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 253*1de075a0SStacey Son 254*1de075a0SStacey Son /* struct nstat is the same as stat above but without the st_lspare field */ 255*1de075a0SStacey Son struct target_freebsd11_nstat { 256*1de075a0SStacey Son uint32_t st_dev; /* inode's device */ 257*1de075a0SStacey Son uint32_t st_ino; /* inode's number */ 258*1de075a0SStacey Son int16_t st_mode; /* inode protection mode */ 259*1de075a0SStacey Son int16_t st_nlink; /* number of hard links */ 260*1de075a0SStacey Son uint32_t st_uid; /* user ID of the file's owner */ 261*1de075a0SStacey Son uint32_t st_gid; /* group ID of the file's group */ 262*1de075a0SStacey Son uint32_t st_rdev; /* device type */ 263*1de075a0SStacey Son struct target_freebsd_timespec st_atim; /* time last accessed */ 264*1de075a0SStacey Son struct target_freebsd_timespec st_mtim; /* time last data modification */ 265*1de075a0SStacey Son struct target_freebsd_timespec st_ctim; /* time last file status change */ 266*1de075a0SStacey Son int64_t st_size; /* file size, in bytes */ 267*1de075a0SStacey Son int64_t st_blocks; /* blocks allocated for file */ 268*1de075a0SStacey Son uint32_t st_blksize; /* optimal blocksize for I/O */ 269*1de075a0SStacey Son uint32_t st_flags; /* user defined flags for file */ 270*1de075a0SStacey Son uint32_t st_gen; /* file generation number */ 271*1de075a0SStacey Son struct target_freebsd_timespec st_birthtim; /* time of file creation */ 272*1de075a0SStacey Son /* 273*1de075a0SStacey Son * Explicitly pad st_birthtim to 16 bytes so that the size of 274*1de075a0SStacey Son * struct stat is backwards compatible. We use bitfields instead 275*1de075a0SStacey Son * of an array of chars so that this doesn't require a C99 compiler 276*1de075a0SStacey Son * to compile if the size of the padding is 0. We use 2 bitfields 277*1de075a0SStacey Son * to cover up to 64 bits on 32-bit machines. We assume that 278*1de075a0SStacey Son * CHAR_BIT is 8... 279*1de075a0SStacey Son */ 280*1de075a0SStacey Son unsigned int:(8 / 2) * (16 - (int)sizeof(struct target_freebsd_timespec)); 281*1de075a0SStacey Son unsigned int:(8 / 2) * (16 - (int)sizeof(struct target_freebsd_timespec)); 282*1de075a0SStacey Son } __packed; 283*1de075a0SStacey Son 284*1de075a0SStacey Son /* 285*1de075a0SStacey Son * sys/mount.h 286*1de075a0SStacey Son */ 287*1de075a0SStacey Son 288*1de075a0SStacey Son /* filesystem id type */ 289*1de075a0SStacey Son typedef struct target_freebsd_fsid { int32_t val[2]; } target_freebsd_fsid_t; 290*1de075a0SStacey Son 291*1de075a0SStacey Son /* filesystem statistics */ 292*1de075a0SStacey Son struct target_freebsd11_statfs { 293*1de075a0SStacey Son uint32_t f_version; /* structure version number */ 294*1de075a0SStacey Son uint32_t f_type; /* type of filesystem */ 295*1de075a0SStacey Son uint64_t f_flags; /* copy of mount exported flags */ 296*1de075a0SStacey Son uint64_t f_bsize; /* filesystem fragment size */ 297*1de075a0SStacey Son uint64_t f_iosize; /* optimal transfer block size */ 298*1de075a0SStacey Son uint64_t f_blocks; /* total data blocks in filesystem */ 299*1de075a0SStacey Son uint64_t f_bfree; /* free blocks in filesystem */ 300*1de075a0SStacey Son int64_t f_bavail; /* free blocks avail to non-superuser */ 301*1de075a0SStacey Son uint64_t f_files; /* total file nodes in filesystem */ 302*1de075a0SStacey Son int64_t f_ffree; /* free nodes avail to non-superuser */ 303*1de075a0SStacey Son uint64_t f_syncwrites; /* count of sync writes since mount */ 304*1de075a0SStacey Son uint64_t f_asyncwrites; /* count of async writes since mount */ 305*1de075a0SStacey Son uint64_t f_syncreads; /* count of sync reads since mount */ 306*1de075a0SStacey Son uint64_t f_asyncreads; /* count of async reads since mount */ 307*1de075a0SStacey Son uint64_t f_spare[10]; /* unused spare */ 308*1de075a0SStacey Son uint32_t f_namemax; /* maximum filename length */ 309*1de075a0SStacey Son uint32_t f_owner; /* user that mounted the filesystem */ 310*1de075a0SStacey Son target_freebsd_fsid_t f_fsid; /* filesystem id */ 311*1de075a0SStacey Son char f_charspare[80]; /* spare string space */ 312*1de075a0SStacey Son char f_fstypename[16]; /* filesys type name */ 313*1de075a0SStacey Son char f_mntfromname[88]; /* mount filesystem */ 314*1de075a0SStacey Son char f_mntonname[88]; /* dir on which mounted*/ 315*1de075a0SStacey Son }; 316*1de075a0SStacey Son 317a5b88166SWarner Losh #define safe_syscall0(type, name) \ 318a5b88166SWarner Losh type safe_##name(void) \ 319a5b88166SWarner Losh { \ 320a5b88166SWarner Losh return safe_syscall(SYS_##name); \ 321a5b88166SWarner Losh } 322a5b88166SWarner Losh 323a5b88166SWarner Losh #define safe_syscall1(type, name, type1, arg1) \ 324a5b88166SWarner Losh type safe_##name(type1 arg1) \ 325a5b88166SWarner Losh { \ 326a5b88166SWarner Losh return safe_syscall(SYS_##name, arg1); \ 327a5b88166SWarner Losh } 328a5b88166SWarner Losh 329a5b88166SWarner Losh #define safe_syscall2(type, name, type1, arg1, type2, arg2) \ 330a5b88166SWarner Losh type safe_##name(type1 arg1, type2 arg2) \ 331a5b88166SWarner Losh { \ 332a5b88166SWarner Losh return safe_syscall(SYS_##name, arg1, arg2); \ 333a5b88166SWarner Losh } 334a5b88166SWarner Losh 335a5b88166SWarner Losh #define safe_syscall3(type, name, type1, arg1, type2, arg2, type3, arg3) \ 336a5b88166SWarner Losh type safe_##name(type1 arg1, type2 arg2, type3 arg3) \ 337a5b88166SWarner Losh { \ 338a5b88166SWarner Losh return safe_syscall(SYS_##name, arg1, arg2, arg3); \ 339a5b88166SWarner Losh } 340a5b88166SWarner Losh 341a5b88166SWarner Losh #define safe_syscall4(type, name, type1, arg1, type2, arg2, type3, arg3, \ 342a5b88166SWarner Losh type4, arg4) \ 343a5b88166SWarner Losh type safe_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ 344a5b88166SWarner Losh { \ 345a5b88166SWarner Losh return safe_syscall(SYS_##name, arg1, arg2, arg3, arg4); \ 346a5b88166SWarner Losh } 347a5b88166SWarner Losh 348a5b88166SWarner Losh #define safe_syscall5(type, name, type1, arg1, type2, arg2, type3, arg3, \ 349a5b88166SWarner Losh type4, arg4, type5, arg5) \ 350a5b88166SWarner Losh type safe_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ 351a5b88166SWarner Losh type5 arg5) \ 352a5b88166SWarner Losh { \ 353a5b88166SWarner Losh return safe_syscall(SYS_##name, arg1, arg2, arg3, arg4, arg5); \ 354a5b88166SWarner Losh } 355a5b88166SWarner Losh 356a5b88166SWarner Losh #define safe_syscall6(type, name, type1, arg1, type2, arg2, type3, arg3, \ 357a5b88166SWarner Losh type4, arg4, type5, arg5, type6, arg6) \ 358a5b88166SWarner Losh type safe_##name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ 359a5b88166SWarner Losh type5 arg5, type6 arg6) \ 360a5b88166SWarner Losh { \ 361a5b88166SWarner Losh return safe_syscall(SYS_##name, arg1, arg2, arg3, arg4, arg5, arg6); \ 362a5b88166SWarner Losh } 363a5b88166SWarner Losh 36477d3522bSWarner Losh /* So far all target and host bitmasks are the same */ 365a05cee93SRichard Henderson #undef target_to_host_bitmask 36677d3522bSWarner Losh #define target_to_host_bitmask(x, tbl) (x) 367a05cee93SRichard Henderson #undef host_to_target_bitmask 36877d3522bSWarner Losh #define host_to_target_bitmask(x, tbl) (x) 36977d3522bSWarner Losh 3709c092804SMarkus Armbruster #endif /* SYSCALL_DEFS_H */ 371