Home | History | Annotate | only in /src/sys/compat/ossaudio
History log of /src/sys/compat/ossaudio
RevisionDateAuthorComments
 1.4 17-Nov-2014  uebayasi Define compat modules (but without dependencies yet).
 1.3 18-Jan-2003  christos branches: 1.3.150;
add compat_ossaudio
 1.2 20-Jul-1997  pk config.new => config
 1.1 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.3.150.1 03-Dec-2017  jdolecek update from HEAD
 1.85 20-Jun-2023  riastradh compat_ossaudio: Zero-initialize idat before copyout.

Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

XXX pullup-8
XXX pullup-9
XXX pullup-10
 1.84 07-Sep-2021  riastradh branches: 1.84.4;
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.
 1.83 19-Apr-2020  nia ossaudio: Avoid giving userland uninitialized memory. Noticed by maxv.

The uninitalized field in this structure is `fillers`, an array that
simply reserves space for later changes in OSSv4, which this version
of the OSS compat layer (specifically for Linux applications) makes no
effort to implement.
 1.82 19-Apr-2020  nia ossaudio: Implement SNDCTL_DSP_(SET|GET)TRIGGER.
 1.81 15-Apr-2020  nia ossaudio: If the user's channel count is rejected, use the hardware count
 1.80 15-Apr-2020  nia 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.
 1.79 15-Apr-2020  nia 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).
 1.78 03-Nov-2019  isaki branches: 1.78.6;
Use record field for recording even on
SNDCTL_DSP_STEREO, SNDCTL_DSP_SETFMT, and SNDCTL_DSP_CHANNELS.
 1.77 02-Nov-2019  isaki Use record.sample_rate for recording on SNDCTL_DSP_SPEED.
It's kernel side of PR lib/54667.
 1.76 26-Sep-2019  christos - "source" is u_long in the kernel (and int in userland). Cast -1 to u_long.
- make "s" unsigned since blocksize is too.
 1.75 23-Aug-2019  maxv Fix error handling, returns an errno, not -1.
 1.74 03-Feb-2019  mrg branches: 1.74.4;
- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
 1.73 02-Feb-2019  isaki Correct debug messages.
 1.72 02-Feb-2019  isaki Fix minor bugs of SNDCTL_DSP_GETISPACE.
- hiwat is playback-only parameter.
- 'bytes' should not be rounded down.
 1.71 29-Jan-2019  isaki Revert a wrong OSS_SNDCTL_DSP_GETOSPACE part of rev1.70.
- 'fragments' is the number of full free blocks and should not be
negative value.
- 'bytes' should not be rounded down.
 1.70 24-Mar-2017  nat branches: 1.70.6; 1.70.14;
Update compat/ossaudio with GETISPACE/GETOSPACE corrections from
libossaudio.
 1.69 05-Sep-2014  matt branches: 1.69.2; 1.69.4; 1.69.6;
Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.68 19-Sep-2013  christos branches: 1.68.4; 1.68.10;
exec modules need to be of the exec kind
 1.67 14-Oct-2011  hannken branches: 1.67.2; 1.67.12; 1.67.16;
Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock. Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
 1.66 06-Sep-2011  jmcneill Add support for AFMT_AC3
 1.65 22-Aug-2009  christos add a lot more debugging and error checking. Alas, skype seems to be happy
getting back our values, but still does not work.
 1.64 13-Nov-2008  ad compat_ossaudio module, so others can depend on it.
 1.63 28-Apr-2008  martin branches: 1.63.2; 1.63.6; 1.63.8;
Remove clause 3 and 4 from TNF licenses
 1.62 21-Mar-2008  ad branches: 1.62.2; 1.62.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.61 20-Dec-2007  dsl branches: 1.61.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.60 08-Dec-2007  dsl branches: 1.60.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.59 04-Dec-2007  dsl Remove all the __P
 1.58 26-Nov-2007  pooka branches: 1.58.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.57 18-Sep-2007  mlelstv branches: 1.57.6;
Implement OSS_SNDCTL_DSP_GETODELAY and provide a no-op function
for OSS_SNDCTL_DSP_PROFILE.
 1.56 11-Jun-2007  joerg branches: 1.56.6; 1.56.8;
