xref: /netbsd-src/sys/compat/common/sys_descrip_100.c (revision 85cbce96d96d520dee3a6dc1ece2ea07122c1ef0)
1*85cbce96Smartin /*	$NetBSD: sys_descrip_100.c,v 1.2 2024/05/20 09:37:34 martin Exp $	*/
2679926adSchristos 
3679926adSchristos /*-
4679926adSchristos  * Copyright (c) 2024 The NetBSD Foundation, Inc.
5679926adSchristos  * All rights reserved.
6679926adSchristos  *
7679926adSchristos  * Redistribution and use in source and binary forms, with or without
8679926adSchristos  * modification, are permitted provided that the following conditions
9679926adSchristos  * are met:
10679926adSchristos  * 1. Redistributions of source code must retain the above copyright
11679926adSchristos  *    notice, this list of conditions and the following disclaimer.
12679926adSchristos  * 2. Redistributions in binary form must reproduce the above copyright
13679926adSchristos  *    notice, this list of conditions and the following disclaimer in the
14679926adSchristos  *    documentation and/or other materials provided with the distribution.
15679926adSchristos  *
16679926adSchristos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17679926adSchristos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18679926adSchristos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19679926adSchristos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20679926adSchristos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21679926adSchristos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22679926adSchristos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23679926adSchristos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24679926adSchristos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25679926adSchristos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26679926adSchristos  * POSSIBILITY OF SUCH DAMAGE.
27679926adSchristos  */
28679926adSchristos #include <sys/cdefs.h>
29*85cbce96Smartin __KERNEL_RCSID(0, "$NetBSD: sys_descrip_100.c,v 1.2 2024/05/20 09:37:34 martin Exp $");
30679926adSchristos 
31679926adSchristos #if defined(_KERNEL_OPT)
32679926adSchristos #include "opt_compat_netbsd.h"
33679926adSchristos #endif
34679926adSchristos 
35679926adSchristos #include <sys/param.h>
36679926adSchristos #include <sys/filedesc.h>
37679926adSchristos #include <sys/syscall.h>
38679926adSchristos #include <sys/syscallvar.h>
39679926adSchristos #include <sys/syscallargs.h>
40679926adSchristos 
41679926adSchristos #include <compat/common/compat_mod.h>
42679926adSchristos 
43*85cbce96Smartin static const struct syscall_package sys_descrip_100_syscalls[] = {
44*85cbce96Smartin 	{ SYS_compat_100_dup3, 0,
45*85cbce96Smartin 	    (sy_call_t *)compat_100_sys_dup3 },
46679926adSchristos 	{ 0, 0, NULL },
47679926adSchristos };
48679926adSchristos 
49679926adSchristos int
sys_descrip_100_init(void)50*85cbce96Smartin sys_descrip_100_init(void)
51679926adSchristos {
52679926adSchristos 
53*85cbce96Smartin 	return syscall_establish(NULL, sys_descrip_100_syscalls);
54679926adSchristos }
55679926adSchristos 
56679926adSchristos int
sys_descrip_100_fini(void)57*85cbce96Smartin sys_descrip_100_fini(void)
58679926adSchristos {
59679926adSchristos 
60*85cbce96Smartin 	return syscall_disestablish(NULL, sys_descrip_100_syscalls);
61679926adSchristos }
62679926adSchristos 
63679926adSchristos int
compat_100_sys_dup3(struct lwp * l,const struct compat_100_sys_dup3_args * uap,register_t * retval)64*85cbce96Smartin compat_100_sys_dup3(struct lwp *l, const struct compat_100_sys_dup3_args *uap,
65679926adSchristos     register_t *retval)
66679926adSchristos {
67679926adSchristos 	/* {
68679926adSchristos 		syscallarg(int)	from;
69679926adSchristos 		syscallarg(int)	to;
70679926adSchristos 		syscallarg(int)	flags;
71679926adSchristos 	} */
72679926adSchristos 	return dodup(l, SCARG(uap, from), SCARG(uap, to), SCARG(uap, flags),
73679926adSchristos 	    retval);
74679926adSchristos }
75