On Thu, Oct 22, 2015 at 05:44:58AM +0100, Al Viro wrote: > Except that in this case "correctness" is the matter of rather obscure and > ill-documented areas in POSIX. Don't get me wrong - this semantics isn't > inherently bad, but it's nowhere near being an absolute requirement.
PS: in principle, a fairly ugly trick might suffice for accept(2), but I'm less than happy with going there. Namely, we could * have ->accept() get descriptor number * have ->flush() get descriptor number in addition to current->files and have it DTRT for sockets in the middle of accept(2). However, in addition to being ugly as hell, it has the problem with the points where we call ->flush(), specifically do_dup2() and __close_fd(). It's done *after* the replacement/removal from descriptor table, so another socket might have already gotten the same descriptor and we'd get spurious termination of accept(2). And I'm really curious about the things Solaris would do with dup2() there. Does it take into account the possibility of new accept() coming just as dup2() is trying to terminate the ongoing ones? Is there a window when descriptor-to-file lookups would fail? Looks like a race/deadlock country... -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html