svn commit: r198714 - head/sbin/mknod
Ed Schouten
ed at 80386.nl
Sat Oct 31 18:54:45 UTC 2009
Hello Christian,
* Christian Brueffer <brueffer at FreeBSD.org> wrote:
> The majors file was removed long ago, 0 should be used instead.
It's a bit more complex than that. Right now devices are automatically
numbered, using a 32-bits integer. The following macros are used to
obtain the minor and major numbers (see <sys/types.h>):
| #define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
| #define minor(x) ((int)((x)&0xffff00ff)) /* minor number */
This means that a device number above 255 may (or may not) have a
non-zero major number. Just run the following code:
| #include <fcntl.h>
| #include <stdlib.h>
| #include <unistd.h>
|
| int
| main(int argc, char *argv[])
| {
|
| while (posix_openpt(O_RDWR|O_NOCTTY) >= 0);
| sleep(30);
| return (0);
| }
On my system it even generates device nodes in /dev/pts with a major
number of 4. I wrote a manpage for these macros some time ago. See
makedev(3).
--
Ed Schouten <ed at 80386.nl>
WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20091031/1b08b46a/attachment.pgp
More information about the svn-src-head
mailing list