Print this page
    
OS-5192 need faster clock_gettime
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
Reviewed by: Ryan Zezeski <ryan@zinascii.com>
OS-3280 need a way to specify the root of a native system in the lx brand
OS-3279 lx brand should allow delegated datasets
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
OS-2949 add support for AT_RANDOM aux vector entry
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/cmd/sgs/libconv/common/corenote.c
          +++ new/usr/src/cmd/sgs/libconv/common/corenote.c
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5    5   * Common Development and Distribution License (the "License").
   6    6   * You may not use this file except in compliance with the License.
   7    7   *
   8    8   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9    9   * or http://www.opensolaris.org/os/licensing.
  10   10   * See the License for the specific language governing permissions
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  
    | 
      ↓ open down ↓ | 
    17 lines elided | 
    
      ↑ open up ↑ | 
  
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  /*
  27   27   * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
  28      - * Copyright (c) 2013, Joyent, Inc. All rights reserved.
       28 + * Copyright 2016 Joyent, Inc.
  29   29   */
  30   30  
  31   31  /*
  32   32   * String conversion routines the system structs found in
  33   33   * Solaris core file note sections. These items are not
  34   34   * ELF constructs. However, elfdump contains code for decoding
  35   35   * them, and therefore requires formatting support.
  36   36   */
  37   37  #include        <stdio.h>
  38   38  #include        <procfs.h>
  39   39  #include        <sys/corectl.h>
  40   40  #include        <string.h>
  41   41  #include        <_conv.h>
  42   42  #include        <corenote_msg.h>
  43   43  
  44   44  const char *
  45   45  conv_cnote_type(Word type, Conv_fmt_flags_t fmt_flags,
  46   46      Conv_inv_buf_t *inv_buf)
  47   47  {
  48   48          static const Msg        types[] = {
  49   49                  MSG_NT_PRSTATUS,        MSG_NT_PRFPREG,
  50   50                  MSG_NT_PRPSINFO,        MSG_NT_PRXREG,
  51   51                  MSG_NT_PLATFORM,        MSG_NT_AUXV,
  52   52                  MSG_NT_GWINDOWS,        MSG_NT_ASRS,
  53   53                  MSG_NT_LDT,             MSG_NT_PSTATUS,
  54   54                  0,                      0,
  55   55                  MSG_NT_PSINFO,          MSG_NT_PRCRED,
  56   56                  MSG_NT_UTSNAME,         MSG_NT_LWPSTATUS,
  57   57                  MSG_NT_LWPSINFO,        MSG_NT_PRPRIV,
  58   58                  MSG_NT_PRPRIVINFO,      MSG_NT_CONTENT,
  59   59                  MSG_NT_ZONENAME,        MSG_NT_FDINFO,
  60   60                  MSG_NT_SPYMASTER
  61   61          };
  62   62  #if NT_NUM != NT_SPYMASTER
  63   63  #error "NT_NUM has grown. Update core note types[]"
  64   64  #endif
  65   65          static const conv_ds_msg_t ds_types = {
  66   66              CONV_DS_MSG_INIT(NT_PRSTATUS, types) };
  67   67          static const conv_ds_t  *ds[] = { CONV_DS_ADDR(ds_types), NULL };
  68   68  
  
    | 
      ↓ open down ↓ | 
    30 lines elided | 
    
      ↑ open up ↑ | 
  
  69   69  
  70   70          return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
  71   71              inv_buf));
  72   72  }
  73   73  
  74   74  
  75   75  const char *
  76   76  conv_cnote_auxv_type(Word type, Conv_fmt_flags_t fmt_flags,
  77   77      Conv_inv_buf_t *inv_buf)
  78   78  {
  79      -        static const Msg        types_0_22[] = {
       79 +        static const Msg        types_0_25[] = {
  80   80                  MSG_AUXV_AT_NULL,               MSG_AUXV_AT_IGNORE,
  81   81                  MSG_AUXV_AT_EXECFD,             MSG_AUXV_AT_PHDR,
  82   82                  MSG_AUXV_AT_PHENT,              MSG_AUXV_AT_PHNUM,
  83   83                  MSG_AUXV_AT_PAGESZ,             MSG_AUXV_AT_BASE,
  84   84                  MSG_AUXV_AT_FLAGS,              MSG_AUXV_AT_ENTRY,
  85   85                  MSG_AUXV_AT_NOTELF,             MSG_AUXV_AT_UID,
  86   86                  MSG_AUXV_AT_EUID,               MSG_AUXV_AT_GID,
  87   87                  MSG_AUXV_AT_EGID,               MSG_AUXV_AT_PLATFORM,
  88   88                  MSG_AUXV_AT_HWCAP,              MSG_AUXV_AT_CLKTCK,
  89   89                  MSG_AUXV_AT_FPUCW,              MSG_AUXV_AT_DCACHEBSIZE,
  90   90                  MSG_AUXV_AT_ICACHEBSIZE,        MSG_AUXV_AT_UCACHEBSIZE,
  91      -                MSG_AUXV_AT_IGNOREPPC
       91 +                MSG_AUXV_AT_IGNOREPPC,          MSG_AUXV_AT_SECURE,
       92 +                MSG_AUXV_AT_BASE_PLATFORM,      MSG_AUXV_AT_RANDOM
  92   93          };
  93      -        static const conv_ds_msg_t ds_types_0_22 = {
  94      -            CONV_DS_MSG_INIT(0, types_0_22) };
       94 +        static const conv_ds_msg_t ds_types_0_25 = {
       95 +            CONV_DS_MSG_INIT(0, types_0_25) };
  95   96  
  96   97          static const Msg        types_2000_2011[] = {
  97   98                  MSG_AUXV_AT_SUN_UID,            MSG_AUXV_AT_SUN_RUID,
  98   99                  MSG_AUXV_AT_SUN_GID,            MSG_AUXV_AT_SUN_RGID,
  99  100                  MSG_AUXV_AT_SUN_LDELF,          MSG_AUXV_AT_SUN_LDSHDR,
 100  101                  MSG_AUXV_AT_SUN_LDNAME,         MSG_AUXV_AT_SUN_LPAGESZ,
 101  102                  MSG_AUXV_AT_SUN_PLATFORM,       MSG_AUXV_AT_SUN_HWCAP,
 102  103                  MSG_AUXV_AT_SUN_IFLUSH,         MSG_AUXV_AT_SUN_CPU
 103  104          };
 104  105          static const conv_ds_msg_t ds_types_2000_2011 = {
 105  106              CONV_DS_MSG_INIT(2000, types_2000_2011) };
 106  107  
 107      -        static const Msg        types_2014_2023[] = {
      108 +        static const Msg        types_2014_2025[] = {
 108  109                  MSG_AUXV_AT_SUN_EXECNAME,       MSG_AUXV_AT_SUN_MMU,
 109  110                  MSG_AUXV_AT_SUN_LDDATA,         MSG_AUXV_AT_SUN_AUXFLAGS,
 110  111                  MSG_AUXV_AT_SUN_EMULATOR,       MSG_AUXV_AT_SUN_BRANDNAME,
 111  112                  MSG_AUXV_AT_SUN_BRAND_AUX1,     MSG_AUXV_AT_SUN_BRAND_AUX2,
 112      -                MSG_AUXV_AT_SUN_BRAND_AUX3,     MSG_AUXV_AT_SUN_HWCAP2
      113 +                MSG_AUXV_AT_SUN_BRAND_AUX3,     MSG_AUXV_AT_SUN_HWCAP2,
      114 +                MSG_AUXV_AT_SUN_BRAND_NROOT,    MSG_AUXV_AT_SUN_COMMPAGE
 113  115          };
 114      -        static const conv_ds_msg_t ds_types_2014_2023 = {
 115      -            CONV_DS_MSG_INIT(2014, types_2014_2023) };
      116 +        static const conv_ds_msg_t ds_types_2014_2025 = {
      117 +            CONV_DS_MSG_INIT(2014, types_2014_2025) };
 116  118  
 117  119          static const conv_ds_t  *ds[] = {
 118      -                CONV_DS_ADDR(ds_types_0_22), CONV_DS_ADDR(ds_types_2000_2011),
 119      -                CONV_DS_ADDR(ds_types_2014_2023), NULL };
      120 +                CONV_DS_ADDR(ds_types_0_25), CONV_DS_ADDR(ds_types_2000_2011),
      121 +                CONV_DS_ADDR(ds_types_2014_2025), NULL };
 120  122  
 121  123          return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
 122  124              inv_buf));
 123  125  }
 124  126  
 125  127  
 126  128  const char *
 127  129  conv_cnote_signal(Word sig, Conv_fmt_flags_t fmt_flags,
 128  130      Conv_inv_buf_t *inv_buf)
 129  131  {
 130  132          static const Msg        sigarr[] = {
 131  133                  MSG_SIGHUP,             MSG_SIGINT,
 132  134                  MSG_SIGQUIT,            MSG_SIGILL,
 133  135                  MSG_SIGTRAP,            MSG_SIGABRT,
 134  136                  MSG_SIGEMT,             MSG_SIGFPE,
 135  137                  MSG_SIGKILL,            MSG_SIGBUS,
 136  138                  MSG_SIGSEGV,            MSG_SIGSYS,
 137  139                  MSG_SIGPIPE,            MSG_SIGALRM,
 138  140                  MSG_SIGTERM,            MSG_SIGUSR1,
 139  141                  MSG_SIGUSR2,            MSG_SIGCHLD,
 140  142                  MSG_SIGPWR,             MSG_SIGWINCH,
 141  143                  MSG_SIGURG,             MSG_SIGPOLL,
 142  144                  MSG_SIGSTOP,            MSG_SIGTSTP,
 143  145                  MSG_SIGCONT,            MSG_SIGTTIN,
 144  146                  MSG_SIGTTOU,            MSG_SIGVTALRM,
 145  147                  MSG_SIGPROF,            MSG_SIGXCPU,
 146  148                  MSG_SIGXFSZ,            MSG_SIGWAITING,
 147  149                  MSG_SIGLWP,             MSG_SIGFREEZE,
 148  150                  MSG_SIGTHAW,            MSG_SIGCANCEL,
 149  151                  MSG_SIGLOST,            MSG_SIGXRES,
 150  152                  MSG_SIGJVM1,            MSG_SIGJVM2,
 151  153          };
 152  154          static const conv_ds_msg_t ds_sigarr = {
 153  155              CONV_DS_MSG_INIT(SIGHUP, sigarr) };
 154  156  
 155  157          static const conv_ds_t  *ds[] = { CONV_DS_ADDR(ds_sigarr), NULL };
 156  158  
 157  159          return (conv_map_ds(ELFOSABI_NONE, EM_NONE, sig, ds, fmt_flags,
 158  160              inv_buf));
 159  161  }
 160  162  
 161  163  
 162  164  const char *
 163  165  conv_cnote_fault(Word flt, Conv_fmt_flags_t fmt_flags,
 164  166      Conv_inv_buf_t *inv_buf)
 165  167  {
 166  168          static const Msg        fltarr[] = {
 167  169                  MSG_FLTILL,             MSG_FLTPRIV,
 168  170                  MSG_FLTBPT,             MSG_FLTTRACE,
 169  171                  MSG_FLTACCESS,          MSG_FLTBOUNDS,
 170  172                  MSG_FLTIOVF,            MSG_FLTIZDIV,
 171  173                  MSG_FLTFPE,             MSG_FLTSTACK,
 172  174                  MSG_FLTPAGE,            MSG_FLTWATCH,
 173  175                  MSG_FLTCPCOVF
 174  176  
 175  177          };
 176  178          static const conv_ds_msg_t ds_fltarr = {
 177  179              CONV_DS_MSG_INIT(FLTILL, fltarr) };
 178  180  
 179  181          static const conv_ds_t  *ds[] = { CONV_DS_ADDR(ds_fltarr), NULL };
 180  182  
 181  183          return (conv_map_ds(ELFOSABI_NONE, EM_NONE, flt, ds, fmt_flags,
 182  184              inv_buf));
 183  185  }
 184  186  
 185  187  
 186  188  const char *
 187  189  conv_cnote_syscall(Word sysnum, Conv_fmt_flags_t fmt_flags,
 188  190      Conv_inv_buf_t *inv_buf)
 189  191  {
 190  192          static const Msg        sysnumarr[] = {
 191  193                  MSG_SYS_EXIT,                   MSG_SYS_2,
 192  194                  MSG_SYS_READ,                   MSG_SYS_WRITE,
 193  195                  MSG_SYS_OPEN,                   MSG_SYS_CLOSE,
 194  196                  MSG_SYS_7,                      MSG_SYS_8,
 195  197                  MSG_SYS_LINK,                   MSG_SYS_UNLINK,
 196  198                  MSG_SYS_11,                     MSG_SYS_CHDIR,
 197  199                  MSG_SYS_TIME,                   MSG_SYS_MKNOD,
 198  200                  MSG_SYS_CHMOD,                  MSG_SYS_CHOWN,
 199  201                  MSG_SYS_BRK,                    MSG_SYS_STAT,
 200  202                  MSG_SYS_LSEEK,                  MSG_SYS_GETPID,
 201  203                  MSG_SYS_MOUNT,                  MSG_SYS_22,
 202  204                  MSG_SYS_SETUID,                 MSG_SYS_GETUID,
 203  205                  MSG_SYS_STIME,                  MSG_SYS_PCSAMPLE,
 204  206                  MSG_SYS_ALARM,                  MSG_SYS_FSTAT,
 205  207                  MSG_SYS_PAUSE,                  MSG_SYS_30,
 206  208                  MSG_SYS_STTY,                   MSG_SYS_GTTY,
 207  209                  MSG_SYS_ACCESS,                 MSG_SYS_NICE,
 208  210                  MSG_SYS_STATFS,                 MSG_SYS_SYNC,
 209  211                  MSG_SYS_KILL,                   MSG_SYS_FSTATFS,
 210  212                  MSG_SYS_PGRPSYS,                MSG_SYS_UUCOPYSTR,
 211  213                  MSG_SYS_41,                     MSG_SYS_PIPE,
 212  214                  MSG_SYS_TIMES,                  MSG_SYS_PROFIL,
 213  215                  MSG_SYS_FACCESSAT,              MSG_SYS_SETGID,
 214  216                  MSG_SYS_GETGID,                 MSG_SYS_48,
 215  217                  MSG_SYS_MSGSYS,                 MSG_SYS_SYSI86,
 216  218                  MSG_SYS_ACCT,                   MSG_SYS_SHMSYS,
 217  219                  MSG_SYS_SEMSYS,                 MSG_SYS_IOCTL,
 218  220                  MSG_SYS_UADMIN,                 MSG_SYS_FCHOWNAT,
 219  221                  MSG_SYS_UTSSYS,                 MSG_SYS_FDSYNC,
 220  222                  MSG_SYS_EXECVE,                 MSG_SYS_UMASK,
 221  223                  MSG_SYS_CHROOT,                 MSG_SYS_FCNTL,
 222  224                  MSG_SYS_ULIMIT,                 MSG_SYS_RENAMEAT,
 223  225                  MSG_SYS_UNLINKAT,               MSG_SYS_FSTATAT,
 224  226                  MSG_SYS_FSTATAT64,              MSG_SYS_OPENAT,
 225  227                  MSG_SYS_OPENAT64,               MSG_SYS_TASKSYS,
 226  228                  MSG_SYS_ACCTCTL,                MSG_SYS_EXACCTSYS,
 227  229                  MSG_SYS_GETPAGESIZES,           MSG_SYS_RCTLSYS,
 228  230                  MSG_SYS_SIDSYS,                 MSG_SYS_76,
 229  231                  MSG_SYS_LWP_PARK,               MSG_SYS_SENDFILEV,
 230  232                  MSG_SYS_RMDIR,                  MSG_SYS_MKDIR,
 231  233                  MSG_SYS_GETDENTS,               MSG_SYS_PRIVSYS,
 232  234                  MSG_SYS_UCREDSYS,               MSG_SYS_SYSFS,
 233  235                  MSG_SYS_GETMSG,                 MSG_SYS_PUTMSG,
 234  236                  MSG_SYS_87,                     MSG_SYS_LSTAT,
 235  237                  MSG_SYS_SYMLINK,                MSG_SYS_READLINK,
 236  238                  MSG_SYS_SETGROUPS,              MSG_SYS_GETGROUPS,
 237  239                  MSG_SYS_FCHMOD,                 MSG_SYS_FCHOWN,
 238  240                  MSG_SYS_SIGPROCMASK,            MSG_SYS_SIGSUSPEND,
 239  241                  MSG_SYS_SIGALTSTACK,            MSG_SYS_SIGACTION,
 240  242                  MSG_SYS_SIGPENDING,             MSG_SYS_CONTEXT,
 241  243                  MSG_SYS_101,                    MSG_SYS_102,
 242  244                  MSG_SYS_STATVFS,                MSG_SYS_FSTATVFS,
 243  245                  MSG_SYS_GETLOADAVG,             MSG_SYS_NFSSYS,
 244  246                  MSG_SYS_WAITID,                 MSG_SYS_SIGSENDSYS,
 245  247                  MSG_SYS_HRTSYS,                 MSG_SYS_UTIMESYS,
 246  248                  MSG_SYS_SIGRESEND,              MSG_SYS_PRIOCNTLSYS,
 247  249                  MSG_SYS_PATHCONF,               MSG_SYS_MINCORE,
 248  250                  MSG_SYS_MMAP,                   MSG_SYS_MPROTECT,
 249  251                  MSG_SYS_MUNMAP,                 MSG_SYS_FPATHCONF,
 250  252                  MSG_SYS_VFORK,                  MSG_SYS_FCHDIR,
 251  253                  MSG_SYS_READV,                  MSG_SYS_WRITEV,
 252  254                  MSG_SYS_123,                    MSG_SYS_124,
 253  255                  MSG_SYS_125,                    MSG_SYS_126,
 254  256                  MSG_SYS_MMAPOBJ,                MSG_SYS_SETRLIMIT,
 255  257                  MSG_SYS_GETRLIMIT,              MSG_SYS_LCHOWN,
 256  258                  MSG_SYS_MEMCNTL,                MSG_SYS_GETPMSG,
 257  259                  MSG_SYS_PUTPMSG,                MSG_SYS_RENAME,
 258  260                  MSG_SYS_UNAME,                  MSG_SYS_SETEGID,
 259  261                  MSG_SYS_SYSCONFIG,              MSG_SYS_ADJTIME,
 260  262                  MSG_SYS_SYSTEMINFO,             MSG_SYS_SHAREFS,
 261  263                  MSG_SYS_SETEUID,                MSG_SYS_FORKSYS,
 262  264                  MSG_SYS_143,                    MSG_SYS_SIGTIMEDWAIT,
 263  265                  MSG_SYS_LWP_INFO,               MSG_SYS_YIELD,
 264  266                  MSG_SYS_147,                    MSG_SYS_LWP_SEMA_POST,
 265  267                  MSG_SYS_LWP_SEMA_TRYWAIT,       MSG_SYS_LWP_DETACH,
 266  268                  MSG_SYS_CORECTL,                MSG_SYS_MODCTL,
 267  269                  MSG_SYS_FCHROOT,                MSG_SYS_154,
 268  270                  MSG_SYS_VHANGUP,                MSG_SYS_GETTIMEOFDAY,
 269  271                  MSG_SYS_GETITIMER,              MSG_SYS_SETITIMER,
 270  272                  MSG_SYS_LWP_CREATE,             MSG_SYS_LWP_EXIT,
 271  273                  MSG_SYS_LWP_SUSPEND,            MSG_SYS_LWP_CONTINUE,
 272  274                  MSG_SYS_LWP_KILL,               MSG_SYS_LWP_SELF,
 273  275                  MSG_SYS_LWP_SIGMASK,            MSG_SYS_LWP_PRIVATE,
 274  276                  MSG_SYS_LWP_WAIT,               MSG_SYS_LWP_MUTEX_WAKEUP,
 275  277                  MSG_SYS_169,                    MSG_SYS_LWP_COND_WAIT,
 276  278                  MSG_SYS_LWP_COND_SIGNAL,        MSG_SYS_LWP_COND_BROADCAST,
 277  279                  MSG_SYS_PREAD,                  MSG_SYS_PWRITE,
 278  280                  MSG_SYS_LLSEEK,                 MSG_SYS_INST_SYNC,
 279  281                  MSG_SYS_BRAND,                  MSG_SYS_KAIO,
 280  282                  MSG_SYS_CPC,                    MSG_SYS_LGRPSYS,
 281  283                  MSG_SYS_RUSAGESYS,              MSG_SYS_PORT,
 282  284                  MSG_SYS_POLLSYS,                MSG_SYS_LABELSYS,
 283  285                  MSG_SYS_ACL,                    MSG_SYS_AUDITSYS,
 284  286                  MSG_SYS_PROCESSOR_BIND,         MSG_SYS_PROCESSOR_INFO,
 285  287                  MSG_SYS_P_ONLINE,               MSG_SYS_SIGQUEUE,
 286  288                  MSG_SYS_CLOCK_GETTIME,          MSG_SYS_CLOCK_SETTIME,
 287  289                  MSG_SYS_CLOCK_GETRES,           MSG_SYS_TIMER_CREATE,
 288  290                  MSG_SYS_TIMER_DELETE,           MSG_SYS_TIMER_SETTIME,
 289  291                  MSG_SYS_TIMER_GETTIME,          MSG_SYS_TIMER_GETOVERRUN,
 290  292                  MSG_SYS_NANOSLEEP,              MSG_SYS_FACL,
 291  293                  MSG_SYS_DOOR,                   MSG_SYS_SETREUID,
 292  294                  MSG_SYS_SETREGID,               MSG_SYS_INSTALL_UTRAP,
 293  295                  MSG_SYS_SIGNOTIFY,              MSG_SYS_SCHEDCTL,
 294  296                  MSG_SYS_PSET,                   MSG_SYS_SPARC_UTRAP_INSTALL,
 295  297                  MSG_SYS_RESOLVEPATH,            MSG_SYS_LWP_MUTEX_TIMEDLOCK,
 296  298                  MSG_SYS_LWP_SEMA_TIMEDWAIT,     MSG_SYS_LWP_RWLOCK_SYS,
 297  299                  MSG_SYS_GETDENTS64,             MSG_SYS_MMAP64,
 298  300                  MSG_SYS_STAT64,                 MSG_SYS_LSTAT64,
 299  301                  MSG_SYS_FSTAT64,                MSG_SYS_STATVFS64,
 300  302                  MSG_SYS_FSTATVFS64,             MSG_SYS_SETRLIMIT64,
 301  303                  MSG_SYS_GETRLIMIT64,            MSG_SYS_PREAD64,
 302  304                  MSG_SYS_PWRITE64,               MSG_SYS_224,
 303  305                  MSG_SYS_OPEN64,                 MSG_SYS_RPCSYS,
 304  306                  MSG_SYS_ZONE,                   MSG_SYS_AUTOFSSYS,
 305  307                  MSG_SYS_GETCWD,                 MSG_SYS_SO_SOCKET,
 306  308                  MSG_SYS_SO_SOCKETPAIR,          MSG_SYS_BIND,
 307  309                  MSG_SYS_LISTEN,                 MSG_SYS_ACCEPT,
 308  310                  MSG_SYS_CONNECT,                MSG_SYS_SHUTDOWN,
 309  311                  MSG_SYS_RECV,                   MSG_SYS_RECVFROM,
 310  312                  MSG_SYS_RECVMSG,                MSG_SYS_SEND,
 311  313                  MSG_SYS_SENDMSG,                MSG_SYS_SENDTO,
 312  314                  MSG_SYS_GETPEERNAME,            MSG_SYS_GETSOCKNAME,
 313  315                  MSG_SYS_GETSOCKOPT,             MSG_SYS_SETSOCKOPT,
 314  316                  MSG_SYS_SOCKCONFIG,             MSG_SYS_NTP_GETTIME,
 315  317                  MSG_SYS_NTP_ADJTIME,            MSG_SYS_LWP_MUTEX_UNLOCK,
 316  318                  MSG_SYS_LWP_MUTEX_TRYLOCK,      MSG_SYS_LWP_MUTEX_REGISTER,
 317  319                  MSG_SYS_CLADM,                  MSG_SYS_UUCOPY,
 318  320                  MSG_SYS_UMOUNT2
 319  321          };
 320  322          static const conv_ds_msg_t ds_sysnumarr = {
 321  323              CONV_DS_MSG_INIT(1, sysnumarr) };
 322  324  
 323  325          static const conv_ds_t  *ds[] = { CONV_DS_ADDR(ds_sysnumarr), NULL };
 324  326  
 325  327          int     use_num = 0;
 326  328  
 327  329          /*
 328  330           * Range check, and handle the unused values in the middle
 329  331           * of the range. Although the missing values have strings,
 330  332           * we still prefer to format them, because those strings are
 331  333           * decimal, and the default behavior, unless the CONV_FMT_DECIMAL
 332  334           * flag is set, is to display such things in hex.
 333  335           */
 334  336          switch (sysnum) {
 335  337          case 0:
 336  338          case 2:
 337  339          case 7:
 338  340          case 8:
 339  341          case 11:
 340  342          case 22:
 341  343          case 30:
 342  344          case 41:
 343  345          case 48:
 344  346          case 76:
 345  347          case 87:
 346  348          case 101:
 347  349          case 102:
 348  350          case 123:
 349  351          case 124:
 350  352          case 125:
 351  353          case 126:
 352  354          case 143:
 353  355          case 147:
 354  356          case 154:
 355  357          case 169:
 356  358          case 224:
 357  359                  use_num = 1;
 358  360                  break;
 359  361          default:
 360  362                  use_num = (sysnum > SYS_umount2);
 361  363                  break;
 362  364          }
 363  365          if (use_num)
 364  366                  return (conv_invalid_val(inv_buf, sysnum, fmt_flags));
 365  367  
 366  368          return (conv_map_ds(ELFOSABI_NONE, EM_NONE, sysnum, ds, fmt_flags,
 367  369              inv_buf));
 368  370  }
 369  371  
 370  372  
 371  373  const char *
 372  374  conv_cnote_errno(int errno_val, Conv_fmt_flags_t fmt_flags,
 373  375      Conv_inv_buf_t *inv_buf)
 374  376  {
 375  377          static const Msg        errarr_1_74[74] = {
 376  378                  MSG_ERRNO_EPERM,                MSG_ERRNO_ENOENT,
 377  379                  MSG_ERRNO_ESRCH,                MSG_ERRNO_EINTR,
 378  380                  MSG_ERRNO_EIO,                  MSG_ERRNO_ENXIO,
 379  381                  MSG_ERRNO_E2BIG,                MSG_ERRNO_ENOEXEC,
 380  382                  MSG_ERRNO_EBADF,                MSG_ERRNO_ECHILD,
 381  383                  MSG_ERRNO_EAGAIN,               MSG_ERRNO_ENOMEM,
 382  384                  MSG_ERRNO_EACCES,               MSG_ERRNO_EFAULT,
 383  385                  MSG_ERRNO_ENOTBLK,              MSG_ERRNO_EBUSY,
 384  386                  MSG_ERRNO_EEXIST,               MSG_ERRNO_EXDEV,
 385  387                  MSG_ERRNO_ENODEV,               MSG_ERRNO_ENOTDIR,
 386  388                  MSG_ERRNO_EISDIR,               MSG_ERRNO_EINVAL,
 387  389                  MSG_ERRNO_ENFILE,               MSG_ERRNO_EMFILE,
 388  390                  MSG_ERRNO_ENOTTY,               MSG_ERRNO_ETXTBSY,
 389  391                  MSG_ERRNO_EFBIG,                MSG_ERRNO_ENOSPC,
 390  392                  MSG_ERRNO_ESPIPE,               MSG_ERRNO_EROFS,
 391  393                  MSG_ERRNO_EMLINK,               MSG_ERRNO_EPIPE,
 392  394                  MSG_ERRNO_EDOM,                 MSG_ERRNO_ERANGE,
 393  395                  MSG_ERRNO_ENOMSG,               MSG_ERRNO_EIDRM,
 394  396                  MSG_ERRNO_ECHRNG,               MSG_ERRNO_EL2NSYNC,
 395  397                  MSG_ERRNO_EL3HLT,               MSG_ERRNO_EL3RST,
 396  398                  MSG_ERRNO_ELNRNG,               MSG_ERRNO_EUNATCH,
 397  399                  MSG_ERRNO_ENOCSI,               MSG_ERRNO_EL2HLT,
 398  400                  MSG_ERRNO_EDEADLK,              MSG_ERRNO_ENOLCK,
 399  401                  MSG_ERRNO_ECANCELED,            MSG_ERRNO_ENOTSUP,
 400  402                  MSG_ERRNO_EDQUOT,               MSG_ERRNO_EBADE,
 401  403                  MSG_ERRNO_EBADR,                MSG_ERRNO_EXFULL,
 402  404                  MSG_ERRNO_ENOANO,               MSG_ERRNO_EBADRQC,
 403  405                  MSG_ERRNO_EBADSLT,              MSG_ERRNO_EDEADLOCK,
 404  406                  MSG_ERRNO_EBFONT,               MSG_ERRNO_EOWNERDEAD,
 405  407                  MSG_ERRNO_ENOTRECOVERABLE,      MSG_ERRNO_ENOSTR,
 406  408                  MSG_ERRNO_ENODATA,              MSG_ERRNO_ETIME,
 407  409                  MSG_ERRNO_ENOSR,                MSG_ERRNO_ENONET,
 408  410                  MSG_ERRNO_ENOPKG,               MSG_ERRNO_EREMOTE,
 409  411                  MSG_ERRNO_ENOLINK,              MSG_ERRNO_EADV,
 410  412                  MSG_ERRNO_ESRMNT,               MSG_ERRNO_ECOMM,
 411  413                  MSG_ERRNO_EPROTO,               MSG_ERRNO_ELOCKUNMAPPED,
 412  414                  MSG_ERRNO_ENOTACTIVE,           MSG_ERRNO_EMULTIHOP
 413  415          };
 414  416          static const conv_ds_msg_t ds_errarr_1_74 = {
 415  417              CONV_DS_MSG_INIT(1, errarr_1_74) };
 416  418  
 417  419          static const Msg        errarr_77_99[23] = {
 418  420                  MSG_ERRNO_EBADMSG,              MSG_ERRNO_ENAMETOOLONG,
 419  421                  MSG_ERRNO_EOVERFLOW,            MSG_ERRNO_ENOTUNIQ,
 420  422                  MSG_ERRNO_EBADFD,               MSG_ERRNO_EREMCHG,
 421  423                  MSG_ERRNO_ELIBACC,              MSG_ERRNO_ELIBBAD,
 422  424                  MSG_ERRNO_ELIBSCN,              MSG_ERRNO_ELIBMAX,
 423  425                  MSG_ERRNO_ELIBEXEC,             MSG_ERRNO_EILSEQ,
 424  426                  MSG_ERRNO_ENOSYS,               MSG_ERRNO_ELOOP,
 425  427                  MSG_ERRNO_ERESTART,             MSG_ERRNO_ESTRPIPE,
 426  428                  MSG_ERRNO_ENOTEMPTY,            MSG_ERRNO_EUSERS,
 427  429                  MSG_ERRNO_ENOTSOCK,             MSG_ERRNO_EDESTADDRREQ,
 428  430                  MSG_ERRNO_EMSGSIZE,             MSG_ERRNO_EPROTOTYPE,
 429  431                  MSG_ERRNO_ENOPROTOOPT
 430  432          };
 431  433          static const conv_ds_msg_t ds_errarr_77_99 = {
 432  434              CONV_DS_MSG_INIT(77, errarr_77_99) };
 433  435  
 434  436          static const Msg        errarr_120_134[15] = {
 435  437                  MSG_ERRNO_EPROTONOSUPPORT,      MSG_ERRNO_ESOCKTNOSUPPORT,
 436  438                  MSG_ERRNO_EOPNOTSUPP,           MSG_ERRNO_EPFNOSUPPORT,
 437  439                  MSG_ERRNO_EAFNOSUPPORT,         MSG_ERRNO_EADDRINUSE,
 438  440                  MSG_ERRNO_EADDRNOTAVAIL,        MSG_ERRNO_ENETDOWN,
 439  441                  MSG_ERRNO_ENETUNREACH,          MSG_ERRNO_ENETRESET,
 440  442                  MSG_ERRNO_ECONNABORTED,         MSG_ERRNO_ECONNRESET,
 441  443                  MSG_ERRNO_ENOBUFS,              MSG_ERRNO_EISCONN,
 442  444                  MSG_ERRNO_ENOTCONN
 443  445          };
 444  446          static const conv_ds_msg_t ds_errarr_120_134 = {
 445  447              CONV_DS_MSG_INIT(120, errarr_120_134) };
 446  448  
 447  449          static const Msg        errarr_143_151[9] = {
 448  450                  MSG_ERRNO_ESHUTDOWN,            MSG_ERRNO_ETOOMANYREFS,
 449  451                  MSG_ERRNO_ETIMEDOUT,            MSG_ERRNO_ECONNREFUSED,
 450  452                  MSG_ERRNO_EHOSTDOWN,            MSG_ERRNO_EHOSTUNREACH,
 451  453                  MSG_ERRNO_EALREADY,             MSG_ERRNO_EINPROGRESS,
 452  454                  MSG_ERRNO_ESTALE
 453  455          };
 454  456          static const conv_ds_msg_t ds_errarr_143_151 = {
 455  457              CONV_DS_MSG_INIT(143, errarr_143_151) };
 456  458  
 457  459          static const conv_ds_t  *ds[] = { CONV_DS_ADDR(ds_errarr_1_74),
 458  460                  CONV_DS_ADDR(ds_errarr_77_99), CONV_DS_ADDR(ds_errarr_120_134),
 459  461                  CONV_DS_ADDR(ds_errarr_143_151), NULL };
 460  462  
 461  463  
 462  464          return (conv_map_ds(ELFOSABI_NONE, EM_NONE, errno_val, ds, fmt_flags,
 463  465              inv_buf));
 464  466  }
 465  467  
 466  468  
 467  469  const char *
 468  470  conv_cnote_pr_dmodel(Word dmodel, Conv_fmt_flags_t fmt_flags,
 469  471      Conv_inv_buf_t *inv_buf)
 470  472  {
 471  473          static const Msg        models[] = {
 472  474                  MSG_PR_MODEL_UNKNOWN,
 473  475                  MSG_PR_MODEL_ILP32,
 474  476                  MSG_PR_MODEL_LP64
 475  477          };
 476  478          static const conv_ds_msg_t ds_models = {
 477  479              CONV_DS_MSG_INIT(PR_MODEL_UNKNOWN, models) };
 478  480          static const conv_ds_t  *ds[] = { CONV_DS_ADDR(ds_models), NULL };
 479  481  
 480  482          return (conv_map_ds(ELFOSABI_NONE, EM_NONE, dmodel, ds, fmt_flags,
 481  483              inv_buf));
 482  484  }
 483  485  
 484  486  
 485  487  const char *
 486  488  conv_cnote_pr_why(short why, Conv_fmt_flags_t fmt_flags,
 487  489      Conv_inv_buf_t *inv_buf)
 488  490  {
 489  491          static const Msg        why_arr[] = {
 490  492                  MSG_PR_WHY_REQUESTED,
 491  493                  MSG_PR_WHY_SIGNALLED,
 492  494                  MSG_PR_WHY_SYSENTRY,
 493  495                  MSG_PR_WHY_SYSEXIT,
 494  496                  MSG_PR_WHY_JOBCONTROL,
 495  497                  MSG_PR_WHY_FAULTED,
 496  498                  MSG_PR_WHY_SUSPENDED,
 497  499                  MSG_PR_WHY_CHECKPOINT
 498  500          };
 499  501          static const conv_ds_msg_t ds_why_arr = {
 500  502              CONV_DS_MSG_INIT(1, why_arr) };
 501  503          static const conv_ds_t  *ds[] = { CONV_DS_ADDR(ds_why_arr), NULL };
 502  504  
 503  505          return (conv_map_ds(ELFOSABI_NONE, EM_NONE, why, ds, fmt_flags,
 504  506              inv_buf));
 505  507  }
 506  508  
 507  509  
 508  510  const char *
 509  511  conv_cnote_pr_what(short why, short what, Conv_fmt_flags_t fmt_flags,
 510  512      Conv_inv_buf_t *inv_buf)
 511  513  {
 512  514          /*
 513  515           * The meaning of pr_what depends on the corresponding
 514  516           * value of pr_why, as discussed in the proc(4) manpage.
 515  517           */
 516  518          switch (why) {
 517  519          case PR_SIGNALLED:
 518  520          case PR_JOBCONTROL:
 519  521                  return (conv_cnote_signal(what, fmt_flags, inv_buf));
 520  522          case PR_SYSENTRY:
 521  523          case PR_SYSEXIT:
 522  524                  return (conv_cnote_syscall(what, fmt_flags, inv_buf));
 523  525          case PR_FAULTED:
 524  526                  return (conv_cnote_fault(what, fmt_flags, inv_buf));
 525  527          };
 526  528  
 527  529          return (conv_invalid_val(inv_buf, what, fmt_flags));
 528  530  }
 529  531  
 530  532  
 531  533  /*
 532  534   * Return the name of the general purpose register indexed by
 533  535   * regno in the pr_reg array of lwpstatus_t (<sys/procfs.h>).
 534  536   */
 535  537  const char *
 536  538  conv_cnote_pr_regname(Half mach, int regno, Conv_fmt_flags_t fmt_flags,
 537  539      Conv_inv_buf_t *inv_buf)
 538  540  {
 539  541          static const Msg        sparc_gen_reg[32] = {
 540  542                  MSG_REG_SPARC_G0,               MSG_REG_SPARC_G1,
 541  543                  MSG_REG_SPARC_G2,               MSG_REG_SPARC_G3,
 542  544                  MSG_REG_SPARC_G4,               MSG_REG_SPARC_G5,
 543  545                  MSG_REG_SPARC_G6,               MSG_REG_SPARC_G7,
 544  546                  MSG_REG_SPARC_O0,               MSG_REG_SPARC_O1,
 545  547                  MSG_REG_SPARC_O2,               MSG_REG_SPARC_O3,
 546  548                  MSG_REG_SPARC_O4,               MSG_REG_SPARC_O5,
 547  549                  MSG_REG_SPARC_O6,               MSG_REG_SPARC_O7,
 548  550                  MSG_REG_SPARC_L0,               MSG_REG_SPARC_L1,
 549  551                  MSG_REG_SPARC_L2,               MSG_REG_SPARC_L3,
 550  552                  MSG_REG_SPARC_L4,               MSG_REG_SPARC_L5,
 551  553                  MSG_REG_SPARC_L6,               MSG_REG_SPARC_L7,
 552  554                  MSG_REG_SPARC_I0,               MSG_REG_SPARC_I1,
 553  555                  MSG_REG_SPARC_I2,               MSG_REG_SPARC_I3,
 554  556                  MSG_REG_SPARC_I4,               MSG_REG_SPARC_I5,
 555  557                  MSG_REG_SPARC_I6,               MSG_REG_SPARC_I7
 556  558          };
 557  559          static const conv_ds_msg_t ds_sparc_gen_reg = {
 558  560              CONV_DS_MSG_INIT(0, sparc_gen_reg) };
 559  561  
 560  562          static const Msg        sparc_32_37_reg[6] = {
 561  563                  MSG_REG_SPARC_PSR,              MSG_REG_SPARC_PC,
 562  564                  MSG_REG_SPARC_nPC,              MSG_REG_SPARC_Y,
 563  565                  MSG_REG_SPARC_WIM,              MSG_REG_SPARC_TBR
 564  566          };
 565  567          static const conv_ds_msg_t ds_sparc_32_37_reg = {
 566  568              CONV_DS_MSG_INIT(32, sparc_32_37_reg) };
 567  569  
 568  570          static const Msg        sparcv9_32_37_reg[6] = {
 569  571                  MSG_REG_SPARC_CCR,              MSG_REG_SPARC_PC,
 570  572                  MSG_REG_SPARC_nPC,              MSG_REG_SPARC_Y,
 571  573                  MSG_REG_SPARC_ASI,              MSG_REG_SPARC_FPRS
 572  574          };
 573  575          static const conv_ds_msg_t ds_sparcv9_32_37_reg = {
 574  576              CONV_DS_MSG_INIT(32, sparcv9_32_37_reg) };
 575  577  
 576  578          static const Msg        amd64_reg[28] = {
 577  579                  MSG_REG_AMD64_R15,              MSG_REG_AMD64_R14,
 578  580                  MSG_REG_AMD64_R13,              MSG_REG_AMD64_R12,
 579  581                  MSG_REG_AMD64_R11,              MSG_REG_AMD64_R10,
 580  582                  MSG_REG_AMD64_R9,               MSG_REG_AMD64_R8,
 581  583                  MSG_REG_AMD64_RDI,              MSG_REG_AMD64_RSI,
 582  584                  MSG_REG_AMD64_RBP,              MSG_REG_AMD64_RBX,
 583  585                  MSG_REG_AMD64_RDX,              MSG_REG_AMD64_RCX,
 584  586                  MSG_REG_AMD64_RAX,              MSG_REG_AMD64_TRAPNO,
 585  587                  MSG_REG_AMD64_ERR,              MSG_REG_AMD64_RIP,
 586  588                  MSG_REG_AMD64_CS,               MSG_REG_AMD64_RFL,
 587  589                  MSG_REG_AMD64_RSP,              MSG_REG_AMD64_SS,
 588  590                  MSG_REG_AMD64_FS,               MSG_REG_AMD64_GS,
 589  591                  MSG_REG_AMD64_ES,               MSG_REG_AMD64_DS,
 590  592                  MSG_REG_AMD64_FSBASE,           MSG_REG_AMD64_GSBASE
 591  593          };
 592  594          static const conv_ds_msg_t ds_amd64_reg = {
 593  595              CONV_DS_MSG_INIT(0, amd64_reg) };
 594  596  
 595  597          static const Msg        i86_reg[19] = {
 596  598                  MSG_REG_I86_GS,                 MSG_REG_I86_FS,
 597  599                  MSG_REG_I86_ES,                 MSG_REG_I86_DS,
 598  600                  MSG_REG_I86_EDI,                MSG_REG_I86_ESI,
 599  601                  MSG_REG_I86_EBP,                MSG_REG_I86_ESP,
 600  602                  MSG_REG_I86_EBX,                MSG_REG_I86_EDX,
 601  603                  MSG_REG_I86_ECX,                MSG_REG_I86_EAX,
 602  604                  MSG_REG_I86_TRAPNO,             MSG_REG_I86_ERR,
 603  605                  MSG_REG_I86_EIP,                MSG_REG_I86_CS,
 604  606                  MSG_REG_I86_EFL,                MSG_REG_I86_UESP,
 605  607                  MSG_REG_I86_SS
 606  608          };
 607  609          static const conv_ds_msg_t ds_i86_reg = {
 608  610              CONV_DS_MSG_INIT(0, i86_reg) };
 609  611  
 610  612  
 611  613          static const conv_ds_t  *ds_sparc[] = {
 612  614                  CONV_DS_ADDR(ds_sparc_gen_reg),
 613  615                  CONV_DS_ADDR(ds_sparc_32_37_reg),
 614  616                  NULL
 615  617          };
 616  618          static const conv_ds_t  *ds_sparcv9[] = {
 617  619                  CONV_DS_ADDR(ds_sparc_gen_reg),
 618  620                  CONV_DS_ADDR(ds_sparcv9_32_37_reg),
 619  621                  NULL
 620  622          };
 621  623          static const conv_ds_t  *ds_amd64[] = {
 622  624                  CONV_DS_ADDR(ds_amd64_reg), NULL };
 623  625          static const conv_ds_t  *ds_i86[] = {
 624  626                  CONV_DS_ADDR(ds_i86_reg), NULL };
 625  627  
 626  628          const conv_ds_t **ds;
 627  629  
 628  630          switch (mach) {
 629  631          case EM_386:
 630  632                  ds = ds_i86;
 631  633                  break;
 632  634  
 633  635          case EM_AMD64:
 634  636                  ds = ds_amd64;
 635  637                  break;
 636  638  
 637  639          case EM_SPARC:
 638  640          case EM_SPARC32PLUS:
 639  641                  ds = ds_sparc;
 640  642                  break;
 641  643  
 642  644          case EM_SPARCV9:
 643  645                  ds = ds_sparcv9;
 644  646                  break;
 645  647  
 646  648          default:
 647  649                  return (conv_invalid_val(inv_buf, regno, fmt_flags));
 648  650          }
 649  651  
 650  652          return (conv_map_ds(ELFOSABI_NONE, mach, regno, ds, fmt_flags,
 651  653              inv_buf));
 652  654  }
 653  655  
 654  656  const char *
 655  657  conv_cnote_pr_stype(Word stype, Conv_fmt_flags_t fmt_flags,
 656  658      Conv_inv_buf_t *inv_buf)
 657  659  {
 658  660          static const Msg        types[] = {
 659  661                  MSG_SOBJ_NONE,          MSG_SOBJ_MUTEX,
 660  662                  MSG_SOBJ_RWLOCK,        MSG_SOBJ_CV,
 661  663                  MSG_SOBJ_SEMA,          MSG_SOBJ_USER,
 662  664                  MSG_SOBJ_USER_PI,       MSG_SOBJ_SHUTTLE
 663  665          };
 664  666          static const conv_ds_msg_t ds_types = { CONV_DS_MSG_INIT(0, types) };
 665  667          static const conv_ds_t  *ds[] = { CONV_DS_ADDR(ds_types), NULL };
 666  668  
 667  669  
 668  670          return (conv_map_ds(ELFOSABI_NONE, EM_NONE, stype, ds, fmt_flags,
 669  671              inv_buf));
 670  672  }
 671  673  
 672  674  
 673  675  const char *
 674  676  conv_cnote_priv(int priv, Conv_fmt_flags_t fmt_flags,
 675  677      Conv_inv_buf_t *inv_buf)
 676  678  {
 677  679          const char *fmt;
 678  680  
 679  681          /*
 680  682           * The PRIV_ constants defined in <sys/priv.h> are unusual
 681  683           * in that they are negative values. The libconv code is all
 682  684           * built around the Word type, which is unsigned. Rather than
 683  685           * modify libconv for this one case, we simply handle
 684  686           * these constants differently that the usual approach,
 685  687           * and stay away from conv_invalid_val() and conv_map_ds().
 686  688           */
 687  689          switch (priv) {
 688  690          case PRIV_ALL:
 689  691                  return (MSG_ORIG(MSG_PRIV_ALL));
 690  692          case PRIV_MULTIPLE:
 691  693                  return (MSG_ORIG(MSG_PRIV_MULTIPLE));
 692  694          case PRIV_NONE:
 693  695                  return (MSG_ORIG(MSG_PRIV_NONE));
 694  696          case PRIV_ALLZONE:
 695  697                  return (MSG_ORIG(MSG_PRIV_ALLZONE));
 696  698          case PRIV_GLOBAL:
 697  699                  return (MSG_ORIG(MSG_PRIV_GLOBAL));
 698  700          }
 699  701  
 700  702          fmt = (fmt_flags & CONV_FMT_DECIMAL) ?
 701  703              MSG_ORIG(MSG_FMT_INT) : MSG_ORIG(MSG_FMT_HEXINT);
 702  704          (void) snprintf(inv_buf->buf, sizeof (inv_buf->buf), fmt, priv);
 703  705          return (inv_buf->buf);
 704  706  }
 705  707  
 706  708  
 707  709  const char *
 708  710  conv_cnote_psetid(int id, Conv_fmt_flags_t fmt_flags,
 709  711      Conv_inv_buf_t *inv_buf)
 710  712  {
 711  713          const char *fmt;
 712  714  
 713  715          /*
 714  716           * The PS_ constants defined in <sys/pset.h> are unusual
 715  717           * in that they are negative values. The libconv code is all
 716  718           * built around the Word type, which is unsigned. Rather than
 717  719           * modify libconv for this one case, we simply handle
 718  720           * these constants differently that the usual approach,
 719  721           * and stay away from conv_invalid_val() and conv_map_ds().
 720  722           */
 721  723          switch (id) {
 722  724          case PS_NONE:
 723  725                  return (MSG_ORIG(MSG_PS_NONE));
 724  726          case PS_QUERY:
 725  727                  return (MSG_ORIG(MSG_PS_QUERY));
 726  728          case PS_MYID:
 727  729                  return (MSG_ORIG(MSG_PS_MYID));
 728  730          case PS_SOFT:
 729  731                  return (MSG_ORIG(MSG_PS_SOFT));
 730  732          case PS_HARD:
 731  733                  return (MSG_ORIG(MSG_PS_HARD));
 732  734          case PS_QUERY_TYPE:
 733  735                  return (MSG_ORIG(MSG_PS_QUERY_TYPE));
 734  736          }
 735  737  
 736  738          fmt = (fmt_flags & CONV_FMT_DECIMAL) ?
 737  739              MSG_ORIG(MSG_FMT_INT) : MSG_ORIG(MSG_FMT_HEXINT);
 738  740          (void) snprintf(inv_buf->buf, sizeof (inv_buf->buf), fmt, id);
 739  741          return (inv_buf->buf);
 740  742  }
 741  743  
 742  744  
 743  745  /*
 744  746   * Return a string describing the si_code field of
 745  747   * the siginfo_t struct.
 746  748   *
 747  749   * The meaning of si_code is dependent on both the target
 748  750   * machine (mach) as well as the signal (sig).
 749  751   */
 750  752  const char *
 751  753  conv_cnote_si_code(Half mach, int sig, int si_code,
 752  754      Conv_fmt_flags_t fmt_flags, Conv_inv_buf_t *inv_buf)
 753  755  {
 754  756  
 755  757          /* Values of si_code for user generated signals */
 756  758          static const Msg        user_arr[6] = {
 757  759                  MSG_SI_USER,            MSG_SI_LWP,
 758  760                  MSG_SI_QUEUE,           MSG_SI_TIMER,
 759  761                  MSG_SI_ASYNCIO,         MSG_SI_MESGQ
 760  762          };
 761  763          static const conv_ds_msg_t ds_msg_user_arr = {
 762  764              CONV_DS_MSG_INIT(0, user_arr) };
 763  765          static const conv_ds_t  *ds_user_arr[] = {
 764  766                  CONV_DS_ADDR(ds_msg_user_arr), NULL };
 765  767  
 766  768  
 767  769          /*
 768  770           * Architecture dependent system generated signals. All
 769  771           * versions of Solaris use the same set of these values.
 770  772           */
 771  773          static const Msg        trap_arr[6] = {
 772  774                  MSG_SI_TRAP_BRKPT,      MSG_SI_TRAP_TRACE,
 773  775                  MSG_SI_TRAP_RWATCH,     MSG_SI_TRAP_WWATCH,
 774  776                  MSG_SI_TRAP_XWATCH,     MSG_SI_TRAP_DTRACE
 775  777          };
 776  778          static const conv_ds_msg_t ds_msg_trap_arr = {
 777  779              CONV_DS_MSG_INIT(1, trap_arr) };
 778  780          static const conv_ds_t  *ds_trap_arr[] = {
 779  781                  CONV_DS_ADDR(ds_msg_trap_arr), NULL };
 780  782  
 781  783          static const Msg        cld_arr[6] = {
 782  784                  MSG_SI_CLD_EXITED,      MSG_SI_CLD_KILLED,
 783  785                  MSG_SI_CLD_DUMPED,      MSG_SI_CLD_TRAPPED,
 784  786                  MSG_SI_CLD_STOPPED,     MSG_SI_CLD_CONTINUED
 785  787          };
 786  788          static const conv_ds_msg_t ds_msg_cld_arr = {
 787  789              CONV_DS_MSG_INIT(1, cld_arr) };
 788  790          static const conv_ds_t  *ds_cld_arr[] = {
 789  791                  CONV_DS_ADDR(ds_msg_cld_arr), NULL };
 790  792  
 791  793          static const Msg        poll_arr[6] = {
 792  794                  MSG_SI_POLL_IN,         MSG_SI_POLL_OUT,
 793  795                  MSG_SI_POLL_MSG,        MSG_SI_POLL_ERR,
 794  796                  MSG_SI_POLL_PRI,        MSG_SI_POLL_HUP
 795  797          };
 796  798          static const conv_ds_msg_t ds_msg_poll_arr = {
 797  799              CONV_DS_MSG_INIT(1, poll_arr) };
 798  800          static const conv_ds_t  *ds_poll_arr[] = {
 799  801                  CONV_DS_ADDR(ds_msg_poll_arr), NULL };
 800  802  
 801  803          /*
 802  804           * Architecture dependent system generated signals.
 803  805           * These items (ILL, EMT, FPE, SEGV, BUS) are platform
 804  806           * dependent. Some architectures have extra codes.
 805  807           * The same name may have a different integer value.
 806  808           * Multiple arrays are used when they differ, and one
 807  809           * array when all the architectures agree.
 808  810           */
 809  811  
 810  812          /* ILL */
 811  813          static const Msg        ill_arr[8] = {
 812  814                  MSG_SI_ILL_ILLOPC,      MSG_SI_ILL_ILLOPN,
 813  815                  MSG_SI_ILL_ILLADR,      MSG_SI_ILL_ILLTRP,
 814  816                  MSG_SI_ILL_PRVOPC,      MSG_SI_ILL_PRVREG,
 815  817                  MSG_SI_ILL_COPROC,      MSG_SI_ILL_BADSTK
 816  818          };
 817  819          static const conv_ds_msg_t ds_msg_ill_arr = {
 818  820              CONV_DS_MSG_INIT(1, ill_arr) };
 819  821          static const conv_ds_t  *ds_ill_arr[] = {
 820  822                  CONV_DS_ADDR(ds_msg_ill_arr), NULL };
 821  823  
 822  824          /* EMT */
 823  825          static const Msg        emt_arr_sparc[2] = {
 824  826                  MSG_SI_EMT_TAGOVF,      MSG_SI_EMT_CPCOVF
 825  827          };
 826  828          static const conv_ds_msg_t ds_msg_emt_arr_sparc = {
 827  829              CONV_DS_MSG_INIT(1, emt_arr_sparc) };
 828  830          static const conv_ds_t  *ds_emt_arr_sparc[] = {
 829  831                  CONV_DS_ADDR(ds_msg_emt_arr_sparc), NULL };
 830  832  
 831  833          static const Msg        emt_arr_x86[1] = {
 832  834                  MSG_SI_EMT_CPCOVF
 833  835          };
 834  836          static const conv_ds_msg_t ds_msg_emt_arr_x86 = {
 835  837              CONV_DS_MSG_INIT(1, emt_arr_x86) };
 836  838          static const conv_ds_t  *ds_emt_arr_x86[] = {
 837  839                  CONV_DS_ADDR(ds_msg_emt_arr_x86), NULL };
 838  840  
 839  841  
 840  842          /* FPE */
 841  843          static const Msg        fpe_arr_sparc[8] = {
 842  844                  MSG_SI_FPE_INTDIV,      MSG_SI_FPE_INTOVF,
 843  845                  MSG_SI_FPE_FLTDIV,      MSG_SI_FPE_FLTOVF,
 844  846                  MSG_SI_FPE_FLTUND,      MSG_SI_FPE_FLTRES,
 845  847                  MSG_SI_FPE_FLTINV,      MSG_SI_FPE_FLTSUB
 846  848          };
 847  849          static const conv_ds_msg_t ds_msg_fpe_arr_sparc = {
 848  850              CONV_DS_MSG_INIT(1, fpe_arr_sparc) };
 849  851          static const conv_ds_t  *ds_fpe_arr_sparc[] = {
 850  852                  CONV_DS_ADDR(ds_msg_fpe_arr_sparc), NULL };
 851  853  
 852  854          static const Msg        fpe_arr_x86[9] = {
 853  855                  MSG_SI_FPE_INTDIV,      MSG_SI_FPE_INTOVF,
 854  856                  MSG_SI_FPE_FLTDIV,      MSG_SI_FPE_FLTOVF,
 855  857                  MSG_SI_FPE_FLTUND,      MSG_SI_FPE_FLTRES,
 856  858                  MSG_SI_FPE_FLTINV,      MSG_SI_FPE_FLTSUB,
 857  859                  MSG_SI_FPE_FLTDEN
 858  860          };
 859  861          static const conv_ds_msg_t ds_msg_fpe_arr_x86 = {
 860  862              CONV_DS_MSG_INIT(1, fpe_arr_x86) };
 861  863          static const conv_ds_t  *ds_fpe_arr_x86[] = {
 862  864                  CONV_DS_ADDR(ds_msg_fpe_arr_x86), NULL };
 863  865  
 864  866          /* SEGV */
 865  867          static const Msg        segv_arr[2] = {
 866  868                  MSG_SI_SEGV_MAPERR,     MSG_SI_SEGV_ACCERR
 867  869          };
 868  870          static const conv_ds_msg_t ds_msg_segv_arr = {
 869  871              CONV_DS_MSG_INIT(1, segv_arr) };
 870  872          static const conv_ds_t  *ds_segv_arr[] = {
 871  873                  CONV_DS_ADDR(ds_msg_segv_arr), NULL };
 872  874  
 873  875          /* BUS */
 874  876          static const Msg        bus_arr[3] = {
 875  877                  MSG_SI_BUS_ADRALN,      MSG_SI_BUS_ADRERR,
 876  878                  MSG_SI_BUS_OBJERR
 877  879          };
 878  880          static const conv_ds_msg_t ds_msg_bus_arr = {
 879  881              CONV_DS_MSG_INIT(1, bus_arr) };
 880  882          static const conv_ds_t  *ds_bus_arr[] = {
 881  883                  CONV_DS_ADDR(ds_msg_bus_arr), NULL };
 882  884  
 883  885          enum { ARCH_NONE, ARCH_X86, ARCH_SPARC } arch;
 884  886  
 885  887  
 886  888          /* Handle the si_code values that do not depend on the signal */
 887  889          switch (si_code) {
 888  890          case SI_NOINFO:
 889  891                  return (MSG_ORIG(MSG_SI_NOINFO));
 890  892          case SI_DTRACE:
 891  893                  return (MSG_ORIG(MSG_SI_DTRACE));
 892  894          case SI_RCTL:
 893  895                  return (MSG_ORIG(MSG_SI_RCTL));
 894  896          default:
 895  897                  /* User generated signal codes are <= 0 */
 896  898                  if (si_code <= 0) {
 897  899                          int ndx = -si_code;
 898  900  
 899  901                          /*
 900  902                           * If no signal was delivered, and si_code is
 901  903                           * 0, return "0" rather than "SI_USER".
 902  904                           */
 903  905                          if ((si_code == 0) && (sig == 0))
 904  906                                  return (MSG_ORIG(MSG_GBL_ZERO));
 905  907  
 906  908                          if (ndx >= ARRAY_NELTS(user_arr)) {
 907  909                                  const char *fmt;
 908  910  
 909  911                                  fmt = (fmt_flags & CONV_FMT_DECIMAL) ?
 910  912                                      MSG_ORIG(MSG_FMT_INT) :
 911  913                                      MSG_ORIG(MSG_FMT_HEXINT);
 912  914  
 913  915                                  (void) snprintf(inv_buf->buf,
 914  916                                      sizeof (inv_buf->buf), fmt, si_code);
 915  917                                  return (inv_buf->buf);
 916  918                          }
 917  919                          return (conv_map_ds(ELFOSABI_NONE, EM_NONE, ndx,
 918  920                              ds_user_arr, fmt_flags, inv_buf));
 919  921                  }
 920  922          }
 921  923  
 922  924          /*
 923  925           * If we didn't return above, then this is a
 924  926           * system generated signal, and the meaning of si_code
 925  927           * depends on the signal that was delivered, and possibly
 926  928           * on the target architecture.
 927  929           */
 928  930          switch (mach) {
 929  931          case EM_386:
 930  932          case EM_AMD64:
 931  933                  arch = ARCH_X86;
 932  934                  break;
 933  935  
 934  936          case EM_SPARC:
 935  937          case EM_SPARC32PLUS:
 936  938          case EM_SPARCV9:
 937  939                  arch = ARCH_X86;
 938  940                  break;
 939  941  
 940  942          default:
 941  943                  arch = ARCH_NONE;
 942  944                  break;
 943  945          }
 944  946  
 945  947          switch (sig) {
 946  948          case SIGTRAP:
 947  949                  return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
 948  950                      ds_trap_arr, fmt_flags, inv_buf));
 949  951  
 950  952          case SIGCLD:
 951  953                  return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
 952  954                      ds_cld_arr, fmt_flags, inv_buf));
 953  955  
 954  956          case SIGPOLL:
 955  957                  return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
 956  958                      ds_poll_arr, fmt_flags, inv_buf));
 957  959  
 958  960          case SIGILL:
 959  961                  return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
 960  962                      ds_ill_arr, fmt_flags, inv_buf));
 961  963  
 962  964          case SIGEMT:
 963  965                  switch (arch) {
 964  966                  case ARCH_SPARC:
 965  967                          return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
 966  968                              ds_emt_arr_sparc, fmt_flags, inv_buf));
 967  969                  case ARCH_X86:
 968  970                          return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
 969  971                              ds_emt_arr_x86, fmt_flags, inv_buf));
 970  972                  }
 971  973                  break;
 972  974  
 973  975          case SIGFPE:
 974  976                  switch (arch) {
 975  977                  case ARCH_SPARC:
 976  978                          return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
 977  979                              ds_fpe_arr_sparc, fmt_flags, inv_buf));
 978  980                  case ARCH_X86:
 979  981                          return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
 980  982                              ds_fpe_arr_x86, fmt_flags, inv_buf));
 981  983                  }
 982  984                  break;
 983  985  
 984  986          case SIGSEGV:
 985  987                  return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
 986  988                      ds_segv_arr, fmt_flags, inv_buf));
 987  989  
 988  990          case SIGBUS:
 989  991                  return (conv_map_ds(ELFOSABI_NONE, EM_NONE, si_code,
 990  992                      ds_bus_arr, fmt_flags, inv_buf));
 991  993          }
 992  994  
 993  995          /* If not recognized, format as a number */
 994  996          return (conv_invalid_val(inv_buf, si_code, fmt_flags));
 995  997  
 996  998  }
 997  999  
 998 1000  
 999 1001  #define AUXAFFLGSZ      CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1000 1002          MSG_AUXV_AF_SUN_SETUGID_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1001 1003          MSG_AUXV_AF_SUN_HWCAPVERIFY_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1002 1004          MSG_AUXV_AF_SUN_NOPLM_SIZE      + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1003 1005          CONV_INV_BUFSIZE                + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1004 1006  
