* soft real-time scheduling
@ 2004-09-26 14:08 Ankit Jain
2004-09-26 15:09 ` Muthukumar Ratty
2004-09-26 15:13 ` Eljay Love-Jensen
0 siblings, 2 replies; 4+ messages in thread
From: Ankit Jain @ 2004-09-26 14:08 UTC (permalink / raw)
To: linux prg; +Cc: gcc
hi
/* soft realtime scheduling variable */
struct sched_param *p;
/* set soft real-time scheduling */
sched_getparam(0,p);
p->sched_priority = 50;
if (sched_setscheduler(0,SCHED_FIFO,p))
fprintf(stderr,"Could not change scheduler
settings\n");
if anyone knows about this then i need some help
p is a pointer to the structure sched_param which is
defined in sched.h
this structure has a variable __sched_priority where i
have to set the priority of the process
p->sched_priority =50 this line gives a segmentation
fault.
how t oaccess this variable (__sched_priority) of the
header file
thanks
ankit
________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping"
your friends today! Download Messenger Now
http://uk.messenger.yahoo.com/download/index.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: soft real-time scheduling
2004-09-26 14:08 soft real-time scheduling Ankit Jain
@ 2004-09-26 15:09 ` Muthukumar Ratty
2004-09-26 15:13 ` Eljay Love-Jensen
1 sibling, 0 replies; 4+ messages in thread
From: Muthukumar Ratty @ 2004-09-26 15:09 UTC (permalink / raw)
To: Ankit Jain; +Cc: linux prg, gcc
Hi, This is offtopic for this list.
from http://gcc.gnu.org/lists.html
"gcc-help is a relatively high volume list for people searching for help
in building or using GCC."
Anyway, for your question... i see few problems
1. struct sched_param *p;
sched_getparam(0,p);
Using unallocated memory. will result in SEGV
2. When you get 1 corrected, you may get another error
From man 2 sched_setscheduler
<snip>
EPERM The calling process does not have appropriate privileges.
<snip>
On Sun, 26 Sep 2004, Ankit Jain wrote:
> hi
>
> /* soft realtime scheduling variable */
> struct sched_param *p;
>
>
> /* set soft real-time scheduling */
> sched_getparam(0,p);
> p->sched_priority = 50;
> if (sched_setscheduler(0,SCHED_FIFO,p))
> fprintf(stderr,"Could not change scheduler
> settings\n");
>
> if anyone knows about this then i need some help
>
> p is a pointer to the structure sched_param which is
> defined in sched.h
>
> this structure has a variable __sched_priority where i
> have to set the priority of the process
>
> p->sched_priority =50 this line gives a segmentation
> fault.
> how t oaccess this variable (__sched_priority) of the
> header file
>
> thanks
>
> ankit
>
> ________________________________________________________________________
> Yahoo! Messenger - Communicate instantly..."Ping"
> your friends today! Download Messenger Now
> http://uk.messenger.yahoo.com/download/index.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: soft real-time scheduling
2004-09-26 14:08 soft real-time scheduling Ankit Jain
2004-09-26 15:09 ` Muthukumar Ratty
@ 2004-09-26 15:13 ` Eljay Love-Jensen
1 sibling, 0 replies; 4+ messages in thread
From: Eljay Love-Jensen @ 2004-09-26 15:13 UTC (permalink / raw)
To: Ankit Jain, linux prg; +Cc: gcc
Hi Ankit,
You forgot to do...
p = malloc(sizeof(struct sched_param));
--Eljay
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: soft real-time scheduling
@ 2004-09-26 14:52 Bud Davis
0 siblings, 0 replies; 4+ messages in thread
From: Bud Davis @ 2004-09-26 14:52 UTC (permalink / raw)
To: gcc-help
first off, this list is for gcc, not general programming.
p needs to have storage allocated. here is a safer way to do it:
#include <sched.h>
#include <stdio.h>
int main ()
{
struct sched_param p;
/* set soft real-time scheduling */
sched_getparam(0,&p);
p.sched_priority = 50;
if (sched_setscheduler(0,SCHED_FIFO,&p))
fprintf(stderr,"Could not change scheduler settings\n");
return 0;
}
HTH,
bud davis
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-09-26 15:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-26 14:08 soft real-time scheduling Ankit Jain
2004-09-26 15:09 ` Muthukumar Ratty
2004-09-26 15:13 ` Eljay Love-Jensen
2004-09-26 14:52 Bud Davis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).