summaryrefslogtreecommitdiff
path: root/distrib/special/disknames/disknames.c
diff options
context:
space:
mode:
Diffstat (limited to 'distrib/special/disknames/disknames.c')
-rw-r--r--distrib/special/disknames/disknames.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/distrib/special/disknames/disknames.c b/distrib/special/disknames/disknames.c
new file mode 100644
index 00000000000..bc7de9b3096
--- /dev/null
+++ b/distrib/special/disknames/disknames.c
@@ -0,0 +1,23 @@
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/malloc.h>
+
+#include <stdlib.h>
+
+int
+main() {
+ int mib[2];
+ size_t len;
+ char *p;
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_DISKNAMES;
+
+ if (sysctl(mib, 2, NULL, &len, NULL, 0) != -1)
+ if ((p = (char *)malloc(len)) != NULL)
+ if (sysctl(mib, 2, p, &len, NULL, 0) != -1) {
+ write(1, p, len);
+ _exit(0);
+ }
+ _exit(1);
+}