linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yuri Edward <yuri6037@yuristudio.net>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Issue with fcntl FD_CLOEXEC and execve
Date: Mon, 22 Jun 2020 19:09:22 +0200	[thread overview]
Message-ID: <77fb62c9-1b7f-363a-b574-477bf980e209@yuristudio.net> (raw)
In-Reply-To: <87y2og5h0h.fsf@mid.deneb.enyo.de>

Hello,

Thanks a lot for the tip; I changed my fcntl call to the following: 
"fcntl(myfd, F_SETFD, FD_CLOEXEC)" and that fixed the problem.

I can now run and control external processes using the same API across 
most platforms!

I wish the man pages of fcntl could have been clearer about how you were 
supposed to apply the FD_CLOEXEC flag...

Yuri Edward


On 6/21/20 9:57 PM, Florian Weimer wrote:
> * Yuri Edward:
>
>> https://github.com/BlockProject3D/Framework/blob/ProcessManagement/Base/src/Framework/System/Process.cpp
>>   > This is the main class that performs fork, pipe, read, write and
>      if (fcntl(commonfd[PIPE_WRITE], FD_CLOEXEC, 1) != 0)
>
> That's not how fcntl works.  You need to use F_GETFD and F_SETFD to
> set the FD_CLOEXEC flag.

  reply	other threads:[~2020-06-22 17:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 20:40 Issue with fcntl FD_CLOEXEC and execve postmaster
2020-06-20  6:53 ` Florian Weimer
2020-06-21 18:46   ` Yuri Edward
     [not found]   ` <fadc7cda-a84b-33ed-e15a-8203673f9d61@yuristudio.net>
2020-06-21 19:57     ` Florian Weimer
2020-06-22 17:09       ` Yuri Edward [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-06-21 19:03 Yuri Edward

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77fb62c9-1b7f-363a-b574-477bf980e209@yuristudio.net \
    --to=yuri6037@yuristudio.net \
    --cc=fw@deneb.enyo.de \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).