|
From: Greg P. <gp...@us...> - 2005-08-24 05:31:46
|
I examined Valgrind's generic syscall wrappers and compared them to Darwin / Mac OS X's syscall list. The list should give us a better idea of which syscall wrappers are actually generic and which should be Linux-specific instead. The wrappers are divided into four classes: * Truly generic. There is a Darwin syscall that matches the Linux syscall, and Valgrind's wrapper will probably work for both. These should stay in syswrap-generic.c * Unused on Darwin but generic. There is no Darwin syscall that will use this wrapper, but the wrapper compiles without error. These should stay in syswrap-generic.c if they are useful for FreeBSD or Solaris or something. * Unused on Darwin and not generic. There is no Darwin syscall that will use this wrapper, and the wrapper does not compile. Usually these fail because of a Linux-specific type that is missing. These could move to syswrap-linux.c, or they could stay in syswrap-generic.c and Darwin could provide dummy vki definitions for the types. * Not generic. Darwin has a syscall that is similar to Linux, but the wrapper implementations will differ. Usually these fail because the syscall parameter lists are different. I looked at the valgrind-3 tree checked out as of a few days ago. My analysis was brief and not 100% precise, but these results should be correct for most cases. None of the wrappers currently in syswrap-*linux.c looked applicable to Darwin. # The following groups of syscalls are mostly not generic # and should be handled en masse: *16 *xattr clock_* mq_* msg* rt_sig* sched_* sig* timer_* # The following syscalls are partly generic and partly not. They're # likely candidates for a generic wrapper plus an OS-specific hook. fcntl (some flags are different) ioctl (most flags are different) semctl (most flags are different) shmctl (most flags are different) # Truly generic - keep in syswrap-generic.c accept access acct bind chdir chmod chown chroot close connect dup dup2 execve exit fchdir fchmod fchown flock fork fstatfs fsync ftruncate64 getegid geteuid getgid getgroups getitimer getpeername getpgid getpgrp getpid getppid getpriority getrlimit getrusage getsid getsockname getsockopt gettimeofday getuid lchown link madvise mincore mkdir mknod mlock mlockall mprotect msync munlock munmap newfstat newlstat newstat open poll pread64 pwrite64 read readlink readv recv recvfrom recvmsg rename rmdir select semop send sendmsg sendto setgid setgroups setgroups setitimer setpgid setpriority setregid setreuid setrlimit setsid setsockopt settimeofday setuid shmat shmdt sigaltstack socket socketpair statfs symlink sync truncate64 umask unlink utimes wait4 write writev # Unused but generic - probably keep in syscall-generic.c alarm brk creat fdatasync fstatfs64 ftruncate getcwd getdents getdents64 getegid16 getgid16 getpmsg getuid16 getuid16 init_module iopl lgetxattr llistxattr lookup_dcookie lremovexattr lsetxattr mq_unlink mremap nanosleep newuname nice old_getrlimit pause putpmsg rt_sigaction rt_sigpending rt_sigprocmask rt_sigqueueinfo rt_sigsuspend rt_sigtimedwait sched_get_priority_max sched_get_priority_min sched_getaffinity sched_getscheduler sched_setaffinity sched_yield semtimedop statfs64 time times truncate waitpid # Unused and not generic - possibly keep in syswrap-generic.c capget (no vki_cap_user_data_t) capset (no vki_cap_user_data_t) chown16 (no vki_old_gid_t) clock_getres (no vki_clockid_t) clock_gettime (no vki_clockid_t) clock_nanosleep (no vki_clockid_t) clock_settime (no vki_clockid_t) fchown16 (no vki_old_uid_t) fcntl64 (flags are different) getgroups16 (no vki_old_gid_t) mq_getsetatte (no vki_mqd_t, no mq_attr) mq_notify (no vki_mqd_t) mq_open (no vki_mq_attr) mq_timedreceive (no vki_mqd_t) mq_timedsend (no vki_mqd_t) msgctl (no vki_msgbuf) msgrcv (no vki_msgbuf) msgsnd (no vki_msgbuf) sched_getparam (no vki_sched_param) sched_setparam (no vki_sched_param) sched_setscheduler (no vki_sched_param) setgid16 (no vki_old_gid_t) setgroups16 (no vki_old_gid_t) setgroups16 (no vki_old_gid_t) setregid16 (no vki_old_gid_t) setreuid16 (no vki_old_uid_t) setuid16 (no vki_old_uid_t) timer_create (no vki_timer_t, no vki_clockid_t) timer_delete (no vki_timer_t) timer_getoverrun (no vki_timer_t) timer_gettime (no vki_timer_t, no vki_itimerspec) timer_settime (no vki_timer_t, no vki_itimerspec) utime (no vki_utimbuf) # Not generic - probably move to OS-specific files fgetxattr (darwin has another parameter) flistxattr (darwin has another parameter) fremovexattr (darwin has another parameter) fsetxattr (darwin has another parameter) getxattr (darwin has another parameter) kill (darwin has another parameter) listxattr (darwin has another parameter) lseek (darwin's off_t is 64 bits even on 32-bit archs) mmap (darwin's off_t is 64 bits even on 32-bit archs) munlockall (darwin has another parameter) pipe (darwin has different parameters and return value) quotactl (darwin has different parameters) removexattr (darwin has another parameter) setxattr (darwin has another parameter) sigpending (darwin only has one sigset_t type sigprocmask (darwin only has one sigset_t type) waitid (darwin has different parameters) -- Greg Parker gp...@us... |
|
From: Nicholas N. <nj...@cs...> - 2005-08-24 14:03:07
|
On Wed, 24 Aug 2005, Greg Parker wrote: > I examined Valgrind's generic syscall wrappers and compared them to > Darwin / Mac OS X's syscall list. The list should give us a better > idea of which syscall wrappers are actually generic and which should > be Linux-specific instead. Thank you! This is great. I appreciate how boring this must have been... there are so many syscalls and going through them systematically is a real pain. > The wrappers are divided into four classes: > * Truly generic. There is a Darwin syscall that matches the Linux > syscall, and Valgrind's wrapper will probably work for both. > These should stay in syswrap-generic.c yes > * Unused on Darwin but generic. There is no Darwin syscall that > will use this wrapper, but the wrapper compiles without error. > These should stay in syswrap-generic.c if they are useful for > FreeBSD or Solaris or something. yes > * Unused on Darwin and not generic. There is no Darwin syscall > that will use this wrapper, and the wrapper does not compile. > Usually these fail because of a Linux-specific type that is > missing. These could move to syswrap-linux.c, or they could > stay in syswrap-generic.c and Darwin could provide dummy vki > definitions for the types. They should go in syswrap-linux.c. > * Not generic. Darwin has a syscall that is similar to Linux, > but the wrapper implementations will differ. Usually these > fail because the syscall parameter lists are different. These should be moved to syswrap-linux.c also. > I looked at the valgrind-3 tree checked out as of a few days ago. > My analysis was brief and not 100% precise, but these results > should be correct for most cases. None of the wrappers currently > in syswrap-*linux.c looked applicable to Darwin. > > > # The following groups of syscalls are mostly not generic > # and should be handled en masse: > *16 > *xattr > clock_* > mq_* > msg* > rt_sig* > sched_* > sig* > timer_* Some of these you have in the "unused but generic" list below: > # Unused but generic - probably keep in syscall-generic.c > ... > getegid16 > getgid16 > ... > llistxattr > lremovexattr > lsetxattr > mq_unlink > ... > rt_sigaction > rt_sigpending > ... > sched_get_priority_max > sched_get_priority_min is that just a mistake? They look like they should be in syswrap-linux.c. I'll try to find time to start moving the Linux-specific ones out of syswrap-generic.c into syswrap-linux.c, although patience would be appreciated :) Can you post a full list of the Darwin syscalls for comparison? (The contents of vki_unistd.h would suffice.) And remind me -- is your code visible somewhere? N |
|
From: Greg P. <gp...@us...> - 2005-08-25 18:22:11
|
Nicholas Nethercote writes:
> On Wed, 24 Aug 2005, Greg Parker wrote:
> > # The following groups of syscalls are mostly not generic
> > # and should be handled en masse:
> > *16
> > *xattr
> > clock_*
> > mq_*
> > msg*
> > rt_sig*
> > sched_*
> > sig*
> > timer_*
>
> Some of these you have in the "unused but generic" list below:
[snip]
> is that just a mistake? They look like they should be in syswrap-linux.c.
Those individual "unused but generic" functions compile with no error,
but the others in those groups do not. I'd suggest that all functions
in those groups should be moved together, but you already recommended
that everything get aggressively moved anyway, so that's not an issue.
> I'll try to find time to start moving the Linux-specific ones out of
> syswrap-generic.c into syswrap-linux.c, although patience would be
> appreciated :) Can you post a full list of the Darwin syscalls for
> comparison?
I've pasted the contents of syscall.master below.
> And remind me -- is your code visible somewhere?
I'm just getting started with valgrind 3.x, so I currently
have little code. When I have something that's interesting
to look at, you'll be the first to know.
xnu-792.2.4:bsd/kern/syscalls.master
; derived from: FreeBSD @(#)syscalls.master 8.2 (Berkeley) 1/13/94
;
; System call name/number master file.
; This is file processed by .../xnu/bsd/kern/makesyscalls.sh and creates:
; .../xnu/bsd/kern/init_sysent.c
; .../xnu/bsd/kern/syscalls.c
; .../xnu/bsd/sys/syscall.h
; .../xnu/bsd/sys/sysproto.h
; Columns -> | Number | Cancel | Funnel | Files | { Name and Args } | { Comments }
; Number: system call number, must be in order
; Cancel: type of thread cancel - "PRE", "POST" or "NONE"
; Funnel: type of funnel - "KERN" or "NONE"
; Files: with files to generate - "ALL" or any combo of:
; "T" for syscall table (in init_sysent.c)
; "N" for syscall names (in syscalls.c)
; "H" for syscall headers (in syscall.h)
; "P" for syscall prototypes (in sysproto.h)
; Comments: additional comments about the sys call copied to output files
; #ifdef's, #include's, #if's etc. are copied to all output files.
#include <sys/appleapiopts.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/types.h>
#include <sys/sysent.h>
#include <sys/sysproto.h>
0 NONE NONE ALL { int nosys(void); } { indirect syscall }
1 NONE KERN ALL { void exit(int rval); }
2 NONE KERN ALL { int fork(void); }
3 PRE NONE ALL { user_ssize_t read(int fd, user_addr_t cbuf, user_size_t nbyte); }
4 PRE NONE ALL { user_ssize_t write(int fd, user_addr_t cbuf, user_size_t nbyte); }
5 PRE NONE ALL { int open(user_addr_t path, int flags, int mode); }
6 PRE NONE ALL { int close(int fd); }
7 PRE KERN ALL { int wait4(int pid, user_addr_t status, int options, user_addr_t rusage); }
8 NONE NONE ALL { int nosys(void); } { old creat }
9 NONE NONE ALL { int link(user_addr_t path, user_addr_t link); }
10 NONE NONE ALL { int unlink(user_addr_t path); }
11 NONE NONE ALL { int nosys(void); } { old execv }
12 NONE NONE ALL { int chdir(user_addr_t path); }
13 NONE NONE ALL { int fchdir(int fd); }
14 NONE NONE ALL { int mknod(user_addr_t path, int mode, int dev); }
15 NONE NONE ALL { int chmod(user_addr_t path, int mode); }
16 NONE NONE ALL { int chown(user_addr_t path, int uid, int gid); }
17 NONE NONE UALL { int obreak(char *nsize); } { old break }
#if COMPAT_GETFSSTAT
18 NONE NONE ALL { int ogetfsstat(user_addr_t buf, int bufsize, int flags); }
#else
18 NONE NONE ALL { int getfsstat(user_addr_t buf, int bufsize, int flags); }
#endif
19 NONE NONE ALL { int nosys(void); } { old lseek }
20 NONE NONE ALL { int getpid(void); }
21 NONE NONE ALL { int nosys(void); } { old mount }
22 NONE NONE ALL { int nosys(void); } { old umount }
23 NONE KERN ALL { int setuid(uid_t uid); }
24 NONE KERN ALL { int getuid(void); }
25 NONE KERN ALL { int geteuid(void); }
26 NONE KERN ALL { int ptrace(int req, pid_t pid, caddr_t addr, int data); }
27 PRE NONE ALL { int recvmsg(int s, struct msghdr *msg, int flags); }
28 PRE NONE ALL { int sendmsg(int s, caddr_t msg, int flags); }
29 PRE NONE ALL { int recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, int *fromlenaddr); }
30 PRE NONE ALL { int accept(int s, caddr_t name, socklen_t *anamelen); }
31 NONE NONE ALL { int getpeername(int fdes, caddr_t asa, socklen_t *alen); }
32 NONE NONE ALL { int getsockname(int fdes, caddr_t asa, socklen_t *alen); }
33 NONE NONE ALL { int access(user_addr_t path, int flags); }
34 NONE NONE ALL { int chflags(char *path, int flags); }
35 NONE NONE ALL { int fchflags(int fd, int flags); }
36 NONE NONE ALL { int sync(void); }
37 NONE KERN ALL { int kill(int pid, int signum); }
38 NONE NONE ALL { int nosys(void); } { old stat }
39 NONE KERN ALL { int getppid(void); }
40 NONE NONE ALL { int nosys(void); } { old lstat }
41 NONE NONE ALL { int dup(u_int fd); }
42 NONE NONE ALL { int pipe(void); }
43 NONE KERN ALL { int getegid(void); }
44 NONE KERN ALL { int profil(short *bufbase, size_t bufsize, u_long pcoffset, u_int pcscale); }
45 NONE KERN ALL { int ktrace(const char *fname, int ops, int facs, int pid); }
46 NONE KERN ALL { int sigaction(int signum, struct __sigaction *nsa, struct sigaction *osa); }
47 NONE KERN ALL { int getgid(void); }
48 NONE KERN ALL { int sigprocmask(int how, user_addr_t mask, user_addr_t omask); }
49 NONE KERN ALL { int getlogin(char *namebuf, u_int namelen); }
50 NONE KERN ALL { int setlogin(char *namebuf); }
51 NONE KERN ALL { int acct(char *path); }
52 NONE KERN ALL { int sigpending(struct sigvec *osv); }
53 NONE KERN ALL { int sigaltstack(struct sigaltstack *nss, struct sigaltstack *oss); }
54 NONE NONE ALL { int ioctl(int fd, u_long com, caddr_t data); }
55 NONE KERN ALL { int reboot(int opt, char *command); }
56 NONE NONE ALL { int revoke(char *path); }
57 NONE NONE ALL { int symlink(char *path, char *link); }
58 NONE NONE ALL { int readlink(char *path, char *buf, int count); }
59 NONE KERN ALL { int execve(char *fname, char **argp, char **envp); }
60 NONE KERN ALL { int umask(int newmask); }
61 NONE KERN ALL { int chroot(user_addr_t path); }
62 NONE NONE ALL { int nosys(void); } { old fstat }
63 NONE NONE ALL { int nosys(void); } { used internally, reserved }
64 NONE NONE ALL { int nosys(void); } { old getpagesize }
65 PRE NONE ALL { int msync(caddr_t addr, size_t len, int flags); }
66 NONE KERN ALL { int vfork(void); }
67 NONE NONE ALL { int nosys(void); } { old vread }
68 NONE NONE ALL { int nosys(void); } { old vwrite }
69 NONE NONE ALL { int sbrk(int incr); }
70 NONE NONE ALL { int sstk(int incr); }
71 NONE NONE ALL { int nosys(void); } { old mmap }
72 NONE NONE ALL { int ovadvise(void); } { old vadvise }
73 NONE NONE ALL { int munmap(caddr_t addr, size_t len); }
74 NONE NONE ALL { int mprotect(caddr_t addr, size_t len, int prot); }
75 NONE NONE ALL { int madvise(caddr_t addr, size_t len, int behav); }
76 NONE NONE ALL { int nosys(void); } { old vhangup }
77 NONE NONE ALL { int nosys(void); } { old vlimit }
78 NONE NONE ALL { int mincore(user_addr_t addr, user_size_t len, user_addr_t vec); }
79 NONE KERN ALL { int getgroups(u_int gidsetsize, gid_t *gidset); }
80 NONE KERN ALL { int setgroups(u_int gidsetsize, gid_t *gidset); }
81 NONE KERN ALL { int getpgrp(void); }
82 NONE KERN ALL { int setpgid(int pid, int pgid); }
83 NONE KERN ALL { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); }
84 NONE NONE ALL { int nosys(void); } { old wait }
85 NONE NONE ALL { int swapon(void); }
86 NONE KERN ALL { int getitimer(u_int which, struct itimerval *itv); }
87 NONE NONE ALL { int nosys(void); } { old gethostname }
88 NONE NONE ALL { int nosys(void); } { old sethostname }
89 NONE NONE ALL { int getdtablesize(void); }
90 NONE NONE ALL { int dup2(u_int from, u_int to); }
91 NONE NONE ALL { int nosys(void); } { old getdopt }
92 PRE NONE ALL { int fcntl(int fd, int cmd, long arg); }
93 PRE KERN ALL { int select(int nd, u_int32_t *in, u_int32_t *ou, u_int32_t *ex, struct timeval *tv); }
94 NONE NONE ALL { int nosys(void); } { old setdopt }
95 PRE NONE ALL { int fsync(int fd); }
96 NONE KERN ALL { int setpriority(int which, int who, int prio); }
97 NONE NONE ALL { int socket(int domain, int type, int protocol); }
98 PRE NONE ALL { int connect(int s, caddr_t name, socklen_t namelen); }
99 NONE NONE ALL { int nosys(void); } { old accept }
100 NONE KERN ALL { int getpriority(int which, int who); }
101 NONE NONE ALL { int nosys(void); } { old send }
102 NONE NONE ALL { int nosys(void); } { old recv }
#ifdef __ppc__
103 NONE NONE ALL { int nosys(void); } { old sigreturn }
#else
103 NONE KERN UALL { int sigreturn(struct sigcontext *sigcntxp); }
#endif
104 NONE NONE ALL { int bind(int s, caddr_t name, socklen_t namelen); }
105 NONE NONE ALL { int setsockopt(int s, int level, int name, caddr_t val, socklen_t valsize); }
106 NONE NONE ALL { int listen(int s, int backlog); }
107 NONE NONE ALL { int nosys(void); } { old vtimes }
108 NONE NONE ALL { int nosys(void); } { old sigvec }
109 NONE NONE ALL { int nosys(void); } { old sigblock }
110 NONE NONE ALL { int nosys(void); } { old sigsetmask }
111 PRE KERN ALL { int sigsuspend(sigset_t mask); }
112 NONE NONE ALL { int nosys(void); } { old sigstack }
113 NONE NONE ALL { int nosys(void); } { old recvmsg }
114 NONE NONE ALL { int nosys(void); } { old sendmsg }
115 NONE NONE ALL { int nosys(void); } { old vtrace }
#ifdef __ppc__
116 NONE NONE ALL { int ppc_gettimeofday(struct timeval *tp, struct timezone *tzp); }
#else
116 NONE NONE ALL { int gettimeofday(struct timeval *tp, struct timezone *tzp); }
#endif
117 NONE KERN ALL { int getrusage(int who, struct rusage *rusage); }
118 NONE NONE ALL { int getsockopt(int s, int level, int name, caddr_t val, socklen_t *avalsize); }
119 NONE NONE ALL { int nosys(void); } { old resuba }
120 PRE NONE ALL { user_ssize_t readv(int fd, struct iovec *iovp, u_int iovcnt); }
121 PRE NONE ALL { user_ssize_t writev(int fd, struct iovec *iovp, u_int iovcnt); }
122 NONE KERN ALL { int settimeofday(struct timeval *tv, struct timezone *tzp); }
123 NONE NONE ALL { int fchown(int fd, int uid, int gid); }
124 NONE NONE ALL { int fchmod(int fd, int mode); }
125 NONE NONE ALL { int nosys(void); } { old recvfrom }
126 NONE NONE ALL { int nosys(void); } { old setreuid }
127 NONE NONE ALL { int nosys(void); } { old setregid }
128 NONE NONE ALL { int rename(char *from, char *to); }
129 NONE NONE ALL { int nosys(void); } { old truncate }
130 NONE NONE ALL { int nosys(void); } { old ftruncate }
131 NONE NONE ALL { int flock(int fd, int how); }
132 NONE NONE ALL { int mkfifo(user_addr_t path, int mode); }
133 PRE NONE ALL { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, socklen_t tolen); }
134 NONE NONE ALL { int shutdown(int s, int how); }
135 NONE NONE ALL { int socketpair(int domain, int type, int protocol, int *rsv); }
136 NONE NONE ALL { int mkdir(user_addr_t path, int mode); }
137 NONE NONE ALL { int rmdir(char *path); }
138 NONE NONE ALL { int utimes(char *path, struct timeval *tptr); }
139 NONE NONE ALL { int futimes(int fd, struct timeval *tptr); }
140 NONE KERN ALL { int adjtime(struct timeval *delta, struct timeval *olddelta); }
141 NONE NONE ALL { int nosys(void); } { old getpeername }
142 NONE NONE ALL { int nosys(void); } { old gethostid }
143 NONE NONE ALL { int nosys(void); } { old sethostid }
144 NONE NONE ALL { int nosys(void); } { old getrlimit }
145 NONE NONE ALL { int nosys(void); } { old setrlimit }
146 NONE NONE ALL { int nosys(void); } { old killpg }
147 NONE KERN ALL { int setsid(void); }
148 NONE NONE ALL { int nosys(void); } { old setquota }
149 NONE NONE ALL { int nosys(void); } { old qquota }
150 NONE NONE ALL { int nosys(void); } { old getsockname }
151 NONE KERN ALL { int getpgid(pid_t pid); }
152 NONE KERN ALL { int setprivexec(int flag); }
153 PRE NONE ALL { user_ssize_t pread(int fd, user_addr_t buf, user_size_t nbyte, off_t offset); }
154 PRE NONE ALL { user_ssize_t pwrite(int fd, user_addr_t buf, user_size_t nbyte, off_t offset); }
#if NFSSERVER
155 NONE KERN ALL { int nfssvc(int flag, caddr_t argp); }
#else
155 NONE NONE ALL { int nosys(void); }
#endif
156 NONE NONE ALL { int nosys(void); } { old getdirentries }
157 NONE NONE ALL { int statfs(char *path, struct statfs *buf); }
158 NONE NONE ALL { int fstatfs(int fd, struct statfs *buf); }
159 NONE NONE ALL { int unmount(user_addr_t path, int flags); }
160 NONE NONE ALL { int nosys(void); } { old async_daemon }
#if NFSCLIENT
161 NONE KERN ALL { int getfh(char *fname, fhandle_t *fhp); }
#else
161 NONE NONE ALL { int nosys(void); }
#endif
162 NONE NONE ALL { int nosys(void); } { old getdomainname }
163 NONE NONE ALL { int nosys(void); } { old setdomainname }
164 NONE NONE ALL { int nosys(void); }
165 NONE KERN ALL { int quotactl(char *path, int cmd, int uid, caddr_t arg); }
166 NONE NONE ALL { int nosys(void); } { old exportfs }
167 NONE NONE ALL { int mount(char *type, char *path, int flags, caddr_t data); }
168 NONE NONE ALL { int nosys(void); } { old ustat }
169 NONE NONE ALL { int nosys(void); }
170 NONE NONE HN { int table(void); } { old table }
171 NONE NONE ALL { int nosys(void); } { old wait3 }
172 NONE NONE ALL { int nosys(void); } { old rpause }
173 PRE KERN ALL { int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options); }
174 NONE NONE ALL { int nosys(void); } { old getdents }
175 NONE NONE ALL { int nosys(void); } { old gc_control }
176 NONE KERN ALL { int add_profil(short *bufbase, size_t bufsize, u_long pcoffset, u_int pcscale); }
177 NONE NONE ALL { int nosys(void); }
178 NONE NONE ALL { int nosys(void); }
179 NONE NONE ALL { int nosys(void); }
180 NONE NONE UALL { int kdebug_trace(int code, int arg1, int arg2, int arg3, int arg4, int arg5); }
181 NONE KERN ALL { int setgid(gid_t gid); }
182 NONE KERN ALL { int setegid(gid_t egid); }
183 NONE KERN ALL { int seteuid(uid_t euid); }
#ifdef __ppc__
184 NONE KERN ALL { int sigreturn(struct ucontext *uctx, int infostyle); }
#else
184 NONE NONE ALL { int nosys(void); }
#endif
185 NONE NONE ALL { int nosys(void); }
186 NONE NONE ALL { int nosys(void); }
187 NONE NONE ALL { int nosys(void); }
188 NONE NONE ALL { int stat(user_addr_t path, user_addr_t ub); }
189 NONE NONE ALL { int fstat(int fd, user_addr_t ub); }
190 NONE NONE ALL { int lstat(user_addr_t path, user_addr_t ub); }
191 NONE NONE ALL { int pathconf(char *path, int name); }
192 NONE NONE ALL { int fpathconf(int fd, int name); }
#if COMPAT_GETFSSTAT
193 NONE NONE ALL { int getfsstat(user_addr_t buf, user_long_t bufsize, int flags); }
#else
193 NONE NONE ALL { int nosys(void); }
#endif
194 NONE KERN ALL { int getrlimit(u_int which, struct rlimit *rlp); }
195 NONE KERN ALL { int setrlimit(u_int which, struct rlimit *rlp); }
196 NONE NONE ALL { int getdirentries(int fd, char *buf, u_int count, long *basep); }
197 NONE NONE ALL { user_addr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); }
198 NONE NONE ALL { int nosys(void); } { __syscall }
199 NONE NONE ALL { off_t lseek(int fd, off_t offset, int whence); }
200 NONE NONE ALL { int truncate(char *path, off_t length); }
201 NONE NONE ALL { int ftruncate(int fd, off_t length); }
202 NONE KERN ALL { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); }
203 NONE NONE ALL { int mlock(caddr_t addr, size_t len); }
204 NONE NONE ALL { int munlock(caddr_t addr, size_t len); }
205 NONE NONE ALL { int undelete(user_addr_t path); }
#ifdef __ppc__
206 NONE NONE ALL { int ATsocket(int proto); }
207 NONE NONE UALL { int ATgetmsg(int fd, void *ctlptr, void *datptr, int *flags); }
208 NONE NONE UALL { int ATputmsg(int fd, void *ctlptr, void *datptr, int flags); }
209 NONE NONE UALL { int ATPsndreq(int fd, unsigned char *buf, int len, int nowait); }
210 NONE NONE UALL { int ATPsndrsp(int fd, unsigned char *respbuff, int resplen, int datalen); }
211 NONE NONE UALL { int ATPgetreq(int fd, unsigned char *buf, int buflen); }
212 NONE NONE UALL { int ATPgetrsp(int fd, unsigned char *bdsp); }
213 NONE NONE ALL { int nosys(void); } { Reserved for AppleTalk }
#else
206 NONE NONE HN { int ATsocket(int proto); }
207 NONE NONE UHN { int ATgetmsg(int fd, void *ctlptr, void *datptr, int *flags); }
208 NONE NONE UHN { int ATputmsg(int fd, void *ctlptr, void *datptr, int flags); }
209 NONE NONE UHN { int ATPsndreq(int fd, unsigned char *buf, int len, int nowait); }
210 NONE NONE UHN { int ATPsndrsp(int fd, unsigned char *respbuff, int resplen, int datalen); }
211 NONE NONE UHN { int ATPgetreq(int fd, unsigned char *buf, int buflen); }
212 NONE NONE UHN { int ATPgetrsp(int fd, unsigned char *bdsp); }
213 NONE NONE ALL { int nosys(void); } { Reserved for AppleTalk }
#endif /* __ppc__ */
214 NONE KERN ALL { int kqueue_from_portset_np(int portset); }
215 NONE KERN ALL { int kqueue_portset_np(int fd); }
; System Calls 216 - 230 are reserved for calls to support HFS/HFS Plus
; file system semantics. Currently, we only use 215-227. The rest is
; for future expansion in anticipation of new MacOS APIs for HFS Plus.
; These calls are not conditionalized becuase while they are specific
; to HFS semantics, they are not specific to the HFS filesystem.
; We expect all filesystems to recognize the call and report that it is
; not supported or to actually implement it.
216 NONE NONE UHN { int mkcomplex(const char *path, mode_t mode, u_long type); } { soon to be obsolete }
217 NONE NONE UHN { int statv(const char *path, struct vstat *vsb); } { soon to be obsolete }
218 NONE NONE UHN { int lstatv(const char *path, struct vstat *vsb); } { soon to be obsolete }
219 NONE NONE UHN { int fstatv(int fd, struct vstat *vsb); } { soon to be obsolete }
220 NONE NONE ALL { int getattrlist(const char *path, struct attrlist *alist, void *attributeBuffer, size_t bufferSize, u_long options); }
221 NONE NONE ALL { int setattrlist(const char *path, struct attrlist *alist, void *attributeBuffer, size_t bufferSize, u_long options); }
222 NONE NONE ALL { int getdirentriesattr(int fd, struct attrlist *alist, void *buffer, size_t buffersize, u_long *count, u_long *basep, u_long *newstate, u_long options); }
223 NONE NONE ALL { int exchangedata(const char *path1, const char *path2, u_long options); }
#ifdef __APPLE_API_OBSOLETE
224 NONE NONE UALL { int checkuseraccess(const char *path, uid_t userid, gid_t *groups, int ngroups, int accessrequired, u_long options); }
#else
224 NONE NONE ALL { int nosys(void); } { HFS checkuseraccess check access to a file }
#endif /* __APPLE_API_OBSOLETE */
225 NONE KERN ALL { int searchfs(const char *path, struct fssearchblock *searchblock, u_long *nummatches, u_long scriptcode, u_long options, struct searchstate *state); }
226 NONE NONE ALL { int delete(user_addr_t path); } { private delete (Carbon semantics) }
227 NONE NONE ALL { int copyfile(char *from, char *to, int mode, int flags); }
228 NONE NONE ALL { int nosys(void); }
229 NONE NONE ALL { int nosys(void); }
230 PRE NONE ALL { int poll(struct pollfd *fds, u_int nfds, int timeout); }
231 NONE NONE UALL { int watchevent(struct eventreq *u_req, int u_eventmask); }
232 NONE NONE UALL { int waitevent(struct eventreq *u_req, struct timeval *tv); }
233 NONE NONE UALL { int modwatch(struct eventreq *u_req, int u_eventmask); }
234 NONE NONE ALL { user_ssize_t getxattr(user_addr_t path, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options); }
235 NONE NONE ALL { user_ssize_t fgetxattr(int fd, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options); }
236 NONE NONE ALL { int setxattr(user_addr_t path, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options); }
237 NONE NONE ALL { int fsetxattr(int fd, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options); }
238 NONE NONE ALL { int removexattr(user_addr_t path, user_addr_t attrname, int options); }
239 NONE NONE ALL { int fremovexattr(int fd, user_addr_t attrname, int options); }
240 NONE NONE ALL { user_ssize_t listxattr(user_addr_t path, user_addr_t namebuf, size_t bufsize, int options); }
241 NONE NONE ALL { user_ssize_t flistxattr(int fd, user_addr_t namebuf, size_t bufsize, int options); }
242 NONE KERN ALL { int fsctl(const char *path, u_long cmd, caddr_t data, u_long options); }
243 NONE KERN ALL { int initgroups(u_int gidsetsize, gid_t *gidset, int gmuid); }
244 NONE NONE ALL { int nosys(void); }
245 NONE NONE ALL { int nosys(void); }
246 NONE NONE ALL { int nosys(void); }
#if NFSCLIENT
247 NONE KERN ALL { int nfsclnt(int flag, caddr_t argp); }
248 NONE KERN ALL { int fhopen(const struct fhandle *u_fhp, int flags); }
#else
247 NONE NONE ALL { int nosys(void); }
248 NONE NONE ALL { int nosys(void); }
#endif
249 NONE NONE ALL { int nosys(void); }
250 NONE NONE ALL { int minherit(void *addr, size_t len, int inherit); }
251 NONE NONE ALL { int semsys(u_int which, int a2, int a3, int a4, int a5); }
252 NONE NONE ALL { int msgsys(u_int which, int a2, int a3, int a4, int a5); }
253 NONE NONE ALL { int shmsys(u_int which, int a2, int a3, int a4); }
254 NONE NONE ALL { int semctl(int semid, int semnum, int cmd, semun_t arg); }
255 NONE NONE ALL { int semget(key_t key, int nsems, int semflg); }
256 NONE NONE ALL { int semop(int semid, struct sembuf *sops, int nsops); }
257 NONE NONE ALL { int semconfig(semconfig_ctl_t flag); }
258 NONE NONE ALL { int msgctl(int msqid, int cmd, struct msqid_ds *buf); }
259 NONE NONE ALL { int msgget(key_t key, int msgflg); }
260 PRE NONE ALL { int msgsnd(int msqid, void *msgp, size_t msgsz, int msgflg); }
261 PRE NONE ALL { user_ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); }
262 NONE NONE ALL { int shmat(int shmid, void *shmaddr, int shmflg); }
263 NONE NONE ALL { int shmctl(int shmid, int cmd, struct shmid_ds *buf); }
264 NONE NONE ALL { int shmdt(void *shmaddr); }
265 NONE NONE ALL { int shmget(key_t key, size_t size, int shmflg); }
266 NONE NONE ALL { int shm_open(const char *name, int oflag, int mode); }
267 NONE NONE ALL { int shm_unlink(const char *name); }
268 NONE NONE ALL { user_addr_t sem_open(const char *name, int oflag, int mode, int value); }
269 NONE NONE ALL { int sem_close(sem_t *sem); }
270 NONE NONE ALL { int sem_unlink(const char *name); }
271 PRE NONE ALL { int sem_wait(sem_t *sem); }
272 NONE NONE ALL { int sem_trywait(sem_t *sem); }
273 NONE NONE ALL { int sem_post(sem_t *sem); }
274 NONE NONE ALL { int sem_getvalue(sem_t *sem, int *sval); }
275 NONE NONE ALL { int sem_init(sem_t *sem, int phsared, u_int value); }
276 NONE NONE ALL { int sem_destroy(sem_t *sem); }
277 NONE NONE ALL { int open_extended(user_addr_t path, int flags, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity); }
278 NONE KERN ALL { int umask_extended(int newmask, user_addr_t xsecurity); }
279 NONE NONE ALL { int stat_extended(user_addr_t path, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size); }
280 NONE NONE ALL { int lstat_extended(user_addr_t path, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size); }
281 NONE NONE ALL { int fstat_extended(int fd, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size); }
282 NONE NONE ALL { int chmod_extended(user_addr_t path, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity); }
283 NONE NONE ALL { int fchmod_extended(int fd, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity); }
284 NONE NONE ALL { int access_extended(user_addr_t entries, size_t size, user_addr_t results, uid_t uid); }
285 NONE NONE ALL { int settid(uid_t uid, gid_t gid); }
286 NONE NONE ALL { int gettid(uid_t *uidp, gid_t *gidp); }
287 NONE NONE ALL { int setsgroups(int setlen, user_addr_t guidset); }
288 NONE NONE ALL { int getsgroups(user_addr_t setlen, user_addr_t guidset); }
289 NONE NONE ALL { int setwgroups(int setlen, user_addr_t guidset); }
290 NONE NONE ALL { int getwgroups(user_addr_t setlen, user_addr_t guidset); }
291 NONE NONE ALL { int mkfifo_extended(user_addr_t path, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity); }
292 NONE NONE ALL { int mkdir_extended(user_addr_t path, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity); }
293 NONE NONE ALL { int identitysvc(int opcode, user_addr_t message); }
294 NONE NONE ALL { int nosys(void); }
295 NONE NONE ALL { int nosys(void); }
296 NONE KERN UALL { int load_shared_file(char *filename, caddr_t mfa, u_long mfs, caddr_t *ba, int map_cnt, sf_mapping_t *mappings, int *flags); }
297 NONE KERN UALL { int reset_shared_file(caddr_t *ba, int map_cnt, sf_mapping_t *mappings); }
298 NONE KERN ALL { int new_system_shared_regions(void); }
299 NONE KERN UALL { int shared_region_map_file_np(int fd, uint32_t mappingCount, user_addr_t mappings, user_addr_t slide_p); }
300 NONE KERN UALL { int shared_region_make_private_np(uint32_t rangeCount, user_addr_t ranges); }
301 NONE NONE ALL { int nosys(void); }
302 NONE NONE ALL { int nosys(void); }
303 NONE NONE ALL { int nosys(void); }
304 NONE NONE ALL { int nosys(void); }
305 NONE NONE ALL { int nosys(void); }
306 NONE NONE ALL { int nosys(void); }
307 NONE NONE ALL { int nosys(void); }
308 NONE NONE ALL { int nosys(void); }
309 NONE NONE ALL { int nosys(void); }
310 NONE KERN ALL { int getsid(pid_t pid); }
311 NONE NONE ALL { int settid_with_pid(pid_t pid, int assume); }
312 NONE NONE ALL { int nosys(void); }
313 NONE NONE ALL { int aio_fsync(int op, user_addr_t aiocbp); }
314 NONE NONE ALL { user_ssize_t aio_return(user_addr_t aiocbp); }
315 PRE NONE ALL { int aio_suspend(user_addr_t aiocblist, int nent, user_addr_t timeoutp); }
316 NONE NONE ALL { int aio_cancel(int fd, user_addr_t aiocbp); }
317 NONE NONE ALL { int aio_error(user_addr_t aiocbp); }
318 NONE NONE ALL { int aio_read(user_addr_t aiocbp); }
319 NONE NONE ALL { int aio_write(user_addr_t aiocbp); }
320 NONE NONE ALL { int lio_listio(int mode, user_addr_t aiocblist, int nent, user_addr_t sigp); }
321 NONE NONE ALL { int nosys(void); }
322 NONE NONE ALL { int nosys(void); }
323 NONE NONE ALL { int nosys(void); }
324 NONE NONE ALL { int mlockall(int how); }
325 NONE NONE ALL { int munlockall(int how); }
326 NONE NONE ALL { int nosys(void); }
327 NONE KERN ALL { int issetugid(void); }
328 NONE KERN ALL { int __pthread_kill(int thread_port, int sig); }
329 NONE KERN ALL { int pthread_sigmask(int how, user_addr_t set, user_addr_t oset); }
330 PRE KERN ALL { int sigwait(user_addr_t set, user_addr_t sig); }
331 NONE KERN ALL { int __disable_threadsignal(int value); }
332 NONE NONE ALL { int __pthread_markcancel(int thread_port); }
333 NONE NONE ALL { int __pthread_canceled(int action); }
334 POST NONE ALL { int __semwait_signal(int cond_sem, int mutex_sem, int timeout, int relative, time_t tv_sec, int32_t tv_nsec); }
335 NONE KERN ALL { int utrace(const void *addr, size_t len); }
336 NONE NONE ALL { int nosys(void); }
337 NONE NONE ALL { int nosys(void); }
338 NONE NONE ALL { int nosys(void); }
339 NONE NONE ALL { int nosys(void); }
340 NONE NONE ALL { int nosys(void); }
341 NONE NONE ALL { int nosys(void); }
342 NONE NONE ALL { int nosys(void); }
343 NONE NONE ALL { int nosys(void); }
344 NONE NONE ALL { int nosys(void); }
345 NONE NONE ALL { int nosys(void); }
346 NONE NONE ALL { int nosys(void); }
347 NONE NONE ALL { int nosys(void); }
348 NONE NONE ALL { int nosys(void); }
349 NONE NONE ALL { int nosys(void); }
350 NONE KERN ALL { int audit(void *record, int length); }
351 NONE KERN ALL { int auditon(int cmd, void *data, int length); }
352 NONE KERN ALL { int nosys(void); }
353 NONE KERN ALL { int getauid(au_id_t *auid); }
354 NONE KERN ALL { int setauid(au_id_t *auid); }
355 NONE KERN ALL { int getaudit(struct auditinfo *auditinfo); }
356 NONE KERN ALL { int setaudit(struct auditinfo *auditinfo); }
357 NONE KERN ALL { int getaudit_addr(struct auditinfo_addr *auditinfo_addr, int length); }
358 NONE KERN ALL { int setaudit_addr(struct auditinfo_addr *auditinfo_addr, int length); }
359 NONE KERN ALL { int auditctl(char *path); }
360 NONE NONE ALL { int nosys(void); }
361 NONE NONE ALL { int nosys(void); }
362 NONE NONE ALL { int kqueue(void); }
363 NONE NONE ALL { int kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); }
364 NONE NONE ALL { int lchown(user_addr_t path, uid_t owner, gid_t group); }
365 NONE NONE ALL { int nosys(void); }
366 NONE NONE ALL { int nosys(void); }
367 NONE NONE ALL { int nosys(void); }
368 NONE NONE ALL { int nosys(void); }
369 NONE NONE ALL { int nosys(void); }
|
|
From: Nicholas N. <nj...@cs...> - 2005-08-25 19:07:13
|
On Thu, 25 Aug 2005, Greg Parker wrote: > I've pasted the contents of syscall.master below. Ah, very nice. I wish Linux had a master syscall list like that one. N |
|
From: Greg P. <gp...@us...> - 2005-08-25 21:51:29
|
Nicholas Nethercote writes: > On Thu, 25 Aug 2005, Greg Parker wrote: > > I've pasted the contents of syscall.master below. > > Ah, very nice. I wish Linux had a master syscall list like that one. It looks like an inherited BSD-ism. Mac OS X makes up for it by having the additional Mach RPC interfaces; some of those that Valgrind will need to recognize aren't even communications with the kernel. -- Greg Parker gp...@us... |
|
From: Nicholas N. <nj...@cs...> - 2005-08-29 13:22:48
|
On Wed, 24 Aug 2005, Greg Parker wrote: I examined Valgrind's generic syscall wrappers and compared them to Darwin / Mac OS X's syscall list. > # The following groups of syscalls are mostly not generic > # and should be handled en masse: > *16 > *xattr > clock_* > mq_* > msg* > rt_sig* > sched_* > sig* > timer_* I've moved *16, clock_*, mq_* and timer_* so far. > # Unused and not generic - possibly keep in syswrap-generic.c > fcntl64 (flags are different) Should this be in the "Not generic" category below? > msgctl (no vki_msgbuf) > msgrcv (no vki_msgbuf) > msgsnd (no vki_msgbuf) I haven't done these ones yet because they're odd... on AMD64/Linux they're separate syscalls, on x86/Linux they're part of the super "socketcall" syscall. Looking more closely, they should be moved. > sched_getparam (no vki_sched_param) > sched_setparam (no vki_sched_param) > sched_setscheduler (no vki_sched_param) > utime (no vki_utimbuf) I think these, as well as the sched_* ones that don't cause compile failures, are POSIX? Perhaps they should just go in the Linux-specific part for now, and we can create a syswrap-posix.c file later if necessary. > # Not generic - probably move to OS-specific files > fgetxattr (darwin has another parameter) > flistxattr (darwin has another parameter) > fremovexattr (darwin has another parameter) > fsetxattr (darwin has another parameter) > getxattr (darwin has another parameter) > kill (darwin has another parameter) > listxattr (darwin has another parameter) > lseek (darwin's off_t is 64 bits even on 32-bit archs) > mmap (darwin's off_t is 64 bits even on 32-bit archs) > munlockall (darwin has another parameter) > pipe (darwin has different parameters and return value) > quotactl (darwin has different parameters) > removexattr (darwin has another parameter) > setxattr (darwin has another parameter) > sigpending (darwin only has one sigset_t type > sigprocmask (darwin only has one sigset_t type) > waitid (darwin has different parameters) I haven't moved these yet, but I guess I will. |
|
From: Greg P. <gp...@us...> - 2005-08-31 00:57:47
|
Nicholas Nethercote writes: > On Wed, 24 Aug 2005, Greg Parker wrote: > > sched_getparam (no vki_sched_param) > > sched_setparam (no vki_sched_param) > > sched_setscheduler (no vki_sched_param) > > utime (no vki_utimbuf) > > I think these, as well as the sched_* ones that don't cause compile > failures, are POSIX? Perhaps they should just go in the Linux-specific > part for now, and we can create a syswrap-posix.c file later if necessary. They're POSIX functions, but that doesn't mean they're syscalls. In the case of utime, Mac OS X's implementation is a libc function that calls the utimes syscall. For sched_*, Mac OS X currently implements only sched_get_priority_min(), sched_get_priority_max(), and sched_yield(), none of which are syscalls. The rest of POSIX sched.h is not supported. Mac OS X does in fact have structs sched_param and utimbuf; I missed them in my first search. It might make sense to leave POSIX wrappers in syswrap-generic, perhaps protected by guards like `#if defined(__NR_utime)`. For now, it's probably best to move them to Linux-specific files, and wait to see what's needed by other interesting platforms like FreeBSD. -- Greg Parker gp...@us... |
|
From: Nicholas N. <nj...@cs...> - 2005-08-31 02:59:13
|
Hi, I'm pretty much done with moving syscalls from "generic" to "linux". On Wed, 24 Aug 2005, Greg Parker wrote: > The wrappers are divided into four classes: > * Truly generic. I've left these untouched. > * Unused on Darwin but generic. There is no Darwin syscall that > will use this wrapper, but the wrapper compiles without error. > These should stay in syswrap-generic.c if they are useful for > FreeBSD or Solaris or something. I've left these untouched except for rt_sig* and those that were part of a group which had some members in the below categories (mq_unlink, *xattr, sched_*, get*id16). > * Unused on Darwin and not generic. There is no Darwin syscall > that will use this wrapper, and the wrapper does not compile. > Usually these fail because of a Linux-specific type that is > missing. These could move to syswrap-linux.c, or they could > stay in syswrap-generic.c and Darwin could provide dummy vki > definitions for the types. I've moved all these except for: fcntl64 (flags are different) Which flags are different? If it's a small number we could get away with #ifdefs... there are already some in this wrapper. > * Not generic. Darwin has a syscall that is similar to Linux, > but the wrapper implementations will differ. Usually these > fail because the syscall parameter lists are different. I've moved all these except: kill (darwin has another parameter) AFAICT kill's parameters are the same for Darwin and Linux. Nick |
|
From: Greg P. <gp...@us...> - 2005-08-31 19:23:35
|
Nicholas Nethercote writes:
> fcntl64 (flags are different)
>
> Which flags are different? If it's a small number we could get away with
> #ifdefs... there are already some in this wrapper.
Flags used by fcntl64 that Darwin doesn't have:
F_GETSIG
F_SETSIG
F_GETLEASE
F_SETLEASE
F_NOTIFY
F_GETLK64
F_SETLK64
F_SETLKW64
I'd like to see fcntl and ioctl provide support for generic flags
plus a hook for platform-specific flags, something like this:
PRE(sys_fcntl)
{
switch (ARG2) {
case VKI_F_GETFD: ...
case VKI_F_GETFL: ...
// .. other generic flags here ...
default:
platform_specific_pre_fcntl(ARG1, ARG2, ARG3);
}
}
> kill (darwin has another parameter)
>
> AFAICT kill's parameters are the same for Darwin and Linux.
You're right, it's the same.
--
Greg Parker gp...@us...
|