]> git.saurik.com Git - apple/libc.git/blob - gen/devname.3
Libc-825.24.tar.gz
[apple/libc.git] / gen / devname.3
1 .\" Copyright (c) 1993
2 .\" The Regents of the University of California. All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\" @(#)devname.3 8.2 (Berkeley) 4/29/95
33 .\" $FreeBSD: src/lib/libc/gen/devname.3,v 1.11 2001/10/01 16:08:50 ru Exp $
34 .\"
35 .Dd October 25, 2004
36 .Dt DEVNAME 3
37 .Os
38 .Sh NAME
39 .Nm devname ,
40 .Nm devname_r
41 .Nd get device name
42 .Sh LIBRARY
43 .Lb libc
44 .Sh SYNOPSIS
45 .In sys/stat.h
46 .In stdlib.h
47 .Ft char *
48 .Fo devname
49 .Fa "dev_t dev"
50 .Fa "mode_t type"
51 .Fc
52 .Ft char *
53 .Fo devname_r
54 .Fa "dev_t dev"
55 .Fa "mode_t type"
56 .Fa "char *buf"
57 .Fa "int len"
58 .Fc
59 .Sh DESCRIPTION
60 The
61 .Fn devname
62 function returns a pointer to the name of the block or character
63 device in
64 .Dq Pa /dev
65 with a device number of
66 .Fa dev ,
67 and a file type matching the one encoded in
68 .Fa type
69 which must be one of
70 .Dv S_IFBLK
71 or
72 .Dv S_IFCHR .
73 If no device matches the specified values, or no information is
74 available, NULL is returned.
75 .Pp
76 The
77 .Fn devname
78 function uses a static buffer, which will be overwritten
79 on subsequent calls.
80 The
81 .Fn devname_r
82 functions takes a buffer and length as arguments to avoid this problem.
83 .Pp
84 The traditional display for applications when no device is
85 found is the string
86 .Dq ?? .
87 .Sh SEE ALSO
88 .Xr stat 2 ,
89 .Xr dev_mkdb 8
90 .Sh HISTORY
91 The
92 .Fn devname
93 function call appeared in
94 .Bx 4.4 .