From patchwork Wed Nov 18 19:55:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 41121 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 DF4553947C38; Wed, 18 Nov 2020 19:56:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF4553947C38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1605729392; bh=1HTymu6NMKG8u/I8kSakZbmbYoYcjm0NL95njlsA3vk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=II3puVC7ZxfZRTofrpVLRFP+pufd8Czdg6LHkGy9Va8BDA+21uuxI6/pIlq+qvIRa WiTygjz9DK2jVfOy5Ws9Pe8z6hWaD3h9RRiq5WEpuFs89Fe0A2hNzZR/cLyfE2PG0o iBPAiIE0kox/gFhzwLEwzCRJX48t4x4yIHQTnLXg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by sourceware.org (Postfix) with ESMTPS id 68DE33947407 for ; Wed, 18 Nov 2020 19:56:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 68DE33947407 Received: by mail-qk1-x742.google.com with SMTP id d28so3038941qka.11 for ; Wed, 18 Nov 2020 11:56:29 -0800 (PST) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=1HTymu6NMKG8u/I8kSakZbmbYoYcjm0NL95njlsA3vk=; b=PfDEdRflX++Un4wQPxUHNjlPt/adgYeP6R+M2nFij+OgdJ+kSD4mJkqTC7q6nLAn2+ JiEV38vGM+xOD3UQHGjHrD1WWSuGsTdyZkD89JzGecNlEB/C5sewJg0TBU9j/oUJ6DnN G+FSp6xSHstueFeuKvnOW2vjpIm4DdAwONNvrSnJLgppxNxtWuIZh6q/BQMGEJcVoPEr HkCdBonQok/PA+LScMlkjCHOoN5zdocm1C8rQP1Xv0xVRa3FA3HLhEWCsRwCQvEHJyJu Bw0X51QOCfxoY4AZTkwpza9pB+YHxewe3CZMh4iAG1ENGMLD7O9YDW01arug95VcLBg+ LV7w== X-Gm-Message-State: AOAM532qOXpqgbua4niL527w72RJVdT3CNKWRGiENTH6LdY50qHmmabC jjVy3TSGpqHhX960tCxSqnXOF6yqHpKblA== X-Google-Smtp-Source: ABdhPJwRxW+caokBzrV4oNa95ntMTn5k+os8y4rVnvPAY2e/ZD91FJ42mumd3Ss+9NU0gypY6jbNsw== X-Received: by 2002:a05:620a:57b:: with SMTP id p27mr6497736qkp.417.1605729388805; Wed, 18 Nov 2020 11:56:28 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id f27sm6538775qtv.95.2020.11.18.11.56.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Nov 2020 11:56:28 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 22/28] Linux: implement ioctl in C Date: Wed, 18 Nov 2020 16:55:46 -0300 Message-Id: <20201118195552.2687336-23-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201118195552.2687336-1-adhemerval.zanella@linaro.org> References: <20201118195552.2687336-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.9 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" This avoid variadic function in syscalls.list and the possible mismatch between the asm syscall macros the required ABI to handle the variadic argument. Checked on x86_64-linux-gnu. --- sysdeps/unix/syscalls.list | 1 - sysdeps/unix/sysv/linux/ioctl.c | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 sysdeps/unix/sysv/linux/ioctl.c diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list index 6d1a2ad441..353afe594f 100644 --- a/sysdeps/unix/syscalls.list +++ b/sysdeps/unix/syscalls.list @@ -31,7 +31,6 @@ getrlimit - getrlimit i:ip __getrlimit getrlimit getsockname - getsockname i:ibN __getsockname getsockname getsockopt - getsockopt i:iiiBN getsockopt getuid - getuid Ei: __getuid getuid -ioctl - ioctl i:iiI __ioctl ioctl kill - kill i:ii __kill kill link - link i:ss __link link listen - listen i:ii __listen listen diff --git a/sysdeps/unix/sysv/linux/ioctl.c b/sysdeps/unix/sysv/linux/ioctl.c new file mode 100644 index 0000000000..fe0dc5661e --- /dev/null +++ b/sysdeps/unix/sysv/linux/ioctl.c @@ -0,0 +1,36 @@ +/* Control device. Linux version. + Copyright (C) 2020 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 + +int +__ioctl (int fd, unsigned long int request, ...) +{ + void *arg; + va_list va; + + va_start (va, request); + arg = va_arg (va, void *); + va_end (va); + + return INLINE_SYSCALL_CALL (ioctl, fd, request, arg); +} +libc_hidden_def (__ioctl) +weak_alias (__ioctl, ioctl)