This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: linuxthreads question
- To: tb@MIT.EDU (Thomas Bushnell, n/BSG)
- Subject: Re: linuxthreads question
- From: Zack Weinberg <zack@rabi.phys.columbia.edu>
- Date: Wed, 15 Jul 1998 11:01:05 -0400
- cc: roland@frob.com, libc-hacker@cygnus.com
>Exactly. pthread_attr_* should in general do no error codes at all.
>Then if you do a pthread_create with a scheduling policy set and it
>isn't supported (for the permission reason, say) then pthread_create
>returns the error. I was in the balloting group; this is exactly the
>intention of the standard.
There's an implementation issue: the system call that actually sets
the priority is made in the child thread (in pthread_start_thread),
where getting a failure code back to the caller is awkward. I can see
two possible ways:
- Leave the __sched_setscheduler call where it is, but if it fails,
post a notification to the thread manager and suicide. Simple, but it
costs another slow manager-pipe invocation on _every_ pthread_create()
call (since create() can't return till it knows success or failure).
- Have the parent make the call and kill the child if it fails.
Problem: you don't know how far the child has gotten in its processing
(could be dealt with by a pause() in start_thread, and send the child
either a SIGCONT or a SIGKILL).
For the moment perhaps we should just take out the check in
pthread_attr_setschedpolicy and document the issue.
zw
1998-07-15 11:00 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu>
* linuxthreads/attr.c (pthread_attr_setschedpolicy): Don't
check whether caller is root.
============================================================
Index: linuxthreads/attr.c
--- linuxthreads/attr.c 1998/07/04 10:22:31 1.6
+++ linuxthreads/attr.c 1998/07/15 14:51:32
@@ -96,8 +96,6 @@
{
if (policy != SCHED_OTHER && policy != SCHED_FIFO && policy != SCHED_RR)
return EINVAL;
- if (policy != SCHED_OTHER && geteuid() != 0)
- return ENOTSUP;
attr->schedpolicy = policy;
return 0;
}