aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2007-03-02 00:08:47 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2007-03-02 00:08:47 +0000
commita4e3bad794e41d2d5362743924bd356d76d8e5a9 (patch)
tree76f3354eaac42ce1077343edb09d5f39cf288b70
parent5f87dd698c09408e51e4cc31946117003debf270 (diff)
downloadsrc-a4e3bad794e41d2d5362743924bd356d76d8e5a9.tar.gz
src-a4e3bad794e41d2d5362743924bd356d76d8e5a9.zip
MFP4: 115220, 115222
- Fix style(9) and reduce diff between amd64 and i386. - Prefix Linuxulator macros with LINUX_ to prevent future collision.
Notes
Notes: svn path=/head/; revision=167157
-rw-r--r--sys/amd64/linux32/linux.h333
-rw-r--r--sys/amd64/linux32/linux32_machdep.c24
-rw-r--r--sys/compat/linux/linux_emul.c4
-rw-r--r--sys/i386/linux/linux.h310
-rw-r--r--sys/i386/linux/linux_machdep.c52
5 files changed, 371 insertions, 352 deletions
diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h
index 2851537d6d8c..cf9b14c47537 100644
--- a/sys/amd64/linux32/linux.h
+++ b/sys/amd64/linux32/linux.h
@@ -8,7 +8,7 @@
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer
+ * notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
@@ -30,8 +30,8 @@
* $FreeBSD$
*/
-#ifndef _AMD64_LINUX_LINUX_H_
-#define _AMD64_LINUX_LINUX_H_
+#ifndef _AMD64_LINUX_H_
+#define _AMD64_LINUX_H_
#include <amd64/linux32/linux32_syscall.h>
@@ -39,20 +39,20 @@
* debugging support
*/
extern u_char linux_debug_map[];
-#define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
-#define ARGS(nm, fmt) "linux(%ld): "#nm"("fmt")\n", (long)td->td_proc->p_pid
-#define LMSG(fmt) "linux(%ld): "fmt"\n", (long)td->td_proc->p_pid
+#define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
+#define ARGS(nm, fmt) "linux(%ld): "#nm"("fmt")\n", (long)td->td_proc->p_pid
+#define LMSG(fmt) "linux(%ld): "fmt"\n", (long)td->td_proc->p_pid
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_LINUX);
#endif
-#define LINUX32_USRSTACK ((1ul << 32) - PAGE_SIZE)
+#define LINUX32_USRSTACK ((1ul << 32) - PAGE_SIZE)
/* XXX 16 = sizeof(linux32_ps_strings) */
-#define LINUX32_PS_STRINGS (LINUX32_USRSTACK - 16)
-#define LINUX32_MAXDSIZ (512*1024*1024) /* 512MB */
-#define LINUX32_MAXSSIZ (64*1024*1024) /* 64MB */
-#define LINUX32_MAXVMEM 0 /* Unlimited */
+#define LINUX32_PS_STRINGS (LINUX32_USRSTACK - 16)
+#define LINUX32_MAXDSIZ (512 * 1024 * 1024) /* 512MB */
+#define LINUX32_MAXSSIZ (64 * 1024 * 1024) /* 64MB */
+#define LINUX32_MAXVMEM 0 /* Unlimited */
#define PTRIN(v) (void *)(uintptr_t)(v)
#define PTROUT(v) (l_uintptr_t)(uintptr_t)(v)
@@ -132,7 +132,7 @@ struct l___sysctl_args
#define LINUX_RLIMIT_NPROC 6
#define LINUX_RLIMIT_NOFILE 7
#define LINUX_RLIMIT_MEMLOCK 8
-#define LINUX_RLIMIT_AS 9 /* address space limit */
+#define LINUX_RLIMIT_AS 9 /* Address space limit */
#define LINUX_RLIM_NLIMITS 10
@@ -205,21 +205,21 @@ struct l_newstat {
} __packed;
struct l_stat {
- l_ushort st_dev;
- l_ulong st_ino;
- l_ushort st_mode;
- l_ushort st_nlink;
- l_ushort st_uid;
- l_ushort st_gid;
- l_ushort st_rdev;
- l_long st_size;
- struct l_timespec st_atimespec;
- struct l_timespec st_mtimespec;
- struct l_timespec st_ctimespec;
- l_long st_blksize;
- l_long st_blocks;
- l_ulong st_flags;
- l_ulong st_gen;
+ l_ushort st_dev;
+ l_ulong st_ino;
+ l_ushort st_mode;
+ l_ushort st_nlink;
+ l_ushort st_uid;
+ l_ushort st_gid;
+ l_ushort st_rdev;
+ l_long st_size;
+ struct l_timespec st_atimespec;
+ struct l_timespec st_mtimespec;
+ struct l_timespec st_ctimespec;
+ l_long st_blksize;
+ l_long st_blocks;
+ l_ulong st_flags;
+ l_ulong st_gen;
};
struct l_stat64 {
@@ -315,9 +315,9 @@ struct l_new_utsname {
#define LINUX_SIGADDSET(set, sig) SIGADDSET(set, sig)
/* sigaltstack */
-#define LINUX_MINSIGSTKSZ 2048
-#define LINUX_SS_ONSTACK 1
-#define LINUX_SS_DISABLE 2
+#define LINUX_MINSIGSTKSZ 2048
+#define LINUX_SS_ONSTACK 1
+#define LINUX_SS_DISABLE 2
int linux_to_bsd_sigaltstack(int lsa);
int bsd_to_linux_sigaltstack(int bsa);
@@ -380,11 +380,11 @@ struct l_ucontext {
l_uintptr_t uc_link;
l_stack_t uc_stack;
struct l_sigcontext uc_mcontext;
- l_sigset_t uc_sigmask;
+ l_sigset_t uc_sigmask;
} __packed;
-#define LINUX_SI_MAX_SIZE 128
-#define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE/sizeof(l_int)) - 3)
+#define LINUX_SI_MAX_SIZE 128
+#define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE/sizeof(l_int)) - 3)
union l_sigval {
l_int sival_int;
@@ -423,41 +423,41 @@ typedef struct l_siginfo {
} __packed _sigchld;
struct {
- l_uintptr_t _addr; /* faulting insn/memory ref. */
+ l_uintptr_t _addr; /* Faulting insn/memory ref. */
} __packed _sigfault;
struct {
- l_int _band; /* POLL_IN,POLL_OUT,POLL_MSG */
+ l_int _band; /* POLL_IN,POLL_OUT,POLL_MSG */
l_int _fd;
} __packed _sigpoll;
} _sifields;
} __packed l_siginfo_t;
-#define lsi_pid _sifields._kill._pid
-#define lsi_uid _sifields._kill._uid
-#define lsi_status _sifields._sigchld._status
-#define lsi_utime _sifields._sigchld._utime
-#define lsi_stime _sifields._sigchld._stime
-#define lsi_value _sifields._rt._sigval
-#define lsi_int _sifields._rt._sigval.sival_int
-#define lsi_ptr _sifields._rt._sigval.sival_ptr
-#define lsi_addr _sifields._sigfault._addr
-#define lsi_band _sifields._sigpoll._band
-#define lsi_fd _sifields._sigpoll._fd
+#define lsi_pid _sifields._kill._pid
+#define lsi_uid _sifields._kill._uid
+#define lsi_status _sifields._sigchld._status
+#define lsi_utime _sifields._sigchld._utime
+#define lsi_stime _sifields._sigchld._stime
+#define lsi_value _sifields._rt._sigval
+#define lsi_int _sifields._rt._sigval.sival_int
+#define lsi_ptr _sifields._rt._sigval.sival_ptr
+#define lsi_addr _sifields._sigfault._addr
+#define lsi_band _sifields._sigpoll._band
+#define lsi_fd _sifields._sigpoll._fd
struct l_fpreg {
- u_int16_t significand[4];
- u_int16_t exponent;
+ u_int16_t significand[4];
+ u_int16_t exponent;
} __packed;
struct l_fpxreg {
- u_int16_t significand[4];
- u_int16_t exponent;
- u_int16_t padding[3];
+ u_int16_t significand[4];
+ u_int16_t exponent;
+ u_int16_t padding[3];
} __packed;
struct l_xmmreg {
- u_int32_t element[4];
+ u_int32_t element[4];
} __packed;
struct l_fpstate {
@@ -471,13 +471,13 @@ struct l_fpstate {
u_int32_t datasel;
struct l_fpreg _st[8];
u_int16_t status;
- u_int16_t magic; /* 0xffff = regular FPU data */
+ u_int16_t magic; /* 0xffff = regular FPU data */
/* FXSR FPU environment */
- u_int32_t _fxsr_env[6]; /* env is ignored */
+ u_int32_t _fxsr_env[6]; /* env is ignored. */
u_int32_t mxcsr;
u_int32_t reserved;
- struct l_fpxreg _fxsr_st[8]; /* reg data is ignored */
+ struct l_fpxreg _fxsr_st[8]; /* reg data is ignored. */
struct l_xmmreg _xmm[8];
u_int32_t padding[56];
} __packed;
@@ -528,22 +528,22 @@ int linux_ioctl_unregister_handler(struct linux_ioctl_handler *h);
/*
* open/fcntl flags
*/
-#define LINUX_O_RDONLY 00
-#define LINUX_O_WRONLY 01
-#define LINUX_O_RDWR 02
-#define LINUX_O_CREAT 0100
-#define LINUX_O_EXCL 0200
-#define LINUX_O_NOCTTY 0400
-#define LINUX_O_TRUNC 01000
-#define LINUX_O_APPEND 02000
-#define LINUX_O_NONBLOCK 04000
+#define LINUX_O_RDONLY 00000000
+#define LINUX_O_WRONLY 00000001
+#define LINUX_O_RDWR 00000002
+#define LINUX_O_CREAT 00000100
+#define LINUX_O_EXCL 00000200
+#define LINUX_O_NOCTTY 00000400
+#define LINUX_O_TRUNC 00001000
+#define LINUX_O_APPEND 00002000
+#define LINUX_O_NONBLOCK 00004000
#define LINUX_O_NDELAY LINUX_O_NONBLOCK
-#define LINUX_O_SYNC 010000
-#define LINUX_FASYNC 020000
-#define LINUX_O_DIRECT 040000 /* direct disk access hint */
-#define LINUX_O_LARGEFILE 0100000
-#define LINUX_O_DIRECTORY 0200000 /* must be a directory */
-#define LINUX_O_NOFOLLOW 0400000 /* don't follow links */
+#define LINUX_O_SYNC 00010000
+#define LINUX_FASYNC 00020000
+#define LINUX_O_DIRECT 00040000 /* Direct disk access hint */
+#define LINUX_O_LARGEFILE 00100000
+#define LINUX_O_DIRECTORY 00200000 /* Must be a directory */
+#define LINUX_O_NOFOLLOW 00400000 /* Do not follow links */
#define LINUX_O_NOATIME 01000000
#define LINUX_F_DUPFD 0
@@ -568,12 +568,12 @@ int linux_ioctl_unregister_handler(struct linux_ioctl_handler *h);
/*
* 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
-
+#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
+
/*
* SystemV IPC defines
*/
@@ -671,13 +671,13 @@ union l_semun {
#define LINUX_SO_NO_CHECK 11
#define LINUX_SO_PRIORITY 12
#define LINUX_SO_LINGER 13
-#define LINUX_SO_PEERCRED 17
-#define LINUX_SO_RCVLOWAT 18
-#define LINUX_SO_SNDLOWAT 19
-#define LINUX_SO_RCVTIMEO 20
-#define LINUX_SO_SNDTIMEO 21
-#define LINUX_SO_TIMESTAMP 29
-#define LINUX_SO_ACCEPTCONN 30
+#define LINUX_SO_PEERCRED 17
+#define LINUX_SO_RCVLOWAT 18
+#define LINUX_SO_SNDLOWAT 19
+#define LINUX_SO_RCVTIMEO 20
+#define LINUX_SO_SNDTIMEO 21
+#define LINUX_SO_TIMESTAMP 29
+#define LINUX_SO_ACCEPTCONN 30
#define LINUX_IP_TOS 1
#define LINUX_IP_TTL 2
@@ -727,7 +727,7 @@ struct l_ifreq {
} ifr_ifru;
} __packed;
-#define ifr_name ifr_ifrn.ifrn_name /* interface name */
+#define ifr_name ifr_ifrn.ifrn_name /* Interface name */
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
struct l_ifconf {
@@ -774,89 +774,96 @@ struct l_user_desc {
l_uint useable:1;
};
-struct l_desc_struct {
- unsigned long a,b;
-};
-
+#define LINUX_LOWERWORD 0x0000ffff
-#define LINUX_LOWERWORD 0x0000ffff
+/*
+ * Macros which does the same thing as those in Linux include/asm-um/ldt-i386.h.
+ * These convert Linux user space descriptor to machine one.
+ */
+#define LINUX_LDT_entry_a(info) \
+ ((((info)->base_addr & LINUX_LOWERWORD) << 16) | \
+ ((info)->limit & LINUX_LOWERWORD))
+
+#define LINUX_ENTRY_B_READ_EXEC_ONLY 9
+#define LINUX_ENTRY_B_CONTENTS 10
+#define LINUX_ENTRY_B_SEG_NOT_PRESENT 15
+#define LINUX_ENTRY_B_BASE_ADDR 16
+#define LINUX_ENTRY_B_USEABLE 20
+#define LINUX_ENTRY_B_SEG32BIT 22
+#define LINUX_ENTRY_B_LIMIT 23
+
+#define LINUX_LDT_entry_b(info) \
+ (((info)->base_addr & 0xff000000) | \
+ ((info)->limit & 0xf0000) | \
+ ((info)->contents << LINUX_ENTRY_B_CONTENTS) | \
+ (((info)->seg_not_present == 0) << LINUX_ENTRY_B_SEG_NOT_PRESENT) | \
+ (((info)->base_addr & 0x00ff0000) >> LINUX_ENTRY_B_BASE_ADDR) | \
+ (((info)->read_exec_only == 0) << LINUX_ENTRY_B_READ_EXEC_ONLY) | \
+ ((info)->seg_32bit << LINUX_ENTRY_B_SEG32BIT) | \
+ ((info)->useable << LINUX_ENTRY_B_USEABLE) | \
+ ((info)->limit_in_pages << LINUX_ENTRY_B_LIMIT) | 0x7000)
+
+#define LINUX_LDT_empty(info) \
+ ((info)->base_addr == 0 && \
+ (info)->limit == 0 && \
+ (info)->contents == 0 && \
+ (info)->seg_not_present == 1 && \
+ (info)->read_exec_only == 1 && \
+ (info)->seg_32bit == 0 && \
+ (info)->limit_in_pages == 0 && \
+ (info)->useable == 0)
-/*
- * macros which does the same thing as those in linux include/asm-um/ldt-i386.h
- * these convert linux user space descriptor to machine one
+/*
+ * Macros for converting segments.
+ * They do the same as those in arch/i386/kernel/process.c in Linux.
*/
-#define LDT_entry_a(info) \
- ((((info)->base_addr & LINUX_LOWERWORD) << 16) | ((info)->limit & LINUX_LOWERWORD))
-
-#define ENTRY_B_READ_EXEC_ONLY 9
-#define ENTRY_B_CONTENTS 10
-#define ENTRY_B_SEG_NOT_PRESENT 15
-#define ENTRY_B_BASE_ADDR 16
-#define ENTRY_B_USEABLE 20
-#define ENTRY_B_SEG32BIT 22
-#define ENTRY_B_LIMIT 23
-
-#define LDT_entry_b(info) \
- (((info)->base_addr & 0xff000000) | \
- ((info)->limit & 0xf0000) | \
- ((info)->contents << ENTRY_B_CONTENTS) | \
- (((info)->seg_not_present == 0) << ENTRY_B_SEG_NOT_PRESENT) | \
- (((info)->base_addr & 0x00ff0000) >> ENTRY_B_BASE_ADDR) | \
- (((info)->read_exec_only == 0) << ENTRY_B_READ_EXEC_ONLY) | \
- ((info)->seg_32bit << ENTRY_B_SEG32BIT) | \
- ((info)->useable << ENTRY_B_USEABLE) | \
- ((info)->limit_in_pages << ENTRY_B_LIMIT) | 0x7000)
-
-#define LDT_empty(info) (\
- (info)->base_addr == 0 && \
- (info)->limit == 0 && \
- (info)->contents == 0 && \
- (info)->seg_not_present == 1 && \
- (info)->read_exec_only == 1 && \
- (info)->seg_32bit == 0 && \
- (info)->limit_in_pages == 0 && \
- (info)->useable == 0 )
-
-/* macros for converting segments, they do the same as those in arch/i386/kernel/process.c */
-#define GET_BASE(desc) ( \
- (((desc)->a >> 16) & LINUX_LOWERWORD) | \
- (((desc)->b << 16) & 0x00ff0000) | \
- ( (desc)->b & 0xff000000) )
-
-#define GET_LIMIT(desc) ( \
- ((desc)->a & LINUX_LOWERWORD) | \
- ((desc)->b & 0xf0000) )
-
-#define GET_32BIT(desc) (((desc)->b >> ENTRY_B_SEG32BIT) & 1)
-#define GET_CONTENTS(desc) (((desc)->b >> ENTRY_B_CONTENTS) & 3)
-#define GET_WRITABLE(desc) (((desc)->b >> ENTRY_B_READ_EXEC_ONLY) & 1)
-#define GET_LIMIT_PAGES(desc) (((desc)->b >> ENTRY_B_LIMIT) & 1)
-#define GET_PRESENT(desc) (((desc)->b >> ENTRY_B_SEG_NOT_PRESENT) & 1)
-#define GET_USEABLE(desc) (((desc)->b >> ENTRY_B_USEABLE) & 1)
-
-#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
+#define LINUX_GET_BASE(desc) \
+ ((((desc)->a >> 16) & LINUX_LOWERWORD) | \
+ (((desc)->b << 16) & 0x00ff0000) | \
+ ((desc)->b & 0xff000000))
+
+#define LINUX_GET_LIMIT(desc) \
+ (((desc)->a & LINUX_LOWERWORD) | \
+ ((desc)->b & 0xf0000))
+
+#define LINUX_GET_32BIT(desc) \
+ (((desc)->b >> LINUX_ENTRY_B_SEG32BIT) & 1)
+#define LINUX_GET_CONTENTS(desc) \
+ (((desc)->b >> LINUX_ENTRY_B_CONTENTS) & 3)
+#define LINUX_GET_WRITABLE(desc) \
+ (((desc)->b >> LINUX_ENTRY_B_READ_EXEC_ONLY) & 1)
+#define LINUX_GET_LIMIT_PAGES(desc) \
+ (((desc)->b >> LINUX_ENTRY_B_LIMIT) & 1)
+#define LINUX_GET_PRESENT(desc) \
+ (((desc)->b >> LINUX_ENTRY_B_SEG_NOT_PRESENT) & 1)
+#define LINUX_GET_USEABLE(desc) \
+ (((desc)->b >> LINUX_ENTRY_B_USEABLE) & 1)
+
+#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
typedef int l_timer_t;
typedef int l_mqd_t;
-#define CLONE_VM 0x100
-#define CLONE_FS 0x200
-#define CLONE_FILES 0x400
-#define CLONE_SIGHAND 0x800
-#define CLONE_PID 0x1000 /* this flag does not exist in linux anymore */
-#define CLONE_VFORK 0x4000
-#define CLONE_PARENT 0x00008000
-#define CLONE_THREAD 0x10000
-#define CLONE_SETTLS 0x80000
-#define CLONE_CHILD_CLEARTID 0x00200000
-#define CLONE_CHILD_SETTID 0x01000000
-#define CLONE_PARENT_SETTID 0x00100000
-
-#define THREADING_FLAGS (CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND)
-
-#endif /* !_AMD64_LINUX_LINUX_H_ */
+#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)
+
+#endif /* !_AMD64_LINUX_H_ */
diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c
index 7e9274f24d1c..a83ec4fbfb5b 100644
--- a/sys/amd64/linux32/linux32_machdep.c
+++ b/sys/amd64/linux32/linux32_machdep.c
@@ -561,9 +561,9 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
if (exit_signal <= LINUX_SIGTBLSZ)
exit_signal = linux_to_bsd_signal[_SIG_IDX(exit_signal)];
- if (args->flags & CLONE_VM)
+ if (args->flags & LINUX_CLONE_VM)
ff |= RFMEM;
- if (args->flags & CLONE_SIGHAND)
+ if (args->flags & LINUX_CLONE_SIGHAND)
ff |= RFSIGSHARE;
/*
* XXX: in linux sharing of fs info (chroot/cwd/umask)
@@ -571,7 +571,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
* structure but in reality it doesn't cause any problems
* because both of these flags are usually set together.
*/
- if (!(args->flags & (CLONE_FILES | CLONE_FS)))
+ if (!(args->flags & (LINUX_CLONE_FILES | LINUX_CLONE_FS)))
ff |= RFFDG;
/*
@@ -587,14 +587,14 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
* that special treatment is necessary for signal delivery
* between those processes and fd locking.
*/
- if ((args->flags & 0xffffff00) == THREADING_FLAGS)
+ if ((args->flags & 0xffffff00) == LINUX_THREADING_FLAGS)
ff |= RFTHREAD;
error = fork1(td, ff, 0, &p2);
if (error)
return (error);
- if (args->flags & (CLONE_PARENT|CLONE_THREAD)) {
+ if (args->flags & (LINUX_CLONE_PARENT | LINUX_CLONE_THREAD)) {
sx_xlock(&proctree_lock);
PROC_LOCK(p2);
proc_reparent(p2, td->td_proc->p_pptr);
@@ -608,7 +608,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
em = em_find(p2, EMUL_DOLOCK);
KASSERT(em != NULL, ("clone: emuldata not found.\n"));
/* and adjust it */
- if (args->flags & CLONE_PARENT_SETTID) {
+ if (args->flags & LINUX_CLONE_PARENT_SETTID) {
if (args->parent_tidptr == NULL) {
EMUL_UNLOCK(&emul_lock);
return (EINVAL);
@@ -620,7 +620,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
}
}
- if (args->flags & CLONE_THREAD) {
+ if (args->flags & LINUX_CLONE_THREAD) {
/* XXX: linux mangles pgrp and pptr somehow
* I think it might be this but I am not sure.
*/
@@ -632,12 +632,12 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
exit_signal = 0;
}
- if (args->flags & CLONE_CHILD_SETTID)
+ if (args->flags & LINUX_CLONE_CHILD_SETTID)
em->child_set_tid = args->child_tidptr;
else
em->child_set_tid = NULL;
- if (args->flags & CLONE_CHILD_CLEARTID)
+ if (args->flags & LINUX_CLONE_CHILD_CLEARTID)
em->child_clear_tid = args->child_tidptr;
else
em->child_clear_tid = NULL;
@@ -655,7 +655,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
if (args->stack)
td2->td_frame->tf_rsp = PTROUT(args->stack);
- if (args->flags & CLONE_SETTLS) {
+ if (args->flags & LINUX_CLONE_SETTLS) {
/* XXX: todo */
}
@@ -664,7 +664,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
printf(LMSG("clone: successful rfork to %ld, stack %p sig = %d"),
(long)p2->p_pid, args->stack, exit_signal);
#endif
- if (args->flags & CLONE_VFORK) {
+ if (args->flags & LINUX_CLONE_VFORK) {
PROC_LOCK(p2);
p2->p_flag |= P_PPWAIT;
PROC_UNLOCK(p2);
@@ -681,7 +681,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
td->td_retval[0] = p2->p_pid;
td->td_retval[1] = 0;
- if (args->flags & CLONE_VFORK) {
+ if (args->flags & LINUX_CLONE_VFORK) {
/* wait for the children to exit, ie. emulate vfork */
PROC_LOCK(p2);
while (p2->p_flag & P_PPWAIT)
diff --git a/sys/compat/linux/linux_emul.c b/sys/compat/linux/linux_emul.c
index 0209d89c840e..a0221b96890a 100644
--- a/sys/compat/linux/linux_emul.c
+++ b/sys/compat/linux/linux_emul.c
@@ -86,7 +86,7 @@ linux_proc_init(struct thread *td, pid_t child, int flags)
em = malloc(sizeof *em, M_LINUX, M_WAITOK | M_ZERO);
em->pid = child;
em->pdeath_signal = 0;
- if (flags & CLONE_THREAD) {
+ if (flags & LINUX_CLONE_THREAD) {
/* handled later in the code */
} else {
struct linux_emuldata_shared *s;
@@ -113,7 +113,7 @@ linux_proc_init(struct thread *td, pid_t child, int flags)
* proc
*/
if (child != 0) {
- if (flags & CLONE_THREAD) {
+ if (flags & LINUX_CLONE_THREAD) {
/* lookup the parent */
/*
* we dont have to lock the p_em because
diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h
index fb89cf4d7310..c7219ba42a02 100644
--- a/sys/i386/linux/linux.h
+++ b/sys/i386/linux/linux.h
@@ -6,7 +6,7 @@
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer
+ * notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
@@ -28,10 +28,10 @@
* $FreeBSD$
*/
-#ifndef _I386_LINUX_LINUX_H_
-#define _I386_LINUX_LINUX_H_
+#ifndef _I386_LINUX_H_
+#define _I386_LINUX_H_
-#include <sys/signal.h> /* for sigval union */
+#include <sys/signal.h> /* for sigval union */
#include <i386/linux/linux_syscall.h>
@@ -39,9 +39,9 @@
* debugging support
*/
extern u_char linux_debug_map[];
-#define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
-#define ARGS(nm, fmt) "linux(%ld): "#nm"("fmt")\n", (long)td->td_proc->p_pid
-#define LMSG(fmt) "linux(%ld): "fmt"\n", (long)td->td_proc->p_pid
+#define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
+#define ARGS(nm, fmt) "linux(%ld): "#nm"("fmt")\n", (long)td->td_proc->p_pid
+#define LMSG(fmt) "linux(%ld): "fmt"\n", (long)td->td_proc->p_pid
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_LINUX);
@@ -126,7 +126,7 @@ struct l___sysctl_args
#define LINUX_RLIMIT_NPROC 6
#define LINUX_RLIMIT_NOFILE 7
#define LINUX_RLIMIT_MEMLOCK 8
-#define LINUX_RLIMIT_AS 9 /* address space limit */
+#define LINUX_RLIMIT_AS 9 /* Address space limit */
#define LINUX_RLIM_NLIMITS 10
@@ -180,21 +180,21 @@ struct l_newstat {
};
struct l_stat {
- l_ushort st_dev;
- l_ulong st_ino;
- l_ushort st_mode;
- l_ushort st_nlink;
- l_ushort st_uid;
- l_ushort st_gid;
- l_ushort st_rdev;
- l_long st_size;
- struct l_timespec st_atimespec;
- struct l_timespec st_mtimespec;
- struct l_timespec st_ctimespec;
- l_long st_blksize;
- l_long st_blocks;
- l_ulong st_flags;
- l_ulong st_gen;
+ l_ushort st_dev;
+ l_ulong st_ino;
+ l_ushort st_mode;
+ l_ushort st_nlink;
+ l_ushort st_uid;
+ l_ushort st_gid;
+ l_ushort st_rdev;
+ l_long st_size;
+ struct l_timespec st_atimespec;
+ struct l_timespec st_mtimespec;
+ struct l_timespec st_ctimespec;
+ l_long st_blksize;
+ l_long st_blocks;
+ l_ulong st_flags;
+ l_ulong st_gen;
};
struct l_stat64 {
@@ -290,9 +290,9 @@ struct l_new_utsname {
#define LINUX_SIGADDSET(set, sig) SIGADDSET(set, sig)
/* sigaltstack */
-#define LINUX_MINSIGSTKSZ 2048
-#define LINUX_SS_ONSTACK 1
-#define LINUX_SS_DISABLE 2
+#define LINUX_MINSIGSTKSZ 2048
+#define LINUX_SS_ONSTACK 1
+#define LINUX_SS_DISABLE 2
int linux_to_bsd_sigaltstack(int lsa);
int bsd_to_linux_sigaltstack(int bsa);
@@ -355,11 +355,11 @@ struct l_ucontext {
void *uc_link;
l_stack_t uc_stack;
struct l_sigcontext uc_mcontext;
- l_sigset_t uc_sigmask;
+ l_sigset_t uc_sigmask;
};
-#define LINUX_SI_MAX_SIZE 128
-#define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE/sizeof(l_int)) - 3)
+#define LINUX_SI_MAX_SIZE 128
+#define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE/sizeof(l_int)) - 3)
typedef struct l_siginfo {
l_int lsi_signo;
@@ -393,41 +393,41 @@ typedef struct l_siginfo {
} _sigchld;
struct {
- void *_addr; /* faulting insn/memory ref. */
+ void *_addr; /* Faulting insn/memory ref. */
} _sigfault;
struct {
- l_int _band; /* POLL_IN,POLL_OUT,POLL_MSG */
+ l_int _band; /* POLL_IN,POLL_OUT,POLL_MSG */
l_int _fd;
} _sigpoll;
} _sifields;
} l_siginfo_t;
-#define lsi_pid _sifields._kill._pid
-#define lsi_uid _sifields._kill._uid
-#define lsi_status _sifields._sigchld._status
-#define lsi_utime _sifields._sigchld._utime
-#define lsi_stime _sifields._sigchld._stime
-#define lsi_value _sifields._rt._sigval
-#define lsi_int _sifields._rt._sigval.sival_int
-#define lsi_ptr _sifields._rt._sigval.sival_ptr
-#define lsi_addr _sifields._sigfault._addr
-#define lsi_band _sifields._sigpoll._band
-#define lsi_fd _sifields._sigpoll._fd
+#define lsi_pid _sifields._kill._pid
+#define lsi_uid _sifields._kill._uid
+#define lsi_status _sifields._sigchld._status
+#define lsi_utime _sifields._sigchld._utime
+#define lsi_stime _sifields._sigchld._stime
+#define lsi_value _sifields._rt._sigval
+#define lsi_int _sifields._rt._sigval.sival_int
+#define lsi_ptr _sifields._rt._sigval.sival_ptr
+#define lsi_addr _sifields._sigfault._addr
+#define lsi_band _sifields._sigpoll._band
+#define lsi_fd _sifields._sigpoll._fd
struct l_fpreg {
- u_int16_t significand[4];
- u_int16_t exponent;
+ u_int16_t significand[4];
+ u_int16_t exponent;
};
struct l_fpxreg {
- u_int16_t significand[4];
- u_int16_t exponent;
- u_int16_t padding[3];
+ u_int16_t significand[4];
+ u_int16_t exponent;
+ u_int16_t padding[3];
};
struct l_xmmreg {
- u_int32_t element[4];
+ u_int32_t element[4];
};
struct l_fpstate {
@@ -441,13 +441,13 @@ struct l_fpstate {
u_int32_t datasel;
struct l_fpreg _st[8];
u_int16_t status;
- u_int16_t magic; /* 0xffff = regular FPU data */
+ u_int16_t magic; /* 0xffff = regular FPU data */
/* FXSR FPU environment */
- u_int32_t _fxsr_env[6]; /* env is ignored */
+ u_int32_t _fxsr_env[6]; /* env is ignored. */
u_int32_t mxcsr;
u_int32_t reserved;
- struct l_fpxreg _fxsr_st[8]; /* reg data is ignored */
+ struct l_fpxreg _fxsr_st[8]; /* reg data is ignored. */
struct l_xmmreg _xmm[8];
u_int32_t padding[56];
};
@@ -499,22 +499,22 @@ int linux_ioctl_unregister_handler(struct linux_ioctl_handler *h);
/*
* open/fcntl flags
*/
-#define LINUX_O_RDONLY 00
-#define LINUX_O_WRONLY 01
-#define LINUX_O_RDWR 02
-#define LINUX_O_CREAT 0100
-#define LINUX_O_EXCL 0200
-#define LINUX_O_NOCTTY 0400
-#define LINUX_O_TRUNC 01000
-#define LINUX_O_APPEND 02000
-#define LINUX_O_NONBLOCK 04000
+#define LINUX_O_RDONLY 00000000
+#define LINUX_O_WRONLY 00000001
+#define LINUX_O_RDWR 00000002
+#define LINUX_O_CREAT 00000100
+#define LINUX_O_EXCL 00000200
+#define LINUX_O_NOCTTY 00000400
+#define LINUX_O_TRUNC 00001000
+#define LINUX_O_APPEND 00002000
+#define LINUX_O_NONBLOCK 00004000
#define LINUX_O_NDELAY LINUX_O_NONBLOCK
-#define LINUX_O_SYNC 010000
-#define LINUX_FASYNC 020000
-#define LINUX_O_DIRECT 040000 /* direct disk access hint */
-#define LINUX_O_LARGEFILE 0100000
-#define LINUX_O_DIRECTORY 0200000 /* must be a directory */
-#define LINUX_O_NOFOLLOW 0400000 /* don't follow links */
+#define LINUX_O_SYNC 00010000
+#define LINUX_FASYNC 00020000
+#define LINUX_O_DIRECT 00040000 /* Direct disk access hint */
+#define LINUX_O_LARGEFILE 00100000
+#define LINUX_O_DIRECTORY 00200000 /* Must be a directory */
+#define LINUX_O_NOFOLLOW 00400000 /* Do not follow links */
#define LINUX_O_NOATIME 01000000
#define LINUX_F_DUPFD 0
@@ -539,12 +539,12 @@ int linux_ioctl_unregister_handler(struct linux_ioctl_handler *h);
/*
* 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
-
+#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
+
/*
* SystemV IPC defines
*/
@@ -698,7 +698,7 @@ struct l_ifreq {
} ifr_ifru;
};
-#define ifr_name ifr_ifrn.ifrn_name /* interface name */
+#define ifr_name ifr_ifrn.ifrn_name /* Interface name */
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
/*
@@ -735,88 +735,100 @@ struct l_user_desc {
};
struct l_desc_struct {
- unsigned long a,b;
+ unsigned long a, b;
};
-#define LINUX_LOWERWORD 0x0000ffff
+#define LINUX_LOWERWORD 0x0000ffff
-/*
- * macros which does the same thing as those in linux include/asm-um/ldt-i386.h
- * these convert linux user space descriptor to machine one
+/*
+ * Macros which does the same thing as those in Linux include/asm-um/ldt-i386.h.
+ * These convert Linux user space descriptor to machine one.
+ */
+#define LINUX_LDT_entry_a(info) \
+ ((((info)->base_addr & LINUX_LOWERWORD) << 16) | \
+ ((info)->limit & LINUX_LOWERWORD))
+
+#define LINUX_ENTRY_B_READ_EXEC_ONLY 9
+#define LINUX_ENTRY_B_CONTENTS 10
+#define LINUX_ENTRY_B_SEG_NOT_PRESENT 15
+#define LINUX_ENTRY_B_BASE_ADDR 16
+#define LINUX_ENTRY_B_USEABLE 20
+#define LINUX_ENTRY_B_SEG32BIT 22
+#define LINUX_ENTRY_B_LIMIT 23
+
+#define LINUX_LDT_entry_b(info) \
+ (((info)->base_addr & 0xff000000) | \
+ ((info)->limit & 0xf0000) | \
+ ((info)->contents << LINUX_ENTRY_B_CONTENTS) | \
+ (((info)->seg_not_present == 0) << LINUX_ENTRY_B_SEG_NOT_PRESENT) | \
+ (((info)->base_addr & 0x00ff0000) >> LINUX_ENTRY_B_BASE_ADDR) | \
+ (((info)->read_exec_only == 0) << LINUX_ENTRY_B_READ_EXEC_ONLY) | \
+ ((info)->seg_32bit << LINUX_ENTRY_B_SEG32BIT) | \
+ ((info)->useable << LINUX_ENTRY_B_USEABLE) | \
+ ((info)->limit_in_pages << LINUX_ENTRY_B_LIMIT) | 0x7000)
+
+#define LINUX_LDT_empty(info) \
+ ((info)->base_addr == 0 && \
+ (info)->limit == 0 && \
+ (info)->contents == 0 && \
+ (info)->seg_not_present == 1 && \
+ (info)->read_exec_only == 1 && \
+ (info)->seg_32bit == 0 && \
+ (info)->limit_in_pages == 0 && \
+ (info)->useable == 0)
+
+/*
+ * Macros for converting segments.
+ * They do the same as those in arch/i386/kernel/process.c in Linux.
*/
-#define LDT_entry_a(info) \
- ((((info)->base_addr & LINUX_LOWERWORD) << 16) | ((info)->limit & LINUX_LOWERWORD))
-
-#define ENTRY_B_READ_EXEC_ONLY 9
-#define ENTRY_B_CONTENTS 10
-#define ENTRY_B_SEG_NOT_PRESENT 15
-#define ENTRY_B_BASE_ADDR 16
-#define ENTRY_B_USEABLE 20
-#define ENTRY_B_SEG32BIT 22
-#define ENTRY_B_LIMIT 23
-
-#define LDT_entry_b(info) \
- (((info)->base_addr & 0xff000000) | \
- ((info)->limit & 0xf0000) | \
- ((info)->contents << ENTRY_B_CONTENTS) | \
- (((info)->seg_not_present == 0) << ENTRY_B_SEG_NOT_PRESENT) | \
- (((info)->base_addr & 0x00ff0000) >> ENTRY_B_BASE_ADDR) | \
- (((info)->read_exec_only == 0) << ENTRY_B_READ_EXEC_ONLY) | \
- ((info)->seg_32bit << ENTRY_B_SEG32BIT) | \
- ((info)->useable << ENTRY_B_USEABLE) | \
- ((info)->limit_in_pages << ENTRY_B_LIMIT) | 0x7000)
-
-#define LDT_empty(info) (\
- (info)->base_addr == 0 && \
- (info)->limit == 0 && \
- (info)->contents == 0 && \
- (info)->seg_not_present == 1 && \
- (info)->read_exec_only == 1 && \
- (info)->seg_32bit == 0 && \
- (info)->limit_in_pages == 0 && \
- (info)->useable == 0 )
-
-/* macros for converting segments, they do the same as those in arch/i386/kernel/process.c */
-#define GET_BASE(desc) ( \
- (((desc)->a >> 16) & LINUX_LOWERWORD) | \
- (((desc)->b << 16) & 0x00ff0000) | \
- ( (desc)->b & 0xff000000) )
-
-#define GET_LIMIT(desc) ( \
- ((desc)->a & LINUX_LOWERWORD) | \
- ((desc)->b & 0xf0000) )
-
-#define GET_32BIT(desc) (((desc)->b >> ENTRY_B_SEG32BIT) & 1)
-#define GET_CONTENTS(desc) (((desc)->b >> ENTRY_B_CONTENTS) & 3)
-#define GET_WRITABLE(desc) (((desc)->b >> ENTRY_B_READ_EXEC_ONLY) & 1)
-#define GET_LIMIT_PAGES(desc) (((desc)->b >> ENTRY_B_LIMIT) & 1)
-#define GET_PRESENT(desc) (((desc)->b >> ENTRY_B_SEG_NOT_PRESENT) & 1)
-#define GET_USEABLE(desc) (((desc)->b >> ENTRY_B_USEABLE) & 1)
-
-#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
+#define LINUX_GET_BASE(desc) \
+ ((((desc)->a >> 16) & LINUX_LOWERWORD) | \
+ (((desc)->b << 16) & 0x00ff0000) | \
+ ((desc)->b & 0xff000000))
+
+#define LINUX_GET_LIMIT(desc) \
+ (((desc)->a & LINUX_LOWERWORD) | \
+ ((desc)->b & 0xf0000))
+
+#define LINUX_GET_32BIT(desc) \
+ (((desc)->b >> LINUX_ENTRY_B_SEG32BIT) & 1)
+#define LINUX_GET_CONTENTS(desc) \
+ (((desc)->b >> LINUX_ENTRY_B_CONTENTS) & 3)
+#define LINUX_GET_WRITABLE(desc) \
+ (((desc)->b >> LINUX_ENTRY_B_READ_EXEC_ONLY) & 1)
+#define LINUX_GET_LIMIT_PAGES(desc) \
+ (((desc)->b >> LINUX_ENTRY_B_LIMIT) & 1)
+#define LINUX_GET_PRESENT(desc) \
+ (((desc)->b >> LINUX_ENTRY_B_SEG_NOT_PRESENT) & 1)
+#define LINUX_GET_USEABLE(desc) \
+ (((desc)->b >> LINUX_ENTRY_B_USEABLE) & 1)
+
+#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
typedef int l_timer_t;
typedef int l_mqd_t;
-#define CLONE_VM 0x100
-#define CLONE_FS 0x200
-#define CLONE_FILES 0x400
-#define CLONE_SIGHAND 0x800
-#define CLONE_PID 0x1000 /* this flag does not exist in linux anymore */
-#define CLONE_VFORK 0x4000
-#define CLONE_PARENT 0x00008000
-#define CLONE_THREAD 0x10000
-#define CLONE_SETTLS 0x80000
-#define CLONE_CHILD_CLEARTID 0x00200000
-#define CLONE_CHILD_SETTID 0x01000000
-#define CLONE_PARENT_SETTID 0x00100000
-
-#define THREADING_FLAGS (CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND)
-
-#endif /* !_I386_LINUX_LINUX_H_ */
+#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)
+
+#endif /* !_I386_LINUX_H_ */
diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c
index 9f7eb1823ca6..c58abb5e40c7 100644
--- a/sys/i386/linux/linux_machdep.c
+++ b/sys/i386/linux/linux_machdep.c
@@ -406,9 +406,9 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
if (exit_signal <= LINUX_SIGTBLSZ)
exit_signal = linux_to_bsd_signal[_SIG_IDX(exit_signal)];
- if (args->flags & CLONE_VM)
+ if (args->flags & LINUX_CLONE_VM)
ff |= RFMEM;
- if (args->flags & CLONE_SIGHAND)
+ if (args->flags & LINUX_CLONE_SIGHAND)
ff |= RFSIGSHARE;
/*
* XXX: in linux sharing of fs info (chroot/cwd/umask)
@@ -416,7 +416,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
* structure but in reality it doesn't cause any problems
* because both of these flags are usually set together.
*/
- if (!(args->flags & (CLONE_FILES | CLONE_FS)))
+ if (!(args->flags & (LINUX_CLONE_FILES | LINUX_CLONE_FS)))
ff |= RFFDG;
/*
@@ -432,10 +432,10 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
* that special treatment is necessary for signal delivery
* between those processes and fd locking.
*/
- if ((args->flags & 0xffffff00) == THREADING_FLAGS)
+ if ((args->flags & 0xffffff00) == LINUX_THREADING_FLAGS)
ff |= RFTHREAD;
- if (args->flags & CLONE_PARENT_SETTID)
+ if (args->flags & LINUX_CLONE_PARENT_SETTID)
if (args->parent_tidptr == NULL)
return (EINVAL);
@@ -443,7 +443,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
if (error)
return (error);
- if (args->flags & (CLONE_PARENT|CLONE_THREAD)) {
+ if (args->flags & (LINUX_CLONE_PARENT | LINUX_CLONE_THREAD)) {
sx_xlock(&proctree_lock);
PROC_LOCK(p2);
proc_reparent(p2, td->td_proc->p_pptr);
@@ -458,7 +458,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
KASSERT(em != NULL, ("clone: emuldata not found.\n"));
/* and adjust it */
- if (args->flags & CLONE_THREAD) {
+ if (args->flags & LINUX_CLONE_THREAD) {
/* XXX: linux mangles pgrp and pptr somehow
* I think it might be this but I am not sure.
*/
@@ -470,19 +470,19 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
exit_signal = 0;
}
- if (args->flags & CLONE_CHILD_SETTID)
+ if (args->flags & LINUX_CLONE_CHILD_SETTID)
em->child_set_tid = args->child_tidptr;
else
em->child_set_tid = NULL;
- if (args->flags & CLONE_CHILD_CLEARTID)
+ if (args->flags & LINUX_CLONE_CHILD_CLEARTID)
em->child_clear_tid = args->child_tidptr;
else
em->child_clear_tid = NULL;
EMUL_UNLOCK(&emul_lock);
- if (args->flags & CLONE_PARENT_SETTID) {
+ if (args->flags & LINUX_CLONE_PARENT_SETTID) {
error = copyout(&p2->p_pid, args->parent_tidptr, sizeof(p2->p_pid));
if (error)
printf(LMSG("copyout failed!"));
@@ -499,7 +499,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
if (args->stack)
td2->td_frame->tf_esp = (unsigned int)args->stack;
- if (args->flags & CLONE_SETTLS) {
+ if (args->flags & LINUX_CLONE_SETTLS) {
struct l_user_desc info;
int idx;
int a[2];
@@ -530,8 +530,8 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
printf(LMSG("copyout failed!"));
}
- a[0] = LDT_entry_a(&info);
- a[1] = LDT_entry_b(&info);
+ a[0] = LINUX_LDT_entry_a(&info);
+ a[1] = LINUX_LDT_entry_b(&info);
memcpy(&sd, &a, sizeof(a));
#ifdef DEBUG
@@ -559,7 +559,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
printf(LMSG("clone: successful rfork to %ld, stack %p sig = %d"),
(long)p2->p_pid, args->stack, exit_signal);
#endif
- if (args->flags & CLONE_VFORK) {
+ if (args->flags & LINUX_CLONE_VFORK) {
PROC_LOCK(p2);
p2->p_flag |= P_PPWAIT;
PROC_UNLOCK(p2);
@@ -576,7 +576,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
td->td_retval[0] = p2->p_pid;
td->td_retval[1] = 0;
- if (args->flags & CLONE_VFORK) {
+ if (args->flags & LINUX_CLONE_VFORK) {
/* wait for the children to exit, ie. emulate vfork */
PROC_LOCK(p2);
while (p2->p_flag & P_PPWAIT)
@@ -1146,12 +1146,12 @@ linux_set_thread_area(struct thread *td, struct linux_set_thread_area_args *args
if (error)
return (error);
- if (LDT_empty(&info)) {
+ if (LINUX_LDT_empty(&info)) {
a[0] = 0;
a[1] = 0;
} else {
- a[0] = LDT_entry_a(&info);
- a[1] = LDT_entry_b(&info);
+ a[0] = LINUX_LDT_entry_a(&info);
+ a[1] = LINUX_LDT_entry_b(&info);
}
memcpy(&sd, &a, sizeof(a));
@@ -1213,14 +1213,14 @@ linux_get_thread_area(struct thread *td, struct linux_get_thread_area_args *args
memcpy(&desc, &sd, sizeof(desc));
info.entry_number = idx;
- info.base_addr = GET_BASE(&desc);
- info.limit = GET_LIMIT(&desc);
- info.seg_32bit = GET_32BIT(&desc);
- info.contents = GET_CONTENTS(&desc);
- info.read_exec_only = !GET_WRITABLE(&desc);
- info.limit_in_pages = GET_LIMIT_PAGES(&desc);
- info.seg_not_present = !GET_PRESENT(&desc);
- info.useable = GET_USEABLE(&desc);
+ info.base_addr = LINUX_GET_BASE(&desc);
+ info.limit = LINUX_GET_LIMIT(&desc);
+ info.seg_32bit = LINUX_GET_32BIT(&desc);
+ info.contents = LINUX_GET_CONTENTS(&desc);
+ info.read_exec_only = !LINUX_GET_WRITABLE(&desc);
+ info.limit_in_pages = LINUX_GET_LIMIT_PAGES(&desc);
+ info.seg_not_present = !LINUX_GET_PRESENT(&desc);
+ info.useable = LINUX_GET_USEABLE(&desc);
error = copyout(&info, args->desc, sizeof(struct l_user_desc));
if (error)