Subject: fstat() and cloned devices
To: None <tech-kern@NetBSD.org>
From: Klaus Heinz <email@example.com>
Date: 10/07/2007 16:56:20
qemu does the following in vl.c:
fd = open("/dev/tap", O_RDWR);
dev = devname(s.st_rdev, S_IFCHR);
This fails on NetBSD 3 because fstat() returns -1 and most (all?)
members of struct stat are set to 0.
I have two questions:
- How can I get the name of the cloned interface (tap1, tap2, ...)?
- Can anyone please check whether there are any other undocumented
errno values for fstat? If fstat() returns -1 errno is set to 45
(EOPNOTSUPP) which is not listed on the man page for fstat().
I tried to find the file where fstat is implemented but failed
miserably. It looks like fstat in NetBSD 3 is really fstat13 with
system call number 279, that's as far as I got.