Upstream the file, thread, socket and remaining signal system calls (too
numerous to list here).
This series is an ambitous use of claude to help me upstream all the
remaining system calls. I've batched them together in what I think are
reasonable chunks, and had claude do the grunt work of copying the code
over and attributing the commits from our complex branching history. The
chopping up was a bit arbitrary, but I think it's good. The commit
messages may be a little weak, but may also be OK. I've also double
checked the style and made fixes upstream for them as well. Claude also
reviewed all these changes and found a few bugs that I've fixed. I've
personally read through them all and haven't found anything glaring. I
fixed all the bugs that were found, in most cases differently than
claude's suggestions.
I've added 'Assisted-by: Claude...' to all these commits to reflect my
leaning on Claude so hard. This use falls within the 'non-creative' use
that the Qemu project has said is OK. If that's not the right thing to
do, I can remove them.
This leaves sysctl translation, the powerpc architecture support,
coredumps and a transition to 'truss' based system call tracing. With
these changes applied we'er down from a high of about 30k lines of diffs
to only 5k (not counting genereted, but checked in files in blitz). The
changes are 8k, so maybe a bit ambitious from that perspective as well.
There's a few lines over 80 that I've not cleaned up. Let me know if
that's a problem. The other warnings are about adding files, and there's
no new MAINTAINERS entry needed. And the 'arch dependent defines should
be avoided' are needed to cope with different FreeBSD build systems
having different system calls.
Finally, a number of bugs were found late in the process, and not all
were squashed back since the patch series is a bit unwieldy, and it
helps me to make sure I've applied the fixes found during review to
blitz. I know this pushes us past the suggested 50 chunks, but I felt it
important to keep them seprate since Claude identified all the issues. I
think it's important to have another set of eyes on the changes that I
made to fix them. I'd be open to feedback other ways to handle this.
This is a big experiment, in many ways, for me, so I'm interested in
whatever feedback you may have to make things better in the future.
Signed-off-by: Warner Losh <imp@bsdimp.com>
---
Warner Losh (66):
bsd-user: catchup to locking / mapping routines in bsd-misc.
bsd-user: Rename cpu_env to env throughout bsd-user
bsd-user: Add bsd-signal.h with sigaction through sigreturn
bsd-user: Add signal shims sigwait through kill and os-signal.h
bsd-user: Add signal system call dispatch
bsd-user: Add poll, lseek, pipe, and swap system call shims
bsd-user: Add os-file.h with pipe2, chflagsat, close_range, and more
bsd-user: Add file operation system call dispatch
bsd-user: Add bsd-socket.h with bind through getsockname
bsd-user: Add socket shims socketpair through shutdown
bsd-user: Add os-socket.h with sendrecvmsg and message structures
bsd-user: Add do_bsd_setsockopt and socket option definitions
bsd-user: Add do_bsd_getsockopt
bsd-user: Add FreeBSD socket helpers and sockaddr conversion
bsd-user: Add os-socket.c with cmsg conversion functions
bsd-user: Add socket system call dispatch
bsd-user: Add os-time.h with clock and time-of-day functions
bsd-user: Add utimes, futimes, and ktimer functions to os-time.h
bsd-user: Add select, pselect, and ppoll to os-time.h
bsd-user: Add kqueue and kevent functions to os-time.h
bsd-user: Add sigtimedwait, itimer, and futimens to os-time.h
bsd-user: Add os-time.c and time-related type definitions
bsd-user: Add time system call dispatch
bsd-user: Add thread, umtx, and ACL type definitions
bsd-user: Add cpu_copy and make init_task_state non-static
bsd-user: Add os-thread.h with thr and context functions
bsd-user: Add do_freebsd__umtx_op to os-thread.h
bsd-user: Add os-thread.c with umtx, mutex, and thread creation
bsd-user: Add thread system call dispatch
bsd-user: Add os-extattr.h with file and fd extattr functions
bsd-user: Add link and list extattr functions to os-extattr.h
bsd-user: Add ACL system call shims to os-extattr.h
bsd-user: Add os-extattr.c with ACL conversion functions
bsd-user: Add extended attribute and ACL system call dispatch
bsd-user: Add scheduler and cpuset functions to os-misc.h
bsd-user: Add kmod, posix, and misc functions to os-misc.h
bsd-user: Add scheduler, cpuset, kmod, and misc syscall dispatch
bsd-user: Remove dead watchpoint code from cpu_copy
bsd-user: Fix cpu_copy to initialize new_cpu queues, not source
bsd-user: Free CPU state and TaskState on thread creation failure
bsd-user: Fix kenv KENV_SET to not write back read-only buffer
bsd-user: Fix freebsd_lock_umutex to re-read m_owner not m_count
bsd-user: Fix problem with extattr_* routines
bsd-user: do_freebsd__acl_aclcheck_file pass type to __acl_aclcheck_file
bsd-user: Unlock in h2t_freebsd_ntptimeval
bsd-user: freebsd_umtx_mutex_wake2 fix unlock_user
bsd-user: In do_freebsd_thr_new, use unlock_user_struct
bsd-user: h2t_freebsd_cmsg should use SCM_TIMEOUT
bsd-user: sendto/recvfrom need + 1 too for addrlen
bsd-user: __acl_aclcheck_file should check t2h_freebsd_acl_type
bsd-user: do_freebsd_ppoll: unlock target_pfds in error paths
bsd-user: Return -TARGET_EINVAL rather than EINVAL
bsd-user: t2h_freebsd_cmsg use host not target values
bsd-user: Validate acl_maxcnt
bsd-user: Convert TARGET_SO_SNDLOWAT to SO_SNDLOWAT not SO_RCVLOWAT
bsd-user: os-time.c -- Fix copy in time conversion rotuines
bsd-user: Fix gettimeofday's writeback to tz
bsd-user: settimeofday should copy the data in, but not out
bsd-user: unlock the start of the cmsg
bsd-user: Don't leak fd's when we can't writeback in do_bsd_pipe2
bsd-user: freebsd_rw_rdlock and freebsd_rw_wrlock fix missed decrement
bsd-user: freebsd_rw_wrlock needs to unlock_user_struct on this path
bsd-user: Don't write back length on kenv error
bsd-user: avoid writeback in do_freebsd_extattr_set_*
bsd-user: In specialfd, we need to copyin target_eventfd
bsd-user: freebsd_unlock_umutex: make flags 32 bits
bsd-user/aarch64/target.h | 2 +-
bsd-user/arm/target.h | 2 +-
bsd-user/bsd-file.h | 164 +++-
bsd-user/bsd-mem.h | 4 +-
bsd-user/bsd-proc.h | 24 +-
bsd-user/bsd-signal.h | 231 ++++++
bsd-user/bsd-socket.c | 98 +++
bsd-user/bsd-socket.h | 274 +++++++
bsd-user/freebsd/meson.build | 8 +-
bsd-user/freebsd/os-extattr.c | 116 +++
bsd-user/freebsd/os-extattr.h | 662 ++++++++++++++++
bsd-user/freebsd/os-file.h | 128 ++++
bsd-user/freebsd/os-misc.h | 470 +++++++++++-
bsd-user/freebsd/os-proc.c | 4 +-
bsd-user/freebsd/os-proc.h | 26 +-
bsd-user/freebsd/os-signal.h | 20 +
bsd-user/freebsd/os-socket.c | 234 ++++++
bsd-user/freebsd/os-socket.h | 764 +++++++++++++++++++
bsd-user/freebsd/os-stat.h | 10 +
bsd-user/freebsd/os-sys.c | 4 +-
bsd-user/freebsd/os-syscall.c | 790 +++++++++++++++++--
bsd-user/freebsd/os-thread.c | 1674 +++++++++++++++++++++++++++++++++++++++++
bsd-user/freebsd/os-thread.h | 596 +++++++++++++++
bsd-user/freebsd/os-time.c | 316 ++++++++
bsd-user/freebsd/os-time.h | 978 ++++++++++++++++++++++++
bsd-user/freebsd/qemu-os.h | 47 ++
bsd-user/i386/target.h | 2 +-
bsd-user/main.c | 32 +-
bsd-user/meson.build | 1 +
bsd-user/qemu-bsd.h | 26 +
bsd-user/qemu.h | 48 +-
bsd-user/riscv/target.h | 2 +-
bsd-user/signal-common.h | 4 +
bsd-user/signal.c | 67 ++
bsd-user/syscall_defs.h | 458 +++++++++--
bsd-user/x86_64/target.h | 2 +-
36 files changed, 8099 insertions(+), 189 deletions(-)
---
base-commit: edcc429e9e41a8e0e415dcdab6aa52ad17ef8889
change-id: 20260504-misc-2026q2-a5af31ac032a
Best regards,
--
Warner Losh <imp@bsdimp.com>