Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
#include <sys/types.h> #include <sys/task.h> #include <unistd.h> taskid_t settaskid(projid_t project, int flags);
taskid_t gettaskid(void);
#include <sys/types.h> #include <sys/task.h> #include <unistd.h> #include <project.h> projid_t getprojid(void);
The settaskid() function makes a request of the system to assign a new task ID to the calling process, changing the associated project ID to that specified. The calling process must have sufficient privileges to perform this operation. The flags argument should be either TASK_NORMAL for a regular task, or TASK_FINAL, which disallows subsequent settaskid() calls by the created task.
The gettaskid() function returns the task ID of the calling process.
The getprojid() function returns the project ID of the calling process.
Upon successful completion, these functions return the appropriate task or project ID. Otherwise, -1 is returned and errno is set to indicate the error.
The settaskid() function will fail if: EACCES
The invoking task was created with the TASK_FINAL flag.
A resource control limiting the number of tasks or LWPs in the current project or zone has been exceeded. A resource control on the given project would be exceeded.
The given project ID is not within the valid project ID range.
The {PRIV_PROC_TASKID} privilege is not asserted in the effective set of the calling process.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE |
MT-Level Async-Signal-Safe |
setsid(2), project(4), attributes(5), privileges(5)