I'm from Gaisler Research. We are trying to port Lynxos to the Leon-
sparc
platform. We have come quite far now, I can boot up, /init starts and
forks off /bin/dlsh. Here
comes the problem: the libc function getwd() goes into
a swait() when sys/kernel/read,c:close_fd() is called. Here is the
callpath:
src/lib/libc/getwd.c:getwd()
-> src/lib/libc/getwd.c

pendirstat()
-> ...
sys/kernel/read.c

pen()
-> sys/kernel/read.c:get_fd()
[ here fdentry index 5 is allocated. fdentry.users = 0 ]
sys/kernel/read.c:lseek()
-> sys/kernel/read_text.c:getf(5)
[ getf sets fdentry.users = 1 ]
-> sys/kernel/read.c:close(5)
-> sys/kernel/read.c:close_fd(5)
=> while (fdp->users != 0) { ...
if (swait(&currpptr->fdcsem, 1)) {
[ Here I enter swait ]
So here the question:
lseek() gets a fdentry and increments fdentry.users. It _doesnt
decrement_
fdentry.users on return and fdentry.users stays 1. Therefore the
following close() waits
on fdentry.users that is 1.
How is this supposed to work?
I cannot see a call to freef_fd() somewhere in the code. I suppost
that lseek should
call freef_fd() on return. What am I making wrong here ... ?
I'd apreciate your help.
-- Konrad