Re: thread rant

From: Jamie Lokier (lk@tantalophile.demon.co.uk)
Date: Sat Sep 02 2000 - 09:38:14 EDT

  • Next message: Rasmus Andersen: "Re: [patchlet] Removing unneeded line in vmtruncate() (2.4.0-t8p1)"

    dean gaudet wrote:
    > an example of brokenness in the traditional fd API is close-on-exec --
    > there's a race between open()/socket()/pipe() and fcntl(FD_CLOEXEC) during
    > which if another thread does a fork() it's possible the child will inherit
    > an fd it shouldn't... working around it is painful. the model which
    > NT/OS2 use for creating a new process scales better in the 99.99% case of
    > stdin/out/err -- you only specify those fds you want to keep in the new
    > process.

    An obvious solution presents itself. O_CLOEXEC.

    Glibc could easily be made to call fcntl(FD_CLOEXEC) for kernels that
    don't implement O_CLOEXEC, so that applications can simply use the flag
    and rely on it.

    -- Jamie
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Sat Sep 02 2000 - 09:40:19 EDT