Commit Graph

1097 Commits

Author SHA1 Message Date
andvar 1cd43426d5 Fix various typos in comments, log messages and documentation. 2024-02-10 18:43:51 +00:00
andvar 100a3398b8 fix spelling mistakes, mainly in comments and log messages. 2024-02-09 22:08:30 +00:00
christos 2915865e7d fix a locking bug (Theodore Preduta) 2023-08-24 19:51:24 +00:00
christos ba958ad86f put variable length structure at the end, so that clang does not complain. 2023-08-23 19:17:59 +00:00
christos 6ecdc2761e aarch64 does not have sys_inotify_init()... 2023-08-22 12:02:34 +00:00
christos ed30ecde8c fix locking: eliminate using mutex_owned() (Theodore Preduta) 2023-08-20 18:09:25 +00:00
christos 8575c986c4 new inotify support GSoC 2023 (Theodore Preduta) 2023-08-19 17:57:54 +00:00
christos 69e4d6a089 Add linux waitid(2) from GSoC 2023 (Theodore Preduta) 2023-08-18 19:41:18 +00:00
christos 2c545067c7 Add EPOLL_CLOEXEC (Theodore Preduta) 2023-07-30 18:31:13 +00:00
christos a0a4eb1d2e Add/fix statx, readahead, close_range. From GSoC 2023 by Theodore Preduta 2023-07-29 15:04:28 +00:00
rin fb5e41dcc3 Add comment on packed attribution for struct linux_epoll_event on amd64.
NFC.
2023-07-29 12:58:51 +00:00
rin 15575ebdf6 compat/linux: aarch64 does not have epoll_create(2) nor epoll_wait(2)
Note that for Linux, new architectures like arm64 use MI system call
table in include/uapi/asm-generic/unistd.h, instead of MD syscall.tbl.

XXX
Too many ifdef's like this. We should be smarter...
2023-07-29 07:00:00 +00:00
christos d11110f473 Add epoll(2) from Theodore Preduta as part of GSoC 2023 2023-07-28 18:18:59 +00:00
christos 7eace3da0c Add memfd_create(2) from GSoC 2023 by Theodore Preduta 2023-07-10 02:31:54 +00:00
andvar e1541cea4e s/reqest/request/, s/requst/request/ and s/reuqest/request/ in comments. 2022-12-24 15:23:02 +00:00
andvar f42f89fd6f fix various small typos, mainly in comments. 2022-05-22 11:27:33 +00:00
andvar 7ba300a976 s/auxillary/auxiliary/ in comments. 2022-05-20 19:34:22 +00:00
ryo 8f021900d7 add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32 2021-12-02 04:29:47 +00:00
ryo 836f4a42d7 The internal architecture name of golang is "arm" or "arm64", which has
different naming conventions from netbsd's machine[] or machine_arch[]
("earmv7", "aarch64", etc.) and cannot be used as is.
Instead, use define LINUX_GO_RT0_SIGNATURE_ARCH{32,64}.
2021-11-26 09:05:05 +00:00
ryo bbb9625b59 - LINUX_GO_RT0_SIGNATURE for compat_linux is no longer enabled by default.
it is now defined in each arch same as the other *_SIGNATURE definitions.
- add new LINUX32_GO_RT0_SIGNATURE for compat_linux32, and is defined in amd64 and aarch64.
2021-11-26 08:56:28 +00:00
ryo 2f5e5e7356 add support COMPAT_LINUX32 for aarch64 2021-11-25 03:08:03 +00:00
ryo 5fe0554c47 - Add compat_linux statx(2) syscall.
- The AT_EMPTY_PATH processing from the modification of
  sys/compat/linux/common/linux_file64.c r1.63 has been separated, and made
  common to linux_statat(), so that it can be used not only by
  linux32_sys_fstatat64() but also by other *statat() variants.
2021-11-25 02:27:08 +00:00
ryo 6d8ced6337 rename bsd_to_linux_stat() to bsd_to_linux_stat64() to avoid confusion.
There is a static function with the same name in linux/common/linux_file.c.

NFC.
2021-11-25 02:09:23 +00:00
ryo 4cd291c698 rename bsd_to_linux_stat() to bsd_to_linux_stat64() to avoid confusion.
There is a static function with the same name in linux/common/linux_file.c.

NFC.
2021-11-25 02:08:55 +00:00
pho 55da09bdbb Make LINUX_FIOCLEX and LINUX_FIONCLEX work
These ioctls were declared in linux_termios.h but were not actually
handled.
2021-11-23 17:54:08 +00:00
thorpej 0a15a2c8dc Use "stack_t" instead of "struct sigaltstack", as the former is the
newer standardized name.  NFC.
2021-11-01 05:07:15 +00:00
thorpej 38baf0b8de Use __SIGTRAMP_SIGCODE_VERSION rather than hard-coding 0. 2021-10-27 16:40:04 +00:00
christos 4794b2a493 remove stray char. 2021-09-23 11:28:47 +00:00
ryo abbc8a65e2 add support COMPAT_LINUX for aarch64 2021-09-23 06:56:26 +00:00
rin 48ab0cf3a8 linux_sys_fstatat64: Add support for AT_EMPTY_PATH flag.
This is required for rtld shipped with glibc 2.33.

