]> git.saurik.com Git - apple/libc.git/blame - gen/devname.3
Libc-763.11.tar.gz
[apple/libc.git] / gen / devname.3
CommitLineData
5b2abdfb 1.\" Copyright (c) 1993
e9ce8d39
A
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.\"
5b2abdfb
A
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 $
e9ce8d39 34.\"
3d9156a7 35.Dd October 25, 2004
5b2abdfb 36.Dt DEVNAME 3
e9ce8d39
A
37.Os
38.Sh NAME
224c7076
A
39.Nm devname ,
40.Nm devname_r
5b2abdfb 41.Nd get device name
e9ce8d39
A
42.Sh LIBRARY
43.Lb libc
44.Sh SYNOPSIS
5b2abdfb
A
45.In sys/stat.h
46.In stdlib.h
47.Ft char *
224c7076
A
48.Fo devname
49.Fa "dev_t dev"
50.Fa "mode_t type"
51.Fc
3d9156a7 52.Ft char *
224c7076
A
53.Fo devname_r
54.Fa "dev_t dev"
55.Fa "mode_t type"
56.Fa "char *buf"
57.Fa "int len"
58.Fc
e9ce8d39
A
59.Sh DESCRIPTION
60The
5b2abdfb
A
61.Fn devname
62function returns a pointer to the name of the block or character
63device in
64.Dq Pa /dev
65with a device number of
66.Fa dev ,
67and a file type matching the one encoded in
68.Fa type
3d9156a7
A
69which must be one of
70.Dv S_IFBLK
71or
72.Dv S_IFCHR .
5b2abdfb
A
73If no device matches the specified values, or no information is
74available, NULL is returned.
75.Pp
3d9156a7
A
76The
77.Fn devname
78function uses a static buffer, which will be overwritten
79on subsequent calls.
80The
81.Fn devname_r
82functions takes a buffer and length as arguments to avoid this problem.
83.Pp
5b2abdfb
A
84The traditional display for applications when no device is
85found is the string
86.Dq ?? .
e9ce8d39 87.Sh SEE ALSO
5b2abdfb
A
88.Xr stat 2 ,
89.Xr dev_mkdb 8
e9ce8d39
A
90.Sh HISTORY
91The
5b2abdfb
A
92.Fn devname
93function call appeared in
e9ce8d39 94.Bx 4.4 .