diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2024-04-22 10:39:52 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2024-04-22 10:39:52 +0000 |
commit | 218d835fae80ba49bee60f8fa577310b740a42aa (patch) | |
tree | c338d068b5d1aad10badd5413bc842dbceccacf5 /usr.bin/sndiod | |
parent | 9dca7c9c9f7e306c3ec74896def24c88a4c4539c (diff) |
sndiod: Return the number of controls ctl_del() has deleted.
Diffstat (limited to 'usr.bin/sndiod')
-rw-r--r-- | usr.bin/sndiod/dev.c | 9 | ||||
-rw-r--r-- | usr.bin/sndiod/dev.h | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/sndiod/dev.c b/usr.bin/sndiod/dev.c index 235b6d5d56a..7eaf83dcc8e 100644 --- a/usr.bin/sndiod/dev.c +++ b/usr.bin/sndiod/dev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev.c,v 1.108 2024/04/02 05:21:32 ratchov Exp $ */ +/* $OpenBSD: dev.c,v 1.109 2024/04/22 10:39:51 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -2601,16 +2601,18 @@ ctl_onval(int scope, void *arg0, void *arg1, int val) return 1; } -void +int ctl_del(int scope, void *arg0, void *arg1) { struct ctl *c, **pc; + int found; + found = 0; pc = &ctl_list; for (;;) { c = *pc; if (c == NULL) - return; + return found; if (ctl_match(c, scope, arg0, arg1)) { #ifdef DEBUG if (log_level >= 2) { @@ -2618,6 +2620,7 @@ ctl_del(int scope, void *arg0, void *arg1) log_puts(": removed\n"); } #endif + found++; c->refs_mask &= ~CTL_DEVMASK; if (c->refs_mask == 0) { *pc = c->next; diff --git a/usr.bin/sndiod/dev.h b/usr.bin/sndiod/dev.h index 29aee9173c0..aeadb0ec9f8 100644 --- a/usr.bin/sndiod/dev.h +++ b/usr.bin/sndiod/dev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dev.h,v 1.43 2022/12/26 19:16:03 jmc Exp $ */ +/* $OpenBSD: dev.h,v 1.44 2024/04/22 10:39:51 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -352,7 +352,7 @@ void slot_detach(struct slot *); struct ctl *ctl_new(int, void *, void *, int, char *, char *, int, char *, char *, int, int, int); -void ctl_del(int, void *, void *); +int ctl_del(int, void *, void *); void ctl_log(struct ctl *); int ctl_setval(struct ctl *c, int val); int ctl_match(struct ctl *, int, void *, void *); |