From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id C57C23857419 for ; Mon, 21 Mar 2022 21:19:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C57C23857419 Received: by mail-ot1-x335.google.com with SMTP id o20-20020a9d7194000000b005cb20cf4f1bso11344356otj.7 for ; Mon, 21 Mar 2022 14:19:20 -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=VCQZrPKABV62ysDah5+QAAuJPynCsh1tajlDylxcRkSqmfKaLhCFcoFpVZvgVXivcf krBG8ZG2WbiKbPQYaT2l898rqQYGUQyeBZYBxadqbRVdyyMqXzkD8AyZdnzjyqPp76IZ PfvVj3+jXqAhOq+2dSKlUVnh2X8qHQVWL8VI5z6wPyLbC26qUgbscriRM2VfBsX4k69j JkWv+C10tdOACZsOWsRdl+KKYDTcsAMCzNc/Mr045OpY8hb249VwpyCwKBWB6x7bTvFV VnvUPwab14lC0XpDCQQqYavjgTt1PJaAPjlyF+hahzmeEUmnGtBjB23sH00TzK7Fb3KX 2aDg== X-Gm-Message-State: AOAM531gorVpvHAi6ydLdNiMRrqppLU8PorgcAkjEA1RMAptnzWhvwus /OGvU1UriZ6Qvc0mWKg/xFLrxPiVNuclGQ== X-Google-Smtp-Source: ABdhPJx2Sv88QhFyhk2llm5CWzgtaYmg5Otb2q4/1VOMAzqIn6gVE3Zbj+cNqYKV2t2Cw5LsNBc3Mg== X-Received: by 2002:a05:6830:1098:b0:5af:a452:2f17 with SMTP id y24-20020a056830109800b005afa4522f17mr8597951oto.175.1647897559740; Mon, 21 Mar 2022 14:19:19 -0700 (PDT) Received: from birita.. ([2804:431:c7ca:2d55:d5f9:2c96:1f30:1f58]) by smtp.gmail.com with ESMTPSA id c37-20020a9d27a8000000b005b23cf22e23sm7925256otb.42.2022.03.21.14.19.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 14:19:19 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org, Paul Eggert Subject: [PATCH v5 1/7] support: Add xmkfifo Date: Mon, 21 Mar 2022 18:19:07 -0300 Message-Id: <20220321211913.2347924-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220321211913.2347924-1-adhemerval.zanella@linaro.org> References: <20220321211913.2347924-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: Mon, 21 Mar 2022 21:19:22 -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