Print this page
7264 Example code is rctlblk_set_value(3c) manpage does not compile.
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Toomas Soome <tsoome@me.com>

*** 279,291 **** #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); } --- 279,293 ---- #include <rctl.h> #include <stdio.h> #include <stdlib.h> + int + main() + { rctlblk_t *rblk; ! int rsignal, raction; if ((rblk = malloc(rctlblk_size())) == NULL) { (void) perror("rblk malloc"); exit(1); }
*** 293,323 **** 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("Enforced value: %llu\n", rctlblk_get_enforced_value(rblk)); } ATTRIBUTES See attributes(5) for descriptions of the following attributes: --- 295,325 ---- if (getrctl("process.max-cpu-time", NULL, rblk, RCTL_FIRST) == -1) { (void) perror("getrctl"); exit(1); } raction = rctlblk_get_local_action(rblk, &rsignal), (void) printf("Resource control for %s\n", "process.max-cpu-time"); (void) printf("Process ID: %d\n", ! (int)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("Enforced value: %llu\n", rctlblk_get_enforced_value(rblk)); + + return (0); } ATTRIBUTES See attributes(5) for descriptions of the following attributes:
*** 336,341 **** SEE ALSO rctladm(1M), getrctl(2), setrctl(2), gethrtime(3C), attributes(5) ! May 15, 2006 RCTLBLK_SET_VALUE(3C) --- 338,343 ---- SEE ALSO rctladm(1M), getrctl(2), setrctl(2), gethrtime(3C), attributes(5) ! August 2, 2016 RCTLBLK_SET_VALUE(3C)