HP-UX Reference (11i v2 03/08) - 2 System Calls (vol 5)

p
pset_bind(2) pset_bind(2)
process to an empty processor set is to fail the request.
The child process and its first thread created by a
fork() or vfork() function will inherit the proces-
sor set binding from the parent process. The new threads in the multi-threaded process will inherit their
processor set binding from the creator thread.
EXAMPLE
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);
}
RETURN VALUE
pset_bind() returns zero on successful completion. Otherwise, -1 is returned and errno is set to
indicate the error.
ERRORS
pset_bind fails if one or more of the following is true:
[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 operation
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 processor
set.
[EPERM] The specified thread or process is a system daemon.
[ESRCH] The specified thread, process, user id, or process group does not exist.
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).
Section 2224 Hewlett-Packard Company 2 HP-UX 11i Version 2: August 2003