diff --git a/src/libvmssys/arch/alpha/syscall_vms.c b/src/libvmssys/arch/alpha/syscall_vms.c index 10b3421e1..fed0a4294 100644 --- a/src/libvmssys/arch/alpha/syscall_vms.c +++ b/src/libvmssys/arch/alpha/syscall_vms.c @@ -24,19 +24,20 @@ * contract vms_syscall.h's wrappers expect. This backend does NOT fake success * (INV-6): a failed syscall returns a genuine negative errno. * - * KNOWN RUNTIME GAP — LLP64 pointer width (tracked as vms-1fc, which BLOCKS the - * rung-4 runtime proof vms-f49). vms_syscall.h declares these as `long`, and its - * vms_sys_* wrappers cast pointer arguments through `(long)`. On the - * alpha-dec-vms LLP64 model `long` is 32 bits while the Linux-Alpha kernel - * takes full 64-bit register arguments, so a pointer argument is truncated — - * the same class of bug the musl port fixed by widening its syscall_arg_t to - * `long long` (syscall_arch.h). Rung 1's deliverable is BUILD + STRICT-LINK - * only; this trampoline faithfully passes whatever width it is handed and links - * clean. Making the transport RUN correctly requires widening the alpha - * vms_syscall.h path to `long long` (arch-isolated: `long long` == `long` on - * the alpha-linux-gnu LP64 build, so it is safe there too) — filed as vms-1fc, - * landing with the un-fakeable /dev/vms runtime proof in rung 4 (vms-f49); NOT - * papered over here. + * LLP64 pointer width — FIXED (vms-1fc, landing with the rung-4 runtime proof + * vms-f49). vms_syscall.h formerly declared these as `long` and its vms_sys_* + * wrappers cast pointer arguments through `(long)`. On the alpha-dec-vms LLP64 + * model `long` is 32 bits while the Linux-Alpha kernel takes full 64-bit + * register arguments, so a pointer argument was truncated — the same class of + * bug the musl port fixed by widening its syscall_arg_t to `long long` + * (syscall_arch.h). vms-1fc widened the whole raw-syscall path to a + * guaranteed-64-bit `vms_reg_t` (== `long long`): the header's trampoline + * prototypes + vms_sys_* pointer casts, and these definitions below. It is + * arch-isolated — `long long` == `long` on the LP64 builds (x86_64/aarch64/ + * alpha-linux-gnu), so the codegen there is byte-identical, and it is the + * actual fix only on alpha-dec-vms. The rung-4 proof (vms-f49) is what + * VALIDATES it: a truncated pointer makes the RMS-routed fopen write nothing, + * so the independent ODS-2 reader would see no file. */ #if defined(__alpha__) @@ -65,29 +66,37 @@ static long long vms_alpha_callsys(long long n, long long a1, long long a2, return r0; } -/* The __vms_syscallN signatures MATCH vms_syscall.h's `extern long` prototypes - * so the declaration and definition agree at link. Each shifts nr -> $0 and - * a1..aN -> $16.. and traps. (The LLP64 width of `long` here is the documented - * rung-4 gap above; the trampoline itself is faithful.) */ -long __vms_syscall0(long nr) -{ return (long)vms_alpha_callsys(nr, 0, 0, 0, 0, 0, 0); } +/* The __vms_syscallN signatures MATCH vms_syscall.h's `extern vms_reg_t` + * prototypes (vms_reg_t == `long long` == a full 64-bit register word) so the + * declaration and definition agree at link. Each shifts nr -> $0 and a1..aN -> + * $16.. and traps. This is the vms-1fc width fix: on the alpha-dec-vms LLP64 + * model `long` is 32 bits, so the earlier `long` prototype TRUNCATED every + * pointer argument the kif transport passes (ioctl(/dev/vms,...) then hit a + * truncated address and the RMS write reached nothing). `long long` is 64 bits + * on every raw-syscall target, so the trampoline now passes the full-width + * register value the Linux/Alpha kernel expects. (vms_reg_t is spelled out as + * `long long` here rather than pulled from vms_syscall.h to keep this leaf TU + * free of the whole syscall-number/wrapper header; the two spellings are the + * identical type, so declaration and definition agree at link on every arch.) */ +long long __vms_syscall0(long long nr) +{ return vms_alpha_callsys(nr, 0, 0, 0, 0, 0, 0); } -long __vms_syscall1(long nr, long a1) -{ return (long)vms_alpha_callsys(nr, a1, 0, 0, 0, 0, 0); } +long long __vms_syscall1(long long nr, long long a1) +{ return vms_alpha_callsys(nr, a1, 0, 0, 0, 0, 0); } -long __vms_syscall2(long nr, long a1, long a2) -{ return (long)vms_alpha_callsys(nr, a1, a2, 0, 0, 0, 0); } +long long __vms_syscall2(long long nr, long long a1, long long a2) +{ return vms_alpha_callsys(nr, a1, a2, 0, 0, 0, 0); } -long __vms_syscall3(long nr, long a1, long a2, long a3) -{ return (long)vms_alpha_callsys(nr, a1, a2, a3, 0, 0, 0); } +long long __vms_syscall3(long long nr, long long a1, long long a2, long long a3) +{ return vms_alpha_callsys(nr, a1, a2, a3, 0, 0, 0); } -long __vms_syscall4(long nr, long a1, long a2, long a3, long a4) -{ return (long)vms_alpha_callsys(nr, a1, a2, a3, a4, 0, 0); } +long long __vms_syscall4(long long nr, long long a1, long long a2, long long a3, long long a4) +{ return vms_alpha_callsys(nr, a1, a2, a3, a4, 0, 0); } -long __vms_syscall5(long nr, long a1, long a2, long a3, long a4, long a5) -{ return (long)vms_alpha_callsys(nr, a1, a2, a3, a4, a5, 0); } +long long __vms_syscall5(long long nr, long long a1, long long a2, long long a3, long long a4, long long a5) +{ return vms_alpha_callsys(nr, a1, a2, a3, a4, a5, 0); } -long __vms_syscall6(long nr, long a1, long a2, long a3, long a4, long a5, long a6) -{ return (long)vms_alpha_callsys(nr, a1, a2, a3, a4, a5, a6); } +long long __vms_syscall6(long long nr, long long a1, long long a2, long long a3, long long a4, long long a5, long long a6) +{ return vms_alpha_callsys(nr, a1, a2, a3, a4, a5, a6); } #endif /* __alpha__ */ diff --git a/src/libvmssys/kif_transport_linux.c b/src/libvmssys/kif_transport_linux.c index cbe330b1c..9acb6223e 100644 --- a/src/libvmssys/kif_transport_linux.c +++ b/src/libvmssys/kif_transport_linux.c @@ -51,7 +51,14 @@ void kif_xport_dev_close(int fd) int kif_xport_ioctl(int fd, unsigned long req, void *arg) { - return vms_sys_ioctl(fd, req, (unsigned long)arg); + /* vms-1fc: cast the request-block pointer through vms_reg_t (a + * guaranteed-64-bit register word), NOT `unsigned long`. On the + * alpha-dec-vms LLP64 model `unsigned long` is 32 bits, so `(unsigned + * long)arg` truncated the high half of `arg` and the executive's + * copy_from_user read from a garbage address -- the RMS write reached + * nothing. This is THE /dev/vms pointer the rung-4 proof (vms-f49) exercises. + * No-op on the LP64 targets (vms_reg_t == unsigned long in width there). */ + return vms_sys_ioctl(fd, req, (vms_reg_t)arg); } void *kif_xport_mmap(int fd, unsigned long length, unsigned long offset) diff --git a/src/libvmssys/vms_syscall.h b/src/libvmssys/vms_syscall.h index c7b6e3d26..41c03c1d3 100644 --- a/src/libvmssys/vms_syscall.h +++ b/src/libvmssys/vms_syscall.h @@ -255,13 +255,35 @@ * Assembly trampoline declarations * ================================================================ */ -extern long __vms_syscall0(long nr); -extern long __vms_syscall1(long nr, long a1); -extern long __vms_syscall2(long nr, long a1, long a2); -extern long __vms_syscall3(long nr, long a1, long a2, long a3); -extern long __vms_syscall4(long nr, long a1, long a2, long a3, long a4); -extern long __vms_syscall5(long nr, long a1, long a2, long a3, long a4, long a5); -extern long __vms_syscall6(long nr, long a1, long a2, long a3, long a4, long a5, long a6); +/* + * vms_reg_t -- a guaranteed-64-bit syscall register word (vms-1fc). + * + * The __vms_syscallN trampolines shift their arguments straight into the + * kernel's argument registers ($16.. on Alpha, rdi.. on x86_64), which are ALL + * 64 bits wide on every target the raw-syscall path is compiled for. Declaring + * these as `long` was correct on the three LP64 targets but WRONG on the + * alpha-dec-vms LLP64 model, where `long` is only 32 bits: a pointer argument + * cast through `(vms_reg_t)` lost its high half, so the kif transport's + * ioctl(/dev/vms, ...) landed on a truncated/garbage address and the RMS write + * reached nothing (vms-1fc, the runtime bug the rung-4 proof vms-f49 pins). + * `long long` is 64 bits on ALL FOUR raw-syscall targets -- x86_64, aarch64, + * alpha-linux-gnu (LP64) and alpha-dec-vms (LLP64) -- so it is the correct + * register-width word everywhere. On the three LP64 targets `long long` has the + * exact same representation and ABI as `long`, so widening to it is a strict + * no-op there (byte-identical codegen); it is the ACTUAL fix only on the + * alpha-dec-vms cc1. (VAX takes an entirely different path -- see the __NetBSD__ + * branch at the top of this file, which includes arch/vax/vms_syscall_netbsd.h + * and compiles NONE of these declarations -- so VAX is untouched by definition.) + */ +typedef long long vms_reg_t; + +extern vms_reg_t __vms_syscall0(vms_reg_t nr); +extern vms_reg_t __vms_syscall1(vms_reg_t nr, vms_reg_t a1); +extern vms_reg_t __vms_syscall2(vms_reg_t nr, vms_reg_t a1, vms_reg_t a2); +extern vms_reg_t __vms_syscall3(vms_reg_t nr, vms_reg_t a1, vms_reg_t a2, vms_reg_t a3); +extern vms_reg_t __vms_syscall4(vms_reg_t nr, vms_reg_t a1, vms_reg_t a2, vms_reg_t a3, vms_reg_t a4); +extern vms_reg_t __vms_syscall5(vms_reg_t nr, vms_reg_t a1, vms_reg_t a2, vms_reg_t a3, vms_reg_t a4, vms_reg_t a5); +extern vms_reg_t __vms_syscall6(vms_reg_t nr, vms_reg_t a1, vms_reg_t a2, vms_reg_t a3, vms_reg_t a4, vms_reg_t a5, vms_reg_t a6); /* ================================================================ * File I/O @@ -269,7 +291,7 @@ extern long __vms_syscall6(long nr, long a1, long a2, long a3, long a4, long a5, static inline int vms_sys_openat(int dirfd, const char *path, int flags, vms_mode_t mode) { - return (int)__vms_syscall4(__NR_openat, dirfd, (long)path, flags, mode); + return (int)__vms_syscall4(__NR_openat, dirfd, (vms_reg_t)path, flags, mode); } static inline int vms_sys_close(int fd) @@ -279,12 +301,12 @@ static inline int vms_sys_close(int fd) static inline vms_ssize_t vms_sys_read(int fd, void *buf, vms_size_t count) { - return (vms_ssize_t)__vms_syscall3(__NR_read, fd, (long)buf, count); + return (vms_ssize_t)__vms_syscall3(__NR_read, fd, (vms_reg_t)buf, count); } static inline vms_ssize_t vms_sys_write(int fd, const void *buf, vms_size_t count) { - return (vms_ssize_t)__vms_syscall3(__NR_write, fd, (long)buf, count); + return (vms_ssize_t)__vms_syscall3(__NR_write, fd, (vms_reg_t)buf, count); } static inline vms_off_t vms_sys_lseek(int fd, vms_off_t offset, int whence) @@ -298,15 +320,15 @@ static inline int vms_sys_fstat(int fd, struct vms_stat *buf) /* stat64 pair: __NR_fstat (91) fills the OLD struct stat, which does * not match the stat64-shaped struct vms_stat defined for Alpha in * vms_types.h. Use __NR_fstat64 (427) instead. */ - return (int)__vms_syscall2(__NR_fstat64, fd, (long)buf); + return (int)__vms_syscall2(__NR_fstat64, fd, (vms_reg_t)buf); #else - return (int)__vms_syscall2(__NR_fstat, fd, (long)buf); + return (int)__vms_syscall2(__NR_fstat, fd, (vms_reg_t)buf); #endif } static inline int vms_sys_newfstatat(int dirfd, const char *path, struct vms_stat *buf, int flags) { - return (int)__vms_syscall4(__NR_newfstatat, dirfd, (long)path, (long)buf, flags); + return (int)__vms_syscall4(__NR_newfstatat, dirfd, (vms_reg_t)path, (vms_reg_t)buf, flags); } static inline int vms_sys_ftruncate(int fd, vms_off_t length) @@ -331,24 +353,24 @@ static inline int vms_sys_fcntl(int fd, int cmd, long arg) static inline int vms_sys_unlinkat(int dirfd, const char *path, int flags) { - return (int)__vms_syscall3(__NR_unlinkat, dirfd, (long)path, flags); + return (int)__vms_syscall3(__NR_unlinkat, dirfd, (vms_reg_t)path, flags); } static inline int vms_sys_renameat2(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, unsigned int flags) { - return (int)__vms_syscall5(__NR_renameat2, olddirfd, (long)oldpath, - newdirfd, (long)newpath, flags); + return (int)__vms_syscall5(__NR_renameat2, olddirfd, (vms_reg_t)oldpath, + newdirfd, (vms_reg_t)newpath, flags); } static inline int vms_sys_mkdirat(int dirfd, const char *path, vms_mode_t mode) { - return (int)__vms_syscall3(__NR_mkdirat, dirfd, (long)path, mode); + return (int)__vms_syscall3(__NR_mkdirat, dirfd, (vms_reg_t)path, mode); } static inline vms_ssize_t vms_sys_getdents64(int fd, void *dirp, vms_size_t count) { - return (vms_ssize_t)__vms_syscall3(__NR_getdents64, fd, (long)dirp, count); + return (vms_ssize_t)__vms_syscall3(__NR_getdents64, fd, (vms_reg_t)dirp, count); } /* ================================================================ @@ -358,27 +380,27 @@ static inline vms_ssize_t vms_sys_getdents64(int fd, void *dirp, vms_size_t coun static inline void *vms_sys_mmap(void *addr, vms_size_t length, int prot, int flags, int fd, vms_off_t offset) { - return (void *)__vms_syscall6(__NR_mmap, (long)addr, length, prot, flags, fd, offset); + return (void *)__vms_syscall6(__NR_mmap, (vms_reg_t)addr, length, prot, flags, fd, offset); } static inline int vms_sys_munmap(void *addr, vms_size_t length) { - return (int)__vms_syscall2(__NR_munmap, (long)addr, length); + return (int)__vms_syscall2(__NR_munmap, (vms_reg_t)addr, length); } static inline int vms_sys_mprotect(void *addr, vms_size_t length, int prot) { - return (int)__vms_syscall3(__NR_mprotect, (long)addr, length, prot); + return (int)__vms_syscall3(__NR_mprotect, (vms_reg_t)addr, length, prot); } static inline long vms_sys_brk(void *addr) { - return __vms_syscall1(__NR_brk, (long)addr); + return __vms_syscall1(__NR_brk, (vms_reg_t)addr); } static inline int vms_sys_madvise(void *addr, vms_size_t length, int advice) { - return (int)__vms_syscall3(__NR_madvise, (long)addr, length, advice); + return (int)__vms_syscall3(__NR_madvise, (vms_reg_t)addr, length, advice); } /* ================================================================ @@ -388,14 +410,14 @@ static inline int vms_sys_madvise(void *addr, vms_size_t length, int advice) static inline long vms_sys_clone(unsigned long flags, void *stack, int *parent_tid, int *child_tid, unsigned long tls) { - return __vms_syscall5(__NR_clone, flags, (long)stack, - (long)parent_tid, (long)child_tid, tls); + return __vms_syscall5(__NR_clone, flags, (vms_reg_t)stack, + (vms_reg_t)parent_tid, (vms_reg_t)child_tid, tls); } static inline int vms_sys_execve(const char *filename, char *const argv[], char *const envp[]) { - return (int)__vms_syscall3(__NR_execve, (long)filename, (long)argv, (long)envp); + return (int)__vms_syscall3(__NR_execve, (vms_reg_t)filename, (vms_reg_t)argv, (vms_reg_t)envp); } static inline void vms_sys_exit_group(int status) @@ -413,7 +435,7 @@ static inline void vms_sys_exit(int status) static inline vms_pid_t vms_sys_wait4(vms_pid_t pid, int *wstatus, int options, struct vms_rusage *rusage) { - return (vms_pid_t)__vms_syscall4(__NR_wait4, pid, (long)wstatus, options, (long)rusage); + return (vms_pid_t)__vms_syscall4(__NR_wait4, pid, (vms_reg_t)wstatus, options, (vms_reg_t)rusage); } static inline int vms_sys_kill(vms_pid_t pid, int sig) @@ -468,17 +490,17 @@ static inline int vms_sys_rt_sigaction(int signum, const struct vms_sigaction *a * __vms_rt_sigreturn unconditionally is harmless when act == NULL * (query-only mode): the kernel only consults ka_restorer inside the * `if (act)` branch of sys_rt_sigaction. */ - return (int)__vms_syscall5(__NR_rt_sigaction, signum, (long)act, (long)oldact, - sigsetsize, (long)__vms_rt_sigreturn); + return (int)__vms_syscall5(__NR_rt_sigaction, signum, (vms_reg_t)act, (vms_reg_t)oldact, + sigsetsize, (vms_reg_t)__vms_rt_sigreturn); #else - return (int)__vms_syscall4(__NR_rt_sigaction, signum, (long)act, (long)oldact, sigsetsize); + return (int)__vms_syscall4(__NR_rt_sigaction, signum, (vms_reg_t)act, (vms_reg_t)oldact, sigsetsize); #endif } static inline int vms_sys_rt_sigprocmask(int how, const vms_sigset_t *set, vms_sigset_t *oldset, vms_size_t sigsetsize) { - return (int)__vms_syscall4(__NR_rt_sigprocmask, how, (long)set, (long)oldset, sigsetsize); + return (int)__vms_syscall4(__NR_rt_sigprocmask, how, (vms_reg_t)set, (vms_reg_t)oldset, sigsetsize); } /* ================================================================ @@ -489,8 +511,8 @@ static inline long vms_sys_futex(uint32_t *uaddr, int futex_op, uint32_t val, const struct vms_timespec *timeout, uint32_t *uaddr2, uint32_t val3) { - return __vms_syscall6(__NR_futex, (long)uaddr, futex_op, val, - (long)timeout, (long)uaddr2, val3); + return __vms_syscall6(__NR_futex, (vms_reg_t)uaddr, futex_op, val, + (vms_reg_t)timeout, (vms_reg_t)uaddr2, val3); } /* ================================================================ @@ -499,7 +521,7 @@ static inline long vms_sys_futex(uint32_t *uaddr, int futex_op, uint32_t val, static inline int vms_sys_clock_gettime(vms_clockid_t clockid, struct vms_timespec *tp) { - return (int)__vms_syscall2(__NR_clock_gettime, clockid, (long)tp); + return (int)__vms_syscall2(__NR_clock_gettime, clockid, (vms_reg_t)tp); } static inline int vms_sys_clock_nanosleep(vms_clockid_t clockid, int flags, @@ -507,14 +529,14 @@ static inline int vms_sys_clock_nanosleep(vms_clockid_t clockid, int flags, struct vms_timespec *remain) { return (int)__vms_syscall4(__NR_clock_nanosleep, clockid, flags, - (long)request, (long)remain); + (vms_reg_t)request, (vms_reg_t)remain); } static inline int vms_sys_timer_create(vms_clockid_t clockid, struct vms_sigevent *sevp, vms_timer_t *timerid) { - return (int)__vms_syscall3(__NR_timer_create, clockid, (long)sevp, (long)timerid); + return (int)__vms_syscall3(__NR_timer_create, clockid, (vms_reg_t)sevp, (vms_reg_t)timerid); } static inline int vms_sys_timer_settime(vms_timer_t timerid, int flags, @@ -522,7 +544,7 @@ static inline int vms_sys_timer_settime(vms_timer_t timerid, int flags, struct vms_itimerspec *old_value) { return (int)__vms_syscall4(__NR_timer_settime, timerid, flags, - (long)new_value, (long)old_value); + (vms_reg_t)new_value, (vms_reg_t)old_value); } static inline int vms_sys_timer_delete(vms_timer_t timerid) @@ -532,7 +554,7 @@ static inline int vms_sys_timer_delete(vms_timer_t timerid) static inline int vms_sys_nanosleep(const struct vms_timespec *req, struct vms_timespec *rem) { - return (int)__vms_syscall2(__NR_nanosleep, (long)req, (long)rem); + return (int)__vms_syscall2(__NR_nanosleep, (vms_reg_t)req, (vms_reg_t)rem); } /* ================================================================ @@ -546,7 +568,7 @@ static inline int vms_sys_socket(int domain, int type, int protocol) static inline int vms_sys_bind(int sockfd, const void *addr, uint32_t addrlen) { - return (int)__vms_syscall3(__NR_bind, sockfd, (long)addr, addrlen); + return (int)__vms_syscall3(__NR_bind, sockfd, (vms_reg_t)addr, addrlen); } static inline int vms_sys_listen(int sockfd, int backlog) @@ -556,26 +578,26 @@ static inline int vms_sys_listen(int sockfd, int backlog) static inline int vms_sys_accept4(int sockfd, void *addr, uint32_t *addrlen, int flags) { - return (int)__vms_syscall4(__NR_accept4, sockfd, (long)addr, (long)addrlen, flags); + return (int)__vms_syscall4(__NR_accept4, sockfd, (vms_reg_t)addr, (vms_reg_t)addrlen, flags); } static inline int vms_sys_connect(int sockfd, const void *addr, uint32_t addrlen) { - return (int)__vms_syscall3(__NR_connect, sockfd, (long)addr, addrlen); + return (int)__vms_syscall3(__NR_connect, sockfd, (vms_reg_t)addr, addrlen); } static inline vms_ssize_t vms_sys_sendto(int sockfd, const void *buf, vms_size_t len, int flags, const void *dest_addr, uint32_t addrlen) { - return (vms_ssize_t)__vms_syscall6(__NR_sendto, sockfd, (long)buf, len, - flags, (long)dest_addr, addrlen); + return (vms_ssize_t)__vms_syscall6(__NR_sendto, sockfd, (vms_reg_t)buf, len, + flags, (vms_reg_t)dest_addr, addrlen); } static inline vms_ssize_t vms_sys_recvfrom(int sockfd, void *buf, vms_size_t len, int flags, void *src_addr, uint32_t *addrlen) { - return (vms_ssize_t)__vms_syscall6(__NR_recvfrom, sockfd, (long)buf, len, - flags, (long)src_addr, (long)addrlen); + return (vms_ssize_t)__vms_syscall6(__NR_recvfrom, sockfd, (vms_reg_t)buf, len, + flags, (vms_reg_t)src_addr, (vms_reg_t)addrlen); } /* ================================================================ @@ -584,27 +606,33 @@ static inline vms_ssize_t vms_sys_recvfrom(int sockfd, void *buf, vms_size_t len static inline int vms_sys_uname(struct vms_utsname *buf) { - return (int)__vms_syscall1(__NR_uname, (long)buf); + return (int)__vms_syscall1(__NR_uname, (vms_reg_t)buf); } static inline int vms_sys_sysinfo(struct vms_sysinfo *info) { - return (int)__vms_syscall1(__NR_sysinfo, (long)info); + return (int)__vms_syscall1(__NR_sysinfo, (vms_reg_t)info); } -static inline int vms_sys_ioctl(int fd, unsigned long request, unsigned long arg) +static inline int vms_sys_ioctl(int fd, unsigned long request, vms_reg_t arg) { + /* vms-1fc: `arg` is a guaranteed-64-bit register word, NOT `unsigned long` + * -- on the alpha-dec-vms LLP64 model `unsigned long` is 32 bits, which + * truncated the pointer the /dev/vms transport passes here (the RMS-over-ACP + * write path: ioctl(/dev/vms, VMS_IOCTL_*, &kif_request)). Callers cast the + * pointer through vms_reg_t so its high half survives. No-op on the LP64 + * targets, where vms_reg_t == unsigned long in width. */ return (int)__vms_syscall3(__NR_ioctl, fd, request, arg); } static inline vms_ssize_t vms_sys_getcwd(char *buf, vms_size_t size) { - return (vms_ssize_t)__vms_syscall2(__NR_getcwd, (long)buf, size); + return (vms_ssize_t)__vms_syscall2(__NR_getcwd, (vms_reg_t)buf, size); } static inline int vms_sys_chdir(const char *path) { - return (int)__vms_syscall1(__NR_chdir, (long)path); + return (int)__vms_syscall1(__NR_chdir, (vms_reg_t)path); } /* ================================================================ @@ -613,7 +641,7 @@ static inline int vms_sys_chdir(const char *path) static inline int vms_sys_io_uring_setup(uint32_t entries, struct vms_io_uring_params *p) { - return (int)__vms_syscall2(__NR_io_uring_setup, entries, (long)p); + return (int)__vms_syscall2(__NR_io_uring_setup, entries, (vms_reg_t)p); } static inline int vms_sys_io_uring_enter(int ring_fd, uint32_t to_submit, @@ -621,13 +649,13 @@ static inline int vms_sys_io_uring_enter(int ring_fd, uint32_t to_submit, const void *sig) { return (int)__vms_syscall5(__NR_io_uring_enter, ring_fd, to_submit, - min_complete, flags, (long)sig); + min_complete, flags, (vms_reg_t)sig); } static inline int vms_sys_io_uring_register(int ring_fd, uint32_t opcode, const void *arg, uint32_t nr_args) { - return (int)__vms_syscall4(__NR_io_uring_register, ring_fd, opcode, (long)arg, nr_args); + return (int)__vms_syscall4(__NR_io_uring_register, ring_fd, opcode, (vms_reg_t)arg, nr_args); } /* ================================================================ @@ -643,12 +671,12 @@ static inline int vms_sys_arch_prctl(int code, unsigned long addr) static inline long vms_sys_set_tid_address(int *tidptr) { - return __vms_syscall1(__NR_set_tid_address, (long)tidptr); + return __vms_syscall1(__NR_set_tid_address, (vms_reg_t)tidptr); } static inline int vms_sys_set_robust_list(void *head, vms_size_t len) { - return (int)__vms_syscall2(__NR_set_robust_list, (long)head, len); + return (int)__vms_syscall2(__NR_set_robust_list, (vms_reg_t)head, len); } /* ================================================================ @@ -657,7 +685,7 @@ static inline int vms_sys_set_robust_list(void *head, vms_size_t len) static inline int vms_sys_pipe2(int pipefd[2], int flags) { - return (int)__vms_syscall2(__NR_pipe2, (long)pipefd, flags); + return (int)__vms_syscall2(__NR_pipe2, (vms_reg_t)pipefd, flags); } static inline int vms_sys_dup3(int oldfd, int newfd, int flags) diff --git a/src/vmstcpip/sockets/vms_bgsock.c b/src/vmstcpip/sockets/vms_bgsock.c index 2f125d39b..fab28f903 100644 --- a/src/vmstcpip/sockets/vms_bgsock.c +++ b/src/vmstcpip/sockets/vms_bgsock.c @@ -481,7 +481,7 @@ int ovmx_fd_getname(int fd, int peer, struct sockaddr *addr, socklen_t *addrlen) if (addr == NULL || addrlen == NULL) { errno = EFAULT; return -1; } memset(&a, 0, sizeof(a)); a.which = peer ? 1u : 0u; - if (vms_sys_ioctl(fd, VMS_IOCTL_BGCONN_GETNAME, (unsigned long)&a) != 0) + if (vms_sys_ioctl(fd, VMS_IOCTL_BGCONN_GETNAME, (vms_reg_t)&a) != 0) return 1; /* not a materialized [bgconn] fd */ if (!(a.status & 1)) { errno = ENOTCONN; return -1; } @@ -509,7 +509,7 @@ int ovmx_fd_setsockopt(int fd, int level, int optname, const void *optval, sockl a.level = level; a.optname = optname; a.optval = *(const int *)optval; - if (vms_sys_ioctl(fd, VMS_IOCTL_BGCONN_SOCKOPT, (unsigned long)&a) != 0) + if (vms_sys_ioctl(fd, VMS_IOCTL_BGCONN_SOCKOPT, (vms_reg_t)&a) != 0) return 1; /* not a materialized [bgconn] fd */ if (!(a.status & 1)) { errno = ENOPROTOOPT; return -1; } return 0; @@ -526,7 +526,7 @@ int ovmx_fd_getsockopt(int fd, int level, int optname, void *optval, socklen_t * a.op = 1; /* get */ a.level = level; a.optname = optname; - if (vms_sys_ioctl(fd, VMS_IOCTL_BGCONN_SOCKOPT, (unsigned long)&a) != 0) + if (vms_sys_ioctl(fd, VMS_IOCTL_BGCONN_SOCKOPT, (vms_reg_t)&a) != 0) return 1; /* not a materialized [bgconn] fd */ if (!(a.status & 1)) { errno = ENOPROTOOPT; return -1; } *(int *)optval = a.optval;