-
Notifications
You must be signed in to change notification settings - Fork 0
/
syscall_defs.h
2539 lines (2220 loc) · 82.9 KB
/
syscall_defs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* common syscall defines for all architectures */
/* Note: although the syscall numbers change between architectures,
most of them stay the same, so we handle it by putting ifdefs if
necessary */
#ifndef SYSCALL_DEFS_H
#define SYSCALL_DEFS_H
#include "syscall_nr.h"
/* socket operations for socketcall() */
#define TARGET_SYS_SOCKET 1 /* socket() */
#define TARGET_SYS_BIND 2 /* bind() */
#define TARGET_SYS_CONNECT 3 /* connect() */
#define TARGET_SYS_LISTEN 4 /* listen() */
#define TARGET_SYS_ACCEPT 5 /* accept() */
#define TARGET_SYS_GETSOCKNAME 6 /* getsockname() */
#define TARGET_SYS_GETPEERNAME 7 /* getpeername() */
#define TARGET_SYS_SOCKETPAIR 8 /* socketpair() */
#define TARGET_SYS_SEND 9 /* send() */
#define TARGET_SYS_RECV 10 /* recv() */
#define TARGET_SYS_SENDTO 11 /* sendto() */
#define TARGET_SYS_RECVFROM 12 /* recvfrom() */
#define TARGET_SYS_SHUTDOWN 13 /* shutdown() */
#define TARGET_SYS_SETSOCKOPT 14 /* setsockopt() */
#define TARGET_SYS_GETSOCKOPT 15 /* getsockopt() */
#define TARGET_SYS_SENDMSG 16 /* sendmsg() */
#define TARGET_SYS_RECVMSG 17 /* recvmsg() */
#define TARGET_SYS_ACCEPT4 18 /* accept4() */
#define TARGET_SYS_RECVMMSG 19 /* recvmmsg() */
#define TARGET_SYS_SENDMMSG 20 /* sendmmsg() */
#define IPCOP_semop 1
#define IPCOP_semget 2
#define IPCOP_semctl 3
#define IPCOP_semtimedop 4
#define IPCOP_msgsnd 11
#define IPCOP_msgrcv 12
#define IPCOP_msgget 13
#define IPCOP_msgctl 14
#define IPCOP_shmat 21
#define IPCOP_shmdt 22
#define IPCOP_shmget 23
#define IPCOP_shmctl 24
/*
* The following is for compatibility across the various Linux
* platforms. The i386 ioctl numbering scheme doesn't really enforce
* a type field. De facto, however, the top 8 bits of the lower 16
* bits are indeed used as a type field, so we might just as well make
* this explicit here. Please be sure to use the decoding macros
* below from now on.
*/
#define TARGET_IOC_NRBITS 8
#define TARGET_IOC_TYPEBITS 8
#if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
|| (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
|| defined(TARGET_SPARC) \
|| defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
/* 16 bit uid wrappers emulation */
#define USE_UID16
#define target_id uint16_t
#else
#define target_id uint32_t
#endif
#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
|| defined(TARGET_M68K) || defined(TARGET_CRIS) \
|| defined(TARGET_S390X) \
|| defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) \
|| defined(TARGET_NIOS2) || defined(TARGET_RISCV) \
|| defined(TARGET_XTENSA)
#define TARGET_IOC_SIZEBITS 14
#define TARGET_IOC_DIRBITS 2
#define TARGET_IOC_NONE 0U
#define TARGET_IOC_WRITE 1U
#define TARGET_IOC_READ 2U
#elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \
defined(TARGET_MIPS)
#define TARGET_IOC_SIZEBITS 13
#define TARGET_IOC_DIRBITS 3
#define TARGET_IOC_NONE 1U
#define TARGET_IOC_READ 2U
#define TARGET_IOC_WRITE 4U
#elif defined(TARGET_HPPA)
#define TARGET_IOC_SIZEBITS 14
#define TARGET_IOC_DIRBITS 2
#define TARGET_IOC_NONE 0U
#define TARGET_IOC_WRITE 2U
#define TARGET_IOC_READ 1U
#else
#error unsupported CPU
#endif
#define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1)
#define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1)
#define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1)
#define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1)
#define TARGET_IOC_NRSHIFT 0
#define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
#define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
#define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
#define TARGET_IOC(dir,type,nr,size) \
(((dir) << TARGET_IOC_DIRSHIFT) | \
((type) << TARGET_IOC_TYPESHIFT) | \
((nr) << TARGET_IOC_NRSHIFT) | \
((size) << TARGET_IOC_SIZESHIFT))
/* used to create numbers */
#define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
#define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
#define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
#define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
/* the size is automatically computed for these defines */
#define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
#define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
#define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
struct target_sockaddr {
uint16_t sa_family;
uint8_t sa_data[14];
};
struct target_sockaddr_ll {
uint16_t sll_family; /* Always AF_PACKET */
uint16_t sll_protocol; /* Physical layer protocol */
int sll_ifindex; /* Interface number */
uint16_t sll_hatype; /* ARP hardware type */
uint8_t sll_pkttype; /* Packet type */
uint8_t sll_halen; /* Length of address */
uint8_t sll_addr[8]; /* Physical layer address */
};
struct target_sockaddr_un {
uint16_t su_family;
uint8_t sun_path[108];
};
struct target_in_addr {
uint32_t s_addr; /* big endian */
};
struct target_sockaddr_in {
uint16_t sin_family;
int16_t sin_port; /* big endian */
struct target_in_addr sin_addr;
uint8_t __pad[sizeof(struct target_sockaddr) -
sizeof(uint16_t) - sizeof(int16_t) -
sizeof(struct target_in_addr)];
};
struct target_sockaddr_in6 {
uint16_t sin6_family;
uint16_t sin6_port; /* big endian */
uint32_t sin6_flowinfo; /* big endian */
struct in6_addr sin6_addr; /* IPv6 address, big endian */
uint32_t sin6_scope_id;
};
struct target_sock_filter {
abi_ushort code;
uint8_t jt;
uint8_t jf;
abi_uint k;
};
struct target_sock_fprog {
abi_ushort len;
abi_ulong filter;
};
struct target_ip_mreq {
struct target_in_addr imr_multiaddr;
struct target_in_addr imr_address;
};
struct target_ip_mreqn {
struct target_in_addr imr_multiaddr;
struct target_in_addr imr_address;
abi_long imr_ifindex;
};
struct target_ip_mreq_source {
/* big endian */
uint32_t imr_multiaddr;
uint32_t imr_interface;
uint32_t imr_sourceaddr;
};
struct target_linger {
abi_int l_onoff; /* Linger active */
abi_int l_linger; /* How long to linger for */
};
struct target_timeval {
abi_long tv_sec;
abi_long tv_usec;
};
struct target_timespec {
abi_long tv_sec;
abi_long tv_nsec;
};
struct target_timezone {
abi_int tz_minuteswest;
abi_int tz_dsttime;
};
struct target_itimerval {
struct target_timeval it_interval;
struct target_timeval it_value;
};
struct target_itimerspec {
struct target_timespec it_interval;
struct target_timespec it_value;
};
struct target_timex {
abi_uint modes; /* Mode selector */
abi_long offset; /* Time offset */
abi_long freq; /* Frequency offset */
abi_long maxerror; /* Maximum error (microseconds) */
abi_long esterror; /* Estimated error (microseconds) */
abi_int status; /* Clock command/status */
abi_long constant; /* PLL (phase-locked loop) time constant */
abi_long precision; /* Clock precision (microseconds, ro) */
abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */
struct target_timeval time; /* Current time */
abi_long tick; /* Microseconds between clock ticks */
abi_long ppsfreq; /* PPS (pulse per second) frequency */
abi_long jitter; /* PPS jitter (ro); nanoseconds */
abi_int shift; /* PPS interval duration (seconds) */
abi_long stabil; /* PPS stability */
abi_long jitcnt; /* PPS jitter limit exceeded (ro) */
abi_long calcnt; /* PPS calibration intervals */
abi_long errcnt; /* PPS calibration errors */
abi_long stbcnt; /* PPS stability limit exceeded */
abi_int tai; /* TAI offset */
/* Further padding bytes to allow for future expansion */
abi_int:32; abi_int:32; abi_int:32; abi_int:32;
abi_int:32; abi_int:32; abi_int:32; abi_int:32;
abi_int:32; abi_int:32; abi_int:32;
};
typedef abi_long target_clock_t;
#define TARGET_HZ 100
struct target_tms {
target_clock_t tms_utime;
target_clock_t tms_stime;
target_clock_t tms_cutime;
target_clock_t tms_cstime;
};
struct target_utimbuf {
abi_long actime;
abi_long modtime;
};
struct target_sel_arg_struct {
abi_long n;
abi_long inp, outp, exp;
abi_long tvp;
};
struct target_iovec {
abi_long iov_base; /* Starting address */
abi_long iov_len; /* Number of bytes */
};
struct target_msghdr {
abi_long msg_name; /* Socket name */
int msg_namelen; /* Length of name */
abi_long msg_iov; /* Data blocks */
abi_long msg_iovlen; /* Number of blocks */
abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
abi_long msg_controllen; /* Length of cmsg list */
unsigned int msg_flags;
};
struct target_cmsghdr {
abi_long cmsg_len;
int cmsg_level;
int cmsg_type;
};
#define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
#define TARGET_CMSG_NXTHDR(mhdr, cmsg, cmsg_start) \
__target_cmsg_nxthdr(mhdr, cmsg, cmsg_start)
#define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
& (size_t) ~(sizeof (abi_long) - 1))
#define TARGET_CMSG_SPACE(len) (sizeof(struct target_cmsghdr) + \
TARGET_CMSG_ALIGN(len))
#define TARGET_CMSG_LEN(len) (sizeof(struct target_cmsghdr) + (len))
static __inline__ struct target_cmsghdr *
__target_cmsg_nxthdr(struct target_msghdr *__mhdr,
struct target_cmsghdr *__cmsg,
struct target_cmsghdr *__cmsg_start)
{
struct target_cmsghdr *__ptr;
__ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg
+ TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len)));
if ((unsigned long)((char *)(__ptr+1) - (char *)__cmsg_start)
> tswapal(__mhdr->msg_controllen)) {
/* No more entries. */
return (struct target_cmsghdr *)0;
}
return __ptr;
}
struct target_mmsghdr {
struct target_msghdr msg_hdr; /* Message header */
unsigned int msg_len; /* Number of bytes transmitted */
};
struct target_rusage {
struct target_timeval ru_utime; /* user time used */
struct target_timeval ru_stime; /* system time used */
abi_long ru_maxrss; /* maximum resident set size */
abi_long ru_ixrss; /* integral shared memory size */
abi_long ru_idrss; /* integral unshared data size */
abi_long ru_isrss; /* integral unshared stack size */
abi_long ru_minflt; /* page reclaims */
abi_long ru_majflt; /* page faults */
abi_long ru_nswap; /* swaps */
abi_long ru_inblock; /* block input operations */
abi_long ru_oublock; /* block output operations */
abi_long ru_msgsnd; /* messages sent */
abi_long ru_msgrcv; /* messages received */
abi_long ru_nsignals; /* signals received */
abi_long ru_nvcsw; /* voluntary context switches */
abi_long ru_nivcsw; /* involuntary " */
};
typedef struct {
int val[2];
} kernel_fsid_t;
struct target_dirent {
abi_long d_ino;
abi_long d_off;
unsigned short d_reclen;
char d_name[];
};
struct target_dirent64 {
uint64_t d_ino;
int64_t d_off;
unsigned short d_reclen;
unsigned char d_type;
char d_name[256];
};
/* mostly generic signal stuff */
#define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */
#define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */
#define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */
#ifdef TARGET_MIPS
#define TARGET_NSIG 128
#else
#define TARGET_NSIG 64
#endif
#define TARGET_NSIG_BPW TARGET_ABI_BITS
#define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
typedef struct {
abi_ulong sig[TARGET_NSIG_WORDS];
} target_sigset_t;
#ifdef BSWAP_NEEDED
static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
{
int i;
for(i = 0;i < TARGET_NSIG_WORDS; i++)
d->sig[i] = tswapal(s->sig[i]);
}
#else
static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
{
*d = *s;
}
#endif
static inline void target_siginitset(target_sigset_t *d, abi_ulong set)
{
int i;
d->sig[0] = set;
for(i = 1;i < TARGET_NSIG_WORDS; i++)
d->sig[i] = 0;
}
void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
void host_to_target_old_sigset(abi_ulong *old_sigset,
const sigset_t *sigset);
void target_to_host_old_sigset(sigset_t *sigset,
const abi_ulong *old_sigset);
struct target_sigaction;
int do_sigaction(int sig, const struct target_sigaction *act,
struct target_sigaction *oact);
#include "target_signal.h"
#ifdef TARGET_SA_RESTORER
#define TARGET_ARCH_HAS_SA_RESTORER 1
#endif
#if defined(TARGET_ALPHA)
struct target_old_sigaction {
abi_ulong _sa_handler;
abi_ulong sa_mask;
int32_t sa_flags;
};
struct target_rt_sigaction {
abi_ulong _sa_handler;
abi_ulong sa_flags;
target_sigset_t sa_mask;
};
/* This is the struct used inside the kernel. The ka_restorer
field comes from the 5th argument to sys_rt_sigaction. */
struct target_sigaction {
abi_ulong _sa_handler;
abi_ulong sa_flags;
target_sigset_t sa_mask;
abi_ulong sa_restorer;
};
#elif defined(TARGET_MIPS)
struct target_sigaction {
uint32_t sa_flags;
#if defined(TARGET_ABI_MIPSN32)
uint32_t _sa_handler;
#else
abi_ulong _sa_handler;
#endif
target_sigset_t sa_mask;
#ifdef TARGET_ARCH_HAS_SA_RESTORER
/* ??? This is always present, but ignored unless O32. */
abi_ulong sa_restorer;
#endif
};
#else
struct target_old_sigaction {
abi_ulong _sa_handler;
abi_ulong sa_mask;
abi_ulong sa_flags;
#ifdef TARGET_ARCH_HAS_SA_RESTORER
abi_ulong sa_restorer;
#endif
};
struct target_sigaction {
abi_ulong _sa_handler;
abi_ulong sa_flags;
#ifdef TARGET_ARCH_HAS_SA_RESTORER
abi_ulong sa_restorer;
#endif
target_sigset_t sa_mask;
#ifdef TARGET_ARCH_HAS_KA_RESTORER
abi_ulong ka_restorer;
#endif
};
#endif
typedef union target_sigval {
int sival_int;
abi_ulong sival_ptr;
} target_sigval_t;
#if 0
#if defined (TARGET_SPARC)
typedef struct {
struct {
abi_ulong psr;
abi_ulong pc;
abi_ulong npc;
abi_ulong y;
abi_ulong u_regs[16]; /* globals and ins */
} si_regs;
int si_mask;
} __siginfo_t;
typedef struct {
unsigned long si_float_regs [32];
unsigned long si_fsr;
unsigned long si_fpqdepth;
struct {
unsigned long *insn_addr;
unsigned long insn;
} si_fpqueue [16];
} __siginfo_fpu_t;
#endif
#endif
#define TARGET_SI_MAX_SIZE 128
#if TARGET_ABI_BITS == 32
#define TARGET_SI_PREAMBLE_SIZE (3 * sizeof(int))
#else
#define TARGET_SI_PREAMBLE_SIZE (4 * sizeof(int))
#endif
#define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE - TARGET_SI_PREAMBLE_SIZE) / sizeof(int))
/* Within QEMU the top 16 bits of si_code indicate which of the parts of
* the union in target_siginfo is valid. This only applies between
* host_to_target_siginfo_noswap() and tswap_siginfo(); it does not
* appear either within host siginfo_t or in target_siginfo structures
* which we get from the guest userspace program. (The Linux kernel
* does a similar thing with using the top bits for its own internal
* purposes but not letting them be visible to userspace.)
*/
#define QEMU_SI_KILL 0
#define QEMU_SI_TIMER 1
#define QEMU_SI_POLL 2
#define QEMU_SI_FAULT 3
#define QEMU_SI_CHLD 4
#define QEMU_SI_RT 5
typedef struct target_siginfo {
#ifdef TARGET_MIPS
int si_signo;
int si_code;
int si_errno;
#else
int si_signo;
int si_errno;
int si_code;
#endif
union {
int _pad[TARGET_SI_PAD_SIZE];
/* kill() */
struct {
pid_t _pid; /* sender's pid */
uid_t _uid; /* sender's uid */
} _kill;
/* POSIX.1b timers */
struct {
unsigned int _timer1;
unsigned int _timer2;
} _timer;
/* POSIX.1b signals */
struct {
pid_t _pid; /* sender's pid */
uid_t _uid; /* sender's uid */
target_sigval_t _sigval;
} _rt;
/* SIGCHLD */
struct {
pid_t _pid; /* which child */
uid_t _uid; /* sender's uid */
int _status; /* exit code */
target_clock_t _utime;
target_clock_t _stime;
} _sigchld;
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
struct {
abi_ulong _addr; /* faulting insn/memory ref. */
} _sigfault;
/* SIGPOLL */
struct {
int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
int _fd;
} _sigpoll;
} _sifields;
} target_siginfo_t;
/*
* si_code values
* Digital reserves positive values for kernel-generated signals.
*/
#define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */
#define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */
#define TARGET_SI_QUEUE -1 /* sent by sigqueue */
#define TARGET_SI_TIMER -2 /* sent by timer expiration */
#define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */
#define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */
#define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */
/*
* SIGILL si_codes
*/
#define TARGET_ILL_ILLOPC (1) /* illegal opcode */
#define TARGET_ILL_ILLOPN (2) /* illegal operand */
#define TARGET_ILL_ILLADR (3) /* illegal addressing mode */
#define TARGET_ILL_ILLTRP (4) /* illegal trap */
#define TARGET_ILL_PRVOPC (5) /* privileged opcode */
#define TARGET_ILL_PRVREG (6) /* privileged register */
#define TARGET_ILL_COPROC (7) /* coprocessor error */
#define TARGET_ILL_BADSTK (8) /* internal stack error */
#ifdef TARGET_TILEGX
#define TARGET_ILL_DBLFLT (9) /* double fault */
#define TARGET_ILL_HARDWALL (10) /* user networks hardwall violation */
#endif
/*
* SIGFPE si_codes
*/
#define TARGET_FPE_INTDIV (1) /* integer divide by zero */
#define TARGET_FPE_INTOVF (2) /* integer overflow */
#define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */
#define TARGET_FPE_FLTOVF (4) /* floating point overflow */
#define TARGET_FPE_FLTUND (5) /* floating point underflow */
#define TARGET_FPE_FLTRES (6) /* floating point inexact result */
#define TARGET_FPE_FLTINV (7) /* floating point invalid operation */
#define TARGET_FPE_FLTSUB (8) /* subscript out of range */
#define TARGET_FPE_FLTUNK (14) /* undiagnosed fp exception */
#define TARGET_NSIGFPE 15
/*
* SIGSEGV si_codes
*/
#define TARGET_SEGV_MAPERR (1) /* address not mapped to object */
#define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */
#define TARGET_SEGV_BNDERR (3) /* failed address bound checks */
/*
* SIGBUS si_codes
*/
#define TARGET_BUS_ADRALN (1) /* invalid address alignment */
#define TARGET_BUS_ADRERR (2) /* non-existent physical address */
#define TARGET_BUS_OBJERR (3) /* object specific hardware error */
/* hardware memory error consumed on a machine check: action required */
#define TARGET_BUS_MCEERR_AR (4)
/* hardware memory error detected in process but not consumed: action optional*/
#define TARGET_BUS_MCEERR_AO (5)
/*
* SIGTRAP si_codes
*/
#define TARGET_TRAP_BRKPT (1) /* process breakpoint */
#define TARGET_TRAP_TRACE (2) /* process trace trap */
#define TARGET_TRAP_BRANCH (3) /* process taken branch trap */
#define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint */
struct target_rlimit {
abi_ulong rlim_cur;
abi_ulong rlim_max;
};
#if defined(TARGET_ALPHA)
#define TARGET_RLIM_INFINITY 0x7fffffffffffffffull
#elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32)
#define TARGET_RLIM_INFINITY 0x7fffffffUL
#else
#define TARGET_RLIM_INFINITY ((abi_ulong)-1)
#endif
#if defined(TARGET_MIPS)
#define TARGET_RLIMIT_CPU 0
#define TARGET_RLIMIT_FSIZE 1
#define TARGET_RLIMIT_DATA 2
#define TARGET_RLIMIT_STACK 3
#define TARGET_RLIMIT_CORE 4
#define TARGET_RLIMIT_RSS 7
#define TARGET_RLIMIT_NPROC 8
#define TARGET_RLIMIT_NOFILE 5
#define TARGET_RLIMIT_MEMLOCK 9
#define TARGET_RLIMIT_AS 6
#define TARGET_RLIMIT_LOCKS 10
#define TARGET_RLIMIT_SIGPENDING 11
#define TARGET_RLIMIT_MSGQUEUE 12
#define TARGET_RLIMIT_NICE 13
#define TARGET_RLIMIT_RTPRIO 14
#else
#define TARGET_RLIMIT_CPU 0
#define TARGET_RLIMIT_FSIZE 1
#define TARGET_RLIMIT_DATA 2
#define TARGET_RLIMIT_STACK 3
#define TARGET_RLIMIT_CORE 4
#define TARGET_RLIMIT_RSS 5
#if defined(TARGET_SPARC)
#define TARGET_RLIMIT_NOFILE 6
#define TARGET_RLIMIT_NPROC 7
#else
#define TARGET_RLIMIT_NPROC 6
#define TARGET_RLIMIT_NOFILE 7
#endif
#define TARGET_RLIMIT_MEMLOCK 8
#define TARGET_RLIMIT_AS 9
#define TARGET_RLIMIT_LOCKS 10
#define TARGET_RLIMIT_SIGPENDING 11
#define TARGET_RLIMIT_MSGQUEUE 12
#define TARGET_RLIMIT_NICE 13
#define TARGET_RLIMIT_RTPRIO 14
#endif
struct target_pollfd {
int fd; /* file descriptor */
short events; /* requested events */
short revents; /* returned events */
};
/* virtual terminal ioctls */
#define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */
#define TARGET_KDMKTONE 0x4B30 /* generate tone */
#define TARGET_KDGKBTYPE 0x4b33
#define TARGET_KDSETMODE 0x4b3a
#define TARGET_KDGKBMODE 0x4b44
#define TARGET_KDSKBMODE 0x4b45
#define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */
#define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */
#define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */
#define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */
#define TARGET_KDGETLED 0x4B31 /* return current led state */
#define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */
#define TARGET_KDSIGACCEPT 0x4B4E
#if defined(TARGET_ALPHA) || defined(TARGET_MIPS) || defined(TARGET_SH4) || \
defined(TARGET_XTENSA)
#define TARGET_SIOCATMARK TARGET_IOR('s', 7, int)
#define TARGET_SIOCSPGRP TARGET_IOW('s', 8, pid_t)
#define TARGET_SIOCGPGRP TARGET_IOR('s', 9, pid_t)
#else
#define TARGET_SIOCATMARK 0x8905
#define TARGET_SIOCSPGRP 0x8902
#define TARGET_SIOCGPGRP 0x8904
#endif
#define TARGET_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
#define TARGET_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
/* Networking ioctls */
#define TARGET_SIOCADDRT 0x890B /* add routing table entry */
#define TARGET_SIOCDELRT 0x890C /* delete routing table entry */
#define TARGET_SIOCGIFNAME 0x8910 /* get iface name */
#define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */
#define TARGET_SIOCGIFCONF 0x8912 /* get iface list */
#define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */
#define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */
#define TARGET_SIOCGIFADDR 0x8915 /* get PA address */
#define TARGET_SIOCSIFADDR 0x8916 /* set PA address */
#define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */
#define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */
#define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */
#define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */
#define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */
#define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */
#define TARGET_SIOCGIFMETRIC 0x891d /* get metric */
#define TARGET_SIOCSIFMETRIC 0x891e /* set metric */
#define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */
#define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */
#define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */
#define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */
#define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */
#define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */
#define TARGET_SIOCSIFENCAP 0x8926
#define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */
#define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */
#define TARGET_SIOCSIFSLAVE 0x8930
#define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */
#define TARGET_SIOCDELMULTI 0x8932
#define TARGET_SIOCGIFINDEX 0x8933
#define TARGET_SIOCSIFPFLAGS 0x8934 /* set extended flags */
#define TARGET_SIOCGIFPFLAGS 0x8935 /* get extended flags */
/* Bridging control calls */
#define TARGET_SIOCGIFBR 0x8940 /* Bridging support */
#define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */
#define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
#define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
/* ARP cache control calls. */
#define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */
#define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */
#define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */
#define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */
#define TARGET_SIOCGARP 0x8954 /* get ARP table entry */
#define TARGET_SIOCSARP 0x8955 /* set ARP table entry */
/* RARP cache control calls. */
#define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */
#define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */
#define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */
/* Driver configuration calls */
#define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */
#define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */
/* DLCI configuration calls */
#define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */
#define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */
/* From <linux/wireless.h> */
#define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */
/* From <linux/random.h> */
#define TARGET_RNDGETENTCNT TARGET_IOR('R', 0x00, int)
#define TARGET_RNDADDTOENTCNT TARGET_IOW('R', 0x01, int)
#define TARGET_RNDZAPENTCNT TARGET_IO('R', 0x04)
#define TARGET_RNDCLEARPOOL TARGET_IO('R', 0x06)
/* From <linux/fs.h> */
#define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
#define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
#define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */
#define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
#define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */
#define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */
#define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */
#define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
#define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
#define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
#define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
#define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */
#define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */
/* A jump here: 108-111 have been used for various private purposes. */
#define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong)
#define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong)
#define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong)
/* return device size in bytes
(u64 *arg) */
#define TARGET_BLKDISCARD TARGET_IO(0x12, 119)
#define TARGET_BLKIOMIN TARGET_IO(0x12, 120)
#define TARGET_BLKIOOPT TARGET_IO(0x12, 121)
#define TARGET_BLKALIGNOFF TARGET_IO(0x12, 122)
#define TARGET_BLKPBSZGET TARGET_IO(0x12, 123)
#define TARGET_BLKDISCARDZEROES TARGET_IO(0x12, 124)
#define TARGET_BLKSECDISCARD TARGET_IO(0x12, 125)
#define TARGET_BLKROTATIONAL TARGET_IO(0x12, 126)
#define TARGET_BLKZEROOUT TARGET_IO(0x12, 127)
#define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */
#define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */
#define TARGET_FICLONE TARGET_IOW(0x94, 9, int)
#define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
/* Note that the ioctl numbers claim type "long" but the actual type
* used by the kernel is "int".
*/
#define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long)
#define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long)
#define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
/* usb ioctls */
#define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
#define TARGET_USBDEVFS_BULK TARGET_IOWRU('U', 2)
#define TARGET_USBDEVFS_RESETEP TARGET_IORU('U', 3)
#define TARGET_USBDEVFS_SETINTERFACE TARGET_IORU('U', 4)
#define TARGET_USBDEVFS_SETCONFIGURATION TARGET_IORU('U', 5)
#define TARGET_USBDEVFS_GETDRIVER TARGET_IOWU('U', 8)
#define TARGET_USBDEVFS_SUBMITURB TARGET_IORU('U', 10)
#define TARGET_USBDEVFS_DISCARDURB TARGET_IO('U', 11)
#define TARGET_USBDEVFS_REAPURB TARGET_IOWU('U', 12)
#define TARGET_USBDEVFS_REAPURBNDELAY TARGET_IOWU('U', 13)
#define TARGET_USBDEVFS_DISCSIGNAL TARGET_IORU('U', 14)
#define TARGET_USBDEVFS_CLAIMINTERFACE TARGET_IORU('U', 15)
#define TARGET_USBDEVFS_RELEASEINTERFACE TARGET_IORU('U', 16)
#define TARGET_USBDEVFS_CONNECTINFO TARGET_IOWU('U', 17)
#define TARGET_USBDEVFS_IOCTL TARGET_IOWRU('U', 18)
#define TARGET_USBDEVFS_HUB_PORTINFO TARGET_IORU('U', 19)
#define TARGET_USBDEVFS_RESET TARGET_IO('U', 20)
#define TARGET_USBDEVFS_CLEAR_HALT TARGET_IORU('U', 21)
#define TARGET_USBDEVFS_DISCONNECT TARGET_IO('U', 22)
#define TARGET_USBDEVFS_CONNECT TARGET_IO('U', 23)
#define TARGET_USBDEVFS_CLAIM_PORT TARGET_IORU('U', 24)
#define TARGET_USBDEVFS_RELEASE_PORT TARGET_IORU('U', 25)
#define TARGET_USBDEVFS_GET_CAPABILITIES TARGET_IORU('U', 26)
#define TARGET_USBDEVFS_DISCONNECT_CLAIM TARGET_IORU('U', 27)
#define TARGET_USBDEVFS_DROP_PRIVILEGES TARGET_IOWU('U', 30)
#define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31)
/* cdrom commands */
#define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */
#define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */
#define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */
#define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index
(struct cdrom_ti) */
#define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header
(struct cdrom_tochdr) */
#define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry
(struct cdrom_tocentry) */
#define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */
#define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */
#define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */
#define TARGET_CDROMVOLCTRL 0x530a /* Control output volume
(struct cdrom_volctrl) */
#define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data
(struct cdrom_subchnl) */
#define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
(struct cdrom_read) */
#define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
(struct cdrom_read) */
#define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */
#define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */
#define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session
address of multi session disks
(struct cdrom_multisession) */
#define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code"
if available (struct cdrom_mcn) */
#define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is deprecated,
but here anyway for compatibility */
#define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */
#define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting
(struct cdrom_volctrl) */
#define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes)
(struct cdrom_read) */
/*
* These ioctls are used only used in aztcd.c and optcd.c
*/
#define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */
#define TARGET_CDROMSEEK 0x5316 /* seek msf address */
/*
* This ioctl is only used by the scsi-cd driver.
It is for playing audio in logical block addressing mode.
*/
#define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */
/*
* These ioctls are only used in optcd.c
*/
#define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */
/*
* These ioctls are (now) only in ide-cd.c for controlling
* drive spindown time. They should be implemented in the
* Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
* GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
* -Erik
*/
#define TARGET_CDROMGETSPINDOWN 0x531d
#define TARGET_CDROMSETSPINDOWN 0x531e
/*
* These ioctls are implemented through the uniform CD-ROM driver
* They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
* drivers are eventually ported to the uniform CD-ROM driver interface.
*/
#define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
#define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */
#define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */
#define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */
#define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */
#define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */
#define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
#define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */
#define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */
#define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */
#define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */
#define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
/* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
* Future CDROM ioctls should be kept below 0x537F
*/
/* This ioctl is only used by sbpcd at the moment */
#define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */
/* conflict with SCSI_IOCTL_GET_IDLUN */
/* DVD-ROM Specific ioctls */
#define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */
#define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */
#define TARGET_DVD_AUTH 0x5392 /* Authentication */
#define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */
#define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */
#define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */
/* HD commands */
/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */