Print this page
OS-5462 lxbrand kernel should be lint clean
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
OS-3554 lx brand: node.js test test-fs-append-file.js hangs on 64-bit
OS-3209 javac futex problem when dtrace probes enabled - dtrace_systrace_syscall32 only passes 6 args
OS-3217 brandsys syscall takes 7 parameters, not 6

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/sysent.c
          +++ new/usr/src/uts/common/os/sysent.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright 2012 Milan Jurik. All rights reserved.
  25   25   * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
  26      - * Copyright (c) 2015, Joyent, Inc.
       26 + * Copyright 2016 Joyent, Inc.
  27   27   */
  28   28  
  29   29  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  30   30  /*        All Rights Reserved   */
  31   31  
  32   32  #include <sys/param.h>
  33   33  #include <sys/types.h>
  34   34  #include <sys/systm.h>
  35   35  #include <sys/systrace.h>
  36   36  #include <sys/procfs.h>
↓ open down ↓ 17 lines elided ↑ open up ↑
  54   54   * This table is the switch used to transfer to the appropriate
  55   55   * routine for processing a system call.  Each row contains the
  56   56   * number of arguments expected, a switch that tells systrap()
  57   57   * in trap.c whether a setjmp() is not necessary, and a pointer
  58   58   * to the routine.
  59   59   */
  60   60  
  61   61  int     access(char *, int);
  62   62  int     alarm(int);
  63   63  int     auditsys(struct auditcalls *, rval_t *);
  64      -int64_t brandsys(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t,
  65      -    uintptr_t);
       64 +int64_t brandsys(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
  66   65  int     brk(caddr_t);
  67   66  int     chdir(char *);
  68   67  int     chmod(char *, int);
  69   68  int     chown(char *, uid_t, gid_t);
  70   69  int     chroot(char *);
  71   70  int     cladm(int, int, void *);
  72   71  int     close(int);
  73   72  int     exece(const char *, const char **, const char **);
  74   73  int     faccessat(int, char *, int, int);
  75   74  int     fchmodat(int, char *, int, int);
↓ open down ↓ 563 lines elided ↑ open up ↑
 639  638          /* 173 */ SYSENT_CL("pread",            pread,          4),
 640  639          /* 174 */ SYSENT_CL("pwrite ",          pwrite,         4),
 641  640          /*
 642  641           * The 64-bit C library maps llseek() to lseek(), so this
 643  642           * is needed as a native syscall only on the 32-bit kernel.
 644  643           */
 645  644          /* 175 */ IF_LP64(
 646  645                          SYSENT_NOSYS(),
 647  646                          SYSENT_C("llseek",      llseek32,       4)),
 648  647          /* 176 */ SYSENT_LOADABLE(),            /* inst_sync */
 649      -        /* 177 */ SYSENT_CI("brandsys",         brandsys,       6),
      648 +        /* 177 */ SYSENT_CI("brandsys",         brandsys,       5),
 650  649          /* 178 */ SYSENT_LOADABLE(),            /* kaio */
 651  650          /* 179 */ SYSENT_LOADABLE(),            /* cpc */
 652  651          /* 180 */ SYSENT_CI("lgrpsys",          lgrpsys,        3),
 653  652          /* 181 */ SYSENT_CI("rusagesys",        rusagesys,      5),
 654  653          /* 182 */ SYSENT_LOADABLE(),            /* portfs */
 655  654          /* 183 */ SYSENT_CI("pollsys",          pollsys,        4),
 656  655          /* 184 */ SYSENT_CI("labelsys",         labelsys,       5),
 657  656          /* 185 */ SYSENT_CI("acl",              acl,            4),
 658  657          /* 186 */ SYSENT_AP("auditsys",         auditsys,       6),
 659  658          /* 187 */ SYSENT_CI("processor_bind",   processor_bind, 4),
↓ open down ↓ 334 lines elided ↑ open up ↑
 994  993          /* 167 */ SYSENT_CI("lwp_wait",         lwp_wait,       2),
 995  994          /* 168 */ SYSENT_CI("lwp_mutex_wakeup", lwp_mutex_wakeup,       2),
 996  995          /* 169 */ SYSENT_LOADABLE32(),              /* (was lwp_mutex_lock) */
 997  996          /* 170 */ SYSENT_CI("lwp_cond_wait",    lwp_cond_wait,          4),
 998  997          /* 171 */ SYSENT_CI("lwp_cond_signal",  lwp_cond_signal,        1),
 999  998          /* 172 */ SYSENT_CI("lwp_cond_broadcast", lwp_cond_broadcast,   1),
1000  999          /* 173 */ SYSENT_CI("pread",            pread32,                4),
1001 1000          /* 174 */ SYSENT_CI("pwrite",           pwrite32,               4),
1002 1001          /* 175 */ SYSENT_C("llseek",            llseek32,       4),
1003 1002          /* 176 */ SYSENT_LOADABLE32(),          /* inst_sync */
1004      -        /* 177 */ SYSENT_CI("brandsys",         brandsys,       6),
     1003 +        /* 177 */ SYSENT_CI("brandsys",         brandsys,       5),
1005 1004          /* 178 */ SYSENT_LOADABLE32(),          /* kaio */
1006 1005          /* 179 */ SYSENT_LOADABLE32(),          /* cpc */
1007 1006          /* 180 */ SYSENT_CI("lgrpsys",          lgrpsys,        3),
1008 1007          /* 181 */ SYSENT_CI("rusagesys",        rusagesys,      5),
1009 1008          /* 182 */ SYSENT_LOADABLE32(),          /* portfs */
1010 1009          /* 183 */ SYSENT_CI("pollsys",          pollsys,        4),
1011 1010          /* 184 */ SYSENT_CI("labelsys",         labelsys,       5),
1012 1011          /* 185 */ SYSENT_CI("acl",              acl,            4),
1013 1012          /* 186 */ SYSENT_AP("auditsys",         auditsys,       6),
1014 1013          /* 187 */ SYSENT_CI("processor_bind",   processor_bind, 4),
↓ open down ↓ 71 lines elided ↑ open up ↑
1086 1085  };
1087 1086  #endif /* _SYSCALL32_IMPL */
1088 1087  
1089 1088  /*
1090 1089   * Space allocated and initialized in init_syscallnames().
1091 1090   */
1092 1091  char **syscallnames;
1093 1092  
1094 1093  systrace_sysent_t *systrace_sysent;
1095 1094  void (*systrace_probe)(dtrace_id_t, uintptr_t, uintptr_t,
1096      -    uintptr_t, uintptr_t, uintptr_t, uintptr_t);
     1095 +    uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
