gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r27543 - in gnunet/src: include util


From: gnunet
Subject: [GNUnet-SVN] r27543 - in gnunet/src: include util
Date: Sun, 23 Jun 2013 20:17:10 +0200

Author: amatus
Date: 2013-06-23 20:17:10 +0200 (Sun, 23 Jun 2013)
New Revision: 27543

Removed:
   gnunet/src/util/test_os_priority.c
Modified:
   gnunet/src/include/gnunet_os_lib.h
   gnunet/src/util/Makefile.am
   gnunet/src/util/os_priority.c
Log:
Removed GNUNET_OS_set_process_priority since it's not used.


Modified: gnunet/src/include/gnunet_os_lib.h
===================================================================
--- gnunet/src/include/gnunet_os_lib.h  2013-06-23 16:23:08 UTC (rev 27542)
+++ gnunet/src/include/gnunet_os_lib.h  2013-06-23 18:17:10 UTC (rev 27543)
@@ -304,18 +304,6 @@
 
 
 /**
- * Set process priority
- *
- * @param proc pointer to process structure
- * @param prio priority value
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
- */
-int
-GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc,
-                                enum GNUNET_SCHEDULER_Priority prio);
-
-
-/**
  * Start a process.
  *
  * @param pipe_control should a pipe be used to send signals to the child?

Modified: gnunet/src/util/Makefile.am
===================================================================
--- gnunet/src/util/Makefile.am 2013-06-23 16:23:08 UTC (rev 27542)
+++ gnunet/src/util/Makefile.am 2013-06-23 18:17:10 UTC (rev 27543)
@@ -236,7 +236,6 @@
  test_mq \
  test_mq_client \
  test_os_network \
- test_os_priority \
  test_peer \
  test_plugin \
  test_program \
@@ -436,11 +435,6 @@
 test_os_network_LDADD = \
  $(top_builddir)/src/util/libgnunetutil.la  
 
-test_os_priority_SOURCES = \
- test_os_priority.c
-test_os_priority_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la  
-
 test_peer_SOURCES = \
  test_peer.c
 test_peer_LDADD = \

Modified: gnunet/src/util/os_priority.c
===================================================================
--- gnunet/src/util/os_priority.c       2013-06-23 16:23:08 UTC (rev 27542)
+++ gnunet/src/util/os_priority.c       2013-06-23 18:17:10 UTC (rev 27543)
@@ -343,112 +343,6 @@
 #endif
 
 
-/**
- * Set process priority
- *
- * @param proc pointer to process structure
- * @param prio priority value
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
- */
-int
-GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc,
-                                enum GNUNET_SCHEDULER_Priority prio)
-{
-  int rprio;
-
-  GNUNET_assert (prio < GNUNET_SCHEDULER_PRIORITY_COUNT);
-  if (GNUNET_SCHEDULER_PRIORITY_KEEP == prio)
-    return GNUNET_OK;
-
-  /* convert to MINGW/Unix values */
-  switch (prio)
-  {
-  case GNUNET_SCHEDULER_PRIORITY_UI:
-  case GNUNET_SCHEDULER_PRIORITY_URGENT:
-#ifdef MINGW
-    rprio = HIGH_PRIORITY_CLASS;
-#else
-    rprio = 0;
-#endif
-    break;
-
-  case GNUNET_SCHEDULER_PRIORITY_HIGH:
-#ifdef MINGW
-    rprio = ABOVE_NORMAL_PRIORITY_CLASS;
-#else
-    rprio = 5;
-#endif
-    break;
-
-  case GNUNET_SCHEDULER_PRIORITY_DEFAULT:
-#ifdef MINGW
-    rprio = NORMAL_PRIORITY_CLASS;
-#else
-    rprio = 7;
-#endif
-    break;
-
-  case GNUNET_SCHEDULER_PRIORITY_BACKGROUND:
-#ifdef MINGW
-    rprio = BELOW_NORMAL_PRIORITY_CLASS;
-#else
-    rprio = 10;
-#endif
-    break;
-
-  case GNUNET_SCHEDULER_PRIORITY_IDLE:
-#ifdef MINGW
-    rprio = IDLE_PRIORITY_CLASS;
-#else
-    rprio = 19;
-#endif
-    break;
-  default:
-    GNUNET_assert (0);
-    return GNUNET_SYSERR;
-  }
-
-  /* Set process priority */
-#ifdef MINGW
-  {
-    HANDLE h = proc->handle;
-
-    GNUNET_assert (h != NULL);
-    SetPriorityClass (h, rprio);
-  }
-#elif LINUX
-  pid_t pid;
-
-  pid = proc->pid;
-  if ((0 == pid) || (pid == getpid ()))
-  {
-    int have = nice (0);
-    int delta = rprio - have;
-
-    errno = 0;
-    if ((delta != 0) && (rprio == nice (delta)) && (errno != 0))
-    {
-      LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, 
"nice");
-      return GNUNET_SYSERR;
-    }
-  }
-  else
-  {
-    if (0 != setpriority (PRIO_PROCESS, pid, rprio))
-    {
-      LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
-                    "setpriority");
-      return GNUNET_SYSERR;
-    }
-  }
-#else
-  LOG (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
-       "Priority management not availabe for this platform\n");
-#endif
-  return GNUNET_OK;
-}
-
-
 #if MINGW
 static char *
 CreateCustomEnvTable (char **vars)

Deleted: gnunet/src/util/test_os_priority.c
===================================================================
--- gnunet/src/util/test_os_priority.c  2013-06-23 16:23:08 UTC (rev 27542)
+++ gnunet/src/util/test_os_priority.c  2013-06-23 18:17:10 UTC (rev 27543)
@@ -1,68 +0,0 @@
-/*
-     This file is part of GNUnet.
-     (C) 2003, 2004, 2005, 2006, 2009 Christian Grothoff (and other 
contributing authors)
-
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-*/
-/**
- * @file util/test_os_priority.c
- * @brief testcase for util/os_priority.c
- */
-#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_os_lib.h"
-
-
-static int
-testprio ()
-{
-  if (GNUNET_OK !=
-      GNUNET_OS_set_process_priority (GNUNET_OS_process_current (),
-                                      GNUNET_SCHEDULER_PRIORITY_DEFAULT))
-    return 1;
-  if (GNUNET_OK !=
-      GNUNET_OS_set_process_priority (GNUNET_OS_process_current (),
-                                      GNUNET_SCHEDULER_PRIORITY_UI))
-    return 1;
-  if (GNUNET_OK !=
-      GNUNET_OS_set_process_priority (GNUNET_OS_process_current (),
-                                      GNUNET_SCHEDULER_PRIORITY_IDLE))
-    return 1;
-  if (GNUNET_OK !=
-      GNUNET_OS_set_process_priority (GNUNET_OS_process_current (),
-                                      GNUNET_SCHEDULER_PRIORITY_BACKGROUND))
-    return 1;
-  if (GNUNET_OK !=
-      GNUNET_OS_set_process_priority (GNUNET_OS_process_current (),
-                                      GNUNET_SCHEDULER_PRIORITY_HIGH))
-    return 1;
-  if (GNUNET_OK !=
-      GNUNET_OS_set_process_priority (GNUNET_OS_process_current (),
-                                      GNUNET_SCHEDULER_PRIORITY_HIGH))
-    return 1;
-  return 0;
-}
-
-int
-main (int argc, char *argv[])
-{
-  int errCnt = 0;
-
-  GNUNET_log_setup ("test_os_priority", "WARNING", NULL);
-  if (0 != testprio ())
-    errCnt++;
-  return errCnt;
-}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]