bonic: libc: cpuacct support for setuid functions
Any of the setuid functions now updates /acct/uid/ with its own tid before changing users. This is so we can properly account for cpu time per uid. Change-Id: I34186cf4d5228cac8439e582a9e26c01ef3011e4 Signed-off-by: Mike Chan <mike@android.com>
This commit is contained in:
@@ -43,6 +43,14 @@ int fork(void)
|
||||
ret = __fork();
|
||||
if (ret != 0) { /* not a child process */
|
||||
__timer_table_start_stop(0);
|
||||
} else {
|
||||
/*
|
||||
* Newly created process must update cpu accounting.
|
||||
* Call cpuacct_add passing in our uid, which will take
|
||||
* the current task id and add it to the uid group passed
|
||||
* as a parameter.
|
||||
*/
|
||||
cpuacct_add(getuid());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user