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