From nobody Fri Jun 17 19:31:53 2022 X-Original-To: dev-commits-src-all@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 CA41E853304; Fri, 17 Jun 2022 19:31:54 +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 4LPq1606R1z3K6S; Fri, 17 Jun 2022 19:31:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494314; 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=gyWfgWiCY32T9Ss8lCJW5ekzpI0dC0QWN5TdHKTlAco=; b=YundPaW6ig/x7J2K7+LrWVSw1FOBOpzv7wdpFTyQ8vDyc5Wg91Ng31P1vWYGvJDwlHZeZm LdHuz6OHzfkoDuK/wEvAVwZvEWhyxmn+uoKQMcQGwkXEKaXFmlsdqkBOj0YS7o1UX/VmLf jvt7LH0oKfHJvISxznPRjIg6kS+YcYTYF4283722i3iGYQXHO4+gxapNfDzbuyEJ8Ya+tH nSVH2ArPBMN5ofVWx3ujmOvhEcSkYPVWUIxjg+IKwtH6KWYJjmXO02vzH4GjuB11DSDSxs lRnwcVjeP5/qG+Q1HEfQFITAvvsgRpb9EUE/Oi+AhD5xXd+UHHVKqvfHmUEypw== 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 918BF259A4; Fri, 17 Jun 2022 19:31:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25HJVrOP007733; Fri, 17 Jun 2022 19:31:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJVr1t007732; Fri, 17 Jun 2022 19:31:53 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:31:53 GMT Message-Id: <202206171931.25HJVr1t007732@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 4250154ede1b - stable/13 - linux(4): Implement pselect6_time64 system call. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4250154ede1b791dc805f91c274af2dd8bd4a091 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494314; 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=gyWfgWiCY32T9Ss8lCJW5ekzpI0dC0QWN5TdHKTlAco=; b=vnDE+Z1YxoCHjVVctKa+saVEsxSpwqH1tXqDR9akHNrDNhLcNwi9xr9AFZVW/yjnqYWOXb Fy/eqq4H+bON42q5iRt/z7xrAUKKgeYuwWdF9lYZva3w6WLWvWNZc2EfOc6NKVHHigyg3w 0hGrjXxvmJkccwS+9x0/hm3Yu+sQw9pfrZ42iOIaKdmBwX5+pL53LN5szKT2ndLfInXrdo HCjp1gagi/NiAEirEI/0+ijCHraTNpiRBH/yr1p3KY7pY/vAiLpmjXT12HEY8IB2CXtNn6 9dranhyOq5P5Vj5KemObEqOT8OVR0sBETXEtn5lsxbI+Qk0Lg7cVNxM8o1ZlEg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494314; a=rsa-sha256; cv=none; b=kCvoMuTM27RQhHfk8T1xyhmEmNSsR+cT8jgjSY0/U7v6rvpEupl6d316OmDm5RO+EUpzDz djjGvpdFEA5wLmOFihQC1/zyrddezyg6utP+zLEF8GtxPMqPpp4Dmig2gORyL4qjOWGoNW 8n6UL0m/IKbdSbg/k2gyABaMfCJqUKAxnqVmqwyVDwXBWCcNSJTHioG2dk7uw86RKc7wDX DIIuVtkJncvdg6/Z3wJhdj9a6HoJie1pfW15cvZ6e40LmNHF5VBa1NM5MgAuozEssbKtP3 K1EBMK5TV2kbLuXg7gqYA6c8Jw/2F71hi4TVVgO+eVgdh4xUwrVvRCQjeeUGpg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=4250154ede1b791dc805f91c274af2dd8bd4a091 commit 4250154ede1b791dc805f91c274af2dd8bd4a091 Author: Dmitry Chagin AuthorDate: 2021-06-10 12:03:30 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:30:16 +0000 linux(4): Implement pselect6_time64 system call. MFC after: 2 weeks (cherry picked from commit f6d075ecd76925cbe56ea528a59bd74e4dd9451e) --- sys/amd64/linux32/linux32_dummy_machdep.c | 1 - sys/amd64/linux32/syscalls.master | 9 ++- sys/compat/linux/linux_misc.c | 96 ++++++++++++++++++++++++------- sys/i386/linux/linux_dummy_machdep.c | 1 - sys/i386/linux/syscalls.master | 9 ++- 5 files changed, 92 insertions(+), 24 deletions(-) diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index 837496641311..81e0ed51ae31 100644 --- a/sys/amd64/linux32/linux32_dummy_machdep.c +++ b/sys/amd64/linux32/linux32_dummy_machdep.c @@ -72,7 +72,6 @@ DUMMY(timer_gettime64); DUMMY(timer_settime64); DUMMY(timerfd_gettime64); DUMMY(timerfd_settime64); -DUMMY(pselect6_time64); DUMMY(ppoll_time64); DUMMY(io_pgetevents_time64); DUMMY(recvmmsg_time64); diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index 92c1c0e53cdc..ef89e331b429 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -2390,7 +2390,14 @@ ); } 413 AUE_NULL STD { - int linux_pselect6_time64(void); + int linux_pselect6_time64( + l_int nfds, + l_fd_set *readfds, + l_fd_set *writefds, + l_fd_set *exceptfds, + struct l_timespec64 *tsp, + l_uintptr_t *sig + ); } 414 AUE_NULL STD { int linux_ppoll_time64(void); diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 4549abbeb0eb..d7b38161f8ff 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -138,6 +138,9 @@ static int linux_utimensat_lts64_to_ts(struct l_timespec64 *, #endif static int linux_common_utimensat(struct thread *, int, const char *, struct timespec *, int); +static int linux_common_pselect6(struct thread *, l_int, + l_fd_set *, l_fd_set *, l_fd_set *, + struct timespec *, l_uintptr_t *); int linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args) @@ -2356,19 +2359,50 @@ linux_prlimit64(struct thread *td, struct linux_prlimit64_args *args) int linux_pselect6(struct thread *td, struct linux_pselect6_args *args) +{ + struct l_timespec lts; + struct timespec ts, *tsp; + int error; + + if (args->tsp != NULL) { + error = copyin(args->tsp, <s, sizeof(lts)); + if (error != 0) + return (error); + error = linux_to_native_timespec(&ts, <s); + if (error != 0) + return (error); + tsp = &ts; + } else + tsp = NULL; + + error = linux_common_pselect6(td, args->nfds, args->readfds, + args->writefds, args->exceptfds, tsp, args->sig); + if (error != 0) + return (error); + + if (args->tsp != NULL) { + error = native_to_linux_timespec(<s, tsp); + if (error == 0) + error = copyout(<s, args->tsp, sizeof(lts)); + } + return (error); +} + +static int +linux_common_pselect6(struct thread *td, l_int nfds, l_fd_set *readfds, + l_fd_set *writefds, l_fd_set *exceptfds, struct timespec *tsp, + l_uintptr_t *sig) { struct timeval utv, tv0, tv1, *tvp; struct l_pselect6arg lpse6; - struct l_timespec lts; - struct timespec uts; l_sigset_t l_ss; sigset_t *ssp; sigset_t ss; int error; ssp = NULL; - if (args->sig != NULL) { - error = copyin(args->sig, &lpse6, sizeof(lpse6)); + if (sig != NULL) { + error = copyin(sig, &lpse6, sizeof(lpse6)); if (error != 0) return (error); if (lpse6.ss_len != sizeof(l_ss)) @@ -2381,21 +2415,15 @@ linux_pselect6(struct thread *td, struct linux_pselect6_args *args) linux_to_bsd_sigset(&l_ss, &ss); ssp = &ss; } - } + } else + ssp = NULL; /* * Currently glibc changes nanosecond number to microsecond. * This mean losing precision but for now it is hardly seen. */ - if (args->tsp != NULL) { - error = copyin(args->tsp, <s, sizeof(lts)); - if (error != 0) - return (error); - error = linux_to_native_timespec(&uts, <s); - if (error != 0) - return (error); - - TIMESPEC_TO_TIMEVAL(&utv, &uts); + if (tsp != NULL) { + TIMESPEC_TO_TIMEVAL(&utv, tsp); if (itimerfix(&utv)) return (EINVAL); @@ -2404,10 +2432,10 @@ linux_pselect6(struct thread *td, struct linux_pselect6_args *args) } else tvp = NULL; - error = kern_pselect(td, args->nfds, args->readfds, args->writefds, - args->exceptfds, tvp, ssp, LINUX_NFDBITS); + error = kern_pselect(td, nfds, readfds, writefds, + exceptfds, tvp, ssp, LINUX_NFDBITS); - if (error == 0 && args->tsp != NULL) { + if (error == 0 && tsp != NULL) { if (td->td_retval[0] != 0) { /* * Compute how much time was left of the timeout, @@ -2423,16 +2451,44 @@ linux_pselect6(struct thread *td, struct linux_pselect6_args *args) timevalclear(&utv); } else timevalclear(&utv); + TIMEVAL_TO_TIMESPEC(&utv, tsp); + } + return (error); +} - TIMEVAL_TO_TIMESPEC(&utv, &uts); +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int +linux_pselect6_time64(struct thread *td, + struct linux_pselect6_time64_args *args) +{ + struct l_timespec64 lts; + struct timespec ts, *tsp; + int error; - error = native_to_linux_timespec(<s, &uts); + if (args->tsp != NULL) { + error = copyin(args->tsp, <s, sizeof(lts)); + if (error != 0) + return (error); + error = linux_to_native_timespec64(&ts, <s); + if (error != 0) + return (error); + tsp = &ts; + } else + tsp = NULL; + + error = linux_common_pselect6(td, args->nfds, args->readfds, + args->writefds, args->exceptfds, tsp, args->sig); + if (error != 0) + return (error); + + if (args->tsp != NULL) { + error = native_to_linux_timespec64(<s, tsp); if (error == 0) error = copyout(<s, args->tsp, sizeof(lts)); } - return (error); } +#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ int linux_ppoll(struct thread *td, struct linux_ppoll_args *args) diff --git a/sys/i386/linux/linux_dummy_machdep.c b/sys/i386/linux/linux_dummy_machdep.c index a349fab5b637..67c70afa15b3 100644 --- a/sys/i386/linux/linux_dummy_machdep.c +++ b/sys/i386/linux/linux_dummy_machdep.c @@ -74,7 +74,6 @@ DUMMY(timer_gettime64); DUMMY(timer_settime64); DUMMY(timerfd_gettime64); DUMMY(timerfd_settime64); -DUMMY(pselect6_time64); DUMMY(ppoll_time64); DUMMY(io_pgetevents_time64); DUMMY(recvmmsg_time64); diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index c42d9af0058d..056ac42eaad7 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -2408,7 +2408,14 @@ ); } 413 AUE_NULL STD { - int linux_pselect6_time64(void); + int linux_pselect6_time64( + l_int nfds, + l_fd_set *readfds, + l_fd_set *writefds, + l_fd_set *exceptfds, + struct l_timespec64 *tsp, + l_uintptr_t *sig + ); } 414 AUE_NULL STD { int linux_ppoll_time64(void);