Add a new ioctl AUDIO_GETBUFINFO. It works like AUDIO_GETINFO, but
doesn't obtain the ports, gain and balance related parameters.
Those generally require reading from the hardware and therefore are much
more expensive to obtain. Modify OSS emulation to use the new ioctl
where possible.

This reduces CPU usage of mplayer during mp3 playback with my Thinkpad
from 20% to < 1% and from 50% to 20% during Xvid playback.

Review and comments from jmcneill@
 1.55 04-Mar-2007  christos branches: 1.55.2; 1.55.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.54 09-Feb-2007  ad branches: 1.54.2;
Merge newlock2 to head.
 1.53 03-Sep-2006  christos branches: 1.53.2; 1.53.6; 1.53.8;
remove unneeded initializer.
 1.52 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.51 14-May-2006  elad integrate kauth.
 1.50 04-Mar-2006  xtraeme branches: 1.50.2; 1.50.4; 1.50.6;
Instead of getting properties from calling ioctl with AUDIO_GETINFO, use
AUDIO_INITINFO(). Now the sound with the linux flash plugin works
properly.

From OpenBSD.
 1.49 11-Dec-2005  christos branches: 1.49.4; 1.49.6;
merge ktrace-lwp.
 1.48 08-Dec-2005  tron Fix problem in ioctl() handling in OSS audio emulation which caused
unintentional changes of the audio settings e.g. when running "kphone".

Patch submitted by George Michaelson on "tech-kern@NetBSD.org".
 1.47 26-Feb-2005  perry branches: 1.47.2; 1.47.4;
nuke trailing whitespace
 1.46 18-Nov-2004  kent branches: 1.46.4; 1.46.6;
getdevinfo():
If a mixer item does not match with AudioNsomething, check whether
it ends with '.' + AudioNsomething. PR#15441
 1.45 29-Jun-2003  fvdl branches: 1.45.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.44 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.43 23-Jun-2003  augustss Fix missing call to FILE_UNUSE. From kern/21946, from Todd Vierling.
 1.42 21-Mar-2003  dsl Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
 1.41 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.40 12-Jan-2003  jdolecek add support for SNDCTL_DSP_SETDUPLEX ioctl to ossaudio emulation code
code provided by Andreas Wrede in PR kern/19793
 1.39 24-Dec-2001  mycroft branches: 1.39.10;
Make SNDCTL_DSP_POST a nop. It's explicitly *not* supposed to sleep, and as
it's merely advisory (and in fact is implemented as a nop in the OSS->ALSA
shim), it should be safe to ignore it.
 1.38 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.37 09-Jul-2001  kim branches: 1.37.2;
Map OSS mixer device "line1" to native mixer device "aux".
 1.36 14-Jun-2001  thorpej Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.35 10-May-2001  augustss Improved fix of PR12796, from Frederick Bruckman <fb@enteract.com>
 1.34 09-May-2001  augustss Apply patch in PR lib/12796 from Frederick Bruckman <fb@enteract.com>
 1.33 18-Jan-2001  jdolecek branches: 1.33.2;
constify
 1.32 16-Aug-2000  tron Use accurate rounding in conversion between OSS and NetBSD volume values.
The optimized integer formula was supplied by Wolfgang Solfrank on
"tech-kern@netbsd.org". This fixes problems with e.g FreeBSD TV (fxtv),
RealPlayer-7.0 Beta 2 (PR pkg/10818) and KDE's "kscd".
 1.31 04-Jul-2000  augustss Implement OSS_GETVERSION.
Accept mixer values above max (100).
Handle the info from AUDIO_MIXER_DEVINFO properly, parts of it is opaque.
 1.30 17-Nov-1999  augustss branches: 1.30.4;
Implement OSS_SOUND_MIXER_INFO.
 1.29 22-Aug-1999  kleink branches: 1.29.2; 1.29.8;
Per discussion with Lennart Augustsson, change the behaviour to report emulated
encodings, too. (This is currently an issue with the eso(4) driver, which,
due to different byte orders in playing and recording directions, sets the
emulated flag for all 16-bit encodings, although it could be argued that this
is an unfortunate weakness of the query_encoding() interface.)
 1.28 05-May-1999  thorpej Add "use counting" to file entries. When closing a file, and it's reference
