1 /*	$NetBSD: compat_linux.h,v 1.1 2009/03/02 09:33:02 nonaka Exp $	*/
2 /*	$OpenBSD: compat_linux.h,v 1.8 2007/06/16 00:26:33 deraadt Exp $	*/
3 
4 /*
5  * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /* This file must be included late, for redefinitions to take effect. */
21 
22 #ifndef _LOCORE
23 
24 #include <sys/param.h>
25 #include <sys/termios.h>
26 #include <sys/fd_set.h>
27 struct lwp;
28 struct vnode;
29 
30 #include <compat/linux/common/linux_types.h>
31 #include <compat/linux/common/linux_fcntl.h>
32 #include <compat/linux/common/linux_util.h>
33 #include <compat/linux/common/linux_ioctl.h>
34 #include <compat/linux/common/linux_errno.h>
35 
36 #define	INT_LIMIT(x)		(~((x)1 << (sizeof(x) * 8 - 1)))
37 #define	OFFSET_MAX		INT_LIMIT(long long)
38 #define	OFFT_OFFSET_MAX		INT_LIMIT(long)
39 
40 #undef	SEEK_SET
41 #undef	SEEK_CUR
42 #define SEEK_SET		0
43 #define SEEK_CUR		1
44 
45 #define	LINUX_EOVERFLOW		75
46 
47 #endif /* !_LOCORE */
48 
49 #include <compat/linux/linux_syscall.h>
50 
51 /* linux/asm/unistd.h */
52 #define __NR_SYSCALL_BASE	0x900000
53 #define __NR_exit		(__NR_SYSCALL_BASE + LINUX_SYS_exit)
54 #define __NR_read		(__NR_SYSCALL_BASE + LINUX_SYS_read)
55 #define __NR_write		(__NR_SYSCALL_BASE + LINUX_SYS_write)
56 #define __NR_open		(__NR_SYSCALL_BASE + LINUX_SYS_open)
57 #define __NR_close		(__NR_SYSCALL_BASE + LINUX_SYS_close)
58 #define __NR_time		(__NR_SYSCALL_BASE + LINUX_SYS_time)
59 #define __NR_lseek32		(__NR_SYSCALL_BASE + LINUX_SYS_lseek)
60 #define __NR_ioctl		(__NR_SYSCALL_BASE + LINUX_SYS_ioctl)
61 #define __NR_select		(__NR_SYSCALL_BASE + LINUX_SYS_select)
62 #define __NR_stat		(__NR_SYSCALL_BASE + LINUX_SYS_stat)
63 #define __NR_syscall		(__NR_SYSCALL_BASE + 113)
64 
65 #undef	SYS_select
66 #define SYS_select		__NR_select
67