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,13 +279,15 @@
 
          #include <rctl.h>
          #include <stdio.h>
          #include <stdlib.h>
 
+         int
+         main()
+         {
          rctlblk_t *rblk;
-         int rsignal;
-         int raction;
+              int rsignal, raction;
 
          if ((rblk = malloc(rctlblk_size())) == NULL) {
                 (void) perror("rblk malloc");
                 exit(1);
          }

@@ -293,31 +295,31 @@
          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"
+                  (int)rctlblk_get_recipient_pid(rblk));
+              (void) printf("Privilege:      %x\n",
                  rctlblk_get_privilege(rblk));
-             (void) printf("Global flags:   %x\n"
+              (void) printf("Global flags:   %x\n",
                  rctlblk_get_global_flags(rblk));
-             (void) printf("Global actions: %x\n"
+              (void) printf("Global actions: %x\n",
                  rctlblk_get_global_action(rblk));
-             (void) printf("Local flags:    %x\n"
+              (void) printf("Local flags:    %x\n",
                  rctlblk_get_local_flags(rblk));
-             (void) printf("Local action:   %x (%d)\n"
+              (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,6 +338,6 @@
 SEE ALSO
        rctladm(1M), getrctl(2), setrctl(2), gethrtime(3C), attributes(5)
 
 
 
-                                 May 15, 2006            RCTLBLK_SET_VALUE(3C)
+                                August 2, 2016           RCTLBLK_SET_VALUE(3C)