From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc2c.google.com (mail-oo1-xc2c.google.com [IPv6:2607:f8b0:4864:20::c2c]) by sourceware.org (Postfix) with ESMTPS id D36843853804 for ; Fri, 18 Mar 2022 16:52:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D36843853804 Received: by mail-oo1-xc2c.google.com with SMTP id y27-20020a4a9c1b000000b0032129651bb0so10815501ooj.2 for ; Fri, 18 Mar 2022 09:52:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yLtoGvS6xckQHPl0gjw6Ytmpjx0eAYqmfl2aBNnEpXg=; b=5jY13zs0U3/PX62Y9SSoL1xNHstPV7mCJQn02wr9Xl5A7+1rzWRvZvfnUAGKUDbXPV pkSvUBePLFLxIQA7GNbiZTDotBPeNcwgN+LhLlJ6/PHp6/yiEK1q3Xz/KBFrlMINhyrz b+kYSZVbwxhpbqAWJoKgL7qVBgcFbtusKIblC0ISeSx69rMfldMAKLPNSqC410I59cEu Og9vJ4Pq82X39JytkXxpgaRpvHH11N4SXddyDx4FnoiKkfukpoFdwKUlyGcG2yKf+w/9 F0r/K5aEYctbLXFJe6NpaJ4nmLddJXxu4VniG6STtU2tTOIYZBftdyHVrJmFKytYu2q4 Ozyg== X-Gm-Message-State: AOAM531QCyNjpJqyGodf0N9Xsql2c9s0qG+eUVACLYW1/865wXLWYs23 wSas1ZXY9u1eEIucvJOYUdZ9jHadMvppgA== X-Google-Smtp-Source: ABdhPJyswOXuPguFULiOXmFrSPp8SWOdAzXXWURFfZFunYceJGCMjg8jwvxMFbuQbb3DFeeXkx0tLA== X-Received: by 2002:a05:6870:d1d5:b0:da:cd6:7ac5 with SMTP id b21-20020a056870d1d500b000da0cd67ac5mr7329839oac.157.1647622340972; Fri, 18 Mar 2022 09:52:20 -0700 (PDT) Received: from birita.. ([2804:431:c7ca:99a3:99e2:1060:da92:ae49]) by smtp.gmail.com with ESMTPSA id c12-20020a9d75cc000000b005b24b061940sm3986417otl.33.2022.03.18.09.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Mar 2022 09:52:20 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org, Paul Eggert Subject: [PATCH v3 1/7] support: Add xmkfifo Date: Fri, 18 Mar 2022 13:52:08 -0300 Message-Id: <20220318165214.2291065-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220318165214.2291065-1-adhemerval.zanella@linaro.org> References: <20220318165214.2291065-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Mar 2022 16:52:23 -0000 Wrapper support mkfifo. --- support/Makefile | 1 + support/xmkfifo.c | 29 +++++++++++++++++++++++++++++ support/xunistd.h | 1 + 3 files changed, 31 insertions(+) create mode 100644 support/xmkfifo.c diff --git a/support/Makefile b/support/Makefile index 5ddcb8d158..c3609e211b 100644 --- a/support/Makefile +++ b/support/Makefile @@ -133,6 +133,7 @@ libsupport-routines = \ xmemstream \ xmkdir \ xmkdirp \ + xmkfifo \ xmmap \ xmprotect \ xmunmap \ diff --git a/support/xmkfifo.c b/support/xmkfifo.c new file mode 100644 index 0000000000..a8e196dbc2 --- /dev/null +++ b/support/xmkfifo.c @@ -0,0 +1,29 @@ +/* mkfifo with error checking. + Copyright (C) 2022 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +void +xmkfifo (const char *pathname, mode_t mode) +{ + int r = mkfifo (pathname, mode); + if (r < 0) + FAIL_EXIT1 ("mkfifo (%s, 0%o): %m", pathname, mode); +} diff --git a/support/xunistd.h b/support/xunistd.h index 0454d83cf1..960a62d412 100644 --- a/support/xunistd.h +++ b/support/xunistd.h @@ -61,6 +61,7 @@ void xsymlink (const char *target, const char *linkpath); void xchdir (const char *path); void xfchmod (int fd, mode_t mode); void xchmod (const char *pathname, mode_t mode); +void xmkfifo (const char *pathname, mode_t mode); /* Equivalent of "mkdir -p". */ void xmkdirp (const char *, mode_t); -- 2.32.0