blob: 63c2bc3db9605addd4c6746871f99e1ee20fae21 [file] [log] [blame]
bellard31e31b82003-02-18 22:55:36 +00001/* common syscall defines for all architectures */
2
bellard2521d692003-06-15 19:58:13 +00003/* Note: although the syscall numbers change between architectures,
4 most of them stay the same, so we handle it by puting ifdefs if
5 necessary */
6
bellard6180a182003-09-30 21:04:53 +00007#include "syscall_nr.h"
bellard2521d692003-06-15 19:58:13 +00008
bellard31e31b82003-02-18 22:55:36 +00009#define SOCKOP_socket 1
10#define SOCKOP_bind 2
11#define SOCKOP_connect 3
12#define SOCKOP_listen 4
13#define SOCKOP_accept 5
14#define SOCKOP_getsockname 6
15#define SOCKOP_getpeername 7
16#define SOCKOP_socketpair 8
17#define SOCKOP_send 9
18#define SOCKOP_recv 10
19#define SOCKOP_sendto 11
20#define SOCKOP_recvfrom 12
21#define SOCKOP_shutdown 13
22#define SOCKOP_setsockopt 14
23#define SOCKOP_getsockopt 15
24#define SOCKOP_sendmsg 16
25#define SOCKOP_recvmsg 17
26
bellard8853f862004-02-22 14:57:26 +000027#define IPCOP_semop 1
28#define IPCOP_semget 2
29#define IPCOP_semctl 3
30#define IPCOP_semtimedop 4
31#define IPCOP_msgsnd 11
32#define IPCOP_msgrcv 12
33#define IPCOP_msgget 13
34#define IPCOP_msgctl 14
35#define IPCOP_shmat 21
36#define IPCOP_shmdt 22
37#define IPCOP_shmget 23
38#define IPCOP_shmctl 24
39
bellard2521d692003-06-15 19:58:13 +000040/*
41 * The following is for compatibility across the various Linux
42 * platforms. The i386 ioctl numbering scheme doesn't really enforce
43 * a type field. De facto, however, the top 8 bits of the lower 16
44 * bits are indeed used as a type field, so we might just as well make
45 * this explicit here. Please be sure to use the decoding macros
46 * below from now on.
47 */
48#define TARGET_IOC_NRBITS 8
49#define TARGET_IOC_TYPEBITS 8
50
Mika Westerberg74d753a2009-04-07 16:57:29 +030051#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
52 || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
53 /* 16 bit uid wrappers emulation */
54#define USE_UID16
55#endif
56
pbrooke6e59062006-10-22 00:18:54 +000057#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
aurel32dccfec62008-11-12 10:01:12 +000058 || defined(TARGET_M68K) || defined(TARGET_CRIS)
bellard2521d692003-06-15 19:58:13 +000059
60#define TARGET_IOC_SIZEBITS 14
61#define TARGET_IOC_DIRBITS 2
62
63#define TARGET_IOC_NONE 0U
64#define TARGET_IOC_WRITE 1U
65#define TARGET_IOC_READ 2U
66
bellard048f6b42005-11-26 18:47:20 +000067#elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
Edgar E. Iglesiasb779e292009-05-20 21:31:33 +020068 defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \
69 defined(TARGET_MIPS)
bellard2521d692003-06-15 19:58:13 +000070
71#define TARGET_IOC_SIZEBITS 13
72#define TARGET_IOC_DIRBITS 3
73
74#define TARGET_IOC_NONE 1U
75#define TARGET_IOC_READ 2U
76#define TARGET_IOC_WRITE 4U
77
78#else
79#error unsupported CPU
80#endif
81
82#define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1)
83#define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1)
84#define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1)
85#define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1)
86
87#define TARGET_IOC_NRSHIFT 0
88#define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
89#define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
90#define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
91
92#define TARGET_IOC(dir,type,nr,size) \
93 (((dir) << TARGET_IOC_DIRSHIFT) | \
94 ((type) << TARGET_IOC_TYPESHIFT) | \
95 ((nr) << TARGET_IOC_NRSHIFT) | \
96 ((size) << TARGET_IOC_SIZESHIFT))
97
98/* used to create numbers */
99#define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
100#define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
101#define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
102#define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
103
104/* the size is automatically computed for these defines */
105#define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
106#define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
107#define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
108
bellard7854b052003-03-29 17:22:23 +0000109struct target_sockaddr {
110 uint16_t sa_family;
111 uint8_t sa_data[14];
112};
113
Lionel Landwerlinb975b832009-04-25 23:30:19 +0200114struct target_in_addr {
115 uint32_t s_addr; /* big endian */
116};
117
118struct target_ip_mreq {
119 struct target_in_addr imr_multiaddr;
120 struct target_in_addr imr_address;
121};
122
123struct target_ip_mreqn {
124 struct target_in_addr imr_multiaddr;
125 struct target_in_addr imr_address;
126 abi_long imr_ifindex;
127};
128
Lionel Landwerlin6e3cb582009-04-25 23:31:18 +0200129struct target_ip_mreq_source {
130 /* big endian */
131 uint32_t imr_multiaddr;
132 uint32_t imr_interface;
133 uint32_t imr_sourceaddr;
134};
135
bellard31e31b82003-02-18 22:55:36 +0000136struct target_timeval {
blueswir1992f48a2007-10-14 16:27:31 +0000137 abi_long tv_sec;
138 abi_long tv_usec;
bellard31e31b82003-02-18 22:55:36 +0000139};
140
bellard1b6b0292003-03-22 17:31:38 +0000141struct target_timespec {
blueswir1992f48a2007-10-14 16:27:31 +0000142 abi_long tv_sec;
143 abi_long tv_nsec;
bellard1b6b0292003-03-22 17:31:38 +0000144};
145
bellard66fb9762003-03-23 01:06:05 +0000146struct target_itimerval {
147 struct target_timeval it_interval;
148 struct target_timeval it_value;
149};
150
Anthony Liguoric227f092009-10-01 16:12:16 -0500151typedef abi_long target_clock_t;
bellard32f36bc2003-03-30 21:29:48 +0000152
bellardc596ed12003-07-13 17:32:31 +0000153#define TARGET_HZ 100
154
bellard32f36bc2003-03-30 21:29:48 +0000155struct target_tms {
Anthony Liguoric227f092009-10-01 16:12:16 -0500156 target_clock_t tms_utime;
157 target_clock_t tms_stime;
158 target_clock_t tms_cutime;
159 target_clock_t tms_cstime;
bellard32f36bc2003-03-30 21:29:48 +0000160};
161
bellard6180a182003-09-30 21:04:53 +0000162struct target_utimbuf {
blueswir1992f48a2007-10-14 16:27:31 +0000163 abi_long actime;
164 abi_long modtime;
bellard6180a182003-09-30 21:04:53 +0000165};
166
bellardf2674e32003-07-09 12:26:09 +0000167struct target_sel_arg_struct {
blueswir1992f48a2007-10-14 16:27:31 +0000168 abi_long n;
169 abi_long inp, outp, exp;
170 abi_long tvp;
bellardf2674e32003-07-09 12:26:09 +0000171};
172
bellard31e31b82003-02-18 22:55:36 +0000173struct target_iovec {
blueswir1992f48a2007-10-14 16:27:31 +0000174 abi_long iov_base; /* Starting address */
175 abi_long iov_len; /* Number of bytes */
bellard31e31b82003-02-18 22:55:36 +0000176};
177
bellard1a9353d2003-03-16 20:28:50 +0000178struct target_msghdr {
blueswir1992f48a2007-10-14 16:27:31 +0000179 abi_long msg_name; /* Socket name */
180 int msg_namelen; /* Length of name */
181 abi_long msg_iov; /* Data blocks */
182 abi_long msg_iovlen; /* Number of blocks */
183 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
184 abi_long msg_controllen; /* Length of cmsg list */
bellard1a9353d2003-03-16 20:28:50 +0000185 unsigned int msg_flags;
186};
187
bellard7854b052003-03-29 17:22:23 +0000188struct target_cmsghdr {
blueswir1992f48a2007-10-14 16:27:31 +0000189 abi_long cmsg_len;
bellard7854b052003-03-29 17:22:23 +0000190 int cmsg_level;
191 int cmsg_type;
192};
193
194#define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
195#define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg)
blueswir1992f48a2007-10-14 16:27:31 +0000196#define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
197 & (size_t) ~(sizeof (abi_long) - 1))
bellard7854b052003-03-29 17:22:23 +0000198#define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
199 + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)))
200#define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len))
201
202static __inline__ struct target_cmsghdr *
203__target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg)
204{
ths2b8bdef2007-05-28 21:35:23 +0000205 struct target_cmsghdr *__ptr;
bellard7854b052003-03-29 17:22:23 +0000206
ths2b8bdef2007-05-28 21:35:23 +0000207 __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg
208 + TARGET_CMSG_ALIGN (tswapl(__cmsg->cmsg_len)));
209 if ((unsigned long)((char *)(__ptr+1) - (char *)(size_t)tswapl(__mhdr->msg_control))
210 > tswapl(__mhdr->msg_controllen))
bellard7854b052003-03-29 17:22:23 +0000211 /* No more entries. */
ths2b8bdef2007-05-28 21:35:23 +0000212 return (struct target_cmsghdr *)0;
bellard7854b052003-03-29 17:22:23 +0000213 return __cmsg;
214}
215
216
bellard31e31b82003-02-18 22:55:36 +0000217struct target_rusage {
218 struct target_timeval ru_utime; /* user time used */
219 struct target_timeval ru_stime; /* system time used */
blueswir1992f48a2007-10-14 16:27:31 +0000220 abi_long ru_maxrss; /* maximum resident set size */
221 abi_long ru_ixrss; /* integral shared memory size */
222 abi_long ru_idrss; /* integral unshared data size */
223 abi_long ru_isrss; /* integral unshared stack size */
224 abi_long ru_minflt; /* page reclaims */
225 abi_long ru_majflt; /* page faults */
226 abi_long ru_nswap; /* swaps */
227 abi_long ru_inblock; /* block input operations */
228 abi_long ru_oublock; /* block output operations */
229 abi_long ru_msgsnd; /* messages sent */
230 abi_long ru_msgrcv; /* messages received */
231 abi_long ru_nsignals; /* signals received */
232 abi_long ru_nvcsw; /* voluntary context switches */
233 abi_long ru_nivcsw; /* involuntary " */
bellard31e31b82003-02-18 22:55:36 +0000234};
235
236typedef struct {
237 int val[2];
Anthony Liguoric227f092009-10-01 16:12:16 -0500238} kernel_fsid_t;
bellard31e31b82003-02-18 22:55:36 +0000239
bellard72f03902003-02-18 23:33:18 +0000240struct kernel_statfs {
bellard31e31b82003-02-18 22:55:36 +0000241 int f_type;
242 int f_bsize;
243 int f_blocks;
244 int f_bfree;
245 int f_bavail;
246 int f_files;
247 int f_ffree;
Anthony Liguoric227f092009-10-01 16:12:16 -0500248 kernel_fsid_t f_fsid;
bellard31e31b82003-02-18 22:55:36 +0000249 int f_namelen;
250 int f_spare[6];
251};
252
bellarddab2ed92003-03-22 15:23:14 +0000253struct target_dirent {
blueswir1992f48a2007-10-14 16:27:31 +0000254 abi_long d_ino;
255 abi_long d_off;
bellarddab2ed92003-03-22 15:23:14 +0000256 unsigned short d_reclen;
257 char d_name[256]; /* We must not include limits.h! */
258};
259
260struct target_dirent64 {
261 uint64_t d_ino;
262 int64_t d_off;
263 unsigned short d_reclen;
264 unsigned char d_type;
265 char d_name[256];
266};
267
268
bellard31e31b82003-02-18 22:55:36 +0000269/* mostly generic signal stuff */
blueswir1992f48a2007-10-14 16:27:31 +0000270#define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */
271#define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */
272#define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */
bellard31e31b82003-02-18 22:55:36 +0000273
274#ifdef TARGET_MIPS
275#define TARGET_NSIG 128
276#else
277#define TARGET_NSIG 64
278#endif
blueswir1992f48a2007-10-14 16:27:31 +0000279#define TARGET_NSIG_BPW TARGET_ABI_BITS
bellard31e31b82003-02-18 22:55:36 +0000280#define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
281
282typedef struct {
blueswir1992f48a2007-10-14 16:27:31 +0000283 abi_ulong sig[TARGET_NSIG_WORDS];
Anthony Liguoric227f092009-10-01 16:12:16 -0500284} target_sigset_t;
bellard31e31b82003-02-18 22:55:36 +0000285
bellard66fb9762003-03-23 01:06:05 +0000286#ifdef BSWAP_NEEDED
Anthony Liguoric227f092009-10-01 16:12:16 -0500287static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
bellard66fb9762003-03-23 01:06:05 +0000288{
289 int i;
290 for(i = 0;i < TARGET_NSIG_WORDS; i++)
291 d->sig[i] = tswapl(s->sig[i]);
292}
293#else
Anthony Liguoric227f092009-10-01 16:12:16 -0500294static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
bellard66fb9762003-03-23 01:06:05 +0000295{
296 *d = *s;
297}
298#endif
299
Anthony Liguoric227f092009-10-01 16:12:16 -0500300static inline void target_siginitset(target_sigset_t *d, abi_ulong set)
bellard66fb9762003-03-23 01:06:05 +0000301{
302 int i;
303 d->sig[0] = set;
304 for(i = 1;i < TARGET_NSIG_WORDS; i++)
305 d->sig[i] = 0;
306}
307
Anthony Liguoric227f092009-10-01 16:12:16 -0500308void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
309void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
blueswir1992f48a2007-10-14 16:27:31 +0000310void host_to_target_old_sigset(abi_ulong *old_sigset,
bellard66fb9762003-03-23 01:06:05 +0000311 const sigset_t *sigset);
ths5fafdf22007-09-16 21:08:06 +0000312void target_to_host_old_sigset(sigset_t *sigset,
blueswir1992f48a2007-10-14 16:27:31 +0000313 const abi_ulong *old_sigset);
bellard66fb9762003-03-23 01:06:05 +0000314struct target_sigaction;
315int do_sigaction(int sig, const struct target_sigaction *act,
316 struct target_sigaction *oact);
317
Edgar E. Iglesiasb779e292009-05-20 21:31:33 +0200318#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined (TARGET_SH4) || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) || defined(TARGET_MICROBLAZE)
bellard2521d692003-06-15 19:58:13 +0000319
bellard048f6b42005-11-26 18:47:20 +0000320#if defined(TARGET_SPARC)
321#define TARGET_SA_NOCLDSTOP 8u
322#define TARGET_SA_NOCLDWAIT 0x100u
323#define TARGET_SA_SIGINFO 0x200u
324#define TARGET_SA_ONSTACK 1u
325#define TARGET_SA_RESTART 2u
326#define TARGET_SA_NODEFER 0x20u
327#define TARGET_SA_RESETHAND 4u
328#elif defined(TARGET_MIPS)
329#define TARGET_SA_NOCLDSTOP 0x00000001
330#define TARGET_SA_NOCLDWAIT 0x00010000
331#define TARGET_SA_SIGINFO 0x00000008
332#define TARGET_SA_ONSTACK 0x08000000
333#define TARGET_SA_NODEFER 0x40000000
334#define TARGET_SA_RESTART 0x10000000
335#define TARGET_SA_RESETHAND 0x80000000
thsd26bc212007-11-08 18:05:37 +0000336#if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64)
337#define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */
ths540635b2007-09-30 01:58:33 +0000338#endif
bellard048f6b42005-11-26 18:47:20 +0000339#else
bellard2521d692003-06-15 19:58:13 +0000340#define TARGET_SA_NOCLDSTOP 0x00000001
341#define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */
342#define TARGET_SA_SIGINFO 0x00000004
343#define TARGET_SA_ONSTACK 0x08000000
344#define TARGET_SA_RESTART 0x10000000
345#define TARGET_SA_NODEFER 0x40000000
346#define TARGET_SA_RESETHAND 0x80000000
347#define TARGET_SA_RESTORER 0x04000000
bellard6d5e2162004-09-30 22:04:13 +0000348#endif
349
350#if defined(TARGET_SPARC)
351
352#define TARGET_SIGHUP 1
353#define TARGET_SIGINT 2
354#define TARGET_SIGQUIT 3
355#define TARGET_SIGILL 4
356#define TARGET_SIGTRAP 5
357#define TARGET_SIGABRT 6
358#define TARGET_SIGIOT 6
359#define TARGET_SIGSTKFLT 7 /* actually EMT */
360#define TARGET_SIGFPE 8
361#define TARGET_SIGKILL 9
362#define TARGET_SIGBUS 10
363#define TARGET_SIGSEGV 11
364#define TARGET_SIGSYS 12
365#define TARGET_SIGPIPE 13
366#define TARGET_SIGALRM 14
367#define TARGET_SIGTERM 15
368#define TARGET_SIGURG 16
369#define TARGET_SIGSTOP 17
370#define TARGET_SIGTSTP 18
371#define TARGET_SIGCONT 19
372#define TARGET_SIGCHLD 20
373#define TARGET_SIGTTIN 21
374#define TARGET_SIGTTOU 22
375#define TARGET_SIGIO 23
376#define TARGET_SIGXCPU 24
377#define TARGET_SIGXFSZ 25
378#define TARGET_SIGVTALRM 26
379#define TARGET_SIGPROF 27
380#define TARGET_SIGWINCH 28
381#define TARGET_SIGPWR 29
382#define TARGET_SIGUSR1 30
383#define TARGET_SIGUSR2 31
384#define TARGET_SIGRTMIN 32
385
386#define TARGET_SIG_BLOCK 0x01 /* for blocking signals */
387#define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */
388#define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */
389
bellard048f6b42005-11-26 18:47:20 +0000390#elif defined(TARGET_MIPS)
391
392#define TARGET_SIGHUP 1 /* Hangup (POSIX). */
393#define TARGET_SIGINT 2 /* Interrupt (ANSI). */
394#define TARGET_SIGQUIT 3 /* Quit (POSIX). */
395#define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */
396#define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */
397#define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */
398#define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */
399#define TARGET_SIGEMT 7
400#define TARGET_SIGSTKFLT 7 /* XXX: incorrect */
401#define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */
402#define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */
403#define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */
404#define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */
405#define TARGET_SIGSYS 12
406#define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */
407#define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */
408#define TARGET_SIGTERM 15 /* Termination (ANSI). */
409#define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */
410#define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */
411#define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */
412#define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */
413#define TARGET_SIGPWR 19 /* Power failure restart (System V). */
414#define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */
415#define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */
416#define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */
417#define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */
418#define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */
419#define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */
420#define TARGET_SIGCONT 25 /* Continue (POSIX). */
421#define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */
422#define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */
423#define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */
424#define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
425#define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
426#define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
427#define TARGET_SIGRTMIN 32
428
429#define TARGET_SIG_BLOCK 1 /* for blocking signals */
430#define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */
431#define TARGET_SIG_SETMASK 3 /* for setting the signal mask */
432
bellard6d5e2162004-09-30 22:04:13 +0000433#else
bellard2521d692003-06-15 19:58:13 +0000434
435#define TARGET_SIGHUP 1
436#define TARGET_SIGINT 2
437#define TARGET_SIGQUIT 3
438#define TARGET_SIGILL 4
439#define TARGET_SIGTRAP 5
440#define TARGET_SIGABRT 6
441#define TARGET_SIGIOT 6
442#define TARGET_SIGBUS 7
443#define TARGET_SIGFPE 8
444#define TARGET_SIGKILL 9
445#define TARGET_SIGUSR1 10
446#define TARGET_SIGSEGV 11
447#define TARGET_SIGUSR2 12
448#define TARGET_SIGPIPE 13
449#define TARGET_SIGALRM 14
450#define TARGET_SIGTERM 15
451#define TARGET_SIGSTKFLT 16
452#define TARGET_SIGCHLD 17
453#define TARGET_SIGCONT 18
454#define TARGET_SIGSTOP 19
455#define TARGET_SIGTSTP 20
456#define TARGET_SIGTTIN 21
457#define TARGET_SIGTTOU 22
458#define TARGET_SIGURG 23
459#define TARGET_SIGXCPU 24
460#define TARGET_SIGXFSZ 25
461#define TARGET_SIGVTALRM 26
462#define TARGET_SIGPROF 27
463#define TARGET_SIGWINCH 28
464#define TARGET_SIGIO 29
bellardc596ed12003-07-13 17:32:31 +0000465#define TARGET_SIGPWR 30
466#define TARGET_SIGSYS 31
bellard2521d692003-06-15 19:58:13 +0000467#define TARGET_SIGRTMIN 32
468
469#define TARGET_SIG_BLOCK 0 /* for blocking signals */
470#define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */
471#define TARGET_SIG_SETMASK 2 /* for setting the signal mask */
472
bellard6d5e2162004-09-30 22:04:13 +0000473#endif
474
Richard Henderson6049f4f2009-12-27 18:30:03 -0800475#if defined(TARGET_ALPHA)
476struct target_old_sigaction {
477 abi_ulong _sa_handler;
478 abi_ulong sa_mask;
479 abi_ulong sa_flags;
480};
bellard106ec872006-06-27 21:08:10 +0000481
Richard Henderson6049f4f2009-12-27 18:30:03 -0800482struct target_rt_sigaction {
483 abi_ulong _sa_handler;
484 abi_ulong sa_flags;
485 target_sigset_t sa_mask;
486};
487
488/* This is the struct used inside the kernel. The ka_restorer
489 field comes from the 5th argument to sys_rt_sigaction. */
490struct target_sigaction {
491 abi_ulong _sa_handler;
492 abi_ulong sa_flags;
493 target_sigset_t sa_mask;
494 abi_ulong sa_restorer;
495};
496#elif defined(TARGET_MIPS)
bellard106ec872006-06-27 21:08:10 +0000497struct target_sigaction {
ths540635b2007-09-30 01:58:33 +0000498 uint32_t sa_flags;
thsd26bc212007-11-08 18:05:37 +0000499#if defined(TARGET_ABI_MIPSN32)
ths540635b2007-09-30 01:58:33 +0000500 uint32_t _sa_handler;
501#else
blueswir1992f48a2007-10-14 16:27:31 +0000502 abi_ulong _sa_handler;
ths540635b2007-09-30 01:58:33 +0000503#endif
Anthony Liguoric227f092009-10-01 16:12:16 -0500504 target_sigset_t sa_mask;
bellard106ec872006-06-27 21:08:10 +0000505};
bellard106ec872006-06-27 21:08:10 +0000506#else
bellard2521d692003-06-15 19:58:13 +0000507struct target_old_sigaction {
blueswir1992f48a2007-10-14 16:27:31 +0000508 abi_ulong _sa_handler;
509 abi_ulong sa_mask;
510 abi_ulong sa_flags;
511 abi_ulong sa_restorer;
bellard2521d692003-06-15 19:58:13 +0000512};
513
514struct target_sigaction {
blueswir1992f48a2007-10-14 16:27:31 +0000515 abi_ulong _sa_handler;
516 abi_ulong sa_flags;
517 abi_ulong sa_restorer;
Anthony Liguoric227f092009-10-01 16:12:16 -0500518 target_sigset_t sa_mask;
bellard2521d692003-06-15 19:58:13 +0000519};
bellard106ec872006-06-27 21:08:10 +0000520#endif
bellard2521d692003-06-15 19:58:13 +0000521
522typedef union target_sigval {
523 int sival_int;
blueswir1992f48a2007-10-14 16:27:31 +0000524 abi_ulong sival_ptr;
Anthony Liguoric227f092009-10-01 16:12:16 -0500525} target_sigval_t;
bellard6d5e2162004-09-30 22:04:13 +0000526#if 0
527#if defined (TARGET_SPARC)
528typedef struct {
529 struct {
blueswir1992f48a2007-10-14 16:27:31 +0000530 abi_ulong psr;
531 abi_ulong pc;
532 abi_ulong npc;
533 abi_ulong y;
534 abi_ulong u_regs[16]; /* globals and ins */
bellard6d5e2162004-09-30 22:04:13 +0000535 } si_regs;
536 int si_mask;
537} __siginfo_t;
538
539typedef struct {
540 unsigned long si_float_regs [32];
541 unsigned long si_fsr;
542 unsigned long si_fpqdepth;
543 struct {
544 unsigned long *insn_addr;
545 unsigned long insn;
546 } si_fpqueue [16];
547} __siginfo_fpu_t;
548#endif
549#endif
bellard2521d692003-06-15 19:58:13 +0000550
551#define TARGET_SI_MAX_SIZE 128
552#define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3)
553
554typedef struct target_siginfo {
pbrook3f53d542009-04-21 00:59:40 +0000555#ifdef TARGET_MIPS
556 int si_signo;
557 int si_code;
558 int si_errno;
559#else
bellard2521d692003-06-15 19:58:13 +0000560 int si_signo;
561 int si_errno;
562 int si_code;
pbrook3f53d542009-04-21 00:59:40 +0000563#endif
bellard2521d692003-06-15 19:58:13 +0000564
565 union {
566 int _pad[TARGET_SI_PAD_SIZE];
567
568 /* kill() */
569 struct {
570 pid_t _pid; /* sender's pid */
571 uid_t _uid; /* sender's uid */
572 } _kill;
573
574 /* POSIX.1b timers */
575 struct {
576 unsigned int _timer1;
577 unsigned int _timer2;
578 } _timer;
579
580 /* POSIX.1b signals */
581 struct {
582 pid_t _pid; /* sender's pid */
583 uid_t _uid; /* sender's uid */
Anthony Liguoric227f092009-10-01 16:12:16 -0500584 target_sigval_t _sigval;
bellard2521d692003-06-15 19:58:13 +0000585 } _rt;
586
587 /* SIGCHLD */
588 struct {
589 pid_t _pid; /* which child */
590 uid_t _uid; /* sender's uid */
591 int _status; /* exit code */
Anthony Liguoric227f092009-10-01 16:12:16 -0500592 target_clock_t _utime;
593 target_clock_t _stime;
bellard2521d692003-06-15 19:58:13 +0000594 } _sigchld;
595
596 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
597 struct {
blueswir1992f48a2007-10-14 16:27:31 +0000598 abi_ulong _addr; /* faulting insn/memory ref. */
bellard2521d692003-06-15 19:58:13 +0000599 } _sigfault;
600
601 /* SIGPOLL */
602 struct {
603 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
604 int _fd;
605 } _sigpoll;
606 } _sifields;
Anthony Liguoric227f092009-10-01 16:12:16 -0500607} target_siginfo_t;
bellard2521d692003-06-15 19:58:13 +0000608
609/*
610 * si_code values
611 * Digital reserves positive values for kernel-generated signals.
612 */
613#define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */
614#define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */
615#define TARGET_SI_QUEUE -1 /* sent by sigqueue */
616#define TARGET_SI_TIMER -2 /* sent by timer expiration */
617#define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */
618#define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */
619#define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */
620
621/*
622 * SIGILL si_codes
623 */
bellardffa65c32004-01-04 23:57:22 +0000624#define TARGET_ILL_ILLOPC (1) /* illegal opcode */
bellard2521d692003-06-15 19:58:13 +0000625#define TARGET_ILL_ILLOPN (2) /* illegal operand */
bellardffa65c32004-01-04 23:57:22 +0000626#define TARGET_ILL_ILLADR (3) /* illegal addressing mode */
627#define TARGET_ILL_ILLTRP (4) /* illegal trap */
628#define TARGET_ILL_PRVOPC (5) /* privileged opcode */
629#define TARGET_ILL_PRVREG (6) /* privileged register */
630#define TARGET_ILL_COPROC (7) /* coprocessor error */
631#define TARGET_ILL_BADSTK (8) /* internal stack error */
bellard2521d692003-06-15 19:58:13 +0000632
633/*
634 * SIGFPE si_codes
635 */
636#define TARGET_FPE_INTDIV (1) /* integer divide by zero */
637#define TARGET_FPE_INTOVF (2) /* integer overflow */
638#define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */
639#define TARGET_FPE_FLTOVF (4) /* floating point overflow */
640#define TARGET_FPE_FLTUND (5) /* floating point underflow */
641#define TARGET_FPE_FLTRES (6) /* floating point inexact result */
642#define TARGET_FPE_FLTINV (7) /* floating point invalid operation */
643#define TARGET_FPE_FLTSUB (8) /* subscript out of range */
644#define TARGET_NSIGFPE 8
645
646/*
647 * SIGSEGV si_codes
648 */
649#define TARGET_SEGV_MAPERR (1) /* address not mapped to object */
650#define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */
651
652/*
bellardffa65c32004-01-04 23:57:22 +0000653 * SIGBUS si_codes
654 */
655#define TARGET_BUS_ADRALN (1) /* invalid address alignment */
656#define TARGET_BUS_ADRERR (2) /* non-existant physical address */
657#define TARGET_BUS_OBJERR (3) /* object specific hardware error */
658
659/*
bellard2521d692003-06-15 19:58:13 +0000660 * SIGTRAP si_codes
661 */
662#define TARGET_TRAP_BRKPT (1) /* process breakpoint */
663#define TARGET_TRAP_TRACE (2) /* process trace trap */
664
665#endif /* defined(TARGET_I386) || defined(TARGET_ARM) */
666
bellard9de5e442003-03-23 16:49:39 +0000667struct target_rlimit {
blueswir1992f48a2007-10-14 16:27:31 +0000668 abi_ulong rlim_cur;
669 abi_ulong rlim_max;
bellard9de5e442003-03-23 16:49:39 +0000670};
671
672struct target_pollfd {
673 int fd; /* file descriptor */
674 short events; /* requested events */
675 short revents; /* returned events */
676};
677
bellard8e5a0662003-05-08 15:42:10 +0000678/* virtual terminal ioctls */
bellard0221cfc2003-05-10 12:38:16 +0000679#define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */
680#define TARGET_KDMKTONE 0x4B30 /* generate tone */
bellard8e5a0662003-05-08 15:42:10 +0000681#define TARGET_KDGKBTYPE 0x4b33
Ulrich Hechtf7680a52009-10-16 17:00:44 +0200682#define TARGET_KDSETMODE 0x4b3a
683#define TARGET_KDGKBMODE 0x4b44
684#define TARGET_KDSKBMODE 0x4b45
bellard0221cfc2003-05-10 12:38:16 +0000685#define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */
686#define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */
bellard8e5a0662003-05-08 15:42:10 +0000687
bellard2521d692003-06-15 19:58:13 +0000688#define TARGET_SIOCATMARK 0x8905
689
bellard31e31b82003-02-18 22:55:36 +0000690/* Networking ioctls */
691#define TARGET_SIOCADDRT 0x890B /* add routing table entry */
692#define TARGET_SIOCDELRT 0x890C /* delete routing table entry */
693#define TARGET_SIOCGIFNAME 0x8910 /* get iface name */
694#define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */
695#define TARGET_SIOCGIFCONF 0x8912 /* get iface list */
696#define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */
697#define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */
698#define TARGET_SIOCGIFADDR 0x8915 /* get PA address */
699#define TARGET_SIOCSIFADDR 0x8916 /* set PA address */
700#define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */
701#define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */
702#define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */
703#define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */
704#define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */
705#define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */
706#define TARGET_SIOCGIFMETRIC 0x891d /* get metric */
707#define TARGET_SIOCSIFMETRIC 0x891e /* set metric */
708#define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */
709#define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */
710#define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */
711#define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */
712#define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */
713#define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */
714#define TARGET_SIOCSIFENCAP 0x8926
715#define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */
716#define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */
717#define TARGET_SIOCSIFSLAVE 0x8930
718#define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */
719#define TARGET_SIOCDELMULTI 0x8932
720
721/* Bridging control calls */
722#define TARGET_SIOCGIFBR 0x8940 /* Bridging support */
723#define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */
724
725#define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
726#define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
727
728/* ARP cache control calls. */
729#define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */
730#define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */
731#define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */
732#define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */
733#define TARGET_SIOCGARP 0x8954 /* get ARP table entry */
734#define TARGET_SIOCSARP 0x8955 /* set ARP table entry */
735
736/* RARP cache control calls. */
737#define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */
738#define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */
739#define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */
740
741/* Driver configuration calls */
742#define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */
743#define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */
744
745/* DLCI configuration calls */
746#define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */
747#define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */
748
749
750/* From <linux/fs.h> */
751
752#define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
753#define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
754#define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */
755#define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
756#define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */
757#define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */
758#define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */
759#define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
760#define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
761#define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
762#define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
763#define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */
764/* A jump here: 108-111 have been used for various private purposes. */
765#define TARGET_BLKBSZGET TARGET_IOR(0x12,112,sizeof(int))
766#define TARGET_BLKBSZSET TARGET_IOW(0x12,113,sizeof(int))
767#define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,sizeof(uint64_t)) /* return device size in bytes (u64 *arg) */
768#define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */
769#define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */
770
771/* cdrom commands */
ths5fafdf22007-09-16 21:08:06 +0000772#define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */
bellard31e31b82003-02-18 22:55:36 +0000773#define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */
774#define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */
ths5fafdf22007-09-16 21:08:06 +0000775#define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index
bellard31e31b82003-02-18 22:55:36 +0000776 (struct cdrom_ti) */
ths5fafdf22007-09-16 21:08:06 +0000777#define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header
bellard31e31b82003-02-18 22:55:36 +0000778 (struct cdrom_tochdr) */
ths5fafdf22007-09-16 21:08:06 +0000779#define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry
bellard31e31b82003-02-18 22:55:36 +0000780 (struct cdrom_tocentry) */
781#define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */
782#define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */
783#define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */
ths5fafdf22007-09-16 21:08:06 +0000784#define TARGET_CDROMVOLCTRL 0x530a /* Control output volume
bellard31e31b82003-02-18 22:55:36 +0000785 (struct cdrom_volctrl) */
ths5fafdf22007-09-16 21:08:06 +0000786#define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data
bellard31e31b82003-02-18 22:55:36 +0000787 (struct cdrom_subchnl) */
ths5fafdf22007-09-16 21:08:06 +0000788#define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
bellard31e31b82003-02-18 22:55:36 +0000789 (struct cdrom_read) */
790#define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
791 (struct cdrom_read) */
792#define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */
793#define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */
ths5fafdf22007-09-16 21:08:06 +0000794#define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session
795 address of multi session disks
bellard31e31b82003-02-18 22:55:36 +0000796 (struct cdrom_multisession) */
ths5fafdf22007-09-16 21:08:06 +0000797#define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code"
bellard31e31b82003-02-18 22:55:36 +0000798 if available (struct cdrom_mcn) */
ths5fafdf22007-09-16 21:08:06 +0000799#define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is depricated,
bellard31e31b82003-02-18 22:55:36 +0000800 but here anyway for compatability */
801#define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */
ths5fafdf22007-09-16 21:08:06 +0000802#define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting
bellard31e31b82003-02-18 22:55:36 +0000803 (struct cdrom_volctrl) */
804#define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes)
805 (struct cdrom_read) */
ths5fafdf22007-09-16 21:08:06 +0000806/*
bellard31e31b82003-02-18 22:55:36 +0000807 * These ioctls are used only used in aztcd.c and optcd.c
808 */
809#define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */
810#define TARGET_CDROMSEEK 0x5316 /* seek msf address */
ths3b46e622007-09-17 08:09:54 +0000811
bellard31e31b82003-02-18 22:55:36 +0000812/*
ths3b46e622007-09-17 08:09:54 +0000813 * This ioctl is only used by the scsi-cd driver.
bellard31e31b82003-02-18 22:55:36 +0000814 It is for playing audio in logical block addressing mode.
815 */
816#define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */
817
ths5fafdf22007-09-16 21:08:06 +0000818/*
bellard31e31b82003-02-18 22:55:36 +0000819 * These ioctls are only used in optcd.c
820 */
821#define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */
822
ths5fafdf22007-09-16 21:08:06 +0000823/*
824 * These ioctls are (now) only in ide-cd.c for controlling
bellard31e31b82003-02-18 22:55:36 +0000825 * drive spindown time. They should be implemented in the
826 * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
827 * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
828 * -Erik
829 */
830#define TARGET_CDROMGETSPINDOWN 0x531d
831#define TARGET_CDROMSETSPINDOWN 0x531e
832
ths5fafdf22007-09-16 21:08:06 +0000833/*
bellard31e31b82003-02-18 22:55:36 +0000834 * These ioctls are implemented through the uniform CD-ROM driver
835 * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
836 * drivers are eventually ported to the uniform CD-ROM driver interface.
837 */
838#define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
839#define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */
840#define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */
841#define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */
842#define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */
843#define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */
844#define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
845#define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */
846#define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */
847#define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */
848#define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */
849#define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
850
851/* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
852 * Future CDROM ioctls should be kept below 0x537F
853 */
854
855/* This ioctl is only used by sbpcd at the moment */
856#define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */
857 /* conflict with SCSI_IOCTL_GET_IDLUN */
858
859/* DVD-ROM Specific ioctls */
860#define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */
861#define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */
862#define TARGET_DVD_AUTH 0x5392 /* Authentication */
863
864#define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */
865#define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */
866#define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */
867
868/* HD commands */
869
870/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
871#define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */
872#define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
873#define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
bellard31e31b82003-02-18 22:55:36 +0000874#define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
875#define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
876#define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
877#define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */
bellard2521d692003-06-15 19:58:13 +0000878#define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
bellard31e31b82003-02-18 22:55:36 +0000879#define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
880
881/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
882#define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
883#define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
884#define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
885#define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
886#define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
887#define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */
888#define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
bellard2521d692003-06-15 19:58:13 +0000889
balrogb8005912008-04-26 14:44:49 +0000890/* loop ioctls */
891#define TARGET_LOOP_SET_FD 0x4C00
892#define TARGET_LOOP_CLR_FD 0x4C01
893#define TARGET_LOOP_SET_STATUS 0x4C02
894#define TARGET_LOOP_GET_STATUS 0x4C03
895#define TARGET_LOOP_SET_STATUS64 0x4C04
896#define TARGET_LOOP_GET_STATUS64 0x4C05
897#define TARGET_LOOP_CHANGE_FD 0x4C06
bellard2521d692003-06-15 19:58:13 +0000898
Ulrich Hechtf7680a52009-10-16 17:00:44 +0200899/* fb ioctls */
900#define TARGET_FBIOGET_VSCREENINFO 0x4600
901#define TARGET_FBIOPUT_VSCREENINFO 0x4601
902#define TARGET_FBIOGET_FSCREENINFO 0x4602
903
904/* vt ioctls */
905#define TARGET_VT_OPENQRY 0x5600
906#define TARGET_VT_GETSTATE 0x5603
907#define TARGET_VT_ACTIVATE 0x5606
908#define TARGET_VT_WAITACTIVE 0x5607
909#define TARGET_VT_LOCKSWITCH 0x560b
910#define TARGET_VT_UNLOCKSWITCH 0x560c
911
bellard2521d692003-06-15 19:58:13 +0000912/* from asm/termbits.h */
913
bellard3bfd9da2004-01-04 15:52:31 +0000914#define TARGET_NCC 8
915struct target_termio {
916 unsigned short c_iflag; /* input mode flags */
917 unsigned short c_oflag; /* output mode flags */
918 unsigned short c_cflag; /* control mode flags */
919 unsigned short c_lflag; /* local mode flags */
920 unsigned char c_line; /* line discipline */
921 unsigned char c_cc[TARGET_NCC]; /* control characters */
bellard2521d692003-06-15 19:58:13 +0000922};
923
bellard3bfd9da2004-01-04 15:52:31 +0000924struct target_winsize {
925 unsigned short ws_row;
926 unsigned short ws_col;
927 unsigned short ws_xpixel;
928 unsigned short ws_ypixel;
929};
bellard2521d692003-06-15 19:58:13 +0000930
bellard3bfd9da2004-01-04 15:52:31 +0000931#include "termbits.h"
bellard2521d692003-06-15 19:58:13 +0000932
aurel32e44a3e72008-09-29 17:23:09 +0000933/* Common */
bellard2521d692003-06-15 19:58:13 +0000934#define TARGET_MAP_SHARED 0x01 /* Share changes */
935#define TARGET_MAP_PRIVATE 0x02 /* Changes are private */
aurel32e44a3e72008-09-29 17:23:09 +0000936#define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */
937
938/* Target specific */
bellard048f6b42005-11-26 18:47:20 +0000939#if defined(TARGET_MIPS)
aurel32e44a3e72008-09-29 17:23:09 +0000940#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
bellard048f6b42005-11-26 18:47:20 +0000941#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */
942#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */
943#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */
944#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */
945#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */
946#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */
ths540635b2007-09-30 01:58:33 +0000947#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
948#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */
aurel32e44a3e72008-09-29 17:23:09 +0000949#elif defined(TARGET_PPC)
950#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
bellard2521d692003-06-15 19:58:13 +0000951#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
bellard2521d692003-06-15 19:58:13 +0000952#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */
953#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
954#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
j_mayer7ec931962007-09-18 21:54:57 +0000955#define TARGET_MAP_LOCKED 0x0080 /* pages are locked */
956#define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */
aurel32e44a3e72008-09-29 17:23:09 +0000957#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
958#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */
959#elif defined(TARGET_ALPHA)
960#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */
961#define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */
962#define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */
963#define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */
964#define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */
965#define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */
966#define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */
967#define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */
968#define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */
j_mayer7ec931962007-09-18 21:54:57 +0000969#else
aurel32e44a3e72008-09-29 17:23:09 +0000970#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
971#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
972#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */
973#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
974#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
bellard2521d692003-06-15 19:58:13 +0000975#define TARGET_MAP_LOCKED 0x2000 /* pages are locked */
976#define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */
ths540635b2007-09-30 01:58:33 +0000977#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
978#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */
j_mayer7ec931962007-09-18 21:54:57 +0000979#endif
bellard2521d692003-06-15 19:58:13 +0000980
bellardd2fd1af2007-11-14 18:08:56 +0000981#if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) || defined(TARGET_CRIS)
bellard2521d692003-06-15 19:58:13 +0000982struct target_stat {
983 unsigned short st_dev;
984 unsigned short __pad1;
blueswir1992f48a2007-10-14 16:27:31 +0000985 abi_ulong st_ino;
bellard2521d692003-06-15 19:58:13 +0000986 unsigned short st_mode;
987 unsigned short st_nlink;
988 unsigned short st_uid;
989 unsigned short st_gid;
990 unsigned short st_rdev;
991 unsigned short __pad2;
blueswir1992f48a2007-10-14 16:27:31 +0000992 abi_ulong st_size;
993 abi_ulong st_blksize;
994 abi_ulong st_blocks;
995 abi_ulong target_st_atime;
996 abi_ulong __unused1;
997 abi_ulong target_st_mtime;
998 abi_ulong __unused2;
999 abi_ulong target_st_ctime;
1000 abi_ulong __unused3;
1001 abi_ulong __unused4;
1002 abi_ulong __unused5;
bellard2521d692003-06-15 19:58:13 +00001003};
1004
1005/* This matches struct stat64 in glibc2.1, hence the absolutely
1006 * insane amounts of padding around dev_t's.
1007 */
1008struct target_stat64 {
1009 unsigned short st_dev;
1010 unsigned char __pad0[10];
1011
1012#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
blueswir1992f48a2007-10-14 16:27:31 +00001013 abi_ulong __st_ino;
bellard2521d692003-06-15 19:58:13 +00001014
1015 unsigned int st_mode;
1016 unsigned int st_nlink;
1017
blueswir1992f48a2007-10-14 16:27:31 +00001018 abi_ulong st_uid;
1019 abi_ulong st_gid;
bellard2521d692003-06-15 19:58:13 +00001020
1021 unsigned short st_rdev;
1022 unsigned char __pad3[10];
1023
1024 long long st_size;
blueswir1992f48a2007-10-14 16:27:31 +00001025 abi_ulong st_blksize;
bellard2521d692003-06-15 19:58:13 +00001026
blueswir1992f48a2007-10-14 16:27:31 +00001027 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */
1028 abi_ulong __pad4; /* future possible st_blocks high bits */
bellard2521d692003-06-15 19:58:13 +00001029
blueswir1992f48a2007-10-14 16:27:31 +00001030 abi_ulong target_st_atime;
1031 abi_ulong __pad5;
bellard2521d692003-06-15 19:58:13 +00001032
blueswir1992f48a2007-10-14 16:27:31 +00001033 abi_ulong target_st_mtime;
1034 abi_ulong __pad6;
bellard2521d692003-06-15 19:58:13 +00001035
blueswir1992f48a2007-10-14 16:27:31 +00001036 abi_ulong target_st_ctime;
1037 abi_ulong __pad7; /* will be high 32 bits of ctime someday */
bellard2521d692003-06-15 19:58:13 +00001038
1039 unsigned long long st_ino;
1040} __attribute__((packed));
1041
pbrookce4defa2006-02-09 16:49:55 +00001042#ifdef TARGET_ARM
1043struct target_eabi_stat64 {
1044 unsigned long long st_dev;
1045 unsigned int __pad1;
blueswir1992f48a2007-10-14 16:27:31 +00001046 abi_ulong __st_ino;
pbrookce4defa2006-02-09 16:49:55 +00001047 unsigned int st_mode;
1048 unsigned int st_nlink;
1049
blueswir1992f48a2007-10-14 16:27:31 +00001050 abi_ulong st_uid;
1051 abi_ulong st_gid;
pbrookce4defa2006-02-09 16:49:55 +00001052
1053 unsigned long long st_rdev;
1054 unsigned int __pad2[2];
1055
1056 long long st_size;
blueswir1992f48a2007-10-14 16:27:31 +00001057 abi_ulong st_blksize;
pbrookce4defa2006-02-09 16:49:55 +00001058 unsigned int __pad3;
1059 unsigned long long st_blocks;
1060
blueswir1992f48a2007-10-14 16:27:31 +00001061 abi_ulong target_st_atime;
1062 abi_ulong target_st_atime_nsec;
pbrookce4defa2006-02-09 16:49:55 +00001063
blueswir1992f48a2007-10-14 16:27:31 +00001064 abi_ulong target_st_mtime;
1065 abi_ulong target_st_mtime_nsec;
pbrookce4defa2006-02-09 16:49:55 +00001066
blueswir1992f48a2007-10-14 16:27:31 +00001067 abi_ulong target_st_ctime;
1068 abi_ulong target_st_ctime_nsec;
pbrookce4defa2006-02-09 16:49:55 +00001069
1070 unsigned long long st_ino;
1071} __attribute__ ((packed));
1072#endif
1073
blueswir1992f48a2007-10-14 16:27:31 +00001074#elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
blueswir11b8dd642007-07-08 10:08:24 +00001075struct target_stat {
1076 unsigned int st_dev;
blueswir1992f48a2007-10-14 16:27:31 +00001077 abi_ulong st_ino;
blueswir11b8dd642007-07-08 10:08:24 +00001078 unsigned int st_mode;
1079 unsigned int st_nlink;
1080 unsigned int st_uid;
1081 unsigned int st_gid;
1082 unsigned int st_rdev;
blueswir1992f48a2007-10-14 16:27:31 +00001083 abi_long st_size;
1084 abi_long target_st_atime;
1085 abi_long target_st_mtime;
1086 abi_long target_st_ctime;
1087 abi_long st_blksize;
1088 abi_long st_blocks;
1089 abi_ulong __unused4[2];
blueswir11b8dd642007-07-08 10:08:24 +00001090};
1091
1092struct target_stat64 {
1093 unsigned char __pad0[6];
1094 unsigned short st_dev;
1095
1096 uint64_t st_ino;
1097 uint64_t st_nlink;
1098
1099 unsigned int st_mode;
1100
1101 unsigned int st_uid;
1102 unsigned int st_gid;
1103
1104 unsigned char __pad2[6];
1105 unsigned short st_rdev;
1106
1107 int64_t st_size;
1108 int64_t st_blksize;
1109
1110 unsigned char __pad4[4];
1111 unsigned int st_blocks;
1112
blueswir1992f48a2007-10-14 16:27:31 +00001113 abi_ulong target_st_atime;
1114 abi_ulong __unused1;
blueswir11b8dd642007-07-08 10:08:24 +00001115
blueswir1992f48a2007-10-14 16:27:31 +00001116 abi_ulong target_st_mtime;
1117 abi_ulong __unused2;
blueswir11b8dd642007-07-08 10:08:24 +00001118
blueswir1992f48a2007-10-14 16:27:31 +00001119 abi_ulong target_st_ctime;
1120 abi_ulong __unused3;
blueswir11b8dd642007-07-08 10:08:24 +00001121
blueswir1992f48a2007-10-14 16:27:31 +00001122 abi_ulong __unused4[3];
blueswir11b8dd642007-07-08 10:08:24 +00001123};
1124
bellard3bfd9da2004-01-04 15:52:31 +00001125#elif defined(TARGET_SPARC)
1126
1127struct target_stat {
1128 unsigned short st_dev;
blueswir1992f48a2007-10-14 16:27:31 +00001129 abi_ulong st_ino;
bellard3bfd9da2004-01-04 15:52:31 +00001130 unsigned short st_mode;
1131 short st_nlink;
1132 unsigned short st_uid;
1133 unsigned short st_gid;
1134 unsigned short st_rdev;
blueswir1992f48a2007-10-14 16:27:31 +00001135 abi_long st_size;
1136 abi_long target_st_atime;
1137 abi_ulong __unused1;
1138 abi_long target_st_mtime;
1139 abi_ulong __unused2;
1140 abi_long target_st_ctime;
1141 abi_ulong __unused3;
1142 abi_long st_blksize;
1143 abi_long st_blocks;
1144 abi_ulong __unused4[2];
bellard3bfd9da2004-01-04 15:52:31 +00001145};
1146
1147struct target_stat64 {
1148 unsigned char __pad0[6];
1149 unsigned short st_dev;
1150
1151 uint64_t st_ino;
1152
1153 unsigned int st_mode;
1154 unsigned int st_nlink;
1155
1156 unsigned int st_uid;
1157 unsigned int st_gid;
1158
1159 unsigned char __pad2[6];
1160 unsigned short st_rdev;
1161
1162 unsigned char __pad3[8];
1163
1164 int64_t st_size;
1165 unsigned int st_blksize;
1166
1167 unsigned char __pad4[8];
1168 unsigned int st_blocks;
1169
1170 unsigned int target_st_atime;
1171 unsigned int __unused1;
1172
1173 unsigned int target_st_mtime;
1174 unsigned int __unused2;
1175
1176 unsigned int target_st_ctime;
1177 unsigned int __unused3;
1178
1179 unsigned int __unused4;
1180 unsigned int __unused5;
1181};
1182
bellard67867302003-11-23 17:05:30 +00001183#elif defined(TARGET_PPC)
1184
1185struct target_stat {
j_mayere32448e2007-12-10 08:24:59 +00001186 abi_ulong st_dev;
blueswir1992f48a2007-10-14 16:27:31 +00001187 abi_ulong st_ino;
j_mayer325e6512007-11-21 13:06:54 +00001188#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
j_mayere32448e2007-12-10 08:24:59 +00001189 abi_ulong st_nlink;
j_mayer325e6512007-11-21 13:06:54 +00001190 unsigned int st_mode;
1191#else
bellard67867302003-11-23 17:05:30 +00001192 unsigned int st_mode;
1193 unsigned short st_nlink;
j_mayer325e6512007-11-21 13:06:54 +00001194#endif
bellard67867302003-11-23 17:05:30 +00001195 unsigned int st_uid;
1196 unsigned int st_gid;
j_mayere32448e2007-12-10 08:24:59 +00001197 abi_ulong st_rdev;
blueswir1992f48a2007-10-14 16:27:31 +00001198 abi_ulong st_size;
1199 abi_ulong st_blksize;
1200 abi_ulong st_blocks;
1201 abi_ulong target_st_atime;
j_mayere32448e2007-12-10 08:24:59 +00001202 abi_ulong target_st_atime_nsec;
blueswir1992f48a2007-10-14 16:27:31 +00001203 abi_ulong target_st_mtime;
j_mayere32448e2007-12-10 08:24:59 +00001204 abi_ulong target_st_mtime_nsec;
blueswir1992f48a2007-10-14 16:27:31 +00001205 abi_ulong target_st_ctime;
j_mayere32448e2007-12-10 08:24:59 +00001206 abi_ulong target_st_ctime_nsec;
blueswir1992f48a2007-10-14 16:27:31 +00001207 abi_ulong __unused4;
1208 abi_ulong __unused5;
j_mayer325e6512007-11-21 13:06:54 +00001209#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1210 abi_ulong __unused6;
1211#endif
bellard67867302003-11-23 17:05:30 +00001212};
1213
aurel32e1ce5e42009-01-30 19:48:32 +00001214struct __attribute__((__packed__)) target_stat64 {
bellard67867302003-11-23 17:05:30 +00001215 unsigned long long st_dev;
bellard67867302003-11-23 17:05:30 +00001216 unsigned long long st_ino;
bellard3bfd9da2004-01-04 15:52:31 +00001217 unsigned int st_mode;
1218 unsigned int st_nlink;
bellard67867302003-11-23 17:05:30 +00001219 unsigned int st_uid;
1220 unsigned int st_gid;
bellard3bfd9da2004-01-04 15:52:31 +00001221 unsigned long long st_rdev;
aurel32e1ce5e42009-01-30 19:48:32 +00001222 unsigned long long __pad0;
j_mayere32448e2007-12-10 08:24:59 +00001223 long long st_size;
1224 int st_blksize;
aurel32e1ce5e42009-01-30 19:48:32 +00001225 unsigned int __pad1;
Max Filippov61322e92009-09-01 23:27:47 +04001226 long long st_blocks; /* Number 512-byte blocks allocated. */
j_mayere32448e2007-12-10 08:24:59 +00001227 int target_st_atime;
1228 unsigned int target_st_atime_nsec;
1229 int target_st_mtime;
1230 unsigned int target_st_mtime_nsec;
1231 int target_st_ctime;
1232 unsigned int target_st_ctime_nsec;
1233 unsigned int __unused4;
1234 unsigned int __unused5;
bellard67867302003-11-23 17:05:30 +00001235};
1236
Edgar E. Iglesiasb779e292009-05-20 21:31:33 +02001237#elif defined(TARGET_MICROBLAZE)
1238
1239struct target_stat {
1240 abi_ulong st_dev;
1241 abi_ulong st_ino;
1242 unsigned int st_mode;
1243 unsigned short st_nlink;
1244 unsigned int st_uid;
1245 unsigned int st_gid;
1246 abi_ulong st_rdev;
1247 abi_ulong st_size;
1248 abi_ulong st_blksize;
1249 abi_ulong st_blocks;
1250 abi_ulong target_st_atime;
1251 abi_ulong target_st_atime_nsec;
1252 abi_ulong target_st_mtime;
1253 abi_ulong target_st_mtime_nsec;
1254 abi_ulong target_st_ctime;
1255 abi_ulong target_st_ctime_nsec;
1256 abi_ulong __unused4;
1257 abi_ulong __unused5;
1258};
1259
1260/* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */
1261struct __attribute__((__packed__)) target_stat64 {
1262 uint64_t st_dev;
1263 uint64_t st_ino;
1264 uint32_t st_mode;
1265 uint32_t st_nlink;
1266 uint32_t st_uid;
1267 uint32_t st_gid;
1268 uint64_t st_rdev;
Edgar E. Iglesias21ebeb22009-06-23 19:19:33 +02001269 uint64_t __pad1;
Edgar E. Iglesiasb779e292009-05-20 21:31:33 +02001270
1271 int64_t st_size;
Edgar E. Iglesias21ebeb22009-06-23 19:19:33 +02001272 int32_t st_blksize;
1273 uint32_t __pad2;
Edgar E. Iglesiasb779e292009-05-20 21:31:33 +02001274 int64_t st_blocks; /* Number 512-byte blocks allocated. */
1275
1276 int target_st_atime;
1277 unsigned int target_st_atime_nsec;
1278 int target_st_mtime;
1279 unsigned int target_st_mtime_nsec;
1280 int target_st_ctime;
1281 unsigned int target_st_ctime_nsec;
1282 uint32_t __unused4;
1283 uint32_t __unused5;
1284};
1285
pbrooke6e59062006-10-22 00:18:54 +00001286#elif defined(TARGET_M68K)
1287
1288struct target_stat {
1289 unsigned short st_dev;
1290 unsigned short __pad1;
blueswir1992f48a2007-10-14 16:27:31 +00001291 abi_ulong st_ino;
pbrooke6e59062006-10-22 00:18:54 +00001292 unsigned short st_mode;
1293 unsigned short st_nlink;
1294 unsigned short st_uid;
1295 unsigned short st_gid;
1296 unsigned short st_rdev;
1297 unsigned short __pad2;
blueswir1992f48a2007-10-14 16:27:31 +00001298 abi_ulong st_size;
1299 abi_ulong st_blksize;
1300 abi_ulong st_blocks;
1301 abi_ulong target_st_atime;
1302 abi_ulong __unused1;
1303 abi_ulong target_st_mtime;
1304 abi_ulong __unused2;
1305 abi_ulong target_st_ctime;
1306 abi_ulong __unused3;
1307 abi_ulong __unused4;
1308 abi_ulong __unused5;
pbrooke6e59062006-10-22 00:18:54 +00001309};
1310
1311/* This matches struct stat64 in glibc2.1, hence the absolutely
1312 * insane amounts of padding around dev_t's.
1313 */
1314struct target_stat64 {
1315 unsigned long long st_dev;
1316 unsigned char __pad1[2];
1317
1318#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
blueswir1992f48a2007-10-14 16:27:31 +00001319 abi_ulong __st_ino;
pbrooke6e59062006-10-22 00:18:54 +00001320
1321 unsigned int st_mode;
1322 unsigned int st_nlink;
1323
blueswir1992f48a2007-10-14 16:27:31 +00001324 abi_ulong st_uid;
1325 abi_ulong st_gid;
pbrooke6e59062006-10-22 00:18:54 +00001326
1327 unsigned long long st_rdev;
1328 unsigned char __pad3[2];
1329
1330 long long st_size;
blueswir1992f48a2007-10-14 16:27:31 +00001331 abi_ulong st_blksize;
pbrooke6e59062006-10-22 00:18:54 +00001332
blueswir1992f48a2007-10-14 16:27:31 +00001333 abi_ulong __pad4; /* future possible st_blocks high bits */
1334 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */
pbrooke6e59062006-10-22 00:18:54 +00001335
blueswir1992f48a2007-10-14 16:27:31 +00001336 abi_ulong target_st_atime;
1337 abi_ulong target_st_atime_nsec;
pbrooke6e59062006-10-22 00:18:54 +00001338
blueswir1992f48a2007-10-14 16:27:31 +00001339 abi_ulong target_st_mtime;
1340 abi_ulong target_st_mtime_nsec;
pbrooke6e59062006-10-22 00:18:54 +00001341
blueswir1992f48a2007-10-14 16:27:31 +00001342 abi_ulong target_st_ctime;
1343 abi_ulong target_st_ctime_nsec;
pbrooke6e59062006-10-22 00:18:54 +00001344
1345 unsigned long long st_ino;
1346} __attribute__((packed));
1347
thsd26bc212007-11-08 18:05:37 +00001348#elif defined(TARGET_ABI_MIPSN64)
ths540635b2007-09-30 01:58:33 +00001349
1350/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
1351struct target_stat {
1352 unsigned int st_dev;
1353 unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
1354
blueswir1992f48a2007-10-14 16:27:31 +00001355 abi_ulong st_ino;
ths540635b2007-09-30 01:58:33 +00001356
1357 unsigned int st_mode;
1358 unsigned int st_nlink;
1359
1360 int st_uid;
1361 int st_gid;
1362
1363 unsigned int st_rdev;
1364 unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
1365
blueswir1992f48a2007-10-14 16:27:31 +00001366 abi_ulong st_size;
ths540635b2007-09-30 01:58:33 +00001367
1368 /*
1369 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1370 * but we don't have it under Linux.
1371 */
1372 unsigned int target_st_atime;
1373 unsigned int target_st_atime_nsec;
1374
1375 unsigned int target_st_mtime;
1376 unsigned int target_st_mtime_nsec;
1377
1378 unsigned int target_st_ctime;
1379 unsigned int target_st_ctime_nsec;
1380
1381 unsigned int st_blksize;
1382 unsigned int st_pad2;
1383
blueswir1992f48a2007-10-14 16:27:31 +00001384 abi_ulong st_blocks;
ths540635b2007-09-30 01:58:33 +00001385};
1386
thsd26bc212007-11-08 18:05:37 +00001387#elif defined(TARGET_ABI_MIPSN32)
ths540635b2007-09-30 01:58:33 +00001388
1389struct target_stat {
1390 unsigned st_dev;
1391 int st_pad1[3]; /* Reserved for network id */
1392 unsigned int st_ino;
1393 unsigned int st_mode;
1394 unsigned int st_nlink;
1395 int st_uid;
1396 int st_gid;
1397 unsigned st_rdev;
1398 unsigned int st_pad2[2];
1399 unsigned int st_size;
1400 unsigned int st_pad3;
1401 /*
1402 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1403 * but we don't have it under Linux.
1404 */
1405 unsigned int target_st_atime;
1406 unsigned int target_st_atime_nsec;
1407 unsigned int target_st_mtime;
1408 unsigned int target_st_mtime_nsec;
1409 unsigned int target_st_ctime;
1410 unsigned int target_st_ctime_nsec;
1411 unsigned int st_blksize;
1412 unsigned int st_blocks;
1413 unsigned int st_pad4[14];
1414};
1415
1416/*
1417 * This matches struct stat64 in glibc2.1, hence the absolutely insane
1418 * amounts of padding around dev_t's. The memory layout is the same as of
1419 * struct stat of the 64-bit kernel.
1420 */
1421
1422struct target_stat64 {
1423 unsigned int st_dev;
1424 unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
1425
1426 target_ulong st_ino;
1427
1428 unsigned int st_mode;
1429 unsigned int st_nlink;
1430
1431 int st_uid;
1432 int st_gid;
1433
1434 unsigned int st_rdev;
1435 unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
1436
1437 int st_size;
1438
1439 /*
1440 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1441 * but we don't have it under Linux.
1442 */
1443 int target_st_atime;
1444 unsigned int target_st_atime_nsec; /* Reserved for st_atime expansion */
1445
1446 int target_st_mtime;
1447 unsigned int target_st_mtime_nsec; /* Reserved for st_mtime expansion */
1448
1449 int target_st_ctime;
1450 unsigned int target_st_ctime_nsec; /* Reserved for st_ctime expansion */
1451
1452 unsigned int st_blksize;
1453 unsigned int st_pad2;
1454
1455 int st_blocks;
1456};
1457
thsd26bc212007-11-08 18:05:37 +00001458#elif defined(TARGET_ABI_MIPSO32)
bellard048f6b42005-11-26 18:47:20 +00001459
1460struct target_stat {
1461 unsigned st_dev;
blueswir1992f48a2007-10-14 16:27:31 +00001462 abi_long st_pad1[3]; /* Reserved for network id */
1463 abi_ulong st_ino;
bellard048f6b42005-11-26 18:47:20 +00001464 unsigned int st_mode;
1465 unsigned int st_nlink;
1466 int st_uid;
1467 int st_gid;
1468 unsigned st_rdev;
blueswir1992f48a2007-10-14 16:27:31 +00001469 abi_long st_pad2[2];
1470 abi_long st_size;
1471 abi_long st_pad3;
bellard048f6b42005-11-26 18:47:20 +00001472 /*
1473 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1474 * but we don't have it under Linux.
1475 */
blueswir1992f48a2007-10-14 16:27:31 +00001476 abi_long target_st_atime;
1477 abi_long target_st_atime_nsec;
1478 abi_long target_st_mtime;
1479 abi_long target_st_mtime_nsec;
1480 abi_long target_st_ctime;
1481 abi_long target_st_ctime_nsec;
1482 abi_long st_blksize;
1483 abi_long st_blocks;
1484 abi_long st_pad4[14];
bellard048f6b42005-11-26 18:47:20 +00001485};
1486
1487/*
1488 * This matches struct stat64 in glibc2.1, hence the absolutely insane
1489 * amounts of padding around dev_t's. The memory layout is the same as of
1490 * struct stat of the 64-bit kernel.
1491 */
1492
1493struct target_stat64 {
blueswir1992f48a2007-10-14 16:27:31 +00001494 abi_ulong st_dev;
1495 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */
bellard048f6b42005-11-26 18:47:20 +00001496
1497 uint64_t st_ino;
1498
1499 unsigned int st_mode;
1500 unsigned int st_nlink;
1501
1502 int st_uid;
1503 int st_gid;
1504
blueswir1992f48a2007-10-14 16:27:31 +00001505 abi_ulong st_rdev;
1506 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */
bellard048f6b42005-11-26 18:47:20 +00001507
1508 int64_t st_size;
1509
1510 /*
1511 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1512 * but we don't have it under Linux.
1513 */
blueswir1992f48a2007-10-14 16:27:31 +00001514 abi_long target_st_atime;
1515 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */
bellard048f6b42005-11-26 18:47:20 +00001516
blueswir1992f48a2007-10-14 16:27:31 +00001517 abi_long target_st_mtime;
1518 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */
bellard048f6b42005-11-26 18:47:20 +00001519
blueswir1992f48a2007-10-14 16:27:31 +00001520 abi_long target_st_ctime;
1521 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */
bellard048f6b42005-11-26 18:47:20 +00001522
blueswir1992f48a2007-10-14 16:27:31 +00001523 abi_ulong st_blksize;
1524 abi_ulong st_pad2;
bellard048f6b42005-11-26 18:47:20 +00001525
1526 int64_t st_blocks;
1527};
j_mayer7a3148a2007-04-05 07:13:51 +00001528
1529#elif defined(TARGET_ALPHA)
1530
1531struct target_stat {
1532 unsigned int st_dev;
1533 unsigned int st_ino;
1534 unsigned int st_mode;
1535 unsigned int st_nlink;
1536 unsigned int st_uid;
1537 unsigned int st_gid;
1538 unsigned int st_rdev;
blueswir1992f48a2007-10-14 16:27:31 +00001539 abi_long st_size;
1540 abi_ulong target_st_atime;
1541 abi_ulong target_st_mtime;
1542 abi_ulong target_st_ctime;
j_mayer7a3148a2007-04-05 07:13:51 +00001543 unsigned int st_blksize;
1544 unsigned int st_blocks;
1545 unsigned int st_flags;
1546 unsigned int st_gen;
1547};
1548
1549struct target_stat64 {
blueswir1992f48a2007-10-14 16:27:31 +00001550 abi_ulong st_dev;
1551 abi_ulong st_ino;
1552 abi_ulong st_rdev;
1553 abi_long st_size;
1554 abi_ulong st_blocks;
j_mayer7a3148a2007-04-05 07:13:51 +00001555
1556 unsigned int st_mode;
1557 unsigned int st_uid;
1558 unsigned int st_gid;
1559 unsigned int st_blksize;
1560 unsigned int st_nlink;
1561 unsigned int __pad0;
1562
blueswir1992f48a2007-10-14 16:27:31 +00001563 abi_ulong target_st_atime;
1564 abi_ulong target_st_atime_nsec;
1565 abi_ulong target_st_mtime;
1566 abi_ulong target_st_mtime_nsec;
1567 abi_ulong target_st_ctime;
1568 abi_ulong target_st_ctime_nsec;
1569 abi_long __unused[3];
j_mayer7a3148a2007-04-05 07:13:51 +00001570};
1571
ths6db45e62007-06-22 10:15:10 +00001572#elif defined(TARGET_SH4)
1573
1574struct target_stat {
blueswir1992f48a2007-10-14 16:27:31 +00001575 abi_ulong st_dev;
1576 abi_ulong st_ino;
ths6db45e62007-06-22 10:15:10 +00001577 unsigned short st_mode;
1578 unsigned short st_nlink;
1579 unsigned short st_uid;
1580 unsigned short st_gid;
blueswir1992f48a2007-10-14 16:27:31 +00001581 abi_ulong st_rdev;
1582 abi_ulong st_size;
1583 abi_ulong st_blksize;
1584 abi_ulong st_blocks;
1585 abi_ulong target_st_atime;
1586 abi_ulong target_st_atime_nsec;
1587 abi_ulong target_st_mtime;
1588 abi_ulong target_st_mtime_nsec;
1589 abi_ulong target_st_ctime;
1590 abi_ulong target_st_ctime_nsec;
1591 abi_ulong __unused4;
1592 abi_ulong __unused5;
ths6db45e62007-06-22 10:15:10 +00001593};
1594
1595/* This matches struct stat64 in glibc2.1, hence the absolutely
1596 * insane amounts of padding around dev_t's.
1597 */
aurel3291bd8ce2009-01-30 19:48:24 +00001598struct __attribute__((__packed__)) target_stat64 {
ths6db45e62007-06-22 10:15:10 +00001599 unsigned long long st_dev;
1600 unsigned char __pad0[4];
1601
1602#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
blueswir1992f48a2007-10-14 16:27:31 +00001603 abi_ulong __st_ino;
ths6db45e62007-06-22 10:15:10 +00001604
1605 unsigned int st_mode;
1606 unsigned int st_nlink;
1607
blueswir1992f48a2007-10-14 16:27:31 +00001608 abi_ulong st_uid;
1609 abi_ulong st_gid;
ths6db45e62007-06-22 10:15:10 +00001610
1611 unsigned long long st_rdev;
1612 unsigned char __pad3[4];
1613
1614 long long st_size;
blueswir1992f48a2007-10-14 16:27:31 +00001615 abi_ulong st_blksize;
ths6db45e62007-06-22 10:15:10 +00001616
1617 unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
1618
blueswir1992f48a2007-10-14 16:27:31 +00001619 abi_ulong target_st_atime;
1620 abi_ulong target_st_atime_nsec;
ths6db45e62007-06-22 10:15:10 +00001621
blueswir1992f48a2007-10-14 16:27:31 +00001622 abi_ulong target_st_mtime;
1623 abi_ulong target_st_mtime_nsec;
ths6db45e62007-06-22 10:15:10 +00001624
blueswir1992f48a2007-10-14 16:27:31 +00001625 abi_ulong target_st_ctime;
1626 abi_ulong target_st_ctime_nsec;
ths6db45e62007-06-22 10:15:10 +00001627
1628 unsigned long long st_ino;
1629};
1630
bellardd2fd1af2007-11-14 18:08:56 +00001631#elif defined(TARGET_I386) && !defined(TARGET_ABI32)
1632struct target_stat {
1633 abi_ulong st_dev;
1634 abi_ulong st_ino;
1635 abi_ulong st_nlink;
1636
1637 unsigned int st_mode;
1638 unsigned int st_uid;
1639 unsigned int st_gid;
1640 unsigned int __pad0;
1641 abi_ulong st_rdev;
1642 abi_long st_size;
1643 abi_long st_blksize;
1644 abi_long st_blocks; /* Number 512-byte blocks allocated. */
1645
1646 abi_ulong target_st_atime;
1647 abi_ulong target_st_atime_nsec;
1648 abi_ulong target_st_mtime;
1649 abi_ulong target_st_mtime_nsec;
1650 abi_ulong target_st_ctime;
1651 abi_ulong target_st_ctime_nsec;
1652
1653 abi_long __unused[3];
1654};
bellard048f6b42005-11-26 18:47:20 +00001655#else
1656#error unsupported CPU
1657#endif
bellard2521d692003-06-15 19:58:13 +00001658
ths4ce6f8d2007-07-20 15:54:27 +00001659typedef struct {
1660 int val[2];
Anthony Liguoric227f092009-10-01 16:12:16 -05001661} target_fsid_t;
ths4ce6f8d2007-07-20 15:54:27 +00001662
bellard56c8f682005-11-28 22:28:41 +00001663#ifdef TARGET_MIPS
thsd26bc212007-11-08 18:05:37 +00001664#ifdef TARGET_ABI_MIPSN32
ths540635b2007-09-30 01:58:33 +00001665struct target_statfs {
1666 int32_t f_type;
1667 int32_t f_bsize;
1668 int32_t f_frsize; /* Fragment size - unsupported */
1669 int32_t f_blocks;
1670 int32_t f_bfree;
1671 int32_t f_files;
1672 int32_t f_ffree;
1673 int32_t f_bavail;
1674
1675 /* Linux specials */
Anthony Liguoric227f092009-10-01 16:12:16 -05001676 target_fsid_t f_fsid;
ths540635b2007-09-30 01:58:33 +00001677 int32_t f_namelen;
1678 int32_t f_spare[6];
1679};
1680#else
bellard56c8f682005-11-28 22:28:41 +00001681struct target_statfs {
blueswir1992f48a2007-10-14 16:27:31 +00001682 abi_long f_type;
1683 abi_long f_bsize;
1684 abi_long f_frsize; /* Fragment size - unsupported */
1685 abi_long f_blocks;
1686 abi_long f_bfree;
1687 abi_long f_files;
1688 abi_long f_ffree;
1689 abi_long f_bavail;
bellard56c8f682005-11-28 22:28:41 +00001690
1691 /* Linux specials */
Anthony Liguoric227f092009-10-01 16:12:16 -05001692 target_fsid_t f_fsid;
blueswir1992f48a2007-10-14 16:27:31 +00001693 abi_long f_namelen;
1694 abi_long f_spare[6];
bellard56c8f682005-11-28 22:28:41 +00001695};
ths540635b2007-09-30 01:58:33 +00001696#endif
bellard56c8f682005-11-28 22:28:41 +00001697
1698struct target_statfs64 {
1699 uint32_t f_type;
1700 uint32_t f_bsize;
1701 uint32_t f_frsize; /* Fragment size - unsupported */
1702 uint32_t __pad;
1703 uint64_t f_blocks;
1704 uint64_t f_bfree;
1705 uint64_t f_files;
1706 uint64_t f_ffree;
1707 uint64_t f_bavail;
Anthony Liguoric227f092009-10-01 16:12:16 -05001708 target_fsid_t f_fsid;
bellard56c8f682005-11-28 22:28:41 +00001709 uint32_t f_namelen;
1710 uint32_t f_spare[6];
1711};
balrogc4d10622008-07-19 09:38:52 +00001712#elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
1713 defined(TARGET_SPARC64)) && !defined(TARGET_ABI32)
j_mayer325e6512007-11-21 13:06:54 +00001714struct target_statfs {
1715 abi_long f_type;
1716 abi_long f_bsize;
1717 abi_long f_blocks;
1718 abi_long f_bfree;
1719 abi_long f_bavail;
1720 abi_long f_files;
1721 abi_long f_ffree;
Anthony Liguoric227f092009-10-01 16:12:16 -05001722 target_fsid_t f_fsid;
j_mayer325e6512007-11-21 13:06:54 +00001723 abi_long f_namelen;
1724 abi_long f_frsize;
1725 abi_long f_spare[5];
1726};
1727
1728struct target_statfs64 {
1729 abi_long f_type;
1730 abi_long f_bsize;
1731 abi_long f_blocks;
1732 abi_long f_bfree;
1733 abi_long f_bavail;
1734 abi_long f_files;
1735 abi_long f_ffree;
Anthony Liguoric227f092009-10-01 16:12:16 -05001736 target_fsid_t f_fsid;
j_mayer325e6512007-11-21 13:06:54 +00001737 abi_long f_namelen;
1738 abi_long f_frsize;
1739 abi_long f_spare[5];
1740};
bellard56c8f682005-11-28 22:28:41 +00001741#else
1742struct target_statfs {
1743 uint32_t f_type;
1744 uint32_t f_bsize;
1745 uint32_t f_blocks;
1746 uint32_t f_bfree;
1747 uint32_t f_bavail;
1748 uint32_t f_files;
1749 uint32_t f_ffree;
Anthony Liguoric227f092009-10-01 16:12:16 -05001750 target_fsid_t f_fsid;
bellard56c8f682005-11-28 22:28:41 +00001751 uint32_t f_namelen;
1752 uint32_t f_frsize;
1753 uint32_t f_spare[5];
1754};
1755
1756struct target_statfs64 {
1757 uint32_t f_type;
1758 uint32_t f_bsize;
1759 uint64_t f_blocks;
1760 uint64_t f_bfree;
1761 uint64_t f_bavail;
1762 uint64_t f_files;
1763 uint64_t f_ffree;
Anthony Liguoric227f092009-10-01 16:12:16 -05001764 target_fsid_t f_fsid;
bellard56c8f682005-11-28 22:28:41 +00001765 uint32_t f_namelen;
1766 uint32_t f_frsize;
1767 uint32_t f_spare[5];
1768};
1769#endif
1770
1771
bellard2521d692003-06-15 19:58:13 +00001772#define TARGET_F_DUPFD 0 /* dup */
1773#define TARGET_F_GETFD 1 /* get close_on_exec */
1774#define TARGET_F_SETFD 2 /* set/clear close_on_exec */
1775#define TARGET_F_GETFL 3 /* get file->f_flags */
1776#define TARGET_F_SETFL 4 /* set file->f_flags */
1777
1778#if defined(TARGET_ALPHA)
1779#define TARGET_F_GETLK 7
1780#define TARGET_F_SETLK 8
1781#define TARGET_F_SETLKW 9
1782#define TARGET_F_SETOWN 5 /* for sockets. */
1783#define TARGET_F_GETOWN 6 /* for sockets. */
Arnaud Patard (Rtp)5f106812009-06-03 14:35:04 +02001784#elif defined(TARGET_MIPS)
1785#define TARGET_F_GETLK 14
1786#define TARGET_F_SETLK 6
1787#define TARGET_F_SETLKW 7
1788#define TARGET_F_SETOWN 24 /* for sockets. */
1789#define TARGET_F_GETOWN 25 /* for sockets. */
bellard2521d692003-06-15 19:58:13 +00001790#else
1791#define TARGET_F_GETLK 5
1792#define TARGET_F_SETLK 6
1793#define TARGET_F_SETLKW 7
1794#define TARGET_F_SETOWN 8 /* for sockets. */
1795#define TARGET_F_GETOWN 9 /* for sockets. */
1796#endif
1797
1798#define TARGET_F_SETSIG 10 /* for sockets. */
1799#define TARGET_F_GETSIG 11 /* for sockets. */
1800
Arnaud Patard (Rtp)5f106812009-06-03 14:35:04 +02001801#if defined(TARGET_MIPS)
1802#define TARGET_F_GETLK64 33 /* using 'struct flock64' */
1803#define TARGET_F_SETLK64 34
1804#define TARGET_F_SETLKW64 35
1805#else
bellard2521d692003-06-15 19:58:13 +00001806#define TARGET_F_GETLK64 12 /* using 'struct flock64' */
1807#define TARGET_F_SETLK64 13
1808#define TARGET_F_SETLKW64 14
Arnaud Patard (Rtp)5f106812009-06-03 14:35:04 +02001809#endif
Ulrich Hecht7e22e542009-07-24 19:10:27 +02001810
1811#define TARGET_F_LINUX_SPECIFIC_BASE 1024
1812#define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0)
1813#define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1)
1814#define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6)
1815#define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2)
1816
bellardf09936a2004-01-18 22:39:25 +00001817#if defined (TARGET_ARM)
1818#define TARGET_O_ACCMODE 0003
1819#define TARGET_O_RDONLY 00
1820#define TARGET_O_WRONLY 01
1821#define TARGET_O_RDWR 02
1822#define TARGET_O_CREAT 0100 /* not fcntl */
1823#define TARGET_O_EXCL 0200 /* not fcntl */
1824#define TARGET_O_NOCTTY 0400 /* not fcntl */
1825#define TARGET_O_TRUNC 01000 /* not fcntl */
1826#define TARGET_O_APPEND 02000
1827#define TARGET_O_NONBLOCK 04000
bellard048f6b42005-11-26 18:47:20 +00001828#define TARGET_O_NDELAY TARGET_O_NONBLOCK
bellardf09936a2004-01-18 22:39:25 +00001829#define TARGET_O_SYNC 010000
1830#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
1831#define TARGET_O_DIRECTORY 040000 /* must be a directory */
1832#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
1833#define TARGET_O_DIRECT 0200000 /* direct disk access hint */
1834#define TARGET_O_LARGEFILE 0400000
1835#elif defined (TARGET_PPC)
bellardffa65c32004-01-04 23:57:22 +00001836#define TARGET_O_ACCMODE 0003
1837#define TARGET_O_RDONLY 00
1838#define TARGET_O_WRONLY 01
1839#define TARGET_O_RDWR 02
1840#define TARGET_O_CREAT 0100 /* not fcntl */
1841#define TARGET_O_EXCL 0200 /* not fcntl */
1842#define TARGET_O_NOCTTY 0400 /* not fcntl */
1843#define TARGET_O_TRUNC 01000 /* not fcntl */
1844#define TARGET_O_APPEND 02000
1845#define TARGET_O_NONBLOCK 04000
bellard048f6b42005-11-26 18:47:20 +00001846#define TARGET_O_NDELAY TARGET_O_NONBLOCK
bellardffa65c32004-01-04 23:57:22 +00001847#define TARGET_O_SYNC 010000
1848#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
1849#define TARGET_O_DIRECTORY 040000 /* must be a directory */
1850#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
1851#define TARGET_O_LARGEFILE 0200000
1852#define TARGET_O_DIRECT 0400000 /* direct disk access hint */
Edgar E. Iglesiasb779e292009-05-20 21:31:33 +02001853#elif defined (TARGET_MICROBLAZE)
1854#define TARGET_O_ACCMODE 0003
1855#define TARGET_O_RDONLY 00
1856#define TARGET_O_WRONLY 01
1857#define TARGET_O_RDWR 02
1858#define TARGET_O_CREAT 0100 /* not fcntl */
1859#define TARGET_O_EXCL 0200 /* not fcntl */
1860#define TARGET_O_NOCTTY 0400 /* not fcntl */
1861#define TARGET_O_TRUNC 01000 /* not fcntl */
1862#define TARGET_O_APPEND 02000
1863#define TARGET_O_NONBLOCK 04000
1864#define TARGET_O_NDELAY TARGET_O_NONBLOCK
1865#define TARGET_O_SYNC 010000
1866#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
1867#define TARGET_O_DIRECTORY 040000 /* must be a directory */
1868#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
1869#define TARGET_O_LARGEFILE 0200000
1870#define TARGET_O_DIRECT 0400000 /* direct disk access hint */
bellard6d5e2162004-09-30 22:04:13 +00001871#elif defined (TARGET_SPARC)
1872#define TARGET_O_RDONLY 0x0000
1873#define TARGET_O_WRONLY 0x0001
1874#define TARGET_O_RDWR 0x0002
1875#define TARGET_O_ACCMODE 0x0003
1876#define TARGET_O_APPEND 0x0008
1877#define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */
1878#define TARGET_O_CREAT 0x0200 /* not fcntl */
1879#define TARGET_O_TRUNC 0x0400 /* not fcntl */
1880#define TARGET_O_EXCL 0x0800 /* not fcntl */
1881#define TARGET_O_SYNC 0x2000
1882#define TARGET_O_NONBLOCK 0x4000
bellard048f6b42005-11-26 18:47:20 +00001883#define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK)
bellard6d5e2162004-09-30 22:04:13 +00001884#define TARGET_O_NOCTTY 0x8000 /* not fcntl */
1885#define TARGET_O_DIRECTORY 0x10000 /* must be a directory */
1886#define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */
1887#define TARGET_O_LARGEFILE 0x40000
1888#define TARGET_O_DIRECT 0x100000 /* direct disk access hint */
bellard048f6b42005-11-26 18:47:20 +00001889#elif defined(TARGET_MIPS)
1890#define TARGET_O_ACCMODE 0x0003
1891#define TARGET_O_RDONLY 0x0000
1892#define TARGET_O_WRONLY 0x0001
1893#define TARGET_O_RDWR 0x0002
1894#define TARGET_O_APPEND 0x0008
1895#define TARGET_O_SYNC 0x0010
1896#define TARGET_O_NONBLOCK 0x0080
1897#define TARGET_O_CREAT 0x0100 /* not fcntl */
1898#define TARGET_O_TRUNC 0x0200 /* not fcntl */
1899#define TARGET_O_EXCL 0x0400 /* not fcntl */
1900#define TARGET_O_NOCTTY 0x0800 /* not fcntl */
1901#define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */
1902#define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */
1903#define TARGET_O_DIRECT 0x8000 /* direct disk access hint */
1904#define TARGET_O_DIRECTORY 0x10000 /* must be a directory */
1905#define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */
1906#define TARGET_O_NOATIME 0x40000
1907#define TARGET_O_NDELAY TARGET_O_NONBLOCK
aurel321f961122008-11-11 11:30:48 +00001908#elif defined(TARGET_ALPHA)
1909#define TARGET_O_ACCMODE 0x0003
1910#define TARGET_O_RDONLY 0x0000
1911#define TARGET_O_WRONLY 0x0001
1912#define TARGET_O_RDWR 0x0002
1913#define TARGET_O_APPEND 0x0008
1914#define TARGET_O_SYNC 0x4000
1915#define TARGET_O_NONBLOCK 0x0004
1916#define TARGET_O_CREAT 0x0200 /* not fcntl */
1917#define TARGET_O_TRUNC 0x0400 /* not fcntl */
1918#define TARGET_O_EXCL 0x0800 /* not fcntl */
1919#define TARGET_O_NOCTTY 0x1000 /* not fcntl */
1920#define TARGET_FASYNC 0x2000 /* fcntl, for BSD compatibility */
1921#define TARGET_O_LARGEFILE 0x0000 /* not necessary, always 64-bit */
1922#define TARGET_O_DIRECT 0x80000 /* direct disk access hint */
1923#define TARGET_O_DIRECTORY 0x8000 /* must be a directory */
1924#define TARGET_O_NOFOLLOW 0x10000 /* don't follow links */
1925#define TARGET_O_NOATIME 0x100000
1926#define TARGET_O_NDELAY TARGET_O_NONBLOCK
bellardffa65c32004-01-04 23:57:22 +00001927#else
1928#define TARGET_O_ACCMODE 0003
1929#define TARGET_O_RDONLY 00
1930#define TARGET_O_WRONLY 01
1931#define TARGET_O_RDWR 02
1932#define TARGET_O_CREAT 0100 /* not fcntl */
1933#define TARGET_O_EXCL 0200 /* not fcntl */
1934#define TARGET_O_NOCTTY 0400 /* not fcntl */
1935#define TARGET_O_TRUNC 01000 /* not fcntl */
1936#define TARGET_O_APPEND 02000
1937#define TARGET_O_NONBLOCK 04000
bellard048f6b42005-11-26 18:47:20 +00001938#define TARGET_O_NDELAY TARGET_O_NONBLOCK
bellardffa65c32004-01-04 23:57:22 +00001939#define TARGET_O_SYNC 010000
1940#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
1941#define TARGET_O_DIRECT 040000 /* direct disk access hint */
1942#define TARGET_O_LARGEFILE 0100000
1943#define TARGET_O_DIRECTORY 0200000 /* must be a directory */
1944#define TARGET_O_NOFOLLOW 0400000 /* don't follow links */
1945#endif
1946
bellard2521d692003-06-15 19:58:13 +00001947struct target_flock {
1948 short l_type;
1949 short l_whence;
blueswir1992f48a2007-10-14 16:27:31 +00001950 abi_ulong l_start;
1951 abi_ulong l_len;
bellard2521d692003-06-15 19:58:13 +00001952 int l_pid;
1953};
1954
1955struct target_flock64 {
1956 short l_type;
1957 short l_whence;
Edgar E. Iglesiasb779e292009-05-20 21:31:33 +02001958#if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) || defined(TARGET_SPARC) || defined(TARGET_HPPA) || defined (TARGET_MICROBLAZE)
aurel32ce3f0e22008-03-28 22:31:51 +00001959 int __pad;
1960#endif
bellard2521d692003-06-15 19:58:13 +00001961 unsigned long long l_start;
1962 unsigned long long l_len;
1963 int l_pid;
pbrookce4defa2006-02-09 16:49:55 +00001964}__attribute__((packed));
bellard2521d692003-06-15 19:58:13 +00001965
pbrookce4defa2006-02-09 16:49:55 +00001966#ifdef TARGET_ARM
1967struct target_eabi_flock64 {
1968 short l_type;
1969 short l_whence;
1970 int __pad;
1971 unsigned long long l_start;
1972 unsigned long long l_len;
1973 int l_pid;
1974}__attribute__((packed));
1975#endif
bellard2521d692003-06-15 19:58:13 +00001976
1977/* soundcard defines */
1978/* XXX: convert them all to arch indepedent entries */
1979#define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int);
1980#define TARGET_SNDCTL_COPR_LOAD 0xcfb04301
1981#define TARGET_SNDCTL_COPR_RCODE 0xc0144303
1982#define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309
1983#define TARGET_SNDCTL_COPR_RDATA 0xc0144302
1984#define TARGET_SNDCTL_COPR_RESET 0x00004300
1985#define TARGET_SNDCTL_COPR_RUN 0xc0144306
1986#define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308
1987#define TARGET_SNDCTL_COPR_WCODE 0x40144305
1988#define TARGET_SNDCTL_COPR_WDATA 0x40144304
1989#define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0)
1990#define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1)
1991#define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int)
1992#define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int)
1993#define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int)
1994#define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int)
1995#define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int)
1996#define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int)
1997#define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8)
1998#define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int)
1999#define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int)
2000#define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int)
2001#define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12)
2002#define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13)
2003#define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int)
2004#define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int)
2005#define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17)
2006#define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18)
2007#define TARGET_SNDCTL_DSP_MAPINBUF 0x80085013
2008#define TARGET_SNDCTL_DSP_MAPOUTBUF 0x80085014
2009#define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e
2010#define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005
2011#define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016
2012#define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015
2013#define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010
2014#define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f
2015#define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107
2016#define TARGET_SNDCTL_MIDI_INFO 0xc074510c
2017#define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02
2018#define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01
2019#define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00
2020#define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110
2021#define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001
2022#define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103
2023#define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105
2024#define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104
2025#define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b
2026#define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a
2027#define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112
2028#define TARGET_SNDCTL_SEQ_PANIC 0x00005111
2029#define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106
2030#define TARGET_SNDCTL_SEQ_RESET 0x00005100
2031#define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109
2032#define TARGET_SNDCTL_SEQ_SYNC 0x00005101
2033#define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108
2034#define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d
2035#define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d
2036#define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102
2037#define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e
2038#define TARGET_SNDCTL_TMR_CONTINUE 0x00005404
2039#define TARGET_SNDCTL_TMR_METRONOME 0x40045407
2040#define TARGET_SNDCTL_TMR_SELECT 0x40045408
2041#define TARGET_SNDCTL_TMR_SOURCE 0xc0045406
2042#define TARGET_SNDCTL_TMR_START 0x00005402
2043#define TARGET_SNDCTL_TMR_STOP 0x00005403
2044#define TARGET_SNDCTL_TMR_TEMPO 0xc0045405
2045#define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401
2046#define TARGET_SOUND_PCM_READ_RATE 0x80045002
2047#define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006
2048#define TARGET_SOUND_PCM_READ_BITS 0x80045005
2049#define TARGET_SOUND_PCM_READ_FILTER 0x80045007
2050#define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info)
2051#define TARGET_SOUND_MIXER_ACCESS 0xc0804d66
2052#define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int)
2053#define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int)
2054#define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int)
2055#define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int)
2056#define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int)
2057
2058#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int)
2059
2060#define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME)
2061#define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS)
2062#define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE)
2063#define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH)
2064#define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM)
2065#define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER)
2066#define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE)
2067#define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC)
2068#define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD)
2069#define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX)
2070#define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM)
2071#define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV)
2072#define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN)
2073#define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN)
2074#define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1)
2075#define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2)
2076#define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3)
2077
2078/* Obsolete macros */
2079#define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE)
2080#define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE)
2081#define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD)
2082
2083#define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC)
2084#define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK)
2085#define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK)
2086#define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)
2087#define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS)
2088
2089#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int)
2090
2091#define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)
2092#define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
2093#define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE)
2094#define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH)
2095#define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM)
2096#define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER)
2097#define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE)
2098#define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC)
2099#define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD)
2100#define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX)
2101#define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM)
2102#define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV)
2103#define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN)
2104#define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN)
2105#define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1)
2106#define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2)
2107#define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)
2108
2109/* Obsolete macros */
2110#define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE)
2111#define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE)
2112#define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD)
2113
2114#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
2115
2116/* vfat ioctls */
2117#define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
2118#define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2)
bellarda5448a72004-06-19 16:59:03 +00002119
balrog8fbd6b52008-09-20 03:03:09 +00002120#define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop)
2121#define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget)
2122#define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos)
2123
bellarda5448a72004-06-19 16:59:03 +00002124struct target_sysinfo {
blueswir1992f48a2007-10-14 16:27:31 +00002125 abi_long uptime; /* Seconds since boot */
2126 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */
2127 abi_ulong totalram; /* Total usable main memory size */
2128 abi_ulong freeram; /* Available memory size */
2129 abi_ulong sharedram; /* Amount of shared memory */
2130 abi_ulong bufferram; /* Memory used by buffers */
2131 abi_ulong totalswap; /* Total swap space size */
2132 abi_ulong freeswap; /* swap space still available */
bellarda5448a72004-06-19 16:59:03 +00002133 unsigned short procs; /* Number of current processes */
2134 unsigned short pad; /* explicit padding for m68k */
blueswir1992f48a2007-10-14 16:27:31 +00002135 abi_ulong totalhigh; /* Total high memory size */
2136 abi_ulong freehigh; /* Available high memory size */
bellarda5448a72004-06-19 16:59:03 +00002137 unsigned int mem_unit; /* Memory unit size in bytes */
blueswir1992f48a2007-10-14 16:27:31 +00002138 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */
bellarda5448a72004-06-19 16:59:03 +00002139};
bellard3532fa72006-06-24 15:06:03 +00002140
aurel326556a832008-10-13 21:08:17 +00002141struct linux_dirent {
2142 long d_ino;
2143 unsigned long d_off;
2144 unsigned short d_reclen;
2145 char d_name[256]; /* We must not include limits.h! */
2146};
2147
2148struct linux_dirent64 {
2149 uint64_t d_ino;
2150 int64_t d_off;
2151 unsigned short d_reclen;
2152 unsigned char d_type;
2153 char d_name[256];
2154};
2155
aurel3224e10032009-04-15 16:11:43 +00002156struct target_mq_attr {
2157 abi_long mq_flags;
2158 abi_long mq_maxmsg;
2159 abi_long mq_msgsize;
2160 abi_long mq_curmsgs;
2161};
2162
bellard3532fa72006-06-24 15:06:03 +00002163#include "socket.h"
ths637947f2007-06-01 12:09:19 +00002164
2165#include "errno_defs.h"
Riku Voipio03dfe9f2009-06-18 22:51:31 +03002166
2167#define FUTEX_WAIT 0
2168#define FUTEX_WAKE 1
2169#define FUTEX_FD 2
2170#define FUTEX_REQUEUE 3
2171#define FUTEX_CMP_REQUEUE 4
2172#define FUTEX_WAKE_OP 5
2173#define FUTEX_LOCK_PI 6
2174#define FUTEX_UNLOCK_PI 7
2175#define FUTEX_TRYLOCK_PI 8
2176#define FUTEX_WAIT_BITSET 9
2177#define FUTEX_WAKE_BITSET 10
2178
2179#define FUTEX_PRIVATE_FLAG 128
2180#define FUTEX_CLOCK_REALTIME 256
2181#define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
2182