OpenBSD CVS

CVS log for src/usr.bin/sndiod/sock.c


[BACK] Up to [local] / src / usr.bin / sndiod

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.47 / (download) - annotate - [select for diffs], Mon Dec 26 19:16:03 2022 UTC (16 months, 3 weeks ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, HEAD
Changes since 1.46: +2 -2 lines
Diff to previous 1.46 (colored)

spelling fixes; from paul tagliamonte
amendments to his diff are noted on tech

Revision 1.46 / (download) - annotate - [select for diffs], Fri Apr 29 08:30:48 2022 UTC (2 years ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.45: +2 -2 lines
Diff to previous 1.45 (colored)

Add sio_flush(3) function to stop playback immediately

The new sio_flush(3) functions works the same way as sio_stop(3),
except that it doesn't wait for play buffer to be drained. Instead,
it discards its contents and returns immediately.

Revision 1.45 / (download) - annotate - [select for diffs], Mon Nov 1 14:43:25 2021 UTC (2 years, 6 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.44: +68 -32 lines
Diff to previous 1.44 (colored)

Stop binding audio devices exposed by sndiod to physical devices

This a shift towards a new model: clients connect to logical devices
(created with -s option) then the server routes data to/from the
underlying physical device (registered with -f option). The binding
may be changed at run-time with the server.device control exposed by
sndioctl(1).

As audio devices exposed by sndiod(8) are not bound to fixed physical
devices anymore, the physical audio device number component of
sndio(7) descriptors was removed.

fixes, help from and ok denis, edd

Revision 1.44 / (download) - annotate - [select for diffs], Wed Mar 3 10:19:06 2021 UTC (3 years, 2 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (colored)

sndiod: Move MTC/MMC state to its own global structure

Revision 1.43 / (download) - annotate - [select for diffs], Wed Mar 3 10:13:06 2021 UTC (3 years, 2 months ago) by ratchov
Branch: MAIN
Changes since 1.42: +5 -2 lines
Diff to previous 1.42 (colored)

sndiod: Move MIDI control endpoint to opt structure

No behavior change.

Revision 1.42 / (download) - annotate - [select for diffs], Wed Mar 3 10:00:27 2021 UTC (3 years, 2 months ago) by ratchov
Branch: MAIN
Changes since 1.41: +31 -15 lines
Diff to previous 1.41 (colored)

sndiod: Move controls out of the device structure

Moving to a global server-wide controls list is necessary to expose
controls that are not associated to a particular device (ex. a device
selector).

The current hack to use the device-side sioctl_desc->addr variable as
client-side key can't work anymore. So, we use a unique dynamically
allocated ctl->addr key; this is much cleaner. A new "scope" enum
(with two "void *" arguments) is used to determine what the control
does control. This adds flexibility and allows to easily add new
control types that are not associated to devices.

No behavior change.

Revision 1.41 / (download) - annotate - [select for diffs], Fri Jan 29 11:38:23 2021 UTC (3 years, 3 months ago) by ratchov
Branch: MAIN
Changes since 1.40: +5 -5 lines
Diff to previous 1.40 (colored)

Make audio clients use struct opt to reach the device

No behavior change. This decreases the number of explicit references
to the dev structure

Revision 1.40 / (download) - annotate - [select for diffs], Fri Jan 29 11:36:44 2021 UTC (3 years, 3 months ago) by ratchov
Branch: MAIN
Changes since 1.39: +9 -6 lines
Diff to previous 1.39 (colored)

Make control clients use struct opt to reach the device

No behavior change. This decreases the number of explicit references
to the dev structure.

Revision 1.39 / (download) - annotate - [select for diffs], Fri Jan 29 11:31:28 2021 UTC (3 years, 3 months ago) by ratchov
Branch: MAIN
Changes since 1.38: +4 -4 lines
Diff to previous 1.38 (colored)

Rename ctlslot->mask to ctlslot->self to match the rest of the code

No binary change.

Revision 1.38 / (download) - annotate - [select for diffs], Fri Jan 29 10:55:19 2021 UTC (3 years, 3 months ago) by ratchov
Branch: MAIN
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

Move the control client state out of the device structure

No behavior change. Later this will ease changing the controlled
device by "just" swapping pointers.

Revision 1.37 / (download) - annotate - [select for diffs], Fri Jan 29 10:51:24 2021 UTC (3 years, 3 months ago) by ratchov
Branch: MAIN
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

Move the audio clients state out of the device structure

No behavior change. Later this will ease moving clients from one
device to another by "just" swapping pointers.

Revision 1.36 / (download) - annotate - [select for diffs], Thu Jan 28 11:15:31 2021 UTC (3 years, 3 months ago) by ratchov
Branch: MAIN
Changes since 1.35: +2 -2 lines
Diff to previous 1.35 (colored)

Dont attempt to drain disconnected clients

Clients are always drained before they disconnect, so this change
affects programs that die unexpectedly or loose thier network
connection.

Besides the bad style, this change fixes a theoretical bug when the
disconnected client slot could be recycled and given to another client
while it's being drained

Revision 1.35 / (download) - annotate - [select for diffs], Sun Apr 26 14:13:22 2020 UTC (4 years ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.34: +16 -3 lines
Diff to previous 1.34 (colored)

Bypass authentication and create no session for root

ok deraadt

Revision 1.34 / (download) - annotate - [select for diffs], Sat Apr 25 05:03:54 2020 UTC (4 years ago) by ratchov
Branch: MAIN
Changes since 1.33: +10 -1 lines
Diff to previous 1.33 (colored)

Get a reference to the device when "snd/N" MIDI ports are opened

As the master output level control is not in software any longer the
device needs to opened for adjustments to work.

Revision 1.33 / (download) - annotate - [select for diffs], Sun Mar 8 14:52:20 2020 UTC (4 years, 2 months ago) by ratchov
Branch: MAIN
Changes since 1.32: +15 -4 lines
Diff to previous 1.32 (colored)

Don't forget to notify clients when controls list is ready.

This is needed because when devices are swapped, clients need to know
when to rebuild their user interface.

Revision 1.32 / (download) - annotate - [select for diffs], Wed Feb 26 13:53:58 2020 UTC (4 years, 2 months ago) by ratchov
Branch: MAIN
Changes since 1.31: +231 -3 lines
Diff to previous 1.31 (colored)

Add API to control audio device parameters exposed by sndiod.

The API exposes controls of modern audio hardware and sndiod software
volume knobs in a uniform way.  Hardware knobs are exposed through
sndiod.  Multiple programs may use the controls at the same time
without the need to continuously scan the controls.

For now sndiod exposes only its own controls and the master output and
input volumes of the underlying hardware (if any), i.e. those
typically exposed by acpi volume keys.

ok deraadt

Revision 1.31 / (download) - annotate - [select for diffs], Fri Jul 12 06:30:55 2019 UTC (4 years, 10 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.30: +4 -2 lines
Diff to previous 1.30 (colored)

Add affinity between the program and its mixer control.

Currently, if there are two instances of the same program, sndiod will
allocate one volume control to each. If both programs disconnect and
reconnect, the information of which control is assigned to which
program is lost. This makes difficult to run two instances of a player
and crossfade between each other with a MIDI controller.

To address this, the program chooses a 32-bit "id" (for now the
process pid) and sends it to the server. The server records the id in
the client's slot structure.  When the server accepts a new
connection, it uses the id to identify the slot the client used during
the previous connection; if it was not recycled yet, it's assigned to
the program.

Revision 1.30 / (download) - annotate - [select for diffs], Sat Jun 29 21:23:18 2019 UTC (4 years, 10 months ago) by ratchov
Branch: MAIN
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored)

Check if syscalls return -1 instead of any negative or non-zero value.

ok deraadt

Revision 1.29 / (download) - annotate - [select for diffs], Tue Jun 26 07:39:59 2018 UTC (5 years, 10 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.28: +3 -17 lines
Diff to previous 1.28 (colored)

Move slot-related debug printfs from sock_hello() to slot_new().

Revision 1.28 / (download) - annotate - [select for diffs], Tue Jun 26 07:36:27 2018 UTC (5 years, 10 months ago) by ratchov
Branch: MAIN
Changes since 1.27: +11 -15 lines
Diff to previous 1.27 (colored)

Convert all the slot_xxx() routines to use the number of channels
instead of the maximum channel number. This way the code is simpler.
No behaviour change.

Revision 1.27 / (download) - annotate - [select for diffs], Tue Jun 26 07:31:29 2018 UTC (5 years, 10 months ago) by ratchov
Branch: MAIN
Changes since 1.26: +7 -7 lines
Diff to previous 1.26 (colored)

Remove {mix,sub}.slot_cmin fields from the slot structure, as the same
information is already available in the opt structure.

Revision 1.26 / (download) - annotate - [select for diffs], Tue Jun 26 07:30:26 2018 UTC (5 years, 10 months ago) by ratchov
Branch: MAIN
Changes since 1.25: +5 -7 lines
Diff to previous 1.25 (colored)

Remove dev_{cmin,cmax} from the slot structure as the same information
is available in the opt structure.

Revision 1.25 / (download) - annotate - [select for diffs], Tue Jun 26 07:20:37 2018 UTC (5 years, 10 months ago) by ratchov
Branch: MAIN
Changes since 1.24: +1 -5 lines
Diff to previous 1.24 (colored)

Don't set slot's {slot,dev}_cmin parameters in slot_setpar() routine,
as their value doesn't change once the slot is initialized.

Revision 1.24 / (download) - annotate - [select for diffs], Tue Jun 26 07:15:17 2018 UTC (5 years, 10 months ago) by ratchov
Branch: MAIN
Changes since 1.23: +2 -31 lines
Diff to previous 1.23 (colored)

Initialize slot with parameters from the opt struct.

Revision 1.23 / (download) - annotate - [select for diffs], Tue Jun 26 07:13:54 2018 UTC (5 years, 10 months ago) by ratchov
Branch: MAIN
Changes since 1.22: +24 -23 lines
Diff to previous 1.22 (colored)

Move opt pointer from the sock to the slot struct.

Revision 1.22 / (download) - annotate - [select for diffs], Tue Jun 26 07:12:35 2018 UTC (5 years, 10 months ago) by ratchov
Branch: MAIN
Changes since 1.21: +7 -4 lines
Diff to previous 1.21 (colored)

Replace the gloal opt list with per-device lists.

Revision 1.21 / (download) - annotate - [select for diffs], Wed Jan 10 09:05:48 2018 UTC (6 years, 4 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.20: +3 -3 lines
Diff to previous 1.20 (colored)

Simplify bounds checking of client numbers of channels and rate. From
Michael W. Bombardieri, thanks.

Revision 1.20 / (download) - annotate - [select for diffs], Thu Jul 20 10:26:27 2017 UTC (6 years, 10 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.19: +9 -0 lines
Diff to previous 1.19 (colored)

Add comments to explain correct code that might look wrong.

Revision 1.19 / (download) - annotate - [select for diffs], Thu Oct 27 04:37:47 2016 UTC (7 years, 6 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

Fix many typos in comments, from Michael W. Bombardieri <mb at ii.net>

Revision 1.18 / (download) - annotate - [select for diffs], Wed Mar 23 06:16:35 2016 UTC (8 years, 1 month ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

Remove unused arguments of dev_adjpar(), getbasepath() and all
slotops->onvol() implementations. From David CARLIER <devnexen at
gmail.com>. Thanks.

Revision 1.17 / (download) - annotate - [select for diffs], Fri Jan 8 16:17:31 2016 UTC (8 years, 4 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.16: +6 -6 lines
Diff to previous 1.16 (colored)

Make code fit in 80 columns, remove trailing spaces & tabs.

Revision 1.16 / (download) - annotate - [select for diffs], Mon Dec 7 11:58:29 2015 UTC (8 years, 5 months ago) by ratchov
Branch: MAIN
Changes since 1.15: +2 -1 lines
Diff to previous 1.15 (colored)

reset the slowaccept flag in sock_close()

Revision 1.15 / (download) - annotate - [select for diffs], Mon Feb 16 06:35:17 2015 UTC (9 years, 3 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.14: +14 -13 lines
Diff to previous 1.14 (colored)

Check if slot is NULL, and if so, drop the connection. For now slot
is never NULL, but this is an accident.

Revision 1.14 / (download) - annotate - [select for diffs], Fri Nov 21 09:05:38 2014 UTC (9 years, 5 months ago) by ratchov
Branch: MAIN
Changes since 1.13: +2 -1 lines
Diff to previous 1.13 (colored)

Don't forget to transmit the xrun attribute in GETPAR messages. Found
by stu@, thanks.

Revision 1.13 / (download) - annotate - [select for diffs], Mon Jun 2 07:54:23 2014 UTC (9 years, 11 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.12: +2 -1 lines
Diff to previous 1.12 (colored)

fix uninitialized sock->port variable, causing crashes in certain
error handling code paths (ex. wrong/unsupported mode).

Revision 1.12 / (download) - annotate - [select for diffs], Fri Mar 7 10:23:05 2014 UTC (10 years, 2 months ago) by ratchov
Branch: MAIN
Changes since 1.11: +3 -3 lines
Diff to previous 1.11 (colored)

remove unused "delta" argument from onmove callbacks

Revision 1.11 / (download) - annotate - [select for diffs], Fri Mar 7 10:15:39 2014 UTC (10 years, 2 months ago) by ratchov
Branch: MAIN
Changes since 1.10: +1 -46 lines
Diff to previous 1.10 (colored)

remove unused mmc start/stop/relocate call-backs as they don't
make sense for clients and are handled through midi anyway

Revision 1.10 / (download) - annotate - [select for diffs], Wed Mar 5 20:04:21 2014 UTC (10 years, 2 months ago) by ratchov
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored)

Check that socket is writable before attempting to write data
packets.

Revision 1.9 / (download) - annotate - [select for diffs], Sat Feb 8 15:15:31 2014 UTC (10 years, 3 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.8: +4 -2 lines
Diff to previous 1.8 (colored)

use the correct integer width in calls to  AMSG_ISSET()

Revision 1.8 / (download) - annotate - [select for diffs], Tue Dec 31 12:24:55 2013 UTC (10 years, 4 months ago) by ratchov
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

round client block size to nearest possble

Revision 1.7 / (download) - annotate - [select for diffs], Mon Nov 18 17:37:45 2013 UTC (10 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.6: +26 -25 lines
Diff to previous 1.6 (colored)

add missing prototypes

Revision 1.6 / (download) - annotate - [select for diffs], Sun May 5 20:42:53 2013 UTC (11 years ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.5: +9 -10 lines
Diff to previous 1.5 (colored)

Initialize channel ranges of new slots to full sub-device channels.
Fixes wrong channel mappings when the client specifies no channels.
Found by Dimitri Sokolyuk <sokolyuk at gmail.com>, thanks!

Revision 1.5 / (download) - annotate - [select for diffs], Thu Dec 6 08:13:04 2012 UTC (11 years, 5 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

set port = NULL for new connctions, fixes crashes
found by brad

Revision 1.4 / (download) - annotate - [select for diffs], Sat Dec 1 12:13:34 2012 UTC (11 years, 5 months ago) by ratchov
Branch: MAIN
Changes since 1.3: +1 -7 lines
Diff to previous 1.3 (colored)

remove misleading XXXs and TODOs

Revision 1.3 / (download) - annotate - [select for diffs], Fri Nov 30 20:48:00 2012 UTC (11 years, 5 months ago) by ratchov
Branch: MAIN
Changes since 1.2: +8 -2 lines
Diff to previous 1.2 (colored)

For MIDI ports, use the same open/close logic as for audio devices:
drop clients using it when the port is closed (eg. umidi disconnected)
and try to reopen it whenever a new client connects.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Nov 30 20:30:24 2012 UTC (11 years, 5 months ago) by ratchov
Branch: MAIN
Changes since 1.1: +13 -16 lines
Diff to previous 1.1 (colored)

Process incoming MIDI data on the fly rather than using an
input fifo; besides being simpler, this way there's no data
to drain when a connection is dropped.

Revision 1.1 / (download) - annotate - [select for diffs], Fri Nov 23 07:03:28 2012 UTC (11 years, 5 months ago) by ratchov
Branch: MAIN

Remplace aucat server by a new sndiod daemon aimed to be simpler
smaller and faster than aucat. It's a drop in replacement with the
following exceptions that don't affect the default setup:
  - The sample rate and the encoding are a per-device parameters
    thus -r and -e options must precede the corresponding -f option
  - MIDI thru boxes are dynamically created and no -M option
    is required anymore, so -M was removed.
  - MIDI ports are exposed with a new ``midi/N'' name, rather
    than abusing MIDI thru boxes.
with help from armani@, ok deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.