Re: close() of active socket does not work on FreeBSD 6



[CC trimmed]

On Wed, 13 Dec 2006, David Xu wrote:

On Wednesday 13 December 2006 04:49, Daniel Eischen wrote:

Well, if threads waiting on IO are interruptable by signals,
can't we make a new signal that's only used by the kernel
and send it to all threads waiting on IO for that descriptor?
When it gets out to actually setup the signal handler, it
just resumes like it is returning from an SA_RESTART signal
handler (which according to another posting would reissue
the IO command and get EBADF).

Even if you have implemented the close() with the interruption, another
thread openning a file still can reuse the file handle immediately,
according to specifications, the lowest free file handle will be returned,
if SA_RESTART is used, the interrupted thread restart the syscall,
it will be using a wrong file, I think even if we have implemented the
feature in kernel, useland threads still has serious race to fix.

If you use a special signal that is only used for this
purpose, there is no reason you have to try the IO operation
again. You can just return EBADF.

Anyway, this was just a thought/idea. I don't mean to
argue against any of the other reasons why this isn't
a good idea.

--
DE
_______________________________________________
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: [PATCH] CodingStyle: add typedefs chapter
    ... The reason we have them for things like pte_t etc. is that there ... then by all means go ahead and use a typedef. ... New types which are identical to standard C99 types, ... covers RTL which is used frequently with assembly language in the kernel. ...
    (Linux-Kernel)
  • Re: Forth for Mac OS X Leopard (Intel) - what are the options?
    ... As I understand it even FreeBSD binaries are elf. ... If the .data section works for the kernel part of xina, ... The official way is to use linker scripts. ... For some reason a normal start address in linux32 is around ...
    (comp.lang.forth)
  • Re: SuSE: migrating tot linux software RAID?
    ... > third machine with a megaraid that crashed because of this kernel ... >> The reason that you had data loss at all... ... > I had backups and successfully restored the system after a full install. ...
    (alt.os.linux.suse)
  • Re: eradicating out of tree modules (was: : Linux Security *Module* Framework)
    ... reasons, won't ever be accepted into the mainline kernel tree, what you ... crashes of "the Linux kernel" caused by some binary-only driver. ... it's still a reason for fixing the real problem. ...
    (Linux-Kernel)
  • Re: RFT: updatedb "morning after" problem [was: Re: -mm merge plans for 2.6.23]
    ... Upon completion, it actually frees enough memory that swap-prefetch _could_ help on some boxes, while the real issue is that they should first and foremost dump GNU locate. ... I'm not saying the kernel needs to fix the software itself, but the kernel should try and keep such software from hurting the rest of the system where it can. ... (reading this thread it sometimes seems like the downside is that updatedb shouldn't cause this problem and so if you fixed updatedb there wold be no legitimate benifit, or alturnatly this patch doesn't help updatedb so there's no legitimate benifit) ... it's not that they shouldn't have been swapped out, it's that the reason they were swapped out no longer exists. ...
    (Linux-Kernel)