diff options
author | Warner Losh <imp@bsdimp.com> | 2022-06-11 21:32:19 -0600 |
---|---|---|
committer | Warner Losh <imp@bsdimp.com> | 2022-06-13 15:48:09 -0600 |
commit | 77d3522b3fb6da9f39ada61fe7c2d0121c10de7f (patch) | |
tree | d49dd3f074e090dd5def2c6a765840e07de26c0e /bsd-user/freebsd | |
parent | dcb40541ebca7ec98a14d461593b3cd7282b4fac (diff) | |
download | qemu-77d3522b3fb6da9f39ada61fe7c2d0121c10de7f.zip qemu-77d3522b3fb6da9f39ada61fe7c2d0121c10de7f.tar.gz qemu-77d3522b3fb6da9f39ada61fe7c2d0121c10de7f.tar.bz2 |
bsd-user: Implement open, openat and close
Add the open, openat and close system calls. We need to lock paths, so
implmenent that as well.
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Jung-uk Kim <jkim@FreeBSD.org>
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'bsd-user/freebsd')
-rw-r--r-- | bsd-user/freebsd/os-syscall.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index 71aa0d3..a824785 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -44,6 +44,10 @@ #include "bsd-proc.h" /* I/O */ +safe_syscall3(int, open, const char *, path, int, flags, mode_t, mode); +safe_syscall4(int, openat, int, fd, const char *, path, int, flags, mode_t, + mode); + safe_syscall3(ssize_t, read, int, fd, void *, buf, size_t, nbytes); safe_syscall4(ssize_t, pread, int, fd, void *, buf, size_t, nbytes, off_t, offset); @@ -257,6 +261,18 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret = do_bsd_pwritev(cpu_env, arg1, arg2, arg3, arg4, arg5, arg6); break; + case TARGET_FREEBSD_NR_open: /* open(2) */ + ret = do_bsd_open(arg1, arg2, arg3); + break; + + case TARGET_FREEBSD_NR_openat: /* openat(2) */ + ret = do_bsd_openat(arg1, arg2, arg3, arg4); + break; + + case TARGET_FREEBSD_NR_close: /* close(2) */ + ret = do_bsd_close(arg1); + break; + default: qemu_log_mask(LOG_UNIMP, "Unsupported syscall: %d\n", num); ret = -TARGET_ENOSYS; |