From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 3A53C469719 for ; Tue, 3 Mar 2020 14:45:40 +0300 (MSK) Received: by mail-lj1-f194.google.com with SMTP id f10so1311944ljn.6 for ; Tue, 03 Mar 2020 03:45:40 -0800 (PST) Date: Tue, 3 Mar 2020 14:45:37 +0300 From: Cyrill Gorcunov Message-ID: <20200303114537.GF22649@uranus> References: <20200302201227.31785-1-gorcunov@gmail.com> <20200302201227.31785-7-gorcunov@gmail.com> <20200303113853.2gmoaph7zet7rzwo@tkn_work_nb> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200303113853.2gmoaph7zet7rzwo@tkn_work_nb> Subject: Re: [Tarantool-patches] [PATCH 6/7] popen: handle setsid os specifics List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Turenko Cc: tml On Tue, Mar 03, 2020 at 02:38:53PM +0300, Alexander Turenko wrote: > On Mon, Mar 02, 2020 at 11:12:26PM +0300, Cyrill Gorcunov wrote: > > On linux it is fine to call setsid right after > > the vfork, in turn on bsd pgrp should be used. > > Can you refer a source of this information? > > I tried the following snippet on Mac OS and FreeBSD and it at least does > not report an error: > > | #include > | #include > | > | int > | main() > | { > | if (setsid() == -1) { > | perror("setsid"); > | return 1; > | } > | return 0; > | } > > $ cc setsid.c -o setsid > $ echo 1 | ./setsid > > (Pipeline is to not be a session leader already, this will lead to EPERM.) I found that people are hitting the same problem. https://stackoverflow.com/questions/15179361/setpgrp-setpgid-fails-works-on-mac-osx-not-on-linux The main problem is that I don't have a clue about macos internals but it looks like we have to setup group instead. To me it is vague area. I suspect it is due to vfork macos specifics.