summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-02-11 20:24:59 +0000
committered <ed@FreeBSD.org>2009-02-11 20:24:59 +0000
commitde78bbbfe832781ef4718e4d175d53fbe4e7ac40 (patch)
tree0b13c353e44fe54b12f0be5c1ae687436add79ee /include
parentc1e92bfb206adffe9aca701014c9028722d1ed02 (diff)
downloadFreeBSD-src-de78bbbfe832781ef4718e4d175d53fbe4e7ac40.zip
FreeBSD-src-de78bbbfe832781ef4718e4d175d53fbe4e7ac40.tar.gz
Add two new routines: fdevname() and fdevname_r().
A more elegant way of obtaining a name of a character device by its file descriptor on FreeBSD, is to use the FIODGNAME ioctl. Because a valid file descriptor implies a file descriptor is visible in /dev, it will always resolve a valid device name. I'm adding a more friendly wrapper for this ioctl, called fdevname(). It is a lot easier to use than devname() and also has better error handling. When a device name cannot be resolved, it will just return NULL instead of a generated device name that makes no sense. Discussed with: kib
Diffstat (limited to 'include')
-rw-r--r--include/stdlib.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/stdlib.h b/include/stdlib.h
index 91be536..5c8e4e3 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -256,6 +256,8 @@ int cgetustr(char *, const char *, char **);
int daemon(int, int);
char *devname(__dev_t, __mode_t);
char *devname_r(__dev_t, __mode_t, char *, int);
+char *fdevname(int);
+char *fdevname_r(int, char *, int);
int getloadavg(double [], int);
__const char *
getprogname(void);
OpenPOWER on IntegriCloud