mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
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>
This commit is contained in:
parent
dcb40541eb
commit
77d3522b3f
3 changed files with 69 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue