Print this page
Code review comments from jeffpc


2604 #if (CONV_PRSECFLAGS_BUFSIZE != PROCSECFLGSZ) && !defined(__lint)
2605 #define REPORT_BUFSIZE PROCSECFLGSZ
2606 #include "report_bufsize.h"
2607 #error "CONV_PRSECFLAGS_BUFSIZE does not match PROCSECFLGSZ"
2608 #endif
2609 
2610 const char *
2611 conv_prsecflags(secflagset_t flags, Conv_fmt_flags_t fmt_flags,
2612     Conv_secflags_buf_t *secflags_buf)
2613 {
2614         /*
2615          * The values are initialized later, based on position in this array
2616          */
2617         static Val_desc vda[] = {
2618                 { 0, MSG_ASLR },
2619                 { 0, MSG_FORBIDNULLMAP },
2620                 { 0, MSG_NOEXECSTACK },
2621                 { 0, 0 }
2622         };
2623         static CONV_EXPN_FIELD_ARG conv_arg = {
2624             NULL, sizeof (secflags_buf->buf) };

2625         int i;
2626 
2627         for (i = 0; vda[i].v_msg != 0; i++) {
2628                 vda[i].v_val = secflag_to_bit(i);
2629         }
2630 
2631         if (flags == 0)
2632                 return (MSG_ORIG(MSG_GBL_ZERO));
2633 
2634         conv_arg.buf = secflags_buf->buf;
2635         conv_arg.oflags = conv_arg.rflags = flags;
2636         (void) conv_expn_field(&conv_arg, vda, fmt_flags);
2637 
2638         return ((const char *)secflags_buf->buf);
2639 }


2604 #if (CONV_PRSECFLAGS_BUFSIZE != PROCSECFLGSZ) && !defined(__lint)
2605 #define REPORT_BUFSIZE PROCSECFLGSZ
2606 #include "report_bufsize.h"
2607 #error "CONV_PRSECFLAGS_BUFSIZE does not match PROCSECFLGSZ"
2608 #endif
2609 
2610 const char *
2611 conv_prsecflags(secflagset_t flags, Conv_fmt_flags_t fmt_flags,
2612     Conv_secflags_buf_t *secflags_buf)
2613 {
2614         /*
2615          * The values are initialized later, based on position in this array
2616          */
2617         static Val_desc vda[] = {
2618                 { 0, MSG_ASLR },
2619                 { 0, MSG_FORBIDNULLMAP },
2620                 { 0, MSG_NOEXECSTACK },
2621                 { 0, 0 }
2622         };
2623         static CONV_EXPN_FIELD_ARG conv_arg = {
2624             NULL, sizeof (secflags_buf->buf)
2625         };
2626         int i;
2627 
2628         for (i = 0; vda[i].v_msg != 0; i++)
2629                 vda[i].v_val = secflag_to_bit(i);

2630 
2631         if (flags == 0)
2632                 return (MSG_ORIG(MSG_GBL_ZERO));
2633 
2634         conv_arg.buf = secflags_buf->buf;
2635         conv_arg.oflags = conv_arg.rflags = flags;
2636         (void) conv_expn_field(&conv_arg, vda, fmt_flags);
2637 
2638         return ((const char *)secflags_buf->buf);
2639 }