SetPriorityClass (h, rprio);
}
#elif LINUX
- if (0 != setpriority (PRIO_PROCESS, proc->pid, rprio))
+ pid_t pid;
+
+ pid = proc->pid;
+ if ( (0 == pid) ||
+ (pid == getpid () ) )
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING |
- GNUNET_ERROR_TYPE_BULK, "setpriority");
- return GNUNET_SYSERR;
+ int have = nice (0);
+ int delta = rprio - have;
+ errno = 0;
+ if ( (delta != 0) &&
+ (rprio == nice (delta)) &&
+ (errno != 0) )
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING |
+ GNUNET_ERROR_TYPE_BULK, "nice");
+ return GNUNET_SYSERR;
+ }
+ }
+ else
+ {
+ if (0 != setpriority (PRIO_PROCESS, pid, rprio))
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING |
+ GNUNET_ERROR_TYPE_BULK, "setpriority");
+ return GNUNET_SYSERR;
+ }
}
#else
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
* @param pipe_stdout pipe to use to get output from child process (or NULL)
* @param filename name of the binary
* @param ... NULL-terminated list of arguments to the process
+ *
* @return pointer to process structure of the new process, NULL on error
+ *
*/
struct GNUNET_OS_Process *
GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin,