]> Git Repo - qemu.git/blame - linux-user/syscall_defs.h
qemu-sockets: Fix buffer overflow in inet_parse()
[qemu.git] / linux-user / syscall_defs.h
CommitLineData
31e31b8a
FB
1/* common syscall defines for all architectures */
2
2521d698 3/* Note: although the syscall numbers change between architectures,
b4916d7b 4 most of them stay the same, so we handle it by putting ifdefs if
2521d698
FB
5 necessary */
6
cb9c377f
PB
7#ifndef SYSCALL_DEFS_H
8#define SYSCALL_DEFS_H 1
9
10
6180a181 11#include "syscall_nr.h"
2521d698 12
31e31b8a
FB
13#define SOCKOP_socket 1
14#define SOCKOP_bind 2
15#define SOCKOP_connect 3
16#define SOCKOP_listen 4
17#define SOCKOP_accept 5
18#define SOCKOP_getsockname 6
19#define SOCKOP_getpeername 7
20#define SOCKOP_socketpair 8
21#define SOCKOP_send 9
22#define SOCKOP_recv 10
23#define SOCKOP_sendto 11
24#define SOCKOP_recvfrom 12
25#define SOCKOP_shutdown 13
26#define SOCKOP_setsockopt 14
27#define SOCKOP_getsockopt 15
28#define SOCKOP_sendmsg 16
29#define SOCKOP_recvmsg 17
b9d36eb2 30#define SOCKOP_accept4 18
31e31b8a 31
8853f86e
FB
32#define IPCOP_semop 1
33#define IPCOP_semget 2
34#define IPCOP_semctl 3
35#define IPCOP_semtimedop 4
36#define IPCOP_msgsnd 11
37#define IPCOP_msgrcv 12
38#define IPCOP_msgget 13
39#define IPCOP_msgctl 14
40#define IPCOP_shmat 21
41#define IPCOP_shmdt 22
42#define IPCOP_shmget 23
43#define IPCOP_shmctl 24
44
2521d698
FB
45/*
46 * The following is for compatibility across the various Linux
47 * platforms. The i386 ioctl numbering scheme doesn't really enforce
48 * a type field. De facto, however, the top 8 bits of the lower 16
49 * bits are indeed used as a type field, so we might just as well make
50 * this explicit here. Please be sure to use the decoding macros
51 * below from now on.
52 */
53#define TARGET_IOC_NRBITS 8
54#define TARGET_IOC_TYPEBITS 8
55
cd98d390
AS
56#if defined(TARGET_I386) || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
57 || defined(TARGET_SPARC) \
0c866a7e 58 || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
74d753ac
MW
59 /* 16 bit uid wrappers emulation */
60#define USE_UID16
0c866a7e
RV
61#define target_id uint16_t
62#else
63#define target_id uint32_t
74d753ac
MW
64#endif
65
e6e5906b 66#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
a4c075f1 67 || defined(TARGET_M68K) || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) \
d962783e 68 || defined(TARGET_S390X) || defined(TARGET_OPENRISC)
2521d698
FB
69
70#define TARGET_IOC_SIZEBITS 14
71#define TARGET_IOC_DIRBITS 2
72
73#define TARGET_IOC_NONE 0U
74#define TARGET_IOC_WRITE 1U
75#define TARGET_IOC_READ 2U
76
048f6b4d 77#elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
b779e29e
EI
78 defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \
79 defined(TARGET_MIPS)
2521d698
FB
80
81#define TARGET_IOC_SIZEBITS 13
82#define TARGET_IOC_DIRBITS 3
83
84#define TARGET_IOC_NONE 1U
85#define TARGET_IOC_READ 2U
86#define TARGET_IOC_WRITE 4U
87
88#else
89#error unsupported CPU
90#endif
91
92#define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1)
93#define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1)
94#define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1)
95#define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1)
96
97#define TARGET_IOC_NRSHIFT 0
98#define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
99#define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
100#define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
101
102#define TARGET_IOC(dir,type,nr,size) \
103 (((dir) << TARGET_IOC_DIRSHIFT) | \
104 ((type) << TARGET_IOC_TYPESHIFT) | \
105 ((nr) << TARGET_IOC_NRSHIFT) | \
106 ((size) << TARGET_IOC_SIZESHIFT))
107
108/* used to create numbers */
109#define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
110#define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
111#define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
112#define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
113
114/* the size is automatically computed for these defines */
115#define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
116#define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
117#define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
118
7854b056
FB
119struct target_sockaddr {
120 uint16_t sa_family;
121 uint8_t sa_data[14];
122};
123
33a29b51
JT
124struct target_sockaddr_ll {
125 uint16_t sll_family; /* Always AF_PACKET */
126 uint16_t sll_protocol; /* Physical layer protocol */
127 int sll_ifindex; /* Interface number */
128 uint16_t sll_hatype; /* ARP hardware type */
129 uint8_t sll_pkttype; /* Packet type */
130 uint8_t sll_halen; /* Length of address */
131 uint8_t sll_addr[8]; /* Physical layer address */
132};
133
f57d4192
LV
134struct target_sock_filter {
135 abi_ushort code;
136 uint8_t jt;
137 uint8_t jf;
138 abi_uint k;
139};
140
141struct target_sock_fprog {
142 abi_ushort len;
143 abi_ulong filter;
144};
145
b975b83b
LL
146struct target_in_addr {
147 uint32_t s_addr; /* big endian */
148};
149
150struct target_ip_mreq {
151 struct target_in_addr imr_multiaddr;
152 struct target_in_addr imr_address;
153};
154
155struct target_ip_mreqn {
156 struct target_in_addr imr_multiaddr;
157 struct target_in_addr imr_address;
158 abi_long imr_ifindex;
159};
160
6e3cb58f
LL
161struct target_ip_mreq_source {
162 /* big endian */
163 uint32_t imr_multiaddr;
164 uint32_t imr_interface;
165 uint32_t imr_sourceaddr;
166};
167
31e31b8a 168struct target_timeval {
992f48a0
BS
169 abi_long tv_sec;
170 abi_long tv_usec;
31e31b8a
FB
171};
172
1b6b029e 173struct target_timespec {
992f48a0
BS
174 abi_long tv_sec;
175 abi_long tv_nsec;
1b6b029e
FB
176};
177
ef4467e9
PB
178struct target_timezone {
179 abi_int tz_minuteswest;
180 abi_int tz_dsttime;
181};
182
66fb9763
FB
183struct target_itimerval {
184 struct target_timeval it_interval;
185 struct target_timeval it_value;
186};
187
905bba13
ECL
188struct target_itimerspec {
189 struct target_timespec it_interval;
190 struct target_timespec it_value;
191};
192
c227f099 193typedef abi_long target_clock_t;
32f36bce 194
c596ed17
FB
195#define TARGET_HZ 100
196
32f36bce 197struct target_tms {
c227f099
AL
198 target_clock_t tms_utime;
199 target_clock_t tms_stime;
200 target_clock_t tms_cutime;
201 target_clock_t tms_cstime;
32f36bce
FB
202};
203
6180a181 204struct target_utimbuf {
992f48a0
BS
205 abi_long actime;
206 abi_long modtime;
6180a181
FB
207};
208
f2674e31 209struct target_sel_arg_struct {
992f48a0
BS
210 abi_long n;
211 abi_long inp, outp, exp;
212 abi_long tvp;
f2674e31
FB
213};
214
31e31b8a 215struct target_iovec {
992f48a0
BS
216 abi_long iov_base; /* Starting address */
217 abi_long iov_len; /* Number of bytes */
31e31b8a
FB
218};
219
1a9353d2 220struct target_msghdr {
992f48a0
BS
221 abi_long msg_name; /* Socket name */
222 int msg_namelen; /* Length of name */
223 abi_long msg_iov; /* Data blocks */
224 abi_long msg_iovlen; /* Number of blocks */
225 abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
226 abi_long msg_controllen; /* Length of cmsg list */
1a9353d2
FB
227 unsigned int msg_flags;
228};
229
7854b056 230struct target_cmsghdr {
992f48a0 231 abi_long cmsg_len;
7854b056
FB
232 int cmsg_level;
233 int cmsg_type;
234};
235
236#define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
237#define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg)
992f48a0
BS
238#define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
239 & (size_t) ~(sizeof (abi_long) - 1))
7854b056
FB
240#define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
241 + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)))
242#define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len))
243
244static __inline__ struct target_cmsghdr *
245__target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg)
246{
2b8bdefc
TS
247 struct target_cmsghdr *__ptr;
248
249 __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg
cbb21eed
MB
250 + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len)));
251 if ((unsigned long)((char *)(__ptr+1) - (char *)(size_t)tswapal(__mhdr->msg_control))
252 > tswapal(__mhdr->msg_controllen))
7854b056 253 /* No more entries. */
2b8bdefc 254 return (struct target_cmsghdr *)0;
7854b056
FB
255 return __cmsg;
256}
257
f19e00d7
AG
258struct target_mmsghdr {
259 struct target_msghdr msg_hdr; /* Message header */
260 unsigned int msg_len; /* Number of bytes transmitted */
261};
7854b056 262
31e31b8a
FB
263struct target_rusage {
264 struct target_timeval ru_utime; /* user time used */
265 struct target_timeval ru_stime; /* system time used */
992f48a0
BS
266 abi_long ru_maxrss; /* maximum resident set size */
267 abi_long ru_ixrss; /* integral shared memory size */
268 abi_long ru_idrss; /* integral unshared data size */
269 abi_long ru_isrss; /* integral unshared stack size */
270 abi_long ru_minflt; /* page reclaims */
271 abi_long ru_majflt; /* page faults */
272 abi_long ru_nswap; /* swaps */
273 abi_long ru_inblock; /* block input operations */
274 abi_long ru_oublock; /* block output operations */
275 abi_long ru_msgsnd; /* messages sent */
276 abi_long ru_msgrcv; /* messages received */
277 abi_long ru_nsignals; /* signals received */
278 abi_long ru_nvcsw; /* voluntary context switches */
279 abi_long ru_nivcsw; /* involuntary " */
31e31b8a
FB
280};
281
282typedef struct {
283 int val[2];
c227f099 284} kernel_fsid_t;
31e31b8a 285
72f03900 286struct kernel_statfs {
31e31b8a
FB
287 int f_type;
288 int f_bsize;
289 int f_blocks;
290 int f_bfree;
291 int f_bavail;
292 int f_files;
293 int f_ffree;
c227f099 294 kernel_fsid_t f_fsid;
31e31b8a
FB
295 int f_namelen;
296 int f_spare[6];
297};
298
dab2ed99 299struct target_dirent {
333858b7
DL
300 abi_long d_ino;
301 abi_long d_off;
302 unsigned short d_reclen;
303 char d_name[];
dab2ed99
FB
304};
305
306struct target_dirent64 {
307 uint64_t d_ino;
308 int64_t d_off;
309 unsigned short d_reclen;
310 unsigned char d_type;
311 char d_name[256];
312};
313
314
31e31b8a 315/* mostly generic signal stuff */
992f48a0
BS
316#define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */
317#define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */
318#define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */
31e31b8a
FB
319
320#ifdef TARGET_MIPS
321#define TARGET_NSIG 128
322#else
323#define TARGET_NSIG 64
324#endif
992f48a0 325#define TARGET_NSIG_BPW TARGET_ABI_BITS
31e31b8a
FB
326#define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
327
328typedef struct {
992f48a0 329 abi_ulong sig[TARGET_NSIG_WORDS];
c227f099 330} target_sigset_t;
31e31b8a 331
66fb9763 332#ifdef BSWAP_NEEDED
c227f099 333static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
66fb9763
FB
334{
335 int i;
336 for(i = 0;i < TARGET_NSIG_WORDS; i++)
cbb21eed 337 d->sig[i] = tswapal(s->sig[i]);
66fb9763
FB
338}
339#else
c227f099 340static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
66fb9763
FB
341{
342 *d = *s;
343}
344#endif
345
c227f099 346static inline void target_siginitset(target_sigset_t *d, abi_ulong set)
66fb9763
FB
347{
348 int i;
349 d->sig[0] = set;
350 for(i = 1;i < TARGET_NSIG_WORDS; i++)
351 d->sig[i] = 0;
352}
353
c227f099
AL
354void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
355void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
992f48a0 356void host_to_target_old_sigset(abi_ulong *old_sigset,
66fb9763 357 const sigset_t *sigset);
5fafdf24 358void target_to_host_old_sigset(sigset_t *sigset,
992f48a0 359 const abi_ulong *old_sigset);
66fb9763
FB
360struct target_sigaction;
361int do_sigaction(int sig, const struct target_sigaction *act,
362 struct target_sigaction *oact);
363
d2fbca94
GX
364#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
365 || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \
366 || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \
a4c075f1 367 || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \
d962783e 368 || defined(TARGET_S390X) || defined(TARGET_OPENRISC)
2521d698 369
048f6b4d
FB
370#if defined(TARGET_SPARC)
371#define TARGET_SA_NOCLDSTOP 8u
372#define TARGET_SA_NOCLDWAIT 0x100u
373#define TARGET_SA_SIGINFO 0x200u
374#define TARGET_SA_ONSTACK 1u
375#define TARGET_SA_RESTART 2u
376#define TARGET_SA_NODEFER 0x20u
377#define TARGET_SA_RESETHAND 4u
378#elif defined(TARGET_MIPS)
379#define TARGET_SA_NOCLDSTOP 0x00000001
380#define TARGET_SA_NOCLDWAIT 0x00010000
381#define TARGET_SA_SIGINFO 0x00000008
382#define TARGET_SA_ONSTACK 0x08000000
383#define TARGET_SA_NODEFER 0x40000000
384#define TARGET_SA_RESTART 0x10000000
385#define TARGET_SA_RESETHAND 0x80000000
d26bc211
TS
386#if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64)
387#define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */
540635ba 388#endif
d962783e
JL
389#elif defined(TARGET_OPENRISC)
390#define TARGET_SA_NOCLDSTOP 0x00000001
391#define TARGET_SA_NOCLDWAIT 0x00000002
392#define TARGET_SA_SIGINFO 0x00000004
393#define TARGET_SA_ONSTACK 0x08000000
394#define TARGET_SA_RESTART 0x10000000
395#define TARGET_SA_NODEFER 0x40000000
396#define TARGET_SA_RESETHAND 0x80000000
57f18a95
RH
397#elif defined(TARGET_ALPHA)
398#define TARGET_SA_ONSTACK 0x00000001
399#define TARGET_SA_RESTART 0x00000002
400#define TARGET_SA_NOCLDSTOP 0x00000004
401#define TARGET_SA_NODEFER 0x00000008
402#define TARGET_SA_RESETHAND 0x00000010
403#define TARGET_SA_NOCLDWAIT 0x00000020 /* not supported yet */
404#define TARGET_SA_SIGINFO 0x00000040
048f6b4d 405#else
2521d698
FB
406#define TARGET_SA_NOCLDSTOP 0x00000001
407#define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */
408#define TARGET_SA_SIGINFO 0x00000004
409#define TARGET_SA_ONSTACK 0x08000000
410#define TARGET_SA_RESTART 0x10000000
411#define TARGET_SA_NODEFER 0x40000000
412#define TARGET_SA_RESETHAND 0x80000000
413#define TARGET_SA_RESTORER 0x04000000
6d5e216d
FB
414#endif
415
d0f20495
RH
416#if defined(TARGET_ALPHA)
417
418#define TARGET_SIGHUP 1
419#define TARGET_SIGINT 2
420#define TARGET_SIGQUIT 3
421#define TARGET_SIGILL 4
422#define TARGET_SIGTRAP 5
423#define TARGET_SIGABRT 6
424#define TARGET_SIGSTKFLT 7 /* actually SIGEMT */
425#define TARGET_SIGFPE 8
426#define TARGET_SIGKILL 9
427#define TARGET_SIGBUS 10
428#define TARGET_SIGSEGV 11
429#define TARGET_SIGSYS 12
430#define TARGET_SIGPIPE 13
431#define TARGET_SIGALRM 14
432#define TARGET_SIGTERM 15
433#define TARGET_SIGURG 16
434#define TARGET_SIGSTOP 17
435#define TARGET_SIGTSTP 18
436#define TARGET_SIGCONT 19
437#define TARGET_SIGCHLD 20
438#define TARGET_SIGTTIN 21
439#define TARGET_SIGTTOU 22
440#define TARGET_SIGIO 23
441#define TARGET_SIGXCPU 24
442#define TARGET_SIGXFSZ 25
443#define TARGET_SIGVTALRM 26
444#define TARGET_SIGPROF 27
445#define TARGET_SIGWINCH 28
446#define TARGET_SIGPWR 29 /* actually SIGINFO */
447#define TARGET_SIGUSR1 30
448#define TARGET_SIGUSR2 31
449#define TARGET_SIGRTMIN 32
450
451#define TARGET_SIG_BLOCK 1
452#define TARGET_SIG_UNBLOCK 2
453#define TARGET_SIG_SETMASK 3
454
455#elif defined(TARGET_SPARC)
6d5e216d
FB
456
457#define TARGET_SIGHUP 1
458#define TARGET_SIGINT 2
459#define TARGET_SIGQUIT 3
460#define TARGET_SIGILL 4
461#define TARGET_SIGTRAP 5
462#define TARGET_SIGABRT 6
463#define TARGET_SIGIOT 6
464#define TARGET_SIGSTKFLT 7 /* actually EMT */
465#define TARGET_SIGFPE 8
466#define TARGET_SIGKILL 9
467#define TARGET_SIGBUS 10
468#define TARGET_SIGSEGV 11
469#define TARGET_SIGSYS 12
470#define TARGET_SIGPIPE 13
471#define TARGET_SIGALRM 14
472#define TARGET_SIGTERM 15
473#define TARGET_SIGURG 16
474#define TARGET_SIGSTOP 17
475#define TARGET_SIGTSTP 18
476#define TARGET_SIGCONT 19
477#define TARGET_SIGCHLD 20
478#define TARGET_SIGTTIN 21
479#define TARGET_SIGTTOU 22
480#define TARGET_SIGIO 23
481#define TARGET_SIGXCPU 24
482#define TARGET_SIGXFSZ 25
483#define TARGET_SIGVTALRM 26
484#define TARGET_SIGPROF 27
485#define TARGET_SIGWINCH 28
486#define TARGET_SIGPWR 29
487#define TARGET_SIGUSR1 30
488#define TARGET_SIGUSR2 31
489#define TARGET_SIGRTMIN 32
490
491#define TARGET_SIG_BLOCK 0x01 /* for blocking signals */
492#define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */
493#define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */
494
048f6b4d
FB
495#elif defined(TARGET_MIPS)
496
497#define TARGET_SIGHUP 1 /* Hangup (POSIX). */
498#define TARGET_SIGINT 2 /* Interrupt (ANSI). */
499#define TARGET_SIGQUIT 3 /* Quit (POSIX). */
500#define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */
501#define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */
502#define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */
503#define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */
504#define TARGET_SIGEMT 7
505#define TARGET_SIGSTKFLT 7 /* XXX: incorrect */
506#define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */
507#define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */
508#define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */
509#define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */
510#define TARGET_SIGSYS 12
511#define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */
512#define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */
513#define TARGET_SIGTERM 15 /* Termination (ANSI). */
514#define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */
515#define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */
516#define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */
517#define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */
518#define TARGET_SIGPWR 19 /* Power failure restart (System V). */
519#define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */
520#define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */
521#define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */
522#define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */
523#define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */
524#define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */
525#define TARGET_SIGCONT 25 /* Continue (POSIX). */
526#define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */
527#define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */
528#define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */
529#define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
530#define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
531#define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
532#define TARGET_SIGRTMIN 32
533
534#define TARGET_SIG_BLOCK 1 /* for blocking signals */
535#define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */
536#define TARGET_SIG_SETMASK 3 /* for setting the signal mask */
537
6d5e216d 538#else
2521d698 539
d962783e 540/* OpenRISC Using the general signals */
2521d698
FB
541#define TARGET_SIGHUP 1
542#define TARGET_SIGINT 2
543#define TARGET_SIGQUIT 3
544#define TARGET_SIGILL 4
545#define TARGET_SIGTRAP 5
546#define TARGET_SIGABRT 6
547#define TARGET_SIGIOT 6
548#define TARGET_SIGBUS 7
549#define TARGET_SIGFPE 8
550#define TARGET_SIGKILL 9
551#define TARGET_SIGUSR1 10
552#define TARGET_SIGSEGV 11
553#define TARGET_SIGUSR2 12
554#define TARGET_SIGPIPE 13
555#define TARGET_SIGALRM 14
556#define TARGET_SIGTERM 15
557#define TARGET_SIGSTKFLT 16
558#define TARGET_SIGCHLD 17
559#define TARGET_SIGCONT 18
560#define TARGET_SIGSTOP 19
561#define TARGET_SIGTSTP 20
562#define TARGET_SIGTTIN 21
563#define TARGET_SIGTTOU 22
564#define TARGET_SIGURG 23
565#define TARGET_SIGXCPU 24
566#define TARGET_SIGXFSZ 25
567#define TARGET_SIGVTALRM 26
568#define TARGET_SIGPROF 27
569#define TARGET_SIGWINCH 28
570#define TARGET_SIGIO 29
c596ed17
FB
571#define TARGET_SIGPWR 30
572#define TARGET_SIGSYS 31
2521d698
FB
573#define TARGET_SIGRTMIN 32
574
575#define TARGET_SIG_BLOCK 0 /* for blocking signals */
576#define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */
577#define TARGET_SIG_SETMASK 2 /* for setting the signal mask */
578
6d5e216d
FB
579#endif
580
6049f4f8
RH
581#if defined(TARGET_ALPHA)
582struct target_old_sigaction {
583 abi_ulong _sa_handler;
584 abi_ulong sa_mask;
d2565875 585 int32_t sa_flags;
6049f4f8
RH
586};
587
588struct target_rt_sigaction {
589 abi_ulong _sa_handler;
590 abi_ulong sa_flags;
591 target_sigset_t sa_mask;
592};
106ec879 593
6049f4f8
RH
594/* This is the struct used inside the kernel. The ka_restorer
595 field comes from the 5th argument to sys_rt_sigaction. */
596struct target_sigaction {
597 abi_ulong _sa_handler;
598 abi_ulong sa_flags;
599 target_sigset_t sa_mask;
600 abi_ulong sa_restorer;
601};
602#elif defined(TARGET_MIPS)
106ec879 603struct target_sigaction {
540635ba 604 uint32_t sa_flags;
d26bc211 605#if defined(TARGET_ABI_MIPSN32)
540635ba
TS
606 uint32_t _sa_handler;
607#else
992f48a0 608 abi_ulong _sa_handler;
540635ba 609#endif
c227f099 610 target_sigset_t sa_mask;
106ec879 611};
106ec879 612#else
2521d698 613struct target_old_sigaction {
992f48a0
BS
614 abi_ulong _sa_handler;
615 abi_ulong sa_mask;
616 abi_ulong sa_flags;
617 abi_ulong sa_restorer;
2521d698
FB
618};
619
620struct target_sigaction {
992f48a0
BS
621 abi_ulong _sa_handler;
622 abi_ulong sa_flags;
623 abi_ulong sa_restorer;
c227f099 624 target_sigset_t sa_mask;
2521d698 625};
106ec879 626#endif
2521d698
FB
627
628typedef union target_sigval {
629 int sival_int;
992f48a0 630 abi_ulong sival_ptr;
c227f099 631} target_sigval_t;
6d5e216d
FB
632#if 0
633#if defined (TARGET_SPARC)
634typedef struct {
635 struct {
992f48a0
BS
636 abi_ulong psr;
637 abi_ulong pc;
638 abi_ulong npc;
639 abi_ulong y;
640 abi_ulong u_regs[16]; /* globals and ins */
6d5e216d
FB
641 } si_regs;
642 int si_mask;
643} __siginfo_t;
644
645typedef struct {
646 unsigned long si_float_regs [32];
647 unsigned long si_fsr;
648 unsigned long si_fpqdepth;
649 struct {
650 unsigned long *insn_addr;
651 unsigned long insn;
652 } si_fpqueue [16];
653} __siginfo_fpu_t;
654#endif
655#endif
2521d698
FB
656
657#define TARGET_SI_MAX_SIZE 128
658#define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3)
659
660typedef struct target_siginfo {
3f53d546
PB
661#ifdef TARGET_MIPS
662 int si_signo;
663 int si_code;
664 int si_errno;
665#else
2521d698
FB
666 int si_signo;
667 int si_errno;
668 int si_code;
3f53d546 669#endif
2521d698
FB
670
671 union {
672 int _pad[TARGET_SI_PAD_SIZE];
673
674 /* kill() */
675 struct {
676 pid_t _pid; /* sender's pid */
677 uid_t _uid; /* sender's uid */
678 } _kill;
679
680 /* POSIX.1b timers */
681 struct {
682 unsigned int _timer1;
683 unsigned int _timer2;
684 } _timer;
685
686 /* POSIX.1b signals */
687 struct {
688 pid_t _pid; /* sender's pid */
689 uid_t _uid; /* sender's uid */
c227f099 690 target_sigval_t _sigval;
2521d698
FB
691 } _rt;
692
693 /* SIGCHLD */
694 struct {
695 pid_t _pid; /* which child */
696 uid_t _uid; /* sender's uid */
697 int _status; /* exit code */
c227f099
AL
698 target_clock_t _utime;
699 target_clock_t _stime;
2521d698
FB
700 } _sigchld;
701
702 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
703 struct {
992f48a0 704 abi_ulong _addr; /* faulting insn/memory ref. */
2521d698
FB
705 } _sigfault;
706
707 /* SIGPOLL */
708 struct {
709 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
710 int _fd;
711 } _sigpoll;
712 } _sifields;
c227f099 713} target_siginfo_t;
2521d698
FB
714
715/*
716 * si_code values
717 * Digital reserves positive values for kernel-generated signals.
718 */
719#define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */
720#define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */
721#define TARGET_SI_QUEUE -1 /* sent by sigqueue */
722#define TARGET_SI_TIMER -2 /* sent by timer expiration */
723#define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */
724#define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */
725#define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */
726
727/*
728 * SIGILL si_codes
729 */
ffa65c3b 730#define TARGET_ILL_ILLOPC (1) /* illegal opcode */
2521d698 731#define TARGET_ILL_ILLOPN (2) /* illegal operand */
ffa65c3b
FB
732#define TARGET_ILL_ILLADR (3) /* illegal addressing mode */
733#define TARGET_ILL_ILLTRP (4) /* illegal trap */
734#define TARGET_ILL_PRVOPC (5) /* privileged opcode */
735#define TARGET_ILL_PRVREG (6) /* privileged register */
736#define TARGET_ILL_COPROC (7) /* coprocessor error */
737#define TARGET_ILL_BADSTK (8) /* internal stack error */
2521d698
FB
738
739/*
740 * SIGFPE si_codes
741 */
742#define TARGET_FPE_INTDIV (1) /* integer divide by zero */
743#define TARGET_FPE_INTOVF (2) /* integer overflow */
744#define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */
745#define TARGET_FPE_FLTOVF (4) /* floating point overflow */
746#define TARGET_FPE_FLTUND (5) /* floating point underflow */
747#define TARGET_FPE_FLTRES (6) /* floating point inexact result */
748#define TARGET_FPE_FLTINV (7) /* floating point invalid operation */
749#define TARGET_FPE_FLTSUB (8) /* subscript out of range */
750#define TARGET_NSIGFPE 8
751
752/*
753 * SIGSEGV si_codes
754 */
755#define TARGET_SEGV_MAPERR (1) /* address not mapped to object */
756#define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */
757
ffa65c3b
FB
758/*
759 * SIGBUS si_codes
760 */
761#define TARGET_BUS_ADRALN (1) /* invalid address alignment */
b4916d7b 762#define TARGET_BUS_ADRERR (2) /* non-existent physical address */
ffa65c3b
FB
763#define TARGET_BUS_OBJERR (3) /* object specific hardware error */
764
2521d698
FB
765/*
766 * SIGTRAP si_codes
767 */
768#define TARGET_TRAP_BRKPT (1) /* process breakpoint */
769#define TARGET_TRAP_TRACE (2) /* process trace trap */
770
771#endif /* defined(TARGET_I386) || defined(TARGET_ARM) */
772
9de5e440 773struct target_rlimit {
992f48a0
BS
774 abi_ulong rlim_cur;
775 abi_ulong rlim_max;
9de5e440
FB
776};
777
81bbe906 778#if defined(TARGET_ALPHA)
e476492e 779#define TARGET_RLIM_INFINITY 0x7fffffffffffffffull
6cafd027 780#elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32)
81bbe906
TY
781#define TARGET_RLIM_INFINITY 0x7fffffffUL
782#else
26b746db 783#define TARGET_RLIM_INFINITY ((abi_ulong)-1)
81bbe906
TY
784#endif
785
e22b7015
WT
786#if defined(TARGET_MIPS)
787#define TARGET_RLIMIT_CPU 0
788#define TARGET_RLIMIT_FSIZE 1
789#define TARGET_RLIMIT_DATA 2
790#define TARGET_RLIMIT_STACK 3
791#define TARGET_RLIMIT_CORE 4
792#define TARGET_RLIMIT_RSS 7
793#define TARGET_RLIMIT_NPROC 8
794#define TARGET_RLIMIT_NOFILE 5
795#define TARGET_RLIMIT_MEMLOCK 9
796#define TARGET_RLIMIT_AS 6
797#define TARGET_RLIMIT_LOCKS 10
798#define TARGET_RLIMIT_SIGPENDING 11
799#define TARGET_RLIMIT_MSGQUEUE 12
800#define TARGET_RLIMIT_NICE 13
801#define TARGET_RLIMIT_RTPRIO 14
802#else
803#define TARGET_RLIMIT_CPU 0
804#define TARGET_RLIMIT_FSIZE 1
805#define TARGET_RLIMIT_DATA 2
806#define TARGET_RLIMIT_STACK 3
807#define TARGET_RLIMIT_CORE 4
808#define TARGET_RLIMIT_RSS 5
6cafd027
MB
809#if defined(TARGET_SPARC)
810#define TARGET_RLIMIT_NOFILE 6
811#define TARGET_RLIMIT_NPROC 7
812#else
e22b7015
WT
813#define TARGET_RLIMIT_NPROC 6
814#define TARGET_RLIMIT_NOFILE 7
6cafd027 815#endif
e22b7015
WT
816#define TARGET_RLIMIT_MEMLOCK 8
817#define TARGET_RLIMIT_AS 9
818#define TARGET_RLIMIT_LOCKS 10
819#define TARGET_RLIMIT_SIGPENDING 11
820#define TARGET_RLIMIT_MSGQUEUE 12
821#define TARGET_RLIMIT_NICE 13
822#define TARGET_RLIMIT_RTPRIO 14
823#endif
824
9de5e440
FB
825struct target_pollfd {
826 int fd; /* file descriptor */
827 short events; /* requested events */
828 short revents; /* returned events */
829};
830
8e5a0667 831/* virtual terminal ioctls */
0221cfcd
FB
832#define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */
833#define TARGET_KDMKTONE 0x4B30 /* generate tone */
8e5a0667 834#define TARGET_KDGKBTYPE 0x4b33
f7680a55
UH
835#define TARGET_KDSETMODE 0x4b3a
836#define TARGET_KDGKBMODE 0x4b44
837#define TARGET_KDSKBMODE 0x4b45
0221cfcd
FB
838#define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */
839#define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */
e6fe18fb
CV
840#define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */
841#define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */
842#define TARGET_KDGETLED 0x4B31 /* return current led state */
843#define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */
ca56f5b5 844#define TARGET_KDSIGACCEPT 0x4B4E
8e5a0667 845
2521d698
FB
846#define TARGET_SIOCATMARK 0x8905
847
31e31b8a
FB
848/* Networking ioctls */
849#define TARGET_SIOCADDRT 0x890B /* add routing table entry */
850#define TARGET_SIOCDELRT 0x890C /* delete routing table entry */
851#define TARGET_SIOCGIFNAME 0x8910 /* get iface name */
852#define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */
853#define TARGET_SIOCGIFCONF 0x8912 /* get iface list */
854#define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */
855#define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */
856#define TARGET_SIOCGIFADDR 0x8915 /* get PA address */
857#define TARGET_SIOCSIFADDR 0x8916 /* set PA address */
858#define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */
859#define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */
860#define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */
861#define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */
862#define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */
863#define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */
864#define TARGET_SIOCGIFMETRIC 0x891d /* get metric */
865#define TARGET_SIOCSIFMETRIC 0x891e /* set metric */
866#define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */
867#define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */
868#define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */
869#define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */
870#define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */
871#define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */
872#define TARGET_SIOCSIFENCAP 0x8926
873#define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */
874#define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */
875#define TARGET_SIOCSIFSLAVE 0x8930
876#define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */
877#define TARGET_SIOCDELMULTI 0x8932
f63eb01a 878#define TARGET_SIOCGIFINDEX 0x8933
31e31b8a
FB
879
880/* Bridging control calls */
881#define TARGET_SIOCGIFBR 0x8940 /* Bridging support */
882#define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */
883
884#define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
885#define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
886
887/* ARP cache control calls. */
888#define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */
889#define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */
890#define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */
891#define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */
892#define TARGET_SIOCGARP 0x8954 /* get ARP table entry */
893#define TARGET_SIOCSARP 0x8955 /* set ARP table entry */
894
895/* RARP cache control calls. */
896#define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */
897#define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */
898#define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */
899
900/* Driver configuration calls */
901#define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */
902#define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */
903
904/* DLCI configuration calls */
905#define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */
906#define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */
907
86fcd946
LV
908/* From <linux/wireless.h> */
909
910#define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */
31e31b8a
FB
911
912/* From <linux/fs.h> */
913
914#define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
915#define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
916#define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */
917#define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
918#define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */
919#define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */
920#define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */
921#define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
922#define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
923#define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
924#define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
925#define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */
fff8c539 926#define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */
31e31b8a 927/* A jump here: 108-111 have been used for various private purposes. */
c8b0bf54
PM
928#define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong)
929#define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong)
edafea13
AG
930#define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong)
931 /* return device size in bytes
932 (u64 *arg) */
31e31b8a
FB
933#define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */
934#define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */
285da2b9 935#define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
31e31b8a
FB
936
937/* cdrom commands */
5fafdf24 938#define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */
31e31b8a
FB
939#define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */
940#define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */
5fafdf24 941#define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index
31e31b8a 942 (struct cdrom_ti) */
5fafdf24 943#define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header
31e31b8a 944 (struct cdrom_tochdr) */
5fafdf24 945#define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry
31e31b8a
FB
946 (struct cdrom_tocentry) */
947#define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */
948#define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */
949#define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */
5fafdf24 950#define TARGET_CDROMVOLCTRL 0x530a /* Control output volume
31e31b8a 951 (struct cdrom_volctrl) */
5fafdf24 952#define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data
31e31b8a 953 (struct cdrom_subchnl) */
5fafdf24 954#define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
31e31b8a
FB
955 (struct cdrom_read) */
956#define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
957 (struct cdrom_read) */
958#define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */
959#define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */
5fafdf24
TS
960#define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session
961 address of multi session disks
31e31b8a 962 (struct cdrom_multisession) */
5fafdf24 963#define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code"
31e31b8a 964 if available (struct cdrom_mcn) */
5fafdf24 965#define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is depricated,
b4916d7b 966 but here anyway for compatibility */
31e31b8a 967#define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */
5fafdf24 968#define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting
31e31b8a
FB
969 (struct cdrom_volctrl) */
970#define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes)
971 (struct cdrom_read) */
5fafdf24 972/*
31e31b8a
FB
973 * These ioctls are used only used in aztcd.c and optcd.c
974 */
975#define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */
976#define TARGET_CDROMSEEK 0x5316 /* seek msf address */
3b46e624 977
31e31b8a 978/*
3b46e624 979 * This ioctl is only used by the scsi-cd driver.
31e31b8a
FB
980 It is for playing audio in logical block addressing mode.
981 */
982#define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */
983
5fafdf24 984/*
31e31b8a
FB
985 * These ioctls are only used in optcd.c
986 */
987#define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */
988
5fafdf24
TS
989/*
990 * These ioctls are (now) only in ide-cd.c for controlling
31e31b8a
FB
991 * drive spindown time. They should be implemented in the
992 * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
993 * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
994 * -Erik
995 */
996#define TARGET_CDROMGETSPINDOWN 0x531d
997#define TARGET_CDROMSETSPINDOWN 0x531e
998
5fafdf24 999/*
31e31b8a
FB
1000 * These ioctls are implemented through the uniform CD-ROM driver
1001 * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
1002 * drivers are eventually ported to the uniform CD-ROM driver interface.
1003 */
1004#define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
1005#define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */
1006#define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */
1007#define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */
1008#define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */
1009#define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */
1010#define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
1011#define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */
1012#define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */
1013#define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */
1014#define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */
1015#define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
1016
1017/* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
1018 * Future CDROM ioctls should be kept below 0x537F
1019 */
1020
1021/* This ioctl is only used by sbpcd at the moment */
1022#define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */
1023 /* conflict with SCSI_IOCTL_GET_IDLUN */
1024
1025/* DVD-ROM Specific ioctls */
1026#define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */
1027#define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */
1028#define TARGET_DVD_AUTH 0x5392 /* Authentication */
1029
1030#define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */
1031#define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */
1032#define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */
1033
1034/* HD commands */
1035
1036/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
1037#define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */
1038#define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
1039#define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
31e31b8a
FB
1040#define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
1041#define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
1042#define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
1043#define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */
2521d698 1044#define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
31e31b8a
FB
1045#define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
1046
1047/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
1048#define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
1049#define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
1050#define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
1051#define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
1052#define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
1053#define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */
1054#define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
2521d698 1055
b8005914
AZ
1056/* loop ioctls */
1057#define TARGET_LOOP_SET_FD 0x4C00
1058#define TARGET_LOOP_CLR_FD 0x4C01
1059#define TARGET_LOOP_SET_STATUS 0x4C02
1060#define TARGET_LOOP_GET_STATUS 0x4C03
1061#define TARGET_LOOP_SET_STATUS64 0x4C04
1062#define TARGET_LOOP_GET_STATUS64 0x4C05
1063#define TARGET_LOOP_CHANGE_FD 0x4C06
2521d698 1064
f7680a55
UH
1065/* fb ioctls */
1066#define TARGET_FBIOGET_VSCREENINFO 0x4600
1067#define TARGET_FBIOPUT_VSCREENINFO 0x4601
1068#define TARGET_FBIOGET_FSCREENINFO 0x4602
12b81b71
CV
1069#define TARGET_FBIOGETCMAP 0x4604
1070#define TARGET_FBIOPUTCMAP 0x4605
1071#define TARGET_FBIOPAN_DISPLAY 0x4606
1072#define TARGET_FBIOGET_CON2FBMAP 0x460F
1073#define TARGET_FBIOPUT_CON2FBMAP 0x4610
f7680a55
UH
1074
1075/* vt ioctls */
1076#define TARGET_VT_OPENQRY 0x5600
1077#define TARGET_VT_GETSTATE 0x5603
1078#define TARGET_VT_ACTIVATE 0x5606
1079#define TARGET_VT_WAITACTIVE 0x5607
1080#define TARGET_VT_LOCKSWITCH 0x560b
1081#define TARGET_VT_UNLOCKSWITCH 0x560c
774750c0
CV
1082#define TARGET_VT_GETMODE 0x5601
1083#define TARGET_VT_SETMODE 0x5602
1084#define TARGET_VT_RELDISP 0x5605
1085#define TARGET_VT_DISALLOCATE 0x5608
f7680a55 1086
56e904ec
AG
1087/* device mapper */
1088#define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00)
1089#define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01)
1090#define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02)
1091#define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03)
1092#define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04)
1093#define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05)
1094#define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06)
1095#define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07)
1096#define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08)
1097#define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09)
1098#define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a)
1099#define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b)
1100#define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c)
1101#define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d)
1102#define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e)
1103#define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f)
1104
2521d698
FB
1105/* from asm/termbits.h */
1106
3bfd9da1
FB
1107#define TARGET_NCC 8
1108struct target_termio {
1109 unsigned short c_iflag; /* input mode flags */
1110 unsigned short c_oflag; /* output mode flags */
1111 unsigned short c_cflag; /* control mode flags */
1112 unsigned short c_lflag; /* local mode flags */
1113 unsigned char c_line; /* line discipline */
1114 unsigned char c_cc[TARGET_NCC]; /* control characters */
1115};
2521d698 1116
3bfd9da1
FB
1117struct target_winsize {
1118 unsigned short ws_row;
1119 unsigned short ws_col;
1120 unsigned short ws_xpixel;
1121 unsigned short ws_ypixel;
2521d698
FB
1122};
1123
3bfd9da1 1124#include "termbits.h"
2521d698 1125
9e0b74a4
PB
1126#if defined(TARGET_MIPS)
1127#define TARGET_PROT_SEM 0x10
1128#else
1129#define TARGET_PROT_SEM 0x08
1130#endif
1131
e44a3e79 1132/* Common */
2521d698
FB
1133#define TARGET_MAP_SHARED 0x01 /* Share changes */
1134#define TARGET_MAP_PRIVATE 0x02 /* Changes are private */
e44a3e79
AJ
1135#define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */
1136
1137/* Target specific */
048f6b4d 1138#if defined(TARGET_MIPS)
e44a3e79 1139#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
048f6b4d
FB
1140#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */
1141#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */
1142#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */
1143#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */
1144#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */
1145#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */
540635ba
TS
1146#define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
1147#define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */
e44a3e79
AJ
1148#elif defined(TARGET_PPC)
1149#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
2521d698 1150#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
2521d698
FB
1151#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */
1152#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
1153#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
7ec93196
JM
1154#define TARGET_MAP_LOCKED 0x0080 /* pages are locked */
1155#define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */
e44a3e79
AJ
1156#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
1157#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */
1158#elif defined(TARGET_ALPHA)
1159#define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */
1160#define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */
1161#define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */
1162#define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */
1163#define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */
1164#define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */
1165#define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */
1166#define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */
1167#define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */
7ec93196 1168#else
e44a3e79
AJ
1169#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
1170#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
1171#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */
1172#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
1173#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
2521d698
FB
1174#define TARGET_MAP_LOCKED 0x2000 /* pages are locked */
1175#define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */
540635ba
TS
1176#define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
1177#define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */
906c1b8e 1178#define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */
7ec93196 1179#endif
2521d698 1180
09701199
AG
1181#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
1182 || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
c7819dfb 1183 || defined(TARGET_CRIS) || defined(TARGET_UNICORE32)
2521d698
FB
1184struct target_stat {
1185 unsigned short st_dev;
1186 unsigned short __pad1;
992f48a0 1187 abi_ulong st_ino;
2521d698
FB
1188 unsigned short st_mode;
1189 unsigned short st_nlink;
1190 unsigned short st_uid;
1191 unsigned short st_gid;
1192 unsigned short st_rdev;
1193 unsigned short __pad2;
992f48a0
BS
1194 abi_ulong st_size;
1195 abi_ulong st_blksize;
1196 abi_ulong st_blocks;
1197 abi_ulong target_st_atime;
1198 abi_ulong __unused1;
1199 abi_ulong target_st_mtime;
1200 abi_ulong __unused2;
1201 abi_ulong target_st_ctime;
1202 abi_ulong __unused3;
1203 abi_ulong __unused4;
1204 abi_ulong __unused5;
2521d698
FB
1205};
1206
1207/* This matches struct stat64 in glibc2.1, hence the absolutely
1208 * insane amounts of padding around dev_t's.
1209 */
20d155bc 1210#define TARGET_HAS_STRUCT_STAT64
2521d698
FB
1211struct target_stat64 {
1212 unsigned short st_dev;
1213 unsigned char __pad0[10];
1214
1215#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
992f48a0 1216 abi_ulong __st_ino;
2521d698
FB
1217
1218 unsigned int st_mode;
1219 unsigned int st_nlink;
1220
992f48a0
BS
1221 abi_ulong st_uid;
1222 abi_ulong st_gid;
2521d698
FB
1223
1224 unsigned short st_rdev;
1225 unsigned char __pad3[10];
1226
1227 long long st_size;
992f48a0 1228 abi_ulong st_blksize;
2521d698 1229
992f48a0
BS
1230 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */
1231 abi_ulong __pad4; /* future possible st_blocks high bits */
2521d698 1232
992f48a0
BS
1233 abi_ulong target_st_atime;
1234 abi_ulong __pad5;
2521d698 1235
992f48a0
BS
1236 abi_ulong target_st_mtime;
1237 abi_ulong __pad6;
2521d698 1238
992f48a0
BS
1239 abi_ulong target_st_ctime;
1240 abi_ulong __pad7; /* will be high 32 bits of ctime someday */
2521d698
FB
1241
1242 unsigned long long st_ino;
541dc0d4 1243} QEMU_PACKED;
2521d698 1244
ce4defa0 1245#ifdef TARGET_ARM
20d155bc 1246#define TARGET_HAS_STRUCT_STAT64
ce4defa0
PB
1247struct target_eabi_stat64 {
1248 unsigned long long st_dev;
1249 unsigned int __pad1;
992f48a0 1250 abi_ulong __st_ino;
ce4defa0
PB
1251 unsigned int st_mode;
1252 unsigned int st_nlink;
1253
992f48a0
BS
1254 abi_ulong st_uid;
1255 abi_ulong st_gid;
ce4defa0
PB
1256
1257 unsigned long long st_rdev;
1258 unsigned int __pad2[2];
1259
1260 long long st_size;
992f48a0 1261 abi_ulong st_blksize;
ce4defa0
PB
1262 unsigned int __pad3;
1263 unsigned long long st_blocks;
1264
992f48a0
BS
1265 abi_ulong target_st_atime;
1266 abi_ulong target_st_atime_nsec;
ce4defa0 1267
992f48a0
BS
1268 abi_ulong target_st_mtime;
1269 abi_ulong target_st_mtime_nsec;
ce4defa0 1270
992f48a0
BS
1271 abi_ulong target_st_ctime;
1272 abi_ulong target_st_ctime_nsec;
ce4defa0
PB
1273
1274 unsigned long long st_ino;
541dc0d4 1275} QEMU_PACKED;
ce4defa0
PB
1276#endif
1277
992f48a0 1278#elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
1b8dd648
BS
1279struct target_stat {
1280 unsigned int st_dev;
992f48a0 1281 abi_ulong st_ino;
1b8dd648
BS
1282 unsigned int st_mode;
1283 unsigned int st_nlink;
1284 unsigned int st_uid;
1285 unsigned int st_gid;
1286 unsigned int st_rdev;
992f48a0
BS
1287 abi_long st_size;
1288 abi_long target_st_atime;
1289 abi_long target_st_mtime;
1290 abi_long target_st_ctime;
1291 abi_long st_blksize;
1292 abi_long st_blocks;
1293 abi_ulong __unused4[2];
1b8dd648
BS
1294};
1295
20d155bc 1296#define TARGET_HAS_STRUCT_STAT64
1b8dd648
BS
1297struct target_stat64 {
1298 unsigned char __pad0[6];
1299 unsigned short st_dev;
1300
1301 uint64_t st_ino;
1302 uint64_t st_nlink;
1303
1304 unsigned int st_mode;
1305
1306 unsigned int st_uid;
1307 unsigned int st_gid;
1308
1309 unsigned char __pad2[6];
1310 unsigned short st_rdev;
1311
1312 int64_t st_size;
1313 int64_t st_blksize;
1314
1315 unsigned char __pad4[4];
1316 unsigned int st_blocks;
1317
992f48a0
BS
1318 abi_ulong target_st_atime;
1319 abi_ulong __unused1;
1b8dd648 1320
992f48a0
BS
1321 abi_ulong target_st_mtime;
1322 abi_ulong __unused2;
1b8dd648 1323
992f48a0
BS
1324 abi_ulong target_st_ctime;
1325 abi_ulong __unused3;
1b8dd648 1326
992f48a0 1327 abi_ulong __unused4[3];
1b8dd648
BS
1328};
1329
3bfd9da1
FB
1330#elif defined(TARGET_SPARC)
1331
1332struct target_stat {
1333 unsigned short st_dev;
992f48a0 1334 abi_ulong st_ino;
3bfd9da1
FB
1335 unsigned short st_mode;
1336 short st_nlink;
1337 unsigned short st_uid;
1338 unsigned short st_gid;
1339 unsigned short st_rdev;
992f48a0
BS
1340 abi_long st_size;
1341 abi_long target_st_atime;
1342 abi_ulong __unused1;
1343 abi_long target_st_mtime;
1344 abi_ulong __unused2;
1345 abi_long target_st_ctime;
1346 abi_ulong __unused3;
1347 abi_long st_blksize;
1348 abi_long st_blocks;
1349 abi_ulong __unused4[2];
3bfd9da1
FB
1350};
1351
20d155bc 1352#define TARGET_HAS_STRUCT_STAT64
3bfd9da1
FB
1353struct target_stat64 {
1354 unsigned char __pad0[6];
1355 unsigned short st_dev;
1356
1357 uint64_t st_ino;
1358
1359 unsigned int st_mode;
1360 unsigned int st_nlink;
1361
1362 unsigned int st_uid;
1363 unsigned int st_gid;
1364
1365 unsigned char __pad2[6];
1366 unsigned short st_rdev;
1367
1368 unsigned char __pad3[8];
1369
1370 int64_t st_size;
1371 unsigned int st_blksize;
1372
1373 unsigned char __pad4[8];
1374 unsigned int st_blocks;
1375
1376 unsigned int target_st_atime;
1377 unsigned int __unused1;
1378
1379 unsigned int target_st_mtime;
1380 unsigned int __unused2;
1381
1382 unsigned int target_st_ctime;
1383 unsigned int __unused3;
1384
1385 unsigned int __unused4;
1386 unsigned int __unused5;
1387};
1388
67867308
FB
1389#elif defined(TARGET_PPC)
1390
1391struct target_stat {
e32448e0 1392 abi_ulong st_dev;
992f48a0 1393 abi_ulong st_ino;
325e651f 1394#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
e32448e0 1395 abi_ulong st_nlink;
325e651f
JM
1396 unsigned int st_mode;
1397#else
67867308
FB
1398 unsigned int st_mode;
1399 unsigned short st_nlink;
325e651f 1400#endif
67867308
FB
1401 unsigned int st_uid;
1402 unsigned int st_gid;
e32448e0 1403 abi_ulong st_rdev;
992f48a0
BS
1404 abi_ulong st_size;
1405 abi_ulong st_blksize;
1406 abi_ulong st_blocks;
1407 abi_ulong target_st_atime;
e32448e0 1408 abi_ulong target_st_atime_nsec;
992f48a0 1409 abi_ulong target_st_mtime;
e32448e0 1410 abi_ulong target_st_mtime_nsec;
992f48a0 1411 abi_ulong target_st_ctime;
e32448e0 1412 abi_ulong target_st_ctime_nsec;
992f48a0
BS
1413 abi_ulong __unused4;
1414 abi_ulong __unused5;
325e651f
JM
1415#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
1416 abi_ulong __unused6;
1417#endif
67867308
FB
1418};
1419
20d155bc
SW
1420#if !defined(TARGET_PPC64) || defined(TARGET_ABI32)
1421#define TARGET_HAS_STRUCT_STAT64
541dc0d4 1422struct QEMU_PACKED target_stat64 {
67867308 1423 unsigned long long st_dev;
67867308 1424 unsigned long long st_ino;
3bfd9da1
FB
1425 unsigned int st_mode;
1426 unsigned int st_nlink;
67867308
FB
1427 unsigned int st_uid;
1428 unsigned int st_gid;
3bfd9da1 1429 unsigned long long st_rdev;
e1ce5e40 1430 unsigned long long __pad0;
e32448e0
JM
1431 long long st_size;
1432 int st_blksize;
e1ce5e40 1433 unsigned int __pad1;
61322e91 1434 long long st_blocks; /* Number 512-byte blocks allocated. */
e32448e0
JM
1435 int target_st_atime;
1436 unsigned int target_st_atime_nsec;
1437 int target_st_mtime;
1438 unsigned int target_st_mtime_nsec;
1439 int target_st_ctime;
1440 unsigned int target_st_ctime_nsec;
1441 unsigned int __unused4;
1442 unsigned int __unused5;
67867308 1443};
20d155bc 1444#endif
67867308 1445
b779e29e
EI
1446#elif defined(TARGET_MICROBLAZE)
1447
1448struct target_stat {
1449 abi_ulong st_dev;
1450 abi_ulong st_ino;
1451 unsigned int st_mode;
1452 unsigned short st_nlink;
1453 unsigned int st_uid;
1454 unsigned int st_gid;
1455 abi_ulong st_rdev;
1456 abi_ulong st_size;
1457 abi_ulong st_blksize;
1458 abi_ulong st_blocks;
1459 abi_ulong target_st_atime;
1460 abi_ulong target_st_atime_nsec;
1461 abi_ulong target_st_mtime;
1462 abi_ulong target_st_mtime_nsec;
1463 abi_ulong target_st_ctime;
1464 abi_ulong target_st_ctime_nsec;
1465 abi_ulong __unused4;
1466 abi_ulong __unused5;
1467};
1468
1469/* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */
20d155bc 1470#define TARGET_HAS_STRUCT_STAT64
541dc0d4 1471struct QEMU_PACKED target_stat64 {
b779e29e 1472 uint64_t st_dev;
a523eb06
EI
1473#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
1474 uint32_t pad0;
1475 uint32_t __st_ino;
1476
b779e29e
EI
1477 uint32_t st_mode;
1478 uint32_t st_nlink;
1479 uint32_t st_uid;
1480 uint32_t st_gid;
1481 uint64_t st_rdev;
21ebeb23 1482 uint64_t __pad1;
b779e29e
EI
1483
1484 int64_t st_size;
21ebeb23
EI
1485 int32_t st_blksize;
1486 uint32_t __pad2;
b779e29e
EI
1487 int64_t st_blocks; /* Number 512-byte blocks allocated. */
1488
1489 int target_st_atime;
a523eb06 1490 unsigned int target_st_atime_nsec;
b779e29e 1491 int target_st_mtime;
a523eb06 1492 unsigned int target_st_mtime_nsec;
b779e29e 1493 int target_st_ctime;
a523eb06
EI
1494 unsigned int target_st_ctime_nsec;
1495 uint64_t st_ino;
b779e29e
EI
1496};
1497
e6e5906b
PB
1498#elif defined(TARGET_M68K)
1499
1500struct target_stat {
1501 unsigned short st_dev;
1502 unsigned short __pad1;
992f48a0 1503 abi_ulong st_ino;
e6e5906b
PB
1504 unsigned short st_mode;
1505 unsigned short st_nlink;
1506 unsigned short st_uid;
1507 unsigned short st_gid;
1508 unsigned short st_rdev;
1509 unsigned short __pad2;
992f48a0
BS
1510 abi_ulong st_size;
1511 abi_ulong st_blksize;
1512 abi_ulong st_blocks;
1513 abi_ulong target_st_atime;
1514 abi_ulong __unused1;
1515 abi_ulong target_st_mtime;
1516 abi_ulong __unused2;
1517 abi_ulong target_st_ctime;
1518 abi_ulong __unused3;
1519 abi_ulong __unused4;
1520 abi_ulong __unused5;
e6e5906b
PB
1521};
1522
1523/* This matches struct stat64 in glibc2.1, hence the absolutely
1524 * insane amounts of padding around dev_t's.
1525 */
20d155bc 1526#define TARGET_HAS_STRUCT_STAT64
e6e5906b
PB
1527struct target_stat64 {
1528 unsigned long long st_dev;
1529 unsigned char __pad1[2];
1530
1531#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
992f48a0 1532 abi_ulong __st_ino;
e6e5906b
PB
1533
1534 unsigned int st_mode;
1535 unsigned int st_nlink;
1536
992f48a0
BS
1537 abi_ulong st_uid;
1538 abi_ulong st_gid;
e6e5906b
PB
1539
1540 unsigned long long st_rdev;
1541 unsigned char __pad3[2];
1542
1543 long long st_size;
992f48a0 1544 abi_ulong st_blksize;
e6e5906b 1545
992f48a0
BS
1546 abi_ulong __pad4; /* future possible st_blocks high bits */
1547 abi_ulong st_blocks; /* Number 512-byte blocks allocated. */
e6e5906b 1548
992f48a0
BS
1549 abi_ulong target_st_atime;
1550 abi_ulong target_st_atime_nsec;
e6e5906b 1551
992f48a0
BS
1552 abi_ulong target_st_mtime;
1553 abi_ulong target_st_mtime_nsec;
e6e5906b 1554
992f48a0
BS
1555 abi_ulong target_st_ctime;
1556 abi_ulong target_st_ctime_nsec;
e6e5906b
PB
1557
1558 unsigned long long st_ino;
541dc0d4 1559} QEMU_PACKED;
e6e5906b 1560
d26bc211 1561#elif defined(TARGET_ABI_MIPSN64)
540635ba
TS
1562
1563/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
1564struct target_stat {
1565 unsigned int st_dev;
1566 unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
1567
992f48a0 1568 abi_ulong st_ino;
540635ba
TS
1569
1570 unsigned int st_mode;
1571 unsigned int st_nlink;
1572
1573 int st_uid;
1574 int st_gid;
1575
1576 unsigned int st_rdev;
1577 unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
1578
992f48a0 1579 abi_ulong st_size;
540635ba
TS
1580
1581 /*
1582 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1583 * but we don't have it under Linux.
1584 */
1585 unsigned int target_st_atime;
1586 unsigned int target_st_atime_nsec;
1587
1588 unsigned int target_st_mtime;
1589 unsigned int target_st_mtime_nsec;
1590
1591 unsigned int target_st_ctime;
1592 unsigned int target_st_ctime_nsec;
1593
1594 unsigned int st_blksize;
1595 unsigned int st_pad2;
1596
992f48a0 1597 abi_ulong st_blocks;
540635ba
TS
1598};
1599
d26bc211 1600#elif defined(TARGET_ABI_MIPSN32)
540635ba
TS
1601
1602struct target_stat {
1603 unsigned st_dev;
1604 int st_pad1[3]; /* Reserved for network id */
1605 unsigned int st_ino;
1606 unsigned int st_mode;
1607 unsigned int st_nlink;
1608 int st_uid;
1609 int st_gid;
1610 unsigned st_rdev;
1611 unsigned int st_pad2[2];
1612 unsigned int st_size;
1613 unsigned int st_pad3;
1614 /*
1615 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1616 * but we don't have it under Linux.
1617 */
1618 unsigned int target_st_atime;
1619 unsigned int target_st_atime_nsec;
1620 unsigned int target_st_mtime;
1621 unsigned int target_st_mtime_nsec;
1622 unsigned int target_st_ctime;
1623 unsigned int target_st_ctime_nsec;
1624 unsigned int st_blksize;
1625 unsigned int st_blocks;
1626 unsigned int st_pad4[14];
1627};
1628
1629/*
1630 * This matches struct stat64 in glibc2.1, hence the absolutely insane
1631 * amounts of padding around dev_t's. The memory layout is the same as of
1632 * struct stat of the 64-bit kernel.
1633 */
1634
20d155bc 1635#define TARGET_HAS_STRUCT_STAT64
540635ba
TS
1636struct target_stat64 {
1637 unsigned int st_dev;
1638 unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
1639
1640 target_ulong st_ino;
1641
1642 unsigned int st_mode;
1643 unsigned int st_nlink;
1644
1645 int st_uid;
1646 int st_gid;
1647
1648 unsigned int st_rdev;
1649 unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
1650
1651 int st_size;
1652
1653 /*
1654 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1655 * but we don't have it under Linux.
1656 */
1657 int target_st_atime;
1658 unsigned int target_st_atime_nsec; /* Reserved for st_atime expansion */
1659
1660 int target_st_mtime;
1661 unsigned int target_st_mtime_nsec; /* Reserved for st_mtime expansion */
1662
1663 int target_st_ctime;
1664 unsigned int target_st_ctime_nsec; /* Reserved for st_ctime expansion */
1665
1666 unsigned int st_blksize;
1667 unsigned int st_pad2;
1668
1669 int st_blocks;
1670};
1671
d26bc211 1672#elif defined(TARGET_ABI_MIPSO32)
048f6b4d
FB
1673
1674struct target_stat {
1675 unsigned st_dev;
992f48a0
BS
1676 abi_long st_pad1[3]; /* Reserved for network id */
1677 abi_ulong st_ino;
048f6b4d
FB
1678 unsigned int st_mode;
1679 unsigned int st_nlink;
1680 int st_uid;
1681 int st_gid;
1682 unsigned st_rdev;
992f48a0
BS
1683 abi_long st_pad2[2];
1684 abi_long st_size;
1685 abi_long st_pad3;
048f6b4d
FB
1686 /*
1687 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1688 * but we don't have it under Linux.
1689 */
992f48a0
BS
1690 abi_long target_st_atime;
1691 abi_long target_st_atime_nsec;
1692 abi_long target_st_mtime;
1693 abi_long target_st_mtime_nsec;
1694 abi_long target_st_ctime;
1695 abi_long target_st_ctime_nsec;
1696 abi_long st_blksize;
1697 abi_long st_blocks;
1698 abi_long st_pad4[14];
048f6b4d
FB
1699};
1700
1701/*
1702 * This matches struct stat64 in glibc2.1, hence the absolutely insane
1703 * amounts of padding around dev_t's. The memory layout is the same as of
1704 * struct stat of the 64-bit kernel.
1705 */
1706
20d155bc 1707#define TARGET_HAS_STRUCT_STAT64
048f6b4d 1708struct target_stat64 {
992f48a0
BS
1709 abi_ulong st_dev;
1710 abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */
048f6b4d
FB
1711
1712 uint64_t st_ino;
1713
1714 unsigned int st_mode;
1715 unsigned int st_nlink;
1716
1717 int st_uid;
1718 int st_gid;
1719
992f48a0
BS
1720 abi_ulong st_rdev;
1721 abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */
048f6b4d
FB
1722
1723 int64_t st_size;
1724
1725 /*
1726 * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
1727 * but we don't have it under Linux.
1728 */
992f48a0
BS
1729 abi_long target_st_atime;
1730 abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */
048f6b4d 1731
992f48a0
BS
1732 abi_long target_st_mtime;
1733 abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */
048f6b4d 1734
992f48a0
BS
1735 abi_long target_st_ctime;
1736 abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */
048f6b4d 1737
992f48a0
BS
1738 abi_ulong st_blksize;
1739 abi_ulong st_pad2;
048f6b4d
FB
1740
1741 int64_t st_blocks;
1742};
7a3148a9
JM
1743
1744#elif defined(TARGET_ALPHA)
1745
1746struct target_stat {
1747 unsigned int st_dev;
1748 unsigned int st_ino;
1749 unsigned int st_mode;
1750 unsigned int st_nlink;
1751 unsigned int st_uid;
1752 unsigned int st_gid;
1753 unsigned int st_rdev;
992f48a0
BS
1754 abi_long st_size;
1755 abi_ulong target_st_atime;
1756 abi_ulong target_st_mtime;
1757 abi_ulong target_st_ctime;
7a3148a9
JM
1758 unsigned int st_blksize;
1759 unsigned int st_blocks;
1760 unsigned int st_flags;
1761 unsigned int st_gen;
1762};
1763
20d155bc 1764#define TARGET_HAS_STRUCT_STAT64
7a3148a9 1765struct target_stat64 {
992f48a0
BS
1766 abi_ulong st_dev;
1767 abi_ulong st_ino;
1768 abi_ulong st_rdev;
1769 abi_long st_size;
1770 abi_ulong st_blocks;
7a3148a9
JM
1771
1772 unsigned int st_mode;
1773 unsigned int st_uid;
1774 unsigned int st_gid;
1775 unsigned int st_blksize;
1776 unsigned int st_nlink;
1777 unsigned int __pad0;
1778
992f48a0
BS
1779 abi_ulong target_st_atime;
1780 abi_ulong target_st_atime_nsec;
1781 abi_ulong target_st_mtime;
1782 abi_ulong target_st_mtime_nsec;
1783 abi_ulong target_st_ctime;
1784 abi_ulong target_st_ctime_nsec;
1785 abi_long __unused[3];
7a3148a9
JM
1786};
1787
6db45e65
TS
1788#elif defined(TARGET_SH4)
1789
1790struct target_stat {
992f48a0
BS
1791 abi_ulong st_dev;
1792 abi_ulong st_ino;
6db45e65
TS
1793 unsigned short st_mode;
1794 unsigned short st_nlink;
1795 unsigned short st_uid;
1796 unsigned short st_gid;
992f48a0
BS
1797 abi_ulong st_rdev;
1798 abi_ulong st_size;
1799 abi_ulong st_blksize;
1800 abi_ulong st_blocks;
1801 abi_ulong target_st_atime;
1802 abi_ulong target_st_atime_nsec;
1803 abi_ulong target_st_mtime;
1804 abi_ulong target_st_mtime_nsec;
1805 abi_ulong target_st_ctime;
1806 abi_ulong target_st_ctime_nsec;
1807 abi_ulong __unused4;
1808 abi_ulong __unused5;
6db45e65
TS
1809};
1810
1811/* This matches struct stat64 in glibc2.1, hence the absolutely
1812 * insane amounts of padding around dev_t's.
1813 */
20d155bc 1814#define TARGET_HAS_STRUCT_STAT64
541dc0d4 1815struct QEMU_PACKED target_stat64 {
6db45e65
TS
1816 unsigned long long st_dev;
1817 unsigned char __pad0[4];
1818
1819#define TARGET_STAT64_HAS_BROKEN_ST_INO 1
992f48a0 1820 abi_ulong __st_ino;
6db45e65
TS
1821
1822 unsigned int st_mode;
1823 unsigned int st_nlink;
1824
992f48a0
BS
1825 abi_ulong st_uid;
1826 abi_ulong st_gid;
6db45e65
TS
1827
1828 unsigned long long st_rdev;
1829 unsigned char __pad3[4];
1830
1831 long long st_size;
992f48a0 1832 abi_ulong st_blksize;
6db45e65
TS
1833
1834 unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
1835
992f48a0
BS
1836 abi_ulong target_st_atime;
1837 abi_ulong target_st_atime_nsec;
6db45e65 1838
992f48a0
BS
1839 abi_ulong target_st_mtime;
1840 abi_ulong target_st_mtime_nsec;
6db45e65 1841
992f48a0
BS
1842 abi_ulong target_st_ctime;
1843 abi_ulong target_st_ctime_nsec;
6db45e65
TS
1844
1845 unsigned long long st_ino;
1846};
1847
d2fd1af7
FB
1848#elif defined(TARGET_I386) && !defined(TARGET_ABI32)
1849struct target_stat {
1850 abi_ulong st_dev;
1851 abi_ulong st_ino;
1852 abi_ulong st_nlink;
1853
1854 unsigned int st_mode;
1855 unsigned int st_uid;
1856 unsigned int st_gid;
1857 unsigned int __pad0;
1858 abi_ulong st_rdev;
1859 abi_long st_size;
1860 abi_long st_blksize;
1861 abi_long st_blocks; /* Number 512-byte blocks allocated. */
1862
1863 abi_ulong target_st_atime;
1864 abi_ulong target_st_atime_nsec;
1865 abi_ulong target_st_mtime;
1866 abi_ulong target_st_mtime_nsec;
1867 abi_ulong target_st_ctime;
1868 abi_ulong target_st_ctime_nsec;
1869
1870 abi_long __unused[3];
1871};
a4c075f1
UH
1872#elif defined(TARGET_S390X)
1873struct target_stat {
1874 abi_ulong st_dev;
1875 abi_ulong st_ino;
1876 abi_ulong st_nlink;
1877 unsigned int st_mode;
1878 unsigned int st_uid;
1879 unsigned int st_gid;
1880 unsigned int __pad1;
1881 abi_ulong st_rdev;
1882 abi_ulong st_size;
1883 abi_ulong target_st_atime;
1884 abi_ulong target_st_atime_nsec;
1885 abi_ulong target_st_mtime;
1886 abi_ulong target_st_mtime_nsec;
1887 abi_ulong target_st_ctime;
1888 abi_ulong target_st_ctime_nsec;
1889 abi_ulong st_blksize;
1890 abi_long st_blocks;
1891 abi_ulong __unused[3];
1892};
09701199
AG
1893#elif defined(TARGET_AARCH64)
1894struct target_stat {
1895 abi_ulong st_dev;
1896 abi_ulong st_ino;
1897 unsigned int st_mode;
1898 unsigned int st_nlink;
1899 unsigned int st_uid;
1900 unsigned int st_gid;
1901 abi_ulong st_rdev;
1902 abi_ulong _pad1;
1903 abi_long st_size;
1904 int st_blksize;
1905 int __pad2;
1906 abi_long st_blocks;
1907 abi_long target_st_atime;
1908 abi_ulong target_st_atime_nsec;
1909 abi_long target_st_mtime;
1910 abi_ulong target_st_mtime_nsec;
1911 abi_long target_st_ctime;
1912 abi_ulong target_st_ctime_nsec;
1913 unsigned int __unused[2];
1914};
d962783e 1915#elif defined(TARGET_OPENRISC)
c7819dfb
PM
1916
1917/* These are the asm-generic versions of the stat and stat64 structures */
1918
d962783e
JL
1919struct target_stat {
1920 abi_ulong st_dev;
1921 abi_ulong st_ino;
d962783e 1922 unsigned int st_mode;
c7819dfb 1923 unsigned int st_nlink;
d962783e
JL
1924 unsigned int st_uid;
1925 unsigned int st_gid;
d962783e 1926 abi_ulong st_rdev;
c7819dfb 1927 abi_ulong __pad1;
d962783e 1928 abi_long st_size;
c7819dfb
PM
1929 int st_blksize;
1930 int __pad2;
1931 abi_long st_blocks;
1932 abi_long target_st_atime;
d962783e 1933 abi_ulong target_st_atime_nsec;
c7819dfb 1934 abi_long target_st_mtime;
d962783e 1935 abi_ulong target_st_mtime_nsec;
c7819dfb 1936 abi_long target_st_ctime;
d962783e 1937 abi_ulong target_st_ctime_nsec;
c7819dfb
PM
1938 unsigned int __unused4;
1939 unsigned int __unused5;
1940};
d962783e 1941
20d155bc 1942#define TARGET_HAS_STRUCT_STAT64
c7819dfb
PM
1943struct target_stat64 {
1944 uint64_t st_dev;
1945 uint64_t st_ino;
1946 unsigned int st_mode;
1947 unsigned int st_nlink;
1948 unsigned int st_uid;
1949 unsigned int st_gid;
1950 uint64_t st_rdev;
1951 uint64_t __pad1;
1952 int64_t st_size;
1953 int st_blksize;
1954 int __pad2;
1955 int64_t st_blocks;
1956 int target_st_atime;
1957 unsigned int target_st_atime_nsec;
1958 int target_st_mtime;
1959 unsigned int target_st_mtime_nsec;
1960 int target_st_ctime;
1961 unsigned int target_st_ctime_nsec;
1962 unsigned int __unused4;
1963 unsigned int __unused5;
d962783e 1964};
c7819dfb 1965
048f6b4d
FB
1966#else
1967#error unsupported CPU
1968#endif
2521d698 1969
4ce6f8de
TS
1970typedef struct {
1971 int val[2];
c227f099 1972} target_fsid_t;
4ce6f8de 1973
56c8f68f 1974#ifdef TARGET_MIPS
d26bc211 1975#ifdef TARGET_ABI_MIPSN32
540635ba
TS
1976struct target_statfs {
1977 int32_t f_type;
1978 int32_t f_bsize;
1979 int32_t f_frsize; /* Fragment size - unsupported */
1980 int32_t f_blocks;
1981 int32_t f_bfree;
1982 int32_t f_files;
1983 int32_t f_ffree;
1984 int32_t f_bavail;
1985
1986 /* Linux specials */
c227f099 1987 target_fsid_t f_fsid;
540635ba
TS
1988 int32_t f_namelen;
1989 int32_t f_spare[6];
1990};
1991#else
56c8f68f 1992struct target_statfs {
992f48a0
BS
1993 abi_long f_type;
1994 abi_long f_bsize;
1995 abi_long f_frsize; /* Fragment size - unsupported */
1996 abi_long f_blocks;
1997 abi_long f_bfree;
1998 abi_long f_files;
1999 abi_long f_ffree;
2000 abi_long f_bavail;
56c8f68f
FB
2001
2002 /* Linux specials */
c227f099 2003 target_fsid_t f_fsid;
992f48a0
BS
2004 abi_long f_namelen;
2005 abi_long f_spare[6];
56c8f68f 2006};
540635ba 2007#endif
56c8f68f
FB
2008
2009struct target_statfs64 {
2010 uint32_t f_type;
2011 uint32_t f_bsize;
2012 uint32_t f_frsize; /* Fragment size - unsupported */
2013 uint32_t __pad;
2014 uint64_t f_blocks;
2015 uint64_t f_bfree;
2016 uint64_t f_files;
2017 uint64_t f_ffree;
2018 uint64_t f_bavail;
c227f099 2019 target_fsid_t f_fsid;
56c8f68f
FB
2020 uint32_t f_namelen;
2021 uint32_t f_spare[6];
2022};
c4d10628 2023#elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
09701199
AG
2024 defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \
2025 !defined(TARGET_ABI32)
325e651f
JM
2026struct target_statfs {
2027 abi_long f_type;
2028 abi_long f_bsize;
2029 abi_long f_blocks;
2030 abi_long f_bfree;
2031 abi_long f_bavail;
2032 abi_long f_files;
2033 abi_long f_ffree;
c227f099 2034 target_fsid_t f_fsid;
325e651f
JM
2035 abi_long f_namelen;
2036 abi_long f_frsize;
2037 abi_long f_spare[5];
2038};
2039
2040struct target_statfs64 {
2041 abi_long f_type;
2042 abi_long f_bsize;
2043 abi_long f_blocks;
2044 abi_long f_bfree;
2045 abi_long f_bavail;
2046 abi_long f_files;
2047 abi_long f_ffree;
c227f099 2048 target_fsid_t f_fsid;
325e651f
JM
2049 abi_long f_namelen;
2050 abi_long f_frsize;
2051 abi_long f_spare[5];
2052};
a4c075f1
UH
2053#elif defined(TARGET_S390X)
2054struct target_statfs {
2055 int32_t f_type;
2056 int32_t f_bsize;
2057 abi_long f_blocks;
2058 abi_long f_bfree;
2059 abi_long f_bavail;
2060 abi_long f_files;
2061 abi_long f_ffree;
2062 kernel_fsid_t f_fsid;
2063 int32_t f_namelen;
2064 int32_t f_frsize;
2065 int32_t f_spare[5];
2066};
2067
2068struct target_statfs64 {
2069 int32_t f_type;
2070 int32_t f_bsize;
2071 abi_long f_blocks;
2072 abi_long f_bfree;
2073 abi_long f_bavail;
2074 abi_long f_files;
2075 abi_long f_ffree;
2076 kernel_fsid_t f_fsid;
2077 int32_t f_namelen;
2078 int32_t f_frsize;
2079 int32_t f_spare[5];
2080};
56c8f68f
FB
2081#else
2082struct target_statfs {
2083 uint32_t f_type;
2084 uint32_t f_bsize;
2085 uint32_t f_blocks;
2086 uint32_t f_bfree;
2087 uint32_t f_bavail;
2088 uint32_t f_files;
2089 uint32_t f_ffree;
c227f099 2090 target_fsid_t f_fsid;
56c8f68f
FB
2091 uint32_t f_namelen;
2092 uint32_t f_frsize;
2093 uint32_t f_spare[5];
2094};
2095
2096struct target_statfs64 {
2097 uint32_t f_type;
2098 uint32_t f_bsize;
2099 uint64_t f_blocks;
2100 uint64_t f_bfree;
2101 uint64_t f_bavail;
2102 uint64_t f_files;
2103 uint64_t f_ffree;
c227f099 2104 target_fsid_t f_fsid;
56c8f68f
FB
2105 uint32_t f_namelen;
2106 uint32_t f_frsize;
2107 uint32_t f_spare[5];
2108};
2109#endif
2110
2111
2521d698
FB
2112#define TARGET_F_DUPFD 0 /* dup */
2113#define TARGET_F_GETFD 1 /* get close_on_exec */
2114#define TARGET_F_SETFD 2 /* set/clear close_on_exec */
2115#define TARGET_F_GETFL 3 /* get file->f_flags */
2116#define TARGET_F_SETFL 4 /* set file->f_flags */
2117
2118#if defined(TARGET_ALPHA)
2119#define TARGET_F_GETLK 7
2120#define TARGET_F_SETLK 8
2121#define TARGET_F_SETLKW 9
2122#define TARGET_F_SETOWN 5 /* for sockets. */
2123#define TARGET_F_GETOWN 6 /* for sockets. */
2ba7f730
LV
2124
2125#define TARGET_F_RDLCK 1
2126#define TARGET_F_WRLCK 2
2127#define TARGET_F_UNLCK 8
2128#define TARGET_F_EXLCK 16
2129#define TARGET_F_SHLCK 32
5f106811
APR
2130#elif defined(TARGET_MIPS)
2131#define TARGET_F_GETLK 14
2132#define TARGET_F_SETLK 6
2133#define TARGET_F_SETLKW 7
2134#define TARGET_F_SETOWN 24 /* for sockets. */
2135#define TARGET_F_GETOWN 25 /* for sockets. */
2521d698
FB
2136#else
2137#define TARGET_F_GETLK 5
2138#define TARGET_F_SETLK 6
2139#define TARGET_F_SETLKW 7
2140#define TARGET_F_SETOWN 8 /* for sockets. */
2141#define TARGET_F_GETOWN 9 /* for sockets. */
2142#endif
8d5d3004
AS
2143#define TARGET_F_SETOWN_EX 15
2144#define TARGET_F_GETOWN_EX 16
2521d698 2145
2ba7f730
LV
2146#ifndef TARGET_F_RDLCK
2147#define TARGET_F_RDLCK 0
2148#define TARGET_F_WRLCK 1
2149#define TARGET_F_UNLCK 2
2150#endif
2151
2152#ifndef TARGET_F_EXLCK
2153#define TARGET_F_EXLCK 4
2154#define TARGET_F_SHLCK 8
2155#endif
2156
2157
2521d698
FB
2158#define TARGET_F_SETSIG 10 /* for sockets. */
2159#define TARGET_F_GETSIG 11 /* for sockets. */
2160
5f106811
APR
2161#if defined(TARGET_MIPS)
2162#define TARGET_F_GETLK64 33 /* using 'struct flock64' */
2163#define TARGET_F_SETLK64 34
2164#define TARGET_F_SETLKW64 35
2165#else
2521d698
FB
2166#define TARGET_F_GETLK64 12 /* using 'struct flock64' */
2167#define TARGET_F_SETLK64 13
2168#define TARGET_F_SETLKW64 14
5f106811 2169#endif
7e22e546
UH
2170
2171#define TARGET_F_LINUX_SPECIFIC_BASE 1024
2172#define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0)
2173#define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1)
2174#define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6)
2175#define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2)
2176
4eeea4f3
RH
2177#if defined(TARGET_ALPHA)
2178#define TARGET_O_NONBLOCK 04
2179#define TARGET_O_APPEND 010
2180#define TARGET_O_CREAT 01000 /* not fcntl */
2181#define TARGET_O_TRUNC 02000 /* not fcntl */
2182#define TARGET_O_EXCL 04000 /* not fcntl */
2183#define TARGET_O_NOCTTY 010000 /* not fcntl */
2184#define TARGET_O_DSYNC 040000
2185#define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */
2186#define TARGET_O_DIRECTORY 0100000 /* must be a directory */
2187#define TARGET_O_NOFOLLOW 0200000 /* don't follow links */
2188#define TARGET_O_DIRECT 02000000 /* direct disk access hint */
2189#define TARGET_O_NOATIME 04000000
2190#define TARGET_O_CLOEXEC 010000000
2191#define TARGET___O_SYNC 020000000
2192#define TARGET_O_PATH 040000000
2193#elif defined(TARGET_ARM) || defined(TARGET_M68K)
f09936ac
FB
2194#define TARGET_O_DIRECTORY 040000 /* must be a directory */
2195#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
2196#define TARGET_O_DIRECT 0200000 /* direct disk access hint */
2197#define TARGET_O_LARGEFILE 0400000
4eeea4f3
RH
2198#elif defined(TARGET_MIPS)
2199#define TARGET_O_APPEND 0x0008
2200#define TARGET_O_DSYNC 0x0010
2201#define TARGET_O_NONBLOCK 0x0080
2202#define TARGET_O_CREAT 0x0100 /* not fcntl */
2203#define TARGET_O_TRUNC 0x0200 /* not fcntl */
2204#define TARGET_O_EXCL 0x0400 /* not fcntl */
2205#define TARGET_O_NOCTTY 0x0800 /* not fcntl */
2206#define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */
2207#define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */
2208#define TARGET___O_SYNC 0x4000
2209#define TARGET_O_DIRECT 0x8000 /* direct disk access hint */
f09936ac 2210#elif defined (TARGET_PPC)
b779e29e
EI
2211#define TARGET_O_DIRECTORY 040000 /* must be a directory */
2212#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
2213#define TARGET_O_LARGEFILE 0200000
2214#define TARGET_O_DIRECT 0400000 /* direct disk access hint */
6d5e216d 2215#elif defined (TARGET_SPARC)
4eeea4f3
RH
2216#define TARGET_O_APPEND 0x0008
2217#define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */
2218#define TARGET_O_CREAT 0x0200 /* not fcntl */
2219#define TARGET_O_TRUNC 0x0400 /* not fcntl */
2220#define TARGET_O_EXCL 0x0800 /* not fcntl */
2221#define TARGET_O_DSYNC 0x2000
2222#define TARGET_O_NONBLOCK 0x4000
2223# ifdef TARGET_SPARC64
2224# define TARGET_O_NDELAY 0x0004
2225# else
2226# define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK)
2227# endif
2228#define TARGET_O_NOCTTY 0x8000 /* not fcntl */
6d5e216d 2229#define TARGET_O_LARGEFILE 0x40000
4eeea4f3
RH
2230#define TARGET_O_DIRECT 0x100000 /* direct disk access hint */
2231#define TARGET_O_NOATIME 0x200000
2232#define TARGET_O_CLOEXEC 0x400000
2233#define TARGET___O_SYNC 0x800000
2234#define TARGET_O_PATH 0x1000000
2235#endif
2236
2237/* <asm-generic/fcntl.h> values follow. */
ffa65c3b
FB
2238#define TARGET_O_ACCMODE 0003
2239#define TARGET_O_RDONLY 00
2240#define TARGET_O_WRONLY 01
2241#define TARGET_O_RDWR 02
4eeea4f3 2242#ifndef TARGET_O_CREAT
ffa65c3b 2243#define TARGET_O_CREAT 0100 /* not fcntl */
4eeea4f3
RH
2244#endif
2245#ifndef TARGET_O_EXCL
ffa65c3b 2246#define TARGET_O_EXCL 0200 /* not fcntl */
4eeea4f3
RH
2247#endif
2248#ifndef TARGET_O_NOCTTY
ffa65c3b 2249#define TARGET_O_NOCTTY 0400 /* not fcntl */
4eeea4f3
RH
2250#endif
2251#ifndef TARGET_O_TRUNC
ffa65c3b 2252#define TARGET_O_TRUNC 01000 /* not fcntl */
4eeea4f3
RH
2253#endif
2254#ifndef TARGET_O_APPEND
ffa65c3b 2255#define TARGET_O_APPEND 02000
4eeea4f3
RH
2256#endif
2257#ifndef TARGET_O_NONBLOCK
ffa65c3b 2258#define TARGET_O_NONBLOCK 04000
4eeea4f3
RH
2259#endif
2260#ifndef TARGET_O_DSYNC
2261#define TARGET_O_DSYNC 010000
2262#endif
2263#ifndef TARGET_FASYNC
ffa65c3b 2264#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
4eeea4f3
RH
2265#endif
2266#ifndef TARGET_O_DIRECT
ffa65c3b 2267#define TARGET_O_DIRECT 040000 /* direct disk access hint */
4eeea4f3
RH
2268#endif
2269#ifndef TARGET_O_LARGEFILE
ffa65c3b 2270#define TARGET_O_LARGEFILE 0100000
4eeea4f3
RH
2271#endif
2272#ifndef TARGET_O_DIRECTORY
ffa65c3b 2273#define TARGET_O_DIRECTORY 0200000 /* must be a directory */
4eeea4f3
RH
2274#endif
2275#ifndef TARGET_O_NOFOLLOW
ffa65c3b
FB
2276#define TARGET_O_NOFOLLOW 0400000 /* don't follow links */
2277#endif
4eeea4f3
RH
2278#ifndef TARGET_O_NOATIME
2279#define TARGET_O_NOATIME 01000000
2280#endif
2281#ifndef TARGET_O_CLOEXEC
2282#define TARGET_O_CLOEXEC 02000000
2283#endif
2284#ifndef TARGET___O_SYNC
2285#define TARGET___O_SYNC 04000000
2286#endif
2287#ifndef TARGET_O_PATH
2288#define TARGET_O_PATH 010000000
2289#endif
2290#ifndef TARGET_O_NDELAY
2291#define TARGET_O_NDELAY TARGET_O_NONBLOCK
2292#endif
2293#ifndef TARGET_O_SYNC
2294#define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC)
2295#endif
ffa65c3b 2296
2521d698
FB
2297struct target_flock {
2298 short l_type;
2299 short l_whence;
992f48a0
BS
2300 abi_ulong l_start;
2301 abi_ulong l_len;
2521d698
FB
2302 int l_pid;
2303};
2304
2305struct target_flock64 {
2306 short l_type;
2307 short l_whence;
b779e29e 2308#if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) || defined(TARGET_SPARC) || defined(TARGET_HPPA) || defined (TARGET_MICROBLAZE)
ce3f0e2f
AJ
2309 int __pad;
2310#endif
2521d698
FB
2311 unsigned long long l_start;
2312 unsigned long long l_len;
2313 int l_pid;
541dc0d4 2314} QEMU_PACKED;
2521d698 2315
ce4defa0
PB
2316#ifdef TARGET_ARM
2317struct target_eabi_flock64 {
2318 short l_type;
2319 short l_whence;
2320 int __pad;
2321 unsigned long long l_start;
2322 unsigned long long l_len;
2323 int l_pid;
541dc0d4 2324} QEMU_PACKED;
ce4defa0 2325#endif
2521d698 2326
8d5d3004
AS
2327struct target_f_owner_ex {
2328 int type; /* Owner type of ID. */
2329 int pid; /* ID of owner. */
2330};
2331
2521d698
FB
2332/* soundcard defines */
2333/* XXX: convert them all to arch indepedent entries */
2334#define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int);
2335#define TARGET_SNDCTL_COPR_LOAD 0xcfb04301
2336#define TARGET_SNDCTL_COPR_RCODE 0xc0144303
2337#define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309
2338#define TARGET_SNDCTL_COPR_RDATA 0xc0144302
2339#define TARGET_SNDCTL_COPR_RESET 0x00004300
2340#define TARGET_SNDCTL_COPR_RUN 0xc0144306
2341#define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308
2342#define TARGET_SNDCTL_COPR_WCODE 0x40144305
2343#define TARGET_SNDCTL_COPR_WDATA 0x40144304
2344#define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0)
2345#define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1)
2346#define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int)
2347#define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int)
2348#define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int)
2349#define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int)
2350#define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int)
2351#define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int)
2352#define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8)
2353#define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int)
2354#define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int)
2355#define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int)
2356#define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12)
2357#define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13)
2358#define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int)
2359#define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int)
2360#define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17)
2361#define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18)
5f72307d
PM
2362#define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19)
2363#define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20)
2521d698
FB
2364#define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e
2365#define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005
2366#define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016
2367#define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015
2368#define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010
2369#define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f
2370#define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107
2371#define TARGET_SNDCTL_MIDI_INFO 0xc074510c
2372#define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02
2373#define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01
2374#define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00
2375#define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110
2376#define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001
2377#define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103
2378#define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105
2379#define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104
2380#define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b
2381#define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a
2382#define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112
2383#define TARGET_SNDCTL_SEQ_PANIC 0x00005111
2384#define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106
2385#define TARGET_SNDCTL_SEQ_RESET 0x00005100
2386#define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109
2387#define TARGET_SNDCTL_SEQ_SYNC 0x00005101
2388#define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108
2389#define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d
2390#define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d
2391#define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102
2392#define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e
2393#define TARGET_SNDCTL_TMR_CONTINUE 0x00005404
2394#define TARGET_SNDCTL_TMR_METRONOME 0x40045407
2395#define TARGET_SNDCTL_TMR_SELECT 0x40045408
2396#define TARGET_SNDCTL_TMR_SOURCE 0xc0045406
2397#define TARGET_SNDCTL_TMR_START 0x00005402
2398#define TARGET_SNDCTL_TMR_STOP 0x00005403
2399#define TARGET_SNDCTL_TMR_TEMPO 0xc0045405
2400#define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401
2401#define TARGET_SOUND_PCM_READ_RATE 0x80045002
2402#define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006
2403#define TARGET_SOUND_PCM_READ_BITS 0x80045005
2404#define TARGET_SOUND_PCM_READ_FILTER 0x80045007
2405#define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info)
2406#define TARGET_SOUND_MIXER_ACCESS 0xc0804d66
2407#define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int)
2408#define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int)
2409#define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int)
2410#define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int)
2411#define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int)
2412
2413#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int)
2414
2415#define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME)
2416#define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS)
2417#define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE)
2418#define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH)
2419#define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM)
2420#define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER)
2421#define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE)
2422#define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC)
2423#define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD)
2424#define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX)
2425#define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM)
2426#define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV)
2427#define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN)
2428#define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN)
2429#define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1)
2430#define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2)
2431#define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3)
2432
2433/* Obsolete macros */
2434#define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE)
2435#define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE)
2436#define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD)
2437
2438#define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC)
2439#define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK)
2440#define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK)
2441#define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)
2442#define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS)
2443
2444#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int)
2445
2446#define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)
2447#define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
2448#define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE)
2449#define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH)
2450#define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM)
2451#define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER)
2452#define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE)
2453#define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC)
2454#define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD)
2455#define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX)
2456#define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM)
2457#define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV)
2458#define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN)
2459#define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN)
2460#define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1)
2461#define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2)
2462#define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)
2463
2464/* Obsolete macros */
2465#define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE)
2466#define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE)
2467#define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD)
2468
2469#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
2470
2471/* vfat ioctls */
2472#define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
2473#define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2)
a5448a7d 2474
8fbd6b52
AZ
2475#define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop)
2476#define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget)
2477#define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos)
2478
a5448a7d 2479struct target_sysinfo {
992f48a0
BS
2480 abi_long uptime; /* Seconds since boot */
2481 abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */
2482 abi_ulong totalram; /* Total usable main memory size */
2483 abi_ulong freeram; /* Available memory size */
2484 abi_ulong sharedram; /* Amount of shared memory */
2485 abi_ulong bufferram; /* Memory used by buffers */
2486 abi_ulong totalswap; /* Total swap space size */
2487 abi_ulong freeswap; /* swap space still available */
a5448a7d
FB
2488 unsigned short procs; /* Number of current processes */
2489 unsigned short pad; /* explicit padding for m68k */
992f48a0
BS
2490 abi_ulong totalhigh; /* Total high memory size */
2491 abi_ulong freehigh; /* Available high memory size */
a5448a7d 2492 unsigned int mem_unit; /* Memory unit size in bytes */
992f48a0 2493 char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */
a5448a7d 2494};
3532fa74 2495
6556a833
AJ
2496struct linux_dirent {
2497 long d_ino;
2498 unsigned long d_off;
2499 unsigned short d_reclen;
2500 char d_name[256]; /* We must not include limits.h! */
2501};
2502
2503struct linux_dirent64 {
2504 uint64_t d_ino;
2505 int64_t d_off;
2506 unsigned short d_reclen;
2507 unsigned char d_type;
2508 char d_name[256];
2509};
2510
24e1003a
AJ
2511struct target_mq_attr {
2512 abi_long mq_flags;
2513 abi_long mq_maxmsg;
2514 abi_long mq_msgsize;
2515 abi_long mq_curmsgs;
2516};
2517
3532fa74 2518#include "socket.h"
637947f1
TS
2519
2520#include "errno_defs.h"
03dfe9f8
RV
2521
2522#define FUTEX_WAIT 0
2523#define FUTEX_WAKE 1
2524#define FUTEX_FD 2
2525#define FUTEX_REQUEUE 3
2526#define FUTEX_CMP_REQUEUE 4
2527#define FUTEX_WAKE_OP 5
2528#define FUTEX_LOCK_PI 6
2529#define FUTEX_UNLOCK_PI 7
2530#define FUTEX_TRYLOCK_PI 8
2531#define FUTEX_WAIT_BITSET 9
2532#define FUTEX_WAKE_BITSET 10
2533
2534#define FUTEX_PRIVATE_FLAG 128
2535#define FUTEX_CLOCK_REALTIME 256
2536#define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
2537
3b6edd16
PM
2538#ifdef CONFIG_EPOLL
2539typedef union target_epoll_data {
2540 abi_ulong ptr;
2541 abi_ulong fd;
2542 uint32_t u32;
2543 uint64_t u64;
2544} target_epoll_data_t;
2545
2546struct target_epoll_event {
2547 uint32_t events;
fd767832 2548#if defined(TARGET_ARM) || defined(TARGET_MIPS) || defined(TARGET_MIPS64)
ddaa7e5a
AG
2549 uint32_t __pad;
2550#endif
3b6edd16 2551 target_epoll_data_t data;
ddaa7e5a 2552} QEMU_PACKED;
3b6edd16 2553#endif
163a05a8
PM
2554struct target_rlimit64 {
2555 uint64_t rlim_cur;
2556 uint64_t rlim_max;
2557};
583359a6
AP
2558
2559struct target_ucred {
2560 uint32_t pid;
2561 uint32_t uid;
2562 uint32_t gid;
2563};
cb9c377f
PB
2564
2565#endif
905bba13 2566
aecc8861 2567typedef int32_t target_timer_t;
905bba13 2568
34d60862
NC
2569#define TARGET_SIGEV_MAX_SIZE 64
2570
2571/* This is architecture-specific but most architectures use the default */
2572#ifdef TARGET_MIPS
2573#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long))
2574#else
2575#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \
2576 + sizeof(target_sigval_t))
2577#endif
2578
2579#define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \
2580 - TARGET_SIGEV_PREAMBLE_SIZE) \
2581 / sizeof(int32_t))
2582
905bba13
ECL
2583struct target_sigevent {
2584 target_sigval_t sigev_value;
2585 int32_t sigev_signo;
2586 int32_t sigev_notify;
2587 union {
34d60862 2588 int32_t _pad[TARGET_SIGEV_PAD_SIZE];
905bba13
ECL
2589 int32_t _tid;
2590
2591 struct {
2592 void (*_function)(sigval_t);
2593 void *_attribute;
2594 } _sigev_thread;
2595 } _sigev_un;
2596};
e0eb210e
PM
2597
2598struct target_user_cap_header {
2599 uint32_t version;
2600 int pid;
2601};
2602
2603struct target_user_cap_data {
2604 uint32_t effective;
2605 uint32_t permitted;
2606 uint32_t inheritable;
2607};
This page took 1.011957 seconds and 4 git commands to generate.