#include <sys/types.h> /* getgrnam() */
#include <grp.h>
#include <signal.h>
+#include <sys/resource.h>
#include "para.h"
#include "daemon.h"
PARA_INFO_LOG("welcome to para_%s-" PACKAGE_VERSION " \n", name);
}
+/**
+ * Renice the calling process.
+ *
+ * \param prio The priority value to set.
+ *
+ * Errors are not considered fatal, but a warning message is logged if the
+ * underlying call to setpriority(2) fails.
+ */
+void daemon_set_priority(int prio)
+{
+ if (setpriority(PRIO_PROCESS, 0, prio) < 0)
+ PARA_WARNING_LOG("could not set priority to %d: %s\n", prio,
+ strerror(errno));
+}
+
/**
* Give up superuser privileges.
*