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