Now, userland of Fedora 34 is working fine on NetBSD/amd64.
2021-09-21 09:24:15 +00:00
thorpej 4d7b9c0523 Add preadv(2) and pwritev(2) system calls to COMPAT_LINUX and COMPAT_LINUX32. 2021-09-20 02:20:02 +00:00
thorpej 4d055d8a83 Add the eventfd system calls to COMPAT_LINUX and COMPAT_LINUX32. 2021-09-20 00:09:01 +00:00
thorpej 185d6cd739 Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32. 2021-09-19 23:51:36 +00:00
thorpej 555b185132 Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.
2021-09-19 23:01:49 +00:00
thorpej 8b56e9b928 - LINUX_SIGEV_PAD is incorrect for 64-bit systems, because sigval_t
contains a pointer.  Correct this.
- Add routines to convert from Linux to native sigevent_t.
2021-09-19 17:33:39 +00:00
riastradh 41aa5859b6 sys/compat: Memset zero before copyout.
Just in case of uninitialized padding which would lead to kernel
stack disclosure.  If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
2021-09-07 11:43:02 +00:00
thorpej 30e584e46a Rewrite linux_sys_alarm() to use dogetitimer() / dosetitimer(), rather
than fiddling with process timers directly.
2020-12-04 00:26:16 +00:00
christos f5c7935f9c PR/55780: Bernd Sieker: setsockopt in Linux emulation misses some options 2020-11-03 22:08:44 +00:00
mgorny 62a92db07d Fix compat with Linux programs that use longer namelen for sockets
Linux is less strict than NetBSD and permits namelen to be larger
than valid struct sockaddr_in*.  If this is the case, truncate the value
to the correct size, so that NetBSD networking does not return an error.

Reviewed by kamil
2020-10-24 09:01:56 +00:00
msaitoh 0be10c48cf Don't accept negative value.
Reported-by: syzbot+e71a77402d6668f1868d@syzkaller.appspotmail.com
2020-07-16 15:02:08 +00:00
ad ba90a6ba38 Counter tweaks:
- Don't need to count anonpages+filepages any more; clean+unknown+dirty for
  each kind of page can be summed to get the totals.

- Track the number of free pages with a counter so that it's one less thing
  for the allocator to do, which opens up further options there.

- Remove cpu_count_sync_one().  It has no users and doesn't save a whole lot.
  For the cheap option, give cpu_count_sync() a boolean parameter indicating
  that a cached value is okay, and rate limit the updates for cached values
  to hz.
2020-06-11 22:21:05 +00:00
ad 4b8a875ae2 uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched.  It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.
2020-06-11 19:20:42 +00:00
ad 0eaaa024ea Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
2020-05-23 23:42:41 +00:00
rin 412770719c Fix previous; specify lwpid for curlpw in the case of pid == 0.
For linux_sys_sched_setaffinity, pid == 0 means the current thread.
On the other hand, for our native sys_sched_setaffinity, lid == 0
means all lwp's that belong to the process.
2020-05-14 08:26:29 +00:00
thorpej 6430fcd5ce Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG.  This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object.  Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
2020-05-03 01:06:55 +00:00
thorpej a05d1819c9 Fix proc lookup by distinguishing between the "tgid" and "tid" cases. 2020-04-29 01:55:52 +00:00
thorpej 5aee0edc68 Fix proc / lwp lookup processing in linux_sys_sched_getaffinity()
and linux_sys_sched_setaffinity().  They were incorrect even before
the LWP ID changes, but those changes exposed the latent bugs.
2020-04-29 01:55:18 +00:00
thorpej d69d0e707c Oops, fix a silly mistake in the Linux futex syscall stubs -- we also
copy in the timeout for FUTEX_WAIT_BITSET.
2020-04-29 01:44:03 +00:00
thorpej 276ef22378 Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
2020-04-26 18:53:31 +00:00
thorpej 156895706e Overhaul the way LWP IDs are allocated. Instead of each LWP having it's
own LWP ID space, LWP IDs came from the same number space as PIDs.  The
lead LWP of a process gets the PID as its LID.  If a multi-LWP process's
lead LWP exits, the PID persists for the process.

In addition to providing system-wide unique thread IDs, this also lets us
eliminate the per-process LWP radix tree, and some associated locks.

Remove the separate "global thread ID" map added previously; it is no longer
needed to provide this functionality.

Nudged in this direction by ad@ and chs@.
2020-04-24 03:22:06 +00:00