Re: Can I open a special file with major/minor instead of name?

Andi Kleen (ak@muc.de)
14 Jun 1998 11:49:26 +0200


Dave Cinege <dcinege@psychosis.com> writes:

> This is the code in do_linuxrc():
>
> (void) open("/dev/tty1",O_RDWR,0);
>
> This is what I want to do:
>
> (void) open( MKDEV(TTY_MAJOR,1) ,O_RDWR,0);

char *dev = mktemp(TEMPPATH "/devXXXXXX");
mknod(dev, 0600, MKDEV(TTY_MAJOR));
open(dev, O_RDWR, 0);
unlink(dev);

Yes, this is a temp race, but I don't think that is a big problem inside
linuxrc. If you want to avoid it create a not world writable directory
first.

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu