problems coding a real-time process
Ray Strode
halfline at hawaii.rr.com
Tue Jan 22 00:29:09 PST 2002
>
>
>Is anybody familiar enough with this to explain it, or
>
>maybe point me in the right direction?
>
I'm just guessing here, but I bet the problem is you aren't running the
program
as superuser. I have a feeling if you #include <errno.h> and check if
errno == EPERM
you will find it does. But do the check immediately after finding out
if the call returns
-1. Remember errno is undefined after a successful library call, so
you can't depend on it's value after making a library call (even functions
related to errno like perror()). I suspect you are getting 29, because
you've made some
library calls in between setscheduler() and your check to errno. In the
future, use
perror() or strerror() to find out what's going on... ie...
int retval = -1;
...
retval = sched_setscheduler(...);
// Note there is no ellipses here, I MEAN IT...don't do anything from
libc here.
if (retval == -1) {
perror("sched_setscheduler() error");
}
in your final code do something like...
#include <errno.h>
extern int errno;
....
retval = sched_setscheduler(...);
if (retval == -1) {
switch (errno) {
case EPERM:
break;
....
}
}
--Ray Strode
More information about the LUAU
mailing list