From patchwork Mon Apr 12 21:11:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 42950 X-Patchwork-Delegate: carlos@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C24EA3939C19; Mon, 12 Apr 2021 21:11:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C24EA3939C19 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1618261880; bh=A0d+0O8DLfRIFZQuMtGhZDbK135or2anEorsGZLxmrc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=SMYyQXWCKPxENOVelOJqn+093utKvpF4drOVC0B5kS5GkKNIbVMmwlUZNrUPhx1a5 tsK062HQl91jg4eSSUTbfujqQj1Khxf1ag23Pg6plYPHyJWjWcc1m6YyhT9W6Len70 AKBK2GrZwGjsJF5ngr9KWrvWJjpfhz2nBSfRlvlw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) by sourceware.org (Postfix) with ESMTPS id AC294385480B for ; Mon, 12 Apr 2021 21:11:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AC294385480B Received: by mail-qv1-xf32.google.com with SMTP id 30so7045192qva.9 for ; Mon, 12 Apr 2021 14:11:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=A0d+0O8DLfRIFZQuMtGhZDbK135or2anEorsGZLxmrc=; b=EUuCoMkW5omN8t61CYWFPrI4ektjJgehU2GF2Uwykogk2bXAe4g3ZeFVxgyRVscB0U Iw8HIElDpjn7Bh4YJfJEni1yEVlDAFFfascvE3JsAM4GWX0cjtIu7DBysSvxiuSRs/+q KyMB8N2MnBTLJsdSLc+qJS2wRgj84hbFlmxvjFg36iZ6qQtd5oUronjUqAliSgdrBWSl hmh/JccJ3SjHXLzXN23EOWSAHfiwP+bReKbgJGe/zw/gumir5e4RBoy4PxAlPlQzKVsu GCFGXdwoKv+rrXYWmOiZaKzAp7uNwcEM/1XKX5vORVrSWISWsKxmFWrbvCPs2p+EChT3 5Qfg== X-Gm-Message-State: AOAM531QepxPnop2NrkCJabjJ+CgyLaXDtN+QL6xXP8yq3NLEoaYPMbX e1Mti/kOj6Vp6t0RkPMEzQEQlHriITaW2kmA X-Google-Smtp-Source: ABdhPJxEcEaDjyc7ZcMHcinfXaIRKB5yJX8PMmyRWS7e3lEhPL4Hg1IXeQmeP9sPLeKByu/FYHbYmg== X-Received: by 2002:a0c:ed50:: with SMTP id v16mr29621366qvq.54.1618261878136; Mon, 12 Apr 2021 14:11:18 -0700 (PDT) Received: from localhost.localdomain ([177.194.41.149]) by smtp.googlemail.com with ESMTPSA id i22sm3073392qko.135.2021.04.12.14.11.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 14:11:17 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 01/11] support: Add xmkfifo Date: Mon, 12 Apr 2021 18:11:03 -0300 Message-Id: <20210412211113.393120-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 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 autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" 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 900e17f94f..cbf2efdf5f 100644 --- a/support/Makefile +++ b/support/Makefile @@ -114,6 +114,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..d9f3e9fde7 --- /dev/null +++ b/support/xmkfifo.c @@ -0,0 +1,29 @@ +/* mkfifo with error checking. + Copyright (C) 2021 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, %d): %m", pathname, mode); +} diff --git a/support/xunistd.h b/support/xunistd.h index c642588c29..86fee87b7a 100644 --- a/support/xunistd.h +++ b/support/xunistd.h @@ -48,6 +48,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 *pathtname, mode_t mode); /* Equivalent of "mkdir -p". */ void xmkdirp (const char *, mode_t);