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
This commit is contained in:
Brooks Davis 2024-03-19 21:52:39 +00:00
parent cab73e5305
commit d0efabdf15
5 changed files with 10 additions and 10 deletions

View file

@ -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 *);

View file

@ -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);

View file

@ -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) {
/*

View file

@ -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);
}

View file

@ -616,7 +616,7 @@
int fcntl(
int fd,
int cmd,
long arg
intptr_t arg
);
}
; XXX should be { int fcntl(int fd, int cmd, ...); }