From patchwork Thu Oct 19 18:32:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 828309 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-86130-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="HbnnufVb"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yHyGJ06Hdz9t3f for ; Fri, 20 Oct 2017 05:32:39 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; q=dns; s=default; b= ckeUcwvgzHmEKIjKr7M0nvwazeYvP0BHFlw0AYP8nhYHA1Jse4zKHo1Blre1/G/I wPA9H+0OSq+lHEJjdJenow+ZpKptoVbOuG15czpJEzP+d8OhvyaABfz/Fef10Nnd YWnIs4f7KgvTKzOZLws6KVvODQ608FU2J8npqr8bTfg= 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:date:to:subject:mime-version:content-type :content-transfer-encoding:message-id:from; s=default; bh=PMGVTH zyNAp0YIb7maOgeEGY9sE=; b=HbnnufVbbtSZKBcYjvUAB8SeCXXUrk8cqUSDxf fcmvdfbhCd+9aiV+CdzJrYQyR8Yvfdf4GkZZAng+Rrdv+OTcKmnEOtyghXVycIKh OT3zOHekTIP6S4bPZfj1TgpOLz6EJc7Blr/gUodJrMTvKOs37F7lz2zcXh08BTqB UCGMM= Received: (qmail 77761 invoked by alias); 19 Oct 2017 18:32:32 -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 77177 invoked by uid 89); 19 Oct 2017 18:32:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=UD:mount.h, sysinfo.h, sysinfoh, mounth X-HELO: mx1.redhat.com DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com ABB98C13DA2B Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=fweimer@redhat.com Date: Thu, 19 Oct 2017 20:32:28 +0200 To: libc-alpha@sourceware.org Subject: [PATCH] sysconf: Fix missing definition of UIO_MAXIOV on Linux [BZ #22321] User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20171019183228.4BD2A428666AA@oldenburg.str.redhat.com> From: fweimer@redhat.com (Florian Weimer) 2017-10-19 Florian Weimer [BZ #22321] sysconf: Fix missing definition of UIO_MAXIOV on Linux. * sysdeps/posix/sysconf.c: Include . * sysdeps/unix/sysv/linux/Makefile (tests): Add tst-sysconf-iov_max. (tst-sysconf-iov_max): Link with tst-sysconf-iov_max-uapi.o. * sysdeps/unix/sysv/linux/tst-sysconf-iov_max.c: New file. * sysdeps/unix/sysv/linux/tst-sysconf-iov_max-uapi.c: Likewise. Reviewed-by: Carlos O'Donell diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c index a95e1b3f05..254f87c437 100644 --- a/sysdeps/posix/sysconf.c +++ b/sysdeps/posix/sysconf.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #define NEED_SPEC_ARRAY 0 diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 30bd167bae..0c8a009b5e 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -50,7 +50,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \ bits/siginfo-arch.h bits/siginfo-consts-arch.h tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \ - tst-quota tst-sync_file_range test-errno-linux + tst-quota tst-sync_file_range test-errno-linux tst-sysconf-iov_max # Generate the list of SYS_* macros for the system calls (__NR_* # macros). The file syscall-names.list contains all possible system @@ -95,6 +95,9 @@ $(objpfx)tst-syscall-list.out: \ $(objpfx)tst-syscall-list-sys.list $(BASH) $^ $(AWK) > $@; $(evaluate-test) +# Separate object file for access to the constant from the UAPI header. +$(objpfx)tst-sysconf-iov_max: $(objpfx)tst-sysconf-iov_max-uapi.o + endif # $(subdir) == misc ifeq ($(subdir),time) diff --git a/sysdeps/unix/sysv/linux/tst-sysconf-iov_max-uapi.c b/sysdeps/unix/sysv/linux/tst-sysconf-iov_max-uapi.c new file mode 100644 index 0000000000..1240b846e6 --- /dev/null +++ b/sysdeps/unix/sysv/linux/tst-sysconf-iov_max-uapi.c @@ -0,0 +1,27 @@ +/* Check IOV_MAX definition: Helper function to capture UAPI header value. + Copyright (C) 2017 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 + . */ + +/* Use a separate function to avoid header compatibility issues. */ + +#include + +long +uio_maxiov_value (void) +{ + return UIO_MAXIOV; +} diff --git a/sysdeps/unix/sysv/linux/tst-sysconf-iov_max.c b/sysdeps/unix/sysv/linux/tst-sysconf-iov_max.c new file mode 100644 index 0000000000..e85bd59550 --- /dev/null +++ b/sysdeps/unix/sysv/linux/tst-sysconf-iov_max.c @@ -0,0 +1,38 @@ +/* Check IOV_MAX definition for consistency (bug 22321). + Copyright (C) 2017 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 + . */ + +/* Defined in tst-sysconf-iov_max-uapi.c. */ +long uio_maxiov_value (void); + + +#include +#include +#include +#include + +static int +do_test (void) +{ + TEST_VERIFY (IOV_MAX == uio_maxiov_value ()); + TEST_VERIFY (UIO_MAXIOV == uio_maxiov_value ()); + TEST_VERIFY (sysconf (_SC_UIO_MAXIOV) == uio_maxiov_value ()); + TEST_VERIFY (sysconf (_SC_IOV_MAX) == uio_maxiov_value ()); + return 0; +} + +#include