Commit Graph

20154 Commits

Author SHA1 Message Date
nia
8bdeed361e ossaudio(3): add some no-op defines for ossv4 compat. 2020-10-19 10:28:47 +00:00
nia
028d2f4db2 ossaudio(3): these ioctls need to return samples, not bytes 2020-10-19 09:07:29 +00:00
nia
27ca241ed7 ossaudio(3): Add SNDCTL_DSP_CURRENT_(I|O)PTR
In OSSv4 these are supposed to avoid the wrapping problems with the
older GET(I|O)PTR ioctls but we don't quite get the same benefit here.

XXX: We could probably fake it by maintaining some state in-between calls.
2020-10-19 09:01:24 +00:00
nia
1f7ebca62c ossaudio(3): Add initial support for the OSSv4.1 Mixer API
One or two calls from this API were supported previously and have been
moved to the correct place.

Mapping the controls correctly is a difficult task. There is a define
hidden in the OSS headers that would allow an AUDIO_MIXER_SET control
to be represented perfectly, but it seems to _only_ exist there, and
no software supports it. So for now only one member of a set can be
set at a time - unfortunate. I've hidden code that should unlock
doing this the proper way under #notyet.

I'm not too happy with the way this code is managing file descriptors.
Currently it has to open a new fd for each ioctl due to OSSv4 deciding
to specify the device number in a structure rather than in the filename.
In the future, we could reuse the file descriptor if the correct one is
detected open.

This allows the mixer programs provided with the OSSv4 sources to compile
and work cleanly. I've observed problems with it failing to work on
secondary devices, and should investigate this later. There may be
a fd leak somewhere.
2020-10-17 23:23:06 +00:00
christos
d6635c5ec1 update to 2020c 2020-10-17 16:24:33 +00:00
skrll
1a739c1b22 Change x30 to lr for ease of reading
NFCI
2020-10-17 15:44:59 +00:00
wiz
e3d011e985 Use Fx and Nx. End Rs block. Remove trailing whitespace.
Remove unnecessary Pp.
2020-10-17 09:04:59 +00:00
nia
b32d7310bd ossaudio.3: note this is most/all of ossv3 and some of ossv4 2020-10-16 20:51:54 +00:00
nia
d53a6cbc32 ossaudio(3): Add SNDCTL_DSP_COOKEDMODE, SNDCTL_DSP_GETERROR
SNDCTL_DSP_COOKEDMODE simply always returns 1.
"Cooked mode" is a silly way the OSSv4 authors chose to refer to allowing
for reprocessed streams. The NetBSD kernel always performs format
conversion and it can't be turned off.

SNDCTL_DSP_GETERROR provides access to the read/write over/underrun
counters. There are other things it might return, but they don't make
sense for our implementation.
2020-10-16 20:24:35 +00:00
nia
ad3ea96832 ossaudio.3: Sort sections. 2020-10-16 16:48:07 +00:00
nia
381a0b036e ossaudio.3: More information about the history and status of this API 2020-10-16 16:30:53 +00:00
nia
9613c80501 ossaudio: Bump copyright date and improve description. 2020-10-16 15:40:16 +00:00
nia
d9a5cdad2e ossaudio: Add comments for the more obscure parts of SNDCTL_AUDIOINFO 2020-10-16 12:36:01 +00:00
nia
2874e967ea ossaudio: Various OSSv4 fixes for SNDCTL_AUDIOINFO
- Per OSSv4, make this ioctl work on the main mixer device.
  Since the native NetBSD API uses queries on individual audio devices,
  we have to reopen the correct audio device specified in the input to the
  ioctl and fetch information from that.
- Correctly return whether the device is for playback, capture, or both.
- Return the full name of the device in the name field.
- The "handle" has to be a globally unique identifier. The closest thing
  we have to that is device numbers, so use device numbers.
- Return reasonable values in min_rate/max_rate and min_channels/max_channels.

This should allow Mumble's device enumeration to work with a lot less
patching.
2020-10-16 12:23:34 +00:00
skrll
e63a73d85d Trailing whitespace 2020-10-15 05:50:14 +00:00
skrll
33778f9e87 Remove '_OFFSETOF' prefix for genassm(1) generate CPP identifers for
consistency with other arches.

