| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#include "config.h" |
| 6 |
|
| 7 |
#include <glib/gi18n-lib.h> |
| 8 |
|
| 9 |
#include <errno.h> |
| 10 |
#include <sys/resource.h> |
| 11 |
#include <sys/types.h> |
| 12 |
|
| 13 |
#include "gsm-setpriority.h" |
| 14 |
|
| 15 |
|
| 16 |
void |
| 17 |
gsm_setpriority (pid_t pid, |
| 18 |
int priority, |
| 19 |
GError **error) |
| 20 |
{ |
| 21 |
int err; |
| 22 |
|
| 23 |
if (setpriority (PRIO_PROCESS, pid, priority) >= 0) { |
| 24 |
return; |
| 25 |
} |
| 26 |
|
| 27 |
err = errno; |
| 28 |
|
| 29 |
g_set_error (error, |
| 30 |
G_FILE_ERROR, |
| 31 |
g_file_error_from_errno (err), |
| 32 |
_("Priority failed on %i: %s"), |
| 33 |
pid, |
| 34 |
g_strerror (err)); |
| 35 |
} |