-Pierre > On Dec 18, 2015, at 11:14 AM, Philippe Hausler via swift-corelibs-dev > <swift-corelibs-dev@swift.org> wrote: > > I would definitely say that posix_spawn is the correct path to implement > this; that will keep pretty close to the way the one on darwin works; > > Couple of suggestions: > > posix_spawnattr_setsigmask should be set to the empty signal set > > the attribute flags should probably be POSIX_SPAWN_CLOEXEC_DEFAULT | > POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSIGDEF > > You can probably skip QoS since it won’t exist on linux. > > There may be some issue with not having libdispatch to use for a source to > watch a DISPATCH_PROC_EXIT but this perhaps could be done via a pthread (not > certain on exactly how but perhaps it can be done)
No, it can’t that’s the big problem with posix_spawn() on linux, because the new task isn’t a child with this (or maybe it is on linux I don’t know) and there is no equivalent to the EVFILT_PROC which is the kevent backend for the PROC_EXIT dispatch source thing. This feature is only available through netlink on linux which is restricted to the root user. It *may* be that posix_spawn()ed things are children on linux and that a SIGCHLD source should be used instead, which means that NSTask would have to multiplex the SIGCHLD + waitpid() and route them back to the right NSTask(). > It also might be useful in this case to drop down to C similarly as > CFXMLInterface - but pick your poison on that one. > > >> On Dec 18, 2015, at 11:08 AM, Dan Stenmark via swift-corelibs-dev >> <swift-corelibs-dev@swift.org> wrote: >> >> I hope to take a crack at implementing some of NSTask this weekend. What >> are the recommended posix_spawnattr_t flags that should be set? Do we also >> want to take the opportunity to expose the ability to override some of these >> flags (like POSIX_SPAWN_SETPGROUP) or do we want to avoid tying this with >> posix_spawn() too closely? >> >> Dan >> _______________________________________________ >> swift-corelibs-dev mailing list >> swift-corelibs-dev@swift.org >> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev > > _______________________________________________ > swift-corelibs-dev mailing list > swift-corelibs-dev@swift.org > https://lists.swift.org/mailman/listinfo/swift-corelibs-dev _______________________________________________ swift-corelibs-dev mailing list swift-corelibs-dev@swift.org https://lists.swift.org/mailman/listinfo/swift-corelibs-dev