[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 30/36] bsd-user: Implement do_freebsd_realpathat syscall
From: |
Warner Losh |
Subject: |
[PULL 30/36] bsd-user: Implement do_freebsd_realpathat syscall |
Date: |
Mon, 28 Aug 2023 17:38:15 -0600 |
From: Mikaël Urankar <mikael.urankar@gmail.com>
Signed-off-by: Mikaël Urankar <mikael.urankar@gmail.com>
Signed-off-by: Karim Taha <kariem.taha2.7@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
---
bsd-user/freebsd/os-stat.h | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/bsd-user/freebsd/os-stat.h b/bsd-user/freebsd/os-stat.h
index e31b2aab9e8..b20e2707745 100644
--- a/bsd-user/freebsd/os-stat.h
+++ b/bsd-user/freebsd/os-stat.h
@@ -634,4 +634,30 @@ static inline abi_long do_freebsd_fcntl(abi_long arg1,
abi_long arg2,
return ret;
}
+#if defined(__FreeBSD_version) && __FreeBSD_version >= 1300080
+extern int __realpathat(int fd, const char *path, char *buf, size_t size,
+ int flags);
+/* https://svnweb.freebsd.org/base?view=revision&revision=358172 */
+/* no man page */
+static inline abi_long do_freebsd_realpathat(abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
+{
+ abi_long ret;
+ void *p, *b;
+
+ LOCK_PATH(p, arg2);
+ b = lock_user(VERIFY_WRITE, arg3, arg4, 0);
+ if (b == NULL) {
+ UNLOCK_PATH(p, arg2);
+ return -TARGET_EFAULT;
+ }
+
+ ret = get_errno(__realpathat(arg1, p, b, arg4, arg5));
+ UNLOCK_PATH(p, arg2);
+ unlock_user(b, arg3, ret);
+
+ return ret;
+}
+#endif
+
#endif /* BSD_USER_FREEBSD_OS_STAT_H */
--
2.41.0
- [PULL 25/36] bsd-user: Implement freebsd11 stat related syscalls, (continued)
- [PULL 25/36] bsd-user: Implement freebsd11 stat related syscalls, Warner Losh, 2023/08/28
- [PULL 28/36] bsd-user: Implement freebsd11 getdirents related syscalls, Warner Losh, 2023/08/28
- [PULL 33/36] bsd-user: Add glue for getfh and related syscalls, Warner Losh, 2023/08/28
- [PULL 32/36] bsd-user: Add glue for the freebsd11_stat syscalls, Warner Losh, 2023/08/28
- [PULL 36/36] bsd-user: Add missing break after do_bsd_preadv, Warner Losh, 2023/08/28
- [PULL 27/36] bsd-user: Implement freebsd11 statfs related syscalls, Warner Losh, 2023/08/28
- [PULL 35/36] bsd-user: Add getdents and fcntl related system calls, Warner Losh, 2023/08/28
- [PULL 26/36] bsd-user: Implement freebsd11 fstat and fhstat related syscalls, Warner Losh, 2023/08/28
- [PULL 29/36] bsd-user: Implement freebsd11 netbsd stat related syscalls, Warner Losh, 2023/08/28
- [PULL 31/36] bsd-user: Add os-stat.c to the build, Warner Losh, 2023/08/28
- [PULL 30/36] bsd-user: Implement do_freebsd_realpathat syscall,
Warner Losh <=
- [PULL 34/36] bsd-user: Add glue for statfs related system calls, Warner Losh, 2023/08/28
- Re: [PULL 00/36] 2023q3 bsd user patches, Stefan Hajnoczi, 2023/08/29