184778508Sblueswir1 /* 2366c5c9fSWarner Losh * System call related declarations 384778508Sblueswir1 * 4366c5c9fSWarner Losh * Copyright (c) 2013-15 Stacey D. Son (sson at FreeBSD) 584778508Sblueswir1 * 6366c5c9fSWarner Losh * This program is free software; you can redistribute it and/or modify 7366c5c9fSWarner Losh * it under the terms of the GNU General Public License as published by 8366c5c9fSWarner Losh * the Free Software Foundation; either version 2 of the License, or 9366c5c9fSWarner Losh * (at your option) any later version. 1084778508Sblueswir1 * 11366c5c9fSWarner Losh * This program is distributed in the hope that it will be useful, 12366c5c9fSWarner Losh * but WITHOUT ANY WARRANTY; without even the implied warranty of 13366c5c9fSWarner Losh * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14366c5c9fSWarner Losh * GNU General Public License for more details. 15366c5c9fSWarner Losh * 16366c5c9fSWarner Losh * You should have received a copy of the GNU General Public License 17366c5c9fSWarner Losh * along with this program; if not, see <http://www.gnu.org/licenses/>. 1884778508Sblueswir1 */ 1984778508Sblueswir1 209c092804SMarkus Armbruster #ifndef SYSCALL_DEFS_H 219c092804SMarkus Armbruster #define SYSCALL_DEFS_H 2284778508Sblueswir1 23366c5c9fSWarner Losh #include <sys/syscall.h> 2437714547SWarner Losh #include <sys/resource.h> 2584778508Sblueswir1 2684778508Sblueswir1 #include "errno_defs.h" 2784778508Sblueswir1 2884778508Sblueswir1 #include "freebsd/syscall_nr.h" 2984778508Sblueswir1 #include "netbsd/syscall_nr.h" 3084778508Sblueswir1 #include "openbsd/syscall_nr.h" 3178cfb07fSJuergen Lock 32366c5c9fSWarner Losh /* 33366c5c9fSWarner Losh * machine/_types.h 34366c5c9fSWarner Losh * or x86/_types.h 35366c5c9fSWarner Losh */ 36366c5c9fSWarner Losh 37366c5c9fSWarner Losh /* 38366c5c9fSWarner Losh * time_t seems to be very inconsistly defined for the different *BSD's... 39366c5c9fSWarner Losh * 40366c5c9fSWarner Losh * FreeBSD uses a 64bits time_t except on i386 41366c5c9fSWarner Losh * so we have to add a special case here. 42366c5c9fSWarner Losh * 43366c5c9fSWarner Losh * On NetBSD time_t is always defined as an int64_t. On OpenBSD time_t 44366c5c9fSWarner Losh * is always defined as an int. 45366c5c9fSWarner Losh * 46366c5c9fSWarner Losh */ 47366c5c9fSWarner Losh #if (!defined(TARGET_I386)) 48366c5c9fSWarner Losh typedef int64_t target_freebsd_time_t; 49366c5c9fSWarner Losh #else 50366c5c9fSWarner Losh typedef int32_t target_freebsd_time_t; 51366c5c9fSWarner Losh #endif 52366c5c9fSWarner Losh 5378cfb07fSJuergen Lock struct target_iovec { 5478cfb07fSJuergen Lock abi_long iov_base; /* Starting address */ 5578cfb07fSJuergen Lock abi_long iov_len; /* Number of bytes */ 5678cfb07fSJuergen Lock }; 5778cfb07fSJuergen Lock 58366c5c9fSWarner Losh /* 59366c5c9fSWarner Losh * sys/mman.h 60366c5c9fSWarner Losh */ 61366c5c9fSWarner Losh #define TARGET_FREEBSD_MAP_RESERVED0080 0x0080 /* previously misimplemented */ 62366c5c9fSWarner Losh /* MAP_INHERIT */ 63366c5c9fSWarner Losh #define TARGET_FREEBSD_MAP_RESERVED0100 0x0100 /* previously unimplemented */ 64366c5c9fSWarner Losh /* MAP_NOEXTEND */ 65366c5c9fSWarner Losh #define TARGET_FREEBSD_MAP_STACK 0x0400 /* region grows down, like a */ 66366c5c9fSWarner Losh /* stack */ 67366c5c9fSWarner Losh #define TARGET_FREEBSD_MAP_NOSYNC 0x0800 /* page to but do not sync */ 68366c5c9fSWarner Losh /* underlying file */ 69366c5c9fSWarner Losh 70366c5c9fSWarner Losh #define TARGET_FREEBSD_MAP_FLAGMASK 0x1ff7 71366c5c9fSWarner Losh 72366c5c9fSWarner Losh #define TARGET_NETBSD_MAP_INHERIT 0x0080 /* region is retained after */ 73366c5c9fSWarner Losh /* exec */ 74366c5c9fSWarner Losh #define TARGET_NETBSD_MAP_TRYFIXED 0x0400 /* attempt hint address, even */ 75366c5c9fSWarner Losh /* within break */ 76366c5c9fSWarner Losh #define TARGET_NETBSD_MAP_WIRED 0x0800 /* mlock() mapping when it is */ 77366c5c9fSWarner Losh /* established */ 78366c5c9fSWarner Losh 79366c5c9fSWarner Losh #define TARGET_NETBSD_MAP_STACK 0x2000 /* allocated from memory, */ 80366c5c9fSWarner Losh /* swap space (stack) */ 81366c5c9fSWarner Losh 82366c5c9fSWarner Losh #define TARGET_NETBSD_MAP_FLAGMASK 0x3ff7 83366c5c9fSWarner Losh 84366c5c9fSWarner Losh #define TARGET_OPENBSD_MAP_INHERIT 0x0080 /* region is retained after */ 85366c5c9fSWarner Losh /* exec */ 86366c5c9fSWarner Losh #define TARGET_OPENBSD_MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change */ 87366c5c9fSWarner Losh /* file size */ 88366c5c9fSWarner Losh #define TARGET_OPENBSD_MAP_TRYFIXED 0x0400 /* attempt hint address, */ 89366c5c9fSWarner Losh /* even within heap */ 90366c5c9fSWarner Losh 91366c5c9fSWarner Losh #define TARGET_OPENBSD_MAP_FLAGMASK 0x17f7 92366c5c9fSWarner Losh 93366c5c9fSWarner Losh /* XXX */ 94366c5c9fSWarner Losh #define TARGET_BSD_MAP_FLAGMASK 0x3ff7 95366c5c9fSWarner Losh 96366c5c9fSWarner Losh /* 97366c5c9fSWarner Losh * sys/time.h 98366c5c9fSWarner Losh * sys/timex.h 99366c5c9fSWarner Losh */ 100366c5c9fSWarner Losh 101366c5c9fSWarner Losh typedef abi_long target_freebsd_suseconds_t; 102366c5c9fSWarner Losh 103366c5c9fSWarner Losh /* compare to sys/timespec.h */ 104366c5c9fSWarner Losh struct target_freebsd_timespec { 105366c5c9fSWarner Losh target_freebsd_time_t tv_sec; /* seconds */ 106366c5c9fSWarner Losh abi_long tv_nsec; /* and nanoseconds */ 107366c5c9fSWarner Losh #if !defined(TARGET_I386) && TARGET_ABI_BITS == 32 108366c5c9fSWarner Losh abi_long _pad; 109366c5c9fSWarner Losh #endif 110366c5c9fSWarner Losh }; 111366c5c9fSWarner Losh 112366c5c9fSWarner Losh #define TARGET_CPUCLOCK_WHICH_PID 0 113366c5c9fSWarner Losh #define TARGET_CPUCLOCK_WHICH_TID 1 114366c5c9fSWarner Losh 115366c5c9fSWarner Losh /* sys/umtx.h */ 116366c5c9fSWarner Losh struct target_freebsd__umtx_time { 117366c5c9fSWarner Losh struct target_freebsd_timespec _timeout; 118366c5c9fSWarner Losh uint32_t _flags; 119366c5c9fSWarner Losh uint32_t _clockid; 120366c5c9fSWarner Losh }; 121366c5c9fSWarner Losh 122366c5c9fSWarner Losh struct target_freebsd_timeval { 123366c5c9fSWarner Losh target_freebsd_time_t tv_sec; /* seconds */ 124366c5c9fSWarner Losh target_freebsd_suseconds_t tv_usec;/* and microseconds */ 125366c5c9fSWarner Losh #if !defined(TARGET_I386) && TARGET_ABI_BITS == 32 126366c5c9fSWarner Losh abi_long _pad; 127366c5c9fSWarner Losh #endif 128366c5c9fSWarner Losh }; 129366c5c9fSWarner Losh 130366c5c9fSWarner Losh /* 131366c5c9fSWarner Losh * sys/resource.h 132366c5c9fSWarner Losh */ 133366c5c9fSWarner Losh #if defined(__FreeBSD__) 134366c5c9fSWarner Losh #define TARGET_RLIM_INFINITY RLIM_INFINITY 135366c5c9fSWarner Losh #else 136366c5c9fSWarner Losh #define TARGET_RLIM_INFINITY ((abi_ulong)-1) 137366c5c9fSWarner Losh #endif 138366c5c9fSWarner Losh 139366c5c9fSWarner Losh #define TARGET_RLIMIT_CPU 0 140366c5c9fSWarner Losh #define TARGET_RLIMIT_FSIZE 1 141366c5c9fSWarner Losh #define TARGET_RLIMIT_DATA 2 142366c5c9fSWarner Losh #define TARGET_RLIMIT_STACK 3 143366c5c9fSWarner Losh #define TARGET_RLIMIT_CORE 4 144366c5c9fSWarner Losh #define TARGET_RLIMIT_RSS 5 145366c5c9fSWarner Losh #define TARGET_RLIMIT_MEMLOCK 6 146366c5c9fSWarner Losh #define TARGET_RLIMIT_NPROC 7 147366c5c9fSWarner Losh #define TARGET_RLIMIT_NOFILE 8 148366c5c9fSWarner Losh #define TARGET_RLIMIT_SBSIZE 9 149366c5c9fSWarner Losh #define TARGET_RLIMIT_AS 10 150366c5c9fSWarner Losh #define TARGET_RLIMIT_NPTS 11 151366c5c9fSWarner Losh #define TARGET_RLIMIT_SWAP 12 152366c5c9fSWarner Losh 153366c5c9fSWarner Losh struct target_rlimit { 154366c5c9fSWarner Losh uint64_t rlim_cur; 155366c5c9fSWarner Losh uint64_t rlim_max; 156366c5c9fSWarner Losh }; 157366c5c9fSWarner Losh 158366c5c9fSWarner Losh struct target_freebsd_rusage { 159366c5c9fSWarner Losh struct target_freebsd_timeval ru_utime; /* user time used */ 160366c5c9fSWarner Losh struct target_freebsd_timeval ru_stime; /* system time used */ 161366c5c9fSWarner Losh abi_long ru_maxrss; /* maximum resident set size */ 162366c5c9fSWarner Losh abi_long ru_ixrss; /* integral shared memory size */ 163366c5c9fSWarner Losh abi_long ru_idrss; /* integral unshared data size */ 164366c5c9fSWarner Losh abi_long ru_isrss; /* integral unshared stack size */ 165366c5c9fSWarner Losh abi_long ru_minflt; /* page reclaims */ 166366c5c9fSWarner Losh abi_long ru_majflt; /* page faults */ 167366c5c9fSWarner Losh abi_long ru_nswap; /* swaps */ 168366c5c9fSWarner Losh abi_long ru_inblock; /* block input operations */ 169366c5c9fSWarner Losh abi_long ru_oublock; /* block output operations */ 170366c5c9fSWarner Losh abi_long ru_msgsnd; /* messages sent */ 171366c5c9fSWarner Losh abi_long ru_msgrcv; /* messages received */ 172366c5c9fSWarner Losh abi_long ru_nsignals; /* signals received */ 173366c5c9fSWarner Losh abi_long ru_nvcsw; /* voluntary context switches */ 174366c5c9fSWarner Losh abi_long ru_nivcsw; /* involuntary context switches */ 175366c5c9fSWarner Losh }; 176366c5c9fSWarner Losh 177366c5c9fSWarner Losh struct target_freebsd__wrusage { 178366c5c9fSWarner Losh struct target_freebsd_rusage wru_self; 179366c5c9fSWarner Losh struct target_freebsd_rusage wru_children; 180366c5c9fSWarner Losh }; 181366c5c9fSWarner Losh 18240f5e298SStacey Son /* 18340f5e298SStacey Son * sys/stat.h 18440f5e298SStacey Son */ 18540f5e298SStacey Son struct target_freebsd11_stat { 18640f5e298SStacey Son uint32_t st_dev; /* inode's device */ 18740f5e298SStacey Son uint32_t st_ino; /* inode's number */ 18840f5e298SStacey Son int16_t st_mode; /* inode protection mode */ 18940f5e298SStacey Son int16_t st_nlink; /* number of hard links */ 19040f5e298SStacey Son uint32_t st_uid; /* user ID of the file's owner */ 19140f5e298SStacey Son uint32_t st_gid; /* group ID of the file's group */ 19240f5e298SStacey Son uint32_t st_rdev; /* device type */ 19340f5e298SStacey Son struct target_freebsd_timespec st_atim; /* time last accessed */ 19440f5e298SStacey Son struct target_freebsd_timespec st_mtim; /* time last data modification */ 19540f5e298SStacey Son struct target_freebsd_timespec st_ctim; /* time last file status change */ 19640f5e298SStacey Son int64_t st_size; /* file size, in bytes */ 19740f5e298SStacey Son int64_t st_blocks; /* blocks allocated for file */ 19840f5e298SStacey Son uint32_t st_blksize; /* optimal blocksize for I/O */ 19940f5e298SStacey Son uint32_t st_flags; /* user defined flags for file */ 20040f5e298SStacey Son uint32_t st_gen; /* file generation number */ 20140f5e298SStacey Son int32_t st_lspare; 20240f5e298SStacey Son struct target_freebsd_timespec st_birthtim; /* time of file creation */ 20340f5e298SStacey Son /* 20440f5e298SStacey Son * Explicitly pad st_birthtim to 16 bytes so that the size of 20540f5e298SStacey Son * struct stat is backwards compatible. We use bitfields instead 20640f5e298SStacey Son * of an array of chars so that this doesn't require a C99 compiler 20740f5e298SStacey Son * to compile if the size of the padding is 0. We use 2 bitfields 20840f5e298SStacey Son * to cover up to 64 bits on 32-bit machines. We assume that 20940f5e298SStacey Son * CHAR_BIT is 8... 21040f5e298SStacey Son */ 21140f5e298SStacey Son unsigned int:(8 / 2) * (16 - (int)sizeof(struct target_freebsd_timespec)); 21240f5e298SStacey Son unsigned int:(8 / 2) * (16 - (int)sizeof(struct target_freebsd_timespec)); 21340f5e298SStacey Son } __packed; 21440f5e298SStacey Son 215ad805a77SMichal Meloun #if defined(__i386__) 216ad805a77SMichal Meloun #define TARGET_HAS_STAT_TIME_T_EXT 1 217ad805a77SMichal Meloun #endif 218ad805a77SMichal Meloun 219ad805a77SMichal Meloun struct target_stat { 220ad805a77SMichal Meloun uint64_t st_dev; /* inode's device */ 221ad805a77SMichal Meloun uint64_t st_ino; /* inode's number */ 222ad805a77SMichal Meloun uint64_t st_nlink; /* number of hard links */ 223ad805a77SMichal Meloun int16_t st_mode; /* inode protection mode */ 224ad805a77SMichal Meloun int16_t st_padding0; 225ad805a77SMichal Meloun uint32_t st_uid; /* user ID of the file's owner */ 226ad805a77SMichal Meloun uint32_t st_gid; /* group ID of the file's group */ 227ad805a77SMichal Meloun int32_t st_padding1; 228ad805a77SMichal Meloun uint64_t st_rdev; /* device type */ 229ad805a77SMichal Meloun #ifdef TARGET_HAS_STAT_TIME_T_EXT 230ad805a77SMichal Meloun int32_t st_atim_ext; 231ad805a77SMichal Meloun #endif 232ad805a77SMichal Meloun struct target_freebsd_timespec st_atim; /* time of last access */ 233ad805a77SMichal Meloun #ifdef TARGET_HAS_STAT_TIME_T_EXT 234ad805a77SMichal Meloun int32_t st_mtim_ext; 235ad805a77SMichal Meloun #endif 236ad805a77SMichal Meloun struct target_freebsd_timespec st_mtim; /* time of last data modification */ 237ad805a77SMichal Meloun #ifdef TARGET_HAS_STAT_TIME_T_EXT 238ad805a77SMichal Meloun int32_t st_ctim_ext; 239ad805a77SMichal Meloun #endif 240ad805a77SMichal Meloun struct target_freebsd_timespec st_ctim;/* time of last file status change */ 241ad805a77SMichal Meloun #ifdef TARGET_HAS_STAT_TIME_T_EXT 242ad805a77SMichal Meloun int32_t st_btim_ext; 243ad805a77SMichal Meloun #endif 244ad805a77SMichal Meloun struct target_freebsd_timespec st_birthtim; /* time of file creation */ 245ad805a77SMichal Meloun int64_t st_size; /* file size, in bytes */ 246ad805a77SMichal Meloun int64_t st_blocks; /* blocks allocated for file */ 247ad805a77SMichal Meloun uint32_t st_blksize; /* optimal blocksize for I/O */ 248ad805a77SMichal Meloun uint32_t st_flags; /* user defined flags for file */ 249ad805a77SMichal Meloun uint64_t st_gen; /* file generation number */ 250ad805a77SMichal Meloun uint64_t st_spare[10]; 251ad805a77SMichal Meloun }; 252ad805a77SMichal Meloun 2531de075a0SStacey Son 2541de075a0SStacey Son /* struct nstat is the same as stat above but without the st_lspare field */ 2551de075a0SStacey Son struct target_freebsd11_nstat { 2561de075a0SStacey Son uint32_t st_dev; /* inode's device */ 2571de075a0SStacey Son uint32_t st_ino; /* inode's number */ 2581de075a0SStacey Son int16_t st_mode; /* inode protection mode */ 2591de075a0SStacey Son int16_t st_nlink; /* number of hard links */ 2601de075a0SStacey Son uint32_t st_uid; /* user ID of the file's owner */ 2611de075a0SStacey Son uint32_t st_gid; /* group ID of the file's group */ 2621de075a0SStacey Son uint32_t st_rdev; /* device type */ 2631de075a0SStacey Son struct target_freebsd_timespec st_atim; /* time last accessed */ 2641de075a0SStacey Son struct target_freebsd_timespec st_mtim; /* time last data modification */ 2651de075a0SStacey Son struct target_freebsd_timespec st_ctim; /* time last file status change */ 2661de075a0SStacey Son int64_t st_size; /* file size, in bytes */ 2671de075a0SStacey Son int64_t st_blocks; /* blocks allocated for file */ 2681de075a0SStacey Son uint32_t st_blksize; /* optimal blocksize for I/O */ 2691de075a0SStacey Son uint32_t st_flags; /* user defined flags for file */ 2701de075a0SStacey Son uint32_t st_gen; /* file generation number */ 2711de075a0SStacey Son struct target_freebsd_timespec st_birthtim; /* time of file creation */ 2721de075a0SStacey Son /* 2731de075a0SStacey Son * Explicitly pad st_birthtim to 16 bytes so that the size of 2741de075a0SStacey Son * struct stat is backwards compatible. We use bitfields instead 2751de075a0SStacey Son * of an array of chars so that this doesn't require a C99 compiler 2761de075a0SStacey Son * to compile if the size of the padding is 0. We use 2 bitfields 2771de075a0SStacey Son * to cover up to 64 bits on 32-bit machines. We assume that 2781de075a0SStacey Son * CHAR_BIT is 8... 2791de075a0SStacey Son */ 2801de075a0SStacey Son unsigned int:(8 / 2) * (16 - (int)sizeof(struct target_freebsd_timespec)); 2811de075a0SStacey Son unsigned int:(8 / 2) * (16 - (int)sizeof(struct target_freebsd_timespec)); 2821de075a0SStacey Son } __packed; 2831de075a0SStacey Son 2841de075a0SStacey Son /* 2851de075a0SStacey Son * sys/mount.h 2861de075a0SStacey Son */ 2871de075a0SStacey Son 2881de075a0SStacey Son /* filesystem id type */ 2891de075a0SStacey Son typedef struct target_freebsd_fsid { int32_t val[2]; } target_freebsd_fsid_t; 2901de075a0SStacey Son 2911de075a0SStacey Son /* filesystem statistics */ 2921de075a0SStacey Son struct target_freebsd11_statfs { 2931de075a0SStacey Son uint32_t f_version; /* structure version number */ 2941de075a0SStacey Son uint32_t f_type; /* type of filesystem */ 2951de075a0SStacey Son uint64_t f_flags; /* copy of mount exported flags */ 2961de075a0SStacey Son uint64_t f_bsize; /* filesystem fragment size */ 2971de075a0SStacey Son uint64_t f_iosize; /* optimal transfer block size */ 2981de075a0SStacey Son uint64_t f_blocks; /* total data blocks in filesystem */ 2991de075a0SStacey Son uint64_t f_bfree; /* free blocks in filesystem */ 3001de075a0SStacey Son int64_t f_bavail; /* free blocks avail to non-superuser */ 3011de075a0SStacey Son uint64_t f_files; /* total file nodes in filesystem */ 3021de075a0SStacey Son int64_t f_ffree; /* free nodes avail to non-superuser */ 3031de075a0SStacey Son uint64_t f_syncwrites; /* count of sync writes since mount */ 3041de075a0SStacey Son uint64_t f_asyncwrites; /* count of async writes since mount */ 3051de075a0SStacey Son uint64_t f_syncreads; /* count of sync reads since mount */ 3061de075a0SStacey Son uint64_t f_asyncreads; /* count of async reads since mount */ 3071de075a0SStacey Son uint64_t f_spare[10]; /* unused spare */ 3081de075a0SStacey Son uint32_t f_namemax; /* maximum filename length */ 3091de075a0SStacey Son uint32_t f_owner; /* user that mounted the filesystem */ 3101de075a0SStacey Son target_freebsd_fsid_t f_fsid; /* filesystem id */ 3111de075a0SStacey Son char f_charspare[80]; /* spare string space */ 3121de075a0SStacey Son char f_fstypename[16]; /* filesys type name */ 3131de075a0SStacey Son char f_mntfromname[88]; /* mount filesystem */ 3141de075a0SStacey Son char f_mntonname[88]; /* dir on which mounted*/ 3151de075a0SStacey Son }; 3161de075a0SStacey Son 317*25efcda4SMichal Meloun struct target_statfs { 318*25efcda4SMichal Meloun uint32_t f_version; /* structure version number */ 319*25efcda4SMichal Meloun uint32_t f_type; /* type of filesystem */ 320*25efcda4SMichal Meloun uint64_t f_flags; /* copy of mount exported flags */ 321*25efcda4SMichal Meloun uint64_t f_bsize; /* filesystem fragment size */ 322*25efcda4SMichal Meloun uint64_t f_iosize; /* optimal transfer block size */ 323*25efcda4SMichal Meloun uint64_t f_blocks; /* total data blocks in filesystem */ 324*25efcda4SMichal Meloun uint64_t f_bfree; /* free blocks in filesystem */ 325*25efcda4SMichal Meloun int64_t f_bavail; /* free blocks avail to non-superuser */ 326*25efcda4SMichal Meloun uint64_t f_files; /* total file nodes in filesystem */ 327*25efcda4SMichal Meloun int64_t f_ffree; /* free nodes avail to non-superuser */ 328*25efcda4SMichal Meloun uint64_t f_syncwrites; /* count of sync writes since mount */ 329*25efcda4SMichal Meloun uint64_t f_asyncwrites; /* count of async writes since mount */ 330*25efcda4SMichal Meloun uint64_t f_syncreads; /* count of sync reads since mount */ 331*25efcda4SMichal Meloun uint64_t f_asyncreads; /* count of async reads since mount */ 332*25efcda4SMichal Meloun uint64_t f_spare[10]; /* unused spare */ 333*25efcda4SMichal Meloun uint32_t f_namemax; /* maximum filename length */ 334*25efcda4SMichal Meloun uint32_t f_owner; /* user that mounted the filesystem */ 335*25efcda4SMichal Meloun target_freebsd_fsid_t f_fsid; /* filesystem id */ 336*25efcda4SMichal Meloun char f_charspare[80]; /* spare string space */ 337*25efcda4SMichal Meloun char f_fstypename[16]; /* filesystem type name */ 338*25efcda4SMichal Meloun char f_mntfromname[1024]; /* mounted filesystem */ 339*25efcda4SMichal Meloun char f_mntonname[1024]; /* directory on which mounted */ 340*25efcda4SMichal Meloun }; 341*25efcda4SMichal Meloun 342a5b88166SWarner Losh #define safe_syscall0(type, name) \ 343a5b88166SWarner Losh type safe_##name(void) \ 344a5b88166SWarner Losh { \ 345a5b88166SWarner Losh return safe_syscall(SYS_##name); \ 346a5b88166SWarner Losh } 347a5b88166SWarner Losh 348a5b88166SWarner Losh #define safe_syscall1(type, name, type1, arg1) \ 349a5b88166SWarner Losh type safe_##name(type1 arg1) \ 350a5b88166SWarner Losh { \ 351a5b88166SWarner Losh return safe_syscall(SYS_##name, arg1); \ 352a5b88166SWarner Losh } 353a5b88166SWarner Losh 354a5b88166SWarner Losh #define safe_syscall2(type, name, type1, arg1, type2, arg2) \ 355a5b88166SWarner Losh type safe_##name(type1 arg1, type2 arg2) \ 356a5b88166SWarner Losh { \ 357a5b88166SWarner Losh return safe_syscall(SYS_##name, arg1, arg2); \ 358a5b88166SWarner Losh } 359a5b88166SWarner Losh 360a5b88166SWarner Losh #define safe_syscall3(type, name, type1, arg1, type2, arg2, type3, arg3) \ 361a5b88166SWarner Losh type safe_##name(type1 arg1, type2 arg2, type3 arg3) \ 362a5b88166SWarner Losh { \ 363a5b88166SWarner Losh return safe_syscall(SYS_##name, arg1, arg2, arg3); \ 364a5b88166SWarner Losh } 365a5b88166SWarner Losh 366a5b88166SWarner Losh #define safe_syscall4(type, name, type1, arg1, type2, arg2, type3, arg3, \ 367a5b88166SWarner Losh type4, arg4) \ 368a5b88166SWarner Losh type safe_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ 369a5b88166SWarner Losh { \ 370a5b88166SWarner Losh return safe_syscall(SYS_##name, arg1, arg2, arg3, arg4); \ 371a5b88166SWarner Losh } 372a5b88166SWarner Losh 373a5b88166SWarner Losh #define safe_syscall5(type, name, type1, arg1, type2, arg2, type3, arg3, \ 374a5b88166SWarner Losh type4, arg4, type5, arg5) \ 375a5b88166SWarner Losh type safe_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ 376a5b88166SWarner Losh type5 arg5) \ 377a5b88166SWarner Losh { \ 378a5b88166SWarner Losh return safe_syscall(SYS_##name, arg1, arg2, arg3, arg4, arg5); \ 379a5b88166SWarner Losh } 380a5b88166SWarner Losh 381a5b88166SWarner Losh #define safe_syscall6(type, name, type1, arg1, type2, arg2, type3, arg3, \ 382a5b88166SWarner Losh type4, arg4, type5, arg5, type6, arg6) \ 383a5b88166SWarner Losh type safe_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ 384a5b88166SWarner Losh type5 arg5, type6 arg6) \ 385a5b88166SWarner Losh { \ 386a5b88166SWarner Losh return safe_syscall(SYS_##name, arg1, arg2, arg3, arg4, arg5, arg6); \ 387a5b88166SWarner Losh } 388a5b88166SWarner Losh 38977d3522bSWarner Losh /* So far all target and host bitmasks are the same */ 390a05cee93SRichard Henderson #undef target_to_host_bitmask 39177d3522bSWarner Losh #define target_to_host_bitmask(x, tbl) (x) 392a05cee93SRichard Henderson #undef host_to_target_bitmask 39377d3522bSWarner Losh #define host_to_target_bitmask(x, tbl) (x) 39477d3522bSWarner Losh 3959c092804SMarkus Armbruster #endif /* SYSCALL_DEFS_H */ 396