View | Details | Raw Unified | Return to bug 201299 | Differences between
and this patch

Collapse All | Expand All

(-)sys/amd64/amd64/elf_machdep.c (+1 lines)
Lines 82-87 Link Here
82
	.sv_shared_page_base = SHAREDPAGE,
82
	.sv_shared_page_base = SHAREDPAGE,
83
	.sv_shared_page_len = PAGE_SIZE,
83
	.sv_shared_page_len = PAGE_SIZE,
84
	.sv_schedtail	= NULL,
84
	.sv_schedtail	= NULL,
85
	.sv_trap	= NULL,
85
};
86
};
86
INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec);
87
INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec);
87
88
(-)sys/amd64/amd64/machdep.c (-4 lines)
Lines 384-393 Link Here
384
	/* Align to 16 bytes. */
384
	/* Align to 16 bytes. */
385
	sfp = (struct sigframe *)((unsigned long)sp & ~0xFul);
385
	sfp = (struct sigframe *)((unsigned long)sp & ~0xFul);
386
386
387
	/* Translate the signal if appropriate. */
388
	if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
389
		sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
390
391
	/* Build the argument list for the signal handler. */
387
	/* Build the argument list for the signal handler. */
392
	regs->tf_rdi = sig;			/* arg 1 in %rdi */
388
	regs->tf_rdi = sig;			/* arg 1 in %rdi */
393
	regs->tf_rdx = (register_t)&sfp->sf_uc;	/* arg 3 in %rdx */
389
	regs->tf_rdx = (register_t)&sfp->sf_uc;	/* arg 3 in %rdx */
(-)sys/amd64/amd64/trap.c (-4 / +28 lines)
Lines 274-279 Link Here
274
		if (td->td_ucred != p->p_ucred) 
274
		if (td->td_ucred != p->p_ucred) 
275
			cred_update_thread(td);
275
			cred_update_thread(td);
276
276
277
		if (*p->p_sysent->sv_trap)
278
			if ((*p->p_sysent->sv_trap)(td, frame) == 0)
279
				goto userout;
280
277
		switch (type) {
281
		switch (type) {
278
		case T_PRIVINFLT:	/* privileged instruction fault */
282
		case T_PRIVINFLT:	/* privileged instruction fault */
279
			i = SIGILL;
283
			i = SIGILL;
Lines 591-601 Link Here
591
	ksi.ksi_trapno = type;
595
	ksi.ksi_trapno = type;
592
	ksi.ksi_addr = (void *)addr;
596
	ksi.ksi_addr = (void *)addr;
593
	if (uprintf_signal) {
597
	if (uprintf_signal) {
594
		uprintf("pid %d comm %s: signal %d err %lx code %d type %d "
598
		uprintf("pid %05d thread %p comm %s: signal %d err %lx code %d type %d\n"
595
		    "addr 0x%lx rsp 0x%lx rip 0x%lx "
599
		    "addr 0x%lx rip 0x%lx rax 0x%lx\n"
600
		    "rdi 0x%lx rsi 0x%lx rdx 0x%lx rcx 0x%lx\n"
601
		    "r8 0x%lx r9 0x%lx rbx 0x%lx rbp 0x%lx\n"
602
		    "r10 0x%lx r11 0x%lx r12 0x%lx r13 0x%lx\n"
603
		    "r14 0x%lx r15 0x%lx\n"
604
		    "<%02x %02x %02x %02x %02x %02x %02x %02x>\n"
596
		    "<%02x %02x %02x %02x %02x %02x %02x %02x>\n",
605
		    "<%02x %02x %02x %02x %02x %02x %02x %02x>\n",
597
		    p->p_pid, p->p_comm, i, frame->tf_err, ucode, type, addr,
606
		    p->p_pid, td, p->p_comm, i, frame->tf_err, ucode, type,
598
		    frame->tf_rsp, frame->tf_rip,
607
		    addr, frame->tf_rip, frame->tf_rax,
608
		    frame->tf_rdi, frame->tf_rsi,
609
		    frame->tf_rdx, frame->tf_rcx,
610
		    frame->tf_r8, frame->tf_r9,
611
		    frame->tf_rbx, frame->tf_rbp,
612
		    frame->tf_r10, frame->tf_r11,
613
		    frame->tf_r12, frame->tf_r13,
614
		    frame->tf_r14, frame->tf_r15,
615
		    fubyte((void *)(frame->tf_rip - 8)),
616
		    fubyte((void *)(frame->tf_rip - 7)),
617
		    fubyte((void *)(frame->tf_rip - 6)),
618
		    fubyte((void *)(frame->tf_rip - 5)),
619
		    fubyte((void *)(frame->tf_rip - 4)),
620
		    fubyte((void *)(frame->tf_rip - 3)),
621
		    fubyte((void *)(frame->tf_rip - 2)),
622
		    fubyte((void *)(frame->tf_rip - 1)),
599
		    fubyte((void *)(frame->tf_rip + 0)),
623
		    fubyte((void *)(frame->tf_rip + 0)),
600
		    fubyte((void *)(frame->tf_rip + 1)),
624
		    fubyte((void *)(frame->tf_rip + 1)),
601
		    fubyte((void *)(frame->tf_rip + 2)),
625
		    fubyte((void *)(frame->tf_rip + 2)),
(-)sys/amd64/ia32/ia32_signal.c (-12 lines)
Lines 360-369 Link Here
360
	} else
360
	} else
361
		fp = (struct ia32_sigframe3 *)regs->tf_rsp - 1;
361
		fp = (struct ia32_sigframe3 *)regs->tf_rsp - 1;
362
362
363
	/* Translate the signal if appropriate. */
364
	if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
365
		sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
366
367
	/* Build the argument list for the signal handler. */
363
	/* Build the argument list for the signal handler. */
368
	sf.sf_signum = sig;
364
	sf.sf_signum = sig;
369
	sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc;
365
	sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc;
Lines 498-507 Link Here
498
		sfp = (struct ia32_sigframe4 *)regs->tf_rsp - 1;
494
		sfp = (struct ia32_sigframe4 *)regs->tf_rsp - 1;
499
	PROC_UNLOCK(p);
495
	PROC_UNLOCK(p);
500
496
501
	/* Translate the signal if appropriate. */
502
	if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
503
		sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
504
505
	/* Build the argument list for the signal handler. */
497
	/* Build the argument list for the signal handler. */
506
	sf.sf_signum = sig;
498
	sf.sf_signum = sig;
507
	sf.sf_ucontext = (register_t)&sfp->sf_uc;
499
	sf.sf_ucontext = (register_t)&sfp->sf_uc;
Lines 643-652 Link Here
643
	sfp = (struct ia32_sigframe *)((uintptr_t)sp & ~0xF);
635
	sfp = (struct ia32_sigframe *)((uintptr_t)sp & ~0xF);
644
	PROC_UNLOCK(p);
636
	PROC_UNLOCK(p);
645
637
646
	/* Translate the signal if appropriate. */
647
	if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
648
		sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
649
650
	/* Build the argument list for the signal handler. */
638
	/* Build the argument list for the signal handler. */
651
	sf.sf_signum = sig;
639
	sf.sf_signum = sig;
652
	sf.sf_ucontext = (register_t)&sfp->sf_uc;
640
	sf.sf_ucontext = (register_t)&sfp->sf_uc;
(-)sys/amd64/linux/Makefile (+17 lines)
Line 0 Link Here
1
# Makefile for syscall tables
2
#
3
# $FreeBSD$
4
5
all:
6
	@echo "make sysent only"
7
8
sysent:  linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c
9
10
linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \
11
		../../kern/makesyscalls.sh syscalls.master syscalls.conf
12
	-mv -f linux_sysent.c linux_sysent.c.bak
13
	-mv -f linux_syscall.h linux_syscall.h.bak
14
	-mv -f linux_proto.h linux_proto.h.bak
15
	-mv -f linux_syscalls.c linux_syscalls.c.bak
16
	-mv -f linux_systrace_args.c linux_systrace_args.c.bak
17
	sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
(-)sys/amd64/linux/linux.h (+547 lines)
Line 0 Link Here
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$
30
 */
31
32
#ifndef _AMD64_LINUX_H_
33
#define	_AMD64_LINUX_H_
34
35
#include <compat/linux/linux.h>
36
#include <amd64/linux/linux_syscall.h>
37
38
/*
39
 * debugging support
40
 */
41
extern u_char linux_debug_map[];
42
#define	ldebug(name)	isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
43
#define	ARGS(nm, fmt)	"linux(%ld/%ld): "#nm"("fmt")\n",			\
44
			(long)td->td_proc->p_pid, (long)td->td_tid
45
#define	LMSG(fmt)	"linux(%ld/%ld): "fmt"\n",				\
46
			(long)td->td_proc->p_pid, (long)td->td_tid
47
#define	LINUX_DTRACE	linuxulator
48
49
#define	PTRIN(v)	(void *)(v)
50
#define	PTROUT(v)	(uintptr_t)(v)
51
52
#define	CP(src,dst,fld) do { (dst).fld = (src).fld; } while (0)
53
#define	CP2(src,dst,sfld,dfld) do { (dst).dfld = (src).sfld; } while (0)
54
#define	PTRIN_CP(src,dst,fld) \
55
	do { (dst).fld = PTRIN((src).fld); } while (0)
56
57
/*
58
 * Provide a separate set of types for the Linux types.
59
 */
60
typedef int32_t		l_int;
61
typedef int64_t		l_long;
62
typedef int16_t		l_short;
63
typedef uint32_t	l_uint;
64
typedef uint64_t	l_ulong;
65
typedef uint16_t	l_ushort;
66
67
typedef l_ulong		l_uintptr_t;
68
typedef l_long		l_clock_t;
69
typedef l_int		l_daddr_t;
70
typedef l_ulong		l_dev_t;
71
typedef l_uint		l_gid_t;
72
typedef l_uint		l_uid_t;
73
typedef l_ulong		l_ino_t;
74
typedef l_int		l_key_t;
75
typedef l_long		l_loff_t;
76
typedef l_uint		l_mode_t;
77
typedef l_long		l_off_t;
78
typedef l_int		l_pid_t;
79
typedef l_ulong		l_size_t;
80
typedef l_long		l_ssize_t;
81
typedef l_long		l_suseconds_t;
82
typedef l_long		l_time_t;
83
typedef l_int		l_timer_t;
84
typedef l_int		l_mqd_t;
85
typedef l_size_t	l_socklen_t;
86
typedef	l_ulong		l_fd_mask;
87
88
typedef struct {
89
	l_int		val[2];
90
} l_fsid_t;
91
92
typedef struct {
93
	l_time_t	tv_sec;
94
	l_suseconds_t	tv_usec;
95
} l_timeval;
96
97
#define	l_fd_set	fd_set
98
99
/*
100
 * Miscellaneous
101
 */
102
#define	LINUX_NAME_MAX		255
103
#define	LINUX_CTL_MAXNAME	10
104
105
#define LINUX_AT_COUNT		19	/* Count of used aux entry types. */
106
107
struct l___sysctl_args
108
{
109
	l_uintptr_t	name;
110
	l_int		nlen;
111
	l_uintptr_t	oldval;
112
	l_uintptr_t	oldlenp;
113
	l_uintptr_t	newval;
114
	l_size_t	newlen;
115
	l_ulong		__spare[4];
116
};
117
118
/* Scheduling policies */
119
#define	LINUX_SCHED_OTHER	0
120
#define	LINUX_SCHED_FIFO	1
121
#define	LINUX_SCHED_RR		2
122
123
/* Resource limits */
124
#define	LINUX_RLIMIT_CPU	0
125
#define	LINUX_RLIMIT_FSIZE	1
126
#define	LINUX_RLIMIT_DATA	2
127
#define	LINUX_RLIMIT_STACK	3
128
#define	LINUX_RLIMIT_CORE	4
129
#define	LINUX_RLIMIT_RSS	5
130
#define	LINUX_RLIMIT_NPROC	6
131
#define	LINUX_RLIMIT_NOFILE	7
132
#define	LINUX_RLIMIT_MEMLOCK	8
133
#define	LINUX_RLIMIT_AS		9	/* Address space limit */
134
135
#define	LINUX_RLIM_NLIMITS	10
136
137
struct l_rlimit {
138
	l_ulong		rlim_cur;
139
	l_ulong		rlim_max;
140
};
141
142
/* mmap options */
143
#define	LINUX_MAP_SHARED	0x0001
144
#define	LINUX_MAP_PRIVATE	0x0002
145
#define	LINUX_MAP_FIXED		0x0010
146
#define	LINUX_MAP_ANON		0x0020
147
#define	LINUX_MAP_GROWSDOWN	0x0100
148
149
/*
150
 * stat family of syscalls
151
 */
152
struct l_timespec {
153
	l_time_t	tv_sec;
154
	l_long		tv_nsec;
155
};
156
157
struct l_newstat {
158
	l_dev_t		st_dev;
159
	l_ino_t		st_ino;
160
	l_ulong		st_nlink;
161
	l_uint		st_mode;
162
	l_uid_t		st_uid;
163
	l_gid_t		st_gid;
164
	l_uint		__st_pad1;
165
	l_dev_t		st_rdev;
166
	l_off_t		st_size;
167
	l_long		st_blksize;
168
	l_long		st_blocks;
169
	struct l_timespec	st_atim;
170
	struct l_timespec	st_mtim;
171
	struct l_timespec	st_ctim;
172
	l_long		__unused1;
173
	l_long		__unused2;
174
	l_long		__unused3;
175
};
176
177
/* sigaction flags */
178
#define	LINUX_SA_NOCLDSTOP	0x00000001
179
#define	LINUX_SA_NOCLDWAIT	0x00000002
180
#define	LINUX_SA_SIGINFO	0x00000004
181
#define	LINUX_SA_RESTORER	0x04000000
182
#define	LINUX_SA_ONSTACK	0x08000000
183
#define	LINUX_SA_RESTART	0x10000000
184
#define	LINUX_SA_INTERRUPT	0x20000000
185
#define	LINUX_SA_NOMASK		0x40000000
186
#define	LINUX_SA_ONESHOT	0x80000000
187
188
/* sigprocmask actions */
189
#define	LINUX_SIG_BLOCK		0
190
#define	LINUX_SIG_UNBLOCK	1
191
#define	LINUX_SIG_SETMASK	2
192
193
/* sigaltstack */
194
#define	LINUX_MINSIGSTKSZ	2048
195
196
typedef void	(*l_handler_t)(l_int);
197
198
typedef struct {
199
	l_handler_t	lsa_handler;
200
	l_ulong		lsa_flags;
201
	l_uintptr_t	lsa_restorer;
202
	l_sigset_t	lsa_mask;
203
} l_sigaction_t;
204
205
typedef struct {
206
	l_uintptr_t	ss_sp;
207
	l_int		ss_flags;
208
	l_size_t	ss_size;
209
} l_stack_t;
210
211
struct l_fpstate {
212
	u_int16_t cwd;
213
	u_int16_t swd;
214
	u_int16_t twd;
215
	u_int16_t fop;
216
	u_int64_t rip;
217
	u_int64_t rdp;
218
	u_int32_t mxcsr;
219
	u_int32_t mxcsr_mask;
220
	u_int32_t st_space[32];
221
	u_int32_t xmm_space[64];
222
	u_int32_t reserved2[24];
223
};
224
225
struct l_sigcontext {
226
	l_ulong		sc_r8;
227
	l_ulong		sc_r9;
228
	l_ulong		sc_r10;
229
	l_ulong		sc_r11;
230
	l_ulong		sc_r12;
231
	l_ulong		sc_r13;
232
	l_ulong		sc_r14;
233
	l_ulong		sc_r15;
234
	l_ulong		sc_rdi;
235
	l_ulong		sc_rsi;
236
	l_ulong		sc_rbp;
237
	l_ulong		sc_rbx;
238
	l_ulong		sc_rdx;
239
	l_ulong		sc_rax;
240
	l_ulong		sc_rcx;
241
	l_ulong		sc_rsp;
242
	l_ulong		sc_rip;
243
	l_ulong		sc_rflags;
244
	l_ushort	sc_cs;
245
	l_ushort	sc_gs;
246
	l_ushort	sc_fs;
247
	l_ushort	sc___pad0;
248
	l_ulong		sc_err;
249
	l_ulong		sc_trapno;
250
	l_sigset_t	sc_mask;
251
	l_ulong		sc_cr2;
252
	struct l_fpstate *sc_fpstate;
253
	l_ulong		sc_reserved1[8];
254
};
255
256
struct l_ucontext {
257
	l_ulong		uc_flags;
258
	l_uintptr_t	uc_link;
259
	l_stack_t	uc_stack;
260
	struct l_sigcontext	uc_mcontext;
261
	l_sigset_t	uc_sigmask;
262
};
263
264
#define LINUX_SI_PREAMBLE_SIZE	(4 * sizeof(int))
265
#define	LINUX_SI_MAX_SIZE	128
266
#define	LINUX_SI_PAD_SIZE	((LINUX_SI_MAX_SIZE - \
267
				    LINUX_SI_PREAMBLE_SIZE) / sizeof(l_int))
268
typedef union l_sigval {
269
	l_int		sival_int;
270
	l_uintptr_t	sival_ptr;
271
} l_sigval_t;
272
273
typedef struct l_siginfo {
274
	l_int		lsi_signo;
275
	l_int		lsi_errno;
276
	l_int		lsi_code;
277
	union {
278
		l_int	_pad[LINUX_SI_PAD_SIZE];
279
280
		struct {
281
			l_pid_t		_pid;
282
			l_uid_t		_uid;
283
		} _kill;
284
285
		struct {
286
			l_timer_t	_tid;
287
			l_int		_overrun;
288
			char		_pad[sizeof(l_uid_t) - sizeof(int)];
289
			union l_sigval	_sigval;
290
			l_uint		_sys_private;
291
		} _timer;
292
293
		struct {
294
			l_pid_t		_pid;		/* sender's pid */
295
			l_uid_t		_uid;		/* sender's uid */
296
			union l_sigval	_sigval;
297
		} _rt;
298
299
		struct {
300
			l_pid_t		_pid;		/* which child */
301
			l_uid_t		_uid;		/* sender's uid */
302
			l_int		_status;	/* exit code */
303
			l_clock_t	_utime;
304
			l_clock_t	_stime;
305
		} _sigchld;
306
307
		struct {
308
			l_uintptr_t	_addr;	/* Faulting insn/memory ref. */
309
		} _sigfault;
310
311
		struct {
312
			l_long		_band;	/* POLL_IN,POLL_OUT,POLL_MSG */
313
			l_int		_fd;
314
		} _sigpoll;
315
	} _sifields;
316
} l_siginfo_t;
317
318
#define	lsi_pid		_sifields._kill._pid
319
#define	lsi_uid		_sifields._kill._uid
320
#define	lsi_tid		_sifields._timer._tid
321
#define	lsi_overrun	_sifields._timer._overrun
322
#define	lsi_sys_private	_sifields._timer._sys_private
323
#define	lsi_status	_sifields._sigchld._status
324
#define	lsi_utime	_sifields._sigchld._utime
325
#define	lsi_stime	_sifields._sigchld._stime
326
#define	lsi_value	_sifields._rt._sigval
327
#define	lsi_int		_sifields._rt._sigval.sival_int
328
#define	lsi_ptr		_sifields._rt._sigval.sival_ptr
329
#define	lsi_addr	_sifields._sigfault._addr
330
#define	lsi_band	_sifields._sigpoll._band
331
#define	lsi_fd		_sifields._sigpoll._fd
332
333
/*
334
 * We make the stack look like Linux expects it when calling a signal
335
 * handler, but use the BSD way of calling the handler and sigreturn().
336
 * This means that we need to pass the pointer to the handler too.
337
 * It is appended to the frame to not interfere with the rest of it.
338
 */
339
340
struct l_rt_sigframe {
341
	struct l_ucontext	sf_sc;
342
	struct l_siginfo	sf_si;
343
	l_handler_t		sf_handler;
344
};
345
346
/*
347
 * mount flags
348
 */
349
#define	LINUX_MS_RDONLY		0x0001
350
#define	LINUX_MS_NOSUID		0x0002
351
#define	LINUX_MS_NODEV		0x0004
352
#define	LINUX_MS_NOEXEC		0x0008
353
#define	LINUX_MS_REMOUNT	0x0020
354
355
/*
356
 * SystemV IPC defines
357
 */
358
#define	LINUX_IPC_RMID		0
359
#define	LINUX_IPC_SET		1
360
#define	LINUX_IPC_STAT		2
361
#define	LINUX_IPC_INFO		3
362
363
#define	LINUX_SHM_LOCK		11
364
#define	LINUX_SHM_UNLOCK	12
365
#define	LINUX_SHM_STAT		13
366
#define	LINUX_SHM_INFO		14
367
368
#define	LINUX_SHM_RDONLY	0x1000
369
#define	LINUX_SHM_RND		0x2000
370
#define	LINUX_SHM_REMAP		0x4000
371
372
/* semctl commands */
373
#define	LINUX_GETPID		11
374
#define	LINUX_GETVAL		12
375
#define	LINUX_GETALL		13
376
#define	LINUX_GETNCNT		14
377
#define	LINUX_GETZCNT		15
378
#define	LINUX_SETVAL		16
379
#define	LINUX_SETALL		17
380
#define	LINUX_SEM_STAT		18
381
#define	LINUX_SEM_INFO		19
382
383
union l_semun {
384
	l_int		val;
385
	l_uintptr_t	buf;
386
	l_uintptr_t	array;
387
	l_uintptr_t	__buf;
388
	l_uintptr_t	__pad;
389
};
390
391
struct l_ipc_perm {
392
	l_key_t		key;
393
	l_uid_t		uid;
394
	l_gid_t		gid;
395
	l_uid_t		cuid;
396
	l_gid_t		cgid;
397
	l_ushort	mode;
398
	l_ushort	seq;
399
};
400
401
/*
402
 * Socket defines
403
 */
404
405
#define	LINUX_SOL_SOCKET	1
406
#define	LINUX_SOL_IP		0
407
#define	LINUX_SOL_IPX		256
408
#define	LINUX_SOL_AX25		257
409
#define	LINUX_SOL_TCP		6
410
#define	LINUX_SOL_UDP		17
411
412
#define	LINUX_SO_DEBUG		1
413
#define	LINUX_SO_REUSEADDR	2
414
#define	LINUX_SO_TYPE		3
415
#define	LINUX_SO_ERROR		4
416
#define	LINUX_SO_DONTROUTE	5
417
#define	LINUX_SO_BROADCAST	6
418
#define	LINUX_SO_SNDBUF		7
419
#define	LINUX_SO_RCVBUF		8
420
#define	LINUX_SO_KEEPALIVE	9
421
#define	LINUX_SO_OOBINLINE	10
422
#define	LINUX_SO_NO_CHECK	11
423
#define	LINUX_SO_PRIORITY	12
424
#define	LINUX_SO_LINGER		13
425
#define	LINUX_SO_PASSCRED	16
426
#define	LINUX_SO_PEERCRED	17
427
#define	LINUX_SO_RCVLOWAT	18
428
#define	LINUX_SO_SNDLOWAT	19
429
#define	LINUX_SO_RCVTIMEO	20
430
#define	LINUX_SO_SNDTIMEO	21
431
#define	LINUX_SO_TIMESTAMP	29
432
#define	LINUX_SO_ACCEPTCONN	30
433
434
#define	LINUX_IP_TOS		1
435
#define	LINUX_IP_TTL		2
436
#define	LINUX_IP_HDRINCL	3
437
#define	LINUX_IP_OPTIONS	4
438
439
#define	LINUX_IP_MULTICAST_IF		32
440
#define	LINUX_IP_MULTICAST_TTL		33
441
#define	LINUX_IP_MULTICAST_LOOP		34
442
#define	LINUX_IP_ADD_MEMBERSHIP		35
443
#define	LINUX_IP_DROP_MEMBERSHIP	36
444
445
struct l_sockaddr {
446
	l_ushort	sa_family;
447
	char		sa_data[14];
448
};
449
450
struct l_ifmap {
451
	l_ulong		mem_start;
452
	l_ulong		mem_end;
453
	l_ushort	base_addr;
454
	u_char		irq;
455
	u_char		dma;
456
	u_char		port;
457
} __packed;
458
459
#define	LINUX_IFHWADDRLEN	6
460
#define	LINUX_IFNAMSIZ		16
461
462
struct l_ifreq {
463
	union {
464
		char	ifrn_name[LINUX_IFNAMSIZ];
465
	} ifr_ifrn;
466
467
	union {
468
		struct l_sockaddr	ifru_addr;
469
		struct l_sockaddr	ifru_dstaddr;
470
		struct l_sockaddr	ifru_broadaddr;
471
		struct l_sockaddr	ifru_netmask;
472
		struct l_sockaddr	ifru_hwaddr;
473
		l_short		ifru_flags[1];
474
		l_int		ifru_metric;
475
		l_int		ifru_mtu;
476
		struct l_ifmap	ifru_map;
477
		char		ifru_slave[LINUX_IFNAMSIZ];
478
		l_uintptr_t	ifru_data;
479
	} ifr_ifru;
480
} __packed;
481
482
#define	ifr_name	ifr_ifrn.ifrn_name	/* Interface name */
483
#define	ifr_hwaddr	ifr_ifru.ifru_hwaddr	/* MAC address */
484
485
struct l_ifconf {
486
	int	ifc_len;
487
	union {
488
		l_uintptr_t	ifcu_buf;
489
		l_uintptr_t	ifcu_req;
490
	} ifc_ifcu;
491
};
492
493
#define	ifc_buf		ifc_ifcu.ifcu_buf
494
#define	ifc_req		ifc_ifcu.ifcu_req
495
496
/*
497
 * poll()
498
 */
499
#define	LINUX_POLLIN		0x0001
500
#define	LINUX_POLLPRI		0x0002
501
#define	LINUX_POLLOUT		0x0004
502
#define	LINUX_POLLERR		0x0008
503
#define	LINUX_POLLHUP		0x0010
504
#define	LINUX_POLLNVAL		0x0020
505
#define	LINUX_POLLRDNORM	0x0040
506
#define	LINUX_POLLRDBAND	0x0080
507
#define	LINUX_POLLWRNORM	0x0100
508
#define	LINUX_POLLWRBAND	0x0200
509
#define	LINUX_POLLMSG		0x0400
510
511
struct l_pollfd {
512
	l_int		fd;
513
	l_short		events;
514
	l_short		revents;
515
};
516
517
518
#define	LINUX_CLONE_VM			0x00000100
519
#define	LINUX_CLONE_FS			0x00000200
520
#define	LINUX_CLONE_FILES		0x00000400
521
#define	LINUX_CLONE_SIGHAND		0x00000800
522
#define	LINUX_CLONE_PID			0x00001000	/* No longer exist in Linux */
523
#define	LINUX_CLONE_VFORK		0x00004000
524
#define	LINUX_CLONE_PARENT		0x00008000
525
#define	LINUX_CLONE_THREAD		0x00010000
526
#define	LINUX_CLONE_SETTLS		0x00080000
527
#define	LINUX_CLONE_PARENT_SETTID	0x00100000
528
#define	LINUX_CLONE_CHILD_CLEARTID	0x00200000
529
#define	LINUX_CLONE_CHILD_SETTID	0x01000000
530
531
#define LINUX_ARCH_SET_GS		0x1001
532
#define LINUX_ARCH_SET_FS		0x1002
533
#define LINUX_ARCH_GET_GS		0x1003
534
#define LINUX_ARCH_GET_FS		0x1004
535
536
/* robust futexes */
537
struct linux_robust_list {
538
	l_uintptr_t			next;
539
};
540
 
541
struct linux_robust_list_head {
542
	struct linux_robust_list	list;
543
	l_long				futex_offset;
544
	l_uintptr_t			pending_list;
545
};
546
547
#endif /* !_AMD64_LINUX_H_ */
(-)sys/amd64/linux/linux_dummy.c (+141 lines)
Line 0 Link Here
1
/*-
2
 * Copyright (c) 2013 Dmitry Chagin
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
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
27
#include <sys/cdefs.h>
28
__FBSDID("$FreeBSD$");
29
30
#include "opt_compat.h"
31
#include "opt_kdtrace.h"
32
33
#include <sys/param.h>
34
#include <sys/kernel.h>
35
#include <sys/sdt.h>
36
#include <sys/systm.h>
37
#include <sys/proc.h>
38
39
#include <amd64/linux/linux.h>
40
#include <amd64/linux/linux_proto.h>
41
#include <compat/linux/linux_dtrace.h>
42
#include <compat/linux/linux_util.h>
43
44
/* DTrace init */
45
LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
46
47
DUMMY(mincore);
48
DUMMY(sendfile);
49
DUMMY(ptrace);
50
DUMMY(syslog);
51
DUMMY(setfsuid);
52
DUMMY(setfsgid);
53
DUMMY(sysfs);
54
DUMMY(vhangup);
55
DUMMY(pivot_root);
56
DUMMY(adjtimex);
57
DUMMY(swapoff);
58
DUMMY(create_module);
59
DUMMY(init_module);
60
DUMMY(delete_module);
61
DUMMY(get_kernel_syms);
62
DUMMY(query_module);
63
DUMMY(quotactl);
64
DUMMY(nfsservctl);
65
DUMMY(getpmsg);
66
DUMMY(putpmsg);
67
DUMMY(afs_syscall);
68
DUMMY(tuxcall);
69
DUMMY(security);
70
DUMMY(set_thread_area);
71
DUMMY(lookup_dcookie);
72
DUMMY(epoll_ctl_old);
73
DUMMY(epoll_wait_old);
74
DUMMY(remap_file_pages);
75
DUMMY(semtimedop);
76
DUMMY(mbind);
77
DUMMY(get_mempolicy);
78
DUMMY(set_mempolicy);
79
DUMMY(mq_open);
80
DUMMY(mq_unlink);
81
DUMMY(mq_timedsend);
82
DUMMY(mq_timedreceive);
83
DUMMY(mq_notify);
84
DUMMY(mq_getsetattr);
85
DUMMY(kexec_load);
86
DUMMY(add_key);
87
DUMMY(request_key);
88
DUMMY(keyctl);
89
DUMMY(ioprio_set);
90
DUMMY(ioprio_get);
91
DUMMY(inotify_init);
92
DUMMY(inotify_add_watch);
93
DUMMY(inotify_rm_watch);
94
DUMMY(migrate_pages);
95
DUMMY(unshare);
96
DUMMY(splice);
97
DUMMY(tee);
98
DUMMY(sync_file_range);
99
DUMMY(vmsplice);
100
DUMMY(move_pages);
101
DUMMY(signalfd);
102
DUMMY(timerfd);
103
DUMMY(timerfd_settime);
104
DUMMY(timerfd_gettime);
105
DUMMY(signalfd4);
106
DUMMY(inotify_init1);
107
DUMMY(preadv);
108
DUMMY(pwritev);
109
DUMMY(rt_tsigqueueinfo);
110
DUMMY(perf_event_open);
111
DUMMY(fanotify_init);
112
DUMMY(fanotify_mark);
113
DUMMY(name_to_handle_at);
114
DUMMY(open_by_handle_at);
115
DUMMY(clock_adjtime);
116
DUMMY(setns);
117
DUMMY(process_vm_readv);
118
DUMMY(process_vm_writev);
119
DUMMY(kcmp);
120
DUMMY(finit_module);
121
122
#define DUMMY_XATTR(s)						\
123
int								\
124
linux_ ## s ## xattr(						\
125
    struct thread *td, struct linux_ ## s ## xattr_args *arg)	\
126
{								\
127
								\
128
	return (ENOATTR);					\
129
}
130
DUMMY_XATTR(set);
131
DUMMY_XATTR(lset);
132
DUMMY_XATTR(fset);
133
DUMMY_XATTR(get);
134
DUMMY_XATTR(lget);
135
DUMMY_XATTR(fget);
136
DUMMY_XATTR(list);
137
DUMMY_XATTR(llist);
138
DUMMY_XATTR(flist);
139
DUMMY_XATTR(remove);
140
DUMMY_XATTR(lremove);
141
DUMMY_XATTR(fremove);
(-)sys/amd64/linux/linux_genassym.c (+15 lines)
Line 0 Link Here
1
#include <sys/cdefs.h>
2
__FBSDID("$FreeBSD$");
3
4
#include <sys/param.h>
5
#include <sys/assym.h>
6
#include <sys/systm.h>
7
8
#include <amd64/linux/linux.h>
9
#include <compat/linux/linux_mib.h>
10
11
ASSYM(LINUX_RT_SIGF_HANDLER, offsetof(struct l_rt_sigframe, sf_handler));
12
ASSYM(LINUX_RT_SIGF_UC, offsetof(struct l_rt_sigframe, sf_sc));
13
ASSYM(LINUX_RT_SIGF_SC, offsetof(struct l_ucontext, uc_mcontext));
14
ASSYM(LINUX_VERSION_CODE, LINUX_VERSION_CODE);
15
ASSYM(LINUX_SC_RSP, offsetof(struct l_sigcontext, sc_rsp));
(-)sys/amd64/linux/linux_ipc64.h (+142 lines)
Line 0 Link Here
1
/*-
2
 * Copyright (c) 2002 Maxim Sobolev <sobomax@FreeBSD.org>
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
 * $FreeBSD$
29
 */
30
31
#ifndef _AMD64_LINUX_LINUX_IPC64_H_
32
#define	_AMD64_LINUX_LINUX_IPC64_H_
33
34
/*
35
 * The ipc64_perm structure for i386 architecture.
36
 * Note extra padding because this structure is passed back and forth
37
 * between kernel and user space.
38
 *
39
 * Pad space is left for:
40
 * - 32-bit mode_t and seq
41
 * - 2 miscellaneous 32-bit values
42
 */
43
44
struct l_ipc64_perm
45
{
46
	l_key_t		key;
47
	l_uid_t		uid;
48
	l_gid_t		gid;
49
	l_uid_t		cuid;
50
	l_gid_t		cgid;
51
	l_mode_t	mode;
52
	l_ushort	__pad1;
53
	l_ushort	seq;
54
	l_ushort	__pad2;
55
	l_ulong		__unused1;
56
	l_ulong		__unused2;
57
};
58
59
/*
60
 * The msqid64_ds structure for i386 architecture.
61
 * Note extra padding because this structure is passed back and forth
62
 * between kernel and user space.
63
 *
64
 * Pad space is left for:
65
 * - 64-bit time_t to solve y2038 problem
66
 * - 2 miscellaneous 32-bit values
67
 */
68
69
struct l_msqid64_ds {
70
	struct l_ipc64_perm msg_perm;
71
	l_time_t	msg_stime;	/* last msgsnd time */
72
	l_ulong		__unused1;
73
	l_time_t	msg_rtime;	/* last msgrcv time */
74
	l_ulong		__unused2;
75
	l_time_t	msg_ctime;	/* last change time */
76
	l_ulong		__unused3;
77
	l_ulong		msg_cbytes;	/* current number of bytes on queue */
78
	l_ulong		msg_qnum;	/* number of messages in queue */
79
	l_ulong		msg_qbytes;	/* max number of bytes on queue */
80
	l_pid_t		msg_lspid;	/* pid of last msgsnd */
81
	l_pid_t		msg_lrpid;	/* last receive pid */
82
	l_ulong		__unused4;
83
	l_ulong		__unused5;
84
};
85
86
/*
87
 * The semid64_ds structure for i386 architecture.
88
 * Note extra padding because this structure is passed back and forth
89
 * between kernel and user space.
90
 *
91
 * Pad space is left for:
92
 * - 64-bit time_t to solve y2038 problem
93
 * - 2 miscellaneous 32-bit values
94
 */
95
96
struct l_semid64_ds {
97
	struct l_ipc64_perm sem_perm;	/* permissions */
98
	l_time_t	sem_otime;	/* last semop time */
99
	l_ulong		__unused1;
100
	l_time_t	sem_ctime;	/* last change time */
101
	l_ulong		__unused2;
102
	l_ulong		sem_nsems;	/* no. of semaphores in array */
103
	l_ulong		__unused3;
104
	l_ulong		__unused4;
105
};
106
107
/*
108
 * The shmid64_ds structure for i386 architecture.
109
 * Note extra padding because this structure is passed back and forth
110
 * between kernel and user space.
111
 *
112
 * Pad space is left for:
113
 * - 64-bit time_t to solve y2038 problem
114
 * - 2 miscellaneous 32-bit values
115
 */
116
117
struct l_shmid64_ds {
118
	struct l_ipc64_perm shm_perm;	/* operation perms */
119
	l_size_t	shm_segsz;	/* size of segment (bytes) */
120
	l_time_t	shm_atime;	/* last attach time */
121
	l_time_t	shm_dtime;	/* last detach time */
122
	l_time_t	shm_ctime;	/* last change time */
123
	l_pid_t		shm_cpid;	/* pid of creator */
124
	l_pid_t		shm_lpid;	/* pid of last operator */
125
	l_ulong		shm_nattch;	/* no. of current attaches */
126
	l_ulong		__unused4;
127
	l_ulong		__unused5;
128
};
129
130
struct l_shminfo64 {
131
	l_ulong		shmmax;
132
	l_ulong		shmmin;
133
	l_ulong		shmmni;
134
	l_ulong		shmseg;
135
	l_ulong		shmall;
136
	l_ulong   	__unused1;
137
	l_ulong		__unused2;
138
	l_ulong		__unused3;
139
	l_ulong		__unused4;
140
};
141
142
#endif /* !_AMD64_LINUX_LINUX_IPC64_H_ */
(-)sys/amd64/linux/linux_locore.s (+123 lines)
Line 0 Link Here
1
/* $FreeBSD$ */
2
3
#include "linux_assym.h"			/* system definitions */
4
#include <machine/asmacros.h>			/* miscellaneous asm macros */
5
6
#include <amd64/linux/linux_syscall.h>		/* system call numbers */
7
8
	.data
9
10
	.globl linux_platform
11
linux_platform:
12
	.asciz "x86_64"
13
14
15
	.text
16
/*
17
 * To avoid excess stack frame the signal trampoline code emulates
18
 * the 'call' instruction.
19
 */
20
NON_GPROF_ENTRY(linux_rt_sigcode)
21
	movq	%rsp, %rbx			/* preserve sigframe */
22
	call	.getip
23
.getip:
24
	popq	%rax
25
	add	$.startrtsigcode-.getip, %rax	/* ret address */
26
	pushq	%rax
27
	jmp	*LINUX_RT_SIGF_HANDLER(%rbx)
28
.startrtsigcode:
29
	movq	$LINUX_SYS_linux_rt_sigreturn,%rax   /* linux_rt_sigreturn() */
30
	syscall					/* enter kernel with args */
31
	hlt
32
0:	jmp	0b
33
34
NON_GPROF_ENTRY(__vdso_clock_gettime)
35
.startclockgettime:
36
	movq	$LINUX_SYS_linux_clock_gettime,%rax
37
	syscall
38
	ret
39
.endclockgettime:
40
.weak clock_gettime
41
.set clock_gettime, __vdso_clock_gettime
42
43
NON_GPROF_ENTRY(__vdso_time)
44
.starttime:
45
	movq	$LINUX_SYS_linux_time,%rax
46
	syscall
47
	ret
48
.endtime:
49
.weak time
50
.set time, __vdso_time
51
52
NON_GPROF_ENTRY(__vdso_gettimeofday)
53
.startgettimeofday:
54
	movq	$LINUX_SYS_gettimeofday,%rax
55
	syscall
56
	ret
57
.endgettimeofday:
58
.weak gettimeofday
59
.set gettimeofday, __vdso_gettimeofday
60
61
NON_GPROF_ENTRY(__vdso_getcpu)
62
.startgetcpu:
63
	movq	$-38,%rax	/* not implemented */
64
	ret
65
.endgetcpu:
66
.weak getcpu
67
.set getcpu, __vdso_getcpu
68
69
#if 0
70
	.section .note.Linux, "a",@note
71
	.long 2f - 1f		/* namesz */
72
	.balign 4
73
	.long 4f - 3f		/* descsz */
74
	.long 0
75
1:
76
	.asciz "Linux"
77
2:
78
	.balign 4
79
3:
80
	.long LINUX_VERSION_CODE
81
4:
82
	.balign 4
83
	.previous
84
#endif
85
86
#define do_cfa_expr(offset)                                             \
87
	.byte 0x0f;			/* DW_CFA_def_cfa_expression */ \
88
	.uleb128 11f-10f;		/*   length */                  \
89
10:	.byte 0x74;			/*     DW_OP_breg4 */           \
90
	.sleb128 offset;		/*      offset */               \
91
	.byte 0x06;			/*     DW_OP_deref */           \
92
11:
93
94
	.section .eh_frame,"a",@progbits
95
.LSTARTFRAMEDLSI0:
96
	.long .LENDCIEDLSI0-.LSTARTCIEDLSI0
97
.LSTARTCIEDLSI0:
98
	.long 0					/* CIE ID */
99
	.byte 1					/* Version number */
100
	.string "zR"				/* NULL-terminated
101
						 * augmentation string
102
						 */
103
	.uleb128 1				/* Code alignment factor */
104
	.sleb128 -4				/* Data alignment factor */
105
	.byte 8					/* Return address register column */
106
	.uleb128 1				/* Augmentation value length */
107
	.byte 0x1b				/* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
108
	.byte 0x0c				/* DW_CFA_def_cfa */
109
	.uleb128 4
110
	.uleb128 4
111
	.byte 0x88				/* DW_CFA_offset, column 0x8 */
112
	.uleb128 1
113
	.align 4
114
.LENDCIEDLSI0:
115
	.long .LENDFDEDLSI0-.LSTARTFDEDLSI0	/* Length FDE */
116
.LSTARTFDEDLSI0:
117
	.long .LSTARTFDEDLSI0-.LSTARTFRAMEDLSI0	/* CIE pointer */
118
	.long .startclockgettime-.		/* PC-relative start address */
119
	.long .endclockgettime-.startclockgettime
120
	.uleb128 0
121
	.align 4
122
.LENDFDEDLSI0:
123
	.previous
(-)sys/amd64/linux/linux_machdep.c (+527 lines)
Line 0 Link Here
1
/*-
2
 * Copyright (c) 2013 Dmitry Chagin
3
 * Copyright (c) 2004 Tim J. Robbins
4
 * Copyright (c) 2002 Doug Rabson
5
 * Copyright (c) 2000 Marcel Moolenaar
6
 * All rights reserved.
7
 *
8
 * Redistribution and use in source and binary forms, with or without
9
 * modification, are permitted provided that the following conditions
10
 * are met:
11
 * 1. Redistributions of source code must retain the above copyright
12
 *    notice, this list of conditions and the following disclaimer
13
 *    in this position and unchanged.
14
 * 2. Redistributions in binary form must reproduce the above copyright
15
 *    notice, this list of conditions and the following disclaimer in the
16
 *    documentation and/or other materials provided with the distribution.
17
 * 3. The name of the author may not be used to endorse or promote products
18
 *    derived from this software without specific prior written permission.
19
 *
20
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
 */
31
32
#include <sys/cdefs.h>
33
__FBSDID("$FreeBSD$");
34
35
#include <sys/param.h>
36
#include <sys/kernel.h>
37
#include <sys/systm.h>
38
#include <sys/capability.h>
39
#include <sys/dirent.h>
40
#include <sys/file.h>
41
#include <sys/fcntl.h>
42
#include <sys/filedesc.h>
43
#include <sys/clock.h>
44
#include <sys/imgact.h>
45
#include <sys/ktr.h>
46
#include <sys/limits.h>
47
#include <sys/lock.h>
48
#include <sys/malloc.h>
49
#include <sys/mman.h>
50
#include <sys/mutex.h>
51
#include <sys/priv.h>
52
#include <sys/proc.h>
53
#include <sys/resource.h>
54
#include <sys/resourcevar.h>
55
#include <sys/sched.h>
56
#include <sys/syscallsubr.h>
57
#include <sys/sysproto.h>
58
#include <sys/vnode.h>
59
#include <sys/unistd.h>
60
#include <sys/wait.h>
61
62
#include <security/mac/mac_framework.h>
63
64
#include <ufs/ufs/extattr.h>
65
#include <ufs/ufs/quota.h>
66
#include <ufs/ufs/ufsmount.h>
67
68
#include <machine/frame.h>
69
#include <machine/md_var.h>
70
#include <machine/pcb.h>
71
#include <machine/psl.h>
72
#include <machine/segments.h>
73
#include <machine/specialreg.h>
74
75
#include <vm/vm.h>
76
#include <vm/pmap.h>
77
#include <vm/vm_extern.h>
78
#include <vm/vm_kern.h>
79
#include <vm/vm_map.h>
80
81
#include <amd64/linux/linux.h>
82
#include <amd64/linux/linux_proto.h>
83
#include <compat/linux/linux_ipc.h>
84
#include <compat/linux/linux_file.h>
85
#include <compat/linux/linux_misc.h>
86
#include <compat/linux/linux_signal.h>
87
#include <compat/linux/linux_util.h>
88
#include <compat/linux/linux_emul.h>
89
90
91
int
92
linux_execve(struct thread *td, struct linux_execve_args *args)
93
{
94
	struct image_args eargs;
95
	char *path;
96
	int error;
97
98
	LCONVPATHEXIST(td, args->path, &path);
99
100
	LINUX_CTR(execve);
101
102
	error = exec_copyin_args(&eargs, path, UIO_SYSSPACE, args->argp,
103
	    args->envp);
104
	free(path, M_TEMP);
105
	if (error == 0)
106
		error = linux_common_execve(td, &eargs);
107
	return (error);
108
}
109
110
int
111
linux_set_upcall_kse(struct thread *td, register_t stack)
112
{
113
114
	if (stack)
115
		td->td_frame->tf_rsp = stack;
116
117
	/*
118
	 * The newly created Linux thread returns
119
	 * to the user space by the same path that a parent do.
120
	 */
121
	td->td_frame->tf_rax = 0;
122
	return (0);
123
}
124
125
#define STACK_SIZE  (2 * 1024 * 1024)
126
#define GUARD_SIZE  (4 * PAGE_SIZE)
127
128
int
129
linux_mmap2(struct thread *td, struct linux_mmap2_args *args)
130
{
131
	struct proc *p = td->td_proc;
132
	struct mmap_args /* {
133
		caddr_t addr;
134
		size_t len;
135
		int prot;
136
		int flags;
137
		int fd;
138
		long pad;
139
		off_t pos;
140
	} */ bsd_args;
141
	int error;
142
	struct file *fp;
143
	cap_rights_t rights;
144
145
	LINUX_CTR6(mmap2, "0x%lx, %ld, %ld, 0x%08lx, %ld, 0x%lx",
146
	    args->addr, args->len, args->prot,
147
	    args->flags, args->fd, args->pgoff);
148
149
	error = 0;
150
	bsd_args.flags = 0;
151
	fp = NULL;
152
153
	/*
154
	 * Linux mmap(2):
155
	 * You must specify exactly one of MAP_SHARED and MAP_PRIVATE
156
	 */
157
	if (! ((args->flags & LINUX_MAP_SHARED) ^
158
	    (args->flags & LINUX_MAP_PRIVATE)))
159
		return (EINVAL);
160
161
	if (args->flags & LINUX_MAP_SHARED)
162
		bsd_args.flags |= MAP_SHARED;
163
	if (args->flags & LINUX_MAP_PRIVATE)
164
		bsd_args.flags |= MAP_PRIVATE;
165
	if (args->flags & LINUX_MAP_FIXED)
166
		bsd_args.flags |= MAP_FIXED;
167
	if (args->flags & LINUX_MAP_ANON)
168
		bsd_args.flags |= MAP_ANON;
169
	else
170
		bsd_args.flags |= MAP_NOSYNC;
171
	if (args->flags & LINUX_MAP_GROWSDOWN)
172
		bsd_args.flags |= MAP_STACK;
173
174
	/*
175
	 * PROT_READ, PROT_WRITE, or PROT_EXEC implies PROT_READ and PROT_EXEC
176
	 * on Linux/i386. We do this to ensure maximum compatibility.
177
	 * Linux/ia64 does the same in i386 emulation mode.
178
	 */
179
	bsd_args.prot = args->prot;
180
	if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC))
181
		bsd_args.prot |= PROT_READ | PROT_EXEC;
182
183
	/* Linux does not check file descriptor when MAP_ANONYMOUS is set. */
184
	bsd_args.fd = (bsd_args.flags & MAP_ANON) ? -1 : args->fd;
185
	if (bsd_args.fd != -1) {
186
		/*
187
		 * Linux follows Solaris mmap(2) description:
188
		 * The file descriptor fildes is opened with
189
		 * read permission, regardless of the
190
		 * protection options specified.
191
		 */
192
193
		error = fget(td, bsd_args.fd,
194
		    cap_rights_init(&rights, CAP_MMAP), &fp);
195
		if (error != 0 )
196
			return (error);
197
		if (fp->f_type != DTYPE_VNODE) {
198
			fdrop(fp, td);
199
			return (EINVAL);
200
		}
201
202
		/* Linux mmap() just fails for O_WRONLY files */
203
		if (!(fp->f_flag & FREAD)) {
204
			fdrop(fp, td);
205
			return (EACCES);
206
		}
207
208
		fdrop(fp, td);
209
	}
210
211
	if (args->flags & LINUX_MAP_GROWSDOWN) {
212
		/*
213
		 * The Linux MAP_GROWSDOWN option does not limit auto
214
		 * growth of the region.  Linux mmap with this option
215
		 * takes as addr the inital BOS, and as len, the initial
216
		 * region size.  It can then grow down from addr without
217
		 * limit.  However, Linux threads has an implicit internal
218
		 * limit to stack size of STACK_SIZE.  Its just not
219
		 * enforced explicitly in Linux.  But, here we impose
220
		 * a limit of (STACK_SIZE - GUARD_SIZE) on the stack
221
		 * region, since we can do this with our mmap.
222
		 *
223
		 * Our mmap with MAP_STACK takes addr as the maximum
224
		 * downsize limit on BOS, and as len the max size of
225
		 * the region.  It then maps the top SGROWSIZ bytes,
226
		 * and auto grows the region down, up to the limit
227
		 * in addr.
228
		 *
229
		 * If we don't use the MAP_STACK option, the effect
230
		 * of this code is to allocate a stack region of a
231
		 * fixed size of (STACK_SIZE - GUARD_SIZE).
232
		 */
233
234
		if ((caddr_t)PTRIN(args->addr) + args->len >
235
		    p->p_vmspace->vm_maxsaddr) {
236
			/*
237
			 * Some Linux apps will attempt to mmap
238
			 * thread stacks near the top of their
239
			 * address space.  If their TOS is greater
240
			 * than vm_maxsaddr, vm_map_growstack()
241
			 * will confuse the thread stack with the
242
			 * process stack and deliver a SEGV if they
243
			 * attempt to grow the thread stack past their
244
			 * current stacksize rlimit.  To avoid this,
245
			 * adjust vm_maxsaddr upwards to reflect
246
			 * the current stacksize rlimit rather
247
			 * than the maximum possible stacksize.
248
			 * It would be better to adjust the
249
			 * mmap'ed region, but some apps do not check
250
			 * mmap's return value.
251
			 */
252
			PROC_LOCK(p);
253
			p->p_vmspace->vm_maxsaddr = (char *)USRSTACK -
254
			    lim_cur(p, RLIMIT_STACK);
255
			PROC_UNLOCK(p);
256
		}
257
258
		/*
259
		 * This gives us our maximum stack size and a new BOS.
260
		 * If we're using VM_STACK, then mmap will just map
261
		 * the top SGROWSIZ bytes, and let the stack grow down
262
		 * to the limit at BOS.  If we're not using VM_STACK
263
		 * we map the full stack, since we don't have a way
264
		 * to autogrow it.
265
		 */
266
		if (args->len > STACK_SIZE - GUARD_SIZE) {
267
			bsd_args.addr = (caddr_t)PTRIN(args->addr);
268
			bsd_args.len = args->len;
269
		} else {
270
			bsd_args.addr = (caddr_t)PTRIN(args->addr) -
271
			    (STACK_SIZE - GUARD_SIZE - args->len);
272
			bsd_args.len = STACK_SIZE - GUARD_SIZE;
273
		}
274
	} else {
275
		bsd_args.addr = (caddr_t)PTRIN(args->addr);
276
		bsd_args.len  = args->len;
277
	}
278
	bsd_args.pos = (off_t)args->pgoff;
279
280
	error = sys_mmap(td, &bsd_args);
281
282
	LINUX_CTR2(mmap2, "return: %d (%p)",
283
	    error, td->td_retval[0]);
284
	return (error);
285
}
286
287
int
288
linux_mprotect(struct thread *td, struct linux_mprotect_args *uap)
289
{
290
	struct mprotect_args bsd_args;
291
292
	LINUX_CTR(mprotect);
293
294
	bsd_args.addr = uap->addr;
295
	bsd_args.len = uap->len;
296
	bsd_args.prot = uap->prot;
297
	if (bsd_args.prot & (PROT_READ | PROT_WRITE | PROT_EXEC))
298
		bsd_args.prot |= PROT_READ | PROT_EXEC;
299
	return (sys_mprotect(td, &bsd_args));
300
}
301
302
int
303
linux_iopl(struct thread *td, struct linux_iopl_args *args)
304
{
305
	int error;
306
307
	LINUX_CTR(iopl);
308
309
	if (args->level > 3)
310
		return (EINVAL);
311
	if ((error = priv_check(td, PRIV_IO)) != 0)
312
		return (error);
313
	if ((error = securelevel_gt(td->td_ucred, 0)) != 0)
314
		return (error);
315
	td->td_frame->tf_rflags = (td->td_frame->tf_rflags & ~PSL_IOPL) |
316
	    (args->level * (PSL_IOPL / 3));
317
318
	return (0);
319
}
320
321
int
322
linux_rt_sigsuspend(struct thread *td, struct linux_rt_sigsuspend_args *uap)
323
{
324
	l_sigset_t lmask;
325
	sigset_t sigmask;
326
	int error;
327
328
	LINUX_CTR2(rt_sigsuspend, "%p, %ld",
329
	    uap->newset, uap->sigsetsize);
330
331
	if (uap->sigsetsize != sizeof(l_sigset_t))
332
		return (EINVAL);
333
334
	error = copyin(uap->newset, &lmask, sizeof(l_sigset_t));
335
	if (error)
336
		return (error);
337
338
	linux_to_bsd_sigset(&lmask, &sigmask);
339
	return (kern_sigsuspend(td, sigmask));
340
}
341
342
int
343
linux_pause(struct thread *td, struct linux_pause_args *args)
344
{
345
	struct proc *p = td->td_proc;
346
	sigset_t sigmask;
347
348
	LINUX_CTR(pause);
349
350
	PROC_LOCK(p);
351
	sigmask = td->td_sigmask;
352
	PROC_UNLOCK(p);
353
	return (kern_sigsuspend(td, sigmask));
354
}
355
356
int
357
linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap)
358
{
359
	stack_t ss, oss;
360
	l_stack_t lss;
361
	int error;
362
363
	LINUX_CTR2(sigaltstack, "%p, %p", uap->uss, uap->uoss);
364
365
	if (uap->uss != NULL) {
366
		error = copyin(uap->uss, &lss, sizeof(l_stack_t));
367
		if (error)
368
			return (error);
369
370
		ss.ss_sp = PTRIN(lss.ss_sp);
371
		ss.ss_size = lss.ss_size;
372
		ss.ss_flags = linux_to_bsd_sigaltstack(lss.ss_flags);
373
	}
374
	error = kern_sigaltstack(td, (uap->uss != NULL) ? &ss : NULL,
375
	    (uap->uoss != NULL) ? &oss : NULL);
376
	if (!error && uap->uoss != NULL) {
377
		lss.ss_sp = PTROUT(oss.ss_sp);
378
		lss.ss_size = oss.ss_size;
379
		lss.ss_flags = bsd_to_linux_sigaltstack(oss.ss_flags);
380
		error = copyout(&lss, uap->uoss, sizeof(l_stack_t));
381
	}
382
383
	return (error);
384
}
385
386
/* XXX do all */
387
int
388
linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args)
389
{
390
	int error;
391
	struct pcb *pcb;
392
393
	LINUX_CTR2(arch_prctl, "0x%x, %p", args->code, args->addr);
394
395
	error = ENOTSUP;
396
	pcb = td->td_pcb;
397
398
	switch (args->code) {
399
	case LINUX_ARCH_GET_GS:
400
		error = copyout(&pcb->pcb_gsbase, (unsigned long *)args->addr,
401
		    sizeof(args->addr));
402
		break;
403
	case LINUX_ARCH_SET_GS:
404
		if (args->addr >= VM_MAXUSER_ADDRESS)
405
			return(EPERM);
406
		break;
407
	case LINUX_ARCH_GET_FS:
408
		error = copyout(&pcb->pcb_fsbase, (unsigned long *)args->addr,
409
		    sizeof(args->addr));
410
		break;
411
	case LINUX_ARCH_SET_FS:
412
		error = linux_set_cloned_tls(td, (void *)args->addr);
413
		break;
414
	default:
415
		error = EINVAL;
416
	}
417
	return (error);
418
}
419
420
int
421
linux_set_cloned_tls(struct thread *td, void *desc)
422
{
423
	struct pcb *pcb;
424
425
	if ((uint64_t)desc >= VM_MAXUSER_ADDRESS)
426
		return (EPERM);
427
428
	pcb = td->td_pcb;
429
	pcb->pcb_fsbase = (register_t)desc;
430
	td->td_frame->tf_fs = _ufssel;
431
432
	return (0);
433
}
434
435
int
436
linux_wait4(struct thread *td, struct linux_wait4_args *args)
437
{
438
	int error, options;
439
	struct rusage ru, *rup;
440
441
#ifdef DEBUG
442
	if (ldebug(wait4))
443
		printf(ARGS(wait4, "%d, %p, %d, %p"),
444
		    args->pid, (void *)args->status, args->options,
445
		    (void *)args->rusage);
446
#endif
447
	if (args->options & ~(LINUX_WUNTRACED | LINUX_WNOHANG |
448
	    LINUX_WCONTINUED | __WCLONE | __WNOTHREAD | __WALL))
449
		return (EINVAL);
450
451
	options = WEXITED;
452
	linux_to_bsd_waitopts(args->options, &options);
453
454
	if (args->rusage != NULL)
455
		rup = &ru;
456
	else
457
		rup = NULL;
458
	error = linux_common_wait(td, args->pid, args->status, options, rup);
459
	if (error)
460
		return (error);
461
	if (args->rusage != NULL)
462
		error = copyout(&ru, args->rusage, sizeof(ru));
463
464
	return (error);
465
}
466
467
int
468
linux_waitid(struct thread *td, struct linux_waitid_args *args)
469
{
470
	int status, options, sig;
471
	struct __wrusage wru;
472
	siginfo_t siginfo;
473
	l_siginfo_t lsi;
474
	idtype_t idtype;
475
	struct proc *p;
476
	int error;
477
478
	options = 0;
479
	linux_to_bsd_waitopts(args->options, &options);
480
481
	if (options & ~(WNOHANG | WNOWAIT | WEXITED | WUNTRACED | WCONTINUED))
482
		return (EINVAL);
483
	if (!(options & (WEXITED | WUNTRACED | WCONTINUED)))
484
		return (EINVAL);
485
486
	switch (args->idtype) {
487
	case LINUX_P_ALL:
488
		idtype = P_ALL;
489
		break;
490
	case LINUX_P_PID:
491
		if (args->id <= 0)
492
			return (EINVAL);
493
		idtype = P_PID;
494
		break;
495
	case LINUX_P_PGID:
496
		if (args->id <= 0)
497
			return (EINVAL);
498
		idtype = P_PGID;
499
		break;
500
	default:
501
		return (EINVAL);
502
	}
503
504
	error = kern_wait6(td, idtype, args->id, &status, options,
505
	    &wru, &siginfo);
506
	if (error)
507
		return (error);
508
	if (args->rusage != NULL) {
509
		error = copyout(&wru.wru_children, args->rusage,
510
		    sizeof(wru.wru_children));
511
		if (error)
512
			return (error);
513
	}
514
	if (args->info != NULL) {
515
		p = td->td_proc;
516
		if (td->td_retval[0] == 0)
517
			bzero(&lsi, sizeof(lsi));
518
		else {
519
			sig = bsd_to_linux_signal(siginfo.si_signo);
520
			siginfo_to_lsiginfo(&siginfo, &lsi, sig);
521
		}
522
		error = copyout(&lsi, args->info, sizeof(lsi));
523
	}
524
	td->td_retval[0] = 0;
525
526
	return (error);
527
}
(-)sys/amd64/linux/linux_proto.h (+1663 lines)
Line 0 Link Here
1
/*
2
 * System call prototypes.
3
 *
4
 * DO NOT EDIT-- this file is automatically generated.
5
 * $FreeBSD$
6
 * created from FreeBSD
7
 */
8
9
#ifndef _LINUX_SYSPROTO_H_
10
#define	_LINUX_SYSPROTO_H_
11
12
#include <sys/signal.h>
13
#include <sys/acl.h>
14
#include <sys/cpuset.h>
15
#include <sys/_ffcounter.h>
16
#include <sys/_semaphore.h>
17
#include <sys/ucontext.h>
18
#include <sys/wait.h>
19
20
#include <bsm/audit_kevents.h>
21
22
struct proc;
23
24
struct thread;
25
26
#define	PAD_(t)	(sizeof(register_t) <= sizeof(t) ? \
27
		0 : sizeof(register_t) - sizeof(t))
28
29
#if BYTE_ORDER == LITTLE_ENDIAN
30
#define	PADL_(t)	0
31
#define	PADR_(t)	PAD_(t)
32
#else
33
#define	PADL_(t)	PAD_(t)
34
#define	PADR_(t)	0
35
#endif
36
37
#define	nosys	linux_nosys
38
struct linux_open_args {
39
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
40
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
41
	char mode_l_[PADL_(l_int)]; l_int mode; char mode_r_[PADR_(l_int)];
42
};
43
struct linux_newstat_args {
44
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
45
	char buf_l_[PADL_(struct l_newstat *)]; struct l_newstat * buf; char buf_r_[PADR_(struct l_newstat *)];
46
};
47
struct linux_newfstat_args {
48
	char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)];
49
	char buf_l_[PADL_(struct l_newstat *)]; struct l_newstat * buf; char buf_r_[PADR_(struct l_newstat *)];
50
};
51
struct linux_newlstat_args {
52
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
53
	char buf_l_[PADL_(struct l_newstat *)]; struct l_newstat * buf; char buf_r_[PADR_(struct l_newstat *)];
54
};
55
struct linux_lseek_args {
56
	char fdes_l_[PADL_(l_uint)]; l_uint fdes; char fdes_r_[PADR_(l_uint)];
57
	char off_l_[PADL_(l_off_t)]; l_off_t off; char off_r_[PADR_(l_off_t)];
58
	char whence_l_[PADL_(l_int)]; l_int whence; char whence_r_[PADR_(l_int)];
59
};
60
struct linux_mmap2_args {
61
	char addr_l_[PADL_(l_ulong)]; l_ulong addr; char addr_r_[PADR_(l_ulong)];
62
	char len_l_[PADL_(l_ulong)]; l_ulong len; char len_r_[PADR_(l_ulong)];
63
	char prot_l_[PADL_(l_ulong)]; l_ulong prot; char prot_r_[PADR_(l_ulong)];
64
	char flags_l_[PADL_(l_ulong)]; l_ulong flags; char flags_r_[PADR_(l_ulong)];
65
	char fd_l_[PADL_(l_ulong)]; l_ulong fd; char fd_r_[PADR_(l_ulong)];
66
	char pgoff_l_[PADL_(l_ulong)]; l_ulong pgoff; char pgoff_r_[PADR_(l_ulong)];
67
};
68
struct linux_mprotect_args {
69
	char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)];
70
	char len_l_[PADL_(int)]; int len; char len_r_[PADR_(int)];
71
	char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];
72
};
73
struct linux_brk_args {
74
	char dsend_l_[PADL_(l_ulong)]; l_ulong dsend; char dsend_r_[PADR_(l_ulong)];
75
};
76
struct linux_rt_sigaction_args {
77
	char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)];
78
	char act_l_[PADL_(l_sigaction_t *)]; l_sigaction_t * act; char act_r_[PADR_(l_sigaction_t *)];
79
	char oact_l_[PADL_(l_sigaction_t *)]; l_sigaction_t * oact; char oact_r_[PADR_(l_sigaction_t *)];
80
	char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)];
81
};
82
struct linux_rt_sigprocmask_args {
83
	char how_l_[PADL_(l_int)]; l_int how; char how_r_[PADR_(l_int)];
84
	char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char mask_r_[PADR_(l_sigset_t *)];
85
	char omask_l_[PADL_(l_sigset_t *)]; l_sigset_t * omask; char omask_r_[PADR_(l_sigset_t *)];
86
	char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)];
87
};
88
struct linux_rt_sigreturn_args {
89
	char ucp_l_[PADL_(struct l_ucontext *)]; struct l_ucontext * ucp; char ucp_r_[PADR_(struct l_ucontext *)];
90
};
91
struct linux_ioctl_args {
92
	char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)];
93
	char cmd_l_[PADL_(l_uint)]; l_uint cmd; char cmd_r_[PADR_(l_uint)];
94
	char arg_l_[PADL_(uintptr_t)]; uintptr_t arg; char arg_r_[PADR_(uintptr_t)];
95
};
96
struct linux_pread_args {
97
	char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)];
98
	char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];
99
	char nbyte_l_[PADL_(l_size_t)]; l_size_t nbyte; char nbyte_r_[PADR_(l_size_t)];
100
	char offset_l_[PADL_(l_loff_t)]; l_loff_t offset; char offset_r_[PADR_(l_loff_t)];
101
};
102
struct linux_pwrite_args {
103
	char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)];
104
	char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];
105
	char nbyte_l_[PADL_(l_size_t)]; l_size_t nbyte; char nbyte_r_[PADR_(l_size_t)];
106
	char offset_l_[PADL_(l_loff_t)]; l_loff_t offset; char offset_r_[PADR_(l_loff_t)];
107
};
108
struct linux_access_args {
109
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
110
	char amode_l_[PADL_(l_int)]; l_int amode; char amode_r_[PADR_(l_int)];
111
};
112
struct linux_pipe_args {
113
	char pipefds_l_[PADL_(l_ulong *)]; l_ulong * pipefds; char pipefds_r_[PADR_(l_ulong *)];
114
};
115
struct linux_select_args {
116
	char nfds_l_[PADL_(l_int)]; l_int nfds; char nfds_r_[PADR_(l_int)];
117
	char readfds_l_[PADL_(l_fd_set *)]; l_fd_set * readfds; char readfds_r_[PADR_(l_fd_set *)];
118
	char writefds_l_[PADL_(l_fd_set *)]; l_fd_set * writefds; char writefds_r_[PADR_(l_fd_set *)];
119
	char exceptfds_l_[PADL_(l_fd_set *)]; l_fd_set * exceptfds; char exceptfds_r_[PADR_(l_fd_set *)];
120
	char timeout_l_[PADL_(struct l_timeval *)]; struct l_timeval * timeout; char timeout_r_[PADR_(struct l_timeval *)];
121
};
122
struct linux_mremap_args {
123
	char addr_l_[PADL_(l_ulong)]; l_ulong addr; char addr_r_[PADR_(l_ulong)];
124
	char old_len_l_[PADL_(l_ulong)]; l_ulong old_len; char old_len_r_[PADR_(l_ulong)];
125
	char new_len_l_[PADL_(l_ulong)]; l_ulong new_len; char new_len_r_[PADR_(l_ulong)];
126
	char flags_l_[PADL_(l_ulong)]; l_ulong flags; char flags_r_[PADR_(l_ulong)];
127
	char new_addr_l_[PADL_(l_ulong)]; l_ulong new_addr; char new_addr_r_[PADR_(l_ulong)];
128
};
129
struct linux_msync_args {
130
	char addr_l_[PADL_(l_ulong)]; l_ulong addr; char addr_r_[PADR_(l_ulong)];
131
	char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)];
132
	char fl_l_[PADL_(l_int)]; l_int fl; char fl_r_[PADR_(l_int)];
133
};
134
struct linux_mincore_args {
135
	char start_l_[PADL_(l_ulong)]; l_ulong start; char start_r_[PADR_(l_ulong)];
136
	char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)];
137
	char vec_l_[PADL_(u_char *)]; u_char * vec; char vec_r_[PADR_(u_char *)];
138
};
139
struct linux_shmget_args {
140
	char key_l_[PADL_(l_key_t)]; l_key_t key; char key_r_[PADR_(l_key_t)];
141
	char size_l_[PADL_(l_size_t)]; l_size_t size; char size_r_[PADR_(l_size_t)];
142
	char shmflg_l_[PADL_(l_int)]; l_int shmflg; char shmflg_r_[PADR_(l_int)];
143
};
144
struct linux_shmat_args {
145
	char shmid_l_[PADL_(l_int)]; l_int shmid; char shmid_r_[PADR_(l_int)];
146
	char shmaddr_l_[PADL_(char *)]; char * shmaddr; char shmaddr_r_[PADR_(char *)];
147
	char shmflg_l_[PADL_(l_int)]; l_int shmflg; char shmflg_r_[PADR_(l_int)];
148
};
149
struct linux_shmctl_args {
150
	char shmid_l_[PADL_(l_int)]; l_int shmid; char shmid_r_[PADR_(l_int)];
151
	char cmd_l_[PADL_(l_int)]; l_int cmd; char cmd_r_[PADR_(l_int)];
152
	char buf_l_[PADL_(struct l_shmid_ds *)]; struct l_shmid_ds * buf; char buf_r_[PADR_(struct l_shmid_ds *)];
153
};
154
struct linux_pause_args {
155
	register_t dummy;
156
};
157
struct linux_nanosleep_args {
158
	char rqtp_l_[PADL_(const struct l_timespec *)]; const struct l_timespec * rqtp; char rqtp_r_[PADR_(const struct l_timespec *)];
159
	char rmtp_l_[PADL_(struct l_timespec *)]; struct l_timespec * rmtp; char rmtp_r_[PADR_(struct l_timespec *)];
160
};
161
struct linux_getitimer_args {
162
	char which_l_[PADL_(l_int)]; l_int which; char which_r_[PADR_(l_int)];
163
	char itv_l_[PADL_(struct l_itimerval *)]; struct l_itimerval * itv; char itv_r_[PADR_(struct l_itimerval *)];
164
};
165
struct linux_alarm_args {
166
	char secs_l_[PADL_(l_uint)]; l_uint secs; char secs_r_[PADR_(l_uint)];
167
};
168
struct linux_setitimer_args {
169
	char which_l_[PADL_(l_int)]; l_int which; char which_r_[PADR_(l_int)];
170
	char itv_l_[PADL_(struct l_itimerval *)]; struct l_itimerval * itv; char itv_r_[PADR_(struct l_itimerval *)];
171
	char oitv_l_[PADL_(struct l_itimerval *)]; struct l_itimerval * oitv; char oitv_r_[PADR_(struct l_itimerval *)];
172
};
173
struct linux_getpid_args {
174
	register_t dummy;
175
};
176
struct linux_sendfile_args {
177
	char out_l_[PADL_(int)]; int out; char out_r_[PADR_(int)];
178
	char in_l_[PADL_(int)]; int in; char in_r_[PADR_(int)];
179
	char offset_l_[PADL_(l_long *)]; l_long * offset; char offset_r_[PADR_(l_long *)];
180
	char count_l_[PADL_(l_size_t)]; l_size_t count; char count_r_[PADR_(l_size_t)];
181
};
182
struct linux_socket_args {
183
	char domain_l_[PADL_(l_int)]; l_int domain; char domain_r_[PADR_(l_int)];
184
	char type_l_[PADL_(l_int)]; l_int type; char type_r_[PADR_(l_int)];
185
	char protocol_l_[PADL_(l_int)]; l_int protocol; char protocol_r_[PADR_(l_int)];
186
};
187
struct linux_connect_args {
188
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
189
	char name_l_[PADL_(l_uintptr_t)]; l_uintptr_t name; char name_r_[PADR_(l_uintptr_t)];
190
	char namelen_l_[PADL_(l_int)]; l_int namelen; char namelen_r_[PADR_(l_int)];
191
};
192
struct linux_accept_args {
193
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
194
	char addr_l_[PADL_(l_uintptr_t)]; l_uintptr_t addr; char addr_r_[PADR_(l_uintptr_t)];
195
	char namelen_l_[PADL_(l_uintptr_t)]; l_uintptr_t namelen; char namelen_r_[PADR_(l_uintptr_t)];
196
};
197
struct linux_sendto_args {
198
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
199
	char msg_l_[PADL_(l_uintptr_t)]; l_uintptr_t msg; char msg_r_[PADR_(l_uintptr_t)];
200
	char len_l_[PADL_(l_int)]; l_int len; char len_r_[PADR_(l_int)];
201
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
202
	char to_l_[PADL_(l_uintptr_t)]; l_uintptr_t to; char to_r_[PADR_(l_uintptr_t)];
203
	char tolen_l_[PADL_(l_int)]; l_int tolen; char tolen_r_[PADR_(l_int)];
204
};
205
struct linux_recvfrom_args {
206
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
207
	char buf_l_[PADL_(l_uintptr_t)]; l_uintptr_t buf; char buf_r_[PADR_(l_uintptr_t)];
208
	char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)];
209
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
210
	char from_l_[PADL_(l_uintptr_t)]; l_uintptr_t from; char from_r_[PADR_(l_uintptr_t)];
211
	char fromlen_l_[PADL_(l_uintptr_t)]; l_uintptr_t fromlen; char fromlen_r_[PADR_(l_uintptr_t)];
212
};
213
struct linux_sendmsg_args {
214
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
215
	char msg_l_[PADL_(l_uintptr_t)]; l_uintptr_t msg; char msg_r_[PADR_(l_uintptr_t)];
216
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
217
};
218
struct linux_recvmsg_args {
219
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
220
	char msg_l_[PADL_(l_uintptr_t)]; l_uintptr_t msg; char msg_r_[PADR_(l_uintptr_t)];
221
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
222
};
223
struct linux_shutdown_args {
224
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
225
	char how_l_[PADL_(l_int)]; l_int how; char how_r_[PADR_(l_int)];
226
};
227
struct linux_bind_args {
228
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
229
	char name_l_[PADL_(l_uintptr_t)]; l_uintptr_t name; char name_r_[PADR_(l_uintptr_t)];
230
	char namelen_l_[PADL_(l_int)]; l_int namelen; char namelen_r_[PADR_(l_int)];
231
};
232
struct linux_listen_args {
233
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
234
	char backlog_l_[PADL_(l_int)]; l_int backlog; char backlog_r_[PADR_(l_int)];
235
};
236
struct linux_getsockname_args {
237
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
238
	char addr_l_[PADL_(l_uintptr_t)]; l_uintptr_t addr; char addr_r_[PADR_(l_uintptr_t)];
239
	char namelen_l_[PADL_(l_uintptr_t)]; l_uintptr_t namelen; char namelen_r_[PADR_(l_uintptr_t)];
240
};
241
struct linux_getpeername_args {
242
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
243
	char addr_l_[PADL_(l_uintptr_t)]; l_uintptr_t addr; char addr_r_[PADR_(l_uintptr_t)];
244
	char namelen_l_[PADL_(l_uintptr_t)]; l_uintptr_t namelen; char namelen_r_[PADR_(l_uintptr_t)];
245
};
246
struct linux_socketpair_args {
247
	char domain_l_[PADL_(l_int)]; l_int domain; char domain_r_[PADR_(l_int)];
248
	char type_l_[PADL_(l_int)]; l_int type; char type_r_[PADR_(l_int)];
249
	char protocol_l_[PADL_(l_int)]; l_int protocol; char protocol_r_[PADR_(l_int)];
250
	char rsv_l_[PADL_(l_uintptr_t)]; l_uintptr_t rsv; char rsv_r_[PADR_(l_uintptr_t)];
251
};
252
struct linux_setsockopt_args {
253
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
254
	char level_l_[PADL_(l_int)]; l_int level; char level_r_[PADR_(l_int)];
255
	char optname_l_[PADL_(l_int)]; l_int optname; char optname_r_[PADR_(l_int)];
256
	char optval_l_[PADL_(l_uintptr_t)]; l_uintptr_t optval; char optval_r_[PADR_(l_uintptr_t)];
257
	char optlen_l_[PADL_(l_int)]; l_int optlen; char optlen_r_[PADR_(l_int)];
258
};
259
struct linux_getsockopt_args {
260
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
261
	char level_l_[PADL_(l_int)]; l_int level; char level_r_[PADR_(l_int)];
262
	char optname_l_[PADL_(l_int)]; l_int optname; char optname_r_[PADR_(l_int)];
263
	char optval_l_[PADL_(l_uintptr_t)]; l_uintptr_t optval; char optval_r_[PADR_(l_uintptr_t)];
264
	char optlen_l_[PADL_(l_uintptr_t)]; l_uintptr_t optlen; char optlen_r_[PADR_(l_uintptr_t)];
265
};
266
struct linux_clone_args {
267
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
268
	char stack_l_[PADL_(void *)]; void * stack; char stack_r_[PADR_(void *)];
269
	char parent_tidptr_l_[PADL_(void *)]; void * parent_tidptr; char parent_tidptr_r_[PADR_(void *)];
270
	char child_tidptr_l_[PADL_(void *)]; void * child_tidptr; char child_tidptr_r_[PADR_(void *)];
271
	char tls_l_[PADL_(void *)]; void * tls; char tls_r_[PADR_(void *)];
272
};
273
struct linux_fork_args {
274
	register_t dummy;
275
};
276
struct linux_vfork_args {
277
	register_t dummy;
278
};
279
struct linux_execve_args {
280
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
281
	char argp_l_[PADL_(char **)]; char ** argp; char argp_r_[PADR_(char **)];
282
	char envp_l_[PADL_(char **)]; char ** envp; char envp_r_[PADR_(char **)];
283
};
284
struct linux_exit_args {
285
	char rval_l_[PADL_(int)]; int rval; char rval_r_[PADR_(int)];
286
};
287
struct linux_wait4_args {
288
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
289
	char status_l_[PADL_(l_int *)]; l_int * status; char status_r_[PADR_(l_int *)];
290
	char options_l_[PADL_(l_int)]; l_int options; char options_r_[PADR_(l_int)];
291
	char rusage_l_[PADL_(struct l_rusage *)]; struct l_rusage * rusage; char rusage_r_[PADR_(struct l_rusage *)];
292
};
293
struct linux_kill_args {
294
	char pid_l_[PADL_(l_int)]; l_int pid; char pid_r_[PADR_(l_int)];
295
	char signum_l_[PADL_(l_int)]; l_int signum; char signum_r_[PADR_(l_int)];
296
};
297
struct linux_newuname_args {
298
	char buf_l_[PADL_(struct l_new_utsname *)]; struct l_new_utsname * buf; char buf_r_[PADR_(struct l_new_utsname *)];
299
};
300
struct linux_semget_args {
301
	char key_l_[PADL_(l_key_t)]; l_key_t key; char key_r_[PADR_(l_key_t)];
302
	char nsems_l_[PADL_(l_int)]; l_int nsems; char nsems_r_[PADR_(l_int)];
303
	char semflg_l_[PADL_(l_int)]; l_int semflg; char semflg_r_[PADR_(l_int)];
304
};
305
struct linux_semop_args {
306
	char semid_l_[PADL_(l_int)]; l_int semid; char semid_r_[PADR_(l_int)];
307
	char tsops_l_[PADL_(struct l_sembuf *)]; struct l_sembuf * tsops; char tsops_r_[PADR_(struct l_sembuf *)];
308
	char nsops_l_[PADL_(l_uint)]; l_uint nsops; char nsops_r_[PADR_(l_uint)];
309
};
310
struct linux_semctl_args {
311
	char semid_l_[PADL_(l_int)]; l_int semid; char semid_r_[PADR_(l_int)];
312
	char semnum_l_[PADL_(l_int)]; l_int semnum; char semnum_r_[PADR_(l_int)];
313
	char cmd_l_[PADL_(l_int)]; l_int cmd; char cmd_r_[PADR_(l_int)];
314
	char arg_l_[PADL_(union l_semun)]; union l_semun arg; char arg_r_[PADR_(union l_semun)];
315
};
316
struct linux_shmdt_args {
317
	char shmaddr_l_[PADL_(char *)]; char * shmaddr; char shmaddr_r_[PADR_(char *)];
318
};
319
struct linux_msgget_args {
320
	char key_l_[PADL_(l_key_t)]; l_key_t key; char key_r_[PADR_(l_key_t)];
321
	char msgflg_l_[PADL_(l_int)]; l_int msgflg; char msgflg_r_[PADR_(l_int)];
322
};
323
struct linux_msgsnd_args {
324
	char msqid_l_[PADL_(l_int)]; l_int msqid; char msqid_r_[PADR_(l_int)];
325
	char msgp_l_[PADL_(struct l_msgbuf *)]; struct l_msgbuf * msgp; char msgp_r_[PADR_(struct l_msgbuf *)];
326
	char msgsz_l_[PADL_(l_size_t)]; l_size_t msgsz; char msgsz_r_[PADR_(l_size_t)];
327
	char msgflg_l_[PADL_(l_int)]; l_int msgflg; char msgflg_r_[PADR_(l_int)];
328
};
329
struct linux_msgrcv_args {
330
	char msqid_l_[PADL_(l_int)]; l_int msqid; char msqid_r_[PADR_(l_int)];
331
	char msgp_l_[PADL_(struct l_msgbuf *)]; struct l_msgbuf * msgp; char msgp_r_[PADR_(struct l_msgbuf *)];
332
	char msgsz_l_[PADL_(l_size_t)]; l_size_t msgsz; char msgsz_r_[PADR_(l_size_t)];
333
	char msgtyp_l_[PADL_(l_long)]; l_long msgtyp; char msgtyp_r_[PADR_(l_long)];
334
	char msgflg_l_[PADL_(l_int)]; l_int msgflg; char msgflg_r_[PADR_(l_int)];
335
};
336
struct linux_msgctl_args {
337
	char msqid_l_[PADL_(l_int)]; l_int msqid; char msqid_r_[PADR_(l_int)];
338
	char cmd_l_[PADL_(l_int)]; l_int cmd; char cmd_r_[PADR_(l_int)];
339
	char buf_l_[PADL_(struct l_msqid_ds *)]; struct l_msqid_ds * buf; char buf_r_[PADR_(struct l_msqid_ds *)];
340
};
341
struct linux_fcntl_args {
342
	char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)];
343
	char cmd_l_[PADL_(l_uint)]; l_uint cmd; char cmd_r_[PADR_(l_uint)];
344
	char arg_l_[PADL_(l_ulong)]; l_ulong arg; char arg_r_[PADR_(l_ulong)];
345
};
346
struct linux_fdatasync_args {
347
	char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)];
348
};
349
struct linux_truncate_args {
350
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
351
	char length_l_[PADL_(l_ulong)]; l_ulong length; char length_r_[PADR_(l_ulong)];
352
};
353
struct linux_ftruncate_args {
354
	char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
355
	char length_l_[PADL_(l_long)]; l_long length; char length_r_[PADR_(l_long)];
356
};
357
struct linux_getdents_args {
358
	char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)];
359
	char dent_l_[PADL_(void *)]; void * dent; char dent_r_[PADR_(void *)];
360
	char count_l_[PADL_(l_uint)]; l_uint count; char count_r_[PADR_(l_uint)];
361
};
362
struct linux_getcwd_args {
363
	char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];
364
	char bufsize_l_[PADL_(l_ulong)]; l_ulong bufsize; char bufsize_r_[PADR_(l_ulong)];
365
};
366
struct linux_chdir_args {
367
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
368
};
369
struct linux_rename_args {
370
	char from_l_[PADL_(char *)]; char * from; char from_r_[PADR_(char *)];
371
	char to_l_[PADL_(char *)]; char * to; char to_r_[PADR_(char *)];
372
};
373
struct linux_mkdir_args {
374
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
375
	char mode_l_[PADL_(l_int)]; l_int mode; char mode_r_[PADR_(l_int)];
376
};
377
struct linux_rmdir_args {
378
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
379
};
380
struct linux_creat_args {
381
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
382
	char mode_l_[PADL_(l_int)]; l_int mode; char mode_r_[PADR_(l_int)];
383
};
384
struct linux_link_args {
385
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
386
	char to_l_[PADL_(char *)]; char * to; char to_r_[PADR_(char *)];
387
};
388
struct linux_unlink_args {
389
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
390
};
391
struct linux_symlink_args {
392
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
393
	char to_l_[PADL_(char *)]; char * to; char to_r_[PADR_(char *)];
394
};
395
struct linux_readlink_args {
396
	char name_l_[PADL_(char *)]; char * name; char name_r_[PADR_(char *)];
397
	char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];
398
	char count_l_[PADL_(l_int)]; l_int count; char count_r_[PADR_(l_int)];
399
};
400
struct linux_chmod_args {
401
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
402
	char mode_l_[PADL_(l_mode_t)]; l_mode_t mode; char mode_r_[PADR_(l_mode_t)];
403
};
404
struct linux_chown_args {
405
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
406
	char uid_l_[PADL_(l_uid_t)]; l_uid_t uid; char uid_r_[PADR_(l_uid_t)];
407
	char gid_l_[PADL_(l_gid_t)]; l_gid_t gid; char gid_r_[PADR_(l_gid_t)];
408
};
409
struct linux_lchown_args {
410
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
411
	char uid_l_[PADL_(l_uid_t)]; l_uid_t uid; char uid_r_[PADR_(l_uid_t)];
412
	char gid_l_[PADL_(l_gid_t)]; l_gid_t gid; char gid_r_[PADR_(l_gid_t)];
413
};
414
struct linux_getrlimit_args {
415
	char resource_l_[PADL_(l_uint)]; l_uint resource; char resource_r_[PADR_(l_uint)];
416
	char rlim_l_[PADL_(struct l_rlimit *)]; struct l_rlimit * rlim; char rlim_r_[PADR_(struct l_rlimit *)];
417
};
418
struct linux_sysinfo_args {
419
	char info_l_[PADL_(struct l_sysinfo *)]; struct l_sysinfo * info; char info_r_[PADR_(struct l_sysinfo *)];
420
};
421
struct linux_times_args {
422
	char buf_l_[PADL_(struct l_times_argv *)]; struct l_times_argv * buf; char buf_r_[PADR_(struct l_times_argv *)];
423
};
424
struct linux_ptrace_args {
425
	char req_l_[PADL_(l_long)]; l_long req; char req_r_[PADR_(l_long)];
426
	char pid_l_[PADL_(l_long)]; l_long pid; char pid_r_[PADR_(l_long)];
427
	char addr_l_[PADL_(l_long)]; l_long addr; char addr_r_[PADR_(l_long)];
428
	char data_l_[PADL_(l_long)]; l_long data; char data_r_[PADR_(l_long)];
429
};
430
struct linux_getuid_args {
431
	register_t dummy;
432
};
433
struct linux_syslog_args {
434
	char type_l_[PADL_(l_int)]; l_int type; char type_r_[PADR_(l_int)];
435
	char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];
436
	char len_l_[PADL_(l_int)]; l_int len; char len_r_[PADR_(l_int)];
437
};
438
struct linux_getgid_args {
439
	register_t dummy;
440
};
441
struct linux_getppid_args {
442
	register_t dummy;
443
};
444
struct linux_getgroups_args {
445
	char gidsetsize_l_[PADL_(l_int)]; l_int gidsetsize; char gidsetsize_r_[PADR_(l_int)];
446
	char grouplist_l_[PADL_(l_gid_t *)]; l_gid_t * grouplist; char grouplist_r_[PADR_(l_gid_t *)];
447
};
448
struct linux_setgroups_args {
449
	char gidsetsize_l_[PADL_(l_int)]; l_int gidsetsize; char gidsetsize_r_[PADR_(l_int)];
450
	char grouplist_l_[PADL_(l_gid_t *)]; l_gid_t * grouplist; char grouplist_r_[PADR_(l_gid_t *)];
451
};
452
struct linux_setfsuid_args {
453
	char uid_l_[PADL_(l_uid_t)]; l_uid_t uid; char uid_r_[PADR_(l_uid_t)];
454
};
455
struct linux_setfsgid_args {
456
	char gid_l_[PADL_(l_gid_t)]; l_gid_t gid; char gid_r_[PADR_(l_gid_t)];
457
};
458
struct linux_getsid_args {
459
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
460
};
461
struct linux_capget_args {
462
	char hdrp_l_[PADL_(struct l_user_cap_header *)]; struct l_user_cap_header * hdrp; char hdrp_r_[PADR_(struct l_user_cap_header *)];
463
	char datap_l_[PADL_(struct l_user_cap_data *)]; struct l_user_cap_data * datap; char datap_r_[PADR_(struct l_user_cap_data *)];
464
};
465
struct linux_capset_args {
466
	char hdrp_l_[PADL_(struct l_user_cap_header *)]; struct l_user_cap_header * hdrp; char hdrp_r_[PADR_(struct l_user_cap_header *)];
467
	char datap_l_[PADL_(struct l_user_cap_data *)]; struct l_user_cap_data * datap; char datap_r_[PADR_(struct l_user_cap_data *)];
468
};
469
struct linux_rt_sigpending_args {
470
	char set_l_[PADL_(l_sigset_t *)]; l_sigset_t * set; char set_r_[PADR_(l_sigset_t *)];
471
	char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)];
472
};
473
struct linux_rt_sigtimedwait_args {
474
	char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char mask_r_[PADR_(l_sigset_t *)];
475
	char ptr_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * ptr; char ptr_r_[PADR_(l_siginfo_t *)];
476
	char timeout_l_[PADL_(struct l_timeval *)]; struct l_timeval * timeout; char timeout_r_[PADR_(struct l_timeval *)];
477
	char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)];
478
};
479
struct linux_rt_sigqueueinfo_args {
480
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
481
	char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)];
482
	char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char info_r_[PADR_(l_siginfo_t *)];
483
};
484
struct linux_rt_sigsuspend_args {
485
	char newset_l_[PADL_(l_sigset_t *)]; l_sigset_t * newset; char newset_r_[PADR_(l_sigset_t *)];
486
	char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)];
487
};
488
struct linux_sigaltstack_args {
489
	char uss_l_[PADL_(l_stack_t *)]; l_stack_t * uss; char uss_r_[PADR_(l_stack_t *)];
490
	char uoss_l_[PADL_(l_stack_t *)]; l_stack_t * uoss; char uoss_r_[PADR_(l_stack_t *)];
491
};
492
struct linux_utime_args {
493
	char fname_l_[PADL_(char *)]; char * fname; char fname_r_[PADR_(char *)];
494
	char times_l_[PADL_(struct l_utimbuf *)]; struct l_utimbuf * times; char times_r_[PADR_(struct l_utimbuf *)];
495
};
496
struct linux_mknod_args {
497
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
498
	char mode_l_[PADL_(l_int)]; l_int mode; char mode_r_[PADR_(l_int)];
499
	char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)];
500
};
501
struct linux_personality_args {
502
	char per_l_[PADL_(l_ulong)]; l_ulong per; char per_r_[PADR_(l_ulong)];
503
};
504
struct linux_ustat_args {
505
	char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)];
506
	char ubuf_l_[PADL_(struct l_ustat *)]; struct l_ustat * ubuf; char ubuf_r_[PADR_(struct l_ustat *)];
507
};
508
struct linux_statfs_args {
509
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
510
	char buf_l_[PADL_(struct l_statfs_buf *)]; struct l_statfs_buf * buf; char buf_r_[PADR_(struct l_statfs_buf *)];
511
};
512
struct linux_fstatfs_args {
513
	char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)];
514
	char buf_l_[PADL_(struct l_statfs_buf *)]; struct l_statfs_buf * buf; char buf_r_[PADR_(struct l_statfs_buf *)];
515
};
516
struct linux_sysfs_args {
517
	char option_l_[PADL_(l_int)]; l_int option; char option_r_[PADR_(l_int)];
518
	char arg1_l_[PADL_(l_ulong)]; l_ulong arg1; char arg1_r_[PADR_(l_ulong)];
519
	char arg2_l_[PADL_(l_ulong)]; l_ulong arg2; char arg2_r_[PADR_(l_ulong)];
520
};
521
struct linux_getpriority_args {
522
	char which_l_[PADL_(int)]; int which; char which_r_[PADR_(int)];
523
	char who_l_[PADL_(int)]; int who; char who_r_[PADR_(int)];
524
};
525
struct linux_sched_setparam_args {
526
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
527
	char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
528
};
529
struct linux_sched_getparam_args {
530
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
531
	char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
532
};
533
struct linux_sched_setscheduler_args {
534
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
535
	char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)];
536
	char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
537
};
538
struct linux_sched_getscheduler_args {
539
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
540
};
541
struct linux_sched_get_priority_max_args {
542
	char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)];
543
};
544
struct linux_sched_get_priority_min_args {
545
	char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)];
546
};
547
struct linux_sched_rr_get_interval_args {
548
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
549
	char interval_l_[PADL_(struct l_timespec *)]; struct l_timespec * interval; char interval_r_[PADR_(struct l_timespec *)];
550
};
551
struct linux_vhangup_args {
552
	register_t dummy;
553
};
554
struct linux_pivot_root_args {
555
	register_t dummy;
556
};
557
struct linux_sysctl_args {
558
	char args_l_[PADL_(struct l___sysctl_args *)]; struct l___sysctl_args * args; char args_r_[PADR_(struct l___sysctl_args *)];
559
};
560
struct linux_prctl_args {
561
	char option_l_[PADL_(l_int)]; l_int option; char option_r_[PADR_(l_int)];
562
	char arg2_l_[PADL_(l_uintptr_t)]; l_uintptr_t arg2; char arg2_r_[PADR_(l_uintptr_t)];
563
	char arg3_l_[PADL_(l_uintptr_t)]; l_uintptr_t arg3; char arg3_r_[PADR_(l_uintptr_t)];
564
	char arg4_l_[PADL_(l_uintptr_t)]; l_uintptr_t arg4; char arg4_r_[PADR_(l_uintptr_t)];
565
	char arg5_l_[PADL_(l_uintptr_t)]; l_uintptr_t arg5; char arg5_r_[PADR_(l_uintptr_t)];
566
};
567
struct linux_arch_prctl_args {
568
	char code_l_[PADL_(l_int)]; l_int code; char code_r_[PADR_(l_int)];
569
	char addr_l_[PADL_(l_ulong)]; l_ulong addr; char addr_r_[PADR_(l_ulong)];
570
};
571
struct linux_adjtimex_args {
572
	register_t dummy;
573
};
574
struct linux_setrlimit_args {
575
	char resource_l_[PADL_(l_uint)]; l_uint resource; char resource_r_[PADR_(l_uint)];
576
	char rlim_l_[PADL_(struct l_rlimit *)]; struct l_rlimit * rlim; char rlim_r_[PADR_(struct l_rlimit *)];
577
};
578
struct linux_mount_args {
579
	char specialfile_l_[PADL_(char *)]; char * specialfile; char specialfile_r_[PADR_(char *)];
580
	char dir_l_[PADL_(char *)]; char * dir; char dir_r_[PADR_(char *)];
581
	char filesystemtype_l_[PADL_(char *)]; char * filesystemtype; char filesystemtype_r_[PADR_(char *)];
582
	char rwflag_l_[PADL_(l_ulong)]; l_ulong rwflag; char rwflag_r_[PADR_(l_ulong)];
583
	char data_l_[PADL_(void *)]; void * data; char data_r_[PADR_(void *)];
584
};
585
struct linux_umount_args {
586
	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
587
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
588
};
589
struct linux_swapoff_args {
590
	register_t dummy;
591
};
592
struct linux_reboot_args {
593
	char magic1_l_[PADL_(l_int)]; l_int magic1; char magic1_r_[PADR_(l_int)];
594
	char magic2_l_[PADL_(l_int)]; l_int magic2; char magic2_r_[PADR_(l_int)];
595
	char cmd_l_[PADL_(l_uint)]; l_uint cmd; char cmd_r_[PADR_(l_uint)];
596
	char arg_l_[PADL_(void *)]; void * arg; char arg_r_[PADR_(void *)];
597
};
598
struct linux_sethostname_args {
599
	char hostname_l_[PADL_(char *)]; char * hostname; char hostname_r_[PADR_(char *)];
600
	char len_l_[PADL_(l_uint)]; l_uint len; char len_r_[PADR_(l_uint)];
601
};
602
struct linux_setdomainname_args {
603
	char name_l_[PADL_(char *)]; char * name; char name_r_[PADR_(char *)];
604
	char len_l_[PADL_(l_int)]; l_int len; char len_r_[PADR_(l_int)];
605
};
606
struct linux_iopl_args {
607
	char level_l_[PADL_(l_uint)]; l_uint level; char level_r_[PADR_(l_uint)];
608
};
609
struct linux_create_module_args {
610
	register_t dummy;
611
};
612
struct linux_init_module_args {
613
	register_t dummy;
614
};
615
struct linux_delete_module_args {
616
	register_t dummy;
617
};
618
struct linux_get_kernel_syms_args {
619
	register_t dummy;
620
};
621
struct linux_query_module_args {
622
	register_t dummy;
623
};
624
struct linux_quotactl_args {
625
	register_t dummy;
626
};
627
struct linux_nfsservctl_args {
628
	register_t dummy;
629
};
630
struct linux_getpmsg_args {
631
	register_t dummy;
632
};
633
struct linux_putpmsg_args {
634
	register_t dummy;
635
};
636
struct linux_afs_syscall_args {
637
	register_t dummy;
638
};
639
struct linux_tuxcall_args {
640
	register_t dummy;
641
};
642
struct linux_security_args {
643
	register_t dummy;
644
};
645
struct linux_gettid_args {
646
	register_t dummy;
647
};
648
struct linux_setxattr_args {
649
	register_t dummy;
650
};
651
struct linux_lsetxattr_args {
652
	register_t dummy;
653
};
654
struct linux_fsetxattr_args {
655
	register_t dummy;
656
};
657
struct linux_getxattr_args {
658
	register_t dummy;
659
};
660
struct linux_lgetxattr_args {
661
	register_t dummy;
662
};
663
struct linux_fgetxattr_args {
664
	register_t dummy;
665
};
666
struct linux_listxattr_args {
667
	register_t dummy;
668
};
669
struct linux_llistxattr_args {
670
	register_t dummy;
671
};
672
struct linux_flistxattr_args {
673
	register_t dummy;
674
};
675
struct linux_removexattr_args {
676
	register_t dummy;
677
};
678
struct linux_lremovexattr_args {
679
	register_t dummy;
680
};
681
struct linux_fremovexattr_args {
682
	register_t dummy;
683
};
684
struct linux_tkill_args {
685
	char tid_l_[PADL_(int)]; int tid; char tid_r_[PADR_(int)];
686
	char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];
687
};
688
struct linux_time_args {
689
	char tm_l_[PADL_(l_time_t *)]; l_time_t * tm; char tm_r_[PADR_(l_time_t *)];
690
};
691
struct linux_sys_futex_args {
692
	char uaddr_l_[PADL_(void *)]; void * uaddr; char uaddr_r_[PADR_(void *)];
693
	char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)];
694
	char val_l_[PADL_(int)]; int val; char val_r_[PADR_(int)];
695
	char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)];
696
	char uaddr2_l_[PADL_(void *)]; void * uaddr2; char uaddr2_r_[PADR_(void *)];
697
	char val3_l_[PADL_(int)]; int val3; char val3_r_[PADR_(int)];
698
};
699
struct linux_sched_setaffinity_args {
700
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
701
	char len_l_[PADL_(l_uint)]; l_uint len; char len_r_[PADR_(l_uint)];
702
	char user_mask_ptr_l_[PADL_(l_ulong *)]; l_ulong * user_mask_ptr; char user_mask_ptr_r_[PADR_(l_ulong *)];
703
};
704
struct linux_sched_getaffinity_args {
705
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
706
	char len_l_[PADL_(l_uint)]; l_uint len; char len_r_[PADR_(l_uint)];
707
	char user_mask_ptr_l_[PADL_(l_ulong *)]; l_ulong * user_mask_ptr; char user_mask_ptr_r_[PADR_(l_ulong *)];
708
};
709
struct linux_set_thread_area_args {
710
	register_t dummy;
711
};
712
struct linux_lookup_dcookie_args {
713
	register_t dummy;
714
};
715
struct linux_epoll_create_args {
716
	char size_l_[PADL_(l_int)]; l_int size; char size_r_[PADR_(l_int)];
717
};
718
struct linux_epoll_ctl_old_args {
719
	register_t dummy;
720
};
721
struct linux_epoll_wait_old_args {
722
	register_t dummy;
723
};
724
struct linux_remap_file_pages_args {
725
	register_t dummy;
726
};
727
struct linux_getdents64_args {
728
	char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)];
729
	char dirent_l_[PADL_(void *)]; void * dirent; char dirent_r_[PADR_(void *)];
730
	char count_l_[PADL_(l_uint)]; l_uint count; char count_r_[PADR_(l_uint)];
731
};
732
struct linux_set_tid_address_args {
733
	char tidptr_l_[PADL_(int *)]; int * tidptr; char tidptr_r_[PADR_(int *)];
734
};
735
struct linux_semtimedop_args {
736
	register_t dummy;
737
};
738
struct linux_fadvise64_args {
739
	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
740
	char offset_l_[PADL_(l_loff_t)]; l_loff_t offset; char offset_r_[PADR_(l_loff_t)];
741
	char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)];
742
	char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)];
743
};
744
struct linux_timer_create_args {
745
	char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)];
746
	char evp_l_[PADL_(struct sigevent *)]; struct sigevent * evp; char evp_r_[PADR_(struct sigevent *)];
747
	char timerid_l_[PADL_(l_timer_t *)]; l_timer_t * timerid; char timerid_r_[PADR_(l_timer_t *)];
748
};
749
struct linux_timer_settime_args {
750
	char timerid_l_[PADL_(l_timer_t)]; l_timer_t timerid; char timerid_r_[PADR_(l_timer_t)];
751
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
752
	char new_l_[PADL_(const struct itimerspec *)]; const struct itimerspec * new; char new_r_[PADR_(const struct itimerspec *)];
753
	char old_l_[PADL_(struct itimerspec *)]; struct itimerspec * old; char old_r_[PADR_(struct itimerspec *)];
754
};
755
struct linux_timer_gettime_args {
756
	char timerid_l_[PADL_(l_timer_t)]; l_timer_t timerid; char timerid_r_[PADR_(l_timer_t)];
757
	char setting_l_[PADL_(struct itimerspec *)]; struct itimerspec * setting; char setting_r_[PADR_(struct itimerspec *)];
758
};
759
struct linux_timer_getoverrun_args {
760
	char timerid_l_[PADL_(l_timer_t)]; l_timer_t timerid; char timerid_r_[PADR_(l_timer_t)];
761
};
762
struct linux_timer_delete_args {
763
	char timerid_l_[PADL_(l_timer_t)]; l_timer_t timerid; char timerid_r_[PADR_(l_timer_t)];
764
};
765
struct linux_clock_settime_args {
766
	char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)];
767
	char tp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tp; char tp_r_[PADR_(struct l_timespec *)];
768
};
769
struct linux_clock_gettime_args {
770
	char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)];
771
	char tp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tp; char tp_r_[PADR_(struct l_timespec *)];
772
};
773
struct linux_clock_getres_args {
774
	char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)];
775
	char tp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tp; char tp_r_[PADR_(struct l_timespec *)];
776
};
777
struct linux_clock_nanosleep_args {
778
	char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)];
779
	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
780
	char rqtp_l_[PADL_(struct l_timespec *)]; struct l_timespec * rqtp; char rqtp_r_[PADR_(struct l_timespec *)];
781
	char rmtp_l_[PADL_(struct l_timespec *)]; struct l_timespec * rmtp; char rmtp_r_[PADR_(struct l_timespec *)];
782
};
783
struct linux_exit_group_args {
784
	char error_code_l_[PADL_(int)]; int error_code; char error_code_r_[PADR_(int)];
785
};
786
struct linux_epoll_wait_args {
787
	char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)];
788
	char events_l_[PADL_(struct epoll_event *)]; struct epoll_event * events; char events_r_[PADR_(struct epoll_event *)];
789
	char maxevents_l_[PADL_(l_int)]; l_int maxevents; char maxevents_r_[PADR_(l_int)];
790
	char timeout_l_[PADL_(l_int)]; l_int timeout; char timeout_r_[PADR_(l_int)];
791
};
792
struct linux_epoll_ctl_args {
793
	char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)];
794
	char op_l_[PADL_(l_int)]; l_int op; char op_r_[PADR_(l_int)];
795
	char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
796
	char event_l_[PADL_(struct epoll_event *)]; struct epoll_event * event; char event_r_[PADR_(struct epoll_event *)];
797
};
798
struct linux_tgkill_args {
799
	char tgid_l_[PADL_(int)]; int tgid; char tgid_r_[PADR_(int)];
800
	char pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)];
801
	char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];
802
};
803
struct linux_utimes_args {
804
	char fname_l_[PADL_(char *)]; char * fname; char fname_r_[PADR_(char *)];
805
	char tptr_l_[PADL_(struct l_timeval *)]; struct l_timeval * tptr; char tptr_r_[PADR_(struct l_timeval *)];
806
};
807
struct linux_mbind_args {
808
	register_t dummy;
809
};
810
struct linux_set_mempolicy_args {
811
	register_t dummy;
812
};
813
struct linux_get_mempolicy_args {
814
	register_t dummy;
815
};
816
struct linux_mq_open_args {
817
	register_t dummy;
818
};
819
struct linux_mq_unlink_args {
820
	register_t dummy;
821
};
822
struct linux_mq_timedsend_args {
823
	register_t dummy;
824
};
825
struct linux_mq_timedreceive_args {
826
	register_t dummy;
827
};
828
struct linux_mq_notify_args {
829
	register_t dummy;
830
};
831
struct linux_mq_getsetattr_args {
832
	register_t dummy;
833
};
834
struct linux_kexec_load_args {
835
	register_t dummy;
836
};
837
struct linux_waitid_args {
838
	char idtype_l_[PADL_(int)]; int idtype; char idtype_r_[PADR_(int)];
839
	char id_l_[PADL_(l_pid_t)]; l_pid_t id; char id_r_[PADR_(l_pid_t)];
840
	char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char info_r_[PADR_(l_siginfo_t *)];
841
	char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)];
842
	char rusage_l_[PADL_(struct l_rusage *)]; struct l_rusage * rusage; char rusage_r_[PADR_(struct l_rusage *)];
843
};
844
struct linux_add_key_args {
845
	register_t dummy;
846
};
847
struct linux_request_key_args {
848
	register_t dummy;
849
};
850
struct linux_keyctl_args {
851
	register_t dummy;
852
};
853
struct linux_ioprio_set_args {
854
	register_t dummy;
855
};
856
struct linux_ioprio_get_args {
857
	register_t dummy;
858
};
859
struct linux_inotify_init_args {
860
	register_t dummy;
861
};
862
struct linux_inotify_add_watch_args {
863
	register_t dummy;
864
};
865
struct linux_inotify_rm_watch_args {
866
	register_t dummy;
867
};
868
struct linux_migrate_pages_args {
869
	register_t dummy;
870
};
871
struct linux_openat_args {
872
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
873
	char filename_l_[PADL_(const char *)]; const char * filename; char filename_r_[PADR_(const char *)];
874
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
875
	char mode_l_[PADL_(l_int)]; l_int mode; char mode_r_[PADR_(l_int)];
876
};
877
struct linux_mkdirat_args {
878
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
879
	char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)];
880
	char mode_l_[PADL_(l_int)]; l_int mode; char mode_r_[PADR_(l_int)];
881
};
882
struct linux_mknodat_args {
883
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
884
	char filename_l_[PADL_(const char *)]; const char * filename; char filename_r_[PADR_(const char *)];
885
	char mode_l_[PADL_(l_int)]; l_int mode; char mode_r_[PADR_(l_int)];
886
	char dev_l_[PADL_(l_uint)]; l_uint dev; char dev_r_[PADR_(l_uint)];
887
};
888
struct linux_fchownat_args {
889
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
890
	char filename_l_[PADL_(const char *)]; const char * filename; char filename_r_[PADR_(const char *)];
891
	char uid_l_[PADL_(l_uid_t)]; l_uid_t uid; char uid_r_[PADR_(l_uid_t)];
892
	char gid_l_[PADL_(l_gid_t)]; l_gid_t gid; char gid_r_[PADR_(l_gid_t)];
893
	char flag_l_[PADL_(l_int)]; l_int flag; char flag_r_[PADR_(l_int)];
894
};
895
struct linux_futimesat_args {
896
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
897
	char filename_l_[PADL_(char *)]; char * filename; char filename_r_[PADR_(char *)];
898
	char utimes_l_[PADL_(struct l_timeval *)]; struct l_timeval * utimes; char utimes_r_[PADR_(struct l_timeval *)];
899
};
900
struct linux_newfstatat_args {
901
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
902
	char pathname_l_[PADL_(char *)]; char * pathname; char pathname_r_[PADR_(char *)];
903
	char statbuf_l_[PADL_(struct l_stat64 *)]; struct l_stat64 * statbuf; char statbuf_r_[PADR_(struct l_stat64 *)];
904
	char flag_l_[PADL_(l_int)]; l_int flag; char flag_r_[PADR_(l_int)];
905
};
906
struct linux_unlinkat_args {
907
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
908
	char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)];
909
	char flag_l_[PADL_(l_int)]; l_int flag; char flag_r_[PADR_(l_int)];
910
};
911
struct linux_renameat_args {
912
	char olddfd_l_[PADL_(l_int)]; l_int olddfd; char olddfd_r_[PADR_(l_int)];
913
	char oldname_l_[PADL_(const char *)]; const char * oldname; char oldname_r_[PADR_(const char *)];
914
	char newdfd_l_[PADL_(l_int)]; l_int newdfd; char newdfd_r_[PADR_(l_int)];
915
	char newname_l_[PADL_(const char *)]; const char * newname; char newname_r_[PADR_(const char *)];
916
};
917
struct linux_linkat_args {
918
	char olddfd_l_[PADL_(l_int)]; l_int olddfd; char olddfd_r_[PADR_(l_int)];
919
	char oldname_l_[PADL_(const char *)]; const char * oldname; char oldname_r_[PADR_(const char *)];
920
	char newdfd_l_[PADL_(l_int)]; l_int newdfd; char newdfd_r_[PADR_(l_int)];
921
	char newname_l_[PADL_(const char *)]; const char * newname; char newname_r_[PADR_(const char *)];
922
	char flag_l_[PADL_(l_int)]; l_int flag; char flag_r_[PADR_(l_int)];
923
};
924
struct linux_symlinkat_args {
925
	char oldname_l_[PADL_(const char *)]; const char * oldname; char oldname_r_[PADR_(const char *)];
926
	char newdfd_l_[PADL_(l_int)]; l_int newdfd; char newdfd_r_[PADR_(l_int)];
927
	char newname_l_[PADL_(const char *)]; const char * newname; char newname_r_[PADR_(const char *)];
928
};
929
struct linux_readlinkat_args {
930
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
931
	char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];
932
	char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];
933
	char bufsiz_l_[PADL_(l_int)]; l_int bufsiz; char bufsiz_r_[PADR_(l_int)];
934
};
935
struct linux_fchmodat_args {
936
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
937
	char filename_l_[PADL_(const char *)]; const char * filename; char filename_r_[PADR_(const char *)];
938
	char mode_l_[PADL_(l_mode_t)]; l_mode_t mode; char mode_r_[PADR_(l_mode_t)];
939
};
940
struct linux_faccessat_args {
941
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
942
	char filename_l_[PADL_(const char *)]; const char * filename; char filename_r_[PADR_(const char *)];
943
	char amode_l_[PADL_(l_int)]; l_int amode; char amode_r_[PADR_(l_int)];
944
};
945
struct linux_pselect6_args {
946
	char nfds_l_[PADL_(l_int)]; l_int nfds; char nfds_r_[PADR_(l_int)];
947
	char readfds_l_[PADL_(l_fd_set *)]; l_fd_set * readfds; char readfds_r_[PADR_(l_fd_set *)];
948
	char writefds_l_[PADL_(l_fd_set *)]; l_fd_set * writefds; char writefds_r_[PADR_(l_fd_set *)];
949
	char exceptfds_l_[PADL_(l_fd_set *)]; l_fd_set * exceptfds; char exceptfds_r_[PADR_(l_fd_set *)];
950
	char tsp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tsp; char tsp_r_[PADR_(struct l_timespec *)];
951
	char sig_l_[PADL_(l_uintptr_t *)]; l_uintptr_t * sig; char sig_r_[PADR_(l_uintptr_t *)];
952
};
953
struct linux_ppoll_args {
954
	char fds_l_[PADL_(struct pollfd *)]; struct pollfd * fds; char fds_r_[PADR_(struct pollfd *)];
955
	char nfds_l_[PADL_(uint32_t)]; uint32_t nfds; char nfds_r_[PADR_(uint32_t)];
956
	char tsp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tsp; char tsp_r_[PADR_(struct l_timespec *)];
957
	char sset_l_[PADL_(l_sigset_t *)]; l_sigset_t * sset; char sset_r_[PADR_(l_sigset_t *)];
958
	char ssize_l_[PADL_(l_size_t)]; l_size_t ssize; char ssize_r_[PADR_(l_size_t)];
959
};
960
struct linux_unshare_args {
961
	register_t dummy;
962
};
963
struct linux_set_robust_list_args {
964
	char head_l_[PADL_(struct linux_robust_list_head *)]; struct linux_robust_list_head * head; char head_r_[PADR_(struct linux_robust_list_head *)];
965
	char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)];
966
};
967
struct linux_get_robust_list_args {
968
	char pid_l_[PADL_(l_int)]; l_int pid; char pid_r_[PADR_(l_int)];
969
	char head_l_[PADL_(struct linux_robust_list_head *)]; struct linux_robust_list_head * head; char head_r_[PADR_(struct linux_robust_list_head *)];
970
	char len_l_[PADL_(l_size_t *)]; l_size_t * len; char len_r_[PADR_(l_size_t *)];
971
};
972
struct linux_splice_args {
973
	register_t dummy;
974
};
975
struct linux_tee_args {
976
	register_t dummy;
977
};
978
struct linux_sync_file_range_args {
979
	register_t dummy;
980
};
981
struct linux_vmsplice_args {
982
	register_t dummy;
983
};
984
struct linux_move_pages_args {
985
	register_t dummy;
986
};
987
struct linux_utimensat_args {
988
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
989
	char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)];
990
	char times_l_[PADL_(const struct l_timespec *)]; const struct l_timespec * times; char times_r_[PADR_(const struct l_timespec *)];
991
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
992
};
993
struct linux_epoll_pwait_args {
994
	char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)];
995
	char events_l_[PADL_(struct epoll_event *)]; struct epoll_event * events; char events_r_[PADR_(struct epoll_event *)];
996
	char maxevents_l_[PADL_(l_int)]; l_int maxevents; char maxevents_r_[PADR_(l_int)];
997
	char timeout_l_[PADL_(l_int)]; l_int timeout; char timeout_r_[PADR_(l_int)];
998
	char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char mask_r_[PADR_(l_sigset_t *)];
999
};
1000
struct linux_signalfd_args {
1001
	register_t dummy;
1002
};
1003
struct linux_timerfd_args {
1004
	register_t dummy;
1005
};
1006
struct linux_eventfd_args {
1007
	char initval_l_[PADL_(l_uint)]; l_uint initval; char initval_r_[PADR_(l_uint)];
1008
};
1009
struct linux_fallocate_args {
1010
	char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
1011
	char mode_l_[PADL_(l_int)]; l_int mode; char mode_r_[PADR_(l_int)];
1012
	char offset_l_[PADL_(l_loff_t)]; l_loff_t offset; char offset_r_[PADR_(l_loff_t)];
1013
	char len_l_[PADL_(l_loff_t)]; l_loff_t len; char len_r_[PADR_(l_loff_t)];
1014
};
1015
struct linux_timerfd_settime_args {
1016
	register_t dummy;
1017
};
1018
struct linux_timerfd_gettime_args {
1019
	register_t dummy;
1020
};
1021
struct linux_accept4_args {
1022
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
1023
	char addr_l_[PADL_(l_uintptr_t)]; l_uintptr_t addr; char addr_r_[PADR_(l_uintptr_t)];
1024
	char namelen_l_[PADL_(l_uintptr_t)]; l_uintptr_t namelen; char namelen_r_[PADR_(l_uintptr_t)];
1025
	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
1026
};
1027
struct linux_signalfd4_args {
1028
	register_t dummy;
1029
};
1030
struct linux_eventfd2_args {
1031
	char initval_l_[PADL_(l_uint)]; l_uint initval; char initval_r_[PADR_(l_uint)];
1032
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
1033
};
1034
struct linux_epoll_create1_args {
1035
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
1036
};
1037
struct linux_dup3_args {
1038
	char oldfd_l_[PADL_(l_int)]; l_int oldfd; char oldfd_r_[PADR_(l_int)];
1039
	char newfd_l_[PADL_(l_int)]; l_int newfd; char newfd_r_[PADR_(l_int)];
1040
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
1041
};
1042
struct linux_pipe2_args {
1043
	char pipefds_l_[PADL_(l_int *)]; l_int * pipefds; char pipefds_r_[PADR_(l_int *)];
1044
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
1045
};
1046
struct linux_inotify_init1_args {
1047
	register_t dummy;
1048
};
1049
struct linux_preadv_args {
1050
	register_t dummy;
1051
};
1052
struct linux_pwritev_args {
1053
	register_t dummy;
1054
};
1055
struct linux_rt_tsigqueueinfo_args {
1056
	register_t dummy;
1057
};
1058
struct linux_perf_event_open_args {
1059
	register_t dummy;
1060
};
1061
struct linux_recvmmsg_args {
1062
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
1063
	char msg_l_[PADL_(struct l_mmsghdr *)]; struct l_mmsghdr * msg; char msg_r_[PADR_(struct l_mmsghdr *)];
1064
	char vlen_l_[PADL_(l_uint)]; l_uint vlen; char vlen_r_[PADR_(l_uint)];
1065
	char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)];
1066
	char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)];
1067
};
1068
struct linux_fanotify_init_args {
1069
	register_t dummy;
1070
};
1071
struct linux_fanotify_mark_args {
1072
	register_t dummy;
1073
};
1074
struct linux_prlimit64_args {
1075
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
1076
	char resource_l_[PADL_(l_uint)]; l_uint resource; char resource_r_[PADR_(l_uint)];
1077
	char new_l_[PADL_(struct rlimit *)]; struct rlimit * new; char new_r_[PADR_(struct rlimit *)];
1078
	char old_l_[PADL_(struct rlimit *)]; struct rlimit * old; char old_r_[PADR_(struct rlimit *)];
1079
};
1080
struct linux_name_to_handle_at_args {
1081
	register_t dummy;
1082
};
1083
struct linux_open_by_handle_at_args {
1084
	register_t dummy;
1085
};
1086
struct linux_clock_adjtime_args {
1087
	register_t dummy;
1088
};
1089
struct linux_syncfs_args {
1090
	char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
1091
};
1092
struct linux_sendmmsg_args {
1093
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
1094
	char msg_l_[PADL_(struct l_mmsghdr *)]; struct l_mmsghdr * msg; char msg_r_[PADR_(struct l_mmsghdr *)];
1095
	char vlen_l_[PADL_(l_uint)]; l_uint vlen; char vlen_r_[PADR_(l_uint)];
1096
	char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)];
1097
};
1098
struct linux_setns_args {
1099
	register_t dummy;
1100
};
1101
struct linux_process_vm_readv_args {
1102
	register_t dummy;
1103
};
1104
struct linux_process_vm_writev_args {
1105
	register_t dummy;
1106
};
1107
struct linux_kcmp_args {
1108
	register_t dummy;
1109
};
1110
struct linux_finit_module_args {
1111
	register_t dummy;
1112
};
1113
#define	nosys	linux_nosys
1114
int	linux_open(struct thread *, struct linux_open_args *);
1115
int	linux_newstat(struct thread *, struct linux_newstat_args *);
1116
int	linux_newfstat(struct thread *, struct linux_newfstat_args *);
1117
int	linux_newlstat(struct thread *, struct linux_newlstat_args *);
1118
int	linux_lseek(struct thread *, struct linux_lseek_args *);
1119
int	linux_mmap2(struct thread *, struct linux_mmap2_args *);
1120
int	linux_mprotect(struct thread *, struct linux_mprotect_args *);
1121
int	linux_brk(struct thread *, struct linux_brk_args *);
1122
int	linux_rt_sigaction(struct thread *, struct linux_rt_sigaction_args *);
1123
int	linux_rt_sigprocmask(struct thread *, struct linux_rt_sigprocmask_args *);
1124
int	linux_rt_sigreturn(struct thread *, struct linux_rt_sigreturn_args *);
1125
int	linux_ioctl(struct thread *, struct linux_ioctl_args *);
1126
int	linux_pread(struct thread *, struct linux_pread_args *);
1127
int	linux_pwrite(struct thread *, struct linux_pwrite_args *);
1128
int	linux_access(struct thread *, struct linux_access_args *);
1129
int	linux_pipe(struct thread *, struct linux_pipe_args *);
1130
int	linux_select(struct thread *, struct linux_select_args *);
1131
int	linux_mremap(struct thread *, struct linux_mremap_args *);
1132
int	linux_msync(struct thread *, struct linux_msync_args *);
1133
int	linux_mincore(struct thread *, struct linux_mincore_args *);
1134
int	linux_shmget(struct thread *, struct linux_shmget_args *);
1135
int	linux_shmat(struct thread *, struct linux_shmat_args *);
1136
int	linux_shmctl(struct thread *, struct linux_shmctl_args *);
1137
int	linux_pause(struct thread *, struct linux_pause_args *);
1138
int	linux_nanosleep(struct thread *, struct linux_nanosleep_args *);
1139
int	linux_getitimer(struct thread *, struct linux_getitimer_args *);
1140
int	linux_alarm(struct thread *, struct linux_alarm_args *);
1141
int	linux_setitimer(struct thread *, struct linux_setitimer_args *);
1142
int	linux_getpid(struct thread *, struct linux_getpid_args *);
1143
int	linux_sendfile(struct thread *, struct linux_sendfile_args *);
1144
int	linux_socket(struct thread *, struct linux_socket_args *);
1145
int	linux_connect(struct thread *, struct linux_connect_args *);
1146
int	linux_accept(struct thread *, struct linux_accept_args *);
1147
int	linux_sendto(struct thread *, struct linux_sendto_args *);
1148
int	linux_recvfrom(struct thread *, struct linux_recvfrom_args *);
1149
int	linux_sendmsg(struct thread *, struct linux_sendmsg_args *);
1150
int	linux_recvmsg(struct thread *, struct linux_recvmsg_args *);
1151
int	linux_shutdown(struct thread *, struct linux_shutdown_args *);
1152
int	linux_bind(struct thread *, struct linux_bind_args *);
1153
int	linux_listen(struct thread *, struct linux_listen_args *);
1154
int	linux_getsockname(struct thread *, struct linux_getsockname_args *);
1155
int	linux_getpeername(struct thread *, struct linux_getpeername_args *);
1156
int	linux_socketpair(struct thread *, struct linux_socketpair_args *);
1157
int	linux_setsockopt(struct thread *, struct linux_setsockopt_args *);
1158
int	linux_getsockopt(struct thread *, struct linux_getsockopt_args *);
1159
int	linux_clone(struct thread *, struct linux_clone_args *);
1160
int	linux_fork(struct thread *, struct linux_fork_args *);
1161
int	linux_vfork(struct thread *, struct linux_vfork_args *);
1162
int	linux_execve(struct thread *, struct linux_execve_args *);
1163
int	linux_exit(struct thread *, struct linux_exit_args *);
1164
int	linux_wait4(struct thread *, struct linux_wait4_args *);
1165
int	linux_kill(struct thread *, struct linux_kill_args *);
1166
int	linux_newuname(struct thread *, struct linux_newuname_args *);
1167
int	linux_semget(struct thread *, struct linux_semget_args *);
1168
int	linux_semop(struct thread *, struct linux_semop_args *);
1169
int	linux_semctl(struct thread *, struct linux_semctl_args *);
1170
int	linux_shmdt(struct thread *, struct linux_shmdt_args *);
1171
int	linux_msgget(struct thread *, struct linux_msgget_args *);
1172
int	linux_msgsnd(struct thread *, struct linux_msgsnd_args *);
1173
int	linux_msgrcv(struct thread *, struct linux_msgrcv_args *);
1174
int	linux_msgctl(struct thread *, struct linux_msgctl_args *);
1175
int	linux_fcntl(struct thread *, struct linux_fcntl_args *);
1176
int	linux_fdatasync(struct thread *, struct linux_fdatasync_args *);
1177
int	linux_truncate(struct thread *, struct linux_truncate_args *);
1178
int	linux_ftruncate(struct thread *, struct linux_ftruncate_args *);
1179
int	linux_getdents(struct thread *, struct linux_getdents_args *);
1180
int	linux_getcwd(struct thread *, struct linux_getcwd_args *);
1181
int	linux_chdir(struct thread *, struct linux_chdir_args *);
1182
int	linux_rename(struct thread *, struct linux_rename_args *);
1183
int	linux_mkdir(struct thread *, struct linux_mkdir_args *);
1184
int	linux_rmdir(struct thread *, struct linux_rmdir_args *);
1185
int	linux_creat(struct thread *, struct linux_creat_args *);
1186
int	linux_link(struct thread *, struct linux_link_args *);
1187
int	linux_unlink(struct thread *, struct linux_unlink_args *);
1188
int	linux_symlink(struct thread *, struct linux_symlink_args *);
1189
int	linux_readlink(struct thread *, struct linux_readlink_args *);
1190
int	linux_chmod(struct thread *, struct linux_chmod_args *);
1191
int	linux_chown(struct thread *, struct linux_chown_args *);
1192
int	linux_lchown(struct thread *, struct linux_lchown_args *);
1193
int	linux_getrlimit(struct thread *, struct linux_getrlimit_args *);
1194
int	linux_sysinfo(struct thread *, struct linux_sysinfo_args *);
1195
int	linux_times(struct thread *, struct linux_times_args *);
1196
int	linux_ptrace(struct thread *, struct linux_ptrace_args *);
1197
int	linux_getuid(struct thread *, struct linux_getuid_args *);
1198
int	linux_syslog(struct thread *, struct linux_syslog_args *);
1199
int	linux_getgid(struct thread *, struct linux_getgid_args *);
1200
int	linux_getppid(struct thread *, struct linux_getppid_args *);
1201
int	linux_getgroups(struct thread *, struct linux_getgroups_args *);
1202
int	linux_setgroups(struct thread *, struct linux_setgroups_args *);
1203
int	linux_setfsuid(struct thread *, struct linux_setfsuid_args *);
1204
int	linux_setfsgid(struct thread *, struct linux_setfsgid_args *);
1205
int	linux_getsid(struct thread *, struct linux_getsid_args *);
1206
int	linux_capget(struct thread *, struct linux_capget_args *);
1207
int	linux_capset(struct thread *, struct linux_capset_args *);
1208
int	linux_rt_sigpending(struct thread *, struct linux_rt_sigpending_args *);
1209
int	linux_rt_sigtimedwait(struct thread *, struct linux_rt_sigtimedwait_args *);
1210
int	linux_rt_sigqueueinfo(struct thread *, struct linux_rt_sigqueueinfo_args *);
1211
int	linux_rt_sigsuspend(struct thread *, struct linux_rt_sigsuspend_args *);
1212
int	linux_sigaltstack(struct thread *, struct linux_sigaltstack_args *);
1213
int	linux_utime(struct thread *, struct linux_utime_args *);
1214
int	linux_mknod(struct thread *, struct linux_mknod_args *);
1215
int	linux_personality(struct thread *, struct linux_personality_args *);
1216
int	linux_ustat(struct thread *, struct linux_ustat_args *);
1217
int	linux_statfs(struct thread *, struct linux_statfs_args *);
1218
int	linux_fstatfs(struct thread *, struct linux_fstatfs_args *);
1219
int	linux_sysfs(struct thread *, struct linux_sysfs_args *);
1220
int	linux_getpriority(struct thread *, struct linux_getpriority_args *);
1221
int	linux_sched_setparam(struct thread *, struct linux_sched_setparam_args *);
1222
int	linux_sched_getparam(struct thread *, struct linux_sched_getparam_args *);
1223
int	linux_sched_setscheduler(struct thread *, struct linux_sched_setscheduler_args *);
1224
int	linux_sched_getscheduler(struct thread *, struct linux_sched_getscheduler_args *);
1225
int	linux_sched_get_priority_max(struct thread *, struct linux_sched_get_priority_max_args *);
1226
int	linux_sched_get_priority_min(struct thread *, struct linux_sched_get_priority_min_args *);
1227
int	linux_sched_rr_get_interval(struct thread *, struct linux_sched_rr_get_interval_args *);
1228
int	linux_vhangup(struct thread *, struct linux_vhangup_args *);
1229
int	linux_pivot_root(struct thread *, struct linux_pivot_root_args *);
1230
int	linux_sysctl(struct thread *, struct linux_sysctl_args *);
1231
int	linux_prctl(struct thread *, struct linux_prctl_args *);
1232
int	linux_arch_prctl(struct thread *, struct linux_arch_prctl_args *);
1233
int	linux_adjtimex(struct thread *, struct linux_adjtimex_args *);
1234
int	linux_setrlimit(struct thread *, struct linux_setrlimit_args *);
1235
int	linux_mount(struct thread *, struct linux_mount_args *);
1236
int	linux_umount(struct thread *, struct linux_umount_args *);
1237
int	linux_swapoff(struct thread *, struct linux_swapoff_args *);
1238
int	linux_reboot(struct thread *, struct linux_reboot_args *);
1239
int	linux_sethostname(struct thread *, struct linux_sethostname_args *);
1240
int	linux_setdomainname(struct thread *, struct linux_setdomainname_args *);
1241
int	linux_iopl(struct thread *, struct linux_iopl_args *);
1242
int	linux_create_module(struct thread *, struct linux_create_module_args *);
1243
int	linux_init_module(struct thread *, struct linux_init_module_args *);
1244
int	linux_delete_module(struct thread *, struct linux_delete_module_args *);
1245
int	linux_get_kernel_syms(struct thread *, struct linux_get_kernel_syms_args *);
1246
int	linux_query_module(struct thread *, struct linux_query_module_args *);
1247
int	linux_quotactl(struct thread *, struct linux_quotactl_args *);
1248
int	linux_nfsservctl(struct thread *, struct linux_nfsservctl_args *);
1249
int	linux_getpmsg(struct thread *, struct linux_getpmsg_args *);
1250
int	linux_putpmsg(struct thread *, struct linux_putpmsg_args *);
1251
int	linux_afs_syscall(struct thread *, struct linux_afs_syscall_args *);
1252
int	linux_tuxcall(struct thread *, struct linux_tuxcall_args *);
1253
int	linux_security(struct thread *, struct linux_security_args *);
1254
int	linux_gettid(struct thread *, struct linux_gettid_args *);
1255
int	linux_setxattr(struct thread *, struct linux_setxattr_args *);
1256
int	linux_lsetxattr(struct thread *, struct linux_lsetxattr_args *);
1257
int	linux_fsetxattr(struct thread *, struct linux_fsetxattr_args *);
1258
int	linux_getxattr(struct thread *, struct linux_getxattr_args *);
1259
int	linux_lgetxattr(struct thread *, struct linux_lgetxattr_args *);
1260
int	linux_fgetxattr(struct thread *, struct linux_fgetxattr_args *);
1261
int	linux_listxattr(struct thread *, struct linux_listxattr_args *);
1262
int	linux_llistxattr(struct thread *, struct linux_llistxattr_args *);
1263
int	linux_flistxattr(struct thread *, struct linux_flistxattr_args *);
1264
int	linux_removexattr(struct thread *, struct linux_removexattr_args *);
1265
int	linux_lremovexattr(struct thread *, struct linux_lremovexattr_args *);
1266
int	linux_fremovexattr(struct thread *, struct linux_fremovexattr_args *);
1267
int	linux_tkill(struct thread *, struct linux_tkill_args *);
1268
int	linux_time(struct thread *, struct linux_time_args *);
1269
int	linux_sys_futex(struct thread *, struct linux_sys_futex_args *);
1270
int	linux_sched_setaffinity(struct thread *, struct linux_sched_setaffinity_args *);
1271
int	linux_sched_getaffinity(struct thread *, struct linux_sched_getaffinity_args *);
1272
int	linux_set_thread_area(struct thread *, struct linux_set_thread_area_args *);
1273
int	linux_lookup_dcookie(struct thread *, struct linux_lookup_dcookie_args *);
1274
int	linux_epoll_create(struct thread *, struct linux_epoll_create_args *);
1275
int	linux_epoll_ctl_old(struct thread *, struct linux_epoll_ctl_old_args *);
1276
int	linux_epoll_wait_old(struct thread *, struct linux_epoll_wait_old_args *);
1277
int	linux_remap_file_pages(struct thread *, struct linux_remap_file_pages_args *);
1278
int	linux_getdents64(struct thread *, struct linux_getdents64_args *);
1279
int	linux_set_tid_address(struct thread *, struct linux_set_tid_address_args *);
1280
int	linux_semtimedop(struct thread *, struct linux_semtimedop_args *);
1281
int	linux_fadvise64(struct thread *, struct linux_fadvise64_args *);
1282
int	linux_timer_create(struct thread *, struct linux_timer_create_args *);
1283
int	linux_timer_settime(struct thread *, struct linux_timer_settime_args *);
1284
int	linux_timer_gettime(struct thread *, struct linux_timer_gettime_args *);
1285
int	linux_timer_getoverrun(struct thread *, struct linux_timer_getoverrun_args *);
1286
int	linux_timer_delete(struct thread *, struct linux_timer_delete_args *);
1287
int	linux_clock_settime(struct thread *, struct linux_clock_settime_args *);
1288
int	linux_clock_gettime(struct thread *, struct linux_clock_gettime_args *);
1289
int	linux_clock_getres(struct thread *, struct linux_clock_getres_args *);
1290
int	linux_clock_nanosleep(struct thread *, struct linux_clock_nanosleep_args *);
1291
int	linux_exit_group(struct thread *, struct linux_exit_group_args *);
1292
int	linux_epoll_wait(struct thread *, struct linux_epoll_wait_args *);
1293
int	linux_epoll_ctl(struct thread *, struct linux_epoll_ctl_args *);
1294
int	linux_tgkill(struct thread *, struct linux_tgkill_args *);
1295
int	linux_utimes(struct thread *, struct linux_utimes_args *);
1296
int	linux_mbind(struct thread *, struct linux_mbind_args *);
1297
int	linux_set_mempolicy(struct thread *, struct linux_set_mempolicy_args *);
1298
int	linux_get_mempolicy(struct thread *, struct linux_get_mempolicy_args *);
1299
int	linux_mq_open(struct thread *, struct linux_mq_open_args *);
1300
int	linux_mq_unlink(struct thread *, struct linux_mq_unlink_args *);
1301
int	linux_mq_timedsend(struct thread *, struct linux_mq_timedsend_args *);
1302
int	linux_mq_timedreceive(struct thread *, struct linux_mq_timedreceive_args *);
1303
int	linux_mq_notify(struct thread *, struct linux_mq_notify_args *);
1304
int	linux_mq_getsetattr(struct thread *, struct linux_mq_getsetattr_args *);
1305
int	linux_kexec_load(struct thread *, struct linux_kexec_load_args *);
1306
int	linux_waitid(struct thread *, struct linux_waitid_args *);
1307
int	linux_add_key(struct thread *, struct linux_add_key_args *);
1308
int	linux_request_key(struct thread *, struct linux_request_key_args *);
1309
int	linux_keyctl(struct thread *, struct linux_keyctl_args *);
1310
int	linux_ioprio_set(struct thread *, struct linux_ioprio_set_args *);
1311
int	linux_ioprio_get(struct thread *, struct linux_ioprio_get_args *);
1312
int	linux_inotify_init(struct thread *, struct linux_inotify_init_args *);
1313
int	linux_inotify_add_watch(struct thread *, struct linux_inotify_add_watch_args *);
1314
int	linux_inotify_rm_watch(struct thread *, struct linux_inotify_rm_watch_args *);
1315
int	linux_migrate_pages(struct thread *, struct linux_migrate_pages_args *);
1316
int	linux_openat(struct thread *, struct linux_openat_args *);
1317
int	linux_mkdirat(struct thread *, struct linux_mkdirat_args *);
1318
int	linux_mknodat(struct thread *, struct linux_mknodat_args *);
1319
int	linux_fchownat(struct thread *, struct linux_fchownat_args *);
1320
int	linux_futimesat(struct thread *, struct linux_futimesat_args *);
1321
int	linux_newfstatat(struct thread *, struct linux_newfstatat_args *);
1322
int	linux_unlinkat(struct thread *, struct linux_unlinkat_args *);
1323
int	linux_renameat(struct thread *, struct linux_renameat_args *);
1324
int	linux_linkat(struct thread *, struct linux_linkat_args *);
1325
int	linux_symlinkat(struct thread *, struct linux_symlinkat_args *);
1326
int	linux_readlinkat(struct thread *, struct linux_readlinkat_args *);
1327
int	linux_fchmodat(struct thread *, struct linux_fchmodat_args *);
1328
int	linux_faccessat(struct thread *, struct linux_faccessat_args *);
1329
int	linux_pselect6(struct thread *, struct linux_pselect6_args *);
1330
int	linux_ppoll(struct thread *, struct linux_ppoll_args *);
1331
int	linux_unshare(struct thread *, struct linux_unshare_args *);
1332
int	linux_set_robust_list(struct thread *, struct linux_set_robust_list_args *);
1333
int	linux_get_robust_list(struct thread *, struct linux_get_robust_list_args *);
1334
int	linux_splice(struct thread *, struct linux_splice_args *);
1335
int	linux_tee(struct thread *, struct linux_tee_args *);
1336
int	linux_sync_file_range(struct thread *, struct linux_sync_file_range_args *);
1337
int	linux_vmsplice(struct thread *, struct linux_vmsplice_args *);
1338
int	linux_move_pages(struct thread *, struct linux_move_pages_args *);
1339
int	linux_utimensat(struct thread *, struct linux_utimensat_args *);
1340
int	linux_epoll_pwait(struct thread *, struct linux_epoll_pwait_args *);
1341
int	linux_signalfd(struct thread *, struct linux_signalfd_args *);
1342
int	linux_timerfd(struct thread *, struct linux_timerfd_args *);
1343
int	linux_eventfd(struct thread *, struct linux_eventfd_args *);
1344
int	linux_fallocate(struct thread *, struct linux_fallocate_args *);
1345
int	linux_timerfd_settime(struct thread *, struct linux_timerfd_settime_args *);
1346
int	linux_timerfd_gettime(struct thread *, struct linux_timerfd_gettime_args *);
1347
int	linux_accept4(struct thread *, struct linux_accept4_args *);
1348
int	linux_signalfd4(struct thread *, struct linux_signalfd4_args *);
1349
int	linux_eventfd2(struct thread *, struct linux_eventfd2_args *);
1350
int	linux_epoll_create1(struct thread *, struct linux_epoll_create1_args *);
1351
int	linux_dup3(struct thread *, struct linux_dup3_args *);
1352
int	linux_pipe2(struct thread *, struct linux_pipe2_args *);
1353
int	linux_inotify_init1(struct thread *, struct linux_inotify_init1_args *);
1354
int	linux_preadv(struct thread *, struct linux_preadv_args *);
1355
int	linux_pwritev(struct thread *, struct linux_pwritev_args *);
1356
int	linux_rt_tsigqueueinfo(struct thread *, struct linux_rt_tsigqueueinfo_args *);
1357
int	linux_perf_event_open(struct thread *, struct linux_perf_event_open_args *);
1358
int	linux_recvmmsg(struct thread *, struct linux_recvmmsg_args *);
1359
int	linux_fanotify_init(struct thread *, struct linux_fanotify_init_args *);
1360
int	linux_fanotify_mark(struct thread *, struct linux_fanotify_mark_args *);
1361
int	linux_prlimit64(struct thread *, struct linux_prlimit64_args *);
1362
int	linux_name_to_handle_at(struct thread *, struct linux_name_to_handle_at_args *);
1363
int	linux_open_by_handle_at(struct thread *, struct linux_open_by_handle_at_args *);
1364
int	linux_clock_adjtime(struct thread *, struct linux_clock_adjtime_args *);
1365
int	linux_syncfs(struct thread *, struct linux_syncfs_args *);
1366
int	linux_sendmmsg(struct thread *, struct linux_sendmmsg_args *);
1367
int	linux_setns(struct thread *, struct linux_setns_args *);
1368
int	linux_process_vm_readv(struct thread *, struct linux_process_vm_readv_args *);
1369
int	linux_process_vm_writev(struct thread *, struct linux_process_vm_writev_args *);
1370
int	linux_kcmp(struct thread *, struct linux_kcmp_args *);
1371
int	linux_finit_module(struct thread *, struct linux_finit_module_args *);
1372
1373
#ifdef COMPAT_43
1374
1375
#define	nosys	linux_nosys
1376
1377
#endif /* COMPAT_43 */
1378
1379
1380
#ifdef COMPAT_FREEBSD4
1381
1382
#define	nosys	linux_nosys
1383
1384
#endif /* COMPAT_FREEBSD4 */
1385
1386
1387
#ifdef COMPAT_FREEBSD6
1388
1389
#define	nosys	linux_nosys
1390
1391
#endif /* COMPAT_FREEBSD6 */
1392
1393
1394
#ifdef COMPAT_FREEBSD7
1395
1396
#define	nosys	linux_nosys
1397
1398
#endif /* COMPAT_FREEBSD7 */
1399
1400
#define	LINUX_SYS_AUE_linux_open	AUE_OPEN_RWTC
1401
#define	LINUX_SYS_AUE_linux_newstat	AUE_STAT
1402
#define	LINUX_SYS_AUE_linux_newfstat	AUE_FSTAT
1403
#define	LINUX_SYS_AUE_linux_newlstat	AUE_LSTAT
1404
#define	LINUX_SYS_AUE_linux_lseek	AUE_LSEEK
1405
#define	LINUX_SYS_AUE_linux_mmap2	AUE_MMAP
1406
#define	LINUX_SYS_AUE_linux_mprotect	AUE_MPROTECT
1407
#define	LINUX_SYS_AUE_linux_brk	AUE_NULL
1408
#define	LINUX_SYS_AUE_linux_rt_sigaction	AUE_NULL
1409
#define	LINUX_SYS_AUE_linux_rt_sigprocmask	AUE_NULL
1410
#define	LINUX_SYS_AUE_linux_rt_sigreturn	AUE_NULL
1411
#define	LINUX_SYS_AUE_linux_ioctl	AUE_IOCTL
1412
#define	LINUX_SYS_AUE_linux_pread	AUE_PREAD
1413
#define	LINUX_SYS_AUE_linux_pwrite	AUE_PWRITE
1414
#define	LINUX_SYS_AUE_linux_access	AUE_ACCESS
1415
#define	LINUX_SYS_AUE_linux_pipe	AUE_PIPE
1416
#define	LINUX_SYS_AUE_linux_select	AUE_SELECT
1417
#define	LINUX_SYS_AUE_linux_mremap	AUE_NULL
1418
#define	LINUX_SYS_AUE_linux_msync	AUE_MSYNC
1419
#define	LINUX_SYS_AUE_linux_mincore	AUE_MINCORE
1420
#define	LINUX_SYS_AUE_linux_shmget	AUE_NULL
1421
#define	LINUX_SYS_AUE_linux_shmat	AUE_NULL
1422
#define	LINUX_SYS_AUE_linux_shmctl	AUE_NULL
1423
#define	LINUX_SYS_AUE_linux_pause	AUE_NULL
1424
#define	LINUX_SYS_AUE_linux_nanosleep	AUE_NULL
1425
#define	LINUX_SYS_AUE_linux_getitimer	AUE_GETITIMER
1426
#define	LINUX_SYS_AUE_linux_alarm	AUE_NULL
1427
#define	LINUX_SYS_AUE_linux_setitimer	AUE_SETITIMER
1428
#define	LINUX_SYS_AUE_linux_getpid	AUE_GETPID
1429
#define	LINUX_SYS_AUE_linux_sendfile	AUE_SENDFILE
1430
#define	LINUX_SYS_AUE_linux_socket	AUE_SOCKET
1431
#define	LINUX_SYS_AUE_linux_connect	AUE_CONNECT
1432
#define	LINUX_SYS_AUE_linux_accept	AUE_ACCEPT
1433
#define	LINUX_SYS_AUE_linux_sendto	AUE_SENDTO
1434
#define	LINUX_SYS_AUE_linux_recvfrom	AUE_RECVFROM
1435
#define	LINUX_SYS_AUE_linux_sendmsg	AUE_SENDMSG
1436
#define	LINUX_SYS_AUE_linux_recvmsg	AUE_RECVMSG
1437
#define	LINUX_SYS_AUE_linux_shutdown	AUE_NULL
1438
#define	LINUX_SYS_AUE_linux_bind	AUE_BIND
1439
#define	LINUX_SYS_AUE_linux_listen	AUE_LISTEN
1440
#define	LINUX_SYS_AUE_linux_getsockname	AUE_GETSOCKNAME
1441
#define	LINUX_SYS_AUE_linux_getpeername	AUE_GETPEERNAME
1442
#define	LINUX_SYS_AUE_linux_socketpair	AUE_SOCKETPAIR
1443
#define	LINUX_SYS_AUE_linux_setsockopt	AUE_SETSOCKOPT
1444
#define	LINUX_SYS_AUE_linux_getsockopt	AUE_GETSOCKOPT
1445
#define	LINUX_SYS_AUE_linux_clone	AUE_RFORK
1446
#define	LINUX_SYS_AUE_linux_fork	AUE_FORK
1447
#define	LINUX_SYS_AUE_linux_vfork	AUE_VFORK
1448
#define	LINUX_SYS_AUE_linux_execve	AUE_EXECVE
1449
#define	LINUX_SYS_AUE_linux_exit	AUE_EXIT
1450
#define	LINUX_SYS_AUE_linux_wait4	AUE_WAIT4
1451
#define	LINUX_SYS_AUE_linux_kill	AUE_KILL
1452
#define	LINUX_SYS_AUE_linux_newuname	AUE_NULL
1453
#define	LINUX_SYS_AUE_linux_semget	AUE_NULL
1454
#define	LINUX_SYS_AUE_linux_semop	AUE_NULL
1455
#define	LINUX_SYS_AUE_linux_semctl	AUE_NULL
1456
#define	LINUX_SYS_AUE_linux_shmdt	AUE_NULL
1457
#define	LINUX_SYS_AUE_linux_msgget	AUE_NULL
1458
#define	LINUX_SYS_AUE_linux_msgsnd	AUE_NULL
1459
#define	LINUX_SYS_AUE_linux_msgrcv	AUE_NULL
1460
#define	LINUX_SYS_AUE_linux_msgctl	AUE_NULL
1461
#define	LINUX_SYS_AUE_linux_fcntl	AUE_FCNTL
1462
#define	LINUX_SYS_AUE_linux_fdatasync	AUE_NULL
1463
#define	LINUX_SYS_AUE_linux_truncate	AUE_TRUNCATE
1464
#define	LINUX_SYS_AUE_linux_ftruncate	AUE_FTRUNCATE
1465
#define	LINUX_SYS_AUE_linux_getdents	AUE_GETDIRENTRIES
1466
#define	LINUX_SYS_AUE_linux_getcwd	AUE_GETCWD
1467
#define	LINUX_SYS_AUE_linux_chdir	AUE_CHDIR
1468
#define	LINUX_SYS_AUE_linux_rename	AUE_RENAME
1469
#define	LINUX_SYS_AUE_linux_mkdir	AUE_MKDIR
1470
#define	LINUX_SYS_AUE_linux_rmdir	AUE_RMDIR
1471
#define	LINUX_SYS_AUE_linux_creat	AUE_CREAT
1472
#define	LINUX_SYS_AUE_linux_link	AUE_LINK
1473
#define	LINUX_SYS_AUE_linux_unlink	AUE_UNLINK
1474
#define	LINUX_SYS_AUE_linux_symlink	AUE_SYMLINK
1475
#define	LINUX_SYS_AUE_linux_readlink	AUE_READLINK
1476
#define	LINUX_SYS_AUE_linux_chmod	AUE_CHMOD
1477
#define	LINUX_SYS_AUE_linux_chown	AUE_LCHOWN
1478
#define	LINUX_SYS_AUE_linux_lchown	AUE_LCHOWN
1479
#define	LINUX_SYS_AUE_linux_getrlimit	AUE_GETRLIMIT
1480
#define	LINUX_SYS_AUE_linux_sysinfo	AUE_NULL
1481
#define	LINUX_SYS_AUE_linux_times	AUE_NULL
1482
#define	LINUX_SYS_AUE_linux_ptrace	AUE_PTRACE
1483
#define	LINUX_SYS_AUE_linux_getuid	AUE_GETUID
1484
#define	LINUX_SYS_AUE_linux_syslog	AUE_NULL
1485
#define	LINUX_SYS_AUE_linux_getgid	AUE_GETGID
1486
#define	LINUX_SYS_AUE_linux_getppid	AUE_GETPPID
1487
#define	LINUX_SYS_AUE_linux_getgroups	AUE_GETGROUPS
1488
#define	LINUX_SYS_AUE_linux_setgroups	AUE_SETGROUPS
1489
#define	LINUX_SYS_AUE_linux_setfsuid	AUE_SETFSUID
1490
#define	LINUX_SYS_AUE_linux_setfsgid	AUE_SETFSGID
1491
#define	LINUX_SYS_AUE_linux_getsid	AUE_GETSID
1492
#define	LINUX_SYS_AUE_linux_capget	AUE_CAPGET
1493
#define	LINUX_SYS_AUE_linux_capset	AUE_CAPSET
1494
#define	LINUX_SYS_AUE_linux_rt_sigpending	AUE_NULL
1495
#define	LINUX_SYS_AUE_linux_rt_sigtimedwait	AUE_NULL
1496
#define	LINUX_SYS_AUE_linux_rt_sigqueueinfo	AUE_NULL
1497
#define	LINUX_SYS_AUE_linux_rt_sigsuspend	AUE_NULL
1498
#define	LINUX_SYS_AUE_linux_sigaltstack	AUE_NULL
1499
#define	LINUX_SYS_AUE_linux_utime	AUE_UTIME
1500
#define	LINUX_SYS_AUE_linux_mknod	AUE_MKNOD
1501
#define	LINUX_SYS_AUE_linux_personality	AUE_PERSONALITY
1502
#define	LINUX_SYS_AUE_linux_ustat	AUE_NULL
1503
#define	LINUX_SYS_AUE_linux_statfs	AUE_STATFS
1504
#define	LINUX_SYS_AUE_linux_fstatfs	AUE_FSTATFS
1505
#define	LINUX_SYS_AUE_linux_sysfs	AUE_NULL
1506
#define	LINUX_SYS_AUE_linux_getpriority	AUE_GETPRIORITY
1507
#define	LINUX_SYS_AUE_linux_sched_setparam	AUE_SCHED_SETPARAM
1508
#define	LINUX_SYS_AUE_linux_sched_getparam	AUE_SCHED_GETPARAM
1509
#define	LINUX_SYS_AUE_linux_sched_setscheduler	AUE_SCHED_SETSCHEDULER
1510
#define	LINUX_SYS_AUE_linux_sched_getscheduler	AUE_SCHED_GETSCHEDULER
1511
#define	LINUX_SYS_AUE_linux_sched_get_priority_max	AUE_SCHED_GET_PRIORITY_MAX
1512
#define	LINUX_SYS_AUE_linux_sched_get_priority_min	AUE_SCHED_GET_PRIORITY_MIN
1513
#define	LINUX_SYS_AUE_linux_sched_rr_get_interval	AUE_SCHED_RR_GET_INTERVAL
1514
#define	LINUX_SYS_AUE_linux_vhangup	AUE_NULL
1515
#define	LINUX_SYS_AUE_linux_pivot_root	AUE_PIVOT_ROOT
1516
#define	LINUX_SYS_AUE_linux_sysctl	AUE_SYSCTL
1517
#define	LINUX_SYS_AUE_linux_prctl	AUE_PRCTL
1518
#define	LINUX_SYS_AUE_linux_arch_prctl	AUE_PRCTL
1519
#define	LINUX_SYS_AUE_linux_adjtimex	AUE_ADJTIME
1520
#define	LINUX_SYS_AUE_linux_setrlimit	AUE_SETRLIMIT
1521
#define	LINUX_SYS_AUE_linux_mount	AUE_MOUNT
1522
#define	LINUX_SYS_AUE_linux_umount	AUE_UMOUNT
1523
#define	LINUX_SYS_AUE_linux_swapoff	AUE_SWAPOFF
1524
#define	LINUX_SYS_AUE_linux_reboot	AUE_REBOOT
1525
#define	LINUX_SYS_AUE_linux_sethostname	AUE_SYSCTL
1526
#define	LINUX_SYS_AUE_linux_setdomainname	AUE_SYSCTL
1527
#define	LINUX_SYS_AUE_linux_iopl	AUE_NULL
1528
#define	LINUX_SYS_AUE_linux_create_module	AUE_NULL
1529
#define	LINUX_SYS_AUE_linux_init_module	AUE_NULL
1530
#define	LINUX_SYS_AUE_linux_delete_module	AUE_NULL
1531
#define	LINUX_SYS_AUE_linux_get_kernel_syms	AUE_NULL
1532
#define	LINUX_SYS_AUE_linux_query_module	AUE_NULL
1533
#define	LINUX_SYS_AUE_linux_quotactl	AUE_QUOTACTL
1534
#define	LINUX_SYS_AUE_linux_nfsservctl	AUE_NULL
1535
#define	LINUX_SYS_AUE_linux_getpmsg	AUE_GETPMSG
1536
#define	LINUX_SYS_AUE_linux_putpmsg	AUE_PUTPMSG
1537
#define	LINUX_SYS_AUE_linux_afs_syscall	AUE_NULL
1538
#define	LINUX_SYS_AUE_linux_tuxcall	AUE_NULL
1539
#define	LINUX_SYS_AUE_linux_security	AUE_NULL
1540
#define	LINUX_SYS_AUE_linux_gettid	AUE_NULL
1541
#define	LINUX_SYS_AUE_linux_setxattr	AUE_NULL
1542
#define	LINUX_SYS_AUE_linux_lsetxattr	AUE_NULL
1543
#define	LINUX_SYS_AUE_linux_fsetxattr	AUE_NULL
1544
#define	LINUX_SYS_AUE_linux_getxattr	AUE_NULL
1545
#define	LINUX_SYS_AUE_linux_lgetxattr	AUE_NULL
1546
#define	LINUX_SYS_AUE_linux_fgetxattr	AUE_NULL
1547
#define	LINUX_SYS_AUE_linux_listxattr	AUE_NULL
1548
#define	LINUX_SYS_AUE_linux_llistxattr	AUE_NULL
1549
#define	LINUX_SYS_AUE_linux_flistxattr	AUE_NULL
1550
#define	LINUX_SYS_AUE_linux_removexattr	AUE_NULL
1551
#define	LINUX_SYS_AUE_linux_lremovexattr	AUE_NULL
1552
#define	LINUX_SYS_AUE_linux_fremovexattr	AUE_NULL
1553
#define	LINUX_SYS_AUE_linux_tkill	AUE_NULL
1554
#define	LINUX_SYS_AUE_linux_time	AUE_NULL
1555
#define	LINUX_SYS_AUE_linux_sys_futex	AUE_NULL
1556
#define	LINUX_SYS_AUE_linux_sched_setaffinity	AUE_NULL
1557
#define	LINUX_SYS_AUE_linux_sched_getaffinity	AUE_NULL
1558
#define	LINUX_SYS_AUE_linux_set_thread_area	AUE_NULL
1559
#define	LINUX_SYS_AUE_linux_lookup_dcookie	AUE_NULL
1560
#define	LINUX_SYS_AUE_linux_epoll_create	AUE_NULL
1561
#define	LINUX_SYS_AUE_linux_epoll_ctl_old	AUE_NULL
1562
#define	LINUX_SYS_AUE_linux_epoll_wait_old	AUE_NULL
1563
#define	LINUX_SYS_AUE_linux_remap_file_pages	AUE_NULL
1564
#define	LINUX_SYS_AUE_linux_getdents64	AUE_GETDIRENTRIES
1565
#define	LINUX_SYS_AUE_linux_set_tid_address	AUE_NULL
1566
#define	LINUX_SYS_AUE_linux_semtimedop	AUE_NULL
1567
#define	LINUX_SYS_AUE_linux_fadvise64	AUE_NULL
1568
#define	LINUX_SYS_AUE_linux_timer_create	AUE_NULL
1569
#define	LINUX_SYS_AUE_linux_timer_settime	AUE_NULL
1570
#define	LINUX_SYS_AUE_linux_timer_gettime	AUE_NULL
1571
#define	LINUX_SYS_AUE_linux_timer_getoverrun	AUE_NULL
1572
#define	LINUX_SYS_AUE_linux_timer_delete	AUE_NULL
1573
#define	LINUX_SYS_AUE_linux_clock_settime	AUE_CLOCK_SETTIME
1574
#define	LINUX_SYS_AUE_linux_clock_gettime	AUE_NULL
1575
#define	LINUX_SYS_AUE_linux_clock_getres	AUE_NULL
1576
#define	LINUX_SYS_AUE_linux_clock_nanosleep	AUE_NULL
1577
#define	LINUX_SYS_AUE_linux_exit_group	AUE_EXIT
1578
#define	LINUX_SYS_AUE_linux_epoll_wait	AUE_NULL
1579
#define	LINUX_SYS_AUE_linux_epoll_ctl	AUE_NULL
1580
#define	LINUX_SYS_AUE_linux_tgkill	AUE_NULL
1581
#define	LINUX_SYS_AUE_linux_utimes	AUE_UTIMES
1582
#define	LINUX_SYS_AUE_linux_mbind	AUE_NULL
1583
#define	LINUX_SYS_AUE_linux_set_mempolicy	AUE_NULL
1584
#define	LINUX_SYS_AUE_linux_get_mempolicy	AUE_NULL
1585
#define	LINUX_SYS_AUE_linux_mq_open	AUE_NULL
1586
#define	LINUX_SYS_AUE_linux_mq_unlink	AUE_NULL
1587
#define	LINUX_SYS_AUE_linux_mq_timedsend	AUE_NULL
1588
#define	LINUX_SYS_AUE_linux_mq_timedreceive	AUE_NULL
1589
#define	LINUX_SYS_AUE_linux_mq_notify	AUE_NULL
1590
#define	LINUX_SYS_AUE_linux_mq_getsetattr	AUE_NULL
1591
#define	LINUX_SYS_AUE_linux_kexec_load	AUE_NULL
1592
#define	LINUX_SYS_AUE_linux_waitid	AUE_WAIT6
1593
#define	LINUX_SYS_AUE_linux_add_key	AUE_NULL
1594
#define	LINUX_SYS_AUE_linux_request_key	AUE_NULL
1595
#define	LINUX_SYS_AUE_linux_keyctl	AUE_NULL
1596
#define	LINUX_SYS_AUE_linux_ioprio_set	AUE_NULL
1597
#define	LINUX_SYS_AUE_linux_ioprio_get	AUE_NULL
1598
#define	LINUX_SYS_AUE_linux_inotify_init	AUE_NULL
1599
#define	LINUX_SYS_AUE_linux_inotify_add_watch	AUE_NULL
1600
#define	LINUX_SYS_AUE_linux_inotify_rm_watch	AUE_NULL
1601
#define	LINUX_SYS_AUE_linux_migrate_pages	AUE_NULL
1602
#define	LINUX_SYS_AUE_linux_openat	AUE_OPEN_RWTC
1603
#define	LINUX_SYS_AUE_linux_mkdirat	AUE_MKDIRAT
1604
#define	LINUX_SYS_AUE_linux_mknodat	AUE_MKNODAT
1605
#define	LINUX_SYS_AUE_linux_fchownat	AUE_FCHOWNAT
1606
#define	LINUX_SYS_AUE_linux_futimesat	AUE_FUTIMESAT
1607
#define	LINUX_SYS_AUE_linux_newfstatat	AUE_FSTATAT
1608
#define	LINUX_SYS_AUE_linux_unlinkat	AUE_UNLINKAT
1609
#define	LINUX_SYS_AUE_linux_renameat	AUE_RENAMEAT
1610
#define	LINUX_SYS_AUE_linux_linkat	AUE_LINKAT
1611
#define	LINUX_SYS_AUE_linux_symlinkat	AUE_SYMLINKAT
1612
#define	LINUX_SYS_AUE_linux_readlinkat	AUE_READLINKAT
1613
#define	LINUX_SYS_AUE_linux_fchmodat	AUE_FCHMODAT
1614
#define	LINUX_SYS_AUE_linux_faccessat	AUE_FACCESSAT
1615
#define	LINUX_SYS_AUE_linux_pselect6	AUE_SELECT
1616
#define	LINUX_SYS_AUE_linux_ppoll	AUE_POLL
1617
#define	LINUX_SYS_AUE_linux_unshare	AUE_NULL
1618
#define	LINUX_SYS_AUE_linux_set_robust_list	AUE_NULL
1619
#define	LINUX_SYS_AUE_linux_get_robust_list	AUE_NULL
1620
#define	LINUX_SYS_AUE_linux_splice	AUE_NULL
1621
#define	LINUX_SYS_AUE_linux_tee	AUE_NULL
1622
#define	LINUX_SYS_AUE_linux_sync_file_range	AUE_NULL
1623
#define	LINUX_SYS_AUE_linux_vmsplice	AUE_NULL
1624
#define	LINUX_SYS_AUE_linux_move_pages	AUE_NULL
1625
#define	LINUX_SYS_AUE_linux_utimensat	AUE_FUTIMESAT
1626
#define	LINUX_SYS_AUE_linux_epoll_pwait	AUE_NULL
1627
#define	LINUX_SYS_AUE_linux_signalfd	AUE_NULL
1628
#define	LINUX_SYS_AUE_linux_timerfd	AUE_NULL
1629
#define	LINUX_SYS_AUE_linux_eventfd	AUE_NULL
1630
#define	LINUX_SYS_AUE_linux_fallocate	AUE_NULL
1631
#define	LINUX_SYS_AUE_linux_timerfd_settime	AUE_NULL
1632
#define	LINUX_SYS_AUE_linux_timerfd_gettime	AUE_NULL
1633
#define	LINUX_SYS_AUE_linux_accept4	AUE_ACCEPT
1634
#define	LINUX_SYS_AUE_linux_signalfd4	AUE_NULL
1635
#define	LINUX_SYS_AUE_linux_eventfd2	AUE_NULL
1636
#define	LINUX_SYS_AUE_linux_epoll_create1	AUE_NULL
1637
#define	LINUX_SYS_AUE_linux_dup3	AUE_NULL
1638
#define	LINUX_SYS_AUE_linux_pipe2	AUE_NULL
1639
#define	LINUX_SYS_AUE_linux_inotify_init1	AUE_NULL
1640
#define	LINUX_SYS_AUE_linux_preadv	AUE_NULL
1641
#define	LINUX_SYS_AUE_linux_pwritev	AUE_NULL
1642
#define	LINUX_SYS_AUE_linux_rt_tsigqueueinfo	AUE_NULL
1643
#define	LINUX_SYS_AUE_linux_perf_event_open	AUE_NULL
1644
#define	LINUX_SYS_AUE_linux_recvmmsg	AUE_NULL
1645
#define	LINUX_SYS_AUE_linux_fanotify_init	AUE_NULL
1646
#define	LINUX_SYS_AUE_linux_fanotify_mark	AUE_NULL
1647
#define	LINUX_SYS_AUE_linux_prlimit64	AUE_NULL
1648
#define	LINUX_SYS_AUE_linux_name_to_handle_at	AUE_NULL
1649
#define	LINUX_SYS_AUE_linux_open_by_handle_at	AUE_NULL
1650
#define	LINUX_SYS_AUE_linux_clock_adjtime	AUE_NULL
1651
#define	LINUX_SYS_AUE_linux_syncfs	AUE_SYNC
1652
#define	LINUX_SYS_AUE_linux_sendmmsg	AUE_NULL
1653
#define	LINUX_SYS_AUE_linux_setns	AUE_NULL
1654
#define	LINUX_SYS_AUE_linux_process_vm_readv	AUE_NULL
1655
#define	LINUX_SYS_AUE_linux_process_vm_writev	AUE_NULL
1656
#define	LINUX_SYS_AUE_linux_kcmp	AUE_NULL
1657
#define	LINUX_SYS_AUE_linux_finit_module	AUE_NULL
1658
1659
#undef PAD_
1660
#undef PADL_
1661
#undef PADR_
1662
1663
#endif /* !_LINUX_SYSPROTO_H_ */
(-)sys/amd64/linux/linux_support.s (+124 lines)
Line 0 Link Here
1
/*-
2
 * Copyright (c) 2007 Konstantin Belousov
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
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 * 4. Neither the name of the University nor the names of its contributors
14
 *    may be used to endorse or promote products derived from this software
15
 *    without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
 * SUCH DAMAGE.
28
 *
29
 * $FreeBSD$
30
 */
31
32
#include "linux_assym.h"		/* system definitions */
33
#include <machine/asmacros.h>		/* miscellaneous asm macros */
34
35
#include "assym.s"
36
37
futex_fault:
38
	movq	$0,PCB_ONFAULT(%r8)
39
	movl	$-EFAULT,%eax
40
	ret
41
42
ENTRY(futex_xchgl)
43
	movq	PCPU(CURPCB),%r8
44
	movq	$futex_fault,PCB_ONFAULT(%r8)
45
	movq	$VM_MAXUSER_ADDRESS-4,%rax
46
	cmpq	%rax,%rsi
47
	ja	futex_fault
48
	xchgl	%edi,(%rsi)
49
	movl	%edi,(%rdx)
50
	xorl	%eax,%eax
51
	movq	%rax,PCB_ONFAULT(%r8)
52
	ret
53
54
ENTRY(futex_addl)
55
	movq	PCPU(CURPCB),%r8
56
	movq	$futex_fault,PCB_ONFAULT(%r8)
57
	movq	$VM_MAXUSER_ADDRESS-4,%rax
58
	cmpq	%rax,%rsi
59
	ja	futex_fault
60
#ifdef SMP
61
	lock
62
#endif
63
	xaddl	%edi,(%rsi)
64
	movl	%edi,(%rdx)
65
	xorl	%eax,%eax
66
	movq	%rax,PCB_ONFAULT(%r8)
67
	ret
68
69
ENTRY(futex_orl)
70
	movq	PCPU(CURPCB),%r8
71
	movq	$futex_fault,PCB_ONFAULT(%r8)
72
	movq	$VM_MAXUSER_ADDRESS-4,%rax
73
	cmpq	%rax,%rsi
74
	ja	futex_fault
75
	movl	(%rsi),%eax
76
1:	movl	%eax,%ecx
77
	orl	%edi,%ecx
78
#ifdef SMP
79
	lock
80
#endif
81
	cmpxchgl %ecx,(%rsi)
82
	jnz	1b
83
	movl	%eax,(%rdx)
84
	xorl	%eax,%eax
85
	movq	%rax,PCB_ONFAULT(%r8)
86
	ret
87
88
ENTRY(futex_andl)
89
	movq	PCPU(CURPCB),%r8
90
	movq	$futex_fault,PCB_ONFAULT(%r8)
91
	movq	$VM_MAXUSER_ADDRESS-4,%rax
92
	cmpq	%rax,%rsi
93
	ja	futex_fault
94
	movl	(%rsi),%eax
95
1:	movl	%eax,%ecx
96
	andl	%edi,%ecx
97
#ifdef SMP
98
	lock
99
#endif
100
	cmpxchgl %ecx,(%rsi)
101
	jnz	1b
102
	movl	%eax,(%rdx)
103
	xorl	%eax,%eax
104
	movq	%rax,PCB_ONFAULT(%r8)
105
	ret
106
107
ENTRY(futex_xorl)
108
	movq	PCPU(CURPCB),%r8
109
	movq	$futex_fault,PCB_ONFAULT(%r8)
110
	movq	$VM_MAXUSER_ADDRESS-4,%rax
111
	cmpq	%rax,%rsi
112
	ja	futex_fault
113
	movl	(%rsi),%eax
114
1:	movl	%eax,%ecx
115
	xorl	%edi,%ecx
116
#ifdef SMP
117
	lock
118
#endif
119
	cmpxchgl %ecx,(%rsi)
120
	jnz	1b
121
	movl	%eax,(%rdx)
122
	xorl	%eax,%eax
123
	movq	%rax,PCB_ONFAULT(%r8)
124
	ret
(-)sys/amd64/linux/linux_syscall.h (+310 lines)
Line 0 Link Here
1
/*
2
 * System call numbers.
3
 *
4
 * DO NOT EDIT-- this file is automatically generated.
5
 * $FreeBSD$
6
 * created from FreeBSD
7
 */
8
9
#define	LINUX_SYS_read	0
10
#define	LINUX_SYS_write	1
11
#define	LINUX_SYS_linux_open	2
12
#define	LINUX_SYS_close	3
13
#define	LINUX_SYS_linux_newstat	4
14
#define	LINUX_SYS_linux_newfstat	5
15
#define	LINUX_SYS_linux_newlstat	6
16
#define	LINUX_SYS_poll	7
17
#define	LINUX_SYS_linux_lseek	8
18
#define	LINUX_SYS_linux_mmap2	9
19
#define	LINUX_SYS_linux_mprotect	10
20
#define	LINUX_SYS_munmap	11
21
#define	LINUX_SYS_linux_brk	12
22
#define	LINUX_SYS_linux_rt_sigaction	13
23
#define	LINUX_SYS_linux_rt_sigprocmask	14
24
#define	LINUX_SYS_linux_rt_sigreturn	15
25
#define	LINUX_SYS_linux_ioctl	16
26
#define	LINUX_SYS_linux_pread	17
27
#define	LINUX_SYS_linux_pwrite	18
28
#define	LINUX_SYS_readv	19
29
#define	LINUX_SYS_writev	20
30
#define	LINUX_SYS_linux_access	21
31
#define	LINUX_SYS_linux_pipe	22
32
#define	LINUX_SYS_linux_select	23
33
#define	LINUX_SYS_sched_yield	24
34
#define	LINUX_SYS_linux_mremap	25
35
#define	LINUX_SYS_linux_msync	26
36
#define	LINUX_SYS_linux_mincore	27
37
#define	LINUX_SYS_madvise	28
38
#define	LINUX_SYS_linux_shmget	29
39
#define	LINUX_SYS_linux_shmat	30
40
#define	LINUX_SYS_linux_shmctl	31
41
#define	LINUX_SYS_dup	32
42
#define	LINUX_SYS_dup2	33
43
#define	LINUX_SYS_linux_pause	34
44
#define	LINUX_SYS_linux_nanosleep	35
45
#define	LINUX_SYS_linux_getitimer	36
46
#define	LINUX_SYS_linux_alarm	37
47
#define	LINUX_SYS_linux_setitimer	38
48
#define	LINUX_SYS_linux_getpid	39
49
#define	LINUX_SYS_linux_sendfile	40
50
#define	LINUX_SYS_linux_socket	41
51
#define	LINUX_SYS_linux_connect	42
52
#define	LINUX_SYS_linux_accept	43
53
#define	LINUX_SYS_linux_sendto	44
54
#define	LINUX_SYS_linux_recvfrom	45
55
#define	LINUX_SYS_linux_sendmsg	46
56
#define	LINUX_SYS_linux_recvmsg	47
57
#define	LINUX_SYS_linux_shutdown	48
58
#define	LINUX_SYS_linux_bind	49
59
#define	LINUX_SYS_linux_listen	50
60
#define	LINUX_SYS_linux_getsockname	51
61
#define	LINUX_SYS_linux_getpeername	52
62
#define	LINUX_SYS_linux_socketpair	53
63
#define	LINUX_SYS_linux_setsockopt	54
64
#define	LINUX_SYS_linux_getsockopt	55
65
#define	LINUX_SYS_linux_clone	56
66
#define	LINUX_SYS_linux_fork	57
67
#define	LINUX_SYS_linux_vfork	58
68
#define	LINUX_SYS_linux_execve	59
69
#define	LINUX_SYS_linux_exit	60
70
#define	LINUX_SYS_linux_wait4	61
71
#define	LINUX_SYS_linux_kill	62
72
#define	LINUX_SYS_linux_newuname	63
73
#define	LINUX_SYS_linux_semget	64
74
#define	LINUX_SYS_linux_semop	65
75
#define	LINUX_SYS_linux_semctl	66
76
#define	LINUX_SYS_linux_shmdt	67
77
#define	LINUX_SYS_linux_msgget	68
78
#define	LINUX_SYS_linux_msgsnd	69
79
#define	LINUX_SYS_linux_msgrcv	70
80
#define	LINUX_SYS_linux_msgctl	71
81
#define	LINUX_SYS_linux_fcntl	72
82
#define	LINUX_SYS_flock	73
83
#define	LINUX_SYS_fsync	74
84
#define	LINUX_SYS_linux_fdatasync	75
85
#define	LINUX_SYS_linux_truncate	76
86
#define	LINUX_SYS_linux_ftruncate	77
87
#define	LINUX_SYS_linux_getdents	78
88
#define	LINUX_SYS_linux_getcwd	79
89
#define	LINUX_SYS_linux_chdir	80
90
#define	LINUX_SYS_fchdir	81
91
#define	LINUX_SYS_linux_rename	82
92
#define	LINUX_SYS_linux_mkdir	83
93
#define	LINUX_SYS_linux_rmdir	84
94
#define	LINUX_SYS_linux_creat	85
95
#define	LINUX_SYS_linux_link	86
96
#define	LINUX_SYS_linux_unlink	87
97
#define	LINUX_SYS_linux_symlink	88
98
#define	LINUX_SYS_linux_readlink	89
99
#define	LINUX_SYS_linux_chmod	90
100
#define	LINUX_SYS_fchmod	91
101
#define	LINUX_SYS_linux_chown	92
102
#define	LINUX_SYS_fchown	93
103
#define	LINUX_SYS_linux_lchown	94
104
#define	LINUX_SYS_umask	95
105
#define	LINUX_SYS_gettimeofday	96
106
#define	LINUX_SYS_linux_getrlimit	97
107
#define	LINUX_SYS_getrusage	98
108
#define	LINUX_SYS_linux_sysinfo	99
109
#define	LINUX_SYS_linux_times	100
110
#define	LINUX_SYS_linux_ptrace	101
111
#define	LINUX_SYS_linux_getuid	102
112
#define	LINUX_SYS_linux_syslog	103
113
#define	LINUX_SYS_linux_getgid	104
114
#define	LINUX_SYS_setuid	105
115
#define	LINUX_SYS_setgid	106
116
#define	LINUX_SYS_geteuid	107
117
#define	LINUX_SYS_getegid	108
118
#define	LINUX_SYS_setpgid	109
119
#define	LINUX_SYS_linux_getppid	110
120
#define	LINUX_SYS_getpgrp	111
121
#define	LINUX_SYS_setsid	112
122
#define	LINUX_SYS_setreuid	113
123
#define	LINUX_SYS_setregid	114
124
#define	LINUX_SYS_linux_getgroups	115
125
#define	LINUX_SYS_linux_setgroups	116
126
#define	LINUX_SYS_setresuid	117
127
#define	LINUX_SYS_getresuid	118
128
#define	LINUX_SYS_setresgid	119
129
#define	LINUX_SYS_getresgid	120
130
#define	LINUX_SYS_getpgid	121
131
#define	LINUX_SYS_linux_setfsuid	122
132
#define	LINUX_SYS_linux_setfsgid	123
133
#define	LINUX_SYS_linux_getsid	124
134
#define	LINUX_SYS_linux_capget	125
135
#define	LINUX_SYS_linux_capset	126
136
#define	LINUX_SYS_linux_rt_sigpending	127
137
#define	LINUX_SYS_linux_rt_sigtimedwait	128
138
#define	LINUX_SYS_linux_rt_sigqueueinfo	129
139
#define	LINUX_SYS_linux_rt_sigsuspend	130
140
#define	LINUX_SYS_linux_sigaltstack	131
141
#define	LINUX_SYS_linux_utime	132
142
#define	LINUX_SYS_linux_mknod	133
143
#define	LINUX_SYS_linux_personality	135
144
#define	LINUX_SYS_linux_ustat	136
145
#define	LINUX_SYS_linux_statfs	137
146
#define	LINUX_SYS_linux_fstatfs	138
147
#define	LINUX_SYS_linux_sysfs	139
148
#define	LINUX_SYS_linux_getpriority	140
149
#define	LINUX_SYS_setpriority	141
150
#define	LINUX_SYS_linux_sched_setparam	142
151
#define	LINUX_SYS_linux_sched_getparam	143
152
#define	LINUX_SYS_linux_sched_setscheduler	144
153
#define	LINUX_SYS_linux_sched_getscheduler	145
154
#define	LINUX_SYS_linux_sched_get_priority_max	146
155
#define	LINUX_SYS_linux_sched_get_priority_min	147
156
#define	LINUX_SYS_linux_sched_rr_get_interval	148
157
#define	LINUX_SYS_mlock	149
158
#define	LINUX_SYS_munlock	150
159
#define	LINUX_SYS_mlockall	151
160
#define	LINUX_SYS_munlockall	152
161
#define	LINUX_SYS_linux_vhangup	153
162
#define	LINUX_SYS_linux_pivot_root	155
163
#define	LINUX_SYS_linux_sysctl	156
164
#define	LINUX_SYS_linux_prctl	157
165
#define	LINUX_SYS_linux_arch_prctl	158
166
#define	LINUX_SYS_linux_adjtimex	159
167
#define	LINUX_SYS_linux_setrlimit	160
168
#define	LINUX_SYS_chroot	161
169
#define	LINUX_SYS_sync	162
170
#define	LINUX_SYS_acct	163
171
#define	LINUX_SYS_settimeofday	164
172
#define	LINUX_SYS_linux_mount	165
173
#define	LINUX_SYS_linux_umount	166
174
#define	LINUX_SYS_swapon	167
175
#define	LINUX_SYS_linux_swapoff	168
176
#define	LINUX_SYS_linux_reboot	169
177
#define	LINUX_SYS_linux_sethostname	170
178
#define	LINUX_SYS_linux_setdomainname	171
179
#define	LINUX_SYS_linux_iopl	172
180
#define	LINUX_SYS_linux_create_module	174
181
#define	LINUX_SYS_linux_init_module	175
182
#define	LINUX_SYS_linux_delete_module	176
183
#define	LINUX_SYS_linux_get_kernel_syms	177
184
#define	LINUX_SYS_linux_query_module	178
185
#define	LINUX_SYS_linux_quotactl	179
186
#define	LINUX_SYS_linux_nfsservctl	180
187
#define	LINUX_SYS_linux_getpmsg	181
188
#define	LINUX_SYS_linux_putpmsg	182
189
#define	LINUX_SYS_linux_afs_syscall	183
190
#define	LINUX_SYS_linux_tuxcall	184
191
#define	LINUX_SYS_linux_security	185
192
#define	LINUX_SYS_linux_gettid	186
193
#define	LINUX_SYS_linux_setxattr	188
194
#define	LINUX_SYS_linux_lsetxattr	189
195
#define	LINUX_SYS_linux_fsetxattr	190
196
#define	LINUX_SYS_linux_getxattr	191
197
#define	LINUX_SYS_linux_lgetxattr	192
198
#define	LINUX_SYS_linux_fgetxattr	193
199
#define	LINUX_SYS_linux_listxattr	194
200
#define	LINUX_SYS_linux_llistxattr	195
201
#define	LINUX_SYS_linux_flistxattr	196
202
#define	LINUX_SYS_linux_removexattr	197
203
#define	LINUX_SYS_linux_lremovexattr	198
204
#define	LINUX_SYS_linux_fremovexattr	199
205
#define	LINUX_SYS_linux_tkill	200
206
#define	LINUX_SYS_linux_time	201
207
#define	LINUX_SYS_linux_sys_futex	202
208
#define	LINUX_SYS_linux_sched_setaffinity	203
209
#define	LINUX_SYS_linux_sched_getaffinity	204
210
#define	LINUX_SYS_linux_set_thread_area	205
211
#define	LINUX_SYS_linux_lookup_dcookie	212
212
#define	LINUX_SYS_linux_epoll_create	213
213
#define	LINUX_SYS_linux_epoll_ctl_old	214
214
#define	LINUX_SYS_linux_epoll_wait_old	215
215
#define	LINUX_SYS_linux_remap_file_pages	216
216
#define	LINUX_SYS_linux_getdents64	217
217
#define	LINUX_SYS_linux_set_tid_address	218
218
#define	LINUX_SYS_linux_semtimedop	220
219
#define	LINUX_SYS_linux_fadvise64	221
220
#define	LINUX_SYS_linux_timer_create	222
221
#define	LINUX_SYS_linux_timer_settime	223
222
#define	LINUX_SYS_linux_timer_gettime	224
223
#define	LINUX_SYS_linux_timer_getoverrun	225
224
#define	LINUX_SYS_linux_timer_delete	226
225
#define	LINUX_SYS_linux_clock_settime	227
226
#define	LINUX_SYS_linux_clock_gettime	228
227
#define	LINUX_SYS_linux_clock_getres	229
228
#define	LINUX_SYS_linux_clock_nanosleep	230
229
#define	LINUX_SYS_linux_exit_group	231
230
#define	LINUX_SYS_linux_epoll_wait	232
231
#define	LINUX_SYS_linux_epoll_ctl	233
232
#define	LINUX_SYS_linux_tgkill	234
233
#define	LINUX_SYS_linux_utimes	235
234
#define	LINUX_SYS_linux_mbind	237
235
#define	LINUX_SYS_linux_set_mempolicy	238
236
#define	LINUX_SYS_linux_get_mempolicy	239
237
#define	LINUX_SYS_linux_mq_open	240
238
#define	LINUX_SYS_linux_mq_unlink	241
239
#define	LINUX_SYS_linux_mq_timedsend	242
240
#define	LINUX_SYS_linux_mq_timedreceive	243
241
#define	LINUX_SYS_linux_mq_notify	244
242
#define	LINUX_SYS_linux_mq_getsetattr	245
243
#define	LINUX_SYS_linux_kexec_load	246
244
#define	LINUX_SYS_linux_waitid	247
245
#define	LINUX_SYS_linux_add_key	248
246
#define	LINUX_SYS_linux_request_key	249
247
#define	LINUX_SYS_linux_keyctl	250
248
#define	LINUX_SYS_linux_ioprio_set	251
249
#define	LINUX_SYS_linux_ioprio_get	252
250
#define	LINUX_SYS_linux_inotify_init	253
251
#define	LINUX_SYS_linux_inotify_add_watch	254
252
#define	LINUX_SYS_linux_inotify_rm_watch	255
253
#define	LINUX_SYS_linux_migrate_pages	256
254
#define	LINUX_SYS_linux_openat	257
255
#define	LINUX_SYS_linux_mkdirat	258
256
#define	LINUX_SYS_linux_mknodat	259
257
#define	LINUX_SYS_linux_fchownat	260
258
#define	LINUX_SYS_linux_futimesat	261
259
#define	LINUX_SYS_linux_newfstatat	262
260
#define	LINUX_SYS_linux_unlinkat	263
261
#define	LINUX_SYS_linux_renameat	264
262
#define	LINUX_SYS_linux_linkat	265
263
#define	LINUX_SYS_linux_symlinkat	266
264
#define	LINUX_SYS_linux_readlinkat	267
265
#define	LINUX_SYS_linux_fchmodat	268
266
#define	LINUX_SYS_linux_faccessat	269
267
#define	LINUX_SYS_linux_pselect6	270
268
#define	LINUX_SYS_linux_ppoll	271
269
#define	LINUX_SYS_linux_unshare	272
270
#define	LINUX_SYS_linux_set_robust_list	273
271
#define	LINUX_SYS_linux_get_robust_list	274
272
#define	LINUX_SYS_linux_splice	275
273
#define	LINUX_SYS_linux_tee	276
274
#define	LINUX_SYS_linux_sync_file_range	277
275
#define	LINUX_SYS_linux_vmsplice	278
276
#define	LINUX_SYS_linux_move_pages	279
277
#define	LINUX_SYS_linux_utimensat	280
278
#define	LINUX_SYS_linux_epoll_pwait	281
279
#define	LINUX_SYS_linux_signalfd	282
280
#define	LINUX_SYS_linux_timerfd	283
281
#define	LINUX_SYS_linux_eventfd	284
282
#define	LINUX_SYS_linux_fallocate	285
283
#define	LINUX_SYS_linux_timerfd_settime	286
284
#define	LINUX_SYS_linux_timerfd_gettime	287
285
#define	LINUX_SYS_linux_accept4	288
286
#define	LINUX_SYS_linux_signalfd4	289
287
#define	LINUX_SYS_linux_eventfd2	290
288
#define	LINUX_SYS_linux_epoll_create1	291
289
#define	LINUX_SYS_linux_dup3	292
290
#define	LINUX_SYS_linux_pipe2	293
291
#define	LINUX_SYS_linux_inotify_init1	294
292
#define	LINUX_SYS_linux_preadv	295
293
#define	LINUX_SYS_linux_pwritev	296
294
#define	LINUX_SYS_linux_rt_tsigqueueinfo	297
295
#define	LINUX_SYS_linux_perf_event_open	298
296
#define	LINUX_SYS_linux_recvmmsg	299
297
#define	LINUX_SYS_linux_fanotify_init	300
298
#define	LINUX_SYS_linux_fanotify_mark	301
299
#define	LINUX_SYS_linux_prlimit64	302
300
#define	LINUX_SYS_linux_name_to_handle_at	303
301
#define	LINUX_SYS_linux_open_by_handle_at	304
302
#define	LINUX_SYS_linux_clock_adjtime	305
303
#define	LINUX_SYS_linux_syncfs	306
304
#define	LINUX_SYS_linux_sendmmsg	307
305
#define	LINUX_SYS_linux_setns	308
306
#define	LINUX_SYS_linux_process_vm_readv	309
307
#define	LINUX_SYS_linux_process_vm_writev	310
308
#define	LINUX_SYS_linux_kcmp	311
309
#define	LINUX_SYS_linux_finit_module	312
310
#define	LINUX_SYS_MAXSYSCALL	314
(-)sys/amd64/linux/linux_syscalls.c (+325 lines)
Line 0 Link Here
1
/*
2
 * System call names.
3
 *
4
 * DO NOT EDIT-- this file is automatically generated.
5
 * $FreeBSD$
6
 * created from FreeBSD
7
 */
8
9
const char *linux_syscallnames[] = {
10
#define	nosys	linux_nosys
11
	"read",			/* 0 = read */
12
	"write",			/* 1 = write */
13
	"linux_open",			/* 2 = linux_open */
14
	"close",			/* 3 = close */
15
	"linux_newstat",			/* 4 = linux_newstat */
16
	"linux_newfstat",			/* 5 = linux_newfstat */
17
	"linux_newlstat",			/* 6 = linux_newlstat */
18
	"poll",			/* 7 = poll */
19
	"linux_lseek",			/* 8 = linux_lseek */
20
	"linux_mmap2",			/* 9 = linux_mmap2 */
21
	"linux_mprotect",			/* 10 = linux_mprotect */
22
	"munmap",			/* 11 = munmap */
23
	"linux_brk",			/* 12 = linux_brk */
24
	"linux_rt_sigaction",			/* 13 = linux_rt_sigaction */
25
	"linux_rt_sigprocmask",			/* 14 = linux_rt_sigprocmask */
26
	"linux_rt_sigreturn",			/* 15 = linux_rt_sigreturn */
27
	"linux_ioctl",			/* 16 = linux_ioctl */
28
	"linux_pread",			/* 17 = linux_pread */
29
	"linux_pwrite",			/* 18 = linux_pwrite */
30
	"readv",			/* 19 = readv */
31
	"writev",			/* 20 = writev */
32
	"linux_access",			/* 21 = linux_access */
33
	"linux_pipe",			/* 22 = linux_pipe */
34
	"linux_select",			/* 23 = linux_select */
35
	"sched_yield",			/* 24 = sched_yield */
36
	"linux_mremap",			/* 25 = linux_mremap */
37
	"linux_msync",			/* 26 = linux_msync */
38
	"linux_mincore",			/* 27 = linux_mincore */
39
	"madvise",			/* 28 = madvise */
40
	"linux_shmget",			/* 29 = linux_shmget */
41
	"linux_shmat",			/* 30 = linux_shmat */
42
	"linux_shmctl",			/* 31 = linux_shmctl */
43
	"dup",			/* 32 = dup */
44
	"dup2",			/* 33 = dup2 */
45
	"linux_pause",			/* 34 = linux_pause */
46
	"linux_nanosleep",			/* 35 = linux_nanosleep */
47
	"linux_getitimer",			/* 36 = linux_getitimer */
48
	"linux_alarm",			/* 37 = linux_alarm */
49
	"linux_setitimer",			/* 38 = linux_setitimer */
50
	"linux_getpid",			/* 39 = linux_getpid */
51
	"linux_sendfile",			/* 40 = linux_sendfile */
52
	"linux_socket",			/* 41 = linux_socket */
53
	"linux_connect",			/* 42 = linux_connect */
54
	"linux_accept",			/* 43 = linux_accept */
55
	"linux_sendto",			/* 44 = linux_sendto */
56
	"linux_recvfrom",			/* 45 = linux_recvfrom */
57
	"linux_sendmsg",			/* 46 = linux_sendmsg */
58
	"linux_recvmsg",			/* 47 = linux_recvmsg */
59
	"linux_shutdown",			/* 48 = linux_shutdown */
60
	"linux_bind",			/* 49 = linux_bind */
61
	"linux_listen",			/* 50 = linux_listen */
62
	"linux_getsockname",			/* 51 = linux_getsockname */
63
	"linux_getpeername",			/* 52 = linux_getpeername */
64
	"linux_socketpair",			/* 53 = linux_socketpair */
65
	"linux_setsockopt",			/* 54 = linux_setsockopt */
66
	"linux_getsockopt",			/* 55 = linux_getsockopt */
67
	"linux_clone",			/* 56 = linux_clone */
68
	"linux_fork",			/* 57 = linux_fork */
69
	"linux_vfork",			/* 58 = linux_vfork */
70
	"linux_execve",			/* 59 = linux_execve */
71
	"linux_exit",			/* 60 = linux_exit */
72
	"linux_wait4",			/* 61 = linux_wait4 */
73
	"linux_kill",			/* 62 = linux_kill */
74
	"linux_newuname",			/* 63 = linux_newuname */
75
	"linux_semget",			/* 64 = linux_semget */
76
	"linux_semop",			/* 65 = linux_semop */
77
	"linux_semctl",			/* 66 = linux_semctl */
78
	"linux_shmdt",			/* 67 = linux_shmdt */
79
	"linux_msgget",			/* 68 = linux_msgget */
80
	"linux_msgsnd",			/* 69 = linux_msgsnd */
81
	"linux_msgrcv",			/* 70 = linux_msgrcv */
82
	"linux_msgctl",			/* 71 = linux_msgctl */
83
	"linux_fcntl",			/* 72 = linux_fcntl */
84
	"flock",			/* 73 = flock */
85
	"fsync",			/* 74 = fsync */
86
	"linux_fdatasync",			/* 75 = linux_fdatasync */
87
	"linux_truncate",			/* 76 = linux_truncate */
88
	"linux_ftruncate",			/* 77 = linux_ftruncate */
89
	"linux_getdents",			/* 78 = linux_getdents */
90
	"linux_getcwd",			/* 79 = linux_getcwd */
91
	"linux_chdir",			/* 80 = linux_chdir */
92
	"fchdir",			/* 81 = fchdir */
93
	"linux_rename",			/* 82 = linux_rename */
94
	"linux_mkdir",			/* 83 = linux_mkdir */
95
	"linux_rmdir",			/* 84 = linux_rmdir */
96
	"linux_creat",			/* 85 = linux_creat */
97
	"linux_link",			/* 86 = linux_link */
98
	"linux_unlink",			/* 87 = linux_unlink */
99
	"linux_symlink",			/* 88 = linux_symlink */
100
	"linux_readlink",			/* 89 = linux_readlink */
101
	"linux_chmod",			/* 90 = linux_chmod */
102
	"fchmod",			/* 91 = fchmod */
103
	"linux_chown",			/* 92 = linux_chown */
104
	"fchown",			/* 93 = fchown */
105
	"linux_lchown",			/* 94 = linux_lchown */
106
	"umask",			/* 95 = umask */
107
	"gettimeofday",			/* 96 = gettimeofday */
108
	"linux_getrlimit",			/* 97 = linux_getrlimit */
109
	"getrusage",			/* 98 = getrusage */
110
	"linux_sysinfo",			/* 99 = linux_sysinfo */
111
	"linux_times",			/* 100 = linux_times */
112
	"linux_ptrace",			/* 101 = linux_ptrace */
113
	"linux_getuid",			/* 102 = linux_getuid */
114
	"linux_syslog",			/* 103 = linux_syslog */
115
	"linux_getgid",			/* 104 = linux_getgid */
116
	"setuid",			/* 105 = setuid */
117
	"setgid",			/* 106 = setgid */
118
	"geteuid",			/* 107 = geteuid */
119
	"getegid",			/* 108 = getegid */
120
	"setpgid",			/* 109 = setpgid */
121
	"linux_getppid",			/* 110 = linux_getppid */
122
	"getpgrp",			/* 111 = getpgrp */
123
	"setsid",			/* 112 = setsid */
124
	"setreuid",			/* 113 = setreuid */
125
	"setregid",			/* 114 = setregid */
126
	"linux_getgroups",			/* 115 = linux_getgroups */
127
	"linux_setgroups",			/* 116 = linux_setgroups */
128
	"setresuid",			/* 117 = setresuid */
129
	"getresuid",			/* 118 = getresuid */
130
	"setresgid",			/* 119 = setresgid */
131
	"getresgid",			/* 120 = getresgid */
132
	"getpgid",			/* 121 = getpgid */
133
	"linux_setfsuid",			/* 122 = linux_setfsuid */
134
	"linux_setfsgid",			/* 123 = linux_setfsgid */
135
	"linux_getsid",			/* 124 = linux_getsid */
136
	"linux_capget",			/* 125 = linux_capget */
137
	"linux_capset",			/* 126 = linux_capset */
138
	"linux_rt_sigpending",			/* 127 = linux_rt_sigpending */
139
	"linux_rt_sigtimedwait",			/* 128 = linux_rt_sigtimedwait */
140
	"linux_rt_sigqueueinfo",			/* 129 = linux_rt_sigqueueinfo */
141
	"linux_rt_sigsuspend",			/* 130 = linux_rt_sigsuspend */
142
	"linux_sigaltstack",			/* 131 = linux_sigaltstack */
143
	"linux_utime",			/* 132 = linux_utime */
144
	"linux_mknod",			/* 133 = linux_mknod */
145
	"#134",			/* 134 = uselib */
146
	"linux_personality",			/* 135 = linux_personality */
147
	"linux_ustat",			/* 136 = linux_ustat */
148
	"linux_statfs",			/* 137 = linux_statfs */
149
	"linux_fstatfs",			/* 138 = linux_fstatfs */
150
	"linux_sysfs",			/* 139 = linux_sysfs */
151
	"linux_getpriority",			/* 140 = linux_getpriority */
152
	"setpriority",			/* 141 = setpriority */
153
	"linux_sched_setparam",			/* 142 = linux_sched_setparam */
154
	"linux_sched_getparam",			/* 143 = linux_sched_getparam */
155
	"linux_sched_setscheduler",			/* 144 = linux_sched_setscheduler */
156
	"linux_sched_getscheduler",			/* 145 = linux_sched_getscheduler */
157
	"linux_sched_get_priority_max",			/* 146 = linux_sched_get_priority_max */
158
	"linux_sched_get_priority_min",			/* 147 = linux_sched_get_priority_min */
159
	"linux_sched_rr_get_interval",			/* 148 = linux_sched_rr_get_interval */
160
	"mlock",			/* 149 = mlock */
161
	"munlock",			/* 150 = munlock */
162
	"mlockall",			/* 151 = mlockall */
163
	"munlockall",			/* 152 = munlockall */
164
	"linux_vhangup",			/* 153 = linux_vhangup */
165
	"#154",			/* 154 = modify_ldt */
166
	"linux_pivot_root",			/* 155 = linux_pivot_root */
167
	"linux_sysctl",			/* 156 = linux_sysctl */
168
	"linux_prctl",			/* 157 = linux_prctl */
169
	"linux_arch_prctl",			/* 158 = linux_arch_prctl */
170
	"linux_adjtimex",			/* 159 = linux_adjtimex */
171
	"linux_setrlimit",			/* 160 = linux_setrlimit */
172
	"chroot",			/* 161 = chroot */
173
	"sync",			/* 162 = sync */
174
	"acct",			/* 163 = acct */
175
	"settimeofday",			/* 164 = settimeofday */
176
	"linux_mount",			/* 165 = linux_mount */
177
	"linux_umount",			/* 166 = linux_umount */
178
	"swapon",			/* 167 = swapon */
179
	"linux_swapoff",			/* 168 = linux_swapoff */
180
	"linux_reboot",			/* 169 = linux_reboot */
181
	"linux_sethostname",			/* 170 = linux_sethostname */
182
	"linux_setdomainname",			/* 171 = linux_setdomainname */
183
	"linux_iopl",			/* 172 = linux_iopl */
184
	"#173",			/* 173 = ioperm */
185
	"linux_create_module",			/* 174 = linux_create_module */
186
	"linux_init_module",			/* 175 = linux_init_module */
187
	"linux_delete_module",			/* 176 = linux_delete_module */
188
	"linux_get_kernel_syms",			/* 177 = linux_get_kernel_syms */
189
	"linux_query_module",			/* 178 = linux_query_module */
190
	"linux_quotactl",			/* 179 = linux_quotactl */
191
	"linux_nfsservctl",			/* 180 = linux_nfsservctl */
192
	"linux_getpmsg",			/* 181 = linux_getpmsg */
193
	"linux_putpmsg",			/* 182 = linux_putpmsg */
194
	"linux_afs_syscall",			/* 183 = linux_afs_syscall */
195
	"linux_tuxcall",			/* 184 = linux_tuxcall */
196
	"linux_security",			/* 185 = linux_security */
197
	"linux_gettid",			/* 186 = linux_gettid */
198
	"#187",			/* 187 = linux_readahead */
199
	"linux_setxattr",			/* 188 = linux_setxattr */
200
	"linux_lsetxattr",			/* 189 = linux_lsetxattr */
201
	"linux_fsetxattr",			/* 190 = linux_fsetxattr */
202
	"linux_getxattr",			/* 191 = linux_getxattr */
203
	"linux_lgetxattr",			/* 192 = linux_lgetxattr */
204
	"linux_fgetxattr",			/* 193 = linux_fgetxattr */
205
	"linux_listxattr",			/* 194 = linux_listxattr */
206
	"linux_llistxattr",			/* 195 = linux_llistxattr */
207
	"linux_flistxattr",			/* 196 = linux_flistxattr */
208
	"linux_removexattr",			/* 197 = linux_removexattr */
209
	"linux_lremovexattr",			/* 198 = linux_lremovexattr */
210
	"linux_fremovexattr",			/* 199 = linux_fremovexattr */
211
	"linux_tkill",			/* 200 = linux_tkill */
212
	"linux_time",			/* 201 = linux_time */
213
	"linux_sys_futex",			/* 202 = linux_sys_futex */
214
	"linux_sched_setaffinity",			/* 203 = linux_sched_setaffinity */
215
	"linux_sched_getaffinity",			/* 204 = linux_sched_getaffinity */
216
	"linux_set_thread_area",			/* 205 = linux_set_thread_area */
217
	"#206",			/* 206 = linux_io_setup */
218
	"#207",			/* 207 = linux_io_destroy */
219
	"#208",			/* 208 = linux_io_getevents */
220
	"#209",			/* 209 = inux_io_submit */
221
	"#210",			/* 210 = linux_io_cancel */
222
	"#211",			/* 211 = linux_get_thread_area */
223
	"linux_lookup_dcookie",			/* 212 = linux_lookup_dcookie */
224
	"linux_epoll_create",			/* 213 = linux_epoll_create */
225
	"linux_epoll_ctl_old",			/* 214 = linux_epoll_ctl_old */
226
	"linux_epoll_wait_old",			/* 215 = linux_epoll_wait_old */
227
	"linux_remap_file_pages",			/* 216 = linux_remap_file_pages */
228
	"linux_getdents64",			/* 217 = linux_getdents64 */
229
	"linux_set_tid_address",			/* 218 = linux_set_tid_address */
230
	"#219",			/* 219 = restart_syscall */
231
	"linux_semtimedop",			/* 220 = linux_semtimedop */
232
	"linux_fadvise64",			/* 221 = linux_fadvise64 */
233
	"linux_timer_create",			/* 222 = linux_timer_create */
234
	"linux_timer_settime",			/* 223 = linux_timer_settime */
235
	"linux_timer_gettime",			/* 224 = linux_timer_gettime */
236
	"linux_timer_getoverrun",			/* 225 = linux_timer_getoverrun */
237
	"linux_timer_delete",			/* 226 = linux_timer_delete */
238
	"linux_clock_settime",			/* 227 = linux_clock_settime */
239
	"linux_clock_gettime",			/* 228 = linux_clock_gettime */
240
	"linux_clock_getres",			/* 229 = linux_clock_getres */
241
	"linux_clock_nanosleep",			/* 230 = linux_clock_nanosleep */
242
	"linux_exit_group",			/* 231 = linux_exit_group */
243
	"linux_epoll_wait",			/* 232 = linux_epoll_wait */
244
	"linux_epoll_ctl",			/* 233 = linux_epoll_ctl */
245
	"linux_tgkill",			/* 234 = linux_tgkill */
246
	"linux_utimes",			/* 235 = linux_utimes */
247
	"#236",			/* 236 = vserver */
248
	"linux_mbind",			/* 237 = linux_mbind */
249
	"linux_set_mempolicy",			/* 238 = linux_set_mempolicy */
250
	"linux_get_mempolicy",			/* 239 = linux_get_mempolicy */
251
	"linux_mq_open",			/* 240 = linux_mq_open */
252
	"linux_mq_unlink",			/* 241 = linux_mq_unlink */
253
	"linux_mq_timedsend",			/* 242 = linux_mq_timedsend */
254
	"linux_mq_timedreceive",			/* 243 = linux_mq_timedreceive */
255
	"linux_mq_notify",			/* 244 = linux_mq_notify */
256
	"linux_mq_getsetattr",			/* 245 = linux_mq_getsetattr */
257
	"linux_kexec_load",			/* 246 = linux_kexec_load */
258
	"linux_waitid",			/* 247 = linux_waitid */
259
	"linux_add_key",			/* 248 = linux_add_key */
260
	"linux_request_key",			/* 249 = linux_request_key */
261
	"linux_keyctl",			/* 250 = linux_keyctl */
262
	"linux_ioprio_set",			/* 251 = linux_ioprio_set */
263
	"linux_ioprio_get",			/* 252 = linux_ioprio_get */
264
	"linux_inotify_init",			/* 253 = linux_inotify_init */
265
	"linux_inotify_add_watch",			/* 254 = linux_inotify_add_watch */
266
	"linux_inotify_rm_watch",			/* 255 = linux_inotify_rm_watch */
267
	"linux_migrate_pages",			/* 256 = linux_migrate_pages */
268
	"linux_openat",			/* 257 = linux_openat */
269
	"linux_mkdirat",			/* 258 = linux_mkdirat */
270
	"linux_mknodat",			/* 259 = linux_mknodat */
271
	"linux_fchownat",			/* 260 = linux_fchownat */
272
	"linux_futimesat",			/* 261 = linux_futimesat */
273
	"linux_newfstatat",			/* 262 = linux_newfstatat */
274
	"linux_unlinkat",			/* 263 = linux_unlinkat */
275
	"linux_renameat",			/* 264 = linux_renameat */
276
	"linux_linkat",			/* 265 = linux_linkat */
277
	"linux_symlinkat",			/* 266 = linux_symlinkat */
278
	"linux_readlinkat",			/* 267 = linux_readlinkat */
279
	"linux_fchmodat",			/* 268 = linux_fchmodat */
280
	"linux_faccessat",			/* 269 = linux_faccessat */
281
	"linux_pselect6",			/* 270 = linux_pselect6 */
282
	"linux_ppoll",			/* 271 = linux_ppoll */
283
	"linux_unshare",			/* 272 = linux_unshare */
284
	"linux_set_robust_list",			/* 273 = linux_set_robust_list */
285
	"linux_get_robust_list",			/* 274 = linux_get_robust_list */
286
	"linux_splice",			/* 275 = linux_splice */
287
	"linux_tee",			/* 276 = linux_tee */
288
	"linux_sync_file_range",			/* 277 = linux_sync_file_range */
289
	"linux_vmsplice",			/* 278 = linux_vmsplice */
290
	"linux_move_pages",			/* 279 = linux_move_pages */
291
	"linux_utimensat",			/* 280 = linux_utimensat */
292
	"linux_epoll_pwait",			/* 281 = linux_epoll_pwait */
293
	"linux_signalfd",			/* 282 = linux_signalfd */
294
	"linux_timerfd",			/* 283 = linux_timerfd */
295
	"linux_eventfd",			/* 284 = linux_eventfd */
296
	"linux_fallocate",			/* 285 = linux_fallocate */
297
	"linux_timerfd_settime",			/* 286 = linux_timerfd_settime */
298
	"linux_timerfd_gettime",			/* 287 = linux_timerfd_gettime */
299
	"linux_accept4",			/* 288 = linux_accept4 */
300
	"linux_signalfd4",			/* 289 = linux_signalfd4 */
301
	"linux_eventfd2",			/* 290 = linux_eventfd2 */
302
	"linux_epoll_create1",			/* 291 = linux_epoll_create1 */
303
	"linux_dup3",			/* 292 = linux_dup3 */
304
	"linux_pipe2",			/* 293 = linux_pipe2 */
305
	"linux_inotify_init1",			/* 294 = linux_inotify_init1 */
306
	"linux_preadv",			/* 295 = linux_preadv */
307
	"linux_pwritev",			/* 296 = linux_pwritev */
308
	"linux_rt_tsigqueueinfo",			/* 297 = linux_rt_tsigqueueinfo */
309
	"linux_perf_event_open",			/* 298 = linux_perf_event_open */
310
	"linux_recvmmsg",			/* 299 = linux_recvmmsg */
311
	"linux_fanotify_init",			/* 300 = linux_fanotify_init */
312
	"linux_fanotify_mark",			/* 301 = linux_fanotify_mark */
313
	"linux_prlimit64",			/* 302 = linux_prlimit64 */
314
	"linux_name_to_handle_at",			/* 303 = linux_name_to_handle_at */
315
	"linux_open_by_handle_at",			/* 304 = linux_open_by_handle_at */
316
	"linux_clock_adjtime",			/* 305 = linux_clock_adjtime */
317
	"linux_syncfs",			/* 306 = linux_syncfs */
318
	"linux_sendmmsg",			/* 307 = linux_sendmmsg */
319
	"linux_setns",			/* 308 = linux_setns */
320
	"linux_process_vm_readv",			/* 309 = linux_process_vm_readv */
321
	"linux_process_vm_writev",			/* 310 = linux_process_vm_writev */
322
	"linux_kcmp",			/* 311 = linux_kcmp */
323
	"linux_finit_module",			/* 312 = linux_finit_module */
324
	"#313",			/* 313 = nosys */
325
};
(-)sys/amd64/linux/linux_sysent.c (+335 lines)
Line 0 Link Here
1
/*
2
 * System call switch table.
3
 *
4
 * DO NOT EDIT-- this file is automatically generated.
5
 * $FreeBSD$
6
 * created from FreeBSD
7
 */
8
9
#include <sys/param.h>
10
#include <sys/sysent.h>
11
#include <sys/sysproto.h>
12
#include <compat/linux/linux_sysproto.h>
13
#include <amd64/linux/linux.h>
14
#include <amd64/linux/linux_proto.h>
15
16
#define AS(name) (sizeof(struct name) / sizeof(register_t))
17
18
/* The casts are bogus but will do for now. */
19
struct sysent linux_sysent[] = {
20
#define	nosys	linux_nosys
21
	{ AS(read_args), (sy_call_t *)sys_read, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 0 = read */
22
	{ AS(write_args), (sy_call_t *)sys_write, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 1 = write */
23
	{ AS(linux_open_args), (sy_call_t *)linux_open, AUE_OPEN_RWTC, NULL, 0, 0, 0, SY_THR_STATIC },	/* 2 = linux_open */
24
	{ AS(close_args), (sy_call_t *)sys_close, AUE_CLOSE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 3 = close */
25
	{ AS(linux_newstat_args), (sy_call_t *)linux_newstat, AUE_STAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 4 = linux_newstat */
26
	{ AS(linux_newfstat_args), (sy_call_t *)linux_newfstat, AUE_FSTAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 5 = linux_newfstat */
27
	{ AS(linux_newlstat_args), (sy_call_t *)linux_newlstat, AUE_LSTAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 6 = linux_newlstat */
28
	{ AS(poll_args), (sy_call_t *)sys_poll, AUE_POLL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 7 = poll */
29
	{ AS(linux_lseek_args), (sy_call_t *)linux_lseek, AUE_LSEEK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 8 = linux_lseek */
30
	{ AS(linux_mmap2_args), (sy_call_t *)linux_mmap2, AUE_MMAP, NULL, 0, 0, 0, SY_THR_STATIC },	/* 9 = linux_mmap2 */
31
	{ AS(linux_mprotect_args), (sy_call_t *)linux_mprotect, AUE_MPROTECT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 10 = linux_mprotect */
32
	{ AS(munmap_args), (sy_call_t *)sys_munmap, AUE_MUNMAP, NULL, 0, 0, 0, SY_THR_STATIC },	/* 11 = munmap */
33
	{ AS(linux_brk_args), (sy_call_t *)linux_brk, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 12 = linux_brk */
34
	{ AS(linux_rt_sigaction_args), (sy_call_t *)linux_rt_sigaction, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 13 = linux_rt_sigaction */
35
	{ AS(linux_rt_sigprocmask_args), (sy_call_t *)linux_rt_sigprocmask, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 14 = linux_rt_sigprocmask */
36
	{ AS(linux_rt_sigreturn_args), (sy_call_t *)linux_rt_sigreturn, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 15 = linux_rt_sigreturn */
37
	{ AS(linux_ioctl_args), (sy_call_t *)linux_ioctl, AUE_IOCTL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 16 = linux_ioctl */
38
	{ AS(linux_pread_args), (sy_call_t *)linux_pread, AUE_PREAD, NULL, 0, 0, 0, SY_THR_STATIC },	/* 17 = linux_pread */
39
	{ AS(linux_pwrite_args), (sy_call_t *)linux_pwrite, AUE_PWRITE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 18 = linux_pwrite */
40
	{ AS(readv_args), (sy_call_t *)sys_readv, AUE_READV, NULL, 0, 0, 0, SY_THR_STATIC },	/* 19 = readv */
41
	{ AS(writev_args), (sy_call_t *)sys_writev, AUE_WRITEV, NULL, 0, 0, 0, SY_THR_STATIC },	/* 20 = writev */
42
	{ AS(linux_access_args), (sy_call_t *)linux_access, AUE_ACCESS, NULL, 0, 0, 0, SY_THR_STATIC },	/* 21 = linux_access */
43
	{ AS(linux_pipe_args), (sy_call_t *)linux_pipe, AUE_PIPE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 22 = linux_pipe */
44
	{ AS(linux_select_args), (sy_call_t *)linux_select, AUE_SELECT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 23 = linux_select */
45
	{ 0, (sy_call_t *)sys_sched_yield, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 24 = sched_yield */
46
	{ AS(linux_mremap_args), (sy_call_t *)linux_mremap, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 25 = linux_mremap */
47
	{ AS(linux_msync_args), (sy_call_t *)linux_msync, AUE_MSYNC, NULL, 0, 0, 0, SY_THR_STATIC },	/* 26 = linux_msync */
48
	{ AS(linux_mincore_args), (sy_call_t *)linux_mincore, AUE_MINCORE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 27 = linux_mincore */
49
	{ AS(madvise_args), (sy_call_t *)sys_madvise, AUE_MADVISE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 28 = madvise */
50
	{ AS(linux_shmget_args), (sy_call_t *)linux_shmget, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 29 = linux_shmget */
51
	{ AS(linux_shmat_args), (sy_call_t *)linux_shmat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 30 = linux_shmat */
52
	{ AS(linux_shmctl_args), (sy_call_t *)linux_shmctl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 31 = linux_shmctl */
53
	{ AS(dup_args), (sy_call_t *)sys_dup, AUE_DUP, NULL, 0, 0, 0, SY_THR_STATIC },	/* 32 = dup */
54
	{ AS(dup2_args), (sy_call_t *)sys_dup2, AUE_DUP2, NULL, 0, 0, 0, SY_THR_STATIC },	/* 33 = dup2 */
55
	{ 0, (sy_call_t *)linux_pause, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 34 = linux_pause */
56
	{ AS(linux_nanosleep_args), (sy_call_t *)linux_nanosleep, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 35 = linux_nanosleep */
57
	{ AS(linux_getitimer_args), (sy_call_t *)linux_getitimer, AUE_GETITIMER, NULL, 0, 0, 0, SY_THR_STATIC },	/* 36 = linux_getitimer */
58
	{ AS(linux_alarm_args), (sy_call_t *)linux_alarm, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 37 = linux_alarm */
59
	{ AS(linux_setitimer_args), (sy_call_t *)linux_setitimer, AUE_SETITIMER, NULL, 0, 0, 0, SY_THR_STATIC },	/* 38 = linux_setitimer */
60
	{ 0, (sy_call_t *)linux_getpid, AUE_GETPID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 39 = linux_getpid */
61
	{ AS(linux_sendfile_args), (sy_call_t *)linux_sendfile, AUE_SENDFILE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 40 = linux_sendfile */
62
	{ AS(linux_socket_args), (sy_call_t *)linux_socket, AUE_SOCKET, NULL, 0, 0, 0, SY_THR_STATIC },	/* 41 = linux_socket */
63
	{ AS(linux_connect_args), (sy_call_t *)linux_connect, AUE_CONNECT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 42 = linux_connect */
64
	{ AS(linux_accept_args), (sy_call_t *)linux_accept, AUE_ACCEPT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 43 = linux_accept */
65
	{ AS(linux_sendto_args), (sy_call_t *)linux_sendto, AUE_SENDTO, NULL, 0, 0, 0, SY_THR_STATIC },	/* 44 = linux_sendto */
66
	{ AS(linux_recvfrom_args), (sy_call_t *)linux_recvfrom, AUE_RECVFROM, NULL, 0, 0, 0, SY_THR_STATIC },	/* 45 = linux_recvfrom */
67
	{ AS(linux_sendmsg_args), (sy_call_t *)linux_sendmsg, AUE_SENDMSG, NULL, 0, 0, 0, SY_THR_STATIC },	/* 46 = linux_sendmsg */
68
	{ AS(linux_recvmsg_args), (sy_call_t *)linux_recvmsg, AUE_RECVMSG, NULL, 0, 0, 0, SY_THR_STATIC },	/* 47 = linux_recvmsg */
69
	{ AS(linux_shutdown_args), (sy_call_t *)linux_shutdown, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 48 = linux_shutdown */
70
	{ AS(linux_bind_args), (sy_call_t *)linux_bind, AUE_BIND, NULL, 0, 0, 0, SY_THR_STATIC },	/* 49 = linux_bind */
71
	{ AS(linux_listen_args), (sy_call_t *)linux_listen, AUE_LISTEN, NULL, 0, 0, 0, SY_THR_STATIC },	/* 50 = linux_listen */
72
	{ AS(linux_getsockname_args), (sy_call_t *)linux_getsockname, AUE_GETSOCKNAME, NULL, 0, 0, 0, SY_THR_STATIC },	/* 51 = linux_getsockname */
73
	{ AS(linux_getpeername_args), (sy_call_t *)linux_getpeername, AUE_GETPEERNAME, NULL, 0, 0, 0, SY_THR_STATIC },	/* 52 = linux_getpeername */
74
	{ AS(linux_socketpair_args), (sy_call_t *)linux_socketpair, AUE_SOCKETPAIR, NULL, 0, 0, 0, SY_THR_STATIC },	/* 53 = linux_socketpair */
75
	{ AS(linux_setsockopt_args), (sy_call_t *)linux_setsockopt, AUE_SETSOCKOPT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 54 = linux_setsockopt */
76
	{ AS(linux_getsockopt_args), (sy_call_t *)linux_getsockopt, AUE_GETSOCKOPT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 55 = linux_getsockopt */
77
	{ AS(linux_clone_args), (sy_call_t *)linux_clone, AUE_RFORK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 56 = linux_clone */
78
	{ 0, (sy_call_t *)linux_fork, AUE_FORK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 57 = linux_fork */
79
	{ 0, (sy_call_t *)linux_vfork, AUE_VFORK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 58 = linux_vfork */
80
	{ AS(linux_execve_args), (sy_call_t *)linux_execve, AUE_EXECVE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 59 = linux_execve */
81
	{ AS(linux_exit_args), (sy_call_t *)linux_exit, AUE_EXIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 60 = linux_exit */
82
	{ AS(linux_wait4_args), (sy_call_t *)linux_wait4, AUE_WAIT4, NULL, 0, 0, 0, SY_THR_STATIC },	/* 61 = linux_wait4 */
83
	{ AS(linux_kill_args), (sy_call_t *)linux_kill, AUE_KILL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 62 = linux_kill */
84
	{ AS(linux_newuname_args), (sy_call_t *)linux_newuname, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 63 = linux_newuname */
85
	{ AS(linux_semget_args), (sy_call_t *)linux_semget, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 64 = linux_semget */
86
	{ AS(linux_semop_args), (sy_call_t *)linux_semop, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 65 = linux_semop */
87
	{ AS(linux_semctl_args), (sy_call_t *)linux_semctl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 66 = linux_semctl */
88
	{ AS(linux_shmdt_args), (sy_call_t *)linux_shmdt, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 67 = linux_shmdt */
89
	{ AS(linux_msgget_args), (sy_call_t *)linux_msgget, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 68 = linux_msgget */
90
	{ AS(linux_msgsnd_args), (sy_call_t *)linux_msgsnd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 69 = linux_msgsnd */
91
	{ AS(linux_msgrcv_args), (sy_call_t *)linux_msgrcv, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 70 = linux_msgrcv */
92
	{ AS(linux_msgctl_args), (sy_call_t *)linux_msgctl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 71 = linux_msgctl */
93
	{ AS(linux_fcntl_args), (sy_call_t *)linux_fcntl, AUE_FCNTL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 72 = linux_fcntl */
94
	{ AS(flock_args), (sy_call_t *)sys_flock, AUE_FLOCK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 73 = flock */
95
	{ AS(fsync_args), (sy_call_t *)sys_fsync, AUE_FSYNC, NULL, 0, 0, 0, SY_THR_STATIC },	/* 74 = fsync */
96
	{ AS(linux_fdatasync_args), (sy_call_t *)linux_fdatasync, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 75 = linux_fdatasync */
97
	{ AS(linux_truncate_args), (sy_call_t *)linux_truncate, AUE_TRUNCATE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 76 = linux_truncate */
98
	{ AS(linux_ftruncate_args), (sy_call_t *)linux_ftruncate, AUE_FTRUNCATE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 77 = linux_ftruncate */
99
	{ AS(linux_getdents_args), (sy_call_t *)linux_getdents, AUE_GETDIRENTRIES, NULL, 0, 0, 0, SY_THR_STATIC },	/* 78 = linux_getdents */
100
	{ AS(linux_getcwd_args), (sy_call_t *)linux_getcwd, AUE_GETCWD, NULL, 0, 0, 0, SY_THR_STATIC },	/* 79 = linux_getcwd */
101
	{ AS(linux_chdir_args), (sy_call_t *)linux_chdir, AUE_CHDIR, NULL, 0, 0, 0, SY_THR_STATIC },	/* 80 = linux_chdir */
102
	{ AS(fchdir_args), (sy_call_t *)sys_fchdir, AUE_FCHDIR, NULL, 0, 0, 0, SY_THR_STATIC },	/* 81 = fchdir */
103
	{ AS(linux_rename_args), (sy_call_t *)linux_rename, AUE_RENAME, NULL, 0, 0, 0, SY_THR_STATIC },	/* 82 = linux_rename */
104
	{ AS(linux_mkdir_args), (sy_call_t *)linux_mkdir, AUE_MKDIR, NULL, 0, 0, 0, SY_THR_STATIC },	/* 83 = linux_mkdir */
105
	{ AS(linux_rmdir_args), (sy_call_t *)linux_rmdir, AUE_RMDIR, NULL, 0, 0, 0, SY_THR_STATIC },	/* 84 = linux_rmdir */
106
	{ AS(linux_creat_args), (sy_call_t *)linux_creat, AUE_CREAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 85 = linux_creat */
107
	{ AS(linux_link_args), (sy_call_t *)linux_link, AUE_LINK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 86 = linux_link */
108
	{ AS(linux_unlink_args), (sy_call_t *)linux_unlink, AUE_UNLINK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 87 = linux_unlink */
109
	{ AS(linux_symlink_args), (sy_call_t *)linux_symlink, AUE_SYMLINK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 88 = linux_symlink */
110
	{ AS(linux_readlink_args), (sy_call_t *)linux_readlink, AUE_READLINK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 89 = linux_readlink */
111
	{ AS(linux_chmod_args), (sy_call_t *)linux_chmod, AUE_CHMOD, NULL, 0, 0, 0, SY_THR_STATIC },	/* 90 = linux_chmod */
112
	{ AS(fchmod_args), (sy_call_t *)sys_fchmod, AUE_FCHMOD, NULL, 0, 0, 0, SY_THR_STATIC },	/* 91 = fchmod */
113
	{ AS(linux_chown_args), (sy_call_t *)linux_chown, AUE_LCHOWN, NULL, 0, 0, 0, SY_THR_STATIC },	/* 92 = linux_chown */
114
	{ AS(fchown_args), (sy_call_t *)sys_fchown, AUE_FCHOWN, NULL, 0, 0, 0, SY_THR_STATIC },	/* 93 = fchown */
115
	{ AS(linux_lchown_args), (sy_call_t *)linux_lchown, AUE_LCHOWN, NULL, 0, 0, 0, SY_THR_STATIC },	/* 94 = linux_lchown */
116
	{ AS(umask_args), (sy_call_t *)sys_umask, AUE_UMASK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 95 = umask */
117
	{ AS(gettimeofday_args), (sy_call_t *)sys_gettimeofday, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 96 = gettimeofday */
118
	{ AS(linux_getrlimit_args), (sy_call_t *)linux_getrlimit, AUE_GETRLIMIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 97 = linux_getrlimit */
119
	{ AS(getrusage_args), (sy_call_t *)sys_getrusage, AUE_GETRUSAGE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 98 = getrusage */
120
	{ AS(linux_sysinfo_args), (sy_call_t *)linux_sysinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 99 = linux_sysinfo */
121
	{ AS(linux_times_args), (sy_call_t *)linux_times, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 100 = linux_times */
122
	{ AS(linux_ptrace_args), (sy_call_t *)linux_ptrace, AUE_PTRACE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 101 = linux_ptrace */
123
	{ 0, (sy_call_t *)linux_getuid, AUE_GETUID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 102 = linux_getuid */
124
	{ AS(linux_syslog_args), (sy_call_t *)linux_syslog, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 103 = linux_syslog */
125
	{ 0, (sy_call_t *)linux_getgid, AUE_GETGID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 104 = linux_getgid */
126
	{ AS(setuid_args), (sy_call_t *)sys_setuid, AUE_SETUID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 105 = setuid */
127
	{ AS(setgid_args), (sy_call_t *)sys_setgid, AUE_SETGID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 106 = setgid */
128
	{ 0, (sy_call_t *)sys_geteuid, AUE_GETEUID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 107 = geteuid */
129
	{ 0, (sy_call_t *)sys_getegid, AUE_GETEGID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 108 = getegid */
130
	{ AS(setpgid_args), (sy_call_t *)sys_setpgid, AUE_SETPGRP, NULL, 0, 0, 0, SY_THR_STATIC },	/* 109 = setpgid */
131
	{ 0, (sy_call_t *)linux_getppid, AUE_GETPPID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 110 = linux_getppid */
132
	{ 0, (sy_call_t *)sys_getpgrp, AUE_GETPGRP, NULL, 0, 0, 0, SY_THR_STATIC },	/* 111 = getpgrp */
133
	{ 0, (sy_call_t *)sys_setsid, AUE_SETSID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 112 = setsid */
134
	{ AS(setreuid_args), (sy_call_t *)sys_setreuid, AUE_SETREUID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 113 = setreuid */
135
	{ AS(setregid_args), (sy_call_t *)sys_setregid, AUE_SETREGID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 114 = setregid */
136
	{ AS(linux_getgroups_args), (sy_call_t *)linux_getgroups, AUE_GETGROUPS, NULL, 0, 0, 0, SY_THR_STATIC },	/* 115 = linux_getgroups */
137
	{ AS(linux_setgroups_args), (sy_call_t *)linux_setgroups, AUE_SETGROUPS, NULL, 0, 0, 0, SY_THR_STATIC },	/* 116 = linux_setgroups */
138
	{ AS(setresuid_args), (sy_call_t *)sys_setresuid, AUE_SETRESUID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 117 = setresuid */
139
	{ AS(getresuid_args), (sy_call_t *)sys_getresuid, AUE_GETRESUID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 118 = getresuid */
140
	{ AS(setresgid_args), (sy_call_t *)sys_setresgid, AUE_SETRESGID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 119 = setresgid */
141
	{ AS(getresgid_args), (sy_call_t *)sys_getresgid, AUE_GETRESGID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 120 = getresgid */
142
	{ AS(getpgid_args), (sy_call_t *)sys_getpgid, AUE_GETPGID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 121 = getpgid */
143
	{ AS(linux_setfsuid_args), (sy_call_t *)linux_setfsuid, AUE_SETFSUID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 122 = linux_setfsuid */
144
	{ AS(linux_setfsgid_args), (sy_call_t *)linux_setfsgid, AUE_SETFSGID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 123 = linux_setfsgid */
145
	{ AS(linux_getsid_args), (sy_call_t *)linux_getsid, AUE_GETSID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 124 = linux_getsid */
146
	{ AS(linux_capget_args), (sy_call_t *)linux_capget, AUE_CAPGET, NULL, 0, 0, 0, SY_THR_STATIC },	/* 125 = linux_capget */
147
	{ AS(linux_capset_args), (sy_call_t *)linux_capset, AUE_CAPSET, NULL, 0, 0, 0, SY_THR_STATIC },	/* 126 = linux_capset */
148
	{ AS(linux_rt_sigpending_args), (sy_call_t *)linux_rt_sigpending, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 127 = linux_rt_sigpending */
149
	{ AS(linux_rt_sigtimedwait_args), (sy_call_t *)linux_rt_sigtimedwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 128 = linux_rt_sigtimedwait */
150
	{ AS(linux_rt_sigqueueinfo_args), (sy_call_t *)linux_rt_sigqueueinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 129 = linux_rt_sigqueueinfo */
151
	{ AS(linux_rt_sigsuspend_args), (sy_call_t *)linux_rt_sigsuspend, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 130 = linux_rt_sigsuspend */
152
	{ AS(linux_sigaltstack_args), (sy_call_t *)linux_sigaltstack, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 131 = linux_sigaltstack */
153
	{ AS(linux_utime_args), (sy_call_t *)linux_utime, AUE_UTIME, NULL, 0, 0, 0, SY_THR_STATIC },	/* 132 = linux_utime */
154
	{ AS(linux_mknod_args), (sy_call_t *)linux_mknod, AUE_MKNOD, NULL, 0, 0, 0, SY_THR_STATIC },	/* 133 = linux_mknod */
155
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 134 = uselib */
156
	{ AS(linux_personality_args), (sy_call_t *)linux_personality, AUE_PERSONALITY, NULL, 0, 0, 0, SY_THR_STATIC },	/* 135 = linux_personality */
157
	{ AS(linux_ustat_args), (sy_call_t *)linux_ustat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 136 = linux_ustat */
158
	{ AS(linux_statfs_args), (sy_call_t *)linux_statfs, AUE_STATFS, NULL, 0, 0, 0, SY_THR_STATIC },	/* 137 = linux_statfs */
159
	{ AS(linux_fstatfs_args), (sy_call_t *)linux_fstatfs, AUE_FSTATFS, NULL, 0, 0, 0, SY_THR_STATIC },	/* 138 = linux_fstatfs */
160
	{ AS(linux_sysfs_args), (sy_call_t *)linux_sysfs, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 139 = linux_sysfs */
161
	{ AS(linux_getpriority_args), (sy_call_t *)linux_getpriority, AUE_GETPRIORITY, NULL, 0, 0, 0, SY_THR_STATIC },	/* 140 = linux_getpriority */
162
	{ AS(setpriority_args), (sy_call_t *)sys_setpriority, AUE_SETPRIORITY, NULL, 0, 0, 0, SY_THR_STATIC },	/* 141 = setpriority */
163
	{ AS(linux_sched_setparam_args), (sy_call_t *)linux_sched_setparam, AUE_SCHED_SETPARAM, NULL, 0, 0, 0, SY_THR_STATIC },	/* 142 = linux_sched_setparam */
164
	{ AS(linux_sched_getparam_args), (sy_call_t *)linux_sched_getparam, AUE_SCHED_GETPARAM, NULL, 0, 0, 0, SY_THR_STATIC },	/* 143 = linux_sched_getparam */
165
	{ AS(linux_sched_setscheduler_args), (sy_call_t *)linux_sched_setscheduler, AUE_SCHED_SETSCHEDULER, NULL, 0, 0, 0, SY_THR_STATIC },	/* 144 = linux_sched_setscheduler */
166
	{ AS(linux_sched_getscheduler_args), (sy_call_t *)linux_sched_getscheduler, AUE_SCHED_GETSCHEDULER, NULL, 0, 0, 0, SY_THR_STATIC },	/* 145 = linux_sched_getscheduler */
167
	{ AS(linux_sched_get_priority_max_args), (sy_call_t *)linux_sched_get_priority_max, AUE_SCHED_GET_PRIORITY_MAX, NULL, 0, 0, 0, SY_THR_STATIC },	/* 146 = linux_sched_get_priority_max */
168
	{ AS(linux_sched_get_priority_min_args), (sy_call_t *)linux_sched_get_priority_min, AUE_SCHED_GET_PRIORITY_MIN, NULL, 0, 0, 0, SY_THR_STATIC },	/* 147 = linux_sched_get_priority_min */
169
	{ AS(linux_sched_rr_get_interval_args), (sy_call_t *)linux_sched_rr_get_interval, AUE_SCHED_RR_GET_INTERVAL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 148 = linux_sched_rr_get_interval */
170
	{ AS(mlock_args), (sy_call_t *)sys_mlock, AUE_MLOCK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 149 = mlock */
171
	{ AS(munlock_args), (sy_call_t *)sys_munlock, AUE_MUNLOCK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 150 = munlock */
172
	{ AS(mlockall_args), (sy_call_t *)sys_mlockall, AUE_MLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 151 = mlockall */
173
	{ 0, (sy_call_t *)sys_munlockall, AUE_MUNLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 152 = munlockall */
174
	{ 0, (sy_call_t *)linux_vhangup, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 153 = linux_vhangup */
175
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 154 = modify_ldt */
176
	{ 0, (sy_call_t *)linux_pivot_root, AUE_PIVOT_ROOT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 155 = linux_pivot_root */
177
	{ AS(linux_sysctl_args), (sy_call_t *)linux_sysctl, AUE_SYSCTL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 156 = linux_sysctl */
178
	{ AS(linux_prctl_args), (sy_call_t *)linux_prctl, AUE_PRCTL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 157 = linux_prctl */
179
	{ AS(linux_arch_prctl_args), (sy_call_t *)linux_arch_prctl, AUE_PRCTL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 158 = linux_arch_prctl */
180
	{ 0, (sy_call_t *)linux_adjtimex, AUE_ADJTIME, NULL, 0, 0, 0, SY_THR_STATIC },	/* 159 = linux_adjtimex */
181
	{ AS(linux_setrlimit_args), (sy_call_t *)linux_setrlimit, AUE_SETRLIMIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 160 = linux_setrlimit */
182
	{ AS(chroot_args), (sy_call_t *)sys_chroot, AUE_CHROOT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 161 = chroot */
183
	{ 0, (sy_call_t *)sys_sync, AUE_SYNC, NULL, 0, 0, 0, SY_THR_STATIC },		/* 162 = sync */
184
	{ AS(acct_args), (sy_call_t *)sys_acct, AUE_ACCT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 163 = acct */
185
	{ AS(settimeofday_args), (sy_call_t *)sys_settimeofday, AUE_SETTIMEOFDAY, NULL, 0, 0, 0, SY_THR_STATIC },	/* 164 = settimeofday */
186
	{ AS(linux_mount_args), (sy_call_t *)linux_mount, AUE_MOUNT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 165 = linux_mount */
187
	{ AS(linux_umount_args), (sy_call_t *)linux_umount, AUE_UMOUNT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 166 = linux_umount */
188
	{ AS(swapon_args), (sy_call_t *)sys_swapon, AUE_SWAPON, NULL, 0, 0, 0, SY_THR_STATIC },	/* 167 = swapon */
189
	{ 0, (sy_call_t *)linux_swapoff, AUE_SWAPOFF, NULL, 0, 0, 0, SY_THR_STATIC },	/* 168 = linux_swapoff */
190
	{ AS(linux_reboot_args), (sy_call_t *)linux_reboot, AUE_REBOOT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 169 = linux_reboot */
191
	{ AS(linux_sethostname_args), (sy_call_t *)linux_sethostname, AUE_SYSCTL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 170 = linux_sethostname */
192
	{ AS(linux_setdomainname_args), (sy_call_t *)linux_setdomainname, AUE_SYSCTL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 171 = linux_setdomainname */
193
	{ AS(linux_iopl_args), (sy_call_t *)linux_iopl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 172 = linux_iopl */
194
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 173 = ioperm */
195
	{ 0, (sy_call_t *)linux_create_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 174 = linux_create_module */
196
	{ 0, (sy_call_t *)linux_init_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 175 = linux_init_module */
197
	{ 0, (sy_call_t *)linux_delete_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 176 = linux_delete_module */
198
	{ 0, (sy_call_t *)linux_get_kernel_syms, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 177 = linux_get_kernel_syms */
199
	{ 0, (sy_call_t *)linux_query_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 178 = linux_query_module */
200
	{ 0, (sy_call_t *)linux_quotactl, AUE_QUOTACTL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 179 = linux_quotactl */
201
	{ 0, (sy_call_t *)linux_nfsservctl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 180 = linux_nfsservctl */
202
	{ 0, (sy_call_t *)linux_getpmsg, AUE_GETPMSG, NULL, 0, 0, 0, SY_THR_STATIC },	/* 181 = linux_getpmsg */
203
	{ 0, (sy_call_t *)linux_putpmsg, AUE_PUTPMSG, NULL, 0, 0, 0, SY_THR_STATIC },	/* 182 = linux_putpmsg */
204
	{ 0, (sy_call_t *)linux_afs_syscall, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 183 = linux_afs_syscall */
205
	{ 0, (sy_call_t *)linux_tuxcall, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 184 = linux_tuxcall */
206
	{ 0, (sy_call_t *)linux_security, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 185 = linux_security */
207
	{ 0, (sy_call_t *)linux_gettid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 186 = linux_gettid */
208
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 187 = linux_readahead */
209
	{ 0, (sy_call_t *)linux_setxattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 188 = linux_setxattr */
210
	{ 0, (sy_call_t *)linux_lsetxattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 189 = linux_lsetxattr */
211
	{ 0, (sy_call_t *)linux_fsetxattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 190 = linux_fsetxattr */
212
	{ 0, (sy_call_t *)linux_getxattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 191 = linux_getxattr */
213
	{ 0, (sy_call_t *)linux_lgetxattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 192 = linux_lgetxattr */
214
	{ 0, (sy_call_t *)linux_fgetxattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 193 = linux_fgetxattr */
215
	{ 0, (sy_call_t *)linux_listxattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 194 = linux_listxattr */
216
	{ 0, (sy_call_t *)linux_llistxattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 195 = linux_llistxattr */
217
	{ 0, (sy_call_t *)linux_flistxattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 196 = linux_flistxattr */
218
	{ 0, (sy_call_t *)linux_removexattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 197 = linux_removexattr */
219
	{ 0, (sy_call_t *)linux_lremovexattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 198 = linux_lremovexattr */
220
	{ 0, (sy_call_t *)linux_fremovexattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 199 = linux_fremovexattr */
221
	{ AS(linux_tkill_args), (sy_call_t *)linux_tkill, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 200 = linux_tkill */
222
	{ AS(linux_time_args), (sy_call_t *)linux_time, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 201 = linux_time */
223
	{ AS(linux_sys_futex_args), (sy_call_t *)linux_sys_futex, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 202 = linux_sys_futex */
224
	{ AS(linux_sched_setaffinity_args), (sy_call_t *)linux_sched_setaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 203 = linux_sched_setaffinity */
225
	{ AS(linux_sched_getaffinity_args), (sy_call_t *)linux_sched_getaffinity, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 204 = linux_sched_getaffinity */
226
	{ 0, (sy_call_t *)linux_set_thread_area, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 205 = linux_set_thread_area */
227
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 206 = linux_io_setup */
228
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 207 = linux_io_destroy */
229
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 208 = linux_io_getevents */
230
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 209 = inux_io_submit */
231
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 210 = linux_io_cancel */
232
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 211 = linux_get_thread_area */
233
	{ 0, (sy_call_t *)linux_lookup_dcookie, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 212 = linux_lookup_dcookie */
234
	{ AS(linux_epoll_create_args), (sy_call_t *)linux_epoll_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 213 = linux_epoll_create */
235
	{ 0, (sy_call_t *)linux_epoll_ctl_old, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 214 = linux_epoll_ctl_old */
236
	{ 0, (sy_call_t *)linux_epoll_wait_old, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 215 = linux_epoll_wait_old */
237
	{ 0, (sy_call_t *)linux_remap_file_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 216 = linux_remap_file_pages */
238
	{ AS(linux_getdents64_args), (sy_call_t *)linux_getdents64, AUE_GETDIRENTRIES, NULL, 0, 0, 0, SY_THR_STATIC },	/* 217 = linux_getdents64 */
239
	{ AS(linux_set_tid_address_args), (sy_call_t *)linux_set_tid_address, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 218 = linux_set_tid_address */
240
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 219 = restart_syscall */
241
	{ 0, (sy_call_t *)linux_semtimedop, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 220 = linux_semtimedop */
242
	{ AS(linux_fadvise64_args), (sy_call_t *)linux_fadvise64, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 221 = linux_fadvise64 */
243
	{ AS(linux_timer_create_args), (sy_call_t *)linux_timer_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 222 = linux_timer_create */
244
	{ AS(linux_timer_settime_args), (sy_call_t *)linux_timer_settime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 223 = linux_timer_settime */
245
	{ AS(linux_timer_gettime_args), (sy_call_t *)linux_timer_gettime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 224 = linux_timer_gettime */
246
	{ AS(linux_timer_getoverrun_args), (sy_call_t *)linux_timer_getoverrun, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 225 = linux_timer_getoverrun */
247
	{ AS(linux_timer_delete_args), (sy_call_t *)linux_timer_delete, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 226 = linux_timer_delete */
248
	{ AS(linux_clock_settime_args), (sy_call_t *)linux_clock_settime, AUE_CLOCK_SETTIME, NULL, 0, 0, 0, SY_THR_STATIC },	/* 227 = linux_clock_settime */
249
	{ AS(linux_clock_gettime_args), (sy_call_t *)linux_clock_gettime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 228 = linux_clock_gettime */
250
	{ AS(linux_clock_getres_args), (sy_call_t *)linux_clock_getres, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 229 = linux_clock_getres */
251
	{ AS(linux_clock_nanosleep_args), (sy_call_t *)linux_clock_nanosleep, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 230 = linux_clock_nanosleep */
252
	{ AS(linux_exit_group_args), (sy_call_t *)linux_exit_group, AUE_EXIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 231 = linux_exit_group */
253
	{ AS(linux_epoll_wait_args), (sy_call_t *)linux_epoll_wait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 232 = linux_epoll_wait */
254
	{ AS(linux_epoll_ctl_args), (sy_call_t *)linux_epoll_ctl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 233 = linux_epoll_ctl */
255
	{ AS(linux_tgkill_args), (sy_call_t *)linux_tgkill, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 234 = linux_tgkill */
256
	{ AS(linux_utimes_args), (sy_call_t *)linux_utimes, AUE_UTIMES, NULL, 0, 0, 0, SY_THR_STATIC },	/* 235 = linux_utimes */
257
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 236 = vserver */
258
	{ 0, (sy_call_t *)linux_mbind, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 237 = linux_mbind */
259
	{ 0, (sy_call_t *)linux_set_mempolicy, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 238 = linux_set_mempolicy */
260
	{ 0, (sy_call_t *)linux_get_mempolicy, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 239 = linux_get_mempolicy */
261
	{ 0, (sy_call_t *)linux_mq_open, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 240 = linux_mq_open */
262
	{ 0, (sy_call_t *)linux_mq_unlink, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 241 = linux_mq_unlink */
263
	{ 0, (sy_call_t *)linux_mq_timedsend, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 242 = linux_mq_timedsend */
264
	{ 0, (sy_call_t *)linux_mq_timedreceive, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 243 = linux_mq_timedreceive */
265
	{ 0, (sy_call_t *)linux_mq_notify, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 244 = linux_mq_notify */
266
	{ 0, (sy_call_t *)linux_mq_getsetattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 245 = linux_mq_getsetattr */
267
	{ 0, (sy_call_t *)linux_kexec_load, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 246 = linux_kexec_load */
268
	{ AS(linux_waitid_args), (sy_call_t *)linux_waitid, AUE_WAIT6, NULL, 0, 0, 0, SY_THR_STATIC },	/* 247 = linux_waitid */
269
	{ 0, (sy_call_t *)linux_add_key, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 248 = linux_add_key */
270
	{ 0, (sy_call_t *)linux_request_key, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 249 = linux_request_key */
271
	{ 0, (sy_call_t *)linux_keyctl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 250 = linux_keyctl */
272
	{ 0, (sy_call_t *)linux_ioprio_set, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 251 = linux_ioprio_set */
273
	{ 0, (sy_call_t *)linux_ioprio_get, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 252 = linux_ioprio_get */
274
	{ 0, (sy_call_t *)linux_inotify_init, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 253 = linux_inotify_init */
275
	{ 0, (sy_call_t *)linux_inotify_add_watch, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 254 = linux_inotify_add_watch */
276
	{ 0, (sy_call_t *)linux_inotify_rm_watch, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 255 = linux_inotify_rm_watch */
277
	{ 0, (sy_call_t *)linux_migrate_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 256 = linux_migrate_pages */
278
	{ AS(linux_openat_args), (sy_call_t *)linux_openat, AUE_OPEN_RWTC, NULL, 0, 0, 0, SY_THR_STATIC },	/* 257 = linux_openat */
279
	{ AS(linux_mkdirat_args), (sy_call_t *)linux_mkdirat, AUE_MKDIRAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 258 = linux_mkdirat */
280
	{ AS(linux_mknodat_args), (sy_call_t *)linux_mknodat, AUE_MKNODAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 259 = linux_mknodat */
281
	{ AS(linux_fchownat_args), (sy_call_t *)linux_fchownat, AUE_FCHOWNAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 260 = linux_fchownat */
282
	{ AS(linux_futimesat_args), (sy_call_t *)linux_futimesat, AUE_FUTIMESAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 261 = linux_futimesat */
283
	{ AS(linux_newfstatat_args), (sy_call_t *)linux_newfstatat, AUE_FSTATAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 262 = linux_newfstatat */
284
	{ AS(linux_unlinkat_args), (sy_call_t *)linux_unlinkat, AUE_UNLINKAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 263 = linux_unlinkat */
285
	{ AS(linux_renameat_args), (sy_call_t *)linux_renameat, AUE_RENAMEAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 264 = linux_renameat */
286
	{ AS(linux_linkat_args), (sy_call_t *)linux_linkat, AUE_LINKAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 265 = linux_linkat */
287
	{ AS(linux_symlinkat_args), (sy_call_t *)linux_symlinkat, AUE_SYMLINKAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 266 = linux_symlinkat */
288
	{ AS(linux_readlinkat_args), (sy_call_t *)linux_readlinkat, AUE_READLINKAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 267 = linux_readlinkat */
289
	{ AS(linux_fchmodat_args), (sy_call_t *)linux_fchmodat, AUE_FCHMODAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 268 = linux_fchmodat */
290
	{ AS(linux_faccessat_args), (sy_call_t *)linux_faccessat, AUE_FACCESSAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 269 = linux_faccessat */
291
	{ AS(linux_pselect6_args), (sy_call_t *)linux_pselect6, AUE_SELECT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 270 = linux_pselect6 */
292
	{ AS(linux_ppoll_args), (sy_call_t *)linux_ppoll, AUE_POLL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 271 = linux_ppoll */
293
	{ 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 272 = linux_unshare */
294
	{ AS(linux_set_robust_list_args), (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 273 = linux_set_robust_list */
295
	{ AS(linux_get_robust_list_args), (sy_call_t *)linux_get_robust_list, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 274 = linux_get_robust_list */
296
	{ 0, (sy_call_t *)linux_splice, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 275 = linux_splice */
297
	{ 0, (sy_call_t *)linux_tee, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },		/* 276 = linux_tee */
298
	{ 0, (sy_call_t *)linux_sync_file_range, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 277 = linux_sync_file_range */
299
	{ 0, (sy_call_t *)linux_vmsplice, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 278 = linux_vmsplice */
300
	{ 0, (sy_call_t *)linux_move_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 279 = linux_move_pages */
301
	{ AS(linux_utimensat_args), (sy_call_t *)linux_utimensat, AUE_FUTIMESAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 280 = linux_utimensat */
302
	{ AS(linux_epoll_pwait_args), (sy_call_t *)linux_epoll_pwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 281 = linux_epoll_pwait */
303
	{ 0, (sy_call_t *)linux_signalfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 282 = linux_signalfd */
304
	{ 0, (sy_call_t *)linux_timerfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 283 = linux_timerfd */
305
	{ AS(linux_eventfd_args), (sy_call_t *)linux_eventfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 284 = linux_eventfd */
306
	{ AS(linux_fallocate_args), (sy_call_t *)linux_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 285 = linux_fallocate */
307
	{ 0, (sy_call_t *)linux_timerfd_settime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 286 = linux_timerfd_settime */
308
	{ 0, (sy_call_t *)linux_timerfd_gettime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 287 = linux_timerfd_gettime */
309
	{ AS(linux_accept4_args), (sy_call_t *)linux_accept4, AUE_ACCEPT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 288 = linux_accept4 */
310
	{ 0, (sy_call_t *)linux_signalfd4, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 289 = linux_signalfd4 */
311
	{ AS(linux_eventfd2_args), (sy_call_t *)linux_eventfd2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 290 = linux_eventfd2 */
312
	{ AS(linux_epoll_create1_args), (sy_call_t *)linux_epoll_create1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 291 = linux_epoll_create1 */
313
	{ AS(linux_dup3_args), (sy_call_t *)linux_dup3, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 292 = linux_dup3 */
314
	{ AS(linux_pipe2_args), (sy_call_t *)linux_pipe2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 293 = linux_pipe2 */
315
	{ 0, (sy_call_t *)linux_inotify_init1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 294 = linux_inotify_init1 */
316
	{ 0, (sy_call_t *)linux_preadv, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 295 = linux_preadv */
317
	{ 0, (sy_call_t *)linux_pwritev, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 296 = linux_pwritev */
318
	{ 0, (sy_call_t *)linux_rt_tsigqueueinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 297 = linux_rt_tsigqueueinfo */
319
	{ 0, (sy_call_t *)linux_perf_event_open, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 298 = linux_perf_event_open */
320
	{ AS(linux_recvmmsg_args), (sy_call_t *)linux_recvmmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 299 = linux_recvmmsg */
321
	{ 0, (sy_call_t *)linux_fanotify_init, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 300 = linux_fanotify_init */
322
	{ 0, (sy_call_t *)linux_fanotify_mark, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 301 = linux_fanotify_mark */
323
	{ AS(linux_prlimit64_args), (sy_call_t *)linux_prlimit64, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 302 = linux_prlimit64 */
324
	{ 0, (sy_call_t *)linux_name_to_handle_at, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 303 = linux_name_to_handle_at */
325
	{ 0, (sy_call_t *)linux_open_by_handle_at, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 304 = linux_open_by_handle_at */
326
	{ 0, (sy_call_t *)linux_clock_adjtime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 305 = linux_clock_adjtime */
327
	{ AS(linux_syncfs_args), (sy_call_t *)linux_syncfs, AUE_SYNC, NULL, 0, 0, 0, SY_THR_STATIC },	/* 306 = linux_syncfs */
328
	{ AS(linux_sendmmsg_args), (sy_call_t *)linux_sendmmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 307 = linux_sendmmsg */
329
	{ 0, (sy_call_t *)linux_setns, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 308 = linux_setns */
330
	{ 0, (sy_call_t *)linux_process_vm_readv, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 309 = linux_process_vm_readv */
331
	{ 0, (sy_call_t *)linux_process_vm_writev, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 310 = linux_process_vm_writev */
332
	{ 0, (sy_call_t *)linux_kcmp, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 311 = linux_kcmp */
333
	{ 0, (sy_call_t *)linux_finit_module, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 312 = linux_finit_module */
334
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 313 = nosys */
335
};
(-)sys/amd64/linux/linux_systrace_args.c (+6885 lines)
Line 0 Link Here
1
/*
2
 * System call argument to DTrace register array converstion.
3
 *
4
 * DO NOT EDIT-- this file is automatically generated.
5
 * $FreeBSD$
6
 * This file is part of the DTrace syscall provider.
7
 */
8
9
static void
10
systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
11
{
12
	int64_t *iarg  = (int64_t *) uarg;
13
	switch (sysnum) {
14
#define	nosys	linux_nosys
15
	/* read */
16
	case 0: {
17
		struct read_args *p = params;
18
		iarg[0] = p->fd; /* int */
19
		uarg[1] = (intptr_t) p->buf; /* char * */
20
		uarg[2] = p->nbyte; /* u_int */
21
		*n_args = 3;
22
		break;
23
	}
24
	/* write */
25
	case 1: {
26
		struct write_args *p = params;
27
		iarg[0] = p->fd; /* int */
28
		uarg[1] = (intptr_t) p->buf; /* char * */
29
		uarg[2] = p->nbyte; /* u_int */
30
		*n_args = 3;
31
		break;
32
	}
33
	/* linux_open */
34
	case 2: {
35
		struct linux_open_args *p = params;
36
		uarg[0] = (intptr_t) p->path; /* char * */
37
		iarg[1] = p->flags; /* l_int */
38
		iarg[2] = p->mode; /* l_int */
39
		*n_args = 3;
40
		break;
41
	}
42
	/* close */
43
	case 3: {
44
		struct close_args *p = params;
45
		iarg[0] = p->fd; /* int */
46
		*n_args = 1;
47
		break;
48
	}
49
	/* linux_newstat */
50
	case 4: {
51
		struct linux_newstat_args *p = params;
52
		uarg[0] = (intptr_t) p->path; /* char * */
53
		uarg[1] = (intptr_t) p->buf; /* struct l_newstat * */
54
		*n_args = 2;
55
		break;
56
	}
57
	/* linux_newfstat */
58
	case 5: {
59
		struct linux_newfstat_args *p = params;
60
		iarg[0] = p->fd; /* l_uint */
61
		uarg[1] = (intptr_t) p->buf; /* struct l_newstat * */
62
		*n_args = 2;
63
		break;
64
	}
65
	/* linux_newlstat */
66
	case 6: {
67
		struct linux_newlstat_args *p = params;
68
		uarg[0] = (intptr_t) p->path; /* char * */
69
		uarg[1] = (intptr_t) p->buf; /* struct l_newstat * */
70
		*n_args = 2;
71
		break;
72
	}
73
	/* poll */
74
	case 7: {
75
		struct poll_args *p = params;
76
		iarg[0] = p->*; /* struct pollfd */
77
		uarg[1] = p->nfds; /* unsigned int */
78
		iarg[2] = p->timeout; /* int */
79
		*n_args = 3;
80
		break;
81
	}
82
	/* linux_lseek */
83
	case 8: {
84
		struct linux_lseek_args *p = params;
85
		iarg[0] = p->fdes; /* l_uint */
86
		iarg[1] = p->off; /* l_off_t */
87
		iarg[2] = p->whence; /* l_int */
88
		*n_args = 3;
89
		break;
90
	}
91
	/* linux_mmap2 */
92
	case 9: {
93
		struct linux_mmap2_args *p = params;
94
		iarg[0] = p->addr; /* l_ulong */
95
		iarg[1] = p->len; /* l_ulong */
96
		iarg[2] = p->prot; /* l_ulong */
97
		iarg[3] = p->flags; /* l_ulong */
98
		iarg[4] = p->fd; /* l_ulong */
99
		iarg[5] = p->pgoff; /* l_ulong */
100
		*n_args = 6;
101
		break;
102
	}
103
	/* linux_mprotect */
104
	case 10: {
105
		struct linux_mprotect_args *p = params;
106
		uarg[0] = (intptr_t) p->addr; /* caddr_t */
107
		iarg[1] = p->len; /* int */
108
		iarg[2] = p->prot; /* int */
109
		*n_args = 3;
110
		break;
111
	}
112
	/* munmap */
113
	case 11: {
114
		struct munmap_args *p = params;
115
		uarg[0] = (intptr_t) p->addr; /* caddr_t */
116
		iarg[1] = p->len; /* int */
117
		*n_args = 2;
118
		break;
119
	}
120
	/* linux_brk */
121
	case 12: {
122
		struct linux_brk_args *p = params;
123
		iarg[0] = p->dsend; /* l_ulong */
124
		*n_args = 1;
125
		break;
126
	}
127
	/* linux_rt_sigaction */
128
	case 13: {
129
		struct linux_rt_sigaction_args *p = params;
130
		iarg[0] = p->sig; /* l_int */
131
		uarg[1] = (intptr_t) p->act; /* l_sigaction_t * */
132
		uarg[2] = (intptr_t) p->oact; /* l_sigaction_t * */
133
		iarg[3] = p->sigsetsize; /* l_size_t */
134
		*n_args = 4;
135
		break;
136
	}
137
	/* linux_rt_sigprocmask */
138
	case 14: {
139
		struct linux_rt_sigprocmask_args *p = params;
140
		iarg[0] = p->how; /* l_int */
141
		uarg[1] = (intptr_t) p->mask; /* l_sigset_t * */
142
		uarg[2] = (intptr_t) p->omask; /* l_sigset_t * */
143
		iarg[3] = p->sigsetsize; /* l_size_t */
144
		*n_args = 4;
145
		break;
146
	}
147
	/* linux_rt_sigreturn */
148
	case 15: {
149
		struct linux_rt_sigreturn_args *p = params;
150
		uarg[0] = (intptr_t) p->ucp; /* struct l_ucontext * */
151
		*n_args = 1;
152
		break;
153
	}
154
	/* linux_ioctl */
155
	case 16: {
156
		struct linux_ioctl_args *p = params;
157
		iarg[0] = p->fd; /* l_uint */
158
		iarg[1] = p->cmd; /* l_uint */
159
		uarg[2] = p->arg; /* uintptr_t */
160
		*n_args = 3;
161
		break;
162
	}
163
	/* linux_pread */
164
	case 17: {
165
		struct linux_pread_args *p = params;
166
		iarg[0] = p->fd; /* l_uint */
167
		uarg[1] = (intptr_t) p->buf; /* char * */
168
		iarg[2] = p->nbyte; /* l_size_t */
169
		iarg[3] = p->offset; /* l_loff_t */
170
		*n_args = 4;
171
		break;
172
	}
173
	/* linux_pwrite */
174
	case 18: {
175
		struct linux_pwrite_args *p = params;
176
		iarg[0] = p->fd; /* l_uint */
177
		uarg[1] = (intptr_t) p->buf; /* char * */
178
		iarg[2] = p->nbyte; /* l_size_t */
179
		iarg[3] = p->offset; /* l_loff_t */
180
		*n_args = 4;
181
		break;
182
	}
183
	/* readv */
184
	case 19: {
185
		struct readv_args *p = params;
186
		iarg[0] = p->fd; /* int */
187
		uarg[1] = (intptr_t) p->iovp; /* struct iovec * */
188
		uarg[2] = p->iovcnt; /* u_int */
189
		*n_args = 3;
190
		break;
191
	}
192
	/* writev */
193
	case 20: {
194
		struct writev_args *p = params;
195
		iarg[0] = p->fd; /* int */
196
		uarg[1] = (intptr_t) p->iovp; /* struct iovec * */
197
		uarg[2] = p->iovcnt; /* u_int */
198
		*n_args = 3;
199
		break;
200
	}
201
	/* linux_access */
202
	case 21: {
203
		struct linux_access_args *p = params;
204
		uarg[0] = (intptr_t) p->path; /* char * */
205
		iarg[1] = p->amode; /* l_int */
206
		*n_args = 2;
207
		break;
208
	}
209
	/* linux_pipe */
210
	case 22: {
211
		struct linux_pipe_args *p = params;
212
		uarg[0] = (intptr_t) p->pipefds; /* l_ulong * */
213
		*n_args = 1;
214
		break;
215
	}
216
	/* linux_select */
217
	case 23: {
218
		struct linux_select_args *p = params;
219
		iarg[0] = p->nfds; /* l_int */
220
		uarg[1] = (intptr_t) p->readfds; /* l_fd_set * */
221
		uarg[2] = (intptr_t) p->writefds; /* l_fd_set * */
222
		uarg[3] = (intptr_t) p->exceptfds; /* l_fd_set * */
223
		uarg[4] = (intptr_t) p->timeout; /* struct l_timeval * */
224
		*n_args = 5;
225
		break;
226
	}
227
	/* sched_yield */
228
	case 24: {
229
		*n_args = 0;
230
		break;
231
	}
232
	/* linux_mremap */
233
	case 25: {
234
		struct linux_mremap_args *p = params;
235
		iarg[0] = p->addr; /* l_ulong */
236
		iarg[1] = p->old_len; /* l_ulong */
237
		iarg[2] = p->new_len; /* l_ulong */
238
		iarg[3] = p->flags; /* l_ulong */
239
		iarg[4] = p->new_addr; /* l_ulong */
240
		*n_args = 5;
241
		break;
242
	}
243
	/* linux_msync */
244
	case 26: {
245
		struct linux_msync_args *p = params;
246
		iarg[0] = p->addr; /* l_ulong */
247
		iarg[1] = p->len; /* l_size_t */
248
		iarg[2] = p->fl; /* l_int */
249
		*n_args = 3;
250
		break;
251
	}
252
	/* linux_mincore */
253
	case 27: {
254
		struct linux_mincore_args *p = params;
255
		iarg[0] = p->start; /* l_ulong */
256
		iarg[1] = p->len; /* l_size_t */
257
		uarg[2] = (intptr_t) p->vec; /* u_char * */
258
		*n_args = 3;
259
		break;
260
	}
261
	/* madvise */
262
	case 28: {
263
		struct madvise_args *p = params;
264
		uarg[0] = (intptr_t) p->addr; /* void * */
265
		uarg[1] = p->len; /* size_t */
266
		iarg[2] = p->behav; /* int */
267
		*n_args = 3;
268
		break;
269
	}
270
	/* linux_shmget */
271
	case 29: {
272
		struct linux_shmget_args *p = params;
273
		iarg[0] = p->key; /* l_key_t */
274
		iarg[1] = p->size; /* l_size_t */
275
		iarg[2] = p->shmflg; /* l_int */
276
		*n_args = 3;
277
		break;
278
	}
279
	/* linux_shmat */
280
	case 30: {
281
		struct linux_shmat_args *p = params;
282
		iarg[0] = p->shmid; /* l_int */
283
		uarg[1] = (intptr_t) p->shmaddr; /* char * */
284
		iarg[2] = p->shmflg; /* l_int */
285
		*n_args = 3;
286
		break;
287
	}
288
	/* linux_shmctl */
289
	case 31: {
290
		struct linux_shmctl_args *p = params;
291
		iarg[0] = p->shmid; /* l_int */
292
		iarg[1] = p->cmd; /* l_int */
293
		uarg[2] = (intptr_t) p->buf; /* struct l_shmid_ds * */
294
		*n_args = 3;
295
		break;
296
	}
297
	/* dup */
298
	case 32: {
299
		struct dup_args *p = params;
300
		uarg[0] = p->fd; /* u_int */
301
		*n_args = 1;
302
		break;
303
	}
304
	/* dup2 */
305
	case 33: {
306
		struct dup2_args *p = params;
307
		uarg[0] = p->from; /* u_int */
308
		uarg[1] = p->to; /* u_int */
309
		*n_args = 2;
310
		break;
311
	}
312
	/* linux_pause */
313
	case 34: {
314
		*n_args = 0;
315
		break;
316
	}
317
	/* linux_nanosleep */
318
	case 35: {
319
		struct linux_nanosleep_args *p = params;
320
		uarg[0] = (intptr_t) p->rqtp; /* const struct l_timespec * */
321
		uarg[1] = (intptr_t) p->rmtp; /* struct l_timespec * */
322
		*n_args = 2;
323
		break;
324
	}
325
	/* linux_getitimer */
326
	case 36: {
327
		struct linux_getitimer_args *p = params;
328
		iarg[0] = p->which; /* l_int */
329
		uarg[1] = (intptr_t) p->itv; /* struct l_itimerval * */
330
		*n_args = 2;
331
		break;
332
	}
333
	/* linux_alarm */
334
	case 37: {
335
		struct linux_alarm_args *p = params;
336
		iarg[0] = p->secs; /* l_uint */
337
		*n_args = 1;
338
		break;
339
	}
340
	/* linux_setitimer */
341
	case 38: {
342
		struct linux_setitimer_args *p = params;
343
		iarg[0] = p->which; /* l_int */
344
		uarg[1] = (intptr_t) p->itv; /* struct l_itimerval * */
345
		uarg[2] = (intptr_t) p->oitv; /* struct l_itimerval * */
346
		*n_args = 3;
347
		break;
348
	}
349
	/* linux_getpid */
350
	case 39: {
351
		*n_args = 0;
352
		break;
353
	}
354
	/* linux_sendfile */
355
	case 40: {
356
		struct linux_sendfile_args *p = params;
357
		iarg[0] = p->out; /* int */
358
		iarg[1] = p->in; /* int */
359
		uarg[2] = (intptr_t) p->offset; /* l_long * */
360
		iarg[3] = p->count; /* l_size_t */
361
		*n_args = 4;
362
		break;
363
	}
364
	/* linux_socket */
365
	case 41: {
366
		struct linux_socket_args *p = params;
367
		iarg[0] = p->domain; /* l_int */
368
		iarg[1] = p->type; /* l_int */
369
		iarg[2] = p->protocol; /* l_int */
370
		*n_args = 3;
371
		break;
372
	}
373
	/* linux_connect */
374
	case 42: {
375
		struct linux_connect_args *p = params;
376
		iarg[0] = p->s; /* l_int */
377
		iarg[1] = p->name; /* l_uintptr_t */
378
		iarg[2] = p->namelen; /* l_int */
379
		*n_args = 3;
380
		break;
381
	}
382
	/* linux_accept */
383
	case 43: {
384
		struct linux_accept_args *p = params;
385
		iarg[0] = p->s; /* l_int */
386
		iarg[1] = p->addr; /* l_uintptr_t */
387
		iarg[2] = p->namelen; /* l_uintptr_t */
388
		*n_args = 3;
389
		break;
390
	}
391
	/* linux_sendto */
392
	case 44: {
393
		struct linux_sendto_args *p = params;
394
		iarg[0] = p->s; /* l_int */
395
		iarg[1] = p->msg; /* l_uintptr_t */
396
		iarg[2] = p->len; /* l_int */
397
		iarg[3] = p->flags; /* l_int */
398
		iarg[4] = p->to; /* l_uintptr_t */
399
		iarg[5] = p->tolen; /* l_int */
400
		*n_args = 6;
401
		break;
402
	}
403
	/* linux_recvfrom */
404
	case 45: {
405
		struct linux_recvfrom_args *p = params;
406
		iarg[0] = p->s; /* l_int */
407
		iarg[1] = p->buf; /* l_uintptr_t */
408
		iarg[2] = p->len; /* l_size_t */
409
		iarg[3] = p->flags; /* l_int */
410
		iarg[4] = p->from; /* l_uintptr_t */
411
		iarg[5] = p->fromlen; /* l_uintptr_t */
412
		*n_args = 6;
413
		break;
414
	}
415
	/* linux_sendmsg */
416
	case 46: {
417
		struct linux_sendmsg_args *p = params;
418
		iarg[0] = p->s; /* l_int */
419
		iarg[1] = p->msg; /* l_uintptr_t */
420
		iarg[2] = p->flags; /* l_int */
421
		*n_args = 3;
422
		break;
423
	}
424
	/* linux_recvmsg */
425
	case 47: {
426
		struct linux_recvmsg_args *p = params;
427
		iarg[0] = p->s; /* l_int */
428
		iarg[1] = p->msg; /* l_uintptr_t */
429
		iarg[2] = p->flags; /* l_int */
430
		*n_args = 3;
431
		break;
432
	}
433
	/* linux_shutdown */
434
	case 48: {
435
		struct linux_shutdown_args *p = params;
436
		iarg[0] = p->s; /* l_int */
437
		iarg[1] = p->how; /* l_int */
438
		*n_args = 2;
439
		break;
440
	}
441
	/* linux_bind */
442
	case 49: {
443
		struct linux_bind_args *p = params;
444
		iarg[0] = p->s; /* l_int */
445
		iarg[1] = p->name; /* l_uintptr_t */
446
		iarg[2] = p->namelen; /* l_int */
447
		*n_args = 3;
448
		break;
449
	}
450
	/* linux_listen */
451
	case 50: {
452
		struct linux_listen_args *p = params;
453
		iarg[0] = p->s; /* l_int */
454
		iarg[1] = p->backlog; /* l_int */
455
		*n_args = 2;
456
		break;
457
	}
458
	/* linux_getsockname */
459
	case 51: {
460
		struct linux_getsockname_args *p = params;
461
		iarg[0] = p->s; /* l_int */
462
		iarg[1] = p->addr; /* l_uintptr_t */
463
		iarg[2] = p->namelen; /* l_uintptr_t */
464
		*n_args = 3;
465
		break;
466
	}
467
	/* linux_getpeername */
468
	case 52: {
469
		struct linux_getpeername_args *p = params;
470
		iarg[0] = p->s; /* l_int */
471
		iarg[1] = p->addr; /* l_uintptr_t */
472
		iarg[2] = p->namelen; /* l_uintptr_t */
473
		*n_args = 3;
474
		break;
475
	}
476
	/* linux_socketpair */
477
	case 53: {
478
		struct linux_socketpair_args *p = params;
479
		iarg[0] = p->domain; /* l_int */
480
		iarg[1] = p->type; /* l_int */
481
		iarg[2] = p->protocol; /* l_int */
482
		iarg[3] = p->rsv; /* l_uintptr_t */
483
		*n_args = 4;
484
		break;
485
	}
486
	/* linux_setsockopt */
487
	case 54: {
488
		struct linux_setsockopt_args *p = params;
489
		iarg[0] = p->s; /* l_int */
490
		iarg[1] = p->level; /* l_int */
491
		iarg[2] = p->optname; /* l_int */
492
		iarg[3] = p->optval; /* l_uintptr_t */
493
		iarg[4] = p->optlen; /* l_int */
494
		*n_args = 5;
495
		break;
496
	}
497
	/* linux_getsockopt */
498
	case 55: {
499
		struct linux_getsockopt_args *p = params;
500
		iarg[0] = p->s; /* l_int */
501
		iarg[1] = p->level; /* l_int */
502
		iarg[2] = p->optname; /* l_int */
503
		iarg[3] = p->optval; /* l_uintptr_t */
504
		iarg[4] = p->optlen; /* l_uintptr_t */
505
		*n_args = 5;
506
		break;
507
	}
508
	/* linux_clone */
509
	case 56: {
510
		struct linux_clone_args *p = params;
511
		iarg[0] = p->flags; /* l_int */
512
		uarg[1] = (intptr_t) p->stack; /* void * */
513
		uarg[2] = (intptr_t) p->parent_tidptr; /* void * */
514
		uarg[3] = (intptr_t) p->child_tidptr; /* void * */
515
		uarg[4] = (intptr_t) p->tls; /* void * */
516
		*n_args = 5;
517
		break;
518
	}
519
	/* linux_fork */
520
	case 57: {
521
		*n_args = 0;
522
		break;
523
	}
524
	/* linux_vfork */
525
	case 58: {
526
		*n_args = 0;
527
		break;
528
	}
529
	/* linux_execve */
530
	case 59: {
531
		struct linux_execve_args *p = params;
532
		uarg[0] = (intptr_t) p->path; /* char * */
533
		uarg[1] = (intptr_t) p->argp; /* char ** */
534
		uarg[2] = (intptr_t) p->envp; /* char ** */
535
		*n_args = 3;
536
		break;
537
	}
538
	/* linux_exit */
539
	case 60: {
540
		struct linux_exit_args *p = params;
541
		iarg[0] = p->rval; /* int */
542
		*n_args = 1;
543
		break;
544
	}
545
	/* linux_wait4 */
546
	case 61: {
547
		struct linux_wait4_args *p = params;
548
		iarg[0] = p->pid; /* l_pid_t */
549
		uarg[1] = (intptr_t) p->status; /* l_int * */
550
		iarg[2] = p->options; /* l_int */
551
		uarg[3] = (intptr_t) p->rusage; /* struct l_rusage * */
552
		*n_args = 4;
553
		break;
554
	}
555
	/* linux_kill */
556
	case 62: {
557
		struct linux_kill_args *p = params;
558
		iarg[0] = p->pid; /* l_int */
559
		iarg[1] = p->signum; /* l_int */
560
		*n_args = 2;
561
		break;
562
	}
563
	/* linux_newuname */
564
	case 63: {
565
		struct linux_newuname_args *p = params;
566
		uarg[0] = (intptr_t) p->buf; /* struct l_new_utsname * */
567
		*n_args = 1;
568
		break;
569
	}
570
	/* linux_semget */
571
	case 64: {
572
		struct linux_semget_args *p = params;
573
		iarg[0] = p->key; /* l_key_t */
574
		iarg[1] = p->nsems; /* l_int */
575
		iarg[2] = p->semflg; /* l_int */
576
		*n_args = 3;
577
		break;
578
	}
579
	/* linux_semop */
580
	case 65: {
581
		struct linux_semop_args *p = params;
582
		iarg[0] = p->semid; /* l_int */
583
		uarg[1] = (intptr_t) p->tsops; /* struct l_sembuf * */
584
		iarg[2] = p->nsops; /* l_uint */
585
		*n_args = 3;
586
		break;
587
	}
588
	/* linux_semctl */
589
	case 66: {
590
		struct linux_semctl_args *p = params;
591
		iarg[0] = p->semid; /* l_int */
592
		iarg[1] = p->semnum; /* l_int */
593
		iarg[2] = p->cmd; /* l_int */
594
		uarg[3] = p->arg; /* union l_semun */
595
		*n_args = 4;
596
		break;
597
	}
598
	/* linux_shmdt */
599
	case 67: {
600
		struct linux_shmdt_args *p = params;
601
		uarg[0] = (intptr_t) p->shmaddr; /* char * */
602
		*n_args = 1;
603
		break;
604
	}
605
	/* linux_msgget */
606
	case 68: {
607
		struct linux_msgget_args *p = params;
608
		iarg[0] = p->key; /* l_key_t */
609
		iarg[1] = p->msgflg; /* l_int */
610
		*n_args = 2;
611
		break;
612
	}
613
	/* linux_msgsnd */
614
	case 69: {
615
		struct linux_msgsnd_args *p = params;
616
		iarg[0] = p->msqid; /* l_int */
617
		uarg[1] = (intptr_t) p->msgp; /* struct l_msgbuf * */
618
		iarg[2] = p->msgsz; /* l_size_t */
619
		iarg[3] = p->msgflg; /* l_int */
620
		*n_args = 4;
621
		break;
622
	}
623
	/* linux_msgrcv */
624
	case 70: {
625
		struct linux_msgrcv_args *p = params;
626
		iarg[0] = p->msqid; /* l_int */
627
		uarg[1] = (intptr_t) p->msgp; /* struct l_msgbuf * */
628
		iarg[2] = p->msgsz; /* l_size_t */
629
		iarg[3] = p->msgtyp; /* l_long */
630
		iarg[4] = p->msgflg; /* l_int */
631
		*n_args = 5;
632
		break;
633
	}
634
	/* linux_msgctl */
635
	case 71: {
636
		struct linux_msgctl_args *p = params;
637
		iarg[0] = p->msqid; /* l_int */
638
		iarg[1] = p->cmd; /* l_int */
639
		uarg[2] = (intptr_t) p->buf; /* struct l_msqid_ds * */
640
		*n_args = 3;
641
		break;
642
	}
643
	/* linux_fcntl */
644
	case 72: {
645
		struct linux_fcntl_args *p = params;
646
		iarg[0] = p->fd; /* l_uint */
647
		iarg[1] = p->cmd; /* l_uint */
648
		iarg[2] = p->arg; /* l_ulong */
649
		*n_args = 3;
650
		break;
651
	}
652
	/* flock */
653
	case 73: {
654
		struct flock_args *p = params;
655
		iarg[0] = p->fd; /* int */
656
		iarg[1] = p->how; /* int */
657
		*n_args = 2;
658
		break;
659
	}
660
	/* fsync */
661
	case 74: {
662
		struct fsync_args *p = params;
663
		iarg[0] = p->fd; /* int */
664
		*n_args = 1;
665
		break;
666
	}
667
	/* linux_fdatasync */
668
	case 75: {
669
		struct linux_fdatasync_args *p = params;
670
		iarg[0] = p->fd; /* l_uint */
671
		*n_args = 1;
672
		break;
673
	}
674
	/* linux_truncate */
675
	case 76: {
676
		struct linux_truncate_args *p = params;
677
		uarg[0] = (intptr_t) p->path; /* char * */
678
		iarg[1] = p->length; /* l_ulong */
679
		*n_args = 2;
680
		break;
681
	}
682
	/* linux_ftruncate */
683
	case 77: {
684
		struct linux_ftruncate_args *p = params;
685
		iarg[0] = p->fd; /* l_int */
686
		iarg[1] = p->length; /* l_long */
687
		*n_args = 2;
688
		break;
689
	}
690
	/* linux_getdents */
691
	case 78: {
692
		struct linux_getdents_args *p = params;
693
		iarg[0] = p->fd; /* l_uint */
694
		uarg[1] = (intptr_t) p->dent; /* void * */
695
		iarg[2] = p->count; /* l_uint */
696
		*n_args = 3;
697
		break;
698
	}
699
	/* linux_getcwd */
700
	case 79: {
701
		struct linux_getcwd_args *p = params;
702
		uarg[0] = (intptr_t) p->buf; /* char * */
703
		iarg[1] = p->bufsize; /* l_ulong */
704
		*n_args = 2;
705
		break;
706
	}
707
	/* linux_chdir */
708
	case 80: {
709
		struct linux_chdir_args *p = params;
710
		uarg[0] = (intptr_t) p->path; /* char * */
711
		*n_args = 1;
712
		break;
713
	}
714
	/* fchdir */
715
	case 81: {
716
		struct fchdir_args *p = params;
717
		iarg[0] = p->fd; /* int */
718
		*n_args = 1;
719
		break;
720
	}
721
	/* linux_rename */
722
	case 82: {
723
		struct linux_rename_args *p = params;
724
		uarg[0] = (intptr_t) p->from; /* char * */
725
		uarg[1] = (intptr_t) p->to; /* char * */
726
		*n_args = 2;
727
		break;
728
	}
729
	/* linux_mkdir */
730
	case 83: {
731
		struct linux_mkdir_args *p = params;
732
		uarg[0] = (intptr_t) p->path; /* char * */
733
		iarg[1] = p->mode; /* l_int */
734
		*n_args = 2;
735
		break;
736
	}
737
	/* linux_rmdir */
738
	case 84: {
739
		struct linux_rmdir_args *p = params;
740
		uarg[0] = (intptr_t) p->path; /* char * */
741
		*n_args = 1;
742
		break;
743
	}
744
	/* linux_creat */
745
	case 85: {
746
		struct linux_creat_args *p = params;
747
		uarg[0] = (intptr_t) p->path; /* char * */
748
		iarg[1] = p->mode; /* l_int */
749
		*n_args = 2;
750
		break;
751
	}
752
	/* linux_link */
753
	case 86: {
754
		struct linux_link_args *p = params;
755
		uarg[0] = (intptr_t) p->path; /* char * */
756
		uarg[1] = (intptr_t) p->to; /* char * */
757
		*n_args = 2;
758
		break;
759
	}
760
	/* linux_unlink */
761
	case 87: {
762
		struct linux_unlink_args *p = params;
763
		uarg[0] = (intptr_t) p->path; /* char * */
764
		*n_args = 1;
765
		break;
766
	}
767
	/* linux_symlink */
768
	case 88: {
769
		struct linux_symlink_args *p = params;
770
		uarg[0] = (intptr_t) p->path; /* char * */
771
		uarg[1] = (intptr_t) p->to; /* char * */
772
		*n_args = 2;
773
		break;
774
	}
775
	/* linux_readlink */
776
	case 89: {
777
		struct linux_readlink_args *p = params;
778
		uarg[0] = (intptr_t) p->name; /* char * */
779
		uarg[1] = (intptr_t) p->buf; /* char * */
780
		iarg[2] = p->count; /* l_int */
781
		*n_args = 3;
782
		break;
783
	}
784
	/* linux_chmod */
785
	case 90: {
786
		struct linux_chmod_args *p = params;
787
		uarg[0] = (intptr_t) p->path; /* char * */
788
		iarg[1] = p->mode; /* l_mode_t */
789
		*n_args = 2;
790
		break;
791
	}
792
	/* fchmod */
793
	case 91: {
794
		struct fchmod_args *p = params;
795
		iarg[0] = p->fd; /* int */
796
		iarg[1] = p->mode; /* int */
797
		*n_args = 2;
798
		break;
799
	}
800
	/* linux_chown */
801
	case 92: {
802
		struct linux_chown_args *p = params;
803
		uarg[0] = (intptr_t) p->path; /* char * */
804
		iarg[1] = p->uid; /* l_uid_t */
805
		iarg[2] = p->gid; /* l_gid_t */
806
		*n_args = 3;
807
		break;
808
	}
809
	/* fchown */
810
	case 93: {
811
		struct fchown_args *p = params;
812
		iarg[0] = p->fd; /* int */
813
		iarg[1] = p->uid; /* int */
814
		iarg[2] = p->gid; /* int */
815
		*n_args = 3;
816
		break;
817
	}
818
	/* linux_lchown */
819
	case 94: {
820
		struct linux_lchown_args *p = params;
821
		uarg[0] = (intptr_t) p->path; /* char * */
822
		iarg[1] = p->uid; /* l_uid_t */
823
		iarg[2] = p->gid; /* l_gid_t */
824
		*n_args = 3;
825
		break;
826
	}
827
	/* umask */
828
	case 95: {
829
		struct umask_args *p = params;
830
		iarg[0] = p->newmask; /* int */
831
		*n_args = 1;
832
		break;
833
	}
834
	/* gettimeofday */
835
	case 96: {
836
		struct gettimeofday_args *p = params;
837
		uarg[0] = (intptr_t) p->tp; /* struct l_timeval * */
838
		uarg[1] = (intptr_t) p->tzp; /* struct timezone * */
839
		*n_args = 2;
840
		break;
841
	}
842
	/* linux_getrlimit */
843
	case 97: {
844
		struct linux_getrlimit_args *p = params;
845
		iarg[0] = p->resource; /* l_uint */
846
		uarg[1] = (intptr_t) p->rlim; /* struct l_rlimit * */
847
		*n_args = 2;
848
		break;
849
	}
850
	/* getrusage */
851
	case 98: {
852
		struct getrusage_args *p = params;
853
		iarg[0] = p->who; /* int */
854
		uarg[1] = (intptr_t) p->rusage; /* struct rusage * */
855
		*n_args = 2;
856
		break;
857
	}
858
	/* linux_sysinfo */
859
	case 99: {
860
		struct linux_sysinfo_args *p = params;
861
		uarg[0] = (intptr_t) p->info; /* struct l_sysinfo * */
862
		*n_args = 1;
863
		break;
864
	}
865
	/* linux_times */
866
	case 100: {
867
		struct linux_times_args *p = params;
868
		uarg[0] = (intptr_t) p->buf; /* struct l_times_argv * */
869
		*n_args = 1;
870
		break;
871
	}
872
	/* linux_ptrace */
873
	case 101: {
874
		struct linux_ptrace_args *p = params;
875
		iarg[0] = p->req; /* l_long */
876
		iarg[1] = p->pid; /* l_long */
877
		iarg[2] = p->addr; /* l_long */
878
		iarg[3] = p->data; /* l_long */
879
		*n_args = 4;
880
		break;
881
	}
882
	/* linux_getuid */
883
	case 102: {
884
		*n_args = 0;
885
		break;
886
	}
887
	/* linux_syslog */
888
	case 103: {
889
		struct linux_syslog_args *p = params;
890
		iarg[0] = p->type; /* l_int */
891
		uarg[1] = (intptr_t) p->buf; /* char * */
892
		iarg[2] = p->len; /* l_int */
893
		*n_args = 3;
894
		break;
895
	}
896
	/* linux_getgid */
897
	case 104: {
898
		*n_args = 0;
899
		break;
900
	}
901
	/* setuid */
902
	case 105: {
903
		struct setuid_args *p = params;
904
		uarg[0] = p->uid; /* uid_t */
905
		*n_args = 1;
906
		break;
907
	}
908
	/* setgid */
909
	case 106: {
910
		struct setgid_args *p = params;
911
		iarg[0] = p->gid; /* gid_t */
912
		*n_args = 1;
913
		break;
914
	}
915
	/* geteuid */
916
	case 107: {
917
		*n_args = 0;
918
		break;
919
	}
920
	/* getegid */
921
	case 108: {
922
		*n_args = 0;
923
		break;
924
	}
925
	/* setpgid */
926
	case 109: {
927
		struct setpgid_args *p = params;
928
		iarg[0] = p->pid; /* int */
929
		iarg[1] = p->pgid; /* int */
930
		*n_args = 2;
931
		break;
932
	}
933
	/* linux_getppid */
934
	case 110: {
935
		*n_args = 0;
936
		break;
937
	}
938
	/* getpgrp */
939
	case 111: {
940
		*n_args = 0;
941
		break;
942
	}
943
	/* setsid */
944
	case 112: {
945
		*n_args = 0;
946
		break;
947
	}
948
	/* setreuid */
949
	case 113: {
950
		struct setreuid_args *p = params;
951
		uarg[0] = p->ruid; /* uid_t */
952
		uarg[1] = p->euid; /* uid_t */
953
		*n_args = 2;
954
		break;
955
	}
956
	/* setregid */
957
	case 114: {
958
		struct setregid_args *p = params;
959
		iarg[0] = p->rgid; /* gid_t */
960
		iarg[1] = p->egid; /* gid_t */
961
		*n_args = 2;
962
		break;
963
	}
964
	/* linux_getgroups */
965
	case 115: {
966
		struct linux_getgroups_args *p = params;
967
		iarg[0] = p->gidsetsize; /* l_int */
968
		uarg[1] = (intptr_t) p->grouplist; /* l_gid_t * */
969
		*n_args = 2;
970
		break;
971
	}
972
	/* linux_setgroups */
973
	case 116: {
974
		struct linux_setgroups_args *p = params;
975
		iarg[0] = p->gidsetsize; /* l_int */
976
		uarg[1] = (intptr_t) p->grouplist; /* l_gid_t * */
977
		*n_args = 2;
978
		break;
979
	}
980
	/* setresuid */
981
	case 117: {
982
		struct setresuid_args *p = params;
983
		uarg[0] = p->ruid; /* uid_t */
984
		uarg[1] = p->euid; /* uid_t */
985
		uarg[2] = p->suid; /* uid_t */
986
		*n_args = 3;
987
		break;
988
	}
989
	/* getresuid */
990
	case 118: {
991
		struct getresuid_args *p = params;
992
		uarg[0] = (intptr_t) p->ruid; /* uid_t * */
993
		uarg[1] = (intptr_t) p->euid; /* uid_t * */
994
		uarg[2] = (intptr_t) p->suid; /* uid_t * */
995
		*n_args = 3;
996
		break;
997
	}
998
	/* setresgid */
999
	case 119: {
1000
		struct setresgid_args *p = params;
1001
		iarg[0] = p->rgid; /* gid_t */
1002
		iarg[1] = p->egid; /* gid_t */
1003
		iarg[2] = p->sgid; /* gid_t */
1004
		*n_args = 3;
1005
		break;
1006
	}
1007
	/* getresgid */
1008
	case 120: {
1009
		struct getresgid_args *p = params;
1010
		uarg[0] = (intptr_t) p->rgid; /* gid_t * */
1011
		uarg[1] = (intptr_t) p->egid; /* gid_t * */
1012
		uarg[2] = (intptr_t) p->sgid; /* gid_t * */
1013
		*n_args = 3;
1014
		break;
1015
	}
1016
	/* getpgid */
1017
	case 121: {
1018
		struct getpgid_args *p = params;
1019
		iarg[0] = p->pid; /* int */
1020
		*n_args = 1;
1021
		break;
1022
	}
1023
	/* linux_setfsuid */
1024
	case 122: {
1025
		struct linux_setfsuid_args *p = params;
1026
		iarg[0] = p->uid; /* l_uid_t */
1027
		*n_args = 1;
1028
		break;
1029
	}
1030
	/* linux_setfsgid */
1031
	case 123: {
1032
		struct linux_setfsgid_args *p = params;
1033
		iarg[0] = p->gid; /* l_gid_t */
1034
		*n_args = 1;
1035
		break;
1036
	}
1037
	/* linux_getsid */
1038
	case 124: {
1039
		struct linux_getsid_args *p = params;
1040
		iarg[0] = p->pid; /* l_pid_t */
1041
		*n_args = 1;
1042
		break;
1043
	}
1044
	/* linux_capget */
1045
	case 125: {
1046
		struct linux_capget_args *p = params;
1047
		uarg[0] = (intptr_t) p->hdrp; /* struct l_user_cap_header * */
1048
		uarg[1] = (intptr_t) p->datap; /* struct l_user_cap_data * */
1049
		*n_args = 2;
1050
		break;
1051
	}
1052
	/* linux_capset */
1053
	case 126: {
1054
		struct linux_capset_args *p = params;
1055
		uarg[0] = (intptr_t) p->hdrp; /* struct l_user_cap_header * */
1056
		uarg[1] = (intptr_t) p->datap; /* struct l_user_cap_data * */
1057
		*n_args = 2;
1058
		break;
1059
	}
1060
	/* linux_rt_sigpending */
1061
	case 127: {
1062
		struct linux_rt_sigpending_args *p = params;
1063
		uarg[0] = (intptr_t) p->set; /* l_sigset_t * */
1064
		iarg[1] = p->sigsetsize; /* l_size_t */
1065
		*n_args = 2;
1066
		break;
1067
	}
1068
	/* linux_rt_sigtimedwait */
1069
	case 128: {
1070
		struct linux_rt_sigtimedwait_args *p = params;
1071
		uarg[0] = (intptr_t) p->mask; /* l_sigset_t * */
1072
		uarg[1] = (intptr_t) p->ptr; /* l_siginfo_t * */
1073
		uarg[2] = (intptr_t) p->timeout; /* struct l_timeval * */
1074
		iarg[3] = p->sigsetsize; /* l_size_t */
1075
		*n_args = 4;
1076
		break;
1077
	}
1078
	/* linux_rt_sigqueueinfo */
1079
	case 129: {
1080
		struct linux_rt_sigqueueinfo_args *p = params;
1081
		iarg[0] = p->pid; /* l_pid_t */
1082
		iarg[1] = p->sig; /* l_int */
1083
		uarg[2] = (intptr_t) p->info; /* l_siginfo_t * */
1084
		*n_args = 3;
1085
		break;
1086
	}
1087
	/* linux_rt_sigsuspend */
1088
	case 130: {
1089
		struct linux_rt_sigsuspend_args *p = params;
1090
		uarg[0] = (intptr_t) p->newset; /* l_sigset_t * */
1091
		iarg[1] = p->sigsetsize; /* l_size_t */
1092
		*n_args = 2;
1093
		break;
1094
	}
1095
	/* linux_sigaltstack */
1096
	case 131: {
1097
		struct linux_sigaltstack_args *p = params;
1098
		uarg[0] = (intptr_t) p->uss; /* l_stack_t * */
1099
		uarg[1] = (intptr_t) p->uoss; /* l_stack_t * */
1100
		*n_args = 2;
1101
		break;
1102
	}
1103
	/* linux_utime */
1104
	case 132: {
1105
		struct linux_utime_args *p = params;
1106
		uarg[0] = (intptr_t) p->fname; /* char * */
1107
		uarg[1] = (intptr_t) p->times; /* struct l_utimbuf * */
1108
		*n_args = 2;
1109
		break;
1110
	}
1111
	/* linux_mknod */
1112
	case 133: {
1113
		struct linux_mknod_args *p = params;
1114
		uarg[0] = (intptr_t) p->path; /* char * */
1115
		iarg[1] = p->mode; /* l_int */
1116
		iarg[2] = p->dev; /* l_dev_t */
1117
		*n_args = 3;
1118
		break;
1119
	}
1120
	/* linux_personality */
1121
	case 135: {
1122
		struct linux_personality_args *p = params;
1123
		iarg[0] = p->per; /* l_ulong */
1124
		*n_args = 1;
1125
		break;
1126
	}
1127
	/* linux_ustat */
1128
	case 136: {
1129
		struct linux_ustat_args *p = params;
1130
		iarg[0] = p->dev; /* l_dev_t */
1131
		uarg[1] = (intptr_t) p->ubuf; /* struct l_ustat * */
1132
		*n_args = 2;
1133
		break;
1134
	}
1135
	/* linux_statfs */
1136
	case 137: {
1137
		struct linux_statfs_args *p = params;
1138
		uarg[0] = (intptr_t) p->path; /* char * */
1139
		uarg[1] = (intptr_t) p->buf; /* struct l_statfs_buf * */
1140
		*n_args = 2;
1141
		break;
1142
	}
1143
	/* linux_fstatfs */
1144
	case 138: {
1145
		struct linux_fstatfs_args *p = params;
1146
		iarg[0] = p->fd; /* l_uint */
1147
		uarg[1] = (intptr_t) p->buf; /* struct l_statfs_buf * */
1148
		*n_args = 2;
1149
		break;
1150
	}
1151
	/* linux_sysfs */
1152
	case 139: {
1153
		struct linux_sysfs_args *p = params;
1154
		iarg[0] = p->option; /* l_int */
1155
		iarg[1] = p->arg1; /* l_ulong */
1156
		iarg[2] = p->arg2; /* l_ulong */
1157
		*n_args = 3;
1158
		break;
1159
	}
1160
	/* linux_getpriority */
1161
	case 140: {
1162
		struct linux_getpriority_args *p = params;
1163
		iarg[0] = p->which; /* int */
1164
		iarg[1] = p->who; /* int */
1165
		*n_args = 2;
1166
		break;
1167
	}
1168
	/* setpriority */
1169
	case 141: {
1170
		struct setpriority_args *p = params;
1171
		iarg[0] = p->which; /* int */
1172
		iarg[1] = p->who; /* int */
1173
		iarg[2] = p->prio; /* int */
1174
		*n_args = 3;
1175
		break;
1176
	}
1177
	/* linux_sched_setparam */
1178
	case 142: {
1179
		struct linux_sched_setparam_args *p = params;
1180
		iarg[0] = p->pid; /* l_pid_t */
1181
		uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */
1182
		*n_args = 2;
1183
		break;
1184
	}
1185
	/* linux_sched_getparam */
1186
	case 143: {
1187
		struct linux_sched_getparam_args *p = params;
1188
		iarg[0] = p->pid; /* l_pid_t */
1189
		uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */
1190
		*n_args = 2;
1191
		break;
1192
	}
1193
	/* linux_sched_setscheduler */
1194
	case 144: {
1195
		struct linux_sched_setscheduler_args *p = params;
1196
		iarg[0] = p->pid; /* l_pid_t */
1197
		iarg[1] = p->policy; /* l_int */
1198
		uarg[2] = (intptr_t) p->param; /* struct l_sched_param * */
1199
		*n_args = 3;
1200
		break;
1201
	}
1202
	/* linux_sched_getscheduler */
1203
	case 145: {
1204
		struct linux_sched_getscheduler_args *p = params;
1205
		iarg[0] = p->pid; /* l_pid_t */
1206
		*n_args = 1;
1207
		break;
1208
	}
1209
	/* linux_sched_get_priority_max */
1210
	case 146: {
1211
		struct linux_sched_get_priority_max_args *p = params;
1212
		iarg[0] = p->policy; /* l_int */
1213
		*n_args = 1;
1214
		break;
1215
	}
1216
	/* linux_sched_get_priority_min */
1217
	case 147: {
1218
		struct linux_sched_get_priority_min_args *p = params;
1219
		iarg[0] = p->policy; /* l_int */
1220
		*n_args = 1;
1221
		break;
1222
	}
1223
	/* linux_sched_rr_get_interval */
1224
	case 148: {
1225
		struct linux_sched_rr_get_interval_args *p = params;
1226
		iarg[0] = p->pid; /* l_pid_t */
1227
		uarg[1] = (intptr_t) p->interval; /* struct l_timespec * */
1228
		*n_args = 2;
1229
		break;
1230
	}
1231
	/* mlock */
1232
	case 149: {
1233
		struct mlock_args *p = params;
1234
		uarg[0] = (intptr_t) p->addr; /* const void * */
1235
		uarg[1] = p->len; /* size_t */
1236
		*n_args = 2;
1237
		break;
1238
	}
1239
	/* munlock */
1240
	case 150: {
1241
		struct munlock_args *p = params;
1242
		uarg[0] = (intptr_t) p->addr; /* const void * */
1243
		uarg[1] = p->len; /* size_t */
1244
		*n_args = 2;
1245
		break;
1246
	}
1247
	/* mlockall */
1248
	case 151: {
1249
		struct mlockall_args *p = params;
1250
		iarg[0] = p->how; /* int */
1251
		*n_args = 1;
1252
		break;
1253
	}
1254
	/* munlockall */
1255
	case 152: {
1256
		*n_args = 0;
1257
		break;
1258
	}
1259
	/* linux_vhangup */
1260
	case 153: {
1261
		*n_args = 0;
1262
		break;
1263
	}
1264
	/* linux_pivot_root */
1265
	case 155: {
1266
		*n_args = 0;
1267
		break;
1268
	}
1269
	/* linux_sysctl */
1270
	case 156: {
1271
		struct linux_sysctl_args *p = params;
1272
		uarg[0] = (intptr_t) p->args; /* struct l___sysctl_args * */
1273
		*n_args = 1;
1274
		break;
1275
	}
1276
	/* linux_prctl */
1277
	case 157: {
1278
		struct linux_prctl_args *p = params;
1279
		iarg[0] = p->option; /* l_int */
1280
		iarg[1] = p->arg2; /* l_uintptr_t */
1281
		iarg[2] = p->arg3; /* l_uintptr_t */
1282
		iarg[3] = p->arg4; /* l_uintptr_t */
1283
		iarg[4] = p->arg5; /* l_uintptr_t */
1284
		*n_args = 5;
1285
		break;
1286
	}
1287
	/* linux_arch_prctl */
1288
	case 158: {
1289
		struct linux_arch_prctl_args *p = params;
1290
		iarg[0] = p->code; /* l_int */
1291
		iarg[1] = p->addr; /* l_ulong */
1292
		*n_args = 2;
1293
		break;
1294
	}
1295
	/* linux_adjtimex */
1296
	case 159: {
1297
		*n_args = 0;
1298
		break;
1299
	}
1300
	/* linux_setrlimit */
1301
	case 160: {
1302
		struct linux_setrlimit_args *p = params;
1303
		iarg[0] = p->resource; /* l_uint */
1304
		uarg[1] = (intptr_t) p->rlim; /* struct l_rlimit * */
1305
		*n_args = 2;
1306
		break;
1307
	}
1308
	/* chroot */
1309
	case 161: {
1310
		struct chroot_args *p = params;
1311
		uarg[0] = (intptr_t) p->path; /* char * */
1312
		*n_args = 1;
1313
		break;
1314
	}
1315
	/* sync */
1316
	case 162: {
1317
		*n_args = 0;
1318
		break;
1319
	}
1320
	/* acct */
1321
	case 163: {
1322
		struct acct_args *p = params;
1323
		uarg[0] = (intptr_t) p->path; /* char * */
1324
		*n_args = 1;
1325
		break;
1326
	}
1327
	/* settimeofday */
1328
	case 164: {
1329
		struct settimeofday_args *p = params;
1330
		uarg[0] = (intptr_t) p->tp; /* struct l_timeval * */
1331
		uarg[1] = (intptr_t) p->tzp; /* struct timezone * */
1332
		*n_args = 2;
1333
		break;
1334
	}
1335
	/* linux_mount */
1336
	case 165: {
1337
		struct linux_mount_args *p = params;
1338
		uarg[0] = (intptr_t) p->specialfile; /* char * */
1339
		uarg[1] = (intptr_t) p->dir; /* char * */
1340
		uarg[2] = (intptr_t) p->filesystemtype; /* char * */
1341
		iarg[3] = p->rwflag; /* l_ulong */
1342
		uarg[4] = (intptr_t) p->data; /* void * */
1343
		*n_args = 5;
1344
		break;
1345
	}
1346
	/* linux_umount */
1347
	case 166: {
1348
		struct linux_umount_args *p = params;
1349
		uarg[0] = (intptr_t) p->path; /* char * */
1350
		iarg[1] = p->flags; /* l_int */
1351
		*n_args = 2;
1352
		break;
1353
	}
1354
	/* swapon */
1355
	case 167: {
1356
		struct swapon_args *p = params;
1357
		uarg[0] = (intptr_t) p->name; /* char * */
1358
		*n_args = 1;
1359
		break;
1360
	}
1361
	/* linux_swapoff */
1362
	case 168: {
1363
		*n_args = 0;
1364
		break;
1365
	}
1366
	/* linux_reboot */
1367
	case 169: {
1368
		struct linux_reboot_args *p = params;
1369
		iarg[0] = p->magic1; /* l_int */
1370
		iarg[1] = p->magic2; /* l_int */
1371
		iarg[2] = p->cmd; /* l_uint */
1372
		uarg[3] = (intptr_t) p->arg; /* void * */
1373
		*n_args = 4;
1374
		break;
1375
	}
1376
	/* linux_sethostname */
1377
	case 170: {
1378
		struct linux_sethostname_args *p = params;
1379
		uarg[0] = (intptr_t) p->hostname; /* char * */
1380
		iarg[1] = p->len; /* l_uint */
1381
		*n_args = 2;
1382
		break;
1383
	}
1384
	/* linux_setdomainname */
1385
	case 171: {
1386
		struct linux_setdomainname_args *p = params;
1387
		uarg[0] = (intptr_t) p->name; /* char * */
1388
		iarg[1] = p->len; /* l_int */
1389
		*n_args = 2;
1390
		break;
1391
	}
1392
	/* linux_iopl */
1393
	case 172: {
1394
		struct linux_iopl_args *p = params;
1395
		iarg[0] = p->level; /* l_uint */
1396
		*n_args = 1;
1397
		break;
1398
	}
1399
	/* linux_create_module */
1400
	case 174: {
1401
		*n_args = 0;
1402
		break;
1403
	}
1404
	/* linux_init_module */
1405
	case 175: {
1406
		*n_args = 0;
1407
		break;
1408
	}
1409
	/* linux_delete_module */
1410
	case 176: {
1411
		*n_args = 0;
1412
		break;
1413
	}
1414
	/* linux_get_kernel_syms */
1415
	case 177: {
1416
		*n_args = 0;
1417
		break;
1418
	}
1419
	/* linux_query_module */
1420
	case 178: {
1421
		*n_args = 0;
1422
		break;
1423
	}
1424
	/* linux_quotactl */
1425
	case 179: {
1426
		*n_args = 0;
1427
		break;
1428
	}
1429
	/* linux_nfsservctl */
1430
	case 180: {
1431
		*n_args = 0;
1432
		break;
1433
	}
1434
	/* linux_getpmsg */
1435
	case 181: {
1436
		*n_args = 0;
1437
		break;
1438
	}
1439
	/* linux_putpmsg */
1440
	case 182: {
1441
		*n_args = 0;
1442
		break;
1443
	}
1444
	/* linux_afs_syscall */
1445
	case 183: {
1446
		*n_args = 0;
1447
		break;
1448
	}
1449
	/* linux_tuxcall */
1450
	case 184: {
1451
		*n_args = 0;
1452
		break;
1453
	}
1454
	/* linux_security */
1455
	case 185: {
1456
		*n_args = 0;
1457
		break;
1458
	}
1459
	/* linux_gettid */
1460
	case 186: {
1461
		*n_args = 0;
1462
		break;
1463
	}
1464
	/* linux_setxattr */
1465
	case 188: {
1466
		*n_args = 0;
1467
		break;
1468
	}
1469
	/* linux_lsetxattr */
1470
	case 189: {
1471
		*n_args = 0;
1472
		break;
1473
	}
1474
	/* linux_fsetxattr */
1475
	case 190: {
1476
		*n_args = 0;
1477
		break;
1478
	}
1479
	/* linux_getxattr */
1480
	case 191: {
1481
		*n_args = 0;
1482
		break;
1483
	}
1484
	/* linux_lgetxattr */
1485
	case 192: {
1486
		*n_args = 0;
1487
		break;
1488
	}
1489
	/* linux_fgetxattr */
1490
	case 193: {
1491
		*n_args = 0;
1492
		break;
1493
	}
1494
	/* linux_listxattr */
1495
	case 194: {
1496
		*n_args = 0;
1497
		break;
1498
	}
1499
	/* linux_llistxattr */
1500
	case 195: {
1501
		*n_args = 0;
1502
		break;
1503
	}
1504
	/* linux_flistxattr */
1505
	case 196: {
1506
		*n_args = 0;
1507
		break;
1508
	}
1509
	/* linux_removexattr */
1510
	case 197: {
1511
		*n_args = 0;
1512
		break;
1513
	}
1514
	/* linux_lremovexattr */
1515
	case 198: {
1516
		*n_args = 0;
1517
		break;
1518
	}
1519
	/* linux_fremovexattr */
1520
	case 199: {
1521
		*n_args = 0;
1522
		break;
1523
	}
1524
	/* linux_tkill */
1525
	case 200: {
1526
		struct linux_tkill_args *p = params;
1527
		iarg[0] = p->tid; /* int */
1528
		iarg[1] = p->sig; /* int */
1529
		*n_args = 2;
1530
		break;
1531
	}
1532
	/* linux_time */
1533
	case 201: {
1534
		struct linux_time_args *p = params;
1535
		uarg[0] = (intptr_t) p->tm; /* l_time_t * */
1536
		*n_args = 1;
1537
		break;
1538
	}
1539
	/* linux_sys_futex */
1540
	case 202: {
1541
		struct linux_sys_futex_args *p = params;
1542
		uarg[0] = (intptr_t) p->uaddr; /* void * */
1543
		iarg[1] = p->op; /* int */
1544
		iarg[2] = p->val; /* int */
1545
		uarg[3] = (intptr_t) p->timeout; /* struct l_timespec * */
1546
		uarg[4] = (intptr_t) p->uaddr2; /* void * */
1547
		iarg[5] = p->val3; /* int */
1548
		*n_args = 6;
1549
		break;
1550
	}
1551
	/* linux_sched_setaffinity */
1552
	case 203: {
1553
		struct linux_sched_setaffinity_args *p = params;
1554
		iarg[0] = p->pid; /* l_pid_t */
1555
		iarg[1] = p->len; /* l_uint */
1556
		uarg[2] = (intptr_t) p->user_mask_ptr; /* l_ulong * */
1557
		*n_args = 3;
1558
		break;
1559
	}
1560
	/* linux_sched_getaffinity */
1561
	case 204: {
1562
		struct linux_sched_getaffinity_args *p = params;
1563
		iarg[0] = p->pid; /* l_pid_t */
1564
		iarg[1] = p->len; /* l_uint */
1565
		uarg[2] = (intptr_t) p->user_mask_ptr; /* l_ulong * */
1566
		*n_args = 3;
1567
		break;
1568
	}
1569
	/* linux_set_thread_area */
1570
	case 205: {
1571
		*n_args = 0;
1572
		break;
1573
	}
1574
	/* linux_lookup_dcookie */
1575
	case 212: {
1576
		*n_args = 0;
1577
		break;
1578
	}
1579
	/* linux_epoll_create */
1580
	case 213: {
1581
		struct linux_epoll_create_args *p = params;
1582
		iarg[0] = p->size; /* l_int */
1583
		*n_args = 1;
1584
		break;
1585
	}
1586
	/* linux_epoll_ctl_old */
1587
	case 214: {
1588
		*n_args = 0;
1589
		break;
1590
	}
1591
	/* linux_epoll_wait_old */
1592
	case 215: {
1593
		*n_args = 0;
1594
		break;
1595
	}
1596
	/* linux_remap_file_pages */
1597
	case 216: {
1598
		*n_args = 0;
1599
		break;
1600
	}
1601
	/* linux_getdents64 */
1602
	case 217: {
1603
		struct linux_getdents64_args *p = params;
1604
		iarg[0] = p->fd; /* l_uint */
1605
		uarg[1] = (intptr_t) p->dirent; /* void * */
1606
		iarg[2] = p->count; /* l_uint */
1607
		*n_args = 3;
1608
		break;
1609
	}
1610
	/* linux_set_tid_address */
1611
	case 218: {
1612
		struct linux_set_tid_address_args *p = params;
1613
		uarg[0] = (intptr_t) p->tidptr; /* int * */
1614
		*n_args = 1;
1615
		break;
1616
	}
1617
	/* linux_semtimedop */
1618
	case 220: {
1619
		*n_args = 0;
1620
		break;
1621
	}
1622
	/* linux_fadvise64 */
1623
	case 221: {
1624
		struct linux_fadvise64_args *p = params;
1625
		iarg[0] = p->fd; /* int */
1626
		iarg[1] = p->offset; /* l_loff_t */
1627
		iarg[2] = p->len; /* l_size_t */
1628
		iarg[3] = p->advice; /* int */
1629
		*n_args = 4;
1630
		break;
1631
	}
1632
	/* linux_timer_create */
1633
	case 222: {
1634
		struct linux_timer_create_args *p = params;
1635
		iarg[0] = p->clock_id; /* clockid_t */
1636
		uarg[1] = (intptr_t) p->evp; /* struct sigevent * */
1637
		uarg[2] = (intptr_t) p->timerid; /* l_timer_t * */
1638
		*n_args = 3;
1639
		break;
1640
	}
1641
	/* linux_timer_settime */
1642
	case 223: {
1643
		struct linux_timer_settime_args *p = params;
1644
		iarg[0] = p->timerid; /* l_timer_t */
1645
		iarg[1] = p->flags; /* l_int */
1646
		uarg[2] = (intptr_t) p->new; /* const struct itimerspec * */
1647
		uarg[3] = (intptr_t) p->old; /* struct itimerspec * */
1648
		*n_args = 4;
1649
		break;
1650
	}
1651
	/* linux_timer_gettime */
1652
	case 224: {
1653
		struct linux_timer_gettime_args *p = params;
1654
		iarg[0] = p->timerid; /* l_timer_t */
1655
		uarg[1] = (intptr_t) p->setting; /* struct itimerspec * */
1656
		*n_args = 2;
1657
		break;
1658
	}
1659
	/* linux_timer_getoverrun */
1660
	case 225: {
1661
		struct linux_timer_getoverrun_args *p = params;
1662
		iarg[0] = p->timerid; /* l_timer_t */
1663
		*n_args = 1;
1664
		break;
1665
	}
1666
	/* linux_timer_delete */
1667
	case 226: {
1668
		struct linux_timer_delete_args *p = params;
1669
		iarg[0] = p->timerid; /* l_timer_t */
1670
		*n_args = 1;
1671
		break;
1672
	}
1673
	/* linux_clock_settime */
1674
	case 227: {
1675
		struct linux_clock_settime_args *p = params;
1676
		iarg[0] = p->which; /* clockid_t */
1677
		uarg[1] = (intptr_t) p->tp; /* struct l_timespec * */
1678
		*n_args = 2;
1679
		break;
1680
	}
1681
	/* linux_clock_gettime */
1682
	case 228: {
1683
		struct linux_clock_gettime_args *p = params;
1684
		iarg[0] = p->which; /* clockid_t */
1685
		uarg[1] = (intptr_t) p->tp; /* struct l_timespec * */
1686
		*n_args = 2;
1687
		break;
1688
	}
1689
	/* linux_clock_getres */
1690
	case 229: {
1691
		struct linux_clock_getres_args *p = params;
1692
		iarg[0] = p->which; /* clockid_t */
1693
		uarg[1] = (intptr_t) p->tp; /* struct l_timespec * */
1694
		*n_args = 2;
1695
		break;
1696
	}
1697
	/* linux_clock_nanosleep */
1698
	case 230: {
1699
		struct linux_clock_nanosleep_args *p = params;
1700
		iarg[0] = p->which; /* clockid_t */
1701
		iarg[1] = p->flags; /* int */
1702
		uarg[2] = (intptr_t) p->rqtp; /* struct l_timespec * */
1703
		uarg[3] = (intptr_t) p->rmtp; /* struct l_timespec * */
1704
		*n_args = 4;
1705
		break;
1706
	}
1707
	/* linux_exit_group */
1708
	case 231: {
1709
		struct linux_exit_group_args *p = params;
1710
		iarg[0] = p->error_code; /* int */
1711
		*n_args = 1;
1712
		break;
1713
	}
1714
	/* linux_epoll_wait */
1715
	case 232: {
1716
		struct linux_epoll_wait_args *p = params;
1717
		iarg[0] = p->epfd; /* l_int */
1718
		uarg[1] = (intptr_t) p->events; /* struct epoll_event * */
1719
		iarg[2] = p->maxevents; /* l_int */
1720
		iarg[3] = p->timeout; /* l_int */
1721
		*n_args = 4;
1722
		break;
1723
	}
1724
	/* linux_epoll_ctl */
1725
	case 233: {
1726
		struct linux_epoll_ctl_args *p = params;
1727
		iarg[0] = p->epfd; /* l_int */
1728
		iarg[1] = p->op; /* l_int */
1729
		iarg[2] = p->fd; /* l_int */
1730
		uarg[3] = (intptr_t) p->event; /* struct epoll_event * */
1731
		*n_args = 4;
1732
		break;
1733
	}
1734
	/* linux_tgkill */
1735
	case 234: {
1736
		struct linux_tgkill_args *p = params;
1737
		iarg[0] = p->tgid; /* int */
1738
		iarg[1] = p->pid; /* int */
1739
		iarg[2] = p->sig; /* int */
1740
		*n_args = 3;
1741
		break;
1742
	}
1743
	/* linux_utimes */
1744
	case 235: {
1745
		struct linux_utimes_args *p = params;
1746
		uarg[0] = (intptr_t) p->fname; /* char * */
1747
		uarg[1] = (intptr_t) p->tptr; /* struct l_timeval * */
1748
		*n_args = 2;
1749
		break;
1750
	}
1751
	/* linux_mbind */
1752
	case 237: {
1753
		*n_args = 0;
1754
		break;
1755
	}
1756
	/* linux_set_mempolicy */
1757
	case 238: {
1758
		*n_args = 0;
1759
		break;
1760
	}
1761
	/* linux_get_mempolicy */
1762
	case 239: {
1763
		*n_args = 0;
1764
		break;
1765
	}
1766
	/* linux_mq_open */
1767
	case 240: {
1768
		*n_args = 0;
1769
		break;
1770
	}
1771
	/* linux_mq_unlink */
1772
	case 241: {
1773
		*n_args = 0;
1774
		break;
1775
	}
1776
	/* linux_mq_timedsend */
1777
	case 242: {
1778
		*n_args = 0;
1779
		break;
1780
	}
1781
	/* linux_mq_timedreceive */
1782
	case 243: {
1783
		*n_args = 0;
1784
		break;
1785
	}
1786
	/* linux_mq_notify */
1787
	case 244: {
1788
		*n_args = 0;
1789
		break;
1790
	}
1791
	/* linux_mq_getsetattr */
1792
	case 245: {
1793
		*n_args = 0;
1794
		break;
1795
	}
1796
	/* linux_kexec_load */
1797
	case 246: {
1798
		*n_args = 0;
1799
		break;
1800
	}
1801
	/* linux_waitid */
1802
	case 247: {
1803
		struct linux_waitid_args *p = params;
1804
		iarg[0] = p->idtype; /* int */
1805
		iarg[1] = p->id; /* l_pid_t */
1806
		uarg[2] = (intptr_t) p->info; /* l_siginfo_t * */
1807
		iarg[3] = p->options; /* int */
1808
		uarg[4] = (intptr_t) p->rusage; /* struct l_rusage * */
1809
		*n_args = 5;
1810
		break;
1811
	}
1812
	/* linux_add_key */
1813
	case 248: {
1814
		*n_args = 0;
1815
		break;
1816
	}
1817
	/* linux_request_key */
1818
	case 249: {
1819
		*n_args = 0;
1820
		break;
1821
	}
1822
	/* linux_keyctl */
1823
	case 250: {
1824
		*n_args = 0;
1825
		break;
1826
	}
1827
	/* linux_ioprio_set */
1828
	case 251: {
1829
		*n_args = 0;
1830
		break;
1831
	}
1832
	/* linux_ioprio_get */
1833
	case 252: {
1834
		*n_args = 0;
1835
		break;
1836
	}
1837
	/* linux_inotify_init */
1838
	case 253: {
1839
		*n_args = 0;
1840
		break;
1841
	}
1842
	/* linux_inotify_add_watch */
1843
	case 254: {
1844
		*n_args = 0;
1845
		break;
1846
	}
1847
	/* linux_inotify_rm_watch */
1848
	case 255: {
1849
		*n_args = 0;
1850
		break;
1851
	}
1852
	/* linux_migrate_pages */
1853
	case 256: {
1854
		*n_args = 0;
1855
		break;
1856
	}
1857
	/* linux_openat */
1858
	case 257: {
1859
		struct linux_openat_args *p = params;
1860
		iarg[0] = p->dfd; /* l_int */
1861
		uarg[1] = (intptr_t) p->filename; /* const char * */
1862
		iarg[2] = p->flags; /* l_int */
1863
		iarg[3] = p->mode; /* l_int */
1864
		*n_args = 4;
1865
		break;
1866
	}
1867
	/* linux_mkdirat */
1868
	case 258: {
1869
		struct linux_mkdirat_args *p = params;
1870
		iarg[0] = p->dfd; /* l_int */
1871
		uarg[1] = (intptr_t) p->pathname; /* const char * */
1872
		iarg[2] = p->mode; /* l_int */
1873
		*n_args = 3;
1874
		break;
1875
	}
1876
	/* linux_mknodat */
1877
	case 259: {
1878
		struct linux_mknodat_args *p = params;
1879
		iarg[0] = p->dfd; /* l_int */
1880
		uarg[1] = (intptr_t) p->filename; /* const char * */
1881
		iarg[2] = p->mode; /* l_int */
1882
		iarg[3] = p->dev; /* l_uint */
1883
		*n_args = 4;
1884
		break;
1885
	}
1886
	/* linux_fchownat */
1887
	case 260: {
1888
		struct linux_fchownat_args *p = params;
1889
		iarg[0] = p->dfd; /* l_int */
1890
		uarg[1] = (intptr_t) p->filename; /* const char * */
1891
		iarg[2] = p->uid; /* l_uid_t */
1892
		iarg[3] = p->gid; /* l_gid_t */
1893
		iarg[4] = p->flag; /* l_int */
1894
		*n_args = 5;
1895
		break;
1896
	}
1897
	/* linux_futimesat */
1898
	case 261: {
1899
		struct linux_futimesat_args *p = params;
1900
		iarg[0] = p->dfd; /* l_int */
1901
		uarg[1] = (intptr_t) p->filename; /* char * */
1902
		uarg[2] = (intptr_t) p->utimes; /* struct l_timeval * */
1903
		*n_args = 3;
1904
		break;
1905
	}
1906
	/* linux_newfstatat */
1907
	case 262: {
1908
		struct linux_newfstatat_args *p = params;
1909
		iarg[0] = p->dfd; /* l_int */
1910
		uarg[1] = (intptr_t) p->pathname; /* char * */
1911
		uarg[2] = (intptr_t) p->statbuf; /* struct l_stat64 * */
1912
		iarg[3] = p->flag; /* l_int */
1913
		*n_args = 4;
1914
		break;
1915
	}
1916
	/* linux_unlinkat */
1917
	case 263: {
1918
		struct linux_unlinkat_args *p = params;
1919
		iarg[0] = p->dfd; /* l_int */
1920
		uarg[1] = (intptr_t) p->pathname; /* const char * */
1921
		iarg[2] = p->flag; /* l_int */
1922
		*n_args = 3;
1923
		break;
1924
	}
1925
	/* linux_renameat */
1926
	case 264: {
1927
		struct linux_renameat_args *p = params;
1928
		iarg[0] = p->olddfd; /* l_int */
1929
		uarg[1] = (intptr_t) p->oldname; /* const char * */
1930
		iarg[2] = p->newdfd; /* l_int */
1931
		uarg[3] = (intptr_t) p->newname; /* const char * */
1932
		*n_args = 4;
1933
		break;
1934
	}
1935
	/* linux_linkat */
1936
	case 265: {
1937
		struct linux_linkat_args *p = params;
1938
		iarg[0] = p->olddfd; /* l_int */
1939
		uarg[1] = (intptr_t) p->oldname; /* const char * */
1940
		iarg[2] = p->newdfd; /* l_int */
1941
		uarg[3] = (intptr_t) p->newname; /* const char * */
1942
		iarg[4] = p->flag; /* l_int */
1943
		*n_args = 5;
1944
		break;
1945
	}
1946
	/* linux_symlinkat */
1947
	case 266: {
1948
		struct linux_symlinkat_args *p = params;
1949
		uarg[0] = (intptr_t) p->oldname; /* const char * */
1950
		iarg[1] = p->newdfd; /* l_int */
1951
		uarg[2] = (intptr_t) p->newname; /* const char * */
1952
		*n_args = 3;
1953
		break;
1954
	}
1955
	/* linux_readlinkat */
1956
	case 267: {
1957
		struct linux_readlinkat_args *p = params;
1958
		iarg[0] = p->dfd; /* l_int */
1959
		uarg[1] = (intptr_t) p->path; /* const char * */
1960
		uarg[2] = (intptr_t) p->buf; /* char * */
1961
		iarg[3] = p->bufsiz; /* l_int */
1962
		*n_args = 4;
1963
		break;
1964
	}
1965
	/* linux_fchmodat */
1966
	case 268: {
1967
		struct linux_fchmodat_args *p = params;
1968
		iarg[0] = p->dfd; /* l_int */
1969
		uarg[1] = (intptr_t) p->filename; /* const char * */
1970
		iarg[2] = p->mode; /* l_mode_t */
1971
		*n_args = 3;
1972
		break;
1973
	}
1974
	/* linux_faccessat */
1975
	case 269: {
1976
		struct linux_faccessat_args *p = params;
1977
		iarg[0] = p->dfd; /* l_int */
1978
		uarg[1] = (intptr_t) p->filename; /* const char * */
1979
		iarg[2] = p->amode; /* l_int */
1980
		*n_args = 3;
1981
		break;
1982
	}
1983
	/* linux_pselect6 */
1984
	case 270: {
1985
		struct linux_pselect6_args *p = params;
1986
		iarg[0] = p->nfds; /* l_int */
1987
		uarg[1] = (intptr_t) p->readfds; /* l_fd_set * */
1988
		uarg[2] = (intptr_t) p->writefds; /* l_fd_set * */
1989
		uarg[3] = (intptr_t) p->exceptfds; /* l_fd_set * */
1990
		uarg[4] = (intptr_t) p->tsp; /* struct l_timespec * */
1991
		uarg[5] = (intptr_t) p->sig; /* l_uintptr_t * */
1992
		*n_args = 6;
1993
		break;
1994
	}
1995
	/* linux_ppoll */
1996
	case 271: {
1997
		struct linux_ppoll_args *p = params;
1998
		uarg[0] = (intptr_t) p->fds; /* struct pollfd * */
1999
		uarg[1] = p->nfds; /* uint32_t */
2000
		uarg[2] = (intptr_t) p->tsp; /* struct l_timespec * */
2001
		uarg[3] = (intptr_t) p->sset; /* l_sigset_t * */
2002
		iarg[4] = p->ssize; /* l_size_t */
2003
		*n_args = 5;
2004
		break;
2005
	}
2006
	/* linux_unshare */
2007
	case 272: {
2008
		*n_args = 0;
2009
		break;
2010
	}
2011
	/* linux_set_robust_list */
2012
	case 273: {
2013
		struct linux_set_robust_list_args *p = params;
2014
		uarg[0] = (intptr_t) p->head; /* struct linux_robust_list_head * */
2015
		iarg[1] = p->len; /* l_size_t */
2016
		*n_args = 2;
2017
		break;
2018
	}
2019
	/* linux_get_robust_list */
2020
	case 274: {
2021
		struct linux_get_robust_list_args *p = params;
2022
		iarg[0] = p->pid; /* l_int */
2023
		uarg[1] = (intptr_t) p->head; /* struct linux_robust_list_head * */
2024
		uarg[2] = (intptr_t) p->len; /* l_size_t * */
2025
		*n_args = 3;
2026
		break;
2027
	}
2028
	/* linux_splice */
2029
	case 275: {
2030
		*n_args = 0;
2031
		break;
2032
	}
2033
	/* linux_tee */
2034
	case 276: {
2035
		*n_args = 0;
2036
		break;
2037
	}
2038
	/* linux_sync_file_range */
2039
	case 277: {
2040
		*n_args = 0;
2041
		break;
2042
	}
2043
	/* linux_vmsplice */
2044
	case 278: {
2045
		*n_args = 0;
2046
		break;
2047
	}
2048
	/* linux_move_pages */
2049
	case 279: {
2050
		*n_args = 0;
2051
		break;
2052
	}
2053
	/* linux_utimensat */
2054
	case 280: {
2055
		struct linux_utimensat_args *p = params;
2056
		iarg[0] = p->dfd; /* l_int */
2057
		uarg[1] = (intptr_t) p->pathname; /* const char * */
2058
		uarg[2] = (intptr_t) p->times; /* const struct l_timespec * */
2059
		iarg[3] = p->flags; /* l_int */
2060
		*n_args = 4;
2061
		break;
2062
	}
2063
	/* linux_epoll_pwait */
2064
	case 281: {
2065
		struct linux_epoll_pwait_args *p = params;
2066
		iarg[0] = p->epfd; /* l_int */
2067
		uarg[1] = (intptr_t) p->events; /* struct epoll_event * */
2068
		iarg[2] = p->maxevents; /* l_int */
2069
		iarg[3] = p->timeout; /* l_int */
2070
		uarg[4] = (intptr_t) p->mask; /* l_sigset_t * */
2071
		*n_args = 5;
2072
		break;
2073
	}
2074
	/* linux_signalfd */
2075
	case 282: {
2076
		*n_args = 0;
2077
		break;
2078
	}
2079
	/* linux_timerfd */
2080
	case 283: {
2081
		*n_args = 0;
2082
		break;
2083
	}
2084
	/* linux_eventfd */
2085
	case 284: {
2086
		struct linux_eventfd_args *p = params;
2087
		iarg[0] = p->initval; /* l_uint */
2088
		*n_args = 1;
2089
		break;
2090
	}
2091
	/* linux_fallocate */
2092
	case 285: {
2093
		struct linux_fallocate_args *p = params;
2094
		iarg[0] = p->fd; /* l_int */
2095
		iarg[1] = p->mode; /* l_int */
2096
		iarg[2] = p->offset; /* l_loff_t */
2097
		iarg[3] = p->len; /* l_loff_t */
2098
		*n_args = 4;
2099
		break;
2100
	}
2101
	/* linux_timerfd_settime */
2102
	case 286: {
2103
		*n_args = 0;
2104
		break;
2105
	}
2106
	/* linux_timerfd_gettime */
2107
	case 287: {
2108
		*n_args = 0;
2109
		break;
2110
	}
2111
	/* linux_accept4 */
2112
	case 288: {
2113
		struct linux_accept4_args *p = params;
2114
		iarg[0] = p->s; /* l_int */
2115
		iarg[1] = p->addr; /* l_uintptr_t */
2116
		iarg[2] = p->namelen; /* l_uintptr_t */
2117
		iarg[3] = p->flags; /* int */
2118
		*n_args = 4;
2119
		break;
2120
	}
2121
	/* linux_signalfd4 */
2122
	case 289: {
2123
		*n_args = 0;
2124
		break;
2125
	}
2126
	/* linux_eventfd2 */
2127
	case 290: {
2128
		struct linux_eventfd2_args *p = params;
2129
		iarg[0] = p->initval; /* l_uint */
2130
		iarg[1] = p->flags; /* l_int */
2131
		*n_args = 2;
2132
		break;
2133
	}
2134
	/* linux_epoll_create1 */
2135
	case 291: {
2136
		struct linux_epoll_create1_args *p = params;
2137
		iarg[0] = p->flags; /* l_int */
2138
		*n_args = 1;
2139
		break;
2140
	}
2141
	/* linux_dup3 */
2142
	case 292: {
2143
		struct linux_dup3_args *p = params;
2144
		iarg[0] = p->oldfd; /* l_int */
2145
		iarg[1] = p->newfd; /* l_int */
2146
		iarg[2] = p->flags; /* l_int */
2147
		*n_args = 3;
2148
		break;
2149
	}
2150
	/* linux_pipe2 */
2151
	case 293: {
2152
		struct linux_pipe2_args *p = params;
2153
		uarg[0] = (intptr_t) p->pipefds; /* l_int * */
2154
		iarg[1] = p->flags; /* l_int */
2155
		*n_args = 2;
2156
		break;
2157
	}
2158
	/* linux_inotify_init1 */
2159
	case 294: {
2160
		*n_args = 0;
2161
		break;
2162
	}
2163
	/* linux_preadv */
2164
	case 295: {
2165
		*n_args = 0;
2166
		break;
2167
	}
2168
	/* linux_pwritev */
2169
	case 296: {
2170
		*n_args = 0;
2171
		break;
2172
	}
2173
	/* linux_rt_tsigqueueinfo */
2174
	case 297: {
2175
		*n_args = 0;
2176
		break;
2177
	}
2178
	/* linux_perf_event_open */
2179
	case 298: {
2180
		*n_args = 0;
2181
		break;
2182
	}
2183
	/* linux_recvmmsg */
2184
	case 299: {
2185
		struct linux_recvmmsg_args *p = params;
2186
		iarg[0] = p->s; /* l_int */
2187
		uarg[1] = (intptr_t) p->msg; /* struct l_mmsghdr * */
2188
		iarg[2] = p->vlen; /* l_uint */
2189
		iarg[3] = p->flags; /* l_uint */
2190
		uarg[4] = (intptr_t) p->timeout; /* struct l_timespec * */
2191
		*n_args = 5;
2192
		break;
2193
	}
2194
	/* linux_fanotify_init */
2195
	case 300: {
2196
		*n_args = 0;
2197
		break;
2198
	}
2199
	/* linux_fanotify_mark */
2200
	case 301: {
2201
		*n_args = 0;
2202
		break;
2203
	}
2204
	/* linux_prlimit64 */
2205
	case 302: {
2206
		struct linux_prlimit64_args *p = params;
2207
		iarg[0] = p->pid; /* l_pid_t */
2208
		iarg[1] = p->resource; /* l_uint */
2209
		uarg[2] = (intptr_t) p->new; /* struct rlimit * */
2210
		uarg[3] = (intptr_t) p->old; /* struct rlimit * */
2211
		*n_args = 4;
2212
		break;
2213
	}
2214
	/* linux_name_to_handle_at */
2215
	case 303: {
2216
		*n_args = 0;
2217
		break;
2218
	}
2219
	/* linux_open_by_handle_at */
2220
	case 304: {
2221
		*n_args = 0;
2222
		break;
2223
	}
2224
	/* linux_clock_adjtime */
2225
	case 305: {
2226
		*n_args = 0;
2227
		break;
2228
	}
2229
	/* linux_syncfs */
2230
	case 306: {
2231
		struct linux_syncfs_args *p = params;
2232
		iarg[0] = p->fd; /* l_int */
2233
		*n_args = 1;
2234
		break;
2235
	}
2236
	/* linux_sendmmsg */
2237
	case 307: {
2238
		struct linux_sendmmsg_args *p = params;
2239
		iarg[0] = p->s; /* l_int */
2240
		uarg[1] = (intptr_t) p->msg; /* struct l_mmsghdr * */
2241
		iarg[2] = p->vlen; /* l_uint */
2242
		iarg[3] = p->flags; /* l_uint */
2243
		*n_args = 4;
2244
		break;
2245
	}
2246
	/* linux_setns */
2247
	case 308: {
2248
		*n_args = 0;
2249
		break;
2250
	}
2251
	/* linux_process_vm_readv */
2252
	case 309: {
2253
		*n_args = 0;
2254
		break;
2255
	}
2256
	/* linux_process_vm_writev */
2257
	case 310: {
2258
		*n_args = 0;
2259
		break;
2260
	}
2261
	/* linux_kcmp */
2262
	case 311: {
2263
		*n_args = 0;
2264
		break;
2265
	}
2266
	/* linux_finit_module */
2267
	case 312: {
2268
		*n_args = 0;
2269
		break;
2270
	}
2271
	default:
2272
		*n_args = 0;
2273
		break;
2274
	};
2275
}
2276
static void
2277
systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
2278
{
2279
	const char *p = NULL;
2280
	switch (sysnum) {
2281
#define	nosys	linux_nosys
2282
	/* read */
2283
	case 0:
2284
		switch(ndx) {
2285
		case 0:
2286
			p = "int";
2287
			break;
2288
		case 1:
2289
			p = "char *";
2290
			break;
2291
		case 2:
2292
			p = "u_int";
2293
			break;
2294
		default:
2295
			break;
2296
		};
2297
		break;
2298
	/* write */
2299
	case 1:
2300
		switch(ndx) {
2301
		case 0:
2302
			p = "int";
2303
			break;
2304
		case 1:
2305
			p = "char *";
2306
			break;
2307
		case 2:
2308
			p = "u_int";
2309
			break;
2310
		default:
2311
			break;
2312
		};
2313
		break;
2314
	/* linux_open */
2315
	case 2:
2316
		switch(ndx) {
2317
		case 0:
2318
			p = "char *";
2319
			break;
2320
		case 1:
2321
			p = "l_int";
2322
			break;
2323
		case 2:
2324
			p = "l_int";
2325
			break;
2326
		default:
2327
			break;
2328
		};
2329
		break;
2330
	/* close */
2331
	case 3:
2332
		switch(ndx) {
2333
		case 0:
2334
			p = "int";
2335
			break;
2336
		default:
2337
			break;
2338
		};
2339
		break;
2340
	/* linux_newstat */
2341
	case 4:
2342
		switch(ndx) {
2343
		case 0:
2344
			p = "char *";
2345
			break;
2346
		case 1:
2347
			p = "struct l_newstat *";
2348
			break;
2349
		default:
2350
			break;
2351
		};
2352
		break;
2353
	/* linux_newfstat */
2354
	case 5:
2355
		switch(ndx) {
2356
		case 0:
2357
			p = "l_uint";
2358
			break;
2359
		case 1:
2360
			p = "struct l_newstat *";
2361
			break;
2362
		default:
2363
			break;
2364
		};
2365
		break;
2366
	/* linux_newlstat */
2367
	case 6:
2368
		switch(ndx) {
2369
		case 0:
2370
			p = "char *";
2371
			break;
2372
		case 1:
2373
			p = "struct l_newstat *";
2374
			break;
2375
		default:
2376
			break;
2377
		};
2378
		break;
2379
	/* poll */
2380
	case 7:
2381
		switch(ndx) {
2382
		case 0:
2383
			p = "struct pollfd";
2384
			break;
2385
		case 1:
2386
			p = "unsigned int";
2387
			break;
2388
		case 2:
2389
			p = "int";
2390
			break;
2391
		default:
2392
			break;
2393
		};
2394
		break;
2395
	/* linux_lseek */
2396
	case 8:
2397
		switch(ndx) {
2398
		case 0:
2399
			p = "l_uint";
2400
			break;
2401
		case 1:
2402
			p = "l_off_t";
2403
			break;
2404
		case 2:
2405
			p = "l_int";
2406
			break;
2407
		default:
2408
			break;
2409
		};
2410
		break;
2411
	/* linux_mmap2 */
2412
	case 9:
2413
		switch(ndx) {
2414
		case 0:
2415
			p = "l_ulong";
2416
			break;
2417
		case 1:
2418
			p = "l_ulong";
2419
			break;
2420
		case 2:
2421
			p = "l_ulong";
2422
			break;
2423
		case 3:
2424
			p = "l_ulong";
2425
			break;
2426
		case 4:
2427
			p = "l_ulong";
2428
			break;
2429
		case 5:
2430
			p = "l_ulong";
2431
			break;
2432
		default:
2433
			break;
2434
		};
2435
		break;
2436
	/* linux_mprotect */
2437
	case 10:
2438
		switch(ndx) {
2439
		case 0:
2440
			p = "caddr_t";
2441
			break;
2442
		case 1:
2443
			p = "int";
2444
			break;
2445
		case 2:
2446
			p = "int";
2447
			break;
2448
		default:
2449
			break;
2450
		};
2451
		break;
2452
	/* munmap */
2453
	case 11:
2454
		switch(ndx) {
2455
		case 0:
2456
			p = "caddr_t";
2457
			break;
2458
		case 1:
2459
			p = "int";
2460
			break;
2461
		default:
2462
			break;
2463
		};
2464
		break;
2465
	/* linux_brk */
2466
	case 12:
2467
		switch(ndx) {
2468
		case 0:
2469
			p = "l_ulong";
2470
			break;
2471
		default:
2472
			break;
2473
		};
2474
		break;
2475
	/* linux_rt_sigaction */
2476
	case 13:
2477
		switch(ndx) {
2478
		case 0:
2479
			p = "l_int";
2480
			break;
2481
		case 1:
2482
			p = "l_sigaction_t *";
2483
			break;
2484
		case 2:
2485
			p = "l_sigaction_t *";
2486
			break;
2487
		case 3:
2488
			p = "l_size_t";
2489
			break;
2490
		default:
2491
			break;
2492
		};
2493
		break;
2494
	/* linux_rt_sigprocmask */
2495
	case 14:
2496
		switch(ndx) {
2497
		case 0:
2498
			p = "l_int";
2499
			break;
2500
		case 1:
2501
			p = "l_sigset_t *";
2502
			break;
2503
		case 2:
2504
			p = "l_sigset_t *";
2505
			break;
2506
		case 3:
2507
			p = "l_size_t";
2508
			break;
2509
		default:
2510
			break;
2511
		};
2512
		break;
2513
	/* linux_rt_sigreturn */
2514
	case 15:
2515
		switch(ndx) {
2516
		case 0:
2517
			p = "struct l_ucontext *";
2518
			break;
2519
		default:
2520
			break;
2521
		};
2522
		break;
2523
	/* linux_ioctl */
2524
	case 16:
2525
		switch(ndx) {
2526
		case 0:
2527
			p = "l_uint";
2528
			break;
2529
		case 1:
2530
			p = "l_uint";
2531
			break;
2532
		case 2:
2533
			p = "uintptr_t";
2534
			break;
2535
		default:
2536
			break;
2537
		};
2538
		break;
2539
	/* linux_pread */
2540
	case 17:
2541
		switch(ndx) {
2542
		case 0:
2543
			p = "l_uint";
2544
			break;
2545
		case 1:
2546
			p = "char *";
2547
			break;
2548
		case 2:
2549
			p = "l_size_t";
2550
			break;
2551
		case 3:
2552
			p = "l_loff_t";
2553
			break;
2554
		default:
2555
			break;
2556
		};
2557
		break;
2558
	/* linux_pwrite */
2559
	case 18:
2560
		switch(ndx) {
2561
		case 0:
2562
			p = "l_uint";
2563
			break;
2564
		case 1:
2565
			p = "char *";
2566
			break;
2567
		case 2:
2568
			p = "l_size_t";
2569
			break;
2570
		case 3:
2571
			p = "l_loff_t";
2572
			break;
2573
		default:
2574
			break;
2575
		};
2576
		break;
2577
	/* readv */
2578
	case 19:
2579
		switch(ndx) {
2580
		case 0:
2581
			p = "int";
2582
			break;
2583
		case 1:
2584
			p = "struct iovec *";
2585
			break;
2586
		case 2:
2587
			p = "u_int";
2588
			break;
2589
		default:
2590
			break;
2591
		};
2592
		break;
2593
	/* writev */
2594
	case 20:
2595
		switch(ndx) {
2596
		case 0:
2597
			p = "int";
2598
			break;
2599
		case 1:
2600
			p = "struct iovec *";
2601
			break;
2602
		case 2:
2603
			p = "u_int";
2604
			break;
2605
		default:
2606
			break;
2607
		};
2608
		break;
2609
	/* linux_access */
2610
	case 21:
2611
		switch(ndx) {
2612
		case 0:
2613
			p = "char *";
2614
			break;
2615
		case 1:
2616
			p = "l_int";
2617
			break;
2618
		default:
2619
			break;
2620
		};
2621
		break;
2622
	/* linux_pipe */
2623
	case 22:
2624
		switch(ndx) {
2625
		case 0:
2626
			p = "l_ulong *";
2627
			break;
2628
		default:
2629
			break;
2630
		};
2631
		break;
2632
	/* linux_select */
2633
	case 23:
2634
		switch(ndx) {
2635
		case 0:
2636
			p = "l_int";
2637
			break;
2638
		case 1:
2639
			p = "l_fd_set *";
2640
			break;
2641
		case 2:
2642
			p = "l_fd_set *";
2643
			break;
2644
		case 3:
2645
			p = "l_fd_set *";
2646
			break;
2647
		case 4:
2648
			p = "struct l_timeval *";
2649
			break;
2650
		default:
2651
			break;
2652
		};
2653
		break;
2654
	/* sched_yield */
2655
	case 24:
2656
		break;
2657
	/* linux_mremap */
2658
	case 25:
2659
		switch(ndx) {
2660
		case 0:
2661
			p = "l_ulong";
2662
			break;
2663
		case 1:
2664
			p = "l_ulong";
2665
			break;
2666
		case 2:
2667
			p = "l_ulong";
2668
			break;
2669
		case 3:
2670
			p = "l_ulong";
2671
			break;
2672
		case 4:
2673
			p = "l_ulong";
2674
			break;
2675
		default:
2676
			break;
2677
		};
2678
		break;
2679
	/* linux_msync */
2680
	case 26:
2681
		switch(ndx) {
2682
		case 0:
2683
			p = "l_ulong";
2684
			break;
2685
		case 1:
2686
			p = "l_size_t";
2687
			break;
2688
		case 2:
2689
			p = "l_int";
2690
			break;
2691
		default:
2692
			break;
2693
		};
2694
		break;
2695
	/* linux_mincore */
2696
	case 27:
2697
		switch(ndx) {
2698
		case 0:
2699
			p = "l_ulong";
2700
			break;
2701
		case 1:
2702
			p = "l_size_t";
2703
			break;
2704
		case 2:
2705
			p = "u_char *";
2706
			break;
2707
		default:
2708
			break;
2709
		};
2710
		break;
2711
	/* madvise */
2712
	case 28:
2713
		switch(ndx) {
2714
		case 0:
2715
			p = "void *";
2716
			break;
2717
		case 1:
2718
			p = "size_t";
2719
			break;
2720
		case 2:
2721
			p = "int";
2722
			break;
2723
		default:
2724
			break;
2725
		};
2726
		break;
2727
	/* linux_shmget */
2728
	case 29:
2729
		switch(ndx) {
2730
		case 0:
2731
			p = "l_key_t";
2732
			break;
2733
		case 1:
2734
			p = "l_size_t";
2735
			break;
2736
		case 2:
2737
			p = "l_int";
2738
			break;
2739
		default:
2740
			break;
2741
		};
2742
		break;
2743
	/* linux_shmat */
2744
	case 30:
2745
		switch(ndx) {
2746
		case 0:
2747
			p = "l_int";
2748
			break;
2749
		case 1:
2750
			p = "char *";
2751
			break;
2752
		case 2:
2753
			p = "l_int";
2754
			break;
2755
		default:
2756
			break;
2757
		};
2758
		break;
2759
	/* linux_shmctl */
2760
	case 31:
2761
		switch(ndx) {
2762
		case 0:
2763
			p = "l_int";
2764
			break;
2765
		case 1:
2766
			p = "l_int";
2767
			break;
2768
		case 2:
2769
			p = "struct l_shmid_ds *";
2770
			break;
2771
		default:
2772
			break;
2773
		};
2774
		break;
2775
	/* dup */
2776
	case 32:
2777
		switch(ndx) {
2778
		case 0:
2779
			p = "u_int";
2780
			break;
2781
		default:
2782
			break;
2783
		};
2784
		break;
2785
	/* dup2 */
2786
	case 33:
2787
		switch(ndx) {
2788
		case 0:
2789
			p = "u_int";
2790
			break;
2791
		case 1:
2792
			p = "u_int";
2793
			break;
2794
		default:
2795
			break;
2796
		};
2797
		break;
2798
	/* linux_pause */
2799
	case 34:
2800
		break;
2801
	/* linux_nanosleep */
2802
	case 35:
2803
		switch(ndx) {
2804
		case 0:
2805
			p = "const struct l_timespec *";
2806
			break;
2807
		case 1:
2808
			p = "struct l_timespec *";
2809
			break;
2810
		default:
2811
			break;
2812
		};
2813
		break;
2814
	/* linux_getitimer */
2815
	case 36:
2816
		switch(ndx) {
2817
		case 0:
2818
			p = "l_int";
2819
			break;
2820
		case 1:
2821
			p = "struct l_itimerval *";
2822
			break;
2823
		default:
2824
			break;
2825
		};
2826
		break;
2827
	/* linux_alarm */
2828
	case 37:
2829
		switch(ndx) {
2830
		case 0:
2831
			p = "l_uint";
2832
			break;
2833
		default:
2834
			break;
2835
		};
2836
		break;
2837
	/* linux_setitimer */
2838
	case 38:
2839
		switch(ndx) {
2840
		case 0:
2841
			p = "l_int";
2842
			break;
2843
		case 1:
2844
			p = "struct l_itimerval *";
2845
			break;
2846
		case 2:
2847
			p = "struct l_itimerval *";
2848
			break;
2849
		default:
2850
			break;
2851
		};
2852
		break;
2853
	/* linux_getpid */
2854
	case 39:
2855
		break;
2856
	/* linux_sendfile */
2857
	case 40:
2858
		switch(ndx) {
2859
		case 0:
2860
			p = "int";
2861
			break;
2862
		case 1:
2863
			p = "int";
2864
			break;
2865
		case 2:
2866
			p = "l_long *";
2867
			break;
2868
		case 3:
2869
			p = "l_size_t";
2870
			break;
2871
		default:
2872
			break;
2873
		};
2874
		break;
2875
	/* linux_socket */
2876
	case 41:
2877
		switch(ndx) {
2878
		case 0:
2879
			p = "l_int";
2880
			break;
2881
		case 1:
2882
			p = "l_int";
2883
			break;
2884
		case 2:
2885
			p = "l_int";
2886
			break;
2887
		default:
2888
			break;
2889
		};
2890
		break;
2891
	/* linux_connect */
2892
	case 42:
2893
		switch(ndx) {
2894
		case 0:
2895
			p = "l_int";
2896
			break;
2897
		case 1:
2898
			p = "l_uintptr_t";
2899
			break;
2900
		case 2:
2901
			p = "l_int";
2902
			break;
2903
		default:
2904
			break;
2905
		};
2906
		break;
2907
	/* linux_accept */
2908
	case 43:
2909
		switch(ndx) {
2910
		case 0:
2911
			p = "l_int";
2912
			break;
2913
		case 1:
2914
			p = "l_uintptr_t";
2915
			break;
2916
		case 2:
2917
			p = "l_uintptr_t";
2918
			break;
2919
		default:
2920
			break;
2921
		};
2922
		break;
2923
	/* linux_sendto */
2924
	case 44:
2925
		switch(ndx) {
2926
		case 0:
2927
			p = "l_int";
2928
			break;
2929
		case 1:
2930
			p = "l_uintptr_t";
2931
			break;
2932
		case 2:
2933
			p = "l_int";
2934
			break;
2935
		case 3:
2936
			p = "l_int";
2937
			break;
2938
		case 4:
2939
			p = "l_uintptr_t";
2940
			break;
2941
		case 5:
2942
			p = "l_int";
2943
			break;
2944
		default:
2945
			break;
2946
		};
2947
		break;
2948
	/* linux_recvfrom */
2949
	case 45:
2950
		switch(ndx) {
2951
		case 0:
2952
			p = "l_int";
2953
			break;
2954
		case 1:
2955
			p = "l_uintptr_t";
2956
			break;
2957
		case 2:
2958
			p = "l_size_t";
2959
			break;
2960
		case 3:
2961
			p = "l_int";
2962
			break;
2963
		case 4:
2964
			p = "l_uintptr_t";
2965
			break;
2966
		case 5:
2967
			p = "l_uintptr_t";
2968
			break;
2969
		default:
2970
			break;
2971
		};
2972
		break;
2973
	/* linux_sendmsg */
2974
	case 46:
2975
		switch(ndx) {
2976
		case 0:
2977
			p = "l_int";
2978
			break;
2979
		case 1:
2980
			p = "l_uintptr_t";
2981
			break;
2982
		case 2:
2983
			p = "l_int";
2984
			break;
2985
		default:
2986
			break;
2987
		};
2988
		break;
2989
	/* linux_recvmsg */
2990
	case 47:
2991
		switch(ndx) {
2992
		case 0:
2993
			p = "l_int";
2994
			break;
2995
		case 1:
2996
			p = "l_uintptr_t";
2997
			break;
2998
		case 2:
2999
			p = "l_int";
3000
			break;
3001
		default:
3002
			break;
3003
		};
3004
		break;
3005
	/* linux_shutdown */
3006
	case 48:
3007
		switch(ndx) {
3008
		case 0:
3009
			p = "l_int";
3010
			break;
3011
		case 1:
3012
			p = "l_int";
3013
			break;
3014
		default:
3015
			break;
3016
		};
3017
		break;
3018
	/* linux_bind */
3019
	case 49:
3020
		switch(ndx) {
3021
		case 0:
3022
			p = "l_int";
3023
			break;
3024
		case 1:
3025
			p = "l_uintptr_t";
3026
			break;
3027
		case 2:
3028
			p = "l_int";
3029
			break;
3030
		default:
3031
			break;
3032
		};
3033
		break;
3034
	/* linux_listen */
3035
	case 50:
3036
		switch(ndx) {
3037
		case 0:
3038
			p = "l_int";
3039
			break;
3040
		case 1:
3041
			p = "l_int";
3042
			break;
3043
		default:
3044
			break;
3045
		};
3046
		break;
3047
	/* linux_getsockname */
3048
	case 51:
3049
		switch(ndx) {
3050
		case 0:
3051
			p = "l_int";
3052
			break;
3053
		case 1:
3054
			p = "l_uintptr_t";
3055
			break;
3056
		case 2:
3057
			p = "l_uintptr_t";
3058
			break;
3059
		default:
3060
			break;
3061
		};
3062
		break;
3063
	/* linux_getpeername */
3064
	case 52:
3065
		switch(ndx) {
3066
		case 0:
3067
			p = "l_int";
3068
			break;
3069
		case 1:
3070
			p = "l_uintptr_t";
3071
			break;
3072
		case 2:
3073
			p = "l_uintptr_t";
3074
			break;
3075
		default:
3076
			break;
3077
		};
3078
		break;
3079
	/* linux_socketpair */
3080
	case 53:
3081
		switch(ndx) {
3082
		case 0:
3083
			p = "l_int";
3084
			break;
3085
		case 1:
3086
			p = "l_int";
3087
			break;
3088
		case 2:
3089
			p = "l_int";
3090
			break;
3091
		case 3:
3092
			p = "l_uintptr_t";
3093
			break;
3094
		default:
3095
			break;
3096
		};
3097
		break;
3098
	/* linux_setsockopt */
3099
	case 54:
3100
		switch(ndx) {
3101
		case 0:
3102
			p = "l_int";
3103
			break;
3104
		case 1:
3105
			p = "l_int";
3106
			break;
3107
		case 2:
3108
			p = "l_int";
3109
			break;
3110
		case 3:
3111
			p = "l_uintptr_t";
3112
			break;
3113
		case 4:
3114
			p = "l_int";
3115
			break;
3116
		default:
3117
			break;
3118
		};
3119
		break;
3120
	/* linux_getsockopt */
3121
	case 55:
3122
		switch(ndx) {
3123
		case 0:
3124
			p = "l_int";
3125
			break;
3126
		case 1:
3127
			p = "l_int";
3128
			break;
3129
		case 2:
3130
			p = "l_int";
3131
			break;
3132
		case 3:
3133
			p = "l_uintptr_t";
3134
			break;
3135
		case 4:
3136
			p = "l_uintptr_t";
3137
			break;
3138
		default:
3139
			break;
3140
		};
3141
		break;
3142
	/* linux_clone */
3143
	case 56:
3144
		switch(ndx) {
3145
		case 0:
3146
			p = "l_int";
3147
			break;
3148
		case 1:
3149
			p = "void *";
3150
			break;
3151
		case 2:
3152
			p = "void *";
3153
			break;
3154
		case 3:
3155
			p = "void *";
3156
			break;
3157
		case 4:
3158
			p = "void *";
3159
			break;
3160
		default:
3161
			break;
3162
		};
3163
		break;
3164
	/* linux_fork */
3165
	case 57:
3166
		break;
3167
	/* linux_vfork */
3168
	case 58:
3169
		break;
3170
	/* linux_execve */
3171
	case 59:
3172
		switch(ndx) {
3173
		case 0:
3174
			p = "char *";
3175
			break;
3176
		case 1:
3177
			p = "char **";
3178
			break;
3179
		case 2:
3180
			p = "char **";
3181
			break;
3182
		default:
3183
			break;
3184
		};
3185
		break;
3186
	/* linux_exit */
3187
	case 60:
3188
		switch(ndx) {
3189
		case 0:
3190
			p = "int";
3191
			break;
3192
		default:
3193
			break;
3194
		};
3195
		break;
3196
	/* linux_wait4 */
3197
	case 61:
3198
		switch(ndx) {
3199
		case 0:
3200
			p = "l_pid_t";
3201
			break;
3202
		case 1:
3203
			p = "l_int *";
3204
			break;
3205
		case 2:
3206
			p = "l_int";
3207
			break;
3208
		case 3:
3209
			p = "struct l_rusage *";
3210
			break;
3211
		default:
3212
			break;
3213
		};
3214
		break;
3215
	/* linux_kill */
3216
	case 62:
3217
		switch(ndx) {
3218
		case 0:
3219
			p = "l_int";
3220
			break;
3221
		case 1:
3222
			p = "l_int";
3223
			break;
3224
		default:
3225
			break;
3226
		};
3227
		break;
3228
	/* linux_newuname */
3229
	case 63:
3230
		switch(ndx) {
3231
		case 0:
3232
			p = "struct l_new_utsname *";
3233
			break;
3234
		default:
3235
			break;
3236
		};
3237
		break;
3238
	/* linux_semget */
3239
	case 64:
3240
		switch(ndx) {
3241
		case 0:
3242
			p = "l_key_t";
3243
			break;
3244
		case 1:
3245
			p = "l_int";
3246
			break;
3247
		case 2:
3248
			p = "l_int";
3249
			break;
3250
		default:
3251
			break;
3252
		};
3253
		break;
3254
	/* linux_semop */
3255
	case 65:
3256
		switch(ndx) {
3257
		case 0:
3258
			p = "l_int";
3259
			break;
3260
		case 1:
3261
			p = "struct l_sembuf *";
3262
			break;
3263
		case 2:
3264
			p = "l_uint";
3265
			break;
3266
		default:
3267
			break;
3268
		};
3269
		break;
3270
	/* linux_semctl */
3271
	case 66:
3272
		switch(ndx) {
3273
		case 0:
3274
			p = "l_int";
3275
			break;
3276
		case 1:
3277
			p = "l_int";
3278
			break;
3279
		case 2:
3280
			p = "l_int";
3281
			break;
3282
		case 3:
3283
			p = "union l_semun";
3284
			break;
3285
		default:
3286
			break;
3287
		};
3288
		break;
3289
	/* linux_shmdt */
3290
	case 67:
3291
		switch(ndx) {
3292
		case 0:
3293
			p = "char *";
3294
			break;
3295
		default:
3296
			break;
3297
		};
3298
		break;
3299
	/* linux_msgget */
3300
	case 68:
3301
		switch(ndx) {
3302
		case 0:
3303
			p = "l_key_t";
3304
			break;
3305
		case 1:
3306
			p = "l_int";
3307
			break;
3308
		default:
3309
			break;
3310
		};
3311
		break;
3312
	/* linux_msgsnd */
3313
	case 69:
3314
		switch(ndx) {
3315
		case 0:
3316
			p = "l_int";
3317
			break;
3318
		case 1:
3319
			p = "struct l_msgbuf *";
3320
			break;
3321
		case 2:
3322
			p = "l_size_t";
3323
			break;
3324
		case 3:
3325
			p = "l_int";
3326
			break;
3327
		default:
3328
			break;
3329
		};
3330
		break;
3331
	/* linux_msgrcv */
3332
	case 70:
3333
		switch(ndx) {
3334
		case 0:
3335
			p = "l_int";
3336
			break;
3337
		case 1:
3338
			p = "struct l_msgbuf *";
3339
			break;
3340
		case 2:
3341
			p = "l_size_t";
3342
			break;
3343
		case 3:
3344
			p = "l_long";
3345
			break;
3346
		case 4:
3347
			p = "l_int";
3348
			break;
3349
		default:
3350
			break;
3351
		};
3352
		break;
3353
	/* linux_msgctl */
3354
	case 71:
3355
		switch(ndx) {
3356
		case 0:
3357
			p = "l_int";
3358
			break;
3359
		case 1:
3360
			p = "l_int";
3361
			break;
3362
		case 2:
3363
			p = "struct l_msqid_ds *";
3364
			break;
3365
		default:
3366
			break;
3367
		};
3368
		break;
3369
	/* linux_fcntl */
3370
	case 72:
3371
		switch(ndx) {
3372
		case 0:
3373
			p = "l_uint";
3374
			break;
3375
		case 1:
3376
			p = "l_uint";
3377
			break;
3378
		case 2:
3379
			p = "l_ulong";
3380
			break;
3381
		default:
3382
			break;
3383
		};
3384
		break;
3385
	/* flock */
3386
	case 73:
3387
		switch(ndx) {
3388
		case 0:
3389
			p = "int";
3390
			break;
3391
		case 1:
3392
			p = "int";
3393
			break;
3394
		default:
3395
			break;
3396
		};
3397
		break;
3398
	/* fsync */
3399
	case 74:
3400
		switch(ndx) {
3401
		case 0:
3402
			p = "int";
3403
			break;
3404
		default:
3405
			break;
3406
		};
3407
		break;
3408
	/* linux_fdatasync */
3409
	case 75:
3410
		switch(ndx) {
3411
		case 0:
3412
			p = "l_uint";
3413
			break;
3414
		default:
3415
			break;
3416
		};
3417
		break;
3418
	/* linux_truncate */
3419
	case 76:
3420
		switch(ndx) {
3421
		case 0:
3422
			p = "char *";
3423
			break;
3424
		case 1:
3425
			p = "l_ulong";
3426
			break;
3427
		default:
3428
			break;
3429
		};
3430
		break;
3431
	/* linux_ftruncate */
3432
	case 77:
3433
		switch(ndx) {
3434
		case 0:
3435
			p = "l_int";
3436
			break;
3437
		case 1:
3438
			p = "l_long";
3439
			break;
3440
		default:
3441
			break;
3442
		};
3443
		break;
3444
	/* linux_getdents */
3445
	case 78:
3446
		switch(ndx) {
3447
		case 0:
3448
			p = "l_uint";
3449
			break;
3450
		case 1:
3451
			p = "void *";
3452
			break;
3453
		case 2:
3454
			p = "l_uint";
3455
			break;
3456
		default:
3457
			break;
3458
		};
3459
		break;
3460
	/* linux_getcwd */
3461
	case 79:
3462
		switch(ndx) {
3463
		case 0:
3464
			p = "char *";
3465
			break;
3466
		case 1:
3467
			p = "l_ulong";
3468
			break;
3469
		default:
3470
			break;
3471
		};
3472
		break;
3473
	/* linux_chdir */
3474
	case 80:
3475
		switch(ndx) {
3476
		case 0:
3477
			p = "char *";
3478
			break;
3479
		default:
3480
			break;
3481
		};
3482
		break;
3483
	/* fchdir */
3484
	case 81:
3485
		switch(ndx) {
3486
		case 0:
3487
			p = "int";
3488
			break;
3489
		default:
3490
			break;
3491
		};
3492
		break;
3493
	/* linux_rename */
3494
	case 82:
3495
		switch(ndx) {
3496
		case 0:
3497
			p = "char *";
3498
			break;
3499
		case 1:
3500
			p = "char *";
3501
			break;
3502
		default:
3503
			break;
3504
		};
3505
		break;
3506
	/* linux_mkdir */
3507
	case 83:
3508
		switch(ndx) {
3509
		case 0:
3510
			p = "char *";
3511
			break;
3512
		case 1:
3513
			p = "l_int";
3514
			break;
3515
		default:
3516
			break;
3517
		};
3518
		break;
3519
	/* linux_rmdir */
3520
	case 84:
3521
		switch(ndx) {
3522
		case 0:
3523
			p = "char *";
3524
			break;
3525
		default:
3526
			break;
3527
		};
3528
		break;
3529
	/* linux_creat */
3530
	case 85:
3531
		switch(ndx) {
3532
		case 0:
3533
			p = "char *";
3534
			break;
3535
		case 1:
3536
			p = "l_int";
3537
			break;
3538
		default:
3539
			break;
3540
		};
3541
		break;
3542
	/* linux_link */
3543
	case 86:
3544
		switch(ndx) {
3545
		case 0:
3546
			p = "char *";
3547
			break;
3548
		case 1:
3549
			p = "char *";
3550
			break;
3551
		default:
3552
			break;
3553
		};
3554
		break;
3555
	/* linux_unlink */
3556
	case 87:
3557
		switch(ndx) {
3558
		case 0:
3559
			p = "char *";
3560
			break;
3561
		default:
3562
			break;
3563
		};
3564
		break;
3565
	/* linux_symlink */
3566
	case 88:
3567
		switch(ndx) {
3568
		case 0:
3569
			p = "char *";
3570
			break;
3571
		case 1:
3572
			p = "char *";
3573
			break;
3574
		default:
3575
			break;
3576
		};
3577
		break;
3578
	/* linux_readlink */
3579
	case 89:
3580
		switch(ndx) {
3581
		case 0:
3582
			p = "char *";
3583
			break;
3584
		case 1:
3585
			p = "char *";
3586
			break;
3587
		case 2:
3588
			p = "l_int";
3589
			break;
3590
		default:
3591
			break;
3592
		};
3593
		break;
3594
	/* linux_chmod */
3595
	case 90:
3596
		switch(ndx) {
3597
		case 0:
3598
			p = "char *";
3599
			break;
3600
		case 1:
3601
			p = "l_mode_t";
3602
			break;
3603
		default:
3604
			break;
3605
		};
3606
		break;
3607
	/* fchmod */
3608
	case 91:
3609
		switch(ndx) {
3610
		case 0:
3611
			p = "int";
3612
			break;
3613
		case 1:
3614
			p = "int";
3615
			break;
3616
		default:
3617
			break;
3618
		};
3619
		break;
3620
	/* linux_chown */
3621
	case 92:
3622
		switch(ndx) {
3623
		case 0:
3624
			p = "char *";
3625
			break;
3626
		case 1:
3627
			p = "l_uid_t";
3628
			break;
3629
		case 2:
3630
			p = "l_gid_t";
3631
			break;
3632
		default:
3633
			break;
3634
		};
3635
		break;
3636
	/* fchown */
3637
	case 93:
3638
		switch(ndx) {
3639
		case 0:
3640
			p = "int";
3641
			break;
3642
		case 1:
3643
			p = "int";
3644
			break;
3645
		case 2:
3646
			p = "int";
3647
			break;
3648
		default:
3649
			break;
3650
		};
3651
		break;
3652
	/* linux_lchown */
3653
	case 94:
3654
		switch(ndx) {
3655
		case 0:
3656
			p = "char *";
3657
			break;
3658
		case 1:
3659
			p = "l_uid_t";
3660
			break;
3661
		case 2:
3662
			p = "l_gid_t";
3663
			break;
3664
		default:
3665
			break;
3666
		};
3667
		break;
3668
	/* umask */
3669
	case 95:
3670
		switch(ndx) {
3671
		case 0:
3672
			p = "int";
3673
			break;
3674
		default:
3675
			break;
3676
		};
3677
		break;
3678
	/* gettimeofday */
3679
	case 96:
3680
		switch(ndx) {
3681
		case 0:
3682
			p = "struct l_timeval *";
3683
			break;
3684
		case 1:
3685
			p = "struct timezone *";
3686
			break;
3687
		default:
3688
			break;
3689
		};
3690
		break;
3691
	/* linux_getrlimit */
3692
	case 97:
3693
		switch(ndx) {
3694
		case 0:
3695
			p = "l_uint";
3696
			break;
3697
		case 1:
3698
			p = "struct l_rlimit *";
3699
			break;
3700
		default:
3701
			break;
3702
		};
3703
		break;
3704
	/* getrusage */
3705
	case 98:
3706
		switch(ndx) {
3707
		case 0:
3708
			p = "int";
3709
			break;
3710
		case 1:
3711
			p = "struct rusage *";
3712
			break;
3713
		default:
3714
			break;
3715
		};
3716
		break;
3717
	/* linux_sysinfo */
3718
	case 99:
3719
		switch(ndx) {
3720
		case 0:
3721
			p = "struct l_sysinfo *";
3722
			break;
3723
		default:
3724
			break;
3725
		};
3726
		break;
3727
	/* linux_times */
3728
	case 100:
3729
		switch(ndx) {
3730
		case 0:
3731
			p = "struct l_times_argv *";
3732
			break;
3733
		default:
3734
			break;
3735
		};
3736
		break;
3737
	/* linux_ptrace */
3738
	case 101:
3739
		switch(ndx) {
3740
		case 0:
3741
			p = "l_long";
3742
			break;
3743
		case 1:
3744
			p = "l_long";
3745
			break;
3746
		case 2:
3747
			p = "l_long";
3748
			break;
3749
		case 3:
3750
			p = "l_long";
3751
			break;
3752
		default:
3753
			break;
3754
		};
3755
		break;
3756
	/* linux_getuid */
3757
	case 102:
3758
		break;
3759
	/* linux_syslog */
3760
	case 103:
3761
		switch(ndx) {
3762
		case 0:
3763
			p = "l_int";
3764
			break;
3765
		case 1:
3766
			p = "char *";
3767
			break;
3768
		case 2:
3769
			p = "l_int";
3770
			break;
3771
		default:
3772
			break;
3773
		};
3774
		break;
3775
	/* linux_getgid */
3776
	case 104:
3777
		break;
3778
	/* setuid */
3779
	case 105:
3780
		switch(ndx) {
3781
		case 0:
3782
			p = "uid_t";
3783
			break;
3784
		default:
3785
			break;
3786
		};
3787
		break;
3788
	/* setgid */
3789
	case 106:
3790
		switch(ndx) {
3791
		case 0:
3792
			p = "gid_t";
3793
			break;
3794
		default:
3795
			break;
3796
		};
3797
		break;
3798
	/* geteuid */
3799
	case 107:
3800
		break;
3801
	/* getegid */
3802
	case 108:
3803
		break;
3804
	/* setpgid */
3805
	case 109:
3806
		switch(ndx) {
3807
		case 0:
3808
			p = "int";
3809
			break;
3810
		case 1:
3811
			p = "int";
3812
			break;
3813
		default:
3814
			break;
3815
		};
3816
		break;
3817
	/* linux_getppid */
3818
	case 110:
3819
		break;
3820
	/* getpgrp */
3821
	case 111:
3822
		break;
3823
	/* setsid */
3824
	case 112:
3825
		break;
3826
	/* setreuid */
3827
	case 113:
3828
		switch(ndx) {
3829
		case 0:
3830
			p = "uid_t";
3831
			break;
3832
		case 1:
3833
			p = "uid_t";
3834
			break;
3835
		default:
3836
			break;
3837
		};
3838
		break;
3839
	/* setregid */
3840
	case 114:
3841
		switch(ndx) {
3842
		case 0:
3843
			p = "gid_t";
3844
			break;
3845
		case 1:
3846
			p = "gid_t";
3847
			break;
3848
		default:
3849
			break;
3850
		};
3851
		break;
3852
	/* linux_getgroups */
3853
	case 115:
3854
		switch(ndx) {
3855
		case 0:
3856
			p = "l_int";
3857
			break;
3858
		case 1:
3859
			p = "l_gid_t *";
3860
			break;
3861
		default:
3862
			break;
3863
		};
3864
		break;
3865
	/* linux_setgroups */
3866
	case 116:
3867
		switch(ndx) {
3868
		case 0:
3869
			p = "l_int";
3870
			break;
3871
		case 1:
3872
			p = "l_gid_t *";
3873
			break;
3874
		default:
3875
			break;
3876
		};
3877
		break;
3878
	/* setresuid */
3879
	case 117:
3880
		switch(ndx) {
3881
		case 0:
3882
			p = "uid_t";
3883
			break;
3884
		case 1:
3885
			p = "uid_t";
3886
			break;
3887
		case 2:
3888
			p = "uid_t";
3889
			break;
3890
		default:
3891
			break;
3892
		};
3893
		break;
3894
	/* getresuid */
3895
	case 118:
3896
		switch(ndx) {
3897
		case 0:
3898
			p = "uid_t *";
3899
			break;
3900
		case 1:
3901
			p = "uid_t *";
3902
			break;
3903
		case 2:
3904
			p = "uid_t *";
3905
			break;
3906
		default:
3907
			break;
3908
		};
3909
		break;
3910
	/* setresgid */
3911
	case 119:
3912
		switch(ndx) {
3913
		case 0:
3914
			p = "gid_t";
3915
			break;
3916
		case 1:
3917
			p = "gid_t";
3918
			break;
3919
		case 2:
3920
			p = "gid_t";
3921
			break;
3922
		default:
3923
			break;
3924
		};
3925
		break;
3926
	/* getresgid */
3927
	case 120:
3928
		switch(ndx) {
3929
		case 0:
3930
			p = "gid_t *";
3931
			break;
3932
		case 1:
3933
			p = "gid_t *";
3934
			break;
3935
		case 2:
3936
			p = "gid_t *";
3937
			break;
3938
		default:
3939
			break;
3940
		};
3941
		break;
3942
	/* getpgid */
3943
	case 121:
3944
		switch(ndx) {
3945
		case 0:
3946
			p = "int";
3947
			break;
3948
		default:
3949
			break;
3950
		};
3951
		break;
3952
	/* linux_setfsuid */
3953
	case 122:
3954
		switch(ndx) {
3955
		case 0:
3956
			p = "l_uid_t";
3957
			break;
3958
		default:
3959
			break;
3960
		};
3961
		break;
3962
	/* linux_setfsgid */
3963
	case 123:
3964
		switch(ndx) {
3965
		case 0:
3966
			p = "l_gid_t";
3967
			break;
3968
		default:
3969
			break;
3970
		};
3971
		break;
3972
	/* linux_getsid */
3973
	case 124:
3974
		switch(ndx) {
3975
		case 0:
3976
			p = "l_pid_t";
3977
			break;
3978
		default:
3979
			break;
3980
		};
3981
		break;
3982
	/* linux_capget */
3983
	case 125:
3984
		switch(ndx) {
3985
		case 0:
3986
			p = "struct l_user_cap_header *";
3987
			break;
3988
		case 1:
3989
			p = "struct l_user_cap_data *";
3990
			break;
3991
		default:
3992
			break;
3993
		};
3994
		break;
3995
	/* linux_capset */
3996
	case 126:
3997
		switch(ndx) {
3998
		case 0:
3999
			p = "struct l_user_cap_header *";
4000
			break;
4001
		case 1:
4002
			p = "struct l_user_cap_data *";
4003
			break;
4004
		default:
4005
			break;
4006
		};
4007
		break;
4008
	/* linux_rt_sigpending */
4009
	case 127:
4010
		switch(ndx) {
4011
		case 0:
4012
			p = "l_sigset_t *";
4013
			break;
4014
		case 1:
4015
			p = "l_size_t";
4016
			break;
4017
		default:
4018
			break;
4019
		};
4020
		break;
4021
	/* linux_rt_sigtimedwait */
4022
	case 128:
4023
		switch(ndx) {
4024
		case 0:
4025
			p = "l_sigset_t *";
4026
			break;
4027
		case 1:
4028
			p = "l_siginfo_t *";
4029
			break;
4030
		case 2:
4031
			p = "struct l_timeval *";
4032
			break;
4033
		case 3:
4034
			p = "l_size_t";
4035
			break;
4036
		default:
4037
			break;
4038
		};
4039
		break;
4040
	/* linux_rt_sigqueueinfo */
4041
	case 129:
4042
		switch(ndx) {
4043
		case 0:
4044
			p = "l_pid_t";
4045
			break;
4046
		case 1:
4047
			p = "l_int";
4048
			break;
4049
		case 2:
4050
			p = "l_siginfo_t *";
4051
			break;
4052
		default:
4053
			break;
4054
		};
4055
		break;
4056
	/* linux_rt_sigsuspend */
4057
	case 130:
4058
		switch(ndx) {
4059
		case 0:
4060
			p = "l_sigset_t *";
4061
			break;
4062
		case 1:
4063
			p = "l_size_t";
4064
			break;
4065
		default:
4066
			break;
4067
		};
4068
		break;
4069
	/* linux_sigaltstack */
4070
	case 131:
4071
		switch(ndx) {
4072
		case 0:
4073
			p = "l_stack_t *";
4074
			break;
4075
		case 1:
4076
			p = "l_stack_t *";
4077
			break;
4078
		default:
4079
			break;
4080
		};
4081
		break;
4082
	/* linux_utime */
4083
	case 132:
4084
		switch(ndx) {
4085
		case 0:
4086
			p = "char *";
4087
			break;
4088
		case 1:
4089
			p = "struct l_utimbuf *";
4090
			break;
4091
		default:
4092
			break;
4093
		};
4094
		break;
4095
	/* linux_mknod */
4096
	case 133:
4097
		switch(ndx) {
4098
		case 0:
4099
			p = "char *";
4100
			break;
4101
		case 1:
4102
			p = "l_int";
4103
			break;
4104
		case 2:
4105
			p = "l_dev_t";
4106
			break;
4107
		default:
4108
			break;
4109
		};
4110
		break;
4111
	/* linux_personality */
4112
	case 135:
4113
		switch(ndx) {
4114
		case 0:
4115
			p = "l_ulong";
4116
			break;
4117
		default:
4118
			break;
4119
		};
4120
		break;
4121
	/* linux_ustat */
4122
	case 136:
4123
		switch(ndx) {
4124
		case 0:
4125
			p = "l_dev_t";
4126
			break;
4127
		case 1:
4128
			p = "struct l_ustat *";
4129
			break;
4130
		default:
4131
			break;
4132
		};
4133
		break;
4134
	/* linux_statfs */
4135
	case 137:
4136
		switch(ndx) {
4137
		case 0:
4138
			p = "char *";
4139
			break;
4140
		case 1:
4141
			p = "struct l_statfs_buf *";
4142
			break;
4143
		default:
4144
			break;
4145
		};
4146
		break;
4147
	/* linux_fstatfs */
4148
	case 138:
4149
		switch(ndx) {
4150
		case 0:
4151
			p = "l_uint";
4152
			break;
4153
		case 1:
4154
			p = "struct l_statfs_buf *";
4155
			break;
4156
		default:
4157
			break;
4158
		};
4159
		break;
4160
	/* linux_sysfs */
4161
	case 139:
4162
		switch(ndx) {
4163
		case 0:
4164
			p = "l_int";
4165
			break;
4166
		case 1:
4167
			p = "l_ulong";
4168
			break;
4169
		case 2:
4170
			p = "l_ulong";
4171
			break;
4172
		default:
4173
			break;
4174
		};
4175
		break;
4176
	/* linux_getpriority */
4177
	case 140:
4178
		switch(ndx) {
4179
		case 0:
4180
			p = "int";
4181
			break;
4182
		case 1:
4183
			p = "int";
4184
			break;
4185
		default:
4186
			break;
4187
		};
4188
		break;
4189
	/* setpriority */
4190
	case 141:
4191
		switch(ndx) {
4192
		case 0:
4193
			p = "int";
4194
			break;
4195
		case 1:
4196
			p = "int";
4197
			break;
4198
		case 2:
4199
			p = "int";
4200
			break;
4201
		default:
4202
			break;
4203
		};
4204
		break;
4205
	/* linux_sched_setparam */
4206
	case 142:
4207
		switch(ndx) {
4208
		case 0:
4209
			p = "l_pid_t";
4210
			break;
4211
		case 1:
4212
			p = "struct l_sched_param *";
4213
			break;
4214
		default:
4215
			break;
4216
		};
4217
		break;
4218
	/* linux_sched_getparam */
4219
	case 143:
4220
		switch(ndx) {
4221
		case 0:
4222
			p = "l_pid_t";
4223
			break;
4224
		case 1:
4225
			p = "struct l_sched_param *";
4226
			break;
4227
		default:
4228
			break;
4229
		};
4230
		break;
4231
	/* linux_sched_setscheduler */
4232
	case 144:
4233
		switch(ndx) {
4234
		case 0:
4235
			p = "l_pid_t";
4236
			break;
4237
		case 1:
4238
			p = "l_int";
4239
			break;
4240
		case 2:
4241
			p = "struct l_sched_param *";
4242
			break;
4243
		default:
4244
			break;
4245
		};
4246
		break;
4247
	/* linux_sched_getscheduler */
4248
	case 145:
4249
		switch(ndx) {
4250
		case 0:
4251
			p = "l_pid_t";
4252
			break;
4253
		default:
4254
			break;
4255
		};
4256
		break;
4257
	/* linux_sched_get_priority_max */
4258
	case 146:
4259
		switch(ndx) {
4260
		case 0:
4261
			p = "l_int";
4262
			break;
4263
		default:
4264
			break;
4265
		};
4266
		break;
4267
	/* linux_sched_get_priority_min */
4268
	case 147:
4269
		switch(ndx) {
4270
		case 0:
4271
			p = "l_int";
4272
			break;
4273
		default:
4274
			break;
4275
		};
4276
		break;
4277
	/* linux_sched_rr_get_interval */
4278
	case 148:
4279
		switch(ndx) {
4280
		case 0:
4281
			p = "l_pid_t";
4282
			break;
4283
		case 1:
4284
			p = "struct l_timespec *";
4285
			break;
4286
		default:
4287
			break;
4288
		};
4289
		break;
4290
	/* mlock */
4291
	case 149:
4292
		switch(ndx) {
4293
		case 0:
4294
			p = "const void *";
4295
			break;
4296
		case 1:
4297
			p = "size_t";
4298
			break;
4299
		default:
4300
			break;
4301
		};
4302
		break;
4303
	/* munlock */
4304
	case 150:
4305
		switch(ndx) {
4306
		case 0:
4307
			p = "const void *";
4308
			break;
4309
		case 1:
4310
			p = "size_t";
4311
			break;
4312
		default:
4313
			break;
4314
		};
4315
		break;
4316
	/* mlockall */
4317
	case 151:
4318
		switch(ndx) {
4319
		case 0:
4320
			p = "int";
4321
			break;
4322
		default:
4323
			break;
4324
		};
4325
		break;
4326
	/* munlockall */
4327
	case 152:
4328
		break;
4329
	/* linux_vhangup */
4330
	case 153:
4331
		break;
4332
	/* linux_pivot_root */
4333
	case 155:
4334
		break;
4335
	/* linux_sysctl */
4336
	case 156:
4337
		switch(ndx) {
4338
		case 0:
4339
			p = "struct l___sysctl_args *";
4340
			break;
4341
		default:
4342
			break;
4343
		};
4344
		break;
4345
	/* linux_prctl */
4346
	case 157:
4347
		switch(ndx) {
4348
		case 0:
4349
			p = "l_int";
4350
			break;
4351
		case 1:
4352
			p = "l_uintptr_t";
4353
			break;
4354
		case 2:
4355
			p = "l_uintptr_t";
4356
			break;
4357
		case 3:
4358
			p = "l_uintptr_t";
4359
			break;
4360
		case 4:
4361
			p = "l_uintptr_t";
4362
			break;
4363
		default:
4364
			break;
4365
		};
4366
		break;
4367
	/* linux_arch_prctl */
4368
	case 158:
4369
		switch(ndx) {
4370
		case 0:
4371
			p = "l_int";
4372
			break;
4373
		case 1:
4374
			p = "l_ulong";
4375
			break;
4376
		default:
4377
			break;
4378
		};
4379
		break;
4380
	/* linux_adjtimex */
4381
	case 159:
4382
		break;
4383
	/* linux_setrlimit */
4384
	case 160:
4385
		switch(ndx) {
4386
		case 0:
4387
			p = "l_uint";
4388
			break;
4389
		case 1:
4390
			p = "struct l_rlimit *";
4391
			break;
4392
		default:
4393
			break;
4394
		};
4395
		break;
4396
	/* chroot */
4397
	case 161:
4398
		switch(ndx) {
4399
		case 0:
4400
			p = "char *";
4401
			break;
4402
		default:
4403
			break;
4404
		};
4405
		break;
4406
	/* sync */
4407
	case 162:
4408
		break;
4409
	/* acct */
4410
	case 163:
4411
		switch(ndx) {
4412
		case 0:
4413
			p = "char *";
4414
			break;
4415
		default:
4416
			break;
4417
		};
4418
		break;
4419
	/* settimeofday */
4420
	case 164:
4421
		switch(ndx) {
4422
		case 0:
4423
			p = "struct l_timeval *";
4424
			break;
4425
		case 1:
4426
			p = "struct timezone *";
4427
			break;
4428
		default:
4429
			break;
4430
		};
4431
		break;
4432
	/* linux_mount */
4433
	case 165:
4434
		switch(ndx) {
4435
		case 0:
4436
			p = "char *";
4437
			break;
4438
		case 1:
4439
			p = "char *";
4440
			break;
4441
		case 2:
4442
			p = "char *";
4443
			break;
4444
		case 3:
4445
			p = "l_ulong";
4446
			break;
4447
		case 4:
4448
			p = "void *";
4449
			break;
4450
		default:
4451
			break;
4452
		};
4453
		break;
4454
	/* linux_umount */
4455
	case 166:
4456
		switch(ndx) {
4457
		case 0:
4458
			p = "char *";
4459
			break;
4460
		case 1:
4461
			p = "l_int";
4462
			break;
4463
		default:
4464
			break;
4465
		};
4466
		break;
4467
	/* swapon */
4468
	case 167:
4469
		switch(ndx) {
4470
		case 0:
4471
			p = "char *";
4472
			break;
4473
		default:
4474
			break;
4475
		};
4476
		break;
4477
	/* linux_swapoff */
4478
	case 168:
4479
		break;
4480
	/* linux_reboot */
4481
	case 169:
4482
		switch(ndx) {
4483
		case 0:
4484
			p = "l_int";
4485
			break;
4486
		case 1:
4487
			p = "l_int";
4488
			break;
4489
		case 2:
4490
			p = "l_uint";
4491
			break;
4492
		case 3:
4493
			p = "void *";
4494
			break;
4495
		default:
4496
			break;
4497
		};
4498
		break;
4499
	/* linux_sethostname */
4500
	case 170:
4501
		switch(ndx) {
4502
		case 0:
4503
			p = "char *";
4504
			break;
4505
		case 1:
4506
			p = "l_uint";
4507
			break;
4508
		default:
4509
			break;
4510
		};
4511
		break;
4512
	/* linux_setdomainname */
4513
	case 171:
4514
		switch(ndx) {
4515
		case 0:
4516
			p = "char *";
4517
			break;
4518
		case 1:
4519
			p = "l_int";
4520
			break;
4521
		default:
4522
			break;
4523
		};
4524
		break;
4525
	/* linux_iopl */
4526
	case 172:
4527
		switch(ndx) {
4528
		case 0:
4529
			p = "l_uint";
4530
			break;
4531
		default:
4532
			break;
4533
		};
4534
		break;
4535
	/* linux_create_module */
4536
	case 174:
4537
		break;
4538
	/* linux_init_module */
4539
	case 175:
4540
		break;
4541
	/* linux_delete_module */
4542
	case 176:
4543
		break;
4544
	/* linux_get_kernel_syms */
4545
	case 177:
4546
		break;
4547
	/* linux_query_module */
4548
	case 178:
4549
		break;
4550
	/* linux_quotactl */
4551
	case 179:
4552
		break;
4553
	/* linux_nfsservctl */
4554
	case 180:
4555
		break;
4556
	/* linux_getpmsg */
4557
	case 181:
4558
		break;
4559
	/* linux_putpmsg */
4560
	case 182:
4561
		break;
4562
	/* linux_afs_syscall */
4563
	case 183:
4564
		break;
4565
	/* linux_tuxcall */
4566
	case 184:
4567
		break;
4568
	/* linux_security */
4569
	case 185:
4570
		break;
4571
	/* linux_gettid */
4572
	case 186:
4573
		break;
4574
	/* linux_setxattr */
4575
	case 188:
4576
		break;
4577
	/* linux_lsetxattr */
4578
	case 189:
4579
		break;
4580
	/* linux_fsetxattr */
4581
	case 190:
4582
		break;
4583
	/* linux_getxattr */
4584
	case 191:
4585
		break;
4586
	/* linux_lgetxattr */
4587
	case 192:
4588
		break;
4589
	/* linux_fgetxattr */
4590
	case 193:
4591
		break;
4592
	/* linux_listxattr */
4593
	case 194:
4594
		break;
4595
	/* linux_llistxattr */
4596
	case 195:
4597
		break;
4598
	/* linux_flistxattr */
4599
	case 196:
4600
		break;
4601
	/* linux_removexattr */
4602
	case 197:
4603
		break;
4604
	/* linux_lremovexattr */
4605
	case 198:
4606
		break;
4607
	/* linux_fremovexattr */
4608
	case 199:
4609
		break;
4610
	/* linux_tkill */
4611
	case 200:
4612
		switch(ndx) {
4613
		case 0:
4614
			p = "int";
4615
			break;
4616
		case 1:
4617
			p = "int";
4618
			break;
4619
		default:
4620
			break;
4621
		};
4622
		break;
4623
	/* linux_time */
4624
	case 201:
4625
		switch(ndx) {
4626
		case 0:
4627
			p = "l_time_t *";
4628
			break;
4629
		default:
4630
			break;
4631
		};
4632
		break;
4633
	/* linux_sys_futex */
4634
	case 202:
4635
		switch(ndx) {
4636
		case 0:
4637
			p = "void *";
4638
			break;
4639
		case 1:
4640
			p = "int";
4641
			break;
4642
		case 2:
4643
			p = "int";
4644
			break;
4645
		case 3:
4646
			p = "struct l_timespec *";
4647
			break;
4648
		case 4:
4649
			p = "void *";
4650
			break;
4651
		case 5:
4652
			p = "int";
4653
			break;
4654
		default:
4655
			break;
4656
		};
4657
		break;
4658
	/* linux_sched_setaffinity */
4659
	case 203:
4660
		switch(ndx) {
4661
		case 0:
4662
			p = "l_pid_t";
4663
			break;
4664
		case 1:
4665
			p = "l_uint";
4666
			break;
4667
		case 2:
4668
			p = "l_ulong *";
4669
			break;
4670
		default:
4671
			break;
4672
		};
4673
		break;
4674
	/* linux_sched_getaffinity */
4675
	case 204:
4676
		switch(ndx) {
4677
		case 0:
4678
			p = "l_pid_t";
4679
			break;
4680
		case 1:
4681
			p = "l_uint";
4682
			break;
4683
		case 2:
4684
			p = "l_ulong *";
4685
			break;
4686
		default:
4687
			break;
4688
		};
4689
		break;
4690
	/* linux_set_thread_area */
4691
	case 205:
4692
		break;
4693
	/* linux_lookup_dcookie */
4694
	case 212:
4695
		break;
4696
	/* linux_epoll_create */
4697
	case 213:
4698
		switch(ndx) {
4699
		case 0:
4700
			p = "l_int";
4701
			break;
4702
		default:
4703
			break;
4704
		};
4705
		break;
4706
	/* linux_epoll_ctl_old */
4707
	case 214:
4708
		break;
4709
	/* linux_epoll_wait_old */
4710
	case 215:
4711
		break;
4712
	/* linux_remap_file_pages */
4713
	case 216:
4714
		break;
4715
	/* linux_getdents64 */
4716
	case 217:
4717
		switch(ndx) {
4718
		case 0:
4719
			p = "l_uint";
4720
			break;
4721
		case 1:
4722
			p = "void *";
4723
			break;
4724
		case 2:
4725
			p = "l_uint";
4726
			break;
4727
		default:
4728
			break;
4729
		};
4730
		break;
4731
	/* linux_set_tid_address */
4732
	case 218:
4733
		switch(ndx) {
4734
		case 0:
4735
			p = "int *";
4736
			break;
4737
		default:
4738
			break;
4739
		};
4740
		break;
4741
	/* linux_semtimedop */
4742
	case 220:
4743
		break;
4744
	/* linux_fadvise64 */
4745
	case 221:
4746
		switch(ndx) {
4747
		case 0:
4748
			p = "int";
4749
			break;
4750
		case 1:
4751
			p = "l_loff_t";
4752
			break;
4753
		case 2:
4754
			p = "l_size_t";
4755
			break;
4756
		case 3:
4757
			p = "int";
4758
			break;
4759
		default:
4760
			break;
4761
		};
4762
		break;
4763
	/* linux_timer_create */
4764
	case 222:
4765
		switch(ndx) {
4766
		case 0:
4767
			p = "clockid_t";
4768
			break;
4769
		case 1:
4770
			p = "struct sigevent *";
4771
			break;
4772
		case 2:
4773
			p = "l_timer_t *";
4774
			break;
4775
		default:
4776
			break;
4777
		};
4778
		break;
4779
	/* linux_timer_settime */
4780
	case 223:
4781
		switch(ndx) {
4782
		case 0:
4783
			p = "l_timer_t";
4784
			break;
4785
		case 1:
4786
			p = "l_int";
4787
			break;
4788
		case 2:
4789
			p = "const struct itimerspec *";
4790
			break;
4791
		case 3:
4792
			p = "struct itimerspec *";
4793
			break;
4794
		default:
4795
			break;
4796
		};
4797
		break;
4798
	/* linux_timer_gettime */
4799
	case 224:
4800
		switch(ndx) {
4801
		case 0:
4802
			p = "l_timer_t";
4803
			break;
4804
		case 1:
4805
			p = "struct itimerspec *";
4806
			break;
4807
		default:
4808
			break;
4809
		};
4810
		break;
4811
	/* linux_timer_getoverrun */
4812
	case 225:
4813
		switch(ndx) {
4814
		case 0:
4815
			p = "l_timer_t";
4816
			break;
4817
		default:
4818
			break;
4819
		};
4820
		break;
4821
	/* linux_timer_delete */
4822
	case 226:
4823
		switch(ndx) {
4824
		case 0:
4825
			p = "l_timer_t";
4826
			break;
4827
		default:
4828
			break;
4829
		};
4830
		break;
4831
	/* linux_clock_settime */
4832
	case 227:
4833
		switch(ndx) {
4834
		case 0:
4835
			p = "clockid_t";
4836
			break;
4837
		case 1:
4838
			p = "struct l_timespec *";
4839
			break;
4840
		default:
4841
			break;
4842
		};
4843
		break;
4844
	/* linux_clock_gettime */
4845
	case 228:
4846
		switch(ndx) {
4847
		case 0:
4848
			p = "clockid_t";
4849
			break;
4850
		case 1:
4851
			p = "struct l_timespec *";
4852
			break;
4853
		default:
4854
			break;
4855
		};
4856
		break;
4857
	/* linux_clock_getres */
4858
	case 229:
4859
		switch(ndx) {
4860
		case 0:
4861
			p = "clockid_t";
4862
			break;
4863
		case 1:
4864
			p = "struct l_timespec *";
4865
			break;
4866
		default:
4867
			break;
4868
		};
4869
		break;
4870
	/* linux_clock_nanosleep */
4871
	case 230:
4872
		switch(ndx) {
4873
		case 0:
4874
			p = "clockid_t";
4875
			break;
4876
		case 1:
4877
			p = "int";
4878
			break;
4879
		case 2:
4880
			p = "struct l_timespec *";
4881
			break;
4882
		case 3:
4883
			p = "struct l_timespec *";
4884
			break;
4885
		default:
4886
			break;
4887
		};
4888
		break;
4889
	/* linux_exit_group */
4890
	case 231:
4891
		switch(ndx) {
4892
		case 0:
4893
			p = "int";
4894
			break;
4895
		default:
4896
			break;
4897
		};
4898
		break;
4899
	/* linux_epoll_wait */
4900
	case 232:
4901
		switch(ndx) {
4902
		case 0:
4903
			p = "l_int";
4904
			break;
4905
		case 1:
4906
			p = "struct epoll_event *";
4907
			break;
4908
		case 2:
4909
			p = "l_int";
4910
			break;
4911
		case 3:
4912
			p = "l_int";
4913
			break;
4914
		default:
4915
			break;
4916
		};
4917
		break;
4918
	/* linux_epoll_ctl */
4919
	case 233:
4920
		switch(ndx) {
4921
		case 0:
4922
			p = "l_int";
4923
			break;
4924
		case 1:
4925
			p = "l_int";
4926
			break;
4927
		case 2:
4928
			p = "l_int";
4929
			break;
4930
		case 3:
4931
			p = "struct epoll_event *";
4932
			break;
4933
		default:
4934
			break;
4935
		};
4936
		break;
4937
	/* linux_tgkill */
4938
	case 234:
4939
		switch(ndx) {
4940
		case 0:
4941
			p = "int";
4942
			break;
4943
		case 1:
4944
			p = "int";
4945
			break;
4946
		case 2:
4947
			p = "int";
4948
			break;
4949
		default:
4950
			break;
4951
		};
4952
		break;
4953
	/* linux_utimes */
4954
	case 235:
4955
		switch(ndx) {
4956
		case 0:
4957
			p = "char *";
4958
			break;
4959
		case 1:
4960
			p = "struct l_timeval *";
4961
			break;
4962
		default:
4963
			break;
4964
		};
4965
		break;
4966
	/* linux_mbind */
4967
	case 237:
4968
		break;
4969
	/* linux_set_mempolicy */
4970
	case 238:
4971
		break;
4972
	/* linux_get_mempolicy */
4973
	case 239:
4974
		break;
4975
	/* linux_mq_open */
4976
	case 240:
4977
		break;
4978
	/* linux_mq_unlink */
4979
	case 241:
4980
		break;
4981
	/* linux_mq_timedsend */
4982
	case 242:
4983
		break;
4984
	/* linux_mq_timedreceive */
4985
	case 243:
4986
		break;
4987
	/* linux_mq_notify */
4988
	case 244:
4989
		break;
4990
	/* linux_mq_getsetattr */
4991
	case 245:
4992
		break;
4993
	/* linux_kexec_load */
4994
	case 246:
4995
		break;
4996
	/* linux_waitid */
4997
	case 247:
4998
		switch(ndx) {
4999
		case 0:
5000
			p = "int";
5001
			break;
5002
		case 1:
5003
			p = "l_pid_t";
5004
			break;
5005
		case 2:
5006
			p = "l_siginfo_t *";
5007
			break;
5008
		case 3:
5009
			p = "int";
5010
			break;
5011
		case 4:
5012
			p = "struct l_rusage *";
5013
			break;
5014
		default:
5015
			break;
5016
		};
5017
		break;
5018
	/* linux_add_key */
5019
	case 248:
5020
		break;
5021
	/* linux_request_key */
5022
	case 249:
5023
		break;
5024
	/* linux_keyctl */
5025
	case 250:
5026
		break;
5027
	/* linux_ioprio_set */
5028
	case 251:
5029
		break;
5030
	/* linux_ioprio_get */
5031
	case 252:
5032
		break;
5033
	/* linux_inotify_init */
5034
	case 253:
5035
		break;
5036
	/* linux_inotify_add_watch */
5037
	case 254:
5038
		break;
5039
	/* linux_inotify_rm_watch */
5040
	case 255:
5041
		break;
5042
	/* linux_migrate_pages */
5043
	case 256:
5044
		break;
5045
	/* linux_openat */
5046
	case 257:
5047
		switch(ndx) {
5048
		case 0:
5049
			p = "l_int";
5050
			break;
5051
		case 1:
5052
			p = "const char *";
5053
			break;
5054
		case 2:
5055
			p = "l_int";
5056
			break;
5057
		case 3:
5058
			p = "l_int";
5059
			break;
5060
		default:
5061
			break;
5062
		};
5063
		break;
5064
	/* linux_mkdirat */
5065
	case 258:
5066
		switch(ndx) {
5067
		case 0:
5068
			p = "l_int";
5069
			break;
5070
		case 1:
5071
			p = "const char *";
5072
			break;
5073
		case 2:
5074
			p = "l_int";
5075
			break;
5076
		default:
5077
			break;
5078
		};
5079
		break;
5080
	/* linux_mknodat */
5081
	case 259:
5082
		switch(ndx) {
5083
		case 0:
5084
			p = "l_int";
5085
			break;
5086
		case 1:
5087
			p = "const char *";
5088
			break;
5089
		case 2:
5090
			p = "l_int";
5091
			break;
5092
		case 3:
5093
			p = "l_uint";
5094
			break;
5095
		default:
5096
			break;
5097
		};
5098
		break;
5099
	/* linux_fchownat */
5100
	case 260:
5101
		switch(ndx) {
5102
		case 0:
5103
			p = "l_int";
5104
			break;
5105
		case 1:
5106
			p = "const char *";
5107
			break;
5108
		case 2:
5109
			p = "l_uid_t";
5110
			break;
5111
		case 3:
5112
			p = "l_gid_t";
5113
			break;
5114
		case 4:
5115
			p = "l_int";
5116
			break;
5117
		default:
5118
			break;
5119
		};
5120
		break;
5121
	/* linux_futimesat */
5122
	case 261:
5123
		switch(ndx) {
5124
		case 0:
5125
			p = "l_int";
5126
			break;
5127
		case 1:
5128
			p = "char *";
5129
			break;
5130
		case 2:
5131
			p = "struct l_timeval *";
5132
			break;
5133
		default:
5134
			break;
5135
		};
5136
		break;
5137
	/* linux_newfstatat */
5138
	case 262:
5139
		switch(ndx) {
5140
		case 0:
5141
			p = "l_int";
5142
			break;
5143
		case 1:
5144
			p = "char *";
5145
			break;
5146
		case 2:
5147
			p = "struct l_stat64 *";
5148
			break;
5149
		case 3:
5150
			p = "l_int";
5151
			break;
5152
		default:
5153
			break;
5154
		};
5155
		break;
5156
	/* linux_unlinkat */
5157
	case 263:
5158
		switch(ndx) {
5159
		case 0:
5160
			p = "l_int";
5161
			break;
5162
		case 1:
5163
			p = "const char *";
5164
			break;
5165
		case 2:
5166
			p = "l_int";
5167
			break;
5168
		default:
5169
			break;
5170
		};
5171
		break;
5172
	/* linux_renameat */
5173
	case 264:
5174
		switch(ndx) {
5175
		case 0:
5176
			p = "l_int";
5177
			break;
5178
		case 1:
5179
			p = "const char *";
5180
			break;
5181
		case 2:
5182
			p = "l_int";
5183
			break;
5184
		case 3:
5185
			p = "const char *";
5186
			break;
5187
		default:
5188
			break;
5189
		};
5190
		break;
5191
	/* linux_linkat */
5192
	case 265:
5193
		switch(ndx) {
5194
		case 0:
5195
			p = "l_int";
5196
			break;
5197
		case 1:
5198
			p = "const char *";
5199
			break;
5200
		case 2:
5201
			p = "l_int";
5202
			break;
5203
		case 3:
5204
			p = "const char *";
5205
			break;
5206
		case 4:
5207
			p = "l_int";
5208
			break;
5209
		default:
5210
			break;
5211
		};
5212
		break;
5213
	/* linux_symlinkat */
5214
	case 266:
5215
		switch(ndx) {
5216
		case 0:
5217
			p = "const char *";
5218
			break;
5219
		case 1:
5220
			p = "l_int";
5221
			break;
5222
		case 2:
5223
			p = "const char *";
5224
			break;
5225
		default:
5226
			break;
5227
		};
5228
		break;
5229
	/* linux_readlinkat */
5230
	case 267:
5231
		switch(ndx) {
5232
		case 0:
5233
			p = "l_int";
5234
			break;
5235
		case 1:
5236
			p = "const char *";
5237
			break;
5238
		case 2:
5239
			p = "char *";
5240
			break;
5241
		case 3:
5242
			p = "l_int";
5243
			break;
5244
		default:
5245
			break;
5246
		};
5247
		break;
5248
	/* linux_fchmodat */
5249
	case 268:
5250
		switch(ndx) {
5251
		case 0:
5252
			p = "l_int";
5253
			break;
5254
		case 1:
5255
			p = "const char *";
5256
			break;
5257
		case 2:
5258
			p = "l_mode_t";
5259
			break;
5260
		default:
5261
			break;
5262
		};
5263
		break;
5264
	/* linux_faccessat */
5265
	case 269:
5266
		switch(ndx) {
5267
		case 0:
5268
			p = "l_int";
5269
			break;
5270
		case 1:
5271
			p = "const char *";
5272
			break;
5273
		case 2:
5274
			p = "l_int";
5275
			break;
5276
		default:
5277
			break;
5278
		};
5279
		break;
5280
	/* linux_pselect6 */
5281
	case 270:
5282
		switch(ndx) {
5283
		case 0:
5284
			p = "l_int";
5285
			break;
5286
		case 1:
5287
			p = "l_fd_set *";
5288
			break;
5289
		case 2:
5290
			p = "l_fd_set *";
5291
			break;
5292
		case 3:
5293
			p = "l_fd_set *";
5294
			break;
5295
		case 4:
5296
			p = "struct l_timespec *";
5297
			break;
5298
		case 5:
5299
			p = "l_uintptr_t *";
5300
			break;
5301
		default:
5302
			break;
5303
		};
5304
		break;
5305
	/* linux_ppoll */
5306
	case 271:
5307
		switch(ndx) {
5308
		case 0:
5309
			p = "struct pollfd *";
5310
			break;
5311
		case 1:
5312
			p = "uint32_t";
5313
			break;
5314
		case 2:
5315
			p = "struct l_timespec *";
5316
			break;
5317
		case 3:
5318
			p = "l_sigset_t *";
5319
			break;
5320
		case 4:
5321
			p = "l_size_t";
5322
			break;
5323
		default:
5324
			break;
5325
		};
5326
		break;
5327
	/* linux_unshare */
5328
	case 272:
5329
		break;
5330
	/* linux_set_robust_list */
5331
	case 273:
5332
		switch(ndx) {
5333
		case 0:
5334
			p = "struct linux_robust_list_head *";
5335
			break;
5336
		case 1:
5337
			p = "l_size_t";
5338
			break;
5339
		default:
5340
			break;
5341
		};
5342
		break;
5343
	/* linux_get_robust_list */
5344
	case 274:
5345
		switch(ndx) {
5346
		case 0:
5347
			p = "l_int";
5348
			break;
5349
		case 1:
5350
			p = "struct linux_robust_list_head *";
5351
			break;
5352
		case 2:
5353
			p = "l_size_t *";
5354
			break;
5355
		default:
5356
			break;
5357
		};
5358
		break;
5359
	/* linux_splice */
5360
	case 275:
5361
		break;
5362
	/* linux_tee */
5363
	case 276:
5364
		break;
5365
	/* linux_sync_file_range */
5366
	case 277:
5367
		break;
5368
	/* linux_vmsplice */
5369
	case 278:
5370
		break;
5371
	/* linux_move_pages */
5372
	case 279:
5373
		break;
5374
	/* linux_utimensat */
5375
	case 280:
5376
		switch(ndx) {
5377
		case 0:
5378
			p = "l_int";
5379
			break;
5380
		case 1:
5381
			p = "const char *";
5382
			break;
5383
		case 2:
5384
			p = "const struct l_timespec *";
5385
			break;
5386
		case 3:
5387
			p = "l_int";
5388
			break;
5389
		default:
5390
			break;
5391
		};
5392
		break;
5393
	/* linux_epoll_pwait */
5394
	case 281:
5395
		switch(ndx) {
5396
		case 0:
5397
			p = "l_int";
5398
			break;
5399
		case 1:
5400
			p = "struct epoll_event *";
5401
			break;
5402
		case 2:
5403
			p = "l_int";
5404
			break;
5405
		case 3:
5406
			p = "l_int";
5407
			break;
5408
		case 4:
5409
			p = "l_sigset_t *";
5410
			break;
5411
		default:
5412
			break;
5413
		};
5414
		break;
5415
	/* linux_signalfd */
5416
	case 282:
5417
		break;
5418
	/* linux_timerfd */
5419
	case 283:
5420
		break;
5421
	/* linux_eventfd */
5422
	case 284:
5423
		switch(ndx) {
5424
		case 0:
5425
			p = "l_uint";
5426
			break;
5427
		default:
5428
			break;
5429
		};
5430
		break;
5431
	/* linux_fallocate */
5432
	case 285:
5433
		switch(ndx) {
5434
		case 0:
5435
			p = "l_int";
5436
			break;
5437
		case 1:
5438
			p = "l_int";
5439
			break;
5440
		case 2:
5441
			p = "l_loff_t";
5442
			break;
5443
		case 3:
5444
			p = "l_loff_t";
5445
			break;
5446
		default:
5447
			break;
5448
		};
5449
		break;
5450
	/* linux_timerfd_settime */
5451
	case 286:
5452
		break;
5453
	/* linux_timerfd_gettime */
5454
	case 287:
5455
		break;
5456
	/* linux_accept4 */
5457
	case 288:
5458
		switch(ndx) {
5459
		case 0:
5460
			p = "l_int";
5461
			break;
5462
		case 1:
5463
			p = "l_uintptr_t";
5464
			break;
5465
		case 2:
5466
			p = "l_uintptr_t";
5467
			break;
5468
		case 3:
5469
			p = "int";
5470
			break;
5471
		default:
5472
			break;
5473
		};
5474
		break;
5475
	/* linux_signalfd4 */
5476
	case 289:
5477
		break;
5478
	/* linux_eventfd2 */
5479
	case 290:
5480
		switch(ndx) {
5481
		case 0:
5482
			p = "l_uint";
5483
			break;
5484
		case 1:
5485
			p = "l_int";
5486
			break;
5487
		default:
5488
			break;
5489
		};
5490
		break;
5491
	/* linux_epoll_create1 */
5492
	case 291:
5493
		switch(ndx) {
5494
		case 0:
5495
			p = "l_int";
5496
			break;
5497
		default:
5498
			break;
5499
		};
5500
		break;
5501
	/* linux_dup3 */
5502
	case 292:
5503
		switch(ndx) {
5504
		case 0:
5505
			p = "l_int";
5506
			break;
5507
		case 1:
5508
			p = "l_int";
5509
			break;
5510
		case 2:
5511
			p = "l_int";
5512
			break;
5513
		default:
5514
			break;
5515
		};
5516
		break;
5517
	/* linux_pipe2 */
5518
	case 293:
5519
		switch(ndx) {
5520
		case 0:
5521
			p = "l_int *";
5522
			break;
5523
		case 1:
5524
			p = "l_int";
5525
			break;
5526
		default:
5527
			break;
5528
		};
5529
		break;
5530
	/* linux_inotify_init1 */
5531
	case 294:
5532
		break;
5533
	/* linux_preadv */
5534
	case 295:
5535
		break;
5536
	/* linux_pwritev */
5537
	case 296:
5538
		break;
5539
	/* linux_rt_tsigqueueinfo */
5540
	case 297:
5541
		break;
5542
	/* linux_perf_event_open */
5543
	case 298:
5544
		break;
5545
	/* linux_recvmmsg */
5546
	case 299:
5547
		switch(ndx) {
5548
		case 0:
5549
			p = "l_int";
5550
			break;
5551
		case 1:
5552
			p = "struct l_mmsghdr *";
5553
			break;
5554
		case 2:
5555
			p = "l_uint";
5556
			break;
5557
		case 3:
5558
			p = "l_uint";
5559
			break;
5560
		case 4:
5561
			p = "struct l_timespec *";
5562
			break;
5563
		default:
5564
			break;
5565
		};
5566
		break;
5567
	/* linux_fanotify_init */
5568
	case 300:
5569
		break;
5570
	/* linux_fanotify_mark */
5571
	case 301:
5572
		break;
5573
	/* linux_prlimit64 */
5574
	case 302:
5575
		switch(ndx) {
5576
		case 0:
5577
			p = "l_pid_t";
5578
			break;
5579
		case 1:
5580
			p = "l_uint";
5581
			break;
5582
		case 2:
5583
			p = "struct rlimit *";
5584
			break;
5585
		case 3:
5586
			p = "struct rlimit *";
5587
			break;
5588
		default:
5589
			break;
5590
		};
5591
		break;
5592
	/* linux_name_to_handle_at */
5593
	case 303:
5594
		break;
5595
	/* linux_open_by_handle_at */
5596
	case 304:
5597
		break;
5598
	/* linux_clock_adjtime */
5599
	case 305:
5600
		break;
5601
	/* linux_syncfs */
5602
	case 306:
5603
		switch(ndx) {
5604
		case 0:
5605
			p = "l_int";
5606
			break;
5607
		default:
5608
			break;
5609
		};
5610
		break;
5611
	/* linux_sendmmsg */
5612
	case 307:
5613
		switch(ndx) {
5614
		case 0:
5615
			p = "l_int";
5616
			break;
5617
		case 1:
5618
			p = "struct l_mmsghdr *";
5619
			break;
5620
		case 2:
5621
			p = "l_uint";
5622
			break;
5623
		case 3:
5624
			p = "l_uint";
5625
			break;
5626
		default:
5627
			break;
5628
		};
5629
		break;
5630
	/* linux_setns */
5631
	case 308:
5632
		break;
5633
	/* linux_process_vm_readv */
5634
	case 309:
5635
		break;
5636
	/* linux_process_vm_writev */
5637
	case 310:
5638
		break;
5639
	/* linux_kcmp */
5640
	case 311:
5641
		break;
5642
	/* linux_finit_module */
5643
	case 312:
5644
		break;
5645
	default:
5646
		break;
5647
	};
5648
	if (p != NULL)
5649
		strlcpy(desc, p, descsz);
5650
}
5651
static void
5652
systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
5653
{
5654
	const char *p = NULL;
5655
	switch (sysnum) {
5656
#define	nosys	linux_nosys
5657
	/* read */
5658
	case 0:
5659
		if (ndx == 0 || ndx == 1)
5660
			p = "int";
5661
		break;
5662
	/* write */
5663
	case 1:
5664
		if (ndx == 0 || ndx == 1)
5665
			p = "int";
5666
		break;
5667
	/* linux_open */
5668
	case 2:
5669
		if (ndx == 0 || ndx == 1)
5670
			p = "int";
5671
		break;
5672
	/* close */
5673
	case 3:
5674
		if (ndx == 0 || ndx == 1)
5675
			p = "int";
5676
		break;
5677
	/* linux_newstat */
5678
	case 4:
5679
		if (ndx == 0 || ndx == 1)
5680
			p = "int";
5681
		break;
5682
	/* linux_newfstat */
5683
	case 5:
5684
		if (ndx == 0 || ndx == 1)
5685
			p = "int";
5686
		break;
5687
	/* linux_newlstat */
5688
	case 6:
5689
		if (ndx == 0 || ndx == 1)
5690
			p = "int";
5691
		break;
5692
	/* poll */
5693
	case 7:
5694
		if (ndx == 0 || ndx == 1)
5695
			p = "int";
5696
		break;
5697
	/* linux_lseek */
5698
	case 8:
5699
		if (ndx == 0 || ndx == 1)
5700
			p = "int";
5701
		break;
5702
	/* linux_mmap2 */
5703
	case 9:
5704
		if (ndx == 0 || ndx == 1)
5705
			p = "int";
5706
		break;
5707
	/* linux_mprotect */
5708
	case 10:
5709
		if (ndx == 0 || ndx == 1)
5710
			p = "int";
5711
		break;
5712
	/* munmap */
5713
	case 11:
5714
		if (ndx == 0 || ndx == 1)
5715
			p = "int";
5716
		break;
5717
	/* linux_brk */
5718
	case 12:
5719
		if (ndx == 0 || ndx == 1)
5720
			p = "int";
5721
		break;
5722
	/* linux_rt_sigaction */
5723
	case 13:
5724
		if (ndx == 0 || ndx == 1)
5725
			p = "int";
5726
		break;
5727
	/* linux_rt_sigprocmask */
5728
	case 14:
5729
		if (ndx == 0 || ndx == 1)
5730
			p = "int";
5731
		break;
5732
	/* linux_rt_sigreturn */
5733
	case 15:
5734
		if (ndx == 0 || ndx == 1)
5735
			p = "int";
5736
		break;
5737
	/* linux_ioctl */
5738
	case 16:
5739
		if (ndx == 0 || ndx == 1)
5740
			p = "int";
5741
		break;
5742
	/* linux_pread */
5743
	case 17:
5744
		if (ndx == 0 || ndx == 1)
5745
			p = "int";
5746
		break;
5747
	/* linux_pwrite */
5748
	case 18:
5749
		if (ndx == 0 || ndx == 1)
5750
			p = "int";
5751
		break;
5752
	/* readv */
5753
	case 19:
5754
		if (ndx == 0 || ndx == 1)
5755
			p = "int";
5756
		break;
5757
	/* writev */
5758
	case 20:
5759
		if (ndx == 0 || ndx == 1)
5760
			p = "int";
5761
		break;
5762
	/* linux_access */
5763
	case 21:
5764
		if (ndx == 0 || ndx == 1)
5765
			p = "int";
5766
		break;
5767
	/* linux_pipe */
5768
	case 22:
5769
		if (ndx == 0 || ndx == 1)
5770
			p = "int";
5771
		break;
5772
	/* linux_select */
5773
	case 23:
5774
		if (ndx == 0 || ndx == 1)
5775
			p = "int";
5776
		break;
5777
	/* sched_yield */
5778
	case 24:
5779
	/* linux_mremap */
5780
	case 25:
5781
		if (ndx == 0 || ndx == 1)
5782
			p = "int";
5783
		break;
5784
	/* linux_msync */
5785
	case 26:
5786
		if (ndx == 0 || ndx == 1)
5787
			p = "int";
5788
		break;
5789
	/* linux_mincore */
5790
	case 27:
5791
		if (ndx == 0 || ndx == 1)
5792
			p = "int";
5793
		break;
5794
	/* madvise */
5795
	case 28:
5796
		if (ndx == 0 || ndx == 1)
5797
			p = "int";
5798
		break;
5799
	/* linux_shmget */
5800
	case 29:
5801
		if (ndx == 0 || ndx == 1)
5802
			p = "int";
5803
		break;
5804
	/* linux_shmat */
5805
	case 30:
5806
		if (ndx == 0 || ndx == 1)
5807
			p = "int";
5808
		break;
5809
	/* linux_shmctl */
5810
	case 31:
5811
		if (ndx == 0 || ndx == 1)
5812
			p = "int";
5813
		break;
5814
	/* dup */
5815
	case 32:
5816
		if (ndx == 0 || ndx == 1)
5817
			p = "int";
5818
		break;
5819
	/* dup2 */
5820
	case 33:
5821
		if (ndx == 0 || ndx == 1)
5822
			p = "int";
5823
		break;
5824
	/* linux_pause */
5825
	case 34:
5826
	/* linux_nanosleep */
5827
	case 35:
5828
		if (ndx == 0 || ndx == 1)
5829
			p = "int";
5830
		break;
5831
	/* linux_getitimer */
5832
	case 36:
5833
		if (ndx == 0 || ndx == 1)
5834
			p = "int";
5835
		break;
5836
	/* linux_alarm */
5837
	case 37:
5838
		if (ndx == 0 || ndx == 1)
5839
			p = "int";
5840
		break;
5841
	/* linux_setitimer */
5842
	case 38:
5843
		if (ndx == 0 || ndx == 1)
5844
			p = "int";
5845
		break;
5846
	/* linux_getpid */
5847
	case 39:
5848
	/* linux_sendfile */
5849
	case 40:
5850
		if (ndx == 0 || ndx == 1)
5851
			p = "int";
5852
		break;
5853
	/* linux_socket */
5854
	case 41:
5855
		if (ndx == 0 || ndx == 1)
5856
			p = "int";
5857
		break;
5858
	/* linux_connect */
5859
	case 42:
5860
		if (ndx == 0 || ndx == 1)
5861
			p = "int";
5862
		break;
5863
	/* linux_accept */
5864
	case 43:
5865
		if (ndx == 0 || ndx == 1)
5866
			p = "int";
5867
		break;
5868
	/* linux_sendto */
5869
	case 44:
5870
		if (ndx == 0 || ndx == 1)
5871
			p = "int";
5872
		break;
5873
	/* linux_recvfrom */
5874
	case 45:
5875
		if (ndx == 0 || ndx == 1)
5876
			p = "int";
5877
		break;
5878
	/* linux_sendmsg */
5879
	case 46:
5880
		if (ndx == 0 || ndx == 1)
5881
			p = "int";
5882
		break;
5883
	/* linux_recvmsg */
5884
	case 47:
5885
		if (ndx == 0 || ndx == 1)
5886
			p = "int";
5887
		break;
5888
	/* linux_shutdown */
5889
	case 48:
5890
		if (ndx == 0 || ndx == 1)
5891
			p = "int";
5892
		break;
5893
	/* linux_bind */
5894
	case 49:
5895
		if (ndx == 0 || ndx == 1)
5896
			p = "int";
5897
		break;
5898
	/* linux_listen */
5899
	case 50:
5900
		if (ndx == 0 || ndx == 1)
5901
			p = "int";
5902
		break;
5903
	/* linux_getsockname */
5904
	case 51:
5905
		if (ndx == 0 || ndx == 1)
5906
			p = "int";
5907
		break;
5908
	/* linux_getpeername */
5909
	case 52:
5910
		if (ndx == 0 || ndx == 1)
5911
			p = "int";
5912
		break;
5913
	/* linux_socketpair */
5914
	case 53:
5915
		if (ndx == 0 || ndx == 1)
5916
			p = "int";
5917
		break;
5918
	/* linux_setsockopt */
5919
	case 54:
5920
		if (ndx == 0 || ndx == 1)
5921
			p = "int";
5922
		break;
5923
	/* linux_getsockopt */
5924
	case 55:
5925
		if (ndx == 0 || ndx == 1)
5926
			p = "int";
5927
		break;
5928
	/* linux_clone */
5929
	case 56:
5930
		if (ndx == 0 || ndx == 1)
5931
			p = "int";
5932
		break;
5933
	/* linux_fork */
5934
	case 57:
5935
	/* linux_vfork */
5936
	case 58:
5937
	/* linux_execve */
5938
	case 59:
5939
		if (ndx == 0 || ndx == 1)
5940
			p = "int";
5941
		break;
5942
	/* linux_exit */
5943
	case 60:
5944
		if (ndx == 0 || ndx == 1)
5945
			p = "void";
5946
		break;
5947
	/* linux_wait4 */
5948
	case 61:
5949
		if (ndx == 0 || ndx == 1)
5950
			p = "int";
5951
		break;
5952
	/* linux_kill */
5953
	case 62:
5954
		if (ndx == 0 || ndx == 1)
5955
			p = "int";
5956
		break;
5957
	/* linux_newuname */
5958
	case 63:
5959
		if (ndx == 0 || ndx == 1)
5960
			p = "int";
5961
		break;
5962
	/* linux_semget */
5963
	case 64:
5964
		if (ndx == 0 || ndx == 1)
5965
			p = "int";
5966
		break;
5967
	/* linux_semop */
5968
	case 65:
5969
		if (ndx == 0 || ndx == 1)
5970
			p = "int";
5971
		break;
5972
	/* linux_semctl */
5973
	case 66:
5974
		if (ndx == 0 || ndx == 1)
5975
			p = "int";
5976
		break;
5977
	/* linux_shmdt */
5978
	case 67:
5979
		if (ndx == 0 || ndx == 1)
5980
			p = "int";
5981
		break;
5982
	/* linux_msgget */
5983
	case 68:
5984
		if (ndx == 0 || ndx == 1)
5985
			p = "int";
5986
		break;
5987
	/* linux_msgsnd */
5988
	case 69:
5989
		if (ndx == 0 || ndx == 1)
5990
			p = "int";
5991
		break;
5992
	/* linux_msgrcv */
5993
	case 70:
5994
		if (ndx == 0 || ndx == 1)
5995
			p = "int";
5996
		break;
5997
	/* linux_msgctl */
5998
	case 71:
5999
		if (ndx == 0 || ndx == 1)
6000
			p = "int";
6001
		break;
6002
	/* linux_fcntl */
6003
	case 72:
6004
		if (ndx == 0 || ndx == 1)
6005
			p = "int";
6006
		break;
6007
	/* flock */
6008
	case 73:
6009
		if (ndx == 0 || ndx == 1)
6010
			p = "int";
6011
		break;
6012
	/* fsync */
6013
	case 74:
6014
		if (ndx == 0 || ndx == 1)
6015
			p = "int";
6016
		break;
6017
	/* linux_fdatasync */
6018
	case 75:
6019
		if (ndx == 0 || ndx == 1)
6020
			p = "int";
6021
		break;
6022
	/* linux_truncate */
6023
	case 76:
6024
		if (ndx == 0 || ndx == 1)
6025
			p = "int";
6026
		break;
6027
	/* linux_ftruncate */
6028
	case 77:
6029
		if (ndx == 0 || ndx == 1)
6030
			p = "int";
6031
		break;
6032
	/* linux_getdents */
6033
	case 78:
6034
		if (ndx == 0 || ndx == 1)
6035
			p = "int";
6036
		break;
6037
	/* linux_getcwd */
6038
	case 79:
6039
		if (ndx == 0 || ndx == 1)
6040
			p = "int";
6041
		break;
6042
	/* linux_chdir */
6043
	case 80:
6044
		if (ndx == 0 || ndx == 1)
6045
			p = "int";
6046
		break;
6047
	/* fchdir */
6048
	case 81:
6049
		if (ndx == 0 || ndx == 1)
6050
			p = "int";
6051
		break;
6052
	/* linux_rename */
6053
	case 82:
6054
		if (ndx == 0 || ndx == 1)
6055
			p = "int";
6056
		break;
6057
	/* linux_mkdir */
6058
	case 83:
6059
		if (ndx == 0 || ndx == 1)
6060
			p = "int";
6061
		break;
6062
	/* linux_rmdir */
6063
	case 84:
6064
		if (ndx == 0 || ndx == 1)
6065
			p = "int";
6066
		break;
6067
	/* linux_creat */
6068
	case 85:
6069
		if (ndx == 0 || ndx == 1)
6070
			p = "int";
6071
		break;
6072
	/* linux_link */
6073
	case 86:
6074
		if (ndx == 0 || ndx == 1)
6075
			p = "int";
6076
		break;
6077
	/* linux_unlink */
6078
	case 87:
6079
		if (ndx == 0 || ndx == 1)
6080
			p = "int";
6081
		break;
6082
	/* linux_symlink */
6083
	case 88:
6084
		if (ndx == 0 || ndx == 1)
6085
			p = "int";
6086
		break;
6087
	/* linux_readlink */
6088
	case 89:
6089
		if (ndx == 0 || ndx == 1)
6090
			p = "int";
6091
		break;
6092
	/* linux_chmod */
6093
	case 90:
6094
		if (ndx == 0 || ndx == 1)
6095
			p = "int";
6096
		break;
6097
	/* fchmod */
6098
	case 91:
6099
		if (ndx == 0 || ndx == 1)
6100
			p = "int";
6101
		break;
6102
	/* linux_chown */
6103
	case 92:
6104
		if (ndx == 0 || ndx == 1)
6105
			p = "int";
6106
		break;
6107
	/* fchown */
6108
	case 93:
6109
		if (ndx == 0 || ndx == 1)
6110
			p = "int";
6111
		break;
6112
	/* linux_lchown */
6113
	case 94:
6114
		if (ndx == 0 || ndx == 1)
6115
			p = "int";
6116
		break;
6117
	/* umask */
6118
	case 95:
6119
		if (ndx == 0 || ndx == 1)
6120
			p = "int";
6121
		break;
6122
	/* gettimeofday */
6123
	case 96:
6124
		if (ndx == 0 || ndx == 1)
6125
			p = "int";
6126
		break;
6127
	/* linux_getrlimit */
6128
	case 97:
6129
		if (ndx == 0 || ndx == 1)
6130
			p = "int";
6131
		break;
6132
	/* getrusage */
6133
	case 98:
6134
		if (ndx == 0 || ndx == 1)
6135
			p = "int";
6136
		break;
6137
	/* linux_sysinfo */
6138
	case 99:
6139
		if (ndx == 0 || ndx == 1)
6140
			p = "int";
6141
		break;
6142
	/* linux_times */
6143
	case 100:
6144
		if (ndx == 0 || ndx == 1)
6145
			p = "int";
6146
		break;
6147
	/* linux_ptrace */
6148
	case 101:
6149
		if (ndx == 0 || ndx == 1)
6150
			p = "int";
6151
		break;
6152
	/* linux_getuid */
6153
	case 102:
6154
	/* linux_syslog */
6155
	case 103:
6156
		if (ndx == 0 || ndx == 1)
6157
			p = "int";
6158
		break;
6159
	/* linux_getgid */
6160
	case 104:
6161
	/* setuid */
6162
	case 105:
6163
		if (ndx == 0 || ndx == 1)
6164
			p = "int";
6165
		break;
6166
	/* setgid */
6167
	case 106:
6168
		if (ndx == 0 || ndx == 1)
6169
			p = "int";
6170
		break;
6171
	/* geteuid */
6172
	case 107:
6173
	/* getegid */
6174
	case 108:
6175
	/* setpgid */
6176
	case 109:
6177
		if (ndx == 0 || ndx == 1)
6178
			p = "int";
6179
		break;
6180
	/* linux_getppid */
6181
	case 110:
6182
	/* getpgrp */
6183
	case 111:
6184
	/* setsid */
6185
	case 112:
6186
	/* setreuid */
6187
	case 113:
6188
		if (ndx == 0 || ndx == 1)
6189
			p = "int";
6190
		break;
6191
	/* setregid */
6192
	case 114:
6193
		if (ndx == 0 || ndx == 1)
6194
			p = "int";
6195
		break;
6196
	/* linux_getgroups */
6197
	case 115:
6198
		if (ndx == 0 || ndx == 1)
6199
			p = "int";
6200
		break;
6201
	/* linux_setgroups */
6202
	case 116:
6203
		if (ndx == 0 || ndx == 1)
6204
			p = "int";
6205
		break;
6206
	/* setresuid */
6207
	case 117:
6208
		if (ndx == 0 || ndx == 1)
6209
			p = "int";
6210
		break;
6211
	/* getresuid */
6212
	case 118:
6213
		if (ndx == 0 || ndx == 1)
6214
			p = "int";
6215
		break;
6216
	/* setresgid */
6217
	case 119:
6218
		if (ndx == 0 || ndx == 1)
6219
			p = "int";
6220
		break;
6221
	/* getresgid */
6222
	case 120:
6223
		if (ndx == 0 || ndx == 1)
6224
			p = "int";
6225
		break;
6226
	/* getpgid */
6227
	case 121:
6228
		if (ndx == 0 || ndx == 1)
6229
			p = "int";
6230
		break;
6231
	/* linux_setfsuid */
6232
	case 122:
6233
		if (ndx == 0 || ndx == 1)
6234
			p = "int";
6235
		break;
6236
	/* linux_setfsgid */
6237
	case 123:
6238
		if (ndx == 0 || ndx == 1)
6239
			p = "int";
6240
		break;
6241
	/* linux_getsid */
6242
	case 124:
6243
		if (ndx == 0 || ndx == 1)
6244
			p = "int";
6245
		break;
6246
	/* linux_capget */
6247
	case 125:
6248
		if (ndx == 0 || ndx == 1)
6249
			p = "int";
6250
		break;
6251
	/* linux_capset */
6252
	case 126:
6253
		if (ndx == 0 || ndx == 1)
6254
			p = "int";
6255
		break;
6256
	/* linux_rt_sigpending */
6257
	case 127:
6258
		if (ndx == 0 || ndx == 1)
6259
			p = "int";
6260
		break;
6261
	/* linux_rt_sigtimedwait */
6262
	case 128:
6263
		if (ndx == 0 || ndx == 1)
6264
			p = "int";
6265
		break;
6266
	/* linux_rt_sigqueueinfo */
6267
	case 129:
6268
		if (ndx == 0 || ndx == 1)
6269
			p = "int";
6270
		break;
6271
	/* linux_rt_sigsuspend */
6272
	case 130:
6273
		if (ndx == 0 || ndx == 1)
6274
			p = "int";
6275
		break;
6276
	/* linux_sigaltstack */
6277
	case 131:
6278
		if (ndx == 0 || ndx == 1)
6279
			p = "int";
6280
		break;
6281
	/* linux_utime */
6282
	case 132:
6283
		if (ndx == 0 || ndx == 1)
6284
			p = "int";
6285
		break;
6286
	/* linux_mknod */
6287
	case 133:
6288
		if (ndx == 0 || ndx == 1)
6289
			p = "int";
6290
		break;
6291
	/* linux_personality */
6292
	case 135:
6293
		if (ndx == 0 || ndx == 1)
6294
			p = "int";
6295
		break;
6296
	/* linux_ustat */
6297
	case 136:
6298
		if (ndx == 0 || ndx == 1)
6299
			p = "int";
6300
		break;
6301
	/* linux_statfs */
6302
	case 137:
6303
		if (ndx == 0 || ndx == 1)
6304
			p = "int";
6305
		break;
6306
	/* linux_fstatfs */
6307
	case 138:
6308
		if (ndx == 0 || ndx == 1)
6309
			p = "int";
6310
		break;
6311
	/* linux_sysfs */
6312
	case 139:
6313
		if (ndx == 0 || ndx == 1)
6314
			p = "int";
6315
		break;
6316
	/* linux_getpriority */
6317
	case 140:
6318
		if (ndx == 0 || ndx == 1)
6319
			p = "int";
6320
		break;
6321
	/* setpriority */
6322
	case 141:
6323
		if (ndx == 0 || ndx == 1)
6324
			p = "int";
6325
		break;
6326
	/* linux_sched_setparam */
6327
	case 142:
6328
		if (ndx == 0 || ndx == 1)
6329
			p = "int";
6330
		break;
6331
	/* linux_sched_getparam */
6332
	case 143:
6333
		if (ndx == 0 || ndx == 1)
6334
			p = "int";
6335
		break;
6336
	/* linux_sched_setscheduler */
6337
	case 144:
6338
		if (ndx == 0 || ndx == 1)
6339
			p = "int";
6340
		break;
6341
	/* linux_sched_getscheduler */
6342
	case 145:
6343
		if (ndx == 0 || ndx == 1)
6344
			p = "int";
6345
		break;
6346
	/* linux_sched_get_priority_max */
6347
	case 146:
6348
		if (ndx == 0 || ndx == 1)
6349
			p = "int";
6350
		break;
6351
	/* linux_sched_get_priority_min */
6352
	case 147:
6353
		if (ndx == 0 || ndx == 1)
6354
			p = "int";
6355
		break;
6356
	/* linux_sched_rr_get_interval */
6357
	case 148:
6358
		if (ndx == 0 || ndx == 1)
6359
			p = "int";
6360
		break;
6361
	/* mlock */
6362
	case 149:
6363
		if (ndx == 0 || ndx == 1)
6364
			p = "int";
6365
		break;
6366
	/* munlock */
6367
	case 150:
6368
		if (ndx == 0 || ndx == 1)
6369
			p = "int";
6370
		break;
6371
	/* mlockall */
6372
	case 151:
6373
		if (ndx == 0 || ndx == 1)
6374
			p = "int";
6375
		break;
6376
	/* munlockall */
6377
	case 152:
6378
	/* linux_vhangup */
6379
	case 153:
6380
	/* linux_pivot_root */
6381
	case 155:
6382
	/* linux_sysctl */
6383
	case 156:
6384
		if (ndx == 0 || ndx == 1)
6385
			p = "int";
6386
		break;
6387
	/* linux_prctl */
6388
	case 157:
6389
		if (ndx == 0 || ndx == 1)
6390
			p = "int";
6391
		break;
6392
	/* linux_arch_prctl */
6393
	case 158:
6394
		if (ndx == 0 || ndx == 1)
6395
			p = "int";
6396
		break;
6397
	/* linux_adjtimex */
6398
	case 159:
6399
	/* linux_setrlimit */
6400
	case 160:
6401
		if (ndx == 0 || ndx == 1)
6402
			p = "int";
6403
		break;
6404
	/* chroot */
6405
	case 161:
6406
		if (ndx == 0 || ndx == 1)
6407
			p = "int";
6408
		break;
6409
	/* sync */
6410
	case 162:
6411
	/* acct */
6412
	case 163:
6413
		if (ndx == 0 || ndx == 1)
6414
			p = "int";
6415
		break;
6416
	/* settimeofday */
6417
	case 164:
6418
		if (ndx == 0 || ndx == 1)
6419
			p = "int";
6420
		break;
6421
	/* linux_mount */
6422
	case 165:
6423
		if (ndx == 0 || ndx == 1)
6424
			p = "int";
6425
		break;
6426
	/* linux_umount */
6427
	case 166:
6428
		if (ndx == 0 || ndx == 1)
6429
			p = "int";
6430
		break;
6431
	/* swapon */
6432
	case 167:
6433
		if (ndx == 0 || ndx == 1)
6434
			p = "int";
6435
		break;
6436
	/* linux_swapoff */
6437
	case 168:
6438
	/* linux_reboot */
6439
	case 169:
6440
		if (ndx == 0 || ndx == 1)
6441
			p = "int";
6442
		break;
6443
	/* linux_sethostname */
6444
	case 170:
6445
		if (ndx == 0 || ndx == 1)
6446
			p = "int";
6447
		break;
6448
	/* linux_setdomainname */
6449
	case 171:
6450
		if (ndx == 0 || ndx == 1)
6451
			p = "int";
6452
		break;
6453
	/* linux_iopl */
6454
	case 172:
6455
		if (ndx == 0 || ndx == 1)
6456
			p = "int";
6457
		break;
6458
	/* linux_create_module */
6459
	case 174:
6460
	/* linux_init_module */
6461
	case 175:
6462
	/* linux_delete_module */
6463
	case 176:
6464
	/* linux_get_kernel_syms */
6465
	case 177:
6466
	/* linux_query_module */
6467
	case 178:
6468
	/* linux_quotactl */
6469
	case 179:
6470
	/* linux_nfsservctl */
6471
	case 180:
6472
	/* linux_getpmsg */
6473
	case 181:
6474
	/* linux_putpmsg */
6475
	case 182:
6476
	/* linux_afs_syscall */
6477
	case 183:
6478
	/* linux_tuxcall */
6479
	case 184:
6480
	/* linux_security */
6481
	case 185:
6482
	/* linux_gettid */
6483
	case 186:
6484
	/* linux_setxattr */
6485
	case 188:
6486
	/* linux_lsetxattr */
6487
	case 189:
6488
	/* linux_fsetxattr */
6489
	case 190:
6490
	/* linux_getxattr */
6491
	case 191:
6492
	/* linux_lgetxattr */
6493
	case 192:
6494
	/* linux_fgetxattr */
6495
	case 193:
6496
	/* linux_listxattr */
6497
	case 194:
6498
	/* linux_llistxattr */
6499
	case 195:
6500
	/* linux_flistxattr */
6501
	case 196:
6502
	/* linux_removexattr */
6503
	case 197:
6504
	/* linux_lremovexattr */
6505
	case 198:
6506
	/* linux_fremovexattr */
6507
	case 199:
6508
	/* linux_tkill */
6509
	case 200:
6510
		if (ndx == 0 || ndx == 1)
6511
			p = "int";
6512
		break;
6513
	/* linux_time */
6514
	case 201:
6515
		if (ndx == 0 || ndx == 1)
6516
			p = "int";
6517
		break;
6518
	/* linux_sys_futex */
6519
	case 202:
6520
		if (ndx == 0 || ndx == 1)
6521
			p = "int";
6522
		break;
6523
	/* linux_sched_setaffinity */
6524
	case 203:
6525
		if (ndx == 0 || ndx == 1)
6526
			p = "int";
6527
		break;
6528
	/* linux_sched_getaffinity */
6529
	case 204:
6530
		if (ndx == 0 || ndx == 1)
6531
			p = "int";
6532
		break;
6533
	/* linux_set_thread_area */
6534
	case 205:
6535
	/* linux_lookup_dcookie */
6536
	case 212:
6537
	/* linux_epoll_create */
6538
	case 213:
6539
		if (ndx == 0 || ndx == 1)
6540
			p = "int";
6541
		break;
6542
	/* linux_epoll_ctl_old */
6543
	case 214:
6544
	/* linux_epoll_wait_old */
6545
	case 215:
6546
	/* linux_remap_file_pages */
6547
	case 216:
6548
	/* linux_getdents64 */
6549
	case 217:
6550
		if (ndx == 0 || ndx == 1)
6551
			p = "int";
6552
		break;
6553
	/* linux_set_tid_address */
6554
	case 218:
6555
		if (ndx == 0 || ndx == 1)
6556
			p = "int";
6557
		break;
6558
	/* linux_semtimedop */
6559
	case 220:
6560
	/* linux_fadvise64 */
6561
	case 221:
6562
		if (ndx == 0 || ndx == 1)
6563
			p = "int";
6564
		break;
6565
	/* linux_timer_create */
6566
	case 222:
6567
		if (ndx == 0 || ndx == 1)
6568
			p = "int";
6569
		break;
6570
	/* linux_timer_settime */
6571
	case 223:
6572
		if (ndx == 0 || ndx == 1)
6573
			p = "int";
6574
		break;
6575
	/* linux_timer_gettime */
6576
	case 224:
6577
		if (ndx == 0 || ndx == 1)
6578
			p = "int";
6579
		break;
6580
	/* linux_timer_getoverrun */
6581
	case 225:
6582
		if (ndx == 0 || ndx == 1)
6583
			p = "int";
6584
		break;
6585
	/* linux_timer_delete */
6586
	case 226:
6587
		if (ndx == 0 || ndx == 1)
6588
			p = "int";
6589
		break;
6590
	/* linux_clock_settime */
6591
	case 227:
6592
		if (ndx == 0 || ndx == 1)
6593
			p = "int";
6594
		break;
6595
	/* linux_clock_gettime */
6596
	case 228:
6597
		if (ndx == 0 || ndx == 1)
6598
			p = "int";
6599
		break;
6600
	/* linux_clock_getres */
6601
	case 229:
6602
		if (ndx == 0 || ndx == 1)
6603
			p = "int";
6604
		break;
6605
	/* linux_clock_nanosleep */
6606
	case 230:
6607
		if (ndx == 0 || ndx == 1)
6608
			p = "int";
6609
		break;
6610
	/* linux_exit_group */
6611
	case 231:
6612
		if (ndx == 0 || ndx == 1)
6613
			p = "int";
6614
		break;
6615
	/* linux_epoll_wait */
6616
	case 232:
6617
		if (ndx == 0 || ndx == 1)
6618
			p = "int";
6619
		break;
6620
	/* linux_epoll_ctl */
6621
	case 233:
6622
		if (ndx == 0 || ndx == 1)
6623
			p = "int";
6624
		break;
6625
	/* linux_tgkill */
6626
	case 234:
6627
		if (ndx == 0 || ndx == 1)
6628
			p = "int";
6629
		break;
6630
	/* linux_utimes */
6631
	case 235:
6632
		if (ndx == 0 || ndx == 1)
6633
			p = "int";
6634
		break;
6635
	/* linux_mbind */
6636
	case 237:
6637
	/* linux_set_mempolicy */
6638
	case 238:
6639
	/* linux_get_mempolicy */
6640
	case 239:
6641
	/* linux_mq_open */
6642
	case 240:
6643
	/* linux_mq_unlink */
6644
	case 241:
6645
	/* linux_mq_timedsend */
6646
	case 242:
6647
	/* linux_mq_timedreceive */
6648
	case 243:
6649
	/* linux_mq_notify */
6650
	case 244:
6651
	/* linux_mq_getsetattr */
6652
	case 245:
6653
	/* linux_kexec_load */
6654
	case 246:
6655
	/* linux_waitid */
6656
	case 247:
6657
		if (ndx == 0 || ndx == 1)
6658
			p = "int";
6659
		break;
6660
	/* linux_add_key */
6661
	case 248:
6662
	/* linux_request_key */
6663
	case 249:
6664
	/* linux_keyctl */
6665
	case 250:
6666
	/* linux_ioprio_set */
6667
	case 251:
6668
	/* linux_ioprio_get */
6669
	case 252:
6670
	/* linux_inotify_init */
6671
	case 253:
6672
	/* linux_inotify_add_watch */
6673
	case 254:
6674
	/* linux_inotify_rm_watch */
6675
	case 255:
6676
	/* linux_migrate_pages */
6677
	case 256:
6678
	/* linux_openat */
6679
	case 257:
6680
		if (ndx == 0 || ndx == 1)
6681
			p = "int";
6682
		break;
6683
	/* linux_mkdirat */
6684
	case 258:
6685
		if (ndx == 0 || ndx == 1)
6686
			p = "int";
6687
		break;
6688
	/* linux_mknodat */
6689
	case 259:
6690
		if (ndx == 0 || ndx == 1)
6691
			p = "int";
6692
		break;
6693
	/* linux_fchownat */
6694
	case 260:
6695
		if (ndx == 0 || ndx == 1)
6696
			p = "int";
6697
		break;
6698
	/* linux_futimesat */
6699
	case 261:
6700
		if (ndx == 0 || ndx == 1)
6701
			p = "int";
6702
		break;
6703
	/* linux_newfstatat */
6704
	case 262:
6705
		if (ndx == 0 || ndx == 1)
6706
			p = "int";
6707
		break;
6708
	/* linux_unlinkat */
6709
	case 263:
6710
		if (ndx == 0 || ndx == 1)
6711
			p = "int";
6712
		break;
6713
	/* linux_renameat */
6714
	case 264:
6715
		if (ndx == 0 || ndx == 1)
6716
			p = "int";
6717
		break;
6718
	/* linux_linkat */
6719
	case 265:
6720
		if (ndx == 0 || ndx == 1)
6721
			p = "int";
6722
		break;
6723
	/* linux_symlinkat */
6724
	case 266:
6725
		if (ndx == 0 || ndx == 1)
6726
			p = "int";
6727
		break;
6728
	/* linux_readlinkat */
6729
	case 267:
6730
		if (ndx == 0 || ndx == 1)
6731
			p = "int";
6732
		break;
6733
	/* linux_fchmodat */
6734
	case 268:
6735
		if (ndx == 0 || ndx == 1)
6736
			p = "int";
6737
		break;
6738
	/* linux_faccessat */
6739
	case 269:
6740
		if (ndx == 0 || ndx == 1)
6741
			p = "int";
6742
		break;
6743
	/* linux_pselect6 */
6744
	case 270:
6745
		if (ndx == 0 || ndx == 1)
6746
			p = "int";
6747
		break;
6748
	/* linux_ppoll */
6749
	case 271:
6750
		if (ndx == 0 || ndx == 1)
6751
			p = "int";
6752
		break;
6753
	/* linux_unshare */
6754
	case 272:
6755
	/* linux_set_robust_list */
6756
	case 273:
6757
		if (ndx == 0 || ndx == 1)
6758
			p = "int";
6759
		break;
6760
	/* linux_get_robust_list */
6761
	case 274:
6762
		if (ndx == 0 || ndx == 1)
6763
			p = "int";
6764
		break;
6765
	/* linux_splice */
6766
	case 275:
6767
	/* linux_tee */
6768
	case 276:
6769
	/* linux_sync_file_range */
6770
	case 277:
6771
	/* linux_vmsplice */
6772
	case 278:
6773
	/* linux_move_pages */
6774
	case 279:
6775
	/* linux_utimensat */
6776
	case 280:
6777
		if (ndx == 0 || ndx == 1)
6778
			p = "int";
6779
		break;
6780
	/* linux_epoll_pwait */
6781
	case 281:
6782
		if (ndx == 0 || ndx == 1)
6783
			p = "int";
6784
		break;
6785
	/* linux_signalfd */
6786
	case 282:
6787
	/* linux_timerfd */
6788
	case 283:
6789
	/* linux_eventfd */
6790
	case 284:
6791
		if (ndx == 0 || ndx == 1)
6792
			p = "int";
6793
		break;
6794
	/* linux_fallocate */
6795
	case 285:
6796
		if (ndx == 0 || ndx == 1)
6797
			p = "int";
6798
		break;
6799
	/* linux_timerfd_settime */
6800
	case 286:
6801
	/* linux_timerfd_gettime */
6802
	case 287:
6803
	/* linux_accept4 */
6804
	case 288:
6805
		if (ndx == 0 || ndx == 1)
6806
			p = "int";
6807
		break;
6808
	/* linux_signalfd4 */
6809
	case 289:
6810
	/* linux_eventfd2 */
6811
	case 290:
6812
		if (ndx == 0 || ndx == 1)
6813
			p = "int";
6814
		break;
6815
	/* linux_epoll_create1 */
6816
	case 291:
6817
		if (ndx == 0 || ndx == 1)
6818
			p = "int";
6819
		break;
6820
	/* linux_dup3 */
6821
	case 292:
6822
		if (ndx == 0 || ndx == 1)
6823
			p = "int";
6824
		break;
6825
	/* linux_pipe2 */
6826
	case 293:
6827
		if (ndx == 0 || ndx == 1)
6828
			p = "int";
6829
		break;
6830
	/* linux_inotify_init1 */
6831
	case 294:
6832
	/* linux_preadv */
6833
	case 295:
6834
	/* linux_pwritev */
6835
	case 296:
6836
	/* linux_rt_tsigqueueinfo */
6837
	case 297:
6838
	/* linux_perf_event_open */
6839
	case 298:
6840
	/* linux_recvmmsg */
6841
	case 299:
6842
		if (ndx == 0 || ndx == 1)
6843
			p = "int";
6844
		break;
6845
	/* linux_fanotify_init */
6846
	case 300:
6847
	/* linux_fanotify_mark */
6848
	case 301:
6849
	/* linux_prlimit64 */
6850
	case 302:
6851
		if (ndx == 0 || ndx == 1)
6852
			p = "int";
6853
		break;
6854
	/* linux_name_to_handle_at */
6855
	case 303:
6856
	/* linux_open_by_handle_at */
6857
	case 304:
6858
	/* linux_clock_adjtime */
6859
	case 305:
6860
	/* linux_syncfs */
6861
	case 306:
6862
		if (ndx == 0 || ndx == 1)
6863
			p = "int";
6864
		break;
6865
	/* linux_sendmmsg */
6866
	case 307:
6867
		if (ndx == 0 || ndx == 1)
6868
			p = "int";
6869
		break;
6870
	/* linux_setns */
6871
	case 308:
6872
	/* linux_process_vm_readv */
6873
	case 309:
6874
	/* linux_process_vm_writev */
6875
	case 310:
6876
	/* linux_kcmp */
6877
	case 311:
6878
	/* linux_finit_module */
6879
	case 312:
6880
	default:
6881
		break;
6882
	};
6883
	if (p != NULL)
6884
		strlcpy(desc, p, descsz);
6885
}
(-)sys/amd64/linux/linux_sysvec.c (+1000 lines)
Line 0 Link Here
1
/*-
2
 * Copyright (c) 2013 Dmitry Chagin
3
 * Copyright (c) 2004 Tim J. Robbins
4
 * Copyright (c) 2003 Peter Wemm
5
 * Copyright (c) 2002 Doug Rabson
6
 * Copyright (c) 1998-1999 Andrew Gallatin
7
 * Copyright (c) 1994-1996 Søren Schmidt
8
 * All rights reserved.
9
 *
10
 * Redistribution and use in source and binary forms, with or without
11
 * modification, are permitted provided that the following conditions
12
 * are met:
13
 * 1. Redistributions of source code must retain the above copyright
14
 *    notice, this list of conditions and the following disclaimer
15
 *    in this position and unchanged.
16
 * 2. Redistributions in binary form must reproduce the above copyright
17
 *    notice, this list of conditions and the following disclaimer in the
18
 *    documentation and/or other materials provided with the distribution.
19
 * 3. The name of the author may not be used to endorse or promote products
20
 *    derived from this software without specific prior written permission
21
 *
22
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
 */
33
34
#include <sys/cdefs.h>
35
__FBSDID("$FreeBSD$");
36
37
#include "opt_compat.h"
38
39
#define	__ELF_WORD_SIZE	64
40
41
#include <sys/param.h>
42
#include <sys/systm.h>
43
#include <sys/exec.h>
44
#include <sys/fcntl.h>
45
#include <sys/imgact.h>
46
#include <sys/imgact_elf.h>
47
#include <sys/kernel.h>
48
#include <sys/ktr.h>
49
#include <sys/lock.h>
50
#include <sys/malloc.h>
51
#include <sys/module.h>
52
#include <sys/mutex.h>
53
#include <sys/proc.h>
54
#include <sys/resourcevar.h>
55
#include <sys/signalvar.h>
56
#include <sys/sysctl.h>
57
#include <sys/syscallsubr.h>
58
#include <sys/sysent.h>
59
#include <sys/sysproto.h>
60
#include <sys/vnode.h>
61
#include <sys/eventhandler.h>
62
63
#include <vm/vm.h>
64
#include <vm/pmap.h>
65
#include <vm/vm_extern.h>
66
#include <vm/vm_map.h>
67
#include <vm/vm_object.h>
68
#include <vm/vm_page.h>
69
#include <vm/vm_param.h>
70
71
#include <machine/cpu.h>
72
#include <machine/md_var.h>
73
#include <machine/pcb.h>
74
#include <machine/specialreg.h>
75
76
#include <amd64/linux/linux.h>
77
#include <amd64/linux/linux_proto.h>
78
#include <compat/linux/linux_emul.h>
79
#include <compat/linux/linux_futex.h>
80
#include <compat/linux/linux_ioctl.h>
81
#include <compat/linux/linux_mib.h>
82
#include <compat/linux/linux_misc.h>
83
#include <compat/linux/linux_signal.h>
84
#include <compat/linux/linux_sysproto.h>
85
#include <compat/linux/linux_util.h>
86
#include <compat/linux/linux_vdso.h>
87
88
MODULE_VERSION(linux64, 1);
89
90
#if BYTE_ORDER == LITTLE_ENDIAN
91
#define SHELLMAGIC      0x2123 /* #! */
92
#else
93
#define SHELLMAGIC      0x2321
94
#endif
95
96
#if defined(DEBUG)
97
SYSCTL_PROC(_compat_linux, OID_AUTO, debug,
98
	    CTLTYPE_STRING | CTLFLAG_RW,
99
	    0, 0, linux_sysctl_debug, "A",
100
	    "Linux 64 debugging control");
101
#endif
102
103
/*
104
 * Allow the this functions to use the ldebug() facility
105
 * even though they are not syscalls themselves. Map them
106
 * to syscall 0. This is slightly less bogus than using
107
 * ldebug(sigreturn).
108
 */
109
#define	LINUX_SYS_linux_rt_sendsig	0
110
111
const char *linux_kplatform;
112
static int linux_szsigcode;
113
static vm_object_t linux_shared_page_obj;
114
static char *linux_shared_page_mapping;
115
extern char _binary_linux_locore_o_start;
116
extern char _binary_linux_locore_o_end;
117
118
extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
119
120
SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
121
122
static register_t * linux_copyout_strings(struct image_params *imgp);
123
static int	elf_linux_fixup(register_t **stack_base,
124
		    struct image_params *iparams);
125
static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel);
126
static void	linux_vdso_install(void *param);
127
static void	linux_vdso_deinstall(void *param);
128
static void	linux_set_syscall_retval(struct thread *td, int error);
129
static int	linux_fetch_syscall_args(struct thread *td, struct syscall_args *sa);
130
static void	linux_exec_setregs(struct thread *td, struct image_params *imgp,
131
		    u_long stack);
132
static int	linux_vsyscall(struct thread *td, struct trapframe *tf);
133
134
/*
135
 * Linux syscalls return negative errno's, we do positive and map them
136
 * Reference:
137
 *   FreeBSD: src/sys/sys/errno.h
138
 *   Linux:   linux-2.6.17.8/include/asm-generic/errno-base.h
139
 *            linux-2.6.17.8/include/asm-generic/errno.h
140
 */
141
static int bsd_to_linux_errno[ELAST + 1] = {
142
	-0,  -1,  -2,  -3,  -4,  -5,  -6,  -7,  -8,  -9,
143
	-10, -35, -12, -13, -14, -15, -16, -17, -18, -19,
144
	-20, -21, -22, -23, -24, -25, -26, -27, -28, -29,
145
	-30, -31, -32, -33, -34, -11,-115,-114, -88, -89,
146
	-90, -91, -92, -93, -94, -95, -96, -97, -98, -99,
147
	-100,-101,-102,-103,-104,-105,-106,-107,-108,-109,
148
	-110,-111, -40, -36,-112,-113, -39, -11, -87,-122,
149
	-116, -66,  -6,  -6,  -6,  -6,  -6, -37, -38,  -9,
150
	  -6,  -6, -43, -42, -75,-125, -84, -95, -16, -74,
151
	 -72, -67, -71
152
};
153
154
#define LINUX_T_UNKNOWN  255
155
static int _bsd_to_linux_trapcode[] = {
156
	LINUX_T_UNKNOWN,	/* 0 */
157
	6,			/* 1  T_PRIVINFLT */
158
	LINUX_T_UNKNOWN,	/* 2 */
159
	3,			/* 3  T_BPTFLT */
160
	LINUX_T_UNKNOWN,	/* 4 */
161
	LINUX_T_UNKNOWN,	/* 5 */
162
	16,			/* 6  T_ARITHTRAP */
163
	254,			/* 7  T_ASTFLT */
164
	LINUX_T_UNKNOWN,	/* 8 */
165
	13,			/* 9  T_PROTFLT */
166
	1,			/* 10 T_TRCTRAP */
167
	LINUX_T_UNKNOWN,	/* 11 */
168
	14,			/* 12 T_PAGEFLT */
169
	LINUX_T_UNKNOWN,	/* 13 */
170
	17,			/* 14 T_ALIGNFLT */
171
	LINUX_T_UNKNOWN,	/* 15 */
172
	LINUX_T_UNKNOWN,	/* 16 */
173
	LINUX_T_UNKNOWN,	/* 17 */
174
	0,			/* 18 T_DIVIDE */
175
	2,			/* 19 T_NMI */
176
	4,			/* 20 T_OFLOW */
177
	5,			/* 21 T_BOUND */
178
	7,			/* 22 T_DNA */
179
	8,			/* 23 T_DOUBLEFLT */
180
	9,			/* 24 T_FPOPFLT */
181
	10,			/* 25 T_TSSFLT */
182
	11,			/* 26 T_SEGNPFLT */
183
	12,			/* 27 T_STKFLT */
184
	18,			/* 28 T_MCHK */
185
	19,			/* 29 T_XMMFLT */
186
	15			/* 30 T_RESERVED */
187
};
188
#define bsd_to_linux_trapcode(code) \
189
    ((code)<sizeof(_bsd_to_linux_trapcode)/sizeof(*_bsd_to_linux_trapcode)? \
190
     _bsd_to_linux_trapcode[(code)]: \
191
     LINUX_T_UNKNOWN)
192
193
LINUX_VDSO_SYM_INTPTR(linux_rt_sigcode);
194
LINUX_VDSO_SYM_CHAR(linux_platform);
195
196
/*
197
 * If FreeBSD & Linux have a difference of opinion about what a trap
198
 * means, deal with it here.
199
 *
200
 * MPSAFE
201
 */
202
static int
203
translate_traps(int signal, int trap_code)
204
{
205
206
	if (signal != SIGBUS)
207
		return signal;
208
	switch (trap_code) {
209
	case T_PROTFLT:
210
	case T_TSSFLT:
211
	case T_DOUBLEFLT:
212
	case T_PAGEFLT:
213
		return SIGSEGV;
214
	default:
215
		return signal;
216
	}
217
}
218
219
static int
220
linux_fetch_syscall_args(struct thread *td, struct syscall_args *sa)
221
{
222
	struct proc *p;
223
	struct trapframe *frame;
224
225
	p = td->td_proc;
226
	frame = td->td_frame;
227
228
	sa->args[0] = frame->tf_rdi;
229
	sa->args[1] = frame->tf_rsi;
230
	sa->args[2] = frame->tf_rdx;
231
	sa->args[3] = frame->tf_rcx;
232
	sa->args[4] = frame->tf_r8;
233
	sa->args[5] = frame->tf_r9;
234
	sa->code = frame->tf_rax;
235
236
	if (sa->code >= p->p_sysent->sv_size)
237
		/* nosys */
238
		sa->callp = &p->p_sysent->sv_table[LINUX_SYS_MAXSYSCALL];
239
	else
240
		sa->callp = &p->p_sysent->sv_table[sa->code];
241
	sa->narg = sa->callp->sy_narg;
242
243
	td->td_retval[0] = 0;
244
	return (0);
245
}
246
247
static void
248
linux_set_syscall_retval(struct thread *td, int error)
249
{
250
	struct trapframe *frame = td->td_frame;
251
252
	/*
253
	 * On Linux only %rcx and %r11 values are not preserved across
254
	 * the syscall.
255
	 * So, do not clobber %rdx and %r10
256
	 */
257
	td->td_retval[1] = frame->tf_rdx;
258
	frame->tf_r10 = frame->tf_rcx;
259
260
	cpu_set_syscall_retval(td, error);
261
262
	 /* Restore all registers. */
263
	set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
264
}
265
266
static int
267
elf_linux_fixup(register_t **stack_base, struct image_params *imgp)
268
{
269
	Elf_Auxargs *args;
270
	Elf_Addr *base;
271
	Elf_Addr *pos;
272
	struct ps_strings *arginfo;
273
	struct proc *p;
274
275
	p = imgp->proc;
276
	arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings;
277
278
	KASSERT(curthread->td_proc == imgp->proc,
279
	    ("unsafe elf_linux_fixup(), should be curproc"));
280
	base = (Elf64_Addr *)*stack_base;
281
	args = (Elf64_Auxargs *)imgp->auxargs;
282
	pos = base + (imgp->args->argc + imgp->args->envc + 2);
283
284
	AUXARGS_ENTRY(pos, LINUX_AT_SYSINFO_EHDR,
285
	    imgp->proc->p_sysent->sv_shared_page_base);
286
	AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, cpu_feature);
287
	AUXARGS_ENTRY(pos, LINUX_AT_CLKTCK, stclohz);
288
	AUXARGS_ENTRY(pos, AT_PHDR, args->phdr);
289
	AUXARGS_ENTRY(pos, AT_PHENT, args->phent);
290
	AUXARGS_ENTRY(pos, AT_PHNUM, args->phnum);
291
	AUXARGS_ENTRY(pos, AT_PAGESZ, args->pagesz);
292
	AUXARGS_ENTRY(pos, AT_BASE, args->base);
293
	AUXARGS_ENTRY(pos, AT_FLAGS, args->flags);
294
	AUXARGS_ENTRY(pos, AT_ENTRY, args->entry);
295
	AUXARGS_ENTRY(pos, AT_UID, imgp->proc->p_ucred->cr_ruid);
296
	AUXARGS_ENTRY(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid);
297
	AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid);
298
	AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid);
299
	AUXARGS_ENTRY(pos, LINUX_AT_SECURE, 0);
300
	AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform));
301
	AUXARGS_ENTRY(pos, LINUX_AT_RANDOM, imgp->canary);
302
	if (imgp->execpathp != 0)
303
		AUXARGS_ENTRY(pos, LINUX_AT_EXECFN, imgp->execpathp);
304
	if (args->execfd != -1)
305
		AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd);
306
	AUXARGS_ENTRY(pos, AT_NULL, 0);
307
	free(imgp->auxargs, M_TEMP);
308
	imgp->auxargs = NULL;
309
310
	base--;
311
	suword(base, (uint64_t)imgp->args->argc);
312
313
	*stack_base = (register_t *)base;
314
	return (0);
315
}
316
317
/*
318
 * Copy strings out to the new process address space, constructing new arg
319
 * and env vector tables. Return a pointer to the base so that it can be used
320
 * as the initial stack pointer.
321
 */
322
static register_t *
323
linux_copyout_strings(struct image_params *imgp)
324
{
325
	int argc, envc;
326
	char **vectp;
327
	char *stringp, *destp;
328
	register_t *stack_base;
329
	struct ps_strings *arginfo;
330
	char canary[LINUX_AT_RANDOM_LEN];
331
	size_t execpath_len;
332
	struct proc *p;
333
334
	/*
335
	 * Calculate string base and vector table pointers.
336
	 */
337
	if (imgp->execpath != NULL && imgp->auxargs != NULL)
338
		execpath_len = strlen(imgp->execpath) + 1;
339
	else
340
		execpath_len = 0;
341
342
	p = imgp->proc;
343
	arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings;
344
	destp =	(caddr_t)arginfo - SPARE_USRSPACE -
345
	    roundup(sizeof(canary), sizeof(char *)) -
346
	    roundup(execpath_len, sizeof(char *)) -
347
	    roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *));
348
349
	if (execpath_len != 0) {
350
		imgp->execpathp = (uintptr_t)arginfo - execpath_len;
351
		copyout(imgp->execpath, (void *)imgp->execpathp, execpath_len);
352
	}
353
354
	/*
355
	 * Prepare the canary for SSP.
356
	 */
357
	arc4rand(canary, sizeof(canary), 0);
358
	imgp->canary = (uintptr_t)arginfo -
359
	    roundup(execpath_len, sizeof(char *)) -
360
	    roundup(sizeof(canary), sizeof(char *));
361
	copyout(canary, (void *)imgp->canary, sizeof(canary));
362
363
	/*
364
	 * If we have a valid auxargs ptr, prepare some room
365
	 * on the stack.
366
	 */
367
	if (imgp->auxargs) {
368
		/*
369
		 * 'AT_COUNT*2' is size for the ELF Auxargs data. This is for
370
		 * lower compatibility.
371
		 */
372
		imgp->auxarg_size = (imgp->auxarg_size) ? imgp->auxarg_size :
373
		    (LINUX_AT_COUNT * 2);
374
375
		/*
376
		 * The '+ 2' is for the null pointers at the end of each of
377
		 * the arg and env vector sets,and imgp->auxarg_size is room
378
		 * for argument of Runtime loader.
379
		 */
380
		vectp = (char **)(destp - (imgp->args->argc +
381
		    imgp->args->envc + 2 + imgp->auxarg_size) * sizeof(char *));
382
383
	} else {
384
		/*
385
		 * The '+ 2' is for the null pointers at the end of each of
386
		 * the arg and env vector sets
387
		 */
388
		vectp = (char **)(destp - (imgp->args->argc +
389
		    imgp->args->envc + 2) * sizeof(char *));
390
	}
391
392
	/*
393
	 * vectp also becomes our initial stack base
394
	 */
395
	stack_base = (register_t *)vectp;
396
397
	stringp = imgp->args->begin_argv;
398
	argc = imgp->args->argc;
399
	envc = imgp->args->envc;
400
401
	/*
402
	 * Copy out strings - arguments and environment.
403
	 */
404
	copyout(stringp, destp, ARG_MAX - imgp->args->stringspace);
405
406
	/*
407
	 * Fill in "ps_strings" struct for ps, w, etc.
408
	 */
409
	suword(&arginfo->ps_argvstr, (long)(intptr_t)vectp);
410
	suword(&arginfo->ps_nargvstr, argc);
411
412
	/*
413
	 * Fill in argument portion of vector table.
414
	 */
415
	for (; argc > 0; --argc) {
416
		suword(vectp++, (long)(intptr_t)destp);
417
		while (*stringp++ != 0)
418
			destp++;
419
		destp++;
420
	}
421
422
	/* a null vector table pointer separates the argp's from the envp's */
423
	suword(vectp++, 0);
424
425
	suword(&arginfo->ps_envstr, (long)(intptr_t)vectp);
426
	suword(&arginfo->ps_nenvstr, envc);
427
428
	/*
429
	 * Fill in environment portion of vector table.
430
	 */
431
	for (; envc > 0; --envc) {
432
		suword(vectp++, (long)(intptr_t)destp);
433
		while (*stringp++ != 0)
434
			destp++;
435
		destp++;
436
	}
437
438
	/* end of vector table is a null pointer */
439
	suword(vectp, 0);
440
	return (stack_base);
441
}
442
443
/*
444
 * Reset registers to default values on exec.
445
 */
446
static void
447
linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack)
448
{
449
	struct trapframe *regs = td->td_frame;
450
	struct pcb *pcb = td->td_pcb;
451
452
	mtx_lock(&dt_lock);
453
	if (td->td_proc->p_md.md_ldt != NULL)
454
		user_ldt_free(td);
455
	else
456
		mtx_unlock(&dt_lock);
457
458
	pcb->pcb_fsbase = 0;
459
	pcb->pcb_gsbase = 0;
460
	clear_pcb_flags(pcb, PCB_32BIT);
461
	pcb->pcb_initial_fpucw = __LINUX_NPXCW__;
462
	set_pcb_flags(pcb, PCB_FULL_IRET);
463
464
	bzero((char *)regs, sizeof(struct trapframe));
465
	regs->tf_rip = imgp->entry_addr;
466
	regs->tf_rsp = stack;
467
	regs->tf_rflags = PSL_USER | (regs->tf_rflags & PSL_T);
468
	regs->tf_ss = _udatasel;
469
	regs->tf_cs = _ucodesel;
470
	regs->tf_ds = _udatasel;
471
	regs->tf_es = _udatasel;
472
	regs->tf_fs = _ufssel;
473
	regs->tf_gs = _ugssel;
474
	regs->tf_flags = TF_HASSEGS;
475
476
	/*
477
	 * Reset the hardware debug registers if they were in use.
478
	 * They won't have any meaning for the newly exec'd process.
479
	 */
480
	if (pcb->pcb_flags & PCB_DBREGS) {
481
		pcb->pcb_dr0 = 0;
482
		pcb->pcb_dr1 = 0;
483
		pcb->pcb_dr2 = 0;
484
		pcb->pcb_dr3 = 0;
485
		pcb->pcb_dr6 = 0;
486
		pcb->pcb_dr7 = 0;
487
		if (pcb == curpcb) {
488
			/*
489
			 * Clear the debug registers on the running
490
			 * CPU, otherwise they will end up affecting
491
			 * the next process we switch to.
492
			 */
493
			reset_dbregs();
494
		}
495
		clear_pcb_flags(pcb, PCB_DBREGS);
496
	}
497
498
	/*
499
	 * Drop the FP state if we hold it, so that the process gets a
500
	 * clean FP state if it uses the FPU again.
501
	 */
502
	fpstate_drop(td);
503
}
504
505
/*
506
 * Copied from amd64/amd64/machdep.c
507
 *
508
 * XXX fpu state need? don't think so
509
 */
510
int
511
linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args)
512
{
513
	struct proc *p;
514
	struct l_ucontext uc;
515
	struct l_sigcontext *context;
516
	struct trapframe *regs;
517
	unsigned long rflags;
518
	int error;
519
	ksiginfo_t ksi;
520
521
	regs = td->td_frame;
522
	error = copyin((void *)regs->tf_rbx, &uc, sizeof(uc));
523
	if (error != 0)
524
		return (error);
525
526
	p = td->td_proc;
527
	context = &uc.uc_mcontext;
528
	rflags = context->sc_rflags;
529
530
	/*
531
	 * Don't allow users to change privileged or reserved flags.
532
	 */
533
	/*
534
	 * XXX do allow users to change the privileged flag PSL_RF.
535
	 * The cpu sets PSL_RF in tf_rflags for faults.  Debuggers
536
	 * should sometimes set it there too.  tf_rflags is kept in
537
	 * the signal context during signal handling and there is no
538
	 * other place to remember it, so the PSL_RF bit may be
539
	 * corrupted by the signal handler without us knowing.
540
	 * Corruption of the PSL_RF bit at worst causes one more or
541
	 * one less debugger trap, so allowing it is fairly harmless.
542
	 */
543
544
#define RFLAG_SECURE(ef, oef)     ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)
545
	if (!RFLAG_SECURE(rflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) {
546
		printf("linux_rt_sigreturn: rflags = 0x%lx\n", rflags);
547
		return (EINVAL);
548
	}
549
550
	/*
551
	 * Don't allow users to load a valid privileged %cs.  Let the
552
	 * hardware check for invalid selectors, excess privilege in
553
	 * other selectors, invalid %eip's and invalid %esp's.
554
	 */
555
#define CS_SECURE(cs)           (ISPL(cs) == SEL_UPL)
556
	if (!CS_SECURE(context->sc_cs)) {
557
		printf("linux_rt_sigreturn: cs = 0x%x\n", context->sc_cs);
558
		ksiginfo_init_trap(&ksi);
559
		ksi.ksi_signo = SIGBUS;
560
		ksi.ksi_code = BUS_OBJERR;
561
		ksi.ksi_trapno = T_PROTFLT;
562
		ksi.ksi_addr = (void *)regs->tf_rip;
563
		trapsignal(td, &ksi);
564
		return (EINVAL);
565
	}
566
567
	PROC_LOCK(p);
568
	linux_to_bsd_sigset(&uc.uc_sigmask, &td->td_sigmask);
569
	SIG_CANTMASK(td->td_sigmask);
570
	signotify(td);
571
	PROC_UNLOCK(p);
572
573
	regs->tf_rdi    = context->sc_rdi;
574
	regs->tf_rsi    = context->sc_rsi;
575
	regs->tf_rdx    = context->sc_rdx;
576
	regs->tf_rbp    = context->sc_rbp;
577
	regs->tf_rbx    = context->sc_rbx;
578
	regs->tf_rcx    = context->sc_rcx;
579
	regs->tf_rax    = context->sc_rax;
580
	regs->tf_rip    = context->sc_rip;
581
	regs->tf_rsp    = context->sc_rsp;
582
	regs->tf_r8     = context->sc_r8;
583
	regs->tf_r9     = context->sc_r9;
584
	regs->tf_r10    = context->sc_r10;
585
	regs->tf_r11    = context->sc_r11;
586
	regs->tf_r12    = context->sc_r12;
587
	regs->tf_r13    = context->sc_r13;
588
	regs->tf_r14    = context->sc_r14;
589
	regs->tf_r15    = context->sc_r15;
590
	regs->tf_cs     = context->sc_cs;
591
	regs->tf_err    = context->sc_err;
592
	regs->tf_rflags = rflags;
593
594
	set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
595
	return (EJUSTRETURN);
596
}
597
598
/*
599
 * copied from amd64/amd64/machdep.c
600
 *
601
 * Send an interrupt to process.
602
 */
603
static void
604
linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
605
{
606
	struct l_rt_sigframe sf, *sfp;
607
	struct proc *p;
608
	struct thread *td;
609
	struct sigacts *psp;
610
	caddr_t sp;
611
	struct trapframe *regs;
612
	int sig, code;
613
	int oonstack;
614
615
	td = curthread;
616
	p = td->td_proc;
617
	PROC_LOCK_ASSERT(p, MA_OWNED);
618
	sig = ksi->ksi_signo;
619
	psp = p->p_sigacts;
620
	code = ksi->ksi_code;
621
	mtx_assert(&psp->ps_mtx, MA_OWNED);
622
	regs = td->td_frame;
623
	oonstack = sigonstack(regs->tf_rsp);
624
625
	LINUX_CTR4(rt_sendsig, "%p, %d, %p, %u",
626
	    catcher, sig, mask, code);
627
628
	/* Allocate space for the signal handler context. */
629
	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
630
	    SIGISMEMBER(psp->ps_sigonstack, sig)) {
631
		sp = td->td_sigstk.ss_sp + td->td_sigstk.ss_size -
632
		    sizeof(struct l_rt_sigframe);
633
	} else
634
		sp = (caddr_t)regs->tf_rsp - sizeof(struct l_rt_sigframe) - 128;
635
	/* Align to 16 bytes. */
636
	sfp = (struct l_rt_sigframe *)((unsigned long)sp & ~0xFul);
637
	mtx_unlock(&psp->ps_mtx);
638
639
	/* Translate the signal. */
640
	sig = bsd_to_linux_signal(sig);
641
642
	/* Save user context. */
643
	bzero(&sf, sizeof(sf));
644
	bsd_to_linux_sigset(mask, &sf.sf_sc.uc_sigmask);
645
	bsd_to_linux_sigset(mask, &sf.sf_sc.uc_mcontext.sc_mask);
646
647
	sf.sf_sc.uc_stack.ss_sp = PTROUT(td->td_sigstk.ss_sp);
648
	sf.sf_sc.uc_stack.ss_size = td->td_sigstk.ss_size;
649
	sf.sf_sc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK)
650
	    ? ((oonstack) ? LINUX_SS_ONSTACK : 0) : LINUX_SS_DISABLE;
651
	PROC_UNLOCK(p);
652
653
	sf.sf_sc.uc_mcontext.sc_rdi    = regs->tf_rdi;
654
	sf.sf_sc.uc_mcontext.sc_rsi    = regs->tf_rsi;
655
	sf.sf_sc.uc_mcontext.sc_rdx    = regs->tf_rdx;
656
	sf.sf_sc.uc_mcontext.sc_rbp    = regs->tf_rbp;
657
	sf.sf_sc.uc_mcontext.sc_rbx    = regs->tf_rbx;
658
	sf.sf_sc.uc_mcontext.sc_rcx    = regs->tf_rcx;
659
	sf.sf_sc.uc_mcontext.sc_rax    = regs->tf_rax;
660
	sf.sf_sc.uc_mcontext.sc_rip    = regs->tf_rip;
661
	sf.sf_sc.uc_mcontext.sc_rsp    = regs->tf_rsp;
662
	sf.sf_sc.uc_mcontext.sc_r8     = regs->tf_r8;
663
	sf.sf_sc.uc_mcontext.sc_r9     = regs->tf_r9;
664
	sf.sf_sc.uc_mcontext.sc_r10    = regs->tf_r10;
665
	sf.sf_sc.uc_mcontext.sc_r11    = regs->tf_r11;
666
	sf.sf_sc.uc_mcontext.sc_r12    = regs->tf_r12;
667
	sf.sf_sc.uc_mcontext.sc_r13    = regs->tf_r13;
668
	sf.sf_sc.uc_mcontext.sc_r14    = regs->tf_r14;
669
	sf.sf_sc.uc_mcontext.sc_r15    = regs->tf_r15;
670
	sf.sf_sc.uc_mcontext.sc_cs     = regs->tf_cs;
671
	sf.sf_sc.uc_mcontext.sc_rflags = regs->tf_rflags;
672
	sf.sf_sc.uc_mcontext.sc_err    = regs->tf_err;
673
	sf.sf_sc.uc_mcontext.sc_trapno = bsd_to_linux_trapcode(code);
674
	sf.sf_sc.uc_mcontext.sc_cr2    = (register_t)ksi->ksi_addr;
675
676
	/* Build the argument list for the signal handler. */
677
	regs->tf_rdi = sig;			/* arg 1 in %rdi */
678
	regs->tf_rax = 0;
679
	regs->tf_rsi = (register_t)&sfp->sf_si;	/* arg 2 in %rsi */
680
	regs->tf_rdx = (register_t)&sfp->sf_sc;	/* arg 3 in %rdx */
681
682
	sf.sf_handler = catcher;
683
	/* Fill in POSIX parts */
684
	ksiginfo_to_lsiginfo(ksi, &sf.sf_si, sig);
685
686
	/*
687
	 * Copy the sigframe out to the user's stack.
688
	 */
689
	if (copyout(&sf, sfp, sizeof(*sfp)) != 0) {
690
#ifdef DEBUG
691
		printf("process %ld has trashed its stack\n", (long)p->p_pid);
692
#endif
693
		PROC_LOCK(p);
694
		sigexit(td, SIGILL);
695
	}
696
697
	regs->tf_rsp = (long)sfp;
698
	regs->tf_rip = linux_rt_sigcode;
699
	regs->tf_rflags &= ~(PSL_T | PSL_D);
700
	regs->tf_cs = _ucodesel;
701
	set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
702
	PROC_LOCK(p);
703
	mtx_lock(&psp->ps_mtx);
704
}
705
706
/*
707
 * If a linux binary is exec'ing something, try this image activator
708
 * first.  We override standard shell script execution in order to
709
 * be able to modify the interpreter path.  We only do this if a linux
710
 * binary is doing the exec, so we do not create an EXEC module for it.
711
 */
712
static int exec_linux_imgact_try(struct image_params *iparams);
713
714
static int
715
exec_linux_imgact_try(struct image_params *imgp)
716
{
717
	const char *head = (const char *)imgp->image_header;
718
	char *rpath;
719
	int error = -1, len;
720
721
	/*
722
	 * The interpreter for shell scripts run from a linux binary needs
723
	 * to be located in /compat/linux if possible in order to recursively
724
	 * maintain linux path emulation.
725
	 */
726
	if (((const short *)head)[0] == SHELLMAGIC) {
727
		/*
728
		 * Run our normal shell image activator.  If it succeeds
729
		 * attempt to use the alternate path for the interpreter.
730
		 * If an alternate path is found, use our stringspace
731
		 * to store it.
732
		 */
733
		if ((error = exec_shell_imgact(imgp)) == 0) {
734
			linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc),
735
			    imgp->interpreter_name, UIO_SYSSPACE,
736
			    &rpath, 0, AT_FDCWD);
737
			if (rpath != NULL) {
738
				len = strlen(rpath) + 1;
739
740
				if (len <= MAXSHELLCMDLEN)
741
					memcpy(imgp->interpreter_name,
742
					    rpath, len);
743
				free(rpath, M_TEMP);
744
			}
745
		}
746
	}
747
	return(error);
748
}
749
750
/*
751
 * vsyscall area, temporary hack. XXX
752
 *
753
 * getcpu missied....
754
 */
755
#define	LINUX_VSYSCALL_START		(-10UL << 20)
756
#define	LINUX_VSYSCALL_SIZE		1024
757
#define	LINUX_VSYSCALL_NR		3
758
759
const unsigned long linux_vsyscall_vector[] = {
760
	LINUX_SYS_gettimeofday,
761
	LINUX_SYS_linux_time,
762
	-1,
763
	-1
764
};
765
766
static int
767
linux_vsyscall(struct thread *td, struct trapframe *tf)
768
{
769
	int code, error, traced;
770
	uint64_t retqaddr, trapaddr;
771
772
	error = -1;
773
	trapaddr = tf->tf_rip;
774
775
	/* check up %rip for LINUX_VSYSCALL AREA */
776
	if (__predict_true(trapaddr < LINUX_VSYSCALL_START))
777
		return (error);
778
	if ((tf->tf_rip & (LINUX_VSYSCALL_SIZE - 1)) != 0)
779
		return (error);
780
	code = (tf->tf_rip - LINUX_VSYSCALL_START) / LINUX_VSYSCALL_SIZE;
781
	if (code > LINUX_VSYSCALL_NR)
782
		return (error);
783
	/*
784
	 * vsyscall called as callq *(%rax), so we must
785
	 * use return address from %rsp and also fixup %rsp
786
	 */
787
	error = copyin((void *)tf->tf_rsp, &retqaddr, sizeof(retqaddr));
788
	if (error)
789
		return (error);
790
791
	tf->tf_rip = retqaddr;
792
	tf->tf_rax = linux_vsyscall_vector[code];
793
	tf->tf_rsp += 8;
794
795
	traced = (tf->tf_flags & PSL_T);
796
797
	amd64_syscall(td, traced);
798
799
	return (0);
800
}
801
802
struct sysentvec elf_linux_sysvec = {
803
	.sv_size	= LINUX_SYS_MAXSYSCALL,
804
	.sv_table	= linux_sysent,
805
	.sv_mask	= 0,
806
	.sv_sigsize	= 0,
807
	.sv_sigtbl	= NULL,
808
	.sv_errsize	= ELAST + 1,
809
	.sv_errtbl	= bsd_to_linux_errno,
810
	.sv_transtrap	= translate_traps,
811
	.sv_fixup	= elf_linux_fixup,
812
	.sv_sendsig	= linux_rt_sendsig,
813
	.sv_sigcode	= &_binary_linux_locore_o_start,
814
	.sv_szsigcode	= &linux_szsigcode,
815
	.sv_prepsyscall	= NULL,
816
	.sv_name	= "Linux ELF64",
817
	.sv_coredump	= elf64_coredump,
818
	.sv_imgact_try	= exec_linux_imgact_try,
819
	.sv_minsigstksz	= LINUX_MINSIGSTKSZ,
820
	.sv_pagesize	= PAGE_SIZE,
821
	.sv_minuser	= VM_MIN_ADDRESS,
822
	.sv_maxuser	= VM_MAXUSER_ADDRESS,
823
	.sv_usrstack	= USRSTACK,
824
	.sv_psstrings	= PS_STRINGS,
825
	.sv_stackprot	= VM_PROT_ALL,
826
	.sv_copyout_strings = linux_copyout_strings,
827
	.sv_setregs	= linux_exec_setregs,
828
	.sv_fixlimit	= NULL,
829
	.sv_maxssiz	= NULL,
830
	.sv_flags	= SV_ABI_LINUX | SV_LP64 | SV_SHP,
831
	.sv_set_syscall_retval = linux_set_syscall_retval,
832
	.sv_fetch_syscall_args = linux_fetch_syscall_args,
833
	.sv_syscallnames = NULL,
834
	.sv_shared_page_base = SHAREDPAGE,
835
	.sv_shared_page_len = PAGE_SIZE,
836
	.sv_schedtail	= linux_schedtail,
837
	.sv_thread_detach = linux_thread_detach,
838
	.sv_trap	= linux_vsyscall,
839
};
840
841
static void
842
linux_vdso_install(void *param)
843
{
844
845
	linux_szsigcode = (&_binary_linux_locore_o_end - 
846
	    &_binary_linux_locore_o_start);
847
848
	if (linux_szsigcode > elf_linux_sysvec.sv_shared_page_len)
849
		panic("Linux invalid vdso size\n");
850
851
	__elfN(linux_vdso_fixup)(&elf_linux_sysvec);
852
853
	linux_shared_page_obj = __elfN(linux_shared_page_init)
854
	    (&linux_shared_page_mapping);
855
856
	__elfN(linux_vdso_reloc)(&elf_linux_sysvec, SHAREDPAGE);
857
858
	bcopy(elf_linux_sysvec.sv_sigcode, linux_shared_page_mapping,
859
	    linux_szsigcode);
860
	elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj;
861
862
	linux_kplatform = linux_shared_page_mapping +
863
	    (linux_platform - (caddr_t)SHAREDPAGE);
864
}
865
SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY,
866
    (sysinit_cfunc_t)linux_vdso_install, NULL);
867
868
static void
869
linux_vdso_deinstall(void *param)
870
{
871
872
	__elfN(linux_shared_page_fini)(linux_shared_page_obj);
873
};
874
SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST,
875
    (sysinit_cfunc_t)linux_vdso_deinstall, NULL);
876
877
static char GNULINUX_ABI_VENDOR[] = "GNU";
878
static int GNULINUX_ABI_DESC = 0;
879
880
static boolean_t
881
linux_trans_osrel(const Elf_Note *note, int32_t *osrel)
882
{
883
	const Elf32_Word *desc;
884
	uintptr_t p;
885
886
	p = (uintptr_t)(note + 1);
887
	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
888
889
	desc = (const Elf32_Word *)p;
890
	if (desc[0] != GNULINUX_ABI_DESC)
891
		return (FALSE);
892
893
	/*
894
	 * For linux we encode osrel as follows (see linux_mib.c):
895
	 * VVVMMMIII (version, major, minor), see linux_mib.c.
896
	 */
897
	*osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3];
898
899
	return (TRUE);
900
}
901
902
static Elf_Brandnote linux64_brandnote = {
903
	.hdr.n_namesz	= sizeof(GNULINUX_ABI_VENDOR),
904
	.hdr.n_descsz	= 16,
905
	.hdr.n_type	= 1,
906
	.vendor		= GNULINUX_ABI_VENDOR,
907
	.flags		= BN_TRANSLATE_OSREL,
908
	.trans_osrel	= linux_trans_osrel
909
};
910
911
static Elf64_Brandinfo linux_glibc2brand = {
912
	.brand		= ELFOSABI_LINUX,
913
	.machine	= EM_X86_64,
914
	.compat_3_brand	= "Linux",
915
	.emul_path	= "/compat/linux",
916
	.interp_path	= "/lib64/ld-linux-x86-64.so.2",
917
	.sysvec		= &elf_linux_sysvec,
918
	.interp_newpath	= NULL,
919
	.brand_note	= &linux64_brandnote,
920
	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
921
};
922
923
static Elf64_Brandinfo linux_glibc2brandshort = {
924
	.brand		= ELFOSABI_LINUX,
925
	.machine	= EM_X86_64,
926
	.compat_3_brand	= "Linux",
927
	.emul_path	= "/compat/linux",
928
	.interp_path	= "/lib64/ld-linux.so.2",
929
	.sysvec		= &elf_linux_sysvec,
930
	.interp_newpath	= NULL,
931
	.brand_note	= &linux64_brandnote,
932
	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
933
};
934
935
Elf64_Brandinfo *linux_brandlist[] = {
936
	&linux_glibc2brand,
937
	&linux_glibc2brandshort,
938
	NULL
939
};
940
941
static int
942
linux64_elf_modevent(module_t mod, int type, void *data)
943
{
944
	Elf64_Brandinfo **brandinfo;
945
	int error;
946
	struct linux_ioctl_handler **lihp;
947
948
	error = 0;
949
950
	switch(type) {
951
	case MOD_LOAD:
952
		for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL;
953
		     ++brandinfo)
954
			if (elf64_insert_brand_entry(*brandinfo) < 0)
955
				error = EINVAL;
956
		if (error == 0) {
957
			SET_FOREACH(lihp, linux_ioctl_handler_set)
958
				linux_ioctl_register_handler(*lihp);
959
			LIST_INIT(&futex_list);
960
			mtx_init(&futex_mtx, "ftllk64", NULL, MTX_DEF);
961
			stclohz = (stathz ? stathz : hz);
962
			if (bootverbose)
963
				printf("Linux x86-64 ELF exec handler installed\n");
964
		} else
965
			printf("cannot insert Linux x86-64 ELF brand handler\n");
966
		break;
967
	case MOD_UNLOAD:
968
		for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL;
969
		     ++brandinfo)
970
			if (elf64_brand_inuse(*brandinfo))
971
				error = EBUSY;
972
		if (error == 0) {
973
			for (brandinfo = &linux_brandlist[0];
974
			     *brandinfo != NULL; ++brandinfo)
975
				if (elf64_remove_brand_entry(*brandinfo) < 0)
976
					error = EINVAL;
977
		}
978
		if (error == 0) {
979
			SET_FOREACH(lihp, linux_ioctl_handler_set)
980
				linux_ioctl_unregister_handler(*lihp);
981
			mtx_destroy(&futex_mtx);
982
			if (bootverbose)
983
				printf("Linux ELF exec handler removed\n");
984
		} else
985
			printf("Could not deinstall ELF interpreter entry\n");
986
		break;
987
	default:
988
		return (EOPNOTSUPP);
989
	}
990
	return (error);
991
}
992
993
static moduledata_t linux64_elf_mod = {
994
	"linux64elf",
995
	linux64_elf_modevent,
996
	0
997
};
998
999
DECLARE_MODULE_TIED(linux64elf, linux64_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY);
1000
MODULE_DEPEND(linux64elf, linux_common, 1, 1, 1);
(-)sys/amd64/linux/linux_vdso.lds.s (+69 lines)
Line 0 Link Here
1
/*
2
 * Linker script for 64-bit vDSO.
3
 * Copied from Linux kernel arch/x86/vdso/vdso-layout.lds.S
4
 *
5
 * $FreeBSD$
6
 */
7
8
SECTIONS
9
{
10
	. = . + SIZEOF_HEADERS;
11
12
	.hash		: { *(.hash) }			:text
13
	.gnu.hash	: { *(.gnu.hash) }
14
	.dynsym		: { *(.dynsym) }
15
	.dynstr		: { *(.dynstr) }
16
	.gnu.version	: { *(.gnu.version) }
17
	.gnu.version_d	: { *(.gnu.version_d) }
18
	.gnu.version_r	: { *(.gnu.version_r) }
19
20
	.note		: { *(.note.*) }		:text	:note
21
22
	.eh_frame_hdr	: { *(.eh_frame_hdr) }		:text	:eh_frame_hdr
23
	.eh_frame	: { KEEP (*(.eh_frame)) }	:text
24
25
	.dynamic	: { *(.dynamic) }		:text	:dynamic
26
27
	.rodata		: { *(.rodata*) }		:text
28
	.data		: {
29
	      *(.data*)
30
	      *(.sdata*)
31
	      *(.got.plt) *(.got)
32
	      *(.gnu.linkonce.d.*)
33
	      *(.bss*)
34
	      *(.dynbss*)
35
	      *(.gnu.linkonce.b.*)
36
	}
37
38
	.altinstructions	: { *(.altinstructions) }
39
	.altinstr_replacement	: { *(.altinstr_replacement) }
40
41
	. = ALIGN(0x100);
42
	.text		: { *(.test .text*) }			:text	=0x90909090
43
}
44
45
PHDRS
46
{
47
	text		PT_LOAD		FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
48
	dynamic		PT_DYNAMIC	FLAGS(4);		/* PF_R */
49
	note		PT_NOTE		FLAGS(4);		/* PF_R */
50
	eh_frame_hdr	PT_GNU_EH_FRAME;
51
}
52
53
VERSION
54
{
55
	LINUX_2.6 {
56
	global:
57
		time;
58
		__vdso_time;
59
		gettimeofday;
60
		__vdso_gettimeofday;
61
		getcpu;
62
		__vdso_getcpu;
63
		clock_gettime;
64
		__vdso_clock_gettime;
65
		linux_rt_sigcode;
66
		linux_platform;
67
	local: *;
68
	};
69
}
(-)sys/amd64/linux/syscalls.conf (+11 lines)
Line 0 Link Here
1
# $FreeBSD$
2
sysnames="linux_syscalls.c"
3
sysproto="linux_proto.h"
4
sysproto_h=_LINUX_SYSPROTO_H_
5
syshdr="linux_syscall.h"
6
syssw="linux_sysent.c"
7
sysmk="/dev/null"
8
syscallprefix="LINUX_SYS_"
9
switchname="linux_sysent"
10
namesname="linux_syscallnames"
11
systrace="linux_systrace_args.c"
(-)sys/amd64/linux/syscalls.master (+515 lines)
Line 0 Link Here
1
 $FreeBSD$
2
3
;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
4
; System call name/number master file (or rather, slave, from LINUX).
5
; Processed to create linux_sysent.c, linux_proto.h and linux_syscall.h.
6
7
; Columns: number audit type nargs name alt{name,tag,rtyp}/comments
8
;	number	system call number, must be in order
9
;	audit	the audit event associated with the system call
10
;		A value of AUE_NULL means no auditing, but it also means that
11
;		there is no audit event for the call at this time. For the
12
;		case where the event exists, but we don't want auditing, the
13
;		event should be #defined to AUE_NULL in audit_kevents.h.
14
;	type	one of STD, OBSOL, UNIMPL
15
;	name	psuedo-prototype of syscall routine
16
;		If one of the following alts is different, then all appear:
17
;	altname	name of system call if different
18
;	alttag	name of args struct tag if different from [o]`name'"_args"
19
;	altrtyp	return type if not int (bogus - syscalls always return int)
20
;		for UNIMPL/OBSOL, name continues with comments
21
22
; types:
23
;	STD	always included
24
;	OBSOL	obsolete, not included in system, only specifies name
25
;	UNIMPL	not implemented, placeholder only
26
27
#include <sys/param.h>
28
#include <sys/sysent.h>
29
#include <sys/sysproto.h>
30
#include <compat/linux/linux_sysproto.h>
31
#include <amd64/linux/linux.h>
32
#include <amd64/linux/linux_proto.h>
33
34
; Isn't pretty, but there seems to be no other way to trap nosys
35
#define	nosys	linux_nosys
36
37
; #ifdef's, etc. may be included, and are copied to the output files.
38
39
0	AUE_NULL	NOPROTO	{ int read(int fd, char *buf, \
40
				    u_int nbyte); }
41
1	AUE_NULL	NOPROTO	{ int write(int fd, char *buf, \
42
				    u_int nbyte); }
43
2	AUE_OPEN_RWTC	STD	{ int linux_open(char *path, l_int flags, \
44
				    l_int mode); }
45
3	AUE_CLOSE	NOPROTO	{ int close(int fd); }
46
4	AUE_STAT	STD	{ int linux_newstat(char *path, \
47
				    struct l_newstat *buf); }
48
5	AUE_FSTAT	STD	{ int linux_newfstat(l_uint fd, \
49
				    struct l_newstat *buf); }
50
6	AUE_LSTAT	STD	{ int linux_newlstat(char *path, \
51
				    struct l_newstat *buf); }
52
7	AUE_POLL	NOPROTO	{ int poll(struct pollfd*, \
53
				    unsigned int nfds, int timeout); }
54
8	AUE_LSEEK	STD	{ int linux_lseek(l_uint fdes, l_off_t off, \
55
				    l_int whence); }
56
9	AUE_MMAP	STD	{ int linux_mmap2(l_ulong addr, l_ulong len, \
57
				    l_ulong prot, l_ulong flags, l_ulong fd, \
58
				    l_ulong pgoff); }
59
10	AUE_MPROTECT	STD	{ int linux_mprotect(caddr_t addr, int len, \
60
				    int prot); }
61
11	AUE_MUNMAP	NOPROTO	{ int munmap(caddr_t addr, int len); }
62
12	AUE_NULL	STD	{ int linux_brk(l_ulong dsend); }
63
13	AUE_NULL	STD	{ int linux_rt_sigaction(l_int sig, \
64
				    l_sigaction_t *act, l_sigaction_t *oact, \
65
				    l_size_t sigsetsize); }
66
14	AUE_NULL	STD	{ int linux_rt_sigprocmask(l_int how, \
67
				    l_sigset_t *mask, l_sigset_t *omask, \
68
				    l_size_t sigsetsize); }
69
15	AUE_NULL	STD	{ int linux_rt_sigreturn( \
70
				    struct l_ucontext *ucp); }
71
16	AUE_IOCTL	STD	{ int linux_ioctl(l_uint fd, l_uint cmd, \
72
				    uintptr_t arg); }
73
17	AUE_PREAD	STD	{ int linux_pread(l_uint fd, char *buf, \
74
				    l_size_t nbyte, l_loff_t offset); }
75
18	AUE_PWRITE	STD	{ int linux_pwrite(l_uint fd, char *buf, \
76
				    l_size_t nbyte, l_loff_t offset); }
77
19	AUE_READV	NOPROTO { int readv(int fd, struct iovec *iovp, \
78
				    u_int iovcnt); }
79
20	AUE_WRITEV	NOPROTO	{ int writev(int fd, struct iovec *iovp, \
80
				    u_int iovcnt); }
81
21	AUE_ACCESS	STD	{ int linux_access(char *path, l_int amode); }
82
22	AUE_PIPE	STD	{ int linux_pipe(l_ulong *pipefds); }
83
23	AUE_SELECT	STD	{ int linux_select(l_int nfds, \
84
				    l_fd_set *readfds, l_fd_set *writefds, \
85
				    l_fd_set *exceptfds, \
86
				    struct l_timeval *timeout); }
87
24	AUE_NULL	NOPROTO	{ int sched_yield(void); }
88
25	AUE_NULL	STD	{ int linux_mremap(l_ulong addr, \
89
				    l_ulong old_len, l_ulong new_len, \
90
				    l_ulong flags, l_ulong new_addr); }
91
26	AUE_MSYNC	STD	{ int linux_msync(l_ulong addr, \
92
				    l_size_t len, l_int fl); }
93
27	AUE_MINCORE	STD	{ int linux_mincore(l_ulong start, \
94
				    l_size_t len, u_char *vec); }
95
28	AUE_MADVISE	NOPROTO	{ int madvise(void *addr, size_t len, \
96
				    int behav); }
97
29	AUE_NULL	STD	{ int linux_shmget(l_key_t key, l_size_t size, \
98
				    l_int shmflg); }
99
30	AUE_NULL	STD	{ int linux_shmat(l_int shmid, char *shmaddr, \
100
				    l_int shmflg); }
101
31	AUE_NULL	STD	{ int linux_shmctl(l_int shmid, l_int cmd, \
102
				    struct l_shmid_ds *buf); }
103
32	AUE_DUP		NOPROTO	{ int dup(u_int fd); }
104
33	AUE_DUP2	NOPROTO	{ int dup2(u_int from, u_int to); }
105
34	AUE_NULL	STD	{ int linux_pause(void); }
106
35	AUE_NULL	STD	{ int linux_nanosleep( \
107
				    const struct l_timespec *rqtp, \
108
				    struct l_timespec *rmtp); }
109
36	AUE_GETITIMER	STD	{ int linux_getitimer(l_int which, \
110
				    struct l_itimerval *itv); }
111
37	AUE_NULL	STD	{ int linux_alarm(l_uint secs); }
112
38	AUE_SETITIMER	STD	{ int linux_setitimer(l_int which, \
113
				    struct l_itimerval *itv, \
114
				    struct l_itimerval *oitv); }
115
39	AUE_GETPID	STD	{ int linux_getpid(void); }
116
40	AUE_SENDFILE	STD	{ int linux_sendfile(int out, int in, \
117
				    l_long *offset, l_size_t count); }
118
41	AUE_SOCKET	STD	{ int linux_socket(l_int domain, l_int type, \
119
				    l_int protocol); }
120
42	AUE_CONNECT	STD	{ int linux_connect(l_int s, l_uintptr_t name, \
121
				    l_int namelen); }
122
43	AUE_ACCEPT	STD	{ int linux_accept(l_int s, l_uintptr_t addr, \
123
				    l_uintptr_t namelen); }
124
44	AUE_SENDTO	STD	{ int linux_sendto(l_int s, l_uintptr_t msg, \
125
				    l_int len, l_int flags, l_uintptr_t to, \
126
				    l_int tolen); }
127
45	AUE_RECVFROM	STD	{ int linux_recvfrom(l_int s, l_uintptr_t buf, \
128
				    l_size_t len, l_int flags, l_uintptr_t from, \
129
				    l_uintptr_t fromlen); }
130
46	AUE_SENDMSG	STD	{ int linux_sendmsg(l_int s, l_uintptr_t msg, \
131
				    l_int flags); }
132
47	AUE_RECVMSG	STD	{ int linux_recvmsg(l_int s, l_uintptr_t msg, \
133
				    l_int flags); }
134
48	AUE_NULL	STD	{ int linux_shutdown(l_int s, l_int how); }
135
49	AUE_BIND	STD	{ int linux_bind(l_int s, l_uintptr_t name, \
136
				    l_int namelen); }
137
50	AUE_LISTEN	STD	{ int linux_listen(l_int s, l_int backlog); }
138
51	AUE_GETSOCKNAME	STD	{ int linux_getsockname(l_int s, \
139
				    l_uintptr_t addr, l_uintptr_t namelen); }
140
52	AUE_GETPEERNAME	STD	{ int linux_getpeername(l_int s, \
141
				    l_uintptr_t addr, l_uintptr_t namelen); }
142
53	AUE_SOCKETPAIR	STD	{ int linux_socketpair(l_int domain, \
143
				    l_int type, l_int protocol, l_uintptr_t rsv); }
144
54	AUE_SETSOCKOPT	STD	{ int linux_setsockopt(l_int s, l_int level, \
145
				    l_int optname, l_uintptr_t optval, \
146
				    l_int optlen); }
147
55	AUE_GETSOCKOPT	STD	{ int linux_getsockopt(l_int s, l_int level, \
148
				    l_int optname, l_uintptr_t optval, \
149
				    l_uintptr_t optlen); }
150
56	AUE_RFORK	STD	{ int linux_clone(l_int flags, void *stack, \
151
				    void *parent_tidptr, void * child_tidptr, void *tls ); }
152
57	AUE_FORK	STD	{ int linux_fork(void); }
153
58	AUE_VFORK	STD	{ int linux_vfork(void); }
154
59	AUE_EXECVE	STD	{ int linux_execve(char *path, char **argp, \
155
				    char **envp); }
156
60	AUE_EXIT	STD	{ void linux_exit(int rval); }
157
61	AUE_WAIT4	STD	{ int linux_wait4(l_pid_t pid, \
158
				    l_int *status, l_int options, \
159
				    struct l_rusage *rusage); }
160
62	AUE_KILL	STD	{ int linux_kill(l_int pid, l_int signum); }
161
63	AUE_NULL	STD	{ int linux_newuname( \
162
				    struct l_new_utsname *buf); }
163
64	AUE_NULL	STD	{ int linux_semget(l_key_t key, \
164
				    l_int nsems, l_int semflg); }
165
65	AUE_NULL	STD	{ int linux_semop(l_int semid, \
166
				    struct l_sembuf *tsops, l_uint nsops); }
167
66	AUE_NULL	STD	{ int linux_semctl(l_int semid, \
168
				    l_int semnum, l_int cmd, union l_semun arg); }
169
67	AUE_NULL	STD	{ int linux_shmdt(char *shmaddr); }
170
68	AUE_NULL	STD	{ int linux_msgget(l_key_t key, l_int msgflg); }
171
69	AUE_NULL	STD	{ int linux_msgsnd(l_int msqid, \
172
				    struct l_msgbuf *msgp, l_size_t msgsz, \
173
				    l_int msgflg); }
174
70	AUE_NULL	STD	{ int linux_msgrcv(l_int msqid, \
175
				    struct l_msgbuf *msgp, l_size_t msgsz, \
176
				    l_long msgtyp, l_int msgflg); }
177
71	AUE_NULL	STD	{ int linux_msgctl(l_int msqid, l_int cmd, \
178
				    struct l_msqid_ds *buf); }
179
72	AUE_FCNTL	STD	{ int linux_fcntl(l_uint fd, l_uint cmd, \
180
				    l_ulong arg); }
181
73	AUE_FLOCK	NOPROTO	{ int flock(int fd, int how); }
182
74	AUE_FSYNC	NOPROTO	{ int fsync(int fd); }
183
75	AUE_NULL	STD	{ int linux_fdatasync(l_uint fd); }
184
76	AUE_TRUNCATE	STD	{ int linux_truncate(char *path, \
185
				    l_ulong length); }
186
77	AUE_FTRUNCATE	STD	{ int linux_ftruncate(l_int fd, l_long length); }
187
78	AUE_GETDIRENTRIES	STD { int linux_getdents(l_uint fd, void *dent, \
188
				    l_uint count); }
189
79	AUE_GETCWD	STD	{ int linux_getcwd(char *buf, \
190
				    l_ulong bufsize); }
191
80	AUE_CHDIR	STD	{ int linux_chdir(char *path); }
192
81	AUE_FCHDIR	NOPROTO	{ int fchdir(int fd); }
193
82	AUE_RENAME	STD	{ int linux_rename(char *from, char *to); }
194
83	AUE_MKDIR	STD	{ int linux_mkdir(char *path, l_int mode); }
195
84	AUE_RMDIR	STD	{ int linux_rmdir(char *path); }
196
85	AUE_CREAT	STD	{ int linux_creat(char *path, \
197
				    l_int mode); }
198
86	AUE_LINK	STD	{ int linux_link(char *path, char *to); }
199
87	AUE_UNLINK	STD	{ int linux_unlink(char *path); }
200
88	AUE_SYMLINK	STD	{ int linux_symlink(char *path, char *to); }
201
89	AUE_READLINK	STD	{ int linux_readlink(char *name, char *buf, \
202
				    l_int count); }
203
90	AUE_CHMOD	STD	{ int linux_chmod(char *path, \
204
				    l_mode_t mode); }
205
91	AUE_FCHMOD	NOPROTO	{ int fchmod(int fd, int mode); }
206
92	AUE_LCHOWN	STD	{ int linux_chown(char *path, \
207
				    l_uid_t uid, l_gid_t gid); }
208
93	AUE_FCHOWN	NOPROTO	{ int fchown(int fd, int uid, int gid); }
209
94	AUE_LCHOWN	STD	{ int linux_lchown(char *path, l_uid_t uid, \
210
				    l_gid_t gid); }
211
95	AUE_UMASK	NOPROTO	{ int umask(int newmask); }
212
96	AUE_NULL	NOPROTO	{ int gettimeofday(struct l_timeval *tp, \
213
				    struct timezone *tzp); }
214
97	AUE_GETRLIMIT	STD	{ int linux_getrlimit(l_uint resource, \
215
				    struct l_rlimit *rlim); }
216
98	AUE_GETRUSAGE	NOPROTO	{ int getrusage(int who, struct rusage *rusage); }
217
99	AUE_NULL	STD	{ int linux_sysinfo(struct l_sysinfo *info); }
218
100	AUE_NULL	STD	{ int linux_times(struct l_times_argv *buf); }
219
101	AUE_PTRACE	STD	{ int linux_ptrace(l_long req, l_long pid, \
220
				    l_long addr, l_long data); }
221
102	AUE_GETUID	STD	{ int linux_getuid(void); }
222
103	AUE_NULL	STD	{ int linux_syslog(l_int type, char *buf, \
223
				    l_int len); }
224
104	AUE_GETGID	STD	{ int linux_getgid(void); }
225
105	AUE_SETUID	NOPROTO	{ int setuid(uid_t uid); }
226
106	AUE_SETGID	NOPROTO	{ int setgid(gid_t gid); }
227
107	AUE_GETEUID	NOPROTO	{ int geteuid(void); }
228
108	AUE_GETEGID	NOPROTO	{ int getegid(void); }
229
109	AUE_SETPGRP	NOPROTO	{ int setpgid(int pid, int pgid); }
230
110	AUE_GETPPID	STD	{ int linux_getppid(void); }
231
111	AUE_GETPGRP	NOPROTO	{ int getpgrp(void); }
232
112	AUE_SETSID	NOPROTO	{ int setsid(void); }
233
113	AUE_SETREUID	NOPROTO	{ int setreuid(uid_t ruid, uid_t euid); }
234
114	AUE_SETREGID	NOPROTO	{ int setregid(gid_t rgid, gid_t egid); }
235
115	AUE_GETGROUPS	STD	{ int linux_getgroups(l_int gidsetsize, \
236
				    l_gid_t *grouplist); }
237
116	AUE_SETGROUPS	STD	{ int linux_setgroups(l_int gidsetsize, \
238
				    l_gid_t *grouplist); }
239
117	AUE_SETRESUID	NOPROTO	{ int setresuid(uid_t ruid, uid_t euid, \
240
				    uid_t suid); }
241
118	AUE_GETRESUID	NOPROTO	{ int getresuid(uid_t *ruid, uid_t *euid, \
242
				    uid_t *suid); }
243
119	AUE_SETRESGID	NOPROTO	{ int setresgid(gid_t rgid, gid_t egid, \
244
				    gid_t sgid); }
245
120	AUE_GETRESGID	NOPROTO	{ int getresgid(gid_t *rgid, gid_t *egid, \
246
				    gid_t *sgid); }
247
121	AUE_GETPGID	NOPROTO	{ int getpgid(int pid); }
248
122	AUE_SETFSUID	STD	{ int linux_setfsuid(l_uid_t uid); }
249
123	AUE_SETFSGID	STD	{ int linux_setfsgid(l_gid_t gid); }
250
124	AUE_GETSID	STD	{ int linux_getsid(l_pid_t pid); }
251
125	AUE_CAPGET	STD	{ int linux_capget(struct l_user_cap_header *hdrp, \
252
				    struct l_user_cap_data *datap); }
253
126	AUE_CAPSET	STD	{ int linux_capset(struct l_user_cap_header *hdrp, \
254
				    struct l_user_cap_data *datap); }
255
127	AUE_NULL	STD	{ int linux_rt_sigpending(l_sigset_t *set, \
256
				    l_size_t sigsetsize); }
257
128	AUE_NULL	STD	{ int linux_rt_sigtimedwait(l_sigset_t *mask, \
258
				    l_siginfo_t *ptr, \
259
				    struct l_timeval *timeout, \
260
				    l_size_t sigsetsize); }
261
129	AUE_NULL	STD	{ int linux_rt_sigqueueinfo(l_pid_t pid, l_int sig, \
262
				    l_siginfo_t *info); }
263
130	AUE_NULL	STD	{ int linux_rt_sigsuspend( \
264
				    l_sigset_t *newset, \
265
				    l_size_t sigsetsize); }
266
131	AUE_NULL	STD	{ int linux_sigaltstack(l_stack_t *uss, \
267
				    l_stack_t *uoss); }
268
132	AUE_UTIME	STD	{ int linux_utime(char *fname, \
269
				    struct l_utimbuf *times); }
270
133	AUE_MKNOD	STD	{ int linux_mknod(char *path, l_int mode, \
271
				    l_dev_t dev); }
272
134	AUE_USELIB	UNIMPL	uselib
273
135	AUE_PERSONALITY	STD	{ int linux_personality(l_ulong per); }
274
136	AUE_NULL	STD	{ int linux_ustat(l_dev_t dev, \
275
				    struct l_ustat *ubuf); }
276
137	AUE_STATFS	STD	{ int linux_statfs(char *path, \
277
				    struct l_statfs_buf *buf); }
278
138	AUE_FSTATFS	STD	{ int linux_fstatfs(l_uint fd, \
279
				    struct l_statfs_buf *buf); }
280
139	AUE_NULL	STD	{ int linux_sysfs(l_int option, \
281
				    l_ulong arg1, l_ulong arg2); }
282
140	AUE_GETPRIORITY	STD	{ int linux_getpriority(int which, int who); }
283
141	AUE_SETPRIORITY	NOPROTO	{ int setpriority(int which, int who, \
284
				    int prio); }
285
142	AUE_SCHED_SETPARAM	STD	{ int linux_sched_setparam(l_pid_t pid, \
286
				    struct l_sched_param *param); }
287
143	AUE_SCHED_GETPARAM	STD	{ int linux_sched_getparam(l_pid_t pid, \
288
				    struct l_sched_param *param); }
289
144	AUE_SCHED_SETSCHEDULER	STD { int linux_sched_setscheduler( \
290
				    l_pid_t pid, l_int policy, \
291
				    struct l_sched_param *param); }
292
145	AUE_SCHED_GETSCHEDULER	STD { int linux_sched_getscheduler( \
293
				    l_pid_t pid); }
294
146	AUE_SCHED_GET_PRIORITY_MAX	STD { int linux_sched_get_priority_max( \
295
				    l_int policy); }
296
147	AUE_SCHED_GET_PRIORITY_MIN	STD { int linux_sched_get_priority_min( \
297
				    l_int policy); }
298
148	AUE_SCHED_RR_GET_INTERVAL	STD { int linux_sched_rr_get_interval(l_pid_t pid, \
299
				    struct l_timespec *interval); }
300
149	AUE_MLOCK	NOPROTO	{ int mlock(const void *addr, size_t len); }
301
150	AUE_MUNLOCK	NOPROTO	{ int munlock(const void *addr, size_t len); }
302
151	AUE_MLOCKALL	NOPROTO	{ int mlockall(int how); }
303
152	AUE_MUNLOCKALL	NOPROTO	{ int munlockall(void); }
304
153	AUE_NULL	STD	{ int linux_vhangup(void); }
305
154	AUE_NULL	UNIMPL	modify_ldt
306
155	AUE_PIVOT_ROOT	STD	{ int linux_pivot_root(void); }
307
156	AUE_SYSCTL	STD	{ int linux_sysctl( \
308
				    struct l___sysctl_args *args); }
309
157	AUE_PRCTL	STD	{ int linux_prctl(l_int option, l_uintptr_t arg2, \
310
				    l_uintptr_t arg3, l_uintptr_t arg4, \
311
				    l_uintptr_t arg5); }
312
158	AUE_PRCTL	STD	{ int linux_arch_prctl(l_int code, l_ulong addr); }
313
159	AUE_ADJTIME	STD	{ int linux_adjtimex(void); }
314
160	AUE_SETRLIMIT	STD	{ int linux_setrlimit(l_uint resource, \
315
				    struct l_rlimit *rlim); }
316
161	AUE_CHROOT	NOPROTO	{ int chroot(char *path); }
317
162	AUE_SYNC	NOPROTO	{ int sync(void); }
318
163	AUE_ACCT	NOPROTO	{ int acct(char *path); }
319
164	AUE_SETTIMEOFDAY	NOPROTO	{ int settimeofday(struct l_timeval *tp, struct timezone *tzp); }
320
165	AUE_MOUNT	STD	{ int linux_mount(char *specialfile, \
321
				    char *dir, char *filesystemtype, \
322
				    l_ulong rwflag, void *data); }
323
166	AUE_UMOUNT	STD	{ int linux_umount(char *path, l_int flags); }
324
167	AUE_SWAPON	NOPROTO	{ int swapon(char *name); }
325
168	AUE_SWAPOFF	STD	{ int linux_swapoff(void); }
326
169	AUE_REBOOT	STD	{ int linux_reboot(l_int magic1, \
327
				    l_int magic2, l_uint cmd, void *arg); }
328
170	AUE_SYSCTL	STD	{ int linux_sethostname(char *hostname, \
329
				    l_uint len); }
330
171	AUE_SYSCTL	STD	{ int linux_setdomainname(char *name, \
331
				    l_int len); }
332
172	AUE_NULL	STD	{ int linux_iopl(l_uint level); }
333
173	AUE_NULL	UNIMPL	ioperm
334
174	AUE_NULL	STD	{ int linux_create_module(void); }
335
175	AUE_NULL	STD	{ int linux_init_module(void); }
336
176	AUE_NULL	STD	{ int linux_delete_module(void); }
337
177	AUE_NULL	STD	{ int linux_get_kernel_syms(void); }
338
178	AUE_NULL	STD	{ int linux_query_module(void); }
339
179	AUE_QUOTACTL	STD	{ int linux_quotactl(void); }
340
180	AUE_NULL	STD	{ int linux_nfsservctl(void); }
341
181	AUE_GETPMSG	STD	{ int linux_getpmsg(void); }
342
182	AUE_PUTPMSG	STD	{ int linux_putpmsg(void); }
343
183	AUE_NULL	STD	{ int linux_afs_syscall(void); }
344
184	AUE_NULL	STD	{ int linux_tuxcall(void); }
345
185	AUE_NULL	STD	{ int linux_security(void); }
346
186	AUE_NULL	STD	{ int linux_gettid(void); }
347
187	AUE_NULL	UNIMPL	linux_readahead
348
188	AUE_NULL	STD	{ int linux_setxattr(void); }
349
189	AUE_NULL	STD	{ int linux_lsetxattr(void); }
350
190	AUE_NULL	STD	{ int linux_fsetxattr(void); }
351
191	AUE_NULL	STD	{ int linux_getxattr(void); }
352
192	AUE_NULL	STD	{ int linux_lgetxattr(void); }
353
193	AUE_NULL	STD	{ int linux_fgetxattr(void); }
354
194	AUE_NULL	STD	{ int linux_listxattr(void); }
355
195	AUE_NULL	STD	{ int linux_llistxattr(void); }
356
196	AUE_NULL	STD	{ int linux_flistxattr(void); }
357
197	AUE_NULL	STD	{ int linux_removexattr(void); }
358
198	AUE_NULL	STD	{ int linux_lremovexattr(void); }
359
199	AUE_NULL	STD	{ int linux_fremovexattr(void); }
360
200	AUE_NULL	STD	{ int linux_tkill(int tid, int sig); }
361
201	AUE_NULL	STD	{ int linux_time(l_time_t *tm); }
362
202	AUE_NULL	STD	{ int linux_sys_futex(void *uaddr, int op, int val, \
363
				    struct l_timespec *timeout, void *uaddr2, int val3); }
364
203	AUE_NULL	STD	{ int linux_sched_setaffinity(l_pid_t pid, l_uint len, \
365
				    l_ulong *user_mask_ptr); }
366
204	AUE_NULL	STD	{ int linux_sched_getaffinity(l_pid_t pid, l_uint len, \
367
				    l_ulong *user_mask_ptr); }
368
205	AUE_NULL	STD	{ int linux_set_thread_area(void); }
369
206	AUE_NULL	UNIMPL	linux_io_setup
370
207	AUE_NULL	UNIMPL	linux_io_destroy
371
208	AUE_NULL	UNIMPL	linux_io_getevents
372
209	AUE_NULL	UNIMPL	inux_io_submit
373
210	AUE_NULL	UNIMPL	linux_io_cancel
374
211	AUE_NULL	UNIMPL	linux_get_thread_area
375
212	AUE_NULL	STD	{ int linux_lookup_dcookie(void); }
376
213	AUE_NULL	STD	{ int linux_epoll_create(l_int size); }
377
214	AUE_NULL	STD	{ int linux_epoll_ctl_old(void); }
378
215	AUE_NULL	STD	{ int linux_epoll_wait_old(void); }
379
216	AUE_NULL	STD	{ int linux_remap_file_pages(void); }
380
217	AUE_GETDIRENTRIES	STD { int linux_getdents64(l_uint fd, \
381
				    void *dirent, l_uint count); }
382
218	AUE_NULL	STD	{ int linux_set_tid_address(int *tidptr); }
383
219	AUE_NULL	UNIMPL	restart_syscall
384
220	AUE_NULL	STD	{ int linux_semtimedop(void); }
385
221	AUE_NULL	STD	{ int linux_fadvise64(int fd, l_loff_t offset, \
386
				    l_size_t len, int advice); }
387
222	AUE_NULL	STD	{ int linux_timer_create(clockid_t clock_id, \
388
				    struct sigevent *evp, l_timer_t *timerid); }
389
223	AUE_NULL	STD	{ int linux_timer_settime(l_timer_t timerid, l_int flags, \
390
				    const struct itimerspec *new, struct itimerspec *old); }
391
224	AUE_NULL	STD	{ int linux_timer_gettime(l_timer_t timerid, struct itimerspec *setting); }
392
225	AUE_NULL	STD	{ int linux_timer_getoverrun(l_timer_t timerid); }
393
226	AUE_NULL	STD	{ int linux_timer_delete(l_timer_t timerid); }
394
227	AUE_CLOCK_SETTIME	STD	{ int linux_clock_settime(clockid_t which, struct l_timespec *tp); }
395
228	AUE_NULL	STD	{ int linux_clock_gettime(clockid_t which, struct l_timespec *tp); }
396
229	AUE_NULL	STD	{ int linux_clock_getres(clockid_t which, struct l_timespec *tp); }
397
230	AUE_NULL	STD	{ int linux_clock_nanosleep(clockid_t which, int flags, \
398
				    struct l_timespec *rqtp, struct l_timespec *rmtp); }
399
231	AUE_EXIT	STD	{ int linux_exit_group(int error_code); }
400
232	AUE_NULL	STD	{ int linux_epoll_wait(l_int epfd, struct epoll_event *events, \
401
					l_int maxevents, l_int timeout); }
402
233	AUE_NULL	STD	{ int linux_epoll_ctl(l_int epfd, l_int op, l_int fd, \
403
					struct epoll_event *event); }
404
234	AUE_NULL	STD	{ int linux_tgkill(int tgid, int pid, int sig); }
405
235	AUE_UTIMES	STD	{ int linux_utimes(char *fname, \
406
				    struct l_timeval *tptr); }
407
236	AUE_NULL	UNIMPL	vserver
408
237	AUE_NULL	STD	{ int linux_mbind(void); }
409
238	AUE_NULL	STD	{ int linux_set_mempolicy(void); }
410
239	AUE_NULL	STD	{ int linux_get_mempolicy(void); }
411
240	AUE_NULL	STD	{ int linux_mq_open(void); }
412
241	AUE_NULL	STD	{ int linux_mq_unlink(void); }
413
242	AUE_NULL	STD	{ int linux_mq_timedsend(void); }
414
243	AUE_NULL	STD	{ int linux_mq_timedreceive(void); }
415
244	AUE_NULL	STD	{ int linux_mq_notify(void); }
416
245	AUE_NULL	STD	{ int linux_mq_getsetattr(void); }
417
246	AUE_NULL	STD	{ int linux_kexec_load(void); }
418
247	AUE_WAIT6	STD	{ int linux_waitid(int idtype, l_pid_t id, l_siginfo_t *info, \
419
				    int options, struct l_rusage *rusage); }
420
248	AUE_NULL	STD	{ int linux_add_key(void); }
421
249	AUE_NULL	STD	{ int linux_request_key(void); }
422
250	AUE_NULL	STD	{ int linux_keyctl(void); }
423
251	AUE_NULL	STD	{ int linux_ioprio_set(void); }
424
252	AUE_NULL	STD	{ int linux_ioprio_get(void); }
425
253	AUE_NULL	STD	{ int linux_inotify_init(void); }
426
254	AUE_NULL	STD	{ int linux_inotify_add_watch(void); }
427
255	AUE_NULL	STD	{ int linux_inotify_rm_watch(void); }
428
256	AUE_NULL	STD	{ int linux_migrate_pages(void); }
429
257	AUE_OPEN_RWTC	STD	{ int linux_openat(l_int dfd, const char *filename, \
430
				    l_int flags, l_int mode); }
431
258	AUE_MKDIRAT	STD	{ int linux_mkdirat(l_int dfd, const char *pathname, \
432
				    l_int mode); }
433
259	AUE_MKNODAT	STD	{ int linux_mknodat(l_int dfd, const char *filename, \
434
				    l_int mode, l_uint dev); }
435
260	AUE_FCHOWNAT	STD	{ int linux_fchownat(l_int dfd, const char *filename, \
436
				    l_uid_t uid, l_gid_t gid, l_int flag); }
437
261	AUE_FUTIMESAT	STD	{ int linux_futimesat(l_int dfd, char *filename, \
438
				    struct l_timeval *utimes); }
439
262	AUE_FSTATAT	STD	{ int linux_newfstatat(l_int dfd, char *pathname, \
440
				    struct l_stat64 *statbuf, l_int flag); }
441
263	AUE_UNLINKAT	STD	{ int linux_unlinkat(l_int dfd, const char *pathname, \
442
				    l_int flag); }
443
264	AUE_RENAMEAT	STD	{ int linux_renameat(l_int olddfd, const char *oldname, \
444
				    l_int newdfd, const char *newname); }
445
265	AUE_LINKAT	STD	{ int linux_linkat(l_int olddfd, const char *oldname, \
446
				    l_int newdfd, const char *newname, l_int flag); }
447
266	AUE_SYMLINKAT	STD	{ int linux_symlinkat(const char *oldname, l_int newdfd, \
448
				    const char *newname); }
449
267	AUE_READLINKAT	STD	{ int linux_readlinkat(l_int dfd, const char *path, \
450
				    char *buf, l_int bufsiz); }
451
268	AUE_FCHMODAT	STD	{ int linux_fchmodat(l_int dfd, const char *filename, \
452
				    l_mode_t mode); }
453
269	AUE_FACCESSAT	STD	{ int linux_faccessat(l_int dfd, const char *filename, \
454
				    l_int amode); }
455
270	AUE_SELECT	STD	{ int linux_pselect6(l_int nfds,			\
456
				    l_fd_set *readfds, l_fd_set *writefds, l_fd_set *exceptfds,	\
457
				    struct l_timespec *tsp, l_uintptr_t *sig); }
458
271	AUE_POLL	STD	{ int linux_ppoll(struct pollfd *fds, uint32_t nfds,	\
459
				    struct l_timespec *tsp, l_sigset_t *sset, l_size_t ssize); }
460
272	AUE_NULL	STD	{ int linux_unshare(void); }
461
273	AUE_NULL	STD	{ int linux_set_robust_list(struct linux_robust_list_head *head, \
462
				    l_size_t len); }
463
274	AUE_NULL	STD	{ int linux_get_robust_list(l_int pid, struct linux_robust_list_head *head, \
464
				    l_size_t *len); }
465
275	AUE_NULL	STD	{ int linux_splice(void); }
466
276	AUE_NULL	STD	{ int linux_tee(void); }
467
277	AUE_NULL	STD	{ int linux_sync_file_range(void); }
468
278	AUE_NULL	STD	{ int linux_vmsplice(void); }
469
279	AUE_NULL	STD	{ int linux_move_pages(void); }
470
280	AUE_FUTIMESAT	STD	{ int linux_utimensat(l_int dfd, const char *pathname, \
471
					const struct l_timespec *times, l_int flags); }
472
281     AUE_NULL        STD     { int linux_epoll_pwait(l_int epfd, struct epoll_event *events, \
473
                                        l_int maxevents, l_int timeout, l_sigset_t *mask); }
474
282	AUE_NULL	STD	{ int linux_signalfd(void); }
475
283	AUE_NULL	STD	{ int linux_timerfd(void); }
476
284	AUE_NULL	STD	{ int linux_eventfd(l_uint initval); }
477
285	AUE_NULL	STD	{ int linux_fallocate(l_int fd, l_int mode, \
478
				    l_loff_t offset, l_loff_t len); }
479
286	AUE_NULL	STD	{ int linux_timerfd_settime(void); }
480
287	AUE_NULL	STD	{ int linux_timerfd_gettime(void); }
481
288	AUE_ACCEPT	STD	{ int linux_accept4(l_int s, l_uintptr_t addr, \
482
				    l_uintptr_t namelen, int flags); }
483
289	AUE_NULL	STD	{ int linux_signalfd4(void); }
484
290	AUE_NULL	STD	{ int linux_eventfd2(l_uint initval, l_int flags); }
485
291	AUE_NULL	STD	{ int linux_epoll_create1(l_int flags); }
486
292	AUE_NULL	STD	{ int linux_dup3(l_int oldfd,		\
487
				    l_int newfd, l_int flags); }
488
293	AUE_NULL	STD	{ int linux_pipe2(l_int *pipefds, l_int flags); }
489
294	AUE_NULL	STD	{ int linux_inotify_init1(void); }
490
295	AUE_NULL	STD	{ int linux_preadv(void); }
491
296	AUE_NULL	STD	{ int linux_pwritev(void); }
492
297	AUE_NULL	STD	{ int linux_rt_tsigqueueinfo(void); }
493
298	AUE_NULL	STD	{ int linux_perf_event_open(void); }
494
299	AUE_NULL	STD	{ int linux_recvmmsg(l_int s,			\
495
				    struct l_mmsghdr *msg, l_uint vlen,		\
496
				    l_uint flags, struct l_timespec *timeout); }
497
300	AUE_NULL	STD	{ int linux_fanotify_init(void); }
498
301	AUE_NULL	STD	{ int linux_fanotify_mark(void); }
499
302	AUE_NULL	STD	{ int linux_prlimit64(l_pid_t pid,	\
500
				    l_uint resource, struct rlimit *new,\
501
				    struct rlimit *old); }
502
303	AUE_NULL	STD	{ int linux_name_to_handle_at(void); }
503
304	AUE_NULL	STD	{ int linux_open_by_handle_at(void); }
504
305	AUE_NULL	STD	{ int linux_clock_adjtime(void); }
505
306	AUE_SYNC	STD	{ int linux_syncfs(l_int fd); }
506
307	AUE_NULL	STD	{ int linux_sendmmsg(l_int s,			\
507
				    struct l_mmsghdr *msg, l_uint vlen,		\
508
				    l_uint flags); }
509
308	AUE_NULL	STD	{ int linux_setns(void); }
510
309	AUE_NULL	STD	{ int linux_process_vm_readv(void); }
511
310	AUE_NULL	STD	{ int linux_process_vm_writev(void); }
512
311	AUE_NULL	STD	{ int linux_kcmp(void); }
513
312	AUE_NULL	STD	{ int linux_finit_module(void); }
514
; please, keep this line at the end.
515
313	AUE_NULL	UNIMPL	nosys
(-)sys/amd64/linux32/linux.h (-119 / +19 lines)
Lines 33-38 Link Here
33
#ifndef _AMD64_LINUX_H_
33
#ifndef _AMD64_LINUX_H_
34
#define	_AMD64_LINUX_H_
34
#define	_AMD64_LINUX_H_
35
35
36
#include <compat/linux/linux.h>
36
#include <amd64/linux32/linux32_syscall.h>
37
#include <amd64/linux32/linux32_syscall.h>
37
38
38
/*
39
/*
Lines 40-53 Link Here
40
 */
41
 */
41
extern u_char linux_debug_map[];
42
extern u_char linux_debug_map[];
42
#define	ldebug(name)	isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
43
#define	ldebug(name)	isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
43
#define	ARGS(nm, fmt)	"linux(%ld): "#nm"("fmt")\n", (long)td->td_proc->p_pid
44
#define	ARGS(nm, fmt)	"linux(%ld/%ld): "#nm"("fmt")\n",			\
44
#define	LMSG(fmt)	"linux(%ld): "fmt"\n", (long)td->td_proc->p_pid
45
			(long)td->td_proc->p_pid, (long)td->td_tid
46
#define	LMSG(fmt)	"linux(%ld/%ld): "fmt"\n",				\
47
			(long)td->td_proc->p_pid, (long)td->td_tid
45
#define	LINUX_DTRACE	linuxulator32
48
#define	LINUX_DTRACE	linuxulator32
46
49
47
#ifdef MALLOC_DECLARE
48
MALLOC_DECLARE(M_LINUX);
49
#endif
50
51
#define	LINUX32_MAXUSER		((1ul << 32) - PAGE_SIZE)
50
#define	LINUX32_MAXUSER		((1ul << 32) - PAGE_SIZE)
52
#define	LINUX32_SHAREDPAGE	(LINUX32_MAXUSER - PAGE_SIZE)
51
#define	LINUX32_SHAREDPAGE	(LINUX32_MAXUSER - PAGE_SIZE)
53
#define	LINUX32_USRSTACK	LINUX32_SHAREDPAGE
52
#define	LINUX32_USRSTACK	LINUX32_SHAREDPAGE
Lines 97-102 Link Here
97
typedef l_ushort	l_uid16_t;
96
typedef l_ushort	l_uid16_t;
98
typedef l_int		l_timer_t;
97
typedef l_int		l_timer_t;
99
typedef l_int		l_mqd_t;
98
typedef l_int		l_mqd_t;
99
typedef	l_ulong		l_fd_mask;
100
100
101
typedef struct {
101
typedef struct {
102
	l_int		val[2];
102
	l_int		val[2];
Lines 112-118 Link Here
112
/*
112
/*
113
 * Miscellaneous
113
 * Miscellaneous
114
 */
114
 */
115
#define	LINUX_AT_COUNT		16	/* Count of used aux entry types.
115
#define	LINUX_AT_COUNT		20	/* Count of used aux entry types.
116
					 * Keep this synchronized with
116
					 * Keep this synchronized with
117
					 * elf_linux_fixup() code.
117
					 * elf_linux_fixup() code.
118
					 */
118
					 */
Lines 260-308 Link Here
260
        l_int           f_spare[6];
260
        l_int           f_spare[6];
261
} __packed;
261
} __packed;
262
262
263
/*
264
 * Signalling
265
 */
266
#define	LINUX_SIGHUP		1
267
#define	LINUX_SIGINT		2
268
#define	LINUX_SIGQUIT		3
269
#define	LINUX_SIGILL		4
270
#define	LINUX_SIGTRAP		5
271
#define	LINUX_SIGABRT		6
272
#define	LINUX_SIGIOT		LINUX_SIGABRT
273
#define	LINUX_SIGBUS		7
274
#define	LINUX_SIGFPE		8
275
#define	LINUX_SIGKILL		9
276
#define	LINUX_SIGUSR1		10
277
#define	LINUX_SIGSEGV		11
278
#define	LINUX_SIGUSR2		12
279
#define	LINUX_SIGPIPE		13
280
#define	LINUX_SIGALRM		14
281
#define	LINUX_SIGTERM		15
282
#define	LINUX_SIGSTKFLT		16
283
#define	LINUX_SIGCHLD		17
284
#define	LINUX_SIGCONT		18
285
#define	LINUX_SIGSTOP		19
286
#define	LINUX_SIGTSTP		20
287
#define	LINUX_SIGTTIN		21
288
#define	LINUX_SIGTTOU		22
289
#define	LINUX_SIGURG		23
290
#define	LINUX_SIGXCPU		24
291
#define	LINUX_SIGXFSZ		25
292
#define	LINUX_SIGVTALRM		26
293
#define	LINUX_SIGPROF		27
294
#define	LINUX_SIGWINCH		28
295
#define	LINUX_SIGIO		29
296
#define	LINUX_SIGPOLL		LINUX_SIGIO
297
#define	LINUX_SIGPWR		30
298
#define	LINUX_SIGSYS		31
299
#define	LINUX_SIGRTMIN		32
300
301
#define	LINUX_SIGTBLSZ		31
302
#define	LINUX_NSIG_WORDS	2
303
#define	LINUX_NBPW		32
304
#define	LINUX_NSIG		(LINUX_NBPW * LINUX_NSIG_WORDS)
305
306
/* sigaction flags */
263
/* sigaction flags */
307
#define	LINUX_SA_NOCLDSTOP	0x00000001
264
#define	LINUX_SA_NOCLDSTOP	0x00000001
308
#define	LINUX_SA_NOCLDWAIT	0x00000002
265
#define	LINUX_SA_NOCLDWAIT	0x00000002
Lines 319-345 Link Here
319
#define	LINUX_SIG_UNBLOCK	1
276
#define	LINUX_SIG_UNBLOCK	1
320
#define	LINUX_SIG_SETMASK	2
277
#define	LINUX_SIG_SETMASK	2
321
278
322
/* sigset_t macros */
323
#define	LINUX_SIGEMPTYSET(set)		(set).__bits[0] = (set).__bits[1] = 0
324
#define	LINUX_SIGISMEMBER(set, sig)	SIGISMEMBER(set, sig)
325
#define	LINUX_SIGADDSET(set, sig)	SIGADDSET(set, sig)
326
327
/* sigaltstack */
279
/* sigaltstack */
328
#define	LINUX_MINSIGSTKSZ	2048
280
#define	LINUX_MINSIGSTKSZ	2048
329
#define	LINUX_SS_ONSTACK	1
330
#define	LINUX_SS_DISABLE	2
331
281
332
int linux_to_bsd_sigaltstack(int lsa);
333
int bsd_to_linux_sigaltstack(int bsa);
334
335
typedef l_uintptr_t l_handler_t;
282
typedef l_uintptr_t l_handler_t;
336
typedef l_ulong	l_osigset_t;
283
typedef l_ulong	l_osigset_t;
337
284
338
typedef struct {
285
typedef struct {
339
	l_uint	__bits[LINUX_NSIG_WORDS];
340
} __packed l_sigset_t;
341
342
typedef struct {
343
	l_handler_t	lsa_handler;
286
	l_handler_t	lsa_handler;
344
	l_osigset_t	lsa_mask;
287
	l_osigset_t	lsa_mask;
345
	l_ulong		lsa_flags;
288
	l_ulong		lsa_flags;
Lines 508-514 Link Here
508
	l_int			sf_sig;
451
	l_int			sf_sig;
509
	struct l_sigcontext	sf_sc;
452
	struct l_sigcontext	sf_sc;
510
	struct l_fpstate	sf_fpstate;
453
	struct l_fpstate	sf_fpstate;
511
	l_uint			sf_extramask[LINUX_NSIG_WORDS-1];
454
	l_uint			sf_extramask[1];
512
	l_handler_t		sf_handler;
455
	l_handler_t		sf_handler;
513
} __packed;
456
} __packed;
514
457
Lines 521-570 Link Here
521
	l_handler_t 		sf_handler;
464
	l_handler_t 		sf_handler;
522
} __packed;
465
} __packed;
523
466
524
extern struct sysentvec elf_linux_sysvec;
525
526
/*
467
/*
527
 * open/fcntl flags
468
 * arch specific open/fcntl flags
528
 */
469
 */
529
#define	LINUX_O_RDONLY		00000000
530
#define	LINUX_O_WRONLY		00000001
531
#define	LINUX_O_RDWR		00000002
532
#define	LINUX_O_ACCMODE		00000003
533
#define	LINUX_O_CREAT		00000100
534
#define	LINUX_O_EXCL		00000200
535
#define	LINUX_O_NOCTTY		00000400
536
#define	LINUX_O_TRUNC		00001000
537
#define	LINUX_O_APPEND		00002000
538
#define	LINUX_O_NONBLOCK	00004000
539
#define	LINUX_O_NDELAY		LINUX_O_NONBLOCK
540
#define	LINUX_O_SYNC		00010000
541
#define	LINUX_FASYNC		00020000
542
#define	LINUX_O_DIRECT		00040000	/* Direct disk access hint */
543
#define	LINUX_O_LARGEFILE	00100000
544
#define	LINUX_O_DIRECTORY	00200000	/* Must be a directory */
545
#define	LINUX_O_NOFOLLOW	00400000	/* Do not follow links */
546
#define	LINUX_O_NOATIME		01000000
547
#define	LINUX_O_CLOEXEC		02000000
548
549
#define	LINUX_F_DUPFD		0
550
#define	LINUX_F_GETFD		1
551
#define	LINUX_F_SETFD		2
552
#define	LINUX_F_GETFL		3
553
#define	LINUX_F_SETFL		4
554
#define	LINUX_F_GETLK		5
555
#define	LINUX_F_SETLK		6
556
#define	LINUX_F_SETLKW		7
557
#define	LINUX_F_SETOWN		8
558
#define	LINUX_F_GETOWN		9
559
560
#define	LINUX_F_GETLK64		12
470
#define	LINUX_F_GETLK64		12
561
#define	LINUX_F_SETLK64		13
471
#define	LINUX_F_SETLK64		13
562
#define	LINUX_F_SETLKW64	14
472
#define	LINUX_F_SETLKW64	14
563
473
564
#define	LINUX_F_RDLCK		0
565
#define	LINUX_F_WRLCK		1
566
#define	LINUX_F_UNLCK		2
567
568
union l_semun {
474
union l_semun {
569
	l_int		val;
475
	l_int		val;
570
	l_uintptr_t	buf;
476
	l_uintptr_t	buf;
Lines 573-578 Link Here
573
	l_uintptr_t	__pad;
479
	l_uintptr_t	__pad;
574
} __packed;
480
} __packed;
575
481
482
struct l_ipc_perm {
483
	l_key_t		key;
484
	l_uid16_t	uid;
485
	l_gid16_t	gid;
486
	l_uid16_t	cuid;
487
	l_gid16_t	cgid;
488
	l_ushort	mode;
489
	l_ushort	seq;
490
};
491
576
/*
492
/*
577
 * Socket defines
493
 * Socket defines
578
 */
494
 */
Lines 609-630 Link Here
609
	char		sa_data[14];
525
	char		sa_data[14];
610
} __packed;
526
} __packed;
611
527
612
struct l_msghdr {
613
	l_uintptr_t	msg_name;
614
	l_int		msg_namelen;
615
	l_uintptr_t	msg_iov;
616
	l_size_t	msg_iovlen;
617
	l_uintptr_t	msg_control;
618
	l_size_t	msg_controllen;
619
	l_uint		msg_flags;
620
};
621
622
struct l_cmsghdr {
623
	l_size_t	cmsg_len;
624
	l_int		cmsg_level;
625
	l_int		cmsg_type;
626
};
627
628
struct l_ifmap {
528
struct l_ifmap {
629
	l_ulong		mem_start;
529
	l_ulong		mem_start;
630
	l_ulong		mem_end;
530
	l_ulong		mem_end;
(-)sys/amd64/linux32/linux32_dummy.c (-20 lines)
Lines 62-68 Link Here
62
DUMMY(sysfs);
62
DUMMY(sysfs);
63
DUMMY(query_module);
63
DUMMY(query_module);
64
DUMMY(nfsservctl);
64
DUMMY(nfsservctl);
65
DUMMY(rt_sigqueueinfo);
66
DUMMY(sendfile);
65
DUMMY(sendfile);
67
DUMMY(setfsuid);
66
DUMMY(setfsuid);
68
DUMMY(setfsgid);
67
DUMMY(setfsgid);
Lines 70-78 Link Here
70
DUMMY(mincore);
69
DUMMY(mincore);
71
DUMMY(ptrace);
70
DUMMY(ptrace);
72
DUMMY(lookup_dcookie);
71
DUMMY(lookup_dcookie);
73
DUMMY(epoll_create);
74
DUMMY(epoll_ctl);
75
DUMMY(epoll_wait);
76
DUMMY(remap_file_pages);
72
DUMMY(remap_file_pages);
77
DUMMY(fstatfs64);
73
DUMMY(fstatfs64);
78
DUMMY(mbind);
74
DUMMY(mbind);
Lines 85-91 Link Here
85
DUMMY(mq_notify);
81
DUMMY(mq_notify);
86
DUMMY(mq_getsetattr);
82
DUMMY(mq_getsetattr);
87
DUMMY(kexec_load);
83
DUMMY(kexec_load);
88
DUMMY(waitid);
89
/* linux 2.6.11: */
84
/* linux 2.6.11: */
90
DUMMY(add_key);
85
DUMMY(add_key);
91
DUMMY(request_key);
86
DUMMY(request_key);
Lines 98-105 Link Here
98
DUMMY(inotify_rm_watch);
93
DUMMY(inotify_rm_watch);
99
/* linux 2.6.16: */
94
/* linux 2.6.16: */
100
DUMMY(migrate_pages);
95
DUMMY(migrate_pages);
101
DUMMY(pselect6);
102
DUMMY(ppoll);
103
DUMMY(unshare);
96
DUMMY(unshare);
104
/* linux 2.6.17: */
97
/* linux 2.6.17: */
105
DUMMY(splice);
98
DUMMY(splice);
Lines 110-131 Link Here
110
DUMMY(move_pages);
103
DUMMY(move_pages);
111
/* linux 2.6.19: */
104
/* linux 2.6.19: */
112
DUMMY(getcpu);
105
DUMMY(getcpu);
113
DUMMY(epoll_pwait);
114
/* linux 2.6.22: */
106
/* linux 2.6.22: */
115
DUMMY(utimensat);
116
DUMMY(signalfd);
107
DUMMY(signalfd);
117
DUMMY(timerfd_create);
108
DUMMY(timerfd_create);
118
DUMMY(eventfd);
119
/* linux 2.6.23: */
120
DUMMY(fallocate);
121
/* linux 2.6.25: */
109
/* linux 2.6.25: */
122
DUMMY(timerfd_settime);
110
DUMMY(timerfd_settime);
123
DUMMY(timerfd_gettime);
111
DUMMY(timerfd_gettime);
124
/* linux 2.6.27: */
112
/* linux 2.6.27: */
125
DUMMY(signalfd4);
113
DUMMY(signalfd4);
126
DUMMY(eventfd2);
127
DUMMY(epoll_create1);
128
DUMMY(dup3);
129
DUMMY(inotify_init1);
114
DUMMY(inotify_init1);
130
/* linux 2.6.30: */
115
/* linux 2.6.30: */
131
DUMMY(preadv);
116
DUMMY(preadv);
Lines 134-150 Link Here
134
DUMMY(rt_tsigqueueinfo);
119
DUMMY(rt_tsigqueueinfo);
135
DUMMY(perf_event_open);
120
DUMMY(perf_event_open);
136
/* linux 2.6.33: */
121
/* linux 2.6.33: */
137
DUMMY(recvmmsg);
138
DUMMY(fanotify_init);
122
DUMMY(fanotify_init);
139
DUMMY(fanotify_mark);
123
DUMMY(fanotify_mark);
140
/* linux 2.6.36: */
141
DUMMY(prlimit64);
142
/* later: */
124
/* later: */
143
DUMMY(name_to_handle_at);
125
DUMMY(name_to_handle_at);
144
DUMMY(open_by_handle_at);
126
DUMMY(open_by_handle_at);
145
DUMMY(clock_adjtime);
127
DUMMY(clock_adjtime);
146
DUMMY(syncfs);
147
DUMMY(sendmmsg);
148
DUMMY(setns);
128
DUMMY(setns);
149
DUMMY(process_vm_readv);
129
DUMMY(process_vm_readv);
150
DUMMY(process_vm_writev);
130
DUMMY(process_vm_writev);
(-)sys/amd64/linux32/linux32_genassym.c (+3 lines)
Lines 6-11 Link Here
6
#include <sys/systm.h>
6
#include <sys/systm.h>
7
7
8
#include <amd64/linux32/linux.h>
8
#include <amd64/linux32/linux.h>
9
#include <compat/linux/linux_mib.h>
9
10
10
ASSYM(LINUX_SIGF_HANDLER, offsetof(struct l_sigframe, sf_handler));
11
ASSYM(LINUX_SIGF_HANDLER, offsetof(struct l_sigframe, sf_handler));
11
ASSYM(LINUX_SIGF_SC, offsetof(struct l_sigframe, sf_sc));
12
ASSYM(LINUX_SIGF_SC, offsetof(struct l_sigframe, sf_sc));
Lines 12-14 Link Here
12
ASSYM(LINUX_RT_SIGF_HANDLER, offsetof(struct l_rt_sigframe, sf_handler));
13
ASSYM(LINUX_RT_SIGF_HANDLER, offsetof(struct l_rt_sigframe, sf_handler));
13
ASSYM(LINUX_RT_SIGF_UC, offsetof(struct l_rt_sigframe, sf_sc));
14
ASSYM(LINUX_RT_SIGF_UC, offsetof(struct l_rt_sigframe, sf_sc));
14
ASSYM(LINUX_RT_SIGF_SC, offsetof(struct l_ucontext, uc_mcontext));
15
ASSYM(LINUX_RT_SIGF_SC, offsetof(struct l_ucontext, uc_mcontext));
16
ASSYM(LINUX_VERSION_CODE, LINUX_VERSION_CODE);
17
ASSYM(LINUX_SC_ESP, offsetof(struct l_sigcontext, sc_esp));
(-)sys/amd64/linux32/linux32_locore.s (-19 / +137 lines)
Lines 5-38 Link Here
5
5
6
#include <amd64/linux32/linux32_syscall.h>	/* system call numbers */
6
#include <amd64/linux32/linux32_syscall.h>	/* system call numbers */
7
7
8
.data
9
10
	.globl linux_platform
11
linux_platform:
12
	.asciz "i686"
13
8
.text
14
.text
9
.code32
15
.code32
10
16
11
NON_GPROF_ENTRY(linux_sigcode)
17
/*
12
	call	*LINUX_SIGF_HANDLER(%esp)
18
 * To avoid excess stack frame the signal trampoline code emulates
13
	leal	LINUX_SIGF_SC(%esp),%ebx	/* linux scp */
19
 * the 'call' instruction.
14
	movl	%esp, %ebx			/* pass sigframe */
20
 */
15
	push	%eax				/* fake ret addr */
21
NON_GPROF_ENTRY(linux32_sigcode)
22
	movl	%esp, %ebx			/* preserve sigframe */
23
	call .getip0
24
.getip0:
25
	popl	%eax
26
	add	$.startsigcode-.getip0, %eax	/* ret address */
27
	push	%eax
28
	jmp	*LINUX_SIGF_HANDLER(%ebx)
29
.startsigcode:
30
	popl	%eax
16
	movl	$LINUX_SYS_linux_sigreturn,%eax	/* linux_sigreturn() */
31
	movl	$LINUX_SYS_linux_sigreturn,%eax	/* linux_sigreturn() */
17
	int	$0x80				/* enter kernel with args */
32
	int	$0x80				/* enter kernel with args */
33
.endsigcode:
18
0:	jmp	0b
34
0:	jmp	0b
19
	ALIGN_TEXT
35
20
/* XXXXX */
36
NON_GPROF_ENTRY(linux32_rt_sigcode)
21
linux_rt_sigcode:
22
	call	*LINUX_RT_SIGF_HANDLER(%esp)
23
	leal	LINUX_RT_SIGF_UC(%esp),%ebx	/* linux ucp */
37
	leal	LINUX_RT_SIGF_UC(%esp),%ebx	/* linux ucp */
24
	leal	LINUX_RT_SIGF_SC(%ebx),%ecx	/* linux sigcontext */
38
	leal	LINUX_RT_SIGF_SC(%ebx),%ecx	/* linux sigcontext */
25
	push	%eax				/* fake ret addr */
39
	movl	%esp, %edi
40
	call	.getip1
41
.getip1:
42
	popl	%eax
43
	add	$.startrtsigcode-.getip1, %eax	/* ret address */
44
	push	%eax
45
	jmp	*LINUX_RT_SIGF_HANDLER(%edi)
46
.startrtsigcode:
26
	movl	$LINUX_SYS_linux_rt_sigreturn,%eax   /* linux_rt_sigreturn() */
47
	movl	$LINUX_SYS_linux_rt_sigreturn,%eax   /* linux_rt_sigreturn() */
27
	int	$0x80				/* enter kernel with args */
48
	int	$0x80				/* enter kernel with args */
49
.endrtsigcode:
28
0:	jmp	0b
50
0:	jmp	0b
29
	ALIGN_TEXT
30
/* XXXXX */
31
linux_esigcode:
32
51
33
	.data
52
NON_GPROF_ENTRY(linux32_vsyscall)
34
	.globl	linux_szsigcode, linux_sznonrtsigcode
53
.startvsyscall:
35
linux_szsigcode:
54
	int $0x80
36
	.long	linux_esigcode-linux_sigcode
55
	ret
37
linux_sznonrtsigcode:
56
.endvsyscall:
38
	.long	linux_rt_sigcode-linux_sigcode
57
58
#if 0
59
	.section .note.Linux, "a",@note
60
	.long 2f - 1f		/* namesz */
61
	.balign 4
62
	.long 4f - 3f		/* descsz */
63
	.long 0
64
1:
65
	.asciz "Linux"
66
2:
67
	.balign 4
68
3:
69
	.long LINUX_VERSION_CODE
70
4:
71
	.balign 4
72
	.previous
73
#endif
74
75
#define do_cfa_expr(offset)                                             \
76
	.byte 0x0f;			/* DW_CFA_def_cfa_expression */ \
77
	.uleb128 11f-10f;		/*   length */                  \
78
10:	.byte 0x74;			/*     DW_OP_breg4 */           \
79
	.sleb128 offset;		/*      offset */               \
80
	.byte 0x06;			/*     DW_OP_deref */           \
81
11:
82
83
84
	/* CIE */
85
	.section .eh_frame,"a",@progbits
86
.LSTARTFRAMEDLSI1:
87
	.long .LENDCIEDLSI1-.LSTARTCIEDLSI1
88
.LSTARTCIEDLSI1:
89
	.long 0					/* CIE ID */
90
	.byte 1					/* Version number */
91
	.string "zRS"				/* NULL-terminated
92
						 * augmentation string
93
						 */
94
	.uleb128 1				/* Code alignment factor */
95
	.sleb128 -4				/* Data alignment factor */
96
	.byte 8					/* Return address
97
						 * register column
98
						 */
99
	.uleb128 1				/* Augmentation value length */
100
	.byte 0x1b				/* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
101
	.byte 0					/* DW_CFA_nop */
102
	.align 4
103
.LENDCIEDLSI1:
104
105
	/* FDE */
106
	.long .LENDFDEDLSI1-.LSTARTFDEDLSI1	/* Length FDE */
107
.LSTARTFDEDLSI1:
108
	.long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */
109
	.long .startsigcode-.			/* PC-relative start address */
110
	.long .endsigcode-.startsigcode
111
	.uleb128 0				/* Augmentation */
112
	do_cfa_expr(LINUX_SIGF_SC-8)
113
	.align 4
114
.LENDFDEDLSI1:
115
116
	.long .LENDFDEDLSI2-.LSTARTFDEDLSI2	/* Length FDE */
117
.LSTARTFDEDLSI2:
118
	.long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1	/* CIE pointer */
119
	.long .startrtsigcode-.			/* PC-relative start address */
120
	.long .endrtsigcode-.startrtsigcode
121
	.uleb128 0				/* Augmentation */
122
	do_cfa_expr(LINUX_RT_SIGF_SC-4+LINUX_SC_ESP)
123
	.align 4
124
.LENDFDEDLSI2:
125
	.previous
126
127
	.section .eh_frame,"a",@progbits
128
.LSTARTFRAMEDLSI2:
129
	.long .LENDCIEDLSI2-.LSTARTCIEDLSI2
130
.LSTARTCIEDLSI2:
131
	.long 0					/* CIE ID */
132
	.byte 1					/* Version number */
133
	.string "zR"				/* NULL-terminated
134
						 * augmentation string
135
						 */
136
	.uleb128 1				/* Code alignment factor */
137
	.sleb128 -4				/* Data alignment factor */
138
	.byte 8					/* Return address register column */
139
	.uleb128 1				/* Augmentation value length */
140
	.byte 0x1b				/* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
141
	.byte 0x0c				/* DW_CFA_def_cfa */
142
	.uleb128 4
143
	.uleb128 4
144
	.byte 0x88				/* DW_CFA_offset, column 0x8 */
145
	.uleb128 1
146
	.align 4
147
.LENDCIEDLSI2:
148
	.long .LENDFDEDLSI3-.LSTARTFDEDLSI3 /* Length FDE */
149
.LSTARTFDEDLSI3:
150
	.long .LSTARTFDEDLSI3-.LSTARTFRAMEDLSI2 /* CIE pointer */
151
	.long .startvsyscall-.			/* PC-relative start address */
152
	.long .endvsyscall-.startvsyscall
153
	.uleb128 0
154
	.align 4
155
.LENDFDEDLSI3:
156
	.previous
(-)sys/amd64/linux32/linux32_machdep.c (-66 / +81 lines)
Lines 31-36 Link Here
31
#include <sys/cdefs.h>
31
#include <sys/cdefs.h>
32
__FBSDID("$FreeBSD$");
32
__FBSDID("$FreeBSD$");
33
33
34
#include "opt_compat.h"
35
34
#include <sys/param.h>
36
#include <sys/param.h>
35
#include <sys/kernel.h>
37
#include <sys/kernel.h>
36
#include <sys/systm.h>
38
#include <sys/systm.h>
Lines 48-54 Link Here
48
#include <sys/proc.h>
50
#include <sys/proc.h>
49
#include <sys/resource.h>
51
#include <sys/resource.h>
50
#include <sys/resourcevar.h>
52
#include <sys/resourcevar.h>
51
#include <sys/sched.h>
52
#include <sys/syscallsubr.h>
53
#include <sys/syscallsubr.h>
53
#include <sys/sysproto.h>
54
#include <sys/sysproto.h>
54
#include <sys/unistd.h>
55
#include <sys/unistd.h>
Lines 81-114 Link Here
81
	l_uintptr_t	timeout;
82
	l_uintptr_t	timeout;
82
} __packed;
83
} __packed;
83
84
84
int
85
linux_to_bsd_sigaltstack(int lsa)
86
{
87
	int bsa = 0;
88
89
	if (lsa & LINUX_SS_DISABLE)
90
		bsa |= SS_DISABLE;
91
	if (lsa & LINUX_SS_ONSTACK)
92
		bsa |= SS_ONSTACK;
93
	return (bsa);
94
}
95
96
static int	linux_mmap_common(struct thread *td, l_uintptr_t addr,
85
static int	linux_mmap_common(struct thread *td, l_uintptr_t addr,
97
		    l_size_t len, l_int prot, l_int flags, l_int fd,
86
		    l_size_t len, l_int prot, l_int flags, l_int fd,
98
		    l_loff_t pos);
87
		    l_loff_t pos);
99
88
100
int
101
bsd_to_linux_sigaltstack(int bsa)
102
{
103
	int lsa = 0;
104
105
	if (bsa & SS_DISABLE)
106
		lsa |= LINUX_SS_DISABLE;
107
	if (bsa & SS_ONSTACK)
108
		lsa |= LINUX_SS_ONSTACK;
109
	return (lsa);
110
}
111
112
static void
89
static void
113
bsd_to_linux_rusage(struct rusage *ru, struct l_rusage *lru)
90
bsd_to_linux_rusage(struct rusage *ru, struct l_rusage *lru)
114
{
91
{
Lines 137-143 Link Here
137
linux_execve(struct thread *td, struct linux_execve_args *args)
114
linux_execve(struct thread *td, struct linux_execve_args *args)
138
{
115
{
139
	struct image_args eargs;
116
	struct image_args eargs;
140
	struct vmspace *oldvmspace;
141
	char *path;
117
	char *path;
142
	int error;
118
	int error;
143
119
Lines 148-173 Link Here
148
		printf(ARGS(execve, "%s"), path);
124
		printf(ARGS(execve, "%s"), path);
149
#endif
125
#endif
150
126
151
	error = pre_execve(td, &oldvmspace);
152
	if (error != 0) {
153
		free(path, M_TEMP);
154
		return (error);
155
	}
156
	error = freebsd32_exec_copyin_args(&eargs, path, UIO_SYSSPACE,
127
	error = freebsd32_exec_copyin_args(&eargs, path, UIO_SYSSPACE,
157
	    args->argp, args->envp);
128
	    args->argp, args->envp);
158
	free(path, M_TEMP);
129
	free(path, M_TEMP);
159
	if (error == 0)
130
	if (error == 0)
160
		error = kern_execve(td, &eargs, NULL);
131
		error = linux_common_execve(td, &eargs);
161
	if (error == 0) {
162
		/* Linux process can execute FreeBSD one, do not attempt
163
		 * to create emuldata for such process using
164
		 * linux_proc_init, this leads to a panic on KASSERT
165
		 * because such process has p->p_emuldata == NULL.
166
		 */
167
		if (SV_PROC_ABI(td->td_proc) == SV_ABI_LINUX)
168
			error = linux_proc_init(td, 0, 0);
169
	}
170
	post_execve(td, error, oldvmspace);
171
	return (error);
132
	return (error);
172
}
133
}
173
134
Lines 465-472 Link Here
465
linux_set_upcall_kse(struct thread *td, register_t stack)
426
linux_set_upcall_kse(struct thread *td, register_t stack)
466
{
427
{
467
428
468
	td->td_frame->tf_rsp = stack;
429
	if (stack)
430
		td->td_frame->tf_rsp = stack;
469
431
432
	/*
433
	 * The newly created Linux thread returns
434
	 * to the user space by the same path that a parent do.
435
	 */
436
	td->td_frame->tf_rax = 0;
470
	return (0);
437
	return (0);
471
}
438
}
472
439
Lines 729-735 Link Here
729
		act.lsa_flags = osa.lsa_flags;
696
		act.lsa_flags = osa.lsa_flags;
730
		act.lsa_restorer = osa.lsa_restorer;
697
		act.lsa_restorer = osa.lsa_restorer;
731
		LINUX_SIGEMPTYSET(act.lsa_mask);
698
		LINUX_SIGEMPTYSET(act.lsa_mask);
732
		act.lsa_mask.__bits[0] = osa.lsa_mask;
699
		act.lsa_mask.__mask = osa.lsa_mask;
733
	}
700
	}
734
701
735
	error = linux_do_sigaction(td, args->sig, args->nsa ? &act : NULL,
702
	error = linux_do_sigaction(td, args->sig, args->nsa ? &act : NULL,
Lines 739-745 Link Here
739
		osa.lsa_handler = oact.lsa_handler;
706
		osa.lsa_handler = oact.lsa_handler;
740
		osa.lsa_flags = oact.lsa_flags;
707
		osa.lsa_flags = oact.lsa_flags;
741
		osa.lsa_restorer = oact.lsa_restorer;
708
		osa.lsa_restorer = oact.lsa_restorer;
742
		osa.lsa_mask = oact.lsa_mask.__bits[0];
709
		osa.lsa_mask = oact.lsa_mask.__mask;
743
		error = copyout(&osa, args->osa, sizeof(l_osigaction_t));
710
		error = copyout(&osa, args->osa, sizeof(l_osigaction_t));
744
	}
711
	}
745
712
Lines 763-769 Link Here
763
#endif
730
#endif
764
731
765
	LINUX_SIGEMPTYSET(mask);
732
	LINUX_SIGEMPTYSET(mask);
766
	mask.__bits[0] = args->mask;
733
	mask.__mask = args->mask;
767
	linux_to_bsd_sigset(&mask, &sigmask);
734
	linux_to_bsd_sigset(&mask, &sigmask);
768
	return (kern_sigsuspend(td, sigmask));
735
	return (kern_sigsuspend(td, sigmask));
769
}
736
}
Lines 925-946 Link Here
925
}
892
}
926
893
927
int
894
int
928
linux_sched_rr_get_interval(struct thread *td,
929
    struct linux_sched_rr_get_interval_args *uap)
930
{
931
	struct timespec ts;
932
	struct l_timespec ts32;
933
	int error;
934
935
	error = kern_sched_rr_get_interval(td, uap->pid, &ts);
936
	if (error != 0)
937
		return (error);
938
	ts32.tv_sec = ts.tv_sec;
939
	ts32.tv_nsec = ts.tv_nsec;
940
	return (copyout(&ts32, uap->interval, sizeof(ts32)));
941
}
942
943
int
944
linux_set_thread_area(struct thread *td,
895
linux_set_thread_area(struct thread *td,
945
    struct linux_set_thread_area_args *args)
896
    struct linux_set_thread_area_args *args)
946
{
897
{
Lines 1056-1066 Link Here
1056
		    args->pid, (void *)args->status, args->options,
1007
		    args->pid, (void *)args->status, args->options,
1057
		    (void *)args->rusage);
1008
		    (void *)args->rusage);
1058
#endif
1009
#endif
1010
	if (args->options & ~(LINUX_WUNTRACED | LINUX_WNOHANG |
1011
	    LINUX_WCONTINUED | __WCLONE | __WNOTHREAD | __WALL))
1012
		return (EINVAL);
1059
1013
1060
	options = (args->options & (WNOHANG | WUNTRACED));
1014
	options = WEXITED;
1061
	/* WLINUXCLONE should be equal to __WCLONE, but we make sure */
1015
	linux_to_bsd_waitopts(args->options, &options);
1062
	if (args->options & __WCLONE)
1063
		options |= WLINUXCLONE;
1064
1016
1065
	if (args->rusage != NULL)
1017
	if (args->rusage != NULL)
1066
		rup = &ru;
1018
		rup = &ru;
Lines 1076-1078 Link Here
1076
1028
1077
	return (error);
1029
	return (error);
1078
}
1030
}
1031
1032
int
1033
linux_waitid(struct thread *td, struct linux_waitid_args *args)
1034
{
1035
	int status, options, sig;
1036
	struct __wrusage wru;
1037
	struct l_rusage lru;
1038
	siginfo_t siginfo;
1039
	l_siginfo_t lsi;
1040
	idtype_t idtype;
1041
	struct proc *p;
1042
	int error;
1043
1044
	options = 0;
1045
	linux_to_bsd_waitopts(args->options, &options);
1046
1047
	if (options & ~(WNOHANG | WNOWAIT | WEXITED | WUNTRACED | WCONTINUED))
1048
		return (EINVAL);
1049
	if (!(options & (WEXITED | WUNTRACED | WCONTINUED)))
1050
		return (EINVAL);
1051
1052
	switch (args->idtype) {
1053
	case LINUX_P_ALL:
1054
		idtype = P_ALL;
1055
		break;
1056
	case LINUX_P_PID:
1057
		if (args->id <= 0)
1058
			return (EINVAL);
1059
		idtype = P_PID;
1060
		break;
1061
	case LINUX_P_PGID:
1062
		if (args->id <= 0)
1063
			return (EINVAL);
1064
		idtype = P_PGID;
1065
		break;
1066
	default:
1067
		return (EINVAL);
1068
	}
1069
1070
	error = kern_wait6(td, idtype, args->id, &status, options,
1071
	    &wru, &siginfo);
1072
	if (error)
1073
		return (error);
1074
	if (args->rusage != NULL) {
1075
		bsd_to_linux_rusage(&wru.wru_children, &lru);
1076
		error = copyout(&lru, args->rusage, sizeof(lru));
1077
		if (error)
1078
			return (error);
1079
	}
1080
	if (args->info != NULL) {
1081
		p = td->td_proc;
1082
		if (td->td_retval[0] == 0)
1083
			bzero(&lsi, sizeof(lsi));
1084
		else {
1085
			sig = bsd_to_linux_signal(siginfo.si_signo);
1086
			siginfo_to_lsiginfo(&siginfo, &lsi, sig);
1087
		}
1088
		error = copyout(&lsi, args->info, sizeof(lsi));
1089
	}
1090
	td->td_retval[0] = 0;
1091
1092
	return (error);
1093
}
(-)sys/amd64/linux32/linux32_proto.h (-24 / +84 lines)
Lines 35-40 Link Here
35
#endif
35
#endif
36
36
37
#define	nosys	linux_nosys
37
#define	nosys	linux_nosys
38
struct linux_exit_args {
39
	char rval_l_[PADL_(int)]; int rval; char rval_r_[PADR_(int)];
40
};
38
struct linux_fork_args {
41
struct linux_fork_args {
39
	register_t dummy;
42
	register_t dummy;
40
};
43
};
Lines 475-480 Link Here
475
struct linux_sysctl_args {
478
struct linux_sysctl_args {
476
	char args_l_[PADL_(struct l___sysctl_args *)]; struct l___sysctl_args * args; char args_r_[PADR_(struct l___sysctl_args *)];
479
	char args_l_[PADL_(struct l___sysctl_args *)]; struct l___sysctl_args * args; char args_r_[PADR_(struct l___sysctl_args *)];
477
};
480
};
481
struct linux_sched_setparam_args {
482
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
483
	char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
484
};
485
struct linux_sched_getparam_args {
486
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
487
	char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
488
};
478
struct linux_sched_setscheduler_args {
489
struct linux_sched_setscheduler_args {
479
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
490
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
480
	char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)];
491
	char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)];
Lines 563-569 Link Here
563
	char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)];
574
	char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)];
564
};
575
};
565
struct linux_rt_sigqueueinfo_args {
576
struct linux_rt_sigqueueinfo_args {
566
	register_t dummy;
577
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
578
	char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)];
579
	char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char info_r_[PADR_(l_siginfo_t *)];
567
};
580
};
568
struct linux_rt_sigsuspend_args {
581
struct linux_rt_sigsuspend_args {
569
	char newset_l_[PADL_(l_sigset_t *)]; l_sigset_t * newset; char newset_r_[PADR_(l_sigset_t *)];
582
	char newset_l_[PADL_(l_sigset_t *)]; l_sigset_t * newset; char newset_r_[PADR_(l_sigset_t *)];
Lines 766-778 Link Here
766
	register_t dummy;
779
	register_t dummy;
767
};
780
};
768
struct linux_epoll_create_args {
781
struct linux_epoll_create_args {
769
	register_t dummy;
782
	char size_l_[PADL_(l_int)]; l_int size; char size_r_[PADR_(l_int)];
770
};
783
};
771
struct linux_epoll_ctl_args {
784
struct linux_epoll_ctl_args {
772
	register_t dummy;
785
	char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)];
786
	char op_l_[PADL_(l_int)]; l_int op; char op_r_[PADR_(l_int)];
787
	char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
788
	char event_l_[PADL_(struct epoll_event *)]; struct epoll_event * event; char event_r_[PADR_(struct epoll_event *)];
773
};
789
};
774
struct linux_epoll_wait_args {
790
struct linux_epoll_wait_args {
775
	register_t dummy;
791
	char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)];
792
	char events_l_[PADL_(struct epoll_event *)]; struct epoll_event * events; char events_r_[PADR_(struct epoll_event *)];
793
	char maxevents_l_[PADL_(l_int)]; l_int maxevents; char maxevents_r_[PADR_(l_int)];
794
	char timeout_l_[PADL_(l_int)]; l_int timeout; char timeout_r_[PADR_(l_int)];
776
};
795
};
777
struct linux_remap_file_pages_args {
796
struct linux_remap_file_pages_args {
778
	register_t dummy;
797
	register_t dummy;
Lines 873-879 Link Here
873
	register_t dummy;
892
	register_t dummy;
874
};
893
};
875
struct linux_waitid_args {
894
struct linux_waitid_args {
876
	register_t dummy;
895
	char idtype_l_[PADL_(int)]; int idtype; char idtype_r_[PADR_(int)];
896
	char id_l_[PADL_(l_pid_t)]; l_pid_t id; char id_r_[PADR_(l_pid_t)];
897
	char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char info_r_[PADR_(l_siginfo_t *)];
898
	char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)];
899
	char rusage_l_[PADL_(struct l_rusage *)]; struct l_rusage * rusage; char rusage_r_[PADR_(struct l_rusage *)];
877
};
900
};
878
struct linux_add_key_args {
901
struct linux_add_key_args {
879
	register_t dummy;
902
	register_t dummy;
Lines 975-987 Link Here
975
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
998
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
976
	char filename_l_[PADL_(const char *)]; const char * filename; char filename_r_[PADR_(const char *)];
999
	char filename_l_[PADL_(const char *)]; const char * filename; char filename_r_[PADR_(const char *)];
977
	char amode_l_[PADL_(l_int)]; l_int amode; char amode_r_[PADR_(l_int)];
1000
	char amode_l_[PADL_(l_int)]; l_int amode; char amode_r_[PADR_(l_int)];
978
	char flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];
979
};
1001
};
980
struct linux_pselect6_args {
1002
struct linux_pselect6_args {
981
	register_t dummy;
1003
	char nfds_l_[PADL_(l_int)]; l_int nfds; char nfds_r_[PADR_(l_int)];
1004
	char readfds_l_[PADL_(l_fd_set *)]; l_fd_set * readfds; char readfds_r_[PADR_(l_fd_set *)];
1005
	char writefds_l_[PADL_(l_fd_set *)]; l_fd_set * writefds; char writefds_r_[PADR_(l_fd_set *)];
1006
	char exceptfds_l_[PADL_(l_fd_set *)]; l_fd_set * exceptfds; char exceptfds_r_[PADR_(l_fd_set *)];
1007
	char tsp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tsp; char tsp_r_[PADR_(struct l_timespec *)];
1008
	char sig_l_[PADL_(l_uintptr_t *)]; l_uintptr_t * sig; char sig_r_[PADR_(l_uintptr_t *)];
982
};
1009
};
983
struct linux_ppoll_args {
1010
struct linux_ppoll_args {
984
	register_t dummy;
1011
	char fds_l_[PADL_(struct pollfd *)]; struct pollfd * fds; char fds_r_[PADR_(struct pollfd *)];
1012
	char nfds_l_[PADL_(uint32_t)]; uint32_t nfds; char nfds_r_[PADR_(uint32_t)];
1013
	char tsp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tsp; char tsp_r_[PADR_(struct l_timespec *)];
1014
	char sset_l_[PADL_(l_sigset_t *)]; l_sigset_t * sset; char sset_r_[PADR_(l_sigset_t *)];
1015
	char ssize_l_[PADL_(l_size_t)]; l_size_t ssize; char ssize_r_[PADR_(l_size_t)];
985
};
1016
};
986
struct linux_unshare_args {
1017
struct linux_unshare_args {
987
	register_t dummy;
1018
	register_t dummy;
Lines 1014-1023 Link Here
1014
	register_t dummy;
1045
	register_t dummy;
1015
};
1046
};
1016
struct linux_epoll_pwait_args {
1047
struct linux_epoll_pwait_args {
1017
	register_t dummy;
1048
	char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)];
1049
	char events_l_[PADL_(struct epoll_event *)]; struct epoll_event * events; char events_r_[PADR_(struct epoll_event *)];
1050
	char maxevents_l_[PADL_(l_int)]; l_int maxevents; char maxevents_r_[PADR_(l_int)];
1051
	char timeout_l_[PADL_(l_int)]; l_int timeout; char timeout_r_[PADR_(l_int)];
1052
	char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char mask_r_[PADR_(l_sigset_t *)];
1018
};
1053
};
1019
struct linux_utimensat_args {
1054
struct linux_utimensat_args {
1020
	register_t dummy;
1055
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
1056
	char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)];
1057
	char times_l_[PADL_(const struct l_timespec *)]; const struct l_timespec * times; char times_r_[PADR_(const struct l_timespec *)];
1058
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
1021
};
1059
};
1022
struct linux_signalfd_args {
1060
struct linux_signalfd_args {
1023
	register_t dummy;
1061
	register_t dummy;
Lines 1026-1035 Link Here
1026
	register_t dummy;
1064
	register_t dummy;
1027
};
1065
};
1028
struct linux_eventfd_args {
1066
struct linux_eventfd_args {
1029
	register_t dummy;
1067
	char initval_l_[PADL_(l_uint)]; l_uint initval; char initval_r_[PADR_(l_uint)];
1030
};
1068
};
1031
struct linux_fallocate_args {
1069
struct linux_fallocate_args {
1032
	register_t dummy;
1070
	char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
1071
	char mode_l_[PADL_(l_int)]; l_int mode; char mode_r_[PADR_(l_int)];
1072
	char offset_l_[PADL_(l_loff_t)]; l_loff_t offset; char offset_r_[PADR_(l_loff_t)];
1073
	char len_l_[PADL_(l_loff_t)]; l_loff_t len; char len_r_[PADR_(l_loff_t)];
1033
};
1074
};
1034
struct linux_timerfd_settime_args {
1075
struct linux_timerfd_settime_args {
1035
	register_t dummy;
1076
	register_t dummy;
Lines 1041-1053 Link Here
1041
	register_t dummy;
1082
	register_t dummy;
1042
};
1083
};
1043
struct linux_eventfd2_args {
1084
struct linux_eventfd2_args {
1044
	register_t dummy;
1085
	char initval_l_[PADL_(l_uint)]; l_uint initval; char initval_r_[PADR_(l_uint)];
1086
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
1045
};
1087
};
1046
struct linux_epoll_create1_args {
1088
struct linux_epoll_create1_args {
1047
	register_t dummy;
1089
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
1048
};
1090
};
1049
struct linux_dup3_args {
1091
struct linux_dup3_args {
1050
	register_t dummy;
1092
	char oldfd_l_[PADL_(l_int)]; l_int oldfd; char oldfd_r_[PADR_(l_int)];
1093
	char newfd_l_[PADL_(l_int)]; l_int newfd; char newfd_r_[PADR_(l_int)];
1094
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
1051
};
1095
};
1052
struct linux_pipe2_args {
1096
struct linux_pipe2_args {
1053
	char pipefds_l_[PADL_(l_int *)]; l_int * pipefds; char pipefds_r_[PADR_(l_int *)];
1097
	char pipefds_l_[PADL_(l_int *)]; l_int * pipefds; char pipefds_r_[PADR_(l_int *)];
Lines 1069-1075 Link Here
1069
	register_t dummy;
1113
	register_t dummy;
1070
};
1114
};
1071
struct linux_recvmmsg_args {
1115
struct linux_recvmmsg_args {
1072
	register_t dummy;
1116
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
1117
	char msg_l_[PADL_(struct l_mmsghdr *)]; struct l_mmsghdr * msg; char msg_r_[PADR_(struct l_mmsghdr *)];
1118
	char vlen_l_[PADL_(l_uint)]; l_uint vlen; char vlen_r_[PADR_(l_uint)];
1119
	char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)];
1120
	char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)];
1073
};
1121
};
1074
struct linux_fanotify_init_args {
1122
struct linux_fanotify_init_args {
1075
	register_t dummy;
1123
	register_t dummy;
Lines 1078-1084 Link Here
1078
	register_t dummy;
1126
	register_t dummy;
1079
};
1127
};
1080
struct linux_prlimit64_args {
1128
struct linux_prlimit64_args {
1081
	register_t dummy;
1129
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
1130
	char resource_l_[PADL_(l_uint)]; l_uint resource; char resource_r_[PADR_(l_uint)];
1131
	char new_l_[PADL_(struct rlimit *)]; struct rlimit * new; char new_r_[PADR_(struct rlimit *)];
1132
	char old_l_[PADL_(struct rlimit *)]; struct rlimit * old; char old_r_[PADR_(struct rlimit *)];
1082
};
1133
};
1083
struct linux_name_to_handle_at_args {
1134
struct linux_name_to_handle_at_args {
1084
	register_t dummy;
1135
	register_t dummy;
Lines 1090-1099 Link Here
1090
	register_t dummy;
1141
	register_t dummy;
1091
};
1142
};
1092
struct linux_syncfs_args {
1143
struct linux_syncfs_args {
1093
	register_t dummy;
1144
	char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
1094
};
1145
};
1095
struct linux_sendmmsg_args {
1146
struct linux_sendmmsg_args {
1096
	register_t dummy;
1147
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
1148
	char msg_l_[PADL_(struct l_mmsghdr *)]; struct l_mmsghdr * msg; char msg_r_[PADR_(struct l_mmsghdr *)];
1149
	char vlen_l_[PADL_(l_uint)]; l_uint vlen; char vlen_r_[PADR_(l_uint)];
1150
	char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)];
1097
};
1151
};
1098
struct linux_setns_args {
1152
struct linux_setns_args {
1099
	register_t dummy;
1153
	register_t dummy;
Lines 1105-1110 Link Here
1105
	register_t dummy;
1159
	register_t dummy;
1106
};
1160
};
1107
#define	nosys	linux_nosys
1161
#define	nosys	linux_nosys
1162
int	linux_exit(struct thread *, struct linux_exit_args *);
1108
int	linux_fork(struct thread *, struct linux_fork_args *);
1163
int	linux_fork(struct thread *, struct linux_fork_args *);
1109
int	linux_open(struct thread *, struct linux_open_args *);
1164
int	linux_open(struct thread *, struct linux_open_args *);
1110
int	linux_waitpid(struct thread *, struct linux_waitpid_args *);
1165
int	linux_waitpid(struct thread *, struct linux_waitpid_args *);
Lines 1216-1221 Link Here
1216
int	linux_getsid(struct thread *, struct linux_getsid_args *);
1271
int	linux_getsid(struct thread *, struct linux_getsid_args *);
1217
int	linux_fdatasync(struct thread *, struct linux_fdatasync_args *);
1272
int	linux_fdatasync(struct thread *, struct linux_fdatasync_args *);
1218
int	linux_sysctl(struct thread *, struct linux_sysctl_args *);
1273
int	linux_sysctl(struct thread *, struct linux_sysctl_args *);
1274
int	linux_sched_setparam(struct thread *, struct linux_sched_setparam_args *);
1275
int	linux_sched_getparam(struct thread *, struct linux_sched_getparam_args *);
1219
int	linux_sched_setscheduler(struct thread *, struct linux_sched_setscheduler_args *);
1276
int	linux_sched_setscheduler(struct thread *, struct linux_sched_setscheduler_args *);
1220
int	linux_sched_getscheduler(struct thread *, struct linux_sched_getscheduler_args *);
1277
int	linux_sched_getscheduler(struct thread *, struct linux_sched_getscheduler_args *);
1221
int	linux_sched_get_priority_max(struct thread *, struct linux_sched_get_priority_max_args *);
1278
int	linux_sched_get_priority_max(struct thread *, struct linux_sched_get_priority_max_args *);
Lines 1407-1412 Link Here
1407
1464
1408
#endif /* COMPAT_FREEBSD7 */
1465
#endif /* COMPAT_FREEBSD7 */
1409
1466
1467
#define	LINUX_SYS_AUE_linux_exit	AUE_EXIT
1410
#define	LINUX_SYS_AUE_linux_fork	AUE_FORK
1468
#define	LINUX_SYS_AUE_linux_fork	AUE_FORK
1411
#define	LINUX_SYS_AUE_linux_open	AUE_OPEN_RWTC
1469
#define	LINUX_SYS_AUE_linux_open	AUE_OPEN_RWTC
1412
#define	LINUX_SYS_AUE_linux_waitpid	AUE_WAIT4
1470
#define	LINUX_SYS_AUE_linux_waitpid	AUE_WAIT4
Lines 1518-1523 Link Here
1518
#define	LINUX_SYS_AUE_linux_getsid	AUE_GETSID
1576
#define	LINUX_SYS_AUE_linux_getsid	AUE_GETSID
1519
#define	LINUX_SYS_AUE_linux_fdatasync	AUE_NULL
1577
#define	LINUX_SYS_AUE_linux_fdatasync	AUE_NULL
1520
#define	LINUX_SYS_AUE_linux_sysctl	AUE_SYSCTL
1578
#define	LINUX_SYS_AUE_linux_sysctl	AUE_SYSCTL
1579
#define	LINUX_SYS_AUE_linux_sched_setparam	AUE_SCHED_SETPARAM
1580
#define	LINUX_SYS_AUE_linux_sched_getparam	AUE_SCHED_GETPARAM
1521
#define	LINUX_SYS_AUE_linux_sched_setscheduler	AUE_SCHED_SETSCHEDULER
1581
#define	LINUX_SYS_AUE_linux_sched_setscheduler	AUE_SCHED_SETSCHEDULER
1522
#define	LINUX_SYS_AUE_linux_sched_getscheduler	AUE_SCHED_GETSCHEDULER
1582
#define	LINUX_SYS_AUE_linux_sched_getscheduler	AUE_SCHED_GETSCHEDULER
1523
#define	LINUX_SYS_AUE_linux_sched_get_priority_max	AUE_SCHED_GET_PRIORITY_MAX
1583
#define	LINUX_SYS_AUE_linux_sched_get_priority_max	AUE_SCHED_GET_PRIORITY_MAX
Lines 1617-1623 Link Here
1617
#define	LINUX_SYS_AUE_linux_mq_notify	AUE_NULL
1677
#define	LINUX_SYS_AUE_linux_mq_notify	AUE_NULL
1618
#define	LINUX_SYS_AUE_linux_mq_getsetattr	AUE_NULL
1678
#define	LINUX_SYS_AUE_linux_mq_getsetattr	AUE_NULL
1619
#define	LINUX_SYS_AUE_linux_kexec_load	AUE_NULL
1679
#define	LINUX_SYS_AUE_linux_kexec_load	AUE_NULL
1620
#define	LINUX_SYS_AUE_linux_waitid	AUE_NULL
1680
#define	LINUX_SYS_AUE_linux_waitid	AUE_WAIT6
1621
#define	LINUX_SYS_AUE_linux_add_key	AUE_NULL
1681
#define	LINUX_SYS_AUE_linux_add_key	AUE_NULL
1622
#define	LINUX_SYS_AUE_linux_request_key	AUE_NULL
1682
#define	LINUX_SYS_AUE_linux_request_key	AUE_NULL
1623
#define	LINUX_SYS_AUE_linux_keyctl	AUE_NULL
1683
#define	LINUX_SYS_AUE_linux_keyctl	AUE_NULL
Lines 1640-1647 Link Here
1640
#define	LINUX_SYS_AUE_linux_readlinkat	AUE_READLINKAT
1700
#define	LINUX_SYS_AUE_linux_readlinkat	AUE_READLINKAT
1641
#define	LINUX_SYS_AUE_linux_fchmodat	AUE_FCHMODAT
1701
#define	LINUX_SYS_AUE_linux_fchmodat	AUE_FCHMODAT
1642
#define	LINUX_SYS_AUE_linux_faccessat	AUE_FACCESSAT
1702
#define	LINUX_SYS_AUE_linux_faccessat	AUE_FACCESSAT
1643
#define	LINUX_SYS_AUE_linux_pselect6	AUE_NULL
1703
#define	LINUX_SYS_AUE_linux_pselect6	AUE_SELECT
1644
#define	LINUX_SYS_AUE_linux_ppoll	AUE_NULL
1704
#define	LINUX_SYS_AUE_linux_ppoll	AUE_POLL
1645
#define	LINUX_SYS_AUE_linux_unshare	AUE_NULL
1705
#define	LINUX_SYS_AUE_linux_unshare	AUE_NULL
1646
#define	LINUX_SYS_AUE_linux_set_robust_list	AUE_NULL
1706
#define	LINUX_SYS_AUE_linux_set_robust_list	AUE_NULL
1647
#define	LINUX_SYS_AUE_linux_get_robust_list	AUE_NULL
1707
#define	LINUX_SYS_AUE_linux_get_robust_list	AUE_NULL
Lines 1652-1658 Link Here
1652
#define	LINUX_SYS_AUE_linux_move_pages	AUE_NULL
1712
#define	LINUX_SYS_AUE_linux_move_pages	AUE_NULL
1653
#define	LINUX_SYS_AUE_linux_getcpu	AUE_NULL
1713
#define	LINUX_SYS_AUE_linux_getcpu	AUE_NULL
1654
#define	LINUX_SYS_AUE_linux_epoll_pwait	AUE_NULL
1714
#define	LINUX_SYS_AUE_linux_epoll_pwait	AUE_NULL
1655
#define	LINUX_SYS_AUE_linux_utimensat	AUE_NULL
1715
#define	LINUX_SYS_AUE_linux_utimensat	AUE_FUTIMESAT
1656
#define	LINUX_SYS_AUE_linux_signalfd	AUE_NULL
1716
#define	LINUX_SYS_AUE_linux_signalfd	AUE_NULL
1657
#define	LINUX_SYS_AUE_linux_timerfd_create	AUE_NULL
1717
#define	LINUX_SYS_AUE_linux_timerfd_create	AUE_NULL
1658
#define	LINUX_SYS_AUE_linux_eventfd	AUE_NULL
1718
#define	LINUX_SYS_AUE_linux_eventfd	AUE_NULL
Lines 1676-1682 Link Here
1676
#define	LINUX_SYS_AUE_linux_name_to_handle_at	AUE_NULL
1736
#define	LINUX_SYS_AUE_linux_name_to_handle_at	AUE_NULL
1677
#define	LINUX_SYS_AUE_linux_open_by_handle_at	AUE_NULL
1737
#define	LINUX_SYS_AUE_linux_open_by_handle_at	AUE_NULL
1678
#define	LINUX_SYS_AUE_linux_clock_adjtime	AUE_NULL
1738
#define	LINUX_SYS_AUE_linux_clock_adjtime	AUE_NULL
1679
#define	LINUX_SYS_AUE_linux_syncfs	AUE_NULL
1739
#define	LINUX_SYS_AUE_linux_syncfs	AUE_SYNC
1680
#define	LINUX_SYS_AUE_linux_sendmmsg	AUE_NULL
1740
#define	LINUX_SYS_AUE_linux_sendmmsg	AUE_NULL
1681
#define	LINUX_SYS_AUE_linux_setns	AUE_NULL
1741
#define	LINUX_SYS_AUE_linux_setns	AUE_NULL
1682
#define	LINUX_SYS_AUE_linux_process_vm_readv	AUE_NULL
1742
#define	LINUX_SYS_AUE_linux_process_vm_readv	AUE_NULL
(-)sys/amd64/linux32/linux32_syscall.h (-4 / +4 lines)
Lines 6-12 Link Here
6
 * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 276810 2015-01-08 06:23:11Z dchagin 
6
 * created from FreeBSD: stable/10/sys/amd64/linux32/syscalls.master 276810 2015-01-08 06:23:11Z dchagin 
7
 */
7
 */
8
8
9
#define	LINUX_SYS_exit	1
9
#define	LINUX_SYS_linux_exit	1
10
#define	LINUX_SYS_linux_fork	2
10
#define	LINUX_SYS_linux_fork	2
11
#define	LINUX_SYS_read	3
11
#define	LINUX_SYS_read	3
12
#define	LINUX_SYS_write	4
12
#define	LINUX_SYS_write	4
Lines 143-150 Link Here
143
#define	LINUX_SYS_munlock	151
143
#define	LINUX_SYS_munlock	151
144
#define	LINUX_SYS_mlockall	152
144
#define	LINUX_SYS_mlockall	152
145
#define	LINUX_SYS_munlockall	153
145
#define	LINUX_SYS_munlockall	153
146
#define	LINUX_SYS_sched_setparam	154
146
#define	LINUX_SYS_linux_sched_setparam	154
147
#define	LINUX_SYS_sched_getparam	155
147
#define	LINUX_SYS_linux_sched_getparam	155
148
#define	LINUX_SYS_linux_sched_setscheduler	156
148
#define	LINUX_SYS_linux_sched_setscheduler	156
149
#define	LINUX_SYS_linux_sched_getscheduler	157
149
#define	LINUX_SYS_linux_sched_getscheduler	157
150
#define	LINUX_SYS_sched_yield	158
150
#define	LINUX_SYS_sched_yield	158
Lines 321-324 Link Here
321
#define	LINUX_SYS_linux_setns	346
321
#define	LINUX_SYS_linux_setns	346
322
#define	LINUX_SYS_linux_process_vm_readv	347
322
#define	LINUX_SYS_linux_process_vm_readv	347
323
#define	LINUX_SYS_linux_process_vm_writev	348
323
#define	LINUX_SYS_linux_process_vm_writev	348
324
#define	LINUX_SYS_MAXSYSCALL	349
324
#define	LINUX_SYS_MAXSYSCALL	350
(-)sys/amd64/linux32/linux32_syscalls.c (-3 / +4 lines)
Lines 9-15 Link Here
9
const char *linux_syscallnames[] = {
9
const char *linux_syscallnames[] = {
10
#define	nosys	linux_nosys
10
#define	nosys	linux_nosys
11
	"#0",			/* 0 = setup */
11
	"#0",			/* 0 = setup */
12
	"exit",			/* 1 = exit */
12
	"linux_exit",			/* 1 = exit */
13
	"linux_fork",			/* 2 = linux_fork */
13
	"linux_fork",			/* 2 = linux_fork */
14
	"read",			/* 3 = read */
14
	"read",			/* 3 = read */
15
	"write",			/* 4 = write */
15
	"write",			/* 4 = write */
Lines 162-169 Link Here
162
	"munlock",			/* 151 = munlock */
162
	"munlock",			/* 151 = munlock */
163
	"mlockall",			/* 152 = mlockall */
163
	"mlockall",			/* 152 = mlockall */
164
	"munlockall",			/* 153 = munlockall */
164
	"munlockall",			/* 153 = munlockall */
165
	"sched_setparam",			/* 154 = sched_setparam */
165
	"linux_sched_setparam",			/* 154 = linux_sched_setparam */
166
	"sched_getparam",			/* 155 = sched_getparam */
166
	"linux_sched_getparam",			/* 155 = linux_sched_getparam */
167
	"linux_sched_setscheduler",			/* 156 = linux_sched_setscheduler */
167
	"linux_sched_setscheduler",			/* 156 = linux_sched_setscheduler */
168
	"linux_sched_getscheduler",			/* 157 = linux_sched_getscheduler */
168
	"linux_sched_getscheduler",			/* 157 = linux_sched_getscheduler */
169
	"sched_yield",			/* 158 = sched_yield */
169
	"sched_yield",			/* 158 = sched_yield */
Lines 357-360 Link Here
357
	"linux_setns",			/* 346 = linux_setns */
357
	"linux_setns",			/* 346 = linux_setns */
358
	"linux_process_vm_readv",			/* 347 = linux_process_vm_readv */
358
	"linux_process_vm_readv",			/* 347 = linux_process_vm_readv */
359
	"linux_process_vm_writev",			/* 348 = linux_process_vm_writev */
359
	"linux_process_vm_writev",			/* 348 = linux_process_vm_writev */
360
	"#349",			/* 349 = nosys */
360
};
361
};
(-)sys/amd64/linux32/linux32_sysent.c (-21 / +22 lines)
Lines 20-26 Link Here
20
struct sysent linux_sysent[] = {
20
struct sysent linux_sysent[] = {
21
#define	nosys	linux_nosys
21
#define	nosys	linux_nosys
22
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 0 = setup */
22
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 0 = setup */
23
	{ AS(sys_exit_args), (sy_call_t *)sys_sys_exit, AUE_EXIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 1 = exit */
23
	{ AS(linux_exit_args), (sy_call_t *)linux_exit, AUE_EXIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 1 = linux_exit */
24
	{ 0, (sy_call_t *)linux_fork, AUE_FORK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 2 = linux_fork */
24
	{ 0, (sy_call_t *)linux_fork, AUE_FORK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 2 = linux_fork */
25
	{ AS(read_args), (sy_call_t *)sys_read, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 3 = read */
25
	{ AS(read_args), (sy_call_t *)sys_read, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 3 = read */
26
	{ AS(write_args), (sy_call_t *)sys_write, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 4 = write */
26
	{ AS(write_args), (sy_call_t *)sys_write, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 4 = write */
Lines 173-180 Link Here
173
	{ AS(munlock_args), (sy_call_t *)sys_munlock, AUE_MUNLOCK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 151 = munlock */
173
	{ AS(munlock_args), (sy_call_t *)sys_munlock, AUE_MUNLOCK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 151 = munlock */
174
	{ AS(mlockall_args), (sy_call_t *)sys_mlockall, AUE_MLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 152 = mlockall */
174
	{ AS(mlockall_args), (sy_call_t *)sys_mlockall, AUE_MLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 152 = mlockall */
175
	{ 0, (sy_call_t *)sys_munlockall, AUE_MUNLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 153 = munlockall */
175
	{ 0, (sy_call_t *)sys_munlockall, AUE_MUNLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 153 = munlockall */
176
	{ AS(sched_setparam_args), (sy_call_t *)sys_sched_setparam, AUE_SCHED_SETPARAM, NULL, 0, 0, 0, SY_THR_STATIC },	/* 154 = sched_setparam */
176
	{ AS(linux_sched_setparam_args), (sy_call_t *)linux_sched_setparam, AUE_SCHED_SETPARAM, NULL, 0, 0, 0, SY_THR_STATIC },	/* 154 = linux_sched_setparam */
177
	{ AS(sched_getparam_args), (sy_call_t *)sys_sched_getparam, AUE_SCHED_GETPARAM, NULL, 0, 0, 0, SY_THR_STATIC },	/* 155 = sched_getparam */
177
	{ AS(linux_sched_getparam_args), (sy_call_t *)linux_sched_getparam, AUE_SCHED_GETPARAM, NULL, 0, 0, 0, SY_THR_STATIC },	/* 155 = linux_sched_getparam */
178
	{ AS(linux_sched_setscheduler_args), (sy_call_t *)linux_sched_setscheduler, AUE_SCHED_SETSCHEDULER, NULL, 0, 0, 0, SY_THR_STATIC },	/* 156 = linux_sched_setscheduler */
178
	{ AS(linux_sched_setscheduler_args), (sy_call_t *)linux_sched_setscheduler, AUE_SCHED_SETSCHEDULER, NULL, 0, 0, 0, SY_THR_STATIC },	/* 156 = linux_sched_setscheduler */
179
	{ AS(linux_sched_getscheduler_args), (sy_call_t *)linux_sched_getscheduler, AUE_SCHED_GETSCHEDULER, NULL, 0, 0, 0, SY_THR_STATIC },	/* 157 = linux_sched_getscheduler */
179
	{ AS(linux_sched_getscheduler_args), (sy_call_t *)linux_sched_getscheduler, AUE_SCHED_GETSCHEDULER, NULL, 0, 0, 0, SY_THR_STATIC },	/* 157 = linux_sched_getscheduler */
180
	{ 0, (sy_call_t *)sys_sched_yield, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 158 = sched_yield */
180
	{ 0, (sy_call_t *)sys_sched_yield, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 158 = sched_yield */
Lines 197-203 Link Here
197
	{ AS(linux_rt_sigprocmask_args), (sy_call_t *)linux_rt_sigprocmask, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 175 = linux_rt_sigprocmask */
197
	{ AS(linux_rt_sigprocmask_args), (sy_call_t *)linux_rt_sigprocmask, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 175 = linux_rt_sigprocmask */
198
	{ AS(linux_rt_sigpending_args), (sy_call_t *)linux_rt_sigpending, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 176 = linux_rt_sigpending */
198
	{ AS(linux_rt_sigpending_args), (sy_call_t *)linux_rt_sigpending, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 176 = linux_rt_sigpending */
199
	{ AS(linux_rt_sigtimedwait_args), (sy_call_t *)linux_rt_sigtimedwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 177 = linux_rt_sigtimedwait */
199
	{ AS(linux_rt_sigtimedwait_args), (sy_call_t *)linux_rt_sigtimedwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 177 = linux_rt_sigtimedwait */
200
	{ 0, (sy_call_t *)linux_rt_sigqueueinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 178 = linux_rt_sigqueueinfo */
200
	{ AS(linux_rt_sigqueueinfo_args), (sy_call_t *)linux_rt_sigqueueinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 178 = linux_rt_sigqueueinfo */
201
	{ AS(linux_rt_sigsuspend_args), (sy_call_t *)linux_rt_sigsuspend, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 179 = linux_rt_sigsuspend */
201
	{ AS(linux_rt_sigsuspend_args), (sy_call_t *)linux_rt_sigsuspend, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 179 = linux_rt_sigsuspend */
202
	{ AS(linux_pread_args), (sy_call_t *)linux_pread, AUE_PREAD, NULL, 0, 0, 0, SY_THR_STATIC },	/* 180 = linux_pread */
202
	{ AS(linux_pread_args), (sy_call_t *)linux_pread, AUE_PREAD, NULL, 0, 0, 0, SY_THR_STATIC },	/* 180 = linux_pread */
203
	{ AS(linux_pwrite_args), (sy_call_t *)linux_pwrite, AUE_PWRITE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 181 = linux_pwrite */
203
	{ AS(linux_pwrite_args), (sy_call_t *)linux_pwrite, AUE_PWRITE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 181 = linux_pwrite */
Lines 273-281 Link Here
273
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 251 =  */
273
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 251 =  */
274
	{ AS(linux_exit_group_args), (sy_call_t *)linux_exit_group, AUE_EXIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 252 = linux_exit_group */
274
	{ AS(linux_exit_group_args), (sy_call_t *)linux_exit_group, AUE_EXIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 252 = linux_exit_group */
275
	{ 0, (sy_call_t *)linux_lookup_dcookie, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 253 = linux_lookup_dcookie */
275
	{ 0, (sy_call_t *)linux_lookup_dcookie, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 253 = linux_lookup_dcookie */
276
	{ 0, (sy_call_t *)linux_epoll_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 254 = linux_epoll_create */
276
	{ AS(linux_epoll_create_args), (sy_call_t *)linux_epoll_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 254 = linux_epoll_create */
277
	{ 0, (sy_call_t *)linux_epoll_ctl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 255 = linux_epoll_ctl */
277
	{ AS(linux_epoll_ctl_args), (sy_call_t *)linux_epoll_ctl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 255 = linux_epoll_ctl */
278
	{ 0, (sy_call_t *)linux_epoll_wait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 256 = linux_epoll_wait */
278
	{ AS(linux_epoll_wait_args), (sy_call_t *)linux_epoll_wait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 256 = linux_epoll_wait */
279
	{ 0, (sy_call_t *)linux_remap_file_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 257 = linux_remap_file_pages */
279
	{ 0, (sy_call_t *)linux_remap_file_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 257 = linux_remap_file_pages */
280
	{ AS(linux_set_tid_address_args), (sy_call_t *)linux_set_tid_address, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 258 = linux_set_tid_address */
280
	{ AS(linux_set_tid_address_args), (sy_call_t *)linux_set_tid_address, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 258 = linux_set_tid_address */
281
	{ AS(linux_timer_create_args), (sy_call_t *)linux_timer_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 259 = linux_timer_create */
281
	{ AS(linux_timer_create_args), (sy_call_t *)linux_timer_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 259 = linux_timer_create */
Lines 303-309 Link Here
303
	{ 0, (sy_call_t *)linux_mq_notify, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 281 = linux_mq_notify */
303
	{ 0, (sy_call_t *)linux_mq_notify, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 281 = linux_mq_notify */
304
	{ 0, (sy_call_t *)linux_mq_getsetattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 282 = linux_mq_getsetattr */
304
	{ 0, (sy_call_t *)linux_mq_getsetattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 282 = linux_mq_getsetattr */
305
	{ 0, (sy_call_t *)linux_kexec_load, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 283 = linux_kexec_load */
305
	{ 0, (sy_call_t *)linux_kexec_load, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 283 = linux_kexec_load */
306
	{ 0, (sy_call_t *)linux_waitid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 284 = linux_waitid */
306
	{ AS(linux_waitid_args), (sy_call_t *)linux_waitid, AUE_WAIT6, NULL, 0, 0, 0, SY_THR_STATIC },	/* 284 = linux_waitid */
307
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 285 =  */
307
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 285 =  */
308
	{ 0, (sy_call_t *)linux_add_key, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 286 = linux_add_key */
308
	{ 0, (sy_call_t *)linux_add_key, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 286 = linux_add_key */
309
	{ 0, (sy_call_t *)linux_request_key, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 287 = linux_request_key */
309
	{ 0, (sy_call_t *)linux_request_key, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 287 = linux_request_key */
Lines 327-334 Link Here
327
	{ AS(linux_readlinkat_args), (sy_call_t *)linux_readlinkat, AUE_READLINKAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 305 = linux_readlinkat */
327
	{ AS(linux_readlinkat_args), (sy_call_t *)linux_readlinkat, AUE_READLINKAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 305 = linux_readlinkat */
328
	{ AS(linux_fchmodat_args), (sy_call_t *)linux_fchmodat, AUE_FCHMODAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 306 = linux_fchmodat */
328
	{ AS(linux_fchmodat_args), (sy_call_t *)linux_fchmodat, AUE_FCHMODAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 306 = linux_fchmodat */
329
	{ AS(linux_faccessat_args), (sy_call_t *)linux_faccessat, AUE_FACCESSAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 307 = linux_faccessat */
329
	{ AS(linux_faccessat_args), (sy_call_t *)linux_faccessat, AUE_FACCESSAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 307 = linux_faccessat */
330
	{ 0, (sy_call_t *)linux_pselect6, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 308 = linux_pselect6 */
330
	{ AS(linux_pselect6_args), (sy_call_t *)linux_pselect6, AUE_SELECT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 308 = linux_pselect6 */
331
	{ 0, (sy_call_t *)linux_ppoll, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 309 = linux_ppoll */
331
	{ AS(linux_ppoll_args), (sy_call_t *)linux_ppoll, AUE_POLL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 309 = linux_ppoll */
332
	{ 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 310 = linux_unshare */
332
	{ 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 310 = linux_unshare */
333
	{ AS(linux_set_robust_list_args), (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 311 = linux_set_robust_list */
333
	{ AS(linux_set_robust_list_args), (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 311 = linux_set_robust_list */
334
	{ AS(linux_get_robust_list_args), (sy_call_t *)linux_get_robust_list, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 312 = linux_get_robust_list */
334
	{ AS(linux_get_robust_list_args), (sy_call_t *)linux_get_robust_list, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 312 = linux_get_robust_list */
Lines 338-355 Link Here
338
	{ 0, (sy_call_t *)linux_vmsplice, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 316 = linux_vmsplice */
338
	{ 0, (sy_call_t *)linux_vmsplice, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 316 = linux_vmsplice */
339
	{ 0, (sy_call_t *)linux_move_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 317 = linux_move_pages */
339
	{ 0, (sy_call_t *)linux_move_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 317 = linux_move_pages */
340
	{ 0, (sy_call_t *)linux_getcpu, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 318 = linux_getcpu */
340
	{ 0, (sy_call_t *)linux_getcpu, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 318 = linux_getcpu */
341
	{ 0, (sy_call_t *)linux_epoll_pwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 319 = linux_epoll_pwait */
341
	{ AS(linux_epoll_pwait_args), (sy_call_t *)linux_epoll_pwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 319 = linux_epoll_pwait */
342
	{ 0, (sy_call_t *)linux_utimensat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 320 = linux_utimensat */
342
	{ AS(linux_utimensat_args), (sy_call_t *)linux_utimensat, AUE_FUTIMESAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 320 = linux_utimensat */
343
	{ 0, (sy_call_t *)linux_signalfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 321 = linux_signalfd */
343
	{ 0, (sy_call_t *)linux_signalfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 321 = linux_signalfd */
344
	{ 0, (sy_call_t *)linux_timerfd_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 322 = linux_timerfd_create */
344
	{ 0, (sy_call_t *)linux_timerfd_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 322 = linux_timerfd_create */
345
	{ 0, (sy_call_t *)linux_eventfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 323 = linux_eventfd */
345
	{ AS(linux_eventfd_args), (sy_call_t *)linux_eventfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 323 = linux_eventfd */
346
	{ 0, (sy_call_t *)linux_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 324 = linux_fallocate */
346
	{ AS(linux_fallocate_args), (sy_call_t *)linux_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 324 = linux_fallocate */
347
	{ 0, (sy_call_t *)linux_timerfd_settime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 325 = linux_timerfd_settime */
347
	{ 0, (sy_call_t *)linux_timerfd_settime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 325 = linux_timerfd_settime */
348
	{ 0, (sy_call_t *)linux_timerfd_gettime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 326 = linux_timerfd_gettime */
348
	{ 0, (sy_call_t *)linux_timerfd_gettime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 326 = linux_timerfd_gettime */
349
	{ 0, (sy_call_t *)linux_signalfd4, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 327 = linux_signalfd4 */
349
	{ 0, (sy_call_t *)linux_signalfd4, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 327 = linux_signalfd4 */
350
	{ 0, (sy_call_t *)linux_eventfd2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 328 = linux_eventfd2 */
350
	{ AS(linux_eventfd2_args), (sy_call_t *)linux_eventfd2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 328 = linux_eventfd2 */
351
	{ 0, (sy_call_t *)linux_epoll_create1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 329 = linux_epoll_create1 */
351
	{ AS(linux_epoll_create1_args), (sy_call_t *)linux_epoll_create1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 329 = linux_epoll_create1 */
352
	{ 0, (sy_call_t *)linux_dup3, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 330 = linux_dup3 */
352
	{ AS(linux_dup3_args), (sy_call_t *)linux_dup3, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 330 = linux_dup3 */
353
	{ AS(linux_pipe2_args), (sy_call_t *)linux_pipe2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 331 = linux_pipe2 */
353
	{ AS(linux_pipe2_args), (sy_call_t *)linux_pipe2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 331 = linux_pipe2 */
354
	{ 0, (sy_call_t *)linux_inotify_init1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 332 = linux_inotify_init1 */
354
	{ 0, (sy_call_t *)linux_inotify_init1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 332 = linux_inotify_init1 */
355
	{ 0, (sy_call_t *)linux_preadv, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 333 = linux_preadv */
355
	{ 0, (sy_call_t *)linux_preadv, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 333 = linux_preadv */
Lines 356-371 Link Here
356
	{ 0, (sy_call_t *)linux_pwritev, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 334 = linux_pwritev */
356
	{ 0, (sy_call_t *)linux_pwritev, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 334 = linux_pwritev */
357
	{ 0, (sy_call_t *)linux_rt_tsigqueueinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 335 = linux_rt_tsigqueueinfo */
357
	{ 0, (sy_call_t *)linux_rt_tsigqueueinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 335 = linux_rt_tsigqueueinfo */
358
	{ 0, (sy_call_t *)linux_perf_event_open, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 336 = linux_perf_event_open */
358
	{ 0, (sy_call_t *)linux_perf_event_open, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 336 = linux_perf_event_open */
359
	{ 0, (sy_call_t *)linux_recvmmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 337 = linux_recvmmsg */
359
	{ AS(linux_recvmmsg_args), (sy_call_t *)linux_recvmmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 337 = linux_recvmmsg */
360
	{ 0, (sy_call_t *)linux_fanotify_init, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 338 = linux_fanotify_init */
360
	{ 0, (sy_call_t *)linux_fanotify_init, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 338 = linux_fanotify_init */
361
	{ 0, (sy_call_t *)linux_fanotify_mark, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 339 = linux_fanotify_mark */
361
	{ 0, (sy_call_t *)linux_fanotify_mark, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 339 = linux_fanotify_mark */
362
	{ 0, (sy_call_t *)linux_prlimit64, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 340 = linux_prlimit64 */
362
	{ AS(linux_prlimit64_args), (sy_call_t *)linux_prlimit64, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 340 = linux_prlimit64 */
363
	{ 0, (sy_call_t *)linux_name_to_handle_at, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 341 = linux_name_to_handle_at */
363
	{ 0, (sy_call_t *)linux_name_to_handle_at, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 341 = linux_name_to_handle_at */
364
	{ 0, (sy_call_t *)linux_open_by_handle_at, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 342 = linux_open_by_handle_at */
364
	{ 0, (sy_call_t *)linux_open_by_handle_at, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 342 = linux_open_by_handle_at */
365
	{ 0, (sy_call_t *)linux_clock_adjtime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 343 = linux_clock_adjtime */
365
	{ 0, (sy_call_t *)linux_clock_adjtime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 343 = linux_clock_adjtime */
366
	{ 0, (sy_call_t *)linux_syncfs, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 344 = linux_syncfs */
366
	{ AS(linux_syncfs_args), (sy_call_t *)linux_syncfs, AUE_SYNC, NULL, 0, 0, 0, SY_THR_STATIC },	/* 344 = linux_syncfs */
367
	{ 0, (sy_call_t *)linux_sendmmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 345 = linux_sendmmsg */
367
	{ AS(linux_sendmmsg_args), (sy_call_t *)linux_sendmmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 345 = linux_sendmmsg */
368
	{ 0, (sy_call_t *)linux_setns, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 346 = linux_setns */
368
	{ 0, (sy_call_t *)linux_setns, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 346 = linux_setns */
369
	{ 0, (sy_call_t *)linux_process_vm_readv, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 347 = linux_process_vm_readv */
369
	{ 0, (sy_call_t *)linux_process_vm_readv, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 347 = linux_process_vm_readv */
370
	{ 0, (sy_call_t *)linux_process_vm_writev, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 348 = linux_process_vm_writev */
370
	{ 0, (sy_call_t *)linux_process_vm_writev, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 348 = linux_process_vm_writev */
371
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 349 = nosys */
371
};
372
};
(-)sys/amd64/linux32/linux32_systrace_args.c (-43 / +431 lines)
Lines 12-20 Link Here
12
	int64_t *iarg  = (int64_t *) uarg;
12
	int64_t *iarg  = (int64_t *) uarg;
13
	switch (sysnum) {
13
	switch (sysnum) {
14
#define	nosys	linux_nosys
14
#define	nosys	linux_nosys
15
	/* sys_exit */
15
	/* linux_exit */
16
	case 1: {
16
	case 1: {
17
		struct sys_exit_args *p = params;
17
		struct linux_exit_args *p = params;
18
		iarg[0] = p->rval; /* int */
18
		iarg[0] = p->rval; /* int */
19
		*n_args = 1;
19
		*n_args = 1;
20
		break;
20
		break;
Lines 1043-1061 Link Here
1043
		*n_args = 0;
1043
		*n_args = 0;
1044
		break;
1044
		break;
1045
	}
1045
	}
1046
	/* sched_setparam */
1046
	/* linux_sched_setparam */
1047
	case 154: {
1047
	case 154: {
1048
		struct sched_setparam_args *p = params;
1048
		struct linux_sched_setparam_args *p = params;
1049
		iarg[0] = p->pid; /* pid_t */
1049
		iarg[0] = p->pid; /* l_pid_t */
1050
		uarg[1] = (intptr_t) p->param; /* const struct sched_param * */
1050
		uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */
1051
		*n_args = 2;
1051
		*n_args = 2;
1052
		break;
1052
		break;
1053
	}
1053
	}
1054
	/* sched_getparam */
1054
	/* linux_sched_getparam */
1055
	case 155: {
1055
	case 155: {
1056
		struct sched_getparam_args *p = params;
1056
		struct linux_sched_getparam_args *p = params;
1057
		iarg[0] = p->pid; /* pid_t */
1057
		iarg[0] = p->pid; /* l_pid_t */
1058
		uarg[1] = (intptr_t) p->param; /* struct sched_param * */
1058
		uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */
1059
		*n_args = 2;
1059
		*n_args = 2;
1060
		break;
1060
		break;
1061
	}
1061
	}
Lines 1234-1240 Link Here
1234
	}
1234
	}
1235
	/* linux_rt_sigqueueinfo */
1235
	/* linux_rt_sigqueueinfo */
1236
	case 178: {
1236
	case 178: {
1237
		*n_args = 0;
1237
		struct linux_rt_sigqueueinfo_args *p = params;
1238
		iarg[0] = p->pid; /* l_pid_t */
1239
		iarg[1] = p->sig; /* l_int */
1240
		uarg[2] = (intptr_t) p->info; /* l_siginfo_t * */
1241
		*n_args = 3;
1238
		break;
1242
		break;
1239
	}
1243
	}
1240
	/* linux_rt_sigsuspend */
1244
	/* linux_rt_sigsuspend */
Lines 1693-1709 Link Here
1693
	}
1697
	}
1694
	/* linux_epoll_create */
1698
	/* linux_epoll_create */
1695
	case 254: {
1699
	case 254: {
1696
		*n_args = 0;
1700
		struct linux_epoll_create_args *p = params;
1701
		iarg[0] = p->size; /* l_int */
1702
		*n_args = 1;
1697
		break;
1703
		break;
1698
	}
1704
	}
1699
	/* linux_epoll_ctl */
1705
	/* linux_epoll_ctl */
1700
	case 255: {
1706
	case 255: {
1701
		*n_args = 0;
1707
		struct linux_epoll_ctl_args *p = params;
1708
		iarg[0] = p->epfd; /* l_int */
1709
		iarg[1] = p->op; /* l_int */
1710
		iarg[2] = p->fd; /* l_int */
1711
		uarg[3] = (intptr_t) p->event; /* struct epoll_event * */
1712
		*n_args = 4;
1702
		break;
1713
		break;
1703
	}
1714
	}
1704
	/* linux_epoll_wait */
1715
	/* linux_epoll_wait */
1705
	case 256: {
1716
	case 256: {
1706
		*n_args = 0;
1717
		struct linux_epoll_wait_args *p = params;
1718
		iarg[0] = p->epfd; /* l_int */
1719
		uarg[1] = (intptr_t) p->events; /* struct epoll_event * */
1720
		iarg[2] = p->maxevents; /* l_int */
1721
		iarg[3] = p->timeout; /* l_int */
1722
		*n_args = 4;
1707
		break;
1723
		break;
1708
	}
1724
	}
1709
	/* linux_remap_file_pages */
1725
	/* linux_remap_file_pages */
Lines 1886-1892 Link Here
1886
	}
1902
	}
1887
	/* linux_waitid */
1903
	/* linux_waitid */
1888
	case 284: {
1904
	case 284: {
1889
		*n_args = 0;
1905
		struct linux_waitid_args *p = params;
1906
		iarg[0] = p->idtype; /* int */
1907
		iarg[1] = p->id; /* l_pid_t */
1908
		uarg[2] = (intptr_t) p->info; /* l_siginfo_t * */
1909
		iarg[3] = p->options; /* int */
1910
		uarg[4] = (intptr_t) p->rusage; /* struct l_rusage * */
1911
		*n_args = 5;
1890
		break;
1912
		break;
1891
	}
1913
	}
1892
	/* linux_add_key */
1914
	/* linux_add_key */
Lines 2057-2074 Link Here
2057
		iarg[0] = p->dfd; /* l_int */
2079
		iarg[0] = p->dfd; /* l_int */
2058
		uarg[1] = (intptr_t) p->filename; /* const char * */
2080
		uarg[1] = (intptr_t) p->filename; /* const char * */
2059
		iarg[2] = p->amode; /* l_int */
2081
		iarg[2] = p->amode; /* l_int */
2060
		iarg[3] = p->flag; /* int */
2082
		*n_args = 3;
2061
		*n_args = 4;
2062
		break;
2083
		break;
2063
	}
2084
	}
2064
	/* linux_pselect6 */
2085
	/* linux_pselect6 */
2065
	case 308: {
2086
	case 308: {
2066
		*n_args = 0;
2087
		struct linux_pselect6_args *p = params;
2088
		iarg[0] = p->nfds; /* l_int */
2089
		uarg[1] = (intptr_t) p->readfds; /* l_fd_set * */
2090
		uarg[2] = (intptr_t) p->writefds; /* l_fd_set * */
2091
		uarg[3] = (intptr_t) p->exceptfds; /* l_fd_set * */
2092
		uarg[4] = (intptr_t) p->tsp; /* struct l_timespec * */
2093
		uarg[5] = (intptr_t) p->sig; /* l_uintptr_t * */
2094
		*n_args = 6;
2067
		break;
2095
		break;
2068
	}
2096
	}
2069
	/* linux_ppoll */
2097
	/* linux_ppoll */
2070
	case 309: {
2098
	case 309: {
2071
		*n_args = 0;
2099
		struct linux_ppoll_args *p = params;
2100
		uarg[0] = (intptr_t) p->fds; /* struct pollfd * */
2101
		uarg[1] = p->nfds; /* uint32_t */
2102
		uarg[2] = (intptr_t) p->tsp; /* struct l_timespec * */
2103
		uarg[3] = (intptr_t) p->sset; /* l_sigset_t * */
2104
		iarg[4] = p->ssize; /* l_size_t */
2105
		*n_args = 5;
2072
		break;
2106
		break;
2073
	}
2107
	}
2074
	/* linux_unshare */
2108
	/* linux_unshare */
Lines 2125-2136 Link Here
2125
	}
2159
	}
2126
	/* linux_epoll_pwait */
2160
	/* linux_epoll_pwait */
2127
	case 319: {
2161
	case 319: {
2128
		*n_args = 0;
2162
		struct linux_epoll_pwait_args *p = params;
2163
		iarg[0] = p->epfd; /* l_int */
2164
		uarg[1] = (intptr_t) p->events; /* struct epoll_event * */
2165
		iarg[2] = p->maxevents; /* l_int */
2166
		iarg[3] = p->timeout; /* l_int */
2167
		uarg[4] = (intptr_t) p->mask; /* l_sigset_t * */
2168
		*n_args = 5;
2129
		break;
2169
		break;
2130
	}
2170
	}
2131
	/* linux_utimensat */
2171
	/* linux_utimensat */
2132
	case 320: {
2172
	case 320: {
2133
		*n_args = 0;
2173
		struct linux_utimensat_args *p = params;
2174
		iarg[0] = p->dfd; /* l_int */
2175
		uarg[1] = (intptr_t) p->pathname; /* const char * */
2176
		uarg[2] = (intptr_t) p->times; /* const struct l_timespec * */
2177
		iarg[3] = p->flags; /* l_int */
2178
		*n_args = 4;
2134
		break;
2179
		break;
2135
	}
2180
	}
2136
	/* linux_signalfd */
2181
	/* linux_signalfd */
Lines 2145-2156 Link Here
2145
	}
2190
	}
2146
	/* linux_eventfd */
2191
	/* linux_eventfd */
2147
	case 323: {
2192
	case 323: {
2148
		*n_args = 0;
2193
		struct linux_eventfd_args *p = params;
2194
		iarg[0] = p->initval; /* l_uint */
2195
		*n_args = 1;
2149
		break;
2196
		break;
2150
	}
2197
	}
2151
	/* linux_fallocate */
2198
	/* linux_fallocate */
2152
	case 324: {
2199
	case 324: {
2153
		*n_args = 0;
2200
		struct linux_fallocate_args *p = params;
2201
		iarg[0] = p->fd; /* l_int */
2202
		iarg[1] = p->mode; /* l_int */
2203
		iarg[2] = p->offset; /* l_loff_t */
2204
		iarg[3] = p->len; /* l_loff_t */
2205
		*n_args = 4;
2154
		break;
2206
		break;
2155
	}
2207
	}
2156
	/* linux_timerfd_settime */
2208
	/* linux_timerfd_settime */
Lines 2170-2186 Link Here
2170
	}
2222
	}
2171
	/* linux_eventfd2 */
2223
	/* linux_eventfd2 */
2172
	case 328: {
2224
	case 328: {
2173
		*n_args = 0;
2225
		struct linux_eventfd2_args *p = params;
2226
		iarg[0] = p->initval; /* l_uint */
2227
		iarg[1] = p->flags; /* l_int */
2228
		*n_args = 2;
2174
		break;
2229
		break;
2175
	}
2230
	}
2176
	/* linux_epoll_create1 */
2231
	/* linux_epoll_create1 */
2177
	case 329: {
2232
	case 329: {
2178
		*n_args = 0;
2233
		struct linux_epoll_create1_args *p = params;
2234
		iarg[0] = p->flags; /* l_int */
2235
		*n_args = 1;
2179
		break;
2236
		break;
2180
	}
2237
	}
2181
	/* linux_dup3 */
2238
	/* linux_dup3 */
2182
	case 330: {
2239
	case 330: {
2183
		*n_args = 0;
2240
		struct linux_dup3_args *p = params;
2241
		iarg[0] = p->oldfd; /* l_int */
2242
		iarg[1] = p->newfd; /* l_int */
2243
		iarg[2] = p->flags; /* l_int */
2244
		*n_args = 3;
2184
		break;
2245
		break;
2185
	}
2246
	}
2186
	/* linux_pipe2 */
2247
	/* linux_pipe2 */
Lines 2218-2224 Link Here
2218
	}
2279
	}
2219
	/* linux_recvmmsg */
2280
	/* linux_recvmmsg */
2220
	case 337: {
2281
	case 337: {
2221
		*n_args = 0;
2282
		struct linux_recvmmsg_args *p = params;
2283
		iarg[0] = p->s; /* l_int */
2284
		uarg[1] = (intptr_t) p->msg; /* struct l_mmsghdr * */
2285
		iarg[2] = p->vlen; /* l_uint */
2286
		iarg[3] = p->flags; /* l_uint */
2287
		uarg[4] = (intptr_t) p->timeout; /* struct l_timespec * */
2288
		*n_args = 5;
2222
		break;
2289
		break;
2223
	}
2290
	}
2224
	/* linux_fanotify_init */
2291
	/* linux_fanotify_init */
Lines 2233-2239 Link Here
2233
	}
2300
	}
2234
	/* linux_prlimit64 */
2301
	/* linux_prlimit64 */
2235
	case 340: {
2302
	case 340: {
2236
		*n_args = 0;
2303
		struct linux_prlimit64_args *p = params;
2304
		iarg[0] = p->pid; /* l_pid_t */
2305
		iarg[1] = p->resource; /* l_uint */
2306
		uarg[2] = (intptr_t) p->new; /* struct rlimit * */
2307
		uarg[3] = (intptr_t) p->old; /* struct rlimit * */
2308
		*n_args = 4;
2237
		break;
2309
		break;
2238
	}
2310
	}
2239
	/* linux_name_to_handle_at */
2311
	/* linux_name_to_handle_at */
Lines 2253-2264 Link Here
2253
	}
2325
	}
2254
	/* linux_syncfs */
2326
	/* linux_syncfs */
2255
	case 344: {
2327
	case 344: {
2256
		*n_args = 0;
2328
		struct linux_syncfs_args *p = params;
2329
		iarg[0] = p->fd; /* l_int */
2330
		*n_args = 1;
2257
		break;
2331
		break;
2258
	}
2332
	}
2259
	/* linux_sendmmsg */
2333
	/* linux_sendmmsg */
2260
	case 345: {
2334
	case 345: {
2261
		*n_args = 0;
2335
		struct linux_sendmmsg_args *p = params;
2336
		iarg[0] = p->s; /* l_int */
2337
		uarg[1] = (intptr_t) p->msg; /* struct l_mmsghdr * */
2338
		iarg[2] = p->vlen; /* l_uint */
2339
		iarg[3] = p->flags; /* l_uint */
2340
		*n_args = 4;
2262
		break;
2341
		break;
2263
	}
2342
	}
2264
	/* linux_setns */
2343
	/* linux_setns */
Lines 2287-2293 Link Here
2287
	const char *p = NULL;
2366
	const char *p = NULL;
2288
	switch (sysnum) {
2367
	switch (sysnum) {
2289
#define	nosys	linux_nosys
2368
#define	nosys	linux_nosys
2290
	/* sys_exit */
2369
	/* linux_exit */
2291
	case 1:
2370
	case 1:
2292
		switch(ndx) {
2371
		switch(ndx) {
2293
		case 0:
2372
		case 0:
Lines 3848-3874 Link Here
3848
	/* munlockall */
3927
	/* munlockall */
3849
	case 153:
3928
	case 153:
3850
		break;
3929
		break;
3851
	/* sched_setparam */
3930
	/* linux_sched_setparam */
3852
	case 154:
3931
	case 154:
3853
		switch(ndx) {
3932
		switch(ndx) {
3854
		case 0:
3933
		case 0:
3855
			p = "pid_t";
3934
			p = "l_pid_t";
3856
			break;
3935
			break;
3857
		case 1:
3936
		case 1:
3858
			p = "const struct sched_param *";
3937
			p = "struct l_sched_param *";
3859
			break;
3938
			break;
3860
		default:
3939
		default:
3861
			break;
3940
			break;
3862
		};
3941
		};
3863
		break;
3942
		break;
3864
	/* sched_getparam */
3943
	/* linux_sched_getparam */
3865
	case 155:
3944
	case 155:
3866
		switch(ndx) {
3945
		switch(ndx) {
3867
		case 0:
3946
		case 0:
3868
			p = "pid_t";
3947
			p = "l_pid_t";
3869
			break;
3948
			break;
3870
		case 1:
3949
		case 1:
3871
			p = "struct sched_param *";
3950
			p = "struct l_sched_param *";
3872
			break;
3951
			break;
3873
		default:
3952
		default:
3874
			break;
3953
			break;
Lines 4161-4166 Link Here
4161
		break;
4240
		break;
4162
	/* linux_rt_sigqueueinfo */
4241
	/* linux_rt_sigqueueinfo */
4163
	case 178:
4242
	case 178:
4243
		switch(ndx) {
4244
		case 0:
4245
			p = "l_pid_t";
4246
			break;
4247
		case 1:
4248
			p = "l_int";
4249
			break;
4250
		case 2:
4251
			p = "l_siginfo_t *";
4252
			break;
4253
		default:
4254
			break;
4255
		};
4164
		break;
4256
		break;
4165
	/* linux_rt_sigsuspend */
4257
	/* linux_rt_sigsuspend */
4166
	case 179:
4258
	case 179:
Lines 4823-4834 Link Here
4823
		break;
4915
		break;
4824
	/* linux_epoll_create */
4916
	/* linux_epoll_create */
4825
	case 254:
4917
	case 254:
4918
		switch(ndx) {
4919
		case 0:
4920
			p = "l_int";
4921
			break;
4922
		default:
4923
			break;
4924
		};
4826
		break;
4925
		break;
4827
	/* linux_epoll_ctl */
4926
	/* linux_epoll_ctl */
4828
	case 255:
4927
	case 255:
4928
		switch(ndx) {
4929
		case 0:
4930
			p = "l_int";
4931
			break;
4932
		case 1:
4933
			p = "l_int";
4934
			break;
4935
		case 2:
4936
			p = "l_int";
4937
			break;
4938
		case 3:
4939
			p = "struct epoll_event *";
4940
			break;
4941
		default:
4942
			break;
4943
		};
4829
		break;
4944
		break;
4830
	/* linux_epoll_wait */
4945
	/* linux_epoll_wait */
4831
	case 256:
4946
	case 256:
4947
		switch(ndx) {
4948
		case 0:
4949
			p = "l_int";
4950
			break;
4951
		case 1:
4952
			p = "struct epoll_event *";
4953
			break;
4954
		case 2:
4955
			p = "l_int";
4956
			break;
4957
		case 3:
4958
			p = "l_int";
4959
			break;
4960
		default:
4961
			break;
4962
		};
4832
		break;
4963
		break;
4833
	/* linux_remap_file_pages */
4964
	/* linux_remap_file_pages */
4834
	case 257:
4965
	case 257:
Lines 5068-5073 Link Here
5068
		break;
5199
		break;
5069
	/* linux_waitid */
5200
	/* linux_waitid */
5070
	case 284:
5201
	case 284:
5202
		switch(ndx) {
5203
		case 0:
5204
			p = "int";
5205
			break;
5206
		case 1:
5207
			p = "l_pid_t";
5208
			break;
5209
		case 2:
5210
			p = "l_siginfo_t *";
5211
			break;
5212
		case 3:
5213
			p = "int";
5214
			break;
5215
		case 4:
5216
			p = "struct l_rusage *";
5217
			break;
5218
		default:
5219
			break;
5220
		};
5071
		break;
5221
		break;
5072
	/* linux_add_key */
5222
	/* linux_add_key */
5073
	case 286:
5223
	case 286:
Lines 5327-5335 Link Here
5327
		case 2:
5477
		case 2:
5328
			p = "l_int";
5478
			p = "l_int";
5329
			break;
5479
			break;
5330
		case 3:
5331
			p = "int";
5332
			break;
5333
		default:
5480
		default:
5334
			break;
5481
			break;
5335
		};
5482
		};
Lines 5336-5344 Link Here
5336
		break;
5483
		break;
5337
	/* linux_pselect6 */
5484
	/* linux_pselect6 */
5338
	case 308:
5485
	case 308:
5486
		switch(ndx) {
5487
		case 0:
5488
			p = "l_int";
5489
			break;
5490
		case 1:
5491
			p = "l_fd_set *";
5492
			break;
5493
		case 2:
5494
			p = "l_fd_set *";
5495
			break;
5496
		case 3:
5497
			p = "l_fd_set *";
5498
			break;
5499
		case 4:
5500
			p = "struct l_timespec *";
5501
			break;
5502
		case 5:
5503
			p = "l_uintptr_t *";
5504
			break;
5505
		default:
5506
			break;
5507
		};
5339
		break;
5508
		break;
5340
	/* linux_ppoll */
5509
	/* linux_ppoll */
5341
	case 309:
5510
	case 309:
5511
		switch(ndx) {
5512
		case 0:
5513
			p = "struct pollfd *";
5514
			break;
5515
		case 1:
5516
			p = "uint32_t";
5517
			break;
5518
		case 2:
5519
			p = "struct l_timespec *";
5520
			break;
5521
		case 3:
5522
			p = "l_sigset_t *";
5523
			break;
5524
		case 4:
5525
			p = "l_size_t";
5526
			break;
5527
		default:
5528
			break;
5529
		};
5342
		break;
5530
		break;
5343
	/* linux_unshare */
5531
	/* linux_unshare */
5344
	case 310:
5532
	case 310:
Lines 5392-5400 Link Here
5392
		break;
5580
		break;
5393
	/* linux_epoll_pwait */
5581
	/* linux_epoll_pwait */
5394
	case 319:
5582
	case 319:
5583
		switch(ndx) {
5584
		case 0:
5585
			p = "l_int";
5586
			break;
5587
		case 1:
5588
			p = "struct epoll_event *";
5589
			break;
5590
		case 2:
5591
			p = "l_int";
5592
			break;
5593
		case 3:
5594
			p = "l_int";
5595
			break;
5596
		case 4:
5597
			p = "l_sigset_t *";
5598
			break;
5599
		default:
5600
			break;
5601
		};
5395
		break;
5602
		break;
5396
	/* linux_utimensat */
5603
	/* linux_utimensat */
5397
	case 320:
5604
	case 320:
5605
		switch(ndx) {
5606
		case 0:
5607
			p = "l_int";
5608
			break;
5609
		case 1:
5610
			p = "const char *";
5611
			break;
5612
		case 2:
5613
			p = "const struct l_timespec *";
5614
			break;
5615
		case 3:
5616
			p = "l_int";
5617
			break;
5618
		default:
5619
			break;
5620
		};
5398
		break;
5621
		break;
5399
	/* linux_signalfd */
5622
	/* linux_signalfd */
5400
	case 321:
5623
	case 321:
Lines 5404-5412 Link Here
5404
		break;
5627
		break;
5405
	/* linux_eventfd */
5628
	/* linux_eventfd */
5406
	case 323:
5629
	case 323:
5630
		switch(ndx) {
5631
		case 0:
5632
			p = "l_uint";
5633
			break;
5634
		default:
5635
			break;
5636
		};
5407
		break;
5637
		break;
5408
	/* linux_fallocate */
5638
	/* linux_fallocate */
5409
	case 324:
5639
	case 324:
5640
		switch(ndx) {
5641
		case 0:
5642
			p = "l_int";
5643
			break;
5644
		case 1:
5645
			p = "l_int";
5646
			break;
5647
		case 2:
5648
			p = "l_loff_t";
5649
			break;
5650
		case 3:
5651
			p = "l_loff_t";
5652
			break;
5653
		default:
5654
			break;
5655
		};
5410
		break;
5656
		break;
5411
	/* linux_timerfd_settime */
5657
	/* linux_timerfd_settime */
5412
	case 325:
5658
	case 325:
Lines 5419-5430 Link Here
5419
		break;
5665
		break;
5420
	/* linux_eventfd2 */
5666
	/* linux_eventfd2 */
5421
	case 328:
5667
	case 328:
5668
		switch(ndx) {
5669
		case 0:
5670
			p = "l_uint";
5671
			break;
5672
		case 1:
5673
			p = "l_int";
5674
			break;
5675
		default:
5676
			break;
5677
		};
5422
		break;
5678
		break;
5423
	/* linux_epoll_create1 */
5679
	/* linux_epoll_create1 */
5424
	case 329:
5680
	case 329:
5681
		switch(ndx) {
5682
		case 0:
5683
			p = "l_int";
5684
			break;
5685
		default:
5686
			break;
5687
		};
5425
		break;
5688
		break;
5426
	/* linux_dup3 */
5689
	/* linux_dup3 */
5427
	case 330:
5690
	case 330:
5691
		switch(ndx) {
5692
		case 0:
5693
			p = "l_int";
5694
			break;
5695
		case 1:
5696
			p = "l_int";
5697
			break;
5698
		case 2:
5699
			p = "l_int";
5700
			break;
5701
		default:
5702
			break;
5703
		};
5428
		break;
5704
		break;
5429
	/* linux_pipe2 */
5705
	/* linux_pipe2 */
5430
	case 331:
5706
	case 331:
Lines 5456-5461 Link Here
5456
		break;
5732
		break;
5457
	/* linux_recvmmsg */
5733
	/* linux_recvmmsg */
5458
	case 337:
5734
	case 337:
5735
		switch(ndx) {
5736
		case 0:
5737
			p = "l_int";
5738
			break;
5739
		case 1:
5740
			p = "struct l_mmsghdr *";
5741
			break;
5742
		case 2:
5743
			p = "l_uint";
5744
			break;
5745
		case 3:
5746
			p = "l_uint";
5747
			break;
5748
		case 4:
5749
			p = "struct l_timespec *";
5750
			break;
5751
		default:
5752
			break;
5753
		};
5459
		break;
5754
		break;
5460
	/* linux_fanotify_init */
5755
	/* linux_fanotify_init */
5461
	case 338:
5756
	case 338:
Lines 5465-5470 Link Here
5465
		break;
5760
		break;
5466
	/* linux_prlimit64 */
5761
	/* linux_prlimit64 */
5467
	case 340:
5762
	case 340:
5763
		switch(ndx) {
5764
		case 0:
5765
			p = "l_pid_t";
5766
			break;
5767
		case 1:
5768
			p = "l_uint";
5769
			break;
5770
		case 2:
5771
			p = "struct rlimit *";
5772
			break;
5773
		case 3:
5774
			p = "struct rlimit *";
5775
			break;
5776
		default:
5777
			break;
5778
		};
5468
		break;
5779
		break;
5469
	/* linux_name_to_handle_at */
5780
	/* linux_name_to_handle_at */
5470
	case 341:
5781
	case 341:
Lines 5477-5485 Link Here
5477
		break;
5788
		break;
5478
	/* linux_syncfs */
5789
	/* linux_syncfs */
5479
	case 344:
5790
	case 344:
5791
		switch(ndx) {
5792
		case 0:
5793
			p = "l_int";
5794
			break;
5795
		default:
5796
			break;
5797
		};
5480
		break;
5798
		break;
5481
	/* linux_sendmmsg */
5799
	/* linux_sendmmsg */
5482
	case 345:
5800
	case 345:
5801
		switch(ndx) {
5802
		case 0:
5803
			p = "l_int";
5804
			break;
5805
		case 1:
5806
			p = "struct l_mmsghdr *";
5807
			break;
5808
		case 2:
5809
			p = "l_uint";
5810
			break;
5811
		case 3:
5812
			p = "l_uint";
5813
			break;
5814
		default:
5815
			break;
5816
		};
5483
		break;
5817
		break;
5484
	/* linux_setns */
5818
	/* linux_setns */
5485
	case 346:
5819
	case 346:
Lines 5502-5508 Link Here
5502
	const char *p = NULL;
5836
	const char *p = NULL;
5503
	switch (sysnum) {
5837
	switch (sysnum) {
5504
#define	nosys	linux_nosys
5838
#define	nosys	linux_nosys
5505
	/* sys_exit */
5839
	/* linux_exit */
5506
	case 1:
5840
	case 1:
5507
		if (ndx == 0 || ndx == 1)
5841
		if (ndx == 0 || ndx == 1)
5508
			p = "void";
5842
			p = "void";
Lines 6112-6123 Link Here
6112
		break;
6446
		break;
6113
	/* munlockall */
6447
	/* munlockall */
6114
	case 153:
6448
	case 153:
6115
	/* sched_setparam */
6449
	/* linux_sched_setparam */
6116
	case 154:
6450
	case 154:
6117
		if (ndx == 0 || ndx == 1)
6451
		if (ndx == 0 || ndx == 1)
6118
			p = "int";
6452
			p = "int";
6119
		break;
6453
		break;
6120
	/* sched_getparam */
6454
	/* linux_sched_getparam */
6121
	case 155:
6455
	case 155:
6122
		if (ndx == 0 || ndx == 1)
6456
		if (ndx == 0 || ndx == 1)
6123
			p = "int";
6457
			p = "int";
Lines 6220-6225 Link Here
6220
		break;
6554
		break;
6221
	/* linux_rt_sigqueueinfo */
6555
	/* linux_rt_sigqueueinfo */
6222
	case 178:
6556
	case 178:
6557
		if (ndx == 0 || ndx == 1)
6558
			p = "int";
6559
		break;
6223
	/* linux_rt_sigsuspend */
6560
	/* linux_rt_sigsuspend */
6224
	case 179:
6561
	case 179:
6225
		if (ndx == 0 || ndx == 1)
6562
		if (ndx == 0 || ndx == 1)
Lines 6469-6478 Link Here
6469
	case 253:
6806
	case 253:
6470
	/* linux_epoll_create */
6807
	/* linux_epoll_create */
6471
	case 254:
6808
	case 254:
6809
		if (ndx == 0 || ndx == 1)
6810
			p = "int";
6811
		break;
6472
	/* linux_epoll_ctl */
6812
	/* linux_epoll_ctl */
6473
	case 255:
6813
	case 255:
6814
		if (ndx == 0 || ndx == 1)
6815
			p = "int";
6816
		break;
6474
	/* linux_epoll_wait */
6817
	/* linux_epoll_wait */
6475
	case 256:
6818
	case 256:
6819
		if (ndx == 0 || ndx == 1)
6820
			p = "int";
6821
		break;
6476
	/* linux_remap_file_pages */
6822
	/* linux_remap_file_pages */
6477
	case 257:
6823
	case 257:
6478
	/* linux_set_tid_address */
6824
	/* linux_set_tid_address */
Lines 6569-6574 Link Here
6569
	case 283:
6915
	case 283:
6570
	/* linux_waitid */
6916
	/* linux_waitid */
6571
	case 284:
6917
	case 284:
6918
		if (ndx == 0 || ndx == 1)
6919
			p = "int";
6920
		break;
6572
	/* linux_add_key */
6921
	/* linux_add_key */
6573
	case 286:
6922
	case 286:
6574
	/* linux_request_key */
6923
	/* linux_request_key */
Lines 6654-6661 Link Here
6654
		break;
7003
		break;
6655
	/* linux_pselect6 */
7004
	/* linux_pselect6 */
6656
	case 308:
7005
	case 308:
7006
		if (ndx == 0 || ndx == 1)
7007
			p = "int";
7008
		break;
6657
	/* linux_ppoll */
7009
	/* linux_ppoll */
6658
	case 309:
7010
	case 309:
7011
		if (ndx == 0 || ndx == 1)
7012
			p = "int";
7013
		break;
6659
	/* linux_unshare */
7014
	/* linux_unshare */
6660
	case 310:
7015
	case 310:
6661
	/* linux_set_robust_list */
7016
	/* linux_set_robust_list */
Lines 6682-6689 Link Here
6682
	case 318:
7037
	case 318:
6683
	/* linux_epoll_pwait */
7038
	/* linux_epoll_pwait */
6684
	case 319:
7039
	case 319:
7040
		if (ndx == 0 || ndx == 1)
7041
			p = "int";
7042
		break;
6685
	/* linux_utimensat */
7043
	/* linux_utimensat */
6686
	case 320:
7044
	case 320:
7045
		if (ndx == 0 || ndx == 1)
7046
			p = "int";
7047
		break;
6687
	/* linux_signalfd */
7048
	/* linux_signalfd */
6688
	case 321:
7049
	case 321:
6689
	/* linux_timerfd_create */
7050
	/* linux_timerfd_create */
Lines 6690-6697 Link Here
6690
	case 322:
7051
	case 322:
6691
	/* linux_eventfd */
7052
	/* linux_eventfd */
6692
	case 323:
7053
	case 323:
7054
		if (ndx == 0 || ndx == 1)
7055
			p = "int";
7056
		break;
6693
	/* linux_fallocate */
7057
	/* linux_fallocate */
6694
	case 324:
7058
	case 324:
7059
		if (ndx == 0 || ndx == 1)
7060
			p = "int";
7061
		break;
6695
	/* linux_timerfd_settime */
7062
	/* linux_timerfd_settime */
6696
	case 325:
7063
	case 325:
6697
	/* linux_timerfd_gettime */
7064
	/* linux_timerfd_gettime */
Lines 6700-6709 Link Here
6700
	case 327:
7067
	case 327:
6701
	/* linux_eventfd2 */
7068
	/* linux_eventfd2 */
6702
	case 328:
7069
	case 328:
7070
		if (ndx == 0 || ndx == 1)
7071
			p = "int";
7072
		break;
6703
	/* linux_epoll_create1 */
7073
	/* linux_epoll_create1 */
6704
	case 329:
7074
	case 329:
7075
		if (ndx == 0 || ndx == 1)
7076
			p = "int";
7077
		break;
6705
	/* linux_dup3 */
7078
	/* linux_dup3 */
6706
	case 330:
7079
	case 330:
7080
		if (ndx == 0 || ndx == 1)
7081
			p = "int";
7082
		break;
6707
	/* linux_pipe2 */
7083
	/* linux_pipe2 */
6708
	case 331:
7084
	case 331:
6709
		if (ndx == 0 || ndx == 1)
7085
		if (ndx == 0 || ndx == 1)
Lines 6721-6726 Link Here
6721
	case 336:
7097
	case 336:
6722
	/* linux_recvmmsg */
7098
	/* linux_recvmmsg */
6723
	case 337:
7099
	case 337:
7100
		if (ndx == 0 || ndx == 1)
7101
			p = "int";
7102
		break;
6724
	/* linux_fanotify_init */
7103
	/* linux_fanotify_init */
6725
	case 338:
7104
	case 338:
6726
	/* linux_fanotify_mark */
7105
	/* linux_fanotify_mark */
Lines 6727-6732 Link Here
6727
	case 339:
7106
	case 339:
6728
	/* linux_prlimit64 */
7107
	/* linux_prlimit64 */
6729
	case 340:
7108
	case 340:
7109
		if (ndx == 0 || ndx == 1)
7110
			p = "int";
7111
		break;
6730
	/* linux_name_to_handle_at */
7112
	/* linux_name_to_handle_at */
6731
	case 341:
7113
	case 341:
6732
	/* linux_open_by_handle_at */
7114
	/* linux_open_by_handle_at */
Lines 6735-6742 Link Here
6735
	case 343:
7117
	case 343:
6736
	/* linux_syncfs */
7118
	/* linux_syncfs */
6737
	case 344:
7119
	case 344:
7120
		if (ndx == 0 || ndx == 1)
7121
			p = "int";
7122
		break;
6738
	/* linux_sendmmsg */
7123
	/* linux_sendmmsg */
6739
	case 345:
7124
	case 345:
7125
		if (ndx == 0 || ndx == 1)
7126
			p = "int";
7127
		break;
6740
	/* linux_setns */
7128
	/* linux_setns */
6741
	case 346:
7129
	case 346:
6742
	/* linux_process_vm_readv */
7130
	/* linux_process_vm_readv */
(-)sys/amd64/linux32/linux32_sysvec.c (-89 / +113 lines)
Lines 83-93 Link Here
83
#include <compat/linux/linux_misc.h>
83
#include <compat/linux/linux_misc.h>
84
#include <compat/linux/linux_signal.h>
84
#include <compat/linux/linux_signal.h>
85
#include <compat/linux/linux_util.h>
85
#include <compat/linux/linux_util.h>
86
#include <compat/linux/linux_vdso.h>
86
87
87
MODULE_VERSION(linux, 1);
88
MODULE_VERSION(linux, 1);
88
89
89
MALLOC_DEFINE(M_LINUX, "linux", "Linux mode structures");
90
91
#define	AUXARGS_ENTRY_32(pos, id, val)	\
90
#define	AUXARGS_ENTRY_32(pos, id, val)	\
92
	do {				\
91
	do {				\
93
		suword32(pos++, id);	\
92
		suword32(pos++, id);	\
Lines 109-123 Link Here
109
#define	LINUX_SYS_linux_rt_sendsig	0
108
#define	LINUX_SYS_linux_rt_sendsig	0
110
#define	LINUX_SYS_linux_sendsig		0
109
#define	LINUX_SYS_linux_sendsig		0
111
110
112
const char *linux_platform = "i686";
111
const char *linux_kplatform;
113
static int linux_szplatform;
112
static int linux_szsigcode;
114
extern char linux_sigcode[];
113
static vm_object_t linux_shared_page_obj;
115
extern int linux_szsigcode;
114
static char *linux_shared_page_mapping;
115
extern char _binary_linux32_locore_o_start;
116
extern char _binary_linux32_locore_o_end;
116
117
117
extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
118
extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
118
119
119
SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
120
SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
120
SET_DECLARE(linux_device_handler_set, struct linux_device_handler);
121
121
122
static int	elf_linux_fixup(register_t **stack_base,
122
static int	elf_linux_fixup(register_t **stack_base,
123
		    struct image_params *iparams);
123
		    struct image_params *iparams);
Lines 127-136 Link Here
127
				   struct image_params *imgp, u_long stack);
127
				   struct image_params *imgp, u_long stack);
128
static void	linux32_fixlimit(struct rlimit *rl, int which);
128
static void	linux32_fixlimit(struct rlimit *rl, int which);
129
static boolean_t linux32_trans_osrel(const Elf_Note *note, int32_t *osrel);
129
static boolean_t linux32_trans_osrel(const Elf_Note *note, int32_t *osrel);
130
static void	linux_vdso_install(void *param);
131
static void	linux_vdso_deinstall(void *param);
130
132
131
static eventhandler_tag linux_exit_tag;
132
static eventhandler_tag linux_exec_tag;
133
134
/*
133
/*
135
 * Linux syscalls return negative errno's, we do positive and map them
134
 * Linux syscalls return negative errno's, we do positive and map them
136
 * Reference:
135
 * Reference:
Lines 151-178 Link Here
151
	 -72, -67, -71
150
	 -72, -67, -71
152
};
151
};
153
152
154
int bsd_to_linux_signal[LINUX_SIGTBLSZ] = {
155
	LINUX_SIGHUP, LINUX_SIGINT, LINUX_SIGQUIT, LINUX_SIGILL,
156
	LINUX_SIGTRAP, LINUX_SIGABRT, 0, LINUX_SIGFPE,
157
	LINUX_SIGKILL, LINUX_SIGBUS, LINUX_SIGSEGV, LINUX_SIGSYS,
158
	LINUX_SIGPIPE, LINUX_SIGALRM, LINUX_SIGTERM, LINUX_SIGURG,
159
	LINUX_SIGSTOP, LINUX_SIGTSTP, LINUX_SIGCONT, LINUX_SIGCHLD,
160
	LINUX_SIGTTIN, LINUX_SIGTTOU, LINUX_SIGIO, LINUX_SIGXCPU,
161
	LINUX_SIGXFSZ, LINUX_SIGVTALRM, LINUX_SIGPROF, LINUX_SIGWINCH,
162
	0, LINUX_SIGUSR1, LINUX_SIGUSR2
163
};
164
165
int linux_to_bsd_signal[LINUX_SIGTBLSZ] = {
166
	SIGHUP, SIGINT, SIGQUIT, SIGILL,
167
	SIGTRAP, SIGABRT, SIGBUS, SIGFPE,
168
	SIGKILL, SIGUSR1, SIGSEGV, SIGUSR2,
169
	SIGPIPE, SIGALRM, SIGTERM, SIGBUS,
170
	SIGCHLD, SIGCONT, SIGSTOP, SIGTSTP,
171
	SIGTTIN, SIGTTOU, SIGURG, SIGXCPU,
172
	SIGXFSZ, SIGVTALRM, SIGPROF, SIGWINCH,
173
	SIGIO, SIGURG, SIGSYS
174
};
175
176
#define LINUX_T_UNKNOWN  255
153
#define LINUX_T_UNKNOWN  255
177
static int _bsd_to_linux_trapcode[] = {
154
static int _bsd_to_linux_trapcode[] = {
178
	LINUX_T_UNKNOWN,	/* 0 */
155
	LINUX_T_UNKNOWN,	/* 0 */
Lines 219-224 Link Here
219
	u_int ps_nenvstr;	/* the number of environment strings */
196
	u_int ps_nenvstr;	/* the number of environment strings */
220
};
197
};
221
198
199
LINUX_VDSO_SYM_INTPTR(linux32_sigcode);
200
LINUX_VDSO_SYM_INTPTR(linux32_rt_sigcode);
201
LINUX_VDSO_SYM_INTPTR(linux32_vsyscall);
202
LINUX_VDSO_SYM_CHAR(linux_platform);
203
222
/*
204
/*
223
 * If FreeBSD & Linux have a difference of opinion about what a trap
205
 * If FreeBSD & Linux have a difference of opinion about what a trap
224
 * means, deal with it here.
206
 * means, deal with it here.
Lines 246-256 Link Here
246
{
228
{
247
	Elf32_Auxargs *args;
229
	Elf32_Auxargs *args;
248
	Elf32_Addr *base;
230
	Elf32_Addr *base;
249
	Elf32_Addr *pos, *uplatform;
231
	Elf32_Addr *pos;
250
	struct linux32_ps_strings *arginfo;
232
	struct linux32_ps_strings *arginfo;
251
233
252
	arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS;
234
	arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS;
253
	uplatform = (Elf32_Addr *)((caddr_t)arginfo - linux_szplatform);
254
235
255
	KASSERT(curthread->td_proc == imgp->proc,
236
	KASSERT(curthread->td_proc == imgp->proc,
256
	    ("unsafe elf_linux_fixup(), should be curproc"));
237
	    ("unsafe elf_linux_fixup(), should be curproc"));
Lines 258-263 Link Here
258
	args = (Elf32_Auxargs *)imgp->auxargs;
239
	args = (Elf32_Auxargs *)imgp->auxargs;
259
	pos = base + (imgp->args->argc + imgp->args->envc + 2);
240
	pos = base + (imgp->args->argc + imgp->args->envc + 2);
260
241
242
	AUXARGS_ENTRY_32(pos, LINUX_AT_SYSINFO_EHDR,
243
	    imgp->proc->p_sysent->sv_shared_page_base);
244
	AUXARGS_ENTRY_32(pos, LINUX_AT_SYSINFO, linux32_vsyscall);
261
	AUXARGS_ENTRY_32(pos, LINUX_AT_HWCAP, cpu_feature);
245
	AUXARGS_ENTRY_32(pos, LINUX_AT_HWCAP, cpu_feature);
262
246
263
	/*
247
	/*
Lines 282-288 Link Here
282
	AUXARGS_ENTRY_32(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid);
266
	AUXARGS_ENTRY_32(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid);
283
	AUXARGS_ENTRY_32(pos, AT_GID, imgp->proc->p_ucred->cr_rgid);
267
	AUXARGS_ENTRY_32(pos, AT_GID, imgp->proc->p_ucred->cr_rgid);
284
	AUXARGS_ENTRY_32(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid);
268
	AUXARGS_ENTRY_32(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid);
285
	AUXARGS_ENTRY_32(pos, LINUX_AT_PLATFORM, PTROUT(uplatform));
269
	AUXARGS_ENTRY_32(pos, LINUX_AT_PLATFORM, PTROUT(linux_platform));
270
	AUXARGS_ENTRY(pos, LINUX_AT_RANDOM, PTROUT(imgp->canary));
271
	if (imgp->execpathp != 0)
272
		AUXARGS_ENTRY(pos, LINUX_AT_EXECFN, PTROUT(imgp->execpathp));
286
	if (args->execfd != -1)
273
	if (args->execfd != -1)
287
		AUXARGS_ENTRY_32(pos, AT_EXECFD, args->execfd);
274
		AUXARGS_ENTRY_32(pos, AT_EXECFD, args->execfd);
288
	AUXARGS_ENTRY_32(pos, AT_NULL, 0);
275
	AUXARGS_ENTRY_32(pos, AT_NULL, 0);
Lines 293-303 Link Here
293
	base--;
280
	base--;
294
	suword32(base, (uint32_t)imgp->args->argc);
281
	suword32(base, (uint32_t)imgp->args->argc);
295
	*stack_base = (register_t *)base;
282
	*stack_base = (register_t *)base;
296
	return 0;
283
	return (0);
297
}
284
}
298
285
299
extern unsigned long linux_sznonrtsigcode;
300
301
static void
286
static void
302
linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
287
linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
303
{
288
{
Lines 337-345 Link Here
337
	/*
322
	/*
338
	 * Build the argument list for the signal handler.
323
	 * Build the argument list for the signal handler.
339
	 */
324
	 */
340
	if (p->p_sysent->sv_sigtbl)
325
	sig = bsd_to_linux_signal(sig);
341
		if (sig <= p->p_sysent->sv_sigsize)
342
			sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
343
326
344
	bzero(&frame, sizeof(frame));
327
	bzero(&frame, sizeof(frame));
345
328
Lines 352-358 Link Here
352
	ksiginfo_to_lsiginfo(ksi, &frame.sf_si, sig);
335
	ksiginfo_to_lsiginfo(ksi, &frame.sf_si, sig);
353
336
354
	/*
337
	/*
355
	 * Build the signal context to be used by sigreturn.
338
	 * Build the signal context to be used by sigreturn
339
	 * and libgcc unwind.
356
	 */
340
	 */
357
	frame.sf_sc.uc_flags = 0;		/* XXX ??? */
341
	frame.sf_sc.uc_flags = 0;		/* XXX ??? */
358
	frame.sf_sc.uc_link = 0;		/* XXX ??? */
342
	frame.sf_sc.uc_link = 0;		/* XXX ??? */
Lines 365-375 Link Here
365
349
366
	bsd_to_linux_sigset(mask, &frame.sf_sc.uc_sigmask);
350
	bsd_to_linux_sigset(mask, &frame.sf_sc.uc_sigmask);
367
351
368
	frame.sf_sc.uc_mcontext.sc_mask   = frame.sf_sc.uc_sigmask.__bits[0];
352
	frame.sf_sc.uc_mcontext.sc_mask   = frame.sf_sc.uc_sigmask.__mask;
369
	frame.sf_sc.uc_mcontext.sc_edi    = regs->tf_rdi;
353
	frame.sf_sc.uc_mcontext.sc_edi    = regs->tf_rdi;
370
	frame.sf_sc.uc_mcontext.sc_esi    = regs->tf_rsi;
354
	frame.sf_sc.uc_mcontext.sc_esi    = regs->tf_rsi;
371
	frame.sf_sc.uc_mcontext.sc_ebp    = regs->tf_rbp;
355
	frame.sf_sc.uc_mcontext.sc_ebp    = regs->tf_rbp;
372
	frame.sf_sc.uc_mcontext.sc_ebx    = regs->tf_rbx;
356
	frame.sf_sc.uc_mcontext.sc_ebx    = regs->tf_rbx;
357
	frame.sf_sc.uc_mcontext.sc_esp    = regs->tf_rsp;
373
	frame.sf_sc.uc_mcontext.sc_edx    = regs->tf_rdx;
358
	frame.sf_sc.uc_mcontext.sc_edx    = regs->tf_rdx;
374
	frame.sf_sc.uc_mcontext.sc_ecx    = regs->tf_rcx;
359
	frame.sf_sc.uc_mcontext.sc_ecx    = regs->tf_rcx;
375
	frame.sf_sc.uc_mcontext.sc_eax    = regs->tf_rax;
360
	frame.sf_sc.uc_mcontext.sc_eax    = regs->tf_rax;
Lines 411-417 Link Here
411
	 * Build context to run handler in.
396
	 * Build context to run handler in.
412
	 */
397
	 */
413
	regs->tf_rsp = PTROUT(fp);
398
	regs->tf_rsp = PTROUT(fp);
414
	regs->tf_rip = p->p_sysent->sv_sigcode_base + linux_sznonrtsigcode;
399
	regs->tf_rip = linux32_rt_sigcode;
415
	regs->tf_rflags &= ~(PSL_T | PSL_D);
400
	regs->tf_rflags &= ~(PSL_T | PSL_D);
416
	regs->tf_cs = _ucode32sel;
401
	regs->tf_cs = _ucode32sel;
417
	regs->tf_ss = _udatasel;
402
	regs->tf_ss = _udatasel;
Lines 445-451 Link Here
445
	struct trapframe *regs;
430
	struct trapframe *regs;
446
	struct l_sigframe *fp, frame;
431
	struct l_sigframe *fp, frame;
447
	l_sigset_t lmask;
432
	l_sigset_t lmask;
448
	int oonstack, i;
433
	int oonstack;
449
	int sig, code;
434
	int sig, code;
450
435
451
	sig = ksi->ksi_signo;
436
	sig = ksi->ksi_signo;
Lines 483-491 Link Here
483
	/*
468
	/*
484
	 * Build the argument list for the signal handler.
469
	 * Build the argument list for the signal handler.
485
	 */
470
	 */
486
	if (p->p_sysent->sv_sigtbl)
471
	sig = bsd_to_linux_signal(sig);
487
		if (sig <= p->p_sysent->sv_sigsize)
488
			sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
489
472
490
	bzero(&frame, sizeof(frame));
473
	bzero(&frame, sizeof(frame));
491
474
Lines 497-503 Link Here
497
	/*
480
	/*
498
	 * Build the signal context to be used by sigreturn.
481
	 * Build the signal context to be used by sigreturn.
499
	 */
482
	 */
500
	frame.sf_sc.sc_mask   = lmask.__bits[0];
483
	frame.sf_sc.sc_mask   = lmask.__mask;
501
	frame.sf_sc.sc_gs     = regs->tf_gs;
484
	frame.sf_sc.sc_gs     = regs->tf_gs;
502
	frame.sf_sc.sc_fs     = regs->tf_fs;
485
	frame.sf_sc.sc_fs     = regs->tf_fs;
503
	frame.sf_sc.sc_es     = regs->tf_es;
486
	frame.sf_sc.sc_es     = regs->tf_es;
Lines 506-511 Link Here
506
	frame.sf_sc.sc_esi    = regs->tf_rsi;
489
	frame.sf_sc.sc_esi    = regs->tf_rsi;
507
	frame.sf_sc.sc_ebp    = regs->tf_rbp;
490
	frame.sf_sc.sc_ebp    = regs->tf_rbp;
508
	frame.sf_sc.sc_ebx    = regs->tf_rbx;
491
	frame.sf_sc.sc_ebx    = regs->tf_rbx;
492
	frame.sf_sc.sc_esp    = regs->tf_rsp;
509
	frame.sf_sc.sc_edx    = regs->tf_rdx;
493
	frame.sf_sc.sc_edx    = regs->tf_rdx;
510
	frame.sf_sc.sc_ecx    = regs->tf_rcx;
494
	frame.sf_sc.sc_ecx    = regs->tf_rcx;
511
	frame.sf_sc.sc_eax    = regs->tf_rax;
495
	frame.sf_sc.sc_eax    = regs->tf_rax;
Lines 518-525 Link Here
518
	frame.sf_sc.sc_cr2    = (u_int32_t)(uintptr_t)ksi->ksi_addr;
502
	frame.sf_sc.sc_cr2    = (u_int32_t)(uintptr_t)ksi->ksi_addr;
519
	frame.sf_sc.sc_trapno = bsd_to_linux_trapcode(code);
503
	frame.sf_sc.sc_trapno = bsd_to_linux_trapcode(code);
520
504
521
	for (i = 0; i < (LINUX_NSIG_WORDS-1); i++)
505
	frame.sf_extramask[0] = lmask.__mask;
522
		frame.sf_extramask[i] = lmask.__bits[i+1];
523
506
524
	if (copyout(&frame, fp, sizeof(frame)) != 0) {
507
	if (copyout(&frame, fp, sizeof(frame)) != 0) {
525
		/*
508
		/*
Lines 534-540 Link Here
534
	 * Build context to run handler in.
517
	 * Build context to run handler in.
535
	 */
518
	 */
536
	regs->tf_rsp = PTROUT(fp);
519
	regs->tf_rsp = PTROUT(fp);
537
	regs->tf_rip = p->p_sysent->sv_sigcode_base;
520
	regs->tf_rip = linux32_sigcode;
538
	regs->tf_rflags &= ~(PSL_T | PSL_D);
521
	regs->tf_rflags &= ~(PSL_T | PSL_D);
539
	regs->tf_cs = _ucode32sel;
522
	regs->tf_cs = _ucode32sel;
540
	regs->tf_ss = _udatasel;
523
	regs->tf_ss = _udatasel;
Lines 565-571 Link Here
565
	struct trapframe *regs;
548
	struct trapframe *regs;
566
	sigset_t bmask;
549
	sigset_t bmask;
567
	l_sigset_t lmask;
550
	l_sigset_t lmask;
568
	int eflags, i;
551
	int eflags;
569
	ksiginfo_t ksi;
552
	ksiginfo_t ksi;
570
553
571
	regs = td->td_frame;
554
	regs = td->td_frame;
Lines 606-614 Link Here
606
		return(EINVAL);
589
		return(EINVAL);
607
	}
590
	}
608
591
609
	lmask.__bits[0] = frame.sf_sc.sc_mask;
592
	lmask.__mask = frame.sf_sc.sc_mask;
610
	for (i = 0; i < (LINUX_NSIG_WORDS-1); i++)
593
	lmask.__mask = frame.sf_extramask[0];
611
		lmask.__bits[i+1] = frame.sf_extramask[i];
612
	linux_to_bsd_sigset(&lmask, &bmask);
594
	linux_to_bsd_sigset(&lmask, &bmask);
613
	kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0);
595
	kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0);
614
596
Lines 758-764 Link Here
758
	sa->code = frame->tf_rax;
740
	sa->code = frame->tf_rax;
759
741
760
	if (sa->code >= p->p_sysent->sv_size)
742
	if (sa->code >= p->p_sysent->sv_size)
761
		sa->callp = &p->p_sysent->sv_table[0];
743
		/* nosys */
744
		sa->callp = &p->p_sysent->sv_table[LINUX_SYS_MAXSYSCALL];
762
	else
745
	else
763
		sa->callp = &p->p_sysent->sv_table[sa->code];
746
		sa->callp = &p->p_sysent->sv_table[sa->code];
764
	sa->narg = sa->callp->sy_narg;
747
	sa->narg = sa->callp->sy_narg;
Lines 862-882 Link Here
862
	char *stringp, *destp;
845
	char *stringp, *destp;
863
	u_int32_t *stack_base;
846
	u_int32_t *stack_base;
864
	struct linux32_ps_strings *arginfo;
847
	struct linux32_ps_strings *arginfo;
848
	char canary[LINUX_AT_RANDOM_LEN];
849
	size_t execpath_len;
865
850
866
	/*
851
	/*
867
	 * Calculate string base and vector table pointers.
852
	 * Calculate string base and vector table pointers.
868
	 * Also deal with signal trampoline code for this exec type.
869
	 */
853
	 */
854
	if (imgp->execpath != NULL && imgp->auxargs != NULL)
855
		execpath_len = strlen(imgp->execpath) + 1;
856
	else
857
		execpath_len = 0;
858
870
	arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS;
859
	arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS;
871
	destp =	(caddr_t)arginfo - SPARE_USRSPACE - linux_szplatform -
860
	destp =	(caddr_t)arginfo - SPARE_USRSPACE -
872
	    roundup((ARG_MAX - imgp->args->stringspace),
861
	    roundup(sizeof(canary), sizeof(char *)) -
873
	    sizeof(char *));
862
	    roundup(execpath_len, sizeof(char *)) -
863
	    roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *));
874
864
865
	if (execpath_len != 0) {
866
		imgp->execpathp = (uintptr_t)arginfo - execpath_len;
867
		copyout(imgp->execpath, (void *)imgp->execpathp, execpath_len);
868
	}
869
875
	/*
870
	/*
876
	 * Install LINUX_PLATFORM
871
	 * Prepare the canary for SSP.
877
	 */
872
	 */
878
	copyout(linux_platform, ((caddr_t)arginfo - linux_szplatform),
873
	arc4rand(canary, sizeof(canary), 0);
879
	    linux_szplatform);
874
	imgp->canary = (uintptr_t)arginfo -
875
	    roundup(execpath_len, sizeof(char *)) -
876
	    roundup(sizeof(canary), sizeof(char *));
877
	copyout(canary, (void *)imgp->canary, sizeof(canary));
880
878
881
	/*
879
	/*
882
	 * If we have a valid auxargs ptr, prepare some room
880
	 * If we have a valid auxargs ptr, prepare some room
Lines 970-975 Link Here
970
SYSCTL_ULONG(_compat_linux32, OID_AUTO, maxvmem, CTLFLAG_RW,
968
SYSCTL_ULONG(_compat_linux32, OID_AUTO, maxvmem, CTLFLAG_RW,
971
    &linux32_maxvmem, 0, "");
969
    &linux32_maxvmem, 0, "");
972
970
971
#if defined(DEBUG)
972
SYSCTL_PROC(_compat_linux32, OID_AUTO, debug,
973
            CTLTYPE_STRING | CTLFLAG_RW,
974
            0, 0, linux_sysctl_debug, "A",
975
            "Linux debugging control");
976
#endif
977
973
static void
978
static void
974
linux32_fixlimit(struct rlimit *rl, int which)
979
linux32_fixlimit(struct rlimit *rl, int which)
975
{
980
{
Lines 1006-1019 Link Here
1006
	.sv_size	= LINUX_SYS_MAXSYSCALL,
1011
	.sv_size	= LINUX_SYS_MAXSYSCALL,
1007
	.sv_table	= linux_sysent,
1012
	.sv_table	= linux_sysent,
1008
	.sv_mask	= 0,
1013
	.sv_mask	= 0,
1009
	.sv_sigsize	= LINUX_SIGTBLSZ,
1014
	.sv_sigsize	= 0,
1010
	.sv_sigtbl	= bsd_to_linux_signal,
1015
	.sv_sigtbl	= NULL,
1011
	.sv_errsize	= ELAST + 1,
1016
	.sv_errsize	= ELAST + 1,
1012
	.sv_errtbl	= bsd_to_linux_errno,
1017
	.sv_errtbl	= bsd_to_linux_errno,
1013
	.sv_transtrap	= translate_traps,
1018
	.sv_transtrap	= translate_traps,
1014
	.sv_fixup	= elf_linux_fixup,
1019
	.sv_fixup	= elf_linux_fixup,
1015
	.sv_sendsig	= linux_sendsig,
1020
	.sv_sendsig	= linux_sendsig,
1016
	.sv_sigcode	= linux_sigcode,
1021
	.sv_sigcode	= &_binary_linux32_locore_o_start,
1017
	.sv_szsigcode	= &linux_szsigcode,
1022
	.sv_szsigcode	= &linux_szsigcode,
1018
	.sv_prepsyscall	= NULL,
1023
	.sv_prepsyscall	= NULL,
1019
	.sv_name	= "Linux ELF32",
1024
	.sv_name	= "Linux ELF32",
Lines 1037-1045 Link Here
1037
	.sv_shared_page_base = LINUX32_SHAREDPAGE,
1042
	.sv_shared_page_base = LINUX32_SHAREDPAGE,
1038
	.sv_shared_page_len = PAGE_SIZE,
1043
	.sv_shared_page_len = PAGE_SIZE,
1039
	.sv_schedtail	= linux_schedtail,
1044
	.sv_schedtail	= linux_schedtail,
1045
	.sv_thread_detach = linux_thread_detach,
1046
	.sv_trap	= NULL,
1040
};
1047
};
1041
INIT_SYSENTVEC(elf_sysvec, &elf_linux_sysvec);
1042
1048
1049
static void
1050
linux_vdso_install(void *param)
1051
{
1052
1053
	linux_szsigcode = (&_binary_linux32_locore_o_end - 
1054
	    &_binary_linux32_locore_o_start);
1055
1056
	if (linux_szsigcode > elf_linux_sysvec.sv_shared_page_len)
1057
		panic("Linux invalid vdso size\n");
1058
1059
	__elfN(linux_vdso_fixup)(&elf_linux_sysvec);
1060
1061
	linux_shared_page_obj = __elfN(linux_shared_page_init)
1062
	    (&linux_shared_page_mapping);
1063
1064
	__elfN(linux_vdso_reloc)(&elf_linux_sysvec, LINUX32_SHAREDPAGE);
1065
1066
	bcopy(elf_linux_sysvec.sv_sigcode, linux_shared_page_mapping,
1067
	    linux_szsigcode);
1068
	elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj;
1069
1070
	linux_kplatform = linux_shared_page_mapping +
1071
	    (linux_platform - (caddr_t)LINUX32_SHAREDPAGE);
1072
}
1073
SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY,
1074
    (sysinit_cfunc_t)linux_vdso_install, NULL);
1075
1076
static void
1077
linux_vdso_deinstall(void *param)
1078
{
1079
1080
	__elfN(linux_shared_page_fini)(linux_shared_page_obj);
1081
};
1082
SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST,
1083
    (sysinit_cfunc_t)linux_vdso_deinstall, NULL);
1084
1043
static char GNU_ABI_VENDOR[] = "GNU";
1085
static char GNU_ABI_VENDOR[] = "GNU";
1044
static int GNULINUX_ABI_DESC = 0;
1086
static int GNULINUX_ABI_DESC = 0;
1045
1087
Lines 1110-1116 Link Here
1110
	Elf32_Brandinfo **brandinfo;
1152
	Elf32_Brandinfo **brandinfo;
1111
	int error;
1153
	int error;
1112
	struct linux_ioctl_handler **lihp;
1154
	struct linux_ioctl_handler **lihp;
1113
	struct linux_device_handler **ldhp;
1114
1155
1115
	error = 0;
1156
	error = 0;
1116
1157
Lines 1123-1141 Link Here
1123
		if (error == 0) {
1164
		if (error == 0) {
1124
			SET_FOREACH(lihp, linux_ioctl_handler_set)
1165
			SET_FOREACH(lihp, linux_ioctl_handler_set)
1125
				linux_ioctl_register_handler(*lihp);
1166
				linux_ioctl_register_handler(*lihp);
1126
			SET_FOREACH(ldhp, linux_device_handler_set)
1127
				linux_device_register_handler(*ldhp);
1128
			mtx_init(&emul_lock, "emuldata lock", NULL, MTX_DEF);
1129
			sx_init(&emul_shared_lock, "emuldata->shared lock");
1130
			LIST_INIT(&futex_list);
1167
			LIST_INIT(&futex_list);
1131
			mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF);
1168
			mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF);
1132
			linux_exit_tag = EVENTHANDLER_REGISTER(process_exit,
1133
			    linux_proc_exit, NULL, 1000);
1134
			linux_exec_tag = EVENTHANDLER_REGISTER(process_exec,
1135
			    linux_proc_exec, NULL, 1000);
1136
			linux_szplatform = roundup(strlen(linux_platform) + 1,
1137
			    sizeof(char *));
1138
			linux_osd_jail_register();
1139
			stclohz = (stathz ? stathz : hz);
1169
			stclohz = (stathz ? stathz : hz);
1140
			if (bootverbose)
1170
			if (bootverbose)
1141
				printf("Linux ELF exec handler installed\n");
1171
				printf("Linux ELF exec handler installed\n");
Lines 1156-1169 Link Here
1156
		if (error == 0) {
1186
		if (error == 0) {
1157
			SET_FOREACH(lihp, linux_ioctl_handler_set)
1187
			SET_FOREACH(lihp, linux_ioctl_handler_set)
1158
				linux_ioctl_unregister_handler(*lihp);
1188
				linux_ioctl_unregister_handler(*lihp);
1159
			SET_FOREACH(ldhp, linux_device_handler_set)
1160
				linux_device_unregister_handler(*ldhp);
1161
			mtx_destroy(&emul_lock);
1162
			sx_destroy(&emul_shared_lock);
1163
			mtx_destroy(&futex_mtx);
1189
			mtx_destroy(&futex_mtx);
1164
			EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
1165
			EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
1166
			linux_osd_jail_deregister();
1167
			if (bootverbose)
1190
			if (bootverbose)
1168
				printf("Linux ELF exec handler removed\n");
1191
				printf("Linux ELF exec handler removed\n");
1169
		} else
1192
		} else
Lines 1170-1178 Link Here
1170
			printf("Could not deinstall ELF interpreter entry\n");
1193
			printf("Could not deinstall ELF interpreter entry\n");
1171
		break;
1194
		break;
1172
	default:
1195
	default:
1173
		return EOPNOTSUPP;
1196
		return (EOPNOTSUPP);
1174
	}
1197
	}
1175
	return error;
1198
	return (error);
1176
}
1199
}
1177
1200
1178
static moduledata_t linux_elf_mod = {
1201
static moduledata_t linux_elf_mod = {
Lines 1182-1184 Link Here
1182
};
1205
};
1183
1206
1184
DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY);
1207
DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY);
1208
MODULE_DEPEND(linuxelf, linux_common, 1, 1, 1);
(-)sys/amd64/linux32/linux32_vdso.lds.s (+66 lines)
Line 0 Link Here
1
/*
2
 * Linker script for 32-bit vDSO.
3
 * Copied from Linux kernel arch/x86/vdso/vdso-layout.lds.S
4
 * and arch/x86/vdso/vdso32/vdso32.lds.S
5
 *
6
 * $FreeBSD$
7
 */
8
9
SECTIONS
10
{
11
	. = . + SIZEOF_HEADERS;
12
13
	.hash		: { *(.hash) }			:text
14
	.gnu.hash	: { *(.gnu.hash) }
15
	.dynsym		: { *(.dynsym) }
16
	.dynstr		: { *(.dynstr) }
17
	.gnu.version	: { *(.gnu.version) }
18
	.gnu.version_d	: { *(.gnu.version_d) }
19
	.gnu.version_r	: { *(.gnu.version_r) }
20
21
	.note		: { *(.note.*) }		:text	:note
22
23
	.eh_frame_hdr	: { *(.eh_frame_hdr) }		:text	:eh_frame_hdr
24
	.eh_frame	: { KEEP (*(.eh_frame)) }	:text
25
26
	.dynamic	: { *(.dynamic) }		:text	:dynamic
27
28
	.rodata		: { *(.rodata*) }		:text
29
	.data		: {
30
	      *(.data*)
31
	      *(.sdata*)
32
	      *(.got.plt) *(.got)
33
	      *(.gnu.linkonce.d.*)
34
	      *(.bss*)
35
	      *(.dynbss*)
36
	      *(.gnu.linkonce.b.*)
37
	}
38
39
	.altinstructions	: { *(.altinstructions) }
40
	.altinstr_replacement	: { *(.altinstr_replacement) }
41
42
	. = ALIGN(0x100);
43
	.text		: { *(.text*) }			:text	=0x90909090
44
}
45
46
PHDRS
47
{
48
	text		PT_LOAD		FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
49
	dynamic		PT_DYNAMIC	FLAGS(4);		/* PF_R */
50
	note		PT_NOTE		FLAGS(4);		/* PF_R */
51
	eh_frame_hdr	PT_GNU_EH_FRAME;
52
}
53
54
ENTRY(linux32_vsyscall);
55
56
VERSION
57
{
58
	LINUX_2.5 {
59
	global:
60
		linux32_vsyscall;
61
		linux32_sigcode;
62
		linux32_rt_sigcode;
63
		linux_platform;
64
	local: *;
65
	};
66
}
(-)sys/amd64/linux32/syscalls.master (-25 / +44 lines)
Lines 38-45 Link Here
38
; #ifdef's, etc. may be included, and are copied to the output files.
38
; #ifdef's, etc. may be included, and are copied to the output files.
39
39
40
0	AUE_NULL	UNIMPL	setup
40
0	AUE_NULL	UNIMPL	setup
41
1	AUE_EXIT	NOPROTO	{ void sys_exit(int rval); } exit \
41
1	AUE_EXIT	STD	{ void linux_exit(int rval); }
42
				    sys_exit_args void
43
2	AUE_FORK	STD	{ int linux_fork(void); }
42
2	AUE_FORK	STD	{ int linux_fork(void); }
44
3	AUE_NULL	NOPROTO	{ int read(int fd, char *buf, \
43
3	AUE_NULL	NOPROTO	{ int read(int fd, char *buf, \
45
				    u_int nbyte); }
44
				    u_int nbyte); }
Lines 268-277 Link Here
268
151	AUE_MUNLOCK	NOPROTO	{ int munlock(const void *addr, size_t len); }
267
151	AUE_MUNLOCK	NOPROTO	{ int munlock(const void *addr, size_t len); }
269
152	AUE_MLOCKALL	NOPROTO	{ int mlockall(int how); }
268
152	AUE_MLOCKALL	NOPROTO	{ int mlockall(int how); }
270
153	AUE_MUNLOCKALL	NOPROTO	{ int munlockall(void); }
269
153	AUE_MUNLOCKALL	NOPROTO	{ int munlockall(void); }
271
154	AUE_SCHED_SETPARAM	NOPROTO	{ int sched_setparam(pid_t pid, \
270
154	AUE_SCHED_SETPARAM	STD	{ int linux_sched_setparam(l_pid_t pid, \
272
				    const struct sched_param *param); }
271
				    struct l_sched_param *param); }
273
155	AUE_SCHED_GETPARAM	NOPROTO	{ int sched_getparam(pid_t pid, \
272
155	AUE_SCHED_GETPARAM	STD	{ int linux_sched_getparam(l_pid_t pid, \
274
				    struct sched_param *param); }
273
				    struct l_sched_param *param); }
275
156	AUE_SCHED_SETSCHEDULER	STD { int linux_sched_setscheduler( \
274
156	AUE_SCHED_SETSCHEDULER	STD { int linux_sched_setscheduler( \
276
				    l_pid_t pid, l_int policy, \
275
				    l_pid_t pid, l_int policy, \
277
				    struct l_sched_param *param); }
276
				    struct l_sched_param *param); }
Lines 319-325 Link Here
319
				    l_siginfo_t *ptr, \
318
				    l_siginfo_t *ptr, \
320
				    struct l_timeval *timeout, \
319
				    struct l_timeval *timeout, \
321
				    l_size_t sigsetsize); }
320
				    l_size_t sigsetsize); }
322
178	AUE_NULL	STD	{ int linux_rt_sigqueueinfo(void); }
321
178	AUE_NULL	STD	{ int linux_rt_sigqueueinfo(l_pid_t pid, l_int sig, \
322
				    l_siginfo_t *info); }
323
179	AUE_NULL	STD	{ int linux_rt_sigsuspend( \
323
179	AUE_NULL	STD	{ int linux_rt_sigsuspend( \
324
				    l_sigset_t *newset, \
324
				    l_sigset_t *newset, \
325
				    l_size_t sigsetsize); }
325
				    l_size_t sigsetsize); }
Lines 430-438 Link Here
430
251	AUE_NULL	UNIMPL
430
251	AUE_NULL	UNIMPL
431
252	AUE_EXIT	STD	{ int linux_exit_group(int error_code); }
431
252	AUE_EXIT	STD	{ int linux_exit_group(int error_code); }
432
253	AUE_NULL	STD	{ int linux_lookup_dcookie(void); }
432
253	AUE_NULL	STD	{ int linux_lookup_dcookie(void); }
433
254	AUE_NULL	STD	{ int linux_epoll_create(void); }
433
254	AUE_NULL	STD	{ int linux_epoll_create(l_int size); }
434
255	AUE_NULL	STD	{ int linux_epoll_ctl(void); }
434
255	AUE_NULL	STD	{ int linux_epoll_ctl(l_int epfd, l_int op, l_int fd, \
435
256	AUE_NULL	STD	{ int linux_epoll_wait(void); }
435
					struct epoll_event *event); }
436
256	AUE_NULL	STD	{ int linux_epoll_wait(l_int epfd, struct epoll_event *events, \
437
					l_int maxevents, l_int timeout); }
436
257	AUE_NULL	STD	{ int linux_remap_file_pages(void); }
438
257	AUE_NULL	STD	{ int linux_remap_file_pages(void); }
437
258	AUE_NULL	STD	{ int linux_set_tid_address(int *tidptr); }
439
258	AUE_NULL	STD	{ int linux_set_tid_address(int *tidptr); }
438
259	AUE_NULL	STD	{ int linux_timer_create(clockid_t clock_id, \
440
259	AUE_NULL	STD	{ int linux_timer_create(clockid_t clock_id, \
Lines 467-473 Link Here
467
281	AUE_NULL	STD	{ int linux_mq_notify(void); }
469
281	AUE_NULL	STD	{ int linux_mq_notify(void); }
468
282	AUE_NULL	STD	{ int linux_mq_getsetattr(void); }
470
282	AUE_NULL	STD	{ int linux_mq_getsetattr(void); }
469
283	AUE_NULL	STD	{ int linux_kexec_load(void); }
471
283	AUE_NULL	STD	{ int linux_kexec_load(void); }
470
284	AUE_NULL	STD	{ int linux_waitid(void); }
472
284	AUE_WAIT6	STD	{ int linux_waitid(int idtype, l_pid_t id, l_siginfo_t *info, \
473
					int options, struct l_rusage *rusage); }
471
285	AUE_NULL	UNIMPL
474
285	AUE_NULL	UNIMPL
472
; linux 2.6.11:
475
; linux 2.6.11:
473
286	AUE_NULL	STD	{ int linux_add_key(void); }
476
286	AUE_NULL	STD	{ int linux_add_key(void); }
Lines 505-513 Link Here
505
					char *buf, l_int bufsiz); }
508
					char *buf, l_int bufsiz); }
506
306	AUE_FCHMODAT	STD	{ int linux_fchmodat(l_int dfd, const char *filename, \
509
306	AUE_FCHMODAT	STD	{ int linux_fchmodat(l_int dfd, const char *filename, \
507
					l_mode_t mode); }
510
					l_mode_t mode); }
508
307	AUE_FACCESSAT	STD	{ int linux_faccessat(l_int dfd, const char *filename, l_int amode, int flag); }
511
307	AUE_FACCESSAT	STD	{ int linux_faccessat(l_int dfd, const char *filename, l_int amode); }
509
308	AUE_NULL	STD	{ int linux_pselect6(void); }
512
308	AUE_SELECT	STD	{ int linux_pselect6(l_int nfds, l_fd_set *readfds,	\
510
309	AUE_NULL	STD	{ int linux_ppoll(void); }
513
					l_fd_set *writefds, l_fd_set *exceptfds,	\
514
					struct l_timespec *tsp, l_uintptr_t *sig); }
515
309	AUE_POLL	STD	{ int linux_ppoll(struct pollfd *fds, uint32_t nfds,	\
516
				    struct l_timespec *tsp, l_sigset_t *sset, l_size_t ssize); }
511
310	AUE_NULL	STD	{ int linux_unshare(void); }
517
310	AUE_NULL	STD	{ int linux_unshare(void); }
512
; linux 2.6.17:
518
; linux 2.6.17:
513
311	AUE_NULL	STD	{ int linux_set_robust_list(struct linux_robust_list_head *head, \
519
311	AUE_NULL	STD	{ int linux_set_robust_list(struct linux_robust_list_head *head, \
Lines 522-543 Link Here
522
317	AUE_NULL	STD	{ int linux_move_pages(void); }
528
317	AUE_NULL	STD	{ int linux_move_pages(void); }
523
; linux 2.6.19:
529
; linux 2.6.19:
524
318	AUE_NULL	STD	{ int linux_getcpu(void); }
530
318	AUE_NULL	STD	{ int linux_getcpu(void); }
525
319	AUE_NULL	STD	{ int linux_epoll_pwait(void); }
531
319     AUE_NULL        STD     { int linux_epoll_pwait(l_int epfd, struct epoll_event *events, \
532
                                        l_int maxevents, l_int timeout, l_sigset_t *mask); }
526
; linux 2.6.22:
533
; linux 2.6.22:
527
320	AUE_NULL	STD	{ int linux_utimensat(void); }
534
320	AUE_FUTIMESAT	STD	{ int linux_utimensat(l_int dfd, const char *pathname, \
535
					const struct l_timespec *times, l_int flags); }
528
321	AUE_NULL	STD	{ int linux_signalfd(void); }
536
321	AUE_NULL	STD	{ int linux_signalfd(void); }
529
322	AUE_NULL	STD	{ int linux_timerfd_create(void); }
537
322	AUE_NULL	STD	{ int linux_timerfd_create(void); }
530
323	AUE_NULL	STD	{ int linux_eventfd(void); }
538
323	AUE_NULL	STD	{ int linux_eventfd(l_uint initval); }
531
; linux 2.6.23:
539
; linux 2.6.23:
532
324	AUE_NULL	STD	{ int linux_fallocate(void); }
540
324	AUE_NULL	STD	{ int linux_fallocate(l_int fd, l_int mode, \
541
				    l_loff_t offset, l_loff_t len); }
533
; linux 2.6.25:
542
; linux 2.6.25:
534
325	AUE_NULL	STD	{ int linux_timerfd_settime(void); }
543
325	AUE_NULL	STD	{ int linux_timerfd_settime(void); }
535
326	AUE_NULL	STD	{ int linux_timerfd_gettime(void); }
544
326	AUE_NULL	STD	{ int linux_timerfd_gettime(void); }
536
; linux 2.6.27:
545
; linux 2.6.27:
537
327	AUE_NULL	STD	{ int linux_signalfd4(void); }
546
327	AUE_NULL	STD	{ int linux_signalfd4(void); }
538
328	AUE_NULL	STD	{ int linux_eventfd2(void); }
547
328	AUE_NULL	STD	{ int linux_eventfd2(l_uint initval, l_int flags); }
539
329	AUE_NULL	STD	{ int linux_epoll_create1(void); }
548
329	AUE_NULL	STD	{ int linux_epoll_create1(l_int flags); }
540
330	AUE_NULL	STD	{ int linux_dup3(void); }
549
330	AUE_NULL	STD	{ int linux_dup3(l_int oldfd,		\
550
					l_int newfd, l_int flags); }
541
331	AUE_NULL	STD	{ int linux_pipe2(l_int *pipefds, l_int flags); }
551
331	AUE_NULL	STD	{ int linux_pipe2(l_int *pipefds, l_int flags); }
542
332	AUE_NULL	STD	{ int linux_inotify_init1(void); }
552
332	AUE_NULL	STD	{ int linux_inotify_init1(void); }
543
; linux 2.6.30:
553
; linux 2.6.30:
Lines 547-563 Link Here
547
335	AUE_NULL	STD	{ int linux_rt_tsigqueueinfo(void); }
557
335	AUE_NULL	STD	{ int linux_rt_tsigqueueinfo(void); }
548
336	AUE_NULL	STD	{ int linux_perf_event_open(void); }
558
336	AUE_NULL	STD	{ int linux_perf_event_open(void); }
549
; linux 2.6.33:
559
; linux 2.6.33:
550
337	AUE_NULL	STD	{ int linux_recvmmsg(void); }
560
337	AUE_NULL	STD	{ int linux_recvmmsg(l_int s,			\
561
				    struct l_mmsghdr *msg, l_uint vlen,		\
562
				    l_uint flags, struct l_timespec *timeout); }
551
338	AUE_NULL	STD	{ int linux_fanotify_init(void); }
563
338	AUE_NULL	STD	{ int linux_fanotify_init(void); }
552
339	AUE_NULL	STD	{ int linux_fanotify_mark(void); }
564
339	AUE_NULL	STD	{ int linux_fanotify_mark(void); }
553
; linux 2.6.36:
565
; linux 2.6.36:
554
340	AUE_NULL	STD	{ int linux_prlimit64(void); }
566
340	AUE_NULL	STD	{ int linux_prlimit64(l_pid_t pid,	\
567
					l_uint resource,		\
568
					struct rlimit *new,		\
569
					struct rlimit *old); }
555
; later:
570
; later:
556
341	AUE_NULL	STD	{ int linux_name_to_handle_at(void); }
571
341	AUE_NULL	STD	{ int linux_name_to_handle_at(void); }
557
342	AUE_NULL	STD	{ int linux_open_by_handle_at(void); }
572
342	AUE_NULL	STD	{ int linux_open_by_handle_at(void); }
558
343	AUE_NULL	STD	{ int linux_clock_adjtime(void); }
573
343	AUE_NULL	STD	{ int linux_clock_adjtime(void); }
559
344	AUE_NULL	STD	{ int linux_syncfs(void); }
574
344	AUE_SYNC	STD	{ int linux_syncfs(l_int fd); }
560
345	AUE_NULL	STD	{ int linux_sendmmsg(void); }
575
345	AUE_NULL	STD	{ int linux_sendmmsg(l_int s,			\
576
				    struct l_mmsghdr *msg, l_uint vlen,		\
577
				    l_uint flags); }
561
346	AUE_NULL	STD	{ int linux_setns(void); }
578
346	AUE_NULL	STD	{ int linux_setns(void); }
562
347	AUE_NULL	STD	{ int linux_process_vm_readv(void); }
579
347	AUE_NULL	STD	{ int linux_process_vm_readv(void); }
563
348	AUE_NULL	STD	{ int linux_process_vm_writev(void); }
580
348	AUE_NULL	STD	{ int linux_process_vm_writev(void); }
581
; please, keep this line at the end.
582
349	AUE_NULL	UNIMPL	nosys
(-)sys/arm/arm/elf_machdep.c (+1 lines)
Lines 79-84 Link Here
79
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
79
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
80
	.sv_syscallnames = syscallnames,
80
	.sv_syscallnames = syscallnames,
81
	.sv_schedtail	= NULL,
81
	.sv_schedtail	= NULL,
82
	.sv_trap	= NULL,
82
};
83
};
83
84
84
static Elf32_Brandinfo freebsd_brand_info = {
85
static Elf32_Brandinfo freebsd_brand_info = {
(-)sys/arm/arm/machdep.c (-4 lines)
Lines 259-268 Link Here
259
		sigexit(td, SIGILL);
259
		sigexit(td, SIGILL);
260
	}
260
	}
261
261
262
	/* Translate the signal if appropriate. */
263
	if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
264
		sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
265
266
	/*
262
	/*
267
	 * Build context to run handler in.  We invoke the handler
263
	 * Build context to run handler in.  We invoke the handler
268
	 * directly, only returning via the trampoline.  Note the
264
	 * directly, only returning via the trampoline.  Note the
(-)sys/compat/ia32/ia32_sysvec.c (+1 lines)
Lines 139-144 Link Here
139
	.sv_shared_page_base = FREEBSD32_SHAREDPAGE,
139
	.sv_shared_page_base = FREEBSD32_SHAREDPAGE,
140
	.sv_shared_page_len = PAGE_SIZE,
140
	.sv_shared_page_len = PAGE_SIZE,
141
	.sv_schedtail	= NULL,
141
	.sv_schedtail	= NULL,
142
	.sv_trap	= NULL,
142
};
143
};
143
INIT_SYSENTVEC(elf_ia32_sysvec, &ia32_freebsd_sysvec);
144
INIT_SYSENTVEC(elf_ia32_sysvec, &ia32_freebsd_sysvec);
144
145
(-)sys/compat/linprocfs/linprocfs.c (-48 / +118 lines)
Lines 39-46 Link Here
39
 *	@(#)procfs_status.c	8.4 (Berkeley) 6/15/94
39
 *	@(#)procfs_status.c	8.4 (Berkeley) 6/15/94
40
 */
40
 */
41
41
42
#include "opt_compat.h"
43
44
#include <sys/cdefs.h>
42
#include <sys/cdefs.h>
45
__FBSDID("$FreeBSD$");
43
__FBSDID("$FreeBSD$");
46
44
Lines 53-58 Link Here
53
#include <sys/filedesc.h>
51
#include <sys/filedesc.h>
54
#include <sys/jail.h>
52
#include <sys/jail.h>
55
#include <sys/kernel.h>
53
#include <sys/kernel.h>
54
#include <sys/limits.h>
56
#include <sys/linker.h>
55
#include <sys/linker.h>
57
#include <sys/lock.h>
56
#include <sys/lock.h>
58
#include <sys/malloc.h>
57
#include <sys/malloc.h>
Lines 68-73 Link Here
68
#include <sys/smp.h>
67
#include <sys/smp.h>
69
#include <sys/socket.h>
68
#include <sys/socket.h>
70
#include <sys/sysctl.h>
69
#include <sys/sysctl.h>
70
#include <sys/sysent.h>
71
#include <sys/systm.h>
71
#include <sys/systm.h>
72
#include <sys/time.h>
72
#include <sys/time.h>
73
#include <sys/tty.h>
73
#include <sys/tty.h>
Lines 78-84 Link Here
78
#include <sys/bus.h>
78
#include <sys/bus.h>
79
79
80
#include <net/if.h>
80
#include <net/if.h>
81
#include <net/vnet.h>
81
#include <net/if_types.h>
82
82
83
#include <vm/vm.h>
83
#include <vm/vm.h>
84
#include <vm/vm_extern.h>
84
#include <vm/vm_extern.h>
Lines 98-108 Link Here
98
#include <machine/md_var.h>
98
#include <machine/md_var.h>
99
#endif /* __i386__ || __amd64__ */
99
#endif /* __i386__ || __amd64__ */
100
100
101
#ifdef COMPAT_FREEBSD32
101
#include <compat/linux/linux.h>
102
#include <compat/freebsd32/freebsd32_util.h>
103
#endif
104
105
#include <compat/linux/linux_ioctl.h>
106
#include <compat/linux/linux_mib.h>
102
#include <compat/linux/linux_mib.h>
107
#include <compat/linux/linux_misc.h>
103
#include <compat/linux/linux_misc.h>
108
#include <compat/linux/linux_util.h>
104
#include <compat/linux/linux_util.h>
Lines 754-759 Link Here
754
	segsz_t lsize;
750
	segsz_t lsize;
755
	struct thread *td2;
751
	struct thread *td2;
756
	struct sigacts *ps;
752
	struct sigacts *ps;
753
	l_sigset_t siglist, sigignore, sigcatch;
757
	int i;
754
	int i;
758
755
759
	PROC_LOCK(p);
756
	PROC_LOCK(p);
Lines 842-871 Link Here
842
839
843
	/*
840
	/*
844
	 * Signal masks
841
	 * Signal masks
845
	 *
846
	 * We support up to 128 signals, while Linux supports 32,
847
	 * but we only define 32 (the same 32 as Linux, to boot), so
848
	 * just show the lower 32 bits of each mask. XXX hack.
849
	 *
850
	 * NB: on certain platforms (Sparc at least) Linux actually
851
	 * supports 64 signals, but this code is a long way from
852
	 * running on anything but i386, so ignore that for now.
853
	 */
842
	 */
854
	PROC_LOCK(p);
843
	PROC_LOCK(p);
855
	sbuf_printf(sb, "SigPnd:\t%08x\n",	p->p_siglist.__bits[0]);
844
	bsd_to_linux_sigset(&p->p_siglist, &siglist);
856
	/*
857
	 * I can't seem to find out where the signal mask is in
858
	 * relation to struct proc, so SigBlk is left unimplemented.
859
	 */
860
	sbuf_printf(sb, "SigBlk:\t%08x\n",	0); /* XXX */
861
	ps = p->p_sigacts;
845
	ps = p->p_sigacts;
862
	mtx_lock(&ps->ps_mtx);
846
	mtx_lock(&ps->ps_mtx);
863
	sbuf_printf(sb, "SigIgn:\t%08x\n",	ps->ps_sigignore.__bits[0]);
847
	bsd_to_linux_sigset(&ps->ps_sigignore, &sigignore);
864
	sbuf_printf(sb, "SigCgt:\t%08x\n",	ps->ps_sigcatch.__bits[0]);
848
	bsd_to_linux_sigset(&ps->ps_sigcatch, &sigcatch);
865
	mtx_unlock(&ps->ps_mtx);
849
	mtx_unlock(&ps->ps_mtx);
866
	PROC_UNLOCK(p);
850
	PROC_UNLOCK(p);
867
851
852
	sbuf_printf(sb, "SigPnd:\t%016jx\n",	siglist.__mask);
868
	/*
853
	/*
854
	 * XXX. SigBlk - target thread's signal mask, td_sigmask.
855
	 * To implement SigBlk pseudofs should support proc/tid dir entries.
856
	 */
857
	sbuf_printf(sb, "SigBlk:\t%016x\n",	0);
858
	sbuf_printf(sb, "SigIgn:\t%016jx\n",	sigignore.__mask);
859
	sbuf_printf(sb, "SigCgt:\t%016jx\n",	sigcatch.__mask);
860
861
	/*
869
	 * Linux also prints the capability masks, but we don't have
862
	 * Linux also prints the capability masks, but we don't have
870
	 * capabilities yet, and when we do get them they're likely to
863
	 * capabilities yet, and when we do get them they're likely to
871
	 * be meaningless to Linux programs, so we lie. XXX
864
	 * be meaningless to Linux programs, so we lie. XXX
Lines 957-990 Link Here
957
static int
950
static int
958
linprocfs_doprocenviron(PFS_FILL_ARGS)
951
linprocfs_doprocenviron(PFS_FILL_ARGS)
959
{
952
{
960
	int ret;
961
953
962
	PROC_LOCK(p);
963
	if ((ret = p_candebug(td, p)) != 0) {
964
		PROC_UNLOCK(p);
965
		return (ret);
966
	}
967
968
	/*
954
	/*
969
	 * Mimic linux behavior and pass only processes with usermode
955
	 * Mimic linux behavior and pass only processes with usermode
970
	 * address space as valid.  Return zero silently otherwize.
956
	 * address space as valid.  Return zero silently otherwize.
971
	 */
957
	 */
972
	if (p->p_vmspace == &vmspace0) {
958
	if (p->p_vmspace == &vmspace0)
973
		PROC_UNLOCK(p);
974
		return (0);
959
		return (0);
975
	}
976
960
977
	if ((p->p_flag & P_SYSTEM) != 0) {
961
	return (proc_getenvv(td, p, sb));
978
		PROC_UNLOCK(p);
962
}
979
		return (0);
980
	}
981
963
982
	PROC_UNLOCK(p);
964
static char l32_map_str[] = "%08lx-%08lx %s%s%s%s %08lx %02x:%02x %lu%s%s\n";
965
static char l64_map_str[] = "%016lx-%016lx %s%s%s%s %08lx %02x:%02x %lu%s%s\n";
966
static char vdso_str[] = "      [vdso]";
967
static char stack_str[] = "      [stack]";
983
968
984
	ret = proc_getenvv(td, p, sb);
985
	return (ret);
986
}
987
988
/*
969
/*
989
 * Filler function for proc/pid/maps
970
 * Filler function for proc/pid/maps
990
 */
971
 */
Lines 1000-1005 Link Here
1000
	vm_prot_t e_prot;
981
	vm_prot_t e_prot;
1001
	unsigned int last_timestamp;
982
	unsigned int last_timestamp;
1002
	char *name = "", *freename = NULL;
983
	char *name = "", *freename = NULL;
984
	const char *l_map_str;
1003
	ino_t ino;
985
	ino_t ino;
1004
	int ref_count, shadow_count, flags;
986
	int ref_count, shadow_count, flags;
1005
	int error;
987
	int error;
Lines 1019-1024 Link Here
1019
	vm = vmspace_acquire_ref(p);
1001
	vm = vmspace_acquire_ref(p);
1020
	if (vm == NULL)
1002
	if (vm == NULL)
1021
		return (ESRCH);
1003
		return (ESRCH);
1004
1005
	if (SV_CURPROC_FLAG(SV_LP64))
1006
		l_map_str = l64_map_str;
1007
	else
1008
		l_map_str = l32_map_str;
1022
	map = &vm->vm_map;
1009
	map = &vm->vm_map;
1023
	vm_map_lock_read(map);
1010
	vm_map_lock_read(map);
1024
	for (entry = map->header.next; entry != &map->header;
1011
	for (entry = map->header.next; entry != &map->header;
Lines 1061-1066 Link Here
1061
				VOP_GETATTR(vp, &vat, td->td_ucred);
1048
				VOP_GETATTR(vp, &vat, td->td_ucred);
1062
				ino = vat.va_fileid;
1049
				ino = vat.va_fileid;
1063
				vput(vp);
1050
				vput(vp);
1051
			} else if (SV_PROC_ABI(p) == SV_ABI_LINUX) {
1052
				if (e_start == p->p_sysent->sv_shared_page_base)
1053
					name = vdso_str;
1054
				if (e_end == p->p_sysent->sv_usrstack)
1055
					name = stack_str;
1064
			}
1056
			}
1065
		} else {
1057
		} else {
1066
			flags = 0;
1058
			flags = 0;
Lines 1072-1079 Link Here
1072
		 * format:
1064
		 * format:
1073
		 *  start, end, access, offset, major, minor, inode, name.
1065
		 *  start, end, access, offset, major, minor, inode, name.
1074
		 */
1066
		 */
1075
		error = sbuf_printf(sb,
1067
		error = sbuf_printf(sb, l_map_str,
1076
		    "%08lx-%08lx %s%s%s%s %08lx %02x:%02x %lu%s%s\n",
1077
		    (u_long)e_start, (u_long)e_end,
1068
		    (u_long)e_start, (u_long)e_end,
1078
		    (e_prot & VM_PROT_READ)?"r":"-",
1069
		    (e_prot & VM_PROT_READ)?"r":"-",
1079
		    (e_prot & VM_PROT_WRITE)?"w":"-",
1070
		    (e_prot & VM_PROT_WRITE)?"w":"-",
Lines 1110-1115 Link Here
1110
}
1101
}
1111
1102
1112
/*
1103
/*
1104
 * Criteria for interface name translation
1105
 */
1106
#define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER)
1107
1108
static int
1109
linux_ifname(struct ifnet *ifp, char *buffer, size_t buflen)
1110
{
1111
	struct ifnet *ifscan;
1112
	int ethno;
1113
1114
	IFNET_RLOCK_ASSERT();
1115
1116
	/* Short-circuit non ethernet interfaces */
1117
	if (!IFP_IS_ETH(ifp))
1118
		return (strlcpy(buffer, ifp->if_xname, buflen));
1119
1120
	/* Determine the (relative) unit number for ethernet interfaces */
1121
	ethno = 0;
1122
	TAILQ_FOREACH(ifscan, &V_ifnet, if_link) {
1123
		if (ifscan == ifp)
1124
			return (snprintf(buffer, buflen, "eth%d", ethno));
1125
		if (IFP_IS_ETH(ifscan))
1126
			ethno++;
1127
	}
1128
1129
	return (0);
1130
}
1131
1132
/*
1113
 * Filler function for proc/net/dev
1133
 * Filler function for proc/net/dev
1114
 */
1134
 */
1115
static int
1135
static int
Lines 1256-1263 Link Here
1256
	return (0);
1276
	return (0);
1257
}
1277
}
1258
1278
1259
extern struct cdevsw *cdevsw[];
1260
1261
/*
1279
/*
1262
 * Filler function for proc/devices
1280
 * Filler function for proc/devices
1263
 */
1281
 */
Lines 1352-1358 Link Here
1352
	return(0);
1370
	return(0);
1353
}
1371
}
1354
1372
1373
/*
1374
 * Filler function for proc/pid/auxv
1375
 */
1376
static int
1377
linprocfs_doauxv(PFS_FILL_ARGS)
1378
{
1379
	struct sbuf *asb;
1380
	off_t buflen, resid;
1381
	int error;
1355
1382
1383
	/*
1384
	 * Mimic linux behavior and pass only processes with usermode
1385
	 * address space as valid.  Return zero silently otherwize.
1386
	 */
1387
	if (p->p_vmspace == &vmspace0)
1388
		return (0);
1389
1390
	if (uio->uio_resid == 0)
1391
		return (0);
1392
	if (uio->uio_offset < 0 || uio->uio_resid < 0)
1393
		return (EINVAL);
1394
1395
	asb = sbuf_new_auto();
1396
	if (asb == NULL)
1397
		return (ENOMEM);
1398
	error = proc_getauxv(td, p, asb);
1399
	if (error == 0)
1400
		error = sbuf_finish(asb);
1401
1402
	resid = sbuf_len(asb) - uio->uio_offset;
1403
	if (resid > uio->uio_resid)
1404
		buflen = uio->uio_resid;
1405
	else
1406
		buflen = resid;
1407
	if (buflen > IOSIZE_MAX)
1408
		return (EINVAL);
1409
	if (buflen > MAXPHYS)
1410
		buflen = MAXPHYS;
1411
	if (resid <= 0)
1412
		return (0);
1413
1414
	if (error == 0)
1415
		error = uiomove(sbuf_data(asb) + uio->uio_offset, buflen, uio);
1416
	sbuf_delete(asb);
1417
	return (error);
1418
}
1419
1356
/*
1420
/*
1357
 * Constructor
1421
 * Constructor
1358
 */
1422
 */
Lines 1410-1416 Link Here
1410
	pfs_create_link(dir, "cwd", &linprocfs_doproccwd,
1474
	pfs_create_link(dir, "cwd", &linprocfs_doproccwd,
1411
	    NULL, NULL, NULL, 0);
1475
	    NULL, NULL, NULL, 0);
1412
	pfs_create_file(dir, "environ", &linprocfs_doprocenviron,
1476
	pfs_create_file(dir, "environ", &linprocfs_doprocenviron,
1413
	    NULL, NULL, NULL, PFS_RD);
1477
	    NULL, &procfs_candebug, NULL, PFS_RD);
1414
	pfs_create_link(dir, "exe", &procfs_doprocfile,
1478
	pfs_create_link(dir, "exe", &procfs_doprocfile,
1415
	    NULL, &procfs_notsystem, NULL, 0);
1479
	    NULL, &procfs_notsystem, NULL, 0);
1416
	pfs_create_file(dir, "maps", &linprocfs_doprocmaps,
1480
	pfs_create_file(dir, "maps", &linprocfs_doprocmaps,
Lines 1427-1432 Link Here
1427
	    NULL, NULL, NULL, PFS_RD);
1491
	    NULL, NULL, NULL, PFS_RD);
1428
	pfs_create_link(dir, "fd", &linprocfs_dofdescfs,
1492
	pfs_create_link(dir, "fd", &linprocfs_dofdescfs,
1429
	    NULL, NULL, NULL, 0);
1493
	    NULL, NULL, NULL, 0);
1494
	pfs_create_file(dir, "auxv", &linprocfs_doauxv,
1495
	    NULL, &procfs_candebug, NULL, PFS_RD|PFS_RAWRD);
1430
1496
1431
	/* /proc/scsi/... */
1497
	/* /proc/scsi/... */
1432
	dir = pfs_create_dir(root, "scsi", NULL, NULL, NULL, 0);
1498
	dir = pfs_create_dir(root, "scsi", NULL, NULL, NULL, 0);
Lines 1472-1478 Link Here
1472
}
1538
}
1473
1539
1474
PSEUDOFS(linprocfs, 1, 0);
1540
PSEUDOFS(linprocfs, 1, 0);
1541
#if defined(__amd64__)
1542
MODULE_DEPEND(linprocfs, linux_common, 1, 1, 1);
1543
#else
1475
MODULE_DEPEND(linprocfs, linux, 1, 1, 1);
1544
MODULE_DEPEND(linprocfs, linux, 1, 1, 1);
1545
#endif
1476
MODULE_DEPEND(linprocfs, procfs, 1, 1, 1);
1546
MODULE_DEPEND(linprocfs, procfs, 1, 1, 1);
1477
MODULE_DEPEND(linprocfs, sysvmsg, 1, 1, 1);
1547
MODULE_DEPEND(linprocfs, sysvmsg, 1, 1, 1);
1478
MODULE_DEPEND(linprocfs, sysvsem, 1, 1, 1);
1548
MODULE_DEPEND(linprocfs, sysvsem, 1, 1, 1);
(-)sys/compat/linsysfs/linsysfs.c (-6 / +4 lines)
Lines 61-72 Link Here
61
61
62
#include <machine/bus.h>
62
#include <machine/bus.h>
63
63
64
#include "opt_compat.h"
65
#ifdef COMPAT_LINUX32				/* XXX */
66
#include <machine/../linux32/linux.h>
67
#else
68
#include <machine/../linux/linux.h>
69
#endif
70
#include <compat/linux/linux_ioctl.h>
64
#include <compat/linux/linux_ioctl.h>
71
#include <compat/linux/linux_mib.h>
65
#include <compat/linux/linux_mib.h>
72
#include <compat/linux/linux_util.h>
66
#include <compat/linux/linux_util.h>
Lines 281-284 Link Here
281
}
275
}
282
276
283
PSEUDOFS(linsysfs, 1, 0);
277
PSEUDOFS(linsysfs, 1, 0);
278
#if defined(__amd64__)
279
MODULE_DEPEND(linsysfs, linux_common, 1, 1, 1);
280
#else
284
MODULE_DEPEND(linsysfs, linux, 1, 1, 1);
281
MODULE_DEPEND(linsysfs, linux, 1, 1, 1);
282
#endif
(-)sys/compat/linux/check_error.d (-2 / +2 lines)
Lines 36-43 Link Here
36
 */
36
 */
37
37
38
linuxulator*:dummy::not_implemented,
38
linuxulator*:dummy::not_implemented,
39
linuxulator*:emul:proc_exit:child_clear_tid_error,
39
linuxulator*:emul:linux_thread_detach:child_clear_tid_error,
40
linuxulator*:emul:proc_exit:futex_failed,
40
linuxulator*:emul:linux_thread_detach:futex_failed,
41
linuxulator*:emul:linux_schedtail:copyout_error,
41
linuxulator*:emul:linux_schedtail:copyout_error,
42
linuxulator*:futex:futex_get:error,
42
linuxulator*:futex:futex_get:error,
43
linuxulator*:futex:futex_sleep:requeue_error,
43
linuxulator*:futex:futex_sleep:requeue_error,
(-)sys/compat/linux/check_internal_locks.d (-35 lines)
Lines 41-54 Link Here
41
41
42
BEGIN
42
BEGIN
43
{
43
{
44
	check["emul_lock"] = 0;
45
	check["emul_shared_rlock"] = 0;
46
	check["emul_shared_wlock"] = 0;
47
	check["futex_mtx"] = 0;
44
	check["futex_mtx"] = 0;
48
}
45
}
49
46
50
linuxulator*:locks:emul_lock:locked,
51
linuxulator*:locks:emul_shared_wlock:locked,
52
linuxulator*:locks:futex_mtx:locked
47
linuxulator*:locks:futex_mtx:locked
53
/check[probefunc] > 0/
48
/check[probefunc] > 0/
54
{
49
{
Lines 57-65 Link Here
57
	stack();
52
	stack();
58
}
53
}
59
54
60
linuxulator*:locks:emul_lock:locked,
61
linuxulator*:locks:emul_shared_rlock:locked,
62
linuxulator*:locks:emul_shared_wlock:locked,
63
linuxulator*:locks:futex_mtx:locked
55
linuxulator*:locks:futex_mtx:locked
64
{
56
{
65
	++check[probefunc];
57
	++check[probefunc];
Lines 69-77 Link Here
69
	spec[probefunc] = speculation();
61
	spec[probefunc] = speculation();
70
}
62
}
71
63
72
linuxulator*:locks:emul_lock:unlock,
73
linuxulator*:locks:emul_shared_rlock:unlock,
74
linuxulator*:locks:emul_shared_wlock:unlock,
75
linuxulator*:locks:futex_mtx:unlock
64
linuxulator*:locks:futex_mtx:unlock
76
/check[probefunc] == 0/
65
/check[probefunc] == 0/
77
{
66
{
Lines 82-90 Link Here
82
	stack();
71
	stack();
83
}
72
}
84
73
85
linuxulator*:locks:emul_lock:unlock,
86
linuxulator*:locks:emul_shared_rlock:unlock,
87
linuxulator*:locks:emul_shared_wlock:unlock,
88
linuxulator*:locks:futex_mtx:unlock
74
linuxulator*:locks:futex_mtx:unlock
89
{
75
{
90
	discard(spec[probefunc]);
76
	discard(spec[probefunc]);
Lines 95-121 Link Here
95
/* Timeout handling */
81
/* Timeout handling */
96
82
97
tick-10s
83
tick-10s
98
/spec["emul_lock"] != 0 && timestamp - ts["emul_lock"] >= 9999999000/
99
{
100
	commit(spec["emul_lock"]);
101
	spec["emul_lock"] = 0;
102
}
103
104
tick-10s
105
/spec["emul_shared_wlock"] != 0 && timestamp - ts["emul_shared_wlock"] >= 9999999000/
106
{
107
	commit(spec["emul_shared_wlock"]);
108
	spec["emul_shared_wlock"] = 0;
109
}
110
111
tick-10s
112
/spec["emul_shared_rlock"] != 0 && timestamp - ts["emul_shared_rlock"] >= 9999999000/
113
{
114
	commit(spec["emul_shared_rlock"]);
115
	spec["emul_shared_rlock"] = 0;
116
}
117
118
tick-10s
119
/spec["futex_mtx"] != 0 && timestamp - ts["futex_mtx"] >= 9999999000/
84
/spec["futex_mtx"] != 0 && timestamp - ts["futex_mtx"] >= 9999999000/
120
{
85
{
121
	commit(spec["futex_mtx"]);
86
	commit(spec["futex_mtx"]);
(-)sys/compat/linux/linux.c (+205 lines)
Line 0 Link Here
1
/*-
2
 * Copyright (c) 2015 Dmitry Chagin
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
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
 * SUCH DAMAGE.
25
 */
26
27
#include <sys/cdefs.h>
28
__FBSDID("$FreeBSD$");
29
30
#include <sys/param.h>
31
#include <sys/systm.h>
32
#include <sys/signalvar.h>
33
34
#include <compat/linux/linux.h>
35
36
37
static int bsd_to_linux_sigtbl[LINUX_SIGTBLSZ] = {
38
	LINUX_SIGHUP,	/* SIGHUP */
39
	LINUX_SIGINT,	/* SIGINT */
40
	LINUX_SIGQUIT,	/* SIGQUIT */
41
	LINUX_SIGILL,	/* SIGILL */
42
	LINUX_SIGTRAP,	/* SIGTRAP */
43
	LINUX_SIGABRT,	/* SIGABRT */
44
	0,		/* SIGEMT */
45
	LINUX_SIGFPE,	/* SIGFPE */
46
	LINUX_SIGKILL,	/* SIGKILL */
47
	LINUX_SIGBUS,	/* SIGBUS */
48
	LINUX_SIGSEGV,	/* SIGSEGV */
49
	LINUX_SIGSYS,	/* SIGSYS */
50
	LINUX_SIGPIPE,	/* SIGPIPE */
51
	LINUX_SIGALRM,	/* SIGALRM */
52
	LINUX_SIGTERM,	/* SIGTERM */
53
	LINUX_SIGURG,	/* SIGURG */
54
	LINUX_SIGSTOP,	/* SIGSTOP */
55
	LINUX_SIGTSTP,	/* SIGTSTP */
56
	LINUX_SIGCONT,	/* SIGCONT */
57
	LINUX_SIGCHLD,	/* SIGCHLD */
58
	LINUX_SIGTTIN,	/* SIGTTIN */
59
	LINUX_SIGTTOU,	/* SIGTTOU */
60
	LINUX_SIGIO,	/* SIGIO */
61
	LINUX_SIGXCPU,	/* SIGXCPU */
62
	LINUX_SIGXFSZ,	/* SIGXFSZ */
63
	LINUX_SIGVTALRM,/* SIGVTALRM */
64
	LINUX_SIGPROF,	/* SIGPROF */
65
	LINUX_SIGWINCH,	/* SIGWINCH */
66
	0,		/* SIGINFO */
67
	LINUX_SIGUSR1,	/* SIGUSR1 */
68
	LINUX_SIGUSR2	/* SIGUSR2 */
69
};
70
71
static int linux_to_bsd_sigtbl[LINUX_SIGTBLSZ] = {
72
	SIGHUP,		/* LINUX_SIGHUP */
73
	SIGINT,		/* LINUX_SIGINT */
74
	SIGQUIT,	/* LINUX_SIGQUIT */
75
	SIGILL,		/* LINUX_SIGILL */
76
	SIGTRAP,	/* LINUX_SIGTRAP */
77
	SIGABRT,	/* LINUX_SIGABRT */
78
	SIGBUS,		/* LINUX_SIGBUS */
79
	SIGFPE,		/* LINUX_SIGFPE */
80
	SIGKILL,	/* LINUX_SIGKILL */
81
	SIGUSR1,	/* LINUX_SIGUSR1 */
82
	SIGSEGV,	/* LINUX_SIGSEGV */
83
	SIGUSR2,	/* LINUX_SIGUSR2 */
84
	SIGPIPE,	/* LINUX_SIGPIPE */
85
	SIGALRM,	/* LINUX_SIGALRM */
86
	SIGTERM,	/* LINUX_SIGTERM */
87
	SIGBUS,		/* LINUX_SIGSTKFLT */
88
	SIGCHLD,	/* LINUX_SIGCHLD */
89
	SIGCONT,	/* LINUX_SIGCONT */
90
	SIGSTOP,	/* LINUX_SIGSTOP */
91
	SIGTSTP,	/* LINUX_SIGTSTP */
92
	SIGTTIN,	/* LINUX_SIGTTIN */
93
	SIGTTOU,	/* LINUX_SIGTTOU */
94
	SIGURG,		/* LINUX_SIGURG */
95
	SIGXCPU,	/* LINUX_SIGXCPU */
96
	SIGXFSZ,	/* LINUX_SIGXFSZ */
97
	SIGVTALRM,	/* LINUX_SIGVTALARM */
98
	SIGPROF,	/* LINUX_SIGPROF */
99
	SIGWINCH,	/* LINUX_SIGWINCH */
100
	SIGIO,		/* LINUX_SIGIO */
101
	/*
102
	 * FreeBSD does not have SIGPWR signal, map Linux SIGPWR signal
103
	 * to the first unused FreeBSD signal number. Since Linux supports
104
	 * signals from 1 to 64 we are ok here as our SIGRTMIN = 65.
105
	 */
106
	SIGRTMIN,	/* LINUX_SIGPWR */
107
	SIGSYS		/* LINUX_SIGSYS */
108
};
109
110
/*
111
 * Map Linux RT signals to the FreeBSD RT signals.
112
 */
113
static inline int
114
linux_to_bsd_rt_signal(int sig)
115
{
116
117
	return (SIGRTMIN + 1 + sig - LINUX_SIGRTMIN);
118
}
119
120
static inline int
121
bsd_to_linux_rt_signal(int sig)
122
{
123
124
	return (sig - SIGRTMIN - 1 + LINUX_SIGRTMIN);
125
}
126
127
int
128
linux_to_bsd_signal(int sig)
129
{
130
131
	KASSERT(sig > 0 && sig <= LINUX_SIGRTMAX, ("Invalid Linux signal\n"));
132
133
	if (sig < LINUX_SIGRTMIN)
134
		return (linux_to_bsd_sigtbl[_SIG_IDX(sig)]);
135
136
	return (linux_to_bsd_rt_signal(sig));
137
}
138
139
int
140
bsd_to_linux_signal(int sig)
141
{
142
143
	if (sig <= LINUX_SIGTBLSZ)
144
		return (bsd_to_linux_sigtbl[_SIG_IDX(sig)]);
145
	if (sig == SIGRTMIN)
146
		return (LINUX_SIGPWR);
147
148
	return (bsd_to_linux_rt_signal(sig));
149
}
150
151
int
152
linux_to_bsd_sigaltstack(int lsa)
153
{
154
	int bsa = 0;
155
156
	if (lsa & LINUX_SS_DISABLE)
157
		bsa |= SS_DISABLE;
158
	/*
159
	 * Linux ignores SS_ONSTACK flag for ss
160
	 * parameter while FreeBSD prohibits it.
161
	 */
162
	return (bsa);
163
}
164
165
int
166
bsd_to_linux_sigaltstack(int bsa)
167
{
168
	int lsa = 0;
169
170
	if (bsa & SS_DISABLE)
171
		lsa |= LINUX_SS_DISABLE;
172
	if (bsa & SS_ONSTACK)
173
		lsa |= LINUX_SS_ONSTACK;
174
	return (lsa);
175
}
176
177
void
178
linux_to_bsd_sigset(l_sigset_t *lss, sigset_t *bss)
179
{
180
	int b, l;
181
182
	SIGEMPTYSET(*bss);
183
	for (l = 1; l <= LINUX_SIGRTMAX; l++) {
184
		if (LINUX_SIGISMEMBER(*lss, l)) {
185
			b = linux_to_bsd_signal(l);
186
			if (b)
187
				SIGADDSET(*bss, b);
188
		}
189
	}
190
}
191
192
void
193
bsd_to_linux_sigset(sigset_t *bss, l_sigset_t *lss)
194
{
195
	int b, l;
196
197
	LINUX_SIGEMPTYSET(*lss);
198
	for (b = 1; b <= SIGRTMAX; b++) {
199
		if (SIGISMEMBER(*bss, b)) {
200
			l = bsd_to_linux_signal(b);
201
			if (l)
202
				LINUX_SIGADDSET(*lss, l);
203
		}
204
	}
205
}
(-)sys/compat/linux/linux.h (+95 lines)
Line 0 Link Here
1
/*-
2
 * Copyright (c) 2015 Dmitry Chagin
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
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
 * SUCH DAMAGE.
25
 *
26
 * $FreeBSD$
27
 */
28
29
#ifndef _LINUX_MI_H_
30
#define _LINUX_MI_H_
31
32
/* sigaltstack */
33
#define	LINUX_SS_ONSTACK	1
34
#define	LINUX_SS_DISABLE	2
35
36
int linux_to_bsd_sigaltstack(int lsa);
37
int bsd_to_linux_sigaltstack(int bsa);
38
39
/* sigset */
40
typedef struct {
41
	uint64_t	__mask;
42
} l_sigset_t;
43
44
/* primitives to manipulate sigset_t */
45
#define	LINUX_SIGEMPTYSET(set)		(set).__mask = 0
46
#define	LINUX_SIGISMEMBER(set, sig)	(1UL & ((set).__mask >> _SIG_IDX(sig)))
47
#define	LINUX_SIGADDSET(set, sig)	(set).__mask |= 1UL << _SIG_IDX(sig)
48
49
void linux_to_bsd_sigset(l_sigset_t *, sigset_t *);
50
void bsd_to_linux_sigset(sigset_t *, l_sigset_t *);
51
52
/* signaling */
53
#define	LINUX_SIGHUP		1
54
#define	LINUX_SIGINT		2
55
#define	LINUX_SIGQUIT		3
56
#define	LINUX_SIGILL		4
57
#define	LINUX_SIGTRAP		5
58
#define	LINUX_SIGABRT		6
59
#define	LINUX_SIGIOT		LINUX_SIGABRT
60
#define	LINUX_SIGBUS		7
61
#define	LINUX_SIGFPE		8
62
#define	LINUX_SIGKILL		9
63
#define	LINUX_SIGUSR1		10
64
#define	LINUX_SIGSEGV		11
65
#define	LINUX_SIGUSR2		12
66
#define	LINUX_SIGPIPE		13
67
#define	LINUX_SIGALRM		14
68
#define	LINUX_SIGTERM		15
69
#define	LINUX_SIGSTKFLT		16
70
#define	LINUX_SIGCHLD		17
71
#define	LINUX_SIGCONT		18
72
#define	LINUX_SIGSTOP		19
73
#define	LINUX_SIGTSTP		20
74
#define	LINUX_SIGTTIN		21
75
#define	LINUX_SIGTTOU		22
76
#define	LINUX_SIGURG		23
77
#define	LINUX_SIGXCPU		24
78
#define	LINUX_SIGXFSZ		25
79
#define	LINUX_SIGVTALRM		26
80
#define	LINUX_SIGPROF		27
81
#define	LINUX_SIGWINCH		28
82
#define	LINUX_SIGIO		29
83
#define	LINUX_SIGPOLL		LINUX_SIGIO
84
#define	LINUX_SIGPWR		30
85
#define	LINUX_SIGSYS		31
86
#define	LINUX_SIGTBLSZ		31
87
#define	LINUX_SIGRTMIN		32
88
#define	LINUX_SIGRTMAX		64
89
90
#define LINUX_SIG_VALID(sig)	((sig) <= LINUX_SIGRTMAX && (sig) > 0)
91
92
int linux_to_bsd_signal(int sig);
93
int bsd_to_linux_signal(int sig);
94
95
#endif /* _LINUX_MI_H_ */
(-)sys/compat/linux/linux_common.c (+93 lines)
Line 0 Link Here
1
/*-
2
 * Copyright (c) 2014 Vassilis Laganakos
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
 * 2. Redistributions in binary form must reproduce the above copyright
11
 *    notice, this list of conditions and the following disclaimer in the
12
 *    documentation and/or other materials provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
 * SUCH DAMAGE.
25
 */
26
27
#include <sys/cdefs.h>
28
__FBSDID("$FreeBSD$");
29
30
#include <sys/param.h>
31
#include <sys/systm.h>
32
#include <sys/exec.h>
33
#include <sys/imgact.h>
34
#include <sys/imgact_elf.h>
35
#include <sys/kernel.h>
36
#include <sys/malloc.h>
37
#include <sys/eventhandler.h>
38
#include <sys/sysctl.h>
39
40
#include <compat/linux/linux_emul.h>
41
#include <compat/linux/linux_mib.h>
42
#include <compat/linux/linux_util.h>
43
44
FEATURE(linuxulator_v4l, "V4L ioctl wrapper support in the linuxulator");
45
FEATURE(linuxulator_v4l2, "V4L2 ioctl wrapper support in the linuxulator");
46
47
MODULE_VERSION(linux_common, 1);
48
49
SET_DECLARE(linux_device_handler_set, struct linux_device_handler);
50
51
static eventhandler_tag linux_exec_tag;
52
static eventhandler_tag linux_thread_dtor_tag;
53
static eventhandler_tag	linux_exit_tag;
54
55
56
static int
57
linux_common_modevent(module_t mod, int type, void *data)
58
{
59
	struct linux_device_handler **ldhp;
60
61
	switch(type) {
62
	case MOD_LOAD:
63
		linux_osd_jail_register();
64
		linux_exit_tag = EVENTHANDLER_REGISTER(process_exit,
65
		    linux_proc_exit, NULL, 1000);
66
		linux_exec_tag = EVENTHANDLER_REGISTER(process_exec,
67
		    linux_proc_exec, NULL, 1000);
68
		linux_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor,
69
		    linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY);
70
		SET_FOREACH(ldhp, linux_device_handler_set)
71
			linux_device_register_handler(*ldhp);
72
		break;
73
	case MOD_UNLOAD:
74
		linux_osd_jail_deregister();
75
		SET_FOREACH(ldhp, linux_device_handler_set)
76
			linux_device_unregister_handler(*ldhp);
77
		EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
78
		EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
79
		EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag);
80
		break;
81
	default:
82
		return (EOPNOTSUPP);
83
	}
84
	return (0);
85
}
86
87
static moduledata_t linux_common_mod = {
88
	"linuxcommon",
89
	linux_common_modevent,
90
	0
91
};
92
93
DECLARE_MODULE(linuxcommon, linux_common_mod, SI_SUB_EXEC, SI_ORDER_ANY);
(-)sys/compat/linux/linux_emul.c (-348 / +159 lines)
Lines 1-5 Link Here
1
/*-
1
/*-
2
 * Copyright (c) 2006 Roman Divacky
2
 * Copyright (c) 2006 Roman Divacky
3
 * Copyright (c) 2013 Dmitry Chagin
3
 * All rights reserved.
4
 * All rights reserved.
4
 *
5
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * Redistribution and use in source and binary forms, with or without
Lines 29-392 Link Here
29
#include <sys/cdefs.h>
30
#include <sys/cdefs.h>
30
__FBSDID("$FreeBSD$");
31
__FBSDID("$FreeBSD$");
31
32
32
#include "opt_compat.h"
33
#include "opt_kdtrace.h"
34
35
#include <sys/param.h>
33
#include <sys/param.h>
36
#include <sys/systm.h>
34
#include <sys/systm.h>
37
#include <sys/imgact.h>
35
#include <sys/imgact.h>
38
#include <sys/kernel.h>
36
#include <sys/kernel.h>
37
#include <sys/ktr.h>
39
#include <sys/lock.h>
38
#include <sys/lock.h>
40
#include <sys/malloc.h>
39
#include <sys/malloc.h>
41
#include <sys/mutex.h>
40
#include <sys/mutex.h>
42
#include <sys/sdt.h>
43
#include <sys/sx.h>
41
#include <sys/sx.h>
44
#include <sys/proc.h>
42
#include <sys/proc.h>
45
#include <sys/syscallsubr.h>
43
#include <sys/syscallsubr.h>
46
#include <sys/sysent.h>
44
#include <sys/sysent.h>
47
#include <sys/sysproto.h>
48
#include <sys/unistd.h>
49
45
50
#ifdef COMPAT_LINUX32
51
#include <machine/../linux32/linux.h>
52
#include <machine/../linux32/linux32_proto.h>
53
#else
54
#include <machine/../linux/linux.h>
55
#include <machine/../linux/linux_proto.h>
56
#endif
57
58
#include <compat/linux/linux_dtrace.h>
59
#include <compat/linux/linux_emul.h>
46
#include <compat/linux/linux_emul.h>
60
#include <compat/linux/linux_futex.h>
61
#include <compat/linux/linux_misc.h>
47
#include <compat/linux/linux_misc.h>
48
#include <compat/linux/linux_util.h>
62
49
63
/**
50
64
 * Special DTrace provider for the linuxulator.
51
/*
52
 * This returns reference to the thread emuldata entry (if found)
65
 *
53
 *
66
 * In this file we define the provider for the entire linuxulator. All
54
 * Hold PROC_LOCK when referencing emuldata from other threads.
67
 * modules (= files of the linuxulator) use it.
68
 *
69
 * We define a different name depending on the emulated bitsize, see
70
 * ../../<ARCH>/linux{,32}/linux.h, e.g.:
71
 *      native bitsize          = linuxulator
72
 *      amd64, 32bit emulation  = linuxulator32
73
 */
55
 */
74
LIN_SDT_PROVIDER_DEFINE(LINUX_DTRACE);
75
76
/**
77
 * Special DTrace module "locks", it covers some linuxulator internal
78
 * locks.
79
 */
80
LIN_SDT_PROBE_DEFINE1(locks, emul_lock, locked, "struct mtx *");
81
LIN_SDT_PROBE_DEFINE1(locks, emul_lock, unlock, "struct mtx *");
82
LIN_SDT_PROBE_DEFINE1(locks, emul_shared_rlock, locked, "struct sx *");
83
LIN_SDT_PROBE_DEFINE1(locks, emul_shared_rlock, unlock, "struct sx *");
84
LIN_SDT_PROBE_DEFINE1(locks, emul_shared_wlock, locked, "struct sx *");
85
LIN_SDT_PROBE_DEFINE1(locks, emul_shared_wlock, unlock, "struct sx *");
86
87
/**
88
 * DTrace probes in this module.
89
 */
90
LIN_SDT_PROBE_DEFINE2(emul, em_find, entry, "struct proc *", "int");
91
LIN_SDT_PROBE_DEFINE0(emul, em_find, return);
92
LIN_SDT_PROBE_DEFINE3(emul, proc_init, entry, "struct thread *", "pid_t",
93
    "int");
94
LIN_SDT_PROBE_DEFINE0(emul, proc_init, create_thread);
95
LIN_SDT_PROBE_DEFINE0(emul, proc_init, fork);
96
LIN_SDT_PROBE_DEFINE0(emul, proc_init, exec);
97
LIN_SDT_PROBE_DEFINE0(emul, proc_init, return);
98
LIN_SDT_PROBE_DEFINE1(emul, proc_exit, entry, "struct proc *");
99
LIN_SDT_PROBE_DEFINE0(emul, proc_exit, futex_failed);
100
LIN_SDT_PROBE_DEFINE3(emul, proc_exit, reparent, "pid_t", "pid_t",
101
    "struct proc *");
102
LIN_SDT_PROBE_DEFINE1(emul, proc_exit, child_clear_tid_error, "int");
103
LIN_SDT_PROBE_DEFINE0(emul, proc_exit, return);
104
LIN_SDT_PROBE_DEFINE2(emul, proc_exec, entry, "struct proc *",
105
    "struct image_params *");
106
LIN_SDT_PROBE_DEFINE0(emul, proc_exec, return);
107
LIN_SDT_PROBE_DEFINE0(emul, linux_schedtail, entry);
108
LIN_SDT_PROBE_DEFINE1(emul, linux_schedtail, copyout_error, "int");
109
LIN_SDT_PROBE_DEFINE0(emul, linux_schedtail, return);
110
LIN_SDT_PROBE_DEFINE1(emul, linux_set_tid_address, entry, "int *");
111
LIN_SDT_PROBE_DEFINE0(emul, linux_set_tid_address, return);
112
LIN_SDT_PROBE_DEFINE2(emul, linux_kill_threads, entry, "struct thread *",
113
    "int");
114
LIN_SDT_PROBE_DEFINE1(emul, linux_kill_threads, kill, "pid_t");
115
LIN_SDT_PROBE_DEFINE0(emul, linux_kill_threads, return);
116
117
struct sx	emul_shared_lock;
118
struct mtx	emul_lock;
119
120
/* this returns locked reference to the emuldata entry (if found) */
121
struct linux_emuldata *
56
struct linux_emuldata *
122
em_find(struct proc *p, int locked)
57
em_find(struct thread *td)
123
{
58
{
124
	struct linux_emuldata *em;
59
	struct linux_emuldata *em;
125
60
126
	LIN_SDT_PROBE2(emul, em_find, entry, p, locked);
61
	em = td->td_emuldata;
127
62
128
	if (locked == EMUL_DOLOCK)
63
	return (em);
129
		EMUL_LOCK(&emul_lock);
64
}
130
65
131
	em = p->p_emuldata;
66
/*
67
 * This returns reference to the proc pemuldata entry (if found)
68
 *
69
 * Hold PROC_LOCK when referencing proc pemuldata from other threads.
70
 * Hold LINUX_PEM_LOCK wher referencing pemuldata members.
71
 */
72
struct linux_pemuldata *
73
pem_find(struct proc *p)
74
{
75
	struct linux_pemuldata *pem;
132
76
133
	if (em == NULL && locked == EMUL_DOLOCK)
77
	pem = p->p_emuldata;
134
		EMUL_UNLOCK(&emul_lock);
135
78
136
	LIN_SDT_PROBE1(emul, em_find, return, em);
79
	return (pem);
137
	return (em);
138
}
80
}
139
81
140
int
82
void
141
linux_proc_init(struct thread *td, pid_t child, int flags)
83
linux_proc_init(struct thread *td, struct thread *newtd, int flags)
142
{
84
{
143
	struct linux_emuldata *em, *p_em;
85
	struct linux_emuldata *em;
86
	struct linux_pemuldata *pem;
87
	struct epoll_emuldata *emd;
144
	struct proc *p;
88
	struct proc *p;
145
89
146
	LIN_SDT_PROBE3(emul, proc_init, entry, td, child, flags);
90
	if (newtd != NULL) {
91
		p = newtd->td_proc;
147
92
148
	if (child != 0) {
93
		/* non-exec call */
149
		/* fork or create a thread */
94
		em = malloc(sizeof(*em), M_TEMP, M_WAITOK | M_ZERO);
150
		em = malloc(sizeof *em, M_LINUX, M_WAITOK | M_ZERO);
151
		em->pid = child;
152
		em->pdeath_signal = 0;
153
		em->flags = 0;
154
		em->robust_futexes = NULL;
155
		if (flags & LINUX_CLONE_THREAD) {
95
		if (flags & LINUX_CLONE_THREAD) {
156
			/* handled later in the code */
96
			LINUX_CTR1(proc_init, "thread newtd(%d)",
157
			LIN_SDT_PROBE0(emul, proc_init, create_thread);
97
			    newtd->td_tid);
98
99
			em->em_tid = newtd->td_tid;
158
		} else {
100
		} else {
159
			struct linux_emuldata_shared *s;
101
			LINUX_CTR1(proc_init, "fork newtd(%d)", p->p_pid);
160
102
161
			LIN_SDT_PROBE0(emul, proc_init, fork);
103
			em->em_tid = p->p_pid;
162
104
163
			s = malloc(sizeof *s, M_LINUX, M_WAITOK | M_ZERO);
105
			pem = malloc(sizeof(*pem), M_LINUX, M_WAITOK | M_ZERO);
164
			s->refs = 1;
106
			sx_init(&pem->pem_sx, "lpemlk");
165
			s->group_pid = child;
107
			p->p_emuldata = pem;
166
167
			LIST_INIT(&s->threads);
168
			em->shared = s;
169
		}
108
		}
109
		newtd->td_emuldata = em;
170
	} else {
110
	} else {
111
		p = td->td_proc;
112
171
		/* exec */
113
		/* exec */
172
		LIN_SDT_PROBE0(emul, proc_init, exec);
114
		LINUX_CTR1(proc_init, "exec newtd(%d)", p->p_pid);
173
115
174
		/* lookup the old one */
116
		/* lookup the old one */
175
		em = em_find(td->td_proc, EMUL_DOLOCK);
117
		em = em_find(td);
176
		KASSERT(em != NULL, ("proc_init: emuldata not found in exec case.\n"));
118
		KASSERT(em != NULL, ("proc_init: emuldata not found in exec case.\n"));
177
	}
178
119
179
	em->child_clear_tid = NULL;
120
		em->em_tid = p->p_pid;
180
	em->child_set_tid = NULL;
121
		em->flags = 0;
122
		em->pdeath_signal = 0;
123
		em->robust_futexes = NULL;
124
		em->child_clear_tid = NULL;
125
		em->child_set_tid = NULL;
181
126
182
	/*
127
		 /* epoll should be destroyed in a case of exec. */
183
	 * allocate the shared struct only in clone()/fork cases in the case
128
		pem = pem_find(p);
184
	 * of clone() td = calling proc and child = pid of the newly created
129
		KASSERT(pem != NULL, ("proc_exit: proc emuldata not found.\n"));
185
	 * proc
130
186
	 */
131
		if (pem->epoll != NULL) {
187
	if (child != 0) {
132
			emd = pem->epoll;
188
		if (flags & LINUX_CLONE_THREAD) {
133
			pem->epoll = NULL;
189
			/* lookup the parent */
134
			free(emd, M_EPOLL);
190
			/* 
191
			 * we dont have to lock the p_em because
192
			 * its waiting for us in linux_clone so
193
			 * there is no chance of it changing the
194
			 * p_em->shared address
195
			 */
196
			p_em = em_find(td->td_proc, EMUL_DONTLOCK);
197
			KASSERT(p_em != NULL, ("proc_init: parent emuldata not found for CLONE_THREAD\n"));
198
			em->shared = p_em->shared;
199
			EMUL_SHARED_WLOCK(&emul_shared_lock);
200
			em->shared->refs++;
201
			EMUL_SHARED_WUNLOCK(&emul_shared_lock);
202
		} else {
203
			/*
204
			 * handled earlier to avoid malloc(M_WAITOK) with
205
			 * rwlock held
206
			 */
207
		}
135
		}
136
	}
208
137
209
		EMUL_SHARED_WLOCK(&emul_shared_lock);
210
		LIST_INSERT_HEAD(&em->shared->threads, em, threads);
211
		EMUL_SHARED_WUNLOCK(&emul_shared_lock);
212
213
		p = pfind(child);
214
		KASSERT(p != NULL, ("process not found in proc_init\n"));
215
		p->p_emuldata = em;
216
		PROC_UNLOCK(p);
217
	} else
218
		EMUL_UNLOCK(&emul_lock);
219
220
	LIN_SDT_PROBE0(emul, proc_init, return);
221
	return (0);
222
}
138
}
223
139
224
void
140
void 
225
linux_proc_exit(void *arg __unused, struct proc *p)
141
linux_proc_exit(void *arg __unused, struct proc *p)
226
{
142
{
227
	struct linux_emuldata *em;
143
	struct linux_pemuldata *pem;
228
	int error, shared_flags, shared_xstat;
144
	struct epoll_emuldata *emd;
229
	struct thread *td = FIRST_THREAD_IN_PROC(p);
145
	struct thread *td = curthread;
230
	int *child_clear_tid;
231
	struct proc *q, *nq;
232
146
233
	if (__predict_true(p->p_sysent != &elf_linux_sysvec))
147
	if (__predict_false(SV_CURPROC_ABI() != SV_ABI_LINUX))
234
		return;
148
		return;
235
149
236
	LIN_SDT_PROBE1(emul, proc_exit, entry, p);
150
	LINUX_CTR3(proc_exit, "thread(%d) proc(%d) p %p",
151
	    td->td_tid, p->p_pid, p);
237
152
238
	release_futexes(p);
153
	pem = pem_find(p);
154
	if (pem == NULL)
155
		return;	
156
	(p->p_sysent->sv_thread_detach)(td);
239
157
240
	/* find the emuldata */
158
	p->p_emuldata = NULL;
241
	em = em_find(p, EMUL_DOLOCK);
242
159
243
	KASSERT(em != NULL, ("proc_exit: emuldata not found.\n"));
160
	if (pem->epoll != NULL) {
244
161
		emd = pem->epoll;
245
	/* reparent all procs that are not a thread leader to initproc */
162
		pem->epoll = NULL;
246
	if (em->shared->group_pid != p->p_pid) {
163
		free(emd, M_EPOLL);
247
		LIN_SDT_PROBE3(emul, proc_exit, reparent,
248
		    em->shared->group_pid, p->p_pid, p);
249
250
		child_clear_tid = em->child_clear_tid;
251
		EMUL_UNLOCK(&emul_lock);
252
		sx_xlock(&proctree_lock);
253
		wakeup(initproc);
254
		PROC_LOCK(p);
255
		proc_reparent(p, initproc);
256
		p->p_sigparent = SIGCHLD;
257
		PROC_UNLOCK(p);
258
		sx_xunlock(&proctree_lock);
259
	} else {
260
		child_clear_tid = em->child_clear_tid;
261
		EMUL_UNLOCK(&emul_lock);	
262
	}
164
	}
263
165
264
	EMUL_SHARED_WLOCK(&emul_shared_lock);
166
	sx_destroy(&pem->pem_sx);
265
	shared_flags = em->shared->flags;
167
	free(pem, M_LINUX);
266
	shared_xstat = em->shared->xstat;
168
}
267
	LIST_REMOVE(em, threads);
268
169
269
	em->shared->refs--;
170
int 
270
	if (em->shared->refs == 0) {
171
linux_common_execve(struct thread *td, struct image_args *eargs)
271
		EMUL_SHARED_WUNLOCK(&emul_shared_lock);
172
{
272
		free(em->shared, M_LINUX);
173
	struct linux_pemuldata *pem;
273
	} else	
174
	struct epoll_emuldata *emd;
274
		EMUL_SHARED_WUNLOCK(&emul_shared_lock);
175
	struct vmspace *oldvmspace;
176
	struct linux_emuldata *em;
177
	struct proc *p;
178
	int error;
275
179
276
	if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0)
180
	p = td->td_proc;
277
		p->p_xstat = shared_xstat;
278
181
279
	if (child_clear_tid != NULL) {
182
	error = pre_execve(td, &oldvmspace);
280
		struct linux_sys_futex_args cup;
183
	if (error != 0)
281
		int null = 0;
184
		return (error);
282
185
283
		error = copyout(&null, child_clear_tid, sizeof(null));
186
	error = kern_execve(td, eargs, NULL);
284
		if (error) {
187
	post_execve(td, error, oldvmspace);
285
			LIN_SDT_PROBE1(emul, proc_exit,
188
	if (error != 0)
286
			    child_clear_tid_error, error);
189
		return (error);
287
190
288
			free(em, M_LINUX);
191
	/*
192
	 * In a case of transition from Linux binary execing to
193
	 * FreeBSD binary we destroy linux emuldata thread & proc entries.
194
	 */
195
	if (SV_CURPROC_ABI() != SV_ABI_LINUX) {
196
		PROC_LOCK(p);
197
		em = em_find(td);
198
		KASSERT(em != NULL, ("proc_exec: thread emuldata not found.\n"));
199
		td->td_emuldata = NULL;
289
200
290
			LIN_SDT_PROBE0(emul, proc_exit, return);
201
		pem = pem_find(p);
291
			return;
202
		KASSERT(pem != NULL, ("proc_exec: proc pemuldata not found.\n"));
292
		}
203
		p->p_emuldata = NULL;
204
		PROC_UNLOCK(p);
293
205
294
		/* futexes stuff */
206
		if (pem->epoll != NULL) {
295
		cup.uaddr = child_clear_tid;
207
			emd = pem->epoll;
296
		cup.op = LINUX_FUTEX_WAKE;
208
			pem->epoll = NULL;
297
		cup.val = 0x7fffffff;	/* Awake everyone */
209
			free(emd, M_EPOLL);
298
		cup.timeout = NULL;
299
		cup.uaddr2 = NULL;
300
		cup.val3 = 0;
301
		error = linux_sys_futex(FIRST_THREAD_IN_PROC(p), &cup);
302
		/*
303
		 * this cannot happen at the moment and if this happens it
304
		 * probably means there is a user space bug
305
		 */
306
		if (error) {
307
			LIN_SDT_PROBE0(emul, proc_exit, futex_failed);
308
			printf(LMSG("futex stuff in proc_exit failed.\n"));
309
		}
210
		}
310
	}
311
211
312
	/* clean the stuff up */
212
		free(em, M_TEMP);
313
	free(em, M_LINUX);
213
		free(pem, M_LINUX);
314
315
	/* this is a little weird but rewritten from exit1() */
316
	sx_xlock(&proctree_lock);
317
	q = LIST_FIRST(&p->p_children);
318
	for (; q != NULL; q = nq) {
319
		nq = LIST_NEXT(q, p_sibling);
320
		if (q->p_flag & P_WEXIT)
321
			continue;
322
		if (__predict_false(q->p_sysent != &elf_linux_sysvec))
323
			continue;
324
		em = em_find(q, EMUL_DOLOCK);
325
		KASSERT(em != NULL, ("linux_reparent: emuldata not found: %i\n", q->p_pid));
326
		PROC_LOCK(q);
327
		if ((q->p_flag & P_WEXIT) == 0 && em->pdeath_signal != 0) {
328
			kern_psignal(q, em->pdeath_signal);
329
		}
330
		PROC_UNLOCK(q);
331
		EMUL_UNLOCK(&emul_lock);
332
	}
214
	}
333
	sx_xunlock(&proctree_lock);
215
	return (0);
334
335
	LIN_SDT_PROBE0(emul, proc_exit, return);
336
}
216
}
337
217
338
/*
339
 * This is used in a case of transition from FreeBSD binary execing to linux binary
340
 * in this case we create linux emuldata proc entry with the pid of the currently running
341
 * process.
342
 */
343
void 
218
void 
344
linux_proc_exec(void *arg __unused, struct proc *p, struct image_params *imgp)
219
linux_proc_exec(void *arg __unused, struct proc *p, struct image_params *imgp)
345
{
220
{
346
	if (__predict_false(imgp->sysent == &elf_linux_sysvec)) {
221
	struct thread *td = curthread;
347
		LIN_SDT_PROBE2(emul, proc_exec, entry, p, imgp);
222
	struct thread *othertd;
223
224
	/*
225
	 * In a case of execing from linux binary properly detach
226
	 * other threads from the user space.
227
	 */
228
	if (__predict_false(SV_PROC_ABI(p) == SV_ABI_LINUX)) {
229
		FOREACH_THREAD_IN_PROC(p, othertd) {
230
			if (td != othertd)
231
				(p->p_sysent->sv_thread_detach)(othertd);
232
		}
348
	}
233
	}
349
	if (__predict_false(imgp->sysent == &elf_linux_sysvec
350
	    && p->p_sysent != &elf_linux_sysvec))
351
		linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0);
352
	if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) ==
353
	    SV_ABI_LINUX))
354
		/* Kill threads regardless of imgp->sysent value */
355
		linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL);
356
	if (__predict_false(imgp->sysent != &elf_linux_sysvec
357
	    && p->p_sysent == &elf_linux_sysvec)) {
358
		struct linux_emuldata *em;
359
234
360
		/* 
235
	/*
361
		 * XXX:There's a race because here we assign p->p_emuldata NULL
236
	 * In a case of execing to linux binary we create linux
362
		 * but the process is still counted as linux one for a short
237
	 * emuldata thread entry.
363
 		 * time so some other process might reference it and try to
238
	 */
364
 		 * access its p->p_emuldata and panicing on a NULL reference.
239
	if (__predict_false((imgp->sysent->sv_flags & SV_ABI_MASK) ==
365
		 */
240
	    SV_ABI_LINUX)) {
366
		em = em_find(p, EMUL_DONTLOCK);
367
241
368
		KASSERT(em != NULL, ("proc_exec: emuldata not found.\n"));
242
		if (SV_PROC_ABI(p) == SV_ABI_LINUX)
243
			linux_proc_init(td, NULL, 0);
244
		else
245
			linux_proc_init(td, td, 0);
246
	}
247
}
369
248
370
		EMUL_SHARED_WLOCK(&emul_shared_lock);
249
void
371
		LIST_REMOVE(em, threads);
250
linux_thread_dtor(void *arg __unused, struct thread *td)
251
{
252
	struct linux_emuldata *em;
372
253
373
		PROC_LOCK(p);
254
	em = em_find(td);
374
		p->p_emuldata = NULL;
255
	if (em == NULL)
375
		PROC_UNLOCK(p);
256
		return;
257
	td->td_emuldata = NULL;
376
258
377
		em->shared->refs--;
259
	LINUX_CTR1(thread_dtor, "thread(%d)", em->em_tid);
378
		if (em->shared->refs == 0) {
379
			EMUL_SHARED_WUNLOCK(&emul_shared_lock);
380
			free(em->shared, M_LINUX);
381
		} else
382
			EMUL_SHARED_WUNLOCK(&emul_shared_lock);
383
260
384
		free(em, M_LINUX);
261
	free(em, M_TEMP);
385
	}
386
387
	if (__predict_false(imgp->sysent == &elf_linux_sysvec)) {
388
		LIN_SDT_PROBE0(emul, proc_exec, return);
389
	}
390
}
262
}
391
263
392
void
264
void
Lines 399-474 Link Here
399
271
400
	p = td->td_proc;
272
	p = td->td_proc;
401
273
402
	LIN_SDT_PROBE1(emul, linux_schedtail, entry, p);
274
	em = em_find(td);
403
275
	KASSERT(em != NULL, ("linux_schedtail: thread emuldata not found.\n"));
404
	/* find the emuldata */
405
	em = em_find(p, EMUL_DOLOCK);
406
407
	KASSERT(em != NULL, ("linux_schedtail: emuldata not found.\n"));
408
	child_set_tid = em->child_set_tid;
276
	child_set_tid = em->child_set_tid;
409
	EMUL_UNLOCK(&emul_lock);
410
277
411
	if (child_set_tid != NULL) {
278
	if (child_set_tid != NULL) {
412
		error = copyout(&p->p_pid, (int *)child_set_tid,
279
		error = copyout(&em->em_tid, child_set_tid,
413
		    sizeof(p->p_pid));
280
		    sizeof(em->em_tid));
414
281
		LINUX_CTR4(schedtail, "thread(%d) %p stored %d error %d",
415
		if (error != 0) {
282
		    td->td_tid, child_set_tid, em->em_tid, error);
416
			LIN_SDT_PROBE1(emul, linux_schedtail, copyout_error,
283
	} else
417
			    error);
284
		LINUX_CTR1(schedtail, "thread(%d)", em->em_tid);
418
		}
419
	}
420
421
	LIN_SDT_PROBE0(emul, linux_schedtail, return);
422
423
	return;
424
}
285
}
425
426
int
427
linux_set_tid_address(struct thread *td, struct linux_set_tid_address_args *args)
428
{
429
	struct linux_emuldata *em;
430
431
	LIN_SDT_PROBE1(emul, linux_set_tid_address, entry, args->tidptr);
432
433
	/* find the emuldata */
434
	em = em_find(td->td_proc, EMUL_DOLOCK);
435
436
	KASSERT(em != NULL, ("set_tid_address: emuldata not found.\n"));
437
438
	em->child_clear_tid = args->tidptr;
439
	td->td_retval[0] = td->td_proc->p_pid;
440
441
	EMUL_UNLOCK(&emul_lock);
442
443
	LIN_SDT_PROBE0(emul, linux_set_tid_address, return);
444
	return 0;
445
}
446
447
void
448
linux_kill_threads(struct thread *td, int sig)
449
{
450
	struct linux_emuldata *em, *td_em, *tmp_em;
451
	struct proc *sp;
452
453
	LIN_SDT_PROBE2(emul, linux_kill_threads, entry, td, sig);
454
455
	td_em = em_find(td->td_proc, EMUL_DONTLOCK);
456
457
	KASSERT(td_em != NULL, ("linux_kill_threads: emuldata not found.\n"));
458
459
	EMUL_SHARED_RLOCK(&emul_shared_lock);
460
	LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) {
461
		if (em->pid == td_em->pid)
462
			continue;
463
464
		sp = pfind(em->pid);
465
		if ((sp->p_flag & P_WEXIT) == 0)
466
			kern_psignal(sp, sig);
467
		PROC_UNLOCK(sp);
468
469
		LIN_SDT_PROBE1(emul, linux_kill_threads, kill, em->pid);
470
	}
471
	EMUL_SHARED_RUNLOCK(&emul_shared_lock);
472
473
	LIN_SDT_PROBE0(emul, linux_kill_threads, return);
474
}
(-)sys/compat/linux/linux_emul.h (-66 / +26 lines)
Lines 1-5 Link Here
1
/*-
1
/*-
2
 * Copyright (c) 2006 Roman Divacky
2
 * Copyright (c) 2006 Roman Divacky
3
 * Copyright (c) 2013 Dmitry Chagin
3
 * All rights reserved.
4
 * All rights reserved.
4
 *
5
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * Redistribution and use in source and binary forms, with or without
Lines 31-121 Link Here
31
#ifndef _LINUX_EMUL_H_
32
#ifndef _LINUX_EMUL_H_
32
#define	_LINUX_EMUL_H_
33
#define	_LINUX_EMUL_H_
33
34
34
#define EMUL_SHARED_HASXSTAT	0x01
35
36
struct linux_emuldata_shared {
37
	int	refs;
38
	int	flags;
39
	int	xstat;
40
	pid_t	group_pid;
41
42
	LIST_HEAD(, linux_emuldata) threads; /* head of list of linux threads */
43
};
44
45
/*
35
/*
46
 * modeled after similar structure in NetBSD
36
 * modeled after similar structure in NetBSD
47
 * this will be extended as we need more functionality
37
 * this will be extended as we need more functionality
48
 */
38
 */
49
struct linux_emuldata {
39
struct linux_emuldata {
50
	pid_t	pid;
51
52
	int    *child_set_tid;	/* in clone(): Child's TID to set on clone */
40
	int    *child_set_tid;	/* in clone(): Child's TID to set on clone */
53
	int    *child_clear_tid;/* in clone(): Child's TID to clear on exit */
41
	int    *child_clear_tid;/* in clone(): Child's TID to clear on exit */
54
42
55
	struct linux_emuldata_shared *shared;
56
57
	int	pdeath_signal;		/* parent death signal */
43
	int	pdeath_signal;		/* parent death signal */
58
	int	flags;			/* different emuldata flags */
44
	int	flags;			/* thread emuldata flags */
45
	int	em_tid;			/* thread id */
59
46
60
	struct	linux_robust_list_head	*robust_futexes;
47
	struct	linux_robust_list_head	*robust_futexes;
61
62
	LIST_ENTRY(linux_emuldata) threads;	/* list of linux threads */
63
};
48
};
64
49
65
struct linux_emuldata	*em_find(struct proc *, int locked);
50
struct linux_emuldata	*em_find(struct thread *);
66
51
67
/*
52
/* thread emuldata flags */
68
 * DTrace probes for locks should be fired after locking and before releasing
53
#define	LINUX_THREAD_DETACHED	0x00000002
69
 * to prevent races (to provide data/function stability in dtrace, see the
70
 * output of "dtrace -v ..." and the corresponding dtrace docs).
71
 */
72
#define	EMUL_LOCK(l)		do { \
73
				    mtx_lock(l); \
74
				    LIN_SDT_PROBE1(locks, emul_lock, \
75
					locked, l); \
76
				} while (0)
77
#define	EMUL_UNLOCK(l)		do { \
78
				    LIN_SDT_PROBE1(locks, emul_lock, \
79
					unlock, l); \
80
				    mtx_unlock(l); \
81
				} while (0)
82
54
83
#define	EMUL_SHARED_RLOCK(l)	do { \
55
void	linux_proc_init(struct thread *, struct thread *, int);
84
				    sx_slock(l); \
56
void	linux_proc_exit(void *, struct proc *);
85
				    LIN_SDT_PROBE1(locks, emul_shared_rlock, \
57
void	linux_schedtail(struct thread *);
86
					locked, l); \
58
void	linux_proc_exec(void *, struct proc *, struct image_params *);
87
				} while (0)
59
void	linux_thread_dtor(void *arg __unused, struct thread *);
88
#define	EMUL_SHARED_RUNLOCK(l)	do { \
60
void	linux_thread_detach(struct thread *);
89
				    LIN_SDT_PROBE1(locks, emul_shared_rlock, \
61
int	linux_common_execve(struct thread *, struct image_args *);
90
					unlock, l); \
91
				    sx_sunlock(l); \
92
				} while (0)
93
#define	EMUL_SHARED_WLOCK(l)	do { \
94
				    sx_xlock(l); \
95
				    LIN_SDT_PROBE1(locks, emul_shared_wlock, \
96
					locked, l); \
97
				} while (0)
98
#define	EMUL_SHARED_WUNLOCK(l)	do { \
99
				    LIN_SDT_PROBE1(locks, emul_shared_wlock, \
100
					unlock, l); \
101
				    sx_xunlock(l); \
102
				} while (0)
103
62
104
/* for em_find use */
63
/* process emuldata flags */
105
#define	EMUL_DOLOCK		1
106
#define	EMUL_DONTLOCK		0
107
108
/* emuldata flags */
109
#define	LINUX_XDEPR_REQUEUEOP	0x00000001	/* uses deprecated
64
#define	LINUX_XDEPR_REQUEUEOP	0x00000001	/* uses deprecated
110
						   futex REQUEUE op*/
65
						   futex REQUEUE op*/
66
#define	LINUX_XUNSUP_EPOLL	0x00000002	/* unsupported epoll events */
111
67
112
int	linux_proc_init(struct thread *, pid_t, int);
68
struct linux_pemuldata {
113
void	linux_proc_exit(void *, struct proc *);
69
	uint32_t	flags;		/* process emuldata flags */
114
void	linux_schedtail(struct thread *);
70
	struct sx	pem_sx;		/* lock for this struct */
115
void	linux_proc_exec(void *, struct proc *, struct image_params *);
71
	void		*epoll;		/* epoll data */
116
void	linux_kill_threads(struct thread *, int);
72
};
117
73
118
extern struct sx	emul_shared_lock;
74
#define	LINUX_PEM_XLOCK(p)	sx_xlock(&(p)->pem_sx)
119
extern struct mtx	emul_lock;
75
#define	LINUX_PEM_XUNLOCK(p)	sx_xunlock(&(p)->pem_sx)
76
#define	LINUX_PEM_SLOCK(p)	sx_slock(&(p)->pem_sx)
77
#define	LINUX_PEM_SUNLOCK(p)	sx_sunlock(&(p)->pem_sx)
120
78
79
struct linux_pemuldata	*pem_find(struct proc *);
80
121
#endif	/* !_LINUX_EMUL_H_ */
81
#endif	/* !_LINUX_EMUL_H_ */
(-)sys/compat/linux/linux_event.c (+883 lines)
Line 0 Link Here
1
/*-
2
 * Copyright (c) 2007 Roman Divacky
3
 * Copyright (c) 2014 Dmitry Chagin
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
 * 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
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
 * SUCH DAMAGE.
26
 */
27
28
#include <sys/cdefs.h>
29
__FBSDID("$FreeBSD$");
30
31
#include "opt_compat.h"
32
33
#include <sys/param.h>
34
#include <sys/systm.h>
35
#include <sys/imgact.h>
36
#include <sys/kernel.h>
37
#include <sys/limits.h>
38
#include <sys/lock.h>
39
#include <sys/mutex.h>
40
#include <sys/capability.h>
41
#include <sys/types.h>
42
#include <sys/user.h>
43
#include <sys/file.h>
44
#include <sys/filedesc.h>
45
#include <sys/errno.h>
46
#include <sys/event.h>
47
#include <sys/poll.h>
48
#include <sys/proc.h>
49
#include <sys/selinfo.h>
50
#include <sys/sx.h>
51
#include <sys/syscallsubr.h>
52
#include <sys/timespec.h>
53
54
#ifdef COMPAT_LINUX32
55
#include <machine/../linux32/linux.h>
56
#include <machine/../linux32/linux32_proto.h>
57
#else
58
#include <machine/../linux/linux.h>
59
#include <machine/../linux/linux_proto.h>
60
#endif
61
62
#include <compat/linux/linux_emul.h>
63
#include <compat/linux/linux_event.h>
64
#include <compat/linux/linux_file.h>
65
#include <compat/linux/linux_util.h>
66
67
/*
68
 * epoll defines 'struct epoll_event' with the field 'data' as 64 bits
69
 * on all architectures. But on 32 bit architectures BSD 'struct kevent' only
70
 * has 32 bit opaque pointer as 'udata' field. So we can't pass epoll supplied
71
 * data verbatuim. Therefore we allocate 64-bit memory block to pass
72
 * user supplied data for every file descriptor.
73
 */
74
75
typedef uint64_t	epoll_udata_t;
76
77
struct epoll_emuldata {
78
	uint32_t	fdc;		/* epoll udata max index */
79
	epoll_udata_t	udata[1];	/* epoll user data vector */
80
};
81
82
#define	EPOLL_DEF_SZ		16
83
#define	EPOLL_SIZE(fdn)			\
84
	(sizeof(struct epoll_emuldata)+(fdn) * sizeof(epoll_udata_t))
85
86
struct epoll_event {
87
	uint32_t	events;
88
	epoll_udata_t	data;
89
}
90
#if defined(__amd64__)
91
__attribute__((packed))
92
#endif
93
;
94
95
#define	LINUX_MAX_EVENTS	(INT_MAX / sizeof(struct epoll_event))
96
97
static void	epoll_fd_install(struct thread *td, int fd, epoll_udata_t udata);
98
static int	epoll_to_kevent(struct thread *td, struct file *epfp,
99
		    int fd, struct epoll_event *l_event, int *kev_flags,
100
		    struct kevent *kevent, int *nkevents);
101
static void	kevent_to_epoll(struct kevent *kevent, struct epoll_event *l_event);
102
static int	epoll_kev_copyout(void *arg, struct kevent *kevp, int count);
103
static int	epoll_kev_copyin(void *arg, struct kevent *kevp, int count);
104
static int	epoll_delete_event(struct thread *td, struct file *epfp,
105
		    int fd, int filter);
106
static int	epoll_delete_all_events(struct thread *td, struct file *epfp,
107
		    int fd);
108
109
struct epoll_copyin_args {
110
	struct kevent	*changelist;
111
};
112
113
struct epoll_copyout_args {
114
	struct epoll_event	*leventlist;
115
	struct proc		*p;
116
	uint32_t		count;
117
	int			error;
118
};
119
120
/* eventfd */
121
typedef uint64_t	eventfd_t;
122
123
static fo_rdwr_t	eventfd_read;
124
static fo_rdwr_t	eventfd_write;
125
static fo_truncate_t	eventfd_truncate;
126
static fo_ioctl_t	eventfd_ioctl;
127
static fo_poll_t	eventfd_poll;
128
static fo_kqfilter_t	eventfd_kqfilter;
129
static fo_stat_t	eventfd_stat;
130
static fo_close_t	eventfd_close;
131
132
static struct fileops eventfdops = {
133
	.fo_read = eventfd_read,
134
	.fo_write = eventfd_write,
135
	.fo_truncate = eventfd_truncate,
136
	.fo_ioctl = eventfd_ioctl,
137
	.fo_poll = eventfd_poll,
138
	.fo_kqfilter = eventfd_kqfilter,
139
	.fo_stat = eventfd_stat,
140
	.fo_close = eventfd_close,
141
	.fo_chmod = invfo_chmod,
142
	.fo_chown = invfo_chown,
143
	.fo_sendfile = invfo_sendfile,
144
	.fo_flags = DFLAG_PASSABLE
145
};
146
147
static void	filt_eventfddetach(struct knote *kn);
148
static int	filt_eventfdread(struct knote *kn, long hint);
149
static int	filt_eventfdwrite(struct knote *kn, long hint);
150
151
static struct filterops eventfd_rfiltops = {
152
	.f_isfd = 1,
153
	.f_detach = filt_eventfddetach,
154
	.f_event = filt_eventfdread
155
};
156
static struct filterops eventfd_wfiltops = {
157
	.f_isfd = 1,
158
	.f_detach = filt_eventfddetach,
159
	.f_event = filt_eventfdwrite
160
};
161
162
struct eventfd {
163
	eventfd_t	efd_count;
164
	uint32_t	efd_flags;
165
	struct selinfo	efd_sel;
166
	struct mtx	efd_lock;
167
};
168
169
static int	eventfd_create(struct thread *td, uint32_t initval, int flags);
170
171
172
static void
173
epoll_fd_install(struct thread *td, int fd, epoll_udata_t udata)
174
{
175
	struct linux_pemuldata *pem;
176
	struct epoll_emuldata *emd;
177
	struct proc *p;
178
179
	p = td->td_proc;
180
181
	pem = pem_find(p);
182
	KASSERT(pem != NULL, ("epoll proc emuldata not found.\n"));
183
184
	LINUX_PEM_XLOCK(pem);
185
	if (pem->epoll == NULL) {
186
		emd = malloc(EPOLL_SIZE(fd), M_EPOLL, M_WAITOK);
187
		emd->fdc = fd;
188
		pem->epoll = emd;
189
	} else {
190
		emd = pem->epoll;
191
		if (fd > emd->fdc) {
192
			emd = realloc(emd, EPOLL_SIZE(fd), M_EPOLL, M_WAITOK);
193
			emd->fdc = fd;
194
			pem->epoll = emd;
195
		}
196
	}
197
	emd->udata[fd] = udata;
198
	LINUX_PEM_XUNLOCK(pem);
199
}
200
201
static int
202
epoll_create_common(struct thread *td, int flags)
203
{
204
	int error;
205
206
	error = kern_kqueue(td, flags);
207
	if (error)
208
		return (error);
209
210
	epoll_fd_install(td, EPOLL_DEF_SZ, 0);
211
212
	return (0);
213
}
214
215
int
216
linux_epoll_create(struct thread *td, struct linux_epoll_create_args *args)
217
{
218
219
	/*
220
	 * args->size is unused. Linux just tests it
221
	 * and then forgets it as well.
222
	 */
223
	if (args->size <= 0)
224
		return (EINVAL);
225
226
	return (epoll_create_common(td, 0));
227
}
228
229
int
230
linux_epoll_create1(struct thread *td, struct linux_epoll_create1_args *args)
231
{
232
	int flags;
233
234
	if ((args->flags & ~(LINUX_O_CLOEXEC)) != 0)
235
		return (EINVAL);
236
237
	flags = 0;
238
	if ((args->flags & LINUX_O_CLOEXEC) != 0)
239
		flags |= O_CLOEXEC;
240
241
	return (epoll_create_common(td, flags));
242
}
243
244
/* Structure converting function from epoll to kevent. */
245
static int
246
epoll_to_kevent(struct thread *td, struct file *epfp,
247
    int fd, struct epoll_event *l_event, int *kev_flags,
248
    struct kevent *kevent, int *nkevents)
249
{
250
	uint32_t levents = l_event->events;
251
	struct linux_pemuldata *pem;
252
	struct proc *p;
253
254
	/* flags related to how event is registered */
255
	if ((levents & LINUX_EPOLLONESHOT) != 0)
256
		*kev_flags |= EV_ONESHOT;
257
	if ((levents & LINUX_EPOLLET) != 0)
258
		*kev_flags |= EV_CLEAR;
259
	if ((levents & LINUX_EPOLLERR) != 0)
260
		*kev_flags |= EV_ERROR;
261
	if ((levents & LINUX_EPOLLRDHUP) != 0)
262
		*kev_flags |= EV_EOF;
263
264
	/* flags related to what event is registered */
265
	if ((levents & LINUX_EPOLL_EVRD) != 0) {
266
		EV_SET(kevent++, fd, EVFILT_READ, *kev_flags, 0, 0, 0);
267
		++(*nkevents);
268
	}
269
	if ((levents & LINUX_EPOLL_EVWR) != 0) {
270
		EV_SET(kevent++, fd, EVFILT_WRITE, *kev_flags, 0, 0, 0);
271
		++(*nkevents);
272
	}
273
274
	if ((levents & ~(LINUX_EPOLL_EVSUP)) != 0) {
275
		p = td->td_proc;
276
277
		pem = pem_find(p);
278
		KASSERT(pem != NULL, ("epoll proc emuldata not found.\n"));
279
		KASSERT(pem->epoll != NULL, ("epoll proc epolldata not found.\n"));
280
281
		LINUX_PEM_XLOCK(pem);
282
		if ((pem->flags & LINUX_XUNSUP_EPOLL) == 0) {
283
			pem->flags |= LINUX_XUNSUP_EPOLL;
284
			LINUX_PEM_XUNLOCK(pem);
285
			linux_msg(td, "epoll_ctl unsupported flags: 0x%x\n",
286
			    levents);
287
		} else
288
			LINUX_PEM_XUNLOCK(pem);
289
		return (EINVAL);
290
	}
291
292
	return (0);
293
}
294
295
/* 
296
 * Structure converting function from kevent to epoll. In a case
297
 * this is called on error in registration we store the error in
298
 * event->data and pick it up later in linux_epoll_ctl().
299
 */
300
static void
301
kevent_to_epoll(struct kevent *kevent, struct epoll_event *l_event)
302
{
303
304
	if ((kevent->flags & EV_ERROR) != 0) {
305
		l_event->events = LINUX_EPOLLERR;
306
		return;
307
	}
308
309
	switch (kevent->filter) {
310
	case EVFILT_READ:
311
		l_event->events = LINUX_EPOLLIN|LINUX_EPOLLRDNORM|LINUX_EPOLLPRI;
312
		if ((kevent->flags & EV_EOF) != 0)
313
			l_event->events |= LINUX_EPOLLRDHUP;
314
	break;
315
	case EVFILT_WRITE:
316
		l_event->events = LINUX_EPOLLOUT|LINUX_EPOLLWRNORM;
317
	break;
318
	}
319
}
320
321
/* 
322
 * Copyout callback used by kevent. This converts kevent
323
 * events to epoll events and copies them back to the
324
 * userspace. This is also called on error on registering
325
 * of the filter.
326
 */
327
static int
328
epoll_kev_copyout(void *arg, struct kevent *kevp, int count)
329
{
330
	struct epoll_copyout_args *args;
331
	struct linux_pemuldata *pem;
332
	struct epoll_emuldata *emd;
333
	struct epoll_event *eep;
334
	int error, fd, i;
335
336
	args = (struct epoll_copyout_args*) arg;
337
	eep = malloc(sizeof(*eep) * count, M_EPOLL, M_WAITOK | M_ZERO);
338
339
	pem = pem_find(args->p);
340
	KASSERT(pem != NULL, ("epoll proc emuldata not found.\n"));
341
	LINUX_PEM_SLOCK(pem);
342
	emd = pem->epoll;
343
	KASSERT(emd != NULL, ("epoll proc epolldata not found.\n"));
344
345
	for (i = 0; i < count; i++) {
346
		kevent_to_epoll(&kevp[i], &eep[i]);
347
348
		fd = kevp[i].ident;
349
		KASSERT(fd <= emd->fdc, ("epoll user data vector"
350
						    " is too small.\n"));
351
		eep[i].data = emd->udata[fd];
352
	}
353
	LINUX_PEM_SUNLOCK(pem);
354
355
	error = copyout(eep, args->leventlist, count * sizeof(*eep));
356
	if (error == 0) {
357
		args->leventlist += count;
358
		args->count += count;
359
	} else if (args->error == 0)
360
		args->error = error;
361
362
	free(eep, M_EPOLL);
363
	return (error);
364
}
365
366
/*
367
 * Copyin callback used by kevent. This copies already
368
 * converted filters from kernel memory to the kevent 
369
 * internal kernel memory. Hence the memcpy instead of
370
 * copyin.
371
 */
372
static int
373
epoll_kev_copyin(void *arg, struct kevent *kevp, int count)
374
{
375
	struct epoll_copyin_args *args;
376
377
	args = (struct epoll_copyin_args*) arg;
378
	
379
	memcpy(kevp, args->changelist, count * sizeof(*kevp));
380
	args->changelist += count;
381
382
	return (0);
383
}
384
385
/*
386
 * Load epoll filter, convert it to kevent filter
387
 * and load it into kevent subsystem.
388
 */
389
int
390
linux_epoll_ctl(struct thread *td, struct linux_epoll_ctl_args *args)
391
{
392
	struct file *epfp, *fp;
393
	struct epoll_copyin_args ciargs;
394
	struct kevent kev[2];
395
	struct kevent_copyops k_ops = { &ciargs,
396
					NULL,
397
					epoll_kev_copyin};
398
	struct epoll_event le;
399
	cap_rights_t rights;
400
	int kev_flags;
401
	int nchanges = 0;
402
	int error;
403
404
	if (args->op != LINUX_EPOLL_CTL_DEL) {
405
		error = copyin(args->event, &le, sizeof(le));
406
		if (error != 0)
407
			return (error);
408
	}
409
410
	error = fget(td, args->epfd,
411
	    cap_rights_init(&rights, CAP_KQUEUE_CHANGE), &epfp);
412
	if (error != 0)
413
		return (error);
414
	if (epfp->f_type != DTYPE_KQUEUE)
415
		goto leave1;
416
417
	 /* Protect user data vector from incorrectly supplied fd. */
418
	error = fget(td, args->fd, cap_rights_init(&rights, CAP_POLL_EVENT), &fp);
419
	if (error != 0)
420
		goto leave1;
421
422
	/* Linux disallows spying on himself */
423
	if (epfp == fp) {
424
		error = EINVAL;
425
		goto leave0;
426
	}
427
428
	ciargs.changelist = kev;
429
430
	switch (args->op) {
431
	case LINUX_EPOLL_CTL_MOD:
432
		/*
433
		 * We don't memorize which events were set for this FD
434
		 * on this level, so just delete all we could have set:
435
		 * EVFILT_READ and EVFILT_WRITE, ignoring any errors
436
		 */
437
		error = epoll_delete_all_events(td, epfp, args->fd);
438
		if (error)
439
			goto leave0;
440
		/* FALLTHROUGH */
441
442
	case LINUX_EPOLL_CTL_ADD:
443
			kev_flags = EV_ADD | EV_ENABLE;
444
		break;
445
446
	case LINUX_EPOLL_CTL_DEL:
447
		/* CTL_DEL means unregister this fd with this epoll */
448
		error = epoll_delete_all_events(td, epfp, args->fd);
449
		goto leave0;
450
451
	default:
452
		error = EINVAL;
453
		goto leave0;
454
	}
455
456
	error = epoll_to_kevent(td, epfp, args->fd, &le, &kev_flags,
457
	    kev, &nchanges);
458
	if (error)
459
		goto leave0;
460
461
	epoll_fd_install(td, args->fd, le.data);
462
463
	error = kern_kevent_fp(td, epfp, nchanges, 0, &k_ops, NULL);
464
465
leave0:
466
	fdrop(fp, td);
467
468
leave1:
469
	fdrop(epfp, td);
470
	return (error);
471
}
472
473
/*
474
 * Wait for a filter to be triggered on the epoll file descriptor.
475
 */
476
static int
477
linux_epoll_wait_common(struct thread *td, int epfd, struct epoll_event *events,
478
    int maxevents, int timeout, sigset_t *uset)
479
{
480
	struct file *epfp;
481
	struct timespec ts, *tsp;
482
	cap_rights_t rights;
483
	struct epoll_copyout_args coargs;
484
	struct kevent_copyops k_ops = { &coargs,
485
					epoll_kev_copyout,
486
					NULL};
487
	int error;
488
489
	if (maxevents <= 0 || maxevents > LINUX_MAX_EVENTS)
490
		return (EINVAL);
491
492
	if (uset != NULL) {
493
		error = kern_sigprocmask(td, SIG_SETMASK, uset,
494
		    &td->td_oldsigmask, 0);
495
		if (error != 0)
496
			return (error);
497
		td->td_pflags |= TDP_OLDMASK;
498
		/*
499
		 * Make sure that ast() is called on return to
500
		 * usermode and TDP_OLDMASK is cleared, restoring old
501
		 * sigmask.
502
		 */
503
		thread_lock(td);
504
		td->td_flags |= TDF_ASTPENDING;
505
		thread_unlock(td);
506
	}
507
508
	error = fget(td, epfd,
509
	    cap_rights_init(&rights, CAP_KQUEUE_EVENT), &epfp);
510
	if (error != 0)
511
		return (error);
512
513
	coargs.leventlist = events;
514
	coargs.p = td->td_proc;
515
	coargs.count = 0;
516
	coargs.error = 0;
517
518
	if (timeout != -1) {
519
		if (timeout < 0) {
520
			error = EINVAL;
521
			goto leave;
522
		}
523
		/* Convert from milliseconds to timespec. */
524
		ts.tv_sec = timeout / 1000;
525
		ts.tv_nsec = (timeout % 1000) * 1000000;
526
		tsp = &ts;
527
	} else {
528
		tsp = NULL;
529
	}
530
531
	error = kern_kevent_fp(td, epfp, 0, maxevents, &k_ops, tsp);
532
	if (error == 0 && coargs.error != 0)
533
		error = coargs.error;
534
535
	/* 
536
	 * kern_kevent might return ENOMEM which is not expected from epoll_wait.
537
	 * Maybe we should translate that but I don't think it matters at all.
538
	 */
539
	if (error == 0)
540
		td->td_retval[0] = coargs.count;
541
leave:
542
	fdrop(epfp, td);
543
	return (error);
544
}
545
546
int
547
linux_epoll_wait(struct thread *td, struct linux_epoll_wait_args *args)
548
{
549
550
	return (linux_epoll_wait_common(td, args->epfd, args->events,
551
	    args->maxevents, args->timeout, NULL));
552
}
553
554
int
555
linux_epoll_pwait(struct thread *td, struct linux_epoll_pwait_args *args)
556
{
557
	sigset_t mask, *pmask;
558
	l_sigset_t lmask;
559
	int error;
560
561
	if (args->mask != NULL) {
562
		error = copyin(args->mask, &lmask, sizeof(l_sigset_t));
563
		if (error != 0)
564
			return (error);
565
		linux_to_bsd_sigset(&lmask, &mask);
566
		pmask = &mask;
567
	} else
568
		pmask = NULL;
569
	return (linux_epoll_wait_common(td, args->epfd, args->events,
570
	    args->maxevents, args->timeout, pmask));
571
}
572
573
static int
574
epoll_delete_event(struct thread *td, struct file *epfp, int fd, int filter)
575
{
576
	struct epoll_copyin_args ciargs;
577
	struct kevent kev;
578
	struct kevent_copyops k_ops = { &ciargs,
579
					NULL,
580
					epoll_kev_copyin};
581
	int error;
582
583
	ciargs.changelist = &kev;
584
	EV_SET(&kev, fd, filter, EV_DELETE | EV_DISABLE, 0, 0, 0);
585
586
	error = kern_kevent_fp(td, epfp, 1, 0, &k_ops, NULL);
587
588
	/*
589
	 * here we ignore ENONT, because we don't keep track of events here
590
	 */
591
	if (error == ENOENT)
592
		error = 0;
593
	return (error);
594
}
595
596
static int
597
epoll_delete_all_events(struct thread *td, struct file *epfp, int fd)
598
{
599
	int error1, error2;
600
601
	error1 = epoll_delete_event(td, epfp, fd, EVFILT_READ);
602
	error2 = epoll_delete_event(td, epfp, fd, EVFILT_WRITE);
603
604
	/* report any errors we got */
605
	return (error1 == 0 ? error2 : error1);
606
}
607
608
static int
609
eventfd_create(struct thread *td, uint32_t initval, int flags)
610
{
611
	struct filedesc *fdp;
612
	struct eventfd *efd;
613
	struct file *fp;
614
	int fflags, fd, error;
615
616
	fflags = 0;
617
	if ((flags & LINUX_O_CLOEXEC) != 0)
618
		fflags |= O_CLOEXEC;
619
620
	fdp = td->td_proc->p_fd;
621
	error = falloc(td, &fp, &fd, fflags);
622
	if (error)
623
		return (error);
624
625
	efd = malloc(sizeof(*efd), M_EPOLL, M_WAITOK | M_ZERO);
626
	efd->efd_flags = flags;
627
	efd->efd_count = initval;
628
	mtx_init(&efd->efd_lock, "eventfd", NULL, MTX_DEF);
629
630
	knlist_init_mtx(&efd->efd_sel.si_note, &efd->efd_lock);
631
632
	fflags = FREAD | FWRITE; 
633
	if ((flags & LINUX_O_NONBLOCK) != 0)
634
		fflags |= FNONBLOCK;
635
636
	finit(fp, fflags, DTYPE_LINUXEFD, efd, &eventfdops);
637
	fdrop(fp, td);
638
639
	td->td_retval[0] = fd;
640
	return (error);
641
}
642
643
int
644
linux_eventfd(struct thread *td, struct linux_eventfd_args *args)
645
{
646
647
	return (eventfd_create(td, args->initval, 0));
648
}
649
650
int
651
linux_eventfd2(struct thread *td, struct linux_eventfd2_args *args)
652
{
653
654
	if ((args->flags & ~(LINUX_O_CLOEXEC|LINUX_O_NONBLOCK|LINUX_EFD_SEMAPHORE)) != 0)
655
		return (EINVAL);
656
657
	return (eventfd_create(td, args->initval, args->flags));
658
}
659
660
static int
661
eventfd_close(struct file *fp, struct thread *td)
662
{
663
	struct eventfd *efd;
664
665
	efd = fp->f_data;
666
	if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
667
		return (EBADF);
668
669
	seldrain(&efd->efd_sel);
670
	knlist_destroy(&efd->efd_sel.si_note);
671
672
	fp->f_ops = &badfileops;
673
	mtx_destroy(&efd->efd_lock);
674
	free(efd, M_EPOLL);
675
676
	return (0);
677
}
678
679
static int
680
eventfd_read(struct file *fp, struct uio *uio, struct ucred *active_cred,
681
	int flags, struct thread *td)
682
{
683
	struct eventfd *efd;
684
	eventfd_t count;
685
	int error;
686
687
	efd = fp->f_data;
688
	if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
689
		return (EBADF);
690
691
	if (uio->uio_resid < sizeof(eventfd_t))
692
		return (EINVAL);
693
694
	error = 0;
695
	mtx_lock(&efd->efd_lock);
696
retry:
697
	if (efd->efd_count == 0) {
698
		if ((efd->efd_flags & LINUX_O_NONBLOCK) != 0) {
699
			mtx_unlock(&efd->efd_lock);
700
			return (EAGAIN);
701
		}
702
		error = mtx_sleep(&efd->efd_count, &efd->efd_lock, PCATCH, "lefdrd", 0);
703
		if (error == 0)
704
			goto retry;
705
	}
706
	if (error == 0) {
707
		if ((efd->efd_flags & LINUX_EFD_SEMAPHORE) != 0) {
708
			count = 1;
709
			--efd->efd_count;
710
		} else {
711
			count = efd->efd_count;
712
			efd->efd_count = 0;
713
		}
714
		KNOTE_LOCKED(&efd->efd_sel.si_note, 0);
715
		selwakeup(&efd->efd_sel);
716
		wakeup(&efd->efd_count);
717
		mtx_unlock(&efd->efd_lock);
718
		error = uiomove(&count, sizeof(eventfd_t), uio);
719
	} else
720
		mtx_unlock(&efd->efd_lock);
721
722
	return (error);
723
}
724
725
static int
726
eventfd_write(struct file *fp, struct uio *uio, struct ucred *active_cred,
727
	 int flags, struct thread *td)
728
{
729
	struct eventfd *efd;
730
	eventfd_t count;
731
	int error;
732
733
	efd = fp->f_data;
734
	if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
735
		return (EBADF);
736
737
	if (uio->uio_resid < sizeof(eventfd_t))
738
		return (EINVAL);
739
740
	error = uiomove(&count, sizeof(eventfd_t), uio);
741
	if (error)
742
		return (error);
743
	if (count == UINT64_MAX)
744
		return (EINVAL);
745
746
	mtx_lock(&efd->efd_lock);
747
retry:
748
	if (UINT64_MAX - efd->efd_count <= count) {
749
		if ((efd->efd_flags & LINUX_O_NONBLOCK) != 0) {
750
			mtx_unlock(&efd->efd_lock);
751
			return (EAGAIN);
752
		}
753
		error = mtx_sleep(&efd->efd_count, &efd->efd_lock,
754
		    PCATCH, "lefdwr", 0);
755
		if (error == 0)
756
			goto retry;
757
	}
758
	if (error == 0) {
759
		efd->efd_count += count;
760
		KNOTE_LOCKED(&efd->efd_sel.si_note, 0);
761
		selwakeup(&efd->efd_sel);
762
		wakeup(&efd->efd_count);
763
	}
764
	mtx_unlock(&efd->efd_lock);
765
766
	return (error);
767
}
768
769
static int
770
eventfd_poll(struct file *fp, int events, struct ucred *active_cred,
771
	struct thread *td)
772
{
773
	struct eventfd *efd;
774
	int revents = 0;
775
776
	efd = fp->f_data;
777
	if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
778
		return (POLLERR);
779
780
	mtx_lock(&efd->efd_lock);
781
	if ((events & (POLLIN|POLLRDNORM)) && efd->efd_count > 0)
782
		revents |= events & (POLLIN|POLLRDNORM);
783
	if ((events & (POLLOUT|POLLWRNORM)) && UINT64_MAX - 1 > efd->efd_count)
784
		revents |= events & (POLLOUT|POLLWRNORM);
785
	if (revents == 0)
786
		selrecord(td, &efd->efd_sel);
787
	mtx_unlock(&efd->efd_lock);
788
789
	return (revents);
790
}
791
792
/*ARGSUSED*/
793
static int
794
eventfd_kqfilter(struct file *fp, struct knote *kn)
795
{
796
	struct eventfd *efd;
797
798
	efd = fp->f_data;
799
	if (fp->f_type != DTYPE_LINUXEFD || efd == NULL)
800
		return (EINVAL);
801
802
	mtx_lock(&efd->efd_lock);
803
	switch (kn->kn_filter) {
804
	case EVFILT_READ:
805
		kn->kn_fop = &eventfd_rfiltops;
806
		break;
807
	case EVFILT_WRITE:
808
		kn->kn_fop = &eventfd_wfiltops;
809
		break;
810
	default:
811
		mtx_unlock(&efd->efd_lock);
812
		return (EINVAL);
813
	}
814
815
	kn->kn_hook = efd;
816
	knlist_add(&efd->efd_sel.si_note, kn, 1);
817
	mtx_unlock(&efd->efd_lock);
818
819
	return (0);
820
}
821
822
static void
823
filt_eventfddetach(struct knote *kn)
824
{
825
	struct eventfd *efd = kn->kn_hook;
826
827
	mtx_lock(&efd->efd_lock);
828
	knlist_remove(&efd->efd_sel.si_note, kn, 1);
829
	mtx_unlock(&efd->efd_lock);
830
}
831
832
/*ARGSUSED*/
833
static int
834
filt_eventfdread(struct knote *kn, long hint)
835
{
836
	struct eventfd *efd = kn->kn_hook;
837
	int ret;
838
839
	mtx_assert(&efd->efd_lock, MA_OWNED);
840
	ret = (efd->efd_count > 0);
841
842
	return (ret);
843
}
844
845
/*ARGSUSED*/
846
static int
847
filt_eventfdwrite(struct knote *kn, long hint)
848
{
849
	struct eventfd *efd = kn->kn_hook;
850
	int ret;
851
852
	mtx_assert(&efd->efd_lock, MA_OWNED);
853
	ret = (UINT64_MAX - 1 > efd->efd_count);
854
855
	return (ret);
856
}
857
858
/*ARGSUSED*/
859
static int
860
eventfd_truncate(struct file *fp, off_t length, struct ucred *active_cred,
861
	struct thread *td)
862
{
863
864
	return (ENXIO);
865
}
866
867
/*ARGSUSED*/
868
static int
869
eventfd_ioctl(struct file *fp, u_long cmd, void *data,
870
	struct ucred *active_cred, struct thread *td)
871
{
872
873
	return (ENXIO);
874
}
875
876
/*ARGSUSED*/
877
static int
878
eventfd_stat(struct file *fp, struct stat *st, struct ucred *active_cred,
879
	struct thread *td)
880
{
881
882
	return (ENXIO);
883
}
(-)sys/compat/linux/linux_event.h (+60 lines)
Line 0 Link Here
1
/*-
2
 * Copyright (c) 2007 Roman Divacky
3
 * Copyright (c) 2014 Dmitry Chagin
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
 * 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
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
 * SUCH DAMAGE.
26
 *
27
 * $FreeBSD$
28
 */
29
30
#ifndef _LINUX_EVENT_H_
31
#define	_LINUX_EVENT_H_
32
33
#define	LINUX_EPOLLIN		0x001
34
#define	LINUX_EPOLLPRI		0x002
35
#define	LINUX_EPOLLOUT		0x004
36
#define	LINUX_EPOLLRDNORM	0x040
37
#define	LINUX_EPOLLRDBAND	0x080
38
#define	LINUX_EPOLLWRNORM	0x100
39
#define	LINUX_EPOLLWRBAND	0x200
40
#define	LINUX_EPOLLMSG		0x400
41
#define	LINUX_EPOLLERR		0x008
42
#define	LINUX_EPOLLHUP		0x010
43
#define	LINUX_EPOLLRDHUP	0x2000
44
#define	LINUX_EPOLLWAKEUP	1u<<29
45
#define	LINUX_EPOLLONESHOT	1u<<30
46
#define	LINUX_EPOLLET		1u<<31
47
48
#define	LINUX_EPOLL_EVRD	(LINUX_EPOLLIN|LINUX_EPOLLRDNORM	\
49
		|LINUX_EPOLLHUP|LINUX_EPOLLERR|LINUX_EPOLLPRI)
50
#define	LINUX_EPOLL_EVWR	(LINUX_EPOLLOUT|LINUX_EPOLLWRNORM)
51
#define	LINUX_EPOLL_EVSUP	(LINUX_EPOLLET|LINUX_EPOLLONESHOT	\
52
		|LINUX_EPOLL_EVRD|LINUX_EPOLL_EVWR|LINUX_EPOLLRDHUP)
53
54
#define	LINUX_EPOLL_CTL_ADD	1
55
#define	LINUX_EPOLL_CTL_DEL	2
56
#define	LINUX_EPOLL_CTL_MOD	3
57
58
#define	LINUX_EFD_SEMAPHORE	(1 << 0)
59
60
#endif	/* !_LINUX_EVENT_H_ */
(-)sys/compat/linux/linux_file.c (-14 / +58 lines)
Lines 239-244 Link Here
239
    return error;
239
    return error;
240
}
240
}
241
241
242
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
242
int
243
int
243
linux_llseek(struct thread *td, struct linux_llseek_args *args)
244
linux_llseek(struct thread *td, struct linux_llseek_args *args)
244
{
245
{
Lines 277-282 Link Here
277
	lda.count = 1;
278
	lda.count = 1;
278
	return linux_getdents(td, &lda);
279
	return linux_getdents(td, &lda);
279
}
280
}
281
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
280
282
281
/*
283
/*
282
 * Note that linux_getdents(2) and linux_getdents64(2) have the same
284
 * Note that linux_getdents(2) and linux_getdents64(2) have the same
Lines 371-378 Link Here
371
373
372
	buflen = max(LINUX_DIRBLKSIZ, nbytes);
374
	buflen = max(LINUX_DIRBLKSIZ, nbytes);
373
	buflen = min(buflen, MAXBSIZE);
375
	buflen = min(buflen, MAXBSIZE);
374
	buf = malloc(buflen, M_TEMP, M_WAITOK);
376
	buf = malloc(buflen, M_LINUX, M_WAITOK);
375
	lbuf = malloc(LINUX_MAXRECLEN, M_TEMP, M_WAITOK | M_ZERO);
377
	lbuf = malloc(LINUX_MAXRECLEN, M_LINUX, M_WAITOK | M_ZERO);
376
	vn_lock(vp, LK_SHARED | LK_RETRY);
378
	vn_lock(vp, LK_SHARED | LK_RETRY);
377
379
378
	aiov.iov_base = buf;
380
	aiov.iov_base = buf;
Lines 523-530 Link Here
523
	VOP_UNLOCK(vp, 0);
525
	VOP_UNLOCK(vp, 0);
524
	foffset_unlock(fp, off, 0);
526
	foffset_unlock(fp, off, 0);
525
	fdrop(fp, td);
527
	fdrop(fp, td);
526
	free(buf, M_TEMP);
528
	free(buf, M_LINUX);
527
	free(lbuf, M_TEMP);
529
	free(lbuf, M_LINUX);
528
	return (error);
530
	return (error);
529
}
531
}
530
532
Lines 584-591 Link Here
584
	char *path;
586
	char *path;
585
	int error, dfd, flag;
587
	int error, dfd, flag;
586
588
587
	if (args->flag & ~LINUX_AT_EACCESS)
588
		return (EINVAL);
589
	/* linux convention */
589
	/* linux convention */
590
	if (args->amode & ~(F_OK | X_OK | W_OK | R_OK))
590
	if (args->amode & ~(F_OK | X_OK | W_OK | R_OK))
591
		return (EINVAL);
591
		return (EINVAL);
Lines 598-604 Link Here
598
		printf(ARGS(access, "%s, %d"), path, args->amode);
598
		printf(ARGS(access, "%s, %d"), path, args->amode);
599
#endif
599
#endif
600
600
601
	flag = (args->flag & LINUX_AT_EACCESS) == 0 ? 0 : AT_EACCESS;
601
	flag = AT_EACCESS;
602
	error = kern_accessat(td, dfd, path, UIO_SYSSPACE, flag, args->amode);
602
	error = kern_accessat(td, dfd, path, UIO_SYSSPACE, flag, args->amode);
603
	LFREEPATH(path);
603
	LFREEPATH(path);
604
604
Lines 923-928 Link Here
923
	return (error);
923
	return (error);
924
}
924
}
925
925
926
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
926
int
927
int
927
linux_truncate64(struct thread *td, struct linux_truncate64_args *args)
928
linux_truncate64(struct thread *td, struct linux_truncate64_args *args)
928
{
929
{
Lines 940-945 Link Here
940
	LFREEPATH(path);
941
	LFREEPATH(path);
941
	return (error);
942
	return (error);
942
}
943
}
944
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
945
943
int
946
int
944
linux_ftruncate(struct thread *td, struct linux_ftruncate_args *args)
947
linux_ftruncate(struct thread *td, struct linux_ftruncate_args *args)
945
{
948
{
Lines 1147-1152 Link Here
1147
	return (error);
1150
	return (error);
1148
}
1151
}
1149
1152
1153
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
1150
int
1154
int
1151
linux_oldumount(struct thread *td, struct linux_oldumount_args *args)
1155
linux_oldumount(struct thread *td, struct linux_oldumount_args *args)
1152
{
1156
{
Lines 1156-1161 Link Here
1156
	args2.flags = 0;
1160
	args2.flags = 0;
1157
	return (linux_umount(td, &args2));
1161
	return (linux_umount(td, &args2));
1158
}
1162
}
1163
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
1159
1164
1160
int
1165
int
1161
linux_umount(struct thread *td, struct linux_umount_args *args)
1166
linux_umount(struct thread *td, struct linux_umount_args *args)
Lines 1286-1292 Link Here
1286
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
1291
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
1287
1292
1288
static int
1293
static int
1289
fcntl_common(struct thread *td, struct linux_fcntl64_args *args)
1294
fcntl_common(struct thread *td, struct linux_fcntl_args *args)
1290
{
1295
{
1291
	struct l_flock linux_flock;
1296
	struct l_flock linux_flock;
1292
	struct flock bsd_flock;
1297
	struct flock bsd_flock;
Lines 1404-1409 Link Here
1404
		fdrop(fp, td);
1409
		fdrop(fp, td);
1405
1410
1406
		return (kern_fcntl(td, args->fd, F_SETOWN, args->arg));
1411
		return (kern_fcntl(td, args->fd, F_SETOWN, args->arg));
1412
1413
	case LINUX_F_DUPFD_CLOEXEC:
1414
		return (kern_fcntl(td, args->fd, F_DUPFD_CLOEXEC, args->arg));
1407
	}
1415
	}
1408
1416
1409
	return (EINVAL);
1417
	return (EINVAL);
Lines 1412-1418 Link Here
1412
int
1420
int
1413
linux_fcntl(struct thread *td, struct linux_fcntl_args *args)
1421
linux_fcntl(struct thread *td, struct linux_fcntl_args *args)
1414
{
1422
{
1415
	struct linux_fcntl64_args args64;
1416
1423
1417
#ifdef DEBUG
1424
#ifdef DEBUG
1418
	if (ldebug(fcntl))
1425
	if (ldebug(fcntl))
Lines 1419-1428 Link Here
1419
		printf(ARGS(fcntl, "%d, %08x, *"), args->fd, args->cmd);
1426
		printf(ARGS(fcntl, "%d, %08x, *"), args->fd, args->cmd);
1420
#endif
1427
#endif
1421
1428
1422
	args64.fd = args->fd;
1429
	return (fcntl_common(td, args));
1423
	args64.cmd = args->cmd;
1424
	args64.arg = args->arg;
1425
	return (fcntl_common(td, &args64));
1426
}
1430
}
1427
1431
1428
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
1432
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
Lines 1431-1436 Link Here
1431
{
1435
{
1432
	struct l_flock64 linux_flock;
1436
	struct l_flock64 linux_flock;
1433
	struct flock bsd_flock;
1437
	struct flock bsd_flock;
1438
	struct linux_fcntl_args fcntl_args;
1434
	int error;
1439
	int error;
1435
1440
1436
#ifdef DEBUG
1441
#ifdef DEBUG
Lines 1471-1477 Link Here
1471
		    (intptr_t)&bsd_flock));
1476
		    (intptr_t)&bsd_flock));
1472
	}
1477
	}
1473
1478
1474
	return (fcntl_common(td, args));
1479
	fcntl_args.fd = args->fd;
1480
	fcntl_args.cmd = args->cmd;
1481
	fcntl_args.arg = args->arg;
1482
	return (fcntl_common(td, &fcntl_args));
1475
}
1483
}
1476
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
1484
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
1477
1485
Lines 1567-1572 Link Here
1567
	    advice));
1575
	    advice));
1568
}
1576
}
1569
1577
1578
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
1570
int
1579
int
1571
linux_fadvise64_64(struct thread *td, struct linux_fadvise64_64_args *args)
1580
linux_fadvise64_64(struct thread *td, struct linux_fadvise64_64_args *args)
1572
{
1581
{
Lines 1578-1583 Link Here
1578
	return (kern_posix_fadvise(td, args->fd, args->offset, args->len,
1587
	return (kern_posix_fadvise(td, args->fd, args->offset, args->len,
1579
	    advice));
1588
	    advice));
1580
}
1589
}
1590
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
1581
1591
1582
int
1592
int
1583
linux_pipe(struct thread *td, struct linux_pipe_args *args)
1593
linux_pipe(struct thread *td, struct linux_pipe_args *args)
Lines 1624-1626 Link Here
1624
	/* XXX: Close descriptors on error. */
1634
	/* XXX: Close descriptors on error. */
1625
	return (copyout(fildes, args->pipefds, sizeof(fildes)));
1635
	return (copyout(fildes, args->pipefds, sizeof(fildes)));
1626
}
1636
}
1637
1638
int
1639
linux_dup3(struct thread *td, struct linux_dup3_args *args)
1640
{
1641
	int cmd;
1642
	intptr_t newfd;
1643
1644
	if (args->oldfd == args->newfd)
1645
		return (EINVAL);
1646
	if ((args->flags & ~LINUX_O_CLOEXEC) != 0)
1647
		return (EINVAL);
1648
	if (args->flags & LINUX_O_CLOEXEC)
1649
		cmd = F_DUP2FD_CLOEXEC;
1650
	else
1651
		cmd = F_DUP2FD;
1652
1653
	newfd = args->newfd;
1654
	return (kern_fcntl(td, args->oldfd, cmd, newfd));
1655
}
1656
1657
int
1658
linux_fallocate(struct thread *td, struct linux_fallocate_args *args)
1659
{
1660
1661
	/*
1662
	 * We emulate only posix_fallocate system call for which
1663
	 * mode should be 0.
1664
	 */
1665
	if (args->mode != 0)
1666
		return (ENOSYS);
1667
1668
	return (kern_posix_fallocate(td, args->fd, args->offset,
1669
	    args->len));
1670
}
(-)sys/compat/linux/linux_file.h (+71 lines)
Lines 54-57 Link Here
54
#define	LINUX_MS_NOEXEC		0x0008
54
#define	LINUX_MS_NOEXEC		0x0008
55
#define	LINUX_MS_REMOUNT	0x0020
55
#define	LINUX_MS_REMOUNT	0x0020
56
56
57
/*
58
 * common open/fcntl flags
59
 */
60
#define	LINUX_O_RDONLY		00000000
61
#define	LINUX_O_WRONLY		00000001
62
#define	LINUX_O_RDWR		00000002
63
#define	LINUX_O_ACCMODE		00000003
64
#define	LINUX_O_CREAT		00000100
65
#define	LINUX_O_EXCL		00000200
66
#define	LINUX_O_NOCTTY		00000400
67
#define	LINUX_O_TRUNC		00001000
68
#define	LINUX_O_APPEND		00002000
69
#define	LINUX_O_NONBLOCK	00004000
70
#define	LINUX_O_NDELAY		LINUX_O_NONBLOCK
71
#define	LINUX_O_SYNC		00010000
72
#define	LINUX_FASYNC		00020000
73
#define	LINUX_O_DIRECT		00040000	/* Direct disk access hint */
74
#define	LINUX_O_LARGEFILE	00100000
75
#define	LINUX_O_DIRECTORY	00200000	/* Must be a directory */
76
#define	LINUX_O_NOFOLLOW	00400000	/* Do not follow links */
77
#define	LINUX_O_NOATIME		01000000
78
#define	LINUX_O_CLOEXEC		02000000
79
80
#define	LINUX_F_DUPFD		0
81
#define	LINUX_F_GETFD		1
82
#define	LINUX_F_SETFD		2
83
#define	LINUX_F_GETFL		3
84
#define	LINUX_F_SETFL		4
85
#ifndef LINUX_F_GETLK
86
#define	LINUX_F_GETLK		5
87
#define	LINUX_F_SETLK		6
88
#define	LINUX_F_SETLKW		7
89
#endif
90
#ifndef LINUX_F_SETOWN
91
#define	LINUX_F_SETOWN		8
92
#define	LINUX_F_GETOWN		9
93
#endif
94
#ifndef LINUX_F_SETSIG
95
#define	LINUX_F_SETSIG		10
96
#define	LINUX_F_GETSIG		11
97
#endif
98
#ifndef LINUX_F_SETOWN_EX
99
#define	LINUX_F_SETOWN_EX	15
100
#define	LINUX_F_GETOWN_EX	16
101
#define	LINUX_F_GETOWNER_UIDS	17
102
#endif
103
104
#define	LINUX_F_SPECIFIC_BASE	1024
105
106
#define	LINUX_F_SETLEASE	(LINUX_F_SPECIFIC_BASE + 0)
107
#define	LINUX_F_GETLEASE	(LINUX_F_SPECIFIC_BASE + 1)
108
#define	LINUX_F_CANCELLK	(LINUX_F_SPECIFIC_BASE + 5)
109
#define	LINUX_F_DUPFD_CLOEXEC	(LINUX_F_SPECIFIC_BASE + 6)
110
#define	LINUX_F_NOTIFY		(LINUX_F_SPECIFIC_BASE + 2)
111
#define	LINUX_F_SETPIPE_SZ	(LINUX_F_SPECIFIC_BASE + 7)
112
#define	LINUX_F_GETPIPE_SZ	(LINUX_F_SPECIFIC_BASE + 8)
113
114
#define	LINUX_F_GETLKP		36
115
#define	LINUX_F_SETLKP		37
116
#define	LINUX_F_SETLKPW		38
117
118
#define	LINUX_F_OWNER_TID	0
119
#define	LINUX_F_OWNER_PID	1
120
#define	LINUX_F_OWNER_PGRP	2
121
122
#ifndef LINUX_F_RDLCK
123
#define	LINUX_F_RDLCK		0
124
#define	LINUX_F_WRLCK		1
125
#define	LINUX_F_UNLCK		2
126
#endif
127
57
#endif	/* !_LINUX_FILE_H_ */
128
#endif	/* !_LINUX_FILE_H_ */
(-)sys/compat/linux/linux_fork.c (-69 / +239 lines)
Lines 35-48 Link Here
35
#include <sys/param.h>
35
#include <sys/param.h>
36
#include <sys/systm.h>
36
#include <sys/systm.h>
37
#include <sys/imgact.h>
37
#include <sys/imgact.h>
38
#include <sys/ktr.h>
38
#include <sys/lock.h>
39
#include <sys/lock.h>
39
#include <sys/mutex.h>
40
#include <sys/mutex.h>
40
#include <sys/proc.h>
41
#include <sys/proc.h>
42
#include <sys/racct.h>
41
#include <sys/sched.h>
43
#include <sys/sched.h>
42
#include <sys/sdt.h>
44
#include <sys/syscallsubr.h>
43
#include <sys/sx.h>
45
#include <sys/sx.h>
44
#include <sys/unistd.h>
46
#include <sys/unistd.h>
47
#include <sys/wait.h>
45
48
49
#include <vm/vm.h>
50
#include <vm/pmap.h>
51
#include <vm/vm_map.h>
52
46
#ifdef COMPAT_LINUX32
53
#ifdef COMPAT_LINUX32
47
#include <machine/../linux32/linux.h>
54
#include <machine/../linux32/linux.h>
48
#include <machine/../linux32/linux32_proto.h>
55
#include <machine/../linux32/linux32_proto.h>
Lines 50-68 Link Here
50
#include <machine/../linux/linux.h>
57
#include <machine/../linux/linux.h>
51
#include <machine/../linux/linux_proto.h>
58
#include <machine/../linux/linux_proto.h>
52
#endif
59
#endif
53
#include <compat/linux/linux_dtrace.h>
54
#include <compat/linux/linux_signal.h>
55
#include <compat/linux/linux_emul.h>
60
#include <compat/linux/linux_emul.h>
61
#include <compat/linux/linux_futex.h>
56
#include <compat/linux/linux_misc.h>
62
#include <compat/linux/linux_misc.h>
63
#include <compat/linux/linux_util.h>
57
64
58
/* DTrace init */
59
LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
60
61
/* Linuxulator-global DTrace probes */
62
LIN_SDT_PROBE_DECLARE(locks, emul_lock, locked);
63
LIN_SDT_PROBE_DECLARE(locks, emul_lock, unlock);
64
65
66
int
65
int
67
linux_fork(struct thread *td, struct linux_fork_args *args)
66
linux_fork(struct thread *td, struct linux_fork_args *args)
68
{
67
{
Lines 79-92 Link Here
79
	    != 0)
78
	    != 0)
80
		return (error);
79
		return (error);
81
80
82
	td->td_retval[0] = p2->p_pid;
81
	td2 = FIRST_THREAD_IN_PROC(p2);
83
	td->td_retval[1] = 0;
84
82
85
	error = linux_proc_init(td, td->td_retval[0], 0);
83
	linux_proc_init(td, td2, 0);
86
	if (error)
87
		return (error);
88
84
89
	td2 = FIRST_THREAD_IN_PROC(p2);
85
	td->td_retval[0] = p2->p_pid;
90
86
91
	/*
87
	/*
92
	 * Make this runnable after we are finished with it.
88
	 * Make this runnable after we are finished with it.
Lines 116-132 Link Here
116
	    NULL, 0)) != 0)
112
	    NULL, 0)) != 0)
117
		return (error);
113
		return (error);
118
114
119
   	td->td_retval[0] = p2->p_pid;
120
115
121
	error = linux_proc_init(td, td->td_retval[0], 0);
116
	td2 = FIRST_THREAD_IN_PROC(p2);
122
	if (error)
123
		return (error);
124
117
118
	linux_proc_init(td, td2, 0);
119
125
	PROC_LOCK(p2);
120
	PROC_LOCK(p2);
126
	p2->p_flag |= P_PPWAIT;
121
	p2->p_flag |= P_PPWAIT;
127
	PROC_UNLOCK(p2);
122
	PROC_UNLOCK(p2);
128
123
129
	td2 = FIRST_THREAD_IN_PROC(p2);
124
   	td->td_retval[0] = p2->p_pid;
130
125
131
	/*
126
	/*
132
	 * Make this runnable after we are finished with it.
127
	 * Make this runnable after we are finished with it.
Lines 145-152 Link Here
145
	return (0);
140
	return (0);
146
}
141
}
147
142
148
int
143
static int
149
linux_clone(struct thread *td, struct linux_clone_args *args)
144
linux_clone_proc(struct thread *td, struct linux_clone_args *args)
150
{
145
{
151
	int error, ff = RFPROC | RFSTOPPED;
146
	int error, ff = RFPROC | RFSTOPPED;
152
	struct proc *p2;
147
	struct proc *p2;
Lines 164-172 Link Here
164
159
165
	exit_signal = args->flags & 0x000000ff;
160
	exit_signal = args->flags & 0x000000ff;
166
	if (LINUX_SIG_VALID(exit_signal)) {
161
	if (LINUX_SIG_VALID(exit_signal)) {
167
		if (exit_signal <= LINUX_SIGTBLSZ)
162
		exit_signal = linux_to_bsd_signal(exit_signal);
168
			exit_signal =
169
			    linux_to_bsd_signal[_SIG_IDX(exit_signal)];
170
	} else if (exit_signal != 0)
163
	} else if (exit_signal != 0)
171
		return (EINVAL);
164
		return (EINVAL);
172
165
Lines 183-204 Link Here
183
	if (!(args->flags & (LINUX_CLONE_FILES | LINUX_CLONE_FS)))
176
	if (!(args->flags & (LINUX_CLONE_FILES | LINUX_CLONE_FS)))
184
		ff |= RFFDG;
177
		ff |= RFFDG;
185
178
186
	/*
187
	 * Attempt to detect when linux_clone(2) is used for creating
188
	 * kernel threads. Unfortunately despite the existence of the
189
	 * CLONE_THREAD flag, version of linuxthreads package used in
190
	 * most popular distros as of beginning of 2005 doesn't make
191
	 * any use of it. Therefore, this detection relies on
192
	 * empirical observation that linuxthreads sets certain
193
	 * combination of flags, so that we can make more or less
194
	 * precise detection and notify the FreeBSD kernel that several
195
	 * processes are in fact part of the same threading group, so
196
	 * that special treatment is necessary for signal delivery
197
	 * between those processes and fd locking.
198
	 */
199
	if ((args->flags & 0xffffff00) == LINUX_THREADING_FLAGS)
200
		ff |= RFTHREAD;
201
202
	if (args->flags & LINUX_CLONE_PARENT_SETTID)
179
	if (args->flags & LINUX_CLONE_PARENT_SETTID)
203
		if (args->parent_tidptr == NULL)
180
		if (args->parent_tidptr == NULL)
204
			return (EINVAL);
181
			return (EINVAL);
Lines 207-235 Link Here
207
	if (error)
184
	if (error)
208
		return (error);
185
		return (error);
209
186
210
	if (args->flags & (LINUX_CLONE_PARENT | LINUX_CLONE_THREAD)) {
187
	td2 = FIRST_THREAD_IN_PROC(p2);
211
	   	sx_xlock(&proctree_lock);
212
		PROC_LOCK(p2);
213
		proc_reparent(p2, td->td_proc->p_pptr);
214
		PROC_UNLOCK(p2);
215
		sx_xunlock(&proctree_lock);
216
	}
217
188
218
	/* create the emuldata */
189
	/* create the emuldata */
219
	error = linux_proc_init(td, p2->p_pid, args->flags);
190
	linux_proc_init(td, td2, args->flags);
220
	/* reference it - no need to check this */
221
	em = em_find(p2, EMUL_DOLOCK);
222
	KASSERT(em != NULL, ("clone: emuldata not found."));
223
	/* and adjust it */
224
191
225
	if (args->flags & LINUX_CLONE_THREAD) {
192
	em = em_find(td2);
226
#ifdef notyet
193
	KASSERT(em != NULL, ("clone_proc: emuldata not found.\n"));
227
	   	PROC_LOCK(p2);
228
	   	p2->p_pgrp = td->td_proc->p_pgrp;
229
	   	PROC_UNLOCK(p2);
230
#endif
231
		exit_signal = 0;
232
	}
233
194
234
	if (args->flags & LINUX_CLONE_CHILD_SETTID)
195
	if (args->flags & LINUX_CLONE_CHILD_SETTID)
235
		em->child_set_tid = args->child_tidptr;
196
		em->child_set_tid = args->child_tidptr;
Lines 241-248 Link Here
241
	else
202
	else
242
	   	em->child_clear_tid = NULL;
203
	   	em->child_clear_tid = NULL;
243
204
244
	EMUL_UNLOCK(&emul_lock);
245
246
	if (args->flags & LINUX_CLONE_PARENT_SETTID) {
205
	if (args->flags & LINUX_CLONE_PARENT_SETTID) {
247
		error = copyout(&p2->p_pid, args->parent_tidptr,
206
		error = copyout(&p2->p_pid, args->parent_tidptr,
248
		    sizeof(p2->p_pid));
207
		    sizeof(p2->p_pid));
Lines 253-266 Link Here
253
	PROC_LOCK(p2);
212
	PROC_LOCK(p2);
254
	p2->p_sigparent = exit_signal;
213
	p2->p_sigparent = exit_signal;
255
	PROC_UNLOCK(p2);
214
	PROC_UNLOCK(p2);
256
	td2 = FIRST_THREAD_IN_PROC(p2);
257
	/*
215
	/*
258
	 * In a case of stack = NULL, we are supposed to COW calling process
216
	 * In a case of stack = NULL, we are supposed to COW calling process
259
	 * stack. This is what normal fork() does, so we just keep tf_rsp arg
217
	 * stack. This is what normal fork() does, so we just keep tf_rsp arg
260
	 * intact.
218
	 * intact.
261
	 */
219
	 */
262
	if (args->stack)
220
	linux_set_upcall_kse(td2, PTROUT(args->stack));
263
		linux_set_upcall_kse(td2, PTROUT(args->stack));
264
221
265
	if (args->flags & LINUX_CLONE_SETTLS)
222
	if (args->flags & LINUX_CLONE_SETTLS)
266
		linux_set_cloned_tls(td2, args->tls);
223
		linux_set_cloned_tls(td2, args->tls);
Lines 271-276 Link Here
271
		    "stack %p sig = %d"), (int)p2->p_pid, args->stack,
228
		    "stack %p sig = %d"), (int)p2->p_pid, args->stack,
272
		    exit_signal);
229
		    exit_signal);
273
#endif
230
#endif
231
274
	if (args->flags & LINUX_CLONE_VFORK) {
232
	if (args->flags & LINUX_CLONE_VFORK) {
275
	   	PROC_LOCK(p2);
233
	   	PROC_LOCK(p2);
276
	   	p2->p_flag |= P_PPWAIT;
234
	   	p2->p_flag |= P_PPWAIT;
Lines 286-292 Link Here
286
	thread_unlock(td2);
244
	thread_unlock(td2);
287
245
288
	td->td_retval[0] = p2->p_pid;
246
	td->td_retval[0] = p2->p_pid;
289
	td->td_retval[1] = 0;
290
247
291
	if (args->flags & LINUX_CLONE_VFORK) {
248
	if (args->flags & LINUX_CLONE_VFORK) {
292
		/* wait for the children to exit, ie. emulate vfork */
249
		/* wait for the children to exit, ie. emulate vfork */
Lines 298-300 Link Here
298
255
299
	return (0);
256
	return (0);
300
}
257
}
258
259
static int
260
linux_clone_thread(struct thread *td, struct linux_clone_args *args)
261
{
262
	struct linux_emuldata *em;
263
	struct thread *newtd;
264
	struct proc *p;
265
	int error;
266
267
#ifdef DEBUG
268
	if (ldebug(clone)) {
269
		printf(ARGS(clone, "thread: flags %x, stack %p, parent tid: %p, "
270
		    "child tid: %p"), (unsigned)args->flags,
271
		    args->stack, args->parent_tidptr, args->child_tidptr);
272
	}
273
#endif
274
275
	LINUX_CTR4(clone_thread, "thread(%d) flags %x ptid %p ctid %p",
276
	    td->td_tid, (unsigned)args->flags,
277
	    args->parent_tidptr, args->child_tidptr);
278
279
	if (args->flags & LINUX_CLONE_PARENT_SETTID)
280
		if (args->parent_tidptr == NULL)
281
			return (EINVAL);
282
283
	/* Threads should be created with own stack */
284
	if (args->stack == NULL)
285
		return (EINVAL);
286
287
	p = td->td_proc;
288
289
	/* Initialize our td */
290
	error = kern_thr_alloc(p, 0, &newtd);
291
	if (error)
292
		return (error);
293
														
294
	cpu_set_upcall(newtd, td);
295
296
	bzero(&newtd->td_startzero,
297
	    __rangeof(struct thread, td_startzero, td_endzero));
298
	bcopy(&td->td_startcopy, &newtd->td_startcopy,
299
	    __rangeof(struct thread, td_startcopy, td_endcopy));
300
301
	newtd->td_proc = p;
302
	newtd->td_ucred = crhold(td->td_ucred);
303
304
	/* create the emuldata */
305
	linux_proc_init(td, newtd, args->flags);
306
307
	em = em_find(newtd);
308
	KASSERT(em != NULL, ("clone_thread: emuldata not found.\n"));
309
310
	if (args->flags & LINUX_CLONE_SETTLS)
311
		linux_set_cloned_tls(newtd, args->tls);
312
313
	if (args->flags & LINUX_CLONE_CHILD_SETTID)
314
		em->child_set_tid = args->child_tidptr;
315
	else
316
	   	em->child_set_tid = NULL;
317
318
	if (args->flags & LINUX_CLONE_CHILD_CLEARTID)
319
		em->child_clear_tid = args->child_tidptr;
320
	else
321
	   	em->child_clear_tid = NULL;
322
323
	cpu_thread_clean(newtd);
324
	
325
	linux_set_upcall_kse(newtd, PTROUT(args->stack));
326
327
	PROC_LOCK(p);
328
	p->p_flag |= P_HADTHREADS;
329
	bcopy(p->p_comm, newtd->td_name, sizeof(newtd->td_name));
330
331
	if (args->flags & LINUX_CLONE_PARENT)
332
		thread_link(newtd, p->p_pptr);
333
	else
334
		thread_link(newtd, p);
335
336
	thread_lock(td);
337
	/* let the scheduler know about these things. */
338
	sched_fork_thread(td, newtd);
339
	thread_unlock(td);
340
	if (P_SHOULDSTOP(p))
341
		newtd->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK;
342
	PROC_UNLOCK(p);
343
344
	tidhash_add(newtd);
345
346
#ifdef DEBUG
347
	if (ldebug(clone))
348
		printf(ARGS(clone, "successful clone to %d, stack %p"),
349
		(int)newtd->td_tid, args->stack);
350
#endif
351
352
	LINUX_CTR2(clone_thread, "thread(%d) successful clone to %d",
353
	    td->td_tid, newtd->td_tid);
354
355
	if (args->flags & LINUX_CLONE_PARENT_SETTID) {
356
		error = copyout(&newtd->td_tid, args->parent_tidptr,
357
		    sizeof(newtd->td_tid));
358
		if (error)
359
			printf(LMSG("clone_thread: copyout failed!"));
360
	}
361
362
	/*
363
	 * Make this runnable after we are finished with it.
364
	 */
365
	thread_lock(newtd);
366
	TD_SET_CAN_RUN(newtd);
367
	sched_add(newtd, SRQ_BORING);
368
	thread_unlock(newtd);
369
370
	td->td_retval[0] = newtd->td_tid;
371
372
	return (0);
373
}
374
375
int
376
linux_clone(struct thread *td, struct linux_clone_args *args)
377
{
378
379
	if (args->flags & LINUX_CLONE_THREAD)
380
		return (linux_clone_thread(td, args));
381
	else
382
		return (linux_clone_proc(td, args));
383
}
384
385
int
386
linux_exit(struct thread *td, struct linux_exit_args *args)
387
{
388
	struct linux_emuldata *em;
389
	struct proc *p;
390
391
	em = em_find(td);
392
	KASSERT(em != NULL, ("exit: emuldata not found.\n"));
393
394
	LINUX_CTR2(exit, "thread(%d) (%d)", em->em_tid, args->rval);
395
396
	p = td->td_proc;
397
398
	linux_thread_detach(td);
399
400
	kern_thr_exit(td);
401
	exit1(td, W_EXITCODE(args->rval, 0));
402
		/* NOTREACHED */
403
}
404
405
int
406
linux_set_tid_address(struct thread *td, struct linux_set_tid_address_args *args)
407
{
408
	struct linux_emuldata *em;
409
410
	em = em_find(td);
411
	KASSERT(em != NULL, ("set_tid_address: emuldata not found.\n"));
412
413
	em->child_clear_tid = args->tidptr;
414
415
	td->td_retval[0] = em->em_tid;
416
417
	LINUX_CTR3(set_tid_address, "tidptr(%d) %p, returns %d",
418
	    em->em_tid, args->tidptr, td->td_retval[0]);
419
420
	return (0);
421
}
422
423
void
424
linux_thread_detach(struct thread *td)
425
{
426
	struct linux_sys_futex_args cup;
427
	struct linux_emuldata *em;
428
	int *child_clear_tid;
429
	int null = 0;
430
	int error;
431
432
	em = em_find(td);
433
	KASSERT(em != NULL, ("thread_detach: emuldata not found.\n"));
434
435
	if (em->flags & LINUX_THREAD_DETACHED) {
436
		LINUX_CTR1(thread_detach, "thread(%d) already detached", em->em_tid);
437
		return;
438
	}
439
440
	em->flags |= LINUX_THREAD_DETACHED;
441
	LINUX_CTR1(thread_detach, "thread(%d)", em->em_tid);
442
443
	release_futexes(td, em);
444
445
	child_clear_tid = em->child_clear_tid;
446
447
	if (child_clear_tid != NULL) {
448
449
		LINUX_CTR2(thread_detach, "thread(%d) %p",
450
		    em->em_tid, child_clear_tid);
451
	
452
		error = copyout(&null, child_clear_tid, sizeof(null));
453
		if (error)
454
			return;
455
456
		cup.uaddr = child_clear_tid;
457
		cup.op = LINUX_FUTEX_WAKE;
458
		cup.val = 1;		/* wake one */
459
		cup.timeout = NULL;
460
		cup.uaddr2 = NULL;
461
		cup.val3 = 0;
462
		error = linux_sys_futex(td, &cup);
463
		/*
464
		 * this cannot happen at the moment and if this happens it
465
		 * probably means there is a user space bug
466
		 */
467
		if (error)
468
			printf(LMSG("futex stuff in thread_detach failed.\n"));
469
	}
470
}
(-)sys/compat/linux/linux_futex.c (-66 / +78 lines)
Lines 66-80 Link Here
66
#include <compat/linux/linux_dtrace.h>
66
#include <compat/linux/linux_dtrace.h>
67
#include <compat/linux/linux_emul.h>
67
#include <compat/linux/linux_emul.h>
68
#include <compat/linux/linux_futex.h>
68
#include <compat/linux/linux_futex.h>
69
#include <compat/linux/linux_timer.h>
69
#include <compat/linux/linux_util.h>
70
#include <compat/linux/linux_util.h>
70
71
71
/* DTrace init */
72
/* DTrace init */
72
LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
73
LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
73
74
74
/* Linuxulator-global DTrace probes */
75
LIN_SDT_PROBE_DECLARE(locks, emul_lock, locked);
76
LIN_SDT_PROBE_DECLARE(locks, emul_lock, unlock);
77
78
/**
75
/**
79
 * Futex part for the special DTrace module "locks".
76
 * Futex part for the special DTrace module "locks".
80
 */
77
 */
Lines 175-182 Link Here
175
    "struct linux_get_robust_list_args *");
172
    "struct linux_get_robust_list_args *");
176
LIN_SDT_PROBE_DEFINE1(futex, linux_get_robust_list, copyout_error, "int");
173
LIN_SDT_PROBE_DEFINE1(futex, linux_get_robust_list, copyout_error, "int");
177
LIN_SDT_PROBE_DEFINE1(futex, linux_get_robust_list, return, "int");
174
LIN_SDT_PROBE_DEFINE1(futex, linux_get_robust_list, return, "int");
178
LIN_SDT_PROBE_DEFINE3(futex, handle_futex_death, entry, "struct proc *",
175
LIN_SDT_PROBE_DEFINE3(futex, handle_futex_death, entry,
179
    "uint32_t *", "unsigned int");
176
    "struct linux_emuldata *", "uint32_t *", "unsigned int");
180
LIN_SDT_PROBE_DEFINE1(futex, handle_futex_death, copyin_error, "int");
177
LIN_SDT_PROBE_DEFINE1(futex, handle_futex_death, copyin_error, "int");
181
LIN_SDT_PROBE_DEFINE1(futex, handle_futex_death, return, "int");
178
LIN_SDT_PROBE_DEFINE1(futex, handle_futex_death, return, "int");
182
LIN_SDT_PROBE_DEFINE3(futex, fetch_robust_entry, entry,
179
LIN_SDT_PROBE_DEFINE3(futex, fetch_robust_entry, entry,
Lines 184-196 Link Here
184
    "unsigned int *");
181
    "unsigned int *");
185
LIN_SDT_PROBE_DEFINE1(futex, fetch_robust_entry, copyin_error, "int");
182
LIN_SDT_PROBE_DEFINE1(futex, fetch_robust_entry, copyin_error, "int");
186
LIN_SDT_PROBE_DEFINE1(futex, fetch_robust_entry, return, "int");
183
LIN_SDT_PROBE_DEFINE1(futex, fetch_robust_entry, return, "int");
187
LIN_SDT_PROBE_DEFINE1(futex, release_futexes, entry, "struct proc *");
184
LIN_SDT_PROBE_DEFINE2(futex, release_futexes, entry, "struct thread *",
185
    "struct linux_emuldata *");
188
LIN_SDT_PROBE_DEFINE1(futex, release_futexes, copyin_error, "int");
186
LIN_SDT_PROBE_DEFINE1(futex, release_futexes, copyin_error, "int");
189
LIN_SDT_PROBE_DEFINE0(futex, release_futexes, return);
187
LIN_SDT_PROBE_DEFINE0(futex, release_futexes, return);
190
188
191
static MALLOC_DEFINE(M_FUTEX, "futex", "Linux futexes");
192
static MALLOC_DEFINE(M_FUTEX_WP, "futex wp", "Linux futexes wp");
193
194
struct futex;
189
struct futex;
195
190
196
struct waiting_proc {
191
struct waiting_proc {
Lines 253-258 Link Here
253
					 * wp_list to prevent double wakeup.
248
					 * wp_list to prevent double wakeup.
254
					 */
249
					 */
255
250
251
static void futex_put(struct futex *, struct waiting_proc *);
252
static int futex_get0(uint32_t *, struct futex **f, uint32_t);
253
static int futex_get(uint32_t *, struct waiting_proc **, struct futex **,
254
    uint32_t);
255
static int futex_sleep(struct futex *, struct waiting_proc *, int);
256
static int futex_wake(struct futex *, int, uint32_t);
257
static int futex_requeue(struct futex *, int, struct futex *, int);
258
static int futex_wait(struct futex *, struct waiting_proc *, int,
259
    uint32_t);
260
static int futex_atomic_op(struct thread *, int, uint32_t *);
261
static int handle_futex_death(struct linux_emuldata *, uint32_t *,
262
    unsigned int);
263
static int fetch_robust_entry(struct linux_robust_list **,
264
    struct linux_robust_list **, unsigned int *);
265
256
/* support.s */
266
/* support.s */
257
int futex_xchgl(int oparg, uint32_t *uaddr, int *oldval);
267
int futex_xchgl(int oparg, uint32_t *uaddr, int *oldval);
258
int futex_addl(int oparg, uint32_t *uaddr, int *oldval);
268
int futex_addl(int oparg, uint32_t *uaddr, int *oldval);
Lines 260-265 Link Here
260
int futex_andl(int oparg, uint32_t *uaddr, int *oldval);
270
int futex_andl(int oparg, uint32_t *uaddr, int *oldval);
261
int futex_xorl(int oparg, uint32_t *uaddr, int *oldval);
271
int futex_xorl(int oparg, uint32_t *uaddr, int *oldval);
262
272
273
263
static void
274
static void
264
futex_put(struct futex *f, struct waiting_proc *wp)
275
futex_put(struct futex *f, struct waiting_proc *wp)
265
{
276
{
Lines 657-666 Link Here
657
linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
668
linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
658
{
669
{
659
	int clockrt, nrwake, op_ret, ret;
670
	int clockrt, nrwake, op_ret, ret;
660
	struct linux_emuldata *em;
671
	struct linux_pemuldata *pem;
661
	struct waiting_proc *wp;
672
	struct waiting_proc *wp;
662
	struct futex *f, *f2;
673
	struct futex *f, *f2;
663
	struct l_timespec timeout;
674
	struct l_timespec ltimeout;
675
	struct timespec timeout;
664
	struct timeval utv, ctv;
676
	struct timeval utv, ctv;
665
	int timeout_hz;
677
	int timeout_hz;
666
	int error;
678
	int error;
Lines 704-709 Link Here
704
		LINUX_CTR3(sys_futex, "WAIT uaddr %p val 0x%x bitset 0x%x",
716
		LINUX_CTR3(sys_futex, "WAIT uaddr %p val 0x%x bitset 0x%x",
705
		    args->uaddr, args->val, args->val3);
717
		    args->uaddr, args->val, args->val3);
706
718
719
		if (args->timeout != NULL) {
720
			error = copyin(args->timeout, &ltimeout, sizeof(ltimeout));
721
			if (error) {
722
				LIN_SDT_PROBE1(futex, linux_sys_futex, copyin_error,
723
				    error);
724
				LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
725
				return (error);
726
			}
727
			error = linux_to_native_timespec(&timeout, &ltimeout);
728
			if (error)
729
				return (error);
730
			TIMESPEC_TO_TIMEVAL(&utv, &timeout);
731
			error = itimerfix(&utv);
732
			if (error) {
733
				LIN_SDT_PROBE1(futex, linux_sys_futex, itimerfix_error,
734
				    error);
735
				LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
736
				return (error);
737
			}
738
			if (clockrt) {
739
				microtime(&ctv);
740
				timevalsub(&utv, &ctv);
741
			} else if (args->op == LINUX_FUTEX_WAIT_BITSET) {
742
				microuptime(&ctv);
743
				timevalsub(&utv, &ctv);
744
			}
745
			if (utv.tv_sec < 0)
746
				timevalclear(&utv);
747
			timeout_hz = tvtohz(&utv);
748
		} else
749
			timeout_hz = 0;
750
707
		error = futex_get(args->uaddr, &wp, &f,
751
		error = futex_get(args->uaddr, &wp, &f,
708
		    flags | FUTEX_CREATE_WP);
752
		    flags | FUTEX_CREATE_WP);
709
		if (error) {
753
		if (error) {
Lines 736-772 Link Here
736
			return (EWOULDBLOCK);
780
			return (EWOULDBLOCK);
737
		}
781
		}
738
782
739
		if (args->timeout != NULL) {
740
			error = copyin(args->timeout, &timeout, sizeof(timeout));
741
			if (error) {
742
				LIN_SDT_PROBE1(futex, linux_sys_futex, copyin_error,
743
				    error);
744
				LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
745
				futex_put(f, wp);
746
				return (error);
747
			}
748
			TIMESPEC_TO_TIMEVAL(&utv, &timeout);
749
			error = itimerfix(&utv);
750
			if (error) {
751
				LIN_SDT_PROBE1(futex, linux_sys_futex, itimerfix_error,
752
				    error);
753
				LIN_SDT_PROBE1(futex, linux_sys_futex, return, error);
754
				futex_put(f, wp);
755
				return (error);
756
			}
757
			if (clockrt) {
758
				microtime(&ctv);
759
				timevalsub(&utv, &ctv);
760
			} else if (args->op == LINUX_FUTEX_WAIT_BITSET) {
761
				microuptime(&ctv);
762
				timevalsub(&utv, &ctv);
763
			}
764
			if (utv.tv_sec < 0)
765
				timevalclear(&utv);
766
			timeout_hz = tvtohz(&utv);
767
		} else
768
			timeout_hz = 0;
769
770
		error = futex_wait(f, wp, timeout_hz, args->val3);
783
		error = futex_wait(f, wp, timeout_hz, args->val3);
771
		break;
784
		break;
772
785
Lines 977-988 Link Here
977
		 * Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when
990
		 * Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when
978
		 * FUTEX_REQUEUE returned EINVAL.
991
		 * FUTEX_REQUEUE returned EINVAL.
979
		 */
992
		 */
980
		em = em_find(td->td_proc, EMUL_DONTLOCK);
993
		pem = pem_find(td->td_proc);
981
		if ((em->flags & LINUX_XDEPR_REQUEUEOP) == 0) {
994
		if ((pem->flags & LINUX_XDEPR_REQUEUEOP) == 0) {
982
			linux_msg(td,
995
			linux_msg(td,
983
				  "linux_sys_futex: "
996
				  "linux_sys_futex: "
984
				  "unsupported futex_requeue op\n");
997
				  "unsupported futex_requeue op\n");
985
			em->flags |= LINUX_XDEPR_REQUEUEOP;
998
			pem->flags |= LINUX_XDEPR_REQUEUEOP;
986
			LIN_SDT_PROBE0(futex, linux_sys_futex,
999
			LIN_SDT_PROBE0(futex, linux_sys_futex,
987
			    deprecated_requeue);
1000
			    deprecated_requeue);
988
		}
1001
		}
Lines 1036-1044 Link Here
1036
		return (EINVAL);
1049
		return (EINVAL);
1037
	}
1050
	}
1038
1051
1039
	em = em_find(td->td_proc, EMUL_DOLOCK);
1052
	em = em_find(td);
1040
	em->robust_futexes = args->head;
1053
	em->robust_futexes = args->head;
1041
	EMUL_UNLOCK(&emul_lock);
1042
1054
1043
	LIN_SDT_PROBE1(futex, linux_set_robust_list, return, 0);
1055
	LIN_SDT_PROBE1(futex, linux_set_robust_list, return, 0);
1044
	return (0);
1056
	return (0);
Lines 1050-1078 Link Here
1050
	struct linux_emuldata *em;
1062
	struct linux_emuldata *em;
1051
	struct linux_robust_list_head *head;
1063
	struct linux_robust_list_head *head;
1052
	l_size_t len = sizeof(struct linux_robust_list_head);
1064
	l_size_t len = sizeof(struct linux_robust_list_head);
1065
	struct thread *td2;
1053
	int error = 0;
1066
	int error = 0;
1054
1067
1055
	LIN_SDT_PROBE2(futex, linux_get_robust_list, entry, td, args);
1068
	LIN_SDT_PROBE2(futex, linux_get_robust_list, entry, td, args);
1056
1069
1057
	if (!args->pid) {
1070
	if (!args->pid) {
1058
		em = em_find(td->td_proc, EMUL_DONTLOCK);
1071
		em = em_find(td);
1072
		KASSERT(em != NULL, ("get_robust_list: emuldata notfound.\n"));
1059
		head = em->robust_futexes;
1073
		head = em->robust_futexes;
1060
	} else {
1074
	} else {
1061
		struct proc *p;
1075
		td2 = tdfind(args->pid, -1);
1062
1076
		if (td2 == NULL) {
1063
		p = pfind(args->pid);
1064
		if (p == NULL) {
1065
			LIN_SDT_PROBE1(futex, linux_get_robust_list, return,
1077
			LIN_SDT_PROBE1(futex, linux_get_robust_list, return,
1066
			    ESRCH);
1078
			    ESRCH);
1067
			return (ESRCH);
1079
			return (ESRCH);
1068
		}
1080
		}
1069
1081
1070
		em = em_find(p, EMUL_DONTLOCK);
1082
		em = em_find(td2);
1083
		KASSERT(em != NULL, ("get_robust_list: emuldata notfound.\n"));
1071
		/* XXX: ptrace? */
1084
		/* XXX: ptrace? */
1072
		if (priv_check(td, PRIV_CRED_SETUID) ||
1085
		if (priv_check(td, PRIV_CRED_SETUID) ||
1073
		    priv_check(td, PRIV_CRED_SETEUID) ||
1086
		    priv_check(td, PRIV_CRED_SETEUID) ||
1074
		    p_candebug(td, p)) {
1087
		    p_candebug(td, td2->td_proc)) {
1075
			PROC_UNLOCK(p);
1088
			PROC_UNLOCK(td2->td_proc);
1076
1089
1077
			LIN_SDT_PROBE1(futex, linux_get_robust_list, return,
1090
			LIN_SDT_PROBE1(futex, linux_get_robust_list, return,
1078
			    EPERM);
1091
			    EPERM);
Lines 1080-1086 Link Here
1080
		}
1093
		}
1081
		head = em->robust_futexes;
1094
		head = em->robust_futexes;
1082
1095
1083
		PROC_UNLOCK(p);
1096
		PROC_UNLOCK(td2->td_proc);
1084
	}
1097
	}
1085
1098
1086
	error = copyout(&len, args->len, sizeof(l_size_t));
1099
	error = copyout(&len, args->len, sizeof(l_size_t));
Lines 1102-1114 Link Here
1102
}
1115
}
1103
1116
1104
static int
1117
static int
1105
handle_futex_death(struct proc *p, uint32_t *uaddr, unsigned int pi)
1118
handle_futex_death(struct linux_emuldata *em, uint32_t *uaddr,
1119
    unsigned int pi)
1106
{
1120
{
1107
	uint32_t uval, nval, mval;
1121
	uint32_t uval, nval, mval;
1108
	struct futex *f;
1122
	struct futex *f;
1109
	int error;
1123
	int error;
1110
1124
1111
	LIN_SDT_PROBE3(futex, handle_futex_death, entry, p, uaddr, pi);
1125
	LIN_SDT_PROBE3(futex, handle_futex_death, entry, em, uaddr, pi);
1112
1126
1113
retry:
1127
retry:
1114
	error = copyin(uaddr, &uval, 4);
1128
	error = copyin(uaddr, &uval, 4);
Lines 1117-1123 Link Here
1117
		LIN_SDT_PROBE1(futex, handle_futex_death, return, EFAULT);
1131
		LIN_SDT_PROBE1(futex, handle_futex_death, return, EFAULT);
1118
		return (EFAULT);
1132
		return (EFAULT);
1119
	}
1133
	}
1120
	if ((uval & FUTEX_TID_MASK) == p->p_pid) {
1134
	if ((uval & FUTEX_TID_MASK) == em->em_tid) {
1121
		mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED;
1135
		mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED;
1122
		nval = casuword32(uaddr, uval, mval);
1136
		nval = casuword32(uaddr, uval, mval);
1123
1137
Lines 1174-1191 Link Here
1174
1188
1175
/* This walks the list of robust futexes releasing them. */
1189
/* This walks the list of robust futexes releasing them. */
1176
void
1190
void
1177
release_futexes(struct proc *p)
1191
release_futexes(struct thread *td, struct linux_emuldata *em)
1178
{
1192
{
1179
	struct linux_robust_list_head *head = NULL;
1193
	struct linux_robust_list_head *head = NULL;
1180
	struct linux_robust_list *entry, *next_entry, *pending;
1194
	struct linux_robust_list *entry, *next_entry, *pending;
1181
	unsigned int limit = 2048, pi, next_pi, pip;
1195
	unsigned int limit = 2048, pi, next_pi, pip;
1182
	struct linux_emuldata *em;
1183
	l_long futex_offset;
1196
	l_long futex_offset;
1184
	int rc, error;
1197
	int rc, error;
1185
1198
1186
	LIN_SDT_PROBE1(futex, release_futexes, entry, p);
1199
	LIN_SDT_PROBE2(futex, release_futexes, entry, td, em);
1187
1200
1188
	em = em_find(p, EMUL_DONTLOCK);
1189
	head = em->robust_futexes;
1201
	head = em->robust_futexes;
1190
1202
1191
	if (head == NULL) {
1203
	if (head == NULL) {
Lines 1215-1221 Link Here
1215
		rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi);
1227
		rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi);
1216
1228
1217
		if (entry != pending)
1229
		if (entry != pending)
1218
			if (handle_futex_death(p,
1230
			if (handle_futex_death(em,
1219
			    (uint32_t *)((caddr_t)entry + futex_offset), pi)) {
1231
			    (uint32_t *)((caddr_t)entry + futex_offset), pi)) {
1220
				LIN_SDT_PROBE0(futex, release_futexes, return);
1232
				LIN_SDT_PROBE0(futex, release_futexes, return);
1221
				return;
1233
				return;
Lines 1235-1241 Link Here
1235
	}
1247
	}
1236
1248
1237
	if (pending)
1249
	if (pending)
1238
		handle_futex_death(p, (uint32_t *)((caddr_t)pending + futex_offset), pip);
1250
		handle_futex_death(em, (uint32_t *)((caddr_t)pending + futex_offset), pip);
1239
1251
1240
	LIN_SDT_PROBE0(futex, release_futexes, return);
1252
	LIN_SDT_PROBE0(futex, release_futexes, return);
1241
}
1253
}
(-)sys/compat/linux/linux_futex.h (-1 / +2 lines)
Lines 76-81 Link Here
76
#define	FUTEX_TID_MASK		0x3fffffff
76
#define	FUTEX_TID_MASK		0x3fffffff
77
#define	FUTEX_BITSET_MATCH_ANY	0xffffffff
77
#define	FUTEX_BITSET_MATCH_ANY	0xffffffff
78
78
79
void	release_futexes(struct proc *);
79
void	release_futexes(struct thread *,
80
			struct linux_emuldata *);
80
81
81
#endif	/* !_LINUX_FUTEX_H */
82
#endif	/* !_LINUX_FUTEX_H */
(-)sys/compat/linux/linux_getcwd.c (-17 / +15 lines)
Lines 119-125 Link Here
119
	int     tries;
119
	int     tries;
120
	struct uio uio;
120
	struct uio uio;
121
	struct iovec iov;
121
	struct iovec iov;
122
	char   *dirbuf = NULL;
122
	char   *dirbuf;
123
	int	dirbuflen;
123
	int	dirbuflen;
124
	ino_t   fileno;
124
	ino_t   fileno;
125
	struct vattr va;
125
	struct vattr va;
Lines 139-145 Link Here
139
			vput(lvp);
139
			vput(lvp);
140
			*lvpp = NULL;
140
			*lvpp = NULL;
141
			*uvpp = NULL;
141
			*uvpp = NULL;
142
			return error;
142
			return (error);
143
		}
143
		}
144
	}
144
	}
145
145
Lines 170-176 Link Here
170
		vput(lvp);
170
		vput(lvp);
171
		*lvpp = NULL;
171
		*lvpp = NULL;
172
		*uvpp = NULL;
172
		*uvpp = NULL;
173
		return error;
173
		return (error);
174
	}
174
	}
175
	uvp = *uvpp;
175
	uvp = *uvpp;
176
176
Lines 178-184 Link Here
178
	if (bufp == NULL) {
178
	if (bufp == NULL) {
179
		vput(lvp);
179
		vput(lvp);
180
		*lvpp = NULL;
180
		*lvpp = NULL;
181
		return 0;
181
		return (0);
182
	}
182
	}
183
	
183
	
184
	fileno = va.va_fileid;
184
	fileno = va.va_fileid;
Lines 186-192 Link Here
186
	dirbuflen = DIRBLKSIZ;
186
	dirbuflen = DIRBLKSIZ;
187
	if (dirbuflen < va.va_blocksize)
187
	if (dirbuflen < va.va_blocksize)
188
		dirbuflen = va.va_blocksize;
188
		dirbuflen = va.va_blocksize;
189
	dirbuf = malloc(dirbuflen, M_TEMP, M_WAITOK);
189
	dirbuf = malloc(dirbuflen, M_LINUX, M_WAITOK);
190
190
191
#if 0
191
#if 0
192
unionread:
192
unionread:
Lines 228-234 Link Here
228
			continue;	/* once more, with feeling */
228
			continue;	/* once more, with feeling */
229
		}
229
		}
230
230
231
		if (!error) {
231
		if (error == 0) {
232
			char   *cpos;
232
			char   *cpos;
233
			struct dirent *dp;
233
			struct dirent *dp;
234
			
234
			
Lines 274-281 Link Here
274
out:
274
out:
275
	vput(lvp);
275
	vput(lvp);
276
	*lvpp = NULL;
276
	*lvpp = NULL;
277
	free(dirbuf, M_TEMP);
277
	free(dirbuf, M_LINUX);
278
	return error;
278
	return (error);
279
}
279
}
280
280
281
281
Lines 399-405 Link Here
399
	if (lvp)
399
	if (lvp)
400
		vput(lvp);
400
		vput(lvp);
401
	vrele(rvp);
401
	vrele(rvp);
402
	return error;
402
	return (error);
403
}
403
}
404
404
405
405
Lines 426-443 Link Here
426
	if (len > MAXPATHLEN*4)
426
	if (len > MAXPATHLEN*4)
427
		len = MAXPATHLEN*4;
427
		len = MAXPATHLEN*4;
428
	else if (len < 2)
428
	else if (len < 2)
429
		return ERANGE;
429
		return (ERANGE);
430
430
431
	path = malloc(len, M_TEMP, M_WAITOK);
431
	path = malloc(len, M_LINUX, M_WAITOK);
432
432
433
	error = kern___getcwd(td, path, UIO_SYSSPACE, len);
433
	error = kern___getcwd(td, path, UIO_SYSSPACE, len);
434
	if (!error) {
434
	if (error == 0) {
435
		lenused = strlen(path) + 1;
435
		lenused = strlen(path) + 1;
436
		if (lenused <= args->bufsize) {
436
		if (lenused <= args->bufsize) {
437
			td->td_retval[0] = lenused;
437
			td->td_retval[0] = lenused;
438
			error = copyout(path, args->buf, lenused);
438
			error = copyout(path, args->buf, lenused);
439
		}
439
		} else
440
		else
441
			error = ERANGE;
440
			error = ERANGE;
442
	} else {
441
	} else {
443
		bp = &path[len];
442
		bp = &path[len];
Lines 450-456 Link Here
450
		 * limit it to N/2 vnodes for an N byte buffer.
449
		 * limit it to N/2 vnodes for an N byte buffer.
451
		 */
450
		 */
452
451
453
		error = linux_getcwd_common (td->td_proc->p_fd->fd_cdir, NULL,
452
		error = linux_getcwd_common(td->td_proc->p_fd->fd_cdir, NULL,
454
		    &bp, path, len/2, GETCWD_CHECK_ACCESS, td);
453
		    &bp, path, len/2, GETCWD_CHECK_ACCESS, td);
455
		if (error)
454
		if (error)
456
			goto out;
455
			goto out;
Lines 460-466 Link Here
460
		error = copyout(bp, args->buf, lenused);
459
		error = copyout(bp, args->buf, lenused);
461
	}
460
	}
462
out:
461
out:
463
	free(path, M_TEMP);
462
	free(path, M_LINUX);
464
	return (error);
463
	return (error);
465
}
464
}
466
(-)sys/compat/linux/linux_ioctl.c (-39 / +20 lines)
Lines 68-74 Link Here
68
#include <net/if.h>
68
#include <net/if.h>
69
#include <net/if_dl.h>
69
#include <net/if_dl.h>
70
#include <net/if_types.h>
70
#include <net/if_types.h>
71
#include <net/vnet.h>
72
71
73
#include <dev/usb/usb_ioctl.h>
72
#include <dev/usb/usb_ioctl.h>
74
73
Lines 95-103 Link Here
95
94
96
CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ);
95
CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ);
97
96
98
FEATURE(linuxulator_v4l, "V4L ioctl wrapper support in the linuxulator");
99
FEATURE(linuxulator_v4l2, "V4L2 ioctl wrapper support in the linuxulator");
100
101
static linux_ioctl_function_t linux_ioctl_cdrom;
97
static linux_ioctl_function_t linux_ioctl_cdrom;
102
static linux_ioctl_function_t linux_ioctl_vfat;
98
static linux_ioctl_function_t linux_ioctl_vfat;
103
static linux_ioctl_function_t linux_ioctl_console;
99
static linux_ioctl_function_t linux_ioctl_console;
Lines 1980-1987 Link Here
1980
 * Console related ioctls
1976
 * Console related ioctls
1981
 */
1977
 */
1982
1978
1983
#define ISSIGVALID(sig)		((sig) > 0 && (sig) < NSIG)
1984
1985
static int
1979
static int
1986
linux_ioctl_console(struct thread *td, struct linux_ioctl_args *args)
1980
linux_ioctl_console(struct thread *td, struct linux_ioctl_args *args)
1987
{
1981
{
Lines 2064-2071 Link Here
2064
		struct vt_mode mode;
2058
		struct vt_mode mode;
2065
		if ((error = copyin((void *)args->arg, &mode, sizeof(mode))))
2059
		if ((error = copyin((void *)args->arg, &mode, sizeof(mode))))
2066
			break;
2060
			break;
2067
		if (!ISSIGVALID(mode.frsig) && ISSIGVALID(mode.acqsig))
2061
		if (LINUX_SIG_VALID(mode.relsig))
2068
			mode.frsig = mode.acqsig;
2062
			mode.relsig = linux_to_bsd_signal(mode.relsig);
2063
		else
2064
			mode.relsig = 0;
2065
		if (LINUX_SIG_VALID(mode.acqsig))
2066
			mode.acqsig = linux_to_bsd_signal(mode.acqsig);
2067
		else
2068
			mode.acqsig = 0;
2069
		/* XXX. Linux ignores frsig and set it to 0. */
2070
		mode.frsig = 0;
2069
		if ((error = copyout(&mode, (void *)args->arg, sizeof(mode))))
2071
		if ((error = copyout(&mode, (void *)args->arg, sizeof(mode))))
2070
			break;
2072
			break;
2071
		args->cmd = VT_SETMODE;
2073
		args->cmd = VT_SETMODE;
Lines 2108-2141 Link Here
2108
#define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER)
2110
#define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER)
2109
2111
2110
/*
2112
/*
2111
 * Interface function used by linprocfs (at the time of writing). It's not
2112
 * used by the Linuxulator itself.
2113
 */
2114
int
2115
linux_ifname(struct ifnet *ifp, char *buffer, size_t buflen)
2116
{
2117
	struct ifnet *ifscan;
2118
	int ethno;
2119
2120
	IFNET_RLOCK_ASSERT();
2121
2122
	/* Short-circuit non ethernet interfaces */
2123
	if (!IFP_IS_ETH(ifp))
2124
		return (strlcpy(buffer, ifp->if_xname, buflen));
2125
2126
	/* Determine the (relative) unit number for ethernet interfaces */
2127
	ethno = 0;
2128
	TAILQ_FOREACH(ifscan, &V_ifnet, if_link) {
2129
		if (ifscan == ifp)
2130
			return (snprintf(buffer, buflen, "eth%d", ethno));
2131
		if (IFP_IS_ETH(ifscan))
2132
			ethno++;
2133
	}
2134
2135
	return (0);
2136
}
2137
2138
/*
2139
 * Translate a Linux interface name to a FreeBSD interface name,
2113
 * Translate a Linux interface name to a FreeBSD interface name,
2140
 * and return the associated ifnet structure
2114
 * and return the associated ifnet structure
2141
 * bsdname and lxname need to be least IFNAMSIZ bytes long, but
2115
 * bsdname and lxname need to be least IFNAMSIZ bytes long, but
Lines 3621-3630 Link Here
3621
	sx_sunlock(&linux_ioctl_sx);
3595
	sx_sunlock(&linux_ioctl_sx);
3622
	fdrop(fp, td);
3596
	fdrop(fp, td);
3623
3597
3624
	linux_msg(td, "ioctl fd=%d, cmd=0x%x ('%c',%d) is not implemented",
3598
	switch (args->cmd & 0xffff) {
3625
	    args->fd, (int)(args->cmd & 0xffff),
3599
	case LINUX_BTRFS_IOC_CLONE:
3626
	    (int)(args->cmd & 0xff00) >> 8, (int)(args->cmd & 0xff));
3600
		return (ENOTSUP);
3627
3601
3602
	default:
3603
		linux_msg(td, "ioctl fd=%d, cmd=0x%x ('%c',%d) is not implemented",
3604
		    args->fd, (int)(args->cmd & 0xffff),
3605
		    (int)(args->cmd & 0xff00) >> 8, (int)(args->cmd & 0xff));
3606
		break;
3607
	}
3608
3628
	return (EINVAL);
3609
	return (EINVAL);
3629
}
3610
}
3630
3611
(-)sys/compat/linux/linux_ioctl.h (-7 / +6 lines)
Lines 581-593 Link Here
581
#define	LINUX_IOCTL_DRM_MAX	0x64ff
581
#define	LINUX_IOCTL_DRM_MAX	0x64ff
582
582
583
/*
583
/*
584
 * This doesn't really belong here, but I can't think of a better
585
 * place to put it.
586
 */
587
struct ifnet;
588
int		 linux_ifname(struct ifnet *, char *, size_t);
589
590
/*
591
 * video
584
 * video
592
 */
585
 */
593
#define LINUX_VIDIOCGCAP		0x7601
586
#define LINUX_VIDIOCGCAP		0x7601
Lines 752-757 Link Here
752
#define	FBSD_LUSB_MIN			0xffdd
745
#define	FBSD_LUSB_MIN			0xffdd
753
746
754
/*
747
/*
748
 * Linux btrfs clone operation
749
 */
750
#define LINUX_BTRFS_IOC_CLONE		0x9409 /* 0x40049409 */
751
752
753
/*
755
 * Pluggable ioctl handlers
754
 * Pluggable ioctl handlers
756
 */
755
 */
757
struct linux_ioctl_args;
756
struct linux_ioctl_args;
(-)sys/compat/linux/linux_ipc.c (-10 lines)
Lines 117-132 Link Here
117
	lpp->swap_successes = bpp->swap_successes ;
117
	lpp->swap_successes = bpp->swap_successes ;
118
}
118
}
119
119
120
struct l_ipc_perm {
121
	l_key_t		key;
122
	l_uid16_t	uid;
123
	l_gid16_t	gid;
124
	l_uid16_t	cuid;
125
	l_gid16_t	cgid;
126
	l_ushort	mode;
127
	l_ushort	seq;
128
};
129
130
static void
120
static void
131
linux_to_bsd_ipc_perm(struct l_ipc_perm *lpp, struct ipc_perm *bpp)
121
linux_to_bsd_ipc_perm(struct l_ipc_perm *lpp, struct ipc_perm *bpp)
132
{
122
{
(-)sys/compat/linux/linux_ipc.h (-2 / +2 lines)
Lines 82-88 Link Here
82
#define	LINUX_IPC_64	0x0100	/* New version (support 32-bit UIDs, bigger
82
#define	LINUX_IPC_64	0x0100	/* New version (support 32-bit UIDs, bigger
83
				   message sizes, etc. */
83
				   message sizes, etc. */
84
84
85
#if defined(__i386__) || defined(__amd64__)
85
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
86
86
87
struct linux_msgctl_args 
87
struct linux_msgctl_args 
88
{
88
{
Lines 177-182 Link Here
177
int linux_shmdt(struct thread *, struct linux_shmdt_args *);
177
int linux_shmdt(struct thread *, struct linux_shmdt_args *);
178
int linux_shmget(struct thread *, struct linux_shmget_args *);
178
int linux_shmget(struct thread *, struct linux_shmget_args *);
179
179
180
#endif	/* __i386__ || __amd64__ */
180
#endif	/* __i386__ || (__amd64__ && COMPAT_LINUX32) */
181
181
182
#endif /* _LINUX_IPC_H_ */
182
#endif /* _LINUX_IPC_H_ */
(-)sys/compat/linux/linux_mib.c (-333 / +34 lines)
Lines 29-37 Link Here
29
#include <sys/cdefs.h>
29
#include <sys/cdefs.h>
30
__FBSDID("$FreeBSD$");
30
__FBSDID("$FreeBSD$");
31
31
32
#include "opt_compat.h"
33
#include "opt_kdtrace.h"
34
35
#include <sys/param.h>
32
#include <sys/param.h>
36
#include <sys/kernel.h>
33
#include <sys/kernel.h>
37
#include <sys/sdt.h>
34
#include <sys/sdt.h>
Lines 42-126 Link Here
42
#include <sys/mount.h>
39
#include <sys/mount.h>
43
#include <sys/jail.h>
40
#include <sys/jail.h>
44
#include <sys/lock.h>
41
#include <sys/lock.h>
45
#include <sys/mutex.h>
46
#include <sys/sx.h>
42
#include <sys/sx.h>
47
43
48
#ifdef COMPAT_LINUX32
49
#include <machine/../linux32/linux.h>
50
#else
51
#include <machine/../linux/linux.h>
52
#endif
53
#include <compat/linux/linux_dtrace.h>
54
#include <compat/linux/linux_mib.h>
44
#include <compat/linux/linux_mib.h>
55
#include <compat/linux/linux_misc.h>
45
#include <compat/linux/linux_misc.h>
56
46
57
/* DTrace init */
58
LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
59
60
/**
61
 * DTrace probes in this module.
62
 */
63
LIN_SDT_PROBE_DEFINE0(mib, linux_sysctl_osname, entry);
64
LIN_SDT_PROBE_DEFINE1(mib, linux_sysctl_osname, sysctl_string_error, "int");
65
LIN_SDT_PROBE_DEFINE1(mib, linux_sysctl_osname, return, "int");
66
67
LIN_SDT_PROBE_DEFINE0(mib, linux_sysctl_osrelease, entry);
68
LIN_SDT_PROBE_DEFINE1(mib, linux_sysctl_osrelease, sysctl_string_error, "int");
69
LIN_SDT_PROBE_DEFINE1(mib, linux_sysctl_osrelease, return, "int");
70
LIN_SDT_PROBE_DEFINE0(mib, linux_sysctl_oss_version, entry);
71
LIN_SDT_PROBE_DEFINE1(mib, linux_sysctl_oss_version, sysctl_string_error,
72
    "int");
73
LIN_SDT_PROBE_DEFINE1(mib, linux_sysctl_oss_version, return, "int");
74
LIN_SDT_PROBE_DEFINE2(mib, linux_map_osrel, entry, "char *", "int *");
75
LIN_SDT_PROBE_DEFINE1(mib, linux_map_osrel, return, "int");
76
LIN_SDT_PROBE_DEFINE2(mib, linux_get_prison, entry, "struct prison *",
77
    "struct prison **");
78
LIN_SDT_PROBE_DEFINE1(mib, linux_get_prison, return, "struct linux_prison *");
79
LIN_SDT_PROBE_DEFINE2(mib, linux_alloc_prison, entry, "struct prison *",
80
    "struct linux_prison **");
81
LIN_SDT_PROBE_DEFINE1(mib, linux_alloc_prison, return, "int");
82
LIN_SDT_PROBE_DEFINE2(mib, linux_prison_create, entry, "void *", "void *");
83
LIN_SDT_PROBE_DEFINE1(mib, linux_prison_create, vfs_copyopt_error, "int");
84
LIN_SDT_PROBE_DEFINE1(mib, linux_prison_create, return, "int");
85
LIN_SDT_PROBE_DEFINE2(mib, linux_prison_check, entry, "void *", "void *");
86
LIN_SDT_PROBE_DEFINE1(mib, linux_prison_check, vfs_copyopt_error, "int");
87
LIN_SDT_PROBE_DEFINE1(mib, linux_prison_check, vfs_getopt_error, "int");
88
LIN_SDT_PROBE_DEFINE1(mib, linux_prison_check, return, "int");
89
LIN_SDT_PROBE_DEFINE2(mib, linux_prison_set, entry, "void *", "void *");
90
LIN_SDT_PROBE_DEFINE1(mib, linux_prison_set, vfs_copyopt_error, "int");
91
LIN_SDT_PROBE_DEFINE1(mib, linux_prison_set, vfs_getopt_error, "int");
92
LIN_SDT_PROBE_DEFINE1(mib, linux_prison_set, return, "int");
93
LIN_SDT_PROBE_DEFINE2(mib, linux_prison_get, entry, "void *", "void *");
94
LIN_SDT_PROBE_DEFINE1(mib, linux_prison_get, vfs_setopt_error, "int");
95
LIN_SDT_PROBE_DEFINE1(mib, linux_prison_get, vfs_setopts_error, "int");
96
LIN_SDT_PROBE_DEFINE1(mib, linux_prison_get, return, "int");
97
LIN_SDT_PROBE_DEFINE1(mib, linux_prison_destructor, entry, "void *");
98
LIN_SDT_PROBE_DEFINE0(mib, linux_prison_destructor, return);
99
LIN_SDT_PROBE_DEFINE0(mib, linux_osd_jail_register, entry);
100
LIN_SDT_PROBE_DEFINE0(mib, linux_osd_jail_register, return);
101
LIN_SDT_PROBE_DEFINE0(mib, linux_osd_jail_deregister, entry);
102
LIN_SDT_PROBE_DEFINE0(mib, linux_osd_jail_deregister, return);
103
LIN_SDT_PROBE_DEFINE2(mib, linux_get_osname, entry, "struct thread *",
104
    "char *");
105
LIN_SDT_PROBE_DEFINE0(mib, linux_get_osname, return);
106
LIN_SDT_PROBE_DEFINE2(mib, linux_set_osname, entry, "struct thread *",
107
    "char *");
108
LIN_SDT_PROBE_DEFINE1(mib, linux_set_osname, return, "int");
109
LIN_SDT_PROBE_DEFINE2(mib, linux_get_osrelease, entry, "struct thread *",
110
    "char *");
111
LIN_SDT_PROBE_DEFINE0(mib, linux_get_osrelease, return);
112
LIN_SDT_PROBE_DEFINE1(mib, linux_kernver, entry, "struct thread *");
113
LIN_SDT_PROBE_DEFINE1(mib, linux_kernver, return, "int");
114
LIN_SDT_PROBE_DEFINE2(mib, linux_set_osrelease, entry, "struct thread *",
115
    "char *");
116
LIN_SDT_PROBE_DEFINE1(mib, linux_set_osrelease, return, "int");
117
LIN_SDT_PROBE_DEFINE1(mib, linux_get_oss_version, entry, "struct thread *");
118
LIN_SDT_PROBE_DEFINE1(mib, linux_get_oss_version, return, "int");
119
120
LIN_SDT_PROBE_DEFINE2(mib, linux_set_oss_version, entry, "struct thread *",
121
    "int");
122
LIN_SDT_PROBE_DEFINE1(mib, linux_set_oss_version, return, "int");
123
124
struct linux_prison {
47
struct linux_prison {
125
	char	pr_osname[LINUX_MAX_UTSNAME];
48
	char	pr_osname[LINUX_MAX_UTSNAME];
126
	char	pr_osrelease[LINUX_MAX_UTSNAME];
49
	char	pr_osrelease[LINUX_MAX_UTSNAME];
Lines 130-144 Link Here
130
53
131
static struct linux_prison lprison0 = {
54
static struct linux_prison lprison0 = {
132
	.pr_osname =		"Linux",
55
	.pr_osname =		"Linux",
133
	.pr_osrelease =		"2.6.18",
56
	.pr_osrelease =		LINUX_VERSION_STR,
134
	.pr_oss_version =	0x030600,
57
	.pr_oss_version =	0x030600,
135
	.pr_osrel =		2006018
58
	.pr_osrel =		LINUX_VERSION_CODE
136
};
59
};
137
60
138
static unsigned linux_osd_jail_slot;
61
static unsigned linux_osd_jail_slot;
139
62
140
static SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 0,
63
SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 0, "Linux mode");
141
	    "Linux mode");
142
64
143
static int	linux_set_osname(struct thread *td, char *osname);
65
static int	linux_set_osname(struct thread *td, char *osname);
144
static int	linux_set_osrelease(struct thread *td, char *osrelease);
66
static int	linux_set_osrelease(struct thread *td, char *osrelease);
Lines 150-168 Link Here
150
	char osname[LINUX_MAX_UTSNAME];
72
	char osname[LINUX_MAX_UTSNAME];
151
	int error;
73
	int error;
152
74
153
	LIN_SDT_PROBE0(mib, linux_sysctl_osname, entry);
154
155
	linux_get_osname(req->td, osname);
75
	linux_get_osname(req->td, osname);
156
	error = sysctl_handle_string(oidp, osname, LINUX_MAX_UTSNAME, req);
76
	error = sysctl_handle_string(oidp, osname, LINUX_MAX_UTSNAME, req);
157
	if (error != 0 || req->newptr == NULL) {
77
	if (error != 0 || req->newptr == NULL)
158
		LIN_SDT_PROBE1(mib, linux_sysctl_osname, sysctl_string_error,
159
		    error);
160
		LIN_SDT_PROBE1(mib, linux_sysctl_osname, return, error);
161
		return (error);
78
		return (error);
162
	}
163
	error = linux_set_osname(req->td, osname);
79
	error = linux_set_osname(req->td, osname);
164
80
165
	LIN_SDT_PROBE1(mib, linux_sysctl_osname, return, error);
166
	return (error);
81
	return (error);
167
}
82
}
168
83
Lines 177-195 Link Here
177
	char osrelease[LINUX_MAX_UTSNAME];
92
	char osrelease[LINUX_MAX_UTSNAME];
178
	int error;
93
	int error;
179
94
180
	LIN_SDT_PROBE0(mib, linux_sysctl_osrelease, entry);
181
182
	linux_get_osrelease(req->td, osrelease);
95
	linux_get_osrelease(req->td, osrelease);
183
	error = sysctl_handle_string(oidp, osrelease, LINUX_MAX_UTSNAME, req);
96
	error = sysctl_handle_string(oidp, osrelease, LINUX_MAX_UTSNAME, req);
184
	if (error != 0 || req->newptr == NULL) {
97
	if (error != 0 || req->newptr == NULL)
185
		LIN_SDT_PROBE1(mib, linux_sysctl_osrelease, sysctl_string_error,
186
		    error);
187
		LIN_SDT_PROBE1(mib, linux_sysctl_osrelease, return, error);
188
		return (error);
98
		return (error);
189
	}
190
	error = linux_set_osrelease(req->td, osrelease);
99
	error = linux_set_osrelease(req->td, osrelease);
191
100
192
	LIN_SDT_PROBE1(mib, linux_sysctl_osrelease, return, error);
193
	return (error);
101
	return (error);
194
}
102
}
195
103
Lines 204-222 Link Here
204
	int oss_version;
112
	int oss_version;
205
	int error;
113
	int error;
206
114
207
	LIN_SDT_PROBE0(mib, linux_sysctl_oss_version, entry);
208
209
	oss_version = linux_get_oss_version(req->td);
115
	oss_version = linux_get_oss_version(req->td);
210
	error = sysctl_handle_int(oidp, &oss_version, 0, req);
116
	error = sysctl_handle_int(oidp, &oss_version, 0, req);
211
	if (error != 0 || req->newptr == NULL) {
117
	if (error != 0 || req->newptr == NULL)
212
		LIN_SDT_PROBE1(mib, linux_sysctl_oss_version,
213
		    sysctl_string_error, error);
214
		LIN_SDT_PROBE1(mib, linux_sysctl_oss_version, return, error);
215
		return (error);
118
		return (error);
216
	}
217
	error = linux_set_oss_version(req->td, oss_version);
119
	error = linux_set_oss_version(req->td, oss_version);
218
120
219
	LIN_SDT_PROBE1(mib, linux_sysctl_oss_version, return, error);
220
	return (error);
121
	return (error);
221
}
122
}
222
123
Lines 234-270 Link Here
234
	char *sep, *eosrelease;
135
	char *sep, *eosrelease;
235
	int len, v0, v1, v2, v;
136
	int len, v0, v1, v2, v;
236
137
237
	LIN_SDT_PROBE2(mib, linux_map_osrel, entry, osrelease, osrel);
238
239
	len = strlen(osrelease);
138
	len = strlen(osrelease);
240
	eosrelease = osrelease + len;
139
	eosrelease = osrelease + len;
241
	v0 = strtol(osrelease, &sep, 10);
140
	v0 = strtol(osrelease, &sep, 10);
242
	if (osrelease == sep || sep + 1 >= eosrelease || *sep != '.') {
141
	if (osrelease == sep || sep + 1 >= eosrelease || *sep != '.')
243
		LIN_SDT_PROBE1(mib, linux_map_osrel, return, EINVAL);
244
		return (EINVAL);
142
		return (EINVAL);
245
	}
246
	osrelease = sep + 1;
143
	osrelease = sep + 1;
247
	v1 = strtol(osrelease, &sep, 10);
144
	v1 = strtol(osrelease, &sep, 10);
248
	if (osrelease == sep || sep + 1 >= eosrelease || *sep != '.') {
145
	if (osrelease == sep || sep + 1 >= eosrelease || *sep != '.')
249
		LIN_SDT_PROBE1(mib, linux_map_osrel, return, EINVAL);
250
		return (EINVAL);
146
		return (EINVAL);
251
	}
252
	osrelease = sep + 1;
147
	osrelease = sep + 1;
253
	v2 = strtol(osrelease, &sep, 10);
148
	v2 = strtol(osrelease, &sep, 10);
254
	if (osrelease == sep || sep != eosrelease) {
149
	if (osrelease == sep || sep != eosrelease)
255
		LIN_SDT_PROBE1(mib, linux_map_osrel, return, EINVAL);
256
		return (EINVAL);
150
		return (EINVAL);
257
	}
258
151
259
	v = v0 * 1000000 + v1 * 1000 + v2;
152
	v = v0 * 1000000 + v1 * 1000 + v2;
260
	if (v < 1000000) {
153
	if (v < 1000000)
261
		LIN_SDT_PROBE1(mib, linux_map_osrel, return, EINVAL);
262
		return (EINVAL);
154
		return (EINVAL);
263
	}
264
155
265
	*osrel = v;
156
	*osrel = v;
266
157
267
	LIN_SDT_PROBE1(mib, linux_map_osrel, return, 0);
268
	return (0);
158
	return (0);
269
}
159
}
270
160
Lines 278-285 Link Here
278
	struct prison *pr;
168
	struct prison *pr;
279
	struct linux_prison *lpr;
169
	struct linux_prison *lpr;
280
170
281
	LIN_SDT_PROBE2(mib, linux_get_prison, entry, spr, prp);
282
283
	if (!linux_osd_jail_slot)
171
	if (!linux_osd_jail_slot)
284
		/* In case osd_register failed. */
172
		/* In case osd_register failed. */
285
		spr = &prison0;
173
		spr = &prison0;
Lines 294-300 Link Here
294
	}
182
	}
295
	*prp = pr;
183
	*prp = pr;
296
184
297
	LIN_SDT_PROBE1(mib, linux_get_prison, return, lpr);
298
	return (lpr);
185
	return (lpr);
299
}
186
}
300
187
Lines 309-316 Link Here
309
	struct linux_prison *lpr, *nlpr;
196
	struct linux_prison *lpr, *nlpr;
310
	int error;
197
	int error;
311
198
312
	LIN_SDT_PROBE2(mib, linux_alloc_prison, entry, pr, lprp);
313
314
	/* If this prison already has Linux info, return that. */
199
	/* If this prison already has Linux info, return that. */
315
	error = 0;
200
	error = 0;
316
	lpr = linux_find_prison(pr, &ppr);
201
	lpr = linux_find_prison(pr, &ppr);
Lines 344-350 Link Here
344
	else
229
	else
345
		mtx_unlock(&pr->pr_mtx);
230
		mtx_unlock(&pr->pr_mtx);
346
231
347
	LIN_SDT_PROBE1(mib, linux_alloc_prison, return, error);
348
	return (error);
232
	return (error);
349
}
233
}
350
234
Lines 356-381 Link Here
356
{
240
{
357
	struct prison *pr = obj;
241
	struct prison *pr = obj;
358
	struct vfsoptlist *opts = data;
242
	struct vfsoptlist *opts = data;
359
	int jsys, error;
243
	int jsys;
360
244
361
	LIN_SDT_PROBE2(mib, linux_prison_create, entry, obj, data);
245
	if (vfs_copyopt(opts, "linux", &jsys, sizeof(jsys)) == 0 &&
362
246
	    jsys == JAIL_SYS_INHERIT)
363
	error = vfs_copyopt(opts, "linux", &jsys, sizeof(jsys));
364
	if (error != 0) {
365
		LIN_SDT_PROBE1(mib, linux_prison_create, vfs_copyopt_error,
366
		    error);
367
	} else if (jsys == JAIL_SYS_INHERIT) {
368
		LIN_SDT_PROBE1(mib, linux_prison_create, return, 0);
369
		return (0);
247
		return (0);
370
	}
371
	/*
248
	/*
372
	 * Inherit a prison's initial values from its parent
249
	 * Inherit a prison's initial values from its parent
373
	 * (different from JAIL_SYS_INHERIT which also inherits changes).
250
	 * (different from JAIL_SYS_INHERIT which also inherits changes).
374
	 */
251
	 */
375
	error = linux_alloc_prison(pr, NULL);
252
	return (linux_alloc_prison(pr, NULL));
376
377
	LIN_SDT_PROBE1(mib, linux_prison_create, return, error);
378
	return (error);
379
}
253
}
380
254
381
static int
255
static int
Lines 385-464 Link Here
385
	char *osname, *osrelease;
259
	char *osname, *osrelease;
386
	int error, jsys, len, osrel, oss_version;
260
	int error, jsys, len, osrel, oss_version;
387
261
388
	LIN_SDT_PROBE2(mib, linux_prison_check, entry, obj, data);
389
390
	/* Check that the parameters are correct. */
262
	/* Check that the parameters are correct. */
391
	error = vfs_copyopt(opts, "linux", &jsys, sizeof(jsys));
263
	error = vfs_copyopt(opts, "linux", &jsys, sizeof(jsys));
392
	if (error != 0) {
393
		LIN_SDT_PROBE1(mib, linux_prison_check, vfs_copyopt_error,
394
		    error);
395
	}
396
	if (error != ENOENT) {
264
	if (error != ENOENT) {
397
		if (error != 0) {
265
		if (error != 0)
398
			LIN_SDT_PROBE1(mib, linux_prison_check, return, error);
399
			return (error);
266
			return (error);
400
		}
267
		if (jsys != JAIL_SYS_NEW && jsys != JAIL_SYS_INHERIT)
401
		if (jsys != JAIL_SYS_NEW && jsys != JAIL_SYS_INHERIT) {
402
			LIN_SDT_PROBE1(mib, linux_prison_check, return, EINVAL);
403
			return (EINVAL);
268
			return (EINVAL);
404
		}
405
	}
269
	}
406
	error = vfs_getopt(opts, "linux.osname", (void **)&osname, &len);
270
	error = vfs_getopt(opts, "linux.osname", (void **)&osname, &len);
407
	if (error != 0) {
408
		LIN_SDT_PROBE1(mib, linux_prison_check, vfs_getopt_error,
409
		    error);
410
	}
411
	if (error != ENOENT) {
271
	if (error != ENOENT) {
412
		if (error != 0) {
272
		if (error != 0)
413
			LIN_SDT_PROBE1(mib, linux_prison_check, return, error);
414
			return (error);
273
			return (error);
415
		}
274
		if (len == 0 || osname[len - 1] != '\0')
416
		if (len == 0 || osname[len - 1] != '\0') {
417
			LIN_SDT_PROBE1(mib, linux_prison_check, return, EINVAL);
418
			return (EINVAL);
275
			return (EINVAL);
419
		}
420
		if (len > LINUX_MAX_UTSNAME) {
276
		if (len > LINUX_MAX_UTSNAME) {
421
			vfs_opterror(opts, "linux.osname too long");
277
			vfs_opterror(opts, "linux.osname too long");
422
			LIN_SDT_PROBE1(mib, linux_prison_check, return,
423
			    ENAMETOOLONG);
424
			return (ENAMETOOLONG);
278
			return (ENAMETOOLONG);
425
		}
279
		}
426
	}
280
	}
427
	error = vfs_getopt(opts, "linux.osrelease", (void **)&osrelease, &len);
281
	error = vfs_getopt(opts, "linux.osrelease", (void **)&osrelease, &len);
428
	if (error != 0) {
429
		LIN_SDT_PROBE1(mib, linux_prison_check, vfs_getopt_error,
430
		    error);
431
	}
432
	if (error != ENOENT) {
282
	if (error != ENOENT) {
433
		if (error != 0) {
283
		if (error != 0)
434
			LIN_SDT_PROBE1(mib, linux_prison_check, return, error);
435
			return (error);
284
			return (error);
436
		}
285
		if (len == 0 || osrelease[len - 1] != '\0')
437
		if (len == 0 || osrelease[len - 1] != '\0') {
438
			LIN_SDT_PROBE1(mib, linux_prison_check, return, EINVAL);
439
			return (EINVAL);
286
			return (EINVAL);
440
		}
441
		if (len > LINUX_MAX_UTSNAME) {
287
		if (len > LINUX_MAX_UTSNAME) {
442
			vfs_opterror(opts, "linux.osrelease too long");
288
			vfs_opterror(opts, "linux.osrelease too long");
443
			LIN_SDT_PROBE1(mib, linux_prison_check, return,
444
			    ENAMETOOLONG);
445
			return (ENAMETOOLONG);
289
			return (ENAMETOOLONG);
446
		}
290
		}
447
		error = linux_map_osrel(osrelease, &osrel);
291
		error = linux_map_osrel(osrelease, &osrel);
448
		if (error != 0) {
292
		if (error != 0) {
449
			vfs_opterror(opts, "linux.osrelease format error");
293
			vfs_opterror(opts, "linux.osrelease format error");
450
			LIN_SDT_PROBE1(mib, linux_prison_check, return, error);
451
			return (error);
294
			return (error);
452
		}
295
		}
453
	}
296
	}
454
	error = vfs_copyopt(opts, "linux.oss_version", &oss_version,
297
	error = vfs_copyopt(opts, "linux.oss_version", &oss_version,
455
	    sizeof(oss_version));
298
	    sizeof(oss_version));
456
	if (error != 0)
457
	    LIN_SDT_PROBE1(mib, linux_prison_check, vfs_copyopt_error, error);
458
299
459
	if (error == ENOENT)
300
	if (error == ENOENT)
460
		error = 0;
301
		error = 0;
461
	LIN_SDT_PROBE1(mib, linux_prison_check, return, error);
462
	return (error);
302
	return (error);
463
}
303
}
464
304
Lines 471-494 Link Here
471
	char *osname, *osrelease;
311
	char *osname, *osrelease;
472
	int error, gotversion, jsys, len, oss_version;
312
	int error, gotversion, jsys, len, oss_version;
473
313
474
	LIN_SDT_PROBE2(mib, linux_prison_set, entry, obj, data);
475
476
	/* Set the parameters, which should be correct. */
314
	/* Set the parameters, which should be correct. */
477
	error = vfs_copyopt(opts, "linux", &jsys, sizeof(jsys));
315
	error = vfs_copyopt(opts, "linux", &jsys, sizeof(jsys));
478
	if (error != 0)
479
		LIN_SDT_PROBE1(mib, linux_prison_set, vfs_copyopt_error, error);
480
	if (error == ENOENT)
316
	if (error == ENOENT)
481
		jsys = -1;
317
		jsys = -1;
482
	error = vfs_getopt(opts, "linux.osname", (void **)&osname, &len);
318
	error = vfs_getopt(opts, "linux.osname", (void **)&osname, &len);
483
	if (error != 0)
484
		LIN_SDT_PROBE1(mib, linux_prison_set, vfs_getopt_error, error);
485
	if (error == ENOENT)
319
	if (error == ENOENT)
486
		osname = NULL;
320
		osname = NULL;
487
	else
321
	else
488
		jsys = JAIL_SYS_NEW;
322
		jsys = JAIL_SYS_NEW;
489
	error = vfs_getopt(opts, "linux.osrelease", (void **)&osrelease, &len);
323
	error = vfs_getopt(opts, "linux.osrelease", (void **)&osrelease, &len);
490
	if (error != 0)
491
		LIN_SDT_PROBE1(mib, linux_prison_set, vfs_getopt_error, error);
492
	if (error == ENOENT)
324
	if (error == ENOENT)
493
		osrelease = NULL;
325
		osrelease = NULL;
494
	else
326
	else
Lines 495-502 Link Here
495
		jsys = JAIL_SYS_NEW;
327
		jsys = JAIL_SYS_NEW;
496
	error = vfs_copyopt(opts, "linux.oss_version", &oss_version,
328
	error = vfs_copyopt(opts, "linux.oss_version", &oss_version,
497
	    sizeof(oss_version));
329
	    sizeof(oss_version));
498
	if (error != 0)
499
		LIN_SDT_PROBE1(mib, linux_prison_set, vfs_copyopt_error, error);
500
	if (error == ENOENT)
330
	if (error == ENOENT)
501
		gotversion = 0;
331
		gotversion = 0;
502
	else {
332
	else {
Lines 518-524 Link Here
518
		error = linux_alloc_prison(pr, &lpr);
348
		error = linux_alloc_prison(pr, &lpr);
519
		if (error) {
349
		if (error) {
520
			mtx_unlock(&pr->pr_mtx);
350
			mtx_unlock(&pr->pr_mtx);
521
			LIN_SDT_PROBE1(mib, linux_prison_set, return, error);
522
			return (error);
351
			return (error);
523
		}
352
		}
524
		if (osrelease) {
353
		if (osrelease) {
Lines 525-532 Link Here
525
			error = linux_map_osrel(osrelease, &lpr->pr_osrel);
354
			error = linux_map_osrel(osrelease, &lpr->pr_osrel);
526
			if (error) {
355
			if (error) {
527
				mtx_unlock(&pr->pr_mtx);
356
				mtx_unlock(&pr->pr_mtx);
528
				LIN_SDT_PROBE1(mib, linux_prison_set, return,
529
				    error);
530
				return (error);
357
				return (error);
531
			}
358
			}
532
			strlcpy(lpr->pr_osrelease, osrelease,
359
			strlcpy(lpr->pr_osrelease, osrelease,
Lines 539-545 Link Here
539
		mtx_unlock(&pr->pr_mtx);
366
		mtx_unlock(&pr->pr_mtx);
540
	}
367
	}
541
368
542
	LIN_SDT_PROBE1(mib, linux_prison_set, return, 0);
543
	return (0);
369
	return (0);
544
}
370
}
545
371
Lines 562-601 Link Here
562
388
563
	static int version0;
389
	static int version0;
564
390
565
	LIN_SDT_PROBE2(mib, linux_prison_get, entry, obj, data);
566
567
	/* See if this prison is the one with the Linux info. */
391
	/* See if this prison is the one with the Linux info. */
568
	lpr = linux_find_prison(pr, &ppr);
392
	lpr = linux_find_prison(pr, &ppr);
569
	i = (ppr == pr) ? JAIL_SYS_NEW : JAIL_SYS_INHERIT;
393
	i = (ppr == pr) ? JAIL_SYS_NEW : JAIL_SYS_INHERIT;
570
	error = vfs_setopt(opts, "linux", &i, sizeof(i));
394
	error = vfs_setopt(opts, "linux", &i, sizeof(i));
571
	if (error != 0) {
395
	if (error != 0 && error != ENOENT)
572
		LIN_SDT_PROBE1(mib, linux_prison_get, vfs_setopt_error, error);
396
		goto done;
573
		if (error != ENOENT)
574
			goto done;
575
	}
576
	if (i) {
397
	if (i) {
577
		error = vfs_setopts(opts, "linux.osname", lpr->pr_osname);
398
		error = vfs_setopts(opts, "linux.osname", lpr->pr_osname);
578
		if (error != 0) {
399
		if (error != 0 && error != ENOENT)
579
			LIN_SDT_PROBE1(mib, linux_prison_get, vfs_setopts_error,
400
			goto done;
580
			    error);
581
			if (error != ENOENT)
582
				goto done;
583
		}
584
		error = vfs_setopts(opts, "linux.osrelease", lpr->pr_osrelease);
401
		error = vfs_setopts(opts, "linux.osrelease", lpr->pr_osrelease);
585
		if (error != 0) {
402
		if (error != 0 && error != ENOENT)
586
			LIN_SDT_PROBE1(mib, linux_prison_get, vfs_setopts_error,
403
			goto done;
587
			    error);
588
			if (error != ENOENT)
589
				goto done;
590
		}
591
		error = vfs_setopt(opts, "linux.oss_version",
404
		error = vfs_setopt(opts, "linux.oss_version",
592
		    &lpr->pr_oss_version, sizeof(lpr->pr_oss_version));
405
		    &lpr->pr_oss_version, sizeof(lpr->pr_oss_version));
593
		if (error != 0) {
406
		if (error != 0 && error != ENOENT)
594
			LIN_SDT_PROBE1(mib, linux_prison_get, vfs_setopt_error,
407
			goto done;
595
			    error);
596
			if(error != ENOENT)
597
				goto done;
598
		}
599
	} else {
408
	} else {
600
		/*
409
		/*
601
		 * If this prison is inheriting its Linux info, report
410
		 * If this prison is inheriting its Linux info, report
Lines 602-628 Link Here
602
		 * empty/zero parameters.
411
		 * empty/zero parameters.
603
		 */
412
		 */
604
		error = vfs_setopts(opts, "linux.osname", "");
413
		error = vfs_setopts(opts, "linux.osname", "");
605
		if (error != 0) {
414
		if (error != 0 && error != ENOENT)
606
			LIN_SDT_PROBE1(mib, linux_prison_get, vfs_setopts_error,
415
			goto done;
607
			    error);
608
			if(error != ENOENT)
609
				goto done;
610
		}
611
		error = vfs_setopts(opts, "linux.osrelease", "");
416
		error = vfs_setopts(opts, "linux.osrelease", "");
612
		if (error != 0) {
417
		if (error != 0 && error != ENOENT)
613
			LIN_SDT_PROBE1(mib, linux_prison_get, vfs_setopts_error,
418
			goto done;
614
			    error);
615
			if(error != ENOENT)
616
				goto done;
617
		}
618
		error = vfs_setopt(opts, "linux.oss_version", &version0,
419
		error = vfs_setopt(opts, "linux.oss_version", &version0,
619
		    sizeof(lpr->pr_oss_version));
420
		    sizeof(lpr->pr_oss_version));
620
		if (error != 0) {
421
		if (error != 0 && error != ENOENT)
621
			LIN_SDT_PROBE1(mib, linux_prison_get, vfs_setopt_error,
422
			goto done;
622
			    error);
623
			if(error != ENOENT)
624
				goto done;
625
		}
626
	}
423
	}
627
	error = 0;
424
	error = 0;
628
425
Lines 629-635 Link Here
629
 done:
426
 done:
630
	mtx_unlock(&ppr->pr_mtx);
427
	mtx_unlock(&ppr->pr_mtx);
631
428
632
	LIN_SDT_PROBE1(mib, linux_prison_get, return, error);
633
	return (error);
429
	return (error);
634
}
430
}
635
431
Lines 637-645 Link Here
637
linux_prison_destructor(void *data)
433
linux_prison_destructor(void *data)
638
{
434
{
639
435
640
	LIN_SDT_PROBE1(mib, linux_prison_destructor, entry, data);
641
	free(data, M_PRISON);
436
	free(data, M_PRISON);
642
	LIN_SDT_PROBE0(mib, linux_prison_destructor, return);
643
}
437
}
644
438
645
void
439
void
Lines 653-660 Link Here
653
	    [PR_METHOD_CHECK] =		linux_prison_check
447
	    [PR_METHOD_CHECK] =		linux_prison_check
654
	};
448
	};
655
449
656
	LIN_SDT_PROBE0(mib, linux_osd_jail_register, entry);
657
658
	linux_osd_jail_slot =
450
	linux_osd_jail_slot =
659
	    osd_jail_register(linux_prison_destructor, methods);
451
	    osd_jail_register(linux_prison_destructor, methods);
660
	if (linux_osd_jail_slot > 0) {
452
	if (linux_osd_jail_slot > 0) {
Lines 664-671 Link Here
664
			(void)linux_alloc_prison(pr, NULL);
456
			(void)linux_alloc_prison(pr, NULL);
665
		sx_xunlock(&allprison_lock);
457
		sx_xunlock(&allprison_lock);
666
	}
458
	}
667
668
	LIN_SDT_PROBE0(mib, linux_osd_jail_register, return);
669
}
459
}
670
460
671
void
461
void
Lines 672-683 Link Here
672
linux_osd_jail_deregister(void)
462
linux_osd_jail_deregister(void)
673
{
463
{
674
464
675
	LIN_SDT_PROBE0(mib, linux_osd_jail_register, entry);
676
677
	if (linux_osd_jail_slot)
465
	if (linux_osd_jail_slot)
678
		osd_jail_deregister(linux_osd_jail_slot);
466
		osd_jail_deregister(linux_osd_jail_slot);
679
680
	LIN_SDT_PROBE0(mib, linux_osd_jail_register, return);
681
}
467
}
682
468
683
void
469
void
Lines 686-698 Link Here
686
	struct prison *pr;
472
	struct prison *pr;
687
	struct linux_prison *lpr;
473
	struct linux_prison *lpr;
688
474
689
	LIN_SDT_PROBE2(mib, linux_get_osname, entry, td, dst);
690
691
	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
475
	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
692
	bcopy(lpr->pr_osname, dst, LINUX_MAX_UTSNAME);
476
	bcopy(lpr->pr_osname, dst, LINUX_MAX_UTSNAME);
693
	mtx_unlock(&pr->pr_mtx);
477
	mtx_unlock(&pr->pr_mtx);
694
695
	LIN_SDT_PROBE0(mib, linux_get_osname, return);
696
}
478
}
697
479
698
static int
480
static int
Lines 701-713 Link Here
701
	struct prison *pr;
483
	struct prison *pr;
702
	struct linux_prison *lpr;
484
	struct linux_prison *lpr;
703
485
704
	LIN_SDT_PROBE2(mib, linux_set_osname, entry, td, osname);
705
706
	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
486
	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
707
	strlcpy(lpr->pr_osname, osname, LINUX_MAX_UTSNAME);
487
	strlcpy(lpr->pr_osname, osname, LINUX_MAX_UTSNAME);
708
	mtx_unlock(&pr->pr_mtx);
488
	mtx_unlock(&pr->pr_mtx);
709
489
710
	LIN_SDT_PROBE1(mib, linux_set_osname, return, 0);
711
	return (0);
490
	return (0);
712
}
491
}
713
492
Lines 717-729 Link Here
717
	struct prison *pr;
496
	struct prison *pr;
718
	struct linux_prison *lpr;
497
	struct linux_prison *lpr;
719
498
720
	LIN_SDT_PROBE2(mib, linux_get_osrelease, entry, td, dst);
721
722
	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
499
	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
723
	bcopy(lpr->pr_osrelease, dst, LINUX_MAX_UTSNAME);
500
	bcopy(lpr->pr_osrelease, dst, LINUX_MAX_UTSNAME);
724
	mtx_unlock(&pr->pr_mtx);
501
	mtx_unlock(&pr->pr_mtx);
725
726
	LIN_SDT_PROBE0(mib, linux_get_osrelease, return);
727
}
502
}
728
503
729
int
504
int
Lines 733-745 Link Here
733
	struct linux_prison *lpr;
508
	struct linux_prison *lpr;
734
	int osrel;
509
	int osrel;
735
510
736
	LIN_SDT_PROBE1(mib, linux_kernver, entry, td);
737
738
	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
511
	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
739
	osrel = lpr->pr_osrel;
512
	osrel = lpr->pr_osrel;
740
	mtx_unlock(&pr->pr_mtx);
513
	mtx_unlock(&pr->pr_mtx);
741
514
742
	LIN_SDT_PROBE1(mib, linux_kernver, return, osrel);
743
	return (osrel);
515
	return (osrel);
744
}
516
}
745
517
Lines 750-757 Link Here
750
	struct linux_prison *lpr;
522
	struct linux_prison *lpr;
751
	int error;
523
	int error;
752
524
753
	LIN_SDT_PROBE2(mib, linux_set_osrelease, entry, td, osrelease);
754
755
	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
525
	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
756
	error = linux_map_osrel(osrelease, &lpr->pr_osrel);
526
	error = linux_map_osrel(osrelease, &lpr->pr_osrel);
757
	if (error == 0)
527
	if (error == 0)
Lines 758-764 Link Here
758
		strlcpy(lpr->pr_osrelease, osrelease, LINUX_MAX_UTSNAME);
528
		strlcpy(lpr->pr_osrelease, osrelease, LINUX_MAX_UTSNAME);
759
	mtx_unlock(&pr->pr_mtx);
529
	mtx_unlock(&pr->pr_mtx);
760
530
761
	LIN_SDT_PROBE1(mib, linux_set_osrelease, return, error);
762
	return (error);
531
	return (error);
763
}
532
}
764
533
Lines 769-781 Link Here
769
	struct linux_prison *lpr;
538
	struct linux_prison *lpr;
770
	int version;
539
	int version;
771
540
772
	LIN_SDT_PROBE1(mib, linux_get_oss_version, entry, td);
773
774
	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
541
	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
775
	version = lpr->pr_oss_version;
542
	version = lpr->pr_oss_version;
776
	mtx_unlock(&pr->pr_mtx);
543
	mtx_unlock(&pr->pr_mtx);
777
544
778
	LIN_SDT_PROBE1(mib, linux_get_oss_version, return, version);
779
	return (version);
545
	return (version);
780
}
546
}
781
547
Lines 785-858 Link Here
785
	struct prison *pr;
551
	struct prison *pr;
786
	struct linux_prison *lpr;
552
	struct linux_prison *lpr;
787
553
788
	LIN_SDT_PROBE2(mib, linux_set_oss_version, entry, td, oss_version);
789
790
	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
554
	lpr = linux_find_prison(td->td_ucred->cr_prison, &pr);
791
	lpr->pr_oss_version = oss_version;
555
	lpr->pr_oss_version = oss_version;
792
	mtx_unlock(&pr->pr_mtx);
556
	mtx_unlock(&pr->pr_mtx);
793
557
794
	LIN_SDT_PROBE1(mib, linux_set_oss_version, return, 0);
795
	return (0);
558
	return (0);
796
}
559
}
797
798
#if defined(DEBUG) || defined(KTR)
799
/* XXX: can be removed when every ldebug(...) and KTR stuff are removed. */
800
801
u_char linux_debug_map[howmany(LINUX_SYS_MAXSYSCALL, sizeof(u_char))];
802
803
static int
804
linux_debug(int syscall, int toggle, int global)
805
{
806
807
	if (global) {
808
		char c = toggle ? 0 : 0xff;
809
810
		memset(linux_debug_map, c, sizeof(linux_debug_map));
811
		return (0);
812
	}
813
	if (syscall < 0 || syscall >= LINUX_SYS_MAXSYSCALL)
814
		return (EINVAL);
815
	if (toggle)
816
		clrbit(linux_debug_map, syscall);
817
	else
818
		setbit(linux_debug_map, syscall);
819
	return (0);
820
}
821
822
/*
823
 * Usage: sysctl linux.debug=<syscall_nr>.<0/1>
824
 *
825
 *    E.g.: sysctl linux.debug=21.0
826
 *
827
 * As a special case, syscall "all" will apply to all syscalls globally.
828
 */
829
#define LINUX_MAX_DEBUGSTR	16
830
static int
831
linux_sysctl_debug(SYSCTL_HANDLER_ARGS)
832
{
833
	char value[LINUX_MAX_DEBUGSTR], *p;
834
	int error, sysc, toggle;
835
	int global = 0;
836
837
	value[0] = '\0';
838
	error = sysctl_handle_string(oidp, value, LINUX_MAX_DEBUGSTR, req);
839
	if (error || req->newptr == NULL)
840
		return (error);
841
	for (p = value; *p != '\0' && *p != '.'; p++);
842
	if (*p == '\0')
843
		return (EINVAL);
844
	*p++ = '\0';
845
	sysc = strtol(value, NULL, 0);
846
	toggle = strtol(p, NULL, 0);
847
	if (strcmp(value, "all") == 0)
848
		global = 1;
849
	error = linux_debug(sysc, toggle, global);
850
	return (error);
851
}
852
853
SYSCTL_PROC(_compat_linux, OID_AUTO, debug,
854
            CTLTYPE_STRING | CTLFLAG_RW,
855
            0, 0, linux_sysctl_debug, "A",
856
            "Linux debugging control");
857
858
#endif /* DEBUG || KTR */
(-)sys/compat/linux/linux_mib.h (-2 / +17 lines)
Lines 31-36 Link Here
31
#ifndef _LINUX_MIB_H_
31
#ifndef _LINUX_MIB_H_
32
#define _LINUX_MIB_H_
32
#define _LINUX_MIB_H_
33
33
34
#ifdef SYSCTL_DECL
35
SYSCTL_DECL(_compat_linux);
36
#endif
37
34
void	linux_osd_jail_register(void);
38
void	linux_osd_jail_register(void);
35
void	linux_osd_jail_deregister(void);
39
void	linux_osd_jail_deregister(void);
36
40
Lines 42-50 Link Here
42
46
43
int	linux_kernver(struct thread *td);
47
int	linux_kernver(struct thread *td);
44
48
45
#define	LINUX_KERNVER_2004000		2004000
49
#define	LINUX_KVERSION		2
46
#define	LINUX_KERNVER_2006000		2006000
50
#define	LINUX_KPATCHLEVEL	6
51
#define	LINUX_KSUBLEVEL		32
47
52
53
#define	LINUX_KERNVER(a,b,c)	(((a) << 16) + ((b) << 8) + (c))
54
#define	LINUX_VERSION_CODE	LINUX_KERNVER(LINUX_KVERSION,		\
55
				    LINUX_KPATCHLEVEL, LINUX_KSUBLEVEL)
56
#define	LINUX_KERNVERSTR(x)	#x
57
#define	LINUX_XKERNVERSTR(x)	LINUX_KERNVERSTR(x)
58
#define	LINUX_VERSION_STR	LINUX_XKERNVERSTR(LINUX_KVERSION.LINUX_KPATCHLEVEL.LINUX_KSUBLEVEL)
59
60
#define	LINUX_KERNVER_2004000	LINUX_KERNVER(2,4,0)
61
#define	LINUX_KERNVER_2006000	LINUX_KERNVER(2,6,0)
62
48
#define	linux_use26(t)		(linux_kernver(t) >= LINUX_KERNVER_2006000)
63
#define	linux_use26(t)		(linux_kernver(t) >= LINUX_KERNVER_2006000)
49
64
50
#endif /* _LINUX_MIB_H_ */
65
#endif /* _LINUX_MIB_H_ */
(-)sys/compat/linux/linux_misc.c (-116 / +497 lines)
Lines 89-110 Link Here
89
#include <compat/linux/linux_file.h>
89
#include <compat/linux/linux_file.h>
90
#include <compat/linux/linux_mib.h>
90
#include <compat/linux/linux_mib.h>
91
#include <compat/linux/linux_signal.h>
91
#include <compat/linux/linux_signal.h>
92
#include <compat/linux/linux_timer.h>
92
#include <compat/linux/linux_util.h>
93
#include <compat/linux/linux_util.h>
93
#include <compat/linux/linux_sysproto.h>
94
#include <compat/linux/linux_sysproto.h>
94
#include <compat/linux/linux_emul.h>
95
#include <compat/linux/linux_emul.h>
95
#include <compat/linux/linux_misc.h>
96
#include <compat/linux/linux_misc.h>
96
97
97
/* DTrace init */
98
/**
98
LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
99
 * Special DTrace provider for the linuxulator.
100
 *
101
 * In this file we define the provider for the entire linuxulator. All
102
 * modules (= files of the linuxulator) use it.
103
 *
104
 * We define a different name depending on the emulated bitsize, see
105
 * ../../<ARCH>/linux{,32}/linux.h, e.g.:
106
 *      native bitsize          = linuxulator
107
 *      amd64, 32bit emulation  = linuxulator32
108
 */
109
LIN_SDT_PROVIDER_DEFINE(LINUX_DTRACE);
99
110
100
/* Linuxulator-global DTrace probes */
101
LIN_SDT_PROBE_DECLARE(locks, emul_lock, locked);
102
LIN_SDT_PROBE_DECLARE(locks, emul_lock, unlock);
103
LIN_SDT_PROBE_DECLARE(locks, emul_shared_rlock, locked);
104
LIN_SDT_PROBE_DECLARE(locks, emul_shared_rlock, unlock);
105
LIN_SDT_PROBE_DECLARE(locks, emul_shared_wlock, locked);
106
LIN_SDT_PROBE_DECLARE(locks, emul_shared_wlock, unlock);
107
108
int stclohz;				/* Statistics clock frequency */
111
int stclohz;				/* Statistics clock frequency */
109
112
110
static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] = {
113
static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] = {
Lines 130-135 Link Here
130
	l_uint		mem_unit;
133
	l_uint		mem_unit;
131
	char		_f[20-2*sizeof(l_long)-sizeof(l_int)];	/* padding */
134
	char		_f[20-2*sizeof(l_long)-sizeof(l_int)];	/* padding */
132
};
135
};
136
137
struct l_pselect6arg {
138
	l_uintptr_t	ss;
139
	l_size_t	ss_len;
140
};
141
142
133
int
143
int
134
linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args)
144
linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args)
135
{
145
{
Lines 524-530 Link Here
524
		tvp = NULL;
534
		tvp = NULL;
525
535
526
	error = kern_select(td, args->nfds, args->readfds, args->writefds,
536
	error = kern_select(td, args->nfds, args->readfds, args->writefds,
527
	    args->exceptfds, tvp, sizeof(l_int) * 8);
537
	    args->exceptfds, tvp, sizeof(l_fd_mask) * 8);
528
538
529
#ifdef DEBUG
539
#ifdef DEBUG
530
	if (ldebug(select))
540
	if (ldebug(select))
Lines 691-699 Link Here
691
	if (args->buf != NULL) {
701
	if (args->buf != NULL) {
692
		p = td->td_proc;
702
		p = td->td_proc;
693
		PROC_LOCK(p);
703
		PROC_LOCK(p);
694
		PROC_SLOCK(p);
704
		PROC_STATLOCK(p);
695
		calcru(p, &utime, &stime);
705
		calcru(p, &utime, &stime);
696
		PROC_SUNLOCK(p);
706
		PROC_STATUNLOCK(p);
697
		calccru(p, &cutime, &cstime);
707
		calccru(p, &cutime, &cstime);
698
		PROC_UNLOCK(p);
708
		PROC_UNLOCK(p);
699
709
Lines 739-750 Link Here
739
			*p = '\0';
749
			*p = '\0';
740
			break;
750
			break;
741
		}
751
		}
742
	strlcpy(utsname.machine, linux_platform, LINUX_MAX_UTSNAME);
752
	strlcpy(utsname.machine, linux_kplatform, LINUX_MAX_UTSNAME);
743
753
744
	return (copyout(&utsname, args->buf, sizeof(utsname)));
754
	return (copyout(&utsname, args->buf, sizeof(utsname)));
745
}
755
}
746
756
747
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
748
struct l_utimbuf {
757
struct l_utimbuf {
749
	l_time_t l_actime;
758
	l_time_t l_actime;
750
	l_time_t l_modtime;
759
	l_time_t l_modtime;
Lines 815-820 Link Here
815
	return (error);
824
	return (error);
816
}
825
}
817
826
827
int 
828
linux_utimensat(struct thread *td, struct linux_utimensat_args *args)
829
{
830
	return (ENOSYS);
831
}
832
818
int
833
int
819
linux_futimesat(struct thread *td, struct linux_futimesat_args *args)
834
linux_futimesat(struct thread *td, struct linux_futimesat_args *args)
820
{
835
{
Lines 847-853 Link Here
847
	LFREEPATH(fname);
862
	LFREEPATH(fname);
848
	return (error);
863
	return (error);
849
}
864
}
850
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
851
865
852
int
866
int
853
linux_common_wait(struct thread *td, int pid, int *status,
867
linux_common_wait(struct thread *td, int pid, int *status,
Lines 863-872 Link Here
863
		tmpstat &= 0xffff;
877
		tmpstat &= 0xffff;
864
		if (WIFSIGNALED(tmpstat))
878
		if (WIFSIGNALED(tmpstat))
865
			tmpstat = (tmpstat & 0xffffff80) |
879
			tmpstat = (tmpstat & 0xffffff80) |
866
			    BSD_TO_LINUX_SIGNAL(WTERMSIG(tmpstat));
880
			    bsd_to_linux_signal(WTERMSIG(tmpstat));
867
		else if (WIFSTOPPED(tmpstat))
881
		else if (WIFSTOPPED(tmpstat))
868
			tmpstat = (tmpstat & 0xffff00ff) |
882
			tmpstat = (tmpstat & 0xffff00ff) |
869
			    (BSD_TO_LINUX_SIGNAL(WSTOPSIG(tmpstat)) << 8);
883
			    (bsd_to_linux_signal(WSTOPSIG(tmpstat)) << 8);
884
		else if (WIFCONTINUED(tmpstat))
885
			tmpstat = 0xffff;
870
		error = copyout(&tmpstat, status, sizeof(int));
886
		error = copyout(&tmpstat, status, sizeof(int));
871
	}
887
	}
872
888
Lines 873-878 Link Here
873
	return (error);
889
	return (error);
874
}
890
}
875
891
892
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
876
int
893
int
877
linux_waitpid(struct thread *td, struct linux_waitpid_args *args)
894
linux_waitpid(struct thread *td, struct linux_waitpid_args *args)
878
{
895
{
Lines 883-902 Link Here
883
		printf(ARGS(waitpid, "%d, %p, %d"),
900
		printf(ARGS(waitpid, "%d, %p, %d"),
884
		    args->pid, (void *)args->status, args->options);
901
		    args->pid, (void *)args->status, args->options);
885
#endif
902
#endif
886
	/*
903
	if (args->options & ~(LINUX_WUNTRACED | LINUX_WNOHANG |
887
	 * this is necessary because the test in kern_wait doesn't work
904
	    LINUX_WCONTINUED | __WCLONE | __WNOTHREAD | __WALL))
888
	 * because we mess with the options here
889
	 */
890
	if (args->options & ~(WUNTRACED | WNOHANG | WCONTINUED | __WCLONE))
891
		return (EINVAL);
905
		return (EINVAL);
892
   
893
	options = (args->options & (WNOHANG | WUNTRACED));
894
	/* WLINUXCLONE should be equal to __WCLONE, but we make sure */
895
	if (args->options & __WCLONE)
896
		options |= WLINUXCLONE;
897
906
907
	options = WEXITED;
908
	linux_to_bsd_waitopts(args->options, &options);
909
898
	return (linux_common_wait(td, args->pid, args->status, options, NULL));
910
	return (linux_common_wait(td, args->pid, args->status, options, NULL));
899
}
911
}
912
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
900
913
901
914
902
int
915
int
Lines 909-915 Link Here
909
922
910
#ifdef DEBUG
923
#ifdef DEBUG
911
	if (ldebug(mknod))
924
	if (ldebug(mknod))
912
		printf(ARGS(mknod, "%s, %d, %d"), path, args->mode, args->dev);
925
		printf(ARGS(mknod, "%s, %d, %ju"), path, args->mode,
926
		    (uintmax_t)args->dev);
913
#endif
927
#endif
914
928
915
	switch (args->mode & S_IFMT) {
929
	switch (args->mode & S_IFMT) {
Lines 1079-1084 Link Here
1079
	return (copyout(&ls, uap->itv, sizeof(ls)));
1093
	return (copyout(&ls, uap->itv, sizeof(ls)));
1080
}
1094
}
1081
1095
1096
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
1082
int
1097
int
1083
linux_nice(struct thread *td, struct linux_nice_args *args)
1098
linux_nice(struct thread *td, struct linux_nice_args *args)
1084
{
1099
{
Lines 1089-1094 Link Here
1089
	bsd_args.prio = args->inc;
1104
	bsd_args.prio = args->inc;
1090
	return (sys_setpriority(td, &bsd_args));
1105
	return (sys_setpriority(td, &bsd_args));
1091
}
1106
}
1107
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
1092
1108
1093
int
1109
int
1094
linux_setgroups(struct thread *td, struct linux_setgroups_args *args)
1110
linux_setgroups(struct thread *td, struct linux_setgroups_args *args)
Lines 1102-1108 Link Here
1102
	ngrp = args->gidsetsize;
1118
	ngrp = args->gidsetsize;
1103
	if (ngrp < 0 || ngrp >= ngroups_max + 1)
1119
	if (ngrp < 0 || ngrp >= ngroups_max + 1)
1104
		return (EINVAL);
1120
		return (EINVAL);
1105
	linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_TEMP, M_WAITOK);
1121
	linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_LINUX, M_WAITOK);
1106
	error = copyin(args->grouplist, linux_gidset, ngrp * sizeof(l_gid_t));
1122
	error = copyin(args->grouplist, linux_gidset, ngrp * sizeof(l_gid_t));
1107
	if (error)
1123
	if (error)
1108
		goto out;
1124
		goto out;
Lines 1141-1147 Link Here
1141
	crfree(oldcred);
1157
	crfree(oldcred);
1142
	error = 0;
1158
	error = 0;
1143
out:
1159
out:
1144
	free(linux_gidset, M_TEMP);
1160
	free(linux_gidset, M_LINUX);
1145
	return (error);
1161
	return (error);
1146
}
1162
}
1147
1163
Lines 1173-1179 Link Here
1173
1189
1174
	ngrp = 0;
1190
	ngrp = 0;
1175
	linux_gidset = malloc(bsd_gidsetsz * sizeof(*linux_gidset),
1191
	linux_gidset = malloc(bsd_gidsetsz * sizeof(*linux_gidset),
1176
	    M_TEMP, M_WAITOK);
1192
	    M_LINUX, M_WAITOK);
1177
	while (ngrp < bsd_gidsetsz) {
1193
	while (ngrp < bsd_gidsetsz) {
1178
		linux_gidset[ngrp] = bsd_gidset[ngrp + 1];
1194
		linux_gidset[ngrp] = bsd_gidset[ngrp + 1];
1179
		ngrp++;
1195
		ngrp++;
Lines 1180-1186 Link Here
1180
	}
1196
	}
1181
1197
1182
	error = copyout(linux_gidset, args->grouplist, ngrp * sizeof(l_gid_t));
1198
	error = copyout(linux_gidset, args->grouplist, ngrp * sizeof(l_gid_t));
1183
	free(linux_gidset, M_TEMP);
1199
	free(linux_gidset, M_LINUX);
1184
	if (error)
1200
	if (error)
1185
		return (error);
1201
		return (error);
1186
1202
Lines 1218-1223 Link Here
1218
	return (kern_setrlimit(td, which, &bsd_rlim));
1234
	return (kern_setrlimit(td, which, &bsd_rlim));
1219
}
1235
}
1220
1236
1237
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
1221
int
1238
int
1222
linux_old_getrlimit(struct thread *td, struct linux_old_getrlimit_args *args)
1239
linux_old_getrlimit(struct thread *td, struct linux_old_getrlimit_args *args)
1223
{
1240
{
Lines 1260-1265 Link Here
1260
#endif
1277
#endif
1261
	return (copyout(&rlim, args->rlim, sizeof(rlim)));
1278
	return (copyout(&rlim, args->rlim, sizeof(rlim)));
1262
}
1279
}
1280
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
1263
1281
1264
int
1282
int
1265
linux_getrlimit(struct thread *td, struct linux_getrlimit_args *args)
1283
linux_getrlimit(struct thread *td, struct linux_getrlimit_args *args)
Lines 1295-1301 Link Here
1295
linux_sched_setscheduler(struct thread *td,
1313
linux_sched_setscheduler(struct thread *td,
1296
    struct linux_sched_setscheduler_args *args)
1314
    struct linux_sched_setscheduler_args *args)
1297
{
1315
{
1298
	struct sched_setscheduler_args bsd;
1316
	struct sched_param sched_param;
1317
	struct thread *tdt;
1318
	int error, policy;
1299
1319
1300
#ifdef DEBUG
1320
#ifdef DEBUG
1301
	if (ldebug(sched_setscheduler))
1321
	if (ldebug(sched_setscheduler))
Lines 1305-1325 Link Here
1305
1325
1306
	switch (args->policy) {
1326
	switch (args->policy) {
1307
	case LINUX_SCHED_OTHER:
1327
	case LINUX_SCHED_OTHER:
1308
		bsd.policy = SCHED_OTHER;
1328
		policy = SCHED_OTHER;
1309
		break;
1329
		break;
1310
	case LINUX_SCHED_FIFO:
1330
	case LINUX_SCHED_FIFO:
1311
		bsd.policy = SCHED_FIFO;
1331
		policy = SCHED_FIFO;
1312
		break;
1332
		break;
1313
	case LINUX_SCHED_RR:
1333
	case LINUX_SCHED_RR:
1314
		bsd.policy = SCHED_RR;
1334
		policy = SCHED_RR;
1315
		break;
1335
		break;
1316
	default:
1336
	default:
1317
		return (EINVAL);
1337
		return (EINVAL);
1318
	}
1338
	}
1319
1339
1320
	bsd.pid = args->pid;
1340
	error = copyin(args->param, &sched_param, sizeof(sched_param));
1321
	bsd.param = (struct sched_param *)args->param;
1341
	if (error)
1322
	return (sys_sched_setscheduler(td, &bsd));
1342
		return (error);
1343
1344
	tdt = linux_tdfind(td, args->pid, -1);
1345
	if (tdt == NULL)
1346
		return (ESRCH);
1347
1348
	error = kern_sched_setscheduler(td, tdt, policy, &sched_param);
1349
	PROC_UNLOCK(tdt->td_proc);
1350
	return (error);
1323
}
1351
}
1324
1352
1325
int
1353
int
Lines 1326-1333 Link Here
1326
linux_sched_getscheduler(struct thread *td,
1354
linux_sched_getscheduler(struct thread *td,
1327
    struct linux_sched_getscheduler_args *args)
1355
    struct linux_sched_getscheduler_args *args)
1328
{
1356
{
1329
	struct sched_getscheduler_args bsd;
1357
	struct thread *tdt;
1330
	int error;
1358
	int error, policy;
1331
1359
1332
#ifdef DEBUG
1360
#ifdef DEBUG
1333
	if (ldebug(sched_getscheduler))
1361
	if (ldebug(sched_getscheduler))
Lines 1334-1343 Link Here
1334
		printf(ARGS(sched_getscheduler, "%d"), args->pid);
1362
		printf(ARGS(sched_getscheduler, "%d"), args->pid);
1335
#endif
1363
#endif
1336
1364
1337
	bsd.pid = args->pid;
1365
	tdt = linux_tdfind(td, args->pid, -1);
1338
	error = sys_sched_getscheduler(td, &bsd);
1366
	if (tdt == NULL)
1367
		return (ESRCH);
1339
1368
1340
	switch (td->td_retval[0]) {
1369
	error = kern_sched_getscheduler(td, tdt, &policy);
1370
	PROC_UNLOCK(tdt->td_proc);
1371
1372
	switch (policy) {
1341
	case SCHED_OTHER:
1373
	case SCHED_OTHER:
1342
		td->td_retval[0] = LINUX_SCHED_OTHER;
1374
		td->td_retval[0] = LINUX_SCHED_OTHER;
1343
		break;
1375
		break;
Lines 1348-1354 Link Here
1348
		td->td_retval[0] = LINUX_SCHED_RR;
1380
		td->td_retval[0] = LINUX_SCHED_RR;
1349
		break;
1381
		break;
1350
	}
1382
	}
1351
1352
	return (error);
1383
	return (error);
1353
}
1384
}
1354
1385
Lines 1474-1494 Link Here
1474
int
1505
int
1475
linux_getpid(struct thread *td, struct linux_getpid_args *args)
1506
linux_getpid(struct thread *td, struct linux_getpid_args *args)
1476
{
1507
{
1477
	struct linux_emuldata *em;
1478
1508
1479
#ifdef DEBUG
1509
#ifdef DEBUG
1480
	if (ldebug(getpid))
1510
	if (ldebug(getpid))
1481
		printf(ARGS(getpid, ""));
1511
		printf(ARGS(getpid, ""));
1482
#endif
1512
#endif
1513
	td->td_retval[0] = td->td_proc->p_pid;
1483
1514
1484
	if (linux_use26(td)) {
1485
		em = em_find(td->td_proc, EMUL_DONTLOCK);
1486
		KASSERT(em != NULL, ("getpid: emuldata not found.\n"));
1487
		td->td_retval[0] = em->shared->group_pid;
1488
	} else {
1489
		td->td_retval[0] = td->td_proc->p_pid;
1490
	}
1491
1492
	return (0);
1515
	return (0);
1493
}
1516
}
1494
1517
Lines 1495-1500 Link Here
1495
int
1518
int
1496
linux_gettid(struct thread *td, struct linux_gettid_args *args)
1519
linux_gettid(struct thread *td, struct linux_gettid_args *args)
1497
{
1520
{
1521
	struct linux_emuldata *em;
1498
1522
1499
#ifdef DEBUG
1523
#ifdef DEBUG
1500
	if (ldebug(gettid))
1524
	if (ldebug(gettid))
Lines 1501-1507 Link Here
1501
		printf(ARGS(gettid, ""));
1525
		printf(ARGS(gettid, ""));
1502
#endif
1526
#endif
1503
1527
1504
	td->td_retval[0] = td->td_proc->p_pid;
1528
	em = em_find(td);
1529
	KASSERT(em != NULL, ("gettid: emuldata not found.\n"));
1530
1531
	td->td_retval[0] = em->em_tid;
1532
1505
	return (0);
1533
	return (0);
1506
}
1534
}
1507
1535
Lines 1509-1516 Link Here
1509
int
1537
int
1510
linux_getppid(struct thread *td, struct linux_getppid_args *args)
1538
linux_getppid(struct thread *td, struct linux_getppid_args *args)
1511
{
1539
{
1512
	struct linux_emuldata *em;
1513
	struct proc *p, *pp;
1514
1540
1515
#ifdef DEBUG
1541
#ifdef DEBUG
1516
	if (ldebug(getppid))
1542
	if (ldebug(getppid))
Lines 1517-1558 Link Here
1517
		printf(ARGS(getppid, ""));
1543
		printf(ARGS(getppid, ""));
1518
#endif
1544
#endif
1519
1545
1520
	if (!linux_use26(td)) {
1546
	PROC_LOCK(td->td_proc);
1521
		PROC_LOCK(td->td_proc);
1547
	td->td_retval[0] = td->td_proc->p_pptr->p_pid;
1522
		td->td_retval[0] = td->td_proc->p_pptr->p_pid;
1548
	PROC_UNLOCK(td->td_proc);
1523
		PROC_UNLOCK(td->td_proc);
1524
		return (0);
1525
	}
1526
1527
	em = em_find(td->td_proc, EMUL_DONTLOCK);
1528
1529
	KASSERT(em != NULL, ("getppid: process emuldata not found.\n"));
1530
1531
	/* find the group leader */
1532
	p = pfind(em->shared->group_pid);
1533
1534
	if (p == NULL) {
1535
#ifdef DEBUG
1536
	   	printf(LMSG("parent process not found.\n"));
1537
#endif
1538
		return (0);
1539
	}
1540
1541
	pp = p->p_pptr;		/* switch to parent */
1542
	PROC_LOCK(pp);
1543
	PROC_UNLOCK(p);
1544
1545
	/* if its also linux process */
1546
	if (pp->p_sysent == &elf_linux_sysvec) {
1547
		em = em_find(pp, EMUL_DONTLOCK);
1548
		KASSERT(em != NULL, ("getppid: parent emuldata not found.\n"));
1549
1550
		td->td_retval[0] = em->shared->group_pid;
1551
	} else
1552
		td->td_retval[0] = pp->p_pid;
1553
1554
	PROC_UNLOCK(pp);
1555
1556
	return (0);
1549
	return (0);
1557
}
1550
}
1558
1551
Lines 1657-1663 Link Here
1657
int
1650
int
1658
linux_exit_group(struct thread *td, struct linux_exit_group_args *args)
1651
linux_exit_group(struct thread *td, struct linux_exit_group_args *args)
1659
{
1652
{
1660
	struct linux_emuldata *em;
1661
1653
1662
#ifdef DEBUG
1654
#ifdef DEBUG
1663
	if (ldebug(exit_group))
1655
	if (ldebug(exit_group))
Lines 1664-1678 Link Here
1664
		printf(ARGS(exit_group, "%i"), args->error_code);
1656
		printf(ARGS(exit_group, "%i"), args->error_code);
1665
#endif
1657
#endif
1666
1658
1667
	em = em_find(td->td_proc, EMUL_DONTLOCK);
1659
	LINUX_CTR2(exit_group, "thread(%d) (%d)", td->td_tid,
1668
	if (em->shared->refs > 1) {
1660
	    args->error_code);
1669
		EMUL_SHARED_WLOCK(&emul_shared_lock);
1670
		em->shared->flags |= EMUL_SHARED_HASXSTAT;
1671
		em->shared->xstat = W_EXITCODE(args->error_code, 0);
1672
		EMUL_SHARED_WUNLOCK(&emul_shared_lock);
1673
		if (linux_use26(td))
1674
			linux_kill_threads(td, SIGKILL);
1675
	}
1676
1661
1677
	/*
1662
	/*
1678
	 * XXX: we should send a signal to the parent if
1663
	 * XXX: we should send a signal to the parent if
Lines 1680-1687 Link Here
1680
	 * as it doesnt occur often.
1665
	 * as it doesnt occur often.
1681
	 */
1666
	 */
1682
	exit1(td, W_EXITCODE(args->error_code, 0));
1667
	exit1(td, W_EXITCODE(args->error_code, 0));
1683
1668
		/* NOTREACHED */
1684
	return (0);
1685
}
1669
}
1686
1670
1687
#define _LINUX_CAPABILITY_VERSION  0x19980330
1671
#define _LINUX_CAPABILITY_VERSION  0x19980330
Lines 1789-1796 Link Here
1789
1773
1790
#ifdef DEBUG
1774
#ifdef DEBUG
1791
	if (ldebug(prctl))
1775
	if (ldebug(prctl))
1792
		printf(ARGS(prctl, "%d, %d, %d, %d, %d"), args->option,
1776
		printf(ARGS(prctl, "%d, %ju, %ju, %ju, %ju"), args->option,
1793
		    args->arg2, args->arg3, args->arg4, args->arg5);
1777
		    (uintmax_t)args->arg2, (uintmax_t)args->arg3,
1778
		    (uintmax_t)args->arg4, (uintmax_t)args->arg5);
1794
#endif
1779
#endif
1795
1780
1796
	switch (args->option) {
1781
	switch (args->option) {
Lines 1797-1812 Link Here
1797
	case LINUX_PR_SET_PDEATHSIG:
1782
	case LINUX_PR_SET_PDEATHSIG:
1798
		if (!LINUX_SIG_VALID(args->arg2))
1783
		if (!LINUX_SIG_VALID(args->arg2))
1799
			return (EINVAL);
1784
			return (EINVAL);
1800
		em = em_find(p, EMUL_DOLOCK);
1785
		em = em_find(td);
1801
		KASSERT(em != NULL, ("prctl: emuldata not found.\n"));
1786
		KASSERT(em != NULL, ("prctl: emuldata not found.\n"));
1802
		em->pdeath_signal = args->arg2;
1787
		em->pdeath_signal = args->arg2;
1803
		EMUL_UNLOCK(&emul_lock);
1804
		break;
1788
		break;
1805
	case LINUX_PR_GET_PDEATHSIG:
1789
	case LINUX_PR_GET_PDEATHSIG:
1806
		em = em_find(p, EMUL_DOLOCK);
1790
		em = em_find(td);
1807
		KASSERT(em != NULL, ("prctl: emuldata not found.\n"));
1791
		KASSERT(em != NULL, ("prctl: emuldata not found.\n"));
1808
		pdeath_signal = em->pdeath_signal;
1792
		pdeath_signal = em->pdeath_signal;
1809
		EMUL_UNLOCK(&emul_lock);
1810
		error = copyout(&pdeath_signal,
1793
		error = copyout(&pdeath_signal,
1811
		    (void *)(register_t)args->arg2,
1794
		    (void *)(register_t)args->arg2,
1812
		    sizeof(pdeath_signal));
1795
		    sizeof(pdeath_signal));
Lines 1871-1876 Link Here
1871
	return (error);
1854
	return (error);
1872
}
1855
}
1873
1856
1857
int
1858
linux_sched_setparam(struct thread *td,
1859
    struct linux_sched_setparam_args *uap)
1860
{
1861
	struct sched_param sched_param;
1862
	struct thread *tdt;
1863
	int error;
1864
1865
#ifdef DEBUG
1866
	if (ldebug(sched_setparam))
1867
		printf(ARGS(sched_setparam, "%d, *"), uap->pid);
1868
#endif
1869
1870
	error = copyin(uap->param, &sched_param, sizeof(sched_param));
1871
	if (error)
1872
		return (error);
1873
1874
	tdt = linux_tdfind(td, uap->pid, -1);
1875
	if (tdt == NULL)
1876
		return (ESRCH);
1877
1878
	error = kern_sched_setparam(td, tdt, &sched_param);
1879
	PROC_UNLOCK(tdt->td_proc);
1880
	return (error);
1881
}
1882
1883
int
1884
linux_sched_getparam(struct thread *td,
1885
    struct linux_sched_getparam_args *uap)
1886
{
1887
	struct sched_param sched_param;
1888
	struct thread *tdt;
1889
	int error;
1890
1891
#ifdef DEBUG
1892
	if (ldebug(sched_getparam))
1893
		printf(ARGS(sched_getparam, "%d, *"), uap->pid);
1894
#endif
1895
1896
	tdt = linux_tdfind(td, uap->pid, -1);
1897
	if (tdt == NULL)
1898
		return (ESRCH);
1899
1900
	error = kern_sched_getparam(td, tdt, &sched_param);
1901
	PROC_UNLOCK(tdt->td_proc);
1902
	if (error == 0)
1903
		error = copyout(&sched_param, uap->param,
1904
		    sizeof(sched_param));
1905
	return (error);
1906
}
1907
1874
/*
1908
/*
1875
 * Get affinity of a process.
1909
 * Get affinity of a process.
1876
 */
1910
 */
Lines 1879-1884 Link Here
1879
    struct linux_sched_getaffinity_args *args)
1913
    struct linux_sched_getaffinity_args *args)
1880
{
1914
{
1881
	int error;
1915
	int error;
1916
	struct thread *tdt;
1882
	struct cpuset_getaffinity_args cga;
1917
	struct cpuset_getaffinity_args cga;
1883
1918
1884
#ifdef DEBUG
1919
#ifdef DEBUG
Lines 1889-1897 Link Here
1889
	if (args->len < sizeof(cpuset_t))
1924
	if (args->len < sizeof(cpuset_t))
1890
		return (EINVAL);
1925
		return (EINVAL);
1891
1926
1927
	tdt = linux_tdfind(td, args->pid, -1);
1928
	if (tdt == NULL)
1929
		return (ESRCH);
1930
1931
	PROC_UNLOCK(tdt->td_proc);
1892
	cga.level = CPU_LEVEL_WHICH;
1932
	cga.level = CPU_LEVEL_WHICH;
1893
	cga.which = CPU_WHICH_PID;
1933
	cga.which = CPU_WHICH_TID;
1894
	cga.id = args->pid;
1934
	cga.id = tdt->td_tid;
1895
	cga.cpusetsize = sizeof(cpuset_t);
1935
	cga.cpusetsize = sizeof(cpuset_t);
1896
	cga.mask = (cpuset_t *) args->user_mask_ptr;
1936
	cga.mask = (cpuset_t *) args->user_mask_ptr;
1897
1937
Lines 1909-1914 Link Here
1909
    struct linux_sched_setaffinity_args *args)
1949
    struct linux_sched_setaffinity_args *args)
1910
{
1950
{
1911
	struct cpuset_setaffinity_args csa;
1951
	struct cpuset_setaffinity_args csa;
1952
	struct thread *tdt;
1912
1953
1913
#ifdef DEBUG
1954
#ifdef DEBUG
1914
	if (ldebug(sched_setaffinity))
1955
	if (ldebug(sched_setaffinity))
Lines 1918-1928 Link Here
1918
	if (args->len < sizeof(cpuset_t))
1959
	if (args->len < sizeof(cpuset_t))
1919
		return (EINVAL);
1960
		return (EINVAL);
1920
1961
1962
	tdt = linux_tdfind(td, args->pid, -1);
1963
	if (tdt == NULL)
1964
		return (ESRCH);
1965
1966
	PROC_UNLOCK(tdt->td_proc);
1921
	csa.level = CPU_LEVEL_WHICH;
1967
	csa.level = CPU_LEVEL_WHICH;
1922
	csa.which = CPU_WHICH_PID;
1968
	csa.which = CPU_WHICH_TID;
1923
	csa.id = args->pid;
1969
	csa.id = tdt->td_tid;
1924
	csa.cpusetsize = sizeof(cpuset_t);
1970
	csa.cpusetsize = sizeof(cpuset_t);
1925
	csa.mask = (cpuset_t *) args->user_mask_ptr;
1971
	csa.mask = (cpuset_t *) args->user_mask_ptr;
1926
1972
1927
	return (sys_cpuset_setaffinity(td, &csa));
1973
	return (sys_cpuset_setaffinity(td, &csa));
1928
}
1974
}
1975
1976
int
1977
linux_sched_rr_get_interval(struct thread *td,
1978
    struct linux_sched_rr_get_interval_args *uap)
1979
{
1980
	struct timespec ts;
1981
	struct l_timespec lts;
1982
	struct thread *tdt;
1983
	int error;
1984
1985
	/*
1986
	 * According to man in case the invalid pid specified
1987
	 * EINVAL should be returned.
1988
	 */
1989
	if (uap->pid < 0)
1990
		return (EINVAL);
1991
1992
	tdt = linux_tdfind(td, uap->pid, -1);
1993
	if (tdt == NULL)
1994
		return (ESRCH);
1995
1996
	error = kern_sched_rr_get_interval_td(td, tdt, &ts);
1997
	PROC_UNLOCK(tdt->td_proc);
1998
	if (error != 0)
1999
		return (error);
2000
	native_to_linux_timespec(&lts, &ts);
2001
	return (copyout(&lts, uap->interval, sizeof(lts)));
2002
}
2003
2004
/*
2005
 * In case when the Linux thread is the initial thread in
2006
 * the thread group thread id is equal to the process id.
2007
 * Glibc depends on this magic (assert in pthread_getattr_np.c).
2008
 */
2009
struct thread *
2010
linux_tdfind(struct thread *td, lwpid_t tid, pid_t pid)
2011
{
2012
	struct linux_emuldata *em;
2013
	struct thread *tdt;
2014
	struct proc *p;
2015
2016
	tdt = NULL;
2017
	if (tid == 0 || tid == td->td_tid) {
2018
		tdt = td;
2019
		PROC_LOCK(tdt->td_proc);
2020
	} else if (tid > PID_MAX)
2021
		tdt = tdfind(tid, pid);
2022
	else {
2023
		/*
2024
		 * Initial thread where the tid equal to the pid.
2025
		 */
2026
		p = pfind(tid);
2027
		if (p != NULL) {
2028
			if (SV_PROC_ABI(p) != SV_ABI_LINUX) {
2029
				/*
2030
				 * p is not a Linuxulator process.
2031
				 */
2032
				PROC_UNLOCK(p);
2033
				return (NULL);
2034
			}
2035
			FOREACH_THREAD_IN_PROC(p, tdt) {
2036
				em = em_find(tdt);
2037
				if (tid == em->em_tid)
2038
					return (tdt);
2039
			}
2040
			PROC_UNLOCK(p);
2041
		}
2042
		return (NULL);
2043
	}
2044
2045
	return (tdt);
2046
}
2047
2048
void
2049
linux_to_bsd_waitopts(int options, int *bsdopts)
2050
{
2051
2052
	if (options & LINUX_WNOHANG)
2053
		*bsdopts |= WNOHANG;
2054
	if (options & LINUX_WUNTRACED)
2055
		*bsdopts |= WUNTRACED;
2056
	if (options & LINUX_WEXITED)
2057
		*bsdopts |= WEXITED;
2058
	if (options & LINUX_WCONTINUED)
2059
		*bsdopts |= WCONTINUED;
2060
	if (options & LINUX_WNOWAIT)
2061
		*bsdopts |= WNOWAIT;
2062
2063
	if (options & __WCLONE)
2064
		*bsdopts |= WLINUXCLONE;
2065
}
2066
2067
int
2068
linux_prlimit64(struct thread *td, struct linux_prlimit64_args *args)
2069
{
2070
	struct rlimit rlim;
2071
	struct proc *p;
2072
	u_int which;
2073
	int error;
2074
2075
#ifdef DEBUG
2076
	if (ldebug(prlimit64))
2077
		printf(ARGS(prlimit64, "%d, %d, %p, %p"), args->pid,
2078
		    args->resource, (void *)args->new, (void *)args->old);
2079
#endif
2080
2081
	if (args->resource >= LINUX_RLIM_NLIMITS)
2082
		return (EINVAL);
2083
2084
	which = linux_to_bsd_resource[args->resource];
2085
	if (which == -1)
2086
		return (EINVAL);
2087
2088
	if (args->pid == 0) {
2089
		p = td->td_proc;
2090
		PROC_LOCK(p);
2091
	} else {
2092
		p = pfind(args->pid);
2093
		if (p == NULL)
2094
			return (ESRCH);
2095
	}
2096
	error = p_cansee(td, p);
2097
	if (error) {
2098
		PROC_UNLOCK(p);
2099
		return (EPERM);
2100
	}
2101
2102
	_PHOLD(p);
2103
2104
	if (args->old) {
2105
		lim_rlimit(p, which, &rlim);
2106
		PROC_UNLOCK(p);
2107
		error = copyout(&rlim, args->old, sizeof(rlim));
2108
		if (error)
2109
			goto out;
2110
	} else
2111
		PROC_UNLOCK(p);
2112
2113
	if (args->new) {
2114
		error = copyin(args->new, &rlim, sizeof(rlim));
2115
		if (error == 0)
2116
			error = kern_proc_setrlimit(td, p, which, &rlim);
2117
	}
2118
out:
2119
	PRELE(p);
2120
	return (error);
2121
}
2122
2123
int
2124
linux_pselect6(struct thread *td, struct linux_pselect6_args *args)
2125
{
2126
	struct timeval utv, tv0, tv1, *tvp;
2127
	struct l_pselect6arg lpse6;
2128
	struct l_timespec lts;
2129
	struct timespec uts;
2130
	l_sigset_t l_ss;
2131
	sigset_t *ssp;
2132
	sigset_t ss;
2133
	int error;
2134
2135
	ssp = NULL;
2136
	if (args->sig) {
2137
		error = copyin(args->sig, &lpse6, sizeof(lpse6));
2138
		if (error)
2139
			return (error);
2140
		if (lpse6.ss_len != sizeof(l_ss))
2141
			return (EINVAL);
2142
		if (lpse6.ss != 0) {
2143
			error = copyin(PTRIN(lpse6.ss), &l_ss,
2144
			    sizeof(l_ss));
2145
			if (error)
2146
				return (error);
2147
			linux_to_bsd_sigset(&l_ss, &ss);
2148
			ssp = &ss;
2149
		}
2150
	}
2151
2152
	/*
2153
	 * Currently glibc changes nanosecond number to microsecond.
2154
	 * This mean losing precision but for now it is hardly seen.
2155
	 */
2156
	if (args->tsp) {
2157
		error = copyin(args->tsp, &lts, sizeof(lts));
2158
		if (error)
2159
			return (error);
2160
		error = linux_to_native_timespec(&uts, &lts);
2161
		if (error)
2162
			return (error);
2163
2164
		TIMESPEC_TO_TIMEVAL(&utv, &uts);
2165
		if (itimerfix(&utv))
2166
			return (EINVAL);
2167
2168
		microtime(&tv0);
2169
		tvp = &utv;
2170
	} else
2171
		tvp = NULL;
2172
2173
	error = kern_pselect(td, args->nfds, args->readfds, args->writefds,
2174
	    args->exceptfds, tvp, ssp, sizeof(l_int) * 8);
2175
2176
	if (error == 0 && args->tsp) {
2177
		if (td->td_retval[0]) {
2178
			/*
2179
			 * Compute how much time was left of the timeout,
2180
			 * by subtracting the current time and the time
2181
			 * before we started the call, and subtracting
2182
			 * that result from the user-supplied value.
2183
			 */
2184
2185
			microtime(&tv1);
2186
			timevalsub(&tv1, &tv0);
2187
			timevalsub(&utv, &tv1);
2188
			if (utv.tv_sec < 0)
2189
				timevalclear(&utv);
2190
		} else
2191
			timevalclear(&utv);
2192
2193
		TIMEVAL_TO_TIMESPEC(&utv, &uts);
2194
		native_to_linux_timespec(&lts, &uts);
2195
		error = copyout(&lts, args->tsp, sizeof(lts));
2196
	}
2197
2198
	return (error);
2199
}
2200
2201
int
2202
linux_ppoll(struct thread *td, struct linux_ppoll_args *args)
2203
{
2204
	struct timespec ts0, ts1;
2205
	struct l_timespec lts;
2206
	struct timespec uts, *tsp;
2207
	l_sigset_t l_ss;
2208
	sigset_t *ssp;
2209
	sigset_t ss;
2210
	int error;
2211
2212
	if (args->sset != NULL) {
2213
		if (args->ssize != sizeof(l_ss))
2214
			return (EINVAL);
2215
		error = copyin(args->sset, &l_ss, sizeof(l_ss));
2216
		if (error)
2217
			return (error);
2218
		linux_to_bsd_sigset(&l_ss, &ss);
2219
		ssp = &ss;
2220
	} else
2221
		ssp = NULL;
2222
	if (args->tsp != NULL) {
2223
		error = copyin(args->tsp, &lts, sizeof(lts));
2224
		if (error)
2225
			return (error);
2226
		error = linux_to_native_timespec(&uts, &lts);
2227
		if (error)
2228
			return (error);
2229
2230
		nanotime(&ts0);
2231
		tsp = &uts;
2232
	} else
2233
		tsp = NULL;
2234
2235
	error = kern_poll(td, args->fds, args->nfds, tsp, ssp);
2236
2237
	if (error == 0 && args->tsp != NULL) {
2238
		if (td->td_retval[0]) {
2239
			nanotime(&ts1);
2240
			timespecsub(&ts1, &ts0);
2241
			timespecsub(&uts, &ts1);
2242
			if (uts.tv_sec < 0)
2243
				timespecclear(&uts);
2244
		} else
2245
			timespecclear(&uts);
2246
2247
		native_to_linux_timespec(&lts, &uts);
2248
		error = copyout(&lts, args->tsp, sizeof(lts));
2249
	}
2250
2251
	return (error);
2252
}
2253
2254
#if defined(DEBUG) || defined(KTR)
2255
/* XXX: can be removed when every ldebug(...) and KTR stuff are removed. */
2256
2257
u_char linux_debug_map[howmany(LINUX_SYS_MAXSYSCALL, sizeof(u_char))];
2258
2259
static int
2260
linux_debug(int syscall, int toggle, int global)
2261
{
2262
2263
	if (global) {
2264
		char c = toggle ? 0 : 0xff;
2265
2266
		memset(linux_debug_map, c, sizeof(linux_debug_map));
2267
		return (0);
2268
	}
2269
	if (syscall < 0 || syscall >= LINUX_SYS_MAXSYSCALL)
2270
		return (EINVAL);
2271
	if (toggle)
2272
		clrbit(linux_debug_map, syscall);
2273
	else
2274
		setbit(linux_debug_map, syscall);
2275
	return (0);
2276
}
2277
2278
/*
2279
 * Usage: sysctl linux.debug=<syscall_nr>.<0/1>
2280
 *
2281
 *    E.g.: sysctl linux.debug=21.0
2282
 *
2283
 * As a special case, syscall "all" will apply to all syscalls globally.
2284
 */
2285
#define LINUX_MAX_DEBUGSTR	16
2286
int
2287
linux_sysctl_debug(SYSCTL_HANDLER_ARGS)
2288
{
2289
	char value[LINUX_MAX_DEBUGSTR], *p;
2290
	int error, sysc, toggle;
2291
	int global = 0;
2292
2293
	value[0] = '\0';
2294
	error = sysctl_handle_string(oidp, value, LINUX_MAX_DEBUGSTR, req);
2295
	if (error || req->newptr == NULL)
2296
		return (error);
2297
	for (p = value; *p != '\0' && *p != '.'; p++);
2298
	if (*p == '\0')
2299
		return (EINVAL);
2300
	*p++ = '\0';
2301
	sysc = strtol(value, NULL, 0);
2302
	toggle = strtol(p, NULL, 0);
2303
	if (strcmp(value, "all") == 0)
2304
		global = 1;
2305
	error = linux_debug(sysc, toggle, global);
2306
	return (error);
2307
}
2308
2309
#endif /* DEBUG || KTR */
(-)sys/compat/linux/linux_misc.h (-6 / +32 lines)
Lines 31-36 Link Here
31
#ifndef _LINUX_MISC_H_
31
#ifndef _LINUX_MISC_H_
32
#define	_LINUX_MISC_H_
32
#define	_LINUX_MISC_H_
33
33
34
#include <sys/sysctl.h>
35
34
/*
36
/*
35
 * Miscellaneous
37
 * Miscellaneous
36
 */
38
 */
Lines 55-61 Link Here
55
#define	LINUX_MREMAP_MAYMOVE	1
57
#define	LINUX_MREMAP_MAYMOVE	1
56
#define	LINUX_MREMAP_FIXED	2
58
#define	LINUX_MREMAP_FIXED	2
57
59
58
extern const char *linux_platform;
60
extern const char *linux_kplatform;
59
61
60
/*
62
/*
61
 * Non-standard aux entry types used in Linux ELF binaries.
63
 * Non-standard aux entry types used in Linux ELF binaries.
Lines 68-75 Link Here
68
#define	LINUX_AT_BASE_PLATFORM	24	/* string identifying real platform, may
70
#define	LINUX_AT_BASE_PLATFORM	24	/* string identifying real platform, may
69
					 * differ from AT_PLATFORM.
71
					 * differ from AT_PLATFORM.
70
					 */
72
					 */
73
#define	LINUX_AT_RANDOM		25	/* address of random bytes */
71
#define	LINUX_AT_EXECFN		31	/* filename of program */
74
#define	LINUX_AT_EXECFN		31	/* filename of program */
75
#define	LINUX_AT_SYSINFO	32	/* vsyscall */
76
#define	LINUX_AT_SYSINFO_EHDR	33	/* vdso header */
72
77
78
#define	LINUX_AT_RANDOM_LEN	16	/* size of random bytes */
79
73
/* Linux sets the i387 to extended precision. */
80
/* Linux sets the i387 to extended precision. */
74
#if defined(__i386__) || defined(__amd64__)
81
#if defined(__i386__) || defined(__amd64__)
75
#define	__LINUX_NPXCW__		0x37f
82
#define	__LINUX_NPXCW__		0x37f
Lines 88-97 Link Here
88
#define	LINUX_CLONE_CHILD_CLEARTID	0x00200000
95
#define	LINUX_CLONE_CHILD_CLEARTID	0x00200000
89
#define	LINUX_CLONE_CHILD_SETTID	0x01000000
96
#define	LINUX_CLONE_CHILD_SETTID	0x01000000
90
97
91
#define	LINUX_THREADING_FLAGS					\
92
	(LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES |	\
93
	LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD)
94
95
/* Scheduling policies */
98
/* Scheduling policies */
96
#define	LINUX_SCHED_OTHER	0
99
#define	LINUX_SCHED_OTHER	0
97
#define	LINUX_SCHED_FIFO	1
100
#define	LINUX_SCHED_FIFO	1
Lines 113-125 Link Here
113
#define	LINUX_CLOCK_REALTIME_HR		4
116
#define	LINUX_CLOCK_REALTIME_HR		4
114
#define	LINUX_CLOCK_MONOTONIC_HR	5
117
#define	LINUX_CLOCK_MONOTONIC_HR	5
115
118
119
#define LINUX_UTIME_NOW			0x3FFFFFFF
120
#define LINUX_UTIME_OMIT		0x3FFFFFFE
121
116
extern int stclohz;
122
extern int stclohz;
117
123
118
#define __WCLONE 0x80000000
124
#define	LINUX_WNOHANG		0x00000001
125
#define	LINUX_WUNTRACED		0x00000002
126
#define	LINUX_WSTOPPED		LINUX_WUNTRACED
127
#define	LINUX_WEXITED		0x00000004
128
#define	LINUX_WCONTINUED	0x00000008
129
#define	LINUX_WNOWAIT		0x01000000
119
130
131
132
#define	__WNOTHREAD		0x20000000
133
#define	__WALL			0x40000000
134
#define	__WCLONE		0x80000000
135
136
/* Linux waitid idtype  */
137
#define	LINUX_P_ALL		0
138
#define	LINUX_P_PID		1
139
#define	LINUX_P_PGID		2
140
141
120
int linux_common_wait(struct thread *td, int pid, int *status,
142
int linux_common_wait(struct thread *td, int pid, int *status,
121
			int options, struct rusage *ru);
143
			int options, struct rusage *ru);
144
void linux_to_bsd_waitopts(int options, int *bsdopts);
122
int linux_set_upcall_kse(struct thread *td, register_t stack);
145
int linux_set_upcall_kse(struct thread *td, register_t stack);
123
int linux_set_cloned_tls(struct thread *td, void *desc);
146
int linux_set_cloned_tls(struct thread *td, void *desc);
147
struct thread	*linux_tdfind(struct thread *, lwpid_t, pid_t);
124
148
149
int linux_sysctl_debug(SYSCTL_HANDLER_ARGS);
150
125
#endif	/* _LINUX_MISC_H_ */
151
#endif	/* _LINUX_MISC_H_ */
(-)sys/compat/linux/linux_signal.c (-119 / +218 lines)
Lines 53-93 Link Here
53
#include <compat/linux/linux_signal.h>
53
#include <compat/linux/linux_signal.h>
54
#include <compat/linux/linux_util.h>
54
#include <compat/linux/linux_util.h>
55
#include <compat/linux/linux_emul.h>
55
#include <compat/linux/linux_emul.h>
56
#include <compat/linux/linux_misc.h>
56
57
57
void
58
static int	linux_do_tkill(struct thread *td, struct thread *tdt,
58
linux_to_bsd_sigset(l_sigset_t *lss, sigset_t *bss)
59
		    ksiginfo_t *ksi);
59
{
60
static void	sicode_to_lsicode(int si_code, int *lsi_code);
60
	int b, l;
61
61
62
	SIGEMPTYSET(*bss);
63
	bss->__bits[0] = lss->__bits[0] & ~((1U << LINUX_SIGTBLSZ) - 1);
64
	bss->__bits[1] = lss->__bits[1];
65
	for (l = 1; l <= LINUX_SIGTBLSZ; l++) {
66
		if (LINUX_SIGISMEMBER(*lss, l)) {
67
			b = linux_to_bsd_signal[_SIG_IDX(l)];
68
			if (b)
69
				SIGADDSET(*bss, b);
70
		}
71
	}
72
}
73
62
74
void
75
bsd_to_linux_sigset(sigset_t *bss, l_sigset_t *lss)
76
{
77
	int b, l;
78
79
	LINUX_SIGEMPTYSET(*lss);
80
	lss->__bits[0] = bss->__bits[0] & ~((1U << LINUX_SIGTBLSZ) - 1);
81
	lss->__bits[1] = bss->__bits[1];
82
	for (b = 1; b <= LINUX_SIGTBLSZ; b++) {
83
		if (SIGISMEMBER(*bss, b)) {
84
			l = bsd_to_linux_signal[_SIG_IDX(b)];
85
			if (l)
86
				LINUX_SIGADDSET(*lss, l);
87
		}
88
	}
89
}
90
91
static void
63
static void
92
linux_to_bsd_sigaction(l_sigaction_t *lsa, struct sigaction *bsa)
64
linux_to_bsd_sigaction(l_sigaction_t *lsa, struct sigaction *bsa)
93
{
65
{
Lines 155-166 Link Here
155
		linux_to_bsd_sigaction(linux_nsa, nsa);
127
		linux_to_bsd_sigaction(linux_nsa, nsa);
156
	} else
128
	} else
157
		nsa = NULL;
129
		nsa = NULL;
130
	sig = linux_to_bsd_signal(linux_sig);
158
131
159
	if (linux_sig <= LINUX_SIGTBLSZ)
160
		sig = linux_to_bsd_signal[_SIG_IDX(linux_sig)];
161
	else
162
		sig = linux_sig;
163
164
	error = kern_sigaction(td, sig, nsa, osa, 0);
132
	error = kern_sigaction(td, sig, nsa, osa, 0);
165
	if (error)
133
	if (error)
166
		return (error);
134
		return (error);
Lines 171-177 Link Here
171
	return (0);
139
	return (0);
172
}
140
}
173
141
174
142
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
175
int
143
int
176
linux_signal(struct thread *td, struct linux_signal_args *args)
144
linux_signal(struct thread *td, struct linux_signal_args *args)
177
{
145
{
Lines 193-198 Link Here
193
161
194
	return (error);
162
	return (error);
195
}
163
}
164
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
196
165
197
int
166
int
198
linux_rt_sigaction(struct thread *td, struct linux_rt_sigaction_args *args)
167
linux_rt_sigaction(struct thread *td, struct linux_rt_sigaction_args *args)
Lines 262-267 Link Here
262
	return (error);
231
	return (error);
263
}
232
}
264
233
234
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
265
int
235
int
266
linux_sigprocmask(struct thread *td, struct linux_sigprocmask_args *args)
236
linux_sigprocmask(struct thread *td, struct linux_sigprocmask_args *args)
267
{
237
{
Lines 279-285 Link Here
279
		if (error)
249
		if (error)
280
			return (error);
250
			return (error);
281
		LINUX_SIGEMPTYSET(set);
251
		LINUX_SIGEMPTYSET(set);
282
		set.__bits[0] = mask;
252
		set.__mask = mask;
283
	}
253
	}
284
254
285
	error = linux_do_sigprocmask(td, args->how,
255
	error = linux_do_sigprocmask(td, args->how,
Lines 287-298 Link Here
287
				     args->omask ? &oset : NULL);
257
				     args->omask ? &oset : NULL);
288
258
289
	if (args->omask != NULL && !error) {
259
	if (args->omask != NULL && !error) {
290
		mask = oset.__bits[0];
260
		mask = oset.__mask;
291
		error = copyout(&mask, args->omask, sizeof(l_osigset_t));
261
		error = copyout(&mask, args->omask, sizeof(l_osigset_t));
292
	}
262
	}
293
263
294
	return (error);
264
	return (error);
295
}
265
}
266
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
296
267
297
int
268
int
298
linux_rt_sigprocmask(struct thread *td, struct linux_rt_sigprocmask_args *args)
269
linux_rt_sigprocmask(struct thread *td, struct linux_rt_sigprocmask_args *args)
Lines 327-332 Link Here
327
	return (error);
298
	return (error);
328
}
299
}
329
300
301
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
330
int
302
int
331
linux_sgetmask(struct thread *td, struct linux_sgetmask_args *args)
303
linux_sgetmask(struct thread *td, struct linux_sgetmask_args *args)
332
{
304
{
Lines 341-347 Link Here
341
	PROC_LOCK(p);
313
	PROC_LOCK(p);
342
	bsd_to_linux_sigset(&td->td_sigmask, &mask);
314
	bsd_to_linux_sigset(&td->td_sigmask, &mask);
343
	PROC_UNLOCK(p);
315
	PROC_UNLOCK(p);
344
	td->td_retval[0] = mask.__bits[0];
316
	td->td_retval[0] = mask.__mask;
345
	return (0);
317
	return (0);
346
}
318
}
347
319
Lines 359-367 Link Here
359
331
360
	PROC_LOCK(p);
332
	PROC_LOCK(p);
361
	bsd_to_linux_sigset(&td->td_sigmask, &lset);
333
	bsd_to_linux_sigset(&td->td_sigmask, &lset);
362
	td->td_retval[0] = lset.__bits[0];
334
	td->td_retval[0] = lset.__mask;
363
	LINUX_SIGEMPTYSET(lset);
335
	LINUX_SIGEMPTYSET(lset);
364
	lset.__bits[0] = args->mask;
336
	lset.__mask = args->mask;
365
	linux_to_bsd_sigset(&lset, &bset);
337
	linux_to_bsd_sigset(&lset, &bset);
366
	td->td_sigmask = bset;
338
	td->td_sigmask = bset;
367
	SIG_CANTMASK(td->td_sigmask);
339
	SIG_CANTMASK(td->td_sigmask);
Lines 370-378 Link Here
370
	return (0);
342
	return (0);
371
}
343
}
372
344
373
/*
374
 * MPSAFE
375
 */
376
int
345
int
377
linux_sigpending(struct thread *td, struct linux_sigpending_args *args)
346
linux_sigpending(struct thread *td, struct linux_sigpending_args *args)
378
{
347
{
Lines 392-400 Link Here
392
	SIGSETAND(bset, td->td_sigmask);
361
	SIGSETAND(bset, td->td_sigmask);
393
	PROC_UNLOCK(p);
362
	PROC_UNLOCK(p);
394
	bsd_to_linux_sigset(&bset, &lset);
363
	bsd_to_linux_sigset(&bset, &lset);
395
	mask = lset.__bits[0];
364
	mask = lset.__mask;
396
	return (copyout(&mask, args->mask, sizeof(mask)));
365
	return (copyout(&mask, args->mask, sizeof(mask)));
397
}
366
}
367
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
398
368
399
/*
369
/*
400
 * MPSAFE
370
 * MPSAFE
Lines 458-465 Link Here
458
#ifdef DEBUG
428
#ifdef DEBUG
459
		if (ldebug(rt_sigtimedwait))
429
		if (ldebug(rt_sigtimedwait))
460
			printf(LMSG("linux_rt_sigtimedwait: "
430
			printf(LMSG("linux_rt_sigtimedwait: "
461
			    "incoming timeout (%d/%d)\n"),
431
			    "incoming timeout (%jd/%jd)\n"),
462
			    ltv.tv_sec, ltv.tv_usec);
432
			    (intmax_t)ltv.tv_sec, (intmax_t)ltv.tv_usec);
463
#endif
433
#endif
464
		tv.tv_sec = (long)ltv.tv_sec;
434
		tv.tv_sec = (long)ltv.tv_sec;
465
		tv.tv_usec = (suseconds_t)ltv.tv_usec;
435
		tv.tv_usec = (suseconds_t)ltv.tv_usec;
Lines 495-501 Link Here
495
	if (error)
465
	if (error)
496
		return (error);
466
		return (error);
497
467
498
	sig = BSD_TO_LINUX_SIGNAL(info.ksi_signo);
468
	sig = bsd_to_linux_signal(info.ksi_signo);
499
469
500
	if (args->ptr) {
470
	if (args->ptr) {
501
		memset(&linfo, 0, sizeof(linfo));
471
		memset(&linfo, 0, sizeof(linfo));
Lines 527-536 Link Here
527
	if (!LINUX_SIG_VALID(args->signum) && args->signum != 0)
497
	if (!LINUX_SIG_VALID(args->signum) && args->signum != 0)
528
		return (EINVAL);
498
		return (EINVAL);
529
499
530
	if (args->signum > 0 && args->signum <= LINUX_SIGTBLSZ)
500
	if (args->signum > 0)
531
		tmp.signum = linux_to_bsd_signal[_SIG_IDX(args->signum)];
501
		tmp.signum = linux_to_bsd_signal(args->signum);
532
	else
502
	else
533
		tmp.signum = args->signum;
503
		tmp.signum = 0;
534
504
535
	tmp.pid = args->pid;
505
	tmp.pid = args->pid;
536
	return (sys_kill(td, &tmp));
506
	return (sys_kill(td, &tmp));
Lines 537-593 Link Here
537
}
507
}
538
508
539
static int
509
static int
540
linux_do_tkill(struct thread *td, l_int tgid, l_int pid, l_int signum)
510
linux_do_tkill(struct thread *td, struct thread *tdt, ksiginfo_t *ksi)
541
{
511
{
542
	struct proc *proc = td->td_proc;
543
	struct linux_emuldata *em;
544
	struct proc *p;
512
	struct proc *p;
545
	ksiginfo_t ksi;
546
	int error;
513
	int error;
547
514
548
	AUDIT_ARG_SIGNUM(signum);
515
	p = tdt->td_proc;
549
	AUDIT_ARG_PID(pid);
516
	AUDIT_ARG_SIGNUM(ksi->ksi_signo);
550
517
	AUDIT_ARG_PID(p->p_pid);
551
	/*
552
	 * Allow signal 0 as a means to check for privileges
553
	 */
554
	if (!LINUX_SIG_VALID(signum) && signum != 0)
555
		return (EINVAL);
556
557
	if (signum > 0 && signum <= LINUX_SIGTBLSZ)
558
		signum = linux_to_bsd_signal[_SIG_IDX(signum)];
559
560
	if ((p = pfind(pid)) == NULL) {
561
		if ((p = zpfind(pid)) == NULL)
562
			return (ESRCH);
563
	}
564
565
	AUDIT_ARG_PROCESS(p);
518
	AUDIT_ARG_PROCESS(p);
566
	error = p_cansignal(td, p, signum);
567
	if (error != 0 || signum == 0)
568
		goto out;
569
519
570
	error = ESRCH;
520
	error = p_cansignal(td, p, ksi->ksi_signo);
571
	em = em_find(p, EMUL_DONTLOCK);
521
	if (error != 0 || ksi->ksi_signo == 0)
572
573
	if (em == NULL) {
574
#ifdef DEBUG
575
		printf("emuldata not found in do_tkill.\n");
576
#endif
577
		goto out;
522
		goto out;
578
	}
579
	if (tgid > 0 && em->shared->group_pid != tgid)
580
		goto out;
581
523
582
	ksiginfo_init(&ksi);
524
	tdksignal(tdt, ksi->ksi_signo, ksi);
583
	ksi.ksi_signo = signum;
584
	ksi.ksi_code = LINUX_SI_TKILL;
585
	ksi.ksi_errno = 0;
586
	ksi.ksi_pid = proc->p_pid;
587
	ksi.ksi_uid = proc->p_ucred->cr_ruid;
588
525
589
	error = pksignal(p, ksi.ksi_signo, &ksi);
590
591
out:
526
out:
592
	PROC_UNLOCK(p);
527
	PROC_UNLOCK(p);
593
	return (error);
528
	return (error);
Lines 596-615 Link Here
596
int
531
int
597
linux_tgkill(struct thread *td, struct linux_tgkill_args *args)
532
linux_tgkill(struct thread *td, struct linux_tgkill_args *args)
598
{
533
{
534
	struct thread *tdt;
535
	ksiginfo_t ksi;
536
	int sig;
599
537
600
#ifdef DEBUG
538
#ifdef DEBUG
601
	if (ldebug(tgkill))
539
	if (ldebug(tgkill))
602
		printf(ARGS(tgkill, "%d, %d, %d"), args->tgid, args->pid, args->sig);
540
		printf(ARGS(tgkill, "%d, %d, %d"),
541
		    args->tgid, args->pid, args->sig);
603
#endif
542
#endif
543
604
	if (args->pid <= 0 || args->tgid <=0)
544
	if (args->pid <= 0 || args->tgid <=0)
605
		return (EINVAL);
545
		return (EINVAL);
606
546
607
	return (linux_do_tkill(td, args->tgid, args->pid, args->sig));
547
	/*
548
	 * Allow signal 0 as a means to check for privileges
549
	 */
550
	if (!LINUX_SIG_VALID(args->sig) && args->sig != 0)
551
		return (EINVAL);
552
553
	if (args->sig > 0)
554
		sig = linux_to_bsd_signal(args->sig);
555
	else
556
		sig = 0;
557
558
	tdt = linux_tdfind(td, args->pid, args->tgid);
559
	if (tdt == NULL)
560
		return (ESRCH);
561
562
	ksiginfo_init(&ksi);
563
	ksi.ksi_signo = sig;
564
	ksi.ksi_code = SI_LWP;
565
	ksi.ksi_errno = 0;
566
	ksi.ksi_pid = td->td_proc->p_pid;
567
	ksi.ksi_uid = td->td_proc->p_ucred->cr_ruid;
568
	return (linux_do_tkill(td, tdt, &ksi));
608
}
569
}
609
570
571
/*
572
 * Deprecated since 2.5.75. Replaced by tgkill().
573
 */
610
int
574
int
611
linux_tkill(struct thread *td, struct linux_tkill_args *args)
575
linux_tkill(struct thread *td, struct linux_tkill_args *args)
612
{
576
{
577
	struct thread *tdt;
578
	ksiginfo_t ksi;
579
	int sig;
580
613
#ifdef DEBUG
581
#ifdef DEBUG
614
	if (ldebug(tkill))
582
	if (ldebug(tkill))
615
		printf(ARGS(tkill, "%i, %i"), args->tid, args->sig);
583
		printf(ARGS(tkill, "%i, %i"), args->tid, args->sig);
Lines 617-623 Link Here
617
	if (args->tid <= 0)
585
	if (args->tid <= 0)
618
		return (EINVAL);
586
		return (EINVAL);
619
587
620
	return (linux_do_tkill(td, 0, args->tid, args->sig));
588
	if (!LINUX_SIG_VALID(args->sig))
589
		return (EINVAL);
590
591
	sig = linux_to_bsd_signal(args->sig);
592
593
	tdt = linux_tdfind(td, args->tid, -1);
594
	if (tdt == NULL)
595
		return (ESRCH);
596
597
	ksiginfo_init(&ksi);
598
	ksi.ksi_signo = sig;
599
	ksi.ksi_code = SI_LWP;
600
	ksi.ksi_errno = 0;
601
	ksi.ksi_pid = td->td_proc->p_pid;
602
	ksi.ksi_uid = td->td_proc->p_ucred->cr_ruid;
603
	return (linux_do_tkill(td, tdt, &ksi));
621
}
604
}
622
605
623
void
606
void
Lines 624-656 Link Here
624
ksiginfo_to_lsiginfo(ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig)
607
ksiginfo_to_lsiginfo(ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig)
625
{
608
{
626
609
627
	lsi->lsi_signo = sig;
610
	siginfo_to_lsiginfo(&ksi->ksi_info, lsi, sig);
628
	lsi->lsi_code = ksi->ksi_code;
611
}
629
612
630
	switch (sig) {
613
static void
631
	case LINUX_SIGPOLL:
614
sicode_to_lsicode(int si_code, int *lsi_code)
632
		/* XXX si_fd? */
615
{
633
		lsi->lsi_band = ksi->ksi_band;
616
617
	switch (si_code) {
618
	case SI_USER:
619
		*lsi_code = LINUX_SI_TIMER;
634
		break;
620
		break;
635
	case LINUX_SIGCHLD:
621
	case SI_KERNEL:
636
		lsi->lsi_pid = ksi->ksi_pid;
622
		*lsi_code = LINUX_SI_KERNEL;
637
		lsi->lsi_uid = ksi->ksi_uid;
638
		lsi->lsi_status = ksi->ksi_status;
639
		break;
623
		break;
640
	case LINUX_SIGBUS:
624
	case SI_QUEUE:
641
	case LINUX_SIGILL:
625
		*lsi_code = LINUX_SI_QUEUE;
642
	case LINUX_SIGFPE:
643
	case LINUX_SIGSEGV:
644
		lsi->lsi_addr = PTROUT(ksi->ksi_addr);
645
		break;
626
		break;
627
	case SI_TIMER:
628
		*lsi_code = LINUX_SI_TIMER;
629
		break;
630
	case SI_MESGQ:
631
		*lsi_code = LINUX_SI_MESGQ;
632
		break;
633
	case SI_ASYNCIO:
634
		*lsi_code = LINUX_SI_ASYNCIO;
635
		break;
636
	case SI_LWP:
637
		*lsi_code = LINUX_SI_TKILL;
638
		break;
646
	default:
639
	default:
647
		/* XXX SI_TIMER etc... */
640
		*lsi_code = si_code;
648
		lsi->lsi_pid = ksi->ksi_pid;
649
		lsi->lsi_uid = ksi->ksi_uid;
650
		break;
641
		break;
651
	}
642
	}
652
	if (sig >= LINUX_SIGRTMIN) {
643
}
653
		lsi->lsi_int = ksi->ksi_info.si_value.sival_int;
644
654
		lsi->lsi_ptr = PTROUT(ksi->ksi_info.si_value.sival_ptr);
645
void
646
lsiginfo_to_ksiginfo(l_siginfo_t *lsi, ksiginfo_t *ksi, int sig)
647
{
648
649
	ksi->ksi_signo = sig;
650
	ksi->ksi_code = lsi->lsi_code;	/* XXX. Convert. */
651
	ksi->ksi_pid = lsi->lsi_pid;
652
	ksi->ksi_uid = lsi->lsi_uid;
653
	ksi->ksi_status = lsi->lsi_status;
654
	ksi->ksi_addr = PTRIN(lsi->lsi_addr);
655
	ksi->ksi_info.si_value.sival_int = lsi->lsi_int;
656
}
657
658
int
659
linux_rt_sigqueueinfo(struct thread *td, struct linux_rt_sigqueueinfo_args *args)
660
{
661
	l_siginfo_t linfo;
662
	struct proc *p;
663
	ksiginfo_t ksi;
664
	int error;
665
	int sig;
666
667
	if (!LINUX_SIG_VALID(args->sig))
668
		return (EINVAL);
669
670
	if ((error = copyin(args->info, &linfo, sizeof(linfo))))
671
		return (error);
672
673
	if (linfo.lsi_code >= 0)
674
		return (EPERM);
675
676
	sig = linux_to_bsd_signal(args->sig);
677
678
	error = ESRCH;
679
	if ((p = pfind(args->pid)) != NULL ||
680
	    (p = zpfind(args->pid)) != NULL) {
681
		ksiginfo_init(&ksi);
682
		lsiginfo_to_ksiginfo(&linfo, &ksi, sig);
683
		error = tdsendsignal(p, NULL, sig, &ksi);
684
		PROC_UNLOCK(p);
655
	}
685
	}
686
	return (error);
656
}
687
}
688
689
void
690
siginfo_to_lsiginfo(siginfo_t *si, l_siginfo_t *lsi, l_int sig)
691
{
692
693
	/* sig alredy converted */
694
 	lsi->lsi_signo = sig;
695
	sicode_to_lsicode(si->si_code, &lsi->lsi_code);
696
 
697
	switch (si->si_code) {
698
	case SI_LWP:
699
 		lsi->lsi_pid = si->si_pid;
700
 		lsi->lsi_uid = si->si_uid;
701
		break;
702
703
	case SI_TIMER:
704
		lsi->lsi_int = si->si_value.sival_int;
705
		lsi->lsi_ptr = PTROUT(si->si_value.sival_ptr);
706
		lsi->lsi_tid = si->si_timerid;
707
 		break;
708
709
	case SI_QUEUE:
710
 		lsi->lsi_pid = si->si_pid;
711
 		lsi->lsi_uid = si->si_uid;
712
		lsi->lsi_ptr = PTROUT(si->si_value.sival_ptr);
713
 		break;
714
715
	case SI_ASYNCIO:
716
 		lsi->lsi_int = si->si_value.sival_int;
717
 		lsi->lsi_ptr = PTROUT(si->si_value.sival_ptr);
718
		break;
719
720
	default:
721
		switch (sig) {
722
		case LINUX_SIGPOLL:
723
			/* XXX si_fd? */
724
			lsi->lsi_band = si->si_band;
725
			break;
726
		case LINUX_SIGCHLD:
727
			lsi->lsi_errno = 0;
728
			lsi->lsi_pid = si->si_pid;
729
			lsi->lsi_uid = si->si_uid;
730
731
			if (si->si_code == CLD_STOPPED)
732
				lsi->lsi_status = bsd_to_linux_signal(si->si_status);
733
			else if (si->si_code == CLD_CONTINUED)
734
				lsi->lsi_status = LINUX_SIGCONT;
735
			else
736
				lsi->lsi_status = si->si_status;
737
			break;
738
		case LINUX_SIGBUS:
739
		case LINUX_SIGILL:
740
		case LINUX_SIGFPE:
741
		case LINUX_SIGSEGV:
742
			lsi->lsi_addr = PTROUT(si->si_addr);
743
			break;
744
		default:
745
 			lsi->lsi_pid = si->si_pid;
746
 			lsi->lsi_uid = si->si_uid;
747
			if (sig >= LINUX_SIGRTMIN) {
748
 				lsi->lsi_int = si->si_value.sival_int;
749
 				lsi->lsi_ptr = PTROUT(si->si_value.sival_ptr);
750
			}
751
			break;
752
		}
753
		break;
754
 	}
755
}
(-)sys/compat/linux/linux_signal.h (-11 / +13 lines)
Lines 31-49 Link Here
31
#ifndef _LINUX_SIGNAL_H_
31
#ifndef _LINUX_SIGNAL_H_
32
#define _LINUX_SIGNAL_H_
32
#define _LINUX_SIGNAL_H_
33
33
34
#define	LINUX_SI_TKILL		-6;
34
/*
35
 * si_code values
36
 */
37
#define	LINUX_SI_USER		0	/* sent by kill, sigsend, raise */
38
#define	LINUX_SI_KERNEL		0x80	/* sent by the kernel from somewhere */
39
#define	LINUX_SI_QUEUE		-1	/* sent by sigqueue */
40
#define	LINUX_SI_TIMER		-2	/* sent by timer expiration */
41
#define	LINUX_SI_MESGQ		-3	/* sent by real time mesq state change */
42
#define	LINUX_SI_ASYNCIO	-4	/* sent by AIO completion */
43
#define	LINUX_SI_SIGIO		-5	/* sent by queued SIGIO */
44
#define	LINUX_SI_TKILL		-6	/* sent by tkill system call */
35
45
36
extern int bsd_to_linux_signal[];
37
extern int linux_to_bsd_signal[];
38
39
void linux_to_bsd_sigset(l_sigset_t *, sigset_t *);
40
void bsd_to_linux_sigset(sigset_t *, l_sigset_t *);
41
int linux_do_sigaction(struct thread *, int, l_sigaction_t *, l_sigaction_t *);
46
int linux_do_sigaction(struct thread *, int, l_sigaction_t *, l_sigaction_t *);
47
void lsiginfo_to_ksiginfo(l_siginfo_t *lsi, ksiginfo_t *ksi, int sig);
42
void ksiginfo_to_lsiginfo(ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig);
48
void ksiginfo_to_lsiginfo(ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig);
49
void siginfo_to_lsiginfo(siginfo_t *si, l_siginfo_t *lsi, l_int sig);
43
50
44
#define LINUX_SIG_VALID(sig)	((sig) <= LINUX_NSIG && (sig) > 0)
45
46
#define BSD_TO_LINUX_SIGNAL(sig)				\
47
	(((sig) <= LINUX_SIGTBLSZ) ? bsd_to_linux_signal[_SIG_IDX(sig)] : sig)
48
49
#endif /* _LINUX_SIGNAL_H_ */
51
#endif /* _LINUX_SIGNAL_H_ */
(-)sys/compat/linux/linux_socket.c (-261 / +251 lines)
Lines 70-79 Link Here
70
#include <machine/../linux/linux.h>
70
#include <machine/../linux/linux.h>
71
#include <machine/../linux/linux_proto.h>
71
#include <machine/../linux/linux_proto.h>
72
#endif
72
#endif
73
#include <compat/linux/linux_file.h>
73
#include <compat/linux/linux_socket.h>
74
#include <compat/linux/linux_socket.h>
75
#include <compat/linux/linux_timer.h>
74
#include <compat/linux/linux_util.h>
76
#include <compat/linux/linux_util.h>
75
77
76
static int linux_to_bsd_domain(int);
78
static int linux_to_bsd_domain(int);
79
static int linux_sendmsg_common(struct thread *, l_int, struct l_msghdr *,
80
					l_uint);
81
static int linux_recvmsg_common(struct thread *, l_int, struct l_msghdr *,
82
					l_uint, struct msghdr *);
83
static int linux_set_socket_flags(int, int *);
77
84
78
/*
85
/*
79
 * Reads a linux sockaddr and does any necessary translation.
86
 * Reads a linux sockaddr and does any necessary translation.
Lines 428-434 Link Here
428
	return (error);
435
	return (error);
429
}
436
}
430
437
431
432
static int
438
static int
433
linux_sa_put(struct osockaddr *osa)
439
linux_sa_put(struct osockaddr *osa)
434
{
440
{
Lines 477-482 Link Here
477
		return (LINUX_SCM_RIGHTS);
483
		return (LINUX_SCM_RIGHTS);
478
	case SCM_CREDS:
484
	case SCM_CREDS:
479
		return (LINUX_SCM_CREDENTIALS);
485
		return (LINUX_SCM_CREDENTIALS);
486
	case SCM_TIMESTAMP:
487
		return (LINUX_SCM_TIMESTAMP);
480
	}
488
	}
481
	return (-1);
489
	return (-1);
482
}
490
}
Lines 529-548 Link Here
529
}
537
}
530
538
531
static int
539
static int
532
linux_set_socket_flags(struct thread *td, int s, int flags)
540
linux_set_socket_flags(int lflags, int *flags)
533
{
541
{
534
	int error;
535
542
536
	if (flags & LINUX_SOCK_NONBLOCK) {
543
	if (lflags & ~(LINUX_SOCK_CLOEXEC | LINUX_SOCK_NONBLOCK))
537
		error = kern_fcntl(td, s, F_SETFL, O_NONBLOCK);
544
		return (EINVAL);
538
		if (error)
545
	if (lflags & LINUX_SOCK_NONBLOCK)
539
			return (error);
546
		*flags |= SOCK_NONBLOCK;
540
	}
547
	if (lflags & LINUX_SOCK_CLOEXEC)
541
	if (flags & LINUX_SOCK_CLOEXEC) {
548
		*flags |= SOCK_CLOEXEC;
542
		error = kern_fcntl(td, s, F_SETFD, FD_CLOEXEC);
543
		if (error)
544
			return (error);
545
	}
546
	return (0);
549
	return (0);
547
}
550
}
548
551
Lines 585-599 Link Here
585
	return (optval == 0);
588
	return (optval == 0);
586
}
589
}
587
590
588
struct linux_sendto_args {
589
	int s;
590
	l_uintptr_t msg;
591
	int len;
592
	int flags;
593
	l_uintptr_t to;
594
	int tolen;
595
};
596
597
/*
591
/*
598
 * Updated sendto() when IP_HDRINCL is set:
592
 * Updated sendto() when IP_HDRINCL is set:
599
 * tweak endian-dependent fields in the IP packet.
593
 * tweak endian-dependent fields in the IP packet.
Lines 618-624 Link Here
618
	    linux_args->len > IP_MAXPACKET)
612
	    linux_args->len > IP_MAXPACKET)
619
		return (EINVAL);
613
		return (EINVAL);
620
614
621
	packet = (struct ip *)malloc(linux_args->len, M_TEMP, M_WAITOK);
615
	packet = (struct ip *)malloc(linux_args->len, M_LINUX, M_WAITOK);
622
616
623
	/* Make kernel copy of the packet to be sent */
617
	/* Make kernel copy of the packet to be sent */
624
	if ((error = copyin(PTRIN(linux_args->msg), packet,
618
	if ((error = copyin(PTRIN(linux_args->msg), packet,
Lines 641-657 Link Here
641
	error = linux_sendit(td, linux_args->s, &msg, linux_args->flags,
635
	error = linux_sendit(td, linux_args->s, &msg, linux_args->flags,
642
	    NULL, UIO_SYSSPACE);
636
	    NULL, UIO_SYSSPACE);
643
goout:
637
goout:
644
	free(packet, M_TEMP);
638
	free(packet, M_LINUX);
645
	return (error);
639
	return (error);
646
}
640
}
647
641
648
struct linux_socket_args {
642
int
649
	int domain;
650
	int type;
651
	int protocol;
652
};
653
654
static int
655
linux_socket(struct thread *td, struct linux_socket_args *args)
643
linux_socket(struct thread *td, struct linux_socket_args *args)
656
{
644
{
657
	struct socket_args /* {
645
	struct socket_args /* {
Lines 659-673 Link Here
659
		int type;
647
		int type;
660
		int protocol;
648
		int protocol;
661
	} */ bsd_args;
649
	} */ bsd_args;
662
	int retval_socket, socket_flags;
650
	int retval_socket;
663
651
664
	bsd_args.protocol = args->protocol;
652
	bsd_args.protocol = args->protocol;
665
	socket_flags = args->type & ~LINUX_SOCK_TYPE_MASK;
666
	if (socket_flags & ~(LINUX_SOCK_CLOEXEC | LINUX_SOCK_NONBLOCK))
667
		return (EINVAL);
668
	bsd_args.type = args->type & LINUX_SOCK_TYPE_MASK;
653
	bsd_args.type = args->type & LINUX_SOCK_TYPE_MASK;
669
	if (bsd_args.type < 0 || bsd_args.type > LINUX_SOCK_MAX)
654
	if (bsd_args.type < 0 || bsd_args.type > LINUX_SOCK_MAX)
670
		return (EINVAL);
655
		return (EINVAL);
656
	retval_socket = linux_set_socket_flags(args->type & ~LINUX_SOCK_TYPE_MASK,
657
		&bsd_args.type);
658
	if (retval_socket != 0)
659
		return (retval_socket);
671
	bsd_args.domain = linux_to_bsd_domain(args->domain);
660
	bsd_args.domain = linux_to_bsd_domain(args->domain);
672
	if (bsd_args.domain == -1)
661
	if (bsd_args.domain == -1)
673
		return (EAFNOSUPPORT);
662
		return (EAFNOSUPPORT);
Lines 676-688 Link Here
676
	if (retval_socket)
665
	if (retval_socket)
677
		return (retval_socket);
666
		return (retval_socket);
678
667
679
	retval_socket = linux_set_socket_flags(td, td->td_retval[0],
680
	    socket_flags);
681
	if (retval_socket) {
682
		(void)kern_close(td, td->td_retval[0]);
683
		goto out;
684
	}
685
686
	if (bsd_args.type == SOCK_RAW
668
	if (bsd_args.type == SOCK_RAW
687
	    && (bsd_args.protocol == IPPROTO_RAW || bsd_args.protocol == 0)
669
	    && (bsd_args.protocol == IPPROTO_RAW || bsd_args.protocol == 0)
688
	    && bsd_args.domain == PF_INET) {
670
	    && bsd_args.domain == PF_INET) {
Lines 711-727 Link Here
711
	}
693
	}
712
#endif
694
#endif
713
695
714
out:
715
	return (retval_socket);
696
	return (retval_socket);
716
}
697
}
717
698
718
struct linux_bind_args {
699
int
719
	int s;
720
	l_uintptr_t name;
721
	int namelen;
722
};
723
724
static int
725
linux_bind(struct thread *td, struct linux_bind_args *args)
700
linux_bind(struct thread *td, struct linux_bind_args *args)
726
{
701
{
727
	struct sockaddr *sa;
702
	struct sockaddr *sa;
Lines 739-751 Link Here
739
	return (error);
714
	return (error);
740
}
715
}
741
716
742
struct linux_connect_args {
743
	int s;
744
	l_uintptr_t name;
745
	int namelen;
746
};
747
int linux_connect(struct thread *, struct linux_connect_args *);
748
749
int
717
int
750
linux_connect(struct thread *td, struct linux_connect_args *args)
718
linux_connect(struct thread *td, struct linux_connect_args *args)
751
{
719
{
Lines 790-801 Link Here
790
	return (error);
758
	return (error);
791
}
759
}
792
760
793
struct linux_listen_args {
761
int
794
	int s;
795
	int backlog;
796
};
797
798
static int
799
linux_listen(struct thread *td, struct linux_listen_args *args)
762
linux_listen(struct thread *td, struct linux_listen_args *args)
800
{
763
{
801
	struct listen_args /* {
764
	struct listen_args /* {
Lines 812-832 Link Here
812
linux_accept_common(struct thread *td, int s, l_uintptr_t addr,
775
linux_accept_common(struct thread *td, int s, l_uintptr_t addr,
813
    l_uintptr_t namelen, int flags)
776
    l_uintptr_t namelen, int flags)
814
{
777
{
815
	struct accept_args /* {
778
	struct accept4_args /* {
816
		int	s;
779
		int	s;
817
		struct sockaddr * __restrict name;
780
		struct sockaddr * __restrict name;
818
		socklen_t * __restrict anamelen;
781
		socklen_t * __restrict anamelen;
782
		int	flags;
819
	} */ bsd_args;
783
	} */ bsd_args;
820
	int error;
784
	int error;
821
785
822
	if (flags & ~(LINUX_SOCK_CLOEXEC | LINUX_SOCK_NONBLOCK))
823
		return (EINVAL);
824
825
	bsd_args.s = s;
786
	bsd_args.s = s;
826
	/* XXX: */
787
	/* XXX: */
827
	bsd_args.name = (struct sockaddr * __restrict)PTRIN(addr);
788
	bsd_args.name = (struct sockaddr * __restrict)PTRIN(addr);
828
	bsd_args.anamelen = PTRIN(namelen);/* XXX */
789
	bsd_args.anamelen = PTRIN(namelen);/* XXX */
829
	error = sys_accept(td, &bsd_args);
790
	error = linux_set_socket_flags(flags, &bsd_args.flags);
791
	if (error != 0)
792
		return (error);
793
	error = sys_accept4(td, &bsd_args);
830
	bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.name);
794
	bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.name);
831
	if (error) {
795
	if (error) {
832
		if (error == EFAULT && namelen != sizeof(struct sockaddr_in))
796
		if (error == EFAULT && namelen != sizeof(struct sockaddr_in))
Lines 833-854 Link Here
833
			return (EINVAL);
797
			return (EINVAL);
834
		return (error);
798
		return (error);
835
	}
799
	}
836
837
	/*
838
	 * linux appears not to copy flags from the parent socket to the
839
	 * accepted one, so we must clear the flags in the new descriptor
840
	 * and apply the requested flags.
841
	 */
842
	error = kern_fcntl(td, td->td_retval[0], F_SETFL, 0);
843
	if (error)
844
		goto out;
845
	error = linux_set_socket_flags(td, td->td_retval[0], flags);
846
	if (error)
847
		goto out;
848
	if (addr)
800
	if (addr)
849
		error = linux_sa_put(PTRIN(addr));
801
		error = linux_sa_put(PTRIN(addr));
850
851
out:
852
	if (error) {
802
	if (error) {
853
		(void)kern_close(td, td->td_retval[0]);
803
		(void)kern_close(td, td->td_retval[0]);
854
		td->td_retval[0] = 0;
804
		td->td_retval[0] = 0;
Lines 856-868 Link Here
856
	return (error);
806
	return (error);
857
}
807
}
858
808
859
struct linux_accept_args {
809
int
860
	int s;
861
	l_uintptr_t addr;
862
	l_uintptr_t namelen;
863
};
864
865
static int
866
linux_accept(struct thread *td, struct linux_accept_args *args)
810
linux_accept(struct thread *td, struct linux_accept_args *args)
867
{
811
{
868
812
Lines 870-883 Link Here
870
	    args->namelen, 0));
814
	    args->namelen, 0));
871
}
815
}
872
816
873
struct linux_accept4_args {
817
int
874
	int s;
875
	l_uintptr_t addr;
876
	l_uintptr_t namelen;
877
	int flags;
878
};
879
880
static int
881
linux_accept4(struct thread *td, struct linux_accept4_args *args)
818
linux_accept4(struct thread *td, struct linux_accept4_args *args)
882
{
819
{
883
820
Lines 885-897 Link Here
885
	    args->namelen, args->flags));
822
	    args->namelen, args->flags));
886
}
823
}
887
824
888
struct linux_getsockname_args {
825
int
889
	int s;
890
	l_uintptr_t addr;
891
	l_uintptr_t namelen;
892
};
893
894
static int
895
linux_getsockname(struct thread *td, struct linux_getsockname_args *args)
826
linux_getsockname(struct thread *td, struct linux_getsockname_args *args)
896
{
827
{
897
	struct getsockname_args /* {
828
	struct getsockname_args /* {
Lines 915-927 Link Here
915
	return (0);
846
	return (0);
916
}
847
}
917
848
918
struct linux_getpeername_args {
849
int
919
	int s;
920
	l_uintptr_t addr;
921
	l_uintptr_t namelen;
922
};
923
924
static int
925
linux_getpeername(struct thread *td, struct linux_getpeername_args *args)
850
linux_getpeername(struct thread *td, struct linux_getpeername_args *args)
926
{
851
{
927
	struct getpeername_args /* {
852
	struct getpeername_args /* {
Lines 944-957 Link Here
944
	return (0);
869
	return (0);
945
}
870
}
946
871
947
struct linux_socketpair_args {
872
int
948
	int domain;
949
	int type;
950
	int protocol;
951
	l_uintptr_t rsv;
952
};
953
954
static int
955
linux_socketpair(struct thread *td, struct linux_socketpair_args *args)
873
linux_socketpair(struct thread *td, struct linux_socketpair_args *args)
956
{
874
{
957
	struct socketpair_args /* {
875
	struct socketpair_args /* {
Lines 960-979 Link Here
960
		int protocol;
878
		int protocol;
961
		int *rsv;
879
		int *rsv;
962
	} */ bsd_args;
880
	} */ bsd_args;
963
	int error, socket_flags;
881
	int error;
964
	int sv[2];
965
882
966
	bsd_args.domain = linux_to_bsd_domain(args->domain);
883
	bsd_args.domain = linux_to_bsd_domain(args->domain);
967
	if (bsd_args.domain != PF_LOCAL)
884
	if (bsd_args.domain != PF_LOCAL)
968
		return (EAFNOSUPPORT);
885
		return (EAFNOSUPPORT);
969
970
	socket_flags = args->type & ~LINUX_SOCK_TYPE_MASK;
971
	if (socket_flags & ~(LINUX_SOCK_CLOEXEC | LINUX_SOCK_NONBLOCK))
972
		return (EINVAL);
973
	bsd_args.type = args->type & LINUX_SOCK_TYPE_MASK;
886
	bsd_args.type = args->type & LINUX_SOCK_TYPE_MASK;
974
	if (bsd_args.type < 0 || bsd_args.type > LINUX_SOCK_MAX)
887
	if (bsd_args.type < 0 || bsd_args.type > LINUX_SOCK_MAX)
975
		return (EINVAL);
888
		return (EINVAL);
976
889
	error = linux_set_socket_flags(args->type & ~LINUX_SOCK_TYPE_MASK,
890
		&bsd_args.type);
891
	if (error != 0)
892
		return (error);
977
	if (args->protocol != 0 && args->protocol != PF_UNIX)
893
	if (args->protocol != 0 && args->protocol != PF_UNIX)
978
894
979
		/*
895
		/*
Lines 986-1012 Link Here
986
	else
902
	else
987
		bsd_args.protocol = 0;
903
		bsd_args.protocol = 0;
988
	bsd_args.rsv = (int *)PTRIN(args->rsv);
904
	bsd_args.rsv = (int *)PTRIN(args->rsv);
989
	error = kern_socketpair(td, bsd_args.domain, bsd_args.type,
905
	return (sys_socketpair(td, &bsd_args));
990
	    bsd_args.protocol, sv);
991
	if (error)
992
		return (error);
993
	error = linux_set_socket_flags(td, sv[0], socket_flags);
994
	if (error)
995
		goto out;
996
	error = linux_set_socket_flags(td, sv[1], socket_flags);
997
	if (error)
998
		goto out;
999
1000
	error = copyout(sv, bsd_args.rsv, 2 * sizeof(int));
1001
1002
out:
1003
	if (error) {
1004
		(void)kern_close(td, sv[0]);
1005
		(void)kern_close(td, sv[1]);
1006
	}
1007
	return (error);
1008
}
906
}
1009
907
908
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
1010
struct linux_send_args {
909
struct linux_send_args {
1011
	int s;
910
	int s;
1012
	l_uintptr_t msg;
911
	l_uintptr_t msg;
Lines 1062-1069 Link Here
1062
	bsd_args.fromlenaddr = 0;
961
	bsd_args.fromlenaddr = 0;
1063
	return (sys_recvfrom(td, &bsd_args));
962
	return (sys_recvfrom(td, &bsd_args));
1064
}
963
}
964
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
1065
965
1066
static int
966
int
1067
linux_sendto(struct thread *td, struct linux_sendto_args *args)
967
linux_sendto(struct thread *td, struct linux_sendto_args *args)
1068
{
968
{
1069
	struct msghdr msg;
969
	struct msghdr msg;
Lines 1087-1149 Link Here
1087
	return (error);
987
	return (error);
1088
}
988
}
1089
989
1090
struct linux_recvfrom_args {
990
int
1091
	int s;
1092
	l_uintptr_t buf;
1093
	int len;
1094
	int flags;
1095
	l_uintptr_t from;
1096
	l_uintptr_t fromlen;
1097
};
1098
1099
static int
1100
linux_recvfrom(struct thread *td, struct linux_recvfrom_args *args)
991
linux_recvfrom(struct thread *td, struct linux_recvfrom_args *args)
1101
{
992
{
1102
	struct recvfrom_args /* {
993
	struct msghdr msg;
1103
		int	s;
994
	struct iovec aiov;
1104
		caddr_t	buf;
1105
		size_t	len;
1106
		int	flags;
1107
		struct sockaddr * __restrict from;
1108
		socklen_t * __restrict fromlenaddr;
1109
	} */ bsd_args;
1110
	size_t len;
1111
	int error;
995
	int error;
1112
996
1113
	if ((error = copyin(PTRIN(args->fromlen), &len, sizeof(size_t))))
997
	if (args->fromlen) {
1114
		return (error);
998
		error = copyin(PTRIN(args->fromlen), &msg.msg_namelen,
999
		    sizeof (msg.msg_namelen));
1000
		if (error)
1001
			return (error);
1115
1002
1116
	bsd_args.s = args->s;
1003
		error = linux_to_bsd_sockaddr((struct sockaddr *)PTRIN(args->from),
1117
	bsd_args.buf = PTRIN(args->buf);
1004
		    msg.msg_namelen);
1118
	bsd_args.len = args->len;
1005
		if (error)
1119
	bsd_args.flags = linux_to_bsd_msg_flags(args->flags);
1006
			return (error);
1120
	/* XXX: */
1007
	} else
1121
	bsd_args.from = (struct sockaddr * __restrict)PTRIN(args->from);
1008
		msg.msg_namelen = 0;
1122
	bsd_args.fromlenaddr = PTRIN(args->fromlen);/* XXX */
1009
1123
	
1010
	msg.msg_name = (struct sockaddr * __restrict)PTRIN(args->from);
1124
	linux_to_bsd_sockaddr((struct sockaddr *)bsd_args.from, len);
1011
	msg.msg_iov = &aiov;
1125
	error = sys_recvfrom(td, &bsd_args);
1012
	msg.msg_iovlen = 1;
1126
	bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.from);
1013
	aiov.iov_base = PTRIN(args->buf);
1127
	
1014
	aiov.iov_len = args->len;
1015
	msg.msg_control = 0;
1016
	msg.msg_flags = linux_to_bsd_msg_flags(args->flags);
1017
1018
	error = kern_recvit(td, args->s, &msg, UIO_USERSPACE, NULL);
1128
	if (error)
1019
	if (error)
1129
		return (error);
1020
		return (error);
1021
1130
	if (args->from) {
1022
	if (args->from) {
1131
		error = linux_sa_put((struct osockaddr *)
1023
		error = bsd_to_linux_sockaddr((struct sockaddr *)
1132
		    PTRIN(args->from));
1024
		    PTRIN(args->from));
1133
		if (error)
1025
		if (error)
1134
			return (error);
1026
			return (error);
1027
1028
		error = linux_sa_put((struct osockaddr *)
1029
		    PTRIN(args->from));
1135
	}
1030
	}
1136
	return (0);
1031
	return (error);
1137
}
1032
}
1138
1033
1139
struct linux_sendmsg_args {
1140
	int s;
1141
	l_uintptr_t msg;
1142
	int flags;
1143
};
1144
1145
static int
1034
static int
1146
linux_sendmsg(struct thread *td, struct linux_sendmsg_args *args)
1035
linux_sendmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr,
1036
    l_uint flags)
1147
{
1037
{
1148
	struct cmsghdr *cmsg;
1038
	struct cmsghdr *cmsg;
1149
	struct cmsgcred cmcred;
1039
	struct cmsgcred cmcred;
Lines 1159-1166 Link Here
1159
	void *data;
1049
	void *data;
1160
	int error;
1050
	int error;
1161
1051
1162
	error = copyin(PTRIN(args->msg), &linux_msg, sizeof(linux_msg));
1052
	error = copyin(msghdr, &linux_msg, sizeof(linux_msg));
1163
	if (error)
1053
	if (error != 0)
1164
		return (error);
1054
		return (error);
1165
1055
1166
	/*
1056
	/*
Lines 1174-1180 Link Here
1174
		linux_msg.msg_control = PTROUT(NULL);
1064
		linux_msg.msg_control = PTROUT(NULL);
1175
1065
1176
	error = linux_to_bsd_msghdr(&msg, &linux_msg);
1066
	error = linux_to_bsd_msghdr(&msg, &linux_msg);
1177
	if (error)
1067
	if (error != 0)
1178
		return (error);
1068
		return (error);
1179
1069
1180
#ifdef COMPAT_LINUX32
1070
#ifdef COMPAT_LINUX32
Lines 1183-1189 Link Here
1183
#else
1073
#else
1184
	error = copyiniov(msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE);
1074
	error = copyiniov(msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE);
1185
#endif
1075
#endif
1186
	if (error)
1076
	if (error != 0)
1187
		return (error);
1077
		return (error);
1188
1078
1189
	control = NULL;
1079
	control = NULL;
Lines 1190-1211 Link Here
1190
	cmsg = NULL;
1080
	cmsg = NULL;
1191
1081
1192
	if ((ptr_cmsg = LINUX_CMSG_FIRSTHDR(&linux_msg)) != NULL) {
1082
	if ((ptr_cmsg = LINUX_CMSG_FIRSTHDR(&linux_msg)) != NULL) {
1193
		error = kern_getsockname(td, args->s, &sa, &datalen);
1083
		error = kern_getsockname(td, s, &sa, &datalen);
1194
		if (error)
1084
		if (error != 0)
1195
			goto bad;
1085
			goto bad;
1196
		sa_family = sa->sa_family;
1086
		sa_family = sa->sa_family;
1197
		free(sa, M_SONAME);
1087
		free(sa, M_SONAME);
1198
1088
1199
		error = ENOBUFS;
1089
		error = ENOBUFS;
1200
		cmsg = malloc(CMSG_HDRSZ, M_TEMP, M_WAITOK | M_ZERO);
1090
		cmsg = malloc(CMSG_HDRSZ, M_LINUX, M_WAITOK|M_ZERO);
1201
		control = m_get(M_WAITOK, MT_CONTROL);
1091
		control = m_get(M_WAITOK, MT_CONTROL);
1202
		if (control == NULL)
1203
			goto bad;
1204
1092
1205
		do {
1093
		do {
1206
			error = copyin(ptr_cmsg, &linux_cmsg,
1094
			error = copyin(ptr_cmsg, &linux_cmsg,
1207
			    sizeof(struct l_cmsghdr));
1095
			    sizeof(struct l_cmsghdr));
1208
			if (error)
1096
			if (error != 0)
1209
				goto bad;
1097
				goto bad;
1210
1098
1211
			error = EINVAL;
1099
			error = EINVAL;
Lines 1269-1296 Link Here
1269
1157
1270
	msg.msg_iov = iov;
1158
	msg.msg_iov = iov;
1271
	msg.msg_flags = 0;
1159
	msg.msg_flags = 0;
1272
	error = linux_sendit(td, args->s, &msg, args->flags, control,
1160
	error = linux_sendit(td, s, &msg, flags, control, UIO_USERSPACE);
1273
	    UIO_USERSPACE);
1274
1161
1275
bad:
1162
bad:
1163
	m_freem(control);
1276
	free(iov, M_IOV);
1164
	free(iov, M_IOV);
1277
	if (cmsg)
1165
	if (cmsg)
1278
		free(cmsg, M_TEMP);
1166
		free(cmsg, M_LINUX);
1279
	return (error);
1167
	return (error);
1280
}
1168
}
1281
1169
1282
struct linux_recvmsg_args {
1170
int
1283
	int s;
1171
linux_sendmsg(struct thread *td, struct linux_sendmsg_args *args)
1284
	l_uintptr_t msg;
1172
{
1285
	int flags;
1286
};
1287
1173
1174
	return (linux_sendmsg_common(td, args->s, PTRIN(args->msg),
1175
	    args->flags));
1176
}
1177
1178
int
1179
linux_sendmmsg(struct thread *td, struct linux_sendmmsg_args *args)
1180
{
1181
	struct l_mmsghdr *msg;
1182
	l_uint retval;
1183
	int error, datagrams;
1184
1185
	if (args->vlen > UIO_MAXIOV)
1186
		args->vlen = UIO_MAXIOV;
1187
1188
	msg = PTRIN(args->msg);
1189
	datagrams = 0;
1190
	while (datagrams < args->vlen) {
1191
		error = linux_sendmsg_common(td, args->s, &msg->msg_hdr,
1192
		    args->flags);
1193
		if (error != 0)
1194
			break;
1195
1196
		retval = td->td_retval[0];
1197
		error = copyout(&retval, &msg->msg_len, sizeof(msg->msg_len));
1198
		if (error != 0)
1199
			break;
1200
		++msg;
1201
		++datagrams;
1202
	}
1203
	if (error == 0)
1204
		td->td_retval[0] = datagrams;
1205
	return (error);
1206
}
1207
1288
static int
1208
static int
1289
linux_recvmsg(struct thread *td, struct linux_recvmsg_args *args)
1209
linux_recvmsg_common(struct thread *td, l_int s, struct l_msghdr *msghdr,
1210
    l_uint flags, struct msghdr *msg)
1290
{
1211
{
1291
	struct cmsghdr *cm;
1212
	struct cmsghdr *cm;
1292
	struct cmsgcred *cmcred;
1213
	struct cmsgcred *cmcred;
1293
	struct msghdr msg;
1294
	struct l_cmsghdr *linux_cmsg = NULL;
1214
	struct l_cmsghdr *linux_cmsg = NULL;
1295
	struct l_ucred linux_ucred;
1215
	struct l_ucred linux_ucred;
1296
	socklen_t datalen, outlen;
1216
	socklen_t datalen, outlen;
Lines 1298-1352 Link Here
1298
	struct iovec *iov, *uiov;
1218
	struct iovec *iov, *uiov;
1299
	struct mbuf *control = NULL;
1219
	struct mbuf *control = NULL;
1300
	struct mbuf **controlp;
1220
	struct mbuf **controlp;
1221
	struct timeval *ftmvl;
1222
	l_timeval ltmvl;
1301
	caddr_t outbuf;
1223
	caddr_t outbuf;
1302
	void *data;
1224
	void *data;
1303
	int error, i, fd, fds, *fdp;
1225
	int error, i, fd, fds, *fdp;
1304
1226
1305
	error = copyin(PTRIN(args->msg), &linux_msg, sizeof(linux_msg));
1227
	error = copyin(msghdr, &linux_msg, sizeof(linux_msg));
1306
	if (error)
1228
	if (error != 0)
1307
		return (error);
1229
		return (error);
1308
1230
1309
	error = linux_to_bsd_msghdr(&msg, &linux_msg);
1231
	error = linux_to_bsd_msghdr(msg, &linux_msg);
1310
	if (error)
1232
	if (error != 0)
1311
		return (error);
1233
		return (error);
1312
1234
1313
#ifdef COMPAT_LINUX32
1235
#ifdef COMPAT_LINUX32
1314
	error = linux32_copyiniov(PTRIN(msg.msg_iov), msg.msg_iovlen,
1236
	error = linux32_copyiniov(PTRIN(msg->msg_iov), msg->msg_iovlen,
1315
	    &iov, EMSGSIZE);
1237
	    &iov, EMSGSIZE);
1316
#else
1238
#else
1317
	error = copyiniov(msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE);
1239
	error = copyiniov(msg->msg_iov, msg->msg_iovlen, &iov, EMSGSIZE);
1318
#endif
1240
#endif
1319
	if (error)
1241
	if (error != 0)
1320
		return (error);
1242
		return (error);
1321
1243
1322
	if (msg.msg_name) {
1244
	if (msg->msg_name) {
1323
		error = linux_to_bsd_sockaddr((struct sockaddr *)msg.msg_name,
1245
		error = linux_to_bsd_sockaddr((struct sockaddr *)msg->msg_name,
1324
		    msg.msg_namelen);
1246
		    msg->msg_namelen);
1325
		if (error)
1247
		if (error != 0)
1326
			goto bad;
1248
			goto bad;
1327
	}
1249
	}
1328
1250
1329
	uiov = msg.msg_iov;
1251
	uiov = msg->msg_iov;
1330
	msg.msg_iov = iov;
1252
	msg->msg_iov = iov;
1331
	controlp = (msg.msg_control != NULL) ? &control : NULL;
1253
	controlp = (msg->msg_control != NULL) ? &control : NULL;
1332
	error = kern_recvit(td, args->s, &msg, UIO_USERSPACE, controlp);
1254
	error = kern_recvit(td, s, msg, UIO_USERSPACE, controlp);
1333
	msg.msg_iov = uiov;
1255
	msg->msg_iov = uiov;
1334
	if (error)
1256
	if (error != 0)
1335
		goto bad;
1257
		goto bad;
1336
1258
1337
	error = bsd_to_linux_msghdr(&msg, &linux_msg);
1259
	error = bsd_to_linux_msghdr(msg, &linux_msg);
1338
	if (error)
1260
	if (error != 0)
1339
		goto bad;
1261
		goto bad;
1340
1262
1341
	if (linux_msg.msg_name) {
1263
	if (linux_msg.msg_name) {
1342
		error = bsd_to_linux_sockaddr((struct sockaddr *)
1264
		error = bsd_to_linux_sockaddr((struct sockaddr *)
1343
		    PTRIN(linux_msg.msg_name));
1265
		    PTRIN(linux_msg.msg_name));
1344
		if (error)
1266
		if (error != 0)
1345
			goto bad;
1267
			goto bad;
1346
	}
1268
	}
1347
	if (linux_msg.msg_name && linux_msg.msg_namelen > 2) {
1269
	if (linux_msg.msg_name && linux_msg.msg_namelen > 2) {
1348
		error = linux_sa_put(PTRIN(linux_msg.msg_name));
1270
		error = linux_sa_put(PTRIN(linux_msg.msg_name));
1349
		if (error)
1271
		if (error != 0)
1350
			goto bad;
1272
			goto bad;
1351
	}
1273
	}
1352
1274
Lines 1354-1365 Link Here
1354
	outlen = 0;
1276
	outlen = 0;
1355
1277
1356
	if (control) {
1278
	if (control) {
1357
		linux_cmsg = malloc(L_CMSG_HDRSZ, M_TEMP, M_WAITOK | M_ZERO);
1279
		linux_cmsg = malloc(L_CMSG_HDRSZ, M_LINUX, M_WAITOK | M_ZERO);
1358
1280
1359
		msg.msg_control = mtod(control, struct cmsghdr *);
1281
		msg->msg_control = mtod(control, struct cmsghdr *);
1360
		msg.msg_controllen = control->m_len;
1282
		msg->msg_controllen = control->m_len;
1361
1283
1362
		cm = CMSG_FIRSTHDR(&msg);
1284
		cm = CMSG_FIRSTHDR(msg);
1363
1285
1364
		while (cm != NULL) {
1286
		while (cm != NULL) {
1365
			linux_cmsg->cmsg_type =
1287
			linux_cmsg->cmsg_type =
Lines 1379-1385 Link Here
1379
			switch (cm->cmsg_type)
1301
			switch (cm->cmsg_type)
1380
			{
1302
			{
1381
			case SCM_RIGHTS:
1303
			case SCM_RIGHTS:
1382
				if (args->flags & LINUX_MSG_CMSG_CLOEXEC) {
1304
				if (flags & LINUX_MSG_CMSG_CLOEXEC) {
1383
					fds = datalen / sizeof(int);
1305
					fds = datalen / sizeof(int);
1384
					fdp = data;
1306
					fdp = data;
1385
					for (i = 0; i < fds; i++) {
1307
					for (i = 0; i < fds; i++) {
Lines 1408-1413 Link Here
1408
				data = &linux_ucred;
1330
				data = &linux_ucred;
1409
				datalen = sizeof(linux_ucred);
1331
				datalen = sizeof(linux_ucred);
1410
				break;
1332
				break;
1333
1334
			case SCM_TIMESTAMP:
1335
				if (datalen != sizeof(struct timeval)) {
1336
					error = EMSGSIZE;
1337
					goto bad;
1338
				}
1339
				ftmvl = (struct timeval *)data;
1340
				ltmvl.tv_sec = ftmvl->tv_sec;
1341
				ltmvl.tv_usec = ftmvl->tv_usec;
1342
				data = &ltmvl;
1343
				datalen = sizeof(ltmvl);
1344
				break;
1411
			}
1345
			}
1412
1346
1413
			if (outlen + LINUX_CMSG_LEN(datalen) >
1347
			if (outlen + LINUX_CMSG_LEN(datalen) >
Lines 1436-1463 Link Here
1436
			outbuf += LINUX_CMSG_ALIGN(datalen);
1370
			outbuf += LINUX_CMSG_ALIGN(datalen);
1437
			outlen += LINUX_CMSG_LEN(datalen);
1371
			outlen += LINUX_CMSG_LEN(datalen);
1438
1372
1439
			cm = CMSG_NXTHDR(&msg, cm);
1373
			cm = CMSG_NXTHDR(msg, cm);
1440
		}
1374
		}
1441
	}
1375
	}
1442
1376
1443
out:
1377
out:
1444
	linux_msg.msg_controllen = outlen;
1378
	linux_msg.msg_controllen = outlen;
1445
	error = copyout(&linux_msg, PTRIN(args->msg), sizeof(linux_msg));
1379
	error = copyout(&linux_msg, msghdr, sizeof(linux_msg));
1446
1380
1447
bad:
1381
bad:
1448
	free(iov, M_IOV);
1382
	free(iov, M_IOV);
1449
	m_freem(control);
1383
	m_freem(control);
1450
	free(linux_cmsg, M_TEMP);
1384
	free(linux_cmsg, M_LINUX);
1451
1385
1452
	return (error);
1386
	return (error);
1453
}
1387
}
1454
1388
1455
struct linux_shutdown_args {
1389
int
1456
	int s;
1390
linux_recvmsg(struct thread *td, struct linux_recvmsg_args *args)
1457
	int how;
1391
{
1458
};
1392
	struct msghdr bsd_msg;
1459
1393
1460
static int
1394
	return (linux_recvmsg_common(td, args->s, PTRIN(args->msg),
1395
	    args->flags, &bsd_msg));
1396
}
1397
1398
int
1399
linux_recvmmsg(struct thread *td, struct linux_recvmmsg_args *args)
1400
{
1401
	struct l_mmsghdr *msg;
1402
	struct msghdr bsd_msg;
1403
	struct l_timespec lts;
1404
	struct timespec ts, tts;
1405
	l_uint retval;
1406
	int error, datagrams;
1407
1408
	if (args->timeout) {
1409
		error = copyin(args->timeout, &lts, sizeof(struct l_timespec));
1410
		if (error != 0)
1411
			return (error);
1412
		error = linux_to_native_timespec(&ts, &lts);
1413
		if (error != 0)
1414
			return (error);
1415
		getnanotime(&tts);
1416
		timespecadd(&tts, &ts);
1417
	}
1418
1419
	msg = PTRIN(args->msg);
1420
	datagrams = 0;
1421
	while (datagrams < args->vlen) {
1422
		error = linux_recvmsg_common(td, args->s, &msg->msg_hdr,
1423
		    args->flags & ~LINUX_MSG_WAITFORONE, &bsd_msg);
1424
		if (error != 0)
1425
			break;
1426
1427
		retval = td->td_retval[0];
1428
		error = copyout(&retval, &msg->msg_len, sizeof(msg->msg_len));
1429
		if (error != 0)
1430
			break;
1431
		++msg;
1432
		++datagrams;
1433
1434
		/*
1435
		 * MSG_WAITFORONE turns on MSG_DONTWAIT after one packet.
1436
		 */
1437
		if (args->flags & LINUX_MSG_WAITFORONE)
1438
			args->flags |= LINUX_MSG_DONTWAIT;
1439
1440
		/*
1441
		 * See BUGS section of recvmmsg(2).
1442
		 */
1443
		if (args->timeout) {
1444
			getnanotime(&ts);
1445
			timespecsub(&ts, &tts);
1446
			if (!timespecisset(&ts) || ts.tv_sec > 0)
1447
				break;
1448
		}
1449
		/* Out of band data, return right away. */
1450
		if (bsd_msg.msg_flags & MSG_OOB)
1451
			break;
1452
	}
1453
	if (error == 0)
1454
		td->td_retval[0] = datagrams;
1455
	return (error);
1456
}
1457
1458
int
1461
linux_shutdown(struct thread *td, struct linux_shutdown_args *args)
1459
linux_shutdown(struct thread *td, struct linux_shutdown_args *args)
1462
{
1460
{
1463
	struct shutdown_args /* {
1461
	struct shutdown_args /* {
Lines 1470-1484 Link Here
1470
	return (sys_shutdown(td, &bsd_args));
1468
	return (sys_shutdown(td, &bsd_args));
1471
}
1469
}
1472
1470
1473
struct linux_setsockopt_args {
1471
int
1474
	int s;
1475
	int level;
1476
	int optname;
1477
	l_uintptr_t optval;
1478
	int optlen;
1479
};
1480
1481
static int
1482
linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args)
1472
linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args)
1483
{
1473
{
1484
	struct setsockopt_args /* {
1474
	struct setsockopt_args /* {
Lines 1543-1557 Link Here
1543
	return (error);
1533
	return (error);
1544
}
1534
}
1545
1535
1546
struct linux_getsockopt_args {
1536
int
1547
	int s;
1548
	int level;
1549
	int optname;
1550
	l_uintptr_t optval;
1551
	l_uintptr_t optlen;
1552
};
1553
1554
static int
1555
linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args)
1537
linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args)
1556
{
1538
{
1557
	struct getsockopt_args /* {
1539
	struct getsockopt_args /* {
Lines 1635-1640 Link Here
1635
	return (error);
1617
	return (error);
1636
}
1618
}
1637
1619
1620
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
1621
1638
/* Argument list sizes for linux_socketcall */
1622
/* Argument list sizes for linux_socketcall */
1639
1623
1640
#define LINUX_AL(x) ((x) * sizeof(l_ulong))
1624
#define LINUX_AL(x) ((x) * sizeof(l_ulong))
Lines 1649-1655 Link Here
1649
	LINUX_AL(6) /* recvfrom */,	LINUX_AL(2) /* shutdown */,
1633
	LINUX_AL(6) /* recvfrom */,	LINUX_AL(2) /* shutdown */,
1650
	LINUX_AL(5) /* setsockopt */,	LINUX_AL(5) /* getsockopt */,
1634
	LINUX_AL(5) /* setsockopt */,	LINUX_AL(5) /* getsockopt */,
1651
	LINUX_AL(3) /* sendmsg */,	LINUX_AL(3) /* recvmsg */,
1635
	LINUX_AL(3) /* sendmsg */,	LINUX_AL(3) /* recvmsg */,
1652
	LINUX_AL(4) /* accept4 */
1636
	LINUX_AL(4) /* accept4 */,	LINUX_AL(5) /* recvmmsg */,
1637
	LINUX_AL(4) /* sendmmsg */
1653
};
1638
};
1654
1639
1655
#define	LINUX_AL_SIZE	sizeof(lxs_args) / sizeof(lxs_args[0]) - 1
1640
#define	LINUX_AL_SIZE	sizeof(lxs_args) / sizeof(lxs_args[0]) - 1
Lines 1705-1712 Link Here
1705
		return (linux_recvmsg(td, arg));
1690
		return (linux_recvmsg(td, arg));
1706
	case LINUX_ACCEPT4:
1691
	case LINUX_ACCEPT4:
1707
		return (linux_accept4(td, arg));
1692
		return (linux_accept4(td, arg));
1693
	case LINUX_RECVMMSG:
1694
		return (linux_recvmmsg(td, arg));
1695
	case LINUX_SENDMMSG:
1696
		return (linux_sendmmsg(td, arg));
1708
	}
1697
	}
1709
1698
1710
	uprintf("LINUX: 'socket' typ=%d not implemented\n", args->what);
1699
	uprintf("LINUX: 'socket' typ=%d not implemented\n", args->what);
1711
	return (ENOSYS);
1700
	return (ENOSYS);
1712
}
1701
}
1702
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
(-)sys/compat/linux/linux_socket.h (-1 / +154 lines)
Lines 48-60 Link Here
48
#define LINUX_MSG_RST		0x1000
48
#define LINUX_MSG_RST		0x1000
49
#define LINUX_MSG_ERRQUEUE	0x2000
49
#define LINUX_MSG_ERRQUEUE	0x2000
50
#define LINUX_MSG_NOSIGNAL	0x4000
50
#define LINUX_MSG_NOSIGNAL	0x4000
51
#define LINUX_MSG_WAITFORONE	0x10000
51
#define LINUX_MSG_CMSG_CLOEXEC	0x40000000
52
#define LINUX_MSG_CMSG_CLOEXEC	0x40000000
52
53
53
/* Socket-level control message types */
54
/* Socket-level control message types */
54
55
55
#define LINUX_SCM_RIGHTS	0x01
56
#define LINUX_SCM_RIGHTS	0x01
56
#define LINUX_SCM_CREDENTIALS   0x02
57
#define LINUX_SCM_CREDENTIALS	0x02
58
#define LINUX_SCM_TIMESTAMP	0x1D
57
59
60
struct l_msghdr {
61
	l_uintptr_t	msg_name;
62
	l_int		msg_namelen;
63
	l_uintptr_t	msg_iov;
64
	l_size_t	msg_iovlen;
65
	l_uintptr_t	msg_control;
66
	l_size_t	msg_controllen;
67
	l_uint		msg_flags;
68
};
69
70
struct l_mmsghdr {
71
	struct l_msghdr	msg_hdr;
72
	l_uint		msg_len;
73
74
};
75
76
struct l_cmsghdr {
77
	l_size_t	cmsg_len;
78
	l_int		cmsg_level;
79
	l_int		cmsg_type;
80
};
81
58
/* Ancilliary data object information macros */
82
/* Ancilliary data object information macros */
59
83
60
#define LINUX_CMSG_ALIGN(len)	roundup2(len, sizeof(l_ulong))
84
#define LINUX_CMSG_ALIGN(len)	roundup2(len, sizeof(l_ulong))
Lines 116-121 Link Here
116
	uint32_t	gid;
140
	uint32_t	gid;
117
};
141
};
118
142
143
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
144
145
struct linux_sendto_args {
146
	int s;
147
	l_uintptr_t msg;
148
	int len;
149
	int flags;
150
	l_uintptr_t to;
151
	int tolen;
152
};
153
154
struct linux_socket_args {
155
	int domain;
156
	int type;
157
	int protocol;
158
};
159
160
struct linux_bind_args {
161
	int s;
162
	l_uintptr_t name;
163
	int namelen;
164
};
165
166
struct linux_connect_args {
167
	int s;
168
	l_uintptr_t name;
169
	int namelen;
170
};
171
172
struct linux_listen_args {
173
	int s;
174
	int backlog;
175
};
176
177
struct linux_accept_args {
178
	int s;
179
	l_uintptr_t addr;
180
	l_uintptr_t namelen;
181
};
182
183
struct linux_accept4_args {
184
	int s;
185
	l_uintptr_t addr;
186
	l_uintptr_t namelen;
187
	int flags;
188
};
189
190
struct linux_getsockname_args {
191
	int s;
192
	l_uintptr_t addr;
193
	l_uintptr_t namelen;
194
};
195
196
struct linux_getpeername_args {
197
	int s;
198
	l_uintptr_t addr;
199
	l_uintptr_t namelen;
200
};
201
202
struct linux_socketpair_args {
203
	int domain;
204
	int type;
205
	int protocol;
206
	l_uintptr_t rsv;
207
};
208
209
struct linux_recvfrom_args {
210
	int s;
211
	l_uintptr_t buf;
212
	int len;
213
	int flags;
214
	l_uintptr_t from;
215
	l_uintptr_t fromlen;
216
};
217
218
struct linux_sendmsg_args {
219
	int s;
220
	l_uintptr_t msg;
221
	int flags;
222
};
223
224
struct linux_recvmsg_args {
225
	int s;
226
	l_uintptr_t msg;
227
	int flags;
228
};
229
230
struct linux_shutdown_args {
231
	int s;
232
	int how;
233
};
234
235
struct linux_setsockopt_args {
236
	int s;
237
	int level;
238
	int optname;
239
	l_uintptr_t optval;
240
	int optlen;
241
};
242
243
struct linux_getsockopt_args {
244
	int s;
245
	int level;
246
	int optname;
247
	l_uintptr_t optval;
248
	l_uintptr_t optlen;
249
};
250
251
int linux_socket(struct thread *td, struct linux_socket_args *args);
252
int linux_bind(struct thread *td, struct linux_bind_args *args);
253
int linux_connect(struct thread *, struct linux_connect_args *);
254
int linux_listen(struct thread *td, struct linux_listen_args *args);
255
int linux_accept(struct thread *td, struct linux_accept_args *args);
256
int linux_accept4(struct thread *td, struct linux_accept4_args *args);
257
int linux_getsockname(struct thread *td, struct linux_getsockname_args *args);
258
int linux_getpeername(struct thread *td, struct linux_getpeername_args *args);
259
int linux_socketpair(struct thread *td, struct linux_socketpair_args *args);
260
int linux_sendto(struct thread *td, struct linux_sendto_args *args);
261
int linux_recvfrom(struct thread *td, struct linux_recvfrom_args *args);
262
int linux_sendmsg(struct thread *td, struct linux_sendmsg_args *args);
263
int linux_recvmsg(struct thread *td, struct linux_recvmsg_args *args);
264
int linux_shutdown(struct thread *td, struct linux_shutdown_args *args);
265
int linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args);
266
int linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args);
267
268
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
269
119
/* Operations for socketcall */
270
/* Operations for socketcall */
120
271
121
#define	LINUX_SOCKET 		1
272
#define	LINUX_SOCKET 		1
Lines 136-141 Link Here
136
#define	LINUX_SENDMSG		16
287
#define	LINUX_SENDMSG		16
137
#define	LINUX_RECVMSG		17
288
#define	LINUX_RECVMSG		17
138
#define	LINUX_ACCEPT4		18
289
#define	LINUX_ACCEPT4		18
290
#define	LINUX_RECVMMSG		19
291
#define	LINUX_SENDMMSG		20
139
292
140
/* Socket options */
293
/* Socket options */
141
#define	LINUX_IP_TOS		1
294
#define	LINUX_IP_TOS		1
(-)sys/compat/linux/linux_stats.c (-19 / +88 lines)
Lines 32-37 Link Here
32
#include "opt_compat.h"
32
#include "opt_compat.h"
33
33
34
#include <sys/param.h>
34
#include <sys/param.h>
35
#include <sys/capsicum.h>
35
#include <sys/dirent.h>
36
#include <sys/dirent.h>
36
#include <sys/file.h>
37
#include <sys/file.h>
37
#include <sys/filedesc.h>
38
#include <sys/filedesc.h>
Lines 58-64 Link Here
58
#include <compat/linux/linux_util.h>
59
#include <compat/linux/linux_util.h>
59
#include <compat/linux/linux_file.h>
60
#include <compat/linux/linux_file.h>
60
61
61
#define	LINUX_SHMFS_MAGIC 0x01021994
62
62
63
static void
63
static void
64
translate_vnhook_major_minor(struct vnode *vp, struct stat *sb)
64
translate_vnhook_major_minor(struct vnode *vp, struct stat *sb)
Lines 251-256 Link Here
251
	return (error);
251
	return (error);
252
}
252
}
253
253
254
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
254
static int
255
static int
255
stat_copyout(struct stat *buf, void *ubuf)
256
stat_copyout(struct stat *buf, void *ubuf)
256
{
257
{
Lines 325-343 Link Here
325
	LFREEPATH(path);
326
	LFREEPATH(path);
326
	return(stat_copyout(&buf, args->up));
327
	return(stat_copyout(&buf, args->up));
327
}
328
}
329
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
328
330
329
/* XXX - All fields of type l_int are defined as l_long on i386 */
330
struct l_statfs {
331
struct l_statfs {
331
	l_int		f_type;
332
	l_long		f_type;
332
	l_int		f_bsize;
333
	l_long		f_bsize;
333
	l_int		f_blocks;
334
	l_long		f_blocks;
334
	l_int		f_bfree;
335
	l_long		f_bfree;
335
	l_int		f_bavail;
336
	l_long		f_bavail;
336
	l_int		f_files;
337
	l_long		f_files;
337
	l_int		f_ffree;
338
	l_long		f_ffree;
338
	l_fsid_t	f_fsid;
339
	l_fsid_t	f_fsid;
339
	l_int		f_namelen;
340
	l_long		f_namelen;
340
	l_int		f_spare[6];
341
	l_long		f_spare[6];
341
};
342
};
342
343
343
#define	LINUX_CODA_SUPER_MAGIC	0x73757245L
344
#define	LINUX_CODA_SUPER_MAGIC	0x73757245L
Lines 351-356 Link Here
351
#define	LINUX_PROC_SUPER_MAGIC	0x9fa0L
352
#define	LINUX_PROC_SUPER_MAGIC	0x9fa0L
352
#define	LINUX_UFS_SUPER_MAGIC	0x00011954L	/* XXX - UFS_MAGIC in Linux */
353
#define	LINUX_UFS_SUPER_MAGIC	0x00011954L	/* XXX - UFS_MAGIC in Linux */
353
#define LINUX_DEVFS_SUPER_MAGIC	0x1373L
354
#define LINUX_DEVFS_SUPER_MAGIC	0x1373L
355
#define	LINUX_SHMFS_MAGIC	0x01021994
354
356
355
static long
357
static long
356
bsd_to_linux_ftype(const char *fstypename)
358
bsd_to_linux_ftype(const char *fstypename)
Lines 368-373 Link Here
368
		{"hpfs",    LINUX_HPFS_SUPER_MAGIC},
370
		{"hpfs",    LINUX_HPFS_SUPER_MAGIC},
369
		{"coda",    LINUX_CODA_SUPER_MAGIC},
371
		{"coda",    LINUX_CODA_SUPER_MAGIC},
370
		{"devfs",   LINUX_DEVFS_SUPER_MAGIC},
372
		{"devfs",   LINUX_DEVFS_SUPER_MAGIC},
373
		{"tmpfs",   LINUX_SHMFS_MAGIC},
371
		{NULL,      0L}};
374
		{NULL,      0L}};
372
375
373
	for (i = 0; b2l_tbl[i].bsd_name != NULL; i++)
376
	for (i = 0; b2l_tbl[i].bsd_name != NULL; i++)
Lines 399-405 Link Here
399
	struct l_statfs linux_statfs;
402
	struct l_statfs linux_statfs;
400
	struct statfs bsd_statfs;
403
	struct statfs bsd_statfs;
401
	char *path;
404
	char *path;
402
	int error, dev_shm;
405
	int error;
403
406
404
	LCONVPATHEXIST(td, args->path, &path);
407
	LCONVPATHEXIST(td, args->path, &path);
405
408
Lines 407-426 Link Here
407
	if (ldebug(statfs))
410
	if (ldebug(statfs))
408
		printf(ARGS(statfs, "%s, *"), path);
411
		printf(ARGS(statfs, "%s, *"), path);
409
#endif
412
#endif
410
	dev_shm = 0;
411
	error = kern_statfs(td, path, UIO_SYSSPACE, &bsd_statfs);
413
	error = kern_statfs(td, path, UIO_SYSSPACE, &bsd_statfs);
412
	if (strncmp(path, "/dev/shm", sizeof("/dev/shm") - 1) == 0)
413
		dev_shm = (path[8] == '\0'
414
		    || (path[8] == '/' && path[9] == '\0'));
415
	LFREEPATH(path);
414
	LFREEPATH(path);
416
	if (error)
415
	if (error)
417
		return (error);
416
		return (error);
418
	bsd_to_linux_statfs(&bsd_statfs, &linux_statfs);
417
	bsd_to_linux_statfs(&bsd_statfs, &linux_statfs);
419
	if (dev_shm)
420
		linux_statfs.f_type = LINUX_SHMFS_MAGIC;
421
	return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
418
	return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
422
}
419
}
423
420
421
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
424
static void
422
static void
425
bsd_to_linux_statfs64(struct statfs *bsd_statfs, struct l_statfs64 *linux_statfs)
423
bsd_to_linux_statfs64(struct statfs *bsd_statfs, struct l_statfs64 *linux_statfs)
426
{
424
{
Lines 461-466 Link Here
461
	bsd_to_linux_statfs64(&bsd_statfs, &linux_statfs);
459
	bsd_to_linux_statfs64(&bsd_statfs, &linux_statfs);
462
	return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
460
	return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
463
}
461
}
462
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
464
463
465
int
464
int
466
linux_fstatfs(struct thread *td, struct linux_fstatfs_args *args)
465
linux_fstatfs(struct thread *td, struct linux_fstatfs_args *args)
Lines 493-499 Link Here
493
{
492
{
494
#ifdef DEBUG
493
#ifdef DEBUG
495
	if (ldebug(ustat))
494
	if (ldebug(ustat))
496
		printf(ARGS(ustat, "%d, *"), args->dev);
495
		printf(ARGS(ustat, "%ju, *"), (uintmax_t)args->dev);
497
#endif
496
#endif
498
497
499
	return (EOPNOTSUPP);
498
	return (EOPNOTSUPP);
Lines 624-627 Link Here
624
	return (error);
623
	return (error);
625
}
624
}
626
625
626
#else
627
628
int
629
linux_newfstatat(struct thread *td, struct linux_newfstatat_args *args)
630
{
631
	char *path;
632
	int error, dfd, flag;
633
	struct stat buf;
634
635
	if (args->flag & ~LINUX_AT_SYMLINK_NOFOLLOW)
636
		return (EINVAL);
637
	flag = (args->flag & LINUX_AT_SYMLINK_NOFOLLOW) ?
638
	    AT_SYMLINK_NOFOLLOW : 0;
639
640
	dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
641
	LCONVPATHEXIST_AT(td, args->pathname, &path, dfd);
642
643
#ifdef DEBUG
644
	if (ldebug(newfstatat))
645
		printf(ARGS(newfstatat, "%i, %s, %i"), args->dfd, path, args->flag);
646
#endif
647
648
	error = linux_kern_statat(td, flag, dfd, path, UIO_SYSSPACE, &buf);
649
	if (!error)
650
		error = newstat_copyout(&buf, args->statbuf);
651
	LFREEPATH(path);
652
653
	return (error);
654
}
655
627
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
656
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
657
658
int
659
linux_syncfs(struct thread *td, struct linux_syncfs_args *args)
660
{
661
	cap_rights_t rights;
662
	struct mount *mp;
663
	struct vnode *vp;
664
	int error, save;
665
666
	error = fgetvp(td, args->fd, cap_rights_init(&rights, CAP_FSYNC), &vp);
667
	if (error != 0)
668
		/*
669
		 * Linux syncfs() returns only EBADF, however fgetvp()
670
		 * can return EINVAL in case of file descriptor does
671
		 * not represent a vnode. XXX.
672
		 */
673
		return (error);
674
675
	mp = vp->v_mount;
676
	mtx_lock(&mountlist_mtx);
677
	error = vfs_busy(mp, MBF_MNTLSTLOCK);
678
	if (error != 0) {
679
		/* See comment above. */
680
		mtx_unlock(&mountlist_mtx);
681
		goto out;
682
	}
683
	if ((mp->mnt_flag & MNT_RDONLY) == 0 &&
684
	    vn_start_write(NULL, &mp, V_NOWAIT) == 0) {
685
		save = curthread_pflags_set(TDP_SYNCIO);
686
		vfs_msync(mp, MNT_NOWAIT);
687
		VFS_SYNC(mp, MNT_NOWAIT);
688
		curthread_pflags_restore(save);
689
		vn_finished_write(mp);
690
	}
691
	vfs_unbusy(mp);
692
693
 out:
694
	vrele(vp);
695
	return (error);
696
}
(-)sys/compat/linux/linux_sysctl.c (-4 / +4 lines)
Lines 141-152 Link Here
141
		return (ENOTDIR);
141
		return (ENOTDIR);
142
	}
142
	}
143
143
144
	mib = malloc(la.nlen * sizeof(l_int), M_TEMP, M_WAITOK);
144
	mib = malloc(la.nlen * sizeof(l_int), M_LINUX, M_WAITOK);
145
	error = copyin(PTRIN(la.name), mib, la.nlen * sizeof(l_int));
145
	error = copyin(PTRIN(la.name), mib, la.nlen * sizeof(l_int));
146
	if (error) {
146
	if (error) {
147
		LIN_SDT_PROBE1(sysctl, linux_sysctl, copyin_error, error);
147
		LIN_SDT_PROBE1(sysctl, linux_sysctl, copyin_error, error);
148
		LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error);
148
		LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error);
149
		free(mib, M_TEMP);
149
		free(mib, M_LINUX);
150
		return (error);
150
		return (error);
151
	}
151
	}
152
152
Lines 158-164 Link Here
158
		switch (mib[1]) {
158
		switch (mib[1]) {
159
		case LINUX_KERN_VERSION:
159
		case LINUX_KERN_VERSION:
160
			error = handle_string(&la, version);
160
			error = handle_string(&la, version);
161
			free(mib, M_TEMP);
161
			free(mib, M_LINUX);
162
			LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error);
162
			LIN_SDT_PROBE1(sysctl, linux_sysctl, return, error);
163
			return (error);
163
			return (error);
164
		default:
164
		default:
Lines 187-193 Link Here
187
		sbuf_delete(sb);
187
		sbuf_delete(sb);
188
	}
188
	}
189
189
190
	free(mib, M_TEMP);
190
	free(mib, M_LINUX);
191
191
192
	LIN_SDT_PROBE1(sysctl, linux_sysctl, return, ENOTDIR);
192
	LIN_SDT_PROBE1(sysctl, linux_sysctl, return, ENOTDIR);
193
	return (ENOTDIR);
193
	return (ENOTDIR);
(-)sys/compat/linux/linux_time.c (-60 / +212 lines)
Lines 40-47 Link Here
40
40
41
#include <sys/param.h>
41
#include <sys/param.h>
42
#include <sys/kernel.h>
42
#include <sys/kernel.h>
43
#include <sys/lock.h>
43
#include <sys/ucred.h>
44
#include <sys/ucred.h>
44
#include <sys/mount.h>
45
#include <sys/mount.h>
46
#include <sys/mutex.h>
47
#include <sys/resourcevar.h>
45
#include <sys/sdt.h>
48
#include <sys/sdt.h>
46
#include <sys/signal.h>
49
#include <sys/signal.h>
47
#include <sys/stdint.h>
50
#include <sys/stdint.h>
Lines 60-66 Link Here
60
#endif
63
#endif
61
64
62
#include <compat/linux/linux_dtrace.h>
65
#include <compat/linux/linux_dtrace.h>
63
#include <compat/linux/linux_misc.h>
66
#include <compat/linux/linux_timer.h>
64
67
65
/* DTrace init */
68
/* DTrace init */
66
LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
69
LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
Lines 103-109 Link Here
103
LIN_SDT_PROBE_DEFINE2(time, linux_nanosleep, entry, "const struct l_timespec *",
106
LIN_SDT_PROBE_DEFINE2(time, linux_nanosleep, entry, "const struct l_timespec *",
104
    "struct l_timespec *");
107
    "struct l_timespec *");
105
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, conversion_error, "int");
108
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, conversion_error, "int");
106
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, nanosleep_error, "int");
107
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyout_error, "int");
109
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyout_error, "int");
108
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyin_error, "int");
110
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyin_error, "int");
109
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, return, "int");
111
LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, return, "int");
Lines 110-116 Link Here
110
LIN_SDT_PROBE_DEFINE4(time, linux_clock_nanosleep, entry, "clockid_t", "int",
112
LIN_SDT_PROBE_DEFINE4(time, linux_clock_nanosleep, entry, "clockid_t", "int",
111
    "struct l_timespec *", "struct l_timespec *");
113
    "struct l_timespec *", "struct l_timespec *");
112
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, conversion_error, "int");
114
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, conversion_error, "int");
113
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, nanosleep_error, "int");
114
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyout_error, "int");
115
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyout_error, "int");
115
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyin_error, "int");
116
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyin_error, "int");
116
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_flags, "int");
117
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_flags, "int");
Lines 117-129 Link Here
117
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_clockid, "int");
118
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_clockid, "int");
118
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, return, "int");
119
LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, return, "int");
119
120
120
static void native_to_linux_timespec(struct l_timespec *,
121
				     struct timespec *);
122
static int linux_to_native_timespec(struct timespec *,
123
				     struct l_timespec *);
124
static int linux_to_native_clockid(clockid_t *, clockid_t);
125
121
126
static void
122
void
127
native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp)
123
native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp)
128
{
124
{
129
125
Lines 135-141 Link Here
135
	LIN_SDT_PROBE0(time, native_to_linux_timespec, return);
131
	LIN_SDT_PROBE0(time, native_to_linux_timespec, return);
136
}
132
}
137
133
138
static int
134
int
139
linux_to_native_timespec(struct timespec *ntp, struct l_timespec *ltp)
135
linux_to_native_timespec(struct timespec *ntp, struct l_timespec *ltp)
140
{
136
{
141
137
Lines 152-163 Link Here
152
	return (0);
148
	return (0);
153
}
149
}
154
150
155
static int
151
int
156
linux_to_native_clockid(clockid_t *n, clockid_t l)
152
linux_to_native_clockid(clockid_t *n, clockid_t l)
157
{
153
{
158
154
159
	LIN_SDT_PROBE2(time, linux_to_native_clockid, entry, n, l);
155
	LIN_SDT_PROBE2(time, linux_to_native_clockid, entry, n, l);
160
156
157
	if (l < 0) {
158
		/* cpu-clock */
159
		if ((l & LINUX_CLOCKFD_MASK) == LINUX_CLOCKFD)
160
			return (EINVAL);
161
		if (LINUX_CPUCLOCK_WHICH(l) >= LINUX_CPUCLOCK_MAX)
162
			return (EINVAL);
163
164
		if (LINUX_CPUCLOCK_PERTHREAD(l))
165
			*n = CLOCK_THREAD_CPUTIME_ID;
166
		else
167
			*n = CLOCK_PROCESS_CPUTIME_ID;
168
		return (0);
169
	}
170
161
	switch (l) {
171
	switch (l) {
162
	case LINUX_CLOCK_REALTIME:
172
	case LINUX_CLOCK_REALTIME:
163
		*n = CLOCK_REALTIME;
173
		*n = CLOCK_REALTIME;
Lines 165-174 Link Here
165
	case LINUX_CLOCK_MONOTONIC:
175
	case LINUX_CLOCK_MONOTONIC:
166
		*n = CLOCK_MONOTONIC;
176
		*n = CLOCK_MONOTONIC;
167
		break;
177
		break;
168
	case LINUX_CLOCK_PROCESS_CPUTIME_ID:
178
	case LINUX_CLOCK_REALTIME_COARSE:
169
	case LINUX_CLOCK_THREAD_CPUTIME_ID:
179
		*n = CLOCK_REALTIME_FAST;
170
	case LINUX_CLOCK_REALTIME_HR:
180
		break;
171
	case LINUX_CLOCK_MONOTONIC_HR:
181
	case LINUX_CLOCK_MONOTONIC_COARSE:
182
		*n = CLOCK_MONOTONIC_FAST;
183
		break;
184
	case LINUX_CLOCK_MONOTONIC_RAW:
185
	case LINUX_CLOCK_BOOTTIME:
186
	case LINUX_CLOCK_REALTIME_ALARM:
187
	case LINUX_CLOCK_BOOTTIME_ALARM:
188
	case LINUX_CLOCK_SGI_CYCLE:
189
	case LINUX_CLOCK_TAI:
172
		LIN_SDT_PROBE1(time, linux_to_native_clockid,
190
		LIN_SDT_PROBE1(time, linux_to_native_clockid,
173
		    unsupported_clockid, l);
191
		    unsupported_clockid, l);
174
		LIN_SDT_PROBE1(time, linux_to_native_clockid, return, EINVAL);
192
		LIN_SDT_PROBE1(time, linux_to_native_clockid, return, EINVAL);
Lines 190-198 Link Here
190
linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args)
208
linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args)
191
{
209
{
192
	struct l_timespec lts;
210
	struct l_timespec lts;
193
	int error;
211
	struct timespec tp;
212
	struct rusage ru;
213
	struct thread *targettd;
214
	struct proc *p;
215
	int error, clockwhich;
194
	clockid_t nwhich = 0;	/* XXX: GCC */
216
	clockid_t nwhich = 0;	/* XXX: GCC */
195
	struct timespec tp;
217
	pid_t pid;
218
	lwpid_t tid;
196
219
197
	LIN_SDT_PROBE2(time, linux_clock_gettime, entry, args->which, args->tp);
220
	LIN_SDT_PROBE2(time, linux_clock_gettime, entry, args->which, args->tp);
198
221
Lines 203-209 Link Here
203
		LIN_SDT_PROBE1(time, linux_clock_gettime, return, error);
226
		LIN_SDT_PROBE1(time, linux_clock_gettime, return, error);
204
		return (error);
227
		return (error);
205
	}
228
	}
206
	error = kern_clock_gettime(td, nwhich, &tp);
229
230
	switch (nwhich) {
231
	case CLOCK_PROCESS_CPUTIME_ID:
232
		clockwhich = LINUX_CPUCLOCK_WHICH(args->which);
233
		pid = LINUX_CPUCLOCK_ID(args->which);
234
		if (pid == 0) {
235
			targettd = td;
236
			p = td->td_proc;
237
			PROC_LOCK(p);
238
		} else {
239
			error = pget(pid, PGET_CANSEE, &p);
240
			if (error != 0)
241
				return (EINVAL);
242
		}
243
		switch (clockwhich) {
244
		case LINUX_CPUCLOCK_PROF:
245
			PROC_STATLOCK(p);
246
			calcru(p, &ru.ru_utime, &ru.ru_stime);
247
			PROC_STATUNLOCK(p);
248
			PROC_UNLOCK(p);
249
			timevaladd(&ru.ru_utime, &ru.ru_stime);
250
			TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp);
251
			break;
252
		case LINUX_CPUCLOCK_VIRT:
253
			PROC_STATLOCK(p);
254
			calcru(p, &ru.ru_utime, &ru.ru_stime);
255
			PROC_STATUNLOCK(p);
256
			PROC_UNLOCK(p);
257
			TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp);
258
			break;
259
		case LINUX_CPUCLOCK_SCHED:
260
			PROC_UNLOCK(p);
261
			error = kern_clock_getcpuclockid2(td, pid,
262
			    CPUCLOCK_WHICH_PID, &nwhich);
263
			if (error != 0)
264
				return (EINVAL);
265
			error = kern_clock_gettime(td, nwhich, &tp);
266
			break;
267
		default:
268
			PROC_UNLOCK(p);
269
			return (EINVAL);
270
		}
271
272
		break;
273
274
	case CLOCK_THREAD_CPUTIME_ID:
275
		clockwhich = LINUX_CPUCLOCK_WHICH(args->which);
276
		p = td->td_proc;
277
		tid = LINUX_CPUCLOCK_ID(args->which);
278
		if (tid == 0) {
279
			targettd = td;
280
			PROC_LOCK(p);
281
		} else {
282
			targettd = tdfind(tid, p->p_pid);
283
			if (targettd == NULL)
284
				return (EINVAL);
285
		}
286
		switch (clockwhich) {
287
		case LINUX_CPUCLOCK_PROF:
288
			PROC_STATLOCK(p);
289
			thread_lock(targettd);
290
			rufetchtd(targettd, &ru);
291
			thread_unlock(targettd);
292
			PROC_STATUNLOCK(p);
293
			PROC_UNLOCK(p);
294
			timevaladd(&ru.ru_utime, &ru.ru_stime);
295
			TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp);
296
			break;
297
		case LINUX_CPUCLOCK_VIRT:
298
			PROC_STATLOCK(p);
299
			thread_lock(targettd);
300
			rufetchtd(targettd, &ru);
301
			thread_unlock(targettd);
302
			PROC_STATUNLOCK(p);
303
			PROC_UNLOCK(p);
304
			TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp);
305
			break;
306
		case LINUX_CPUCLOCK_SCHED:
307
			error = kern_clock_getcpuclockid2(td, tid,
308
			    CPUCLOCK_WHICH_TID, &nwhich);
309
			PROC_UNLOCK(p);
310
			if (error != 0)
311
				return (EINVAL);
312
			error = kern_clock_gettime(td, nwhich, &tp);
313
			break;
314
		default:
315
			PROC_UNLOCK(p);
316
			return (EINVAL);
317
		}
318
		break;
319
320
	default:
321
		error = kern_clock_gettime(td, nwhich, &tp);
322
		break;
323
	}
207
	if (error != 0) {
324
	if (error != 0) {
208
		LIN_SDT_PROBE1(time, linux_clock_gettime, gettime_error, error);
325
		LIN_SDT_PROBE1(time, linux_clock_gettime, gettime_error, error);
209
		LIN_SDT_PROBE1(time, linux_clock_gettime, return, error);
326
		LIN_SDT_PROBE1(time, linux_clock_gettime, return, error);
Lines 261-279 Link Here
261
int
378
int
262
linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args)
379
linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args)
263
{
380
{
381
	struct proc *p;
264
	struct timespec ts;
382
	struct timespec ts;
265
	struct l_timespec lts;
383
	struct l_timespec lts;
266
	int error;
384
	int error, clockwhich;
267
	clockid_t nwhich = 0;	/* XXX: GCC */
385
	clockid_t nwhich = 0;	/* XXX: GCC */
386
	pid_t pid;
387
	lwpid_t tid;
268
388
269
	LIN_SDT_PROBE2(time, linux_clock_getres, entry, args->which, args->tp);
389
	LIN_SDT_PROBE2(time, linux_clock_getres, entry, args->which, args->tp);
270
390
271
	if (args->tp == NULL) {
272
		LIN_SDT_PROBE0(time, linux_clock_getres, nullcall);
273
		LIN_SDT_PROBE1(time, linux_clock_getres, return, 0);
274
	  	return (0);
275
	}
276
277
	error = linux_to_native_clockid(&nwhich, args->which);
391
	error = linux_to_native_clockid(&nwhich, args->which);
278
	if (error != 0) {
392
	if (error != 0) {
279
		LIN_SDT_PROBE1(time, linux_clock_getres, conversion_error,
393
		LIN_SDT_PROBE1(time, linux_clock_getres, conversion_error,
Lines 281-286 Link Here
281
		LIN_SDT_PROBE1(time, linux_clock_getres, return, error);
395
		LIN_SDT_PROBE1(time, linux_clock_getres, return, error);
282
		return (error);
396
		return (error);
283
	}
397
	}
398
399
	switch (nwhich) {
400
	case CLOCK_THREAD_CPUTIME_ID:
401
		tid = LINUX_CPUCLOCK_ID(args->which);
402
		if (tid != 0) {
403
			p = td->td_proc;
404
			if (tdfind(tid, p->p_pid) == NULL)
405
				return (ESRCH);
406
			PROC_UNLOCK(p);
407
		}
408
		break;
409
	case CLOCK_PROCESS_CPUTIME_ID:
410
		pid = LINUX_CPUCLOCK_ID(args->which);
411
		if (pid != 0) {
412
			error = pget(pid, PGET_CANSEE, &p);
413
			if (error != 0)
414
				return (EINVAL);
415
			PROC_UNLOCK(p);
416
		}
417
		break;
418
	}
419
420
	if (args->tp == NULL) {
421
		LIN_SDT_PROBE0(time, linux_clock_getres, nullcall);
422
		LIN_SDT_PROBE1(time, linux_clock_getres, return, 0);
423
	  	return (0);
424
	}
425
426
	switch (nwhich) {
427
	case CLOCK_THREAD_CPUTIME_ID:
428
	case CLOCK_PROCESS_CPUTIME_ID:
429
		clockwhich = LINUX_CPUCLOCK_WHICH(args->which);
430
		switch (clockwhich) {
431
		case LINUX_CPUCLOCK_PROF:
432
			nwhich = CLOCK_PROF;
433
			break;
434
		case LINUX_CPUCLOCK_VIRT:
435
			nwhich = CLOCK_VIRTUAL;
436
			break;
437
		case LINUX_CPUCLOCK_SCHED:
438
			break;
439
		default:
440
			return (EINVAL);
441
		}
442
		break;
443
444
	default:
445
		break;
446
	}
284
	error = kern_clock_getres(td, nwhich, &ts);
447
	error = kern_clock_getres(td, nwhich, &ts);
285
	if (error != 0) {
448
	if (error != 0) {
286
		LIN_SDT_PROBE1(time, linux_clock_getres, getres_error, error);
449
		LIN_SDT_PROBE1(time, linux_clock_getres, getres_error, error);
Lines 303-309 Link Here
303
	struct timespec *rmtp;
466
	struct timespec *rmtp;
304
	struct l_timespec lrqts, lrmts;
467
	struct l_timespec lrqts, lrmts;
305
	struct timespec rqts, rmts;
468
	struct timespec rqts, rmts;
306
	int error;
469
	int error, error2;
307
470
308
	LIN_SDT_PROBE2(time, linux_nanosleep, entry, args->rqtp, args->rmtp);
471
	LIN_SDT_PROBE2(time, linux_nanosleep, entry, args->rqtp, args->rmtp);
309
472
Lines 315-323 Link Here
315
	}
478
	}
316
479
317
	if (args->rmtp != NULL)
480
	if (args->rmtp != NULL)
318
	   	rmtp = &rmts;
481
		rmtp = &rmts;
319
	else
482
	else
320
	   	rmtp = NULL;
483
		rmtp = NULL;
321
484
322
	error = linux_to_native_timespec(&rqts, &lrqts);
485
	error = linux_to_native_timespec(&rqts, &lrqts);
323
	if (error != 0) {
486
	if (error != 0) {
Lines 326-350 Link Here
326
		return (error);
489
		return (error);
327
	}
490
	}
328
	error = kern_nanosleep(td, &rqts, rmtp);
491
	error = kern_nanosleep(td, &rqts, rmtp);
329
	if (error != 0) {
330
		LIN_SDT_PROBE1(time, linux_nanosleep, nanosleep_error, error);
331
		LIN_SDT_PROBE1(time, linux_nanosleep, return, error);
332
		return (error);
333
	}
334
335
	if (args->rmtp != NULL) {
492
	if (args->rmtp != NULL) {
336
	   	native_to_linux_timespec(&lrmts, rmtp);
493
		native_to_linux_timespec(&lrmts, rmtp);
337
	   	error = copyout(&lrmts, args->rmtp, sizeof(lrmts));
494
		error2 = copyout(&lrmts, args->rmtp, sizeof(lrmts));
338
		if (error != 0) {
495
		if (error2 != 0) {
339
			LIN_SDT_PROBE1(time, linux_nanosleep, copyout_error,
496
			LIN_SDT_PROBE1(time, linux_nanosleep, copyout_error,
340
			    error);
497
			    error2);
341
			LIN_SDT_PROBE1(time, linux_nanosleep, return, error);
498
			LIN_SDT_PROBE1(time, linux_nanosleep, return, error2);
342
		   	return (error);
499
			return (error2);
343
		}
500
		}
344
	}
501
	}
345
502
346
	LIN_SDT_PROBE1(time, linux_nanosleep, return, 0);
503
	LIN_SDT_PROBE1(time, linux_nanosleep, return, error);
347
	return (0);
504
	return (error);
348
}
505
}
349
506
350
int
507
int
Lines 353-359 Link Here
353
	struct timespec *rmtp;
510
	struct timespec *rmtp;
354
	struct l_timespec lrqts, lrmts;
511
	struct l_timespec lrqts, lrmts;
355
	struct timespec rqts, rmts;
512
	struct timespec rqts, rmts;
356
	int error;
513
	int error, error2;
357
514
358
	LIN_SDT_PROBE4(time, linux_clock_nanosleep, entry, args->which,
515
	LIN_SDT_PROBE4(time, linux_clock_nanosleep, entry, args->which,
359
	    args->flags, args->rqtp, args->rmtp);
516
	    args->flags, args->rqtp, args->rmtp);
Lines 373-379 Link Here
373
		return (EINVAL);
530
		return (EINVAL);
374
	}
531
	}
375
532
376
	error = copyin(args->rqtp, &lrqts, sizeof lrqts);
533
	error = copyin(args->rqtp, &lrqts, sizeof(lrqts));
377
	if (error != 0) {
534
	if (error != 0) {
378
		LIN_SDT_PROBE1(time, linux_clock_nanosleep, copyin_error,
535
		LIN_SDT_PROBE1(time, linux_clock_nanosleep, copyin_error,
379
		    error);
536
		    error);
Lines 382-390 Link Here
382
	}
539
	}
383
540
384
	if (args->rmtp != NULL)
541
	if (args->rmtp != NULL)
385
	   	rmtp = &rmts;
542
		rmtp = &rmts;
386
	else
543
	else
387
	   	rmtp = NULL;
544
		rmtp = NULL;
388
545
389
	error = linux_to_native_timespec(&rqts, &lrqts);
546
	error = linux_to_native_timespec(&rqts, &lrqts);
390
	if (error != 0) {
547
	if (error != 0) {
Lines 394-417 Link Here
394
		return (error);
551
		return (error);
395
	}
552
	}
396
	error = kern_nanosleep(td, &rqts, rmtp);
553
	error = kern_nanosleep(td, &rqts, rmtp);
397
	if (error != 0) {
398
		LIN_SDT_PROBE1(time, linux_clock_nanosleep, nanosleep_error,
399
		    error);
400
		LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error);
401
		return (error);
402
	}
403
404
	if (args->rmtp != NULL) {
554
	if (args->rmtp != NULL) {
555
		/* XXX. Not for TIMER_ABSTIME */
405
	   	native_to_linux_timespec(&lrmts, rmtp);
556
	   	native_to_linux_timespec(&lrmts, rmtp);
406
	   	error = copyout(&lrmts, args->rmtp, sizeof lrmts );
557
		error2 = copyout(&lrmts, args->rmtp, sizeof(lrmts));
407
		if (error != 0) {
558
		if (error2 != 0) {
408
			LIN_SDT_PROBE1(time, linux_clock_nanosleep,
559
			LIN_SDT_PROBE1(time, linux_clock_nanosleep,
409
			    copyout_error, error);
560
			    copyout_error, error2);
410
			LIN_SDT_PROBE1(time, linux_nanosleep, return, error);
561
			LIN_SDT_PROBE1(time, linux_clock_nanosleep,
411
		   	return (error);
562
			    return, error2);
563
			return (error2);
412
		}
564
		}
413
	}
565
	}
414
566
415
	LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, 0);
567
	LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error);
416
	return (0);
568
	return (error);
417
}
569
}
(-)sys/compat/linux/linux_timer.c (-22 / +5 lines)
Lines 49-72 Link Here
49
#endif
49
#endif
50
#include <compat/linux/linux_timer.h>
50
#include <compat/linux/linux_timer.h>
51
51
52
static int
53
linux_convert_l_clockid(clockid_t *clock_id)
54
{
55
52
56
	switch (*clock_id) {
57
	case LINUX_CLOCK_REALTIME:
58
		*clock_id = CLOCK_REALTIME;
59
		break;
60
	case LINUX_CLOCK_MONOTONIC:
61
		*clock_id = CLOCK_MONOTONIC;
62
		break;
63
	default:
64
		return (EINVAL);
65
	}
66
67
	return (0);
68
}
69
70
static int
53
static int
71
linux_convert_l_sigevent(struct l_sigevent *l_sig, struct sigevent *sig)
54
linux_convert_l_sigevent(struct l_sigevent *l_sig, struct sigevent *sig)
72
{
55
{
Lines 75-81 Link Here
75
	switch (l_sig->sigev_notify) {
58
	switch (l_sig->sigev_notify) {
76
	case L_SIGEV_SIGNAL:
59
	case L_SIGEV_SIGNAL:
77
		sig->sigev_notify = SIGEV_SIGNAL;
60
		sig->sigev_notify = SIGEV_SIGNAL;
78
		CP(*l_sig, *sig, sigev_signo);
61
		sig->sigev_signo = linux_to_bsd_signal(l_sig->sigev_signo);
79
		PTRIN_CP(*l_sig, *sig, sigev_value.sival_ptr);
62
		PTRIN_CP(*l_sig, *sig, sigev_value.sival_ptr);
80
		break;
63
		break;
81
	case L_SIGEV_NONE:
64
	case L_SIGEV_NONE:
Lines 92-98 Link Here
92
	case L_SIGEV_THREAD_ID:
75
	case L_SIGEV_THREAD_ID:
93
		sig->sigev_notify = SIGEV_THREAD_ID;
76
		sig->sigev_notify = SIGEV_THREAD_ID;
94
		CP2(*l_sig, *sig, _l_sigev_un._tid, sigev_notify_thread_id);
77
		CP2(*l_sig, *sig, _l_sigev_un._tid, sigev_notify_thread_id);
95
		CP(*l_sig, *sig, sigev_signo);
78
		sig->sigev_signo = linux_to_bsd_signal(l_sig->sigev_signo);
96
		PTRIN_CP(*l_sig, *sig, sigev_value.sival_ptr);
79
		PTRIN_CP(*l_sig, *sig, sigev_value.sival_ptr);
97
		break;
80
		break;
98
	default:
81
	default:
Lines 106-111 Link Here
106
{
89
{
107
	struct l_sigevent l_ev;
90
	struct l_sigevent l_ev;
108
	struct sigevent ev, *evp;
91
	struct sigevent ev, *evp;
92
	clockid_t nwhich;
109
	int error, id;
93
	int error, id;
110
94
111
	if (uap->evp == NULL) {
95
	if (uap->evp == NULL) {
Lines 119-128 Link Here
119
			return (error);
103
			return (error);
120
		evp = &ev;
104
		evp = &ev;
121
	}
105
	}
122
	error = linux_convert_l_clockid(&uap->clock_id);
106
	error = linux_to_native_clockid(&nwhich, uap->clock_id);
123
	if (error != 0)
107
	if (error != 0)
124
		return (error);
108
		return (error);
125
	error = kern_ktimer_create(td, uap->clock_id, evp, &id, -1);
109
	error = kern_ktimer_create(td, nwhich, evp, &id, -1);
126
	if (error == 0) {
110
	if (error == 0) {
127
		error = copyout(&id, uap->timerid, sizeof(int));
111
		error = copyout(&id, uap->timerid, sizeof(int));
128
		if (error != 0)
112
		if (error != 0)
Lines 179-182 Link Here
179
163
180
	return (kern_ktimer_delete(td, uap->timerid));
164
	return (kern_ktimer_delete(td, uap->timerid));
181
}
165
}
182
(-)sys/compat/linux/linux_timer.h (+23 lines)
Lines 56-61 Link Here
56
#define	LINUX_CLOCK_SGI_CYCLE			10
56
#define	LINUX_CLOCK_SGI_CYCLE			10
57
#define	LINUX_CLOCK_TAI				11
57
#define	LINUX_CLOCK_TAI				11
58
58
59
#define	LINUX_CPUCLOCK_PERTHREAD_MASK		4
60
#define	LINUX_CPUCLOCK_MASK			3
61
#define	LINUX_CPUCLOCK_WHICH(clock)		\
62
	((clock) & (clockid_t) LINUX_CPUCLOCK_MASK)
63
#define	LINUX_CPUCLOCK_PROF			0
64
#define	LINUX_CPUCLOCK_VIRT			1
65
#define	LINUX_CPUCLOCK_SCHED			2
66
#define	LINUX_CPUCLOCK_MAX			3
67
#define	LINUX_CLOCKFD				LINUX_CPUCLOCK_MAX
68
#define	LINUX_CLOCKFD_MASK			\
69
	(LINUX_CPUCLOCK_PERTHREAD_MASK|LINUX_CPUCLOCK_MASK)
70
71
#define	LINUX_CPUCLOCK_ID(clock)		((pid_t) ~((clock) >> 3))
72
#define	LINUX_CPUCLOCK_PERTHREAD(clock)		\
73
	(((clock) & (clockid_t) LINUX_CPUCLOCK_PERTHREAD_MASK) != 0)
74
75
59
#define	L_SIGEV_SIGNAL				0
76
#define	L_SIGEV_SIGNAL				0
60
#define	L_SIGEV_NONE				1
77
#define	L_SIGEV_NONE				1
61
#define	L_SIGEV_THREAD				2
78
#define	L_SIGEV_THREAD				2
Lines 94-97 Link Here
94
	struct l_timespec it_value;
111
	struct l_timespec it_value;
95
};
112
};
96
113
114
void native_to_linux_timespec(struct l_timespec *,
115
				     struct timespec *);
116
int linux_to_native_timespec(struct timespec *,
117
				     struct l_timespec *);
118
int linux_to_native_clockid(clockid_t *, clockid_t);
119
97
#endif	/* _LINUX_TIMER_H */
120
#endif	/* _LINUX_TIMER_H */
(-)sys/compat/linux/linux_uid16.c (-5 / +5 lines)
Lines 172-183 Link Here
172
		LIN_SDT_PROBE1(uid16, linux_setgroups16, return, EINVAL);
172
		LIN_SDT_PROBE1(uid16, linux_setgroups16, return, EINVAL);
173
		return (EINVAL);
173
		return (EINVAL);
174
	}
174
	}
175
	linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_TEMP, M_WAITOK);
175
	linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_LINUX, M_WAITOK);
176
	error = copyin(args->gidset, linux_gidset, ngrp * sizeof(l_gid16_t));
176
	error = copyin(args->gidset, linux_gidset, ngrp * sizeof(l_gid16_t));
177
	if (error) {
177
	if (error) {
178
		LIN_SDT_PROBE1(uid16, linux_setgroups16, copyin_error, error);
178
		LIN_SDT_PROBE1(uid16, linux_setgroups16, copyin_error, error);
179
		LIN_SDT_PROBE1(uid16, linux_setgroups16, return, error);
179
		LIN_SDT_PROBE1(uid16, linux_setgroups16, return, error);
180
		free(linux_gidset, M_TEMP);
180
		free(linux_gidset, M_LINUX);
181
		return (error);
181
		return (error);
182
	}
182
	}
183
	newcred = crget();
183
	newcred = crget();
Lines 219-225 Link Here
219
	crfree(oldcred);
219
	crfree(oldcred);
220
	error = 0;
220
	error = 0;
221
out:
221
out:
222
	free(linux_gidset, M_TEMP);
222
	free(linux_gidset, M_LINUX);
223
223
224
	LIN_SDT_PROBE1(uid16, linux_setgroups16, return, error);
224
	LIN_SDT_PROBE1(uid16, linux_setgroups16, return, error);
225
	return (error);
225
	return (error);
Lines 260-266 Link Here
260
260
261
	ngrp = 0;
261
	ngrp = 0;
262
	linux_gidset = malloc(bsd_gidsetsz * sizeof(*linux_gidset),
262
	linux_gidset = malloc(bsd_gidsetsz * sizeof(*linux_gidset),
263
	    M_TEMP, M_WAITOK);
263
	    M_LINUX, M_WAITOK);
264
	while (ngrp < bsd_gidsetsz) {
264
	while (ngrp < bsd_gidsetsz) {
265
		linux_gidset[ngrp] = bsd_gidset[ngrp + 1];
265
		linux_gidset[ngrp] = bsd_gidset[ngrp + 1];
266
		ngrp++;
266
		ngrp++;
Lines 267-273 Link Here
267
	}
267
	}
268
268
269
	error = copyout(linux_gidset, args->gidset, ngrp * sizeof(l_gid16_t));
269
	error = copyout(linux_gidset, args->gidset, ngrp * sizeof(l_gid16_t));
270
	free(linux_gidset, M_TEMP);
270
	free(linux_gidset, M_LINUX);
271
	if (error) {
271
	if (error) {
272
		LIN_SDT_PROBE1(uid16, linux_getgroups16, copyout_error, error);
272
		LIN_SDT_PROBE1(uid16, linux_getgroups16, copyout_error, error);
273
		LIN_SDT_PROBE1(uid16, linux_getgroups16, return, error);
273
		LIN_SDT_PROBE1(uid16, linux_getgroups16, return, error);
(-)sys/compat/linux/linux_util.c (-101 / +14 lines)
Lines 53-100 Link Here
53
#include <machine/stdarg.h>
53
#include <machine/stdarg.h>
54
54
55
#include <compat/linux/linux_util.h>
55
#include <compat/linux/linux_util.h>
56
#ifdef COMPAT_LINUX32
57
#include <machine/../linux32/linux.h>
58
#else
59
#include <machine/../linux/linux.h>
60
#endif
61
56
62
#include <compat/linux/linux_dtrace.h>
57
MALLOC_DEFINE(M_LINUX, "linux", "Linux mode structures");
58
MALLOC_DEFINE(M_EPOLL, "lepoll", "Linux events structures");
59
MALLOC_DEFINE(M_FUTEX, "futex", "Linux futexes");
60
MALLOC_DEFINE(M_FUTEX_WP, "futex wp", "Linux futex waiting proc");
63
61
64
const char      linux_emul_path[] = "/compat/linux";
62
const char      linux_emul_path[] = "/compat/linux";
65
63
66
/* DTrace init */
67
LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE);
68
69
/**
70
 * DTrace probes in this module.
71
 */
72
LIN_SDT_PROBE_DEFINE5(util, linux_emul_convpath, entry, "const char *",
73
    "enum uio_seg", "char **", "int", "int");
74
LIN_SDT_PROBE_DEFINE1(util, linux_emul_convpath, return, "int");
75
LIN_SDT_PROBE_DEFINE1(util, linux_msg, entry, "const char *");
76
LIN_SDT_PROBE_DEFINE0(util, linux_msg, return);
77
LIN_SDT_PROBE_DEFINE2(util, linux_driver_get_name_dev, entry, "device_t",
78
    "const char *");
79
LIN_SDT_PROBE_DEFINE0(util, linux_driver_get_name_dev, nullcall);
80
LIN_SDT_PROBE_DEFINE1(util, linux_driver_get_name_dev, return, "char *");
81
LIN_SDT_PROBE_DEFINE3(util, linux_driver_get_major_minor, entry, "char *",
82
    "int *", "int *");
83
LIN_SDT_PROBE_DEFINE0(util, linux_driver_get_major_minor, nullcall);
84
LIN_SDT_PROBE_DEFINE1(util, linux_driver_get_major_minor, notfound, "char *");
85
LIN_SDT_PROBE_DEFINE3(util, linux_driver_get_major_minor, return, "int",
86
    "int", "int");
87
LIN_SDT_PROBE_DEFINE0(util, linux_get_char_devices, entry);
88
LIN_SDT_PROBE_DEFINE1(util, linux_get_char_devices, return, "char *");
89
LIN_SDT_PROBE_DEFINE1(util, linux_free_get_char_devices, entry, "char *");
90
LIN_SDT_PROBE_DEFINE0(util, linux_free_get_char_devices, return);
91
LIN_SDT_PROBE_DEFINE1(util, linux_device_register_handler, entry,
92
    "struct linux_device_handler *");
93
LIN_SDT_PROBE_DEFINE1(util, linux_device_register_handler, return, "int");
94
LIN_SDT_PROBE_DEFINE1(util, linux_device_unregister_handler, entry,
95
    "struct linux_device_handler *");
96
LIN_SDT_PROBE_DEFINE1(util, linux_device_unregister_handler, return, "int");
97
98
/*
64
/*
99
 * Search an alternate path before passing pathname arguments on to
65
 * Search an alternate path before passing pathname arguments on to
100
 * system calls. Useful for keeping a separate 'emulation tree'.
66
 * system calls. Useful for keeping a separate 'emulation tree'.
Lines 108-120 Link Here
108
{
74
{
109
	int retval;
75
	int retval;
110
76
111
	LIN_SDT_PROBE5(util, linux_emul_convpath, entry, path, pathseg, pbuf,
112
	    cflag, dfd);
113
114
	retval = kern_alternate_path(td, linux_emul_path, path, pathseg, pbuf,
77
	retval = kern_alternate_path(td, linux_emul_path, path, pathseg, pbuf,
115
	    cflag, dfd);
78
	    cflag, dfd);
116
79
117
	LIN_SDT_PROBE1(util, linux_emul_convpath, return, retval);
118
	return (retval);
80
	return (retval);
119
}
81
}
120
82
Lines 124-131 Link Here
124
	va_list ap;
86
	va_list ap;
125
	struct proc *p;
87
	struct proc *p;
126
88
127
	LIN_SDT_PROBE1(util, linux_msg, entry, fmt);
128
129
	p = td->td_proc;
89
	p = td->td_proc;
130
	printf("linux: pid %d (%s): ", (int)p->p_pid, p->p_comm);
90
	printf("linux: pid %d (%s): ", (int)p->p_pid, p->p_comm);
131
	va_start(ap, fmt);
91
	va_start(ap, fmt);
Lines 132-139 Link Here
132
	vprintf(fmt, ap);
92
	vprintf(fmt, ap);
133
	va_end(ap);
93
	va_end(ap);
134
	printf("\n");
94
	printf("\n");
135
136
	LIN_SDT_PROBE0(util, linux_msg, return);
137
}
95
}
138
96
139
struct device_element
97
struct device_element
Lines 156-179 Link Here
156
	struct device_element *de;
114
	struct device_element *de;
157
	const char *device_name = device_get_name(dev);
115
	const char *device_name = device_get_name(dev);
158
116
159
	LIN_SDT_PROBE2(util, linux_driver_get_name_dev, entry, dev,
117
	if (device_name == NULL)
160
	    device_name);
161
162
	if (device_name == NULL) {
163
		LIN_SDT_PROBE0(util, linux_driver_get_name_dev, nullcall);
164
		LIN_SDT_PROBE1(util, linux_driver_get_name_dev, return, NULL);
165
		return NULL;
118
		return NULL;
166
	}
167
	TAILQ_FOREACH(de, &devices, list) {
119
	TAILQ_FOREACH(de, &devices, list) {
168
		if (strcmp(device_name, de->entry.bsd_driver_name) == 0) {
120
		if (strcmp(device_name, de->entry.bsd_driver_name) == 0)
169
			LIN_SDT_PROBE1(util, linux_driver_get_name_dev, return,
170
			    de->entry.linux_driver_name);
171
			return (de->entry.linux_driver_name);
121
			return (de->entry.linux_driver_name);
172
		}
173
	}
122
	}
174
123
175
	LIN_SDT_PROBE1(util, linux_driver_get_name_dev, return, NULL);
124
	return (NULL);
176
	return NULL;
177
}
125
}
178
126
179
int
127
int
Lines 181-195 Link Here
181
{
129
{
182
	struct device_element *de;
130
	struct device_element *de;
183
131
184
	LIN_SDT_PROBE3(util, linux_driver_get_major_minor, entry, node, major,
132
	if (node == NULL || major == NULL || minor == NULL)
185
	    minor);
186
187
	if (node == NULL || major == NULL || minor == NULL) {
188
		LIN_SDT_PROBE0(util, linux_driver_get_major_minor, nullcall);
189
		LIN_SDT_PROBE3(util, linux_driver_get_major_minor, return, 1,
190
		   0, 0);
191
		return 1;
133
		return 1;
192
	}
193
134
194
	if (strlen(node) > strlen("pts/") &&
135
	if (strlen(node) > strlen("pts/") &&
195
	    strncmp(node, "pts/", strlen("pts/")) == 0) {
136
	    strncmp(node, "pts/", strlen("pts/")) == 0) {
Lines 204-212 Link Here
204
		*major = 136 + (devno / 256);
145
		*major = 136 + (devno / 256);
205
		*minor = devno % 256;
146
		*minor = devno % 256;
206
147
207
		LIN_SDT_PROBE3(util, linux_driver_get_major_minor, return, 0,
148
		return (0);
208
		    *major, *minor);
209
		return 0;
210
	}
149
	}
211
150
212
	TAILQ_FOREACH(de, &devices, list) {
151
	TAILQ_FOREACH(de, &devices, list) {
Lines 213-228 Link Here
213
		if (strcmp(node, de->entry.bsd_device_name) == 0) {
152
		if (strcmp(node, de->entry.bsd_device_name) == 0) {
214
			*major = de->entry.linux_major;
153
			*major = de->entry.linux_major;
215
			*minor = de->entry.linux_minor;
154
			*minor = de->entry.linux_minor;
216
155
			return (0);
217
			LIN_SDT_PROBE3(util, linux_driver_get_major_minor,
218
			    return, 0, *major, *minor);
219
			return 0;
220
		}
156
		}
221
	}
157
	}
222
158
223
	LIN_SDT_PROBE1(util, linux_driver_get_major_minor, notfound, node);
159
	return (1);
224
	LIN_SDT_PROBE3(util, linux_driver_get_major_minor, return, 1, 0, 0);
225
	return 1;
226
}
160
}
227
161
228
char *
162
char *
Lines 233-240 Link Here
233
	char formated[256];
167
	char formated[256];
234
	int current_size = 0, string_size = 1024;
168
	int current_size = 0, string_size = 1024;
235
169
236
	LIN_SDT_PROBE0(util, linux_get_char_devices, entry);
237
238
	string = malloc(string_size, M_LINUX, M_WAITOK);
170
	string = malloc(string_size, M_LINUX, M_WAITOK);
239
	string[0] = '\000';
171
	string[0] = '\000';
240
	last = "";
172
	last = "";
Lines 261-268 Link Here
261
		}
193
		}
262
	}
194
	}
263
195
264
	LIN_SDT_PROBE1(util, linux_get_char_devices, return, string);
196
	return (string);
265
	return string;
266
}
197
}
267
198
268
void
199
void
Lines 269-279 Link Here
269
linux_free_get_char_devices(char *string)
200
linux_free_get_char_devices(char *string)
270
{
201
{
271
202
272
	LIN_SDT_PROBE1(util, linux_get_char_devices, entry, string);
273
274
	free(string, M_LINUX);
203
	free(string, M_LINUX);
275
276
	LIN_SDT_PROBE0(util, linux_get_char_devices, return);
277
}
204
}
278
205
279
static int linux_major_starting = 200;
206
static int linux_major_starting = 200;
Lines 283-295 Link Here
283
{
210
{
284
	struct device_element *de;
211
	struct device_element *de;
285
212
286
	LIN_SDT_PROBE1(util, linux_device_register_handler, entry, d);
213
	if (d == NULL)
287
288
	if (d == NULL) {
289
		LIN_SDT_PROBE1(util, linux_device_register_handler, return,
290
		    EINVAL);
291
		return (EINVAL);
214
		return (EINVAL);
292
	}
293
215
294
	de = malloc(sizeof(*de), M_LINUX, M_WAITOK);
216
	de = malloc(sizeof(*de), M_LINUX, M_WAITOK);
295
	if (d->linux_major < 0) {
217
	if (d->linux_major < 0) {
Lines 300-306 Link Here
300
	/* Add the element to the list, sorted on span. */
222
	/* Add the element to the list, sorted on span. */
301
	TAILQ_INSERT_TAIL(&devices, de, list);
223
	TAILQ_INSERT_TAIL(&devices, de, list);
302
224
303
	LIN_SDT_PROBE1(util, linux_device_register_handler, return, 0);
304
	return (0);
225
	return (0);
305
}
226
}
306
227
Lines 309-321 Link Here
309
{
230
{
310
	struct device_element *de;
231
	struct device_element *de;
311
232
312
	LIN_SDT_PROBE1(util, linux_device_unregister_handler, entry, d);
233
	if (d == NULL)
313
314
	if (d == NULL) {
315
		LIN_SDT_PROBE1(util, linux_device_unregister_handler, return,
316
		    EINVAL);
317
		return (EINVAL);
234
		return (EINVAL);
318
	}
319
235
320
	TAILQ_FOREACH(de, &devices, list) {
236
	TAILQ_FOREACH(de, &devices, list) {
321
		if (bcmp(d, &de->entry, sizeof(*d)) == 0) {
237
		if (bcmp(d, &de->entry, sizeof(*d)) == 0) {
Lines 322-333 Link Here
322
			TAILQ_REMOVE(&devices, de, list);
238
			TAILQ_REMOVE(&devices, de, list);
323
			free(de, M_LINUX);
239
			free(de, M_LINUX);
324
240
325
			LIN_SDT_PROBE1(util, linux_device_unregister_handler,
326
			    return, 0);
327
			return (0);
241
			return (0);
328
		}
242
		}
329
	}
243
	}
330
244
331
	LIN_SDT_PROBE1(util, linux_device_unregister_handler, return, EINVAL);
332
	return (EINVAL);
245
	return (EINVAL);
333
}
246
}
(-)sys/compat/linux/linux_util.h (-1 / +5 lines)
Lines 44-49 Link Here
44
#include <sys/cdefs.h>
44
#include <sys/cdefs.h>
45
#include <sys/uio.h>
45
#include <sys/uio.h>
46
46
47
MALLOC_DECLARE(M_LINUX);
48
MALLOC_DECLARE(M_EPOLL);
49
MALLOC_DECLARE(M_FUTEX);
50
MALLOC_DECLARE(M_FUTEX_WP);
51
47
extern const char linux_emul_path[];
52
extern const char linux_emul_path[];
48
53
49
int linux_emul_convpath(struct thread *, const char *, enum uio_seg, char **, int, int);
54
int linux_emul_convpath(struct thread *, const char *, enum uio_seg, char **, int, int);
Lines 115-121 Link Here
115
#define	LINUX_CTRFMT(nm, fmt)	#nm"("fmt")"
120
#define	LINUX_CTRFMT(nm, fmt)	#nm"("fmt")"
116
121
117
#define	LINUX_CTR6(f, m, p1, p2, p3, p4, p5, p6) do {			\
122
#define	LINUX_CTR6(f, m, p1, p2, p3, p4, p5, p6) do {			\
118
	if (ldebug(f))							\
119
		CTR6(KTR_LINUX, LINUX_CTRFMT(f, m),			\
123
		CTR6(KTR_LINUX, LINUX_CTRFMT(f, m),			\
120
		    p1, p2, p3, p4, p5, p6);				\
124
		    p1, p2, p3, p4, p5, p6);				\
121
} while (0)
125
} while (0)
(-)sys/compat/linux/linux_vdso.c (+244 lines)
Line 0 Link Here
1
/*-
2
 * Copyright (c) 2013 Dmitry Chagin
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
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
27
#include <sys/cdefs.h>
28
__FBSDID("$FreeBSD$");
29
30
#include "opt_compat.h"
31
32
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
33
#define	__ELF_WORD_SIZE	32
34
#else
35
#define	__ELF_WORD_SIZE	64
36
#endif
37
38
#include <sys/param.h>
39
#include <sys/systm.h>
40
#include <sys/elf.h>
41
#include <sys/kernel.h>
42
#include <sys/lock.h>
43
#include <sys/rwlock.h>
44
#include <sys/queue.h>
45
#include <sys/sysent.h>
46
47
#include <vm/vm.h>
48
#include <vm/vm_param.h>
49
#include <vm/pmap.h>
50
#include <vm/vm_extern.h>
51
#include <vm/vm_kern.h>
52
#include <vm/vm_map.h>
53
#include <vm/vm_object.h>
54
#include <vm/vm_page.h>
55
#include <vm/vm_pager.h>
56
57
#include <compat/linux/linux_vdso.h>
58
59
SLIST_HEAD(, linux_vdso_sym) __elfN(linux_vdso_syms) =
60
    SLIST_HEAD_INITIALIZER(__elfN(linux_vdso_syms));
61
62
static int __elfN(symtabindex);
63
static int __elfN(symstrindex);
64
65
static void
66
__elfN(linux_vdso_lookup)(Elf_Ehdr *, struct linux_vdso_sym *);
67
68
69
void
70
__elfN(linux_vdso_sym_init)(struct linux_vdso_sym *s)
71
{
72
73
	SLIST_INSERT_HEAD(&__elfN(linux_vdso_syms), s, sym);
74
}
75
76
vm_object_t
77
__elfN(linux_shared_page_init)(char **mapping)
78
{
79
	vm_page_t m;
80
	vm_object_t obj;
81
	vm_offset_t addr;
82
83
	obj = vm_pager_allocate(OBJT_PHYS, 0, PAGE_SIZE,
84
	    VM_PROT_DEFAULT, 0, NULL);
85
	VM_OBJECT_WLOCK(obj);
86
	m = vm_page_grab(obj, 0, VM_ALLOC_NOBUSY | VM_ALLOC_ZERO);
87
	m->valid = VM_PAGE_BITS_ALL;
88
	VM_OBJECT_WUNLOCK(obj);
89
	addr = kva_alloc(PAGE_SIZE);
90
	pmap_qenter(addr, &m, 1);
91
	*mapping = (char *)addr;
92
	return (obj);
93
}
94
95
void
96
__elfN(linux_shared_page_fini)(vm_object_t obj)
97
{
98
99
	vm_object_deallocate(obj);
100
}
101
102
void
103
__elfN(linux_vdso_fixup)(struct sysentvec *sv)
104
{
105
	Elf_Ehdr *ehdr;
106
	Elf_Shdr *shdr;
107
	int i;
108
109
	ehdr = (Elf_Ehdr *) sv->sv_sigcode;
110
111
	if (!IS_ELF(*ehdr) ||
112
	    ehdr->e_ident[EI_CLASS] != ELF_TARG_CLASS ||
113
	    ehdr->e_ident[EI_DATA] != ELF_TARG_DATA ||
114
	    ehdr->e_ident[EI_VERSION] != EV_CURRENT ||
115
	    ehdr->e_shoff == 0 ||
116
	    ehdr->e_shentsize != sizeof(Elf_Shdr))
117
		panic("Linux invalid vdso header.\n");
118
119
	if (ehdr->e_type != ET_DYN)
120
		panic("Linux invalid vdso header.\n");
121
122
	shdr = (Elf_Shdr *) ((caddr_t)ehdr + ehdr->e_shoff);
123
124
	__elfN(symtabindex) = -1;
125
	__elfN(symstrindex) = -1;
126
	for (i = 0; i < ehdr->e_shnum; i++) {
127
		if (shdr[i].sh_size == 0)
128
			continue;
129
		if (shdr[i].sh_type == SHT_DYNSYM) {
130
			__elfN(symtabindex) = i;
131
			__elfN(symstrindex) = shdr[i].sh_link;
132
		}
133
	}
134
135
	if (__elfN(symtabindex) == -1 || __elfN(symstrindex) == -1)
136
		panic("Linux invalid vdso header.\n");
137
138
	ehdr->e_ident[EI_OSABI] = ELFOSABI_LINUX;
139
}
140
141
void
142
__elfN(linux_vdso_reloc)(struct sysentvec *sv, long vdso_adjust)
143
{
144
	struct linux_vdso_sym *lsym;
145
	Elf_Ehdr *ehdr;
146
	Elf_Phdr *phdr;
147
	Elf_Shdr *shdr;
148
	Elf_Dyn *dyn;
149
	Elf_Sym *sym;
150
	int i, symcnt;
151
152
	ehdr = (Elf_Ehdr *) sv->sv_sigcode;
153
154
	/* Adjust our so relative to the sigcode_base */
155
	if (vdso_adjust != 0) {
156
		ehdr->e_entry += vdso_adjust;
157
		phdr = (Elf_Phdr *)((caddr_t)ehdr + ehdr->e_phoff);
158
159
		/* phdrs */
160
		for (i = 0; i < ehdr->e_phnum; i++) {
161
			phdr[i].p_vaddr += vdso_adjust;
162
			if (phdr[i].p_type != PT_DYNAMIC)
163
				continue;
164
			dyn = (Elf_Dyn *)((caddr_t)ehdr + phdr[i].p_offset);
165
			for(; dyn->d_tag != DT_NULL; dyn++) {
166
				switch (dyn->d_tag) {
167
				case DT_PLTGOT:
168
				case DT_HASH:
169
				case DT_STRTAB:
170
				case DT_SYMTAB:
171
				case DT_RELA:
172
				case DT_INIT:
173
				case DT_FINI:
174
				case DT_REL:
175
				case DT_DEBUG:
176
				case DT_JMPREL:
177
				case DT_VERSYM:
178
				case DT_VERDEF:
179
				case DT_VERNEED:
180
				case DT_ADDRRNGLO ... DT_ADDRRNGHI:
181
					dyn->d_un.d_ptr += vdso_adjust;
182
					break;
183
				case DT_ENCODING ... DT_LOOS-1:
184
				case DT_LOOS ... DT_HIOS:
185
					if (dyn->d_tag >= DT_ENCODING &&
186
					    (dyn->d_tag & 1) == 0)
187
						dyn->d_un.d_ptr += vdso_adjust;
188
					break;
189
				default:
190
					break;
191
				}
192
			}
193
		}
194
195
		/* sections */
196
		shdr = (Elf_Shdr *)((caddr_t)ehdr + ehdr->e_shoff);
197
		for(i = 0; i < ehdr->e_shnum; i++) {
198
			if (!(shdr[i].sh_flags & SHF_ALLOC))
199
				continue;
200
			shdr[i].sh_addr += vdso_adjust;
201
			if (shdr[i].sh_type != SHT_SYMTAB &&
202
			    shdr[i].sh_type != SHT_DYNSYM)
203
				continue;
204
205
			sym = (Elf_Sym *)((caddr_t)ehdr + shdr[i].sh_offset);
206
			symcnt = shdr[i].sh_size / sizeof(*sym);
207
208
			for(i = 0; i < symcnt; i++, sym++) {
209
				if (sym->st_shndx == SHN_UNDEF ||
210
				    sym->st_shndx == SHN_ABS)
211
					continue;
212
				sym->st_value += vdso_adjust;
213
			}
214
		}
215
	}
216
217
	SLIST_FOREACH(lsym, &__elfN(linux_vdso_syms), sym)
218
		__elfN(linux_vdso_lookup)(ehdr, lsym);
219
}
220
221
static void
222
__elfN(linux_vdso_lookup)(Elf_Ehdr *ehdr, struct linux_vdso_sym *vsym)
223
{
224
	vm_offset_t strtab, symname;
225
	uint32_t symcnt;
226
	Elf_Shdr *shdr;
227
	int i;
228
229
	shdr = (Elf_Shdr *) ((caddr_t)ehdr + ehdr->e_shoff);
230
231
	strtab = (vm_offset_t)((caddr_t)ehdr +
232
	    shdr[__elfN(symstrindex)].sh_offset);
233
	Elf_Sym *sym = (Elf_Sym *)((caddr_t)ehdr +
234
	    shdr[__elfN(symtabindex)].sh_offset);
235
	symcnt = shdr[__elfN(symtabindex)].sh_size / sizeof(*sym);
236
237
	for (i = 0; i < symcnt; ++i, ++sym) {
238
		symname = strtab + sym->st_name;
239
		if (strncmp(vsym->symname, (char *)symname, vsym->size) == 0) {
240
			*vsym->ptr = (uintptr_t)sym->st_value;
241
			break;
242
		}
243
	}
244
}
(-)sys/compat/linux/linux_vdso.h (+65 lines)
Line 0 Link Here
1
/*-
2
 * Copyright (c) 2013 Dmitry Chagin
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
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 *
26
 * $FreeBSD$
27
 */
28
29
#ifndef _LINUX_VDSO_H_
30
#define	_LINUX_VDSO_H_
31
32
#include <sys/types.h>
33
34
struct linux_vdso_sym {
35
	SLIST_ENTRY(linux_vdso_sym) sym;
36
	uint32_t	size;
37
	uintptr_t *	ptr;
38
	char		symname[];
39
};
40
41
vm_object_t __elfN(linux_shared_page_init)(char **);
42
void	__elfN(linux_shared_page_fini)(vm_object_t);
43
void	__elfN(linux_vdso_fixup)(struct sysentvec *);
44
void	__elfN(linux_vdso_reloc)(struct sysentvec *, long);
45
void	__elfN(linux_vdso_sym_init)(struct linux_vdso_sym *);
46
47
#define	LINUX_VDSO_SYM_INTPTR(name)				\
48
uintptr_t name;							\
49
LINUX_VDSO_SYM_DEFINE(name)
50
51
#define	LINUX_VDSO_SYM_CHAR(name)				\
52
const char * name;						\
53
LINUX_VDSO_SYM_DEFINE(name)
54
55
#define	LINUX_VDSO_SYM_DEFINE(name)				\
56
static struct linux_vdso_sym name ## sym = {			\
57
	.symname	= #name,				\
58
	.size		= sizeof(#name),			\
59
	.ptr		= (uintptr_t *)&name			\
60
};								\
61
SYSINIT(__elfN(name ## _sym_init), SI_SUB_EXEC,			\
62
    SI_ORDER_FIRST, __elfN(linux_vdso_sym_init), &name ## sym);	\
63
struct __hack
64
65
#endif	/* _LINUX_VDSO_H_ */
(-)sys/compat/linux/stats_timing.d (-1 lines)
Lines 39-45 Link Here
39
 *      possible for a given application
39
 *      possible for a given application
40
 *  - graph of longest running (CPU-time!) function in total
40
 *  - graph of longest running (CPU-time!) function in total
41
 *    - may help finding problem cases in the kernel code
41
 *    - may help finding problem cases in the kernel code
42
 * - timing statistics for the emul_lock
43
 * - graph of longest held (CPU-time!) locks
42
 * - graph of longest held (CPU-time!) locks
44
 */
43
 */
45
44
(-)sys/compat/svr4/svr4_misc.c (-8 / +8 lines)
Lines 875-883 Link Here
875
875
876
	p = td->td_proc;
876
	p = td->td_proc;
877
	PROC_LOCK(p);
877
	PROC_LOCK(p);
878
	PROC_SLOCK(p);
878
	PROC_STATLOCK(p);
879
	calcru(p, &utime, &stime);
879
	calcru(p, &utime, &stime);
880
	PROC_SUNLOCK(p);
880
	PROC_STATUNLOCK(p);
881
	calccru(p, &cutime, &cstime);
881
	calccru(p, &cutime, &cstime);
882
	PROC_UNLOCK(p);
882
	PROC_UNLOCK(p);
883
883
Lines 1288-1296 Link Here
1288
			pid = p->p_pid;
1288
			pid = p->p_pid;
1289
			status = p->p_xstat;
1289
			status = p->p_xstat;
1290
			ru = p->p_ru;
1290
			ru = p->p_ru;
1291
			PROC_SLOCK(p);
1291
			PROC_STATLOCK(p);
1292
			calcru(p, &ru.ru_utime, &ru.ru_stime);
1292
			calcru(p, &ru.ru_utime, &ru.ru_stime);
1293
			PROC_SUNLOCK(p);
1293
			PROC_STATUNLOCK(p);
1294
			PROC_UNLOCK(p);
1294
			PROC_UNLOCK(p);
1295
			sx_sunlock(&proctree_lock);
1295
			sx_sunlock(&proctree_lock);
1296
1296
Lines 1315-1323 Link Here
1315
			pid = p->p_pid;
1315
			pid = p->p_pid;
1316
			status = W_STOPCODE(p->p_xstat);
1316
			status = W_STOPCODE(p->p_xstat);
1317
			ru = p->p_ru;
1317
			ru = p->p_ru;
1318
			PROC_SLOCK(p);
1318
			PROC_STATLOCK(p);
1319
			calcru(p, &ru.ru_utime, &ru.ru_stime);
1319
			calcru(p, &ru.ru_utime, &ru.ru_stime);
1320
			PROC_SUNLOCK(p);
1320
			PROC_STATUNLOCK(p);
1321
			PROC_UNLOCK(p);
1321
			PROC_UNLOCK(p);
1322
1322
1323
		        if (((uap->options & SVR4_WNOWAIT)) == 0) {
1323
		        if (((uap->options & SVR4_WNOWAIT)) == 0) {
Lines 1339-1347 Link Here
1339
			pid = p->p_pid;
1339
			pid = p->p_pid;
1340
			ru = p->p_ru;
1340
			ru = p->p_ru;
1341
			status = SIGCONT;
1341
			status = SIGCONT;
1342
			PROC_SLOCK(p);
1342
			PROC_STATLOCK(p);
1343
			calcru(p, &ru.ru_utime, &ru.ru_stime);
1343
			calcru(p, &ru.ru_utime, &ru.ru_stime);
1344
			PROC_SUNLOCK(p);
1344
			PROC_STATUNLOCK(p);
1345
			PROC_UNLOCK(p);
1345
			PROC_UNLOCK(p);
1346
1346
1347
		        if (((uap->options & SVR4_WNOWAIT)) == 0) {
1347
		        if (((uap->options & SVR4_WNOWAIT)) == 0) {
(-)sys/compat/svr4/svr4_sysvec.c (+1 lines)
Lines 196-201 Link Here
196
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
196
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
197
	.sv_syscallnames = NULL,
197
	.sv_syscallnames = NULL,
198
	.sv_schedtail	= NULL,
198
	.sv_schedtail	= NULL,
199
	.sv_trap	= NULL,
199
};
200
};
200
201
201
const char      svr4_emul_path[] = "/compat/svr4";
202
const char      svr4_emul_path[] = "/compat/svr4";
(-)sys/conf/files (+1 lines)
Lines 2684-2689 Link Here
2684
fs/procfs/procfs.c		optional procfs
2684
fs/procfs/procfs.c		optional procfs
2685
fs/procfs/procfs_ctl.c		optional procfs
2685
fs/procfs/procfs_ctl.c		optional procfs
2686
fs/procfs/procfs_dbregs.c	optional procfs
2686
fs/procfs/procfs_dbregs.c	optional procfs
2687
fs/procfs/procfs_fdlink.c	optional procfs
2687
fs/procfs/procfs_fpregs.c	optional procfs
2688
fs/procfs/procfs_fpregs.c	optional procfs
2688
fs/procfs/procfs_ioctl.c	optional procfs
2689
fs/procfs/procfs_ioctl.c	optional procfs
2689
fs/procfs/procfs_map.c		optional procfs
2690
fs/procfs/procfs_map.c		optional procfs
(-)sys/conf/files.amd64 (-2 / +15 lines)
Lines 20-25 Link Here
20
	no-obj no-implicit-rule before-depend				\
20
	no-obj no-implicit-rule before-depend				\
21
	clean		"linux32_assym.h"
21
	clean		"linux32_assym.h"
22
#
22
#
23
linux32_locore.o	optional	compat_linux32		\
24
	dependency 	"linux32_assym.h $S/amd64/linux32/linux32_locore.s"	\
25
	compile-with	"${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s -pipe -I. -I$S -Werror -Wall -fno-common -nostdinc -nostdlib -Wl,-T$S/amd64/linux32/linux32_vdso.lds.s -Wl,-soname=linux32_vdso.so,--eh-frame-hdr,-fPIC,-warn-common ${.IMPSRC} -o ${.TARGET}" \
26
	no-obj no-implicit-rule						\
27
	clean		"linux32_locore.o"
28
#
29
linux32_vdso.so		optional	compat_linux32			\
30
	dependency 	"linux32_locore.o"				\
31
	compile-with	"${OBJCOPY} --input binary --output elf64-x86-64-freebsd --binary-architecture i386 linux32_locore.o ${.TARGET}" \
32
	no-implicit-rule						\
33
	clean		"linux32_vdso.so"
34
#
23
ia32_genassym.o			standard				\
35
ia32_genassym.o			standard				\
24
	dependency 	"$S/compat/ia32/ia32_genassym.c"		\
36
	dependency 	"$S/compat/ia32/ia32_genassym.c"		\
25
	compile-with	"${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}"	\
37
	compile-with	"${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}"	\
Lines 505-512 Link Here
505
# Linux/i386 binary support
517
# Linux/i386 binary support
506
#
518
#
507
amd64/linux32/linux32_dummy.c	optional	compat_linux32
519
amd64/linux32/linux32_dummy.c	optional	compat_linux32
508
amd64/linux32/linux32_locore.s	optional	compat_linux32		\
509
	dependency 	"linux32_assym.h"
510
amd64/linux32/linux32_machdep.c	optional	compat_linux32
520
amd64/linux32/linux32_machdep.c	optional	compat_linux32
511
amd64/linux32/linux32_support.s	optional	compat_linux32		\
521
amd64/linux32/linux32_support.s	optional	compat_linux32		\
512
	dependency 	"linux32_assym.h"
522
	dependency 	"linux32_assym.h"
Lines 513-518 Link Here
513
amd64/linux32/linux32_sysent.c	optional	compat_linux32
523
amd64/linux32/linux32_sysent.c	optional	compat_linux32
514
amd64/linux32/linux32_sysvec.c	optional	compat_linux32
524
amd64/linux32/linux32_sysvec.c	optional	compat_linux32
515
compat/linux/linux_emul.c	optional	compat_linux32
525
compat/linux/linux_emul.c	optional	compat_linux32
526
compat/linux/linux_event.c	optional	compat_linux32
516
compat/linux/linux_file.c	optional	compat_linux32
527
compat/linux/linux_file.c	optional	compat_linux32
517
compat/linux/linux_fork.c	optional	compat_linux32
528
compat/linux/linux_fork.c	optional	compat_linux32
518
compat/linux/linux_futex.c	optional	compat_linux32
529
compat/linux/linux_futex.c	optional	compat_linux32
Lines 529-534 Link Here
529
compat/linux/linux_timer.c	optional	compat_linux32
540
compat/linux/linux_timer.c	optional	compat_linux32
530
compat/linux/linux_uid16.c	optional	compat_linux32
541
compat/linux/linux_uid16.c	optional	compat_linux32
531
compat/linux/linux_util.c	optional	compat_linux32
542
compat/linux/linux_util.c	optional	compat_linux32
543
compat/linux/linux_vdso.c	optional	compat_linux32
544
compat/linux/linux_common.c	optional	compat_linux32
532
dev/amr/amr_linux.c		optional	compat_linux32 amr
545
dev/amr/amr_linux.c		optional	compat_linux32 amr
533
dev/mfi/mfi_linux.c		optional	compat_linux32 mfi
546
dev/mfi/mfi_linux.c		optional	compat_linux32 mfi
534
#
547
#
(-)sys/conf/files.i386 (-2 / +14 lines)
Lines 19-24 Link Here
19
	no-obj no-implicit-rule before-depend				\
19
	no-obj no-implicit-rule before-depend				\
20
	clean		"linux_assym.h"
20
	clean		"linux_assym.h"
21
#
21
#
22
linux_locore.o			optional	compat_linux		\
23
	dependency 	"linux_assym.h $S/i386/linux/linux_locore.s"	\
24
	compile-with	"${CC} -x assembler-with-cpp -DLOCORE -shared -s -pipe -I. -I$S -Werror -Wall -fno-common -nostdinc -nostdlib -Wl,-T$S/i386/linux/linux_vdso.lds.s -Wl,-soname=linux_vdso.so,--eh-frame-hdr,-fPIC,-warn-common ${.IMPSRC} -o ${.TARGET}" \
25
	no-obj no-implicit-rule						\
26
	clean		"linux_locore.o"
27
#
28
linux_vdso.so			optional	compat_linux		\
29
	dependency 	"linux_locore.o"				\
30
	compile-with	"${OBJCOPY} --input binary --output elf32-i386-freebsd --binary-architecture i386 linux_locore.o ${.TARGET}" \
31
	no-implicit-rule						\
32
	clean		"linux_vdso.so"
33
#
22
svr4_genassym.o			optional	compat_svr4		\
34
svr4_genassym.o			optional	compat_svr4		\
23
	dependency 	"$S/i386/svr4/svr4_genassym.c"			\
35
	dependency 	"$S/i386/svr4/svr4_genassym.c"			\
24
	compile-with	"${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}"	\
36
	compile-with	"${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}"	\
Lines 80-85 Link Here
80
cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S	optional zfs compile-with "${ZFS_S}"
92
cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S	optional zfs compile-with "${ZFS_S}"
81
compat/linprocfs/linprocfs.c	optional linprocfs
93
compat/linprocfs/linprocfs.c	optional linprocfs
82
compat/linsysfs/linsysfs.c	optional linsysfs
94
compat/linsysfs/linsysfs.c	optional linsysfs
95
compat/linux/linux_event.c	optional compat_linux
83
compat/linux/linux_emul.c	optional compat_linux
96
compat/linux/linux_emul.c	optional compat_linux
84
compat/linux/linux_file.c	optional compat_linux
97
compat/linux/linux_file.c	optional compat_linux
85
compat/linux/linux_fork.c	optional compat_linux
98
compat/linux/linux_fork.c	optional compat_linux
Lines 97-102 Link Here
97
compat/linux/linux_timer.c	optional compat_linux
110
compat/linux/linux_timer.c	optional compat_linux
98
compat/linux/linux_uid16.c	optional compat_linux
111
compat/linux/linux_uid16.c	optional compat_linux
99
compat/linux/linux_util.c	optional compat_linux
112
compat/linux/linux_util.c	optional compat_linux
113
compat/linux/linux_vdso.c	optional compat_linux
100
compat/ndis/kern_ndis.c		optional ndisapi pci
114
compat/ndis/kern_ndis.c		optional ndisapi pci
101
compat/ndis/kern_windrv.c	optional ndisapi pci
115
compat/ndis/kern_windrv.c	optional ndisapi pci
102
compat/ndis/subr_hal.c		optional ndisapi pci
116
compat/ndis/subr_hal.c		optional ndisapi pci
Lines 516-523 Link Here
516
i386/isa/spic.c			optional spic
530
i386/isa/spic.c			optional spic
517
i386/linux/imgact_linux.c	optional compat_linux
531
i386/linux/imgact_linux.c	optional compat_linux
518
i386/linux/linux_dummy.c	optional compat_linux
532
i386/linux/linux_dummy.c	optional compat_linux
519
i386/linux/linux_locore.s	optional compat_linux	\
520
	dependency 	"linux_assym.h"
521
i386/linux/linux_machdep.c	optional compat_linux
533
i386/linux/linux_machdep.c	optional compat_linux
522
i386/linux/linux_ptrace.c	optional compat_linux
534
i386/linux/linux_ptrace.c	optional compat_linux
523
i386/linux/linux_support.s	optional compat_linux	\
535
i386/linux/linux_support.s	optional compat_linux	\
(-)sys/conf/files.pc98 (+1 lines)
Lines 41-46 Link Here
41
cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S	optional zfs compile-with "${ZFS_S}"
41
cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S	optional zfs compile-with "${ZFS_S}"
42
compat/linprocfs/linprocfs.c	optional linprocfs
42
compat/linprocfs/linprocfs.c	optional linprocfs
43
compat/linsysfs/linsysfs.c	optional linsysfs
43
compat/linsysfs/linsysfs.c	optional linsysfs
44
compat/linux/linux_event.c	optional compat_linux
44
compat/linux/linux_emul.c	optional compat_linux
45
compat/linux/linux_emul.c	optional compat_linux
45
compat/linux/linux_file.c	optional compat_linux
46
compat/linux/linux_file.c	optional compat_linux
46
compat/linux/linux_fork.c	optional compat_linux
47
compat/linux/linux_fork.c	optional compat_linux
(-)sys/ddb/db_ps.c (-4 / +5 lines)
Lines 392-408 Link Here
392
	db_printf(" state: ");
392
	db_printf(" state: ");
393
	switch (p->p_state) {
393
	switch (p->p_state) {
394
	case PRS_NEW:
394
	case PRS_NEW:
395
		db_printf("NEW\n");
395
		db_printf("NEW");
396
		break;
396
		break;
397
	case PRS_NORMAL:
397
	case PRS_NORMAL:
398
		db_printf("NORMAL\n");
398
		db_printf("NORMAL");
399
		break;
399
		break;
400
	case PRS_ZOMBIE:
400
	case PRS_ZOMBIE:
401
		db_printf("ZOMBIE\n");
401
		db_printf("ZOMBIE");
402
		break;
402
		break;
403
	default:
403
	default:
404
		db_printf("??? (%#x)\n", p->p_state);
404
		db_printf("??? (%#x)", p->p_state);
405
	}
405
	}
406
	db_printf(" (p_flag 0x%x)\n", p->p_flag);
406
	if (p->p_ucred != NULL) {
407
	if (p->p_ucred != NULL) {
407
		db_printf(" uid: %d  gids: ", p->p_ucred->cr_uid);
408
		db_printf(" uid: %d  gids: ", p->p_ucred->cr_uid);
408
		for (i = 0; i < p->p_ucred->cr_ngroups; i++) {
409
		for (i = 0; i < p->p_ucred->cr_ngroups; i++) {
(-)sys/fs/procfs/procfs_status.c (-2 / +2 lines)
Lines 125-133 Link Here
125
	if (p->p_flag & P_INMEM) {
125
	if (p->p_flag & P_INMEM) {
126
		struct timeval start, ut, st;
126
		struct timeval start, ut, st;
127
127
128
		PROC_SLOCK(p);
128
		PROC_STATLOCK(p);
129
		calcru(p, &ut, &st);
129
		calcru(p, &ut, &st);
130
		PROC_SUNLOCK(p);
130
		PROC_STATUNLOCK(p);
131
		start = p->p_stats->p_start;
131
		start = p->p_stats->p_start;
132
		timevaladd(&start, &boottime);
132
		timevaladd(&start, &boottime);
133
		sbuf_printf(sb, " %jd,%ld %jd,%ld %jd,%ld",
133
		sbuf_printf(sb, " %jd,%ld %jd,%ld %jd,%ld",
(-)sys/fs/pseudofs/pseudofs.c (+2 lines)
Lines 52-60 Link Here
52
SYSCTL_NODE(_vfs, OID_AUTO, pfs, CTLFLAG_RW, 0,
52
SYSCTL_NODE(_vfs, OID_AUTO, pfs, CTLFLAG_RW, 0,
53
    "pseudofs");
53
    "pseudofs");
54
54
55
#ifdef PSEUDOFS_TRACE
55
int pfs_trace;
56
int pfs_trace;
56
SYSCTL_INT(_vfs_pfs, OID_AUTO, trace, CTLFLAG_RW, &pfs_trace, 0,
57
SYSCTL_INT(_vfs_pfs, OID_AUTO, trace, CTLFLAG_RW, &pfs_trace, 0,
57
    "enable tracing of pseudofs vnode operations");
58
    "enable tracing of pseudofs vnode operations");
59
#endif
58
60
59
#if PFS_FSNAMELEN != MFSNAMELEN
61
#if PFS_FSNAMELEN != MFSNAMELEN
60
#error "PFS_FSNAMELEN is not equal to MFSNAMELEN"
62
#error "PFS_FSNAMELEN is not equal to MFSNAMELEN"
(-)sys/i386/i386/elf_machdep.c (+1 lines)
Lines 88-93 Link Here
88
	.sv_shared_page_base = SHAREDPAGE,
88
	.sv_shared_page_base = SHAREDPAGE,
89
	.sv_shared_page_len = PAGE_SIZE,
89
	.sv_shared_page_len = PAGE_SIZE,
90
	.sv_schedtail	= NULL,
90
	.sv_schedtail	= NULL,
91
	.sv_trap	= NULL,
91
};
92
};
92
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
93
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
93
94
(-)sys/i386/i386/machdep.c (-8 lines)
Lines 400-409 Link Here
400
	} else
400
	} else
401
		fp = (struct osigframe *)regs->tf_esp - 1;
401
		fp = (struct osigframe *)regs->tf_esp - 1;
402
402
403
	/* Translate the signal if appropriate. */
404
	if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
405
		sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
406
407
	/* Build the argument list for the signal handler. */
403
	/* Build the argument list for the signal handler. */
408
	sf.sf_signum = sig;
404
	sf.sf_signum = sig;
409
	sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc;
405
	sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc;
Lines 551-560 Link Here
551
	} else
547
	} else
552
		sfp = (struct sigframe4 *)regs->tf_esp - 1;
548
		sfp = (struct sigframe4 *)regs->tf_esp - 1;
553
549
554
	/* Translate the signal if appropriate. */
555
	if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
556
		sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
557
558
	/* Build the argument list for the signal handler. */
550
	/* Build the argument list for the signal handler. */
559
	sf.sf_signum = sig;
551
	sf.sf_signum = sig;
560
	sf.sf_ucontext = (register_t)&sfp->sf_uc;
552
	sf.sf_ucontext = (register_t)&sfp->sf_uc;
(-)sys/i386/ibcs2/ibcs2_sysvec.c (+1 lines)
Lines 89-94 Link Here
89
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
89
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
90
	.sv_syscallnames = NULL,
90
	.sv_syscallnames = NULL,
91
	.sv_schedtail	= NULL,
91
	.sv_schedtail	= NULL,
92
	.sv_trap	= NULL,
92
};
93
};
93
94
94
static int
95
static int
(-)sys/i386/linux/linux.h (-115 / +18 lines)
Lines 33-38 Link Here
33
33
34
#include <sys/signal.h>	/* for sigval union */
34
#include <sys/signal.h>	/* for sigval union */
35
35
36
#include <compat/linux/linux.h>
36
#include <i386/linux/linux_syscall.h>
37
#include <i386/linux/linux_syscall.h>
37
38
38
/*
39
/*
Lines 40-53 Link Here
40
 */
41
 */
41
extern u_char linux_debug_map[];
42
extern u_char linux_debug_map[];
42
#define	ldebug(name)	isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
43
#define	ldebug(name)	isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
43
#define	ARGS(nm, fmt)	"linux(%ld): "#nm"("fmt")\n", (long)td->td_proc->p_pid
44
#define	ARGS(nm, fmt)	"linux(%ld/%ld): "#nm"("fmt")\n",			\
44
#define	LMSG(fmt)	"linux(%ld): "fmt"\n", (long)td->td_proc->p_pid
45
			(long)td->td_proc->p_pid, (long)td->td_tid
46
#define	LMSG(fmt)	"linux(%ld/%ld): "fmt"\n",				\
47
			(long)td->td_proc->p_pid, (long)td->td_tid
45
#define	LINUX_DTRACE	linuxulator
48
#define	LINUX_DTRACE	linuxulator
46
49
47
#ifdef MALLOC_DECLARE
48
MALLOC_DECLARE(M_LINUX);
49
#endif
50
51
#define	LINUX_SHAREDPAGE	(VM_MAXUSER_ADDRESS - PAGE_SIZE)
50
#define	LINUX_SHAREDPAGE	(VM_MAXUSER_ADDRESS - PAGE_SIZE)
52
#define	LINUX_USRSTACK		LINUX_SHAREDPAGE
51
#define	LINUX_USRSTACK		LINUX_SHAREDPAGE
53
52
Lines 91-96 Link Here
91
typedef l_ushort	l_uid16_t;
90
typedef l_ushort	l_uid16_t;
92
typedef l_int		l_timer_t;
91
typedef l_int		l_timer_t;
93
typedef l_int		l_mqd_t;
92
typedef l_int		l_mqd_t;
93
typedef	l_ulong		l_fd_mask;
94
94
95
typedef struct {
95
typedef struct {
96
	l_int		val[2];
96
	l_int		val[2];
Lines 106-112 Link Here
106
/*
106
/*
107
 * Miscellaneous
107
 * Miscellaneous
108
 */
108
 */
109
#define LINUX_AT_COUNT		16	/* Count of used aux entry types.
109
#define LINUX_AT_COUNT		20	/* Count of used aux entry types.
110
					 * Keep this synchronized with
110
					 * Keep this synchronized with
111
					 * elf_linux_fixup() code.
111
					 * elf_linux_fixup() code.
112
					 */
112
					 */
Lines 235-282 Link Here
235
        l_int           f_spare[6];
235
        l_int           f_spare[6];
236
};
236
};
237
237
238
/*
239
 * Signalling
240
 */
241
#define	LINUX_SIGHUP		1
242
#define	LINUX_SIGINT		2
243
#define	LINUX_SIGQUIT		3
244
#define	LINUX_SIGILL		4
245
#define	LINUX_SIGTRAP		5
246
#define	LINUX_SIGABRT		6
247
#define	LINUX_SIGIOT		LINUX_SIGABRT
248
#define	LINUX_SIGBUS		7
249
#define	LINUX_SIGFPE		8
250
#define	LINUX_SIGKILL		9
251
#define	LINUX_SIGUSR1		10
252
#define	LINUX_SIGSEGV		11
253
#define	LINUX_SIGUSR2		12
254
#define	LINUX_SIGPIPE		13
255
#define	LINUX_SIGALRM		14
256
#define	LINUX_SIGTERM		15
257
#define	LINUX_SIGSTKFLT		16
258
#define	LINUX_SIGCHLD		17
259
#define	LINUX_SIGCONT		18
260
#define	LINUX_SIGSTOP		19
261
#define	LINUX_SIGTSTP		20
262
#define	LINUX_SIGTTIN		21
263
#define	LINUX_SIGTTOU		22
264
#define	LINUX_SIGURG		23
265
#define	LINUX_SIGXCPU		24
266
#define	LINUX_SIGXFSZ		25
267
#define	LINUX_SIGVTALRM		26
268
#define	LINUX_SIGPROF		27
269
#define	LINUX_SIGWINCH		28
270
#define	LINUX_SIGIO		29
271
#define	LINUX_SIGPOLL		LINUX_SIGIO
272
#define	LINUX_SIGPWR		30
273
#define	LINUX_SIGSYS		31
274
#define	LINUX_SIGRTMIN		32
275
276
#define	LINUX_SIGTBLSZ		31
277
#define	LINUX_NSIG_WORDS	2
238
#define	LINUX_NSIG_WORDS	2
278
#define	LINUX_NBPW		32
279
#define	LINUX_NSIG		(LINUX_NBPW * LINUX_NSIG_WORDS)
280
239
281
/* sigaction flags */
240
/* sigaction flags */
282
#define	LINUX_SA_NOCLDSTOP	0x00000001
241
#define	LINUX_SA_NOCLDSTOP	0x00000001
Lines 294-320 Link Here
294
#define	LINUX_SIG_UNBLOCK	1
253
#define	LINUX_SIG_UNBLOCK	1
295
#define	LINUX_SIG_SETMASK	2
254
#define	LINUX_SIG_SETMASK	2
296
255
297
/* sigset_t macros */
298
#define	LINUX_SIGEMPTYSET(set)		(set).__bits[0] = (set).__bits[1] = 0
299
#define	LINUX_SIGISMEMBER(set, sig)	SIGISMEMBER(set, sig)
300
#define	LINUX_SIGADDSET(set, sig)	SIGADDSET(set, sig)
301
302
/* sigaltstack */
256
/* sigaltstack */
303
#define	LINUX_MINSIGSTKSZ	2048
257
#define	LINUX_MINSIGSTKSZ	2048
304
#define	LINUX_SS_ONSTACK	1
305
#define	LINUX_SS_DISABLE	2
306
258
307
int linux_to_bsd_sigaltstack(int lsa);
308
int bsd_to_linux_sigaltstack(int bsa);
309
310
typedef void	(*l_handler_t)(l_int);
259
typedef void	(*l_handler_t)(l_int);
311
typedef l_ulong	l_osigset_t;
260
typedef l_ulong	l_osigset_t;
312
261
313
typedef struct {
262
typedef struct {
314
	l_uint	__bits[LINUX_NSIG_WORDS];
315
} l_sigset_t;
316
317
typedef struct {
318
	l_handler_t	lsa_handler;
263
	l_handler_t	lsa_handler;
319
	l_osigset_t	lsa_mask;
264
	l_osigset_t	lsa_mask;
320
	l_ulong		lsa_flags;
265
	l_ulong		lsa_flags;
Lines 497-546 Link Here
497
};
442
};
498
443
499
extern struct sysentvec linux_sysvec;
444
extern struct sysentvec linux_sysvec;
500
extern struct sysentvec elf_linux_sysvec;
501
445
502
/*
446
/*
503
 * open/fcntl flags
447
 * arch specific open/fcntl flags
504
 */
448
 */
505
#define	LINUX_O_RDONLY		00000000
506
#define	LINUX_O_WRONLY		00000001
507
#define	LINUX_O_RDWR		00000002
508
#define	LINUX_O_ACCMODE		00000003
509
#define	LINUX_O_CREAT		00000100
510
#define	LINUX_O_EXCL		00000200
511
#define	LINUX_O_NOCTTY		00000400
512
#define	LINUX_O_TRUNC		00001000
513
#define	LINUX_O_APPEND		00002000
514
#define	LINUX_O_NONBLOCK	00004000
515
#define	LINUX_O_NDELAY		LINUX_O_NONBLOCK
516
#define	LINUX_O_SYNC		00010000
517
#define	LINUX_FASYNC		00020000
518
#define	LINUX_O_DIRECT		00040000	/* Direct disk access hint */
519
#define	LINUX_O_LARGEFILE	00100000
520
#define	LINUX_O_DIRECTORY	00200000	/* Must be a directory */
521
#define	LINUX_O_NOFOLLOW	00400000	/* Do not follow links */
522
#define	LINUX_O_NOATIME		01000000
523
#define	LINUX_O_CLOEXEC		02000000
524
525
#define	LINUX_F_DUPFD		0
526
#define	LINUX_F_GETFD		1
527
#define	LINUX_F_SETFD		2
528
#define	LINUX_F_GETFL		3
529
#define	LINUX_F_SETFL		4
530
#define	LINUX_F_GETLK		5
531
#define	LINUX_F_SETLK		6
532
#define	LINUX_F_SETLKW		7
533
#define	LINUX_F_SETOWN		8
534
#define	LINUX_F_GETOWN		9
535
536
#define	LINUX_F_GETLK64		12
449
#define	LINUX_F_GETLK64		12
537
#define	LINUX_F_SETLK64		13
450
#define	LINUX_F_SETLK64		13
538
#define	LINUX_F_SETLKW64	14
451
#define	LINUX_F_SETLKW64	14
539
452
540
#define	LINUX_F_RDLCK		0
541
#define	LINUX_F_WRLCK		1
542
#define	LINUX_F_UNLCK		2
543
544
union l_semun {
453
union l_semun {
545
	l_int		val;
454
	l_int		val;
546
	struct l_semid_ds	*buf;
455
	struct l_semid_ds	*buf;
Lines 549-554 Link Here
549
	void		*__pad;
458
	void		*__pad;
550
};
459
};
551
460
461
struct l_ipc_perm {
462
	l_key_t		key;
463
	l_uid16_t	uid;
464
	l_gid16_t	gid;
465
	l_uid16_t	cuid;
466
	l_gid16_t	cgid;
467
	l_ushort	mode;
468
	l_ushort	seq;
469
};
470
552
/*
471
/*
553
 * Socket defines
472
 * Socket defines
554
 */
473
 */
Lines 585-606 Link Here
585
	char		sa_data[14];
504
	char		sa_data[14];
586
};
505
};
587
506
588
struct l_msghdr {
589
	l_uintptr_t	msg_name;
590
	l_int		msg_namelen;
591
	l_uintptr_t	msg_iov;
592
	l_size_t	msg_iovlen;
593
	l_uintptr_t	msg_control;
594
	l_size_t	msg_controllen;
595
	l_uint		msg_flags;
596
};
597
598
struct l_cmsghdr {
599
	l_size_t	cmsg_len;
600
	l_int		cmsg_level;
601
	l_int		cmsg_type;
602
};
603
604
struct l_ifmap {
507
struct l_ifmap {
605
	l_ulong		mem_start;
508
	l_ulong		mem_start;
606
	l_ulong		mem_end;
509
	l_ulong		mem_end;
(-)sys/i386/linux/linux_dummy.c (-20 lines)
Lines 65-71 Link Here
65
DUMMY(vm86);
65
DUMMY(vm86);
66
DUMMY(query_module);
66
DUMMY(query_module);
67
DUMMY(nfsservctl);
67
DUMMY(nfsservctl);
68
DUMMY(rt_sigqueueinfo);
69
DUMMY(sendfile);		/* different semantics */
68
DUMMY(sendfile);		/* different semantics */
70
DUMMY(setfsuid);
69
DUMMY(setfsuid);
71
DUMMY(setfsgid);
70
DUMMY(setfsgid);
Lines 72-80 Link Here
72
DUMMY(pivot_root);
71
DUMMY(pivot_root);
73
DUMMY(mincore);
72
DUMMY(mincore);
74
DUMMY(lookup_dcookie);
73
DUMMY(lookup_dcookie);
75
DUMMY(epoll_create);
76
DUMMY(epoll_ctl);
77
DUMMY(epoll_wait);
78
DUMMY(remap_file_pages);
74
DUMMY(remap_file_pages);
79
DUMMY(fstatfs64);
75
DUMMY(fstatfs64);
80
DUMMY(mbind);
76
DUMMY(mbind);
Lines 81-87 Link Here
81
DUMMY(get_mempolicy);
77
DUMMY(get_mempolicy);
82
DUMMY(set_mempolicy);
78
DUMMY(set_mempolicy);
83
DUMMY(kexec_load);
79
DUMMY(kexec_load);
84
DUMMY(waitid);
85
/* linux 2.6.11: */
80
/* linux 2.6.11: */
86
DUMMY(add_key);
81
DUMMY(add_key);
87
DUMMY(request_key);
82
DUMMY(request_key);
Lines 94-101 Link Here
94
DUMMY(inotify_rm_watch);
89
DUMMY(inotify_rm_watch);
95
/* linux 2.6.16: */
90
/* linux 2.6.16: */
96
DUMMY(migrate_pages);
91
DUMMY(migrate_pages);
97
DUMMY(pselect6);
98
DUMMY(ppoll);
99
DUMMY(unshare);
92
DUMMY(unshare);
100
/* linux 2.6.17: */
93
/* linux 2.6.17: */
101
DUMMY(splice);
94
DUMMY(splice);
Lines 106-127 Link Here
106
DUMMY(move_pages);
99
DUMMY(move_pages);
107
/* linux 2.6.19: */
100
/* linux 2.6.19: */
108
DUMMY(getcpu);
101
DUMMY(getcpu);
109
DUMMY(epoll_pwait);
110
/* linux 2.6.22: */
102
/* linux 2.6.22: */
111
DUMMY(utimensat);
112
DUMMY(signalfd);
103
DUMMY(signalfd);
113
DUMMY(timerfd_create);
104
DUMMY(timerfd_create);
114
DUMMY(eventfd);
115
/* linux 2.6.23: */
116
DUMMY(fallocate);
117
/* linux 2.6.25: */
105
/* linux 2.6.25: */
118
DUMMY(timerfd_settime);
106
DUMMY(timerfd_settime);
119
DUMMY(timerfd_gettime);
107
DUMMY(timerfd_gettime);
120
/* linux 2.6.27: */
108
/* linux 2.6.27: */
121
DUMMY(signalfd4);
109
DUMMY(signalfd4);
122
DUMMY(eventfd2);
123
DUMMY(epoll_create1);
124
DUMMY(dup3);
125
DUMMY(inotify_init1);
110
DUMMY(inotify_init1);
126
/* linux 2.6.30: */
111
/* linux 2.6.30: */
127
DUMMY(preadv);
112
DUMMY(preadv);
Lines 130-146 Link Here
130
DUMMY(rt_tsigqueueinfo);
115
DUMMY(rt_tsigqueueinfo);
131
DUMMY(perf_event_open);
116
DUMMY(perf_event_open);
132
/* linux 2.6.33: */
117
/* linux 2.6.33: */
133
DUMMY(recvmmsg);
134
DUMMY(fanotify_init);
118
DUMMY(fanotify_init);
135
DUMMY(fanotify_mark);
119
DUMMY(fanotify_mark);
136
/* linux 2.6.36: */
137
DUMMY(prlimit64);
138
/* later: */
120
/* later: */
139
DUMMY(name_to_handle_at);
121
DUMMY(name_to_handle_at);
140
DUMMY(open_by_handle_at);
122
DUMMY(open_by_handle_at);
141
DUMMY(clock_adjtime);
123
DUMMY(clock_adjtime);
142
DUMMY(syncfs);
143
DUMMY(sendmmsg);
144
DUMMY(setns);
124
DUMMY(setns);
145
DUMMY(process_vm_readv);
125
DUMMY(process_vm_readv);
146
DUMMY(process_vm_writev);
126
DUMMY(process_vm_writev);
(-)sys/i386/linux/linux_genassym.c (+3 lines)
Lines 6-11 Link Here
6
#include <sys/systm.h>
6
#include <sys/systm.h>
7
7
8
#include <i386/linux/linux.h>
8
#include <i386/linux/linux.h>
9
#include <compat/linux/linux_mib.h>
9
10
10
ASSYM(LINUX_SIGF_HANDLER, offsetof(struct l_sigframe, sf_handler));
11
ASSYM(LINUX_SIGF_HANDLER, offsetof(struct l_sigframe, sf_handler));
11
ASSYM(LINUX_SIGF_SC, offsetof(struct l_sigframe, sf_sc));
12
ASSYM(LINUX_SIGF_SC, offsetof(struct l_sigframe, sf_sc));
Lines 14-16 Link Here
14
ASSYM(LINUX_RT_SIGF_HANDLER, offsetof(struct l_rt_sigframe, sf_handler));
15
ASSYM(LINUX_RT_SIGF_HANDLER, offsetof(struct l_rt_sigframe, sf_handler));
15
ASSYM(LINUX_RT_SIGF_UC, offsetof(struct l_rt_sigframe, sf_sc));
16
ASSYM(LINUX_RT_SIGF_UC, offsetof(struct l_rt_sigframe, sf_sc));
16
ASSYM(LINUX_RT_SIGF_SC, offsetof(struct l_ucontext, uc_mcontext));
17
ASSYM(LINUX_RT_SIGF_SC, offsetof(struct l_ucontext, uc_mcontext));
18
ASSYM(LINUX_SC_ESP, offsetof(struct l_sigcontext, sc_esp));
19
ASSYM(LINUX_VERSION_CODE, LINUX_VERSION_CODE);
(-)sys/i386/linux/linux_locore.s (-20 / +132 lines)
Lines 5-37 Link Here
5
5
6
#include <i386/linux/linux_syscall.h>		/* system call numbers */
6
#include <i386/linux/linux_syscall.h>		/* system call numbers */
7
7
8
#include "assym.s"
9
10
/*
11
 * To avoid excess stack frame the signal trampoline code emulates
12
 * the 'call' instruction.
13
 */
8
NON_GPROF_ENTRY(linux_sigcode)
14
NON_GPROF_ENTRY(linux_sigcode)
9
	call	*LINUX_SIGF_HANDLER(%esp)
15
	movl	%esp, %ebx			/* preserve sigframe */
10
	leal	LINUX_SIGF_SC(%esp),%ebx	/* linux scp */
16
	call .getip0
11
	mov	LINUX_SC_GS(%ebx),%gs
17
.getip0:
12
	movl	%esp, %ebx			/* pass sigframe */
18
	popl	%eax
13
	push	%eax				/* fake ret addr */
19
	add	$.startsigcode-.getip0, %eax	/* ret address */
20
	push	%eax
21
	jmp	*LINUX_SIGF_HANDLER(%ebx)
22
.startsigcode:
23
	popl	%eax				/* gcc unwind code need this */
14
	movl	$LINUX_SYS_linux_sigreturn,%eax	/* linux_sigreturn() */
24
	movl	$LINUX_SYS_linux_sigreturn,%eax	/* linux_sigreturn() */
15
	int	$0x80				/* enter kernel with args */
25
	int	$0x80				/* enter kernel with args */
26
.endsigcode:
16
0:	jmp	0b
27
0:	jmp	0b
17
	ALIGN_TEXT
28
18
/* XXXXX */
29
NON_GPROF_ENTRY(linux_rt_sigcode)
19
linux_rt_sigcode:
20
	call	*LINUX_RT_SIGF_HANDLER(%esp)
21
	leal	LINUX_RT_SIGF_UC(%esp),%ebx	/* linux ucp */
30
	leal	LINUX_RT_SIGF_UC(%esp),%ebx	/* linux ucp */
22
	leal	LINUX_RT_SIGF_SC(%ebx),%ecx	/* linux sigcontext */
31
	leal	LINUX_RT_SIGF_SC(%ebx),%ecx	/* linux sigcontext */
23
	mov	LINUX_SC_GS(%ecx),%gs
32
	movl	%esp, %edi
24
	push	%eax				/* fake ret addr */
33
	call	.getip1
34
.getip1:
35
	popl	%eax
36
	add	$.startrtsigcode-.getip1, %eax	/* ret address */
37
	push	%eax
38
	jmp	*LINUX_RT_SIGF_HANDLER(%edi)
39
.startrtsigcode:
25
	movl	$LINUX_SYS_linux_rt_sigreturn,%eax   /* linux_rt_sigreturn() */
40
	movl	$LINUX_SYS_linux_rt_sigreturn,%eax   /* linux_rt_sigreturn() */
26
	int	$0x80				/* enter kernel with args */
41
	int	$0x80				/* enter kernel with args */
42
.endrtsigcode:
27
0:	jmp	0b
43
0:	jmp	0b
28
	ALIGN_TEXT
29
/* XXXXX */
30
linux_esigcode:
31
44
32
	.data
45
NON_GPROF_ENTRY(linux_vsyscall)
33
	.globl	linux_szsigcode, linux_sznonrtsigcode
46
.startvsyscall:
34
linux_szsigcode:
47
	int $0x80
35
	.long	linux_esigcode-linux_sigcode
48
	ret
36
linux_sznonrtsigcode:
49
.endvsyscall:
37
	.long	linux_rt_sigcode-linux_sigcode
50
51
#if 0
52
	.section .note.Linux, "a",@note
53
	.long 2f - 1f		/* namesz */
54
	.balign 4
55
	.long 4f - 3f		/* descsz */
56
	.long 0
57
1:
58
	.asciz "Linux"
59
2:
60
	.balign 4
61
3:
62
	.long LINUX_VERSION_CODE
63
4:
64
	.balign 4
65
	.previous
66
#endif
67
68
#define do_cfa_expr(offset)                                             \
69
	.byte 0x0f;			/* DW_CFA_def_cfa_expression */ \
70
	.uleb128 11f-10f;		/*   length */                  \
71
10:	.byte 0x74;			/*     DW_OP_breg4 */           \
72
	.sleb128 offset;		/*      offset */               \
73
	.byte 0x06;			/*     DW_OP_deref */           \
74
11:
75
76
77
	/* CIE */
78
	.section .eh_frame,"a",@progbits
79
.LSTARTFRAMEDLSI1:
80
	.long .LENDCIEDLSI1-.LSTARTCIEDLSI1
81
.LSTARTCIEDLSI1:
82
	.long 0					/* CIE ID */
83
	.byte 1					/* Version number */
84
	.string "zRS"				/* NULL-terminated
85
						 * augmentation string
86
						 */
87
	.uleb128 1				/* Code alignment factor */
88
	.sleb128 -4				/* Data alignment factor */
89
	.byte 8					/* Return address
90
						 * register column
91
						 */
92
	.uleb128 1				/* Augmentation value length */
93
	.byte 0x1b				/* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
94
	.byte 0					/* DW_CFA_nop */
95
	.align 4
96
.LENDCIEDLSI1:
97
98
	/* FDE */
99
	.long .LENDFDEDLSI1-.LSTARTFDEDLSI1	/* Length FDE */
100
.LSTARTFDEDLSI1:
101
	.long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */
102
	.long .startsigcode-.			/* PC-relative start address */
103
	.long .endsigcode-.startsigcode
104
	.uleb128 0				/* Augmentation */
105
	do_cfa_expr(LINUX_SIGF_SC-8)
106
	.align 4
107
.LENDFDEDLSI1:
108
109
	.long .LENDFDEDLSI2-.LSTARTFDEDLSI2	/* Length FDE */
110
.LSTARTFDEDLSI2:
111
	.long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1	/* CIE pointer */
112
	.long .startrtsigcode-.			/* PC-relative start address */
113
	.long .endrtsigcode-.startrtsigcode
114
	.uleb128 0				/* Augmentation */
115
	do_cfa_expr(LINUX_RT_SIGF_SC-4+LINUX_SC_ESP)
116
	.align 4
117
.LENDFDEDLSI2:
118
	.previous
119
120
	.section .eh_frame,"a",@progbits
121
.LSTARTFRAMEDLSI2:
122
	.long .LENDCIEDLSI2-.LSTARTCIEDLSI2
123
.LSTARTCIEDLSI2:
124
	.long 0					/* CIE ID */
125
	.byte 1					/* Version number */
126
	.string "zR"				/* NULL-terminated
127
						 * augmentation string
128
						 */
129
	.uleb128 1				/* Code alignment factor */
130
	.sleb128 -4				/* Data alignment factor */
131
	.byte 8					/* Return address register column */
132
	.uleb128 1				/* Augmentation value length */
133
	.byte 0x1b				/* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
134
	.byte 0x0c				/* DW_CFA_def_cfa */
135
	.uleb128 4
136
	.uleb128 4
137
	.byte 0x88				/* DW_CFA_offset, column 0x8 */
138
	.uleb128 1
139
	.align 4
140
.LENDCIEDLSI2:
141
	.long .LENDFDEDLSI3-.LSTARTFDEDLSI3 /* Length FDE */
142
.LSTARTFDEDLSI3:
143
	.long .LSTARTFDEDLSI3-.LSTARTFRAMEDLSI2 /* CIE pointer */
144
	.long .startvsyscall-.			/* PC-relative start address */
145
	.long .endvsyscall-.startvsyscall
146
	.uleb128 0
147
	.align 4
148
.LENDFDEDLSI3:
149
	.previous
(-)sys/i386/linux/linux_machdep.c (-48 / +78 lines)
Lines 99-133 Link Here
99
		    l_size_t len, l_int prot, l_int flags, l_int fd,
99
		    l_size_t len, l_int prot, l_int flags, l_int fd,
100
		    l_loff_t pos);
100
		    l_loff_t pos);
101
101
102
int
103
linux_to_bsd_sigaltstack(int lsa)
104
{
105
	int bsa = 0;
106
102
107
	if (lsa & LINUX_SS_DISABLE)
108
		bsa |= SS_DISABLE;
109
	if (lsa & LINUX_SS_ONSTACK)
110
		bsa |= SS_ONSTACK;
111
	return (bsa);
112
}
113
114
int
103
int
115
bsd_to_linux_sigaltstack(int bsa)
116
{
117
	int lsa = 0;
118
119
	if (bsa & SS_DISABLE)
120
		lsa |= LINUX_SS_DISABLE;
121
	if (bsa & SS_ONSTACK)
122
		lsa |= LINUX_SS_ONSTACK;
123
	return (lsa);
124
}
125
126
int
127
linux_execve(struct thread *td, struct linux_execve_args *args)
104
linux_execve(struct thread *td, struct linux_execve_args *args)
128
{
105
{
129
	struct image_args eargs;
106
	struct image_args eargs;
130
	struct vmspace *oldvmspace;
131
	char *newpath;
107
	char *newpath;
132
	int error;
108
	int error;
133
109
Lines 138-163 Link Here
138
		printf(ARGS(execve, "%s"), newpath);
114
		printf(ARGS(execve, "%s"), newpath);
139
#endif
115
#endif
140
116
141
	error = pre_execve(td, &oldvmspace);
142
	if (error != 0) {
143
		free(newpath, M_TEMP);
144
		return (error);
145
	}
146
	error = exec_copyin_args(&eargs, newpath, UIO_SYSSPACE,
117
	error = exec_copyin_args(&eargs, newpath, UIO_SYSSPACE,
147
	    args->argp, args->envp);
118
	    args->argp, args->envp);
148
	free(newpath, M_TEMP);
119
	free(newpath, M_TEMP);
149
	if (error == 0)
120
	if (error == 0)
150
		error = kern_execve(td, &eargs, NULL);
121
		error = linux_common_execve(td, &eargs);
151
	if (error == 0) {
152
	   	/* linux process can exec fbsd one, dont attempt
153
		 * to create emuldata for such process using
154
		 * linux_proc_init, this leads to a panic on KASSERT
155
		 * because such process has p->p_emuldata == NULL
156
		 */
157
		if (SV_PROC_ABI(td->td_proc) == SV_ABI_LINUX)
158
   			error = linux_proc_init(td, 0, 0);
159
	}
160
	post_execve(td, error, oldvmspace);
161
	return (error);
122
	return (error);
162
}
123
}
163
124
Lines 368-375 Link Here
368
linux_set_upcall_kse(struct thread *td, register_t stack)
329
linux_set_upcall_kse(struct thread *td, register_t stack)
369
{
330
{
370
331
371
	td->td_frame->tf_esp = stack;
332
	if (stack)
333
		td->td_frame->tf_esp = stack;
372
334
335
	/*
336
	 * The newly created Linux thread returns
337
	 * to the user space by the same path that a parent do.
338
	 */
339
	td->td_frame->tf_eax = 0;
373
	return (0);
340
	return (0);
374
}
341
}
375
342
Lines 710-716 Link Here
710
		act.lsa_flags = osa.lsa_flags;
677
		act.lsa_flags = osa.lsa_flags;
711
		act.lsa_restorer = osa.lsa_restorer;
678
		act.lsa_restorer = osa.lsa_restorer;
712
		LINUX_SIGEMPTYSET(act.lsa_mask);
679
		LINUX_SIGEMPTYSET(act.lsa_mask);
713
		act.lsa_mask.__bits[0] = osa.lsa_mask;
680
		act.lsa_mask.__mask = osa.lsa_mask;
714
	}
681
	}
715
682
716
	error = linux_do_sigaction(td, args->sig, args->nsa ? &act : NULL,
683
	error = linux_do_sigaction(td, args->sig, args->nsa ? &act : NULL,
Lines 720-726 Link Here
720
		osa.lsa_handler = oact.lsa_handler;
687
		osa.lsa_handler = oact.lsa_handler;
721
		osa.lsa_flags = oact.lsa_flags;
688
		osa.lsa_flags = oact.lsa_flags;
722
		osa.lsa_restorer = oact.lsa_restorer;
689
		osa.lsa_restorer = oact.lsa_restorer;
723
		osa.lsa_mask = oact.lsa_mask.__bits[0];
690
		osa.lsa_mask = oact.lsa_mask.__mask;
724
		error = copyout(&osa, args->osa, sizeof(l_osigaction_t));
691
		error = copyout(&osa, args->osa, sizeof(l_osigaction_t));
725
	}
692
	}
726
693
Lines 744-750 Link Here
744
#endif
711
#endif
745
712
746
	LINUX_SIGEMPTYSET(mask);
713
	LINUX_SIGEMPTYSET(mask);
747
	mask.__bits[0] = args->mask;
714
	mask.__mask = args->mask;
748
	linux_to_bsd_sigset(&mask, &sigmask);
715
	linux_to_bsd_sigset(&mask, &sigmask);
749
	return (kern_sigsuspend(td, sigmask));
716
	return (kern_sigsuspend(td, sigmask));
750
}
717
}
Lines 1061-1071 Link Here
1061
		    args->pid, (void *)args->status, args->options,
1028
		    args->pid, (void *)args->status, args->options,
1062
		    (void *)args->rusage);
1029
		    (void *)args->rusage);
1063
#endif
1030
#endif
1031
	if (args->options & ~(LINUX_WUNTRACED | LINUX_WNOHANG |
1032
	    LINUX_WCONTINUED | __WCLONE | __WNOTHREAD | __WALL))
1033
		return (EINVAL);
1064
1034
1065
	options = (args->options & (WNOHANG | WUNTRACED));
1035
	options = WEXITED;
1066
	/* WLINUXCLONE should be equal to __WCLONE, but we make sure */
1036
	linux_to_bsd_waitopts(args->options, &options);
1067
	if (args->options & __WCLONE)
1068
		options |= WLINUXCLONE;
1069
1037
1070
	if (args->rusage != NULL)
1038
	if (args->rusage != NULL)
1071
		rup = &ru;
1039
		rup = &ru;
Lines 1079-1081 Link Here
1079
1047
1080
	return (error);
1048
	return (error);
1081
}
1049
}
1050
1051
int
1052
linux_waitid(struct thread *td, struct linux_waitid_args *args)
1053
{
1054
	int status, options, sig;
1055
	struct __wrusage wru;
1056
	siginfo_t siginfo;
1057
	l_siginfo_t lsi;
1058
	idtype_t idtype;
1059
	struct proc *p;
1060
	int error;
1061
1062
	options = 0;
1063
	linux_to_bsd_waitopts(args->options, &options);
1064
1065
	if (options & ~(WNOHANG | WNOWAIT | WEXITED | WUNTRACED | WCONTINUED))
1066
		return (EINVAL);
1067
	if (!(options & (WEXITED | WUNTRACED | WCONTINUED)))
1068
		return (EINVAL);
1069
1070
	switch (args->idtype) {
1071
	case LINUX_P_ALL:
1072
		idtype = P_ALL;
1073
		break;
1074
	case LINUX_P_PID:
1075
		if (args->id <= 0)
1076
			return (EINVAL);
1077
		idtype = P_PID;
1078
		break;
1079
	case LINUX_P_PGID:
1080
		if (args->id <= 0)
1081
			return (EINVAL);
1082
		idtype = P_PGID;
1083
		break;
1084
	default:
1085
		return (EINVAL);
1086
	}
1087
1088
	error = kern_wait6(td, idtype, args->id, &status, options,
1089
	    &wru, &siginfo);
1090
	if (error)
1091
		return (error);
1092
	if (args->rusage != NULL) {
1093
		error = copyout(&wru.wru_children, args->rusage,
1094
		    sizeof(wru.wru_children));
1095
		if (error)
1096
			return (error);
1097
	}
1098
	if (args->info != NULL) {
1099
		p = td->td_proc;
1100
		if (td->td_retval[0] == 0)
1101
			bzero(&lsi, sizeof(lsi));
1102
		else {
1103
			sig = bsd_to_linux_signal(siginfo.si_signo);
1104
			siginfo_to_lsiginfo(&siginfo, &lsi, sig);
1105
		}
1106
		error = copyout(&lsi, args->info, sizeof(lsi));
1107
	}
1108
	td->td_retval[0] = 0;
1109
1110
	return (error);
1111
}
(-)sys/i386/linux/linux_proto.h (-24 / +90 lines)
Lines 35-40 Link Here
35
#endif
35
#endif
36
36
37
#define	nosys	linux_nosys
37
#define	nosys	linux_nosys
38
struct linux_exit_args {
39
	char rval_l_[PADL_(int)]; int rval; char rval_r_[PADR_(int)];
40
};
38
struct linux_fork_args {
41
struct linux_fork_args {
39
	register_t dummy;
42
	register_t dummy;
40
};
43
};
Lines 473-478 Link Here
473
struct linux_sysctl_args {
476
struct linux_sysctl_args {
474
	char args_l_[PADL_(struct l___sysctl_args *)]; struct l___sysctl_args * args; char args_r_[PADR_(struct l___sysctl_args *)];
477
	char args_l_[PADL_(struct l___sysctl_args *)]; struct l___sysctl_args * args; char args_r_[PADR_(struct l___sysctl_args *)];
475
};
478
};
479
struct linux_sched_setparam_args {
480
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
481
	char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
482
};
483
struct linux_sched_getparam_args {
484
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
485
	char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)];
486
};
476
struct linux_sched_setscheduler_args {
487
struct linux_sched_setscheduler_args {
477
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
488
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
478
	char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)];
489
	char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)];
Lines 487-492 Link Here
487
struct linux_sched_get_priority_min_args {
498
struct linux_sched_get_priority_min_args {
488
	char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)];
499
	char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)];
489
};
500
};
501
struct linux_sched_rr_get_interval_args {
502
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
503
	char interval_l_[PADL_(struct l_timespec *)]; struct l_timespec * interval; char interval_r_[PADR_(struct l_timespec *)];
504
};
490
struct linux_nanosleep_args {
505
struct linux_nanosleep_args {
491
	char rqtp_l_[PADL_(const struct l_timespec *)]; const struct l_timespec * rqtp; char rqtp_r_[PADR_(const struct l_timespec *)];
506
	char rqtp_l_[PADL_(const struct l_timespec *)]; const struct l_timespec * rqtp; char rqtp_r_[PADR_(const struct l_timespec *)];
492
	char rmtp_l_[PADL_(struct l_timespec *)]; struct l_timespec * rmtp; char rmtp_r_[PADR_(struct l_timespec *)];
507
	char rmtp_l_[PADL_(struct l_timespec *)]; struct l_timespec * rmtp; char rmtp_r_[PADR_(struct l_timespec *)];
Lines 560-566 Link Here
560
	char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)];
575
	char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)];
561
};
576
};
562
struct linux_rt_sigqueueinfo_args {
577
struct linux_rt_sigqueueinfo_args {
563
	register_t dummy;
578
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
579
	char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)];
580
	char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char info_r_[PADR_(l_siginfo_t *)];
564
};
581
};
565
struct linux_rt_sigsuspend_args {
582
struct linux_rt_sigsuspend_args {
566
	char newset_l_[PADL_(l_sigset_t *)]; l_sigset_t * newset; char newset_r_[PADR_(l_sigset_t *)];
583
	char newset_l_[PADL_(l_sigset_t *)]; l_sigset_t * newset; char newset_r_[PADR_(l_sigset_t *)];
Lines 766-778 Link Here
766
	register_t dummy;
783
	register_t dummy;
767
};
784
};
768
struct linux_epoll_create_args {
785
struct linux_epoll_create_args {
769
	register_t dummy;
786
	char size_l_[PADL_(l_int)]; l_int size; char size_r_[PADR_(l_int)];
770
};
787
};
771
struct linux_epoll_ctl_args {
788
struct linux_epoll_ctl_args {
772
	register_t dummy;
789
	char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)];
790
	char op_l_[PADL_(l_int)]; l_int op; char op_r_[PADR_(l_int)];
791
	char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
792
	char event_l_[PADL_(struct epoll_event *)]; struct epoll_event * event; char event_r_[PADR_(struct epoll_event *)];
773
};
793
};
774
struct linux_epoll_wait_args {
794
struct linux_epoll_wait_args {
775
	register_t dummy;
795
	char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)];
796
	char events_l_[PADL_(struct epoll_event *)]; struct epoll_event * events; char events_r_[PADR_(struct epoll_event *)];
797
	char maxevents_l_[PADL_(l_int)]; l_int maxevents; char maxevents_r_[PADR_(l_int)];
798
	char timeout_l_[PADL_(l_int)]; l_int timeout; char timeout_r_[PADR_(l_int)];
776
};
799
};
777
struct linux_remap_file_pages_args {
800
struct linux_remap_file_pages_args {
778
	register_t dummy;
801
	register_t dummy;
Lines 887-893 Link Here
887
	register_t dummy;
910
	register_t dummy;
888
};
911
};
889
struct linux_waitid_args {
912
struct linux_waitid_args {
890
	register_t dummy;
913
	char idtype_l_[PADL_(int)]; int idtype; char idtype_r_[PADR_(int)];
914
	char id_l_[PADL_(l_pid_t)]; l_pid_t id; char id_r_[PADR_(l_pid_t)];
915
	char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char info_r_[PADR_(l_siginfo_t *)];
916
	char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)];
917
	char rusage_l_[PADL_(struct l_rusage *)]; struct l_rusage * rusage; char rusage_r_[PADR_(struct l_rusage *)];
891
};
918
};
892
struct linux_add_key_args {
919
struct linux_add_key_args {
893
	register_t dummy;
920
	register_t dummy;
Lines 989-1001 Link Here
989
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
1016
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
990
	char filename_l_[PADL_(const char *)]; const char * filename; char filename_r_[PADR_(const char *)];
1017
	char filename_l_[PADL_(const char *)]; const char * filename; char filename_r_[PADR_(const char *)];
991
	char amode_l_[PADL_(l_int)]; l_int amode; char amode_r_[PADR_(l_int)];
1018
	char amode_l_[PADL_(l_int)]; l_int amode; char amode_r_[PADR_(l_int)];
992
	char flag_l_[PADL_(l_int)]; l_int flag; char flag_r_[PADR_(l_int)];
993
};
1019
};
994
struct linux_pselect6_args {
1020
struct linux_pselect6_args {
995
	register_t dummy;
1021
	char nfds_l_[PADL_(l_int)]; l_int nfds; char nfds_r_[PADR_(l_int)];
1022
	char readfds_l_[PADL_(l_fd_set *)]; l_fd_set * readfds; char readfds_r_[PADR_(l_fd_set *)];
1023
	char writefds_l_[PADL_(l_fd_set *)]; l_fd_set * writefds; char writefds_r_[PADR_(l_fd_set *)];
1024
	char exceptfds_l_[PADL_(l_fd_set *)]; l_fd_set * exceptfds; char exceptfds_r_[PADR_(l_fd_set *)];
1025
	char tsp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tsp; char tsp_r_[PADR_(struct l_timespec *)];
1026
	char sig_l_[PADL_(l_uintptr_t *)]; l_uintptr_t * sig; char sig_r_[PADR_(l_uintptr_t *)];
996
};
1027
};
997
struct linux_ppoll_args {
1028
struct linux_ppoll_args {
998
	register_t dummy;
1029
	char fds_l_[PADL_(struct pollfd *)]; struct pollfd * fds; char fds_r_[PADR_(struct pollfd *)];
1030
	char nfds_l_[PADL_(uint32_t)]; uint32_t nfds; char nfds_r_[PADR_(uint32_t)];
1031
	char tsp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tsp; char tsp_r_[PADR_(struct l_timespec *)];
1032
	char sset_l_[PADL_(l_sigset_t *)]; l_sigset_t * sset; char sset_r_[PADR_(l_sigset_t *)];
1033
	char ssize_l_[PADL_(l_size_t)]; l_size_t ssize; char ssize_r_[PADR_(l_size_t)];
999
};
1034
};
1000
struct linux_unshare_args {
1035
struct linux_unshare_args {
1001
	register_t dummy;
1036
	register_t dummy;
Lines 1028-1037 Link Here
1028
	register_t dummy;
1063
	register_t dummy;
1029
};
1064
};
1030
struct linux_epoll_pwait_args {
1065
struct linux_epoll_pwait_args {
1031
	register_t dummy;
1066
	char epfd_l_[PADL_(l_int)]; l_int epfd; char epfd_r_[PADR_(l_int)];
1067
	char events_l_[PADL_(struct epoll_event *)]; struct epoll_event * events; char events_r_[PADR_(struct epoll_event *)];
1068
	char maxevents_l_[PADL_(l_int)]; l_int maxevents; char maxevents_r_[PADR_(l_int)];
1069
	char timeout_l_[PADL_(l_int)]; l_int timeout; char timeout_r_[PADR_(l_int)];
1070
	char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char mask_r_[PADR_(l_sigset_t *)];
1032
};
1071
};
1033
struct linux_utimensat_args {
1072
struct linux_utimensat_args {
1034
	register_t dummy;
1073
	char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
1074
	char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)];
1075
	char times_l_[PADL_(const struct l_timespec *)]; const struct l_timespec * times; char times_r_[PADR_(const struct l_timespec *)];
1076
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
1035
};
1077
};
1036
struct linux_signalfd_args {
1078
struct linux_signalfd_args {
1037
	register_t dummy;
1079
	register_t dummy;
Lines 1040-1049 Link Here
1040
	register_t dummy;
1082
	register_t dummy;
1041
};
1083
};
1042
struct linux_eventfd_args {
1084
struct linux_eventfd_args {
1043
	register_t dummy;
1085
	char initval_l_[PADL_(l_uint)]; l_uint initval; char initval_r_[PADR_(l_uint)];
1044
};
1086
};
1045
struct linux_fallocate_args {
1087
struct linux_fallocate_args {
1046
	register_t dummy;
1088
	char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
1089
	char mode_l_[PADL_(l_int)]; l_int mode; char mode_r_[PADR_(l_int)];
1090
	char offset_l_[PADL_(l_loff_t)]; l_loff_t offset; char offset_r_[PADR_(l_loff_t)];
1091
	char len_l_[PADL_(l_loff_t)]; l_loff_t len; char len_r_[PADR_(l_loff_t)];
1047
};
1092
};
1048
struct linux_timerfd_settime_args {
1093
struct linux_timerfd_settime_args {
1049
	register_t dummy;
1094
	register_t dummy;
Lines 1055-1067 Link Here
1055
	register_t dummy;
1100
	register_t dummy;
1056
};
1101
};
1057
struct linux_eventfd2_args {
1102
struct linux_eventfd2_args {
1058
	register_t dummy;
1103
	char initval_l_[PADL_(l_uint)]; l_uint initval; char initval_r_[PADR_(l_uint)];
1104
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
1059
};
1105
};
1060
struct linux_epoll_create1_args {
1106
struct linux_epoll_create1_args {
1061
	register_t dummy;
1107
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
1062
};
1108
};
1063
struct linux_dup3_args {
1109
struct linux_dup3_args {
1064
	register_t dummy;
1110
	char oldfd_l_[PADL_(l_int)]; l_int oldfd; char oldfd_r_[PADR_(l_int)];
1111
	char newfd_l_[PADL_(l_int)]; l_int newfd; char newfd_r_[PADR_(l_int)];
1112
	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
1065
};
1113
};
1066
struct linux_pipe2_args {
1114
struct linux_pipe2_args {
1067
	char pipefds_l_[PADL_(l_int *)]; l_int * pipefds; char pipefds_r_[PADR_(l_int *)];
1115
	char pipefds_l_[PADL_(l_int *)]; l_int * pipefds; char pipefds_r_[PADR_(l_int *)];
Lines 1083-1089 Link Here
1083
	register_t dummy;
1131
	register_t dummy;
1084
};
1132
};
1085
struct linux_recvmmsg_args {
1133
struct linux_recvmmsg_args {
1086
	register_t dummy;
1134
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
1135
	char msg_l_[PADL_(struct l_mmsghdr *)]; struct l_mmsghdr * msg; char msg_r_[PADR_(struct l_mmsghdr *)];
1136
	char vlen_l_[PADL_(l_uint)]; l_uint vlen; char vlen_r_[PADR_(l_uint)];
1137
	char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)];
1138
	char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)];
1087
};
1139
};
1088
struct linux_fanotify_init_args {
1140
struct linux_fanotify_init_args {
1089
	register_t dummy;
1141
	register_t dummy;
Lines 1092-1098 Link Here
1092
	register_t dummy;
1144
	register_t dummy;
1093
};
1145
};
1094
struct linux_prlimit64_args {
1146
struct linux_prlimit64_args {
1095
	register_t dummy;
1147
	char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)];
1148
	char resource_l_[PADL_(l_uint)]; l_uint resource; char resource_r_[PADR_(l_uint)];
1149
	char new_l_[PADL_(struct rlimit *)]; struct rlimit * new; char new_r_[PADR_(struct rlimit *)];
1150
	char old_l_[PADL_(struct rlimit *)]; struct rlimit * old; char old_r_[PADR_(struct rlimit *)];
1096
};
1151
};
1097
struct linux_name_to_handle_at_args {
1152
struct linux_name_to_handle_at_args {
1098
	register_t dummy;
1153
	register_t dummy;
Lines 1104-1113 Link Here
1104
	register_t dummy;
1159
	register_t dummy;
1105
};
1160
};
1106
struct linux_syncfs_args {
1161
struct linux_syncfs_args {
1107
	register_t dummy;
1162
	char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
1108
};
1163
};
1109
struct linux_sendmmsg_args {
1164
struct linux_sendmmsg_args {
1110
	register_t dummy;
1165
	char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)];
1166
	char msg_l_[PADL_(struct l_mmsghdr *)]; struct l_mmsghdr * msg; char msg_r_[PADR_(struct l_mmsghdr *)];
1167
	char vlen_l_[PADL_(l_uint)]; l_uint vlen; char vlen_r_[PADR_(l_uint)];
1168
	char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)];
1111
};
1169
};
1112
struct linux_setns_args {
1170
struct linux_setns_args {
1113
	register_t dummy;
1171
	register_t dummy;
Lines 1119-1124 Link Here
1119
	register_t dummy;
1177
	register_t dummy;
1120
};
1178
};
1121
#define	nosys	linux_nosys
1179
#define	nosys	linux_nosys
1180
int	linux_exit(struct thread *, struct linux_exit_args *);
1122
int	linux_fork(struct thread *, struct linux_fork_args *);
1181
int	linux_fork(struct thread *, struct linux_fork_args *);
1123
int	linux_open(struct thread *, struct linux_open_args *);
1182
int	linux_open(struct thread *, struct linux_open_args *);
1124
int	linux_waitpid(struct thread *, struct linux_waitpid_args *);
1183
int	linux_waitpid(struct thread *, struct linux_waitpid_args *);
Lines 1230-1239 Link Here
1230
int	linux_getsid(struct thread *, struct linux_getsid_args *);
1289
int	linux_getsid(struct thread *, struct linux_getsid_args *);
1231
int	linux_fdatasync(struct thread *, struct linux_fdatasync_args *);
1290
int	linux_fdatasync(struct thread *, struct linux_fdatasync_args *);
1232
int	linux_sysctl(struct thread *, struct linux_sysctl_args *);
1291
int	linux_sysctl(struct thread *, struct linux_sysctl_args *);
1292
int	linux_sched_setparam(struct thread *, struct linux_sched_setparam_args *);
1293
int	linux_sched_getparam(struct thread *, struct linux_sched_getparam_args *);
1233
int	linux_sched_setscheduler(struct thread *, struct linux_sched_setscheduler_args *);
1294
int	linux_sched_setscheduler(struct thread *, struct linux_sched_setscheduler_args *);
1234
int	linux_sched_getscheduler(struct thread *, struct linux_sched_getscheduler_args *);
1295
int	linux_sched_getscheduler(struct thread *, struct linux_sched_getscheduler_args *);
1235
int	linux_sched_get_priority_max(struct thread *, struct linux_sched_get_priority_max_args *);
1296
int	linux_sched_get_priority_max(struct thread *, struct linux_sched_get_priority_max_args *);
1236
int	linux_sched_get_priority_min(struct thread *, struct linux_sched_get_priority_min_args *);
1297
int	linux_sched_get_priority_min(struct thread *, struct linux_sched_get_priority_min_args *);
1298
int	linux_sched_rr_get_interval(struct thread *, struct linux_sched_rr_get_interval_args *);
1237
int	linux_nanosleep(struct thread *, struct linux_nanosleep_args *);
1299
int	linux_nanosleep(struct thread *, struct linux_nanosleep_args *);
1238
int	linux_mremap(struct thread *, struct linux_mremap_args *);
1300
int	linux_mremap(struct thread *, struct linux_mremap_args *);
1239
int	linux_setresuid16(struct thread *, struct linux_setresuid16_args *);
1301
int	linux_setresuid16(struct thread *, struct linux_setresuid16_args *);
Lines 1422-1427 Link Here
1422
1484
1423
#endif /* COMPAT_FREEBSD7 */
1485
#endif /* COMPAT_FREEBSD7 */
1424
1486
1487
#define	LINUX_SYS_AUE_linux_exit	AUE_EXIT
1425
#define	LINUX_SYS_AUE_linux_fork	AUE_FORK
1488
#define	LINUX_SYS_AUE_linux_fork	AUE_FORK
1426
#define	LINUX_SYS_AUE_linux_open	AUE_OPEN_RWTC
1489
#define	LINUX_SYS_AUE_linux_open	AUE_OPEN_RWTC
1427
#define	LINUX_SYS_AUE_linux_waitpid	AUE_WAIT4
1490
#define	LINUX_SYS_AUE_linux_waitpid	AUE_WAIT4
Lines 1533-1542 Link Here
1533
#define	LINUX_SYS_AUE_linux_getsid	AUE_GETSID
1596
#define	LINUX_SYS_AUE_linux_getsid	AUE_GETSID
1534
#define	LINUX_SYS_AUE_linux_fdatasync	AUE_NULL
1597
#define	LINUX_SYS_AUE_linux_fdatasync	AUE_NULL
1535
#define	LINUX_SYS_AUE_linux_sysctl	AUE_SYSCTL
1598
#define	LINUX_SYS_AUE_linux_sysctl	AUE_SYSCTL
1599
#define	LINUX_SYS_AUE_linux_sched_setparam	AUE_SCHED_SETPARAM
1600
#define	LINUX_SYS_AUE_linux_sched_getparam	AUE_SCHED_GETPARAM
1536
#define	LINUX_SYS_AUE_linux_sched_setscheduler	AUE_SCHED_SETSCHEDULER
1601
#define	LINUX_SYS_AUE_linux_sched_setscheduler	AUE_SCHED_SETSCHEDULER
1537
#define	LINUX_SYS_AUE_linux_sched_getscheduler	AUE_SCHED_GETSCHEDULER
1602
#define	LINUX_SYS_AUE_linux_sched_getscheduler	AUE_SCHED_GETSCHEDULER
1538
#define	LINUX_SYS_AUE_linux_sched_get_priority_max	AUE_SCHED_GET_PRIORITY_MAX
1603
#define	LINUX_SYS_AUE_linux_sched_get_priority_max	AUE_SCHED_GET_PRIORITY_MAX
1539
#define	LINUX_SYS_AUE_linux_sched_get_priority_min	AUE_SCHED_GET_PRIORITY_MIN
1604
#define	LINUX_SYS_AUE_linux_sched_get_priority_min	AUE_SCHED_GET_PRIORITY_MIN
1605
#define	LINUX_SYS_AUE_linux_sched_rr_get_interval	AUE_SCHED_RR_GET_INTERVAL
1540
#define	LINUX_SYS_AUE_linux_nanosleep	AUE_NULL
1606
#define	LINUX_SYS_AUE_linux_nanosleep	AUE_NULL
1541
#define	LINUX_SYS_AUE_linux_mremap	AUE_NULL
1607
#define	LINUX_SYS_AUE_linux_mremap	AUE_NULL
1542
#define	LINUX_SYS_AUE_linux_setresuid16	AUE_SETRESUID
1608
#define	LINUX_SYS_AUE_linux_setresuid16	AUE_SETRESUID
Lines 1633-1639 Link Here
1633
#define	LINUX_SYS_AUE_linux_mq_notify	AUE_NULL
1699
#define	LINUX_SYS_AUE_linux_mq_notify	AUE_NULL
1634
#define	LINUX_SYS_AUE_linux_mq_getsetattr	AUE_NULL
1700
#define	LINUX_SYS_AUE_linux_mq_getsetattr	AUE_NULL
1635
#define	LINUX_SYS_AUE_linux_kexec_load	AUE_NULL
1701
#define	LINUX_SYS_AUE_linux_kexec_load	AUE_NULL
1636
#define	LINUX_SYS_AUE_linux_waitid	AUE_NULL
1702
#define	LINUX_SYS_AUE_linux_waitid	AUE_WAIT6
1637
#define	LINUX_SYS_AUE_linux_add_key	AUE_NULL
1703
#define	LINUX_SYS_AUE_linux_add_key	AUE_NULL
1638
#define	LINUX_SYS_AUE_linux_request_key	AUE_NULL
1704
#define	LINUX_SYS_AUE_linux_request_key	AUE_NULL
1639
#define	LINUX_SYS_AUE_linux_keyctl	AUE_NULL
1705
#define	LINUX_SYS_AUE_linux_keyctl	AUE_NULL
Lines 1656-1663 Link Here
1656
#define	LINUX_SYS_AUE_linux_readlinkat	AUE_READLINKAT
1722
#define	LINUX_SYS_AUE_linux_readlinkat	AUE_READLINKAT
1657
#define	LINUX_SYS_AUE_linux_fchmodat	AUE_FCHMODAT
1723
#define	LINUX_SYS_AUE_linux_fchmodat	AUE_FCHMODAT
1658
#define	LINUX_SYS_AUE_linux_faccessat	AUE_FACCESSAT
1724
#define	LINUX_SYS_AUE_linux_faccessat	AUE_FACCESSAT
1659
#define	LINUX_SYS_AUE_linux_pselect6	AUE_NULL
1725
#define	LINUX_SYS_AUE_linux_pselect6	AUE_SELECT
1660
#define	LINUX_SYS_AUE_linux_ppoll	AUE_NULL
1726
#define	LINUX_SYS_AUE_linux_ppoll	AUE_POLL
1661
#define	LINUX_SYS_AUE_linux_unshare	AUE_NULL
1727
#define	LINUX_SYS_AUE_linux_unshare	AUE_NULL
1662
#define	LINUX_SYS_AUE_linux_set_robust_list	AUE_NULL
1728
#define	LINUX_SYS_AUE_linux_set_robust_list	AUE_NULL
1663
#define	LINUX_SYS_AUE_linux_get_robust_list	AUE_NULL
1729
#define	LINUX_SYS_AUE_linux_get_robust_list	AUE_NULL
Lines 1668-1674 Link Here
1668
#define	LINUX_SYS_AUE_linux_move_pages	AUE_NULL
1734
#define	LINUX_SYS_AUE_linux_move_pages	AUE_NULL
1669
#define	LINUX_SYS_AUE_linux_getcpu	AUE_NULL
1735
#define	LINUX_SYS_AUE_linux_getcpu	AUE_NULL
1670
#define	LINUX_SYS_AUE_linux_epoll_pwait	AUE_NULL
1736
#define	LINUX_SYS_AUE_linux_epoll_pwait	AUE_NULL
1671
#define	LINUX_SYS_AUE_linux_utimensat	AUE_NULL
1737
#define	LINUX_SYS_AUE_linux_utimensat	AUE_FUTIMESAT
1672
#define	LINUX_SYS_AUE_linux_signalfd	AUE_NULL
1738
#define	LINUX_SYS_AUE_linux_signalfd	AUE_NULL
1673
#define	LINUX_SYS_AUE_linux_timerfd_create	AUE_NULL
1739
#define	LINUX_SYS_AUE_linux_timerfd_create	AUE_NULL
1674
#define	LINUX_SYS_AUE_linux_eventfd	AUE_NULL
1740
#define	LINUX_SYS_AUE_linux_eventfd	AUE_NULL
Lines 1692-1698 Link Here
1692
#define	LINUX_SYS_AUE_linux_name_to_handle_at	AUE_NULL
1758
#define	LINUX_SYS_AUE_linux_name_to_handle_at	AUE_NULL
1693
#define	LINUX_SYS_AUE_linux_open_by_handle_at	AUE_NULL
1759
#define	LINUX_SYS_AUE_linux_open_by_handle_at	AUE_NULL
1694
#define	LINUX_SYS_AUE_linux_clock_adjtime	AUE_NULL
1760
#define	LINUX_SYS_AUE_linux_clock_adjtime	AUE_NULL
1695
#define	LINUX_SYS_AUE_linux_syncfs	AUE_NULL
1761
#define	LINUX_SYS_AUE_linux_syncfs	AUE_SYNC
1696
#define	LINUX_SYS_AUE_linux_sendmmsg	AUE_NULL
1762
#define	LINUX_SYS_AUE_linux_sendmmsg	AUE_NULL
1697
#define	LINUX_SYS_AUE_linux_setns	AUE_NULL
1763
#define	LINUX_SYS_AUE_linux_setns	AUE_NULL
1698
#define	LINUX_SYS_AUE_linux_process_vm_readv	AUE_NULL
1764
#define	LINUX_SYS_AUE_linux_process_vm_readv	AUE_NULL
(-)sys/i386/linux/linux_ptrace.c (-2 / +1 lines)
Lines 91-98 Link Here
91
map_signum(int signum)
91
map_signum(int signum)
92
{
92
{
93
93
94
	if (signum > 0 && signum <= LINUX_SIGTBLSZ)
94
	signum = linux_to_bsd_signal(signum);
95
		signum = linux_to_bsd_signal[_SIG_IDX(signum)];
96
	return ((signum == SIGSTOP)? 0 : signum);
95
	return ((signum == SIGSTOP)? 0 : signum);
97
}
96
}
98
97
(-)sys/i386/linux/linux_syscall.h (-5 / +5 lines)
Lines 6-12 Link Here
6
 * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 276810 2015-01-08 06:23:11Z dchagin 
6
 * created from FreeBSD: stable/10/sys/i386/linux/syscalls.master 276810 2015-01-08 06:23:11Z dchagin 
7
 */
7
 */
8
8
9
#define	LINUX_SYS_exit	1
9
#define	LINUX_SYS_linux_exit	1
10
#define	LINUX_SYS_linux_fork	2
10
#define	LINUX_SYS_linux_fork	2
11
#define	LINUX_SYS_read	3
11
#define	LINUX_SYS_read	3
12
#define	LINUX_SYS_write	4
12
#define	LINUX_SYS_write	4
Lines 148-161 Link Here
148
#define	LINUX_SYS_munlock	151
148
#define	LINUX_SYS_munlock	151
149
#define	LINUX_SYS_mlockall	152
149
#define	LINUX_SYS_mlockall	152
150
#define	LINUX_SYS_munlockall	153
150
#define	LINUX_SYS_munlockall	153
151
#define	LINUX_SYS_sched_setparam	154
151
#define	LINUX_SYS_linux_sched_setparam	154
152
#define	LINUX_SYS_sched_getparam	155
152
#define	LINUX_SYS_linux_sched_getparam	155
153
#define	LINUX_SYS_linux_sched_setscheduler	156
153
#define	LINUX_SYS_linux_sched_setscheduler	156
154
#define	LINUX_SYS_linux_sched_getscheduler	157
154
#define	LINUX_SYS_linux_sched_getscheduler	157
155
#define	LINUX_SYS_sched_yield	158
155
#define	LINUX_SYS_sched_yield	158
156
#define	LINUX_SYS_linux_sched_get_priority_max	159
156
#define	LINUX_SYS_linux_sched_get_priority_max	159
157
#define	LINUX_SYS_linux_sched_get_priority_min	160
157
#define	LINUX_SYS_linux_sched_get_priority_min	160
158
#define	LINUX_SYS_sched_rr_get_interval	161
158
#define	LINUX_SYS_linux_sched_rr_get_interval	161
159
#define	LINUX_SYS_linux_nanosleep	162
159
#define	LINUX_SYS_linux_nanosleep	162
160
#define	LINUX_SYS_linux_mremap	163
160
#define	LINUX_SYS_linux_mremap	163
161
#define	LINUX_SYS_linux_setresuid16	164
161
#define	LINUX_SYS_linux_setresuid16	164
Lines 328-331 Link Here
328
#define	LINUX_SYS_linux_setns	346
328
#define	LINUX_SYS_linux_setns	346
329
#define	LINUX_SYS_linux_process_vm_readv	347
329
#define	LINUX_SYS_linux_process_vm_readv	347
330
#define	LINUX_SYS_linux_process_vm_writev	348
330
#define	LINUX_SYS_linux_process_vm_writev	348
331
#define	LINUX_SYS_MAXSYSCALL	349
331
#define	LINUX_SYS_MAXSYSCALL	350
(-)sys/i386/linux/linux_syscalls.c (-4 / +5 lines)
Lines 9-15 Link Here
9
const char *linux_syscallnames[] = {
9
const char *linux_syscallnames[] = {
10
#define	nosys	linux_nosys
10
#define	nosys	linux_nosys
11
	"#0",			/* 0 = setup */
11
	"#0",			/* 0 = setup */
12
	"exit",			/* 1 = exit */
12
	"linux_exit",			/* 1 = exit */
13
	"linux_fork",			/* 2 = linux_fork */
13
	"linux_fork",			/* 2 = linux_fork */
14
	"read",			/* 3 = read */
14
	"read",			/* 3 = read */
15
	"write",			/* 4 = write */
15
	"write",			/* 4 = write */
Lines 162-175 Link Here
162
	"munlock",			/* 151 = munlock */
162
	"munlock",			/* 151 = munlock */
163
	"mlockall",			/* 152 = mlockall */
163
	"mlockall",			/* 152 = mlockall */
164
	"munlockall",			/* 153 = munlockall */
164
	"munlockall",			/* 153 = munlockall */
165
	"sched_setparam",			/* 154 = sched_setparam */
165
	"linux_sched_setparam",			/* 154 = linux_sched_setparam */
166
	"sched_getparam",			/* 155 = sched_getparam */
166
	"linux_sched_getparam",			/* 155 = linux_sched_getparam */
167
	"linux_sched_setscheduler",			/* 156 = linux_sched_setscheduler */
167
	"linux_sched_setscheduler",			/* 156 = linux_sched_setscheduler */
168
	"linux_sched_getscheduler",			/* 157 = linux_sched_getscheduler */
168
	"linux_sched_getscheduler",			/* 157 = linux_sched_getscheduler */
169
	"sched_yield",			/* 158 = sched_yield */
169
	"sched_yield",			/* 158 = sched_yield */
170
	"linux_sched_get_priority_max",			/* 159 = linux_sched_get_priority_max */
170
	"linux_sched_get_priority_max",			/* 159 = linux_sched_get_priority_max */
171
	"linux_sched_get_priority_min",			/* 160 = linux_sched_get_priority_min */
171
	"linux_sched_get_priority_min",			/* 160 = linux_sched_get_priority_min */
172
	"sched_rr_get_interval",			/* 161 = sched_rr_get_interval */
172
	"linux_sched_rr_get_interval",			/* 161 = linux_sched_rr_get_interval */
173
	"linux_nanosleep",			/* 162 = linux_nanosleep */
173
	"linux_nanosleep",			/* 162 = linux_nanosleep */
174
	"linux_mremap",			/* 163 = linux_mremap */
174
	"linux_mremap",			/* 163 = linux_mremap */
175
	"linux_setresuid16",			/* 164 = linux_setresuid16 */
175
	"linux_setresuid16",			/* 164 = linux_setresuid16 */
Lines 357-360 Link Here
357
	"linux_setns",			/* 346 = linux_setns */
357
	"linux_setns",			/* 346 = linux_setns */
358
	"linux_process_vm_readv",			/* 347 = linux_process_vm_readv */
358
	"linux_process_vm_readv",			/* 347 = linux_process_vm_readv */
359
	"linux_process_vm_writev",			/* 348 = linux_process_vm_writev */
359
	"linux_process_vm_writev",			/* 348 = linux_process_vm_writev */
360
	"#349",			/* 349 = nosys */
360
};
361
};
(-)sys/i386/linux/linux_sysent.c (-22 / +23 lines)
Lines 19-25 Link Here
19
struct sysent linux_sysent[] = {
19
struct sysent linux_sysent[] = {
20
#define	nosys	linux_nosys
20
#define	nosys	linux_nosys
21
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 0 = setup */
21
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 0 = setup */
22
	{ AS(sys_exit_args), (sy_call_t *)sys_sys_exit, AUE_EXIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 1 = exit */
22
	{ AS(linux_exit_args), (sy_call_t *)linux_exit, AUE_EXIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 1 = linux_exit */
23
	{ 0, (sy_call_t *)linux_fork, AUE_FORK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 2 = linux_fork */
23
	{ 0, (sy_call_t *)linux_fork, AUE_FORK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 2 = linux_fork */
24
	{ AS(read_args), (sy_call_t *)sys_read, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 3 = read */
24
	{ AS(read_args), (sy_call_t *)sys_read, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 3 = read */
25
	{ AS(write_args), (sy_call_t *)sys_write, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 4 = write */
25
	{ AS(write_args), (sy_call_t *)sys_write, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 4 = write */
Lines 172-185 Link Here
172
	{ AS(munlock_args), (sy_call_t *)sys_munlock, AUE_MUNLOCK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 151 = munlock */
172
	{ AS(munlock_args), (sy_call_t *)sys_munlock, AUE_MUNLOCK, NULL, 0, 0, 0, SY_THR_STATIC },	/* 151 = munlock */
173
	{ AS(mlockall_args), (sy_call_t *)sys_mlockall, AUE_MLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 152 = mlockall */
173
	{ AS(mlockall_args), (sy_call_t *)sys_mlockall, AUE_MLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 152 = mlockall */
174
	{ 0, (sy_call_t *)sys_munlockall, AUE_MUNLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 153 = munlockall */
174
	{ 0, (sy_call_t *)sys_munlockall, AUE_MUNLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 153 = munlockall */
175
	{ AS(sched_setparam_args), (sy_call_t *)sys_sched_setparam, AUE_SCHED_SETPARAM, NULL, 0, 0, 0, SY_THR_STATIC },	/* 154 = sched_setparam */
175
	{ AS(linux_sched_setparam_args), (sy_call_t *)linux_sched_setparam, AUE_SCHED_SETPARAM, NULL, 0, 0, 0, SY_THR_STATIC },	/* 154 = linux_sched_setparam */
176
	{ AS(sched_getparam_args), (sy_call_t *)sys_sched_getparam, AUE_SCHED_GETPARAM, NULL, 0, 0, 0, SY_THR_STATIC },	/* 155 = sched_getparam */
176
	{ AS(linux_sched_getparam_args), (sy_call_t *)linux_sched_getparam, AUE_SCHED_GETPARAM, NULL, 0, 0, 0, SY_THR_STATIC },	/* 155 = linux_sched_getparam */
177
	{ AS(linux_sched_setscheduler_args), (sy_call_t *)linux_sched_setscheduler, AUE_SCHED_SETSCHEDULER, NULL, 0, 0, 0, SY_THR_STATIC },	/* 156 = linux_sched_setscheduler */
177
	{ AS(linux_sched_setscheduler_args), (sy_call_t *)linux_sched_setscheduler, AUE_SCHED_SETSCHEDULER, NULL, 0, 0, 0, SY_THR_STATIC },	/* 156 = linux_sched_setscheduler */
178
	{ AS(linux_sched_getscheduler_args), (sy_call_t *)linux_sched_getscheduler, AUE_SCHED_GETSCHEDULER, NULL, 0, 0, 0, SY_THR_STATIC },	/* 157 = linux_sched_getscheduler */
178
	{ AS(linux_sched_getscheduler_args), (sy_call_t *)linux_sched_getscheduler, AUE_SCHED_GETSCHEDULER, NULL, 0, 0, 0, SY_THR_STATIC },	/* 157 = linux_sched_getscheduler */
179
	{ 0, (sy_call_t *)sys_sched_yield, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 158 = sched_yield */
179
	{ 0, (sy_call_t *)sys_sched_yield, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 158 = sched_yield */
180
	{ AS(linux_sched_get_priority_max_args), (sy_call_t *)linux_sched_get_priority_max, AUE_SCHED_GET_PRIORITY_MAX, NULL, 0, 0, 0, SY_THR_STATIC },	/* 159 = linux_sched_get_priority_max */
180
	{ AS(linux_sched_get_priority_max_args), (sy_call_t *)linux_sched_get_priority_max, AUE_SCHED_GET_PRIORITY_MAX, NULL, 0, 0, 0, SY_THR_STATIC },	/* 159 = linux_sched_get_priority_max */
181
	{ AS(linux_sched_get_priority_min_args), (sy_call_t *)linux_sched_get_priority_min, AUE_SCHED_GET_PRIORITY_MIN, NULL, 0, 0, 0, SY_THR_STATIC },	/* 160 = linux_sched_get_priority_min */
181
	{ AS(linux_sched_get_priority_min_args), (sy_call_t *)linux_sched_get_priority_min, AUE_SCHED_GET_PRIORITY_MIN, NULL, 0, 0, 0, SY_THR_STATIC },	/* 160 = linux_sched_get_priority_min */
182
	{ AS(sched_rr_get_interval_args), (sy_call_t *)sys_sched_rr_get_interval, AUE_SCHED_RR_GET_INTERVAL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 161 = sched_rr_get_interval */
182
	{ AS(linux_sched_rr_get_interval_args), (sy_call_t *)linux_sched_rr_get_interval, AUE_SCHED_RR_GET_INTERVAL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 161 = linux_sched_rr_get_interval */
183
	{ AS(linux_nanosleep_args), (sy_call_t *)linux_nanosleep, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 162 = linux_nanosleep */
183
	{ AS(linux_nanosleep_args), (sy_call_t *)linux_nanosleep, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 162 = linux_nanosleep */
184
	{ AS(linux_mremap_args), (sy_call_t *)linux_mremap, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 163 = linux_mremap */
184
	{ AS(linux_mremap_args), (sy_call_t *)linux_mremap, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 163 = linux_mremap */
185
	{ AS(linux_setresuid16_args), (sy_call_t *)linux_setresuid16, AUE_SETRESUID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 164 = linux_setresuid16 */
185
	{ AS(linux_setresuid16_args), (sy_call_t *)linux_setresuid16, AUE_SETRESUID, NULL, 0, 0, 0, SY_THR_STATIC },	/* 164 = linux_setresuid16 */
Lines 196-202 Link Here
196
	{ AS(linux_rt_sigprocmask_args), (sy_call_t *)linux_rt_sigprocmask, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 175 = linux_rt_sigprocmask */
196
	{ AS(linux_rt_sigprocmask_args), (sy_call_t *)linux_rt_sigprocmask, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 175 = linux_rt_sigprocmask */
197
	{ AS(linux_rt_sigpending_args), (sy_call_t *)linux_rt_sigpending, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 176 = linux_rt_sigpending */
197
	{ AS(linux_rt_sigpending_args), (sy_call_t *)linux_rt_sigpending, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 176 = linux_rt_sigpending */
198
	{ AS(linux_rt_sigtimedwait_args), (sy_call_t *)linux_rt_sigtimedwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 177 = linux_rt_sigtimedwait */
198
	{ AS(linux_rt_sigtimedwait_args), (sy_call_t *)linux_rt_sigtimedwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 177 = linux_rt_sigtimedwait */
199
	{ 0, (sy_call_t *)linux_rt_sigqueueinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 178 = linux_rt_sigqueueinfo */
199
	{ AS(linux_rt_sigqueueinfo_args), (sy_call_t *)linux_rt_sigqueueinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 178 = linux_rt_sigqueueinfo */
200
	{ AS(linux_rt_sigsuspend_args), (sy_call_t *)linux_rt_sigsuspend, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 179 = linux_rt_sigsuspend */
200
	{ AS(linux_rt_sigsuspend_args), (sy_call_t *)linux_rt_sigsuspend, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 179 = linux_rt_sigsuspend */
201
	{ AS(linux_pread_args), (sy_call_t *)linux_pread, AUE_PREAD, NULL, 0, 0, 0, SY_THR_STATIC },	/* 180 = linux_pread */
201
	{ AS(linux_pread_args), (sy_call_t *)linux_pread, AUE_PREAD, NULL, 0, 0, 0, SY_THR_STATIC },	/* 180 = linux_pread */
202
	{ AS(linux_pwrite_args), (sy_call_t *)linux_pwrite, AUE_PWRITE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 181 = linux_pwrite */
202
	{ AS(linux_pwrite_args), (sy_call_t *)linux_pwrite, AUE_PWRITE, NULL, 0, 0, 0, SY_THR_STATIC },	/* 181 = linux_pwrite */
Lines 272-280 Link Here
272
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 251 =  */
272
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 251 =  */
273
	{ AS(linux_exit_group_args), (sy_call_t *)linux_exit_group, AUE_EXIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 252 = linux_exit_group */
273
	{ AS(linux_exit_group_args), (sy_call_t *)linux_exit_group, AUE_EXIT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 252 = linux_exit_group */
274
	{ 0, (sy_call_t *)linux_lookup_dcookie, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 253 = linux_lookup_dcookie */
274
	{ 0, (sy_call_t *)linux_lookup_dcookie, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 253 = linux_lookup_dcookie */
275
	{ 0, (sy_call_t *)linux_epoll_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 254 = linux_epoll_create */
275
	{ AS(linux_epoll_create_args), (sy_call_t *)linux_epoll_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 254 = linux_epoll_create */
276
	{ 0, (sy_call_t *)linux_epoll_ctl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 255 = linux_epoll_ctl */
276
	{ AS(linux_epoll_ctl_args), (sy_call_t *)linux_epoll_ctl, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 255 = linux_epoll_ctl */
277
	{ 0, (sy_call_t *)linux_epoll_wait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 256 = linux_epoll_wait */
277
	{ AS(linux_epoll_wait_args), (sy_call_t *)linux_epoll_wait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 256 = linux_epoll_wait */
278
	{ 0, (sy_call_t *)linux_remap_file_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 257 = linux_remap_file_pages */
278
	{ 0, (sy_call_t *)linux_remap_file_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 257 = linux_remap_file_pages */
279
	{ AS(linux_set_tid_address_args), (sy_call_t *)linux_set_tid_address, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 258 = linux_set_tid_address */
279
	{ AS(linux_set_tid_address_args), (sy_call_t *)linux_set_tid_address, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 258 = linux_set_tid_address */
280
	{ AS(linux_timer_create_args), (sy_call_t *)linux_timer_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 259 = linux_timer_create */
280
	{ AS(linux_timer_create_args), (sy_call_t *)linux_timer_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 259 = linux_timer_create */
Lines 302-308 Link Here
302
	{ AS(linux_mq_notify_args), (sy_call_t *)linux_mq_notify, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 281 = linux_mq_notify */
302
	{ AS(linux_mq_notify_args), (sy_call_t *)linux_mq_notify, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 281 = linux_mq_notify */
303
	{ AS(linux_mq_getsetattr_args), (sy_call_t *)linux_mq_getsetattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 282 = linux_mq_getsetattr */
303
	{ AS(linux_mq_getsetattr_args), (sy_call_t *)linux_mq_getsetattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 282 = linux_mq_getsetattr */
304
	{ 0, (sy_call_t *)linux_kexec_load, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 283 = linux_kexec_load */
304
	{ 0, (sy_call_t *)linux_kexec_load, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 283 = linux_kexec_load */
305
	{ 0, (sy_call_t *)linux_waitid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 284 = linux_waitid */
305
	{ AS(linux_waitid_args), (sy_call_t *)linux_waitid, AUE_WAIT6, NULL, 0, 0, 0, SY_THR_STATIC },	/* 284 = linux_waitid */
306
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 285 =  */
306
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 285 =  */
307
	{ 0, (sy_call_t *)linux_add_key, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 286 = linux_add_key */
307
	{ 0, (sy_call_t *)linux_add_key, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 286 = linux_add_key */
308
	{ 0, (sy_call_t *)linux_request_key, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 287 = linux_request_key */
308
	{ 0, (sy_call_t *)linux_request_key, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 287 = linux_request_key */
Lines 326-333 Link Here
326
	{ AS(linux_readlinkat_args), (sy_call_t *)linux_readlinkat, AUE_READLINKAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 305 = linux_readlinkat */
326
	{ AS(linux_readlinkat_args), (sy_call_t *)linux_readlinkat, AUE_READLINKAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 305 = linux_readlinkat */
327
	{ AS(linux_fchmodat_args), (sy_call_t *)linux_fchmodat, AUE_FCHMODAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 306 = linux_fchmodat */
327
	{ AS(linux_fchmodat_args), (sy_call_t *)linux_fchmodat, AUE_FCHMODAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 306 = linux_fchmodat */
328
	{ AS(linux_faccessat_args), (sy_call_t *)linux_faccessat, AUE_FACCESSAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 307 = linux_faccessat */
328
	{ AS(linux_faccessat_args), (sy_call_t *)linux_faccessat, AUE_FACCESSAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 307 = linux_faccessat */
329
	{ 0, (sy_call_t *)linux_pselect6, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 308 = linux_pselect6 */
329
	{ AS(linux_pselect6_args), (sy_call_t *)linux_pselect6, AUE_SELECT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 308 = linux_pselect6 */
330
	{ 0, (sy_call_t *)linux_ppoll, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 309 = linux_ppoll */
330
	{ AS(linux_ppoll_args), (sy_call_t *)linux_ppoll, AUE_POLL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 309 = linux_ppoll */
331
	{ 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 310 = linux_unshare */
331
	{ 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 310 = linux_unshare */
332
	{ AS(linux_set_robust_list_args), (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 311 = linux_set_robust_list */
332
	{ AS(linux_set_robust_list_args), (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 311 = linux_set_robust_list */
333
	{ AS(linux_get_robust_list_args), (sy_call_t *)linux_get_robust_list, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 312 = linux_get_robust_list */
333
	{ AS(linux_get_robust_list_args), (sy_call_t *)linux_get_robust_list, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 312 = linux_get_robust_list */
Lines 337-354 Link Here
337
	{ 0, (sy_call_t *)linux_vmsplice, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 316 = linux_vmsplice */
337
	{ 0, (sy_call_t *)linux_vmsplice, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 316 = linux_vmsplice */
338
	{ 0, (sy_call_t *)linux_move_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 317 = linux_move_pages */
338
	{ 0, (sy_call_t *)linux_move_pages, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 317 = linux_move_pages */
339
	{ 0, (sy_call_t *)linux_getcpu, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 318 = linux_getcpu */
339
	{ 0, (sy_call_t *)linux_getcpu, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 318 = linux_getcpu */
340
	{ 0, (sy_call_t *)linux_epoll_pwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 319 = linux_epoll_pwait */
340
	{ AS(linux_epoll_pwait_args), (sy_call_t *)linux_epoll_pwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 319 = linux_epoll_pwait */
341
	{ 0, (sy_call_t *)linux_utimensat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 320 = linux_utimensat */
341
	{ AS(linux_utimensat_args), (sy_call_t *)linux_utimensat, AUE_FUTIMESAT, NULL, 0, 0, 0, SY_THR_STATIC },	/* 320 = linux_utimensat */
342
	{ 0, (sy_call_t *)linux_signalfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 321 = linux_signalfd */
342
	{ 0, (sy_call_t *)linux_signalfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 321 = linux_signalfd */
343
	{ 0, (sy_call_t *)linux_timerfd_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 322 = linux_timerfd_create */
343
	{ 0, (sy_call_t *)linux_timerfd_create, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 322 = linux_timerfd_create */
344
	{ 0, (sy_call_t *)linux_eventfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 323 = linux_eventfd */
344
	{ AS(linux_eventfd_args), (sy_call_t *)linux_eventfd, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 323 = linux_eventfd */
345
	{ 0, (sy_call_t *)linux_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 324 = linux_fallocate */
345
	{ AS(linux_fallocate_args), (sy_call_t *)linux_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 324 = linux_fallocate */
346
	{ 0, (sy_call_t *)linux_timerfd_settime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 325 = linux_timerfd_settime */
346
	{ 0, (sy_call_t *)linux_timerfd_settime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 325 = linux_timerfd_settime */
347
	{ 0, (sy_call_t *)linux_timerfd_gettime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 326 = linux_timerfd_gettime */
347
	{ 0, (sy_call_t *)linux_timerfd_gettime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 326 = linux_timerfd_gettime */
348
	{ 0, (sy_call_t *)linux_signalfd4, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 327 = linux_signalfd4 */
348
	{ 0, (sy_call_t *)linux_signalfd4, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 327 = linux_signalfd4 */
349
	{ 0, (sy_call_t *)linux_eventfd2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 328 = linux_eventfd2 */
349
	{ AS(linux_eventfd2_args), (sy_call_t *)linux_eventfd2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 328 = linux_eventfd2 */
350
	{ 0, (sy_call_t *)linux_epoll_create1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 329 = linux_epoll_create1 */
350
	{ AS(linux_epoll_create1_args), (sy_call_t *)linux_epoll_create1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 329 = linux_epoll_create1 */
351
	{ 0, (sy_call_t *)linux_dup3, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 330 = linux_dup3 */
351
	{ AS(linux_dup3_args), (sy_call_t *)linux_dup3, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 330 = linux_dup3 */
352
	{ AS(linux_pipe2_args), (sy_call_t *)linux_pipe2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 331 = linux_pipe2 */
352
	{ AS(linux_pipe2_args), (sy_call_t *)linux_pipe2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 331 = linux_pipe2 */
353
	{ 0, (sy_call_t *)linux_inotify_init1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 332 = linux_inotify_init1 */
353
	{ 0, (sy_call_t *)linux_inotify_init1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 332 = linux_inotify_init1 */
354
	{ 0, (sy_call_t *)linux_preadv, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 333 = linux_preadv */
354
	{ 0, (sy_call_t *)linux_preadv, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 333 = linux_preadv */
Lines 355-370 Link Here
355
	{ 0, (sy_call_t *)linux_pwritev, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 334 = linux_pwritev */
355
	{ 0, (sy_call_t *)linux_pwritev, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 334 = linux_pwritev */
356
	{ 0, (sy_call_t *)linux_rt_tsigqueueinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 335 = linux_rt_tsigqueueinfo */
356
	{ 0, (sy_call_t *)linux_rt_tsigqueueinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 335 = linux_rt_tsigqueueinfo */
357
	{ 0, (sy_call_t *)linux_perf_event_open, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 336 = linux_perf_event_open */
357
	{ 0, (sy_call_t *)linux_perf_event_open, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 336 = linux_perf_event_open */
358
	{ 0, (sy_call_t *)linux_recvmmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 337 = linux_recvmmsg */
358
	{ AS(linux_recvmmsg_args), (sy_call_t *)linux_recvmmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 337 = linux_recvmmsg */
359
	{ 0, (sy_call_t *)linux_fanotify_init, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 338 = linux_fanotify_init */
359
	{ 0, (sy_call_t *)linux_fanotify_init, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 338 = linux_fanotify_init */
360
	{ 0, (sy_call_t *)linux_fanotify_mark, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 339 = linux_fanotify_mark */
360
	{ 0, (sy_call_t *)linux_fanotify_mark, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 339 = linux_fanotify_mark */
361
	{ 0, (sy_call_t *)linux_prlimit64, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 340 = linux_prlimit64 */
361
	{ AS(linux_prlimit64_args), (sy_call_t *)linux_prlimit64, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 340 = linux_prlimit64 */
362
	{ 0, (sy_call_t *)linux_name_to_handle_at, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 341 = linux_name_to_handle_at */
362
	{ 0, (sy_call_t *)linux_name_to_handle_at, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 341 = linux_name_to_handle_at */
363
	{ 0, (sy_call_t *)linux_open_by_handle_at, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 342 = linux_open_by_handle_at */
363
	{ 0, (sy_call_t *)linux_open_by_handle_at, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 342 = linux_open_by_handle_at */
364
	{ 0, (sy_call_t *)linux_clock_adjtime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 343 = linux_clock_adjtime */
364
	{ 0, (sy_call_t *)linux_clock_adjtime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 343 = linux_clock_adjtime */
365
	{ 0, (sy_call_t *)linux_syncfs, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 344 = linux_syncfs */
365
	{ AS(linux_syncfs_args), (sy_call_t *)linux_syncfs, AUE_SYNC, NULL, 0, 0, 0, SY_THR_STATIC },	/* 344 = linux_syncfs */
366
	{ 0, (sy_call_t *)linux_sendmmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 345 = linux_sendmmsg */
366
	{ AS(linux_sendmmsg_args), (sy_call_t *)linux_sendmmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 345 = linux_sendmmsg */
367
	{ 0, (sy_call_t *)linux_setns, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 346 = linux_setns */
367
	{ 0, (sy_call_t *)linux_setns, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 346 = linux_setns */
368
	{ 0, (sy_call_t *)linux_process_vm_readv, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 347 = linux_process_vm_readv */
368
	{ 0, (sy_call_t *)linux_process_vm_readv, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 347 = linux_process_vm_readv */
369
	{ 0, (sy_call_t *)linux_process_vm_writev, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 348 = linux_process_vm_writev */
369
	{ 0, (sy_call_t *)linux_process_vm_writev, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },	/* 348 = linux_process_vm_writev */
370
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },			/* 349 = nosys */
370
};
371
};
(-)sys/i386/linux/linux_systrace_args.c (-47 / +435 lines)
Lines 12-20 Link Here
12
	int64_t *iarg  = (int64_t *) uarg;
12
	int64_t *iarg  = (int64_t *) uarg;
13
	switch (sysnum) {
13
	switch (sysnum) {
14
#define	nosys	linux_nosys
14
#define	nosys	linux_nosys
15
	/* sys_exit */
15
	/* linux_exit */
16
	case 1: {
16
	case 1: {
17
		struct sys_exit_args *p = params;
17
		struct linux_exit_args *p = params;
18
		iarg[0] = p->rval; /* int */
18
		iarg[0] = p->rval; /* int */
19
		*n_args = 1;
19
		*n_args = 1;
20
		break;
20
		break;
Lines 1081-1099 Link Here
1081
		*n_args = 0;
1081
		*n_args = 0;
1082
		break;
1082
		break;
1083
	}
1083
	}
1084
	/* sched_setparam */
1084
	/* linux_sched_setparam */
1085
	case 154: {
1085
	case 154: {
1086
		struct sched_setparam_args *p = params;
1086
		struct linux_sched_setparam_args *p = params;
1087
		iarg[0] = p->pid; /* pid_t */
1087
		iarg[0] = p->pid; /* l_pid_t */
1088
		uarg[1] = (intptr_t) p->param; /* const struct sched_param * */
1088
		uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */
1089
		*n_args = 2;
1089
		*n_args = 2;
1090
		break;
1090
		break;
1091
	}
1091
	}
1092
	/* sched_getparam */
1092
	/* linux_sched_getparam */
1093
	case 155: {
1093
	case 155: {
1094
		struct sched_getparam_args *p = params;
1094
		struct linux_sched_getparam_args *p = params;
1095
		iarg[0] = p->pid; /* pid_t */
1095
		iarg[0] = p->pid; /* l_pid_t */
1096
		uarg[1] = (intptr_t) p->param; /* struct sched_param * */
1096
		uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */
1097
		*n_args = 2;
1097
		*n_args = 2;
1098
		break;
1098
		break;
1099
	}
1099
	}
Lines 1132-1140 Link Here
1132
		*n_args = 1;
1132
		*n_args = 1;
1133
		break;
1133
		break;
1134
	}
1134
	}
1135
	/* sched_rr_get_interval */
1135
	/* linux_sched_rr_get_interval */
1136
	case 161: {
1136
	case 161: {
1137
		struct sched_rr_get_interval_args *p = params;
1137
		struct linux_sched_rr_get_interval_args *p = params;
1138
		iarg[0] = p->pid; /* l_pid_t */
1138
		iarg[0] = p->pid; /* l_pid_t */
1139
		uarg[1] = (intptr_t) p->interval; /* struct l_timespec * */
1139
		uarg[1] = (intptr_t) p->interval; /* struct l_timespec * */
1140
		*n_args = 2;
1140
		*n_args = 2;
Lines 1277-1283 Link Here
1277
	}
1277
	}
1278
	/* linux_rt_sigqueueinfo */
1278
	/* linux_rt_sigqueueinfo */
1279
	case 178: {
1279
	case 178: {
1280
		*n_args = 0;
1280
		struct linux_rt_sigqueueinfo_args *p = params;
1281
		iarg[0] = p->pid; /* l_pid_t */
1282
		iarg[1] = p->sig; /* l_int */
1283
		uarg[2] = (intptr_t) p->info; /* l_siginfo_t * */
1284
		*n_args = 3;
1281
		break;
1285
		break;
1282
	}
1286
	}
1283
	/* linux_rt_sigsuspend */
1287
	/* linux_rt_sigsuspend */
Lines 1743-1759 Link Here
1743
	}
1747
	}
1744
	/* linux_epoll_create */
1748
	/* linux_epoll_create */
1745
	case 254: {
1749
	case 254: {
1746
		*n_args = 0;
1750
		struct linux_epoll_create_args *p = params;
1751
		iarg[0] = p->size; /* l_int */
1752
		*n_args = 1;
1747
		break;
1753
		break;
1748
	}
1754
	}
1749
	/* linux_epoll_ctl */
1755
	/* linux_epoll_ctl */
1750
	case 255: {
1756
	case 255: {
1751
		*n_args = 0;
1757
		struct linux_epoll_ctl_args *p = params;
1758
		iarg[0] = p->epfd; /* l_int */
1759
		iarg[1] = p->op; /* l_int */
1760
		iarg[2] = p->fd; /* l_int */
1761
		uarg[3] = (intptr_t) p->event; /* struct epoll_event * */
1762
		*n_args = 4;
1752
		break;
1763
		break;
1753
	}
1764
	}
1754
	/* linux_epoll_wait */
1765
	/* linux_epoll_wait */
1755
	case 256: {
1766
	case 256: {
1756
		*n_args = 0;
1767
		struct linux_epoll_wait_args *p = params;
1768
		iarg[0] = p->epfd; /* l_int */
1769
		uarg[1] = (intptr_t) p->events; /* struct epoll_event * */
1770
		iarg[2] = p->maxevents; /* l_int */
1771
		iarg[3] = p->timeout; /* l_int */
1772
		*n_args = 4;
1757
		break;
1773
		break;
1758
	}
1774
	}
1759
	/* linux_remap_file_pages */
1775
	/* linux_remap_file_pages */
Lines 1962-1968 Link Here
1962
	}
1978
	}
1963
	/* linux_waitid */
1979
	/* linux_waitid */
1964
	case 284: {
1980
	case 284: {
1965
		*n_args = 0;
1981
		struct linux_waitid_args *p = params;
1982
		iarg[0] = p->idtype; /* int */
1983
		iarg[1] = p->id; /* l_pid_t */
1984
		uarg[2] = (intptr_t) p->info; /* l_siginfo_t * */
1985
		iarg[3] = p->options; /* int */
1986
		uarg[4] = (intptr_t) p->rusage; /* struct l_rusage * */
1987
		*n_args = 5;
1966
		break;
1988
		break;
1967
	}
1989
	}
1968
	/* linux_add_key */
1990
	/* linux_add_key */
Lines 2133-2150 Link Here
2133
		iarg[0] = p->dfd; /* l_int */
2155
		iarg[0] = p->dfd; /* l_int */
2134
		uarg[1] = (intptr_t) p->filename; /* const char * */
2156
		uarg[1] = (intptr_t) p->filename; /* const char * */
2135
		iarg[2] = p->amode; /* l_int */
2157
		iarg[2] = p->amode; /* l_int */
2136
		iarg[3] = p->flag; /* l_int */
2158
		*n_args = 3;
2137
		*n_args = 4;
2138
		break;
2159
		break;
2139
	}
2160
	}
2140
	/* linux_pselect6 */
2161
	/* linux_pselect6 */
2141
	case 308: {
2162
	case 308: {
2142
		*n_args = 0;
2163
		struct linux_pselect6_args *p = params;
2164
		iarg[0] = p->nfds; /* l_int */
2165
		uarg[1] = (intptr_t) p->readfds; /* l_fd_set * */
2166
		uarg[2] = (intptr_t) p->writefds; /* l_fd_set * */
2167
		uarg[3] = (intptr_t) p->exceptfds; /* l_fd_set * */
2168
		uarg[4] = (intptr_t) p->tsp; /* struct l_timespec * */
2169
		uarg[5] = (intptr_t) p->sig; /* l_uintptr_t * */
2170
		*n_args = 6;
2143
		break;
2171
		break;
2144
	}
2172
	}
2145
	/* linux_ppoll */
2173
	/* linux_ppoll */
2146
	case 309: {
2174
	case 309: {
2147
		*n_args = 0;
2175
		struct linux_ppoll_args *p = params;
2176
		uarg[0] = (intptr_t) p->fds; /* struct pollfd * */
2177
		uarg[1] = p->nfds; /* uint32_t */
2178
		uarg[2] = (intptr_t) p->tsp; /* struct l_timespec * */
2179
		uarg[3] = (intptr_t) p->sset; /* l_sigset_t * */
2180
		iarg[4] = p->ssize; /* l_size_t */
2181
		*n_args = 5;
2148
		break;
2182
		break;
2149
	}
2183
	}
2150
	/* linux_unshare */
2184
	/* linux_unshare */
Lines 2201-2212 Link Here
2201
	}
2235
	}
2202
	/* linux_epoll_pwait */
2236
	/* linux_epoll_pwait */
2203
	case 319: {
2237
	case 319: {
2204
		*n_args = 0;
2238
		struct linux_epoll_pwait_args *p = params;
2239
		iarg[0] = p->epfd; /* l_int */
2240
		uarg[1] = (intptr_t) p->events; /* struct epoll_event * */
2241
		iarg[2] = p->maxevents; /* l_int */
2242
		iarg[3] = p->timeout; /* l_int */
2243
		uarg[4] = (intptr_t) p->mask; /* l_sigset_t * */
2244
		*n_args = 5;
2205
		break;
2245
		break;
2206
	}
2246
	}
2207
	/* linux_utimensat */
2247
	/* linux_utimensat */
2208
	case 320: {
2248
	case 320: {
2209
		*n_args = 0;
2249
		struct linux_utimensat_args *p = params;
2250
		iarg[0] = p->dfd; /* l_int */
2251
		uarg[1] = (intptr_t) p->pathname; /* const char * */
2252
		uarg[2] = (intptr_t) p->times; /* const struct l_timespec * */
2253
		iarg[3] = p->flags; /* l_int */
2254
		*n_args = 4;
2210
		break;
2255
		break;
2211
	}
2256
	}
2212
	/* linux_signalfd */
2257
	/* linux_signalfd */
Lines 2221-2232 Link Here
2221
	}
2266
	}
2222
	/* linux_eventfd */
2267
	/* linux_eventfd */
2223
	case 323: {
2268
	case 323: {
2224
		*n_args = 0;
2269
		struct linux_eventfd_args *p = params;
2270
		iarg[0] = p->initval; /* l_uint */
2271
		*n_args = 1;
2225
		break;
2272
		break;
2226
	}
2273
	}
2227
	/* linux_fallocate */
2274
	/* linux_fallocate */
2228
	case 324: {
2275
	case 324: {
2229
		*n_args = 0;
2276
		struct linux_fallocate_args *p = params;
2277
		iarg[0] = p->fd; /* l_int */
2278
		iarg[1] = p->mode; /* l_int */
2279
		iarg[2] = p->offset; /* l_loff_t */
2280
		iarg[3] = p->len; /* l_loff_t */
2281
		*n_args = 4;
2230
		break;
2282
		break;
2231
	}
2283
	}
2232
	/* linux_timerfd_settime */
2284
	/* linux_timerfd_settime */
Lines 2246-2262 Link Here
2246
	}
2298
	}
2247
	/* linux_eventfd2 */
2299
	/* linux_eventfd2 */
2248
	case 328: {
2300
	case 328: {
2249
		*n_args = 0;
2301
		struct linux_eventfd2_args *p = params;
2302
		iarg[0] = p->initval; /* l_uint */
2303
		iarg[1] = p->flags; /* l_int */
2304
		*n_args = 2;
2250
		break;
2305
		break;
2251
	}
2306
	}
2252
	/* linux_epoll_create1 */
2307
	/* linux_epoll_create1 */
2253
	case 329: {
2308
	case 329: {
2254
		*n_args = 0;
2309
		struct linux_epoll_create1_args *p = params;
2310
		iarg[0] = p->flags; /* l_int */
2311
		*n_args = 1;
2255
		break;
2312
		break;
2256
	}
2313
	}
2257
	/* linux_dup3 */
2314
	/* linux_dup3 */
2258
	case 330: {
2315
	case 330: {
2259
		*n_args = 0;
2316
		struct linux_dup3_args *p = params;
2317
		iarg[0] = p->oldfd; /* l_int */
2318
		iarg[1] = p->newfd; /* l_int */
2319
		iarg[2] = p->flags; /* l_int */
2320
		*n_args = 3;
2260
		break;
2321
		break;
2261
	}
2322
	}
2262
	/* linux_pipe2 */
2323
	/* linux_pipe2 */
Lines 2294-2300 Link Here
2294
	}
2355
	}
2295
	/* linux_recvmmsg */
2356
	/* linux_recvmmsg */
2296
	case 337: {
2357
	case 337: {
2297
		*n_args = 0;
2358
		struct linux_recvmmsg_args *p = params;
2359
		iarg[0] = p->s; /* l_int */
2360
		uarg[1] = (intptr_t) p->msg; /* struct l_mmsghdr * */
2361
		iarg[2] = p->vlen; /* l_uint */
2362
		iarg[3] = p->flags; /* l_uint */
2363
		uarg[4] = (intptr_t) p->timeout; /* struct l_timespec * */
2364
		*n_args = 5;
2298
		break;
2365
		break;
2299
	}
2366
	}
2300
	/* linux_fanotify_init */
2367
	/* linux_fanotify_init */
Lines 2309-2315 Link Here
2309
	}
2376
	}
2310
	/* linux_prlimit64 */
2377
	/* linux_prlimit64 */
2311
	case 340: {
2378
	case 340: {
2312
		*n_args = 0;
2379
		struct linux_prlimit64_args *p = params;
2380
		iarg[0] = p->pid; /* l_pid_t */
2381
		iarg[1] = p->resource; /* l_uint */
2382
		uarg[2] = (intptr_t) p->new; /* struct rlimit * */
2383
		uarg[3] = (intptr_t) p->old; /* struct rlimit * */
2384
		*n_args = 4;
2313
		break;
2385
		break;
2314
	}
2386
	}
2315
	/* linux_name_to_handle_at */
2387
	/* linux_name_to_handle_at */
Lines 2329-2340 Link Here
2329
	}
2401
	}
2330
	/* linux_syncfs */
2402
	/* linux_syncfs */
2331
	case 344: {
2403
	case 344: {
2332
		*n_args = 0;
2404
		struct linux_syncfs_args *p = params;
2405
		iarg[0] = p->fd; /* l_int */
2406
		*n_args = 1;
2333
		break;
2407
		break;
2334
	}
2408
	}
2335
	/* linux_sendmmsg */
2409
	/* linux_sendmmsg */
2336
	case 345: {
2410
	case 345: {
2337
		*n_args = 0;
2411
		struct linux_sendmmsg_args *p = params;
2412
		iarg[0] = p->s; /* l_int */
2413
		uarg[1] = (intptr_t) p->msg; /* struct l_mmsghdr * */
2414
		iarg[2] = p->vlen; /* l_uint */
2415
		iarg[3] = p->flags; /* l_uint */
2416
		*n_args = 4;
2338
		break;
2417
		break;
2339
	}
2418
	}
2340
	/* linux_setns */
2419
	/* linux_setns */
Lines 2363-2369 Link Here
2363
	const char *p = NULL;
2442
	const char *p = NULL;
2364
	switch (sysnum) {
2443
	switch (sysnum) {
2365
#define	nosys	linux_nosys
2444
#define	nosys	linux_nosys
2366
	/* sys_exit */
2445
	/* linux_exit */
2367
	case 1:
2446
	case 1:
2368
		switch(ndx) {
2447
		switch(ndx) {
2369
		case 0:
2448
		case 0:
Lines 3982-4008 Link Here
3982
	/* munlockall */
4061
	/* munlockall */
3983
	case 153:
4062
	case 153:
3984
		break;
4063
		break;
3985
	/* sched_setparam */
4064
	/* linux_sched_setparam */
3986
	case 154:
4065
	case 154:
3987
		switch(ndx) {
4066
		switch(ndx) {
3988
		case 0:
4067
		case 0:
3989
			p = "pid_t";
4068
			p = "l_pid_t";
3990
			break;
4069
			break;
3991
		case 1:
4070
		case 1:
3992
			p = "const struct sched_param *";
4071
			p = "struct l_sched_param *";
3993
			break;
4072
			break;
3994
		default:
4073
		default:
3995
			break;
4074
			break;
3996
		};
4075
		};
3997
		break;
4076
		break;
3998
	/* sched_getparam */
4077
	/* linux_sched_getparam */
3999
	case 155:
4078
	case 155:
4000
		switch(ndx) {
4079
		switch(ndx) {
4001
		case 0:
4080
		case 0:
4002
			p = "pid_t";
4081
			p = "l_pid_t";
4003
			break;
4082
			break;
4004
		case 1:
4083
		case 1:
4005
			p = "struct sched_param *";
4084
			p = "struct l_sched_param *";
4006
			break;
4085
			break;
4007
		default:
4086
		default:
4008
			break;
4087
			break;
Lines 4057-4063 Link Here
4057
			break;
4136
			break;
4058
		};
4137
		};
4059
		break;
4138
		break;
4060
	/* sched_rr_get_interval */
4139
	/* linux_sched_rr_get_interval */
4061
	case 161:
4140
	case 161:
4062
		switch(ndx) {
4141
		switch(ndx) {
4063
		case 0:
4142
		case 0:
Lines 4298-4303 Link Here
4298
		break;
4377
		break;
4299
	/* linux_rt_sigqueueinfo */
4378
	/* linux_rt_sigqueueinfo */
4300
	case 178:
4379
	case 178:
4380
		switch(ndx) {
4381
		case 0:
4382
			p = "l_pid_t";
4383
			break;
4384
		case 1:
4385
			p = "l_int";
4386
			break;
4387
		case 2:
4388
			p = "l_siginfo_t *";
4389
			break;
4390
		default:
4391
			break;
4392
		};
4301
		break;
4393
		break;
4302
	/* linux_rt_sigsuspend */
4394
	/* linux_rt_sigsuspend */
4303
	case 179:
4395
	case 179:
Lines 4970-4981 Link Here
4970
		break;
5062
		break;
4971
	/* linux_epoll_create */
5063
	/* linux_epoll_create */
4972
	case 254:
5064
	case 254:
5065
		switch(ndx) {
5066
		case 0:
5067
			p = "l_int";
5068
			break;
5069
		default:
5070
			break;
5071
		};
4973
		break;
5072
		break;
4974
	/* linux_epoll_ctl */
5073
	/* linux_epoll_ctl */
4975
	case 255:
5074
	case 255:
5075
		switch(ndx) {
5076
		case 0:
5077
			p = "l_int";
5078
			break;
5079
		case 1:
5080
			p = "l_int";
5081
			break;
5082
		case 2:
5083
			p = "l_int";
5084
			break;
5085
		case 3:
5086
			p = "struct epoll_event *";
5087
			break;
5088
		default:
5089
			break;
5090
		};
4976
		break;
5091
		break;
4977
	/* linux_epoll_wait */
5092
	/* linux_epoll_wait */
4978
	case 256:
5093
	case 256:
5094
		switch(ndx) {
5095
		case 0:
5096
			p = "l_int";
5097
			break;
5098
		case 1:
5099
			p = "struct epoll_event *";
5100
			break;
5101
		case 2:
5102
			p = "l_int";
5103
			break;
5104
		case 3:
5105
			p = "l_int";
5106
			break;
5107
		default:
5108
			break;
5109
		};
4979
		break;
5110
		break;
4980
	/* linux_remap_file_pages */
5111
	/* linux_remap_file_pages */
4981
	case 257:
5112
	case 257:
Lines 5299-5304 Link Here
5299
		break;
5430
		break;
5300
	/* linux_waitid */
5431
	/* linux_waitid */
5301
	case 284:
5432
	case 284:
5433
		switch(ndx) {
5434
		case 0:
5435
			p = "int";
5436
			break;
5437
		case 1:
5438
			p = "l_pid_t";
5439
			break;
5440
		case 2:
5441
			p = "l_siginfo_t *";
5442
			break;
5443
		case 3:
5444
			p = "int";
5445
			break;
5446
		case 4:
5447
			p = "struct l_rusage *";
5448
			break;
5449
		default:
5450
			break;
5451
		};
5302
		break;
5452
		break;
5303
	/* linux_add_key */
5453
	/* linux_add_key */
5304
	case 286:
5454
	case 286:
Lines 5558-5566 Link Here
5558
		case 2:
5708
		case 2:
5559
			p = "l_int";
5709
			p = "l_int";
5560
			break;
5710
			break;
5561
		case 3:
5562
			p = "l_int";
5563
			break;
5564
		default:
5711
		default:
5565
			break;
5712
			break;
5566
		};
5713
		};
Lines 5567-5575 Link Here
5567
		break;
5714
		break;
5568
	/* linux_pselect6 */
5715
	/* linux_pselect6 */
5569
	case 308:
5716
	case 308:
5717
		switch(ndx) {
5718
		case 0:
5719
			p = "l_int";
5720
			break;
5721
		case 1:
5722
			p = "l_fd_set *";
5723
			break;
5724
		case 2:
5725
			p = "l_fd_set *";
5726
			break;
5727
		case 3:
5728
			p = "l_fd_set *";
5729
			break;
5730
		case 4:
5731
			p = "struct l_timespec *";
5732
			break;
5733
		case 5:
5734
			p = "l_uintptr_t *";
5735
			break;
5736
		default:
5737
			break;
5738
		};
5570
		break;
5739
		break;
5571
	/* linux_ppoll */
5740
	/* linux_ppoll */
5572
	case 309:
5741
	case 309:
5742
		switch(ndx) {
5743
		case 0:
5744
			p = "struct pollfd *";
5745
			break;
5746
		case 1:
5747
			p = "uint32_t";
5748
			break;
5749
		case 2:
5750
			p = "struct l_timespec *";
5751
			break;
5752
		case 3:
5753
			p = "l_sigset_t *";
5754
			break;
5755
		case 4:
5756
			p = "l_size_t";
5757
			break;
5758
		default:
5759
			break;
5760
		};
5573
		break;
5761
		break;
5574
	/* linux_unshare */
5762
	/* linux_unshare */
5575
	case 310:
5763
	case 310:
Lines 5623-5631 Link Here
5623
		break;
5811
		break;
5624
	/* linux_epoll_pwait */
5812
	/* linux_epoll_pwait */
5625
	case 319:
5813
	case 319:
5814
		switch(ndx) {
5815
		case 0:
5816
			p = "l_int";
5817
			break;
5818
		case 1:
5819
			p = "struct epoll_event *";
5820
			break;
5821
		case 2:
5822
			p = "l_int";
5823
			break;
5824
		case 3:
5825
			p = "l_int";
5826
			break;
5827
		case 4:
5828
			p = "l_sigset_t *";
5829
			break;
5830
		default:
5831
			break;
5832
		};
5626
		break;
5833
		break;
5627
	/* linux_utimensat */
5834
	/* linux_utimensat */
5628
	case 320:
5835
	case 320:
5836
		switch(ndx) {
5837
		case 0:
5838
			p = "l_int";
5839
			break;
5840
		case 1:
5841
			p = "const char *";
5842
			break;
5843
		case 2:
5844
			p = "const struct l_timespec *";
5845
			break;
5846
		case 3:
5847
			p = "l_int";
5848
			break;
5849
		default:
5850
			break;
5851
		};
5629
		break;
5852
		break;
5630
	/* linux_signalfd */
5853
	/* linux_signalfd */
5631
	case 321:
5854
	case 321:
Lines 5635-5643 Link Here
5635
		break;
5858
		break;
5636
	/* linux_eventfd */
5859
	/* linux_eventfd */
5637
	case 323:
5860
	case 323:
5861
		switch(ndx) {
5862
		case 0:
5863
			p = "l_uint";
5864
			break;
5865
		default:
5866
			break;
5867
		};
5638
		break;
5868
		break;
5639
	/* linux_fallocate */
5869
	/* linux_fallocate */
5640
	case 324:
5870
	case 324:
5871
		switch(ndx) {
5872
		case 0:
5873
			p = "l_int";
5874
			break;
5875
		case 1:
5876
			p = "l_int";
5877
			break;
5878
		case 2:
5879
			p = "l_loff_t";
5880
			break;
5881
		case 3:
5882
			p = "l_loff_t";
5883
			break;
5884
		default:
5885
			break;
5886
		};
5641
		break;
5887
		break;
5642
	/* linux_timerfd_settime */
5888
	/* linux_timerfd_settime */
5643
	case 325:
5889
	case 325:
Lines 5650-5661 Link Here
5650
		break;
5896
		break;
5651
	/* linux_eventfd2 */
5897
	/* linux_eventfd2 */
5652
	case 328:
5898
	case 328:
5899
		switch(ndx) {
5900
		case 0:
5901
			p = "l_uint";
5902
			break;
5903
		case 1:
5904
			p = "l_int";
5905
			break;
5906
		default:
5907
			break;
5908
		};
5653
		break;
5909
		break;
5654
	/* linux_epoll_create1 */
5910
	/* linux_epoll_create1 */
5655
	case 329:
5911
	case 329:
5912
		switch(ndx) {
5913
		case 0:
5914
			p = "l_int";
5915
			break;
5916
		default:
5917
			break;
5918
		};
5656
		break;
5919
		break;
5657
	/* linux_dup3 */
5920
	/* linux_dup3 */
5658
	case 330:
5921
	case 330:
5922
		switch(ndx) {
5923
		case 0:
5924
			p = "l_int";
5925
			break;
5926
		case 1:
5927
			p = "l_int";
5928
			break;
5929
		case 2:
5930
			p = "l_int";
5931
			break;
5932
		default:
5933
			break;
5934
		};
5659
		break;
5935
		break;
5660
	/* linux_pipe2 */
5936
	/* linux_pipe2 */
5661
	case 331:
5937
	case 331:
Lines 5687-5692 Link Here
5687
		break;
5963
		break;
5688
	/* linux_recvmmsg */
5964
	/* linux_recvmmsg */
5689
	case 337:
5965
	case 337:
5966
		switch(ndx) {
5967
		case 0:
5968
			p = "l_int";
5969
			break;
5970
		case 1:
5971
			p = "struct l_mmsghdr *";
5972
			break;
5973
		case 2:
5974
			p = "l_uint";
5975
			break;
5976
		case 3:
5977
			p = "l_uint";
5978
			break;
5979
		case 4:
5980
			p = "struct l_timespec *";
5981
			break;
5982
		default:
5983
			break;
5984
		};
5690
		break;
5985
		break;
5691
	/* linux_fanotify_init */
5986
	/* linux_fanotify_init */
5692
	case 338:
5987
	case 338:
Lines 5696-5701 Link Here
5696
		break;
5991
		break;
5697
	/* linux_prlimit64 */
5992
	/* linux_prlimit64 */
5698
	case 340:
5993
	case 340:
5994
		switch(ndx) {
5995
		case 0:
5996
			p = "l_pid_t";
5997
			break;
5998
		case 1:
5999
			p = "l_uint";
6000
			break;
6001
		case 2:
6002
			p = "struct rlimit *";
6003
			break;
6004
		case 3:
6005
			p = "struct rlimit *";
6006
			break;
6007
		default:
6008
			break;
6009
		};
5699
		break;
6010
		break;
5700
	/* linux_name_to_handle_at */
6011
	/* linux_name_to_handle_at */
5701
	case 341:
6012
	case 341:
Lines 5708-5716 Link Here
5708
		break;
6019
		break;
5709
	/* linux_syncfs */
6020
	/* linux_syncfs */
5710
	case 344:
6021
	case 344:
6022
		switch(ndx) {
6023
		case 0:
6024
			p = "l_int";
6025
			break;
6026
		default:
6027
			break;
6028
		};
5711
		break;
6029
		break;
5712
	/* linux_sendmmsg */
6030
	/* linux_sendmmsg */
5713
	case 345:
6031
	case 345:
6032
		switch(ndx) {
6033
		case 0:
6034
			p = "l_int";
6035
			break;
6036
		case 1:
6037
			p = "struct l_mmsghdr *";
6038
			break;
6039
		case 2:
6040
			p = "l_uint";
6041
			break;
6042
		case 3:
6043
			p = "l_uint";
6044
			break;
6045
		default:
6046
			break;
6047
		};
5714
		break;
6048
		break;
5715
	/* linux_setns */
6049
	/* linux_setns */
5716
	case 346:
6050
	case 346:
Lines 5733-5739 Link Here
5733
	const char *p = NULL;
6067
	const char *p = NULL;
5734
	switch (sysnum) {
6068
	switch (sysnum) {
5735
#define	nosys	linux_nosys
6069
#define	nosys	linux_nosys
5736
	/* sys_exit */
6070
	/* linux_exit */
5737
	case 1:
6071
	case 1:
5738
		if (ndx == 0 || ndx == 1)
6072
		if (ndx == 0 || ndx == 1)
5739
			p = "void";
6073
			p = "void";
Lines 6365-6376 Link Here
6365
		break;
6699
		break;
6366
	/* munlockall */
6700
	/* munlockall */
6367
	case 153:
6701
	case 153:
6368
	/* sched_setparam */
6702
	/* linux_sched_setparam */
6369
	case 154:
6703
	case 154:
6370
		if (ndx == 0 || ndx == 1)
6704
		if (ndx == 0 || ndx == 1)
6371
			p = "int";
6705
			p = "int";
6372
		break;
6706
		break;
6373
	/* sched_getparam */
6707
	/* linux_sched_getparam */
6374
	case 155:
6708
	case 155:
6375
		if (ndx == 0 || ndx == 1)
6709
		if (ndx == 0 || ndx == 1)
6376
			p = "int";
6710
			p = "int";
Lines 6397-6403 Link Here
6397
		if (ndx == 0 || ndx == 1)
6731
		if (ndx == 0 || ndx == 1)
6398
			p = "int";
6732
			p = "int";
6399
		break;
6733
		break;
6400
	/* sched_rr_get_interval */
6734
	/* linux_sched_rr_get_interval */
6401
	case 161:
6735
	case 161:
6402
		if (ndx == 0 || ndx == 1)
6736
		if (ndx == 0 || ndx == 1)
6403
			p = "int";
6737
			p = "int";
Lines 6475-6480 Link Here
6475
		break;
6809
		break;
6476
	/* linux_rt_sigqueueinfo */
6810
	/* linux_rt_sigqueueinfo */
6477
	case 178:
6811
	case 178:
6812
		if (ndx == 0 || ndx == 1)
6813
			p = "int";
6814
		break;
6478
	/* linux_rt_sigsuspend */
6815
	/* linux_rt_sigsuspend */
6479
	case 179:
6816
	case 179:
6480
		if (ndx == 0 || ndx == 1)
6817
		if (ndx == 0 || ndx == 1)
Lines 6729-6738 Link Here
6729
	case 253:
7066
	case 253:
6730
	/* linux_epoll_create */
7067
	/* linux_epoll_create */
6731
	case 254:
7068
	case 254:
7069
		if (ndx == 0 || ndx == 1)
7070
			p = "int";
7071
		break;
6732
	/* linux_epoll_ctl */
7072
	/* linux_epoll_ctl */
6733
	case 255:
7073
	case 255:
7074
		if (ndx == 0 || ndx == 1)
7075
			p = "int";
7076
		break;
6734
	/* linux_epoll_wait */
7077
	/* linux_epoll_wait */
6735
	case 256:
7078
	case 256:
7079
		if (ndx == 0 || ndx == 1)
7080
			p = "int";
7081
		break;
6736
	/* linux_remap_file_pages */
7082
	/* linux_remap_file_pages */
6737
	case 257:
7083
	case 257:
6738
	/* linux_set_tid_address */
7084
	/* linux_set_tid_address */
Lines 6847-6852 Link Here
6847
	case 283:
7193
	case 283:
6848
	/* linux_waitid */
7194
	/* linux_waitid */
6849
	case 284:
7195
	case 284:
7196
		if (ndx == 0 || ndx == 1)
7197
			p = "int";
7198
		break;
6850
	/* linux_add_key */
7199
	/* linux_add_key */
6851
	case 286:
7200
	case 286:
6852
	/* linux_request_key */
7201
	/* linux_request_key */
Lines 6932-6939 Link Here
6932
		break;
7281
		break;
6933
	/* linux_pselect6 */
7282
	/* linux_pselect6 */
6934
	case 308:
7283
	case 308:
7284
		if (ndx == 0 || ndx == 1)
7285
			p = "int";
7286
		break;
6935
	/* linux_ppoll */
7287
	/* linux_ppoll */
6936
	case 309:
7288
	case 309:
7289
		if (ndx == 0 || ndx == 1)
7290
			p = "int";
7291
		break;
6937
	/* linux_unshare */
7292
	/* linux_unshare */
6938
	case 310:
7293
	case 310:
6939
	/* linux_set_robust_list */
7294
	/* linux_set_robust_list */
Lines 6960-6967 Link Here
6960
	case 318:
7315
	case 318:
6961
	/* linux_epoll_pwait */
7316
	/* linux_epoll_pwait */
6962
	case 319:
7317
	case 319:
7318
		if (ndx == 0 || ndx == 1)
7319
			p = "int";
7320
		break;
6963
	/* linux_utimensat */
7321
	/* linux_utimensat */
6964
	case 320:
7322
	case 320:
7323
		if (ndx == 0 || ndx == 1)
7324
			p = "int";
7325
		break;
6965
	/* linux_signalfd */
7326
	/* linux_signalfd */
6966
	case 321:
7327
	case 321:
6967
	/* linux_timerfd_create */
7328
	/* linux_timerfd_create */
Lines 6968-6975 Link Here
6968
	case 322:
7329
	case 322:
6969
	/* linux_eventfd */
7330
	/* linux_eventfd */
6970
	case 323:
7331
	case 323:
7332
		if (ndx == 0 || ndx == 1)
7333
			p = "int";
7334
		break;
6971
	/* linux_fallocate */
7335
	/* linux_fallocate */
6972
	case 324:
7336
	case 324:
7337
		if (ndx == 0 || ndx == 1)
7338
			p = "int";
7339
		break;
6973
	/* linux_timerfd_settime */
7340
	/* linux_timerfd_settime */
6974
	case 325:
7341
	case 325:
6975
	/* linux_timerfd_gettime */
7342
	/* linux_timerfd_gettime */
Lines 6978-6987 Link Here
6978
	case 327:
7345
	case 327:
6979
	/* linux_eventfd2 */
7346
	/* linux_eventfd2 */
6980
	case 328:
7347
	case 328:
7348
		if (ndx == 0 || ndx == 1)
7349
			p = "int";
7350
		break;
6981
	/* linux_epoll_create1 */
7351
	/* linux_epoll_create1 */
6982
	case 329:
7352
	case 329:
7353
		if (ndx == 0 || ndx == 1)
7354
			p = "int";
7355
		break;
6983
	/* linux_dup3 */
7356
	/* linux_dup3 */
6984
	case 330:
7357
	case 330:
7358
		if (ndx == 0 || ndx == 1)
7359
			p = "int";
7360
		break;
6985
	/* linux_pipe2 */
7361
	/* linux_pipe2 */
6986
	case 331:
7362
	case 331:
6987
		if (ndx == 0 || ndx == 1)
7363
		if (ndx == 0 || ndx == 1)
Lines 6999-7004 Link Here
6999
	case 336:
7375
	case 336:
7000
	/* linux_recvmmsg */
7376
	/* linux_recvmmsg */
7001
	case 337:
7377
	case 337:
7378
		if (ndx == 0 || ndx == 1)
7379
			p = "int";
7380
		break;
7002
	/* linux_fanotify_init */
7381
	/* linux_fanotify_init */
7003
	case 338:
7382
	case 338:
7004
	/* linux_fanotify_mark */
7383
	/* linux_fanotify_mark */
Lines 7005-7010 Link Here
7005
	case 339:
7384
	case 339:
7006
	/* linux_prlimit64 */
7385
	/* linux_prlimit64 */
7007
	case 340:
7386
	case 340:
7387
		if (ndx == 0 || ndx == 1)
7388
			p = "int";
7389
		break;
7008
	/* linux_name_to_handle_at */
7390
	/* linux_name_to_handle_at */
7009
	case 341:
7391
	case 341:
7010
	/* linux_open_by_handle_at */
7392
	/* linux_open_by_handle_at */
Lines 7013-7020 Link Here
7013
	case 343:
7395
	case 343:
7014
	/* linux_syncfs */
7396
	/* linux_syncfs */
7015
	case 344:
7397
	case 344:
7398
		if (ndx == 0 || ndx == 1)
7399
			p = "int";
7400
		break;
7016
	/* linux_sendmmsg */
7401
	/* linux_sendmmsg */
7017
	case 345:
7402
	case 345:
7403
		if (ndx == 0 || ndx == 1)
7404
			p = "int";
7405
		break;
7018
	/* linux_setns */
7406
	/* linux_setns */
7019
	case 346:
7407
	case 346:
7020
	/* linux_process_vm_readv */
7408
	/* linux_process_vm_readv */
(-)sys/i386/linux/linux_sysvec.c (-79 / +123 lines)
Lines 44-49 Link Here
44
#include <sys/proc.h>
44
#include <sys/proc.h>
45
#include <sys/signalvar.h>
45
#include <sys/signalvar.h>
46
#include <sys/syscallsubr.h>
46
#include <sys/syscallsubr.h>
47
#include <sys/sysctl.h>
47
#include <sys/sysent.h>
48
#include <sys/sysent.h>
48
#include <sys/sysproto.h>
49
#include <sys/sysproto.h>
49
#include <sys/vnode.h>
50
#include <sys/vnode.h>
Lines 71-81 Link Here
71
#include <compat/linux/linux_misc.h>
72
#include <compat/linux/linux_misc.h>
72
#include <compat/linux/linux_signal.h>
73
#include <compat/linux/linux_signal.h>
73
#include <compat/linux/linux_util.h>
74
#include <compat/linux/linux_util.h>
75
#include <compat/linux/linux_vdso.h>
74
76
75
MODULE_VERSION(linux, 1);
77
MODULE_VERSION(linux, 1);
76
78
77
MALLOC_DEFINE(M_LINUX, "linux", "Linux mode structures");
78
79
#if BYTE_ORDER == LITTLE_ENDIAN
79
#if BYTE_ORDER == LITTLE_ENDIAN
80
#define SHELLMAGIC      0x2123 /* #! */
80
#define SHELLMAGIC      0x2123 /* #! */
81
#else
81
#else
Lines 82-87 Link Here
82
#define SHELLMAGIC      0x2321
82
#define SHELLMAGIC      0x2321
83
#endif
83
#endif
84
84
85
#if defined(DEBUG)
86
SYSCTL_PROC(_compat_linux, OID_AUTO, debug,
87
            CTLTYPE_STRING | CTLFLAG_RW,
88
            0, 0, linux_sysctl_debug, "A",
89
            "Linux debugging control");
90
#endif
91
85
/*
92
/*
86
 * Allow the sendsig functions to use the ldebug() facility
93
 * Allow the sendsig functions to use the ldebug() facility
87
 * even though they are not syscalls themselves. Map them
94
 * even though they are not syscalls themselves. Map them
Lines 93-105 Link Here
93
100
94
#define	LINUX_PS_STRINGS	(LINUX_USRSTACK - sizeof(struct ps_strings))
101
#define	LINUX_PS_STRINGS	(LINUX_USRSTACK - sizeof(struct ps_strings))
95
102
96
extern char linux_sigcode[];
103
static int linux_szsigcode;
97
extern int linux_szsigcode;
104
static vm_object_t linux_shared_page_obj;
105
static char *linux_shared_page_mapping;
106
extern char _binary_linux_locore_o_start;
107
extern char _binary_linux_locore_o_end;
98
108
99
extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
109
extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
100
110
101
SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
111
SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
102
SET_DECLARE(linux_device_handler_set, struct linux_device_handler);
103
112
104
static int	linux_fixup(register_t **stack_base,
113
static int	linux_fixup(register_t **stack_base,
105
		    struct image_params *iparams);
114
		    struct image_params *iparams);
Lines 110-121 Link Here
110
		    struct image_params *imgp, u_long stack);
119
		    struct image_params *imgp, u_long stack);
111
static register_t *linux_copyout_strings(struct image_params *imgp);
120
static register_t *linux_copyout_strings(struct image_params *imgp);
112
static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel);
121
static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel);
122
static void	linux_vdso_install(void *param);
123
static void	linux_vdso_deinstall(void *param);
113
124
114
static int linux_szplatform;
125
static int linux_szplatform;
115
const char *linux_platform;
126
const char *linux_kplatform;
116
127
117
static eventhandler_tag linux_exit_tag;
128
static eventhandler_tag linux_exit_tag;
118
static eventhandler_tag linux_exec_tag;
129
static eventhandler_tag linux_exec_tag;
130
static eventhandler_tag linux_thread_dtor_tag;
119
131
120
/*
132
/*
121
 * Linux syscalls return negative errno's, we do positive and map them
133
 * Linux syscalls return negative errno's, we do positive and map them
Lines 137-164 Link Here
137
	 -72, -67, -71
149
	 -72, -67, -71
138
};
150
};
139
151
140
int bsd_to_linux_signal[LINUX_SIGTBLSZ] = {
141
	LINUX_SIGHUP, LINUX_SIGINT, LINUX_SIGQUIT, LINUX_SIGILL,
142
	LINUX_SIGTRAP, LINUX_SIGABRT, 0, LINUX_SIGFPE,
143
	LINUX_SIGKILL, LINUX_SIGBUS, LINUX_SIGSEGV, LINUX_SIGSYS,
144
	LINUX_SIGPIPE, LINUX_SIGALRM, LINUX_SIGTERM, LINUX_SIGURG,
145
	LINUX_SIGSTOP, LINUX_SIGTSTP, LINUX_SIGCONT, LINUX_SIGCHLD,
146
	LINUX_SIGTTIN, LINUX_SIGTTOU, LINUX_SIGIO, LINUX_SIGXCPU,
147
	LINUX_SIGXFSZ, LINUX_SIGVTALRM, LINUX_SIGPROF, LINUX_SIGWINCH,
148
	0, LINUX_SIGUSR1, LINUX_SIGUSR2
149
};
150
151
int linux_to_bsd_signal[LINUX_SIGTBLSZ] = {
152
	SIGHUP, SIGINT, SIGQUIT, SIGILL,
153
	SIGTRAP, SIGABRT, SIGBUS, SIGFPE,
154
	SIGKILL, SIGUSR1, SIGSEGV, SIGUSR2,
155
	SIGPIPE, SIGALRM, SIGTERM, SIGBUS,
156
	SIGCHLD, SIGCONT, SIGSTOP, SIGTSTP,
157
	SIGTTIN, SIGTTOU, SIGURG, SIGXCPU,
158
	SIGXFSZ, SIGVTALRM, SIGPROF, SIGWINCH,
159
	SIGIO, SIGURG, SIGSYS
160
};
161
162
#define LINUX_T_UNKNOWN  255
152
#define LINUX_T_UNKNOWN  255
163
static int _bsd_to_linux_trapcode[] = {
153
static int _bsd_to_linux_trapcode[] = {
164
	LINUX_T_UNKNOWN,	/* 0 */
154
	LINUX_T_UNKNOWN,	/* 0 */
Lines 198-203 Link Here
198
     _bsd_to_linux_trapcode[(code)]: \
188
     _bsd_to_linux_trapcode[(code)]: \
199
     LINUX_T_UNKNOWN)
189
     LINUX_T_UNKNOWN)
200
190
191
LINUX_VDSO_SYM_INTPTR(linux_sigcode);
192
LINUX_VDSO_SYM_INTPTR(linux_rt_sigcode);
193
LINUX_VDSO_SYM_INTPTR(linux_vsyscall);
194
201
/*
195
/*
202
 * If FreeBSD & Linux have a difference of opinion about what a trap
196
 * If FreeBSD & Linux have a difference of opinion about what a trap
203
 * means, deal with it here.
197
 * means, deal with it here.
Lines 208-222 Link Here
208
translate_traps(int signal, int trap_code)
202
translate_traps(int signal, int trap_code)
209
{
203
{
210
	if (signal != SIGBUS)
204
	if (signal != SIGBUS)
211
		return signal;
205
		return (signal);
212
	switch (trap_code) {
206
	switch (trap_code) {
213
	case T_PROTFLT:
207
	case T_PROTFLT:
214
	case T_TSSFLT:
208
	case T_TSSFLT:
215
	case T_DOUBLEFLT:
209
	case T_DOUBLEFLT:
216
	case T_PAGEFLT:
210
	case T_PAGEFLT:
217
		return SIGSEGV;
211
		return (SIGSEGV);
218
	default:
212
	default:
219
		return signal;
213
		return (signal);
220
	}
214
	}
221
}
215
}
222
216
Lines 254-259 Link Here
254
	args = (Elf32_Auxargs *)imgp->auxargs;
248
	args = (Elf32_Auxargs *)imgp->auxargs;
255
	pos = *stack_base + (imgp->args->argc + imgp->args->envc + 2);
249
	pos = *stack_base + (imgp->args->argc + imgp->args->envc + 2);
256
250
251
	AUXARGS_ENTRY(pos, LINUX_AT_SYSINFO_EHDR,
252
	    imgp->proc->p_sysent->sv_shared_page_base);
253
	AUXARGS_ENTRY(pos, LINUX_AT_SYSINFO, linux_vsyscall);
257
	AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, cpu_feature);
254
	AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, cpu_feature);
258
255
259
	/*
256
	/*
Lines 279-284 Link Here
279
	AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid);
276
	AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid);
280
	AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid);
277
	AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid);
281
	AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(uplatform));
278
	AUXARGS_ENTRY(pos, LINUX_AT_PLATFORM, PTROUT(uplatform));
279
	AUXARGS_ENTRY(pos, LINUX_AT_RANDOM, imgp->canary);
280
	if (imgp->execpathp != 0)
281
		AUXARGS_ENTRY(pos, LINUX_AT_EXECFN, imgp->execpathp);
282
	if (args->execfd != -1)
282
	if (args->execfd != -1)
283
		AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd);
283
		AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd);
284
	AUXARGS_ENTRY(pos, AT_NULL, 0);
284
	AUXARGS_ENTRY(pos, AT_NULL, 0);
Lines 302-325 Link Here
302
	char *stringp, *destp;
302
	char *stringp, *destp;
303
	register_t *stack_base;
303
	register_t *stack_base;
304
	struct ps_strings *arginfo;
304
	struct ps_strings *arginfo;
305
	char canary[LINUX_AT_RANDOM_LEN];
306
	size_t execpath_len;
305
	struct proc *p;
307
	struct proc *p;
306
308
307
	/*
309
	/*
308
	 * Calculate string base and vector table pointers.
310
	 * Calculate string base and vector table pointers.
309
	 * Also deal with signal trampoline code for this exec type.
310
	 */
311
	 */
311
	p = imgp->proc;
312
	p = imgp->proc;
313
	if (imgp->execpath != NULL && imgp->auxargs != NULL)
314
		execpath_len = strlen(imgp->execpath) + 1;
315
	else
316
		execpath_len = 0;
312
	arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings;
317
	arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings;
313
	destp = (caddr_t)arginfo - SPARE_USRSPACE - linux_szplatform -
318
	destp = (caddr_t)arginfo - SPARE_USRSPACE - linux_szplatform -
319
	    roundup(sizeof(canary), sizeof(char *)) -
320
	    roundup(execpath_len, sizeof(char *)) -
314
	    roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *));
321
	    roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *));
315
322
316
	/*
323
	/*
317
	 * install LINUX_PLATFORM
324
	 * install LINUX_PLATFORM
318
	 */
325
	 */
319
	copyout(linux_platform, ((caddr_t)arginfo - linux_szplatform),
326
	copyout(linux_kplatform, ((caddr_t)arginfo - linux_szplatform),
320
	    linux_szplatform);
327
	    linux_szplatform);
321
328
329
	if (execpath_len != 0) {
330
		imgp->execpathp = (uintptr_t)arginfo -
331
		linux_szplatform - execpath_len;
332
		copyout(imgp->execpath, (void *)imgp->execpathp, execpath_len);
333
	}
334
322
	/*
335
	/*
336
	 * Prepare the canary for SSP.
337
	 */
338
	arc4rand(canary, sizeof(canary), 0);
339
	imgp->canary = (uintptr_t)arginfo - linux_szplatform -
340
	    roundup(execpath_len, sizeof(char *)) -
341
	    roundup(sizeof(canary), sizeof(char *));
342
	copyout(canary, (void *)imgp->canary, sizeof(canary));
343
344
	/*
323
	 * If we have a valid auxargs ptr, prepare some room
345
	 * If we have a valid auxargs ptr, prepare some room
324
	 * on the stack.
346
	 * on the stack.
325
	 */
347
	 */
Lines 398-407 Link Here
398
	return (stack_base);
420
	return (stack_base);
399
}
421
}
400
422
401
402
403
extern unsigned long linux_sznonrtsigcode;
404
405
static void
423
static void
406
linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
424
linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
407
{
425
{
Lines 440-448 Link Here
440
	/*
458
	/*
441
	 * Build the argument list for the signal handler.
459
	 * Build the argument list for the signal handler.
442
	 */
460
	 */
443
	if (p->p_sysent->sv_sigtbl)
461
	sig = bsd_to_linux_signal(sig);
444
		if (sig <= p->p_sysent->sv_sigsize)
445
			sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
446
462
447
	bzero(&frame, sizeof(frame));
463
	bzero(&frame, sizeof(frame));
448
464
Lines 468-474 Link Here
468
484
469
	bsd_to_linux_sigset(mask, &frame.sf_sc.uc_sigmask);
485
	bsd_to_linux_sigset(mask, &frame.sf_sc.uc_sigmask);
470
486
471
	frame.sf_sc.uc_mcontext.sc_mask   = frame.sf_sc.uc_sigmask.__bits[0];
487
	frame.sf_sc.uc_mcontext.sc_mask   = frame.sf_sc.uc_sigmask.__mask;
472
	frame.sf_sc.uc_mcontext.sc_gs     = rgs();
488
	frame.sf_sc.uc_mcontext.sc_gs     = rgs();
473
	frame.sf_sc.uc_mcontext.sc_fs     = regs->tf_fs;
489
	frame.sf_sc.uc_mcontext.sc_fs     = regs->tf_fs;
474
	frame.sf_sc.uc_mcontext.sc_es     = regs->tf_es;
490
	frame.sf_sc.uc_mcontext.sc_es     = regs->tf_es;
Lines 477-482 Link Here
477
	frame.sf_sc.uc_mcontext.sc_esi    = regs->tf_esi;
493
	frame.sf_sc.uc_mcontext.sc_esi    = regs->tf_esi;
478
	frame.sf_sc.uc_mcontext.sc_ebp    = regs->tf_ebp;
494
	frame.sf_sc.uc_mcontext.sc_ebp    = regs->tf_ebp;
479
	frame.sf_sc.uc_mcontext.sc_ebx    = regs->tf_ebx;
495
	frame.sf_sc.uc_mcontext.sc_ebx    = regs->tf_ebx;
496
	frame.sf_sc.uc_mcontext.sc_esp    = regs->tf_esp;
480
	frame.sf_sc.uc_mcontext.sc_edx    = regs->tf_edx;
497
	frame.sf_sc.uc_mcontext.sc_edx    = regs->tf_edx;
481
	frame.sf_sc.uc_mcontext.sc_ecx    = regs->tf_ecx;
498
	frame.sf_sc.uc_mcontext.sc_ecx    = regs->tf_ecx;
482
	frame.sf_sc.uc_mcontext.sc_eax    = regs->tf_eax;
499
	frame.sf_sc.uc_mcontext.sc_eax    = regs->tf_eax;
Lines 514-520 Link Here
514
	 * Build context to run handler in.
531
	 * Build context to run handler in.
515
	 */
532
	 */
516
	regs->tf_esp = (int)fp;
533
	regs->tf_esp = (int)fp;
517
	regs->tf_eip = p->p_sysent->sv_sigcode_base + linux_sznonrtsigcode;
534
	regs->tf_eip = linux_rt_sigcode;
518
	regs->tf_eflags &= ~(PSL_T | PSL_VM | PSL_D);
535
	regs->tf_eflags &= ~(PSL_T | PSL_VM | PSL_D);
519
	regs->tf_cs = _ucodesel;
536
	regs->tf_cs = _ucodesel;
520
	regs->tf_ds = _udatasel;
537
	regs->tf_ds = _udatasel;
Lines 546-552 Link Here
546
	struct l_sigframe *fp, frame;
563
	struct l_sigframe *fp, frame;
547
	l_sigset_t lmask;
564
	l_sigset_t lmask;
548
	int sig, code;
565
	int sig, code;
549
	int oonstack, i;
566
	int oonstack;
550
567
551
	PROC_LOCK_ASSERT(p, MA_OWNED);
568
	PROC_LOCK_ASSERT(p, MA_OWNED);
552
	psp = p->p_sigacts;
569
	psp = p->p_sigacts;
Lines 582-590 Link Here
582
	/*
599
	/*
583
	 * Build the argument list for the signal handler.
600
	 * Build the argument list for the signal handler.
584
	 */
601
	 */
585
	if (p->p_sysent->sv_sigtbl)
602
	sig = bsd_to_linux_signal(sig);
586
		if (sig <= p->p_sysent->sv_sigsize)
587
			sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
588
603
589
	bzero(&frame, sizeof(frame));
604
	bzero(&frame, sizeof(frame));
590
605
Lines 596-602 Link Here
596
	/*
611
	/*
597
	 * Build the signal context to be used by sigreturn.
612
	 * Build the signal context to be used by sigreturn.
598
	 */
613
	 */
599
	frame.sf_sc.sc_mask   = lmask.__bits[0];
614
	frame.sf_sc.sc_mask   = lmask.__mask;
600
	frame.sf_sc.sc_gs     = rgs();
615
	frame.sf_sc.sc_gs     = rgs();
601
	frame.sf_sc.sc_fs     = regs->tf_fs;
616
	frame.sf_sc.sc_fs     = regs->tf_fs;
602
	frame.sf_sc.sc_es     = regs->tf_es;
617
	frame.sf_sc.sc_es     = regs->tf_es;
Lines 605-610 Link Here
605
	frame.sf_sc.sc_esi    = regs->tf_esi;
620
	frame.sf_sc.sc_esi    = regs->tf_esi;
606
	frame.sf_sc.sc_ebp    = regs->tf_ebp;
621
	frame.sf_sc.sc_ebp    = regs->tf_ebp;
607
	frame.sf_sc.sc_ebx    = regs->tf_ebx;
622
	frame.sf_sc.sc_ebx    = regs->tf_ebx;
623
	frame.sf_sc.sc_esp    = regs->tf_esp;
608
	frame.sf_sc.sc_edx    = regs->tf_edx;
624
	frame.sf_sc.sc_edx    = regs->tf_edx;
609
	frame.sf_sc.sc_ecx    = regs->tf_ecx;
625
	frame.sf_sc.sc_ecx    = regs->tf_ecx;
610
	frame.sf_sc.sc_eax    = regs->tf_eax;
626
	frame.sf_sc.sc_eax    = regs->tf_eax;
Lines 617-624 Link Here
617
	frame.sf_sc.sc_cr2    = (register_t)ksi->ksi_addr;
633
	frame.sf_sc.sc_cr2    = (register_t)ksi->ksi_addr;
618
	frame.sf_sc.sc_trapno = bsd_to_linux_trapcode(ksi->ksi_trapno);
634
	frame.sf_sc.sc_trapno = bsd_to_linux_trapcode(ksi->ksi_trapno);
619
635
620
	for (i = 0; i < (LINUX_NSIG_WORDS-1); i++)
636
	frame.sf_extramask[0] = lmask.__mask;
621
		frame.sf_extramask[i] = lmask.__bits[i+1];
622
637
623
	if (copyout(&frame, fp, sizeof(frame)) != 0) {
638
	if (copyout(&frame, fp, sizeof(frame)) != 0) {
624
		/*
639
		/*
Lines 633-639 Link Here
633
	 * Build context to run handler in.
648
	 * Build context to run handler in.
634
	 */
649
	 */
635
	regs->tf_esp = (int)fp;
650
	regs->tf_esp = (int)fp;
636
	regs->tf_eip = p->p_sysent->sv_sigcode_base;
651
	regs->tf_eip = linux_sigcode;
637
	regs->tf_eflags &= ~(PSL_T | PSL_VM | PSL_D);
652
	regs->tf_eflags &= ~(PSL_T | PSL_VM | PSL_D);
638
	regs->tf_cs = _ucodesel;
653
	regs->tf_cs = _ucodesel;
639
	regs->tf_ds = _udatasel;
654
	regs->tf_ds = _udatasel;
Lines 661-667 Link Here
661
	struct trapframe *regs;
676
	struct trapframe *regs;
662
	l_sigset_t lmask;
677
	l_sigset_t lmask;
663
	sigset_t bmask;
678
	sigset_t bmask;
664
	int eflags, i;
679
	int eflags;
665
	ksiginfo_t ksi;
680
	ksiginfo_t ksi;
666
681
667
	regs = td->td_frame;
682
	regs = td->td_frame;
Lines 684-690 Link Here
684
#define	EFLAGS_SECURE(ef, oef)	((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)
699
#define	EFLAGS_SECURE(ef, oef)	((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)
685
	eflags = frame.sf_sc.sc_eflags;
700
	eflags = frame.sf_sc.sc_eflags;
686
	if (!EFLAGS_SECURE(eflags, regs->tf_eflags))
701
	if (!EFLAGS_SECURE(eflags, regs->tf_eflags))
687
		return(EINVAL);
702
		return (EINVAL);
688
703
689
	/*
704
	/*
690
	 * Don't allow users to load a valid privileged %cs.  Let the
705
	 * Don't allow users to load a valid privileged %cs.  Let the
Lines 699-710 Link Here
699
		ksi.ksi_trapno = T_PROTFLT;
714
		ksi.ksi_trapno = T_PROTFLT;
700
		ksi.ksi_addr = (void *)regs->tf_eip;
715
		ksi.ksi_addr = (void *)regs->tf_eip;
701
		trapsignal(td, &ksi);
716
		trapsignal(td, &ksi);
702
		return(EINVAL);
717
		return (EINVAL);
703
	}
718
	}
704
719
705
	lmask.__bits[0] = frame.sf_sc.sc_mask;
720
	lmask.__mask = frame.sf_sc.sc_mask;
706
	for (i = 0; i < (LINUX_NSIG_WORDS-1); i++)
707
		lmask.__bits[i+1] = frame.sf_extramask[i];
708
	linux_to_bsd_sigset(&lmask, &bmask);
721
	linux_to_bsd_sigset(&lmask, &bmask);
709
	kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0);
722
	kern_sigprocmask(td, SIG_SETMASK, &bmask, NULL, 0);
710
723
Lines 775-781 Link Here
775
#define	EFLAGS_SECURE(ef, oef)	((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)
788
#define	EFLAGS_SECURE(ef, oef)	((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)
776
	eflags = context->sc_eflags;
789
	eflags = context->sc_eflags;
777
	if (!EFLAGS_SECURE(eflags, regs->tf_eflags))
790
	if (!EFLAGS_SECURE(eflags, regs->tf_eflags))
778
		return(EINVAL);
791
		return (EINVAL);
779
792
780
	/*
793
	/*
781
	 * Don't allow users to load a valid privileged %cs.  Let the
794
	 * Don't allow users to load a valid privileged %cs.  Let the
Lines 790-796 Link Here
790
		ksi.ksi_trapno = T_PROTFLT;
803
		ksi.ksi_trapno = T_PROTFLT;
791
		ksi.ksi_addr = (void *)regs->tf_eip;
804
		ksi.ksi_addr = (void *)regs->tf_eip;
792
		trapsignal(td, &ksi);
805
		trapsignal(td, &ksi);
793
		return(EINVAL);
806
		return (EINVAL);
794
	}
807
	}
795
808
796
	linux_to_bsd_sigset(&uc.uc_sigmask, &bmask);
809
	linux_to_bsd_sigset(&uc.uc_sigmask, &bmask);
Lines 852-858 Link Here
852
	sa->args[5] = frame->tf_ebp;	/* Unconfirmed */
865
	sa->args[5] = frame->tf_ebp;	/* Unconfirmed */
853
866
854
	if (sa->code >= p->p_sysent->sv_size)
867
	if (sa->code >= p->p_sysent->sv_size)
855
		sa->callp = &p->p_sysent->sv_table[0];
868
		/* nosys */
869
		sa->callp = &p->p_sysent->sv_table[LINUX_SYS_MAXSYSCALL];
856
 	else
870
 	else
857
 		sa->callp = &p->p_sysent->sv_table[sa->code];
871
 		sa->callp = &p->p_sysent->sv_table[sa->code];
858
	sa->narg = sa->callp->sy_narg;
872
	sa->narg = sa->callp->sy_narg;
Lines 942-955 Link Here
942
	.sv_size	= LINUX_SYS_MAXSYSCALL,
956
	.sv_size	= LINUX_SYS_MAXSYSCALL,
943
	.sv_table	= linux_sysent,
957
	.sv_table	= linux_sysent,
944
	.sv_mask	= 0,
958
	.sv_mask	= 0,
945
	.sv_sigsize	= LINUX_SIGTBLSZ,
959
	.sv_sigsize	= 0,
946
	.sv_sigtbl	= bsd_to_linux_signal,
960
	.sv_sigtbl	= NULL,
947
	.sv_errsize	= ELAST + 1,
961
	.sv_errsize	= ELAST + 1,
948
	.sv_errtbl	= bsd_to_linux_errno,
962
	.sv_errtbl	= bsd_to_linux_errno,
949
	.sv_transtrap	= translate_traps,
963
	.sv_transtrap	= translate_traps,
950
	.sv_fixup	= linux_fixup,
964
	.sv_fixup	= linux_fixup,
951
	.sv_sendsig	= linux_sendsig,
965
	.sv_sendsig	= linux_sendsig,
952
	.sv_sigcode	= linux_sigcode,
966
	.sv_sigcode	= &_binary_linux_locore_o_start,
953
	.sv_szsigcode	= &linux_szsigcode,
967
	.sv_szsigcode	= &linux_szsigcode,
954
	.sv_prepsyscall	= NULL,
968
	.sv_prepsyscall	= NULL,
955
	.sv_name	= "Linux a.out",
969
	.sv_name	= "Linux a.out",
Lines 973-978 Link Here
973
	.sv_shared_page_base = LINUX_SHAREDPAGE,
987
	.sv_shared_page_base = LINUX_SHAREDPAGE,
974
	.sv_shared_page_len = PAGE_SIZE,
988
	.sv_shared_page_len = PAGE_SIZE,
975
	.sv_schedtail	= linux_schedtail,
989
	.sv_schedtail	= linux_schedtail,
990
	.sv_thread_detach = linux_thread_detach,
991
	.sv_trap	= NULL,
976
};
992
};
977
INIT_SYSENTVEC(aout_sysvec, &linux_sysvec);
993
INIT_SYSENTVEC(aout_sysvec, &linux_sysvec);
978
994
Lines 980-993 Link Here
980
	.sv_size	= LINUX_SYS_MAXSYSCALL,
996
	.sv_size	= LINUX_SYS_MAXSYSCALL,
981
	.sv_table	= linux_sysent,
997
	.sv_table	= linux_sysent,
982
	.sv_mask	= 0,
998
	.sv_mask	= 0,
983
	.sv_sigsize	= LINUX_SIGTBLSZ,
999
	.sv_sigsize	= 0,
984
	.sv_sigtbl	= bsd_to_linux_signal,
1000
	.sv_sigtbl	= NULL,
985
	.sv_errsize	= ELAST + 1,
1001
	.sv_errsize	= ELAST + 1,
986
	.sv_errtbl	= bsd_to_linux_errno,
1002
	.sv_errtbl	= bsd_to_linux_errno,
987
	.sv_transtrap	= translate_traps,
1003
	.sv_transtrap	= translate_traps,
988
	.sv_fixup	= elf_linux_fixup,
1004
	.sv_fixup	= elf_linux_fixup,
989
	.sv_sendsig	= linux_sendsig,
1005
	.sv_sendsig	= linux_sendsig,
990
	.sv_sigcode	= linux_sigcode,
1006
	.sv_sigcode	= &_binary_linux_locore_o_start,
991
	.sv_szsigcode	= &linux_szsigcode,
1007
	.sv_szsigcode	= &linux_szsigcode,
992
	.sv_prepsyscall	= NULL,
1008
	.sv_prepsyscall	= NULL,
993
	.sv_name	= "Linux ELF",
1009
	.sv_name	= "Linux ELF",
Lines 1011-1019 Link Here
1011
	.sv_shared_page_base = LINUX_SHAREDPAGE,
1027
	.sv_shared_page_base = LINUX_SHAREDPAGE,
1012
	.sv_shared_page_len = PAGE_SIZE,
1028
	.sv_shared_page_len = PAGE_SIZE,
1013
	.sv_schedtail	= linux_schedtail,
1029
	.sv_schedtail	= linux_schedtail,
1030
	.sv_thread_detach = linux_thread_detach,
1031
	.sv_trap	= NULL,
1014
};
1032
};
1015
INIT_SYSENTVEC(elf_sysvec, &elf_linux_sysvec);
1016
1033
1034
static void
1035
linux_vdso_install(void *param)
1036
{
1037
1038
	linux_szsigcode = (&_binary_linux_locore_o_end - 
1039
	    &_binary_linux_locore_o_start);
1040
1041
	if (linux_szsigcode > elf_linux_sysvec.sv_shared_page_len)
1042
		panic("Linux invalid vdso size\n");
1043
1044
	__elfN(linux_vdso_fixup)(&elf_linux_sysvec);
1045
1046
	linux_shared_page_obj = __elfN(linux_shared_page_init)
1047
	    (&linux_shared_page_mapping);
1048
1049
	__elfN(linux_vdso_reloc)(&elf_linux_sysvec, LINUX_SHAREDPAGE);
1050
1051
	bcopy(elf_linux_sysvec.sv_sigcode, linux_shared_page_mapping,
1052
	    linux_szsigcode);
1053
	elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj;
1054
}
1055
SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY,
1056
    (sysinit_cfunc_t)linux_vdso_install, NULL);
1057
1058
static void
1059
linux_vdso_deinstall(void *param)
1060
{
1061
1062
	__elfN(linux_shared_page_fini)(linux_shared_page_obj);
1063
};
1064
SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST,
1065
    (sysinit_cfunc_t)linux_vdso_deinstall, NULL);
1066
1017
static char GNU_ABI_VENDOR[] = "GNU";
1067
static char GNU_ABI_VENDOR[] = "GNU";
1018
static int GNULINUX_ABI_DESC = 0;
1068
static int GNULINUX_ABI_DESC = 0;
1019
1069
Lines 1084-1090 Link Here
1084
	Elf32_Brandinfo **brandinfo;
1134
	Elf32_Brandinfo **brandinfo;
1085
	int error;
1135
	int error;
1086
	struct linux_ioctl_handler **lihp;
1136
	struct linux_ioctl_handler **lihp;
1087
	struct linux_device_handler **ldhp;
1088
1137
1089
	error = 0;
1138
	error = 0;
1090
1139
Lines 1097-1106 Link Here
1097
		if (error == 0) {
1146
		if (error == 0) {
1098
			SET_FOREACH(lihp, linux_ioctl_handler_set)
1147
			SET_FOREACH(lihp, linux_ioctl_handler_set)
1099
				linux_ioctl_register_handler(*lihp);
1148
				linux_ioctl_register_handler(*lihp);
1100
			SET_FOREACH(ldhp, linux_device_handler_set)
1101
				linux_device_register_handler(*ldhp);
1102
			mtx_init(&emul_lock, "emuldata lock", NULL, MTX_DEF);
1103
			sx_init(&emul_shared_lock, "emuldata->shared lock");
1104
			LIST_INIT(&futex_list);
1149
			LIST_INIT(&futex_list);
1105
			mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF);
1150
			mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF);
1106
			linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit,
1151
			linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit,
Lines 1107-1114 Link Here
1107
			      NULL, 1000);
1152
			      NULL, 1000);
1108
			linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec,
1153
			linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec,
1109
			      NULL, 1000);
1154
			      NULL, 1000);
1110
			linux_get_machine(&linux_platform);
1155
			linux_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor,
1111
			linux_szplatform = roundup(strlen(linux_platform) + 1,
1156
			    linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY);
1157
			linux_get_machine(&linux_kplatform);
1158
			linux_szplatform = roundup(strlen(linux_kplatform) + 1,
1112
			    sizeof(char *));
1159
			    sizeof(char *));
1113
			linux_osd_jail_register();
1160
			linux_osd_jail_register();
1114
			stclohz = (stathz ? stathz : hz);
1161
			stclohz = (stathz ? stathz : hz);
Lines 1131-1143 Link Here
1131
		if (error == 0) {
1178
		if (error == 0) {
1132
			SET_FOREACH(lihp, linux_ioctl_handler_set)
1179
			SET_FOREACH(lihp, linux_ioctl_handler_set)
1133
				linux_ioctl_unregister_handler(*lihp);
1180
				linux_ioctl_unregister_handler(*lihp);
1134
			SET_FOREACH(ldhp, linux_device_handler_set)
1135
				linux_device_unregister_handler(*ldhp);
1136
			mtx_destroy(&emul_lock);
1137
			sx_destroy(&emul_shared_lock);
1138
			mtx_destroy(&futex_mtx);
1181
			mtx_destroy(&futex_mtx);
1139
			EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
1182
			EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
1140
			EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
1183
			EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
1184
			EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag);
1141
			linux_osd_jail_deregister();
1185
			linux_osd_jail_deregister();
1142
			if (bootverbose)
1186
			if (bootverbose)
1143
				printf("Linux ELF exec handler removed\n");
1187
				printf("Linux ELF exec handler removed\n");
Lines 1145-1153 Link Here
1145
			printf("Could not deinstall ELF interpreter entry\n");
1189
			printf("Could not deinstall ELF interpreter entry\n");
1146
		break;
1190
		break;
1147
	default:
1191
	default:
1148
		return EOPNOTSUPP;
1192
		return (EOPNOTSUPP);
1149
	}
1193
	}
1150
	return error;
1194
	return (error);
1151
}
1195
}
1152
1196
1153
static moduledata_t linux_elf_mod = {
1197
static moduledata_t linux_elf_mod = {
(-)sys/i386/linux/linux_vdso.lds.s (+65 lines)
Line 0 Link Here
1
/*
2
 * Linker script for 32-bit vDSO.
3
 * Copied from Linux kernel arch/x86/vdso/vdso-layout.lds.S
4
 * and arch/x86/vdso/vdso32/vdso32.lds.S
5
 *
6
 * $FreeBSD$
7
 */
8
9
SECTIONS
10
{
11
	. = . + SIZEOF_HEADERS;
12
13
	.hash		: { *(.hash) }			:text
14
	.gnu.hash	: { *(.gnu.hash) }
15
	.dynsym		: { *(.dynsym) }
16
	.dynstr		: { *(.dynstr) }
17
	.gnu.version	: { *(.gnu.version) }
18
	.gnu.version_d	: { *(.gnu.version_d) }
19
	.gnu.version_r	: { *(.gnu.version_r) }
20
21
	.note		: { *(.note.*) }		:text	:note
22
23
	.eh_frame_hdr	: { *(.eh_frame_hdr) }		:text	:eh_frame_hdr
24
	.eh_frame	: { KEEP (*(.eh_frame)) }	:text
25
26
	.dynamic	: { *(.dynamic) }		:text	:dynamic
27
28
	.rodata		: { *(.rodata*) }		:text
29
	.data		: {
30
	      *(.data*)
31
	      *(.sdata*)
32
	      *(.got.plt) *(.got)
33
	      *(.gnu.linkonce.d.*)
34
	      *(.bss*)
35
	      *(.dynbss*)
36
	      *(.gnu.linkonce.b.*)
37
	}
38
39
	.altinstructions	: { *(.altinstructions) }
40
	.altinstr_replacement	: { *(.altinstr_replacement) }
41
42
	. = ALIGN(0x100);
43
	.text		: { *(.text*) }			:text	=0x90909090
44
}
45
46
PHDRS
47
{
48
	text		PT_LOAD		FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
49
	dynamic		PT_DYNAMIC	FLAGS(4);		/* PF_R */
50
	note		PT_NOTE		FLAGS(4);		/* PF_R */
51
	eh_frame_hdr	PT_GNU_EH_FRAME;
52
}
53
54
ENTRY(linux_vsyscall);
55
56
VERSION
57
{
58
	LINUX_2.5 {
59
	global:
60
		linux_vsyscall;
61
		linux_sigcode;
62
		linux_rt_sigcode;
63
	local: *;
64
	};
65
}
(-)sys/i386/linux/syscalls.master (-27 / +46 lines)
Lines 37-44 Link Here
37
; #ifdef's, etc. may be included, and are copied to the output files.
37
; #ifdef's, etc. may be included, and are copied to the output files.
38
38
39
0	AUE_NULL	UNIMPL	setup
39
0	AUE_NULL	UNIMPL	setup
40
1	AUE_EXIT	NOPROTO	{ void sys_exit(int rval); } exit \
40
1	AUE_EXIT	STD	{ void linux_exit(int rval); }
41
				    sys_exit_args void
42
2	AUE_FORK	STD	{ int linux_fork(void); }
41
2	AUE_FORK	STD	{ int linux_fork(void); }
43
3	AUE_NULL	NOPROTO	{ int read(int fd, char *buf, \
42
3	AUE_NULL	NOPROTO	{ int read(int fd, char *buf, \
44
				    u_int nbyte); }
43
				    u_int nbyte); }
Lines 270-279 Link Here
270
151	AUE_MUNLOCK	NOPROTO	{ int munlock(const void *addr, size_t len); }
269
151	AUE_MUNLOCK	NOPROTO	{ int munlock(const void *addr, size_t len); }
271
152	AUE_MLOCKALL	NOPROTO	{ int mlockall(int how); }
270
152	AUE_MLOCKALL	NOPROTO	{ int mlockall(int how); }
272
153	AUE_MUNLOCKALL	NOPROTO	{ int munlockall(void); }
271
153	AUE_MUNLOCKALL	NOPROTO	{ int munlockall(void); }
273
154	AUE_SCHED_SETPARAM	NOPROTO	{ int sched_setparam(pid_t pid, \
272
154	AUE_SCHED_SETPARAM	STD	{ int linux_sched_setparam(l_pid_t pid, \
274
				    const struct sched_param *param); }
273
				    struct l_sched_param *param); }
275
155	AUE_SCHED_GETPARAM	NOPROTO	{ int sched_getparam(pid_t pid, \
274
155	AUE_SCHED_GETPARAM	STD	{ int linux_sched_getparam(l_pid_t pid, \
276
				    struct sched_param *param); }
275
				    struct l_sched_param *param); }
277
156	AUE_SCHED_SETSCHEDULER	STD { int linux_sched_setscheduler( \
276
156	AUE_SCHED_SETSCHEDULER	STD { int linux_sched_setscheduler( \
278
				    l_pid_t pid, l_int policy, \
277
				    l_pid_t pid, l_int policy, \
279
				    struct l_sched_param *param); }
278
				    struct l_sched_param *param); }
Lines 284-291 Link Here
284
				    l_int policy); }
283
				    l_int policy); }
285
160	AUE_SCHED_GET_PRIORITY_MIN	STD { int linux_sched_get_priority_min( \
284
160	AUE_SCHED_GET_PRIORITY_MIN	STD { int linux_sched_get_priority_min( \
286
				    l_int policy); }
285
				    l_int policy); }
287
161	AUE_SCHED_RR_GET_INTERVAL	NOPROTO	{ int sched_rr_get_interval(l_pid_t pid, \
286
161	AUE_SCHED_RR_GET_INTERVAL	STD	{ int linux_sched_rr_get_interval( \
288
				    struct l_timespec *interval); }
287
				    l_pid_t pid, struct l_timespec *interval); }
289
162	AUE_NULL	STD	{ int linux_nanosleep( \
288
162	AUE_NULL	STD	{ int linux_nanosleep( \
290
				    const struct l_timespec *rqtp, \
289
				    const struct l_timespec *rqtp, \
291
				    struct l_timespec *rmtp); }
290
				    struct l_timespec *rmtp); }
Lines 321-327 Link Here
321
				    l_siginfo_t *ptr, \
320
				    l_siginfo_t *ptr, \
322
				    struct l_timeval *timeout, \
321
				    struct l_timeval *timeout, \
323
				    l_size_t sigsetsize); }
322
				    l_size_t sigsetsize); }
324
178	AUE_NULL	STD	{ int linux_rt_sigqueueinfo(void); }
323
178	AUE_NULL	STD	{ int linux_rt_sigqueueinfo(l_pid_t pid, l_int sig, \
324
				    l_siginfo_t *info); }
325
179	AUE_NULL	STD	{ int linux_rt_sigsuspend( \
325
179	AUE_NULL	STD	{ int linux_rt_sigsuspend( \
326
				    l_sigset_t *newset, \
326
				    l_sigset_t *newset, \
327
				    l_size_t sigsetsize); }
327
				    l_size_t sigsetsize); }
Lines 432-440 Link Here
432
251	AUE_NULL	UNIMPL
432
251	AUE_NULL	UNIMPL
433
252	AUE_EXIT	STD	{ int linux_exit_group(int error_code); }
433
252	AUE_EXIT	STD	{ int linux_exit_group(int error_code); }
434
253	AUE_NULL	STD	{ int linux_lookup_dcookie(void); }
434
253	AUE_NULL	STD	{ int linux_lookup_dcookie(void); }
435
254	AUE_NULL	STD	{ int linux_epoll_create(void); }
435
254	AUE_NULL	STD	{ int linux_epoll_create(l_int size); }
436
255	AUE_NULL	STD	{ int linux_epoll_ctl(void); }
436
255	AUE_NULL	STD	{ int linux_epoll_ctl(l_int epfd, l_int op, l_int fd, \
437
256	AUE_NULL	STD	{ int linux_epoll_wait(void); }
437
					struct epoll_event *event); }
438
256	AUE_NULL	STD	{ int linux_epoll_wait(l_int epfd, struct epoll_event *events, \
439
					l_int maxevents, l_int timeout); }
438
257	AUE_NULL	STD	{ int linux_remap_file_pages(void); }
440
257	AUE_NULL	STD	{ int linux_remap_file_pages(void); }
439
258	AUE_NULL	STD	{ int linux_set_tid_address(int *tidptr); }
441
258	AUE_NULL	STD	{ int linux_set_tid_address(int *tidptr); }
440
259	AUE_NULL	STD	{ int linux_timer_create(clockid_t clock_id, \
442
259	AUE_NULL	STD	{ int linux_timer_create(clockid_t clock_id, \
Lines 475-481 Link Here
475
282	AUE_NULL	STD	{ int linux_mq_getsetattr(l_mqd_t mqd, const struct mq_attr *attr, \
477
282	AUE_NULL	STD	{ int linux_mq_getsetattr(l_mqd_t mqd, const struct mq_attr *attr, \
476
					struct mq_attr *oattr); }
478
					struct mq_attr *oattr); }
477
283	AUE_NULL	STD	{ int linux_kexec_load(void); }
479
283	AUE_NULL	STD	{ int linux_kexec_load(void); }
478
284	AUE_NULL	STD	{ int linux_waitid(void); }
480
284	AUE_WAIT6	STD	{ int linux_waitid(int idtype, l_pid_t id, l_siginfo_t *info, \
481
					int options, struct l_rusage *rusage); }
479
285	AUE_NULL	UNIMPL
482
285	AUE_NULL	UNIMPL
480
; linux 2.6.11:
483
; linux 2.6.11:
481
286	AUE_NULL	STD	{ int linux_add_key(void); }
484
286	AUE_NULL	STD	{ int linux_add_key(void); }
Lines 513-521 Link Here
513
					char *buf, l_int bufsiz); }
516
					char *buf, l_int bufsiz); }
514
306	AUE_FCHMODAT	STD	{ int linux_fchmodat(l_int dfd, const char *filename, \
517
306	AUE_FCHMODAT	STD	{ int linux_fchmodat(l_int dfd, const char *filename, \
515
					l_mode_t mode); }
518
					l_mode_t mode); }
516
307	AUE_FACCESSAT	STD	{ int linux_faccessat(l_int dfd, const char *filename, l_int amode, l_int flag); }
519
307	AUE_FACCESSAT	STD	{ int linux_faccessat(l_int dfd, const char *filename, l_int amode); }
517
308	AUE_NULL	STD	{ int linux_pselect6(void); }
520
308	AUE_SELECT	STD	{ int linux_pselect6(l_int nfds, l_fd_set *readfds,	\
518
309	AUE_NULL	STD	{ int linux_ppoll(void); }
521
					l_fd_set *writefds, l_fd_set *exceptfds,	\
522
					struct l_timespec *tsp, l_uintptr_t *sig); }
523
309	AUE_POLL	STD	{ int linux_ppoll(struct pollfd *fds, uint32_t nfds,	\
524
				    struct l_timespec *tsp, l_sigset_t *sset, l_size_t ssize); }
519
310	AUE_NULL	STD	{ int linux_unshare(void); }
525
310	AUE_NULL	STD	{ int linux_unshare(void); }
520
; linux 2.6.17:
526
; linux 2.6.17:
521
311	AUE_NULL	STD	{ int linux_set_robust_list(struct linux_robust_list_head *head, \
527
311	AUE_NULL	STD	{ int linux_set_robust_list(struct linux_robust_list_head *head, \
Lines 530-551 Link Here
530
317	AUE_NULL	STD	{ int linux_move_pages(void); }
536
317	AUE_NULL	STD	{ int linux_move_pages(void); }
531
; linux 2.6.19:
537
; linux 2.6.19:
532
318	AUE_NULL	STD	{ int linux_getcpu(void); }
538
318	AUE_NULL	STD	{ int linux_getcpu(void); }
533
319	AUE_NULL	STD	{ int linux_epoll_pwait(void); }
539
319	AUE_NULL	STD	{ int linux_epoll_pwait(l_int epfd, struct epoll_event *events, \
540
					l_int maxevents, l_int timeout, l_sigset_t *mask); }
534
; linux 2.6.22:
541
; linux 2.6.22:
535
320	AUE_NULL	STD	{ int linux_utimensat(void); }
542
320	AUE_FUTIMESAT	STD	{ int linux_utimensat(l_int dfd, const char *pathname, \
543
					const struct l_timespec *times, l_int flags); }
536
321	AUE_NULL	STD	{ int linux_signalfd(void); }
544
321	AUE_NULL	STD	{ int linux_signalfd(void); }
537
322	AUE_NULL	STD	{ int linux_timerfd_create(void); }
545
322	AUE_NULL	STD	{ int linux_timerfd_create(void); }
538
323	AUE_NULL	STD	{ int linux_eventfd(void); }
546
323	AUE_NULL	STD	{ int linux_eventfd(l_uint initval); }
539
; linux 2.6.23:
547
; linux 2.6.23:
540
324	AUE_NULL	STD	{ int linux_fallocate(void); }
548
324	AUE_NULL	STD	{ int linux_fallocate(l_int fd, l_int mode, \
549
				    l_loff_t offset, l_loff_t len); }
541
; linux 2.6.25:
550
; linux 2.6.25:
542
325	AUE_NULL	STD	{ int linux_timerfd_settime(void); }
551
325	AUE_NULL	STD	{ int linux_timerfd_settime(void); }
543
326	AUE_NULL	STD	{ int linux_timerfd_gettime(void); }
552
326	AUE_NULL	STD	{ int linux_timerfd_gettime(void); }
544
; linux 2.6.27:
553
; linux 2.6.27:
545
327	AUE_NULL	STD	{ int linux_signalfd4(void); }
554
327	AUE_NULL	STD	{ int linux_signalfd4(void); }
546
328	AUE_NULL	STD	{ int linux_eventfd2(void); }
555
328	AUE_NULL	STD	{ int linux_eventfd2(l_uint initval, l_int flags); }
547
329	AUE_NULL	STD	{ int linux_epoll_create1(void); }
556
329	AUE_NULL	STD	{ int linux_epoll_create1(l_int flags); }
548
330	AUE_NULL	STD	{ int linux_dup3(void); }
557
330	AUE_NULL	STD	{ int linux_dup3(l_int oldfd,		\
558
					l_int newfd, l_int flags); }
549
331	AUE_NULL	STD	{ int linux_pipe2(l_int *pipefds, l_int flags); }
559
331	AUE_NULL	STD	{ int linux_pipe2(l_int *pipefds, l_int flags); }
550
332	AUE_NULL	STD	{ int linux_inotify_init1(void); }
560
332	AUE_NULL	STD	{ int linux_inotify_init1(void); }
551
; linux 2.6.30:
561
; linux 2.6.30:
Lines 555-571 Link Here
555
335	AUE_NULL	STD	{ int linux_rt_tsigqueueinfo(void); }
565
335	AUE_NULL	STD	{ int linux_rt_tsigqueueinfo(void); }
556
336	AUE_NULL	STD	{ int linux_perf_event_open(void); }
566
336	AUE_NULL	STD	{ int linux_perf_event_open(void); }
557
; linux 2.6.33:
567
; linux 2.6.33:
558
337	AUE_NULL	STD	{ int linux_recvmmsg(void); }
568
337	AUE_NULL	STD	{ int linux_recvmmsg(l_int s,			\
569
				    struct l_mmsghdr *msg, l_uint vlen,		\
570
				    l_uint flags, struct l_timespec *timeout); }
559
338	AUE_NULL	STD	{ int linux_fanotify_init(void); }
571
338	AUE_NULL	STD	{ int linux_fanotify_init(void); }
560
339	AUE_NULL	STD	{ int linux_fanotify_mark(void); }
572
339	AUE_NULL	STD	{ int linux_fanotify_mark(void); }
561
; linux 2.6.36:
573
; linux 2.6.36:
562
340	AUE_NULL	STD	{ int linux_prlimit64(void); }
574
340	AUE_NULL	STD	{ int linux_prlimit64(l_pid_t pid,	\
575
					l_uint resource,		\
576
					struct rlimit *new,		\
577
					struct rlimit *old); }
563
; later:
578
; later:
564
341	AUE_NULL	STD	{ int linux_name_to_handle_at(void); }
579
341	AUE_NULL	STD	{ int linux_name_to_handle_at(void); }
565
342	AUE_NULL	STD	{ int linux_open_by_handle_at(void); }
580
342	AUE_NULL	STD	{ int linux_open_by_handle_at(void); }
566
343	AUE_NULL	STD	{ int linux_clock_adjtime(void); }
581
343	AUE_NULL	STD	{ int linux_clock_adjtime(void); }
567
344	AUE_NULL	STD	{ int linux_syncfs(void); }
582
344	AUE_SYNC	STD	{ int linux_syncfs(l_int fd); }
568
345	AUE_NULL	STD	{ int linux_sendmmsg(void); }
583
345	AUE_NULL	STD	{ int linux_sendmmsg(l_int s,			\
584
				    struct l_mmsghdr *msg, l_uint vlen,		\
585
				    l_uint flags); }
569
346	AUE_NULL	STD	{ int linux_setns(void); }
586
346	AUE_NULL	STD	{ int linux_setns(void); }
570
347	AUE_NULL	STD	{ int linux_process_vm_readv(void); }
587
347	AUE_NULL	STD	{ int linux_process_vm_readv(void); }
571
348	AUE_NULL	STD	{ int linux_process_vm_writev(void); }
588
348	AUE_NULL	STD	{ int linux_process_vm_writev(void); }
589
; please, keep this line at the end.
590
349	AUE_NULL	UNIMPL	nosys
(-)sys/kern/imgact_aout.c (+1 lines)
Lines 99-104 Link Here
99
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
99
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
100
	.sv_syscallnames = syscallnames,
100
	.sv_syscallnames = syscallnames,
101
	.sv_schedtail	= NULL,
101
	.sv_schedtail	= NULL,
102
	.sv_trap	= NULL,
102
};
103
};
103
104
104
#elif defined(__amd64__)
105
#elif defined(__amd64__)
(-)sys/kern/init_main.c (-2 / +3 lines)
Lines 410-415 Link Here
410
	.sv_fetch_syscall_args = null_fetch_syscall_args,
410
	.sv_fetch_syscall_args = null_fetch_syscall_args,
411
	.sv_syscallnames = NULL,
411
	.sv_syscallnames = NULL,
412
	.sv_schedtail	= NULL,
412
	.sv_schedtail	= NULL,
413
	.sv_trap	= NULL,
413
};
414
};
414
415
415
/*
416
/*
Lines 604-612 Link Here
604
	sx_slock(&allproc_lock);
605
	sx_slock(&allproc_lock);
605
	FOREACH_PROC_IN_SYSTEM(p) {
606
	FOREACH_PROC_IN_SYSTEM(p) {
606
		microuptime(&p->p_stats->p_start);
607
		microuptime(&p->p_stats->p_start);
607
		PROC_SLOCK(p);
608
		PROC_STATLOCK(p);
608
		rufetch(p, &ru);	/* Clears thread stats */
609
		rufetch(p, &ru);	/* Clears thread stats */
609
		PROC_SUNLOCK(p);
610
		PROC_STATUNLOCK(p);
610
		p->p_rux.rux_runtime = 0;
611
		p->p_rux.rux_runtime = 0;
611
		p->p_rux.rux_uticks = 0;
612
		p->p_rux.rux_uticks = 0;
612
		p->p_rux.rux_sticks = 0;
613
		p->p_rux.rux_sticks = 0;
(-)sys/kern/kern_clock.c (-8 / +8 lines)
Lines 433-448 Link Here
433
	flags = 0;
433
	flags = 0;
434
	if (usermode &&
434
	if (usermode &&
435
	    timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value)) {
435
	    timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value)) {
436
		PROC_SLOCK(p);
436
		PROC_ITIMLOCK(p);
437
		if (itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0)
437
		if (itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0)
438
			flags |= TDF_ALRMPEND | TDF_ASTPENDING;
438
			flags |= TDF_ALRMPEND | TDF_ASTPENDING;
439
		PROC_SUNLOCK(p);
439
		PROC_ITIMUNLOCK(p);
440
	}
440
	}
441
	if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value)) {
441
	if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value)) {
442
		PROC_SLOCK(p);
442
		PROC_ITIMLOCK(p);
443
		if (itimerdecr(&pstats->p_timer[ITIMER_PROF], tick) == 0)
443
		if (itimerdecr(&pstats->p_timer[ITIMER_PROF], tick) == 0)
444
			flags |= TDF_PROFPEND | TDF_ASTPENDING;
444
			flags |= TDF_PROFPEND | TDF_ASTPENDING;
445
		PROC_SUNLOCK(p);
445
		PROC_ITIMUNLOCK(p);
446
	}
446
	}
447
	thread_lock(td);
447
	thread_lock(td);
448
	sched_tick(1);
448
	sched_tick(1);
Lines 521-538 Link Here
521
	flags = 0;
521
	flags = 0;
522
	if (usermode &&
522
	if (usermode &&
523
	    timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value)) {
523
	    timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value)) {
524
		PROC_SLOCK(p);
524
		PROC_ITIMLOCK(p);
525
		if (itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL],
525
		if (itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL],
526
		    tick * cnt) == 0)
526
		    tick * cnt) == 0)
527
			flags |= TDF_ALRMPEND | TDF_ASTPENDING;
527
			flags |= TDF_ALRMPEND | TDF_ASTPENDING;
528
		PROC_SUNLOCK(p);
528
		PROC_ITIMUNLOCK(p);
529
	}
529
	}
530
	if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value)) {
530
	if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value)) {
531
		PROC_SLOCK(p);
531
		PROC_ITIMLOCK(p);
532
		if (itimerdecr(&pstats->p_timer[ITIMER_PROF],
532
		if (itimerdecr(&pstats->p_timer[ITIMER_PROF],
533
		    tick * cnt) == 0)
533
		    tick * cnt) == 0)
534
			flags |= TDF_PROFPEND | TDF_ASTPENDING;
534
			flags |= TDF_PROFPEND | TDF_ASTPENDING;
535
		PROC_SUNLOCK(p);
535
		PROC_ITIMUNLOCK(p);
536
	}
536
	}
537
	thread_lock(td);
537
	thread_lock(td);
538
	sched_tick(cnt);
538
	sched_tick(cnt);
(-)sys/kern/kern_descrip.c (-2 / +2 lines)
Lines 1874-1880 Link Here
1874
	return (&newfdp->fd_fd);
1874
	return (&newfdp->fd_fd);
1875
}
1875
}
1876
1876
1877
static struct filedesc *
1877
struct filedesc *
1878
fdhold(struct proc *p)
1878
fdhold(struct proc *p)
1879
{
1879
{
1880
	struct filedesc *fdp;
1880
	struct filedesc *fdp;
Lines 1887-1893 Link Here
1887
	return (fdp);
1887
	return (fdp);
1888
}
1888
}
1889
1889
1890
static void
1890
void
1891
fddrop(struct filedesc *fdp)
1891
fddrop(struct filedesc *fdp)
1892
{
1892
{
1893
	struct filedesc0 *fdp0;
1893
	struct filedesc0 *fdp0;
(-)sys/kern/kern_event.c (-9 / +26 lines)
Lines 731-736 Link Here
731
int
731
int
732
sys_kqueue(struct thread *td, struct kqueue_args *uap)
732
sys_kqueue(struct thread *td, struct kqueue_args *uap)
733
{
733
{
734
735
	return (kern_kqueue(td, 0));
736
}
737
738
int
739
kern_kqueue(struct thread *td, int flags)
740
{
734
	struct filedesc *fdp;
741
	struct filedesc *fdp;
735
	struct kqueue *kq;
742
	struct kqueue *kq;
736
	struct file *fp;
743
	struct file *fp;
Lines 737-743 Link Here
737
	int fd, error;
744
	int fd, error;
738
745
739
	fdp = td->td_proc->p_fd;
746
	fdp = td->td_proc->p_fd;
740
	error = falloc(td, &fp, &fd, 0);
747
	error = falloc(td, &fp, &fd, flags);
741
	if (error)
748
	if (error)
742
		goto done2;
749
		goto done2;
743
750
Lines 863-874 Link Here
863
kern_kevent(struct thread *td, int fd, int nchanges, int nevents,
870
kern_kevent(struct thread *td, int fd, int nchanges, int nevents,
864
    struct kevent_copyops *k_ops, const struct timespec *timeout)
871
    struct kevent_copyops *k_ops, const struct timespec *timeout)
865
{
872
{
866
	struct kevent keva[KQ_NEVENTS];
873
	cap_rights_t rights;
867
	struct kevent *kevp, *changes;
868
	struct kqueue *kq;
869
	struct file *fp;
874
	struct file *fp;
870
	cap_rights_t rights;
875
	int error;
871
	int i, n, nerrors, error;
872
876
873
	cap_rights_init(&rights);
877
	cap_rights_init(&rights);
874
	if (nchanges > 0)
878
	if (nchanges > 0)
Lines 879-887 Link Here
879
	if (error != 0)
883
	if (error != 0)
880
		return (error);
884
		return (error);
881
885
886
	error = kern_kevent_fp(td, fp, nchanges, nevents, k_ops, timeout);
887
	fdrop(fp, td);
888
889
	return (error);
890
}
891
892
int
893
kern_kevent_fp(struct thread *td, struct file *fp, int nchanges, int nevents,
894
    struct kevent_copyops *k_ops, const struct timespec *timeout)
895
{
896
	struct kevent keva[KQ_NEVENTS];
897
	struct kevent *kevp, *changes;
898
	struct kqueue *kq;
899
	int i, n, nerrors, error;
900
882
	error = kqueue_acquire(fp, &kq);
901
	error = kqueue_acquire(fp, &kq);
883
	if (error != 0)
902
	if (error != 0)
884
		goto done_norel;
903
		return (error);
885
904
886
	nerrors = 0;
905
	nerrors = 0;
887
906
Lines 921-928 Link Here
921
	error = kqueue_scan(kq, nevents, k_ops, timeout, keva, td);
940
	error = kqueue_scan(kq, nevents, k_ops, timeout, keva, td);
922
done:
941
done:
923
	kqueue_release(kq, 0);
942
	kqueue_release(kq, 0);
924
done_norel:
925
	fdrop(fp, td);
926
	return (error);
943
	return (error);
927
}
944
}
928
945
(-)sys/kern/kern_exit.c (-3 / +5 lines)
Lines 660-666 Link Here
660
	/*
660
	/*
661
	 * Save our children's rusage information in our exit rusage.
661
	 * Save our children's rusage information in our exit rusage.
662
	 */
662
	 */
663
	PROC_STATLOCK(p);
663
	ruadd(&p->p_ru, &p->p_rux, &p->p_stats->p_cru, &p->p_crux);
664
	ruadd(&p->p_ru, &p->p_rux, &p->p_stats->p_cru, &p->p_crux);
665
	PROC_STATUNLOCK(p);
664
666
665
	/*
667
	/*
666
	 * Make sure the scheduler takes this thread out of its tables etc.
668
	 * Make sure the scheduler takes this thread out of its tables etc.
Lines 1043-1050 Link Here
1043
		return (0);
1045
		return (0);
1044
	}
1046
	}
1045
1047
1046
	PROC_SLOCK(p);
1047
1048
	if (siginfo != NULL) {
1048
	if (siginfo != NULL) {
1049
		bzero(siginfo, sizeof(*siginfo));
1049
		bzero(siginfo, sizeof(*siginfo));
1050
		siginfo->si_errno = 0;
1050
		siginfo->si_errno = 0;
Lines 1091-1097 Link Here
1091
	if (wrusage != NULL) {
1091
	if (wrusage != NULL) {
1092
		rup = &wrusage->wru_self;
1092
		rup = &wrusage->wru_self;
1093
		*rup = p->p_ru;
1093
		*rup = p->p_ru;
1094
		PROC_STATLOCK(p);
1094
		calcru(p, &rup->ru_utime, &rup->ru_stime);
1095
		calcru(p, &rup->ru_utime, &rup->ru_stime);
1096
		PROC_STATUNLOCK(p);
1095
1097
1096
		rup = &wrusage->wru_children;
1098
		rup = &wrusage->wru_children;
1097
		*rup = p->p_stats->p_cru;
1099
		*rup = p->p_stats->p_cru;
Lines 1099-1108 Link Here
1099
	}
1101
	}
1100
1102
1101
	if (p->p_state == PRS_ZOMBIE) {
1103
	if (p->p_state == PRS_ZOMBIE) {
1104
		PROC_SLOCK(p);
1102
		proc_reap(td, p, status, options);
1105
		proc_reap(td, p, status, options);
1103
		return (-1);
1106
		return (-1);
1104
	}
1107
	}
1105
	PROC_SUNLOCK(p);
1106
	PROC_UNLOCK(p);
1108
	PROC_UNLOCK(p);
1107
	return (1);
1109
	return (1);
1108
}
1110
}
(-)sys/kern/kern_mutex.c (+3 lines)
Lines 989-994 Link Here
989
	blocked_lock.mtx_lock = 0xdeadc0de;	/* Always blocked. */
989
	blocked_lock.mtx_lock = 0xdeadc0de;	/* Always blocked. */
990
	mtx_init(&proc0.p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK);
990
	mtx_init(&proc0.p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK);
991
	mtx_init(&proc0.p_slock, "process slock", NULL, MTX_SPIN | MTX_RECURSE);
991
	mtx_init(&proc0.p_slock, "process slock", NULL, MTX_SPIN | MTX_RECURSE);
992
	mtx_init(&proc0.p_statmtx, "pstatl", NULL, MTX_SPIN);
993
	mtx_init(&proc0.p_itimmtx, "pitiml", NULL, MTX_SPIN);
994
	mtx_init(&proc0.p_profmtx, "pprofl", NULL, MTX_SPIN);
992
	mtx_init(&devmtx, "cdev", NULL, MTX_DEF);
995
	mtx_init(&devmtx, "cdev", NULL, MTX_DEF);
993
	mtx_lock(&Giant);
996
	mtx_lock(&Giant);
994
}
997
}
(-)sys/kern/kern_proc.c (-4 / +7 lines)
Lines 229-234 Link Here
229
	bzero(&p->p_mtx, sizeof(struct mtx));
229
	bzero(&p->p_mtx, sizeof(struct mtx));
230
	mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK);
230
	mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK);
231
	mtx_init(&p->p_slock, "process slock", NULL, MTX_SPIN | MTX_RECURSE);
231
	mtx_init(&p->p_slock, "process slock", NULL, MTX_SPIN | MTX_RECURSE);
232
	mtx_init(&p->p_statmtx, "pstatl", NULL, MTX_SPIN);
233
	mtx_init(&p->p_itimmtx, "pitiml", NULL, MTX_SPIN);
234
	mtx_init(&p->p_profmtx, "pprofl", NULL, MTX_SPIN);
232
	cv_init(&p->p_pwait, "ppwait");
235
	cv_init(&p->p_pwait, "ppwait");
233
	cv_init(&p->p_dbgwait, "dbgwait");
236
	cv_init(&p->p_dbgwait, "dbgwait");
234
	TAILQ_INIT(&p->p_threads);	     /* all threads in proc */
237
	TAILQ_INIT(&p->p_threads);	     /* all threads in proc */
Lines 871-881 Link Here
871
	kp->ki_fibnum = p->p_fibnum;
874
	kp->ki_fibnum = p->p_fibnum;
872
	kp->ki_start = p->p_stats->p_start;
875
	kp->ki_start = p->p_stats->p_start;
873
	timevaladd(&kp->ki_start, &boottime);
876
	timevaladd(&kp->ki_start, &boottime);
874
	PROC_SLOCK(p);
877
	PROC_STATLOCK(p);
875
	rufetch(p, &kp->ki_rusage);
878
	rufetch(p, &kp->ki_rusage);
876
	kp->ki_runtime = cputick2usec(p->p_rux.rux_runtime);
879
	kp->ki_runtime = cputick2usec(p->p_rux.rux_runtime);
877
	calcru(p, &kp->ki_rusage.ru_utime, &kp->ki_rusage.ru_stime);
880
	calcru(p, &kp->ki_rusage.ru_utime, &kp->ki_rusage.ru_stime);
878
	PROC_SUNLOCK(p);
881
	PROC_STATUNLOCK(p);
879
	calccru(p, &kp->ki_childutime, &kp->ki_childstime);
882
	calccru(p, &kp->ki_childutime, &kp->ki_childstime);
880
	/* Some callers want child times in a single value. */
883
	/* Some callers want child times in a single value. */
881
	kp->ki_childtime = kp->ki_childstime;
884
	kp->ki_childtime = kp->ki_childstime;
Lines 940-946 Link Here
940
	PROC_LOCK_ASSERT(p, MA_OWNED);
943
	PROC_LOCK_ASSERT(p, MA_OWNED);
941
944
942
	if (preferthread)
945
	if (preferthread)
943
		PROC_SLOCK(p);
946
		PROC_STATLOCK(p);
944
	thread_lock(td);
947
	thread_lock(td);
945
	if (td->td_wmesg != NULL)
948
	if (td->td_wmesg != NULL)
946
		strlcpy(kp->ki_wmesg, td->td_wmesg, sizeof(kp->ki_wmesg));
949
		strlcpy(kp->ki_wmesg, td->td_wmesg, sizeof(kp->ki_wmesg));
Lines 1007-1013 Link Here
1007
	kp->ki_sigmask = td->td_sigmask;
1010
	kp->ki_sigmask = td->td_sigmask;
1008
	thread_unlock(td);
1011
	thread_unlock(td);
1009
	if (preferthread)
1012
	if (preferthread)
1010
		PROC_SUNLOCK(p);
1013
		PROC_STATUNLOCK(p);
1011
}
1014
}
1012
1015
1013
/*
1016
/*
(-)sys/kern/kern_racct.c (-2 / +2 lines)
Lines 1215-1225 Link Here
1215
1215
1216
			microuptime(&wallclock);
1216
			microuptime(&wallclock);
1217
			timevalsub(&wallclock, &p->p_stats->p_start);
1217
			timevalsub(&wallclock, &p->p_stats->p_start);
1218
			PROC_SLOCK(p);
1218
			PROC_STATLOCK(p);
1219
			FOREACH_THREAD_IN_PROC(p, td)
1219
			FOREACH_THREAD_IN_PROC(p, td)
1220
				ruxagg(p, td);
1220
				ruxagg(p, td);
1221
			runtime = cputick2usec(p->p_rux.rux_runtime);
1221
			runtime = cputick2usec(p->p_rux.rux_runtime);
1222
			PROC_SUNLOCK(p);
1222
			PROC_STATUNLOCK(p);
1223
#ifdef notyet
1223
#ifdef notyet
1224
			KASSERT(runtime >= p->p_prev_runtime,
1224
			KASSERT(runtime >= p->p_prev_runtime,
1225
			    ("runtime < p_prev_runtime"));
1225
			    ("runtime < p_prev_runtime"));
(-)sys/kern/kern_resource.c (-10 / +10 lines)
Lines 631-641 Link Here
631
	 */
631
	 */
632
	if (p->p_cpulimit == RLIM_INFINITY)
632
	if (p->p_cpulimit == RLIM_INFINITY)
633
		return;
633
		return;
634
	PROC_SLOCK(p);
634
	PROC_STATLOCK(p);
635
	FOREACH_THREAD_IN_PROC(p, td) {
635
	FOREACH_THREAD_IN_PROC(p, td) {
636
		ruxagg(p, td);
636
		ruxagg(p, td);
637
	}
637
	}
638
	PROC_SUNLOCK(p);
638
	PROC_STATUNLOCK(p);
639
	if (p->p_rux.rux_runtime > p->p_cpulimit * cpu_tickrate()) {
639
	if (p->p_rux.rux_runtime > p->p_cpulimit * cpu_tickrate()) {
640
		lim_rlimit(p, RLIMIT_CPU, &rlim);
640
		lim_rlimit(p, RLIMIT_CPU, &rlim);
641
		if (p->p_rux.rux_runtime >= rlim.rlim_max * cpu_tickrate()) {
641
		if (p->p_rux.rux_runtime >= rlim.rlim_max * cpu_tickrate()) {
Lines 847-853 Link Here
847
	uint64_t runtime, u;
847
	uint64_t runtime, u;
848
848
849
	PROC_LOCK_ASSERT(p, MA_OWNED);
849
	PROC_LOCK_ASSERT(p, MA_OWNED);
850
	PROC_SLOCK_ASSERT(p, MA_OWNED);
850
	PROC_STATLOCK_ASSERT(p, MA_OWNED);
851
	/*
851
	/*
852
	 * If we are getting stats for the current process, then add in the
852
	 * If we are getting stats for the current process, then add in the
853
	 * stats that this thread has accumulated in its current time slice.
853
	 * stats that this thread has accumulated in its current time slice.
Lines 879-885 Link Here
879
	uint64_t runtime, u;
879
	uint64_t runtime, u;
880
880
881
	p = td->td_proc;
881
	p = td->td_proc;
882
	PROC_SLOCK_ASSERT(p, MA_OWNED);
882
	PROC_STATLOCK_ASSERT(p, MA_OWNED);
883
	THREAD_LOCK_ASSERT(td, MA_OWNED);
883
	THREAD_LOCK_ASSERT(td, MA_OWNED);
884
	/*
884
	/*
885
	 * If we are getting stats for the current thread, then add in the
885
	 * If we are getting stats for the current thread, then add in the
Lines 1015-1025 Link Here
1015
		break;
1015
		break;
1016
1016
1017
	case RUSAGE_THREAD:
1017
	case RUSAGE_THREAD:
1018
		PROC_SLOCK(p);
1018
		PROC_STATLOCK(p);
1019
		thread_lock(td);
1019
		thread_lock(td);
1020
		rufetchtd(td, rup);
1020
		rufetchtd(td, rup);
1021
		thread_unlock(td);
1021
		thread_unlock(td);
1022
		PROC_SUNLOCK(p);
1022
		PROC_STATUNLOCK(p);
1023
		break;
1023
		break;
1024
1024
1025
	default:
1025
	default:
Lines 1066-1072 Link Here
1066
{
1066
{
1067
1067
1068
	THREAD_LOCK_ASSERT(td, MA_OWNED);
1068
	THREAD_LOCK_ASSERT(td, MA_OWNED);
1069
	PROC_SLOCK_ASSERT(td->td_proc, MA_OWNED);
1069
	PROC_STATLOCK_ASSERT(td->td_proc, MA_OWNED);
1070
	rux->rux_runtime += td->td_incruntime;
1070
	rux->rux_runtime += td->td_incruntime;
1071
	rux->rux_uticks += td->td_uticks;
1071
	rux->rux_uticks += td->td_uticks;
1072
	rux->rux_sticks += td->td_sticks;
1072
	rux->rux_sticks += td->td_sticks;
Lines 1096-1102 Link Here
1096
{
1096
{
1097
	struct thread *td;
1097
	struct thread *td;
1098
1098
1099
	PROC_SLOCK_ASSERT(p, MA_OWNED);
1099
	PROC_STATLOCK_ASSERT(p, MA_OWNED);
1100
1100
1101
	*ru = p->p_ru;
1101
	*ru = p->p_ru;
1102
	if (p->p_numthreads > 0)  {
1102
	if (p->p_numthreads > 0)  {
Lines 1117-1126 Link Here
1117
    struct timeval *sp)
1117
    struct timeval *sp)
1118
{
1118
{
1119
1119
1120
	PROC_SLOCK(p);
1120
	PROC_STATLOCK(p);
1121
	rufetch(p, ru);
1121
	rufetch(p, ru);
1122
	calcru(p, up, sp);
1122
	calcru(p, up, sp);
1123
	PROC_SUNLOCK(p);
1123
	PROC_STATUNLOCK(p);
1124
}
1124
}
1125
1125
1126
/*
1126
/*
(-)sys/kern/kern_thr.c (-13 / +29 lines)
Lines 162-173 Link Here
162
162
163
	p = td->td_proc;
163
	p = td->td_proc;
164
164
165
	/* Have race condition but it is cheap. */
166
	if (p->p_numthreads >= max_threads_per_proc) {
167
		++max_threads_hits;
168
		return (EPROCLIM);
169
	}
170
171
	if (rtp != NULL) {
165
	if (rtp != NULL) {
172
		switch(rtp->type) {
166
		switch(rtp->type) {
173
		case RTP_PRIO_REALTIME:
167
		case RTP_PRIO_REALTIME:
Lines 195-205 Link Here
195
#endif
189
#endif
196
190
197
	/* Initialize our td */
191
	/* Initialize our td */
198
	newtd = thread_alloc(0);
192
	error = kern_thr_alloc(p, 0, &newtd);
199
	if (newtd == NULL) {
193
	if (error)
200
		error = ENOMEM;
201
		goto fail;
194
		goto fail;
202
	}
203
195
204
	cpu_set_upcall(newtd, td);
196
	cpu_set_upcall(newtd, td);
205
197
Lines 306-315 Link Here
306
sys_thr_exit(struct thread *td, struct thr_exit_args *uap)
298
sys_thr_exit(struct thread *td, struct thr_exit_args *uap)
307
    /* long *state */
299
    /* long *state */
308
{
300
{
309
	struct proc *p;
310
301
311
	p = td->td_proc;
312
313
	/* Signal userland that it can free the stack. */
302
	/* Signal userland that it can free the stack. */
314
	if ((void *)uap->state != NULL) {
303
	if ((void *)uap->state != NULL) {
315
		suword_lwpid(uap->state, 1);
304
		suword_lwpid(uap->state, 1);
Lines 316-321 Link Here
316
		kern_umtx_wake(td, uap->state, INT_MAX, 0);
305
		kern_umtx_wake(td, uap->state, INT_MAX, 0);
317
	}
306
	}
318
307
308
	return (kern_thr_exit(td));
309
}
310
311
int
312
kern_thr_exit(struct thread *td)
313
{
314
	struct proc *p;
315
316
	p = td->td_proc;
317
319
	rw_wlock(&tidhash_lock);
318
	rw_wlock(&tidhash_lock);
320
319
321
	PROC_LOCK(p);
320
	PROC_LOCK(p);
Lines 559-561 Link Here
559
	PROC_UNLOCK(p);
558
	PROC_UNLOCK(p);
560
	return (error);
559
	return (error);
561
}
560
}
561
562
int
563
kern_thr_alloc(struct proc *p, int pages, struct thread **ntd)
564
{
565
566
	/* Have race condition but it is cheap. */
567
	if (p->p_numthreads >= max_threads_per_proc) {
568
		++max_threads_hits;
569
		return (EPROCLIM);
570
	}
571
572
	*ntd = thread_alloc(pages);
573
	if (*ntd == NULL)
574
		return (ENOMEM);
575
576
	return (0);
577
}
(-)sys/kern/kern_thread.c (-2 / +11 lines)
Lines 45-50 Link Here
45
#include <sys/smp.h>
45
#include <sys/smp.h>
46
#include <sys/sched.h>
46
#include <sys/sched.h>
47
#include <sys/sleepqueue.h>
47
#include <sys/sleepqueue.h>
48
#include <sys/sysent.h>
48
#include <sys/selinfo.h>
49
#include <sys/selinfo.h>
49
#include <sys/turnstile.h>
50
#include <sys/turnstile.h>
50
#include <sys/ktr.h>
51
#include <sys/ktr.h>
Lines 472-477 Link Here
472
		PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT);
473
		PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT);
473
#endif
474
#endif
474
	PROC_UNLOCK(p);
475
	PROC_UNLOCK(p);
476
	PROC_STATLOCK(p);
477
	thread_lock(td);
478
	PROC_SUNLOCK(p);
475
479
476
	/* Do the same timestamp bookkeeping that mi_switch() would do. */
480
	/* Do the same timestamp bookkeeping that mi_switch() would do. */
477
	new_switchtime = cpu_ticks();
481
	new_switchtime = cpu_ticks();
Lines 486-494 Link Here
486
	td->td_ru.ru_nvcsw++;
490
	td->td_ru.ru_nvcsw++;
487
	ruxagg(p, td);
491
	ruxagg(p, td);
488
	rucollect(&p->p_ru, &td->td_ru);
492
	rucollect(&p->p_ru, &td->td_ru);
493
	PROC_STATUNLOCK(p);
489
494
490
	thread_lock(td);
491
	PROC_SUNLOCK(p);
492
	td->td_state = TDS_INACTIVE;
495
	td->td_state = TDS_INACTIVE;
493
#ifdef WITNESS
496
#ifdef WITNESS
494
	witness_thread_exit(td);
497
	witness_thread_exit(td);
Lines 882-887 Link Here
882
		 */
885
		 */
883
		if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) {
886
		if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) {
884
			PROC_UNLOCK(p);
887
			PROC_UNLOCK(p);
888
			/*
889
			 * Let thread to do cleanup work before die.
890
			 */
891
			if (__predict_false(p->p_sysent->sv_thread_detach != NULL))
892
				(p->p_sysent->sv_thread_detach)(td);
893
885
			tidhash_remove(td);
894
			tidhash_remove(td);
886
			PROC_LOCK(p);
895
			PROC_LOCK(p);
887
			tdsigcleanup(td);
896
			tdsigcleanup(td);
(-)sys/kern/kern_time.c (-10 / +10 lines)
Lines 273-282 Link Here
273
	uint64_t runtime;
273
	uint64_t runtime;
274
	struct rusage ru;
274
	struct rusage ru;
275
275
276
	PROC_SLOCK(targetp);
276
	PROC_STATLOCK(targetp);
277
	rufetch(targetp, &ru);
277
	rufetch(targetp, &ru);
278
	runtime = targetp->p_rux.rux_runtime;
278
	runtime = targetp->p_rux.rux_runtime;
279
	PROC_SUNLOCK(targetp);
279
	PROC_STATUNLOCK(targetp);
280
	cputick2timespec(runtime, ats);
280
	cputick2timespec(runtime, ats);
281
}
281
}
282
282
Lines 325-341 Link Here
325
		break;
325
		break;
326
	case CLOCK_VIRTUAL:
326
	case CLOCK_VIRTUAL:
327
		PROC_LOCK(p);
327
		PROC_LOCK(p);
328
		PROC_SLOCK(p);
328
		PROC_STATLOCK(p);
329
		calcru(p, &user, &sys);
329
		calcru(p, &user, &sys);
330
		PROC_SUNLOCK(p);
330
		PROC_STATUNLOCK(p);
331
		PROC_UNLOCK(p);
331
		PROC_UNLOCK(p);
332
		TIMEVAL_TO_TIMESPEC(&user, ats);
332
		TIMEVAL_TO_TIMESPEC(&user, ats);
333
		break;
333
		break;
334
	case CLOCK_PROF:
334
	case CLOCK_PROF:
335
		PROC_LOCK(p);
335
		PROC_LOCK(p);
336
		PROC_SLOCK(p);
336
		PROC_STATLOCK(p);
337
		calcru(p, &user, &sys);
337
		calcru(p, &user, &sys);
338
		PROC_SUNLOCK(p);
338
		PROC_STATUNLOCK(p);
339
		PROC_UNLOCK(p);
339
		PROC_UNLOCK(p);
340
		timevaladd(&user, &sys);
340
		timevaladd(&user, &sys);
341
		TIMEVAL_TO_TIMESPEC(&user, ats);
341
		TIMEVAL_TO_TIMESPEC(&user, ats);
Lines 695-703 Link Here
695
				timevalsub(&aitv->it_value, &ctv);
695
				timevalsub(&aitv->it_value, &ctv);
696
		}
696
		}
697
	} else {
697
	} else {
698
		PROC_SLOCK(p);
698
		PROC_ITIMLOCK(p);
699
		*aitv = p->p_stats->p_timer[which];
699
		*aitv = p->p_stats->p_timer[which];
700
		PROC_SUNLOCK(p);
700
		PROC_ITIMUNLOCK(p);
701
	}
701
	}
702
	return (0);
702
	return (0);
703
}
703
}
Lines 779-788 Link Here
779
		    aitv->it_value.tv_usec != 0 &&
779
		    aitv->it_value.tv_usec != 0 &&
780
		    aitv->it_value.tv_usec < tick)
780
		    aitv->it_value.tv_usec < tick)
781
			aitv->it_value.tv_usec = tick;
781
			aitv->it_value.tv_usec = tick;
782
		PROC_SLOCK(p);
782
		PROC_ITIMLOCK(p);
783
		*oitv = p->p_stats->p_timer[which];
783
		*oitv = p->p_stats->p_timer[which];
784
		p->p_stats->p_timer[which] = *aitv;
784
		p->p_stats->p_timer[which] = *aitv;
785
		PROC_SUNLOCK(p);
785
		PROC_ITIMUNLOCK(p);
786
	}
786
	}
787
	return (0);
787
	return (0);
788
}
788
}
(-)sys/kern/p1003_1b.c (-27 / +94 lines)
Lines 130-145 Link Here
130
		targettd = FIRST_THREAD_IN_PROC(targetp);
130
		targettd = FIRST_THREAD_IN_PROC(targetp);
131
	}
131
	}
132
132
133
	e = p_cansched(td, targetp);
133
	e = kern_sched_setparam(td, targettd, &sched_param);
134
	if (e == 0) {
135
		e = ksched_setparam(ksched, targettd,
136
			(const struct sched_param *)&sched_param);
137
	}
138
	PROC_UNLOCK(targetp);
134
	PROC_UNLOCK(targetp);
139
	return (e);
135
	return (e);
140
}
136
}
141
137
142
int
138
int
139
kern_sched_setparam(struct thread *td, struct thread *targettd,
140
    struct sched_param *param)
141
{
142
	struct proc *targetp;
143
	int error;
144
145
	targetp = targettd->td_proc;
146
	PROC_LOCK_ASSERT(targetp, MA_OWNED);
147
148
	error = p_cansched(td, targetp);
149
	if (error == 0)
150
		error = ksched_setparam(ksched, targettd,
151
		    (const struct sched_param *)param);
152
	return (error);
153
}
154
155
int
143
sys_sched_getparam(struct thread *td, struct sched_getparam_args *uap)
156
sys_sched_getparam(struct thread *td, struct sched_getparam_args *uap)
144
{
157
{
145
	int e;
158
	int e;
Lines 159-168 Link Here
159
		targettd = FIRST_THREAD_IN_PROC(targetp);
172
		targettd = FIRST_THREAD_IN_PROC(targetp);
160
	}
173
	}
161
174
162
	e = p_cansee(td, targetp);
175
	e = kern_sched_getparam(td, targettd, &sched_param);
163
	if (e == 0) {
164
		e = ksched_getparam(ksched, targettd, &sched_param);
165
	}
166
	PROC_UNLOCK(targetp);
176
	PROC_UNLOCK(targetp);
167
	if (e == 0)
177
	if (e == 0)
168
		e = copyout(&sched_param, uap->param, sizeof(sched_param));
178
		e = copyout(&sched_param, uap->param, sizeof(sched_param));
Lines 170-175 Link Here
170
}
180
}
171
181
172
int
182
int
183
kern_sched_getparam(struct thread *td, struct thread *targettd,
184
    struct sched_param *param)
185
{
186
	struct proc *targetp;
187
	int error;
188
189
	targetp = targettd->td_proc;
190
	PROC_LOCK_ASSERT(targetp, MA_OWNED);
191
192
	error = p_cansee(td, targetp);
193
	if (error == 0)
194
		error = ksched_getparam(ksched, targettd, param);
195
	return (error);
196
}
197
198
int
173
sys_sched_setscheduler(struct thread *td, struct sched_setscheduler_args *uap)
199
sys_sched_setscheduler(struct thread *td, struct sched_setscheduler_args *uap)
174
{
200
{
175
	int e;
201
	int e;
Lines 177-187 Link Here
177
	struct thread *targettd;
203
	struct thread *targettd;
178
	struct proc *targetp;
204
	struct proc *targetp;
179
205
180
	/* Don't allow non root user to set a scheduler policy. */
181
	e = priv_check(td, PRIV_SCHED_SET);
182
	if (e)
183
		return (e);
184
185
	e = copyin(uap->param, &sched_param, sizeof(sched_param));
206
	e = copyin(uap->param, &sched_param, sizeof(sched_param));
186
	if (e)
207
	if (e)
187
		return (e);
208
		return (e);
Lines 197-212 Link Here
197
		targettd = FIRST_THREAD_IN_PROC(targetp);
218
		targettd = FIRST_THREAD_IN_PROC(targetp);
198
	}
219
	}
199
220
200
	e = p_cansched(td, targetp);
221
	e = kern_sched_setscheduler(td, targettd, uap->policy,
201
	if (e == 0) {
222
	    &sched_param);
202
		e = ksched_setscheduler(ksched, targettd,
203
			uap->policy, (const struct sched_param *)&sched_param);
204
	}
205
	PROC_UNLOCK(targetp);
223
	PROC_UNLOCK(targetp);
206
	return (e);
224
	return (e);
207
}
225
}
208
226
209
int
227
int
228
kern_sched_setscheduler(struct thread *td, struct thread *targettd,
229
    int policy, struct sched_param *param)
230
{
231
	struct proc *targetp;
232
	int error;
233
234
	targetp = targettd->td_proc;
235
	PROC_LOCK_ASSERT(targetp, MA_OWNED);
236
237
	/* Don't allow non root user to set a scheduler policy. */
238
	error = priv_check(td, PRIV_SCHED_SET);
239
	if (error)
240
		return (error);
241
242
	error = p_cansched(td, targetp);
243
	if (error == 0)
244
		error = ksched_setscheduler(ksched, targettd, policy,
245
		    (const struct sched_param *)param);
246
	return (error);
247
}
248
249
int
210
sys_sched_getscheduler(struct thread *td, struct sched_getscheduler_args *uap)
250
sys_sched_getscheduler(struct thread *td, struct sched_getscheduler_args *uap)
211
{
251
{
212
	int e, policy;
252
	int e, policy;
Lines 224-240 Link Here
224
		targettd = FIRST_THREAD_IN_PROC(targetp);
264
		targettd = FIRST_THREAD_IN_PROC(targetp);
225
	}
265
	}
226
266
227
	e = p_cansee(td, targetp);
267
	e = kern_sched_getscheduler(td, targettd, &policy);
228
	if (e == 0) {
268
	PROC_UNLOCK(targetp);
229
		e = ksched_getscheduler(ksched, targettd, &policy);
269
	if (e == 0)
230
		td->td_retval[0] = policy;
270
		td->td_retval[0] = policy;
231
	}
232
	PROC_UNLOCK(targetp);
233
271
234
	return (e);
272
	return (e);
235
}
273
}
236
274
237
int
275
int
276
kern_sched_getscheduler(struct thread *td, struct thread *targettd,
277
    int *policy)
278
{
279
	struct proc *targetp;
280
	int error;
281
282
	targetp = targettd->td_proc;
283
	PROC_LOCK_ASSERT(targetp, MA_OWNED);
284
285
	error = p_cansee(td, targetp);
286
	if (error == 0)
287
		error = ksched_getscheduler(ksched, targettd, policy);
288
	return (error);
289
}
290
291
int
238
sys_sched_yield(struct thread *td, struct sched_yield_args *uap)
292
sys_sched_yield(struct thread *td, struct sched_yield_args *uap)
239
{
293
{
240
294
Lines 296-308 Link Here
296
		targettd = FIRST_THREAD_IN_PROC(targetp);
350
		targettd = FIRST_THREAD_IN_PROC(targetp);
297
	}
351
	}
298
352
299
	e = p_cansee(td, targetp);
353
	e = kern_sched_rr_get_interval_td(td, targettd, ts);
300
	if (e == 0)
301
		e = ksched_rr_get_interval(ksched, targettd, ts);
302
	PROC_UNLOCK(targetp);
354
	PROC_UNLOCK(targetp);
303
	return (e);
355
	return (e);
304
}
356
}
305
357
358
int
359
kern_sched_rr_get_interval_td(struct thread *td, struct thread *targettd,
360
    struct timespec *ts)
361
{
362
	struct proc *p;
363
	int error;
364
365
	p = targettd->td_proc;
366
	PROC_LOCK_ASSERT(p, MA_OWNED);
367
368
	error = p_cansee(td, p);
369
	if (error == 0)
370
		error = ksched_rr_get_interval(ksched, targettd, ts);
371
	return (error);
372
}
306
#endif
373
#endif
307
374
308
static void
375
static void
(-)sys/kern/subr_prof.c (-8 / +8 lines)
Lines 421-432 Link Here
421
	}
421
	}
422
	PROC_LOCK(p);
422
	PROC_LOCK(p);
423
	upp = &td->td_proc->p_stats->p_prof;
423
	upp = &td->td_proc->p_stats->p_prof;
424
	PROC_SLOCK(p);
424
	PROC_PROFLOCK(p);
425
	upp->pr_off = uap->offset;
425
	upp->pr_off = uap->offset;
426
	upp->pr_scale = uap->scale;
426
	upp->pr_scale = uap->scale;
427
	upp->pr_base = uap->samples;
427
	upp->pr_base = uap->samples;
428
	upp->pr_size = uap->size;
428
	upp->pr_size = uap->size;
429
	PROC_SUNLOCK(p);
429
	PROC_PROFUNLOCK(p);
430
	startprofclock(p);
430
	startprofclock(p);
431
	PROC_UNLOCK(p);
431
	PROC_UNLOCK(p);
432
432
Lines 466-480 Link Here
466
	if (ticks == 0)
466
	if (ticks == 0)
467
		return;
467
		return;
468
	prof = &td->td_proc->p_stats->p_prof;
468
	prof = &td->td_proc->p_stats->p_prof;
469
	PROC_SLOCK(td->td_proc);
469
	PROC_PROFLOCK(td->td_proc);
470
	if (pc < prof->pr_off ||
470
	if (pc < prof->pr_off ||
471
	    (i = PC_TO_INDEX(pc, prof)) >= prof->pr_size) {
471
	    (i = PC_TO_INDEX(pc, prof)) >= prof->pr_size) {
472
		PROC_SUNLOCK(td->td_proc);
472
		PROC_PROFUNLOCK(td->td_proc);
473
		return;			/* out of range; ignore */
473
		return;			/* out of range; ignore */
474
	}
474
	}
475
475
476
	addr = prof->pr_base + i;
476
	addr = prof->pr_base + i;
477
	PROC_SUNLOCK(td->td_proc);
477
	PROC_PROFUNLOCK(td->td_proc);
478
	if ((v = fuswintr(addr)) == -1 || suswintr(addr, v + ticks) == -1) {
478
	if ((v = fuswintr(addr)) == -1 || suswintr(addr, v + ticks) == -1) {
479
		td->td_profil_addr = pc;
479
		td->td_profil_addr = pc;
480
		td->td_profil_ticks = ticks;
480
		td->td_profil_ticks = ticks;
Lines 509-523 Link Here
509
	}
509
	}
510
	p->p_profthreads++;
510
	p->p_profthreads++;
511
	prof = &p->p_stats->p_prof;
511
	prof = &p->p_stats->p_prof;
512
	PROC_SLOCK(p);
512
	PROC_PROFLOCK(p);
513
	if (pc < prof->pr_off ||
513
	if (pc < prof->pr_off ||
514
	    (i = PC_TO_INDEX(pc, prof)) >= prof->pr_size) {
514
	    (i = PC_TO_INDEX(pc, prof)) >= prof->pr_size) {
515
		PROC_SUNLOCK(p);
515
		PROC_PROFUNLOCK(p);
516
		goto out;
516
		goto out;
517
	}
517
	}
518
518
519
	addr = prof->pr_base + i;
519
	addr = prof->pr_base + i;
520
	PROC_SUNLOCK(p);
520
	PROC_PROFUNLOCK(p);
521
	PROC_UNLOCK(p);
521
	PROC_UNLOCK(p);
522
	if (copyin(addr, &v, sizeof(v)) == 0) {
522
	if (copyin(addr, &v, sizeof(v)) == 0) {
523
		v += ticks;
523
		v += ticks;
(-)sys/mips/mips/elf_machdep.c (+2 lines)
Lines 83-88 Link Here
83
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
83
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
84
	.sv_syscallnames = syscallnames,
84
	.sv_syscallnames = syscallnames,
85
	.sv_schedtail	= NULL,
85
	.sv_schedtail	= NULL,
86
	.sv_trap	= NULL,
86
};
87
};
87
88
88
static Elf64_Brandinfo freebsd_brand_info = {
89
static Elf64_Brandinfo freebsd_brand_info = {
Lines 139-144 Link Here
139
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
140
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
140
	.sv_syscallnames = syscallnames,
141
	.sv_syscallnames = syscallnames,
141
	.sv_schedtail	= NULL,
142
	.sv_schedtail	= NULL,
143
	.sv_trap	= NULL,
142
};
144
};
143
145
144
static Elf32_Brandinfo freebsd_brand_info = {
146
static Elf32_Brandinfo freebsd_brand_info = {
(-)sys/mips/mips/freebsd32_machdep.c (-6 / +1 lines)
Lines 106-111 Link Here
106
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
106
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
107
	.sv_syscallnames = freebsd32_syscallnames,
107
	.sv_syscallnames = freebsd32_syscallnames,
108
	.sv_schedtail	= NULL,
108
	.sv_schedtail	= NULL,
109
	.sv_trap	= NULL,
109
};
110
};
110
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
111
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
111
112
Lines 418-429 Link Here
418
		sfp = (struct sigframe32 *)((vm_offset_t)(td->td_frame->sp - 
419
		sfp = (struct sigframe32 *)((vm_offset_t)(td->td_frame->sp - 
419
		    sizeof(struct sigframe32)) & ~(sizeof(__int64_t) - 1));
420
		    sizeof(struct sigframe32)) & ~(sizeof(__int64_t) - 1));
420
421
421
	/* Translate the signal if appropriate */
422
	if (p->p_sysent->sv_sigtbl) {
423
		if (sig <= p->p_sysent->sv_sigsize)
424
			sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
425
	}
426
427
	/* Build the argument list for the signal handler. */
422
	/* Build the argument list for the signal handler. */
428
	td->td_frame->a0 = sig;
423
	td->td_frame->a0 = sig;
429
	td->td_frame->a2 = (register_t)(intptr_t)&sfp->sf_uc;
424
	td->td_frame->a2 = (register_t)(intptr_t)&sfp->sf_uc;
(-)sys/mips/mips/pm_machdep.c (-6 lines)
Lines 133-144 Link Here
133
		sfp = (struct sigframe *)((vm_offset_t)(regs->sp - 
133
		sfp = (struct sigframe *)((vm_offset_t)(regs->sp - 
134
		    sizeof(struct sigframe)) & ~(sizeof(__int64_t) - 1));
134
		    sizeof(struct sigframe)) & ~(sizeof(__int64_t) - 1));
135
135
136
	/* Translate the signal if appropriate */
137
	if (p->p_sysent->sv_sigtbl) {
138
		if (sig <= p->p_sysent->sv_sigsize)
139
			sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
140
	}
141
142
	/* Build the argument list for the signal handler. */
136
	/* Build the argument list for the signal handler. */
143
	regs->a0 = sig;
137
	regs->a0 = sig;
144
	regs->a2 = (register_t)(intptr_t)&sfp->sf_uc;
138
	regs->a2 = (register_t)(intptr_t)&sfp->sf_uc;
(-)sys/modules/Makefile (+4 lines)
Lines 197-202 Link Here
197
	${_linprocfs} \
197
	${_linprocfs} \
198
	${_linsysfs} \
198
	${_linsysfs} \
199
	${_linux} \
199
	${_linux} \
200
	${_linux_common} \
201
	${_linux64} \
200
	lmc \
202
	lmc \
201
	lpt \
203
	lpt \
202
	mac_biba \
204
	mac_biba \
Lines 741-746 Link Here
741
_linprocfs=	linprocfs
743
_linprocfs=	linprocfs
742
_linsysfs=	linsysfs
744
_linsysfs=	linsysfs
743
_linux=		linux
745
_linux=		linux
746
_linux64=	linux64
747
_linux_common=	linux_common
744
_mly=		mly
748
_mly=		mly
745
.if ${MK_OFED} != "no" || defined(ALL_MODULES)
749
.if ${MK_OFED} != "no" || defined(ALL_MODULES)
746
_mlx4=		mlx4
750
_mlx4=		mlx4
(-)sys/modules/linprocfs/Makefile (-6 / +1 lines)
Lines 5-15 Link Here
5
KMOD=	linprocfs
5
KMOD=	linprocfs
6
SRCS=	vnode_if.h \
6
SRCS=	vnode_if.h \
7
	device_if.h bus_if.h \
7
	device_if.h bus_if.h \
8
	linprocfs.c \
8
	linprocfs.c
9
	opt_compat.h
10
9
11
.if ${MACHINE_CPUARCH} == "amd64"
12
CFLAGS+=-DCOMPAT_LINUX32
13
.endif
14
15
.include <bsd.kmod.mk>
10
.include <bsd.kmod.mk>
(-)sys/modules/linsysfs/Makefile (-6 / +1 lines)
Lines 5-15 Link Here
5
KMOD=	linsysfs
5
KMOD=	linsysfs
6
SRCS=	vnode_if.h \
6
SRCS=	vnode_if.h \
7
	device_if.h bus_if.h  pci_if.h \
7
	device_if.h bus_if.h  pci_if.h \
8
	linsysfs.c \
8
	linsysfs.c
9
	opt_compat.h
10
9
11
.if ${MACHINE_CPUARCH} == "amd64"
12
CFLAGS+=-DCOMPAT_LINUX32
13
.endif
14
15
.include <bsd.kmod.mk>
10
.include <bsd.kmod.mk>
(-)sys/modules/linux/Makefile (-20 / +40 lines)
Lines 7-21 Link Here
7
7
8
.PATH: ${.CURDIR}/../../compat/linux ${.CURDIR}/../../${MACHINE_CPUARCH}/linux${SFX}
8
.PATH: ${.CURDIR}/../../compat/linux ${.CURDIR}/../../${MACHINE_CPUARCH}/linux${SFX}
9
9
10
VDSO=	linux${SFX}_vdso
11
10
KMOD=	linux
12
KMOD=	linux
11
SRCS=	linux_fork.c linux${SFX}_dummy.c linux_emul.c linux_file.c \
13
SRCS=	linux_fork.c linux${SFX}_dummy.c linux_file.c linux_event.c \
12
	linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \
14
	linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \
13
	linux${SFX}_machdep.c linux_mib.c linux_misc.c linux_signal.c \
15
	linux${SFX}_machdep.c linux_misc.c linux_signal.c \
14
	linux_socket.c linux_stats.c linux_sysctl.c linux${SFX}_sysent.c \
16
	linux_socket.c linux_stats.c linux_sysctl.c linux${SFX}_sysent.c \
15
	linux${SFX}_sysvec.c linux_uid16.c linux_util.c linux_time.c \
17
	linux${SFX}_sysvec.c linux_uid16.c linux_time.c \
16
	linux_timer.c \
18
	linux_timer.c linux_vdso.c \
17
	opt_inet6.h opt_compat.h opt_kdtrace.h opt_posix.h opt_usb.h \
19
	opt_inet6.h opt_compat.h opt_posix.h opt_usb.h vnode_if.h \
18
	vnode_if.h device_if.h bus_if.h assym.s
20
	device_if.h bus_if.h assym.s \
21
	linux${SFX}_support.s
19
DPSRCS=	linux${SFX}_genassym.c
22
DPSRCS=	linux${SFX}_genassym.c
20
23
21
# XXX: for assym.s
24
# XXX: for assym.s
Lines 24-68 Link Here
24
SRCS+=	opt_apic.h
27
SRCS+=	opt_apic.h
25
.endif
28
.endif
26
29
27
OBJS=	linux${SFX}_locore.o linux${SFX}_support.o
30
OBJS=	${VDSO}.so
28
31
29
.if ${MACHINE_CPUARCH} == "i386"
32
.if ${MACHINE_CPUARCH} == "i386"
30
SRCS+=	linux_ptrace.c imgact_linux.c opt_cpu.h
33
SRCS+=	linux_ptrace.c imgact_linux.c linux_util.c linux_mib.c \
34
	linux_emul.c opt_cpu.h linux.c
31
.endif
35
.endif
32
36
37
.if ${MACHINE_CPUARCH} == "i386"
33
EXPORT_SYMS=
38
EXPORT_SYMS=
34
EXPORT_SYMS+=	linux_emul_path
39
EXPORT_SYMS+=	linux_emul_path
35
EXPORT_SYMS+=	linux_get_osname
40
EXPORT_SYMS+=	linux_get_osname
36
EXPORT_SYMS+=	linux_get_osrelease
41
EXPORT_SYMS+=	linux_get_osrelease
37
EXPORT_SYMS+=	linux_ifname
38
EXPORT_SYMS+=	linux_ioctl_register_handler
42
EXPORT_SYMS+=	linux_ioctl_register_handler
39
EXPORT_SYMS+=	linux_ioctl_unregister_handler
43
EXPORT_SYMS+=	linux_ioctl_unregister_handler
44
.endif
40
45
41
CLEANFILES=	linux${SFX}_assym.h linux${SFX}_genassym.o
46
CLEANFILES=	linux${SFX}_assym.h linux${SFX}_genassym.o linux${SFX}_locore.o
42
47
43
linux${SFX}_assym.h: linux${SFX}_genassym.o
48
linux${SFX}_assym.h: linux${SFX}_genassym.o
44
.if exists(@)
49
	sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET}
45
linux${SFX}_assym.h: @/kern/genassym.sh
46
.endif
47
	sh @/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET}
48
50
49
linux${SFX}_locore.o: linux${SFX}_locore.s linux${SFX}_assym.h
51
linux${SFX}_locore.o: linux${SFX}_assym.h assym.s
50
	${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
52
	${CC} -x assembler-with-cpp -DLOCORE -m32 -shared -s			\
53
	-pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -nostdinc -nostdlib	\
54
	-fno-omit-frame-pointer							\
55
	-Wl,-T${.CURDIR}/../../${MACHINE_CPUARCH}/linux${SFX}/${VDSO}.lds.s	\
56
	-Wl,-soname=${VDSO}.so.1,--eh-frame-hdr,-fPIC,-warn-common		\
51
	    ${.IMPSRC} -o ${.TARGET}
57
	    ${.IMPSRC} -o ${.TARGET}
52
58
53
linux${SFX}_support.o: linux${SFX}_support.s assym.s linux${SFX}_assym.h
59
linux${SFX}_support.o: linux${SFX}_assym.h assym.s
54
	${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
60
	${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
55
	    ${.IMPSRC} -o ${.TARGET}
61
	    ${.IMPSRC} -o ${.TARGET}
56
62
57
linux${SFX}_genassym.o: linux${SFX}_genassym.c linux.h @ machine x86
63
.if ${MACHINE_CPUARCH} == "amd64"
64
${VDSO}.so: linux${SFX}_locore.o
65
	${OBJCOPY} --input binary --output elf64-x86-64-freebsd			\
66
	    --binary-architecture i386 linux${SFX}_locore.o ${.TARGET}
67
.else
68
${VDSO}.so: linux${SFX}_locore.o
69
	${OBJCOPY} --input binary --output elf32-i386-freebsd			\
70
	    --binary-architecture i386 linux${SFX}_locore.o ${.TARGET}
71
.endif
72
73
linux${SFX}_genassym.o:
58
	${CC} -c ${CFLAGS:N-fno-common} ${.IMPSRC}
74
	${CC} -c ${CFLAGS:N-fno-common} ${.IMPSRC}
59
75
60
.if !defined(KERNBUILDDIR)
76
.if !defined(KERNBUILDDIR)
61
opt_inet6.h:
62
	echo "#define INET6 1" > ${.TARGET}
63
.if defined(KTR)
77
.if defined(KTR)
64
CFLAGS+=	-DKTR
78
CFLAGS+=	-DKTR
65
.endif
79
.endif
80
.if defined(DEBUG)
81
CFLAGS+=	-DDEBUG
66
.endif
82
.endif
83
.if defined(DEBUG)
84
CFLAGS+=	-DDEBUG
85
.endif
86
.endif
67
87
68
.include <bsd.kmod.mk>
88
.include <bsd.kmod.mk>
(-)sys/modules/linux64/Makefile (+55 lines)
Line 0 Link Here
1
# $FreeBSD$
2
3
.PATH: ${.CURDIR}/../../compat/linux ${.CURDIR}/../../${MACHINE_ARCH}/linux
4
5
VDSO=	linux_vdso
6
7
KMOD=	linux64
8
SRCS=	linux_fork.c linux_dummy.c linux_file.c linux_event.c \
9
	linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \
10
	linux_machdep.c linux_misc.c linux_signal.c \
11
	linux_socket.c linux_stats.c linux_sysctl.c linux_sysent.c \
12
	linux_sysvec.c linux_time.c linux_vdso.c linux_timer.c \
13
	opt_inet6.h opt_compat.h opt_kdtrace.h opt_posix.h opt_usb.h \
14
	vnode_if.h device_if.h bus_if.h assym.s \
15
	linux_support.s
16
DPSRCS=	linux_genassym.c
17
18
# XXX: for assym.s
19
SRCS+=  opt_kstack_pages.h opt_nfs.h opt_apic.h opt_hwpmc_hooks.h
20
21
CLEANFILES=	linux_assym.h linux_genassym.o linux_locore.o
22
23
OBJS=	${VDSO}.so
24
25
linux_assym.h: linux_genassym.o
26
	sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET}
27
28
linux_locore.o: linux_locore.s linux_assym.h
29
	${CC} -x assembler-with-cpp -DLOCORE -shared -mcmodel=small	\
30
	-pipe -I. -I${SYSDIR} -Werror -Wall -fno-common -nostdinc 	\
31
	-Wl,-T${.CURDIR}/../../${MACHINE_CPUARCH}/linux/${VDSO}.lds.s	\
32
	-Wl,-soname=${VDSO}.so.1,-fPIC,-warn-common -nostdlib		\
33
	    ${.IMPSRC} -o ${.TARGET}
34
35
${VDSO}.so: linux_locore.o
36
	${OBJCOPY} --input binary --output elf64-x86-64-freebsd		\
37
	    -S -g --binary-architecture i386:x86-64 linux_locore.o ${.TARGET}
38
39
linux_support.o: assym.s linux_assym.h
40
	${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
41
	    ${.IMPSRC} -o ${.TARGET}
42
43
linux_genassym.o:
44
	${CC} -c ${CFLAGS:N-fno-common} ${.IMPSRC}
45
46
.if !defined(KERNBUILDDIR)
47
.if defined(DEBUG)
48
CFLAGS+=-DDEBUG
49
.endif
50
.if defined(KTR)
51
CFLAGS+=-DKTR
52
.endif
53
.endif
54
55
.include <bsd.kmod.mk>
(-)sys/modules/linux_common/Makefile (+25 lines)
Line 0 Link Here
1
# $FreeBSD$
2
3
.PATH: ${.CURDIR}/../../compat/linux
4
5
KMOD=	linux_common
6
SRCS=	linux_common.c linux_mib.c linux_util.c linux_emul.c \
7
	linux.c opt_compat.h device_if.h vnode_if.h bus_if.h
8
9
EXPORT_SYMS=
10
EXPORT_SYMS+=	linux_emul_path
11
EXPORT_SYMS+=	linux_ioctl_register_handler
12
EXPORT_SYMS+=	linux_ioctl_unregister_handler
13
EXPORT_SYMS+=	linux_get_osname
14
EXPORT_SYMS+=	linux_get_osrelease
15
16
.if !defined(KERNBUILDDIR)
17
.if defined(DEBUG)
18
CFLAGS+=-DDEBUG
19
.endif
20
.if defined(KTR)
21
CFLAGS+=-DKTR
22
.endif
23
.endif
24
25
.include <bsd.kmod.mk>
(-)sys/modules/pseudofs/Makefile (+6 lines)
Lines 23-26 Link Here
23
		pfs_enable	\
23
		pfs_enable	\
24
		pfs_destroy
24
		pfs_destroy
25
25
26
.if !defined(KERNBUILDDIR)
27
.if defined(PSEUDOFS_TRACE)
28
CFLAGS+=-DPSEUDOFS_TRACE
29
.endif
30
.endif
31
26
.include <bsd.kmod.mk>
32
.include <bsd.kmod.mk>
(-)sys/powerpc/powerpc/elf32_machdep.c (+1 lines)
Lines 107-112 Link Here
107
	.sv_shared_page_base = FREEBSD32_SHAREDPAGE,
107
	.sv_shared_page_base = FREEBSD32_SHAREDPAGE,
108
	.sv_shared_page_len = PAGE_SIZE,
108
	.sv_shared_page_len = PAGE_SIZE,
109
	.sv_schedtail	= NULL,
109
	.sv_schedtail	= NULL,
110
	.sv_trap	= NULL,
110
};
111
};
111
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
112
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
112
113
(-)sys/powerpc/powerpc/elf64_machdep.c (+1 lines)
Lines 83-88 Link Here
83
	.sv_shared_page_base = SHAREDPAGE,
83
	.sv_shared_page_base = SHAREDPAGE,
84
	.sv_shared_page_len = PAGE_SIZE,
84
	.sv_shared_page_len = PAGE_SIZE,
85
	.sv_schedtail	= NULL,
85
	.sv_schedtail	= NULL,
86
	.sv_trap	= NULL,
86
};
87
};
87
INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec);
88
INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec);
88
89
(-)sys/powerpc/powerpc/exec_machdep.c (-6 lines)
Lines 231-242 Link Here
231
	}
231
	}
232
232
233
	/*
233
	/*
234
	 * Translate the signal if appropriate (Linux emu ?)
235
	 */
236
	if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
237
		sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
238
239
	/*
240
	 * Save the floating-point state, if necessary, then copy it.
234
	 * Save the floating-point state, if necessary, then copy it.
241
	 */
235
	 */
242
	/* XXX */
236
	/* XXX */
(-)sys/sparc64/sparc64/elf_machdep.c (+1 lines)
Lines 87-92 Link Here
87
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
87
	.sv_fetch_syscall_args = cpu_fetch_syscall_args,
88
	.sv_syscallnames = syscallnames,
88
	.sv_syscallnames = syscallnames,
89
	.sv_schedtail	= NULL,
89
	.sv_schedtail	= NULL,
90
	.sv_trap	= NULL,
90
};
91
};
91
92
92
static Elf64_Brandinfo freebsd_brand_info = {
93
static Elf64_Brandinfo freebsd_brand_info = {
(-)sys/sparc64/sparc64/machdep.c (-4 lines)
Lines 658-667 Link Here
658
658
659
	fp = (struct frame *)sfp - 1;
659
	fp = (struct frame *)sfp - 1;
660
660
661
	/* Translate the signal if appropriate. */
662
	if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
663
		sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
664
665
	/* Build the argument list for the signal handler. */
661
	/* Build the argument list for the signal handler. */
666
	tf->tf_out[0] = sig;
662
	tf->tf_out[0] = sig;
667
	tf->tf_out[2] = (register_t)&sfp->sf_uc;
663
	tf->tf_out[2] = (register_t)&sfp->sf_uc;
(-)sys/sys/file.h (+1 lines)
Lines 65-70 Link Here
65
#define	DTYPE_PTS	10	/* pseudo teletype master device */
65
#define	DTYPE_PTS	10	/* pseudo teletype master device */
66
#define	DTYPE_DEV	11	/* Device specific fd type */
66
#define	DTYPE_DEV	11	/* Device specific fd type */
67
#define	DTYPE_PROCDESC	12	/* process descriptor */
67
#define	DTYPE_PROCDESC	12	/* process descriptor */
68
#define	DTYPE_LINUXEFD	13	/* emulation eventfd type */
68
69
69
#ifdef _KERNEL
70
#ifdef _KERNEL
70
71
(-)sys/sys/filedesc.h (+2 lines)
Lines 156-161 Link Here
156
int	fdcheckstd(struct thread *td);
156
int	fdcheckstd(struct thread *td);
157
void	fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td);
157
void	fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td);
158
void	fdcloseexec(struct thread *td);
158
void	fdcloseexec(struct thread *td);
159
void	fddrop(struct filedesc *fdp);
160
struct	filedesc *fdhold(struct proc *p);
159
struct	filedesc *fdcopy(struct filedesc *fdp);
161
struct	filedesc *fdcopy(struct filedesc *fdp);
160
void	fdunshare(struct thread *td);
162
void	fdunshare(struct thread *td);
161
void	fdescfree(struct thread *td);
163
void	fdescfree(struct thread *td);
(-)sys/sys/proc.h (-6 / +24 lines)
Lines 148-153 Link Here
148
 *      q - td_contested lock
148
 *      q - td_contested lock
149
 *      r - p_peers lock
149
 *      r - p_peers lock
150
 *      t - thread lock
150
 *      t - thread lock
151
 *	u - process stat lock
152
 *	w - process timer lock
151
 *      x - created at fork, only changes during single threading in exec
153
 *      x - created at fork, only changes during single threading in exec
152
 *      y - created at first aio, doesn't change until exit or exec at which
154
 *      y - created at first aio, doesn't change until exit or exec at which
153
 *          point we are single-threaded and only curthread changes it
155
 *          point we are single-threaded and only curthread changes it
Lines 183-196 Link Here
183
 * userland asks for rusage info.  Backwards compatibility prevents putting
185
 * userland asks for rusage info.  Backwards compatibility prevents putting
184
 * this directly in the user-visible rusage struct.
186
 * this directly in the user-visible rusage struct.
185
 *
187
 *
186
 * Locking for p_rux: (cj) means (j) for p_rux and (c) for p_crux.
188
 * Locking for p_rux: (cu) means (u) for p_rux and (c) for p_crux.
187
 * Locking for td_rux: (t) for all fields.
189
 * Locking for td_rux: (t) for all fields.
188
 */
190
 */
189
struct rusage_ext {
191
struct rusage_ext {
190
	uint64_t	rux_runtime;    /* (cj) Real time. */
192
	uint64_t	rux_runtime;    /* (cu) Real time. */
191
	uint64_t	rux_uticks;     /* (cj) Statclock hits in user mode. */
193
	uint64_t	rux_uticks;     /* (cu) Statclock hits in user mode. */
192
	uint64_t	rux_sticks;     /* (cj) Statclock hits in sys mode. */
194
	uint64_t	rux_sticks;     /* (cu) Statclock hits in sys mode. */
193
	uint64_t	rux_iticks;     /* (cj) Statclock hits in intr mode. */
195
	uint64_t	rux_iticks;     /* (cu) Statclock hits in intr mode. */
194
	uint64_t	rux_uu;         /* (c) Previous user time in usec. */
196
	uint64_t	rux_uu;         /* (c) Previous user time in usec. */
195
	uint64_t	rux_su;         /* (c) Previous sys time in usec. */
197
	uint64_t	rux_su;         /* (c) Previous sys time in usec. */
196
	uint64_t	rux_tu;         /* (c) Previous total time in usec. */
198
	uint64_t	rux_tu;         /* (c) Previous total time in usec. */
Lines 320-325 Link Here
320
	struct vm_page	**td_ma;	/* (k) uio pages held */
322
	struct vm_page	**td_ma;	/* (k) uio pages held */
321
	int		td_ma_cnt;	/* (k) size of *td_ma */
323
	int		td_ma_cnt;	/* (k) size of *td_ma */
322
	void		*td_su;		/* (k) FFS SU private */
324
	void		*td_su;		/* (k) FFS SU private */
325
	void		*td_emuldata;	/* Emulator state data */
323
};
326
};
324
327
325
struct mtx *thread_lock_block(struct thread *);
328
struct mtx *thread_lock_block(struct thread *);
Lines 509-514 Link Here
509
	LIST_ENTRY(proc) p_sibling;	/* (e) List of sibling processes. */
512
	LIST_ENTRY(proc) p_sibling;	/* (e) List of sibling processes. */
510
	LIST_HEAD(, proc) p_children;	/* (e) Pointer to list of children. */
513
	LIST_HEAD(, proc) p_children;	/* (e) Pointer to list of children. */
511
	struct mtx	p_mtx;		/* (n) Lock for this struct. */
514
	struct mtx	p_mtx;		/* (n) Lock for this struct. */
515
	struct mtx	p_statmtx;	/* Lock for the stats */
516
	struct mtx	p_itimmtx;	/* Lock for the virt/prof timers */
517
	struct mtx	p_profmtx;	/* Lock for the profiling */
512
	struct ksiginfo *p_ksi;	/* Locked by parent proc lock */
518
	struct ksiginfo *p_ksi;	/* Locked by parent proc lock */
513
	sigqueue_t	p_sigqueue;	/* (c) Sigs not delivered to a td. */
519
	sigqueue_t	p_sigqueue;	/* (c) Sigs not delivered to a td. */
514
#define p_siglist	p_sigqueue.sq_signals
520
#define p_siglist	p_sigqueue.sq_signals
Lines 520-526 Link Here
520
	u_int		p_swtick;	/* (c) Tick when swapped in or out. */
526
	u_int		p_swtick;	/* (c) Tick when swapped in or out. */
521
	struct itimerval p_realtimer;	/* (c) Alarm timer. */
527
	struct itimerval p_realtimer;	/* (c) Alarm timer. */
522
	struct rusage	p_ru;		/* (a) Exit information. */
528
	struct rusage	p_ru;		/* (a) Exit information. */
523
	struct rusage_ext p_rux;	/* (cj) Internal resource usage. */
529
	struct rusage_ext p_rux;	/* (cu) Internal resource usage. */
524
	struct rusage_ext p_crux;	/* (c) Internal child resource usage. */
530
	struct rusage_ext p_crux;	/* (c) Internal child resource usage. */
525
	int		p_profthreads;	/* (c) Num threads in addupc_task. */
531
	int		p_profthreads;	/* (c) Num threads in addupc_task. */
526
	volatile int	p_exitthreads;	/* (j) Number of threads exiting */
532
	volatile int	p_exitthreads;	/* (j) Number of threads exiting */
Lines 612-617 Link Here
612
#define	PROC_SUNLOCK(p)	mtx_unlock_spin(&(p)->p_slock)
618
#define	PROC_SUNLOCK(p)	mtx_unlock_spin(&(p)->p_slock)
613
#define	PROC_SLOCK_ASSERT(p, type)	mtx_assert(&(p)->p_slock, (type))
619
#define	PROC_SLOCK_ASSERT(p, type)	mtx_assert(&(p)->p_slock, (type))
614
620
621
#define	PROC_STATLOCK(p)	mtx_lock_spin(&(p)->p_statmtx)
622
#define	PROC_STATUNLOCK(p)	mtx_unlock_spin(&(p)->p_statmtx)
623
#define	PROC_STATLOCK_ASSERT(p, type)	mtx_assert(&(p)->p_statmtx, (type))
624
625
#define	PROC_ITIMLOCK(p)	mtx_lock_spin(&(p)->p_itimmtx)
626
#define	PROC_ITIMUNLOCK(p)	mtx_unlock_spin(&(p)->p_itimmtx)
627
#define	PROC_ITIMLOCK_ASSERT(p, type)	mtx_assert(&(p)->p_itimmtx, (type))
628
629
#define	PROC_PROFLOCK(p)	mtx_lock_spin(&(p)->p_profmtx)
630
#define	PROC_PROFUNLOCK(p)	mtx_unlock_spin(&(p)->p_profmtx)
631
#define	PROC_PROFLOCK_ASSERT(p, type)	mtx_assert(&(p)->p_profmtx, (type))
632
615
/* These flags are kept in p_flag. */
633
/* These flags are kept in p_flag. */
616
#define	P_ADVLOCK	0x00001	/* Process may hold a POSIX advisory lock. */
634
#define	P_ADVLOCK	0x00001	/* Process may hold a POSIX advisory lock. */
617
#define	P_CONTROLT	0x00002	/* Has a controlling terminal. */
635
#define	P_CONTROLT	0x00002	/* Has a controlling terminal. */
(-)sys/sys/resourcevar.h (-6 / +7 lines)
Lines 47-67 Link Here
47
 * Locking key:
47
 * Locking key:
48
 *      b - created at fork, never changes
48
 *      b - created at fork, never changes
49
 *      c - locked by proc mtx
49
 *      c - locked by proc mtx
50
 *      j - locked by proc slock
51
 *      k - only accessed by curthread
50
 *      k - only accessed by curthread
51
 *      w - locked by proc itim lock
52
 *	w2 - locked by proc prof lock
52
 */
53
 */
53
struct pstats {
54
struct pstats {
54
#define	pstat_startzero	p_cru
55
#define	pstat_startzero	p_cru
55
	struct	rusage p_cru;		/* Stats for reaped children. */
56
	struct	rusage p_cru;		/* Stats for reaped children. */
56
	struct	itimerval p_timer[3];	/* (j) Virtual-time timers. */
57
	struct	itimerval p_timer[3];	/* (w) Virtual-time timers. */
57
#define	pstat_endzero	pstat_startcopy
58
#define	pstat_endzero	pstat_startcopy
58
59
59
#define	pstat_startcopy	p_prof
60
#define	pstat_startcopy	p_prof
60
	struct uprof {			/* Profile arguments. */
61
	struct uprof {			/* Profile arguments. */
61
		caddr_t	pr_base;	/* (c + j) Buffer base. */
62
		caddr_t	pr_base;	/* (c + w2) Buffer base. */
62
		u_long	pr_size;	/* (c + j) Buffer size. */
63
		u_long	pr_size;	/* (c + w2) Buffer size. */
63
		u_long	pr_off;		/* (c + j) PC offset. */
64
		u_long	pr_off;		/* (c + w2) PC offset. */
64
		u_long	pr_scale;	/* (c + j) PC scaling. */
65
		u_long	pr_scale;	/* (c + w2) PC scaling. */
65
	} p_prof;
66
	} p_prof;
66
#define	pstat_endcopy	p_start
67
#define	pstat_endcopy	p_start
67
	struct	timeval p_start;	/* (b) Starting time. */
68
	struct	timeval p_start;	/* (b) Starting time. */
(-)sys/sys/syscallsubr.h (+17 lines)
Lines 55-60 Link Here
55
struct sockaddr;
55
struct sockaddr;
56
struct stat;
56
struct stat;
57
struct thr_param;
57
struct thr_param;
58
struct sched_param;
58
struct __wrusage;
59
struct __wrusage;
59
60
60
int	kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg,
61
int	kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg,
Lines 125-130 Link Here
125
int	kern_jail_set(struct thread *td, struct uio *options, int flags);
126
int	kern_jail_set(struct thread *td, struct uio *options, int flags);
126
int	kern_kevent(struct thread *td, int fd, int nchanges, int nevents,
127
int	kern_kevent(struct thread *td, int fd, int nchanges, int nevents,
127
	    struct kevent_copyops *k_ops, const struct timespec *timeout);
128
	    struct kevent_copyops *k_ops, const struct timespec *timeout);
129
int	kern_kevent_fp(struct thread *td, struct file *fp, int nchanges,
130
	    int nevents, struct kevent_copyops *k_ops,
131
	    const struct timespec *timeout);
132
int	kern_kqueue(struct thread *td, int flags);
128
int	kern_kldload(struct thread *td, const char *file, int *fileid);
133
int	kern_kldload(struct thread *td, const char *file, int *fileid);
129
int	kern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat);
134
int	kern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat);
130
int	kern_kldunload(struct thread *td, int fileid, int flags);
135
int	kern_kldunload(struct thread *td, int fileid, int flags);
Lines 193-200 Link Here
193
int	kern_rmdir(struct thread *td, char *path, enum uio_seg pathseg);
198
int	kern_rmdir(struct thread *td, char *path, enum uio_seg pathseg);
194
int	kern_rmdirat(struct thread *td, int fd, char *path,
199
int	kern_rmdirat(struct thread *td, int fd, char *path,
195
	    enum uio_seg pathseg);
200
	    enum uio_seg pathseg);
201
int	kern_sched_getparam(struct thread *td, struct thread *targettd,
202
	    struct sched_param *param);
203
int	kern_sched_getscheduler(struct thread *td, struct thread *targettd,
204
	    int *policy);
205
int	kern_sched_setparam(struct thread *td, struct thread *targettd,
206
	    struct sched_param *param);
207
int	kern_sched_setscheduler(struct thread *td, struct thread *targettd,
208
	    int policy, struct sched_param *param);
196
int	kern_sched_rr_get_interval(struct thread *td, pid_t pid,
209
int	kern_sched_rr_get_interval(struct thread *td, pid_t pid,
197
	    struct timespec *ts);
210
	    struct timespec *ts);
211
int	kern_sched_rr_get_interval_td(struct thread *td, struct thread *targettd,
212
	    struct timespec *ts);
198
int	kern_semctl(struct thread *td, int semid, int semnum, int cmd,
213
int	kern_semctl(struct thread *td, int semid, int semnum, int cmd,
199
	    union semun *arg, register_t *rval);
214
	    union semun *arg, register_t *rval);
200
int	kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
215
int	kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
Lines 244-249 Link Here
244
int	kern_ktimer_gettime(struct thread *td, int timer_id,
259
int	kern_ktimer_gettime(struct thread *td, int timer_id,
245
	    struct itimerspec *val);
260
	    struct itimerspec *val);
246
int	kern_ktimer_getoverrun(struct thread *td, int timer_id);
261
int	kern_ktimer_getoverrun(struct thread *td, int timer_id);
262
int	kern_thr_alloc(struct proc *, int pages, struct thread **);
263
int	kern_thr_exit(struct thread *td);
247
int	kern_thr_new(struct thread *td, struct thr_param *param);
264
int	kern_thr_new(struct thread *td, struct thr_param *param);
248
int	kern_thr_suspend(struct thread *td, struct timespec *tsp);
265
int	kern_thr_suspend(struct thread *td, struct timespec *tsp);
249
int	kern_truncate(struct thread *td, char *path, enum uio_seg pathseg,
266
int	kern_truncate(struct thread *td, char *path, enum uio_seg pathseg,
(-)sys/sys/sysent.h (+4 lines)
Lines 130-135 Link Here
130
	uint32_t	sv_timekeep_gen;
130
	uint32_t	sv_timekeep_gen;
131
	void		*sv_shared_page_obj;
131
	void		*sv_shared_page_obj;
132
	void		(*sv_schedtail)(struct thread *);
132
	void		(*sv_schedtail)(struct thread *);
133
	void		(*sv_thread_detach)(struct thread *);
134
	int		(*sv_trap)(struct thread *, struct trapframe *);
133
};
135
};
134
136
135
#define	SV_ILP32	0x000100
137
#define	SV_ILP32	0x000100
Lines 138-146 Link Here
138
#define	SV_AOUT		0x008000
140
#define	SV_AOUT		0x008000
139
#define	SV_SHP		0x010000
141
#define	SV_SHP		0x010000
140
142
143
#define	SV_IS_MASK	0x007f00
141
#define	SV_ABI_MASK	0xff
144
#define	SV_ABI_MASK	0xff
142
#define	SV_PROC_FLAG(p, x)	((p)->p_sysent->sv_flags & (x))
145
#define	SV_PROC_FLAG(p, x)	((p)->p_sysent->sv_flags & (x))
143
#define	SV_PROC_ABI(p)		((p)->p_sysent->sv_flags & SV_ABI_MASK)
146
#define	SV_PROC_ABI(p)		((p)->p_sysent->sv_flags & SV_ABI_MASK)
147
#define	SV_PROC_IS(p)		((p)->p_sysent->sv_flags & SV_IS_MASK)
144
#define	SV_CURPROC_FLAG(x)	SV_PROC_FLAG(curproc, x)
148
#define	SV_CURPROC_FLAG(x)	SV_PROC_FLAG(curproc, x)
145
#define	SV_CURPROC_ABI()	SV_PROC_ABI(curproc)
149
#define	SV_CURPROC_ABI()	SV_PROC_ABI(curproc)
146
/* same as ELFOSABI_XXX, to prevent header pollution */
150
/* same as ELFOSABI_XXX, to prevent header pollution */
(-)usr.bin/kdump/Makefile (-5 / +8 lines)
Lines 3-12 Link Here
3
3
4
.include <bsd.own.mk>
4
.include <bsd.own.mk>
5
5
6
.if (${MACHINE_ARCH} == "amd64")
7
SFX=		32
8
.endif
9
10
.PATH: ${.CURDIR}/../ktrace
6
.PATH: ${.CURDIR}/../ktrace
11
7
12
PROG=		kdump
8
PROG=		kdump
Lines 25-30 Link Here
25
.if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386")
21
.if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386")
26
CLEANFILES+=	linux_syscalls.c
22
CLEANFILES+=	linux_syscalls.c
27
.endif
23
.endif
24
.if (${MACHINE_ARCH} == "amd64")
25
CLEANFILES+=	linux32_syscalls.c
26
.endif
28
27
29
ioctl.c: mkioctls
28
ioctl.c: mkioctls
30
	env MACHINE=${MACHINE} CPP="${CPP}" \
29
	env MACHINE=${MACHINE} CPP="${CPP}" \
Lines 38-44 Link Here
38
	sh ${.CURDIR}/mksubr ${DESTDIR}/usr/include >${.TARGET}
37
	sh ${.CURDIR}/mksubr ${DESTDIR}/usr/include >${.TARGET}
39
.if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386")
38
.if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386")
40
	sh ${.CURDIR}/../../sys/kern/makesyscalls.sh \
39
	sh ${.CURDIR}/../../sys/kern/makesyscalls.sh \
41
	    ${.CURDIR}/../../sys/${MACHINE_ARCH}/linux${SFX}/syscalls.master ${.CURDIR}/linux_syscalls.conf
40
	    ${.CURDIR}/../../sys/${MACHINE_ARCH}/linux/syscalls.master ${.CURDIR}/linux_syscalls.conf
42
.endif
41
.endif
42
.if (${MACHINE_ARCH} == "amd64")
43
	sh ${.CURDIR}/../../sys/kern/makesyscalls.sh \
44
	    ${.CURDIR}/../../sys/${MACHINE_ARCH}/linux32/syscalls.master ${.CURDIR}/linux32_syscalls.conf
45
.endif
43
46
44
.include <bsd.prog.mk>
47
.include <bsd.prog.mk>
(-)usr.bin/kdump/kdump.c (-10 / +30 lines)
Lines 139-146 Link Here
139
139
140
#if defined(__amd64__) || defined(__i386__)
140
#if defined(__amd64__) || defined(__i386__)
141
141
142
void linux_ktrsyscall(struct ktr_syscall *);
142
void linux_ktrsyscall(struct ktr_syscall *, u_int);
143
void linux_ktrsysret(struct ktr_sysret *);
143
void linux_ktrsysret(struct ktr_sysret *, u_int);
144
extern const char *linux_syscallnames[];
144
extern const char *linux_syscallnames[];
145
145
146
#include <linux_syscalls.c>
146
#include <linux_syscalls.c>
Lines 165-170 Link Here
165
};
165
};
166
#endif
166
#endif
167
167
168
#if defined(__amd64__)
169
extern const char *linux32_syscallnames[];
170
#include <linux32_syscalls.c>
171
static int nlinux32_syscalls = sizeof(linux32_syscallnames) / \
172
				sizeof(linux32_syscallnames[0]);
173
#endif
174
168
struct proc_info
175
struct proc_info
169
{
176
{
170
	TAILQ_ENTRY(proc_info)	info;
177
	TAILQ_ENTRY(proc_info)	info;
Lines 331-337 Link Here
331
		case KTR_SYSCALL:
338
		case KTR_SYSCALL:
332
#if defined(__amd64__) || defined(__i386__)
339
#if defined(__amd64__) || defined(__i386__)
333
			if ((sv_flags & SV_ABI_MASK) == SV_ABI_LINUX)
340
			if ((sv_flags & SV_ABI_MASK) == SV_ABI_LINUX)
334
				linux_ktrsyscall((struct ktr_syscall *)m);
341
				linux_ktrsyscall((struct ktr_syscall *)m,
342
				    sv_flags);
335
			else
343
			else
336
#endif
344
#endif
337
				ktrsyscall((struct ktr_syscall *)m, sv_flags);
345
				ktrsyscall((struct ktr_syscall *)m, sv_flags);
Lines 339-345 Link Here
339
		case KTR_SYSRET:
347
		case KTR_SYSRET:
340
#if defined(__amd64__) || defined(__i386__)
348
#if defined(__amd64__) || defined(__i386__)
341
			if ((sv_flags & SV_ABI_MASK) == SV_ABI_LINUX)
349
			if ((sv_flags & SV_ABI_MASK) == SV_ABI_LINUX)
342
				linux_ktrsysret((struct ktr_sysret *)m);
350
				linux_ktrsysret((struct ktr_sysret *)m, 
351
				    sv_flags);
343
			else
352
			else
344
#endif
353
#endif
345
				ktrsysret((struct ktr_sysret *)m, sv_flags);
354
				ktrsysret((struct ktr_sysret *)m, sv_flags);
Lines 1890-1905 Link Here
1890
}
1899
}
1891
1900
1892
#if defined(__amd64__) || defined(__i386__)
1901
#if defined(__amd64__) || defined(__i386__)
1902
1903
#if defined(__amd64__)
1904
#define	NLINUX_SYSCALLS(v)		((v) & SV_ILP32 ?		\
1905
	    nlinux32_syscalls : nlinux_syscalls)
1906
#define	LINUX_SYSCALLNAMES(v, i)	((v) & SV_ILP32 ?		\
1907
	    linux32_syscallnames[i] : linux_syscallnames[i])
1908
#else
1909
#define	NLINUX_SYSCALLS(v)		(nlinux_syscalls)
1910
#define	LINUX_SYSCALLNAMES(v, i)	(linux_syscallnames[i])
1911
#endif
1912
1893
void
1913
void
1894
linux_ktrsyscall(struct ktr_syscall *ktr)
1914
linux_ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags)
1895
{
1915
{
1896
	int narg = ktr->ktr_narg;
1916
	int narg = ktr->ktr_narg;
1897
	register_t *ip;
1917
	register_t *ip;
1898
1918
1899
	if (ktr->ktr_code >= nlinux_syscalls || ktr->ktr_code < 0)
1919
	if (ktr->ktr_code >= NLINUX_SYSCALLS(sv_flags) || ktr->ktr_code < 0)
1900
		printf("[%d]", ktr->ktr_code);
1920
		printf("[%d]", ktr->ktr_code);
1901
	else {
1921
	else {
1902
		printf("%s", linux_syscallnames[ktr->ktr_code]);
1922
		printf("%s", LINUX_SYSCALLNAMES(sv_flags, ktr->ktr_code));
1903
		if (syscallno)
1923
		if (syscallno)
1904
			printf("[%d]", ktr->ktr_code);
1924
			printf("[%d]", ktr->ktr_code);
1905
	}
1925
	}
Lines 1914-1929 Link Here
1914
}
1934
}
1915
1935
1916
void
1936
void
1917
linux_ktrsysret(struct ktr_sysret *ktr)
1937
linux_ktrsysret(struct ktr_sysret *ktr, u_int sv_flags)
1918
{
1938
{
1919
	register_t ret = ktr->ktr_retval;
1939
	register_t ret = ktr->ktr_retval;
1920
	int error = ktr->ktr_error;
1940
	int error = ktr->ktr_error;
1921
	int code = ktr->ktr_code;
1941
	int code = ktr->ktr_code;
1922
1942
1923
	if (code >= nlinux_syscalls || code < 0)
1943
	if (code >= NLINUX_SYSCALLS(sv_flags) || code < 0)
1924
		printf("[%d] ", code);
1944
		printf("[%d] ", code);
1925
	else {
1945
	else {
1926
		printf("%s", linux_syscallnames[code]);
1946
		printf("%s ", LINUX_SYSCALLNAMES(sv_flags, code));
1927
		if (syscallno)
1947
		if (syscallno)
1928
			printf("[%d]", code);
1948
			printf("[%d]", code);
1929
		printf(" ");
1949
		printf(" ");
(-)usr.bin/kdump/linux32_syscalls.conf (+11 lines)
Line 0 Link Here
1
# $FreeBSD$
2
sysnames="linux32_syscalls.c"
3
sysproto="/dev/null"
4
sysproto_h=_LINUX32_SYSPROTO_H_
5
syshdr="/dev/null"
6
syssw="/dev/null"
7
sysmk="/dev/null"
8
syscallprefix="LINUX32_SYS_"
9
switchname="/dev/null"
10
namesname="linux32_syscallnames"
11
systrace="/dev/null"

Return to bug 201299