1 2 /*--------------------------------------------------------------------*/ 3 /*--- Linux-specific kernel interface. vki-linux.h ---*/ 4 /*--------------------------------------------------------------------*/ 5 6 /* 7 This file is part of Valgrind, a dynamic binary instrumentation 8 framework. 9 10 Copyright (C) 2000-2013 Julian Seward 11 jseward (at) acm.org 12 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. 17 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. 22 23 You should have received a copy of the GNU General Public License 24 along with this program; if not, write to the Free Software 25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 26 02111-1307, USA. 27 28 The GNU General Public License is contained in the file COPYING. 29 */ 30 31 /* This file defines types and constants for the kernel interface, and to 32 make that clear everything is prefixed VKI_/vki_. 33 34 All code is copied verbatim from kernel source files, except that: 35 - VKI_/vki_ prefixes are added 36 - some extra explanatory comments are included; they are all within 37 "[[ ]]" 38 - for some types, we only care about the size; for a few of them (big 39 ones that are painful to fully drag in here), a VKI_SIZEOF_* constant 40 is used. 41 42 The files the code is taken from is indicated. 43 44 Note especially that the types are not the glibc versions, many of which 45 are different to those in here. 46 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.) 55 56 Finally, note that it is assumed that __KERNEL__ is set for all these 57 definitions, which affects some of them. 58 */ 59 60 /* The structure is (aiui, jrs 20060504): 61 62 #include plat-specific posix types (vki-posixtypes-ARCH-linux.h) 63 64 Lots more types, structs, consts, in this file 65 66 #include other plat-specific stuff (vki-ARCH-linux.h) 67 68 Even more types, structs, consts, in this file 69 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. 73 */ 74 75 #ifndef __VKI_LINUX_H 76 #define __VKI_LINUX_H 77 78 //---------------------------------------------------------------------- 79 // Arch-specific POSIX types 80 //---------------------------------------------------------------------- 81 82 #if defined(VGA_x86) 83 # include "vki-posixtypes-x86-linux.h" 84 #elif defined(VGA_amd64) 85 # include "vki-posixtypes-amd64-linux.h" 86 #elif defined(VGA_ppc32) 87 # include "vki-posixtypes-ppc32-linux.h" 88 #elif defined(VGA_ppc64) 89 # include "vki-posixtypes-ppc64-linux.h" 90 #elif defined(VGA_arm) 91 # include "vki-posixtypes-arm-linux.h" 92 #elif defined(VGA_arm64) 93 # include "vki-posixtypes-arm64-linux.h" 94 #elif defined(VGA_s390x) 95 # include "vki-posixtypes-s390x-linux.h" 96 #elif defined(VGA_mips32) 97 # include "vki-posixtypes-mips32-linux.h" 98 #elif defined(VGA_mips64) 99 # include "vki-posixtypes-mips64-linux.h" 100 #else 101 # error Unknown platform 102 #endif 103 104 //---------------------------------------------------------------------- 105 // VKI_STATIC_ASSERT(). Inspired by BUILD_BUG_ON() from 106 // linux-2.6.34/include/linux/kernel.h 107 //---------------------------------------------------------------------- 108 109 /* 110 * Evaluates to zero if 'expr' is true and forces a compilation error if 111 * 'expr' is false. Can be used in a context where no comma expressions 112 * are allowed. 113 */ 114 #ifdef __cplusplus 115 template <bool b> struct vki_static_assert { int m_bitfield:(2*b-1); }; 116 #define VKI_STATIC_ASSERT(expr) \ 117 (sizeof(vki_static_assert<(expr)>) - sizeof(int)) 118 #else 119 #define VKI_STATIC_ASSERT(expr) (sizeof(struct { int:-!(expr); })) 120 #endif 121 122 //---------------------------------------------------------------------- 123 // Based on _IOC_TYPECHECK() from linux-2.6.34/asm-generic/ioctl.h 124 //---------------------------------------------------------------------- 125 126 /* provoke compile error for invalid uses of size argument */ 127 #define _VKI_IOC_TYPECHECK(t) \ 128 (VKI_STATIC_ASSERT((sizeof(t) == sizeof(t[1]) \ 129 && sizeof(t) < (1 << _VKI_IOC_SIZEBITS))) \ 130 + sizeof(t)) 131 132 //---------------------------------------------------------------------- 133 // From linux-2.6.8.1/include/linux/compiler.h 134 //---------------------------------------------------------------------- 135 136 # define __user 137 138 //---------------------------------------------------------------------- 139 // From linux/include/linux/compiler-gcc.h 140 //---------------------------------------------------------------------- 141 142 #ifdef __GNUC__ 143 #define __vki_packed __attribute__((packed)) 144 #endif 145 146 //---------------------------------------------------------------------- 147 // From linux-2.6.8.1/include/linux/posix_types.h 148 //---------------------------------------------------------------------- 149 150 #undef __VKI_NFDBITS 151 #define __VKI_NFDBITS (8 * sizeof(unsigned long)) 152 153 #undef __VKI_FD_SETSIZE 154 #define __VKI_FD_SETSIZE 1024 155 156 #undef __VKI_FDSET_LONGS 157 #define __VKI_FDSET_LONGS (__VKI_FD_SETSIZE/__VKI_NFDBITS) 158 159 #undef __VKI_FDELT 160 #define __VKI_FDELT(d) ((d) / __VKI_NFDBITS) 161 162 #undef __VKI_FDMASK 163 #define __VKI_FDMASK(d) (1UL << ((d) % __VKI_NFDBITS)) 164 165 typedef struct { 166 unsigned long fds_bits [__VKI_FDSET_LONGS]; 167 } __vki_kernel_fd_set; 168 169 typedef int __vki_kernel_key_t; 170 typedef int __vki_kernel_mqd_t; 171 172 //---------------------------------------------------------------------- 173 // From linux-2.6.8.1/include/linux/types.h 174 //---------------------------------------------------------------------- 175 176 typedef __vki_kernel_fd_set vki_fd_set; 177 typedef __vki_kernel_mode_t vki_mode_t; 178 typedef __vki_kernel_off_t vki_off_t; 179 typedef __vki_kernel_pid_t vki_pid_t; 180 typedef __vki_kernel_key_t vki_key_t; 181 typedef __vki_kernel_suseconds_t vki_suseconds_t; 182 typedef __vki_kernel_timer_t vki_timer_t; 183 typedef __vki_kernel_clockid_t vki_clockid_t; 184 typedef __vki_kernel_mqd_t vki_mqd_t; 185 186 // [[Nb: it's a bit unclear due to a #ifdef, but I think this is right. --njn]] 187 typedef __vki_kernel_uid32_t vki_uid_t; 188 typedef __vki_kernel_gid32_t vki_gid_t; 189 190 typedef __vki_kernel_old_uid_t vki_old_uid_t; 191 typedef __vki_kernel_old_gid_t vki_old_gid_t; 192 193 typedef __vki_kernel_loff_t vki_loff_t; 194 195 typedef __vki_kernel_size_t vki_size_t; 196 typedef __vki_kernel_time_t vki_time_t; 197 typedef __vki_kernel_clock_t vki_clock_t; 198 typedef __vki_kernel_caddr_t vki_caddr_t; 199 200 typedef unsigned long vki_u_long; 201 202 typedef unsigned int vki_uint; 203 204 //---------------------------------------------------------------------- 205 // Now the rest of the arch-specific stuff 206 //---------------------------------------------------------------------- 207 208 #if defined(VGA_x86) 209 # include "vki-x86-linux.h" 210 #elif defined(VGA_amd64) 211 # include "vki-amd64-linux.h" 212 #elif defined(VGA_ppc32) 213 # include "vki-ppc32-linux.h" 214 #elif defined(VGA_ppc64) 215 # include "vki-ppc64-linux.h" 216 #elif defined(VGA_arm) 217 # include "vki-arm-linux.h" 218 #elif defined(VGA_arm64) 219 # include "vki-arm64-linux.h" 220 #elif defined(VGA_s390x) 221 # include "vki-s390x-linux.h" 222 #elif defined(VGA_mips32) 223 # include "vki-mips32-linux.h" 224 #elif defined(VGA_mips64) 225 # include "vki-mips64-linux.h" 226 #else 227 # error Unknown platform 228 #endif 229 230 //---------------------------------------------------------------------- 231 // From linux-2.6.20.1/include/linux/types.h 232 //---------------------------------------------------------------------- 233 234 typedef __vki_s32 vki_int32_t; 235 typedef __vki_s16 vki_int16_t; 236 typedef __vki_s64 vki_int64_t; 237 238 typedef __vki_u8 vki_uint8_t; 239 typedef __vki_u16 vki_uint16_t; 240 typedef __vki_u32 vki_uint32_t; 241 typedef __vki_u64 vki_uint64_t; 242 243 typedef __vki_u16 __vki_le16; 244 245 //---------------------------------------------------------------------- 246 // From linux-2.6.8.1/include/linux/limits.h 247 //---------------------------------------------------------------------- 248 249 #define VKI_PATH_MAX 4096 /* # chars in a path name including nul */ 250 251 //---------------------------------------------------------------------- 252 // From linux-2.6.8.1/include/linux/kernel.h 253 //---------------------------------------------------------------------- 254 255 struct vki_sysinfo { 256 long uptime; /* Seconds since boot */ 257 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */ 258 unsigned long totalram; /* Total usable main memory size */ 259 unsigned long freeram; /* Available memory size */ 260 unsigned long sharedram; /* Amount of shared memory */ 261 unsigned long bufferram; /* Memory used by buffers */ 262 unsigned long totalswap; /* Total swap space size */ 263 unsigned long freeswap; /* swap space still available */ 264 unsigned short procs; /* Number of current processes */ 265 unsigned short pad; /* explicit padding for m68k */ 266 unsigned long totalhigh; /* Total high memory size */ 267 unsigned long freehigh; /* Available high memory size */ 268 unsigned int mem_unit; /* Memory unit size in bytes */ 269 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 270 }; 271 272 //---------------------------------------------------------------------- 273 // From linux-2.6.8.1/include/linux/time.h 274 //---------------------------------------------------------------------- 275 276 #define VKI_CLOCK_REALTIME 0 277 #define VKI_CLOCK_MONOTONIC 1 278 #define VKI_CLOCK_PROCESS_CPUTIME_ID 2 279 #define VKI_CLOCK_THREAD_CPUTIME_ID 3 280 281 struct vki_timespec { 282 vki_time_t tv_sec; /* seconds */ 283 long tv_nsec; /* nanoseconds */ 284 }; 285 286 struct vki_timeval { 287 vki_time_t tv_sec; /* seconds */ 288 vki_suseconds_t tv_usec; /* microseconds */ 289 }; 290 291 struct vki_timezone { 292 int tz_minuteswest; /* minutes west of Greenwich */ 293 int tz_dsttime; /* type of dst correction */ 294 }; 295 296 struct vki_itimerspec { 297 struct vki_timespec it_interval; /* timer period */ 298 struct vki_timespec it_value; /* timer expiration */ 299 }; 300 301 struct vki_itimerval { 302 struct vki_timeval it_interval; /* timer interval */ 303 struct vki_timeval it_value; /* current value */ 304 }; 305 306 //---------------------------------------------------------------------- 307 // From linux-2.6.8.1/include/linux/timex.h 308 //---------------------------------------------------------------------- 309 310 struct vki_timex { 311 unsigned int modes; /* mode selector */ 312 long offset; /* time offset (usec) */ 313 long freq; /* frequency offset (scaled ppm) */ 314 long maxerror; /* maximum error (usec) */ 315 long esterror; /* estimated error (usec) */ 316 int status; /* clock command/status */ 317 long constant; /* pll time constant */ 318 long precision; /* clock precision (usec) (read only) */ 319 long tolerance; /* clock frequency tolerance (ppm) 320 * (read only) 321 */ 322 struct vki_timeval time; /* (read only) */ 323 long tick; /* (modified) usecs between clock ticks */ 324 325 long ppsfreq; /* pps frequency (scaled ppm) (ro) */ 326 long jitter; /* pps jitter (us) (ro) */ 327 int shift; /* interval duration (s) (shift) (ro) */ 328 long stabil; /* pps stability (scaled ppm) (ro) */ 329 long jitcnt; /* jitter limit exceeded (ro) */ 330 long calcnt; /* calibration intervals (ro) */ 331 long errcnt; /* calibration errors (ro) */ 332 long stbcnt; /* stability limit exceeded (ro) */ 333 334 int :32; int :32; int :32; int :32; 335 int :32; int :32; int :32; int :32; 336 int :32; int :32; int :32; int :32; 337 }; 338 339 #define VKI_ADJ_OFFSET 0x0001 /* time offset */ 340 #define VKI_ADJ_FREQUENCY 0x0002 /* frequency offset */ 341 #define VKI_ADJ_MAXERROR 0x0004 /* maximum time error */ 342 #define VKI_ADJ_ESTERROR 0x0008 /* estimated time error */ 343 #define VKI_ADJ_STATUS 0x0010 /* clock status */ 344 #define VKI_ADJ_TIMECONST 0x0020 /* pll time constant */ 345 #define VKI_ADJ_TAI 0x0080 /* set TAI offset */ 346 #define VKI_ADJ_TICK 0x4000 /* tick value */ 347 #define VKI_ADJ_ADJTIME 0x8000 /* switch between adjtime/adjtimex modes */ 348 //#define VKI_ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ 349 #define VKI_ADJ_OFFSET_READONLY 0x2000 /* read-only adjtime */ 350 351 //---------------------------------------------------------------------- 352 // From linux-2.6.8.1/include/linux/times.h 353 //---------------------------------------------------------------------- 354 355 struct vki_tms { 356 vki_clock_t tms_utime; 357 vki_clock_t tms_stime; 358 vki_clock_t tms_cutime; 359 vki_clock_t tms_cstime; 360 }; 361 362 //---------------------------------------------------------------------- 363 // From linux-2.6.8.1/include/linux/utime.h 364 //---------------------------------------------------------------------- 365 366 struct vki_utimbuf { 367 vki_time_t actime; 368 vki_time_t modtime; 369 }; 370 371 //---------------------------------------------------------------------- 372 // From linux-2.6.8.1/include/linux/sched.h 373 //---------------------------------------------------------------------- 374 375 #define VKI_CSIGNAL 0x000000ff /* signal mask to be sent at exit */ 376 #define VKI_CLONE_VM 0x00000100 /* set if VM shared between processes */ 377 #define VKI_CLONE_FS 0x00000200 /* set if fs info shared between processes */ 378 #define VKI_CLONE_FILES 0x00000400 /* set if open files shared between processes */ 379 #define VKI_CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */ 380 #define VKI_CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ 381 #define VKI_CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ 382 #define VKI_CLONE_THREAD 0x00010000 /* Same thread group? */ 383 #define VKI_CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ 384 #define VKI_CLONE_SETTLS 0x00080000 /* create a new TLS for the child */ 385 #define VKI_CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */ 386 #define VKI_CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */ 387 #define VKI_CLONE_DETACHED 0x00400000 /* Unused, ignored */ 388 #define VKI_CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */ 389 390 struct vki_sched_param { 391 int sched_priority; 392 }; 393 394 #define VKI_TASK_COMM_LEN 16 395 396 //---------------------------------------------------------------------- 397 // From linux-2.6.8.1/include/asm-generic/siginfo.h 398 //---------------------------------------------------------------------- 399 400 // Some archs, such as MIPS, have non-standard vki_siginfo. 401 #ifndef HAVE_ARCH_SIGINFO_T 402 typedef union vki_sigval { 403 int sival_int; 404 void __user *sival_ptr; 405 } vki_sigval_t; 406 407 #ifndef __VKI_ARCH_SI_PREAMBLE_SIZE 408 #define __VKI_ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int)) 409 #endif 410 411 #define VKI_SI_MAX_SIZE 128 412 413 #ifndef VKI_SI_PAD_SIZE 414 #define VKI_SI_PAD_SIZE ((VKI_SI_MAX_SIZE - __VKI_ARCH_SI_PREAMBLE_SIZE) / sizeof(int)) 415 #endif 416 417 #ifndef __VKI_ARCH_SI_UID_T 418 #define __VKI_ARCH_SI_UID_T vki_uid_t 419 #endif 420 421 #ifndef __VKI_ARCH_SI_BAND_T 422 #define __VKI_ARCH_SI_BAND_T long 423 #endif 424 425 // [[Nb: this type changed between 2.4 and 2.6, but not in a way that 426 // affects Valgrind.]] 427 typedef struct vki_siginfo { 428 int si_signo; 429 int si_errno; 430 int si_code; 431 432 union { 433 int _pad[VKI_SI_PAD_SIZE]; 434 435 /* kill() */ 436 struct { 437 vki_pid_t _pid; /* sender's pid */ 438 __VKI_ARCH_SI_UID_T _uid; /* sender's uid */ 439 } _kill; 440 441 /* POSIX.1b timers */ 442 struct { 443 vki_timer_t _tid; /* timer id */ 444 int _overrun; /* overrun count */ 445 char _pad[sizeof( __VKI_ARCH_SI_UID_T) - sizeof(int)]; 446 vki_sigval_t _sigval; /* same as below */ 447 int _sys_private; /* not to be passed to user */ 448 } _timer; 449 450 /* POSIX.1b signals */ 451 struct { 452 vki_pid_t _pid; /* sender's pid */ 453 __VKI_ARCH_SI_UID_T _uid; /* sender's uid */ 454 vki_sigval_t _sigval; 455 } _rt; 456 457 /* SIGCHLD */ 458 struct { 459 vki_pid_t _pid; /* which child */ 460 __VKI_ARCH_SI_UID_T _uid; /* sender's uid */ 461 int _status; /* exit code */ 462 vki_clock_t _utime; 463 vki_clock_t _stime; 464 } _sigchld; 465 466 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 467 struct { 468 void __user *_addr; /* faulting insn/memory ref. */ 469 #ifdef __ARCH_SI_TRAPNO 470 int _trapno; /* TRAP # which caused the signal */ 471 #endif 472 } _sigfault; 473 474 /* SIGPOLL */ 475 struct { 476 __VKI_ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 477 int _fd; 478 } _sigpoll; 479 } _sifields; 480 } vki_siginfo_t; 481 #endif 482 483 #define __VKI_SI_FAULT 0 484 485 /* 486 * si_code values 487 * Digital reserves positive values for kernel-generated signals. 488 */ 489 #define VKI_SI_USER 0 /* sent by kill, sigsend, raise */ 490 #define VKI_SI_TKILL -6 /* sent by tkill system call */ 491 492 /* 493 * SIGILL si_codes 494 */ 495 #define VKI_ILL_ILLOPC (__VKI_SI_FAULT|1) /* illegal opcode */ 496 #define VKI_ILL_ILLOPN (__VKI_SI_FAULT|2) /* illegal operand */ 497 #define VKI_ILL_ILLADR (__VKI_SI_FAULT|3) /* illegal addressing mode */ 498 #define VKI_ILL_ILLTRP (__VKI_SI_FAULT|4) /* illegal trap */ 499 #define VKI_ILL_PRVOPC (__VKI_SI_FAULT|5) /* privileged opcode */ 500 #define VKI_ILL_PRVREG (__VKI_SI_FAULT|6) /* privileged register */ 501 #define VKI_ILL_COPROC (__VKI_SI_FAULT|7) /* coprocessor error */ 502 #define VKI_ILL_BADSTK (__VKI_SI_FAULT|8) /* internal stack error */ 503 504 /* 505 * SIGFPE si_codes 506 */ 507 #define VKI_FPE_INTDIV (__VKI_SI_FAULT|1) /* integer divide by zero */ 508 #define VKI_FPE_INTOVF (__VKI_SI_FAULT|2) /* integer overflow */ 509 #define VKI_FPE_FLTDIV (__VKI_SI_FAULT|3) /* floating point divide by zero */ 510 #define VKI_FPE_FLTOVF (__VKI_SI_FAULT|4) /* floating point overflow */ 511 #define VKI_FPE_FLTUND (__VKI_SI_FAULT|5) /* floating point underflow */ 512 #define VKI_FPE_FLTRES (__VKI_SI_FAULT|6) /* floating point inexact result */ 513 #define VKI_FPE_FLTINV (__VKI_SI_FAULT|7) /* floating point invalid operation */ 514 #define VKI_FPE_FLTSUB (__VKI_SI_FAULT|8) /* subscript out of range */ 515 516 /* 517 * SIGSEGV si_codes 518 */ 519 #define VKI_SEGV_MAPERR (__VKI_SI_FAULT|1) /* address not mapped to object */ 520 #define VKI_SEGV_ACCERR (__VKI_SI_FAULT|2) /* invalid permissions for mapped object */ 521 522 /* 523 * SIGBUS si_codes 524 */ 525 #define VKI_BUS_ADRALN (__VKI_SI_FAULT|1) /* invalid address alignment */ 526 #define VKI_BUS_ADRERR (__VKI_SI_FAULT|2) /* non-existant physical address */ 527 #define VKI_BUS_OBJERR (__VKI_SI_FAULT|3) /* object specific hardware error */ 528 529 /* 530 * SIGTRAP si_codes 531 */ 532 #define VKI_TRAP_BRKPT (__VKI_SI_FAULT|1) /* process breakpoint */ 533 #define VKI_TRAP_TRACE (__VKI_SI_FAULT|2) /* process trace trap */ 534 535 /* 536 * This works because the alignment is ok on all current architectures 537 * but we leave open this being overridden in the future 538 */ 539 #ifndef VKI___ARCH_SIGEV_PREAMBLE_SIZE 540 #define VKI___ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(vki_sigval_t)) 541 #endif 542 543 #define VKI_SIGEV_MAX_SIZE 64 544 #define VKI_SIGEV_PAD_SIZE ((VKI_SIGEV_MAX_SIZE - VKI___ARCH_SIGEV_PREAMBLE_SIZE) \ 545 / sizeof(int)) 546 547 /* This is the flag the kernel handles, userspace/glibc handles SEGEV_THEAD. */ 548 #define VKI_SIGEV_THREAD_ID 4 549 550 typedef struct vki_sigevent { 551 vki_sigval_t sigev_value; 552 int sigev_signo; 553 int sigev_notify; 554 union { 555 int _pad[VKI_SIGEV_PAD_SIZE]; 556 int _tid; 557 558 struct { 559 void (*_function)(vki_sigval_t); 560 void *_attribute; /* really pthread_attr_t */ 561 } _sigev_thread; 562 } _sigev_un; 563 } vki_sigevent_t; 564 565 #define vki_sigev_notify_thread_id _sigev_un._tid 566 567 //---------------------------------------------------------------------- 568 // From elsewhere... 569 //---------------------------------------------------------------------- 570 571 // [[The kernel actually uses the numbers 0,1,2 directly here, believe it or 572 // not. So we introduce our own constants, based on the glibc ones.]] 573 #define VKI_SEEK_SET 0 574 #define VKI_SEEK_CUR 1 575 #define VKI_SEEK_END 2 576 577 //---------------------------------------------------------------------- 578 // From linux-2.6.8.1/include/linux/net.h 579 //---------------------------------------------------------------------- 580 581 #define VKI_SYS_SOCKET 1 /* sys_socket(2) */ 582 #define VKI_SYS_BIND 2 /* sys_bind(2) */ 583 #define VKI_SYS_CONNECT 3 /* sys_connect(2) */ 584 #define VKI_SYS_LISTEN 4 /* sys_listen(2) */ 585 #define VKI_SYS_ACCEPT 5 /* sys_accept(2) */ 586 #define VKI_SYS_GETSOCKNAME 6 /* sys_getsockname(2) */ 587 #define VKI_SYS_GETPEERNAME 7 /* sys_getpeername(2) */ 588 #define VKI_SYS_SOCKETPAIR 8 /* sys_socketpair(2) */ 589 #define VKI_SYS_SEND 9 /* sys_send(2) */ 590 #define VKI_SYS_RECV 10 /* sys_recv(2) */ 591 #define VKI_SYS_SENDTO 11 /* sys_sendto(2) */ 592 #define VKI_SYS_RECVFROM 12 /* sys_recvfrom(2) */ 593 #define VKI_SYS_SHUTDOWN 13 /* sys_shutdown(2) */ 594 #define VKI_SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */ 595 #define VKI_SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ 596 #define VKI_SYS_SENDMSG 16 /* sys_sendmsg(2) */ 597 #define VKI_SYS_RECVMSG 17 /* sys_recvmsg(2) */ 598 #define VKI_SYS_ACCEPT4 18 /* sys_accept4(2) */ 599 600 #ifndef ARCH_HAS_SOCKET_TYPES 601 enum vki_sock_type { 602 VKI_SOCK_STREAM = 1, 603 // [[others omitted]] 604 }; 605 #endif /* ARCH_HAS_SOCKET_TYPES */ 606 607 //---------------------------------------------------------------------- 608 // From linux-2.6.8.1/include/linux/uio.h 609 //---------------------------------------------------------------------- 610 611 struct vki_iovec 612 { 613 void __user *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */ 614 __vki_kernel_size_t iov_len; /* Must be size_t (1003.1g) */ 615 }; 616 617 //---------------------------------------------------------------------- 618 // From linux-2.6.8.1/include/linux/socket.h 619 //---------------------------------------------------------------------- 620 621 // [[Resolved arbitrarily; doesn't really matter whether it's '__inline__' 622 // or 'inline']] 623 #define __KINLINE static __inline__ 624 625 typedef unsigned short vki_sa_family_t; 626 627 struct vki_sockaddr { 628 vki_sa_family_t sa_family; /* address family, AF_xxx */ 629 char sa_data[14]; /* 14 bytes of protocol address */ 630 }; 631 632 struct vki_msghdr { 633 void * msg_name; /* Socket name */ 634 int msg_namelen; /* Length of name */ 635 struct vki_iovec * msg_iov; /* Data blocks */ 636 __vki_kernel_size_t msg_iovlen; /* Number of blocks */ 637 void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 638 __vki_kernel_size_t msg_controllen; /* Length of cmsg list */ 639 unsigned msg_flags; 640 }; 641 642 struct vki_mmsghdr { 643 struct vki_msghdr msg_hdr; 644 unsigned msg_len; 645 }; 646 647 struct vki_cmsghdr { 648 __vki_kernel_size_t cmsg_len; /* data byte count, including hdr */ 649 int cmsg_level; /* originating protocol */ 650 int cmsg_type; /* protocol-specific type */ 651 }; 652 653 #define __VKI_CMSG_NXTHDR(ctl, len, cmsg) __vki_cmsg_nxthdr((ctl),(len),(cmsg)) 654 #define VKI_CMSG_NXTHDR(mhdr, cmsg) vki_cmsg_nxthdr((mhdr), (cmsg)) 655 656 #define VKI_CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) ) 657 658 #define VKI_CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + VKI_CMSG_ALIGN(sizeof(struct vki_cmsghdr)))) 659 660 #define __VKI_CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct vki_cmsghdr) ? \ 661 (struct vki_cmsghdr *)(ctl) : \ 662 (struct vki_cmsghdr *)NULL) 663 #define VKI_CMSG_FIRSTHDR(msg) __VKI_CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen) 664 665 // [[Urgh, this is revolting...] 666 __KINLINE struct vki_cmsghdr * __vki_cmsg_nxthdr(void *__ctl, __vki_kernel_size_t __size, 667 struct vki_cmsghdr *__cmsg) 668 { 669 struct vki_cmsghdr * __ptr; 670 671 __ptr = (struct vki_cmsghdr*)(((unsigned char *) __cmsg) + VKI_CMSG_ALIGN(__cmsg->cmsg_len)); 672 if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size) 673 return (struct vki_cmsghdr *)0; 674 675 return __ptr; 676 } 677 678 __KINLINE struct vki_cmsghdr * vki_cmsg_nxthdr (struct vki_msghdr *__msg, struct vki_cmsghdr *__cmsg) 679 { 680 return __vki_cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg); 681 } 682 683 #define VKI_SCM_RIGHTS 0x01 /* rw: access rights (array of int) */ 684 685 #define VKI_AF_UNIX 1 /* Unix domain sockets */ 686 #define VKI_AF_INET 2 /* Internet IP Protocol */ 687 #define VKI_AF_INET6 10 /* IP version 6 */ 688 #define VKI_AF_BLUETOOTH 31 /* Bluetooth sockets */ 689 690 #define VKI_MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */ 691 692 #define VKI_SOL_SCTP 132 693 694 //---------------------------------------------------------------------- 695 // From linux-2.6.8.1/include/linux/in.h 696 //---------------------------------------------------------------------- 697 698 struct vki_in_addr { 699 __vki_u32 s_addr; 700 }; 701 702 /* Structure describing an Internet (IP) socket address. */ 703 #define __VKI_SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */ 704 struct vki_sockaddr_in { 705 vki_sa_family_t sin_family; /* Address family */ 706 unsigned short int sin_port; /* Port number */ 707 struct vki_in_addr sin_addr; /* Internet address */ 708 709 /* Pad to size of `struct sockaddr'. */ 710 unsigned char __pad[__VKI_SOCK_SIZE__ - sizeof(short int) - 711 sizeof(unsigned short int) - sizeof(struct vki_in_addr)]; 712 }; 713 714 #define VKI_IPPROTO_TCP 6 /* Transmission Control Protocol */ 715 716 //---------------------------------------------------------------------- 717 // From linux-2.6.8.1/include/linux/in6.h 718 //---------------------------------------------------------------------- 719 720 struct vki_in6_addr 721 { 722 union 723 { 724 __vki_u8 u6_addr8[16]; 725 __vki_u16 u6_addr16[8]; 726 __vki_u32 u6_addr32[4]; 727 } vki_in6_u; 728 #define vki_s6_addr vki_in6_u.u6_addr8 729 #define vki_s6_addr16 vki_in6_u.u6_addr16 730 #define vki_s6_addr32 vki_in6_u.u6_addr32 731 }; 732 733 struct vki_sockaddr_in6 { 734 unsigned short int sin6_family; /* AF_INET6 */ 735 __vki_u16 sin6_port; /* Transport layer port # */ 736 __vki_u32 sin6_flowinfo; /* IPv6 flow information */ 737 struct vki_in6_addr sin6_addr; /* IPv6 address */ 738 __vki_u32 sin6_scope_id; /* scope id (new in RFC2553) */ 739 }; 740 741 //---------------------------------------------------------------------- 742 // From linux-2.6.8.1/include/linux/tcp.h 743 //---------------------------------------------------------------------- 744 745 #define VKI_TCP_NODELAY 1 /* Turn off Nagle's algorithm. */ 746 747 748 //---------------------------------------------------------------------- 749 // From linux-2.6.8.1/include/linux/un.h 750 //---------------------------------------------------------------------- 751 752 #define VKI_UNIX_PATH_MAX 108 753 754 struct vki_sockaddr_un { 755 vki_sa_family_t sun_family; /* AF_UNIX */ 756 char sun_path[VKI_UNIX_PATH_MAX]; /* pathname */ 757 }; 758 759 //---------------------------------------------------------------------- 760 // From linux-2.6.8.1/include/linux/if.h 761 //---------------------------------------------------------------------- 762 763 #define VKI_IFNAMSIZ 16 764 765 struct vki_ifmap 766 { 767 unsigned long mem_start; 768 unsigned long mem_end; 769 unsigned short base_addr; 770 unsigned char irq; 771 unsigned char dma; 772 unsigned char port; 773 /* 3 bytes spare */ 774 }; 775 776 struct vki_if_settings 777 { 778 unsigned int type; /* Type of physical device or protocol */ 779 unsigned int size; /* Size of the data allocated by the caller */ 780 union { 781 // [[Nb: converted these all to void* to avoid pulling in 782 // unnecessary headers]]] 783 /* {atm/eth/dsl}_settings anyone ? */ 784 void /*raw_hdlc_proto */__user *raw_hdlc; 785 void /*cisco_proto */__user *cisco; 786 void /*fr_proto */__user *fr; 787 void /*fr_proto_pvc */__user *fr_pvc; 788 void /*fr_proto_pvc_info */__user *fr_pvc_info; 789 790 /* interface settings */ 791 void /*sync_serial_settings */__user *sync; 792 void /*te1_settings */__user *te1; 793 } ifs_ifsu; 794 }; 795 796 struct vki_ifreq 797 { 798 #define VKI_IFHWADDRLEN 6 799 union 800 { 801 char ifrn_name[VKI_IFNAMSIZ]; /* if name, e.g. "en0" */ 802 } ifr_ifrn; 803 804 union { 805 struct vki_sockaddr ifru_addr; 806 struct vki_sockaddr ifru_dstaddr; 807 struct vki_sockaddr ifru_broadaddr; 808 struct vki_sockaddr ifru_netmask; 809 struct vki_sockaddr ifru_hwaddr; 810 short ifru_flags; 811 int ifru_ivalue; 812 int ifru_mtu; 813 struct vki_ifmap ifru_map; 814 char ifru_slave[VKI_IFNAMSIZ]; /* Just fits the size */ 815 char ifru_newname[VKI_IFNAMSIZ]; 816 void __user * ifru_data; 817 struct vki_if_settings ifru_settings; 818 } ifr_ifru; 819 }; 820 821 #define vki_ifr_name ifr_ifrn.ifrn_name /* interface name */ 822 #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ 823 #define ifr_addr ifr_ifru.ifru_addr /* address */ 824 #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ 825 #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ 826 #define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ 827 #define vki_ifr_flags ifr_ifru.ifru_flags /* flags */ 828 #define vki_ifr_metric ifr_ifru.ifru_ivalue /* metric */ 829 #define vki_ifr_mtu ifr_ifru.ifru_mtu /* mtu */ 830 #define ifr_map ifr_ifru.ifru_map /* device map */ 831 #define ifr_slave ifr_ifru.ifru_slave /* slave device */ 832 #define vki_ifr_data ifr_ifru.ifru_data /* for use by interface */ 833 #define vki_ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ 834 #define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ 835 #define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */ 836 #define ifr_newname ifr_ifru.ifru_newname /* New name */ 837 #define ifr_settings ifr_ifru.ifru_settings /* Device/proto settings*/ 838 839 struct vki_ifconf 840 { 841 int ifc_len; /* size of buffer */ 842 union 843 { 844 char __user *ifcu_buf; 845 struct vki_ifreq __user *ifcu_req; 846 } ifc_ifcu; 847 }; 848 #define vki_ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ 849 850 //---------------------------------------------------------------------- 851 // From linux-2.6.8.1/include/linux/if_arp.h 852 //---------------------------------------------------------------------- 853 854 struct vki_arpreq { 855 struct vki_sockaddr arp_pa; /* protocol address */ 856 struct vki_sockaddr arp_ha; /* hardware address */ 857 int arp_flags; /* flags */ 858 struct vki_sockaddr arp_netmask; /* netmask (only for proxy arps) */ 859 char arp_dev[16]; 860 }; 861 862 //---------------------------------------------------------------------- 863 // From linux-2.6.8.1/include/linux/route.h 864 //---------------------------------------------------------------------- 865 866 struct vki_rtentry 867 { 868 unsigned long rt_pad1; 869 struct vki_sockaddr rt_dst; /* target address */ 870 struct vki_sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ 871 struct vki_sockaddr rt_genmask; /* target network mask (IP) */ 872 unsigned short rt_flags; 873 short rt_pad2; 874 unsigned long rt_pad3; 875 void *rt_pad4; 876 short rt_metric; /* +1 for binary compatibility! */ 877 char __user *rt_dev; /* forcing the device at add */ 878 unsigned long rt_mtu; /* per route MTU/Window */ 879 // [[Not important for Valgrind]] 880 //#ifndef __KERNEL__ 881 //#define rt_mss rt_mtu /* Compatibility :-( */ 882 //#endif 883 unsigned long rt_window; /* Window clamping */ 884 unsigned short rt_irtt; /* Initial RTT */ 885 }; 886 887 //---------------------------------------------------------------------- 888 // From linux-2.6.13-rc5/include/net/sctp/user.h 889 //---------------------------------------------------------------------- 890 891 typedef __vki_s32 vki_sctp_assoc_t; 892 893 enum vki_sctp_optname { 894 VKI_SCTP_RTOINFO, 895 #define VKI_SCTP_RTOINFO VKI_SCTP_RTOINFO 896 VKI_SCTP_ASSOCINFO, 897 #define VKI_SCTP_ASSOCINFO VKI_SCTP_ASSOCINFO 898 VKI_SCTP_INITMSG, 899 #define VKI_SCTP_INITMSG VKI_SCTP_INITMSG 900 VKI_SCTP_NODELAY, /* Get/set nodelay option. */ 901 #define VKI_SCTP_NODELAY VKI_SCTP_NODELAY 902 VKI_SCTP_AUTOCLOSE, 903 #define VKI_SCTP_AUTOCLOSE VKI_SCTP_AUTOCLOSE 904 VKI_SCTP_SET_PEER_PRIMARY_ADDR, 905 #define VKI_SCTP_SET_PEER_PRIMARY_ADDR VKI_SCTP_SET_PEER_PRIMARY_ADDR 906 VKI_SCTP_PRIMARY_ADDR, 907 #define VKI_SCTP_PRIMARY_ADDR VKI_SCTP_PRIMARY_ADDR 908 VKI_SCTP_ADAPTION_LAYER, 909 #define VKI_SCTP_ADAPTION_LAYER VKI_SCTP_ADAPTION_LAYER 910 VKI_SCTP_DISABLE_FRAGMENTS, 911 #define VKI_SCTP_DISABLE_FRAGMENTS VKI_SCTP_DISABLE_FRAGMENTS 912 VKI_SCTP_PEER_ADDR_PARAMS, 913 #define VKI_SCTP_PEER_ADDR_PARAMS VKI_SCTP_PEER_ADDR_PARAMS 914 VKI_SCTP_DEFAULT_SEND_PARAM, 915 #define VKI_SCTP_DEFAULT_SEND_PARAM VKI_SCTP_DEFAULT_SEND_PARAM 916 VKI_SCTP_EVENTS, 917 #define VKI_SCTP_EVENTS VKI_SCTP_EVENTS 918 VKI_SCTP_I_WANT_MAPPED_V4_ADDR, /* Turn on/off mapped v4 addresses */ 919 #define VKI_SCTP_I_WANT_MAPPED_V4_ADDR VKI_SCTP_I_WANT_MAPPED_V4_ADDR 920 VKI_SCTP_MAXSEG, /* Get/set maximum fragment. */ 921 #define VKI_SCTP_MAXSEG VKI_SCTP_MAXSEG 922 VKI_SCTP_STATUS, 923 #define VKI_SCTP_STATUS VKI_SCTP_STATUS 924 VKI_SCTP_GET_PEER_ADDR_INFO, 925 #define VKI_SCTP_GET_PEER_ADDR_INFO VKI_SCTP_GET_PEER_ADDR_INFO 926 927 /* Internal Socket Options. Some of the sctp library functions are 928 * implemented using these socket options. 929 */ 930 VKI_SCTP_SOCKOPT_BINDX_ADD = 100,/* BINDX requests for adding addresses. */ 931 #define VKI_SCTP_SOCKOPT_BINDX_ADD VKI_SCTP_SOCKOPT_BINDX_ADD 932 VKI_SCTP_SOCKOPT_BINDX_REM, /* BINDX requests for removing addresses. */ 933 #define VKI_SCTP_SOCKOPT_BINDX_REM VKI_SCTP_SOCKOPT_BINDX_REM 934 VKI_SCTP_SOCKOPT_PEELOFF, /* peel off association. */ 935 #define VKI_SCTP_SOCKOPT_PEELOFF VKI_SCTP_SOCKOPT_PEELOFF 936 VKI_SCTP_GET_PEER_ADDRS_NUM, /* Get number of peer addresss. */ 937 #define VKI_SCTP_GET_PEER_ADDRS_NUM VKI_SCTP_GET_PEER_ADDRS_NUM 938 VKI_SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */ 939 #define VKI_SCTP_GET_PEER_ADDRS VKI_SCTP_GET_PEER_ADDRS 940 VKI_SCTP_GET_LOCAL_ADDRS_NUM, /* Get number of local addresss. */ 941 #define VKI_SCTP_GET_LOCAL_ADDRS_NUM VKI_SCTP_GET_LOCAL_ADDRS_NUM 942 VKI_SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */ 943 #define VKI_SCTP_GET_LOCAL_ADDRS VKI_SCTP_GET_LOCAL_ADDRS 944 VKI_SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */ 945 #define VKI_SCTP_SOCKOPT_CONNECTX VKI_SCTP_SOCKOPT_CONNECTX 946 }; 947 948 struct vki_sctp_getaddrs { 949 vki_sctp_assoc_t assoc_id; 950 int addr_num; 951 struct vki_sockaddr *addrs; 952 }; 953 954 //---------------------------------------------------------------------- 955 // From linux-2.6.8.1/include/linux/resource.h 956 //---------------------------------------------------------------------- 957 958 struct vki_rusage { 959 struct vki_timeval ru_utime; /* user time used */ 960 struct vki_timeval ru_stime; /* system time used */ 961 long ru_maxrss; /* maximum resident set size */ 962 long ru_ixrss; /* integral shared memory size */ 963 long ru_idrss; /* integral unshared data size */ 964 long ru_isrss; /* integral unshared stack size */ 965 long ru_minflt; /* page reclaims */ 966 long ru_majflt; /* page faults */ 967 long ru_nswap; /* swaps */ 968 long ru_inblock; /* block input operations */ 969 long ru_oublock; /* block output operations */ 970 long ru_msgsnd; /* messages sent */ 971 long ru_msgrcv; /* messages received */ 972 long ru_nsignals; /* signals received */ 973 long ru_nvcsw; /* voluntary context switches */ 974 long ru_nivcsw; /* involuntary " */ 975 }; 976 977 struct vki_rlimit { 978 unsigned long rlim_cur; 979 unsigned long rlim_max; 980 }; 981 982 struct vki_rlimit64 { 983 __vki_u64 rlim_cur; 984 __vki_u64 rlim_max; 985 }; 986 987 //---------------------------------------------------------------------- 988 // From linux-2.6.8.1/include/linux/elfcore.h 989 //---------------------------------------------------------------------- 990 991 struct vki_elf_siginfo 992 { 993 int si_signo; /* signal number */ 994 int si_code; /* extra code */ 995 int si_errno; /* errno */ 996 }; 997 998 // [[Removed some commented out lines here]] 999 struct vki_elf_prstatus 1000 { 1001 struct vki_elf_siginfo pr_info; /* Info associated with signal */ 1002 short pr_cursig; /* Current signal */ 1003 unsigned long pr_sigpend; /* Set of pending signals */ 1004 unsigned long pr_sighold; /* Set of held signals */ 1005 vki_pid_t pr_pid; 1006 vki_pid_t pr_ppid; 1007 vki_pid_t pr_pgrp; 1008 vki_pid_t pr_sid; 1009 struct vki_timeval pr_utime; /* User time */ 1010 struct vki_timeval pr_stime; /* System time */ 1011 struct vki_timeval pr_cutime; /* Cumulative user time */ 1012 struct vki_timeval pr_cstime; /* Cumulative system time */ 1013 vki_elf_gregset_t pr_reg; /* GP registers */ 1014 int pr_fpvalid; /* True if math co-processor being used. */ 1015 }; 1016 1017 #define VKI_ELF_PRARGSZ (80) /* Number of chars for args */ 1018 1019 struct vki_elf_prpsinfo 1020 { 1021 char pr_state; /* numeric process state */ 1022 char pr_sname; /* char for pr_state */ 1023 char pr_zomb; /* zombie */ 1024 char pr_nice; /* nice val */ 1025 unsigned long pr_flag; /* flags */ 1026 __vki_kernel_uid_t pr_uid; 1027 __vki_kernel_gid_t pr_gid; 1028 vki_pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; 1029 /* Lots missing */ 1030 char pr_fname[16]; /* filename of executable */ 1031 char pr_psargs[VKI_ELF_PRARGSZ]; /* initial part of arg list */ 1032 }; 1033 1034 //---------------------------------------------------------------------- 1035 // From linux-2.6.12.1/include/linux/eventpoll.h 1036 //---------------------------------------------------------------------- 1037 1038 /* Valid opcodes to issue to sys_epoll_ctl() */ 1039 #define VKI_EPOLL_CTL_ADD 1 1040 #define VKI_EPOLL_CTL_DEL 2 1041 #define VKI_EPOLL_CTL_MOD 3 1042 1043 #ifdef __x86_64__ 1044 #define VKI_EPOLL_PACKED __attribute__((packed)) 1045 #else 1046 #define VKI_EPOLL_PACKED 1047 #endif 1048 1049 struct vki_epoll_event { 1050 __vki_u32 events; 1051 __vki_u64 data; 1052 } VKI_EPOLL_PACKED; 1053 1054 1055 //---------------------------------------------------------------------- 1056 // From linux-2.6.8.1/include/linux/mqueue.h 1057 //---------------------------------------------------------------------- 1058 1059 struct vki_mq_attr { 1060 long mq_flags; /* message queue flags */ 1061 long mq_maxmsg; /* maximum number of messages */ 1062 long mq_msgsize; /* maximum message size */ 1063 long mq_curmsgs; /* number of messages currently queued */ 1064 long __reserved[4]; /* ignored for input, zeroed for output */ 1065 }; 1066 1067 //---------------------------------------------------------------------- 1068 // From linux-2.6.8.1/include/linux/utsname.h 1069 //---------------------------------------------------------------------- 1070 1071 struct vki_new_utsname { 1072 char sysname[65]; 1073 char nodename[65]; 1074 char release[65]; 1075 char version[65]; 1076 char machine[65]; 1077 char domainname[65]; 1078 }; 1079 1080 //---------------------------------------------------------------------- 1081 // From linux-2.6.8.1/include/linux/mii.h 1082 //---------------------------------------------------------------------- 1083 1084 /* This structure is used in all SIOCxMIIxxx ioctl calls */ 1085 struct vki_mii_ioctl_data { 1086 vki_u16 phy_id; 1087 vki_u16 reg_num; 1088 vki_u16 val_in; 1089 vki_u16 val_out; 1090 }; 1091 1092 //---------------------------------------------------------------------- 1093 // From linux-2.6.8.1/include/linux/capability.h 1094 //---------------------------------------------------------------------- 1095 1096 // [[capget()/capset() man page says this, ominously: 1097 // 1098 // The kernel API is likely to change and use of these functions (in 1099 // particular the format of the cap_user_*_t types) is subject to 1100 // change with each kernel revision. 1101 // 1102 // However, the format hasn't changed since at least Linux 2.4.6.]] 1103 1104 typedef struct __vki_user_cap_header_struct { 1105 __vki_u32 version; 1106 int pid; 1107 } __user *vki_cap_user_header_t; 1108 1109 typedef struct __vki_user_cap_data_struct { 1110 __vki_u32 effective; 1111 __vki_u32 permitted; 1112 __vki_u32 inheritable; 1113 } __user *vki_cap_user_data_t; 1114 1115 1116 //---------------------------------------------------------------------- 1117 // From linux-2.6.8.1/include/linux/module.h 1118 //---------------------------------------------------------------------- 1119 1120 // [[We do a VKI_SIZEOF_* here because this type is so big, and its size 1121 // depends on the word size, so see vki_arch.h]] 1122 1123 //---------------------------------------------------------------------- 1124 // From linux-2.6.8.1/include/linux/ipc.h 1125 //---------------------------------------------------------------------- 1126 1127 /* Obsolete, used only for backwards compatibility and libc5 compiles */ 1128 struct vki_ipc_perm 1129 { 1130 __vki_kernel_key_t key; 1131 __vki_kernel_uid_t uid; 1132 __vki_kernel_gid_t gid; 1133 __vki_kernel_uid_t cuid; 1134 __vki_kernel_gid_t cgid; 1135 __vki_kernel_mode_t mode; 1136 unsigned short seq; 1137 }; 1138 1139 #define VKI_IPC_CREAT 00001000 /* create if key is nonexistent */ 1140 #define VKI_IPC_EXCL 00002000 /* fail if key exists */ 1141 #define VKI_IPC_NOWAIT 00004000 /* return error on wait */ 1142 1143 //#define VKI_IPC_RMID 0 /* remove resource */ 1144 #define VKI_IPC_SET 1 /* set ipc_perm options */ 1145 #define VKI_IPC_STAT 2 /* get ipc_perm options */ 1146 #define VKI_IPC_INFO 3 /* see ipcs */ 1147 1148 #define VKI_IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger 1149 message sizes, etc. */ 1150 1151 //---------------------------------------------------------------------- 1152 // From linux-2.6.8.1/include/linux/sem.h 1153 //---------------------------------------------------------------------- 1154 1155 #define VKI_GETALL 13 /* get all semval's */ 1156 #define VKI_SETVAL 16 /* set semval */ 1157 #define VKI_SETALL 17 /* set all semval's */ 1158 1159 #define VKI_SEM_STAT 18 1160 #define VKI_SEM_INFO 19 1161 1162 /* Obsolete, used only for backwards compatibility and libc5 compiles */ 1163 struct vki_semid_ds { 1164 struct vki_ipc_perm sem_perm; /* permissions .. see ipc.h */ 1165 __vki_kernel_time_t sem_otime; /* last semop time */ 1166 __vki_kernel_time_t sem_ctime; /* last change time */ 1167 // [[Use void* to avoid excess header copying]] 1168 void/*struct sem */*sem_base; /* ptr to first semaphore in array */ 1169 void/*struct sem_queue */*sem_pending; /* pending operations to be processed */ 1170 void/*struct sem_queue */**sem_pending_last; /* last pending operation */ 1171 void/*struct sem_undo */*undo; /* undo requests on this array */ 1172 unsigned short sem_nsems; /* no. of semaphores in array */ 1173 }; 1174 1175 struct vki_sembuf { 1176 unsigned short sem_num; /* semaphore index in array */ 1177 short sem_op; /* semaphore operation */ 1178 short sem_flg; /* operation flags */ 1179 }; 1180 1181 union vki_semun { 1182 int val; /* value for SETVAL */ 1183 struct vki_semid_ds __user *buf; /* buffer for IPC_STAT & IPC_SET */ 1184 unsigned short __user *array; /* array for GETALL & SETALL */ 1185 struct vki_seminfo __user *__buf; /* buffer for IPC_INFO */ 1186 void __user *__pad; 1187 }; 1188 1189 struct vki_seminfo { 1190 int semmap; 1191 int semmni; 1192 int semmns; 1193 int semmnu; 1194 int semmsl; 1195 int semopm; 1196 int semume; 1197 int semusz; 1198 int semvmx; 1199 int semaem; 1200 }; 1201 1202 //---------------------------------------------------------------------- 1203 // From linux-2.6.8.1/include/asm-generic/errno-base.h 1204 //---------------------------------------------------------------------- 1205 1206 #define VKI_EPERM 1 /* Operation not permitted */ 1207 #define VKI_ENOENT 2 /* No such file or directory */ 1208 #define VKI_ESRCH 3 /* No such process */ 1209 #define VKI_EINTR 4 /* Interrupted system call */ 1210 #define VKI_EIO 5 /* I/O error */ 1211 #define VKI_ENXIO 6 /* No such device or address */ 1212 #define VKI_E2BIG 7 /* Argument list too long */ 1213 #define VKI_ENOEXEC 8 /* Exec format error */ 1214 #define VKI_EBADF 9 /* Bad file number */ 1215 #define VKI_ECHILD 10 /* No child processes */ 1216 #define VKI_EAGAIN 11 /* Try again */ 1217 #define VKI_ENOMEM 12 /* Out of memory */ 1218 #define VKI_EACCES 13 /* Permission denied */ 1219 #define VKI_EFAULT 14 /* Bad address */ 1220 #define VKI_ENOTBLK 15 /* Block device required */ 1221 #define VKI_EBUSY 16 /* Device or resource busy */ 1222 #define VKI_EEXIST 17 /* File exists */ 1223 #define VKI_EXDEV 18 /* Cross-device link */ 1224 #define VKI_ENODEV 19 /* No such device */ 1225 #define VKI_ENOTDIR 20 /* Not a directory */ 1226 #define VKI_EISDIR 21 /* Is a directory */ 1227 #define VKI_EINVAL 22 /* Invalid argument */ 1228 #define VKI_ENFILE 23 /* File table overflow */ 1229 #define VKI_EMFILE 24 /* Too many open files */ 1230 #define VKI_ENOTTY 25 /* Not a typewriter */ 1231 #define VKI_ETXTBSY 26 /* Text file busy */ 1232 #define VKI_EFBIG 27 /* File too large */ 1233 #define VKI_ENOSPC 28 /* No space left on device */ 1234 #define VKI_ESPIPE 29 /* Illegal seek */ 1235 #define VKI_EROFS 30 /* Read-only file system */ 1236 #define VKI_EMLINK 31 /* Too many links */ 1237 #define VKI_EPIPE 32 /* Broken pipe */ 1238 #define VKI_EDOM 33 /* Math argument out of domain of func */ 1239 #define VKI_ERANGE 34 /* Math result not representable */ 1240 1241 //---------------------------------------------------------------------- 1242 // From linux-2.6.8.1/include/asm-generic/errno.h 1243 //---------------------------------------------------------------------- 1244 1245 #define VKI_EWOULDBLOCK VKI_EAGAIN 1246 1247 //---------------------------------------------------------------------- 1248 // From linux-2.6.8.1/include/linux/wait.h 1249 //---------------------------------------------------------------------- 1250 1251 #define VKI_WNOHANG 0x00000001 1252 1253 #define __VKI_WALL 0x40000000 /* Wait on all children, regardless of type */ 1254 #define __VKI_WCLONE 0x80000000 /* Wait only on non-SIGCHLD children */ 1255 1256 //---------------------------------------------------------------------- 1257 // From linux-2.6.8.1/include/linux/mman.h 1258 //---------------------------------------------------------------------- 1259 1260 #define VKI_MREMAP_MAYMOVE 1 1261 #define VKI_MREMAP_FIXED 2 1262 1263 //---------------------------------------------------------------------- 1264 // From linux-2.6.31-rc4/include/linux/futex.h 1265 //---------------------------------------------------------------------- 1266 1267 #define VKI_FUTEX_WAIT (0) 1268 #define VKI_FUTEX_WAKE (1) 1269 #define VKI_FUTEX_FD (2) 1270 #define VKI_FUTEX_REQUEUE (3) 1271 #define VKI_FUTEX_CMP_REQUEUE (4) 1272 #define VKI_FUTEX_WAKE_OP (5) 1273 #define VKI_FUTEX_LOCK_PI (6) 1274 #define VKI_FUTEX_UNLOCK_PI (7) 1275 #define VKI_FUTEX_TRYLOCK_PI (8) 1276 #define VKI_FUTEX_WAIT_BITSET (9) 1277 #define VKI_FUTEX_WAKE_BITSET (10) 1278 #define VKI_FUTEX_WAIT_REQUEUE_PI (11) 1279 #define VKI_FUTEX_CMP_REQUEUE_PI (12) 1280 #define VKI_FUTEX_PRIVATE_FLAG (128) 1281 #define VKI_FUTEX_CLOCK_REALTIME (256) 1282 1283 struct vki_robust_list { 1284 struct vki_robust_list __user *next; 1285 }; 1286 1287 struct vki_robust_list_head { 1288 /* 1289 * The head of the list. Points back to itself if empty: 1290 */ 1291 struct vki_robust_list list; 1292 1293 /* 1294 * This relative offset is set by user-space, it gives the kernel 1295 * the relative position of the futex field to examine. This way 1296 * we keep userspace flexible, to freely shape its data-structure, 1297 * without hardcoding any particular offset into the kernel: 1298 */ 1299 long futex_offset; 1300 1301 /* 1302 * The death of the thread may race with userspace setting 1303 * up a lock's links. So to handle this race, userspace first 1304 * sets this field to the address of the to-be-taken lock, 1305 * then does the lock acquire, and then adds itself to the 1306 * list, and then clears this field. Hence the kernel will 1307 * always have full knowledge of all locks that the thread 1308 * _might_ have taken. We check the owner TID in any case, 1309 * so only truly owned locks will be handled. 1310 */ 1311 struct vki_robust_list __user *list_op_pending; 1312 }; 1313 1314 //---------------------------------------------------------------------- 1315 // From linux-2.6.8.1/include/linux/errno.h 1316 //---------------------------------------------------------------------- 1317 1318 #define VKI_ERESTARTSYS 512 1319 1320 //---------------------------------------------------------------------- 1321 // From linux-2.6.8.1/include/linux/stat.h 1322 //---------------------------------------------------------------------- 1323 1324 #define VKI_S_IFMT 00170000 1325 #define VKI_S_IFSOCK 0140000 1326 #define VKI_S_IFLNK 0120000 1327 #define VKI_S_IFREG 0100000 1328 #define VKI_S_IFBLK 0060000 1329 #define VKI_S_IFDIR 0040000 1330 #define VKI_S_IFCHR 0020000 1331 #define VKI_S_IFIFO 0010000 1332 #define VKI_S_ISUID 0004000 1333 #define VKI_S_ISGID 0002000 1334 #define VKI_S_ISVTX 0001000 1335 1336 #define VKI_S_ISLNK(m) (((m) & VKI_S_IFMT) == VKI_S_IFLNK) 1337 #define VKI_S_ISREG(m) (((m) & VKI_S_IFMT) == VKI_S_IFREG) 1338 #define VKI_S_ISDIR(m) (((m) & VKI_S_IFMT) == VKI_S_IFDIR) 1339 #define VKI_S_ISCHR(m) (((m) & VKI_S_IFMT) == VKI_S_IFCHR) 1340 #define VKI_S_ISBLK(m) (((m) & VKI_S_IFMT) == VKI_S_IFBLK) 1341 #define VKI_S_ISFIFO(m) (((m) & VKI_S_IFMT) == VKI_S_IFIFO) 1342 #define VKI_S_ISSOCK(m) (((m) & VKI_S_IFMT) == VKI_S_IFSOCK) 1343 1344 #define VKI_S_IRWXU 00700 1345 #define VKI_S_IRUSR 00400 1346 #define VKI_S_IWUSR 00200 1347 #define VKI_S_IXUSR 00100 1348 1349 #define VKI_S_IRWXG 00070 1350 #define VKI_S_IRGRP 00040 1351 #define VKI_S_IWGRP 00020 1352 #define VKI_S_IXGRP 00010 1353 1354 #define VKI_S_IRWXO 00007 1355 #define VKI_S_IROTH 00004 1356 #define VKI_S_IWOTH 00002 1357 #define VKI_S_IXOTH 00001 1358 1359 //---------------------------------------------------------------------- 1360 // From linux-2.6.8.1/include/linux/dirent.h 1361 //---------------------------------------------------------------------- 1362 1363 struct vki_dirent { 1364 long d_ino; 1365 __vki_kernel_off_t d_off; 1366 unsigned short d_reclen; 1367 char d_name[256]; /* We must not include limits.h! */ 1368 }; 1369 1370 //---------------------------------------------------------------------- 1371 // From linux-2.6.8.1/include/linux/fcntl.h 1372 //---------------------------------------------------------------------- 1373 1374 #define VKI_F_SETLEASE (VKI_F_LINUX_SPECIFIC_BASE + 0) 1375 #define VKI_F_GETLEASE (VKI_F_LINUX_SPECIFIC_BASE + 1) 1376 1377 #define VKI_F_CANCELLK (VKI_F_LINUX_SPECIFIC_BASE + 5) 1378 1379 #define VKI_F_DUPFD_CLOEXEC (VKI_F_LINUX_SPECIFIC_BASE + 6) 1380 1381 #define VKI_F_NOTIFY (VKI_F_LINUX_SPECIFIC_BASE + 2) 1382 1383 #define VKI_F_SETPIPE_SZ (VKI_F_LINUX_SPECIFIC_BASE + 7) 1384 #define VKI_F_GETPIPE_SZ (VKI_F_LINUX_SPECIFIC_BASE + 8) 1385 1386 //---------------------------------------------------------------------- 1387 // From linux-2.6.8.1/include/linux/sysctl.h 1388 //---------------------------------------------------------------------- 1389 1390 struct __vki_sysctl_args { 1391 int __user *name; 1392 int nlen; 1393 void __user *oldval; 1394 vki_size_t __user *oldlenp; 1395 void __user *newval; 1396 vki_size_t newlen; 1397 unsigned long __unused[4]; 1398 }; 1399 1400 //---------------------------------------------------------------------- 1401 // From linux-2.6.8.1/include/linux/aio_abi.h 1402 //---------------------------------------------------------------------- 1403 1404 typedef unsigned long vki_aio_context_t; 1405 1406 enum { 1407 VKI_IOCB_CMD_PREAD = 0, 1408 VKI_IOCB_CMD_PWRITE = 1, 1409 VKI_IOCB_CMD_FSYNC = 2, 1410 VKI_IOCB_CMD_FDSYNC = 3, 1411 VKI_IOCB_CMD_PREADV = 7, 1412 VKI_IOCB_CMD_PWRITEV = 8, 1413 }; 1414 1415 /* read() from /dev/aio returns these structures. */ 1416 struct vki_io_event { 1417 __vki_u64 data; /* the data field from the iocb */ 1418 __vki_u64 obj; /* what iocb this event came from */ 1419 // [[Nb: These fields renamed from 'res' and 'res2' because 'res' is 1420 // a macro in vg_syscalls.c!]] 1421 __vki_s64 result; /* result code for this event */ 1422 __vki_s64 result2; /* secondary result */ 1423 }; 1424 1425 #if defined(VKI_LITTLE_ENDIAN) 1426 # define VKI_PADDED(x,y) x, y 1427 #elif defined(VKI_BIG_ENDIAN) 1428 # define VKI_PADDED(x,y) y, x 1429 #else 1430 #error edit for your odd byteorder. 1431 #endif 1432 1433 struct vki_iocb { 1434 /* these are internal to the kernel/libc. */ 1435 __vki_u64 aio_data; /* data to be returned in event's data */ 1436 __vki_u32 VKI_PADDED(aio_key, aio_reserved1); 1437 /* the kernel sets aio_key to the req # */ 1438 1439 /* common fields */ 1440 __vki_u16 aio_lio_opcode; /* see IOCB_CMD_ above */ 1441 __vki_s16 aio_reqprio; 1442 __vki_u32 aio_fildes; 1443 1444 __vki_u64 aio_buf; 1445 __vki_u64 aio_nbytes; 1446 __vki_s64 aio_offset; 1447 1448 /* extra parameters */ 1449 __vki_u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */ 1450 __vki_u64 aio_reserved3; 1451 }; /* 64 bytes */ 1452 1453 //---------------------------------------------------------------------- 1454 // From linux-2.6.8.1/include/linux/aio.h 1455 //---------------------------------------------------------------------- 1456 1457 struct vki_aio_ring { 1458 unsigned id; /* kernel internal index number */ 1459 unsigned nr; /* number of io_events */ 1460 unsigned head; 1461 unsigned tail; 1462 1463 unsigned magic; 1464 unsigned compat_features; 1465 unsigned incompat_features; 1466 unsigned header_length; /* size of aio_ring */ 1467 1468 struct vki_io_event io_events[0]; 1469 }; /* 128 bytes + ring size */ 1470 1471 //---------------------------------------------------------------------- 1472 // From linux-2.6.8.1/include/linux/msg.h 1473 //---------------------------------------------------------------------- 1474 1475 #define VKI_MSG_STAT 11 1476 #define VKI_MSG_INFO 12 1477 1478 struct vki_msqid_ds { 1479 struct vki_ipc_perm msg_perm; 1480 struct vki_msg *msg_first; /* first message on queue,unused */ 1481 struct vki_msg *msg_last; /* last message in queue,unused */ 1482 __vki_kernel_time_t msg_stime; /* last msgsnd time */ 1483 __vki_kernel_time_t msg_rtime; /* last msgrcv time */ 1484 __vki_kernel_time_t msg_ctime; /* last change time */ 1485 unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */ 1486 unsigned long msg_lqbytes; /* ditto */ 1487 unsigned short msg_cbytes; /* current number of bytes on queue */ 1488 unsigned short msg_qnum; /* number of messages in queue */ 1489 unsigned short msg_qbytes; /* max number of bytes on queue */ 1490 __vki_kernel_ipc_pid_t msg_lspid; /* pid of last msgsnd */ 1491 __vki_kernel_ipc_pid_t msg_lrpid; /* last receive pid */ 1492 }; 1493 1494 struct vki_msgbuf { 1495 long mtype; /* type of message */ 1496 char mtext[1]; /* message text */ 1497 }; 1498 1499 struct vki_msginfo { 1500 int msgpool; 1501 int msgmap; 1502 int msgmax; 1503 int msgmnb; 1504 int msgmni; 1505 int msgssz; 1506 int msgtql; 1507 unsigned short msgseg; 1508 }; 1509 1510 //---------------------------------------------------------------------- 1511 // From linux-2.6.8.1/include/linux/shm.h 1512 //---------------------------------------------------------------------- 1513 1514 struct vki_shmid_ds { 1515 struct vki_ipc_perm shm_perm; /* operation perms */ 1516 int shm_segsz; /* size of segment (bytes) */ 1517 __vki_kernel_time_t shm_atime; /* last attach time */ 1518 __vki_kernel_time_t shm_dtime; /* last detach time */ 1519 __vki_kernel_time_t shm_ctime; /* last change time */ 1520 __vki_kernel_ipc_pid_t shm_cpid; /* pid of creator */ 1521 __vki_kernel_ipc_pid_t shm_lpid; /* pid of last operator */ 1522 unsigned short shm_nattch; /* no. of current attaches */ 1523 unsigned short shm_unused; /* compatibility */ 1524 void *shm_unused2; /* ditto - used by DIPC */ 1525 void *shm_unused3; /* unused */ 1526 }; 1527 1528 #define VKI_SHM_RDONLY 010000 /* read-only access */ 1529 #define VKI_SHM_RND 020000 /* round attach address to SHMLBA boundary */ 1530 1531 #define VKI_SHM_STAT 13 1532 #define VKI_SHM_INFO 14 1533 1534 /* Obsolete, used only for backwards compatibility */ 1535 struct vki_shminfo { 1536 int shmmax; 1537 int shmmin; 1538 int shmmni; 1539 int shmseg; 1540 int shmall; 1541 }; 1542 1543 struct vki_shm_info { 1544 int used_ids; 1545 unsigned long shm_tot; /* total allocated shm */ 1546 unsigned long shm_rss; /* total resident shm */ 1547 unsigned long shm_swp; /* total swapped shm */ 1548 unsigned long swap_attempts; 1549 unsigned long swap_successes; 1550 }; 1551 1552 //---------------------------------------------------------------------- 1553 // From linux-2.6.8.1/include/linux/rtc.h 1554 //---------------------------------------------------------------------- 1555 1556 struct vki_rtc_time { 1557 int tm_sec; 1558 int tm_min; 1559 int tm_hour; 1560 int tm_mday; 1561 int tm_mon; 1562 int tm_year; 1563 int tm_wday; 1564 int tm_yday; 1565 int tm_isdst; 1566 }; 1567 1568 #define VKI_RTC_AIE_ON _VKI_IO('p', 0x01) /* Alarm int. enable on */ 1569 #define VKI_RTC_AIE_OFF _VKI_IO('p', 0x02) /* ... off */ 1570 #define VKI_RTC_UIE_ON _VKI_IO('p', 0x03) /* Update int. enable on*/ 1571 #define VKI_RTC_UIE_OFF _VKI_IO('p', 0x04) /* ... off */ 1572 #define VKI_RTC_PIE_ON _VKI_IO('p', 0x05) /* Periodic int. enable on*/ 1573 #define VKI_RTC_PIE_OFF _VKI_IO('p', 0x06) /* ... off */ 1574 1575 #define VKI_RTC_ALM_SET _VKI_IOW('p', 0x07, struct vki_rtc_time) /* Set alarm time */ 1576 #define VKI_RTC_ALM_READ _VKI_IOR('p', 0x08, struct vki_rtc_time) /* Read alarm time */ 1577 #define VKI_RTC_RD_TIME _VKI_IOR('p', 0x09, struct vki_rtc_time) /* Read RTC time */ 1578 //#define RTC_SET_TIME _IOW('p', 0x0a, struct rtc_time) /* Set RTC time */ 1579 #define VKI_RTC_IRQP_READ _VKI_IOR('p', 0x0b, unsigned long) /* Read IRQ rate */ 1580 #define VKI_RTC_IRQP_SET _VKI_IOW('p', 0x0c, unsigned long) /* Set IRQ rate */ 1581 1582 //---------------------------------------------------------------------- 1583 // From linux-2.6.8.1/include/linux/isdn.h 1584 //---------------------------------------------------------------------- 1585 1586 // [[Nb: Resolved this for the common case where CONFIG_COBALT_MICRO_SERVER 1587 // is not defined]] 1588 #define VKI_ISDN_MAX_CHANNELS 64 1589 1590 #define VKI_IIOCGETCPS _VKI_IO('I',21) 1591 1592 #define VKI_IIOCNETGPN _VKI_IO('I',34) 1593 1594 #define VKI_ISDN_MSNLEN 32 1595 1596 typedef struct { 1597 char name[10]; 1598 char phone[VKI_ISDN_MSNLEN]; 1599 int outgoing; 1600 } vki_isdn_net_ioctl_phone; 1601 1602 //---------------------------------------------------------------------- 1603 // From linux-2.6.8.1/include/linux/sockios.h 1604 //---------------------------------------------------------------------- 1605 1606 #define VKI_SIOCOUTQ VKI_TIOCOUTQ 1607 1608 #define VKI_SIOCADDRT 0x890B /* add routing table entry */ 1609 #define VKI_SIOCDELRT 0x890C /* delete routing table entry */ 1610 1611 #define VKI_SIOCGIFNAME 0x8910 /* get iface name */ 1612 #define VKI_SIOCGIFCONF 0x8912 /* get iface list */ 1613 #define VKI_SIOCGIFFLAGS 0x8913 /* get flags */ 1614 #define VKI_SIOCSIFFLAGS 0x8914 /* set flags */ 1615 #define VKI_SIOCGIFADDR 0x8915 /* get PA address */ 1616 #define VKI_SIOCSIFADDR 0x8916 /* set PA address */ 1617 #define VKI_SIOCGIFDSTADDR 0x8917 /* get remote PA address */ 1618 #define VKI_SIOCSIFDSTADDR 0x8918 /* set remote PA address */ 1619 #define VKI_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */ 1620 #define VKI_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */ 1621 #define VKI_SIOCGIFNETMASK 0x891b /* get network PA mask */ 1622 #define VKI_SIOCSIFNETMASK 0x891c /* set network PA mask */ 1623 #define VKI_SIOCGIFMETRIC 0x891d /* get metric */ 1624 #define VKI_SIOCSIFMETRIC 0x891e /* set metric */ 1625 #define VKI_SIOCGIFMTU 0x8921 /* get MTU size */ 1626 #define VKI_SIOCSIFMTU 0x8922 /* set MTU size */ 1627 #define VKI_SIOCSIFHWADDR 0x8924 /* set hardware address */ 1628 #define VKI_SIOCGIFHWADDR 0x8927 /* Get hardware address */ 1629 #define VKI_SIOCGIFINDEX 0x8933 /* name -> if_index mapping */ 1630 1631 #define VKI_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */ 1632 #define VKI_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */ 1633 1634 #define VKI_SIOCGMIIPHY 0x8947 /* Get address of MII PHY in use. */ 1635 #define VKI_SIOCGMIIREG 0x8948 /* Read MII PHY register. */ 1636 #define VKI_SIOCSMIIREG 0x8949 /* Write MII PHY register. */ 1637 1638 #define VKI_SIOCDARP 0x8953 /* delete ARP table entry */ 1639 #define VKI_SIOCGARP 0x8954 /* get ARP table entry */ 1640 #define VKI_SIOCSARP 0x8955 /* set ARP table entry */ 1641 1642 #define VKI_SIOCDRARP 0x8960 /* delete RARP table entry */ 1643 #define VKI_SIOCGRARP 0x8961 /* get RARP table entry */ 1644 #define VKI_SIOCSRARP 0x8962 /* set RARP table entry */ 1645 1646 #define VKI_SIOCGIFMAP 0x8970 /* Get device parameters */ 1647 #define VKI_SIOCSIFMAP 0x8971 /* Set device parameters */ 1648 1649 #define VKI_SIOCSHWTSTAMP 0x89B0 /* Set hardware time stamping */ 1650 1651 //---------------------------------------------------------------------- 1652 // From linux-2.6.8.1/include/linux/ppdev.h 1653 //---------------------------------------------------------------------- 1654 1655 #define VKI_PP_MAJOR 99 1656 1657 #define VKI_PP_IOCTL 'p' 1658 1659 /* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */ 1660 #define VKI_PPSETMODE _VKI_IOW(VKI_PP_IOCTL, 0x80, int) 1661 1662 /* Read status */ 1663 #define VKI_PPRSTATUS _VKI_IOR(VKI_PP_IOCTL, 0x81, unsigned char) 1664 //#define PPWSTATUS OBSOLETE__IOW(PP_IOCTL, 0x82, unsigned char) 1665 1666 /* Read/write control */ 1667 #define VKI_PPRCONTROL _VKI_IOR(VKI_PP_IOCTL, 0x83, unsigned char) 1668 #define VKI_PPWCONTROL _VKI_IOW(VKI_PP_IOCTL, 0x84, unsigned char) 1669 1670 struct vki_ppdev_frob_struct { 1671 unsigned char mask; 1672 unsigned char val; 1673 }; 1674 #define VKI_PPFCONTROL _VKI_IOW(VKI_PP_IOCTL, 0x8e, struct vki_ppdev_frob_struct) 1675 1676 /* Read/write data */ 1677 #define VKI_PPRDATA _VKI_IOR(VKI_PP_IOCTL, 0x85, unsigned char) 1678 #define VKI_PPWDATA _VKI_IOW(VKI_PP_IOCTL, 0x86, unsigned char) 1679 1680 /* Claim the port to start using it */ 1681 #define VKI_PPCLAIM _VKI_IO(VKI_PP_IOCTL, 0x8b) 1682 1683 /* Release the port when you aren't using it */ 1684 #define VKI_PPRELEASE _VKI_IO(VKI_PP_IOCTL, 0x8c) 1685 1686 /* Yield the port (release it if another driver is waiting, 1687 * then reclaim) */ 1688 #define VKI_PPYIELD _VKI_IO(VKI_PP_IOCTL, 0x8d) 1689 1690 /* Register device exclusively (must be before PPCLAIM). */ 1691 #define VKI_PPEXCL _VKI_IO(VKI_PP_IOCTL, 0x8f) 1692 1693 /* Data line direction: non-zero for input mode. */ 1694 #define VKI_PPDATADIR _VKI_IOW(VKI_PP_IOCTL, 0x90, int) 1695 1696 /* Negotiate a particular IEEE 1284 mode. */ 1697 #define VKI_PPNEGOT _VKI_IOW(VKI_PP_IOCTL, 0x91, int) 1698 1699 /* Set control lines when an interrupt occurs. */ 1700 #define VKI_PPWCTLONIRQ _VKI_IOW(VKI_PP_IOCTL, 0x92, unsigned char) 1701 1702 /* Clear (and return) interrupt count. */ 1703 #define VKI_PPCLRIRQ _VKI_IOR(VKI_PP_IOCTL, 0x93, int) 1704 1705 /* Set the IEEE 1284 phase that we're in (e.g. IEEE1284_PH_FWD_IDLE) */ 1706 #define VKI_PPSETPHASE _VKI_IOW(VKI_PP_IOCTL, 0x94, int) 1707 1708 /* Set and get port timeout (struct timeval's) */ 1709 #define VKI_PPGETTIME _VKI_IOR(VKI_PP_IOCTL, 0x95, struct vki_timeval) 1710 #define VKI_PPSETTIME _VKI_IOW(VKI_PP_IOCTL, 0x96, struct vki_timeval) 1711 1712 #define VKI_PPGETMODES _VKI_IOR(VKI_PP_IOCTL, 0x97, unsigned int) 1713 1714 #define VKI_PPGETMODE _VKI_IOR(VKI_PP_IOCTL, 0x98, int) 1715 #define VKI_PPGETPHASE _VKI_IOR(VKI_PP_IOCTL, 0x99, int) 1716 1717 #define VKI_PPGETFLAGS _VKI_IOR(VKI_PP_IOCTL, 0x9a, int) 1718 #define VKI_PPSETFLAGS _VKI_IOW(VKI_PP_IOCTL, 0x9b, int) 1719 1720 //---------------------------------------------------------------------- 1721 // From linux-2.6.8.1/include/linux/fs.h 1722 //---------------------------------------------------------------------- 1723 1724 #define VKI_BLKROSET _VKI_IO(0x12,93) /* set device read-only (0 = read-write) */ 1725 #define VKI_BLKROGET _VKI_IO(0x12,94) /* get read-only status (0 = read_write) */ 1726 #define VKI_BLKGETSIZE _VKI_IO(0x12,96) /* return device size /512 (long *arg) */ 1727 #define VKI_BLKRASET _VKI_IO(0x12,98) /* set read ahead for block device */ 1728 #define VKI_BLKRAGET _VKI_IO(0x12,99) /* get current read ahead setting */ 1729 #define VKI_BLKFRASET _VKI_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ 1730 #define VKI_BLKFRAGET _VKI_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ 1731 #define VKI_BLKSECTGET _VKI_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ 1732 #define VKI_BLKSSZGET _VKI_IO(0x12,104)/* get block device sector size */ 1733 #define VKI_BLKBSZGET _VKI_IOR(0x12,112,vki_size_t) 1734 #define VKI_BLKBSZSET _VKI_IOW(0x12,113,vki_size_t) 1735 #define VKI_BLKGETSIZE64 _VKI_IOR(0x12,114,vki_size_t) /* return device size in bytes (u64 *arg) */ 1736 #define VKI_BLKPBSZGET _VKI_IO(0x12,123) 1737 1738 #define VKI_FIBMAP _VKI_IO(0x00,1) /* bmap access */ 1739 #define VKI_FIGETBSZ _VKI_IO(0x00,2) /* get the block size used for bmap */ 1740 1741 //---------------------------------------------------------------------- 1742 // From linux-2.6.8.1/include/scsi/sg.h 1743 //---------------------------------------------------------------------- 1744 1745 typedef struct vki_sg_io_hdr 1746 { 1747 int interface_id; /* [i] 'S' for SCSI generic (required) */ 1748 int dxfer_direction; /* [i] data transfer direction */ 1749 unsigned char cmd_len; /* [i] SCSI command length ( <= 16 bytes) */ 1750 unsigned char mx_sb_len; /* [i] max length to write to sbp */ 1751 unsigned short iovec_count; /* [i] 0 implies no scatter gather */ 1752 unsigned int dxfer_len; /* [i] byte count of data transfer */ 1753 void __user *dxferp; /* [i], [*io] points to data transfer memory 1754 or scatter gather list */ 1755 unsigned char __user *cmdp; /* [i], [*i] points to command to perform */ 1756 void __user *sbp; /* [i], [*o] points to sense_buffer memory */ 1757 unsigned int timeout; /* [i] MAX_UINT->no timeout (unit: millisec) */ 1758 unsigned int flags; /* [i] 0 -> default, see SG_FLAG... */ 1759 int pack_id; /* [i->o] unused internally (normally) */ 1760 void __user * usr_ptr; /* [i->o] unused internally */ 1761 unsigned char status; /* [o] scsi status */ 1762 unsigned char masked_status;/* [o] shifted, masked scsi status */ 1763 unsigned char msg_status; /* [o] messaging level data (optional) */ 1764 unsigned char sb_len_wr; /* [o] byte count actually written to sbp */ 1765 unsigned short host_status; /* [o] errors from host adapter */ 1766 unsigned short driver_status;/* [o] errors from software driver */ 1767 int resid; /* [o] dxfer_len - actual_transferred */ 1768 unsigned int duration; /* [o] time taken by cmd (unit: millisec) */ 1769 unsigned int info; /* [o] auxiliary information */ 1770 } vki_sg_io_hdr_t; /* 64 bytes long (on i386) */ 1771 1772 typedef struct vki_sg_scsi_id { /* used by SG_GET_SCSI_ID ioctl() */ 1773 int host_no; /* as in "scsi<n>" where 'n' is one of 0, 1, 2 etc */ 1774 int channel; 1775 int scsi_id; /* scsi id of target device */ 1776 int lun; 1777 int scsi_type; /* TYPE_... defined in scsi/scsi.h */ 1778 short h_cmd_per_lun;/* host (adapter) maximum commands per lun */ 1779 short d_queue_depth;/* device (or adapter) maximum queue length */ 1780 int unused[2]; /* probably find a good use, set 0 for now */ 1781 } vki_sg_scsi_id_t; /* 32 bytes long on i386 */ 1782 1783 #define VKI_SG_EMULATED_HOST 0x2203 /* true for emulated host adapter (ATAPI) */ 1784 1785 #define VKI_SG_SET_RESERVED_SIZE 0x2275 /* request a new reserved buffer size */ 1786 #define VKI_SG_GET_RESERVED_SIZE 0x2272 /* actual size of reserved buffer */ 1787 1788 #define VKI_SG_GET_SCSI_ID 0x2276 /* Yields fd's bus, chan, dev, lun + type */ 1789 1790 #define VKI_SG_GET_SG_TABLESIZE 0x227F /* 0 implies can't do scatter gather */ 1791 1792 #define VKI_SG_GET_VERSION_NUM 0x2282 /* Example: version 2.1.34 yields 20134 */ 1793 1794 #define VKI_SG_IO 0x2285 /* similar effect as write() followed by read() */ 1795 1796 #define VKI_SG_SET_TIMEOUT 0x2201 /* unit: jiffies (10ms on i386) */ 1797 #define VKI_SG_GET_TIMEOUT 0x2202 /* yield timeout as _return_ value */ 1798 1799 //#define SG_GET_COMMAND_Q 0x2270 /* Yields 0 (queuing off) or 1 (on) */ 1800 #define VKI_SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1 */ 1801 1802 //---------------------------------------------------------------------- 1803 // From linux-2.6.34/include/scsi/scsi.h and scsi/scsi_ioctl.h 1804 //---------------------------------------------------------------------- 1805 1806 #define VKI_SCSI_IOCTL_DOORLOCK 0x5380 /* Lock the eject mechanism. */ 1807 #define VKI_SCSI_IOCTL_DOORUNLOCK 0x5381 /* Unlock the mechanism. */ 1808 #define VKI_SCSI_IOCTL_GET_IDLUN 0x5382 1809 #define VKI_SCSI_IOCTL_GET_BUS_NUMBER 0x5386 1810 1811 struct vki_scsi_idlun { 1812 __vki_u32 dev_id; 1813 __vki_u32 host_unique_id; 1814 }; 1815 1816 //---------------------------------------------------------------------- 1817 // From linux-2.6.8.1/include/linux/cdrom.h 1818 //---------------------------------------------------------------------- 1819 1820 #define VKI_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */ 1821 #define VKI_CDROMREADTOCHDR 0x5305 /* Read TOC header 1822 (struct cdrom_tochdr) */ 1823 #define VKI_CDROMREADTOCENTRY 0x5306 /* Read TOC entry 1824 (struct cdrom_tocentry) */ 1825 #define VKI_CDROMSUBCHNL 0x530b /* Read subchannel data 1826 (struct cdrom_subchnl) */ 1827 #define VKI_CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes) 1828 (struct cdrom_read) */ 1829 #define VKI_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */ 1830 #define VKI_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session 1831 address of multi session disks 1832 (struct cdrom_multisession) */ 1833 #define VKI_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 1834 if available (struct cdrom_mcn) */ 1835 #define VKI_CDROMVOLREAD 0x5313 /* Get the drive's volume setting 1836 (struct cdrom_volctrl) */ 1837 #define VKI_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes) 1838 (struct cdrom_read) */ 1839 #define VKI_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */ 1840 #define VKI_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */ 1841 #define VKI_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ 1842 1843 #define VKI_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */ 1844 1845 struct vki_cdrom_msf0 1846 { 1847 __vki_u8 minute; 1848 __vki_u8 second; 1849 __vki_u8 frame; 1850 }; 1851 1852 union vki_cdrom_addr 1853 { 1854 struct vki_cdrom_msf0 msf; 1855 int lba; 1856 }; 1857 1858 struct vki_cdrom_msf 1859 { 1860 __vki_u8 cdmsf_min0; /* start minute */ 1861 __vki_u8 cdmsf_sec0; /* start second */ 1862 __vki_u8 cdmsf_frame0; /* start frame */ 1863 __vki_u8 cdmsf_min1; /* end minute */ 1864 __vki_u8 cdmsf_sec1; /* end second */ 1865 __vki_u8 cdmsf_frame1; /* end frame */ 1866 }; 1867 1868 struct vki_cdrom_tochdr 1869 { 1870 __vki_u8 cdth_trk0; /* start track */ 1871 __vki_u8 cdth_trk1; /* end track */ 1872 }; 1873 1874 struct vki_cdrom_volctrl 1875 { 1876 __vki_u8 channel0; 1877 __vki_u8 channel1; 1878 __vki_u8 channel2; 1879 __vki_u8 channel3; 1880 }; 1881 1882 struct vki_cdrom_subchnl 1883 { 1884 __vki_u8 cdsc_format; 1885 __vki_u8 cdsc_audiostatus; 1886 __vki_u8 cdsc_adr: 4; 1887 __vki_u8 cdsc_ctrl: 4; 1888 __vki_u8 cdsc_trk; 1889 __vki_u8 cdsc_ind; 1890 union vki_cdrom_addr cdsc_absaddr; 1891 union vki_cdrom_addr cdsc_reladdr; 1892 }; 1893 1894 struct vki_cdrom_tocentry 1895 { 1896 __vki_u8 cdte_track; 1897 __vki_u8 cdte_adr :4; 1898 __vki_u8 cdte_ctrl :4; 1899 __vki_u8 cdte_format; 1900 union vki_cdrom_addr cdte_addr; 1901 __vki_u8 cdte_datamode; 1902 }; 1903 1904 struct vki_cdrom_read 1905 { 1906 int cdread_lba; 1907 char *cdread_bufaddr; 1908 int cdread_buflen; 1909 }; 1910 1911 struct vki_cdrom_read_audio 1912 { 1913 union vki_cdrom_addr addr; /* frame address */ 1914 __vki_u8 addr_format; /* CDROM_LBA or CDROM_MSF */ 1915 int nframes; /* number of 2352-byte-frames to read at once */ 1916 __vki_u8 __user *buf; /* frame buffer (size: nframes*2352 bytes) */ 1917 }; 1918 1919 struct vki_cdrom_multisession 1920 { 1921 union vki_cdrom_addr addr; /* frame address: start-of-last-session 1922 (not the new "frame 16"!). Only valid 1923 if the "xa_flag" is true. */ 1924 __vki_u8 xa_flag; /* 1: "is XA disk" */ 1925 __vki_u8 addr_format; /* CDROM_LBA or CDROM_MSF */ 1926 }; 1927 1928 struct vki_cdrom_mcn 1929 { 1930 __vki_u8 medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */ 1931 }; 1932 1933 #define VKI_CDROM_PACKET_SIZE 12 1934 1935 struct vki_cdrom_generic_command 1936 { 1937 unsigned char cmd[VKI_CDROM_PACKET_SIZE]; 1938 unsigned char __user *buffer; 1939 unsigned int buflen; 1940 int stat; 1941 // [[replace with void* to reduce inclusion amounts]] 1942 void/*struct vki_request_sense */__user *sense; 1943 unsigned char data_direction; 1944 int quiet; 1945 int timeout; 1946 void __user *reserved[1]; /* unused, actually */ 1947 }; 1948 1949 #define VKI_CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */ 1950 #define VKI_CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */ 1951 #define VKI_CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */ 1952 #define VKI_CD_FRAMESIZE_RAW0 (VKI_CD_FRAMESIZE_RAW-VKI_CD_SYNC_SIZE-VKI_CD_HEAD_SIZE) /*2336*/ 1953 1954 //---------------------------------------------------------------------- 1955 // From linux-2.6.8.1/include/linux/soundcard.h 1956 //---------------------------------------------------------------------- 1957 1958 #ifndef _VKI_SIOWR 1959 #if defined(_VKI_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__))) 1960 /* Use already defined ioctl defines if they exist (except with Sun or Sparc) */ 1961 #define _VKI_SIO _VKI_IO 1962 #define _VKI_SIOR _VKI_IOR 1963 #define _VKI_SIOW _VKI_IOW 1964 #define _VKI_SIOWR _VKI_IOWR 1965 #else 1966 // [[Valgrind: Install this case if/when necessary] 1967 #error Valgrind: Cannot handle sparc/sun case yet... 1968 # endif /* _IOWR */ 1969 #endif /* !_VKI_SIOWR */ 1970 1971 #define VKI_SNDCTL_SEQ_CTRLRATE _VKI_SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */ 1972 #define VKI_SNDCTL_SEQ_GETOUTCOUNT _VKI_SIOR ('Q', 4, int) 1973 #define VKI_SNDCTL_SEQ_GETINCOUNT _VKI_SIOR ('Q', 5, int) 1974 #define VKI_SNDCTL_SEQ_PERCMODE _VKI_SIOW ('Q', 6, int) 1975 #define VKI_SNDCTL_SEQ_TESTMIDI _VKI_SIOW ('Q', 8, int) 1976 #define VKI_SNDCTL_SEQ_RESETSAMPLES _VKI_SIOW ('Q', 9, int) 1977 #define VKI_SNDCTL_SEQ_NRSYNTHS _VKI_SIOR ('Q',10, int) 1978 #define VKI_SNDCTL_SEQ_NRMIDIS _VKI_SIOR ('Q',11, int) 1979 #define VKI_SNDCTL_SEQ_GETTIME _VKI_SIOR ('Q',19, int) 1980 1981 #define VKI_SNDCTL_TMR_TIMEBASE _VKI_SIOWR('T', 1, int) 1982 #define VKI_SNDCTL_TMR_TEMPO _VKI_SIOWR('T', 5, int) 1983 #define VKI_SNDCTL_TMR_SOURCE _VKI_SIOWR('T', 6, int) 1984 1985 #define VKI_SNDCTL_MIDI_PRETIME _VKI_SIOWR('m', 0, int) 1986 #define VKI_SNDCTL_MIDI_MPUMODE _VKI_SIOWR('m', 1, int) 1987 1988 #define VKI_SNDCTL_DSP_RESET _VKI_SIO ('P', 0) 1989 #define VKI_SNDCTL_DSP_SYNC _VKI_SIO ('P', 1) 1990 #define VKI_SNDCTL_DSP_SPEED _VKI_SIOWR('P', 2, int) 1991 #define VKI_SNDCTL_DSP_STEREO _VKI_SIOWR('P', 3, int) 1992 #define VKI_SNDCTL_DSP_GETBLKSIZE _VKI_SIOWR('P', 4, int) 1993 #define VKI_SNDCTL_DSP_CHANNELS _VKI_SIOWR('P', 6, int) 1994 #define VKI_SOUND_PCM_WRITE_FILTER _VKI_SIOWR('P', 7, int) 1995 #define VKI_SNDCTL_DSP_POST _VKI_SIO ('P', 8) 1996 #define VKI_SNDCTL_DSP_SUBDIVIDE _VKI_SIOWR('P', 9, int) 1997 #define VKI_SNDCTL_DSP_SETFRAGMENT _VKI_SIOWR('P',10, int) 1998 1999 #define VKI_SNDCTL_DSP_GETFMTS _VKI_SIOR ('P',11, int) /* Returns a mask */ 2000 #define VKI_SNDCTL_DSP_SETFMT _VKI_SIOWR('P', 5, int) /* Selects ONE fmt */ 2001 2002 typedef struct vki_audio_buf_info { 2003 int fragments; /* # of available fragments (partially usend ones not counted) */ 2004 int fragstotal; /* Total # of fragments allocated */ 2005 int fragsize; /* Size of a fragment in bytes */ 2006 2007 int bytes; /* Available space in bytes (includes partially used fragments) */ 2008 /* Note! 'bytes' could be more than fragments*fragsize */ 2009 } vki_audio_buf_info; 2010 2011 #define VKI_SNDCTL_DSP_GETOSPACE _VKI_SIOR ('P',12, vki_audio_buf_info) 2012 #define VKI_SNDCTL_DSP_GETISPACE _VKI_SIOR ('P',13, vki_audio_buf_info) 2013 #define VKI_SNDCTL_DSP_NONBLOCK _VKI_SIO ('P',14) 2014 #define VKI_SNDCTL_DSP_GETCAPS _VKI_SIOR ('P',15, int) 2015 2016 #define VKI_SNDCTL_DSP_GETTRIGGER _VKI_SIOR ('P',16, int) 2017 #define VKI_SNDCTL_DSP_SETTRIGGER _VKI_SIOW ('P',16, int) 2018 2019 #define VKI_SNDCTL_DSP_SETSYNCRO _VKI_SIO ('P', 21) 2020 #define VKI_SNDCTL_DSP_SETDUPLEX _VKI_SIO ('P', 22) 2021 #define VKI_SNDCTL_DSP_GETODELAY _VKI_SIOR ('P', 23, int) 2022 2023 #define VKI_SNDCTL_DSP_GETCHANNELMASK _VKI_SIOWR('P', 64, int) 2024 #define VKI_SNDCTL_DSP_BIND_CHANNEL _VKI_SIOWR('P', 65, int) 2025 2026 #define VKI_SNDCTL_DSP_SETSPDIF _VKI_SIOW ('P', 66, int) 2027 #define VKI_SNDCTL_DSP_GETSPDIF _VKI_SIOR ('P', 67, int) 2028 2029 #define VKI_SOUND_PCM_READ_RATE _VKI_SIOR ('P', 2, int) 2030 #define VKI_SOUND_PCM_READ_CHANNELS _VKI_SIOR ('P', 6, int) 2031 #define VKI_SOUND_PCM_READ_BITS _VKI_SIOR ('P', 5, int) 2032 #define VKI_SOUND_PCM_READ_FILTER _VKI_SIOR ('P', 7, int) 2033 2034 2035 //---------------------------------------------------------------------- 2036 // From linux-2.6.8.1/include/linux/hdreg.h 2037 //---------------------------------------------------------------------- 2038 2039 struct vki_hd_geometry { 2040 unsigned char heads; 2041 unsigned char sectors; 2042 unsigned short cylinders; 2043 unsigned long start; 2044 }; 2045 2046 #define VKI_HDIO_GETGEO 0x0301 /* get device geometry */ 2047 #define VKI_HDIO_GET_DMA 0x030b /* get use-dma flag */ 2048 #define VKI_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ 2049 2050 // [[Nb: done like this because the original type is a huge struct that will 2051 // always be the same size.]] 2052 #define VKI_SIZEOF_STRUCT_HD_DRIVEID 512 2053 2054 //---------------------------------------------------------------------- 2055 // From linux-2.6.8.1/include/linux/fb.h 2056 //---------------------------------------------------------------------- 2057 2058 #define VKI_FBIOGET_VSCREENINFO 0x4600 2059 #define VKI_FBIOPUT_VSCREENINFO 0x4601 2060 #define VKI_FBIOGET_FSCREENINFO 0x4602 2061 #define VKI_FBIOPAN_DISPLAY 0x4606 2062 2063 struct vki_fb_fix_screeninfo { 2064 char id[16]; /* identification string eg "TT Builtin" */ 2065 unsigned long smem_start; /* Start of frame buffer mem */ 2066 /* (physical address) */ 2067 __vki_u32 smem_len; /* Length of frame buffer mem */ 2068 __vki_u32 type; /* see FB_TYPE_* */ 2069 __vki_u32 type_aux; /* Interleave for interleaved Planes */ 2070 __vki_u32 visual; /* see FB_VISUAL_* */ 2071 __vki_u16 xpanstep; /* zero if no hardware panning */ 2072 __vki_u16 ypanstep; /* zero if no hardware panning */ 2073 __vki_u16 ywrapstep; /* zero if no hardware ywrap */ 2074 __vki_u32 line_length; /* length of a line in bytes */ 2075 unsigned long mmio_start; /* Start of Memory Mapped I/O */ 2076 /* (physical address) */ 2077 __vki_u32 mmio_len; /* Length of Memory Mapped I/O */ 2078 __vki_u32 accel; /* Indicate to driver which */ 2079 /* specific chip/card we have */ 2080 __vki_u16 reserved[3]; /* Reserved for future compatibility */ 2081 }; 2082 2083 struct vki_fb_bitfield { 2084 __vki_u32 offset; /* beginning of bitfield */ 2085 __vki_u32 length; /* length of bitfield */ 2086 __vki_u32 msb_right; /* != 0 : Most significant bit is */ 2087 /* right */ 2088 }; 2089 2090 struct vki_fb_var_screeninfo { 2091 __vki_u32 xres; /* visible resolution */ 2092 __vki_u32 yres; 2093 __vki_u32 xres_virtual; /* virtual resolution */ 2094 __vki_u32 yres_virtual; 2095 __vki_u32 xoffset; /* offset from virtual to visible */ 2096 __vki_u32 yoffset; /* resolution */ 2097 2098 __vki_u32 bits_per_pixel; /* guess what */ 2099 __vki_u32 grayscale; /* != 0 Graylevels instead of colors */ 2100 2101 struct vki_fb_bitfield red; /* bitfield in fb mem if true color, */ 2102 struct vki_fb_bitfield green; /* else only length is significant */ 2103 struct vki_fb_bitfield blue; 2104 struct vki_fb_bitfield transp; /* transparency */ 2105 2106 __vki_u32 nonstd; /* != 0 Non standard pixel format */ 2107 2108 __vki_u32 activate; /* see FB_ACTIVATE_* */ 2109 2110 __vki_u32 height; /* height of picture in mm */ 2111 __vki_u32 width; /* width of picture in mm */ 2112 2113 __vki_u32 accel_flags; /* (OBSOLETE) see fb_info.flags */ 2114 2115 /* Timing: All values in pixclocks, except pixclock (of course) */ 2116 __vki_u32 pixclock; /* pixel clock in ps (pico seconds) */ 2117 __vki_u32 left_margin; /* time from sync to picture */ 2118 __vki_u32 right_margin; /* time from picture to sync */ 2119 __vki_u32 upper_margin; /* time from sync to picture */ 2120 __vki_u32 lower_margin; 2121 __vki_u32 hsync_len; /* length of horizontal sync */ 2122 __vki_u32 vsync_len; /* length of vertical sync */ 2123 __vki_u32 sync; /* see FB_SYNC_* */ 2124 __vki_u32 vmode; /* see FB_VMODE_* */ 2125 __vki_u32 rotate; /* angle we rotate counter clockwise */ 2126 __vki_u32 reserved[5]; /* Reserved for future compatibility */ 2127 }; 2128 2129 //---------------------------------------------------------------------- 2130 // From linux-2.6.9/include/linux/kd.h 2131 //---------------------------------------------------------------------- 2132 2133 #define VKI_GIO_FONT 0x4B60 /* gets font in expanded form */ 2134 #define VKI_PIO_FONT 0x4B61 /* use font in expanded form */ 2135 2136 #define VKI_GIO_FONTX 0x4B6B /* get font using struct consolefontdesc */ 2137 #define VKI_PIO_FONTX 0x4B6C /* set font using struct consolefontdesc */ 2138 struct vki_consolefontdesc { 2139 unsigned short charcount; /* characters in font (256 or 512) */ 2140 unsigned short charheight; /* scan lines per character (1-32) */ 2141 char __user *chardata; /* font data in expanded form */ 2142 }; 2143 2144 #define VKI_PIO_FONTRESET 0x4B6D /* reset to default font */ 2145 2146 #define VKI_GIO_CMAP 0x4B70 /* gets colour palette on VGA+ */ 2147 #define VKI_PIO_CMAP 0x4B71 /* sets colour palette on VGA+ */ 2148 2149 #define VKI_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */ 2150 #define VKI_KDMKTONE 0x4B30 /* generate tone */ 2151 2152 #define VKI_KDGETLED 0x4B31 /* return current led state */ 2153 #define VKI_KDSETLED 0x4B32 /* set led state [lights, not flags] */ 2154 2155 #define VKI_KDGKBTYPE 0x4B33 /* get keyboard type */ 2156 2157 #define VKI_KDADDIO 0x4B34 /* add i/o port as valid */ 2158 #define VKI_KDDELIO 0x4B35 /* del i/o port as valid */ 2159 #define VKI_KDENABIO 0x4B36 /* enable i/o to video board */ 2160 #define VKI_KDDISABIO 0x4B37 /* disable i/o to video board */ 2161 2162 #define VKI_KDSETMODE 0x4B3A /* set text/graphics mode */ 2163 #define VKI_KDGETMODE 0x4B3B /* get current mode */ 2164 2165 #define VKI_KDMAPDISP 0x4B3C /* map display into address space */ 2166 #define VKI_KDUNMAPDISP 0x4B3D /* unmap display from address space */ 2167 2168 #define VKI_E_TABSZ 256 2169 #define VKI_GIO_SCRNMAP 0x4B40 /* get screen mapping from kernel */ 2170 #define VKI_PIO_SCRNMAP 0x4B41 /* put screen mapping table in kernel */ 2171 #define VKI_GIO_UNISCRNMAP 0x4B69 /* get full Unicode screen mapping */ 2172 #define VKI_PIO_UNISCRNMAP 0x4B6A /* set full Unicode screen mapping */ 2173 2174 #define VKI_GIO_UNIMAP 0x4B66 /* get unicode-to-font mapping from kernel */ 2175 struct vki_unipair { 2176 unsigned short unicode; 2177 unsigned short fontpos; 2178 }; 2179 struct vki_unimapdesc { 2180 unsigned short entry_ct; 2181 struct vki_unipair __user *entries; 2182 }; 2183 #define VKI_PIO_UNIMAP 0x4B67 /* put unicode-to-font mapping in kernel */ 2184 #define VKI_PIO_UNIMAPCLR 0x4B68 /* clear table, possibly advise hash algorithm */ 2185 struct vki_unimapinit { 2186 unsigned short advised_hashsize; /* 0 if no opinion */ 2187 unsigned short advised_hashstep; /* 0 if no opinion */ 2188 unsigned short advised_hashlevel; /* 0 if no opinion */ 2189 }; 2190 2191 #define VKI_KDGKBMODE 0x4B44 /* gets current keyboard mode */ 2192 #define VKI_KDSKBMODE 0x4B45 /* sets current keyboard mode */ 2193 2194 #define VKI_KDGKBMETA 0x4B62 /* gets meta key handling mode */ 2195 #define VKI_KDSKBMETA 0x4B63 /* sets meta key handling mode */ 2196 2197 #define VKI_KDGKBLED 0x4B64 /* get led flags (not lights) */ 2198 #define VKI_KDSKBLED 0x4B65 /* set led flags (not lights) */ 2199 2200 struct vki_kbentry { 2201 unsigned char kb_table; 2202 unsigned char kb_index; 2203 unsigned short kb_value; 2204 }; 2205 #define VKI_KDGKBENT 0x4B46 /* gets one entry in translation table */ 2206 #define VKI_KDSKBENT 0x4B47 /* sets one entry in translation table */ 2207 2208 struct vki_kbsentry { 2209 unsigned char kb_func; 2210 unsigned char kb_string[512]; 2211 }; 2212 #define VKI_KDGKBSENT 0x4B48 /* gets one function key string entry */ 2213 #define VKI_KDSKBSENT 0x4B49 /* sets one function key string entry */ 2214 2215 struct vki_kbdiacr { 2216 unsigned char diacr, base, result; 2217 }; 2218 struct vki_kbdiacrs { 2219 unsigned int kb_cnt; /* number of entries in following array */ 2220 struct vki_kbdiacr kbdiacr[256]; /* MAX_DIACR from keyboard.h */ 2221 }; 2222 #define VKI_KDGKBDIACR 0x4B4A /* read kernel accent table */ 2223 #define VKI_KDSKBDIACR 0x4B4B /* write kernel accent table */ 2224 2225 struct vki_kbkeycode { 2226 unsigned int scancode, keycode; 2227 }; 2228 #define VKI_KDGETKEYCODE 0x4B4C /* read kernel keycode table entry */ 2229 #define VKI_KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */ 2230 2231 #define VKI_KDSIGACCEPT 0x4B4E /* accept kbd generated signals */ 2232 2233 struct vki_kbd_repeat { 2234 int delay; /* in msec; <= 0: don't change */ 2235 int period; /* in msec; <= 0: don't change */ 2236 /* earlier this field was misnamed "rate" */ 2237 }; 2238 #define VKI_KDKBDREP 0x4B52 /* set keyboard delay/repeat rate; 2239 * actually used values are returned */ 2240 2241 #define VKI_KDFONTOP 0x4B72 /* font operations */ 2242 2243 struct vki_console_font_op { 2244 unsigned int op; /* operation code KD_FONT_OP_* */ 2245 unsigned int flags; /* KD_FONT_FLAG_* */ 2246 unsigned int width, height; /* font size */ 2247 unsigned int charcount; 2248 unsigned char __user *data; /* font data with height fixed to 32 */ 2249 }; 2250 2251 #define VKI_KD_FONT_OP_SET 0 /* Set font */ 2252 #define VKI_KD_FONT_OP_GET 1 /* Get font */ 2253 #define VKI_KD_FONT_OP_SET_DEFAULT 2 /* Set font to default, data points to name / NULL */ 2254 #define VKI_KD_FONT_OP_COPY 3 /* Copy from another console */ 2255 2256 //---------------------------------------------------------------------- 2257 // From linux-2.6.9/include/linux/kb.h 2258 //---------------------------------------------------------------------- 2259 2260 typedef __vki_kernel_uid32_t vki_qid_t; /* Type in which we store ids in memory */ 2261 2262 //---------------------------------------------------------------------- 2263 // From linux-2.6.20.1/include/linux/ptrace.h 2264 //---------------------------------------------------------------------- 2265 2266 #define VKI_PTRACE_TRACEME 0 2267 #define VKI_PTRACE_PEEKTEXT 1 2268 #define VKI_PTRACE_PEEKDATA 2 2269 #define VKI_PTRACE_PEEKUSR 3 2270 #define VKI_PTRACE_POKEUSR 6 2271 2272 #define VKI_PTRACE_DETACH 17 2273 2274 #define VKI_PTRACE_GETEVENTMSG 0x4201 2275 #define VKI_PTRACE_GETSIGINFO 0x4202 2276 #define VKI_PTRACE_SETSIGINFO 0x4203 2277 #define VKI_PTRACE_GETREGSET 0x4204 2278 #define VKI_PTRACE_SETREGSET 0x4205 2279 2280 //---------------------------------------------------------------------- 2281 // From linux-2.6.14/include/sound/asound.h 2282 //---------------------------------------------------------------------- 2283 2284 enum { 2285 VKI_SNDRV_PCM_IOCTL_HW_FREE = _VKI_IO('A', 0x12), 2286 VKI_SNDRV_PCM_IOCTL_HWSYNC = _VKI_IO('A', 0x22), 2287 VKI_SNDRV_PCM_IOCTL_PREPARE = _VKI_IO('A', 0x40), 2288 VKI_SNDRV_PCM_IOCTL_RESET = _VKI_IO('A', 0x41), 2289 VKI_SNDRV_PCM_IOCTL_START = _VKI_IO('A', 0x42), 2290 VKI_SNDRV_PCM_IOCTL_DROP = _VKI_IO('A', 0x43), 2291 VKI_SNDRV_PCM_IOCTL_DRAIN = _VKI_IO('A', 0x44), 2292 VKI_SNDRV_PCM_IOCTL_PAUSE = _VKI_IOW('A', 0x45, int), 2293 VKI_SNDRV_PCM_IOCTL_RESUME = _VKI_IO('A', 0x47), 2294 VKI_SNDRV_PCM_IOCTL_XRUN = _VKI_IO('A', 0x48), 2295 VKI_SNDRV_PCM_IOCTL_LINK = _VKI_IOW('A', 0x60, int), 2296 VKI_SNDRV_PCM_IOCTL_UNLINK = _VKI_IO('A', 0x61), 2297 }; 2298 2299 enum { 2300 VKI_SNDRV_TIMER_IOCTL_START = _VKI_IO('T', 0xa0), 2301 VKI_SNDRV_TIMER_IOCTL_STOP = _VKI_IO('T', 0xa1), 2302 VKI_SNDRV_TIMER_IOCTL_CONTINUE = _VKI_IO('T', 0xa2), 2303 VKI_SNDRV_TIMER_IOCTL_PAUSE = _VKI_IO('T', 0xa3), 2304 }; 2305 2306 //---------------------------------------------------------------------- 2307 // From linux-2.6.15.4/include/linux/serial.h 2308 //---------------------------------------------------------------------- 2309 2310 struct vki_serial_icounter_struct { 2311 int cts, dsr, rng, dcd; 2312 int rx, tx; 2313 int frame, overrun, parity, brk; 2314 int buf_overrun; 2315 int reserved[9]; 2316 }; 2317 2318 //---------------------------------------------------------------------- 2319 // From linux-2.6.16/include/linux/vt.h 2320 //---------------------------------------------------------------------- 2321 2322 #define VKI_VT_OPENQRY 0x5600 /* find available vt */ 2323 2324 struct vki_vt_mode { 2325 char mode; /* vt mode */ 2326 char waitv; /* if set, hang on writes if not active */ 2327 short relsig; /* signal to raise on release req */ 2328 short acqsig; /* signal to raise on acquisition */ 2329 short frsig; /* unused (set to 0) */ 2330 }; 2331 #define VKI_VT_GETMODE 0x5601 /* get mode of active vt */ 2332 #define VKI_VT_SETMODE 0x5602 /* set mode of active vt */ 2333 2334 struct vki_vt_stat { 2335 unsigned short v_active; /* active vt */ 2336 unsigned short v_signal; /* signal to send */ 2337 unsigned short v_state; /* vt bitmask */ 2338 }; 2339 #define VKI_VT_GETSTATE 0x5603 /* get global vt state info */ 2340 #define VKI_VT_SENDSIG 0x5604 /* signal to send to bitmask of vts */ 2341 2342 #define VKI_VT_RELDISP 0x5605 /* release display */ 2343 2344 #define VKI_VT_ACTIVATE 0x5606 /* make vt active */ 2345 #define VKI_VT_WAITACTIVE 0x5607 /* wait for vt active */ 2346 #define VKI_VT_DISALLOCATE 0x5608 /* free memory associated to vt */ 2347 2348 struct vki_vt_sizes { 2349 unsigned short v_rows; /* number of rows */ 2350 unsigned short v_cols; /* number of columns */ 2351 unsigned short v_scrollsize; /* number of lines of scrollback */ 2352 }; 2353 #define VKI_VT_RESIZE 0x5609 /* set kernel's idea of screensize */ 2354 2355 struct vki_vt_consize { 2356 unsigned short v_rows; /* number of rows */ 2357 unsigned short v_cols; /* number of columns */ 2358 unsigned short v_vlin; /* number of pixel rows on screen */ 2359 unsigned short v_clin; /* number of pixel rows per character */ 2360 unsigned short v_vcol; /* number of pixel columns on screen */ 2361 unsigned short v_ccol; /* number of pixel columns per character */ 2362 }; 2363 #define VKI_VT_RESIZEX 0x560A /* set kernel's idea of screensize + more */ 2364 #define VKI_VT_LOCKSWITCH 0x560B /* disallow vt switching */ 2365 #define VKI_VT_UNLOCKSWITCH 0x560C /* allow vt switching */ 2366 2367 //---------------------------------------------------------------------- 2368 // From linux-2.6.19/include/linux/prctl.h 2369 //---------------------------------------------------------------------- 2370 2371 #define VKI_PR_SET_PDEATHSIG 1 /* Second arg is a signal */ 2372 #define VKI_PR_GET_PDEATHSIG 2 /* Second arg is a ptr to return the signal */ 2373 2374 #define VKI_PR_GET_DUMPABLE 3 2375 #define VKI_PR_SET_DUMPABLE 4 2376 2377 #define VKI_PR_GET_UNALIGN 5 2378 #define VKI_PR_SET_UNALIGN 6 2379 # define VKI_PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */ 2380 # define VKI_PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */ 2381 2382 #define VKI_PR_GET_KEEPCAPS 7 2383 #define VKI_PR_SET_KEEPCAPS 8 2384 2385 #define VKI_PR_GET_FPEMU 9 2386 #define VKI_PR_SET_FPEMU 10 2387 # define VKI_PR_FPEMU_NOPRINT 1 /* silently emulate fp operations accesses */ 2388 # define VKI_PR_FPEMU_SIGFPE 2 /* don't emulate fp operations, send SIGFPE instead */ 2389 2390 #define VKI_PR_GET_FPEXC 11 2391 #define VKI_PR_SET_FPEXC 12 2392 # define VKI_PR_FP_EXC_SW_ENABLE 0x80 /* Use FPEXC for FP exception enables */ 2393 # define VKI_PR_FP_EXC_DIV 0x010000 /* floating point divide by zero */ 2394 # define VKI_PR_FP_EXC_OVF 0x020000 /* floating point overflow */ 2395 # define VKI_PR_FP_EXC_UND 0x040000 /* floating point underflow */ 2396 # define VKI_PR_FP_EXC_RES 0x080000 /* floating point inexact result */ 2397 # define VKI_PR_FP_EXC_INV 0x100000 /* floating point invalid operation */ 2398 # define VKI_PR_FP_EXC_DISABLED 0 /* FP exceptions disabled */ 2399 # define VKI_PR_FP_EXC_NONRECOV 1 /* async non-recoverable exc. mode */ 2400 # define VKI_PR_FP_EXC_ASYNC 2 /* async recoverable exception mode */ 2401 # define VKI_PR_FP_EXC_PRECISE 3 /* precise exception mode */ 2402 2403 #define VKI_PR_GET_TIMING 13 2404 #define VKI_PR_SET_TIMING 14 2405 # define VKI_PR_TIMING_STATISTICAL 0 /* Normal, traditional, 2406 statistical process timing */ 2407 # define VKI_PR_TIMING_TIMESTAMP 1 /* Accurate timestamp based 2408 process timing */ 2409 2410 #define VKI_PR_SET_NAME 15 /* Set process name */ 2411 #define VKI_PR_GET_NAME 16 /* Get process name */ 2412 2413 #define VKI_PR_GET_ENDIAN 19 2414 #define VKI_PR_SET_ENDIAN 20 2415 # define VKI_PR_ENDIAN_BIG 0 2416 # define VKI_PR_ENDIAN_LITTLE 1 /* True little endian mode */ 2417 # define VKI_PR_ENDIAN_PPC_LITTLE 2 /* "PowerPC" pseudo little endian */ 2418 2419 //---------------------------------------------------------------------- 2420 // From linux-2.6.19/include/linux/usbdevice_fs.h 2421 //---------------------------------------------------------------------- 2422 2423 struct vki_usbdevfs_ctrltransfer { 2424 __vki_u8 bRequestType; 2425 __vki_u8 bRequest; 2426 __vki_u16 wValue; 2427 __vki_u16 wIndex; 2428 __vki_u16 wLength; 2429 __vki_u32 timeout; /* in milliseconds */ 2430 void __user *data; 2431 }; 2432 2433 struct vki_usbdevfs_bulktransfer { 2434 unsigned int ep; 2435 unsigned int len; 2436 unsigned int timeout; /* in milliseconds */ 2437 void __user *data; 2438 }; 2439 2440 #define VKI_USBDEVFS_MAXDRIVERNAME 255 2441 2442 struct vki_usbdevfs_getdriver { 2443 unsigned int interface; 2444 char driver[VKI_USBDEVFS_MAXDRIVERNAME + 1]; 2445 }; 2446 2447 struct vki_usbdevfs_connectinfo { 2448 unsigned int devnum; 2449 unsigned char slow; 2450 }; 2451 2452 struct vki_usbdevfs_iso_packet_desc { 2453 unsigned int length; 2454 unsigned int actual_length; 2455 unsigned int status; 2456 }; 2457 2458 struct vki_usbdevfs_urb { 2459 unsigned char type; 2460 unsigned char endpoint; 2461 int status; 2462 unsigned int flags; 2463 void __user *buffer; 2464 int buffer_length; 2465 int actual_length; 2466 int start_frame; 2467 int number_of_packets; 2468 int error_count; 2469 unsigned int signr; /* signal to be sent on error, -1 if none should be sent */ 2470 void *usercontext; 2471 struct vki_usbdevfs_iso_packet_desc iso_frame_desc[0]; 2472 }; 2473 2474 struct vki_usbdevfs_ioctl { 2475 int ifno; /* interface 0..N ; negative numbers reserved */ 2476 int ioctl_code; /* MUST encode size + direction of data so the 2477 * macros in <asm/ioctl.h> give correct values */ 2478 void __user *data; /* param buffer (in, or out) */ 2479 }; 2480 2481 #define VKI_USBDEVFS_CONTROL _VKI_IOWR('U', 0, struct vki_usbdevfs_ctrltransfer) 2482 #define VKI_USBDEVFS_BULK _VKI_IOWR('U', 2, struct vki_usbdevfs_bulktransfer) 2483 #define VKI_USBDEVFS_GETDRIVER _VKI_IOW('U', 8, struct vki_usbdevfs_getdriver) 2484 #define VKI_USBDEVFS_SUBMITURB _VKI_IOR('U', 10, struct vki_usbdevfs_urb) 2485 #define VKI_USBDEVFS_DISCARDURB _VKI_IO('U', 11) 2486 #define VKI_USBDEVFS_REAPURB _VKI_IOW('U', 12, void *) 2487 #define VKI_USBDEVFS_REAPURBNDELAY _VKI_IOW('U', 13, void *) 2488 #define VKI_USBDEVFS_CONNECTINFO _VKI_IOW('U', 17, struct vki_usbdevfs_connectinfo) 2489 #define VKI_USBDEVFS_IOCTL _VKI_IOWR('U', 18, struct vki_usbdevfs_ioctl) 2490 #define VKI_USBDEVFS_RESET _VKI_IO('U', 20) 2491 2492 #define VKI_USBDEVFS_URB_TYPE_ISO 0 2493 #define VKI_USBDEVFS_URB_TYPE_INTERRUPT 1 2494 #define VKI_USBDEVFS_URB_TYPE_CONTROL 2 2495 #define VKI_USBDEVFS_URB_TYPE_BULK 3 2496 2497 // [[this is missing in usbdevice_fs.h]] 2498 struct vki_usbdevfs_setuppacket { 2499 __vki_u8 bRequestType; 2500 __vki_u8 bRequest; 2501 __vki_u16 wValue; 2502 __vki_u16 wIndex; 2503 __vki_u16 wLength; 2504 }; 2505 2506 //---------------------------------------------------------------------- 2507 // From linux-2.6.20.1/include/linux/i2c.h 2508 //---------------------------------------------------------------------- 2509 2510 #define VKI_I2C_SLAVE 0x0703 /* Change slave address */ 2511 /* Attn.: Slave address is 7 or 10 bits */ 2512 #define VKI_I2C_SLAVE_FORCE 0x0706 /* Change slave address */ 2513 /* Attn.: Slave address is 7 or 10 bits */ 2514 /* This changes the address, even if it */ 2515 /* is already taken! */ 2516 #define VKI_I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ 2517 #define VKI_I2C_FUNCS 0x0705 /* Get the adapter functionality */ 2518 #define VKI_I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */ 2519 #define VKI_I2C_PEC 0x0708 /* != 0 for SMBus PEC */ 2520 2521 struct vki_i2c_msg { 2522 __vki_u16 addr; /* slave address */ 2523 __vki_u16 flags; 2524 #define VKI_I2C_M_TEN 0x0010 /* this is a ten bit chip address */ 2525 #define VKI_I2C_M_RD 0x0001 /* read data, from slave to master */ 2526 #define VKI_I2C_M_NOSTART 0x4000 /* if I2C_FUNC_PROTOCOL_MANGLING */ 2527 #define VKI_I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */ 2528 #define VKI_I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */ 2529 #define VKI_I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */ 2530 #define VKI_I2C_M_RECV_LEN 0x0400 /* length will be first received byte */ 2531 __vki_u16 len; /* msg length */ 2532 __vki_u8 *buf; /* pointer to msg data */ 2533 }; 2534 2535 struct vki_i2c_rdwr_ioctl_data { 2536 struct vki_i2c_msg *msgs; /* pointers to i2c_msgs */ 2537 __vki_u32 nmsgs; /* number of i2c_msgs */ 2538 }; 2539 2540 //---------------------------------------------------------------------- 2541 // From linux-2.6.20.1/include/linux/keyctl.h 2542 //---------------------------------------------------------------------- 2543 2544 /* keyctl commands */ 2545 #define VKI_KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ 2546 #define VKI_KEYCTL_JOIN_SESSION_KEYRING 1 /* join or start named session keyring */ 2547 #define VKI_KEYCTL_UPDATE 2 /* update a key */ 2548 #define VKI_KEYCTL_REVOKE 3 /* revoke a key */ 2549 #define VKI_KEYCTL_CHOWN 4 /* set ownership of a key */ 2550 #define VKI_KEYCTL_SETPERM 5 /* set perms on a key */ 2551 #define VKI_KEYCTL_DESCRIBE 6 /* describe a key */ 2552 #define VKI_KEYCTL_CLEAR 7 /* clear contents of a keyring */ 2553 #define VKI_KEYCTL_LINK 8 /* link a key into a keyring */ 2554 #define VKI_KEYCTL_UNLINK 9 /* unlink a key from a keyring */ 2555 #define VKI_KEYCTL_SEARCH 10 /* search for a key in a keyring */ 2556 #define VKI_KEYCTL_READ 11 /* read a key or keyring's contents */ 2557 #define VKI_KEYCTL_INSTANTIATE 12 /* instantiate a partially constructed key */ 2558 #define VKI_KEYCTL_NEGATE 13 /* negate a partially constructed key */ 2559 #define VKI_KEYCTL_SET_REQKEY_KEYRING 14 /* set default request-key keyring */ 2560 #define VKI_KEYCTL_SET_TIMEOUT 15 /* set key timeout */ 2561 #define VKI_KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ 2562 2563 /*--------------------------------------------------------------------*/ 2564 // From linux-2.6.20.1/include/linux/key.h 2565 /*--------------------------------------------------------------------*/ 2566 2567 /* key handle serial number */ 2568 typedef vki_int32_t vki_key_serial_t; 2569 2570 /* key handle permissions mask */ 2571 typedef vki_uint32_t vki_key_perm_t; 2572 2573 //---------------------------------------------------------------------- 2574 // From linux-2.6.24.7/include/linux/wireless.h 2575 // (wireless extensions version 22, 2007-03-16) 2576 //---------------------------------------------------------------------- 2577 2578 /* 2579 * [[Wireless extensions ioctls.]] 2580 */ 2581 2582 /* Wireless Identification */ 2583 #define VKI_SIOCSIWCOMMIT 0x8B00 /* Commit pending changes to driver */ 2584 #define VKI_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ 2585 2586 /* Basic operations */ 2587 #define VKI_SIOCSIWNWID 0x8B02 /* set network id (pre-802.11) */ 2588 #define VKI_SIOCGIWNWID 0x8B03 /* get network id (the cell) */ 2589 #define VKI_SIOCSIWFREQ 0x8B04 /* set channel/frequency (Hz) */ 2590 #define VKI_SIOCGIWFREQ 0x8B05 /* get channel/frequency (Hz) */ 2591 #define VKI_SIOCSIWMODE 0x8B06 /* set operation mode */ 2592 #define VKI_SIOCGIWMODE 0x8B07 /* get operation mode */ 2593 #define VKI_SIOCSIWSENS 0x8B08 /* set sensitivity (dBm) */ 2594 #define VKI_SIOCGIWSENS 0x8B09 /* get sensitivity (dBm) */ 2595 2596 /* Informative stuff */ 2597 #define VKI_SIOCSIWRANGE 0x8B0A /* Unused */ 2598 #define VKI_SIOCGIWRANGE 0x8B0B /* Get range of parameters */ 2599 #define VKI_SIOCSIWPRIV 0x8B0C /* Unused */ 2600 #define VKI_SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */ 2601 #define VKI_SIOCSIWSTATS 0x8B0E /* Unused */ 2602 #define VKI_SIOCGIWSTATS 0x8B0F /* Get /proc/net/wireless stats */ 2603 2604 /* Spy support (statistics per MAC address - used for Mobile IP support) */ 2605 #define VKI_SIOCSIWSPY 0x8B10 /* set spy addresses */ 2606 #define VKI_SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */ 2607 #define VKI_SIOCSIWTHRSPY 0x8B12 /* set spy threshold (spy event) */ 2608 #define VKI_SIOCGIWTHRSPY 0x8B13 /* get spy threshold */ 2609 2610 /* Access Point manipulation */ 2611 #define VKI_SIOCSIWAP 0x8B14 /* set access point MAC addresses */ 2612 #define VKI_SIOCGIWAP 0x8B15 /* get access point MAC addresses */ 2613 #define VKI_SIOCGIWAPLIST 0x8B17 /* Deprecated in favor of scanning */ 2614 #define VKI_SIOCSIWSCAN 0x8B18 /* trigger scanning (list cells) */ 2615 #define VKI_SIOCGIWSCAN 0x8B19 /* get scanning results */ 2616 2617 /* 802.11 specific support */ 2618 #define VKI_SIOCSIWESSID 0x8B1A /* set ESSID (network name) */ 2619 #define VKI_SIOCGIWESSID 0x8B1B /* get ESSID */ 2620 #define VKI_SIOCSIWNICKN 0x8B1C /* set node name/nickname */ 2621 #define VKI_SIOCGIWNICKN 0x8B1D /* get node name/nickname */ 2622 2623 /* Other parameters useful in 802.11 and some other devices */ 2624 #define VKI_SIOCSIWRATE 0x8B20 /* set default bit rate (bps) */ 2625 #define VKI_SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */ 2626 #define VKI_SIOCSIWRTS 0x8B22 /* set RTS/CTS threshold (bytes) */ 2627 #define VKI_SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */ 2628 #define VKI_SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */ 2629 #define VKI_SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */ 2630 #define VKI_SIOCSIWTXPOW 0x8B26 /* set transmit power (dBm) */ 2631 #define VKI_SIOCGIWTXPOW 0x8B27 /* get transmit power (dBm) */ 2632 #define VKI_SIOCSIWRETRY 0x8B28 /* set retry limits and lifetime */ 2633 #define VKI_SIOCGIWRETRY 0x8B29 /* get retry limits and lifetime */ 2634 2635 /* Encoding stuff (scrambling, hardware security, WEP...) */ 2636 #define VKI_SIOCSIWENCODE 0x8B2A /* set encoding token & mode */ 2637 #define VKI_SIOCGIWENCODE 0x8B2B /* get encoding token & mode */ 2638 2639 /* Power saving stuff (power management, unicast and multicast) */ 2640 #define VKI_SIOCSIWPOWER 0x8B2C /* set Power Management settings */ 2641 #define VKI_SIOCGIWPOWER 0x8B2D /* get Power Management settings */ 2642 2643 /* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM). */ 2644 #define VKI_SIOCSIWGENIE 0x8B30 /* set generic IE */ 2645 #define VKI_SIOCGIWGENIE 0x8B31 /* get generic IE */ 2646 2647 /* WPA : IEEE 802.11 MLME requests */ 2648 #define VKI_SIOCSIWMLME 0x8B16 /* request MLME operation; uses 2649 * struct iw_mlme */ 2650 /* WPA : Authentication mode parameters */ 2651 #define VKI_SIOCSIWAUTH 0x8B32 /* set authentication mode params */ 2652 #define VKI_SIOCGIWAUTH 0x8B33 /* get authentication mode params */ 2653 2654 /* WPA : Extended version of encoding configuration */ 2655 #define VKI_SIOCSIWENCODEEXT 0x8B34 /* set encoding token & mode */ 2656 #define VKI_SIOCGIWENCODEEXT 0x8B35 /* get encoding token & mode */ 2657 2658 /* WPA2 : PMKSA cache management */ 2659 #define VKI_SIOCSIWPMKSA 0x8B36 /* PMKSA cache operation */ 2660 2661 /* 2662 * [[Payload for the wireless extensions ioctls.]] 2663 */ 2664 2665 struct vki_iw_param 2666 { 2667 __vki_s32 value; /* The value of the parameter itself */ 2668 __vki_u8 fixed; /* Hardware should not use auto select */ 2669 __vki_u8 disabled; /* Disable the feature */ 2670 __vki_u16 flags; /* Various specifc flags (if any) */ 2671 }; 2672 2673 struct vki_iw_point 2674 { 2675 void __user *pointer; /* Pointer to the data (in user space) */ 2676 __vki_u16 length; /* number of fields or size in bytes */ 2677 __vki_u16 flags; /* Optional params */ 2678 }; 2679 2680 struct vki_iw_freq 2681 { 2682 __vki_s32 m; /* Mantissa */ 2683 __vki_s16 e; /* Exponent */ 2684 __vki_u8 i; /* List index (when in range struct) */ 2685 __vki_u8 flags; /* Flags (fixed/auto) */ 2686 }; 2687 2688 struct vki_iw_quality 2689 { 2690 __vki_u8 qual; /* link quality (%retries, SNR, 2691 %missed beacons or better...) */ 2692 __vki_u8 level; /* signal level (dBm) */ 2693 __vki_u8 noise; /* noise level (dBm) */ 2694 __vki_u8 updated; /* Flags to know if updated */ 2695 }; 2696 2697 union vki_iwreq_data 2698 { 2699 /* Config - generic */ 2700 char name[VKI_IFNAMSIZ]; 2701 /* Name : used to verify the presence of wireless extensions. 2702 * Name of the protocol/provider... */ 2703 2704 struct vki_iw_point essid; /* Extended network name */ 2705 struct vki_iw_param nwid; /* network id (or domain - the cell) */ 2706 struct vki_iw_freq freq; /* frequency or channel : 2707 * 0-1000 = channel 2708 * > 1000 = frequency in Hz */ 2709 2710 struct vki_iw_param sens; /* signal level threshold */ 2711 struct vki_iw_param bitrate;/* default bit rate */ 2712 struct vki_iw_param txpower;/* default transmit power */ 2713 struct vki_iw_param rts; /* RTS threshold threshold */ 2714 struct vki_iw_param frag; /* Fragmentation threshold */ 2715 __vki_u32 mode; /* Operation mode */ 2716 struct vki_iw_param retry; /* Retry limits & lifetime */ 2717 2718 struct vki_iw_point encoding; /* Encoding stuff : tokens */ 2719 struct vki_iw_param power; /* PM duration/timeout */ 2720 struct vki_iw_quality qual; /* Quality part of statistics */ 2721 2722 struct vki_sockaddr ap_addr; /* Access point address */ 2723 struct vki_sockaddr addr; /* Destination address (hw/mac) */ 2724 2725 struct vki_iw_param param; /* Other small parameters */ 2726 struct vki_iw_point data; /* Other large parameters */ 2727 }; 2728 2729 struct vki_iwreq 2730 { 2731 union 2732 { 2733 char ifrn_name[VKI_IFNAMSIZ]; /* if name, e.g. "eth0" */ 2734 } ifr_ifrn; 2735 2736 /* Data part (defined just above) */ 2737 union vki_iwreq_data u; 2738 }; 2739 2740 /*--------------------------------------------------------------------*/ 2741 // From linux-2.6.31.5/include/linux/perf_event.h 2742 /*--------------------------------------------------------------------*/ 2743 2744 struct vki_perf_event_attr { 2745 2746 /* 2747 * Major type: hardware/software/tracepoint/etc. 2748 */ 2749 __vki_u32 type; 2750 2751 /* 2752 * Size of the attr structure, for fwd/bwd compat. 2753 */ 2754 __vki_u32 size; 2755 2756 /* 2757 * Type specific configuration information. 2758 */ 2759 __vki_u64 config; 2760 2761 union { 2762 __vki_u64 sample_period; 2763 __vki_u64 sample_freq; 2764 }; 2765 2766 __vki_u64 sample_type; 2767 __vki_u64 read_format; 2768 2769 __vki_u64 disabled : 1, /* off by default */ 2770 inherit : 1, /* children inherit it */ 2771 pinned : 1, /* must always be on PMU */ 2772 exclusive : 1, /* only group on PMU */ 2773 exclude_user : 1, /* don't count user */ 2774 exclude_kernel : 1, /* ditto kernel */ 2775 exclude_hv : 1, /* ditto hypervisor */ 2776 exclude_idle : 1, /* don't count when idle */ 2777 mmap : 1, /* include mmap data */ 2778 comm : 1, /* include comm data */ 2779 freq : 1, /* use freq, not period */ 2780 inherit_stat : 1, /* per task counts */ 2781 enable_on_exec : 1, /* next exec enables */ 2782 task : 1, /* trace fork/exit */ 2783 watermark : 1, /* wakeup_watermark */ 2784 /* 2785 * precise_ip: 2786 * 2787 * 0 - SAMPLE_IP can have arbitrary skid 2788 * 1 - SAMPLE_IP must have constant skid 2789 * 2 - SAMPLE_IP requested to have 0 skid 2790 * 3 - SAMPLE_IP must have 0 skid 2791 * 2792 * See also PERF_RECORD_MISC_EXACT_IP 2793 */ 2794 precise_ip : 2, /* skid constraint */ 2795 mmap_data : 1, /* non-exec mmap data */ 2796 sample_id_all : 1, /* sample_type all events */ 2797 2798 __reserved_1 : 45; 2799 2800 union { 2801 __vki_u32 wakeup_events; /* wakeup every n events */ 2802 __vki_u32 wakeup_watermark; /* bytes before wakeup */ 2803 }; 2804 2805 __vki_u32 bp_type; 2806 union { 2807 __vki_u64 bp_addr; 2808 __vki_u64 config1; /* extension of config */ 2809 }; 2810 union { 2811 __vki_u64 bp_len; 2812 __vki_u64 config2; /* extension of config1 */ 2813 }; 2814 }; 2815 2816 /*--------------------------------------------------------------------*/ 2817 // From linux-2.6.32.4/include/linux/getcpu.h 2818 /*--------------------------------------------------------------------*/ 2819 2820 struct vki_getcpu_cache { 2821 unsigned long blob[128 / sizeof(long)]; 2822 }; 2823 2824 //---------------------------------------------------------------------- 2825 // From linux-2.6.33.3/include/linux/input.h 2826 //---------------------------------------------------------------------- 2827 2828 /* 2829 * IOCTLs (0x00 - 0x7f) 2830 */ 2831 2832 #define VKI_EVIOCGNAME(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x06, len) /* get device name */ 2833 #define VKI_EVIOCGPHYS(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x07, len) /* get physical location */ 2834 #define VKI_EVIOCGUNIQ(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x08, len) /* get unique identifier */ 2835 2836 #define VKI_EVIOCGKEY(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x18, len) /* get global keystate */ 2837 #define VKI_EVIOCGLED(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x19, len) /* get all LEDs */ 2838 #define VKI_EVIOCGSND(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ 2839 #define VKI_EVIOCGSW(len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x1b, len) /* get all switch states */ 2840 2841 #define VKI_EVIOCGBIT(ev,len) _VKI_IOC(_VKI_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */ 2842 2843 #define VKI_EVIOCSSUSPENDBLOCK _VKI_IOW('E', 0x91, int) /* set suspend block enable */ 2844 2845 /* 2846 * Event types 2847 */ 2848 2849 #define VKI_EV_SYN 0x00 2850 #define VKI_EV_KEY 0x01 2851 #define VKI_EV_REL 0x02 2852 #define VKI_EV_ABS 0x03 2853 #define VKI_EV_MSC 0x04 2854 #define VKI_EV_SW 0x05 2855 #define VKI_EV_LED 0x11 2856 #define VKI_EV_SND 0x12 2857 #define VKI_EV_REP 0x14 2858 #define VKI_EV_FF 0x15 2859 #define VKI_EV_PWR 0x16 2860 #define VKI_EV_FF_STATUS 0x17 2861 #define VKI_EV_MAX 0x1f 2862 #define VKI_EV_CNT (VKI_EV_MAX+1) 2863 2864 //---------------------------------------------------------------------- 2865 // From linux-2.6.39-rc2/include/asm_generic/ioctls.h 2866 //---------------------------------------------------------------------- 2867 2868 #ifndef VKI_FIOQSIZE 2869 #define VKI_FIOQSIZE 0x5460 /* Value differs on some platforms */ 2870 #endif 2871 2872 //---------------------------------------------------------------------- 2873 // From kernel/common/include/linux/ashmem.h 2874 //---------------------------------------------------------------------- 2875 2876 #if defined(VGPV_arm_linux_android) || defined(VGPV_x86_linux_android) \ 2877 || defined(VGPV_mips32_linux_android) 2878 2879 #define VKI_ASHMEM_NAME_LEN 256 2880 2881 #define VKI_ASHMEM_NAME_DEF "dev/ashmem" 2882 2883 #define VKI_ASHMEM_NOT_PURGED 0 2884 #define VKI_ASHMEM_WAS_PURGED 1 2885 2886 #define VKI_ASHMEM_IS_UNPINNED 0 2887 #define VKI_ASHMEM_IS_PINNED 1 2888 2889 struct vki_ashmem_pin { 2890 vki_uint32_t offset; 2891 vki_uint32_t len; 2892 }; 2893 2894 #define __VKI_ASHMEMIOC 0x77 2895 2896 #define VKI_ASHMEM_SET_NAME _VKI_IOW(__VKI_ASHMEMIOC, 1, char[VKI_ASHMEM_NAME_LEN]) 2897 #define VKI_ASHMEM_GET_NAME _VKI_IOR(__VKI_ASHMEMIOC, 2, char[VKI_ASHMEM_NAME_LEN]) 2898 #define VKI_ASHMEM_SET_SIZE _VKI_IOW(__VKI_ASHMEMIOC, 3, vki_size_t) 2899 #define VKI_ASHMEM_GET_SIZE _VKI_IO(__VKI_ASHMEMIOC, 4) 2900 #define VKI_ASHMEM_SET_PROT_MASK _VKI_IOW(__VKI_ASHMEMIOC, 5, unsigned long) 2901 #define VKI_ASHMEM_GET_PROT_MASK _VKI_IO(__VKI_ASHMEMIOC, 6) 2902 #define VKI_ASHMEM_PIN _VKI_IOW(__VKI_ASHMEMIOC, 7, struct vki_ashmem_pin) 2903 #define VKI_ASHMEM_UNPIN _VKI_IOW(__VKI_ASHMEMIOC, 8, struct vki_ashmem_pin) 2904 #define VKI_ASHMEM_GET_PIN_STATUS _VKI_IO(__VKI_ASHMEMIOC, 9) 2905 #define VKI_ASHMEM_PURGE_ALL_CACHES _VKI_IO(__VKI_ASHMEMIOC, 10) 2906 2907 //---------------------------------------------------------------------- 2908 // From kernel/common/include/linux/binder.h 2909 //---------------------------------------------------------------------- 2910 2911 struct vki_binder_write_read { 2912 signed long write_size; 2913 signed long write_consumed; 2914 unsigned long write_buffer; 2915 signed long read_size; 2916 signed long read_consumed; 2917 unsigned long read_buffer; 2918 }; 2919 2920 struct vki_binder_version { 2921 signed long protocol_version; 2922 }; 2923 2924 #define VKI_BINDER_WRITE_READ _VKI_IOWR('b', 1, struct vki_binder_write_read) 2925 #define VKI_BINDER_SET_IDLE_TIMEOUT _VKI_IOW('b', 3, vki_int64_t) 2926 #define VKI_BINDER_SET_MAX_THREADS _VKI_IOW('b', 5, vki_size_t) 2927 #define VKI_BINDER_SET_IDLE_PRIORITY _VKI_IOW('b', 6, int) 2928 #define VKI_BINDER_SET_CONTEXT_MGR _VKI_IOW('b', 7, int) 2929 #define VKI_BINDER_THREAD_EXIT _VKI_IOW('b', 8, int) 2930 #define VKI_BINDER_VERSION _VKI_IOWR('b', 9, struct vki_binder_version) 2931 2932 #endif /* defined(VGPV_*_linux_android) */ 2933 2934 //---------------------------------------------------------------------- 2935 // From linux-3.0.4/include/net/bluetooth/bluetooth.h 2936 //---------------------------------------------------------------------- 2937 2938 typedef struct { 2939 __vki_u8 b[6]; 2940 } __vki_packed vki_bdaddr_t; 2941 2942 //---------------------------------------------------------------------- 2943 // From linux-3.0.4/include/net/bluetooth/hci.h 2944 //---------------------------------------------------------------------- 2945 2946 #define VKI_HCIDEVUP _VKI_IOW('H', 201, int) 2947 #define VKI_HCIDEVDOWN _VKI_IOW('H', 202, int) 2948 #define VKI_HCIDEVRESET _VKI_IOW('H', 203, int) 2949 #define VKI_HCIDEVRESTAT _VKI_IOW('H', 204, int) 2950 2951 #define VKI_HCIGETDEVLIST _VKI_IOR('H', 210, int) 2952 #define VKI_HCIGETDEVINFO _VKI_IOR('H', 211, int) 2953 #define VKI_HCIGETCONNLIST _VKI_IOR('H', 212, int) 2954 #define VKI_HCIGETCONNINFO _VKI_IOR('H', 213, int) 2955 #define VKI_HCIGETAUTHINFO _VKI_IOR('H', 215, int) 2956 2957 #define VKI_HCISETRAW _VKI_IOW('H', 220, int) 2958 #define VKI_HCISETSCAN _VKI_IOW('H', 221, int) 2959 #define VKI_HCISETAUTH _VKI_IOW('H', 222, int) 2960 #define VKI_HCISETENCRYPT _VKI_IOW('H', 223, int) 2961 #define VKI_HCISETPTYPE _VKI_IOW('H', 224, int) 2962 #define VKI_HCISETLINKPOL _VKI_IOW('H', 225, int) 2963 #define VKI_HCISETLINKMODE _VKI_IOW('H', 226, int) 2964 #define VKI_HCISETACLMTU _VKI_IOW('H', 227, int) 2965 #define VKI_HCISETSCOMTU _VKI_IOW('H', 228, int) 2966 2967 #define VKI_HCIBLOCKADDR _VKI_IOW('H', 230, int) 2968 #define VKI_HCIUNBLOCKADDR _VKI_IOW('H', 231, int) 2969 2970 #define VKI_HCIINQUIRY _VKI_IOR('H', 240, int) 2971 2972 struct vki_inquiry_info { 2973 vki_bdaddr_t bdaddr; 2974 __vki_u8 pscan_rep_mode; 2975 __vki_u8 pscan_period_mode; 2976 __vki_u8 pscan_mode; 2977 __vki_u8 dev_class[3]; 2978 __vki_le16 clock_offset; 2979 } __vki_packed; 2980 2981 struct vki_hci_inquiry_req { 2982 __vki_u16 dev_id; 2983 __vki_u16 flags; 2984 __vki_u8 lap[3]; 2985 __vki_u8 length; 2986 __vki_u8 num_rsp; 2987 }; 2988 2989 //---------------------------------------------------------------------- 2990 // From linux-3.9.2/include/net/bluetooth/rfcomm.h 2991 //---------------------------------------------------------------------- 2992 2993 struct vki_sockaddr_rc { 2994 vki_sa_family_t rc_family; 2995 vki_bdaddr_t rc_bdaddr; 2996 __vki_u8 rc_channel; 2997 }; 2998 2999 //---------------------------------------------------------------------- 3000 // From linux-3.4/include/linux/kvm.h 3001 //---------------------------------------------------------------------- 3002 #define KVMIO 0xAE 3003 3004 #define VKI_KVM_GET_API_VERSION _VKI_IO(KVMIO, 0x00) 3005 #define VKI_KVM_CREATE_VM _VKI_IO(KVMIO, 0x01) /* returns a VM fd */ 3006 #define VKI_KVM_CHECK_EXTENSION _VKI_IO(KVMIO, 0x03) 3007 #define VKI_KVM_GET_VCPU_MMAP_SIZE _VKI_IO(KVMIO, 0x04) /* in bytes */ 3008 #define VKI_KVM_S390_ENABLE_SIE _VKI_IO(KVMIO, 0x06) 3009 #define VKI_KVM_CREATE_VCPU _VKI_IO(KVMIO, 0x41) 3010 #define VKI_KVM_SET_NR_MMU_PAGES _VKI_IO(KVMIO, 0x44) 3011 #define VKI_KVM_GET_NR_MMU_PAGES _VKI_IO(KVMIO, 0x45) 3012 #define VKI_KVM_SET_TSS_ADDR _VKI_IO(KVMIO, 0x47) 3013 #define VKI_KVM_CREATE_IRQCHIP _VKI_IO(KVMIO, 0x60) 3014 #define VKI_KVM_CREATE_PIT _VKI_IO(KVMIO, 0x64) 3015 #define VKI_KVM_REINJECT_CONTROL _VKI_IO(KVMIO, 0x71) 3016 #define VKI_KVM_SET_BOOT_CPU_ID _VKI_IO(KVMIO, 0x78) 3017 #define VKI_KVM_SET_TSC_KHZ _VKI_IO(KVMIO, 0xa2) 3018 #define VKI_KVM_GET_TSC_KHZ _VKI_IO(KVMIO, 0xa3) 3019 #define VKI_KVM_RUN _VKI_IO(KVMIO, 0x80) 3020 #define VKI_KVM_S390_INITIAL_RESET _VKI_IO(KVMIO, 0x97) 3021 #define VKI_KVM_NMI _VKI_IO(KVMIO, 0x9a) 3022 3023 //---------------------------------------------------------------------- 3024 // From linux-2.6/include/linux/net_stamp.h 3025 //---------------------------------------------------------------------- 3026 3027 struct vki_hwtstamp_config { 3028 int flags; 3029 int tx_type; 3030 int rx_filter; 3031 }; 3032 3033 //---------------------------------------------------------------------- 3034 // From linux-2.6.12-rc2/include/linux/uinput.h 3035 //---------------------------------------------------------------------- 3036 3037 #define VKI_UINPUT_IOCTL_BASE 'U' 3038 #define VKI_UI_DEV_CREATE _VKI_IO(VKI_UINPUT_IOCTL_BASE, 1) 3039 #define VKI_UI_DEV_DESTROY _VKI_IO(VKI_UINPUT_IOCTL_BASE, 2) 3040 3041 #define VKI_UI_SET_EVBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 100, int) 3042 #define VKI_UI_SET_KEYBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 101, int) 3043 #define VKI_UI_SET_RELBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 102, int) 3044 #define VKI_UI_SET_ABSBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 103, int) 3045 #define VKI_UI_SET_MSCBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 104, int) 3046 #define VKI_UI_SET_LEDBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 105, int) 3047 #define VKI_UI_SET_SNDBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 106, int) 3048 #define VKI_UI_SET_FFBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 107, int) 3049 #define VKI_UI_SET_SWBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 109, int) 3050 #define VKI_UI_SET_PROPBIT _VKI_IOW(VKI_UINPUT_IOCTL_BASE, 110, int) 3051 3052 //---------------------------------------------------------------------- 3053 // From linux-2.6/include/uapi/rdma/ib_user_mad.h 3054 //---------------------------------------------------------------------- 3055 3056 #define VKI_IB_IOCTL_MAGIC 0x1b 3057 3058 #define VKI_IB_USER_MAD_REGISTER_AGENT _VKI_IOWR(VKI_IB_IOCTL_MAGIC, 1, \ 3059 struct ib_user_mad_reg_req) 3060 3061 #define VKI_IB_USER_MAD_UNREGISTER_AGENT _VKI_IOW(VKI_IB_IOCTL_MAGIC, 2, __u32) 3062 3063 #define VKI_IB_USER_MAD_ENABLE_PKEY _VKI_IO(VKI_IB_IOCTL_MAGIC, 3) 3064 3065 //---------------------------------------------------------------------- 3066 // From linux-3.8/include/uapi/linux/if_tun.h 3067 //---------------------------------------------------------------------- 3068 3069 #define VKI_TUNSETNOCSUM _VKI_IOW('T', 200, int) 3070 #define VKI_TUNSETDEBUG _VKI_IOW('T', 201, int) 3071 #define VKI_TUNSETIFF _VKI_IOW('T', 202, int) 3072 #define VKI_TUNSETPERSIST _VKI_IOW('T', 203, int) 3073 #define VKI_TUNSETOWNER _VKI_IOW('T', 204, int) 3074 #define VKI_TUNSETLINK _VKI_IOW('T', 205, int) 3075 #define VKI_TUNSETGROUP _VKI_IOW('T', 206, int) 3076 #define VKI_TUNGETFEATURES _VKI_IOR('T', 207, unsigned int) 3077 #define VKI_TUNSETOFFLOAD _VKI_IOW('T', 208, unsigned int) 3078 #define VKI_TUNSETTXFILTER _VKI_IOW('T', 209, unsigned int) 3079 #define VKI_TUNGETIFF _VKI_IOR('T', 210, unsigned int) 3080 #define VKI_TUNGETSNDBUF _VKI_IOR('T', 211, int) 3081 #define VKI_TUNSETSNDBUF _VKI_IOW('T', 212, int) 3082 //#define VKI_TUNATTACHFILTER _VKI_IOW('T', 213, struct sock_fprog) 3083 //#define VKI_TUNDETACHFILTER _VKI_IOW('T', 214, struct sock_fprog) 3084 #define VKI_TUNGETVNETHDRSZ _VKI_IOR('T', 215, int) 3085 #define VKI_TUNSETVNETHDRSZ _VKI_IOW('T', 216, int) 3086 #define VKI_TUNSETQUEUE _VKI_IOW('T', 217, int) 3087 3088 //---------------------------------------------------------------------- 3089 // From linux-3.8/include/uapi/linux/vhost.h 3090 //---------------------------------------------------------------------- 3091 3092 #define VKI_VHOST_VIRTIO 0xAF 3093 #define VKI_VHOST_SET_OWNER _VKI_IO(VKI_VHOST_VIRTIO, 0x01) 3094 #define VKI_VHOST_RESET_OWNER _VKI_IO(VKI_VHOST_VIRTIO, 0x02) 3095 3096 //---------------------------------------------------------------------- 3097 // Xen privcmd IOCTL 3098 //---------------------------------------------------------------------- 3099 3100 typedef unsigned long __vki_xen_pfn_t; 3101 3102 struct vki_xen_privcmd_hypercall { 3103 __vki_u64 op; 3104 __vki_u64 arg[5]; 3105 }; 3106 3107 struct vki_xen_privcmd_mmap_entry { 3108 __vki_u64 va; 3109 __vki_u64 mfn; 3110 __vki_u64 npages; 3111 }; 3112 3113 struct vki_xen_privcmd_mmap { 3114 int num; 3115 __vki_u16 dom; /* target domain */ 3116 struct vki_xen_privcmd_mmap_entry *entry; 3117 }; 3118 3119 struct vki_xen_privcmd_mmapbatch { 3120 int num; /* number of pages to populate */ 3121 __vki_u16 dom; /* target domain */ 3122 __vki_u64 addr; /* virtual address */ 3123 __vki_xen_pfn_t *arr; /* array of mfns - top nibble set on err */ 3124 }; 3125 3126 struct vki_xen_privcmd_mmapbatch_v2 { 3127 unsigned int num; /* number of pages to populate */ 3128 __vki_u16 dom; /* target domain */ 3129 __vki_u64 addr; /* virtual address */ 3130 const __vki_xen_pfn_t *arr; /* array of mfns */ 3131 int __user *err; /* array of error codes */ 3132 }; 3133 3134 #define VKI_XEN_IOCTL_PRIVCMD_HYPERCALL _VKI_IOC(_VKI_IOC_NONE, 'P', 0, sizeof(struct vki_xen_privcmd_hypercall)) 3135 #define VKI_XEN_IOCTL_PRIVCMD_MMAP _VKI_IOC(_VKI_IOC_NONE, 'P', 2, sizeof(struct vki_xen_privcmd_mmap)) 3136 3137 #define VKI_XEN_IOCTL_PRIVCMD_MMAPBATCH _VKI_IOC(_VKI_IOC_NONE, 'P', 3, sizeof(struct vki_xen_privcmd_mmapbatch)) 3138 #define VKI_XEN_IOCTL_PRIVCMD_MMAPBATCH_V2 _VKI_IOC(_VKI_IOC_NONE, 'P', 4, sizeof(struct vki_xen_privcmd_mmapbatch_v2)) 3139 3140 //---------------------------------------------------------------------- 3141 // From linux-3.4.0/include/linux/fs.h 3142 //---------------------------------------------------------------------- 3143 3144 struct vki_file_handle { 3145 __vki_u32 handle_bytes; 3146 int handle_type; 3147 /* file identifier */ 3148 unsigned char f_handle[0]; 3149 }; 3150 3151 //---------------------------------------------------------------------- 3152 // From linux-3.2.0/include/linux/filter.h 3153 //---------------------------------------------------------------------- 3154 3155 struct vki_sock_filter { 3156 __vki_u16 code; /* Actual filter code */ 3157 __vki_u8 jt; /* Jump true */ 3158 __vki_u8 jf; /* Jump false */ 3159 __vki_u32 k; /* Generic multiuse field */ 3160 }; 3161 3162 struct vki_sock_fprog { 3163 __vki_u16 len; /* actually unsigned short */ 3164 struct vki_sock_filter *filter; 3165 }; 3166 3167 //---------------------------------------------------------------------- 3168 // From include/linux/media.h 3169 //---------------------------------------------------------------------- 3170 3171 struct vki_media_device_info { 3172 char driver[16]; 3173 char model[32]; 3174 char serial[40]; 3175 char bus_info[32]; 3176 __vki_u32 media_version; 3177 __vki_u32 hw_revision; 3178 __vki_u32 driver_version; 3179 __vki_u32 reserved[31]; 3180 }; 3181 3182 #define VKI_MEDIA_IOC_DEVICE_INFO _VKI_IOWR('|', 0x00, struct vki_media_device_info) 3183 3184 3185 3186 #endif // __VKI_LINUX_H 3187 3188 /*--------------------------------------------------------------------*/ 3189 /*--- end ---*/ 3190 /*--------------------------------------------------------------------*/ 3191