NFCI and libc.so is the same before and after.
2020-10-15 05:43:38 +00:00
skrll
252fbae288 Remove '_OFFSETOF' prefix for genassm(1) generate CPP identifers for
consistency with other arches.

NFCI and libc.so is the same before and after.
2020-10-15 05:27:53 +00:00
skrll
90309fbee9 Trailing whitespace 2020-10-15 05:10:30 +00:00
kamil
948dbe8f00 Decorate the aarch64 signal trampoline with CFI attributes easing unwinding
Now, the unwinders (in backtrace(3) and similar) can unwind properly
the stack from a signal handler.
2020-10-13 01:59:55 +00:00
kamil
8c991e5f3d Fix typo 2020-10-12 23:58:14 +00:00
kamil
0d692821e5 Decorate the i386 signal trampoline with CFI attributes easing unwinding
Now, the unwinders (in backtrace(3) and similar) can unwind properly
the stack from a signal handler.
2020-10-12 23:56:08 +00:00
kamil
5b3d48337b Add CVS Id 2020-10-12 21:33:46 +00:00
kamil
749e6dfcc2 Decorate the x86_64 signal trampoline with CFI attributes easing unwinding
Combine the approach provided by Nikhil Benesch and Andrew Cagney.

Now, the unwinders (in gccgo, backtrace(3), etc) can unwind properly
the stack from a signal handler.

Fixes lib/55719 by Nikhil Benesch
2020-10-12 17:55:53 +00:00
uwe
58f328b472 Add italic correction to _Atomic-qualified. 2020-10-09 19:41:02 +00:00
christos
7328cbb47c Merge tzcode2020b (except we keep tzsetwall(3) for now for compatibility,
and we were "slim" already)

Support for zic's long-obsolete '-y YEARISTYPE' option has been
removed and, with it, so has support for the TYPE field in Rule
lines, which is now reserved for compatibility with earlier zic.
These features were previously deprecated in release 2015f.
(Thanks to Tim Parenti.)

zic now defaults to '-b slim' instead of to '-b fat'.

zic's new '-l -' and '-p -' options uninstall any existing
localtime and posixrules files, respectively.

The undocumented and ineffective tzsetwall function has been
removed.
2020-10-09 18:38:48 +00:00
riastradh
a6e2e59435 Reword advice about when not to use membar_exit.
With help from skrll and pgoyette.

While here, change the example so it doesn't violate the advice just
given.  Still not a great example -- abusing UINT_MAX for a reference
count is kinda sketchy, but it'll serve for now.
2020-10-09 17:36:16 +00:00
christos
460972a5e2 bump for set_rpc_maxgrouplist 2020-10-03 18:34:15 +00:00
christos
fb8fd3ef27 Add set_rpc_maxgrouplist 2020-10-03 18:31:29 +00:00
msaitoh
57920690e6 s/occurence/occurrence/ 2020-09-29 02:58:51 +00:00
jmcneill
c9f4e317e7 Add HAVE_NVMM and use it to control the build of NVMM related components.
Defined to "yes" on amd64, "no" everywhere else.
2020-09-26 17:49:49 +00:00
nia
796e3f7c10 remove getentropy bits 2020-09-22 21:37:47 +00:00
ginsbach
d0573fe4fd Correct range for ISO week conversion
The %V conversion range for strptime(3) should match the strftime(3)
conversion range. A valid ISO week is 1-53.
2020-09-21 15:31:54 +00:00
christos
a121fa6581 Add symbol entries for the missing signal functions for the benefit of
autoconf. Autoconf compiles simple programs like:
    char symbol();
    int main() { return symbol(); }
