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>

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man3c/rctlblk_set_value.3c.man.txt
          +++ new/usr/src/man/man3c/rctlblk_set_value.3c.man.txt
↓ open down ↓ 273 lines elided ↑ open up ↑
 274  274  
 275  275  
 276  276         The following example displays the contents of a fetched resource
 277  277         control block.
 278  278  
 279  279  
 280  280           #include <rctl.h>
 281  281           #include <stdio.h>
 282  282           #include <stdlib.h>
 283  283  
 284      -         rctlblk_t *rblk;
 285      -         int rsignal;
 286      -         int raction;
      284 +         int
      285 +         main()
      286 +         {
      287 +              rctlblk_t *rblk;
      288 +              int rsignal, raction;
 287  289  
 288      -         if ((rblk = malloc(rctlblk_size())) == NULL) {
 289      -                (void) perror("rblk malloc");
 290      -                exit(1);
 291      -         }
      290 +              if ((rblk = malloc(rctlblk_size())) == NULL) {
      291 +                   (void) perror("rblk malloc");
      292 +                   exit(1);
      293 +              }
 292  294  
 293      -         if (getrctl("process.max-cpu-time", NULL, rblk, RCTL_FIRST) == -1) {
 294      -                (void) perror("getrctl");
 295      -                exit(1);
 296      -         }
      295 +              if (getrctl("process.max-cpu-time", NULL, rblk, RCTL_FIRST) == -1) {
      296 +                   (void) perror("getrctl");
      297 +                   exit(1);
      298 +              }
 297  299  
 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));
      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);
 319  321           }
 320  322  
 321  323  
 322  324  ATTRIBUTES
 323  325         See attributes(5) for descriptions of the following attributes:
 324  326  
 325  327  
 326  328  
 327  329  
 328  330         +--------------------+-----------------+
↓ open down ↓ 2 lines elided ↑ open up ↑
 331  333         |Interface Stability | Evolving        |
 332  334         +--------------------+-----------------+
 333  335         |MT-Level            | MT-Safe         |
 334  336         +--------------------+-----------------+
 335  337  
 336  338  SEE ALSO
 337  339         rctladm(1M), getrctl(2), setrctl(2), gethrtime(3C), attributes(5)
 338  340  
 339  341  
 340  342  
 341      -                                 May 15, 2006            RCTLBLK_SET_VALUE(3C)
      343 +                                August 2, 2016           RCTLBLK_SET_VALUE(3C)
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX