From nobody Wed May 08 14:49:45 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VZJ2d6V6Cz5JHdZ; Wed, 08 May 2024 14:49:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VZJ2d48w3z4dw9; Wed, 8 May 2024 14:49:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715179785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nt8fcMizQ1yjiZXxdb3R1tqxifwlqlE/XCJSxBUk3f4=; b=k+m/9ugh4ppbHYxFEaYR72F4wOYcDiWWhy0FuVAt/G+x8PWmN6HGko1dJ1B0lX0TfI6yFQ wsydk5DMAChimSgoMQTFaejJOGZ+q5sGNjMA1NnmKgSXUIX7mMvrdGnLSFFSNrgo8tv00q Tb6HWf+rBpSMD2EctUb0SQGYNvY+Xnf69JlDxJjoSjJC9CWU/QHNI4JdSDw4R7j/HgrgI3 tB8u7biQVRP+Jv2otejpx1Y8cxPetKZ/i6lUsOK5+lLlywyjJzOC+pYnmEj1IcX9od5iS6 ZpXWPrOXhmaZJ8cSDh4VtBeb3pwYC/z5xEdhmd6KDHwJYXDhZvpuJR8k4hdtYw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715179785; a=rsa-sha256; cv=none; b=WKQfWJYlaQny7PP2gLiKRaO935Z2WvXJmi68j37txGIARL+xJv43ze8qNtpPV5TVz+6s9i QWsct4CNTDYq3x8mWZ+k0qC7R3n8w20iBz1CGnc7H1XDNDjVeClQWjU3YTnSkhyHWbYvQS KhcejGCxceC+HMt3UJyMUYp33Wr0TCCaPpfhnzlw3yecAxCfBFZGLQ5Agt64RgYcvxip7T Fvr9mGykb4wUE9RgBbXbpBe5kH/j5sqW4YeuhFdF6OFAMcGoJE2621QiRlKUNQH9KcBY++ 2UyqTmor4pfBdEcHVfohx+1YS1YEuHG5+vvHkLXmTuRqtuxU5B7nN7OkKh899g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715179785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nt8fcMizQ1yjiZXxdb3R1tqxifwlqlE/XCJSxBUk3f4=; b=aQdlFe+g71M49uDe9i6guG09KJXZmSbCLqdqtRKjG8xtRqGLfKR1LNs5NFr03PWJ0nt33B LuFUZPskC+yQX2jWfaJ5cMOeNkm7t5gr1zap94GmXTeQo9oFwTkwPo8W2VuXTKziltOXJc ui6YQSaPFb2OamGlG5Z9qQ1xXUFGixbpSJIfiGIvB5ZOMe2dqNKGj+Ig964W/tNbCERZBu lDBaKPCVKbth8M41Tv+Fn8u0yLwFJEWnu3Jac5f42DMzPgiQd0O5I7md7Jlt1i6qHrk6+t PhcRcV/YK6VoQ2NlTE+croUsCJKNu80hFvL0ApDVvHFnZxxJeTm/P8opFx/iJA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VZJ2d3S0VzTD7; Wed, 8 May 2024 14:49:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 448Enjct048960; Wed, 8 May 2024 14:49:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 448Enj7l048957; Wed, 8 May 2024 14:49:45 GMT (envelope-from git) Date: Wed, 8 May 2024 14:49:45 GMT Message-Id: <202405081449.448Enj7l048957@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: ec2b6b16aac4 - main - libthr: avoid varargs in fcntl and openat interposers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ec2b6b16aac4d2873a856658d4cd6001ec255dc7 Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=ec2b6b16aac4d2873a856658d4cd6001ec255dc7 commit ec2b6b16aac4d2873a856658d4cd6001ec255dc7 Author: Brooks Davis AuthorDate: 2024-05-08 14:49:13 +0000 Commit: Brooks Davis CommitDate: 2024-05-08 14:49:13 +0000 libthr: avoid varargs in fcntl and openat interposers Align these signatures with the ones in syscalls.master (and thus libsys.h). There's no reason to do va_args twice and in some ABIs (e.g,, CheriABI) you can't access fixed arguments as varargs if you weren't called with varargs signature. Reviewed by: imp, kib, jhibbits Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D45126 --- lib/libthr/thread/thr_private.h | 4 ++-- lib/libthr/thread/thr_syscalls.c | 25 +++++-------------------- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h index f89941f96c78..de65e8e7353d 100644 --- a/lib/libthr/thread/thr_private.h +++ b/lib/libthr/thread/thr_private.h @@ -864,8 +864,8 @@ int _pthread_mutexattr_setrobust(pthread_mutexattr_t * _Nonnull, int); /* #include */ #ifdef _SYS_FCNTL_H_ #ifndef _LIBC_PRIVATE_H_ -int __sys_fcntl(int, int, ...); -int __sys_openat(int, const char *, int, ...); +int __sys_fcntl(int, int, intptr_t); +int __sys_openat(int, const char *, int, int); #endif /* _LIBC_PRIVATE_H_ */ #endif /* _SYS_FCNTL_H_ */ diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c index ba07c92576c2..22f9c1f68ec2 100644 --- a/lib/libthr/thread/thr_syscalls.c +++ b/lib/libthr/thread/thr_syscalls.c @@ -188,22 +188,19 @@ __thr_connect(int fd, const struct sockaddr *name, socklen_t namelen) * if it is canceled. */ static int -__thr_fcntl(int fd, int cmd, ...) +__thr_fcntl(int fd, int cmd, __intptr_t arg) { struct pthread *curthread; int ret; - va_list ap; curthread = _get_curthread(); - va_start(ap, cmd); if (cmd == F_OSETLKW || cmd == F_SETLKW) { _thr_cancel_enter(curthread); - ret = __sys_fcntl(fd, cmd, (intptr_t)va_arg(ap, void *)); + ret = __sys_fcntl(fd, cmd, arg); _thr_cancel_leave(curthread, ret == -1); } else { - ret = __sys_fcntl(fd, cmd, (intptr_t)va_arg(ap, void *)); + ret = __sys_fcntl(fd, cmd, arg); } - va_end(ap); return (ret); } @@ -294,23 +291,11 @@ __thr_nanosleep(const struct timespec *time_to_sleep, * If the thread is canceled, file is not opened. */ static int -__thr_openat(int fd, const char *path, int flags, ...) +__thr_openat(int fd, const char *path, int flags, int mode) { struct pthread *curthread; - int mode, ret; - va_list ap; + int ret; - - /* Check if the file is being created: */ - if ((flags & O_CREAT) != 0) { - /* Get the creation mode: */ - va_start(ap, flags); - mode = va_arg(ap, int); - va_end(ap); - } else { - mode = 0; - } - curthread = _get_curthread(); _thr_cancel_enter(curthread); ret = __sys_openat(fd, path, flags, mode);