1Unix::Mknod(3)        User Contributed Perl Documentation       Unix::Mknod(3)
2
3
4

NAME

6       Unix::Mknod - Perl extension for mknod, major, minor, and makedev
7

SYNOPSIS

9        use Unix::Mknod qw(:all);
10        use File::stat;
11        use Fcntl qw(:mode);
12
13        $st=stat('/dev/null');
14        $major=major($st->rdev);
15        $minor=minor($st->rdev);
16
17        mknod('/tmp/special', S_IFCHR|0600, makedev($major,$minor+1));
18

DESCRIPTION

20       This module allows access to the device routines
21       major()/minor()/makedev() that may or may not be macros in .h files.
22
23       It also allows access to the mknod(2) system call.
24

FUNCTIONS

26       mknod($filename, $mode, $rdev)
27           Creates a block or character device special file named $filename.
28           Must be run as a privileged user, usually root.  Returns 0 on
29           success and -1 on failure, like "POSIX::mkfifo" does.
30
31       $major = major($rdev)
32           Returns the major number for the device special file as defined by
33           the st_rdev field from the stat(3) call.
34
35       $minor = minor($rdev)
36           Returns the minor number for the device special file as defined by
37           the st_rdev field from the stat(3) call.
38
39       $rdev = makedev($major, $minor)
40           Returns the st_rdev number for the device special file from the
41           $major and $minor numbers.
42

NOTES

44       There are 2 other perl modules that implement the mknod(2) system call,
45       but they have problems working on some platforms.  "Sys::Mknod" does
46       not work on AIX because it uses the syscall(2) generic system call
47       which AIX does not have.  "Mknod" implements S_IFIFO, which on most
48       platforms is not implemented in mknod(1), but rather mkfifo(1) (which
49       is implemented in POSIX perl module).
50
51       The perl module "File::Stat::Bits" also implements major() and minor()
52       (and a version of makedev() called dev_join).  They are done as a
53       program to get the bit masks at compile time, but if major() and
54       minor() are implemented as sub routines, the arugment could be
55       something as simple as an index to a lookup table (and thereby having
56       no decernable relation to its result).
57

BUGS

59       Running "make test" as non root will not truly test the functions, as
60       in most UNIX like OSes, mknod(2) needs to be invoked by a privelaged
61       user, usually root.
62

SEE ALSO

64       $ERRNO or $! for the specific error message.
65
66       File::Stat::Bits, Mknod, POSIX, Sys::Mknod
67
68       major(9), minor(9), mkfifo(1), mknod(8)
69
70       ftp://ftp-dev.cites.uiuc.edu/pub/Unix-Mknod
71

AUTHOR

73       Jim Pirzyk, <pirzyk@uiuc.edu>
74
76       Copyright (c) 2005-2008 University of Illinois Board of Trustees All
77       rights reserved.
78
79       Developed by: Campus Information Technologies and Educational Services,
80                     University of Illinois at Urbana-Champaign
81
82       Permission is hereby granted, free of charge, to any person obtaining a
83       copy of this software and associated documentation files (the
84       ``Software''), to deal with the Software without restriction, including
85       without limitation the rights to use, copy, modify, merge, publish,
86       distribute, sublicense, and/or sell copies of the Software, and to
87       permit persons to whom the Software is furnished to do so, subject to
88       the following conditions:
89
90       * Redistributions of source code must retain the above copyright
91         notice, this list of conditions and the following disclaimers.
92
93       * Redistributions in binary form must reproduce the above copyright
94         notice, this list of conditions and the following disclaimers in the
95         documentation and/or other materials provided with the distribution.
96
97       * Neither the names of Campus Information Technologies and Educational
98         Services, University of Illinois at Urbana-Champaign, nor the names
99         of its contributors may be used to endorse or promote products
100       derived
101         from this Software without specific prior written permission.
102
103       THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
104       EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
105       MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
106       IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
107       ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
108       CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
109       THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
110
111
112
113perl v5.36.0                      2023-01-20                    Unix::Mknod(3)
Impressum