root / linux-user / syscall_defs.h @ e6e5906b
History | View | Annotate | Download (56.4 kB)
1 |
/* common syscall defines for all architectures */
|
---|---|
2 |
|
3 |
/* Note: although the syscall numbers change between architectures,
|
4 |
most of them stay the same, so we handle it by puting ifdefs if
|
5 |
necessary */
|
6 |
|
7 |
#include "syscall_nr.h" |
8 |
|
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 |
26 |
|
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 |
39 |
|
40 |
/*
|
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.
|
47 |
*/
|
48 |
#define TARGET_IOC_NRBITS 8 |
49 |
#define TARGET_IOC_TYPEBITS 8 |
50 |
|
51 |
#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
|
52 |
|| defined(TARGET_M68K) |
53 |
|
54 |
#define TARGET_IOC_SIZEBITS 14 |
55 |
#define TARGET_IOC_DIRBITS 2 |
56 |
|
57 |
#define TARGET_IOC_NONE 0U |
58 |
#define TARGET_IOC_WRITE 1U |
59 |
#define TARGET_IOC_READ 2U |
60 |
|
61 |
#elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
|
62 |
defined(TARGET_SPARC) || defined(TARGET_MIPS) |
63 |
|
64 |
#define TARGET_IOC_SIZEBITS 13 |
65 |
#define TARGET_IOC_DIRBITS 3 |
66 |
|
67 |
#define TARGET_IOC_NONE 1U |
68 |
#define TARGET_IOC_READ 2U |
69 |
#define TARGET_IOC_WRITE 4U |
70 |
|
71 |
#else
|
72 |
#error unsupported CPU
|
73 |
#endif
|
74 |
|
75 |
#define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1) |
76 |
#define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1) |
77 |
#define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1) |
78 |
#define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1) |
79 |
|
80 |
#define TARGET_IOC_NRSHIFT 0 |
81 |
#define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
|
82 |
#define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
|
83 |
#define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
|
84 |
|
85 |
#define TARGET_IOC(dir,type,nr,size) \
|
86 |
(((dir) << TARGET_IOC_DIRSHIFT) | \ |
87 |
((type) << TARGET_IOC_TYPESHIFT) | \ |
88 |
((nr) << TARGET_IOC_NRSHIFT) | \ |
89 |
((size) << TARGET_IOC_SIZESHIFT)) |
90 |
|
91 |
/* used to create numbers */
|
92 |
#define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0) |
93 |
#define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size)) |
94 |
#define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size)) |
95 |
#define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size)) |
96 |
|
97 |
/* the size is automatically computed for these defines */
|
98 |
#define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
|
99 |
#define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
|
100 |
#define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
|
101 |
|
102 |
struct target_sockaddr {
|
103 |
uint16_t sa_family; |
104 |
uint8_t sa_data[14];
|
105 |
}; |
106 |
|
107 |
struct target_timeval {
|
108 |
target_long tv_sec; |
109 |
target_long tv_usec; |
110 |
}; |
111 |
|
112 |
struct target_timespec {
|
113 |
target_long tv_sec; |
114 |
target_long tv_nsec; |
115 |
}; |
116 |
|
117 |
struct target_itimerval {
|
118 |
struct target_timeval it_interval;
|
119 |
struct target_timeval it_value;
|
120 |
}; |
121 |
|
122 |
typedef target_long target_clock_t;
|
123 |
|
124 |
#define TARGET_HZ 100 |
125 |
|
126 |
struct target_tms {
|
127 |
target_clock_t tms_utime; |
128 |
target_clock_t tms_stime; |
129 |
target_clock_t tms_cutime; |
130 |
target_clock_t tms_cstime; |
131 |
}; |
132 |
|
133 |
struct target_utimbuf {
|
134 |
target_long actime; |
135 |
target_long modtime; |
136 |
}; |
137 |
|
138 |
struct target_sel_arg_struct {
|
139 |
target_long n; |
140 |
target_long inp, outp, exp; |
141 |
target_long tvp; |
142 |
}; |
143 |
|
144 |
struct target_iovec {
|
145 |
target_long iov_base; /* Starting address */
|
146 |
target_long iov_len; /* Number of bytes */
|
147 |
}; |
148 |
|
149 |
struct target_msghdr {
|
150 |
target_long msg_name; /* Socket name */
|
151 |
int msg_namelen; /* Length of name */ |
152 |
target_long msg_iov; /* Data blocks */
|
153 |
target_long msg_iovlen; /* Number of blocks */
|
154 |
target_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
|
155 |
target_long msg_controllen; /* Length of cmsg list */
|
156 |
unsigned int msg_flags; |
157 |
}; |
158 |
|
159 |
struct target_cmsghdr {
|
160 |
target_long cmsg_len; |
161 |
int cmsg_level;
|
162 |
int cmsg_type;
|
163 |
}; |
164 |
|
165 |
#define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1)) |
166 |
#define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg)
|
167 |
#define TARGET_CMSG_FIRSTHDR(mhdr) \
|
168 |
((size_t) tswapl((mhdr)->msg_controllen) >= sizeof (struct target_cmsghdr) \ |
169 |
? (struct target_cmsghdr *) tswapl((mhdr)->msg_control) : (struct target_cmsghdr *) NULL) |
170 |
#define TARGET_CMSG_ALIGN(len) (((len) + sizeof (target_long) - 1) \ |
171 |
& (size_t) ~(sizeof (target_long) - 1)) |
172 |
#define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
|
173 |
+ TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr))) |
174 |
#define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len)) |
175 |
|
176 |
static __inline__ struct target_cmsghdr * |
177 |
__target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg) |
178 |
{ |
179 |
if (tswapl(__cmsg->cmsg_len) < sizeof (struct target_cmsghdr)) |
180 |
/* The kernel header does this so there may be a reason. */
|
181 |
return 0; |
182 |
|
183 |
__cmsg = (struct target_cmsghdr *) ((unsigned char *) __cmsg |
184 |
+ TARGET_CMSG_ALIGN (tswapl(__cmsg->cmsg_len))); |
185 |
if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) tswapl(__mhdr->msg_control) |
186 |
+ tswapl(__mhdr->msg_controllen)) |
187 |
|| ((unsigned char *) __cmsg + TARGET_CMSG_ALIGN (tswapl(__cmsg->cmsg_len)) |
188 |
> ((unsigned char *) tswapl(__mhdr->msg_control) |
189 |
+ tswapl(__mhdr->msg_controllen)))) |
190 |
/* No more entries. */
|
191 |
return 0; |
192 |
return __cmsg;
|
193 |
} |
194 |
|
195 |
|
196 |
struct target_rusage {
|
197 |
struct target_timeval ru_utime; /* user time used */ |
198 |
struct target_timeval ru_stime; /* system time used */ |
199 |
target_long ru_maxrss; /* maximum resident set size */
|
200 |
target_long ru_ixrss; /* integral shared memory size */
|
201 |
target_long ru_idrss; /* integral unshared data size */
|
202 |
target_long ru_isrss; /* integral unshared stack size */
|
203 |
target_long ru_minflt; /* page reclaims */
|
204 |
target_long ru_majflt; /* page faults */
|
205 |
target_long ru_nswap; /* swaps */
|
206 |
target_long ru_inblock; /* block input operations */
|
207 |
target_long ru_oublock; /* block output operations */
|
208 |
target_long ru_msgsnd; /* messages sent */
|
209 |
target_long ru_msgrcv; /* messages received */
|
210 |
target_long ru_nsignals; /* signals received */
|
211 |
target_long ru_nvcsw; /* voluntary context switches */
|
212 |
target_long ru_nivcsw; /* involuntary " */
|
213 |
}; |
214 |
|
215 |
typedef struct { |
216 |
int val[2]; |
217 |
} kernel_fsid_t; |
218 |
|
219 |
struct kernel_statfs {
|
220 |
int f_type;
|
221 |
int f_bsize;
|
222 |
int f_blocks;
|
223 |
int f_bfree;
|
224 |
int f_bavail;
|
225 |
int f_files;
|
226 |
int f_ffree;
|
227 |
kernel_fsid_t f_fsid; |
228 |
int f_namelen;
|
229 |
int f_spare[6]; |
230 |
}; |
231 |
|
232 |
struct target_dirent {
|
233 |
target_long d_ino; |
234 |
target_long d_off; |
235 |
unsigned short d_reclen; |
236 |
char d_name[256]; /* We must not include limits.h! */ |
237 |
}; |
238 |
|
239 |
struct target_dirent64 {
|
240 |
uint64_t d_ino; |
241 |
int64_t d_off; |
242 |
unsigned short d_reclen; |
243 |
unsigned char d_type; |
244 |
char d_name[256]; |
245 |
}; |
246 |
|
247 |
|
248 |
/* mostly generic signal stuff */
|
249 |
#define TARGET_SIG_DFL ((target_long)0) /* default signal handling */ |
250 |
#define TARGET_SIG_IGN ((target_long)1) /* ignore signal */ |
251 |
#define TARGET_SIG_ERR ((target_long)-1) /* error return from signal */ |
252 |
|
253 |
#ifdef TARGET_MIPS
|
254 |
#define TARGET_NSIG 128 |
255 |
#else
|
256 |
#define TARGET_NSIG 64 |
257 |
#endif
|
258 |
#define TARGET_NSIG_BPW TARGET_LONG_BITS
|
259 |
#define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
|
260 |
|
261 |
typedef struct { |
262 |
target_ulong sig[TARGET_NSIG_WORDS]; |
263 |
} target_sigset_t; |
264 |
|
265 |
#ifdef BSWAP_NEEDED
|
266 |
static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) |
267 |
{ |
268 |
int i;
|
269 |
for(i = 0;i < TARGET_NSIG_WORDS; i++) |
270 |
d->sig[i] = tswapl(s->sig[i]); |
271 |
} |
272 |
#else
|
273 |
static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s) |
274 |
{ |
275 |
*d = *s; |
276 |
} |
277 |
#endif
|
278 |
|
279 |
static inline void target_siginitset(target_sigset_t *d, target_ulong set) |
280 |
{ |
281 |
int i;
|
282 |
d->sig[0] = set;
|
283 |
for(i = 1;i < TARGET_NSIG_WORDS; i++) |
284 |
d->sig[i] = 0;
|
285 |
} |
286 |
|
287 |
void host_to_target_sigset(target_sigset_t *d, const sigset_t *s); |
288 |
void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); |
289 |
void host_to_target_old_sigset(target_ulong *old_sigset,
|
290 |
const sigset_t *sigset);
|
291 |
void target_to_host_old_sigset(sigset_t *sigset,
|
292 |
const target_ulong *old_sigset);
|
293 |
struct target_sigaction;
|
294 |
int do_sigaction(int sig, const struct target_sigaction *act, |
295 |
struct target_sigaction *oact);
|
296 |
|
297 |
#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined (TARGET_SH4) || defined(TARGET_M68K)
|
298 |
|
299 |
#if defined(TARGET_SPARC)
|
300 |
#define TARGET_SA_NOCLDSTOP 8u |
301 |
#define TARGET_SA_NOCLDWAIT 0x100u |
302 |
#define TARGET_SA_SIGINFO 0x200u |
303 |
#define TARGET_SA_ONSTACK 1u |
304 |
#define TARGET_SA_RESTART 2u |
305 |
#define TARGET_SA_NODEFER 0x20u |
306 |
#define TARGET_SA_RESETHAND 4u |
307 |
#elif defined(TARGET_MIPS)
|
308 |
#define TARGET_SA_NOCLDSTOP 0x00000001 |
309 |
#define TARGET_SA_NOCLDWAIT 0x00010000 |
310 |
#define TARGET_SA_SIGINFO 0x00000008 |
311 |
#define TARGET_SA_ONSTACK 0x08000000 |
312 |
#define TARGET_SA_NODEFER 0x40000000 |
313 |
#define TARGET_SA_RESTART 0x10000000 |
314 |
#define TARGET_SA_RESETHAND 0x80000000 |
315 |
#define TARGET_SA_RESTORER 0x04000000 /* Only for o32 */ |
316 |
#else
|
317 |
#define TARGET_SA_NOCLDSTOP 0x00000001 |
318 |
#define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */ |
319 |
#define TARGET_SA_SIGINFO 0x00000004 |
320 |
#define TARGET_SA_ONSTACK 0x08000000 |
321 |
#define TARGET_SA_RESTART 0x10000000 |
322 |
#define TARGET_SA_NODEFER 0x40000000 |
323 |
#define TARGET_SA_RESETHAND 0x80000000 |
324 |
#define TARGET_SA_RESTORER 0x04000000 |
325 |
#endif
|
326 |
|
327 |
#if defined(TARGET_SPARC)
|
328 |
|
329 |
#define TARGET_SIGHUP 1 |
330 |
#define TARGET_SIGINT 2 |
331 |
#define TARGET_SIGQUIT 3 |
332 |
#define TARGET_SIGILL 4 |
333 |
#define TARGET_SIGTRAP 5 |
334 |
#define TARGET_SIGABRT 6 |
335 |
#define TARGET_SIGIOT 6 |
336 |
#define TARGET_SIGSTKFLT 7 /* actually EMT */ |
337 |
#define TARGET_SIGFPE 8 |
338 |
#define TARGET_SIGKILL 9 |
339 |
#define TARGET_SIGBUS 10 |
340 |
#define TARGET_SIGSEGV 11 |
341 |
#define TARGET_SIGSYS 12 |
342 |
#define TARGET_SIGPIPE 13 |
343 |
#define TARGET_SIGALRM 14 |
344 |
#define TARGET_SIGTERM 15 |
345 |
#define TARGET_SIGURG 16 |
346 |
#define TARGET_SIGSTOP 17 |
347 |
#define TARGET_SIGTSTP 18 |
348 |
#define TARGET_SIGCONT 19 |
349 |
#define TARGET_SIGCHLD 20 |
350 |
#define TARGET_SIGTTIN 21 |
351 |
#define TARGET_SIGTTOU 22 |
352 |
#define TARGET_SIGIO 23 |
353 |
#define TARGET_SIGXCPU 24 |
354 |
#define TARGET_SIGXFSZ 25 |
355 |
#define TARGET_SIGVTALRM 26 |
356 |
#define TARGET_SIGPROF 27 |
357 |
#define TARGET_SIGWINCH 28 |
358 |
#define TARGET_SIGPWR 29 |
359 |
#define TARGET_SIGUSR1 30 |
360 |
#define TARGET_SIGUSR2 31 |
361 |
#define TARGET_SIGRTMIN 32 |
362 |
|
363 |
#define TARGET_SIG_BLOCK 0x01 /* for blocking signals */ |
364 |
#define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */ |
365 |
#define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */ |
366 |
|
367 |
#elif defined(TARGET_MIPS)
|
368 |
|
369 |
#define TARGET_SIGHUP 1 /* Hangup (POSIX). */ |
370 |
#define TARGET_SIGINT 2 /* Interrupt (ANSI). */ |
371 |
#define TARGET_SIGQUIT 3 /* Quit (POSIX). */ |
372 |
#define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */ |
373 |
#define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */ |
374 |
#define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */ |
375 |
#define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */ |
376 |
#define TARGET_SIGEMT 7 |
377 |
#define TARGET_SIGSTKFLT 7 /* XXX: incorrect */ |
378 |
#define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */ |
379 |
#define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */ |
380 |
#define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */ |
381 |
#define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */ |
382 |
#define TARGET_SIGSYS 12 |
383 |
#define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */ |
384 |
#define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */ |
385 |
#define TARGET_SIGTERM 15 /* Termination (ANSI). */ |
386 |
#define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */ |
387 |
#define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */ |
388 |
#define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */ |
389 |
#define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */ |
390 |
#define TARGET_SIGPWR 19 /* Power failure restart (System V). */ |
391 |
#define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ |
392 |
#define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */ |
393 |
#define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */ |
394 |
#define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */ |
395 |
#define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */ |
396 |
#define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */ |
397 |
#define TARGET_SIGCONT 25 /* Continue (POSIX). */ |
398 |
#define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */ |
399 |
#define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */ |
400 |
#define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ |
401 |
#define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ |
402 |
#define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ |
403 |
#define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ |
404 |
#define TARGET_SIGRTMIN 32 |
405 |
|
406 |
#define TARGET_SIG_BLOCK 1 /* for blocking signals */ |
407 |
#define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */ |
408 |
#define TARGET_SIG_SETMASK 3 /* for setting the signal mask */ |
409 |
|
410 |
#else
|
411 |
|
412 |
#define TARGET_SIGHUP 1 |
413 |
#define TARGET_SIGINT 2 |
414 |
#define TARGET_SIGQUIT 3 |
415 |
#define TARGET_SIGILL 4 |
416 |
#define TARGET_SIGTRAP 5 |
417 |
#define TARGET_SIGABRT 6 |
418 |
#define TARGET_SIGIOT 6 |
419 |
#define TARGET_SIGBUS 7 |
420 |
#define TARGET_SIGFPE 8 |
421 |
#define TARGET_SIGKILL 9 |
422 |
#define TARGET_SIGUSR1 10 |
423 |
#define TARGET_SIGSEGV 11 |
424 |
#define TARGET_SIGUSR2 12 |
425 |
#define TARGET_SIGPIPE 13 |
426 |
#define TARGET_SIGALRM 14 |
427 |
#define TARGET_SIGTERM 15 |
428 |
#define TARGET_SIGSTKFLT 16 |
429 |
#define TARGET_SIGCHLD 17 |
430 |
#define TARGET_SIGCONT 18 |
431 |
#define TARGET_SIGSTOP 19 |
432 |
#define TARGET_SIGTSTP 20 |
433 |
#define TARGET_SIGTTIN 21 |
434 |
#define TARGET_SIGTTOU 22 |
435 |
#define TARGET_SIGURG 23 |
436 |
#define TARGET_SIGXCPU 24 |
437 |
#define TARGET_SIGXFSZ 25 |
438 |
#define TARGET_SIGVTALRM 26 |
439 |
#define TARGET_SIGPROF 27 |
440 |
#define TARGET_SIGWINCH 28 |
441 |
#define TARGET_SIGIO 29 |
442 |
#define TARGET_SIGPWR 30 |
443 |
#define TARGET_SIGSYS 31 |
444 |
#define TARGET_SIGRTMIN 32 |
445 |
|
446 |
#define TARGET_SIG_BLOCK 0 /* for blocking signals */ |
447 |
#define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */ |
448 |
#define TARGET_SIG_SETMASK 2 /* for setting the signal mask */ |
449 |
|
450 |
#endif
|
451 |
|
452 |
#if defined(TARGET_MIPS)
|
453 |
|
454 |
struct target_sigaction {
|
455 |
target_ulong sa_flags; |
456 |
target_ulong _sa_handler; |
457 |
target_sigset_t sa_mask; |
458 |
}; |
459 |
|
460 |
#else
|
461 |
struct target_old_sigaction {
|
462 |
target_ulong _sa_handler; |
463 |
target_ulong sa_mask; |
464 |
target_ulong sa_flags; |
465 |
target_ulong sa_restorer; |
466 |
}; |
467 |
|
468 |
struct target_sigaction {
|
469 |
target_ulong _sa_handler; |
470 |
target_ulong sa_flags; |
471 |
target_ulong sa_restorer; |
472 |
target_sigset_t sa_mask; |
473 |
}; |
474 |
#endif
|
475 |
|
476 |
typedef union target_sigval { |
477 |
int sival_int;
|
478 |
target_ulong sival_ptr; |
479 |
} target_sigval_t; |
480 |
#if 0
|
481 |
#if defined (TARGET_SPARC)
|
482 |
typedef struct {
|
483 |
struct {
|
484 |
target_ulong psr;
|
485 |
target_ulong pc;
|
486 |
target_ulong npc;
|
487 |
target_ulong y;
|
488 |
target_ulong u_regs[16]; /* globals and ins */
|
489 |
} si_regs;
|
490 |
int si_mask;
|
491 |
} __siginfo_t;
|
492 |
|
493 |
typedef struct {
|
494 |
unsigned long si_float_regs [32];
|
495 |
unsigned long si_fsr;
|
496 |
unsigned long si_fpqdepth;
|
497 |
struct {
|
498 |
unsigned long *insn_addr;
|
499 |
unsigned long insn;
|
500 |
} si_fpqueue [16];
|
501 |
} __siginfo_fpu_t;
|
502 |
#endif
|
503 |
#endif
|
504 |
|
505 |
#define TARGET_SI_MAX_SIZE 128 |
506 |
#define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3) |
507 |
|
508 |
typedef struct target_siginfo { |
509 |
int si_signo;
|
510 |
int si_errno;
|
511 |
int si_code;
|
512 |
|
513 |
union {
|
514 |
int _pad[TARGET_SI_PAD_SIZE];
|
515 |
|
516 |
/* kill() */
|
517 |
struct {
|
518 |
pid_t _pid; /* sender's pid */
|
519 |
uid_t _uid; /* sender's uid */
|
520 |
} _kill; |
521 |
|
522 |
/* POSIX.1b timers */
|
523 |
struct {
|
524 |
unsigned int _timer1; |
525 |
unsigned int _timer2; |
526 |
} _timer; |
527 |
|
528 |
/* POSIX.1b signals */
|
529 |
struct {
|
530 |
pid_t _pid; /* sender's pid */
|
531 |
uid_t _uid; /* sender's uid */
|
532 |
target_sigval_t _sigval; |
533 |
} _rt; |
534 |
|
535 |
/* SIGCHLD */
|
536 |
struct {
|
537 |
pid_t _pid; /* which child */
|
538 |
uid_t _uid; /* sender's uid */
|
539 |
int _status; /* exit code */ |
540 |
target_clock_t _utime; |
541 |
target_clock_t _stime; |
542 |
} _sigchld; |
543 |
|
544 |
/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
|
545 |
struct {
|
546 |
target_ulong _addr; /* faulting insn/memory ref. */
|
547 |
} _sigfault; |
548 |
|
549 |
/* SIGPOLL */
|
550 |
struct {
|
551 |
int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ |
552 |
int _fd;
|
553 |
} _sigpoll; |
554 |
} _sifields; |
555 |
} target_siginfo_t; |
556 |
|
557 |
/*
|
558 |
* si_code values
|
559 |
* Digital reserves positive values for kernel-generated signals.
|
560 |
*/
|
561 |
#define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */ |
562 |
#define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ |
563 |
#define TARGET_SI_QUEUE -1 /* sent by sigqueue */ |
564 |
#define TARGET_SI_TIMER -2 /* sent by timer expiration */ |
565 |
#define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */ |
566 |
#define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */ |
567 |
#define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */ |
568 |
|
569 |
/*
|
570 |
* SIGILL si_codes
|
571 |
*/
|
572 |
#define TARGET_ILL_ILLOPC (1) /* illegal opcode */ |
573 |
#define TARGET_ILL_ILLOPN (2) /* illegal operand */ |
574 |
#define TARGET_ILL_ILLADR (3) /* illegal addressing mode */ |
575 |
#define TARGET_ILL_ILLTRP (4) /* illegal trap */ |
576 |
#define TARGET_ILL_PRVOPC (5) /* privileged opcode */ |
577 |
#define TARGET_ILL_PRVREG (6) /* privileged register */ |
578 |
#define TARGET_ILL_COPROC (7) /* coprocessor error */ |
579 |
#define TARGET_ILL_BADSTK (8) /* internal stack error */ |
580 |
|
581 |
/*
|
582 |
* SIGFPE si_codes
|
583 |
*/
|
584 |
#define TARGET_FPE_INTDIV (1) /* integer divide by zero */ |
585 |
#define TARGET_FPE_INTOVF (2) /* integer overflow */ |
586 |
#define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */ |
587 |
#define TARGET_FPE_FLTOVF (4) /* floating point overflow */ |
588 |
#define TARGET_FPE_FLTUND (5) /* floating point underflow */ |
589 |
#define TARGET_FPE_FLTRES (6) /* floating point inexact result */ |
590 |
#define TARGET_FPE_FLTINV (7) /* floating point invalid operation */ |
591 |
#define TARGET_FPE_FLTSUB (8) /* subscript out of range */ |
592 |
#define TARGET_NSIGFPE 8 |
593 |
|
594 |
/*
|
595 |
* SIGSEGV si_codes
|
596 |
*/
|
597 |
#define TARGET_SEGV_MAPERR (1) /* address not mapped to object */ |
598 |
#define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */ |
599 |
|
600 |
/*
|
601 |
* SIGBUS si_codes
|
602 |
*/
|
603 |
#define TARGET_BUS_ADRALN (1) /* invalid address alignment */ |
604 |
#define TARGET_BUS_ADRERR (2) /* non-existant physical address */ |
605 |
#define TARGET_BUS_OBJERR (3) /* object specific hardware error */ |
606 |
|
607 |
/*
|
608 |
* SIGTRAP si_codes
|
609 |
*/
|
610 |
#define TARGET_TRAP_BRKPT (1) /* process breakpoint */ |
611 |
#define TARGET_TRAP_TRACE (2) /* process trace trap */ |
612 |
|
613 |
#endif /* defined(TARGET_I386) || defined(TARGET_ARM) */ |
614 |
|
615 |
struct target_rlimit {
|
616 |
target_ulong rlim_cur; |
617 |
target_ulong rlim_max; |
618 |
}; |
619 |
|
620 |
struct target_pollfd {
|
621 |
int fd; /* file descriptor */ |
622 |
short events; /* requested events */ |
623 |
short revents; /* returned events */ |
624 |
}; |
625 |
|
626 |
/* virtual terminal ioctls */
|
627 |
#define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ |
628 |
#define TARGET_KDMKTONE 0x4B30 /* generate tone */ |
629 |
#define TARGET_KDGKBTYPE 0x4b33 |
630 |
#define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */ |
631 |
#define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */ |
632 |
|
633 |
#define TARGET_SIOCATMARK 0x8905 |
634 |
|
635 |
/* Networking ioctls */
|
636 |
#define TARGET_SIOCADDRT 0x890B /* add routing table entry */ |
637 |
#define TARGET_SIOCDELRT 0x890C /* delete routing table entry */ |
638 |
#define TARGET_SIOCGIFNAME 0x8910 /* get iface name */ |
639 |
#define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */ |
640 |
#define TARGET_SIOCGIFCONF 0x8912 /* get iface list */ |
641 |
#define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */ |
642 |
#define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */ |
643 |
#define TARGET_SIOCGIFADDR 0x8915 /* get PA address */ |
644 |
#define TARGET_SIOCSIFADDR 0x8916 /* set PA address */ |
645 |
#define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ |
646 |
#define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ |
647 |
#define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ |
648 |
#define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ |
649 |
#define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */ |
650 |
#define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */ |
651 |
#define TARGET_SIOCGIFMETRIC 0x891d /* get metric */ |
652 |
#define TARGET_SIOCSIFMETRIC 0x891e /* set metric */ |
653 |
#define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */ |
654 |
#define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */ |
655 |
#define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */ |
656 |
#define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */ |
657 |
#define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ |
658 |
#define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ |
659 |
#define TARGET_SIOCSIFENCAP 0x8926 |
660 |
#define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */ |
661 |
#define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */ |
662 |
#define TARGET_SIOCSIFSLAVE 0x8930 |
663 |
#define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */ |
664 |
#define TARGET_SIOCDELMULTI 0x8932 |
665 |
|
666 |
/* Bridging control calls */
|
667 |
#define TARGET_SIOCGIFBR 0x8940 /* Bridging support */ |
668 |
#define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */ |
669 |
|
670 |
#define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ |
671 |
#define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ |
672 |
|
673 |
/* ARP cache control calls. */
|
674 |
#define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */ |
675 |
#define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */ |
676 |
#define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */ |
677 |
#define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */ |
678 |
#define TARGET_SIOCGARP 0x8954 /* get ARP table entry */ |
679 |
#define TARGET_SIOCSARP 0x8955 /* set ARP table entry */ |
680 |
|
681 |
/* RARP cache control calls. */
|
682 |
#define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */ |
683 |
#define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */ |
684 |
#define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */ |
685 |
|
686 |
/* Driver configuration calls */
|
687 |
#define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */ |
688 |
#define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */ |
689 |
|
690 |
/* DLCI configuration calls */
|
691 |
#define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */ |
692 |
#define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */ |
693 |
|
694 |
|
695 |
/* From <linux/fs.h> */
|
696 |
|
697 |
#define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */ |
698 |
#define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */ |
699 |
#define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */ |
700 |
#define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */ |
701 |
#define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */ |
702 |
#define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */ |
703 |
#define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */ |
704 |
#define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ |
705 |
#define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ |
706 |
#define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ |
707 |
#define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ |
708 |
#define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */ |
709 |
/* A jump here: 108-111 have been used for various private purposes. */
|
710 |
#define TARGET_BLKBSZGET TARGET_IOR(0x12,112,sizeof(int)) |
711 |
#define TARGET_BLKBSZSET TARGET_IOW(0x12,113,sizeof(int)) |
712 |
#define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,sizeof(uint64_t)) /* return device size in bytes (u64 *arg) */ |
713 |
#define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */ |
714 |
#define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */ |
715 |
|
716 |
/* cdrom commands */
|
717 |
#define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */ |
718 |
#define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */ |
719 |
#define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ |
720 |
#define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index |
721 |
(struct cdrom_ti) */
|
722 |
#define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header |
723 |
(struct cdrom_tochdr) */
|
724 |
#define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry |
725 |
(struct cdrom_tocentry) */
|
726 |
#define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */ |
727 |
#define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */ |
728 |
#define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */ |
729 |
#define TARGET_CDROMVOLCTRL 0x530a /* Control output volume |
730 |
(struct cdrom_volctrl) */
|
731 |
#define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data |
732 |
(struct cdrom_subchnl) */
|
733 |
#define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) |
734 |
(struct cdrom_read) */
|
735 |
#define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes) |
736 |
(struct cdrom_read) */
|
737 |
#define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ |
738 |
#define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */ |
739 |
#define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session |
740 |
address of multi session disks
|
741 |
(struct cdrom_multisession) */
|
742 |
#define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" |
743 |
if available (struct cdrom_mcn) */
|
744 |
#define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is depricated, |
745 |
but here anyway for compatability */
|
746 |
#define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */ |
747 |
#define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting |
748 |
(struct cdrom_volctrl) */
|
749 |
#define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) |
750 |
(struct cdrom_read) */
|
751 |
/*
|
752 |
* These ioctls are used only used in aztcd.c and optcd.c
|
753 |
*/
|
754 |
#define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */ |
755 |
#define TARGET_CDROMSEEK 0x5316 /* seek msf address */ |
756 |
|
757 |
/*
|
758 |
* This ioctl is only used by the scsi-cd driver.
|
759 |
It is for playing audio in logical block addressing mode.
|
760 |
*/
|
761 |
#define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */ |
762 |
|
763 |
/*
|
764 |
* These ioctls are only used in optcd.c
|
765 |
*/
|
766 |
#define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */ |
767 |
|
768 |
/*
|
769 |
* These ioctls are (now) only in ide-cd.c for controlling
|
770 |
* drive spindown time. They should be implemented in the
|
771 |
* Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
|
772 |
* GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
|
773 |
* -Erik
|
774 |
*/
|
775 |
#define TARGET_CDROMGETSPINDOWN 0x531d |
776 |
#define TARGET_CDROMSETSPINDOWN 0x531e |
777 |
|
778 |
/*
|
779 |
* These ioctls are implemented through the uniform CD-ROM driver
|
780 |
* They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
|
781 |
* drivers are eventually ported to the uniform CD-ROM driver interface.
|
782 |
*/
|
783 |
#define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */ |
784 |
#define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */ |
785 |
#define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ |
786 |
#define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */ |
787 |
#define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */ |
788 |
#define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */ |
789 |
#define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ |
790 |
#define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */ |
791 |
#define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */ |
792 |
#define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */ |
793 |
#define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */ |
794 |
#define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ |
795 |
|
796 |
/* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
|
797 |
* Future CDROM ioctls should be kept below 0x537F
|
798 |
*/
|
799 |
|
800 |
/* This ioctl is only used by sbpcd at the moment */
|
801 |
#define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */ |
802 |
/* conflict with SCSI_IOCTL_GET_IDLUN */
|
803 |
|
804 |
/* DVD-ROM Specific ioctls */
|
805 |
#define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */ |
806 |
#define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */ |
807 |
#define TARGET_DVD_AUTH 0x5392 /* Authentication */ |
808 |
|
809 |
#define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ |
810 |
#define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */ |
811 |
#define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */ |
812 |
|
813 |
/* HD commands */
|
814 |
|
815 |
/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
|
816 |
#define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */ |
817 |
#define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ |
818 |
#define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ |
819 |
#define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ |
820 |
#define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ |
821 |
#define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ |
822 |
#define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */ |
823 |
#define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ |
824 |
#define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ |
825 |
|
826 |
/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
|
827 |
#define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ |
828 |
#define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ |
829 |
#define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ |
830 |
#define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ |
831 |
#define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ |
832 |
#define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */ |
833 |
#define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ |
834 |
|
835 |
|
836 |
/* from asm/termbits.h */
|
837 |
|
838 |
#define TARGET_NCC 8 |
839 |
struct target_termio {
|
840 |
unsigned short c_iflag; /* input mode flags */ |
841 |
unsigned short c_oflag; /* output mode flags */ |
842 |
unsigned short c_cflag; /* control mode flags */ |
843 |
unsigned short c_lflag; /* local mode flags */ |
844 |
unsigned char c_line; /* line discipline */ |
845 |
unsigned char c_cc[TARGET_NCC]; /* control characters */ |
846 |
}; |
847 |
|
848 |
struct target_winsize {
|
849 |
unsigned short ws_row; |
850 |
unsigned short ws_col; |
851 |
unsigned short ws_xpixel; |
852 |
unsigned short ws_ypixel; |
853 |
}; |
854 |
|
855 |
#include "termbits.h" |
856 |
|
857 |
#define TARGET_MAP_SHARED 0x01 /* Share changes */ |
858 |
#define TARGET_MAP_PRIVATE 0x02 /* Changes are private */ |
859 |
#define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */ |
860 |
#define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ |
861 |
#if defined(TARGET_MIPS)
|
862 |
#define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */ |
863 |
#define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */ |
864 |
#define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */ |
865 |
#define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */ |
866 |
#define TARGET_MAP_LOCKED 0x8000 /* pages are locked */ |
867 |
#define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ |
868 |
#else
|
869 |
#define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ |
870 |
#define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */ |
871 |
#define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */ |
872 |
#define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */ |
873 |
#define TARGET_MAP_LOCKED 0x2000 /* pages are locked */ |
874 |
#define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ |
875 |
#endif
|
876 |
|
877 |
#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4)
|
878 |
struct target_stat {
|
879 |
unsigned short st_dev; |
880 |
unsigned short __pad1; |
881 |
target_ulong st_ino; |
882 |
unsigned short st_mode; |
883 |
unsigned short st_nlink; |
884 |
unsigned short st_uid; |
885 |
unsigned short st_gid; |
886 |
unsigned short st_rdev; |
887 |
unsigned short __pad2; |
888 |
target_ulong st_size; |
889 |
target_ulong st_blksize; |
890 |
target_ulong st_blocks; |
891 |
target_ulong target_st_atime; |
892 |
target_ulong __unused1; |
893 |
target_ulong target_st_mtime; |
894 |
target_ulong __unused2; |
895 |
target_ulong target_st_ctime; |
896 |
target_ulong __unused3; |
897 |
target_ulong __unused4; |
898 |
target_ulong __unused5; |
899 |
}; |
900 |
|
901 |
/* This matches struct stat64 in glibc2.1, hence the absolutely
|
902 |
* insane amounts of padding around dev_t's.
|
903 |
*/
|
904 |
struct target_stat64 {
|
905 |
unsigned short st_dev; |
906 |
unsigned char __pad0[10]; |
907 |
|
908 |
#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 |
909 |
target_ulong __st_ino; |
910 |
|
911 |
unsigned int st_mode; |
912 |
unsigned int st_nlink; |
913 |
|
914 |
target_ulong st_uid; |
915 |
target_ulong st_gid; |
916 |
|
917 |
unsigned short st_rdev; |
918 |
unsigned char __pad3[10]; |
919 |
|
920 |
long long st_size; |
921 |
target_ulong st_blksize; |
922 |
|
923 |
target_ulong st_blocks; /* Number 512-byte blocks allocated. */
|
924 |
target_ulong __pad4; /* future possible st_blocks high bits */
|
925 |
|
926 |
target_ulong target_st_atime; |
927 |
target_ulong __pad5; |
928 |
|
929 |
target_ulong target_st_mtime; |
930 |
target_ulong __pad6; |
931 |
|
932 |
target_ulong target_st_ctime; |
933 |
target_ulong __pad7; /* will be high 32 bits of ctime someday */
|
934 |
|
935 |
unsigned long long st_ino; |
936 |
} __attribute__((packed)); |
937 |
|
938 |
#ifdef TARGET_ARM
|
939 |
struct target_eabi_stat64 {
|
940 |
unsigned long long st_dev; |
941 |
unsigned int __pad1; |
942 |
target_ulong __st_ino; |
943 |
unsigned int st_mode; |
944 |
unsigned int st_nlink; |
945 |
|
946 |
target_ulong st_uid; |
947 |
target_ulong st_gid; |
948 |
|
949 |
unsigned long long st_rdev; |
950 |
unsigned int __pad2[2]; |
951 |
|
952 |
long long st_size; |
953 |
target_ulong st_blksize; |
954 |
unsigned int __pad3; |
955 |
unsigned long long st_blocks; |
956 |
|
957 |
target_ulong target_st_atime; |
958 |
target_ulong target_st_atime_nsec; |
959 |
|
960 |
target_ulong target_st_mtime; |
961 |
target_ulong target_st_mtime_nsec; |
962 |
|
963 |
target_ulong target_st_ctime; |
964 |
target_ulong target_st_ctime_nsec; |
965 |
|
966 |
unsigned long long st_ino; |
967 |
} __attribute__ ((packed)); |
968 |
#endif
|
969 |
|
970 |
#elif defined(TARGET_SPARC)
|
971 |
|
972 |
struct target_stat {
|
973 |
unsigned short st_dev; |
974 |
target_ulong st_ino; |
975 |
unsigned short st_mode; |
976 |
short st_nlink;
|
977 |
unsigned short st_uid; |
978 |
unsigned short st_gid; |
979 |
unsigned short st_rdev; |
980 |
target_long st_size; |
981 |
target_long target_st_atime; |
982 |
target_ulong __unused1; |
983 |
target_long target_st_mtime; |
984 |
target_ulong __unused2; |
985 |
target_long target_st_ctime; |
986 |
target_ulong __unused3; |
987 |
target_long st_blksize; |
988 |
target_long st_blocks; |
989 |
target_ulong __unused4[2];
|
990 |
}; |
991 |
|
992 |
struct target_stat64 {
|
993 |
unsigned char __pad0[6]; |
994 |
unsigned short st_dev; |
995 |
|
996 |
uint64_t st_ino; |
997 |
|
998 |
unsigned int st_mode; |
999 |
unsigned int st_nlink; |
1000 |
|
1001 |
unsigned int st_uid; |
1002 |
unsigned int st_gid; |
1003 |
|
1004 |
unsigned char __pad2[6]; |
1005 |
unsigned short st_rdev; |
1006 |
|
1007 |
unsigned char __pad3[8]; |
1008 |
|
1009 |
int64_t st_size; |
1010 |
unsigned int st_blksize; |
1011 |
|
1012 |
unsigned char __pad4[8]; |
1013 |
unsigned int st_blocks; |
1014 |
|
1015 |
unsigned int target_st_atime; |
1016 |
unsigned int __unused1; |
1017 |
|
1018 |
unsigned int target_st_mtime; |
1019 |
unsigned int __unused2; |
1020 |
|
1021 |
unsigned int target_st_ctime; |
1022 |
unsigned int __unused3; |
1023 |
|
1024 |
unsigned int __unused4; |
1025 |
unsigned int __unused5; |
1026 |
}; |
1027 |
|
1028 |
#elif defined(TARGET_PPC)
|
1029 |
|
1030 |
struct target_stat {
|
1031 |
unsigned short st_dev; |
1032 |
target_ulong st_ino; |
1033 |
unsigned int st_mode; |
1034 |
unsigned short st_nlink; |
1035 |
unsigned int st_uid; |
1036 |
unsigned int st_gid; |
1037 |
unsigned short st_rdev; |
1038 |
target_ulong st_size; |
1039 |
target_ulong st_blksize; |
1040 |
target_ulong st_blocks; |
1041 |
target_ulong target_st_atime; |
1042 |
target_ulong __unused1; |
1043 |
target_ulong target_st_mtime; |
1044 |
target_ulong __unused2; |
1045 |
target_ulong target_st_ctime; |
1046 |
target_ulong __unused3; |
1047 |
target_ulong __unused4; |
1048 |
target_ulong __unused5; |
1049 |
}; |
1050 |
|
1051 |
struct target_stat64 {
|
1052 |
unsigned long long st_dev; |
1053 |
unsigned long long st_ino; |
1054 |
unsigned int st_mode; |
1055 |
unsigned int st_nlink; |
1056 |
unsigned int st_uid; |
1057 |
unsigned int st_gid; |
1058 |
unsigned long long st_rdev; |
1059 |
long long pad0; |
1060 |
long long st_size; |
1061 |
target_ulong st_blksize; |
1062 |
target_ulong pad1; |
1063 |
long long st_blocks; /* Number 512-byte blocks allocated. */ |
1064 |
target_ulong target_st_atime; |
1065 |
target_ulong target_st_atime_nsec; |
1066 |
target_ulong target_st_mtime; |
1067 |
target_ulong target_st_mtime_nsec; |
1068 |
target_ulong target_st_ctime; |
1069 |
target_ulong target_st_ctime_nsec; |
1070 |
target_ulong __unused4; |
1071 |
target_ulong __unused5; |
1072 |
}; |
1073 |
|
1074 |
#elif defined(TARGET_M68K)
|
1075 |
|
1076 |
struct target_stat {
|
1077 |
unsigned short st_dev; |
1078 |
unsigned short __pad1; |
1079 |
target_ulong st_ino; |
1080 |
unsigned short st_mode; |
1081 |
unsigned short st_nlink; |
1082 |
unsigned short st_uid; |
1083 |
unsigned short st_gid; |
1084 |
unsigned short st_rdev; |
1085 |
unsigned short __pad2; |
1086 |
target_ulong st_size; |
1087 |
target_ulong st_blksize; |
1088 |
target_ulong st_blocks; |
1089 |
target_ulong target_st_atime; |
1090 |
target_ulong __unused1; |
1091 |
target_ulong target_st_mtime; |
1092 |
target_ulong __unused2; |
1093 |
target_ulong target_st_ctime; |
1094 |
target_ulong __unused3; |
1095 |
target_ulong __unused4; |
1096 |
target_ulong __unused5; |
1097 |
}; |
1098 |
|
1099 |
/* This matches struct stat64 in glibc2.1, hence the absolutely
|
1100 |
* insane amounts of padding around dev_t's.
|
1101 |
*/
|
1102 |
struct target_stat64 {
|
1103 |
unsigned long long st_dev; |
1104 |
unsigned char __pad1[2]; |
1105 |
|
1106 |
#define TARGET_STAT64_HAS_BROKEN_ST_INO 1 |
1107 |
target_ulong __st_ino; |
1108 |
|
1109 |
unsigned int st_mode; |
1110 |
unsigned int st_nlink; |
1111 |
|
1112 |
target_ulong st_uid; |
1113 |
target_ulong st_gid; |
1114 |
|
1115 |
unsigned long long st_rdev; |
1116 |
unsigned char __pad3[2]; |
1117 |
|
1118 |
long long st_size; |
1119 |
target_ulong st_blksize; |
1120 |
|
1121 |
target_ulong __pad4; /* future possible st_blocks high bits */
|
1122 |
target_ulong st_blocks; /* Number 512-byte blocks allocated. */
|
1123 |
|
1124 |
target_ulong target_st_atime; |
1125 |
target_ulong target_st_atime_nsec; |
1126 |
|
1127 |
target_ulong target_st_mtime; |
1128 |
target_ulong target_st_mtime_nsec; |
1129 |
|
1130 |
target_ulong target_st_ctime; |
1131 |
target_ulong target_st_ctime_nsec; |
1132 |
|
1133 |
unsigned long long st_ino; |
1134 |
} __attribute__((packed)); |
1135 |
|
1136 |
#elif defined(TARGET_MIPS)
|
1137 |
|
1138 |
struct target_stat {
|
1139 |
unsigned st_dev;
|
1140 |
target_long st_pad1[3]; /* Reserved for network id */ |
1141 |
target_ulong st_ino; |
1142 |
unsigned int st_mode; |
1143 |
unsigned int st_nlink; |
1144 |
int st_uid;
|
1145 |
int st_gid;
|
1146 |
unsigned st_rdev;
|
1147 |
target_long st_pad2[2];
|
1148 |
target_long st_size; |
1149 |
target_long st_pad3; |
1150 |
/*
|
1151 |
* Actually this should be timestruc_t st_atime, st_mtime and st_ctime
|
1152 |
* but we don't have it under Linux.
|
1153 |
*/
|
1154 |
target_long target_st_atime; |
1155 |
target_long target_st_atime_nsec; |
1156 |
target_long target_st_mtime; |
1157 |
target_long target_st_mtime_nsec; |
1158 |
target_long target_st_ctime; |
1159 |
target_long target_st_ctime_nsec; |
1160 |
target_long st_blksize; |
1161 |
target_long st_blocks; |
1162 |
target_long st_pad4[14];
|
1163 |
}; |
1164 |
|
1165 |
/*
|
1166 |
* This matches struct stat64 in glibc2.1, hence the absolutely insane
|
1167 |
* amounts of padding around dev_t's. The memory layout is the same as of
|
1168 |
* struct stat of the 64-bit kernel.
|
1169 |
*/
|
1170 |
|
1171 |
struct target_stat64 {
|
1172 |
target_ulong st_dev; |
1173 |
target_ulong st_pad0[3]; /* Reserved for st_dev expansion */ |
1174 |
|
1175 |
uint64_t st_ino; |
1176 |
|
1177 |
unsigned int st_mode; |
1178 |
unsigned int st_nlink; |
1179 |
|
1180 |
int st_uid;
|
1181 |
int st_gid;
|
1182 |
|
1183 |
target_ulong st_rdev; |
1184 |
target_ulong st_pad1[3]; /* Reserved for st_rdev expansion */ |
1185 |
|
1186 |
int64_t st_size; |
1187 |
|
1188 |
/*
|
1189 |
* Actually this should be timestruc_t st_atime, st_mtime and st_ctime
|
1190 |
* but we don't have it under Linux.
|
1191 |
*/
|
1192 |
target_long target_st_atime; |
1193 |
target_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */
|
1194 |
|
1195 |
target_long target_st_mtime; |
1196 |
target_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */
|
1197 |
|
1198 |
target_long target_st_ctime; |
1199 |
target_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */
|
1200 |
|
1201 |
target_ulong st_blksize; |
1202 |
target_ulong st_pad2; |
1203 |
|
1204 |
int64_t st_blocks; |
1205 |
}; |
1206 |
#else
|
1207 |
#error unsupported CPU
|
1208 |
#endif
|
1209 |
|
1210 |
#ifdef TARGET_MIPS
|
1211 |
struct target_statfs {
|
1212 |
target_long f_type; |
1213 |
target_long f_bsize; |
1214 |
target_long f_frsize; /* Fragment size - unsupported */
|
1215 |
target_long f_blocks; |
1216 |
target_long f_bfree; |
1217 |
target_long f_files; |
1218 |
target_long f_ffree; |
1219 |
target_long f_bavail; |
1220 |
|
1221 |
/* Linux specials */
|
1222 |
int f_fsid;
|
1223 |
target_long f_namelen; |
1224 |
target_long f_spare[6];
|
1225 |
}; |
1226 |
|
1227 |
struct target_statfs64 {
|
1228 |
uint32_t f_type; |
1229 |
uint32_t f_bsize; |
1230 |
uint32_t f_frsize; /* Fragment size - unsupported */
|
1231 |
uint32_t __pad; |
1232 |
uint64_t f_blocks; |
1233 |
uint64_t f_bfree; |
1234 |
uint64_t f_files; |
1235 |
uint64_t f_ffree; |
1236 |
uint64_t f_bavail; |
1237 |
int f_fsid;
|
1238 |
uint32_t f_namelen; |
1239 |
uint32_t f_spare[6];
|
1240 |
}; |
1241 |
#else
|
1242 |
struct target_statfs {
|
1243 |
uint32_t f_type; |
1244 |
uint32_t f_bsize; |
1245 |
uint32_t f_blocks; |
1246 |
uint32_t f_bfree; |
1247 |
uint32_t f_bavail; |
1248 |
uint32_t f_files; |
1249 |
uint32_t f_ffree; |
1250 |
int f_fsid;
|
1251 |
uint32_t f_namelen; |
1252 |
uint32_t f_frsize; |
1253 |
uint32_t f_spare[5];
|
1254 |
}; |
1255 |
|
1256 |
struct target_statfs64 {
|
1257 |
uint32_t f_type; |
1258 |
uint32_t f_bsize; |
1259 |
uint64_t f_blocks; |
1260 |
uint64_t f_bfree; |
1261 |
uint64_t f_bavail; |
1262 |
uint64_t f_files; |
1263 |
uint64_t f_ffree; |
1264 |
int f_fsid;
|
1265 |
uint32_t f_namelen; |
1266 |
uint32_t f_frsize; |
1267 |
uint32_t f_spare[5];
|
1268 |
}; |
1269 |
#endif
|
1270 |
|
1271 |
|
1272 |
#define TARGET_F_DUPFD 0 /* dup */ |
1273 |
#define TARGET_F_GETFD 1 /* get close_on_exec */ |
1274 |
#define TARGET_F_SETFD 2 /* set/clear close_on_exec */ |
1275 |
#define TARGET_F_GETFL 3 /* get file->f_flags */ |
1276 |
#define TARGET_F_SETFL 4 /* set file->f_flags */ |
1277 |
|
1278 |
#if defined(TARGET_ALPHA)
|
1279 |
#define TARGET_F_GETLK 7 |
1280 |
#define TARGET_F_SETLK 8 |
1281 |
#define TARGET_F_SETLKW 9 |
1282 |
#define TARGET_F_SETOWN 5 /* for sockets. */ |
1283 |
#define TARGET_F_GETOWN 6 /* for sockets. */ |
1284 |
#else
|
1285 |
#define TARGET_F_GETLK 5 |
1286 |
#define TARGET_F_SETLK 6 |
1287 |
#define TARGET_F_SETLKW 7 |
1288 |
#define TARGET_F_SETOWN 8 /* for sockets. */ |
1289 |
#define TARGET_F_GETOWN 9 /* for sockets. */ |
1290 |
#endif
|
1291 |
|
1292 |
#define TARGET_F_SETSIG 10 /* for sockets. */ |
1293 |
#define TARGET_F_GETSIG 11 /* for sockets. */ |
1294 |
|
1295 |
#define TARGET_F_GETLK64 12 /* using 'struct flock64' */ |
1296 |
#define TARGET_F_SETLK64 13 |
1297 |
#define TARGET_F_SETLKW64 14 |
1298 |
|
1299 |
#if defined (TARGET_ARM)
|
1300 |
#define TARGET_O_ACCMODE 0003 |
1301 |
#define TARGET_O_RDONLY 00 |
1302 |
#define TARGET_O_WRONLY 01 |
1303 |
#define TARGET_O_RDWR 02 |
1304 |
#define TARGET_O_CREAT 0100 /* not fcntl */ |
1305 |
#define TARGET_O_EXCL 0200 /* not fcntl */ |
1306 |
#define TARGET_O_NOCTTY 0400 /* not fcntl */ |
1307 |
#define TARGET_O_TRUNC 01000 /* not fcntl */ |
1308 |
#define TARGET_O_APPEND 02000 |
1309 |
#define TARGET_O_NONBLOCK 04000 |
1310 |
#define TARGET_O_NDELAY TARGET_O_NONBLOCK
|
1311 |
#define TARGET_O_SYNC 010000 |
1312 |
#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ |
1313 |
#define TARGET_O_DIRECTORY 040000 /* must be a directory */ |
1314 |
#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ |
1315 |
#define TARGET_O_DIRECT 0200000 /* direct disk access hint */ |
1316 |
#define TARGET_O_LARGEFILE 0400000 |
1317 |
#elif defined (TARGET_PPC)
|
1318 |
#define TARGET_O_ACCMODE 0003 |
1319 |
#define TARGET_O_RDONLY 00 |
1320 |
#define TARGET_O_WRONLY 01 |
1321 |
#define TARGET_O_RDWR 02 |
1322 |
#define TARGET_O_CREAT 0100 /* not fcntl */ |
1323 |
#define TARGET_O_EXCL 0200 /* not fcntl */ |
1324 |
#define TARGET_O_NOCTTY 0400 /* not fcntl */ |
1325 |
#define TARGET_O_TRUNC 01000 /* not fcntl */ |
1326 |
#define TARGET_O_APPEND 02000 |
1327 |
#define TARGET_O_NONBLOCK 04000 |
1328 |
#define TARGET_O_NDELAY TARGET_O_NONBLOCK
|
1329 |
#define TARGET_O_SYNC 010000 |
1330 |
#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ |
1331 |
#define TARGET_O_DIRECTORY 040000 /* must be a directory */ |
1332 |
#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */ |
1333 |
#define TARGET_O_LARGEFILE 0200000 |
1334 |
#define TARGET_O_DIRECT 0400000 /* direct disk access hint */ |
1335 |
#elif defined (TARGET_SPARC)
|
1336 |
#define TARGET_O_RDONLY 0x0000 |
1337 |
#define TARGET_O_WRONLY 0x0001 |
1338 |
#define TARGET_O_RDWR 0x0002 |
1339 |
#define TARGET_O_ACCMODE 0x0003 |
1340 |
#define TARGET_O_APPEND 0x0008 |
1341 |
#define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */ |
1342 |
#define TARGET_O_CREAT 0x0200 /* not fcntl */ |
1343 |
#define TARGET_O_TRUNC 0x0400 /* not fcntl */ |
1344 |
#define TARGET_O_EXCL 0x0800 /* not fcntl */ |
1345 |
#define TARGET_O_SYNC 0x2000 |
1346 |
#define TARGET_O_NONBLOCK 0x4000 |
1347 |
#define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK) |
1348 |
#define TARGET_O_NOCTTY 0x8000 /* not fcntl */ |
1349 |
#define TARGET_O_DIRECTORY 0x10000 /* must be a directory */ |
1350 |
#define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */ |
1351 |
#define TARGET_O_LARGEFILE 0x40000 |
1352 |
#define TARGET_O_DIRECT 0x100000 /* direct disk access hint */ |
1353 |
#elif defined(TARGET_MIPS)
|
1354 |
#define TARGET_O_ACCMODE 0x0003 |
1355 |
#define TARGET_O_RDONLY 0x0000 |
1356 |
#define TARGET_O_WRONLY 0x0001 |
1357 |
#define TARGET_O_RDWR 0x0002 |
1358 |
#define TARGET_O_APPEND 0x0008 |
1359 |
#define TARGET_O_SYNC 0x0010 |
1360 |
#define TARGET_O_NONBLOCK 0x0080 |
1361 |
#define TARGET_O_CREAT 0x0100 /* not fcntl */ |
1362 |
#define TARGET_O_TRUNC 0x0200 /* not fcntl */ |
1363 |
#define TARGET_O_EXCL 0x0400 /* not fcntl */ |
1364 |
#define TARGET_O_NOCTTY 0x0800 /* not fcntl */ |
1365 |
#define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */ |
1366 |
#define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */ |
1367 |
#define TARGET_O_DIRECT 0x8000 /* direct disk access hint */ |
1368 |
#define TARGET_O_DIRECTORY 0x10000 /* must be a directory */ |
1369 |
#define TARGET_O_NOFOLLOW 0x20000 /* don't follow links */ |
1370 |
#define TARGET_O_NOATIME 0x40000 |
1371 |
#define TARGET_O_NDELAY TARGET_O_NONBLOCK
|
1372 |
#else
|
1373 |
#define TARGET_O_ACCMODE 0003 |
1374 |
#define TARGET_O_RDONLY 00 |
1375 |
#define TARGET_O_WRONLY 01 |
1376 |
#define TARGET_O_RDWR 02 |
1377 |
#define TARGET_O_CREAT 0100 /* not fcntl */ |
1378 |
#define TARGET_O_EXCL 0200 /* not fcntl */ |
1379 |
#define TARGET_O_NOCTTY 0400 /* not fcntl */ |
1380 |
#define TARGET_O_TRUNC 01000 /* not fcntl */ |
1381 |
#define TARGET_O_APPEND 02000 |
1382 |
#define TARGET_O_NONBLOCK 04000 |
1383 |
#define TARGET_O_NDELAY TARGET_O_NONBLOCK
|
1384 |
#define TARGET_O_SYNC 010000 |
1385 |
#define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */ |
1386 |
#define TARGET_O_DIRECT 040000 /* direct disk access hint */ |
1387 |
#define TARGET_O_LARGEFILE 0100000 |
1388 |
#define TARGET_O_DIRECTORY 0200000 /* must be a directory */ |
1389 |
#define TARGET_O_NOFOLLOW 0400000 /* don't follow links */ |
1390 |
#endif
|
1391 |
|
1392 |
struct target_flock {
|
1393 |
short l_type;
|
1394 |
short l_whence;
|
1395 |
target_ulong l_start; |
1396 |
target_ulong l_len; |
1397 |
int l_pid;
|
1398 |
}; |
1399 |
|
1400 |
struct target_flock64 {
|
1401 |
short l_type;
|
1402 |
short l_whence;
|
1403 |
unsigned long long l_start; |
1404 |
unsigned long long l_len; |
1405 |
int l_pid;
|
1406 |
}__attribute__((packed)); |
1407 |
|
1408 |
#ifdef TARGET_ARM
|
1409 |
struct target_eabi_flock64 {
|
1410 |
short l_type;
|
1411 |
short l_whence;
|
1412 |
int __pad;
|
1413 |
unsigned long long l_start; |
1414 |
unsigned long long l_len; |
1415 |
int l_pid;
|
1416 |
}__attribute__((packed)); |
1417 |
#endif
|
1418 |
|
1419 |
/* soundcard defines */
|
1420 |
/* XXX: convert them all to arch indepedent entries */
|
1421 |
#define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int); |
1422 |
#define TARGET_SNDCTL_COPR_LOAD 0xcfb04301 |
1423 |
#define TARGET_SNDCTL_COPR_RCODE 0xc0144303 |
1424 |
#define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309 |
1425 |
#define TARGET_SNDCTL_COPR_RDATA 0xc0144302 |
1426 |
#define TARGET_SNDCTL_COPR_RESET 0x00004300 |
1427 |
#define TARGET_SNDCTL_COPR_RUN 0xc0144306 |
1428 |
#define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308 |
1429 |
#define TARGET_SNDCTL_COPR_WCODE 0x40144305 |
1430 |
#define TARGET_SNDCTL_COPR_WDATA 0x40144304 |
1431 |
#define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0) |
1432 |
#define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1) |
1433 |
#define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int) |
1434 |
#define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int) |
1435 |
#define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int) |
1436 |
#define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int) |
1437 |
#define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int) |
1438 |
#define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int) |
1439 |
#define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8) |
1440 |
#define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int) |
1441 |
#define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int) |
1442 |
#define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int) |
1443 |
#define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12) |
1444 |
#define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13) |
1445 |
#define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int) |
1446 |
#define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int) |
1447 |
#define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17) |
1448 |
#define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18) |
1449 |
#define TARGET_SNDCTL_DSP_MAPINBUF 0x80085013 |
1450 |
#define TARGET_SNDCTL_DSP_MAPOUTBUF 0x80085014 |
1451 |
#define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e |
1452 |
#define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005 |
1453 |
#define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016 |
1454 |
#define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015 |
1455 |
#define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010 |
1456 |
#define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f |
1457 |
#define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107 |
1458 |
#define TARGET_SNDCTL_MIDI_INFO 0xc074510c |
1459 |
#define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02 |
1460 |
#define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01 |
1461 |
#define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00 |
1462 |
#define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110 |
1463 |
#define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001 |
1464 |
#define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103 |
1465 |
#define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105 |
1466 |
#define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104 |
1467 |
#define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b |
1468 |
#define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a |
1469 |
#define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112 |
1470 |
#define TARGET_SNDCTL_SEQ_PANIC 0x00005111 |
1471 |
#define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106 |
1472 |
#define TARGET_SNDCTL_SEQ_RESET 0x00005100 |
1473 |
#define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109 |
1474 |
#define TARGET_SNDCTL_SEQ_SYNC 0x00005101 |
1475 |
#define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108 |
1476 |
#define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d |
1477 |
#define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d |
1478 |
#define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102 |
1479 |
#define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e |
1480 |
#define TARGET_SNDCTL_TMR_CONTINUE 0x00005404 |
1481 |
#define TARGET_SNDCTL_TMR_METRONOME 0x40045407 |
1482 |
#define TARGET_SNDCTL_TMR_SELECT 0x40045408 |
1483 |
#define TARGET_SNDCTL_TMR_SOURCE 0xc0045406 |
1484 |
#define TARGET_SNDCTL_TMR_START 0x00005402 |
1485 |
#define TARGET_SNDCTL_TMR_STOP 0x00005403 |
1486 |
#define TARGET_SNDCTL_TMR_TEMPO 0xc0045405 |
1487 |
#define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401 |
1488 |
#define TARGET_SOUND_PCM_READ_RATE 0x80045002 |
1489 |
#define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006 |
1490 |
#define TARGET_SOUND_PCM_READ_BITS 0x80045005 |
1491 |
#define TARGET_SOUND_PCM_READ_FILTER 0x80045007 |
1492 |
#define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info) |
1493 |
#define TARGET_SOUND_MIXER_ACCESS 0xc0804d66 |
1494 |
#define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int) |
1495 |
#define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int) |
1496 |
#define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int) |
1497 |
#define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int) |
1498 |
#define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int) |
1499 |
|
1500 |
#define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int) |
1501 |
|
1502 |
#define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME)
|
1503 |
#define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS)
|
1504 |
#define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE)
|
1505 |
#define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH)
|
1506 |
#define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM)
|
1507 |
#define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER)
|
1508 |
#define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE)
|
1509 |
#define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC)
|
1510 |
#define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD)
|
1511 |
#define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX)
|
1512 |
#define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM)
|
1513 |
#define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV)
|
1514 |
#define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN)
|
1515 |
#define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN)
|
1516 |
#define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1)
|
1517 |
#define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2)
|
1518 |
#define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3)
|
1519 |
|
1520 |
/* Obsolete macros */
|
1521 |
#define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE)
|
1522 |
#define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE)
|
1523 |
#define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD)
|
1524 |
|
1525 |
#define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC)
|
1526 |
#define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK)
|
1527 |
#define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK)
|
1528 |
#define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)
|
1529 |
#define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS)
|
1530 |
|
1531 |
#define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int) |
1532 |
|
1533 |
#define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)
|
1534 |
#define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
|
1535 |
#define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE)
|
1536 |
#define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH)
|
1537 |
#define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM)
|
1538 |
#define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER)
|
1539 |
#define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE)
|
1540 |
#define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC)
|
1541 |
#define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD)
|
1542 |
#define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX)
|
1543 |
#define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM)
|
1544 |
#define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV)
|
1545 |
#define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN)
|
1546 |
#define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN)
|
1547 |
#define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1)
|
1548 |
#define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2)
|
1549 |
#define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)
|
1550 |
|
1551 |
/* Obsolete macros */
|
1552 |
#define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE)
|
1553 |
#define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE)
|
1554 |
#define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD)
|
1555 |
|
1556 |
#define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
|
1557 |
|
1558 |
/* vfat ioctls */
|
1559 |
#define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1) |
1560 |
#define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2) |
1561 |
|
1562 |
struct target_sysinfo {
|
1563 |
target_long uptime; /* Seconds since boot */
|
1564 |
target_ulong loads[3]; /* 1, 5, and 15 minute load averages */ |
1565 |
target_ulong totalram; /* Total usable main memory size */
|
1566 |
target_ulong freeram; /* Available memory size */
|
1567 |
target_ulong sharedram; /* Amount of shared memory */
|
1568 |
target_ulong bufferram; /* Memory used by buffers */
|
1569 |
target_ulong totalswap; /* Total swap space size */
|
1570 |
target_ulong freeswap; /* swap space still available */
|
1571 |
unsigned short procs; /* Number of current processes */ |
1572 |
unsigned short pad; /* explicit padding for m68k */ |
1573 |
target_ulong totalhigh; /* Total high memory size */
|
1574 |
target_ulong freehigh; /* Available high memory size */
|
1575 |
unsigned int mem_unit; /* Memory unit size in bytes */ |
1576 |
char _f[20-2*sizeof(target_long)-sizeof(int)]; /* Padding: libc5 uses this.. */ |
1577 |
}; |
1578 |
|
1579 |
#include "socket.h" |