bsd-user: More file-related system calls
v2 cover bsd-user: More file-related system calls
A second round of mostly BSD-independent filesystem calls: mount, unmount, nmount, symlink, symlinkat, readlink, readlinkat, chmod, fchmod, lchmod, fchmodat, freebsd11_mknod, freebsd11_monodat, mknodat, chown, fchown, lchown, fchownat, chflags, lchflags, fchflags, chroot, flock, mkfifo, mkfifoat, pathconf, lpathconf, fpathconf, undelete.
These are all non-reentrant system calls, so these wrappers are pretty simple and no safe_* versions need to be created.
In addition, a small correction to an earlier series is included.
V2: Updated with review comments.
Reworked freebsd11_mknod* stuff after unifdef BSD_HAVE_INO64 Fixed comments that had too many words
Added one more hunk to remove a stary 'inline' that slipped through earlier
Need reviews on:
bsd-user: Implement symlink, symlinkat, readlink and readlinkat
bsd-user: Implement freebsd11_mknod, freebsd11_mknodat and mknodat
bsd-user: Remove stray 'inline' from do_bsd_close
Warner Losh (11):
bsd-user: Implement mount, umount and nmount
bsd-user: Implement symlink, symlinkat, readlink and readlinkat
bsd-user: implement chmod, fchmod, lchmod and fchmodat
bsd-user: Implement freebsd11_mknod, freebsd11_mknodat and mknodat
bsd-user: Implement chown, fchown, lchown and fchownat
bsd-user: Implement chflags, lchflags and fchflags
bsd-user: Implement chroot and flock
bsd-user: Implement mkfifo and mkfifoat
bsd-user: Implement pathconf, lpathconf and fpathconf
bsd-user: Implement undelete
bsd-user: Remove stray 'inline' from do_bsd_close
bsd-user/bsd-file.h | 392 +++++++++++++++++++++++++++++++++- bsd-user/freebsd/os-syscall.c | 118 ++++++++++ 2 files changed, 509 insertions(+), 1 deletion(-)
Signature · 1 line
2.33.1
PATCH v2 1/11 bsd-user: Implement mount, umount and nmount
--- bsd-user/bsd-file.h | 52 +++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 13 +++++++++ 2 files changed, 65 insertions(+)
bsd-user/bsd-file.h +52 -0
@@ -549,4 +549,56 @@ static abi_long do_bsd_sync(void)return 0 ; } +/* mount(2) */ +static abi_long do_bsd_mount (abi_long arg1,abi_long arg2,abi_long arg3, +abi_long arg4) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH2 (p1, arg1, p2, arg2); +/* +* XXX arg4 should be locked, but it isn't clear how to do that since it may +* be not be a NULL-terminated string. +*/ +if (arg4 ==0 ) { + ret =get_errno (mount (p1, p2, arg3,NULL ));/* XXX path(p2)? */ + }else { + ret =get_errno (mount (p1, p2, arg3,g2h_untagged (arg4)));/* XXX path(p2)? */ + } +UNLOCK_PATH2 (p1, arg1, p2, arg2); + +return ret; +} + +/* unmount(2) */ +static abi_long do_bsd_unmount (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (unmount (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* nmount(2) */ +static abi_long do_bsd_nmount (abi_long arg1,abi_long count, +abi_long flags) +{ +abi_long ret; +struct iovec *vec =lock_iovec (VERIFY_READ , arg1, count,1 ); + +if (vec !=NULL ) { + ret =get_errno (nmount (vec, count, flags)); +unlock_iovec (vec, arg1, count,0 ); + }else { +return -TARGET_EFAULT ; + } + +return ret; +} +#endif /* BSD_FILE_H */
bsd-user/freebsd/os-syscall.c +13 -0
@@ -33,6 +33,7 @@#include "qemu/path.h" #include <sys/syscall.h> #include <sys/param.h> +#include <sys/mount.h> #include <sys/sysctl.h> #include <utime.h>
@@ -373,6 +374,18 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret =do_bsd_sync ();break ; +case TARGET_FREEBSD_NR_mount:/* mount(2) */ + ret =do_bsd_mount (arg1, arg2, arg3, arg4); +break ; + +case TARGET_FREEBSD_NR_unmount:/* unmount(2) */ + ret =do_bsd_unmount (arg1, arg2); +break ; + +case TARGET_FREEBSD_NR_nmount:/* nmount(2) */ + ret =do_bsd_nmount (arg1, arg2, arg3); +break ; +default :qemu_log_mask (LOG_UNIMP ,"Unsupported syscall: %d\n" , num); ret = -TARGET_ENOSYS ;
Signature · 1 line
2.33.1
PATCH v2 2/11 bsd-user: Implement symlink, symlinkat, readlink and readlinkat
In reply to Warner Losh--- bsd-user/bsd-file.h | 74 +++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 16 ++++++++ 2 files changed, 90 insertions(+)
bsd-user/bsd-file.h +74 -0
@@ -601,4 +601,78 @@ static abi_long do_bsd_nmount(abi_long arg1, abi_long count, return ret; } +/* symlink(2) */ +static abi_long do_bsd_symlink (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH2 (p1, arg1, p2, arg2); + ret =get_errno (symlink (p1, p2));/* XXX path(p1), path(p2) */ +UNLOCK_PATH2 (p1, arg1, p2, arg2); + +return ret; +} + +/* symlinkat(2) */ +static abi_long do_bsd_symlinkat (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH2 (p1, arg1, p2, arg3); + ret =get_errno (symlinkat (p1, arg2, p2));/* XXX path(p1), path(p2) */ +UNLOCK_PATH2 (p1, arg1, p2, arg3); + +return ret; +} + +/* readlink(2) */ +static abi_long do_bsd_readlink (CPUArchState *env,abi_long arg1, +abi_long arg2,abi_long arg3) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); + p2 =lock_user (VERIFY_WRITE , arg2, arg3,0 ); +if (p2 ==NULL ) { +UNLOCK_PATH (p1, arg1); +return -TARGET_EFAULT ; + } +if (strcmp (p1,"/proc/curproc/file" ) ==0 ) { +CPUState *cpu =env_cpu (env); +TaskState *ts = (TaskState *)cpu->opaque; +strncpy (p2, ts->bprm->fullpath, arg3); + ret =MIN ((abi_long )strlen (ts->bprm->fullpath), arg3); + }else { + ret =get_errno (readlink (path (p1), p2, arg3)); + } +unlock_user (p2, arg2, ret); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* readlinkat(2) */ +static abi_long do_bsd_readlinkat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg2); + p2 =lock_user (VERIFY_WRITE , arg3, arg4,0 ); +if (p2 ==NULL ) { +UNLOCK_PATH (p1, arg2); +return -TARGET_EFAULT ; + } + ret =get_errno (readlinkat (arg1, p1, p2, arg4)); +unlock_user (p2, arg3, ret); +UNLOCK_PATH (p1, arg2); + +return ret; +} +#endif /* BSD_FILE_H */
bsd-user/freebsd/os-syscall.c +16 -0
@@ -386,6 +386,22 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret =do_bsd_nmount (arg1, arg2, arg3);break ; +case TARGET_FREEBSD_NR_symlink:/* symlink(2) */ + ret =do_bsd_symlink (arg1, arg2); +break ; + +case TARGET_FREEBSD_NR_symlinkat:/* symlinkat(2) */ + ret =do_bsd_symlinkat (arg1, arg2, arg3); +break ; + +case TARGET_FREEBSD_NR_readlink:/* readlink(2) */ + ret =do_bsd_readlink (cpu_env, arg1, arg2, arg3); +break ; + +case TARGET_FREEBSD_NR_readlinkat:/* readlinkat(2) */ + ret =do_bsd_readlinkat (arg1, arg2, arg3, arg4); +break ; +default :qemu_log_mask (LOG_UNIMP ,"Unsupported syscall: %d\n" , num); ret = -TARGET_ENOSYS ;
Signature · 1 line
2.33.1
PATCH v2 7/11 bsd-user: Implement chroot and flock
In reply to Warner Losh--- bsd-user/bsd-file.h | 19 +++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 8 ++++++++ 2 files changed, 27 insertions(+)
bsd-user/bsd-file.h +19 -0
@@ -848,4 +848,23 @@ static abi_long do_bsd_fchflags(abi_long arg1, abi_long arg2) return get_errno(fchflags(arg1, arg2)); } +/* chroot(2) */ +static abi_long do_bsd_chroot (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (chroot (p));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* flock(2) */ +static abi_long do_bsd_flock (abi_long arg1,abi_long arg2) +{ +return get_errno (flock (arg1, arg2)); +} +#endif /* BSD_FILE_H */
bsd-user/freebsd/os-syscall.c +8 -0
@@ -459,6 +459,14 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret =do_bsd_fchflags (arg1, arg2);break ; +case TARGET_FREEBSD_NR_chroot:/* chroot(2) */ + ret =do_bsd_chroot (arg1); +break ; + +case TARGET_FREEBSD_NR_flock:/* flock(2) */ + ret =do_bsd_flock (arg1, arg2); +break ; +default :qemu_log_mask (LOG_UNIMP ,"Unsupported syscall: %d\n" , num); ret = -TARGET_ENOSYS ;
Signature · 1 line
2.33.1
PATCH v2 3/11 bsd-user: implement chmod, fchmod, lchmod and fchmodat
In reply to Warner Losh--- bsd-user/bsd-file.h | 46 +++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 16 ++++++++++++ 2 files changed, 62 insertions(+)
bsd-user/bsd-file.h +46 -0
@@ -675,4 +675,50 @@ static abi_long do_bsd_readlinkat(abi_long arg1, abi_long arg2,return ret; } +/* chmod(2) */ +static abi_long do_bsd_chmod (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (chmod (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchmod(2) */ +static abi_long do_bsd_fchmod (abi_long arg1,abi_long arg2) +{ +return get_errno (fchmod (arg1, arg2)); +} + +/* lchmod(2) */ +static abi_long do_bsd_lchmod (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (lchmod (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchmodat(2) */ +static abi_long do_bsd_fchmodat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (fchmodat (arg1, p, arg3, arg4)); +UNLOCK_PATH (p, arg2); + +return ret; +} +#endif /* BSD_FILE_H */
bsd-user/freebsd/os-syscall.c +16 -0
@@ -402,6 +402,22 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret =do_bsd_readlinkat (arg1, arg2, arg3, arg4);break ; +case TARGET_FREEBSD_NR_chmod:/* chmod(2) */ + ret =do_bsd_chmod (arg1, arg2); +break ; + +case TARGET_FREEBSD_NR_fchmod:/* fchmod(2) */ + ret =do_bsd_fchmod (arg1, arg2); +break ; + +case TARGET_FREEBSD_NR_lchmod:/* lchmod(2) */ + ret =do_bsd_lchmod (arg1, arg2); +break ; + +case TARGET_FREEBSD_NR_fchmodat:/* fchmodat(2) */ + ret =do_bsd_fchmodat (arg1, arg2, arg3, arg4); +break ; +default :qemu_log_mask (LOG_UNIMP ,"Unsupported syscall: %d\n" , num); ret = -TARGET_ENOSYS ;
Signature · 1 line
2.33.1
PATCH v2 5/11 bsd-user: Implement chown, fchown, lchown and fchownat
In reply to Warner Losh--- bsd-user/bsd-file.h | 48 +++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 16 ++++++++++++ 2 files changed, 64 insertions(+)
bsd-user/bsd-file.h +48 -0
@@ -768,4 +768,52 @@ static abi_long do_bsd_mknodat(void *cpu_env, abi_long arg1,return ret; } +/* chown(2) */ +static abi_long do_bsd_chown (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (chown (p, arg2, arg3));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchown(2) */ +static abi_long do_bsd_fchown (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +return get_errno (fchown (arg1, arg2, arg3)); +} + +/* lchown(2) */ +static abi_long do_bsd_lchown (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (lchown (p, arg2, arg3));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchownat(2) */ +static abi_long do_bsd_fchownat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (fchownat (arg1, p, arg3, arg4, arg5));/* XXX path(p)? */ +UNLOCK_PATH (p, arg2); + +return ret; +} +#endif /* BSD_FILE_H */
bsd-user/freebsd/os-syscall.c +16 -0
@@ -431,6 +431,22 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret =do_bsd_mknodat (cpu_env, arg1, arg2, arg3, arg4, arg5, arg6);break ; +case TARGET_FREEBSD_NR_chown:/* chown(2) */ + ret =do_bsd_chown (arg1, arg2, arg3); +break ; + +case TARGET_FREEBSD_NR_fchown:/* fchown(2) */ + ret =do_bsd_fchown (arg1, arg2, arg3); +break ; + +case TARGET_FREEBSD_NR_lchown:/* lchown(2) */ + ret =do_bsd_lchown (arg1, arg2, arg3); +break ; + +case TARGET_FREEBSD_NR_fchownat:/* fchownat(2) */ + ret =do_bsd_fchownat (arg1, arg2, arg3, arg4, arg5); +break ; +default :qemu_log_mask (LOG_UNIMP ,"Unsupported syscall: %d\n" , num); ret = -TARGET_ENOSYS ;
Signature · 1 line
2.33.1
PATCH v2 4/11 bsd-user: Implement freebsd11_mknod, freebsd11_mknodat and mknodat
In reply to Warner LoshThese implement both the old-pre INO64 mknod variations, as well as the now current INO64 variant. To implement the old stuff, we use some linker magic to bind to the old versions of these functions.
--- bsd-user/bsd-file.h | 47 +++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 13 ++++++++++ 2 files changed, 60 insertions(+)
bsd-user/bsd-file.h +47 -0
@@ -721,4 +721,51 @@ static abi_long do_bsd_fchmodat(abi_long arg1, abi_long arg2, return ret; } +/* pre-ino64 mknod(2) */ +static abi_long do_bsd_freebsd11_mknod (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (syscall (SYS_freebsd11_mknod, p, arg2, arg3)); +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* pre-ino64 mknodat(2) */ +static abi_long do_bsd_freebsd11_mknodat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (syscall (SYS_freebsd11_mknodat, arg1, p, arg3, arg4)); +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* post-ino64 mknodat(2) */ +static abi_long do_bsd_mknodat (void *cpu_env,abi_long arg1, +abi_long arg2,abi_long arg3,abi_long arg4,abi_long arg5, +abi_long arg6) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); +/* 32-bit arch's use two 32 registers for 64 bit return value */ +if (regpairs_aligned (cpu_env) !=0 ) { + ret =get_errno (mknodat (arg1, p, arg3,target_arg64 (arg5, arg6))); + }else { + ret =get_errno (mknodat (arg1, p, arg3,target_arg64 (arg4, arg5))); + } +UNLOCK_PATH (p, arg2); + +return ret; +} +#endif /* BSD_FILE_H */
bsd-user/freebsd/os-syscall.c +13 -0
@@ -32,6 +32,7 @@#include "qemu/cutils.h" #include "qemu/path.h" #include <sys/syscall.h> +#include <sys/cdefs.h> #include <sys/param.h> #include <sys/mount.h> #include <sys/sysctl.h>
@@ -418,6 +419,18 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret =do_bsd_fchmodat (arg1, arg2, arg3, arg4);break ; +case TARGET_FREEBSD_NR_freebsd11_mknod:/* mknod(2) */ + ret =do_bsd_freebsd11_mknod (arg1, arg2, arg3); +break ; + +case TARGET_FREEBSD_NR_freebsd11_mknodat:/* mknodat(2) */ + ret =do_bsd_freebsd11_mknodat (arg1, arg2, arg3, arg4); +break ; + +case TARGET_FREEBSD_NR_mknodat:/* mknodat(2) */ + ret =do_bsd_mknodat (cpu_env, arg1, arg2, arg3, arg4, arg5, arg6); +break ; +default :qemu_log_mask (LOG_UNIMP ,"Unsupported syscall: %d\n" , num); ret = -TARGET_ENOSYS ;
Signature · 1 line
2.33.1
PATCH v2 10/11 bsd-user: Implement undelete
In reply to Warner Losh--- bsd-user/bsd-file.h | 13 +++++++++++++ bsd-user/freebsd/os-syscall.c | 4 ++++ 2 files changed, 17 insertions(+)
bsd-user/bsd-file.h +13 -0
@@ -926,4 +926,17 @@ static abi_long do_bsd_fpathconf(abi_long arg1, abi_long arg2) return get_errno(fpathconf(arg1, arg2)); } +/* undelete(2) */ +static abi_long do_bsd_undelete (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (undelete (p));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} +#endif /* BSD_FILE_H */
bsd-user/freebsd/os-syscall.c +4 -0
@@ -487,6 +487,10 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret =do_bsd_fpathconf (arg1, arg2);break ; +case TARGET_FREEBSD_NR_undelete:/* undelete(2) */ + ret =do_bsd_undelete (arg1); +break ; +default :qemu_log_mask (LOG_UNIMP ,"Unsupported syscall: %d\n" , num); ret = -TARGET_ENOSYS ;
Signature · 1 line
2.33.1
PATCH v2 8/11 bsd-user: Implement mkfifo and mkfifoat
In reply to Warner Losh--- bsd-user/bsd-file.h | 27 +++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 8 ++++++++ 2 files changed, 35 insertions(+)
bsd-user/bsd-file.h +27 -0
@@ -867,4 +867,31 @@ static abi_long do_bsd_flock(abi_long arg1, abi_long arg2) return get_errno(flock(arg1, arg2)); } +/* mkfifo(2) */ +static abi_long do_bsd_mkfifo (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (mkfifo (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* mkfifoat(2) */ +static abi_long do_bsd_mkfifoat (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (mkfifoat (arg1, p, arg3)); +UNLOCK_PATH (p, arg2); + +return ret; +} +#endif /* BSD_FILE_H */
bsd-user/freebsd/os-syscall.c +8 -0
@@ -467,6 +467,14 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret =do_bsd_flock (arg1, arg2);break ; +case TARGET_FREEBSD_NR_mkfifo:/* mkfifo(2) */ + ret =do_bsd_mkfifo (arg1, arg2); +break ; + +case TARGET_FREEBSD_NR_mkfifoat:/* mkfifoat(2) */ + ret =do_bsd_mkfifoat (arg1, arg2, arg3); +break ; +default :qemu_log_mask (LOG_UNIMP ,"Unsupported syscall: %d\n" , num); ret = -TARGET_ENOSYS ;
Signature · 1 line
2.33.1
PATCH v2 6/11 bsd-user: Implement chflags, lchflags and fchflags
In reply to Warner Losh--- bsd-user/bsd-file.h | 32 ++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 12 ++++++++++++ 2 files changed, 44 insertions(+)
bsd-user/bsd-file.h +32 -0
@@ -816,4 +816,36 @@ static abi_long do_bsd_fchownat(abi_long arg1, abi_long arg2, return ret; } +/* chflags(2) */ +static abi_long do_bsd_chflags (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (chflags (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* lchflags(2) */ +static abi_long do_bsd_lchflags (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (lchflags (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchflags(2) */ +static abi_long do_bsd_fchflags (abi_long arg1,abi_long arg2) +{ +return get_errno (fchflags (arg1, arg2)); +} +#endif /* BSD_FILE_H */
bsd-user/freebsd/os-syscall.c +12 -0
@@ -447,6 +447,18 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret =do_bsd_fchownat (arg1, arg2, arg3, arg4, arg5);break ; +case TARGET_FREEBSD_NR_chflags:/* chflags(2) */ + ret =do_bsd_chflags (arg1, arg2); +break ; + +case TARGET_FREEBSD_NR_lchflags:/* lchflags(2) */ + ret =do_bsd_lchflags (arg1, arg2); +break ; + +case TARGET_FREEBSD_NR_fchflags:/* fchflags(2) */ + ret =do_bsd_fchflags (arg1, arg2); +break ; +default :qemu_log_mask (LOG_UNIMP ,"Unsupported syscall: %d\n" , num); ret = -TARGET_ENOSYS ;
Signature · 1 line
2.33.1
PATCH v2 9/11 bsd-user: Implement pathconf, lpathconf and fpathconf
In reply to Warner Losh--- bsd-user/bsd-file.h | 32 ++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 12 ++++++++++++ 2 files changed, 44 insertions(+)
bsd-user/bsd-file.h +32 -0
@@ -894,4 +894,36 @@ static abi_long do_bsd_mkfifoat(abi_long arg1, abi_long arg2, return ret; } +/* pathconf(2) */ +static abi_long do_bsd_pathconf (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (pathconf (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* lpathconf(2) */ +static abi_long do_bsd_lpathconf (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (lpathconf (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fpathconf(2) */ +static abi_long do_bsd_fpathconf (abi_long arg1,abi_long arg2) +{ +return get_errno (fpathconf (arg1, arg2)); +} +#endif /* BSD_FILE_H */
bsd-user/freebsd/os-syscall.c +12 -0
@@ -475,6 +475,18 @@ static abi_long freebsd_syscall(void *cpu_env, int num, abi_long arg1, ret =do_bsd_mkfifoat (arg1, arg2, arg3);break ; +case TARGET_FREEBSD_NR_pathconf:/* pathconf(2) */ + ret =do_bsd_pathconf (arg1, arg2); +break ; + +case TARGET_FREEBSD_NR_lpathconf:/* lpathconf(2) */ + ret =do_bsd_lpathconf (arg1, arg2); +break ; + +case TARGET_FREEBSD_NR_fpathconf:/* fpathconf(2) */ + ret =do_bsd_fpathconf (arg1, arg2); +break ; +default :qemu_log_mask (LOG_UNIMP ,"Unsupported syscall: %d\n" , num); ret = -TARGET_ENOSYS ;
Signature · 1 line
2.33.1
PATCH v2 11/11 bsd-user: Remove stray 'inline' from do_bsd_close
In reply to Warner LoshIn the last series, I inadvertantly didn't remove this inline, but did all the others. Remove it for consistency.
--- bsd-user/bsd-file.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bsd-user/bsd-file.h +1 -1
@@ -252,7 +252,7 @@ static abi_long do_bsd_openat(abi_long arg1, abi_long arg2, }/* close(2) */ -static inline abi_long do_bsd_close (abi_long arg1) +static abi_long do_bsd_close (abi_long arg1) {return get_errno (close (arg1)); }
Signature · 1 line
2.33.1
Re: [PATCH v2 02/11] bsd-user: Implement symlink, symlinkat, readlink and readlinkat
In reply to Warner LoshQuoted 7 lines · Warner Losh
Signed-off-by Stacey Son<[email protected]>Signed-off-by Jung-uk Kim<[email protected]>Signed-off-by Warner Losh<[email protected]>--- bsd-user/bsd-file.h | 74 +++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 16 ++++++++ 2 files changed, 90 insertions(+)
r~
Re: [PATCH v2 04/11] bsd-user: Implement freebsd11_mknod, freebsd11_mknodat and mknodat
In reply to Warner LoshQuoted 11 lines · Warner Losh
These implement both the old-pre INO64 mknod variations, as well as the now current INO64 variant. To implement the old stuff, we use some linker magic to bind to the old versions of these functions.
Signed-off-by Stacey Son<[email protected]>Signed-off-by Michal Meloun<[email protected]>Signed-off-by Warner Losh<[email protected]>--- bsd-user/bsd-file.h | 47 +++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-syscall.c | 13 ++++++++++ 2 files changed, 60 insertions(+)
Update the comment -- no more linker magic.
r~
Re: [PATCH v2 11/11] bsd-user: Remove stray 'inline' from do_bsd_close
In reply to Warner LoshQuoted 7 lines · Warner Losh
In the last series, I inadvertantly didn't remove this inline, but did all the others. Remove it for consistency.
Signed-off-by Warner Losh<[email protected]>--- bsd-user/bsd-file.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~