tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

procfs files vs symlink



Hello
I'm trying to get a linux binary to run on NetBSD, as stated in this thread
http://mail-index.netbsd.org/current-users/2022/01/06/msg041891.html

Now I hit an issue where the linux process does a readlink() on a procfs
file and gets EINVAL.
It seems that this is because, on linux all files in /proc/<pid>/fd/ are
symlinks, while on NetBSD they are some kind of hard links.
E.g. on linux:
bip:/dsk/l1/misc/bouyer/HEAD/clean/src>ls -l /proc/$$/fd/
total 0
lr-x------ 1 bouyer ita-iatos 64 Jan  7 14:13 0 -> /dev/null
lr-x------ 1 bouyer ita-iatos 64 Jan  7 14:13 1 -> /dev/null
lrwx------ 1 bouyer ita-iatos 64 Jan  7 15:16 15 -> /dev/pts/11
lrwx------ 1 bouyer ita-iatos 64 Jan  7 14:13 16 -> /dev/pts/11
lrwx------ 1 bouyer ita-iatos 64 Jan  7 15:16 17 -> /dev/pts/11
lrwx------ 1 bouyer ita-iatos 64 Jan  7 15:16 18 -> /dev/pts/11
lrwx------ 1 bouyer ita-iatos 64 Jan  7 15:16 19 -> /dev/pts/11
lr-x------ 1 bouyer ita-iatos 64 Jan  7 14:13 2 -> /dev/null

On NetBSD:
armandeche:/local/armandeche1/bouyer>/emul/linux/bin/ls -l /proc/$$/fd/
total 0
crw--w---- 1 bouyer tty 3, 13 Jan  7 15:19 15
crw--w---- 1 bouyer tty 3, 13 Jan  7 15:19 16
crw--w---- 1 bouyer tty 3, 13 Jan  7 15:19 17

Any idea on how to properly fix it ?

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index