summaryrefslogtreecommitdiffstats
path: root/bsd-user/freebsd
Commit message (Collapse)AuthorAgeFilesLines
* bsd-user: Implement undeleteWarner Losh2022-07-021-0/+4
| | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement pathconf, lpathconf and fpathconfWarner Losh2022-07-021-0/+12
| | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement mkfifo and mkfifoatWarner Losh2022-07-021-0/+8
| | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement chroot and flockWarner Losh2022-07-021-0/+8
| | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement chflags, lchflags and fchflagsWarner Losh2022-07-021-0/+12
| | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement chown, fchown, lchown and fchownatWarner Losh2022-07-021-0/+16
| | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement freebsd11_mknod, freebsd11_mknodat and mknodatWarner Losh2022-07-021-0/+13
| | | | | | | | | | | These implement both the old-pre INO64 mknod variations, as well as the now current INO64 variant. Make direct syscall calls for these older syscalls to avloid too many dependencies. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Michal Meloun <mmel@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: implement chmod, fchmod, lchmod and fchmodatWarner Losh2022-07-021-0/+16
| | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement symlink, symlinkat, readlink and readlinkatWarner Losh2022-07-021-0/+16
| | | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement mount, umount and nmountWarner Losh2022-07-021-0/+13
| | | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement acct and syncWarner Losh2022-06-141-0/+8
| | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement trunctate and ftruncateWarner Losh2022-06-141-0/+8
| | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement dup and dup2Warner Losh2022-06-141-0/+8
| | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement rmdir and undocumented __getcwdWarner Losh2022-06-141-0/+8
| | | | | | | | | | Implemenet rmdir and __getcwd. __getcwd is the undocumented back end to getcwd(3). Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement mkdir and mkdiratWarner Losh2022-06-141-0/+8
| | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement link, linkat, unlink and unlinkatWarner Losh2022-06-131-0/+16
| | | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement rename and renameatWarner Losh2022-06-131-0/+8
| | | | | | | | | Plus the helper LOCK_PATH2 and UNLOCK_PATH2 macros. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement chdir and fchdirWarner Losh2022-06-131-0/+8
| | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement revoke, access, eaccess and faccessatWarner Losh2022-06-131-0/+16
| | | | | | Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement fdatasync, fsync and close_fromWarner Losh2022-06-131-0/+12
| | | | | | | | | Implement fdatasync(2), fsync(2) and close_from(2). Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Implement open, openat and closeWarner Losh2022-06-131-0/+16
| | | | | | | | | | | 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>
* bsd-user/freebsd/os-syscall.c: Implement exitWarner Losh2022-06-111-0/+7
| | | | | | | | | | Implement the exit system call. Bring in bsd-proc.h to contain all the process system call implementation and helper routines. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
* bsd-user/bsd-file.h: Meat of the write system callsWarner Losh2022-06-111-0/+22
| | | | | | | | | | Implement write, writev, pwrite and pwritev and connect them to the system call dispatch routine. Signed-off-by: Stacey Son <sson@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>
* bsd-user/bsd-file.h: Add implementations for read, pread, readv and preadvWarner Losh2022-06-111-0/+28
| | | | | | | | | | Implement do_bsd_{read,pread,readv,preadv}. Connect them to the system call table. Signed-off-by: Stacey Son <sson@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>
* bsd-user/freebsd/os-syscall.c: Tracing and error boilerplateWarner Losh2022-06-111-4/+40
| | | | | | | | | | | | Add in the tracing and this system call not implemented boilerplate. Do this by moving the guts of do_freebsd_syscall to freebsd_syscall. Put the tracing in the wrapper function. Since freebsd_syscall is a singleton static function, it will almost certainly be inlined. Fix comments that referred to do_syscall since that was renamed some tie ago. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user/freebsd/os-syscall.c: unlock_iovecWarner Losh2022-06-111-0/+14
| | | | | | | Releases the references to the iovec created by lock_iovec. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user/freebsd/os-syscall.c: lock_iovecWarner Losh2022-06-111-0/+102
| | | | | | | | | | | | | | lock_iovec will lock an I/O vec and the memory to which it refers and create a iovec in the host space that refers to it, with full error unwinding. Add helper_iovec_unlock to unlock the partially locked iovec in case there's an error. The code will be used in iovec_unlock when that is committed. Note: memory handling likely could be rewritten to use q_autofree. That will be explored in the future since what we have now works well enough. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* Clean up ill-advised or unusual header guardsMarkus Armbruster2022-05-118-24/+27
| | | | | | | | | | | | | | | | | | Leading underscores are ill-advised because such identifiers are reserved. Trailing underscores are merely ugly. Strip both. Our header guards commonly end in _H. Normalize the exceptions. Macros should be ALL_CAPS. Normalize the exception. Done with scripts/clean-header-guards.pl. include/hw/xen/interface/ and tools/virtiofsd/ left alone, because these were imported from Xen and libfuse respectively. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20220506134911.2856099-3-armbru@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* Remove qemu-common.h include from most unitsMarc-André Lureau2022-04-061-1/+0Star
| | | | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220323155743.1585078-33-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* bsd-user/bsd-file.h: Implementation details for the filesystem callsWarner Losh2022-02-271-0/+2
| | | | | | | | | | An include file that pulls in all the definitions needed for the file related system calls. This also includes the host definitions to implement the system calls and some helper routines to lock/unlock different aspects of the system call arguments. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user/freebsd/os-syscall.c: Add get_errno and host_to_target_errnoWarner Losh2022-02-261-1/+22
| | | | | | | | | | | | Add the helper functions get_errno and host_to_target_errno. get_errno returns either the system call results, or the -errno when system call indicates failure by returning -1. Host_to_target_errno returns errno (since on FreeBSD they are the same on all architectures) along with a comment about why it's the identity. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Kyle Evans <kevans@FreeBSD.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Move system call building to os-syscall.cWarner Losh2022-02-261-0/+1
| | | | | Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user/freebsd/os-syscall.c: Move syscall processing hereWarner Losh2022-02-261-0/+69
| | | | | | | | | | | | | | | | While there is some commonality between *BSD syscall processing, there's a number of differences and the system call numbers and ABIs have been independent since the late 90s. Move FreeBSD's proessing here and delete it. The upstream implementation is somewhat different than the current implementation. It will be much easier to upstream these from scratch, justifying the final result, rather than working out the diffs and justifying the changes. Also tweak a comment to qemu standard form. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Kyle Evans <kevans@FreeBSD.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user/freebsd/target_os_ucontext.h: Prefer env as arg name for ↵Warner Losh2022-01-311-3/+3
| | | | | | | CPUArchState args Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Create setup_sigframe_arch to setup sigframe contextWarner Losh2022-01-281-0/+3
| | | | | | | | Define setup_sigframe_arch whose job it is to setup the mcontext for the sigframe. Implement for x86 to just call mcontext. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: Complete FreeBSD siginfoWarner Losh2022-01-281-1/+14
| | | | | | | Fill in the missing FreeBSD siginfo fields, and add some comments. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user/freebsd/target_os_ucontext.h: Require TARGET_*CONTEXT_SIZEWarner Losh2022-01-081-2/+0Star
| | | | | | | | | Now that all architecutres define TARGET_[MU]CONTEXT_SIZE, enforce requiring them and always check the sizeof target_{u,m}context_t sizes. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user/target_os_signal.h: Move signal prototypes to target_os_ucontext.hWarner Losh2022-01-081-0/+11
| | | | | | | | Switch to the CPUArchState typedef and move target-provided prototypes to target_os_ucontext.h. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user/freebsd: Create common target_os_ucontext.h fileWarner Losh2022-01-082-3/+35
| | | | | | | | | | | | FreeBSD has a MI ucontext structure that contains the MD mcontext machine state and other things that are machine independent. Create an include file for all the ucontext stuff. It needs to be included in the arch specific files after target_mcontext is defined. This is largely copied from sys/_ucontext.h with the comments about layout removed because we don't support ancient FreeBSD binaries. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user/sysarch: Move to using do_freebsd_arch_sysarch interfaceWarner Losh2021-10-182-0/+30
| | | | | | | | | | | do_freebsd_arch_sysarch() exists in $ARCH/target_arch_sysarch.h for x86. Call it from do_freebsd_sysarch() and remove the mostly duplicate version in syscall.c. Future changes will move it to os-sys.c and support other architectures. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
* bsd-user/target_os_elf: If ELF_HWCAP2 is defined, publish itWarner Losh2021-10-181-0/+4
| | | | | | | | | | | Some architectures publish AT_HWCAP2 as well as AT_HWCAP. Those architectures will define ELF_HWCAP2 in their target_arch_elf.h files for the value for this process. If it is defined, then publish it. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
* bsd-user/target_os_elf.h: Remove fallback ELF_HWCAP and reorderWarner Losh2021-10-181-6/+2Star
| | | | | | | | | | All architectures have a ELF_HWCAP, so remove the fallback ifdef. Place ELF_HWCAP in the same order as on native FreeBSD. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
* bsd-user: move TARGET_MC_GET_CLEAR_RET to target_os_signal.hWarner Losh2021-10-181-0/+3
| | | | | | | | | | Move TARGET_MC_GET_CLEAR_RET to freebsd/target_os_signal.h since it's architecture agnostic on FreeBSD. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
* bsd-user/strace.list: Remove support for FreeBSD versions older than 12.0Warner Losh2021-10-181-11/+0Star
| | | | | | Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
* bsd-user/target_os-user.h: Remove support for FreeBSD older than 12.0Warner Losh2021-10-181-99/+1Star
| | | | | | Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
* bsd-user: Add target_os_user.h to capture the user/kernel structuresWarner Losh2021-09-101-0/+427
| | | | | | | | | | | This file evolved over the years to capture the user/kernel interfaces, including those that changed over time. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Michal Meloun <mmel@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Acked-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
* bsd-user: elf cleanupWarner Losh2021-09-101-0/+137
| | | | | | | | | | | | | | Move OS-dependent defines into target_os_elf.h. Move the architectural dependent stuff into target_arch_elf.h. Adjust elfload.c to use target_create_elf_tables instead of create_elf_tables. Signed-off-by: Warner Losh <imp@bsdimp.com> Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Kyle Evans <kevans@FreeBSD.org> Signed-off-by: Justin Hibbits <chmeeedalf@gmail.com> Signed-off-by: Alexander Kabaev <kan@FreeBSD.ORG> Acked-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
* bsd-user: Move stack initializtion into a per-os file.Warner Losh2021-09-101-0/+181
| | | | | | | | | Move all of the stack initialization into target_os_stack.h. Each BSD sets up processes a little differently. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* bsd-user: *BSD specific siginfo defintionsWarner Losh2021-09-102-0/+223
| | | | | | | | | | | Add FreeBSD, NetBSD and OpenBSD values for the various signal info types and defines to decode different signals to discover more information about the specific signal types. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Acked-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
* bsd-user: Create target specific vmparam.hWarner Losh2021-09-101-0/+38
| | | | | | | | Target specific values for vm parameters and details. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>