DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

cg_bind(2)


cg_bind -- set a target CPU-Group for a process or its children

Synopsis

#include <sys/cguser.h>

int cg_bind( idtype_t idtype, id_t id, cgid_t cgid, int flags, cgid_t *ocgid, int *oflags);

Description

cg_bind directs the system in the placement of a process, of subsequently executed process images or of process children.

The combination of idtype and id specifies the process or LWP of interest. When idtype is P_PID, id is interpreted as a process id; the special value P_MYID may be used as shorthand for the calling process. When idtype is P_LWPID, id is interpreted as the LWP id of an LWP within the calling process; the special value P_MYID may be used as shorthand for the calling LWP. In either case, an attempt to bind a multi-threaded process will be rejected (a restriction that may be relaxed in a future release).

The cgid parameter is the target CPU-Group; additional values are reserved to mean:


CG_QUERY
query without altering

CG_CURRENT
bind to the CPU-Group to which the target process currently belongs

CG_NONE
unbind

CG_DEFAULT
restore default binding behavior (with CGBIND_FORK only)
The flags parameter may have the following values:

CGBIND_NOW
bind the target now

CGBIND_FORK
bind processes forked by the target

CGBIND_EXEC
a reserved value with currently unimplemented functionality
The pointers ocgid and oflags, if not NULL, are used to pass back the values that were in effect prior to the call.

Return values

On success, cg_bind returns 0. On failure, cg_bind returns -1 and sets errno to indicate the error:

[EAGAIN]
For a CGBIND_NOW operation, the target CPU-Group is currently offline.

[EFAULT]
ocgid or oflags points outside the allocated address space of the calling process.

[EINVAL]
idtype has an invalid value.

[EINVAL]
cgid does not refer to a valid CPU-Group.

[EINVAL]
flags has an invalid value.

[EINVAL]
A binding operation was attempted on a multi-threaded process.

[EPERM]
The caller does not have appropriate privileges for this call. The real or effective user ID of the calling process must match the real or saved (from exec) user ID of the target process, unless the caller has the P_OWNER privilege.

[ESRCH]
No process can be found corresponding to that specified by id.

[ENOSYS]
The cg_bind call is not supported by the system.

References

cg_ids(2), cg_info(2), sysconf(3C)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004