| 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)
- manipulate resource control blocks
#include <rctl.h>hrtime_trctlblk_get_firing_time(rctlblk_t *rblk);
intrctlblk_get_global_action(rctlblk_t *rblk);
intrctlblk_get_global_flags(rctlblk_t *rblk);
intrctlblk_get_local_action(rctlblk_t *rblk,int *signalp);
intrctlblk_get_local_flags(rctlblk_t *rblk);
rctl_priv_trctlblk_get_privilege(rctlblk_t *rblk);
id_trctlblk_get_recipient_pid(rctlblk_t *rblk);
rctl_qty_trctlblk_get_value(rctlblk_t *rblk);
rctl_qty_trctlblk_get_enforced_value(rctlblk_t *rblk);
voidrctlblk_set_local_action(rctlblk_t *rblk,rctl_action_taction,intsignal);
voidrctlblk_set_local_flags(rctlblk_t *rblk,intflags);
voidrctlblk_set_privilege(rctlblk_t *rblk,rctl_priv_tprivilege);
voidrctlblk_set_value(rctlblk_t *rblk,rctl_qty_tvalue);
voidrctlblk_set_recipient_pid(id_tpid);
size_trctlblk_size(void);
The resource control block routines allow the establishment or retrieval of valuesfrom a resource control block used to transfer information using thegetrctl(2) andsetrctl(2) functions. Each of the routines accesses or sets the resource controlblock member corresponding to its name. Certain of these members areread-only and do not possess set routines.
The firing time of a resource control block is 0 if theresource control action-value has not been exceeded for its lifetime on theprocess. Otherwise the firing time is the value ofgethrtime(3C) at themoment the action on the resource control value was taken.
The global actions and flags are the action and flags set byrctladm(1M). These values cannot be set withsetrctl(2). Valid global actionsare listed in the table below. Global flags are generally a publishedproperty of the control and are not modifiable.
The action taken when a control value is exceeded on this control will always include denial of the resource.
The action taken when a control value is exceeded on this control will always exclude denial of the resource; the resource will always be granted, although other actions can also be taken.
No signal actions are permitted on this control.
The valid signals available as local actions include theSIGXCPU signal.
The valid signals available as local actions include theSIGXFSZ signal.
This resource control supports the concept of an unlimited value; generally true only of accumulation-oriented resources, such as CPU time.
Non-privileged callers are able to lower the value of privileged resource control values on this control.
No global action will be taken when a resource control value is exceeded on this control.
No values with theRCPRIV_BASIC privilege are permitted on this control.
A standard message will be logged by thesyslog(3C) facility when any resource control value on a sequence associated with this control is exceeded.
The resource control does not support thesyslog() global action. Exceeding a resource control value on this control will not result in a message logged by thesyslog() facility.
The resource control (generally on a task- or project-related control) does not support observational control values. AnRCPRIV_BASIC privileged control value placed by a process on the task or process will generate an action only if the value is exceeded by that process.
This resource control represents a number of bytes.
This resource control represents a quantity of time in seconds.
This resource control represents an integer count.
The local action and flags are those on the current resource controlvalue represented by this resource control block. Valid actions and flags arelisted in the table below. In the case ofRCTL_LOCAL_SIGNAL, the secondargument torctlblk_set_local_action() contains the signal to be sent. Similarly, the signalto be sent is copied into the integer location specified by thesecond argument torctlblk_get_local_action(). A restricted set of signals is made availablefor normal use by the resource control facility:SIGBART,SIGXRES,SIGHUP,SIGSTOP,SIGTERM, andSIGKILL. Other signals are permitted due to global properties ofa specific control. Calls tosetrctl() with illegal signals will fail.
When this resource control value is encountered, the request for the resource will be denied. Set on all values ifRCTL_GLOBAL_DENY_ALWAYS is set for this control; cleared on all values ifRCTL_GLOBAL_DENY_NEVER is set for this control.
This resource control value represents a request for the maximum amount of resource for this control. IfRCTL_GLOBAL_INFINITE is set for this resource control,RCTL_LOCAL_MAXIMAL indicates an unlimited resource control value, one that will never be exceeded.
No local action will be taken when this resource control value is exceeded.
The specified signal, sent byrctlblk_set_local_action(), will be sent to the process that placed this resource control value in the value sequence. This behavior is also true for signal actions on project and task resource controls. The specified signal is sent only to the recipient process, not all processes within the project or task.
Therctlblk_get_recipient_pid() function returns the value of the process ID that placedthe resource control value for basic rctls. For privileged or system rctls,rctlblk_get_recipient_pid() returns -1.
Therctlblk_set_recipient_pid() function sets the recipientpid for a basic rctl. Whensetrctl(2) is called with the flagRCTL_USE_RECIPIENT_PID, thispid is used. Otherwise, thePID of the calling process is used. Only privileged users can setthe recipient PID to one other than the PID of the callingprocess. Process-scoped rctls must have a recipient PID that matches the PIDof the calling process.
Therctlblk_get_privilege() function returns the privilege of the resource control block. Validprivileges areRCPRIV_BASIC,RCPRIV_PRIVILEGED, andRCPRIV_SYSTEM. System resource controls are read-only. Privilegedresource controls require the {PRIV_SYS_RESOURCE} privilege to write, unless theRCTL_GLOBAL_LOWERABLE global flagis set, in which case unprivileged applications can lower the value ofa privileged control.
Therctlblk_get_value() andrctlblk_set_value() functions return or establish the enforced value associatedwith the resource control. In cases where the process, task, or projectassociated with the control possesses fewer capabilities than allowable by the current value,the value returned byrctlblk_get_enforced_value() will differ from that returned byrctlblk_get_value().This capability difference arises with processes using an address space model smallerthan the maximum address space model supported by the system.
Therctlblk_size() function returns the size of a resource control block foruse in memory allocation. Therctlblk_t * type is an opaque pointer whosesize is not connected with that of the resource control block itself.Use ofrctlblk_size() is illustrated in the example below.
The various set routines have no return values. Incorrectly composed resource controlblocks will generate errors when used withsetrctl(2) orgetrctl(2).
No error values are returned. Incorrectly constructed resource control blocks will berejected by the system calls.
Example 1 Display the contents of a fetched resource control block.
The following example displays the contents of a fetched resource control block.
#include <rctl.h>#include <stdio.h>#include <stdlib.h>rctlblk_t *rblk;int rsignal;int raction;if ((rblk = malloc(rctlblk_size())) == NULL) { (void) perror("rblk malloc"); exit(1);}if (getrctl("process.max-cpu-time", NULL, rblk, RCTL_FIRST) == -1) { (void) perror("getrctl"); exit(1);}main(){ raction = rctlblk_get_local_action(rblk, &rsignal), (void) printf("Resource control for %s\n", "process.max-cpu-time"); (void) printf("Process ID: %d\n", rctlblk_get_recipient_pid(rblk)); (void) printf("Privilege: %x\n" rctlblk_get_privilege(rblk)); (void) printf("Global flags: %x\n" rctlblk_get_global_flags(rblk)); (void) printf("Global actions: %x\n" rctlblk_get_global_action(rblk)); (void) printf("Local flags: %x\n" rctlblk_get_local_flags(rblk)); (void) printf("Local action: %x (%d)\n" raction, raction == RCTL_LOCAL_SIGNAL ? rsignal : 0); (void) printf("Value: %llu\n", rctlblk_get_value(rblk)); (void) printf("\\tEnforced value: %llu\n", rctlblk_get_enforced_value(rblk));}Seeattributes(5) for descriptions of the following attributes:
|
rctladm(1M),getrctl(2),setrctl(2),gethrtime(3C),attributes(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |