1 '\" te
2 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH RCTLBLK_SET_VALUE 3C "May 15, 2006"
7 .SH NAME
8 rctlblk_set_value, rctlblk_get_firing_time, rctlblk_get_global_action,
9 rctlblk_get_global_flags, rctlblk_get_local_action, rctlblk_get_local_flags,
10 rctlblk_get_privilege, rctlblk_get_recipient_pid, rctlblk_get_value,
11 rctlblk_get_enforced_value, rctlblk_set_local_action, rctlblk_set_local_flags,
12 rctlblk_set_privilege, rctlblk_set_recipient_pid, rctlblk_size \- manipulate
13 resource control blocks
14 .SH SYNOPSIS
15 .LP
16 .nf
17 #include <rctl.h>
18
19 \fBhrtime_t\fR \fBrctlblk_get_firing_time\fR(\fBrctlblk_t *\fR\fIrblk\fR);
20 .fi
21
22 .LP
23 .nf
24 \fBint\fR \fBrctlblk_get_global_action\fR(\fBrctlblk_t *\fR\fIrblk\fR);
25 .fi
26
74 .nf
75 \fBvoid\fR \fBrctlblk_set_privilege\fR(\fBrctlblk_t *\fR\fIrblk\fR, \fBrctl_priv_t\fR \fIprivilege\fR);
76 .fi
77
78 .LP
79 .nf
80 \fBvoid\fR \fBrctlblk_set_value\fR(\fBrctlblk_t *\fR\fIrblk\fR, \fBrctl_qty_t\fR \fIvalue\fR);
81 .fi
82
83 .LP
84 .nf
85 \fBvoid\fR \fBrctlblk_set_recipient_pid\fR(\fBid_t\fR\fIpid\fR);
86 .fi
87
88 .LP
89 .nf
90 \fBsize_t\fR \fBrctlblk_size\fR(\fBvoid\fR);
91 .fi
92
93 .SH DESCRIPTION
94 .sp
95 .LP
96 The resource control block routines allow the establishment or retrieval of
97 values from a resource control block used to transfer information using the
98 \fBgetrctl\fR(2) and \fBsetrctl\fR(2) functions. Each of the routines accesses
99 or sets the resource control block member corresponding to its name. Certain
100 of these members are read-only and do not possess set routines.
101 .sp
102 .LP
103 The firing time of a resource control block is 0 if the resource control
104 action-value has not been exceeded for its lifetime on the process. Otherwise
105 the firing time is the value of \fBgethrtime\fR(3C) at the moment the action on
106 the resource control value was taken.
107 .sp
108 .LP
109 The global actions and flags are the action and flags set by \fBrctladm\fR(1M).
110 These values cannot be set with \fBsetrctl\fR(2). Valid global actions are
111 listed in the table below. Global flags are generally a published property of
112 the control and are not modifiable.
113 .sp
114 .ne 2
337 privilege to write, unless the \fBRCTL_GLOBAL_LOWERABLE\fR global flag is set,
338 in which case unprivileged applications can lower the value of a privileged
339 control.
340 .sp
341 .LP
342 The \fBrctlblk_get_value()\fR and \fBrctlblk_set_value()\fR functions return or
343 establish the enforced value associated with the resource control. In cases
344 where the process, task, or project associated with the control possesses fewer
345 capabilities than allowable by the current value, the value returned by
346 \fBrctlblk_get_enforced_value()\fR will differ from that returned by
347 \fBrctlblk_get_value()\fR. This capability difference arises with processes
348 using an address space model smaller than the maximum address space model
349 supported by the system.
350 .sp
351 .LP
352 The \fBrctlblk_size()\fR function returns the size of a resource control block
353 for use in memory allocation. The \fBrctlblk_t *\fR type is an opaque pointer
354 whose size is not connected with that of the resource control block itself. Use
355 of \fBrctlblk_size()\fR is illustrated in the example below.
356 .SH RETURN VALUES
357 .sp
358 .LP
359 The various set routines have no return values. Incorrectly composed resource
360 control blocks will generate errors when used with \fBsetrctl\fR(2) or
361 \fBgetrctl\fR(2).
362 .SH ERRORS
363 .sp
364 .LP
365 No error values are returned. Incorrectly constructed resource control blocks
366 will be rejected by the system calls.
367 .SH EXAMPLES
368 .LP
369 \fBExample 1 \fRDisplay the contents of a fetched resource control block.
370 .sp
371 .LP
372 The following example displays the contents of a fetched resource control
373 block.
374
375 .sp
376 .in +2
377 .nf
378 #include <rctl.h>
379 #include <stdio.h>
380 #include <stdlib.h>
381
382 rctlblk_t *rblk;
383 int rsignal;
384 int raction;
385
386 if ((rblk = malloc(rctlblk_size())) == NULL) {
387 (void) perror("rblk malloc");
388 exit(1);
389 }
390
391 if (getrctl("process.max-cpu-time", NULL, rblk, RCTL_FIRST) == -1) {
392 (void) perror("getrctl");
393 exit(1);
394 }
395
396 main()
397 {
398 raction = rctlblk_get_local_action(rblk, &rsignal),
399 (void) printf("Resource control for %s\en",
400 "process.max-cpu-time");
401 (void) printf("Process ID: %d\en",
402 rctlblk_get_recipient_pid(rblk));
403 (void) printf("Privilege: %x\en"
404 rctlblk_get_privilege(rblk));
405 (void) printf("Global flags: %x\en"
406 rctlblk_get_global_flags(rblk));
407 (void) printf("Global actions: %x\en"
408 rctlblk_get_global_action(rblk));
409 (void) printf("Local flags: %x\en"
410 rctlblk_get_local_flags(rblk));
411 (void) printf("Local action: %x (%d)\en"
412 raction, raction == RCTL_LOCAL_SIGNAL ? rsignal : 0);
413 (void) printf("Value: %llu\en",
414 rctlblk_get_value(rblk));
415 (void) printf("\tEnforced value: %llu\en",
416 rctlblk_get_enforced_value(rblk));
417 }
418 .fi
419 .in -2
420
421 .SH ATTRIBUTES
422 .sp
423 .LP
424 See \fBattributes\fR(5) for descriptions of the following attributes:
425 .sp
426
427 .sp
428 .TS
429 box;
430 c | c
431 l | l .
432 ATTRIBUTE TYPE ATTRIBUTE VALUE
433 _
434 Interface Stability Evolving
435 _
436 MT-Level MT-Safe
437 .TE
438
439 .SH SEE ALSO
440 .sp
441 .LP
442 \fBrctladm\fR(1M), \fBgetrctl\fR(2), \fBsetrctl\fR(2), \fBgethrtime\fR(3C),
443 \fBattributes\fR(5)
|
1 '\" te
2 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH RCTLBLK_SET_VALUE 3C "Aug 2, 2016"
7 .SH NAME
8 rctlblk_set_value, rctlblk_get_firing_time, rctlblk_get_global_action,
9 rctlblk_get_global_flags, rctlblk_get_local_action, rctlblk_get_local_flags,
10 rctlblk_get_privilege, rctlblk_get_recipient_pid, rctlblk_get_value,
11 rctlblk_get_enforced_value, rctlblk_set_local_action, rctlblk_set_local_flags,
12 rctlblk_set_privilege, rctlblk_set_recipient_pid, rctlblk_size \- manipulate
13 resource control blocks
14 .SH SYNOPSIS
15 .LP
16 .nf
17 #include <rctl.h>
18
19 \fBhrtime_t\fR \fBrctlblk_get_firing_time\fR(\fBrctlblk_t *\fR\fIrblk\fR);
20 .fi
21
22 .LP
23 .nf
24 \fBint\fR \fBrctlblk_get_global_action\fR(\fBrctlblk_t *\fR\fIrblk\fR);
25 .fi
26
74 .nf
75 \fBvoid\fR \fBrctlblk_set_privilege\fR(\fBrctlblk_t *\fR\fIrblk\fR, \fBrctl_priv_t\fR \fIprivilege\fR);
76 .fi
77
78 .LP
79 .nf
80 \fBvoid\fR \fBrctlblk_set_value\fR(\fBrctlblk_t *\fR\fIrblk\fR, \fBrctl_qty_t\fR \fIvalue\fR);
81 .fi
82
83 .LP
84 .nf
85 \fBvoid\fR \fBrctlblk_set_recipient_pid\fR(\fBid_t\fR\fIpid\fR);
86 .fi
87
88 .LP
89 .nf
90 \fBsize_t\fR \fBrctlblk_size\fR(\fBvoid\fR);
91 .fi
92
93 .SH DESCRIPTION
94 .LP
95 The resource control block routines allow the establishment or retrieval of
96 values from a resource control block used to transfer information using the
97 \fBgetrctl\fR(2) and \fBsetrctl\fR(2) functions. Each of the routines accesses
98 or sets the resource control block member corresponding to its name. Certain
99 of these members are read-only and do not possess set routines.
100 .sp
101 .LP
102 The firing time of a resource control block is 0 if the resource control
103 action-value has not been exceeded for its lifetime on the process. Otherwise
104 the firing time is the value of \fBgethrtime\fR(3C) at the moment the action on
105 the resource control value was taken.
106 .sp
107 .LP
108 The global actions and flags are the action and flags set by \fBrctladm\fR(1M).
109 These values cannot be set with \fBsetrctl\fR(2). Valid global actions are
110 listed in the table below. Global flags are generally a published property of
111 the control and are not modifiable.
112 .sp
113 .ne 2
336 privilege to write, unless the \fBRCTL_GLOBAL_LOWERABLE\fR global flag is set,
337 in which case unprivileged applications can lower the value of a privileged
338 control.
339 .sp
340 .LP
341 The \fBrctlblk_get_value()\fR and \fBrctlblk_set_value()\fR functions return or
342 establish the enforced value associated with the resource control. In cases
343 where the process, task, or project associated with the control possesses fewer
344 capabilities than allowable by the current value, the value returned by
345 \fBrctlblk_get_enforced_value()\fR will differ from that returned by
346 \fBrctlblk_get_value()\fR. This capability difference arises with processes
347 using an address space model smaller than the maximum address space model
348 supported by the system.
349 .sp
350 .LP
351 The \fBrctlblk_size()\fR function returns the size of a resource control block
352 for use in memory allocation. The \fBrctlblk_t *\fR type is an opaque pointer
353 whose size is not connected with that of the resource control block itself. Use
354 of \fBrctlblk_size()\fR is illustrated in the example below.
355 .SH RETURN VALUES
356 .LP
357 The various set routines have no return values. Incorrectly composed resource
358 control blocks will generate errors when used with \fBsetrctl\fR(2) or
359 \fBgetrctl\fR(2).
360 .SH ERRORS
361 .LP
362 No error values are returned. Incorrectly constructed resource control blocks
363 will be rejected by the system calls.
364 .SH EXAMPLES
365 .LP
366 \fBExample 1 \fRDisplay the contents of a fetched resource control block.
367 .sp
368 .LP
369 The following example displays the contents of a fetched resource control
370 block.
371
372 .sp
373 .in +2
374 .nf
375 #include <rctl.h>
376 #include <stdio.h>
377 #include <stdlib.h>
378
379 int
380 main()
381 {
382 rctlblk_t *rblk;
383 int rsignal, raction;
384
385 if ((rblk = malloc(rctlblk_size())) == NULL) {
386 (void) perror("rblk malloc");
387 exit(1);
388 }
389
390 if (getrctl("process.max-cpu-time", NULL, rblk, RCTL_FIRST) == -1) {
391 (void) perror("getrctl");
392 exit(1);
393 }
394
395 raction = rctlblk_get_local_action(rblk, &rsignal),
396 (void) printf("Resource control for %s\en",
397 "process.max-cpu-time");
398 (void) printf("Process ID: %d\en",
399 (int)rctlblk_get_recipient_pid(rblk));
400 (void) printf("Privilege: %x\en",
401 rctlblk_get_privilege(rblk));
402 (void) printf("Global flags: %x\en",
403 rctlblk_get_global_flags(rblk));
404 (void) printf("Global actions: %x\en",
405 rctlblk_get_global_action(rblk));
406 (void) printf("Local flags: %x\en",
407 rctlblk_get_local_flags(rblk));
408 (void) printf("Local action: %x (%d)\en",
409 raction, raction == RCTL_LOCAL_SIGNAL ? rsignal : 0);
410 (void) printf("Value: %llu\en",
411 rctlblk_get_value(rblk));
412 (void) printf("\tEnforced value: %llu\en",
413 rctlblk_get_enforced_value(rblk));
414
415 return (0);
416 }
417 .fi
418 .in -2
419
420 .SH ATTRIBUTES
421 .LP
422 See \fBattributes\fR(5) for descriptions of the following attributes:
423 .sp
424
425 .sp
426 .TS
427 box;
428 c | c
429 l | l .
430 ATTRIBUTE TYPE ATTRIBUTE VALUE
431 _
432 Interface Stability Evolving
433 _
434 MT-Level MT-Safe
435 .TE
436
437 .SH SEE ALSO
438 .LP
439 \fBrctladm\fR(1M), \fBgetrctl\fR(2), \fBsetrctl\fR(2), \fBgethrtime\fR(3C),
440 \fBattributes\fR(5)
|