1005 1007  /*
1006 1008   * Ensure that Conv_cnote_auxv_af_buf_t is large enough:
1007 1009   *
1008 1010   * AUXAFFLGSZ is the real minimum size of the buffer required by
1009 1011   * conv_cnote_auxv_af(). However, Conv_cnote_auxv_af_buf_t
1010 1012   * uses CONV_CNOTE_AUXV_AF_BUFSIZE to set the buffer size. We do
1011 1013   * things this way because the definition of AUXAFFLGSZ uses information
1012 1014   * that is not available in the environment of other programs
1013 1015   * that include the conv.h header file.
1014 1016   */
1015 1017  #if (CONV_CNOTE_AUXV_AF_BUFSIZE != AUXAFFLGSZ) && !defined(__lint)
1016 1018  #define REPORT_BUFSIZE AUXAFFLGSZ
1017 1019  #include "report_bufsize.h"
1018 1020  #error "CONV_CNOTE_AUXV_AF_BUFSIZE does not match AUXAFFLGSZ"
1019 1021  #endif
1020 1022  
1021 1023  const char *
1022 1024  conv_cnote_auxv_af(Word flags, Conv_fmt_flags_t fmt_flags,
1023 1025      Conv_cnote_auxv_af_buf_t *cnote_auxv_af_buf)
1024 1026  {
1025 1027          static const Val_desc vda[] = {
1026 1028                  { AF_SUN_SETUGID,       MSG_AUXV_AF_SUN_SETUGID },
1027 1029                  { AF_SUN_HWCAPVERIFY,   MSG_AUXV_AF_SUN_HWCAPVERIFY },
1028 1030                  { AF_SUN_NOPLM,         MSG_AUXV_AF_SUN_NOPLM },
1029 1031                  { 0,                    0 }
1030 1032          };
1031 1033          static CONV_EXPN_FIELD_ARG conv_arg = {
1032 1034              NULL, sizeof (cnote_auxv_af_buf->buf) };
1033 1035  
1034 1036          if (flags == 0)
1035 1037                  return (MSG_ORIG(MSG_GBL_ZERO));
1036 1038  
1037 1039          conv_arg.buf = cnote_auxv_af_buf->buf;
1038 1040          conv_arg.oflags = conv_arg.rflags = flags;
1039 1041          (void) conv_expn_field(&conv_arg, vda, fmt_flags);
1040 1042  
1041 1043          return ((const char *)cnote_auxv_af_buf->buf);
1042 1044  }
1043 1045  
1044 1046  
1045 1047  #define CCFLGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1046 1048          MSG_CC_CONTENT_STACK_SIZE       + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1047 1049          MSG_CC_CONTENT_HEAP_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1048 1050          MSG_CC_CONTENT_SHFILE_SIZE      + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1049 1051          MSG_CC_CONTENT_SHANON_SIZE      + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1050 1052          MSG_CC_CONTENT_TEXT_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1051 1053          MSG_CC_CONTENT_DATA_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1052 1054          MSG_CC_CONTENT_RODATA_SIZE      + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1053 1055          MSG_CC_CONTENT_ANON_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1054 1056          MSG_CC_CONTENT_SHM_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1055 1057          MSG_CC_CONTENT_ISM_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1056 1058          MSG_CC_CONTENT_DISM_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1057 1059          MSG_CC_CONTENT_CTF_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1058 1060          MSG_CC_CONTENT_SYMTAB_SIZE      + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1059 1061          CONV_INV_BUFSIZE                + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1060 1062  
1061 1063  /*
1062 1064   * Ensure that Conv_cnote_cc_content_buf_t is large enough:
1063 1065   *
1064 1066   * CCFLGSZ is the real minimum size of the buffer required by
1065 1067   * conv_cnote_cc_content(). However, Conv_cnote_cc_content_buf_t
1066 1068   * uses CONV_CNOTE_CC_CONTENT_BUFSIZE to set the buffer size. We do
1067 1069   * things this way because the definition of CCFLGSZ uses information
1068 1070   * that is not available in the environment of other programs
1069 1071   * that include the conv.h header file.
1070 1072   */
1071 1073  #if (CONV_CNOTE_CC_CONTENT_BUFSIZE != CCFLGSZ) && !defined(__lint)
1072 1074  #define REPORT_BUFSIZE CCFLGSZ
1073 1075  #include "report_bufsize.h"
1074 1076  #error "CONV_CNOTE_CC_CONTENT_BUFSIZE does not match CCFLGSZ"
1075 1077  #endif
1076 1078  
1077 1079  const char *
1078 1080  conv_cnote_cc_content(Lword flags, Conv_fmt_flags_t fmt_flags,
1079 1081      Conv_cnote_cc_content_buf_t *cnote_cc_content_buf)
1080 1082  {
1081 1083          /*
1082 1084           * Note: core_content_t is a 64-bit integer value, but our
1083 1085           * conv_expn_field() logic is all built around 32-bit
1084 1086           * Word values. This will probably need changing someday,
1085 1087           * but for now, we make do with the 32-bit engine. This works
1086 1088           * because the number of bits actually assigned in
1087 1089           * the core_content_t data type (<sys/corectl.h>) bits within
1088 1090           * 32-bits.
1089 1091           *
1090 1092           * The downside is that any bits set in the upper half of
1091 1093           * the flags will be ignored. At the time of this writing,
1092 1094           * that can only occur via core file corruption, which presumably
1093 1095           * would be evident in other ways.
1094 1096           */
1095 1097          static const Val_desc vda[] = {
1096 1098                  { (Word) CC_CONTENT_STACK,      MSG_CC_CONTENT_STACK },
1097 1099                  { (Word) CC_CONTENT_HEAP,       MSG_CC_CONTENT_HEAP },
1098 1100                  { (Word) CC_CONTENT_SHFILE,     MSG_CC_CONTENT_SHFILE },
1099 1101                  { (Word) CC_CONTENT_SHANON,     MSG_CC_CONTENT_SHANON },
1100 1102                  { (Word) CC_CONTENT_TEXT,       MSG_CC_CONTENT_TEXT },
1101 1103                  { (Word) CC_CONTENT_DATA,       MSG_CC_CONTENT_DATA },
1102 1104                  { (Word) CC_CONTENT_RODATA,     MSG_CC_CONTENT_RODATA },
1103 1105                  { (Word) CC_CONTENT_ANON,       MSG_CC_CONTENT_ANON },
1104 1106                  { (Word) CC_CONTENT_SHM,        MSG_CC_CONTENT_SHM },
1105 1107                  { (Word) CC_CONTENT_ISM,        MSG_CC_CONTENT_ISM },
1106 1108                  { (Word) CC_CONTENT_DISM,       MSG_CC_CONTENT_DISM },
1107 1109                  { (Word) CC_CONTENT_CTF,        MSG_CC_CONTENT_CTF },
1108 1110                  { (Word) CC_CONTENT_SYMTAB,     MSG_CC_CONTENT_SYMTAB },
1109 1111                  { 0,                    0 }
1110 1112          };
1111 1113          static CONV_EXPN_FIELD_ARG conv_arg = {
1112 1114              NULL, sizeof (cnote_cc_content_buf->buf) };
1113 1115  
1114 1116          if (flags == 0)
1115 1117                  return (MSG_ORIG(MSG_GBL_ZERO));
1116 1118  
1117 1119          conv_arg.buf = cnote_cc_content_buf->buf;
1118 1120          conv_arg.oflags = conv_arg.rflags = flags;
1119 1121          (void) conv_expn_field(&conv_arg, vda, fmt_flags);
1120 1122  
1121 1123          return ((const char *)cnote_cc_content_buf->buf);
1122 1124  }
1123 1125  
1124 1126  
1125 1127  #define PRFLGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1126 1128          MSG_PR_FLAGS_STOPPED_SIZE       + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1127 1129          MSG_PR_FLAGS_ISTOP_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1128 1130          MSG_PR_FLAGS_DSTOP_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1129 1131          MSG_PR_FLAGS_STEP_SIZE          + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1130 1132          MSG_PR_FLAGS_ASLEEP_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1131 1133          MSG_PR_FLAGS_PCINVAL_SIZE       + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1132 1134          MSG_PR_FLAGS_ASLWP_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1133 1135          MSG_PR_FLAGS_AGENT_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1134 1136          MSG_PR_FLAGS_DETACH_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1135 1137          MSG_PR_FLAGS_DAEMON_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1136 1138          MSG_PR_FLAGS_IDLE_SIZE          + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1137 1139          MSG_PR_FLAGS_ISSYS_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1138 1140          MSG_PR_FLAGS_VFORKP_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1139 1141          MSG_PR_FLAGS_ORPHAN_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1140 1142          MSG_PR_FLAGS_NOSIGCHLD_SIZE     + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1141 1143          MSG_PR_FLAGS_WAITPID_SIZE       + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1142 1144          MSG_PR_FLAGS_FORK_SIZE          + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1143 1145          MSG_PR_FLAGS_RLC_SIZE           + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1144 1146          MSG_PR_FLAGS_KLC_SIZE           + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1145 1147          MSG_PR_FLAGS_ASYNC_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1146 1148          MSG_PR_FLAGS_MSACCT_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1147 1149          MSG_PR_FLAGS_BPTADJ_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1148 1150          MSG_PR_FLAGS_PTRACE_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1149 1151          MSG_PR_FLAGS_MSFORK_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1150 1152          CONV_INV_BUFSIZE                + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1151 1153  
1152 1154  /*
1153 1155   * Ensure that Conv_cnote_pr_flags_buf_t is large enough:
1154 1156   *
1155 1157   * PRFLGSZ is the real minimum size of the buffer required by
1156 1158   * conv_cnote_pr_flags(). However, Conv_cnote_pr_flags_buf_t
1157 1159   * uses CONV_CNOTE_PR_FLAGS_BUFSIZE to set the buffer size. We do
1158 1160   * things this way because the definition of PRFLGSZ uses information
1159 1161   * that is not available in the environment of other programs
1160 1162   * that include the conv.h header file.
1161 1163   */
1162 1164  #if (CONV_CNOTE_PR_FLAGS_BUFSIZE != PRFLGSZ) && !defined(__lint)
1163 1165  #define REPORT_BUFSIZE PRFLGSZ
1164 1166  #include "report_bufsize.h"
1165 1167  #error "CONV_CNOTE_PR_FLAGS_BUFSIZE does not match PRFLGSZ"
1166 1168  #endif
1167 1169  
1168 1170  const char *
1169 1171  conv_cnote_pr_flags(int flags, Conv_fmt_flags_t fmt_flags,
1170 1172      Conv_cnote_pr_flags_buf_t *cnote_pr_flags_buf)
1171 1173  {
1172 1174          static const Val_desc vda[] = {
1173 1175                  { PR_STOPPED,           MSG_PR_FLAGS_STOPPED },
1174 1176                  { PR_ISTOP,             MSG_PR_FLAGS_ISTOP },
1175 1177                  { PR_DSTOP,             MSG_PR_FLAGS_DSTOP },
1176 1178                  { PR_STEP,              MSG_PR_FLAGS_STEP },
1177 1179                  { PR_ASLEEP,            MSG_PR_FLAGS_ASLEEP },
1178 1180                  { PR_PCINVAL,           MSG_PR_FLAGS_PCINVAL },
1179 1181                  { PR_ASLWP,             MSG_PR_FLAGS_ASLWP },
1180 1182                  { PR_AGENT,             MSG_PR_FLAGS_AGENT },
1181 1183                  { PR_DETACH,            MSG_PR_FLAGS_DETACH },
1182 1184                  { PR_DAEMON,            MSG_PR_FLAGS_DAEMON },
1183 1185                  { PR_IDLE,              MSG_PR_FLAGS_IDLE },
1184 1186                  { PR_ISSYS,             MSG_PR_FLAGS_ISSYS },
1185 1187                  { PR_VFORKP,            MSG_PR_FLAGS_VFORKP },
1186 1188                  { PR_ORPHAN,            MSG_PR_FLAGS_ORPHAN },
1187 1189                  { PR_NOSIGCHLD,         MSG_PR_FLAGS_NOSIGCHLD },
1188 1190                  { PR_WAITPID,           MSG_PR_FLAGS_WAITPID },
1189 1191                  { PR_FORK,              MSG_PR_FLAGS_FORK },
1190 1192                  { PR_RLC,               MSG_PR_FLAGS_RLC },
1191 1193                  { PR_KLC,               MSG_PR_FLAGS_KLC },
1192 1194                  { PR_ASYNC,             MSG_PR_FLAGS_ASYNC },
1193 1195                  { PR_MSACCT,            MSG_PR_FLAGS_MSACCT },
1194 1196                  { PR_BPTADJ,            MSG_PR_FLAGS_BPTADJ },
1195 1197                  { PR_PTRACE,            MSG_PR_FLAGS_PTRACE },
1196 1198                  { PR_MSFORK,            MSG_PR_FLAGS_MSFORK },
1197 1199                  { 0,                    0 }
1198 1200          };
1199 1201          static CONV_EXPN_FIELD_ARG conv_arg = {
1200 1202              NULL, sizeof (cnote_pr_flags_buf->buf) };
1201 1203  
1202 1204          if (flags == 0)
1203 1205                  return (MSG_ORIG(MSG_GBL_ZERO));
1204 1206  
1205 1207          conv_arg.buf = cnote_pr_flags_buf->buf;
1206 1208          conv_arg.oflags = conv_arg.rflags = flags;
1207 1209          (void) conv_expn_field(&conv_arg, vda, fmt_flags);
1208 1210  
1209 1211          return ((const char *)cnote_pr_flags_buf->buf);
1210 1212  }
1211 1213  
1212 1214  
1213 1215  #define OLDPRFLGSZ      CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1214 1216          MSG_PR_FLAGS_STOPPED_SIZE       + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1215 1217          MSG_PR_FLAGS_ISTOP_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1216 1218          MSG_PR_FLAGS_DSTOP_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1217 1219          MSG_PR_FLAGS_ASLEEP_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1218 1220          MSG_PR_FLAGS_FORK_SIZE          + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1219 1221          MSG_PR_FLAGS_RLC_SIZE           + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1220 1222          MSG_PR_FLAGS_PTRACE_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1221 1223          MSG_PR_FLAGS_PCINVAL_SIZE       + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1222 1224          MSG_PR_FLAGS_ISSYS_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1223 1225          MSG_PR_FLAGS_STEP_SIZE          + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1224 1226          MSG_PR_FLAGS_KLC_SIZE           + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1225 1227          MSG_PR_FLAGS_ASYNC_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1226 1228          MSG_PR_FLAGS_PCOMPAT_SIZE       + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1227 1229          MSG_PR_FLAGS_MSACCT_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1228 1230          MSG_PR_FLAGS_BPTADJ_SIZE        + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1229 1231          MSG_PR_FLAGS_ASLWP_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1230 1232          CONV_INV_BUFSIZE                + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1231 1233  
1232 1234  /*
1233 1235   * Ensure that Conv_cnote_old_pr_flags_buf_t is large enough:
1234 1236   *
1235 1237   * OLDPRFLGSZ is the real minimum size of the buffer required by
1236 1238   * conv_cnote_old_pr_flags(). However, Conv_cnote_old_pr_flags_buf_t
1237 1239   * uses CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE to set the buffer size. We do
1238 1240   * things this way because the definition of OLDPRFLGSZ uses information
1239 1241   * that is not available in the environment of other programs
1240 1242   * that include the conv.h header file.
1241 1243   */
1242 1244  #if (CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE != OLDPRFLGSZ) && !defined(__lint)
1243 1245  #define REPORT_BUFSIZE OLDPRFLGSZ
1244 1246  #include "report_bufsize.h"
1245 1247  #error "CONV_CNOTE_OLD_PR_FLAGS_BUFSIZE does not match OLDPRFLGSZ"
1246 1248  #endif
1247 1249  
1248 1250  const char *
1249 1251  conv_cnote_old_pr_flags(int flags, Conv_fmt_flags_t fmt_flags,
1250 1252      Conv_cnote_old_pr_flags_buf_t *cnote_old_pr_flags_buf)
1251 1253  {
1252 1254          /*
1253 1255           * <sys/old_procfs.h> defines names for many of these flags
1254 1256           * that are also defined in <sys/procfs.h>, but with different
1255 1257           * values. To avoid confusion, we don't include <sys/old_procfs.h>,
1256 1258           * and specify the values directly.
1257 1259           */
1258 1260          static const Val_desc vda[] = {
1259 1261                  { 0x0001,               MSG_PR_FLAGS_STOPPED },
1260 1262                  { 0x0002,               MSG_PR_FLAGS_ISTOP },
1261 1263                  { 0x0004,               MSG_PR_FLAGS_DSTOP },
1262 1264                  { 0x0008,               MSG_PR_FLAGS_ASLEEP },
1263 1265                  { 0x0010,               MSG_PR_FLAGS_FORK },
1264 1266                  { 0x0020,               MSG_PR_FLAGS_RLC },
1265 1267                  { 0x0040,               MSG_PR_FLAGS_PTRACE },
1266 1268                  { 0x0080,               MSG_PR_FLAGS_PCINVAL },
1267 1269                  { 0x0100,               MSG_PR_FLAGS_ISSYS },
1268 1270                  { 0x0200,               MSG_PR_FLAGS_STEP },
1269 1271                  { 0x0400,               MSG_PR_FLAGS_KLC },
1270 1272                  { 0x0800,               MSG_PR_FLAGS_ASYNC },
1271 1273                  { 0x1000,               MSG_PR_FLAGS_PCOMPAT },
1272 1274                  { 0x2000,               MSG_PR_FLAGS_MSACCT },
1273 1275                  { 0x4000,               MSG_PR_FLAGS_BPTADJ },
1274 1276                  { 0x8000,               MSG_PR_FLAGS_ASLWP },
1275 1277                  { 0,                    0 }
1276 1278          };
1277 1279          static CONV_EXPN_FIELD_ARG conv_arg = {
1278 1280              NULL, sizeof (cnote_old_pr_flags_buf->buf) };
1279 1281  
1280 1282          if (flags == 0)
1281 1283                  return (MSG_ORIG(MSG_GBL_ZERO));
1282 1284  
1283 1285          conv_arg.buf = cnote_old_pr_flags_buf->buf;
1284 1286          conv_arg.oflags = conv_arg.rflags = flags;
1285 1287          (void) conv_expn_field(&conv_arg, vda, fmt_flags);
1286 1288  
1287 1289          return ((const char *)cnote_old_pr_flags_buf->buf);
1288 1290  }
1289 1291  
1290 1292  
1291 1293  #define PROCFLGSZ       CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1292 1294          MSG_PROC_FLAG_SSYS_SIZE         + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1293 1295          MSG_PROC_FLAG_SMSACCT_SIZE      + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1294 1296          CONV_INV_BUFSIZE                + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1295 1297  
1296 1298  /*
1297 1299   * Ensure that Conv_cnote_proc_flag_buf_t is large enough:
1298 1300   *
1299 1301   * PROCFLGSZ is the real minimum size of the buffer required by
1300 1302   * conv_cnote_proc_flag(). However, Conv_cnote_proc_flag_buf_t
1301 1303   * uses CONV_CNOTE_PROC_FLAG_BUFSIZE to set the buffer size. We do
1302 1304   * things this way because the definition of PROCFLGSZ uses information
1303 1305   * that is not available in the environment of other programs
1304 1306   * that include the conv.h header file.
1305 1307   */
1306 1308  #if (CONV_CNOTE_PROC_FLAG_BUFSIZE != PROCFLGSZ) && !defined(__lint)
1307 1309  #define REPORT_BUFSIZE PROCFLGSZ
1308 1310  #include "report_bufsize.h"
1309 1311  #error "CONV_CNOTE_PROC_FLAG_BUFSIZE does not match PROCFLGSZ"
1310 1312  #endif
1311 1313  
1312 1314  const char *
1313 1315  conv_cnote_proc_flag(int flags, Conv_fmt_flags_t fmt_flags,
1314 1316      Conv_cnote_proc_flag_buf_t *cnote_proc_flag_buf)
1315 1317  {
1316 1318          /*
1317 1319           * Most of the proc flags are implementation dependant, and can
1318 1320           * change between releases. As such, we do not attempt to translate
1319 1321           * them to symbolic form, but simply report them in hex form.
1320 1322           * However, SMSACCT and SSYS are special, and their bit values
1321 1323           * are maintained between releases so they can be used in the
1322 1324           * psinfo_t.p_flag field. We therefore translate these items.
1323 1325           *
1324 1326           * See <system/proc.h>
1325 1327           *
1326 1328           * Note: We don't want to include <sys/proc.h> in this file, because
1327 1329           * it redefines 'struct list', which we have defined in sgs.h. As
1328 1330           * SMSACCT and SSYS are stable public values, we simply use
1329 1331           * their numeric value.
1330 1332           */
1331 1333          static const Val_desc vda[] = {
1332 1334                  { 0x00000001,           MSG_PROC_FLAG_SSYS },
1333 1335                  { 0x02000000,           MSG_PROC_FLAG_SMSACCT },
1334 1336                  { 0,                    0 }
1335 1337          };
1336 1338          static CONV_EXPN_FIELD_ARG conv_arg = {
1337 1339              NULL, sizeof (cnote_proc_flag_buf->buf) };
1338 1340  
1339 1341          if (flags == 0)
1340 1342                  return (MSG_ORIG(MSG_GBL_ZERO));
1341 1343  
1342 1344          conv_arg.buf = cnote_proc_flag_buf->buf;
1343 1345          conv_arg.oflags = conv_arg.rflags = flags;
1344 1346          (void) conv_expn_field(&conv_arg, vda, fmt_flags);
1345 1347  
1346 1348          return ((const char *)cnote_proc_flag_buf->buf);
1347 1349  }
1348 1350  
1349 1351  
1350 1352  #define SAFLGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1351 1353          MSG_SA_ONSTACK_SIZE             + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1352 1354          MSG_SA_RESETHAND_SIZE           + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1353 1355          MSG_SA_RESTART_SIZE             + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1354 1356          MSG_SA_SIGINFO_SIZE             + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1355 1357          MSG_SA_NODEFER_SIZE             + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1356 1358          MSG_SA_NOCLDWAIT_SIZE           + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1357 1359          MSG_SA_NOCLDSTOP_SIZE           + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1358 1360          CONV_INV_BUFSIZE                + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1359 1361  
1360 1362  /*
1361 1363   * Ensure that Conv_cnote_sa_flags_buf_t is large enough:
1362 1364   *
1363 1365   * SAFLGSZ is the real minimum size of the buffer required by
1364 1366   * conv_cnote_sa_flags(). However, Conv_cnote_sa_flags_buf_t
1365 1367   * uses CONV_CNOTE_SA_FLAGS_BUFSIZE to set the buffer size. We do
1366 1368   * things this way because the definition of SAFLGSZ uses information
1367 1369   * that is not available in the environment of other programs
1368 1370   * that include the conv.h header file.
1369 1371   */
1370 1372  #if (CONV_CNOTE_SA_FLAGS_BUFSIZE != SAFLGSZ) && !defined(__lint)
1371 1373  #define REPORT_BUFSIZE SAFLGSZ
1372 1374  #include "report_bufsize.h"
1373 1375  #error "CONV_CNOTE_SA_FLAGS_BUFSIZE does not match SAFLGSZ"
1374 1376  #endif
1375 1377  
1376 1378  const char *
1377 1379  conv_cnote_sa_flags(int flags, Conv_fmt_flags_t fmt_flags,
1378 1380      Conv_cnote_sa_flags_buf_t *cnote_sa_flags_buf)
1379 1381  {
1380 1382          static const Val_desc vda[] = {
1381 1383                  { SA_ONSTACK,           MSG_SA_ONSTACK },
1382 1384                  { SA_RESETHAND,         MSG_SA_RESETHAND },
1383 1385                  { SA_RESTART,           MSG_SA_RESTART },
1384 1386                  { SA_SIGINFO,           MSG_SA_SIGINFO },
1385 1387                  { SA_NODEFER,           MSG_SA_NODEFER },
1386 1388                  { SA_NOCLDWAIT,         MSG_SA_NOCLDWAIT },
1387 1389                  { SA_NOCLDSTOP,         MSG_SA_NOCLDSTOP },
1388 1390                  { 0,                    0 }
1389 1391          };
1390 1392          static CONV_EXPN_FIELD_ARG conv_arg = {
1391 1393              NULL, sizeof (cnote_sa_flags_buf->buf) };
1392 1394  
1393 1395          if (flags == 0)
1394 1396                  return (MSG_ORIG(MSG_GBL_ZERO));
1395 1397  
1396 1398          conv_arg.buf = cnote_sa_flags_buf->buf;
1397 1399          conv_arg.oflags = conv_arg.rflags = flags;
1398 1400          (void) conv_expn_field(&conv_arg, vda, fmt_flags);
1399 1401  
1400 1402          return ((const char *)cnote_sa_flags_buf->buf);
1401 1403  }
1402 1404  
1403 1405  
1404 1406  #define SSFLGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1405 1407          MSG_SS_ONSTACK_SIZE             + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1406 1408          MSG_SS_DISABLE_SIZE             + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1407 1409          CONV_INV_BUFSIZE                + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1408 1410  
1409 1411  /*
1410 1412   * Ensure that Conv_cnote_ss_flags_buf_t is large enough:
1411 1413   *
1412 1414   * SSFLGSZ is the real minimum size of the buffer required by
1413 1415   * conv_cnote_ss_flags(). However, Conv_cnote_ss_flags_buf_t
1414 1416   * uses CONV_CNOTE_SS_FLAGS_BUFSIZE to set the buffer size. We do
1415 1417   * things this way because the definition of SSFLGSZ uses information
1416 1418   * that is not available in the environment of other programs
1417 1419   * that include the conv.h header file.
1418 1420   */
1419 1421  #if (CONV_CNOTE_SS_FLAGS_BUFSIZE != SSFLGSZ) && !defined(__lint)
1420 1422  #define REPORT_BUFSIZE SSFLGSZ
1421 1423  #include "report_bufsize.h"
1422 1424  #error "CONV_CNOTE_SS_FLAGS_BUFSIZE does not match SSFLGSZ"
1423 1425  #endif
1424 1426  
1425 1427  const char *
1426 1428  conv_cnote_ss_flags(int flags, Conv_fmt_flags_t fmt_flags,
1427 1429      Conv_cnote_ss_flags_buf_t *cnote_ss_flags_buf)
1428 1430  {
1429 1431          static const Val_desc vda[] = {
1430 1432                  { SS_ONSTACK,           MSG_SS_ONSTACK },
1431 1433                  { SS_DISABLE,           MSG_SS_DISABLE },
1432 1434                  { 0,                    0 }
1433 1435          };
1434 1436          static CONV_EXPN_FIELD_ARG conv_arg = {
1435 1437              NULL, sizeof (cnote_ss_flags_buf->buf) };
1436 1438  
1437 1439          if (flags == 0)
1438 1440                  return (MSG_ORIG(MSG_GBL_ZERO));
1439 1441  
1440 1442          conv_arg.buf = cnote_ss_flags_buf->buf;
1441 1443          conv_arg.oflags = conv_arg.rflags = flags;
1442 1444          (void) conv_expn_field(&conv_arg, vda, fmt_flags);
1443 1445  
1444 1446          return ((const char *)cnote_ss_flags_buf->buf);
1445 1447  }
1446 1448  
1447 1449  
1448 1450  /*
1449 1451   * Solaris has a variety of types that use bitmasks to represent
1450 1452   * sets of things like signals (sigset_t), faults (fltset_t), and
1451 1453   * system calls (sysset_t). These types use arrays of unsigned 32-bit
1452 1454   * integers to represent the set. These are public types that
1453 1455   * cannot be changed, so they are generously oversized to allow
1454 1456   * for future growth. Hence, there are usually unused bits.
1455 1457   *
1456 1458   * conv_bitmaskset() generalizes the process of displaying these items.
1457 1459   */
1458 1460  
1459 1461  typedef struct {
1460 1462          const Val_desc  *vdp;           /* NULL, or bitmask description */
1461 1463          uint32_t        unused_bits;    /* Mask of undefined bits */
1462 1464  } conv_bitmaskset_desc_t;
1463 1465  
1464 1466  /*
1465 1467   * entry:
1466 1468   *      n_mask - # of 32-bit masks that make up this bitmask type.
1467 1469   *      maskarr - Array of n_mask 32-bit mask values
1468 1470   *      bitmask_descarr - Array of n_mask bitmask_desc_t descriptors,
1469 1471   *              one for each mask, specifying the bitmask names, and
1470 1472   *              a mask of the bits that are not defined by the system.
1471 1473   *      fmt_flags - CONV_FMT_* values, used to specify formatting details.
1472 1474   *      conv_buf - Buffer to receive formatted results
1473 1475   *      conv_buf_size - Size of conv_buf, including room for NULL termination
1474 1476   */
1475 1477  static const char *
1476 1478  conv_bitmaskset(uint32_t *maskarr, int n_mask,
1477 1479      const conv_bitmaskset_desc_t *bitmask_descarr, Conv_fmt_flags_t fmt_flags,
1478 1480      char *conv_buf, size_t conv_buf_size)
1479 1481  {
1480 1482          CONV_EXPN_FIELD_ARG     conv_arg;
1481 1483          int     i, need_sep = 0;
1482 1484  
1483 1485          /* If every bit of every mask is 0, return 0 as the result */
1484 1486          for (i = 0; i < n_mask; i++)
1485 1487                  if (maskarr[i] != 0)
1486 1488                          break;
1487 1489          if (i == n_mask)
1488 1490                  return (MSG_ORIG(MSG_GBL_ZERO));
1489 1491  
1490 1492          /*
1491 1493           * At least one bit is non-zero. Move through the masks
1492 1494           * and process each one.
1493 1495           */
1494 1496          (void) memset(&conv_arg, 0, sizeof (conv_arg));
1495 1497          conv_arg.bufsize = conv_buf_size;
1496 1498          conv_arg.buf = conv_buf;
1497 1499          if ((fmt_flags & CONV_FMT_NOBKT) == 0) {
1498 1500                  *conv_arg.buf++ = '[';
1499 1501                  *conv_arg.buf++ = ' ';
1500 1502                  conv_arg.bufsize -= 2;
1501 1503          }
1502 1504  
1503 1505          /*
1504 1506           * conv_expn_field() orders its output with the most significant
1505 1507           * bits on the left. To preserve this ordering across the
1506 1508           * subwords or our "virtual bitmask", we need to process
1507 1509           * the sub-words in the same order, from most significant down
1508 1510           * to least significant. Since unassigned bits tend to be at
1509 1511           * the MSB end of the word, we process the unused bits first.
1510 1512           *
1511 1513           * One implication of this is that the caller should not use
1512 1514           * the unassigned bits for "abandoned" bits in the middle of
1513 1515           * a used range, but should instead define the string for
1514 1516           * that bit as being the string representation of that decimal
1515 1517           * value (i.e. "65"). That will cause the bit to be properly
1516 1518           * sorted among the named bits to either side of it.
1517 1519           */
1518 1520          for (i = 0; i < n_mask; i++) {
1519 1521                  size_t          n;
1520 1522                  uint32_t        mask, unused_bits;
1521 1523                  const int       bits_per_mask = sizeof (mask) * 8;
1522 1524  
1523 1525                  mask = maskarr[i];
1524 1526                  unused_bits = mask & bitmask_descarr[i].unused_bits;
1525 1527                  mask &= ~unused_bits;
1526 1528  
1527 1529                  if (mask != 0) {
1528 1530  
1529 1531                          conv_arg.oflags = conv_arg.rflags = mask;
1530 1532                          if (need_sep) {
1531 1533                                  *conv_arg.buf++ = ' ';
1532 1534                                  conv_arg.bufsize--;
1533 1535                          }
1534 1536                          need_sep = 1;
1535 1537                          (void) conv_expn_field(&conv_arg,
1536 1538                              bitmask_descarr[i].vdp, fmt_flags | CONV_FMT_NOBKT);
1537 1539                          n = strlen(conv_arg.buf);
1538 1540                          conv_arg.bufsize -= n;
1539 1541                          conv_arg.buf += n;
1540 1542                  }
1541 1543  
1542 1544                  if (unused_bits != 0) {
1543 1545                          uint32_t        bit = 0x00000001;
1544 1546                          int             j;
1545 1547  
1546 1548                          for (j = 1; j <= bits_per_mask; j++, bit *= 2) {
1547 1549                                  if ((unused_bits & bit) == 0)
1548 1550                                          continue;
1549 1551  
1550 1552                                  if (need_sep) {
1551 1553                                          *conv_arg.buf++ = ' ';
1552 1554                                          conv_arg.bufsize--;
1553 1555                                  }
1554 1556                                  need_sep = 1;
1555 1557                                  n = snprintf(conv_arg.buf, conv_arg.bufsize,
1556 1558                                      MSG_ORIG(MSG_FMT_WORD),
1557 1559                                      EC_WORD(j + (bits_per_mask * i)));
1558 1560                                  conv_arg.buf += n;
1559 1561                                  conv_arg.bufsize -= n;
1560 1562                          }
1561 1563                  }
1562 1564          }
1563 1565          if ((fmt_flags & CONV_FMT_NOBKT) == 0) {
1564 1566                  *conv_arg.buf++ = ' ';
1565 1567                  *conv_arg.buf++ = ']';
1566 1568          }
1567 1569          *conv_arg.buf = '\0';
1568 1570  
1569 1571          return ((const char *) conv_buf);
1570 1572  }
1571 1573  
1572 1574  
1573 1575  #define SIGSET_FLAGSZ   CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1574 1576          /* sigset_t [0] - Signals [1 - 32] */ \
1575 1577          MSG_SIGHUP_ALT_SIZE     + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1576 1578          MSG_SIGINT_ALT_SIZE     + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1577 1579          MSG_SIGQUIT_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1578 1580          MSG_SIGILL_ALT_SIZE     + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1579 1581          MSG_SIGTRAP_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1580 1582          MSG_SIGABRT_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1581 1583          MSG_SIGEMT_ALT_SIZE     + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1582 1584          MSG_SIGFPE_ALT_SIZE     + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1583 1585          MSG_SIGKILL_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1584 1586          MSG_SIGBUS_ALT_SIZE     + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1585 1587          MSG_SIGSEGV_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1586 1588          MSG_SIGSYS_ALT_SIZE     + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1587 1589          MSG_SIGPIPE_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1588 1590          MSG_SIGALRM_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1589 1591          MSG_SIGTERM_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1590 1592          MSG_SIGUSR1_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1591 1593          MSG_SIGUSR2_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1592 1594          MSG_SIGCHLD_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1593 1595          MSG_SIGPWR_ALT_SIZE     + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1594 1596          MSG_SIGWINCH_ALT_SIZE   + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1595 1597          MSG_SIGURG_ALT_SIZE     + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1596 1598          MSG_SIGPOLL_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1597 1599          MSG_SIGSTOP_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1598 1600          MSG_SIGTSTP_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1599 1601          MSG_SIGCONT_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1600 1602          MSG_SIGTTIN_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1601 1603          MSG_SIGTTOU_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1602 1604          MSG_SIGVTALRM_ALT_SIZE  + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1603 1605          MSG_SIGPROF_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1604 1606          MSG_SIGXCPU_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1605 1607          MSG_SIGXFSZ_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1606 1608          MSG_SIGWAITING_ALT_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1607 1609          \
1608 1610          /* \
1609 1611           * sigset_t [1] - Signals [33 - 64] \
1610 1612           * There are 24 unused bits, each of which needs two \
1611 1613           * characters plus a separator. \
1612 1614           */ \
1613 1615          MSG_SIGLWP_ALT_SIZE     + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1614 1616          MSG_SIGFREEZE_ALT_SIZE  + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1615 1617          MSG_SIGTHAW_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1616 1618          MSG_SIGCANCEL_ALT_SIZE  + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1617 1619          MSG_SIGLOST_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1618 1620          MSG_SIGXRES_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1619 1621          MSG_SIGJVM1_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1620 1622          MSG_SIGJVM2_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1621 1623          (24 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1622 1624          \
1623 1625          /* \
1624 1626           * sigset_t [2] - Signals [65 - 96] \
1625 1627           * There are 32 unused bits, each of which needs two \
1626 1628           * characters plus a separator. \
1627 1629           */ \
1628 1630          (32 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1629 1631          \
1630 1632          /* \
1631 1633           * sigset_t [2] - Signals [97 - 128] \
1632 1634           * There are 32 unused bits. Three of these need two \
1633 1635           * characters, and 29 need 3. Each one needs a separator. \
1634 1636           */ \
1635 1637          (3 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1636 1638          (29 * (3 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1637 1639          \
1638 1640          CONV_INV_BUFSIZE        + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1639 1641  
1640 1642  /*
1641 1643   * Ensure that Conv_cnote_sigset_buf_t is large enough:
1642 1644   *
1643 1645   * SIGSET_FLAGSZ is the real minimum size of the buffer required by
1644 1646   * conv_cnote_sigset(). However, Conv_cnote_sigset_buf_t
1645 1647   * uses CONV_CNOTE_SIGSET_BUFSIZE to set the buffer size. We do
1646 1648   * things this way because the definition of SIGSET_FLAGSZ uses information
1647 1649   * that is not available in the environment of other programs
1648 1650   * that include the conv.h header file.
1649 1651   */
1650 1652  #if (CONV_CNOTE_SIGSET_BUFSIZE != SIGSET_FLAGSZ) && !defined(__lint)
1651 1653  #define REPORT_BUFSIZE SIGSET_FLAGSZ
1652 1654  #include "report_bufsize.h"
1653 1655  #error "CONV_CNOTE_SIGSET_BUFSIZE does not match SIGSET_FLAGSZ"
1654 1656  #endif
1655 1657  
1656 1658  const char *
1657 1659  conv_cnote_sigset(uint32_t *maskarr, int n_mask,
1658 1660      Conv_fmt_flags_t fmt_flags, Conv_cnote_sigset_buf_t *cnote_sigset_buf)
1659 1661  {
1660 1662  #define N_MASK 4
1661 1663  
1662 1664          static const Val_desc vda0[] = {
1663 1665                  { 0x00000001,           MSG_SIGHUP_ALT },
1664 1666                  { 0x00000002,           MSG_SIGINT_ALT },
1665 1667                  { 0x00000004,           MSG_SIGQUIT_ALT },
1666 1668                  { 0x00000008,           MSG_SIGILL_ALT },
1667 1669                  { 0x00000010,           MSG_SIGTRAP_ALT },
1668 1670                  { 0x00000020,           MSG_SIGABRT_ALT },
1669 1671                  { 0x00000040,           MSG_SIGEMT_ALT },
1670 1672                  { 0x00000080,           MSG_SIGFPE_ALT },
1671 1673                  { 0x00000100,           MSG_SIGKILL_ALT },
1672 1674                  { 0x00000200,           MSG_SIGBUS_ALT },
1673 1675                  { 0x00000400,           MSG_SIGSEGV_ALT },
1674 1676                  { 0x00000800,           MSG_SIGSYS_ALT },
1675 1677                  { 0x00001000,           MSG_SIGPIPE_ALT },
1676 1678                  { 0x00002000,           MSG_SIGALRM_ALT },
1677 1679                  { 0x00004000,           MSG_SIGTERM_ALT },
1678 1680                  { 0x00008000,           MSG_SIGUSR1_ALT },
1679 1681                  { 0x00010000,           MSG_SIGUSR2_ALT },
1680 1682                  { 0x00020000,           MSG_SIGCHLD_ALT },
1681 1683                  { 0x00040000,           MSG_SIGPWR_ALT },
1682 1684                  { 0x00080000,           MSG_SIGWINCH_ALT },
1683 1685                  { 0x00100000,           MSG_SIGURG_ALT },
1684 1686                  { 0x00200000,           MSG_SIGPOLL_ALT },
1685 1687                  { 0x00400000,           MSG_SIGSTOP_ALT },
1686 1688                  { 0x00800000,           MSG_SIGTSTP_ALT },
1687 1689                  { 0x01000000,           MSG_SIGCONT_ALT },
1688 1690                  { 0x02000000,           MSG_SIGTTIN_ALT },
1689 1691                  { 0x04000000,           MSG_SIGTTOU_ALT },
1690 1692                  { 0x08000000,           MSG_SIGVTALRM_ALT },
1691 1693                  { 0x10000000,           MSG_SIGPROF_ALT },
1692 1694                  { 0x20000000,           MSG_SIGXCPU_ALT },
1693 1695                  { 0x40000000,           MSG_SIGXFSZ_ALT },
1694 1696                  { 0x80000000,           MSG_SIGWAITING_ALT },
1695 1697                  { 0,                    0 }
1696 1698          };
1697 1699          static const Val_desc vda1[] = {
1698 1700                  { 0x00000001,           MSG_SIGLWP_ALT },
1699 1701                  { 0x00000002,           MSG_SIGFREEZE_ALT },
1700 1702                  { 0x00000004,           MSG_SIGTHAW_ALT },
1701 1703                  { 0x00000008,           MSG_SIGCANCEL_ALT },
1702 1704                  { 0x00000010,           MSG_SIGLOST_ALT },
1703 1705                  { 0x00000020,           MSG_SIGXRES_ALT },
1704 1706                  { 0x00000040,           MSG_SIGJVM1_ALT },
1705 1707                  { 0x00000080,           MSG_SIGJVM2_ALT },
1706 1708                  { 0,                    0 }
1707 1709          };
1708 1710          static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
1709 1711                  { vda0, 0 },
1710 1712                  { vda1, 0xffffff00 },
1711 1713                  { NULL, 0xffffffff },
1712 1714                  { NULL, 0xffffffff }
1713 1715          };
1714 1716  
1715 1717          if (n_mask > N_MASK)
1716 1718                  n_mask = N_MASK;
1717 1719          return (conv_bitmaskset(maskarr, n_mask, bitmask_desc, fmt_flags,
1718 1720              cnote_sigset_buf->buf, CONV_CNOTE_SIGSET_BUFSIZE));
1719 1721  
1720 1722  #undef N_MASK
1721 1723  }
1722 1724  
1723 1725  
1724 1726  #define FLTSET_FLAGSZ   CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1725 1727          /* \
1726 1728           * fltset_t[0] - Faults [1 - 32] \
1727 1729           * There are 19 unused bits, each of which needs two \
1728 1730           * characters plus a separator. \
1729 1731           */ \
1730 1732          MSG_FLTILL_ALT_SIZE     + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1731 1733          MSG_FLTPRIV_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1732 1734          MSG_FLTBPT_ALT_SIZE     + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1733 1735          MSG_FLTTRACE_ALT_SIZE   + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1734 1736          MSG_FLTACCESS_ALT_SIZE  + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1735 1737          MSG_FLTBOUNDS_ALT_SIZE  + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1736 1738          MSG_FLTIOVF_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1737 1739          MSG_FLTIZDIV_ALT_SIZE   + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1738 1740          MSG_FLTFPE_ALT_SIZE     + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1739 1741          MSG_FLTSTACK_ALT_SIZE   + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1740 1742          MSG_FLTPAGE_ALT_SIZE    + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1741 1743          MSG_FLTWATCH_ALT_SIZE   + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1742 1744          MSG_FLTCPCOVF_ALT_SIZE  + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
1743 1745          (19 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1744 1746          /* \
1745 1747           * fltset_t [1] - Faults [33 - 64] \
1746 1748           * There are 32 unused bits, each of which needs two \
1747 1749           * characters plus a separator. \
1748 1750           */ \
1749 1751          (32 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1750 1752          /* \
1751 1753           * fltset_t [2] - Faults [65 - 96] \
1752 1754           * There are 32 unused bits, each of which needs two \
1753 1755           * characters plus a separator. \
1754 1756           */ \
1755 1757          (32 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1756 1758          /* \
1757 1759           * fltset_t [3] - Faults [97 - 128] \
1758 1760           * There are 32 unused bits. Three of these need two \
1759 1761           * characters, and 29 need 3. Each one needs a separator. \
1760 1762           */ \
1761 1763          (3 * (2 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1762 1764          (29 * (3 + CONV_EXPN_FIELD_DEF_SEP_SIZE)) + \
1763 1765          \
1764 1766          CONV_INV_BUFSIZE        + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
1765 1767  
1766 1768  /*
1767 1769   * Ensure that Conv_cnote_fltset_buf_t is large enough:
1768 1770   *
1769 1771   * FLTSET_FLAGSZ is the real minimum size of the buffer required by
1770 1772   * conv_cnote_fltset(). However, Conv_cnote_fltset_buf_t
1771 1773   * uses CONV_CNOTE_FLTSET_BUFSIZE to set the buffer size. We do
1772 1774   * things this way because the definition of FLTSET_FLAGSZ uses information
1773 1775   * that is not available in the environment of other programs
1774 1776   * that include the conv.h header file.
1775 1777   */
1776 1778  #if (CONV_CNOTE_FLTSET_BUFSIZE != FLTSET_FLAGSZ) && !defined(__lint)
1777 1779  #define REPORT_BUFSIZE FLTSET_FLAGSZ
1778 1780  #include "report_bufsize.h"
1779 1781  #error "CONV_CNOTE_FLTSET_BUFSIZE does not match FLTSET_FLAGSZ"
1780 1782  #endif
1781 1783  
1782 1784  const char *
1783 1785  conv_cnote_fltset(uint32_t *maskarr, int n_mask,
1784 1786      Conv_fmt_flags_t fmt_flags, Conv_cnote_fltset_buf_t *cnote_fltset_buf)
1785 1787  {
1786 1788  #define N_MASK 4
1787 1789  
1788 1790          static const Val_desc vda0[] = {
1789 1791                  { 0x00000001,           MSG_FLTILL_ALT },
1790 1792                  { 0x00000002,           MSG_FLTPRIV_ALT },
1791 1793                  { 0x00000004,           MSG_FLTBPT_ALT },
1792 1794                  { 0x00000008,           MSG_FLTTRACE_ALT },
1793 1795                  { 0x00000010,           MSG_FLTACCESS_ALT },
1794 1796                  { 0x00000020,           MSG_FLTBOUNDS_ALT },
1795 1797                  { 0x00000040,           MSG_FLTIOVF_ALT },
1796 1798                  { 0x00000080,           MSG_FLTIZDIV_ALT },
1797 1799                  { 0x00000100,           MSG_FLTFPE_ALT },
1798 1800                  { 0x00000200,           MSG_FLTSTACK_ALT },
1799 1801                  { 0x00000400,           MSG_FLTPAGE_ALT },
1800 1802                  { 0x00000800,           MSG_FLTWATCH_ALT },
1801 1803                  { 0x00001000,           MSG_FLTCPCOVF_ALT },
1802 1804                  { 0,                    0 }
1803 1805          };
1804 1806          static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
1805 1807                  { vda0, 0xffffe000 },
1806 1808                  { NULL, 0xffffffff },
1807 1809                  { NULL, 0xffffffff },
1808 1810                  { NULL, 0xffffffff }
1809 1811          };
1810 1812  
1811 1813          if (n_mask > N_MASK)
1812 1814                  n_mask = N_MASK;
1813 1815          return (conv_bitmaskset(maskarr, n_mask, bitmask_desc, fmt_flags,
1814 1816              cnote_fltset_buf->buf, CONV_CNOTE_FLTSET_BUFSIZE));
1815 1817  
1816 1818  #undef N_MASK
1817 1819  }
1818 1820  
1819 1821  
1820 1822  
1821 1823  #define SYSSET_FLAGSZ   CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
1822 1824          (512 * CONV_EXPN_FIELD_DEF_SEP_SIZE) + \
1823 1825          \
1824 1826          /* sysset_t[0] - System Calls [1 - 32] */ \
1825 1827          MSG_SYS_EXIT_ALT_SIZE                   /* 1 */ + \
1826 1828          MSG_SYS_2_SIZE                          /* 2 (unused) */ + \
1827 1829          MSG_SYS_READ_ALT_SIZE                   /* 3 */ + \
1828 1830          MSG_SYS_WRITE_ALT_SIZE                  /* 4 */ + \
1829 1831          MSG_SYS_OPEN_ALT_SIZE                   /* 5 */ + \
1830 1832          MSG_SYS_CLOSE_ALT_SIZE                  /* 6 */ + \
1831 1833          MSG_SYS_7_SIZE                          /* 7 (unused) */ + \
1832 1834          MSG_SYS_8_SIZE                          /* 8 (unused) */ + \
1833 1835          MSG_SYS_LINK_ALT_SIZE                   /* 9 */ + \
1834 1836          MSG_SYS_UNLINK_ALT_SIZE                 /* 10 */ + \
1835 1837          MSG_SYS_11_SIZE                         /* 11 (unused) */ + \
1836 1838          MSG_SYS_CHDIR_ALT_SIZE                  /* 12 */ + \
1837 1839          MSG_SYS_TIME_ALT_SIZE                   /* 13 */ + \
1838 1840          MSG_SYS_MKNOD_ALT_SIZE                  /* 14 */ + \
1839 1841          MSG_SYS_CHMOD_ALT_SIZE                  /* 15 */ + \
1840 1842          MSG_SYS_CHOWN_ALT_SIZE                  /* 16 */ + \
1841 1843          MSG_SYS_BRK_ALT_SIZE                    /* 17 */ + \
1842 1844          MSG_SYS_STAT_ALT_SIZE                   /* 18 */ + \
1843 1845          MSG_SYS_LSEEK_ALT_SIZE                  /* 19 */ + \
1844 1846          MSG_SYS_GETPID_ALT_SIZE                 /* 20 */ + \
1845 1847          MSG_SYS_MOUNT_ALT_SIZE                  /* 21 */ + \
1846 1848          MSG_SYS_22_SIZE                         /* 22 (unused) */ + \
1847 1849          MSG_SYS_SETUID_ALT_SIZE                 /* 23 */ + \
1848 1850          MSG_SYS_GETUID_ALT_SIZE                 /* 24 */ + \
1849 1851          MSG_SYS_STIME_ALT_SIZE                  /* 25 */ + \
1850 1852          MSG_SYS_PCSAMPLE_ALT_SIZE               /* 26 */ + \
1851 1853          MSG_SYS_ALARM_ALT_SIZE                  /* 27 */ + \
1852 1854          MSG_SYS_FSTAT_ALT_SIZE                  /* 28 */ + \
1853 1855          MSG_SYS_PAUSE_ALT_SIZE                  /* 29 */ + \
1854 1856          MSG_SYS_30_SIZE                         /* 30 (unused) */ + \
1855 1857          MSG_SYS_STTY_ALT_SIZE                   /* 31 */ + \
1856 1858          MSG_SYS_GTTY_ALT_SIZE                   /* 32 */ + \
1857 1859          \
1858 1860          /* sysset_t[1] - System Calls [33 - 64] */ \
1859 1861          MSG_SYS_ACCESS_ALT_SIZE                 /* 33 */ + \
1860 1862          MSG_SYS_NICE_ALT_SIZE                   /* 34 */ + \
1861 1863          MSG_SYS_STATFS_ALT_SIZE                 /* 35 */ + \
1862 1864          MSG_SYS_SYNC_ALT_SIZE                   /* 36 */ + \
1863 1865          MSG_SYS_KILL_ALT_SIZE                   /* 37 */ + \
1864 1866          MSG_SYS_FSTATFS_ALT_SIZE                /* 38 */ + \
1865 1867          MSG_SYS_PGRPSYS_ALT_SIZE                /* 39 */ + \
1866 1868          MSG_SYS_UUCOPYSTR_ALT_SIZE              /* 40 */ + \
1867 1869          MSG_SYS_41_SIZE                         /* 41 (unused) */ + \
1868 1870          MSG_SYS_PIPE_ALT_SIZE                   /* 42 */ + \
1869 1871          MSG_SYS_TIMES_ALT_SIZE                  /* 43 */ + \
1870 1872          MSG_SYS_PROFIL_ALT_SIZE                 /* 44 */ + \
1871 1873          MSG_SYS_FACCESSAT_ALT_SIZE              /* 45 */ + \
1872 1874          MSG_SYS_SETGID_ALT_SIZE                 /* 46 */ + \
1873 1875          MSG_SYS_GETGID_ALT_SIZE                 /* 47 */ + \
1874 1876          MSG_SYS_48_SIZE                         /* 48 (unused) */ + \
1875 1877          MSG_SYS_MSGSYS_ALT_SIZE                 /* 49 */ + \
1876 1878          MSG_SYS_SYSI86_ALT_SIZE                 /* 50 */ + \
1877 1879          MSG_SYS_ACCT_ALT_SIZE                   /* 51 */ + \
1878 1880          MSG_SYS_SHMSYS_ALT_SIZE                 /* 52 */ + \
1879 1881          MSG_SYS_SEMSYS_ALT_SIZE                 /* 53 */ + \
1880 1882          MSG_SYS_IOCTL_ALT_SIZE                  /* 54 */ + \
1881 1883          MSG_SYS_UADMIN_ALT_SIZE                 /* 55 */ + \
1882 1884          MSG_SYS_FCHOWNAT_ALT_SIZE               /* 56 */ + \
1883 1885          MSG_SYS_UTSSYS_ALT_SIZE                 /* 57 */ + \
1884 1886          MSG_SYS_FDSYNC_ALT_SIZE                 /* 58 */ + \
1885 1887          MSG_SYS_EXECVE_ALT_SIZE                 /* 59 */ + \
1886 1888          MSG_SYS_UMASK_ALT_SIZE                  /* 60 */ + \
1887 1889          MSG_SYS_CHROOT_ALT_SIZE                 /* 61 */ + \
1888 1890          MSG_SYS_FCNTL_ALT_SIZE                  /* 62 */ + \
1889 1891          MSG_SYS_ULIMIT_ALT_SIZE                 /* 63 */ + \
1890 1892          MSG_SYS_RENAMEAT_ALT_SIZE               /* 64 */ + \
1891 1893          \
1892 1894          /* sysset_t[2] - System Calls [65 - 96] */ \
1893 1895          MSG_SYS_UNLINKAT_ALT_SIZE               /* 65 */ + \
1894 1896          MSG_SYS_FSTATAT_ALT_SIZE                /* 66 */ + \
1895 1897          MSG_SYS_FSTATAT64_ALT_SIZE              /* 67 */ + \
1896 1898          MSG_SYS_OPENAT_ALT_SIZE                 /* 68 */ + \
1897 1899          MSG_SYS_OPENAT64_ALT_SIZE               /* 69 */ + \
1898 1900          MSG_SYS_TASKSYS_ALT_SIZE                /* 70 */ + \
1899 1901          MSG_SYS_ACCTCTL_ALT_SIZE                /* 71 */ + \
1900 1902          MSG_SYS_EXACCTSYS_ALT_SIZE              /* 72 */ + \
1901 1903          MSG_SYS_GETPAGESIZES_ALT_SIZE           /* 73 */ + \
1902 1904          MSG_SYS_RCTLSYS_ALT_SIZE                /* 74 */ + \
1903 1905          MSG_SYS_SIDSYS_ALT_SIZE                 /* 75 */ + \
1904 1906          MSG_SYS_76_SIZE                         /* 76 (unused) */ + \
1905 1907          MSG_SYS_LWP_PARK_ALT_SIZE               /* 77 */ + \
1906 1908          MSG_SYS_SENDFILEV_ALT_SIZE              /* 78 */ + \
1907 1909          MSG_SYS_RMDIR_ALT_SIZE                  /* 79 */ + \
1908 1910          MSG_SYS_MKDIR_ALT_SIZE                  /* 80 */ + \
1909 1911          MSG_SYS_GETDENTS_ALT_SIZE               /* 81 */ + \
1910 1912          MSG_SYS_PRIVSYS_ALT_SIZE                /* 82 */ + \
1911 1913          MSG_SYS_UCREDSYS_ALT_SIZE               /* 83 */ + \
1912 1914          MSG_SYS_SYSFS_ALT_SIZE                  /* 84 */ + \
1913 1915          MSG_SYS_GETMSG_ALT_SIZE                 /* 85 */ + \
1914 1916          MSG_SYS_PUTMSG_ALT_SIZE                 /* 86 */ + \
1915 1917          MSG_SYS_87_SIZE                         /* 87 (unused) */ + \
1916 1918          MSG_SYS_LSTAT_ALT_SIZE                  /* 88 */ + \
1917 1919          MSG_SYS_SYMLINK_ALT_SIZE                /* 89 */ + \
1918 1920          MSG_SYS_READLINK_ALT_SIZE               /* 90 */ + \
1919 1921          MSG_SYS_SETGROUPS_ALT_SIZE              /* 91 */ + \
1920 1922          MSG_SYS_GETGROUPS_ALT_SIZE              /* 92 */ + \
1921 1923          MSG_SYS_FCHMOD_ALT_SIZE                 /* 93 */ + \
1922 1924          MSG_SYS_FCHOWN_ALT_SIZE                 /* 94 */ + \
1923 1925          MSG_SYS_SIGPROCMASK_ALT_SIZE            /* 95 */ + \
1924 1926          MSG_SYS_SIGSUSPEND_ALT_SIZE             /* 96 */ + \
1925 1927          \
1926 1928          /* sysset_t[3] - System Calls [97 - 128] */ \
1927 1929          MSG_SYS_SIGALTSTACK_ALT_SIZE            /* 97 */ + \
1928 1930          MSG_SYS_SIGACTION_ALT_SIZE              /* 98 */ + \
1929 1931          MSG_SYS_SIGPENDING_ALT_SIZE             /* 99 */ + \
1930 1932          MSG_SYS_CONTEXT_ALT_SIZE                /* 100 */ + \
1931 1933          MSG_SYS_101_SIZE                        /* 101 (unused) */ + \
1932 1934          MSG_SYS_102_SIZE                        /* 102 (unused) */ + \
1933 1935          MSG_SYS_STATVFS_ALT_SIZE                /* 103 */ + \
1934 1936          MSG_SYS_FSTATVFS_ALT_SIZE               /* 104 */ + \
1935 1937          MSG_SYS_GETLOADAVG_ALT_SIZE             /* 105 */ + \
1936 1938          MSG_SYS_NFSSYS_ALT_SIZE                 /* 106 */ + \
1937 1939          MSG_SYS_WAITID_ALT_SIZE                 /* 107 */ + \
1938 1940          MSG_SYS_SIGSENDSYS_ALT_SIZE             /* 108 */ + \
1939 1941          MSG_SYS_HRTSYS_ALT_SIZE                 /* 109 */ + \
1940 1942          MSG_SYS_UTIMESYS_ALT_SIZE               /* 110 */ + \
1941 1943          MSG_SYS_SIGRESEND_ALT_SIZE              /* 111 */ + \
1942 1944          MSG_SYS_PRIOCNTLSYS_ALT_SIZE            /* 112 */ + \
1943 1945          MSG_SYS_PATHCONF_ALT_SIZE               /* 113 */ + \
1944 1946          MSG_SYS_MINCORE_ALT_SIZE                /* 114 */ + \
1945 1947          MSG_SYS_MMAP_ALT_SIZE                   /* 115 */ + \
1946 1948          MSG_SYS_MPROTECT_ALT_SIZE               /* 116 */ + \
1947 1949          MSG_SYS_MUNMAP_ALT_SIZE                 /* 117 */ + \
1948 1950          MSG_SYS_FPATHCONF_ALT_SIZE              /* 118 */ + \
1949 1951          MSG_SYS_VFORK_ALT_SIZE                  /* 119 */ + \
1950 1952          MSG_SYS_FCHDIR_ALT_SIZE                 /* 120 */ + \
1951 1953          MSG_SYS_READV_ALT_SIZE                  /* 121 */ + \
1952 1954          MSG_SYS_WRITEV_ALT_SIZE                 /* 122 */ + \
1953 1955          MSG_SYS_123_SIZE                        /* 123 (unused) */ + \
1954 1956          MSG_SYS_124_SIZE                        /* 124 (unused) */ + \
1955 1957          MSG_SYS_125_SIZE                        /* 125 (unused) */ + \
1956 1958          MSG_SYS_126_SIZE                        /* 126 (unused) */ + \
1957 1959          MSG_SYS_MMAPOBJ_ALT_SIZE                /* 127 */ + \
1958 1960          MSG_SYS_SETRLIMIT_ALT_SIZE              /* 128 */ + \
1959 1961          \
1960 1962          /* sysset_t[4] - System Calls [129 - 160] */ \
1961 1963          MSG_SYS_GETRLIMIT_ALT_SIZE              /* 129 */ + \
1962 1964          MSG_SYS_LCHOWN_ALT_SIZE                 /* 130 */ + \
1963 1965          MSG_SYS_MEMCNTL_ALT_SIZE                /* 131 */ + \
1964 1966          MSG_SYS_GETPMSG_ALT_SIZE                /* 132 */ + \
1965 1967          MSG_SYS_PUTPMSG_ALT_SIZE                /* 133 */ + \
1966 1968          MSG_SYS_RENAME_ALT_SIZE                 /* 134 */ + \
1967 1969          MSG_SYS_UNAME_ALT_SIZE                  /* 135 */ + \
1968 1970          MSG_SYS_SETEGID_ALT_SIZE                /* 136 */ + \
1969 1971          MSG_SYS_SYSCONFIG_ALT_SIZE              /* 137 */ + \
1970 1972          MSG_SYS_ADJTIME_ALT_SIZE                /* 138 */ + \
1971 1973          MSG_SYS_SYSTEMINFO_ALT_SIZE             /* 139 */ + \
1972 1974          MSG_SYS_SHAREFS_ALT_SIZE                /* 140 */ + \
1973 1975          MSG_SYS_SETEUID_ALT_SIZE                /* 141 */ + \
1974 1976          MSG_SYS_FORKSYS_ALT_SIZE                /* 142 */ + \
1975 1977          MSG_SYS_143_SIZE                        /* 143 (unused) */ + \
1976 1978          MSG_SYS_SIGTIMEDWAIT_ALT_SIZE           /* 144 */ + \
1977 1979          MSG_SYS_LWP_INFO_ALT_SIZE               /* 145 */ + \
1978 1980          MSG_SYS_YIELD_ALT_SIZE                  /* 146 */ + \
1979 1981          MSG_SYS_147_SIZE                        /* 147 (unused) */ + \
1980 1982          MSG_SYS_LWP_SEMA_POST_ALT_SIZE          /* 148 */ + \
1981 1983          MSG_SYS_LWP_SEMA_TRYWAIT_ALT_SIZE       /* 149 */ + \
1982 1984          MSG_SYS_LWP_DETACH_ALT_SIZE             /* 150 */ + \
1983 1985          MSG_SYS_CORECTL_ALT_SIZE                /* 151 */ + \
1984 1986          MSG_SYS_MODCTL_ALT_SIZE                 /* 152 */ + \
1985 1987          MSG_SYS_FCHROOT_ALT_SIZE                /* 153 */ + \
1986 1988          MSG_SYS_154_SIZE                        /* 154 (unused) */ + \
1987 1989          MSG_SYS_VHANGUP_ALT_SIZE                /* 155 */ + \
1988 1990          MSG_SYS_GETTIMEOFDAY_ALT_SIZE           /* 156 */ + \
1989 1991          MSG_SYS_GETITIMER_ALT_SIZE              /* 157 */ + \
1990 1992          MSG_SYS_SETITIMER_ALT_SIZE              /* 158 */ + \
1991 1993          MSG_SYS_LWP_CREATE_ALT_SIZE             /* 159 */ + \
1992 1994          MSG_SYS_LWP_EXIT_ALT_SIZE               /* 160 */ + \
1993 1995          \
1994 1996          /* sysset_t[5] - System Calls [161 - 192] */ \
1995 1997          MSG_SYS_LWP_SUSPEND_ALT_SIZE            /* 161 */ + \
1996 1998          MSG_SYS_LWP_CONTINUE_ALT_SIZE           /* 162 */ + \
1997 1999          MSG_SYS_LWP_KILL_ALT_SIZE               /* 163 */ + \
1998 2000          MSG_SYS_LWP_SELF_ALT_SIZE               /* 164 */ + \
1999 2001          MSG_SYS_LWP_SIGMASK_ALT_SIZE            /* 165 */ + \
2000 2002          MSG_SYS_LWP_PRIVATE_ALT_SIZE            /* 166 */ + \
2001 2003          MSG_SYS_LWP_WAIT_ALT_SIZE               /* 167 */ + \
2002 2004          MSG_SYS_LWP_MUTEX_WAKEUP_ALT_SIZE       /* 168 */ + \
2003 2005          MSG_SYS_169_SIZE                        /* 169 (unused) */ + \
2004 2006          MSG_SYS_LWP_COND_WAIT_ALT_SIZE          /* 170 */ + \
2005 2007          MSG_SYS_LWP_COND_SIGNAL_ALT_SIZE        /* 171 */ + \
2006 2008          MSG_SYS_LWP_COND_BROADCAST_ALT_SIZE     /* 172 */ + \
2007 2009          MSG_SYS_PREAD_ALT_SIZE                  /* 173 */ + \
2008 2010          MSG_SYS_PWRITE_ALT_SIZE                 /* 174 */ + \
2009 2011          MSG_SYS_LLSEEK_ALT_SIZE                 /* 175 */ + \
2010 2012          MSG_SYS_INST_SYNC_ALT_SIZE              /* 176 */ + \
2011 2013          MSG_SYS_BRAND_ALT_SIZE                  /* 177 */ + \
2012 2014          MSG_SYS_KAIO_ALT_SIZE                   /* 178 */ + \
2013 2015          MSG_SYS_CPC_ALT_SIZE                    /* 179 */ + \
2014 2016          MSG_SYS_LGRPSYS_ALT_SIZE                /* 180 */ + \
2015 2017          MSG_SYS_RUSAGESYS_ALT_SIZE              /* 181 */ + \
2016 2018          MSG_SYS_PORT_ALT_SIZE                   /* 182 */ + \
2017 2019          MSG_SYS_POLLSYS_ALT_SIZE                /* 183 */ + \
2018 2020          MSG_SYS_LABELSYS_ALT_SIZE               /* 184 */ + \
2019 2021          MSG_SYS_ACL_ALT_SIZE                    /* 185 */ + \
2020 2022          MSG_SYS_AUDITSYS_ALT_SIZE               /* 186 */ + \
2021 2023          MSG_SYS_PROCESSOR_BIND_ALT_SIZE         /* 187 */ + \
2022 2024          MSG_SYS_PROCESSOR_INFO_ALT_SIZE         /* 188 */ + \
2023 2025          MSG_SYS_P_ONLINE_ALT_SIZE               /* 189 */ + \
2024 2026          MSG_SYS_SIGQUEUE_ALT_SIZE               /* 190 */ + \
2025 2027          MSG_SYS_CLOCK_GETTIME_ALT_SIZE          /* 191 */ + \
2026 2028          MSG_SYS_CLOCK_SETTIME_ALT_SIZE          /* 192 */ + \
2027 2029          \
2028 2030          /* sysset_t[6] - System Calls [193 - 224] */ \
2029 2031          MSG_SYS_CLOCK_GETRES_ALT_SIZE           /* 193 */ + \
2030 2032          MSG_SYS_TIMER_CREATE_ALT_SIZE           /* 194 */ + \
2031 2033          MSG_SYS_TIMER_DELETE_ALT_SIZE           /* 195 */ + \
2032 2034          MSG_SYS_TIMER_SETTIME_ALT_SIZE          /* 196 */ + \
2033 2035          MSG_SYS_TIMER_GETTIME_ALT_SIZE          /* 197 */ + \
2034 2036          MSG_SYS_TIMER_GETOVERRUN_ALT_SIZE       /* 198 */ + \
2035 2037          MSG_SYS_NANOSLEEP_ALT_SIZE              /* 199 */ + \
2036 2038          MSG_SYS_FACL_ALT_SIZE                   /* 200 */ + \
2037 2039          MSG_SYS_DOOR_ALT_SIZE                   /* 201 */ + \
2038 2040          MSG_SYS_SETREUID_ALT_SIZE               /* 202 */ + \
2039 2041          MSG_SYS_SETREGID_ALT_SIZE               /* 203 */ + \
2040 2042          MSG_SYS_INSTALL_UTRAP_ALT_SIZE          /* 204 */ + \
2041 2043          MSG_SYS_SIGNOTIFY_ALT_SIZE              /* 205 */ + \
2042 2044          MSG_SYS_SCHEDCTL_ALT_SIZE               /* 206 */ + \
2043 2045          MSG_SYS_PSET_ALT_SIZE                   /* 207 */ + \
2044 2046          MSG_SYS_SPARC_UTRAP_INSTALL_ALT_SIZE    /* 208 */ + \
2045 2047          MSG_SYS_RESOLVEPATH_ALT_SIZE            /* 209 */ + \
2046 2048          MSG_SYS_LWP_MUTEX_TIMEDLOCK_ALT_SIZE    /* 210 */ + \
2047 2049          MSG_SYS_LWP_SEMA_TIMEDWAIT_ALT_SIZE     /* 211 */ + \
2048 2050          MSG_SYS_LWP_RWLOCK_SYS_ALT_SIZE         /* 212 */ + \
2049 2051          MSG_SYS_GETDENTS64_ALT_SIZE             /* 213 */ + \
2050 2052          MSG_SYS_MMAP64_ALT_SIZE                 /* 214 */ + \
2051 2053          MSG_SYS_STAT64_ALT_SIZE                 /* 215 */ + \
2052 2054          MSG_SYS_LSTAT64_ALT_SIZE                /* 216 */ + \
2053 2055          MSG_SYS_FSTAT64_ALT_SIZE                /* 217 */ + \
2054 2056          MSG_SYS_STATVFS64_ALT_SIZE              /* 218 */ + \
2055 2057          MSG_SYS_FSTATVFS64_ALT_SIZE             /* 219 */ + \
2056 2058          MSG_SYS_SETRLIMIT64_ALT_SIZE            /* 220 */ + \
2057 2059          MSG_SYS_GETRLIMIT64_ALT_SIZE            /* 221 */ + \
2058 2060          MSG_SYS_PREAD64_ALT_SIZE                /* 222 */ + \
2059 2061          MSG_SYS_PWRITE64_ALT_SIZE               /* 223 */ + \
2060 2062          MSG_SYS_224_SIZE                        /* 224 (unused) */ + \
2061 2063          \
2062 2064          /* sysset_t[7] - System Calls [225 - 256] */ \
2063 2065          MSG_SYS_OPEN64_ALT_SIZE                 /* 225 */ + \
2064 2066          MSG_SYS_RPCSYS_ALT_SIZE                 /* 226 */ + \
2065 2067          MSG_SYS_ZONE_ALT_SIZE                   /* 227 */ + \
2066 2068          MSG_SYS_AUTOFSSYS_ALT_SIZE              /* 228 */ + \
2067 2069          MSG_SYS_GETCWD_ALT_SIZE                 /* 229 */ + \
2068 2070          MSG_SYS_SO_SOCKET_ALT_SIZE              /* 230 */ + \
2069 2071          MSG_SYS_SO_SOCKETPAIR_ALT_SIZE          /* 231 */ + \
2070 2072          MSG_SYS_BIND_ALT_SIZE                   /* 232 */ + \
2071 2073          MSG_SYS_LISTEN_ALT_SIZE                 /* 233 */ + \
2072 2074          MSG_SYS_ACCEPT_ALT_SIZE                 /* 234 */ + \
2073 2075          MSG_SYS_CONNECT_ALT_SIZE                /* 235 */ + \
2074 2076          MSG_SYS_SHUTDOWN_ALT_SIZE               /* 236 */ + \
2075 2077          MSG_SYS_RECV_ALT_SIZE                   /* 237 */ + \
2076 2078          MSG_SYS_RECVFROM_ALT_SIZE               /* 238 */ + \
2077 2079          MSG_SYS_RECVMSG_ALT_SIZE                /* 239 */ + \
2078 2080          MSG_SYS_SEND_ALT_SIZE                   /* 240 */ + \
2079 2081          MSG_SYS_SENDMSG_ALT_SIZE                /* 241 */ + \
2080 2082          MSG_SYS_SENDTO_ALT_SIZE                 /* 242 */ + \
2081 2083          MSG_SYS_GETPEERNAME_ALT_SIZE            /* 243 */ + \
2082 2084          MSG_SYS_GETSOCKNAME_ALT_SIZE            /* 244 */ + \
2083 2085          MSG_SYS_GETSOCKOPT_ALT_SIZE             /* 245 */ + \
2084 2086          MSG_SYS_SETSOCKOPT_ALT_SIZE             /* 246 */ + \
2085 2087          MSG_SYS_SOCKCONFIG_ALT_SIZE             /* 247 */ + \
2086 2088          MSG_SYS_NTP_GETTIME_ALT_SIZE            /* 248 */ + \
2087 2089          MSG_SYS_NTP_ADJTIME_ALT_SIZE            /* 249 */ + \
2088 2090          MSG_SYS_LWP_MUTEX_UNLOCK_ALT_SIZE       /* 250 */ + \
2089 2091          MSG_SYS_LWP_MUTEX_TRYLOCK_ALT_SIZE      /* 251 */ + \
2090 2092          MSG_SYS_LWP_MUTEX_REGISTER_ALT_SIZE     /* 252 */ + \
2091 2093          MSG_SYS_CLADM_ALT_SIZE                  /* 253 */ + \
2092 2094          MSG_SYS_UUCOPY_ALT_SIZE                 /* 254 */ + \
2093 2095          MSG_SYS_UMOUNT2_ALT_SIZE                /* 255 */ + \
2094 2096          3                                       /* 256 (unused) */ + \
2095 2097          \
2096 2098          /* sysset_t[8] - System Calls [257 - 288] */ \
2097 2099          (32 * 3)                                /* 257 - 288 (unused) */ + \
2098 2100          \
2099 2101          /* sysset_t[9] - System Calls [289 - 320] */ \
2100 2102          (32 * 3)                                /* 289 - 320 (unused) */ + \
2101 2103          \
2102 2104          /* sysset_t[10] - System Calls [321 - 352] */ \
2103 2105          (32 * 3)                                /* 321 - 352 (unused) */ + \
2104 2106          \
2105 2107          /* sysset_t[11] - System Calls [353 - 384] */ \
2106 2108          (32 * 3)                                /* 353 - 384 (unused) */ + \
2107 2109          \
2108 2110          /* sysset_t[12] - System Calls [385 - 416] */ \
2109 2111          (32 * 3)                                /* 385 - 416 (unused) */ + \
2110 2112          \
2111 2113          /* sysset_t[13] - System Calls [417 - 448] */ \
2112 2114          (32 * 3)                                /* 417 - 448 (unused) */ + \
2113 2115          \
2114 2116          /* sysset_t[14] - System Calls [449 - 480] */ \
2115 2117          (32 * 3)                                /* 449 - 480 (unused) */ + \
2116 2118          \
2117 2119          /* sysset_t[15] - System Calls [481 - 512] */ \
2118 2120          (32 * 3)                                /* 481 - 512 (unused) */ + \
2119 2121          \
2120 2122          CONV_INV_BUFSIZE        + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
2121 2123  
2122 2124  /*
2123 2125   * Ensure that Conv_cnote_sysset_buf_t is large enough:
2124 2126   *
2125 2127   * SYSSET_FLAGSZ is the real minimum size of the buffer required by
2126 2128   * conv_cnote_sysset(). However, Conv_cnote_sysset_buf_t
2127 2129   * uses CONV_CNOTE_SYSSET_BUFSIZE to set the buffer size. We do
2128 2130   * things this way because the definition of SYSSET_FLAGSZ uses information
2129 2131   * that is not available in the environment of other programs
2130 2132   * that include the conv.h header file.
2131 2133   */
2132 2134  #if (CONV_CNOTE_SYSSET_BUFSIZE != SYSSET_FLAGSZ) && !defined(__lint)
2133 2135  #define REPORT_BUFSIZE SYSSET_FLAGSZ
2134 2136  #include "report_bufsize.h"
2135 2137  #error "CONV_CNOTE_SYSSET_BUFSIZE does not match SYSSET_FLAGSZ"
2136 2138  #endif
2137 2139  
2138 2140  const char *
2139 2141  conv_cnote_sysset(uint32_t *maskarr, int n_mask,
2140 2142      Conv_fmt_flags_t fmt_flags, Conv_cnote_sysset_buf_t *cnote_sysset_buf)
2141 2143  {
2142 2144  #define N_MASK 16
2143 2145  
2144 2146          static const Val_desc vda0[] = {        /* System Calls [1 - 32] */
2145 2147                  { 0x00000001,   MSG_SYS_EXIT_ALT },
2146 2148                  { 0x00000002,   MSG_SYS_2 },
2147 2149                  { 0x00000004,   MSG_SYS_READ_ALT },
2148 2150                  { 0x00000008,   MSG_SYS_WRITE_ALT },
2149 2151                  { 0x00000010,   MSG_SYS_OPEN_ALT },
2150 2152                  { 0x00000020,   MSG_SYS_CLOSE_ALT },
2151 2153                  { 0x00000040,   MSG_SYS_7 },
2152 2154                  { 0x00000080,   MSG_SYS_8 },
2153 2155                  { 0x00000100,   MSG_SYS_LINK_ALT },
2154 2156                  { 0x00000200,   MSG_SYS_UNLINK_ALT },
2155 2157                  { 0x00000400,   MSG_SYS_11 },
2156 2158                  { 0x00000800,   MSG_SYS_CHDIR_ALT },
2157 2159                  { 0x00001000,   MSG_SYS_TIME_ALT },
2158 2160                  { 0x00002000,   MSG_SYS_MKNOD_ALT },
2159 2161                  { 0x00004000,   MSG_SYS_CHMOD_ALT },
2160 2162                  { 0x00008000,   MSG_SYS_CHOWN_ALT },
2161 2163                  { 0x00010000,   MSG_SYS_BRK_ALT },
2162 2164                  { 0x00020000,   MSG_SYS_STAT_ALT },
2163 2165                  { 0x00040000,   MSG_SYS_LSEEK_ALT },
2164 2166                  { 0x00080000,   MSG_SYS_GETPID_ALT },
2165 2167                  { 0x00100000,   MSG_SYS_MOUNT_ALT },
2166 2168                  { 0x00200000,   MSG_SYS_22 },
2167 2169                  { 0x00400000,   MSG_SYS_SETUID_ALT },
2168 2170                  { 0x00800000,   MSG_SYS_GETUID_ALT },
2169 2171                  { 0x01000000,   MSG_SYS_STIME_ALT },
2170 2172                  { 0x02000000,   MSG_SYS_PCSAMPLE_ALT },
2171 2173                  { 0x04000000,   MSG_SYS_ALARM_ALT },
2172 2174                  { 0x08000000,   MSG_SYS_FSTAT_ALT },
2173 2175                  { 0x10000000,   MSG_SYS_PAUSE_ALT },
2174 2176                  { 0x20000000,   MSG_SYS_30 },
2175 2177                  { 0x40000000,   MSG_SYS_STTY_ALT },
2176 2178                  { 0x80000000,   MSG_SYS_GTTY_ALT },
2177 2179                  { 0,            0 }
2178 2180          };
2179 2181          static const Val_desc vda1[] = {        /* System Calls [33 - 64] */
2180 2182                  { 0x00000001,   MSG_SYS_ACCESS_ALT },
2181 2183                  { 0x00000002,   MSG_SYS_NICE_ALT },
2182 2184                  { 0x00000004,   MSG_SYS_STATFS_ALT },
2183 2185                  { 0x00000008,   MSG_SYS_SYNC_ALT },
2184 2186                  { 0x00000010,   MSG_SYS_KILL_ALT },
2185 2187                  { 0x00000020,   MSG_SYS_FSTATFS_ALT },
2186 2188                  { 0x00000040,   MSG_SYS_PGRPSYS_ALT },
2187 2189                  { 0x00000080,   MSG_SYS_UUCOPYSTR_ALT },
2188 2190                  { 0x00000100,   MSG_SYS_41 },
2189 2191                  { 0x00000200,   MSG_SYS_PIPE_ALT },
2190 2192                  { 0x00000400,   MSG_SYS_TIMES_ALT },
2191 2193                  { 0x00000800,   MSG_SYS_PROFIL_ALT },
2192 2194                  { 0x00001000,   MSG_SYS_FACCESSAT_ALT },
2193 2195                  { 0x00002000,   MSG_SYS_SETGID_ALT },
2194 2196                  { 0x00004000,   MSG_SYS_GETGID_ALT },
2195 2197                  { 0x00008000,   MSG_SYS_48 },
2196 2198                  { 0x00010000,   MSG_SYS_MSGSYS_ALT },
2197 2199                  { 0x00020000,   MSG_SYS_SYSI86_ALT },
2198 2200                  { 0x00040000,   MSG_SYS_ACCT_ALT },
2199 2201                  { 0x00080000,   MSG_SYS_SHMSYS_ALT },
2200 2202                  { 0x00100000,   MSG_SYS_SEMSYS_ALT },
2201 2203                  { 0x00200000,   MSG_SYS_IOCTL_ALT },
2202 2204                  { 0x00400000,   MSG_SYS_UADMIN_ALT },
2203 2205                  { 0x00800000,   MSG_SYS_FCHOWNAT_ALT },
2204 2206                  { 0x01000000,   MSG_SYS_UTSSYS_ALT },
2205 2207                  { 0x0200000,    MSG_SYS_FDSYNC_ALT },
2206 2208                  { 0x04000000,   MSG_SYS_EXECVE_ALT },
2207 2209                  { 0x08000000,   MSG_SYS_UMASK_ALT },
2208 2210                  { 0x10000000,   MSG_SYS_CHROOT_ALT },
2209 2211                  { 0x20000000,   MSG_SYS_FCNTL_ALT },
2210 2212                  { 0x40000000,   MSG_SYS_ULIMIT_ALT },
2211 2213                  { 0x80000000,   MSG_SYS_RENAMEAT_ALT },
2212 2214                  { 0,            0 }
2213 2215          };
2214 2216          static const Val_desc vda2[] = {        /* System Calls [65 - 96] */
2215 2217                  { 0x00000001,   MSG_SYS_UNLINKAT_ALT },
2216 2218                  { 0x00000002,   MSG_SYS_FSTATAT_ALT },
2217 2219                  { 0x00000004,   MSG_SYS_FSTATAT64_ALT },
2218 2220                  { 0x00000008,   MSG_SYS_OPENAT_ALT },
2219 2221                  { 0x00000010,   MSG_SYS_OPENAT64_ALT },
2220 2222                  { 0x00000020,   MSG_SYS_TASKSYS_ALT },
2221 2223                  { 0x00000040,   MSG_SYS_ACCTCTL_ALT },
2222 2224                  { 0x00000080,   MSG_SYS_EXACCTSYS_ALT },
2223 2225                  { 0x00000100,   MSG_SYS_GETPAGESIZES_ALT },
2224 2226                  { 0x00000200,   MSG_SYS_RCTLSYS_ALT },
2225 2227                  { 0x00000400,   MSG_SYS_SIDSYS_ALT },
2226 2228                  { 0x00000800,   MSG_SYS_76 },
2227 2229                  { 0x00001000,   MSG_SYS_LWP_PARK_ALT },
2228 2230                  { 0x00002000,   MSG_SYS_SENDFILEV_ALT },
2229 2231                  { 0x00004000,   MSG_SYS_RMDIR_ALT },
2230 2232                  { 0x00008000,   MSG_SYS_MKDIR_ALT },
2231 2233                  { 0x00010000,   MSG_SYS_GETDENTS_ALT },
2232 2234                  { 0x00020000,   MSG_SYS_PRIVSYS_ALT },
2233 2235                  { 0x00040000,   MSG_SYS_UCREDSYS_ALT },
2234 2236                  { 0x00080000,   MSG_SYS_SYSFS_ALT },
2235 2237                  { 0x00100000,   MSG_SYS_GETMSG_ALT },
2236 2238                  { 0x00200000,   MSG_SYS_PUTMSG_ALT },
2237 2239                  { 0x00400000,   MSG_SYS_87 },
2238 2240                  { 0x00800000,   MSG_SYS_LSTAT_ALT },
2239 2241                  { 0x01000000,   MSG_SYS_SYMLINK_ALT },
2240 2242                  { 0x02000000,   MSG_SYS_READLINK_ALT },
2241 2243                  { 0x04000000,   MSG_SYS_SETGROUPS_ALT },
2242 2244                  { 0x08000000,   MSG_SYS_GETGROUPS_ALT },
2243 2245                  { 0x10000000,   MSG_SYS_FCHMOD_ALT },
2244 2246                  { 0x20000000,   MSG_SYS_FCHOWN_ALT },
2245 2247                  { 0x40000000,   MSG_SYS_SIGPROCMASK_ALT },
2246 2248                  { 0x80000000,   MSG_SYS_SIGSUSPEND_ALT },
2247 2249                  { 0,            0 }
2248 2250          };
2249 2251          static const Val_desc vda3[] = {        /* System Calls [97 - 128] */
2250 2252                  { 0x00000001,   MSG_SYS_SIGALTSTACK_ALT },
2251 2253                  { 0x00000002,   MSG_SYS_SIGACTION_ALT },
2252 2254                  { 0x00000004,   MSG_SYS_SIGPENDING_ALT },
2253 2255                  { 0x00000008,   MSG_SYS_CONTEXT_ALT },
2254 2256                  { 0x00000010,   MSG_SYS_101 },
2255 2257                  { 0x00000020,   MSG_SYS_102 },
2256 2258                  { 0x00000040,   MSG_SYS_STATVFS_ALT },
2257 2259                  { 0x00000080,   MSG_SYS_FSTATVFS_ALT },
2258 2260                  { 0x00000100,   MSG_SYS_GETLOADAVG_ALT },
2259 2261                  { 0x00000200,   MSG_SYS_NFSSYS_ALT },
2260 2262                  { 0x00000400,   MSG_SYS_WAITID_ALT },
2261 2263                  { 0x00000800,   MSG_SYS_SIGSENDSYS_ALT },
2262 2264                  { 0x00001000,   MSG_SYS_HRTSYS_ALT },
2263 2265                  { 0x00002000,   MSG_SYS_UTIMESYS_ALT },
2264 2266                  { 0x00004000,   MSG_SYS_SIGRESEND_ALT },
2265 2267                  { 0x00008000,   MSG_SYS_PRIOCNTLSYS_ALT },
2266 2268                  { 0x00010000,   MSG_SYS_PATHCONF_ALT },
2267 2269                  { 0x00020000,   MSG_SYS_MINCORE_ALT },
2268 2270                  { 0x00040000,   MSG_SYS_MMAP_ALT },
2269 2271                  { 0x00080000,   MSG_SYS_MPROTECT_ALT },
2270 2272                  { 0x00100000,   MSG_SYS_MUNMAP_ALT },
2271 2273                  { 0x00200000,   MSG_SYS_FPATHCONF_ALT },
2272 2274                  { 0x00400000,   MSG_SYS_VFORK_ALT },
2273 2275                  { 0x00800000,   MSG_SYS_FCHDIR_ALT },
2274 2276                  { 0x01000000,   MSG_SYS_READV_ALT },
2275 2277                  { 0x02000000,   MSG_SYS_WRITEV_ALT },
2276 2278                  { 0x04000000,   MSG_SYS_123 },
2277 2279                  { 0x08000000,   MSG_SYS_124 },
2278 2280                  { 0x10000000,   MSG_SYS_125 },
2279 2281                  { 0x20000000,   MSG_SYS_126 },
2280 2282                  { 0x40000000,   MSG_SYS_MMAPOBJ_ALT },
2281 2283                  { 0x80000000,   MSG_SYS_SETRLIMIT_ALT },
2282 2284                  { 0,                    0 }
2283 2285          };
2284 2286          static const Val_desc vda4[] = {        /* System Calls [129 - 160] */
2285 2287                  { 0x00000001,   MSG_SYS_GETRLIMIT_ALT },
2286 2288                  { 0x00000002,   MSG_SYS_LCHOWN_ALT },
2287 2289                  { 0x00000004,   MSG_SYS_MEMCNTL_ALT },
2288 2290                  { 0x00000008,   MSG_SYS_GETPMSG_ALT },
2289 2291                  { 0x00000010,   MSG_SYS_PUTPMSG_ALT },
2290 2292                  { 0x00000020,   MSG_SYS_RENAME_ALT },
2291 2293                  { 0x00000040,   MSG_SYS_UNAME_ALT },
2292 2294                  { 0x00000080,   MSG_SYS_SETEGID_ALT },
2293 2295                  { 0x00000100,   MSG_SYS_SYSCONFIG_ALT },
2294 2296                  { 0x00000200,   MSG_SYS_ADJTIME_ALT },
2295 2297                  { 0x00000400,   MSG_SYS_SYSTEMINFO_ALT },
2296 2298                  { 0x00000800,   MSG_SYS_SHAREFS_ALT },
2297 2299                  { 0x00001000,   MSG_SYS_SETEUID_ALT },
2298 2300                  { 0x00002000,   MSG_SYS_FORKSYS_ALT },
2299 2301                  { 0x00004000,   MSG_SYS_143 },
2300 2302                  { 0x00008000,   MSG_SYS_SIGTIMEDWAIT_ALT },
2301 2303                  { 0x00010000,   MSG_SYS_LWP_INFO_ALT },
2302 2304                  { 0x00020000,   MSG_SYS_YIELD_ALT },
2303 2305                  { 0x00040000,   MSG_SYS_147 },
2304 2306                  { 0x00080000,   MSG_SYS_LWP_SEMA_POST_ALT },
2305 2307                  { 0x00100000,   MSG_SYS_LWP_SEMA_TRYWAIT_ALT },
2306 2308                  { 0x00200000,   MSG_SYS_LWP_DETACH_ALT },
2307 2309                  { 0x00400000,   MSG_SYS_CORECTL_ALT },
2308 2310                  { 0x00800000,   MSG_SYS_MODCTL_ALT },
2309 2311                  { 0x01000000,   MSG_SYS_FCHROOT_ALT },
2310 2312                  { 0x02000000,   MSG_SYS_154 },
2311 2313                  { 0x04000000,   MSG_SYS_VHANGUP_ALT },
2312 2314                  { 0x08000000,   MSG_SYS_GETTIMEOFDAY_ALT },
2313 2315                  { 0x10000000,   MSG_SYS_GETITIMER_ALT },
2314 2316                  { 0x20000000,   MSG_SYS_SETITIMER_ALT },
2315 2317                  { 0x40000000,   MSG_SYS_LWP_CREATE_ALT },
2316 2318                  { 0x80000000,   MSG_SYS_LWP_EXIT_ALT },
2317 2319                  { 0,            0 }
2318 2320          };
2319 2321          static const Val_desc vda5[] = {        /* System Calls [161 - 192] */
2320 2322                  { 0x00000001,   MSG_SYS_LWP_SUSPEND_ALT },
2321 2323                  { 0x00000002,   MSG_SYS_LWP_CONTINUE_ALT },
2322 2324                  { 0x00000004,   MSG_SYS_LWP_KILL_ALT },
2323 2325                  { 0x00000008,   MSG_SYS_LWP_SELF_ALT },
2324 2326                  { 0x00000010,   MSG_SYS_LWP_SIGMASK_ALT },
2325 2327                  { 0x00000020,   MSG_SYS_LWP_PRIVATE_ALT },
2326 2328                  { 0x00000040,   MSG_SYS_LWP_WAIT_ALT },
2327 2329                  { 0x00000080,   MSG_SYS_LWP_MUTEX_WAKEUP_ALT },
2328 2330                  { 0x00000100,   MSG_SYS_169 },
2329 2331                  { 0x00000200,   MSG_SYS_LWP_COND_WAIT_ALT },
2330 2332                  { 0x00000400,   MSG_SYS_LWP_COND_SIGNAL_ALT },
2331 2333                  { 0x00000800,   MSG_SYS_LWP_COND_BROADCAST_ALT },
2332 2334                  { 0x00001000,   MSG_SYS_PREAD_ALT },
2333 2335                  { 0x00002000,   MSG_SYS_PWRITE_ALT },
2334 2336                  { 0x00004000,   MSG_SYS_LLSEEK_ALT },
2335 2337                  { 0x00008000,   MSG_SYS_INST_SYNC_ALT },
2336 2338                  { 0x00010000,   MSG_SYS_BRAND_ALT },
2337 2339                  { 0x00020000,   MSG_SYS_KAIO_ALT },
2338 2340                  { 0x00040000,   MSG_SYS_CPC_ALT },
2339 2341                  { 0x00080000,   MSG_SYS_LGRPSYS_ALT },
2340 2342                  { 0x00100000,   MSG_SYS_RUSAGESYS_ALT },
2341 2343                  { 0x00200000,   MSG_SYS_PORT_ALT },
2342 2344                  { 0x00400000,   MSG_SYS_POLLSYS_ALT },
2343 2345                  { 0x00800000,   MSG_SYS_LABELSYS_ALT },
2344 2346                  { 0x01000000,   MSG_SYS_ACL_ALT },
2345 2347                  { 0x02000000,   MSG_SYS_AUDITSYS_ALT },
2346 2348                  { 0x04000000,   MSG_SYS_PROCESSOR_BIND_ALT },
2347 2349                  { 0x08000000,   MSG_SYS_PROCESSOR_INFO_ALT },
2348 2350                  { 0x10000000,   MSG_SYS_P_ONLINE_ALT },
2349 2351                  { 0x20000000,   MSG_SYS_SIGQUEUE_ALT },
2350 2352                  { 0x40000000,   MSG_SYS_CLOCK_GETTIME_ALT },
2351 2353                  { 0x80000000,   MSG_SYS_CLOCK_SETTIME_ALT },
2352 2354                  { 0,            0 }
2353 2355          };
2354 2356          static const Val_desc vda6[] = {        /* System Calls [193 - 224] */
2355 2357                  { 0x00000001,   MSG_SYS_CLOCK_GETRES_ALT },
2356 2358                  { 0x00000002,   MSG_SYS_TIMER_CREATE_ALT },
2357 2359                  { 0x00000004,   MSG_SYS_TIMER_DELETE_ALT },
2358 2360                  { 0x00000008,   MSG_SYS_TIMER_SETTIME_ALT },
2359 2361                  { 0x00000010,   MSG_SYS_TIMER_GETTIME_ALT },
2360 2362                  { 0x00000020,   MSG_SYS_TIMER_GETOVERRUN_ALT },
2361 2363                  { 0x00000040,   MSG_SYS_NANOSLEEP_ALT },
2362 2364                  { 0x00000080,   MSG_SYS_FACL_ALT },
2363 2365                  { 0x00000100,   MSG_SYS_DOOR_ALT },
2364 2366                  { 0x00000200,   MSG_SYS_SETREUID_ALT },
2365 2367                  { 0x00000400,   MSG_SYS_SETREGID_ALT },
2366 2368                  { 0x00000800,   MSG_SYS_INSTALL_UTRAP_ALT },
2367 2369                  { 0x00001000,   MSG_SYS_SIGNOTIFY_ALT },
2368 2370                  { 0x00002000,   MSG_SYS_SCHEDCTL_ALT },
2369 2371                  { 0x00004000,   MSG_SYS_PSET_ALT },
2370 2372                  { 0x00008000,   MSG_SYS_SPARC_UTRAP_INSTALL_ALT },
2371 2373                  { 0x00010000,   MSG_SYS_RESOLVEPATH_ALT },
2372 2374                  { 0x00020000,   MSG_SYS_LWP_MUTEX_TIMEDLOCK_ALT },
2373 2375                  { 0x00040000,   MSG_SYS_LWP_SEMA_TIMEDWAIT_ALT },
2374 2376                  { 0x00080000,   MSG_SYS_LWP_RWLOCK_SYS_ALT },
2375 2377                  { 0x00100000,   MSG_SYS_GETDENTS64_ALT },
2376 2378                  { 0x00200000,   MSG_SYS_MMAP64_ALT },
2377 2379                  { 0x00400000,   MSG_SYS_STAT64_ALT },
2378 2380                  { 0x00800000,   MSG_SYS_LSTAT64_ALT },
2379 2381                  { 0x01000000,   MSG_SYS_FSTAT64_ALT },
2380 2382                  { 0x02000000,   MSG_SYS_STATVFS64_ALT },
2381 2383                  { 0x04000000,   MSG_SYS_FSTATVFS64_ALT },
2382 2384                  { 0x08000000,   MSG_SYS_SETRLIMIT64_ALT },
2383 2385                  { 0x10000000,   MSG_SYS_GETRLIMIT64_ALT },
2384 2386                  { 0x20000000,   MSG_SYS_PREAD64_ALT },
2385 2387                  { 0x40000000,   MSG_SYS_PWRITE64_ALT },
2386 2388                  { 0x80000000,   MSG_SYS_224 },
2387 2389                  { 0,                    0 }
2388 2390          };
2389 2391          static const Val_desc vda7[] = {        /* System Calls [225 - 256] */
2390 2392                  { 0x00000001,   MSG_SYS_OPEN64_ALT },
2391 2393                  { 0x00000002,   MSG_SYS_RPCSYS_ALT },
2392 2394                  { 0x00000004,   MSG_SYS_ZONE_ALT },
2393 2395                  { 0x00000008,   MSG_SYS_AUTOFSSYS_ALT },
2394 2396                  { 0x00000010,   MSG_SYS_GETCWD_ALT },
2395 2397                  { 0x00000020,   MSG_SYS_SO_SOCKET_ALT },
2396 2398                  { 0x00000040,   MSG_SYS_SO_SOCKETPAIR_ALT },
2397 2399                  { 0x00000080,   MSG_SYS_BIND_ALT },
2398 2400                  { 0x00000100,   MSG_SYS_LISTEN_ALT },
2399 2401                  { 0x00000200,   MSG_SYS_ACCEPT_ALT },
2400 2402                  { 0x00000400,   MSG_SYS_CONNECT_ALT },
2401 2403                  { 0x00000800,   MSG_SYS_SHUTDOWN_ALT },
2402 2404                  { 0x00001000,   MSG_SYS_RECV_ALT },
2403 2405                  { 0x00002000,   MSG_SYS_RECVFROM_ALT },
2404 2406                  { 0x00004000,   MSG_SYS_RECVMSG_ALT },
2405 2407                  { 0x00008000,   MSG_SYS_SEND_ALT },
2406 2408                  { 0x00010000,   MSG_SYS_SENDMSG_ALT },
2407 2409                  { 0x00020000,   MSG_SYS_SENDTO_ALT },
2408 2410                  { 0x00040000,   MSG_SYS_GETPEERNAME_ALT },
2409 2411                  { 0x00080000,   MSG_SYS_GETSOCKNAME_ALT },
2410 2412                  { 0x00100000,   MSG_SYS_GETSOCKOPT_ALT },
2411 2413                  { 0x00200000,   MSG_SYS_SETSOCKOPT_ALT },
2412 2414                  { 0x00400000,   MSG_SYS_SOCKCONFIG_ALT },
2413 2415                  { 0x00800000,   MSG_SYS_NTP_GETTIME_ALT },
2414 2416                  { 0x01000000,   MSG_SYS_NTP_ADJTIME_ALT },
2415 2417                  { 0x02000000,   MSG_SYS_LWP_MUTEX_UNLOCK_ALT },
2416 2418                  { 0x04000000,   MSG_SYS_LWP_MUTEX_TRYLOCK_ALT },
2417 2419                  { 0x08000000,   MSG_SYS_LWP_MUTEX_REGISTER_ALT },
2418 2420                  { 0x10000000,   MSG_SYS_CLADM_ALT },
2419 2421                  { 0x20000000,   MSG_SYS_UUCOPY_ALT },
2420 2422                  { 0x40000000,   MSG_SYS_UMOUNT2_ALT },
2421 2423                  /* 256 (unused) */
2422 2424                  { 0,            0 }
2423 2425          };
2424 2426          static const conv_bitmaskset_desc_t bitmask_desc[N_MASK] = {
2425 2427                  { vda0, 0x00000000 },
2426 2428                  { vda1, 0x00000000 },
2427 2429                  { vda2, 0x00000000 },
2428 2430                  { vda3, 0x00000000 },
2429 2431                  { vda4, 0x00000000 },
2430 2432                  { vda5, 0x00000000 },
2431 2433                  { vda6, 0x00000000 },
2432 2434                  { vda7, 0x80000000 },
2433 2435                  { NULL, 0xffffffff },
2434 2436                  { NULL, 0xffffffff },
2435 2437                  { NULL, 0xffffffff },
2436 2438                  { NULL, 0xffffffff },
2437 2439                  { NULL, 0xffffffff },
2438 2440                  { NULL, 0xffffffff },
2439 2441                  { NULL, 0xffffffff },
2440 2442                  { NULL, 0xffffffff }
2441 2443          };
2442 2444  
2443 2445          if (n_mask > N_MASK)
2444 2446                  n_mask = N_MASK;
2445 2447          return (conv_bitmaskset(maskarr, n_mask, bitmask_desc, fmt_flags,
2446 2448              cnote_sysset_buf->buf, CONV_CNOTE_SYSSET_BUFSIZE));
2447 2449  
2448 2450  #undef N_MASK
2449 2451  }
2450 2452  
2451 2453  const char *
2452 2454  conv_cnote_fileflags(uint32_t fileflags, Conv_fmt_flags_t fmt_flags,
2453 2455      char *buf, size_t bufsize)
2454 2456  {
2455 2457          CONV_EXPN_FIELD_ARG arg = { 0 };
2456 2458  
2457 2459          Val_desc vda[] = {
2458 2460                  { 0x0001,       MSG_PR_O_WRONLY },
2459 2461                  { 0x0002,       MSG_PR_O_RDONLY },
2460 2462                  { 0x200000,     MSG_PR_O_SEARCH },
2461 2463                  { 0x400000,     MSG_PR_O_EXEC },
2462 2464                  { 0x0004,       MSG_PR_O_NDELAY },
2463 2465                  { 0x0008,       MSG_PR_O_APPEND },
2464 2466                  { 0x0010,       MSG_PR_O_SYNC },
2465 2467                  { 0x0040,       MSG_PR_O_DSYNC },
2466 2468                  { 0x0080,       MSG_PR_O_NONBLOCK },
2467 2469                  { 0x0100,       MSG_PR_O_CREAT },
2468 2470                  { 0x0200,       MSG_PR_O_TRUNC },
2469 2471                  { 0x0400,       MSG_PR_O_EXCL },
2470 2472                  { 0x0800,       MSG_PR_O_NOCTTY },
2471 2473                  { 0x4000,       MSG_PR_O_XATTR },
2472 2474                  { 0x8000,       MSG_PR_O_RSYNC },
2473 2475                  { 0x2000,       MSG_PR_O_LARGEFILE },
2474 2476                  { 0x20000,      MSG_PR_O_NOFOLLOW },
2475 2477                  { 0x40000,      MSG_PR_O_NOLINKS },
2476 2478                  { 0, NULL },
2477 2479          };
2478 2480  
2479 2481          arg.oflags = arg.rflags = fileflags;
2480 2482          arg.buf = buf;
2481 2483          arg.bufsize = bufsize;
2482 2484  
2483 2485          switch (fileflags & (0x600003)) {
2484 2486          case 0: /* RDONLY */
2485 2487                  vda[0].v_msg = MSG_PR_O_RDONLY;
2486 2488                  arg.oflags |= 1;
2487 2489                  arg.rflags |= 1;
2488 2490                  break;
2489 2491          case 1: /* WRONLY */
2490 2492          case 2: /* RDWR */
2491 2493          case 0x200000:  /* SEARCH */
2492 2494          case 0x400000:
2493 2495                  /* In isolate, treat these as normal bits */
2494 2496                  break;
2495 2497          default:
2496 2498                  /* More than one bit set in this group, emit numerically */
2497 2499                  arg.oflags &= ~(fileflags & 0x600003);
2498 2500          }
2499 2501  
2500 2502          if (fileflags == 0)
2501 2503                  return (MSG_ORIG(MSG_GBL_ZERO));
2502 2504  
2503 2505          (void) conv_expn_field(&arg, vda, fmt_flags);
2504 2506          return (buf);
2505 2507  }
2506 2508  
2507 2509  const char *
2508 2510  conv_cnote_filemode(uint32_t mode, Conv_fmt_flags_t fmt_flags,
2509 2511      char *buf, size_t bufsize)
2510 2512  {
2511 2513          CONV_EXPN_FIELD_ARG arg = { 0 };
2512 2514          Msg s;
2513 2515  
2514 2516          Val_desc vda[] = {
2515 2517                  { 0x1000,       MSG_S_IFIFO },
2516 2518                  { 0x800,        MSG_S_ISUID },
2517 2519                  { 0x400,        MSG_S_ISGID },
2518 2520                  { 0x200,        MSG_S_ISVTX },
2519 2521                  { 0400,         MSG_S_IRUSR },
2520 2522                  { 0200,         MSG_S_IWUSR },
2521 2523                  { 0100,         MSG_S_IXUSR },
2522 2524                  { 0040,         MSG_S_IRGRP },
2523 2525                  { 0020,         MSG_S_IWGRP },
2524 2526                  { 0010,         MSG_S_IXGRP },
2525 2527                  { 0004,         MSG_S_IROTH },
2526 2528                  { 0002,         MSG_S_IWOTH },
2527 2529                  { 0001,         MSG_S_IXOTH },
2528 2530                  { 0, NULL },
2529 2531          };
2530 2532  
2531 2533          arg.oflags = arg.rflags = mode & ~(0xf000);
2532 2534          arg.buf = buf;
2533 2535          arg.bufsize = bufsize;
2534 2536  
2535 2537          switch (mode & (0xf000)) {
2536 2538          case 0x1000:
2537 2539                  s = MSG_S_IFIFO;
2538 2540                  break;
2539 2541          case 0x2000:
2540 2542                  s = MSG_S_IFCHR;
2541 2543                  break;
2542 2544          case 0x4000:
2543 2545                  s = MSG_S_IFDIR;
2544 2546                  break;
2545 2547          case 0x5000:
2546 2548                  s = MSG_S_IFNAM;
2547 2549                  break;
2548 2550          case 0x6000:
2549 2551                  s = MSG_S_IFBLK;
2550 2552                  break;
2551 2553          case 0x8000:
2552 2554                  s = MSG_S_IFREG;
2553 2555                  break;
2554 2556          case 0xA000:
2555 2557                  s = MSG_S_IFLNK;
2556 2558                  break;
2557 2559          case 0xc000:
2558 2560                  s = MSG_S_IFSOCK;
2559 2561                  break;
2560 2562          case 0xd000:
2561 2563                  s = MSG_S_IFDOOR;
2562 2564                  break;
2563 2565          case 0xe000:
2564 2566                  s = MSG_S_IFPORT;
2565 2567                  break;
2566 2568          default:
2567 2569                  s = NULL;
2568 2570                  break;
2569 2571          }
2570 2572  
2571 2573          if (s) {
2572 2574                  arg.oflags |= 0x1000;
2573 2575                  arg.rflags |= 0x1000;
2574 2576                  vda[0].v_msg = s;
2575 2577          } else {
2576 2578                  arg.rflags = mode;
2577 2579          }
2578 2580  
2579 2581          if (mode == 0)
2580 2582                  return (MSG_ORIG(MSG_GBL_ZERO));
2581 2583  
2582 2584          (void) conv_expn_field(&arg, vda, fmt_flags);
2583 2585          return (buf);
2584 2586  }
  
    | 
      ↓ open down ↓ | 
    2455 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX