Date: Mon, 24 Mar 2003 12:12:26 -0800 (PST) From: Archie Cobbs <archie@precisionio.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/50260: can't get my own policy from sched_getscheduler() Message-ID: <200303242012.h2OKCQFX075159@bubba.precisionio.com>
index | next in thread | raw e-mail
>Number: 50260
>Category: bin
>Synopsis: can't get my own policy from sched_getscheduler()
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Mar 24 15:50:11 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Archie Cobbs
>Release: FreeBSD 4.7-STABLE i386
>Organization:
Packet Design
>Environment:
System: FreeBSD bubba.precisionio.com 4.7-STABLE FreeBSD 4.7-STABLE #0: Tue Feb 18 09:50:02 PST 2003 archie@bubba.packetdesign.com:/usr/obj/usr/src/sys/BUBBA i386
>Description:
sched_getscheduler(0) returns EPERM.
Why can't a process get it's own scheduling policy??
SUSv2 seems to state explicitly that it should be able to:
> If a process specified by pid exists and if the calling process has
> permission, the scheduling policy will be returned for the process
> whose process ID is equal to pid.
>
> If pid is zero, the scheduling policy will be returned for the
> calling process.
Ref: http://www.opengroup.org/onlinepubs/7908799/xsh/sched_getscheduler.html
>How-To-Repeat:
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <sched.h>
#include <err.h>
int
main(int ac, char **av)
{
int policy;
int min_prio;
int max_prio;
if ((policy = sched_getscheduler(0)) == -1)
err(1, "sched_getscheduler");
printf("policy = %d\n", policy);
if ((min_prio = sched_get_priority_min(policy)) == -1)
err(1, "sched_get_priority_min");
if ((max_prio = sched_get_priority_max(policy)) == -1)
err(1, "sched_get_priority_max");
printf("max = %d\n", max_prio);
printf("min = %d\n", min_prio);
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303242012.h2OKCQFX075159>
