1 /*- 2 * Copyright (c) 1994-1996 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer 10 * in this position and unchanged. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * $Id: linux.h,v 1.7 1996/03/10 08:42:47 sos Exp $ 29 */ 30 31 #ifndef _I386_LINUX_LINUX_H_ 32 #define _I386_LINUX_LINUX_H_ 33 #include "i386/linux/linux_syscall.h" 34 35 typedef unsigned short linux_uid_t; 36 typedef unsigned short linux_gid_t; 37 typedef unsigned short linux_dev_t; 38 typedef unsigned long linux_ino_t; 39 typedef unsigned short linux_mode_t; 40 typedef unsigned short linux_nlink_t; 41 typedef long linux_time_t; 42 typedef long linux_clock_t; 43 typedef char * linux_caddr_t; 44 typedef long linux_off_t; 45 typedef struct { 46 long val[2]; 47 } linux_fsid_t; 48 typedef int linux_pid_t; 49 typedef unsigned long linux_sigset_t; 50 typedef void (*linux_handler_t)(int); 51 typedef struct { 52 void (*sa_handler)(int); 53 linux_sigset_t sa_mask; 54 unsigned long sa_flags; 55 void (*sa_restorer)(void); 56 } linux_sigaction_t; 57 typedef int linux_key_t; 58 59 /* 60 * The Linux sigcontext, pretty much a standard 386 trapframe. 61 */ 62 63 struct linux_sigcontext { 64 int sc_gs; 65 int sc_fs; 66 int sc_es; 67 int sc_ds; 68 int sc_edi; 69 int sc_esi; 70 int sc_ebp; 71 int sc_esp; 72 int sc_ebx; 73 int sc_edx; 74 int sc_ecx; 75 int sc_eax; 76 int sc_trapno; 77 int sc_err; 78 int sc_eip; 79 int sc_cs; 80 int sc_eflags; 81 int sc_esp_at_signal; 82 int sc_ss; 83 int sc_387; 84 int sc_mask; 85 int sc_cr2; 86 }; 87 88 /* 89 * We make the stack look like Linux expects it when calling a signal 90 * handler, but use the BSD way of calling the handler and sigreturn(). 91 * This means that we need to pass the pointer to the handler too. 92 * It is appended to the frame to not interfere with the rest of it. 93 */ 94 95 struct linux_sigframe { 96 int sf_sig; 97 struct linux_sigcontext sf_sc; 98 sig_t sf_handler; 99 }; 100 101 extern int bsd_to_linux_errno[]; 102 extern int bsd_to_linux_signal[]; 103 extern int linux_to_bsd_signal[]; 104 extern char linux_sigcode[]; 105 extern int linux_szsigcode; 106 extern const char linux_emul_path[]; 107 108 extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL]; 109 extern struct sysentvec linux_sysvec; 110 extern struct sysentvec elf_linux_sysvec; 111 112 /* dummy struct definitions */ 113 struct image_params; 114 struct trapframe; 115 116 /* misc defines */ 117 #define LINUX_NAME_MAX 255 118 119 /* signal numbers */ 120 #define LINUX_SIGHUP 1 121 #define LINUX_SIGINT 2 122 #define LINUX_SIGQUIT 3 123 #define LINUX_SIGILL 4 124 #define LINUX_SIGTRAP 5 125 #define LINUX_SIGABRT 6 126 #define LINUX_SIGIOT 6 127 #define LINUX_SIGUNUSED 7 128 #define LINUX_SIGFPE 8 129 #define LINUX_SIGKILL 9 130 #define LINUX_SIGUSR1 10 131 #define LINUX_SIGSEGV 11 132 #define LINUX_SIGUSR2 12 133 #define LINUX_SIGPIPE 13 134 #define LINUX_SIGALRM 14 135 #define LINUX_SIGTERM 15 136 #define LINUX_SIGSTKFLT 16 137 #define LINUX_SIGCHLD 17 138 #define LINUX_SIGCONT 18 139 #define LINUX_SIGSTOP 19 140 #define LINUX_SIGTSTP 20 141 #define LINUX_SIGTTIN 21 142 #define LINUX_SIGTTOU 22 143 #define LINUX_SIGIO 23 144 #define LINUX_SIGPOLL LINUX_SIGIO 145 #define LINUX_SIGURG LINUX_SIGIO 146 #define LINUX_SIGXCPU 24 147 #define LINUX_SIGXFSZ 25 148 #define LINUX_SIGVTALRM 26 149 #define LINUX_SIGPROF 27 150 #define LINUX_SIGWINCH 28 151 #define LINUX_SIGLOST 29 152 #define LINUX_SIGPWR 30 153 #define LINUX_SIGBUS LINUX_SIGUNUSED 154 #define LINUX_NSIG 32 155 156 /* sigaction flags */ 157 #define LINUX_SA_NOCLDSTOP 0x00000001 158 #define LINUX_SA_ONSTACK 0x08000000 159 #define LINUX_SA_RESTART 0x10000000 160 #define LINUX_SA_INTERRUPT 0x20000000 161 #define LINUX_SA_NOMASK 0x40000000 162 #define LINUX_SA_ONESHOT 0x80000000 163 164 /* sigprocmask actions */ 165 #define LINUX_SIG_BLOCK 0 166 #define LINUX_SIG_UNBLOCK 1 167 #define LINUX_SIG_SETMASK 2 168 169 /* termio commands */ 170 #define LINUX_TCGETS 0x5401 171 #define LINUX_TCSETS 0x5402 172 #define LINUX_TCSETSW 0x5403 173 #define LINUX_TCSETSF 0x5404 174 #define LINUX_TCGETA 0x5405 175 #define LINUX_TCSETA 0x5406 176 #define LINUX_TCSETAW 0x5407 177 #define LINUX_TCSETAF 0x5408 178 #define LINUX_TCSBRK 0x5409 179 #define LINUX_TCXONC 0x540A 180 #define LINUX_TCFLSH 0x540B 181 #define LINUX_TIOCEXCL 0x540C 182 #define LINUX_TIOCNXCL 0x540D 183 #define LINUX_TIOCSCTTY 0x540E 184 #define LINUX_TIOCGPGRP 0x540F 185 #define LINUX_TIOCSPGRP 0x5410 186 #define LINUX_TIOCOUTQ 0x5411 187 #define LINUX_TIOCSTI 0x5412 188 #define LINUX_TIOCGWINSZ 0x5413 189 #define LINUX_TIOCSWINSZ 0x5414 190 #define LINUX_TIOCMGET 0x5415 191 #define LINUX_TIOCMBIS 0x5416 192 #define LINUX_TIOCMBIC 0x5417 193 #define LINUX_TIOCMSET 0x5418 194 #define LINUX_TIOCGSOFTCAR 0x5419 195 #define LINUX_TIOCSSOFTCAR 0x541A 196 #define LINUX_FIONREAD 0x541B 197 #define LINUX_TIOCINQ FIONREAD 198 #define LINUX_TIOCLINUX 0x541C 199 #define LINUX_TIOCCONS 0x541D 200 #define LINUX_TIOCGSERIAL 0x541E 201 #define LINUX_TIOCSSERIAL 0x541F 202 #define LINUX_TIOCPKT 0x5420 203 #define LINUX_FIONBIO 0x5421 204 #define LINUX_TIOCNOTTY 0x5422 205 #define LINUX_TIOCSETD 0x5423 206 #define LINUX_TIOCGETD 0x5424 207 #define LINUX_TCSBRKP 0x5425 208 #define LINUX_TIOCTTYGSTRUCT 0x5426 209 #define LINUX_FIONCLEX 0x5450 210 #define LINUX_FIOCLEX 0x5451 211 #define LINUX_FIOASYNC 0x5452 212 #define LINUX_TIOCSERCONFIG 0x5453 213 #define LINUX_TIOCSERGWILD 0x5454 214 #define LINUX_TIOCSERSWILD 0x5455 215 #define LINUX_TIOCGLCKTRMIOS 0x5456 216 #define LINUX_TIOCSLCKTRMIOS 0x5457 217 218 /* arguments for tcflush() and LINUX_TCFLSH */ 219 #define LINUX_TCIFLUSH 0 220 #define LINUX_TCOFLUSH 1 221 #define LINUX_TCIOFLUSH 2 222 223 /* line disciplines */ 224 #define LINUX_N_TTY 0 225 #define LINUX_N_SLIP 1 226 #define LINUX_N_MOUSE 2 227 #define LINUX_N_PPP 3 228 229 /* Linux termio c_cc values */ 230 #define LINUX_VINTR 0 231 #define LINUX_VQUIT 1 232 #define LINUX_VERASE 2 233 #define LINUX_VKILL 3 234 #define LINUX_VEOF 4 235 #define LINUX_VTIME 5 236 #define LINUX_VMIN 6 237 #define LINUX_VSWTC 7 238 #define LINUX_NCC 8 239 240 /* Linux termios c_cc values */ 241 #define LINUX_VSTART 8 242 #define LINUX_VSTOP 9 243 #define LINUX_VSUSP 10 244 #define LINUX_VEOL 11 245 #define LINUX_VREPRINT 12 246 #define LINUX_VDISCARD 13 247 #define LINUX_VWERASE 14 248 #define LINUX_VLNEXT 15 249 #define LINUX_VEOL2 16 250 #define LINUX_NCCS 19 251 252 #define LINUX_POSIX_VDISABLE '\0' 253 254 /* Linux c_iflag masks */ 255 #define LINUX_IGNBRK 0x0000001 256 #define LINUX_BRKINT 0x0000002 257 #define LINUX_IGNPAR 0x0000004 258 #define LINUX_PARMRK 0x0000008 259 #define LINUX_INPCK 0x0000010 260 #define LINUX_ISTRIP 0x0000020 261 #define LINUX_INLCR 0x0000040 262 #define LINUX_IGNCR 0x0000080 263 #define LINUX_ICRNL 0x0000100 264 #define LINUX_IUCLC 0x0000200 265 #define LINUX_IXON 0x0000400 266 #define LINUX_IXANY 0x0000800 267 #define LINUX_IXOFF 0x0001000 268 #define LINUX_IMAXBEL 0x0002000 269 270 /* Linux c_oflag masks */ 271 #define LINUX_OPOST 0x0000001 272 #define LINUX_OLCUC 0x0000002 273 #define LINUX_ONLCR 0x0000004 274 #define LINUX_OCRNL 0x0000008 275 #define LINUX_ONOCR 0x0000010 276 #define LINUX_ONLRET 0x0000020 277 #define LINUX_OFILL 0x0000040 278 #define LINUX_OFDEL 0x0000080 279 #define LINUX_NLDLY 0x0000100 280 281 #define LINUX_NL0 0x0000000 282 #define LINUX_NL1 0x0000100 283 #define LINUX_CRDLY 0x0000600 284 #define LINUX_CR0 0x0000000 285 #define LINUX_CR1 0x0000200 286 #define LINUX_CR2 0x0000400 287 #define LINUX_CR3 0x0000600 288 #define LINUX_TABDLY 0x0001800 289 #define LINUX_TAB0 0x0000000 290 #define LINUX_TAB1 0x0000800 291 #define LINUX_TAB2 0x0001000 292 #define LINUX_TAB3 0x0001800 293 #define LINUX_XTABS 0x0001800 294 #define LINUX_BSDLY 0x0002000 295 #define LINUX_BS0 0x0000000 296 #define LINUX_BS1 0x0002000 297 #define LINUX_VTDLY 0x0004000 298 #define LINUX_VT0 0x0000000 299 #define LINUX_VT1 0x0004000 300 #define LINUX_FFDLY 0x0008000 301 #define LINUX_FF0 0x0000000 302 #define LINUX_FF1 0x0008000 303 304 #define LINUX_CBAUD 0x0000100f 305 #define LINUX_B0 0x00000000 306 #define LINUX_B50 0x00000001 307 #define LINUX_B75 0x00000002 308 #define LINUX_B110 0x00000003 309 #define LINUX_B134 0x00000004 310 #define LINUX_B150 0x00000005 311 #define LINUX_B200 0x00000006 312 #define LINUX_B300 0x00000007 313 #define LINUX_B600 0x00000008 314 #define LINUX_B1200 0x00000009 315 #define LINUX_B1800 0x0000000a 316 #define LINUX_B2400 0x0000000b 317 #define LINUX_B4800 0x0000000c 318 #define LINUX_B9600 0x0000000d 319 #define LINUX_B19200 0x0000000e 320 #define LINUX_B38400 0x0000000f 321 #define LINUX_EXTA LINUX_B19200 322 #define LINUX_EXTB LINUX_B38400 323 #define LINUX_CBAUDEX 0x00001000 324 #define LINUX_B57600 0x00001001 325 #define LINUX_B115200 0x00001002 326 327 #define LINUX_CSIZE 0x00000030 328 #define LINUX_CS5 0x00000000 329 #define LINUX_CS6 0x00000010 330 #define LINUX_CS7 0x00000020 331 #define LINUX_CS8 0x00000030 332 #define LINUX_CSTOPB 0x00000040 333 #define LINUX_CREAD 0x00000080 334 #define LINUX_PARENB 0x00000100 335 #define LINUX_PARODD 0x00000200 336 #define LINUX_HUPCL 0x00000400 337 #define LINUX_CLOCAL 0x00000800 338 #define LINUX_CRTSCTS 0x80000000 339 340 /* Linux c_lflag masks */ 341 #define LINUX_ISIG 0x00000001 342 #define LINUX_ICANON 0x00000002 343 #define LINUX_XCASE 0x00000004 344 #define LINUX_ECHO 0x00000008 345 #define LINUX_ECHOE 0x00000010 346 #define LINUX_ECHOK 0x00000020 347 #define LINUX_ECHONL 0x00000040 348 #define LINUX_NOFLSH 0x00000080 349 #define LINUX_TOSTOP 0x00000100 350 #define LINUX_ECHOCTL 0x00000200 351 #define LINUX_ECHOPRT 0x00000400 352 #define LINUX_ECHOKE 0x00000800 353 #define LINUX_FLUSHO 0x00001000 354 #define LINUX_PENDIN 0x00002000 355 #define LINUX_IEXTEN 0x00008000 356 357 /* open/fcntl flags */ 358 #define LINUX_O_RDONLY 00 359 #define LINUX_O_WRONLY 01 360 #define LINUX_O_RDWR 02 361 #define LINUX_O_CREAT 0100 362 #define LINUX_O_EXCL 0200 363 #define LINUX_O_NOCTTY 0400 364 #define LINUX_O_TRUNC 01000 365 #define LINUX_O_APPEND 02000 366 #define LINUX_O_NONBLOCK 04000 367 #define LINUX_O_NDELAY LINUX_O_NONBLOCK 368 #define LINUX_O_SYNC 010000 369 #define LINUX_FASYNC 020000 370 371 /* fcntl flags */ 372 #define LINUX_F_DUPFD 0 373 #define LINUX_F_GETFD 1 374 #define LINUX_F_SETFD 2 375 #define LINUX_F_GETFL 3 376 #define LINUX_F_SETFL 4 377 #define LINUX_F_GETLK 5 378 #define LINUX_F_SETLK 6 379 #define LINUX_F_SETLKW 7 380 #define LINUX_F_SETOWN 8 381 #define LINUX_F_GETOWN 9 382 383 #define LINUX_F_RDLCK 0 384 #define LINUX_F_WRLCK 1 385 #define LINUX_F_UNLCK 2 386 387 /* mmap options */ 388 #define LINUX_MAP_SHARED 0x0001 389 #define LINUX_MAP_PRIVATE 0x0002 390 #define LINUX_MAP_FIXED 0x0010 391 #define LINUX_MAP_ANON 0x0020 392 393 /* SystemV ipc defines */ 394 #define LINUX_SEMOP 1 395 #define LINUX_SEMGET 2 396 #define LINUX_SEMCTL 3 397 #define LINUX_MSGSND 11 398 #define LINUX_MSGRCV 12 399 #define LINUX_MSGGET 13 400 #define LINUX_MSGCTL 14 401 #define LINUX_SHMAT 21 402 #define LINUX_SHMDT 22 403 #define LINUX_SHMGET 23 404 #define LINUX_SHMCTL 24 405 406 #define LINUX_IPC_RMID 0 407 #define LINUX_IPC_SET 1 408 #define LINUX_IPC_STAT 2 409 #define LINUX_IPC_INFO 3 410 411 #define LINUX_SHM_LOCK 11 412 #define LINUX_SHM_UNLOCK 12 413 #define LINUX_SHM_STAT 13 414 #define LINUX_SHM_INFO 14 415 416 #define LINUX_SHM_RDONLY 0x1000 417 #define LINUX_SHM_RND 0x2000 418 #define LINUX_SHM_REMAP 0x4000 419 420 /* Socket defines */ 421 #define LINUX_SOCKET 1 422 #define LINUX_BIND 2 423 #define LINUX_CONNECT 3 424 #define LINUX_LISTEN 4 425 #define LINUX_ACCEPT 5 426 #define LINUX_GETSOCKNAME 6 427 #define LINUX_GETPEERNAME 7 428 #define LINUX_SOCKETPAIR 8 429 #define LINUX_SEND 9 430 #define LINUX_RECV 10 431 #define LINUX_SENDTO 11 432 #define LINUX_RECVFROM 12 433 #define LINUX_SHUTDOWN 13 434 #define LINUX_SETSOCKOPT 14 435 #define LINUX_GETSOCKOPT 15 436 437 #define LINUX_AF_UNSPEC 0 438 #define LINUX_AF_UNIX 1 439 #define LINUX_AF_INET 2 440 #define LINUX_AF_AX25 3 441 #define LINUX_AF_IPX 4 442 #define LINUX_AF_APPLETALK 5 443 444 #define LINUX_SOL_SOCKET 1 445 #define LINUX_SOL_IP 0 446 #define LINUX_SOL_IPX 256 447 #define LINUX_SOL_AX25 257 448 #define LINUX_SOL_TCP 6 449 #define LINUX_SOL_UDP 17 450 451 #define LINUX_SO_DEBUG 1 452 #define LINUX_SO_REUSEADDR 2 453 #define LINUX_SO_TYPE 3 454 #define LINUX_SO_ERROR 4 455 #define LINUX_SO_DONTROUTE 5 456 #define LINUX_SO_BROADCAST 6 457 #define LINUX_SO_SNDBUF 7 458 #define LINUX_SO_RCVBUF 8 459 #define LINUX_SO_KEEPALIVE 9 460 #define LINUX_SO_OOBINLINE 10 461 #define LINUX_SO_NO_CHECK 11 462 #define LINUX_SO_PRIORITY 12 463 #define LINUX_SO_LINGER 13 464 465 #define LINUX_IP_TOS 1 466 #define LINUX_IP_TTL 2 467 468 /* Sound system defines */ 469 #define LINUX_SNDCTL_DSP_RESET 0x5000 470 #define LINUX_SNDCTL_DSP_SYNC 0x5001 471 #define LINUX_SNDCTL_DSP_SPEED 0x5002 472 #define LINUX_SNDCTL_DSP_STEREO 0x5003 473 #define LINUX_SNDCTL_DSP_GETBLKSIZE 0x5004 474 #define LINUX_SNDCTL_DSP_SETBLKSIZE 0x5004 475 #define LINUX_SNDCTL_DSP_SETFMT 0x5005 476 #define LINUX_SOUND_PCM_WRITE_CHANNELS 0x5006 477 #define LINUX_SOUND_PCM_WRITE_FILTER 0x5007 478 #define LINUX_SNDCTL_DSP_POST 0x5008 479 #define LINUX_SNDCTL_DSP_SUBDIVIDE 0x5009 480 #define LINUX_SNDCTL_DSP_SETFRAGMENT 0x500A 481 #define LINUX_SNDCTL_DSP_GETFMTS 0x500B 482 #define LINUX_SNDCTL_DSP_GETOSPACE 0x500C 483 #define LINUX_SNDCTL_DSP_GETISPACE 0x500D 484 #define LINUX_SNDCTL_DSP_NONBLOCK 0x500E 485 486 /* Socket system defines */ 487 #define LINUX_SIOCGIFCONF 0x8912 488 #define LINUX_SIOCGIFFLAGS 0x8913 489 #define LINUX_SIOCGIFADDR 0x8915 490 #define LINUX_SIOCGIFDSTADDR 0x8917 491 #define LINUX_SIOCGIFBRDADDR 0x8919 492 #define LINUX_SIOCGIFNETMASK 0x891b 493 #define LINUX_SIOCADDMULTI 0x8931 494 #define LINUX_SIOCDELMULTI 0x8932 495 496 /* serial_struct values for TIOC[GS]SERIAL ioctls */ 497 #define LINUX_ASYNC_CLOSING_WAIT_INF 0 498 #define LINUX_ASYNC_CLOSING_WAIT_NONE 65535 499 500 #define LINUX_PORT_UNKNOWN 0 501 #define LINUX_PORT_8250 1 502 #define LINUX_PORT_16450 2 503 #define LINUX_PORT_16550 3 504 #define LINUX_PORT_16550A 4 505 #define LINUX_PORT_CIRRUS 5 506 #define LINUX_PORT_16650 6 507 #define LINUX_PORT_MAX 6 508 509 #define LINUX_ASYNC_HUP_NOTIFY 0x0001 510 #define LINUX_ASYNC_FOURPORT 0x0002 511 #define LINUX_ASYNC_SAK 0x0004 512 #define LINUX_ASYNC_SPLIT_TERMIOS 0x0008 513 #define LINUX_ASYNC_SPD_MASK 0x0030 514 #define LINUX_ASYNC_SPD_HI 0x0010 515 #define LINUX_ASYNC_SPD_VHI 0x0020 516 #define LINUX_ASYNC_SPD_CUST 0x0030 517 #define LINUX_ASYNC_SKIP_TEST 0x0040 518 #define LINUX_ASYNC_AUTO_IRQ 0x0080 519 #define LINUX_ASYNC_SESSION_LOCKOUT 0x0100 520 #define LINUX_ASYNC_PGRP_LOCKOUT 0x0200 521 #define LINUX_ASYNC_CALLOUT_NOHUP 0x0400 522 #define LINUX_ASYNC_FLAGS 0x0FFF 523 524 525 #endif /* !_I386_LINUX_LINUX_H_ */ 526