devname.3 (a1de21c12e1cbebace89c9150bf41857ad1f48b0) devname.3 (0e5d513b500357d746805e564846986699670477)
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.

--- 18 unchanged lines hidden (view full) ---

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$
34.\"
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.

--- 18 unchanged lines hidden (view full) ---

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$
34.\"
35.Dd July 18, 1999
35.Dd February 22, 2005
36.Dt DEVNAME 3
37.Os
38.Sh NAME
39.Nm devname
36.Dt DEVNAME 3
37.Os
38.Sh NAME
39.Nm devname
40.Nd get device name
40.Nd "get device name"
41.Sh LIBRARY
42.Lb libc
43.Sh SYNOPSIS
44.In sys/stat.h
45.In stdlib.h
46.Ft char *
47.Fn devname "dev_t dev" "mode_t type"
48.Ft char *

--- 24 unchanged lines hidden (view full) ---

73.Fa type
74in a human-readable format.
75.Pp
76.Fn devname
77returns the name stored in a static buffer which will be overwritten
78on subsequent calls.
79.Fn devname_r
80takes a buffer and length as argument to avoid this problem.
41.Sh LIBRARY
42.Lb libc
43.Sh SYNOPSIS
44.In sys/stat.h
45.In stdlib.h
46.Ft char *
47.Fn devname "dev_t dev" "mode_t type"
48.Ft char *

--- 24 unchanged lines hidden (view full) ---

73.Fa type
74in a human-readable format.
75.Pp
76.Fn devname
77returns the name stored in a static buffer which will be overwritten
78on subsequent calls.
79.Fn devname_r
80takes a buffer and length as argument to avoid this problem.
81.Sh EXAMPLES
82.Bd -literal -compact
83int fd;
84struct stat buf;
85char *name;
86
87 fd = open("/dev/tun");
88 fstat(fd, &buf);
89 printf("devname is /dev/%s\en", devname(buf.st_rdev, S_IFCHR));
90.Ed
81.Sh SEE ALSO
82.Xr stat 2
83.Sh HISTORY
84The
85.Fn devname
86function appeared in
87.Bx 4.4 .
91.Sh SEE ALSO
92.Xr stat 2
93.Sh HISTORY
94The
95.Fn devname
96function appeared in
97.Bx 4.4 .