xref: /openbmc/qemu/linux-user/syscall_defs.h (revision f2674e31e0b79a8e30335438f274b846d084a383)
131e31b8aSbellard /* common syscall defines for all architectures */
231e31b8aSbellard 
32521d698Sbellard /* Note: although the syscall numbers change between architectures,
42521d698Sbellard    most of them stay the same, so we handle it by puting ifdefs if
52521d698Sbellard    necessary */
62521d698Sbellard 
72521d698Sbellard #define TARGET_NR_exit		  1
82521d698Sbellard #define TARGET_NR_fork		  2
92521d698Sbellard #define TARGET_NR_read		  3
102521d698Sbellard #define TARGET_NR_write		  4
112521d698Sbellard #define TARGET_NR_open		  5
122521d698Sbellard #define TARGET_NR_close		  6
132521d698Sbellard #define TARGET_NR_waitpid		  7
142521d698Sbellard #define TARGET_NR_creat		  8
152521d698Sbellard #define TARGET_NR_link		  9
162521d698Sbellard #define TARGET_NR_unlink		 10
172521d698Sbellard #define TARGET_NR_execve		 11
182521d698Sbellard #define TARGET_NR_chdir		 12
192521d698Sbellard #define TARGET_NR_time		 13
202521d698Sbellard #define TARGET_NR_mknod		 14
212521d698Sbellard #define TARGET_NR_chmod		 15
222521d698Sbellard #define TARGET_NR_lchown		 16
232521d698Sbellard #define TARGET_NR_break		 17
242521d698Sbellard #define TARGET_NR_oldstat		 18
252521d698Sbellard #define TARGET_NR_lseek		 19
262521d698Sbellard #define TARGET_NR_getpid		 20
272521d698Sbellard #define TARGET_NR_mount		 21
282521d698Sbellard #define TARGET_NR_umount		 22
292521d698Sbellard #define TARGET_NR_setuid		 23
302521d698Sbellard #define TARGET_NR_getuid		 24
312521d698Sbellard #define TARGET_NR_stime		 25
322521d698Sbellard #define TARGET_NR_ptrace		 26
332521d698Sbellard #define TARGET_NR_alarm		 27
342521d698Sbellard #define TARGET_NR_oldfstat		 28
352521d698Sbellard #define TARGET_NR_pause		 29
362521d698Sbellard #define TARGET_NR_utime		 30
372521d698Sbellard #define TARGET_NR_stty		 31
382521d698Sbellard #define TARGET_NR_gtty		 32
392521d698Sbellard #define TARGET_NR_access		 33
402521d698Sbellard #define TARGET_NR_nice		 34
412521d698Sbellard #define TARGET_NR_ftime		 35
422521d698Sbellard #define TARGET_NR_sync		 36
432521d698Sbellard #define TARGET_NR_kill		 37
442521d698Sbellard #define TARGET_NR_rename		 38
452521d698Sbellard #define TARGET_NR_mkdir		 39
462521d698Sbellard #define TARGET_NR_rmdir		 40
472521d698Sbellard #define TARGET_NR_dup		 41
482521d698Sbellard #define TARGET_NR_pipe		 42
492521d698Sbellard #define TARGET_NR_times		 43
502521d698Sbellard #define TARGET_NR_prof		 44
512521d698Sbellard #define TARGET_NR_brk		 45
522521d698Sbellard #define TARGET_NR_setgid		 46
532521d698Sbellard #define TARGET_NR_getgid		 47
542521d698Sbellard #define TARGET_NR_signal		 48
552521d698Sbellard #define TARGET_NR_geteuid		 49
562521d698Sbellard #define TARGET_NR_getegid		 50
572521d698Sbellard #define TARGET_NR_acct		 51
582521d698Sbellard #define TARGET_NR_umount2		 52
592521d698Sbellard #define TARGET_NR_lock		 53
602521d698Sbellard #define TARGET_NR_ioctl		 54
612521d698Sbellard #define TARGET_NR_fcntl		 55
622521d698Sbellard #define TARGET_NR_mpx		 56
632521d698Sbellard #define TARGET_NR_setpgid		 57
642521d698Sbellard #define TARGET_NR_ulimit		 58
652521d698Sbellard #define TARGET_NR_oldolduname	 59
662521d698Sbellard #define TARGET_NR_umask		 60
672521d698Sbellard #define TARGET_NR_chroot		 61
682521d698Sbellard #define TARGET_NR_ustat		 62
692521d698Sbellard #define TARGET_NR_dup2		 63
702521d698Sbellard #define TARGET_NR_getppid		 64
712521d698Sbellard #define TARGET_NR_getpgrp		 65
722521d698Sbellard #define TARGET_NR_setsid		 66
732521d698Sbellard #define TARGET_NR_sigaction		 67
742521d698Sbellard #define TARGET_NR_sgetmask		 68
752521d698Sbellard #define TARGET_NR_ssetmask		 69
762521d698Sbellard #define TARGET_NR_setreuid		 70
772521d698Sbellard #define TARGET_NR_setregid		 71
782521d698Sbellard #define TARGET_NR_sigsuspend		 72
792521d698Sbellard #define TARGET_NR_sigpending		 73
802521d698Sbellard #define TARGET_NR_sethostname	 74
812521d698Sbellard #define TARGET_NR_setrlimit		 75
822521d698Sbellard #define TARGET_NR_getrlimit		 76	/* Back compatible 2Gig limited rlimit */
832521d698Sbellard #define TARGET_NR_getrusage		 77
842521d698Sbellard #define TARGET_NR_gettimeofday	 78
852521d698Sbellard #define TARGET_NR_settimeofday	 79
862521d698Sbellard #define TARGET_NR_getgroups		 80
872521d698Sbellard #define TARGET_NR_setgroups		 81
882521d698Sbellard #define TARGET_NR_select		 82
892521d698Sbellard #define TARGET_NR_symlink		 83
902521d698Sbellard #define TARGET_NR_oldlstat		 84
912521d698Sbellard #define TARGET_NR_readlink		 85
922521d698Sbellard #define TARGET_NR_uselib		 86
932521d698Sbellard #define TARGET_NR_swapon		 87
942521d698Sbellard #define TARGET_NR_reboot		 88
952521d698Sbellard #define TARGET_NR_readdir		 89
962521d698Sbellard #define TARGET_NR_mmap		 90
972521d698Sbellard #define TARGET_NR_munmap		 91
982521d698Sbellard #define TARGET_NR_truncate		 92
992521d698Sbellard #define TARGET_NR_ftruncate		 93
1002521d698Sbellard #define TARGET_NR_fchmod		 94
1012521d698Sbellard #define TARGET_NR_fchown		 95
1022521d698Sbellard #define TARGET_NR_getpriority	 96
1032521d698Sbellard #define TARGET_NR_setpriority	 97
1042521d698Sbellard #define TARGET_NR_profil		 98
1052521d698Sbellard #define TARGET_NR_statfs		 99
1062521d698Sbellard #define TARGET_NR_fstatfs		100
1072521d698Sbellard #define TARGET_NR_ioperm		101
1082521d698Sbellard #define TARGET_NR_socketcall		102
1092521d698Sbellard #define TARGET_NR_syslog		103
1102521d698Sbellard #define TARGET_NR_setitimer		104
1112521d698Sbellard #define TARGET_NR_getitimer		105
1122521d698Sbellard #define TARGET_NR_stat		106
1132521d698Sbellard #define TARGET_NR_lstat		107
1142521d698Sbellard #define TARGET_NR_fstat		108
1152521d698Sbellard #define TARGET_NR_olduname		109
1162521d698Sbellard #define TARGET_NR_iopl		110
1172521d698Sbellard #define TARGET_NR_vhangup		111
1182521d698Sbellard #define TARGET_NR_idle		112
1192521d698Sbellard #define TARGET_NR_vm86old		113
1202521d698Sbellard #define TARGET_NR_wait4		114
1212521d698Sbellard #define TARGET_NR_swapoff		115
1222521d698Sbellard #define TARGET_NR_sysinfo		116
1232521d698Sbellard #define TARGET_NR_ipc		117
1242521d698Sbellard #define TARGET_NR_fsync		118
1252521d698Sbellard #define TARGET_NR_sigreturn		119
1262521d698Sbellard #define TARGET_NR_clone		120
1272521d698Sbellard #define TARGET_NR_setdomainname	121
1282521d698Sbellard #define TARGET_NR_uname		122
1292521d698Sbellard #define TARGET_NR_modify_ldt		123
1302521d698Sbellard #define TARGET_NR_adjtimex		124
1312521d698Sbellard #define TARGET_NR_mprotect		125
1322521d698Sbellard #define TARGET_NR_sigprocmask	126
1332521d698Sbellard #define TARGET_NR_create_module	127
1342521d698Sbellard #define TARGET_NR_init_module	128
1352521d698Sbellard #define TARGET_NR_delete_module	129
1362521d698Sbellard #define TARGET_NR_get_kernel_syms	130
1372521d698Sbellard #define TARGET_NR_quotactl		131
1382521d698Sbellard #define TARGET_NR_getpgid		132
1392521d698Sbellard #define TARGET_NR_fchdir		133
1402521d698Sbellard #define TARGET_NR_bdflush		134
1412521d698Sbellard #define TARGET_NR_sysfs		135
1422521d698Sbellard #define TARGET_NR_personality	136
1432521d698Sbellard #define TARGET_NR_afs_syscall	137 /* Syscall for Andrew File System */
1442521d698Sbellard #define TARGET_NR_setfsuid		138
1452521d698Sbellard #define TARGET_NR_setfsgid		139
1462521d698Sbellard #define TARGET_NR__llseek		140
1472521d698Sbellard #define TARGET_NR_getdents		141
1482521d698Sbellard #define TARGET_NR__newselect		142
1492521d698Sbellard #define TARGET_NR_flock		143
1502521d698Sbellard #define TARGET_NR_msync		144
1512521d698Sbellard #define TARGET_NR_readv		145
1522521d698Sbellard #define TARGET_NR_writev		146
1532521d698Sbellard #define TARGET_NR_getsid		147
1542521d698Sbellard #define TARGET_NR_fdatasync		148
1552521d698Sbellard #define TARGET_NR__sysctl		149
1562521d698Sbellard #define TARGET_NR_mlock		150
1572521d698Sbellard #define TARGET_NR_munlock		151
1582521d698Sbellard #define TARGET_NR_mlockall		152
1592521d698Sbellard #define TARGET_NR_munlockall		153
1602521d698Sbellard #define TARGET_NR_sched_setparam		154
1612521d698Sbellard #define TARGET_NR_sched_getparam		155
1622521d698Sbellard #define TARGET_NR_sched_setscheduler		156
1632521d698Sbellard #define TARGET_NR_sched_getscheduler		157
1642521d698Sbellard #define TARGET_NR_sched_yield		158
1652521d698Sbellard #define TARGET_NR_sched_get_priority_max	159
1662521d698Sbellard #define TARGET_NR_sched_get_priority_min	160
1672521d698Sbellard #define TARGET_NR_sched_rr_get_interval	161
1682521d698Sbellard #define TARGET_NR_nanosleep		162
1692521d698Sbellard #define TARGET_NR_mremap		163
1702521d698Sbellard #define TARGET_NR_setresuid		164
1712521d698Sbellard #define TARGET_NR_getresuid		165
1722521d698Sbellard #define TARGET_NR_vm86		166
1732521d698Sbellard #define TARGET_NR_query_module	167
1742521d698Sbellard #define TARGET_NR_poll		168
1752521d698Sbellard #define TARGET_NR_nfsservctl		169
1762521d698Sbellard #define TARGET_NR_setresgid		170
1772521d698Sbellard #define TARGET_NR_getresgid		171
1782521d698Sbellard #define TARGET_NR_prctl              172
1792521d698Sbellard #define TARGET_NR_rt_sigreturn	173
1802521d698Sbellard #define TARGET_NR_rt_sigaction	174
1812521d698Sbellard #define TARGET_NR_rt_sigprocmask	175
1822521d698Sbellard #define TARGET_NR_rt_sigpending	176
1832521d698Sbellard #define TARGET_NR_rt_sigtimedwait	177
1842521d698Sbellard #define TARGET_NR_rt_sigqueueinfo	178
1852521d698Sbellard #define TARGET_NR_rt_sigsuspend	179
1862521d698Sbellard #define TARGET_NR_pread		180
1872521d698Sbellard #define TARGET_NR_pwrite		181
1882521d698Sbellard #define TARGET_NR_chown		182
1892521d698Sbellard #define TARGET_NR_getcwd		183
1902521d698Sbellard #define TARGET_NR_capget		184
1912521d698Sbellard #define TARGET_NR_capset		185
1922521d698Sbellard #define TARGET_NR_sigaltstack	186
1932521d698Sbellard #define TARGET_NR_sendfile		187
1942521d698Sbellard #define TARGET_NR_getpmsg		188	/* some people actually want streams */
1952521d698Sbellard #define TARGET_NR_putpmsg		189	/* some people actually want streams */
1962521d698Sbellard #define TARGET_NR_vfork		190
1972521d698Sbellard #define TARGET_NR_ugetrlimit		191	/* SuS compliant getrlimit */
1982521d698Sbellard #define TARGET_NR_mmap2		192
1992521d698Sbellard #define TARGET_NR_truncate64		193
2002521d698Sbellard #define TARGET_NR_ftruncate64	194
2012521d698Sbellard #define TARGET_NR_stat64		195
2022521d698Sbellard #define TARGET_NR_lstat64		196
2032521d698Sbellard #define TARGET_NR_fstat64		197
2042521d698Sbellard #define TARGET_NR_lchown32		198
2052521d698Sbellard #define TARGET_NR_getuid32		199
2062521d698Sbellard #define TARGET_NR_getgid32		200
2072521d698Sbellard #define TARGET_NR_geteuid32		201
2082521d698Sbellard #define TARGET_NR_getegid32		202
2092521d698Sbellard #define TARGET_NR_setreuid32		203
2102521d698Sbellard #define TARGET_NR_setregid32		204
2112521d698Sbellard #define TARGET_NR_getgroups32	205
2122521d698Sbellard #define TARGET_NR_setgroups32	206
2132521d698Sbellard #define TARGET_NR_fchown32		207
2142521d698Sbellard #define TARGET_NR_setresuid32	208
2152521d698Sbellard #define TARGET_NR_getresuid32	209
2162521d698Sbellard #define TARGET_NR_setresgid32	210
2172521d698Sbellard #define TARGET_NR_getresgid32	211
2182521d698Sbellard #define TARGET_NR_chown32		212
2192521d698Sbellard #define TARGET_NR_setuid32		213
2202521d698Sbellard #define TARGET_NR_setgid32		214
2212521d698Sbellard #define TARGET_NR_setfsuid32		215
2222521d698Sbellard #define TARGET_NR_setfsgid32		216
2232521d698Sbellard 
2242521d698Sbellard #if defined(TARGET_I386)
2252521d698Sbellard #define TARGET_NR_pivot_root		217
2262521d698Sbellard #define TARGET_NR_mincore		218
2272521d698Sbellard #define TARGET_NR_madvise		219
2282521d698Sbellard #define TARGET_NR_madvise1		219	/* delete when C lib stub is removed */
2292521d698Sbellard #define TARGET_NR_getdents64		220
2302521d698Sbellard #endif
2312521d698Sbellard 
2322521d698Sbellard #if defined(TARGET_ARM)
2332521d698Sbellard #define TARGET_NR_getdents64		217
2342521d698Sbellard #define TARGET_NR_pivot_root		218
2352521d698Sbellard #define TARGET_NR_mincore		219
2362521d698Sbellard #define TARGET_NR_madvise		220
2372521d698Sbellard #endif
2382521d698Sbellard 
2392521d698Sbellard #define TARGET_NR_fcntl64		221
2402521d698Sbellard #define TARGET_NR_security		223	/* syscall for security modules */
2412521d698Sbellard #define TARGET_NR_gettid		224
2422521d698Sbellard #define TARGET_NR_readahead		225
2432521d698Sbellard #define TARGET_NR_setxattr		226
2442521d698Sbellard #define TARGET_NR_lsetxattr		227
2452521d698Sbellard #define TARGET_NR_fsetxattr		228
2462521d698Sbellard #define TARGET_NR_getxattr		229
2472521d698Sbellard #define TARGET_NR_lgetxattr		230
2482521d698Sbellard #define TARGET_NR_fgetxattr		231
2492521d698Sbellard #define TARGET_NR_listxattr		232
2502521d698Sbellard #define TARGET_NR_llistxattr		233
2512521d698Sbellard #define TARGET_NR_flistxattr		234
2522521d698Sbellard #define TARGET_NR_removexattr	235
2532521d698Sbellard #define TARGET_NR_lremovexattr	236
2542521d698Sbellard #define TARGET_NR_fremovexattr	237
2552521d698Sbellard #define TARGET_NR_tkill		238
2562521d698Sbellard #define TARGET_NR_sendfile64		239
2572521d698Sbellard #define TARGET_NR_futex		240
2582521d698Sbellard #define TARGET_NR_sched_setaffinity	241
2592521d698Sbellard #define TARGET_NR_sched_getaffinity	242
2602521d698Sbellard #define TARGET_NR_set_thread_area	243
2612521d698Sbellard #define TARGET_NR_get_thread_area	244
2622521d698Sbellard #define TARGET_NR_io_setup		245
2632521d698Sbellard #define TARGET_NR_io_destroy		246
2642521d698Sbellard #define TARGET_NR_io_getevents	247
2652521d698Sbellard #define TARGET_NR_io_submit		248
2662521d698Sbellard #define TARGET_NR_io_cancel		249
2672521d698Sbellard #define TARGET_NR_fadvise64		250
2682521d698Sbellard 
2692521d698Sbellard #define TARGET_NR_exit_group		252
2702521d698Sbellard #define TARGET_NR_lookup_dcookie	253
2712521d698Sbellard #define TARGET_NR_epoll_create	254
2722521d698Sbellard #define TARGET_NR_epoll_ctl		255
2732521d698Sbellard #define TARGET_NR_epoll_wait		256
2742521d698Sbellard #define TARGET_NR_remap_file_pages	257
2752521d698Sbellard #define TARGET_NR_set_tid_address	258
2762521d698Sbellard #define TARGET_NR_timer_create	259
2772521d698Sbellard #define TARGET_NR_timer_settime	(TARGET_NR_timer_create+1)
2782521d698Sbellard #define TARGET_NR_timer_gettime	(TARGET_NR_timer_create+2)
2792521d698Sbellard #define TARGET_NR_timer_getoverrun	(TARGET_NR_timer_create+3)
2802521d698Sbellard #define TARGET_NR_timer_delete	(TARGET_NR_timer_create+4)
2812521d698Sbellard #define TARGET_NR_clock_settime	(TARGET_NR_timer_create+5)
2822521d698Sbellard #define TARGET_NR_clock_gettime	(TARGET_NR_timer_create+6)
2832521d698Sbellard #define TARGET_NR_clock_getres	(TARGET_NR_timer_create+7)
2842521d698Sbellard #define TARGET_NR_clock_nanosleep	(TARGET_NR_timer_create+8)
2852521d698Sbellard 
28631e31b8aSbellard #define SOCKOP_socket           1
28731e31b8aSbellard #define SOCKOP_bind             2
28831e31b8aSbellard #define SOCKOP_connect          3
28931e31b8aSbellard #define SOCKOP_listen           4
29031e31b8aSbellard #define SOCKOP_accept           5
29131e31b8aSbellard #define SOCKOP_getsockname      6
29231e31b8aSbellard #define SOCKOP_getpeername      7
29331e31b8aSbellard #define SOCKOP_socketpair       8
29431e31b8aSbellard #define SOCKOP_send             9
29531e31b8aSbellard #define SOCKOP_recv             10
29631e31b8aSbellard #define SOCKOP_sendto           11
29731e31b8aSbellard #define SOCKOP_recvfrom         12
29831e31b8aSbellard #define SOCKOP_shutdown         13
29931e31b8aSbellard #define SOCKOP_setsockopt       14
30031e31b8aSbellard #define SOCKOP_getsockopt       15
30131e31b8aSbellard #define SOCKOP_sendmsg          16
30231e31b8aSbellard #define SOCKOP_recvmsg          17
30331e31b8aSbellard 
3042521d698Sbellard /*
3052521d698Sbellard  * The following is for compatibility across the various Linux
3062521d698Sbellard  * platforms.  The i386 ioctl numbering scheme doesn't really enforce
3072521d698Sbellard  * a type field.  De facto, however, the top 8 bits of the lower 16
3082521d698Sbellard  * bits are indeed used as a type field, so we might just as well make
3092521d698Sbellard  * this explicit here.  Please be sure to use the decoding macros
3102521d698Sbellard  * below from now on.
3112521d698Sbellard  */
3122521d698Sbellard #define TARGET_IOC_NRBITS	8
3132521d698Sbellard #define TARGET_IOC_TYPEBITS	8
3142521d698Sbellard 
3152521d698Sbellard #if defined(TARGET_I386) || defined(TARGET_ARM)
3162521d698Sbellard 
3172521d698Sbellard #define TARGET_IOC_SIZEBITS	14
3182521d698Sbellard #define TARGET_IOC_DIRBITS	2
3192521d698Sbellard 
3202521d698Sbellard #define TARGET_IOC_NONE	  0U
3212521d698Sbellard #define TARGET_IOC_WRITE  1U
3222521d698Sbellard #define TARGET_IOC_READ	  2U
3232521d698Sbellard 
3242521d698Sbellard #elif defined(TARGET_PPC) || defined(TARGET_ALPHA)
3252521d698Sbellard 
3262521d698Sbellard #define TARGET_IOC_SIZEBITS	13
3272521d698Sbellard #define TARGET_IOC_DIRBITS	3
3282521d698Sbellard 
3292521d698Sbellard #define TARGET_IOC_NONE	  1U
3302521d698Sbellard #define TARGET_IOC_READ	  2U
3312521d698Sbellard #define TARGET_IOC_WRITE  4U
3322521d698Sbellard 
3332521d698Sbellard #else
3342521d698Sbellard #error unsupported CPU
3352521d698Sbellard #endif
3362521d698Sbellard 
3372521d698Sbellard #define TARGET_IOC_NRMASK	((1 << TARGET_IOC_NRBITS)-1)
3382521d698Sbellard #define TARGET_IOC_TYPEMASK	((1 << TARGET_IOC_TYPEBITS)-1)
3392521d698Sbellard #define TARGET_IOC_SIZEMASK	((1 << TARGET_IOC_SIZEBITS)-1)
3402521d698Sbellard #define TARGET_IOC_DIRMASK	((1 << TARGET_IOC_DIRBITS)-1)
3412521d698Sbellard 
3422521d698Sbellard #define TARGET_IOC_NRSHIFT	0
3432521d698Sbellard #define TARGET_IOC_TYPESHIFT	(TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
3442521d698Sbellard #define TARGET_IOC_SIZESHIFT	(TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
3452521d698Sbellard #define TARGET_IOC_DIRSHIFT	(TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
3462521d698Sbellard 
3472521d698Sbellard #define TARGET_IOC(dir,type,nr,size) \
3482521d698Sbellard 	(((dir)  << TARGET_IOC_DIRSHIFT) | \
3492521d698Sbellard 	 ((type) << TARGET_IOC_TYPESHIFT) | \
3502521d698Sbellard 	 ((nr)   << TARGET_IOC_NRSHIFT) | \
3512521d698Sbellard 	 ((size) << TARGET_IOC_SIZESHIFT))
3522521d698Sbellard 
3532521d698Sbellard /* used to create numbers */
3542521d698Sbellard #define TARGET_IO(type,nr)		TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
3552521d698Sbellard #define TARGET_IOR(type,nr,size)	TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
3562521d698Sbellard #define TARGET_IOW(type,nr,size)	TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
3572521d698Sbellard #define TARGET_IOWR(type,nr,size)	TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
3582521d698Sbellard 
3592521d698Sbellard /* the size is automatically computed for these defines */
3602521d698Sbellard #define TARGET_IORU(type,nr)	TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
3612521d698Sbellard #define TARGET_IOWU(type,nr)	TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
3622521d698Sbellard #define TARGET_IOWRU(type,nr)	TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
3632521d698Sbellard 
3647854b056Sbellard struct target_sockaddr {
3657854b056Sbellard     uint16_t sa_family;
3667854b056Sbellard     uint8_t sa_data[14];
3677854b056Sbellard };
3687854b056Sbellard 
36931e31b8aSbellard struct target_timeval {
37031e31b8aSbellard     target_long tv_sec;
37131e31b8aSbellard     target_long tv_usec;
37231e31b8aSbellard };
37331e31b8aSbellard 
3741b6b029eSbellard struct target_timespec {
3751b6b029eSbellard     target_long tv_sec;
3761b6b029eSbellard     target_long tv_nsec;
3771b6b029eSbellard };
3781b6b029eSbellard 
37966fb9763Sbellard struct target_itimerval {
38066fb9763Sbellard     struct target_timeval it_interval;
38166fb9763Sbellard     struct target_timeval it_value;
38266fb9763Sbellard };
38366fb9763Sbellard 
38432f36bceSbellard typedef target_long target_clock_t;
38532f36bceSbellard 
38632f36bceSbellard struct target_tms {
38732f36bceSbellard     target_clock_t tms_utime;
38832f36bceSbellard     target_clock_t tms_stime;
38932f36bceSbellard     target_clock_t tms_cutime;
39032f36bceSbellard     target_clock_t tms_cstime;
39132f36bceSbellard };
39232f36bceSbellard 
393*f2674e31Sbellard struct target_sel_arg_struct {
394*f2674e31Sbellard     target_long n;
395*f2674e31Sbellard     target_long inp, outp, exp;
396*f2674e31Sbellard     target_long tvp;
397*f2674e31Sbellard };
398*f2674e31Sbellard 
39931e31b8aSbellard struct target_iovec {
40031e31b8aSbellard     target_long iov_base;   /* Starting address */
40131e31b8aSbellard     target_long iov_len;   /* Number of bytes */
40231e31b8aSbellard };
40331e31b8aSbellard 
4041a9353d2Sbellard struct target_msghdr {
4051a9353d2Sbellard     target_long	 msg_name;	/* Socket name			*/
4061a9353d2Sbellard     int		 msg_namelen;	/* Length of name		*/
4071a9353d2Sbellard     target_long	 msg_iov;	/* Data blocks			*/
4081a9353d2Sbellard     target_long	 msg_iovlen;	/* Number of blocks		*/
4091a9353d2Sbellard     target_long  msg_control;	/* Per protocol magic (eg BSD file descriptor passing) */
4101a9353d2Sbellard     target_long	 msg_controllen;	/* Length of cmsg list */
4111a9353d2Sbellard     unsigned int msg_flags;
4121a9353d2Sbellard };
4131a9353d2Sbellard 
4147854b056Sbellard struct target_cmsghdr {
4157854b056Sbellard     target_long  cmsg_len;
4167854b056Sbellard     int          cmsg_level;
4177854b056Sbellard     int          cmsg_type;
4187854b056Sbellard };
4197854b056Sbellard 
4207854b056Sbellard #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
4217854b056Sbellard #define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg)
4227854b056Sbellard #define TARGET_CMSG_FIRSTHDR(mhdr) \
4237854b056Sbellard   ((size_t) tswapl((mhdr)->msg_controllen) >= sizeof (struct target_cmsghdr) \
4247854b056Sbellard    ? (struct target_cmsghdr *) tswapl((mhdr)->msg_control) : (struct target_cmsghdr *) NULL)
4257854b056Sbellard #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (target_long) - 1) \
4267854b056Sbellard                                & (size_t) ~(sizeof (target_long) - 1))
4277854b056Sbellard #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
4287854b056Sbellard                                + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)))
4297854b056Sbellard #define TARGET_CMSG_LEN(len)   (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len))
4307854b056Sbellard 
4317854b056Sbellard static __inline__ struct target_cmsghdr *
4327854b056Sbellard __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg)
4337854b056Sbellard {
4347854b056Sbellard   if (tswapl(__cmsg->cmsg_len) < sizeof (struct target_cmsghdr))
4357854b056Sbellard     /* The kernel header does this so there may be a reason.  */
4367854b056Sbellard     return 0;
4377854b056Sbellard 
4387854b056Sbellard   __cmsg = (struct target_cmsghdr *) ((unsigned char *) __cmsg
4397854b056Sbellard                                + TARGET_CMSG_ALIGN (tswapl(__cmsg->cmsg_len)));
4407854b056Sbellard   if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) tswapl(__mhdr->msg_control)
4417854b056Sbellard                                         + tswapl(__mhdr->msg_controllen))
4427854b056Sbellard       || ((unsigned char *) __cmsg + TARGET_CMSG_ALIGN (tswapl(__cmsg->cmsg_len))
4437854b056Sbellard           > ((unsigned char *) tswapl(__mhdr->msg_control)
4447854b056Sbellard              + tswapl(__mhdr->msg_controllen))))
4457854b056Sbellard     /* No more entries.  */
4467854b056Sbellard     return 0;
4477854b056Sbellard   return __cmsg;
4487854b056Sbellard }
4497854b056Sbellard 
4507854b056Sbellard 
45131e31b8aSbellard struct  target_rusage {
45231e31b8aSbellard         struct target_timeval ru_utime;        /* user time used */
45331e31b8aSbellard         struct target_timeval ru_stime;        /* system time used */
45431e31b8aSbellard         target_long    ru_maxrss;              /* maximum resident set size */
45531e31b8aSbellard         target_long    ru_ixrss;               /* integral shared memory size */
45631e31b8aSbellard         target_long    ru_idrss;               /* integral unshared data size */
45731e31b8aSbellard         target_long    ru_isrss;               /* integral unshared stack size */
45831e31b8aSbellard         target_long    ru_minflt;              /* page reclaims */
45931e31b8aSbellard         target_long    ru_majflt;              /* page faults */
46031e31b8aSbellard         target_long    ru_nswap;               /* swaps */
46131e31b8aSbellard         target_long    ru_inblock;             /* block input operations */
46231e31b8aSbellard         target_long    ru_oublock;             /* block output operations */
46331e31b8aSbellard         target_long    ru_msgsnd;              /* messages sent */
46431e31b8aSbellard         target_long    ru_msgrcv;              /* messages received */
46531e31b8aSbellard         target_long    ru_nsignals;            /* signals received */
46631e31b8aSbellard         target_long    ru_nvcsw;               /* voluntary context switches */
46731e31b8aSbellard         target_long    ru_nivcsw;              /* involuntary " */
46831e31b8aSbellard };
46931e31b8aSbellard 
47031e31b8aSbellard typedef struct {
47131e31b8aSbellard         int     val[2];
47231e31b8aSbellard } kernel_fsid_t;
47331e31b8aSbellard 
47472f03900Sbellard struct kernel_statfs {
47531e31b8aSbellard 	int f_type;
47631e31b8aSbellard 	int f_bsize;
47731e31b8aSbellard 	int f_blocks;
47831e31b8aSbellard 	int f_bfree;
47931e31b8aSbellard 	int f_bavail;
48031e31b8aSbellard 	int f_files;
48131e31b8aSbellard 	int f_ffree;
48231e31b8aSbellard         kernel_fsid_t f_fsid;
48331e31b8aSbellard 	int f_namelen;
48431e31b8aSbellard 	int f_spare[6];
48531e31b8aSbellard };
48631e31b8aSbellard 
487dab2ed99Sbellard struct target_dirent {
488dab2ed99Sbellard 	target_long	d_ino;
489dab2ed99Sbellard 	target_long	d_off;
490dab2ed99Sbellard 	unsigned short	d_reclen;
491dab2ed99Sbellard 	char		d_name[256]; /* We must not include limits.h! */
492dab2ed99Sbellard };
493dab2ed99Sbellard 
494dab2ed99Sbellard struct target_dirent64 {
495dab2ed99Sbellard 	uint64_t	d_ino;
496dab2ed99Sbellard 	int64_t		d_off;
497dab2ed99Sbellard 	unsigned short	d_reclen;
498dab2ed99Sbellard 	unsigned char	d_type;
499dab2ed99Sbellard 	char		d_name[256];
500dab2ed99Sbellard };
501dab2ed99Sbellard 
502dab2ed99Sbellard 
50331e31b8aSbellard /* mostly generic signal stuff */
50431e31b8aSbellard #define TARGET_SIG_DFL	((target_long)0)	/* default signal handling */
50531e31b8aSbellard #define TARGET_SIG_IGN	((target_long)1)	/* ignore signal */
50631e31b8aSbellard #define TARGET_SIG_ERR	((target_long)-1)	/* error return from signal */
50731e31b8aSbellard 
50831e31b8aSbellard #ifdef TARGET_MIPS
50931e31b8aSbellard #define TARGET_NSIG	   128
51031e31b8aSbellard #else
51131e31b8aSbellard #define TARGET_NSIG	   64
51231e31b8aSbellard #endif
51331e31b8aSbellard #define TARGET_NSIG_BPW	   TARGET_LONG_BITS
51431e31b8aSbellard #define TARGET_NSIG_WORDS  (TARGET_NSIG / TARGET_NSIG_BPW)
51531e31b8aSbellard 
51631e31b8aSbellard typedef struct {
51731e31b8aSbellard     target_ulong sig[TARGET_NSIG_WORDS];
51831e31b8aSbellard } target_sigset_t;
51931e31b8aSbellard 
52066fb9763Sbellard #ifdef BSWAP_NEEDED
52166fb9763Sbellard static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
52266fb9763Sbellard {
52366fb9763Sbellard     int i;
52466fb9763Sbellard     for(i = 0;i < TARGET_NSIG_WORDS; i++)
52566fb9763Sbellard         d->sig[i] = tswapl(s->sig[i]);
52666fb9763Sbellard }
52766fb9763Sbellard #else
52866fb9763Sbellard static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
52966fb9763Sbellard {
53066fb9763Sbellard     *d = *s;
53166fb9763Sbellard }
53266fb9763Sbellard #endif
53366fb9763Sbellard 
53466fb9763Sbellard static inline void target_siginitset(target_sigset_t *d, target_ulong set)
53566fb9763Sbellard {
53666fb9763Sbellard     int i;
53766fb9763Sbellard     d->sig[0] = set;
53866fb9763Sbellard     for(i = 1;i < TARGET_NSIG_WORDS; i++)
53966fb9763Sbellard         d->sig[i] = 0;
54066fb9763Sbellard }
54166fb9763Sbellard 
54266fb9763Sbellard void host_to_target_sigset(target_sigset_t *d, sigset_t *s);
54366fb9763Sbellard void target_to_host_sigset(sigset_t *d, target_sigset_t *s);
54466fb9763Sbellard void host_to_target_old_sigset(target_ulong *old_sigset,
54566fb9763Sbellard                                const sigset_t *sigset);
54666fb9763Sbellard void target_to_host_old_sigset(sigset_t *sigset,
54766fb9763Sbellard                                const target_ulong *old_sigset);
54866fb9763Sbellard struct target_sigaction;
54966fb9763Sbellard int do_sigaction(int sig, const struct target_sigaction *act,
55066fb9763Sbellard                  struct target_sigaction *oact);
55166fb9763Sbellard 
5522521d698Sbellard #if defined(TARGET_I386) || defined(TARGET_ARM)
5532521d698Sbellard 
5542521d698Sbellard #define TARGET_SA_NOCLDSTOP	0x00000001
5552521d698Sbellard #define TARGET_SA_NOCLDWAIT	0x00000002 /* not supported yet */
5562521d698Sbellard #define TARGET_SA_SIGINFO	0x00000004
5572521d698Sbellard #define TARGET_SA_ONSTACK	0x08000000
5582521d698Sbellard #define TARGET_SA_RESTART	0x10000000
5592521d698Sbellard #define TARGET_SA_NODEFER	0x40000000
5602521d698Sbellard #define TARGET_SA_RESETHAND	0x80000000
5612521d698Sbellard #define TARGET_SA_RESTORER	0x04000000
5622521d698Sbellard 
5632521d698Sbellard #define TARGET_SIGHUP		 1
5642521d698Sbellard #define TARGET_SIGINT		 2
5652521d698Sbellard #define TARGET_SIGQUIT		 3
5662521d698Sbellard #define TARGET_SIGILL		 4
5672521d698Sbellard #define TARGET_SIGTRAP		 5
5682521d698Sbellard #define TARGET_SIGABRT		 6
5692521d698Sbellard #define TARGET_SIGIOT		 6
5702521d698Sbellard #define TARGET_SIGBUS		 7
5712521d698Sbellard #define TARGET_SIGFPE		 8
5722521d698Sbellard #define TARGET_SIGKILL		 9
5732521d698Sbellard #define TARGET_SIGUSR1		10
5742521d698Sbellard #define TARGET_SIGSEGV		11
5752521d698Sbellard #define TARGET_SIGUSR2		12
5762521d698Sbellard #define TARGET_SIGPIPE		13
5772521d698Sbellard #define TARGET_SIGALRM		14
5782521d698Sbellard #define TARGET_SIGTERM		15
5792521d698Sbellard #define TARGET_SIGSTKFLT	16
5802521d698Sbellard #define TARGET_SIGCHLD		17
5812521d698Sbellard #define TARGET_SIGCONT		18
5822521d698Sbellard #define TARGET_SIGSTOP		19
5832521d698Sbellard #define TARGET_SIGTSTP		20
5842521d698Sbellard #define TARGET_SIGTTIN		21
5852521d698Sbellard #define TARGET_SIGTTOU		22
5862521d698Sbellard #define TARGET_SIGURG		23
5872521d698Sbellard #define TARGET_SIGXCPU		24
5882521d698Sbellard #define TARGET_SIGXFSZ		25
5892521d698Sbellard #define TARGET_SIGVTALRM	26
5902521d698Sbellard #define TARGET_SIGPROF		27
5912521d698Sbellard #define TARGET_SIGWINCH	        28
5922521d698Sbellard #define TARGET_SIGIO		29
5932521d698Sbellard #define TARGET_SIGRTMIN         32
5942521d698Sbellard 
5952521d698Sbellard #define TARGET_SIG_BLOCK          0    /* for blocking signals */
5962521d698Sbellard #define TARGET_SIG_UNBLOCK        1    /* for unblocking signals */
5972521d698Sbellard #define TARGET_SIG_SETMASK        2    /* for setting the signal mask */
5982521d698Sbellard 
5992521d698Sbellard struct target_old_sigaction {
6002521d698Sbellard         target_ulong _sa_handler;
6012521d698Sbellard         target_ulong sa_mask;
6022521d698Sbellard         target_ulong sa_flags;
6032521d698Sbellard         target_ulong sa_restorer;
6042521d698Sbellard };
6052521d698Sbellard 
6062521d698Sbellard struct target_sigaction {
6072521d698Sbellard         target_ulong _sa_handler;
6082521d698Sbellard         target_ulong sa_flags;
6092521d698Sbellard         target_ulong sa_restorer;
6102521d698Sbellard         target_sigset_t sa_mask;
6112521d698Sbellard };
6122521d698Sbellard 
6132521d698Sbellard typedef union target_sigval {
6142521d698Sbellard 	int sival_int;
6152521d698Sbellard         target_ulong sival_ptr;
6162521d698Sbellard } target_sigval_t;
6172521d698Sbellard 
6182521d698Sbellard #define TARGET_SI_MAX_SIZE	128
6192521d698Sbellard #define TARGET_SI_PAD_SIZE	((TARGET_SI_MAX_SIZE/sizeof(int)) - 3)
6202521d698Sbellard 
6212521d698Sbellard typedef struct target_siginfo {
6222521d698Sbellard 	int si_signo;
6232521d698Sbellard 	int si_errno;
6242521d698Sbellard 	int si_code;
6252521d698Sbellard 
6262521d698Sbellard 	union {
6272521d698Sbellard 		int _pad[TARGET_SI_PAD_SIZE];
6282521d698Sbellard 
6292521d698Sbellard 		/* kill() */
6302521d698Sbellard 		struct {
6312521d698Sbellard 			pid_t _pid;		/* sender's pid */
6322521d698Sbellard 			uid_t _uid;		/* sender's uid */
6332521d698Sbellard 		} _kill;
6342521d698Sbellard 
6352521d698Sbellard 		/* POSIX.1b timers */
6362521d698Sbellard 		struct {
6372521d698Sbellard 			unsigned int _timer1;
6382521d698Sbellard 			unsigned int _timer2;
6392521d698Sbellard 		} _timer;
6402521d698Sbellard 
6412521d698Sbellard 		/* POSIX.1b signals */
6422521d698Sbellard 		struct {
6432521d698Sbellard 			pid_t _pid;		/* sender's pid */
6442521d698Sbellard 			uid_t _uid;		/* sender's uid */
6452521d698Sbellard 			target_sigval_t _sigval;
6462521d698Sbellard 		} _rt;
6472521d698Sbellard 
6482521d698Sbellard 		/* SIGCHLD */
6492521d698Sbellard 		struct {
6502521d698Sbellard 			pid_t _pid;		/* which child */
6512521d698Sbellard 			uid_t _uid;		/* sender's uid */
6522521d698Sbellard 			int _status;		/* exit code */
6532521d698Sbellard 			target_clock_t _utime;
6542521d698Sbellard                         target_clock_t _stime;
6552521d698Sbellard 		} _sigchld;
6562521d698Sbellard 
6572521d698Sbellard 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
6582521d698Sbellard 		struct {
6592521d698Sbellard 			target_ulong _addr; /* faulting insn/memory ref. */
6602521d698Sbellard 		} _sigfault;
6612521d698Sbellard 
6622521d698Sbellard 		/* SIGPOLL */
6632521d698Sbellard 		struct {
6642521d698Sbellard 			int _band;	/* POLL_IN, POLL_OUT, POLL_MSG */
6652521d698Sbellard 			int _fd;
6662521d698Sbellard 		} _sigpoll;
6672521d698Sbellard 	} _sifields;
6682521d698Sbellard } target_siginfo_t;
6692521d698Sbellard 
6702521d698Sbellard /*
6712521d698Sbellard  * si_code values
6722521d698Sbellard  * Digital reserves positive values for kernel-generated signals.
6732521d698Sbellard  */
6742521d698Sbellard #define TARGET_SI_USER		0	/* sent by kill, sigsend, raise */
6752521d698Sbellard #define TARGET_SI_KERNEL	0x80	/* sent by the kernel from somewhere */
6762521d698Sbellard #define TARGET_SI_QUEUE	-1		/* sent by sigqueue */
6772521d698Sbellard #define TARGET_SI_TIMER -2              /* sent by timer expiration */
6782521d698Sbellard #define TARGET_SI_MESGQ	-3		/* sent by real time mesq state change */
6792521d698Sbellard #define TARGET_SI_ASYNCIO	-4	/* sent by AIO completion */
6802521d698Sbellard #define TARGET_SI_SIGIO	-5		/* sent by queued SIGIO */
6812521d698Sbellard 
6822521d698Sbellard /*
6832521d698Sbellard  * SIGILL si_codes
6842521d698Sbellard  */
6852521d698Sbellard #define TARGET_ILL_ILLOPN	(2)	/* illegal operand */
6862521d698Sbellard 
6872521d698Sbellard /*
6882521d698Sbellard  * SIGFPE si_codes
6892521d698Sbellard  */
6902521d698Sbellard #define TARGET_FPE_INTDIV      (1)  /* integer divide by zero */
6912521d698Sbellard #define TARGET_FPE_INTOVF      (2)  /* integer overflow */
6922521d698Sbellard #define TARGET_FPE_FLTDIV      (3)  /* floating point divide by zero */
6932521d698Sbellard #define TARGET_FPE_FLTOVF      (4)  /* floating point overflow */
6942521d698Sbellard #define TARGET_FPE_FLTUND      (5)  /* floating point underflow */
6952521d698Sbellard #define TARGET_FPE_FLTRES      (6)  /* floating point inexact result */
6962521d698Sbellard #define TARGET_FPE_FLTINV      (7)  /* floating point invalid operation */
6972521d698Sbellard #define TARGET_FPE_FLTSUB      (8)  /* subscript out of range */
6982521d698Sbellard #define TARGET_NSIGFPE         8
6992521d698Sbellard 
7002521d698Sbellard /*
7012521d698Sbellard  * SIGSEGV si_codes
7022521d698Sbellard  */
7032521d698Sbellard #define TARGET_SEGV_MAPERR     (1)  /* address not mapped to object */
7042521d698Sbellard #define TARGET_SEGV_ACCERR     (2)  /* invalid permissions for mapped object */
7052521d698Sbellard 
7062521d698Sbellard /*
7072521d698Sbellard  * SIGTRAP si_codes
7082521d698Sbellard  */
7092521d698Sbellard #define TARGET_TRAP_BRKPT	(1)	/* process breakpoint */
7102521d698Sbellard #define TARGET_TRAP_TRACE	(2)	/* process trace trap */
7112521d698Sbellard 
7122521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */
7132521d698Sbellard 
7149de5e440Sbellard struct target_rlimit {
7159de5e440Sbellard         target_ulong   rlim_cur;
7169de5e440Sbellard         target_ulong   rlim_max;
7179de5e440Sbellard };
7189de5e440Sbellard 
7199de5e440Sbellard struct target_pollfd {
7209de5e440Sbellard     int fd;           /* file descriptor */
7219de5e440Sbellard     short events;     /* requested events */
7229de5e440Sbellard     short revents;    /* returned events */
7239de5e440Sbellard };
7249de5e440Sbellard 
7258e5a0667Sbellard /* virtual terminal ioctls */
7260221cfcdSbellard #define TARGET_KIOCSOUND       0x4B2F	/* start sound generation (0 for off) */
7270221cfcdSbellard #define TARGET_KDMKTONE	       0x4B30	/* generate tone */
7288e5a0667Sbellard #define TARGET_KDGKBTYPE       0x4b33
7290221cfcdSbellard #define TARGET_KDGKBENT	       0x4B46	/* gets one entry in translation table */
7300221cfcdSbellard #define TARGET_KDGKBSENT       0x4B48	/* gets one function key string entry */
7318e5a0667Sbellard 
7322521d698Sbellard #define TARGET_SIOCATMARK      0x8905
7332521d698Sbellard 
73431e31b8aSbellard /* Networking ioctls */
73531e31b8aSbellard #define TARGET_SIOCADDRT       0x890B          /* add routing table entry */
73631e31b8aSbellard #define TARGET_SIOCDELRT       0x890C          /* delete routing table entry */
73731e31b8aSbellard #define TARGET_SIOCGIFNAME     0x8910          /* get iface name               */
73831e31b8aSbellard #define TARGET_SIOCSIFLINK     0x8911          /* set iface channel            */
73931e31b8aSbellard #define TARGET_SIOCGIFCONF     0x8912          /* get iface list               */
74031e31b8aSbellard #define TARGET_SIOCGIFFLAGS    0x8913          /* get flags                    */
74131e31b8aSbellard #define TARGET_SIOCSIFFLAGS    0x8914          /* set flags                    */
74231e31b8aSbellard #define TARGET_SIOCGIFADDR     0x8915          /* get PA address               */
74331e31b8aSbellard #define TARGET_SIOCSIFADDR     0x8916          /* set PA address               */
74431e31b8aSbellard #define TARGET_SIOCGIFDSTADDR  0x8917          /* get remote PA address        */
74531e31b8aSbellard #define TARGET_SIOCSIFDSTADDR  0x8918          /* set remote PA address        */
74631e31b8aSbellard #define TARGET_SIOCGIFBRDADDR  0x8919          /* get broadcast PA address     */
74731e31b8aSbellard #define TARGET_SIOCSIFBRDADDR  0x891a          /* set broadcast PA address     */
74831e31b8aSbellard #define TARGET_SIOCGIFNETMASK  0x891b          /* get network PA mask          */
74931e31b8aSbellard #define TARGET_SIOCSIFNETMASK  0x891c          /* set network PA mask          */
75031e31b8aSbellard #define TARGET_SIOCGIFMETRIC   0x891d          /* get metric                   */
75131e31b8aSbellard #define TARGET_SIOCSIFMETRIC   0x891e          /* set metric                   */
75231e31b8aSbellard #define TARGET_SIOCGIFMEM      0x891f          /* get memory address (BSD)     */
75331e31b8aSbellard #define TARGET_SIOCSIFMEM      0x8920          /* set memory address (BSD)     */
75431e31b8aSbellard #define TARGET_SIOCGIFMTU      0x8921          /* get MTU size                 */
75531e31b8aSbellard #define TARGET_SIOCSIFMTU      0x8922          /* set MTU size                 */
75631e31b8aSbellard #define TARGET_SIOCSIFHWADDR   0x8924          /* set hardware address (NI)    */
75731e31b8aSbellard #define TARGET_SIOCGIFENCAP    0x8925          /* get/set slip encapsulation   */
75831e31b8aSbellard #define TARGET_SIOCSIFENCAP    0x8926
75931e31b8aSbellard #define TARGET_SIOCGIFHWADDR   0x8927          /* Get hardware address         */
76031e31b8aSbellard #define TARGET_SIOCGIFSLAVE    0x8929          /* Driver slaving support       */
76131e31b8aSbellard #define TARGET_SIOCSIFSLAVE    0x8930
76231e31b8aSbellard #define TARGET_SIOCADDMULTI    0x8931          /* Multicast address lists      */
76331e31b8aSbellard #define TARGET_SIOCDELMULTI    0x8932
76431e31b8aSbellard 
76531e31b8aSbellard /* Bridging control calls */
76631e31b8aSbellard #define TARGET_SIOCGIFBR       0x8940          /* Bridging support             */
76731e31b8aSbellard #define TARGET_SIOCSIFBR       0x8941          /* Set bridging options         */
76831e31b8aSbellard 
76931e31b8aSbellard #define TARGET_SIOCGIFTXQLEN   0x8942          /* Get the tx queue length      */
77031e31b8aSbellard #define TARGET_SIOCSIFTXQLEN   0x8943          /* Set the tx queue length      */
77131e31b8aSbellard 
77231e31b8aSbellard /* ARP cache control calls. */
77331e31b8aSbellard #define TARGET_OLD_SIOCDARP    0x8950          /* old delete ARP table entry   */
77431e31b8aSbellard #define TARGET_OLD_SIOCGARP    0x8951          /* old get ARP table entry      */
77531e31b8aSbellard #define TARGET_OLD_SIOCSARP    0x8952          /* old set ARP table entry      */
77631e31b8aSbellard #define TARGET_SIOCDARP        0x8953          /* delete ARP table entry       */
77731e31b8aSbellard #define TARGET_SIOCGARP        0x8954          /* get ARP table entry          */
77831e31b8aSbellard #define TARGET_SIOCSARP        0x8955          /* set ARP table entry          */
77931e31b8aSbellard 
78031e31b8aSbellard /* RARP cache control calls. */
78131e31b8aSbellard #define TARGET_SIOCDRARP       0x8960          /* delete RARP table entry      */
78231e31b8aSbellard #define TARGET_SIOCGRARP       0x8961          /* get RARP table entry         */
78331e31b8aSbellard #define TARGET_SIOCSRARP       0x8962          /* set RARP table entry         */
78431e31b8aSbellard 
78531e31b8aSbellard /* Driver configuration calls */
78631e31b8aSbellard #define TARGET_SIOCGIFMAP      0x8970          /* Get device parameters        */
78731e31b8aSbellard #define TARGET_SIOCSIFMAP      0x8971          /* Set device parameters        */
78831e31b8aSbellard 
78931e31b8aSbellard /* DLCI configuration calls */
79031e31b8aSbellard #define TARGET_SIOCADDDLCI     0x8980          /* Create new DLCI device       */
79131e31b8aSbellard #define TARGET_SIOCDELDLCI     0x8981          /* Delete DLCI device           */
79231e31b8aSbellard 
79331e31b8aSbellard 
79431e31b8aSbellard /* From <linux/fs.h> */
79531e31b8aSbellard 
79631e31b8aSbellard #define TARGET_BLKROSET   TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
79731e31b8aSbellard #define TARGET_BLKROGET   TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
79831e31b8aSbellard #define TARGET_BLKRRPART  TARGET_IO(0x12,95) /* re-read partition table */
79931e31b8aSbellard #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
80031e31b8aSbellard #define TARGET_BLKFLSBUF  TARGET_IO(0x12,97) /* flush buffer cache */
80131e31b8aSbellard #define TARGET_BLKRASET   TARGET_IO(0x12,98) /* Set read ahead for block device */
80231e31b8aSbellard #define TARGET_BLKRAGET   TARGET_IO(0x12,99) /* get current read ahead setting */
80331e31b8aSbellard #define TARGET_BLKFRASET  TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
80431e31b8aSbellard #define TARGET_BLKFRAGET  TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
80531e31b8aSbellard #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
80631e31b8aSbellard #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
80731e31b8aSbellard #define TARGET_BLKSSZGET  TARGET_IO(0x12,104)/* get block device sector size */
80831e31b8aSbellard /* A jump here: 108-111 have been used for various private purposes. */
80931e31b8aSbellard #define TARGET_BLKBSZGET  TARGET_IOR(0x12,112,sizeof(int))
81031e31b8aSbellard #define TARGET_BLKBSZSET  TARGET_IOW(0x12,113,sizeof(int))
81131e31b8aSbellard #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,sizeof(uint64_t)) /* return device size in bytes (u64 *arg) */
81231e31b8aSbellard #define TARGET_FIBMAP     TARGET_IO(0x00,1)  /* bmap access */
81331e31b8aSbellard #define TARGET_FIGETBSZ   TARGET_IO(0x00,2)  /* get the block size used for bmap */
81431e31b8aSbellard 
81531e31b8aSbellard /* cdrom commands */
81631e31b8aSbellard #define TARGET_CDROMPAUSE		0x5301 /* Pause Audio Operation */
81731e31b8aSbellard #define TARGET_CDROMRESUME		0x5302 /* Resume paused Audio Operation */
81831e31b8aSbellard #define TARGET_CDROMPLAYMSF		0x5303 /* Play Audio MSF (struct cdrom_msf) */
81931e31b8aSbellard #define TARGET_CDROMPLAYTRKIND		0x5304 /* Play Audio Track/index
82031e31b8aSbellard                                            (struct cdrom_ti) */
82131e31b8aSbellard #define TARGET_CDROMREADTOCHDR		0x5305 /* Read TOC header
82231e31b8aSbellard                                            (struct cdrom_tochdr) */
82331e31b8aSbellard #define TARGET_CDROMREADTOCENTRY	0x5306 /* Read TOC entry
82431e31b8aSbellard                                            (struct cdrom_tocentry) */
82531e31b8aSbellard #define TARGET_CDROMSTOP		0x5307 /* Stop the cdrom drive */
82631e31b8aSbellard #define TARGET_CDROMSTART		0x5308 /* Start the cdrom drive */
82731e31b8aSbellard #define TARGET_CDROMEJECT		0x5309 /* Ejects the cdrom media */
82831e31b8aSbellard #define TARGET_CDROMVOLCTRL		0x530a /* Control output volume
82931e31b8aSbellard                                            (struct cdrom_volctrl) */
83031e31b8aSbellard #define TARGET_CDROMSUBCHNL		0x530b /* Read subchannel data
83131e31b8aSbellard                                            (struct cdrom_subchnl) */
83231e31b8aSbellard #define TARGET_CDROMREADMODE2		0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
83331e31b8aSbellard                                            (struct cdrom_read) */
83431e31b8aSbellard #define TARGET_CDROMREADMODE1		0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
83531e31b8aSbellard                                            (struct cdrom_read) */
83631e31b8aSbellard #define TARGET_CDROMREADAUDIO		0x530e /* (struct cdrom_read_audio) */
83731e31b8aSbellard #define TARGET_CDROMEJECT_SW		0x530f /* enable(1)/disable(0) auto-ejecting */
83831e31b8aSbellard #define TARGET_CDROMMULTISESSION	0x5310 /* Obtain the start-of-last-session
83931e31b8aSbellard                                            address of multi session disks
84031e31b8aSbellard                                            (struct cdrom_multisession) */
84131e31b8aSbellard #define TARGET_CDROM_GET_MCN		0x5311 /* Obtain the "Universal Product Code"
84231e31b8aSbellard                                            if available (struct cdrom_mcn) */
84331e31b8aSbellard #define TARGET_CDROM_GET_UPC		TARGET_CDROM_GET_MCN  /* This one is depricated,
84431e31b8aSbellard                                           but here anyway for compatability */
84531e31b8aSbellard #define TARGET_CDROMRESET		0x5312 /* hard-reset the drive */
84631e31b8aSbellard #define TARGET_CDROMVOLREAD		0x5313 /* Get the drive's volume setting
84731e31b8aSbellard                                           (struct cdrom_volctrl) */
84831e31b8aSbellard #define TARGET_CDROMREADRAW		0x5314	/* read data in raw mode (2352 Bytes)
84931e31b8aSbellard                                            (struct cdrom_read) */
85031e31b8aSbellard /*
85131e31b8aSbellard  * These ioctls are used only used in aztcd.c and optcd.c
85231e31b8aSbellard  */
85331e31b8aSbellard #define TARGET_CDROMREADCOOKED		0x5315	/* read data in cooked mode */
85431e31b8aSbellard #define TARGET_CDROMSEEK		0x5316  /* seek msf address */
85531e31b8aSbellard 
85631e31b8aSbellard /*
85731e31b8aSbellard  * This ioctl is only used by the scsi-cd driver.
85831e31b8aSbellard    It is for playing audio in logical block addressing mode.
85931e31b8aSbellard  */
86031e31b8aSbellard #define TARGET_CDROMPLAYBLK		0x5317	/* (struct cdrom_blk) */
86131e31b8aSbellard 
86231e31b8aSbellard /*
86331e31b8aSbellard  * These ioctls are only used in optcd.c
86431e31b8aSbellard  */
86531e31b8aSbellard #define TARGET_CDROMREADALL		0x5318	/* read all 2646 bytes */
86631e31b8aSbellard 
86731e31b8aSbellard /*
86831e31b8aSbellard  * These ioctls are (now) only in ide-cd.c for controlling
86931e31b8aSbellard  * drive spindown time.  They should be implemented in the
87031e31b8aSbellard  * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
87131e31b8aSbellard  * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
87231e31b8aSbellard  *  -Erik
87331e31b8aSbellard  */
87431e31b8aSbellard #define TARGET_CDROMGETSPINDOWN        0x531d
87531e31b8aSbellard #define TARGET_CDROMSETSPINDOWN        0x531e
87631e31b8aSbellard 
87731e31b8aSbellard /*
87831e31b8aSbellard  * These ioctls are implemented through the uniform CD-ROM driver
87931e31b8aSbellard  * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
88031e31b8aSbellard  * drivers are eventually ported to the uniform CD-ROM driver interface.
88131e31b8aSbellard  */
88231e31b8aSbellard #define TARGET_CDROMCLOSETRAY		0x5319	/* pendant of CDROMEJECT */
88331e31b8aSbellard #define TARGET_CDROM_SET_OPTIONS	0x5320  /* Set behavior options */
88431e31b8aSbellard #define TARGET_CDROM_CLEAR_OPTIONS	0x5321  /* Clear behavior options */
88531e31b8aSbellard #define TARGET_CDROM_SELECT_SPEED	0x5322  /* Set the CD-ROM speed */
88631e31b8aSbellard #define TARGET_CDROM_SELECT_DISC	0x5323  /* Select disc (for juke-boxes) */
88731e31b8aSbellard #define TARGET_CDROM_MEDIA_CHANGED	0x5325  /* Check is media changed  */
88831e31b8aSbellard #define TARGET_CDROM_DRIVE_STATUS	0x5326  /* Get tray position, etc. */
88931e31b8aSbellard #define TARGET_CDROM_DISC_STATUS	0x5327  /* Get disc type, etc. */
89031e31b8aSbellard #define TARGET_CDROM_CHANGER_NSLOTS    0x5328  /* Get number of slots */
89131e31b8aSbellard #define TARGET_CDROM_LOCKDOOR		0x5329  /* lock or unlock door */
89231e31b8aSbellard #define TARGET_CDROM_DEBUG		0x5330	/* Turn debug messages on/off */
89331e31b8aSbellard #define TARGET_CDROM_GET_CAPABILITY	0x5331	/* get capabilities */
89431e31b8aSbellard 
89531e31b8aSbellard /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
89631e31b8aSbellard  * Future CDROM ioctls should be kept below 0x537F
89731e31b8aSbellard  */
89831e31b8aSbellard 
89931e31b8aSbellard /* This ioctl is only used by sbpcd at the moment */
90031e31b8aSbellard #define TARGET_CDROMAUDIOBUFSIZ        0x5382	/* set the audio buffer size */
90131e31b8aSbellard 					/* conflict with SCSI_IOCTL_GET_IDLUN */
90231e31b8aSbellard 
90331e31b8aSbellard /* DVD-ROM Specific ioctls */
90431e31b8aSbellard #define TARGET_DVD_READ_STRUCT		0x5390  /* Read structure */
90531e31b8aSbellard #define TARGET_DVD_WRITE_STRUCT	0x5391  /* Write structure */
90631e31b8aSbellard #define TARGET_DVD_AUTH		0x5392  /* Authentication */
90731e31b8aSbellard 
90831e31b8aSbellard #define TARGET_CDROM_SEND_PACKET	0x5393	/* send a packet to the drive */
90931e31b8aSbellard #define TARGET_CDROM_NEXT_WRITABLE	0x5394	/* get next writable block */
91031e31b8aSbellard #define TARGET_CDROM_LAST_WRITTEN	0x5395	/* get last block written on disc */
91131e31b8aSbellard 
91231e31b8aSbellard /* HD commands */
91331e31b8aSbellard 
91431e31b8aSbellard /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
91531e31b8aSbellard #define TARGET_HDIO_GETGEO            0x0301  /* get device geometry */
91631e31b8aSbellard #define TARGET_HDIO_GET_UNMASKINTR    0x0302  /* get current unmask setting */
91731e31b8aSbellard #define TARGET_HDIO_GET_MULTCOUNT     0x0304  /* get current IDE blockmode setting */
91831e31b8aSbellard #define TARGET_HDIO_GET_KEEPSETTINGS  0x0308  /* get keep-settings-on-reset flag */
91931e31b8aSbellard #define TARGET_HDIO_GET_32BIT         0x0309  /* get current io_32bit setting */
92031e31b8aSbellard #define TARGET_HDIO_GET_NOWERR        0x030a  /* get ignore-write-error flag */
92131e31b8aSbellard #define TARGET_HDIO_GET_DMA           0x030b  /* get use-dma flag */
9222521d698Sbellard #define TARGET_HDIO_GET_IDENTITY      0x030d  /* get IDE identification info */
92331e31b8aSbellard #define TARGET_HDIO_DRIVE_CMD         0x031f  /* execute a special drive command */
92431e31b8aSbellard 
92531e31b8aSbellard /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
92631e31b8aSbellard #define TARGET_HDIO_SET_MULTCOUNT     0x0321  /* change IDE blockmode */
92731e31b8aSbellard #define TARGET_HDIO_SET_UNMASKINTR    0x0322  /* permit other irqs during I/O */
92831e31b8aSbellard #define TARGET_HDIO_SET_KEEPSETTINGS  0x0323  /* keep ioctl settings on reset */
92931e31b8aSbellard #define TARGET_HDIO_SET_32BIT         0x0324  /* change io_32bit flags */
93031e31b8aSbellard #define TARGET_HDIO_SET_NOWERR        0x0325  /* change ignore-write-error flag */
93131e31b8aSbellard #define TARGET_HDIO_SET_DMA           0x0326  /* change use-dma flag */
93231e31b8aSbellard #define TARGET_HDIO_SET_PIO_MODE      0x0327  /* reconfig interface to new speed */
9332521d698Sbellard 
9342521d698Sbellard 
9352521d698Sbellard #if defined(TARGET_I386) || defined(TARGET_ARM)
9362521d698Sbellard 
9372521d698Sbellard /* 0x54 is just a magic number to make these relatively unique ('T') */
9382521d698Sbellard 
9392521d698Sbellard #define TARGET_TCGETS		0x5401
9402521d698Sbellard #define TARGET_TCSETS		0x5402
9412521d698Sbellard #define TARGET_TCSETSW		0x5403
9422521d698Sbellard #define TARGET_TCSETSF		0x5404
9432521d698Sbellard #define TARGET_TCGETA		0x5405
9442521d698Sbellard #define TARGET_TCSETA		0x5406
9452521d698Sbellard #define TARGET_TCSETAW		0x5407
9462521d698Sbellard #define TARGET_TCSETAF		0x5408
9472521d698Sbellard #define TARGET_TCSBRK		0x5409
9482521d698Sbellard #define TARGET_TCXONC		0x540A
9492521d698Sbellard #define TARGET_TCFLSH		0x540B
9502521d698Sbellard #define TARGET_TIOCEXCL	0x540C
9512521d698Sbellard #define TARGET_TIOCNXCL	0x540D
9522521d698Sbellard #define TARGET_TIOCSCTTY	0x540E
9532521d698Sbellard #define TARGET_TIOCGPGRP	0x540F
9542521d698Sbellard #define TARGET_TIOCSPGRP	0x5410
9552521d698Sbellard #define TARGET_TIOCOUTQ	0x5411
9562521d698Sbellard #define TARGET_TIOCSTI		0x5412
9572521d698Sbellard #define TARGET_TIOCGWINSZ	0x5413
9582521d698Sbellard #define TARGET_TIOCSWINSZ	0x5414
9592521d698Sbellard #define TARGET_TIOCMGET	0x5415
9602521d698Sbellard #define TARGET_TIOCMBIS	0x5416
9612521d698Sbellard #define TARGET_TIOCMBIC	0x5417
9622521d698Sbellard #define TARGET_TIOCMSET	0x5418
9632521d698Sbellard #define TARGET_TIOCGSOFTCAR	0x5419
9642521d698Sbellard #define TARGET_TIOCSSOFTCAR	0x541A
9652521d698Sbellard #define TARGET_FIONREAD	0x541B
9662521d698Sbellard #define TARGET_TIOCINQ		FIONREAD
9672521d698Sbellard #define TARGET_TIOCLINUX	0x541C
9682521d698Sbellard #define TARGET_TIOCCONS	0x541D
9692521d698Sbellard #define TARGET_TIOCGSERIAL	0x541E
9702521d698Sbellard #define TARGET_TIOCSSERIAL	0x541F
9712521d698Sbellard #define TARGET_TIOCPKT		0x5420
9722521d698Sbellard #define TARGET_FIONBIO		0x5421
9732521d698Sbellard #define TARGET_TIOCNOTTY	0x5422
9742521d698Sbellard #define TARGET_TIOCSETD	0x5423
9752521d698Sbellard #define TARGET_TIOCGETD	0x5424
9762521d698Sbellard #define TARGET_TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
9772521d698Sbellard #define TARGET_TIOCTTYGSTRUCT	0x5426  /* For debugging only */
9782521d698Sbellard #define TARGET_TIOCSBRK	0x5427  /* BSD compatibility */
9792521d698Sbellard #define TARGET_TIOCCBRK	0x5428  /* BSD compatibility */
9802521d698Sbellard #define TARGET_TIOCGSID	0x5429  /* Return the session ID of FD */
9812521d698Sbellard #define TARGET_TIOCGPTN	TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
9822521d698Sbellard #define TARGET_TIOCSPTLCK	TARGET_IOW('T',0x31, int)  /* Lock/unlock Pty */
9832521d698Sbellard 
9842521d698Sbellard #define TARGET_FIONCLEX	0x5450  /* these numbers need to be adjusted. */
9852521d698Sbellard #define TARGET_FIOCLEX		0x5451
9862521d698Sbellard #define TARGET_FIOASYNC	0x5452
9872521d698Sbellard #define TARGET_TIOCSERCONFIG	0x5453
9882521d698Sbellard #define TARGET_TIOCSERGWILD	0x5454
9892521d698Sbellard #define TARGET_TIOCSERSWILD	0x5455
9902521d698Sbellard #define TARGET_TIOCGLCKTRMIOS	0x5456
9912521d698Sbellard #define TARGET_TIOCSLCKTRMIOS	0x5457
9922521d698Sbellard #define TARGET_TIOCSERGSTRUCT	0x5458 /* For debugging only */
9932521d698Sbellard #define TARGET_TIOCSERGETLSR   0x5459 /* Get line status register */
9942521d698Sbellard #define TARGET_TIOCSERGETMULTI 0x545A /* Get multiport config  */
9952521d698Sbellard #define TARGET_TIOCSERSETMULTI 0x545B /* Set multiport config */
9962521d698Sbellard 
9972521d698Sbellard #define TARGET_TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
9982521d698Sbellard #define TARGET_TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
9992521d698Sbellard #define TARGET_TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
10002521d698Sbellard #define TARGET_TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
10012521d698Sbellard 
10022521d698Sbellard /* Used for packet mode */
10032521d698Sbellard #define TARGET_TIOCPKT_DATA		 0
10042521d698Sbellard #define TARGET_TIOCPKT_FLUSHREAD	 1
10052521d698Sbellard #define TARGET_TIOCPKT_FLUSHWRITE	 2
10062521d698Sbellard #define TARGET_TIOCPKT_STOP		 4
10072521d698Sbellard #define TARGET_TIOCPKT_START		 8
10082521d698Sbellard #define TARGET_TIOCPKT_NOSTOP		16
10092521d698Sbellard #define TARGET_TIOCPKT_DOSTOP		32
10102521d698Sbellard 
10112521d698Sbellard #define TARGET_TIOCSER_TEMT    0x01	/* Transmitter physically empty */
10122521d698Sbellard 
10132521d698Sbellard /* from asm/termbits.h */
10142521d698Sbellard 
10152521d698Sbellard #define TARGET_NCCS 19
10162521d698Sbellard 
10172521d698Sbellard struct target_termios {
10182521d698Sbellard     unsigned int c_iflag;               /* input mode flags */
10192521d698Sbellard     unsigned int c_oflag;               /* output mode flags */
10202521d698Sbellard     unsigned int c_cflag;               /* control mode flags */
10212521d698Sbellard     unsigned int c_lflag;               /* local mode flags */
10222521d698Sbellard     unsigned char c_line;                    /* line discipline */
10232521d698Sbellard     unsigned char c_cc[TARGET_NCCS];                /* control characters */
10242521d698Sbellard };
10252521d698Sbellard 
10262521d698Sbellard /* c_iflag bits */
10272521d698Sbellard #define TARGET_IGNBRK  0000001
10282521d698Sbellard #define TARGET_BRKINT  0000002
10292521d698Sbellard #define TARGET_IGNPAR  0000004
10302521d698Sbellard #define TARGET_PARMRK  0000010
10312521d698Sbellard #define TARGET_INPCK   0000020
10322521d698Sbellard #define TARGET_ISTRIP  0000040
10332521d698Sbellard #define TARGET_INLCR   0000100
10342521d698Sbellard #define TARGET_IGNCR   0000200
10352521d698Sbellard #define TARGET_ICRNL   0000400
10362521d698Sbellard #define TARGET_IUCLC   0001000
10372521d698Sbellard #define TARGET_IXON    0002000
10382521d698Sbellard #define TARGET_IXANY   0004000
10392521d698Sbellard #define TARGET_IXOFF   0010000
10402521d698Sbellard #define TARGET_IMAXBEL 0020000
10412521d698Sbellard 
10422521d698Sbellard /* c_oflag bits */
10432521d698Sbellard #define TARGET_OPOST   0000001
10442521d698Sbellard #define TARGET_OLCUC   0000002
10452521d698Sbellard #define TARGET_ONLCR   0000004
10462521d698Sbellard #define TARGET_OCRNL   0000010
10472521d698Sbellard #define TARGET_ONOCR   0000020
10482521d698Sbellard #define TARGET_ONLRET  0000040
10492521d698Sbellard #define TARGET_OFILL   0000100
10502521d698Sbellard #define TARGET_OFDEL   0000200
10512521d698Sbellard #define TARGET_NLDLY   0000400
10522521d698Sbellard #define   TARGET_NL0   0000000
10532521d698Sbellard #define   TARGET_NL1   0000400
10542521d698Sbellard #define TARGET_CRDLY   0003000
10552521d698Sbellard #define   TARGET_CR0   0000000
10562521d698Sbellard #define   TARGET_CR1   0001000
10572521d698Sbellard #define   TARGET_CR2   0002000
10582521d698Sbellard #define   TARGET_CR3   0003000
10592521d698Sbellard #define TARGET_TABDLY  0014000
10602521d698Sbellard #define   TARGET_TAB0  0000000
10612521d698Sbellard #define   TARGET_TAB1  0004000
10622521d698Sbellard #define   TARGET_TAB2  0010000
10632521d698Sbellard #define   TARGET_TAB3  0014000
10642521d698Sbellard #define   TARGET_XTABS 0014000
10652521d698Sbellard #define TARGET_BSDLY   0020000
10662521d698Sbellard #define   TARGET_BS0   0000000
10672521d698Sbellard #define   TARGET_BS1   0020000
10682521d698Sbellard #define TARGET_VTDLY   0040000
10692521d698Sbellard #define   TARGET_VT0   0000000
10702521d698Sbellard #define   TARGET_VT1   0040000
10712521d698Sbellard #define TARGET_FFDLY   0100000
10722521d698Sbellard #define   TARGET_FF0   0000000
10732521d698Sbellard #define   TARGET_FF1   0100000
10742521d698Sbellard 
10752521d698Sbellard /* c_cflag bit meaning */
10762521d698Sbellard #define TARGET_CBAUD   0010017
10772521d698Sbellard #define  TARGET_B0     0000000         /* hang up */
10782521d698Sbellard #define  TARGET_B50    0000001
10792521d698Sbellard #define  TARGET_B75    0000002
10802521d698Sbellard #define  TARGET_B110   0000003
10812521d698Sbellard #define  TARGET_B134   0000004
10822521d698Sbellard #define  TARGET_B150   0000005
10832521d698Sbellard #define  TARGET_B200   0000006
10842521d698Sbellard #define  TARGET_B300   0000007
10852521d698Sbellard #define  TARGET_B600   0000010
10862521d698Sbellard #define  TARGET_B1200  0000011
10872521d698Sbellard #define  TARGET_B1800  0000012
10882521d698Sbellard #define  TARGET_B2400  0000013
10892521d698Sbellard #define  TARGET_B4800  0000014
10902521d698Sbellard #define  TARGET_B9600  0000015
10912521d698Sbellard #define  TARGET_B19200 0000016
10922521d698Sbellard #define  TARGET_B38400 0000017
10932521d698Sbellard #define TARGET_EXTA B19200
10942521d698Sbellard #define TARGET_EXTB B38400
10952521d698Sbellard #define TARGET_CSIZE   0000060
10962521d698Sbellard #define   TARGET_CS5   0000000
10972521d698Sbellard #define   TARGET_CS6   0000020
10982521d698Sbellard #define   TARGET_CS7   0000040
10992521d698Sbellard #define   TARGET_CS8   0000060
11002521d698Sbellard #define TARGET_CSTOPB  0000100
11012521d698Sbellard #define TARGET_CREAD   0000200
11022521d698Sbellard #define TARGET_PARENB  0000400
11032521d698Sbellard #define TARGET_PARODD  0001000
11042521d698Sbellard #define TARGET_HUPCL   0002000
11052521d698Sbellard #define TARGET_CLOCAL  0004000
11062521d698Sbellard #define TARGET_CBAUDEX 0010000
11072521d698Sbellard #define  TARGET_B57600  0010001
11082521d698Sbellard #define  TARGET_B115200 0010002
11092521d698Sbellard #define  TARGET_B230400 0010003
11102521d698Sbellard #define  TARGET_B460800 0010004
11112521d698Sbellard #define TARGET_CIBAUD    002003600000  /* input baud rate (not used) */
11122521d698Sbellard #define TARGET_CRTSCTS   020000000000          /* flow control */
11132521d698Sbellard 
11142521d698Sbellard /* c_lflag bits */
11152521d698Sbellard #define TARGET_ISIG    0000001
11162521d698Sbellard #define TARGET_ICANON  0000002
11172521d698Sbellard #define TARGET_XCASE   0000004
11182521d698Sbellard #define TARGET_ECHO    0000010
11192521d698Sbellard #define TARGET_ECHOE   0000020
11202521d698Sbellard #define TARGET_ECHOK   0000040
11212521d698Sbellard #define TARGET_ECHONL  0000100
11222521d698Sbellard #define TARGET_NOFLSH  0000200
11232521d698Sbellard #define TARGET_TOSTOP  0000400
11242521d698Sbellard #define TARGET_ECHOCTL 0001000
11252521d698Sbellard #define TARGET_ECHOPRT 0002000
11262521d698Sbellard #define TARGET_ECHOKE  0004000
11272521d698Sbellard #define TARGET_FLUSHO  0010000
11282521d698Sbellard #define TARGET_PENDIN  0040000
11292521d698Sbellard #define TARGET_IEXTEN  0100000
11302521d698Sbellard 
11312521d698Sbellard /* c_cc character offsets */
11322521d698Sbellard #define TARGET_VINTR	0
11332521d698Sbellard #define TARGET_VQUIT	1
11342521d698Sbellard #define TARGET_VERASE	2
11352521d698Sbellard #define TARGET_VKILL	3
11362521d698Sbellard #define TARGET_VEOF	4
11372521d698Sbellard #define TARGET_VTIME	5
11382521d698Sbellard #define TARGET_VMIN	6
11392521d698Sbellard #define TARGET_VSWTC	7
11402521d698Sbellard #define TARGET_VSTART	8
11412521d698Sbellard #define TARGET_VSTOP	9
11422521d698Sbellard #define TARGET_VSUSP	10
11432521d698Sbellard #define TARGET_VEOL	11
11442521d698Sbellard #define TARGET_VREPRINT	12
11452521d698Sbellard #define TARGET_VDISCARD	13
11462521d698Sbellard #define TARGET_VWERASE	14
11472521d698Sbellard #define TARGET_VLNEXT	15
11482521d698Sbellard #define TARGET_VEOL2	16
11492521d698Sbellard 
11502521d698Sbellard #define TARGET_MAP_SHARED	0x01		/* Share changes */
11512521d698Sbellard #define TARGET_MAP_PRIVATE	0x02		/* Changes are private */
11522521d698Sbellard #define TARGET_MAP_TYPE	0x0f		/* Mask for type of mapping */
11532521d698Sbellard #define TARGET_MAP_FIXED	0x10		/* Interpret addr exactly */
11542521d698Sbellard #define TARGET_MAP_ANONYMOUS	0x20		/* don't use a file */
11552521d698Sbellard 
11562521d698Sbellard #define TARGET_MAP_GROWSDOWN	0x0100		/* stack-like segment */
11572521d698Sbellard #define TARGET_MAP_DENYWRITE	0x0800		/* ETXTBSY */
11582521d698Sbellard #define TARGET_MAP_EXECUTABLE	0x1000		/* mark it as an executable */
11592521d698Sbellard #define TARGET_MAP_LOCKED	0x2000		/* pages are locked */
11602521d698Sbellard #define TARGET_MAP_NORESERVE	0x4000		/* don't check for reservations */
11612521d698Sbellard 
11622521d698Sbellard struct target_stat {
11632521d698Sbellard 	unsigned short st_dev;
11642521d698Sbellard 	unsigned short __pad1;
11652521d698Sbellard 	target_ulong st_ino;
11662521d698Sbellard 	unsigned short st_mode;
11672521d698Sbellard 	unsigned short st_nlink;
11682521d698Sbellard 	unsigned short st_uid;
11692521d698Sbellard 	unsigned short st_gid;
11702521d698Sbellard 	unsigned short st_rdev;
11712521d698Sbellard 	unsigned short __pad2;
11722521d698Sbellard 	target_ulong  st_size;
11732521d698Sbellard 	target_ulong  st_blksize;
11742521d698Sbellard 	target_ulong  st_blocks;
11752521d698Sbellard 	target_ulong  target_st_atime;
11762521d698Sbellard 	target_ulong  __unused1;
11772521d698Sbellard 	target_ulong  target_st_mtime;
11782521d698Sbellard 	target_ulong  __unused2;
11792521d698Sbellard 	target_ulong  target_st_ctime;
11802521d698Sbellard 	target_ulong  __unused3;
11812521d698Sbellard 	target_ulong  __unused4;
11822521d698Sbellard 	target_ulong  __unused5;
11832521d698Sbellard };
11842521d698Sbellard 
11852521d698Sbellard /* This matches struct stat64 in glibc2.1, hence the absolutely
11862521d698Sbellard  * insane amounts of padding around dev_t's.
11872521d698Sbellard  */
11882521d698Sbellard struct target_stat64 {
11892521d698Sbellard 	unsigned short	st_dev;
11902521d698Sbellard 	unsigned char	__pad0[10];
11912521d698Sbellard 
11922521d698Sbellard #define TARGET_STAT64_HAS_BROKEN_ST_INO	1
11932521d698Sbellard 	target_ulong	__st_ino;
11942521d698Sbellard 
11952521d698Sbellard 	unsigned int	st_mode;
11962521d698Sbellard 	unsigned int	st_nlink;
11972521d698Sbellard 
11982521d698Sbellard 	target_ulong	st_uid;
11992521d698Sbellard 	target_ulong	st_gid;
12002521d698Sbellard 
12012521d698Sbellard 	unsigned short	st_rdev;
12022521d698Sbellard 	unsigned char	__pad3[10];
12032521d698Sbellard 
12042521d698Sbellard 	long long	st_size;
12052521d698Sbellard 	target_ulong	st_blksize;
12062521d698Sbellard 
12072521d698Sbellard 	target_ulong	st_blocks;	/* Number 512-byte blocks allocated. */
12082521d698Sbellard 	target_ulong	__pad4;		/* future possible st_blocks high bits */
12092521d698Sbellard 
12102521d698Sbellard 	target_ulong	target_st_atime;
12112521d698Sbellard 	target_ulong	__pad5;
12122521d698Sbellard 
12132521d698Sbellard 	target_ulong	target_st_mtime;
12142521d698Sbellard 	target_ulong	__pad6;
12152521d698Sbellard 
12162521d698Sbellard 	target_ulong	target_st_ctime;
12172521d698Sbellard 	target_ulong	__pad7;		/* will be high 32 bits of ctime someday */
12182521d698Sbellard 
12192521d698Sbellard 	unsigned long long	st_ino;
12202521d698Sbellard } __attribute__((packed));
12212521d698Sbellard 
12222521d698Sbellard #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */
12232521d698Sbellard 
12242521d698Sbellard #define TARGET_F_DUPFD         0       /* dup */
12252521d698Sbellard #define TARGET_F_GETFD         1       /* get close_on_exec */
12262521d698Sbellard #define TARGET_F_SETFD         2       /* set/clear close_on_exec */
12272521d698Sbellard #define TARGET_F_GETFL         3       /* get file->f_flags */
12282521d698Sbellard #define TARGET_F_SETFL         4       /* set file->f_flags */
12292521d698Sbellard 
12302521d698Sbellard #if defined(TARGET_ALPHA)
12312521d698Sbellard #define TARGET_F_GETLK         7
12322521d698Sbellard #define TARGET_F_SETLK         8
12332521d698Sbellard #define TARGET_F_SETLKW        9
12342521d698Sbellard #define TARGET_F_SETOWN        5       /*  for sockets. */
12352521d698Sbellard #define TARGET_F_GETOWN        6       /*  for sockets. */
12362521d698Sbellard #else
12372521d698Sbellard #define TARGET_F_GETLK         5
12382521d698Sbellard #define TARGET_F_SETLK         6
12392521d698Sbellard #define TARGET_F_SETLKW        7
12402521d698Sbellard #define TARGET_F_SETOWN        8       /*  for sockets. */
12412521d698Sbellard #define TARGET_F_GETOWN        9       /*  for sockets. */
12422521d698Sbellard #endif
12432521d698Sbellard 
12442521d698Sbellard #define TARGET_F_SETSIG        10      /*  for sockets. */
12452521d698Sbellard #define TARGET_F_GETSIG        11      /*  for sockets. */
12462521d698Sbellard 
12472521d698Sbellard #define TARGET_F_GETLK64       12      /*  using 'struct flock64' */
12482521d698Sbellard #define TARGET_F_SETLK64       13
12492521d698Sbellard #define TARGET_F_SETLKW64      14
12502521d698Sbellard 
12512521d698Sbellard struct target_flock {
12522521d698Sbellard 	short l_type;
12532521d698Sbellard 	short l_whence;
12542521d698Sbellard 	target_ulong l_start;
12552521d698Sbellard 	target_ulong l_len;
12562521d698Sbellard 	int l_pid;
12572521d698Sbellard };
12582521d698Sbellard 
12592521d698Sbellard struct target_flock64 {
12602521d698Sbellard 	short  l_type;
12612521d698Sbellard 	short  l_whence;
12622521d698Sbellard 	unsigned long long l_start;
12632521d698Sbellard 	unsigned long long l_len;
12642521d698Sbellard 	int  l_pid;
12652521d698Sbellard };
12662521d698Sbellard 
12672521d698Sbellard 
12682521d698Sbellard /* soundcard defines */
12692521d698Sbellard /* XXX: convert them all to arch indepedent entries */
12702521d698Sbellard #define TARGET_SNDCTL_COPR_HALT           TARGET_IOWR('C',  7, int);
12712521d698Sbellard #define TARGET_SNDCTL_COPR_LOAD           0xcfb04301
12722521d698Sbellard #define TARGET_SNDCTL_COPR_RCODE          0xc0144303
12732521d698Sbellard #define TARGET_SNDCTL_COPR_RCVMSG         0x8fa44309
12742521d698Sbellard #define TARGET_SNDCTL_COPR_RDATA          0xc0144302
12752521d698Sbellard #define TARGET_SNDCTL_COPR_RESET          0x00004300
12762521d698Sbellard #define TARGET_SNDCTL_COPR_RUN            0xc0144306
12772521d698Sbellard #define TARGET_SNDCTL_COPR_SENDMSG        0xcfa44308
12782521d698Sbellard #define TARGET_SNDCTL_COPR_WCODE          0x40144305
12792521d698Sbellard #define TARGET_SNDCTL_COPR_WDATA          0x40144304
12802521d698Sbellard #define TARGET_SNDCTL_DSP_RESET           TARGET_IO('P', 0)
12812521d698Sbellard #define TARGET_SNDCTL_DSP_SYNC            TARGET_IO('P', 1)
12822521d698Sbellard #define TARGET_SNDCTL_DSP_SPEED           TARGET_IOWR('P', 2, int)
12832521d698Sbellard #define TARGET_SNDCTL_DSP_STEREO          TARGET_IOWR('P', 3, int)
12842521d698Sbellard #define TARGET_SNDCTL_DSP_GETBLKSIZE      TARGET_IOWR('P', 4, int)
12852521d698Sbellard #define TARGET_SNDCTL_DSP_SETFMT          TARGET_IOWR('P', 5, int)
12862521d698Sbellard #define TARGET_SNDCTL_DSP_CHANNELS        TARGET_IOWR('P', 6, int)
12872521d698Sbellard #define TARGET_SOUND_PCM_WRITE_FILTER     TARGET_IOWR('P', 7, int)
12882521d698Sbellard #define TARGET_SNDCTL_DSP_POST            TARGET_IO('P', 8)
12892521d698Sbellard #define TARGET_SNDCTL_DSP_SUBDIVIDE       TARGET_IOWR('P', 9, int)
12902521d698Sbellard #define TARGET_SNDCTL_DSP_SETFRAGMENT     TARGET_IOWR('P',10, int)
12912521d698Sbellard #define TARGET_SNDCTL_DSP_GETFMTS         TARGET_IOR('P', 11, int)
12922521d698Sbellard #define TARGET_SNDCTL_DSP_GETOSPACE       TARGET_IORU('P',12)
12932521d698Sbellard #define TARGET_SNDCTL_DSP_GETISPACE       TARGET_IORU('P',13)
12942521d698Sbellard #define TARGET_SNDCTL_DSP_GETCAPS         TARGET_IOR('P', 15, int)
12952521d698Sbellard #define TARGET_SNDCTL_DSP_GETTRIGGER      TARGET_IOR('P',16, int)
12962521d698Sbellard #define TARGET_SNDCTL_DSP_GETIPTR         TARGET_IORU('P',17)
12972521d698Sbellard #define TARGET_SNDCTL_DSP_GETOPTR         TARGET_IORU('P',18)
12982521d698Sbellard #define TARGET_SNDCTL_DSP_MAPINBUF        0x80085013
12992521d698Sbellard #define TARGET_SNDCTL_DSP_MAPOUTBUF       0x80085014
13002521d698Sbellard #define TARGET_SNDCTL_DSP_NONBLOCK        0x0000500e
13012521d698Sbellard #define TARGET_SNDCTL_DSP_SAMPLESIZE      0xc0045005
13022521d698Sbellard #define TARGET_SNDCTL_DSP_SETDUPLEX       0x00005016
13032521d698Sbellard #define TARGET_SNDCTL_DSP_SETSYNCRO       0x00005015
13042521d698Sbellard #define TARGET_SNDCTL_DSP_SETTRIGGER      0x40045010
13052521d698Sbellard #define TARGET_SNDCTL_FM_4OP_ENABLE       0x4004510f
13062521d698Sbellard #define TARGET_SNDCTL_FM_LOAD_INSTR       0x40285107
13072521d698Sbellard #define TARGET_SNDCTL_MIDI_INFO           0xc074510c
13082521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUCMD         0xc0216d02
13092521d698Sbellard #define TARGET_SNDCTL_MIDI_MPUMODE        0xc0046d01
13102521d698Sbellard #define TARGET_SNDCTL_MIDI_PRETIME        0xc0046d00
13112521d698Sbellard #define TARGET_SNDCTL_PMGR_ACCESS         0xcfb85110
13122521d698Sbellard #define TARGET_SNDCTL_PMGR_IFACE          0xcfb85001
13132521d698Sbellard #define TARGET_SNDCTL_SEQ_CTRLRATE        0xc0045103
13142521d698Sbellard #define TARGET_SNDCTL_SEQ_GETINCOUNT      0x80045105
13152521d698Sbellard #define TARGET_SNDCTL_SEQ_GETOUTCOUNT     0x80045104
13162521d698Sbellard #define TARGET_SNDCTL_SEQ_NRMIDIS         0x8004510b
13172521d698Sbellard #define TARGET_SNDCTL_SEQ_NRSYNTHS        0x8004510a
13182521d698Sbellard #define TARGET_SNDCTL_SEQ_OUTOFBAND       0x40085112
13192521d698Sbellard #define TARGET_SNDCTL_SEQ_PANIC           0x00005111
13202521d698Sbellard #define TARGET_SNDCTL_SEQ_PERCMODE        0x40045106
13212521d698Sbellard #define TARGET_SNDCTL_SEQ_RESET           0x00005100
13222521d698Sbellard #define TARGET_SNDCTL_SEQ_RESETSAMPLES    0x40045109
13232521d698Sbellard #define TARGET_SNDCTL_SEQ_SYNC            0x00005101
13242521d698Sbellard #define TARGET_SNDCTL_SEQ_TESTMIDI        0x40045108
13252521d698Sbellard #define TARGET_SNDCTL_SEQ_THRESHOLD       0x4004510d
13262521d698Sbellard #define TARGET_SNDCTL_SEQ_TRESHOLD        0x4004510d
13272521d698Sbellard #define TARGET_SNDCTL_SYNTH_INFO          0xc08c5102
13282521d698Sbellard #define TARGET_SNDCTL_SYNTH_MEMAVL        0xc004510e
13292521d698Sbellard #define TARGET_SNDCTL_TMR_CONTINUE        0x00005404
13302521d698Sbellard #define TARGET_SNDCTL_TMR_METRONOME       0x40045407
13312521d698Sbellard #define TARGET_SNDCTL_TMR_SELECT          0x40045408
13322521d698Sbellard #define TARGET_SNDCTL_TMR_SOURCE          0xc0045406
13332521d698Sbellard #define TARGET_SNDCTL_TMR_START           0x00005402
13342521d698Sbellard #define TARGET_SNDCTL_TMR_STOP            0x00005403
13352521d698Sbellard #define TARGET_SNDCTL_TMR_TEMPO           0xc0045405
13362521d698Sbellard #define TARGET_SNDCTL_TMR_TIMEBASE        0xc0045401
13372521d698Sbellard #define TARGET_SOUND_PCM_READ_RATE        0x80045002
13382521d698Sbellard #define TARGET_SOUND_PCM_READ_CHANNELS    0x80045006
13392521d698Sbellard #define TARGET_SOUND_PCM_READ_BITS        0x80045005
13402521d698Sbellard #define TARGET_SOUND_PCM_READ_FILTER      0x80045007
13412521d698Sbellard #define TARGET_SOUND_MIXER_INFO           TARGET_IOR ('M', 101, mixer_info)
13422521d698Sbellard #define TARGET_SOUND_MIXER_ACCESS         0xc0804d66
13432521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE1       TARGET_IOWR('M', 111, int)
13442521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE2       TARGET_IOWR('M', 112, int)
13452521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE3       TARGET_IOWR('M', 113, int)
13462521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE4       TARGET_IOWR('M', 114, int)
13472521d698Sbellard #define TARGET_SOUND_MIXER_PRIVATE5       TARGET_IOWR('M', 115, int)
13482521d698Sbellard 
13492521d698Sbellard #define TARGET_MIXER_READ(dev)	TARGET_IOR('M', dev, int)
13502521d698Sbellard 
13512521d698Sbellard #define TARGET_SOUND_MIXER_READ_VOLUME		TARGET_MIXER_READ(SOUND_MIXER_VOLUME)
13522521d698Sbellard #define TARGET_SOUND_MIXER_READ_BASS		TARGET_MIXER_READ(SOUND_MIXER_BASS)
13532521d698Sbellard #define TARGET_SOUND_MIXER_READ_TREBLE		TARGET_MIXER_READ(SOUND_MIXER_TREBLE)
13542521d698Sbellard #define TARGET_SOUND_MIXER_READ_SYNTH		TARGET_MIXER_READ(SOUND_MIXER_SYNTH)
13552521d698Sbellard #define TARGET_SOUND_MIXER_READ_PCM		TARGET_MIXER_READ(SOUND_MIXER_PCM)
13562521d698Sbellard #define TARGET_SOUND_MIXER_READ_SPEAKER	        TARGET_MIXER_READ(SOUND_MIXER_SPEAKER)
13572521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE		TARGET_MIXER_READ(SOUND_MIXER_LINE)
13582521d698Sbellard #define TARGET_SOUND_MIXER_READ_MIC		TARGET_MIXER_READ(SOUND_MIXER_MIC)
13592521d698Sbellard #define TARGET_SOUND_MIXER_READ_CD		TARGET_MIXER_READ(SOUND_MIXER_CD)
13602521d698Sbellard #define TARGET_SOUND_MIXER_READ_IMIX		TARGET_MIXER_READ(SOUND_MIXER_IMIX)
13612521d698Sbellard #define TARGET_SOUND_MIXER_READ_ALTPCM		TARGET_MIXER_READ(SOUND_MIXER_ALTPCM)
13622521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECLEV		TARGET_MIXER_READ(SOUND_MIXER_RECLEV)
13632521d698Sbellard #define TARGET_SOUND_MIXER_READ_IGAIN		TARGET_MIXER_READ(SOUND_MIXER_IGAIN)
13642521d698Sbellard #define TARGET_SOUND_MIXER_READ_OGAIN		TARGET_MIXER_READ(SOUND_MIXER_OGAIN)
13652521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE1		TARGET_MIXER_READ(SOUND_MIXER_LINE1)
13662521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE2		TARGET_MIXER_READ(SOUND_MIXER_LINE2)
13672521d698Sbellard #define TARGET_SOUND_MIXER_READ_LINE3		TARGET_MIXER_READ(SOUND_MIXER_LINE3)
13682521d698Sbellard 
13692521d698Sbellard /* Obsolete macros */
13702521d698Sbellard #define TARGET_SOUND_MIXER_READ_MUTE		TARGET_MIXER_READ(SOUND_MIXER_MUTE)
13712521d698Sbellard #define TARGET_SOUND_MIXER_READ_ENHANCE	        TARGET_MIXER_READ(SOUND_MIXER_ENHANCE)
13722521d698Sbellard #define TARGET_SOUND_MIXER_READ_LOUD		TARGET_MIXER_READ(SOUND_MIXER_LOUD)
13732521d698Sbellard 
13742521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECSRC		TARGET_MIXER_READ(SOUND_MIXER_RECSRC)
13752521d698Sbellard #define TARGET_SOUND_MIXER_READ_DEVMASK	        TARGET_MIXER_READ(SOUND_MIXER_DEVMASK)
13762521d698Sbellard #define TARGET_SOUND_MIXER_READ_RECMASK	        TARGET_MIXER_READ(SOUND_MIXER_RECMASK)
13772521d698Sbellard #define TARGET_SOUND_MIXER_READ_STEREODEVS	TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)
13782521d698Sbellard #define TARGET_SOUND_MIXER_READ_CAPS		TARGET_MIXER_READ(SOUND_MIXER_CAPS)
13792521d698Sbellard 
13802521d698Sbellard #define TARGET_MIXER_WRITE(dev)		TARGET_IOWR('M', dev, int)
13812521d698Sbellard 
13822521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_VOLUME	TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)
13832521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_BASS		TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
13842521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_TREBLE	TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE)
13852521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SYNTH		TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH)
13862521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_PCM		TARGET_MIXER_WRITE(SOUND_MIXER_PCM)
13872521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_SPEAKER	TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER)
13882521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE		TARGET_MIXER_WRITE(SOUND_MIXER_LINE)
13892521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MIC		TARGET_MIXER_WRITE(SOUND_MIXER_MIC)
13902521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_CD		TARGET_MIXER_WRITE(SOUND_MIXER_CD)
13912521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IMIX		TARGET_MIXER_WRITE(SOUND_MIXER_IMIX)
13922521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ALTPCM	TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM)
13932521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECLEV	TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV)
13942521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_IGAIN		TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN)
13952521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_OGAIN		TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN)
13962521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE1		TARGET_MIXER_WRITE(SOUND_MIXER_LINE1)
13972521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE2		TARGET_MIXER_WRITE(SOUND_MIXER_LINE2)
13982521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LINE3		TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)
13992521d698Sbellard 
14002521d698Sbellard /* Obsolete macros */
14012521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_MUTE		TARGET_MIXER_WRITE(SOUND_MIXER_MUTE)
14022521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_ENHANCE	TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE)
14032521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_LOUD		TARGET_MIXER_WRITE(SOUND_MIXER_LOUD)
14042521d698Sbellard 
14052521d698Sbellard #define TARGET_SOUND_MIXER_WRITE_RECSRC	TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
14062521d698Sbellard 
14072521d698Sbellard /* vfat ioctls */
14082521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_BOTH    TARGET_IORU('r', 1)
14092521d698Sbellard #define TARGET_VFAT_IOCTL_READDIR_SHORT   TARGET_IORU('r', 2)
1410