count is 0, wait for use count to drain before finishing the close.

This is necessary in order for multiple processes to safely share file
descriptor tables.
 1.27 13-Apr-1999  augustss Make copyright conform.
 1.26 07-Aug-1998  augustss branches: 1.26.6;
Add MIDI support. The MIDI devices can be accessed as ``raw'' through
the /dev/rmidiN devices, or with a sequencer interface via /dev/music.
So far the only supported MIDI device is the MPU401 port on SoundBlaster
(and only on SB on isapnp, since we do not have locators with multiple
values yet).
 1.25 25-May-1998  augustss Fix off by 1 error
 1.24 19-Mar-1998  mycroft SETFRAGMENT ignores the high bit.
 1.23 19-Oct-1997  augustss branches: 1.23.2;
Make the audio API (almost) SunOS compatible.
The changes is to allow some limited mixer manipulation through
the audio device (instead of the mixer device).
This rendered 4 methods in audio_hw_if unused so garbage collect these.
 1.22 16-Oct-1997  augustss Insert missing NetBSD copyright notices.
 1.21 07-Oct-1997  augustss Emulate setting the hiwater mark with SETFRAGMENT the right way.
Get rid of some 'register'.
 1.20 24-Aug-1997  augustss Increase the number of mixer devices the emulation looks at.
 1.19 11-Aug-1997  augustss Oops, forgot two lines in last commit.
 1.18 11-Aug-1997  augustss Implement OSS_SNDCTL_DSP_NONBLOCK.
 1.17 11-Aug-1997  augustss Some more debugging output.
 1.16 07-Aug-1997  augustss Make sure OSS_SNDCTL_DSP_GETFMTS returns the formats the audio driver
can handle and not just some random guess.
Also add some debugging stuff.
 1.15 06-Aug-1997  augustss Improve ioctl decoding.
Change mixer name mappings.
 1.14 28-Jul-1997  augustss branches: 1.14.2;
Make sure the blocksize is always a power of 2 when inspected.
OSS only uses powers of 2 so some programs expect this.
Now Quake works!
 1.13 27-Jul-1997  augustss Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.12 15-Jul-1997  augustss In the name of backwards compatibility AUDIO_ENCODING_LINEAR has been
renamed AUDIO_ENCODING_SLINEAR and AUDIO_ENCODING_LINEAR reverts to the
NetBSD 1.2 sematics. A kernel with COMPAT_12 defined will accept
AUDIO_ENCODING_LINEAR and treat it as before, without COMPAT_12 it
will be rejected.
 1.11 19-May-1997  augustss Add missing initialization.
 1.10 19-May-1997  augustss Fix recording source selection bug.
 1.9 07-May-1997  augustss Return audio buffer size in audio_info_t with ioctl() AUDIO_GETINFO.
Use the buffer size to implement one more OSS ioctl().
 1.8 07-May-1997  augustss Convert to new orthogonal audio encoding scheme and implement
some of the new encodings. The change to ioctl AUDIO_GETENC is
NOT backwards compatible.
 1.7 06-Apr-1997  augustss Improve setting of record source.
 1.6 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.5 20-Mar-1997  mycroft Copy back the format we set in SNDCTL_DSP_SETFMT.
 1.4 20-Mar-1997  mycroft SOUND_PCM_WRITE_CHANNELS -> SNDCTL_DSP_CHANNELS, to match current Linux code.
 1.3 19-Mar-1997  mycroft Emulate the SOUND_PCM_WRITE_CHANNELS ioctl. From PR 3356, by Lennart
Augustsson. Also add hooks for mixer ioctls.
 1.2 17-Oct-1996  fvdl Add RCS Id.
 1.1 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.14.2.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.2.1 08-May-1998  mycroft Pull up 1.24, per request of mycroft.
 1.26.6.2 26-Aug-2000  he Pull up revision 1.32 (via patch, requested by tron):
Use accurate rounding in conversion between OSS and NetBSD
volume values. Fixes among other things PR#10818.
 1.26.6.1 16-Apr-1999  augustss branches: 1.26.6.1.2;
Make a bunch of copyright headers conform to the standard.
Pullup approved by Perry.
 1.26.6.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.29.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.29.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.29.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.30.4.4 27-Dec-2001  he Pull up revision 1.39 (requested by mycroft):