1097 1096  
1098 1097  /*ARGSUSED*/
1099 1098  void
1100 1099  systrace_stub(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1,
1101      -    uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5)
     1100 +    uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5,
     1101 +    uintptr_t arg6, uintptr_t arg7)
1102 1102  {}
1103 1103  
1104 1104  /*ARGSUSED*/
1105 1105  int64_t
1106 1106  dtrace_systrace_syscall(uintptr_t arg0, uintptr_t arg1, uintptr_t arg2,
1107      -    uintptr_t arg3, uintptr_t arg4, uintptr_t arg5)
     1107 +    uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, uintptr_t arg6,
     1108 +    uintptr_t arg7)
1108 1109  {
1109 1110          systrace_sysent_t *sy = &systrace_sysent[curthread->t_sysnum];
1110 1111          dtrace_id_t id;
1111 1112          int64_t rval;
1112 1113          proc_t *p;
1113 1114  
1114 1115          if ((id = sy->stsy_entry) != DTRACE_IDNONE)
1115      -                (*systrace_probe)(id, arg0, arg1, arg2, arg3, arg4, arg5);
     1116 +                (*systrace_probe)(id, arg0, arg1, arg2, arg3, arg4, arg5,
     1117 +                    arg6, arg7);
1116 1118  
1117 1119          /*
1118 1120           * We want to explicitly allow DTrace consumers to stop a process
1119 1121           * before it actually executes the meat of the syscall.
1120 1122           */
1121 1123          p = ttoproc(curthread);
1122 1124          mutex_enter(&p->p_lock);
1123 1125          if (curthread->t_dtrace_stop && !curthread->t_lwp->lwp_nostop) {
1124 1126                  curthread->t_dtrace_stop = 0;
1125 1127                  stop(PR_REQUESTED, 0);
1126 1128          }
1127 1129          mutex_exit(&p->p_lock);
1128 1130  
1129      -        rval = (*sy->stsy_underlying)(arg0, arg1, arg2, arg3, arg4, arg5);
     1131 +        rval = (*sy->stsy_underlying)(arg0, arg1, arg2, arg3, arg4, arg5,
     1132 +            arg6, arg7);
1130 1133  
1131 1134          if (ttolwp(curthread)->lwp_errno != 0)
1132 1135                  rval = -1;
1133 1136  
1134 1137          if ((id = sy->stsy_return) != DTRACE_IDNONE)
1135 1138                  (*systrace_probe)(id, (uintptr_t)rval, (uintptr_t)rval,
1136      -                    (uintptr_t)((int64_t)rval >> 32), 0, 0, 0);
     1139 +                    (uintptr_t)((int64_t)rval >> 32), 0, 0, 0, 0, 0);
