264 The various set routines have no return values. Incorrectly composed
265 resource control blocks will generate errors when used with setrctl(2)
266 or getrctl(2).
267
268 ERRORS
269 No error values are returned. Incorrectly constructed resource control
270 blocks will be rejected by the system calls.
271
272 EXAMPLES
273 Example 1 Display the contents of a fetched resource control block.
274
275
276 The following example displays the contents of a fetched resource
277 control block.
278
279
280 #include <rctl.h>
281 #include <stdio.h>
282 #include <stdlib.h>
283
284 rctlblk_t *rblk;
285 int rsignal;
286 int raction;
287
288 if ((rblk = malloc(rctlblk_size())) == NULL) {
289 (void) perror("rblk malloc");
290 exit(1);
291 }
292
293 if (getrctl("process.max-cpu-time", NULL, rblk, RCTL_FIRST) == -1) {
294 (void) perror("getrctl");
295 exit(1);
296 }
297
298 main()
299 {
300 raction = rctlblk_get_local_action(rblk, &rsignal),
301 (void) printf("Resource control for %s\n",
302 "process.max-cpu-time");
303 (void) printf("Process ID: %d\n",
304 rctlblk_get_recipient_pid(rblk));
305 (void) printf("Privilege: %x\n"
306 rctlblk_get_privilege(rblk));
307 (void) printf("Global flags: %x\n"
308 rctlblk_get_global_flags(rblk));
309 (void) printf("Global actions: %x\n"
310 rctlblk_get_global_action(rblk));
311 (void) printf("Local flags: %x\n"
312 rctlblk_get_local_flags(rblk));
313 (void) printf("Local action: %x (%d)\n"
314 raction, raction == RCTL_LOCAL_SIGNAL ? rsignal : 0);
315 (void) printf("Value: %llu\n",
316 rctlblk_get_value(rblk));
317 (void) printf("Enforced value: %llu\n",
318 rctlblk_get_enforced_value(rblk));
319 }
320
321
322 ATTRIBUTES
323 See attributes(5) for descriptions of the following attributes:
324
325
326
327
328 +--------------------+-----------------+
329 | ATTRIBUTE TYPE | ATTRIBUTE VALUE |
330 +--------------------+-----------------+
331 |Interface Stability | Evolving |
332 +--------------------+-----------------+
333 |MT-Level | MT-Safe |
334 +--------------------+-----------------+
335
336 SEE ALSO
337 rctladm(1M), getrctl(2), setrctl(2), gethrtime(3C), attributes(5)
338
339
340
341 May 15, 2006 RCTLBLK_SET_VALUE(3C)
|
264 The various set routines have no return values. Incorrectly composed
265 resource control blocks will generate errors when used with setrctl(2)
266 or getrctl(2).
267
268 ERRORS
269 No error values are returned. Incorrectly constructed resource control
270 blocks will be rejected by the system calls.
271
272 EXAMPLES
273 Example 1 Display the contents of a fetched resource control block.
274
275
276 The following example displays the contents of a fetched resource
277 control block.
278
279
280 #include <rctl.h>
281 #include <stdio.h>
282 #include <stdlib.h>
283
284 int
285 main()
286 {
287 rctlblk_t *rblk;
288 int rsignal, raction;
289
290 if ((rblk = malloc(rctlblk_size())) == NULL) {
291 (void) perror("rblk malloc");
292 exit(1);
293 }
294
295 if (getrctl("process.max-cpu-time", NULL, rblk, RCTL_FIRST) == -1) {
296 (void) perror("getrctl");
297 exit(1);
298 }
299
300 raction = rctlblk_get_local_action(rblk, &rsignal),
301 (void) printf("Resource control for %s\n",
302 "process.max-cpu-time");
303 (void) printf("Process ID: %d\n",
304 (int)rctlblk_get_recipient_pid(rblk));
305 (void) printf("Privilege: %x\n",
306 rctlblk_get_privilege(rblk));
307 (void) printf("Global flags: %x\n",
308 rctlblk_get_global_flags(rblk));
309 (void) printf("Global actions: %x\n",
310 rctlblk_get_global_action(rblk));
311 (void) printf("Local flags: %x\n",
312 rctlblk_get_local_flags(rblk));
313 (void) printf("Local action: %x (%d)\n",
314 raction, raction == RCTL_LOCAL_SIGNAL ? rsignal : 0);
315 (void) printf("Value: %llu\n",
316 rctlblk_get_value(rblk));
317 (void) printf("Enforced value: %llu\n",
318 rctlblk_get_enforced_value(rblk));
319
320 return (0);
321 }
322
323
324 ATTRIBUTES
325 See attributes(5) for descriptions of the following attributes:
326
327
328
329
330 +--------------------+-----------------+
331 | ATTRIBUTE TYPE | ATTRIBUTE VALUE |
332 +--------------------+-----------------+
333 |Interface Stability | Evolving |
334 +--------------------+-----------------+
335 |MT-Level | MT-Safe |
336 +--------------------+-----------------+
337
338 SEE ALSO
339 rctladm(1M), getrctl(2), setrctl(2), gethrtime(3C), attributes(5)
340
341
342
343 August 2, 2016 RCTLBLK_SET_VALUE(3C)
|