svn commit: r237067 - projects/calloutng/sys/kern

Davide Italiano davide at FreeBSD.org
Thu Jun 14 13:55:53 UTC 2012


Author: davide
Date: Thu Jun 14 13:55:52 2012
New Revision: 237067
URL: http://svn.freebsd.org/changeset/base/237067

Log:
  The second argument of sleepq_timedwait_sig() is priority and it does not
  concern signal caught in previous calls as I thought and the manpage says.
  Fix kern_nanosleep() accordingly.
  
  Reported by:		bde
  Reviewed by:		bde

Modified:
  projects/calloutng/sys/kern/kern_time.c

Modified: projects/calloutng/sys/kern/kern_time.c
==============================================================================
--- projects/calloutng/sys/kern/kern_time.c	Thu Jun 14 12:43:37 2012	(r237066)
+++ projects/calloutng/sys/kern/kern_time.c	Thu Jun 14 13:55:52 2012	(r237067)
@@ -355,7 +355,7 @@ kern_nanosleep(struct thread *td, struct
 {
 	struct timespec ts;
 	struct bintime bt, bt2, tmp;
-	int catch = 0, error;
+	int error;
 
 	if (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000)
 		return (EINVAL);
@@ -368,22 +368,20 @@ kern_nanosleep(struct thread *td, struct
 		sleepq_lock(&nanowait);	
 		sleepq_add(&nanowait, NULL, "nanslp", PWAIT | PCATCH, 0);
 		sleepq_set_timeout_bt(&nanowait,bt);
-		error = sleepq_timedwait_sig(&nanowait,catch);
+		error = sleepq_timedwait_sig(&nanowait, PWAIT | PCATCH);
 		binuptime(&bt2);
-		if (catch) { 
-			if (error != EWOULDBLOCK) {
-				if (error == ERESTART)
-					error = EINTR;
-				if (rmt != NULL) {
-					tmp = bt;
-					bintime_sub(&tmp, &bt2);	
-					bintime2timespec(&tmp,&ts);
-					if (ts.tv_sec < 0)
-						timespecclear(&ts);
-					*rmt = ts;
-				}
-			return (error);
+		if (error != EWOULDBLOCK) {
+			if (error == ERESTART)
+				error = EINTR;
+			if (rmt != NULL) {
+				tmp = bt;
+				bintime_sub(&tmp, &bt2);	
+				bintime2timespec(&tmp, &ts);
+				if (ts.tv_sec < 0)
+					timespecclear(&ts);
+				*rmt = ts;
 			}
+			return (error);
 		}
 		if (bintime_cmp(&bt2, &bt, >=))
 			return (0);


More information about the svn-src-projects mailing list