1137 1140  
1138 1141          return (rval);
1139 1142  }
1140 1143  
1141 1144  #ifdef _SYSCALL32_IMPL
1142 1145  
1143 1146  systrace_sysent_t *systrace_sysent32;
1144 1147  
1145 1148  /*ARGSUSED*/
1146 1149  int64_t
1147 1150  dtrace_systrace_syscall32(uintptr_t arg0, uintptr_t arg1, uintptr_t arg2,
1148      -    uintptr_t arg3, uintptr_t arg4, uintptr_t arg5)
     1151 +    uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, uintptr_t arg6,
     1152 +    uintptr_t arg7)
1149 1153  {
1150 1154          systrace_sysent_t *sy = &systrace_sysent32[curthread->t_sysnum];
1151 1155          dtrace_id_t id;
1152 1156          int64_t rval;
1153 1157          proc_t *p;
1154 1158  
1155 1159          if ((id = sy->stsy_entry) != DTRACE_IDNONE)
1156      -                (*systrace_probe)(id, arg0, arg1, arg2, arg3, arg4, arg5);
     1160 +                (*systrace_probe)(id, arg0, arg1, arg2, arg3, arg4, arg5, arg6,
     1161 +                    arg7);
1157 1162  
1158 1163          /*
1159 1164           * We want to explicitly allow DTrace consumers to stop a process
1160 1165           * before it actually executes the meat of the syscall.
1161 1166           */
1162 1167          p = ttoproc(curthread);
1163 1168          mutex_enter(&p->p_lock);
1164 1169          if (curthread->t_dtrace_stop && !curthread->t_lwp->lwp_nostop) {
1165 1170                  curthread->t_dtrace_stop = 0;
1166 1171                  stop(PR_REQUESTED, 0);
1167 1172          }
1168 1173          mutex_exit(&p->p_lock);
1169 1174  
1170      -        rval = (*sy->stsy_underlying)(arg0, arg1, arg2, arg3, arg4, arg5);
     1175 +        rval = (*sy->stsy_underlying)(arg0, arg1, arg2, arg3, arg4, arg5, arg6,
     1176 +            arg7);
1171 1177  
1172 1178          if (ttolwp(curthread)->lwp_errno != 0)
1173 1179                  rval = -1;
1174 1180  
1175 1181          if ((id = sy->stsy_return) != DTRACE_IDNONE)
1176 1182                  (*systrace_probe)(id, (uintptr_t)rval, (uintptr_t)rval,
1177      -                    (uintptr_t)((uint64_t)rval >> 32), 0, 0, 0);
     1183 +                    (uintptr_t)((uint64_t)rval >> 32), 0, 0, 0, 0, 0);
1178 1184  
1179 1185          return (rval);
1180 1186  }
1181 1187  
1182 1188  #endif
1183 1189  
1184 1190  void
1185 1191  dtrace_systrace_rtt(void)
1186 1192  {
1187 1193          systrace_sysent_t *sy;
↓ open down ↓ 7 lines elided ↑ open up ↑
1195 1201  #ifdef _SYSCALL32_IMPL
1196 1202          } else {
1197 1203                  if (systrace_sysent32 == NULL)
1198 1204                          return;
1199 1205  
1200 1206                  sy = &systrace_sysent32[curthread->t_sysnum];
1201 1207  #endif
1202 1208          }
1203 1209  
1204 1210          if ((id = sy->stsy_return) != DTRACE_IDNONE)
1205      -                (*systrace_probe)(id, 0, 0, 0, 0, 0, 0);
     1211 +                (*systrace_probe)(id, 0, 0, 0, 0, 0, 0, 0, 0);
1206 1212  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX