| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 3: Basic Library Functions Oracle Solaris 11 Information Library |
enable_extended_FILE_stdio(3C)
posix_spawnattr_getschedparam(3C)
posix_spawnattr_getschedpolicy(3C)
posix_spawnattr_getsigdefault(3C)
posix_spawnattr_getsigignore_np(3C)
posix_spawnattr_getsigmask(3C)
posix_spawnattr_setschedparam(3C)
posix_spawnattr_setschedpolicy(3C)
posix_spawnattr_setsigdefault(3C)
posix_spawnattr_setsigignore_np(3C)
posix_spawnattr_setsigmask(3C)
posix_spawn_file_actions_addclose(3C)
posix_spawn_file_actions_addclosefrom_np(3C)
posix_spawn_file_actions_adddup2(3C)
posix_spawn_file_actions_addopen(3C)
posix_spawn_file_actions_destroy(3C)
posix_spawn_file_actions_init(3C)
pthread_attr_getdetachstate(3C)
pthread_attr_getinheritsched(3C)
pthread_attr_getschedparam(3C)
pthread_attr_getschedpolicy(3C)
pthread_attr_setdetachstate(3C)
pthread_attr_setinheritsched(3C)
pthread_attr_setschedparam(3C)
pthread_attr_setschedpolicy(3C)
pthread_barrierattr_destroy(3C)
pthread_barrierattr_getpshared(3C)
pthread_barrierattr_setpshared(3C)
pthread_condattr_getpshared(3C)
pthread_condattr_setpshared(3C)
pthread_cond_reltimedwait_np(3C)
pthread_key_create_once_np(3C)
pthread_mutexattr_getprioceiling(3C)
pthread_mutexattr_getprotocol(3C)
pthread_mutexattr_getpshared(3C)
pthread_mutexattr_getrobust(3C)
pthread_mutexattr_setprioceiling(3C)
pthread_mutexattr_setprotocol(3C)
pthread_mutexattr_setpshared(3C)
pthread_mutexattr_setrobust(3C)
pthread_mutex_getprioceiling(3C)
pthread_mutex_reltimedlock_np(3C)
pthread_mutex_setprioceiling(3C)
pthread_rwlockattr_destroy(3C)
pthread_rwlockattr_getpshared(3C)
pthread_rwlockattr_setpshared(3C)
pthread_rwlock_reltimedrdlock_np(3C)
pthread_rwlock_reltimedwrlock_np(3C)
pthread_rwlock_timedrdlock(3C)
pthread_rwlock_timedwrlock(3C)
rctlblk_get_enforced_value(3C)
- privilege name functions
#include <priv.h>priv_set_t *priv_str_to_set(const char *buf,const char *sep,const char **endptr);
char *priv_set_to_str(const priv_set_t *set,charsep,intflag);
intpriv_getbyname(const char *privname);
const char *priv_getbynum(intprivnum);
intpriv_getsetbyname(const char *privsetname);
const char *priv_getsetbynum(intprivname);
char *priv_gettext(const char *privname);
Thepriv_str_to_set() function maps the privilege specification inbuf to a privilegeset. It returns a privilege set on success orNULL on failure.If an error occurs when parsing the string, a pointer to theremainder of the string is stored in the object pointed to byendptr,provided thatendptr is not a null pointer. If an error occurswhen allocating memory,errno is set and the object pointed to byendptr is set to the null pointer, provided thatendptr is not anull pointer.
The application is responsible for freeing the returned privilege set usingpriv_freeset(3C).
A privilege specification should contain one or more privilege names, separated bycharacters insep using the same algorithm asstrtok(3C). Privileges can optionally bepreceded by a dash (-) or an exclamation mark (!), in whichcase they are excluded from the resulting set. The special strings “none”for the empty set, “all” for the set of all privileges, “zone”for the set of all privileges available within the caller's zone, and “basic”for the set of basic privileges are also recognized. Set specifications areinterpreted from left to right.
Thepriv_set_to_str() function converts the privilege set to a sequence of privilegesseparated bysep, returning the a pointer to the dynamically allocated result.The application is responsible for freeing the memory usingfree(3C).
To maintain future compatibility, the “basic” set of privileges is included as“basic,!missing_basic_priv1,...”. When further currently unprivileged operations migrate to the basic privilege set,the conversion back of the result withpriv_str_to_set() includes the additional basic privileges,guaranteeing that the resulting privilege set carries the same privileges. This behavioris the default and is equivalent to specifying aflag argument ofPRIV_STR_PORT. When specifying aflag argument ofPRIV_STR_LIT, the result does not treatbasic privileges differently and the privileges present are all literally presented inthe output. A flag argument ofPRIV_STR_SHORT attempts to arrive at theshortest output, using the tokens “basic”, “zone”, “all”, and negated privileges. This outputis most useful for trace output.
Thepriv_getbyname() andpriv_getsetbyname() functions map privilege names and privilege set namesto numbers. The numbers returned are valid for the current kernel instanceonly and could change at the next boot. Only the privilege namesshould be committed to persistent storage. The numbers should not be committed topersistent storage. Both functions return -1 on error, settingerrno toEINVAL.
Thepriv_getbynum() andpriv_getsetbynum() functions map privileges numbers to names. The stringsreturned point to shared storage that should not be modified and isvalid for the lifetime of the process. Both functions returnNULL on error,settingerrno toEINVAL.
Thepriv_gettext() function returns a pointer to a string consisting of oneor more newline-separated lines of text describing the privilege. The text islocalized using {LC_MESSAGES}. The application is responsible for freeing the memory returned.
These functions pick up privileges allocated during the lifetime of the processusingpriv_getbyname(9F) by refreshing the internal data structures when necessary.
Upon successful completion,priv_str_to_set() andpriv_set_to_str() return a non-null pointer to allocatedmemory that should be freed by the application using the appropriate functionswhen it is no longer referenced.
Thepriv_getbynum() andpriv_getsetbynum() functions return non-null pointers to constant memory thatshould not be modified or freed by the application. Otherwise,NULL isreturned anderrno is set to indicate the error.
Upon successful completion,priv_getbyname() andpriv_getsetbyname() return a non-negative integer. Otherwise, -1is returned anderrno is set to indicate the error.
Upon successful completion,priv_gettext() returns a non-null value. It returnsNULL ifan error occurs or no descriptive text for the specified privilege canbe found.
Thepriv_str_to_set() andpriv_set_to_str() functions will fail if:
The physical limits of the system are exceeded by the memory allocation needed to hold a privilege set.
There is not enough memory available to allocate sufficient memory to hold a privilege set, but the application could try again later.
All of these functions will fail if:
One or more of the arguments is invalid.
Example 1 List all the sets and privileges defined in the system.
The following example lists all the sets and privileges defined in thesystem.
#include <priv.h>#include <stdio.h>/* list all the sets and privileges defined in the system */const char *name;int i;printf("Each process has the following privilege sets:\n");for (i = 0; (name = priv_getsetbynum(i++)) != NULL; ) printf("\t%s\n", name);printf("Each set can contain the following privileges:\n");for (i = 0; (name = priv_getbynum(i++)) != NULL; ) printf("\t%s\n", name);Seeattributes(5) for descriptions of the following attributes:
|
free(3C),priv_set(3C),attributes(5),privileges(5),priv_getbyname(9F)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |