=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sndiod/siofile.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- src/usr.bin/sndiod/siofile.c 2020/02/26 13:53:58 1.18 +++ src/usr.bin/sndiod/siofile.c 2020/04/24 11:33:28 1.19 @@ -1,4 +1,4 @@ -/* $OpenBSD: siofile.c,v 1.18 2020/02/26 13:53:58 ratchov Exp $ */ +/* $OpenBSD: siofile.c,v 1.19 2020/04/24 11:33:28 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * @@ -42,6 +42,8 @@ void dev_sio_run(void *); void dev_sio_hup(void *); +extern struct fileops dev_sioctl_ops; + struct fileops dev_sio_ops = { "sio", dev_sio_pollfd, @@ -256,6 +258,10 @@ d->mode &= ~MODE_REC; sio_onmove(d->sio.hdl, dev_sio_onmove, d); d->sio.file = file_new(&dev_sio_ops, d, "dev", sio_nfds(d->sio.hdl)); + if (d->sioctl.hdl) { + d->sioctl.file = file_new(&dev_sioctl_ops, d, "mix", + sioctl_nfds(d->sioctl.hdl)); + } timo_set(&d->sio.watchdog, dev_sio_timeout, d); dev_sioctl_open(d); return 1; @@ -321,8 +327,8 @@ timo_del(&d->sio.watchdog); file_del(d->sio.file); sio_close(d->sio.hdl); - dev_sioctl_close(d); if (d->sioctl.hdl) { + file_del(d->sioctl.file); sioctl_close(d->sioctl.hdl); d->sioctl.hdl = NULL; } @@ -341,6 +347,10 @@ d->sio.hdl = hdl; d->sioctl.hdl = ctlhdl; d->sio.file = file_new(&dev_sio_ops, d, "dev", sio_nfds(hdl)); + if (d->sioctl.hdl) { + d->sioctl.file = file_new(&dev_sioctl_ops, d, "mix", + sioctl_nfds(ctlhdl)); + } sio_onmove(hdl, dev_sio_onmove, d); return 1; bad_close: @@ -364,6 +374,7 @@ file_del(d->sio.file); sio_close(d->sio.hdl); if (d->sioctl.hdl) { + file_del(d->sioctl.file); sioctl_close(d->sioctl.hdl); d->sioctl.hdl = NULL; }