diff options
author | jhb <jhb@FreeBSD.org> | 2013-01-29 18:41:30 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2013-01-29 18:41:30 +0000 |
commit | 2617d9f095bb1dfa934ef021a7237482304fcdb9 (patch) | |
tree | 5dd2d56667d33c443b367a39778b39489a36e09c /sys/compat | |
parent | c007da37d332cc74b36ba78883813ce297764683 (diff) | |
download | FreeBSD-src-2617d9f095bb1dfa934ef021a7237482304fcdb9.zip FreeBSD-src-2617d9f095bb1dfa934ef021a7237482304fcdb9.tar.gz |
Reduce duplication between i386/linux/linux.h and amd64/linux32/linux.h
by moving bits that are MI out into headers in compat/linux.
Reviewed by: Chagin Dmitry dmitry | gmail
MFC after: 2 weeks
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linprocfs/linprocfs.c | 6 | ||||
-rw-r--r-- | sys/compat/linux/linux_emul.c | 1 | ||||
-rw-r--r-- | sys/compat/linux/linux_file.c | 1 | ||||
-rw-r--r-- | sys/compat/linux/linux_file.h | 19 | ||||
-rw-r--r-- | sys/compat/linux/linux_fork.c | 1 | ||||
-rw-r--r-- | sys/compat/linux/linux_ioctl.h | 16 | ||||
-rw-r--r-- | sys/compat/linux/linux_ipc.h | 44 | ||||
-rw-r--r-- | sys/compat/linux/linux_mib.c | 1 | ||||
-rw-r--r-- | sys/compat/linux/linux_misc.h | 48 | ||||
-rw-r--r-- | sys/compat/linux/linux_signal.h | 3 | ||||
-rw-r--r-- | sys/compat/linux/linux_socket.h | 40 | ||||
-rw-r--r-- | sys/compat/linux/linux_sysctl.c | 1 | ||||
-rw-r--r-- | sys/compat/linux/linux_time.c | 1 |
13 files changed, 175 insertions, 7 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index 31cda7d..d86da04 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -101,13 +101,9 @@ __FBSDID("$FreeBSD$"); #include <compat/freebsd32/freebsd32_util.h> #endif -#ifdef COMPAT_LINUX32 /* XXX */ -#include <machine/../linux32/linux.h> -#else -#include <machine/../linux/linux.h> -#endif #include <compat/linux/linux_ioctl.h> #include <compat/linux/linux_mib.h> +#include <compat/linux/linux_misc.h> #include <compat/linux/linux_util.h> #include <fs/pseudofs/pseudofs.h> #include <fs/procfs/procfs.h> diff --git a/sys/compat/linux/linux_emul.c b/sys/compat/linux/linux_emul.c index 6a1098d..61156ba 100644 --- a/sys/compat/linux/linux_emul.c +++ b/sys/compat/linux/linux_emul.c @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include <compat/linux/linux_dtrace.h> #include <compat/linux/linux_emul.h> #include <compat/linux/linux_futex.h> +#include <compat/linux/linux_misc.h> /** * Special DTrace provider for the linuxulator. diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index df13277..0318a5c 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include <machine/../linux/linux.h> #include <machine/../linux/linux_proto.h> #endif +#include <compat/linux/linux_misc.h> #include <compat/linux/linux_util.h> #include <compat/linux/linux_file.h> diff --git a/sys/compat/linux/linux_file.h b/sys/compat/linux/linux_file.h index d0d95ac..2d3106f 100644 --- a/sys/compat/linux/linux_file.h +++ b/sys/compat/linux/linux_file.h @@ -35,4 +35,23 @@ #define LINUX_AT_REMOVEDIR 0x200 #define LINUX_AT_SYMLINK_FOLLOW 0x400 +/* + * posix_fadvise advice + */ +#define LINUX_POSIX_FADV_NORMAL 0 +#define LINUX_POSIX_FADV_RANDOM 1 +#define LINUX_POSIX_FADV_SEQUENTIAL 2 +#define LINUX_POSIX_FADV_WILLNEED 3 +#define LINUX_POSIX_FADV_DONTNEED 4 +#define LINUX_POSIX_FADV_NOREUSE 5 + +/* + * mount flags + */ +#define LINUX_MS_RDONLY 0x0001 +#define LINUX_MS_NOSUID 0x0002 +#define LINUX_MS_NODEV 0x0004 +#define LINUX_MS_NOEXEC 0x0008 +#define LINUX_MS_REMOUNT 0x0020 + #endif /* !_LINUX_FILE_H_ */ diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c index f71063c..2103636 100644 --- a/sys/compat/linux/linux_fork.c +++ b/sys/compat/linux/linux_fork.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include <compat/linux/linux_dtrace.h> #include <compat/linux/linux_signal.h> #include <compat/linux/linux_emul.h> +#include <compat/linux/linux_misc.h> /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); diff --git a/sys/compat/linux/linux_ioctl.h b/sys/compat/linux/linux_ioctl.h index c075231..aa7650b 100644 --- a/sys/compat/linux/linux_ioctl.h +++ b/sys/compat/linux/linux_ioctl.h @@ -748,4 +748,20 @@ int linux_ifname(struct ifnet *, char *, size_t); #define FBSD_LUSB_MAX 0xffff #define FBSD_LUSB_MIN 0xffe0 +/* + * Pluggable ioctl handlers + */ +struct linux_ioctl_args; +struct thread; + +typedef int linux_ioctl_function_t(struct thread *, struct linux_ioctl_args *); + +struct linux_ioctl_handler { + linux_ioctl_function_t *func; + int low, high; +}; + +int linux_ioctl_register_handler(struct linux_ioctl_handler *h); +int linux_ioctl_unregister_handler(struct linux_ioctl_handler *h); + #endif /* !_LINUX_IOCTL_H_ */ diff --git a/sys/compat/linux/linux_ipc.h b/sys/compat/linux/linux_ipc.h index 4c01342..f1531ba 100644 --- a/sys/compat/linux/linux_ipc.h +++ b/sys/compat/linux/linux_ipc.h @@ -32,6 +32,48 @@ #define _LINUX_IPC_H_ /* + * SystemV IPC defines + */ +#define LINUX_SEMOP 1 +#define LINUX_SEMGET 2 +#define LINUX_SEMCTL 3 +#define LINUX_MSGSND 11 +#define LINUX_MSGRCV 12 +#define LINUX_MSGGET 13 +#define LINUX_MSGCTL 14 +#define LINUX_SHMAT 21 +#define LINUX_SHMDT 22 +#define LINUX_SHMGET 23 +#define LINUX_SHMCTL 24 + +#define LINUX_IPC_RMID 0 +#define LINUX_IPC_SET 1 +#define LINUX_IPC_STAT 2 +#define LINUX_IPC_INFO 3 + +#define LINUX_MSG_INFO 12 + +#define LINUX_SHM_LOCK 11 +#define LINUX_SHM_UNLOCK 12 +#define LINUX_SHM_STAT 13 +#define LINUX_SHM_INFO 14 + +#define LINUX_SHM_RDONLY 0x1000 +#define LINUX_SHM_RND 0x2000 +#define LINUX_SHM_REMAP 0x4000 + +/* semctl commands */ +#define LINUX_GETPID 11 +#define LINUX_GETVAL 12 +#define LINUX_GETALL 13 +#define LINUX_GETNCNT 14 +#define LINUX_GETZCNT 15 +#define LINUX_SETVAL 16 +#define LINUX_SETALL 17 +#define LINUX_SEM_STAT 18 +#define LINUX_SEM_INFO 19 + +/* * Version flags for semctl, msgctl, and shmctl commands * These are passed as bitflags or-ed with the actual command */ @@ -135,8 +177,6 @@ int linux_shmctl(struct thread *, struct linux_shmctl_args *); int linux_shmdt(struct thread *, struct linux_shmdt_args *); int linux_shmget(struct thread *, struct linux_shmget_args *); -#define LINUX_MSG_INFO 12 - #endif /* __i386__ || __amd64__ */ #endif /* _LINUX_IPC_H_ */ diff --git a/sys/compat/linux/linux_mib.c b/sys/compat/linux/linux_mib.c index 0856662..323a38f 100644 --- a/sys/compat/linux/linux_mib.c +++ b/sys/compat/linux/linux_mib.c @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #endif #include <compat/linux/linux_dtrace.h> #include <compat/linux/linux_mib.h> +#include <compat/linux/linux_misc.h> /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h index b771825..154d78f 100644 --- a/sys/compat/linux/linux_misc.h +++ b/sys/compat/linux/linux_misc.h @@ -31,6 +31,14 @@ #ifndef _LINUX_MISC_H_ #define _LINUX_MISC_H_ +/* + * Miscellaneous + */ +#define LINUX_NAME_MAX 255 +#define LINUX_MAX_UTSNAME 65 + +#define LINUX_CTL_MAXNAME 10 + /* defines for prctl */ #define LINUX_PR_SET_PDEATHSIG 1 /* Second arg is a signal. */ #define LINUX_PR_GET_PDEATHSIG 2 /* @@ -67,11 +75,51 @@ extern const char *linux_platform; #define __LINUX_NPXCW__ 0x37f #endif +#define LINUX_CLONE_VM 0x00000100 +#define LINUX_CLONE_FS 0x00000200 +#define LINUX_CLONE_FILES 0x00000400 +#define LINUX_CLONE_SIGHAND 0x00000800 +#define LINUX_CLONE_PID 0x00001000 /* No longer exist in Linux */ +#define LINUX_CLONE_VFORK 0x00004000 +#define LINUX_CLONE_PARENT 0x00008000 +#define LINUX_CLONE_THREAD 0x00010000 +#define LINUX_CLONE_SETTLS 0x00080000 +#define LINUX_CLONE_PARENT_SETTID 0x00100000 +#define LINUX_CLONE_CHILD_CLEARTID 0x00200000 +#define LINUX_CLONE_CHILD_SETTID 0x01000000 + +#define LINUX_THREADING_FLAGS \ + (LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES | \ + LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD) + +/* Scheduling policies */ +#define LINUX_SCHED_OTHER 0 +#define LINUX_SCHED_FIFO 1 +#define LINUX_SCHED_RR 2 + +struct l_new_utsname { + char sysname[LINUX_MAX_UTSNAME]; + char nodename[LINUX_MAX_UTSNAME]; + char release[LINUX_MAX_UTSNAME]; + char version[LINUX_MAX_UTSNAME]; + char machine[LINUX_MAX_UTSNAME]; + char domainname[LINUX_MAX_UTSNAME]; +}; + +#define LINUX_CLOCK_REALTIME 0 +#define LINUX_CLOCK_MONOTONIC 1 +#define LINUX_CLOCK_PROCESS_CPUTIME_ID 2 +#define LINUX_CLOCK_THREAD_CPUTIME_ID 3 +#define LINUX_CLOCK_REALTIME_HR 4 +#define LINUX_CLOCK_MONOTONIC_HR 5 + extern int stclohz; #define __WCLONE 0x80000000 int linux_common_wait(struct thread *td, int pid, int *status, int options, struct rusage *ru); +int linux_set_upcall_kse(struct thread *td, register_t stack); +int linux_set_cloned_tls(struct thread *td, void *desc); #endif /* _LINUX_MISC_H_ */ diff --git a/sys/compat/linux/linux_signal.h b/sys/compat/linux/linux_signal.h index 939009f..426cf43 100644 --- a/sys/compat/linux/linux_signal.h +++ b/sys/compat/linux/linux_signal.h @@ -33,6 +33,9 @@ #define LINUX_SI_TKILL -6; +extern int bsd_to_linux_signal[]; +extern int linux_to_bsd_signal[]; + void linux_to_bsd_sigset(l_sigset_t *, sigset_t *); void bsd_to_linux_sigset(sigset_t *, l_sigset_t *); int linux_do_sigaction(struct thread *, int, l_sigaction_t *, l_sigaction_t *); diff --git a/sys/compat/linux/linux_socket.h b/sys/compat/linux/linux_socket.h index 1fe53ed..e6efadb 100644 --- a/sys/compat/linux/linux_socket.h +++ b/sys/compat/linux/linux_socket.h @@ -116,4 +116,44 @@ struct l_ucred { uint32_t gid; }; +/* Operations for socketcall */ + +#define LINUX_SOCKET 1 +#define LINUX_BIND 2 +#define LINUX_CONNECT 3 +#define LINUX_LISTEN 4 +#define LINUX_ACCEPT 5 +#define LINUX_GETSOCKNAME 6 +#define LINUX_GETPEERNAME 7 +#define LINUX_SOCKETPAIR 8 +#define LINUX_SEND 9 +#define LINUX_RECV 10 +#define LINUX_SENDTO 11 +#define LINUX_RECVFROM 12 +#define LINUX_SHUTDOWN 13 +#define LINUX_SETSOCKOPT 14 +#define LINUX_GETSOCKOPT 15 +#define LINUX_SENDMSG 16 +#define LINUX_RECVMSG 17 +#define LINUX_ACCEPT4 18 + +/* Socket options */ +#define LINUX_IP_TOS 1 +#define LINUX_IP_TTL 2 +#define LINUX_IP_HDRINCL 3 +#define LINUX_IP_OPTIONS 4 + +#define LINUX_IP_MULTICAST_IF 32 +#define LINUX_IP_MULTICAST_TTL 33 +#define LINUX_IP_MULTICAST_LOOP 34 +#define LINUX_IP_ADD_MEMBERSHIP 35 +#define LINUX_IP_DROP_MEMBERSHIP 36 + +#define LINUX_TCP_NODELAY 1 +#define LINUX_TCP_MAXSEG 2 +#define LINUX_TCP_KEEPIDLE 4 +#define LINUX_TCP_KEEPINTVL 5 +#define LINUX_TCP_KEEPCNT 6 +#define LINUX_TCP_MD5SIG 14 + #endif /* _LINUX_SOCKET_H_ */ diff --git a/sys/compat/linux/linux_sysctl.c b/sys/compat/linux/linux_sysctl.c index b2c10e1..decd8f8 100644 --- a/sys/compat/linux/linux_sysctl.c +++ b/sys/compat/linux/linux_sysctl.c @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #endif #include <compat/linux/linux_dtrace.h> +#include <compat/linux/linux_misc.h> #include <compat/linux/linux_util.h> #define LINUX_CTL_KERN 1 diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index 1359025..e03af00 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -60,6 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.14 2006/05/14 03:40:54 christos Exp #endif #include <compat/linux/linux_dtrace.h> +#include <compat/linux/linux_misc.h> /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); |