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