lkml.org 
[lkml]   [1998]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Can I open a special file with major/minor instead of name?
From
Date
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

\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.038 / U:0.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site