diff options
Diffstat (limited to 'usr/src')
141 files changed, 3206 insertions, 4479 deletions
diff --git a/usr/src/cmd/auditrecord/audit_record_attr.txt b/usr/src/cmd/auditrecord/audit_record_attr.txt index f1e834ab12..53bf1ff177 100644 --- a/usr/src/cmd/auditrecord/audit_record_attr.txt +++ b/usr/src/cmd/auditrecord/audit_record_attr.txt @@ -2,7 +2,7 @@ # Two "#" are comments that are copied to audit_record_attr # other comments are removed. ## -## Copyright 2009 Sun Microsystems, Inc. All rights reserved. +## Copyright 2010 Sun Microsystems, Inc. All rights reserved. ## Use is subject to license terms. ## ## CDDL HEADER START @@ -604,6 +604,7 @@ label=AUE_CORE # see uts/common/c2/audit.c label=AUE_CREAT +# obsolete - see open(2) format=path:[attr] # does not match old BSM manual # header,151,2,creat(2),,Mon May 15 09:21:59 2000, + 509998810 msec @@ -681,6 +682,7 @@ label=AUE_ENTERPROM # return,success,0 label=AUE_EXEC +# obsolete - see execve(2) format=path:[attr]1:[exec_args]2:[exec_env]3 comment=omitted on error: comment=output if argv policy is set: @@ -719,8 +721,9 @@ label=AUE_EXPORTFS skip=Not used. label=AUE_FACCESSAT +# obsolete see=access(2) - format=path:[path_attr]:[attr] + format=path:[attr] label=AUE_FACLSET syscall=facl @@ -796,9 +799,10 @@ label=AUE_FCHOWN comment=1, file descriptor, "no path fd" label=AUE_FCHOWNAT +# obsolete see=openat(2) case=With a valid absolute/relative file path - format=path:[path_attr]:[attr] + format=path:[attr] case=With an file path eq. NULL and valid file descriptor format=kernel @@ -833,22 +837,15 @@ label=AUE_FORK1 # see audit.c label=AUE_FSAT +# obsolete skip=Not used. (Placeholder for AUE_*AT records) -#openat AUE_OPENAT_{W,RW,R} appended with CT as needed -#openat64 AUE_OPENAT_{W,RW,R} appended with CT as needed -#fstatat64 AUE_FSTATAT -#fstat AUE_FSTATAT -#chownat AUE_FCHOWNAT -#unlinkat AUE_UNLINKAT -#futimesat AUE_FUTIMESAT -#renameat AUE_RENAMEAT -#faccessat AUE_FACCESSAT label=AUE_FSTAT skip=Not used. label=AUE_FSTATAT - format=path:[path_attr]:[attr] +# obsolete + format=path:[attr] label=AUE_FSTATFS case=With a valid file descriptor @@ -864,10 +861,9 @@ label=AUE_FUSERS syscall=utssys: UTS_FUSERS format=path:attr - label=AUE_FUTIMESAT - syscall=utimes(2) - format=[path]:[path_attr]:[attr] +# obsolete + format=[path]:[attr] label=AUE_GETAUDIT format=kernel @@ -986,8 +982,8 @@ label=AUE_LSTAT format=path:[attr] label=AUE_LXSTAT +# obsolete skip=Not used. -# AUE_LXSTAT now maps to AUE_LSTAT label=AUE_MCTL skip=Not used. @@ -1188,78 +1184,80 @@ label=AUE_OPEN skip=Not used. (placeholder for AUE_OPEN_*). label=AUE_OPEN_R - format=path:[attr] + format=path:[path_attr]:[attr] see=open(2) - read label=AUE_OPENAT_R +# obsolete format=path:[path_attr]:[attr] see=openat(2) label=AUE_OPEN_RC - format=path:[attr] + format=path:[path_attr]:[attr] see=open(2) - read,creat label=AUE_OPENAT_RC +# obsolete see=openat(2) format=path:[path_attr]:[attr] -# aui_fsat(): fm & O_CREAT mangling label=AUE_OPEN_RT - format=path:[attr] + format=path:[path_attr]:[attr] see=open(2) - read,trunc label=AUE_OPENAT_RT +# obsolete see=openat(2) format=path:[path_attr]:[attr] -# aui_fsat(): fm & O_TRUNC mangling label=AUE_OPEN_RTC - format=path:[attr] + format=path:[path_attr]:[attr] see=open(2) - read,trunc,creat label=AUE_OPENAT_RTC +# obsolete see=openat(2) format=path:[path_attr]:[attr] -# aui_fsat(): fm & O_TRUNC mangling, fm & O_CREAT mangling label=AUE_OPEN_RW - format=path:[attr] + format=path:[path_attr]:[attr] see=open(2) - read,write label=AUE_OPENAT_RW +# obsolete see=openat(2) format=path:[path_attr]:[attr] # aui_fsat(): fm & O_RDWR label=AUE_OPEN_RWC - format=path:[attr] + format=path:[path_attr]:[attr] see=open(2) - read,write,creat label=AUE_OPENAT_RWC +# obsolete see=openat(2) format=path:[path_attr]:[attr] -# aui_fsat(): fm & O_RDWR, fm & O_CREAT mangling label=AUE_OPEN_RWT - format=path:[attr] + format=path:[path_attr]:[attr] see=open(2) - read,write,trunc label=AUE_OPENAT_RWT +# obsolete see=openat(2) format=path:[path_attr]:[attr] -# aui_fsat(): fm & O_RDWR, fm & O_TRUNC mangling label=AUE_OPEN_RWTC - format=path:[attr] + format=path:[path_attr]:[attr] see=open(2) - read,write,trunc,creat label=AUE_OPENAT_RWTC +# obsolete see=openat(2) format=path:[path_attr]:[attr] -# aui_fsat(): fm & O_RDWR, fm & O_TRUNC mangling, fm & O_CREAT mangling label=AUE_OPEN_W - format=path:[attr] + format=path:[path_attr]:[attr] see=open(2) - write label=AUE_OPENAT_W @@ -1267,36 +1265,34 @@ label=AUE_OPENAT_W format=path:[path_attr]:[attr] label=AUE_OPEN_WC - format=path:[attr] + format=path:[path_attr]:[attr] see=open(2) - write,creat label=AUE_OPENAT_WC see=openat(2) format=path:[path_attr]:[attr] -# aui_fsat(): fm & O_WRONLY, fm & O_CREAT mangling label=AUE_OPEN_WT - format=path:[attr] + format=path:[path_attr]:[attr] see=open(2) - write,trunc label=AUE_OPENAT_WT see=openat(2) format=path:[path_attr]:[attr] -# aui_fsat(): fm & O_WRONLY, fm & O_TRUNC mangling label=AUE_OPEN_WTC - format=path:[attr] + format=path:[path_attr]:[attr] see=open(2) - write,trunc,creat label=AUE_OPENAT_WTC see=openat(2) format=path:[path_attr]:[attr] -# aui_fsat(): fm & O_WRONLY, fm & O_TRUNC mangling, fm & O_CREAT mangling label=AUE_OSETPGRP skip=Not used. label=AUE_OSTAT +# obsolete skip=Not used. label=AUE_PATHCONF @@ -1441,8 +1437,8 @@ label=AUE_RENAME comment=to name label=AUE_RENAMEAT -# see openat(2) - format=path1:[path_attr]:[attr]1:[path]2:[path_attr] +# obsolete + format=path1:[attr]1:[path]2 comment=from name: comment=to name @@ -1982,16 +1978,19 @@ label=AUE_UNLINK format=path:[attr] label=AUE_UNLINKAT +# obsolete see=openat(2) - format=path:[path_attr]:[attr] + format=path:[attr] label=AUE_UNMOUNT skip=Not used. label=AUE_UTIME +# obsolete format=path:[attr] label=AUE_UTIMES + see=futimens(2) format=path:[attr] label=AUE_VFORK @@ -2015,10 +2014,12 @@ label=AUE_WRITEV skip=Not used. (obsolete) label=AUE_XMKNOD - skip=Not used. xmknod() generates AUE_MKNOD +# obsolete + skip=Not used. label=AUE_XSTAT - skip=Not Used. xstat() generates AUE_STAT. +# obsolete + skip=Not Used. label=AUE_PF_POLICY_ADDRULE title=Add IPsec policy rule diff --git a/usr/src/cmd/mdb/common/mdb/mdb_proc.c b/usr/src/cmd/mdb/common/mdb/mdb_proc.c index 0d39b131fb..7c419d8fcd 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_proc.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_proc.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -407,8 +408,7 @@ pt_post_attach(mdb_tgt_t *t) * far the process has proceeded through linker initialization. */ if ((psp->pr_flags & PR_ISTOP) && psp->pr_why == PR_SYSEXIT && - psp->pr_errno == 0 && (psp->pr_what == SYS_exec || - psp->pr_what == SYS_execve)) { + psp->pr_errno == 0 && psp->pr_what == SYS_execve) { if (mdb.m_target == NULL) { warn("target performed exec of %s\n", IOP_NAME(pt->p_fio)); @@ -443,11 +443,8 @@ pt_post_attach(mdb_tgt_t *t) /* * Install event specifiers to track fork and exec activities: */ - (void) mdb_tgt_add_sysexit(t, SYS_forkall, hflag, pt_fork, NULL); - (void) mdb_tgt_add_sysexit(t, SYS_fork1, hflag, pt_fork, NULL); (void) mdb_tgt_add_sysexit(t, SYS_vfork, hflag, pt_fork, NULL); (void) mdb_tgt_add_sysexit(t, SYS_forksys, hflag, pt_fork, NULL); - (void) mdb_tgt_add_sysexit(t, SYS_exec, hflag, pt_exec, NULL); (void) mdb_tgt_add_sysexit(t, SYS_execve, hflag, pt_exec, NULL); /* @@ -667,10 +664,7 @@ pt_fork(mdb_tgt_t *t, int vid, void *private) csp = &Pstatus(C)->pr_lwp; if (csp->pr_why != PR_SYSEXIT || - (csp->pr_what != SYS_forkall && - csp->pr_what != SYS_fork1 && - csp->pr_what != SYS_vfork && - csp->pr_what != SYS_forksys)) { + (csp->pr_what != SYS_vfork && csp->pr_what != SYS_forksys)) { warn("forked child process %ld did not stop on exit from " "fork as expected\n", psp->pr_rval1); } @@ -720,7 +714,6 @@ pt_fork(mdb_tgt_t *t, int vid, void *private) mdb_tgt_sespec_idle_all(t, EBUSY, FALSE); t->t_pshandle = C; - (void) Psysexit(C, SYS_exec, TRUE); (void) Psysexit(C, SYS_execve, TRUE); (void) Punsetflags(C, PR_FORK | PR_KLC); @@ -733,8 +726,7 @@ pt_fork(mdb_tgt_t *t, int vid, void *private) break; /* failure or process died */ } while (csp->pr_why != PR_SYSEXIT || - csp->pr_errno != 0 || (csp->pr_what != SYS_exec && - csp->pr_what != SYS_execve)); + csp->pr_errno != 0 || csp->pr_what != SYS_execve); } else t->t_pshandle = C; } @@ -3588,7 +3580,7 @@ pt_setrun(mdb_tgt_t *t, mdb_tgt_status_t *tsp, int flags) switch (Pstate(P)) { case PS_STOP: if (psp->pr_why == PR_SYSEXIT && psp->pr_errno == 0 && - (psp->pr_what == SYS_exec || psp->pr_what == SYS_execve)) + psp->pr_what == SYS_execve) pt_release_parents(t); else Pupdate_maps(P); @@ -4027,8 +4019,8 @@ pt_brkpt_disarm(mdb_tgt_t *t, mdb_sespec_t *sep) const lwpstatus_t *psp = &Pstatus(t->t_pshandle)->pr_lwp; pt_brkpt_t *ptb = sep->se_data; - if ((psp->pr_why == PR_SYSEXIT && psp->pr_errno == 0) && - (psp->pr_what == SYS_exec || psp->pr_what == SYS_execve)) + if (psp->pr_why == PR_SYSEXIT && psp->pr_errno == 0 && + psp->pr_what == SYS_execve) return (0); /* do not restore saved instruction */ return (Pdelbkpt(t->t_pshandle, ptb->ptb_addr, ptb->ptb_instr)); diff --git a/usr/src/cmd/sgs/include/conv.h b/usr/src/cmd/sgs/include/conv.h index e7fa3d36bc..f7bcf7fb79 100644 --- a/usr/src/cmd/sgs/include/conv.h +++ b/usr/src/cmd/sgs/include/conv.h @@ -313,7 +313,7 @@ typedef union { } Conv_cnote_fltset_buf_t; /* conv_cnote_sysset() */ -#define CONV_CNOTE_SYSSET_BUFSIZE 3222 +#define CONV_CNOTE_SYSSET_BUFSIZE 3195 typedef union { Conv_inv_buf_t inv_buf; char buf[CONV_CNOTE_SYSSET_BUFSIZE]; diff --git a/usr/src/cmd/sgs/libconv/common/corenote.c b/usr/src/cmd/sgs/libconv/common/corenote.c index fe896e665b..f30809c9cc 100644 --- a/usr/src/cmd/sgs/libconv/common/corenote.c +++ b/usr/src/cmd/sgs/libconv/common/corenote.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -183,70 +183,70 @@ conv_cnote_syscall(Word sysnum, Conv_fmt_flags_t fmt_flags, Conv_inv_buf_t *inv_buf) { static const Msg sysnumarr[] = { - MSG_SYS_EXIT, MSG_SYS_FORKALL, + MSG_SYS_EXIT, MSG_SYS_2, MSG_SYS_READ, MSG_SYS_WRITE, MSG_SYS_OPEN, MSG_SYS_CLOSE, - MSG_SYS_WAIT, MSG_SYS_CREAT, + MSG_SYS_7, MSG_SYS_8, MSG_SYS_LINK, MSG_SYS_UNLINK, - MSG_SYS_EXEC, MSG_SYS_CHDIR, + MSG_SYS_11, MSG_SYS_CHDIR, MSG_SYS_TIME, MSG_SYS_MKNOD, MSG_SYS_CHMOD, MSG_SYS_CHOWN, MSG_SYS_BRK, MSG_SYS_STAT, MSG_SYS_LSEEK, MSG_SYS_GETPID, - MSG_SYS_MOUNT, MSG_SYS_UMOUNT, + MSG_SYS_MOUNT, MSG_SYS_22, MSG_SYS_SETUID, MSG_SYS_GETUID, MSG_SYS_STIME, MSG_SYS_PCSAMPLE, MSG_SYS_ALARM, MSG_SYS_FSTAT, - MSG_SYS_PAUSE, MSG_SYS_UTIME, + MSG_SYS_PAUSE, MSG_SYS_30, MSG_SYS_STTY, MSG_SYS_GTTY, MSG_SYS_ACCESS, MSG_SYS_NICE, MSG_SYS_STATFS, MSG_SYS_SYNC, MSG_SYS_KILL, MSG_SYS_FSTATFS, MSG_SYS_PGRPSYS, MSG_SYS_UUCOPYSTR, - MSG_SYS_DUP, MSG_SYS_PIPE, + MSG_SYS_41, MSG_SYS_PIPE, MSG_SYS_TIMES, MSG_SYS_PROFIL, - MSG_SYS_PLOCK, MSG_SYS_SETGID, - MSG_SYS_GETGID, MSG_SYS_SIGNAL, + MSG_SYS_FACCESSAT, MSG_SYS_SETGID, + MSG_SYS_GETGID, MSG_SYS_48, MSG_SYS_MSGSYS, MSG_SYS_SYSI86, MSG_SYS_ACCT, MSG_SYS_SHMSYS, MSG_SYS_SEMSYS, MSG_SYS_IOCTL, - MSG_SYS_UADMIN, MSG_SYS_56, + MSG_SYS_UADMIN, MSG_SYS_FCHOWNAT, MSG_SYS_UTSSYS, MSG_SYS_FDSYNC, MSG_SYS_EXECVE, MSG_SYS_UMASK, MSG_SYS_CHROOT, MSG_SYS_FCNTL, - MSG_SYS_ULIMIT, MSG_SYS_64, - MSG_SYS_65, MSG_SYS_66, - MSG_SYS_67, MSG_SYS_68, - MSG_SYS_69, MSG_SYS_TASKSYS, + MSG_SYS_ULIMIT, MSG_SYS_RENAMEAT, + MSG_SYS_UNLINKAT, MSG_SYS_FSTATAT, + MSG_SYS_FSTATAT64, MSG_SYS_OPENAT, + MSG_SYS_OPENAT64, MSG_SYS_TASKSYS, MSG_SYS_ACCTCTL, MSG_SYS_EXACCTSYS, MSG_SYS_GETPAGESIZES, MSG_SYS_RCTLSYS, - MSG_SYS_SIDSYS, MSG_SYS_FSAT, + MSG_SYS_SIDSYS, MSG_SYS_76, MSG_SYS_LWP_PARK, MSG_SYS_SENDFILEV, MSG_SYS_RMDIR, MSG_SYS_MKDIR, MSG_SYS_GETDENTS, MSG_SYS_PRIVSYS, MSG_SYS_UCREDSYS, MSG_SYS_SYSFS, MSG_SYS_GETMSG, MSG_SYS_PUTMSG, - MSG_SYS_POLL, MSG_SYS_LSTAT, + MSG_SYS_87, MSG_SYS_LSTAT, MSG_SYS_SYMLINK, MSG_SYS_READLINK, MSG_SYS_SETGROUPS, MSG_SYS_GETGROUPS, MSG_SYS_FCHMOD, MSG_SYS_FCHOWN, MSG_SYS_SIGPROCMASK, MSG_SYS_SIGSUSPEND, MSG_SYS_SIGALTSTACK, MSG_SYS_SIGACTION, MSG_SYS_SIGPENDING, MSG_SYS_CONTEXT, - MSG_SYS_EVSYS, MSG_SYS_EVTRAPRET, + MSG_SYS_101, MSG_SYS_102, MSG_SYS_STATVFS, MSG_SYS_FSTATVFS, MSG_SYS_GETLOADAVG, MSG_SYS_NFSSYS, MSG_SYS_WAITID, MSG_SYS_SIGSENDSYS, - MSG_SYS_HRTSYS, MSG_SYS_110, + MSG_SYS_HRTSYS, MSG_SYS_UTIMESYS, MSG_SYS_SIGRESEND, MSG_SYS_PRIOCNTLSYS, MSG_SYS_PATHCONF, MSG_SYS_MINCORE, MSG_SYS_MMAP, MSG_SYS_MPROTECT, MSG_SYS_MUNMAP, MSG_SYS_FPATHCONF, MSG_SYS_VFORK, MSG_SYS_FCHDIR, MSG_SYS_READV, MSG_SYS_WRITEV, - MSG_SYS_XSTAT, MSG_SYS_LXSTAT, - MSG_SYS_FXSTAT, MSG_SYS_XMKNOD, - MSG_SYS_127, MSG_SYS_SETRLIMIT, + MSG_SYS_123, MSG_SYS_124, + MSG_SYS_125, MSG_SYS_126, + MSG_SYS_MMAPOBJ, MSG_SYS_SETRLIMIT, MSG_SYS_GETRLIMIT, MSG_SYS_LCHOWN, MSG_SYS_MEMCNTL, MSG_SYS_GETPMSG, MSG_SYS_PUTPMSG, MSG_SYS_RENAME, @@ -254,12 +254,12 @@ conv_cnote_syscall(Word sysnum, Conv_fmt_flags_t fmt_flags, MSG_SYS_SYSCONFIG, MSG_SYS_ADJTIME, MSG_SYS_SYSTEMINFO, MSG_SYS_SHAREFS, MSG_SYS_SETEUID, MSG_SYS_FORKSYS, - MSG_SYS_FORK1, MSG_SYS_SIGTIMEDWAIT, + MSG_SYS_143, MSG_SYS_SIGTIMEDWAIT, MSG_SYS_LWP_INFO, MSG_SYS_YIELD, - MSG_SYS_LWP_SEMA_WAIT, MSG_SYS_LWP_SEMA_POST, + MSG_SYS_147, MSG_SYS_LWP_SEMA_POST, MSG_SYS_LWP_SEMA_TRYWAIT, MSG_SYS_LWP_DETACH, MSG_SYS_CORECTL, MSG_SYS_MODCTL, - MSG_SYS_FCHROOT, MSG_SYS_UTIMES, + MSG_SYS_FCHROOT, MSG_SYS_154, MSG_SYS_VHANGUP, MSG_SYS_GETTIMEOFDAY, MSG_SYS_GETITIMER, MSG_SYS_SETITIMER, MSG_SYS_LWP_CREATE, MSG_SYS_LWP_EXIT, @@ -267,7 +267,7 @@ conv_cnote_syscall(Word sysnum, Conv_fmt_flags_t fmt_flags, MSG_SYS_LWP_KILL, MSG_SYS_LWP_SELF, MSG_SYS_LWP_SIGMASK, MSG_SYS_LWP_PRIVATE, MSG_SYS_LWP_WAIT, MSG_SYS_LWP_MUTEX_WAKEUP, - MSG_SYS_LWP_MUTEX_LOCK, MSG_SYS_LWP_COND_WAIT, + MSG_SYS_169, MSG_SYS_LWP_COND_WAIT, MSG_SYS_LWP_COND_SIGNAL, MSG_SYS_LWP_COND_BROADCAST, MSG_SYS_PREAD, MSG_SYS_PWRITE, MSG_SYS_LLSEEK, MSG_SYS_INST_SYNC, @@ -294,7 +294,7 @@ conv_cnote_syscall(Word sysnum, Conv_fmt_flags_t fmt_flags, MSG_SYS_FSTAT64, MSG_SYS_STATVFS64, MSG_SYS_FSTATVFS64, MSG_SYS_SETRLIMIT64, MSG_SYS_GETRLIMIT64, MSG_SYS_PREAD64, - MSG_SYS_PWRITE64, MSG_SYS_CREAT64, + MSG_SYS_PWRITE64, MSG_SYS_224, MSG_SYS_OPEN64, MSG_SYS_RPCSYS, MSG_SYS_ZONE, MSG_SYS_AUTOFSSYS, MSG_SYS_GETCWD, MSG_SYS_SO_SOCKET, @@ -328,15 +328,27 @@ conv_cnote_syscall(Word sysnum, Conv_fmt_flags_t fmt_flags, */ switch (sysnum) { case 0: - case 56: - case SYS_reserved_64: - case SYS_reserved_65: - case SYS_reserved_66: - case SYS_reserved_67: - case SYS_reserved_68: - case SYS_reserved_69: - case 110: - case 127: + case 2: + case 7: + case 8: + case 11: + case 22: + case 30: + case 41: + case 48: + case 76: + case 87: + case 101: + case 102: + case 123: + case 124: + case 125: + case 126: + case 143: + case 147: + case 154: + case 169: + case 224: use_num = 1; break; default: @@ -1806,16 +1818,16 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask, \ /* sysset_t[0] - System Calls [1 - 32] */ \ MSG_SYS_EXIT_ALT_SIZE /* 1 */ + \ - MSG_SYS_FORKALL_ALT_SIZE /* 2 */ + \ + MSG_SYS_2_SIZE /* 2 (unused) */ + \ MSG_SYS_READ_ALT_SIZE /* 3 */ + \ MSG_SYS_WRITE_ALT_SIZE /* 4 */ + \ MSG_SYS_OPEN_ALT_SIZE /* 5 */ + \ MSG_SYS_CLOSE_ALT_SIZE /* 6 */ + \ - MSG_SYS_WAIT_ALT_SIZE /* 7 */ + \ - MSG_SYS_CREAT_ALT_SIZE /* 8 */ + \ + MSG_SYS_7_SIZE /* 7 (unused) */ + \ + MSG_SYS_8_SIZE /* 8 (unused) */ + \ MSG_SYS_LINK_ALT_SIZE /* 9 */ + \ MSG_SYS_UNLINK_ALT_SIZE /* 10 */ + \ - MSG_SYS_EXEC_ALT_SIZE /* 11 */ + \ + MSG_SYS_11_SIZE /* 11 (unused) */ + \ MSG_SYS_CHDIR_ALT_SIZE /* 12 */ + \ MSG_SYS_TIME_ALT_SIZE /* 13 */ + \ MSG_SYS_MKNOD_ALT_SIZE /* 14 */ + \ @@ -1826,7 +1838,7 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask, MSG_SYS_LSEEK_ALT_SIZE /* 19 */ + \ MSG_SYS_GETPID_ALT_SIZE /* 20 */ + \ MSG_SYS_MOUNT_ALT_SIZE /* 21 */ + \ - MSG_SYS_UMOUNT_ALT_SIZE /* 22 */ + \ + MSG_SYS_22_SIZE /* 22 (unused) */ + \ MSG_SYS_SETUID_ALT_SIZE /* 23 */ + \ MSG_SYS_GETUID_ALT_SIZE /* 24 */ + \ MSG_SYS_STIME_ALT_SIZE /* 25 */ + \ @@ -1834,7 +1846,7 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask, MSG_SYS_ALARM_ALT_SIZE /* 27 */ + \ MSG_SYS_FSTAT_ALT_SIZE /* 28 */ + \ MSG_SYS_PAUSE_ALT_SIZE /* 29 */ + \ - MSG_SYS_UTIME_ALT_SIZE /* 30 */ + \ + MSG_SYS_30_SIZE /* 30 (unused) */ + \ MSG_SYS_STTY_ALT_SIZE /* 31 */ + \ MSG_SYS_GTTY_ALT_SIZE /* 32 */ + \ \ @@ -1847,14 +1859,14 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask, MSG_SYS_FSTATFS_ALT_SIZE /* 38 */ + \ MSG_SYS_PGRPSYS_ALT_SIZE /* 39 */ + \ MSG_SYS_UUCOPYSTR_ALT_SIZE /* 40 */ + \ - MSG_SYS_DUP_ALT_SIZE /* 41 */ + \ + MSG_SYS_41_SIZE /* 41 (unused) */ + \ MSG_SYS_PIPE_ALT_SIZE /* 42 */ + \ MSG_SYS_TIMES_ALT_SIZE /* 43 */ + \ MSG_SYS_PROFIL_ALT_SIZE /* 44 */ + \ - MSG_SYS_PLOCK_ALT_SIZE /* 45 */ + \ + MSG_SYS_FACCESSAT_ALT_SIZE /* 45 */ + \ MSG_SYS_SETGID_ALT_SIZE /* 46 */ + \ MSG_SYS_GETGID_ALT_SIZE /* 47 */ + \ - MSG_SYS_SIGNAL_ALT_SIZE /* 48 */ + \ + MSG_SYS_48_SIZE /* 48 (unused) */ + \ MSG_SYS_MSGSYS_ALT_SIZE /* 49 */ + \ MSG_SYS_SYSI86_ALT_SIZE /* 50 */ + \ MSG_SYS_ACCT_ALT_SIZE /* 51 */ + \ @@ -1862,7 +1874,7 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask, MSG_SYS_SEMSYS_ALT_SIZE /* 53 */ + \ MSG_SYS_IOCTL_ALT_SIZE /* 54 */ + \ MSG_SYS_UADMIN_ALT_SIZE /* 55 */ + \ - MSG_SYS_56_SIZE /* 56 (unused) */ + \ + MSG_SYS_FCHOWNAT_ALT_SIZE /* 56 */ + \ MSG_SYS_UTSSYS_ALT_SIZE /* 57 */ + \ MSG_SYS_FDSYNC_ALT_SIZE /* 58 */ + \ MSG_SYS_EXECVE_ALT_SIZE /* 59 */ + \ @@ -1870,21 +1882,21 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask, MSG_SYS_CHROOT_ALT_SIZE /* 61 */ + \ MSG_SYS_FCNTL_ALT_SIZE /* 62 */ + \ MSG_SYS_ULIMIT_ALT_SIZE /* 63 */ + \ - MSG_SYS_64_SIZE /* 64 (reserved) */ + \ + MSG_SYS_RENAMEAT_ALT_SIZE /* 64 */ + \ \ /* sysset_t[2] - System Calls [65 - 96] */ \ - MSG_SYS_65_SIZE /* 65 (reserved) */ + \ - MSG_SYS_66_SIZE /* 66 (reserved) */ + \ - MSG_SYS_67_SIZE /* 67 (reserved) */ + \ - MSG_SYS_68_SIZE /* 68 (reserved) */ + \ - MSG_SYS_69_SIZE /* 69 (reserved) */ + \ + MSG_SYS_UNLINKAT_ALT_SIZE /* 65 */ + \ + MSG_SYS_FSTATAT_ALT_SIZE /* 66 */ + \ + MSG_SYS_FSTATAT64_ALT_SIZE /* 67 */ + \ + MSG_SYS_OPENAT_ALT_SIZE /* 68 */ + \ + MSG_SYS_OPENAT64_ALT_SIZE /* 69 */ + \ MSG_SYS_TASKSYS_ALT_SIZE /* 70 */ + \ MSG_SYS_ACCTCTL_ALT_SIZE /* 71 */ + \ MSG_SYS_EXACCTSYS_ALT_SIZE /* 72 */ + \ MSG_SYS_GETPAGESIZES_ALT_SIZE /* 73 */ + \ MSG_SYS_RCTLSYS_ALT_SIZE /* 74 */ + \ MSG_SYS_SIDSYS_ALT_SIZE /* 75 */ + \ - MSG_SYS_FSAT_ALT_SIZE /* 76 */ + \ + MSG_SYS_76_SIZE /* 76 (unused) */ + \ MSG_SYS_LWP_PARK_ALT_SIZE /* 77 */ + \ MSG_SYS_SENDFILEV_ALT_SIZE /* 78 */ + \ MSG_SYS_RMDIR_ALT_SIZE /* 79 */ + \ @@ -1895,7 +1907,7 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask, MSG_SYS_SYSFS_ALT_SIZE /* 84 */ + \ MSG_SYS_GETMSG_ALT_SIZE /* 85 */ + \ MSG_SYS_PUTMSG_ALT_SIZE /* 86 */ + \ - MSG_SYS_POLL_ALT_SIZE /* 87 */ + \ + MSG_SYS_87_SIZE /* 87 (unused) */ + \ MSG_SYS_LSTAT_ALT_SIZE /* 88 */ + \ MSG_SYS_SYMLINK_ALT_SIZE /* 89 */ + \ MSG_SYS_READLINK_ALT_SIZE /* 90 */ + \ @@ -1911,8 +1923,8 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask, MSG_SYS_SIGACTION_ALT_SIZE /* 98 */ + \ MSG_SYS_SIGPENDING_ALT_SIZE /* 99 */ + \ MSG_SYS_CONTEXT_ALT_SIZE /* 100 */ + \ - MSG_SYS_EVSYS_ALT_SIZE /* 101 */ + \ - MSG_SYS_EVTRAPRET_ALT_SIZE /* 102 */ + \ + MSG_SYS_101_SIZE /* 101 (unused) */ + \ + MSG_SYS_102_SIZE /* 102 (unused) */ + \ MSG_SYS_STATVFS_ALT_SIZE /* 103 */ + \ MSG_SYS_FSTATVFS_ALT_SIZE /* 104 */ + \ MSG_SYS_GETLOADAVG_ALT_SIZE /* 105 */ + \ @@ -1920,7 +1932,7 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask, MSG_SYS_WAITID_ALT_SIZE /* 107 */ + \ MSG_SYS_SIGSENDSYS_ALT_SIZE /* 108 */ + \ MSG_SYS_HRTSYS_ALT_SIZE /* 109 */ + \ - MSG_SYS_110_SIZE /* 110 (unused) */ + \ + MSG_SYS_UTIMESYS_ALT_SIZE /* 110 */ + \ MSG_SYS_SIGRESEND_ALT_SIZE /* 111 */ + \ MSG_SYS_PRIOCNTLSYS_ALT_SIZE /* 112 */ + \ MSG_SYS_PATHCONF_ALT_SIZE /* 113 */ + \ @@ -1933,11 +1945,11 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask, MSG_SYS_FCHDIR_ALT_SIZE /* 120 */ + \ MSG_SYS_READV_ALT_SIZE /* 121 */ + \ MSG_SYS_WRITEV_ALT_SIZE /* 122 */ + \ - MSG_SYS_XSTAT_ALT_SIZE /* 123 */ + \ - MSG_SYS_LXSTAT_ALT_SIZE /* 124 */ + \ - MSG_SYS_FXSTAT_ALT_SIZE /* 125 */ + \ - MSG_SYS_XMKNOD_ALT_SIZE /* 126 */ + \ - MSG_SYS_127_SIZE /* 127 (unused) */ + \ + MSG_SYS_123_SIZE /* 123 (unused) */ + \ + MSG_SYS_124_SIZE /* 124 (unused) */ + \ + MSG_SYS_125_SIZE /* 125 (unused) */ + \ + MSG_SYS_126_SIZE /* 126 (unused) */ + \ + MSG_SYS_MMAPOBJ_ALT_SIZE /* 127 */ + \ MSG_SYS_SETRLIMIT_ALT_SIZE /* 128 */ + \ \ /* sysset_t[4] - System Calls [129 - 160] */ \ @@ -1955,18 +1967,18 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask, MSG_SYS_SHAREFS_ALT_SIZE /* 140 */ + \ MSG_SYS_SETEUID_ALT_SIZE /* 141 */ + \ MSG_SYS_FORKSYS_ALT_SIZE /* 142 */ + \ - MSG_SYS_FORK1_ALT_SIZE /* 143 */ + \ + MSG_SYS_143_SIZE /* 143 (unused) */ + \ MSG_SYS_SIGTIMEDWAIT_ALT_SIZE /* 144 */ + \ MSG_SYS_LWP_INFO_ALT_SIZE /* 145 */ + \ MSG_SYS_YIELD_ALT_SIZE /* 146 */ + \ - MSG_SYS_LWP_SEMA_WAIT_ALT_SIZE /* 147 */ + \ + MSG_SYS_147_SIZE /* 147 (unused) */ + \ MSG_SYS_LWP_SEMA_POST_ALT_SIZE /* 148 */ + \ MSG_SYS_LWP_SEMA_TRYWAIT_ALT_SIZE /* 149 */ + \ MSG_SYS_LWP_DETACH_ALT_SIZE /* 150 */ + \ MSG_SYS_CORECTL_ALT_SIZE /* 151 */ + \ MSG_SYS_MODCTL_ALT_SIZE /* 152 */ + \ MSG_SYS_FCHROOT_ALT_SIZE /* 153 */ + \ - MSG_SYS_UTIMES_ALT_SIZE /* 154 */ + \ + MSG_SYS_154_SIZE /* 154 (unused) */ + \ MSG_SYS_VHANGUP_ALT_SIZE /* 155 */ + \ MSG_SYS_GETTIMEOFDAY_ALT_SIZE /* 156 */ + \ MSG_SYS_GETITIMER_ALT_SIZE /* 157 */ + \ @@ -1983,7 +1995,7 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask, MSG_SYS_LWP_PRIVATE_ALT_SIZE /* 166 */ + \ MSG_SYS_LWP_WAIT_ALT_SIZE /* 167 */ + \ MSG_SYS_LWP_MUTEX_WAKEUP_ALT_SIZE /* 168 */ + \ - MSG_SYS_LWP_MUTEX_LOCK_ALT_SIZE /* 169 */ + \ + MSG_SYS_169_SIZE /* 169 (unused) */ + \ MSG_SYS_LWP_COND_WAIT_ALT_SIZE /* 170 */ + \ MSG_SYS_LWP_COND_SIGNAL_ALT_SIZE /* 171 */ + \ MSG_SYS_LWP_COND_BROADCAST_ALT_SIZE /* 172 */ + \ @@ -2040,7 +2052,7 @@ conv_cnote_fltset(uint32_t *maskarr, int n_mask, MSG_SYS_GETRLIMIT64_ALT_SIZE /* 221 */ + \ MSG_SYS_PREAD64_ALT_SIZE /* 222 */ + \ MSG_SYS_PWRITE64_ALT_SIZE /* 223 */ + \ - MSG_SYS_CREAT64_ALT_SIZE /* 224 */ + \ + MSG_SYS_224_SIZE /* 224 (unused) */ + \ \ /* sysset_t[7] - System Calls [225 - 256] */ \ MSG_SYS_OPEN64_ALT_SIZE /* 225 */ + \ @@ -2126,16 +2138,16 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask, static const Val_desc vda0[] = { /* System Calls [1 - 32] */ { 0x00000001, MSG_SYS_EXIT_ALT }, - { 0x00000002, MSG_SYS_FORKALL_ALT }, + { 0x00000002, MSG_SYS_2 }, { 0x00000004, MSG_SYS_READ_ALT }, { 0x00000008, MSG_SYS_WRITE_ALT }, { 0x00000010, MSG_SYS_OPEN_ALT }, { 0x00000020, MSG_SYS_CLOSE_ALT }, - { 0x00000040, MSG_SYS_WAIT_ALT }, - { 0x00000080, MSG_SYS_CREAT_ALT }, + { 0x00000040, MSG_SYS_7 }, + { 0x00000080, MSG_SYS_8 }, { 0x00000100, MSG_SYS_LINK_ALT }, { 0x00000200, MSG_SYS_UNLINK_ALT }, - { 0x00000400, MSG_SYS_EXEC_ALT }, + { 0x00000400, MSG_SYS_11 }, { 0x00000800, MSG_SYS_CHDIR_ALT }, { 0x00001000, MSG_SYS_TIME_ALT }, { 0x00002000, MSG_SYS_MKNOD_ALT }, @@ -2146,7 +2158,7 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask, { 0x00040000, MSG_SYS_LSEEK_ALT }, { 0x00080000, MSG_SYS_GETPID_ALT }, { 0x00100000, MSG_SYS_MOUNT_ALT }, - { 0x00200000, MSG_SYS_UMOUNT_ALT }, + { 0x00200000, MSG_SYS_22 }, { 0x00400000, MSG_SYS_SETUID_ALT }, { 0x00800000, MSG_SYS_GETUID_ALT }, { 0x01000000, MSG_SYS_STIME_ALT }, @@ -2154,7 +2166,7 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask, { 0x04000000, MSG_SYS_ALARM_ALT }, { 0x08000000, MSG_SYS_FSTAT_ALT }, { 0x10000000, MSG_SYS_PAUSE_ALT }, - { 0x20000000, MSG_SYS_UTIME_ALT }, + { 0x20000000, MSG_SYS_30 }, { 0x40000000, MSG_SYS_STTY_ALT }, { 0x80000000, MSG_SYS_GTTY_ALT }, { 0, 0 } @@ -2168,14 +2180,14 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask, { 0x00000020, MSG_SYS_FSTATFS_ALT }, { 0x00000040, MSG_SYS_PGRPSYS_ALT }, { 0x00000080, MSG_SYS_UUCOPYSTR_ALT }, - { 0x00000100, MSG_SYS_DUP_ALT }, + { 0x00000100, MSG_SYS_41 }, { 0x00000200, MSG_SYS_PIPE_ALT }, { 0x00000400, MSG_SYS_TIMES_ALT }, { 0x00000800, MSG_SYS_PROFIL_ALT }, - { 0x00001000, MSG_SYS_PLOCK_ALT }, + { 0x00001000, MSG_SYS_FACCESSAT_ALT }, { 0x00002000, MSG_SYS_SETGID_ALT }, { 0x00004000, MSG_SYS_GETGID_ALT }, - { 0x00008000, MSG_SYS_SIGNAL_ALT }, + { 0x00008000, MSG_SYS_48 }, { 0x00010000, MSG_SYS_MSGSYS_ALT }, { 0x00020000, MSG_SYS_SYSI86_ALT }, { 0x00040000, MSG_SYS_ACCT_ALT }, @@ -2183,7 +2195,7 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask, { 0x00100000, MSG_SYS_SEMSYS_ALT }, { 0x00200000, MSG_SYS_IOCTL_ALT }, { 0x00400000, MSG_SYS_UADMIN_ALT }, - { 0x00800000, MSG_SYS_56 }, + { 0x00800000, MSG_SYS_FCHOWNAT_ALT }, { 0x01000000, MSG_SYS_UTSSYS_ALT }, { 0x0200000, MSG_SYS_FDSYNC_ALT }, { 0x04000000, MSG_SYS_EXECVE_ALT }, @@ -2191,22 +2203,22 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask, { 0x10000000, MSG_SYS_CHROOT_ALT }, { 0x20000000, MSG_SYS_FCNTL_ALT }, { 0x40000000, MSG_SYS_ULIMIT_ALT }, - { 0x80000000, MSG_SYS_64 }, + { 0x80000000, MSG_SYS_RENAMEAT_ALT }, { 0, 0 } }; static const Val_desc vda2[] = { /* System Calls [65 - 96] */ - { 0x00000001, MSG_SYS_65 }, - { 0x00000002, MSG_SYS_66 }, - { 0x00000004, MSG_SYS_67 }, - { 0x00000008, MSG_SYS_68 }, - { 0x00000010, MSG_SYS_69 }, + { 0x00000001, MSG_SYS_UNLINKAT_ALT }, + { 0x00000002, MSG_SYS_FSTATAT_ALT }, + { 0x00000004, MSG_SYS_FSTATAT64_ALT }, + { 0x00000008, MSG_SYS_OPENAT_ALT }, + { 0x00000010, MSG_SYS_OPENAT64_ALT }, { 0x00000020, MSG_SYS_TASKSYS_ALT }, { 0x00000040, MSG_SYS_ACCTCTL_ALT }, { 0x00000080, MSG_SYS_EXACCTSYS_ALT }, { 0x00000100, MSG_SYS_GETPAGESIZES_ALT }, { 0x00000200, MSG_SYS_RCTLSYS_ALT }, { 0x00000400, MSG_SYS_SIDSYS_ALT }, - { 0x00000800, MSG_SYS_FSAT_ALT }, + { 0x00000800, MSG_SYS_76 }, { 0x00001000, MSG_SYS_LWP_PARK_ALT }, { 0x00002000, MSG_SYS_SENDFILEV_ALT }, { 0x00004000, MSG_SYS_RMDIR_ALT }, @@ -2217,7 +2229,7 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask, { 0x00080000, MSG_SYS_SYSFS_ALT }, { 0x00100000, MSG_SYS_GETMSG_ALT }, { 0x00200000, MSG_SYS_PUTMSG_ALT }, - { 0x00400000, MSG_SYS_POLL_ALT }, + { 0x00400000, MSG_SYS_87 }, { 0x00800000, MSG_SYS_LSTAT_ALT }, { 0x01000000, MSG_SYS_SYMLINK_ALT }, { 0x02000000, MSG_SYS_READLINK_ALT }, @@ -2234,8 +2246,8 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask, { 0x00000002, MSG_SYS_SIGACTION_ALT }, { 0x00000004, MSG_SYS_SIGPENDING_ALT }, { 0x00000008, MSG_SYS_CONTEXT_ALT }, - { 0x00000010, MSG_SYS_EVSYS_ALT }, - { 0x00000020, MSG_SYS_EVTRAPRET_ALT }, + { 0x00000010, MSG_SYS_101 }, + { 0x00000020, MSG_SYS_102 }, { 0x00000040, MSG_SYS_STATVFS_ALT }, { 0x00000080, MSG_SYS_FSTATVFS_ALT }, { 0x00000100, MSG_SYS_GETLOADAVG_ALT }, @@ -2243,7 +2255,7 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask, { 0x00000400, MSG_SYS_WAITID_ALT }, { 0x00000800, MSG_SYS_SIGSENDSYS_ALT }, { 0x00001000, MSG_SYS_HRTSYS_ALT }, - { 0x00002000, MSG_SYS_110 }, + { 0x00002000, MSG_SYS_UTIMESYS_ALT }, { 0x00004000, MSG_SYS_SIGRESEND_ALT }, { 0x00008000, MSG_SYS_PRIOCNTLSYS_ALT }, { 0x00010000, MSG_SYS_PATHCONF_ALT }, @@ -2256,11 +2268,11 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask, { 0x00800000, MSG_SYS_FCHDIR_ALT }, { 0x01000000, MSG_SYS_READV_ALT }, { 0x02000000, MSG_SYS_WRITEV_ALT }, - { 0x04000000, MSG_SYS_XSTAT_ALT }, - { 0x08000000, MSG_SYS_LXSTAT_ALT }, - { 0x10000000, MSG_SYS_FXSTAT_ALT }, - { 0x20000000, MSG_SYS_XMKNOD_ALT }, - { 0x40000000, MSG_SYS_127 }, + { 0x04000000, MSG_SYS_123 }, + { 0x08000000, MSG_SYS_124 }, + { 0x10000000, MSG_SYS_125 }, + { 0x20000000, MSG_SYS_126 }, + { 0x40000000, MSG_SYS_MMAPOBJ_ALT }, { 0x80000000, MSG_SYS_SETRLIMIT_ALT }, { 0, 0 } }; @@ -2279,18 +2291,18 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask, { 0x00000800, MSG_SYS_SHAREFS_ALT }, { 0x00001000, MSG_SYS_SETEUID_ALT }, { 0x00002000, MSG_SYS_FORKSYS_ALT }, - { 0x00004000, MSG_SYS_FORK1_ALT }, + { 0x00004000, MSG_SYS_143 }, { 0x00008000, MSG_SYS_SIGTIMEDWAIT_ALT }, { 0x00010000, MSG_SYS_LWP_INFO_ALT }, { 0x00020000, MSG_SYS_YIELD_ALT }, - { 0x00040000, MSG_SYS_LWP_SEMA_WAIT_ALT }, + { 0x00040000, MSG_SYS_147 }, { 0x00080000, MSG_SYS_LWP_SEMA_POST_ALT }, { 0x00100000, MSG_SYS_LWP_SEMA_TRYWAIT_ALT }, { 0x00200000, MSG_SYS_LWP_DETACH_ALT }, { 0x00400000, MSG_SYS_CORECTL_ALT }, { 0x00800000, MSG_SYS_MODCTL_ALT }, { 0x01000000, MSG_SYS_FCHROOT_ALT }, - { 0x02000000, MSG_SYS_UTIMES_ALT }, + { 0x02000000, MSG_SYS_154 }, { 0x04000000, MSG_SYS_VHANGUP_ALT }, { 0x08000000, MSG_SYS_GETTIMEOFDAY_ALT }, { 0x10000000, MSG_SYS_GETITIMER_ALT }, @@ -2308,7 +2320,7 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask, { 0x00000020, MSG_SYS_LWP_PRIVATE_ALT }, { 0x00000040, MSG_SYS_LWP_WAIT_ALT }, { 0x00000080, MSG_SYS_LWP_MUTEX_WAKEUP_ALT }, - { 0x00000100, MSG_SYS_LWP_MUTEX_LOCK_ALT }, + { 0x00000100, MSG_SYS_169 }, { 0x00000200, MSG_SYS_LWP_COND_WAIT_ALT }, { 0x00000400, MSG_SYS_LWP_COND_SIGNAL_ALT }, { 0x00000800, MSG_SYS_LWP_COND_BROADCAST_ALT }, @@ -2366,7 +2378,7 @@ conv_cnote_sysset(uint32_t *maskarr, int n_mask, { 0x10000000, MSG_SYS_GETRLIMIT64_ALT }, { 0x20000000, MSG_SYS_PREAD64_ALT }, { 0x40000000, MSG_SYS_PWRITE64_ALT }, - { 0x80000000, MSG_SYS_CREAT64_ALT }, + { 0x80000000, MSG_SYS_224 }, { 0, 0 } }; static const Val_desc vda7[] = { /* System Calls [225 - 256] */ diff --git a/usr/src/cmd/sgs/libconv/common/corenote.msg b/usr/src/cmd/sgs/libconv/common/corenote.msg index 9be9eca78c..3774d5119a 100644 --- a/usr/src/cmd/sgs/libconv/common/corenote.msg +++ b/usr/src/cmd/sgs/libconv/common/corenote.msg @@ -20,11 +20,9 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# @ MSG_NT_PRSTATUS "[ NT_PRSTATUS ]" @ MSG_NT_PRFPREG "[ NT_PRFPREG ]" @@ -581,8 +579,7 @@ @ MSG_SYS_EXIT "[ exit ]" # 1 @ MSG_SYS_EXIT_ALT "exit" -@ MSG_SYS_FORKALL "[ forkall ]" # 2 -@ MSG_SYS_FORKALL_ALT "forkall" +@ MSG_SYS_2 "2" # 2 (u) @ MSG_SYS_READ "[ read ]" # 3 @ MSG_SYS_READ_ALT "read" @ MSG_SYS_WRITE "[ write ]" # 4 @@ -591,16 +588,13 @@ @ MSG_SYS_OPEN_ALT "open" @ MSG_SYS_CLOSE "[ close ]" # 6 @ MSG_SYS_CLOSE_ALT "close" -@ MSG_SYS_WAIT "[ wait ]" # 7 -@ MSG_SYS_WAIT_ALT "wait" -@ MSG_SYS_CREAT "[ creat ]" # 8 -@ MSG_SYS_CREAT_ALT "creat" +@ MSG_SYS_7 "7" # 7 (u) +@ MSG_SYS_8 "8" # 8 (u) @ MSG_SYS_LINK "[ link ]" # 9 @ MSG_SYS_LINK_ALT "link" @ MSG_SYS_UNLINK "[ unlink ]" # 10 @ MSG_SYS_UNLINK_ALT "unlink" -@ MSG_SYS_EXEC "[ exec ]" # 11 -@ MSG_SYS_EXEC_ALT "exec" +@ MSG_SYS_11 "11" # 11 (u) @ MSG_SYS_CHDIR "[ chdir ]" # 12 @ MSG_SYS_CHDIR_ALT "chdir" @ MSG_SYS_TIME "[ time ]" # 13 @@ -621,8 +615,7 @@ @ MSG_SYS_GETPID_ALT "getpid" @ MSG_SYS_MOUNT "[ mount ]" # 21 @ MSG_SYS_MOUNT_ALT "mount" -@ MSG_SYS_UMOUNT "[ umount ]" # 22 -@ MSG_SYS_UMOUNT_ALT "umount" +@ MSG_SYS_22 "22" # 22 (u) @ MSG_SYS_SETUID "[ setuid ]" # 23 @ MSG_SYS_SETUID_ALT "setuid" @ MSG_SYS_GETUID "[ getuid ]" # 24 @@ -637,8 +630,7 @@ @ MSG_SYS_FSTAT_ALT "fstat" @ MSG_SYS_PAUSE "[ pause ]" # 29 @ MSG_SYS_PAUSE_ALT "pause" -@ MSG_SYS_UTIME "[ utime ]" # 30 -@ MSG_SYS_UTIME_ALT "utime" +@ MSG_SYS_30 "30" # 30 (u) @ MSG_SYS_STTY "[ stty ]" # 31 @ MSG_SYS_STTY_ALT "stty" @ MSG_SYS_GTTY "[ gtty ]" # 32 @@ -659,22 +651,20 @@ @ MSG_SYS_PGRPSYS_ALT "pgrpsys" @ MSG_SYS_UUCOPYSTR "[ uucopystr ]" # 40 @ MSG_SYS_UUCOPYSTR_ALT "uucopystr" -@ MSG_SYS_DUP "[ dup ]" # 41 -@ MSG_SYS_DUP_ALT "dup" +@ MSG_SYS_41 "41" # 41 (u) @ MSG_SYS_PIPE "[ pipe ]" # 42 @ MSG_SYS_PIPE_ALT "pipe" @ MSG_SYS_TIMES "[ times ]" # 43 @ MSG_SYS_TIMES_ALT "times" @ MSG_SYS_PROFIL "[ profil ]" # 44 @ MSG_SYS_PROFIL_ALT "profil" -@ MSG_SYS_PLOCK "[ plock ]" # 45 -@ MSG_SYS_PLOCK_ALT "plock" +@ MSG_SYS_FACCESSAT "[ faccessat ]" # 45 +@ MSG_SYS_FACCESSAT_ALT "faccessat" @ MSG_SYS_SETGID "[ setgid ]" # 46 @ MSG_SYS_SETGID_ALT "setgid" @ MSG_SYS_GETGID "[ getgid ]" # 47 @ MSG_SYS_GETGID_ALT "getgid" -@ MSG_SYS_SIGNAL "[ signal ]" # 48 -@ MSG_SYS_SIGNAL_ALT "signal" +@ MSG_SYS_48 "48" # 48 (u) @ MSG_SYS_MSGSYS "[ msgsys ]" # 49 @ MSG_SYS_MSGSYS_ALT "msgsys" @ MSG_SYS_SYSI86 "[ sysi86 ]" # 50 @@ -689,7 +679,8 @@ @ MSG_SYS_IOCTL_ALT "ioctl" @ MSG_SYS_UADMIN "[ uadmin ]" # 55 @ MSG_SYS_UADMIN_ALT "uadmin" -@ MSG_SYS_56 "56" # 56 (u) +@ MSG_SYS_FCHOWNAT "[ fchownat ]" # 56 +@ MSG_SYS_FCHOWNAT_ALT "fchownat" @ MSG_SYS_UTSSYS "[ utssys ]" # 57 @ MSG_SYS_UTSSYS_ALT "utssys" @ MSG_SYS_FDSYNC "[ fdsync ]" # 58 @@ -704,12 +695,18 @@ @ MSG_SYS_FCNTL_ALT "fcntl" @ MSG_SYS_ULIMIT "[ ulimit ]" # 63 @ MSG_SYS_ULIMIT_ALT "ulimit" -@ MSG_SYS_64 "64" # 64 (r) -@ MSG_SYS_65 "65" # 65 (r) -@ MSG_SYS_66 "66" # 66 (r) -@ MSG_SYS_67 "67" # 67 (r) -@ MSG_SYS_68 "68" # 68 (r) -@ MSG_SYS_69 "69" # 69 (r) +@ MSG_SYS_RENAMEAT "[ renameat ]" # 64 +@ MSG_SYS_RENAMEAT_ALT "renameat" +@ MSG_SYS_UNLINKAT "[ unlinkat ]" # 65 +@ MSG_SYS_UNLINKAT_ALT "unlinkat" +@ MSG_SYS_FSTATAT "[ fstatat ]" # 66 +@ MSG_SYS_FSTATAT_ALT "fstatat" +@ MSG_SYS_FSTATAT64 "[ fstatat64 ]" # 67 +@ MSG_SYS_FSTATAT64_ALT "fstatat64" +@ MSG_SYS_OPENAT "[ openat ]" # 68 +@ MSG_SYS_OPENAT_ALT "openat" +@ MSG_SYS_OPENAT64 "[ openat64 ]" # 69 +@ MSG_SYS_OPENAT64_ALT "openat64" @ MSG_SYS_TASKSYS "[ tasksys ]" # 70 @ MSG_SYS_TASKSYS_ALT "tasksys " @ MSG_SYS_ACCTCTL "[ acctctl ]" # 71 @@ -722,8 +719,7 @@ @ MSG_SYS_RCTLSYS_ALT "rctlsys " @ MSG_SYS_SIDSYS "[ sidsys ]" # 75 @ MSG_SYS_SIDSYS_ALT "sidsys" -@ MSG_SYS_FSAT "[ fsat ]" # 76 -@ MSG_SYS_FSAT_ALT "fsat" +@ MSG_SYS_76 "76" # 76 (u) @ MSG_SYS_LWP_PARK "[ lwp_park ]" # 77 @ MSG_SYS_LWP_PARK_ALT "lwp_park" @ MSG_SYS_SENDFILEV "[ sendfilev ]" # 78 @@ -744,8 +740,7 @@ @ MSG_SYS_GETMSG_ALT "getmsg" @ MSG_SYS_PUTMSG "[ putmsg ]" # 86 @ MSG_SYS_PUTMSG_ALT "putmsg" -@ MSG_SYS_POLL "[ poll ]" # 87 -@ MSG_SYS_POLL_ALT "poll" +@ MSG_SYS_87 "87" # 87 (u) @ MSG_SYS_LSTAT "[ lstat ]" # 88 @ MSG_SYS_LSTAT_ALT "lstat" @ MSG_SYS_SYMLINK "[ symlink ]" # 89 @@ -772,10 +767,8 @@ @ MSG_SYS_SIGPENDING_ALT "sigpending" @ MSG_SYS_CONTEXT "[ context ]" # 100 @ MSG_SYS_CONTEXT_ALT "context" -@ MSG_SYS_EVSYS "[ evsys ]" # 101 -@ MSG_SYS_EVSYS_ALT "evsys" -@ MSG_SYS_EVTRAPRET "[ evtrapret ]" # 102 -@ MSG_SYS_EVTRAPRET_ALT "evtrapret" +@ MSG_SYS_101 "101" # 101(u) +@ MSG_SYS_102 "102" # 102(u) @ MSG_SYS_STATVFS "[ statvfs ]" # 103 @ MSG_SYS_STATVFS_ALT "statvfs" @ MSG_SYS_FSTATVFS "[ fstatvfs ]" # 104 @@ -790,7 +783,8 @@ @ MSG_SYS_SIGSENDSYS_ALT "sigsendsys" @ MSG_SYS_HRTSYS "[ hrtsys ]" # 109 @ MSG_SYS_HRTSYS_ALT "hrtsys" -@ MSG_SYS_110 "110" # 110(u) +@ MSG_SYS_UTIMESYS "[ utimesys ]" # 110 +@ MSG_SYS_UTIMESYS_ALT "utimesys" @ MSG_SYS_SIGRESEND "[ sigresend ]" # 111 @ MSG_SYS_SIGRESEND_ALT "sigresend" @ MSG_SYS_PRIOCNTLSYS "[ priocntlsys ]" # 112 @@ -815,15 +809,12 @@ @ MSG_SYS_READV_ALT "readv" @ MSG_SYS_WRITEV "[ writev ]" # 122 @ MSG_SYS_WRITEV_ALT "writev" -@ MSG_SYS_XSTAT "[ xstat ]" # 123 -@ MSG_SYS_XSTAT_ALT "xstat" -@ MSG_SYS_LXSTAT "[ lxstat ]" # 124 -@ MSG_SYS_LXSTAT_ALT "lxstat" -@ MSG_SYS_FXSTAT "[ fxstat ]" # 125 -@ MSG_SYS_FXSTAT_ALT "fxstat" -@ MSG_SYS_XMKNOD "[ xmknod ]" # 126 -@ MSG_SYS_XMKNOD_ALT "xmknod" -@ MSG_SYS_127 "127" # 127(u) +@ MSG_SYS_123 "123" # 123(u) +@ MSG_SYS_124 "124" # 124(u) +@ MSG_SYS_125 "125" # 125(u) +@ MSG_SYS_126 "126" # 126(u) +@ MSG_SYS_MMAPOBJ "[ mmapobj ]" # 127 +@ MSG_SYS_MMAPOBJ_ALT "mmapobj" @ MSG_SYS_SETRLIMIT "[ setrlimit ]" # 128 @ MSG_SYS_SETRLIMIT_ALT "setrlimit" @ MSG_SYS_GETRLIMIT "[ getrlimit ]" # 129 @@ -854,16 +845,14 @@ @ MSG_SYS_SETEUID_ALT "seteuid" @ MSG_SYS_FORKSYS "[ forksys ]" # 142 @ MSG_SYS_FORKSYS_ALT "forksys" -@ MSG_SYS_FORK1 "[ fork1 ]" # 143 -@ MSG_SYS_FORK1_ALT "fork1" +@ MSG_SYS_143 "143" # 143(u) @ MSG_SYS_SIGTIMEDWAIT "[ sigtimedwait ]" # 144 @ MSG_SYS_SIGTIMEDWAIT_ALT "sigtimedwait" @ MSG_SYS_LWP_INFO "[ lwp_info ]" # 145 @ MSG_SYS_LWP_INFO_ALT "lwp_info" @ MSG_SYS_YIELD "[ yield ]" # 146 @ MSG_SYS_YIELD_ALT "yield" -@ MSG_SYS_LWP_SEMA_WAIT "[ lwp_sema_wait ]" # 147 -@ MSG_SYS_LWP_SEMA_WAIT_ALT "lwp_sema_wait" +@ MSG_SYS_147 "147" # 147(u) @ MSG_SYS_LWP_SEMA_POST "[ lwp_sema_post ]" # 148 @ MSG_SYS_LWP_SEMA_POST_ALT "lwp_sema_post" @ MSG_SYS_LWP_SEMA_TRYWAIT "[ lwp_sema_trywait ]" # 149 @@ -876,8 +865,7 @@ @ MSG_SYS_MODCTL_ALT "modctl" @ MSG_SYS_FCHROOT "[ fchroot ]" # 153 @ MSG_SYS_FCHROOT_ALT "fchroot" -@ MSG_SYS_UTIMES "[ utimes ]" # 154 -@ MSG_SYS_UTIMES_ALT "utimes" +@ MSG_SYS_154 "154" # 154(u) @ MSG_SYS_VHANGUP "[ vhangup ]" # 155 @ MSG_SYS_VHANGUP_ALT "vhangup" @ MSG_SYS_GETTIMEOFDAY "[ gettimeofday ]" # 156 @@ -906,8 +894,7 @@ @ MSG_SYS_LWP_WAIT_ALT "lwp_wait" @ MSG_SYS_LWP_MUTEX_WAKEUP "[ lwp_mutex_wakeup ]" # 168 @ MSG_SYS_LWP_MUTEX_WAKEUP_ALT "lwp_mutex_wakeup" -@ MSG_SYS_LWP_MUTEX_LOCK "[ lwp_mutex_lock ]" # 169 -@ MSG_SYS_LWP_MUTEX_LOCK_ALT "lwp_mutex_lock" +@ MSG_SYS_169 "169" # 169(u) @ MSG_SYS_LWP_COND_WAIT "[ lwp_cond_wait ]" # 170 @ MSG_SYS_LWP_COND_WAIT_ALT "lwp_cond_wait" @ MSG_SYS_LWP_COND_SIGNAL "[ lwp_cond_signal ]" # 171 @@ -1016,8 +1003,7 @@ @ MSG_SYS_PREAD64_ALT "pread64" @ MSG_SYS_PWRITE64 "[ pwrite64 ]" # 223 @ MSG_SYS_PWRITE64_ALT "pwrite64" -@ MSG_SYS_CREAT64 "[ creat64 ]" # 224 -@ MSG_SYS_CREAT64_ALT "creat64" +@ MSG_SYS_224 "224" # 224(u) @ MSG_SYS_OPEN64 "[ open64 ]" # 225 @ MSG_SYS_OPEN64_ALT "open64" @ MSG_SYS_RPCSYS "[ rpcsys ]" # 226 diff --git a/usr/src/cmd/sgs/librtld_db/rdb_demo/common/main.c b/usr/src/cmd/sgs/librtld_db/rdb_demo/common/main.c index 6bd77b0434..b63ef6da0e 100644 --- a/usr/src/cmd/sgs/librtld_db/rdb_demo/common/main.c +++ b/usr/src/cmd/sgs/librtld_db/rdb_demo/common/main.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -117,7 +117,6 @@ init_proc() */ oper = PCSEXIT; premptyset(&sysset); - praddset(&sysset, SYS_exec); praddset(&sysset, SYS_execve); if (writev(pfd, piov, 2) == -1) perr("PCSEXIT"); @@ -233,8 +232,7 @@ main(int argc, char *argv[]) * Make sure that it stopped where we expected. */ while ((pstatus.pr_lwp.pr_why == PR_SYSEXIT) && - ((pstatus.pr_lwp.pr_what == SYS_exec) || - (pstatus.pr_lwp.pr_what == SYS_execve))) { + (pstatus.pr_lwp.pr_what == SYS_execve)) { long pflags = 0; if (!(pstatus.pr_lwp.pr_reg[R_PS] & ERRBIT)) { /* successfull exec(2) */ @@ -266,8 +264,7 @@ main(int argc, char *argv[]) * Did we stop where we expected ? */ if ((pstatus.pr_lwp.pr_why != PR_SYSEXIT) || - ((pstatus.pr_lwp.pr_what != SYS_exec) && - (pstatus.pr_lwp.pr_what != SYS_execve))) { + (pstatus.pr_lwp.pr_what != SYS_execve)) { long pflags = 0; (void) fprintf(stderr, "Didn't catch the exec, why: %d " diff --git a/usr/src/cmd/sgs/rtld.4.x/ld.so b/usr/src/cmd/sgs/rtld.4.x/ld.so Binary files differindex 0b7c52675e..256acfb125 100644 --- a/usr/src/cmd/sgs/rtld.4.x/ld.so +++ b/usr/src/cmd/sgs/rtld.4.x/ld.so diff --git a/usr/src/cmd/sgs/rtld.4.x/rtldlib.s b/usr/src/cmd/sgs/rtld.4.x/rtldlib.s index 76b2ca1827..dcaf82ac45 100644 --- a/usr/src/cmd/sgs/rtld.4.x/rtldlib.s +++ b/usr/src/cmd/sgs/rtld.4.x/rtldlib.s @@ -1,14 +1,8 @@ -! #ident "%Z%%M% %I% %E% SMI" -! -! Copyright 2005 Sun Microsystems, Inc. All rights reserved. -! Use is subject to license terms. -! ! CDDL HEADER START ! ! The contents of this file are subject to the terms of the -! Common Development and Distribution License, Version 1.0 only -! (the "License"). You may not use this file except in compliance -! with the License. +! Common Development and Distribution License (the "License"). +! You may not use this file except in compliance with the License. ! ! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE ! or http://www.opensolaris.org/os/licensing. @@ -23,7 +17,9 @@ ! ! CDDL HEADER END ! - +! Copyright 2010 Sun Microsystems, Inc. All rights reserved. +! Use is subject to license terms. +! ! SPARC support routines for 4.x compatibility dynamic linker. #include <sys/asm_linkage.h> ! N.B.: although this is the 4.x @@ -31,6 +27,8 @@ ! runs only on the SVR4 base, and ! is compiled in an SVR4 .h environment +#define AT_FDCWD 0xffd19553 + ! ld.so bootstrap. Called from crt0 of a dynamically linked program with: ! %i0: version number (always 1) ! %i1: address of crt0 structure, which contains: @@ -86,9 +84,14 @@ _aout_reloc_write: .global _open, _mmap, _munmap, _read, _write, _lseek, _close .global _fstat, _sysconfig, __exit -_open: +_open: ! open(path, oflags, mode) => + mov %o2, %o3 ! openat(AT_FDCWD, path, oflag, mode) + mov %o1, %o2 + mov %o0, %o1 + sethi %hi(AT_FDCWD), %o0 + or %o0, %lo(AT_FDCWD), %o0 ba __syscall - mov SYS_open, %g1 + mov SYS_openat, %g1 _mmap: sethi %hi(0x80000000), %g1 ! MAP_NEW @@ -116,9 +119,12 @@ _close: ba __syscall mov SYS_close, %g1 -_fstat: +_fstat: ! fstat(fd, statb) => + mov %g0, %o3 ! fstatat(fd, NULL, statb, 0) + mov %o1, %o2 + mov %g0, %o1 ba __syscall - mov SYS_fstat, %g1 + mov SYS_fstatat, %g1 _sysconfig: ba __syscall diff --git a/usr/src/cmd/sgs/rtld/common/external.c b/usr/src/cmd/sgs/rtld/common/external.c index 713a9d5be5..62c2fce8bd 100644 --- a/usr/src/cmd/sgs/rtld/common/external.c +++ b/usr/src/cmd/sgs/rtld/common/external.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -617,7 +617,7 @@ fcntl(int fildes, int cmd, ...) int open(const char *path, int oflag, ...) { - extern int __open(const char *, int, ...); + extern int __open(const char *, int, mode_t); mode_t mode; va_list ap; @@ -630,7 +630,7 @@ open(const char *path, int oflag, ...) int openat(int fd, const char *path, int oflag, ...) { - extern int __openat(int, const char *, int, ...); + extern int __openat(int, const char *, int, mode_t); mode_t mode; va_list ap; diff --git a/usr/src/cmd/truss/Makefile.com b/usr/src/cmd/truss/Makefile.com index 4e6ca276a7..8158f591ab 100644 --- a/usr/src/cmd/truss/Makefile.com +++ b/usr/src/cmd/truss/Makefile.com @@ -19,18 +19,16 @@ # CDDL HEADER END # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# # cmd/truss/Makefile.com # PROG= truss OBJS= main.o listopts.o ipc.o actions.o expound.o codes.o print.o \ - ramdata.o systable.o procset.o xstat.o fcall.o htbl.o + ramdata.o systable.o procset.o stat.o fcall.o htbl.o SRCS= $(OBJS:%.o=../%.c) diff --git a/usr/src/cmd/truss/actions.c b/usr/src/cmd/truss/actions.c index 13d443ca03..e04db7bdb5 100644 --- a/usr/src/cmd/truss/actions.c +++ b/usr/src/cmd/truss/actions.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -388,9 +388,13 @@ sysentry(private_t *pri, int dotrace) nargs = stp->nargs; pri->sys_nargs = nargs; - /* fetch and remember first argument if it's a string */ + /* + * Fetch and remember first argument if it's a string, + * or second argument if SYS_openat or SYS_openat64. + */ pri->sys_valid = FALSE; - if (nargs > 0 && stp->arg[0] == STG) { + if ((nargs > 0 && stp->arg[0] == STG) || + (nargs > 1 && (what == SYS_openat || what == SYS_openat64))) { long offset; uint32_t offset32; @@ -399,9 +403,7 @@ sysentry(private_t *pri, int dotrace) * The address in pri->sys_args[0] refers to the old process * image. We must fetch the string from the new image. */ - if (Lsp->pr_why == PR_SYSEXIT && - (Lsp->pr_what == SYS_execve || - Lsp->pr_what == SYS_exec)) { + if (Lsp->pr_why == PR_SYSEXIT && what == SYS_execve) { psinfo_t psinfo; long argv; auxv_t auxv[32]; @@ -428,8 +430,10 @@ sysentry(private_t *pri, int dotrace) offset = offset32; } } - } else { + } else if (stp->arg[0] == STG) { offset = pri->sys_args[0]; + } else { + offset = pri->sys_args[1]; } if ((s = fetchstring(pri, offset, PATH_MAX)) != NULL) { pri->sys_valid = TRUE; @@ -475,8 +479,10 @@ sysentry(private_t *pri, int dotrace) arg = pri->sys_args[i]; x = stp->arg[i]; - if (x == STG && !raw && - i == 0 && pri->sys_valid) { /* already fetched */ + if (!raw && pri->sys_valid && + ((i == 0 && x == STG) || + (i == 1 && (what == SYS_openat || + what == SYS_openat64)))) { /* already fetched */ escape_string(pri, pri->sys_path); argprinted = TRUE; } else if (x != HID || raw) { @@ -541,12 +547,10 @@ sysexit(private_t *pri, int dotrace) switch (what) { case SYS_exit: /* these are traced on entry */ case SYS_lwp_exit: - case SYS_evtrapret: case SYS_context: istraced = dotrace && prismember(&trace, what); break; - case SYS_exec: /* these are normally traced on entry */ - case SYS_execve: + case SYS_execve: /* this is normally traced on entry */ istraced = dotrace && prismember(&trace, what); if (pri->exec_string && *pri->exec_string) { if (!cflag && istraced) { /* print exec() string now */ @@ -562,7 +566,8 @@ sysexit(private_t *pri, int dotrace) /* FALLTHROUGH */ default: /* we called sysentry() in main() for these */ - if (what == SYS_open || what == SYS_open64) + if (what == SYS_openat || what == SYS_openat64 || + what == SYS_open || what == SYS_open64) istraced = dotrace && prismember(&trace, what); else istraced = sysentry(pri, dotrace) && dotrace; @@ -587,7 +592,8 @@ sysexit(private_t *pri, int dotrace) if (what == SYS_forksys && subcode >= 3) scp += subcode - 3; else if (subcode != -1 && - (what != SYS_open && what != SYS_open64 && + (what != SYS_openat && what != SYS_openat64 && + what != SYS_open && what != SYS_open64 && what != SYS_lwp_create)) scp += subcode; scp->count++; @@ -601,10 +607,7 @@ sysexit(private_t *pri, int dotrace) raw = prismember(&rawout, what); if (!cflag && istraced) { - if ((what == SYS_forkall || - what == SYS_vfork || - what == SYS_fork1 || - what == SYS_forksys) && + if ((what == SYS_vfork || what == SYS_forksys) && pri->Errno == 0 && pri->Rval2 != 0) { pri->length &= ~07; if (strlen(sysname(pri, what, raw? -1 : subcode)) < 6) { @@ -620,8 +623,7 @@ sysexit(private_t *pri, int dotrace) pri->length += 7 + printf("\t(returning as new lwp ...)"); } - if (pri->Errno != 0 || - (what != SYS_exec && what != SYS_execve)) { + if (pri->Errno != 0 || what != SYS_execve) { /* prepare to print the return code */ pri->length >>= 3; if (pri->length >= 6) @@ -670,7 +672,7 @@ sysexit(private_t *pri, int dotrace) } } else { /* show arguments on successful exec */ - if (what == SYS_exec || what == SYS_execve) { + if (what == SYS_execve) { if (!cflag && istraced) showargs(pri, raw); } else if (!cflag && istraced) { @@ -818,10 +820,7 @@ sysexit(private_t *pri, int dotrace) (void) fputc('\n', stdout); } - if (what == SYS_forkall || - what == SYS_vfork || - what == SYS_fork1 || - what == SYS_forksys) { + if (what == SYS_vfork || what == SYS_forksys) { if (pri->Rval2 == 0) /* child was created */ pri->child = pri->Rval1; else if (cflag && istraced) /* this is the child */ @@ -843,7 +842,7 @@ sysexit(private_t *pri, int dotrace) int fdp1 = (int)pri->sys_args[0] + 1; /* filedescriptor + 1 */ if (raw) { - if (what != SYS_exec && what != SYS_execve) + if (what != SYS_execve) showpaths(pri, stp); if (ISREAD(what) || ISWRITE(what)) { if (pri->iob_buf[0] != '\0') @@ -897,10 +896,14 @@ sysexit(private_t *pri, int dotrace) void showpaths(private_t *pri, const struct systable *stp) { + int what = pri->lwpstat->pr_what; int i; for (i = 0; i < pri->sys_nargs; i++) { - if ((stp->arg[i] == STG) || + if (stp->arg[i] == ATC && (int)pri->sys_args[i] == AT_FDCWD) { + (void) printf("%s 0x%.8X: AT_FDCWD\n", + pri->pname, AT_FDCWD); + } else if ((stp->arg[i] == STG) || (stp->arg[i] == RST && !pri->Errno) || (stp->arg[i] == RLK && !pri->Errno && pri->Rval1 > 0)) { long addr = pri->sys_args[i]; @@ -908,7 +911,10 @@ showpaths(private_t *pri, const struct systable *stp) (stp->arg[i] == RLK)? (int)pri->Rval1 : PATH_MAX; char *s; - if (i == 0 && pri->sys_valid) /* already fetched */ + if (pri->sys_valid && + ((i == 0 && stp->arg[0] == STG) || + (i == 1 && (what == SYS_openat || + what == SYS_openat64)))) /* already fetched */ s = pri->sys_path; else s = fetchstring(pri, addr, @@ -965,7 +971,7 @@ showargs(private_t *pri, int raw) (void) printf(" argc = %d\n", nargs); if (raw) - showpaths(pri, &systable[SYS_exec]); + showpaths(pri, &systable[SYS_execve]); show_cred(pri, FALSE); diff --git a/usr/src/cmd/truss/codes.c b/usr/src/cmd/truss/codes.c index 68d78f826e..09ea03b92f 100644 --- a/usr/src/cmd/truss/codes.c +++ b/usr/src/cmd/truss/codes.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -59,7 +59,6 @@ #include <sys/termio.h> #include <sys/stermio.h> #include <sys/ttold.h> -#include <sys/lock.h> #include <sys/mount.h> #include <sys/utssys.h> #include <sys/sysconfig.h> @@ -164,16 +163,6 @@ const char *const SYSFSname[] = { "GETNFSTYP" }; -#define PLOCKMIN UNLOCK -#define PLOCKMAX DATLOCK -const char *const PLOCKname[] = { - "UNLOCK", - "PROCLOCK", - "TXTLOCK", - NULL, - "DATLOCK" -}; - #define SCONFMIN _CONFIG_NGROUPS #define SCONFMAX _CONFIG_EPHID_MAX const char *const SCONFname[] = { @@ -1727,16 +1716,6 @@ sfsname(int code) return (str); } -const char * -plockname(int code) -{ - const char *str = NULL; - - if (code >= PLOCKMIN && code <= PLOCKMAX) - str = PLOCKname[code-PLOCKMIN]; - return (str); -} - /* ARGSUSED */ const char * si86name(int code) @@ -1909,7 +1888,8 @@ pathconfname(int code) #define ALL_O_FLAGS \ (O_NDELAY|O_APPEND|O_SYNC|O_DSYNC|O_NONBLOCK|O_CREAT|O_TRUNC\ - |O_EXCL|O_NOCTTY|O_LARGEFILE|O_RSYNC|O_XATTR|O_NOFOLLOW|O_NOLINKS) + |O_EXCL|O_NOCTTY|O_LARGEFILE|O_RSYNC|O_XATTR|O_NOFOLLOW|O_NOLINKS\ + |FXATTRDIROPEN) const char * openarg(private_t *pri, int arg) @@ -1958,6 +1938,8 @@ openarg(private_t *pri, int arg) (void) strlcat(str, "|O_NOFOLLOW", sizeof (pri->code_buf)); if (arg & O_NOLINKS) (void) strlcat(str, "|O_NOLINKS", sizeof (pri->code_buf)); + if (arg & FXATTRDIROPEN) + (void) strlcat(str, "|FXATTRDIROPEN", sizeof (pri->code_buf)); return ((const char *)str); } diff --git a/usr/src/cmd/truss/expound.c b/usr/src/cmd/truss/expound.c index b0245d4458..d78cbecad5 100644 --- a/usr/src/cmd/truss/expound.c +++ b/usr/src/cmd/truss/expound.c @@ -52,7 +52,6 @@ #include <sys/shm.h> #include <sys/shm_impl.h> #include <sys/dirent.h> -#include <sys/utime.h> #include <ustat.h> #include <fcntl.h> #include <time.h> @@ -148,69 +147,6 @@ prtimestruc(private_t *pri, const char *name, timestruc_t *value) } static void -show_utime(private_t *pri) -{ - long offset; - struct utimbuf utimbuf; - - if (pri->sys_nargs < 2 || (offset = pri->sys_args[1]) == NULL) - return; - - if (data_model == PR_MODEL_NATIVE) { - if (Pread(Proc, &utimbuf, sizeof (utimbuf), offset) - != sizeof (utimbuf)) - return; - } else { - struct utimbuf32 utimbuf32; - - if (Pread(Proc, &utimbuf32, sizeof (utimbuf32), offset) - != sizeof (utimbuf32)) - return; - - utimbuf.actime = (time_t)utimbuf32.actime; - utimbuf.modtime = (time_t)utimbuf32.modtime; - } - - /* print access and modification times */ - prtime(pri, "at = ", utimbuf.actime); - prtime(pri, "mt = ", utimbuf.modtime); -} - -static void -show_utimes(private_t *pri, long offset) -{ - struct { - struct timeval atime; - struct timeval mtime; - } utimbuf; - - if (offset == 0) - return; - - if (data_model == PR_MODEL_NATIVE) { - if (Pread(Proc, &utimbuf, sizeof (utimbuf), offset) - != sizeof (utimbuf)) - return; - } else { - struct { - struct timeval32 atime; - struct timeval32 mtime; - } utimbuf32; - - if (Pread(Proc, &utimbuf32, sizeof (utimbuf32), offset) - != sizeof (utimbuf32)) - return; - - TIMEVAL32_TO_TIMEVAL(&utimbuf.atime, &utimbuf32.atime); - TIMEVAL32_TO_TIMEVAL(&utimbuf.mtime, &utimbuf32.mtime); - } - - /* print access and modification times */ - prtimeval(pri, "at = ", &utimbuf.atime); - prtimeval(pri, "mt = ", &utimbuf.mtime); -} - -static void show_utimens(private_t *pri, long offset) { struct { @@ -2143,30 +2079,6 @@ show_all_pollfds(private_t *pri, long offset, int nfds) } void -show_poll(private_t *pri) -{ - long offset; - int nfds; - int serial = 0; - - if (pri->sys_nargs < 2 || (offset = pri->sys_args[0]) == NULL || - (nfds = pri->sys_args[1]) <= 0) - return; - - /* enter region of lengthy output */ - if (nfds > 32) { - Eserialize(); - serial = 1; - } - - show_all_pollfds(pri, offset, nfds); - - /* exit region of lengthy output */ - if (serial) - Xserialize(); -} - -void show_pollsys(private_t *pri) { long offset; @@ -4829,12 +4741,6 @@ expound(private_t *pri, long r0, int raw) what = Lsp->pr_syscall; switch (what) { - case SYS_utime: - show_utime(pri); - break; - case SYS_utimes: - show_utimes(pri, (long)pri->sys_args[1]); - break; case SYS_gettimeofday: if (!err) show_timeofday(pri); @@ -4876,6 +4782,14 @@ expound(private_t *pri, long r0, int raw) show_ioctl(pri, pri->sys_args[1], (long)pri->sys_args[2]); break; + case SYS_fstatat: + if (!err && pri->sys_nargs >= 3) + show_stat(pri, (long)pri->sys_args[2]); + break; + case SYS_fstatat64: + if (!err && pri->sys_nargs >= 3) + show_stat64_32(pri, (long)pri->sys_args[2]); + break; case SYS_stat: case SYS_fstat: case SYS_lstat: @@ -4888,26 +4802,6 @@ expound(private_t *pri, long r0, int raw) if (!err && pri->sys_nargs >= 2) show_stat64_32(pri, (long)pri->sys_args[1]); break; - case SYS_fsat: - /* - * subcodes for fstatat(), fstatat64(), futimesat(). - */ - if (!err && pri->sys_nargs >= 4) { - if (pri->sys_args[0] == 3) - show_statat(pri, (long)pri->sys_args[3]); - else if (pri->sys_args[0] == 2) - show_stat64_32(pri, (long)pri->sys_args[3]); - else if (pri->sys_args[0] == 6) - show_utimes(pri, (long)pri->sys_args[3]); - } - break; - case SYS_xstat: - case SYS_fxstat: - case SYS_lxstat: - if (!err && pri->sys_nargs >= 3) - show_xstat(pri, (int)pri->sys_args[0], - (long)pri->sys_args[2]); - break; case SYS_statvfs: case SYS_fstatvfs: if (err) @@ -4985,9 +4879,6 @@ expound(private_t *pri, long r0, int raw) case SYS_putpmsg: show_gp_msg(pri, what); break; - case SYS_poll: - show_poll(pri); - break; case SYS_pollsys: show_pollsys(pri); break; @@ -5120,7 +5011,6 @@ expound(private_t *pri, long r0, int raw) show_int(pri, (long)pri->sys_args[1], "lwpid"); break; case SYS_lwp_mutex_wakeup: - case SYS_lwp_mutex_lock: case SYS_lwp_mutex_unlock: case SYS_lwp_mutex_trylock: case SYS_lwp_mutex_register: @@ -5146,7 +5036,6 @@ expound(private_t *pri, long r0, int raw) if (pri->sys_nargs > 0) show_condvar(pri, (long)pri->sys_args[0]); break; - case SYS_lwp_sema_wait: case SYS_lwp_sema_trywait: case SYS_lwp_sema_post: if (pri->sys_nargs > 0) diff --git a/usr/src/cmd/truss/ipc.c b/usr/src/cmd/truss/ipc.c index af3488d28e..2bb34656a7 100644 --- a/usr/src/cmd/truss/ipc.c +++ b/usr/src/cmd/truss/ipc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,17 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -259,7 +256,7 @@ checkproc(private_t *pri) const pstatus_t *Psp = Pstatus(Proc); struct ps_lwphandle *Lwp = pri->Lwp; const lwpstatus_t *Lsp = pri->lwpstat; - int what = Lsp->pr_what; /* SYS_open or SYS_open64 */ + int what = Lsp->pr_what; /* one of the SYS_open* syscalls */ int err = Lsp->pr_errno; int pid; int i; diff --git a/usr/src/cmd/truss/listopts.c b/usr/src/cmd/truss/listopts.c index e7b0250a5e..0d32d15561 100644 --- a/usr/src/cmd/truss/listopts.c +++ b/usr/src/cmd/truss/listopts.c @@ -20,15 +20,13 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */ - #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -118,28 +116,34 @@ syslist(char *str, /* string of syscall names */ } if (sys > 0 && sys <= PRMAXSYS) { switch (sys) { - case SYS_xstat: /* set all if any */ - case SYS_stat: + case SYS_fstatat: /* set both if either */ + case SYS_fstatat64: + sys = SYS_fstatat; + sys64 = SYS_fstatat64; + goto def; + + case SYS_stat: /* set all if either */ case SYS_stat64: sys = SYS_stat; - sysx = SYS_xstat; sys64 = SYS_stat64; + sysx = SYS_fstatat; + sysxx = SYS_fstatat64; goto def; - case SYS_lxstat: /* set all if any */ - case SYS_lstat: + case SYS_lstat: /* set all if either */ case SYS_lstat64: sys = SYS_lstat; - sysx = SYS_lxstat; sys64 = SYS_lstat64; + sysx = SYS_fstatat; + sysxx = SYS_fstatat64; goto def; - case SYS_fxstat: /* set all if any */ - case SYS_fstat: + case SYS_fstat: /* set all if either */ case SYS_fstat64: sys = SYS_fstat; - sysx = SYS_fxstat; sys64 = SYS_fstat64; + sysx = SYS_fstatat; + sysxx = SYS_fstatat64; goto def; case SYS_getdents: /* set both if either */ @@ -190,44 +194,20 @@ syslist(char *str, /* string of syscall names */ sys64 = SYS_pwrite64; goto def; - case SYS_creat: /* set both if either */ - case SYS_creat64: - sys = SYS_creat; - sys64 = SYS_creat64; - goto def; - - case SYS_open: /* set both if either */ + case SYS_openat: /* set all if any */ + case SYS_openat64: + case SYS_open: case SYS_open64: - sys = SYS_open; - sys64 = SYS_open64; - goto def; - - case SYS_xmknod: /* set both if either */ - case SYS_mknod: - sysx = SYS_xmknod; - sys = SYS_mknod; + sys = SYS_openat; + sys64 = SYS_openat64; + sysx = SYS_open; + sysxx = SYS_open64; goto def; - case SYS_forkall: /* set all if any */ - case SYS_fork1: + case SYS_forksys: /* set both if either */ case SYS_vfork: - case SYS_forksys: - sys = SYS_forkall; - sysx = SYS_fork1; - sys64 = SYS_vfork; - sysxx = SYS_forksys; - goto def; - - case SYS_exec: /* set both if either */ - case SYS_execve: - sysx = SYS_exec; - sys = SYS_execve; - goto def; - - case SYS_poll: /* set both if either */ - case SYS_pollsys: - sysx = SYS_poll; - sys = SYS_pollsys; + sysx = SYS_forksys; + sys = SYS_vfork; goto def; case SYS_sigprocmask: /* set both if either */ @@ -236,28 +216,38 @@ syslist(char *str, /* string of syscall names */ sys = SYS_lwp_sigmask; goto def; - case SYS_wait: /* set both if either */ - case SYS_waitid: - sysx = SYS_wait; - sys = SYS_waitid; - goto def; - case SYS_lseek: /* set both if either */ case SYS_llseek: sysx = SYS_lseek; sys = SYS_llseek; goto def; - case SYS_lwp_mutex_lock: /* set both if either */ - case SYS_lwp_mutex_timedlock: - sysx = SYS_lwp_mutex_lock; - sys = SYS_lwp_mutex_timedlock; + case SYS_rename: /* set both */ + sysx = SYS_renameat; + goto def; + + case SYS_unlink: /* set both */ + sysx = SYS_unlinkat; + goto def; + + case SYS_rmdir: /* set both */ + sysx = SYS_unlinkat; + goto def; + + case SYS_chown: /* set both */ + sysx = SYS_fchownat; + goto def; + + case SYS_lchown: /* set both */ + sysx = SYS_fchownat; + goto def; + + case SYS_fchown: /* set both */ + sysx = SYS_fchownat; goto def; - case SYS_lwp_sema_wait: /* set both if either */ - case SYS_lwp_sema_timedwait: - sysx = SYS_lwp_sema_wait; - sys = SYS_lwp_sema_timedwait; + case SYS_access: /* set both */ + sysx = SYS_faccessat; goto def; default: diff --git a/usr/src/cmd/truss/main.c b/usr/src/cmd/truss/main.c index ef14a1fb49..736b8bc2ef 100644 --- a/usr/src/cmd/truss/main.c +++ b/usr/src/cmd/truss/main.c @@ -20,14 +20,12 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdio_ext.h> #include <stdlib.h> @@ -160,9 +158,9 @@ insert_lwpid(lwpid_t lwpid) if (i == truss_maxlwp) { /* double the size of the array */ truss_lwpid = my_realloc(truss_lwpid, - truss_maxlwp * 2 * sizeof (lwpid_t), NULL); + truss_maxlwp * 2 * sizeof (lwpid_t), NULL); (void) memset(&truss_lwpid[truss_maxlwp], 0, - truss_maxlwp * sizeof (lwpid_t)); + truss_maxlwp * sizeof (lwpid_t)); truss_maxlwp *= 2; } truss_lwpid[i] = lwpid; @@ -215,10 +213,10 @@ grab_lwp(lwpid_t who) if ((Lwp = Lgrab(Proc, who, &gcode)) == NULL) { if (gcode != G_NOPROC) { (void) fprintf(stderr, - "%s: cannot grab LWP %u in process %d," - " reason: %s\n", - command, who, (int)Pstatus(Proc)->pr_pid, - Lgrab_error(gcode)); + "%s: cannot grab LWP %u in process %d," + " reason: %s\n", + command, who, (int)Pstatus(Proc)->pr_pid, + Lgrab_error(gcode)); interrupt = SIGTERM; /* post an interrupt */ } } @@ -429,10 +427,8 @@ main(int argc, char *argv[]) exit(2); /* if -a or -e was specified, force tracing of exec() */ - if (aflag || eflag) { - praddset(&trace, SYS_exec); + if (aflag || eflag) praddset(&trace, SYS_execve); - } /* * Make sure that all system calls, signals, and machine faults @@ -448,7 +444,7 @@ main(int argc, char *argv[]) /* collect the specified process ids */ if (pflag && argc > 0) { grab = my_malloc(argc * sizeof (proc_set_t), - "memory for process-ids"); + "memory for process-ids"); while (argc-- > 0) pids(*argv++, grab); } @@ -456,11 +452,11 @@ main(int argc, char *argv[]) if (errflg || (argc <= 0 && ngrab <= 0)) { (void) fprintf(stderr, "usage:\t%s [-fcaeildDEF] [-[tTvx] [!]syscalls] [-[sS] [!]signals]\\\n", - command); + command); (void) fprintf(stderr, "\t[-[mM] [!]faults] [-[rw] [!]fds] [-[uU] [!]libs:[:][!]funcs]\\\n"); (void) fprintf(stderr, - "\t[-o outfile] command | -p pid[/lwps] ...\n"); + "\t[-o outfile] command | -p pid[/lwps] ...\n"); exit(2); } @@ -473,31 +469,31 @@ main(int argc, char *argv[]) switch (err) { case C_PERM: (void) fprintf(stderr, - "%s: cannot trace set-id or " - "unreadable object file: %s\n", - command, path); + "%s: cannot trace set-id or " + "unreadable object file: %s\n", + command, path); break; case C_LP64: (void) fprintf(stderr, - "%s: cannot control _LP64 " - "program: %s\n", - command, path); + "%s: cannot control _LP64 " + "program: %s\n", + command, path); break; case C_NOEXEC: (void) fprintf(stderr, - "%s: cannot execute program: %s\n", - command, argv[0]); + "%s: cannot execute program: %s\n", + command, argv[0]); break; case C_NOENT: (void) fprintf(stderr, - "%s: cannot find program: %s\n", - command, argv[0]); + "%s: cannot find program: %s\n", + command, argv[0]); break; case C_STRANGE: break; default: (void) fprintf(stderr, "%s: %s\n", - command, Pcreate_error(err)); + command, Pcreate_error(err)); break; } exit(2); @@ -516,7 +512,7 @@ main(int argc, char *argv[]) pri->length = 0; if (!cflag && prismember(&trace, SYS_execve)) { pri->exec_string = my_realloc(pri->exec_string, - strlen(pri->sys_string) + 1, NULL); + strlen(pri->sys_string) + 1, NULL); (void) strcpy(pri->exec_pname, pri->pname); (void) strcpy(pri->exec_string, pri->sys_string); pri->length += strlen(pri->sys_string); @@ -631,7 +627,7 @@ main(int argc, char *argv[]) case -1: (void) fprintf(stderr, "%s: cannot fork to control process, pid# %d\n", - command, (int)set->pid); + command, (int)set->pid); /* FALLTHROUGH */ default: (void) mutex_unlock(&truss_lock); @@ -680,13 +676,12 @@ main(int argc, char *argv[]) praddset(&traceeven, SYS_exit); praddset(&traceeven, SYS_lwp_create); praddset(&traceeven, SYS_lwp_exit); - praddset(&traceeven, SYS_exec); praddset(&traceeven, SYS_execve); + praddset(&traceeven, SYS_openat); + praddset(&traceeven, SYS_openat64); praddset(&traceeven, SYS_open); praddset(&traceeven, SYS_open64); - praddset(&traceeven, SYS_forkall); praddset(&traceeven, SYS_vfork); - praddset(&traceeven, SYS_fork1); praddset(&traceeven, SYS_forksys); /* for I/O buffer dumps, force tracing of read()s and write()s */ @@ -721,15 +716,7 @@ main(int argc, char *argv[]) prdelset(&traceeven, SYS_context); } - /* special case -- sysexit not traced by OS */ - if (prismember(&trace, SYS_evtrapret)) { - (void) Psysentry(Proc, SYS_evtrapret, TRUE); - (void) Psysexit(Proc, SYS_evtrapret, FALSE); - prdelset(&traceeven, SYS_evtrapret); - } - /* special case -- trace exec() on entry to get the args */ - (void) Psysentry(Proc, SYS_exec, TRUE); (void) Psysentry(Proc, SYS_execve, TRUE); /* special case -- sysexit never reached */ @@ -756,8 +743,7 @@ main(int argc, char *argv[]) */ if ((Lsp->pr_why != PR_SYSENTRY && Lsp->pr_why != PR_SYSEXIT) || - (Lsp->pr_what != SYS_exec && - Lsp->pr_what != SYS_execve)) { + Lsp->pr_what != SYS_execve) { establish_breakpoints(); establish_stacks(); } @@ -813,7 +799,7 @@ main_thread(int first) * arrange not to leave it hung on the same system call. */ primary_lwp = (first && Pstate(Proc) == PS_STOP)? - Pstatus(Proc)->pr_lwp.pr_lwpid : 0; + Pstatus(Proc)->pr_lwp.pr_lwpid : 0; /* * Create worker threads to match the lwps in the target process. @@ -977,10 +963,10 @@ worker_thread(void *arg) who = 1; Lfree(Lwp); pri->Lwp = Lwp = - Lgrab(Proc, who, &gcode); + Lgrab(Proc, who, &gcode); if (Lwp == NULL) abend("Lgrab error: ", - Lgrab_error(gcode)); + Lgrab_error(gcode)); pri->lwpstat = Lsp = Lstatus(Lwp); (void) mutex_unlock(&truss_lock); continue; @@ -999,11 +985,11 @@ worker_thread(void *arg) if (pri->sys_valid) (void) printf( "%s\t*** cannot trace across exec() of %s ***\n", - pri->pname, pri->sys_path); + pri->pname, pri->sys_path); else (void) printf( "%s\t*** lost control of process ***\n", - pri->pname); + pri->pname); pri->length = 0; Flush(); (void) mutex_unlock(&truss_lock); @@ -1011,7 +997,7 @@ worker_thread(void *arg) } if (Lstate(Lwp) != PS_STOP) { (void) fprintf(stderr, - "%s: state = %d\n", command, Lstate(Lwp)); + "%s: state = %d\n", command, Lstate(Lwp)); abend(pri->pname, "uncaught status of subject lwp"); } @@ -1104,7 +1090,6 @@ worker_thread(void *arg) case SYS_exit: /* exit() */ case SYS_lwp_exit: /* lwp_exit() */ case SYS_context: /* [get|set]context() */ - case SYS_evtrapret: /* evtrapret() */ if (dotrace && cflag && prismember(&trace, what)) { ow_in_effect = 1; @@ -1132,7 +1117,7 @@ worker_thread(void *arg) putpname(pri); timestamp(pri); pri->length += - printf("%s\n", pri->sys_string); + printf("%s\n", pri->sys_string); Flush(); } pri->sys_leng = 0; @@ -1141,19 +1126,18 @@ worker_thread(void *arg) if (what == SYS_exit) exit_called = TRUE; break; - case SYS_exec: case SYS_execve: (void) sysentry(pri, dotrace); if (dotrace && !cflag && prismember(&trace, what)) { pri->exec_string = - my_realloc(pri->exec_string, - strlen(pri->sys_string) + 1, - NULL); + my_realloc(pri->exec_string, + strlen(pri->sys_string) + 1, + NULL); (void) strcpy(pri->exec_pname, - pri->pname); + pri->pname); (void) strcpy(pri->exec_string, - pri->sys_string); + pri->sys_string); pri->length += strlen(pri->sys_string); pri->exec_lwpid = Lsp->pr_lwpid; } @@ -1174,14 +1158,24 @@ worker_thread(void *arg) break; case PR_SYSEXIT: /* check for write open of a /proc file */ - if ((what == SYS_open || what == SYS_open64)) { + if (what == SYS_openat || what == SYS_openat64 || + what == SYS_open || what == SYS_open64) { + int readonly; + (void) sysentry(pri, dotrace); pri->Errno = Lsp->pr_errno; pri->ErrPriv = Lsp->pr_errpriv; + readonly = + ((what == SYS_openat || + what == SYS_openat64) && + pri->sys_nargs > 2 && + (pri->sys_args[2]&0x3) == O_RDONLY) || + ((what == SYS_open || + what == SYS_open64) && + pri->sys_nargs > 1 && + (pri->sys_args[1]&0x3) == O_RDONLY); if ((pri->Errno == 0 || pri->Errno == EBUSY) && - pri->sys_valid && - (pri->sys_nargs > 1 && - (pri->sys_args[1]&0x3) != O_RDONLY)) { + pri->sys_valid && !readonly) { int rv = checkproc(pri); if (rv == 1 && Fflag != PGRAB_FORCE) { /* @@ -1200,7 +1194,7 @@ worker_thread(void *arg) } sigusr1 = TRUE; (void) mutex_unlock( - &truss_lock); + &truss_lock); goto out; } if (rv == 2) { @@ -1216,8 +1210,7 @@ worker_thread(void *arg) } } } - if ((what == SYS_exec || what == SYS_execve) && - pri->Errno == 0) { + if (what == SYS_execve && pri->Errno == 0) { /* * Refresh the data model on exec() in case it * is different from the parent. Lwait() @@ -1252,8 +1245,7 @@ worker_thread(void *arg) if (dotrace && Tflag && !first && prismember(&syshang, what)) leave_it_hung = TRUE; - if ((what == SYS_exec || what == SYS_execve) && - pri->Errno == 0) { + if (what == SYS_execve && pri->Errno == 0) { is_vfork_child = FALSE; reset_breakpoints(); /* @@ -1270,14 +1262,14 @@ worker_thread(void *arg) */ while (truss_nlwp > 1) (void) cond_wait(&truss_cv, - &truss_lock); + &truss_lock); who = Lsp->pr_lwpid; Lfree(Lwp); pri->Lwp = Lwp = - Lgrab(Proc, who, &gcode); + Lgrab(Proc, who, &gcode); if (Lwp == NULL) abend("Lgrab error: ", - Lgrab_error(gcode)); + Lgrab_error(gcode)); pri->lwpstat = Lsp = Lstatus(Lwp); } } @@ -1285,8 +1277,8 @@ worker_thread(void *arg) default: req_flag = 0; (void) fprintf(stderr, - "unknown reason for stopping: %d/%d\n", - Lsp->pr_why, what); + "unknown reason for stopping: %d/%d\n", + Lsp->pr_why, what); abend(NULL, NULL); } @@ -1359,8 +1351,8 @@ worker_thread(void *arg) (void) Lsetrun(Lwp, 0, PRCFAULT|PRSTOP); } else { (void) printf("%s\t*** Expected PR_FAULTED/" - "FLTTRACE stop following vfork()\n", - pri->pname); + "FLTTRACE stop following vfork()\n", + pri->pname); } } @@ -1519,9 +1511,7 @@ out: */ (void) Pstop(Proc, MILLISEC); clear_breakpoints(); - (void) Psysexit(Proc, SYS_forkall, FALSE); (void) Psysexit(Proc, SYS_vfork, FALSE); - (void) Psysexit(Proc, SYS_fork1, FALSE); (void) Psysexit(Proc, SYS_forksys, FALSE); (void) Punsetflags(Proc, PR_FORK); Psync(Proc); @@ -1555,8 +1545,8 @@ setup_basetime(hrtime_t basehrtime, struct timeval *basedate) const char *ptime; const char *pdst; hrtime_t delta = basehrtime - - ((hrtime_t)Cp->basetime.tv_sec * NANOSEC + - Cp->basetime.tv_nsec); + ((hrtime_t)Cp->basetime.tv_sec * NANOSEC + + Cp->basetime.tv_nsec); if (delta > 0) { basedate->tv_sec -= (time_t)(delta / NANOSEC); @@ -2109,12 +2099,12 @@ report(private_t *pri, time_t lapse) /* elapsed time, clock ticks */ (void) printf("faults -------------\n"); name = proc_fltname(i, pri->flt_name, - sizeof (pri->flt_name)); + sizeof (pri->flt_name)); (void) printf("%s%s\t%4ld\n", name, - (((int)strlen(name) < 8)? - (const char *)"\t" : (const char *)""), - count); + (((int)strlen(name) < 8)? + (const char *)"\t" : (const char *)""), + count); total += count; } } @@ -2127,9 +2117,9 @@ report(private_t *pri, time_t lapse) /* elapsed time, clock ticks */ (void) printf("signals ------------\n"); name = signame(pri, i); (void) printf("%s%s\t%4ld\n", name, - (((int)strlen(name) < 8)? - (const char *)"\t" : (const char *)""), - count); + (((int)strlen(name) < 8)? + (const char *)"\t" : (const char *)""), + count); total += count; } } @@ -2154,7 +2144,7 @@ report(private_t *pri, time_t lapse) /* elapsed time, clock ticks */ qsort((void *)stbl, elem, sizeof (hentry_t), lib_sort); (void) printf( - "\n%-20s %-40s %s\n", "Library:", "Function", "calls"); + "\n%-20s %-40s %s\n", "Library:", "Function", "calls"); for (i = 0; i < elem; i++) { (void) printf("%-20s %-40s %ld\n", stbl[i].lib, stbl[i].key, stbl[i].count); @@ -2179,7 +2169,7 @@ report(private_t *pri, time_t lapse) /* elapsed time, clock ticks */ for (subcode = 0; subcode < n; subcode++, scp++) { if ((count = scp->count) != 0 || scp->error) { (void) printf("%-19.19s ", - sysname(pri, i, subcode)); + sysname(pri, i, subcode)); ticks = scp->stime; accumulate(&ticktot, &ticks, &tickzero); @@ -2275,11 +2265,11 @@ psargs(private_t *pri) if (proc_get_psinfo(pid, &psinfo) == 0) (void) printf("%spsargs: %.64s\n", - pri->pname, psinfo.pr_psargs); + pri->pname, psinfo.pr_psargs); else { perror("psargs()"); (void) printf("%s\t*** Cannot read psinfo file for pid %d\n", - pri->pname, (int)pid); + pri->pname, (int)pid); } } @@ -2293,7 +2283,7 @@ fetchstring(private_t *pri, long addr, int maxleng) string[40] = '\0'; if (pri->str_bsize == 0) /* initial allocation of string buffer */ pri->str_buffer = - my_malloc(pri->str_bsize = 16, "string buffer"); + my_malloc(pri->str_bsize = 16, "string buffer"); *pri->str_buffer = '\0'; for (nbyte = 40; nbyte == 40 && leng < maxleng; addr += 40) { @@ -2303,8 +2293,8 @@ fetchstring(private_t *pri, long addr, int maxleng) (nbyte = strlen(string)) > 0) { while (leng + nbyte >= pri->str_bsize) pri->str_buffer = - my_realloc(pri->str_buffer, - pri->str_bsize *= 2, "string buffer"); + my_realloc(pri->str_buffer, + pri->str_bsize *= 2, "string buffer"); (void) strcpy(pri->str_buffer+leng, string); leng += nbyte; } @@ -2328,7 +2318,7 @@ show_cred(private_t *pri, int new) return; } - if (!cflag && prismember(&trace, SYS_exec)) { + if (!cflag && prismember(&trace, SYS_execve)) { if (new) credentials = cred; if ((new && cred.pr_ruid != cred.pr_suid) || @@ -2336,19 +2326,19 @@ show_cred(private_t *pri, int new) cred.pr_suid != credentials.pr_suid) (void) printf( "%s *** SUID: ruid/euid/suid = %d / %d / %d ***\n", - pri->pname, - (int)cred.pr_ruid, - (int)cred.pr_euid, - (int)cred.pr_suid); + pri->pname, + (int)cred.pr_ruid, + (int)cred.pr_euid, + (int)cred.pr_suid); if ((new && cred.pr_rgid != cred.pr_sgid) || cred.pr_rgid != credentials.pr_rgid || cred.pr_sgid != credentials.pr_sgid) (void) printf( "%s *** SGID: rgid/egid/sgid = %d / %d / %d ***\n", - pri->pname, - (int)cred.pr_rgid, - (int)cred.pr_egid, - (int)cred.pr_sgid); + pri->pname, + (int)cred.pr_rgid, + (int)cred.pr_egid, + (int)cred.pr_sgid); } credentials = cred; @@ -2373,7 +2363,7 @@ control(private_t *pri, pid_t pid) gps->fork_pid = getpid(); /* parent pid */ if ((childpid = fork()) == -1) { (void) printf("%s\t*** Cannot fork() to control process #%d\n", - pri->pname, (int)pid); + pri->pname, (int)pid); Flush(); gps->fork_pid = 0; (void) cond_broadcast(&gps->fork_cv); @@ -2411,8 +2401,8 @@ control(private_t *pri, pid_t pid) */ if ((Proc = Pgrab(pid, PGRAB_RETAIN, &rc)) == NULL) { (void) fprintf(stderr, - "%s: cannot control child process, pid# %d: %s\n", - command, (int)pid, Pgrab_error(rc)); + "%s: cannot control child process, pid# %d: %s\n", + command, (int)pid, Pgrab_error(rc)); gps->fork_pid = childpid; (void) cond_broadcast(&gps->fork_cv); (void) mutex_unlock(&gps->fork_lock); @@ -2470,7 +2460,7 @@ grabit(private_t *pri, proc_set_t *set) */ if ((Proc = Pgrab(set->pid, Fflag, &gcode)) == NULL) { (void) fprintf(stderr, "%s: %s: %d\n", - command, Pgrab_error(gcode), (int)set->pid); + command, Pgrab_error(gcode), (int)set->pid); pri->lwpstat = NULL; return (FALSE); } @@ -2516,8 +2506,8 @@ release(private_t *pri, pid_t pid) write(fd, (char *)ctl, sizeof (ctl)) < 0) { perror("release()"); (void) printf( - "%s\t*** Cannot release child process, pid# %d\n", - pri->pname, (int)pid); + "%s\t*** Cannot release child process, pid# %d\n", + pri->pname, (int)pid); Flush(); } if (fd >= 0) /* run-on-last-close sets the process running */ @@ -2658,7 +2648,7 @@ void letgo(private_t *pri) { (void) printf("%s\t*** process otherwise traced, releasing ...\n", - pri->pname); + pri->pname); } /* diff --git a/usr/src/cmd/truss/print.c b/usr/src/cmd/truss/print.c index 30dabbf934..2848fd1490 100644 --- a/usr/src/cmd/truss/print.c +++ b/usr/src/cmd/truss/print.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -521,17 +521,6 @@ prt_smf(private_t *pri, int raw, long val) /* print streams message flags */ } void -prt_plk(private_t *pri, int raw, long val) /* print plock code */ -{ - const char *s = raw? NULL : plockname(val); - - if (s == NULL) - prt_dec(pri, 0, val); - else - outstring(pri, s); -} - -void prt_mtf(private_t *pri, int raw, long val) /* print mount flags */ { const char *s = raw? NULL : mountflags(pri, val); @@ -2359,10 +2348,14 @@ prt_zga(private_t *pri, int raw, long val) void prt_atc(private_t *pri, int raw, long val) { - if (!raw && val == AT_FDCWD) - outstring(pri, "AT_FDCWD"); - else + if ((int)val == AT_FDCWD) { + if (raw) + prt_hex(pri, 0, (uint_t)AT_FDCWD); + else + outstring(pri, "AT_FDCWD"); + } else { prt_dec(pri, 0, val); + } } /* @@ -2633,7 +2626,7 @@ void (* const Print[])() = { prt_sef, /* SEF -- print semsys flags */ prt_shc, /* SHC -- print shmsys command */ prt_shf, /* SHF -- print shmsys flags */ - prt_plk, /* PLK -- print plock code */ + prt_nov, /* Was PLK, now available for reuse */ prt_sfs, /* SFS -- print sysfs code */ prt_rst, /* RST -- print string returned by syscall */ prt_smf, /* SMF -- print streams message flags */ diff --git a/usr/src/cmd/truss/print.h b/usr/src/cmd/truss/print.h index 916ebc2505..159b2fbe58 100644 --- a/usr/src/cmd/truss/print.h +++ b/usr/src/cmd/truss/print.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -56,7 +56,7 @@ extern "C" { #define SEF 16 /* print semsys flags */ #define SHC 17 /* print shmsys command */ #define SHF 18 /* print shmsys flags */ -#define PLK 19 /* print plock code */ +/* Number 19 now available for reuse */ #define SFS 20 /* print sysfs code */ #define RST 21 /* print string returned by sys call */ #define SMF 22 /* print streams message flags */ diff --git a/usr/src/cmd/truss/proto.h b/usr/src/cmd/truss/proto.h index 29c8632353..25f92cef67 100644 --- a/usr/src/cmd/truss/proto.h +++ b/usr/src/cmd/truss/proto.h @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -66,7 +66,6 @@ extern const char *ioctlname(private_t *, uint_t); extern const char *ioctldatastruct(uint_t); extern const char *fcntlname(int); extern const char *sfsname(int); -extern const char *plockname(int); extern const char *si86name(int); extern const char *utscode(int); extern const char *openarg(private_t *, int); @@ -135,8 +134,6 @@ extern int maxsyscalls(void); extern int nsubcodes(int); extern void show_stat(private_t *, long); -extern void show_statat(private_t *, long); -extern void show_xstat(private_t *, int, long); extern void show_stat64_32(private_t *, long); extern void establish_breakpoints(void); diff --git a/usr/src/cmd/truss/ramdata.h b/usr/src/cmd/truss/ramdata.h index 24cea0dbd8..ea2bbdda46 100644 --- a/usr/src/cmd/truss/ramdata.h +++ b/usr/src/cmd/truss/ramdata.h @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -106,7 +106,7 @@ typedef struct private { char raw_sig_name[SIG2STR_MAX+4]; /* name of known signal */ char sig_name[12]; /* name of unknown signal */ char flt_name[12]; /* name of unknown fault */ - char *sys_path; /* first pathname given to syscall */ + char *sys_path; /* pathname given to syscall */ size_t sys_psize; /* sizeof(*sys_path) */ int sys_valid; /* pathname was fetched and is valid */ char *sys_string; /* buffer for formatted syscall string */ diff --git a/usr/src/cmd/truss/xstat.c b/usr/src/cmd/truss/stat.c index e82ce21af1..f5ecab0c62 100644 --- a/usr/src/cmd/truss/xstat.c +++ b/usr/src/cmd/truss/stat.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,17 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */ - #define _SYSCALL32 #include <stdio.h> @@ -49,97 +46,6 @@ void show_stat32(private_t *, long); void show_stat64(private_t *, long); #endif -#if defined(i386) && defined(_STAT_VER) - -/* - * Old SVR3 stat structure. - */ -struct o_stat { - o_dev_t st_dev; - o_ino_t st_ino; - o_mode_t st_mode; - o_nlink_t st_nlink; - o_uid_t st_uid; - o_gid_t st_gid; - o_dev_t st_rdev; - off32_t st_size; - time_t st_atim; - time_t st_mtim; - time_t st_ctim; -}; - -void -show_o_stat(private_t *pri, long offset) -{ - struct o_stat statb; - timestruc_t ts; - - if (offset != NULL && - Pread(Proc, &statb, sizeof (statb), offset) == sizeof (statb)) { - (void) printf( - "%s d=0x%.8X i=%-5u m=0%.6o l=%-2u u=%-5u g=%-5u", - pri->pname, - statb.st_dev & 0xffff, - statb.st_ino, - statb.st_mode, - statb.st_nlink % 0xffff, - statb.st_uid, - statb.st_gid); - - switch (statb.st_mode & S_IFMT) { - case S_IFCHR: - case S_IFBLK: - (void) printf(" rdev=0x%.4X\n", statb.st_rdev & 0xffff); - break; - default: - (void) printf(" sz=%u\n", (uint32_t)statb.st_size); - break; - } - - ts.tv_nsec = 0; - ts.tv_sec = statb.st_atim; - prtimestruc(pri, "at = ", &ts); - ts.tv_sec = statb.st_atim; - prtimestruc(pri, "mt = ", &ts); - ts.tv_sec = statb.st_atim; - prtimestruc(pri, "ct = ", &ts); - } -} - -void -show_stat(private_t *pri, long offset) -{ - show_o_stat(pri, offset); -} - -void -show_xstat(private_t *pri, int version, long offset) -{ - switch (version) { - case _R3_STAT_VER: - show_o_stat(pri, offset); - break; - case _STAT_VER: - show_stat32(pri, offset); - break; - } -} - -void -show_statat(private_t *pri, long offset) -{ -#ifdef _LP64 - if (data_model == PR_MODEL_LP64) - show_stat64(pri, offset); - else - show_stat32(pri, offset); -#else - show_stat32(pri, offset); -#endif -} - -#else - void show_stat(private_t *pri, long offset) { @@ -154,21 +60,6 @@ show_stat(private_t *pri, long offset) } void -show_statat(private_t *pri, long offset) -{ - show_stat(pri, offset); -} - -/* ARGSUSED */ -void -show_xstat(private_t *pri, int version, long offset) -{ - show_stat(pri, offset); -} - -#endif - -void show_stat32(private_t *pri, long offset) { struct stat32 statb; diff --git a/usr/src/cmd/truss/systable.c b/usr/src/cmd/truss/systable.c index d63ccbabba..0046110e2b 100644 --- a/usr/src/cmd/truss/systable.c +++ b/usr/src/cmd/truss/systable.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -219,16 +219,16 @@ errname(int err) /* return the error code name (NULL if none) */ const struct systable systable[] = { { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"_exit", 1, DEC, NOV, DEC}, /* 1 */ -{"forkall", 0, DEC, NOV}, /* 2 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"read", 3, DEC, NOV, DEC, IOB, UNS}, /* 3 */ {"write", 3, DEC, NOV, DEC, IOB, UNS}, /* 4 */ {"open", 3, DEC, NOV, STG, OPN, OCT}, /* 5 */ {"close", 1, DEC, NOV, DEC}, /* 6 */ -{"wait", 0, DEC, HHX}, /* 7 */ -{"creat", 2, DEC, NOV, STG, OCT}, /* 8 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"link", 2, DEC, NOV, STG, STG}, /* 9 */ {"unlink", 1, DEC, NOV, STG}, /* 10 */ -{"exec", 2, DEC, NOV, STG, DEC}, /* 11 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"chdir", 1, DEC, NOV, STG}, /* 12 */ {"time", 0, DEC, NOV}, /* 13 */ {"mknod", 3, DEC, NOV, STG, OCT, HEX}, /* 14 */ @@ -238,8 +238,8 @@ const struct systable systable[] = { {"stat", 2, DEC, NOV, STG, HEX}, /* 18 */ {"lseek", 3, DEC, NOV, DEC, DEX, WHN}, /* 19 */ {"getpid", 0, DEC, DEC}, /* 20 */ -{"mount", 8, DEC, NOV, STG, STG, MTF, MFT, HEX, DEC, HEX, DEC}, /* 21 */ -{"umount", 1, DEC, NOV, STG}, /* 22 */ +{"mount", 8, DEC, NOV, STG, STG, MTF, MFT, HEX, DEC, HEX, DEC}, /* 21 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"setuid", 1, DEC, NOV, UNS}, /* 23 */ {"getuid", 0, UNS, UNS}, /* 24 */ {"stime", 1, DEC, NOV, DEC}, /* 25 */ @@ -247,7 +247,7 @@ const struct systable systable[] = { {"alarm", 1, DEC, NOV, UNS}, /* 27 */ {"fstat", 2, DEC, NOV, DEC, HEX}, /* 28 */ {"pause", 0, DEC, NOV}, /* 29 */ -{"utime", 2, DEC, NOV, STG, HEX}, /* 30 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"stty", 2, DEC, NOV, DEC, DEC}, /* 31 */ {"gtty", 2, DEC, NOV, DEC, DEC}, /* 32 */ {"access", 2, DEC, NOV, STG, ACC}, /* 33 */ @@ -258,11 +258,11 @@ const struct systable systable[] = { {"fstatfs", 4, DEC, NOV, DEC, HEX, DEC, DEC}, /* 38 */ {"pgrpsys", 3, DEC, NOV, DEC, DEC, DEC}, /* 39 */ {"uucopystr", 3, DEC, NOV, STG, RST, UNS}, /* 40 */ -{"dup", 1, DEC, NOV, DEC}, /* 41 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"pipe", 0, DEC, DEC}, /* 42 */ {"times", 1, DEC, NOV, HEX}, /* 43 */ {"profil", 4, DEC, NOV, HEX, UNS, HEX, OCT}, /* 44 */ -{"plock", 1, DEC, NOV, PLK}, /* 45 */ +{"faccessat", 4, DEC, NOV, ATC, STG, ACC, DEC}, /* 45 */ {"setgid", 1, DEC, NOV, UNS}, /* 46 */ {"getgid", 0, UNS, UNS}, /* 47 */ { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, @@ -273,7 +273,7 @@ const struct systable systable[] = { {"semsys", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 53 */ {"ioctl", 3, DEC, NOV, DEC, IOC, IOA}, /* 54 */ {"uadmin", 3, DEC, NOV, DEC, DEC, DEC}, /* 55 */ -{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, +{"fchownat", 5, DEC, NOV, ATC, STG, DEC, DEC, UTF}, /* 56 */ {"utssys", 4, DEC, NOV, HEX, DEC, UTS, HEX}, /* 57 */ {"fdsync", 2, DEC, NOV, DEC, FFG}, /* 58 */ {"execve", 3, DEC, NOV, STG, HEX, HEX}, /* 59 */ @@ -281,22 +281,19 @@ const struct systable systable[] = { {"chroot", 1, DEC, NOV, STG}, /* 61 */ {"fcntl", 3, DEC, NOV, DEC, FCN, HEX}, /* 62 */ {"ulimit", 2, DEX, NOV, ULM, DEC}, /* 63 */ - -/* The following 6 entries were reserved for the UNIX PC */ -{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, -{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, -{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, -{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, -{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, -{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, - +{"renameat", 4, DEC, NOV, ATC, STG, ATC, STG}, /* 64 */ +{"unlinkat", 3, DEC, NOV, ATC, STG, DEC}, /* 65 */ +{"fstatat", 4, DEC, NOV, ATC, STG, HEX, UTF}, /* 66 */ +{"fstatat64", 4, DEC, NOV, ATC, STG, HEX, UTF}, /* 67 */ +{"openat", 4, DEC, NOV, ATC, STG, OPN, OCT}, /* 68 */ +{"openat64", 4, DEC, NOV, ATC, STG, OPN, OCT}, /* 69 */ {"tasksys", 5, DEC, NOV, DEC, DEC, DEC, HEX, DEC}, /* 70 */ {"acctctl", 3, DEC, NOV, HEX, HEX, UNS}, /* 71 */ {"exacctsys", 6, DEC, NOV, DEC, IDT, DEC, HEX, DEC, HEX}, /* 72 */ {"getpagesizes", 2, DEC, NOV, HEX, DEC}, /* 73 */ {"rctlsys", 6, DEC, NOV, RSC, STG, HEX, HEX, DEC, DEC}, /* 74 */ {"sidsys", 4, UNS, UNS, DEC, DEC, DEC, DEC}, /* 75 */ -{"fsat", 6, DEC, NOV, HEX, HEX, HEX, HEX, HEX, HEX}, /* 76 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"lwp_park", 3, DEC, NOV, DEC, HEX, DEC}, /* 77 */ {"sendfilev", 5, DEC, NOV, DEC, DEC, HEX, DEC, HEX}, /* 78 */ {"rmdir", 1, DEC, NOV, STG}, /* 79 */ @@ -307,7 +304,7 @@ const struct systable systable[] = { {"sysfs", 3, DEC, NOV, SFS, DEX, DEX}, /* 84 */ {"getmsg", 4, DEC, NOV, DEC, HEX, HEX, HEX}, /* 85 */ {"putmsg", 4, DEC, NOV, DEC, HEX, HEX, SMF}, /* 86 */ -{"poll", 3, DEC, NOV, HEX, DEC, DEC}, /* 87 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"lstat", 2, DEC, NOV, STG, HEX}, /* 88 */ {"symlink", 2, DEC, NOV, STG, STG}, /* 89 */ {"readlink", 3, DEC, NOV, STG, RLK, UNS}, /* 90 */ @@ -321,8 +318,8 @@ const struct systable systable[] = { {"sigaction", 3, DEC, NOV, SIG, HEX, HEX}, /* 98 */ {"sigpendsys", 2, DEC, NOV, DEC, HEX}, /* 99 */ {"context", 2, DEC, NOV, DEC, HEX}, /* 100 */ -{"evsys", 3, DEC, NOV, DEC, DEC, HEX}, /* 101 */ -{"evtrapret", 0, DEC, NOV}, /* 102 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"statvfs", 2, DEC, NOV, STG, HEX}, /* 103 */ {"fstatvfs", 2, DEC, NOV, DEC, HEX}, /* 104 */ {"getloadavg", 2, DEC, NOV, HEX, DEC}, /* 105 */ @@ -343,10 +340,10 @@ const struct systable systable[] = { {"fchdir", 1, DEC, NOV, DEC}, /* 120 */ {"readv", 3, DEC, NOV, DEC, HEX, DEC}, /* 121 */ {"writev", 3, DEC, NOV, DEC, HEX, DEC}, /* 122 */ -{"xstat", 3, DEC, NOV, DEC, STG, HEX}, /* 123 */ -{"lxstat", 3, DEC, NOV, DEC, STG, HEX}, /* 124 */ -{"fxstat", 3, DEC, NOV, DEC, DEC, HEX}, /* 125 */ -{"xmknod", 4, DEC, NOV, DEC, STG, OCT, HEX}, /* 126 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"mmapobj", 5, DEC, NOV, DEC, MOB, HEX, HEX, HEX}, /* 127 */ {"setrlimit", 2, DEC, NOV, RLM, HEX}, /* 128 */ {"getrlimit", 2, DEC, NOV, RLM, HEX}, /* 129 */ @@ -363,18 +360,18 @@ const struct systable systable[] = { {"sharefs", 3, DEC, NOV, DEC, HEX, DEC}, /* 140 */ {"seteuid", 1, DEC, NOV, UNS}, /* 141 */ {"forksys", 2, DEC, NOV, DEC, HHX}, /* 142 */ -{"fork1", 0, DEC, NOV}, /* 143 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"sigtimedwait", 3, DEC, NOV, HEX, HEX, HEX}, /* 144 */ {"lwp_info", 1, DEC, NOV, HEX}, /* 145 */ {"yield", 0, DEC, NOV}, /* 146 */ -{"lwp_sema_wait", 1, DEC, NOV, HEX}, /* 147 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"lwp_sema_post", 1, DEC, NOV, HEX}, /* 148 */ {"lwp_sema_trywait", 1, DEC, NOV, HEX}, /* 149 */ {"lwp_detach", 1, DEC, NOV, DEC}, /* 150 */ {"corectl", 4, DEC, NOV, DEC, HEX, HEX, HEX}, /* 151 */ {"modctl", 5, DEC, NOV, MOD, HEX, HEX, HEX, HEX}, /* 152 */ {"fchroot", 1, DEC, NOV, DEC}, /* 153 */ -{"utimes", 2, DEC, NOV, STG, HEX}, /* 154 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"vhangup", 0, DEC, NOV}, /* 155 */ {"gettimeofday", 1, DEC, NOV, HEX}, /* 156 */ {"getitimer", 2, DEC, NOV, ITM, HEX}, /* 157 */ @@ -389,7 +386,7 @@ const struct systable systable[] = { {"lwp_private", 3, HEX, NOV, DEC, DEC, HEX}, /* 166 */ {"lwp_wait", 2, DEC, NOV, DEC, HEX}, /* 167 */ {"lwp_mutex_wakeup", 2, DEC, NOV, HEX, DEC}, /* 168 */ -{"lwp_mutex_lock", 1, DEC, NOV, HEX}, /* 169 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"lwp_cond_wait", 4, DEC, NOV, HEX, HEX, HEX, DEC}, /* 170 */ {"lwp_cond_signal", 1, DEC, NOV, HEX}, /* 171 */ {"lwp_cond_broadcast", 1, DEC, NOV, HEX}, /* 172 */ @@ -444,7 +441,7 @@ const struct systable systable[] = { {"getrlimit64", 2, DEC, NOV, RLM, HEX}, /* 221 */ {"pread64", 5, DEC, NOV, DEC, IOB, UNS, LLO, HID}, /* 222 */ {"pwrite64", 5, DEC, NOV, DEC, IOB, UNS, LLO, HID}, /* 223 */ -{"creat64", 2, DEC, NOV, STG, OCT}, /* 224 */ +{ NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, {"open64", 3, DEC, NOV, STG, OPN, OCT}, /* 225 */ {"rpcmod", 3, DEC, NOV, DEC, HEX}, /* 226 */ {"zone", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 227 */ @@ -487,6 +484,65 @@ const struct systable systable[] = { * The following are for interpreting syscalls with sub-codes. */ +const struct systable faccessattable[] = { +{"faccessat", 4, DEC, NOV, ATC, STG, ACC, DEC}, /* 0 */ +{"access", 3, DEC, NOV, HID, STG, ACC}, /* 1 */ +}; +#define NACCESSCODE (sizeof (faccessattable) / sizeof (struct systable)) + +const struct systable fchownattable[] = { +{"fchownat", 5, DEC, NOV, ATC, STG, DEC, DEC, UTF}, /* 0 */ +{"chown", 4, DEC, NOV, HID, STG, DEC, DEC}, /* 1 */ +{"lchown", 4, DEC, NOV, HID, STG, DEC, DEC}, /* 2 */ +{"fchown", 4, DEC, NOV, DEC, HID, DEC, DEC}, /* 3 */ +}; +#define NCHOWNCODE (sizeof (fchownattable) / sizeof (struct systable)) + +const struct systable renameattable[] = { +{"renameat", 4, DEC, NOV, ATC, STG, ATC, STG}, /* 0 */ +{"rename", 4, DEC, NOV, HID, STG, HID, STG}, /* 1 */ +}; +#define NRENAMECODE (sizeof (renameattable) / sizeof (struct systable)) + +const struct systable unlinkattable[] = { +{"unlinkat", 3, DEC, NOV, ATC, STG, DEC}, /* 0 */ +{"unlink", 2, DEC, NOV, HID, STG}, /* 1 */ +{"rmdir", 2, DEC, NOV, HID, STG}, /* 2 */ +}; +#define NUNLINKCODE (sizeof (unlinkattable) / sizeof (struct systable)) + +const struct systable fstatattable[] = { +{"fstatat", 4, DEC, NOV, ATC, STG, HEX, UTF}, /* 0 */ +{"stat", 3, DEC, NOV, HID, STG, HEX}, /* 1 */ +{"lstat", 3, DEC, NOV, HID, STG, HEX}, /* 2 */ +{"fstat", 3, DEC, NOV, DEC, HID, HEX}, /* 3 */ +}; +#define NSTATCODE (sizeof (fstatattable) / sizeof (struct systable)) + +const struct systable fstatat64table[] = { +{"fstatat64", 4, DEC, NOV, ATC, STG, HEX, UTF}, /* 0 */ +{"stat64", 3, DEC, NOV, HID, STG, HEX}, /* 1 */ +{"lstat64", 3, DEC, NOV, HID, STG, HEX}, /* 2 */ +{"fstat64", 3, DEC, NOV, DEC, HID, HEX}, /* 3 */ +}; +#define NSTAT64CODE (sizeof (fstatat64table) / sizeof (struct systable)) + +const struct systable openattable[] = { +{"openat", 3, DEC, NOV, ATC, STG, OPN}, /* 0 */ +{"openat", 4, DEC, NOV, ATC, STG, OPN, OCT}, /* 1 */ +{"open", 3, DEC, NOV, HID, STG, OPN}, /* 2 */ +{"open", 4, DEC, NOV, HID, STG, OPN, OCT}, /* 3 */ +}; +#define NOPENATCODE (sizeof (openattable) / sizeof (struct systable)) + +const struct systable openat64table[] = { +{"openat64", 3, DEC, NOV, ATC, STG, OPN}, /* 0 */ +{"openat64", 4, DEC, NOV, ATC, STG, OPN, OCT}, /* 1 */ +{"open64", 3, DEC, NOV, HID, STG, OPN}, /* 2 */ +{"open64", 4, DEC, NOV, HID, STG, OPN, OCT}, /* 3 */ +}; +#define NOPENAT64CODE (sizeof (openat64table) / sizeof (struct systable)) + const struct systable opentable[] = { {"open", 2, DEC, NOV, STG, OPN}, /* 0 */ {"open", 3, DEC, NOV, STG, OPN, OCT}, /* 1 */ @@ -698,22 +754,6 @@ static const struct systable exacctsystable[] = { }; #define NEXACCTSYSCODE (sizeof (exacctsystable) / sizeof (struct systable)) -static const struct systable fsatsystable[] = { -{"openat", 5, DEC, NOV, HID, ATC, STG, OPN, OCT}, /* 0 */ -{"openat64", 5, DEC, NOV, HID, ATC, STG, OPN, OCT}, /* 1 */ -{"fstatat64", 5, DEC, NOV, HID, ATC, STG, HEX, HEX}, /* 2 */ -{"fstatat", 5, DEC, NOV, HID, ATC, STG, HEX, HEX}, /* 3 */ -{"fchownat", 6, DEC, NOV, HID, ATC, STG, HEX, HEX, HEX}, /* 4 */ -{"unlinkat", 4, DEC, NOV, HID, ATC, STG, HEX}, /* 5 */ -{"futimesat", 4, DEC, NOV, HID, ATC, STG, HEX}, /* 6 */ -{"renameat", 5, DEC, NOV, HID, ATC, STG, DEC, STG}, /* 7 */ -{"faccessat", 5, DEC, NOV, HID, ATC, STG, ACC, ACC}, /* 8 */ -{"__openattrdirat", 3, DEC, NOV, HID, ATC, STG}, /* 9 */ -{"openat", 4, DEC, NOV, HID, ATC, STG, OPN}, /* N - 2 */ -{"openat64", 4, DEC, NOV, HID, ATC, STG, OPN}, /* N - 1 */ -}; -#define NFSATSYSCODE (sizeof (fsatsystable) / sizeof (struct systable)) - static const struct systable lwpparktable[] = { {"lwp_park", 3, DEC, NOV, HID, HEX, DEC}, /* 0 */ {"lwp_unpark", 2, DEC, NOV, HID, DEC}, /* 1 */ @@ -836,6 +876,8 @@ const struct systable utimesystable[] = { const struct sysalias sysalias[] = { { "exit", SYS_exit }, { "fork", SYS_forksys }, + { "fork1", SYS_forksys }, + { "forkall", SYS_forksys }, { "forkx", SYS_forksys }, { "forkallx", SYS_forksys }, { "vforkx", SYS_forksys }, @@ -927,6 +969,7 @@ const struct sysalias sysalias[] = { { "putacct", SYS_exacctsys }, { "wracct", SYS_exacctsys }, { "lwp_cond_timedwait", SYS_lwp_cond_wait }, + { "lwp_sema_wait", SYS_lwp_sema_timedwait }, { "lwp_park", SYS_lwp_park }, { "lwp_unpark", SYS_lwp_park }, { "lwp_unpark_all", SYS_lwp_park }, @@ -935,17 +978,11 @@ const struct sysalias sysalias[] = { { "lwp_rwlock_tryrdlock", SYS_lwp_rwlock_sys }, { "lwp_rwlock_trywrlock", SYS_lwp_rwlock_sys }, { "lwp_rwlock_unlock", SYS_lwp_rwlock_sys }, + { "lwp_mutex_lock", SYS_lwp_mutex_timedlock }, { "sendfilev64", SYS_sendfilev }, - { "openat", SYS_fsat }, - { "openat64", SYS_fsat }, - { "fstatat64", SYS_fsat }, - { "fstatat", SYS_fsat }, - { "fchownat", SYS_fsat }, - { "unlinkat", SYS_fsat }, - { "futimesat", SYS_fsat }, - { "renameat", SYS_fsat }, - { "faccessat", SYS_fsat }, - { "__openattrdirat", SYS_fsat }, + { "creat", SYS_open }, + { "creat64", SYS_open64 }, + { "openattrdirat", SYS_openat }, { "lgrpsys", SYS_lgrpsys }, { "getrusage", SYS_rusagesys }, { "getrusage_chld", SYS_rusagesys }, @@ -987,6 +1024,9 @@ const struct sysalias sysalias[] = { { "allocids", SYS_sidsys }, { "futimens", SYS_utimesys }, { "utimensat", SYS_utimesys }, + { "poll", SYS_pollsys }, + { "umount", SYS_umount2 }, + { "wait", SYS_waitid }, { NULL, 0 } /* end-of-list */ }; @@ -1000,6 +1040,38 @@ subsys(int syscall, int subcode) if (subcode != -1) { switch (syscall) { + case SYS_faccessat: + if ((unsigned)subcode < NACCESSCODE) + stp = &faccessattable[subcode]; + break; + case SYS_fchownat: + if ((unsigned)subcode < NCHOWNCODE) + stp = &fchownattable[subcode]; + break; + case SYS_renameat: + if ((unsigned)subcode < NRENAMECODE) + stp = &renameattable[subcode]; + break; + case SYS_unlinkat: + if ((unsigned)subcode < NUNLINKCODE) + stp = &unlinkattable[subcode]; + break; + case SYS_fstatat: + if ((unsigned)subcode < NSTATCODE) + stp = &fstatattable[subcode]; + break; + case SYS_fstatat64: + if ((unsigned)subcode < NSTAT64CODE) + stp = &fstatat64table[subcode]; + break; + case SYS_openat: + if ((unsigned)subcode < NOPENATCODE) + stp = &openattable[subcode]; + break; + case SYS_openat64: + if ((unsigned)subcode < NOPENAT64CODE) + stp = &openat64table[subcode]; + break; case SYS_open: if ((unsigned)subcode < NOPENCODE) stp = &opentable[subcode]; @@ -1072,10 +1144,6 @@ subsys(int syscall, int subcode) if ((unsigned)subcode < NEXACCTSYSCODE) stp = &exacctsystable[subcode]; break; - case SYS_fsat: - if ((unsigned)subcode < NFSATSYSCODE) - stp = &fsatsystable[subcode]; - break; case SYS_privsys: /* privileges */ if ((unsigned)subcode < NPRIVSYSCODE) stp = &privsystable[subcode]; @@ -1208,42 +1276,70 @@ getsubcode(private_t *pri) int subcode = -1; int arg0; - if (syscall > 0 && nsysarg > 0) { + if (syscall > 0 && nsysarg > 0 && !prismember(&rawout, syscall)) { arg0 = Lsp->pr_sysarg[0]; switch (syscall) { case SYS_utssys: /* utssys() */ if (nsysarg > 2) subcode = Lsp->pr_sysarg[2]; break; - case SYS_open: /* open() w/ and w/o O_CREAT */ - case SYS_open64: - if (nsysarg > 1) - subcode = (Lsp->pr_sysarg[1] & O_CREAT)? 1 : 0; + case SYS_faccessat: + if (nsysarg > 3) + subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD && + Lsp->pr_sysarg[3] == 0)? 1 : 0; break; - case SYS_fsat: - switch (arg0) { - case 0: /* openat */ - if (nsysarg > 3) - subcode = - (Lsp->pr_sysarg[3] & O_CREAT) ? - 0 : NFSATSYSCODE - 2; + case SYS_fchownat: + if (nsysarg > 1 && Lsp->pr_sysarg[1] == NULL) { + subcode = 3; break; - case 1: /* openat64 */ - if (nsysarg > 3) - subcode = - (Lsp->pr_sysarg[3] & O_CREAT) ? - 1 : NFSATSYSCODE - 1; + } + if (nsysarg > 0 && (int)Lsp->pr_sysarg[0] != AT_FDCWD) { + subcode = 0; + break; + } + if (nsysarg > 4) + subcode = (Lsp->pr_sysarg[4] == 0)? 1 : + (Lsp->pr_sysarg[4] == AT_SYMLINK_NOFOLLOW)? + 2 : 0; + break; + case SYS_renameat: + if (nsysarg > 2) + subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD && + (int)Lsp->pr_sysarg[2] == AT_FDCWD)? 1 : 0; + break; + case SYS_unlinkat: + if (nsysarg > 2) + subcode = + ((int)Lsp->pr_sysarg[0] != AT_FDCWD)? 0 : + (Lsp->pr_sysarg[2] == AT_REMOVEDIR)? 2 : + (Lsp->pr_sysarg[2] == 0)? 1 : 0; + break; + case SYS_fstatat: + case SYS_fstatat64: + if (nsysarg > 1 && Lsp->pr_sysarg[1] == NULL) { + subcode = 3; break; - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - subcode = arg0; } + if (nsysarg > 0 && (int)Lsp->pr_sysarg[0] != AT_FDCWD) { + subcode = 0; + break; + } + if (nsysarg > 3) + subcode = (Lsp->pr_sysarg[3] == 0)? 1 : + (Lsp->pr_sysarg[3] == AT_SYMLINK_NOFOLLOW)? + 2 : 0; + break; + case SYS_openat: /* openat() w/ and w/o AT_FDCWD */ + case SYS_openat64: /* and with and w/o O_CREAT */ + if (nsysarg > 2) + subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD)? + ((Lsp->pr_sysarg[2] & O_CREAT)? 3 : 2) : + ((Lsp->pr_sysarg[2] & O_CREAT)? 1 : 0); + break; + case SYS_open: /* open() w/ and w/o O_CREAT */ + case SYS_open64: + if (nsysarg > 1) + subcode = (Lsp->pr_sysarg[1] & O_CREAT)? 1 : 0; break; case SYS_kaio: /* kaio() */ subcode = arg0 & ~AIO_POLL_BIT; @@ -1317,6 +1413,14 @@ int maxsyscalls() { return (PRMAXSYS + 1 + + NACCESSCODE - 1 + + NCHOWNCODE - 1 + + NRENAMECODE - 1 + + NUNLINKCODE - 1 + + NSTATCODE - 1 + + NSTAT64CODE - 1 + + NOPENATCODE - 1 + + NOPENAT64CODE - 1 + NOPENCODE - 1 + NOPEN64CODE - 1 + NMSGCODE - 1 @@ -1335,7 +1439,6 @@ maxsyscalls() + NLWPCREATECODE - 1 + NTASKSYSCODE - 1 + NEXACCTSYSCODE - 1 - + NFSATSYSCODE - 1 + NLWPPARKCODE - 1 + NLWPRWLOCKCODE - 1 + NSENDFILESYSCODE - 1 @@ -1360,53 +1463,67 @@ int nsubcodes(int syscall) { switch (syscall) { + case SYS_faccessat: + return (NACCESSCODE); + case SYS_fchownat: + return (NCHOWNCODE); + case SYS_renameat: + return (NRENAMECODE); + case SYS_unlinkat: + return (NUNLINKCODE); + case SYS_fstatat: + return (NSTATCODE); + case SYS_fstatat64: + return (NSTAT64CODE); + case SYS_openat: + return (NOPENATCODE); + case SYS_openat64: + return (NOPENAT64CODE); case SYS_open: return (NOPENCODE); case SYS_open64: return (NOPEN64CODE); - case SYS_msgsys: /* msgsys() */ + case SYS_msgsys: return (NMSGCODE); - case SYS_semsys: /* semsys() */ + case SYS_semsys: return (NSEMCODE); - case SYS_shmsys: /* shmsys() */ + case SYS_shmsys: return (NSHMCODE); - case SYS_pgrpsys: /* pgrpsys() */ + case SYS_pgrpsys: return (NPIDCODE); - case SYS_utssys: /* utssys() */ + case SYS_utssys: return (NUTSCODE); - case SYS_sysfs: /* sysfs() */ + case SYS_sysfs: return (NSFSCODE); - case SYS_sigpending: /* sigpending()/sigfillset() */ + case SYS_sigpending: return (NSGPCODE); - case SYS_context: /* [get|set]context() */ + case SYS_context: return (NCTXCODE); - case SYS_hrtsys: /* hrtsys() */ + case SYS_hrtsys: return (NHRTCODE); - case SYS_corectl: /* corectl() */ + case SYS_corectl: return (NCORCODE); - case SYS_kaio: /* kaio() */ + case SYS_kaio: return (NAIOCODE); - case SYS_door: /* doors */ + case SYS_door: return (NDOORCODE); - case SYS_pset: /* pset() */ + case SYS_pset: return (NPSETCODE); - case SYS_lwp_create: /* lwp_create() */ + case SYS_lwp_create: return (NLWPCREATECODE); - case SYS_tasksys: /* tasks */ + case SYS_tasksys: return (NTASKSYSCODE); - case SYS_exacctsys: /* exacct */ + case SYS_exacctsys: return (NEXACCTSYSCODE); - case SYS_fsat: - return (NFSATSYSCODE); - case SYS_privsys: /* privileges */ + case SYS_privsys: return (NPRIVSYSCODE); - case SYS_lwp_park: /* lwp_park */ + case SYS_lwp_park: return (NLWPPARKCODE); case SYS_lwp_rwlock_sys: return (NLWPRWLOCKCODE); - case SYS_sendfilev: /* sendfilev */ + case SYS_sendfilev: return (NSENDFILESYSCODE); - case SYS_lgrpsys: /* lgrpsys */ + case SYS_lgrpsys: return (NLGRPSYSCODE); case SYS_rusagesys: return (NRUSAGESYSCODE); @@ -1416,7 +1533,7 @@ nsubcodes(int syscall) return (NUCREDSYSCODE); case SYS_port: return (NPORTCODE); - case SYS_zone: /* zone */ + case SYS_zone: return (NZONECODE); case SYS_labelsys: return (NLABELCODE); diff --git a/usr/src/lib/brand/lx/lx_brand/common/ptrace.c b/usr/src/lib/brand/lx/lx_brand/common/ptrace.c index 57c564cbb4..041fff736c 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/ptrace.c +++ b/usr/src/lib/brand/lx/lx_brand/common/ptrace.c @@ -20,12 +20,10 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <errno.h> #include <sys/types.h> #include <sys/param.h> @@ -444,8 +442,7 @@ getregs(pid_t pid, lwpid_t lwpid, lx_user_regs_t *rp) * had called execve (respectively). */ if (status.pr_why == PR_SYSEXIT && - (status.pr_what == SYS_exec || - status.pr_what == SYS_execve)) { + status.pr_what == SYS_execve) { rp->lxur_eax = 0; rp->lxur_orig_eax = LX_SYS_execve; } @@ -1529,7 +1526,6 @@ ptrace_attach_common(int fd, pid_t lxpid, pid_t pid, lwpid_t lwpid, int run) sysp = (sysset_t *)ctlp; ctlp += sizeof (sysset_t) / sizeof (long); premptyset(sysp); - praddset(sysp, SYS_exec); praddset(sysp, SYS_execve); if (run) { *ctlp++ = PCRUN; @@ -1800,8 +1796,7 @@ ptrace_catch_fork(pid_t pid, int monitor) sysp = (sysset_t *)ctlp; ctlp += sizeof (sysset_t) / sizeof (long); premptyset(sysp); - praddset(sysp, SYS_fork1); /* for old libc */ - praddset(sysp, SYS_forksys); /* new libc: fork1() is forksys(0, 0) */ + praddset(sysp, SYS_forksys); /* fork1() is forksys(0, 0) */ *ctlp++ = PCRUN; *ctlp++ = 0; *ctlp++ = PCWSTOP; @@ -1815,10 +1810,8 @@ ptrace_catch_fork(pid_t pid, int monitor) sysp = (sysset_t *)ctlp; ctlp += sizeof (sysset_t) / sizeof (long); premptyset(sysp); - if (monitor) { - praddset(sysp, SYS_exec); + if (monitor) praddset(sysp, SYS_execve); - } size = (char *)ctlp - (char *)&ctl[0]; assert(size <= sizeof (ctl)); @@ -2097,8 +2090,7 @@ found: * in that state as though it had reached the ptrace trace * point. */ - if (status.pr_lwp.pr_what == SYS_exec || - status.pr_lwp.pr_what == SYS_execve) { + if (status.pr_lwp.pr_what == SYS_execve) { infop->si_code = CLD_TRAPPED; infop->si_status = SIGTRAP; break; diff --git a/usr/src/lib/brand/sn1/sn1_brand/common/sn1_brand.c b/usr/src/lib/brand/sn1/sn1_brand/common/sn1_brand.c index 816ef31df2..852cfa38a6 100644 --- a/usr/src/lib/brand/sn1/sn1_brand/common/sn1_brand.c +++ b/usr/src/lib/brand/sn1/sn1_brand/common/sn1_brand.c @@ -18,6 +18,7 @@ * * CDDL HEADER END */ + /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -479,7 +480,6 @@ sn1_##name(sysret_t *rv, \ */ IN_KERNEL_SYSCALL(read, SYS_read) /* 3 */ IN_KERNEL_SYSCALL(write, SYS_write) /* 4 */ -IN_KERNEL_SYSCALL(wait, SYS_wait) /* 7 */ IN_KERNEL_SYSCALL(time, SYS_time) /* 13 */ IN_KERNEL_SYSCALL(getpid, SYS_getpid) /* 20 */ IN_KERNEL_SYSCALL(mount, SYS_mount) /* 21 */ @@ -488,6 +488,7 @@ IN_KERNEL_SYSCALL(times, SYS_times) /* 43 */ IN_KERNEL_SYSCALL(getgid, SYS_getgid) /* 47 */ IN_KERNEL_SYSCALL(utssys, SYS_utssys) /* 57 */ IN_KERNEL_SYSCALL(readlink, SYS_readlink) /* 90 */ +IN_KERNEL_SYSCALL(waitid, SYS_waitid) /* 107 */ /* * This table must have at least NSYSCALL entries in it. @@ -510,7 +511,7 @@ sn1_sysent_table_t sn1_sysent_table[] = { EMULATE(sn1_write, 3 | RV_DEFAULT), /* 4 */ NOSYS, /* 5 */ NOSYS, /* 6 */ - EMULATE(sn1_wait, 0 | RV_32RVAL2), /* 7 */ + NOSYS, /* 7 */ NOSYS, /* 8 */ NOSYS, /* 9 */ NOSYS, /* 10 */ @@ -610,7 +611,7 @@ sn1_sysent_table_t sn1_sysent_table[] = { NOSYS, /* 104 */ NOSYS, /* 105 */ NOSYS, /* 106 */ - NOSYS, /* 107 */ + EMULATE(sn1_waitid, 4 | RV_DEFAULT), /* 107 */ NOSYS, /* 108 */ NOSYS, /* 109 */ NOSYS, /* 110 */ diff --git a/usr/src/lib/brand/solaris10/s10_brand/Makefile.com b/usr/src/lib/brand/solaris10/s10_brand/Makefile.com index a57a9b3726..078dec2b6f 100644 --- a/usr/src/lib/brand/solaris10/s10_brand/Makefile.com +++ b/usr/src/lib/brand/solaris10/s10_brand/Makefile.com @@ -19,13 +19,13 @@ # CDDL HEADER END # # -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # LIBRARY = s10_brand.a VERS = .1 -COBJS = s10_brand.o +COBJS = s10_brand.o s10_deleted.o ASOBJS = s10_crt.o s10_handler.o s10_runexe.o OFFSETS_SRC = ../common/offsets.in OFFSETS_H = assym.h diff --git a/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c b/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c index d3b6955288..a5176e4179 100644 --- a/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c +++ b/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c @@ -18,6 +18,7 @@ * * CDDL HEADER END */ + /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -254,7 +255,7 @@ _s10_abort(int err, const char *msg, const char *file, int line) (void) __systemcall(&rval, SYS_lwp_kill + 1024, _lwp_self(), SIGKILL); } -static int +int s10_uucopy(const void *from, void *to, size_t size) { sysret_t rval; @@ -267,7 +268,7 @@ s10_uucopy(const void *from, void *to, size_t size) /* * ATTENTION: uucopystr() does NOT ensure that string are null terminated! */ -static int +int s10_uucopystr(const void *from, void *to, size_t size) { sysret_t rval; @@ -488,13 +489,13 @@ mntfs_ioctl(sysret_t *rval, int fdes, int cmd, intptr_t arg) struct mntentbuf *embufp; static size_t bufsize = MNT_LINE_MAX; - /* Do not emulate mntfs commands from up-to-date clients. */ if (S10_FEATURE_IS_PRESENT(S10_FEATURE_ALTERED_MNTFS_IOCTL)) return (__systemcall(rval, SYS_ioctl + 1024, fdes, cmd, arg)); /* Do not emulate mntfs commands directed at other file systems. */ - if ((err = __systemcall(rval, SYS_fstat + 1024, fdes, &statbuf)) != 0) + if ((err = __systemcall(rval, SYS_fstatat + 1024, + fdes, NULL, &statbuf, 0)) != 0) return (err); if (strcmp(statbuf.st_fstype, MNTTYPE_MNTFS) != 0) return (__systemcall(rval, SYS_ioctl + 1024, fdes, cmd, arg)); @@ -651,12 +652,13 @@ crypto_ioctl(sysret_t *rval, int fdes, int cmd, intptr_t arg) struct stat sbuf; if (crypto_dev == (dev_t)-1) { - if ((err = __systemcall(rval, SYS_stat + 1024, "/dev/crypto", - &sbuf)) != 0) + if ((err = __systemcall(rval, SYS_fstatat + 1024, + AT_FDCWD, "/dev/crypto", &sbuf, 0)) != 0) goto nonemuioctl; crypto_dev = major(sbuf.st_rdev); } - if ((err = __systemcall(rval, SYS_fstat + 1024, fdes, &sbuf)) != 0) + if ((err = __systemcall(rval, SYS_fstatat + 1024, + fdes, NULL, &sbuf, 0)) != 0) return (err); /* Each open fd of /dev/crypto gets a new minor device. */ if (major(sbuf.st_rdev) != crypto_dev) @@ -785,7 +787,8 @@ ctfs_ioctl(sysret_t *rval, int fdes, int cmd, intptr_t arg) ct_param_t param; struct stat statbuf; - if ((err = __systemcall(rval, SYS_fstat + 1024, fdes, &statbuf)) != 0) + if ((err = __systemcall(rval, SYS_fstatat + 1024, + fdes, NULL, &statbuf, 0)) != 0) return (err); if (strcmp(statbuf.st_fstype, MNTTYPE_CTFS) != 0) return (__systemcall(rval, SYS_ioctl + 1024, fdes, cmd, arg)); @@ -845,12 +848,13 @@ zfs_ioctl(sysret_t *rval, int fdes, int cmd, intptr_t arg) struct stat sbuf; if (zfs_dev == (dev_t)-1) { - if ((err = __systemcall(rval, SYS_stat + 1024, "/dev/zfs", - &sbuf)) != 0) + if ((err = __systemcall(rval, SYS_fstatat + 1024, + AT_FDCWD, "/dev/zfs", &sbuf, 0) != 0) != 0) goto nonemuioctl; zfs_dev = major(sbuf.st_rdev); } - if ((err = __systemcall(rval, SYS_fstat + 1024, fdes, &sbuf)) != 0) + if ((err = __systemcall(rval, SYS_fstatat + 1024, + fdes, NULL, &sbuf, 0)) != 0) return (err); if (major(sbuf.st_rdev) != zfs_dev) goto nonemuioctl; @@ -969,7 +973,7 @@ s10_pwrite(sysret_t *rval, int fd, const void *bufferp, size_t num_bytes, offset)); } -#ifndef _LP64 +#if !defined(_LP64) /* * This is the large file version of the pwrite() system call for 32-bit * processes. This exists for the same reason that s10_pwrite() exists; see @@ -1324,7 +1328,7 @@ s10_exec(sysret_t *rval, const char *fname, const char **argp) return (err); /* If an exec call succeeds, it never returns */ - err = __systemcall(rval, SYS_exec + 1024, fname, argp); + err = __systemcall(rval, SYS_execve + 1024, fname, argp, NULL); s10_assert(err != 0); return (err); } @@ -1437,8 +1441,8 @@ s10_sysinfo(sysret_t *rv, int command, char *buf, long count) return (0); } -#ifdef __x86 -#ifdef __amd64 +#if defined(__x86) +#if defined(__amd64) /* * 64-bit x86 LWPs created by SYS_lwp_create start here if they need to set * their %fs registers to the legacy Solaris 10 selector value. @@ -1539,6 +1543,7 @@ s10_lwp_create_correct_fs(sysret_t *rval, ucontext_t *ucp, int flags, */ if (s10_uucopy(ucp, &s10_uc, sizeof (s10_uc)) != 0) return (EFAULT); + s10_uc.uc_mcontext.gregs[REG_R14] = s10_uc.uc_mcontext.gregs[REG_RIP]; s10_uc.uc_mcontext.gregs[REG_RIP] = (greg_t)s10_lwp_create_entry_point; @@ -1575,7 +1580,7 @@ s10_lwp_create(sysret_t *rval, ucontext_t *ucp, int flags, id_t *new_lwp) static int s10_lwp_private(sysret_t *rval, int cmd, int which, uintptr_t base) { -#ifdef __amd64 +#if defined(__amd64) int err; /* @@ -1962,42 +1967,42 @@ s10_init(int argc, char *argv[], char *envp[]) s10_sysent_table_t s10_sysent_table[] = { #if defined(__sparc) && !defined(__sparcv9) EMULATE(s10_indir, 9 | RV_64RVAL), /* 0 */ -#else /* !__sparc || __sparcv9 */ +#else NOSYS, /* 0 */ -#endif /* !__sparc || __sparcv9 */ +#endif NOSYS, /* 1 */ - NOSYS, /* 2 */ + EMULATE(s10_forkall, 0 | RV_32RVAL2), /* 2 */ NOSYS, /* 3 */ NOSYS, /* 4 */ - NOSYS, /* 5 */ + EMULATE(s10_open, 3 | RV_DEFAULT), /* 5 */ NOSYS, /* 6 */ - NOSYS, /* 7 */ - NOSYS, /* 8 */ + EMULATE(s10_wait, 0 | RV_32RVAL2), /* 7 */ + EMULATE(s10_creat, 2 | RV_DEFAULT), /* 8 */ NOSYS, /* 9 */ - NOSYS, /* 10 */ + EMULATE(s10_unlink, 1 | RV_DEFAULT), /* 10 */ EMULATE(s10_exec, 2 | RV_DEFAULT), /* 11 */ NOSYS, /* 12 */ NOSYS, /* 13 */ NOSYS, /* 14 */ NOSYS, /* 15 */ - NOSYS, /* 16 */ + EMULATE(s10_chown, 3 | RV_DEFAULT), /* 16 */ NOSYS, /* 17 */ - NOSYS, /* 18 */ + EMULATE(s10_stat, 2 | RV_DEFAULT), /* 18 */ NOSYS, /* 19 */ NOSYS, /* 20 */ NOSYS, /* 21 */ - NOSYS, /* 22 */ + EMULATE(s10_umount, 1 | RV_DEFAULT), /* 22 */ NOSYS, /* 23 */ NOSYS, /* 24 */ NOSYS, /* 25 */ NOSYS, /* 26 */ NOSYS, /* 27 */ - NOSYS, /* 28 */ + EMULATE(s10_fstat, 2 | RV_DEFAULT), /* 28 */ NOSYS, /* 29 */ - NOSYS, /* 30 */ + EMULATE(s10_utime, 2 | RV_DEFAULT), /* 30 */ NOSYS, /* 31 */ NOSYS, /* 32 */ - NOSYS, /* 33 */ + EMULATE(s10_access, 2 | RV_DEFAULT), /* 33 */ NOSYS, /* 34 */ NOSYS, /* 35 */ NOSYS, /* 36 */ @@ -2005,7 +2010,7 @@ s10_sysent_table_t s10_sysent_table[] = { NOSYS, /* 38 */ NOSYS, /* 39 */ NOSYS, /* 40 */ - NOSYS, /* 41 */ + EMULATE(s10_dup, 1 | RV_DEFAULT), /* 41 */ NOSYS, /* 42 */ NOSYS, /* 43 */ NOSYS, /* 44 */ @@ -2040,10 +2045,10 @@ s10_sysent_table_t s10_sysent_table[] = { NOSYS, /* 73 */ NOSYS, /* 74 */ EMULATE(s10_issetugid, 0 | RV_DEFAULT), /* 75 */ - NOSYS, /* 76 */ + EMULATE(s10_fsat, 6 | RV_DEFAULT), /* 76 */ NOSYS, /* 77 */ NOSYS, /* 78 */ - NOSYS, /* 79 */ + EMULATE(s10_rmdir, 1 | RV_DEFAULT), /* 79 */ NOSYS, /* 80 */ EMULATE(s10_getdents, 3 | RV_DEFAULT), /* 81 */ NOSYS, /* 82 */ @@ -2051,14 +2056,14 @@ s10_sysent_table_t s10_sysent_table[] = { NOSYS, /* 84 */ NOSYS, /* 85 */ NOSYS, /* 86 */ - NOSYS, /* 87 */ - NOSYS, /* 88 */ + EMULATE(s10_poll, 3 | RV_DEFAULT), /* 87 */ + EMULATE(s10_lstat, 2 | RV_DEFAULT), /* 88 */ NOSYS, /* 89 */ NOSYS, /* 90 */ NOSYS, /* 91 */ NOSYS, /* 92 */ NOSYS, /* 93 */ - NOSYS, /* 94 */ + EMULATE(s10_fchown, 3 | RV_DEFAULT), /* 94 */ NOSYS, /* 95 */ NOSYS, /* 96 */ NOSYS, /* 97 */ @@ -2087,18 +2092,25 @@ s10_sysent_table_t s10_sysent_table[] = { NOSYS, /* 120 */ NOSYS, /* 121 */ NOSYS, /* 122 */ +#if defined(__x86) + EMULATE(s10_xstat, 3 | RV_DEFAULT), /* 123 */ + EMULATE(s10_lxstat, 3 | RV_DEFAULT), /* 124 */ + EMULATE(s10_fxstat, 3 | RV_DEFAULT), /* 125 */ + EMULATE(s10_xmknod, 4 | RV_DEFAULT), /* 126 */ +#else NOSYS, /* 123 */ NOSYS, /* 124 */ NOSYS, /* 125 */ NOSYS, /* 126 */ +#endif NOSYS, /* 127 */ NOSYS, /* 128 */ NOSYS, /* 129 */ - NOSYS, /* 130 */ + EMULATE(s10_lchown, 3 | RV_DEFAULT), /* 130 */ NOSYS, /* 131 */ NOSYS, /* 132 */ NOSYS, /* 133 */ - NOSYS, /* 134 */ + EMULATE(s10_rename, 2 | RV_DEFAULT), /* 134 */ EMULATE(s10_uname, 1 | RV_DEFAULT), /* 135 */ NOSYS, /* 136 */ NOSYS, /* 137 */ @@ -2107,18 +2119,18 @@ s10_sysent_table_t s10_sysent_table[] = { NOSYS, /* 140 */ NOSYS, /* 141 */ NOSYS, /* 142 */ - NOSYS, /* 143 */ + EMULATE(s10_fork1, 0 | RV_32RVAL2), /* 143 */ NOSYS, /* 144 */ NOSYS, /* 145 */ NOSYS, /* 146 */ - NOSYS, /* 147 */ + EMULATE(s10_lwp_sema_wait, 1 | RV_DEFAULT), /* 147 */ NOSYS, /* 148 */ NOSYS, /* 149 */ NOSYS, /* 150 */ NOSYS, /* 151 */ NOSYS, /* 152 */ NOSYS, /* 153 */ - NOSYS, /* 154 */ + EMULATE(s10_utimes, 2 | RV_DEFAULT), /* 154 */ NOSYS, /* 155 */ NOSYS, /* 156 */ NOSYS, /* 157 */ @@ -2134,14 +2146,14 @@ s10_sysent_table_t s10_sysent_table[] = { NOSYS, /* 163 */ NOSYS, /* 164 */ NOSYS, /* 165 */ -#ifdef __x86 +#if defined(__x86) EMULATE(s10_lwp_private, 3 | RV_DEFAULT), /* 166 */ -#else /* !__x86 */ +#else NOSYS, /* 166 */ -#endif /* !__x86 */ +#endif NOSYS, /* 167 */ NOSYS, /* 168 */ - NOSYS, /* 169 */ + EMULATE(s10_lwp_mutex_lock, 1 | RV_DEFAULT), /* 169 */ NOSYS, /* 170 */ NOSYS, /* 171 */ NOSYS, /* 172 */ @@ -2182,30 +2194,38 @@ s10_sysent_table_t s10_sysent_table[] = { NOSYS, /* 207 */ NOSYS, /* 208 */ NOSYS, /* 209 */ - EMULATE(s10_lwp_mutex_timedlock, 2 | RV_DEFAULT), /* 210 */ + EMULATE(s10_lwp_mutex_timedlock, 2 | RV_DEFAULT), /* 210 */ NOSYS, /* 211 */ NOSYS, /* 212 */ -#ifdef _LP64 +#if defined(_LP64) NOSYS, /* 213 */ -#else /* !_LP64 */ +#else EMULATE(s10_getdents64, 3 | RV_DEFAULT), /* 213 */ -#endif /* !_LP64 */ +#endif NOSYS, /* 214 */ +#if defined(_LP64) NOSYS, /* 215 */ NOSYS, /* 216 */ NOSYS, /* 217 */ +#else + EMULATE(s10_stat64, 2 | RV_DEFAULT), /* 215 */ + EMULATE(s10_lstat64, 2 | RV_DEFAULT), /* 216 */ + EMULATE(s10_fstat64, 2 | RV_DEFAULT), /* 217 */ +#endif NOSYS, /* 218 */ NOSYS, /* 219 */ NOSYS, /* 220 */ NOSYS, /* 221 */ NOSYS, /* 222 */ -#ifdef _LP64 +#if defined(_LP64) NOSYS, /* 223 */ -#else /* !_LP64 */ - EMULATE(s10_pwrite64, 5 | RV_DEFAULT), /* 223 */ -#endif /* !_LP64 */ NOSYS, /* 224 */ NOSYS, /* 225 */ +#else + EMULATE(s10_pwrite64, 5 | RV_DEFAULT), /* 223 */ + EMULATE(s10_creat64, 2 | RV_DEFAULT), /* 224 */ + EMULATE(s10_open64, 3 | RV_DEFAULT), /* 225 */ +#endif NOSYS, /* 226 */ EMULATE(s10_zone, 5 | RV_DEFAULT), /* 227 */ NOSYS, /* 228 */ @@ -2231,7 +2251,7 @@ s10_sysent_table_t s10_sysent_table[] = { NOSYS, /* 248 */ NOSYS, /* 249 */ NOSYS, /* 250 */ - EMULATE(s10_lwp_mutex_trylock, 1 | RV_DEFAULT), /* 251 */ + EMULATE(s10_lwp_mutex_trylock, 1 | RV_DEFAULT), /* 251 */ NOSYS, /* 252 */ NOSYS, /* 253 */ NOSYS, /* 254 */ diff --git a/usr/src/lib/brand/solaris10/s10_brand/common/s10_deleted.c b/usr/src/lib/brand/solaris10/s10_brand/common/s10_deleted.c new file mode 100644 index 0000000000..fd8f6e4543 --- /dev/null +++ b/usr/src/lib/brand/solaris10/s10_brand/common/s10_deleted.c @@ -0,0 +1,529 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <fcntl.h> +#include <utime.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/siginfo.h> +#include <sys/time.h> +#include <sys/poll.h> +#include <sys/wait.h> +#include <sys/file.h> +#include <sys/syscall.h> + +#include <s10_brand.h> +#include <s10_misc.h> + +/* + * This file contains the emulation functions for all of the + * obsolete system call traps that existed in Solaris 10 but + * that have been deleted in the current version of Solaris. + */ + +static int +s10_fstatat(sysret_t *rval, + int fd, const char *path, struct stat *sb, int flags) +{ + return (__systemcall(rval, SYS_fstatat + 1024, + fd, path, sb, flags)); +} + +int +s10_stat(sysret_t *rval, const char *path, struct stat *sb) +{ + return (__systemcall(rval, SYS_fstatat + 1024, + AT_FDCWD, path, sb, 0)); +} + +int +s10_lstat(sysret_t *rval, const char *path, struct stat *sb) +{ + return (__systemcall(rval, SYS_fstatat + 1024, + AT_FDCWD, path, sb, AT_SYMLINK_NOFOLLOW)); +} + +int +s10_fstat(sysret_t *rval, int filedes, struct stat *sb) +{ + return (__systemcall(rval, SYS_fstatat + 1024, + filedes, NULL, sb, 0)); +} + +#if !defined(_LP64) + +static int +s10_fstatat64(sysret_t *rval, + int fd, const char *path, struct stat64 *sb, int flags) +{ + return (__systemcall(rval, SYS_fstatat64 + 1024, + fd, path, sb, flags)); +} + +int +s10_stat64(sysret_t *rval, const char *path, struct stat64 *sb) +{ + return (__systemcall(rval, SYS_fstatat64 + 1024, + AT_FDCWD, path, sb, 0)); +} + +int +s10_lstat64(sysret_t *rval, const char *path, struct stat64 *sb) +{ + return (__systemcall(rval, SYS_fstatat64 + 1024, + AT_FDCWD, path, sb, AT_SYMLINK_NOFOLLOW)); +} + +int +s10_fstat64(sysret_t *rval, int filedes, struct stat64 *sb) +{ + return (__systemcall(rval, SYS_fstatat64 + 1024, + filedes, NULL, sb, 0)); +} + +#endif /* !_LP64 */ + +static int +s10_openat(sysret_t *rval, int fd, const char *path, int oflag, mode_t mode) +{ + return (__systemcall(rval, SYS_openat + 1024, + fd, path, oflag, mode)); +} + +int +s10_open(sysret_t *rval, char *path, int oflag, mode_t mode) +{ + return (__systemcall(rval, SYS_openat + 1024, + AT_FDCWD, path, oflag, mode)); +} + +int +s10_creat(sysret_t *rval, char *path, mode_t mode) +{ + return (__systemcall(rval, SYS_openat + 1024, + AT_FDCWD, path, O_WRONLY | O_CREAT | O_TRUNC, mode)); +} + +#if !defined(_LP64) + +static int +s10_openat64(sysret_t *rval, int fd, const char *path, int oflag, mode_t mode) +{ + return (__systemcall(rval, SYS_openat64 + 1024, + fd, path, oflag, mode)); +} + +int +s10_open64(sysret_t *rval, char *path, int oflag, mode_t mode) +{ + return (__systemcall(rval, SYS_openat64 + 1024, + AT_FDCWD, path, oflag, mode)); +} + +int +s10_creat64(sysret_t *rval, char *path, mode_t mode) +{ + return (__systemcall(rval, SYS_openat64 + 1024, + AT_FDCWD, path, O_WRONLY | O_CREAT | O_TRUNC, mode)); +} + +#endif /* !_LP64 */ + +int +s10_fork1(sysret_t *rval) +{ + return (__systemcall(rval, SYS_forksys + 1024, 0, 0)); +} + +int +s10_forkall(sysret_t *rval) +{ + return (__systemcall(rval, SYS_forksys + 1024, 1, 0)); +} + +int +s10_dup(sysret_t *rval, int fd) +{ + return (__systemcall(rval, SYS_fcntl + 1024, fd, F_DUPFD, 0)); +} + +int +s10_poll(sysret_t *rval, struct pollfd *fds, nfds_t nfd, int timeout) +{ + timespec_t ts; + timespec_t *tsp; + + if (timeout < 0) + tsp = NULL; + else { + ts.tv_sec = timeout / MILLISEC; + ts.tv_nsec = (timeout % MILLISEC) * MICROSEC; + tsp = &ts; + } + + return (__systemcall(rval, SYS_pollsys + 1024, + fds, nfd, tsp, NULL)); +} + +int +s10_lwp_mutex_lock(sysret_t *rval, void *mp) +{ + return (__systemcall(rval, SYS_lwp_mutex_timedlock + 1024, + mp, NULL, 0)); +} + +int +s10_lwp_sema_wait(sysret_t *rval, void *sp) +{ + return (__systemcall(rval, SYS_lwp_sema_timedwait + 1024, + sp, NULL, 0)); +} + +static int +s10_fchownat(sysret_t *rval, + int fd, const char *name, uid_t uid, gid_t gid, int flags) +{ + return (__systemcall(rval, SYS_fchownat + 1024, + fd, name, uid, gid, flags)); +} + +int +s10_chown(sysret_t *rval, const char *name, uid_t uid, gid_t gid) +{ + return (__systemcall(rval, SYS_fchownat + 1024, + AT_FDCWD, name, uid, gid, 0)); +} + +int +s10_lchown(sysret_t *rval, const char *name, uid_t uid, gid_t gid) +{ + return (__systemcall(rval, SYS_fchownat + 1024, + AT_FDCWD, name, uid, gid, AT_SYMLINK_NOFOLLOW)); +} + +int +s10_fchown(sysret_t *rval, int filedes, uid_t uid, gid_t gid) +{ + return (__systemcall(rval, SYS_fchownat + 1024, + filedes, NULL, uid, gid, 0)); +} + +static int +s10_unlinkat(sysret_t *rval, int fd, const char *name, int flags) +{ + return (__systemcall(rval, SYS_unlinkat + 1024, + fd, name, flags)); +} + +int +s10_unlink(sysret_t *rval, const char *name) +{ + return (__systemcall(rval, SYS_unlinkat + 1024, + AT_FDCWD, name, 0)); +} + +int +s10_rmdir(sysret_t *rval, const char *name) +{ + return (__systemcall(rval, SYS_unlinkat + 1024, + AT_FDCWD, name, AT_REMOVEDIR)); +} + +static int +s10_renameat(sysret_t *rval, + int oldfd, const char *oldname, int newfd, const char *newname) +{ + return (__systemcall(rval, SYS_renameat + 1024, + oldfd, oldname, newfd, newname)); +} + +int +s10_rename(sysret_t *rval, const char *oldname, const char *newname) +{ + return (__systemcall(rval, SYS_renameat + 1024, + AT_FDCWD, oldname, AT_FDCWD, newname)); +} + +static int +s10_faccessat(sysret_t *rval, int fd, const char *fname, int amode, int flag) +{ + return (__systemcall(rval, SYS_faccessat + 1024, + fd, fname, amode, flag)); +} + +int +s10_access(sysret_t *rval, const char *fname, int amode) +{ + return (__systemcall(rval, SYS_faccessat + 1024, + AT_FDCWD, fname, amode, 0)); +} + +int +s10_utime(sysret_t *rval, const char *path, const struct utimbuf *times) +{ + struct utimbuf ltimes; + timespec_t ts[2]; + timespec_t *tsp; + + if (times == NULL) { + tsp = NULL; + } else { + if (s10_uucopy(times, <imes, sizeof (ltimes)) != 0) + return (EFAULT); + ts[0].tv_sec = ltimes.actime; + ts[0].tv_nsec = 0; + ts[1].tv_sec = ltimes.modtime; + ts[1].tv_nsec = 0; + tsp = ts; + } + + return (__systemcall(rval, SYS_utimesys + 1024, 1, + AT_FDCWD, path, tsp, 0)); +} + +int +s10_utimes(sysret_t *rval, const char *path, const struct timeval times[2]) +{ + struct timeval ltimes[2]; + timespec_t ts[2]; + timespec_t *tsp; + + if (times == NULL) { + tsp = NULL; + } else { + if (s10_uucopy(times, ltimes, sizeof (ltimes)) != 0) + return (EFAULT); + ts[0].tv_sec = ltimes[0].tv_sec; + ts[0].tv_nsec = ltimes[0].tv_usec * 1000; + ts[1].tv_sec = ltimes[1].tv_sec; + ts[1].tv_nsec = ltimes[1].tv_usec * 1000; + tsp = ts; + } + + return (__systemcall(rval, SYS_utimesys + 1024, 1, + AT_FDCWD, path, tsp, 0)); +} + +static int +s10_futimesat(sysret_t *rval, + int fd, const char *path, const struct timeval times[2]) +{ + struct timeval ltimes[2]; + timespec_t ts[2]; + timespec_t *tsp; + + if (times == NULL) { + tsp = NULL; + } else { + if (s10_uucopy(times, ltimes, sizeof (ltimes)) != 0) + return (EFAULT); + ts[0].tv_sec = ltimes[0].tv_sec; + ts[0].tv_nsec = ltimes[0].tv_usec * 1000; + ts[1].tv_sec = ltimes[1].tv_sec; + ts[1].tv_nsec = ltimes[1].tv_usec * 1000; + tsp = ts; + } + + if (path == NULL) + return (__systemcall(rval, SYS_utimesys + 1024, 0, fd, tsp)); + + return (__systemcall(rval, SYS_utimesys + 1024, 1, fd, path, tsp, 0)); +} + +#if defined(__x86) + +/* ARGSUSED */ +int +s10_xstat(sysret_t *rval, int version, const char *path, struct stat *statb) +{ +#if defined(__amd64) + return (EINVAL); +#else + if (version != _STAT_VER) + return (EINVAL); + return (__systemcall(rval, SYS_fstatat + 1024, + AT_FDCWD, path, statb, 0)); +#endif +} + +/* ARGSUSED */ +int +s10_lxstat(sysret_t *rval, int version, const char *path, struct stat *statb) +{ +#if defined(__amd64) + return (EINVAL); +#else + if (version != _STAT_VER) + return (EINVAL); + return (__systemcall(rval, SYS_fstatat + 1024, + AT_FDCWD, path, statb, AT_SYMLINK_NOFOLLOW)); +#endif +} + +/* ARGSUSED */ +int +s10_fxstat(sysret_t *rval, int version, int fd, struct stat *statb) +{ +#if defined(__amd64) + return (EINVAL); +#else + if (version != _STAT_VER) + return (EINVAL); + return (__systemcall(rval, SYS_fstatat + 1024, + fd, NULL, statb, 0)); +#endif +} + +/* ARGSUSED */ +int +s10_xmknod(sysret_t *rval, int version, const char *path, + mode_t mode, dev_t dev) +{ +#if defined(__amd64) + return (EINVAL); +#else + if (version != _MKNOD_VER) + return (EINVAL); + return (__systemcall(rval, SYS_mknod + 1024, path, mode, dev)); +#endif +} + +#endif /* __x86 */ + +/* + * This is the fsat() system call trap in s10. + * It has been removed in the current system. + */ +int +s10_fsat(sysret_t *rval, + int code, uintptr_t arg1, uintptr_t arg2, + uintptr_t arg3, uintptr_t arg4, uintptr_t arg5) +{ + switch (code) { + case 0: /* openat */ + return (s10_openat(rval, (int)arg1, + (const char *)arg2, (int)arg3, (mode_t)arg4)); + case 1: /* openat64 */ +#if defined(_LP64) + return (EINVAL); +#else + return (s10_openat64(rval, (int)arg1, + (const char *)arg2, (int)arg3, (mode_t)arg4)); +#endif + case 2: /* fstatat64 */ +#if defined(_LP64) + return (EINVAL); +#else + return (s10_fstatat64(rval, (int)arg1, + (const char *)arg2, (struct stat64 *)arg3, (int)arg4)); +#endif + case 3: /* fstatat */ + return (s10_fstatat(rval, (int)arg1, + (const char *)arg2, (struct stat *)arg3, (int)arg4)); + case 4: /* fchownat */ + return (s10_fchownat(rval, (int)arg1, (char *)arg2, + (uid_t)arg3, (gid_t)arg4, (int)arg5)); + case 5: /* unlinkat */ + return (s10_unlinkat(rval, (int)arg1, (char *)arg2, + (int)arg3)); + case 6: /* futimesat */ + return (s10_futimesat(rval, (int)arg1, + (const char *)arg2, (const struct timeval *)arg3)); + case 7: /* renameat */ + return (s10_renameat(rval, (int)arg1, (char *)arg2, + (int)arg3, (char *)arg4)); + case 8: /* faccessat */ + return (s10_faccessat(rval, (int)arg1, (char *)arg2, + (int)arg3, (int)arg4)); + case 9: /* openattrdirat */ + return (s10_openat(rval, (int)arg1, + (const char *)arg2, FXATTRDIROPEN, 0)); + } + return (EINVAL); +} + +/* + * Interposition upon SYS_umount + */ +int +s10_umount(sysret_t *rval, const char *path) +{ + return (__systemcall(rval, SYS_umount2 + 1024, path, 0)); +} + +/* + * Convert the siginfo_t code and status fields to an old style + * wait status for s10_wait(), below. + */ +static int +wstat(int code, int status) +{ + int stat = (status & 0377); + + switch (code) { + case CLD_EXITED: + stat <<= 8; + break; + case CLD_DUMPED: + stat |= WCOREFLG; + break; + case CLD_KILLED: + break; + case CLD_TRAPPED: + case CLD_STOPPED: + stat <<= 8; + stat |= WSTOPFLG; + break; + case CLD_CONTINUED: + stat = WCONTFLG; + break; + } + return (stat); +} + +/* + * Interposition upon SYS_wait + */ +int +s10_wait(sysret_t *rval) +{ + int err; + siginfo_t info; + + err = __systemcall(rval, SYS_waitid + 1024, + P_ALL, 0, &info, WEXITED | WTRAPPED); + if (err != 0) + return (err); + + rval->sys_rval1 = info.si_pid; + rval->sys_rval2 = wstat(info.si_code, info.si_status); + + return (0); +} diff --git a/usr/src/lib/brand/solaris10/s10_brand/sys/s10_misc.h b/usr/src/lib/brand/solaris10/s10_brand/sys/s10_misc.h index 926873347f..35874b4c9d 100644 --- a/usr/src/lib/brand/solaris10/s10_brand/sys/s10_misc.h +++ b/usr/src/lib/brand/solaris10/s10_brand/sys/s10_misc.h @@ -190,6 +190,44 @@ extern void s10_success(void); * From s10_brand.c */ extern void _s10_abort(int, const char *, const char *, int); +extern int s10_uucopy(const void *, void *, size_t); +extern int s10_uucopystr(const void *, void *, size_t); + +/* + * From s10_deleted.c + */ +extern int s10_stat(); +extern int s10_lstat(); +extern int s10_fstat(); +extern int s10_stat64(); +extern int s10_lstat64(); +extern int s10_fstat64(); +extern int s10_open(); +extern int s10_open64(); +extern int s10_chown(); +extern int s10_lchown(); +extern int s10_fchown(); +extern int s10_unlink(); +extern int s10_rmdir(); +extern int s10_rename(); +extern int s10_access(); +extern int s10_creat(); +extern int s10_creat64(); +extern int s10_fork1(); +extern int s10_forkall(); +extern int s10_dup(); +extern int s10_poll(); +extern int s10_lwp_mutex_lock(); +extern int s10_lwp_sema_wait(); +extern int s10_utime(); +extern int s10_utimes(); +extern int s10_xstat(); +extern int s10_lxstat(); +extern int s10_fxstat(); +extern int s10_xmknod(); +extern int s10_fsat(); +extern int s10_umount(); +extern int s10_wait(); #endif /* !_ASM */ diff --git a/usr/src/lib/libbc/inc/include/sys/fcntlcom.h b/usr/src/lib/libbc/inc/include/sys/fcntlcom.h index a1e41ac9c7..8a843c900f 100644 --- a/usr/src/lib/libbc/inc/include/sys/fcntlcom.h +++ b/usr/src/lib/libbc/inc/include/sys/fcntlcom.h @@ -1,6 +1,27 @@ /* - * Copyright (c) 1998,2001 by Sun Microsystems, Inc. - * All rights reserved. + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ /* @@ -12,8 +33,6 @@ #ifndef __SYS_FCNTLCOM_H #define __SYS_FCNTLCOM_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -123,6 +142,11 @@ extern "C" { #define F_UNLKSYS 4 /* remove remote locks for a given system */ #endif /* !_POSIX_SOURCE */ +/* needed for _syscall(SYS_openat, AT_FDCWD, ...) */ +#define AT_FDCWD 0xffd19553 +#define AT_SYMLINK_NOFOLLOW 0x1000 +#define AT_REMOVEDIR 0x1 + #include <sys/stdtypes.h> /* file segment locking set data type - information passed to system by user */ diff --git a/usr/src/lib/libbc/libc/gen/common/ttyslot.c b/usr/src/lib/libbc/libc/gen/common/ttyslot.c index a52c786938..24a132f4f1 100644 --- a/usr/src/lib/libbc/libc/gen/common/ttyslot.c +++ b/usr/src/lib/libbc/libc/gen/common/ttyslot.c @@ -1,5 +1,26 @@ /* - * Copyright 1991 Sun Microsystems, Inc. All rights reserved. + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -9,8 +30,6 @@ * specifies the terms and conditions for redistribution. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Return the number of the slot in the utmp file * corresponding to the current user: try for file 0, 1, 2. @@ -39,23 +58,24 @@ ttyslot(void) if ((tp = ttyname(0)) == NULL && (tp = ttyname(1)) == NULL && (tp = ttyname(2)) == NULL) - return(0); + return (0); if ((p = rindex(tp, '/')) == NULL) p = tp; else p++; - if ((fd = _syscall(SYS_open, "/etc/utmpx", O_RDONLY)) == -1) { + if ((fd = _syscall(SYS_openat, + AT_FDCWD, "/etc/utmpx", O_RDONLY)) == -1) { perror("ttyslot: open of /etc/utmpx failed:"); - return(0); + return (0); } s = 0; - while (_read(fd, &utx, sizeof(struct utmpx)) > 0) { + while (_read(fd, &utx, sizeof (struct utmpx)) > 0) { s++; - if (strncmp(utx.ut_line, p, sizeof(utx.ut_line)) == 0) { + if (strncmp(utx.ut_line, p, sizeof (utx.ut_line)) == 0) { _syscall(SYS_close, fd); - return(s); + return (s); } } _syscall(SYS_close, fd); diff --git a/usr/src/lib/libbc/libc/sys/4.2/chown.c b/usr/src/lib/libbc/libc/sys/4.2/chown.c index 7294a433f4..4071372779 100644 --- a/usr/src/lib/libbc/libc/sys/4.2/chown.c +++ b/usr/src/lib/libbc/libc/sys/4.2/chown.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,18 +18,19 @@ * * CDDL HEADER END */ + /* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "chkpath.h" +#include <sys/syscall.h> +#include <sys/fcntl.h> int chown(char *s, int u, int g) { CHKNULL(s); - return (_syscall(SYS_lchown, s, u, g)); + return (_syscall(SYS_fchownat, AT_FDCWD, s, u, g, AT_SYMLINK_NOFOLLOW)); } diff --git a/usr/src/lib/libbc/libc/sys/4.2/execve.c b/usr/src/lib/libbc/libc/sys/4.2/execve.c index ff971dac7a..8851439266 100644 --- a/usr/src/lib/libbc/libc/sys/4.2/execve.c +++ b/usr/src/lib/libbc/libc/sys/4.2/execve.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "chkpath.h" #include <string.h> #include <sys/file.h> @@ -40,7 +38,7 @@ execve(char *file, char **argv, char **arge) CHKNULL(file); if (strncmp(file, "/usr/ucb", strlen("/usr/ucb")) == 0) { - if (_syscall(SYS_access, file, F_OK) == -1) { + if (_syscall(SYS_faccessat, AT_FDCWD, file, F_OK, 0) == -1) { strcpy(path, "/usr/bin"); strcat(path, strrchr(file, '/')); file = path; @@ -50,18 +48,19 @@ execve(char *file, char **argv, char **arge) strncmp(file, "/usr/bin", strlen("/usr/bin")) == 0) { strcpy(path, "/usr/ucb"); strcat(path, strrchr(file, '/')); - if (_syscall(SYS_access, path, F_OK) == 0) + if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) == 0) file = path; } else if (strncmp(file, "/usr/5bin", strlen("/usr/5bin")) == 0) { strcpy(path, "/usr/bin"); strcat(path, strrchr(file, '/')); - if (_syscall(SYS_access, path, F_OK) == 0) + if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) == 0) file = path; else { strcpy(path, "/usr/ucb"); strcat(path, strrchr(file, '/')); - if (_syscall(SYS_access, path, F_OK) == 0) + if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) + == 0) file = path; } } diff --git a/usr/src/lib/libbc/libc/sys/4.2/rename.c b/usr/src/lib/libbc/libc/sys/4.2/rename.c index bb381e3d13..222765f133 100644 --- a/usr/src/lib/libbc/libc/sys/4.2/rename.c +++ b/usr/src/lib/libbc/libc/sys/4.2/rename.c @@ -20,14 +20,13 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "chkpath.h" #include <sys/syscall.h> +#include <sys/fcntl.h> int rename(char *path1, char *path2) @@ -55,5 +54,5 @@ rename(char *path1, char *path2) path2 = buf2; } - return (_syscall(SYS_rename, path1, path2)); + return (_syscall(SYS_renameat, AT_FDCWD, path1, AT_FDCWD, path2)); } diff --git a/usr/src/lib/libbc/libc/sys/4.2/rmdir.c b/usr/src/lib/libbc/libc/sys/4.2/rmdir.c index 6872b4dcb5..620d8a3d35 100644 --- a/usr/src/lib/libbc/libc/sys/4.2/rmdir.c +++ b/usr/src/lib/libbc/libc/sys/4.2/rmdir.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,14 +18,14 @@ * * CDDL HEADER END */ + /* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "chkpath.h" +#include <sys/fcntl.h> int rmdir(char *d) @@ -34,7 +33,7 @@ rmdir(char *d) int ret; CHKNULL(d); - ret = _syscall(SYS_rmdir, d); + ret = _syscall(SYS_unlinkat, AT_FDCWD, d, AT_REMOVEDIR); if (errno == EEXIST) errno = ENOTEMPTY; return (ret); diff --git a/usr/src/lib/libbc/libc/sys/4.2/stat.c b/usr/src/lib/libbc/libc/sys/4.2/stat.c index dc930d2c16..b546568f8c 100644 --- a/usr/src/lib/libbc/libc/sys/4.2/stat.c +++ b/usr/src/lib/libbc/libc/sys/4.2/stat.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "chkpath.h" #include <sys/stat.h> @@ -51,7 +49,7 @@ struct stat *buf; errno = EFAULT; return (-1); } - return(stat_com(SYS_stat, path, buf)); + return(stat_com(0, path, buf)); } @@ -67,6 +65,6 @@ char *path; struct stat *buf; { CHKNULL(path); - return(stat_com(SYS_lstat, path, buf)); + return(stat_com(1, path, buf)); } diff --git a/usr/src/lib/libbc/libc/sys/4.2/unlink.c b/usr/src/lib/libbc/libc/sys/4.2/unlink.c index 0a8d8a694c..9825d5e502 100644 --- a/usr/src/lib/libbc/libc/sys/4.2/unlink.c +++ b/usr/src/lib/libbc/libc/sys/4.2/unlink.c @@ -20,17 +20,16 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "chkpath.h" #include <sys/syscall.h> +#include <sys/fcntl.h> int -unlink(char *path) +unlink(const char *path) { CHKNULL(path); @@ -40,5 +39,5 @@ unlink(char *path) else if (strcmp(path, "/var/adm/wtmp") == 0) path = "/var/adm/wtmpx"; - return (_syscall(SYS_unlink, path)); + return (_syscall(SYS_unlinkat, AT_FDCWD, path, 0)); } diff --git a/usr/src/lib/libbc/libc/sys/common/_access.c b/usr/src/lib/libbc/libc/sys/common/_access.c index 28737c88c0..5adea56e64 100644 --- a/usr/src/lib/libbc/libc/sys/common/_access.c +++ b/usr/src/lib/libbc/libc/sys/common/_access.c @@ -20,13 +20,12 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/syscall.h> +#include <sys/fcntl.h> #include <unistd.h> #include <sys/param.h> @@ -47,5 +46,5 @@ access_com(char *path, int mode) else if (strcmp(path, "/var/adm/wtmp") == 0) path = "/var/adm/wtmpx"; - return (_syscall(SYS_access, path, mode)); + return (_syscall(SYS_faccessat, AT_FDCWD, path, mode, 0)); } diff --git a/usr/src/lib/libbc/libc/sys/common/_creat.c b/usr/src/lib/libbc/libc/sys/common/_creat.c index 3a91013eb4..54477b35bf 100644 --- a/usr/src/lib/libbc/libc/sys/common/_creat.c +++ b/usr/src/lib/libbc/libc/sys/common/_creat.c @@ -20,18 +20,19 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/syscall.h> #include <unistd.h> +#include <fcntl.h> #include <errno.h> #include <sys/param.h> #include "compat.h" /* for UTMPX_MAGIC_FLAG */ +#define CREATFLAGS (O_WRONLY | O_CREAT | O_TRUNC) + int creat_com(char *path, int mode) { @@ -43,15 +44,17 @@ creat_com(char *path, int mode) return (-1); } if (strcmp(path, "/var/adm/wtmp") == 0) { - if ((fd = _syscall(SYS_creat, "/var/adm/wtmpx", mode)) >= 0) + if ((fd = _syscall(SYS_openat, AT_FDCWD, + "/var/adm/wtmpx", CREATFLAGS, mode)) >= 0) fd_add(fd, UTMPX_MAGIC_FLAG); return (fd); } if (strcmp(path, "/etc/utmp") == 0 || strcmp(path, "/var/adm/utmp") == 0) { - if ((fd = _syscall(SYS_creat, "/var/adm/utmpx", mode)) >= 0) + if ((fd = _syscall(SYS_openat, AT_FDCWD, + "/var/adm/utmpx", CREATFLAGS, mode)) >= 0) fd_add(fd, UTMPX_MAGIC_FLAG); return (fd); } - return (_syscall(SYS_creat, path, mode)); + return (_syscall(SYS_openat, AT_FDCWD, path, CREATFLAGS, mode)); } diff --git a/usr/src/lib/libbc/libc/sys/common/_open.c b/usr/src/lib/libbc/libc/sys/common/_open.c index 139135e32a..5cde96fb2b 100644 --- a/usr/src/lib/libbc/libc/sys/common/_open.c +++ b/usr/src/lib/libbc/libc/sys/common/_open.c @@ -20,12 +20,10 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <fcntl.h> #include <string.h> @@ -104,7 +102,7 @@ open_com(char *path, int flags, int mode) locbuf[inspt] = '\0'; /* make it a string */ strcat(locbuf, "old"); /* add "old" */ strcat(locbuf, loct+5); /* add remainer of path */ - return (_syscall(SYS_open, locbuf, nflags, mode)); + return (_syscall(SYS_openat, AT_FDCWD, locbuf, nflags, mode)); } if (strcmp(path, "/etc/mtab") == 0) @@ -114,27 +112,30 @@ open_com(char *path, int flags, int mode) return (open_mnt("/etc/vfstab", "fstab", nflags, mode)); if (strcmp(path, "/etc/printcap") == 0) { - if ((fd = _syscall(SYS_open, path, nflags, mode)) >= 0) + if ((fd = _syscall(SYS_openat, AT_FDCWD, path, nflags, mode)) + >= 0) return (fd); return (open_printcap()); } if (strcmp(path, "/etc/utmp") == 0 || strcmp(path, "/var/adm/utmp") == 0) { - fd = _syscall(SYS_open, "/var/adm/utmpx", nflags, mode); + fd = _syscall(SYS_openat, + AT_FDCWD, "/var/adm/utmpx", nflags, mode); if (fd >= 0) fd_add(fd, UTMPX_MAGIC_FLAG); return (fd); } if (strcmp(path, "/var/adm/wtmp") == 0) { - fd = _syscall(SYS_open, "/var/adm/wtmpx", nflags, mode); + fd = _syscall(SYS_openat, + AT_FDCWD, "/var/adm/wtmpx", nflags, mode); if (fd >= 0) fd_add(fd, UTMPX_MAGIC_FLAG); return (fd); } - return (_syscall(SYS_open, path, nflags, mode)); + return (_syscall(SYS_openat, AT_FDCWD, path, nflags, mode)); } int @@ -177,7 +178,7 @@ open_mnt(char *fname, char *tname, int flags, int mode) fclose(fd_in); fclose(fd_out); - fd = _syscall(SYS_open, tmp_name, O_RDONLY); + fd = _syscall(SYS_openat, AT_FDCWD, tmp_name, O_RDONLY); if (fd == -1 || unlink(tmp_name) == -1) return (-1); @@ -318,7 +319,7 @@ _fopen(char *file, char *mode) default: return (NULL); } - if ((fd = _syscall(SYS_open, file, oflag, 0666)) < 0) + if ((fd = _syscall(SYS_openat, AT_FDCWD, file, oflag, 0666)) < 0) return (NULL); iop->_cnt = 0; iop->_file = fd; @@ -357,7 +358,7 @@ open_printcap(void) } fclose(fd); - tmp_file = _syscall(SYS_open, tmp_name, O_RDONLY); + tmp_file = _syscall(SYS_openat, AT_FDCWD, tmp_name, O_RDONLY); if (tmp_file == -1 || unlink(tmp_name) == -1) return (-1); @@ -380,7 +381,8 @@ getPrinterInfo(char *printerName, FILE *fd) strcat(fullPath, printerName); strcat(fullPath, PRINTER_CONFIG_FILE); - if ((config_fd = _syscall(SYS_open, fullPath, O_RDONLY)) == -1) { + if ((config_fd = _syscall(SYS_openat, AT_FDCWD, fullPath, O_RDONLY)) + == -1) { free(fullPath); return; } diff --git a/usr/src/lib/libbc/libc/sys/common/_stat.c b/usr/src/lib/libbc/libc/sys/common/_stat.c index b9c1ab3580..b3d88cccfb 100644 --- a/usr/src/lib/libbc/libc/sys/common/_stat.c +++ b/usr/src/lib/libbc/libc/sys/common/_stat.c @@ -20,12 +20,10 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/errno.h> #include <sys/syscall.h> #include <sys/fcntl.h> @@ -83,7 +81,7 @@ bc_fstat(int fd, struct stat *buf) return (-1); } - if ((ret = _syscall(SYS_fstat, fd, &nb)) == -1) + if ((ret = _syscall(SYS_fstatat, fd, NULL, &nb, 0)) == -1) return (ret); cpstatbuf(buf, &nb); @@ -96,10 +94,11 @@ bc_fstat(int fd, struct stat *buf) } int -stat_com(int sysnum, char *path, struct stat *buf) +stat_com(int lstat, char *path, struct stat *buf) { int fd, ret; struct n_stat nb; + int follow = lstat? AT_SYMLINK_NOFOLLOW : 0; if (strcmp(path, "/etc/mtab") == 0) { /* @@ -115,7 +114,7 @@ stat_com(int sysnum, char *path, struct stat *buf) * close(fd); * return(ret); */ - ret = stat_com(sysnum, "/etc/mnttab", buf); + ret = stat_com(lstat, "/etc/mnttab", buf); return(ret); } if (strcmp(path, "/etc/fstab") == 0) { @@ -130,7 +129,8 @@ stat_com(int sysnum, char *path, struct stat *buf) } if (strcmp(path, "/etc/utmp") == 0 || strcmp(path, "/var/adm/utmp") == 0) { - if ((ret = _syscall(sysnum, "/var/adm/utmpx", &nb)) != -1) { + if ((ret = _syscall(SYS_fstatat, AT_FDCWD, + "/var/adm/utmpx", &nb, follow)) != -1) { cpstatbuf(buf, &nb); buf->st_size = getmodsize(buf->st_size, sizeof(struct utmpx), sizeof(struct compat_utmp)); @@ -138,7 +138,8 @@ stat_com(int sysnum, char *path, struct stat *buf) return(ret); } if (strcmp(path, "/var/adm/wtmp") == 0) { - if ((ret = _syscall(sysnum, "/var/adm/wtmpx", &nb)) != -1) { + if ((ret = _syscall(SYS_fstatat, AT_FDCWD, + "/var/adm/wtmpx", &nb, follow)) != -1) { cpstatbuf(buf, &nb); buf->st_size = getmodsize(buf->st_size, sizeof(struct utmpx), sizeof(struct compat_utmp)); @@ -156,7 +157,7 @@ stat_com(int sysnum, char *path, struct stat *buf) return(ret); } - if ((ret = _syscall(sysnum, path, &nb)) != -1) + if ((ret = _syscall(SYS_fstatat, AT_FDCWD, path, &nb, follow)) != -1) cpstatbuf(buf, &nb); return(ret); } diff --git a/usr/src/lib/libbc/libc/sys/common/dup.c b/usr/src/lib/libbc/libc/sys/common/dup.c index 3445f278b2..1f7a5dddc1 100644 --- a/usr/src/lib/libbc/libc/sys/common/dup.c +++ b/usr/src/lib/libbc/libc/sys/common/dup.c @@ -20,20 +20,19 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/syscall.h> +#include <sys/fcntl.h> int dup(int fd) { int ret, fds; - if ((ret = _syscall(SYS_dup, fd)) == -1) + if ((ret = _syscall(SYS_fcntl, fd, F_DUPFD, 0)) == -1) return (-1); if ((fds = fd_get(fd)) != -1) diff --git a/usr/src/lib/libbc/libc/sys/common/syscall.c b/usr/src/lib/libbc/libc/sys/common/syscall.c index 79b67e7e03..83079878f8 100644 --- a/usr/src/lib/libbc/libc/sys/common/syscall.c +++ b/usr/src/lib/libbc/libc/sys/common/syscall.c @@ -20,12 +20,10 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <errno.h> #include <stdio.h> #include <stdarg.h> @@ -37,22 +35,22 @@ * to their SVR4/5.0 equivalents before trapping into the kernel. */ -int syscallnum[190] = { SYS_syscall, SYS_exit, SYS_fork1, - SYS_read, SYS_write, SYS_open, SYS_close, - -1, SYS_creat, SYS_link, SYS_unlink, +int syscallnum[190] = { SYS_syscall, SYS_exit, -1 /*fork1*/, + SYS_read, SYS_write, -1 /*open*/, SYS_close, + -1, -1 /*creat*/, SYS_link, -1 /*unlink*/, -1, SYS_chdir, 0, SYS_mknod, - SYS_chmod, SYS_lchown, 0, 0, + SYS_chmod, -1 /*lchown*/, 0, 0, SYS_lseek, SYS_getpid, 0, 0, 0, SYS_getuid, 0, 0, 0, 0, 0, 0, - 0, 0, SYS_access, 0, - 0, SYS_sync, SYS_kill, SYS_stat, - 0, SYS_lstat, SYS_dup, SYS_pipe, + 0, 0, -1 /*access*/, 0, + 0, SYS_sync, SYS_kill, -1 /*stat*/, + 0, -1 /*lstat*/, -1 /*dup*/, SYS_pipe, 0, SYS_profil, 0, 0, SYS_getgid, 0, 0, 0, SYS_acct, 0, -1, SYS_ioctl, -1 /*reboot*/, 0, SYS_symlink, SYS_readlink, - SYS_execve, SYS_umask, SYS_chroot, SYS_fstat, + SYS_execve, SYS_umask, SYS_chroot, -1 /*fstat*/, 0, -1/*getpagesize*/,-1, 0, 0, 0, -1, -1, SYS_mmap, -1, SYS_munmap, SYS_mprotect, @@ -68,16 +66,16 @@ int syscallnum[190] = { SYS_syscall, SYS_exit, SYS_fork1, -1 /*sigpause*/, -1 /*sigstack*/, -1 /*recvmsg*/, -1 /*sendmsg*/, -1 /*vtrace*/, SYS_gettimeofday, -1 /*getrusage*/, -1 /*getsockopt*/, 0, SYS_readv, SYS_writev, -1 /*settimeofday*/, - SYS_fchown, SYS_fchmod, -1 /*recvfrom*/, -1 /*setreuid*/, - -1 /*getregid*/, SYS_rename, -1 /*truncate*/, -1 /*ftruncate*/, + -1 /*fchown*/, SYS_fchmod, -1 /*recvfrom*/, -1 /*setreuid*/, + -1 /*getregid*/, -1 /*rename*/, -1 /*truncate*/, -1 /*ftruncate*/, -1 /*flock*/, 0, -1 /*sendto*/, -1 /*shutdown*/, - -1 /*socketpair*/,SYS_mkdir, SYS_rmdir, SYS_utimes, + -1 /*socketpair*/,SYS_mkdir, -1 /*rmdir*/, -1 /*utimes*/, 0, SYS_adjtime, -1 /*getpeername*/,-1 /*gethostid*/, 0, SYS_getrlimit, SYS_setrlimit, -1 /*killpg*/, 0, 0, 0, -1/*getsockname*/, - SYS_getmsg, SYS_putmsg, SYS_poll, 0, + SYS_getmsg, SYS_putmsg, -1 /*poll*/, 0, -1/*nfssvc*/, -1 /*getdirentries*/, SYS_statfs, SYS_fstatfs, - SYS_umount, -1 /*async_daemmon*/ -1 /*getfh*/, -1/*getdomain*/, + -1/*SYS_umount*/, -1 /*async_daemmon*/ -1 /*getfh*/, -1/*getdomain*/, -1/*setdomain*/, 0, -1 /*quotactl*/, -1 /*exportfs*/, SYS_mount, -1/*ustat*/, SYS_semsys, SYS_msgsys, SYS_shmsys, -1 /*auditsys*/, -1 /*rfsys*/, SYS_getdents, @@ -258,7 +256,7 @@ syscall(int sysnum, ...) i1 = va_arg(ap, int); i2 = va_arg(ap, int); va_end(ap); - return (dup(i1, i2)); + return (dup2(i1, i2)); case XSYS_pipe: c1 = (char *)va_arg(ap, int *); va_end(ap); @@ -465,6 +463,26 @@ syscall(int sysnum, ...) i2 = va_arg(ap, int); va_end(ap); return (flock(i1, i2)); + case XSYS_utimes: + c1 = va_arg(ap, char *); + c2 = va_arg(ap, char *); + va_end(ap); + return (utimes(c1, c2)); + case XSYS_poll: + c1 = va_arg(ap, char *); + i2 = va_arg(ap, int); + i3 = va_arg(ap, int); + va_end(ap); + return (poll(c1, i2, i3)); + case XSYS_fchown: + i1 = va_arg(ap, int); + i2 = va_arg(ap, int); + i3 = va_arg(ap, int); + va_end(ap); + return (fchown(i1, i2, i3)); + case XSYS_fork: + va_end(ap); + return (fork1()); /* the following system calls are now implemented in * libsocket */ @@ -599,9 +617,7 @@ syscall(int sysnum, ...) case XSYS_exit: case XSYS_fchdir: case XSYS_fchmod: - case XSYS_fchown: case XSYS_fchroot: - case XSYS_fork: case XSYS_getgid: case XSYS_getitimer: case XSYS_getmsg: @@ -611,12 +627,10 @@ syscall(int sysnum, ...) case XSYS_mprotect: case XSYS_munmap: case XSYS_putmsg: - case XSYS_poll: case XSYS_profil: case XSYS_setitimer: case XSYS_sync: case XSYS_umask: - case XSYS_utimes: case XSYS_semsys: case XSYS_msgsys: case XSYS_shmsys: diff --git a/usr/src/lib/libbc/libc/sys/sys5/chown.c b/usr/src/lib/libbc/libc/sys/sys5/chown.c index ec2daf5b05..7367a37871 100644 --- a/usr/src/lib/libbc/libc/sys/sys5/chown.c +++ b/usr/src/lib/libbc/libc/sys/sys5/chown.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,17 +18,17 @@ * * CDDL HEADER END */ + /* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/syscall.h> +#include <sys/fcntl.h> int chown(char *s, int u, int g) { - return (_syscall(SYS_lchown, s, u, g)); + return (_syscall(SYS_fchownat, AT_FDCWD, s, u, g, AT_SYMLINK_NOFOLLOW)); } diff --git a/usr/src/lib/libbc/libc/sys/sys5/execve.c b/usr/src/lib/libbc/libc/sys/sys5/execve.c index 476505107b..1ade79a2d4 100644 --- a/usr/src/lib/libbc/libc/sys/sys5/execve.c +++ b/usr/src/lib/libbc/libc/sys/sys5/execve.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <string.h> #include <sys/file.h> #include <sys/syscall.h> @@ -38,7 +36,7 @@ execve(char *file, char **argv, char **arge) if (strncmp(file, "/usr/bin", strlen("/usr/bin")) == 0 || strncmp(file, "/bin", strlen("/bin")) == 0) { - if (_syscall(SYS_access, file, F_OK) == -1) { + if (_syscall(SYS_faccessat, AT_FDCWD, file, F_OK, 0) == -1) { strcpy(path, "/usr/ucb"); strcat(path, strrchr(file, '/')); file = path; @@ -47,18 +45,19 @@ execve(char *file, char **argv, char **arge) else if (strncmp(file, "/usr/ucb", strlen("/usr/ucb")) == 0) { strcpy(path, "/usr/bin"); strcat(path, strrchr(file, '/')); - if (_syscall(SYS_access, path, F_OK) == 0) + if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) == 0) file = path; } else if (strncmp(file, "/usr/5bin", strlen("/usr/5bin")) == 0) { strcpy(path, "/usr/bin"); strcat(path, strrchr(file, '/')); - if (_syscall(SYS_access, path, F_OK) == 0) + if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) == 0) file = path; else { strcpy(path, "/usr/ucb"); strcat(path, strrchr(file, '/')); - if (_syscall(SYS_access, path, F_OK) == 0) + if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) + == 0) file = path; } } diff --git a/usr/src/lib/libbc/libc/sys/sys5/rename.c b/usr/src/lib/libbc/libc/sys/sys5/rename.c index 79b975f975..4a534c0653 100644 --- a/usr/src/lib/libbc/libc/sys/sys5/rename.c +++ b/usr/src/lib/libbc/libc/sys/sys5/rename.c @@ -20,13 +20,12 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/syscall.h> +#include <sys/fcntl.h> int rename(char *path1, char *path2) @@ -46,5 +45,5 @@ rename(char *path1, char *path2) path2 = buf2; } - return (_syscall(SYS_rename, path1, path2)); + return (_syscall(SYS_renameat, AT_FDCWD, path1, AT_FDCWD, path2)); } diff --git a/usr/src/lib/libbc/libc/sys/sys5/rmdir.c b/usr/src/lib/libbc/libc/sys/sys5/rmdir.c index 8c6d49e47e..61b12ef42a 100644 --- a/usr/src/lib/libbc/libc/sys/sys5/rmdir.c +++ b/usr/src/lib/libbc/libc/sys/sys5/rmdir.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,18 +18,18 @@ * * CDDL HEADER END */ + /* - * Copyright 1990 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/syscall.h> +#include <sys/fcntl.h> int rmdir(char *d) { - return (_syscall(SYS_rmdir, d)); + return (_syscall(SYS_unlinkat, AT_FDCWD, d, AT_REMOVEDIR)); } diff --git a/usr/src/lib/libbc/libc/sys/sys5/stat.c b/usr/src/lib/libbc/libc/sys/sys5/stat.c index ebd07f1cd6..13d0726a41 100644 --- a/usr/src/lib/libbc/libc/sys/sys5/stat.c +++ b/usr/src/lib/libbc/libc/sys/sys5/stat.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/syscall.h> #include <sys/types.h> #include <sys/stat.h> @@ -52,7 +50,7 @@ struct stat *buf; errno = EFAULT; return (-1); } - return(stat_com(SYS_stat, path, buf)); + return(stat_com(0, path, buf)); } @@ -67,6 +65,6 @@ int bc_lstat(path, buf) char *path; struct stat *buf; { - return(stat_com(SYS_lstat, path, buf)); + return(stat_com(1, path, buf)); } diff --git a/usr/src/lib/libbc/libc/sys/sys5/unlink.c b/usr/src/lib/libbc/libc/sys/sys5/unlink.c index 36dc087d9f..7c30c45f0d 100644 --- a/usr/src/lib/libbc/libc/sys/sys5/unlink.c +++ b/usr/src/lib/libbc/libc/sys/sys5/unlink.c @@ -20,16 +20,15 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/syscall.h> +#include <sys/fcntl.h> int -unlink(char *path) +unlink(const char *path) { if (strcmp(path, "/etc/utmp") == 0 || strcmp(path, "/var/adm/utmp") == 0) @@ -37,5 +36,5 @@ unlink(char *path) else if (strcmp(path, "/var/adm/wtmp") == 0) path = "/var/adm/wtmpx"; - return (_syscall(SYS_unlink, path)); + return (_syscall(SYS_unlinkat, AT_FDCWD, path, 0)); } diff --git a/usr/src/lib/libbc/sparc/Makefile b/usr/src/lib/libbc/sparc/Makefile index e005d01ed6..b36c5a35ab 100644 --- a/usr/src/lib/libbc/sparc/Makefile +++ b/usr/src/lib/libbc/sparc/Makefile @@ -19,11 +19,9 @@ # CDDL HEADER END # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# # # This builds all objects needed for libbc. @@ -128,15 +126,15 @@ sprintf.o vfprintf.o vprintf.o vsprintf.o SYSCOM=\ _access.o acct.o adjtime.o close.o _creat.o dup.o dup2.o \ -fchdir.o fchmod.o fchown.o fchroot.o \ +fchdir.o fchmod.o fchroot.o \ fdlist.o flock.o fpathconf.o fsync.o ftruncate.o getdents.o \ getdtablesize.o getgid.o getitimer.o getpid.o gettimeofday.o \ getuid.o ioctl.o kill.o lseek.o mincore.o mprotect.o munmap.o\ -_open.o poll.o profil.o setitimer.o \ +_open.o profil.o setitimer.o \ rlimit.o _statfs.o sync.o umask.o uname.o\ execl.o execle.o execv.o mkfifo.o msgsys.o\ pathconf.o semsys.o shmsys.o unmount.o wait.o setuid.o\ -setgid.o _stat.o seteuid.o setegid.o signalmap.o utimes.o syscall.o \ +setgid.o _stat.o seteuid.o setegid.o signalmap.o syscall.o \ maperror.o sigsetjmp.o accept.o bind.o connect.o getpeername.o \ getsockname.o getsockopt.o listen.o recv.o send.o \ setsockopt.o shutdown.o socket.o socketpair.o setsid.o sigaction.o @@ -185,13 +183,12 @@ YP= yp_bind.o YP= yp_bind.o PSEUDO_SRCS= adjtime.s fchdir.s \ -fchmod.s fchown.s fchroot.s \ +fchmod.s fchroot.s \ fpathconf.s getitimer.s getpid.s \ mincore.s mprotect.s munmap.s \ profil.s setitimer.s \ sync.s sysconf.s umask.s ustat.s \ -acct.s stime.s \ -utimes.s poll.s +acct.s stime.s # # libbc build rules diff --git a/usr/src/lib/libbsm/audit_event.txt b/usr/src/lib/libbsm/audit_event.txt index 64453e4998..8ee50ca320 100644 --- a/usr/src/lib/libbsm/audit_event.txt +++ b/usr/src/lib/libbsm/audit_event.txt @@ -68,10 +68,10 @@ 2:AUE_FORKALL:forkall(2):ps # AUE_OPEN is a placeholder and will not be generated 3:AUE_OPEN:open(2) - place holder:no -4:AUE_CREAT:creat(2):fc +4:AUE_CREAT:creat(2):no 5:AUE_LINK:link(2):fc 6:AUE_UNLINK:unlink(2):fd -7:AUE_EXEC:exec(2):ps,ex +7:AUE_EXEC:exec(2):no 8:AUE_CHDIR:chdir(2):pm 9:AUE_MKNOD:mknod(2):fc 10:AUE_CHMOD:chmod(2):fm @@ -236,7 +236,7 @@ 199:AUE_OSTAT:old stat(2):no 200:AUE_SETUID:setuid(2):pm 201:AUE_STIME:old stime(2):as -202:AUE_UTIME:old utime(2):fm +202:AUE_UTIME:old utime(2):no 203:AUE_NICE:old nice(2):pm 204:AUE_OSETPGRP:old setpgrp(2):no 205:AUE_SETGID:old setgid(2):pm @@ -309,26 +309,25 @@ 266:AUE_SETAUDIT_ADDR:setaudit_addr(2):aa 267:AUE_GETAUDIT_ADDR:getaudit_addr(2):aa 268:AUE_UMOUNT2:umount2(2):as -# AUE_FSAT is a placeholder and will not be generated +# AUE_FSAT and all AUE_OPENAT_* codes are obsolete and will not be generated 269:AUE_FSAT:fsat(2) - place holder:no -270:AUE_OPENAT_R:openat(2) - read:fr -271:AUE_OPENAT_RC:openat(2) - read,creat:fc,fr -272:AUE_OPENAT_RT:openat(2) - read,trunc:fd,fr -273:AUE_OPENAT_RTC:openat(2) - read,creat,trunc:fc,fd,fr -274:AUE_OPENAT_W:openat(2) - write:fw -275:AUE_OPENAT_WC:openat(2) - write,creat:fc,fw -276:AUE_OPENAT_WT:openat(2) - write,trunc:fd,fw -277:AUE_OPENAT_WTC:openat(2) - write,creat,trunc:fc,fd,fw -278:AUE_OPENAT_RW:openat(2) - read,write:fr,fw -279:AUE_OPENAT_RWC:openat(2) - read,write,creat:fc,fw,fr -280:AUE_OPENAT_RWT:openat(2) - read,write,trunc:fd,fr,fw -281:AUE_OPENAT_RWTC:openat(2) - read,write,creat,trunc:fc,fd,fw,fr -282:AUE_RENAMEAT:renameat(2):fc,fd -# AUE_FSTATAT is a potentially very high-volume event, use with caution +270:AUE_OPENAT_R:openat(2) - read:no +271:AUE_OPENAT_RC:openat(2) - read,creat:no +272:AUE_OPENAT_RT:openat(2) - read,trunc:no +273:AUE_OPENAT_RTC:openat(2) - read,creat,trunc:no +274:AUE_OPENAT_W:openat(2) - write:no +275:AUE_OPENAT_WC:openat(2) - write,creat:no +276:AUE_OPENAT_WT:openat(2) - write,trunc:no +277:AUE_OPENAT_WTC:openat(2) - write,creat,trunc:no +278:AUE_OPENAT_RW:openat(2) - read,write:no +279:AUE_OPENAT_RWC:openat(2) - read,write,creat:no +280:AUE_OPENAT_RWT:openat(2) - read,write,trunc:no +281:AUE_OPENAT_RWTC:openat(2) - read,write,creat,trunc:no +282:AUE_RENAMEAT:renameat(2):no 283:AUE_FSTATAT:fstatat(2):no -284:AUE_FCHOWNAT:fchownat(2):fm -285:AUE_FUTIMESAT:futimesat(2):fm -286:AUE_UNLINKAT:unlinkat(2):fd +284:AUE_FCHOWNAT:fchownat(2):no +285:AUE_FUTIMESAT:futimesat(2):no +286:AUE_UNLINKAT:unlinkat(2):no 287:AUE_CLOCK_SETTIME:clock_settime(3RT):as 288:AUE_NTP_ADJTIME:ntp_adjtime(2):as 289:AUE_SETPPRIV:setppriv(2):pm @@ -355,7 +354,7 @@ # 307:AUE_SETSID:setsid(2):pm 308:AUE_SETPGID:setpgid(2):pm -309:AUE_FACCESSAT:faccessat(2):fa +309:AUE_FACCESSAT:faccessat(2):no # # user level audit events # 2048 - 6143 Reserved diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile index 85527634fb..856a8c1b91 100644 --- a/usr/src/lib/libc/amd64/Makefile +++ b/usr/src/lib/libc/amd64/Makefile @@ -168,7 +168,6 @@ COMSYSOBJS= \ _so_socket.o \ _so_socketpair.o \ _sockconfig.o \ - access.o \ acct.o \ acl.o \ adjtime.o \ @@ -176,23 +175,17 @@ COMSYSOBJS= \ brk.o \ chdir.o \ chmod.o \ - chown.o \ chroot.o \ cladm.o \ close.o \ - creat.o \ - dup.o \ execve.o \ exit.o \ facl.o \ fchdir.o \ fchmod.o \ - fchown.o \ fchroot.o \ - fcntl.o \ fdsync.o \ fpathconf.o \ - fstat.o \ fstatfs.o \ fstatvfs.o \ getcpuid.o \ @@ -214,11 +207,9 @@ COMSYSOBJS= \ ioctl.o \ kaio.o \ kill.o \ - lchown.o \ link.o \ llseek.o \ lseek.o \ - lstat.o \ mmapobjsys.o \ memcntl.o \ mincore.o \ @@ -232,7 +223,6 @@ COMSYSOBJS= \ nice.o \ ntp_adjtime.o \ ntp_gettime.o \ - open.o \ p_online.o \ pathconf.o \ pause.o \ @@ -249,9 +239,7 @@ COMSYSOBJS= \ read.o \ readlink.o \ readv.o \ - rename.o \ resolvepath.o \ - rmdir.o \ seteguid.o \ setgid.o \ setgroups.o \ @@ -263,7 +251,6 @@ COMSYSOBJS= \ sigprocmsk.o \ sigsendset.o \ sigsuspend.o \ - stat.o \ statfs.o \ statvfs.o \ stty.o \ @@ -277,7 +264,6 @@ COMSYSOBJS= \ ulimit.o \ umask.o \ umount2.o \ - unlink.o \ utssys.o \ uucopy.o \ vhangup.o \ @@ -295,11 +281,9 @@ SYSOBJS= \ door.o \ forkx.o \ forkallx.o \ - fxstat.o \ getcontext.o \ gettimeofday.o \ lwp_private.o \ - lxstat.o \ nuname.o \ pipe.o \ syscall.o \ @@ -308,9 +292,7 @@ SYSOBJS= \ uadmin.o \ umount.o \ uname.o \ - vforkx.o \ - xmknod.o \ - xstat.o + vforkx.o # Preserved solely to ease maintenance of 32-bit and 64-bit library builds # This macro should ALWAYS be empty; native APIs are already 'large file'. @@ -384,7 +366,7 @@ PORTGEN= \ dirname.o \ div.o \ drand48.o \ - dup2.o \ + dup.o \ env_data.o \ err.o \ errno.o \ @@ -786,23 +768,22 @@ PORTSYS64= PORTSYS= \ _autofssys.o \ + access.o \ acctctl.o \ bsd_signal.o \ + chown.o \ corectl.o \ exacctsys.o \ execl.o \ execle.o \ execv.o \ - fsmisc.o \ - fstatat.o \ + fcntl.o \ getpagesizes.o \ getpeerucred.o \ inst_sync.o \ issetugid.o \ label.o \ - libc_fcntl.o \ libc_link.o \ - libc_open.o \ lockf.o \ lwp.o \ lwp_cond.o \ @@ -811,12 +792,13 @@ PORTSYS= \ meminfosys.o \ msgsys.o \ nfssys.o \ - openat.o \ + open.o \ pgrpsys.o \ posix_sigwait.o \ ppriv.o \ psetsys.o \ rctlsys.o \ + rename.o \ sbrk.o \ semsys.o \ set_errno.o \ @@ -827,10 +809,12 @@ PORTSYS= \ signal.o \ sigpending.o \ sigstack.o \ + stat.o \ tasksys.o \ time.o \ time_util.o \ ucontext.o \ + unlink.o \ ustat.o \ utimesys.o \ zone.o @@ -935,6 +919,11 @@ CPPFLAGS= -D_REENTRANT -D$(MACH64) -D__$(MACH64) $(THREAD_DEBUG) \ ASFLAGS= $(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) \ $(amd64_AS_XARCH) +# As a favor to the dtrace syscall provider, libc still calls the +# old syscall traps that have been obsoleted by the *at() interfaces. +# Delete this to compile libc using only the new *at() system call traps +CPPFLAGS += -D_RETAIN_OLD_SYSCALLS + # Conditionally add support for making |wordexp()| check whether # /usr/bin/ksh is ksh93 or not include ../../../Makefile.ksh93switch diff --git a/usr/src/lib/libc/amd64/crt/_rtld.c b/usr/src/lib/libc/amd64/crt/_rtld.c deleted file mode 100644 index 55d209a4fd..0000000000 --- a/usr/src/lib/libc/amd64/crt/_rtld.c +++ /dev/null @@ -1,330 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Redirection ld.so. Based on the 4.x binary compatibility ld.so, used - * to redirect aliases for ld.so to the real one. - */ - -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Import data structures - */ -#include <sys/types.h> -#include <sys/mman.h> -#include <sys/fcntl.h> -#include <sys/stat.h> -#include <sys/sysconfig.h> -#include <sys/auxv.h> -#include <elf.h> -#include <link.h> -#include <string.h> -#include "alias_boot.h" - -/* - * Local manifest constants and macros. - */ -#define ALIGN(x, a) ((int)(x) & ~((int)(a) - 1)) -#define ROUND(x, a) (((int)(x) + ((int)(a) - 1)) & \ - ~((int)(a) - 1)) - -#define EMPTY strings[EMPTY_S] -#define LDSO strings[LDSO_S] -#define ZERO strings[ZERO_S] -#define CLOSE (*(funcs[CLOSE_F])) -#define FSTAT (*(funcs[FSTAT_F])) -#define MMAP (*(funcs[MMAP_F])) -#define MUNMAP (*(funcs[MUNMAP_F])) -#define OPEN (*(funcs[OPEN_F])) -#define PANIC (*(funcs[PANIC_F])) -#define SYSCONFIG (*(funcs[SYSCONFIG_F])) - -#include <link.h> - -/* - * Alias ld.so entry point -- receives a bootstrap structure and a vector - * of strings. The vector is "well-known" to us, and consists of pointers - * to string constants. This aliasing bootstrap requires no relocation in - * order to run, save for the pointers of constant strings. This second - * parameter provides this. Note that this program is carefully coded in - * order to maintain the "no bootstrapping" requirement -- it calls only - * local functions, uses no intrinsics, etc. - */ -void * -__rtld(Elf32_Boot *ebp, const char *strings[], int (*funcs[])()) -{ - int i, j, p; /* working */ - int page_size = 0; /* size of a page */ - const char *program_name = EMPTY; /* our name */ - int ldfd; /* fd assigned to ld.so */ - int dzfd = 0; /* fd assigned to /dev/zero */ - Elf32_Ehdr *ehdr; /* ELF header of ld.so */ - Elf32_Phdr *phdr; /* first Phdr in file */ - Elf32_Phdr *pptr; /* working Phdr */ - Elf32_Phdr *lph; /* last loadable Phdr */ - Elf32_Phdr *fph = 0; /* first loadable Phdr */ - caddr_t maddr; /* pointer to mapping claim */ - Elf32_Off mlen; /* total mapping claim */ - caddr_t faddr; /* first program mapping of ld.so */ - Elf32_Off foff; /* file offset for segment mapping */ - Elf32_Off flen; /* file length for segment mapping */ - caddr_t addr; /* working mapping address */ - caddr_t zaddr; /* /dev/zero working mapping addr */ - struct stat sb; /* stat buffer for sizing */ - auxv_t *ap; /* working aux pointer */ - - /* - * Discover things about our environment: auxiliary vector (if - * any), arguments, program name, and the like. - */ - while (ebp->eb_tag != NULL) { - switch (ebp->eb_tag) { - case EB_ARGV: - program_name = *((char **)ebp->eb_un.eb_ptr); - break; - case EB_AUXV: - for (ap = (auxv_t *)ebp->eb_un.eb_ptr; - ap->a_type != AT_NULL; ap++) - if (ap->a_type == AT_PAGESZ) { - page_size = ap->a_un.a_val; - break; - } - break; - } - ebp++; - } - - /* - * If we didn't get a page size from looking in the auxiliary - * vector, we need to get one now. - */ - if (page_size == 0) { - page_size = SYSCONFIG(_CONFIG_PAGESIZE); - ebp->eb_tag = EB_PAGESIZE, (ebp++)->eb_un.eb_val = - (Elf32_Word)page_size; - } - - /* - * Map in the real ld.so. Note that we're mapping it as - * an ELF database, not as a program -- we just want to walk it's - * data structures. Further mappings will actually establish the - * program in the address space. - */ - if ((ldfd = OPEN(LDSO, O_RDONLY)) == -1) - PANIC(program_name); -/* NEEDSWORK (temp kludge to use xstat so we can run on G6) */ - if (FSTAT(2, ldfd, &sb) == -1) - PANIC(program_name); - ehdr = (Elf32_Ehdr *)MMAP(0, sb.st_size, PROT_READ | PROT_EXEC, - MAP_SHARED, ldfd, 0); - if (ehdr == (Elf32_Ehdr *)-1) - PANIC(program_name); - - /* - * Validate the file we're looking at, ensure it has the correct - * ELF structures, such as: ELF magic numbers, coded for 386, - * is a ".so", etc. - */ - if (ehdr->e_ident[EI_MAG0] != ELFMAG0 || - ehdr->e_ident[EI_MAG1] != ELFMAG1 || - ehdr->e_ident[EI_MAG2] != ELFMAG2 || - ehdr->e_ident[EI_MAG3] != ELFMAG3) - PANIC(program_name); - if (ehdr->e_ident[EI_CLASS] != ELFCLASS32 || - ehdr->e_ident[EI_DATA] != ELFDATA2LSB) - PANIC(program_name); - if (ehdr->e_type != ET_DYN) - PANIC(program_name); - if (ehdr->e_machine != EM_386) - PANIC(program_name); - if (ehdr->e_version > EV_CURRENT) - PANIC(program_name); - - /* - * Point at program headers and start figuring out what to load. - */ - phdr = (Elf32_Phdr *)((caddr_t)ehdr + ehdr->e_phoff); - for (p = 0, pptr = phdr; p < (int)ehdr->e_phnum; p++, - pptr = (Elf32_Phdr *)((caddr_t)pptr + ehdr->e_phentsize)) - if (pptr->p_type == PT_LOAD) { - if (fph == 0) { - fph = pptr; - } else if (pptr->p_vaddr <= lph->p_vaddr) - PANIC(program_name); - lph = pptr; - } - - /* - * We'd better have at least one loadable segment. - */ - if (fph == 0) - PANIC(program_name); - - /* - * Map enough address space to hold the program (as opposed to the - * file) represented by ld.so. The amount to be assigned is the - * range between the end of the last loadable segment and the - * beginning of the first PLUS the alignment of the first segment. - * mmap() can assign us any page-aligned address, but the relocations - * assume the alignments included in the program header. As an - * optimization, however, let's assume that mmap() will actually - * give us an aligned address -- since if it does, we can save - * an munmap() later on. If it doesn't -- then go try it again. - */ - mlen = ROUND((lph->p_vaddr + lph->p_memsz) - - ALIGN(fph->p_vaddr, page_size), page_size); - maddr = (caddr_t)MMAP(0, mlen, PROT_READ | PROT_EXEC, - MAP_SHARED, ldfd, 0); - if (maddr == (caddr_t)-1) - PANIC(program_name); - faddr = (caddr_t)ROUND(maddr, fph->p_align); - - /* - * Check to see whether alignment skew was really needed. - */ - if (faddr != maddr) { - (void) MUNMAP(maddr, mlen); - mlen = ROUND((lph->p_vaddr + lph->p_memsz) - - ALIGN(fph->p_vaddr, fph->p_align) + fph->p_align, - page_size); - maddr = (caddr_t)MMAP(0, mlen, PROT_READ | PROT_EXEC, - MAP_SHARED, ldfd, 0); - if (maddr == (caddr_t)-1) - PANIC(program_name); - faddr = (caddr_t)ROUND(maddr, fph->p_align); - } - - /* - * We have the address space reserved, so map each loadable segment. - */ - for (p = 0, pptr = phdr; p < (int)ehdr->e_phnum; p++, - pptr = (Elf32_Phdr *)((caddr_t)pptr + ehdr->e_phentsize)) { - - /* - * Skip non-loadable segments or segments that don't occupy - * any memory. - */ - if ((pptr->p_type != PT_LOAD) || (pptr->p_memsz == 0)) - continue; - - /* - * Determine the file offset to which the mapping will - * directed (must be aligned) and how much to map (might - * be more than the file in the case of .bss.) - */ - foff = ALIGN(pptr->p_offset, page_size); - flen = pptr->p_memsz + (pptr->p_offset - foff); - - /* - * Set address of this segment relative to our base. - */ - addr = (caddr_t)ALIGN(faddr + pptr->p_vaddr, page_size); - - /* - * If this is the first program header, record our base - * address for later use. - */ - if (pptr == phdr) { - ebp->eb_tag = EB_LDSO_BASE; - (ebp++)->eb_un.eb_ptr = (Elf32_Addr)addr; - } - - /* - * Unmap anything from the last mapping address to this - * one. - */ - if (addr - maddr) { - (void) MUNMAP(maddr, addr - maddr); - mlen -= addr - maddr; - } - - /* - * Determine the mapping protection from the section - * attributes. - */ - i = 0; - if (pptr->p_flags & PF_R) - i |= PROT_READ; - if (pptr->p_flags & PF_W) - i |= PROT_WRITE; - if (pptr->p_flags & PF_X) - i |= PROT_EXEC; - if ((caddr_t)MMAP((caddr_t)addr, flen, i, - MAP_FIXED | MAP_PRIVATE, ldfd, foff) == (caddr_t)-1) - PANIC(program_name); - - /* - * If the memory occupancy of the segment overflows the - * definition in the file, we need to "zero out" the - * end of the mapping we've established, and if necessary, - * map some more space from /dev/zero. - */ - if (pptr->p_memsz > pptr->p_filesz) { - foff = (int)faddr + pptr->p_vaddr + pptr->p_filesz; - zaddr = (caddr_t)ROUND(foff, page_size); - for (j = 0; j < (int)(zaddr - foff); j++) - *((char *)foff + j) = 0; - j = (faddr + pptr->p_vaddr + pptr->p_memsz) - zaddr; - if (j > 0) { - if (dzfd == 0) { - dzfd = OPEN(ZERO, O_RDWR); - if (dzfd == -1) - PANIC(program_name); - } - if ((caddr_t)MMAP((caddr_t)zaddr, j, i, - MAP_FIXED | MAP_PRIVATE, dzfd, - 0) == (caddr_t)-1) - PANIC(program_name); - } - } - - /* - * Update the mapping claim pointer. - */ - maddr = addr + ROUND(flen, page_size); - mlen -= maddr - addr; - } - - /* - * Unmap any final reservation. - */ - if (mlen > 0) - (void) MUNMAP(maddr, mlen); - - /* - * Clean up file descriptor space we've consumed. Pass along - * the /dev/zero file descriptor we got -- every cycle counts. - */ - (void) CLOSE(ldfd); - if (dzfd != 0) - ebp->eb_tag = EB_DEVZERO, (ebp++)->eb_un.eb_val = dzfd; - - ebp->eb_tag = EB_NULL, ebp->eb_un.eb_val = 0; - - /* The two bytes before _rt_boot is for the alias entry point */ - return (void *) (ehdr->e_entry + faddr - 2); -} diff --git a/usr/src/lib/libc/amd64/crt/alias_boot.h b/usr/src/lib/libc/amd64/crt/alias_boot.h deleted file mode 100644 index 5b12462808..0000000000 --- a/usr/src/lib/libc/amd64/crt/alias_boot.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#ifndef _ALIAS_BOOT_H -#define _ALIAS_BOOT_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Offsets for string constants used in alias bootstrap. - */ -#define LDSO_S 0 /* "/usr/lib/ld.so.n" */ -#define ZERO_S 1 /* "/dev/zero" */ -#define EMPTY_S 2 /* "(null)" */ -#define S_MAX 3 /* count of strings */ - -/* - * Offsets for function pointers used in alias bootstrap. - */ -#define PANIC_F 0 /* panic() */ -#define OPEN_F 1 /* open() */ -#define MMAP_F 2 /* mmap() */ -#define FSTAT_F 3 /* fstat() */ -#define SYSCONFIG_F 4 /* sysconfig() */ -#define CLOSE_F 5 /* close() */ -#define MUNMAP_F 6 /* munmap() */ -#define F_MAX 7 /* count of functions */ - -#endif /* _ALIAS_BOOT_H */ diff --git a/usr/src/lib/libc/common/sys/access.s b/usr/src/lib/libc/common/sys/access.s deleted file mode 100644 index e39e7e549c..0000000000 --- a/usr/src/lib/libc/common/sys/access.s +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "access.s" - -/* C library -- access */ -/* int access(char *path, int amode) */ - -#include <sys/asm_linkage.h> - - ANSI_PRAGMA_WEAK(access,function) - -#include "SYS.h" - - SYSCALL_RVAL1(access) - RET - SET_SIZE(access) diff --git a/usr/src/lib/libc/common/sys/chown.s b/usr/src/lib/libc/common/sys/chown.s deleted file mode 100644 index d77e23b346..0000000000 --- a/usr/src/lib/libc/common/sys/chown.s +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "chown.s" - -/* C library -- chown */ -/* int chown(char *path, uid_t owner, gid_t group) */ - -#include <sys/asm_linkage.h> - - ANSI_PRAGMA_WEAK(chown,function) - -#include "SYS.h" - - SYSCALL_RVAL1(chown) - RETC - SET_SIZE(chown) diff --git a/usr/src/lib/libc/common/sys/dup.s b/usr/src/lib/libc/common/sys/dup.s deleted file mode 100644 index 84b89d0170..0000000000 --- a/usr/src/lib/libc/common/sys/dup.s +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "dup.s" - -/* C library -- dup */ -/* int dup(int fildes) */ - -#include <sys/asm_linkage.h> - - ANSI_PRAGMA_WEAK(dup,function) - -#include "SYS.h" - - SYSCALL_RVAL1(dup) - RET - SET_SIZE(dup) diff --git a/usr/src/lib/libc/common/sys/fchown.s b/usr/src/lib/libc/common/sys/fchown.s deleted file mode 100644 index 2cc7d35093..0000000000 --- a/usr/src/lib/libc/common/sys/fchown.s +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "fchown.s" - -/* C library -- fchown */ -/* int fchown(int fildes, uid_t owner, gid_t group) */ - -#include <sys/asm_linkage.h> - - ANSI_PRAGMA_WEAK(fchown,function) - -#include "SYS.h" - - SYSCALL_RVAL1(fchown) - RETC - SET_SIZE(fchown) diff --git a/usr/src/lib/libc/common/sys/fcntl.s b/usr/src/lib/libc/common/sys/fcntl.s deleted file mode 100644 index 3e44b4546d..0000000000 --- a/usr/src/lib/libc/common/sys/fcntl.s +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "fcntl.s" - -/* - * int __fcntl_syscall(int fildes, int cmd [, arg]) - */ - -#include "SYS.h" - - SYSCALL2_RESTART_RVAL1(__fcntl_syscall,fcntl) - RET - SET_SIZE(__fcntl_syscall) diff --git a/usr/src/lib/libc/common/sys/fstat.s b/usr/src/lib/libc/common/sys/fstat.s deleted file mode 100644 index 54a8e83558..0000000000 --- a/usr/src/lib/libc/common/sys/fstat.s +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "fstat.s" - -/* C library -- fstat */ -/* int fstat (int fildes, struct stat *buf) */ - -#include <sys/asm_linkage.h> - -#if !defined(_LARGEFILE_SOURCE) - ANSI_PRAGMA_WEAK(fstat,function) -#else - ANSI_PRAGMA_WEAK(fstat64,function) -#endif - -#include "SYS.h" - -#if !defined(_LARGEFILE_SOURCE) - - SYSCALL_RVAL1(fstat) - RETC - SET_SIZE(fstat) - -#else - -/* C library -- fstat64 transitional large file API */ -/* int fstat64 (int fildes, struct stat64 *buf) */ - - SYSCALL_RVAL1(fstat64) - RETC - SET_SIZE(fstat64) - -#endif diff --git a/usr/src/lib/libc/common/sys/lchown.s b/usr/src/lib/libc/common/sys/lchown.s deleted file mode 100644 index 5055f53ff4..0000000000 --- a/usr/src/lib/libc/common/sys/lchown.s +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "lchown.s" - -/* C library -- lchown */ -/* int lchown(const char *path, uid_t owner, gid_t group) */ - -#include <sys/asm_linkage.h> - - ANSI_PRAGMA_WEAK(lchown,function) - -#include "SYS.h" - - SYSCALL_RVAL1(lchown) - RETC - SET_SIZE(lchown) diff --git a/usr/src/lib/libc/common/sys/lstat.s b/usr/src/lib/libc/common/sys/lstat.s deleted file mode 100644 index fa5c0fdc36..0000000000 --- a/usr/src/lib/libc/common/sys/lstat.s +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "lstat.s" - -/* C library -- lstat */ -/* error = lstat(const char *path, struct lstat *buf) */ - -#include <sys/asm_linkage.h> - -#if !defined(_LARGEFILE_SOURCE) - ANSI_PRAGMA_WEAK(lstat,function) -#else - ANSI_PRAGMA_WEAK(lstat64,function) -#endif - -#include "SYS.h" - -#if !defined(_LARGEFILE_SOURCE) - - SYSCALL_RVAL1(lstat) - RETC - SET_SIZE(lstat) - -#else - -/* C library -- lstat64 - transitional large file API */ -/* error = lstat64(const char *path, struct stat64 *buf) */ - - SYSCALL_RVAL1(lstat64) - RETC - SET_SIZE(lstat64) - -#endif diff --git a/usr/src/lib/libc/common/sys/open.s b/usr/src/lib/libc/common/sys/open.s deleted file mode 100644 index 90c375629b..0000000000 --- a/usr/src/lib/libc/common/sys/open.s +++ /dev/null @@ -1,52 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "open.s" - -#include "SYS.h" - -#if !defined(_LARGEFILE_SOURCE) -/* C library -- open */ -/* int open (const char *path, int oflag, [ mode_t mode ] ) */ - - SYSCALL2_RVAL1(__open_syscall,open) - RET - SET_SIZE(__open_syscall) - -#else -/* - * C library -- open64 - transitional API - * int open64 (const char *path, int oflag, [ mode_t mode ] ) - */ - - SYSCALL2_RVAL1(__open64_syscall,open64) - RET - SET_SIZE(__open64_syscall) - -#endif diff --git a/usr/src/lib/libc/common/sys/rename.s b/usr/src/lib/libc/common/sys/rename.s deleted file mode 100644 index b76767a976..0000000000 --- a/usr/src/lib/libc/common/sys/rename.s +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "rename.s" - -/* C library -- rename */ -/* int rename(const char *old, const char *new); */ - -#include <sys/asm_linkage.h> - - ANSI_PRAGMA_WEAK(rename,function) - -#include "SYS.h" - - SYSCALL_RVAL1(rename) - RETC - SET_SIZE(rename) diff --git a/usr/src/lib/libc/common/sys/rmdir.s b/usr/src/lib/libc/common/sys/rmdir.s deleted file mode 100644 index 9e0aeda3d7..0000000000 --- a/usr/src/lib/libc/common/sys/rmdir.s +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "rmdir.s" - -/* C library -- rmdir */ -/* int rmdir (const char *path); */ - -#include <sys/asm_linkage.h> - - ANSI_PRAGMA_WEAK(rmdir,function) - -#include "SYS.h" - - SYSCALL_RVAL1(rmdir) - RET - SET_SIZE(rmdir) diff --git a/usr/src/lib/libc/common/sys/stat.s b/usr/src/lib/libc/common/sys/stat.s deleted file mode 100644 index db60595cf6..0000000000 --- a/usr/src/lib/libc/common/sys/stat.s +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "stat.s" - -/* C library -- stat */ -/* int stat (const char *path, struct stat *buf); */ - -#include <sys/asm_linkage.h> - -#if !defined(_LARGEFILE_SOURCE) - ANSI_PRAGMA_WEAK(stat,function) -#else - ANSI_PRAGMA_WEAK(stat64,function) -#endif - -#include "SYS.h" - -#if !defined(_LARGEFILE_SOURCE) - - SYSCALL_RVAL1(stat) - RETC - SET_SIZE(stat) - -#else - -/* C library -- stat64 - transitional API */ -/* int stat64 (const char *path, struct stat64 *buf); */ - - SYSCALL_RVAL1(stat64) - RETC - SET_SIZE(stat64) - -#endif diff --git a/usr/src/lib/libc/common/sys/unlink.s b/usr/src/lib/libc/common/sys/unlink.s deleted file mode 100644 index 427ed54c15..0000000000 --- a/usr/src/lib/libc/common/sys/unlink.s +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - - -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "unlink.s" - -/* C library -- unlink */ -/* int unlink (const char *path); */ - -#include <sys/asm_linkage.h> - - ANSI_PRAGMA_WEAK(unlink,function) - -#include "SYS.h" - - SYSCALL_RVAL1(unlink) - RETC - SET_SIZE(unlink) diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com index b4e26c8f67..cf40cf18d2 100644 --- a/usr/src/lib/libc/i386/Makefile.com +++ b/usr/src/lib/libc/i386/Makefile.com @@ -145,19 +145,14 @@ GENOBJS= \ # sysobjs that contain large-file interfaces COMSYSOBJS64= \ - creat64.o \ - fstat64.o \ fstatvfs64.o \ getdents64.o \ getrlimit64.o \ lseek64.o \ - lstat64.o \ mmap64.o \ - open64.o \ pread64.o \ pwrite64.o \ setrlimit64.o \ - stat64.o \ statvfs64.o SYSOBJS64= @@ -194,7 +189,6 @@ COMSYSOBJS= \ _so_socket.o \ _so_socketpair.o \ _sockconfig.o \ - access.o \ acct.o \ acl.o \ adjtime.o \ @@ -202,23 +196,17 @@ COMSYSOBJS= \ brk.o \ chdir.o \ chmod.o \ - chown.o \ chroot.o \ cladm.o \ close.o \ - creat.o \ - dup.o \ execve.o \ exit.o \ facl.o \ fchdir.o \ fchmod.o \ - fchown.o \ fchroot.o \ - fcntl.o \ fdsync.o \ fpathconf.o \ - fstat.o \ fstatfs.o \ fstatvfs.o \ getcpuid.o \ @@ -240,11 +228,9 @@ COMSYSOBJS= \ ioctl.o \ kaio.o \ kill.o \ - lchown.o \ link.o \ llseek.o \ lseek.o \ - lstat.o \ mmapobjsys.o \ memcntl.o \ mincore.o \ @@ -258,7 +244,6 @@ COMSYSOBJS= \ nice.o \ ntp_adjtime.o \ ntp_gettime.o \ - open.o \ p_online.o \ pathconf.o \ pause.o \ @@ -275,9 +260,7 @@ COMSYSOBJS= \ read.o \ readlink.o \ readv.o \ - rename.o \ resolvepath.o \ - rmdir.o \ seteguid.o \ setgid.o \ setgroups.o \ @@ -289,7 +272,6 @@ COMSYSOBJS= \ sigprocmsk.o \ sigsendset.o \ sigsuspend.o \ - stat.o \ statfs.o \ statvfs.o \ stty.o \ @@ -303,7 +285,6 @@ COMSYSOBJS= \ ulimit.o \ umask.o \ umount2.o \ - unlink.o \ utssys.o \ uucopy.o \ vhangup.o \ @@ -321,11 +302,9 @@ SYSOBJS= \ door.o \ forkx.o \ forkallx.o \ - fxstat.o \ getcontext.o \ gettimeofday.o \ lwp_private.o \ - lxstat.o \ nuname.o \ pipe.o \ ptrace.o \ @@ -336,7 +315,6 @@ SYSOBJS= \ umount.o \ uname.o \ vforkx.o \ - xmknod.o \ xstat.o # objects under ../port which contain transitional large file interfaces @@ -418,7 +396,7 @@ PORTGEN= \ dirname.o \ div.o \ drand48.o \ - dup2.o \ + dup.o \ env_data.o \ err.o \ errno.o \ @@ -822,29 +800,27 @@ UNWINDASMOBJS= \ # objects that implement the transitional large file API PORTSYS64= \ - fstatat64.o \ lockf64.o \ - openat64.o + stat64.o PORTSYS= \ _autofssys.o \ + access.o \ acctctl.o \ bsd_signal.o \ + chown.o \ corectl.o \ exacctsys.o \ execl.o \ execle.o \ execv.o \ - fsmisc.o \ - fstatat.o \ + fcntl.o \ getpagesizes.o \ getpeerucred.o \ inst_sync.o \ issetugid.o \ label.o \ - libc_fcntl.o \ libc_link.o \ - libc_open.o \ lockf.o \ lwp.o \ lwp_cond.o \ @@ -853,12 +829,13 @@ PORTSYS= \ meminfosys.o \ msgsys.o \ nfssys.o \ - openat.o \ + open.o \ pgrpsys.o \ posix_sigwait.o \ ppriv.o \ psetsys.o \ rctlsys.o \ + rename.o \ sbrk.o \ semsys.o \ set_errno.o \ @@ -869,10 +846,12 @@ PORTSYS= \ signal.o \ sigpending.o \ sigstack.o \ + stat.o \ tasksys.o \ time.o \ time_util.o \ ucontext.o \ + unlink.o \ ustat.o \ utimesys.o \ zone.o @@ -985,6 +964,11 @@ CPPFLAGS= -D_REENTRANT -Di386 $(EXTN_CPPFLAGS) $(THREAD_DEBUG) \ -I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master) ASFLAGS= $(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) $(i386_AS_XARCH) +# As a favor to the dtrace syscall provider, libc still calls the +# old syscall traps that have been obsoleted by the *at() interfaces. +# Delete this to compile libc using only the new *at() system call traps +CPPFLAGS += -D_RETAIN_OLD_SYSCALLS + # Conditionally add support for making |wordexp()| check whether # /usr/bin/ksh is ksh93 or not include ../../../Makefile.ksh93switch diff --git a/usr/src/lib/libc/i386/crt/_rtboot.s b/usr/src/lib/libc/i386/crt/_rtboot.s index e21c5cb956..fa928906e9 100644 --- a/usr/src/lib/libc/i386/crt/_rtboot.s +++ b/usr/src/lib/libc/i386/crt/_rtboot.s @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -112,11 +113,11 @@ __rtboot: pushl %eax leal f.SYSCONFIG - .L01(%ebx),%eax pushl %eax - leal f.FSTAT - .L01(%ebx),%eax + leal f.FSTATAT - .L01(%ebx),%eax pushl %eax leal f.MMAP - .L01(%ebx),%eax pushl %eax - leal f.OPEN - .L01(%ebx),%eax + leal f.OPENAT - .L01(%ebx),%eax pushl %eax leal f.PANIC - .L01(%ebx),%eax pushl %eax @@ -151,8 +152,8 @@ f.PANIC: jmp f.EXIT / Not reached -f.OPEN: - movl $SYS_open,%eax +f.OPENAT: + movl $SYS_openat,%eax jmp __syscall f.MMAP: movl $SYS_mmap,%eax @@ -172,8 +173,8 @@ f.LSEEK: f.CLOSE: movl $SYS_close,%eax jmp __syscall -f.FSTAT: - movl $SYS_fxstat,%eax / NEEDSWORK: temp kludge for G6 +f.FSTATAT: + movl $SYS_fstatat,%eax jmp __syscall f.SYSCONFIG: movl $SYS_sysconfig,%eax diff --git a/usr/src/lib/libc/i386/crt/_rtld.c b/usr/src/lib/libc/i386/crt/_rtld.c index d7eaa323b8..92c9e53c55 100644 --- a/usr/src/lib/libc/i386/crt/_rtld.c +++ b/usr/src/lib/libc/i386/crt/_rtld.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,16 +18,15 @@ * * CDDL HEADER END */ -#pragma ident "%Z%%M% %I% %E% SMI" /* - * Redirection ld.so. Based on the 4.x binary compatibility ld.so, used - * to redirect aliases for ld.so to the real one. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ /* - * Copyright (c) 1990, 1991, 2001 by Sun Microsystems, Inc. - * All rights reserved. + * Redirection ld.so. Based on the 4.x binary compatibility ld.so, used + * to redirect aliases for ld.so to the real one. */ /* @@ -56,10 +54,10 @@ #define LDSO strings[LDSO_S] #define ZERO strings[ZERO_S] #define CLOSE (*(funcs[CLOSE_F])) -#define FSTAT (*(funcs[FSTAT_F])) +#define FSTATAT (*(funcs[FSTATAT_F])) #define MMAP (*(funcs[MMAP_F])) #define MUNMAP (*(funcs[MUNMAP_F])) -#define OPEN (*(funcs[OPEN_F])) +#define OPENAT (*(funcs[OPENAT_F])) #define PANIC (*(funcs[PANIC_F])) #define SYSCONFIG (*(funcs[SYSCONFIG_F])) @@ -134,10 +132,9 @@ __rtld(Elf32_Boot *ebp, const char *strings[], int (*funcs[])()) * data structures. Further mappings will actually establish the * program in the address space. */ - if ((ldfd = OPEN(LDSO, O_RDONLY)) == -1) + if ((ldfd = OPENAT(AT_FDCWD, LDSO, O_RDONLY)) == -1) PANIC(program_name); -/* NEEDSWORK (temp kludge to use xstat so we can run on G6) */ - if (FSTAT(2, ldfd, &sb) == -1) + if (FSTATAT(ldfd, NULL, &sb, 0) == -1) PANIC(program_name); ehdr = (Elf32_Ehdr *)MMAP(0, sb.st_size, PROT_READ | PROT_EXEC, MAP_SHARED, ldfd, 0); @@ -291,7 +288,7 @@ __rtld(Elf32_Boot *ebp, const char *strings[], int (*funcs[])()) j = (faddr + pptr->p_vaddr + pptr->p_memsz) - zaddr; if (j > 0) { if (dzfd == 0) { - dzfd = OPEN(ZERO, O_RDWR); + dzfd = OPENAT(AT_FDCWD, ZERO, O_RDWR); if (dzfd == -1) PANIC(program_name); } diff --git a/usr/src/lib/libc/i386/crt/alias_boot.h b/usr/src/lib/libc/i386/crt/alias_boot.h index d6828f6fc8..e2a96f933a 100644 --- a/usr/src/lib/libc/i386/crt/alias_boot.h +++ b/usr/src/lib/libc/i386/crt/alias_boot.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,15 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 1991 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #ifndef _ALIAS_BOOT_H #define _ALIAS_BOOT_H -#ident "%W% %E% SMI" - /* * Offsets for string constants used in alias bootstrap. */ @@ -40,9 +39,9 @@ * Offsets for function pointers used in alias bootstrap. */ #define PANIC_F 0 /* panic() */ -#define OPEN_F 1 /* open() */ +#define OPENAT_F 1 /* openat() */ #define MMAP_F 2 /* mmap() */ -#define FSTAT_F 3 /* fstat() */ +#define FSTATAT_F 3 /* fstatat() */ #define SYSCONFIG_F 4 /* sysconfig() */ #define CLOSE_F 5 /* close() */ #define MUNMAP_F 6 /* munmap() */ diff --git a/usr/src/lib/libc/i386/sys/fxstat.s b/usr/src/lib/libc/i386/sys/fxstat.s deleted file mode 100644 index da3eb8f5c0..0000000000 --- a/usr/src/lib/libc/i386/sys/fxstat.s +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "fxstat.s" - -#include "SYS.h" - -/ error = _fxstat(file, statbuf); -/ char statbuf[34] - - ENTRY(_fxstat) - SYSTRAP_RVAL1(fxstat) - SYSCERROR - RETC - SET_SIZE(_fxstat) diff --git a/usr/src/lib/libc/i386/sys/lxstat.s b/usr/src/lib/libc/i386/sys/lxstat.s deleted file mode 100644 index 9e9d3af63c..0000000000 --- a/usr/src/lib/libc/i386/sys/lxstat.s +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "lxstat.s" - -/ int -/ _lxstat(_STAT_VER, _path, _buf); - -#include "SYS.h" - - ENTRY(_lxstat) - SYSTRAP_RVAL1(lxstat) - SYSCERROR - RETC - SET_SIZE(_lxstat) diff --git a/usr/src/lib/libc/i386/sys/xmknod.s b/usr/src/lib/libc/i386/sys/xmknod.s deleted file mode 100644 index e8a9421dcc..0000000000 --- a/usr/src/lib/libc/i386/sys/xmknod.s +++ /dev/null @@ -1,38 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "xmknod.s" - -/ OS library -- _xmknod - -/ error = _xmknod(version, string, mode, dev) - -#include "SYS.h" - - ENTRY(_xmknod) - SYSTRAP_RVAL1(xmknod) - SYSCERROR - RETC - SET_SIZE(_xmknod) diff --git a/usr/src/lib/libc/i386/sys/xstat.c b/usr/src/lib/libc/i386/sys/xstat.c new file mode 100644 index 0000000000..69637eccfb --- /dev/null +++ b/usr/src/lib/libc/i386/sys/xstat.c @@ -0,0 +1,80 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * Wrapper functions to intercept calls to the obsolete + * _xstat(), _lxstat(), _fxstat() and _xmknod() functions + * and redirect them to the proper direct system calls. + */ + +#include "lint.h" +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> + +int +_xstat(int version, const char *path, struct stat *statb) +{ + if (version != _STAT_VER) { + errno = EINVAL; + return (-1); + } + return (stat(path, statb)); +} + +int +_lxstat(int version, const char *path, struct stat *statb) +{ + if (version != _STAT_VER) { + errno = EINVAL; + return (-1); + } + return (lstat(path, statb)); +} + +int +_fxstat(int version, int fd, struct stat *statb) +{ + if (version != _STAT_VER) { + errno = EINVAL; + return (-1); + } + return (fstat(fd, statb)); +} + +int +_xmknod(int version, const char *path, mode_t mode, dev_t dev) +{ + if (version != _MKNOD_VER) { + errno = EINVAL; + return (-1); + } + return (mknod(path, mode, dev)); +} diff --git a/usr/src/lib/libc/i386/sys/xstat.s b/usr/src/lib/libc/i386/sys/xstat.s deleted file mode 100644 index 8581a5f2af..0000000000 --- a/usr/src/lib/libc/i386/sys/xstat.s +++ /dev/null @@ -1,38 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - - .file "xstat.s" - -/ OS library -- _xstat - -/ error = _xstat(version, string, statbuf) - -#include "SYS.h" - - ENTRY(_xstat) - SYSTRAP_RVAL1(xstat) - SYSCERROR - RETC - SET_SIZE(_xstat) diff --git a/usr/src/lib/libc/inc/libc.h b/usr/src/lib/libc/inc/libc.h index 4059d08d8e..5feca8b80f 100644 --- a/usr/src/lib/libc/inc/libc.h +++ b/usr/src/lib/libc/inc/libc.h @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -32,8 +32,6 @@ #ifndef _LIBC_H #define _LIBC_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <thread.h> #include <stdio.h> #include <dirent.h> @@ -118,6 +116,13 @@ extern enum fp_direction_type _QgetRD(void); #error Unknown architecture! #endif +/* + * defined in open.c + */ +extern int __open(const char *, int, mode_t); +extern int __open64(const char *, int, mode_t); +extern int __openat(int, const char *, int, mode_t); +extern int __openat64(int, const char *, int, mode_t); /* * defined in hex_bin.c diff --git a/usr/src/lib/libc/inc/thr_uberdata.h b/usr/src/lib/libc/inc/thr_uberdata.h index 4d1272105c..ac14038787 100644 --- a/usr/src/lib/libc/inc/thr_uberdata.h +++ b/usr/src/lib/libc/inc/thr_uberdata.h @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1354,7 +1354,10 @@ extern void _thrp_unwind(void *); extern pid_t __forkx(int); extern pid_t __forkallx(int); -extern int __open(const char *, int, ...); +extern int __open(const char *, int, mode_t); +extern int __open64(const char *, int, mode_t); +extern int __openat(int, const char *, int, mode_t); +extern int __openat64(int, const char *, int, mode_t); extern int __close(int); extern ssize_t __read(int, void *, size_t); extern ssize_t __write(int, const void *, size_t); diff --git a/usr/src/lib/libc/port/gen/attrat.c b/usr/src/lib/libc/port/gen/attrat.c index 725bdd9b12..89163a3909 100644 --- a/usr/src/lib/libc/port/gen/attrat.c +++ b/usr/src/lib/libc/port/gen/attrat.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -33,7 +34,7 @@ #include <sys/types.h> #include <sys/syscall.h> #include <sys/stat.h> -#include <sys/filio.h> +#include <sys/file.h> #include <unistd.h> #include <dlfcn.h> #include <stdio.h> @@ -47,13 +48,18 @@ static int (*nvlookupint64)(nvlist_t *, const char *, uint64_t *); static mutex_t attrlock = DEFAULTMUTEX; static int initialized; -extern int __openattrdirat(int basefd, const char *name); static char *xattr_view_name[XATTR_VIEW_LAST] = { VIEW_READONLY, VIEW_READWRITE }; +int +__openattrdirat(int fd, const char *name) +{ + return (syscall(SYS_openat, fd, name, FXATTRDIROPEN, 0)); +} + static int attrat_init() { diff --git a/usr/src/lib/libc/port/gen/dup2.c b/usr/src/lib/libc/port/gen/dup.c index 9708d3afb3..8b5db30b19 100644 --- a/usr/src/lib/libc/port/gen/dup2.c +++ b/usr/src/lib/libc/port/gen/dup.c @@ -20,21 +20,25 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#pragma weak _dup2 = dup2 - #include "lint.h" #include <sys/types.h> #include <fcntl.h> +#pragma weak _dup = dup +int +dup(int fildes) +{ + return (fcntl(fildes, F_DUPFD, 0)); +} + +#pragma weak _dup2 = dup2 int dup2(int fildes, int fildes2) { diff --git a/usr/src/lib/libc/common/sys/creat.s b/usr/src/lib/libc/port/sys/access.c index a2922eb974..0bf92311b6 100644 --- a/usr/src/lib/libc/common/sys/creat.s +++ b/usr/src/lib/libc/port/sys/access.c @@ -19,32 +19,29 @@ * CDDL HEADER END */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - .file "creat.s" - -#include "SYS.h" - -#if !defined(_LARGEFILE_SOURCE) -/* C library -- creat */ -/* int __creat(char *path, mode_t mode) */ - - SYSCALL2_RVAL1(__creat,creat) - RET - SET_SIZE(__creat) - +#include "lint.h" +#include <unistd.h> +#include <sys/syscall.h> +#include <sys/fcntl.h> + +int +faccessat(int fd, const char *fname, int amode, int flag) +{ + return (syscall(SYS_faccessat, fd, fname, amode, flag)); +} + +#pragma weak _access = access +int +access(const char *fname, int amode) +{ +#if defined(_RETAIN_OLD_SYSCALLS) + return (syscall(SYS_access, fname, amode)); #else -/* C library -- creat64 */ -/* int __creat64(char *path, mode_t mode) */ - - SYSCALL2_RVAL1(__creat64,creat64) - RET - SET_SIZE(__creat64) - + return (faccessat(AT_FDCWD, fname, amode, 0)); #endif +} diff --git a/usr/src/lib/libc/port/sys/fsmisc.c b/usr/src/lib/libc/port/sys/chown.c index 5ca207adaf..5ea62e12ce 100644 --- a/usr/src/lib/libc/port/sys/fsmisc.c +++ b/usr/src/lib/libc/port/sys/chown.c @@ -20,44 +20,53 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma weak _fchownat = fchownat -#pragma weak _unlinkat = unlinkat - #include "lint.h" +#include <stdio.h> +#include <unistd.h> #include <sys/types.h> #include <sys/syscall.h> -#include <sys/stat.h> +#include <sys/fcntl.h> +#pragma weak _fchownat = fchownat int fchownat(int fd, const char *name, uid_t uid, gid_t gid, int flags) { - return (syscall(SYS_fsat, 4, fd, name, uid, gid, flags)); -} - -int -unlinkat(int fd, const char *name, int flags) -{ - return (syscall(SYS_fsat, 5, fd, name, flags)); + return (syscall(SYS_fchownat, fd, name, uid, gid, flags)); } +#pragma weak _chown = chown int -renameat(int fromfd, const char *fromname, int tofd, const char *toname) +chown(const char *name, uid_t uid, gid_t gid) { - return (syscall(SYS_fsat, 7, fromfd, fromname, tofd, toname)); +#if defined(_RETAIN_OLD_SYSCALLS) + return (syscall(SYS_chown, name, uid, gid)); +#else + return (fchownat(AT_FDCWD, name, uid, gid, 0)); +#endif } +#pragma weak _lchown = lchown int -faccessat(int fd, const char *fname, int amode, int flag) +lchown(const char *name, uid_t uid, gid_t gid) { - return (syscall(SYS_fsat, 8, fd, fname, amode, flag)); +#if defined(_RETAIN_OLD_SYSCALLS) + return (syscall(SYS_lchown, name, uid, gid)); +#else + return (fchownat(AT_FDCWD, name, uid, gid, AT_SYMLINK_NOFOLLOW)); +#endif } +#pragma weak _fchown = fchown int -__openattrdirat(int fd, const char *name) +fchown(int filedes, uid_t uid, gid_t gid) { - return (syscall(SYS_fsat, 9, fd, name)); +#if defined(_RETAIN_OLD_SYSCALLS) + return (syscall(SYS_fchown, filedes, uid, gid)); +#else + return (fchownat(filedes, NULL, uid, gid, 0)); +#endif } diff --git a/usr/src/lib/libc/port/sys/libc_fcntl.c b/usr/src/lib/libc/port/sys/fcntl.c index beab99f74c..cea7e79dd2 100644 --- a/usr/src/lib/libc/port/sys/libc_fcntl.c +++ b/usr/src/lib/libc/port/sys/fcntl.c @@ -20,15 +20,13 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "lint.h" #include <sys/param.h> #include <sys/sockio.h> @@ -52,8 +50,6 @@ #include <stdlib.h> #include "libc.h" -extern int __fcntl_syscall(int fd, int cmd, ...); - #if !defined(_LP64) /* * XXX these hacks are needed for X.25 which assumes that s_fcntl and @@ -92,6 +88,6 @@ __fcntl(int fd, int cmd, ...) return (res); default: - return (__fcntl_syscall(fd, cmd, arg)); + return (syscall(SYS_fcntl, fd, cmd, arg)); } } diff --git a/usr/src/lib/libc/port/sys/libc_open.c b/usr/src/lib/libc/port/sys/open.c index ad9d07d7fd..067bb72d69 100644 --- a/usr/src/lib/libc/port/sys/libc_open.c +++ b/usr/src/lib/libc/port/sys/open.c @@ -20,15 +20,13 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "lint.h" #include <sys/mkdev.h> #include <limits.h> @@ -37,72 +35,71 @@ #include <strings.h> #include <errno.h> #include <sys/stat.h> +#include <sys/fcntl.h> #include <sys/stropts.h> #include <sys/stream.h> #include <sys/ptms.h> +#include <sys/syscall.h> #include "libc.h" -#if !defined(_LP64) -extern int __open64_syscall(const char *fname, int oflag, mode_t mode); -#endif - -extern int __open_syscall(const char *fname, int oflag, mode_t mode); - +static int xpg4_fixup(int fd); static void push_module(int fd); static int isptsfd(int fd); static void itoa(int i, char *ptr); int -__open(const char *fname, int oflag, ...) +__openat(int dfd, const char *path, int oflag, mode_t mode) { - mode_t mode; - int fd; - va_list ap; - - va_start(ap, oflag); - mode = va_arg(ap, mode_t); - va_end(ap); - - /* - * XPG4v2 requires that open of a slave pseudo terminal device - * provides the process with an interface that is identical to - * the terminal interface. For a more detailed discussion, - * see bugid 4025044. - */ - fd = __open_syscall(fname, oflag, mode); - if (libc__xpg4 != 0 && fd >= 0 && isptsfd(fd)) - push_module(fd); - return (fd); + int fd = syscall(SYS_openat, dfd, path, oflag, mode); + return (xpg4_fixup(fd)); +} + +int +__open(const char *path, int oflag, mode_t mode) +{ +#if defined(_RETAIN_OLD_SYSCALLS) + int fd = syscall(SYS_open, path, oflag, mode); + return (xpg4_fixup(fd)); +#else + return (__openat(AT_FDCWD, path, oflag, mode)); +#endif } #if !defined(_LP64) + +int +__openat64(int dfd, const char *path, int oflag, mode_t mode) +{ + int fd = syscall(SYS_openat64, dfd, path, oflag, mode); + return (xpg4_fixup(fd)); +} + +int +__open64(const char *path, int oflag, mode_t mode) +{ +#if defined(_RETAIN_OLD_SYSCALLS) + int fd = syscall(SYS_open64, path, oflag, mode); + return (xpg4_fixup(fd)); +#else + return (__openat64(AT_FDCWD, path, oflag, mode)); +#endif +} + +#endif /* !_LP64 */ + /* - * The 32-bit APIs to large files require this interposition. - * The 64-bit APIs just fall back to __open() above. + * XPG4v2 requires that open of a slave pseudo terminal device + * provides the process with an interface that is identical to + * the terminal interface. For a more detailed discussion, + * see bugid 4025044. */ -int -__open64(const char *fname, int oflag, ...) +static int +xpg4_fixup(int fd) { - mode_t mode; - int fd; - va_list ap; - - va_start(ap, oflag); - mode = va_arg(ap, mode_t); - va_end(ap); - - /* - * XPG4v2 requires that open of a slave pseudo terminal device - * provides the process with an interface that is identical to - * the terminal interface. For a more detailed discussion, - * see bugid 4025044. - */ - fd = __open64_syscall(fname, oflag, mode); if (libc__xpg4 != 0 && fd >= 0 && isptsfd(fd)) push_module(fd); return (fd); } -#endif /* !_LP64 */ /* * Check if the file matches an entry in the /dev/pts directory. diff --git a/usr/src/lib/libc/port/sys/fstatat.c b/usr/src/lib/libc/port/sys/rename.c index 15c9d3b0cb..7f321e091c 100644 --- a/usr/src/lib/libc/port/sys/fstatat.c +++ b/usr/src/lib/libc/port/sys/rename.c @@ -20,37 +20,29 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 -#pragma weak _fstatat64 = fstatat64 -#else -#pragma weak _fstatat = fstatat -#endif - #include "lint.h" -#include <sys/types.h> +#include <stdio.h> +#include <unistd.h> #include <sys/syscall.h> -#include <sys/stat.h> - -#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 +#include <sys/fcntl.h> int -fstatat64(int fd, const char *name, struct stat64 *sb, int flags) +renameat(int oldfd, const char *oldname, int newfd, const char *newname) { - return (syscall(SYS_fsat, 2, fd, name, sb, flags)); + return (syscall(SYS_renameat, oldfd, oldname, newfd, newname)); } -#else - +#pragma weak _rename = rename int -fstatat(int fd, const char *name, struct stat *sb, int flags) +rename(const char *oldname, const char *newname) { - return (syscall(SYS_fsat, 3, fd, name, sb, flags)); -} - +#if defined(_RETAIN_OLD_SYSCALLS) + return (syscall(SYS_rename, oldname, newname)); +#else + return (renameat(AT_FDCWD, oldname, AT_FDCWD, newname)); #endif +} diff --git a/usr/src/lib/libc/port/sys/stat.c b/usr/src/lib/libc/port/sys/stat.c new file mode 100644 index 0000000000..f09c7ed1a8 --- /dev/null +++ b/usr/src/lib/libc/port/sys/stat.c @@ -0,0 +1,117 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include "lint.h" +#include <sys/types.h> +#include <sys/syscall.h> +#include <sys/stat.h> +#include <sys/fcntl.h> + +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 + +#pragma weak _fstatat64 = fstatat64 +int +fstatat64(int fd, const char *name, struct stat64 *sb, int flags) +{ + return (syscall(SYS_fstatat64, fd, name, sb, flags)); +} + +#pragma weak _stat64 = stat64 +int +stat64(const char *name, struct stat64 *sb) +{ +#if defined(_RETAIN_OLD_SYSCALLS) + return (syscall(SYS_stat64, name, sb)); +#else + return (fstatat64(AT_FDCWD, name, sb, 0)); +#endif +} + +#pragma weak _lstat64 = lstat64 +int +lstat64(const char *name, struct stat64 *sb) +{ +#if defined(_RETAIN_OLD_SYSCALLS) + return (syscall(SYS_lstat64, name, sb)); +#else + return (fstatat64(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); +#endif +} + +#pragma weak _fstat64 = fstat64 +int +fstat64(int fd, struct stat64 *sb) +{ +#if defined(_RETAIN_OLD_SYSCALLS) + return (syscall(SYS_fstat64, fd, sb)); +#else + return (fstatat64(fd, NULL, sb, 0)); +#endif +} + +#else /* !defined(_LP64) && _FILE_OFFSET_BITS == 64 */ + +#pragma weak _fstatat = fstatat +int +fstatat(int fd, const char *name, struct stat *sb, int flags) +{ + return (syscall(SYS_fstatat, fd, name, sb, flags)); +} + +#pragma weak _stat = stat +int +stat(const char *name, struct stat *sb) +{ +#if defined(_RETAIN_OLD_SYSCALLS) + return (syscall(SYS_stat, name, sb)); +#else + return (fstatat(AT_FDCWD, name, sb, 0)); +#endif +} + +#pragma weak _lstat = lstat +int +lstat(const char *name, struct stat *sb) +{ +#if defined(_RETAIN_OLD_SYSCALLS) + return (syscall(SYS_lstat, name, sb)); +#else + return (fstatat(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); +#endif +} + +#pragma weak _fstat = fstat +int +fstat(int fd, struct stat *sb) +{ +#if defined(_RETAIN_OLD_SYSCALLS) + return (syscall(SYS_fstat, fd, sb)); +#else + return (fstatat(fd, NULL, sb, 0)); +#endif +} + +#endif /* !defined(_LP64) && _FILE_OFFSET_BITS == 64 */ diff --git a/usr/src/lib/libc/port/sys/openat.c b/usr/src/lib/libc/port/sys/unlink.c index 0a15a8746d..209eb4ad56 100644 --- a/usr/src/lib/libc/port/sys/openat.c +++ b/usr/src/lib/libc/port/sys/unlink.c @@ -20,43 +20,40 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "lint.h" -#include <stdarg.h> -#include <sys/types.h> +#include <unistd.h> #include <sys/syscall.h> +#include <sys/fcntl.h> -#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 - +#pragma weak _unlinkat = unlinkat int -__openat64(int fd, const char *name, int oflag, ...) +unlinkat(int fd, const char *name, int flags) { - va_list ap; - mode_t mode; - - va_start(ap, oflag); - mode = va_arg(ap, mode_t); - va_end(ap); - return (syscall(SYS_fsat, 1, fd, name, oflag, mode)); + return (syscall(SYS_unlinkat, fd, name, flags)); } -#else - +#pragma weak _unlink = unlink int -__openat(int fd, const char *name, int oflag, ...) +unlink(const char *name) { - va_list ap; - mode_t mode; - - va_start(ap, oflag); - mode = va_arg(ap, mode_t); - va_end(ap); - return (syscall(SYS_fsat, 0, fd, name, oflag, mode)); +#if defined(_RETAIN_OLD_SYSCALLS) + return (syscall(SYS_unlink, name)); +#else + return (unlinkat(AT_FDCWD, name, 0)); +#endif } +#pragma weak _rmdir = rmdir +int +rmdir(const char *name) +{ +#if defined(_RETAIN_OLD_SYSCALLS) + return (syscall(SYS_rmdir, name)); +#else + return (unlinkat(AT_FDCWD, name, AT_REMOVEDIR)); #endif +} diff --git a/usr/src/lib/libc/port/threads/scalls.c b/usr/src/lib/libc/port/threads/scalls.c index 337ed35554..368b864d3f 100644 --- a/usr/src/lib/libc/port/threads/scalls.c +++ b/usr/src/lib/libc/port/threads/scalls.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -727,26 +727,6 @@ close(int fildes) } int -creat(const char *path, mode_t mode) -{ - extern int __creat(const char *, mode_t); - int rv; - - PERFORM(__creat(path, mode)) -} - -#if !defined(_LP64) -int -creat64(const char *path, mode_t mode) -{ - extern int __creat64(const char *, mode_t); - int rv; - - PERFORM(__creat64(path, mode)) -} -#endif /* !_LP64 */ - -int door_call(int d, door_arg_t *params) { extern int __door_call(int, door_arg_t *); @@ -837,9 +817,8 @@ msync(caddr_t addr, size_t len, int flags) } int -open(const char *path, int oflag, ...) +openat(int fd, const char *path, int oflag, ...) { - extern int __open(const char *, int, ...); mode_t mode; int rv; va_list ap; @@ -847,13 +826,12 @@ open(const char *path, int oflag, ...) va_start(ap, oflag); mode = va_arg(ap, mode_t); va_end(ap); - PERFORM(__open(path, oflag, mode)) + PERFORM(__openat(fd, path, oflag, mode)) } int -openat(int fd, const char *path, int oflag, ...) +open(const char *path, int oflag, ...) { - extern int __openat(int, const char *, int, ...); mode_t mode; int rv; va_list ap; @@ -861,14 +839,19 @@ openat(int fd, const char *path, int oflag, ...) va_start(ap, oflag); mode = va_arg(ap, mode_t); va_end(ap); - PERFORM(__openat(fd, path, oflag, mode)) + PERFORM(__open(path, oflag, mode)) +} + +int +creat(const char *path, mode_t mode) +{ + return (open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)); } #if !defined(_LP64) int -open64(const char *path, int oflag, ...) +openat64(int fd, const char *path, int oflag, ...) { - extern int __open64(const char *, int, ...); mode_t mode; int rv; va_list ap; @@ -876,13 +859,12 @@ open64(const char *path, int oflag, ...) va_start(ap, oflag); mode = va_arg(ap, mode_t); va_end(ap); - PERFORM(__open64(path, oflag, mode)) + PERFORM(__openat64(fd, path, oflag, mode)) } int -openat64(int fd, const char *path, int oflag, ...) +open64(const char *path, int oflag, ...) { - extern int __openat64(int, const char *, int, ...); mode_t mode; int rv; va_list ap; @@ -890,7 +872,13 @@ openat64(int fd, const char *path, int oflag, ...) va_start(ap, oflag); mode = va_arg(ap, mode_t); va_end(ap); - PERFORM(__openat64(fd, path, oflag, mode)) + PERFORM(__open64(path, oflag, mode)) +} + +int +creat64(const char *path, mode_t mode) +{ + return (open64(path, O_WRONLY | O_CREAT | O_TRUNC, mode)); } #endif /* !_LP64 */ diff --git a/usr/src/lib/libc/port/threads/spawn.c b/usr/src/lib/libc/port/threads/spawn.c index 8228a25b64..fd91cf44cd 100644 --- a/usr/src/lib/libc/port/threads/spawn.c +++ b/usr/src/lib/libc/port/threads/spawn.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -76,7 +76,6 @@ extern int __sigaction(int, const struct sigaction *, struct sigaction *); #define getdents64 getdents #define dirent64_t dirent_t #else -extern int __open64(const char *, int, ...); extern int getdents64(int, dirent64_t *, size_t); #endif @@ -198,8 +197,7 @@ perform_file_actions(file_attr_t *fap, void *dirbuf) do { switch (fap->fa_type) { case FA_OPEN: - fd = __open(fap->fa_path, - fap->fa_oflag, fap->fa_mode); + fd = __open(fap->fa_path, fap->fa_oflag, fap->fa_mode); if (fd < 0) return (errno); if (fd != fap->fa_filedes) { diff --git a/usr/src/lib/libc/sparc/Makefile.com b/usr/src/lib/libc/sparc/Makefile.com index a7d66be272..67d166fa7c 100644 --- a/usr/src/lib/libc/sparc/Makefile.com +++ b/usr/src/lib/libc/sparc/Makefile.com @@ -155,19 +155,14 @@ GENOBJS= \ # sysobjs that contain large-file interfaces COMSYSOBJS64= \ - creat64.o \ - fstat64.o \ fstatvfs64.o \ getdents64.o \ getrlimit64.o \ lseek64.o \ - lstat64.o \ mmap64.o \ - open64.o \ pread64.o \ pwrite64.o \ setrlimit64.o \ - stat64.o \ statvfs64.o SYSOBJS64= @@ -204,7 +199,6 @@ COMSYSOBJS= \ _so_socket.o \ _so_socketpair.o \ _sockconfig.o \ - access.o \ acct.o \ acl.o \ adjtime.o \ @@ -212,23 +206,17 @@ COMSYSOBJS= \ brk.o \ chdir.o \ chmod.o \ - chown.o \ chroot.o \ cladm.o \ close.o \ - creat.o \ - dup.o \ execve.o \ exit.o \ facl.o \ fchdir.o \ fchmod.o \ - fchown.o \ fchroot.o \ - fcntl.o \ fdsync.o \ fpathconf.o \ - fstat.o \ fstatfs.o \ fstatvfs.o \ getcpuid.o \ @@ -250,11 +238,9 @@ COMSYSOBJS= \ ioctl.o \ kaio.o \ kill.o \ - lchown.o \ link.o \ llseek.o \ lseek.o \ - lstat.o \ memcntl.o \ mincore.o \ mkdir.o \ @@ -268,7 +254,6 @@ COMSYSOBJS= \ nice.o \ ntp_adjtime.o \ ntp_gettime.o \ - open.o \ p_online.o \ pathconf.o \ pause.o \ @@ -285,9 +270,7 @@ COMSYSOBJS= \ read.o \ readlink.o \ readv.o \ - rename.o \ resolvepath.o \ - rmdir.o \ seteguid.o \ setgid.o \ setgroups.o \ @@ -299,7 +282,6 @@ COMSYSOBJS= \ sigprocmsk.o \ sigsendset.o \ sigsuspend.o \ - stat.o \ statfs.o \ statvfs.o \ stty.o \ @@ -313,7 +295,6 @@ COMSYSOBJS= \ ulimit.o \ umask.o \ umount2.o \ - unlink.o \ utssys.o \ uucopy.o \ vhangup.o \ @@ -435,7 +416,7 @@ PORTGEN= \ dirname.o \ div.o \ drand48.o \ - dup2.o \ + dup.o \ env_data.o \ err.o \ errno.o \ @@ -841,29 +822,27 @@ UNWINDASMOBJS= \ # objects that implement the transitional large file API PORTSYS64= \ - fstatat64.o \ lockf64.o \ - openat64.o + stat64.o PORTSYS= \ _autofssys.o \ + access.o \ acctctl.o \ bsd_signal.o \ + chown.o \ corectl.o \ exacctsys.o \ execl.o \ execle.o \ execv.o \ - fsmisc.o \ - fstatat.o \ + fcntl.o \ getpagesizes.o \ getpeerucred.o \ inst_sync.o \ issetugid.o \ label.o \ - libc_fcntl.o \ libc_link.o \ - libc_open.o \ lockf.o \ lwp.o \ lwp_cond.o \ @@ -872,12 +851,13 @@ PORTSYS= \ meminfosys.o \ msgsys.o \ nfssys.o \ - openat.o \ + open.o \ pgrpsys.o \ posix_sigwait.o \ ppriv.o \ psetsys.o \ rctlsys.o \ + rename.o \ sbrk.o \ semsys.o \ set_errno.o \ @@ -888,10 +868,12 @@ PORTSYS= \ signal.o \ sigpending.o \ sigstack.o \ + stat.o \ tasksys.o \ time.o \ time_util.o \ ucontext.o \ + unlink.o \ ustat.o \ utimesys.o \ zone.o @@ -1002,6 +984,11 @@ CPPFLAGS= -D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) $(THREAD_DEBUG) \ -I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master) ASFLAGS= $(EXTN_ASFLAGS) -K pic -P -D__STDC__ -D_ASM $(CPPFLAGS) $(sparc_AS_XARCH) +# As a favor to the dtrace syscall provider, libc still calls the +# old syscall traps that have been obsoleted by the *at() interfaces. +# Delete this to compile libc using only the new *at() system call traps +CPPFLAGS += -D_RETAIN_OLD_SYSCALLS + # Conditionally add support for making |wordexp()| check whether # /usr/bin/ksh is ksh93 or not include $(LIBCDIR)/../../Makefile.ksh93switch diff --git a/usr/src/lib/libc/sparc/crt/_rtboot.s b/usr/src/lib/libc/sparc/crt/_rtboot.s index 5ae8505d9a..7764d40507 100644 --- a/usr/src/lib/libc/sparc/crt/_rtboot.s +++ b/usr/src/lib/libc/sparc/crt/_rtboot.s @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 2000 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ -#ident "%Z%%M% %I% %E% SMI" - .file "_rtboot.s" ! Bootstrap routine for alias ld.so. Control arrives here either directly @@ -78,8 +76,8 @@ .global __rtboot .local __rtld .local s.LDSO, s.ZERO - .local f.PANIC, f.OPEN, f.MMAP, f.FSTAT, f.SYSCONFIG, f.CLOSE, f.EXIT - .local f.MUNMAP + .local f.PANIC, f.OPENAT, f.MMAP, f.FSTATAT, f.SYSCONFIG + .local f.CLOSE, f.EXIT, f.MUNMAP .type __rtboot, #function .align 4 @@ -138,9 +136,9 @@ __rtboot: SI(ZERO) SI(EMPTY) FI(PANIC) - FI(OPEN) + FI(OPENAT) FI(MMAP) - FI(FSTAT) + FI(FSTATAT) FI(SYSCONFIG) FI(CLOSE) FI(MUNMAP) @@ -179,9 +177,9 @@ f.PANIC: ba f.EXIT ! leave nop -f.OPEN: +f.OPENAT: ba __syscall - mov SYS_open, %g1 + mov SYS_openat, %g1 f.MMAP: sethi %hi(0x80000000), %g1 ! MAP_NEW @@ -209,9 +207,9 @@ f.CLOSE: ba __syscall mov SYS_close, %g1 -f.FSTAT: +f.FSTATAT: ba __syscall - mov SYS_fstat, %g1 + mov SYS_fstatat, %g1 f.SYSCONFIG: ba __syscall diff --git a/usr/src/lib/libc/sparc/crt/_rtld.c b/usr/src/lib/libc/sparc/crt/_rtld.c index 50647dd10c..132aad09c0 100644 --- a/usr/src/lib/libc/sparc/crt/_rtld.c +++ b/usr/src/lib/libc/sparc/crt/_rtld.c @@ -20,12 +20,10 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Redirection ld.so. Based on the 4.x binary compatibility ld.so, used * to redirect aliases for ld.so to the real one. @@ -56,10 +54,10 @@ #define LDSO strings[LDSO_S] #define ZERO strings[ZERO_S] #define CLOSE (*(funcs[CLOSE_F])) -#define FSTAT (*(funcs[FSTAT_F])) +#define FSTATAT (*(funcs[FSTATAT_F])) #define MMAP (*(funcs[MMAP_F])) #define MUNMAP (*(funcs[MUNMAP_F])) -#define OPEN (*(funcs[OPEN_F])) +#define OPENAT (*(funcs[OPENAT_F])) #define PANIC (*(funcs[PANIC_F])) #define SYSCONFIG (*(funcs[SYSCONFIG_F])) @@ -133,9 +131,9 @@ __rtld(Elf32_Boot *ebp, const char *strings[], int (*funcs[])()) * data structures. Further mappings will actually establish the * program in the address space. */ - if ((ldfd = OPEN(LDSO, O_RDONLY)) == -1) + if ((ldfd = OPENAT(AT_FDCWD, LDSO, O_RDONLY)) == -1) PANIC(program_name); - if (FSTAT(ldfd, &sb) == -1) + if (FSTATAT(ldfd, NULL, &sb, 0) == -1) PANIC(program_name); ehdr = (Elf32_Ehdr *)MMAP(0, sb.st_size, PROT_READ | PROT_EXEC, MAP_SHARED, ldfd, 0); @@ -291,7 +289,7 @@ __rtld(Elf32_Boot *ebp, const char *strings[], int (*funcs[])()) j = (faddr + pptr->p_vaddr + pptr->p_memsz) - zaddr; if (j > 0) { if (dzfd == 0) { - dzfd = OPEN(ZERO, O_RDWR); + dzfd = OPENAT(AT_FDCWD, ZERO, O_RDWR); if (dzfd == -1) PANIC(program_name); } diff --git a/usr/src/lib/libc/sparc/crt/alias_boot.h b/usr/src/lib/libc/sparc/crt/alias_boot.h index 754d480841..e2a96f933a 100644 --- a/usr/src/lib/libc/sparc/crt/alias_boot.h +++ b/usr/src/lib/libc/sparc/crt/alias_boot.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,15 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 1991 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #ifndef _ALIAS_BOOT_H #define _ALIAS_BOOT_H -#ident "%Z%%M% %I% %E% SMI" - /* * Offsets for string constants used in alias bootstrap. */ @@ -40,9 +39,9 @@ * Offsets for function pointers used in alias bootstrap. */ #define PANIC_F 0 /* panic() */ -#define OPEN_F 1 /* open() */ +#define OPENAT_F 1 /* openat() */ #define MMAP_F 2 /* mmap() */ -#define FSTAT_F 3 /* fstat() */ +#define FSTATAT_F 3 /* fstatat() */ #define SYSCONFIG_F 4 /* sysconfig() */ #define CLOSE_F 5 /* close() */ #define MUNMAP_F 6 /* munmap() */ diff --git a/usr/src/lib/libc/sparcv9/Makefile.com b/usr/src/lib/libc/sparcv9/Makefile.com index b88e9ba202..d3a3e2e63d 100644 --- a/usr/src/lib/libc/sparcv9/Makefile.com +++ b/usr/src/lib/libc/sparcv9/Makefile.com @@ -186,7 +186,6 @@ COMSYSOBJS= \ _so_socket.o \ _so_socketpair.o \ _sockconfig.o \ - access.o \ acct.o \ acl.o \ adjtime.o \ @@ -194,23 +193,17 @@ COMSYSOBJS= \ brk.o \ chdir.o \ chmod.o \ - chown.o \ chroot.o \ cladm.o \ close.o \ - creat.o \ - dup.o \ execve.o \ exit.o \ facl.o \ fchdir.o \ fchmod.o \ - fchown.o \ fchroot.o \ - fcntl.o \ fdsync.o \ fpathconf.o \ - fstat.o \ fstatfs.o \ fstatvfs.o \ getcpuid.o \ @@ -232,11 +225,9 @@ COMSYSOBJS= \ ioctl.o \ kaio.o \ kill.o \ - lchown.o \ link.o \ llseek.o \ lseek.o \ - lstat.o \ memcntl.o \ mincore.o \ mkdir.o \ @@ -250,7 +241,6 @@ COMSYSOBJS= \ nice.o \ ntp_adjtime.o \ ntp_gettime.o \ - open.o \ p_online.o \ pathconf.o \ pause.o \ @@ -267,9 +257,7 @@ COMSYSOBJS= \ read.o \ readlink.o \ readv.o \ - rename.o \ resolvepath.o \ - rmdir.o \ seteguid.o \ setgid.o \ setgroups.o \ @@ -281,7 +269,6 @@ COMSYSOBJS= \ sigprocmsk.o \ sigsendset.o \ sigsuspend.o \ - stat.o \ statfs.o \ statvfs.o \ stty.o \ @@ -295,7 +282,6 @@ COMSYSOBJS= \ ulimit.o \ umask.o \ umount2.o \ - unlink.o \ utssys.o \ uucopy.o \ vhangup.o \ @@ -396,7 +382,7 @@ PORTGEN= \ dirname.o \ div.o \ drand48.o \ - dup2.o \ + dup.o \ env_data.o \ err.o \ errno.o \ @@ -791,23 +777,22 @@ PORTSYS64= PORTSYS= \ _autofssys.o \ + access.o \ acctctl.o \ bsd_signal.o \ + chown.o \ corectl.o \ exacctsys.o \ execl.o \ execle.o \ execv.o \ - fsmisc.o \ - fstatat.o \ + fcntl.o \ getpagesizes.o \ getpeerucred.o \ inst_sync.o \ issetugid.o \ label.o \ - libc_fcntl.o \ libc_link.o \ - libc_open.o \ lockf.o \ lwp.o \ lwp_cond.o \ @@ -816,12 +801,13 @@ PORTSYS= \ meminfosys.o \ msgsys.o \ nfssys.o \ - openat.o \ + open.o \ pgrpsys.o \ posix_sigwait.o \ ppriv.o \ psetsys.o \ rctlsys.o \ + rename.o \ sbrk.o \ semsys.o \ set_errno.o \ @@ -832,10 +818,12 @@ PORTSYS= \ signal.o \ sigpending.o \ sigstack.o \ + stat.o \ tasksys.o \ time.o \ time_util.o \ ucontext.o \ + unlink.o \ ustat.o \ utimesys.o \ zone.o @@ -947,6 +935,11 @@ CPPFLAGS= -D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) $(THREAD_DEBUG) \ ASFLAGS= $(EXTN_ASFLAGS) -K PIC -P -D__STDC__ -D_ASM -D__sparcv9 $(CPPFLAGS) \ $(sparcv9_AS_XARCH) +# As a favor to the dtrace syscall provider, libc still calls the +# old syscall traps that have been obsoleted by the *at() interfaces. +# Delete this to compile libc using only the new *at() system call traps +CPPFLAGS += -D_RETAIN_OLD_SYSCALLS + # Conditionally add support for making |wordexp()| check whether # /usr/bin/ksh is ksh93 or not include $(LIBCDIR)/../../Makefile.ksh93switch diff --git a/usr/src/lib/libdtrace/common/dt_proc.c b/usr/src/lib/libdtrace/common/dt_proc.c index 001534163b..96e85f1bdb 100644 --- a/usr/src/lib/libdtrace/common/dt_proc.c +++ b/usr/src/lib/libdtrace/common/dt_proc.c @@ -87,9 +87,8 @@ #include <dt_pid.h> #include <dt_impl.h> -#define IS_SYS_EXEC(w) (w == SYS_exec || w == SYS_execve) -#define IS_SYS_FORK(w) (w == SYS_vfork || w == SYS_fork1 || \ - w == SYS_forkall || w == SYS_forksys) +#define IS_SYS_EXEC(w) (w == SYS_execve) +#define IS_SYS_FORK(w) (w == SYS_vfork || w == SYS_forksys) static dt_bkpt_t * dt_proc_bpcreate(dt_proc_t *dpr, uintptr_t addr, dt_bkpt_f *func, void *data) @@ -496,7 +495,6 @@ dt_proc_control(void *arg) * We must trace exit from exec() system calls so that if the exec is * successful, we can reset our breakpoints and re-initialize libproc. */ - (void) Psysexit(P, SYS_exec, B_TRUE); (void) Psysexit(P, SYS_execve, B_TRUE); /* @@ -507,10 +505,6 @@ dt_proc_control(void *arg) */ (void) Psysentry(P, SYS_vfork, B_TRUE); (void) Psysexit(P, SYS_vfork, B_TRUE); - (void) Psysentry(P, SYS_fork1, B_TRUE); - (void) Psysexit(P, SYS_fork1, B_TRUE); - (void) Psysentry(P, SYS_forkall, B_TRUE); - (void) Psysexit(P, SYS_forkall, B_TRUE); (void) Psysentry(P, SYS_forksys, B_TRUE); (void) Psysexit(P, SYS_forksys, B_TRUE); diff --git a/usr/src/lib/libpctx/common/libpctx.c b/usr/src/lib/libpctx/common/libpctx.c index f17e238322..ec10bbcb69 100644 --- a/usr/src/lib/libpctx/common/libpctx.c +++ b/usr/src/lib/libpctx/common/libpctx.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -316,16 +316,12 @@ pctx_set_events(pctx_t *pctx, ...) pctx->lwp_exit = (pctx_sysc_lwp_exitfn_t *)default_int; if (pctx->fork != (pctx_sysc_forkfn_t *)default_void) { - (void) Psysexit(pctx->Pr, SYS_forkall, 1); (void) Psysexit(pctx->Pr, SYS_vfork, 1); - (void) Psysexit(pctx->Pr, SYS_fork1, 1); (void) Psysexit(pctx->Pr, SYS_forksys, 1); if (Psetflags(pctx->Pr, PR_FORK) == -1) error = -1; } else { - (void) Psysexit(pctx->Pr, SYS_forkall, 0); (void) Psysexit(pctx->Pr, SYS_vfork, 0); - (void) Psysexit(pctx->Pr, SYS_fork1, 0); (void) Psysexit(pctx->Pr, SYS_forksys, 0); if (Punsetflags(pctx->Pr, PR_FORK) == -1) error = -1; @@ -338,14 +334,10 @@ pctx_set_events(pctx_t *pctx, ...) if (pctx->exec != (pctx_sysc_execfn_t *)default_int || pctx->fini_lwp != (pctx_fini_lwpfn_t *)default_int || pctx->init_lwp != (pctx_init_lwpfn_t *)default_int) { - (void) Psysexit(pctx->Pr, SYS_exec, 1); (void) Psysexit(pctx->Pr, SYS_execve, 1); - (void) Psysentry(pctx->Pr, SYS_exec, 1); (void) Psysentry(pctx->Pr, SYS_execve, 1); } else { - (void) Psysexit(pctx->Pr, SYS_exec, 0); (void) Psysexit(pctx->Pr, SYS_execve, 0); - (void) Psysentry(pctx->Pr, SYS_exec, 0); (void) Psysentry(pctx->Pr, SYS_execve, 0); } @@ -704,7 +696,6 @@ checkstate: if (running == 1) running = 0; break; - case SYS_exec: case SYS_execve: (void) pctx_lwpiterate(pctx, pctx->fini_lwp); break; @@ -717,7 +708,6 @@ checkstate: break; case PR_SYSEXIT: switch (pstatus->pr_lwp.pr_what) { - case SYS_exec: case SYS_execve: if (pstatus->pr_lwp.pr_errno) { /* @@ -762,9 +752,7 @@ checkstate: running = -1; pctx_end_syscalls(pctx); break; - case SYS_forkall: case SYS_vfork: - case SYS_fork1: case SYS_forksys: if (pstatus->pr_lwp.pr_errno) break; diff --git a/usr/src/lib/libproc/common/Pcontrol.c b/usr/src/lib/libproc/common/Pcontrol.c index deccb122c3..2a32522e0c 100644 --- a/usr/src/lib/libproc/common/Pcontrol.c +++ b/usr/src/lib/libproc/common/Pcontrol.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Portions Copyright 2007 Chad Mynhier @@ -335,7 +335,6 @@ Pxcreate(const char *file, /* executable file name */ * it again on entry to exec() or exit(). */ (void) Psysentry(P, SYS_exit, 1); - (void) Psysentry(P, SYS_exec, 1); (void) Psysentry(P, SYS_execve, 1); if (Psetrun(P, 0, PRSABORT) == -1) { dprintf("Pcreate: Psetrun failed: %s\n", strerror(errno)); @@ -353,13 +352,11 @@ Pxcreate(const char *file, /* executable file name */ * Move the process through instances of failed exec()s * to reach the point of stopped on successful exec(). */ - (void) Psysexit(P, SYS_exec, TRUE); (void) Psysexit(P, SYS_execve, TRUE); while (P->state == PS_STOP && P->status.pr_lwp.pr_why == PR_SYSENTRY && - (P->status.pr_lwp.pr_what == SYS_execve || - P->status.pr_lwp.pr_what == SYS_exec)) { + P->status.pr_lwp.pr_what == SYS_execve) { /* * Fetch the exec path name now, before we complete * the exec(). We may lose the process and be unable @@ -388,8 +385,7 @@ Pxcreate(const char *file, /* executable file name */ */ if (P->state == PS_STOP && P->status.pr_lwp.pr_why == PR_SYSEXIT && - (P->status.pr_lwp.pr_what == SYS_execve || - P->status.pr_lwp.pr_what == SYS_exec) && + P->status.pr_lwp.pr_what == SYS_execve && (lasterrno = P->status.pr_lwp.pr_errno) != 0) { /* * The exec() failed. Set the process running and @@ -405,8 +401,7 @@ Pxcreate(const char *file, /* executable file name */ if (P->state == PS_STOP && P->status.pr_lwp.pr_why == PR_SYSEXIT && - (P->status.pr_lwp.pr_what == SYS_execve || - P->status.pr_lwp.pr_what == SYS_exec) && + P->status.pr_lwp.pr_what == SYS_execve && P->status.pr_lwp.pr_errno == 0) { /* * The process is stopped on successful exec() or execve(). @@ -1371,8 +1366,7 @@ Preopen(struct ps_prochandle *P) if (P->state == PS_STOP && (P->status.pr_lwp.pr_why == PR_REQUESTED || (P->status.pr_lwp.pr_why == PR_SYSEXIT && - (P->status.pr_lwp.pr_what == SYS_exec || - P->status.pr_lwp.pr_what == SYS_execve)))) { + P->status.pr_lwp.pr_what == SYS_execve))) { /* fake up stop-on-exit-from-execve */ if (P->status.pr_lwp.pr_why == PR_REQUESTED) { P->status.pr_lwp.pr_why = PR_SYSEXIT; diff --git a/usr/src/lib/libproc/common/pr_open.c b/usr/src/lib/libproc/common/pr_open.c index 5ea4ea1393..9c6d463c95 100644 --- a/usr/src/lib/libproc/common/pr_open.c +++ b/usr/src/lib/libproc/common/pr_open.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 1997-2001 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdlib.h> #include <unistd.h> #include <string.h> @@ -39,15 +37,22 @@ int pr_open(struct ps_prochandle *Pr, const char *filename, int flags, mode_t mode) { - sysret_t rval; /* return value from open() */ - argdes_t argd[3]; /* arg descriptors for open() */ + sysret_t rval; /* return value from openat() */ + argdes_t argd[4]; /* arg descriptors for openat() */ argdes_t *adp; int error; if (Pr == NULL) /* no subject process */ return (open(filename, flags, mode)); - adp = &argd[0]; /* filename argument */ + adp = &argd[0]; /* AT_FDCWD argument */ + adp->arg_value = AT_FDCWD; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + + adp++; /* filename argument */ adp->arg_value = 0; adp->arg_object = (void *)filename; adp->arg_type = AT_BYREF; @@ -68,7 +73,7 @@ pr_open(struct ps_prochandle *Pr, const char *filename, int flags, mode_t mode) adp->arg_inout = AI_INPUT; adp->arg_size = 0; - error = Psyscall(Pr, &rval, SYS_open, 3, &argd[0]); + error = Psyscall(Pr, &rval, SYS_openat, 4, &argd[0]); if (error) { errno = (error > 0)? error : ENOSYS; @@ -83,21 +88,35 @@ pr_open(struct ps_prochandle *Pr, const char *filename, int flags, mode_t mode) int pr_creat(struct ps_prochandle *Pr, const char *filename, mode_t mode) { - sysret_t rval; /* return value from creat() */ - argdes_t argd[2]; /* arg descriptors for creat() */ + sysret_t rval; /* return value from openat() */ + argdes_t argd[4]; /* arg descriptors for openat() */ argdes_t *adp; int error; if (Pr == NULL) /* no subject process */ return (creat(filename, mode)); - adp = &argd[0]; /* filename argument */ + adp = &argd[0]; /* AT_FDCWD argument */ + adp->arg_value = AT_FDCWD; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + + adp++; /* filename argument */ adp->arg_value = 0; adp->arg_object = (void *)filename; adp->arg_type = AT_BYREF; adp->arg_inout = AI_INPUT; adp->arg_size = strlen(filename)+1; + adp++; /* flags argument */ + adp->arg_value = (O_WRONLY | O_CREAT | O_TRUNC); + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + adp++; /* mode argument */ adp->arg_value = (long)mode; adp->arg_object = NULL; @@ -105,7 +124,7 @@ pr_creat(struct ps_prochandle *Pr, const char *filename, mode_t mode) adp->arg_inout = AI_INPUT; adp->arg_size = 0; - error = Psyscall(Pr, &rval, SYS_creat, 2, &argd[0]); + error = Psyscall(Pr, &rval, SYS_openat, 4, &argd[0]); if (error) { errno = (error > 0)? error : ENOSYS; @@ -151,14 +170,21 @@ int pr_access(struct ps_prochandle *Pr, const char *path, int amode) { sysret_t rval; /* return from access() */ - argdes_t argd[2]; /* arg descriptors for access() */ + argdes_t argd[4]; /* arg descriptors for access() */ argdes_t *adp; int err; if (Pr == NULL) /* no subject process */ return (access(path, amode)); - adp = &argd[0]; /* path argument */ + adp = &argd[0]; /* directory fd argument */ + adp->arg_value = AT_FDCWD; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + + adp++; /* path argument */ adp->arg_value = 0; adp->arg_object = (void *)path; adp->arg_type = AT_BYREF; @@ -172,7 +198,14 @@ pr_access(struct ps_prochandle *Pr, const char *path, int amode) adp->arg_inout = AI_INPUT; adp->arg_size = 0; - err = Psyscall(Pr, &rval, SYS_access, 2, &argd[0]); + adp++; /* flag argument */ + adp->arg_value = 0; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + + err = Psyscall(Pr, &rval, SYS_faccessat, 4, &argd[0]); if (err) { errno = (err > 0) ? err : ENOSYS; diff --git a/usr/src/lib/libproc/common/pr_rename.c b/usr/src/lib/libproc/common/pr_rename.c index e6c5074eea..7696188111 100644 --- a/usr/src/lib/libproc/common/pr_rename.c +++ b/usr/src/lib/libproc/common/pr_rename.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 1998-2000 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdlib.h> #include <unistd.h> #include <string.h> @@ -39,28 +37,42 @@ int pr_rename(struct ps_prochandle *Pr, const char *old, const char *new) { sysret_t rval; - argdes_t argd[2]; + argdes_t argd[4]; argdes_t *adp; int error; if (Pr == NULL) return (rename(old, new)); - adp = &argd[0]; /* old argument */ + adp = &argd[0]; /* old fd argument */ + adp->arg_value = AT_FDCWD; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + + adp++; /* move to old argument */ adp->arg_value = 0; adp->arg_object = (void *)old; adp->arg_type = AT_BYREF; adp->arg_inout = AI_INPUT; adp->arg_size = strlen(old) + 1; - adp++; /* new argument */ + adp++; /* move to new fd argument */ + adp->arg_value = AT_FDCWD; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + + adp++; /* move to new argument */ adp->arg_value = 0; adp->arg_object = (void *)new; adp->arg_type = AT_BYREF; adp->arg_inout = AI_INPUT; adp->arg_size = strlen(new) + 1; - error = Psyscall(Pr, &rval, SYS_rename, 2, &argd[0]); + error = Psyscall(Pr, &rval, SYS_renameat, 4, &argd[0]); if (error) { errno = (error > 0) ? error : ENOSYS; @@ -113,21 +125,35 @@ int pr_unlink(struct ps_prochandle *Pr, const char *path) { sysret_t rval; - argdes_t argd[1]; + argdes_t argd[3]; argdes_t *adp; int error; if (Pr == NULL) return (unlink(path)); - adp = &argd[0]; /* path argument */ + adp = &argd[0]; /* directory fd argument */ + adp->arg_value = AT_FDCWD; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + adp++; /* move to path argument */ + adp->arg_value = 0; adp->arg_object = (void *)path; adp->arg_type = AT_BYREF; adp->arg_inout = AI_INPUT; adp->arg_size = strlen(path) + 1; + adp++; /* move to flags argument */ + + adp->arg_value = 0; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; - error = Psyscall(Pr, &rval, SYS_unlink, 1, &argd[0]); + error = Psyscall(Pr, &rval, SYS_unlinkat, 3, &argd[0]); if (error) { errno = (error > 0) ? error : ENOSYS; diff --git a/usr/src/lib/libproc/common/pr_stat.c b/usr/src/lib/libproc/common/pr_stat.c index cac5bf9c88..98bda13de5 100644 --- a/usr/src/lib/libproc/common/pr_stat.c +++ b/usr/src/lib/libproc/common/pr_stat.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,21 +18,20 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 1997-2001 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/isa_defs.h> - #include <stdlib.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> +#include <sys/fcntl.h> #include <sys/sysmacros.h> #include "libproc.h" @@ -71,10 +69,9 @@ int pr_stat(struct ps_prochandle *Pr, const char *path, struct stat *buf) { sysret_t rval; /* return value from stat() */ - argdes_t argd[3]; /* arg descriptors for stat() */ + argdes_t argd[4]; /* arg descriptors for fstatat() */ argdes_t *adp = &argd[0]; /* first argument */ - int syscall; /* stat, xstat or stat64 */ - int nargs = 2; /* number of actual arguments */ + int syscall; /* SYS_fstatat or SYS_fstatat64 */ int error; #ifdef _LP64 struct stat64_32 statb64_32; @@ -83,29 +80,19 @@ pr_stat(struct ps_prochandle *Pr, const char *path, struct stat *buf) if (Pr == NULL) /* no subject process */ return (stat(path, buf)); - /* - * This is filthy, but /proc reveals everything about the - * system call interfaces, despite what the architects of the - * header files may desire. We have to know here whether we - * are calling stat() or xstat() in the subject. - */ -#if defined(_STAT_VER) - syscall = SYS_xstat; - nargs = 3; - adp->arg_value = _STAT_VER; - adp->arg_object = NULL; - adp->arg_type = AT_BYVAL; - adp->arg_inout = AI_INPUT; - adp->arg_size = 0; - adp++; /* move to pathname argument */ -#else if (Pstatus(Pr)->pr_dmodel != PR_MODEL_NATIVE) { /* 64-bit process controls 32-bit subject process */ - syscall = SYS_stat64; + syscall = SYS_fstatat64; } else { - syscall = SYS_stat; + syscall = SYS_fstatat; } -#endif + + adp->arg_value = AT_FDCWD; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + adp++; /* move to path argument */ adp->arg_value = 0; adp->arg_object = (void *)path; @@ -129,8 +116,15 @@ pr_stat(struct ps_prochandle *Pr, const char *path, struct stat *buf) adp->arg_object = buf; adp->arg_size = sizeof (*buf); #endif /* _LP64 */ + adp++; /* move to flags argument */ - error = Psyscall(Pr, &rval, syscall, nargs, &argd[0]); + adp->arg_value = 0; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + + error = Psyscall(Pr, &rval, syscall, 4, &argd[0]); if (error) { errno = (error > 0)? error : ENOSYS; @@ -149,11 +143,10 @@ pr_stat(struct ps_prochandle *Pr, const char *path, struct stat *buf) int pr_lstat(struct ps_prochandle *Pr, const char *path, struct stat *buf) { - sysret_t rval; /* return value from lstat() */ - argdes_t argd[3]; /* arg descriptors for lstat() */ + sysret_t rval; /* return value from stat() */ + argdes_t argd[4]; /* arg descriptors for fstatat() */ argdes_t *adp = &argd[0]; /* first argument */ - int syscall; /* lstat, lxstat or lstat64 */ - int nargs = 2; /* number of actual arguments */ + int syscall; /* SYS_fstatat or SYS_fstatat64 */ int error; #ifdef _LP64 struct stat64_32 statb64_32; @@ -162,29 +155,19 @@ pr_lstat(struct ps_prochandle *Pr, const char *path, struct stat *buf) if (Pr == NULL) /* no subject process */ return (lstat(path, buf)); - /* - * This is filthy, but /proc reveals everything about the - * system call interfaces, despite what the architects of the - * header files may desire. We have to know here whether we - * are calling lstat() or lxstat() in the subject. - */ -#if defined(_STAT_VER) - syscall = SYS_lxstat; - nargs = 3; - adp->arg_value = _STAT_VER; - adp->arg_object = NULL; - adp->arg_type = AT_BYVAL; - adp->arg_inout = AI_INPUT; - adp->arg_size = 0; - adp++; /* move to pathname argument */ -#else if (Pstatus(Pr)->pr_dmodel != PR_MODEL_NATIVE) { /* 64-bit process controls 32-bit subject process */ - syscall = SYS_lstat64; + syscall = SYS_fstatat64; } else { - syscall = SYS_lstat; + syscall = SYS_fstatat; } -#endif + + adp->arg_value = AT_FDCWD; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + adp++; /* move to path argument */ adp->arg_value = 0; adp->arg_object = (void *)path; @@ -208,8 +191,15 @@ pr_lstat(struct ps_prochandle *Pr, const char *path, struct stat *buf) adp->arg_object = buf; adp->arg_size = sizeof (*buf); #endif /* _LP64 */ + adp++; /* move to flags argument */ + + adp->arg_value = AT_SYMLINK_NOFOLLOW; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; - error = Psyscall(Pr, &rval, syscall, nargs, &argd[0]); + error = Psyscall(Pr, &rval, syscall, 4, &argd[0]); if (error) { errno = (error > 0)? error : ENOSYS; @@ -228,11 +218,10 @@ pr_lstat(struct ps_prochandle *Pr, const char *path, struct stat *buf) int pr_fstat(struct ps_prochandle *Pr, int fd, struct stat *buf) { - sysret_t rval; /* return value from fstat() */ - argdes_t argd[3]; /* arg descriptors for fstat() */ + sysret_t rval; /* return value from stat() */ + argdes_t argd[4]; /* arg descriptors for fstatat() */ argdes_t *adp = &argd[0]; /* first argument */ - int syscall; /* fstat, fxstat or fstat64 */ - int nargs = 2; /* number of actual arguments */ + int syscall; /* SYS_fstatat or SYS_fstatat64 */ int error; #ifdef _LP64 struct stat64_32 statb64_32; @@ -241,35 +230,25 @@ pr_fstat(struct ps_prochandle *Pr, int fd, struct stat *buf) if (Pr == NULL) /* no subject process */ return (fstat(fd, buf)); - /* - * This is filthy, but /proc reveals everything about the - * system call interfaces, despite what the architects of the - * header files may desire. We have to know here whether we - * are calling fstat() or fxstat() in the subject. - */ -#if defined(_STAT_VER) - syscall = SYS_fxstat; - nargs = 3; - adp->arg_value = _STAT_VER; - adp->arg_object = NULL; - adp->arg_type = AT_BYVAL; - adp->arg_inout = AI_INPUT; - adp->arg_size = 0; - adp++; /* move to fd argument */ -#else if (Pstatus(Pr)->pr_dmodel != PR_MODEL_NATIVE) { /* 64-bit process controls 32-bit subject process */ - syscall = SYS_fstat64; + syscall = SYS_fstatat64; } else { - syscall = SYS_fstat; + syscall = SYS_fstatat; } -#endif adp->arg_value = fd; adp->arg_object = NULL; adp->arg_type = AT_BYVAL; adp->arg_inout = AI_INPUT; adp->arg_size = 0; + adp++; /* move to path argument */ + + adp->arg_value = 0; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; adp++; /* move to buffer argument */ adp->arg_value = 0; @@ -287,8 +266,15 @@ pr_fstat(struct ps_prochandle *Pr, int fd, struct stat *buf) adp->arg_object = buf; adp->arg_size = sizeof (*buf); #endif /* _LP64 */ + adp++; /* move to flags argument */ - error = Psyscall(Pr, &rval, syscall, nargs, &argd[0]); + adp->arg_value = 0; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + + error = Psyscall(Pr, &rval, syscall, 4, &argd[0]); if (error) { errno = (error > 0)? error : ENOSYS; @@ -307,11 +293,10 @@ pr_fstat(struct ps_prochandle *Pr, int fd, struct stat *buf) int pr_stat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf) { - sysret_t rval; /* return value from stat64() */ - argdes_t argd[2]; /* arg descriptors for stat64() */ + sysret_t rval; /* return value from stat() */ + argdes_t argd[4]; /* arg descriptors for fstatat() */ argdes_t *adp = &argd[0]; /* first argument */ - int syscall; /* stat or stat64 */ - int nargs = 2; /* number of actual arguments */ + int syscall; /* SYS_fstatat or SYS_fstatat64 */ int error; #ifdef _LP64 struct stat64_32 statb64_32; @@ -325,12 +310,19 @@ pr_stat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf) * 32-bit native and * 64-bit process controls 32-bit subject process */ - syscall = SYS_stat64; + syscall = SYS_fstatat64; } else { /* 64-bit native */ - syscall = SYS_stat; + syscall = SYS_fstatat; } + adp->arg_value = AT_FDCWD; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + adp++; /* move to path argument */ + adp->arg_value = 0; adp->arg_object = (void *)path; adp->arg_type = AT_BYREF; @@ -353,8 +345,15 @@ pr_stat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf) adp->arg_object = buf; adp->arg_size = sizeof (*buf); #endif /* _LP64 */ + adp++; /* move to flags argument */ - error = Psyscall(Pr, &rval, syscall, nargs, &argd[0]); + adp->arg_value = 0; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + + error = Psyscall(Pr, &rval, syscall, 4, &argd[0]); if (error) { errno = (error > 0)? error : ENOSYS; @@ -373,11 +372,10 @@ pr_stat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf) int pr_lstat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf) { - sysret_t rval; /* return value from lstat64() */ - argdes_t argd[2]; /* arg descriptors for lstat64() */ + sysret_t rval; /* return value from stat() */ + argdes_t argd[4]; /* arg descriptors for fstatat() */ argdes_t *adp = &argd[0]; /* first argument */ - int syscall; /* lstat or lstat64 */ - int nargs = 2; /* number of actual arguments */ + int syscall; /* SYS_fstatat or SYS_fstatat64 */ int error; #ifdef _LP64 struct stat64_32 statb64_32; @@ -391,12 +389,19 @@ pr_lstat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf) * 32-bit native and * 64-bit process controls 32-bit subject process */ - syscall = SYS_lstat64; + syscall = SYS_fstatat64; } else { /* 64-bit native */ - syscall = SYS_lstat; + syscall = SYS_fstatat; } + adp->arg_value = AT_FDCWD; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + adp++; /* move to path argument */ + adp->arg_value = 0; adp->arg_object = (void *)path; adp->arg_type = AT_BYREF; @@ -419,8 +424,15 @@ pr_lstat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf) adp->arg_object = buf; adp->arg_size = sizeof (*buf); #endif /* _LP64 */ + adp++; /* move to flags argument */ - error = Psyscall(Pr, &rval, syscall, nargs, &argd[0]); + adp->arg_value = AT_SYMLINK_NOFOLLOW; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; + + error = Psyscall(Pr, &rval, syscall, 4, &argd[0]); if (error) { errno = (error > 0)? error : ENOSYS; @@ -439,11 +451,10 @@ pr_lstat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf) int pr_fstat64(struct ps_prochandle *Pr, int fd, struct stat64 *buf) { - sysret_t rval; /* return value from fstat64() */ - argdes_t argd[2]; /* arg descriptors for fstat64() */ + sysret_t rval; /* return value from stat() */ + argdes_t argd[4]; /* arg descriptors for fstatat() */ argdes_t *adp = &argd[0]; /* first argument */ - int syscall; /* fstat or fstat64 */ - int nargs = 2; /* number of actual arguments */ + int syscall; /* SYS_fstatat or SYS_fstatat64 */ int error; #ifdef _LP64 struct stat64_32 statb64_32; @@ -457,10 +468,10 @@ pr_fstat64(struct ps_prochandle *Pr, int fd, struct stat64 *buf) * 32-bit native and * 64-bit process controls 32-bit subject process */ - syscall = SYS_fstat64; + syscall = SYS_fstatat64; } else { /* 64-bit native */ - syscall = SYS_fstat; + syscall = SYS_fstatat; } adp->arg_value = fd; @@ -468,6 +479,13 @@ pr_fstat64(struct ps_prochandle *Pr, int fd, struct stat64 *buf) adp->arg_type = AT_BYVAL; adp->arg_inout = AI_INPUT; adp->arg_size = 0; + adp++; /* move to path argument */ + + adp->arg_value = 0; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; adp++; /* move to buffer argument */ adp->arg_value = 0; @@ -485,8 +503,15 @@ pr_fstat64(struct ps_prochandle *Pr, int fd, struct stat64 *buf) adp->arg_object = buf; adp->arg_size = sizeof (*buf); #endif /* _LP64 */ + adp++; /* move to flags argument */ + + adp->arg_value = 0; + adp->arg_object = NULL; + adp->arg_type = AT_BYVAL; + adp->arg_inout = AI_INPUT; + adp->arg_size = 0; - error = Psyscall(Pr, &rval, syscall, nargs, &argd[0]); + error = Psyscall(Pr, &rval, syscall, 4, &argd[0]); if (error) { errno = (error > 0)? error : ENOSYS; diff --git a/usr/src/lib/libproc/common/proc_names.c b/usr/src/lib/libproc/common/proc_names.c index 80fc114a97..96f58363c5 100644 --- a/usr/src/lib/libproc/common/proc_names.c +++ b/usr/src/lib/libproc/common/proc_names.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -115,16 +116,16 @@ proc_signame(int sig, char *buf, size_t bufsz) static const char *const systable[] = { NULL, /* 0 */ "_exit", /* 1 */ - "forkall", /* 2 */ + NULL, /* 2 */ "read", /* 3 */ "write", /* 4 */ "open", /* 5 */ "close", /* 6 */ - "wait", /* 7 */ - "creat", /* 8 */ + NULL, /* 7 */ + NULL, /* 8 */ "link", /* 9 */ "unlink", /* 10 */ - "exec", /* 11 */ + NULL, /* 11 */ "chdir", /* 12 */ "time", /* 13 */ "mknod", /* 14 */ @@ -135,7 +136,7 @@ static const char *const systable[] = { "lseek", /* 19 */ "getpid", /* 20 */ "mount", /* 21 */ - "umount", /* 22 */ + NULL, /* 22 */ "setuid", /* 23 */ "getuid", /* 24 */ "stime", /* 25 */ @@ -143,7 +144,7 @@ static const char *const systable[] = { "alarm", /* 27 */ "fstat", /* 28 */ "pause", /* 29 */ - "utime", /* 30 */ + NULL, /* 30 */ "stty", /* 31 */ "gtty", /* 32 */ "access", /* 33 */ @@ -154,11 +155,11 @@ static const char *const systable[] = { "fstatfs", /* 38 */ "pgrpsys", /* 39 */ "uucopystr", /* 40 */ - "dup", /* 41 */ + NULL, /* 41 */ "pipe", /* 42 */ "times", /* 43 */ "profil", /* 44 */ - "plock", /* 45 */ + "faccessat", /* 45 */ "setgid", /* 46 */ "getgid", /* 47 */ "signal", /* 48 */ @@ -169,7 +170,7 @@ static const char *const systable[] = { "semsys", /* 53 */ "ioctl", /* 54 */ "uadmin", /* 55 */ - NULL, /* 56 */ + "fchownat", /* 56 */ "utssys", /* 57 */ "fdsync", /* 58 */ "execve", /* 59 */ @@ -177,15 +178,12 @@ static const char *const systable[] = { "chroot", /* 61 */ "fcntl", /* 62 */ "ulimit", /* 63 */ - - /* The following 6 entries were reserved for the UNIX PC */ - NULL, /* 64 */ - NULL, /* 65 */ - NULL, /* 66 */ - NULL, /* 67 */ - NULL, /* 68 */ - NULL, /* 69 */ - + "renameat", /* 64 */ + "unlinkat", /* 65 */ + "fstatat", /* 66 */ + "fstatat64", /* 67 */ + "openat", /* 68 */ + "openat64", /* 69 */ "tasksys", /* 70 */ "acctctl", /* 71 */ "exacctsys", /* 72 */ @@ -203,7 +201,7 @@ static const char *const systable[] = { "sysfs", /* 84 */ "getmsg", /* 85 */ "putmsg", /* 86 */ - "poll", /* 87 */ + NULL, /* 87 */ "lstat", /* 88 */ "symlink", /* 89 */ "readlink", /* 90 */ @@ -217,8 +215,8 @@ static const char *const systable[] = { "sigaction", /* 98 */ "sigpending", /* 99 */ "context", /* 100 */ - "evsys", /* 101 */ - "evtrapret", /* 102 */ + NULL, /* 101 */ + NULL, /* 102 */ "statvfs", /* 103 */ "fstatvfs", /* 104 */ "getloadavg", /* 105 */ @@ -239,10 +237,10 @@ static const char *const systable[] = { "fchdir", /* 120 */ "readv", /* 121 */ "writev", /* 122 */ - "xstat", /* 123 */ - "lxstat", /* 124 */ - "fxstat", /* 125 */ - "xmknod", /* 126 */ + NULL, /* 123 */ + NULL, /* 124 */ + NULL, /* 125 */ + NULL, /* 126 */ "mmapobj", /* 127 */ "setrlimit", /* 128 */ "getrlimit", /* 129 */ @@ -259,18 +257,18 @@ static const char *const systable[] = { "sharefs", /* 140 */ "seteuid", /* 141 */ "forksys", /* 142 */ - "fork1", /* 143 */ + NULL, /* 143 */ "sigtimedwait", /* 144 */ "lwp_info", /* 145 */ "yield", /* 146 */ - "lwp_sema_wait", /* 147 */ + NULL, /* 147 */ "lwp_sema_post", /* 148 */ "lwp_sema_trywait", /* 149 */ "lwp_detatch", /* 150 */ "corectl", /* 151 */ "modctl", /* 152 */ "fchroot", /* 153 */ - "utimes", /* 154 */ + NULL, /* 154 */ "vhangup", /* 155 */ "gettimeofday", /* 156 */ "getitimer", /* 157 */ @@ -285,7 +283,7 @@ static const char *const systable[] = { "lwp_private", /* 166 */ "lwp_wait", /* 167 */ "lwp_mutex_wakeup", /* 168 */ - "lwp_mutex_lock", /* 169 */ + NULL, /* 169 */ "lwp_cond_wait", /* 170 */ "lwp_cond_signal", /* 171 */ "lwp_cond_broadcast", /* 172 */ @@ -300,7 +298,7 @@ static const char *const systable[] = { "rusagesys", /* 181 */ "portfs", /* 182 */ "pollsys", /* 183 */ - NULL, /* 184 */ + "labelsys", /* 184 */ "acl", /* 185 */ "auditsys", /* 186 */ "processor_bind", /* 187 */ @@ -340,7 +338,7 @@ static const char *const systable[] = { "getrlimit64", /* 221 */ "pread64", /* 222 */ "pwrite64", /* 223 */ - "creat64", /* 224 */ + NULL, /* 224 */ "open64", /* 225 */ "rpcmod", /* 226 */ "zone", /* 227 */ diff --git a/usr/src/lib/libsocket/socket/_soutil.c b/usr/src/lib/libsocket/socket/_soutil.c index d91e549cff..ac5ee929d8 100644 --- a/usr/src/lib/libsocket/socket/_soutil.c +++ b/usr/src/lib/libsocket/socket/_soutil.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -32,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/socket.h> #include <sys/stat.h> @@ -139,11 +137,7 @@ _s_netconfig_path(int family, int type, int protocol, *prototype = protocol; retry: -#if defined(i386) - if (_xstat(_STAT_VER, net->nc_device, &stats) < 0) { -#else if (stat(net->nc_device, &stats) < 0) { -#endif switch (errno) { case EINTR: goto retry; diff --git a/usr/src/lib/libtnfctl/continue.c b/usr/src/lib/libtnfctl/continue.c index ab9f5d5701..cc4ef319d3 100644 --- a/usr/src/lib/libtnfctl/continue.c +++ b/usr/src/lib/libtnfctl/continue.c @@ -20,12 +20,10 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * interface to continue a target process (DIRECT_MODE) and helper * functions needed by this routine. @@ -237,7 +235,6 @@ again: } else if (state.ps_issysentry) { switch (state.ps_syscallnum) { - case SYS_exec: case SYS_execve: *evt = TNFCTL_EVENT_EXEC; ret_prexstat = TNFCTL_ERR_INTERNAL; @@ -250,9 +247,7 @@ again: } } else if (state.ps_issysexit) { switch (state.ps_syscallnum) { - case SYS_forkall: case SYS_vfork: - case SYS_fork1: case SYS_forksys: *evt = TNFCTL_EVENT_FORK; break; @@ -287,27 +282,16 @@ enable_target_state(tnfctl_handle_t *hndl, boolean_t watch_forks) prbstat = prb_proc_entry(proc_p, SYS_execve, PRB_SYS_ADD); if (prbstat) return (_tnfctl_map_to_errcode(prbstat)); - prbstat = prb_proc_entry(proc_p, SYS_exec, PRB_SYS_ADD); - if (prbstat) - return (_tnfctl_map_to_errcode(prbstat)); /* trace exit */ prbstat = prb_proc_entry(proc_p, SYS_exit, PRB_SYS_ADD); if (prbstat) return (_tnfctl_map_to_errcode(prbstat)); /* trace fork if the caller requests */ if (watch_forks) { - prbstat = prb_proc_exit(proc_p, SYS_forkall, PRB_SYS_ADD); - if (prbstat) - return (_tnfctl_map_to_errcode(prbstat)); - prbstat = prb_proc_exit(proc_p, SYS_vfork, PRB_SYS_ADD); if (prbstat) return (_tnfctl_map_to_errcode(prbstat)); - prbstat = prb_proc_exit(proc_p, SYS_fork1, PRB_SYS_ADD); - if (prbstat) - return (_tnfctl_map_to_errcode(prbstat)); - prbstat = prb_proc_exit(proc_p, SYS_forksys, PRB_SYS_ADD); if (prbstat) return (_tnfctl_map_to_errcode(prbstat)); @@ -346,21 +330,12 @@ disable_target_state(tnfctl_handle_t *hndl) prbstat = prb_proc_entry(proc_p, SYS_execve, PRB_SYS_DEL); if (prbstat) return (_tnfctl_map_to_errcode(prbstat)); - prbstat = prb_proc_entry(proc_p, SYS_exec, PRB_SYS_DEL); - if (prbstat) - return (_tnfctl_map_to_errcode(prbstat)); prbstat = prb_proc_entry(proc_p, SYS_exit, PRB_SYS_DEL); if (prbstat) return (_tnfctl_map_to_errcode(prbstat)); - prbstat = prb_proc_exit(proc_p, SYS_forkall, PRB_SYS_DEL); - if (prbstat) - return (_tnfctl_map_to_errcode(prbstat)); prbstat = prb_proc_exit(proc_p, SYS_vfork, PRB_SYS_DEL); if (prbstat) return (_tnfctl_map_to_errcode(prbstat)); - prbstat = prb_proc_exit(proc_p, SYS_fork1, PRB_SYS_DEL); - if (prbstat) - return (_tnfctl_map_to_errcode(prbstat)); prbstat = prb_proc_exit(proc_p, SYS_forksys, PRB_SYS_DEL); if (prbstat) return (_tnfctl_map_to_errcode(prbstat)); diff --git a/usr/src/lib/libtnfctl/open.c b/usr/src/lib/libtnfctl/open.c index 641ef808b1..e36fe67db4 100644 --- a/usr/src/lib/libtnfctl/open.c +++ b/usr/src/lib/libtnfctl/open.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 1994, by Sun Microsytems, Inc. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Interfaces that return a tnfctl handle back to client (except for * tnfctl_internal_open()) and helper functions for these interfaces. @@ -62,7 +61,7 @@ tnfctl_exec_open(const char *pgm_name, char * const *args, char * const *envp, tnfctl_errcode_t prexstat; prbstat = prb_child_create(pgm_name, args, ld_preload, libtnfprobe_path, - envp, &proc_p); + envp, &proc_p); if (prbstat) { return (_tnfctl_map_to_errcode(prbstat)); } @@ -244,8 +243,8 @@ tnfctl_indirect_open(void *prochandle, tnfctl_ind_config_t *config, /* set state in target indicating we're tracing externally */ prexstat = _tnfctl_external_getlock(hdl); if (prexstat) { - free(hdl); - return (prexstat); + free(hdl); + return (prexstat); } *ret_val = hdl; return (TNFCTL_ERR_NONE); @@ -277,7 +276,7 @@ tnfctl_kernel_open(tnfctl_handle_t **ret_val) /* initialize function pointers that can be stuffed into a probe */ _tnfctl_prbk_get_other_funcs(&hdl->allocfunc, &hdl->commitfunc, - &hdl->rollbackfunc, &hdl->endfunc); + &hdl->rollbackfunc, &hdl->endfunc); _tnfctl_prbk_test_func(&hdl->testfunc); /* find the probes in the kernel */ @@ -343,7 +342,7 @@ tnfctl_buffer_alloc(tnfctl_handle_t *hdl, const char *trace_file_name, } prexstat = _tnfctl_create_tracefile(hdl, trace_file_name, - trace_file_size); + trace_file_size); if (prexstat) { return (prexstat); } @@ -436,15 +435,13 @@ step_to_end_of_exec(tnfctl_handle_t *hndl) prbstat = prb_proc_state(proc_p, &pstate); if (prbstat) return (_tnfctl_map_to_errcode(prbstat)); - if (!(pstate.ps_issysentry && (pstate.ps_syscallnum == SYS_exec || - pstate.ps_syscallnum == SYS_execve))) { + if (!(pstate.ps_issysentry && pstate.ps_syscallnum == SYS_execve)) { /* not stopped at beginning of exec system call */ return (TNFCTL_ERR_NONE); } /* we are stopped at beginning of exec system call */ - /* REMIND: do we have to wait on SYS_exec also ? */ prbstat = prb_proc_exit(proc_p, SYS_execve, PRB_SYS_ADD); if (prbstat) return (_tnfctl_map_to_errcode(prbstat)); @@ -482,7 +479,7 @@ step_to_end_of_exec(tnfctl_handle_t *hndl) if (prbstat) return (_tnfctl_map_to_errcode(prbstat)); - if (!(pstate.ps_issysexit && (pstate.ps_syscallnum == SYS_execve))) { + if (!(pstate.ps_issysexit && pstate.ps_syscallnum == SYS_execve)) { /* unexpected condition */ return (tnfctl_status_map(ENOENT)); } @@ -505,13 +502,13 @@ _tnfctl_external_getlock(tnfctl_handle_t *hdl) int internal_tracing_on; prexstat = _tnfctl_sym_find(hdl, TNFCTL_INTERNAL_TRACEFLAG, - &targ_symbol_ptr); + &targ_symbol_ptr); if (prexstat) { /* no libtnfctl in target: success */ return (TNFCTL_ERR_NONE); } prbstat = hdl->p_read(hdl->proc_p, targ_symbol_ptr, - &internal_tracing_on, sizeof (internal_tracing_on)); + &internal_tracing_on, sizeof (internal_tracing_on)); if (prbstat) { prexstat = _tnfctl_map_to_errcode(prbstat); @@ -523,20 +520,20 @@ _tnfctl_external_getlock(tnfctl_handle_t *hdl) goto failure_ret; } prexstat = _tnfctl_sym_find(hdl, TNFCTL_EXTERNAL_TRACEDPID, - &targ_symbol_ptr); + &targ_symbol_ptr); if (prexstat) { /* this shouldn't happen. we know we have libtnfctl */ goto failure_ret; } prbstat = hdl->p_write(hdl->proc_p, targ_symbol_ptr, - &(hdl->targ_pid), sizeof (hdl->targ_pid)); + &(hdl->targ_pid), sizeof (hdl->targ_pid)); if (prbstat) { prexstat = _tnfctl_map_to_errcode(prbstat); goto failure_ret; } /* success */ DBG((void) fprintf(stderr, "_tnfctl_external_getlock: ok to trace %d\n", - hdl->targ_pid)); + hdl->targ_pid)); return (TNFCTL_ERR_NONE); failure_ret: diff --git a/usr/src/tools/scripts/acr.sh b/usr/src/tools/scripts/acr.sh index ab24657bdc..d9309b8c94 100644 --- a/usr/src/tools/scripts/acr.sh +++ b/usr/src/tools/scripts/acr.sh @@ -20,7 +20,7 @@ # CDDL HEADER END # # -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # @@ -253,9 +253,14 @@ acr_a_root() { # if the sed fails. # if [ $bfu_alt_reality = "true" ] ; then - sed -e 's,^#!/bin/sh,#!/tmp/bfubin/sh,' \ + sed -e 's,^#! */bin/sh,#!/tmp/bfubin/sh,' \ -e 's,/usr/bin/,/tmp/bfubin/,g' \ -e 's,/usr/bin:,/tmp/bfubin:,' \ + -e 's,/usr/sbin/,/tmp/bfubin/,g' \ + -e 's,/usr/sbin:,/tmp/bfubin:,' \ + -e 's,/lib/svc/bin/,/tmp/bfubin/,g' \ + -e 's,/bin/,/tmp/bfubin/,g' \ + -e 's,/sbin/,/tmp/bfubin/,g' \ -e 's,installf,/tmp/bfubin/true,' \ -e 's,removef,/tmp/bfubin/true,' \ $scriptloc > $processedscript.$script @@ -380,9 +385,13 @@ fi echo # workaround for 6644920 -BIN=bin cr_args=${root:+ -R $root} -LD_LIBRARY_PATH=/tmp/bfulib PATH=/tmp/bfubin \ - /tmp/bfubin/ksh $root/boot/solaris/$BIN/create_ramdisk $cr_args +if [ -x /tmp/bfubin/create_ramdisk ] ; then + LD_LIBRARY_PATH=/tmp/bfulib PATH=/tmp/bfubin \ + /tmp/bfubin/ksh /tmp/bfubin/create_ramdisk $cr_args +else + LD_LIBRARY_PATH=/tmp/bfulib PATH=/tmp/bfubin \ + /tmp/bfubin/ksh $root/boot/solaris/bin/create_ramdisk $cr_args +fi print "Finished. See $allresults for complete log." diff --git a/usr/src/tools/scripts/bfu.sh b/usr/src/tools/scripts/bfu.sh index 66cbf3ddfc..59d182d1c6 100644 --- a/usr/src/tools/scripts/bfu.sh +++ b/usr/src/tools/scripts/bfu.sh @@ -533,7 +533,7 @@ smf_import_service() { if [[ $zone = global && -f $rootprefix/var/svc/manifest/$1 ]]; then if [[ -n $rootprefix && -x /usr/sbin/svccfg ]]; then SVCCFG_REPOSITORY=$rootprefix/etc/svc/repository.db \ - /usr/sbin/svccfg import $rootprefix/var/svc/manifest/$1 + svccfg import $rootprefix/var/svc/manifest/$1 elif [[ -n $rootprefix ]]; then echo "Warning: This system does not have SMF, so I" echo "cannot ensure the pre-import of $1. If it does" @@ -818,16 +818,15 @@ update_etc_inet_sock2path() # unloaded from the kernel, after which applications will fail. # sockfile=$rootprefix/etc/inet/sock2path - xgrep=/usr/xpg4/bin/grep ${ZCAT} ${cpiodir}/generic.usr$ZFIX | cpio -it 2>/dev/null | - ${xgrep} -q sockpfp + xpg4grep -q sockpfp if [ $? -eq 1 ] ; then - ${xgrep} -v -E '^ 32 [14] 0 sockpfp' \ + xpg4grep -v -E '^ 32 [14] 0 sockpfp' \ ${sockfile} > /tmp/sock2path.tmp.$$ cp /tmp/sock2path.tmp.$$ ${sockfile} else - if ! ${xgrep} -q -E \ + if ! xpg4grep -q -E \ '^ 31 [14] 0 sockpfp' ${sockfile}; then echo '' >> ${sockfile} echo ' 32 1 0 sockpfp' >> ${sockfile} @@ -2373,7 +2372,7 @@ EOFA # achieved by passing the service FMRI as the second argument to # smf_import_service(). # - /usr/bin/svcs svc:/network/datalink-management:default \ + svcs svc:/network/datalink-management:default \ >/dev/null 2>/dev/null if [ $? -eq 0 ]; then smf_import_service network/dlmgmt.xml @@ -2558,6 +2557,8 @@ extraction_error() { # Make a local copy of bfu in /tmp and execute that instead. # This makes us immune to loss of networking and/or changes # to the original copy that might occur during execution. +# While we're doing this, set ACR to the instance of acr in +# the same directory as bfu (we hope they are a matched pair). # cd . abspath=`[[ $0 = /* ]] && print $0 || print $PWD/$0` @@ -2566,6 +2567,12 @@ if [[ $abspath != /tmp/* ]]; then print "Copying $abspath to $localpath" cp $abspath $localpath chmod +x $localpath + if [ -z "$ACR" ] ; then + acr=`dirname $abspath`/acr + if [ -x "$acr" ] ; then + export ACR="$acr" + fi + fi print "Executing $localpath $*\n" exec $localpath $* fi @@ -3052,9 +3059,11 @@ bfucmd=" /usr/bin/more /usr/bin/mv /usr/bin/nawk + /usr/bin/od /usr/bin/pgrep /usr/bin/pkginfo /usr/bin/pkill + /usr/bin/plabel /usr/bin/printf /usr/bin/ps /usr/bin/ptree @@ -3081,11 +3090,14 @@ bfucmd=" /usr/bin/wc /usr/bin/xargs /usr/bin/zcat + /lib/svc/bin/mfstscan /usr/sbin/add_drv /usr/sbin/chroot + /usr/sbin/fstyp /usr/sbin/halt /usr/sbin/lockfs /usr/sbin/lofiadm + /usr/sbin/logadm /usr/sbin/mkfile /usr/sbin/mkfs /usr/sbin/mknod @@ -3101,17 +3113,30 @@ bfucmd=" /usr/sbin/umount /usr/sbin/update_drv /usr/sbin/wall + /usr/sbin/zfs + /usr/sbin/zpool /usr/sbin/zonecfg ${FASTFS-$GATE/public/bin/$bfu_isa/fastfs} ${GZIPBIN-$GATE/public/bin/$bfu_isa/gzip} " + +# +# Add /usr/xpg4/bin/grep to the bfucmd list as xpg4grep +# +rm -rf /tmp/xpg4grep +cp /usr/xpg4/bin/grep /tmp/xpg4grep +bfucmd="${bfucmd} /tmp/xpg4grep" + # # Scripts needed by BFU. These must be modified to use the interpreters in # /tmp/bfubin. The interpreters in /usr/bin may not be compatible with the # libraries in the archives being extracted. # +if [ -z "$ACR" ] ; then + ACR=${GATE}/public/bin/acr +fi bfuscr=" - ${ACR-${GATE}/public/bin/acr} + ${ACR} " # @@ -3120,46 +3145,47 @@ bfuscr=" # This does not handle compiled shell scripts yet. # bfuchameleons=" - /usr/bin/basename - /usr/bin/bg - /usr/bin/cd - /usr/bin/cksum - /usr/bin/cmp - /usr/bin/comm - /usr/bin/command - /usr/bin/dirname - /usr/bin/cut - /usr/bin/fc - /usr/bin/fg - /usr/bin/getopts - /usr/bin/hash - /usr/bin/jobs - /usr/bin/join - /usr/bin/kill - /usr/bin/logname - /usr/bin/paste - /usr/bin/print - /usr/bin/read - /usr/bin/rev - /usr/bin/sleep - /usr/bin/sum - /usr/bin/tee - /usr/bin/test - /usr/bin/type - /usr/bin/ulimit - /usr/bin/umask - /usr/bin/unalias - /usr/bin/uniq - /usr/bin/wait - /usr/bin/wc + /usr/bin/basename + /usr/bin/bg + /usr/bin/cd + /usr/bin/cksum + /usr/bin/cmp + /usr/bin/comm + /usr/bin/command + /usr/bin/dirname + /usr/bin/cut + /usr/bin/fc + /usr/bin/fg + /usr/bin/gconftool-2 + /usr/bin/getopts + /usr/bin/hash + /usr/bin/jobs + /usr/bin/join + /usr/bin/kill + /usr/bin/logname + /usr/bin/paste + /usr/bin/print + /usr/bin/read + /usr/bin/rev + /usr/bin/sleep + /usr/bin/sum + /usr/bin/tee + /usr/bin/test + /usr/bin/type + /usr/bin/ulimit + /usr/bin/umask + /usr/bin/unalias + /usr/bin/uniq + /usr/bin/wait + /usr/bin/wc " for chameleon in ${bfuchameleons} ; do - if [[ "$(file "${chameleon}")" == *ELF* ]] ; then - bfucmd="${bfucmd} ${chameleon}" - else - bfuscr="${bfuscr} ${chameleon}" - fi + if [[ "$(file "${chameleon}")" == *ELF* ]] ; then + bfucmd="${bfucmd} ${chameleon}" + else + bfuscr="${bfuscr} ${chameleon}" + fi done rm -rf /tmp/bfubin @@ -3425,51 +3451,74 @@ ${BFULD-$GATE/public/bin/$bfu_isa/bfuld} /tmp/bfubin/* || fail "bfuld failed" for x in $bfuscr do - sed -e 's/\/usr\/bin\//\/tmp\/bfubin\//g' \ - -e 's/\/bin\//\/tmp\/bfubin\//g' < $x > /tmp/bfubin/`basename $x` + if [ "$x" = "$ACR" ] ; then # ACR is special + sed -e 's/^#!\/usr\/bin\//#!\/tmp\/bfubin\//' \ + -e 's/^#!\/bin\//#!\/tmp\/bfubin\//' \ + < $x > /tmp/bfubin/`basename $x` + else + sed -e 's/\/usr\/bin\//\/tmp\/bfubin\//g' \ + -e 's/\/bin\//\/tmp\/bfubin\//g' \ + < $x > /tmp/bfubin/`basename $x` + fi chmod +x /tmp/bfubin/`basename $x` done # # scripts used together with multiboot # -multiboot_scr=" - /boot/solaris/bin/create_ramdisk - /boot/solaris/bin/create_diskmap - /boot/solaris/bin/root_archive -" - -if [ $multi_or_direct = yes ]; then - for cmd in $multiboot_scr - do - file=`basename $cmd` - if [ -f $cmd ]; then - cp $cmd /tmp/bfubin - else - if [ ! -d $MULTIBOOT_BIN_DIR ]; then - echo "$MULTIBOOT_BIN_DIR: not found" - fail "" - fi +if [ $target_isa = sparc -a $diskless = no ] ; then + multiboot_scr=" + /boot/solaris/bin/create_ramdisk + " +else + multiboot_scr=" + /boot/solaris/bin/create_ramdisk + /boot/solaris/bin/create_diskmap + /boot/solaris/bin/root_archive + " +fi - if [ ! -f $MULTIBOOT_BIN_DIR/$file ]; then - echo "$MULTIBOOT_BIN_DIR/$file: not found" - fail "" - fi - echo "copying $file from $MULTIBOOT_BIN_DIR" - cp $MULTIBOOT_BIN_DIR/$file /tmp/bfubin +for cmd in $multiboot_scr +do + file=`basename $cmd` + if [ -f $cmd ]; then + cp $cmd /tmp/bfubin + else + if [ ! -d $MULTIBOOT_BIN_DIR ]; then + echo "$MULTIBOOT_BIN_DIR: not found" + fail "" fi - # - # We do two substitutions here to replace references to - # both /usr/bin/ and /bin/ with /tmp/bfubin/ - # - mv /tmp/bfubin/${file} /tmp/bfubin/${file}- - sed -e 's/\/usr\/bin\//\/tmp\/bfubin\//g' \ - -e 's/\/bin\//\/tmp\/bfubin\//g' \ - < /tmp/bfubin/${file}- > /tmp/bfubin/${file} - chmod +x /tmp/bfubin/${file} - done -fi + if [ ! -f $MULTIBOOT_BIN_DIR/$file ]; then + echo "$MULTIBOOT_BIN_DIR/$file: not found" + fail "" + fi + echo "copying $file from $MULTIBOOT_BIN_DIR" + cp $MULTIBOOT_BIN_DIR/$file /tmp/bfubin + fi + + # + # These files need special editing to be used + # inside the bfu protected environment. + # + mv /tmp/bfubin/${file} /tmp/bfubin/${file}- + sed -e 's/boot\/solaris\/bin/BOOT_SOLARIS_BIN/g' \ + -e 's/usr\/sbin\/install/USR_SBIN_INSTALL/g' \ + -e 's/usr\/openwin\/bin/USR_OPENWIN_BIN/g' \ + -e 's/ usr\/bin\// USR_BIN/g' \ + -e 's/\/usr\/bin\//\/tmp\/bfubin\//g' \ + -e 's/\/usr\/sbin\//\/tmp\/bfubin\//g' \ + -e 's/\/bin\//\/tmp\/bfubin\//g' \ + -e 's/\/sbin\//\/tmp\/bfubin\//g' \ + -e 's/ USR_BIN/ usr\/bin\//g' \ + -e 's/USR_OPENWIN_BIN/usr\/openwin\/bin/g' \ + -e 's/USR_SBIN_INSTALL/usr\/sbin\/install/g' \ + -e 's/BOOT_SOLARIS_BIN/boot\/solaris\/bin/g' \ + -e 's/\$(\$EXTRACT_FILELIST/\$(ksh \$EXTRACT_FILELIST/' \ + < /tmp/bfubin/${file}- > /tmp/bfubin/${file} + chmod +x /tmp/bfubin/${file} + rm /tmp/bfubin/${file}- +done # # For directboot archives, /boot/platform/i86pc/kernel/unix will be @@ -5903,8 +5952,15 @@ build_boot_archive() #PATH=/tmp/bfubin /tmp/bfubin/bootadm update $bootadm_args cr_args=${rootprefix:+ -R $rootprefix} - LD_LIBRARY_PATH=/tmp/bfulib PATH=/tmp/bfubin \ - /tmp/bfubin/ksh $rootprefix/boot/solaris/bin/create_ramdisk $cr_args + if [ -x /tmp/bfubin/create_ramdisk ] ; then + LD_LIBRARY_PATH=/tmp/bfulib PATH=/tmp/bfubin \ + /tmp/bfubin/ksh \ + /tmp/bfubin/create_ramdisk $cr_args + else + LD_LIBRARY_PATH=/tmp/bfulib PATH=/tmp/bfubin \ + /tmp/bfubin/ksh \ + $rootprefix/boot/solaris/bin/create_ramdisk $cr_args + fi # # Disable the boot-archive service on the first boot @@ -8506,7 +8562,7 @@ mondo_loop() { # for file in `ls $rootprefix/etc/inet/ike/crls/* \ $rootprefix/etc/inet/ike/publickeys/* 2>/dev/null`; do - if /bin/od -tx1 -N3 < $file | grep '30 82' >/dev/null 2>&1 + if od -tx1 -N3 < $file | grep '30 82' >/dev/null 2>&1 then chmod 644 $file fi diff --git a/usr/src/ucbcmd/sbcp/syscalls.list b/usr/src/ucbcmd/sbcp/syscalls.list index cb11850df6..7004893578 100644 --- a/usr/src/ucbcmd/sbcp/syscalls.list +++ b/usr/src/ucbcmd/sbcp/syscalls.list @@ -18,14 +18,12 @@ # # CDDL HEADER END # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# nosys NOSYS /* 0 = 1, indir */ exit TRAP /* 1 = 1, exit */ -forkall TRAP /* 2 = 0, fork */ +fork SIMPLE /* 2 = 0, fork */ read SIMPLE /* 3 = 3, read */ write SIMPLE /* 4 = 3, write */ open SIMPLE /* 5 = 3, open */ diff --git a/usr/src/uts/common/Makefile.files b/usr/src/uts/common/Makefile.files index 3dba7ff046..b751c7e30a 100644 --- a/usr/src/uts/common/Makefile.files +++ b/usr/src/uts/common/Makefile.files @@ -172,7 +172,6 @@ GENUNIX_OBJS += \ fm.o \ fork.o \ vpm.o \ - fsat.o \ fs_reparse.o \ fs_subr.o \ fsflush.o \ @@ -279,7 +278,6 @@ GENUNIX_OBJS += \ process.o \ rlimit.o \ rmap.o \ - rmdir.o \ rw.o \ rwstlock.o \ sad_conf.o \ diff --git a/usr/src/uts/common/brand/sn1/sn1_brand.c b/usr/src/uts/common/brand/sn1/sn1_brand.c index bf985bfcbf..f75e55045e 100644 --- a/usr/src/uts/common/brand/sn1/sn1_brand.c +++ b/usr/src/uts/common/brand/sn1/sn1_brand.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -772,7 +772,6 @@ _init(void) sn1_emulation_table = kmem_zalloc(NSYSCALL, KM_SLEEP); sn1_emulation_table[SYS_read] = 1; /* 3 */ sn1_emulation_table[SYS_write] = 1; /* 4 */ - sn1_emulation_table[SYS_wait] = 1; /* 7 */ sn1_emulation_table[SYS_time] = 1; /* 13 */ sn1_emulation_table[SYS_getpid] = 1; /* 20 */ sn1_emulation_table[SYS_mount] = 1; /* 21 */ @@ -781,6 +780,7 @@ _init(void) sn1_emulation_table[SYS_getgid] = 1; /* 47 */ sn1_emulation_table[SYS_utssys] = 1; /* 57 */ sn1_emulation_table[SYS_readlink] = 1; /* 90 */ + sn1_emulation_table[SYS_waitid] = 1; /* 107 */ sn1_emulation_table[SYS_uname] = 1; /* 135 */ err = mod_install(&modlinkage); diff --git a/usr/src/uts/common/brand/solaris10/s10_brand.c b/usr/src/uts/common/brand/solaris10/s10_brand.c index 289ddd349a..ce25f37c03 100644 --- a/usr/src/uts/common/brand/solaris10/s10_brand.c +++ b/usr/src/uts/common/brand/solaris10/s10_brand.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -948,24 +949,58 @@ _init(void) * library. */ s10_emulation_table = kmem_zalloc(NSYSCALL, KM_SLEEP); - s10_emulation_table[SYS_exec] = 1; /* 11 */ + s10_emulation_table[S10_SYS_forkall] = 1; /* 2 */ + s10_emulation_table[S10_SYS_open] = 1; /* 5 */ + s10_emulation_table[S10_SYS_wait] = 1; /* 7 */ + s10_emulation_table[S10_SYS_creat] = 1; /* 8 */ + s10_emulation_table[S10_SYS_unlink] = 1; /* 10 */ + s10_emulation_table[S10_SYS_exec] = 1; /* 11 */ + s10_emulation_table[S10_SYS_chown] = 1; /* 16 */ + s10_emulation_table[S10_SYS_stat] = 1; /* 18 */ + s10_emulation_table[S10_SYS_umount] = 1; /* 22 */ + s10_emulation_table[S10_SYS_fstat] = 1; /* 28 */ + s10_emulation_table[S10_SYS_utime] = 1; /* 30 */ + s10_emulation_table[S10_SYS_access] = 1; /* 33 */ + s10_emulation_table[S10_SYS_dup] = 1; /* 41 */ s10_emulation_table[SYS_ioctl] = 1; /* 54 */ s10_emulation_table[SYS_execve] = 1; /* 59 */ s10_emulation_table[SYS_acctctl] = 1; /* 71 */ s10_emulation_table[S10_SYS_issetugid] = 1; /* 75 */ + s10_emulation_table[S10_SYS_fsat] = 1; /* 76 */ + s10_emulation_table[S10_SYS_rmdir] = 1; /* 79 */ s10_emulation_table[SYS_getdents] = 1; /* 81 */ + s10_emulation_table[S10_SYS_poll] = 1; /* 87 */ + s10_emulation_table[S10_SYS_lstat] = 1; /* 88 */ + s10_emulation_table[S10_SYS_fchown] = 1; /* 94 */ +#if defined(__x86) + s10_emulation_table[S10_SYS_xstat] = 1; /* 123 */ + s10_emulation_table[S10_SYS_lxstat] = 1; /* 124 */ + s10_emulation_table[S10_SYS_fxstat] = 1; /* 125 */ + s10_emulation_table[S10_SYS_xmknod] = 1; /* 126 */ +#endif + s10_emulation_table[S10_SYS_lchown] = 1; /* 130 */ + s10_emulation_table[S10_SYS_rename] = 1; /* 134 */ s10_emulation_table[SYS_uname] = 1; /* 135 */ s10_emulation_table[SYS_systeminfo] = 1; /* 139 */ -#ifdef __amd64 + s10_emulation_table[S10_SYS_fork1] = 1; /* 143 */ + s10_emulation_table[S10_SYS_lwp_sema_wait] = 1; /* 147 */ + s10_emulation_table[S10_SYS_utimes] = 1; /* 154 */ +#if defined(__amd64) s10_emulation_table[SYS_lwp_create] = 1; /* 159 */ s10_emulation_table[SYS_lwp_private] = 1; /* 166 */ #endif /* __amd64 */ + s10_emulation_table[S10_SYS_lwp_mutex_lock] = 1; /* 169 */ s10_emulation_table[SYS_pwrite] = 1; /* 174 */ s10_emulation_table[SYS_auditsys] = 1; /* 186 */ s10_emulation_table[SYS_sigqueue] = 1; /* 190 */ s10_emulation_table[SYS_lwp_mutex_timedlock] = 1; /* 210 */ s10_emulation_table[SYS_getdents64] = 1; /* 213 */ + s10_emulation_table[S10_SYS_stat64] = 1; /* 215 */ + s10_emulation_table[S10_SYS_lstat64] = 1; /* 216 */ + s10_emulation_table[S10_SYS_fstat64] = 1; /* 217 */ s10_emulation_table[SYS_pwrite64] = 1; /* 223 */ + s10_emulation_table[S10_SYS_creat64] = 1; /* 224 */ + s10_emulation_table[S10_SYS_open64] = 1; /* 225 */ s10_emulation_table[SYS_zone] = 1; /* 227 */ s10_emulation_table[SYS_lwp_mutex_trylock] = 1; /* 251 */ diff --git a/usr/src/uts/common/brand/solaris10/s10_brand.h b/usr/src/uts/common/brand/solaris10/s10_brand.h index 80bd78fe6b..8fdb2bd65f 100644 --- a/usr/src/uts/common/brand/solaris10/s10_brand.h +++ b/usr/src/uts/common/brand/solaris10/s10_brand.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -100,10 +100,44 @@ enum s10_emulated_features { #define AT_SUN_BRAND_S10_LDDATA AT_SUN_BRAND_AUX1 /* - * S10 system call codes for S10 traps that have been removed or - * re-assigned. + * S10 system call codes for S10 traps that have been removed or reassigned, + * or that are to be removed or reassigned after the dtrace syscall provider + * has been reengineered to deal properly with syscall::open (for example). */ +#define S10_SYS_forkall 2 +#define S10_SYS_open 5 +#define S10_SYS_wait 7 +#define S10_SYS_creat 8 +#define S10_SYS_unlink 10 +#define S10_SYS_exec 11 +#define S10_SYS_chown 16 +#define S10_SYS_stat 18 +#define S10_SYS_umount 22 +#define S10_SYS_fstat 28 +#define S10_SYS_utime 30 +#define S10_SYS_access 33 +#define S10_SYS_dup 41 #define S10_SYS_issetugid 75 +#define S10_SYS_fsat 76 +#define S10_SYS_rmdir 79 +#define S10_SYS_poll 87 +#define S10_SYS_lstat 88 +#define S10_SYS_fchown 94 +#define S10_SYS_xstat 123 +#define S10_SYS_lxstat 124 +#define S10_SYS_fxstat 125 +#define S10_SYS_xmknod 126 +#define S10_SYS_lchown 130 +#define S10_SYS_rename 134 +#define S10_SYS_fork1 143 +#define S10_SYS_lwp_sema_wait 147 +#define S10_SYS_utimes 154 +#define S10_SYS_lwp_mutex_lock 169 +#define S10_SYS_stat64 215 +#define S10_SYS_lstat64 216 +#define S10_SYS_fstat64 217 +#define S10_SYS_creat64 224 +#define S10_SYS_open64 225 /* * solaris10-brand-specific attributes diff --git a/usr/src/uts/common/c2/audit.c b/usr/src/uts/common/c2/audit.c index a39d9b86e3..7c12cf3406 100644 --- a/usr/src/uts/common/c2/audit.c +++ b/usr/src/uts/common/c2/audit.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -300,11 +300,11 @@ audit_savepath( */ if (tad->tad_flag) { - if (flag && (tad->tad_scid == SYS_open || + if (flag && + (tad->tad_scid == SYS_open || tad->tad_scid == SYS_open64 || - tad->tad_scid == SYS_creat || - tad->tad_scid == SYS_creat64 || - tad->tad_scid == SYS_fsat)) { + tad->tad_scid == SYS_openat || + tad->tad_scid == SYS_openat64)) { tad->tad_ctrl |= PAD_TRUE_CREATE; } @@ -328,7 +328,7 @@ audit_savepath( } } - /* free up space if we're not going to save path (open, crate) */ + /* free up space if we're not going to save path (open, creat) */ if ((tad->tad_ctrl & PAD_SAVPATH) == 0) { if (tad->tad_aupath != NULL) { au_pathrele(tad->tad_aupath); @@ -366,7 +366,7 @@ audit_pathbuild(struct pathname *pnp) mutex_enter(&pad->pad_lock); if (tad->tad_aupath != NULL) { pfxapp = tad->tad_aupath; - } else if (tad->tad_scid == SYS_fsat && pnp->pn_buf[0] != '/') { + } else if ((tad->tad_ctrl & PAD_ATCALL) && pnp->pn_buf[0] != '/') { ASSERT(tad->tad_atpath != NULL); pfxapp = tad->tad_atpath; } else if (tad->tad_ctrl & PAD_ABSPATH) { @@ -378,7 +378,7 @@ audit_pathbuild(struct pathname *pnp) mutex_exit(&pad->pad_lock); /* get an expanded buffer to hold the anchored path */ - newsect = tad->tad_ctrl & PAD_ATPATH; + newsect = tad->tad_ctrl & PAD_ATTPATH; newapp = au_pathdup(pfxapp, newsect, len); au_pathrele(pfxapp); @@ -400,7 +400,7 @@ audit_pathbuild(struct pathname *pnp) tad->tad_aupath = newapp; /* for case where multiple lookups in one syscall (rename) */ - tad->tad_ctrl &= ~(PAD_ABSPATH | PAD_ATPATH); + tad->tad_ctrl &= ~(PAD_ABSPATH | PAD_ATTPATH); } @@ -1120,9 +1120,10 @@ audit_setf(file_t *fp, int fd) tad = T2A(curthread); fad = F2A(fp); - if (!(tad->tad_scid == SYS_open || tad->tad_scid == SYS_creat || - tad->tad_scid == SYS_open64 || tad->tad_scid == SYS_creat64 || - tad->tad_scid == SYS_fsat)) + if (!(tad->tad_scid == SYS_open || + tad->tad_scid == SYS_open64 || + tad->tad_scid == SYS_openat || + tad->tad_scid == SYS_openat64)) return; /* no path */ @@ -1138,7 +1139,7 @@ audit_setf(file_t *fp, int fd) tad->tad_vn = NULL; if (!(tad->tad_ctrl & PAD_TRUE_CREATE)) { - /* adjust event type */ + /* adjust event type by dropping the 'creat' part */ switch (tad->tad_event) { case AUE_OPEN_RC: tad->tad_event = AUE_OPEN_R; @@ -1293,57 +1294,43 @@ audit_setfsat_path(int argnum) struct f_audit_data *fad; p_audit_data_t *pad; /* current process */ struct a { - long id; long arg1; long arg2; long arg3; long arg4; long arg5; } *uap; - struct b { - long arg1; - long arg2; - long arg3; - long arg4; - long arg5; - } *uap1; if (clwp == NULL) return; - uap1 = (struct b *)&clwp->lwp_ap[1]; uap = (struct a *)clwp->lwp_ap; tad = U2A(u); - ASSERT(tad != NULL); - if (tad->tad_scid != SYS_fsat) - return; - - switch (argnum) { - case 1: - fd = (uint32_t)uap1->arg1; + switch (tad->tad_scid) { + case SYS_faccessat: + case SYS_fchownat: + case SYS_fstatat: + case SYS_fstatat64: + case SYS_openat: + case SYS_openat64: + case SYS_unlinkat: + fd = uap->arg1; break; - case 2: - fd = (uint32_t)uap1->arg2; - break; - case 3: - fd = (uint32_t)uap1->arg3; - break; - case 4: - fd = (uint32_t)uap1->arg4; + case SYS_renameat: + if (argnum == 3) + fd = uap->arg3; + else + fd = uap->arg1; break; - case 5: - fd = (uint32_t)uap1->arg5; + case SYS_utimesys: + fd = uap->arg2; break; default: return; } - if (uap->id == 9 && tad->tad_atpath != NULL) { /* openattrdir */ - tad->tad_ctrl |= PAD_ATPATH; - return; - } if (tad->tad_atpath != NULL) { au_pathrele(tad->tad_atpath); tad->tad_atpath = NULL; @@ -1353,7 +1340,6 @@ audit_setfsat_path(int argnum) tad->tad_ctrl |= PAD_NOPATH; return; } - fad = F2A(fp); ASSERT(fad); if (fad->fad_aupath == NULL) { @@ -1678,8 +1664,11 @@ audit_getf(int fd) tad = T2A(curthread); - if (!(tad->tad_scid == SYS_open || tad->tad_scid == SYS_creat)) - return; + if (!(tad->tad_scid == SYS_openat || + tad->tad_scid == SYS_openat64 || + tad->tad_scid == SYS_open || + tad->tad_scid == SYS_open64)) + return (0); #endif return (0); } diff --git a/usr/src/uts/common/c2/audit_event.c b/usr/src/uts/common/c2/audit_event.c index fbb96fcaf3..ed1d8c8f76 100644 --- a/usr/src/uts/common/c2/audit_event.c +++ b/usr/src/uts/common/c2/audit_event.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -81,14 +81,16 @@ char _depends_on[] = "fs/sockfs"; +static au_event_t aui_fchownat(au_event_t); static au_event_t aui_open(au_event_t); -static au_event_t aui_fsat(au_event_t); +static au_event_t aui_openat(au_event_t); +static au_event_t aui_unlinkat(au_event_t); +static au_event_t aui_fstatat(au_event_t); static au_event_t aui_msgsys(au_event_t); static au_event_t aui_shmsys(au_event_t); static au_event_t aui_semsys(au_event_t); static au_event_t aui_utssys(au_event_t); static au_event_t aui_fcntl(au_event_t); -static au_event_t aui_execv(au_event_t); static au_event_t aui_execve(au_event_t); static au_event_t aui_memcntl(au_event_t); static au_event_t aui_sysinfo(au_event_t); @@ -103,20 +105,20 @@ static au_event_t aui_labelsys(au_event_t); static au_event_t aui_setpgrp(au_event_t); static void aus_open(struct t_audit_data *); +static void aus_openat(struct t_audit_data *); static void aus_acl(struct t_audit_data *); static void aus_acct(struct t_audit_data *); static void aus_chown(struct t_audit_data *); static void aus_fchown(struct t_audit_data *); static void aus_lchown(struct t_audit_data *); +static void aus_fchownat(struct t_audit_data *); static void aus_chmod(struct t_audit_data *); static void aus_facl(struct t_audit_data *); static void aus_fchmod(struct t_audit_data *); static void aus_fcntl(struct t_audit_data *); -static void aus_fsat(struct t_audit_data *); static void aus_mkdir(struct t_audit_data *); static void aus_mknod(struct t_audit_data *); static void aus_mount(struct t_audit_data *); -static void aus_umount(struct t_audit_data *); static void aus_umount2(struct t_audit_data *); static void aus_msgsys(struct t_audit_data *); static void aus_semsys(struct t_audit_data *); @@ -143,7 +145,6 @@ static void aus_auditsys(struct t_audit_data *); static void aus_sysinfo(struct t_audit_data *); static void aus_modctl(struct t_audit_data *); static void aus_kill(struct t_audit_data *); -static void aus_xmknod(struct t_audit_data *); static void aus_setregid(struct t_audit_data *); static void aus_setreuid(struct t_audit_data *); static void aus_labelsys(struct t_audit_data *); @@ -152,7 +153,6 @@ static void auf_mknod(struct t_audit_data *, int, rval_t *); static void auf_msgsys(struct t_audit_data *, int, rval_t *); static void auf_semsys(struct t_audit_data *, int, rval_t *); static void auf_shmsys(struct t_audit_data *, int, rval_t *); -static void auf_xmknod(struct t_audit_data *, int, rval_t *); static void auf_read(struct t_audit_data *, int, rval_t *); static void auf_write(struct t_audit_data *, int, rval_t *); @@ -201,7 +201,7 @@ aui_null, AUE_NULL, aus_null, /* 0 unused (indirect) */ auf_null, 0, aui_null, AUE_EXIT, aus_null, /* 1 exit */ auf_null, S2E_NPT, -aui_null, AUE_FORKALL, aus_null, /* 2 forkall */ +aui_null, AUE_NULL, aus_null, /* 2 (loadable) was forkall */ auf_null, 0, aui_null, AUE_READ, aus_null, /* 3 read */ auf_read, S2E_PUB, @@ -211,16 +211,16 @@ aui_open, AUE_OPEN, aus_open, /* 5 open */ auf_null, S2E_SP, aui_null, AUE_CLOSE, aus_close, /* 6 close */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 7 wait */ +aui_null, AUE_NULL, aus_null, /* 7 (loadable) was wait */ + auf_null, 0, +aui_null, AUE_NULL, aus_null, /* 8 (loadable) was creat */ auf_null, 0, -aui_null, AUE_CREAT, aus_null, /* 8 create */ - auf_null, S2E_SP, aui_null, AUE_LINK, aus_null, /* 9 link */ auf_null, 0, aui_null, AUE_UNLINK, aus_null, /* 10 unlink */ auf_null, 0, -aui_execv, AUE_EXEC, aus_null, /* 11 exec */ - auf_null, S2E_MLD, +aui_null, AUE_NULL, aus_null, /* 11 (loadable) was exec */ + auf_null, 0, aui_null, AUE_CHDIR, aus_null, /* 12 chdir */ auf_null, S2E_SP, aui_null, AUE_NULL, aus_null, /* 13 time */ @@ -241,7 +241,7 @@ aui_null, AUE_NULL, aus_null, /* 20 getpid */ auf_null, 0, aui_null, AUE_MOUNT, aus_mount, /* 21 mount */ auf_null, S2E_MLD, -aui_null, AUE_UMOUNT, aus_umount, /* 22 umount */ +aui_null, AUE_NULL, aus_null, /* 22 (loadable) was umount */ auf_null, 0, aui_null, AUE_SETUID, aus_setuid, /* 23 setuid */ auf_null, 0, @@ -249,7 +249,7 @@ aui_null, AUE_NULL, aus_null, /* 24 getuid */ auf_null, 0, aui_null, AUE_STIME, aus_null, /* 25 stime */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 26 (loadable) was ptrace */ +aui_null, AUE_NULL, aus_null, /* 26 pcsample */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 27 alarm */ auf_null, 0, @@ -257,7 +257,7 @@ aui_null, AUE_NULL, aus_null, /* 28 fstat */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 29 pause */ auf_null, 0, -aui_null, AUE_UTIME, aus_null, /* 30 utime */ +aui_null, AUE_NULL, aus_null, /* 30 (loadable) was utime */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 31 stty (TIOCSETP-audit?) */ auf_null, 0, @@ -279,24 +279,23 @@ aui_setpgrp, AUE_SETPGRP, aus_setpgrp, /* 39 setpgrp */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 40 uucopystr */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 41 dup */ +aui_null, AUE_NULL, aus_null, /* 41 (loadable) was dup */ auf_null, 0, -aui_null, AUE_PIPE, aus_null, /* 42 pipe */ +aui_null, AUE_PIPE, aus_null, /* 42 (loadable) pipe */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 43 times */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 44 profil */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 45 (loadable) */ - /* was proc lock */ - auf_null, 0, +aui_null, AUE_ACCESS, aus_null, /* 45 faccessat */ + auf_null, S2E_PUB | S2E_ATC, aui_null, AUE_SETGID, aus_setgid, /* 46 setgid */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 47 getgid */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 48 sig */ +aui_null, AUE_NULL, aus_null, /* 48 (loadable) was ssig */ auf_null, 0, -aui_msgsys, AUE_MSGSYS, aus_msgsys, /* 49 (loadable) was msgsys */ +aui_msgsys, AUE_MSGSYS, aus_msgsys, /* 49 (loadable) msgsys */ auf_msgsys, 0, #if defined(__x86) aui_null, AUE_NULL, aus_null, /* 50 sysi86 */ @@ -305,18 +304,18 @@ aui_null, AUE_NULL, aus_null, /* 50 sysi86 */ aui_null, AUE_NULL, aus_null, /* 50 (loadable) was sys3b */ auf_null, 0, #endif /* __x86 */ -aui_null, AUE_ACCT, aus_acct, /* 51 acct */ +aui_null, AUE_ACCT, aus_acct, /* 51 (loadable) sysacct */ auf_null, 0, -aui_shmsys, AUE_SHMSYS, aus_shmsys, /* 52 shared memory */ +aui_shmsys, AUE_SHMSYS, aus_shmsys, /* 52 (loadable) shmsys */ auf_shmsys, 0, -aui_semsys, AUE_SEMSYS, aus_semsys, /* 53 IPC semaphores */ +aui_semsys, AUE_SEMSYS, aus_semsys, /* 53 (loadable) semsys */ auf_semsys, 0, aui_null, AUE_IOCTL, aus_ioctl, /* 54 ioctl */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 55 uadmin */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 56 (loadable) was uexch */ - auf_null, 0, +aui_fchownat, AUE_NULL, aus_fchownat, /* 56 fchownat */ + auf_null, S2E_ATC, aui_utssys, AUE_FUSERS, aus_null, /* 57 utssys */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 58 fsync */ @@ -331,38 +330,35 @@ aui_fcntl, AUE_FCNTL, aus_fcntl, /* 62 fcntl */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 63 ulimit */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 64 (loadable) */ - auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 65 (loadable) */ +aui_null, AUE_RENAME, aus_null, /* 64 renameat */ + auf_null, S2E_ATC, +aui_unlinkat, AUE_NULL, aus_null, /* 65 unlinkat */ + auf_null, S2E_ATC, +aui_fstatat, AUE_NULL, aus_null, /* 66 fstatat */ + auf_null, S2E_PUB | S2E_ATC, +aui_fstatat, AUE_NULL, aus_null, /* 67 fstatat64 */ + auf_null, S2E_PUB | S2E_ATC, +aui_openat, AUE_OPEN, aus_openat, /* 68 openat */ + auf_null, S2E_SP | S2E_ATC, +aui_openat, AUE_OPEN, aus_openat, /* 69 openat64 */ + auf_null, S2E_SP | S2E_ATC, +aui_null, AUE_NULL, aus_null, /* 70 tasksys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 66 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 71 (loadable) acctctl */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 67 (loadable) */ - /* file locking call */ +aui_null, AUE_NULL, aus_null, /* 72 (loadable) exacct */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 68 (loadable) */ - /* local system calls */ +aui_null, AUE_NULL, aus_null, /* 73 getpagesizes */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 69 (loadable) inode open */ - auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 70 (loadable) was advfs */ - auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 71 (loadable) was unadvfs */ - auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 72 (loadable) was notused */ - auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 73 (loadable) was notused */ - auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 74 (loadable) was notused */ +aui_null, AUE_NULL, aus_null, /* 74 rctlsys */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 75 sidsys */ - /* was sigret (SunOS) */ auf_null, 0, -aui_fsat, AUE_FSAT, aus_fsat, /* 76 fsat */ +aui_null, AUE_NULL, aus_null, /* 76 (loadable) was fsat */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 77 (loadable) was rfstop */ +aui_null, AUE_NULL, aus_null, /* 77 syslwp_park */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 78 (loadable) was rfssys */ +aui_null, AUE_NULL, aus_null, /* 78 sendfilev */ auf_null, 0, aui_null, AUE_RMDIR, aus_null, /* 79 rmdir */ auf_null, 0, @@ -371,10 +367,8 @@ aui_null, AUE_MKDIR, aus_mkdir, /* 80 mkdir */ aui_null, AUE_NULL, aus_null, /* 81 getdents */ auf_null, 0, aui_privsys, AUE_NULL, aus_null, /* 82 privsys */ - /* was libattach */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 83 (loadable) */ - /* was libdetach */ +aui_null, AUE_NULL, aus_null, /* 83 ucredsys */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 84 sysfs */ auf_null, 0, @@ -382,7 +376,7 @@ aui_null, AUE_GETMSG, aus_getmsg, /* 85 getmsg */ auf_null, 0, aui_null, AUE_PUTMSG, aus_putmsg, /* 86 putmsg */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 87 poll */ +aui_null, AUE_NULL, aus_null, /* 87 (loadable) was poll */ auf_null, 0, aui_null, AUE_LSTAT, aus_null, /* 88 lstat */ auf_null, S2E_PUB, @@ -410,22 +404,21 @@ aui_null, AUE_NULL, aus_null, /* 99 sigpending */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 100 setcontext */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 101 (loadable) was evsys */ +aui_null, AUE_NULL, aus_null, /* 101 (loadable) */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 102 (loadable) */ - /* was evtrapret */ auf_null, 0, aui_null, AUE_STATVFS, aus_null, /* 103 statvfs */ auf_null, S2E_PUB, aui_null, AUE_NULL, aus_null, /* 104 fstatvfs */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 105 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 105 getloadavg */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 106 nfssys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 107 waitset */ +aui_null, AUE_NULL, aus_null, /* 107 waitsys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 108 sigsendset */ +aui_null, AUE_NULL, aus_null, /* 108 sigsendsys */ auf_null, 0, #if defined(__x86) aui_null, AUE_NULL, aus_null, /* 109 hrtsys */ @@ -434,12 +427,12 @@ aui_null, AUE_NULL, aus_null, /* 109 hrtsys */ aui_null, AUE_NULL, aus_null, /* 109 (loadable) */ auf_null, 0, #endif /* __x86 */ -aui_null, AUE_NULL, aus_null, /* 110 (loadable) was acancel */ +aui_null, AUE_UTIMES, aus_null, /* 110 utimesys */ + auf_null, S2E_ATC, +aui_null, AUE_NULL, aus_null, /* 111 sigresend */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 111 (loadable) was async */ +aui_null, AUE_PRIOCNTLSYS, aus_priocntlsys, /* 112 priocntlsys */ auf_null, 0, -aui_null, AUE_PRIOCNTLSYS, aus_priocntlsys, - auf_null, 0, /* 112 priocntlsys */ aui_null, AUE_PATHCONF, aus_null, /* 113 pathconf */ auf_null, S2E_PUB, aui_null, AUE_NULL, aus_null, /* 114 mincore */ @@ -460,15 +453,15 @@ aui_null, AUE_READ, aus_null, /* 121 readv */ auf_read, S2E_PUB, aui_null, AUE_WRITE, aus_null, /* 122 writev */ auf_write, 0, -aui_null, AUE_STAT, aus_null, /* 123 xstat (x86) */ - auf_null, S2E_PUB, -aui_null, AUE_LSTAT, aus_null, /* 124 lxstat (x86) */ - auf_null, S2E_PUB, -aui_null, AUE_NULL, aus_null, /* 125 fxstat (x86) */ +aui_null, AUE_NULL, aus_null, /* 123 (loadable) was xstat */ auf_null, 0, -aui_null, AUE_MKNOD, aus_xmknod, /* 126 xmknod (x86) */ - auf_xmknod, 0, -aui_null, AUE_NULL, aus_null, /* 127 (loadable) was clocal */ +aui_null, AUE_NULL, aus_null, /* 124 (loadable) was lxstat */ + auf_null, 0, +aui_null, AUE_NULL, aus_null, /* 125 (loadable) was fxstat */ + auf_null, 0, +aui_null, AUE_NULL, aus_null, /* 126 (loadable) was xmknod */ + auf_null, 0, +aui_null, AUE_NULL, aus_null, /* 127 mmapobj */ auf_null, 0, aui_null, AUE_SETRLIMIT, aus_null, /* 128 setrlimit */ auf_null, 0, @@ -494,13 +487,13 @@ aui_null, AUE_ADJTIME, aus_null, /* 138 adjtime */ auf_null, 0, aui_sysinfo, AUE_SYSINFO, aus_sysinfo, /* 139 systeminfo */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 140 reserved */ +aui_null, AUE_NULL, aus_null, /* 140 (loadable) sharefs */ auf_null, 0, aui_null, AUE_SETEUID, aus_seteuid, /* 141 seteuid */ auf_null, 0, aui_forksys, AUE_NULL, aus_null, /* 142 forksys */ auf_null, 0, -aui_null, AUE_FORK1, aus_null, /* 143 fork1 */ +aui_null, AUE_NULL, aus_null, /* 143 (loadable) was fork1 */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 144 sigwait */ auf_null, 0, @@ -508,21 +501,22 @@ aui_null, AUE_NULL, aus_null, /* 145 lwp_info */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 146 yield */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 147 lwp_sema_wait */ +aui_null, AUE_NULL, aus_null, /* 147 (loadable) */ + /* was lwp_sema_wait */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 148 lwp_sema_post */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 149 lwp_sema_trywait */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 150 (loadable reserved) */ +aui_null, AUE_NULL, aus_null, /* 150 lwp_detach */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 151 (loadable reserved) */ +aui_null, AUE_NULL, aus_null, /* 151 corectl */ auf_null, 0, aui_modctl, AUE_MODCTL, aus_modctl, /* 152 modctl */ auf_null, 0, aui_null, AUE_FCHROOT, aus_null, /* 153 fchroot */ auf_null, 0, -aui_null, AUE_UTIMES, aus_null, /* 154 utimes */ +aui_null, AUE_NULL, aus_null, /* 154 (loadable) was utimes */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 155 vhangup */ auf_null, 0, @@ -544,17 +538,16 @@ aui_null, AUE_NULL, aus_null, /* 163 lwp_kill */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 164 lwp_self */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 165 (loadable) */ - /* was lwp_setprivate */ +aui_null, AUE_NULL, aus_null, /* 165 lwp_sigmask */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 166 (loadable) */ - /* was lwp_getprivate */ +aui_null, AUE_NULL, aus_null, /* 166 lwp_private */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 167 lwp_wait */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 168 lwp_mutex_wakeup */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 169 lwp_mutex_lock */ +aui_null, AUE_NULL, aus_null, /* 169 (loadable) */ + /* was lwp_mutex_lock */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 170 lwp_cond_wait */ auf_null, 0, @@ -568,22 +561,21 @@ aui_null, AUE_WRITE, aus_null, /* 174 pwrite */ auf_write, 0, aui_null, AUE_NULL, aus_null, /* 175 llseek */ auf_null, 0, -aui_null, AUE_INST_SYNC, aus_inst_sync, /* 176 (loadable) */ - /* aus_inst_sync */ +aui_null, AUE_INST_SYNC, aus_inst_sync, /* 176 (loadable) inst_sync */ auf_null, 0, aui_null, AUE_BRANDSYS, aus_brandsys, /* 177 brandsys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 178 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 178 (loadable) kaio */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 179 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 179 (loadable) cpc */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 180 (loadable) kaio */ +aui_null, AUE_NULL, aus_null, /* 180 lgrpsys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 181 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 181 rusagesys */ auf_null, 0, aui_portfs, AUE_PORTFS, aus_null, /* 182 (loadable) portfs */ auf_null, S2E_MLD, -aui_null, AUE_NULL, aus_null, /* 183 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 183 pollsys */ auf_null, 0, aui_labelsys, AUE_NULL, aus_labelsys, /* 184 labelsys */ auf_null, 0, @@ -591,8 +583,8 @@ aui_acl, AUE_ACLSET, aus_acl, /* 185 acl */ auf_null, 0, aui_auditsys, AUE_AUDITSYS, aus_auditsys, /* 186 auditsys */ auf_null, 0, -aui_null, AUE_PROCESSOR_BIND, aus_processor_bind, - auf_null, 0, /* 187 processor_bind */ +aui_null, AUE_PROCESSOR_BIND, aus_processor_bind, /* 187 processor_bind */ + auf_null, 0, aui_null, AUE_NULL, aus_null, /* 188 processor_info */ auf_null, 0, aui_null, AUE_P_ONLINE, aus_p_online, /* 189 p_online */ @@ -633,7 +625,7 @@ aui_null, AUE_NULL, aus_null, /* 206 schedctl */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 207 (loadable) pset */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 208 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 208 sparc_utrap_install */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 209 resolvepath */ auf_null, 0, @@ -643,7 +635,7 @@ aui_null, AUE_NULL, aus_null, /* 211 lwp_sema_timedwait */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 212 lwp_rwlock_sys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 213 getdents64 (__ppc) */ +aui_null, AUE_NULL, aus_null, /* 213 getdents64 */ auf_null, 0, aui_null, AUE_MMAP, aus_mmap, /* 214 mmap64 */ auf_null, 0, @@ -665,17 +657,17 @@ aui_null, AUE_READ, aus_null, /* 222 pread64 */ auf_read, S2E_PUB, aui_null, AUE_WRITE, aus_null, /* 223 pwrite64 */ auf_write, 0, -aui_null, AUE_CREAT, aus_null, /* 224 creat64 */ - auf_null, S2E_SP, +aui_null, AUE_NULL, aus_null, /* 224 (loadable) was creat64 */ + auf_null, 0, aui_open, AUE_OPEN, aus_open, /* 225 open64 */ auf_null, S2E_SP, aui_null, AUE_NULL, aus_null, /* 226 (loadable) rpcsys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 227 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 227 zone */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 228 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 228 (loadable) autofssys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 229 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 229 getcwd */ auf_null, 0, aui_null, AUE_SOCKET, aus_socket, /* 230 so_socket */ auf_null, 0, @@ -715,7 +707,7 @@ aui_null, AUE_SOCKCONFIG, aus_sockconfig, /* 247 sockconfig */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 248 ntp_gettime */ auf_null, 0, -aui_null, AUE_NTP_ADJTIME, aus_null, /* 249 ntp_adjtime */ +aui_null, AUE_NTP_ADJTIME, aus_null, /* 249 ntp_adjtime */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 250 lwp_mutex_unlock */ auf_null, 0, @@ -840,6 +832,51 @@ aus_lchown(struct t_audit_data *tad) au_uwrite(au_to_arg32(3, "new file gid", gid)); } +static au_event_t +aui_fchownat(au_event_t e) +{ + klwp_t *clwp = ttolwp(curthread); + + struct a { + long fd; + long fname; /* char * */ + long uid; + long gid; + long flags; + } *uap = (struct a *)clwp->lwp_ap; + + if (uap->fname == NULL) + e = AUE_FCHOWN; + else if (uap->flags & AT_SYMLINK_NOFOLLOW) + e = AUE_LCHOWN; + else + e = AUE_CHOWN; + + return (e); +} + +/*ARGSUSED*/ +static void +aus_fchownat(struct t_audit_data *tad) +{ + klwp_t *clwp = ttolwp(curthread); + uint32_t uid, gid; + + struct a { + long fd; + long fname; /* char * */ + long uid; + long gid; + long flags; + } *uap = (struct a *)clwp->lwp_ap; + + uid = (uint32_t)uap->uid; + gid = (uint32_t)uap->gid; + + au_uwrite(au_to_arg32(3, "new file uid", uid)); + au_uwrite(au_to_arg32(4, "new file gid", gid)); +} + /* chmod start function */ /*ARGSUSED*/ static void @@ -901,11 +938,64 @@ aus_fchmod(struct t_audit_data *tad) releasef(fd); } +/* + * convert open mode to appropriate open event + */ +au_event_t +open_event(uint_t fm) +{ + au_event_t e; + + switch (fm & (O_RDONLY|O_WRONLY|O_RDWR|O_CREAT|O_TRUNC)) { + case O_RDONLY: + e = AUE_OPEN_R; + break; + case O_RDONLY | O_CREAT: + e = AUE_OPEN_RC; + break; + case O_RDONLY | O_TRUNC: + e = AUE_OPEN_RT; + break; + case O_RDONLY | O_TRUNC | O_CREAT: + e = AUE_OPEN_RTC; + break; + case O_WRONLY: + e = AUE_OPEN_W; + break; + case O_WRONLY | O_CREAT: + e = AUE_OPEN_WC; + break; + case O_WRONLY | O_TRUNC: + e = AUE_OPEN_WT; + break; + case O_WRONLY | O_TRUNC | O_CREAT: + e = AUE_OPEN_WTC; + break; + case O_RDWR: + e = AUE_OPEN_RW; + break; + case O_RDWR | O_CREAT: + e = AUE_OPEN_RWC; + break; + case O_RDWR | O_TRUNC: + e = AUE_OPEN_RWT; + break; + case O_RDWR | O_TRUNC | O_CREAT: + e = AUE_OPEN_RWTC; + break; + default: + e = AUE_NULL; + break; + } -/* convert open to appropriate event */ + return (e); +} + +/* ARGSUSED */ static au_event_t aui_open(au_event_t e) { + t_audit_data_t *tad = T2A(curthread); klwp_t *clwp = ttolwp(curthread); uint_t fm; @@ -917,22 +1007,13 @@ aui_open(au_event_t e) fm = (uint_t)uap->fmode; - if (fm & O_WRONLY) - e = AUE_OPEN_W; - else if (fm & O_RDWR) - e = AUE_OPEN_RW; - else - e = AUE_OPEN_R; - - if (fm & O_CREAT) - e += 1; - if (fm & O_TRUNC) - e += 2; + /* convert to appropriate au_ctrl */ + if (fm & (FXATTR | FXATTRDIROPEN)) + tad->tad_ctrl |= PAD_ATTPATH; - return (e); + return (open_event(fm)); } -/*ARGSUSED*/ static void aus_open(struct t_audit_data *tad) { @@ -948,130 +1029,93 @@ aus_open(struct t_audit_data *tad) fm = (uint_t)uap->fmode; /* If no write, create, or trunc modes, mark as a public op */ - if (!(fm & (O_WRONLY|O_RDWR|O_CREAT|O_TRUNC))) + if ((fm & (O_RDONLY|O_WRONLY|O_RDWR|O_CREAT|O_TRUNC)) == O_RDONLY) tad->tad_ctrl |= PAD_PUBLIC_EV; } -/* convert openat(2) to appropriate event */ +/* ARGSUSED */ static au_event_t -aui_fsat(au_event_t e) +aui_openat(au_event_t e) { - t_audit_data_t *tad = U2A(u); + t_audit_data_t *tad = T2A(curthread); klwp_t *clwp = ttolwp(curthread); - uint_t fmcode, fm; + uint_t fm; + struct a { - long id; - long arg1; - long arg2; - long arg3; - long arg4; - long arg5; + long filedes; + long fnamep; /* char * */ + long fmode; + long cmode; } *uap = (struct a *)clwp->lwp_ap; - fmcode = (uint_t)uap->id; - - switch (fmcode) { + fm = (uint_t)uap->fmode; - case 0: /* openat */ - case 1: /* openat64 */ - fm = (uint_t)uap->arg3; - if (fm & O_WRONLY) - e = AUE_OPENAT_W; - else if (fm & O_RDWR) - e = AUE_OPENAT_RW; - else - e = AUE_OPENAT_R; + /* convert to appropriate au_ctrl */ + if (fm & (FXATTR | FXATTRDIROPEN)) + tad->tad_ctrl |= PAD_ATTPATH; - /* - * openat modes are defined in the following order: - * Read only - * Read|Create - * Read|Trunc - * Read|Create|Trunc - * Write Only - * Write|Create - * Write|Trunc - * Write|Create|Trunc * RW Only - * RW|Create - * RW|Trunc - * RW|Create|Trunc - */ - if (fm & O_CREAT) - e += 1; /* increment to include CREAT in mode */ - if (fm & O_TRUNC) - e += 2; /* increment to include TRUNC in mode */ + return (open_event(fm)); +} - /* convert to appropriate au_ctrl */ - tad->tad_ctrl |= PAD_SAVPATH; - if (fm & FXATTR) - tad->tad_ctrl |= PAD_ATPATH; +static void +aus_openat(struct t_audit_data *tad) +{ + klwp_t *clwp = ttolwp(curthread); + uint_t fm; + struct a { + long filedes; + long fnamep; /* char * */ + long fmode; + long cmode; + } *uap = (struct a *)clwp->lwp_ap; - break; - case 2: /* fstatat64 */ - case 3: /* fstatat */ - e = AUE_FSTATAT; - break; - case 4: /* fchownat */ - e = AUE_FCHOWNAT; - break; - case 5: /* unlinkat */ - e = AUE_UNLINKAT; - break; - case 6: /* futimesat */ - e = AUE_FUTIMESAT; - break; - case 7: /* renameat */ - e = AUE_RENAMEAT; - break; - case 8: /* faccessat */ - e = AUE_FACCESSAT; - break; - case 9: /* __openattrdirat */ - tad->tad_ctrl |= PAD_SAVPATH; - /*FALLTHROUGH*/ - default: - e = AUE_NULL; - break; - } + fm = (uint_t)uap->fmode; - return (e); + /* If no write, create, or trunc modes, mark as a public op */ + if ((fm & (O_RDONLY|O_WRONLY|O_RDWR|O_CREAT|O_TRUNC)) == O_RDONLY) + tad->tad_ctrl |= PAD_PUBLIC_EV; } -/*ARGSUSED*/ -static void -aus_fsat(struct t_audit_data *tad) +static au_event_t +aui_unlinkat(au_event_t e) { klwp_t *clwp = ttolwp(curthread); - uint_t fmcode, fm; + struct a { - long id; - long arg1; - long arg2; - long arg3; - long arg4; - long arg5; + long filedes; + long fnamep; /* char * */ + long flags; } *uap = (struct a *)clwp->lwp_ap; - fmcode = (uint_t)uap->id; + if (uap->flags & AT_REMOVEDIR) + e = AUE_RMDIR; + else + e = AUE_UNLINK; - switch (fmcode) { + return (e); +} - case 0: /* openat */ - case 1: /* openat64 */ - fm = (uint_t)uap->arg3; - /* If no write, create, or trunc modes, mark as a public op */ - if (!(fm & (O_WRONLY|O_RDWR|O_CREAT|O_TRUNC))) - tad->tad_ctrl |= PAD_PUBLIC_EV; +static au_event_t +aui_fstatat(au_event_t e) +{ + klwp_t *clwp = ttolwp(curthread); - break; - case 2: /* fstatat64 */ - case 3: /* fstatat */ - tad->tad_ctrl |= PAD_PUBLIC_EV; - break; - default: - break; - } + struct a { + long filedes; + long fnamep; /* char * */ + long statb; + long flags; + } *uap = (struct a *)clwp->lwp_ap; + + if (uap->fnamep == NULL) + e = AUE_FSTAT; + else if (uap->flags & AT_SYMLINK_NOFOLLOW) + e = AUE_LSTAT; + else + e = AUE_STAT; + + return (e); } /* msgsys */ @@ -1314,13 +1358,6 @@ aui_fcntl(au_event_t e) /* null function for now */ static au_event_t -aui_execv(au_event_t e) -{ - return (e); -} - -/* null function for now */ -static au_event_t aui_execve(au_event_t e) { return (e); @@ -1474,32 +1511,6 @@ aus_mknod(struct t_audit_data *tad) /*ARGSUSED*/ static void -aus_xmknod(struct t_audit_data *tad) -{ - klwp_t *clwp = ttolwp(curthread); - uint32_t fmode; - dev_t dev; - - struct a { - long version; /* version */ - long pnamep; /* char * */ - long fmode; - long dev; - } *uap = (struct a *)clwp->lwp_ap; - - fmode = (uint32_t)uap->fmode; - dev = (dev_t)uap->dev; - - au_uwrite(au_to_arg32(2, "mode", fmode)); -#ifdef _LP64 - au_uwrite(au_to_arg64(3, "dev", dev)); -#else - au_uwrite(au_to_arg32(3, "dev", dev)); -#endif -} - -/*ARGSUSED*/ -static void auf_mknod(struct t_audit_data *tad, int error, rval_t *rval) { klwp_t *clwp = ttolwp(curthread); @@ -1530,38 +1541,6 @@ auf_mknod(struct t_audit_data *tad, int error, rval_t *rval) /*ARGSUSED*/ static void -auf_xmknod(struct t_audit_data *tad, int error, rval_t *rval) -{ - klwp_t *clwp = ttolwp(curthread); - vnode_t *dvp; - caddr_t pnamep; - - struct a { - long version; /* version */ - long pnamep; /* char * */ - long fmode; - long dev; - } *uap = (struct a *)clwp->lwp_arg; - - - /* no error, then already path token in audit record */ - if (error != EPERM) - return; - - /* not auditing this event, nothing then to do */ - if (tad->tad_flag == 0) - return; - - /* do the lookup to force generation of path token */ - pnamep = (caddr_t)uap->pnamep; - tad->tad_ctrl |= PAD_NOATTRB; - error = lookupname(pnamep, UIO_USERSPACE, NO_FOLLOW, &dvp, NULLVPP); - if (error == 0) - VN_RELE(dvp); -} - -/*ARGSUSED*/ -static void aus_mount(struct t_audit_data *tad) { /* AUS_START */ klwp_t *clwp = ttolwp(curthread); @@ -1654,23 +1633,6 @@ umount2_free_dir: kmem_free(path, path_len); } -/* - * the umount syscall is implemented as a call to umount2, but the args - * are different... - */ - -/*ARGSUSED*/ -static void -aus_umount(struct t_audit_data *tad) -{ - klwp_t *clwp = ttolwp(curthread); - struct a { - long dir; /* char * */ - } *uap = (struct a *)clwp->lwp_ap; - - aus_umount_path((caddr_t)uap->dir); -} - /*ARGSUSED*/ static void aus_umount2(struct t_audit_data *tad) diff --git a/usr/src/uts/common/c2/audit_kernel.h b/usr/src/uts/common/c2/audit_kernel.h index 9e145fffd0..df6c2910eb 100644 --- a/usr/src/uts/common/c2/audit_kernel.h +++ b/usr/src/uts/common/c2/audit_kernel.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -84,6 +84,7 @@ extern "C" { #define S2E_MLD PAD_MLD /* only one lookup per system call */ #define S2E_NPT PAD_NOPATH /* force no path in audit record */ #define S2E_PUB PAD_PUBLIC_EV /* syscall is defined as a public op */ +#define S2E_ATC PAD_ATCALL /* syscall is one of the *at() family */ /* * At present, we are using the audit classes imbedded with in the kernel. Each @@ -169,14 +170,15 @@ typedef struct p_audit_data p_audit_data_t; extern kmem_cache_t *au_pad_cache; /* - * Defines for pad_ctrl + * Defines for tad_ctrl */ #define PAD_SAVPATH 0x00000001 /* save path for further processing */ #define PAD_MLD 0x00000002 /* system call involves MLD */ #define PAD_NOPATH 0x00000004 /* force no paths in audit record */ #define PAD_ABSPATH 0x00000008 /* path from lookup is absolute */ #define PAD_NOATTRB 0x00000010 /* do not automatically add attribute */ - /* 0x20, 0x40 unused */ + /* 0x20 unused */ +#define PAD_ATCALL 0x00000040 /* *at() syscall, like openat() */ #define PAD_LFLOAT 0x00000080 /* Label float */ #define PAD_NOAUDIT 0x00000100 /* discard audit record */ #define PAD_PATHFND 0x00000200 /* found path, don't retry lookup */ @@ -185,7 +187,7 @@ extern kmem_cache_t *au_pad_cache; #define PAD_SMAC 0x00001000 /* succ mac use. extra audit_finish */ #define PAD_FMAC 0x00002000 /* fail mac use. extra audit_finish */ #define PAD_AUDITME 0x00004000 /* audit me because of NFS operation */ -#define PAD_ATPATH 0x00008000 /* attribute file lookup */ +#define PAD_ATTPATH 0x00008000 /* attribute file lookup */ #define PAD_TRUE_CREATE 0x00010000 /* true create, file not found */ #define PAD_CORE 0x00020000 /* save attribute during core dump */ #define PAD_ERRJMP 0x00040000 /* abort record generation on error */ diff --git a/usr/src/uts/common/c2/audit_kevents.h b/usr/src/uts/common/c2/audit_kevents.h index 7c85544506..fdc3c4dc37 100644 --- a/usr/src/uts/common/c2/audit_kevents.h +++ b/usr/src/uts/common/c2/audit_kevents.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -47,10 +47,10 @@ extern "C" { #define AUE_EXIT 1 /* =ps exit(2) */ #define AUE_FORKALL 2 /* =ps forkall(2) */ #define AUE_OPEN 3 /* =no open(2): place holder */ -#define AUE_CREAT 4 /* =fc create(2) */ +#define AUE_CREAT 4 /* =no obsolete */ #define AUE_LINK 5 /* =fc link(2) */ #define AUE_UNLINK 6 /* =fd unlink(2) */ -#define AUE_EXEC 7 /* =ps,ex exec(2) */ +#define AUE_EXEC 7 /* =no obsolete */ #define AUE_CHDIR 8 /* =pm chdir(2) */ #define AUE_MKNOD 9 /* =fc mknod(2) */ #define AUE_CHMOD 10 /* =fm chmod(2) */ @@ -92,7 +92,7 @@ extern "C" { #define AUE_SHUTDOWN 46 /* =nt shutdown(2) */ #define AUE_MKDIR 47 /* =fc mkdir(2) */ #define AUE_RMDIR 48 /* =fd rmdir(2) */ -#define AUE_UTIMES 49 /* =fm utimes(2) */ +#define AUE_UTIMES 49 /* =fm futimens(2), utimensat(2) */ #define AUE_ADJTIME 50 /* =as adjtime(2) */ #define AUE_SETRLIMIT 51 /* =ua setrlimit(2) */ #define AUE_KILLPG 52 /* =no killpg(2) */ @@ -113,7 +113,7 @@ extern "C" { #define AUE_RFSSYS 67 /* =no rfssys(2): place holder */ #define AUE_FCHDIR 68 /* =pm fchdir(2) */ #define AUE_FCHROOT 69 /* =pm fchroot(2) */ -#define AUE_VPIXSYS 70 /* =no vpixsys(2): obsolete */ +#define AUE_VPIXSYS 70 /* =no obsolete */ #define AUE_PATHCONF 71 /* =fa pathconf(2) */ #define AUE_OPEN_R 72 /* =fr open(2): read */ #define AUE_OPEN_RC 73 /* =fc,fr open(2): read,creat */ @@ -169,7 +169,7 @@ extern "C" { #define AUE_SETAUDIT 133 /* =aa setaudit(2) */ /* 134 OBSOLETE */ /* 135 OBSOLETE */ -#define AUE_AUDITSVC 136 /* =no auditsvc(2): obsolete */ +#define AUE_AUDITSVC 136 /* =no obsolete */ /* 137 OBSOLETE */ #define AUE_AUDITON 138 /* =no auditon(2) */ #define AUE_AUDITON_GTERMID 139 /* =no auditctl(2): GETTERMID */ @@ -232,17 +232,17 @@ extern "C" { #define AUE_WRITEV 196 /* =no writev(2) */ #define AUE_NFS 197 /* =no NFS server */ #define AUE_READV 198 /* =no readv(2) */ -#define AUE_OSTAT 199 /* =no old stat(2) */ +#define AUE_OSTAT 199 /* =no obsolete */ #define AUE_SETUID 200 /* =pm old setuid(2) */ #define AUE_STIME 201 /* =as old stime(2) */ -#define AUE_UTIME 202 /* =fm old utime(2) */ +#define AUE_UTIME 202 /* =no obsolete */ #define AUE_NICE 203 /* =pm old nice(2) */ #define AUE_OSETPGRP 204 /* =no old setpgrp(2) */ #define AUE_SETGID 205 /* =pm old setgid(2) */ #define AUE_READL 206 /* =no readl(2) */ #define AUE_READVL 207 /* =no readvl(2) */ #define AUE_FSTAT 208 /* =no fstat(2) */ -#define AUE_DUP2 209 /* =no dup2(2) u-o-p */ +#define AUE_DUP2 209 /* =no obsolete */ #define AUE_MMAP 210 /* =no mmap(2) u-o-p */ #define AUE_AUDIT 211 /* =no audit(2) u-o-p */ #define AUE_PRIOCNTLSYS 212 /* =pm priocntlsys */ @@ -268,12 +268,12 @@ extern "C" { #define AUE_AUDITON_SETCLASS 232 /* =as */ #define AUE_FUSERS 233 /* =fa */ #define AUE_STATVFS 234 /* =fa */ -#define AUE_XSTAT 235 /* =no */ -#define AUE_LXSTAT 236 /* =no */ +#define AUE_XSTAT 235 /* =no obsolete */ +#define AUE_LXSTAT 236 /* =no obsolete */ #define AUE_LCHOWN 237 /* =fm */ #define AUE_MEMCNTL 238 /* =ot */ #define AUE_SYSINFO 239 /* =as */ -#define AUE_XMKNOD 240 /* =no */ +#define AUE_XMKNOD 240 /* =no obsolete */ #define AUE_FORK1 241 /* =ps */ #define AUE_MODCTL 242 /* =no */ #define AUE_MODLOAD 243 /* =as */ @@ -301,25 +301,25 @@ extern "C" { #define AUE_SOCKCONFIG 265 /* =nt */ #define AUE_SETAUDIT_ADDR 266 /* =aa setaudit_addr(2) */ #define AUE_GETAUDIT_ADDR 267 /* =aa getaudit_addr(2) */ -#define AUE_UMOUNT2 268 /* =as umount(2) */ -#define AUE_FSAT 269 /* =no openat(2): place holder */ -#define AUE_OPENAT_R 270 /* =fr openat(2): read */ -#define AUE_OPENAT_RC 271 /* =fc,fr openat(2): read,creat */ -#define AUE_OPENAT_RT 272 /* =fd,fr openat(2): read,trunc */ -#define AUE_OPENAT_RTC 273 /* =fc,fd,fr openat(2): rd,cr,tr */ -#define AUE_OPENAT_W 274 /* =fw openat(2): write */ -#define AUE_OPENAT_WC 275 /* =fc,fw openat(2): write,creat */ -#define AUE_OPENAT_WT 276 /* =fd,fw openat(2): write,trunc */ -#define AUE_OPENAT_WTC 277 /* =fc,fd,fw openat(2): wr,cr,tr */ -#define AUE_OPENAT_RW 278 /* =fr,fw openat(2): read,write */ -#define AUE_OPENAT_RWC 279 /* =fc,fw,fr openat(2): rd,wr,cr */ -#define AUE_OPENAT_RWT 280 /* =fd,fr,fw openat(2): rd,wr,tr */ -#define AUE_OPENAT_RWTC 281 /* =fc,fd,fw,fr openat(2): rd,wr,cr,tr */ -#define AUE_RENAMEAT 282 /* =fc,fd renameat(2) */ -#define AUE_FSTATAT 283 /* =no fstatat(2) */ -#define AUE_FCHOWNAT 284 /* =fm fchownat(2) */ -#define AUE_FUTIMESAT 285 /* =fm futimesat(2) */ -#define AUE_UNLINKAT 286 /* =fd unlinkat(2) */ +#define AUE_UMOUNT2 268 /* =as umount2(2) */ +#define AUE_FSAT 269 /* =no obsolete */ +#define AUE_OPENAT_R 270 /* =no obsolete */ +#define AUE_OPENAT_RC 271 /* =no obsolete */ +#define AUE_OPENAT_RT 272 /* =no obsolete */ +#define AUE_OPENAT_RTC 273 /* =no obsolete */ +#define AUE_OPENAT_W 274 /* =no obsolete */ +#define AUE_OPENAT_WC 275 /* =no obsolete */ +#define AUE_OPENAT_WT 276 /* =no obsolete */ +#define AUE_OPENAT_WTC 277 /* =no obsolete */ +#define AUE_OPENAT_RW 278 /* =no obsolete */ +#define AUE_OPENAT_RWC 279 /* =no obsolete */ +#define AUE_OPENAT_RWT 280 /* =no obsolete */ +#define AUE_OPENAT_RWTC 281 /* =no obsolete */ +#define AUE_RENAMEAT 282 /* =no obsolete */ +#define AUE_FSTATAT 283 /* =no obsolete */ +#define AUE_FCHOWNAT 284 /* =no obsolete */ +#define AUE_FUTIMESAT 285 /* =no obsolete */ +#define AUE_UNLINKAT 286 /* =no obsolete */ #define AUE_CLOCK_SETTIME 287 /* =as clock_settime(3RT) */ #define AUE_NTP_ADJTIME 288 /* =as ntp_adjtime(2) */ #define AUE_SETPPRIV 289 /* =pm setppriv(2) */ @@ -342,7 +342,7 @@ extern "C" { #define AUE_PORTFS_DISSOCIATE 306 /* =fa portfs(2) - port disassociate */ #define AUE_SETSID 307 /* =pm setsid(2) */ #define AUE_SETPGID 308 /* =pm setpgid(2) */ -#define AUE_FACCESSAT 309 /* =fa faccessat(2) */ +#define AUE_FACCESSAT 309 /* =no obsolete */ diff --git a/usr/src/uts/common/fs/proc/prioctl.c b/usr/src/uts/common/fs/proc/prioctl.c index 721e8e20a6..e49da69bed 100644 --- a/usr/src/uts/common/fs/proc/prioctl.c +++ b/usr/src/uts/common/fs/proc/prioctl.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1466,8 +1466,7 @@ oprgetstatus32(kthread_t *t, prstatus32_t *sp, zone_t *zp) sp->pr_syscall = get_syscall32_args(lwp, (int *)sp->pr_sysarg, &i); sp->pr_nsysarg = (short)i; - if (t->t_whystop == PR_SYSEXIT && - (t->t_sysnum == SYS_exec || t->t_sysnum == SYS_execve)) { + if (t->t_whystop == PR_SYSEXIT && t->t_sysnum == SYS_execve) { sp->pr_sysarg[0] = 0; sp->pr_sysarg[1] = (caddr32_t)up->u_argv; sp->pr_sysarg[2] = (caddr32_t)up->u_envp; @@ -3303,8 +3302,7 @@ oprgetstatus(kthread_t *t, prstatus_t *sp, zone_t *zp) sp->pr_syscall = get_syscall_args(lwp, (long *)sp->pr_sysarg, &i); sp->pr_nsysarg = (short)i; - if (t->t_whystop == PR_SYSEXIT && - (t->t_sysnum == SYS_exec || t->t_sysnum == SYS_execve)) { + if (t->t_whystop == PR_SYSEXIT && t->t_sysnum == SYS_execve) { sp->pr_sysarg[0] = 0; sp->pr_sysarg[1] = (uintptr_t)up->u_argv; sp->pr_sysarg[2] = (uintptr_t)up->u_envp; diff --git a/usr/src/uts/common/fs/proc/prsubr.c b/usr/src/uts/common/fs/proc/prsubr.c index d84cb0a137..5f1b2d6942 100644 --- a/usr/src/uts/common/fs/proc/prsubr.c +++ b/usr/src/uts/common/fs/proc/prsubr.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1056,7 +1056,7 @@ prgetlwpstatus32(kthread_t *t, lwpstatus32_t *sp, zone_t *zp) } else sp->pr_errpriv = lwp->lwp_badpriv; - if (t->t_sysnum == SYS_exec || t->t_sysnum == SYS_execve) { + if (t->t_sysnum == SYS_execve) { up = PTOU(p); sp->pr_sysarg[0] = 0; sp->pr_sysarg[1] = (caddr32_t)up->u_argv; @@ -1281,7 +1281,7 @@ prgetlwpstatus(kthread_t *t, lwpstatus_t *sp, zone_t *zp) else sp->pr_errpriv = lwp->lwp_badpriv; - if (t->t_sysnum == SYS_exec || t->t_sysnum == SYS_execve) { + if (t->t_sysnum == SYS_execve) { up = PTOU(p); sp->pr_sysarg[0] = 0; sp->pr_sysarg[1] = (uintptr_t)up->u_argv; diff --git a/usr/src/uts/common/os/exec.c b/usr/src/uts/common/os/exec.c index 2f03e83563..fc299421fa 100644 --- a/usr/src/uts/common/os/exec.c +++ b/usr/src/uts/common/os/exec.c @@ -92,15 +92,6 @@ uint_t auxv_hwcap32 = 0; /* 32-bit version of auxv_hwcap */ #define PSUIDFLAGS (SNOCD|SUGID) /* - * exec() - wrapper around exece providing NULL environment pointer - */ -int -exec(const char *fname, const char **argp) -{ - return (exece(fname, argp, NULL)); -} - -/* * exece() - system call wrapper around exec_common() */ int diff --git a/usr/src/uts/common/os/exit.c b/usr/src/uts/common/os/exit.c index cf2e3de913..d2f5fd5767 100644 --- a/usr/src/uts/common/os/exit.c +++ b/usr/src/uts/common/os/exit.c @@ -1133,25 +1133,6 @@ waitid(idtype_t idtype, id_t id, k_siginfo_t *ip, int options) return (ECHILD); } -/* - * The wait() system call trap is no longer invoked by libc. - * It is retained only for the benefit of statically linked applications. - * Delete this when we no longer care about these old and broken applications. - */ -int64_t -wait(void) -{ - int error; - k_siginfo_t info; - rval_t r; - - if (error = waitid(P_ALL, (id_t)0, &info, WEXITED|WTRAPPED)) - return (set_errno(error)); - r.r_val1 = info.si_pid; - r.r_val2 = wstat(info.si_code, info.si_status); - return (r.r_vals); -} - int waitsys(idtype_t idtype, id_t id, siginfo_t *infop, int options) { diff --git a/usr/src/uts/common/os/fork.c b/usr/src/uts/common/os/fork.c index f75ef84034..b9f9dba96d 100644 --- a/usr/src/uts/common/os/fork.c +++ b/usr/src/uts/common/os/fork.c @@ -93,16 +93,10 @@ int fork_fail_pending; extern struct kmem_cache *process_cache; /* - * forkall system call. - */ -int64_t -forkall(void) -{ - return (cfork(0, 0, 0)); -} - -/* - * The parent is stopped until the child invokes relvm(). + * The vfork() system call trap is no longer invoked by libc. + * It is retained only for the benefit of applications running + * within a solaris10 branded zone. It should be eliminated + * when we no longer support solaris10 branded zones. */ int64_t vfork(void) @@ -112,24 +106,8 @@ vfork(void) } /* - * fork system call, aka fork1. - */ -int64_t -fork1(void) -{ - return (cfork(0, 1, 0)); -} - -/* - * The forkall(), vfork(), and fork1() system calls are no longer - * invoked by libc. They are retained only for the benefit of - * old statically-linked applications. They should be eliminated - * when we no longer care about such old and broken applications. - */ - -/* - * forksys system call - forkx, forkallx, vforkx. - * This is the interface now invoked by libc. + * forksys system call - forkx, forkallx, vforkx. This is the + * interface invoked by libc for fork1(), forkall(), and vfork() */ int64_t forksys(int subcode, int flags) diff --git a/usr/src/uts/common/os/sysent.c b/usr/src/uts/common/os/sysent.c index c80048ade0..07c8fe03f6 100644 --- a/usr/src/uts/common/os/sysent.c +++ b/usr/src/uts/common/os/sysent.c @@ -21,7 +21,7 @@ /* ONC_PLUS EXTRACT START */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -57,17 +57,13 @@ int chown(); int chroot(); int cladm(); int close(); -int creat(); -int dup(); -int exec(); int exece(); +int faccessat(); +int fchownat(); int fcntl(); -int64_t forkall(); int64_t vfork(); int64_t forksys(); -int64_t fork1(); int fstat(); -int fsat32(); int fdsync(); int64_t getgid(); int ucredsys(); @@ -94,6 +90,7 @@ int mount(); int nice(); int nullsys(); int open(); +int openat(); int pause(); long pcsample(); int privsys(); @@ -102,6 +99,7 @@ ssize_t pread(); ssize_t pwrite(); ssize_t read(); int rename(); +int renameat(); void rexit(); int semsys(); int setgid(); @@ -118,6 +116,7 @@ int sigresend(); int sigtimedwait(); int getsetcontext(); int stat(); +int fstatat(); int stime(); int stty(); int syssync(); @@ -127,16 +126,14 @@ long ulimit(); int getrlimit32(); int setrlimit32(); int umask(); -int umount(); int umount2(); int unlink(); -int utime(); +int unlinkat(); int utimesys(); int64_t utssys32(); int64_t utssys64(); int uucopy(); ssize_t uucopystr(); -int64_t wait(); ssize_t write(); ssize_t readv(); ssize_t writev(); @@ -148,7 +145,6 @@ int statfs32(); int fstatfs32(); int sysfs(); int getmsg(); -int poll(); int pollsys(); int putmsg(); int uadmin(); @@ -181,12 +177,6 @@ caddr_t smmap32(); int smmaplf32(); int mprotect(); int munmap(); -#if (defined(__i386) && !defined(__amd64)) || defined(__i386_COMPAT) -int xstat(); -int lxstat(); -int fxstat(); -int xmknod(); -#endif int uname(); int lchown(); int getpmsg(); @@ -217,7 +207,6 @@ int lwp_self(); int64_t lwp_sigmask(); int yield(); int lwp_wait(); -int lwp_mutex_lock(); int lwp_mutex_timedlock(); int lwp_mutex_wakeup(); int lwp_mutex_unlock(); @@ -225,7 +214,6 @@ int lwp_mutex_trylock(); int lwp_mutex_register(); int lwp_rwlock_sys(); int lwp_sema_post(); -int lwp_sema_wait(); int lwp_sema_timedwait(); int lwp_sema_trywait(); int lwp_cond_wait(); @@ -256,7 +244,6 @@ int signotify(); int getdents64(); int stat64(); -int fsat64(); int lstat64(); int fstatat64(); int fstat64(); @@ -266,8 +253,8 @@ int setrlimit64(); int getrlimit64(); int pread64(); int pwrite64(); -int creat64(); int open64(); +int openat64(); /* * NTP syscalls @@ -281,11 +268,10 @@ int ntp_adjtime(); * ++ SunOS4.1 Buyback ++ * ++++++++++++++++++++++++ * - * fchroot, utimes, vhangup, gettimeofday + * fchroot, vhangup, gettimeofday */ int fchroot(); -int utimes(); int vhangup(); int gettimeofday(); int getitimer(); @@ -433,16 +419,16 @@ struct sysent sysent[NSYSCALL] = SYSENT_NOSYS(), SYSENT_C("indir", indir, 1)), /* 1 */ SYSENT_CI("exit", rexit, 1), - /* 2 */ SYSENT_2CI("forkall", forkall, 0), + /* 2 */ SYSENT_LOADABLE(), /* (was forkall) */ /* 3 */ SYSENT_CL("read", read, 3), /* 4 */ SYSENT_CL("write", write, 3), /* 5 */ SYSENT_CI("open", open, 3), /* 6 */ SYSENT_CI("close", close, 1), - /* 7 */ SYSENT_2CI("wait", wait, 0), - /* 8 */ SYSENT_CI("creat", creat, 2), + /* 7 */ SYSENT_LOADABLE(), /* (was wait) */ + /* 8 */ SYSENT_LOADABLE(), /* (was creat) */ /* 9 */ SYSENT_CI("link", link, 2), /* 10 */ SYSENT_CI("unlink", unlink, 1), - /* 11 */ SYSENT_CI("exec", exec, 2), + /* 11 */ SYSENT_LOADABLE(), /* (was exec) */ /* 12 */ SYSENT_CI("chdir", chdir, 1), /* 13 */ SYSENT_CL("time", gtime, 0), /* 14 */ SYSENT_CI("mknod", mknod, 3), @@ -455,7 +441,7 @@ struct sysent sysent[NSYSCALL] = SYSENT_CL("lseek", lseek32, 3)), /* 20 */ SYSENT_2CI("getpid", getpid, 0), /* 21 */ SYSENT_AP("mount", mount, 8), - /* 22 */ SYSENT_CI("umount", umount, 1), + /* 22 */ SYSENT_LOADABLE(), /* (was umount) */ /* 23 */ SYSENT_CI("setuid", setuid, 1), /* 24 */ SYSENT_2CI("getuid", getuid, 0), /* 25 */ SYSENT_CI("stime", stime, 1), @@ -463,7 +449,7 @@ struct sysent sysent[NSYSCALL] = /* 27 */ SYSENT_CI("alarm", alarm, 1), /* 28 */ SYSENT_CI("fstat", fstat, 2), /* 29 */ SYSENT_CI("pause", pause, 0), - /* 30 */ SYSENT_CI("utime", utime, 2), + /* 30 */ SYSENT_LOADABLE(), /* (was utime) */ /* 31 */ SYSENT_CI("stty", stty, 2), /* 32 */ SYSENT_CI("gtty", gtty, 2), /* 33 */ SYSENT_CI("access", access, 2), @@ -478,11 +464,11 @@ struct sysent sysent[NSYSCALL] = SYSENT_CI("fstatfs", fstatfs32, 4)), /* 39 */ SYSENT_CI("setpgrp", setpgrp, 3), /* 40 */ SYSENT_CI("uucopystr", uucopystr, 3), - /* 41 */ SYSENT_CI("dup", dup, 1), + /* 41 */ SYSENT_LOADABLE(), /* (was dup) */ /* 42 */ SYSENT_LOADABLE(), /* pipe */ /* 43 */ SYSENT_CL("times", times, 1), /* 44 */ SYSENT_CI("prof", profil, 4), - /* 45 */ SYSENT_LOADABLE(), /* (was proc lock) */ + /* 45 */ SYSENT_CI("faccessat", faccessat, 4), /* 46 */ SYSENT_CI("setgid", setgid, 1), /* 47 */ SYSENT_2CI("getgid", getgid, 0), /* 48 */ SYSENT_LOADABLE(), /* (was ssig) */ @@ -495,7 +481,7 @@ struct sysent sysent[NSYSCALL] = /* 53 */ SYSENT_LOADABLE(), /* semsys */ /* 54 */ SYSENT_CI("ioctl", ioctl, 3), /* 55 */ SYSENT_CI("uadmin", uadmin, 3), - /* 56 */ SYSENT_LOADABLE(), + /* 56 */ SYSENT_CI("fchownat", fchownat, 5), /* 57 */ IF_LP64( SYSENT_2CI("utssys", utssys64, 4), SYSENT_2CI("utssys", utssys32, 4)), @@ -505,26 +491,23 @@ struct sysent sysent[NSYSCALL] = /* 61 */ SYSENT_CI("chroot", chroot, 1), /* 62 */ SYSENT_CI("fcntl", fcntl, 3), /* 63 */ SYSENT_CI("ulimit", ulimit, 2), - - /* - * The following 6 entries were reserved for the UNIX PC. - */ - /* 64 */ SYSENT_LOADABLE(), - /* 65 */ SYSENT_LOADABLE(), - /* 66 */ SYSENT_LOADABLE(), - /* 67 */ SYSENT_LOADABLE(), /* file locking call */ - /* 68 */ SYSENT_LOADABLE(), /* local system calls */ - /* 69 */ SYSENT_LOADABLE(), /* inode open */ - + /* 64 */ SYSENT_CI("renameat", renameat, 4), + /* 65 */ SYSENT_CI("unlinkat", unlinkat, 3), + /* 66 */ SYSENT_CI("fstatat", fstatat, 4), + /* 67 */ IF_LP64( + SYSENT_NOSYS(), + SYSENT_CI("fstatat64", fstatat64, 4)), + /* 68 */ SYSENT_CI("openat", openat, 4), + /* 69 */ IF_LP64( + SYSENT_NOSYS(), + SYSENT_CI("openat64", openat64, 4)), /* 70 */ SYSENT_CI("tasksys", tasksys, 5), /* 71 */ SYSENT_LOADABLE(), /* acctctl */ /* 72 */ SYSENT_LOADABLE(), /* exacct */ /* 73 */ SYSENT_CI("getpagesizes", getpagesizes, 3), /* 74 */ SYSENT_CI("rctlsys", rctlsys, 6), /* 75 */ SYSENT_2CI("sidsys", sidsys, 4), - /* 76 */ IF_LP64( - SYSENT_CI("fsat", fsat64, 6), - SYSENT_CI("fsat", fsat32, 6)), + /* 76 */ SYSENT_LOADABLE(), /* (was fsat) */ /* 77 */ SYSENT_CI("lwp_park", syslwp_park, 3), /* 78 */ SYSENT_CL("sendfilev", sendfilev, 5), /* 79 */ SYSENT_CI("rmdir", rmdir, 1), @@ -537,7 +520,7 @@ struct sysent sysent[NSYSCALL] = /* 84 */ SYSENT_CI("sysfs", sysfs, 3), /* 85 */ SYSENT_CI("getmsg", getmsg, 4), /* 86 */ SYSENT_CI("putmsg", putmsg, 4), - /* 87 */ SYSENT_CI("poll", poll, 3), + /* 87 */ SYSENT_LOADABLE(), /* (was poll) */ /* 88 */ SYSENT_CI("lstat", lstat, 2), /* 89 */ SYSENT_CI("symlink", symlink, 2), /* 90 */ SYSENT_CL("readlink", readlink, 3), @@ -550,10 +533,9 @@ struct sysent sysent[NSYSCALL] = /* 97 */ SYSENT_CI("sigaltstack", sigaltstack, 2), /* 98 */ SYSENT_CI("sigaction", sigaction, 3), /* 99 */ SYSENT_CI("sigpending", sigpending, 2), - /* 100 */ SYSENT_CI("getsetcontext", getsetcontext, 2), - /* 101 */ SYSENT_LOADABLE(), /* (was evsys) */ - /* 102 */ SYSENT_LOADABLE(), /* (was evtrapret) */ + /* 101 */ SYSENT_LOADABLE(), + /* 102 */ SYSENT_LOADABLE(), /* 103 */ SYSENT_CI("statvfs", statvfs, 2), /* 104 */ SYSENT_CI("fstatvfs", fstatvfs, 2), /* 105 */ SYSENT_CI("getloadavg", getloadavg, 2), @@ -580,26 +562,10 @@ struct sysent sysent[NSYSCALL] = /* 120 */ SYSENT_CI("fchdir", fchdir, 1), /* 121 */ SYSENT_CL("readv", readv, 3), /* 122 */ SYSENT_CL("writev", writev, 3), - /* 123 */ IF_LP64( - SYSENT_NOSYS(), - IF_i386( - SYSENT_CI("xstat", xstat, 3), - SYSENT_NOSYS())), - /* 124 */ IF_LP64( - SYSENT_NOSYS(), - IF_i386( - SYSENT_CI("lxstat", lxstat, 3), - SYSENT_NOSYS())), - /* 125 */ IF_LP64( - SYSENT_NOSYS(), - IF_i386( - SYSENT_CI("fxstat", fxstat, 3), - SYSENT_NOSYS())), - /* 126 */ IF_LP64( - SYSENT_NOSYS(), - IF_i386( - SYSENT_CI("xmknod", xmknod, 4), - SYSENT_NOSYS())), + /* 123 */ SYSENT_LOADABLE(), /* (was xstat) */ + /* 124 */ SYSENT_LOADABLE(), /* (was lxstat) */ + /* 125 */ SYSENT_LOADABLE(), /* (was fxstat) */ + /* 126 */ SYSENT_LOADABLE(), /* (was xmknod) */ /* 127 */ SYSENT_CI("mmapobj", mmapobjsys, 5), /* 128 */ IF_LP64( SYSENT_CI("setrlimit", setrlimit64, 2), @@ -620,18 +586,18 @@ struct sysent sysent[NSYSCALL] = /* 140 */ SYSENT_LOADABLE(), /* sharefs */ /* 141 */ SYSENT_CI("seteuid", seteuid, 1), /* 142 */ SYSENT_2CI("forksys", forksys, 2), - /* 143 */ SYSENT_2CI("fork1", fork1, 0), + /* 143 */ SYSENT_LOADABLE(), /* (was fork1) */ /* 144 */ SYSENT_CI("sigtimedwait", sigtimedwait, 3), /* 145 */ SYSENT_CI("lwp_info", lwp_info, 1), /* 146 */ SYSENT_CI("yield", yield, 0), - /* 147 */ SYSENT_CI("lwp_sema_wait", lwp_sema_wait, 1), + /* 147 */ SYSENT_LOADABLE(), /* (was lwp_sema_wait) */ /* 148 */ SYSENT_CI("lwp_sema_post", lwp_sema_post, 1), /* 149 */ SYSENT_CI("lwp_sema_trywait", lwp_sema_trywait, 1), /* 150 */ SYSENT_CI("lwp_detach", lwp_detach, 1), /* 151 */ SYSENT_CI("corectl", corectl, 4), /* 152 */ SYSENT_CI("modctl", modctl, 6), /* 153 */ SYSENT_CI("fchroot", fchroot, 1), - /* 154 */ SYSENT_CI("utimes", utimes, 2), + /* 154 */ SYSENT_LOADABLE(), /* (was utimes) */ /* 155 */ SYSENT_CI("vhangup", vhangup, 0), /* 156 */ SYSENT_CI("gettimeofday", gettimeofday, 1), /* 157 */ SYSENT_CI("getitimer", getitimer, 2), @@ -648,7 +614,7 @@ struct sysent sysent[NSYSCALL] = SYSENT_NOSYS()), /* 167 */ SYSENT_CI("lwp_wait", lwp_wait, 2), /* 168 */ SYSENT_CI("lwp_mutex_wakeup", lwp_mutex_wakeup, 2), - /* 169 */ SYSENT_CI("lwp_mutex_lock", lwp_mutex_lock, 1), + /* 169 */ SYSENT_LOADABLE(), /* (was lwp_mutex_lock) */ /* 170 */ SYSENT_CI("lwp_cond_wait", lwp_cond_wait, 4), /* 171 */ SYSENT_CI("lwp_cond_signal", lwp_cond_signal, 1), /* 172 */ SYSENT_CI("lwp_cond_broadcast", lwp_cond_broadcast, 1), @@ -740,9 +706,7 @@ struct sysent sysent[NSYSCALL] = /* 223 */ IF_LP64( SYSENT_NOSYS(), SYSENT_CI("pwrite64", pwrite64, 5)), - /* 224 */ IF_LP64( - SYSENT_NOSYS(), - SYSENT_CI("creat64", creat64, 2)), + /* 224 */ SYSENT_LOADABLE(), /* (was creat64) */ /* 225 */ IF_LP64( SYSENT_NOSYS(), SYSENT_CI("open64", open64, 3)), @@ -792,12 +756,7 @@ extern ssize_t readv32(); extern ssize_t writev32(); extern ssize_t readlink32(); extern int open32(); -extern int creat32(); -#if (defined(__i386) && !defined(__amd64)) || defined(__i386_COMPAT) -extern int xstat32(); -extern int lxstat32(); -extern int fxstat32(); -#endif +extern int openat32(); extern int stat32(); extern int fstatat32(); extern int lstat32(); @@ -842,16 +801,16 @@ struct sysent sysent32[NSYSCALL] = /* ONC_PLUS EXTRACT END */ /* 0 */ SYSENT_C("indir", indir, 1), /* 1 */ SYSENT_CI("exit", (int (*)())rexit, 1), - /* 2 */ SYSENT_2CI("forkall", forkall, 0), + /* 2 */ SYSENT_LOADABLE32(), /* (was forkall) */ /* 3 */ SYSENT_CI("read", read32, 3), /* 4 */ SYSENT_CI("write", write32, 3), /* 5 */ SYSENT_CI("open", open32, 3), /* 6 */ SYSENT_CI("close", close, 1), - /* 7 */ SYSENT_2CI("wait", wait, 0), - /* 8 */ SYSENT_CI("creat", creat32, 2), + /* 7 */ SYSENT_LOADABLE32(), /* (was wait) */ + /* 8 */ SYSENT_LOADABLE32(), /* (was creat32) */ /* 9 */ SYSENT_CI("link", link, 2), /* 10 */ SYSENT_CI("unlink", unlink, 1), - /* 11 */ SYSENT_CI("exec", exec, 2), + /* 11 */ SYSENT_LOADABLE32(), /* (was exec) */ /* 12 */ SYSENT_CI("chdir", chdir, 1), /* 13 */ SYSENT_CI("time", gtime, 0), /* 14 */ SYSENT_CI("mknod", mknod, 3), @@ -862,7 +821,7 @@ struct sysent sysent32[NSYSCALL] = /* 19 */ SYSENT_CI("lseek", lseek32, 3), /* 20 */ SYSENT_2CI("getpid", getpid, 0), /* 21 */ SYSENT_AP("mount", mount, 8), - /* 22 */ SYSENT_CI("umount", umount, 1), + /* 22 */ SYSENT_LOADABLE32(), /* (was umount) */ /* 23 */ SYSENT_CI("setuid", setuid, 1), /* 24 */ SYSENT_2CI("getuid", getuid, 0), /* 25 */ SYSENT_CI("stime", stime32, 1), @@ -870,7 +829,7 @@ struct sysent sysent32[NSYSCALL] = /* 27 */ SYSENT_CI("alarm", alarm, 1), /* 28 */ SYSENT_CI("fstat", fstat32, 2), /* 29 */ SYSENT_CI("pause", pause, 0), - /* 30 */ SYSENT_CI("utime", utime, 2), + /* 30 */ SYSENT_LOADABLE32(), /* (was utime) */ /* 31 */ SYSENT_CI("stty", stty, 2), /* 32 */ SYSENT_CI("gtty", gtty, 2), /* 33 */ SYSENT_CI("access", access, 2), @@ -881,24 +840,24 @@ struct sysent sysent32[NSYSCALL] = /* 38 */ SYSENT_CI("fstatfs", fstatfs32, 4), /* 39 */ SYSENT_CI("setpgrp", setpgrp, 3), /* 40 */ SYSENT_CI("uucopystr", uucopystr, 3), - /* 41 */ SYSENT_CI("dup", dup, 1), + /* 41 */ SYSENT_LOADABLE32(), /* (was dup) */ /* 42 */ SYSENT_LOADABLE32(), /* pipe */ /* 43 */ SYSENT_CI("times", times32, 1), /* 44 */ SYSENT_CI("prof", profil, 4), - /* 45 */ SYSENT_LOADABLE32(), /* (was proc lock) */ + /* 45 */ SYSENT_CI("faccessat", faccessat, 4), /* 46 */ SYSENT_CI("setgid", setgid, 1), /* 47 */ SYSENT_2CI("getgid", getgid, 0), /* 48 */ SYSENT_LOADABLE32(), /* (was ssig) */ /* 49 */ SYSENT_LOADABLE32(), /* msgsys */ /* 50 */ IF_386_ABI( SYSENT_CI("sysi86", sysi86, 4), - SYSENT_LOADABLE()), /* (was sys3b) */ + SYSENT_LOADABLE32()), /* (was sys3b) */ /* 51 */ SYSENT_LOADABLE32(), /* sysacct */ /* 52 */ SYSENT_LOADABLE32(), /* shmsys */ /* 53 */ SYSENT_LOADABLE32(), /* semsys */ /* 54 */ SYSENT_CI("ioctl", ioctl, 3), /* 55 */ SYSENT_CI("uadmin", uadmin, 3), - /* 56 */ SYSENT_LOADABLE32(), + /* 56 */ SYSENT_CI("fchownat", fchownat, 5), /* 57 */ SYSENT_2CI("utssys", utssys32, 4), /* 58 */ SYSENT_CI("fdsync", fdsync, 2), /* 59 */ SYSENT_CI("exece", exece, 3), @@ -906,24 +865,19 @@ struct sysent sysent32[NSYSCALL] = /* 61 */ SYSENT_CI("chroot", chroot, 1), /* 62 */ SYSENT_CI("fcntl", fcntl, 3), /* 63 */ SYSENT_CI("ulimit", ulimit32, 2), - - /* - * The following 6 entries were reserved for the UNIX PC. - */ - /* 64 */ SYSENT_LOADABLE32(), - /* 65 */ SYSENT_LOADABLE32(), - /* 66 */ SYSENT_LOADABLE32(), - /* 67 */ SYSENT_LOADABLE32(), /* file locking call */ - /* 68 */ SYSENT_LOADABLE32(), /* local system calls */ - /* 69 */ SYSENT_LOADABLE32(), /* inode open */ - + /* 64 */ SYSENT_CI("renameat", renameat, 4), + /* 65 */ SYSENT_CI("unlinkat", unlinkat, 3), + /* 66 */ SYSENT_CI("fstatat", fstatat32, 4), + /* 67 */ SYSENT_CI("fstatat64", fstatat64_32, 4), + /* 68 */ SYSENT_CI("openat", openat32, 4), + /* 69 */ SYSENT_CI("openat64", openat64, 4), /* 70 */ SYSENT_CI("tasksys", tasksys, 5), /* 71 */ SYSENT_LOADABLE32(), /* acctctl */ /* 72 */ SYSENT_LOADABLE32(), /* exacct */ /* 73 */ SYSENT_CI("getpagesizes", getpagesizes32, 3), /* 74 */ SYSENT_CI("rctlsys", rctlsys, 6), /* 75 */ SYSENT_2CI("sidsys", sidsys, 4), - /* 76 */ SYSENT_CI("fsat", fsat32, 6), + /* 76 */ SYSENT_LOADABLE32(), /* (was fsat) */ /* 77 */ SYSENT_CI("lwp_park", syslwp_park, 3), /* 78 */ SYSENT_CI("sendfilev", sendfilev, 5), /* 79 */ SYSENT_CI("rmdir", rmdir, 1), @@ -934,7 +888,7 @@ struct sysent sysent32[NSYSCALL] = /* 84 */ SYSENT_CI("sysfs", sysfs, 3), /* 85 */ SYSENT_CI("getmsg", getmsg32, 4), /* 86 */ SYSENT_CI("putmsg", putmsg32, 4), - /* 87 */ SYSENT_CI("poll", poll, 3), + /* 87 */ SYSENT_LOADABLE32(), /* (was poll) */ /* 88 */ SYSENT_CI("lstat", lstat32, 2), /* 89 */ SYSENT_CI("symlink", symlink, 2), /* 90 */ SYSENT_CI("readlink", readlink32, 3), @@ -947,10 +901,9 @@ struct sysent sysent32[NSYSCALL] = /* 97 */ SYSENT_CI("sigaltstack", sigaltstack32, 2), /* 98 */ SYSENT_CI("sigaction", sigaction32, 3), /* 99 */ SYSENT_CI("sigpending", sigpending, 2), - /* 100 */ SYSENT_CI("getsetcontext", getsetcontext32, 2), - /* 101 */ SYSENT_LOADABLE32(), /* (was evsys) */ - /* 102 */ SYSENT_LOADABLE32(), /* (was evtrapret) */ + /* 101 */ SYSENT_LOADABLE32(), + /* 102 */ SYSENT_LOADABLE32(), /* 103 */ SYSENT_CI("statvfs", statvfs32, 2), /* 104 */ SYSENT_CI("fstatvfs", fstatvfs32, 2), /* 105 */ SYSENT_CI("getloadavg", getloadavg, 2), @@ -975,18 +928,10 @@ struct sysent sysent32[NSYSCALL] = /* 120 */ SYSENT_CI("fchdir", fchdir, 1), /* 121 */ SYSENT_CI("readv", readv32, 3), /* 122 */ SYSENT_CI("writev", writev32, 3), - /* 123 */ IF_386_ABI( - SYSENT_CI("xstat", xstat32, 3), - SYSENT_NOSYS()), - /* 124 */ IF_386_ABI( - SYSENT_CI("lxstat", lxstat32, 3), - SYSENT_NOSYS()), - /* 125 */ IF_386_ABI( - SYSENT_CI("fxstat", fxstat32, 3), - SYSENT_NOSYS()), - /* 126 */ IF_386_ABI( - SYSENT_CI("xmknod", xmknod, 4), - SYSENT_NOSYS()), + /* 123 */ SYSENT_LOADABLE32(), /* was xstat32 */ + /* 124 */ SYSENT_LOADABLE32(), /* was lxstat32 */ + /* 125 */ SYSENT_LOADABLE32(), /* was fxstat32 */ + /* 126 */ SYSENT_LOADABLE32(), /* was xmknod */ /* 127 */ SYSENT_CI("mmapobj", mmapobjsys, 5), /* 128 */ SYSENT_CI("setrlimit", setrlimit32, 2), /* 129 */ SYSENT_CI("getrlimit", getrlimit32, 2), @@ -995,7 +940,6 @@ struct sysent sysent32[NSYSCALL] = /* 132 */ SYSENT_CI("getpmsg", getpmsg32, 5), /* 133 */ SYSENT_CI("putpmsg", putpmsg32, 5), /* 134 */ SYSENT_CI("rename", rename, 2), - /* 135 */ SYSENT_CI("uname", uname, 1), /* 136 */ SYSENT_CI("setegid", setegid, 1), /* 137 */ SYSENT_CI("sysconfig", sysconfig, 1), @@ -1004,18 +948,18 @@ struct sysent sysent32[NSYSCALL] = /* 140 */ SYSENT_LOADABLE32(), /* sharefs */ /* 141 */ SYSENT_CI("seteuid", seteuid, 1), /* 142 */ SYSENT_2CI("forksys", forksys, 2), - /* 143 */ SYSENT_2CI("fork1", fork1, 0), + /* 143 */ SYSENT_LOADABLE32(), /* (was fork1) */ /* 144 */ SYSENT_CI("sigtimedwait", sigtimedwait, 3), /* 145 */ SYSENT_CI("lwp_info", lwp_info, 1), /* 146 */ SYSENT_CI("yield", yield, 0), - /* 147 */ SYSENT_CI("lwp_sema_wait", lwp_sema_wait, 1), + /* 147 */ SYSENT_LOADABLE32(), /* (was lwp_sema_wait) */ /* 148 */ SYSENT_CI("lwp_sema_post", lwp_sema_post, 1), /* 149 */ SYSENT_CI("lwp_sema_trywait", lwp_sema_trywait, 1), /* 150 */ SYSENT_CI("lwp_detach", lwp_detach, 1), /* 151 */ SYSENT_CI("corectl", corectl, 4), /* 152 */ SYSENT_CI("modctl", modctl, 6), /* 153 */ SYSENT_CI("fchroot", fchroot, 1), - /* 154 */ SYSENT_CI("utimes", utimes, 2), + /* 154 */ SYSENT_LOADABLE32(), /* (was utimes) */ /* 155 */ SYSENT_CI("vhangup", vhangup, 0), /* 156 */ SYSENT_CI("gettimeofday", gettimeofday, 1), /* 157 */ SYSENT_CI("getitimer", getitimer, 2), @@ -1032,7 +976,7 @@ struct sysent sysent32[NSYSCALL] = SYSENT_NOSYS()), /* 167 */ SYSENT_CI("lwp_wait", lwp_wait, 2), /* 168 */ SYSENT_CI("lwp_mutex_wakeup", lwp_mutex_wakeup, 2), - /* 169 */ SYSENT_CI("lwp_mutex_lock", lwp_mutex_lock, 1), + /* 169 */ SYSENT_LOADABLE32(), /* (was lwp_mutex_lock) */ /* 170 */ SYSENT_CI("lwp_cond_wait", lwp_cond_wait, 4), /* 171 */ SYSENT_CI("lwp_cond_signal", lwp_cond_signal, 1), /* 172 */ SYSENT_CI("lwp_cond_broadcast", lwp_cond_broadcast, 1), @@ -1090,7 +1034,7 @@ struct sysent sysent32[NSYSCALL] = /* 221 */ SYSENT_CI("getrlimit64", getrlimit64, 2), /* 222 */ SYSENT_CI("pread64", pread64, 5), /* 223 */ SYSENT_CI("pwrite64", pwrite64, 5), - /* 224 */ SYSENT_CI("creat64", creat64, 2), + /* 224 */ SYSENT_LOADABLE32(), /* (was creat64) */ /* 225 */ SYSENT_CI("open64", open64, 3), /* 226 */ SYSENT_LOADABLE32(), /* rpcsys */ /* 227 */ SYSENT_CI("zone", zone, 6), diff --git a/usr/src/uts/common/sys/exec.h b/usr/src/uts/common/sys/exec.h index d9bcf11e55..d246d5e885 100644 --- a/usr/src/uts/common/sys/exec.h +++ b/usr/src/uts/common/sys/exec.h @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -206,7 +206,6 @@ extern char aout_omagicstr[]; extern char nomagicstr[]; extern int exec_args(execa_t *, uarg_t *, intpdata_t *, void **); -extern int exec(const char *fname, const char **argp); extern int exece(const char *fname, const char **argp, const char **envp); extern int exec_common(const char *fname, const char **argp, const char **envp, int brand_action); diff --git a/usr/src/uts/common/sys/syscall.h b/usr/src/uts/common/sys/syscall.h index 41a95c33d2..170483de8d 100644 --- a/usr/src/uts/common/sys/syscall.h +++ b/usr/src/uts/common/sys/syscall.h @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -49,16 +49,12 @@ extern "C" { #define SYS_syscall 0 #define SYS_exit 1 -#define SYS_forkall 2 #define SYS_read 3 #define SYS_write 4 #define SYS_open 5 #define SYS_close 6 -#define SYS_wait 7 -#define SYS_creat 8 #define SYS_link 9 #define SYS_unlink 10 -#define SYS_exec 11 #define SYS_chdir 12 #define SYS_time 13 #define SYS_mknod 14 @@ -69,7 +65,6 @@ extern "C" { #define SYS_lseek 19 #define SYS_getpid 20 #define SYS_mount 21 -#define SYS_umount 22 #define SYS_setuid 23 #define SYS_getuid 24 #define SYS_stime 25 @@ -77,7 +72,6 @@ extern "C" { #define SYS_alarm 27 #define SYS_fstat 28 #define SYS_pause 29 -#define SYS_utime 30 #define SYS_stty 31 #define SYS_gtty 32 #define SYS_access 33 @@ -97,11 +91,10 @@ extern "C" { * setpgid(pid,pgid) :: syscall(39,5,pid,pgid) */ #define SYS_uucopystr 40 -#define SYS_dup 41 #define SYS_pipe 42 #define SYS_times 43 #define SYS_profil 44 -#define SYS_plock 45 +#define SYS_faccessat 45 #define SYS_setgid 46 #define SYS_getgid 47 #define SYS_msgsys 49 @@ -143,6 +136,7 @@ extern "C" { */ #define SYS_ioctl 54 #define SYS_uadmin 55 +#define SYS_fchownat 56 #define SYS_utssys 57 /* * subcodes (third argument): @@ -158,12 +152,12 @@ extern "C" { #define SYS_chroot 61 #define SYS_fcntl 62 #define SYS_ulimit 63 -#define SYS_reserved_64 64 /* 64 reserved */ -#define SYS_reserved_65 65 /* 65 reserved */ -#define SYS_reserved_66 66 /* 66 reserved */ -#define SYS_reserved_67 67 /* 67 reserved */ -#define SYS_reserved_68 68 /* 68 reserved */ -#define SYS_reserved_69 69 /* 69 reserved */ +#define SYS_renameat 64 +#define SYS_unlinkat 65 +#define SYS_fstatat 66 +#define SYS_fstatat64 67 +#define SYS_openat 68 +#define SYS_openat64 69 #define SYS_tasksys 70 /* * subcodes: @@ -200,20 +194,6 @@ extern "C" { * idmap_reg(...) :: sidsys(1, ...) * idmap_unreg(...) :: sidsys(2, ...) */ -#define SYS_fsat 76 - /* - * subcodes: - * openat(...) :: fsat(0, ...) - * openat64(...) :: fsat(1, ...) - * fstatat64(...) :: fsat(2, ...) - * fstatat(...) :: fsat(3, ...) - * fchownat(...) :: fsat(4, ...) - * unlinkat(...) :: fsat(5, ...) - * futimesat(...) :: fsat(6, ...) - * renameat(...) :: fsat(7, ...) - * faccessat(...) :: fsat(8, ...) - * openattrdirat(...) :: fsat(9, ...) - */ #define SYS_lwp_park 77 /* * subcodes: @@ -256,8 +236,6 @@ extern "C" { */ #define SYS_getmsg 85 #define SYS_putmsg 86 -#define SYS_poll 87 - #define SYS_lstat 88 #define SYS_symlink 89 #define SYS_readlink 90 @@ -282,8 +260,6 @@ extern "C" { * getcontext(...) :: syscall(100, 0, ...) * setcontext(...) :: syscall(100, 1, ...) */ -#define SYS_evsys 101 -#define SYS_evtrapret 102 #define SYS_statvfs 103 #define SYS_fstatvfs 104 #define SYS_getloadavg 105 @@ -310,10 +286,6 @@ extern "C" { #define SYS_fchdir 120 #define SYS_readv 121 #define SYS_writev 122 -#define SYS_xstat 123 -#define SYS_lxstat 124 -#define SYS_fxstat 125 -#define SYS_xmknod 126 #define SYS_mmapobj 127 #define SYS_setrlimit 128 #define SYS_getrlimit 129 @@ -336,18 +308,15 @@ extern "C" { * forkallx(flags) :: forksys(1, flags) * vforkx(flags) :: forksys(2, flags) */ -#define SYS_fork1 143 #define SYS_sigtimedwait 144 #define SYS_lwp_info 145 #define SYS_yield 146 -#define SYS_lwp_sema_wait 147 #define SYS_lwp_sema_post 148 #define SYS_lwp_sema_trywait 149 #define SYS_lwp_detach 150 #define SYS_corectl 151 #define SYS_modctl 152 #define SYS_fchroot 153 -#define SYS_utimes 154 #define SYS_vhangup 155 #define SYS_gettimeofday 156 #define SYS_getitimer 157 @@ -362,7 +331,6 @@ extern "C" { #define SYS_lwp_private 166 #define SYS_lwp_wait 167 #define SYS_lwp_mutex_wakeup 168 -#define SYS_lwp_mutex_lock 169 #define SYS_lwp_cond_wait 170 #define SYS_lwp_cond_signal 171 #define SYS_lwp_cond_broadcast 172 @@ -467,7 +435,6 @@ extern "C" { #define SYS_getrlimit64 221 #define SYS_pread64 222 #define SYS_pwrite64 223 -#define SYS_creat64 224 #define SYS_open64 225 #define SYS_rpcsys 226 #define SYS_zone 227 @@ -520,7 +487,6 @@ extern "C" { #define SYS_uucopy 254 #define SYS_umount2 255 - #ifndef _ASM typedef struct { /* syscall set type */ diff --git a/usr/src/uts/common/syscall/access.c b/usr/src/uts/common/syscall/access.c index 2fcdb870e5..bf71b77b8c 100644 --- a/usr/src/uts/common/syscall/access.c +++ b/usr/src/uts/common/syscall/access.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -118,12 +118,6 @@ lookup: } int -access(char *fname, int fmode) -{ - return (caccess(fname, fmode, NULL)); -} - -int faccessat(int fd, char *fname, int fmode, int flag) { file_t *dirfp; @@ -172,3 +166,9 @@ faccessat(int fd, char *fname, int fmode, int flag) return (error); } + +int +access(char *fname, int fmode) +{ + return (faccessat(AT_FDCWD, fname, fmode, 0)); +} diff --git a/usr/src/uts/common/syscall/chown.c b/usr/src/uts/common/syscall/chown.c index 706b3b4f71..04250e1e35 100644 --- a/usr/src/uts/common/syscall/chown.c +++ b/usr/src/uts/common/syscall/chown.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -54,15 +53,10 @@ #include <c2/audit.h> /* - * nmflag has the following values - * - * 1 - Always do lookup. i.e. chown, lchown. - * 2 - Name is optional i.e. fchownat - * 0 - Don't lookup name, vp is in file_p. i.e. fchown - * + * Change ownership of file. */ int -cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) +fchownat(int fd, char *name, uid_t uid, gid_t gid, int flags) { vnode_t *startvp, *vp; file_t *filefp; @@ -87,11 +81,12 @@ cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) if (fd == AT_FDCWD && name == NULL) return (set_errno(EFAULT)); - if (nmflag == 1 || (nmflag == 2 && name != NULL)) { + if (name != NULL) { if (copyin(name, &startchar, sizeof (char))) return (set_errno(EFAULT)); - } else + } else { startchar = '\0'; + } if (fd == AT_FDCWD) @@ -100,10 +95,9 @@ cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) /* * only get fd if not doing absolute lookup */ - if (startchar != '/' || nmflag == 0) { - if ((filefp = getf(fd)) == NULL) { + if (startchar != '/') { + if ((filefp = getf(fd)) == NULL) return (set_errno(EBADF)); - } startvp = filefp->f_vnode; VN_HOLD(startvp); releasef(fd); @@ -112,13 +106,13 @@ cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) } } - if ((nmflag == 2) && audit_active) + if (audit_active) audit_setfsat_path(1); /* - * Do lookups for chown, lchown and fchownat when name not NULL + * Do lookup for fchownat when name not NULL */ - if ((nmflag == 2 && name != NULL) || nmflag == 1) { + if (name != NULL) { if (error = lookupnameat(name, UIO_USERSPACE, (flags == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW, @@ -149,33 +143,21 @@ cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) else return (error); } -/* - * Change ownership of file given file name. - */ + int chown(char *fname, uid_t uid, gid_t gid) { - return (cfchownat(AT_FDCWD, fname, 1, uid, gid, 0)); + return (fchownat(AT_FDCWD, fname, uid, gid, 0)); } int lchown(char *fname, uid_t uid, gid_t gid) { - return (cfchownat(AT_FDCWD, fname, 1, uid, gid, AT_SYMLINK_NOFOLLOW)); + return (fchownat(AT_FDCWD, fname, uid, gid, AT_SYMLINK_NOFOLLOW)); } -/* - * Change ownership of file given file descriptor. - */ int fchown(int fd, uid_t uid, uid_t gid) { - return (cfchownat(fd, NULL, 0, uid, gid, 0)); -} - -int -fchownat(int fd, char *name, uid_t uid, gid_t gid, int flags) -{ - return (cfchownat(fd, name, 2, uid, gid, flags)); - + return (fchownat(fd, NULL, uid, gid, 0)); } diff --git a/usr/src/uts/common/syscall/fcntl.c b/usr/src/uts/common/syscall/fcntl.c index 021064d1cd..5ad1497d3b 100644 --- a/usr/src/uts/common/syscall/fcntl.c +++ b/usr/src/uts/common/syscall/fcntl.c @@ -21,7 +21,7 @@ /* ONC_PLUS EXTRACT START */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -33,7 +33,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* ONC_PLUS EXTRACT END */ #include <sys/param.h> @@ -687,12 +686,6 @@ out: return (retval); } -int -dup(int fd) -{ - return (fcntl(fd, F_DUPFD, 0)); -} - /* ONC_PLUS EXTRACT START */ int flock_check(vnode_t *vp, flock64_t *flp, offset_t offset, offset_t max) diff --git a/usr/src/uts/common/syscall/fsat.c b/usr/src/uts/common/syscall/fsat.c deleted file mode 100644 index d9b7f4e288..0000000000 --- a/usr/src/uts/common/syscall/fsat.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/types.h> -#include <sys/errno.h> -#include <sys/fcntl.h> -#include <sys/stat.h> -#include <sys/vnode.h> -#include <sys/vfs.h> -#include <sys/time.h> -#include <sys/systm.h> -#include <sys/debug.h> - -extern int openat(int, char *, int, int); -extern int renameat(int, char *, int, char *); -extern int unlinkat(int, char *, int); -extern int fchownat(int, char *, uid_t, gid_t, int); -extern int fstatat(int, char *, struct stat *, int); -extern int futimesat(int, char *, struct timeval *); -extern int faccessat(int, char *, int, int); -extern int openattrdirat(int, char *); -#if defined(_SYSCALL32_IMPL) || defined(_ILP32) -extern int fstatat64_32(int, char *, struct stat64_32 *, int); -extern int fstatat32(int, char *, struct stat32 *, int); -extern int openat32(int, char *, int, int); -extern int fstatat64(int, char *, struct stat64 *, int); -extern int openat64(int, char *, int, int); -extern int fstatat64_32(int, char *, struct stat64_32 *, int); -#endif - - -/* - * Handle all of the *at system calls - * - * subcodes: - * 0 - openat - * 1 - openat64 - * 2 - fstatat64 - * 3 - fstatat - * 4 - fchownat - * 5 - unlinkat - * 6 - futimesat - * 7 - renameat - * 8 - faccessat - * 9 - openattrdirat - * - * The code for handling the at functionality exists in the file where the - * base syscall is defined. For example openat is in open.c - */ - -#if defined(_SYSCALL32_IMPL) || defined(_ILP32) - -int -fsat32(int code, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, - uintptr_t arg4, uintptr_t arg5) -{ - switch (code) { - - case 0: /* openat */ -#if defined(_LP64) - return (openat32((int)arg1, (char *)arg2, - (int)arg3, (int)arg4)); -#else - return (openat((int)arg1, (char *)arg2, - (int)arg3, (int)arg4)); -#endif - case 1: /* openat64 */ - return (openat64((int)arg1, (char *)arg2, - (int)arg3, (int)arg4)); - case 2: /* fstatat64 */ -#if defined(_LP64) - return (fstatat64_32((int)arg1, (char *)arg2, - (struct stat64_32 *)arg3, (int)arg4)); -#else - return (fstatat64((int)arg1, (char *)arg2, - (struct stat64 *)arg3, (int)arg4)); -#endif - case 3: /* fstatat */ -#if defined(_LP64) - return (fstatat32((int)arg1, (char *)arg2, - (struct stat32 *)arg3, (int)arg4)); -#else - return (fstatat((int)arg1, (char *)arg2, - (struct stat *)arg3, (int)arg4)); -#endif - case 4: /* fchownat */ - return (fchownat((int)arg1, (char *)arg2, - (uid_t)arg3, (gid_t)arg4, (int)arg5)); - case 5: /* unlinkat */ - return (unlinkat((int)arg1, (char *)arg2, (int)arg3)); - case 6: /* futimesat */ - return (futimesat((int)arg1, - (char *)arg2, (struct timeval *)arg3)); - case 7: /* renameat */ - return (renameat((int)arg1, (char *)arg2, (int)arg3, - (char *)arg4)); - case 8: /* faccessat */ - return (faccessat((int)arg1, (char *)arg2, (int)arg3, - (int)arg4)); - case 9: /* openattrdirat */ - return (openattrdirat((int)arg1, (char *)arg2)); - default: - return (set_errno(EINVAL)); - } -} - -#endif - -/* - * For 64 kernels, use fsat64 - */ - -#if defined(_LP64) - -int -fsat64(int code, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, - uintptr_t arg4, uintptr_t arg5) -{ - switch (code) { - - case 0: /* openat */ - return (openat((int)arg1, (char *)arg2, - (int)arg3, (int)arg4)); - case 1: /* openat64 */ - return (set_errno(ENOSYS)); - case 2: /* fstatat64 */ - return (set_errno(ENOSYS)); - case 3: /* fstatat */ - return (fstatat((int)arg1, (char *)arg2, - (struct stat *)arg3, (int)arg4)); - case 4: /* fchownat */ - return (fchownat((int)arg1, (char *)arg2, - (uid_t)arg3, (gid_t)arg4, (int)arg5)); - case 5: /* unlinkat */ - return (unlinkat((int)arg1, (char *)arg2, (int)arg3)); - case 6: /* futimesat */ - return (futimesat((int)arg1, - (char *)arg2, (struct timeval *)arg3)); - case 7: /* renameat */ - return (renameat((int)arg1, (char *)arg2, (int)arg3, - (char *)arg4)); - case 8: /* faccessat */ - return (faccessat((int)arg1, (char *)arg2, (int)arg3, - (int)arg4)); - case 9: /* openattrdirat */ - return (openattrdirat((int)arg1, (char *)arg2)); - default: - return (set_errno(EINVAL)); - } -} -#endif diff --git a/usr/src/uts/common/syscall/lwp_sobj.c b/usr/src/uts/common/syscall/lwp_sobj.c index 3a7e5997c5..94492d64f0 100644 --- a/usr/src/uts/common/syscall/lwp_sobj.c +++ b/usr/src/uts/common/syscall/lwp_sobj.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1358,20 +1358,6 @@ out: return (0); } -/* - * Obsolete lwp_mutex_lock() interface, no longer called from libc. - * libc now calls lwp_mutex_timedlock(lp, NULL, NULL). - * This system call trap continues to exist solely for the benefit - * of old statically-linked binaries from Solaris 9 and before. - * It should be removed from the system when we no longer care - * about such applications. - */ -int -lwp_mutex_lock(lwp_mutex_t *lp) -{ - return (lwp_mutex_timedlock(lp, NULL, NULL)); -} - static int iswanted(kthread_t *t, lwpchan_t *lwpchan) { @@ -2165,19 +2151,6 @@ out: return (0); } -/* - * Obsolete lwp_sema_wait() interface, no longer called from libc. - * libc now calls lwp_sema_timedwait(). - * This system call trap exists solely for the benefit of old - * statically linked applications from Solaris 9 and before. - * It should be removed when we no longer care about such applications. - */ -int -lwp_sema_wait(lwp_sema_t *sp) -{ - return (lwp_sema_timedwait(sp, NULL, 0)); -} - int lwp_sema_post(lwp_sema_t *sp) { diff --git a/usr/src/uts/common/syscall/mknod.c b/usr/src/uts/common/syscall/mknod.c index 2b61dac506..73258f9c2f 100644 --- a/usr/src/uts/common/syscall/mknod.c +++ b/usr/src/uts/common/syscall/mknod.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -94,14 +93,3 @@ mknod(char *fname, mode_t fmode, dev_t dev) VN_RELE(vp); return (0); } - -#if defined(__i386) || defined(__i386_COMPAT) - -/*ARGSUSED*/ -int -xmknod(int version, char *fname, mode_t fmode, dev_t dev) -{ - return (mknod(fname, fmode, dev)); -} - -#endif diff --git a/usr/src/uts/common/syscall/open.c b/usr/src/uts/common/syscall/open.c index a2504bc1c4..e4fc89f3ec 100644 --- a/usr/src/uts/common/syscall/open.c +++ b/usr/src/uts/common/syscall/open.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -50,8 +51,8 @@ #include <sys/cmn_err.h> /* - * Common code for open()/openat() and creat(). Check permissions, allocate - * an open file structure, and call the device open routine (if any). + * Common code for openat(). Check permissions, allocate an open + * file structure, and call the device open routine (if any). */ static int @@ -100,8 +101,8 @@ copen(int startfd, char *fname, int filemode, int createmode) * Handle openattrdirat request */ if (filemode & FXATTRDIROPEN) { - if (audit_active) - audit_setfsat_path(1); + if (audit_active) + audit_setfsat_path(1); if (error = lookupnameat(fname, seg, FOLLOW, NULLVPP, &vp, startvp)) @@ -254,95 +255,61 @@ out: } #define OPENMODE32(fmode) ((int)((fmode)-FOPEN)) -#define CREATMODE32 (FWRITE|FCREAT|FTRUNC) #define OPENMODE64(fmode) (OPENMODE32(fmode) | FOFFMAX) #define OPENMODEATTRDIR FXATTRDIROPEN -#define CREATMODE64 (CREATMODE32 | FOFFMAX) #ifdef _LP64 #define OPENMODE(fmode) OPENMODE64(fmode) -#define CREATMODE CREATMODE64 #else #define OPENMODE OPENMODE32 -#define CREATMODE CREATMODE32 #endif /* * Open a file. */ int -open(char *fname, int fmode, int cmode) -{ - return (copen(AT_FDCWD, fname, OPENMODE(fmode), cmode)); -} - -/* - * Create a file. - */ -int -creat(char *fname, int cmode) +openat(int fd, char *path, int fmode, int cmode) { - return (copen(AT_FDCWD, fname, CREATMODE, cmode)); + return (copen(fd, path, OPENMODE(fmode), cmode)); } int -openat(int fd, char *path, int fmode, int cmode) +open(char *path, int fmode, int cmode) { - return (copen(fd, path, OPENMODE(fmode), cmode)); + return (openat(AT_FDCWD, path, fmode, cmode)); } #if defined(_ILP32) || defined(_SYSCALL32_IMPL) /* - * Open and Creat for large files in 32-bit environment. Sets the FOFFMAX flag. + * Open for large files in 32-bit environment. Sets the FOFFMAX flag. */ int -open64(char *fname, int fmode, int cmode) -{ - return (copen(AT_FDCWD, fname, OPENMODE64(fmode), cmode)); -} - -int -creat64(char *fname, int cmode) +openat64(int fd, char *path, int fmode, int cmode) { - return (copen(AT_FDCWD, fname, CREATMODE64, cmode)); + return (copen(fd, path, OPENMODE64(fmode), cmode)); } int -openat64(int fd, char *path, int fmode, int cmode) +open64(char *path, int fmode, int cmode) { - return (copen(fd, path, OPENMODE64(fmode), cmode)); + return (openat64(AT_FDCWD, path, fmode, cmode)); } #endif /* _ILP32 || _SYSCALL32_IMPL */ #ifdef _SYSCALL32_IMPL /* - * Open and Creat for 32-bit compatibility on 64-bit kernel + * Open for 32-bit compatibility on 64-bit kernel */ int -open32(char *fname, int fmode, int cmode) -{ - return (copen(AT_FDCWD, fname, OPENMODE32(fmode), cmode)); -} - -int -creat32(char *fname, int cmode) -{ - return (copen(AT_FDCWD, fname, CREATMODE32, cmode)); -} - -int openat32(int fd, char *path, int fmode, int cmode) { return (copen(fd, path, OPENMODE32(fmode), cmode)); } -#endif /* _SYSCALL32_IMPL */ - -/* - * Special interface to open hidden attribute directory. - */ int -openattrdirat(int fd, char *fname) +open32(char *path, int fmode, int cmode) { - return (copen(fd, fname, OPENMODEATTRDIR, 0)); + return (openat32(AT_FDCWD, path, fmode, cmode)); } + +#endif /* _SYSCALL32_IMPL */ diff --git a/usr/src/uts/common/syscall/poll.c b/usr/src/uts/common/syscall/poll.c index bed14f800a..dfcbb6dc9f 100644 --- a/usr/src/uts/common/syscall/poll.c +++ b/usr/src/uts/common/syscall/poll.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -618,28 +618,6 @@ pollout: } /* - * This system call trap exists solely for binary compatibility with - * old statically-linked applications. It is not called from libc. - * It should be removed in the next release. - */ -int -poll(pollfd_t *fds, nfds_t nfds, int time_out) -{ - timespec_t ts; - timespec_t *tsp; - - if (time_out < 0) - tsp = NULL; - else { - ts.tv_sec = time_out / MILLISEC; - ts.tv_nsec = (time_out % MILLISEC) * MICROSEC; - tsp = &ts; - } - - return (poll_common(fds, nfds, tsp, NULL)); -} - -/* * This is the system call trap that poll(), * select() and pselect() are built upon. * It is a private interface between libc and the kernel. diff --git a/usr/src/uts/common/syscall/rename.c b/usr/src/uts/common/syscall/rename.c index 4d8d5270ed..4228ea688a 100644 --- a/usr/src/uts/common/syscall/rename.c +++ b/usr/src/uts/common/syscall/rename.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2001 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -32,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -47,19 +45,6 @@ #include <sys/fcntl.h> /* - * Rename or move an existing file. - */ -int -rename(char *from, char *to) -{ - int error; - - if (error = vn_rename(from, to, UIO_USERSPACE)) - return (set_errno(error)); - return (0); -} - -/* * Rename a file relative to a given directory */ int @@ -137,3 +122,9 @@ renameat(int fromfd, char *old, int tofd, char *new) return (set_errno(error)); return (error); } + +int +rename(char *old, char *new) +{ + return (renameat(AT_FDCWD, old, AT_FDCWD, new)); +} diff --git a/usr/src/uts/common/syscall/rmdir.c b/usr/src/uts/common/syscall/rmdir.c deleted file mode 100644 index 0a0ad7e2cd..0000000000 --- a/usr/src/uts/common/syscall/rmdir.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* - * Portions of this source code were derived from Berkeley 4.3 BSD - * under license from the Regents of the University of California. - */ - -#ident "%Z%%M% %I% %E% SMI" - -#include <sys/param.h> -#include <sys/isa_defs.h> -#include <sys/types.h> -#include <sys/sysmacros.h> -#include <sys/systm.h> -#include <sys/errno.h> -#include <sys/vnode.h> -#include <sys/uio.h> -#include <sys/filio.h> - -#include <sys/debug.h> - -/* - * Remove a directory. - */ -int -rmdir(char *dname) -{ - int error; - - if (error = vn_remove(dname, UIO_USERSPACE, RMDIRECTORY)) - return (set_errno(error)); - return (0); -} diff --git a/usr/src/uts/common/syscall/stat.c b/usr/src/uts/common/syscall/stat.c index 8bd03c2454..87ede7fe62 100644 --- a/usr/src/uts/common/syscall/stat.c +++ b/usr/src/uts/common/syscall/stat.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Get file attribute information through a file name or a file descriptor. */ @@ -63,17 +62,8 @@ * to VOP_GETATTR */ -/* - * nmflag has the following values - * - * 1 - Always do lookup. i.e. stat, lstat. - * 2 - Name is optional i.e. fstatat - * 0 - Don't lookup name, vp is in file_p. i.e. fstat - * - */ static int -cstatat_getvp(int fd, char *name, int nmflag, - int follow, vnode_t **vp, cred_t **cred) +cstatat_getvp(int fd, char *name, int follow, vnode_t **vp, cred_t **cred) { vnode_t *startvp; file_t *fp; @@ -88,22 +78,15 @@ cstatat_getvp(int fd, char *name, int nmflag, */ if (fd == AT_FDCWD) { - if (name != NULL || nmflag != 2) { - startvp = NULL; - cr = CRED(); - crhold(cr); - } else - return (EFAULT); + startvp = NULL; + cr = CRED(); + crhold(cr); } else { char startchar; - if (nmflag == 1 || (nmflag == 2 && name != NULL)) { - if (copyin(name, &startchar, sizeof (char))) - return (EFAULT); - } else { - startchar = '\0'; - } - if (startchar != '/' || nmflag == 0) { + if (copyin(name, &startchar, sizeof (char))) + return (EFAULT); + if (startchar != '/') { if ((fp = getf(fd)) == NULL) { return (EBADF); } @@ -123,24 +106,19 @@ cstatat_getvp(int fd, char *name, int nmflag, if (audit_active) audit_setfsat_path(1); - - if (nmflag == 1 || (nmflag == 2 && name != NULL)) { lookup: - if (error = lookupnameat(name, UIO_USERSPACE, follow, NULLVPP, - vp, startvp)) { - if ((error == ESTALE) && - fs_need_estale_retry(estale_retry++)) - goto lookup; - if (startvp != NULL) - VN_RELE(startvp); - crfree(cr); - return (error); - } + if (error = lookupnameat(name, UIO_USERSPACE, follow, NULLVPP, + vp, startvp)) { + if ((error == ESTALE) && + fs_need_estale_retry(estale_retry++)) + goto lookup; if (startvp != NULL) VN_RELE(startvp); - } else { - *vp = startvp; + crfree(cr); + return (error); } + if (startvp != NULL) + VN_RELE(startvp); return (0); } @@ -151,21 +129,9 @@ lookup: * N-bit kernel, N-bit applications, N-bit file offsets */ -static int cstatat(int, char *, int, struct stat *, int, int); +static int cstatat(int, char *, struct stat *, int, int); static int cstat(vnode_t *vp, struct stat *, int, cred_t *); -int -stat(char *fname, struct stat *sb) -{ - return (cstatat(AT_FDCWD, fname, 1, sb, 0, ATTR_REAL)); -} - -int -lstat(char *fname, struct stat *sb) -{ - return (cstatat(AT_FDCWD, fname, 1, sb, AT_SYMLINK_NOFOLLOW, 0)); -} - /* * fstat can and should be fast, do an inline implementation here. */ @@ -174,6 +140,8 @@ lstat(char *fname, struct stat *sb) file_t *fp; \ int error; \ \ + if (fd == AT_FDCWD) \ + return (set_errno(EFAULT)); \ if ((fp = getf(fd)) == NULL) \ return (set_errno(EBADF)); \ if (audit_active) \ @@ -194,48 +162,32 @@ fstat(int fd, struct stat *sb) int fstatat(int fd, char *name, struct stat *sb, int flags) { - return (cstatat(fd, name, 2, sb, - flags & AT_SYMLINK_NOFOLLOW ? AT_SYMLINK_NOFOLLOW : 0, - flags & _AT_TRIGGER ? ATTR_TRIGGER : 0)); -} + int followflag; + int csflags; -#if defined(__i386) || defined(__i386_COMPAT) + if (name == NULL) + return (fstat(fd, sb)); -/* - * Handle all the "extended" stat operations in the same way; - * validate the version, then call the real handler. - */ - -#define XSTAT_BODY(ver, f, s, fn) \ - return (ver != _STAT_VER ? set_errno(EINVAL) : fn(f, s)); - -#endif /* __i386 || __i386_COMPAT */ + followflag = (flags & AT_SYMLINK_NOFOLLOW); + csflags = (flags & _AT_TRIGGER ? ATTR_TRIGGER : 0); + if (followflag == 0) + csflags |= ATTR_REAL; /* flag for procfs lookups */ -#if defined(__i386) - -/* - * Syscalls for i386 applications that issue {,l,f}xstat() directly - */ -int -xstat(int version, char *fname, struct stat *sb) -{ - XSTAT_BODY(version, fname, sb, stat) + return (cstatat(fd, name, sb, followflag, csflags)); } int -lxstat(int version, char *fname, struct stat *sb) +stat(char *name, struct stat *sb) { - XSTAT_BODY(version, fname, sb, lstat) + return (fstatat(AT_FDCWD, name, sb, 0)); } int -fxstat(int version, int fd, struct stat *sb) +lstat(char *name, struct stat *sb) { - XSTAT_BODY(version, fd, sb, fstat) + return (fstatat(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); } -#endif /* __i386 */ - /* * Common code for stat(), lstat(), and fstat(). * (32-bit kernel, 32-bit applications, 32-bit files) @@ -304,7 +256,7 @@ cstat(vnode_t *vp, struct stat *ubp, int flag, cred_t *cr) } static int -cstatat(int fd, char *name, int nmflag, struct stat *sb, int follow, int flags) +cstatat(int fd, char *name, struct stat *sb, int follow, int flags) { vnode_t *vp; int error; @@ -314,16 +266,14 @@ cstatat(int fd, char *name, int nmflag, struct stat *sb, int follow, int flags) link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW; lookup: - if (error = cstatat_getvp(fd, name, nmflag, link_follow, &vp, &cred)) + if (error = cstatat_getvp(fd, name, link_follow, &vp, &cred)) return (set_errno(error)); error = cstat(vp, sb, flags, cred); crfree(cred); VN_RELE(vp); -out: if (error != 0) { if (error == ESTALE && - fs_need_estale_retry(estale_retry++) && - (nmflag == 1 || (nmflag == 2 && name != NULL))) + fs_need_estale_retry(estale_retry++)) goto lookup; return (set_errno(error)); } @@ -335,19 +285,8 @@ out: /* * 64-bit kernel, 32-bit applications, 32-bit file offsets */ -static int cstatat32(int, char *, int, struct stat32 *, int, int); +static int cstatat32(int, char *, struct stat32 *, int, int); static int cstat32(vnode_t *, struct stat32 *, int, cred_t *); -int -stat32(char *fname, struct stat32 *sb) -{ - return (cstatat32(AT_FDCWD, fname, 1, sb, 0, ATTR_REAL)); -} - -int -lstat32(char *fname, struct stat32 *sb) -{ - return (cstatat32(AT_FDCWD, fname, 1, sb, AT_SYMLINK_NOFOLLOW, 0)); -} int fstat32(int fd, struct stat32 *sb) @@ -358,36 +297,32 @@ fstat32(int fd, struct stat32 *sb) int fstatat32(int fd, char *name, struct stat32 *sb, int flags) { - return (cstatat32(fd, name, 2, sb, - flags & AT_SYMLINK_NOFOLLOW ? AT_SYMLINK_NOFOLLOW : 0, - flags & _AT_TRIGGER ? ATTR_TRIGGER : 0)); -} + int followflag; + int csflags; -#if defined(__i386_COMPAT) + if (name == NULL) + return (fstat32(fd, sb)); -/* - * Syscalls for i386 applications that issue {,l,f}xstat() directly - */ -int -xstat32(int version, char *fname, struct stat32 *sb) -{ - XSTAT_BODY(version, fname, sb, stat32) + followflag = (flags & AT_SYMLINK_NOFOLLOW); + csflags = (flags & _AT_TRIGGER ? ATTR_TRIGGER : 0); + if (followflag == 0) + csflags |= ATTR_REAL; /* flag for procfs lookups */ + + return (cstatat32(fd, name, sb, followflag, csflags)); } int -lxstat32(int version, char *fname, struct stat32 *sb) +stat32(char *name, struct stat32 *sb) { - XSTAT_BODY(version, fname, sb, lstat32) + return (fstatat32(AT_FDCWD, name, sb, 0)); } int -fxstat32(int version, int fd, struct stat32 *sb) +lstat32(char *name, struct stat32 *sb) { - XSTAT_BODY(version, fd, sb, fstat32) + return (fstatat32(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); } -#endif /* __i386_COMPAT */ - static int cstat32(vnode_t *vp, struct stat32 *ubp, int flag, struct cred *cr) { @@ -444,8 +379,7 @@ cstat32(vnode_t *vp, struct stat32 *ubp, int flag, struct cred *cr) } static int -cstatat32(int fd, char *name, int nmflag, struct stat32 *sb, - int follow, int flags) +cstatat32(int fd, char *name, struct stat32 *sb, int follow, int flags) { vnode_t *vp; int error; @@ -455,16 +389,14 @@ cstatat32(int fd, char *name, int nmflag, struct stat32 *sb, link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW; lookup: - if (error = cstatat_getvp(fd, name, nmflag, link_follow, &vp, &cred)) + if (error = cstatat_getvp(fd, name, link_follow, &vp, &cred)) return (set_errno(error)); error = cstat32(vp, sb, flags, cred); crfree(cred); VN_RELE(vp); -out: if (error != 0) { if (error == ESTALE && - fs_need_estale_retry(estale_retry++) && - (nmflag == 1 || (nmflag == 2 && name != NULL))) + fs_need_estale_retry(estale_retry++)) goto lookup; return (set_errno(error)); } @@ -480,33 +412,42 @@ out: * * These routines are implemented differently on 64-bit kernels. */ -static int cstatat64(int, char *, int, struct stat64 *, int, int); +static int cstatat64(int, char *, struct stat64 *, int, int); static int cstat64(vnode_t *, struct stat64 *, int, cred_t *); int -stat64(char *fname, struct stat64 *sb) +fstat64(int fd, struct stat64 *sb) { - return (cstatat64(AT_FDCWD, fname, 1, sb, 0, ATTR_REAL)); + FSTAT_BODY(fd, sb, cstat64) } int -lstat64(char *fname, struct stat64 *sb) +fstatat64(int fd, char *name, struct stat64 *sb, int flags) { - return (cstatat64(AT_FDCWD, fname, 1, sb, AT_SYMLINK_NOFOLLOW, 0)); + int followflag; + int csflags; + + if (name == NULL) + return (fstat64(fd, sb)); + + followflag = (flags & AT_SYMLINK_NOFOLLOW); + csflags = (flags & _AT_TRIGGER ? ATTR_TRIGGER : 0); + if (followflag == 0) + csflags |= ATTR_REAL; /* flag for procfs lookups */ + + return (cstatat64(fd, name, sb, followflag, csflags)); } int -fstat64(int fd, struct stat64 *sb) +stat64(char *name, struct stat64 *sb) { - FSTAT_BODY(fd, sb, cstat64) + return (fstatat64(AT_FDCWD, name, sb, 0)); } int -fstatat64(int fd, char *name, struct stat64 *sb, int flags) +lstat64(char *name, struct stat64 *sb) { - return (cstatat64(fd, name, 2, sb, - flags & AT_SYMLINK_NOFOLLOW ? AT_SYMLINK_NOFOLLOW : 0, - flags & _AT_TRIGGER ? ATTR_TRIGGER : 0)); + return (fstatat64(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); } static int @@ -546,8 +487,7 @@ cstat64(vnode_t *vp, struct stat64 *ubp, int flag, cred_t *cr) } static int -cstatat64(int fd, char *name, int nmflag, struct stat64 *sb, - int follow, int flags) +cstatat64(int fd, char *name, struct stat64 *sb, int follow, int flags) { vnode_t *vp; int error; @@ -557,16 +497,14 @@ cstatat64(int fd, char *name, int nmflag, struct stat64 *sb, link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW; lookup: - if (error = cstatat_getvp(fd, name, nmflag, link_follow, &vp, &cred)) + if (error = cstatat_getvp(fd, name, link_follow, &vp, &cred)) return (set_errno(error)); error = cstat64(vp, sb, flags, cred); crfree(cred); VN_RELE(vp); -out: if (error != 0) { if (error == ESTALE && - fs_need_estale_retry(estale_retry++) && - (nmflag == 1 || (nmflag == 2 && name != NULL))) + fs_need_estale_retry(estale_retry++)) goto lookup; return (set_errno(error)); } @@ -585,33 +523,42 @@ out: * differently from the way the 32-bit ABI defines it. */ -static int cstatat64_32(int, char *, int, struct stat64_32 *, int, int); +static int cstatat64_32(int, char *, struct stat64_32 *, int, int); static int cstat64_32(vnode_t *, struct stat64_32 *, int, cred_t *); int -stat64_32(char *fname, struct stat64_32 *sb) +fstat64_32(int fd, struct stat64_32 *sb) { - return (cstatat64_32(AT_FDCWD, fname, 1, sb, 0, ATTR_REAL)); + FSTAT_BODY(fd, sb, cstat64_32) } int -lstat64_32(char *fname, struct stat64_32 *sb) +fstatat64_32(int fd, char *name, struct stat64_32 *sb, int flags) { - return (cstatat64_32(AT_FDCWD, fname, 1, sb, AT_SYMLINK_NOFOLLOW, 0)); + int followflag; + int csflags; + + if (name == NULL) + return (fstat64_32(fd, sb)); + + followflag = (flags & AT_SYMLINK_NOFOLLOW); + csflags = (flags & _AT_TRIGGER ? ATTR_TRIGGER : 0); + if (followflag == 0) + csflags |= ATTR_REAL; /* flag for procfs lookups */ + + return (cstatat64_32(fd, name, sb, followflag, csflags)); } int -fstat64_32(int fd, struct stat64_32 *sb) +stat64_32(char *name, struct stat64_32 *sb) { - FSTAT_BODY(fd, sb, cstat64_32) + return (fstatat64_32(AT_FDCWD, name, sb, 0)); } int -fstatat64_32(int fd, char *name, struct stat64_32 *sb, int flags) +lstat64_32(char *name, struct stat64_32 *sb) { - return (cstatat64_32(fd, name, 2, sb, - flags & AT_SYMLINK_NOFOLLOW ? AT_SYMLINK_NOFOLLOW : 0, - flags & _AT_TRIGGER ? ATTR_TRIGGER : 0)); + return (fstatat64_32(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); } static int @@ -659,8 +606,7 @@ cstat64_32(vnode_t *vp, struct stat64_32 *ubp, int flag, cred_t *cr) } static int -cstatat64_32(int fd, char *name, int nmflag, struct stat64_32 *sb, - int follow, int flags) +cstatat64_32(int fd, char *name, struct stat64_32 *sb, int follow, int flags) { vnode_t *vp; int error; @@ -670,16 +616,14 @@ cstatat64_32(int fd, char *name, int nmflag, struct stat64_32 *sb, link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW; lookup: - if (error = cstatat_getvp(fd, name, nmflag, link_follow, &vp, &cred)) + if (error = cstatat_getvp(fd, name, link_follow, &vp, &cred)) return (set_errno(error)); error = cstat64_32(vp, sb, flags, cred); crfree(cred); VN_RELE(vp); -out: if (error != 0) { if (error == ESTALE && - fs_need_estale_retry(estale_retry++) && - (nmflag == 1 || (nmflag == 2 && name != NULL))) + fs_need_estale_retry(estale_retry++)) goto lookup; return (set_errno(error)); } diff --git a/usr/src/uts/common/syscall/umount.c b/usr/src/uts/common/syscall/umount.c index 970afd9b2b..a2deedb163 100644 --- a/usr/src/uts/common/syscall/umount.c +++ b/usr/src/uts/common/syscall/umount.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/t_lock.h> #include <sys/param.h> @@ -193,13 +192,3 @@ umount2(char *pathp, int flag) return (umount2_engine(vfsp, flag, CRED(), 1)); } - -/* - * Old umount() system call for compatibility. - * Changes due to support for forced unmount. - */ -int -umount(char *pathp) -{ - return (umount2(pathp, 0)); -} diff --git a/usr/src/uts/common/syscall/unlink.c b/usr/src/uts/common/syscall/unlink.c index cd97f970ca..27546c959a 100644 --- a/usr/src/uts/common/syscall/unlink.c +++ b/usr/src/uts/common/syscall/unlink.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -47,19 +46,6 @@ #include <c2/audit.h> /* - * Unlink (i.e. delete) a file. - */ -int -unlink(char *fname) -{ - int error; - - if (error = vn_remove(fname, UIO_USERSPACE, RMFILE)) - return (set_errno(error)); - return (0); -} - -/* * Unlink a file from a directory */ int @@ -106,3 +92,15 @@ unlinkat(int fd, char *name, int flags) return (set_errno(error)); return (0); } + +int +unlink(char *name) +{ + return (unlinkat(AT_FDCWD, name, 0)); +} + +int +rmdir(char *name) +{ + return (unlinkat(AT_FDCWD, name, AT_REMOVEDIR)); +} diff --git a/usr/src/uts/common/syscall/utime.c b/usr/src/uts/common/syscall/utime.c index 38cf6069f7..43cdf1d62b 100644 --- a/usr/src/uts/common/syscall/utime.c +++ b/usr/src/uts/common/syscall/utime.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -115,48 +115,6 @@ cfutimesat(int fd, char *fname, int nmflag, vattr_t *vap, int flags, int follow) return (0); } -/* - * Expunge this function when futimesat() and utimes() - * are expunged from the kernel. - */ -static int -get_timeval_vattr(struct timeval *tvptr, struct vattr *vattr, int *flags) -{ - struct timeval tv[2]; - - if (tvptr != NULL) { - if (get_udatamodel() == DATAMODEL_NATIVE) { - if (copyin(tvptr, tv, sizeof (tv))) - return (EFAULT); - } else { - struct timeval32 tv32[2]; - - if (copyin(tvptr, tv32, sizeof (tv32))) - return (EFAULT); - - TIMEVAL32_TO_TIMEVAL(&tv[0], &tv32[0]); - TIMEVAL32_TO_TIMEVAL(&tv[1], &tv32[1]); - } - - if (tv[0].tv_usec < 0 || tv[0].tv_usec >= MICROSEC || - tv[1].tv_usec < 0 || tv[1].tv_usec >= MICROSEC) - return (EINVAL); - - vattr->va_atime.tv_sec = tv[0].tv_sec; - vattr->va_atime.tv_nsec = tv[0].tv_usec * 1000; - vattr->va_mtime.tv_sec = tv[1].tv_sec; - vattr->va_mtime.tv_nsec = tv[1].tv_usec * 1000; - *flags = ATTR_UTIME; - } else { - gethrestime(&vattr->va_atime); - vattr->va_mtime = vattr->va_atime; - *flags = 0; - } - vattr->va_mask = AT_ATIME | AT_MTIME; - - return (0); -} - static int get_timespec_vattr(timespec_t *tsptr, struct vattr *vattr, int *flags) { @@ -212,90 +170,6 @@ get_timespec_vattr(timespec_t *tsptr, struct vattr *vattr, int *flags) return (0); } -/* - * The futimesat() system call is no longer invoked from libc. - * The futimesat() function has been implemented in libc using calls - * to futimens() and utimensat(). The kernel code for futimesat() - * should be expunged as soon as there is no longer a need - * to run Solaris 10 and prior versions of libc on the system. - * This includes the calls to futimesat in common/syscall/fsat.c - */ -int -futimesat(int fd, char *fname, struct timeval *tvptr) -{ - struct vattr vattr; - int flags; - int error; - - if ((error = get_timeval_vattr(tvptr, &vattr, &flags)) != 0) - return (set_errno(error)); - - return (cfutimesat(fd, fname, 2, &vattr, flags, FOLLOW)); -} - -/* - * The utime() system call is no longer invoked from libc. - * The utime() function has been implemented in libc using - * a call to utimensat(). The kernel code for utime() - * should be expunged as soon as there is no longer a need - * to run Solaris 10 and prior versions of libc on the system. - */ -int -utime(char *fname, time_t *tptr) -{ - time_t tv[2]; - struct vattr vattr; - int flags; - - if (tptr != NULL) { - if (get_udatamodel() == DATAMODEL_NATIVE) { - if (copyin(tptr, tv, sizeof (tv))) - return (set_errno(EFAULT)); - } else { - time32_t tv32[2]; - - if (copyin(tptr, &tv32, sizeof (tv32))) - return (set_errno(EFAULT)); - - tv[0] = (time_t)tv32[0]; - tv[1] = (time_t)tv32[1]; - } - - vattr.va_atime.tv_sec = tv[0]; - vattr.va_atime.tv_nsec = 0; - vattr.va_mtime.tv_sec = tv[1]; - vattr.va_mtime.tv_nsec = 0; - flags = ATTR_UTIME; - } else { - gethrestime(&vattr.va_atime); - vattr.va_mtime = vattr.va_atime; - flags = 0; - } - - vattr.va_mask = AT_ATIME|AT_MTIME; - return (cfutimesat(AT_FDCWD, fname, 1, &vattr, flags, FOLLOW)); -} - -/* - * The utimes() system call is no longer invoked from libc. - * The utimes() function has been implemented in libc using - * a call to utimensat(). The kernel code for utimes() - * should be expunged as soon as there is no longer a need - * to run Solaris 10 and prior versions of libc on the system. - */ -int -utimes(char *fname, struct timeval *tvptr) -{ - struct vattr vattr; - int flags; - int error; - - if ((error = get_timeval_vattr(tvptr, &vattr, &flags)) != 0) - return (set_errno(error)); - - return (cfutimesat(AT_FDCWD, fname, 1, &vattr, flags, FOLLOW)); -} - int futimens(int fd, timespec_t *tsptr) { diff --git a/usr/src/uts/intel/c2audit/Makefile b/usr/src/uts/intel/c2audit/Makefile index 7aadbbbeea..b30966392b 100644 --- a/usr/src/uts/intel/c2audit/Makefile +++ b/usr/src/uts/intel/c2audit/Makefile @@ -21,11 +21,9 @@ # # uts/intel/c2audit/Makefile # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" -# # This makefile drives the production of the c2audit driver kernel module. # # intel architecture dependent @@ -57,14 +55,17 @@ LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) # +# lint pass one enforcement +# +CFLAGS += $(CCVERBOSE) + +# # For now, disable these lint checks; maintainers should endeavor # to investigate and remove these for maximum lint coverage. # Please do not carry these forward to new Makefiles. # LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED -LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV diff --git a/usr/src/uts/intel/os/name_to_sysnum b/usr/src/uts/intel/os/name_to_sysnum index 9c1c003f73..e230d81afa 100644 --- a/usr/src/uts/intel/os/name_to_sysnum +++ b/usr/src/uts/intel/os/name_to_sysnum @@ -1,15 +1,11 @@ nosys 0 rexit 1 -forkall 2 read 3 write 4 open 5 close 6 -wait 7 -creat 8 link 9 unlink 10 -exec 11 chdir 12 gtime 13 mknod 14 @@ -20,7 +16,6 @@ stat 18 lseek 19 getpid 20 mount 21 -umount 22 setuid 23 getuid 24 stime 25 @@ -28,7 +23,6 @@ pcsample 26 alarm 27 fstat 28 pause 29 -utime 30 stty 31 gtty 32 access 33 @@ -39,10 +33,10 @@ kill 37 fstatfs 38 setpgrp 39 uucopystr 40 -dup 41 pipe 42 times 43 profil 44 +faccessat 45 setgid 46 getgid 47 msgsys 49 @@ -52,6 +46,7 @@ shmsys 52 semsys 53 ioctl 54 uadmin 55 +fchownat 56 utssys 57 fdsync 58 exece 59 @@ -59,13 +54,18 @@ umask 60 chroot 61 fcntl 62 ulimit 63 +renameat 64 +unlinkat 65 +fstatat 66 +fstatat64 67 +openat 68 +openat64 69 tasksys 70 acctctl 71 exacctsys 72 getpagesizes 73 rctlsys 74 sidsys 75 -fsat 76 lwp_park 77 sendfilev 78 rmdir 79 @@ -76,7 +76,6 @@ ucredsys 83 sysfs 84 getmsg 85 putmsg 86 -poll 87 lstat 88 symlink 89 readlink 90 @@ -110,10 +109,6 @@ vfork 119 fchdir 120 readv 121 writev 122 -xstat 123 -lxstat 124 -fxstat 125 -xmknod 126 mmapobj 127 setrlimit 128 getrlimit 129 @@ -130,18 +125,15 @@ systeminfo 139 sharefs 140 seteuid 141 forksys 142 -fork1 143 sigwait 144 lwp_info 145 yield 146 -lwp_sema_wait 147 lwp_sema_post 148 lwp_sema_trywait 149 lwp_detach 150 corectl 151 modctl 152 fchroot 153 -utimes 154 vhangup 155 gettimeofday 156 getitimer 157 @@ -155,7 +147,6 @@ lwp_self 164 lwp_sigmask 165 lwp_wait 167 lwp_mutex_wakeup 168 -lwp_mutex_lock 169 lwp_cond_wait 170 lwp_cond_signal 171 lwp_cond_broadcast 172 @@ -209,7 +200,6 @@ setrlimit64 220 getrlimit64 221 pread64 222 pwrite64 223 -creat64 224 open64 225 rpcmod 226 zone 227 diff --git a/usr/src/uts/intel/sys/stat_impl.h b/usr/src/uts/intel/sys/stat_impl.h index 496378dd65..e8d3cfcf3d 100644 --- a/usr/src/uts/intel/sys/stat_impl.h +++ b/usr/src/uts/intel/sys/stat_impl.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,16 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SYS_STAT_IMPL_H #define _SYS_STAT_IMPL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/feature_tests.h> #include <sys/types.h> @@ -36,185 +34,70 @@ extern "C" { #endif -#if !defined(_KERNEL) - -#if defined(__i386) /* * The implementation specific header for <sys/stat.h> - * When compiling outside of the large file environment, the *stat source - * symbols must lead to calls to corresponding _x*stat functions that supply - * an initial version number argument identifying which binary stat structure - * representation to use. In the large file compilation environment, the - * intermediate _x*stat functions and version numbers are unnecessary. - * Instead, the source symbols map onto invocations of corresponding *stat64 - * functions with identical arguments. */ +#if !defined(_KERNEL) + #if defined(__STDC__) +extern int fstat(int, struct stat *); +extern int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD); + #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ defined(_ATFILE_SOURCE) extern int fstatat(int, const char *, struct stat *, int); -#endif /* defined (_ATFILE_SOURCE) */ - -#if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint) -static int fstat(int, struct stat *); -static int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD); -int _fxstat(const int, int, struct stat *); -int _xstat(const int, const char *, struct stat *); -#else -extern int fstat(int, struct stat *); -extern int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD); -#endif +#endif /* defined (_ATFILE_SOURCE) */ #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) -#if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint) -static int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD); -#else extern int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD); -#endif -#if !defined(_LP64) && !defined(__lint) -static int mknod(const char *, mode_t, dev_t); -#else extern int mknod(const char *, mode_t, dev_t); -#endif -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ - -#if !defined(_LP64) && (!defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ - defined(__EXTENSIONS__)) -#if _FILE_OFFSET_BITS == 32 -int _lxstat(const int, const char *, struct stat *); -#endif -int _xmknod(const int, const char *, mode_t, dev_t); -#endif /* !defined(_LP64) && (!defined(__XOPEN_OR_POSIX)... */ +#endif /* !defined(__XOPEN_OR_POSIX) ... */ +#else /* defined(__STDC__) */ -#else /* !__STDC__ */ +extern int fstat(); +extern int stat(); +#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ + defined(_ATFILE_SOURCE) extern int fstatat(); - - -#if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint) -static int fstat(), stat(); -int _fxstat(), _xstat(); -#else -extern int fstat(), stat(); #endif + #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) -#if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint) -static int lstat(); -#else extern int lstat(); -#endif -#if !defined(_LP64) && !defined(__lint) -static int mknod(); -#else extern int mknod(); -#endif -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) ... */ +#endif /* !defined(__XOPEN_OR_POSIX) ... */ -#if !defined(_LP64) && (!defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ - defined(__EXTENSIONS__)) -#if _FILE_OFFSET_BITS == 32 -int _lxstat(); -#endif -int _xmknod(); -#endif /* !defined(_LP64) && (!defined(__XOPEN_OR_POSIX) ... */ +#endif /* defined(__STDC__) */ -#endif /* defined(__STDC__) */ +#if defined(__i386) && _FILE_OFFSET_BITS == 32 && \ + (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)) /* - * NOTE: Application software should NOT program - * to the _xstat interface. + * Obsolete SVR3 compatibility functions. + * Application software should NOT program to the _xstat interface. */ - -#if _FILE_OFFSET_BITS == 32 && !defined(_LP64) && !defined(__lint) - -static int -#ifdef __STDC__ -stat(const char *_RESTRICT_KYWD _path, struct stat *_RESTRICT_KYWD _buf) -#else -stat(_path, _buf) -char *_path; -struct stat *_buf; -#endif -{ - return (_xstat(_STAT_VER, _path, _buf)); -} - -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) -static int -#ifdef __STDC__ -lstat(const char *_RESTRICT_KYWD _path, struct stat *_RESTRICT_KYWD _buf) -#else -lstat(_path, _buf) -char *_path; -struct stat *_buf; -#endif -{ - return (_lxstat(_STAT_VER, _path, _buf)); -} -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ - -static int -#ifdef __STDC__ -fstat(int _fd, struct stat *_buf) -#else -fstat(_fd, _buf) -int _fd; -struct stat *_buf; -#endif -{ - return (_fxstat(_STAT_VER, _fd, _buf)); -} - -#endif /* _FILE_OFFSET_BITS == 32 && !defined(_LP64) ... */ - -#if !defined(_LP64) && !defined(__lint) && (!defined(__XOPEN_OR_POSIX) || \ - defined(_XPG4_2) || defined(__EXTENSIONS__)) -static int -#ifdef __STDC__ -mknod(const char *_path, mode_t _mode, dev_t _dev) -#else -mknod(_path, _mode, _dev) -char *_path; -mode_t _mode; -dev_t _dev; -#endif -{ - return (_xmknod(_MKNOD_VER, _path, _mode, _dev)); -} -#endif /* !defined(_LP64) && !defined(__lint) && ... */ - -#else /* !__i386 */ - #if defined(__STDC__) -extern int fstat(int, struct stat *); -extern int stat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD); -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) || \ - defined(_ATFILE_SOURCE) -extern int fstatat(int, const char *, struct stat *, int); -#endif /* defined (_ATFILE_SOURCE) */ - -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) -extern int lstat(const char *_RESTRICT_KYWD, struct stat *_RESTRICT_KYWD); -extern int mknod(const char *, mode_t, dev_t); -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) ... */ - -#else /* !__STDC__ */ +extern int _fxstat(const int, int, struct stat *); +extern int _xstat(const int, const char *, struct stat *); +extern int _lxstat(const int, const char *, struct stat *); +extern int _xmknod(const int, const char *, mode_t, dev_t); -extern int fstat(), stat(), fstatat(); +#else /* __STDC__ */ -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) -extern int lstat(), mknod(); -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ +extern int _fxstat(); +extern int _xstat(); +extern int _lxstat(); +extern int _xmknod(); -#endif /* !__STDC__ */ +#endif /* __STDC__ */ -#endif /* !__i386 */ +#endif /* defined(__i386) ... */ -#endif /* !defined(_KERNEL) */ +#endif /* !defined(_KERNEL) */ #ifdef __cplusplus } diff --git a/usr/src/uts/sparc/c2audit/Makefile b/usr/src/uts/sparc/c2audit/Makefile index e232501105..95a2df98bc 100644 --- a/usr/src/uts/sparc/c2audit/Makefile +++ b/usr/src/uts/sparc/c2audit/Makefile @@ -20,14 +20,13 @@ # # # uts/sparc/c2audit/Makefile -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# Copyright 2010 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # # This makefile drives the production of the c2audit driver kernel module. # -# sparc implementation architecture dependent +# sparc architecture dependent # # @@ -67,8 +66,6 @@ CFLAGS += $(CCVERBOSE) # LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED -LINTTAGS += -erroff=E_STATIC_UNUSED LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV diff --git a/usr/src/uts/sparc/os/name_to_sysnum b/usr/src/uts/sparc/os/name_to_sysnum index d89f570fc2..ab363d6216 100644 --- a/usr/src/uts/sparc/os/name_to_sysnum +++ b/usr/src/uts/sparc/os/name_to_sysnum @@ -1,15 +1,11 @@ nosys 0 rexit 1 -forkall 2 read 3 write 4 open 5 close 6 -wait 7 -creat 8 link 9 unlink 10 -exec 11 chdir 12 gtime 13 mknod 14 @@ -20,7 +16,6 @@ stat 18 lseek 19 getpid 20 mount 21 -umount 22 setuid 23 getuid 24 stime 25 @@ -28,7 +23,6 @@ pcsample 26 alarm 27 fstat 28 pause 29 -utime 30 stty 31 gtty 32 access 33 @@ -39,10 +33,10 @@ kill 37 fstatfs 38 setpgrp 39 uucopystr 40 -dup 41 pipe 42 times 43 profil 44 +faccessat 45 setgid 46 getgid 47 msgsys 49 @@ -51,6 +45,7 @@ shmsys 52 semsys 53 ioctl 54 uadmin 55 +fchownat 56 utssys 57 fdsync 58 exece 59 @@ -58,13 +53,18 @@ umask 60 chroot 61 fcntl 62 ulimit 63 +renameat 64 +unlinkat 65 +fstatat 66 +fstatat64 67 +openat 68 +openat64 69 tasksys 70 acctctl 71 exacctsys 72 getpagesizes 73 rctlsys 74 sidsys 75 -fsat 76 lwp_park 77 sendfilev 78 rmdir 79 @@ -75,7 +75,6 @@ ucredsys 83 sysfs 84 getmsg 85 putmsg 86 -poll 87 lstat 88 symlink 89 readlink 90 @@ -108,10 +107,6 @@ vfork 119 fchdir 120 readv 121 writev 122 -xstat 123 -lxstat 124 -fxstat 125 -xmknod 126 mmapobj 127 setrlimit 128 getrlimit 129 @@ -128,18 +123,15 @@ systeminfo 139 sharefs 140 seteuid 141 forksys 142 -fork1 143 sigwait 144 lwp_info 145 yield 146 -lwp_sema_wait 147 lwp_sema_post 148 lwp_sema_trywait 149 lwp_detach 150 corectl 151 modctl 152 fchroot 153 -utimes 154 vhangup 155 gettimeofday 156 getitimer 157 @@ -153,7 +145,6 @@ lwp_self 164 lwp_sigmask 165 lwp_wait 167 lwp_mutex_wakeup 168 -lwp_mutex_lock 169 lwp_cond_wait 170 lwp_cond_signal 171 lwp_cond_broadcast 172 @@ -208,7 +199,6 @@ setrlimit64 220 getrlimit64 221 pread64 222 pwrite64 223 -creat64 224 open64 225 rpcmod 226 zone 227 |