Module Name: src Committed By: christos Date: Sun Mar 18 02:04:40 UTC 2012
Modified Files: src/lib/libc/sys: sched.c Log Message: fail as the man page says sched_rr_get_interval should. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libc/sys/sched.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/sys/sched.c diff -u src/lib/libc/sys/sched.c:1.3 src/lib/libc/sys/sched.c:1.4 --- src/lib/libc/sys/sched.c:1.3 Tue Mar 13 17:13:48 2012 +++ src/lib/libc/sys/sched.c Sat Mar 17 22:04:39 2012 @@ -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 @@ int 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;