lkml.org 
[lkml]   [2011]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [path][rfc] add PR_DETACH prctl command [3/3]
    19.04.2011 18:58, Alan Cox wrote:
    >> The attached patch implements the PR_DETACH prctl
    >> command. It detaches the entire process group from
    >> its parent, allowing the parent to still read the detach
    >> code with normal wait(). If the process then exits, the
    >> notification of the new parent is delayed till the old parent
    >> does either wait() to read the detach code, or exits.
    > What is the use case for this and why won't existing process group
    > interfaces do the job ?
    The use case is to daemonize the process with threads.
    You first need to detach it from its parent, then use TIOCNOTTY
    ioctl to detach from the tty (TIOCNOTTY_GRP doesn't seem
    to exist too, though, but might be easy to implement).
    There are a few workarounds to that that I am aware of,
    but what exactly interfaces do you have in mind? I have
    found nothing that allows to do the same without a workarounds
    like this:
    https://lkml.org/lkml/2011/4/8/278
    The current way of detaching, which is a fork/exit combo,
    loses all threads, so, when you call daemon() and you had
    threads, you are a toast.


    \
     
     \ /
      Last update: 2011-04-19 17:11    [W:0.021 / U:91.356 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site