diff options
author | Ed Schouten <ed@FreeBSD.org> | 2009-02-11 20:24:59 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2009-02-11 20:24:59 +0000 |
commit | 26d4f5e969a5850cbb0b2344835d515c368d5652 (patch) | |
tree | 0b13c353e44fe54b12f0be5c1ae687436add79ee /include/stdlib.h | |
parent | 73bac36f82989987e21b669b627a827383ae9224 (diff) | |
download | src-test2-26d4f5e969a5850cbb0b2344835d515c368d5652.tar.gz src-test2-26d4f5e969a5850cbb0b2344835d515c368d5652.zip |
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
Notes
Notes:
svn path=/head/; revision=188497
Diffstat (limited to 'include/stdlib.h')
-rw-r--r-- | include/stdlib.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/stdlib.h b/include/stdlib.h index 91be536668b7..5c8e4e363ef0 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); |