HP-UX Reference (11i v3 07/02) - 2 System Calls (vol 5)
p
pset_bind(2) pset_bind(2)
If pset is empty (no processors are assigned as yet), the behavior of
pset_bind() function depends on
the value of
PSET_ATTR_EMPTY
attribute. The default behavior on an attempt to bind a thread or a pro-
cess to an empty processor set is to fail the request.
The child process and its first thread created by a
fork() or vfork() function inherits the processor set
binding from the parent process. The new threads in the multi-threaded process inherits their processor
set binding from the creator thread.
Security Restrictions
Some or all of the actions associated with this system call require the
PSET privilege. Processes owned by
the superuser have this privilege. Processes owned by other users may have this privilege, depending on
system configuration. See privileges (5) for more information about privileged access on systems that sup-
port fine-grained privileges.
RETURN VALUE
pset_bind() returns the following values:
0 Successful completion.
-1 Failure. errno is set to indicate the error.
ERRORS
pset_bind sets errno to one of the following values if the corresponding condition occurs.
[EFAULT] The memory location pointed to by opset is not writable by the user.
[EINVAL] pset is not valid.
[EINVAL] idtype or id is not valid.
[EINVAL] pset is empty and the current setting of processor set attributes does not allow this opera-
tion on an empty processor set.
[EINVAL] The memory location pointed to by opset is NULL and the
PS_QUERY operation is
requested.
[ENOSYS] The processor set functionality is not supported by the underlying HP-UX version.
[EPERM] User does not have necessary permissions to bind a thread or a process to specified proces-
sor set.
[EPERM] The specified thread or process is a system daemon.
[ESRCH] The specified thread, process, user ID, or process group does not exist.
EXAMPLES
Migrate the current thread to another processor set new_pset, and retrive its current processor set in
old_pset.
#include <sys/pset.h>
int ret;
psetid_t new_pset, old_pset;
/*
* Initialize new_pset first.
* Rebind the current thread to new_pset.
*/
ret = pset_bind( new_pset, P_LWPID, P_MYID, &old_pset);
if (ret < 0) {
perror("pset_bind");
exit(1);
}
SEE ALSO
psrset(1M), fork(2), pset_assign(2), pset_create(2), pset_ctl(2), pset_destroy(2), pset_getattr(2),
pset_setattr(2), vfork(2), privgrp(4), privileges(5).
HP-UX 11i Version 3: February 2007 − 2 − Hewlett-Packard Company 279