src/lib/libc/getwd.c:getwd()
-> src/lib/libc/getwd.c:opendirstat()
-> ...
sys/kernel/read.c:open()
-> 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
Caution: Extremely old neurons (I haven't been in the LynxOS sources for
almost 9 years)...
I seem to recall that there's some magic about currtptr->fd (maybe it's
currfd?) where at system call return, if it's not 0 / -1 / something
invalid, a freef_fd() happens automatically.
So check in the syscal return trampoline code; it might be in there.
--
Steve Watt KD6GGD PP-ASEL-IA ICBM: 121W 56' 57.5" / 37N 20' 15.3"
Internet: steve @ Watt.COM Whois: SW32-ARIN
Free time? There's no such thing. It just comes in varying prices...
Yeah, if there's an fd in use, the syscall handler automatically releases it
before returning. That's why most syscalls that getf() don't have a matching
release.
On Dec 12, 9:15 pm, Steve Watt <steve.removet...@Watt.COM> wrote: