From patchwork Sat Sep 15 15:16:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 146777 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1892501ljw; Sat, 15 Sep 2018 08:18:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbSjre4ONUXM9fLTE3h9QhlOnvlKjftcc0HFuRAHhQvIJ17YKxLISKmDFwJeF3A9+Kadu0U X-Received: by 2002:a65:4d42:: with SMTP id j2-v6mr16186726pgt.232.1537024700541; Sat, 15 Sep 2018 08:18:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537024700; cv=none; d=google.com; s=arc-20160816; b=byMGv8pdHRn07ovggL24EG54h+fpUjok6xUH3jGyGPZoByzwX02DRYcYmD+BdlRCLH 4jmZRt2kvBErNB9n+/TpS/SbZeF5aVEWHGwUuRa3XzrZP8vN5jgqgV0uzBFNaFYsgluL a3ubAqjGT2DKXAQ2uOt4tuEsjzhags7LTLY8NLI8q9EywmmadoV3XKKYVSQrMvW2GIoe sXL8VSBq6iEVHiA85wKw2RsMcAxNFft03GhXsvixXdAw+3+gpK1jtd7mMULfgR5yYozt qSFbueI42TABIUsxCHzWjNwnQ+rB2cdZx57cA+8vsxlMRahKxZkd+BGrFCH1t3CQQdjI +pdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:dkim-signature:delivered-to:sender :list-help:list-post:list-archive:list-subscribe:list-unsubscribe :list-id:precedence:mailing-list:dkim-signature:domainkey-signature; bh=lR7VB5qhzYZD6omRXeaqcyqB7PBTkc3xa6SA+usFC+I=; b=ZkiG5OuzjL0jzDxDmCpGEmiADzHyhRS5j9ausW+4NqAzBg5nXpglUImHW/MLJgePS8 RfpaFwNlPVce/ne4Apg9MWsLmgRDXJyfWkYcdtOu/rk3inZlgNoJI5UL41DseYSpvR6W xhesL+i/nPK+NWVEORhBZP25jwoXx9NYZG5181zctljisTgtWwU0YhRLvE87xD/Vk+TH Wi0wQk5MlIT8bcIwz5vU8CHGRectv9YEUAhDJB1ErRKOpSaa46l3+EwbRepmpQj+/ycr eamyMnT/GeXz75+sH/isIIUY2slglgVjtKPyCKCA2WZkleyuDB/GDmMSr2Z/EJTlo7/k CWFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=DXXWpzXW; dkim=pass header.i=@linaro.org header.s=google header.b=f3Tc5Ebb; spf=pass (google.com: domain of libc-alpha-return-95850-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-95850-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g3-v6si9776548pgu.248.2018.09.15.08.18.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Sep 2018 08:18:20 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-95850-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=DXXWpzXW; dkim=pass header.i=@linaro.org header.s=google header.b=f3Tc5Ebb; spf=pass (google.com: domain of libc-alpha-return-95850-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-95850-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=vCiRhPWVU2Dv0wdD6gKZpneqJ3oz1T31fPNjKmAbvSUGGCLvmLoxo +lHqszI+aWLk2PYjulaN6vyUFdq80alfj5+e6ExBJKQ4VzBcg8Jm3h5MEnQ6lOX5 4WF+tzhd3BTkTg1BKZq1O8nge1D0IDZjQtbYsxC6PGa8+DIhrZU+N0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=qSowf9raUoLMWSfufBflgZN+vqM=; b=DXXWpzXW8/DRY3SoTOct+ZVDKObW /wVm/dy5DrtowqVpCpsIF1eEqNT6Iw0Rw5pKLkaF1tlMsQBC1VkqKXjCBdgYN3xh GDUpUFQhF/MlWsati1BV+fJYfcRnzWh3Pi2k5z3kJZ4E56dc+xdYDxCB+Fa8ud3s jDHmE2ADkGGN0rU= Received: (qmail 88678 invoked by alias); 15 Sep 2018 15:18:10 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 88652 invoked by uid 89); 15 Sep 2018 15:18:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Simply, actions X-HELO: mail-qt0-f193.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=lR7VB5qhzYZD6omRXeaqcyqB7PBTkc3xa6SA+usFC+I=; b=f3Tc5EbbrGCrrjqgz/mAW2FFv6D62yBi3Eb0W7cZ4Qctbeu8Uce3gjM7a3MVO709PM cDm+hwkJEeRy9q6CYYkb4CPOyo9IuhMzDVadKcgJ/GhtLv7f8lNZINDyMGWFd5QcfNe7 cT40D4Obz+EGu4suqoUuP3PcF084vDv7t+hIo= Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 1/3] posix: Add internal symbols for posix_spawn interface Date: Sat, 15 Sep 2018 12:16:20 -0300 Message-Id: <20180915151622.17789-1-adhemerval.zanella@linaro.org> This patch adds internal hidden definition for mostly of the posix_spawn function so it can be used internally on both popen and system implementations. Checked on x86_64-linux-gnu. * include/spawn.h (__posix_spawn, posix_spawn_file_actions_addclose, __posix_spawn_file_actions_adddup2, __posix_spawn_file_actions_destroy, __posix_spawn_file_actions_init, __posix_spawnattr_init, __posix_spawnattr_destroy, __posix_spawnattr_setflags, __posix_spawnattr_setsigdefault, __posix_spawnattr_setsigmask): New prototype. * posix/spawn.c (__posix_spawn): Add libc_hidden_def. * posix/spawn_faction_addclose.c (__posix_spawn_file_actions_addclose): Add hidden definition. * posix/spawn_faction_adddup2.c (__posix_spawn_file_actions_adddup2): Likewise. * posix/spawn_faction_destroy.c (__posix_spawn_file_actions_destroy): Likewise. * posix/spawn_faction_init.c (__posix_spawn_file_actions_init): Likewise. * posix/spawnattr_destroy.c (__posix_spawnattr_destroy): Likewise. * posix/spawnattr_init.c (__posix_spawnattr_init): Likewise. * posix/spawnattr_setdefault.c (__posix_spawnattr_setsigdefault): Likewise. * posix/spawnattr_setflags.c (__posix_spawnattr_setflags): Likewise. * posix/spawnattr_setsigmask.c (__posix_spawnattr_setsigmask): Likewise. --- ChangeLog | 25 ++++++++++++++++++++++++ include/spawn.h | 35 ++++++++++++++++++++++++++++++++++ posix/spawn.c | 1 + posix/spawn_faction_addclose.c | 6 ++++-- posix/spawn_faction_adddup2.c | 6 ++++-- posix/spawn_faction_destroy.c | 4 +++- posix/spawn_faction_init.c | 3 ++- posix/spawnattr_destroy.c | 3 ++- posix/spawnattr_init.c | 3 ++- posix/spawnattr_setdefault.c | 5 +++-- posix/spawnattr_setflags.c | 3 ++- posix/spawnattr_setsigmask.c | 3 ++- 12 files changed, 85 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/include/spawn.h b/include/spawn.h index a6c7a8adc3..7fdd965bd7 100644 --- a/include/spawn.h +++ b/include/spawn.h @@ -1 +1,36 @@ +#ifndef _SPAWN_H #include + +# ifndef _ISOMAC +__typeof (posix_spawn) __posix_spawn; +libc_hidden_proto (__posix_spawn) + +__typeof (posix_spawn_file_actions_addclose) + __posix_spawn_file_actions_addclose attribute_hidden; + +__typeof (posix_spawn_file_actions_adddup2) + __posix_spawn_file_actions_adddup2 attribute_hidden; + +__typeof (posix_spawn_file_actions_destroy) + __posix_spawn_file_actions_destroy attribute_hidden; + +__typeof (posix_spawn_file_actions_init) __posix_spawn_file_actions_init + attribute_hidden; + +__typeof (posix_spawnattr_init) __posix_spawnattr_init + attribute_hidden; + +__typeof (posix_spawnattr_destroy) __posix_spawnattr_destroy + attribute_hidden; + +__typeof (posix_spawnattr_setflags) __posix_spawnattr_setflags + attribute_hidden; + +__typeof (posix_spawnattr_setsigdefault) __posix_spawnattr_setsigdefault + attribute_hidden; + +__typeof (posix_spawnattr_setsigmask) __posix_spawnattr_setsigmask + attribute_hidden; + +# endif /* !_ISOMAC */ +#endif /* spawn.h */ diff --git a/posix/spawn.c b/posix/spawn.c index 51f67b2755..a82f1c84e2 100644 --- a/posix/spawn.c +++ b/posix/spawn.c @@ -30,6 +30,7 @@ __posix_spawn (pid_t *pid, const char *path, return __spawni (pid, path, file_actions, attrp, argv, envp, 0); } versioned_symbol (libc, __posix_spawn, posix_spawn, GLIBC_2_15); +libc_hidden_def (__posix_spawn) #if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_15) diff --git a/posix/spawn_faction_addclose.c b/posix/spawn_faction_addclose.c index 21081e19b5..e1fafe438c 100644 --- a/posix/spawn_faction_addclose.c +++ b/posix/spawn_faction_addclose.c @@ -24,8 +24,8 @@ /* Add an action to FILE-ACTIONS which tells the implementation to call `close' for the given file descriptor during the `spawn' call. */ int -posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions, - int fd) +__posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions, + int fd) { struct __spawn_action *rec; @@ -48,3 +48,5 @@ posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions, return 0; } +weak_alias (__posix_spawn_file_actions_addclose, + posix_spawn_file_actions_addclose) diff --git a/posix/spawn_faction_adddup2.c b/posix/spawn_faction_adddup2.c index 363bc29ae5..371b1de3e6 100644 --- a/posix/spawn_faction_adddup2.c +++ b/posix/spawn_faction_adddup2.c @@ -24,8 +24,8 @@ /* Add an action to FILE-ACTIONS which tells the implementation to call `dup2' for the given file descriptors during the `spawn' call. */ int -posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *file_actions, - int fd, int newfd) +__posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *file_actions, + int fd, int newfd) { struct __spawn_action *rec; @@ -49,3 +49,5 @@ posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *file_actions, return 0; } +weak_alias (__posix_spawn_file_actions_adddup2, + posix_spawn_file_actions_adddup2) diff --git a/posix/spawn_faction_destroy.c b/posix/spawn_faction_destroy.c index 46061ee347..2a2de4e41d 100644 --- a/posix/spawn_faction_destroy.c +++ b/posix/spawn_faction_destroy.c @@ -22,7 +22,7 @@ /* Deallocate the file actions. */ int -posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *file_actions) +__posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *file_actions) { /* Free the paths in the open actions. */ for (int i = 0; i < file_actions->__used; ++i) @@ -44,3 +44,5 @@ posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *file_actions) free (file_actions->__actions); return 0; } +weak_alias (__posix_spawn_file_actions_destroy, + posix_spawn_file_actions_destroy) diff --git a/posix/spawn_faction_init.c b/posix/spawn_faction_init.c index ddb42e6a77..98432067c6 100644 --- a/posix/spawn_faction_init.c +++ b/posix/spawn_faction_init.c @@ -45,9 +45,10 @@ __posix_spawn_file_actions_realloc (posix_spawn_file_actions_t *file_actions) /* Initialize data structure for file attribute for `spawn' call. */ int -posix_spawn_file_actions_init (posix_spawn_file_actions_t *file_actions) +__posix_spawn_file_actions_init (posix_spawn_file_actions_t *file_actions) { /* Simply clear all the elements. */ memset (file_actions, '\0', sizeof (*file_actions)); return 0; } +weak_alias (__posix_spawn_file_actions_init, posix_spawn_file_actions_init) diff --git a/posix/spawnattr_destroy.c b/posix/spawnattr_destroy.c index 603e00fffe..0433867785 100644 --- a/posix/spawnattr_destroy.c +++ b/posix/spawnattr_destroy.c @@ -19,8 +19,9 @@ /* Initialize data structure for file attribute for `spawn' call. */ int -posix_spawnattr_destroy (posix_spawnattr_t *attr) +__posix_spawnattr_destroy (posix_spawnattr_t *attr) { /* Nothing to do in the moment. */ return 0; } +weak_alias (__posix_spawnattr_destroy, posix_spawnattr_destroy) diff --git a/posix/spawnattr_init.c b/posix/spawnattr_init.c index bab464e62b..4e1218ab44 100644 --- a/posix/spawnattr_init.c +++ b/posix/spawnattr_init.c @@ -20,7 +20,7 @@ /* Initialize data structure for file attribute for `spawn' call. */ int -posix_spawnattr_init (posix_spawnattr_t *attr) +__posix_spawnattr_init (posix_spawnattr_t *attr) { /* All elements have to be initialized to the default values which is generally zero. */ @@ -28,3 +28,4 @@ posix_spawnattr_init (posix_spawnattr_t *attr) return 0; } +weak_alias (__posix_spawnattr_init, posix_spawnattr_init) diff --git a/posix/spawnattr_setdefault.c b/posix/spawnattr_setdefault.c index c77cda59be..174bcfa423 100644 --- a/posix/spawnattr_setdefault.c +++ b/posix/spawnattr_setdefault.c @@ -20,11 +20,12 @@ /* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */ int -posix_spawnattr_setsigdefault (posix_spawnattr_t *attr, - const sigset_t *sigdefault) +__posix_spawnattr_setsigdefault (posix_spawnattr_t *attr, + const sigset_t *sigdefault) { /* Copy the sigset_t data to the user buffer. */ memcpy (&attr->__sd, sigdefault, sizeof (sigset_t)); return 0; } +weak_alias (__posix_spawnattr_setsigdefault, posix_spawnattr_setsigdefault) diff --git a/posix/spawnattr_setflags.c b/posix/spawnattr_setflags.c index cf9a60181d..0a42e94770 100644 --- a/posix/spawnattr_setflags.c +++ b/posix/spawnattr_setflags.c @@ -30,7 +30,7 @@ /* Store flags in the attribute structure. */ int -posix_spawnattr_setflags (posix_spawnattr_t *attr, short int flags) +__posix_spawnattr_setflags (posix_spawnattr_t *attr, short int flags) { /* Check no invalid bits are set. */ if (flags & ~ALL_FLAGS) @@ -41,3 +41,4 @@ posix_spawnattr_setflags (posix_spawnattr_t *attr, short int flags) return 0; } +weak_alias (__posix_spawnattr_setflags, posix_spawnattr_setflags) diff --git a/posix/spawnattr_setsigmask.c b/posix/spawnattr_setsigmask.c index 7ae81ad470..12c0111af4 100644 --- a/posix/spawnattr_setsigmask.c +++ b/posix/spawnattr_setsigmask.c @@ -20,7 +20,7 @@ /* Set signal mask for the new process in ATTR to SIGMASK. */ int -posix_spawnattr_setsigmask (posix_spawnattr_t *attr, +__posix_spawnattr_setsigmask (posix_spawnattr_t *attr, const sigset_t *sigmask) { /* Copy the sigset_t data to the user buffer. */ @@ -28,3 +28,4 @@ posix_spawnattr_setsigmask (posix_spawnattr_t *attr, return 0; } +weak_alias (__posix_spawnattr_setsigmask, posix_spawnattr_setsigmask)