From owner-svn-src-stable@freebsd.org Sat Jan 9 18:05:05 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A12DEA6982E; Sat, 9 Jan 2016 18:05:05 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5FD3119CC; Sat, 9 Jan 2016 18:05:05 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u09I54vD071605; Sat, 9 Jan 2016 18:05:04 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u09I541S071604; Sat, 9 Jan 2016 18:05:04 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201601091805.u09I541S071604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 9 Jan 2016 18:05:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r293598 - stable/10/sys/compat/linux X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2016 18:05:05 -0000 Author: dchagin Date: Sat Jan 9 18:05:04 2016 New Revision: 293598 URL: https://svnweb.freebsd.org/changeset/base/293598 Log: MFC r283498: Linux nanosleep() and clock_nanosleep() system calls always writes the remaining time into the structure pointed to by rmtp unless rmtp is NULL. The value of *rmtp can then be used to call nanosleep() again and complete the specified pause if the previous call was interrupted. Note. clock_nanosleep() with an absolute time value does not write the remaining time. While here fix whitespaces and typo in SDT_PROBE. Modified: stable/10/sys/compat/linux/linux_time.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/linux/linux_time.c ============================================================================== --- stable/10/sys/compat/linux/linux_time.c Sat Jan 9 18:04:10 2016 (r293597) +++ stable/10/sys/compat/linux/linux_time.c Sat Jan 9 18:05:04 2016 (r293598) @@ -106,14 +106,12 @@ LIN_SDT_PROBE_DEFINE1(time, linux_clock_ LIN_SDT_PROBE_DEFINE2(time, linux_nanosleep, entry, "const struct l_timespec *", "struct l_timespec *"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, conversion_error, "int"); -LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, nanosleep_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyout_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, return, "int"); LIN_SDT_PROBE_DEFINE4(time, linux_clock_nanosleep, entry, "clockid_t", "int", "struct l_timespec *", "struct l_timespec *"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, conversion_error, "int"); -LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, nanosleep_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyout_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_flags, "int"); @@ -469,7 +467,7 @@ linux_nanosleep(struct thread *td, struc struct timespec *rmtp; struct l_timespec lrqts, lrmts; struct timespec rqts, rmts; - int error; + int error, error2; LIN_SDT_PROBE2(time, linux_nanosleep, entry, args->rqtp, args->rmtp); @@ -481,9 +479,9 @@ linux_nanosleep(struct thread *td, struc } if (args->rmtp != NULL) - rmtp = &rmts; + rmtp = &rmts; else - rmtp = NULL; + rmtp = NULL; error = linux_to_native_timespec(&rqts, &lrqts); if (error != 0) { @@ -492,25 +490,19 @@ linux_nanosleep(struct thread *td, struc return (error); } error = kern_nanosleep(td, &rqts, rmtp); - if (error != 0) { - LIN_SDT_PROBE1(time, linux_nanosleep, nanosleep_error, error); - LIN_SDT_PROBE1(time, linux_nanosleep, return, error); - return (error); - } - if (args->rmtp != NULL) { - native_to_linux_timespec(&lrmts, rmtp); - error = copyout(&lrmts, args->rmtp, sizeof(lrmts)); - if (error != 0) { + native_to_linux_timespec(&lrmts, rmtp); + error2 = copyout(&lrmts, args->rmtp, sizeof(lrmts)); + if (error2 != 0) { LIN_SDT_PROBE1(time, linux_nanosleep, copyout_error, - error); - LIN_SDT_PROBE1(time, linux_nanosleep, return, error); - return (error); + error2); + LIN_SDT_PROBE1(time, linux_nanosleep, return, error2); + return (error2); } } - LIN_SDT_PROBE1(time, linux_nanosleep, return, 0); - return (0); + LIN_SDT_PROBE1(time, linux_nanosleep, return, error); + return (error); } int @@ -519,7 +511,7 @@ linux_clock_nanosleep(struct thread *td, struct timespec *rmtp; struct l_timespec lrqts, lrmts; struct timespec rqts, rmts; - int error; + int error, error2; LIN_SDT_PROBE4(time, linux_clock_nanosleep, entry, args->which, args->flags, args->rqtp, args->rmtp); @@ -539,7 +531,7 @@ linux_clock_nanosleep(struct thread *td, return (EINVAL); } - error = copyin(args->rqtp, &lrqts, sizeof lrqts); + error = copyin(args->rqtp, &lrqts, sizeof(lrqts)); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_nanosleep, copyin_error, error); @@ -548,9 +540,9 @@ linux_clock_nanosleep(struct thread *td, } if (args->rmtp != NULL) - rmtp = &rmts; + rmtp = &rmts; else - rmtp = NULL; + rmtp = NULL; error = linux_to_native_timespec(&rqts, &lrqts); if (error != 0) { @@ -560,24 +552,19 @@ linux_clock_nanosleep(struct thread *td, return (error); } error = kern_nanosleep(td, &rqts, rmtp); - if (error != 0) { - LIN_SDT_PROBE1(time, linux_clock_nanosleep, nanosleep_error, - error); - LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error); - return (error); - } - if (args->rmtp != NULL) { + /* XXX. Not for TIMER_ABSTIME */ native_to_linux_timespec(&lrmts, rmtp); - error = copyout(&lrmts, args->rmtp, sizeof lrmts ); - if (error != 0) { + error2 = copyout(&lrmts, args->rmtp, sizeof(lrmts)); + if (error2 != 0) { + LIN_SDT_PROBE1(time, linux_clock_nanosleep, + copyout_error, error2); LIN_SDT_PROBE1(time, linux_clock_nanosleep, - copyout_error, error); - LIN_SDT_PROBE1(time, linux_nanosleep, return, error); - return (error); + return, error2); + return (error2); } } - LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, 0); - return (0); + LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error); + return (error); }