Change our emulation of SNDCTL_DSP_POST so that OSS applications
(e.g. xmms) don't randomly pause.
 1.30.4.3 16-Aug-2001  tv Pullup [fb]:

lib/libossaudio/ossaudio.c 1.13-1.14
lib/libossaudio/soundcard.h 1.11
sys/compat/ossaudio/ossaudio.c 1.34-1.35

Correctly calculate input and output hardware buffer sizes.
Fixes PR lib/12796.
 1.30.4.2 16-Aug-2000  tron pullup (approved by releng-1-5)

Use accurate rounding in conversion between OSS and NetBSD volume values.
The optimized integer formula was supplied by Wolfgang Solfrank on
"tech-kern@netbsd.org". This fixes problems with e.g FreeBSD TV (fxtv),
RealPlayer-7.0 Beta 2 (PR pkg/10818) and KDE's "kscd".

syssrc/sys/compat/ossaudio/ossaudio.c 1.31 -> 1.32
basesrc/lib/libossaudio/ossaudio.c 1.11 -> 1.12
 1.30.4.1 07-Aug-2000  augustss Pull up:
sys/compat/ossaudio/ossaudio.c 1.30-1.31
sys/compat/ossaudio/ossaudiovar.h 1.7-1.9
lib/libossaudio/ossaudio.c 1.10-1.11
Accept mixer values above max (100).
Handle the info from AUDIO_MIXER_DEVINFO properly, parts of it is opaque.
Approved by thorpej.
 1.33.2.6 15-Jan-2003  thorpej Sync with HEAD.
 1.33.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.33.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.33.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.33.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.33.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.37.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.39.10.1 17-Aug-2003  tron Pull up revision 1.43 (requested by tv in ticket #1422):
Fix missing call to FILE_UNUSE. From kern/21946, from Todd Vierling.
 1.45.2.7 11-Dec-2005  christos Sync with head.
 1.45.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.45.2.5 29-Nov-2004  skrll Sync with HEAD.
 1.45.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.45.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.45.2.2 19-Aug-2003  skrll Fix patch botch.
 1.45.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.46.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.46.4.1 29-Apr-2005  kent sync with -current
 1.47.4.8 24-Mar-2008  yamt sync with head.
 1.47.4.7 21-Jan-2008  yamt sync with head
 1.47.4.6 07-Dec-2007  yamt sync with head
 1.47.4.5 27-Oct-2007  yamt sync with head.
 1.47.4.4 03-Sep-2007  yamt sync with head.
 1.47.4.3 26-Feb-2007  yamt sync with head.
 1.47.4.2 30-Dec-2006  yamt sync with head.
 1.47.4.1 21-Jun-2006  yamt sync with head.
 1.47.2.1 21-Jan-2006  snj Pull up following revision(s) (requested by tron in ticket #1127):
sys/compat/ossaudio/ossaudio.c: revision 1.48
Fix problem in ioctl() handling in OSS audio emulation which caused
unintentional changes of the audio settings e.g. when running "kphone".
Patch submitted by George Michaelson on "tech-kern@NetBSD.org".
 1.49.6.2 01-Jun-2006  kardel Sync with head.
 1.49.6.1 22-Apr-2006  simonb Sync with head.
 1.49.4.1 09-Sep-2006  rpaulo sync with head
 1.50.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.50.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.50.2.3 14-Sep-2006  yamt sync with head.
 1.50.2.2 11-Aug-2006  yamt sync with head
 1.50.2.1 24-May-2006  yamt sync with head.
 1.53.8.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.53.6.1 12-Jun-2007  liamjfoy Pull up following revision(s) (requested by jmcneill in ticket #716):
share/man/man4/audio.4: revision 1.66
sys/compat/ossaudio/ossaudio.c: revision 1.56
sys/sys/audioio.h: revision 1.32
lib/libossaudio/ossaudio.c: revision 1.21
sys/dev/audio.c: revision 1.222
Add a new ioctl AUDIO_GETBUFINFO. It works like AUDIO_GETINFO, but
doesn't obtain the ports, gain and balance related parameters.
Those generally require reading from the hardware and therefore are
much
more expensive to obtain. Modify OSS emulation to use the new ioctl
where possible.
This reduces CPU usage of mplayer during mp3 playback with my Thinkpad
from 20% to < 1% and from 50% to 20% during Xvid playback.
Review and comments from jmcneill@
 1.53.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.54.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.55.4.1 11-Jul-2007  mjf Sync with head.
 1.55.2.2 09-Oct-2007  ad Sync with head.
 1.55.2.1 15-Jul-2007  ad Sync with head.
 1.56.8.2 09-Jan-2008  matt sync with HEAD
 1.56.8.1 06-Nov-2007  matt sync with HEAD
 1.56.6.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.56.6.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.56.6.1 02-Oct-2007  joerg Sync with HEAD.
 1.57.6.2 27-Dec-2007  mjf Sync with HEAD.
 1.57.6.1 08-Dec-2007  mjf Sync with HEAD.
 1.58.2.2 26-Dec-2007  ad Sync with head.
 1.58.2.1 08-Dec-2007  ad Sync with head.
 1.60.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.61.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.61.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.61.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.62.4.3 16-Sep-2009  yamt sync with head
 1.62.4.2 04-May-2009  yamt sync with head.
 1.62.4.1 16-May-2008  yamt sync with head.
 1.62.2.1 18-May-2008  yamt sync with head.
 1.63.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.63.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.63.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.63.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.67.16.1 18-May-2014  rmind sync with head
 1.67.12.2 03-Dec-2017  jdolecek update from HEAD
 1.67.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.67.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.68.10.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.68.4.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.69.6.1 21-Apr-2017  bouyer Sync with HEAD
 1.69.4.1 26-Apr-2017  pgoyette Sync with HEAD
 1.69.2.1 28-Aug-2017  skrll Sync with HEAD
 1.70.14.3 21-Apr-2020  martin Sync with HEAD
 1.70.14.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.70.14.1 10-Jun-2019  christos Sync with HEAD
 1.70.6.5 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1841):

sys/compat/sunos32/sunos32_misc.c: revision 1.86
sys/compat/ossaudio/ossaudio.c: revision 1.85
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.48

compat_sunos32: Memset zero before copyout.

Unclear if this can leak anything but let's be on the safe side.

compat_ossaudio: Zero-initialize idat before copyout.
Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

linux32_rt_sendsig: Memset zero before copyout.
Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.
 1.70.6.4 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

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.
 1.70.6.3 22-Apr-2020  martin Pull up following revision(s) (requested by maxv in ticket #1535):

sys/compat/ossaudio/ossaudio.c: revision 1.83

ossaudio: Avoid giving userland uninitialized memory. Noticed by maxv.

The uninitalized field in this structure is `fillers`, an array that
simply reserves space for later changes in OSSv4, which this version
of the OSS compat layer (specifically for Linux applications) makes no
effort to implement.
 1.70.6.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.70.6.1 09-Feb-2019  martin Pull up following revision(s) (requested by isaki in ticket #1185):

lib/libossaudio/ossaudio.c: revision 1.35
sys/compat/ossaudio/ossaudio.c: revision 1.71

Revert a wrong SNDCTL_DSP_GETOSPACE part of rev1.33.
- 'fragments' is the number of full free blocks and should not be
negative value.
- 'bytes' should not be rounded down.

It makes mpv work correctly (fixes a second half of kern/53028).
Reviewed by mlelstv@

-

Revert a wrong OSS_SNDCTL_DSP_GETOSPACE part of rev1.70.
- 'fragments' is the number of full free blocks and should not be
negative value.
- 'bytes' should not be rounded down.
 1.74.4.6 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1650):

sys/compat/sunos32/sunos32_misc.c: revision 1.86
sys/compat/ossaudio/ossaudio.c: revision 1.85
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.48

compat_sunos32: Memset zero before copyout.

Unclear if this can leak anything but let's be on the safe side.

compat_ossaudio: Zero-initialize idat before copyout.
Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

linux32_rt_sendsig: Memset zero before copyout.
Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.
 1.74.4.5 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

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.
 1.74.4.4 27-Apr-2020  martin Pull up following revision(s) (requested by nia in ticket #855):

lib/libossaudio/ossaudio.c: revision 1.41
lib/libossaudio/ossaudio.c: revision 1.42
lib/libossaudio/ossaudio.c: revision 1.43
sys/compat/ossaudio/ossaudio.c: revision 1.80
sys/compat/ossaudio/ossaudio.c: revision 1.81
sys/compat/ossaudio/ossaudio.c: revision 1.82
lib/libossaudio/ossaudio.c: revision 1.39
sys/compat/ossaudio/ossaudio.c: revision 1.79
lib/libossaudio/ossaudio.c: revision 1.40

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).

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.

ossaudio: If the user's channel count is rejected, use the hardware count

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.

ossaudio: Implement SNDCTL_DSP_(SET|GET)TRIGGER.
 1.74.4.3 22-Apr-2020  martin Pull up following revision(s) (requested by maxv in ticket #841):

sys/compat/ossaudio/ossaudio.c: revision 1.83

ossaudio: Avoid giving userland uninitialized memory. Noticed by maxv.

The uninitalized field in this structure is `fillers`, an array that
simply reserves space for later changes in OSSv4, which this version
of the OSS compat layer (specifically for Linux applications) makes no
effort to implement.
 1.74.4.2 19-Nov-2019  martin Pull up following revision(s) (requested by isaki in ticket #446):
lib/libossaudio/ossaudio.c: revision 1.37
lib/libossaudio/ossaudio.c: revision 1.38
sys/compat/ossaudio/ossaudio.c: revision 1.77
sys/compat/ossaudio/ossaudio.c: revision 1.78
Use record.sample_rate for recording on SNDCTL_DSP_SPEED.
Fix PR lib/54667.
Use record.sample_rate for recording on SNDCTL_DSP_SPEED.
It's kernel side of PR lib/54667.
Use record field for recording even on
SNDCTL_DSP_STEREO, SNDCTL_DSP_SETFMT, and SNDCTL_DSP_CHANNELS.
 1.74.4.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.78.6.1 20-Apr-2020  bouyer Sync with HEAD
 1.84.4.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #204):

sys/compat/sunos32/sunos32_misc.c: revision 1.86
sys/compat/ossaudio/ossaudio.c: revision 1.85
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.48

compat_sunos32: Memset zero before copyout.

Unclear if this can leak anything but let's be on the safe side.

compat_ossaudio: Zero-initialize idat before copyout.
Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

linux32_rt_sendsig: Memset zero before copyout.
Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.
 1.12 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.11 20-Dec-2007  dsl branches: 1.11.6; 1.11.8; 1.11.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.10 04-Dec-2007  dsl branches: 1.10.4;
Remove all the __P
 1.9 11-Dec-2005  christos branches: 1.9.44; 1.9.46; 1.9.52; 1.9.56;
merge ktrace-lwp.
 1.8 29-Jun-2003  fvdl branches: 1.8.2; 1.8.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.7 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.6 13-Apr-1999  augustss Make copyright conform.
 1.5 16-Oct-1997  augustss branches: 1.5.10;
Insert missing NetBSD copyright notices.
 1.4 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.3 20-Mar-1997  mycroft SOUND_PCM_WRITE_CHANNELS -> SNDCTL_DSP_CHANNELS, to match current Linux code.
 1.2 19-Mar-1997  mycroft Emulate the SOUND_PCM_WRITE_CHANNELS ioctl. From PR 3356, by Lennart
Augustsson. Also add hooks for mixer ioctls.
 1.1 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.5.10.1 16-Apr-1999  augustss branches: 1.5.10.1.2;
Make a bunch of copyright headers conform to the standard.
Pullup approved by Perry.
 1.5.10.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.18.3 21-Jan-2008  yamt sync with head
 1.8.18.2 07-Dec-2007  yamt sync with head
 1.8.18.1 21-Jun-2006  yamt sync with head.
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.9.56.2 26-Dec-2007  ad Sync with head.
 1.9.56.1 08-Dec-2007  ad Sync with head.
 1.9.52.2 27-Dec-2007  mjf Sync with HEAD.
 1.9.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.46.1 09-Jan-2008  matt sync with HEAD
 1.9.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.10.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.11.10.1 16-May-2008  yamt sync with head.
 1.11.8.1 18-May-2008  yamt sync with head.
 1.11.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.16 06-Sep-2011  jmcneill Add support for AFMT_AC3
 1.15 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.14 22-Jan-2008  jmcneill branches: 1.14.6; 1.14.8; 1.14.10;
Add ossaudio support for COMPAT_LINUX32, with help from mrg. With this
change, audio now works on amd64 with native firefox, nspluginwrapper, and
the 32-bit linux flash binaries.
 1.13 18-Sep-2007  mlelstv branches: 1.13.6; 1.13.12;
Implement OSS_SNDCTL_DSP_GETODELAY and provide a no-op function
for OSS_SNDCTL_DSP_PROFILE.
 1.12 04-Mar-2007  christos branches: 1.12.2; 1.12.14; 1.12.16;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 11-Dec-2005  christos branches: 1.11.24; 1.11.26; 1.11.30;
merge ktrace-lwp.
 1.10 26-Feb-2005  perry branches: 1.10.4;
nuke trailing whitespace
 1.9 04-Jul-2000  augustss branches: 1.9.24; 1.9.32; 1.9.34;
Implement OSS_GETVERSION.
Accept mixer values above max (100).
Handle the info from AUDIO_MIXER_DEVINFO properly, parts of it is opaque.
 1.8 19-Nov-1999  augustss branches: 1.8.4;
Fix typo in comment. From Brad <brad@openbsd.org>
 1.7 17-Nov-1999  augustss Implement OSS_SOUND_MIXER_INFO.
 1.6 13-Apr-1999  augustss branches: 1.6.2; 1.6.8;
Make copyright conform.
 1.5 07-Aug-1998  augustss branches: 1.5.6;
Add MIDI support. The MIDI devices can be accessed as ``raw'' through
the /dev/rmidiN devices, or with a sequencer interface via /dev/music.
So far the only supported MIDI device is the MPU401 port on SoundBlaster
(and only on SB on isapnp, since we do not have locators with multiple
values yet).
 1.4 16-Oct-1997  augustss Insert missing NetBSD copyright notices.
 1.3 06-Aug-1997  augustss Improve ioctl decoding.
Change mixer name mappings.
 1.2 27-Jul-1997  augustss branches: 1.2.2;
Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.1 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.2.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.6.1 16-Apr-1999  augustss branches: 1.5.6.1.2;
Make a bunch of copyright headers conform to the standard.
Pullup approved by Perry.
 1.5.6.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.8.4.1 07-Aug-2000  augustss Pull up:
sys/compat/ossaudio/ossaudio.c 1.30-1.31
sys/compat/ossaudio/ossaudiovar.h 1.7-1.9
lib/libossaudio/ossaudio.c 1.10-1.11
Accept mixer values above max (100).
Handle the info from AUDIO_MIXER_DEVINFO properly, parts of it is opaque.
Approved by thorpej.
 1.9.34.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.32.1 29-Apr-2005  kent sync with -current
 1.9.24.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.4.3 04-Feb-2008  yamt sync with head.
 1.10.4.2 27-Oct-2007  yamt sync with head.
 1.10.4.1 03-Sep-2007  yamt sync with head.
 1.11.30.1 04-Sep-2008  skrll Sync with netbsd-4.
 1.11.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.11.24.1 20-Aug-2008  bouyer Pull up following revision(s) (requested by jmcneill in ticket #1051):
sys/compat/linux32/common/linux32_ioctl.c: revision 1.10 via patch
sys/compat/ossaudio/ossaudiovar.h: revision 1.14
Add ossaudio support for COMPAT_LINUX32, with help from mrg. With this
change, audio now works on amd64 with native firefox, nspluginwrapper, and
the 32-bit linux flash binaries.
 1.12.16.2 23-Mar-2008  matt sync with HEAD
 1.12.16.1 06-Nov-2007  matt sync with HEAD
 1.12.14.1 02-Oct-2007  joerg Sync with HEAD.
 1.12.2.1 09-Oct-2007  ad Sync with head.
 1.13.12.1 23-Jan-2008  bouyer Sync with HEAD.
 1.13.6.1 18-Feb-2008  mjf Sync with HEAD.
 1.14.10.1 16-May-2008  yamt sync with head.
 1.14.8.1 18-May-2008  yamt sync with head.
 1.14.6.1 02-Jun-2008  mjf Sync with HEAD.

RSS XML Feed