To check if the symbol is present. This makes it happy.
Another way our symbol renaming breaks things.
This fixes gdb native build, which does not find sigprocmask otherwise
and fails to build because it finds pthread_sigmask() and not sigprocmask()!
2020-09-20 20:14:50 +00:00
christos
85603243a2 delint 2020-09-18 14:19:34 +00:00
christos
0068430ed4 PR/55668: Martin Husemann: Disable optimization to avoid infinite loop.
Also bring in a few changes from the most recent gdtoa code (not relevant
to the bug).
2020-09-18 14:06:45 +00:00
mrg
032acb9ed8 make the 2nd argument to __memmove_chk() const 2020-09-05 13:37:59 +00:00
maxv
4a2e4dc388 nvmm: update copyright headers 2020-09-05 07:22:25 +00:00
riastradh
ddc76b9234 Update membar_ops(3) man page with examples and relation to C11.
Add exhortation to always always always document how membars come in
pairs for synchronization between two CPUs when you use them.
2020-09-03 00:00:06 +00:00
jakllsch
453b641308 Treat aarch64eb the same as aarch64 2020-09-02 16:22:45 +00:00
rillig
f76631bc42 stdio(3): fix typos in the manual page
fputc cannot read characters, it can only write them.
2020-08-29 15:25:57 +00:00
christos
93b012cb25 Allow vdprintf to work on non-blocking non-regular files (Rob Newberry) 2020-08-28 22:02:24 +00:00
kre
631837b7c6 When not compiling -DSMALL permit use of names RTMIN[+n] and RTMAX[-n]
(where n is a decimal integer in the range [0 .. SIGRTMAX-SIGRTMIN].
As usual a leading "sig" is ignored and the strings are case independent.

Some implementations do not name the real time signals, and using
labels like RTMIN+3 can be the only way they can be manipulated,
so allow that technique (we still return the RTnn names on the inverse
translation though).

Because this is used by both kill(1) and sh(1) the kill and trap
commands both gain access to the new notation (when !SMALL).
2020-08-20 22:56:56 +00:00
riastradh
25f11de3b9 mmap MAP_FAILED audit. 2020-08-20 15:54:11 +00:00
christos
9630bba2c9 make sure errno is always set when we return -1 (Anon Ymous) 2020-08-18 19:18:06 +00:00
riastradh
bdad8b2721 New system call getrandom() compatible with Linux and others.
Three ways to call:

getrandom(p, n, 0)              Blocks at boot until full entropy.
                                Returns up to n bytes at p; guarantees
                                up to 256 bytes even if interrupted
                                after blocking.  getrandom(0,0,0)
                                serves as an entropy barrier: return
                                only after system has full entropy.

getrandom(p, n, GRND_INSECURE)  Never blocks.  Guarantees up to 256
                                bytes even if interrupted.  Equivalent
                                to /dev/urandom.  Safe only after
                                successful getrandom(...,0),
                                getrandom(...,GRND_RANDOM), or read
                                from /dev/random.

getrandom(p, n, GRND_RANDOM)    May block at any time.  Returns up to n
                                bytes at p, but no guarantees about how
                                many -- may return as short as 1 byte.
                                Equivalent to /dev/random.  Legacy.
                                Provided only for source compatibility
                                with Linux.

Can also use flags|GRND_NONBLOCK to fail with EWOULDBLOCK/EAGAIN
without producing any output instead of blocking.

- The combination GRND_INSECURE|GRND_NONBLOCK is the same as
  GRND_INSECURE, since GRND_INSECURE never blocks anyway.

- The combinations GRND_INSECURE|GRND_RANDOM and
  GRND_INSECURE|GRND_RANDOM|GRND_NONBLOCK are nonsensical and fail
  with EINVAL.

As proposed on tech-userlevel, tech-crypto, tech-security, and
tech-kern, and subsequently adopted by core (minus the getentropy part
of the proposal, because other operating systems and participants in
the discussion couldn't come to an agreement about getentropy and
blocking semantics):

https://mail-index.netbsd.org/tech-userlevel/2020/05/02/msg012333.html
2020-08-14 00:53:15 +00:00
uwe
172da20a8e Fix grammar. 2020-07-30 21:23:36 +00:00
christos
a5cb7ebb06 this file contained the same information as extattr_namespace_to_string.3
and somewhat incorrect too.
2020-07-26 18:10:00 +00:00
christos
1abb353bae If Unwind_Backtrace is broken, ctx.n will still contain ~0, and we will
return that which poor behavior for the user, so return 0 instead.
We could document ~0 to be an error, but that would deviate from the
Linux behavior which is not desirable. Noted by Poul-Henning Kamp
2020-07-26 15:53:05 +00:00
christos
66a0459ab7 remove duplicate, noted by chuq (this was never used).
perhaps either move extattr.c from generic here, or move the man page
extattr.3 in gen?
2020-07-25 21:53:34 +00:00
msaitoh
984bb2b315 s/reseting/resetting/ 2020-07-22 01:24:39 +00:00
wiz
b46ced516b Remove trailing whitespace. 2020-07-17 18:58:11 +00:00
kamil
07e8492e26 Add ppoll() a compatibility wrapper around pollts(2)
Submitted by Apurva Nandan.
2020-07-17 15:34:16 +00:00
uwe
ccb2ee4b73 newwin - fix crash with negative ncols.
When support for negative nrows/ncols was added, one s/ncols/maxx/ was
missed so we ended up passing negative (i.e. huge unsigned) length
when hashing the line contents.

Reported by Naman Jain in PR lib/55484
2020-07-14 04:39:39 +00:00
christos
6953eca8c7 Fix numeric variable handling in settc (lyzliyuzhi at 163 dot com) 2020-07-10 20:34:24 +00:00
uwe
70f6ed9ef6 Pads are not to be automatically refreshed on input.
X/Open Curses says in the documentation for newpad():

  Automatic refreshes of pads (e.g., from scrolling or echoing of
  input) do not occur.

And in the documentation for get*():

  If the current or specified window is not a pad, and it has been
  moved or modified since the last refresh operation, then it will be
  refreshed before another character is read.

From Michael Forney in PR lib/55457
2020-07-06 23:33:38 +00:00
uwe
f6dea36d0e mvwins*(WINDOW *win, ...) functions - call wins* on win, not stdscr.
From Naman Jain in PR lib/55460.
2020-07-06 22:46:50 +00:00
christos
65c5691e7d revert previous; utmpxname is already documented in getlastlogx.3. Should
probably be moved.
2020-07-05 01:09:48 +00:00
christos
20e726508c document utmpxname(3) 2020-07-05 01:05:50 +00:00
uwe
71a0f0ceb5 wtouchln - verify/clip input parameters
From Naman Jain in PR lib/55454
2020-07-03 23:28:51 +00:00
uwe
939fb589cb setcchar - don't lose combining marks to a typo.
We copy len wchars but set the length field to 1, instead of len.
From Naman Jain in PR lib/55443
2020-07-02 23:43:01 +00:00
uwe
1765a45b05 hline, vline - don't lose attributes when using default character.
Make default (wide) and non-wide behavior match.  If the character
argument has (only) attributes set, use them with the default line
character.

In the wide case don't do the fallback in hline - it just calls
hline_set that needs to do it anyway.  Fix the latter to check the
wcwidth of the right character and avoid division by zero.
2020-07-01 02:57:01 +00:00
uwe
4eb5fad78b Oops. Fix y/x typo in the previous whline() fix for !HAVE_WCHAR. 2020-07-01 02:14:41 +00:00
uwe
d9a8ae84b1 Fix indentation in the copyright.
Make it match its siblings in other files.
2020-06-30 21:27:18 +00:00
uwe
9c6a61e7ae whline - save/restore the y coordinate too.
Reaching the right side of the screen can cause a line wrap.
Forgot to apply the fix to the !HAVE_WCHAR case.
PR lib/55434
2020-06-30 21:10:13 +00:00
uwe
1eecb61d77 whline_set - save/restore the y coordinate too.
Reaching the right side of the screen can cause a line wrap.
PR lib/55434
2020-06-30 21:02:24 +00:00
wiz
b633f84bf0 Remove Xr to extattr(2) which we don't have. 2020-06-28 21:37:05 +00:00
christos
3d58360bad reality check 2020-06-28 18:23:01 +00:00
rin
bda9e4fdad Turn on _UC_TLSBASE for sure in the same manner as other ports.
No functional changes since that flag is turned on via getcontext(2).
2020-06-22 06:49:04 +00:00
roy
f236a33b97 libterminfo: cast to uint16/32_t before conversion to preserve negativity
Otherwise the ABSENT_NUMERIC(-1) or CANCELLED_NUMERIC(-2) will be converted
incorrectly to size_t and then down to uint16/32_t.
Picked up by DIAGNOSTIC builds.

Thanks to Michael Forney for the fix for PR lib/52293.
2020-06-21 15:05:23 +00:00
wiz
143a74fba3 Remove reference to non-existing extattr(2) and fix two other xrefs. 2020-06-18 19:47:41 +00:00
wiz
1b3734281f Add RCS Id. 2020-06-18 19:46:34 +00:00
kamil
aa97815be0 Include explicitly <rump/rump_syscallshotgun.h> for previous indirect users
via <rump/rump.h>.
2020-06-17 00:16:21 +00:00
christos
2f0bfbf344 Rename blacklist -> blocklist 2020-06-15 01:57:29 +00:00
ad
7a60fa0a18 Another bug. The CAS loop in pthread_cond_signal() could race against the
thread it is trying to awake.  The thread could exit the condvar and then
reinsert itself at the head of the list with a new waiter behind it.  It's
likely possible to fix this in a way that's wait-free but for now just fix
the bug.
2020-06-14 21:33:28 +00:00
ad
6088a8599a Don't need to ignore ESRCH from _lwp_park() any more. 2020-06-14 21:31:11 +00:00
riastradh
025a8ce8b7 Nix trailing whitespace. 2020-06-13 17:39:42 +00:00
kamil
d8442aacf9 Fix incompatible function pointer casts 2020-06-13 16:51:59 +00:00
fox
113ec9c52a lib/libpam: Fix the possible -Werror=stringop-truncation
Replace strncpy(3) with the safer strlcpy(3) and adjust the code.

Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.

Reviewed by: kamil@, christos@
2020-06-12 01:20:32 +00:00
ad
30140ed218 Drop self->pt_lock before clearing TSD / malloc TSD. 2020-06-11 18:42:02 +00:00
ad
2b4d53924f Adjust memory barriers. 2020-06-11 18:41:22 +00:00
ad
62e0939e7d - Make pthread_condvar and pthread_mutex work on the stack rather than in
pthread_t, so there's less chance of bad things happening if someone calls
  (for example) pthread_cond_broadcast() from a signal handler.

- Remove all the deferred waiter handling except for the one case that really
  matters which is transferring waiters from condvar -> mutex on wakeup, and
  do that by splicing the condvar's waiters onto the mutex.

- Remove the mutex waiters bit as it's another complication that's not
  strictly needed.
2020-06-10 22:45:15 +00:00
thorpej
abcb66ec85 Update for proplib(3) API changes. 2020-06-07 05:54:00 +00:00
ad
b81fe3a293 Adjust previous. In the condvar case the wakeup might already have been
eaten.
2020-06-06 22:23:59 +00:00
thorpej
a792b8435e Improvements to the problib(3) API:
==> Provide a much more complete set of setters and getters for different
    value types in the prop_array_util(3) and prop_dictionary_util(3)
    functions.

==> Overhaul the prop_data(3), prop_number(3), and prop_string(3) APIs
    to be easier to use and less awkwardly named,  Deprecate the old
    awkward names, and produce link-time warnings when they are referenced.

==> Deprecate mutable prop_data(3) and prop_string(3) objects.  The old
    APIs that support them still exist, but will now produce link-time
    warnings when used.

==> When the new prop_string(3) API is used, strings are internally
    de-duplicated as a memory footprint optimization.

==> Provide a rich set of bounds-checked gettter functions in and a
    corresponding set of convenience setters in the prop_number(3) API.

==> Add a new prop_bool_value(3) function that is equivalent to
    prop_bool_true(3), but aligned with the new "value" routines in
    prop_data(3), prop_string(3), and prop_number(3).
2020-06-06 21:25:59 +00:00
roy
c3293770af terminfo(5): Numbre -> Number
Thanks to yukonbob
2020-06-05 22:08:10 +00:00
nia
d06dd93f7d Remove more bogus tests for 64-bit i386 and SuperH.
These are always false.
2020-06-05 11:16:15 +00:00
nia
35c066bcd5 getaddrinfo.3: order of the struct members is wrong, correct it 2020-06-04 11:28:00 +00:00
riastradh
0b4833402a Nix trailing whitespace. NFCI. 2020-06-04 04:40:01 +00:00
joerg
558a0c7357 If _malloc_thread_cleanup is implement, call it from libpthread.
Provide the hook from modern jemalloc to avoid using TSD for the thread
destruction cleanup as it can result in reentrancy crashes if fork is
called from a thread that never called malloc as it will result in a
late malloc from the pre-fork synchronisation handler.
2020-06-04 00:45:32 +00:00
ad
051faad4aa Deal with a couple of problems with threads being awoken early due to
timeouts or cancellation where:

- The restarting thread calls _lwp_exit() before another thread gets around
  to waking it with _lwp_unpark(), leading to ESRCH (observed by joerg@).
  (I may have removed a similar check mistakenly over the weekend.)

- The restarting thread considers itself gone off the sleep queue but
  at the same time another thread is part way through waking it, and hasn't
  fully completed that operation yet by setting thread->pt_mutexwait = 0.
  I think that could have potentially lead to the list of waiters getting
  messed up given the right circumstances.
2020-06-03 22:10:24 +00:00
kamil
5d0165c29d timespec_get(3) was developed by myself
Remove FreeBSD from the authorship as it was just a pullup of small
documentation changes.
2020-06-02 19:30:29 +00:00
nia
d5d305cc98 Don't suggest removing arc4random with a libc bump.
It's established enough in non-legacy code that this is a terrible idea.
Even if we add getentropy it's not a comparable API (not a userspace RNG
capable of streaming large numbers of bytes, doesn't have _uniform, etc).

"Feel free to remove that line!" - riastradh
2020-06-02 13:56:30 +00:00
joerg
b90f380e16 Don't overalign _RuneStatePriv, it must share the alignment of mbstate_t
it aliased with. Assert that the alignment actually used reflects the
alignment required by existing implementation and for newly build
modules assert that it is at most the guaranteed alignment.
2020-06-02 01:30:31 +00:00
joerg
34a4ae727b Pass down errno when calling pthread__errorfunc after a system call.
Allow format arguments for that reason and use (v)snprintf_ss in
pthread_errorfunc to avoid race conditions and the like.
2020-06-02 00:29:53 +00:00
ad
06d492d198 In the interests of reliability simplify waiter handling more and redo
condvars to manage the list of waiters with atomic ops.
2020-06-01 11:44:59 +00:00
christos
58b288d88d use strlcpy() instead of strncpy() for gcc happiness 2020-05-31 23:24:23 +00:00
rin
3a564f248f Add m68k assembler version of __muldi3().
This is intended for 68060:
  - GCC does not emit __muldi3() for 68020-40, that have 32 * 32 --> 64 mulul
  - mulsl (and moveml), used in this code, are not implemented for 68010

In comparison with that from compiler_rt, this version saves:
  - 12% of processing time
  - 12 bytes of stack
  - 50 bytes of code size
Also, slightly faster, memory saving, and smaller than libgcc version.

By examining with evcnt(9), __muldi3() is invoked more than 1000 times per
sec by kernel, which should justify to introduce assembler version of this
function.
2020-05-31 11:43:37 +00:00
roy
877982596a terminfo: test strlcpy result against space free, not string length
riastradh@ yep, looks good.
2020-05-30 16:03:58 +00:00
rmind
b899bfd96f Major NPF improvements (merge from upstream):
- Switch to the C11-style atomic primitives using atomic_loadstore(9).

- npfkern: introduce the 'state.key.interface' and 'state.key.direction'
  settings.  Users can now choose whether the connection state should be
  strictly per-interface or global at the configuration level.  Keep NAT
  logic to be always per-interface, though.

- npfkern: rewrite the G/C worker logic and make it self-tuning.

- npfkern and libnpf: multiple bug fixes; add param exporting; introduce
  more parameters.  Remove npf_nvlist_{copyin,copyout}() functions and
  refactor npfctl_load_nvlist() with others; add npfctl_run_op() to have
  a single entry point for operations.  Introduce npf_flow_t and clean up
  some code.

- npfctl: lots of fixes for the 'npfctl show' logic; make 'npfctl list'
  more informative; misc usability improvements and more user-friendly
  error messages.

- Amend and improve the manual pages.
2020-05-30 14:16:56 +00:00
christos
c1167da0aa Add pathconf and lpathconf (fixes lib/librumphijack/nfs test which uses ls
which now uses lpathconf)
2020-05-27 18:55:36 +00:00