aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-01-24 12:24:11 +0000
committerChristian Grothoff <christian@grothoff.org>2011-01-24 12:24:11 +0000
commita5769eb8918ccb0a7baac179569e7a713ad08465 (patch)
tree906629bd1236bcf0b199b046895a2ba444df532d
parent48718834d4fb6c411ff5b00b86662a3dee3ac6cc (diff)
downloadgnunet-a5769eb8918ccb0a7baac179569e7a713ad08465.tar.gz
gnunet-a5769eb8918ccb0a7baac179569e7a713ad08465.zip
just use setpriority
-rw-r--r--src/util/os_priority.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/src/util/os_priority.c b/src/util/os_priority.c
index e9ca9deea..3993f572c 100644
--- a/src/util/os_priority.c
+++ b/src/util/os_priority.c
@@ -320,32 +320,11 @@ GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc,
320 SetPriorityClass (h, rprio); 320 SetPriorityClass (h, rprio);
321 } 321 }
322#elif LINUX 322#elif LINUX
323 pid_t pid; 323 if (0 != setpriority (PRIO_PROCESS, proc->pid, rprio))
324
325 pid = proc->pid;
326 if ( (0 == pid) ||
327 (pid == getpid () ) )
328 {
329 int have = nice (0);
330 int delta = rprio - have;
331 errno = 0;
332 if ( (delta != 0) &&
333 (rprio == nice (delta)) &&
334 (errno != 0) )
335 {
336 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING |
337 GNUNET_ERROR_TYPE_BULK, "nice");
338 return GNUNET_SYSERR;
339 }
340 }
341 else
342 { 324 {
343 if (0 != setpriority (PRIO_PROCESS, pid, rprio)) 325 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING |
344 { 326 GNUNET_ERROR_TYPE_BULK, "setpriority");
345 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING | 327 return GNUNET_SYSERR;
346 GNUNET_ERROR_TYPE_BULK, "setpriority");
347 return GNUNET_SYSERR;
348 }
349 } 328 }
350#else 329#else
351 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, 330 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,