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