Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/sys fail as the man page says sched_rr_get_interval...



details:   https://anonhg.NetBSD.org/src/rev/17879b0c25c2
branches:  trunk
changeset: 778158:17879b0c25c2
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 18 02:04:39 2012 +0000

description:
fail as the man page says sched_rr_get_interval should.

diffstat:

 lib/libc/sys/sched.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r 3a70711ae661 -r 17879b0c25c2 lib/libc/sys/sched.c
--- a/lib/libc/sys/sched.c      Sat Mar 17 23:47:13 2012 +0000
+++ b/lib/libc/sys/sched.c      Sun Mar 18 02:04:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sched.c,v 1.3 2012/03/13 21:13:48 christos Exp $       */
+/*     $NetBSD: sched.c,v 1.4 2012/03/18 02:04:39 christos Exp $       */
 
 /*
  * Copyright (c) 2008, Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -27,12 +27,13 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: sched.c,v 1.3 2012/03/13 21:13:48 christos Exp $");
+__RCSID("$NetBSD: sched.c,v 1.4 2012/03/18 02:04:39 christos Exp $");
 
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
 #include <sched.h>
+#include <signal.h>
 #include <sys/param.h>
 #include <sys/types.h>
 
@@ -123,6 +124,8 @@
 sched_rr_get_interval(pid_t pid, struct timespec *interval)
 {
 
+       if (pid && kill(pid, 0) == -1)
+               return -1;
        interval->tv_sec = 0;
        interval->tv_nsec = sysconf(_SC_SCHED_RT_TS) * 1000;
        return 0;



Home | Main Index | Thread Index | Old Index