Linux: Add support for the BLKFLSBUF ioctl
[valgrind.git] / include / vki / vki-linux.h
blobcfec2350b590c716ca96ed45dda308237c819c28
2 /*--------------------------------------------------------------------*/
3 /*--- Linux-specific kernel interface. vki-linux.h ---*/
4 /*--------------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright (C) 2000-2017 Julian Seward
11 jseward@acm.org
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 02111-1307, USA.
28 The GNU General Public License is contained in the file COPYING.
31 /* This file defines types and constants for the kernel interface, and to
32 make that clear everything is prefixed VKI_/vki_.
34 All code is copied verbatim from kernel source files, except that:
35 - VKI_/vki_ prefixes are added
36 - some extra explanatory comments are included; they are all within
37 "[[ ]]"
38 - for some types, we only care about the size; for a few of them (big
39 ones that are painful to fully drag in here), a VKI_SIZEOF_* constant
40 is used.
42 The files the code is taken from is indicated.
44 Note especially that the types are not the glibc versions, many of which
45 are different to those in here.
47 Also note that this file contains all the generic header info, ie. that
48 from linux/include/linux/ *.h. The arch-specific header info, eg. that
49 from linux/include/asm-i386/ *.h, is in vki-$PLATFORM.h and
50 vki_posixtypes-$PLATFORM.h. (Two files are required to avoid
51 circular dependencies between the generic VKI header and the
52 arch-specific VKI header. It's possible in the future, as more stuff
53 gets pulled in, that we might have to split files up some more to avoid
54 further circular dependencies.)
56 Finally, note that it is assumed that __KERNEL__ is set for all these
57 definitions, which affects some of them.
60 /* The structure is (aiui, jrs 20060504):
62 #include plat-specific posix types (vki-posixtypes-ARCH-linux.h)
64 Lots more types, structs, consts, in this file
66 #include other plat-specific stuff (vki-ARCH-linux.h)
68 Even more types, structs, consts, in this file
70 The system call numbers are dealt with by
71 pub_{core,tool}_vkiscnums.h, not via pub_{core,tool}_vki.h, which
72 is what this file is part of.
75 #ifndef __VKI_LINUX_H
76 #define __VKI_LINUX_H
78 //----------------------------------------------------------------------
79 // Arch-specific POSIX types
80 //----------------------------------------------------------------------
82 #if defined(VGA_x86)
83 # include "vki-posixtypes-x86-linux.h"
84 #elif defined(VGA_amd64)
85 # include "vki-posixtypes-amd64-linux.h"
86 #elif defined(VGA_ppc32)
87 # include "vki-posixtypes-ppc32-linux.h"
88 #elif defined(VGA_ppc64be) || defined(VGA_ppc64le)
89 # include "vki-posixtypes-ppc64-linux.h"
90 #elif defined(VGA_arm)
91 # include "vki-posixtypes-arm-linux.h"
92 #elif defined(VGA_arm64)
93 # include "vki-posixtypes-arm64-linux.h"
94 #elif defined(VGA_s390x)
95 # include "vki-posixtypes-s390x-linux.h"
96 #elif defined(VGA_mips32)
97 # include "vki-posixtypes-mips32-linux.h"
98 #elif defined(VGA_mips64)
99 # include "vki-posixtypes-mips64-linux.h"
100 #else
101 # error Unknown platform
102 #endif
104 //----------------------------------------------------------------------
105 // VKI_STATIC_ASSERT(). Inspired by BUILD_BUG_ON() from
106 // linux-2.6.34/include/linux/kernel.h
107 //----------------------------------------------------------------------
110 * Evaluates to zero if 'expr' is true and forces a compilation error if
111 * 'expr' is false. Can be used in a context where no comma expressions
112 * are allowed.
114 #ifdef __cplusplus
115 template <bool b> struct vki_static_assert { int m_bitfield:(2*b-1); };
116 #define VKI_STATIC_ASSERT(expr) \
117 (sizeof(vki_static_assert<(expr)>) - sizeof(int))
118 #else
119 #define VKI_STATIC_ASSERT(expr) (sizeof(struct { int:-!(expr); }))
120 #endif
122 //----------------------------------------------------------------------
123 // Based on _IOC_TYPECHECK() from linux-2.6.34/asm-generic/ioctl.h
124 //----------------------------------------------------------------------
126 /* provoke compile error for invalid uses of size argument */
127 #define _VKI_IOC_TYPECHECK(t) \
128 (VKI_STATIC_ASSERT((sizeof(t) == sizeof(t[1]) \
129 && sizeof(t) < (1 << _VKI_IOC_SIZEBITS))) \
130 + sizeof(t))
132 //----------------------------------------------------------------------
133 // From linux-2.6.8.1/include/linux/compiler.h
134 //----------------------------------------------------------------------
136 # define __user
138 //----------------------------------------------------------------------
139 // From linux/include/linux/compiler-gcc.h
140 //----------------------------------------------------------------------
142 #ifdef __GNUC__
143 #define __vki_packed __attribute__((packed))
144 #endif
146 //----------------------------------------------------------------------
147 // From linux-2.6.8.1/include/linux/posix_types.h
148 //----------------------------------------------------------------------
150 #undef __VKI_NFDBITS
151 #define __VKI_NFDBITS (8 * sizeof(unsigned long))
153 #undef __VKI_FD_SETSIZE
154 #define __VKI_FD_SETSIZE 1024
156 #undef __VKI_FDSET_LONGS
157 #define __VKI_FDSET_LONGS (__VKI_FD_SETSIZE/__VKI_NFDBITS)
159 #undef __VKI_FDELT
160 #define __VKI_FDELT(d) ((d) / __VKI_NFDBITS)
162 #undef __VKI_FDMASK
163 #define __VKI_FDMASK(d) (1UL << ((d) % __VKI_NFDBITS))
165 typedef struct {
166 unsigned long fds_bits [__VKI_FDSET_LONGS];
167 } __vki_kernel_fd_set;
169 typedef int __vki_kernel_key_t;
170 typedef int __vki_kernel_mqd_t;
172 //----------------------------------------------------------------------
173 // From linux-2.6.8.1/include/linux/types.h
174 //----------------------------------------------------------------------
176 typedef __vki_kernel_fd_set vki_fd_set;
177 typedef __vki_kernel_mode_t vki_mode_t;
178 typedef __vki_kernel_off_t vki_off_t;
179 typedef __vki_kernel_pid_t vki_pid_t;
180 typedef __vki_kernel_key_t vki_key_t;
181 typedef __vki_kernel_suseconds_t vki_suseconds_t;
182 typedef __vki_kernel_timer_t vki_timer_t;
183 typedef __vki_kernel_clockid_t vki_clockid_t;
184 typedef __vki_kernel_mqd_t vki_mqd_t;
186 // [[Nb: it's a bit unclear due to a #ifdef, but I think this is right. --njn]]
187 typedef __vki_kernel_uid32_t vki_uid_t;
188 typedef __vki_kernel_gid32_t vki_gid_t;
190 typedef __vki_kernel_old_uid_t vki_old_uid_t;
191 typedef __vki_kernel_old_gid_t vki_old_gid_t;
193 typedef __vki_kernel_loff_t vki_loff_t;
195 typedef __vki_kernel_size_t vki_size_t;
196 typedef __vki_kernel_time_t vki_time_t;
197 typedef __vki_kernel_clock_t vki_clock_t;
198 typedef __vki_kernel_caddr_t vki_caddr_t;
200 typedef unsigned long vki_u_long;
202 typedef unsigned int vki_uint;
204 //----------------------------------------------------------------------
205 // Now the rest of the arch-specific stuff
206 //----------------------------------------------------------------------
208 #if defined(VGA_x86)
209 # include "vki-x86-linux.h"
210 #elif defined(VGA_amd64)
211 # include "vki-amd64-linux.h"
212 #elif defined(VGA_ppc32)
213 # include "vki-ppc32-linux.h"
214 #elif defined(VGA_ppc64be) || defined(VGA_ppc64le)
215 # include "vki-ppc64-linux.h"
216 #elif defined(VGA_arm)
217 # include "vki-arm-linux.h"
218 #elif defined(VGA_arm64)
219 # include "vki-arm64-linux.h"
220 #elif defined(VGA_s390x)
221 # include "vki-s390x-linux.h"
222 #elif defined(VGA_mips32)
223 # include "vki-mips32-linux.h"
224 #elif defined(VGA_mips64)
225 # include "vki-mips64-linux.h"
226 #else
227 # error Unknown platform
228 #endif
230 //----------------------------------------------------------------------
231 // From linux-2.6.20.1/include/linux/types.h
232 //----------------------------------------------------------------------
234 typedef __vki_s32 vki_int32_t;
235 typedef __vki_s16 vki_int16_t;
236 typedef __vki_s64 vki_int64_t;
238 typedef __vki_u8 vki_uint8_t;
239 typedef __vki_u16 vki_uint16_t;
240 typedef __vki_u32 vki_uint32_t;
241 typedef __vki_u64 vki_uint64_t;
243 typedef __vki_u16 __vki_le16;
245 //----------------------------------------------------------------------
246 // From linux-2.6.8.1/include/linux/limits.h
247 //----------------------------------------------------------------------
249 #define VKI_PATH_MAX 4096 /* # chars in a path name including nul */
251 //----------------------------------------------------------------------
252 // From linux-2.6.8.1/include/linux/kernel.h
253 //----------------------------------------------------------------------
255 struct vki_sysinfo {
256 long uptime; /* Seconds since boot */
257 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
258 unsigned long totalram; /* Total usable main memory size */
259 unsigned long freeram; /* Available memory size */
260 unsigned long sharedram; /* Amount of shared memory */
261 unsigned long bufferram; /* Memory used by buffers */
262 unsigned long totalswap; /* Total swap space size */
263 unsigned long freeswap; /* swap space still available */
264 unsigned short procs; /* Number of current processes */
265 unsigned short pad; /* explicit padding for m68k */
266 unsigned long totalhigh; /* Total high memory size */
267 unsigned long freehigh; /* Available high memory size */
268 unsigned int mem_unit; /* Memory unit size in bytes */
269 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
272 //----------------------------------------------------------------------
273 // From linux-2.6.8.1/include/linux/time.h
274 //----------------------------------------------------------------------
276 #define VKI_CLOCK_REALTIME 0
277 #define VKI_CLOCK_MONOTONIC 1
278 #define VKI_CLOCK_PROCESS_CPUTIME_ID 2
279 #define VKI_CLOCK_THREAD_CPUTIME_ID 3
281 struct vki_timespec {
282 vki_time_t tv_sec; /* seconds */
283 long tv_nsec; /* nanoseconds */
286 struct vki_timeval {
287 vki_time_t tv_sec; /* seconds */
288 vki_suseconds_t tv_usec; /* microseconds */
291 struct vki_timezone {
292 int tz_minuteswest; /* minutes west of Greenwich */
293 int tz_dsttime; /* type of dst correction */
296 struct vki_itimerspec {
297 struct vki_timespec it_interval; /* timer period */
298 struct vki_timespec it_value; /* timer expiration */
301 struct vki_itimerval {
302 struct vki_timeval it_interval; /* timer interval */
303 struct vki_timeval it_value; /* current value */
306 //----------------------------------------------------------------------
307 // From linux-2.6.8.1/include/linux/timex.h
308 //----------------------------------------------------------------------
310 struct vki_timex {
311 unsigned int modes; /* mode selector */
312 long offset; /* time offset (usec) */
313 long freq; /* frequency offset (scaled ppm) */
314 long maxerror; /* maximum error (usec) */
315 long esterror; /* estimated error (usec) */
316 int status; /* clock command/status */
317 long constant; /* pll time constant */
318 long precision; /* clock precision (usec) (read only) */
319 long tolerance; /* clock frequency tolerance (ppm)
320 * (read only)
322 struct vki_timeval time; /* (read only) */
323 long tick; /* (modified) usecs between clock ticks */
325 long ppsfreq; /* pps frequency (scaled ppm) (ro) */
326 long jitter; /* pps jitter (us) (ro) */
327 int shift; /* interval duration (s) (shift) (ro) */
328 long stabil; /* pps stability (scaled ppm) (ro) */
329 long jitcnt; /* jitter limit exceeded (ro) */
330 long calcnt; /* calibration intervals (ro) */
331 long errcnt; /* calibration errors (ro) */
332 long stbcnt; /* stability limit exceeded (ro) */
334 int :32; int :32; int :32; int :32;
335 int :32; int :32; int :32; int :32;
336 int :32; int :32; int :32; int :32;
339 #define VKI_ADJ_OFFSET 0x0001 /* time offset */
340 #define VKI_ADJ_FREQUENCY 0x0002 /* frequency offset */
341 #define VKI_ADJ_MAXERROR 0x0004 /* maximum time error */
342 #define VKI_ADJ_ESTERROR 0x0008 /* estimated time error */
343 #define VKI_ADJ_STATUS 0x0010 /* clock status */
344 #define VKI_ADJ_TIMECONST 0x0020 /* pll time constant */
345 #define VKI_ADJ_TAI 0x0080 /* set TAI offset */
346 #define VKI_ADJ_TICK 0x4000 /* tick value */
347 #define VKI_ADJ_ADJTIME 0x8000 /* switch between adjtime/adjtimex modes */
348 //#define VKI_ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
349 #define VKI_ADJ_OFFSET_READONLY 0x2000 /* read-only adjtime */
351 //----------------------------------------------------------------------
352 // From linux-2.6.8.1/include/linux/times.h
353 //----------------------------------------------------------------------
355 struct vki_tms {
356 vki_clock_t tms_utime;
357 vki_clock_t tms_stime;
358 vki_clock_t tms_cutime;
359 vki_clock_t tms_cstime;
362 //----------------------------------------------------------------------
363 // From linux-2.6.8.1/include/linux/utime.h
364 //----------------------------------------------------------------------
366 struct vki_utimbuf {
367 vki_time_t actime;
368 vki_time_t modtime;
371 //----------------------------------------------------------------------
372 // From linux-2.6.8.1/include/linux/sched.h
373 //----------------------------------------------------------------------
375 #define VKI_CSIGNAL 0x000000ff /* signal mask to be sent at exit */
376 #define VKI_CLONE_VM 0x00000100 /* set if VM shared between processes */
377 #define VKI_CLONE_FS 0x00000200 /* set if fs info shared between processes */
378 #define VKI_CLONE_FILES 0x00000400 /* set if open files shared between processes */
379 #define VKI_CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */
380 #define VKI_CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
381 #define VKI_CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
382 #define VKI_CLONE_THREAD 0x00010000 /* Same thread group? */
383 #define VKI_CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */
384 #define VKI_CLONE_SETTLS 0x00080000 /* create a new TLS for the child */
385 #define VKI_CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */
386 #define VKI_CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */
387 #define VKI_CLONE_DETACHED 0x00400000 /* Unused, ignored */
388 #define VKI_CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
390 struct vki_sched_param {
391 int sched_priority;
394 #define VKI_TASK_COMM_LEN 16
396 //----------------------------------------------------------------------
397 // From linux-2.6.8.1/include/asm-generic/siginfo.h
398 //----------------------------------------------------------------------
400 // Some archs, such as MIPS, have non-standard vki_siginfo.
401 #ifndef HAVE_ARCH_SIGINFO_T
402 typedef union vki_sigval {
403 int sival_int;
404 void __user *sival_ptr;
405 } vki_sigval_t;
407 #ifndef __VKI_ARCH_SI_PREAMBLE_SIZE
408 #define __VKI_ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
409 #endif
411 #define VKI_SI_MAX_SIZE 128
413 #ifndef VKI_SI_PAD_SIZE
414 #define VKI_SI_PAD_SIZE ((VKI_SI_MAX_SIZE - __VKI_ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
415 #endif
417 #ifndef __VKI_ARCH_SI_UID_T
418 #define __VKI_ARCH_SI_UID_T vki_uid_t
419 #endif
421 #ifndef __VKI_ARCH_SI_BAND_T
422 #define __VKI_ARCH_SI_BAND_T long
423 #endif
425 // [[Nb: this type changed between 2.4 and 2.6, but not in a way that
426 // affects Valgrind.]]
427 typedef struct vki_siginfo {
428 int si_signo;
429 int si_errno;
430 int si_code;
432 union {
433 int _pad[VKI_SI_PAD_SIZE];
435 /* kill() */
436 struct {
437 vki_pid_t _pid; /* sender's pid */
438 __VKI_ARCH_SI_UID_T _uid; /* sender's uid */
439 } _kill;
441 /* POSIX.1b timers */
442 struct {
443 vki_timer_t _tid; /* timer id */
444 int _overrun; /* overrun count */
445 char _pad[sizeof( __VKI_ARCH_SI_UID_T) - sizeof(int)];
446 vki_sigval_t _sigval; /* same as below */
447 int _sys_private; /* not to be passed to user */
448 } _timer;
450 /* POSIX.1b signals */
451 struct {
452 vki_pid_t _pid; /* sender's pid */
453 __VKI_ARCH_SI_UID_T _uid; /* sender's uid */
454 vki_sigval_t _sigval;
455 } _rt;
457 /* SIGCHLD */
458 struct {
459 vki_pid_t _pid; /* which child */
460 __VKI_ARCH_SI_UID_T _uid; /* sender's uid */
461 int _status; /* exit code */
462 vki_clock_t _utime;
463 vki_clock_t _stime;
464 } _sigchld;
466 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
467 struct {
468 void __user *_addr; /* faulting insn/memory ref. */
469 #ifdef __ARCH_SI_TRAPNO
470 int _trapno; /* TRAP # which caused the signal */
471 #endif
472 } _sigfault;
474 /* SIGPOLL */
475 struct {
476 __VKI_ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
477 int _fd;
478 } _sigpoll;
479 } _sifields;
480 } vki_siginfo_t;
481 #endif
483 #define __VKI_SI_FAULT 0
486 * si_code values
487 * Digital reserves positive values for kernel-generated signals.
489 #define VKI_SI_USER 0 /* sent by kill, sigsend, raise */
490 #define VKI_SI_TKILL -6 /* sent by tkill system call */
493 * SIGILL si_codes
495 #define VKI_ILL_ILLOPC (__VKI_SI_FAULT|1) /* illegal opcode */
496 #define VKI_ILL_ILLOPN (__VKI_SI_FAULT|2) /* illegal operand */
497 #define VKI_ILL_ILLADR (__VKI_SI_FAULT|3) /* illegal addressing mode */
498 #define VKI_ILL_ILLTRP (__VKI_SI_FAULT|4) /* illegal trap */
499 #define VKI_ILL_PRVOPC (__VKI_SI_FAULT|5) /* privileged opcode */
500 #define VKI_ILL_PRVREG (__VKI_SI_FAULT|6) /* privileged register */
501 #define VKI_ILL_COPROC (__VKI_SI_FAULT|7) /* coprocessor error */
502 #define VKI_ILL_BADSTK (__VKI_SI_FAULT|8) /* internal stack error */
505 * SIGFPE si_codes
507 #define VKI_FPE_INTDIV (__VKI_SI_FAULT|1) /* integer divide by zero */
508 #define VKI_FPE_INTOVF (__VKI_SI_FAULT|2) /* integer overflow */
509 #define VKI_FPE_FLTDIV (__VKI_SI_FAULT|3) /* floating point divide by zero */
510 #define VKI_FPE_FLTOVF (__VKI_SI_FAULT|4) /* floating point overflow */
511 #define VKI_FPE_FLTUND (__VKI_SI_FAULT|5) /* floating point underflow */
512 #define VKI_FPE_FLTRES (__VKI_SI_FAULT|6) /* floating point inexact result */
513 #define VKI_FPE_FLTINV (__VKI_SI_FAULT|7) /* floating point invalid operation */
514 #define VKI_FPE_FLTSUB (__VKI_SI_FAULT|8) /* subscript out of range */
517 * SIGSEGV si_codes
519 #define VKI_SEGV_MAPERR (__VKI_SI_FAULT|1) /* address not mapped to object */
520 #define VKI_SEGV_ACCERR (__VKI_SI_FAULT|2) /* invalid permissions for mapped object */
523 * SIGBUS si_codes
525 #define VKI_BUS_ADRALN (__VKI_SI_FAULT|1) /* invalid address alignment */
526 #define VKI_BUS_ADRERR (__VKI_SI_FAULT|2) /* non-existent physical address */
527 #define VKI_BUS_OBJERR (__VKI_SI_FAULT|3) /* object specific hardware error */
530 * SIGTRAP si_codes
532 #define VKI_TRAP_BRKPT (__VKI_SI_FAULT|1) /* process breakpoint */
533 #define VKI_TRAP_TRACE (__VKI_SI_FAULT|2) /* process trace trap */
536 * This works because the alignment is ok on all current architectures
537 * but we leave open this being overridden in the future
539 #ifndef VKI___ARCH_SIGEV_PREAMBLE_SIZE
540 #define VKI___ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(vki_sigval_t))
541 #endif
543 #define VKI_SIGEV_MAX_SIZE 64
544 #define VKI_SIGEV_PAD_SIZE ((VKI_SIGEV_MAX_SIZE - VKI___ARCH_SIGEV_PREAMBLE_SIZE) \
545 / sizeof(int))
547 /* This is the flag the kernel handles, userspace/glibc handles SEGEV_THEAD. */
548 #define VKI_SIGEV_THREAD_ID 4
550 typedef struct vki_sigevent {
551 vki_sigval_t sigev_value;
552 int sigev_signo;
553 int sigev_notify;
554 union {
555 int _pad[VKI_SIGEV_PAD_SIZE];
556 int _tid;
558 struct {
559 void (*_function)(vki_sigval_t);
560 void *_attribute; /* really pthread_attr_t */
561 } _sigev_thread;
562 } _sigev_un;
563 } vki_sigevent_t;
565 #define vki_sigev_notify_thread_id _sigev_un._tid
567 //----------------------------------------------------------------------
568 // From elsewhere...
569 //----------------------------------------------------------------------
571 // [[The kernel actually uses the numbers 0,1,2 directly here, believe it or
572 // not. So we introduce our own constants, based on the glibc ones.]]
573 #define VKI_SEEK_SET 0
574 #define VKI_SEEK_CUR 1
575 #define VKI_SEEK_END 2
577 //----------------------------------------------------------------------
578 // From linux-2.6.8.1/include/linux/net.h
579 //----------------------------------------------------------------------
581 #define VKI_SYS_SOCKET 1 /* sys_socket(2) */
582 #define VKI_SYS_BIND 2 /* sys_bind(2) */
583 #define VKI_SYS_CONNECT 3 /* sys_connect(2) */
584 #define VKI_SYS_LISTEN 4 /* sys_listen(2) */
585 #define VKI_SYS_ACCEPT 5 /* sys_accept(2) */
586 #define VKI_SYS_GETSOCKNAME 6 /* sys_getsockname(2) */
587 #define VKI_SYS_GETPEERNAME 7 /* sys_getpeername(2) */
588 #define VKI_SYS_SOCKETPAIR 8 /* sys_socketpair(2) */
589 #define VKI_SYS_SEND 9 /* sys_send(2) */
590 #define VKI_SYS_RECV 10 /* sys_recv(2) */
591 #define VKI_SYS_SENDTO 11 /* sys_sendto(2) */
592 #define VKI_SYS_RECVFROM 12 /* sys_recvfrom(2) */
593 #define VKI_SYS_SHUTDOWN 13 /* sys_shutdown(2) */
594 #define VKI_SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */
595 #define VKI_SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */
596 #define VKI_SYS_SENDMSG 16 /* sys_sendmsg(2) */
597 #define VKI_SYS_RECVMSG 17 /* sys_recvmsg(2) */
598 #define VKI_SYS_ACCEPT4 18 /* sys_accept4(2) */
599 #define VKI_SYS_RECVMMSG 19 /* sys_recvmmsg(2) */
600 #define VKI_SYS_SENDMMSG 20 /* sys_sendmmsg(2) */
602 #ifndef ARCH_HAS_SOCKET_TYPES
603 enum vki_sock_type {
604 VKI_SOCK_STREAM = 1,
605 // [[others omitted]]
607 #endif /* ARCH_HAS_SOCKET_TYPES */
609 //----------------------------------------------------------------------
610 // From linux-2.6.8.1/include/linux/uio.h
611 //----------------------------------------------------------------------
613 struct vki_iovec
615 void __user *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */
616 __vki_kernel_size_t iov_len; /* Must be size_t (1003.1g) */
619 //----------------------------------------------------------------------
620 // From linux-2.6.8.1/include/linux/socket.h
621 //----------------------------------------------------------------------
623 // [[Resolved arbitrarily; doesn't really matter whether it's '__inline__'
624 // or 'inline']]
625 #define __KINLINE static __inline__
627 typedef unsigned short vki_sa_family_t;
629 struct vki_sockaddr {
630 vki_sa_family_t sa_family; /* address family, AF_xxx */
631 char sa_data[14]; /* 14 bytes of protocol address */
634 struct vki_msghdr {
635 void * msg_name; /* Socket name */
636 int msg_namelen; /* Length of name */
637 struct vki_iovec * msg_iov; /* Data blocks */
638 __vki_kernel_size_t msg_iovlen; /* Number of blocks */
639 void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
640 __vki_kernel_size_t msg_controllen; /* Length of cmsg list */
641 unsigned msg_flags;
644 struct vki_mmsghdr {
645 struct vki_msghdr msg_hdr;
646 unsigned msg_len;
649 struct vki_cmsghdr {
650 __vki_kernel_size_t cmsg_len; /* data byte count, including hdr */
651 int cmsg_level; /* originating protocol */
652 int cmsg_type; /* protocol-specific type */
655 #define __VKI_CMSG_NXTHDR(ctl, len, cmsg) __vki_cmsg_nxthdr((ctl),(len),(cmsg))
656 #define VKI_CMSG_NXTHDR(mhdr, cmsg) vki_cmsg_nxthdr((mhdr), (cmsg))
658 #define VKI_CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) )
660 #define VKI_CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + VKI_CMSG_ALIGN(sizeof(struct vki_cmsghdr))))
662 #define __VKI_CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct vki_cmsghdr) ? \
663 (struct vki_cmsghdr *)(ctl) : \
664 (struct vki_cmsghdr *)NULL)
665 #define VKI_CMSG_FIRSTHDR(msg) __VKI_CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen)
667 // [[Urgh, this is revolting...]
668 __KINLINE struct vki_cmsghdr * __vki_cmsg_nxthdr(void *__ctl, __vki_kernel_size_t __size,
669 struct vki_cmsghdr *__cmsg)
671 struct vki_cmsghdr * __ptr;
673 __ptr = ASSUME_ALIGNED(struct vki_cmsghdr *,
674 ((unsigned char *) __cmsg) + VKI_CMSG_ALIGN(__cmsg->cmsg_len));
675 if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size)
676 return (struct vki_cmsghdr *)0;
678 return __ptr;
681 __KINLINE struct vki_cmsghdr * vki_cmsg_nxthdr (struct vki_msghdr *__msg, struct vki_cmsghdr *__cmsg)
683 return __vki_cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
686 #define VKI_SCM_RIGHTS 0x01 /* rw: access rights (array of int) */
688 #define VKI_AF_UNSPEC 0
689 #define VKI_AF_UNIX 1 /* Unix domain sockets */
690 #define VKI_AF_INET 2 /* Internet IP Protocol */
691 #define VKI_AF_INET6 10 /* IP version 6 */
692 #define VKI_AF_NETLINK 16
693 #define VKI_AF_BLUETOOTH 31 /* Bluetooth sockets */
695 #define VKI_MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */
697 #define VKI_SOL_SCTP 132
699 //----------------------------------------------------------------------
700 // From linux-2.6.8.1/include/linux/in.h
701 //----------------------------------------------------------------------
703 struct vki_in_addr {
704 __vki_u32 s_addr;
707 /* Structure describing an Internet (IP) socket address. */
708 #define __VKI_SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
709 struct vki_sockaddr_in {
710 vki_sa_family_t sin_family; /* Address family */
711 unsigned short int sin_port; /* Port number */
712 struct vki_in_addr sin_addr; /* Internet address */
714 /* Pad to size of `struct sockaddr'. */
715 unsigned char __pad[__VKI_SOCK_SIZE__ - sizeof(short int) -
716 sizeof(unsigned short int) - sizeof(struct vki_in_addr)];
719 #define VKI_IPPROTO_TCP 6 /* Transmission Control Protocol */
721 //----------------------------------------------------------------------
722 // From linux-2.6.8.1/include/linux/in6.h
723 //----------------------------------------------------------------------
725 struct vki_in6_addr
727 union
729 __vki_u8 u6_addr8[16];
730 __vki_u16 u6_addr16[8];
731 __vki_u32 u6_addr32[4];
732 } vki_in6_u;
733 #define vki_s6_addr vki_in6_u.u6_addr8
734 #define vki_s6_addr16 vki_in6_u.u6_addr16
735 #define vki_s6_addr32 vki_in6_u.u6_addr32
738 struct vki_sockaddr_in6 {
739 unsigned short int sin6_family; /* AF_INET6 */
740 __vki_u16 sin6_port; /* Transport layer port # */
741 __vki_u32 sin6_flowinfo; /* IPv6 flow information */
742 struct vki_in6_addr sin6_addr; /* IPv6 address */
743 __vki_u32 sin6_scope_id; /* scope id (new in RFC2553) */
746 //----------------------------------------------------------------------
747 // From linux-2.6.8.1/include/linux/tcp.h
748 //----------------------------------------------------------------------
750 #define VKI_TCP_NODELAY 1 /* Turn off Nagle's algorithm. */
753 //----------------------------------------------------------------------
754 // From linux-2.6.8.1/include/linux/un.h
755 //----------------------------------------------------------------------
757 #define VKI_UNIX_PATH_MAX 108
759 struct vki_sockaddr_un {
760 vki_sa_family_t sun_family; /* AF_UNIX */
761 char sun_path[VKI_UNIX_PATH_MAX]; /* pathname */
764 //----------------------------------------------------------------------
765 // From linux-3.15.8/include/uapi/linux/netlink.h
766 //----------------------------------------------------------------------
768 struct vki_sockaddr_nl {
769 vki_sa_family_t nl_family; /* AF_NETLINK */
770 unsigned short nl_pad; /* zero */
771 __vki_u32 nl_pid; /* port ID */
772 __vki_u32 nl_groups; /* multicast groups mask */
775 //----------------------------------------------------------------------
776 // From linux-2.6.8.1/include/linux/if.h
777 //----------------------------------------------------------------------
779 #define VKI_IFNAMSIZ 16
781 struct vki_ifmap
783 unsigned long mem_start;
784 unsigned long mem_end;
785 unsigned short base_addr;
786 unsigned char irq;
787 unsigned char dma;
788 unsigned char port;
789 /* 3 bytes spare */
792 struct vki_if_settings
794 unsigned int type; /* Type of physical device or protocol */
795 unsigned int size; /* Size of the data allocated by the caller */
796 union {
797 // [[Nb: converted these all to void* to avoid pulling in
798 // unnecessary headers]]]
799 /* {atm/eth/dsl}_settings anyone ? */
800 void /*raw_hdlc_proto */__user *raw_hdlc;
801 void /*cisco_proto */__user *cisco;
802 void /*fr_proto */__user *fr;
803 void /*fr_proto_pvc */__user *fr_pvc;
804 void /*fr_proto_pvc_info */__user *fr_pvc_info;
806 /* interface settings */
807 void /*sync_serial_settings */__user *sync;
808 void /*te1_settings */__user *te1;
809 } ifs_ifsu;
812 struct vki_ifreq
814 #define VKI_IFHWADDRLEN 6
815 union
817 char ifrn_name[VKI_IFNAMSIZ]; /* if name, e.g. "en0" */
818 } ifr_ifrn;
820 union {
821 struct vki_sockaddr ifru_addr;
822 struct vki_sockaddr ifru_dstaddr;
823 struct vki_sockaddr ifru_broadaddr;
824 struct vki_sockaddr ifru_netmask;
825 struct vki_sockaddr ifru_hwaddr;
826 short ifru_flags;
827 int ifru_ivalue;
828 int ifru_mtu;
829 struct vki_ifmap ifru_map;
830 char ifru_slave[VKI_IFNAMSIZ]; /* Just fits the size */
831 char ifru_newname[VKI_IFNAMSIZ];
832 void __user * ifru_data;
833 struct vki_if_settings ifru_settings;
834 } ifr_ifru;
837 #define vki_ifr_name ifr_ifrn.ifrn_name /* interface name */
838 #define vki_ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
839 #define vki_ifr_addr ifr_ifru.ifru_addr /* address */
840 #define vki_ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */
841 #define vki_ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
842 #define vki_ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */
843 #define vki_ifr_flags ifr_ifru.ifru_flags /* flags */
844 #define vki_ifr_metric ifr_ifru.ifru_ivalue /* metric */
845 #define vki_ifr_mtu ifr_ifru.ifru_mtu /* mtu */
846 #define vki_ifr_map ifr_ifru.ifru_map /* device map */
847 #define vki_ifr_slave ifr_ifru.ifru_slave /* slave device */
848 #define vki_ifr_data ifr_ifru.ifru_data /* for use by interface */
849 #define vki_ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */
850 #define vki_ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */
851 #define vki_ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */
852 #define vki_ifr_newname ifr_ifru.ifru_newname /* New name */
853 #define vki_ifr_settings ifr_ifru.ifru_settings /* Device/proto settings*/
855 struct vki_ifconf
857 int ifc_len; /* size of buffer */
858 union
860 char __user *ifcu_buf;
861 struct vki_ifreq __user *ifcu_req;
862 } ifc_ifcu;
864 #define vki_ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
866 //----------------------------------------------------------------------
867 // From linux-2.6.8.1/include/linux/if_arp.h
868 //----------------------------------------------------------------------
870 struct vki_arpreq {
871 struct vki_sockaddr arp_pa; /* protocol address */
872 struct vki_sockaddr arp_ha; /* hardware address */
873 int arp_flags; /* flags */
874 struct vki_sockaddr arp_netmask; /* netmask (only for proxy arps) */
875 char arp_dev[16];
878 //----------------------------------------------------------------------
879 // From linux-2.6.8.1/include/linux/route.h
880 //----------------------------------------------------------------------
882 struct vki_rtentry
884 unsigned long rt_pad1;
885 struct vki_sockaddr rt_dst; /* target address */
886 struct vki_sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */
887 struct vki_sockaddr rt_genmask; /* target network mask (IP) */
888 unsigned short rt_flags;
889 short rt_pad2;
890 unsigned long rt_pad3;
891 void *rt_pad4;
892 short rt_metric; /* +1 for binary compatibility! */
893 char __user *rt_dev; /* forcing the device at add */
894 unsigned long rt_mtu; /* per route MTU/Window */
895 // [[Not important for Valgrind]]
896 //#ifndef __KERNEL__
897 //#define rt_mss rt_mtu /* Compatibility :-( */
898 //#endif
899 unsigned long rt_window; /* Window clamping */
900 unsigned short rt_irtt; /* Initial RTT */
903 //----------------------------------------------------------------------
904 // From linux-2.6.13-rc5/include/net/sctp/user.h
905 //----------------------------------------------------------------------
907 typedef __vki_s32 vki_sctp_assoc_t;
909 enum vki_sctp_optname {
910 VKI_SCTP_RTOINFO,
911 #define VKI_SCTP_RTOINFO VKI_SCTP_RTOINFO
912 VKI_SCTP_ASSOCINFO,
913 #define VKI_SCTP_ASSOCINFO VKI_SCTP_ASSOCINFO
914 VKI_SCTP_INITMSG,
915 #define VKI_SCTP_INITMSG VKI_SCTP_INITMSG
916 VKI_SCTP_NODELAY, /* Get/set nodelay option. */
917 #define VKI_SCTP_NODELAY VKI_SCTP_NODELAY
918 VKI_SCTP_AUTOCLOSE,
919 #define VKI_SCTP_AUTOCLOSE VKI_SCTP_AUTOCLOSE
920 VKI_SCTP_SET_PEER_PRIMARY_ADDR,
921 #define VKI_SCTP_SET_PEER_PRIMARY_ADDR VKI_SCTP_SET_PEER_PRIMARY_ADDR
922 VKI_SCTP_PRIMARY_ADDR,
923 #define VKI_SCTP_PRIMARY_ADDR VKI_SCTP_PRIMARY_ADDR
924 VKI_SCTP_ADAPTION_LAYER,
925 #define VKI_SCTP_ADAPTION_LAYER VKI_SCTP_ADAPTION_LAYER
926 VKI_SCTP_DISABLE_FRAGMENTS,
927 #define VKI_SCTP_DISABLE_FRAGMENTS VKI_SCTP_DISABLE_FRAGMENTS
928 VKI_SCTP_PEER_ADDR_PARAMS,
929 #define VKI_SCTP_PEER_ADDR_PARAMS VKI_SCTP_PEER_ADDR_PARAMS
930 VKI_SCTP_DEFAULT_SEND_PARAM,
931 #define VKI_SCTP_DEFAULT_SEND_PARAM VKI_SCTP_DEFAULT_SEND_PARAM
932 VKI_SCTP_EVENTS,
933 #define VKI_SCTP_EVENTS VKI_SCTP_EVENTS
934 VKI_SCTP_I_WANT_MAPPED_V4_ADDR, /* Turn on/off mapped v4 addresses */
935 #define VKI_SCTP_I_WANT_MAPPED_V4_ADDR VKI_SCTP_I_WANT_MAPPED_V4_ADDR
936 VKI_SCTP_MAXSEG, /* Get/set maximum fragment. */
937 #define VKI_SCTP_MAXSEG VKI_SCTP_MAXSEG
938 VKI_SCTP_STATUS,
939 #define VKI_SCTP_STATUS VKI_SCTP_STATUS
940 VKI_SCTP_GET_PEER_ADDR_INFO,
941 #define VKI_SCTP_GET_PEER_ADDR_INFO VKI_SCTP_GET_PEER_ADDR_INFO
943 /* Internal Socket Options. Some of the sctp library functions are
944 * implemented using these socket options.
946 VKI_SCTP_SOCKOPT_BINDX_ADD = 100,/* BINDX requests for adding addresses. */
947 #define VKI_SCTP_SOCKOPT_BINDX_ADD VKI_SCTP_SOCKOPT_BINDX_ADD
948 VKI_SCTP_SOCKOPT_BINDX_REM, /* BINDX requests for removing addresses. */
949 #define VKI_SCTP_SOCKOPT_BINDX_REM VKI_SCTP_SOCKOPT_BINDX_REM
950 VKI_SCTP_SOCKOPT_PEELOFF, /* peel off association. */
951 #define VKI_SCTP_SOCKOPT_PEELOFF VKI_SCTP_SOCKOPT_PEELOFF
952 VKI_SCTP_GET_PEER_ADDRS_NUM, /* Get number of peer addresss. */
953 #define VKI_SCTP_GET_PEER_ADDRS_NUM VKI_SCTP_GET_PEER_ADDRS_NUM
954 VKI_SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */
955 #define VKI_SCTP_GET_PEER_ADDRS VKI_SCTP_GET_PEER_ADDRS
956 VKI_SCTP_GET_LOCAL_ADDRS_NUM, /* Get number of local addresss. */
957 #define VKI_SCTP_GET_LOCAL_ADDRS_NUM VKI_SCTP_GET_LOCAL_ADDRS_NUM
958 VKI_SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */
959 #define VKI_SCTP_GET_LOCAL_ADDRS VKI_SCTP_GET_LOCAL_ADDRS
960 VKI_SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */
961 #define VKI_SCTP_SOCKOPT_CONNECTX VKI_SCTP_SOCKOPT_CONNECTX
964 struct vki_sctp_getaddrs {
965 vki_sctp_assoc_t assoc_id;
966 int addr_num;
967 struct vki_sockaddr *addrs;
970 //----------------------------------------------------------------------
971 // From linux-2.6.8.1/include/linux/resource.h
972 //----------------------------------------------------------------------
974 #define VKI_RUSAGE_SELF 0
975 #define VKI_RUSAGE_CHILDREN (-1)
976 #define VKI_RUSAGE_BOTH (-2) /* sys_wait4() uses this */
977 #define VKI_RUSAGE_THREAD 1 /* only the calling thread */
979 struct vki_rusage {
980 struct vki_timeval ru_utime; /* user time used */
981 struct vki_timeval ru_stime; /* system time used */
982 long ru_maxrss; /* maximum resident set size */
983 long ru_ixrss; /* integral shared memory size */
984 long ru_idrss; /* integral unshared data size */
985 long ru_isrss; /* integral unshared stack size */
986 long ru_minflt; /* page reclaims */
987 long ru_majflt; /* page faults */
988 long ru_nswap; /* swaps */
989 long ru_inblock; /* block input operations */
990 long ru_oublock; /* block output operations */
991 long ru_msgsnd; /* messages sent */
992 long ru_msgrcv; /* messages received */
993 long ru_nsignals; /* signals received */
994 long ru_nvcsw; /* voluntary context switches */
995 long ru_nivcsw; /* involuntary " */
998 struct vki_rlimit {
999 unsigned long rlim_cur;
1000 unsigned long rlim_max;
1003 struct vki_rlimit64 {
1004 __vki_u64 rlim_cur;
1005 __vki_u64 rlim_max;
1008 //----------------------------------------------------------------------
1009 // From linux-2.6.8.1/include/linux/elfcore.h
1010 //----------------------------------------------------------------------
1012 struct vki_elf_siginfo
1014 int si_signo; /* signal number */
1015 int si_code; /* extra code */
1016 int si_errno; /* errno */
1019 // [[Removed some commented out lines here]]
1020 struct vki_elf_prstatus
1022 struct vki_elf_siginfo pr_info; /* Info associated with signal */
1023 short pr_cursig; /* Current signal */
1024 unsigned long pr_sigpend; /* Set of pending signals */
1025 unsigned long pr_sighold; /* Set of held signals */
1026 vki_pid_t pr_pid;
1027 vki_pid_t pr_ppid;
1028 vki_pid_t pr_pgrp;
1029 vki_pid_t pr_sid;
1030 struct vki_timeval pr_utime; /* User time */
1031 struct vki_timeval pr_stime; /* System time */
1032 struct vki_timeval pr_cutime; /* Cumulative user time */
1033 struct vki_timeval pr_cstime; /* Cumulative system time */
1034 vki_elf_gregset_t pr_reg; /* GP registers */
1035 int pr_fpvalid; /* True if math co-processor being used. */
1038 #define VKI_ELF_PRARGSZ (80) /* Number of chars for args */
1040 struct vki_elf_prpsinfo
1042 char pr_state; /* numeric process state */
1043 char pr_sname; /* char for pr_state */
1044 char pr_zomb; /* zombie */
1045 char pr_nice; /* nice val */
1046 unsigned long pr_flag; /* flags */
1047 __vki_kernel_uid_t pr_uid;
1048 __vki_kernel_gid_t pr_gid;
1049 vki_pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
1050 /* Lots missing */
1051 char pr_fname[16]; /* filename of executable */
1052 char pr_psargs[VKI_ELF_PRARGSZ]; /* initial part of arg list */
1055 //----------------------------------------------------------------------
1056 // From linux-2.6.12.1/include/linux/eventpoll.h
1057 //----------------------------------------------------------------------
1059 /* Valid opcodes to issue to sys_epoll_ctl() */
1060 #define VKI_EPOLL_CTL_ADD 1
1061 #define VKI_EPOLL_CTL_DEL 2
1062 #define VKI_EPOLL_CTL_MOD 3
1064 #ifdef __x86_64__
1065 #define VKI_EPOLL_PACKED __attribute__((packed))
1066 #else
1067 #define VKI_EPOLL_PACKED
1068 #endif
1070 struct vki_epoll_event {
1071 __vki_u32 events;
1072 __vki_u64 data;
1073 } VKI_EPOLL_PACKED;
1076 //----------------------------------------------------------------------
1077 // From linux-2.6.8.1/include/linux/mqueue.h
1078 //----------------------------------------------------------------------
1080 struct vki_mq_attr {
1081 long mq_flags; /* message queue flags */
1082 long mq_maxmsg; /* maximum number of messages */
1083 long mq_msgsize; /* maximum message size */
1084 long mq_curmsgs; /* number of messages currently queued */
1085 long __reserved[4]; /* ignored for input, zeroed for output */
1088 //----------------------------------------------------------------------
1089 // From linux-2.6.8.1/include/linux/utsname.h
1090 //----------------------------------------------------------------------
1092 struct vki_new_utsname {
1093 char sysname[65];
1094 char nodename[65];
1095 char release[65];
1096 char version[65];
1097 char machine[65];
1098 char domainname[65];
1101 //----------------------------------------------------------------------
1102 // From linux-2.6.8.1/include/linux/mii.h
1103 //----------------------------------------------------------------------
1105 /* This structure is used in all SIOCxMIIxxx ioctl calls */
1106 struct vki_mii_ioctl_data {
1107 vki_u16 phy_id;
1108 vki_u16 reg_num;
1109 vki_u16 val_in;
1110 vki_u16 val_out;
1113 //----------------------------------------------------------------------
1114 // From linux-2.6.8.1/include/linux/capability.h
1115 //----------------------------------------------------------------------
1117 // [[capget()/capset() man page says this, ominously:
1119 // The kernel API is likely to change and use of these functions (in
1120 // particular the format of the cap_user_*_t types) is subject to
1121 // change with each kernel revision.
1123 // However, the format hasn't changed since at least Linux 2.4.6.]]
1125 typedef struct __vki_user_cap_header_struct {
1126 __vki_u32 version;
1127 int pid;
1128 } __user *vki_cap_user_header_t;
1130 typedef struct __vki_user_cap_data_struct {
1131 __vki_u32 effective;
1132 __vki_u32 permitted;
1133 __vki_u32 inheritable;
1134 } __user *vki_cap_user_data_t;
1137 //----------------------------------------------------------------------
1138 // From linux-2.6.8.1/include/linux/module.h
1139 //----------------------------------------------------------------------
1141 // [[We do a VKI_SIZEOF_* here because this type is so big, and its size
1142 // depends on the word size, so see vki_arch.h]]
1144 //----------------------------------------------------------------------
1145 // From linux-2.6.8.1/include/linux/ipc.h
1146 //----------------------------------------------------------------------
1148 /* Obsolete, used only for backwards compatibility and libc5 compiles */
1149 struct vki_ipc_perm
1151 __vki_kernel_key_t key;
1152 __vki_kernel_uid_t uid;
1153 __vki_kernel_gid_t gid;
1154 __vki_kernel_uid_t cuid;
1155 __vki_kernel_gid_t cgid;
1156 __vki_kernel_mode_t mode;
1157 unsigned short seq;
1160 #define VKI_IPC_CREAT 00001000 /* create if key is nonexistent */
1161 #define VKI_IPC_EXCL 00002000 /* fail if key exists */
1162 #define VKI_IPC_NOWAIT 00004000 /* return error on wait */
1164 //#define VKI_IPC_RMID 0 /* remove resource */
1165 #define VKI_IPC_SET 1 /* set ipc_perm options */
1166 #define VKI_IPC_STAT 2 /* get ipc_perm options */
1167 #define VKI_IPC_INFO 3 /* see ipcs */
1169 #define VKI_IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger
1170 message sizes, etc. */
1171 // From /usr/include/bits/shm.h
1172 # define VKI_SHM_HUGETLB 04000
1175 //----------------------------------------------------------------------
1176 // From linux-2.6.8.1/include/linux/sem.h
1177 //----------------------------------------------------------------------
1179 #define VKI_GETALL 13 /* get all semval's */
1180 #define VKI_SETVAL 16 /* set semval */
1181 #define VKI_SETALL 17 /* set all semval's */
1183 #define VKI_SEM_STAT 18
1184 #define VKI_SEM_INFO 19
1186 /* Obsolete, used only for backwards compatibility and libc5 compiles */
1187 struct vki_semid_ds {
1188 struct vki_ipc_perm sem_perm; /* permissions .. see ipc.h */
1189 __vki_kernel_time_t sem_otime; /* last semop time */
1190 __vki_kernel_time_t sem_ctime; /* last change time */
1191 // [[Use void* to avoid excess header copying]]
1192 void/*struct sem */*sem_base; /* ptr to first semaphore in array */
1193 void/*struct sem_queue */*sem_pending; /* pending operations to be processed */
1194 void/*struct sem_queue */**sem_pending_last; /* last pending operation */
1195 void/*struct sem_undo */*undo; /* undo requests on this array */
1196 unsigned short sem_nsems; /* no. of semaphores in array */
1199 struct vki_sembuf {
1200 unsigned short sem_num; /* semaphore index in array */
1201 short sem_op; /* semaphore operation */
1202 short sem_flg; /* operation flags */
1205 union vki_semun {
1206 int val; /* value for SETVAL */
1207 struct vki_semid_ds __user *buf; /* buffer for IPC_STAT & IPC_SET */
1208 unsigned short __user *array; /* array for GETALL & SETALL */
1209 struct vki_seminfo __user *__buf; /* buffer for IPC_INFO */
1210 void __user *__pad;
1213 struct vki_seminfo {
1214 int semmap;
1215 int semmni;
1216 int semmns;
1217 int semmnu;
1218 int semmsl;
1219 int semopm;
1220 int semume;
1221 int semusz;
1222 int semvmx;
1223 int semaem;
1226 //----------------------------------------------------------------------
1227 // From linux-2.6.8.1/include/asm-generic/errno-base.h
1228 //----------------------------------------------------------------------
1230 #define VKI_EPERM 1 /* Operation not permitted */
1231 #define VKI_ENOENT 2 /* No such file or directory */
1232 #define VKI_ESRCH 3 /* No such process */
1233 #define VKI_EINTR 4 /* Interrupted system call */
1234 #define VKI_EIO 5 /* I/O error */
1235 #define VKI_ENXIO 6 /* No such device or address */
1236 #define VKI_E2BIG 7 /* Argument list too long */
1237 #define VKI_ENOEXEC 8 /* Exec format error */
1238 #define VKI_EBADF 9 /* Bad file number */
1239 #define VKI_ECHILD 10 /* No child processes */
1240 #define VKI_EAGAIN 11 /* Try again */
1241 #define VKI_ENOMEM 12 /* Out of memory */
1242 #define VKI_EACCES 13 /* Permission denied */
1243 #define VKI_EFAULT 14 /* Bad address */
1244 #define VKI_ENOTBLK 15 /* Block device required */
1245 #define VKI_EBUSY 16 /* Device or resource busy */
1246 #define VKI_EEXIST 17 /* File exists */
1247 #define VKI_EXDEV 18 /* Cross-device link */
1248 #define VKI_ENODEV 19 /* No such device */
1249 #define VKI_ENOTDIR 20 /* Not a directory */
1250 #define VKI_EISDIR 21 /* Is a directory */
1251 #define VKI_EINVAL 22 /* Invalid argument */
1252 #define VKI_ENFILE 23 /* File table overflow */
1253 #define VKI_EMFILE 24 /* Too many open files */
1254 #define VKI_ENOTTY 25 /* Not a typewriter */
1255 #define VKI_ETXTBSY 26 /* Text file busy */
1256 #define VKI_EFBIG 27 /* File too large */
1257 #define VKI_ENOSPC 28 /* No space left on device */
1258 #define VKI_ESPIPE 29 /* Illegal seek */
1259 #define VKI_EROFS 30 /* Read-only file system */
1260 #define VKI_EMLINK 31 /* Too many links */
1261 #define VKI_EPIPE 32 /* Broken pipe */
1262 #define VKI_EDOM 33 /* Math argument out of domain of func */
1263 #define VKI_ERANGE 34 /* Math result not representable */
1265 //----------------------------------------------------------------------
1266 // From linux-2.6.8.1/include/asm-generic/errno.h
1267 //----------------------------------------------------------------------
1269 #define VKI_EWOULDBLOCK VKI_EAGAIN
1271 //----------------------------------------------------------------------
1272 // From linux-2.6.8.1/include/linux/wait.h
1273 //----------------------------------------------------------------------
1275 #define VKI_WNOHANG 0x00000001
1277 #define __VKI_WALL 0x40000000 /* Wait on all children, regardless of type */
1278 #define __VKI_WCLONE 0x80000000 /* Wait only on non-SIGCHLD children */
1280 //----------------------------------------------------------------------
1281 // From linux-2.6.8.1/include/linux/mman.h
1282 //----------------------------------------------------------------------
1284 #define VKI_MREMAP_MAYMOVE 1
1285 #define VKI_MREMAP_FIXED 2
1287 //----------------------------------------------------------------------
1288 // From linux-2.6.31-rc4/include/linux/futex.h
1289 //----------------------------------------------------------------------
1291 #define VKI_FUTEX_WAIT (0)
1292 #define VKI_FUTEX_WAKE (1)
1293 #define VKI_FUTEX_FD (2)
1294 #define VKI_FUTEX_REQUEUE (3)
1295 #define VKI_FUTEX_CMP_REQUEUE (4)
1296 #define VKI_FUTEX_WAKE_OP (5)
1297 #define VKI_FUTEX_LOCK_PI (6)
1298 #define VKI_FUTEX_UNLOCK_PI (7)
1299 #define VKI_FUTEX_TRYLOCK_PI (8)
1300 #define VKI_FUTEX_WAIT_BITSET (9)
1301 #define VKI_FUTEX_WAKE_BITSET (10)
1302 #define VKI_FUTEX_WAIT_REQUEUE_PI (11)
1303 #define VKI_FUTEX_CMP_REQUEUE_PI (12)
1304 #define VKI_FUTEX_PRIVATE_FLAG (128)
1305 #define VKI_FUTEX_CLOCK_REALTIME (256)
1307 struct vki_robust_list {
1308 struct vki_robust_list __user *next;
1311 struct vki_robust_list_head {
1313 * The head of the list. Points back to itself if empty:
1315 struct vki_robust_list list;
1318 * This relative offset is set by user-space, it gives the kernel
1319 * the relative position of the futex field to examine. This way
1320 * we keep userspace flexible, to freely shape its data-structure,
1321 * without hardcoding any particular offset into the kernel:
1323 long futex_offset;
1326 * The death of the thread may race with userspace setting
1327 * up a lock's links. So to handle this race, userspace first
1328 * sets this field to the address of the to-be-taken lock,
1329 * then does the lock acquire, and then adds itself to the
1330 * list, and then clears this field. Hence the kernel will
1331 * always have full knowledge of all locks that the thread
1332 * _might_ have taken. We check the owner TID in any case,
1333 * so only truly owned locks will be handled.
1335 struct vki_robust_list __user *list_op_pending;
1338 //----------------------------------------------------------------------
1339 // From linux-2.6.8.1/include/linux/errno.h
1340 //----------------------------------------------------------------------
1342 #define VKI_ERESTARTSYS 512
1344 //----------------------------------------------------------------------
1345 // From linux-2.6.8.1/include/linux/stat.h
1346 //----------------------------------------------------------------------
1348 #define VKI_S_IFMT 00170000
1349 #define VKI_S_IFSOCK 0140000
1350 #define VKI_S_IFLNK 0120000
1351 #define VKI_S_IFREG 0100000
1352 #define VKI_S_IFBLK 0060000
1353 #define VKI_S_IFDIR 0040000
1354 #define VKI_S_IFCHR 0020000
1355 #define VKI_S_IFIFO 0010000
1356 #define VKI_S_ISUID 0004000
1357 #define VKI_S_ISGID 0002000
1358 #define VKI_S_ISVTX 0001000
1360 #define VKI_S_ISLNK(m) (((m) & VKI_S_IFMT) == VKI_S_IFLNK)
1361 #define VKI_S_ISREG(m) (((m) & VKI_S_IFMT) == VKI_S_IFREG)
1362 #define VKI_S_ISDIR(m) (((m) & VKI_S_IFMT) == VKI_S_IFDIR)
1363 #define VKI_S_ISCHR(m) (((m) & VKI_S_IFMT) == VKI_S_IFCHR)
1364 #define VKI_S_ISBLK(m) (((m) & VKI_S_IFMT) == VKI_S_IFBLK)
1365 #define VKI_S_ISFIFO(m) (((m) & VKI_S_IFMT) == VKI_S_IFIFO)
1366 #define VKI_S_ISSOCK(m) (((m) & VKI_S_IFMT) == VKI_S_IFSOCK)
1368 #define VKI_S_IRWXU 00700
1369 #define VKI_S_IRUSR 00400
1370 #define VKI_S_IWUSR 00200
1371 #define VKI_S_IXUSR 00100
1373 #define VKI_S_IRWXG 00070
1374 #define VKI_S_IRGRP 00040
1375 #define VKI_S_IWGRP 00020
1376 #define VKI_S_IXGRP 00010
1378 #define VKI_S_IRWXO 00007
1379 #define VKI_S_IROTH 00004
1380 #define VKI_S_IWOTH 00002
1381 #define VKI_S_IXOTH 00001
1383 //----------------------------------------------------------------------
1384 // From linux-2.6.8.1/include/linux/dirent.h
1385 //----------------------------------------------------------------------
1387 /* This is the old compat structure to use with the old dirent syscall. */
1388 struct vki_dirent {
1389 long d_ino;
1390 __vki_kernel_off_t d_off;
1391 unsigned short d_reclen;
1392 char d_name[256]; /* We must not include limits.h! */
1395 /* This is the new structure to use with the dirent64 syscall. */
1396 struct vki_dirent64 {
1397 __vki_u64 d_ino;
1398 __vki_s64 d_off;
1399 unsigned short d_reclen;
1400 unsigned char d_type;
1401 char d_name[256]; /* Note we hard code a max file length here. */
1404 //----------------------------------------------------------------------
1405 // From linux-2.6.8.1/include/linux/fcntl.h
1406 //----------------------------------------------------------------------
1408 #define VKI_F_SETLEASE (VKI_F_LINUX_SPECIFIC_BASE + 0)
1409 #define VKI_F_GETLEASE (VKI_F_LINUX_SPECIFIC_BASE + 1)
1411 #define VKI_F_CANCELLK (VKI_F_LINUX_SPECIFIC_BASE + 5)
1413 #define VKI_F_DUPFD_CLOEXEC (VKI_F_LINUX_SPECIFIC_BASE + 6)
1415 #define VKI_F_NOTIFY (VKI_F_LINUX_SPECIFIC_BASE + 2)
1417 #define VKI_F_SETPIPE_SZ (VKI_F_LINUX_SPECIFIC_BASE + 7)
1418 #define VKI_F_GETPIPE_SZ (VKI_F_LINUX_SPECIFIC_BASE + 8)
1420 struct vki_flock {
1421 short l_type;
1422 short l_whence;
1423 __vki_kernel_off_t l_start;
1424 __vki_kernel_off_t l_len;
1425 __vki_kernel_pid_t l_pid;
1428 struct vki_flock64 {
1429 short l_type;
1430 short l_whence;
1431 __vki_kernel_loff_t l_start;
1432 __vki_kernel_loff_t l_len;
1433 __vki_kernel_pid_t l_pid;
1436 //----------------------------------------------------------------------
1437 // From linux-2.6.8.1/include/linux/sysctl.h
1438 //----------------------------------------------------------------------
1440 struct __vki_sysctl_args {
1441 int __user *name;
1442 int nlen;
1443 void __user *oldval;
1444 vki_size_t __user *oldlenp;
1445 void __user *newval;
1446 vki_size_t newlen;
1447 unsigned long __unused0[4];
1450 //----------------------------------------------------------------------
1451 // From linux-2.6.8.1/include/linux/aio_abi.h
1452 //----------------------------------------------------------------------
1454 typedef unsigned long vki_aio_context_t;
1456 enum {
1457 VKI_IOCB_CMD_PREAD = 0,
1458 VKI_IOCB_CMD_PWRITE = 1,
1459 VKI_IOCB_CMD_FSYNC = 2,
1460 VKI_IOCB_CMD_FDSYNC = 3,
1461 VKI_IOCB_CMD_PREADV = 7,
1462 VKI_IOCB_CMD_PWRITEV = 8,
1465 /* read() from /dev/aio returns these structures. */
1466 struct vki_io_event {
1467 __vki_u64 data; /* the data field from the iocb */
1468 __vki_u64 obj; /* what iocb this event came from */
1469 // [[Nb: These fields renamed from 'res' and 'res2' because 'res' is
1470 // a macro in vg_syscalls.c!]]
1471 __vki_s64 result; /* result code for this event */
1472 __vki_s64 result2; /* secondary result */
1475 #if defined(VKI_LITTLE_ENDIAN)
1476 # define VKI_PADDED(x,y) x, y
1477 #elif defined(VKI_BIG_ENDIAN)
1478 # define VKI_PADDED(x,y) y, x
1479 #else
1480 #error edit for your odd byteorder.
1481 #endif
1483 struct vki_iocb {
1484 /* these are internal to the kernel/libc. */
1485 __vki_u64 aio_data; /* data to be returned in event's data */
1486 __vki_u32 VKI_PADDED(aio_key, aio_reserved1);
1487 /* the kernel sets aio_key to the req # */
1489 /* common fields */
1490 __vki_u16 aio_lio_opcode; /* see IOCB_CMD_ above */
1491 __vki_s16 aio_reqprio;
1492 __vki_u32 aio_fildes;
1494 __vki_u64 aio_buf;
1495 __vki_u64 aio_nbytes;
1496 __vki_s64 aio_offset;
1498 /* extra parameters */
1499 __vki_u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */
1500 __vki_u64 aio_reserved3;
1501 }; /* 64 bytes */
1503 //----------------------------------------------------------------------
1504 // From linux-2.6.8.1/include/linux/aio.h
1505 //----------------------------------------------------------------------
1507 struct vki_aio_ring {
1508 unsigned id; /* kernel internal index number */
1509 unsigned nr; /* number of io_events */
1510 unsigned head;
1511 unsigned tail;
1513 unsigned magic;
1514 unsigned compat_features;
1515 unsigned incompat_features;
1516 unsigned header_length; /* size of aio_ring */
1518 struct vki_io_event io_events[0];
1519 }; /* 128 bytes + ring size */
1521 //----------------------------------------------------------------------
1522 // From linux-2.6.8.1/include/linux/msg.h
1523 //----------------------------------------------------------------------
1525 #define VKI_MSG_STAT 11
1526 #define VKI_MSG_INFO 12
1528 struct vki_msqid_ds {
1529 struct vki_ipc_perm msg_perm;
1530 struct vki_msg *msg_first; /* first message on queue,unused */
1531 struct vki_msg *msg_last; /* last message in queue,unused */
1532 __vki_kernel_time_t msg_stime; /* last msgsnd time */
1533 __vki_kernel_time_t msg_rtime; /* last msgrcv time */
1534 __vki_kernel_time_t msg_ctime; /* last change time */
1535 unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */
1536 unsigned long msg_lqbytes; /* ditto */
1537 unsigned short msg_cbytes; /* current number of bytes on queue */
1538 unsigned short msg_qnum; /* number of messages in queue */
1539 unsigned short msg_qbytes; /* max number of bytes on queue */
1540 __vki_kernel_ipc_pid_t msg_lspid; /* pid of last msgsnd */
1541 __vki_kernel_ipc_pid_t msg_lrpid; /* last receive pid */
1544 struct vki_msgbuf {
1545 long mtype; /* type of message */
1546 char mtext[1]; /* message text */
1549 struct vki_msginfo {
1550 int msgpool;
1551 int msgmap;
1552 int msgmax;
1553 int msgmnb;
1554 int msgmni;
1555 int msgssz;
1556 int msgtql;
1557 unsigned short msgseg;
1560 //----------------------------------------------------------------------
1561 // From linux-2.6.8.1/include/linux/shm.h
1562 //----------------------------------------------------------------------
1564 struct vki_shmid_ds {
1565 struct vki_ipc_perm shm_perm; /* operation perms */
1566 int shm_segsz; /* size of segment (bytes) */
1567 __vki_kernel_time_t shm_atime; /* last attach time */
1568 __vki_kernel_time_t shm_dtime; /* last detach time */
1569 __vki_kernel_time_t shm_ctime; /* last change time */
1570 __vki_kernel_ipc_pid_t shm_cpid; /* pid of creator */
1571 __vki_kernel_ipc_pid_t shm_lpid; /* pid of last operator */
1572 unsigned short shm_nattch; /* no. of current attaches */
1573 unsigned short shm_unused; /* compatibility */
1574 void *shm_unused2; /* ditto - used by DIPC */
1575 void *shm_unused3; /* unused */
1578 #define VKI_SHM_RDONLY 010000 /* read-only access */
1579 #define VKI_SHM_RND 020000 /* round attach address to SHMLBA boundary */
1581 #define VKI_SHM_STAT 13
1582 #define VKI_SHM_INFO 14
1584 /* Obsolete, used only for backwards compatibility */
1585 struct vki_shminfo {
1586 int shmmax;
1587 int shmmin;
1588 int shmmni;
1589 int shmseg;
1590 int shmall;
1593 struct vki_shm_info {
1594 int used_ids;
1595 unsigned long shm_tot; /* total allocated shm */
1596 unsigned long shm_rss; /* total resident shm */
1597 unsigned long shm_swp; /* total swapped shm */
1598 unsigned long swap_attempts;
1599 unsigned long swap_successes;
1602 //----------------------------------------------------------------------
1603 // From linux-2.6.8.1/include/linux/rtc.h
1604 //----------------------------------------------------------------------
1606 struct vki_rtc_time {
1607 int tm_sec;
1608 int tm_min;
1609 int tm_hour;
1610 int tm_mday;
1611 int tm_mon;
1612 int tm_year;
1613 int tm_wday;
1614 int tm_yday;
1615 int tm_isdst;
1618 #define VKI_RTC_AIE_ON _VKI_IO('p', 0x01) /* Alarm int. enable on */
1619 #define VKI_RTC_AIE_OFF _VKI_IO('p', 0x02) /* ... off */
1620 #define VKI_RTC_UIE_ON _VKI_IO('p', 0x03) /* Update int. enable on*/
1621 #define VKI_RTC_UIE_OFF _VKI_IO('p', 0x04) /* ... off */
1622 #define VKI_RTC_PIE_ON _VKI_IO('p', 0x05) /* Periodic int. enable on*/
1623 #define VKI_RTC_PIE_OFF _VKI_IO('p', 0x06) /* ... off */
1625 #define VKI_RTC_ALM_SET _VKI_IOW('p', 0x07, struct vki_rtc_time) /* Set alarm time */
1626 #define VKI_RTC_ALM_READ _VKI_IOR('p', 0x08, struct vki_rtc_time) /* Read alarm time */
1627 #define VKI_RTC_RD_TIME _VKI_IOR('p', 0x09, struct vki_rtc_time) /* Read RTC time */
1628 //#define RTC_SET_TIME _IOW('p', 0x0a, struct rtc_time) /* Set RTC time */
1629 #define VKI_RTC_IRQP_READ _VKI_IOR('p', 0x0b, unsigned long) /* Read IRQ rate */
1630 #define VKI_RTC_IRQP_SET _VKI_IOW('p', 0x0c, unsigned long) /* Set IRQ rate */
1632 //----------------------------------------------------------------------
1633 // From linux-2.6.8.1/include/linux/isdn.h
1634 //----------------------------------------------------------------------
1636 // [[Nb: Resolved this for the common case where CONFIG_COBALT_MICRO_SERVER
1637 // is not defined]]
1638 #define VKI_ISDN_MAX_CHANNELS 64
1640 #define VKI_IIOCGETCPS _VKI_IO('I',21)
1642 #define VKI_IIOCNETGPN _VKI_IO('I',34)
1644 #define VKI_ISDN_MSNLEN 32
1646 typedef struct {
1647 char name[10];
1648 char phone[VKI_ISDN_MSNLEN];
1649 int outgoing;
1650 } vki_isdn_net_ioctl_phone;
1652 //----------------------------------------------------------------------
1653 // From linux-2.6.8.1/include/linux/sockios.h
1654 //----------------------------------------------------------------------
1656 #define VKI_SIOCOUTQ VKI_TIOCOUTQ
1658 #define VKI_SIOCADDRT 0x890B /* add routing table entry */
1659 #define VKI_SIOCDELRT 0x890C /* delete routing table entry */
1661 #define VKI_SIOCGIFNAME 0x8910 /* get iface name */
1662 #define VKI_SIOCGIFCONF 0x8912 /* get iface list */
1663 #define VKI_SIOCGIFFLAGS 0x8913 /* get flags */
1664 #define VKI_SIOCSIFFLAGS 0x8914 /* set flags */
1665 #define VKI_SIOCGIFADDR 0x8915 /* get PA address */
1666 #define VKI_SIOCSIFADDR 0x8916 /* set PA address */
1667 #define VKI_SIOCGIFDSTADDR 0x8917 /* get remote PA address */
1668 #define VKI_SIOCSIFDSTADDR 0x8918 /* set remote PA address */
1669 #define VKI_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */
1670 #define VKI_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */
1671 #define VKI_SIOCGIFNETMASK 0x891b /* get network PA mask */
1672 #define VKI_SIOCSIFNETMASK 0x891c /* set network PA mask */
1673 #define VKI_SIOCGIFMETRIC 0x891d /* get metric */
1674 #define VKI_SIOCSIFMETRIC 0x891e /* set metric */
1675 #define VKI_SIOCGIFMTU 0x8921 /* get MTU size */
1676 #define VKI_SIOCSIFMTU 0x8922 /* set MTU size */
1677 #define VKI_SIOCSIFHWADDR 0x8924 /* set hardware address */
1678 #define VKI_SIOCGIFHWADDR 0x8927 /* Get hardware address */
1679 #define VKI_SIOCGIFINDEX 0x8933 /* name -> if_index mapping */
1681 #define VKI_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
1682 #define VKI_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
1684 #define VKI_SIOCETHTOOL 0x8946 /* Ethtool interface */
1686 #define VKI_SIOCGMIIPHY 0x8947 /* Get address of MII PHY in use. */
1687 #define VKI_SIOCGMIIREG 0x8948 /* Read MII PHY register. */
1688 #define VKI_SIOCSMIIREG 0x8949 /* Write MII PHY register. */
1690 #define VKI_SIOCDARP 0x8953 /* delete ARP table entry */
1691 #define VKI_SIOCGARP 0x8954 /* get ARP table entry */
1692 #define VKI_SIOCSARP 0x8955 /* set ARP table entry */
1694 #define VKI_SIOCDRARP 0x8960 /* delete RARP table entry */
1695 #define VKI_SIOCGRARP 0x8961 /* get RARP table entry */
1696 #define VKI_SIOCSRARP 0x8962 /* set RARP table entry */
1698 #define VKI_SIOCGIFMAP 0x8970 /* Get device parameters */
1699 #define VKI_SIOCSIFMAP 0x8971 /* Set device parameters */
1701 #define VKI_SIOCSHWTSTAMP 0x89B0 /* Set hardware time stamping */
1703 //----------------------------------------------------------------------
1704 // From linux-2.6.8.1/include/linux/ppdev.h
1705 //----------------------------------------------------------------------
1707 #define VKI_PP_MAJOR 99
1709 #define VKI_PP_IOCTL 'p'
1711 /* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */
1712 #define VKI_PPSETMODE _VKI_IOW(VKI_PP_IOCTL, 0x80, int)
1714 /* Read status */
1715 #define VKI_PPRSTATUS _VKI_IOR(VKI_PP_IOCTL, 0x81, unsigned char)
1716 //#define PPWSTATUS OBSOLETE__IOW(PP_IOCTL, 0x82, unsigned char)
1718 /* Read/write control */
1719 #define VKI_PPRCONTROL _VKI_IOR(VKI_PP_IOCTL, 0x83, unsigned char)
1720 #define VKI_PPWCONTROL _VKI_IOW(VKI_PP_IOCTL, 0x84, unsigned char)
1722 struct vki_ppdev_frob_struct {
1723 unsigned char mask;
1724 unsigned char val;
1726 #define VKI_PPFCONTROL _VKI_IOW(VKI_PP_IOCTL, 0x8e, struct vki_ppdev_frob_struct)
1728 /* Read/write data */
1729 #define VKI_PPRDATA _VKI_IOR(VKI_PP_IOCTL, 0x85, unsigned char)
1730 #define VKI_PPWDATA _VKI_IOW(VKI_PP_IOCTL, 0x86, unsigned char)
1732 /* Claim the port to start using it */
1733 #define VKI_PPCLAIM _VKI_IO(VKI_PP_IOCTL, 0x8b)
1735 /* Release the port when you aren't using it */
1736 #define VKI_PPRELEASE _VKI_IO(VKI_PP_IOCTL, 0x8c)
1738 /* Yield the port (release it if another driver is waiting,
1739 * then reclaim) */
1740 #define VKI_PPYIELD _VKI_IO(VKI_PP_IOCTL, 0x8d)
1742 /* Register device exclusively (must be before PPCLAIM). */
1743 #define VKI_PPEXCL _VKI_IO(VKI_PP_IOCTL, 0x8f)
1745 /* Data line direction: non-zero for input mode. */
1746 #define VKI_PPDATADIR _VKI_IOW(VKI_PP_IOCTL, 0x90, int)
1748 /* Negotiate a particular IEEE 1284 mode. */
1749 #define VKI_PPNEGOT _VKI_IOW(VKI_PP_IOCTL, 0x91, int)
1751 /* Set control lines when an interrupt occurs. */
1752 #define VKI_PPWCTLONIRQ _VKI_IOW(VKI_PP_IOCTL, 0x92, unsigned char)
1754 /* Clear (and return) interrupt count. */
1755 #define VKI_PPCLRIRQ _VKI_IOR(VKI_PP_IOCTL, 0x93, int)
1757 /* Set the IEEE 1284 phase that we're in (e.g. IEEE1284_PH_FWD_IDLE) */
1758 #define VKI_PPSETPHASE _VKI_IOW(VKI_PP_IOCTL, 0x94, int)
1760 /* Set and get port timeout (struct timeval's) */
1761 #define VKI_PPGETTIME _VKI_IOR(VKI_PP_IOCTL, 0x95, struct vki_timeval)
1762 #define VKI_PPSETTIME _VKI_IOW(VKI_PP_IOCTL, 0x96, struct vki_timeval)
1764 #define VKI_PPGETMODES _VKI_IOR(VKI_PP_IOCTL, 0x97, unsigned int)
1766 #define VKI_PPGETMODE _VKI_IOR(VKI_PP_IOCTL, 0x98, int)
1767 #define VKI_PPGETPHASE _VKI_IOR(VKI_PP_IOCTL, 0x99, int)
1769 #define VKI_PPGETFLAGS _VKI_IOR(VKI_PP_IOCTL, 0x9a, int)
1770 #define VKI_PPSETFLAGS _VKI_IOW(VKI_PP_IOCTL, 0x9b, int)
1772 //----------------------------------------------------------------------
1773 // From linux-3.16/include/uapi/linux/fs.h
1774 //----------------------------------------------------------------------
1776 #define VKI_BLKROSET _VKI_IO(0x12,93) /* set device read-only (0 = read-write) */
1777 #define VKI_BLKROGET _VKI_IO(0x12,94) /* get read-only status (0 = read_write) */
1778 #define VKI_BLKRRPART _VKI_IO(0x12,95) /* re-read partition table */
1779 #define VKI_BLKGETSIZE _VKI_IO(0x12,96) /* return device size /512 (long *arg) */
1780 #define VKI_BLKFLSBUF _VKI_IO(0x12,97) /* flush buffer cache */
1781 #define VKI_BLKRASET _VKI_IO(0x12,98) /* set read ahead for block device */
1782 #define VKI_BLKRAGET _VKI_IO(0x12,99) /* get current read ahead setting */
1783 #define VKI_BLKFRASET _VKI_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
1784 #define VKI_BLKFRAGET _VKI_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
1785 #define VKI_BLKSECTSET _VKI_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
1786 #define VKI_BLKSECTGET _VKI_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
1787 #define VKI_BLKSSZGET _VKI_IO(0x12,104)/* get block device sector size */
1788 #define VKI_BLKBSZGET _VKI_IOR(0x12,112,vki_size_t)
1789 #define VKI_BLKBSZSET _VKI_IOW(0x12,113,vki_size_t)
1790 #define VKI_BLKGETSIZE64 _VKI_IOR(0x12,114,vki_size_t) /* return device size in bytes (u64 *arg) */
1791 #define VKI_BLKDISCARD _VKI_IO(0x12,119)
1792 #define VKI_BLKPBSZGET _VKI_IO(0x12,123)
1793 #define VKI_BLKDISCARDZEROES _VKI_IO(0x12,124)
1794 #define VKI_BLKZEROOUT _VKI_IO(0x12,127)
1796 #define VKI_FIBMAP _VKI_IO(0x00,1) /* bmap access */
1797 #define VKI_FIGETBSZ _VKI_IO(0x00,2) /* get the block size used for bmap */
1799 //----------------------------------------------------------------------
1800 // From linux-2.6.8.1/include/scsi/sg.h
1801 //----------------------------------------------------------------------
1803 typedef struct vki_sg_io_hdr
1805 int interface_id; /* [i] 'S' for SCSI generic (required) */
1806 int dxfer_direction; /* [i] data transfer direction */
1807 unsigned char cmd_len; /* [i] SCSI command length ( <= 16 bytes) */
1808 unsigned char mx_sb_len; /* [i] max length to write to sbp */
1809 unsigned short iovec_count; /* [i] 0 implies no scatter gather */
1810 unsigned int dxfer_len; /* [i] byte count of data transfer */
1811 void __user *dxferp; /* [i], [*io] points to data transfer memory
1812 or scatter gather list */
1813 unsigned char __user *cmdp; /* [i], [*i] points to command to perform */
1814 void __user *sbp; /* [i], [*o] points to sense_buffer memory */
1815 unsigned int timeout; /* [i] MAX_UINT->no timeout (unit: millisec) */
1816 unsigned int flags; /* [i] 0 -> default, see SG_FLAG... */
1817 int pack_id; /* [i->o] unused internally (normally) */
1818 void __user * usr_ptr; /* [i->o] unused internally */
1819 unsigned char status; /* [o] scsi status */
1820 unsigned char masked_status;/* [o] shifted, masked scsi status */
1821 unsigned char msg_status; /* [o] messaging level data (optional) */
1822 unsigned char sb_len_wr; /* [o] byte count actually written to sbp */
1823 unsigned short host_status; /* [o] errors from host adapter */
1824 unsigned short driver_status;/* [o] errors from software driver */
1825 int resid; /* [o] dxfer_len - actual_transferred */
1826 unsigned int duration; /* [o] time taken by cmd (unit: millisec) */
1827 unsigned int info; /* [o] auxiliary information */
1828 } vki_sg_io_hdr_t; /* 64 bytes long (on i386) */
1830 #define VKI_SG_DXFER_NONE -1 /* e.g. a SCSI Test Unit Ready command */
1831 #define VKI_SG_DXFER_TO_DEV -2 /* e.g. a SCSI WRITE command */
1832 #define VKI_SG_DXFER_FROM_DEV -3 /* e.g. a SCSI READ command */
1833 #define VKI_SG_DXFER_TO_FROM_DEV -4 /* treated like SG_DXFER_FROM_DEV with the
1834 additional property than during indirect
1835 IO the user buffer is copied into the
1836 kernel buffers before the transfer */
1838 typedef struct vki_sg_scsi_id { /* used by SG_GET_SCSI_ID ioctl() */
1839 int host_no; /* as in "scsi<n>" where 'n' is one of 0, 1, 2 etc */
1840 int channel;
1841 int scsi_id; /* scsi id of target device */
1842 int lun;
1843 int scsi_type; /* TYPE_... defined in scsi/scsi.h */
1844 short h_cmd_per_lun;/* host (adapter) maximum commands per lun */
1845 short d_queue_depth;/* device (or adapter) maximum queue length */
1846 int unused[2]; /* probably find a good use, set 0 for now */
1847 } vki_sg_scsi_id_t; /* 32 bytes long on i386 */
1849 #define VKI_SG_EMULATED_HOST 0x2203 /* true for emulated host adapter (ATAPI) */
1851 #define VKI_SG_SET_RESERVED_SIZE 0x2275 /* request a new reserved buffer size */
1852 #define VKI_SG_GET_RESERVED_SIZE 0x2272 /* actual size of reserved buffer */
1854 #define VKI_SG_GET_SCSI_ID 0x2276 /* Yields fd's bus, chan, dev, lun + type */
1856 #define VKI_SG_GET_SG_TABLESIZE 0x227F /* 0 implies can't do scatter gather */
1858 #define VKI_SG_GET_VERSION_NUM 0x2282 /* Example: version 2.1.34 yields 20134 */
1860 #define VKI_SG_IO 0x2285 /* similar effect as write() followed by read() */
1862 #define VKI_SG_SET_TIMEOUT 0x2201 /* unit: jiffies (10ms on i386) */
1863 #define VKI_SG_GET_TIMEOUT 0x2202 /* yield timeout as _return_ value */
1865 //#define SG_GET_COMMAND_Q 0x2270 /* Yields 0 (queuing off) or 1 (on) */
1866 #define VKI_SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1 */
1868 //----------------------------------------------------------------------
1869 // From linux-2.6.34/include/scsi/scsi.h and scsi/scsi_ioctl.h
1870 //----------------------------------------------------------------------
1872 #define VKI_SCSI_IOCTL_DOORLOCK 0x5380 /* Lock the eject mechanism. */
1873 #define VKI_SCSI_IOCTL_DOORUNLOCK 0x5381 /* Unlock the mechanism. */
1874 #define VKI_SCSI_IOCTL_GET_IDLUN 0x5382
1875 #define VKI_SCSI_IOCTL_GET_BUS_NUMBER 0x5386
1877 struct vki_scsi_idlun {
1878 __vki_u32 dev_id;
1879 __vki_u32 host_unique_id;
1882 //----------------------------------------------------------------------
1883 // From linux-2.6.8.1/include/linux/cdrom.h
1884 //----------------------------------------------------------------------
1886 #define VKI_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */
1887 #define VKI_CDROMREADTOCHDR 0x5305 /* Read TOC header
1888 (struct cdrom_tochdr) */
1889 #define VKI_CDROMREADTOCENTRY 0x5306 /* Read TOC entry
1890 (struct cdrom_tocentry) */
1891 #define VKI_CDROMSTOP 0x5307 /* Stop the cdrom drive */
1892 #define VKI_CDROMSUBCHNL 0x530b /* Read subchannel data
1893 (struct cdrom_subchnl) */
1894 #define VKI_CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes)
1895 (struct cdrom_read) */
1896 #define VKI_CDROMREADMODE1 0x530d /* Read CDROM mode 1 data (2048 Bytes)
1897 (struct cdrom_read) */
1898 #define VKI_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */
1899 #define VKI_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session
1900 address of multi session disks
1901 (struct cdrom_multisession) */
1902 #define VKI_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code"
1903 if available (struct cdrom_mcn) */
1904 #define VKI_CDROMVOLREAD 0x5313 /* Get the drive's volume setting
1905 (struct cdrom_volctrl) */
1906 #define VKI_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes)
1907 (struct cdrom_read) */
1908 #define VKI_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */
1909 #define VKI_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
1910 #define VKI_CDROM_DISC_STATUS 0x5327 /* get CD type information */
1911 #define VKI_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
1913 #define VKI_DVD_READ_STRUCT 0x5390 /* read structure */
1914 #define VKI_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */
1916 struct vki_cdrom_msf0
1918 __vki_u8 minute;
1919 __vki_u8 second;
1920 __vki_u8 frame;
1923 union vki_cdrom_addr
1925 struct vki_cdrom_msf0 msf;
1926 int lba;
1929 struct vki_cdrom_msf
1931 __vki_u8 cdmsf_min0; /* start minute */
1932 __vki_u8 cdmsf_sec0; /* start second */
1933 __vki_u8 cdmsf_frame0; /* start frame */
1934 __vki_u8 cdmsf_min1; /* end minute */
1935 __vki_u8 cdmsf_sec1; /* end second */
1936 __vki_u8 cdmsf_frame1; /* end frame */
1939 struct vki_cdrom_tochdr
1941 __vki_u8 cdth_trk0; /* start track */
1942 __vki_u8 cdth_trk1; /* end track */
1945 struct vki_cdrom_volctrl
1947 __vki_u8 channel0;
1948 __vki_u8 channel1;
1949 __vki_u8 channel2;
1950 __vki_u8 channel3;
1953 struct vki_cdrom_subchnl
1955 __vki_u8 cdsc_format;
1956 __vki_u8 cdsc_audiostatus;
1957 __vki_u8 cdsc_adr: 4;
1958 __vki_u8 cdsc_ctrl: 4;
1959 __vki_u8 cdsc_trk;
1960 __vki_u8 cdsc_ind;
1961 union vki_cdrom_addr cdsc_absaddr;
1962 union vki_cdrom_addr cdsc_reladdr;
1965 struct vki_cdrom_tocentry
1967 __vki_u8 cdte_track;
1968 __vki_u8 cdte_adr :4;
1969 __vki_u8 cdte_ctrl :4;
1970 __vki_u8 cdte_format;
1971 union vki_cdrom_addr cdte_addr;
1972 __vki_u8 cdte_datamode;
1975 struct vki_cdrom_read
1977 int cdread_lba;
1978 char *cdread_bufaddr;
1979 int cdread_buflen;
1982 struct vki_cdrom_read_audio
1984 union vki_cdrom_addr addr; /* frame address */
1985 __vki_u8 addr_format; /* CDROM_LBA or CDROM_MSF */
1986 int nframes; /* number of 2352-byte-frames to read at once */
1987 __vki_u8 __user *buf; /* frame buffer (size: nframes*2352 bytes) */
1990 struct vki_cdrom_multisession
1992 union vki_cdrom_addr addr; /* frame address: start-of-last-session
1993 (not the new "frame 16"!). Only valid
1994 if the "xa_flag" is true. */
1995 __vki_u8 xa_flag; /* 1: "is XA disk" */
1996 __vki_u8 addr_format; /* CDROM_LBA or CDROM_MSF */
1999 struct vki_cdrom_mcn
2001 __vki_u8 medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */
2004 #define VKI_CDROM_PACKET_SIZE 12
2006 struct vki_cdrom_generic_command
2008 unsigned char cmd[VKI_CDROM_PACKET_SIZE];
2009 unsigned char __user *buffer;
2010 unsigned int buflen;
2011 int stat;
2012 // [[replace with void* to reduce inclusion amounts]]
2013 void/*struct vki_request_sense */__user *sense;
2014 unsigned char data_direction;
2015 int quiet;
2016 int timeout;
2017 void __user *reserved[1]; /* unused, actually */
2020 #define VKI_CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */
2021 #define VKI_CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */
2022 #define VKI_CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */
2023 #define VKI_CD_FRAMESIZE_RAW0 (VKI_CD_FRAMESIZE_RAW-VKI_CD_SYNC_SIZE-VKI_CD_HEAD_SIZE) /*2336*/
2024 #define VKI_CD_FRAMESIZE_RAW1 2048 /* bytes per frame, mode 1*/
2026 //----------------------------------------------------------------------
2027 // From linux-2.6.8.1/include/linux/soundcard.h
2028 //----------------------------------------------------------------------
2030 #ifndef _VKI_SIOWR
2031 #if defined(_VKI_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__)))
2032 /* Use already defined ioctl defines if they exist (except with Sun or Sparc) */
2033 #define _VKI_SIO _VKI_IO
2034 #define _VKI_SIOR _VKI_IOR
2035 #define _VKI_SIOW _VKI_IOW
2036 #define _VKI_SIOWR _VKI_IOWR
2037 #else
2038 // [[Valgrind: Install this case if/when necessary]
2039 #error Valgrind: Cannot handle sparc/sun case yet...
2040 # endif /* _IOWR */
2041 #endif /* !_VKI_SIOWR */
2043 #define VKI_SNDCTL_SEQ_CTRLRATE _VKI_SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */
2044 #define VKI_SNDCTL_SEQ_GETOUTCOUNT _VKI_SIOR ('Q', 4, int)
2045 #define VKI_SNDCTL_SEQ_GETINCOUNT _VKI_SIOR ('Q', 5, int)
2046 #define VKI_SNDCTL_SEQ_PERCMODE _VKI_SIOW ('Q', 6, int)
2047 #define VKI_SNDCTL_SEQ_TESTMIDI _VKI_SIOW ('Q', 8, int)
2048 #define VKI_SNDCTL_SEQ_RESETSAMPLES _VKI_SIOW ('Q', 9, int)
2049 #define VKI_SNDCTL_SEQ_NRSYNTHS _VKI_SIOR ('Q',10, int)
2050 #define VKI_SNDCTL_SEQ_NRMIDIS _VKI_SIOR ('Q',11, int)
2051 #define VKI_SNDCTL_SEQ_GETTIME _VKI_SIOR ('Q',19, int)
2053 #define VKI_SNDCTL_TMR_TIMEBASE _VKI_SIOWR('T', 1, int)
2054 #define VKI_SNDCTL_TMR_TEMPO _VKI_SIOWR('T', 5, int)
2055 #define VKI_SNDCTL_TMR_SOURCE _VKI_SIOWR('T', 6, int)
2057 #define VKI_SNDCTL_MIDI_PRETIME _VKI_SIOWR('m', 0, int)
2058 #define VKI_SNDCTL_MIDI_MPUMODE _VKI_SIOWR('m', 1, int)
2060 #define VKI_SNDCTL_DSP_RESET _VKI_SIO ('P', 0)
2061 #define VKI_SNDCTL_DSP_SYNC _VKI_SIO ('P', 1)
2062 #define VKI_SNDCTL_DSP_SPEED _VKI_SIOWR('P', 2, int)
2063 #define VKI_SNDCTL_DSP_STEREO _VKI_SIOWR('P', 3, int)
2064 #define VKI_SNDCTL_DSP_GETBLKSIZE _VKI_SIOWR('P', 4, int)
2065 #define VKI_SNDCTL_DSP_CHANNELS _VKI_SIOWR('P', 6, int)
2066 #define VKI_SOUND_PCM_WRITE_FILTER _VKI_SIOWR('P', 7, int)
2067 #define VKI_SNDCTL_DSP_POST _VKI_SIO ('P', 8)
2068 #define VKI_SNDCTL_DSP_SUBDIVIDE _VKI_SIOWR('P', 9, int)
2069 #define VKI_SNDCTL_DSP_SETFRAGMENT _VKI_SIOWR('P',10, int)
2071 #define VKI_SNDCTL_DSP_GETFMTS _VKI_SIOR ('P',11, int) /* Returns a mask */
2072 #define VKI_SNDCTL_DSP_SETFMT _VKI_SIOWR('P', 5, int) /* Selects ONE fmt */
2074 typedef struct vki_audio_buf_info {
2075 int fragments; /* # of available fragments (partially usend ones not counted) */
2076 int fragstotal; /* Total # of fragments allocated */
2077 int fragsize; /* Size of a fragment in bytes */
2079 int bytes; /* Available space in bytes (includes partially used fragments) */
2080 /* Note! 'bytes' could be more than fragments*fragsize */
2081 } vki_audio_buf_info;
2083 #define VKI_SNDCTL_DSP_GETOSPACE _VKI_SIOR ('P',12, vki_audio_buf_info)
2084 #define VKI_SNDCTL_DSP_GETISPACE _VKI_SIOR ('P',13, vki_audio_buf_info)
2085 #define VKI_SNDCTL_DSP_NONBLOCK _VKI_SIO ('P',14)
2086 #define VKI_SNDCTL_DSP_GETCAPS _VKI_SIOR ('P',15, int)
2088 #define VKI_SNDCTL_DSP_GETTRIGGER _VKI_SIOR ('P',16, int)
2089 #define VKI_SNDCTL_DSP_SETTRIGGER _VKI_SIOW ('P',16, int)
2091 #define VKI_SNDCTL_DSP_SETSYNCRO _VKI_SIO ('P', 21)
2092 #define VKI_SNDCTL_DSP_SETDUPLEX _VKI_SIO ('P', 22)
2093 #define VKI_SNDCTL_DSP_GETODELAY _VKI_SIOR ('P', 23, int)
2095 #define VKI_SNDCTL_DSP_GETCHANNELMASK _VKI_SIOWR('P', 64, int)
2096 #define VKI_SNDCTL_DSP_BIND_CHANNEL _VKI_SIOWR('P', 65, int)
2098 #define VKI_SNDCTL_DSP_SETSPDIF _VKI_SIOW ('P', 66, int)
2099 #define VKI_SNDCTL_DSP_GETSPDIF _VKI_SIOR ('P', 67, int)
2101 #define VKI_SOUND_PCM_READ_RATE _VKI_SIOR ('P', 2, int)
2102 #define VKI_SOUND_PCM_READ_CHANNELS _VKI_SIOR ('P', 6, int)
2103 #define VKI_SOUND_PCM_READ_BITS _VKI_SIOR ('P', 5, int)
2104 #define VKI_SOUND_PCM_READ_FILTER _VKI_SIOR ('P', 7, int)
2107 //----------------------------------------------------------------------
2108 // From linux-2.6.8.1/include/linux/hdreg.h
2109 //----------------------------------------------------------------------
2111 struct vki_hd_geometry {
2112 unsigned char heads;
2113 unsigned char sectors;
2114 unsigned short cylinders;
2115 unsigned long start;
2118 #define VKI_HDIO_GETGEO 0x0301 /* get device geometry */
2119 #define VKI_HDIO_GET_DMA 0x030b /* get use-dma flag */
2120 #define VKI_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
2122 // [[Nb: done like this because the original type is a huge struct that will
2123 // always be the same size.]]
2124 #define VKI_SIZEOF_STRUCT_HD_DRIVEID 512
2126 //----------------------------------------------------------------------
2127 // From linux-2.6.8.1/include/linux/fb.h
2128 //----------------------------------------------------------------------
2130 #define VKI_FBIOGET_VSCREENINFO 0x4600
2131 #define VKI_FBIOPUT_VSCREENINFO 0x4601
2132 #define VKI_FBIOGET_FSCREENINFO 0x4602
2133 #define VKI_FBIOPAN_DISPLAY 0x4606
2135 struct vki_fb_fix_screeninfo {
2136 char id[16]; /* identification string eg "TT Builtin" */
2137 unsigned long smem_start; /* Start of frame buffer mem */
2138 /* (physical address) */
2139 __vki_u32 smem_len; /* Length of frame buffer mem */
2140 __vki_u32 type; /* see FB_TYPE_* */
2141 __vki_u32 type_aux; /* Interleave for interleaved Planes */
2142 __vki_u32 visual; /* see FB_VISUAL_* */
2143 __vki_u16 xpanstep; /* zero if no hardware panning */
2144 __vki_u16 ypanstep; /* zero if no hardware panning */
2145 __vki_u16 ywrapstep; /* zero if no hardware ywrap */
2146 __vki_u32 line_length; /* length of a line in bytes */
2147 unsigned long mmio_start; /* Start of Memory Mapped I/O */
2148 /* (physical address) */
2149 __vki_u32 mmio_len; /* Length of Memory Mapped I/O */
2150 __vki_u32 accel; /* Indicate to driver which */
2151 /* specific chip/card we have */
2152 __vki_u16 reserved[3]; /* Reserved for future compatibility */
2155 struct vki_fb_bitfield {
2156 __vki_u32 offset; /* beginning of bitfield */
2157 __vki_u32 length; /* length of bitfield */
2158 __vki_u32 msb_right; /* != 0 : Most significant bit is */
2159 /* right */
2162 struct vki_fb_var_screeninfo {
2163 __vki_u32 xres; /* visible resolution */
2164 __vki_u32 yres;
2165 __vki_u32 xres_virtual; /* virtual resolution */
2166 __vki_u32 yres_virtual;
2167 __vki_u32 xoffset; /* offset from virtual to visible */
2168 __vki_u32 yoffset; /* resolution */
2170 __vki_u32 bits_per_pixel; /* guess what */
2171 __vki_u32 grayscale; /* != 0 Graylevels instead of colors */
2173 struct vki_fb_bitfield red; /* bitfield in fb mem if true color, */
2174 struct vki_fb_bitfield green; /* else only length is significant */
2175 struct vki_fb_bitfield blue;
2176 struct vki_fb_bitfield transp; /* transparency */
2178 __vki_u32 nonstd; /* != 0 Non standard pixel format */
2180 __vki_u32 activate; /* see FB_ACTIVATE_* */
2182 __vki_u32 height; /* height of picture in mm */
2183 __vki_u32 width; /* width of picture in mm */
2185 __vki_u32 accel_flags; /* (OBSOLETE) see fb_info.flags */
2187 /* Timing: All values in pixclocks, except pixclock (of course) */
2188 __vki_u32 pixclock; /* pixel clock in ps (pico seconds) */
2189 __vki_u32 left_margin; /* time from sync to picture */
2190 __vki_u32 right_margin; /* time from picture to sync */
2191 __vki_u32 upper_margin; /* time from sync to picture */
2192 __vki_u32 lower_margin;
2193 __vki_u32 hsync_len; /* length of horizontal sync */
2194 __vki_u32 vsync_len; /* length of vertical sync */
2195 __vki_u32 sync; /* see FB_SYNC_* */
2196 __vki_u32 vmode; /* see FB_VMODE_* */
2197 __vki_u32 rotate; /* angle we rotate counter clockwise */
2198 __vki_u32 reserved[5]; /* Reserved for future compatibility */
2201 //----------------------------------------------------------------------
2202 // From linux-2.6.9/include/linux/kd.h
2203 //----------------------------------------------------------------------
2205 #define VKI_GIO_FONT 0x4B60 /* gets font in expanded form */
2206 #define VKI_PIO_FONT 0x4B61 /* use font in expanded form */
2208 #define VKI_GIO_FONTX 0x4B6B /* get font using struct consolefontdesc */
2209 #define VKI_PIO_FONTX 0x4B6C /* set font using struct consolefontdesc */
2210 struct vki_consolefontdesc {
2211 unsigned short charcount; /* characters in font (256 or 512) */
2212 unsigned short charheight; /* scan lines per character (1-32) */
2213 char __user *chardata; /* font data in expanded form */
2216 #define VKI_PIO_FONTRESET 0x4B6D /* reset to default font */
2218 #define VKI_GIO_CMAP 0x4B70 /* gets colour palette on VGA+ */
2219 #define VKI_PIO_CMAP 0x4B71 /* sets colour palette on VGA+ */
2221 #define VKI_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */
2222 #define VKI_KDMKTONE 0x4B30 /* generate tone */
2224 #define VKI_KDGETLED 0x4B31 /* return current led state */
2225 #define VKI_KDSETLED 0x4B32 /* set led state [lights, not flags] */
2227 #define VKI_KDGKBTYPE 0x4B33 /* get keyboard type */
2229 #define VKI_KDADDIO 0x4B34 /* add i/o port as valid */
2230 #define VKI_KDDELIO 0x4B35 /* del i/o port as valid */
2231 #define VKI_KDENABIO 0x4B36 /* enable i/o to video board */
2232 #define VKI_KDDISABIO 0x4B37 /* disable i/o to video board */
2234 #define VKI_KDSETMODE 0x4B3A /* set text/graphics mode */
2235 #define VKI_KDGETMODE 0x4B3B /* get current mode */
2237 #define VKI_KDMAPDISP 0x4B3C /* map display into address space */
2238 #define VKI_KDUNMAPDISP 0x4B3D /* unmap display from address space */
2240 #define VKI_E_TABSZ 256
2241 #define VKI_GIO_SCRNMAP 0x4B40 /* get screen mapping from kernel */
2242 #define VKI_PIO_SCRNMAP 0x4B41 /* put screen mapping table in kernel */
2243 #define VKI_GIO_UNISCRNMAP 0x4B69 /* get full Unicode screen mapping */
2244 #define VKI_PIO_UNISCRNMAP 0x4B6A /* set full Unicode screen mapping */
2246 #define VKI_GIO_UNIMAP 0x4B66 /* get unicode-to-font mapping from kernel */
2247 struct vki_unipair {
2248 unsigned short unicode;
2249 unsigned short fontpos;
2251 struct vki_unimapdesc {
2252 unsigned short entry_ct;
2253 struct vki_unipair __user *entries;
2255 #define VKI_PIO_UNIMAP 0x4B67 /* put unicode-to-font mapping in kernel */
2256 #define VKI_PIO_UNIMAPCLR 0x4B68 /* clear table, possibly advise hash algorithm */
2257 struct vki_unimapinit {
2258 unsigned short advised_hashsize; /* 0 if no opinion */
2259 unsigned short advised_hashstep; /* 0 if no opinion */
2260 unsigned short advised_hashlevel; /* 0 if no opinion */
2263 #define VKI_KDGKBMODE 0x4B44 /* gets current keyboard mode */
2264 #define VKI_KDSKBMODE 0x4B45 /* sets current keyboard mode */
2266 #define VKI_KDGKBMETA 0x4B62 /* gets meta key handling mode */
2267 #define VKI_KDSKBMETA 0x4B63 /* sets meta key handling mode */
2269 #define VKI_KDGKBLED 0x4B64 /* get led flags (not lights) */
2270 #define VKI_KDSKBLED 0x4B65 /* set led flags (not lights) */
2272 struct vki_kbentry {
2273 unsigned char kb_table;
2274 unsigned char kb_index;
2275 unsigned short kb_value;
2277 #define VKI_KDGKBENT 0x4B46 /* gets one entry in translation table */
2278 #define VKI_KDSKBENT 0x4B47 /* sets one entry in translation table */
2280 struct vki_kbsentry {
2281 unsigned char kb_func;
2282 unsigned char kb_string[512];
2284 #define VKI_KDGKBSENT 0x4B48 /* gets one function key string entry */
2285 #define VKI_KDSKBSENT 0x4B49 /* sets one function key string entry */
2287 struct vki_kbdiacr {
2288 unsigned char diacr, base, result;
2290 struct vki_kbdiacrs {
2291 unsigned int kb_cnt; /* number of entries in following array */
2292 struct vki_kbdiacr kbdiacr[256]; /* MAX_DIACR from keyboard.h */
2294 #define VKI_KDGKBDIACR 0x4B4A /* read kernel accent table */
2295 #define VKI_KDSKBDIACR 0x4B4B /* write kernel accent table */
2297 struct vki_kbkeycode {
2298 unsigned int scancode, keycode;
2300 #define VKI_KDGETKEYCODE 0x4B4C /* read kernel keycode table entry */
2301 #define VKI_KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */
2303 #define VKI_KDSIGACCEPT 0x4B4E /* accept kbd generated signals */
2305 struct vki_kbd_repeat {
2306 int delay; /* in msec; <= 0: don't change */
2307 int period; /* in msec; <= 0: don't change */
2308 /* earlier this field was misnamed "rate" */
2310 #define VKI_KDKBDREP 0x4B52 /* set keyboard delay/repeat rate;
2311 * actually used values are returned */
2313 #define VKI_KDFONTOP 0x4B72 /* font operations */
2315 struct vki_console_font_op {
2316 unsigned int op; /* operation code KD_FONT_OP_* */
2317 unsigned int flags; /* KD_FONT_FLAG_* */
2318 unsigned int width, height; /* font size */
2319 unsigned int charcount;
2320 unsigned char __user *data; /* font data with height fixed to 32 */
2323 #define VKI_KD_FONT_OP_SET 0 /* Set font */
2324 #define VKI_KD_FONT_OP_GET 1 /* Get font */
2325 #define VKI_KD_FONT_OP_SET_DEFAULT 2 /* Set font to default, data points to name / NULL */
2326 #define VKI_KD_FONT_OP_COPY 3 /* Copy from another console */
2328 //----------------------------------------------------------------------
2329 // From linux-2.6.9/include/linux/kb.h
2330 //----------------------------------------------------------------------
2332 typedef __vki_kernel_uid32_t vki_qid_t; /* Type in which we store ids in memory */
2334 //----------------------------------------------------------------------
2335 // From linux-2.6.20.1/include/linux/ptrace.h
2336 //----------------------------------------------------------------------
2338 #define VKI_PTRACE_TRACEME 0
2339 #define VKI_PTRACE_PEEKTEXT 1
2340 #define VKI_PTRACE_PEEKDATA 2
2341 #define VKI_PTRACE_PEEKUSR 3
2342 #define VKI_PTRACE_POKEUSR 6
2344 #define VKI_PTRACE_DETACH 17
2346 #define VKI_PTRACE_GETEVENTMSG 0x4201
2347 #define VKI_PTRACE_GETSIGINFO 0x4202
2348 #define VKI_PTRACE_SETSIGINFO 0x4203
2349 #define VKI_PTRACE_GETREGSET 0x4204
2350 #define VKI_PTRACE_SETREGSET 0x4205
2352 #define VKI_PT_PTRACED 0x00000001
2354 //----------------------------------------------------------------------
2355 // From linux-2.6.14/include/sound/asound.h
2356 //----------------------------------------------------------------------
2358 enum {
2359 VKI_SNDRV_PCM_IOCTL_HW_FREE = _VKI_IO('A', 0x12),
2360 VKI_SNDRV_PCM_IOCTL_HWSYNC = _VKI_IO('A', 0x22),
2361 VKI_SNDRV_PCM_IOCTL_PREPARE = _VKI_IO('A', 0x40),
2362 VKI_SNDRV_PCM_IOCTL_RESET = _VKI_IO('A', 0x41),
2363 VKI_SNDRV_PCM_IOCTL_START = _VKI_IO('A', 0x42),
2364 VKI_SNDRV_PCM_IOCTL_DROP = _VKI_IO('A', 0x43),
2365 VKI_SNDRV_PCM_IOCTL_DRAIN = _VKI_IO('A', 0x44),
2366 VKI_SNDRV_PCM_IOCTL_PAUSE = _VKI_IOW('A', 0x45, int),
2367 VKI_SNDRV_PCM_IOCTL_RESUME = _VKI_IO('A', 0x47),
2368 VKI_SNDRV_PCM_IOCTL_XRUN = _VKI_IO('A', 0x48),
2369 VKI_SNDRV_PCM_IOCTL_LINK = _VKI_IOW('A', 0x60, int),
2370 VKI_SNDRV_PCM_IOCTL_UNLINK = _VKI_IO('A', 0x61),
2373 enum {
2374 VKI_SNDRV_TIMER_IOCTL_START = _VKI_IO('T', 0xa0),
2375 VKI_SNDRV_TIMER_IOCTL_STOP = _VKI_IO('T', 0xa1),
2376 VKI_SNDRV_TIMER_IOCTL_CONTINUE = _VKI_IO('T', 0xa2),
2377 VKI_SNDRV_TIMER_IOCTL_PAUSE = _VKI_IO('T', 0xa3),
2380 struct vki_snd_ctl_card_info {
2381 int card; /* card number */
2382 int pad; /* reserved for future (was type) */
2383 unsigned char id[16]; /* ID of card (user selectable) */
2384 unsigned char driver[16]; /* Driver name */
2385 unsigned char name[32]; /* Short name of soundcard */
2386 unsigned char longname[80]; /* name + info text about soundcard */
2387 unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */
2388 unsigned char mixername[80]; /* visual mixer identification */
2389 unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */
2392 typedef int vki_snd_ctl_elem_iface_t;
2393 #define VKI_SNDRV_CTL_ELEM_IFACE_CARD ((vki_snd_ctl_elem_iface_t) 0) /* global control */
2394 #define VKI_SNDRV_CTL_ELEM_IFACE_HWDEP ((vki_snd_ctl_elem_iface_t) 1) /* hardware dependent device */
2395 #define VKI_SNDRV_CTL_ELEM_IFACE_MIXER ((vki_snd_ctl_elem_iface_t) 2) /* virtual mixer device */
2396 #define VKI_SNDRV_CTL_ELEM_IFACE_PCM ((vki_snd_ctl_elem_iface_t) 3) /* PCM device */
2397 #define VKI_SNDRV_CTL_ELEM_IFACE_RAWMIDI ((vki_snd_ctl_elem_iface_t) 4) /* RawMidi device */
2398 #define VKI_SNDRV_CTL_ELEM_IFACE_TIMER ((vki_snd_ctl_elem_iface_t) 5) /* timer device */
2399 #define VKI_SNDRV_CTL_ELEM_IFACE_SEQUENCER ((vki_snd_ctl_elem_iface_t) 6) /* sequencer client */
2400 #define VKI_SNDRV_CTL_ELEM_IFACE_LAST VKI_SNDRV_CTL_ELEM_IFACE_SEQUENCER
2402 struct vki_snd_ctl_elem_id {
2403 unsigned int numid; /* numeric identifier, zero = invalid */
2404 vki_snd_ctl_elem_iface_t iface; /* interface identifier */
2405 unsigned int device; /* device/client number */
2406 unsigned int subdevice; /* subdevice (substream) number */
2407 unsigned char name[44]; /* ASCII name of item */
2408 unsigned int index; /* index of item */
2411 struct vki_snd_ctl_elem_list {
2412 unsigned int offset; /* W: first element ID to get */
2413 unsigned int space; /* W: count of element IDs to get */
2414 unsigned int used; /* R: count of element IDs set */
2415 unsigned int count; /* R: count of all elements */
2416 struct vki_snd_ctl_elem_id __user *pids; /* R: IDs */
2417 unsigned char reserved[50];
2420 struct vki_snd_ctl_tlv {
2421 unsigned int numid; /* control element numeric identification */
2422 unsigned int length; /* in bytes aligned to 4 */
2423 unsigned int tlv[0]; /* first TLV */
2426 #define VKI_SNDRV_CTL_IOCTL_PVERSION _VKI_IOR('U', 0x00, int)
2427 #define VKI_SNDRV_CTL_IOCTL_CARD_INFO _VKI_IOR('U', 0x01, struct vki_snd_ctl_card_info)
2428 #define VKI_SNDRV_CTL_IOCTL_ELEM_LIST _VKI_IOWR('U', 0x10, struct vki_snd_ctl_elem_list)
2429 #define VKI_SNDRV_CTL_IOCTL_TLV_READ _VKI_IOWR('U', 0x1a, struct vki_snd_ctl_tlv)
2430 #define VKI_SNDRV_CTL_IOCTL_TLV_WRITE _VKI_IOWR('U', 0x1b, struct vki_snd_ctl_tlv)
2431 #define VKI_SNDRV_CTL_IOCTL_TLV_COMMAND _VKI_IOWR('U', 0x1c, struct vki_snd_ctl_tlv)
2433 //----------------------------------------------------------------------
2434 // From linux-2.6.15.4/include/linux/serial.h
2435 //----------------------------------------------------------------------
2437 struct vki_serial_icounter_struct {
2438 int cts, dsr, rng, dcd;
2439 int rx, tx;
2440 int frame, overrun, parity, brk;
2441 int buf_overrun;
2442 int reserved[9];
2445 //----------------------------------------------------------------------
2446 // From linux-2.6.16/include/linux/vt.h
2447 //----------------------------------------------------------------------
2449 #define VKI_VT_OPENQRY 0x5600 /* find available vt */
2451 struct vki_vt_mode {
2452 char mode; /* vt mode */
2453 char waitv; /* if set, hang on writes if not active */
2454 short relsig; /* signal to raise on release req */
2455 short acqsig; /* signal to raise on acquisition */
2456 short frsig; /* unused (set to 0) */
2458 #define VKI_VT_GETMODE 0x5601 /* get mode of active vt */
2459 #define VKI_VT_SETMODE 0x5602 /* set mode of active vt */
2461 struct vki_vt_stat {
2462 unsigned short v_active; /* active vt */
2463 unsigned short v_signal; /* signal to send */
2464 unsigned short v_state; /* vt bitmask */
2466 #define VKI_VT_GETSTATE 0x5603 /* get global vt state info */
2467 #define VKI_VT_SENDSIG 0x5604 /* signal to send to bitmask of vts */
2469 #define VKI_VT_RELDISP 0x5605 /* release display */
2471 #define VKI_VT_ACTIVATE 0x5606 /* make vt active */
2472 #define VKI_VT_WAITACTIVE 0x5607 /* wait for vt active */
2473 #define VKI_VT_DISALLOCATE 0x5608 /* free memory associated to vt */
2475 struct vki_vt_sizes {
2476 unsigned short v_rows; /* number of rows */
2477 unsigned short v_cols; /* number of columns */
2478 unsigned short v_scrollsize; /* number of lines of scrollback */
2480 #define VKI_VT_RESIZE 0x5609 /* set kernel's idea of screensize */
2482 struct vki_vt_consize {
2483 unsigned short v_rows; /* number of rows */
2484 unsigned short v_cols; /* number of columns */
2485 unsigned short v_vlin; /* number of pixel rows on screen */
2486 unsigned short v_clin; /* number of pixel rows per character */
2487 unsigned short v_vcol; /* number of pixel columns on screen */
2488 unsigned short v_ccol; /* number of pixel columns per character */
2490 #define VKI_VT_RESIZEX 0x560A /* set kernel's idea of screensize + more */
2491 #define VKI_VT_LOCKSWITCH 0x560B /* disallow vt switching */
2492 #define VKI_VT_UNLOCKSWITCH 0x560C /* allow vt switching */
2494 //----------------------------------------------------------------------
2495 // From linux-2.6.19/include/linux/prctl.h
2496 //----------------------------------------------------------------------
2498 #define VKI_PR_SET_PDEATHSIG 1 /* Second arg is a signal */
2499 #define VKI_PR_GET_PDEATHSIG 2 /* Second arg is a ptr to return the signal */
2501 #define VKI_PR_GET_DUMPABLE 3
2502 #define VKI_PR_SET_DUMPABLE 4
2504 #define VKI_PR_GET_UNALIGN 5
2505 #define VKI_PR_SET_UNALIGN 6
2506 # define VKI_PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */
2507 # define VKI_PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */
2509 #define VKI_PR_GET_KEEPCAPS 7
2510 #define VKI_PR_SET_KEEPCAPS 8
2512 #define VKI_PR_GET_FPEMU 9
2513 #define VKI_PR_SET_FPEMU 10
2514 # define VKI_PR_FPEMU_NOPRINT 1 /* silently emulate fp operations accesses */
2515 # define VKI_PR_FPEMU_SIGFPE 2 /* don't emulate fp operations, send SIGFPE instead */
2517 #define VKI_PR_GET_FPEXC 11
2518 #define VKI_PR_SET_FPEXC 12
2519 # define VKI_PR_FP_EXC_SW_ENABLE 0x80 /* Use FPEXC for FP exception enables */
2520 # define VKI_PR_FP_EXC_DIV 0x010000 /* floating point divide by zero */
2521 # define VKI_PR_FP_EXC_OVF 0x020000 /* floating point overflow */
2522 # define VKI_PR_FP_EXC_UND 0x040000 /* floating point underflow */
2523 # define VKI_PR_FP_EXC_RES 0x080000 /* floating point inexact result */
2524 # define VKI_PR_FP_EXC_INV 0x100000 /* floating point invalid operation */
2525 # define VKI_PR_FP_EXC_DISABLED 0 /* FP exceptions disabled */
2526 # define VKI_PR_FP_EXC_NONRECOV 1 /* async non-recoverable exc. mode */
2527 # define VKI_PR_FP_EXC_ASYNC 2 /* async recoverable exception mode */
2528 # define VKI_PR_FP_EXC_PRECISE 3 /* precise exception mode */
2530 #define VKI_PR_GET_TIMING 13
2531 #define VKI_PR_SET_TIMING 14
2532 # define VKI_PR_TIMING_STATISTICAL 0 /* Normal, traditional,
2533 statistical process timing */
2534 # define VKI_PR_TIMING_TIMESTAMP 1 /* Accurate timestamp based
2535 process timing */
2537 #define VKI_PR_SET_NAME 15 /* Set process name */
2538 #define VKI_PR_GET_NAME 16 /* Get process name */
2540 #define VKI_PR_GET_ENDIAN 19
2541 #define VKI_PR_SET_ENDIAN 20
2542 # define VKI_PR_ENDIAN_BIG 0
2543 # define VKI_PR_ENDIAN_LITTLE 1 /* True little endian mode */
2544 # define VKI_PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */
2546 #define VKI_PR_SET_SECCOMP 22
2548 #define VKI_PR_SET_PTRACER 0x59616d61
2550 //----------------------------------------------------------------------
2551 // From linux-2.6.19/include/linux/usbdevice_fs.h
2552 //----------------------------------------------------------------------
2554 struct vki_usbdevfs_ctrltransfer {
2555 __vki_u8 bRequestType;
2556 __vki_u8 bRequest;
2557 __vki_u16 wValue;
2558 __vki_u16 wIndex;
2559 __vki_u16 wLength;
2560 __vki_u32 timeout; /* in milliseconds */
2561 void __user *data;
2564 struct vki_usbdevfs_bulktransfer {
2565 unsigned int ep;
2566 unsigned int len;
2567 unsigned int timeout; /* in milliseconds */
2568 void __user *data;
2571 #define VKI_USBDEVFS_MAXDRIVERNAME 255
2573 struct vki_usbdevfs_getdriver {
2574 unsigned int interface;
2575 char driver[VKI_USBDEVFS_MAXDRIVERNAME + 1];
2578 struct vki_usbdevfs_connectinfo {
2579 unsigned int devnum;
2580 unsigned char slow;
2583 struct vki_usbdevfs_iso_packet_desc {
2584 unsigned int length;
2585 unsigned int actual_length;
2586 unsigned int status;
2589 struct vki_usbdevfs_urb {
2590 unsigned char type;
2591 unsigned char endpoint;
2592 int status;
2593 unsigned int flags;
2594 void __user *buffer;
2595 int buffer_length;
2596 int actual_length;
2597 int start_frame;
2598 int number_of_packets;
2599 int error_count;
2600 unsigned int signr; /* signal to be sent on error, -1 if none should be sent */
2601 void *usercontext;
2602 struct vki_usbdevfs_iso_packet_desc iso_frame_desc[0];
2605 struct vki_usbdevfs_ioctl {
2606 int ifno; /* interface 0..N ; negative numbers reserved */
2607 int ioctl_code; /* MUST encode size + direction of data so the
2608 * macros in <asm/ioctl.h> give correct values */
2609 void __user *data; /* param buffer (in, or out) */
2612 #define VKI_USBDEVFS_CONTROL _VKI_IOWR('U', 0, struct vki_usbdevfs_ctrltransfer)
2613 #define VKI_USBDEVFS_BULK _VKI_IOWR('U', 2, struct vki_usbdevfs_bulktransfer)
2614 #define VKI_USBDEVFS_GETDRIVER _VKI_IOW('U', 8, struct vki_usbdevfs_getdriver)
2615 #define VKI_USBDEVFS_SUBMITURB _VKI_IOR('U', 10, struct vki_usbdevfs_urb)
2616 #define VKI_USBDEVFS_DISCARDURB _VKI_IO('U', 11)
2617 #define VKI_USBDEVFS_REAPURB _VKI_IOW('U', 12, void *)
2618 #define VKI_USBDEVFS_REAPURBNDELAY _VKI_IOW('U', 13, void *)
2619 #define VKI_USBDEVFS_CONNECTINFO _VKI_IOW('U', 17, struct vki_usbdevfs_connectinfo)
2620 #define VKI_USBDEVFS_IOCTL _VKI_IOWR('U', 18, struct vki_usbdevfs_ioctl)
2621 #define VKI_USBDEVFS_RESET _VKI_IO('U', 20)
2623 #define VKI_USBDEVFS_URB_TYPE_ISO 0
2624 #define VKI_USBDEVFS_URB_TYPE_INTERRUPT 1
2625 #define VKI_USBDEVFS_URB_TYPE_CONTROL 2
2626 #define VKI_USBDEVFS_URB_TYPE_BULK 3
2628 // [[this is missing in usbdevice_fs.h]]
2629 struct vki_usbdevfs_setuppacket {
2630 __vki_u8 bRequestType;
2631 __vki_u8 bRequest;
2632 __vki_u16 wValue;
2633 __vki_u16 wIndex;
2634 __vki_u16 wLength;
2637 //----------------------------------------------------------------------
2638 // From linux-2.6.20.1/include/linux/i2c.h
2639 //----------------------------------------------------------------------
2641 #define VKI_I2C_SMBUS_QUICK 0
2642 #define VKI_I2C_SMBUS_BYTE 1
2643 #define VKI_I2C_SMBUS_BYTE_DATA 2
2644 #define VKI_I2C_SMBUS_WORD_DATA 3
2645 #define VKI_I2C_SMBUS_PROC_CALL 4
2646 #define VKI_I2C_SMBUS_BLOCK_DATA 5
2647 #define VKI_I2C_SMBUS_I2C_BLOCK_BROKEN 6
2648 #define VKI_I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */
2649 #define VKI_I2C_SMBUS_I2C_BLOCK_DATA 8
2651 /* smbus_access read or write markers */
2652 #define VKI_I2C_SMBUS_READ 1
2653 #define VKI_I2C_SMBUS_WRITE 0
2655 #define VKI_I2C_SLAVE 0x0703 /* Change slave address */
2656 /* Attn.: Slave address is 7 or 10 bits */
2657 #define VKI_I2C_SLAVE_FORCE 0x0706 /* Change slave address */
2658 /* Attn.: Slave address is 7 or 10 bits */
2659 /* This changes the address, even if it */
2660 /* is already taken! */
2661 #define VKI_I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
2662 #define VKI_I2C_FUNCS 0x0705 /* Get the adapter functionality */
2663 #define VKI_I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */
2664 #define VKI_I2C_PEC 0x0708 /* != 0 for SMBus PEC */
2665 #define VKI_I2C_SMBUS 0x0720 /* SMBus transfer */
2667 #define VKI_I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */
2668 union vki_i2c_smbus_data {
2669 __vki_u8 byte;
2670 __vki_u16 word;
2671 __vki_u8 block[VKI_I2C_SMBUS_BLOCK_MAX + 2];
2672 /* block[0] is used for length */
2673 /* and one more for PEC */
2676 /* This is the structure as used in the I2C_SMBUS ioctl call */
2677 struct vki_i2c_smbus_ioctl_data {
2678 __vki_u8 read_write;
2679 __vki_u8 command;
2680 __vki_u32 size;
2681 union vki_i2c_smbus_data __user *data;
2684 struct vki_i2c_msg {
2685 __vki_u16 addr; /* slave address */
2686 __vki_u16 flags;
2687 #define VKI_I2C_M_TEN 0x0010 /* this is a ten bit chip address */
2688 #define VKI_I2C_M_RD 0x0001 /* read data, from slave to master */
2689 #define VKI_I2C_M_NOSTART 0x4000 /* if I2C_FUNC_PROTOCOL_MANGLING */
2690 #define VKI_I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */
2691 #define VKI_I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */
2692 #define VKI_I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */
2693 #define VKI_I2C_M_RECV_LEN 0x0400 /* length will be first received byte */
2694 __vki_u16 len; /* msg length */
2695 __vki_u8 *buf; /* pointer to msg data */
2698 struct vki_i2c_rdwr_ioctl_data {
2699 struct vki_i2c_msg *msgs; /* pointers to i2c_msgs */
2700 __vki_u32 nmsgs; /* number of i2c_msgs */
2703 //----------------------------------------------------------------------
2704 // From linux-2.6.20.1/include/linux/keyctl.h
2705 //----------------------------------------------------------------------
2707 /* keyctl commands */
2708 #define VKI_KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */
2709 #define VKI_KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */
2710 #define VKI_KEYCTL_UPDATE 2 /* update a key */
2711 #define VKI_KEYCTL_REVOKE 3 /* revoke a key */
2712 #define VKI_KEYCTL_CHOWN 4 /* set ownership of a key */
2713 #define VKI_KEYCTL_SETPERM 5 /* set perms on a key */
2714 #define VKI_KEYCTL_DESCRIBE 6 /* describe a key */
2715 #define VKI_KEYCTL_CLEAR 7 /* clear contents of a keyring */
2716 #define VKI_KEYCTL_LINK 8 /* link a key into a keyring */
2717 #define VKI_KEYCTL_UNLINK 9 /* unlink a key from a keyring */
2718 #define VKI_KEYCTL_SEARCH 10 /* search for a key in a keyring */
2719 #define VKI_KEYCTL_READ 11 /* read a key or keyring's contents */
2720 #define VKI_KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */
2721 #define VKI_KEYCTL_NEGATE 13 /* negate a partially constructed key */
2722 #define VKI_KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */
2723 #define VKI_KEYCTL_SET_TIMEOUT 15 /* set key timeout */
2724 #define VKI_KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */
2726 /*--------------------------------------------------------------------*/
2727 // From linux-2.6.20.1/include/linux/key.h
2728 /*--------------------------------------------------------------------*/
2730 /* key handle serial number */
2731 typedef vki_int32_t vki_key_serial_t;
2733 /* key handle permissions mask */
2734 typedef vki_uint32_t vki_key_perm_t;
2736 //----------------------------------------------------------------------
2737 // From linux-2.6.24.7/include/linux/wireless.h
2738 // (wireless extensions version 22, 2007-03-16)
2739 //----------------------------------------------------------------------
2742 * [[Wireless extensions ioctls.]]
2745 /* Wireless Identification */
2746 #define VKI_SIOCSIWCOMMIT 0x8B00 /* Commit pending changes to driver */
2747 #define VKI_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */
2749 /* Basic operations */
2750 #define VKI_SIOCSIWNWID 0x8B02 /* set network id (pre-802.11) */
2751 #define VKI_SIOCGIWNWID 0x8B03 /* get network id (the cell) */
2752 #define VKI_SIOCSIWFREQ 0x8B04 /* set channel/frequency (Hz) */
2753 #define VKI_SIOCGIWFREQ 0x8B05 /* get channel/frequency (Hz) */
2754 #define VKI_SIOCSIWMODE 0x8B06 /* set operation mode */
2755 #define VKI_SIOCGIWMODE 0x8B07 /* get operation mode */
2756 #define VKI_SIOCSIWSENS 0x8B08 /* set sensitivity (dBm) */
2757 #define VKI_SIOCGIWSENS 0x8B09 /* get sensitivity (dBm) */
2759 /* Informative stuff */
2760 #define VKI_SIOCSIWRANGE 0x8B0A /* Unused */
2761 #define VKI_SIOCGIWRANGE 0x8B0B /* Get range of parameters */
2762 #define VKI_SIOCSIWPRIV 0x8B0C /* Unused */
2763 #define VKI_SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */
2764 #define VKI_SIOCSIWSTATS 0x8B0E /* Unused */
2765 #define VKI_SIOCGIWSTATS 0x8B0F /* Get /proc/net/wireless stats */
2767 /* Spy support (statistics per MAC address - used for Mobile IP support) */
2768 #define VKI_SIOCSIWSPY 0x8B10 /* set spy addresses */
2769 #define VKI_SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */
2770 #define VKI_SIOCSIWTHRSPY 0x8B12 /* set spy threshold (spy event) */
2771 #define VKI_SIOCGIWTHRSPY 0x8B13 /* get spy threshold */
2773 /* Access Point manipulation */
2774 #define VKI_SIOCSIWAP 0x8B14 /* set access point MAC addresses */
2775 #define VKI_SIOCGIWAP 0x8B15 /* get access point MAC addresses */
2776 #define VKI_SIOCGIWAPLIST 0x8B17 /* Deprecated in favor of scanning */
2777 #define VKI_SIOCSIWSCAN 0x8B18 /* trigger scanning (list cells) */
2778 #define VKI_SIOCGIWSCAN 0x8B19 /* get scanning results */
2780 /* 802.11 specific support */
2781 #define VKI_SIOCSIWESSID 0x8B1A /* set ESSID (network name) */
2782 #define VKI_SIOCGIWESSID 0x8B1B /* get ESSID */
2783 #define VKI_SIOCSIWNICKN 0x8B1C /* set node name/nickname */
2784 #define VKI_SIOCGIWNICKN 0x8B1D /* get node name/nickname */
2786 /* Other parameters useful in 802.11 and some other devices */
2787 #define VKI_SIOCSIWRATE 0x8B20 /* set default bit rate (bps) */
2788 #define VKI_SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */
2789 #define VKI_SIOCSIWRTS 0x8B22 /* set RTS/CTS threshold (bytes) */
2790 #define VKI_SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */
2791 #define VKI_SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */
2792 #define VKI_SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */
2793 #define VKI_SIOCSIWTXPOW 0x8B26 /* set transmit power (dBm) */
2794 #define VKI_SIOCGIWTXPOW 0x8B27 /* get transmit power (dBm) */
2795 #define VKI_SIOCSIWRETRY 0x8B28 /* set retry limits and lifetime */
2796 #define VKI_SIOCGIWRETRY 0x8B29 /* get retry limits and lifetime */
2798 /* Encoding stuff (scrambling, hardware security, WEP...) */
2799 #define VKI_SIOCSIWENCODE 0x8B2A /* set encoding token & mode */
2800 #define VKI_SIOCGIWENCODE 0x8B2B /* get encoding token & mode */
2802 /* Power saving stuff (power management, unicast and multicast) */
2803 #define VKI_SIOCSIWPOWER 0x8B2C /* set Power Management settings */
2804 #define VKI_SIOCGIWPOWER 0x8B2D /* get Power Management settings */
2806 /* WPA : Generic IEEE 802.11 information element (e.g., for WPA/RSN/WMM). */
2807 #define VKI_SIOCSIWGENIE 0x8B30 /* set generic IE */
2808 #define VKI_SIOCGIWGENIE 0x8B31 /* get generic IE */
2810 /* WPA : IEEE 802.11 MLME requests */
2811 #define VKI_SIOCSIWMLME 0x8B16 /* request MLME operation; uses
2812 * struct iw_mlme */
2813 /* WPA : Authentication mode parameters */
2814 #define VKI_SIOCSIWAUTH 0x8B32 /* set authentication mode params */
2815 #define VKI_SIOCGIWAUTH 0x8B33 /* get authentication mode params */
2817 /* WPA : Extended version of encoding configuration */
2818 #define VKI_SIOCSIWENCODEEXT 0x8B34 /* set encoding token & mode */
2819 #define VKI_SIOCGIWENCODEEXT 0x8B35 /* get encoding token & mode */
2821 /* WPA2 : PMKSA cache management */
2822 #define VKI_SIOCSIWPMKSA 0x8B36 /* PMKSA cache operation */
2825 * [[Payload for the wireless extensions ioctls.]]
2828 struct vki_iw_param
2830 __vki_s32 value; /* The value of the parameter itself */
2831 __vki_u8 fixed; /* Hardware should not use auto select */
2832 __vki_u8 disabled; /* Disable the feature */
2833 __vki_u16 flags; /* Various specific flags (if any) */
2836 struct vki_iw_point
2838 void __user *pointer; /* Pointer to the data (in user space) */
2839 __vki_u16 length; /* number of fields or size in bytes */
2840 __vki_u16 flags; /* Optional params */
2843 struct vki_iw_freq
2845 __vki_s32 m; /* Mantissa */
2846 __vki_s16 e; /* Exponent */
2847 __vki_u8 i; /* List index (when in range struct) */
2848 __vki_u8 flags; /* Flags (fixed/auto) */
2851 struct vki_iw_quality
2853 __vki_u8 qual; /* link quality (%retries, SNR,
2854 %missed beacons or better...) */
2855 __vki_u8 level; /* signal level (dBm) */
2856 __vki_u8 noise; /* noise level (dBm) */
2857 __vki_u8 updated; /* Flags to know if updated */
2860 union vki_iwreq_data
2862 /* Config - generic */
2863 char name[VKI_IFNAMSIZ];
2864 /* Name : used to verify the presence of wireless extensions.
2865 * Name of the protocol/provider... */
2867 struct vki_iw_point essid; /* Extended network name */
2868 struct vki_iw_param nwid; /* network id (or domain - the cell) */
2869 struct vki_iw_freq freq; /* frequency or channel :
2870 * 0-1000 = channel
2871 * > 1000 = frequency in Hz */
2873 struct vki_iw_param sens; /* signal level threshold */
2874 struct vki_iw_param bitrate;/* default bit rate */
2875 struct vki_iw_param txpower;/* default transmit power */
2876 struct vki_iw_param rts; /* RTS threshold threshold */
2877 struct vki_iw_param frag; /* Fragmentation threshold */
2878 __vki_u32 mode; /* Operation mode */
2879 struct vki_iw_param retry; /* Retry limits & lifetime */
2881 struct vki_iw_point encoding; /* Encoding stuff : tokens */
2882 struct vki_iw_param power; /* PM duration/timeout */
2883 struct vki_iw_quality qual; /* Quality part of statistics */
2885 struct vki_sockaddr ap_addr; /* Access point address */
2886 struct vki_sockaddr addr; /* Destination address (hw/mac) */
2888 struct vki_iw_param param; /* Other small parameters */
2889 struct vki_iw_point data; /* Other large parameters */
2892 struct vki_iwreq
2894 union
2896 char ifrn_name[VKI_IFNAMSIZ]; /* if name, e.g. "eth0" */
2897 } ifr_ifrn;
2899 /* Data part (defined just above) */
2900 union vki_iwreq_data u;
2903 /*--------------------------------------------------------------------*/
2904 // From linux-2.6.31.5/include/linux/perf_event.h
2905 /*--------------------------------------------------------------------*/
2907 struct vki_perf_event_attr {
2910 * Major type: hardware/software/tracepoint/etc.
2912 __vki_u32 type;
2915 * Size of the attr structure, for fwd/bwd compat.
2917 __vki_u32 size;
2920 * Type specific configuration information.
2922 __vki_u64 config;
2924 union {
2925 __vki_u64 sample_period;
2926 __vki_u64 sample_freq;
2929 __vki_u64 sample_type;
2930 __vki_u64 read_format;
2932 __vki_u64 disabled : 1, /* off by default */
2933 inherit : 1, /* children inherit it */
2934 pinned : 1, /* must always be on PMU */
2935 exclusive : 1, /* only group on PMU */
2936 exclude_user : 1, /* don't count user */
2937 exclude_kernel : 1, /* ditto kernel */
2938 exclude_hv : 1, /* ditto hypervisor */
2939 exclude_idle : 1, /* don't count when idle */
2940 mmap : 1, /* include mmap data */
2941 comm : 1, /* include comm data */
2942 freq : 1, /* use freq, not period */
2943 inherit_stat : 1, /* per task counts */
2944 enable_on_exec : 1, /* next exec enables */
2945 task : 1, /* trace fork/exit */
2946 watermark : 1, /* wakeup_watermark */
2948 * precise_ip:
2950 * 0 - SAMPLE_IP can have arbitrary skid
2951 * 1 - SAMPLE_IP must have constant skid
2952 * 2 - SAMPLE_IP requested to have 0 skid
2953 * 3 - SAMPLE_IP must have 0 skid
2955 * See also PERF_RECORD_MISC_EXACT_IP
2957 precise_ip : 2, /* skid constraint */
2958 mmap_data : 1, /* non-exec mmap data */
2959 sample_id_all : 1, /* sample_type all events */
2961 __reserved_1 : 45;
2963 union {
2964 __vki_u32 wakeup_events; /* wakeup every n events */
2965 __vki_u32 wakeup_watermark; /* bytes before wakeup */
2968 __vki_u32 bp_type;
2969 union {
2970 __vki_u64 bp_addr;
2971 __vki_u64 config1; /* extension of config */
2973 union {
2974 __vki_u64 bp_len;
2975 __vki_u64 config2; /* extension of config1 */
2979 #define VKI_PERF_EVENT_IOC_ENABLE _VKI_IO ('$', 0)
2980 #define VKI_PERF_EVENT_IOC_DISABLE _VKI_IO ('$', 1)
2981 #define VKI_PERF_EVENT_IOC_REFRESH _VKI_IO ('$', 2)
2982 #define VKI_PERF_EVENT_IOC_RESET _VKI_IO ('$', 3)
2983 #define VKI_PERF_EVENT_IOC_PERIOD _VKI_IOW('$', 4, __vki_u64)
2984 #define VKI_PERF_EVENT_IOC_SET_OUTPUT _VKI_IO ('$', 5)
2985 #define VKI_PERF_EVENT_IOC_SET_FILTER _VKI_IOW('$', 6, char *)
2986 #define VKI_PERF_EVENT_IOC_ID _VKI_IOR('$', 7, __vki_u64 *)
2987 #define VKI_PERF_EVENT_IOC_SET_BPF _VKI_IOW('$', 8, __vki_u32)
2989 /*--------------------------------------------------------------------*/
2990 // From linux-2.6.32.4/include/linux/getcpu.h
2991 /*--------------------------------------------------------------------*/
2993 struct vki_getcpu_cache {
2994 unsigned long blob[128 / sizeof(long)];
2997 //----------------------------------------------------------------------
2998 // From linux-2.6.33.3/include/linux/input.h
2999 //----------------------------------------------------------------------
3002 * IOCTLs (0x00 - 0x7f)
3005 #define VKI_EVIOCGNAME(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x06, len) /* get device name */
3006 #define VKI_EVIOCGPHYS(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x07, len) /* get physical location */
3007 #define VKI_EVIOCGUNIQ(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x08, len) /* get unique identifier */
3009 #define VKI_EVIOCGKEY(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x18, len) /* get global keystate */
3010 #define VKI_EVIOCGLED(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x19, len) /* get all LEDs */
3011 #define VKI_EVIOCGSND(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x1a, len) /* get all sounds status */
3012 #define VKI_EVIOCGSW(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x1b, len) /* get all switch states */
3014 #define VKI_EVIOCGBIT(ev,len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */
3017 * Event types
3020 #define VKI_EV_SYN 0x00
3021 #define VKI_EV_KEY 0x01
3022 #define VKI_EV_REL 0x02
3023 #define VKI_EV_ABS 0x03
3024 #define VKI_EV_MSC 0x04
3025 #define VKI_EV_SW 0x05
3026 #define VKI_EV_LED 0x11
3027 #define VKI_EV_SND 0x12
3028 #define VKI_EV_REP 0x14
3029 #define VKI_EV_FF 0x15
3030 #define VKI_EV_PWR 0x16
3031 #define VKI_EV_FF_STATUS 0x17
3032 #define VKI_EV_MAX 0x1f
3033 #define VKI_EV_CNT (VKI_EV_MAX+1)
3035 //----------------------------------------------------------------------
3036 // From linux-2.6.39-rc2/include/asm_generic/ioctls.h
3037 //----------------------------------------------------------------------
3039 #ifndef VKI_FIOQSIZE
3040 #define VKI_FIOQSIZE 0x5460 /* Value differs on some platforms */
3041 #endif
3043 #ifndef VKI_TIOCSIG
3044 #define VKI_TIOCSIG _VKI_IOW('T', 0x36, int) /* Value differs on some platforms */
3045 #endif
3047 //----------------------------------------------------------------------
3048 // From kernel/common/include/linux/ashmem.h
3049 //----------------------------------------------------------------------
3051 #if defined(VGPV_arm_linux_android) || defined(VGPV_x86_linux_android) \
3052 || defined(VGPV_mips32_linux_android) \
3053 || defined(VGPV_arm64_linux_android)
3055 #define VKI_ASHMEM_NAME_LEN 256
3057 #define VKI_ASHMEM_NAME_DEF "dev/ashmem"
3059 #define VKI_ASHMEM_NOT_PURGED 0
3060 #define VKI_ASHMEM_WAS_PURGED 1
3062 #define VKI_ASHMEM_IS_UNPINNED 0
3063 #define VKI_ASHMEM_IS_PINNED 1
3065 struct vki_ashmem_pin {
3066 vki_uint32_t offset;
3067 vki_uint32_t len;
3070 #define __VKI_ASHMEMIOC 0x77
3072 #define VKI_ASHMEM_SET_NAME _VKI_IOW(__VKI_ASHMEMIOC, 1, char[VKI_ASHMEM_NAME_LEN])
3073 #define VKI_ASHMEM_GET_NAME _VKI_IOR(__VKI_ASHMEMIOC, 2, char[VKI_ASHMEM_NAME_LEN])
3074 #define VKI_ASHMEM_SET_SIZE _VKI_IOW(__VKI_ASHMEMIOC, 3, vki_size_t)
3075 #define VKI_ASHMEM_GET_SIZE _VKI_IO(__VKI_ASHMEMIOC, 4)
3076 #define VKI_ASHMEM_SET_PROT_MASK _VKI_IOW(__VKI_ASHMEMIOC, 5, unsigned long)
3077 #define VKI_ASHMEM_GET_PROT_MASK _VKI_IO(__VKI_ASHMEMIOC, 6)
3078 #define VKI_ASHMEM_PIN _VKI_IOW(__VKI_ASHMEMIOC, 7, struct vki_ashmem_pin)
3079 #define VKI_ASHMEM_UNPIN _VKI_IOW(__VKI_ASHMEMIOC, 8, struct vki_ashmem_pin)
3080 #define VKI_ASHMEM_GET_PIN_STATUS _VKI_IO(__VKI_ASHMEMIOC, 9)
3081 #define VKI_ASHMEM_PURGE_ALL_CACHES _VKI_IO(__VKI_ASHMEMIOC, 10)
3083 //----------------------------------------------------------------------
3084 // From kernel/common/include/linux/binder.h
3085 //----------------------------------------------------------------------
3087 struct vki_binder_write_read {
3088 signed long write_size;
3089 signed long write_consumed;
3090 unsigned long write_buffer;
3091 signed long read_size;
3092 signed long read_consumed;
3093 unsigned long read_buffer;
3096 struct vki_binder_version {
3097 signed long protocol_version;
3100 #define VKI_BINDER_WRITE_READ _VKI_IOWR('b', 1, struct vki_binder_write_read)
3101 #define VKI_BINDER_SET_IDLE_TIMEOUT _VKI_IOW('b', 3, vki_int64_t)
3102 #define VKI_BINDER_SET_MAX_THREADS _VKI_IOW('b', 5, vki_size_t)
3103 #define VKI_BINDER_SET_IDLE_PRIORITY _VKI_IOW('b', 6, int)
3104 #define VKI_BINDER_SET_CONTEXT_MGR _VKI_IOW('b', 7, int)
3105 #define VKI_BINDER_THREAD_EXIT _VKI_IOW('b', 8, int)
3106 #define VKI_BINDER_VERSION _VKI_IOWR('b', 9, struct vki_binder_version)
3108 #endif /* defined(VGPV_*_linux_android) */
3110 //----------------------------------------------------------------------
3111 // From linux-3.0.4/include/net/bluetooth/bluetooth.h
3112 //----------------------------------------------------------------------
3114 typedef struct {
3115 __vki_u8 b[6];
3116 } __vki_packed vki_bdaddr_t;
3118 //----------------------------------------------------------------------
3119 // From linux-3.0.4/include/net/bluetooth/hci.h
3120 //----------------------------------------------------------------------
3122 #define VKI_HCIDEVUP _VKI_IOW('H', 201, int)
3123 #define VKI_HCIDEVDOWN _VKI_IOW('H', 202, int)
3124 #define VKI_HCIDEVRESET _VKI_IOW('H', 203, int)
3125 #define VKI_HCIDEVRESTAT _VKI_IOW('H', 204, int)
3127 #define VKI_HCIGETDEVLIST _VKI_IOR('H', 210, int)
3129 struct vki_hci_dev_req {
3130 __vki_u16 dev_id;
3131 __vki_u32 dev_opt;
3134 struct vki_hci_dev_list_req {
3135 __vki_u16 dev_num;
3136 struct vki_hci_dev_req dev_req[0]; /* hci_dev_req structures */
3139 #define VKI_HCIGETDEVINFO _VKI_IOR('H', 211, int)
3140 #define VKI_HCIGETCONNLIST _VKI_IOR('H', 212, int)
3141 #define VKI_HCIGETCONNINFO _VKI_IOR('H', 213, int)
3142 #define VKI_HCIGETAUTHINFO _VKI_IOR('H', 215, int)
3144 #define VKI_HCISETRAW _VKI_IOW('H', 220, int)
3145 #define VKI_HCISETSCAN _VKI_IOW('H', 221, int)
3146 #define VKI_HCISETAUTH _VKI_IOW('H', 222, int)
3147 #define VKI_HCISETENCRYPT _VKI_IOW('H', 223, int)
3148 #define VKI_HCISETPTYPE _VKI_IOW('H', 224, int)
3149 #define VKI_HCISETLINKPOL _VKI_IOW('H', 225, int)
3150 #define VKI_HCISETLINKMODE _VKI_IOW('H', 226, int)
3151 #define VKI_HCISETACLMTU _VKI_IOW('H', 227, int)
3152 #define VKI_HCISETSCOMTU _VKI_IOW('H', 228, int)
3154 #define VKI_HCIBLOCKADDR _VKI_IOW('H', 230, int)
3155 #define VKI_HCIUNBLOCKADDR _VKI_IOW('H', 231, int)
3157 #define VKI_HCIINQUIRY _VKI_IOR('H', 240, int)
3159 struct vki_inquiry_info {
3160 vki_bdaddr_t bdaddr;
3161 __vki_u8 pscan_rep_mode;
3162 __vki_u8 pscan_period_mode;
3163 __vki_u8 pscan_mode;
3164 __vki_u8 dev_class[3];
3165 __vki_le16 clock_offset;
3166 } __vki_packed;
3168 struct vki_hci_inquiry_req {
3169 __vki_u16 dev_id;
3170 __vki_u16 flags;
3171 __vki_u8 lap[3];
3172 __vki_u8 length;
3173 __vki_u8 num_rsp;
3176 //----------------------------------------------------------------------
3177 // From linux-3.9.2/include/net/bluetooth/rfcomm.h
3178 //----------------------------------------------------------------------
3180 struct vki_sockaddr_rc {
3181 vki_sa_family_t rc_family;
3182 vki_bdaddr_t rc_bdaddr;
3183 __vki_u8 rc_channel;
3186 //----------------------------------------------------------------------
3187 // From linux-3.4/include/linux/kvm.h
3188 //----------------------------------------------------------------------
3189 #define KVMIO 0xAE
3191 #define VKI_KVM_GET_API_VERSION _VKI_IO(KVMIO, 0x00)
3192 #define VKI_KVM_CREATE_VM _VKI_IO(KVMIO, 0x01) /* returns a VM fd */
3193 #define VKI_KVM_CHECK_EXTENSION _VKI_IO(KVMIO, 0x03)
3194 #define VKI_KVM_GET_VCPU_MMAP_SIZE _VKI_IO(KVMIO, 0x04) /* in bytes */
3195 #define VKI_KVM_S390_ENABLE_SIE _VKI_IO(KVMIO, 0x06)
3196 #define VKI_KVM_CREATE_VCPU _VKI_IO(KVMIO, 0x41)
3197 #define VKI_KVM_SET_NR_MMU_PAGES _VKI_IO(KVMIO, 0x44)
3198 #define VKI_KVM_GET_NR_MMU_PAGES _VKI_IO(KVMIO, 0x45)
3199 #define VKI_KVM_SET_TSS_ADDR _VKI_IO(KVMIO, 0x47)
3200 #define VKI_KVM_CREATE_IRQCHIP _VKI_IO(KVMIO, 0x60)
3201 #define VKI_KVM_CREATE_PIT _VKI_IO(KVMIO, 0x64)
3202 #define VKI_KVM_REINJECT_CONTROL _VKI_IO(KVMIO, 0x71)
3203 #define VKI_KVM_SET_BOOT_CPU_ID _VKI_IO(KVMIO, 0x78)
3204 #define VKI_KVM_SET_TSC_KHZ _VKI_IO(KVMIO, 0xa2)
3205 #define VKI_KVM_GET_TSC_KHZ _VKI_IO(KVMIO, 0xa3)
3206 #define VKI_KVM_RUN _VKI_IO(KVMIO, 0x80)
3207 #define VKI_KVM_S390_INITIAL_RESET _VKI_IO(KVMIO, 0x97)
3208 #define VKI_KVM_NMI _VKI_IO(KVMIO, 0x9a)
3209 #define VKI_KVM_KVMCLOCK_CTRL _VKI_IO(KVMIO, 0xad)
3211 struct vki_kvm_s390_mem_op {
3212 /* in */
3213 __vki_u64 gaddr; /* the guest address */
3214 __vki_u64 flags; /* flags */
3215 __vki_u32 size; /* amount of bytes */
3216 __vki_u32 op; /* type of operation */
3217 __vki_u64 buf; /* buffer in userspace */
3218 __vki_u8 ar; /* the access register number */
3219 __vki_u8 reserved[31]; /* should be set to 0 */
3222 #define VKI_KVM_S390_MEMOP_LOGICAL_READ 0
3223 #define VKI_KVM_S390_MEMOP_LOGICAL_WRITE 1
3224 #define VKI_KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0)
3225 #define VKI_KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1)
3227 #define VKI_KVM_S390_MEM_OP _VKI_IOW(KVMIO, 0xb1, struct vki_kvm_s390_mem_op)
3229 //----------------------------------------------------------------------
3230 // From linux-2.6/include/linux/net_stamp.h
3231 //----------------------------------------------------------------------
3233 struct vki_hwtstamp_config {
3234 int flags;
3235 int tx_type;
3236 int rx_filter;
3239 //----------------------------------------------------------------------
3240 // From linux-2.6.12-rc2/include/linux/uinput.h
3241 //----------------------------------------------------------------------
3243 #define VKI_UINPUT_IOCTL_BASE 'U'
3244 #define VKI_UI_DEV_CREATE _VKI_IO(VKI_UINPUT_IOCTL_BASE, 1)
3245 #define VKI_UI_DEV_DESTROY _VKI_IO(VKI_UINPUT_IOCTL_BASE, 2)
3247 #define VKI_UI_SET_EVBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 100, int)
3248 #define VKI_UI_SET_KEYBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 101, int)
3249 #define VKI_UI_SET_RELBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 102, int)
3250 #define VKI_UI_SET_ABSBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 103, int)
3251 #define VKI_UI_SET_MSCBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 104, int)
3252 #define VKI_UI_SET_LEDBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 105, int)
3253 #define VKI_UI_SET_SNDBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 106, int)
3254 #define VKI_UI_SET_FFBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 107, int)
3255 #define VKI_UI_SET_SWBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 109, int)
3256 #define VKI_UI_SET_PROPBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 110, int)
3258 //----------------------------------------------------------------------
3259 // From linux-2.6/include/uapi/rdma/ib_user_mad.h
3260 //----------------------------------------------------------------------
3262 #define VKI_IB_IOCTL_MAGIC 0x1b
3264 #define VKI_IB_USER_MAD_REGISTER_AGENT _VKI_IOWR(VKI_IB_IOCTL_MAGIC, 1, \
3265 struct ib_user_mad_reg_req)
3267 #define VKI_IB_USER_MAD_UNREGISTER_AGENT _VKI_IOW(VKI_IB_IOCTL_MAGIC, 2, __u32)
3269 #define VKI_IB_USER_MAD_ENABLE_PKEY _VKI_IO(VKI_IB_IOCTL_MAGIC, 3)
3271 //----------------------------------------------------------------------
3272 // From linux-3.8/include/uapi/linux/if_tun.h
3273 //----------------------------------------------------------------------
3275 #define VKI_TUNSETNOCSUM _VKI_IOW('T', 200, int)
3276 #define VKI_TUNSETDEBUG _VKI_IOW('T', 201, int)
3277 #define VKI_TUNSETIFF _VKI_IOW('T', 202, int)
3278 #define VKI_TUNSETPERSIST _VKI_IOW('T', 203, int)
3279 #define VKI_TUNSETOWNER _VKI_IOW('T', 204, int)
3280 #define VKI_TUNSETLINK _VKI_IOW('T', 205, int)
3281 #define VKI_TUNSETGROUP _VKI_IOW('T', 206, int)
3282 #define VKI_TUNGETFEATURES _VKI_IOR('T', 207, unsigned int)
3283 #define VKI_TUNSETOFFLOAD _VKI_IOW('T', 208, unsigned int)
3284 #define VKI_TUNSETTXFILTER _VKI_IOW('T', 209, unsigned int)
3285 #define VKI_TUNGETIFF _VKI_IOR('T', 210, unsigned int)
3286 #define VKI_TUNGETSNDBUF _VKI_IOR('T', 211, int)
3287 #define VKI_TUNSETSNDBUF _VKI_IOW('T', 212, int)
3288 //#define VKI_TUNATTACHFILTER _VKI_IOW('T', 213, struct sock_fprog)
3289 //#define VKI_TUNDETACHFILTER _VKI_IOW('T', 214, struct sock_fprog)
3290 #define VKI_TUNGETVNETHDRSZ _VKI_IOR('T', 215, int)
3291 #define VKI_TUNSETVNETHDRSZ _VKI_IOW('T', 216, int)
3292 #define VKI_TUNSETQUEUE _VKI_IOW('T', 217, int)
3293 #define VKI_TUNSETIFINDEX _VKI_IOW('T', 218, unsigned int)
3294 //#define VKI_TUNGETFILTER _VKI_IOR('T', 219, struct sock_fprog)
3296 //----------------------------------------------------------------------
3297 // From linux-3.8/include/uapi/linux/vhost.h
3298 //----------------------------------------------------------------------
3300 #define VKI_VHOST_VIRTIO 0xAF
3301 #define VKI_VHOST_SET_OWNER _VKI_IO(VKI_VHOST_VIRTIO, 0x01)
3302 #define VKI_VHOST_RESET_OWNER _VKI_IO(VKI_VHOST_VIRTIO, 0x02)
3304 //----------------------------------------------------------------------
3305 // Xen privcmd IOCTL
3306 //----------------------------------------------------------------------
3308 typedef unsigned long __vki_xen_pfn_t;
3310 struct vki_xen_privcmd_hypercall {
3311 __vki_u64 op;
3312 __vki_u64 arg[5];
3315 struct vki_xen_privcmd_mmap_entry {
3316 __vki_u64 va;
3317 __vki_u64 mfn;
3318 __vki_u64 npages;
3321 struct vki_xen_privcmd_mmap {
3322 int num;
3323 __vki_u16 dom; /* target domain */
3324 struct vki_xen_privcmd_mmap_entry *entry;
3327 struct vki_xen_privcmd_mmapbatch {
3328 int num; /* number of pages to populate */
3329 __vki_u16 dom; /* target domain */
3330 __vki_u64 addr; /* virtual address */
3331 __vki_xen_pfn_t *arr; /* array of mfns - top nibble set on err */
3334 struct vki_xen_privcmd_mmapbatch_v2 {
3335 unsigned int num; /* number of pages to populate */
3336 __vki_u16 dom; /* target domain */
3337 __vki_u64 addr; /* virtual address */
3338 const __vki_xen_pfn_t *arr; /* array of mfns */
3339 int __user *err; /* array of error codes */
3342 #define VKI_XEN_IOCTL_PRIVCMD_HYPERCALL _VKI_IOC(_VKI_IOC_NONE, 'P', 0, sizeof(struct vki_xen_privcmd_hypercall))
3343 #define VKI_XEN_IOCTL_PRIVCMD_MMAP _VKI_IOC(_VKI_IOC_NONE, 'P', 2, sizeof(struct vki_xen_privcmd_mmap))
3345 #define VKI_XEN_IOCTL_PRIVCMD_MMAPBATCH _VKI_IOC(_VKI_IOC_NONE, 'P', 3, sizeof(struct vki_xen_privcmd_mmapbatch))
3346 #define VKI_XEN_IOCTL_PRIVCMD_MMAPBATCH_V2 _VKI_IOC(_VKI_IOC_NONE, 'P', 4, sizeof(struct vki_xen_privcmd_mmapbatch_v2))
3348 //----------------------------------------------------------------------
3349 // Xen evtchn IOCTL
3350 //----------------------------------------------------------------------
3352 #define VKI_XEN_IOCTL_EVTCHN_BIND_VIRQ \
3353 _VKI_IOC(_VKI_IOC_NONE, 'E', 0, sizeof(struct vki_xen_ioctl_evtchn_bind_virq))
3354 struct vki_xen_ioctl_evtchn_bind_virq {
3355 vki_uint32_t virq;
3358 #define VKI_XEN_IOCTL_EVTCHN_BIND_INTERDOMAIN \
3359 _VKI_IOC(_VKI_IOC_NONE, 'E', 1, sizeof(struct vki_xen_ioctl_evtchn_bind_interdomain))
3360 struct vki_xen_ioctl_evtchn_bind_interdomain {
3361 vki_uint32_t remote_domain;
3362 vki_uint32_t remote_port;
3365 #define VKI_XEN_IOCTL_EVTCHN_BIND_UNBOUND_PORT \
3366 _VKI_IOC(_VKI_IOC_NONE, 'E', 2, sizeof(struct vki_xen_ioctl_evtchn_bind_unbound_port))
3367 struct vki_xen_ioctl_evtchn_bind_unbound_port {
3368 vki_uint32_t remote_domain;
3371 #define VKI_XEN_IOCTL_EVTCHN_UNBIND \
3372 _VKI_IOC(_VKI_IOC_NONE, 'E', 3, sizeof(struct vki_xen_ioctl_evtchn_unbind))
3373 struct vki_xen_ioctl_evtchn_unbind {
3374 vki_uint32_t port;
3377 #define VKI_XEN_IOCTL_EVTCHN_NOTIFY \
3378 _VKI_IOC(_VKI_IOC_NONE, 'E', 4, sizeof(struct vki_xen_ioctl_evtchn_notify))
3379 struct vki_xen_ioctl_evtchn_notify {
3380 vki_uint32_t port;
3383 #define VKI_XEN_IOCTL_EVTCHN_RESET \
3384 _VKI_IOC(_VKI_IOC_NONE, 'E', 5, 0)
3387 //----------------------------------------------------------------------
3388 // From linux-3.4.0/include/linux/fs.h
3389 //----------------------------------------------------------------------
3391 struct vki_file_handle {
3392 __vki_u32 handle_bytes;
3393 int handle_type;
3394 /* file identifier */
3395 unsigned char f_handle[0];
3398 //----------------------------------------------------------------------
3399 // From linux-3.2.0/include/linux/filter.h
3400 //----------------------------------------------------------------------
3402 struct vki_sock_filter {
3403 __vki_u16 code; /* Actual filter code */
3404 __vki_u8 jt; /* Jump true */
3405 __vki_u8 jf; /* Jump false */
3406 __vki_u32 k; /* Generic multiuse field */
3409 struct vki_sock_fprog {
3410 __vki_u16 len; /* actually unsigned short */
3411 struct vki_sock_filter *filter;
3414 //----------------------------------------------------------------------
3415 // From linux/include/uapi/linux/ethtool.h
3416 //----------------------------------------------------------------------
3418 struct vki_ethtool_cmd {
3419 __vki_u32 cmd;
3420 __vki_u32 supported;
3421 __vki_u32 advertising;
3422 __vki_u16 speed;
3423 __vki_u8 duplex;
3424 __vki_u8 port;
3425 __vki_u8 phy_address;
3426 __vki_u8 transceiver;
3427 __vki_u8 autoneg;
3428 __vki_u8 mdio_support;
3429 __vki_u32 maxtxpkt;
3430 __vki_u32 maxrxpkt;
3431 __vki_u16 speed_hi;
3432 __vki_u8 eth_tp_mdix;
3433 __vki_u8 eth_tp_mdix_ctrl;
3434 __vki_u32 lp_advertising;
3435 __vki_u32 reserved[2];
3438 #define VKI_ETHTOOL_FWVERS_LEN 32
3439 #define VKI_ETHTOOL_BUSINFO_LEN 32
3441 struct vki_ethtool_drvinfo {
3442 __vki_u32 cmd;
3443 char driver[32];
3444 char version[32];
3445 char fw_version[VKI_ETHTOOL_FWVERS_LEN];
3446 char bus_info[VKI_ETHTOOL_BUSINFO_LEN];
3447 char reserved1[32];
3448 char reserved2[12];
3449 __vki_u32 n_priv_flags;
3450 __vki_u32 n_stats;
3451 __vki_u32 testinfo_len;
3452 __vki_u32 eedump_len;
3453 __vki_u32 regdump_len;
3456 #define VKI_SOPASS_MAX 6
3458 struct vki_ethtool_wolinfo {
3459 __vki_u32 cmd;
3460 __vki_u32 supported;
3461 __vki_u32 wolopts;
3462 __vki_u8 sopass[VKI_SOPASS_MAX];
3465 struct vki_ethtool_value {
3466 __vki_u32 cmd;
3467 __vki_u32 data;
3470 struct vki_ethtool_regs {
3471 __vki_u32 cmd;
3472 __vki_u32 version;
3473 __vki_u32 len;
3474 __vki_u8 data[0];
3477 struct vki_ethtool_ringparam {
3478 __vki_u32 cmd;
3479 __vki_u32 rx_max_pending;
3480 __vki_u32 rx_mini_max_pending;
3481 __vki_u32 rx_jumbo_max_pending;
3482 __vki_u32 tx_max_pending;
3483 __vki_u32 rx_pending;
3484 __vki_u32 rx_mini_pending;
3485 __vki_u32 rx_jumbo_pending;
3486 __vki_u32 tx_pending;
3489 struct vki_ethtool_channels {
3490 __vki_u32 cmd;
3491 __vki_u32 max_rx;
3492 __vki_u32 max_tx;
3493 __vki_u32 max_other;
3494 __vki_u32 max_combined;
3495 __vki_u32 rx_count;
3496 __vki_u32 tx_count;
3497 __vki_u32 other_count;
3498 __vki_u32 combined_count;
3501 struct vki_ethtool_sset_info {
3502 __vki_u32 cmd;
3503 __vki_u32 reserved;
3504 __vki_u64 sset_mask;
3505 __vki_u32 data[0];
3508 struct vki_ethtool_test {
3509 __vki_u32 cmd;
3510 __vki_u32 flags;
3511 __vki_u32 reserved;
3512 __vki_u32 len;
3513 __vki_u64 data[0];
3516 struct vki_ethtool_perm_addr {
3517 __vki_u32 cmd;
3518 __vki_u32 size;
3519 __vki_u8 data[0];
3522 struct vki_ethtool_get_features_block {
3523 __vki_u32 available;
3524 __vki_u32 requested;
3525 __vki_u32 active;
3526 __vki_u32 never_changed;
3529 struct vki_ethtool_gfeatures {
3530 __vki_u32 cmd;
3531 __vki_u32 size;
3532 struct vki_ethtool_get_features_block features[0];
3535 struct vki_ethtool_set_features_block {
3536 __vki_u32 valid;
3537 __vki_u32 requested;
3540 struct vki_ethtool_sfeatures {
3541 __vki_u32 cmd;
3542 __vki_u32 size;
3543 struct vki_ethtool_set_features_block features[0];
3546 struct vki_ethtool_ts_info {
3547 __vki_u32 cmd;
3548 __vki_u32 so_timestamping;
3549 __vki_s32 phc_index;
3550 __vki_u32 tx_types;
3551 __vki_u32 tx_reserved[3];
3552 __vki_u32 rx_filters;
3553 __vki_u32 rx_reserved[3];
3556 #define VKI_ETHTOOL_GSET 0x00000001 /* Get settings. */
3557 #define VKI_ETHTOOL_SSET 0x00000002 /* Set settings. */
3558 #define VKI_ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
3559 #define VKI_ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
3560 #define VKI_ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
3561 #define VKI_ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */
3562 #define VKI_ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
3563 #define VKI_ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */
3564 #define VKI_ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */
3565 #define VKI_ETHTOOL_GLINK 0x0000000a
3566 #define VKI_ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */
3567 #define VKI_ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */
3568 #define VKI_ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */
3569 #define VKI_ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */
3570 #define VKI_ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */
3571 #define VKI_ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */
3572 #define VKI_ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable
3573 * (ethtool_value) */
3574 #define VKI_ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable
3575 * (ethtool_value). */
3576 #define VKI_ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */
3577 #define VKI_ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */
3578 #define VKI_ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
3579 #define VKI_ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
3580 #define VKI_ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */
3581 #define VKI_ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */
3582 #define VKI_ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
3583 #define VKI_ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */
3584 #define VKI_ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
3585 #define VKI_ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
3586 #define VKI_ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
3587 #define VKI_ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
3588 #define VKI_ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
3589 #define VKI_ETHTOOL_RESET 0x00000034 /* Reset hardware */
3590 #define VKI_ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
3591 #define VKI_ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */
3592 #define VKI_ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */
3593 #define VKI_ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */
3594 #define VKI_ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */
3595 #define VKI_ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */
3597 //----------------------------------------------------------------------
3598 // From linux-3.15.8/drivers/staging/android/uapi/ion.h
3599 //----------------------------------------------------------------------
3601 typedef int vki_ion_user_handle_t;
3603 struct vki_ion_allocation_data {
3604 vki_size_t len;
3605 vki_size_t align;
3606 unsigned int heap_id_mask;
3607 unsigned int flags;
3608 vki_ion_user_handle_t handle;
3611 struct vki_ion_fd_data {
3612 vki_ion_user_handle_t handle;
3613 int fd;
3616 struct vki_ion_handle_data {
3617 vki_ion_user_handle_t handle;
3620 struct vki_ion_custom_data {
3621 unsigned int cmd;
3622 unsigned long arg;
3625 #define VKI_ION_IOC_MAGIC 'I'
3627 #define VKI_ION_IOC_ALLOC \
3628 _VKI_IOWR(VKI_ION_IOC_MAGIC, 0, struct vki_ion_allocation_data)
3630 #define VKI_ION_IOC_FREE \
3631 _VKI_IOWR(VKI_ION_IOC_MAGIC, 1, struct vki_ion_handle_data)
3633 #define VKI_ION_IOC_MAP \
3634 _VKI_IOWR(VKI_ION_IOC_MAGIC, 2, struct vki_ion_fd_data)
3636 #define VKI_ION_IOC_SHARE \
3637 _VKI_IOWR(VKI_ION_IOC_MAGIC, 4, struct vki_ion_fd_data)
3639 #define VKI_ION_IOC_IMPORT \
3640 _VKI_IOWR(VKI_ION_IOC_MAGIC, 5, struct vki_ion_fd_data)
3642 #define VKI_ION_IOC_SYNC \
3643 _VKI_IOWR(VKI_ION_IOC_MAGIC, 7, struct vki_ion_fd_data)
3645 #define VKI_ION_IOC_CUSTOM \
3646 _VKI_IOWR(VKI_ION_IOC_MAGIC, 6, struct vki_ion_custom_data)
3648 //----------------------------------------------------------------------
3649 // From linux-3.19-rc5/drivers/staging/android/uapi/sync.h
3650 //----------------------------------------------------------------------
3652 struct vki_sync_merge_data {
3653 __vki_s32 fd2;
3654 char name[32];
3655 __vki_s32 fence;
3658 struct vki_sync_pt_info {
3659 __vki_u32 len;
3660 char obj_name[32];
3661 char driver_name[32];
3662 __vki_s32 status;
3663 __vki_u64 timestamp_ns;
3664 __vki_u8 driver_data[0];
3667 struct vki_sync_fence_info_data {
3668 __vki_u32 len;
3669 char name[32];
3670 __vki_s32 status;
3671 __vki_u8 pt_info[0];
3674 #define VKI_SYNC_IOC_MAGIC '>'
3676 #define VKI_SYNC_IOC_WAIT \
3677 _VKI_IOW(VKI_SYNC_IOC_MAGIC, 0, __vki_s32)
3679 #define VKI_SYNC_IOC_MERGE \
3680 _VKI_IOWR(VKI_SYNC_IOC_MAGIC, 1, struct vki_sync_merge_data)
3682 #define VKI_SYNC_IOC_FENCE_INFO \
3683 _VKI_IOWR(VKI_SYNC_IOC_MAGIC, 2, struct vki_sync_fence_info_data)
3685 //----------------------------------------------------------------------
3686 // From drivers/staging/lustre/lustre/include/lustre/lustre_user.h
3687 //----------------------------------------------------------------------
3689 struct vki_lu_fid {
3690 __vki_u64 f_seq;
3691 __vki_u32 f_oid;
3692 __vki_u32 f_ver;
3695 //----------------------------------------------------------------------
3696 // From drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
3697 //----------------------------------------------------------------------
3699 struct vki_getinfo_fid2path {
3700 struct vki_lu_fid gf_fid;
3701 __vki_u64 gf_recno;
3702 __vki_u32 gf_linkno;
3703 __vki_u32 gf_pathlen;
3704 char gf_path[0];
3705 } __attribute__((packed));
3707 //----------------------------------------------------------------------
3708 // From drivers/staging/lustre/lustre/include/linux/lustre_lib.h
3709 //----------------------------------------------------------------------
3711 #define VKI_OBD_IOC_DATA_TYPE long
3713 //----------------------------------------------------------------------
3714 // From drivers/staging/lustre/lustre/include/lustre_lib.h
3715 //----------------------------------------------------------------------
3717 #define VKI_OBD_IOC_FID2PATH \
3718 _VKI_IOWR ('f', 150, VKI_OBD_IOC_DATA_TYPE)
3719 #define VKI_LL_IOC_PATH2FID \
3720 _VKI_IOR ('f', 173, long)
3722 //----------------------------------------------------------------------
3723 // From lustre/include/lustre/lustre_idl.h
3724 //----------------------------------------------------------------------
3726 struct vki_getparent {
3727 struct vki_lu_fid gp_fid;
3728 __vki_u32 gp_linkno;
3729 __vki_u32 gp_name_size;
3730 char gp_name[0];
3731 } __attribute__((packed));
3733 //----------------------------------------------------------------------
3734 // From Lustre's lustre/include/lustre/lustre_user.h
3735 //----------------------------------------------------------------------
3736 #define VKI_LL_IOC_GROUP_LOCK \
3737 _VKI_IOW('f', 158, long)
3738 #define VKI_LL_IOC_GROUP_UNLOCK \
3739 _VKI_IOW('f', 159, long)
3740 #define VKI_LL_IOC_GETPARENT \
3741 _VKI_IOWR('f', 249, struct vki_getparent)
3744 struct vki_v4l2_rect {
3745 __vki_s32 left;
3746 __vki_s32 top;
3747 __vki_u32 width;
3748 __vki_u32 height;
3751 struct vki_v4l2_fract {
3752 __vki_u32 numerator;
3753 __vki_u32 denominator;
3756 struct vki_v4l2_capability {
3757 __vki_u8 driver[16];
3758 __vki_u8 card[32];
3759 __vki_u8 bus_info[32];
3760 __vki_u32 version;
3761 __vki_u32 capabilities;
3762 __vki_u32 device_caps;
3763 __vki_u32 reserved[3];
3766 struct vki_v4l2_pix_format {
3767 __vki_u32 width;
3768 __vki_u32 height;
3769 __vki_u32 pixelformat;
3770 __vki_u32 field; /* enum vki_v4l2_field */
3771 __vki_u32 bytesperline; /* for padding, zero if unused */
3772 __vki_u32 sizeimage;
3773 __vki_u32 colorspace; /* enum vki_v4l2_colorspace */
3774 __vki_u32 priv; /* private data, depends on pixelformat */
3775 __vki_u32 flags; /* format flags (VKI_V4L2_PIX_FMT_FLAG_*) */
3776 __vki_u32 ycbcr_enc;
3777 __vki_u32 quantization;
3780 struct vki_v4l2_fmtdesc {
3781 __vki_u32 index; /* Format number */
3782 __vki_u32 type; /* enum vki_v4l2_buf_type */
3783 __vki_u32 flags;
3784 __vki_u8 description[32]; /* Description string */
3785 __vki_u32 pixelformat; /* Format fourcc */
3786 __vki_u32 reserved[4];
3789 struct vki_v4l2_frmsize_discrete {
3790 __vki_u32 width; /* Frame width [pixel] */
3791 __vki_u32 height; /* Frame height [pixel] */
3794 struct vki_v4l2_frmsize_stepwise {
3795 __vki_u32 min_width; /* Minimum frame width [pixel] */
3796 __vki_u32 max_width; /* Maximum frame width [pixel] */
3797 __vki_u32 step_width; /* Frame width step size [pixel] */
3798 __vki_u32 min_height; /* Minimum frame height [pixel] */
3799 __vki_u32 max_height; /* Maximum frame height [pixel] */
3800 __vki_u32 step_height; /* Frame height step size [pixel] */
3803 struct vki_v4l2_frmsizeenum {
3804 __vki_u32 index; /* Frame size number */
3805 __vki_u32 pixel_format; /* Pixel format */
3806 __vki_u32 type; /* Frame size type the device supports. */
3808 union { /* Frame size */
3809 struct vki_v4l2_frmsize_discrete discrete;
3810 struct vki_v4l2_frmsize_stepwise stepwise;
3813 __vki_u32 reserved[2]; /* Reserved space for future use */
3816 struct vki_v4l2_frmival_stepwise {
3817 struct vki_v4l2_fract min;
3818 struct vki_v4l2_fract max;
3819 struct vki_v4l2_fract step;
3822 struct vki_v4l2_frmivalenum {
3823 __vki_u32 index;
3824 __vki_u32 pixel_format;
3825 __vki_u32 width;
3826 __vki_u32 height;
3827 __vki_u32 type;
3829 union {
3830 struct vki_v4l2_fract discrete;
3831 struct vki_v4l2_frmival_stepwise stepwise;
3834 __vki_u32 reserved[2];
3837 struct vki_v4l2_timecode {
3838 __vki_u32 type;
3839 __vki_u32 flags;
3840 __vki_u8 frames;
3841 __vki_u8 seconds;
3842 __vki_u8 minutes;
3843 __vki_u8 hours;
3844 __vki_u8 userbits[4];
3847 struct vki_v4l2_jpegcompression {
3848 int quality;
3849 int APPn;
3850 int APP_len;
3851 char APP_data[60];
3852 int COM_len;
3853 char COM_data[60];
3854 __vki_u32 jpeg_markers;
3857 struct vki_v4l2_requestbuffers {
3858 __vki_u32 count;
3859 __vki_u32 type;
3860 __vki_u32 memory;
3861 __vki_u32 reserved[2];
3864 struct vki_v4l2_plane {
3865 __vki_u32 bytesused;
3866 __vki_u32 length;
3867 union {
3868 __vki_u32 mem_offset;
3869 unsigned long userptr;
3870 __vki_s32 fd;
3871 } m;
3872 __vki_u32 data_offset;
3873 __vki_u32 reserved[11];
3876 #define VKI_V4L2_MEMORY_MMAP 1
3877 #define VKI_V4L2_MEMORY_DMABUF 4
3878 #define VKI_V4L2_BUF_FLAG_TIMESTAMP_MASK 0x0000e000
3879 #define VKI_V4L2_BUF_FLAG_TIMESTAMP_COPY 0x00004000
3880 struct vki_v4l2_buffer {
3881 __vki_u32 index;
3882 __vki_u32 type;
3883 __vki_u32 bytesused;
3884 __vki_u32 flags;
3885 __vki_u32 field;
3886 struct vki_timeval timestamp;
3887 struct vki_v4l2_timecode timecode;
3888 __vki_u32 sequence;
3890 /* memory location */
3891 __vki_u32 memory;
3892 union {
3893 __vki_u32 offset;
3894 unsigned long userptr;
3895 struct vki_v4l2_plane *planes;
3896 __vki_s32 fd;
3897 } m;
3898 __vki_u32 length;
3899 __vki_u32 reserved2;
3900 __vki_u32 reserved;
3903 struct vki_v4l2_exportbuffer {
3904 __vki_u32 type; /* enum vki_v4l2_buf_type */
3905 __vki_u32 index;
3906 __vki_u32 plane;
3907 __vki_u32 flags;
3908 __vki_s32 fd;
3909 __vki_u32 reserved[11];
3912 struct vki_v4l2_framebuffer {
3913 __vki_u32 capability;
3914 __vki_u32 flags;
3915 void *base;
3916 struct {
3917 __vki_u32 width;
3918 __vki_u32 height;
3919 __vki_u32 pixelformat;
3920 __vki_u32 field; /* enum vki_v4l2_field */
3921 __vki_u32 bytesperline; /* for padding, zero if unused */
3922 __vki_u32 sizeimage;
3923 __vki_u32 colorspace; /* enum vki_v4l2_colorspace */
3924 __vki_u32 priv; /* reserved field, set to 0 */
3925 } fmt;
3928 struct vki_v4l2_clip {
3929 struct vki_v4l2_rect c;
3930 struct vki_v4l2_clip __user *next;
3933 struct vki_v4l2_window {
3934 struct vki_v4l2_rect w;
3935 __vki_u32 field; /* enum vki_v4l2_field */
3936 __vki_u32 chromakey;
3937 struct vki_v4l2_clip __user *clips;
3938 __vki_u32 clipcount;
3939 void __user *bitmap;
3940 __vki_u8 global_alpha;
3943 struct vki_v4l2_captureparm {
3944 __vki_u32 capability; /* Supported modes */
3945 __vki_u32 capturemode; /* Current mode */
3946 struct vki_v4l2_fract timeperframe; /* Time per frame in seconds */
3947 __vki_u32 extendedmode; /* Driver-specific extensions */
3948 __vki_u32 readbuffers; /* # of buffers for read */
3949 __vki_u32 reserved[4];
3952 struct vki_v4l2_outputparm {
3953 __vki_u32 capability; /* Supported modes */
3954 __vki_u32 outputmode; /* Current mode */
3955 struct vki_v4l2_fract timeperframe; /* Time per frame in seconds */
3956 __vki_u32 extendedmode; /* Driver-specific extensions */
3957 __vki_u32 writebuffers; /* # of buffers for write */
3958 __vki_u32 reserved[4];
3961 struct vki_v4l2_cropcap {
3962 __vki_u32 type; /* enum vki_v4l2_buf_type */
3963 struct vki_v4l2_rect bounds;
3964 struct vki_v4l2_rect defrect;
3965 struct vki_v4l2_fract pixelaspect;
3968 struct vki_v4l2_crop {
3969 __vki_u32 type; /* enum vki_v4l2_buf_type */
3970 struct vki_v4l2_rect c;
3973 struct vki_v4l2_selection {
3974 __vki_u32 type;
3975 __vki_u32 target;
3976 __vki_u32 flags;
3977 struct vki_v4l2_rect r;
3978 __vki_u32 reserved[9];
3981 typedef __vki_u64 vki_v4l2_std_id;
3983 struct vki_v4l2_standard {
3984 __vki_u32 index;
3985 vki_v4l2_std_id id;
3986 __vki_u8 name[24];
3987 struct vki_v4l2_fract frameperiod; /* Frames, not fields */
3988 __vki_u32 framelines;
3989 __vki_u32 reserved[4];
3992 struct vki_v4l2_bt_timings {
3993 __vki_u32 width;
3994 __vki_u32 height;
3995 __vki_u32 interlaced;
3996 __vki_u32 polarities;
3997 __vki_u64 pixelclock;
3998 __vki_u32 hfrontporch;
3999 __vki_u32 hsync;
4000 __vki_u32 hbackporch;
4001 __vki_u32 vfrontporch;
4002 __vki_u32 vsync;
4003 __vki_u32 vbackporch;
4004 __vki_u32 il_vfrontporch;
4005 __vki_u32 il_vsync;
4006 __vki_u32 il_vbackporch;
4007 __vki_u32 standards;
4008 __vki_u32 flags;
4009 __vki_u32 reserved[14];
4010 } __attribute__ ((packed));
4012 struct vki_v4l2_dv_timings {
4013 __vki_u32 type;
4014 union {
4015 struct vki_v4l2_bt_timings bt;
4016 __vki_u32 reserved[32];
4018 } __attribute__ ((packed));
4020 struct vki_v4l2_enum_dv_timings {
4021 __vki_u32 index;
4022 __vki_u32 pad;
4023 __vki_u32 reserved[2];
4024 struct vki_v4l2_dv_timings timings;
4027 struct vki_v4l2_bt_timings_cap {
4028 __vki_u32 min_width;
4029 __vki_u32 max_width;
4030 __vki_u32 min_height;
4031 __vki_u32 max_height;
4032 __vki_u64 min_pixelclock;
4033 __vki_u64 max_pixelclock;
4034 __vki_u32 standards;
4035 __vki_u32 capabilities;
4036 __vki_u32 reserved[16];
4037 } __attribute__ ((packed));
4039 struct vki_v4l2_dv_timings_cap {
4040 __vki_u32 type;
4041 __vki_u32 pad;
4042 __vki_u32 reserved[2];
4043 union {
4044 struct vki_v4l2_bt_timings_cap bt;
4045 __vki_u32 raw_data[32];
4049 struct vki_v4l2_input {
4050 __vki_u32 index; /* Which input */
4051 __vki_u8 name[32]; /* Label */
4052 __vki_u32 type; /* Type of input */
4053 __vki_u32 audioset; /* Associated audios (bitfield) */
4054 __vki_u32 tuner; /* enum vki_v4l2_tuner_type */
4055 vki_v4l2_std_id std;
4056 __vki_u32 status;
4057 __vki_u32 capabilities;
4058 __vki_u32 reserved[3];
4061 struct vki_v4l2_output {
4062 __vki_u32 index; /* Which output */
4063 __vki_u8 name[32]; /* Label */
4064 __vki_u32 type; /* Type of output */
4065 __vki_u32 audioset; /* Associated audios (bitfield) */
4066 __vki_u32 modulator; /* Associated modulator */
4067 vki_v4l2_std_id std;
4068 __vki_u32 capabilities;
4069 __vki_u32 reserved[3];
4072 struct vki_v4l2_control {
4073 __vki_u32 id;
4074 __vki_s32 value;
4077 struct vki_v4l2_ext_control {
4078 __vki_u32 id;
4079 __vki_u32 size;
4080 __vki_u32 reserved2[1];
4081 union {
4082 __vki_s32 value;
4083 __vki_s64 value64;
4084 char *string;
4085 __vki_u8 *p_u8;
4086 __vki_u16 *p_u16;
4087 __vki_u32 *p_u32;
4088 void *ptr;
4090 } __attribute__ ((packed));
4092 struct vki_v4l2_ext_controls {
4093 __vki_u32 ctrl_class;
4094 __vki_u32 count;
4095 __vki_u32 error_idx;
4096 __vki_u32 reserved[2];
4097 struct vki_v4l2_ext_control *controls;
4100 struct vki_v4l2_queryctrl {
4101 __vki_u32 id;
4102 __vki_u32 type; /* enum vki_v4l2_ctrl_type */
4103 __vki_u8 name[32]; /* Whatever */
4104 __vki_s32 minimum; /* Note signedness */
4105 __vki_s32 maximum;
4106 __vki_s32 step;
4107 __vki_s32 default_value;
4108 __vki_u32 flags;
4109 __vki_u32 reserved[2];
4112 #define VKI_V4L2_CTRL_MAX_DIMS (4)
4113 struct vki_v4l2_query_ext_ctrl {
4114 __vki_u32 id;
4115 __vki_u32 type;
4116 char name[32];
4117 __vki_s64 minimum;
4118 __vki_s64 maximum;
4119 __vki_u64 step;
4120 __vki_s64 default_value;
4121 __vki_u32 flags;
4122 __vki_u32 elem_size;
4123 __vki_u32 elems;
4124 __vki_u32 nr_of_dims;
4125 __vki_u32 dims[VKI_V4L2_CTRL_MAX_DIMS];
4126 __vki_u32 reserved[32];
4129 struct vki_v4l2_querymenu {
4130 __vki_u32 id;
4131 __vki_u32 index;
4132 union {
4133 __vki_u8 name[32]; /* Whatever */
4134 __vki_s64 value;
4136 __vki_u32 reserved;
4137 } __attribute__ ((packed));
4139 struct vki_v4l2_tuner {
4140 __vki_u32 index;
4141 __vki_u8 name[32];
4142 __vki_u32 type; /* enum vki_v4l2_tuner_type */
4143 __vki_u32 capability;
4144 __vki_u32 rangelow;
4145 __vki_u32 rangehigh;
4146 __vki_u32 rxsubchans;
4147 __vki_u32 audmode;
4148 __vki_s32 signal;
4149 __vki_s32 afc;
4150 __vki_u32 reserved[4];
4153 struct vki_v4l2_modulator {
4154 __vki_u32 index;
4155 __vki_u8 name[32];
4156 __vki_u32 capability;
4157 __vki_u32 rangelow;
4158 __vki_u32 rangehigh;
4159 __vki_u32 txsubchans;
4160 __vki_u32 reserved[4];
4163 struct vki_v4l2_frequency {
4164 __vki_u32 tuner;
4165 __vki_u32 type; /* enum vki_v4l2_tuner_type */
4166 __vki_u32 frequency;
4167 __vki_u32 reserved[8];
4170 struct vki_v4l2_frequency_band {
4171 __vki_u32 tuner;
4172 __vki_u32 type; /* enum vki_v4l2_tuner_type */
4173 __vki_u32 index;
4174 __vki_u32 capability;
4175 __vki_u32 rangelow;
4176 __vki_u32 rangehigh;
4177 __vki_u32 modulation;
4178 __vki_u32 reserved[9];
4181 struct vki_v4l2_hw_freq_seek {
4182 __vki_u32 tuner;
4183 __vki_u32 type; /* enum vki_v4l2_tuner_type */
4184 __vki_u32 seek_upward;
4185 __vki_u32 wrap_around;
4186 __vki_u32 spacing;
4187 __vki_u32 rangelow;
4188 __vki_u32 rangehigh;
4189 __vki_u32 reserved[5];
4192 struct vki_v4l2_audio {
4193 __vki_u32 index;
4194 __vki_u8 name[32];
4195 __vki_u32 capability;
4196 __vki_u32 mode;
4197 __vki_u32 reserved[2];
4200 struct vki_v4l2_audioout {
4201 __vki_u32 index;
4202 __vki_u8 name[32];
4203 __vki_u32 capability;
4204 __vki_u32 mode;
4205 __vki_u32 reserved[2];
4208 struct vki_v4l2_enc_idx_entry {
4209 __vki_u64 offset;
4210 __vki_u64 pts;
4211 __vki_u32 length;
4212 __vki_u32 flags;
4213 __vki_u32 reserved[2];
4216 #define VKI_V4L2_ENC_IDX_ENTRIES (64)
4217 struct vki_v4l2_enc_idx {
4218 __vki_u32 entries;
4219 __vki_u32 entries_cap;
4220 __vki_u32 reserved[4];
4221 struct vki_v4l2_enc_idx_entry entry[VKI_V4L2_ENC_IDX_ENTRIES];
4224 struct vki_v4l2_encoder_cmd {
4225 __vki_u32 cmd;
4226 __vki_u32 flags;
4227 union {
4228 struct {
4229 __vki_u32 data[8];
4230 } raw;
4234 struct vki_v4l2_decoder_cmd {
4235 __vki_u32 cmd;
4236 __vki_u32 flags;
4237 union {
4238 struct {
4239 __vki_u64 pts;
4240 } stop;
4242 struct {
4243 __vki_s32 speed;
4244 __vki_u32 format;
4245 } start;
4247 struct {
4248 __vki_u32 data[16];
4249 } raw;
4253 struct vki_v4l2_vbi_format {
4254 __vki_u32 sampling_rate; /* in 1 Hz */
4255 __vki_u32 offset;
4256 __vki_u32 samples_per_line;
4257 __vki_u32 sample_format; /* VKI_V4L2_PIX_FMT_* */
4258 __vki_s32 start[2];
4259 __vki_u32 count[2];
4260 __vki_u32 flags; /* VKI_V4L2_VBI_* */
4261 __vki_u32 reserved[2]; /* must be zero */
4264 struct vki_v4l2_sliced_vbi_format {
4265 __vki_u16 service_set;
4266 __vki_u16 service_lines[2][24];
4267 __vki_u32 io_size;
4268 __vki_u32 reserved[2]; /* must be zero */
4271 struct vki_v4l2_sliced_vbi_cap {
4272 __vki_u16 service_set;
4273 __vki_u16 service_lines[2][24];
4274 __vki_u32 type; /* enum vki_v4l2_buf_type */
4275 __vki_u32 reserved[3]; /* must be 0 */
4278 struct vki_v4l2_sliced_vbi_data {
4279 __vki_u32 id;
4280 __vki_u32 field; /* 0: first field, 1: second field */
4281 __vki_u32 line; /* 1-23 */
4282 __vki_u32 reserved; /* must be 0 */
4283 __vki_u8 data[48];
4286 struct vki_v4l2_plane_pix_format {
4287 __vki_u32 sizeimage;
4288 __vki_u32 bytesperline;
4289 __vki_u16 reserved[6];
4290 } __attribute__ ((packed));
4292 #define VKI_VIDEO_MAX_PLANES 8
4294 struct vki_v4l2_pix_format_mplane {
4295 __vki_u32 width;
4296 __vki_u32 height;
4297 __vki_u32 pixelformat;
4298 __vki_u32 field;
4299 __vki_u32 colorspace;
4301 struct vki_v4l2_plane_pix_format plane_fmt[VKI_VIDEO_MAX_PLANES];
4302 __vki_u8 num_planes;
4303 __vki_u8 flags;
4304 __vki_u8 ycbcr_enc;
4305 __vki_u8 quantization;
4306 __vki_u8 reserved[8];
4307 } __attribute__ ((packed));
4309 struct vki_v4l2_sdr_format {
4310 __vki_u32 pixelformat;
4311 __vki_u32 buffersize;
4312 __vki_u8 reserved[24];
4313 } __attribute__ ((packed));
4315 enum vki_v4l2_buf_type {
4316 VKI_V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
4317 VKI_V4L2_BUF_TYPE_VIDEO_OUTPUT = 2,
4318 VKI_V4L2_BUF_TYPE_VIDEO_OVERLAY = 3,
4319 VKI_V4L2_BUF_TYPE_VBI_CAPTURE = 4,
4320 VKI_V4L2_BUF_TYPE_VBI_OUTPUT = 5,
4321 VKI_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
4322 VKI_V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7,
4323 VKI_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
4324 VKI_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
4325 VKI_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10,
4326 VKI_V4L2_BUF_TYPE_SDR_CAPTURE = 11,
4329 struct vki_v4l2_format {
4330 __vki_u32 type;
4331 union {
4332 struct vki_v4l2_pix_format pix;
4333 struct vki_v4l2_pix_format_mplane pix_mp;
4334 struct vki_v4l2_window win;
4335 struct vki_v4l2_vbi_format vbi;
4336 struct vki_v4l2_sliced_vbi_format sliced;
4337 struct vki_v4l2_sdr_format sdr;
4338 __vki_u8 raw_data[200];
4339 } fmt;
4342 struct vki_v4l2_streamparm {
4343 __vki_u32 type;
4344 union {
4345 struct vki_v4l2_captureparm capture;
4346 struct vki_v4l2_outputparm output;
4347 __vki_u8 raw_data[200]; /* user-defined */
4348 } parm;
4351 struct vki_v4l2_event_vsync {
4352 __vki_u8 field;
4353 } __attribute__ ((packed));
4355 struct vki_v4l2_event_ctrl {
4356 __vki_u32 changes;
4357 __vki_u32 type;
4358 union {
4359 __vki_s32 value;
4360 __vki_s64 value64;
4362 __vki_u32 flags;
4363 __vki_s32 minimum;
4364 __vki_s32 maximum;
4365 __vki_s32 step;
4366 __vki_s32 default_value;
4369 struct vki_v4l2_event_frame_sync {
4370 __vki_u32 frame_sequence;
4373 struct vki_v4l2_event_src_change {
4374 __vki_u32 changes;
4377 struct vki_v4l2_event_motion_det {
4378 __vki_u32 flags;
4379 __vki_u32 frame_sequence;
4380 __vki_u32 region_mask;
4383 struct vki_v4l2_event {
4384 __vki_u32 type;
4385 union {
4386 struct vki_v4l2_event_vsync vsync;
4387 struct vki_v4l2_event_ctrl ctrl;
4388 struct vki_v4l2_event_frame_sync frame_sync;
4389 struct vki_v4l2_event_src_change src_change;
4390 struct vki_v4l2_event_motion_det motion_det;
4391 __vki_u8 data[64];
4392 } u;
4393 __vki_u32 pending;
4394 __vki_u32 sequence;
4395 struct vki_timespec timestamp;
4396 __vki_u32 id;
4397 __vki_u32 reserved[8];
4400 struct vki_v4l2_event_subscription {
4401 __vki_u32 type;
4402 __vki_u32 id;
4403 __vki_u32 flags;
4404 __vki_u32 reserved[5];
4407 struct vki_v4l2_dbg_match {
4408 __vki_u32 type; /* Match type */
4409 union { /* Match this chip, meaning determined by type */
4410 __vki_u32 addr;
4411 char name[32];
4413 } __attribute__ ((packed));
4415 struct vki_v4l2_dbg_register {
4416 struct vki_v4l2_dbg_match match;
4417 __vki_u32 size; /* register size in bytes */
4418 __vki_u64 reg;
4419 __vki_u64 val;
4420 } __attribute__ ((packed));
4422 struct vki_v4l2_dbg_chip_info {
4423 struct vki_v4l2_dbg_match match;
4424 char name[32];
4425 __vki_u32 flags;
4426 __vki_u32 reserved[32];
4427 } __attribute__ ((packed));
4429 struct vki_v4l2_create_buffers {
4430 __vki_u32 index;
4431 __vki_u32 count;
4432 __vki_u32 memory;
4433 struct vki_v4l2_format format;
4434 __vki_u32 reserved[8];
4437 struct vki_v4l2_edid {
4438 __vki_u32 pad;
4439 __vki_u32 start_block;
4440 __vki_u32 blocks;
4441 __vki_u32 reserved[5];
4442 __vki_u8 *edid;
4445 #define VKI_V4L2_QUERYCAP _VKI_IOR('V', 0, struct vki_v4l2_capability)
4446 #define VKI_V4L2_ENUM_FMT _VKI_IOWR('V', 2, struct vki_v4l2_fmtdesc)
4447 #define VKI_V4L2_G_FMT _VKI_IOWR('V', 4, struct vki_v4l2_format)
4448 #define VKI_V4L2_S_FMT _VKI_IOWR('V', 5, struct vki_v4l2_format)
4449 #define VKI_V4L2_REQBUFS _VKI_IOWR('V', 8, struct vki_v4l2_requestbuffers)
4450 #define VKI_V4L2_QUERYBUF _VKI_IOWR('V', 9, struct vki_v4l2_buffer)
4451 #define VKI_V4L2_G_FBUF _VKI_IOR('V', 10, struct vki_v4l2_framebuffer)
4452 #define VKI_V4L2_S_FBUF _VKI_IOW('V', 11, struct vki_v4l2_framebuffer)
4453 #define VKI_V4L2_OVERLAY _VKI_IOW('V', 14, int)
4454 #define VKI_V4L2_QBUF _VKI_IOWR('V', 15, struct vki_v4l2_buffer)
4455 #define VKI_V4L2_EXPBUF _VKI_IOWR('V', 16, struct vki_v4l2_exportbuffer)
4456 #define VKI_V4L2_DQBUF _VKI_IOWR('V', 17, struct vki_v4l2_buffer)
4457 #define VKI_V4L2_STREAMON _VKI_IOW('V', 18, int)
4458 #define VKI_V4L2_STREAMOFF _VKI_IOW('V', 19, int)
4459 #define VKI_V4L2_G_PARM _VKI_IOWR('V', 21, struct vki_v4l2_streamparm)
4460 #define VKI_V4L2_S_PARM _VKI_IOWR('V', 22, struct vki_v4l2_streamparm)
4461 #define VKI_V4L2_G_STD _VKI_IOR('V', 23, vki_v4l2_std_id)
4462 #define VKI_V4L2_S_STD _VKI_IOW('V', 24, vki_v4l2_std_id)
4463 #define VKI_V4L2_ENUMSTD _VKI_IOWR('V', 25, struct vki_v4l2_standard)
4464 #define VKI_V4L2_ENUMINPUT _VKI_IOWR('V', 26, struct vki_v4l2_input)
4465 #define VKI_V4L2_G_CTRL _VKI_IOWR('V', 27, struct vki_v4l2_control)
4466 #define VKI_V4L2_S_CTRL _VKI_IOWR('V', 28, struct vki_v4l2_control)
4467 #define VKI_V4L2_G_TUNER _VKI_IOWR('V', 29, struct vki_v4l2_tuner)
4468 #define VKI_V4L2_S_TUNER _VKI_IOW('V', 30, struct vki_v4l2_tuner)
4469 #define VKI_V4L2_G_AUDIO _VKI_IOR('V', 33, struct vki_v4l2_audio)
4470 #define VKI_V4L2_S_AUDIO _VKI_IOW('V', 34, struct vki_v4l2_audio)
4471 #define VKI_V4L2_QUERYCTRL _VKI_IOWR('V', 36, struct vki_v4l2_queryctrl)
4472 #define VKI_V4L2_QUERYMENU _VKI_IOWR('V', 37, struct vki_v4l2_querymenu)
4473 #define VKI_V4L2_G_INPUT _VKI_IOR('V', 38, int)
4474 #define VKI_V4L2_S_INPUT _VKI_IOWR('V', 39, int)
4475 #define VKI_V4L2_G_EDID _VKI_IOWR('V', 40, struct vki_v4l2_edid)
4476 #define VKI_V4L2_S_EDID _VKI_IOWR('V', 41, struct vki_v4l2_edid)
4477 #define VKI_V4L2_G_OUTPUT _VKI_IOR('V', 46, int)
4478 #define VKI_V4L2_S_OUTPUT _VKI_IOWR('V', 47, int)
4479 #define VKI_V4L2_ENUMOUTPUT _VKI_IOWR('V', 48, struct vki_v4l2_output)
4480 #define VKI_V4L2_G_AUDOUT _VKI_IOR('V', 49, struct vki_v4l2_audioout)
4481 #define VKI_V4L2_S_AUDOUT _VKI_IOW('V', 50, struct vki_v4l2_audioout)
4482 #define VKI_V4L2_G_MODULATOR _VKI_IOWR('V', 54, struct vki_v4l2_modulator)
4483 #define VKI_V4L2_S_MODULATOR _VKI_IOW('V', 55, struct vki_v4l2_modulator)
4484 #define VKI_V4L2_G_FREQUENCY _VKI_IOWR('V', 56, struct vki_v4l2_frequency)
4485 #define VKI_V4L2_S_FREQUENCY _VKI_IOW('V', 57, struct vki_v4l2_frequency)
4486 #define VKI_V4L2_CROPCAP _VKI_IOWR('V', 58, struct vki_v4l2_cropcap)
4487 #define VKI_V4L2_G_CROP _VKI_IOWR('V', 59, struct vki_v4l2_crop)
4488 #define VKI_V4L2_S_CROP _VKI_IOW('V', 60, struct vki_v4l2_crop)
4489 #define VKI_V4L2_G_JPEGCOMP _VKI_IOR('V', 61, struct vki_v4l2_jpegcompression)
4490 #define VKI_V4L2_S_JPEGCOMP _VKI_IOW('V', 62, struct vki_v4l2_jpegcompression)
4491 #define VKI_V4L2_QUERYSTD _VKI_IOR('V', 63, vki_v4l2_std_id)
4492 #define VKI_V4L2_TRY_FMT _VKI_IOWR('V', 64, struct vki_v4l2_format)
4493 #define VKI_V4L2_ENUMAUDIO _VKI_IOWR('V', 65, struct vki_v4l2_audio)
4494 #define VKI_V4L2_ENUMAUDOUT _VKI_IOWR('V', 66, struct vki_v4l2_audioout)
4495 #define VKI_V4L2_G_PRIORITY _VKI_IOR('V', 67, __vki_u32)
4496 #define VKI_V4L2_S_PRIORITY _VKI_IOW('V', 68, __vki_u32)
4497 #define VKI_V4L2_G_SLICED_VBI_CAP _VKI_IOWR('V', 69, struct vki_v4l2_sliced_vbi_cap)
4498 #define VKI_V4L2_LOG_STATUS _VKI_IO('V', 70)
4499 #define VKI_V4L2_G_EXT_CTRLS _VKI_IOWR('V', 71, struct vki_v4l2_ext_controls)
4500 #define VKI_V4L2_S_EXT_CTRLS _VKI_IOWR('V', 72, struct vki_v4l2_ext_controls)
4501 #define VKI_V4L2_TRY_EXT_CTRLS _VKI_IOWR('V', 73, struct vki_v4l2_ext_controls)
4502 #define VKI_V4L2_ENUM_FRAMESIZES _VKI_IOWR('V', 74, struct vki_v4l2_frmsizeenum)
4503 #define VKI_V4L2_ENUM_FRAMEINTERVALS _VKI_IOWR('V', 75, struct vki_v4l2_frmivalenum)
4504 #define VKI_V4L2_G_ENC_INDEX _VKI_IOR('V', 76, struct vki_v4l2_enc_idx)
4505 #define VKI_V4L2_ENCODER_CMD _VKI_IOWR('V', 77, struct vki_v4l2_encoder_cmd)
4506 #define VKI_V4L2_TRY_ENCODER_CMD _VKI_IOWR('V', 78, struct vki_v4l2_encoder_cmd)
4507 #define VKI_V4L2_DBG_S_REGISTER _VKI_IOW('V', 79, struct vki_v4l2_dbg_register)
4508 #define VKI_V4L2_DBG_G_REGISTER _VKI_IOWR('V', 80, struct vki_v4l2_dbg_register)
4509 #define VKI_V4L2_S_HW_FREQ_SEEK _VKI_IOW('V', 82, struct vki_v4l2_hw_freq_seek)
4510 #define VKI_V4L2_S_DV_TIMINGS _VKI_IOWR('V', 87, struct vki_v4l2_dv_timings)
4511 #define VKI_V4L2_G_DV_TIMINGS _VKI_IOWR('V', 88, struct vki_v4l2_dv_timings)
4512 #define VKI_V4L2_DQEVENT _VKI_IOR('V', 89, struct vki_v4l2_event)
4513 #define VKI_V4L2_SUBSCRIBE_EVENT _VKI_IOW('V', 90, struct vki_v4l2_event_subscription)
4514 #define VKI_V4L2_UNSUBSCRIBE_EVENT _VKI_IOW('V', 91, struct vki_v4l2_event_subscription)
4515 #define VKI_V4L2_CREATE_BUFS _VKI_IOWR('V', 92, struct vki_v4l2_create_buffers)
4516 #define VKI_V4L2_PREPARE_BUF _VKI_IOWR('V', 93, struct vki_v4l2_buffer)
4517 #define VKI_V4L2_G_SELECTION _VKI_IOWR('V', 94, struct vki_v4l2_selection)
4518 #define VKI_V4L2_S_SELECTION _VKI_IOWR('V', 95, struct vki_v4l2_selection)
4519 #define VKI_V4L2_DECODER_CMD _VKI_IOWR('V', 96, struct vki_v4l2_decoder_cmd)
4520 #define VKI_V4L2_TRY_DECODER_CMD _VKI_IOWR('V', 97, struct vki_v4l2_decoder_cmd)
4521 #define VKI_V4L2_ENUM_DV_TIMINGS _VKI_IOWR('V', 98, struct vki_v4l2_enum_dv_timings)
4522 #define VKI_V4L2_QUERY_DV_TIMINGS _VKI_IOR('V', 99, struct vki_v4l2_dv_timings)
4523 #define VKI_V4L2_DV_TIMINGS_CAP _VKI_IOWR('V', 100, struct vki_v4l2_dv_timings_cap)
4524 #define VKI_V4L2_ENUM_FREQ_BANDS _VKI_IOWR('V', 101, struct vki_v4l2_frequency_band)
4525 #define VKI_V4L2_DBG_G_CHIP_INFO _VKI_IOWR('V', 102, struct vki_v4l2_dbg_chip_info)
4526 #define VKI_V4L2_QUERY_EXT_CTRL _VKI_IOWR('V', 103, struct vki_v4l2_query_ext_ctrl)
4528 struct vki_v4l2_mbus_framefmt {
4529 __vki_u32 width;
4530 __vki_u32 height;
4531 __vki_u32 code;
4532 __vki_u32 field;
4533 __vki_u32 colorspace;
4534 __vki_u16 ycbcr_enc;
4535 __vki_u16 quantization;
4536 __vki_u32 reserved[6];
4539 struct vki_v4l2_subdev_format {
4540 __vki_u32 which;
4541 __vki_u32 pad;
4542 struct vki_v4l2_mbus_framefmt format;
4543 __vki_u32 reserved[8];
4546 struct vki_v4l2_subdev_crop {
4547 __vki_u32 which;
4548 __vki_u32 pad;
4549 struct vki_v4l2_rect rect;
4550 __vki_u32 reserved[8];
4553 struct vki_v4l2_subdev_mbus_code_enum {
4554 __vki_u32 pad;
4555 __vki_u32 index;
4556 __vki_u32 code;
4557 __vki_u32 which;
4558 __vki_u32 reserved[8];
4561 struct vki_v4l2_subdev_frame_size_enum {
4562 __vki_u32 index;
4563 __vki_u32 pad;
4564 __vki_u32 code;
4565 __vki_u32 min_width;
4566 __vki_u32 max_width;
4567 __vki_u32 min_height;
4568 __vki_u32 max_height;
4569 __vki_u32 which;
4570 __vki_u32 reserved[8];
4573 struct vki_v4l2_subdev_frame_interval {
4574 __vki_u32 pad;
4575 struct vki_v4l2_fract interval;
4576 __vki_u32 reserved[9];
4579 struct vki_v4l2_subdev_frame_interval_enum {
4580 __vki_u32 index;
4581 __vki_u32 pad;
4582 __vki_u32 code;
4583 __vki_u32 width;
4584 __vki_u32 height;
4585 struct vki_v4l2_fract interval;
4586 __vki_u32 which;
4587 __vki_u32 reserved[8];
4590 struct vki_v4l2_subdev_selection {
4591 __vki_u32 which;
4592 __vki_u32 pad;
4593 __vki_u32 target;
4594 __vki_u32 flags;
4595 struct vki_v4l2_rect r;
4596 __vki_u32 reserved[8];
4599 #define VKI_V4L2_SUBDEV_G_FMT _VKI_IOWR('V', 4, struct vki_v4l2_subdev_format)
4600 #define VKI_V4L2_SUBDEV_S_FMT _VKI_IOWR('V', 5, struct vki_v4l2_subdev_format)
4601 #define VKI_V4L2_SUBDEV_G_FRAME_INTERVAL _VKI_IOWR('V', 21, struct vki_v4l2_subdev_frame_interval)
4602 #define VKI_V4L2_SUBDEV_S_FRAME_INTERVAL _VKI_IOWR('V', 22, struct vki_v4l2_subdev_frame_interval)
4603 #define VKI_V4L2_SUBDEV_ENUM_MBUS_CODE _VKI_IOWR('V', 2, struct vki_v4l2_subdev_mbus_code_enum)
4604 #define VKI_V4L2_SUBDEV_ENUM_FRAME_SIZE _VKI_IOWR('V', 74, struct vki_v4l2_subdev_frame_size_enum)
4605 #define VKI_V4L2_SUBDEV_ENUM_FRAME_INTERVAL _VKI_IOWR('V', 75, struct vki_v4l2_subdev_frame_interval_enum)
4606 #define VKI_V4L2_SUBDEV_G_CROP _VKI_IOWR('V', 59, struct vki_v4l2_subdev_crop)
4607 #define VKI_V4L2_SUBDEV_S_CROP _VKI_IOWR('V', 60, struct vki_v4l2_subdev_crop)
4608 #define VKI_V4L2_SUBDEV_G_SELECTION _VKI_IOWR('V', 61, struct vki_v4l2_subdev_selection)
4609 #define VKI_V4L2_SUBDEV_S_SELECTION _VKI_IOWR('V', 62, struct vki_v4l2_subdev_selection)
4611 struct vki_media_device_info {
4612 char driver[16];
4613 char model[32];
4614 char serial[40];
4615 char bus_info[32];
4616 __vki_u32 media_version;
4617 __vki_u32 hw_revision;
4618 __vki_u32 driver_version;
4619 __vki_u32 reserved[31];
4622 struct vki_media_entity_desc {
4623 __vki_u32 id;
4624 char name[32];
4625 __vki_u32 type;
4626 __vki_u32 revision;
4627 __vki_u32 flags;
4628 __vki_u32 group_id;
4629 __vki_u16 pads;
4630 __vki_u16 links;
4632 __vki_u32 reserved[4];
4634 union {
4635 /* Node specifications */
4636 struct {
4637 __vki_u32 major;
4638 __vki_u32 minor;
4639 } v4l;
4640 struct {
4641 __vki_u32 major;
4642 __vki_u32 minor;
4643 } fb;
4644 struct {
4645 __vki_u32 card;
4646 __vki_u32 device;
4647 __vki_u32 subdevice;
4648 } alsa;
4649 int dvb;
4651 /* Sub-device specifications */
4652 /* Nothing needed yet */
4653 __vki_u8 raw[184];
4657 struct vki_media_pad_desc {
4658 __vki_u32 entity; /* entity ID */
4659 __vki_u16 index; /* pad index */
4660 __vki_u32 flags; /* pad flags */
4661 __vki_u32 reserved[2];
4664 struct vki_media_link_desc {
4665 struct vki_media_pad_desc source;
4666 struct vki_media_pad_desc sink;
4667 __vki_u32 flags;
4668 __vki_u32 reserved[2];
4671 struct vki_media_links_enum {
4672 __vki_u32 entity;
4673 struct vki_media_pad_desc __user *pads;
4674 struct vki_media_link_desc __user *links;
4675 __vki_u32 reserved[4];
4678 #define VKI_MEDIA_IOC_DEVICE_INFO _VKI_IOWR('|', 0x00, struct vki_media_device_info)
4679 #define VKI_MEDIA_IOC_ENUM_ENTITIES _VKI_IOWR('|', 0x01, struct vki_media_entity_desc)
4680 #define VKI_MEDIA_IOC_ENUM_LINKS _VKI_IOWR('|', 0x02, struct vki_media_links_enum)
4681 #define VKI_MEDIA_IOC_SETUP_LINK _VKI_IOWR('|', 0x03, struct vki_media_link_desc)
4683 /* DVB demux API */
4684 #define VKI_DMX_STOP _VKI_IO('o', 42)
4686 /* Comparison type */
4687 enum vki_kcmp_type {
4688 VKI_KCMP_FILE,
4689 VKI_KCMP_VM,
4690 VKI_KCMP_FILES,
4691 VKI_KCMP_FS,
4692 VKI_KCMP_SIGHAND,
4693 VKI_KCMP_IO,
4694 VKI_KCMP_SYSVSEM,
4696 VKI_KCMP_TYPES
4699 //----------------------------------------------------------------------
4700 // From linux-3.19-rc5/include/uapi/linux/seccomp.h
4701 //----------------------------------------------------------------------
4703 #define VKI_SECCOMP_MODE_FILTER 2
4705 //----------------------------------------------------------------------
4706 // From linux-3.19.3/include/uapi/linux/binfmts.h
4707 //----------------------------------------------------------------------
4708 #define VKI_BINPRM_BUF_SIZE 128
4710 //----------------------------------------------------------------------
4711 // From linux-3.19.0/include/linux/serial.h
4712 //----------------------------------------------------------------------
4714 struct vki_serial_struct {
4715 int type;
4716 int line;
4717 unsigned int port;
4718 int irq;
4719 int flags;
4720 int xmit_fifo_size;
4721 int custom_divisor;
4722 int baud_base;
4723 unsigned short close_delay;
4724 char io_type;
4725 char reserved_char[1];
4726 int hub6;
4727 unsigned short closing_wait; /* time to wait before closing */
4728 unsigned short closing_wait2; /* no longer used... */
4729 unsigned char *iomem_base;
4730 unsigned short iomem_reg_shift;
4731 unsigned int port_high;
4732 unsigned long iomap_base; /* cookie passed into ioremap */
4735 //----------------------------------------------------------------------
4736 // From linux-3.19.0/fs/binfmt_elf.c
4737 //----------------------------------------------------------------------
4739 #if !defined(VKI_INIT_ARCH_ELF_STATE)
4740 /* This structure is used to preserve architecture specific data during
4741 the loading of an ELF file, throughout the checking of architecture
4742 specific ELF headers & through to the point where the ELF load is
4743 known to be proceeding. This implementation is a dummy for
4744 architectures which require no specific state. */
4745 struct vki_arch_elf_state {
4748 # define VKI_INIT_ARCH_ELF_STATE { }
4750 #endif
4752 //----------------------------------------------------------------------
4753 // From linux-4.0/include/uapi/linux/prctl.h
4754 //----------------------------------------------------------------------
4756 #define VKI_PR_SET_FP_MODE 45
4757 #define VKI_PR_GET_FP_MODE 46
4758 # define VKI_PR_FP_MODE_FR (1 << 0) /* 64b FP registers */
4759 # define VKI_PR_FP_MODE_FRE (1 << 1) /* 32b compatibility */
4761 #endif // __VKI_LINUX_H
4763 /*--------------------------------------------------------------------*/
4764 /*--- end ---*/
4765 /*--------------------------------------------------------------------*/