Commit Graph

19963 Commits

Author SHA1 Message Date
pgoyette
8d1dd42752 Document ENOSYS return from MODCTL_EXIST.
Remove EMLINK since it is no longer returned.
2020-04-26 18:56:49 +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
maxv
26cfc3f122 Switch to the new PTE naming. The old naming is now unused, remove it. 2020-04-25 05:17:16 +00:00
joerg
18796b949c Explicitly use -fcommon for globals shared between libc and CSU. 2020-04-22 23:32:25 +00:00
thorpej
c6ca5287d3 Remove man page for the never-exposed _lwp_gettid(2) call. 2020-04-22 21:27:06 +00:00
rin
27f1060c62 Restrict usage of m68k assembler versions of {,u}divsi3 and {,u}divsi3 to
kernel and bootloader for 68010.

They requires a special calling convention to udivsi3, and cannot to be
mixed up in normal routines provided by libgcc or compiler_rt. Although,
there's no problem for using them in a controlled situation, i.e., kernel
and standalone programs.

Note that this does not affect at all m68k ports other than sun2, since
codes generated by gcc do not call these routines.

Assembler files are moved from common/lib/libc/arch/m68k/gen to
sys/lib/libkern/arch/m68k in order not to be compiled in libc.

Revert hack introduced to lib/libc/compiler_rt/Makefile.inc rev 1.37:
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/compiler_rt/Makefile.inc#rev1.37

