summaryrefslogtreecommitdiffstats
path: root/Process.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2007-12-17 05:57:28 +0000
committerHisham Muhammad <hisham@gobolinux.org>2007-12-17 05:57:28 +0000
commitcf7fdcd1d69d19bd9662cd1a9665dffe30f5b5b1 (patch)
tree254f5962aa1fa017efd7ecadd9e9c6ab51ccf9d6 /Process.c
parenta839c3f2ca5a11b2293ad0c588859d38aa98d194 (diff)
Experimental feature: beep on permission failures.
Update dates.
Diffstat (limited to 'Process.c')
-rw-r--r--Process.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Process.c b/Process.c
index ed49bace..ef97451a 100644
--- a/Process.c
+++ b/Process.c
@@ -42,7 +42,7 @@ typedef enum ProcessField_ {
STIME, CUTIME, CSTIME, PRIORITY, NICE, ITREALVALUE, STARTTIME, VSIZE, RSS, RLIM, STARTCODE, ENDCODE,
STARTSTACK, KSTKESP, KSTKEIP, SIGNAL, BLOCKED, SSIGIGNORE, SIGCATCH, WCHAN, NSWAP, CNSWAP, EXIT_SIGNAL,
PROCESSOR, M_SIZE, M_RESIDENT, M_SHARE, M_TRS, M_DRS, M_LRS, M_DT, ST_UID, PERCENT_CPU, PERCENT_MEM,
- USER, TIME, NLWP, TGID
+ USER, TIME, NLWP, TGID,
#ifdef HAVE_OPENVZ
VEID, VPID,
#endif
@@ -187,12 +187,13 @@ void Process_toggleTag(Process* this) {
this->tag = this->tag == true ? false : true;
}
-void Process_setPriority(Process* this, int priority) {
+bool Process_setPriority(Process* this, int priority) {
int old_prio = getpriority(PRIO_PROCESS, this->pid);
int err = setpriority(PRIO_PROCESS, this->pid, priority);
if (err == 0 && old_prio != getpriority(PRIO_PROCESS, this->pid)) {
this->nice = priority;
}
+ return (err == 0);
}
unsigned long Process_getAffinity(Process* this) {
@@ -201,8 +202,8 @@ unsigned long Process_getAffinity(Process* this) {
return mask;
}
-void Process_setAffinity(Process* this, unsigned long mask) {
- sched_setaffinity(this->pid, sizeof(unsigned long), (cpu_set_t*) &mask);
+bool Process_setAffinity(Process* this, unsigned long mask) {
+ return (sched_setaffinity(this->pid, sizeof(unsigned long), (cpu_set_t*) &mask) == 0);
}
void Process_sendSignal(Process* this, int signal) {

© 2014-2024 Faster IT GmbH | imprint | privacy policy