aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--LICENSE2
-rw-r--r--README6
-rw-r--r--alsause.18
-rw-r--r--alsause.c30
4 files changed, 37 insertions, 9 deletions
diff --git a/LICENSE b/LICENSE
index fccd785..46cd895 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
ISC License
-© 2024 Mattias Andrée <maandree@kth.se>
+© 2024, 2025 Mattias Andrée <m@maandree.se>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/README b/README
index 41f9516..3ced5d4 100644
--- a/README
+++ b/README
@@ -8,7 +8,7 @@ DESCRIPTION
The alsause utility lists all ALSA PCM devices or sets, either for the
user or for a program it starts, the default ALSA PCM device.
- No options or operands are specified, alsause will list all ALSA PCM
+ If no options or operands are specified, alsause will list all ALSA PCM
devices, otherwise it will set the default ALSA PCM device.
If command is specified, alsause will run that command with the default
@@ -24,7 +24,7 @@ OPTIONS
to the system-wide default ALSA PCM device.
OPERANDS
- The following operands shall be supported:
+ The following operands are supported:
card:device
The card number and device number to use as the default ALSA PCM
@@ -55,4 +55,4 @@ EXIT STATUS
127 The utility specified by command could not be found.
SEE ALSO
- None.
+ galsause(1)
diff --git a/alsause.1 b/alsause.1
index d433d58..e3cb3eb 100644
--- a/alsause.1
+++ b/alsause.1
@@ -17,7 +17,7 @@ utility lists all ALSA PCM devices or
sets, either for the user or for a program
it starts, the default ALSA PCM device.
.PP
-No options or operands are specified,
+If no options or operands are specified,
.B alsause
will list all ALSA PCM devices, otherwise
it will set the default ALSA PCM device.
@@ -41,7 +41,7 @@ The following option is supported:
Remove the user-specified default ALSA PCM device,
falling back to the system-wide default ALSA PCM device.
.SH OPERANDS
-The following operands shall be supported:
+The following operands are supported:
.TP
.IR card : device
The card number and device number to use as the default
@@ -94,7 +94,7 @@ Otherwise, the
.B alsause
utility does not write to standard output.
.SH STDERR
-The standard error shall be used only for diagnostic messages.
+The standard error is only used for diagnostic messages.
.SH OUTPUT FILES
If the the default ALSA PCM device is set, the
.B alsause
@@ -134,4 +134,4 @@ The utility specified by
.I command
could not be found.
.SH SEE ALSO
-None.
+.BR galsause (1)
diff --git a/alsause.c b/alsause.c
index e157e71..5cb923d 100644
--- a/alsause.c
+++ b/alsause.c
@@ -1,5 +1,15 @@
/* See LICENSE file for copyright and license details. */
#include <sys/mount.h>
+#ifndef OPEN_TREE_CLONE
+# define MISSING_OPEN_TREE
+#endif
+#ifndef MOVE_MOUNT_F_EMPTY_PATH
+# define MISSING_MOVE_MOUNT
+#endif
+#if defined(MISSING_OPEN_TREE) || defined(MISSING_MOVE_MOUNT)
+# include <linux/mount.h>
+# include <sys/syscall.h>
+#endif
#include <sched.h>
#include <alsa/asoundlib.h>
#include <libsimple.h>
@@ -8,6 +18,24 @@
NUSAGE(125, "[(-r | name | card:device) [command [argument] ...]]");
+#ifdef MISSING_OPEN_TREE
+static int
+open_tree(int dirfd, const char *path, int flags)
+{
+ return syscall(SYS_open_tree, dirfd, path, flags);
+}
+#endif
+
+
+#ifdef MISSING_MOVE_MOUNT
+static int
+move_mount(int dirfd1, const char *path1, int dirfd2, const char *path2, int flags)
+{
+ return syscall(SYS_move_mount, dirfd1, path1, dirfd2, path2, flags);
+}
+#endif
+
+
static char *
get_config_path(void)
{
@@ -277,7 +305,7 @@ main(int argc, char *argv[])
treefd = open_tree(AT_FDCWD, temppath, OPEN_TREE_CLONE | OPEN_TREE_CLOEXEC);
if (treefd < 0) {
- weprintf("open_tree AT_FDCWD %s OPEN_TREE_CLONE:", temppath);
+ weprintf("open_tree AT_FDCWD %s OPEN_TREE_CLONE|OPEN_TREE_CLOEXEC:", temppath);
unlink(temppath);
exit(libsimple_default_failure_exit);
}