From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77839 invoked by alias); 20 Sep 2016 20:54:26 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 77826 invoked by uid 89); 20 Sep 2016 20:54:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1328, H*F:D*dk, our X-HELO: mail-wm0-f52.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version; bh=GvUbQ9DtTBVthjKsYYk/KDTmK5D9ik9KTmM/KVhHcmk=; b=laoKq+1SMzhEj0l5L+9gINojLi8K9l2fQz6DFB0P/ImQiIvBOIY7ttFj0V4VXe6IEO SYs7rDIWuculF+2LSzgl4FQYp1ZkNdikaVvqsJiPGJwhD6an8p632Ik/JrCNSG8nXKsD uBlRqHTCwdKFtKAFHUbwILX/7aXsbqNu/l4OWlaNdfTLUKg5s95snXNON+QoKrSEchlH G9D3YhQShvR3b+njiDPvqMUxJBpO9XFdlU+/f0N3DOfBvc5W5lXwhu16usOD2r2WAZ+L Do6u8TUJrJhER8QmNReAnJt/4nOYJJ1UbFqe2nN8ETDOM1+0p/+wUL9eEgjoh3SH6O8q rMWg== X-Gm-Message-State: AE9vXwNK/uneWG8GQ7q69Jtk2mXf75QWsqD2z3qiBW445x6TFHFndMDZU3sngF6Xarj3iA== X-Received: by 10.194.235.69 with SMTP id uk5mr29542478wjc.53.1474404854043; Tue, 20 Sep 2016 13:54:14 -0700 (PDT) From: Rasmus Villemoes To: Florian Weimer Cc: Joseph Myers , libc-alpha@sourceware.org, Adhemerval Zanella Subject: Re: [PATCH v2 3/3] posix: New Linux posix_spawn{p} implementation References: <1454343665-1706-1-git-send-email-adhemerval.zanella@linaro.org> <1454343665-1706-4-git-send-email-adhemerval.zanella@linaro.org> <87mvjsprqb.fsf@rasmusvillemoes.dk> <877fa6nwsl.fsf@mid.deneb.enyo.de> X-Hashcash: 1:20:160920:fw@deneb.enyo.de::xFlZFNIIjpTTaaHb:00twM X-Hashcash: 1:20:160920:joseph@codesourcery.com::YqgbWh+PbRbyCuTp:000000000000000000000000000000000000002Qyp X-Hashcash: 1:20:160920:libc-alpha@sourceware.org::TXTr8tYG/r9Di/qK:0000000000000000000000000000000000003z5Y X-Hashcash: 1:20:160920:adhemerval.zanella@linaro.org::b95M+WhMOUBxvu11:000000000000000000000000000000008wyi Date: Tue, 20 Sep 2016 20:54:00 -0000 In-Reply-To: <877fa6nwsl.fsf@mid.deneb.enyo.de> (Florian Weimer's message of "Tue, 20 Sep 2016 22:25:30 +0200") Message-ID: <87h99a1edn.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2016-09/txt/msg00359.txt.bz2 On Tue, Sep 20 2016, Florian Weimer wrote: > * Rasmus Villemoes: > >> + /* errno should have an appropriate non-zero value, but make sure >> + that's the case so that our parent knows we failed to >> + exec. There's no EUNKNOWN or EINTERNALBUG, so we use a value >> + which is clearly bogus. */ >> + args->err = errno ? : EHOSTDOWN; >> _exit (SPAWN_ERROR); >> } > > I think ECHILD is probably a better fake error code. Yeah, that's probably ok. It's consistent with its use in pclose() where the posix description reads "The status of the child process could not be obtained". We just use it in the sense "something went wrong, we just don't know what". I'd really wish EINTERNALBUG existed. > You should set args->err to 0 on success ... > >> + args.err = 0; > > ... and initialize it to -1. > >> if (new_pid > 0) >> { >> - if (__read (args.pipe[0], &ec, sizeof ec) != sizeof ec) >> - ec = 0; >> - else >> + ec = args.err; >> + if (ec != 0) >> __waitpid (new_pid, NULL, 0); >> } > > You should check (assert?) here that args.err is not -1. Otherwise we > will never notice if the page is not shared between parent and child, > and the error reporting mechanism does not work. Good point. I'll send an updated patch in a moment. Rasmus