From: Sascha Wildner Date: Fri, 20 Feb 2015 13:41:13 +0000 (+0100) Subject: Remove the old libsys code which was never hooked in in 10 years. X-Git-Tag: v4.2.0rc~782^2~5 X-Git-Url: https://gitweb.dragonflybsd.org/~tuxillo/dragonfly.git/commitdiff_plain/55e5e159c4d7c60f779ae3d86b8544148eba0c6b Remove the old libsys code which was never hooked in in 10 years. Approved-by: dillon --- diff --git a/lib/libsys/README b/lib/libsys/README deleted file mode 100644 index 22d3b05673..0000000000 --- a/lib/libsys/README +++ /dev/null @@ -1,81 +0,0 @@ -$DragonFly: src/lib/libsys/README,v 1.1 2005/05/08 18:14:52 dillon Exp $ - - System Call Interfacing Layer - - This library implements a system call interfacing layer between - userland and the kernel. Because we intend to support multiple - combinations of user and kernel ABIs we do not try to tie this - layer directly to the kernel. - - This layer, not the master syscall list in the kernel, defines the - ABI between userland and the kernel for all DragonFly releases. - - Although we call this a 'library' the actual library linked into - programs (statically or dynamically) is really just a stub section - that the kernel and/or ld-elf will replace by mmap()ing both the actual - jump table and also mmap()ing the interface layer itself. The actual - interface layer is a static-linked image that is directly mmap()'d. - - The initial implementation of this layer contains no relocation - sections at all. No global variables or subroutine calls.. just - the functions representing the system calls themselves. - - System Call Specifications - - The syscall specifications file is very similar to e.g. syscalls.master, - except it does not contain any legacy 'compatibility' system calls, only - contemporary calls. The other primary difference is that ALL - structures contain a version suffix indicating the dragonfly version - where the last change to the structure was made. These versioned - system interfacing structures are declared in parseable ABI header - files. - - It should be noted that we do NOT attempt to obtain structural data - from system header files. To ensure that the ABI is "set in stone", - so to speak, all system interfacing structures are duplicated in the - ABI headers. The types are NOT NECESSARILY DUPLICATED EXACTLY, and - in fact we use types like e.g. 'generic32_t' to specifically indicate - that we only care about the data as pure storage, not as a type, but - the size of the types is properly retained. - - System Call Configuration File - - This is a work in progress. Here is the grammer so far: - - file: - directive* - - directive: - BASE symbol ";" - ADD integer { control* } - INCLUDE string ";" - - control: - FUNCTION type_id "(" type_id [ "," type_id ]* ")" ";" - IMPLEMENTATION DIRECT ";" - - Basically this will control syscall generation for any version of - DragonFly. The configuration file for later releases simply overriides - earlier releases. There will be a method to specify a direct system - call (i.e. if the program is fully compatible with the kernel), system - calls where programmatic structutral adjustments are required (e.g. - if the 'stat' structure changes), and fully custom conversions where - the shim calls a separate userspace function to perform a more complex - system call conversion. - - The kernel will load the map file representing the conversion from - the userland-specified ABI to the kernel ABI. For example, if - userland is running, say, 1.2.0, and the kernel is running 1.3, - the mapping file will be something like: - - "dragonfly_map_syscalls_1_2_0-1_3.map" - - The idea is that *all* one then needs to run an older binary on a newer - machine, or a newer binary on an older machine, is the correct .map file, - and the system will refuse to run the program if it can't find it. - - The 'native' mapping file, i.e. 1.2.0 running on a 1.2.0 system, - would be built into the kernel directly, so e.g. static binaries - would always be supported even if the map file directory doesn't - exist. - diff --git a/lib/libsys/abi/basetypes.h b/lib/libsys/abi/basetypes.h deleted file mode 100644 index 59a954947d..0000000000 --- a/lib/libsys/abi/basetypes.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * BASETYPES.H - * - * Implements all non-structural types specified in syscall configuration - * files. - * - * $DragonFly: src/lib/libsys/abi/basetypes.h,v 1.1 2005/05/08 18:14:54 dillon Exp $ - */ -typedef int8_t generic_8_t; -typedef int16_t generic_16_t; -typedef int32_t generic_32_t; -typedef int64_t generic_64_t; - -typedef char *char_ptr; -typedef int *int_ptr; - -typedef const char *const_char_ptr; diff --git a/lib/libsys/abi/syscalls_1_2_0.conf b/lib/libsys/abi/syscalls_1_2_0.conf deleted file mode 100644 index 6647499ef8..0000000000 --- a/lib/libsys/abi/syscalls_1_2_0.conf +++ /dev/null @@ -1,1373 +0,0 @@ -# System calls starting at 1.2.0-release. -# -# $DragonFly: src/lib/libsys/abi/syscalls_1_2_0.conf,v 1.1 2005/05/08 18:14:54 dillon Exp $ - -BASE map_syscalls_1_2_0; - -ADD 0 { - function int nosys(void); - implementation direct; -} - -ADD 1 { - function void sys_exit(int rval); - implementation direct; -} - -ADD 2 { - function int fork(void); - implementation direct; -} - -ADD 3 { - function ssize_t read(int fd, void_ptr buf, size_t nbyte); - implementation direct; -} - -ADD 4 { - function ssize_t write(int fd, const_void_ptr buf, size_t nbyte); - implementation direct; -} - -ADD 5 { - function int open(char_ptr path, int flags, int mode); - implementation direct; -} - -ADD 6 { - function int close(int fd); - implementation direct; -} - -ADD 7 { - function int wait4(int pid, int_ptr status, int options, - rusage_1_2_0_ptr rusage); - implementation direct; -} - -ADD 9 { - function int link(char_ptr path, char_ptr link); - implementation direct; -} - -ADD 10 { - function int unlink(char_ptr path); - implementation direct; -} - -ADD 12 { - function int chdir(char_ptr path); - implementation direct; -} - -ADD 13 { - function int fchdir(int fd); - implementation direct; -} - -ADD 14 { - function int mknod(char_ptr path, int mode, int dev); - implementation direct; -} - -ADD 15 { - function int chmod(char_ptr path, int mode); - implementation direct; -} - -ADD 16 { - function int chown(char_ptr path, int uid, int gid); - implementation direct; -} - -ADD 17 { - function int obreak(char_ptr nsize); - implementation direct; -} - -ADD 18 { - function int getfsstat(statfs_1_2_0_ptr buf, long bufsize, - int flags); - implementation direct; -} - -ADD 20 { - function pid_t getpid(void); - implementation direct; -} - -ADD 21 { - function int mount(char_ptr type, char_ptr path, int flags, - caddr_t data); - implementation direct; -} - -ADD 22 { - function int unmount(char_ptr path, int flags); - implementation direct; -} - -ADD 23 { - function int setuid(uid_t uid); - implementation direct; -} - -ADD 24 { - function uid_t getuid(void); - implementation direct; -} - -ADD 25 { - function uid_t geteuid(void); - implementation direct; -} - -ADD 26 { - function int ptrace(int req, pid_t pid, caddr_t addr, - int data); - implementation direct; -} - -ADD 27 { - function int recvmsg(int s, msghdr_1_2_0_ptr msg, int flags); - implementation direct; -} - -ADD 28 { - function int sendmsg(int s, caddr_t msg, int flags); - implementation direct; -} - -ADD 29 { - function int recvfrom(int s, caddr_t buf, size_t len, - int flags, caddr_t from, int_ptr fromlenaddr); - implementation direct; -} - -ADD 30 { - function int accept(int s, caddr_t name, int_ptr anamelen); - implementation direct; -} - -ADD 31 { - function int getpeername(int fdes, caddr_t asa, int_ptr alen); - implementation direct; -} - -ADD 32 { - function int getsockname(int fdes, caddr_t asa, int_ptr alen); - implementation direct; -} - -ADD 33 { - function int access(char_ptr path, int flags); - implementation direct; -} - -ADD 34 { - function int chflags(char_ptr path, int flags); - implementation direct; -} - -ADD 35 { - function int fchflags(int fd, int flags); - implementation direct; -} - -ADD 36 { - function int sync(void); - implementation direct; -} - -ADD 37 { - function int kill(int pid, int signum); - implementation direct; -} - -ADD 39 { - function pid_t getppid(void); - implementation direct; -} - -ADD 41 { - function int dup(u_int fd); - implementation direct; -} - -ADD 42 { - function int pipe(void); - implementation direct; -} - -ADD 43 { - function gid_t getegid(void); - implementation direct; -} - -ADD 44 { - function int profil(caddr_t samples, size_t size, - size_t offset, u_int scale); - implementation direct; -} - -ADD 45 { - function int ktrace(const_char_ptr fname, int ops, int facs, int pid); - implementation direct; -} - -ADD 47 { - function gid_t getgid(void); - implementation direct; -} - -ADD 49 { - function int getlogin(char_ptr namebuf, u_int namelen); - implementation direct; -} - -ADD 50 { - function int setlogin(char_ptr namebuf); - implementation direct; -} - -ADD 51 { - function int acct(char_ptr path); - implementation direct; -} - -ADD 53 { - function int sigaltstack(stack_t_ptr ss, stack_t_ptr oss); - implementation direct; -} - -ADD 54 { - function int ioctl(int fd, u_long com, caddr_t data); - implementation direct; -} - -ADD 55 { - function int reboot(int opt); - implementation direct; -} - -ADD 56 { - function int revoke(char_ptr path); - implementation direct; -} - -ADD 57 { - function int symlink(char_ptr path, char_ptr link); - implementation direct; -} - -ADD 58 { - function int readlink(char_ptr path, char_ptr buf, int count); - implementation direct; -} - -ADD 59 { - function int execve(char_ptr fname, char_ptr_ptr argv, char_ptr_ptr envv); - implementation direct; -} - -ADD 60 { - function int umask(int newmask); - implementation direct; -} - -ADD 61 { - function int chroot(char_ptr path); - implementation direct; -} - -ADD 65 { - function int msync(void_ptr addr, size_t len, int flags); - implementation direct; -} - -ADD 66 { - function int vfork(void); - implementation direct; -} - -ADD 69 { - function int sbrk(int incr); - implementation direct; -} - -ADD 70 { - function int sstk(int incr); - implementation direct; -} - -ADD 72 { - function int ovadvise(int anom); - implementation direct; -} - -ADD 73 { - function int munmap(void_ptr addr, size_t len); - implementation direct; -} - -ADD 74 { - function int mprotect(const_void_ptr addr, size_t len, int prot); - implementation direct; -} - -ADD 75 { - function int madvise(void_ptr addr, size_t len, int behav); - implementation direct; -} - -ADD 78 { - function int mincore(const_void_ptr addr, size_t len, char_ptr vec); - implementation direct; -} - -ADD 79 { - function int getgroups(u_int gidsetsize, gid_t_ptr gidset); - implementation direct; -} - -ADD 80 { - function int setgroups(u_int gidsetsize, gid_t_ptr gidset); - implementation direct; -} - -ADD 81 { - function int getpgrp(void); - implementation direct; -} - -ADD 82 { - function int setpgid(int pid, int pgid); - implementation direct; -} - -ADD 83 { - function int setitimer(u_int which, itimerval_1_2_0_ptr itv, - itimerval_1_2_0_ptr oitv); - implementation direct; -} - -ADD 85 { - function int swapon(char_ptr name); - implementation direct; -} - -ADD 86 { - function int getitimer(u_int which, itimerval_1_2_0_ptr itv); - implementation direct; -} - -ADD 89 { - function int getdtablesize(void); - implementation direct; -} - -ADD 90 { - function int dup2(u_int from, u_int to); - implementation direct; -} - -ADD 92 { - function int fcntl(int fd, int cmd, long arg); - implementation direct; -} - -ADD 93 { - function int select(int nd, fd_set_ptr in, fd_set_ptr ou, - fd_set_ptr ex, timeval_1_2_0_ptr tv); - implementation direct; -} - -ADD 95 { - function int fsync(int fd); - implementation direct; -} - -ADD 96 { - function int setpriority(int which, int who, int prio); - implementation direct; -} - -ADD 97 { - function int socket(int domain, int type, int protocol); - implementation direct; -} - -ADD 98 { - function int connect(int s, caddr_t name, int namelen); - implementation direct; -} - -ADD 99 { - function int accept(int s, caddr_t name, int_ptr anamelen); - implementation direct; -} - -ADD 100 { - function int getpriority(int which, int who); - implementation direct; -} - -ADD 104 { - function int bind(int s, caddr_t name, int namelen); - implementation direct; -} - -ADD 105 { - function int setsockopt(int s, int level, int name, - caddr_t val, int valsize); - implementation direct; -} - -ADD 106 { - function int listen(int s, int backlog); - implementation direct; -} - -ADD 116 { - function int gettimeofday(timeval_1_2_0_ptr tp, timezone_1_2_0_ptr tzp); - implementation direct; -} - -ADD 117 { - function int getrusage(int who, rusage_1_2_0_ptr rusage); - implementation direct; -} - -ADD 118 { - function int getsockopt(int s, int level, int name, - caddr_t val, int_ptr avalsize); - implementation direct; -} - -ADD 120 { - function int readv(int fd, iovec_1_2_0_ptr iovp, u_int iovcnt); - implementation direct; -} - -ADD 121 { - function int writev(int fd, iovec_1_2_0_ptr iovp, u_int iovcnt); - implementation direct; -} - -ADD 122 { - function int settimeofday(timeval_1_2_0_ptr tv, timezone_1_2_0_ptr tzp); - implementation direct; -} - -ADD 123 { - function int fchown(int fd, int uid, int gid); - implementation direct; -} - -ADD 124 { - function int fchmod(int fd, int mode); - implementation direct; -} - -ADD 125 { - function int recvfrom(int s, caddr_t buf, size_t len, - int flags, caddr_t from, int_ptr fromlenaddr); - implementation direct; -} - -ADD 126 { - function int setreuid(int ruid, int euid); - implementation direct; -} - -ADD 127 { - function int setregid(int rgid, int egid); - implementation direct; -} - -ADD 128 { - function int rename(char_ptr from, char_ptr to); - implementation direct; -} - -ADD 131 { - function int flock(int fd, int how); - implementation direct; -} - -ADD 132 { - function int mkfifo(char_ptr path, int mode); - implementation direct; -} - -ADD 133 { - function int sendto(int s, caddr_t buf, size_t len, - int flags, caddr_t to, int tolen); - implementation direct; -} - -ADD 134 { - function int shutdown(int s, int how); - implementation direct; -} - -ADD 135 { - function int socketpair(int domain, int type, int protocol, int_ptr rsv); - implementation direct; -} - -ADD 136 { - function int mkdir(char_ptr path, int mode); - implementation direct; -} - -ADD 137 { - function int rmdir(char_ptr path); - implementation direct; -} - -ADD 138 { - function int utimes(char_ptr path, timeval_1_2_0_ptr tptr); - implementation direct; -} - -ADD 140 { - function int adjtime(timeval_1_2_0_ptr delta, timeval_1_2_0_ptr olddelta); - implementation direct; -} - -ADD 147 { - function int setsid(void); - implementation direct; -} - -ADD 148 { - function int quotactl(char_ptr path, int cmd, int uid, caddr_t arg); - implementation direct; -} - -ADD 150 { - function int getsockname(int fdec, caddr_t asa, int_ptr alen); - implementation direct; -} - -ADD 155 { - function int nfssvc(int flag, caddr_t argp); - implementation direct; -} - -ADD 157 { - function int statfs(char_ptr path, statfs_1_2_0_ptr buf); - implementation direct; -} - -ADD 158 { - function int fstatfs(int fd, statfs_1_2_0_ptr buf); - implementation direct; -} - -ADD 161 { - function int getfh(char_ptr fname, fhandle_1_2_0_ptr fhp); - implementation direct; -} - -ADD 162 { - function int getdomainname(char_ptr domainname, int len); - implementation direct; -} - -ADD 163 { - function int setdomainname(char_ptr domainname, int len); - implementation direct; -} - -ADD 164 { - function int uname(utsname_1_2_0_ptr name); - implementation direct; -} - -ADD 165 { - function int sysarch(int op, char_ptr parms); - implementation direct; -} - -ADD 166 { - function int rtprio(int function, pid_t pid, rtprio_1_2_0_ptr rtp); - implementation direct; -} - -ADD 169 { - function int semsys(int which, int a2, int a3, int a4, int a5); - implementation direct; -} - -ADD 170 { - function int msgsys(int which, int a2, int a3, int a4, int a5, int a6); - implementation direct; -} - -ADD 171 { - function int shmsys(int which, int a2, int a3, int a4); - implementation direct; -} - -ADD 173 { - function ssize_t pread(int fd, void_ptr buf, size_t nbyte, - int pad, off_t offset); - implementation direct; -} - -ADD 174 { - function ssize_t pwrite(int fd, const_void_ptr buf, - size_t nbyte, int pad, off_t offset); - implementation direct; -} - -ADD 176 { - function int ntp_adjtime(timex_1_2_0_ptr tp); - implementation direct; -} - -ADD 181 { - function int setgid(gid_t gid); - implementation direct; -} - -ADD 182 { - function int setegid(gid_t egid); - implementation direct; -} - -ADD 183 { - function int seteuid(uid_t euid); - implementation direct; -} - -ADD 188 { - function int stat(char_ptr path, stat_1_2_0_ptr ub); - implementation direct; -} - -ADD 189 { - function int fstat(int fd, stat_1_2_0_ptr sb); - implementation direct; -} - -ADD 190 { - function int lstat(char_ptr path, stat_1_2_0_ptr ub); - implementation direct; -} - -ADD 191 { - function int pathconf(char_ptr path, int name); - implementation direct; -} - -ADD 192 { - function int fpathconf(int fd, int name); - implementation direct; -} - -ADD 194 { - function int getrlimit(u_int which, rlimit_1_2_0_ptr rlp); - implementation direct; -} - -ADD 195 { - function int setrlimit(u_int which, rlimit_1_2_0_ptr rlp); - implementation direct; -} - -ADD 196 { - function int getdirentries(int fd, char_ptr buf, u_int count, long_ptr basep); - implementation direct; -} - -ADD 197 { - function caddr_t mmap(caddr_t addr, size_t len, int prot, - int flags, int fd, int pad, off_t pos); - implementation direct; -} - -ADD 198 { - function int nosys(void); - implementation direct; -} - -ADD 199 { - function off_t lseek(int fd, int pad, off_t offset, int whence); - implementation direct; -} - -ADD 200 { - function int truncate(char_ptr path, int pad, off_t length); - implementation direct; -} - -ADD 201 { - function int ftruncate(int fd, int pad, off_t length); - implementation direct; -} - -ADD 202 { - function int __sysctl(int_ptr name, u_int namelen, void_ptr old, - size_t_ptr oldlenp, void_ptr new, size_t newlen); - implementation direct; -} - -ADD 203 { - function int mlock(const_void_ptr addr, size_t len); - implementation direct; -} - -ADD 204 { - function int munlock(const_void_ptr addr, size_t len); - implementation direct; -} - -ADD 205 { - function int undelete(char_ptr path); - implementation direct; -} - -ADD 206 { - function int futimes(int fd, timeval_1_2_0_ptr tptr); - implementation direct; -} - -ADD 207 { - function int getpgid(pid_t pid); - implementation direct; -} - -ADD 209 { - function int poll(pollfd_1_2_0_ptr fds, u_int nfds, int timeout); - implementation direct; -} - -ADD 220 { - function int __semctl(int semid, int semnum, int cmd, semun_ptr arg); - implementation direct; -} - -ADD 221 { - function int semget(key_t key, int nsems, int semflg); - implementation direct; -} - -ADD 222 { - function int semop(int semid, sembuf_1_2_0_ptr sops, u_int nsops); - implementation direct; -} - -ADD 224 { - function int msgctl(int msqid, int cmd, msqid_ds_1_2_0_ptr buf); - implementation direct; -} - -ADD 225 { - function int msgget(key_t key, int msgflg); - implementation direct; -} - -ADD 226 { - function int msgsnd(int msqid, void_ptr msgp, size_t msgsz, int msgflg); - implementation direct; -} - -ADD 227 { - function int msgrcv(int msqid, void_ptr msgp, size_t msgsz, - long msgtyp, int msgflg); - implementation direct; -} - -ADD 228 { - function int shmat(int shmid, void_ptr shmaddr, int shmflg); - implementation direct; -} - -ADD 229 { - function int shmctl(int shmid, int cmd, shmid_ds_1_2_0_ptr buf); - implementation direct; -} - -ADD 230 { - function int shmdt(void_ptr shmaddr); - implementation direct; -} - -ADD 231 { - function int shmget(key_t key, int size, int shmflg); - implementation direct; -} - -ADD 232 { - function int clock_gettime(clockid_t clock_id, timespec_1_2_0_ptr tp); - implementation direct; -} - -ADD 233 { - function int clock_settime(clockid_t clock_id, - const_timespec_1_2_0_ptr tp); - implementation direct; -} - -ADD 234 { - function int clock_getres(clockid_t clock_id, timespec_1_2_0_ptr tp); - implementation direct; -} - -ADD 240 { - function int nanosleep(const_timespec_1_2_0_ptr rqtp, - timespec_1_2_0_ptr rmtp); - implementation direct; -} - -ADD 250 { - function int minherit(void_ptr addr, size_t len, int inherit); - implementation direct; -} - -ADD 251 { - function int rfork(int flags); - implementation direct; -} - -ADD 252 { - function int openbsd_poll(pollfd_1_2_0_ptr fds, u_int nfds, int timeout); - implementation direct; -} - -ADD 253 { - function int issetugid(void); - implementation direct; -} - -ADD 254 { - function int lchown(char_ptr path, int uid, int gid); - implementation direct; -} - -ADD 272 { - function int getdents(int fd, char_ptr buf, size_t count); - implementation direct; -} - -ADD 274 { - function int lchmod(char_ptr path, mode_t mode); - implementation direct; -} - -ADD 275 { - function int lchown(char_ptr path, uid_t uid, gid_t gid); - implementation direct; -} - -ADD 276 { - function int lutimes(char_ptr path, timeval_1_2_0_ptr tptr); - implementation direct; -} - -ADD 277 { - function int msync(void_ptr addr, size_t len, int flags); - implementation direct; -} - -ADD 278 { - function int nstat(char_ptr path, nstat_1_2_0_ptr ub); - implementation direct; -} - -ADD 279 { - function int nfstat(int fd, nstat_1_2_0_ptr sb); - implementation direct; -} - -ADD 280 { - function int nlstat(char_ptr path, nstat_1_2_0_ptr ub); - implementation direct; -} - -ADD 297 { - function int fhstatfs(const_fhandle_1_2_0_ptr u_fhp, - statfs_1_2_0_ptr buf); - implementation direct; -} - -ADD 298 { - function int fhopen(const_fhandle_1_2_0_ptr u_fhp, int flags); - implementation direct; -} - -ADD 299 { - function int fhstat(const_fhandle_1_2_0_ptr u_fhp, stat_1_2_0_ptr sb); - implementation direct; -} - -ADD 300 { - function int modnext(int modid); - implementation direct; -} - -ADD 301 { - function int modstat(int modid, module_stat_1_2_0_ptr stat); - implementation direct; -} - -ADD 302 { - function int modfnext(int modid); - implementation direct; -} - -ADD 303 { - function int modfind(const_char_ptr name); - implementation direct; -} - -ADD 304 { - function int kldload(const_char_ptr file); - implementation direct; -} - -ADD 305 { - function int kldunload(int fileid); - implementation direct; -} - -ADD 306 { - function int kldfind(const_char_ptr file); - implementation direct; -} - -ADD 307 { - function int kldnext(int fileid); - implementation direct; -} - -ADD 308 { - function int kldstat(int fileid, kld_file_stat_1_2_0_ptr stat); - implementation direct; -} - -ADD 309 { - function int kldfirstmod(int fileid); - implementation direct; -} - -ADD 310 { - function int getsid(pid_t pid); - implementation direct; -} - -ADD 311 { - function int setresuid(uid_t ruid, uid_t euid, uid_t suid); - implementation direct; -} - -ADD 312 { - function int setresgid(gid_t rgid, gid_t egid, gid_t sgid); - implementation direct; -} - -ADD 314 { - function int aio_return(aiocb_1_2_0_ptr aiocbp); - implementation direct; -} - -ADD 315 { - function int aio_suspend(aiocb_1_2_0_ptr_const_ptr aiocbp, int nent, - const_timespec_1_2_0_ptr timeout); - implementation direct; -} - -ADD 316 { - function int aio_cancel(int fd, aiocb_1_2_0_ptr aiocbp); - implementation direct; -} - -ADD 317 { - function int aio_error(aiocb_1_2_0_ptr aiocbp); - implementation direct; -} - -ADD 318 { - function int aio_read(aiocb_1_2_0_ptr aiocbp); - implementation direct; -} - -ADD 319 { - function int aio_write(aiocb_1_2_0_ptr aiocbp); - implementation direct; -} - -ADD 320 { - function int lio_listio(int mode, aiocb_1_2_0_ptr_const_ptr acb_list, - int nent, sigevent_1_2_0_ptr sig); - implementation direct; -} - -ADD 321 { - function int yield(void); - implementation direct; -} - -ADD 322 { - function int thr_sleep(const_timespec_1_2_0_ptr timeout); - implementation direct; -} - -ADD 323 { - function int thr_wakeup(pid_t pid); - implementation direct; -} - -ADD 324 { - function int mlockall(int how); - implementation direct; -} - -ADD 325 { - function int munlockall(void); - implementation direct; -} - -ADD 326 { - function int __getcwd(u_char_ptr buf, u_int buflen); - implementation direct; -} - -ADD 327 { - function int sched_setparam (pid_t pid, - const_sched_param_1_2_0_ptr param); - implementation direct; -} - -ADD 328 { - function int sched_getparam (pid_t pid, sched_param_1_2_0_ptr param); - implementation direct; -} - -ADD 329 { - function int sched_setscheduler (pid_t pid, int policy, - const_sched_param_1_2_0_ptr param); - implementation direct; -} - -ADD 330 { - function int sched_getscheduler (pid_t pid); - implementation direct; -} - -ADD 331 { - function int sched_yield (void); - implementation direct; -} - -ADD 332 { - function int sched_get_priority_max (int policy); - implementation direct; -} - -ADD 333 { - function int sched_get_priority_min (int policy); - implementation direct; -} - -ADD 334 { - function int sched_rr_get_interval (pid_t pid, - timespec_1_2_0_ptr interval); - implementation direct; -} - -ADD 335 { - function int utrace(const_void_ptr addr, size_t len); - implementation direct; -} - -ADD 337 { - function int kldsym(int fileid, int cmd, void_ptr data); - implementation direct; -} - -ADD 338 { - function int jail(jail_1_2_0_ptr jail); - implementation direct; -} - -ADD 340 { - function int sigprocmask(int how, const_sigset_t_ptr set, sigset_t_ptr oset); - implementation direct; -} - -ADD 341 { - function int sigsuspend(const_sigset_t_ptr sigmask); - implementation direct; -} - -ADD 342 { - function int sigaction(int sig, const_sigaction_1_2_0_ptr act, - sigaction_1_2_0_ptr oact); - implementation direct; -} - -ADD 343 { - function int sigpending(sigset_t_ptr set); - implementation direct; -} - -ADD 344 { - function int sigreturn(ucontext_t_ptr sigcntxp); - implementation direct; -} - -ADD 345 { - function int sigtimedwait(const_sigset_t_ptr set, siginfo_t_ptr info, - const_timespec_1_2_0_ptr timeout); - implementation direct; -} - -ADD 346 { - function int sigwaitinfo(const_sigset_t_ptr set, siginfo_t_ptr info); - implementation direct; -} - -ADD 347 { - function int __acl_get_file(const_char_ptr path, acl_type_t type, - acl_1_2_0_ptr aclp); - implementation direct; -} - -ADD 348 { - function int __acl_set_file(const_char_ptr path, acl_type_t type, - acl_1_2_0_ptr aclp); - implementation direct; -} - -ADD 349 { - function int __acl_get_fd(int filedes, acl_type_t type, - acl_1_2_0_ptr aclp); - implementation direct; -} - -ADD 350 { - function int __acl_set_fd(int filedes, acl_type_t type, - acl_1_2_0_ptr aclp); - implementation direct; -} - -ADD 351 { - function int __acl_delete_file(const_char_ptr path, acl_type_t type); - implementation direct; -} - -ADD 352 { - function int __acl_delete_fd(int filedes, acl_type_t type); - implementation direct; -} - -ADD 353 { - function int __acl_aclcheck_file(const_char_ptr path, acl_type_t type, - acl_1_2_0_ptr aclp); - implementation direct; -} - -ADD 354 { - function int __acl_aclcheck_fd(int filedes, acl_type_t type, - acl_1_2_0_ptr aclp); - implementation direct; -} - -ADD 355 { - function int extattrctl(const_char_ptr path, int cmd, - const_char_ptr attrname, char_ptr arg); - implementation direct; -} - -ADD 356 { - function int extattr_set_file(const_char_ptr path, const_char_ptr attrname, - iovec_1_2_0_ptr iovp, unsigned iovcnt); - implementation direct; -} - -ADD 357 { - function int extattr_get_file(const_char_ptr path, const_char_ptr attrname, - iovec_1_2_0_ptr iovp, unsigned iovcnt); - implementation direct; -} - -ADD 358 { - function int extattr_delete_file(const_char_ptr path, const_char_ptr attrname); - implementation direct; -} - -ADD 359 { - function int aio_waitcomplete(aiocb_1_2_0_ptr_ptr aiocbp, - timespec_1_2_0_ptr timeout); - implementation direct; -} - -ADD 360 { - function int getresuid(uid_t_ptr ruid, uid_t_ptr euid, uid_t_ptr suid); - implementation direct; -} - -ADD 361 { - function int getresgid(gid_t_ptr rgid, gid_t_ptr egid, gid_t_ptr sgid); - implementation direct; -} - -ADD 362 { - function int kqueue(void); - implementation direct; -} - -ADD 363 { - function int kevent(int fd, - const_kevent_1_2_0_ptr changelist, int nchanges, - kevent_1_2_0_ptr eventlist, int nevents, - const_timespec_1_2_0_ptr timeout); - - implementation direct; -} - -ADD 393 { - function int sendfile(int fd, int s, off_t offset, size_t nbytes, - sf_hdtr_1_2_0_ptr hdtr, off_t_ptr sbytes, int flags); - implementation direct; -} - -ADD 450 { - function int varsym_set(int level, const_char_ptr name, const_char_ptr data); - implementation direct; -} - -ADD 451 { - function int varsym_get(int mask, const_char_ptr wild, char_ptr buf, int bufsize); - implementation direct; -} - -ADD 452 { - function int varsym_list(int level, char_ptr buf, int maxsize, int_ptr marker); - implementation direct; -} - -ADD 453 { - function int upc_register(upcall_1_2_0_ptr upc, void_ptr ctxfunc, - void_ptr func, void_ptr data); - implementation direct; -} - -ADD 454 { - function int upc_control(int cmd, int upcid, void_ptr data); - implementation direct; -} - -ADD 455 { - function int caps_sys_service(const_char_ptr name, uid_t uid, gid_t gid, int upcid, int flags); - implementation direct; -} - -ADD 456 { - function int caps_sys_client(const_char_ptr name, uid_t uid, gid_t gid, int upcid, int flags); - implementation direct; -} - -ADD 457 { - function int caps_sys_close(int portid); - implementation direct; -} - -ADD 458 { - function off_t caps_sys_put(int portid, void_ptr msg, int msgsize); - implementation direct; -} - -ADD 459 { - function int caps_sys_reply(int portid, void_ptr msg, int msgsize, off_t msgcid); - implementation direct; -} - -ADD 460 { - function int caps_sys_get(int portid, void_ptr msg, int maxsize, - caps_msgid_1_2_0_ptr msgid, - caps_cred_1_2_0_ptr ccr); - implementation direct; -} - -ADD 461 { - function int caps_sys_wait(int portid, void_ptr msg, int maxsize, - caps_msgid_1_2_0_ptr msgid, - caps_cred_1_2_0_ptr ccr); - implementation direct; -} - -ADD 462 { - function int caps_sys_abort(int portid, off_t msgcid, int flags); - implementation direct; -} - -ADD 463 { - function off_t caps_sys_getgen(int portid); - implementation direct; -} - -ADD 464 { - function int caps_sys_setgen(int portid, off_t gen); - implementation direct; -} - -ADD 465 { - function int exec_sys_register(void_ptr entry); - implementation direct; -} - -ADD 466 { - function int exec_sys_unregister(int id); - implementation direct; -} - -ADD 467 { - function int sys_checkpoint(int type, int fd, pid_t pid, int retval); - implementation direct; -} - -ADD 468 { - function int mountctl(const_char_ptr path, int op, int fd, - const_void_ptr ctl, int ctllen, void_ptr buf, - int buflen); - implementation direct; -} - -ADD 469 { - function int umtx_sleep(volatile_const_int_ptr ptr, int value, - int timeout); - implementation direct; -} - -ADD 470 { - function int umtx_wakeup(volatile_const_int_ptr ptr, int count); - implementation direct; -} - -ADD 471 { - function int jail_attach(int jid); - implementation direct; -} - -ADD 472 { - function int sys_set_tls_area(int which, tls_info_1_2_0_ptr info, - size_t infosize); - implementation direct; -} - -ADD 473 { - function int sys_get_tls_area(int which, tls_info_1_2_0_ptr info, - size_t infosize); - implementation direct; -} - -ADD 474 { - function int closefrom(int fd); - implementation direct; -} - diff --git a/lib/libsys/abi/types_1_2_0.h b/lib/libsys/abi/types_1_2_0.h deleted file mode 100644 index 31d2364f76..0000000000 --- a/lib/libsys/abi/types_1_2_0.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * TYPES_1_2_0.H - * - * This header file contains types specific to the 1.2.0 DragonFly release. - * - * WARNING! This header file is parsed by a program to automatically - * generate compatibility conversions. Only internal type names may be - * used. e.g. 'char_ptr_t' instead of 'char *'. - * - * $DragonFly: src/lib/libsys/abi/types_1_2_0.h,v 1.1 2005/05/08 18:14:54 dillon Exp $ - */ - -struct rusage_1_2_0 { -}; - -struct statfs_1_2_0 { -}; - -struct msghdr_1_2_0 { -}; - -struct itimerval_1_2_0 { -}; - -struct timeval_1_2_0 { -}; - -struct sigvec_1_2_0 { -}; - -struct sigstack_1_2_0 { -}; - -struct timezone_1_2_0 { -}; - -struct iovec_1_2_0 { -}; - -struct statfs_1_2_0 { -}; - -struct fhandle_1_2_0 { -}; - -struct utsname_1_2_0 { -}; - -struct rtprio_1_2_0 { -}; - -struct timex_1_2_0 { -}; - -struct stat_1_2_0 { -}; - -struct pollfs_1_2_0 { -}; - -struct sembuf_1_2_0 { -}; - -struct msqid_ds_1_2_0 { -}; - -struct shmid_ds_1_2_0 { -}; - -struct timespec_1_2_0 { -}; - -struct module_stat_1_2_0 { -}; - -struct kld_file_1_2_0 { -}; - -struct aiocb_1_2_0 { -}; - -struct sigevent_1_2_0 { -}; - -struct sched_param_1_2_0 { -}; - -struct jail_1_2_0 { -}; - -struct sigaction_1_2_0 { -}; - -struct acl_1_2_0 { -}; - -struct kevent_1_2_0 { -}; - -struct sf_hdtr_1_2_0 { -}; - -struct upcall_1_2_0 { -}; - -struct caps_msgid_1_2_0 { -}; - -struct caps_cred_1_2_0 { -}; - -struct tls_info_1_2_0 { -}; - -/* - * The system calls configuration file parses types as single words. - */ -typedef struct rusage_1_2_0 *rusage_1_2_0_ptr; -typedef struct statfs_1_2_0 *statfs_1_2_0_ptr; -typedef struct msghdr_1_2_0 *msghdr_1_2_0_ptr; -typedef struct itimerval_1_2_0 *itimerval_1_2_0_ptr; -typedef struct timeval_1_2_0 *timeval_1_2_0_ptr; -typedef struct sigvec_1_2_0 *sigvec_1_2_0_ptr; -typedef struct sigstack_1_2_0 *sigstack_1_2_0_ptr; -typedef struct timezone_1_2_0 *timezone_1_2_0_ptr; -typedef struct iovec_1_2_0 *iovec_1_2_0_ptr; -typedef struct statfs_1_2_0 *statfs_1_2_0_ptr; -typedef struct fhandle_1_2_0 *fhandle_1_2_0_ptr; -typedef struct utsname_1_2_0 *utsname_1_2_0_ptr; -typedef struct rtprio_1_2_0 *rtprio_1_2_0_ptr; -typedef struct timex_1_2_0 *timex_1_2_0_ptr; -typedef struct stat_1_2_0 *stat_1_2_0_ptr; -typedef struct pollfs_1_2_0 *pollfs_1_2_0_ptr; -typedef struct sembuf_1_2_0 *sembuf_1_2_0_ptr; -typedef struct msqid_ds_1_2_0 *msqid_ds_1_2_0_ptr; -typedef struct shmid_ds_1_2_0 *shmid_ds_1_2_0_ptr; -typedef struct timespec_1_2_0 *timespec_1_2_0_ptr; -typedef struct module_stat_1_2_0 *module_stat_1_2_0_ptr; -typedef struct kld_file_1_2_0 *kld_file_1_2_0_ptr; -typedef struct aiocb_1_2_0 *aiocb_1_2_0_ptr; -typedef struct sigevent_1_2_0 *sigevent_1_2_0_ptr; -typedef struct sched_param_1_2_0 *sched_param_1_2_0_ptr; -typedef struct jail_1_2_0 *jail_1_2_0_ptr; -typedef struct sigaction_1_2_0 *sigaction_1_2_0_ptr; -typedef struct acl_1_2_0 *acl_1_2_0_ptr; -typedef struct kevent_1_2_0 *kevent_1_2_0_ptr; -typedef struct sf_hdtr_1_2_0 *sf_hdtr_1_2_0_ptr; -typedef struct upcall_1_2_0 *upcall_1_2_0_ptr; -typedef struct caps_msgid_1_2_0 *caps_msgid_1_2_0_ptr; -typedef struct caps_cred_1_2_0 *caps_cred_1_2_0_ptr; -typedef struct tls_info_1_2_0 *tls_info_1_2_0_ptr; - -typedef const struct rusage_1_2_0 *const_rusage_1_2_0_ptr; -typedef const struct statfs_1_2_0 *const_statfs_1_2_0_ptr; -typedef const struct msghdr_1_2_0 *const_msghdr_1_2_0_ptr; -typedef const struct itimerval_1_2_0 *const_itimerval_1_2_0_ptr; -typedef const struct timeval_1_2_0 *const_timeval_1_2_0_ptr; -typedef const struct sigvec_1_2_0 *const_sigvec_1_2_0_ptr; -typedef const struct sigstack_1_2_0 *const_sigstack_1_2_0_ptr; -typedef const struct timezone_1_2_0 *const_timezone_1_2_0_ptr; -typedef const struct iovec_1_2_0 *const_iovec_1_2_0_ptr; -typedef const struct statfs_1_2_0 *const_statfs_1_2_0_ptr; -typedef const struct fhandle_1_2_0 *const_fhandle_1_2_0_ptr; -typedef const struct utsname_1_2_0 *const_utsname_1_2_0_ptr; -typedef const struct rtprio_1_2_0 *const_rtprio_1_2_0_ptr; -typedef const struct timex_1_2_0 *const_timex_1_2_0_ptr; -typedef const struct stat_1_2_0 *const_stat_1_2_0_ptr; -typedef const struct pollfs_1_2_0 *const_pollfs_1_2_0_ptr; -typedef const struct sembuf_1_2_0 *const_sembuf_1_2_0_ptr; -typedef const struct msqid_ds_1_2_0 *const_msqid_ds_1_2_0_ptr; -typedef const struct shmid_ds_1_2_0 *const_shmid_ds_1_2_0_ptr; -typedef const struct timespec_1_2_0 *const_timespec_1_2_0_ptr; -typedef const struct module_stat_1_2_0 *const_module_stat_1_2_0_ptr; -typedef const struct kld_file_1_2_0 *const_kld_file_1_2_0_ptr; -typedef const struct aiocb_1_2_0 *const_aiocb_1_2_0_ptr; -typedef const struct sigevent_1_2_0 *const_sigevent_1_2_0_ptr; -typedef const struct sched_param_1_2_0 *const_sched_param_1_2_0_ptr; -typedef const struct jail_1_2_0 *const_jail_1_2_0_ptr; -typedef const struct sigaction_1_2_0 *const_sigaction_1_2_0_ptr; -typedef const struct acl_1_2_0 *const_acl_1_2_0_ptr; -typedef const struct kevent_1_2_0 *const_kevent_1_2_0_ptr; -typedef const struct sf_hdtr_1_2_0 *const_sf_hdtr_1_2_0_ptr; -typedef const struct upcall_1_2_0 *const_upcall_1_2_0_ptr; -typedef const struct caps_msgid_1_2_0 *const_caps_msgid_1_2_0_ptr; -typedef const struct caps_cred_1_2_0 *const_caps_cred_1_2_0_ptr; -typedef const struct tls_info_1_2_0 *const_tls_info_1_2_0_ptr; - diff --git a/lib/libsys/genhooks/Makefile b/lib/libsys/genhooks/Makefile deleted file mode 100644 index 36f454c2ec..0000000000 --- a/lib/libsys/genhooks/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# -# $DragonFly: src/lib/libsys/genhooks/Makefile,v 1.1 2005/05/08 18:14:56 dillon Exp $ - -PROG= genhooks -SRCS= genhooks.c lex.c parse.c output_i386.c -MAN= - -.include diff --git a/lib/libsys/genhooks/defs.h b/lib/libsys/genhooks/defs.h deleted file mode 100644 index 5d1e738e25..0000000000 --- a/lib/libsys/genhooks/defs.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * DEFS.H - * - * $DragonFly: src/lib/libsys/genhooks/defs.h,v 1.2 2005/12/05 16:48:22 dillon Exp $ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define TOK_SEMI ';' -#define TOK_COMMA ',' -#define TOK_OBRACE '{' -#define TOK_CBRACE '}' -#define TOK_OPAREN '(' -#define TOK_CPAREN ')' -#define TOK_EOF 0x00000100 -#define TOK_UNKNOWN 0x00000101 -#define TOK_INTEGER 0x00000102 -#define TOK_BASE 0x00000103 -#define TOK_SYMBOL 0x04000000 - -#define TOK_ADD (TOK_SYMBOL|0x00000001) -#define TOK_FUNCTION (TOK_SYMBOL|0x00000002) -#define TOK_IMPLEMENTATION (TOK_SYMBOL|0x00000003) -#define TOK_DIRECT (TOK_SYMBOL|0x00000004) -#define TOK_SIMULATED (TOK_SYMBOL|0x00000005) - -typedef struct lex_token { - struct lex_info *info; - int type; - int index; - int len; - const char *sym; - int value; -} lex_token; - -typedef struct lex_info { - char *path; - int fd; - const char *base; - int size; - int cache_line; /* cached line number for index */ - int cache_index; /* index to base of cached line */ - int cache_len; /* size of cached line, including newline */ -} lex_info; - -typedef struct sys_type { - char *type_name; - char *var_name; -} sys_type; - -typedef struct sys_info { - struct sys_type *func_ret; - struct sys_type **func_args; - int nargs; /* 0 if takes void */ - int sysno; /* syscall number */ -} sys_info; - -extern struct sys_info **sys_array; -extern int sys_count; -extern char *sys_sectname; - -void *zalloc(int bytes); - -void lex_open(const char *path, lex_token *tok); -void lex_close(lex_token *tok); -int lex_gettoken(lex_token *tok); -int lex_skip_token(lex_token *tok, int type); -void lex_error(lex_token *tok, const char *ctl, ...); -const char *lex_string_quick(lex_token *tok); -char *lex_string(lex_token *tok); - -void parse_file(const char *path); - -void output_user(FILE *fo); -void output_lib(FILE *fo); -void output_standalone(FILE *fo, const char *list_prefix); - diff --git a/lib/libsys/genhooks/genhooks.c b/lib/libsys/genhooks/genhooks.c deleted file mode 100644 index c390e099d9..0000000000 --- a/lib/libsys/genhooks/genhooks.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2005 The DragonFly Project. All rights reserved. - * - * This code is derived from software contributed to The DragonFly Project - * by Matthew Dillon - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of The DragonFly Project nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific, prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $DragonFly: src/lib/libsys/genhooks/genhooks.c,v 1.2 2005/12/05 16:48:22 dillon Exp $ - */ -/* - * GENHOOKS [-u] [-l] [-s listfile] [-o outfile] infile(s) - * - * Generate assembly hooks for the actual system calls. This program - * will either generate hooks for user programs, or it will generate - * the assembly for the actual syscall layer file. - */ - -#include "defs.h" - -static void usage(const char *argv0); - -int -main(int ac, char **av) -{ - enum { OUTPUT_NONE, OUTPUT_USER, - OUTPUT_LIB, OUTPUT_STANDALONE } output_type = OUTPUT_NONE; - const char *argv0 = av[0]; - const char *list_prefix = NULL; - FILE *fo = NULL; - int i; - int ch; - - while ((ch = getopt(ac, av, "uls:o:")) != -1) { - switch(ch) { - case 'u': - output_type = OUTPUT_USER; - break; - case 's': - output_type = OUTPUT_STANDALONE; - list_prefix = optarg; - break; - case 'l': - output_type = OUTPUT_LIB; - break; - case 'o': - fo = fopen(optarg, "w"); - if (fo == NULL) { - err(1, "Unable to create %s", optarg); - /* not reached */ - } - break; - default: - usage(argv0); - /* not reached */ - } - } - ac -= optind; - av += optind; - if (output_type == OUTPUT_NONE) { - errx(1, "No output format specified"); - /* not reached */ - } - if (ac == 0) { - errx(1, "No input files specified"); - /* not reached */ - } - for (i = 0; i < ac; ++i) { - parse_file(av[i]); - } - if (fo == NULL) - fo = stdout; - - switch(output_type) { - case OUTPUT_USER: - output_user(fo); - break; - case OUTPUT_LIB: - output_lib(fo); - break; - case OUTPUT_STANDALONE: - output_standalone(fo, list_prefix); - break; - default: - break; - } - if (fo != stdout) - fclose(fo); - return(0); -} - -static void -usage(const char *argv0) -{ - fprintf(stderr, "%s [-u] [-l] [-s outprefix] [-o outfile] infiles...\n", - argv0); - exit(1); -} - -void * -zalloc(int bytes) -{ - void *ptr; - - ptr = malloc(bytes); - assert(ptr != NULL); - bzero(ptr, bytes); - return(ptr); -} - diff --git a/lib/libsys/genhooks/lex.c b/lib/libsys/genhooks/lex.c deleted file mode 100644 index 15c04a705c..0000000000 --- a/lib/libsys/genhooks/lex.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (c) 2005 The DragonFly Project. All rights reserved. - * - * This code is derived from software contributed to The DragonFly Project - * by Matthew Dillon - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of The DragonFly Project nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific, prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $DragonFly: src/lib/libsys/genhooks/lex.c,v 1.1 2005/05/08 18:14:56 dillon Exp $ - */ -/* - * LEX.C - * - * Lexical tokenizer for the parser. - */ - -#include "defs.h" - -static int lex_keyword(const char *ptr, int len); - -void -lex_open(const char *path, lex_token *tok) -{ - struct stat st; - lex_info *lex; - int fd; - - lex = zalloc(sizeof(*lex)); - bzero(tok, sizeof(lex_token)); - lex->fd = open(path, O_RDONLY); - if (lex->fd < 0) { - err(1, "unable to open %s", path); - /* not reached */ - } - if (fstat(lex->fd, &st) < 0) { - err(1, "unable to stat %s", path); - /* not reached */ - } - lex->path = strdup(path); - lex->size = st.st_size; - lex->base = mmap(NULL, lex->size, PROT_READ, MAP_SHARED, lex->fd, 0); - lex->cache_line = 1; - if (lex->base == MAP_FAILED) { - err(1, "unable to mmap %s", path); - /* not reached */ - } - - tok->info = lex; -} - -void -lex_close(lex_token *tok) -{ - lex_info *lex = tok->info; - - assert(lex->fd >= 0); - close(lex->fd); - munmap((void *)lex->base, lex->size); - lex->fd = -1; - lex->base = NULL; - tok->info = NULL; - free(lex->path); - free(lex); -} - -int -lex_gettoken(lex_token *tok) -{ - lex_info *lex = tok->info; - int b = tok->index + tok->len; - int i = b; - char c; - - tok->type = TOK_EOF; - while (i < lex->size) { - c = lex->base[i]; - - switch(c) { - case '\n': - case ' ': - case '\t': - ++b; - ++i; - break; - case '#': - while (i < lex->size && lex->base[i] != '\n') - ++i; - b = i; - break; - case ';': - case ',': - case '(': - case ')': - case '{': - case '}': - ++i; - tok->type = c; - goto done; - default: - if (c >= '0' && c <= '9') { - tok->type = TOK_INTEGER; - tok->value = 0; - while (i < lex->size) { - c = lex->base[i]; - if (c < '0' || c > '9') - break; - tok->value = tok->value * 10 + (c - '0'); - ++i; - } - goto done; - } - if (c == '_' || isalpha(c)) { - while (i < lex->size) { - c = lex->base[i]; - if (c != '_' && isalnum(c) == 0) - break; - ++i; - } - tok->type = lex_keyword(lex->base + b, i - b); - goto done; - } - tok->type = TOK_UNKNOWN; - ++i; - goto done; - } - } -done: - tok->index = b; - tok->sym = lex->base + b; - tok->len = i - b; - return(tok->type); -} - -static int -lex_keyword(const char *ptr, int len) -{ - if (len == 4 && strncasecmp(ptr, "base", 4) == 0) - return(TOK_BASE); - if (len == 3 && strncasecmp(ptr, "add", 3) == 0) - return(TOK_ADD); - if (len == 8 && strncasecmp(ptr, "function", 8) == 0) - return(TOK_FUNCTION); - if (len == 14 && strncasecmp(ptr, "implementation", 14) == 0) - return(TOK_IMPLEMENTATION); - if (len == 6 && strncasecmp(ptr, "direct", 6) == 0) - return(TOK_DIRECT); - if (len == 9 && strncasecmp(ptr, "simulated", 9) == 0) - return(TOK_SIMULATED); - return(TOK_SYMBOL); -} - -const char * -lex_string_quick(lex_token *tok) -{ - lex_info *lex = tok->info; - static char save_buf[64]; - static char *save_str = save_buf; - - if (save_str != save_buf) - free(save_str); - if (tok->len < sizeof(save_buf)) - save_str = save_buf; - else - save_str = malloc(tok->len + 1); - bcopy(lex->base + tok->index, save_str, tok->len); - save_str[tok->len] = 0; - return(save_str); -} - -char * -lex_string(lex_token *tok) -{ - lex_info *lex = tok->info; - char *ptr; - - ptr = malloc(tok->len + 1); - bcopy(lex->base + tok->index, ptr, tok->len); - ptr[tok->len] = 0; - return(ptr); -} - -int -lex_skip_token(lex_token *tok, int type) -{ - if (tok->type != type) { - if (type < 0x0100) - lex_error(tok, "Unexpected token, expected '%c'", type); - else - lex_error(tok, "Unexpected token"); - exit(1); - } - return(lex_gettoken(tok)); -} - -void -lex_error(lex_token *tok, const char *ctl, ...) -{ - lex_info *lex = tok->info; - va_list va; - int i; - int j; - - /* - * Locate the line and line number containing the error - */ - while (lex->cache_index > tok->index) { - --lex->cache_line; - for (i = lex->cache_index - 1; i > 0; --i) { - if (lex->base[i - 1] == '\n') - break; - } - lex->cache_len = lex->cache_index - i; - lex->cache_index = i; - } - for (i = lex->cache_index; i <= lex->size; ++i) { - if (i == lex->size) { - lex->cache_len = i - lex->cache_index; - break; - } - if (lex->base[i] == '\n') { - if (tok->index <= i) { - lex->cache_len = i + 1 - lex->cache_index; - break; - } - lex->cache_index = i + 1; - ++lex->cache_line; - } - } - - /* - * Pretty print. - */ - fprintf(stderr, "line %d of %s, ", lex->cache_line, lex->path); - va_start(va, ctl); - vfprintf(stderr, ctl, va); - va_end(va); - fprintf(stderr, ":\n"); - - i = tok->index - lex->cache_index; - j = (lex->cache_index + lex->cache_len) - (tok->index + tok->len); - fprintf(stderr, "%*.*s", i, i, lex->base + lex->cache_index); - fprintf(stderr, "\033[7m%*.*s\033[0m", tok->len, tok->len, lex->base + tok->index); - fprintf(stderr, "%*.*s", j, j, lex->base + tok->index + tok->len); -} - diff --git a/lib/libsys/genhooks/output_i386.c b/lib/libsys/genhooks/output_i386.c deleted file mode 100644 index 227e441a68..0000000000 --- a/lib/libsys/genhooks/output_i386.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2005 The DragonFly Project. All rights reserved. - * - * This code is derived from software contributed to The DragonFly Project - * by Matthew Dillon - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of The DragonFly Project nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific, prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $DragonFly: src/lib/libsys/genhooks/output_i386.c,v 1.2 2005/12/05 16:48:22 dillon Exp $ - */ -/* - * OUTPUT_I386.C - * - * Generate IA32 system call section code for the userland mapping - * area and for the actual map file. - */ - -#include "defs.h" - -void -output_user(FILE *fo) -{ - const char *name; - sys_info *sys; - int i; - - fprintf(fo, "\t.section DragonFly_%s,\"ax\", @nobits\n", sys_sectname); - fprintf(fo, "\t.p2align 12,0\n"); - - for (i = 0; i < sys_count; ++i) { - sys = sys_array[i]; - fprintf(fo, "\t.org\t%d * 64\n", i); - fprintf(fo, "\t.globl __syscall_%d\n" - "__syscall_%d:\n", - i); - if (sys) { - name = sys->func_ret->var_name; - fprintf(fo, "\t.globl __syscall_%s\n" - "__syscall_%s:\n", - name, name); - fprintf(fo, "\t.weak %s\n", name); - fprintf(fo, "\t.equ %s, __syscall_%s\n", name, name); - } - fprintf(fo, "\n"); - } - fprintf(fo, "\t.org\t%d * 64\n", i); - fprintf(fo, "\t.p2align 12,0\n"); -} - -void -output_lib(FILE *fo) -{ - sys_info *sys; - int i; - - fprintf(fo, "\t.section DragonFly_%s,\"ax\"\n", sys_sectname); - fprintf(fo, "\t.p2align 12,0\n"); - - for (i = 0; i < sys_count; ++i) { - sys = sys_array[i]; - fprintf(fo, "\t.org\t%d * 64\n", i); - fprintf(fo, "\t.globl __syscall_%d\n" - "__syscall_%d:\n", - i); - if (sys) { - fprintf(fo, "\t.globl __syscall_%s\n" - "__syscall_%s:\n", - sys->func_ret->var_name, - sys->func_ret->var_name); - fprintf(fo, "\tlea\t0x%x,%%eax\n" - "\tint\t$0x80\n" - "\tjb\t__syscall_errno_return\n" - "\tret\n", - i); - } - fprintf(fo, "\n"); - } - fprintf(fo, "\t.org\t%d * 64\n", i); - fprintf(fo, "__syscall_errno_return:\n" - "\tmovl\t%%gs:12,%%edx\n" /* XXX hardwired */ - "\tmovl\t%%eax,(%%edx)\n" - "\tmovl\t$-1,%%eax\n" - "\tmovl\t$-1,%%edx\n" - "\tret\n"); - fprintf(fo, "\t.p2align 12,0\n"); -} - -void -output_standalone(FILE *fo, const char *list_prefix) -{ - const char *name; - sys_info *sys; - char *path; - FILE *fp; - int i; - - { - asprintf(&path, "%serrno.s", list_prefix); - if ((fp = fopen(path, "w")) == NULL) { - err(1, "unable to create %s\n", path); - /* not reached */ - } - fprintf(fp, "\t.text\n"); - fprintf(fp, "\t.p2align 4\n"); - fprintf(fp, "__syscall_errno_return:\n" - "\tmovl\t%%gs:12,%%edx\n" /* XXX hardwired */ - "\tmovl\t%%eax,(%%edx)\n" - "\tmovl\t$-1,%%eax\n" - "\tmovl\t$-1,%%edx\n" - "\tret\n"); - fclose(fp); - - fprintf(fo, "%s ", path); - free(path); - } - - for (i = 0; i < sys_count; ++i) { - sys = sys_array[i]; - if (sys == NULL) - continue; - - asprintf(&path, "%s%s.s", list_prefix, sys->func_ret->var_name); - if ((fp = fopen(path, "w")) == NULL) { - err(1, "unable to create %s\n", path); - /* not reached */ - } - - name = sys->func_ret->var_name; - fprintf(fp, "\t.text\n"); - fprintf(fp, "\t.p2align 4\n"); - fprintf(fp, "\t.globl __syscall_%d\n" - "__syscall_%d:\n", i); - fprintf(fp, "\t.globl __syscall_%s\n" - "__syscall_%s:\n", - name, name); - fprintf(fp, "\t.weak %s\n", name); - fprintf(fp, "\t.equ %s, __syscall_%s\n", name, name); - fprintf(fp, "\tlea\t0x%x,%%eax\n" - "\tint\t$0x80\n" - "\tjb\t__syscall_errno_return\n" - "\tret\n", - i); - fprintf(fp, "\n"); - fclose(fp); - - fprintf(fo, " %s", path); - free(path); - } - fprintf(fo, "\n"); -} - diff --git a/lib/libsys/genhooks/parse.c b/lib/libsys/genhooks/parse.c deleted file mode 100644 index d6b77fea82..0000000000 --- a/lib/libsys/genhooks/parse.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2005 The DragonFly Project. All rights reserved. - * - * This code is derived from software contributed to The DragonFly Project - * by Matthew Dillon - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of The DragonFly Project nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific, prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $DragonFly: src/lib/libsys/genhooks/parse.c,v 1.1 2005/05/08 18:14:56 dillon Exp $ - */ -/* - * PARSE.C - * - * Parse the system call configuration file. - */ - -#include "defs.h" - -struct sys_info **sys_array; -int sys_count; -char *sys_sectname; - -static int parse_base(lex_token *tok); -static int parse_add(lex_token *tok); -static int parse_int(lex_token *tok, int *ret_p); -static int parse_type(lex_token *tok, sys_type **type_pp); - -void -parse_file(const char *path) -{ - lex_token tok; - int t; - - lex_open(path, &tok); - t = lex_gettoken(&tok); - while (t != TOK_EOF) { - switch(t) { - case TOK_BASE: - t = parse_base(&tok); - break; - case TOK_ADD: - t = parse_add(&tok); - break; - default: - lex_error(&tok, "Expected command directive"); - exit(1); - } - } - lex_close(&tok); -} - -int -parse_base(lex_token *tok) -{ - int t; - - t = lex_gettoken(tok); - if (t & TOK_SYMBOL) { - sys_sectname = lex_string(tok); - t = lex_gettoken(tok); - } else { - lex_error(tok, "Expected section extension symbol"); - exit(1); - } - t = lex_skip_token(tok, TOK_SEMI); - return(t); -} - -static int -parse_add(lex_token *tok) -{ - sys_info *info; - sys_type *type; - int sysno; - int t; - - lex_gettoken(tok); - info = zalloc(sizeof(sys_info)); - - parse_int(tok, &info->sysno); - - t = lex_skip_token(tok, TOK_OBRACE); - - while (t != TOK_CBRACE) { - switch(t) { - case TOK_FUNCTION: - t = lex_gettoken(tok); - parse_type(tok, &info->func_ret); - t = lex_skip_token(tok, TOK_OPAREN); - while (t != TOK_CPAREN) { - t = parse_type(tok, &type); - if (t != TOK_COMMA) - break; - t = lex_gettoken(tok); - info->func_args = realloc(info->func_args, - sizeof(sys_type) * (info->nargs + 1)); - info->func_args[info->nargs++] = type; - } - - /* - * cleanup void - */ - if (info->nargs == 1 && - strcmp(info->func_args[0]->type_name, "void") == 0 - ) { - info->nargs = 0; - /* XXX free/cleanup */ - } - - t = lex_skip_token(tok, TOK_CPAREN); - t = lex_skip_token(tok, TOK_SEMI); - break; - case TOK_IMPLEMENTATION: - t = lex_gettoken(tok); - switch(t) { - case TOK_DIRECT: - t = lex_gettoken(tok); - break; - default: - lex_error(tok, "Expected 'direct'"); - exit(1); - } - t = lex_skip_token(tok, TOK_SEMI); - break; - default: - lex_error(tok, "Expected command directive"); - exit(1); - } - } - t = lex_skip_token(tok, TOK_CBRACE); - if (sys_count <= info->sysno) { - sys_array = realloc(sys_array, - sizeof(sys_info *) * (info->sysno + 1)); - while (sys_count <= info->sysno) - sys_array[sys_count++] = NULL; - } - sys_array[info->sysno] = info; - return(t); -} - -static -int -parse_int(lex_token *tok, int *ret_p) -{ - int t = tok->type; - - if (t != TOK_INTEGER) { - lex_error(tok, "Expected integer"); - exit(1); - } - *ret_p = tok->value; - return(lex_gettoken(tok)); -} - -static -int -parse_type(lex_token *tok, sys_type **type_pp) -{ - int t = tok->type; - sys_type *type; - - type = zalloc(sizeof(sys_type)); - - if ((t & TOK_SYMBOL) == 0) { - lex_error(tok, "Expected type identifier"); - exit(1); - } - type->type_name = lex_string(tok); - t = lex_gettoken(tok); - if (t != TOK_COMMA && t != TOK_CPAREN) { - if ((t & TOK_SYMBOL) == 0) { - lex_error(tok, "Expected name identifier"); - exit(1); - } - type->var_name = lex_string(tok); - t = lex_gettoken(tok); - } else { - type->var_name = NULL; - } - *type_pp = type; - return(t); -} -