From nobody Tue Mar 19 23:15:57 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 4Tzndp2vTZz5FkQt; Tue, 19 Mar 2024 23:15:58 +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 4Tzndn6qhhz4JYF; Tue, 19 Mar 2024 23:15:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710890158; 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=2Ym4F/fk6iRFpqB6JM/fP58ohLiQmgaivPu4MTxxyJU=; b=Qc1UzreEQZq/a+DXU2uaQjDtIO5PM79DY9PQxx0T7dX7vj1Km9Lyg1CrI1FkYnt34j1ZOP oPs+YipIGoDZ/hmXJRhrUjb5P+1w2QtpUoq2nnRf8AedC8kjO/ZJ9Zl19itQENL/6Q5uL5 RNZKdgeuHdWXYh7F1cCLjbUfG7USbiBx2jM41F69y7fIrypLdwQ6n6iMs7lwBfkwq4CwCU DL74aed/y+4MuUDGMscBj3vFr8xGL8TDADKpA5sOd3PKlNHM7cnYvciwSEilzgMCCdxNA/ rcHWTSdUTnkOsb6ZbDZ//+1XvKiNf8X3Q5a4i0bAokoOzxODd/Z1Fs390UbzAg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710890158; a=rsa-sha256; cv=none; b=IxukVUdBf3gD3CAcIq48H4AN7IlmF1tsMP7vQZsOXSNNc//oYOGG95sajO6+uyxjenJs4L l/rYPcg/jW8PDaHiJxGs66h9zZ1HETWs9geaslKKqN7dJHMzJFeDlsmQoW1ASCZzzUbSqk gbhQSBIjA/ise3LbnCKUO+xwU5paYzQh4qTsh6+MeUOti0GrdmLC05TSzE6Ul+keerXLtX v03ctZzkfHdX3OQ5qXMj4oQ7wmFjQLGAoGErWXyAzBZAyNbLCajyNpKfW/1XSlvQkSvXAw f37ohl25FV+Fs7iDU2eeAJ0JK+Nb2cRpQt16vPLxv7MJAXF6BAo9H7zys6Xy9w== 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=1710890158; 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=2Ym4F/fk6iRFpqB6JM/fP58ohLiQmgaivPu4MTxxyJU=; b=u3G2RLZ1yM7FotXslSg5l/Ki89qNk8G3gxVLu76KsgHsnvbDcYX/9LQQN0pahPtor0cKvl vvkUoY2IS4Ch6PGMU4ilVxqgBHR1Cez3QQ39DJu4CNQFvY3dGXnrgqaR8M17EyShKmQJPm UH1rhLUAJ45KWJEmsGsMopoj/EYEdwio49HzfpCwD8QirHyt0iZzSRphsJgz6bYBsAporP Jst5iuzeH44/yWhEuY89l3DgWTC3Wf7idsRqmrKCWd/VcQ/T4OK2VcwUDzCYAVbV3dtdT1 QQRvSgGOew5HtiJ9anOPAIz5JIoqw85yULudHGkpMtd5klbZbZkD52frKgRc9Q== 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 4Tzndn6RpNzRxT; Tue, 19 Mar 2024 23:15:57 +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 42JNFvSj079230; Tue, 19 Mar 2024 23:15:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42JNFvc8079227; Tue, 19 Mar 2024 23:15:57 GMT (envelope-from git) Date: Tue, 19 Mar 2024 23:15:57 GMT Message-Id: <202403192315.42JNFvc8079227@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: d0efabdf15d9 - main - syscalls.master: make __sys_fcntl take an intptr_t 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: 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: d0efabdf15d956e9bc0414356ed798ca3c846e08 Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=d0efabdf15d956e9bc0414356ed798ca3c846e08 commit d0efabdf15d956e9bc0414356ed798ca3c846e08 Author: Brooks Davis AuthorDate: 2024-03-19 21:52:39 +0000 Commit: Brooks Davis CommitDate: 2024-03-19 23:13:26 +0000 syscalls.master: make __sys_fcntl take an intptr_t The (optional) third argument of fcntl is sometimes a pointer so change the type to intptr_t. Update the libc-internal defintion (actually used by libthr) to take a fixed intptr_t argument rather than pretending it's a variadic function. (That worked because all supported architectures pass variadic arguments as though the function was declared with those types. In CheriBSD that changes because variadic arguments are passed via a bounded array.) Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D44381 --- lib/libc/include/libc_private.h | 2 +- lib/libthr/thread/thr_syscalls.c | 4 ++-- sys/compat/freebsd32/freebsd32_misc.c | 2 +- sys/kern/kern_descrip.c | 10 +++++----- sys/kern/syscalls.master | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index b3f31f6e4e87..629889a6ff17 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -344,7 +344,7 @@ int __sys_clock_nanosleep(__clockid_t, int, int __sys_close(int); int __sys_close_range(unsigned, unsigned, int); int __sys_connect(int, const struct sockaddr *, __socklen_t); -int __sys_fcntl(int, int, ...); +int __sys_fcntl(int, int, __intptr_t); int __sys_fdatasync(int); int __sys_fstat(int fd, struct stat *); int __sys_fstatfs(int fd, struct statfs *); diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c index c931f2cc310e..348825cd6198 100644 --- a/lib/libthr/thread/thr_syscalls.c +++ b/lib/libthr/thread/thr_syscalls.c @@ -198,10 +198,10 @@ __thr_fcntl(int fd, int cmd, ...) va_start(ap, cmd); if (cmd == F_OSETLKW || cmd == F_SETLKW) { _thr_cancel_enter(curthread); - ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); + ret = __sys_fcntl(fd, cmd, (intptr_t)va_arg(ap, void *)); _thr_cancel_leave(curthread, ret == -1); } else { - ret = __sys_fcntl(fd, cmd, va_arg(ap, void *)); + ret = __sys_fcntl(fd, cmd, (intptr_t)va_arg(ap, void *)); } va_end(ap); diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 6c703f14e408..e6aea3acdecd 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -3942,7 +3942,7 @@ freebsd32_procctl(struct thread *td, struct freebsd32_procctl_args *uap) int freebsd32_fcntl(struct thread *td, struct freebsd32_fcntl_args *uap) { - long tmp; + intptr_t tmp; switch (uap->cmd) { /* diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 65b1f74d310b..7f9318a7ceda 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -414,7 +414,7 @@ sys_fcntl(struct thread *td, struct fcntl_args *uap) } int -kern_fcntl_freebsd(struct thread *td, int fd, int cmd, long arg) +kern_fcntl_freebsd(struct thread *td, int fd, int cmd, intptr_t arg) { struct flock fl; struct __oflock ofl; @@ -430,7 +430,7 @@ kern_fcntl_freebsd(struct thread *td, int fd, int cmd, long arg) /* * Convert old flock structure to new. */ - error = copyin((void *)(intptr_t)arg, &ofl, sizeof(ofl)); + error = copyin((void *)arg, &ofl, sizeof(ofl)); fl.l_start = ofl.l_start; fl.l_len = ofl.l_len; fl.l_pid = ofl.l_pid; @@ -455,7 +455,7 @@ kern_fcntl_freebsd(struct thread *td, int fd, int cmd, long arg) case F_SETLK: case F_SETLKW: case F_SETLK_REMOTE: - error = copyin((void *)(intptr_t)arg, &fl, sizeof(fl)); + error = copyin((void *)arg, &fl, sizeof(fl)); arg1 = (intptr_t)&fl; break; default: @@ -473,9 +473,9 @@ kern_fcntl_freebsd(struct thread *td, int fd, int cmd, long arg) ofl.l_pid = fl.l_pid; ofl.l_type = fl.l_type; ofl.l_whence = fl.l_whence; - error = copyout(&ofl, (void *)(intptr_t)arg, sizeof(ofl)); + error = copyout(&ofl, (void *)arg, sizeof(ofl)); } else if (cmd == F_GETLK) { - error = copyout(&fl, (void *)(intptr_t)arg, sizeof(fl)); + error = copyout(&fl, (void *)arg, sizeof(fl)); } return (error); } diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 874223f6f238..c5485294dcd0 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -616,7 +616,7 @@ int fcntl( int fd, int cmd, - long arg + intptr_t arg ); } ; XXX should be { int fcntl(int fd, int cmd, ...); }