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