linux.h revision 293535
1/*-
2 * Copyright (c) 2013 Dmitry Chagin
3 * Copyright (c) 1994-1996 S��ren Schmidt
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer
11 *    in this position and unchanged.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 *    derived from this software without specific prior written permission
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * $FreeBSD: stable/10/sys/amd64/linux/linux.h 293535 2016-01-09 16:24:30Z dchagin $
30 */
31
32#ifndef _AMD64_LINUX_H_
33#define	_AMD64_LINUX_H_
34
35#include <amd64/linux/linux_syscall.h>
36
37/*
38 * debugging support
39 */
40extern u_char linux_debug_map[];
41#define	ldebug(name)	isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
42#define	ARGS(nm, fmt)	"linux(%ld/%ld): "#nm"("fmt")\n",			\
43			(long)td->td_proc->p_pid, (long)td->td_tid
44#define	LMSG(fmt)	"linux(%ld/%ld): "fmt"\n",				\
45			(long)td->td_proc->p_pid, (long)td->td_tid
46#define	LINUX_DTRACE	linuxulator
47
48#define	PTRIN(v)	(void *)(v)
49#define	PTROUT(v)	(uintptr_t)(v)
50
51#define	CP(src,dst,fld) do { (dst).fld = (src).fld; } while (0)
52#define	CP2(src,dst,sfld,dfld) do { (dst).dfld = (src).sfld; } while (0)
53#define	PTRIN_CP(src,dst,fld) \
54	do { (dst).fld = PTRIN((src).fld); } while (0)
55
56/*
57 * Provide a separate set of types for the Linux types.
58 */
59typedef int32_t		l_int;
60typedef int64_t		l_long;
61typedef int16_t		l_short;
62typedef uint32_t	l_uint;
63typedef uint64_t	l_ulong;
64typedef uint16_t	l_ushort;
65
66typedef l_ulong		l_uintptr_t;
67typedef l_long		l_clock_t;
68typedef l_int		l_daddr_t;
69typedef l_ulong		l_dev_t;
70typedef l_uint		l_gid_t;
71typedef l_uint		l_uid_t;
72typedef l_ulong		l_ino_t;
73typedef l_int		l_key_t;
74typedef l_long		l_loff_t;
75typedef l_uint		l_mode_t;
76typedef l_long		l_off_t;
77typedef l_int		l_pid_t;
78typedef l_ulong		l_size_t;
79typedef l_long		l_ssize_t;
80typedef l_long		l_suseconds_t;
81typedef l_long		l_time_t;
82typedef l_int		l_timer_t;
83typedef l_int		l_mqd_t;
84typedef l_size_t	l_socklen_t;
85
86typedef struct {
87	l_int		val[2];
88} l_fsid_t;
89
90typedef struct {
91	l_time_t	tv_sec;
92	l_suseconds_t	tv_usec;
93} l_timeval;
94
95#define	l_fd_set	fd_set
96
97/*
98 * Miscellaneous
99 */
100#define	LINUX_NAME_MAX		255
101#define	LINUX_CTL_MAXNAME	10
102
103#define LINUX_AT_COUNT		19	/* Count of used aux entry types. */
104
105struct l___sysctl_args
106{
107	l_uintptr_t	name;
108	l_int		nlen;
109	l_uintptr_t	oldval;
110	l_uintptr_t	oldlenp;
111	l_uintptr_t	newval;
112	l_size_t	newlen;
113	l_ulong		__spare[4];
114};
115
116/* Scheduling policies */
117#define	LINUX_SCHED_OTHER	0
118#define	LINUX_SCHED_FIFO	1
119#define	LINUX_SCHED_RR		2
120
121/* Resource limits */
122#define	LINUX_RLIMIT_CPU	0
123#define	LINUX_RLIMIT_FSIZE	1
124#define	LINUX_RLIMIT_DATA	2
125#define	LINUX_RLIMIT_STACK	3
126#define	LINUX_RLIMIT_CORE	4
127#define	LINUX_RLIMIT_RSS	5
128#define	LINUX_RLIMIT_NPROC	6
129#define	LINUX_RLIMIT_NOFILE	7
130#define	LINUX_RLIMIT_MEMLOCK	8
131#define	LINUX_RLIMIT_AS		9	/* Address space limit */
132
133#define	LINUX_RLIM_NLIMITS	10
134
135struct l_rlimit {
136	l_ulong		rlim_cur;
137	l_ulong		rlim_max;
138};
139
140/* mmap options */
141#define	LINUX_MAP_SHARED	0x0001
142#define	LINUX_MAP_PRIVATE	0x0002
143#define	LINUX_MAP_FIXED		0x0010
144#define	LINUX_MAP_ANON		0x0020
145#define	LINUX_MAP_GROWSDOWN	0x0100
146
147/*
148 * stat family of syscalls
149 */
150struct l_timespec {
151	l_time_t	tv_sec;
152	l_long		tv_nsec;
153};
154
155struct l_newstat {
156	l_dev_t		st_dev;
157	l_ino_t		st_ino;
158	l_ulong		st_nlink;
159	l_uint		st_mode;
160	l_uid_t		st_uid;
161	l_gid_t		st_gid;
162	l_uint		__st_pad1;
163	l_dev_t		st_rdev;
164	l_off_t		st_size;
165	l_long		st_blksize;
166	l_long		st_blocks;
167	struct l_timespec	st_atim;
168	struct l_timespec	st_mtim;
169	struct l_timespec	st_ctim;
170	l_long		__unused1;
171	l_long		__unused2;
172	l_long		__unused3;
173};
174
175/*
176 * Signalling
177 */
178#define	LINUX_SIGHUP		1
179#define	LINUX_SIGINT		2
180#define	LINUX_SIGQUIT		3
181#define	LINUX_SIGILL		4
182#define	LINUX_SIGTRAP		5
183#define	LINUX_SIGABRT		6
184#define	LINUX_SIGIOT		LINUX_SIGABRT
185#define	LINUX_SIGBUS		7
186#define	LINUX_SIGFPE		8
187#define	LINUX_SIGKILL		9
188#define	LINUX_SIGUSR1		10
189#define	LINUX_SIGSEGV		11
190#define	LINUX_SIGUSR2		12
191#define	LINUX_SIGPIPE		13
192#define	LINUX_SIGALRM		14
193#define	LINUX_SIGTERM		15
194#define	LINUX_SIGSTKFLT		16
195#define	LINUX_SIGCHLD		17
196#define	LINUX_SIGCONT		18
197#define	LINUX_SIGSTOP		19
198#define	LINUX_SIGTSTP		20
199#define	LINUX_SIGTTIN		21
200#define	LINUX_SIGTTOU		22
201#define	LINUX_SIGURG		23
202#define	LINUX_SIGXCPU		24
203#define	LINUX_SIGXFSZ		25
204#define	LINUX_SIGVTALRM		26
205#define	LINUX_SIGPROF		27
206#define	LINUX_SIGWINCH		28
207#define	LINUX_SIGIO		29
208#define	LINUX_SIGPOLL		LINUX_SIGIO
209#define	LINUX_SIGPWR		30
210#define	LINUX_SIGSYS		31
211#define	LINUX_SIGRTMIN		32
212
213#define	LINUX_SIGTBLSZ		31
214#define	LINUX_NSIG		64
215#define	LINUX_NBPW		64
216#define	LINUX_NSIG_WORDS	(LINUX_NSIG / LINUX_NBPW)
217
218/* sigaction flags */
219#define	LINUX_SA_NOCLDSTOP	0x00000001
220#define	LINUX_SA_NOCLDWAIT	0x00000002
221#define	LINUX_SA_SIGINFO	0x00000004
222#define	LINUX_SA_RESTORER	0x04000000
223#define	LINUX_SA_ONSTACK	0x08000000
224#define	LINUX_SA_RESTART	0x10000000
225#define	LINUX_SA_INTERRUPT	0x20000000
226#define	LINUX_SA_NOMASK		0x40000000
227#define	LINUX_SA_ONESHOT	0x80000000
228
229/* sigprocmask actions */
230#define	LINUX_SIG_BLOCK		0
231#define	LINUX_SIG_UNBLOCK	1
232#define	LINUX_SIG_SETMASK	2
233
234/* primitives to manipulate sigset_t */
235
236#define	LINUX_SIGEMPTYSET(set)					\
237	do {							\
238		(set).__bits[0] = 0;				\
239	} while(0)
240
241#define	LINUX_SIGISMEMBER(set, sig)				\
242	(1UL & ((set).__bits[0] >> _SIG_IDX(sig)))
243
244#define	LINUX_SIGADDSET(set, sig)				\
245	(set).__bits[0] |= 1UL << _SIG_IDX(sig)
246
247/* sigaltstack */
248#define	LINUX_MINSIGSTKSZ	2048
249#define	LINUX_SS_ONSTACK	1
250#define	LINUX_SS_DISABLE	2
251
252int linux_to_bsd_sigaltstack(int lsa);
253int bsd_to_linux_sigaltstack(int bsa);
254
255typedef void	(*l_handler_t)(l_int);
256
257typedef struct {
258	l_ulong __bits[LINUX_NSIG_WORDS];
259} l_sigset_t;
260
261typedef struct {
262	l_handler_t	lsa_handler;
263	l_ulong		lsa_flags;
264	l_uintptr_t	lsa_restorer;
265	l_sigset_t	lsa_mask;
266} l_sigaction_t;
267
268typedef struct {
269	l_uintptr_t	ss_sp;
270	l_int		ss_flags;
271	l_size_t	ss_size;
272} l_stack_t;
273
274struct l_fpstate {
275	u_int16_t cwd;
276	u_int16_t swd;
277	u_int16_t twd;
278	u_int16_t fop;
279	u_int64_t rip;
280	u_int64_t rdp;
281	u_int32_t mxcsr;
282	u_int32_t mxcsr_mask;
283	u_int32_t st_space[32];
284	u_int32_t xmm_space[64];
285	u_int32_t reserved2[24];
286};
287
288struct l_sigcontext {
289	l_ulong		sc_r8;
290	l_ulong		sc_r9;
291	l_ulong		sc_r10;
292	l_ulong		sc_r11;
293	l_ulong		sc_r12;
294	l_ulong		sc_r13;
295	l_ulong		sc_r14;
296	l_ulong		sc_r15;
297	l_ulong		sc_rdi;
298	l_ulong		sc_rsi;
299	l_ulong		sc_rbp;
300	l_ulong		sc_rbx;
301	l_ulong		sc_rdx;
302	l_ulong		sc_rax;
303	l_ulong		sc_rcx;
304	l_ulong		sc_rsp;
305	l_ulong		sc_rip;
306	l_ulong		sc_rflags;
307	l_ushort	sc_cs;
308	l_ushort	sc_gs;
309	l_ushort	sc_fs;
310	l_ushort	sc___pad0;
311	l_ulong		sc_err;
312	l_ulong		sc_trapno;
313	l_sigset_t	sc_mask;
314	l_ulong		sc_cr2;
315	struct l_fpstate *sc_fpstate;
316	l_ulong		sc_reserved1[8];
317};
318
319struct l_ucontext {
320	l_ulong		uc_flags;
321	l_uintptr_t	uc_link;
322	l_stack_t	uc_stack;
323	struct l_sigcontext	uc_mcontext;
324	l_sigset_t	uc_sigmask;
325};
326
327#define LINUX_SI_PREAMBLE_SIZE	(4 * sizeof(int))
328#define	LINUX_SI_MAX_SIZE	128
329#define	LINUX_SI_PAD_SIZE	((LINUX_SI_MAX_SIZE - \
330				    LINUX_SI_PREAMBLE_SIZE) / sizeof(l_int))
331typedef union l_sigval {
332	l_int		sival_int;
333	l_uintptr_t	sival_ptr;
334} l_sigval_t;
335
336typedef struct l_siginfo {
337	l_int		lsi_signo;
338	l_int		lsi_errno;
339	l_int		lsi_code;
340	union {
341		l_int	_pad[LINUX_SI_PAD_SIZE];
342
343		struct {
344			l_pid_t		_pid;
345			l_uid_t		_uid;
346		} _kill;
347
348		struct {
349			l_timer_t	_tid;
350			l_int		_overrun;
351			char		_pad[sizeof(l_uid_t) - sizeof(int)];
352			union l_sigval	_sigval;
353			l_uint		_sys_private;
354		} _timer;
355
356		struct {
357			l_pid_t		_pid;		/* sender's pid */
358			l_uid_t		_uid;		/* sender's uid */
359			union l_sigval	_sigval;
360		} _rt;
361
362		struct {
363			l_pid_t		_pid;		/* which child */
364			l_uid_t		_uid;		/* sender's uid */
365			l_int		_status;	/* exit code */
366			l_clock_t	_utime;
367			l_clock_t	_stime;
368		} _sigchld;
369
370		struct {
371			l_uintptr_t	_addr;	/* Faulting insn/memory ref. */
372		} _sigfault;
373
374		struct {
375			l_long		_band;	/* POLL_IN,POLL_OUT,POLL_MSG */
376			l_int		_fd;
377		} _sigpoll;
378	} _sifields;
379} l_siginfo_t;
380
381#define	lsi_pid		_sifields._kill._pid
382#define	lsi_uid		_sifields._kill._uid
383#define	lsi_tid		_sifields._timer._tid
384#define	lsi_overrun	_sifields._timer._overrun
385#define	lsi_sys_private	_sifields._timer._sys_private
386#define	lsi_status	_sifields._sigchld._status
387#define	lsi_utime	_sifields._sigchld._utime
388#define	lsi_stime	_sifields._sigchld._stime
389#define	lsi_value	_sifields._rt._sigval
390#define	lsi_int		_sifields._rt._sigval.sival_int
391#define	lsi_ptr		_sifields._rt._sigval.sival_ptr
392#define	lsi_addr	_sifields._sigfault._addr
393#define	lsi_band	_sifields._sigpoll._band
394#define	lsi_fd		_sifields._sigpoll._fd
395
396/*
397 * We make the stack look like Linux expects it when calling a signal
398 * handler, but use the BSD way of calling the handler and sigreturn().
399 * This means that we need to pass the pointer to the handler too.
400 * It is appended to the frame to not interfere with the rest of it.
401 */
402
403struct l_rt_sigframe {
404	struct l_ucontext	sf_sc;
405	struct l_siginfo	sf_si;
406	l_handler_t		sf_handler;
407};
408
409/*
410 * open/fcntl flags
411 */
412#define	LINUX_O_RDONLY		00000000
413#define	LINUX_O_WRONLY		00000001
414#define	LINUX_O_RDWR		00000002
415#define	LINUX_O_ACCMODE		00000003
416#define	LINUX_O_CREAT		00000100
417#define	LINUX_O_EXCL		00000200
418#define	LINUX_O_NOCTTY		00000400
419#define	LINUX_O_TRUNC		00001000
420#define	LINUX_O_APPEND		00002000
421#define	LINUX_O_NONBLOCK	00004000
422#define	LINUX_O_NDELAY		LINUX_O_NONBLOCK
423#define	LINUX_O_SYNC		00010000
424#define	LINUX_FASYNC		00020000
425#define	LINUX_O_DIRECT		00040000	/* Direct disk access hint */
426#define	LINUX_O_LARGEFILE	00100000
427#define	LINUX_O_DIRECTORY	00200000	/* Must be a directory */
428#define	LINUX_O_NOFOLLOW	00400000	/* Do not follow links */
429#define	LINUX_O_NOATIME		01000000
430#define	LINUX_O_CLOEXEC		02000000
431
432#define	LINUX_F_DUPFD		0
433#define	LINUX_F_GETFD		1
434#define	LINUX_F_SETFD		2
435#define	LINUX_F_GETFL		3
436#define	LINUX_F_SETFL		4
437#define	LINUX_F_GETLK		5
438#define	LINUX_F_SETLK		6
439#define	LINUX_F_SETLKW		7
440#define	LINUX_F_SETOWN		8
441#define	LINUX_F_GETOWN		9
442
443#define	LINUX_F_RDLCK		0
444#define	LINUX_F_WRLCK		1
445#define	LINUX_F_UNLCK		2
446
447/*
448 * mount flags
449 */
450#define	LINUX_MS_RDONLY		0x0001
451#define	LINUX_MS_NOSUID		0x0002
452#define	LINUX_MS_NODEV		0x0004
453#define	LINUX_MS_NOEXEC		0x0008
454#define	LINUX_MS_REMOUNT	0x0020
455
456/*
457 * SystemV IPC defines
458 */
459#define	LINUX_IPC_RMID		0
460#define	LINUX_IPC_SET		1
461#define	LINUX_IPC_STAT		2
462#define	LINUX_IPC_INFO		3
463
464#define	LINUX_SHM_LOCK		11
465#define	LINUX_SHM_UNLOCK	12
466#define	LINUX_SHM_STAT		13
467#define	LINUX_SHM_INFO		14
468
469#define	LINUX_SHM_RDONLY	0x1000
470#define	LINUX_SHM_RND		0x2000
471#define	LINUX_SHM_REMAP		0x4000
472
473/* semctl commands */
474#define	LINUX_GETPID		11
475#define	LINUX_GETVAL		12
476#define	LINUX_GETALL		13
477#define	LINUX_GETNCNT		14
478#define	LINUX_GETZCNT		15
479#define	LINUX_SETVAL		16
480#define	LINUX_SETALL		17
481#define	LINUX_SEM_STAT		18
482#define	LINUX_SEM_INFO		19
483
484union l_semun {
485	l_int		val;
486	l_uintptr_t	buf;
487	l_uintptr_t	array;
488	l_uintptr_t	__buf;
489	l_uintptr_t	__pad;
490};
491
492struct l_ipc_perm {
493	l_key_t		key;
494	l_uid_t		uid;
495	l_gid_t		gid;
496	l_uid_t		cuid;
497	l_gid_t		cgid;
498	l_ushort	mode;
499	l_ushort	seq;
500};
501
502/*
503 * Socket defines
504 */
505
506#define	LINUX_SOL_SOCKET	1
507#define	LINUX_SOL_IP		0
508#define	LINUX_SOL_IPX		256
509#define	LINUX_SOL_AX25		257
510#define	LINUX_SOL_TCP		6
511#define	LINUX_SOL_UDP		17
512
513#define	LINUX_SO_DEBUG		1
514#define	LINUX_SO_REUSEADDR	2
515#define	LINUX_SO_TYPE		3
516#define	LINUX_SO_ERROR		4
517#define	LINUX_SO_DONTROUTE	5
518#define	LINUX_SO_BROADCAST	6
519#define	LINUX_SO_SNDBUF		7
520#define	LINUX_SO_RCVBUF		8
521#define	LINUX_SO_KEEPALIVE	9
522#define	LINUX_SO_OOBINLINE	10
523#define	LINUX_SO_NO_CHECK	11
524#define	LINUX_SO_PRIORITY	12
525#define	LINUX_SO_LINGER		13
526#define	LINUX_SO_PASSCRED	16
527#define	LINUX_SO_PEERCRED	17
528#define	LINUX_SO_RCVLOWAT	18
529#define	LINUX_SO_SNDLOWAT	19
530#define	LINUX_SO_RCVTIMEO	20
531#define	LINUX_SO_SNDTIMEO	21
532#define	LINUX_SO_TIMESTAMP	29
533#define	LINUX_SO_ACCEPTCONN	30
534
535#define	LINUX_IP_TOS		1
536#define	LINUX_IP_TTL		2
537#define	LINUX_IP_HDRINCL	3
538#define	LINUX_IP_OPTIONS	4
539
540#define	LINUX_IP_MULTICAST_IF		32
541#define	LINUX_IP_MULTICAST_TTL		33
542#define	LINUX_IP_MULTICAST_LOOP		34
543#define	LINUX_IP_ADD_MEMBERSHIP		35
544#define	LINUX_IP_DROP_MEMBERSHIP	36
545
546struct l_sockaddr {
547	l_ushort	sa_family;
548	char		sa_data[14];
549};
550
551struct l_msghdr {
552	l_uintptr_t	msg_name;
553	l_int		msg_namelen;
554	l_uintptr_t	msg_iov;
555	l_size_t	msg_iovlen;
556	l_uintptr_t	msg_control;
557	l_size_t	msg_controllen;
558	l_uint		msg_flags;
559};
560
561struct l_cmsghdr {
562	l_size_t	cmsg_len;
563	l_int		cmsg_level;
564	l_int		cmsg_type;
565};
566
567struct l_ifmap {
568	l_ulong		mem_start;
569	l_ulong		mem_end;
570	l_ushort	base_addr;
571	u_char		irq;
572	u_char		dma;
573	u_char		port;
574} __packed;
575
576#define	LINUX_IFHWADDRLEN	6
577#define	LINUX_IFNAMSIZ		16
578
579struct l_ifreq {
580	union {
581		char	ifrn_name[LINUX_IFNAMSIZ];
582	} ifr_ifrn;
583
584	union {
585		struct l_sockaddr	ifru_addr;
586		struct l_sockaddr	ifru_dstaddr;
587		struct l_sockaddr	ifru_broadaddr;
588		struct l_sockaddr	ifru_netmask;
589		struct l_sockaddr	ifru_hwaddr;
590		l_short		ifru_flags[1];
591		l_int		ifru_metric;
592		l_int		ifru_mtu;
593		struct l_ifmap	ifru_map;
594		char		ifru_slave[LINUX_IFNAMSIZ];
595		l_uintptr_t	ifru_data;
596	} ifr_ifru;
597} __packed;
598
599#define	ifr_name	ifr_ifrn.ifrn_name	/* Interface name */
600#define	ifr_hwaddr	ifr_ifru.ifru_hwaddr	/* MAC address */
601
602struct l_ifconf {
603	int	ifc_len;
604	union {
605		l_uintptr_t	ifcu_buf;
606		l_uintptr_t	ifcu_req;
607	} ifc_ifcu;
608};
609
610#define	ifc_buf		ifc_ifcu.ifcu_buf
611#define	ifc_req		ifc_ifcu.ifcu_req
612
613/*
614 * poll()
615 */
616#define	LINUX_POLLIN		0x0001
617#define	LINUX_POLLPRI		0x0002
618#define	LINUX_POLLOUT		0x0004
619#define	LINUX_POLLERR		0x0008
620#define	LINUX_POLLHUP		0x0010
621#define	LINUX_POLLNVAL		0x0020
622#define	LINUX_POLLRDNORM	0x0040
623#define	LINUX_POLLRDBAND	0x0080
624#define	LINUX_POLLWRNORM	0x0100
625#define	LINUX_POLLWRBAND	0x0200
626#define	LINUX_POLLMSG		0x0400
627
628struct l_pollfd {
629	l_int		fd;
630	l_short		events;
631	l_short		revents;
632};
633
634
635#define	LINUX_CLONE_VM			0x00000100
636#define	LINUX_CLONE_FS			0x00000200
637#define	LINUX_CLONE_FILES		0x00000400
638#define	LINUX_CLONE_SIGHAND		0x00000800
639#define	LINUX_CLONE_PID			0x00001000	/* No longer exist in Linux */
640#define	LINUX_CLONE_VFORK		0x00004000
641#define	LINUX_CLONE_PARENT		0x00008000
642#define	LINUX_CLONE_THREAD		0x00010000
643#define	LINUX_CLONE_SETTLS		0x00080000
644#define	LINUX_CLONE_PARENT_SETTID	0x00100000
645#define	LINUX_CLONE_CHILD_CLEARTID	0x00200000
646#define	LINUX_CLONE_CHILD_SETTID	0x01000000
647
648#define LINUX_ARCH_SET_GS		0x1001
649#define LINUX_ARCH_SET_FS		0x1002
650#define LINUX_ARCH_GET_GS		0x1003
651#define LINUX_ARCH_GET_FS		0x1004
652
653#define	linux_copyout_rusage(r, u)	copyout(r, u, sizeof(*r))
654
655/* robust futexes */
656struct linux_robust_list {
657	l_uintptr_t			next;
658};
659
660struct linux_robust_list_head {
661	struct linux_robust_list	list;
662	l_long				futex_offset;
663	l_uintptr_t			pending_list;
664};
665
666#endif /* !_AMD64_LINUX_H_ */
667