2 /*--------------------------------------------------------------------*/
3 /*--- Linux-specific kernel interface. vki-linux.h ---*/
4 /*--------------------------------------------------------------------*/
7 This file is part of Valgrind, a dynamic binary instrumentation
10 Copyright (C) 2000-2013 Julian Seward
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
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
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
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.
78 //----------------------------------------------------------------------
79 // Arch-specific POSIX types
80 //----------------------------------------------------------------------
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 #elif defined(VGA_tilegx)
101 # include "vki-posixtypes-tilegx-linux.h"
103 # error Unknown platform
106 //----------------------------------------------------------------------
107 // VKI_STATIC_ASSERT(). Inspired by BUILD_BUG_ON() from
108 // linux-2.6.34/include/linux/kernel.h
109 //----------------------------------------------------------------------
112 * Evaluates to zero if 'expr' is true and forces a compilation error if
113 * 'expr' is false. Can be used in a context where no comma expressions
117 template <bool b
> struct vki_static_assert
{ int m_bitfield
:(2*b
-1); };
118 #define VKI_STATIC_ASSERT(expr) \
119 (sizeof(vki_static_assert<(expr)>) - sizeof(int))
121 #define VKI_STATIC_ASSERT(expr) (sizeof(struct { int:-!(expr); }))
124 //----------------------------------------------------------------------
125 // Based on _IOC_TYPECHECK() from linux-2.6.34/asm-generic/ioctl.h
126 //----------------------------------------------------------------------
128 /* provoke compile error for invalid uses of size argument */
129 #define _VKI_IOC_TYPECHECK(t) \
130 (VKI_STATIC_ASSERT((sizeof(t) == sizeof(t[1]) \
131 && sizeof(t) < (1 << _VKI_IOC_SIZEBITS))) \
134 //----------------------------------------------------------------------
135 // From linux-2.6.8.1/include/linux/compiler.h
136 //----------------------------------------------------------------------
140 //----------------------------------------------------------------------
141 // From linux/include/linux/compiler-gcc.h
142 //----------------------------------------------------------------------
145 #define __vki_packed __attribute__((packed))
148 //----------------------------------------------------------------------
149 // From linux-2.6.8.1/include/linux/posix_types.h
150 //----------------------------------------------------------------------
153 #define __VKI_NFDBITS (8 * sizeof(unsigned long))
155 #undef __VKI_FD_SETSIZE
156 #define __VKI_FD_SETSIZE 1024
158 #undef __VKI_FDSET_LONGS
159 #define __VKI_FDSET_LONGS (__VKI_FD_SETSIZE/__VKI_NFDBITS)
162 #define __VKI_FDELT(d) ((d) / __VKI_NFDBITS)
165 #define __VKI_FDMASK(d) (1UL << ((d) % __VKI_NFDBITS))
168 unsigned long fds_bits
[__VKI_FDSET_LONGS
];
169 } __vki_kernel_fd_set
;
171 typedef int __vki_kernel_key_t
;
172 typedef int __vki_kernel_mqd_t
;
174 //----------------------------------------------------------------------
175 // From linux-2.6.8.1/include/linux/types.h
176 //----------------------------------------------------------------------
178 typedef __vki_kernel_fd_set vki_fd_set
;
179 typedef __vki_kernel_mode_t vki_mode_t
;
180 typedef __vki_kernel_off_t vki_off_t
;
181 typedef __vki_kernel_pid_t vki_pid_t
;
182 typedef __vki_kernel_key_t vki_key_t
;
183 typedef __vki_kernel_suseconds_t vki_suseconds_t
;
184 typedef __vki_kernel_timer_t vki_timer_t
;
185 typedef __vki_kernel_clockid_t vki_clockid_t
;
186 typedef __vki_kernel_mqd_t vki_mqd_t
;
188 // [[Nb: it's a bit unclear due to a #ifdef, but I think this is right. --njn]]
189 typedef __vki_kernel_uid32_t vki_uid_t
;
190 typedef __vki_kernel_gid32_t vki_gid_t
;
192 typedef __vki_kernel_old_uid_t vki_old_uid_t
;
193 typedef __vki_kernel_old_gid_t vki_old_gid_t
;
195 typedef __vki_kernel_loff_t vki_loff_t
;
197 typedef __vki_kernel_size_t vki_size_t
;
198 typedef __vki_kernel_time_t vki_time_t
;
199 typedef __vki_kernel_clock_t vki_clock_t
;
200 typedef __vki_kernel_caddr_t vki_caddr_t
;
202 typedef unsigned long vki_u_long
;
204 typedef unsigned int vki_uint
;
206 //----------------------------------------------------------------------
207 // Now the rest of the arch-specific stuff
208 //----------------------------------------------------------------------
211 # include "vki-x86-linux.h"
212 #elif defined(VGA_amd64)
213 # include "vki-amd64-linux.h"
214 #elif defined(VGA_ppc32)
215 # include "vki-ppc32-linux.h"
216 #elif defined(VGA_ppc64be) || defined(VGA_ppc64le)
217 # include "vki-ppc64-linux.h"
218 #elif defined(VGA_arm)
219 # include "vki-arm-linux.h"
220 #elif defined(VGA_arm64)
221 # include "vki-arm64-linux.h"
222 #elif defined(VGA_s390x)
223 # include "vki-s390x-linux.h"
224 #elif defined(VGA_mips32)
225 # include "vki-mips32-linux.h"
226 #elif defined(VGA_mips64)
227 # include "vki-mips64-linux.h"
228 #elif defined(VGA_tilegx)
229 # include "vki-tilegx-linux.h"
231 # error Unknown platform
234 //----------------------------------------------------------------------
235 // From linux-2.6.20.1/include/linux/types.h
236 //----------------------------------------------------------------------
238 typedef __vki_s32 vki_int32_t
;
239 typedef __vki_s16 vki_int16_t
;
240 typedef __vki_s64 vki_int64_t
;
242 typedef __vki_u8 vki_uint8_t
;
243 typedef __vki_u16 vki_uint16_t
;
244 typedef __vki_u32 vki_uint32_t
;
245 typedef __vki_u64 vki_uint64_t
;
247 typedef __vki_u16 __vki_le16
;
249 //----------------------------------------------------------------------
250 // From linux-2.6.8.1/include/linux/limits.h
251 //----------------------------------------------------------------------
253 #define VKI_PATH_MAX 4096 /* # chars in a path name including nul */
255 //----------------------------------------------------------------------
256 // From linux-2.6.8.1/include/linux/kernel.h
257 //----------------------------------------------------------------------
260 long uptime
; /* Seconds since boot */
261 unsigned long loads
[3]; /* 1, 5, and 15 minute load averages */
262 unsigned long totalram
; /* Total usable main memory size */
263 unsigned long freeram
; /* Available memory size */
264 unsigned long sharedram
; /* Amount of shared memory */
265 unsigned long bufferram
; /* Memory used by buffers */
266 unsigned long totalswap
; /* Total swap space size */
267 unsigned long freeswap
; /* swap space still available */
268 unsigned short procs
; /* Number of current processes */
269 unsigned short pad
; /* explicit padding for m68k */
270 unsigned long totalhigh
; /* Total high memory size */
271 unsigned long freehigh
; /* Available high memory size */
272 unsigned int mem_unit
; /* Memory unit size in bytes */
273 char _f
[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
276 //----------------------------------------------------------------------
277 // From linux-2.6.8.1/include/linux/time.h
278 //----------------------------------------------------------------------
280 #define VKI_CLOCK_REALTIME 0
281 #define VKI_CLOCK_MONOTONIC 1
282 #define VKI_CLOCK_PROCESS_CPUTIME_ID 2
283 #define VKI_CLOCK_THREAD_CPUTIME_ID 3
285 struct vki_timespec
{
286 vki_time_t tv_sec
; /* seconds */
287 long tv_nsec
; /* nanoseconds */
291 vki_time_t tv_sec
; /* seconds */
292 vki_suseconds_t tv_usec
; /* microseconds */
295 struct vki_timezone
{
296 int tz_minuteswest
; /* minutes west of Greenwich */
297 int tz_dsttime
; /* type of dst correction */
300 struct vki_itimerspec
{
301 struct vki_timespec it_interval
; /* timer period */
302 struct vki_timespec it_value
; /* timer expiration */
305 struct vki_itimerval
{
306 struct vki_timeval it_interval
; /* timer interval */
307 struct vki_timeval it_value
; /* current value */
310 //----------------------------------------------------------------------
311 // From linux-2.6.8.1/include/linux/timex.h
312 //----------------------------------------------------------------------
315 unsigned int modes
; /* mode selector */
316 long offset
; /* time offset (usec) */
317 long freq
; /* frequency offset (scaled ppm) */
318 long maxerror
; /* maximum error (usec) */
319 long esterror
; /* estimated error (usec) */
320 int status
; /* clock command/status */
321 long constant
; /* pll time constant */
322 long precision
; /* clock precision (usec) (read only) */
323 long tolerance
; /* clock frequency tolerance (ppm)
326 struct vki_timeval time
; /* (read only) */
327 long tick
; /* (modified) usecs between clock ticks */
329 long ppsfreq
; /* pps frequency (scaled ppm) (ro) */
330 long jitter
; /* pps jitter (us) (ro) */
331 int shift
; /* interval duration (s) (shift) (ro) */
332 long stabil
; /* pps stability (scaled ppm) (ro) */
333 long jitcnt
; /* jitter limit exceeded (ro) */
334 long calcnt
; /* calibration intervals (ro) */
335 long errcnt
; /* calibration errors (ro) */
336 long stbcnt
; /* stability limit exceeded (ro) */
338 int :32; int :32; int :32; int :32;
339 int :32; int :32; int :32; int :32;
340 int :32; int :32; int :32; int :32;
343 #define VKI_ADJ_OFFSET 0x0001 /* time offset */
344 #define VKI_ADJ_FREQUENCY 0x0002 /* frequency offset */
345 #define VKI_ADJ_MAXERROR 0x0004 /* maximum time error */
346 #define VKI_ADJ_ESTERROR 0x0008 /* estimated time error */
347 #define VKI_ADJ_STATUS 0x0010 /* clock status */
348 #define VKI_ADJ_TIMECONST 0x0020 /* pll time constant */
349 #define VKI_ADJ_TAI 0x0080 /* set TAI offset */
350 #define VKI_ADJ_TICK 0x4000 /* tick value */
351 #define VKI_ADJ_ADJTIME 0x8000 /* switch between adjtime/adjtimex modes */
352 //#define VKI_ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
353 #define VKI_ADJ_OFFSET_READONLY 0x2000 /* read-only adjtime */
355 //----------------------------------------------------------------------
356 // From linux-2.6.8.1/include/linux/times.h
357 //----------------------------------------------------------------------
360 vki_clock_t tms_utime
;
361 vki_clock_t tms_stime
;
362 vki_clock_t tms_cutime
;
363 vki_clock_t tms_cstime
;
366 //----------------------------------------------------------------------
367 // From linux-2.6.8.1/include/linux/utime.h
368 //----------------------------------------------------------------------
375 //----------------------------------------------------------------------
376 // From linux-2.6.8.1/include/linux/sched.h
377 //----------------------------------------------------------------------
379 #define VKI_CSIGNAL 0x000000ff /* signal mask to be sent at exit */
380 #define VKI_CLONE_VM 0x00000100 /* set if VM shared between processes */
381 #define VKI_CLONE_FS 0x00000200 /* set if fs info shared between processes */
382 #define VKI_CLONE_FILES 0x00000400 /* set if open files shared between processes */
383 #define VKI_CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */
384 #define VKI_CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
385 #define VKI_CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
386 #define VKI_CLONE_THREAD 0x00010000 /* Same thread group? */
387 #define VKI_CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */
388 #define VKI_CLONE_SETTLS 0x00080000 /* create a new TLS for the child */
389 #define VKI_CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */
390 #define VKI_CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */
391 #define VKI_CLONE_DETACHED 0x00400000 /* Unused, ignored */
392 #define VKI_CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
394 struct vki_sched_param
{
398 #define VKI_TASK_COMM_LEN 16
400 //----------------------------------------------------------------------
401 // From linux-2.6.8.1/include/asm-generic/siginfo.h
402 //----------------------------------------------------------------------
404 // Some archs, such as MIPS, have non-standard vki_siginfo.
405 #ifndef HAVE_ARCH_SIGINFO_T
406 typedef union vki_sigval
{
408 void __user
*sival_ptr
;
411 #ifndef __VKI_ARCH_SI_PREAMBLE_SIZE
412 #define __VKI_ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
415 #define VKI_SI_MAX_SIZE 128
417 #ifndef VKI_SI_PAD_SIZE
418 #define VKI_SI_PAD_SIZE ((VKI_SI_MAX_SIZE - __VKI_ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
421 #ifndef __VKI_ARCH_SI_UID_T
422 #define __VKI_ARCH_SI_UID_T vki_uid_t
425 #ifndef __VKI_ARCH_SI_BAND_T
426 #define __VKI_ARCH_SI_BAND_T long
429 // [[Nb: this type changed between 2.4 and 2.6, but not in a way that
430 // affects Valgrind.]]
431 typedef struct vki_siginfo
{
437 int _pad
[VKI_SI_PAD_SIZE
];
441 vki_pid_t _pid
; /* sender's pid */
442 __VKI_ARCH_SI_UID_T _uid
; /* sender's uid */
445 /* POSIX.1b timers */
447 vki_timer_t _tid
; /* timer id */
448 int _overrun
; /* overrun count */
449 char _pad
[sizeof( __VKI_ARCH_SI_UID_T
) - sizeof(int)];
450 vki_sigval_t _sigval
; /* same as below */
451 int _sys_private
; /* not to be passed to user */
454 /* POSIX.1b signals */
456 vki_pid_t _pid
; /* sender's pid */
457 __VKI_ARCH_SI_UID_T _uid
; /* sender's uid */
458 vki_sigval_t _sigval
;
463 vki_pid_t _pid
; /* which child */
464 __VKI_ARCH_SI_UID_T _uid
; /* sender's uid */
465 int _status
; /* exit code */
470 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
472 void __user
*_addr
; /* faulting insn/memory ref. */
473 #ifdef __ARCH_SI_TRAPNO
474 int _trapno
; /* TRAP # which caused the signal */
480 __VKI_ARCH_SI_BAND_T _band
; /* POLL_IN, POLL_OUT, POLL_MSG */
487 #define __VKI_SI_FAULT 0
491 * Digital reserves positive values for kernel-generated signals.
493 #define VKI_SI_USER 0 /* sent by kill, sigsend, raise */
494 #define VKI_SI_TKILL -6 /* sent by tkill system call */
499 #define VKI_ILL_ILLOPC (__VKI_SI_FAULT|1) /* illegal opcode */
500 #define VKI_ILL_ILLOPN (__VKI_SI_FAULT|2) /* illegal operand */
501 #define VKI_ILL_ILLADR (__VKI_SI_FAULT|3) /* illegal addressing mode */
502 #define VKI_ILL_ILLTRP (__VKI_SI_FAULT|4) /* illegal trap */
503 #define VKI_ILL_PRVOPC (__VKI_SI_FAULT|5) /* privileged opcode */
504 #define VKI_ILL_PRVREG (__VKI_SI_FAULT|6) /* privileged register */
505 #define VKI_ILL_COPROC (__VKI_SI_FAULT|7) /* coprocessor error */
506 #define VKI_ILL_BADSTK (__VKI_SI_FAULT|8) /* internal stack error */
511 #define VKI_FPE_INTDIV (__VKI_SI_FAULT|1) /* integer divide by zero */
512 #define VKI_FPE_INTOVF (__VKI_SI_FAULT|2) /* integer overflow */
513 #define VKI_FPE_FLTDIV (__VKI_SI_FAULT|3) /* floating point divide by zero */
514 #define VKI_FPE_FLTOVF (__VKI_SI_FAULT|4) /* floating point overflow */
515 #define VKI_FPE_FLTUND (__VKI_SI_FAULT|5) /* floating point underflow */
516 #define VKI_FPE_FLTRES (__VKI_SI_FAULT|6) /* floating point inexact result */
517 #define VKI_FPE_FLTINV (__VKI_SI_FAULT|7) /* floating point invalid operation */
518 #define VKI_FPE_FLTSUB (__VKI_SI_FAULT|8) /* subscript out of range */
523 #define VKI_SEGV_MAPERR (__VKI_SI_FAULT|1) /* address not mapped to object */
524 #define VKI_SEGV_ACCERR (__VKI_SI_FAULT|2) /* invalid permissions for mapped object */
529 #define VKI_BUS_ADRALN (__VKI_SI_FAULT|1) /* invalid address alignment */
530 #define VKI_BUS_ADRERR (__VKI_SI_FAULT|2) /* non-existant physical address */
531 #define VKI_BUS_OBJERR (__VKI_SI_FAULT|3) /* object specific hardware error */
536 #define VKI_TRAP_BRKPT (__VKI_SI_FAULT|1) /* process breakpoint */
537 #define VKI_TRAP_TRACE (__VKI_SI_FAULT|2) /* process trace trap */
540 * This works because the alignment is ok on all current architectures
541 * but we leave open this being overridden in the future
543 #ifndef VKI___ARCH_SIGEV_PREAMBLE_SIZE
544 #define VKI___ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(vki_sigval_t))
547 #define VKI_SIGEV_MAX_SIZE 64
548 #define VKI_SIGEV_PAD_SIZE ((VKI_SIGEV_MAX_SIZE - VKI___ARCH_SIGEV_PREAMBLE_SIZE) \
551 /* This is the flag the kernel handles, userspace/glibc handles SEGEV_THEAD. */
552 #define VKI_SIGEV_THREAD_ID 4
554 typedef struct vki_sigevent
{
555 vki_sigval_t sigev_value
;
559 int _pad
[VKI_SIGEV_PAD_SIZE
];
563 void (*_function
)(vki_sigval_t
);
564 void *_attribute
; /* really pthread_attr_t */
569 #define vki_sigev_notify_thread_id _sigev_un._tid
571 //----------------------------------------------------------------------
573 //----------------------------------------------------------------------
575 // [[The kernel actually uses the numbers 0,1,2 directly here, believe it or
576 // not. So we introduce our own constants, based on the glibc ones.]]
577 #define VKI_SEEK_SET 0
578 #define VKI_SEEK_CUR 1
579 #define VKI_SEEK_END 2
581 //----------------------------------------------------------------------
582 // From linux-2.6.8.1/include/linux/net.h
583 //----------------------------------------------------------------------
585 #define VKI_SYS_SOCKET 1 /* sys_socket(2) */
586 #define VKI_SYS_BIND 2 /* sys_bind(2) */
587 #define VKI_SYS_CONNECT 3 /* sys_connect(2) */
588 #define VKI_SYS_LISTEN 4 /* sys_listen(2) */
589 #define VKI_SYS_ACCEPT 5 /* sys_accept(2) */
590 #define VKI_SYS_GETSOCKNAME 6 /* sys_getsockname(2) */
591 #define VKI_SYS_GETPEERNAME 7 /* sys_getpeername(2) */
592 #define VKI_SYS_SOCKETPAIR 8 /* sys_socketpair(2) */
593 #define VKI_SYS_SEND 9 /* sys_send(2) */
594 #define VKI_SYS_RECV 10 /* sys_recv(2) */
595 #define VKI_SYS_SENDTO 11 /* sys_sendto(2) */
596 #define VKI_SYS_RECVFROM 12 /* sys_recvfrom(2) */
597 #define VKI_SYS_SHUTDOWN 13 /* sys_shutdown(2) */
598 #define VKI_SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */
599 #define VKI_SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */
600 #define VKI_SYS_SENDMSG 16 /* sys_sendmsg(2) */
601 #define VKI_SYS_RECVMSG 17 /* sys_recvmsg(2) */
602 #define VKI_SYS_ACCEPT4 18 /* sys_accept4(2) */
603 #define VKI_SYS_RECVMMSG 19 /* sys_recvmmsg(2) */
604 #define VKI_SYS_SENDMMSG 20 /* sys_sendmmsg(2) */
606 #ifndef ARCH_HAS_SOCKET_TYPES
609 // [[others omitted]]
611 #endif /* ARCH_HAS_SOCKET_TYPES */
613 //----------------------------------------------------------------------
614 // From linux-2.6.8.1/include/linux/uio.h
615 //----------------------------------------------------------------------
619 void __user
*iov_base
; /* BSD uses caddr_t (1003.1g requires void *) */
620 __vki_kernel_size_t iov_len
; /* Must be size_t (1003.1g) */
623 //----------------------------------------------------------------------
624 // From linux-2.6.8.1/include/linux/socket.h
625 //----------------------------------------------------------------------
627 // [[Resolved arbitrarily; doesn't really matter whether it's '__inline__'
629 #define __KINLINE static __inline__
631 typedef unsigned short vki_sa_family_t
;
633 struct vki_sockaddr
{
634 vki_sa_family_t sa_family
; /* address family, AF_xxx */
635 char sa_data
[14]; /* 14 bytes of protocol address */
639 void * msg_name
; /* Socket name */
640 int msg_namelen
; /* Length of name */
641 struct vki_iovec
* msg_iov
; /* Data blocks */
642 __vki_kernel_size_t msg_iovlen
; /* Number of blocks */
643 void * msg_control
; /* Per protocol magic (eg BSD file descriptor passing) */
644 __vki_kernel_size_t msg_controllen
; /* Length of cmsg list */
649 struct vki_msghdr msg_hdr
;
654 __vki_kernel_size_t cmsg_len
; /* data byte count, including hdr */
655 int cmsg_level
; /* originating protocol */
656 int cmsg_type
; /* protocol-specific type */
659 #define __VKI_CMSG_NXTHDR(ctl, len, cmsg) __vki_cmsg_nxthdr((ctl),(len),(cmsg))
660 #define VKI_CMSG_NXTHDR(mhdr, cmsg) vki_cmsg_nxthdr((mhdr), (cmsg))
662 #define VKI_CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) )
664 #define VKI_CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + VKI_CMSG_ALIGN(sizeof(struct vki_cmsghdr))))
666 #define __VKI_CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct vki_cmsghdr) ? \
667 (struct vki_cmsghdr *)(ctl) : \
668 (struct vki_cmsghdr *)NULL)
669 #define VKI_CMSG_FIRSTHDR(msg) __VKI_CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen)
671 // [[Urgh, this is revolting...]
672 __KINLINE
struct vki_cmsghdr
* __vki_cmsg_nxthdr(void *__ctl
, __vki_kernel_size_t __size
,
673 struct vki_cmsghdr
*__cmsg
)
675 struct vki_cmsghdr
* __ptr
;
677 __ptr
= (struct vki_cmsghdr
*)(((unsigned char *) __cmsg
) + VKI_CMSG_ALIGN(__cmsg
->cmsg_len
));
678 if ((unsigned long)((char*)(__ptr
+1) - (char *) __ctl
) > __size
)
679 return (struct vki_cmsghdr
*)0;
684 __KINLINE
struct vki_cmsghdr
* vki_cmsg_nxthdr (struct vki_msghdr
*__msg
, struct vki_cmsghdr
*__cmsg
)
686 return __vki_cmsg_nxthdr(__msg
->msg_control
, __msg
->msg_controllen
, __cmsg
);
689 #define VKI_SCM_RIGHTS 0x01 /* rw: access rights (array of int) */
691 #define VKI_AF_UNSPEC 0
692 #define VKI_AF_UNIX 1 /* Unix domain sockets */
693 #define VKI_AF_INET 2 /* Internet IP Protocol */
694 #define VKI_AF_INET6 10 /* IP version 6 */
695 #define VKI_AF_NETLINK 16
696 #define VKI_AF_BLUETOOTH 31 /* Bluetooth sockets */
698 #define VKI_MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */
700 #define VKI_SOL_SCTP 132
702 //----------------------------------------------------------------------
703 // From linux-2.6.8.1/include/linux/in.h
704 //----------------------------------------------------------------------
710 /* Structure describing an Internet (IP) socket address. */
711 #define __VKI_SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
712 struct vki_sockaddr_in
{
713 vki_sa_family_t sin_family
; /* Address family */
714 unsigned short int sin_port
; /* Port number */
715 struct vki_in_addr sin_addr
; /* Internet address */
717 /* Pad to size of `struct sockaddr'. */
718 unsigned char __pad
[__VKI_SOCK_SIZE__
- sizeof(short int) -
719 sizeof(unsigned short int) - sizeof(struct vki_in_addr
)];
722 #define VKI_IPPROTO_TCP 6 /* Transmission Control Protocol */
724 //----------------------------------------------------------------------
725 // From linux-2.6.8.1/include/linux/in6.h
726 //----------------------------------------------------------------------
732 __vki_u8 u6_addr8
[16];
733 __vki_u16 u6_addr16
[8];
734 __vki_u32 u6_addr32
[4];
736 #define vki_s6_addr vki_in6_u.u6_addr8
737 #define vki_s6_addr16 vki_in6_u.u6_addr16
738 #define vki_s6_addr32 vki_in6_u.u6_addr32
741 struct vki_sockaddr_in6
{
742 unsigned short int sin6_family
; /* AF_INET6 */
743 __vki_u16 sin6_port
; /* Transport layer port # */
744 __vki_u32 sin6_flowinfo
; /* IPv6 flow information */
745 struct vki_in6_addr sin6_addr
; /* IPv6 address */
746 __vki_u32 sin6_scope_id
; /* scope id (new in RFC2553) */
749 //----------------------------------------------------------------------
750 // From linux-2.6.8.1/include/linux/tcp.h
751 //----------------------------------------------------------------------
753 #define VKI_TCP_NODELAY 1 /* Turn off Nagle's algorithm. */
756 //----------------------------------------------------------------------
757 // From linux-2.6.8.1/include/linux/un.h
758 //----------------------------------------------------------------------
760 #define VKI_UNIX_PATH_MAX 108
762 struct vki_sockaddr_un
{
763 vki_sa_family_t sun_family
; /* AF_UNIX */
764 char sun_path
[VKI_UNIX_PATH_MAX
]; /* pathname */
767 //----------------------------------------------------------------------
768 // From linux-3.15.8/include/uapi/linux/netlink.h
769 //----------------------------------------------------------------------
771 struct vki_sockaddr_nl
{
772 vki_sa_family_t nl_family
; /* AF_NETLINK */
773 unsigned short nl_pad
; /* zero */
774 __vki_u32 nl_pid
; /* port ID */
775 __vki_u32 nl_groups
; /* multicast groups mask */
778 //----------------------------------------------------------------------
779 // From linux-2.6.8.1/include/linux/if.h
780 //----------------------------------------------------------------------
782 #define VKI_IFNAMSIZ 16
786 unsigned long mem_start
;
787 unsigned long mem_end
;
788 unsigned short base_addr
;
795 struct vki_if_settings
797 unsigned int type
; /* Type of physical device or protocol */
798 unsigned int size
; /* Size of the data allocated by the caller */
800 // [[Nb: converted these all to void* to avoid pulling in
801 // unnecessary headers]]]
802 /* {atm/eth/dsl}_settings anyone ? */
803 void /*raw_hdlc_proto */__user
*raw_hdlc
;
804 void /*cisco_proto */__user
*cisco
;
805 void /*fr_proto */__user
*fr
;
806 void /*fr_proto_pvc */__user
*fr_pvc
;
807 void /*fr_proto_pvc_info */__user
*fr_pvc_info
;
809 /* interface settings */
810 void /*sync_serial_settings */__user
*sync
;
811 void /*te1_settings */__user
*te1
;
817 #define VKI_IFHWADDRLEN 6
820 char ifrn_name
[VKI_IFNAMSIZ
]; /* if name, e.g. "en0" */
824 struct vki_sockaddr ifru_addr
;
825 struct vki_sockaddr ifru_dstaddr
;
826 struct vki_sockaddr ifru_broadaddr
;
827 struct vki_sockaddr ifru_netmask
;
828 struct vki_sockaddr ifru_hwaddr
;
832 struct vki_ifmap ifru_map
;
833 char ifru_slave
[VKI_IFNAMSIZ
]; /* Just fits the size */
834 char ifru_newname
[VKI_IFNAMSIZ
];
835 void __user
* ifru_data
;
836 struct vki_if_settings ifru_settings
;
840 #define vki_ifr_name ifr_ifrn.ifrn_name /* interface name */
841 #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
842 #define ifr_addr ifr_ifru.ifru_addr /* address */
843 #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */
844 #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
845 #define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */
846 #define vki_ifr_flags ifr_ifru.ifru_flags /* flags */
847 #define vki_ifr_metric ifr_ifru.ifru_ivalue /* metric */
848 #define vki_ifr_mtu ifr_ifru.ifru_mtu /* mtu */
849 #define ifr_map ifr_ifru.ifru_map /* device map */
850 #define ifr_slave ifr_ifru.ifru_slave /* slave device */
851 #define vki_ifr_data ifr_ifru.ifru_data /* for use by interface */
852 #define vki_ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */
853 #define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */
854 #define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */
855 #define ifr_newname ifr_ifru.ifru_newname /* New name */
856 #define ifr_settings ifr_ifru.ifru_settings /* Device/proto settings*/
860 int ifc_len
; /* size of buffer */
863 char __user
*ifcu_buf
;
864 struct vki_ifreq __user
*ifcu_req
;
867 #define vki_ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
869 //----------------------------------------------------------------------
870 // From linux-2.6.8.1/include/linux/if_arp.h
871 //----------------------------------------------------------------------
874 struct vki_sockaddr arp_pa
; /* protocol address */
875 struct vki_sockaddr arp_ha
; /* hardware address */
876 int arp_flags
; /* flags */
877 struct vki_sockaddr arp_netmask
; /* netmask (only for proxy arps) */
881 //----------------------------------------------------------------------
882 // From linux-2.6.8.1/include/linux/route.h
883 //----------------------------------------------------------------------
887 unsigned long rt_pad1
;
888 struct vki_sockaddr rt_dst
; /* target address */
889 struct vki_sockaddr rt_gateway
; /* gateway addr (RTF_GATEWAY) */
890 struct vki_sockaddr rt_genmask
; /* target network mask (IP) */
891 unsigned short rt_flags
;
893 unsigned long rt_pad3
;
895 short rt_metric
; /* +1 for binary compatibility! */
896 char __user
*rt_dev
; /* forcing the device at add */
897 unsigned long rt_mtu
; /* per route MTU/Window */
898 // [[Not important for Valgrind]]
900 //#define rt_mss rt_mtu /* Compatibility :-( */
902 unsigned long rt_window
; /* Window clamping */
903 unsigned short rt_irtt
; /* Initial RTT */
906 //----------------------------------------------------------------------
907 // From linux-2.6.13-rc5/include/net/sctp/user.h
908 //----------------------------------------------------------------------
910 typedef __vki_s32 vki_sctp_assoc_t
;
912 enum vki_sctp_optname
{
914 #define VKI_SCTP_RTOINFO VKI_SCTP_RTOINFO
916 #define VKI_SCTP_ASSOCINFO VKI_SCTP_ASSOCINFO
918 #define VKI_SCTP_INITMSG VKI_SCTP_INITMSG
919 VKI_SCTP_NODELAY
, /* Get/set nodelay option. */
920 #define VKI_SCTP_NODELAY VKI_SCTP_NODELAY
922 #define VKI_SCTP_AUTOCLOSE VKI_SCTP_AUTOCLOSE
923 VKI_SCTP_SET_PEER_PRIMARY_ADDR
,
924 #define VKI_SCTP_SET_PEER_PRIMARY_ADDR VKI_SCTP_SET_PEER_PRIMARY_ADDR
925 VKI_SCTP_PRIMARY_ADDR
,
926 #define VKI_SCTP_PRIMARY_ADDR VKI_SCTP_PRIMARY_ADDR
927 VKI_SCTP_ADAPTION_LAYER
,
928 #define VKI_SCTP_ADAPTION_LAYER VKI_SCTP_ADAPTION_LAYER
929 VKI_SCTP_DISABLE_FRAGMENTS
,
930 #define VKI_SCTP_DISABLE_FRAGMENTS VKI_SCTP_DISABLE_FRAGMENTS
931 VKI_SCTP_PEER_ADDR_PARAMS
,
932 #define VKI_SCTP_PEER_ADDR_PARAMS VKI_SCTP_PEER_ADDR_PARAMS
933 VKI_SCTP_DEFAULT_SEND_PARAM
,
934 #define VKI_SCTP_DEFAULT_SEND_PARAM VKI_SCTP_DEFAULT_SEND_PARAM
936 #define VKI_SCTP_EVENTS VKI_SCTP_EVENTS
937 VKI_SCTP_I_WANT_MAPPED_V4_ADDR
, /* Turn on/off mapped v4 addresses */
938 #define VKI_SCTP_I_WANT_MAPPED_V4_ADDR VKI_SCTP_I_WANT_MAPPED_V4_ADDR
939 VKI_SCTP_MAXSEG
, /* Get/set maximum fragment. */
940 #define VKI_SCTP_MAXSEG VKI_SCTP_MAXSEG
942 #define VKI_SCTP_STATUS VKI_SCTP_STATUS
943 VKI_SCTP_GET_PEER_ADDR_INFO
,
944 #define VKI_SCTP_GET_PEER_ADDR_INFO VKI_SCTP_GET_PEER_ADDR_INFO
946 /* Internal Socket Options. Some of the sctp library functions are
947 * implemented using these socket options.
949 VKI_SCTP_SOCKOPT_BINDX_ADD
= 100,/* BINDX requests for adding addresses. */
950 #define VKI_SCTP_SOCKOPT_BINDX_ADD VKI_SCTP_SOCKOPT_BINDX_ADD
951 VKI_SCTP_SOCKOPT_BINDX_REM
, /* BINDX requests for removing addresses. */
952 #define VKI_SCTP_SOCKOPT_BINDX_REM VKI_SCTP_SOCKOPT_BINDX_REM
953 VKI_SCTP_SOCKOPT_PEELOFF
, /* peel off association. */
954 #define VKI_SCTP_SOCKOPT_PEELOFF VKI_SCTP_SOCKOPT_PEELOFF
955 VKI_SCTP_GET_PEER_ADDRS_NUM
, /* Get number of peer addresss. */
956 #define VKI_SCTP_GET_PEER_ADDRS_NUM VKI_SCTP_GET_PEER_ADDRS_NUM
957 VKI_SCTP_GET_PEER_ADDRS
, /* Get all peer addresss. */
958 #define VKI_SCTP_GET_PEER_ADDRS VKI_SCTP_GET_PEER_ADDRS
959 VKI_SCTP_GET_LOCAL_ADDRS_NUM
, /* Get number of local addresss. */
960 #define VKI_SCTP_GET_LOCAL_ADDRS_NUM VKI_SCTP_GET_LOCAL_ADDRS_NUM
961 VKI_SCTP_GET_LOCAL_ADDRS
, /* Get all local addresss. */
962 #define VKI_SCTP_GET_LOCAL_ADDRS VKI_SCTP_GET_LOCAL_ADDRS
963 VKI_SCTP_SOCKOPT_CONNECTX
, /* CONNECTX requests. */
964 #define VKI_SCTP_SOCKOPT_CONNECTX VKI_SCTP_SOCKOPT_CONNECTX
967 struct vki_sctp_getaddrs
{
968 vki_sctp_assoc_t assoc_id
;
970 struct vki_sockaddr
*addrs
;
973 //----------------------------------------------------------------------
974 // From linux-2.6.8.1/include/linux/resource.h
975 //----------------------------------------------------------------------
978 struct vki_timeval ru_utime
; /* user time used */
979 struct vki_timeval ru_stime
; /* system time used */
980 long ru_maxrss
; /* maximum resident set size */
981 long ru_ixrss
; /* integral shared memory size */
982 long ru_idrss
; /* integral unshared data size */
983 long ru_isrss
; /* integral unshared stack size */
984 long ru_minflt
; /* page reclaims */
985 long ru_majflt
; /* page faults */
986 long ru_nswap
; /* swaps */
987 long ru_inblock
; /* block input operations */
988 long ru_oublock
; /* block output operations */
989 long ru_msgsnd
; /* messages sent */
990 long ru_msgrcv
; /* messages received */
991 long ru_nsignals
; /* signals received */
992 long ru_nvcsw
; /* voluntary context switches */
993 long ru_nivcsw
; /* involuntary " */
997 unsigned long rlim_cur
;
998 unsigned long rlim_max
;
1001 struct vki_rlimit64
{
1006 //----------------------------------------------------------------------
1007 // From linux-2.6.8.1/include/linux/elfcore.h
1008 //----------------------------------------------------------------------
1010 struct vki_elf_siginfo
1012 int si_signo
; /* signal number */
1013 int si_code
; /* extra code */
1014 int si_errno
; /* errno */
1017 // [[Removed some commented out lines here]]
1018 struct vki_elf_prstatus
1020 struct vki_elf_siginfo pr_info
; /* Info associated with signal */
1021 short pr_cursig
; /* Current signal */
1022 unsigned long pr_sigpend
; /* Set of pending signals */
1023 unsigned long pr_sighold
; /* Set of held signals */
1028 struct vki_timeval pr_utime
; /* User time */
1029 struct vki_timeval pr_stime
; /* System time */
1030 struct vki_timeval pr_cutime
; /* Cumulative user time */
1031 struct vki_timeval pr_cstime
; /* Cumulative system time */
1032 vki_elf_gregset_t pr_reg
; /* GP registers */
1033 int pr_fpvalid
; /* True if math co-processor being used. */
1036 #define VKI_ELF_PRARGSZ (80) /* Number of chars for args */
1038 struct vki_elf_prpsinfo
1040 char pr_state
; /* numeric process state */
1041 char pr_sname
; /* char for pr_state */
1042 char pr_zomb
; /* zombie */
1043 char pr_nice
; /* nice val */
1044 unsigned long pr_flag
; /* flags */
1045 __vki_kernel_uid_t pr_uid
;
1046 __vki_kernel_gid_t pr_gid
;
1047 vki_pid_t pr_pid
, pr_ppid
, pr_pgrp
, pr_sid
;
1049 char pr_fname
[16]; /* filename of executable */
1050 char pr_psargs
[VKI_ELF_PRARGSZ
]; /* initial part of arg list */
1053 //----------------------------------------------------------------------
1054 // From linux-2.6.12.1/include/linux/eventpoll.h
1055 //----------------------------------------------------------------------
1057 /* Valid opcodes to issue to sys_epoll_ctl() */
1058 #define VKI_EPOLL_CTL_ADD 1
1059 #define VKI_EPOLL_CTL_DEL 2
1060 #define VKI_EPOLL_CTL_MOD 3
1063 #define VKI_EPOLL_PACKED __attribute__((packed))
1065 #define VKI_EPOLL_PACKED
1068 struct vki_epoll_event
{
1074 //----------------------------------------------------------------------
1075 // From linux-2.6.8.1/include/linux/mqueue.h
1076 //----------------------------------------------------------------------
1078 struct vki_mq_attr
{
1079 long mq_flags
; /* message queue flags */
1080 long mq_maxmsg
; /* maximum number of messages */
1081 long mq_msgsize
; /* maximum message size */
1082 long mq_curmsgs
; /* number of messages currently queued */
1083 long __reserved
[4]; /* ignored for input, zeroed for output */
1086 //----------------------------------------------------------------------
1087 // From linux-2.6.8.1/include/linux/utsname.h
1088 //----------------------------------------------------------------------
1090 struct vki_new_utsname
{
1096 char domainname
[65];
1099 //----------------------------------------------------------------------
1100 // From linux-2.6.8.1/include/linux/mii.h
1101 //----------------------------------------------------------------------
1103 /* This structure is used in all SIOCxMIIxxx ioctl calls */
1104 struct vki_mii_ioctl_data
{
1111 //----------------------------------------------------------------------
1112 // From linux-2.6.8.1/include/linux/capability.h
1113 //----------------------------------------------------------------------
1115 // [[capget()/capset() man page says this, ominously:
1117 // The kernel API is likely to change and use of these functions (in
1118 // particular the format of the cap_user_*_t types) is subject to
1119 // change with each kernel revision.
1121 // However, the format hasn't changed since at least Linux 2.4.6.]]
1123 typedef struct __vki_user_cap_header_struct
{
1126 } __user
*vki_cap_user_header_t
;
1128 typedef struct __vki_user_cap_data_struct
{
1129 __vki_u32 effective
;
1130 __vki_u32 permitted
;
1131 __vki_u32 inheritable
;
1132 } __user
*vki_cap_user_data_t
;
1135 //----------------------------------------------------------------------
1136 // From linux-2.6.8.1/include/linux/module.h
1137 //----------------------------------------------------------------------
1139 // [[We do a VKI_SIZEOF_* here because this type is so big, and its size
1140 // depends on the word size, so see vki_arch.h]]
1142 //----------------------------------------------------------------------
1143 // From linux-2.6.8.1/include/linux/ipc.h
1144 //----------------------------------------------------------------------
1146 /* Obsolete, used only for backwards compatibility and libc5 compiles */
1149 __vki_kernel_key_t key
;
1150 __vki_kernel_uid_t uid
;
1151 __vki_kernel_gid_t gid
;
1152 __vki_kernel_uid_t cuid
;
1153 __vki_kernel_gid_t cgid
;
1154 __vki_kernel_mode_t mode
;
1158 #define VKI_IPC_CREAT 00001000 /* create if key is nonexistent */
1159 #define VKI_IPC_EXCL 00002000 /* fail if key exists */
1160 #define VKI_IPC_NOWAIT 00004000 /* return error on wait */
1162 //#define VKI_IPC_RMID 0 /* remove resource */
1163 #define VKI_IPC_SET 1 /* set ipc_perm options */
1164 #define VKI_IPC_STAT 2 /* get ipc_perm options */
1165 #define VKI_IPC_INFO 3 /* see ipcs */
1167 #define VKI_IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger
1168 message sizes, etc. */
1169 // From /usr/include/bits/shm.h
1170 # define VKI_SHM_HUGETLB 04000
1173 //----------------------------------------------------------------------
1174 // From linux-2.6.8.1/include/linux/sem.h
1175 //----------------------------------------------------------------------
1177 #define VKI_GETALL 13 /* get all semval's */
1178 #define VKI_SETVAL 16 /* set semval */
1179 #define VKI_SETALL 17 /* set all semval's */
1181 #define VKI_SEM_STAT 18
1182 #define VKI_SEM_INFO 19
1184 /* Obsolete, used only for backwards compatibility and libc5 compiles */
1185 struct vki_semid_ds
{
1186 struct vki_ipc_perm sem_perm
; /* permissions .. see ipc.h */
1187 __vki_kernel_time_t sem_otime
; /* last semop time */
1188 __vki_kernel_time_t sem_ctime
; /* last change time */
1189 // [[Use void* to avoid excess header copying]]
1190 void/*struct sem */*sem_base
; /* ptr to first semaphore in array */
1191 void/*struct sem_queue */*sem_pending
; /* pending operations to be processed */
1192 void/*struct sem_queue */**sem_pending_last
; /* last pending operation */
1193 void/*struct sem_undo */*undo
; /* undo requests on this array */
1194 unsigned short sem_nsems
; /* no. of semaphores in array */
1198 unsigned short sem_num
; /* semaphore index in array */
1199 short sem_op
; /* semaphore operation */
1200 short sem_flg
; /* operation flags */
1204 int val
; /* value for SETVAL */
1205 struct vki_semid_ds __user
*buf
; /* buffer for IPC_STAT & IPC_SET */
1206 unsigned short __user
*array
; /* array for GETALL & SETALL */
1207 struct vki_seminfo __user
*__buf
; /* buffer for IPC_INFO */
1211 struct vki_seminfo
{
1224 //----------------------------------------------------------------------
1225 // From linux-2.6.8.1/include/asm-generic/errno-base.h
1226 //----------------------------------------------------------------------
1228 #define VKI_EPERM 1 /* Operation not permitted */
1229 #define VKI_ENOENT 2 /* No such file or directory */
1230 #define VKI_ESRCH 3 /* No such process */
1231 #define VKI_EINTR 4 /* Interrupted system call */
1232 #define VKI_EIO 5 /* I/O error */
1233 #define VKI_ENXIO 6 /* No such device or address */
1234 #define VKI_E2BIG 7 /* Argument list too long */
1235 #define VKI_ENOEXEC 8 /* Exec format error */
1236 #define VKI_EBADF 9 /* Bad file number */
1237 #define VKI_ECHILD 10 /* No child processes */
1238 #define VKI_EAGAIN 11 /* Try again */
1239 #define VKI_ENOMEM 12 /* Out of memory */
1240 #define VKI_EACCES 13 /* Permission denied */
1241 #define VKI_EFAULT 14 /* Bad address */
1242 #define VKI_ENOTBLK 15 /* Block device required */
1243 #define VKI_EBUSY 16 /* Device or resource busy */
1244 #define VKI_EEXIST 17 /* File exists */
1245 #define VKI_EXDEV 18 /* Cross-device link */
1246 #define VKI_ENODEV 19 /* No such device */
1247 #define VKI_ENOTDIR 20 /* Not a directory */
1248 #define VKI_EISDIR 21 /* Is a directory */
1249 #define VKI_EINVAL 22 /* Invalid argument */
1250 #define VKI_ENFILE 23 /* File table overflow */
1251 #define VKI_EMFILE 24 /* Too many open files */
1252 #define VKI_ENOTTY 25 /* Not a typewriter */
1253 #define VKI_ETXTBSY 26 /* Text file busy */
1254 #define VKI_EFBIG 27 /* File too large */
1255 #define VKI_ENOSPC 28 /* No space left on device */
1256 #define VKI_ESPIPE 29 /* Illegal seek */
1257 #define VKI_EROFS 30 /* Read-only file system */
1258 #define VKI_EMLINK 31 /* Too many links */
1259 #define VKI_EPIPE 32 /* Broken pipe */
1260 #define VKI_EDOM 33 /* Math argument out of domain of func */
1261 #define VKI_ERANGE 34 /* Math result not representable */
1263 //----------------------------------------------------------------------
1264 // From linux-2.6.8.1/include/asm-generic/errno.h
1265 //----------------------------------------------------------------------
1267 #define VKI_EWOULDBLOCK VKI_EAGAIN
1269 //----------------------------------------------------------------------
1270 // From linux-2.6.8.1/include/linux/wait.h
1271 //----------------------------------------------------------------------
1273 #define VKI_WNOHANG 0x00000001
1275 #define __VKI_WALL 0x40000000 /* Wait on all children, regardless of type */
1276 #define __VKI_WCLONE 0x80000000 /* Wait only on non-SIGCHLD children */
1278 //----------------------------------------------------------------------
1279 // From linux-2.6.8.1/include/linux/mman.h
1280 //----------------------------------------------------------------------
1282 #define VKI_MREMAP_MAYMOVE 1
1283 #define VKI_MREMAP_FIXED 2
1285 //----------------------------------------------------------------------
1286 // From linux-2.6.31-rc4/include/linux/futex.h
1287 //----------------------------------------------------------------------
1289 #define VKI_FUTEX_WAIT (0)
1290 #define VKI_FUTEX_WAKE (1)
1291 #define VKI_FUTEX_FD (2)
1292 #define VKI_FUTEX_REQUEUE (3)
1293 #define VKI_FUTEX_CMP_REQUEUE (4)
1294 #define VKI_FUTEX_WAKE_OP (5)
1295 #define VKI_FUTEX_LOCK_PI (6)
1296 #define VKI_FUTEX_UNLOCK_PI (7)
1297 #define VKI_FUTEX_TRYLOCK_PI (8)
1298 #define VKI_FUTEX_WAIT_BITSET (9)
1299 #define VKI_FUTEX_WAKE_BITSET (10)
1300 #define VKI_FUTEX_WAIT_REQUEUE_PI (11)
1301 #define VKI_FUTEX_CMP_REQUEUE_PI (12)
1302 #define VKI_FUTEX_PRIVATE_FLAG (128)
1303 #define VKI_FUTEX_CLOCK_REALTIME (256)
1305 struct vki_robust_list
{
1306 struct vki_robust_list __user
*next
;
1309 struct vki_robust_list_head
{
1311 * The head of the list. Points back to itself if empty:
1313 struct vki_robust_list list
;
1316 * This relative offset is set by user-space, it gives the kernel
1317 * the relative position of the futex field to examine. This way
1318 * we keep userspace flexible, to freely shape its data-structure,
1319 * without hardcoding any particular offset into the kernel:
1324 * The death of the thread may race with userspace setting
1325 * up a lock's links. So to handle this race, userspace first
1326 * sets this field to the address of the to-be-taken lock,
1327 * then does the lock acquire, and then adds itself to the
1328 * list, and then clears this field. Hence the kernel will
1329 * always have full knowledge of all locks that the thread
1330 * _might_ have taken. We check the owner TID in any case,
1331 * so only truly owned locks will be handled.
1333 struct vki_robust_list __user
*list_op_pending
;
1336 //----------------------------------------------------------------------
1337 // From linux-2.6.8.1/include/linux/errno.h
1338 //----------------------------------------------------------------------
1340 #define VKI_ERESTARTSYS 512
1342 //----------------------------------------------------------------------
1343 // From linux-2.6.8.1/include/linux/stat.h
1344 //----------------------------------------------------------------------
1346 #define VKI_S_IFMT 00170000
1347 #define VKI_S_IFSOCK 0140000
1348 #define VKI_S_IFLNK 0120000
1349 #define VKI_S_IFREG 0100000
1350 #define VKI_S_IFBLK 0060000
1351 #define VKI_S_IFDIR 0040000
1352 #define VKI_S_IFCHR 0020000
1353 #define VKI_S_IFIFO 0010000
1354 #define VKI_S_ISUID 0004000
1355 #define VKI_S_ISGID 0002000
1356 #define VKI_S_ISVTX 0001000
1358 #define VKI_S_ISLNK(m) (((m) & VKI_S_IFMT) == VKI_S_IFLNK)
1359 #define VKI_S_ISREG(m) (((m) & VKI_S_IFMT) == VKI_S_IFREG)
1360 #define VKI_S_ISDIR(m) (((m) & VKI_S_IFMT) == VKI_S_IFDIR)
1361 #define VKI_S_ISCHR(m) (((m) & VKI_S_IFMT) == VKI_S_IFCHR)
1362 #define VKI_S_ISBLK(m) (((m) & VKI_S_IFMT) == VKI_S_IFBLK)
1363 #define VKI_S_ISFIFO(m) (((m) & VKI_S_IFMT) == VKI_S_IFIFO)
1364 #define VKI_S_ISSOCK(m) (((m) & VKI_S_IFMT) == VKI_S_IFSOCK)
1366 #define VKI_S_IRWXU 00700
1367 #define VKI_S_IRUSR 00400
1368 #define VKI_S_IWUSR 00200
1369 #define VKI_S_IXUSR 00100
1371 #define VKI_S_IRWXG 00070
1372 #define VKI_S_IRGRP 00040
1373 #define VKI_S_IWGRP 00020
1374 #define VKI_S_IXGRP 00010
1376 #define VKI_S_IRWXO 00007
1377 #define VKI_S_IROTH 00004
1378 #define VKI_S_IWOTH 00002
1379 #define VKI_S_IXOTH 00001
1381 //----------------------------------------------------------------------
1382 // From linux-2.6.8.1/include/linux/dirent.h
1383 //----------------------------------------------------------------------
1385 /* This is the old compat structure to use with the old dirent syscall. */
1388 __vki_kernel_off_t d_off
;
1389 unsigned short d_reclen
;
1390 char d_name
[256]; /* We must not include limits.h! */
1393 /* This is the new structure to use with the dirent64 syscall. */
1394 struct vki_dirent64
{
1397 unsigned short d_reclen
;
1398 unsigned char d_type
;
1399 char d_name
[256]; /* Note we hard code a max file length here. */
1402 //----------------------------------------------------------------------
1403 // From linux-2.6.8.1/include/linux/fcntl.h
1404 //----------------------------------------------------------------------
1406 #define VKI_F_SETLEASE (VKI_F_LINUX_SPECIFIC_BASE + 0)
1407 #define VKI_F_GETLEASE (VKI_F_LINUX_SPECIFIC_BASE + 1)
1409 #define VKI_F_CANCELLK (VKI_F_LINUX_SPECIFIC_BASE + 5)
1411 #define VKI_F_DUPFD_CLOEXEC (VKI_F_LINUX_SPECIFIC_BASE + 6)
1413 #define VKI_F_NOTIFY (VKI_F_LINUX_SPECIFIC_BASE + 2)
1415 #define VKI_F_SETPIPE_SZ (VKI_F_LINUX_SPECIFIC_BASE + 7)
1416 #define VKI_F_GETPIPE_SZ (VKI_F_LINUX_SPECIFIC_BASE + 8)
1418 //----------------------------------------------------------------------
1419 // From linux-2.6.8.1/include/linux/sysctl.h
1420 //----------------------------------------------------------------------
1422 struct __vki_sysctl_args
{
1425 void __user
*oldval
;
1426 vki_size_t __user
*oldlenp
;
1427 void __user
*newval
;
1429 unsigned long __unused0
[4];
1432 //----------------------------------------------------------------------
1433 // From linux-2.6.8.1/include/linux/aio_abi.h
1434 //----------------------------------------------------------------------
1436 typedef unsigned long vki_aio_context_t
;
1439 VKI_IOCB_CMD_PREAD
= 0,
1440 VKI_IOCB_CMD_PWRITE
= 1,
1441 VKI_IOCB_CMD_FSYNC
= 2,
1442 VKI_IOCB_CMD_FDSYNC
= 3,
1443 VKI_IOCB_CMD_PREADV
= 7,
1444 VKI_IOCB_CMD_PWRITEV
= 8,
1447 /* read() from /dev/aio returns these structures. */
1448 struct vki_io_event
{
1449 __vki_u64 data
; /* the data field from the iocb */
1450 __vki_u64 obj
; /* what iocb this event came from */
1451 // [[Nb: These fields renamed from 'res' and 'res2' because 'res' is
1452 // a macro in vg_syscalls.c!]]
1453 __vki_s64 result
; /* result code for this event */
1454 __vki_s64 result2
; /* secondary result */
1457 #if defined(VKI_LITTLE_ENDIAN)
1458 # define VKI_PADDED(x,y) x, y
1459 #elif defined(VKI_BIG_ENDIAN)
1460 # define VKI_PADDED(x,y) y, x
1462 #error edit for your odd byteorder.
1466 /* these are internal to the kernel/libc. */
1467 __vki_u64 aio_data
; /* data to be returned in event's data */
1468 __vki_u32
VKI_PADDED(aio_key
, aio_reserved1
);
1469 /* the kernel sets aio_key to the req # */
1472 __vki_u16 aio_lio_opcode
; /* see IOCB_CMD_ above */
1473 __vki_s16 aio_reqprio
;
1474 __vki_u32 aio_fildes
;
1477 __vki_u64 aio_nbytes
;
1478 __vki_s64 aio_offset
;
1480 /* extra parameters */
1481 __vki_u64 aio_reserved2
; /* TODO: use this for a (struct sigevent *) */
1482 __vki_u64 aio_reserved3
;
1485 //----------------------------------------------------------------------
1486 // From linux-2.6.8.1/include/linux/aio.h
1487 //----------------------------------------------------------------------
1489 struct vki_aio_ring
{
1490 unsigned id
; /* kernel internal index number */
1491 unsigned nr
; /* number of io_events */
1496 unsigned compat_features
;
1497 unsigned incompat_features
;
1498 unsigned header_length
; /* size of aio_ring */
1500 struct vki_io_event io_events
[0];
1501 }; /* 128 bytes + ring size */
1503 //----------------------------------------------------------------------
1504 // From linux-2.6.8.1/include/linux/msg.h
1505 //----------------------------------------------------------------------
1507 #define VKI_MSG_STAT 11
1508 #define VKI_MSG_INFO 12
1510 struct vki_msqid_ds
{
1511 struct vki_ipc_perm msg_perm
;
1512 struct vki_msg
*msg_first
; /* first message on queue,unused */
1513 struct vki_msg
*msg_last
; /* last message in queue,unused */
1514 __vki_kernel_time_t msg_stime
; /* last msgsnd time */
1515 __vki_kernel_time_t msg_rtime
; /* last msgrcv time */
1516 __vki_kernel_time_t msg_ctime
; /* last change time */
1517 unsigned long msg_lcbytes
; /* Reuse junk fields for 32 bit */
1518 unsigned long msg_lqbytes
; /* ditto */
1519 unsigned short msg_cbytes
; /* current number of bytes on queue */
1520 unsigned short msg_qnum
; /* number of messages in queue */
1521 unsigned short msg_qbytes
; /* max number of bytes on queue */
1522 __vki_kernel_ipc_pid_t msg_lspid
; /* pid of last msgsnd */
1523 __vki_kernel_ipc_pid_t msg_lrpid
; /* last receive pid */
1527 long mtype
; /* type of message */
1528 char mtext
[1]; /* message text */
1531 struct vki_msginfo
{
1539 unsigned short msgseg
;
1542 //----------------------------------------------------------------------
1543 // From linux-2.6.8.1/include/linux/shm.h
1544 //----------------------------------------------------------------------
1546 struct vki_shmid_ds
{
1547 struct vki_ipc_perm shm_perm
; /* operation perms */
1548 int shm_segsz
; /* size of segment (bytes) */
1549 __vki_kernel_time_t shm_atime
; /* last attach time */
1550 __vki_kernel_time_t shm_dtime
; /* last detach time */
1551 __vki_kernel_time_t shm_ctime
; /* last change time */
1552 __vki_kernel_ipc_pid_t shm_cpid
; /* pid of creator */
1553 __vki_kernel_ipc_pid_t shm_lpid
; /* pid of last operator */
1554 unsigned short shm_nattch
; /* no. of current attaches */
1555 unsigned short shm_unused
; /* compatibility */
1556 void *shm_unused2
; /* ditto - used by DIPC */
1557 void *shm_unused3
; /* unused */
1560 #define VKI_SHM_RDONLY 010000 /* read-only access */
1561 #define VKI_SHM_RND 020000 /* round attach address to SHMLBA boundary */
1563 #define VKI_SHM_STAT 13
1564 #define VKI_SHM_INFO 14
1566 /* Obsolete, used only for backwards compatibility */
1567 struct vki_shminfo
{
1575 struct vki_shm_info
{
1577 unsigned long shm_tot
; /* total allocated shm */
1578 unsigned long shm_rss
; /* total resident shm */
1579 unsigned long shm_swp
; /* total swapped shm */
1580 unsigned long swap_attempts
;
1581 unsigned long swap_successes
;
1584 //----------------------------------------------------------------------
1585 // From linux-2.6.8.1/include/linux/rtc.h
1586 //----------------------------------------------------------------------
1588 struct vki_rtc_time
{
1600 #define VKI_RTC_AIE_ON _VKI_IO('p', 0x01) /* Alarm int. enable on */
1601 #define VKI_RTC_AIE_OFF _VKI_IO('p', 0x02) /* ... off */
1602 #define VKI_RTC_UIE_ON _VKI_IO('p', 0x03) /* Update int. enable on*/
1603 #define VKI_RTC_UIE_OFF _VKI_IO('p', 0x04) /* ... off */
1604 #define VKI_RTC_PIE_ON _VKI_IO('p', 0x05) /* Periodic int. enable on*/
1605 #define VKI_RTC_PIE_OFF _VKI_IO('p', 0x06) /* ... off */
1607 #define VKI_RTC_ALM_SET _VKI_IOW('p', 0x07, struct vki_rtc_time) /* Set alarm time */
1608 #define VKI_RTC_ALM_READ _VKI_IOR('p', 0x08, struct vki_rtc_time) /* Read alarm time */
1609 #define VKI_RTC_RD_TIME _VKI_IOR('p', 0x09, struct vki_rtc_time) /* Read RTC time */
1610 //#define RTC_SET_TIME _IOW('p', 0x0a, struct rtc_time) /* Set RTC time */
1611 #define VKI_RTC_IRQP_READ _VKI_IOR('p', 0x0b, unsigned long) /* Read IRQ rate */
1612 #define VKI_RTC_IRQP_SET _VKI_IOW('p', 0x0c, unsigned long) /* Set IRQ rate */
1614 //----------------------------------------------------------------------
1615 // From linux-2.6.8.1/include/linux/isdn.h
1616 //----------------------------------------------------------------------
1618 // [[Nb: Resolved this for the common case where CONFIG_COBALT_MICRO_SERVER
1620 #define VKI_ISDN_MAX_CHANNELS 64
1622 #define VKI_IIOCGETCPS _VKI_IO('I',21)
1624 #define VKI_IIOCNETGPN _VKI_IO('I',34)
1626 #define VKI_ISDN_MSNLEN 32
1630 char phone
[VKI_ISDN_MSNLEN
];
1632 } vki_isdn_net_ioctl_phone
;
1634 //----------------------------------------------------------------------
1635 // From linux-2.6.8.1/include/linux/sockios.h
1636 //----------------------------------------------------------------------
1638 #define VKI_SIOCOUTQ VKI_TIOCOUTQ
1640 #define VKI_SIOCADDRT 0x890B /* add routing table entry */
1641 #define VKI_SIOCDELRT 0x890C /* delete routing table entry */
1643 #define VKI_SIOCGIFNAME 0x8910 /* get iface name */
1644 #define VKI_SIOCGIFCONF 0x8912 /* get iface list */
1645 #define VKI_SIOCGIFFLAGS 0x8913 /* get flags */
1646 #define VKI_SIOCSIFFLAGS 0x8914 /* set flags */
1647 #define VKI_SIOCGIFADDR 0x8915 /* get PA address */
1648 #define VKI_SIOCSIFADDR 0x8916 /* set PA address */
1649 #define VKI_SIOCGIFDSTADDR 0x8917 /* get remote PA address */
1650 #define VKI_SIOCSIFDSTADDR 0x8918 /* set remote PA address */
1651 #define VKI_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */
1652 #define VKI_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */
1653 #define VKI_SIOCGIFNETMASK 0x891b /* get network PA mask */
1654 #define VKI_SIOCSIFNETMASK 0x891c /* set network PA mask */
1655 #define VKI_SIOCGIFMETRIC 0x891d /* get metric */
1656 #define VKI_SIOCSIFMETRIC 0x891e /* set metric */
1657 #define VKI_SIOCGIFMTU 0x8921 /* get MTU size */
1658 #define VKI_SIOCSIFMTU 0x8922 /* set MTU size */
1659 #define VKI_SIOCSIFHWADDR 0x8924 /* set hardware address */
1660 #define VKI_SIOCGIFHWADDR 0x8927 /* Get hardware address */
1661 #define VKI_SIOCGIFINDEX 0x8933 /* name -> if_index mapping */
1663 #define VKI_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
1664 #define VKI_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
1666 #define VKI_SIOCETHTOOL 0x8946 /* Ethtool interface */
1668 #define VKI_SIOCGMIIPHY 0x8947 /* Get address of MII PHY in use. */
1669 #define VKI_SIOCGMIIREG 0x8948 /* Read MII PHY register. */
1670 #define VKI_SIOCSMIIREG 0x8949 /* Write MII PHY register. */
1672 #define VKI_SIOCDARP 0x8953 /* delete ARP table entry */
1673 #define VKI_SIOCGARP 0x8954 /* get ARP table entry */
1674 #define VKI_SIOCSARP 0x8955 /* set ARP table entry */
1676 #define VKI_SIOCDRARP 0x8960 /* delete RARP table entry */
1677 #define VKI_SIOCGRARP 0x8961 /* get RARP table entry */
1678 #define VKI_SIOCSRARP 0x8962 /* set RARP table entry */
1680 #define VKI_SIOCGIFMAP 0x8970 /* Get device parameters */
1681 #define VKI_SIOCSIFMAP 0x8971 /* Set device parameters */
1683 #define VKI_SIOCSHWTSTAMP 0x89B0 /* Set hardware time stamping */
1685 //----------------------------------------------------------------------
1686 // From linux-2.6.8.1/include/linux/ppdev.h
1687 //----------------------------------------------------------------------
1689 #define VKI_PP_MAJOR 99
1691 #define VKI_PP_IOCTL 'p'
1693 /* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */
1694 #define VKI_PPSETMODE _VKI_IOW(VKI_PP_IOCTL, 0x80, int)
1697 #define VKI_PPRSTATUS _VKI_IOR(VKI_PP_IOCTL, 0x81, unsigned char)
1698 //#define PPWSTATUS OBSOLETE__IOW(PP_IOCTL, 0x82, unsigned char)
1700 /* Read/write control */
1701 #define VKI_PPRCONTROL _VKI_IOR(VKI_PP_IOCTL, 0x83, unsigned char)
1702 #define VKI_PPWCONTROL _VKI_IOW(VKI_PP_IOCTL, 0x84, unsigned char)
1704 struct vki_ppdev_frob_struct
{
1708 #define VKI_PPFCONTROL _VKI_IOW(VKI_PP_IOCTL, 0x8e, struct vki_ppdev_frob_struct)
1710 /* Read/write data */
1711 #define VKI_PPRDATA _VKI_IOR(VKI_PP_IOCTL, 0x85, unsigned char)
1712 #define VKI_PPWDATA _VKI_IOW(VKI_PP_IOCTL, 0x86, unsigned char)
1714 /* Claim the port to start using it */
1715 #define VKI_PPCLAIM _VKI_IO(VKI_PP_IOCTL, 0x8b)
1717 /* Release the port when you aren't using it */
1718 #define VKI_PPRELEASE _VKI_IO(VKI_PP_IOCTL, 0x8c)
1720 /* Yield the port (release it if another driver is waiting,
1722 #define VKI_PPYIELD _VKI_IO(VKI_PP_IOCTL, 0x8d)
1724 /* Register device exclusively (must be before PPCLAIM). */
1725 #define VKI_PPEXCL _VKI_IO(VKI_PP_IOCTL, 0x8f)
1727 /* Data line direction: non-zero for input mode. */
1728 #define VKI_PPDATADIR _VKI_IOW(VKI_PP_IOCTL, 0x90, int)
1730 /* Negotiate a particular IEEE 1284 mode. */
1731 #define VKI_PPNEGOT _VKI_IOW(VKI_PP_IOCTL, 0x91, int)
1733 /* Set control lines when an interrupt occurs. */
1734 #define VKI_PPWCTLONIRQ _VKI_IOW(VKI_PP_IOCTL, 0x92, unsigned char)
1736 /* Clear (and return) interrupt count. */
1737 #define VKI_PPCLRIRQ _VKI_IOR(VKI_PP_IOCTL, 0x93, int)
1739 /* Set the IEEE 1284 phase that we're in (e.g. IEEE1284_PH_FWD_IDLE) */
1740 #define VKI_PPSETPHASE _VKI_IOW(VKI_PP_IOCTL, 0x94, int)
1742 /* Set and get port timeout (struct timeval's) */
1743 #define VKI_PPGETTIME _VKI_IOR(VKI_PP_IOCTL, 0x95, struct vki_timeval)
1744 #define VKI_PPSETTIME _VKI_IOW(VKI_PP_IOCTL, 0x96, struct vki_timeval)
1746 #define VKI_PPGETMODES _VKI_IOR(VKI_PP_IOCTL, 0x97, unsigned int)
1748 #define VKI_PPGETMODE _VKI_IOR(VKI_PP_IOCTL, 0x98, int)
1749 #define VKI_PPGETPHASE _VKI_IOR(VKI_PP_IOCTL, 0x99, int)
1751 #define VKI_PPGETFLAGS _VKI_IOR(VKI_PP_IOCTL, 0x9a, int)
1752 #define VKI_PPSETFLAGS _VKI_IOW(VKI_PP_IOCTL, 0x9b, int)
1754 //----------------------------------------------------------------------
1755 // From linux-3.16/include/uapi/linux/fs.h
1756 //----------------------------------------------------------------------
1758 #define VKI_BLKROSET _VKI_IO(0x12,93) /* set device read-only (0 = read-write) */
1759 #define VKI_BLKROGET _VKI_IO(0x12,94) /* get read-only status (0 = read_write) */
1760 #define VKI_BLKGETSIZE _VKI_IO(0x12,96) /* return device size /512 (long *arg) */
1761 #define VKI_BLKRASET _VKI_IO(0x12,98) /* set read ahead for block device */
1762 #define VKI_BLKRAGET _VKI_IO(0x12,99) /* get current read ahead setting */
1763 #define VKI_BLKFRASET _VKI_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
1764 #define VKI_BLKFRAGET _VKI_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
1765 #define VKI_BLKSECTGET _VKI_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
1766 #define VKI_BLKSSZGET _VKI_IO(0x12,104)/* get block device sector size */
1767 #define VKI_BLKBSZGET _VKI_IOR(0x12,112,vki_size_t)
1768 #define VKI_BLKBSZSET _VKI_IOW(0x12,113,vki_size_t)
1769 #define VKI_BLKGETSIZE64 _VKI_IOR(0x12,114,vki_size_t) /* return device size in bytes (u64 *arg) */
1770 #define VKI_BLKPBSZGET _VKI_IO(0x12,123)
1771 #define VKI_BLKDISCARDZEROES _VKI_IO(0x12,124)
1773 #define VKI_FIBMAP _VKI_IO(0x00,1) /* bmap access */
1774 #define VKI_FIGETBSZ _VKI_IO(0x00,2) /* get the block size used for bmap */
1776 //----------------------------------------------------------------------
1777 // From linux-2.6.8.1/include/scsi/sg.h
1778 //----------------------------------------------------------------------
1780 typedef struct vki_sg_io_hdr
1782 int interface_id
; /* [i] 'S' for SCSI generic (required) */
1783 int dxfer_direction
; /* [i] data transfer direction */
1784 unsigned char cmd_len
; /* [i] SCSI command length ( <= 16 bytes) */
1785 unsigned char mx_sb_len
; /* [i] max length to write to sbp */
1786 unsigned short iovec_count
; /* [i] 0 implies no scatter gather */
1787 unsigned int dxfer_len
; /* [i] byte count of data transfer */
1788 void __user
*dxferp
; /* [i], [*io] points to data transfer memory
1789 or scatter gather list */
1790 unsigned char __user
*cmdp
; /* [i], [*i] points to command to perform */
1791 void __user
*sbp
; /* [i], [*o] points to sense_buffer memory */
1792 unsigned int timeout
; /* [i] MAX_UINT->no timeout (unit: millisec) */
1793 unsigned int flags
; /* [i] 0 -> default, see SG_FLAG... */
1794 int pack_id
; /* [i->o] unused internally (normally) */
1795 void __user
* usr_ptr
; /* [i->o] unused internally */
1796 unsigned char status
; /* [o] scsi status */
1797 unsigned char masked_status
;/* [o] shifted, masked scsi status */
1798 unsigned char msg_status
; /* [o] messaging level data (optional) */
1799 unsigned char sb_len_wr
; /* [o] byte count actually written to sbp */
1800 unsigned short host_status
; /* [o] errors from host adapter */
1801 unsigned short driver_status
;/* [o] errors from software driver */
1802 int resid
; /* [o] dxfer_len - actual_transferred */
1803 unsigned int duration
; /* [o] time taken by cmd (unit: millisec) */
1804 unsigned int info
; /* [o] auxiliary information */
1805 } vki_sg_io_hdr_t
; /* 64 bytes long (on i386) */
1807 #define VKI_SG_DXFER_NONE -1 /* e.g. a SCSI Test Unit Ready command */
1808 #define VKI_SG_DXFER_TO_DEV -2 /* e.g. a SCSI WRITE command */
1809 #define VKI_SG_DXFER_FROM_DEV -3 /* e.g. a SCSI READ command */
1810 #define VKI_SG_DXFER_TO_FROM_DEV -4 /* treated like SG_DXFER_FROM_DEV with the
1811 additional property than during indirect
1812 IO the user buffer is copied into the
1813 kernel buffers before the transfer */
1815 typedef struct vki_sg_scsi_id
{ /* used by SG_GET_SCSI_ID ioctl() */
1816 int host_no
; /* as in "scsi<n>" where 'n' is one of 0, 1, 2 etc */
1818 int scsi_id
; /* scsi id of target device */
1820 int scsi_type
; /* TYPE_... defined in scsi/scsi.h */
1821 short h_cmd_per_lun
;/* host (adapter) maximum commands per lun */
1822 short d_queue_depth
;/* device (or adapter) maximum queue length */
1823 int unused
[2]; /* probably find a good use, set 0 for now */
1824 } vki_sg_scsi_id_t
; /* 32 bytes long on i386 */
1826 #define VKI_SG_EMULATED_HOST 0x2203 /* true for emulated host adapter (ATAPI) */
1828 #define VKI_SG_SET_RESERVED_SIZE 0x2275 /* request a new reserved buffer size */
1829 #define VKI_SG_GET_RESERVED_SIZE 0x2272 /* actual size of reserved buffer */
1831 #define VKI_SG_GET_SCSI_ID 0x2276 /* Yields fd's bus, chan, dev, lun + type */
1833 #define VKI_SG_GET_SG_TABLESIZE 0x227F /* 0 implies can't do scatter gather */
1835 #define VKI_SG_GET_VERSION_NUM 0x2282 /* Example: version 2.1.34 yields 20134 */
1837 #define VKI_SG_IO 0x2285 /* similar effect as write() followed by read() */
1839 #define VKI_SG_SET_TIMEOUT 0x2201 /* unit: jiffies (10ms on i386) */
1840 #define VKI_SG_GET_TIMEOUT 0x2202 /* yield timeout as _return_ value */
1842 //#define SG_GET_COMMAND_Q 0x2270 /* Yields 0 (queuing off) or 1 (on) */
1843 #define VKI_SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1 */
1845 //----------------------------------------------------------------------
1846 // From linux-2.6.34/include/scsi/scsi.h and scsi/scsi_ioctl.h
1847 //----------------------------------------------------------------------
1849 #define VKI_SCSI_IOCTL_DOORLOCK 0x5380 /* Lock the eject mechanism. */
1850 #define VKI_SCSI_IOCTL_DOORUNLOCK 0x5381 /* Unlock the mechanism. */
1851 #define VKI_SCSI_IOCTL_GET_IDLUN 0x5382
1852 #define VKI_SCSI_IOCTL_GET_BUS_NUMBER 0x5386
1854 struct vki_scsi_idlun
{
1856 __vki_u32 host_unique_id
;
1859 //----------------------------------------------------------------------
1860 // From linux-2.6.8.1/include/linux/cdrom.h
1861 //----------------------------------------------------------------------
1863 #define VKI_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */
1864 #define VKI_CDROMREADTOCHDR 0x5305 /* Read TOC header
1865 (struct cdrom_tochdr) */
1866 #define VKI_CDROMREADTOCENTRY 0x5306 /* Read TOC entry
1867 (struct cdrom_tocentry) */
1868 #define VKI_CDROMSUBCHNL 0x530b /* Read subchannel data
1869 (struct cdrom_subchnl) */
1870 #define VKI_CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes)
1871 (struct cdrom_read) */
1872 #define VKI_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */
1873 #define VKI_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session
1874 address of multi session disks
1875 (struct cdrom_multisession) */
1876 #define VKI_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code"
1877 if available (struct cdrom_mcn) */
1878 #define VKI_CDROMVOLREAD 0x5313 /* Get the drive's volume setting
1879 (struct cdrom_volctrl) */
1880 #define VKI_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes)
1881 (struct cdrom_read) */
1882 #define VKI_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */
1883 #define VKI_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
1884 #define VKI_CDROM_DISC_STATUS 0x5327 /* get CD type information */
1885 #define VKI_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
1887 #define VKI_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */
1889 struct vki_cdrom_msf0
1896 union vki_cdrom_addr
1898 struct vki_cdrom_msf0 msf
;
1902 struct vki_cdrom_msf
1904 __vki_u8 cdmsf_min0
; /* start minute */
1905 __vki_u8 cdmsf_sec0
; /* start second */
1906 __vki_u8 cdmsf_frame0
; /* start frame */
1907 __vki_u8 cdmsf_min1
; /* end minute */
1908 __vki_u8 cdmsf_sec1
; /* end second */
1909 __vki_u8 cdmsf_frame1
; /* end frame */
1912 struct vki_cdrom_tochdr
1914 __vki_u8 cdth_trk0
; /* start track */
1915 __vki_u8 cdth_trk1
; /* end track */
1918 struct vki_cdrom_volctrl
1926 struct vki_cdrom_subchnl
1928 __vki_u8 cdsc_format
;
1929 __vki_u8 cdsc_audiostatus
;
1930 __vki_u8 cdsc_adr
: 4;
1931 __vki_u8 cdsc_ctrl
: 4;
1934 union vki_cdrom_addr cdsc_absaddr
;
1935 union vki_cdrom_addr cdsc_reladdr
;
1938 struct vki_cdrom_tocentry
1940 __vki_u8 cdte_track
;
1941 __vki_u8 cdte_adr
:4;
1942 __vki_u8 cdte_ctrl
:4;
1943 __vki_u8 cdte_format
;
1944 union vki_cdrom_addr cdte_addr
;
1945 __vki_u8 cdte_datamode
;
1948 struct vki_cdrom_read
1951 char *cdread_bufaddr
;
1955 struct vki_cdrom_read_audio
1957 union vki_cdrom_addr addr
; /* frame address */
1958 __vki_u8 addr_format
; /* CDROM_LBA or CDROM_MSF */
1959 int nframes
; /* number of 2352-byte-frames to read at once */
1960 __vki_u8 __user
*buf
; /* frame buffer (size: nframes*2352 bytes) */
1963 struct vki_cdrom_multisession
1965 union vki_cdrom_addr addr
; /* frame address: start-of-last-session
1966 (not the new "frame 16"!). Only valid
1967 if the "xa_flag" is true. */
1968 __vki_u8 xa_flag
; /* 1: "is XA disk" */
1969 __vki_u8 addr_format
; /* CDROM_LBA or CDROM_MSF */
1972 struct vki_cdrom_mcn
1974 __vki_u8 medium_catalog_number
[14]; /* 13 ASCII digits, null-terminated */
1977 #define VKI_CDROM_PACKET_SIZE 12
1979 struct vki_cdrom_generic_command
1981 unsigned char cmd
[VKI_CDROM_PACKET_SIZE
];
1982 unsigned char __user
*buffer
;
1983 unsigned int buflen
;
1985 // [[replace with void* to reduce inclusion amounts]]
1986 void/*struct vki_request_sense */__user
*sense
;
1987 unsigned char data_direction
;
1990 void __user
*reserved
[1]; /* unused, actually */
1993 #define VKI_CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */
1994 #define VKI_CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */
1995 #define VKI_CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */
1996 #define VKI_CD_FRAMESIZE_RAW0 (VKI_CD_FRAMESIZE_RAW-VKI_CD_SYNC_SIZE-VKI_CD_HEAD_SIZE) /*2336*/
1998 //----------------------------------------------------------------------
1999 // From linux-2.6.8.1/include/linux/soundcard.h
2000 //----------------------------------------------------------------------
2003 #if defined(_VKI_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__)))
2004 /* Use already defined ioctl defines if they exist (except with Sun or Sparc) */
2005 #define _VKI_SIO _VKI_IO
2006 #define _VKI_SIOR _VKI_IOR
2007 #define _VKI_SIOW _VKI_IOW
2008 #define _VKI_SIOWR _VKI_IOWR
2010 // [[Valgrind: Install this case if/when necessary]
2011 #error Valgrind: Cannot handle sparc/sun case yet...
2013 #endif /* !_VKI_SIOWR */
2015 #define VKI_SNDCTL_SEQ_CTRLRATE _VKI_SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */
2016 #define VKI_SNDCTL_SEQ_GETOUTCOUNT _VKI_SIOR ('Q', 4, int)
2017 #define VKI_SNDCTL_SEQ_GETINCOUNT _VKI_SIOR ('Q', 5, int)
2018 #define VKI_SNDCTL_SEQ_PERCMODE _VKI_SIOW ('Q', 6, int)
2019 #define VKI_SNDCTL_SEQ_TESTMIDI _VKI_SIOW ('Q', 8, int)
2020 #define VKI_SNDCTL_SEQ_RESETSAMPLES _VKI_SIOW ('Q', 9, int)
2021 #define VKI_SNDCTL_SEQ_NRSYNTHS _VKI_SIOR ('Q',10, int)
2022 #define VKI_SNDCTL_SEQ_NRMIDIS _VKI_SIOR ('Q',11, int)
2023 #define VKI_SNDCTL_SEQ_GETTIME _VKI_SIOR ('Q',19, int)
2025 #define VKI_SNDCTL_TMR_TIMEBASE _VKI_SIOWR('T', 1, int)
2026 #define VKI_SNDCTL_TMR_TEMPO _VKI_SIOWR('T', 5, int)
2027 #define VKI_SNDCTL_TMR_SOURCE _VKI_SIOWR('T', 6, int)
2029 #define VKI_SNDCTL_MIDI_PRETIME _VKI_SIOWR('m', 0, int)
2030 #define VKI_SNDCTL_MIDI_MPUMODE _VKI_SIOWR('m', 1, int)
2032 #define VKI_SNDCTL_DSP_RESET _VKI_SIO ('P', 0)
2033 #define VKI_SNDCTL_DSP_SYNC _VKI_SIO ('P', 1)
2034 #define VKI_SNDCTL_DSP_SPEED _VKI_SIOWR('P', 2, int)
2035 #define VKI_SNDCTL_DSP_STEREO _VKI_SIOWR('P', 3, int)
2036 #define VKI_SNDCTL_DSP_GETBLKSIZE _VKI_SIOWR('P', 4, int)
2037 #define VKI_SNDCTL_DSP_CHANNELS _VKI_SIOWR('P', 6, int)
2038 #define VKI_SOUND_PCM_WRITE_FILTER _VKI_SIOWR('P', 7, int)
2039 #define VKI_SNDCTL_DSP_POST _VKI_SIO ('P', 8)
2040 #define VKI_SNDCTL_DSP_SUBDIVIDE _VKI_SIOWR('P', 9, int)
2041 #define VKI_SNDCTL_DSP_SETFRAGMENT _VKI_SIOWR('P',10, int)
2043 #define VKI_SNDCTL_DSP_GETFMTS _VKI_SIOR ('P',11, int) /* Returns a mask */
2044 #define VKI_SNDCTL_DSP_SETFMT _VKI_SIOWR('P', 5, int) /* Selects ONE fmt */
2046 typedef struct vki_audio_buf_info
{
2047 int fragments
; /* # of available fragments (partially usend ones not counted) */
2048 int fragstotal
; /* Total # of fragments allocated */
2049 int fragsize
; /* Size of a fragment in bytes */
2051 int bytes
; /* Available space in bytes (includes partially used fragments) */
2052 /* Note! 'bytes' could be more than fragments*fragsize */
2053 } vki_audio_buf_info
;
2055 #define VKI_SNDCTL_DSP_GETOSPACE _VKI_SIOR ('P',12, vki_audio_buf_info)
2056 #define VKI_SNDCTL_DSP_GETISPACE _VKI_SIOR ('P',13, vki_audio_buf_info)
2057 #define VKI_SNDCTL_DSP_NONBLOCK _VKI_SIO ('P',14)
2058 #define VKI_SNDCTL_DSP_GETCAPS _VKI_SIOR ('P',15, int)
2060 #define VKI_SNDCTL_DSP_GETTRIGGER _VKI_SIOR ('P',16, int)
2061 #define VKI_SNDCTL_DSP_SETTRIGGER _VKI_SIOW ('P',16, int)
2063 #define VKI_SNDCTL_DSP_SETSYNCRO _VKI_SIO ('P', 21)
2064 #define VKI_SNDCTL_DSP_SETDUPLEX _VKI_SIO ('P', 22)
2065 #define VKI_SNDCTL_DSP_GETODELAY _VKI_SIOR ('P', 23, int)
2067 #define VKI_SNDCTL_DSP_GETCHANNELMASK _VKI_SIOWR('P', 64, int)
2068 #define VKI_SNDCTL_DSP_BIND_CHANNEL _VKI_SIOWR('P', 65, int)
2070 #define VKI_SNDCTL_DSP_SETSPDIF _VKI_SIOW ('P', 66, int)
2071 #define VKI_SNDCTL_DSP_GETSPDIF _VKI_SIOR ('P', 67, int)
2073 #define VKI_SOUND_PCM_READ_RATE _VKI_SIOR ('P', 2, int)
2074 #define VKI_SOUND_PCM_READ_CHANNELS _VKI_SIOR ('P', 6, int)
2075 #define VKI_SOUND_PCM_READ_BITS _VKI_SIOR ('P', 5, int)
2076 #define VKI_SOUND_PCM_READ_FILTER _VKI_SIOR ('P', 7, int)
2079 //----------------------------------------------------------------------
2080 // From linux-2.6.8.1/include/linux/hdreg.h
2081 //----------------------------------------------------------------------
2083 struct vki_hd_geometry
{
2084 unsigned char heads
;
2085 unsigned char sectors
;
2086 unsigned short cylinders
;
2087 unsigned long start
;
2090 #define VKI_HDIO_GETGEO 0x0301 /* get device geometry */
2091 #define VKI_HDIO_GET_DMA 0x030b /* get use-dma flag */
2092 #define VKI_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
2094 // [[Nb: done like this because the original type is a huge struct that will
2095 // always be the same size.]]
2096 #define VKI_SIZEOF_STRUCT_HD_DRIVEID 512
2098 //----------------------------------------------------------------------
2099 // From linux-2.6.8.1/include/linux/fb.h
2100 //----------------------------------------------------------------------
2102 #define VKI_FBIOGET_VSCREENINFO 0x4600
2103 #define VKI_FBIOPUT_VSCREENINFO 0x4601
2104 #define VKI_FBIOGET_FSCREENINFO 0x4602
2105 #define VKI_FBIOPAN_DISPLAY 0x4606
2107 struct vki_fb_fix_screeninfo
{
2108 char id
[16]; /* identification string eg "TT Builtin" */
2109 unsigned long smem_start
; /* Start of frame buffer mem */
2110 /* (physical address) */
2111 __vki_u32 smem_len
; /* Length of frame buffer mem */
2112 __vki_u32 type
; /* see FB_TYPE_* */
2113 __vki_u32 type_aux
; /* Interleave for interleaved Planes */
2114 __vki_u32 visual
; /* see FB_VISUAL_* */
2115 __vki_u16 xpanstep
; /* zero if no hardware panning */
2116 __vki_u16 ypanstep
; /* zero if no hardware panning */
2117 __vki_u16 ywrapstep
; /* zero if no hardware ywrap */
2118 __vki_u32 line_length
; /* length of a line in bytes */
2119 unsigned long mmio_start
; /* Start of Memory Mapped I/O */
2120 /* (physical address) */
2121 __vki_u32 mmio_len
; /* Length of Memory Mapped I/O */
2122 __vki_u32 accel
; /* Indicate to driver which */
2123 /* specific chip/card we have */
2124 __vki_u16 reserved
[3]; /* Reserved for future compatibility */
2127 struct vki_fb_bitfield
{
2128 __vki_u32 offset
; /* beginning of bitfield */
2129 __vki_u32 length
; /* length of bitfield */
2130 __vki_u32 msb_right
; /* != 0 : Most significant bit is */
2134 struct vki_fb_var_screeninfo
{
2135 __vki_u32 xres
; /* visible resolution */
2137 __vki_u32 xres_virtual
; /* virtual resolution */
2138 __vki_u32 yres_virtual
;
2139 __vki_u32 xoffset
; /* offset from virtual to visible */
2140 __vki_u32 yoffset
; /* resolution */
2142 __vki_u32 bits_per_pixel
; /* guess what */
2143 __vki_u32 grayscale
; /* != 0 Graylevels instead of colors */
2145 struct vki_fb_bitfield red
; /* bitfield in fb mem if true color, */
2146 struct vki_fb_bitfield green
; /* else only length is significant */
2147 struct vki_fb_bitfield blue
;
2148 struct vki_fb_bitfield transp
; /* transparency */
2150 __vki_u32 nonstd
; /* != 0 Non standard pixel format */
2152 __vki_u32 activate
; /* see FB_ACTIVATE_* */
2154 __vki_u32 height
; /* height of picture in mm */
2155 __vki_u32 width
; /* width of picture in mm */
2157 __vki_u32 accel_flags
; /* (OBSOLETE) see fb_info.flags */
2159 /* Timing: All values in pixclocks, except pixclock (of course) */
2160 __vki_u32 pixclock
; /* pixel clock in ps (pico seconds) */
2161 __vki_u32 left_margin
; /* time from sync to picture */
2162 __vki_u32 right_margin
; /* time from picture to sync */
2163 __vki_u32 upper_margin
; /* time from sync to picture */
2164 __vki_u32 lower_margin
;
2165 __vki_u32 hsync_len
; /* length of horizontal sync */
2166 __vki_u32 vsync_len
; /* length of vertical sync */
2167 __vki_u32 sync
; /* see FB_SYNC_* */
2168 __vki_u32 vmode
; /* see FB_VMODE_* */
2169 __vki_u32 rotate
; /* angle we rotate counter clockwise */
2170 __vki_u32 reserved
[5]; /* Reserved for future compatibility */
2173 //----------------------------------------------------------------------
2174 // From linux-2.6.9/include/linux/kd.h
2175 //----------------------------------------------------------------------
2177 #define VKI_GIO_FONT 0x4B60 /* gets font in expanded form */
2178 #define VKI_PIO_FONT 0x4B61 /* use font in expanded form */
2180 #define VKI_GIO_FONTX 0x4B6B /* get font using struct consolefontdesc */
2181 #define VKI_PIO_FONTX 0x4B6C /* set font using struct consolefontdesc */
2182 struct vki_consolefontdesc
{
2183 unsigned short charcount
; /* characters in font (256 or 512) */
2184 unsigned short charheight
; /* scan lines per character (1-32) */
2185 char __user
*chardata
; /* font data in expanded form */
2188 #define VKI_PIO_FONTRESET 0x4B6D /* reset to default font */
2190 #define VKI_GIO_CMAP 0x4B70 /* gets colour palette on VGA+ */
2191 #define VKI_PIO_CMAP 0x4B71 /* sets colour palette on VGA+ */
2193 #define VKI_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */
2194 #define VKI_KDMKTONE 0x4B30 /* generate tone */
2196 #define VKI_KDGETLED 0x4B31 /* return current led state */
2197 #define VKI_KDSETLED 0x4B32 /* set led state [lights, not flags] */
2199 #define VKI_KDGKBTYPE 0x4B33 /* get keyboard type */
2201 #define VKI_KDADDIO 0x4B34 /* add i/o port as valid */
2202 #define VKI_KDDELIO 0x4B35 /* del i/o port as valid */
2203 #define VKI_KDENABIO 0x4B36 /* enable i/o to video board */
2204 #define VKI_KDDISABIO 0x4B37 /* disable i/o to video board */
2206 #define VKI_KDSETMODE 0x4B3A /* set text/graphics mode */
2207 #define VKI_KDGETMODE 0x4B3B /* get current mode */
2209 #define VKI_KDMAPDISP 0x4B3C /* map display into address space */
2210 #define VKI_KDUNMAPDISP 0x4B3D /* unmap display from address space */
2212 #define VKI_E_TABSZ 256
2213 #define VKI_GIO_SCRNMAP 0x4B40 /* get screen mapping from kernel */
2214 #define VKI_PIO_SCRNMAP 0x4B41 /* put screen mapping table in kernel */
2215 #define VKI_GIO_UNISCRNMAP 0x4B69 /* get full Unicode screen mapping */
2216 #define VKI_PIO_UNISCRNMAP 0x4B6A /* set full Unicode screen mapping */
2218 #define VKI_GIO_UNIMAP 0x4B66 /* get unicode-to-font mapping from kernel */
2219 struct vki_unipair
{
2220 unsigned short unicode
;
2221 unsigned short fontpos
;
2223 struct vki_unimapdesc
{
2224 unsigned short entry_ct
;
2225 struct vki_unipair __user
*entries
;
2227 #define VKI_PIO_UNIMAP 0x4B67 /* put unicode-to-font mapping in kernel */
2228 #define VKI_PIO_UNIMAPCLR 0x4B68 /* clear table, possibly advise hash algorithm */
2229 struct vki_unimapinit
{
2230 unsigned short advised_hashsize
; /* 0 if no opinion */
2231 unsigned short advised_hashstep
; /* 0 if no opinion */
2232 unsigned short advised_hashlevel
; /* 0 if no opinion */
2235 #define VKI_KDGKBMODE 0x4B44 /* gets current keyboard mode */
2236 #define VKI_KDSKBMODE 0x4B45 /* sets current keyboard mode */
2238 #define VKI_KDGKBMETA 0x4B62 /* gets meta key handling mode */
2239 #define VKI_KDSKBMETA 0x4B63 /* sets meta key handling mode */
2241 #define VKI_KDGKBLED 0x4B64 /* get led flags (not lights) */
2242 #define VKI_KDSKBLED 0x4B65 /* set led flags (not lights) */
2244 struct vki_kbentry
{
2245 unsigned char kb_table
;
2246 unsigned char kb_index
;
2247 unsigned short kb_value
;
2249 #define VKI_KDGKBENT 0x4B46 /* gets one entry in translation table */
2250 #define VKI_KDSKBENT 0x4B47 /* sets one entry in translation table */
2252 struct vki_kbsentry
{
2253 unsigned char kb_func
;
2254 unsigned char kb_string
[512];
2256 #define VKI_KDGKBSENT 0x4B48 /* gets one function key string entry */
2257 #define VKI_KDSKBSENT 0x4B49 /* sets one function key string entry */
2259 struct vki_kbdiacr
{
2260 unsigned char diacr
, base
, result
;
2262 struct vki_kbdiacrs
{
2263 unsigned int kb_cnt
; /* number of entries in following array */
2264 struct vki_kbdiacr kbdiacr
[256]; /* MAX_DIACR from keyboard.h */
2266 #define VKI_KDGKBDIACR 0x4B4A /* read kernel accent table */
2267 #define VKI_KDSKBDIACR 0x4B4B /* write kernel accent table */
2269 struct vki_kbkeycode
{
2270 unsigned int scancode
, keycode
;
2272 #define VKI_KDGETKEYCODE 0x4B4C /* read kernel keycode table entry */
2273 #define VKI_KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */
2275 #define VKI_KDSIGACCEPT 0x4B4E /* accept kbd generated signals */
2277 struct vki_kbd_repeat
{
2278 int delay
; /* in msec; <= 0: don't change */
2279 int period
; /* in msec; <= 0: don't change */
2280 /* earlier this field was misnamed "rate" */
2282 #define VKI_KDKBDREP 0x4B52 /* set keyboard delay/repeat rate;
2283 * actually used values are returned */
2285 #define VKI_KDFONTOP 0x4B72 /* font operations */
2287 struct vki_console_font_op
{
2288 unsigned int op
; /* operation code KD_FONT_OP_* */
2289 unsigned int flags
; /* KD_FONT_FLAG_* */
2290 unsigned int width
, height
; /* font size */
2291 unsigned int charcount
;
2292 unsigned char __user
*data
; /* font data with height fixed to 32 */
2295 #define VKI_KD_FONT_OP_SET 0 /* Set font */
2296 #define VKI_KD_FONT_OP_GET 1 /* Get font */
2297 #define VKI_KD_FONT_OP_SET_DEFAULT 2 /* Set font to default, data points to name / NULL */
2298 #define VKI_KD_FONT_OP_COPY 3 /* Copy from another console */
2300 //----------------------------------------------------------------------
2301 // From linux-2.6.9/include/linux/kb.h
2302 //----------------------------------------------------------------------
2304 typedef __vki_kernel_uid32_t vki_qid_t
; /* Type in which we store ids in memory */
2306 //----------------------------------------------------------------------
2307 // From linux-2.6.20.1/include/linux/ptrace.h
2308 //----------------------------------------------------------------------
2310 #define VKI_PTRACE_TRACEME 0
2311 #define VKI_PTRACE_PEEKTEXT 1
2312 #define VKI_PTRACE_PEEKDATA 2
2313 #define VKI_PTRACE_PEEKUSR 3
2314 #define VKI_PTRACE_POKEUSR 6
2316 #define VKI_PTRACE_DETACH 17
2318 #define VKI_PTRACE_GETEVENTMSG 0x4201
2319 #define VKI_PTRACE_GETSIGINFO 0x4202
2320 #define VKI_PTRACE_SETSIGINFO 0x4203
2321 #define VKI_PTRACE_GETREGSET 0x4204
2322 #define VKI_PTRACE_SETREGSET 0x4205
2324 //----------------------------------------------------------------------
2325 // From linux-2.6.14/include/sound/asound.h
2326 //----------------------------------------------------------------------
2329 VKI_SNDRV_PCM_IOCTL_HW_FREE
= _VKI_IO('A', 0x12),
2330 VKI_SNDRV_PCM_IOCTL_HWSYNC
= _VKI_IO('A', 0x22),
2331 VKI_SNDRV_PCM_IOCTL_PREPARE
= _VKI_IO('A', 0x40),
2332 VKI_SNDRV_PCM_IOCTL_RESET
= _VKI_IO('A', 0x41),
2333 VKI_SNDRV_PCM_IOCTL_START
= _VKI_IO('A', 0x42),
2334 VKI_SNDRV_PCM_IOCTL_DROP
= _VKI_IO('A', 0x43),
2335 VKI_SNDRV_PCM_IOCTL_DRAIN
= _VKI_IO('A', 0x44),
2336 VKI_SNDRV_PCM_IOCTL_PAUSE
= _VKI_IOW('A', 0x45, int),
2337 VKI_SNDRV_PCM_IOCTL_RESUME
= _VKI_IO('A', 0x47),
2338 VKI_SNDRV_PCM_IOCTL_XRUN
= _VKI_IO('A', 0x48),
2339 VKI_SNDRV_PCM_IOCTL_LINK
= _VKI_IOW('A', 0x60, int),
2340 VKI_SNDRV_PCM_IOCTL_UNLINK
= _VKI_IO('A', 0x61),
2344 VKI_SNDRV_TIMER_IOCTL_START
= _VKI_IO('T', 0xa0),
2345 VKI_SNDRV_TIMER_IOCTL_STOP
= _VKI_IO('T', 0xa1),
2346 VKI_SNDRV_TIMER_IOCTL_CONTINUE
= _VKI_IO('T', 0xa2),
2347 VKI_SNDRV_TIMER_IOCTL_PAUSE
= _VKI_IO('T', 0xa3),
2350 struct vki_snd_ctl_card_info
{
2351 int card
; /* card number */
2352 int pad
; /* reserved for future (was type) */
2353 unsigned char id
[16]; /* ID of card (user selectable) */
2354 unsigned char driver
[16]; /* Driver name */
2355 unsigned char name
[32]; /* Short name of soundcard */
2356 unsigned char longname
[80]; /* name + info text about soundcard */
2357 unsigned char reserved_
[16]; /* reserved for future (was ID of mixer) */
2358 unsigned char mixername
[80]; /* visual mixer identification */
2359 unsigned char components
[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */
2362 typedef int vki_snd_ctl_elem_iface_t
;
2363 #define VKI_SNDRV_CTL_ELEM_IFACE_CARD ((vki_snd_ctl_elem_iface_t) 0) /* global control */
2364 #define VKI_SNDRV_CTL_ELEM_IFACE_HWDEP ((vki_snd_ctl_elem_iface_t) 1) /* hardware dependent device */
2365 #define VKI_SNDRV_CTL_ELEM_IFACE_MIXER ((vki_snd_ctl_elem_iface_t) 2) /* virtual mixer device */
2366 #define VKI_SNDRV_CTL_ELEM_IFACE_PCM ((vki_snd_ctl_elem_iface_t) 3) /* PCM device */
2367 #define VKI_SNDRV_CTL_ELEM_IFACE_RAWMIDI ((vki_snd_ctl_elem_iface_t) 4) /* RawMidi device */
2368 #define VKI_SNDRV_CTL_ELEM_IFACE_TIMER ((vki_snd_ctl_elem_iface_t) 5) /* timer device */
2369 #define VKI_SNDRV_CTL_ELEM_IFACE_SEQUENCER ((vki_snd_ctl_elem_iface_t) 6) /* sequencer client */
2370 #define VKI_SNDRV_CTL_ELEM_IFACE_LAST VKI_SNDRV_CTL_ELEM_IFACE_SEQUENCER
2372 struct vki_snd_ctl_elem_id
{
2373 unsigned int numid
; /* numeric identifier, zero = invalid */
2374 vki_snd_ctl_elem_iface_t iface
; /* interface identifier */
2375 unsigned int device
; /* device/client number */
2376 unsigned int subdevice
; /* subdevice (substream) number */
2377 unsigned char name
[44]; /* ASCII name of item */
2378 unsigned int index
; /* index of item */
2381 struct vki_snd_ctl_elem_list
{
2382 unsigned int offset
; /* W: first element ID to get */
2383 unsigned int space
; /* W: count of element IDs to get */
2384 unsigned int used
; /* R: count of element IDs set */
2385 unsigned int count
; /* R: count of all elements */
2386 struct vki_snd_ctl_elem_id __user
*pids
; /* R: IDs */
2387 unsigned char reserved
[50];
2390 struct vki_snd_ctl_tlv
{
2391 unsigned int numid
; /* control element numeric identification */
2392 unsigned int length
; /* in bytes aligned to 4 */
2393 unsigned int tlv
[0]; /* first TLV */
2396 #define VKI_SNDRV_CTL_IOCTL_PVERSION _VKI_IOR('U', 0x00, int)
2397 #define VKI_SNDRV_CTL_IOCTL_CARD_INFO _VKI_IOR('U', 0x01, struct vki_snd_ctl_card_info)
2398 #define VKI_SNDRV_CTL_IOCTL_ELEM_LIST _VKI_IOWR('U', 0x10, struct vki_snd_ctl_elem_list)
2399 #define VKI_SNDRV_CTL_IOCTL_TLV_READ _VKI_IOWR('U', 0x1a, struct vki_snd_ctl_tlv)
2400 #define VKI_SNDRV_CTL_IOCTL_TLV_WRITE _VKI_IOWR('U', 0x1b, struct vki_snd_ctl_tlv)
2401 #define VKI_SNDRV_CTL_IOCTL_TLV_COMMAND _VKI_IOWR('U', 0x1c, struct vki_snd_ctl_tlv)
2403 //----------------------------------------------------------------------
2404 // From linux-2.6.15.4/include/linux/serial.h
2405 //----------------------------------------------------------------------
2407 struct vki_serial_icounter_struct
{
2408 int cts
, dsr
, rng
, dcd
;
2410 int frame
, overrun
, parity
, brk
;
2415 //----------------------------------------------------------------------
2416 // From linux-2.6.16/include/linux/vt.h
2417 //----------------------------------------------------------------------
2419 #define VKI_VT_OPENQRY 0x5600 /* find available vt */
2421 struct vki_vt_mode
{
2422 char mode
; /* vt mode */
2423 char waitv
; /* if set, hang on writes if not active */
2424 short relsig
; /* signal to raise on release req */
2425 short acqsig
; /* signal to raise on acquisition */
2426 short frsig
; /* unused (set to 0) */
2428 #define VKI_VT_GETMODE 0x5601 /* get mode of active vt */
2429 #define VKI_VT_SETMODE 0x5602 /* set mode of active vt */
2431 struct vki_vt_stat
{
2432 unsigned short v_active
; /* active vt */
2433 unsigned short v_signal
; /* signal to send */
2434 unsigned short v_state
; /* vt bitmask */
2436 #define VKI_VT_GETSTATE 0x5603 /* get global vt state info */
2437 #define VKI_VT_SENDSIG 0x5604 /* signal to send to bitmask of vts */
2439 #define VKI_VT_RELDISP 0x5605 /* release display */
2441 #define VKI_VT_ACTIVATE 0x5606 /* make vt active */
2442 #define VKI_VT_WAITACTIVE 0x5607 /* wait for vt active */
2443 #define VKI_VT_DISALLOCATE 0x5608 /* free memory associated to vt */
2445 struct vki_vt_sizes
{
2446 unsigned short v_rows
; /* number of rows */
2447 unsigned short v_cols
; /* number of columns */
2448 unsigned short v_scrollsize
; /* number of lines of scrollback */
2450 #define VKI_VT_RESIZE 0x5609 /* set kernel's idea of screensize */
2452 struct vki_vt_consize
{
2453 unsigned short v_rows
; /* number of rows */
2454 unsigned short v_cols
; /* number of columns */
2455 unsigned short v_vlin
; /* number of pixel rows on screen */
2456 unsigned short v_clin
; /* number of pixel rows per character */
2457 unsigned short v_vcol
; /* number of pixel columns on screen */
2458 unsigned short v_ccol
; /* number of pixel columns per character */
2460 #define VKI_VT_RESIZEX 0x560A /* set kernel's idea of screensize + more */
2461 #define VKI_VT_LOCKSWITCH 0x560B /* disallow vt switching */
2462 #define VKI_VT_UNLOCKSWITCH 0x560C /* allow vt switching */
2464 //----------------------------------------------------------------------
2465 // From linux-2.6.19/include/linux/prctl.h
2466 //----------------------------------------------------------------------
2468 #define VKI_PR_SET_PDEATHSIG 1 /* Second arg is a signal */
2469 #define VKI_PR_GET_PDEATHSIG 2 /* Second arg is a ptr to return the signal */
2471 #define VKI_PR_GET_DUMPABLE 3
2472 #define VKI_PR_SET_DUMPABLE 4
2474 #define VKI_PR_GET_UNALIGN 5
2475 #define VKI_PR_SET_UNALIGN 6
2476 # define VKI_PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */
2477 # define VKI_PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */
2479 #define VKI_PR_GET_KEEPCAPS 7
2480 #define VKI_PR_SET_KEEPCAPS 8
2482 #define VKI_PR_GET_FPEMU 9
2483 #define VKI_PR_SET_FPEMU 10
2484 # define VKI_PR_FPEMU_NOPRINT 1 /* silently emulate fp operations accesses */
2485 # define VKI_PR_FPEMU_SIGFPE 2 /* don't emulate fp operations, send SIGFPE instead */
2487 #define VKI_PR_GET_FPEXC 11
2488 #define VKI_PR_SET_FPEXC 12
2489 # define VKI_PR_FP_EXC_SW_ENABLE 0x80 /* Use FPEXC for FP exception enables */
2490 # define VKI_PR_FP_EXC_DIV 0x010000 /* floating point divide by zero */
2491 # define VKI_PR_FP_EXC_OVF 0x020000 /* floating point overflow */
2492 # define VKI_PR_FP_EXC_UND 0x040000 /* floating point underflow */
2493 # define VKI_PR_FP_EXC_RES 0x080000 /* floating point inexact result */
2494 # define VKI_PR_FP_EXC_INV 0x100000 /* floating point invalid operation */
2495 # define VKI_PR_FP_EXC_DISABLED 0 /* FP exceptions disabled */
2496 # define VKI_PR_FP_EXC_NONRECOV 1 /* async non-recoverable exc. mode */
2497 # define VKI_PR_FP_EXC_ASYNC 2 /* async recoverable exception mode */
2498 # define VKI_PR_FP_EXC_PRECISE 3 /* precise exception mode */
2500 #define VKI_PR_GET_TIMING 13
2501 #define VKI_PR_SET_TIMING 14
2502 # define VKI_PR_TIMING_STATISTICAL 0 /* Normal, traditional,
2503 statistical process timing */
2504 # define VKI_PR_TIMING_TIMESTAMP 1 /* Accurate timestamp based
2507 #define VKI_PR_SET_NAME 15 /* Set process name */
2508 #define VKI_PR_GET_NAME 16 /* Get process name */
2510 #define VKI_PR_GET_ENDIAN 19
2511 #define VKI_PR_SET_ENDIAN 20
2512 # define VKI_PR_ENDIAN_BIG 0
2513 # define VKI_PR_ENDIAN_LITTLE 1 /* True little endian mode */
2514 # define VKI_PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */
2516 #define VKI_PR_SET_SECCOMP 22
2518 #define VKI_PR_SET_PTRACER 0x59616d61
2520 //----------------------------------------------------------------------
2521 // From linux-2.6.19/include/linux/usbdevice_fs.h
2522 //----------------------------------------------------------------------
2524 struct vki_usbdevfs_ctrltransfer
{
2525 __vki_u8 bRequestType
;
2530 __vki_u32 timeout
; /* in milliseconds */
2534 struct vki_usbdevfs_bulktransfer
{
2537 unsigned int timeout
; /* in milliseconds */
2541 #define VKI_USBDEVFS_MAXDRIVERNAME 255
2543 struct vki_usbdevfs_getdriver
{
2544 unsigned int interface
;
2545 char driver
[VKI_USBDEVFS_MAXDRIVERNAME
+ 1];
2548 struct vki_usbdevfs_connectinfo
{
2549 unsigned int devnum
;
2553 struct vki_usbdevfs_iso_packet_desc
{
2554 unsigned int length
;
2555 unsigned int actual_length
;
2556 unsigned int status
;
2559 struct vki_usbdevfs_urb
{
2561 unsigned char endpoint
;
2564 void __user
*buffer
;
2568 int number_of_packets
;
2570 unsigned int signr
; /* signal to be sent on error, -1 if none should be sent */
2572 struct vki_usbdevfs_iso_packet_desc iso_frame_desc
[0];
2575 struct vki_usbdevfs_ioctl
{
2576 int ifno
; /* interface 0..N ; negative numbers reserved */
2577 int ioctl_code
; /* MUST encode size + direction of data so the
2578 * macros in <asm/ioctl.h> give correct values */
2579 void __user
*data
; /* param buffer (in, or out) */
2582 #define VKI_USBDEVFS_CONTROL _VKI_IOWR('U', 0, struct vki_usbdevfs_ctrltransfer)
2583 #define VKI_USBDEVFS_BULK _VKI_IOWR('U', 2, struct vki_usbdevfs_bulktransfer)
2584 #define VKI_USBDEVFS_GETDRIVER _VKI_IOW('U', 8, struct vki_usbdevfs_getdriver)
2585 #define VKI_USBDEVFS_SUBMITURB _VKI_IOR('U', 10, struct vki_usbdevfs_urb)
2586 #define VKI_USBDEVFS_DISCARDURB _VKI_IO('U', 11)
2587 #define VKI_USBDEVFS_REAPURB _VKI_IOW('U', 12, void *)
2588 #define VKI_USBDEVFS_REAPURBNDELAY _VKI_IOW('U', 13, void *)
2589 #define VKI_USBDEVFS_CONNECTINFO _VKI_IOW('U', 17, struct vki_usbdevfs_connectinfo)
2590 #define VKI_USBDEVFS_IOCTL _VKI_IOWR('U', 18, struct vki_usbdevfs_ioctl)
2591 #define VKI_USBDEVFS_RESET _VKI_IO('U', 20)
2593 #define VKI_USBDEVFS_URB_TYPE_ISO 0
2594 #define VKI_USBDEVFS_URB_TYPE_INTERRUPT 1
2595 #define VKI_USBDEVFS_URB_TYPE_CONTROL 2
2596 #define VKI_USBDEVFS_URB_TYPE_BULK 3
2598 // [[this is missing in usbdevice_fs.h]]
2599 struct vki_usbdevfs_setuppacket
{
2600 __vki_u8 bRequestType
;
2607 //----------------------------------------------------------------------
2608 // From linux-2.6.20.1/include/linux/i2c.h
2609 //----------------------------------------------------------------------
2611 #define VKI_I2C_SMBUS_QUICK 0
2612 #define VKI_I2C_SMBUS_BYTE 1
2613 #define VKI_I2C_SMBUS_BYTE_DATA 2
2614 #define VKI_I2C_SMBUS_WORD_DATA 3
2615 #define VKI_I2C_SMBUS_PROC_CALL 4
2616 #define VKI_I2C_SMBUS_BLOCK_DATA 5
2617 #define VKI_I2C_SMBUS_I2C_BLOCK_BROKEN 6
2618 #define VKI_I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */
2619 #define VKI_I2C_SMBUS_I2C_BLOCK_DATA 8
2621 /* smbus_access read or write markers */
2622 #define VKI_I2C_SMBUS_READ 1
2623 #define VKI_I2C_SMBUS_WRITE 0
2625 #define VKI_I2C_SLAVE 0x0703 /* Change slave address */
2626 /* Attn.: Slave address is 7 or 10 bits */
2627 #define VKI_I2C_SLAVE_FORCE 0x0706 /* Change slave address */
2628 /* Attn.: Slave address is 7 or 10 bits */
2629 /* This changes the address, even if it */
2630 /* is already taken! */
2631 #define VKI_I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
2632 #define VKI_I2C_FUNCS 0x0705 /* Get the adapter functionality */
2633 #define VKI_I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */
2634 #define VKI_I2C_PEC 0x0708 /* != 0 for SMBus PEC */
2635 #define VKI_I2C_SMBUS 0x0720 /* SMBus transfer */
2637 #define VKI_I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */
2638 union vki_i2c_smbus_data
{
2641 __vki_u8 block
[VKI_I2C_SMBUS_BLOCK_MAX
+ 2];
2642 /* block[0] is used for length */
2643 /* and one more for PEC */
2646 /* This is the structure as used in the I2C_SMBUS ioctl call */
2647 struct vki_i2c_smbus_ioctl_data
{
2648 __vki_u8 read_write
;
2651 union vki_i2c_smbus_data __user
*data
;
2654 struct vki_i2c_msg
{
2655 __vki_u16 addr
; /* slave address */
2657 #define VKI_I2C_M_TEN 0x0010 /* this is a ten bit chip address */
2658 #define VKI_I2C_M_RD 0x0001 /* read data, from slave to master */
2659 #define VKI_I2C_M_NOSTART 0x4000 /* if I2C_FUNC_PROTOCOL_MANGLING */
2660 #define VKI_I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */
2661 #define VKI_I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */
2662 #define VKI_I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */
2663 #define VKI_I2C_M_RECV_LEN 0x0400 /* length will be first received byte */
2664 __vki_u16 len
; /* msg length */
2665 __vki_u8
*buf
; /* pointer to msg data */
2668 struct vki_i2c_rdwr_ioctl_data
{
2669 struct vki_i2c_msg
*msgs
; /* pointers to i2c_msgs */
2670 __vki_u32 nmsgs
; /* number of i2c_msgs */
2673 //----------------------------------------------------------------------
2674 // From linux-2.6.20.1/include/linux/keyctl.h
2675 //----------------------------------------------------------------------
2677 /* keyctl commands */
2678 #define VKI_KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */
2679 #define VKI_KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */
2680 #define VKI_KEYCTL_UPDATE 2 /* update a key */
2681 #define VKI_KEYCTL_REVOKE 3 /* revoke a key */
2682 #define VKI_KEYCTL_CHOWN 4 /* set ownership of a key */
2683 #define VKI_KEYCTL_SETPERM 5 /* set perms on a key */
2684 #define VKI_KEYCTL_DESCRIBE 6 /* describe a key */
2685 #define VKI_KEYCTL_CLEAR 7 /* clear contents of a keyring */
2686 #define VKI_KEYCTL_LINK 8 /* link a key into a keyring */
2687 #define VKI_KEYCTL_UNLINK 9 /* unlink a key from a keyring */
2688 #define VKI_KEYCTL_SEARCH 10 /* search for a key in a keyring */
2689 #define VKI_KEYCTL_READ 11 /* read a key or keyring's contents */
2690 #define VKI_KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */
2691 #define VKI_KEYCTL_NEGATE 13 /* negate a partially constructed key */
2692 #define VKI_KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */
2693 #define VKI_KEYCTL_SET_TIMEOUT 15 /* set key timeout */
2694 #define VKI_KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */
2696 /*--------------------------------------------------------------------*/
2697 // From linux-2.6.20.1/include/linux/key.h
2698 /*--------------------------------------------------------------------*/
2700 /* key handle serial number */
2701 typedef vki_int32_t vki_key_serial_t
;
2703 /* key handle permissions mask */
2704 typedef vki_uint32_t vki_key_perm_t
;
2706 //----------------------------------------------------------------------
2707 // From linux-2.6.24.7/include/linux/wireless.h
2708 // (wireless extensions version 22, 2007-03-16)
2709 //----------------------------------------------------------------------
2712 * [[Wireless extensions ioctls.]]
2715 /* Wireless Identification */
2716 #define VKI_SIOCSIWCOMMIT 0x8B00 /* Commit pending changes to driver */
2717 #define VKI_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */
2719 /* Basic operations */
2720 #define VKI_SIOCSIWNWID 0x8B02 /* set network id (pre-802.11) */
2721 #define VKI_SIOCGIWNWID 0x8B03 /* get network id (the cell) */
2722 #define VKI_SIOCSIWFREQ 0x8B04 /* set channel/frequency (Hz) */
2723 #define VKI_SIOCGIWFREQ 0x8B05 /* get channel/frequency (Hz) */
2724 #define VKI_SIOCSIWMODE 0x8B06 /* set operation mode */
2725 #define VKI_SIOCGIWMODE 0x8B07 /* get operation mode */
2726 #define VKI_SIOCSIWSENS 0x8B08 /* set sensitivity (dBm) */
2727 #define VKI_SIOCGIWSENS 0x8B09 /* get sensitivity (dBm) */
2729 /* Informative stuff */
2730 #define VKI_SIOCSIWRANGE 0x8B0A /* Unused */
2731 #define VKI_SIOCGIWRANGE 0x8B0B /* Get range of parameters */
2732 #define VKI_SIOCSIWPRIV 0x8B0C /* Unused */
2733 #define VKI_SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */
2734 #define VKI_SIOCSIWSTATS 0x8B0E /* Unused */
2735 #define VKI_SIOCGIWSTATS 0x8B0F /* Get /proc/net/wireless stats */
2737 /* Spy support (statistics per MAC address - used for Mobile IP support) */
2738 #define VKI_SIOCSIWSPY 0x8B10 /* set spy addresses */
2739 #define VKI_SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */
2740 #define VKI_SIOCSIWTHRSPY 0x8B12 /* set spy threshold (spy event) */
2741 #define VKI_SIOCGIWTHRSPY 0x8B13 /* get spy threshold */
2743 /* Access Point manipulation */
2744 #define VKI_SIOCSIWAP 0x8B14 /* set access point MAC addresses */
2745 #define VKI_SIOCGIWAP 0x8B15 /* get access point MAC addresses */
2746 #define VKI_SIOCGIWAPLIST 0x8B17 /* Deprecated in favor of scanning */
2747 #define VKI_SIOCSIWSCAN 0x8B18 /* trigger scanning (list cells) */
2748 #define VKI_SIOCGIWSCAN 0x8B19 /* get scanning results */
2750 /* 802.11 specific support */
2751 #define VKI_SIOCSIWESSID 0x8B1A /* set ESSID (network name) */
2752 #define VKI_SIOCGIWESSID 0x8B1B /* get ESSID */
2753 #define VKI_SIOCSIWNICKN 0x8B1C /* set node name/nickname */
2754 #define VKI_SIOCGIWNICKN 0x8B1D /* get node name/nickname */
2756 /* Other parameters useful in 802.11 and some other devices */
2757 #define VKI_SIOCSIWRATE 0x8B20 /* set default bit rate (bps) */
2758 #define VKI_SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */
2759 #define VKI_SIOCSIWRTS 0x8B22 /* set RTS/CTS threshold (bytes) */
2760 #define VKI_SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */
2761 #define VKI_SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */
2762 #define VKI_SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */
2763 #define VKI_SIOCSIWTXPOW 0x8B26 /* set transmit power (dBm) */
2764 #define VKI_SIOCGIWTXPOW 0x8B27 /* get transmit power (dBm) */
2765 #define VKI_SIOCSIWRETRY 0x8B28 /* set retry limits and lifetime */
2766 #define VKI_SIOCGIWRETRY 0x8B29 /* get retry limits and lifetime */
2768 /* Encoding stuff (scrambling, hardware security, WEP...) */
2769 #define VKI_SIOCSIWENCODE 0x8B2A /* set encoding token & mode */
2770 #define VKI_SIOCGIWENCODE 0x8B2B /* get encoding token & mode */
2772 /* Power saving stuff (power management, unicast and multicast) */
2773 #define VKI_SIOCSIWPOWER 0x8B2C /* set Power Management settings */
2774 #define VKI_SIOCGIWPOWER 0x8B2D /* get Power Management settings */
2776 /* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM). */
2777 #define VKI_SIOCSIWGENIE 0x8B30 /* set generic IE */
2778 #define VKI_SIOCGIWGENIE 0x8B31 /* get generic IE */
2780 /* WPA : IEEE 802.11 MLME requests */
2781 #define VKI_SIOCSIWMLME 0x8B16 /* request MLME operation; uses
2783 /* WPA : Authentication mode parameters */
2784 #define VKI_SIOCSIWAUTH 0x8B32 /* set authentication mode params */
2785 #define VKI_SIOCGIWAUTH 0x8B33 /* get authentication mode params */
2787 /* WPA : Extended version of encoding configuration */
2788 #define VKI_SIOCSIWENCODEEXT 0x8B34 /* set encoding token & mode */
2789 #define VKI_SIOCGIWENCODEEXT 0x8B35 /* get encoding token & mode */
2791 /* WPA2 : PMKSA cache management */
2792 #define VKI_SIOCSIWPMKSA 0x8B36 /* PMKSA cache operation */
2795 * [[Payload for the wireless extensions ioctls.]]
2800 __vki_s32 value
; /* The value of the parameter itself */
2801 __vki_u8 fixed
; /* Hardware should not use auto select */
2802 __vki_u8 disabled
; /* Disable the feature */
2803 __vki_u16 flags
; /* Various specifc flags (if any) */
2808 void __user
*pointer
; /* Pointer to the data (in user space) */
2809 __vki_u16 length
; /* number of fields or size in bytes */
2810 __vki_u16 flags
; /* Optional params */
2815 __vki_s32 m
; /* Mantissa */
2816 __vki_s16 e
; /* Exponent */
2817 __vki_u8 i
; /* List index (when in range struct) */
2818 __vki_u8 flags
; /* Flags (fixed/auto) */
2821 struct vki_iw_quality
2823 __vki_u8 qual
; /* link quality (%retries, SNR,
2824 %missed beacons or better...) */
2825 __vki_u8 level
; /* signal level (dBm) */
2826 __vki_u8 noise
; /* noise level (dBm) */
2827 __vki_u8 updated
; /* Flags to know if updated */
2830 union vki_iwreq_data
2832 /* Config - generic */
2833 char name
[VKI_IFNAMSIZ
];
2834 /* Name : used to verify the presence of wireless extensions.
2835 * Name of the protocol/provider... */
2837 struct vki_iw_point essid
; /* Extended network name */
2838 struct vki_iw_param nwid
; /* network id (or domain - the cell) */
2839 struct vki_iw_freq freq
; /* frequency or channel :
2841 * > 1000 = frequency in Hz */
2843 struct vki_iw_param sens
; /* signal level threshold */
2844 struct vki_iw_param bitrate
;/* default bit rate */
2845 struct vki_iw_param txpower
;/* default transmit power */
2846 struct vki_iw_param rts
; /* RTS threshold threshold */
2847 struct vki_iw_param frag
; /* Fragmentation threshold */
2848 __vki_u32 mode
; /* Operation mode */
2849 struct vki_iw_param retry
; /* Retry limits & lifetime */
2851 struct vki_iw_point encoding
; /* Encoding stuff : tokens */
2852 struct vki_iw_param power
; /* PM duration/timeout */
2853 struct vki_iw_quality qual
; /* Quality part of statistics */
2855 struct vki_sockaddr ap_addr
; /* Access point address */
2856 struct vki_sockaddr addr
; /* Destination address (hw/mac) */
2858 struct vki_iw_param param
; /* Other small parameters */
2859 struct vki_iw_point data
; /* Other large parameters */
2866 char ifrn_name
[VKI_IFNAMSIZ
]; /* if name, e.g. "eth0" */
2869 /* Data part (defined just above) */
2870 union vki_iwreq_data u
;
2873 /*--------------------------------------------------------------------*/
2874 // From linux-2.6.31.5/include/linux/perf_event.h
2875 /*--------------------------------------------------------------------*/
2877 struct vki_perf_event_attr
{
2880 * Major type: hardware/software/tracepoint/etc.
2885 * Size of the attr structure, for fwd/bwd compat.
2890 * Type specific configuration information.
2895 __vki_u64 sample_period
;
2896 __vki_u64 sample_freq
;
2899 __vki_u64 sample_type
;
2900 __vki_u64 read_format
;
2902 __vki_u64 disabled
: 1, /* off by default */
2903 inherit
: 1, /* children inherit it */
2904 pinned
: 1, /* must always be on PMU */
2905 exclusive
: 1, /* only group on PMU */
2906 exclude_user
: 1, /* don't count user */
2907 exclude_kernel
: 1, /* ditto kernel */
2908 exclude_hv
: 1, /* ditto hypervisor */
2909 exclude_idle
: 1, /* don't count when idle */
2910 mmap
: 1, /* include mmap data */
2911 comm
: 1, /* include comm data */
2912 freq
: 1, /* use freq, not period */
2913 inherit_stat
: 1, /* per task counts */
2914 enable_on_exec
: 1, /* next exec enables */
2915 task
: 1, /* trace fork/exit */
2916 watermark
: 1, /* wakeup_watermark */
2920 * 0 - SAMPLE_IP can have arbitrary skid
2921 * 1 - SAMPLE_IP must have constant skid
2922 * 2 - SAMPLE_IP requested to have 0 skid
2923 * 3 - SAMPLE_IP must have 0 skid
2925 * See also PERF_RECORD_MISC_EXACT_IP
2927 precise_ip
: 2, /* skid constraint */
2928 mmap_data
: 1, /* non-exec mmap data */
2929 sample_id_all
: 1, /* sample_type all events */
2934 __vki_u32 wakeup_events
; /* wakeup every n events */
2935 __vki_u32 wakeup_watermark
; /* bytes before wakeup */
2941 __vki_u64 config1
; /* extension of config */
2945 __vki_u64 config2
; /* extension of config1 */
2949 /*--------------------------------------------------------------------*/
2950 // From linux-2.6.32.4/include/linux/getcpu.h
2951 /*--------------------------------------------------------------------*/
2953 struct vki_getcpu_cache
{
2954 unsigned long blob
[128 / sizeof(long)];
2957 //----------------------------------------------------------------------
2958 // From linux-2.6.33.3/include/linux/input.h
2959 //----------------------------------------------------------------------
2962 * IOCTLs (0x00 - 0x7f)
2965 #define VKI_EVIOCGNAME(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x06, len) /* get device name */
2966 #define VKI_EVIOCGPHYS(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x07, len) /* get physical location */
2967 #define VKI_EVIOCGUNIQ(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x08, len) /* get unique identifier */
2969 #define VKI_EVIOCGKEY(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x18, len) /* get global keystate */
2970 #define VKI_EVIOCGLED(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x19, len) /* get all LEDs */
2971 #define VKI_EVIOCGSND(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x1a, len) /* get all sounds status */
2972 #define VKI_EVIOCGSW(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x1b, len) /* get all switch states */
2974 #define VKI_EVIOCGBIT(ev,len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */
2980 #define VKI_EV_SYN 0x00
2981 #define VKI_EV_KEY 0x01
2982 #define VKI_EV_REL 0x02
2983 #define VKI_EV_ABS 0x03
2984 #define VKI_EV_MSC 0x04
2985 #define VKI_EV_SW 0x05
2986 #define VKI_EV_LED 0x11
2987 #define VKI_EV_SND 0x12
2988 #define VKI_EV_REP 0x14
2989 #define VKI_EV_FF 0x15
2990 #define VKI_EV_PWR 0x16
2991 #define VKI_EV_FF_STATUS 0x17
2992 #define VKI_EV_MAX 0x1f
2993 #define VKI_EV_CNT (VKI_EV_MAX+1)
2995 //----------------------------------------------------------------------
2996 // From linux-2.6.39-rc2/include/asm_generic/ioctls.h
2997 //----------------------------------------------------------------------
2999 #ifndef VKI_FIOQSIZE
3000 #define VKI_FIOQSIZE 0x5460 /* Value differs on some platforms */
3004 #define VKI_TIOCSIG _VKI_IOW('T', 0x36, int) /* Value differs on some platforms */
3007 //----------------------------------------------------------------------
3008 // From kernel/common/include/linux/ashmem.h
3009 //----------------------------------------------------------------------
3011 #if defined(VGPV_arm_linux_android) || defined(VGPV_x86_linux_android) \
3012 || defined(VGPV_mips32_linux_android)
3014 #define VKI_ASHMEM_NAME_LEN 256
3016 #define VKI_ASHMEM_NAME_DEF "dev/ashmem"
3018 #define VKI_ASHMEM_NOT_PURGED 0
3019 #define VKI_ASHMEM_WAS_PURGED 1
3021 #define VKI_ASHMEM_IS_UNPINNED 0
3022 #define VKI_ASHMEM_IS_PINNED 1
3024 struct vki_ashmem_pin
{
3025 vki_uint32_t offset
;
3029 #define __VKI_ASHMEMIOC 0x77
3031 #define VKI_ASHMEM_SET_NAME _VKI_IOW(__VKI_ASHMEMIOC, 1, char[VKI_ASHMEM_NAME_LEN])
3032 #define VKI_ASHMEM_GET_NAME _VKI_IOR(__VKI_ASHMEMIOC, 2, char[VKI_ASHMEM_NAME_LEN])
3033 #define VKI_ASHMEM_SET_SIZE _VKI_IOW(__VKI_ASHMEMIOC, 3, vki_size_t)
3034 #define VKI_ASHMEM_GET_SIZE _VKI_IO(__VKI_ASHMEMIOC, 4)
3035 #define VKI_ASHMEM_SET_PROT_MASK _VKI_IOW(__VKI_ASHMEMIOC, 5, unsigned long)
3036 #define VKI_ASHMEM_GET_PROT_MASK _VKI_IO(__VKI_ASHMEMIOC, 6)
3037 #define VKI_ASHMEM_PIN _VKI_IOW(__VKI_ASHMEMIOC, 7, struct vki_ashmem_pin)
3038 #define VKI_ASHMEM_UNPIN _VKI_IOW(__VKI_ASHMEMIOC, 8, struct vki_ashmem_pin)
3039 #define VKI_ASHMEM_GET_PIN_STATUS _VKI_IO(__VKI_ASHMEMIOC, 9)
3040 #define VKI_ASHMEM_PURGE_ALL_CACHES _VKI_IO(__VKI_ASHMEMIOC, 10)
3042 //----------------------------------------------------------------------
3043 // From kernel/common/include/linux/binder.h
3044 //----------------------------------------------------------------------
3046 struct vki_binder_write_read
{
3047 signed long write_size
;
3048 signed long write_consumed
;
3049 unsigned long write_buffer
;
3050 signed long read_size
;
3051 signed long read_consumed
;
3052 unsigned long read_buffer
;
3055 struct vki_binder_version
{
3056 signed long protocol_version
;
3059 #define VKI_BINDER_WRITE_READ _VKI_IOWR('b', 1, struct vki_binder_write_read)
3060 #define VKI_BINDER_SET_IDLE_TIMEOUT _VKI_IOW('b', 3, vki_int64_t)
3061 #define VKI_BINDER_SET_MAX_THREADS _VKI_IOW('b', 5, vki_size_t)
3062 #define VKI_BINDER_SET_IDLE_PRIORITY _VKI_IOW('b', 6, int)
3063 #define VKI_BINDER_SET_CONTEXT_MGR _VKI_IOW('b', 7, int)
3064 #define VKI_BINDER_THREAD_EXIT _VKI_IOW('b', 8, int)
3065 #define VKI_BINDER_VERSION _VKI_IOWR('b', 9, struct vki_binder_version)
3067 #endif /* defined(VGPV_*_linux_android) */
3069 //----------------------------------------------------------------------
3070 // From linux-3.0.4/include/net/bluetooth/bluetooth.h
3071 //----------------------------------------------------------------------
3075 } __vki_packed vki_bdaddr_t
;
3077 //----------------------------------------------------------------------
3078 // From linux-3.0.4/include/net/bluetooth/hci.h
3079 //----------------------------------------------------------------------
3081 #define VKI_HCIDEVUP _VKI_IOW('H', 201, int)
3082 #define VKI_HCIDEVDOWN _VKI_IOW('H', 202, int)
3083 #define VKI_HCIDEVRESET _VKI_IOW('H', 203, int)
3084 #define VKI_HCIDEVRESTAT _VKI_IOW('H', 204, int)
3086 #define VKI_HCIGETDEVLIST _VKI_IOR('H', 210, int)
3088 struct vki_hci_dev_req
{
3093 struct vki_hci_dev_list_req
{
3095 struct vki_hci_dev_req dev_req
[0]; /* hci_dev_req structures */
3098 #define VKI_HCIGETDEVINFO _VKI_IOR('H', 211, int)
3099 #define VKI_HCIGETCONNLIST _VKI_IOR('H', 212, int)
3100 #define VKI_HCIGETCONNINFO _VKI_IOR('H', 213, int)
3101 #define VKI_HCIGETAUTHINFO _VKI_IOR('H', 215, int)
3103 #define VKI_HCISETRAW _VKI_IOW('H', 220, int)
3104 #define VKI_HCISETSCAN _VKI_IOW('H', 221, int)
3105 #define VKI_HCISETAUTH _VKI_IOW('H', 222, int)
3106 #define VKI_HCISETENCRYPT _VKI_IOW('H', 223, int)
3107 #define VKI_HCISETPTYPE _VKI_IOW('H', 224, int)
3108 #define VKI_HCISETLINKPOL _VKI_IOW('H', 225, int)
3109 #define VKI_HCISETLINKMODE _VKI_IOW('H', 226, int)
3110 #define VKI_HCISETACLMTU _VKI_IOW('H', 227, int)
3111 #define VKI_HCISETSCOMTU _VKI_IOW('H', 228, int)
3113 #define VKI_HCIBLOCKADDR _VKI_IOW('H', 230, int)
3114 #define VKI_HCIUNBLOCKADDR _VKI_IOW('H', 231, int)
3116 #define VKI_HCIINQUIRY _VKI_IOR('H', 240, int)
3118 struct vki_inquiry_info
{
3119 vki_bdaddr_t bdaddr
;
3120 __vki_u8 pscan_rep_mode
;
3121 __vki_u8 pscan_period_mode
;
3122 __vki_u8 pscan_mode
;
3123 __vki_u8 dev_class
[3];
3124 __vki_le16 clock_offset
;
3127 struct vki_hci_inquiry_req
{
3135 //----------------------------------------------------------------------
3136 // From linux-3.9.2/include/net/bluetooth/rfcomm.h
3137 //----------------------------------------------------------------------
3139 struct vki_sockaddr_rc
{
3140 vki_sa_family_t rc_family
;
3141 vki_bdaddr_t rc_bdaddr
;
3142 __vki_u8 rc_channel
;
3145 //----------------------------------------------------------------------
3146 // From linux-3.4/include/linux/kvm.h
3147 //----------------------------------------------------------------------
3150 #define VKI_KVM_GET_API_VERSION _VKI_IO(KVMIO, 0x00)
3151 #define VKI_KVM_CREATE_VM _VKI_IO(KVMIO, 0x01) /* returns a VM fd */
3152 #define VKI_KVM_CHECK_EXTENSION _VKI_IO(KVMIO, 0x03)
3153 #define VKI_KVM_GET_VCPU_MMAP_SIZE _VKI_IO(KVMIO, 0x04) /* in bytes */
3154 #define VKI_KVM_S390_ENABLE_SIE _VKI_IO(KVMIO, 0x06)
3155 #define VKI_KVM_CREATE_VCPU _VKI_IO(KVMIO, 0x41)
3156 #define VKI_KVM_SET_NR_MMU_PAGES _VKI_IO(KVMIO, 0x44)
3157 #define VKI_KVM_GET_NR_MMU_PAGES _VKI_IO(KVMIO, 0x45)
3158 #define VKI_KVM_SET_TSS_ADDR _VKI_IO(KVMIO, 0x47)
3159 #define VKI_KVM_CREATE_IRQCHIP _VKI_IO(KVMIO, 0x60)
3160 #define VKI_KVM_CREATE_PIT _VKI_IO(KVMIO, 0x64)
3161 #define VKI_KVM_REINJECT_CONTROL _VKI_IO(KVMIO, 0x71)
3162 #define VKI_KVM_SET_BOOT_CPU_ID _VKI_IO(KVMIO, 0x78)
3163 #define VKI_KVM_SET_TSC_KHZ _VKI_IO(KVMIO, 0xa2)
3164 #define VKI_KVM_GET_TSC_KHZ _VKI_IO(KVMIO, 0xa3)
3165 #define VKI_KVM_RUN _VKI_IO(KVMIO, 0x80)
3166 #define VKI_KVM_S390_INITIAL_RESET _VKI_IO(KVMIO, 0x97)
3167 #define VKI_KVM_NMI _VKI_IO(KVMIO, 0x9a)
3168 #define VKI_KVM_KVMCLOCK_CTRL _VKI_IO(KVMIO, 0xad)
3170 struct vki_kvm_s390_mem_op
{
3172 __vki_u64 gaddr
; /* the guest address */
3173 __vki_u64 flags
; /* flags */
3174 __vki_u32 size
; /* amount of bytes */
3175 __vki_u32 op
; /* type of operation */
3176 __vki_u64 buf
; /* buffer in userspace */
3177 __vki_u8 ar
; /* the access register number */
3178 __vki_u8 reserved
[31]; /* should be set to 0 */
3181 #define VKI_KVM_S390_MEMOP_LOGICAL_READ 0
3182 #define VKI_KVM_S390_MEMOP_LOGICAL_WRITE 1
3183 #define VKI_KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0)
3184 #define VKI_KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1)
3186 #define VKI_KVM_S390_MEM_OP _VKI_IOW(KVMIO, 0xb1, struct vki_kvm_s390_mem_op)
3188 //----------------------------------------------------------------------
3189 // From linux-2.6/include/linux/net_stamp.h
3190 //----------------------------------------------------------------------
3192 struct vki_hwtstamp_config
{
3198 //----------------------------------------------------------------------
3199 // From linux-2.6.12-rc2/include/linux/uinput.h
3200 //----------------------------------------------------------------------
3202 #define VKI_UINPUT_IOCTL_BASE 'U'
3203 #define VKI_UI_DEV_CREATE _VKI_IO(VKI_UINPUT_IOCTL_BASE, 1)
3204 #define VKI_UI_DEV_DESTROY _VKI_IO(VKI_UINPUT_IOCTL_BASE, 2)
3206 #define VKI_UI_SET_EVBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 100, int)
3207 #define VKI_UI_SET_KEYBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 101, int)
3208 #define VKI_UI_SET_RELBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 102, int)
3209 #define VKI_UI_SET_ABSBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 103, int)
3210 #define VKI_UI_SET_MSCBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 104, int)
3211 #define VKI_UI_SET_LEDBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 105, int)
3212 #define VKI_UI_SET_SNDBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 106, int)
3213 #define VKI_UI_SET_FFBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 107, int)
3214 #define VKI_UI_SET_SWBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 109, int)
3215 #define VKI_UI_SET_PROPBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 110, int)
3217 //----------------------------------------------------------------------
3218 // From linux-2.6/include/uapi/rdma/ib_user_mad.h
3219 //----------------------------------------------------------------------
3221 #define VKI_IB_IOCTL_MAGIC 0x1b
3223 #define VKI_IB_USER_MAD_REGISTER_AGENT _VKI_IOWR(VKI_IB_IOCTL_MAGIC, 1, \
3224 struct ib_user_mad_reg_req)
3226 #define VKI_IB_USER_MAD_UNREGISTER_AGENT _VKI_IOW(VKI_IB_IOCTL_MAGIC, 2, __u32)
3228 #define VKI_IB_USER_MAD_ENABLE_PKEY _VKI_IO(VKI_IB_IOCTL_MAGIC, 3)
3230 //----------------------------------------------------------------------
3231 // From linux-3.8/include/uapi/linux/if_tun.h
3232 //----------------------------------------------------------------------
3234 #define VKI_TUNSETNOCSUM _VKI_IOW('T', 200, int)
3235 #define VKI_TUNSETDEBUG _VKI_IOW('T', 201, int)
3236 #define VKI_TUNSETIFF _VKI_IOW('T', 202, int)
3237 #define VKI_TUNSETPERSIST _VKI_IOW('T', 203, int)
3238 #define VKI_TUNSETOWNER _VKI_IOW('T', 204, int)
3239 #define VKI_TUNSETLINK _VKI_IOW('T', 205, int)
3240 #define VKI_TUNSETGROUP _VKI_IOW('T', 206, int)
3241 #define VKI_TUNGETFEATURES _VKI_IOR('T', 207, unsigned int)
3242 #define VKI_TUNSETOFFLOAD _VKI_IOW('T', 208, unsigned int)
3243 #define VKI_TUNSETTXFILTER _VKI_IOW('T', 209, unsigned int)
3244 #define VKI_TUNGETIFF _VKI_IOR('T', 210, unsigned int)
3245 #define VKI_TUNGETSNDBUF _VKI_IOR('T', 211, int)
3246 #define VKI_TUNSETSNDBUF _VKI_IOW('T', 212, int)
3247 //#define VKI_TUNATTACHFILTER _VKI_IOW('T', 213, struct sock_fprog)
3248 //#define VKI_TUNDETACHFILTER _VKI_IOW('T', 214, struct sock_fprog)
3249 #define VKI_TUNGETVNETHDRSZ _VKI_IOR('T', 215, int)
3250 #define VKI_TUNSETVNETHDRSZ _VKI_IOW('T', 216, int)
3251 #define VKI_TUNSETQUEUE _VKI_IOW('T', 217, int)
3252 #define VKI_TUNSETIFINDEX _VKI_IOW('T', 218, unsigned int)
3253 //#define VKI_TUNGETFILTER _VKI_IOR('T', 219, struct sock_fprog)
3255 //----------------------------------------------------------------------
3256 // From linux-3.8/include/uapi/linux/vhost.h
3257 //----------------------------------------------------------------------
3259 #define VKI_VHOST_VIRTIO 0xAF
3260 #define VKI_VHOST_SET_OWNER _VKI_IO(VKI_VHOST_VIRTIO, 0x01)
3261 #define VKI_VHOST_RESET_OWNER _VKI_IO(VKI_VHOST_VIRTIO, 0x02)
3263 //----------------------------------------------------------------------
3264 // Xen privcmd IOCTL
3265 //----------------------------------------------------------------------
3267 typedef unsigned long __vki_xen_pfn_t
;
3269 struct vki_xen_privcmd_hypercall
{
3274 struct vki_xen_privcmd_mmap_entry
{
3280 struct vki_xen_privcmd_mmap
{
3282 __vki_u16 dom
; /* target domain */
3283 struct vki_xen_privcmd_mmap_entry
*entry
;
3286 struct vki_xen_privcmd_mmapbatch
{
3287 int num
; /* number of pages to populate */
3288 __vki_u16 dom
; /* target domain */
3289 __vki_u64 addr
; /* virtual address */
3290 __vki_xen_pfn_t
*arr
; /* array of mfns - top nibble set on err */
3293 struct vki_xen_privcmd_mmapbatch_v2
{
3294 unsigned int num
; /* number of pages to populate */
3295 __vki_u16 dom
; /* target domain */
3296 __vki_u64 addr
; /* virtual address */
3297 const __vki_xen_pfn_t
*arr
; /* array of mfns */
3298 int __user
*err
; /* array of error codes */
3301 #define VKI_XEN_IOCTL_PRIVCMD_HYPERCALL _VKI_IOC(_VKI_IOC_NONE, 'P', 0, sizeof(struct vki_xen_privcmd_hypercall))
3302 #define VKI_XEN_IOCTL_PRIVCMD_MMAP _VKI_IOC(_VKI_IOC_NONE, 'P', 2, sizeof(struct vki_xen_privcmd_mmap))
3304 #define VKI_XEN_IOCTL_PRIVCMD_MMAPBATCH _VKI_IOC(_VKI_IOC_NONE, 'P', 3, sizeof(struct vki_xen_privcmd_mmapbatch))
3305 #define VKI_XEN_IOCTL_PRIVCMD_MMAPBATCH_V2 _VKI_IOC(_VKI_IOC_NONE, 'P', 4, sizeof(struct vki_xen_privcmd_mmapbatch_v2))
3307 //----------------------------------------------------------------------
3309 //----------------------------------------------------------------------
3311 #define VKI_XEN_IOCTL_EVTCHN_BIND_VIRQ \
3312 _VKI_IOC(_VKI_IOC_NONE, 'E', 0, sizeof(struct vki_xen_ioctl_evtchn_bind_virq))
3313 struct vki_xen_ioctl_evtchn_bind_virq
{
3317 #define VKI_XEN_IOCTL_EVTCHN_BIND_INTERDOMAIN \
3318 _VKI_IOC(_VKI_IOC_NONE, 'E', 1, sizeof(struct vki_xen_ioctl_evtchn_bind_interdomain))
3319 struct vki_xen_ioctl_evtchn_bind_interdomain
{
3320 vki_uint32_t remote_domain
;
3321 vki_uint32_t remote_port
;
3324 #define VKI_XEN_IOCTL_EVTCHN_BIND_UNBOUND_PORT \
3325 _VKI_IOC(_VKI_IOC_NONE, 'E', 2, sizeof(struct vki_xen_ioctl_evtchn_bind_unbound_port))
3326 struct vki_xen_ioctl_evtchn_bind_unbound_port
{
3327 vki_uint32_t remote_domain
;
3330 #define VKI_XEN_IOCTL_EVTCHN_UNBIND \
3331 _VKI_IOC(_VKI_IOC_NONE, 'E', 3, sizeof(struct vki_xen_ioctl_evtchn_unbind))
3332 struct vki_xen_ioctl_evtchn_unbind
{
3336 #define VKI_XEN_IOCTL_EVTCHN_NOTIFY \
3337 _VKI_IOC(_VKI_IOC_NONE, 'E', 4, sizeof(struct vki_xen_ioctl_evtchn_notify))
3338 struct vki_xen_ioctl_evtchn_notify
{
3342 #define VKI_XEN_IOCTL_EVTCHN_RESET \
3343 _VKI_IOC(_VKI_IOC_NONE, 'E', 5, 0)
3346 //----------------------------------------------------------------------
3347 // From linux-3.4.0/include/linux/fs.h
3348 //----------------------------------------------------------------------
3350 struct vki_file_handle
{
3351 __vki_u32 handle_bytes
;
3353 /* file identifier */
3354 unsigned char f_handle
[0];
3357 //----------------------------------------------------------------------
3358 // From linux-3.2.0/include/linux/filter.h
3359 //----------------------------------------------------------------------
3361 struct vki_sock_filter
{
3362 __vki_u16 code
; /* Actual filter code */
3363 __vki_u8 jt
; /* Jump true */
3364 __vki_u8 jf
; /* Jump false */
3365 __vki_u32 k
; /* Generic multiuse field */
3368 struct vki_sock_fprog
{
3369 __vki_u16 len
; /* actually unsigned short */
3370 struct vki_sock_filter
*filter
;
3373 //----------------------------------------------------------------------
3374 // From linux/include/uapi/linux/ethtool.h
3375 //----------------------------------------------------------------------
3377 struct vki_ethtool_cmd
{
3379 __vki_u32 supported
;
3380 __vki_u32 advertising
;
3384 __vki_u8 phy_address
;
3385 __vki_u8 transceiver
;
3387 __vki_u8 mdio_support
;
3391 __vki_u8 eth_tp_mdix
;
3392 __vki_u8 eth_tp_mdix_ctrl
;
3393 __vki_u32 lp_advertising
;
3394 __vki_u32 reserved
[2];
3397 #define VKI_ETHTOOL_FWVERS_LEN 32
3398 #define VKI_ETHTOOL_BUSINFO_LEN 32
3400 struct vki_ethtool_drvinfo
{
3404 char fw_version
[VKI_ETHTOOL_FWVERS_LEN
];
3405 char bus_info
[VKI_ETHTOOL_BUSINFO_LEN
];
3408 __vki_u32 n_priv_flags
;
3410 __vki_u32 testinfo_len
;
3411 __vki_u32 eedump_len
;
3412 __vki_u32 regdump_len
;
3415 #define VKI_SOPASS_MAX 6
3417 struct vki_ethtool_wolinfo
{
3419 __vki_u32 supported
;
3421 __vki_u8 sopass
[VKI_SOPASS_MAX
];
3424 struct vki_ethtool_value
{
3429 struct vki_ethtool_regs
{
3436 struct vki_ethtool_ringparam
{
3438 __vki_u32 rx_max_pending
;
3439 __vki_u32 rx_mini_max_pending
;
3440 __vki_u32 rx_jumbo_max_pending
;
3441 __vki_u32 tx_max_pending
;
3442 __vki_u32 rx_pending
;
3443 __vki_u32 rx_mini_pending
;
3444 __vki_u32 rx_jumbo_pending
;
3445 __vki_u32 tx_pending
;
3448 struct vki_ethtool_channels
{
3452 __vki_u32 max_other
;
3453 __vki_u32 max_combined
;
3456 __vki_u32 other_count
;
3457 __vki_u32 combined_count
;
3460 struct vki_ethtool_sset_info
{
3463 __vki_u64 sset_mask
;
3467 struct vki_ethtool_test
{
3475 struct vki_ethtool_perm_addr
{
3481 struct vki_ethtool_get_features_block
{
3482 __vki_u32 available
;
3483 __vki_u32 requested
;
3485 __vki_u32 never_changed
;
3488 struct vki_ethtool_gfeatures
{
3491 struct vki_ethtool_get_features_block features
[0];
3494 struct vki_ethtool_set_features_block
{
3496 __vki_u32 requested
;
3499 struct vki_ethtool_sfeatures
{
3502 struct vki_ethtool_set_features_block features
[0];
3505 struct vki_ethtool_ts_info
{
3507 __vki_u32 so_timestamping
;
3508 __vki_s32 phc_index
;
3510 __vki_u32 tx_reserved
[3];
3511 __vki_u32 rx_filters
;
3512 __vki_u32 rx_reserved
[3];
3515 #define VKI_ETHTOOL_GSET 0x00000001 /* Get settings. */
3516 #define VKI_ETHTOOL_SSET 0x00000002 /* Set settings. */
3517 #define VKI_ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
3518 #define VKI_ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
3519 #define VKI_ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
3520 #define VKI_ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */
3521 #define VKI_ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
3522 #define VKI_ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */
3523 #define VKI_ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */
3524 #define VKI_ETHTOOL_GLINK 0x0000000a
3525 #define VKI_ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */
3526 #define VKI_ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */
3527 #define VKI_ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */
3528 #define VKI_ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */
3529 #define VKI_ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */
3530 #define VKI_ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */
3531 #define VKI_ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable
3532 * (ethtool_value) */
3533 #define VKI_ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable
3534 * (ethtool_value). */
3535 #define VKI_ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */
3536 #define VKI_ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */
3537 #define VKI_ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
3538 #define VKI_ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
3539 #define VKI_ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */
3540 #define VKI_ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */
3541 #define VKI_ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
3542 #define VKI_ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */
3543 #define VKI_ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
3544 #define VKI_ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
3545 #define VKI_ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
3546 #define VKI_ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
3547 #define VKI_ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
3548 #define VKI_ETHTOOL_RESET 0x00000034 /* Reset hardware */
3549 #define VKI_ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
3550 #define VKI_ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */
3551 #define VKI_ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */
3552 #define VKI_ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */
3553 #define VKI_ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */
3554 #define VKI_ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */
3556 //----------------------------------------------------------------------
3557 // From linux-3.15.8/drivers/staging/android/uapi/ion.h
3558 //----------------------------------------------------------------------
3560 typedef int vki_ion_user_handle_t
;
3562 struct vki_ion_allocation_data
{
3565 unsigned int heap_id_mask
;
3567 vki_ion_user_handle_t handle
;
3570 struct vki_ion_fd_data
{
3571 vki_ion_user_handle_t handle
;
3575 struct vki_ion_handle_data
{
3576 vki_ion_user_handle_t handle
;
3579 struct vki_ion_custom_data
{
3584 #define VKI_ION_IOC_MAGIC 'I'
3586 #define VKI_ION_IOC_ALLOC \
3587 _VKI_IOWR(VKI_ION_IOC_MAGIC, 0, struct vki_ion_allocation_data)
3589 #define VKI_ION_IOC_FREE \
3590 _VKI_IOWR(VKI_ION_IOC_MAGIC, 1, struct vki_ion_handle_data)
3592 #define VKI_ION_IOC_MAP \
3593 _VKI_IOWR(VKI_ION_IOC_MAGIC, 2, struct vki_ion_fd_data)
3595 #define VKI_ION_IOC_SHARE \
3596 _VKI_IOWR(VKI_ION_IOC_MAGIC, 4, struct vki_ion_fd_data)
3598 #define VKI_ION_IOC_IMPORT \
3599 _VKI_IOWR(VKI_ION_IOC_MAGIC, 5, struct vki_ion_fd_data)
3601 #define VKI_ION_IOC_SYNC \
3602 _VKI_IOWR(VKI_ION_IOC_MAGIC, 7, struct vki_ion_fd_data)
3604 #define VKI_ION_IOC_CUSTOM \
3605 _VKI_IOWR(VKI_ION_IOC_MAGIC, 6, struct vki_ion_custom_data)
3607 //----------------------------------------------------------------------
3608 // From linux-3.19-rc5/drivers/staging/android/uapi/sync.h
3609 //----------------------------------------------------------------------
3611 struct vki_sync_merge_data
{
3617 struct vki_sync_pt_info
{
3620 char driver_name
[32];
3622 __vki_u64 timestamp_ns
;
3623 __vki_u8 driver_data
[0];
3626 struct vki_sync_fence_info_data
{
3630 __vki_u8 pt_info
[0];
3633 #define VKI_SYNC_IOC_MAGIC '>'
3635 #define VKI_SYNC_IOC_WAIT \
3636 _VKI_IOW(VKI_SYNC_IOC_MAGIC, 0, __vki_s32)
3638 #define VKI_SYNC_IOC_MERGE \
3639 _VKI_IOWR(VKI_SYNC_IOC_MAGIC, 1, struct vki_sync_merge_data)
3641 #define VKI_SYNC_IOC_FENCE_INFO \
3642 _VKI_IOWR(VKI_SYNC_IOC_MAGIC, 2, struct vki_sync_fence_info_data)
3644 //----------------------------------------------------------------------
3645 // From drivers/staging/lustre/lustre/include/lustre/lustre_user.h
3646 //----------------------------------------------------------------------
3654 //----------------------------------------------------------------------
3655 // From drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
3656 //----------------------------------------------------------------------
3658 struct vki_getinfo_fid2path
{
3659 struct vki_lu_fid gf_fid
;
3661 __vki_u32 gf_linkno
;
3662 __vki_u32 gf_pathlen
;
3664 } __attribute__((packed
));
3666 //----------------------------------------------------------------------
3667 // From drivers/staging/lustre/lustre/include/linux/lustre_lib.h
3668 //----------------------------------------------------------------------
3670 #define VKI_OBD_IOC_DATA_TYPE long
3672 //----------------------------------------------------------------------
3673 // From drivers/staging/lustre/lustre/include/lustre_lib.h
3674 //----------------------------------------------------------------------
3676 #define VKI_OBD_IOC_FID2PATH \
3677 _VKI_IOWR ('f', 150, VKI_OBD_IOC_DATA_TYPE)
3678 #define VKI_LL_IOC_PATH2FID \
3679 _VKI_IOR ('f', 173, long)
3681 //----------------------------------------------------------------------
3682 // From lustre/include/lustre/lustre_idl.h
3683 //----------------------------------------------------------------------
3685 struct vki_getparent
{
3686 struct vki_lu_fid gp_fid
;
3687 __vki_u32 gp_linkno
;
3688 __vki_u32 gp_name_size
;
3690 } __attribute__((packed
));
3692 //----------------------------------------------------------------------
3693 // From Lustre's lustre/include/lustre/lustre_user.h
3694 //----------------------------------------------------------------------
3695 #define VKI_LL_IOC_GETPARENT \
3696 _VKI_IOWR('f', 249, struct vki_getparent)
3699 struct vki_v4l2_rect
{
3706 struct vki_v4l2_fract
{
3707 __vki_u32 numerator
;
3708 __vki_u32 denominator
;
3711 struct vki_v4l2_capability
{
3712 __vki_u8 driver
[16];
3714 __vki_u8 bus_info
[32];
3716 __vki_u32 capabilities
;
3717 __vki_u32 device_caps
;
3718 __vki_u32 reserved
[3];
3721 struct vki_v4l2_pix_format
{
3724 __vki_u32 pixelformat
;
3725 __vki_u32 field
; /* enum vki_v4l2_field */
3726 __vki_u32 bytesperline
; /* for padding, zero if unused */
3727 __vki_u32 sizeimage
;
3728 __vki_u32 colorspace
; /* enum vki_v4l2_colorspace */
3729 __vki_u32 priv
; /* private data, depends on pixelformat */
3730 __vki_u32 flags
; /* format flags (VKI_V4L2_PIX_FMT_FLAG_*) */
3731 __vki_u32 ycbcr_enc
;
3732 __vki_u32 quantization
;
3735 struct vki_v4l2_fmtdesc
{
3736 __vki_u32 index
; /* Format number */
3737 __vki_u32 type
; /* enum vki_v4l2_buf_type */
3739 __vki_u8 description
[32]; /* Description string */
3740 __vki_u32 pixelformat
; /* Format fourcc */
3741 __vki_u32 reserved
[4];
3744 struct vki_v4l2_frmsize_discrete
{
3745 __vki_u32 width
; /* Frame width [pixel] */
3746 __vki_u32 height
; /* Frame height [pixel] */
3749 struct vki_v4l2_frmsize_stepwise
{
3750 __vki_u32 min_width
; /* Minimum frame width [pixel] */
3751 __vki_u32 max_width
; /* Maximum frame width [pixel] */
3752 __vki_u32 step_width
; /* Frame width step size [pixel] */
3753 __vki_u32 min_height
; /* Minimum frame height [pixel] */
3754 __vki_u32 max_height
; /* Maximum frame height [pixel] */
3755 __vki_u32 step_height
; /* Frame height step size [pixel] */
3758 struct vki_v4l2_frmsizeenum
{
3759 __vki_u32 index
; /* Frame size number */
3760 __vki_u32 pixel_format
; /* Pixel format */
3761 __vki_u32 type
; /* Frame size type the device supports. */
3763 union { /* Frame size */
3764 struct vki_v4l2_frmsize_discrete discrete
;
3765 struct vki_v4l2_frmsize_stepwise stepwise
;
3768 __vki_u32 reserved
[2]; /* Reserved space for future use */
3771 struct vki_v4l2_frmival_stepwise
{
3772 struct vki_v4l2_fract min
;
3773 struct vki_v4l2_fract max
;
3774 struct vki_v4l2_fract step
;
3777 struct vki_v4l2_frmivalenum
{
3779 __vki_u32 pixel_format
;
3785 struct vki_v4l2_fract discrete
;
3786 struct vki_v4l2_frmival_stepwise stepwise
;
3789 __vki_u32 reserved
[2];
3792 struct vki_v4l2_timecode
{
3799 __vki_u8 userbits
[4];
3802 struct vki_v4l2_jpegcompression
{
3809 __vki_u32 jpeg_markers
;
3812 struct vki_v4l2_requestbuffers
{
3816 __vki_u32 reserved
[2];
3819 struct vki_v4l2_plane
{
3820 __vki_u32 bytesused
;
3823 __vki_u32 mem_offset
;
3824 unsigned long userptr
;
3827 __vki_u32 data_offset
;
3828 __vki_u32 reserved
[11];
3831 #define VKI_V4L2_MEMORY_MMAP 1
3832 #define VKI_V4L2_MEMORY_DMABUF 4
3833 #define VKI_V4L2_BUF_FLAG_TIMESTAMP_MASK 0x0000e000
3834 #define VKI_V4L2_BUF_FLAG_TIMESTAMP_COPY 0x00004000
3835 struct vki_v4l2_buffer
{
3838 __vki_u32 bytesused
;
3841 struct vki_timeval timestamp
;
3842 struct vki_v4l2_timecode timecode
;
3845 /* memory location */
3849 unsigned long userptr
;
3850 struct vki_v4l2_plane
*planes
;
3854 __vki_u32 reserved2
;
3858 struct vki_v4l2_exportbuffer
{
3859 __vki_u32 type
; /* enum vki_v4l2_buf_type */
3864 __vki_u32 reserved
[11];
3867 struct vki_v4l2_framebuffer
{
3868 __vki_u32 capability
;
3874 __vki_u32 pixelformat
;
3875 __vki_u32 field
; /* enum vki_v4l2_field */
3876 __vki_u32 bytesperline
; /* for padding, zero if unused */
3877 __vki_u32 sizeimage
;
3878 __vki_u32 colorspace
; /* enum vki_v4l2_colorspace */
3879 __vki_u32 priv
; /* reserved field, set to 0 */
3883 struct vki_v4l2_clip
{
3884 struct vki_v4l2_rect c
;
3885 struct vki_v4l2_clip __user
*next
;
3888 struct vki_v4l2_window
{
3889 struct vki_v4l2_rect w
;
3890 __vki_u32 field
; /* enum vki_v4l2_field */
3891 __vki_u32 chromakey
;
3892 struct vki_v4l2_clip __user
*clips
;
3893 __vki_u32 clipcount
;
3894 void __user
*bitmap
;
3895 __vki_u8 global_alpha
;
3898 struct vki_v4l2_captureparm
{
3899 __vki_u32 capability
; /* Supported modes */
3900 __vki_u32 capturemode
; /* Current mode */
3901 struct vki_v4l2_fract timeperframe
; /* Time per frame in seconds */
3902 __vki_u32 extendedmode
; /* Driver-specific extensions */
3903 __vki_u32 readbuffers
; /* # of buffers for read */
3904 __vki_u32 reserved
[4];
3907 struct vki_v4l2_outputparm
{
3908 __vki_u32 capability
; /* Supported modes */
3909 __vki_u32 outputmode
; /* Current mode */
3910 struct vki_v4l2_fract timeperframe
; /* Time per frame in seconds */
3911 __vki_u32 extendedmode
; /* Driver-specific extensions */
3912 __vki_u32 writebuffers
; /* # of buffers for write */
3913 __vki_u32 reserved
[4];
3916 struct vki_v4l2_cropcap
{
3917 __vki_u32 type
; /* enum vki_v4l2_buf_type */
3918 struct vki_v4l2_rect bounds
;
3919 struct vki_v4l2_rect defrect
;
3920 struct vki_v4l2_fract pixelaspect
;
3923 struct vki_v4l2_crop
{
3924 __vki_u32 type
; /* enum vki_v4l2_buf_type */
3925 struct vki_v4l2_rect c
;
3928 struct vki_v4l2_selection
{
3932 struct vki_v4l2_rect r
;
3933 __vki_u32 reserved
[9];
3936 typedef __vki_u64 vki_v4l2_std_id
;
3938 struct vki_v4l2_standard
{
3942 struct vki_v4l2_fract frameperiod
; /* Frames, not fields */
3943 __vki_u32 framelines
;
3944 __vki_u32 reserved
[4];
3947 struct vki_v4l2_bt_timings
{
3950 __vki_u32 interlaced
;
3951 __vki_u32 polarities
;
3952 __vki_u64 pixelclock
;
3953 __vki_u32 hfrontporch
;
3955 __vki_u32 hbackporch
;
3956 __vki_u32 vfrontporch
;
3958 __vki_u32 vbackporch
;
3959 __vki_u32 il_vfrontporch
;
3961 __vki_u32 il_vbackporch
;
3962 __vki_u32 standards
;
3964 __vki_u32 reserved
[14];
3965 } __attribute__ ((packed
));
3967 struct vki_v4l2_dv_timings
{
3970 struct vki_v4l2_bt_timings bt
;
3971 __vki_u32 reserved
[32];
3973 } __attribute__ ((packed
));
3975 struct vki_v4l2_enum_dv_timings
{
3978 __vki_u32 reserved
[2];
3979 struct vki_v4l2_dv_timings timings
;
3982 struct vki_v4l2_bt_timings_cap
{
3983 __vki_u32 min_width
;
3984 __vki_u32 max_width
;
3985 __vki_u32 min_height
;
3986 __vki_u32 max_height
;
3987 __vki_u64 min_pixelclock
;
3988 __vki_u64 max_pixelclock
;
3989 __vki_u32 standards
;
3990 __vki_u32 capabilities
;
3991 __vki_u32 reserved
[16];
3992 } __attribute__ ((packed
));
3994 struct vki_v4l2_dv_timings_cap
{
3997 __vki_u32 reserved
[2];
3999 struct vki_v4l2_bt_timings_cap bt
;
4000 __vki_u32 raw_data
[32];
4004 struct vki_v4l2_input
{
4005 __vki_u32 index
; /* Which input */
4006 __vki_u8 name
[32]; /* Label */
4007 __vki_u32 type
; /* Type of input */
4008 __vki_u32 audioset
; /* Associated audios (bitfield) */
4009 __vki_u32 tuner
; /* enum vki_v4l2_tuner_type */
4010 vki_v4l2_std_id std
;
4012 __vki_u32 capabilities
;
4013 __vki_u32 reserved
[3];
4016 struct vki_v4l2_output
{
4017 __vki_u32 index
; /* Which output */
4018 __vki_u8 name
[32]; /* Label */
4019 __vki_u32 type
; /* Type of output */
4020 __vki_u32 audioset
; /* Associated audios (bitfield) */
4021 __vki_u32 modulator
; /* Associated modulator */
4022 vki_v4l2_std_id std
;
4023 __vki_u32 capabilities
;
4024 __vki_u32 reserved
[3];
4027 struct vki_v4l2_control
{
4032 struct vki_v4l2_ext_control
{
4035 __vki_u32 reserved2
[1];
4045 } __attribute__ ((packed
));
4047 struct vki_v4l2_ext_controls
{
4048 __vki_u32 ctrl_class
;
4050 __vki_u32 error_idx
;
4051 __vki_u32 reserved
[2];
4052 struct vki_v4l2_ext_control
*controls
;
4055 struct vki_v4l2_queryctrl
{
4057 __vki_u32 type
; /* enum vki_v4l2_ctrl_type */
4058 __vki_u8 name
[32]; /* Whatever */
4059 __vki_s32 minimum
; /* Note signedness */
4062 __vki_s32 default_value
;
4064 __vki_u32 reserved
[2];
4067 #define VKI_V4L2_CTRL_MAX_DIMS (4)
4068 struct vki_v4l2_query_ext_ctrl
{
4075 __vki_s64 default_value
;
4077 __vki_u32 elem_size
;
4079 __vki_u32 nr_of_dims
;
4080 __vki_u32 dims
[VKI_V4L2_CTRL_MAX_DIMS
];
4081 __vki_u32 reserved
[32];
4084 struct vki_v4l2_querymenu
{
4088 __vki_u8 name
[32]; /* Whatever */
4092 } __attribute__ ((packed
));
4094 struct vki_v4l2_tuner
{
4097 __vki_u32 type
; /* enum vki_v4l2_tuner_type */
4098 __vki_u32 capability
;
4100 __vki_u32 rangehigh
;
4101 __vki_u32 rxsubchans
;
4105 __vki_u32 reserved
[4];
4108 struct vki_v4l2_modulator
{
4111 __vki_u32 capability
;
4113 __vki_u32 rangehigh
;
4114 __vki_u32 txsubchans
;
4115 __vki_u32 reserved
[4];
4118 struct vki_v4l2_frequency
{
4120 __vki_u32 type
; /* enum vki_v4l2_tuner_type */
4121 __vki_u32 frequency
;
4122 __vki_u32 reserved
[8];
4125 struct vki_v4l2_frequency_band
{
4127 __vki_u32 type
; /* enum vki_v4l2_tuner_type */
4129 __vki_u32 capability
;
4131 __vki_u32 rangehigh
;
4132 __vki_u32 modulation
;
4133 __vki_u32 reserved
[9];
4136 struct vki_v4l2_hw_freq_seek
{
4138 __vki_u32 type
; /* enum vki_v4l2_tuner_type */
4139 __vki_u32 seek_upward
;
4140 __vki_u32 wrap_around
;
4143 __vki_u32 rangehigh
;
4144 __vki_u32 reserved
[5];
4147 struct vki_v4l2_audio
{
4150 __vki_u32 capability
;
4152 __vki_u32 reserved
[2];
4155 struct vki_v4l2_audioout
{
4158 __vki_u32 capability
;
4160 __vki_u32 reserved
[2];
4163 struct vki_v4l2_enc_idx_entry
{
4168 __vki_u32 reserved
[2];
4171 #define VKI_V4L2_ENC_IDX_ENTRIES (64)
4172 struct vki_v4l2_enc_idx
{
4174 __vki_u32 entries_cap
;
4175 __vki_u32 reserved
[4];
4176 struct vki_v4l2_enc_idx_entry entry
[VKI_V4L2_ENC_IDX_ENTRIES
];
4179 struct vki_v4l2_encoder_cmd
{
4189 struct vki_v4l2_decoder_cmd
{
4208 struct vki_v4l2_vbi_format
{
4209 __vki_u32 sampling_rate
; /* in 1 Hz */
4211 __vki_u32 samples_per_line
;
4212 __vki_u32 sample_format
; /* VKI_V4L2_PIX_FMT_* */
4215 __vki_u32 flags
; /* VKI_V4L2_VBI_* */
4216 __vki_u32 reserved
[2]; /* must be zero */
4219 struct vki_v4l2_sliced_vbi_format
{
4220 __vki_u16 service_set
;
4221 __vki_u16 service_lines
[2][24];
4223 __vki_u32 reserved
[2]; /* must be zero */
4226 struct vki_v4l2_sliced_vbi_cap
{
4227 __vki_u16 service_set
;
4228 __vki_u16 service_lines
[2][24];
4229 __vki_u32 type
; /* enum vki_v4l2_buf_type */
4230 __vki_u32 reserved
[3]; /* must be 0 */
4233 struct vki_v4l2_sliced_vbi_data
{
4235 __vki_u32 field
; /* 0: first field, 1: second field */
4236 __vki_u32 line
; /* 1-23 */
4237 __vki_u32 reserved
; /* must be 0 */
4241 struct vki_v4l2_plane_pix_format
{
4242 __vki_u32 sizeimage
;
4243 __vki_u32 bytesperline
;
4244 __vki_u16 reserved
[6];
4245 } __attribute__ ((packed
));
4247 #define VKI_VIDEO_MAX_PLANES 8
4249 struct vki_v4l2_pix_format_mplane
{
4252 __vki_u32 pixelformat
;
4254 __vki_u32 colorspace
;
4256 struct vki_v4l2_plane_pix_format plane_fmt
[VKI_VIDEO_MAX_PLANES
];
4257 __vki_u8 num_planes
;
4260 __vki_u8 quantization
;
4261 __vki_u8 reserved
[8];
4262 } __attribute__ ((packed
));
4264 struct vki_v4l2_sdr_format
{
4265 __vki_u32 pixelformat
;
4266 __vki_u32 buffersize
;
4267 __vki_u8 reserved
[24];
4268 } __attribute__ ((packed
));
4270 enum vki_v4l2_buf_type
{
4271 VKI_V4L2_BUF_TYPE_VIDEO_CAPTURE
= 1,
4272 VKI_V4L2_BUF_TYPE_VIDEO_OUTPUT
= 2,
4273 VKI_V4L2_BUF_TYPE_VIDEO_OVERLAY
= 3,
4274 VKI_V4L2_BUF_TYPE_VBI_CAPTURE
= 4,
4275 VKI_V4L2_BUF_TYPE_VBI_OUTPUT
= 5,
4276 VKI_V4L2_BUF_TYPE_SLICED_VBI_CAPTURE
= 6,
4277 VKI_V4L2_BUF_TYPE_SLICED_VBI_OUTPUT
= 7,
4278 VKI_V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY
= 8,
4279 VKI_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
= 9,
4280 VKI_V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE
= 10,
4281 VKI_V4L2_BUF_TYPE_SDR_CAPTURE
= 11,
4284 struct vki_v4l2_format
{
4287 struct vki_v4l2_pix_format pix
;
4288 struct vki_v4l2_pix_format_mplane pix_mp
;
4289 struct vki_v4l2_window win
;
4290 struct vki_v4l2_vbi_format vbi
;
4291 struct vki_v4l2_sliced_vbi_format sliced
;
4292 struct vki_v4l2_sdr_format sdr
;
4293 __vki_u8 raw_data
[200];
4297 struct vki_v4l2_streamparm
{
4300 struct vki_v4l2_captureparm capture
;
4301 struct vki_v4l2_outputparm output
;
4302 __vki_u8 raw_data
[200]; /* user-defined */
4306 struct vki_v4l2_event_vsync
{
4308 } __attribute__ ((packed
));
4310 struct vki_v4l2_event_ctrl
{
4321 __vki_s32 default_value
;
4324 struct vki_v4l2_event_frame_sync
{
4325 __vki_u32 frame_sequence
;
4328 struct vki_v4l2_event_src_change
{
4332 struct vki_v4l2_event_motion_det
{
4334 __vki_u32 frame_sequence
;
4335 __vki_u32 region_mask
;
4338 struct vki_v4l2_event
{
4341 struct vki_v4l2_event_vsync vsync
;
4342 struct vki_v4l2_event_ctrl ctrl
;
4343 struct vki_v4l2_event_frame_sync frame_sync
;
4344 struct vki_v4l2_event_src_change src_change
;
4345 struct vki_v4l2_event_motion_det motion_det
;
4350 struct vki_timespec timestamp
;
4352 __vki_u32 reserved
[8];
4355 struct vki_v4l2_event_subscription
{
4359 __vki_u32 reserved
[5];
4362 struct vki_v4l2_dbg_match
{
4363 __vki_u32 type
; /* Match type */
4364 union { /* Match this chip, meaning determined by type */
4368 } __attribute__ ((packed
));
4370 struct vki_v4l2_dbg_register
{
4371 struct vki_v4l2_dbg_match match
;
4372 __vki_u32 size
; /* register size in bytes */
4375 } __attribute__ ((packed
));
4377 struct vki_v4l2_dbg_chip_info
{
4378 struct vki_v4l2_dbg_match match
;
4381 __vki_u32 reserved
[32];
4382 } __attribute__ ((packed
));
4384 struct vki_v4l2_create_buffers
{
4388 struct vki_v4l2_format format
;
4389 __vki_u32 reserved
[8];
4392 struct vki_v4l2_edid
{
4394 __vki_u32 start_block
;
4396 __vki_u32 reserved
[5];
4400 #define VKI_V4L2_QUERYCAP _VKI_IOR('V', 0, struct vki_v4l2_capability)
4401 #define VKI_V4L2_ENUM_FMT _VKI_IOWR('V', 2, struct vki_v4l2_fmtdesc)
4402 #define VKI_V4L2_G_FMT _VKI_IOWR('V', 4, struct vki_v4l2_format)
4403 #define VKI_V4L2_S_FMT _VKI_IOWR('V', 5, struct vki_v4l2_format)
4404 #define VKI_V4L2_REQBUFS _VKI_IOWR('V', 8, struct vki_v4l2_requestbuffers)
4405 #define VKI_V4L2_QUERYBUF _VKI_IOWR('V', 9, struct vki_v4l2_buffer)
4406 #define VKI_V4L2_G_FBUF _VKI_IOR('V', 10, struct vki_v4l2_framebuffer)
4407 #define VKI_V4L2_S_FBUF _VKI_IOW('V', 11, struct vki_v4l2_framebuffer)
4408 #define VKI_V4L2_OVERLAY _VKI_IOW('V', 14, int)
4409 #define VKI_V4L2_QBUF _VKI_IOWR('V', 15, struct vki_v4l2_buffer)
4410 #define VKI_V4L2_EXPBUF _VKI_IOWR('V', 16, struct vki_v4l2_exportbuffer)
4411 #define VKI_V4L2_DQBUF _VKI_IOWR('V', 17, struct vki_v4l2_buffer)
4412 #define VKI_V4L2_STREAMON _VKI_IOW('V', 18, int)
4413 #define VKI_V4L2_STREAMOFF _VKI_IOW('V', 19, int)
4414 #define VKI_V4L2_G_PARM _VKI_IOWR('V', 21, struct vki_v4l2_streamparm)
4415 #define VKI_V4L2_S_PARM _VKI_IOWR('V', 22, struct vki_v4l2_streamparm)
4416 #define VKI_V4L2_G_STD _VKI_IOR('V', 23, vki_v4l2_std_id)
4417 #define VKI_V4L2_S_STD _VKI_IOW('V', 24, vki_v4l2_std_id)
4418 #define VKI_V4L2_ENUMSTD _VKI_IOWR('V', 25, struct vki_v4l2_standard)
4419 #define VKI_V4L2_ENUMINPUT _VKI_IOWR('V', 26, struct vki_v4l2_input)
4420 #define VKI_V4L2_G_CTRL _VKI_IOWR('V', 27, struct vki_v4l2_control)
4421 #define VKI_V4L2_S_CTRL _VKI_IOWR('V', 28, struct vki_v4l2_control)
4422 #define VKI_V4L2_G_TUNER _VKI_IOWR('V', 29, struct vki_v4l2_tuner)
4423 #define VKI_V4L2_S_TUNER _VKI_IOW('V', 30, struct vki_v4l2_tuner)
4424 #define VKI_V4L2_G_AUDIO _VKI_IOR('V', 33, struct vki_v4l2_audio)
4425 #define VKI_V4L2_S_AUDIO _VKI_IOW('V', 34, struct vki_v4l2_audio)
4426 #define VKI_V4L2_QUERYCTRL _VKI_IOWR('V', 36, struct vki_v4l2_queryctrl)
4427 #define VKI_V4L2_QUERYMENU _VKI_IOWR('V', 37, struct vki_v4l2_querymenu)
4428 #define VKI_V4L2_G_INPUT _VKI_IOR('V', 38, int)
4429 #define VKI_V4L2_S_INPUT _VKI_IOWR('V', 39, int)
4430 #define VKI_V4L2_G_EDID _VKI_IOWR('V', 40, struct vki_v4l2_edid)
4431 #define VKI_V4L2_S_EDID _VKI_IOWR('V', 41, struct vki_v4l2_edid)
4432 #define VKI_V4L2_G_OUTPUT _VKI_IOR('V', 46, int)
4433 #define VKI_V4L2_S_OUTPUT _VKI_IOWR('V', 47, int)
4434 #define VKI_V4L2_ENUMOUTPUT _VKI_IOWR('V', 48, struct vki_v4l2_output)
4435 #define VKI_V4L2_G_AUDOUT _VKI_IOR('V', 49, struct vki_v4l2_audioout)
4436 #define VKI_V4L2_S_AUDOUT _VKI_IOW('V', 50, struct vki_v4l2_audioout)
4437 #define VKI_V4L2_G_MODULATOR _VKI_IOWR('V', 54, struct vki_v4l2_modulator)
4438 #define VKI_V4L2_S_MODULATOR _VKI_IOW('V', 55, struct vki_v4l2_modulator)
4439 #define VKI_V4L2_G_FREQUENCY _VKI_IOWR('V', 56, struct vki_v4l2_frequency)
4440 #define VKI_V4L2_S_FREQUENCY _VKI_IOW('V', 57, struct vki_v4l2_frequency)
4441 #define VKI_V4L2_CROPCAP _VKI_IOWR('V', 58, struct vki_v4l2_cropcap)
4442 #define VKI_V4L2_G_CROP _VKI_IOWR('V', 59, struct vki_v4l2_crop)
4443 #define VKI_V4L2_S_CROP _VKI_IOW('V', 60, struct vki_v4l2_crop)
4444 #define VKI_V4L2_G_JPEGCOMP _VKI_IOR('V', 61, struct vki_v4l2_jpegcompression)
4445 #define VKI_V4L2_S_JPEGCOMP _VKI_IOW('V', 62, struct vki_v4l2_jpegcompression)
4446 #define VKI_V4L2_QUERYSTD _VKI_IOR('V', 63, vki_v4l2_std_id)
4447 #define VKI_V4L2_TRY_FMT _VKI_IOWR('V', 64, struct vki_v4l2_format)
4448 #define VKI_V4L2_ENUMAUDIO _VKI_IOWR('V', 65, struct vki_v4l2_audio)
4449 #define VKI_V4L2_ENUMAUDOUT _VKI_IOWR('V', 66, struct vki_v4l2_audioout)
4450 #define VKI_V4L2_G_PRIORITY _VKI_IOR('V', 67, __vki_u32)
4451 #define VKI_V4L2_S_PRIORITY _VKI_IOW('V', 68, __vki_u32)
4452 #define VKI_V4L2_G_SLICED_VBI_CAP _VKI_IOWR('V', 69, struct vki_v4l2_sliced_vbi_cap)
4453 #define VKI_V4L2_LOG_STATUS _VKI_IO('V', 70)
4454 #define VKI_V4L2_G_EXT_CTRLS _VKI_IOWR('V', 71, struct vki_v4l2_ext_controls)
4455 #define VKI_V4L2_S_EXT_CTRLS _VKI_IOWR('V', 72, struct vki_v4l2_ext_controls)
4456 #define VKI_V4L2_TRY_EXT_CTRLS _VKI_IOWR('V', 73, struct vki_v4l2_ext_controls)
4457 #define VKI_V4L2_ENUM_FRAMESIZES _VKI_IOWR('V', 74, struct vki_v4l2_frmsizeenum)
4458 #define VKI_V4L2_ENUM_FRAMEINTERVALS _VKI_IOWR('V', 75, struct vki_v4l2_frmivalenum)
4459 #define VKI_V4L2_G_ENC_INDEX _VKI_IOR('V', 76, struct vki_v4l2_enc_idx)
4460 #define VKI_V4L2_ENCODER_CMD _VKI_IOWR('V', 77, struct vki_v4l2_encoder_cmd)
4461 #define VKI_V4L2_TRY_ENCODER_CMD _VKI_IOWR('V', 78, struct vki_v4l2_encoder_cmd)
4462 #define VKI_V4L2_DBG_S_REGISTER _VKI_IOW('V', 79, struct vki_v4l2_dbg_register)
4463 #define VKI_V4L2_DBG_G_REGISTER _VKI_IOWR('V', 80, struct vki_v4l2_dbg_register)
4464 #define VKI_V4L2_S_HW_FREQ_SEEK _VKI_IOW('V', 82, struct vki_v4l2_hw_freq_seek)
4465 #define VKI_V4L2_S_DV_TIMINGS _VKI_IOWR('V', 87, struct vki_v4l2_dv_timings)
4466 #define VKI_V4L2_G_DV_TIMINGS _VKI_IOWR('V', 88, struct vki_v4l2_dv_timings)
4467 #define VKI_V4L2_DQEVENT _VKI_IOR('V', 89, struct vki_v4l2_event)
4468 #define VKI_V4L2_SUBSCRIBE_EVENT _VKI_IOW('V', 90, struct vki_v4l2_event_subscription)
4469 #define VKI_V4L2_UNSUBSCRIBE_EVENT _VKI_IOW('V', 91, struct vki_v4l2_event_subscription)
4470 #define VKI_V4L2_CREATE_BUFS _VKI_IOWR('V', 92, struct vki_v4l2_create_buffers)
4471 #define VKI_V4L2_PREPARE_BUF _VKI_IOWR('V', 93, struct vki_v4l2_buffer)
4472 #define VKI_V4L2_G_SELECTION _VKI_IOWR('V', 94, struct vki_v4l2_selection)
4473 #define VKI_V4L2_S_SELECTION _VKI_IOWR('V', 95, struct vki_v4l2_selection)
4474 #define VKI_V4L2_DECODER_CMD _VKI_IOWR('V', 96, struct vki_v4l2_decoder_cmd)
4475 #define VKI_V4L2_TRY_DECODER_CMD _VKI_IOWR('V', 97, struct vki_v4l2_decoder_cmd)
4476 #define VKI_V4L2_ENUM_DV_TIMINGS _VKI_IOWR('V', 98, struct vki_v4l2_enum_dv_timings)
4477 #define VKI_V4L2_QUERY_DV_TIMINGS _VKI_IOR('V', 99, struct vki_v4l2_dv_timings)
4478 #define VKI_V4L2_DV_TIMINGS_CAP _VKI_IOWR('V', 100, struct vki_v4l2_dv_timings_cap)
4479 #define VKI_V4L2_ENUM_FREQ_BANDS _VKI_IOWR('V', 101, struct vki_v4l2_frequency_band)
4480 #define VKI_V4L2_DBG_G_CHIP_INFO _VKI_IOWR('V', 102, struct vki_v4l2_dbg_chip_info)
4481 #define VKI_V4L2_QUERY_EXT_CTRL _VKI_IOWR('V', 103, struct vki_v4l2_query_ext_ctrl)
4483 struct vki_v4l2_mbus_framefmt
{
4488 __vki_u32 colorspace
;
4489 __vki_u16 ycbcr_enc
;
4490 __vki_u16 quantization
;
4491 __vki_u32 reserved
[6];
4494 struct vki_v4l2_subdev_format
{
4497 struct vki_v4l2_mbus_framefmt format
;
4498 __vki_u32 reserved
[8];
4501 struct vki_v4l2_subdev_crop
{
4504 struct vki_v4l2_rect rect
;
4505 __vki_u32 reserved
[8];
4508 struct vki_v4l2_subdev_mbus_code_enum
{
4513 __vki_u32 reserved
[8];
4516 struct vki_v4l2_subdev_frame_size_enum
{
4520 __vki_u32 min_width
;
4521 __vki_u32 max_width
;
4522 __vki_u32 min_height
;
4523 __vki_u32 max_height
;
4525 __vki_u32 reserved
[8];
4528 struct vki_v4l2_subdev_frame_interval
{
4530 struct vki_v4l2_fract interval
;
4531 __vki_u32 reserved
[9];
4534 struct vki_v4l2_subdev_frame_interval_enum
{
4540 struct vki_v4l2_fract interval
;
4542 __vki_u32 reserved
[8];
4545 struct vki_v4l2_subdev_selection
{
4550 struct vki_v4l2_rect r
;
4551 __vki_u32 reserved
[8];
4554 #define VKI_V4L2_SUBDEV_G_FMT _VKI_IOWR('V', 4, struct vki_v4l2_subdev_format)
4555 #define VKI_V4L2_SUBDEV_S_FMT _VKI_IOWR('V', 5, struct vki_v4l2_subdev_format)
4556 #define VKI_V4L2_SUBDEV_G_FRAME_INTERVAL _VKI_IOWR('V', 21, struct vki_v4l2_subdev_frame_interval)
4557 #define VKI_V4L2_SUBDEV_S_FRAME_INTERVAL _VKI_IOWR('V', 22, struct vki_v4l2_subdev_frame_interval)
4558 #define VKI_V4L2_SUBDEV_ENUM_MBUS_CODE _VKI_IOWR('V', 2, struct vki_v4l2_subdev_mbus_code_enum)
4559 #define VKI_V4L2_SUBDEV_ENUM_FRAME_SIZE _VKI_IOWR('V', 74, struct vki_v4l2_subdev_frame_size_enum)
4560 #define VKI_V4L2_SUBDEV_ENUM_FRAME_INTERVAL _VKI_IOWR('V', 75, struct vki_v4l2_subdev_frame_interval_enum)
4561 #define VKI_V4L2_SUBDEV_G_CROP _VKI_IOWR('V', 59, struct vki_v4l2_subdev_crop)
4562 #define VKI_V4L2_SUBDEV_S_CROP _VKI_IOWR('V', 60, struct vki_v4l2_subdev_crop)
4563 #define VKI_V4L2_SUBDEV_G_SELECTION _VKI_IOWR('V', 61, struct vki_v4l2_subdev_selection)
4564 #define VKI_V4L2_SUBDEV_S_SELECTION _VKI_IOWR('V', 62, struct vki_v4l2_subdev_selection)
4566 struct vki_media_device_info
{
4571 __vki_u32 media_version
;
4572 __vki_u32 hw_revision
;
4573 __vki_u32 driver_version
;
4574 __vki_u32 reserved
[31];
4577 struct vki_media_entity_desc
{
4587 __vki_u32 reserved
[4];
4590 /* Node specifications */
4602 __vki_u32 subdevice
;
4606 /* Sub-device specifications */
4607 /* Nothing needed yet */
4612 struct vki_media_pad_desc
{
4613 __vki_u32 entity
; /* entity ID */
4614 __vki_u16 index
; /* pad index */
4615 __vki_u32 flags
; /* pad flags */
4616 __vki_u32 reserved
[2];
4619 struct vki_media_link_desc
{
4620 struct vki_media_pad_desc source
;
4621 struct vki_media_pad_desc sink
;
4623 __vki_u32 reserved
[2];
4626 struct vki_media_links_enum
{
4628 struct vki_media_pad_desc __user
*pads
;
4629 struct vki_media_link_desc __user
*links
;
4630 __vki_u32 reserved
[4];
4633 #define VKI_MEDIA_IOC_DEVICE_INFO _VKI_IOWR('|', 0x00, struct vki_media_device_info)
4634 #define VKI_MEDIA_IOC_ENUM_ENTITIES _VKI_IOWR('|', 0x01, struct vki_media_entity_desc)
4635 #define VKI_MEDIA_IOC_ENUM_LINKS _VKI_IOWR('|', 0x02, struct vki_media_links_enum)
4636 #define VKI_MEDIA_IOC_SETUP_LINK _VKI_IOWR('|', 0x03, struct vki_media_link_desc)
4638 /* Comparison type */
4639 enum vki_kcmp_type
{
4651 //----------------------------------------------------------------------
4652 // From linux-3.19-rc5/include/uapi/linux/seccomp.h
4653 //----------------------------------------------------------------------
4655 #define VKI_SECCOMP_MODE_FILTER 2
4657 //----------------------------------------------------------------------
4658 // From linux-3.19.3/include/uapi/linux/binfmts.h
4659 //----------------------------------------------------------------------
4660 #define VKI_BINPRM_BUF_SIZE 128
4662 #endif // __VKI_LINUX_H
4664 /*--------------------------------------------------------------------*/
4666 /*--------------------------------------------------------------------*/