Proposed on port-sun2@ with no response...
(Again, this does not affect m68k ports other than sun2.)
http://mail-index.netbsd.org/port-sun2/2020/03/10/msg000102.html
2020-04-22 11:28:56 +00:00
rin
1d3b363c69 Use __mc68010__ to distinguish m68000 (sun2) from other m68k ports;
__mc68000__ is defined both for m68000 and m68k.
2020-04-22 08:48:12 +00:00
rin
45df14becf Fix previous for libhack, where _REENTRANT is not defined;
arenas_map_key is used only when NO_TLS && _REENTRANT.
2020-04-22 08:45:06 +00:00
joerg
880ddc3f7b Switch to using TLS in old jemalloc for everywhere but VAX and sun2. 2020-04-21 22:22:55 +00:00
nia
ab8a3679da ossaudio: removed outdated comment 2020-04-20 12:01:44 +00:00
joerg
1116ee1756 Improve TSD behavior
Optimistically check whether the key has been used by this thread
already and avoid locking in that case. This avoids the atomic operation
in the hot path. When the value is set to non-NULL for the first time,
put the entry on the to-be-freed list and keep it their until
destruction or thread exit. Setting the key to NULL and back is common
enough and updating the list is more expensive than the extra check on
the final round.
2020-04-19 20:47:03 +00:00
joerg
57360565c8 Reinit TSD mutex in the child to avoid issues with former waiters 2020-04-19 20:46:04 +00:00
nia
8e9e149d7d ossaudio: Implement SNDCTL_DSP_(SET|GET)TRIGGER. 2020-04-19 13:44:50 +00:00
nia
d4490f2a9c ossaudio: Make SNDCTL_DSP_[GET|SET][PLAY|RECORD]VOL closer to OSSv4
Problems in the previous code include returning values in the 0-255
range NetBSD uses instead of the 0-100 range OSSv4 expects, using
AUDIO_GETBUFINFO (which doesn't even return the mixer bits), and
not encoding channels as specified: "level=(left)|(right << 8)".

In reality, setting the gain in this way (through /dev/audio rather
than /dev/mixer) doesn't seem to work properly, and the mixer-set
value seems to be retained.

However, these changes at least ensure that the return values are
correct and the balance is set correctly.

I've only found one application using this API (audio/audacious), and
OSSv4 support in it is currently disabled precisely because it breaks
when it attempts to set the track volume using it.
2020-04-19 11:27:40 +00:00
joerg
25a494ecc4 Rename __atomic_fork to __locked_fork and give it &errno as argument.
rtld and libc use different storage, so the initial version would
incorrectly report the failure reason for fork().

There is still a small race condition inside ld.elf_so as it doesn't use
thread-safe errno internally, but that's a more contained internal
issue.
2020-04-19 01:06:15 +00:00
thorpej
77abcafc06 Rename "syscall" to "_syscall" and provide "syscall" as a weak alias. 2020-04-18 23:55:50 +00:00
joerg
11954c74b6 Introduce intermediate locking for fork, so that the dynamic linker is
in a consistent state. This most importantly avoids races between dlopen
and friends and fork, potentially resulting in dead locks in the child
when it itself tries to acquire locks.
2020-04-16 14:39:58 +00:00
nia
87706eec7d ossaudio: If the user's channel count is rejected, use the hardware count 2020-04-15 16:39:06 +00:00
nia
0eb796bf71 ossaudio: Make SNDCTL_DSP_SETFMT conform with OSSv4.
The OSSv4 spec says we shouldn't really error if an invalid format is
chosen by an application. Things are especially likely to be confused
if we return MULAW, since in OSSv4 terms that means that's the native
hardware format. Instead, set and return the current hardware format
if an invalid format is chosen.

For the 24-bit sample formats, note that the NetBSD kernel currently
can't handle them in its default configuration, and will return an error
code if you attempt to use them. So, if an applicaton requests 24-bit PCM,
promote it to 32-bit PCM. According to the spec, this is valid and
applications should be checking the return value anyway.

In the Linux compat layer, we just use S16LE as a fallback. The OSSv3
headers that are still being shipped with Linux don't contain definitions
for fancier formats and we can reasonably expect all applications to
support S16LE.
2020-04-15 15:25:33 +00:00
nia
6476938d92 ossaudio: Make SNDCTL_DSP_SPEED more robust when using invalid rates.
From the perspective of reading the OSSv4 specification, NetBSD's
behaviour when an invalid sample rate is set makes no sense at all:
AUDIO_SETINFO simply returns an error code, and then we immediately
fall through to getting the sample rate, which is still set to the
legacy default of 8000 Hz.

Instead, what OSS applications generally expect is that they will be
able to receive the actual hardware sample rate. This is very, very
unlikely to be 8000 Hz on a modern machine.

No functional change when setting a sample rate between the supported
rates of 1000 and 192000 Hz. When a rate outside this range is requested,
the hardware rate is returned (on modern hardware, generally always 48000
Hz or a multiple of 48000 Hz).
2020-04-15 14:54:34 +00:00
joerg
f3cc99aec6 Drop most of the logic associated with pthread__started.
The pthread_cond logic is a questionable optimisation at best and the
post-fork logic is plainly broken.
2020-04-14 23:35:07 +00:00
christos
fea87f652c fix tyop 2020-04-11 20:48:53 +00:00
christos
2d9fc2191e Via enh at google dot com in tech-userlevel. Fix handling of
EXT_FRAC{H,L}BITS (although we don't need to since we don't have them).
2020-04-11 20:28:28 +00:00
rin
92a204309a Revert previous:
http://mail-index.netbsd.org/source-changes/2020/02/20/msg114173.html

Comment turned out to be wrong, and KASSERT fires for oea.

XXX
Need to revisit shortly...
2020-04-11 09:15:23 +00:00
martin
b6924e8af2 Conditionalize a few more functions (hopefully fixing the build) 2020-04-05 14:53:39 +00:00
roy
9e387da605 terminfo: Add guards to optionally build parts of libterminfo
Reading from a database is now optional.
Compiling terminfo descriptions (including from $TERMINFO) is now optional.
Compat support is now optional.

This removes 17k on amd64 from the binary size, which allows it to be used
again on space constrained ramdisks.
2020-04-05 12:31:02 +00:00
dholland
7ec84f335a Move the note about sys_errlist[] users to COMPATIBILITY, and strengthen it. 2020-04-04 21:29:54 +00:00
dholland
903a8c167f Add missing ERRORS section. 2020-04-04 21:26:44 +00:00
fox
a4861c96ec lib/libusbhid: Fix possible left shift changes signedness bit.
This bug was reported by UBSan runs.

lib/libusbhid/parse.c:246:20

Can result in left shift changes signedness bit as a side effect positive number
can go negative, cast it to unsigned for the operation and silence the issue.

Reviewed by: kamil@
2020-04-04 21:26:16 +00:00
fox
f76ca3088f lib/libusbhid: Fix possible left shift changes signedness bit.
This bug was reported by UBSan runs.

lib/libusbhid/usage.c:247:27
lib/libusbhid/usage.c:244:28
lib/libusbhid/usage.c:235:13

Can result in left shift changes signedness bit as a side effect positive number
can go negative, cast it to unsigned for the operation and silence the issue.

Reviewed by: kamil@
2020-04-04 21:23:04 +00:00
fox
ef659d5053 lib/libusbhid: Fix possible left shift changes signedness bit.
This bug was reported by UBSan runs.

lib/libusbhid/data.c:58:25
lib/libusbhid/data.c:91:7
lib/libusbhid/data.c:92:7

Can result in left shift changes signedness bit as a side effect positive number
can go negative, cast it to unsigned for the operation and silence the issue.

Reviewed by: kamil@
2020-04-04 21:21:35 +00:00
dholland
4aee32ddde Minor clarification. And a typo. Bump date. 2020-04-04 21:20:39 +00:00
thorpej
7f4d3fb1f5 Man page for _lwp_gettid(2).
(Not yet installed, pending adding the libc stub.)
2020-04-04 20:31:11 +00:00
christos
c260c42c09 remove smbfs 2020-04-04 17:56:22 +00:00
nia
e194ce9454 statvfs.2: Add STANDARDS section.
Reviewed by kamil
2020-04-04 12:57:26 +00:00
wiz
acf9dc2f4e Add comma in enumeration. 2020-03-30 22:14:48 +00:00
maya
5ff881a534 Mention elf rather than a.out some more.
(Also, inspired by freebsd, which removed the non-elf support)
2020-03-30 20:37:03 +00:00
maya
d4a8a6057f xref elf(5). 2020-03-30 20:35:12 +00:00
maya
9ced62b43c Be less of a minefield for new architectures. They're not going to be a.out.
Remove sh5, long gone.
(Hopefully nothing hits the #else case)
2020-03-30 20:34:11 +00:00
ryo
30a3b0e1af PR/54992: fix hosts_access(5) to works for IPv6 linklocal address without scope-id 2020-03-30 08:34:38 +00:00
ryo
b061283a45 fail to create a pidfile if hostname contains '/' 2020-03-30 08:24:36 +00:00
ryo
3bf82836bf patbuf must be updated if the length of patbuf is greater than or equal to 0. (that is always)
fix of r1.7 was incorrect.
2020-03-30 06:56:38 +00:00
ryo
1148c4261d fix build error with SDEBUG, MAP_DEBUG, DEBUG_REFRESH 2020-03-30 06:54:37 +00:00
roy
2d748ff84b terminfo: satisfy gcc bitching 2020-03-30 02:08:11 +00:00
roy
7f0204b5ec terminfo: v3 records should create v3 aliases 2020-03-30 00:09:06 +00:00
roy
5159a4258d terminfo: Promote a terminfo description to v3 when required
Blindly scanning the capabilities for # and checking that the following
number is bigger than a short isn't reliable because this could be a
string value:

SomeString#1234

Instead, if we process the numeric as normal and if it's value is too big
for v1 then promote the record to v3.
2020-03-29 21:46:22 +00:00
roy
59ea2669e1 terminfo: allow _ti_getname to convert from and to any version 2020-03-29 18:54:57 +00:00
roy
664218069f terminfo: Clamp numeric bounds to storage not API.
While here, fix decoding of numeric -1 stored in uint16_t to still be -1.
2020-03-29 18:32:45 +00:00
christos
e2a9896bc4 PR/55118: Andreas Gustafsson: Oops, set the right flag variable. 2020-03-28 15:45:56 +00:00
roy
0b457be2fc terminfo: Add a comment for prior change. 2020-03-28 15:27:54 +00:00