xref: /netbsd-src/sys/compat/common/vfs_syscalls_10.c (revision 8a031a1d1e0aac23d43015c71ae6350b917c8347)
1*8a031a1dSpgoyette /* $NetBSD: vfs_syscalls_10.c,v 1.5 2019/12/12 02:15:42 pgoyette Exp $	*/
2d91f98a8Spgoyette 
3d91f98a8Spgoyette /*-
4d91f98a8Spgoyette  * Copyright (c) 2018 The NetBSD Foundation, Inc.
5d91f98a8Spgoyette  * All rights reserved.
6d91f98a8Spgoyette  *
7d91f98a8Spgoyette  * This code is derived from software contributed to The NetBSD Foundation
8d91f98a8Spgoyette  * by Paul Goyette
9d91f98a8Spgoyette  *
10d91f98a8Spgoyette  * Redistribution and use in source and binary forms, with or without
11d91f98a8Spgoyette  * modification, are permitted provided that the following conditions
12d91f98a8Spgoyette  * are met:
13d91f98a8Spgoyette  * 1. Redistributions of source code must retain the above copyright
14d91f98a8Spgoyette  *    notice, this list of conditions and the following disclaimer.
15d91f98a8Spgoyette  * 2. Redistributions in binary form must reproduce the above copyright
16d91f98a8Spgoyette  *    notice, this list of conditions and the following disclaimer in the
17d91f98a8Spgoyette  *    documentation and/or other materials provided with the distribution.
18d91f98a8Spgoyette  *
19d91f98a8Spgoyette  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20d91f98a8Spgoyette  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21d91f98a8Spgoyette  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22d91f98a8Spgoyette  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23d91f98a8Spgoyette  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24d91f98a8Spgoyette  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25d91f98a8Spgoyette  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26d91f98a8Spgoyette  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27d91f98a8Spgoyette  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28d91f98a8Spgoyette  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29d91f98a8Spgoyette  * POSSIBILITY OF SUCH DAMAGE.
30d91f98a8Spgoyette  */
31d91f98a8Spgoyette 
32d91f98a8Spgoyette #include <sys/cdefs.h>
33*8a031a1dSpgoyette __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_10.c,v 1.5 2019/12/12 02:15:42 pgoyette Exp $");
34d91f98a8Spgoyette 
35d91f98a8Spgoyette #if defined(_KERNEL_OPT)
36d91f98a8Spgoyette #include "opt_compat_netbsd.h"
37d91f98a8Spgoyette #endif
38d91f98a8Spgoyette 
39d91f98a8Spgoyette #include <sys/param.h>
40d91f98a8Spgoyette #include <sys/systm.h>
41d91f98a8Spgoyette #include <sys/namei.h>
42d91f98a8Spgoyette #include <sys/vfs_syscalls.h>
43d91f98a8Spgoyette #include <sys/compat_stub.h>
44d91f98a8Spgoyette 
45d91f98a8Spgoyette #include <compat/common/compat_mod.h>
46d91f98a8Spgoyette 
47d91f98a8Spgoyette static int
real_sys_openat_10(struct pathbuf ** pb)48d91f98a8Spgoyette real_sys_openat_10(struct pathbuf **pb)
49d91f98a8Spgoyette {
50d91f98a8Spgoyette 
51d91f98a8Spgoyette 	*pb = pathbuf_create(".");
52d91f98a8Spgoyette 	return (*pb == NULL ? ENOMEM : 0);
53d91f98a8Spgoyette }
54d91f98a8Spgoyette 
vfs_syscalls_10_init(void)55d91f98a8Spgoyette void vfs_syscalls_10_init(void)
56d91f98a8Spgoyette {
57d91f98a8Spgoyette 
58*8a031a1dSpgoyette 	MODULE_HOOK_SET(vfs_openat_10_hook, real_sys_openat_10);
59d91f98a8Spgoyette }
60d91f98a8Spgoyette 
vfs_syscalls_10_fini(void)61d91f98a8Spgoyette void vfs_syscalls_10_fini(void)
62d91f98a8Spgoyette {
63d91f98a8Spgoyette 
648c2f80f1Spgoyette 	MODULE_HOOK_UNSET(vfs_openat_10_hook);
65d91f98a8Spgoyette }
66