am 21d70d5f: am 39385aa7: Merge "Clean up the cpuacct cruft."

* commit '21d70d5fd8ff2823a6879d59c7d5a8d6c3e0ce8b':
  Clean up the cpuacct cruft.
This commit is contained in:
Elliott Hughes 2013-10-09 21:28:51 -07:00 committed by Android Git Automerger
commit 2d38f0c1c7
26 changed files with 80 additions and 321 deletions

View File

@ -80,14 +80,12 @@ libc_common_src_files := \
bionic/bindresvport.c \
bionic/bionic_clone.c \
bionic/clearenv.c \
bionic/cpuacct.c \
bionic/daemon.c \
bionic/err.c \
bionic/ether_aton.c \
bionic/ether_ntoa.c \
bionic/fdprintf.c \
bionic/flockfile.c \
bionic/fork.c \
bionic/ftime.c \
bionic/ftok.c \
bionic/fts.c \
@ -124,12 +122,7 @@ libc_common_src_files := \
bionic/sched_getcpu.c \
bionic/semaphore.c \
bionic/send.c \
bionic/setegid.c \
bionic/seteuid.c \
bionic/setpgrp.c \
bionic/setresuid.c \
bionic/setreuid.c \
bionic/setuid.c \
bionic/sigblock.c \
bionic/siginterrupt.c \
bionic/siglist.c \
@ -226,6 +219,7 @@ libc_bionic_src_files := \
bionic/__errno.cpp \
bionic/eventfd_read.cpp \
bionic/eventfd_write.cpp \
bionic/fork.cpp \
bionic/futimens.cpp \
bionic/getauxval.cpp \
bionic/getcwd.cpp \
@ -248,7 +242,9 @@ libc_bionic_src_files := \
bionic/sbrk.cpp \
bionic/scandir.cpp \
bionic/sched_getaffinity.cpp \
bionic/setegid.cpp \
bionic/__set_errno.cpp \
bionic/seteuid.cpp \
bionic/setlocale.cpp \
bionic/signalfd.cpp \
bionic/sigwait.cpp \

View File

@ -41,8 +41,6 @@ pid_t __sys_clone:clone(int, void*, int*, void*, int*) all
int execve(const char*, char* const*, char* const*) all
int __setuid:setuid32(uid_t) arm,x86
int __setuid:setuid(uid_t) mips,x86_64
uid_t getuid:getuid32() arm,x86
uid_t getuid:getuid() mips,x86_64
gid_t getgid:getgid32() arm,x86
@ -65,11 +63,13 @@ pid_t getsid(pid_t) all
pid_t setsid() all
int setgid:setgid32(gid_t) arm,x86
int setgid:setgid(gid_t) mips,x86_64
int setuid:setuid32(uid_t) arm,x86
int setuid:setuid(uid_t) mips,x86_64
int seteuid:seteuid32(uid_t) custom
int __setreuid:setreuid32(uid_t, uid_t) arm,x86
int __setreuid:setreuid(uid_t, uid_t) mips,x86_64
int __setresuid:setresuid32(uid_t, uid_t, uid_t) arm,x86
int __setresuid:setresuid(uid_t, uid_t, uid_t) mips,x86_64
int setreuid:setreuid32(uid_t, uid_t) arm,x86
int setreuid:setreuid(uid_t, uid_t) mips,x86_64
int setresuid:setresuid32(uid_t, uid_t, uid_t) arm,x86
int setresuid:setresuid(uid_t, uid_t, uid_t) mips,x86_64
int setresgid:setresgid32(gid_t, gid_t, gid_t) arm,x86
int setresgid:setresgid(gid_t, gid_t, gid_t) mips,x86_64
void* __brk:brk(void*) all

View File

@ -7,7 +7,6 @@ syscall_src += arch-arm/syscalls/__waitid.S
syscall_src += arch-arm/syscalls/wait4.S
syscall_src += arch-arm/syscalls/__sys_clone.S
syscall_src += arch-arm/syscalls/execve.S
syscall_src += arch-arm/syscalls/__setuid.S
syscall_src += arch-arm/syscalls/getuid.S
syscall_src += arch-arm/syscalls/getgid.S
syscall_src += arch-arm/syscalls/geteuid.S
@ -22,8 +21,9 @@ syscall_src += arch-arm/syscalls/getppid.S
syscall_src += arch-arm/syscalls/getsid.S
syscall_src += arch-arm/syscalls/setsid.S
syscall_src += arch-arm/syscalls/setgid.S
syscall_src += arch-arm/syscalls/__setreuid.S
syscall_src += arch-arm/syscalls/__setresuid.S
syscall_src += arch-arm/syscalls/setuid.S
syscall_src += arch-arm/syscalls/setreuid.S
syscall_src += arch-arm/syscalls/setresuid.S
syscall_src += arch-arm/syscalls/setresgid.S
syscall_src += arch-arm/syscalls/__brk.S
syscall_src += arch-arm/syscalls/__ptrace.S

View File

@ -3,7 +3,7 @@
#include <linux/err.h>
#include <machine/asm.h>
ENTRY(__setresuid)
ENTRY(setresuid)
mov ip, r7
ldr r7, =__NR_setresuid32
swi #0
@ -12,4 +12,4 @@ ENTRY(__setresuid)
bxls lr
neg r0, r0
b __set_errno
END(__setresuid)
END(setresuid)

View File

@ -3,7 +3,7 @@
#include <linux/err.h>
#include <machine/asm.h>
ENTRY(__setreuid)
ENTRY(setreuid)
mov ip, r7
ldr r7, =__NR_setreuid32
swi #0
@ -12,4 +12,4 @@ ENTRY(__setreuid)
bxls lr
neg r0, r0
b __set_errno
END(__setreuid)
END(setreuid)

View File

@ -3,7 +3,7 @@
#include <linux/err.h>
#include <machine/asm.h>
ENTRY(__setuid)
ENTRY(setuid)
mov ip, r7
ldr r7, =__NR_setuid32
swi #0
@ -12,4 +12,4 @@ ENTRY(__setuid)
bxls lr
neg r0, r0
b __set_errno
END(__setuid)
END(setuid)

View File

@ -8,7 +8,6 @@ syscall_src += arch-mips/syscalls/__waitid.S
syscall_src += arch-mips/syscalls/wait4.S
syscall_src += arch-mips/syscalls/__sys_clone.S
syscall_src += arch-mips/syscalls/execve.S
syscall_src += arch-mips/syscalls/__setuid.S
syscall_src += arch-mips/syscalls/getuid.S
syscall_src += arch-mips/syscalls/getgid.S
syscall_src += arch-mips/syscalls/geteuid.S
@ -23,8 +22,9 @@ syscall_src += arch-mips/syscalls/getppid.S
syscall_src += arch-mips/syscalls/getsid.S
syscall_src += arch-mips/syscalls/setsid.S
syscall_src += arch-mips/syscalls/setgid.S
syscall_src += arch-mips/syscalls/__setreuid.S
syscall_src += arch-mips/syscalls/__setresuid.S
syscall_src += arch-mips/syscalls/setuid.S
syscall_src += arch-mips/syscalls/setreuid.S
syscall_src += arch-mips/syscalls/setresuid.S
syscall_src += arch-mips/syscalls/setresgid.S
syscall_src += arch-mips/syscalls/__brk.S
syscall_src += arch-mips/syscalls/kill.S

View File

@ -1,11 +1,11 @@
/* autogenerated by gensyscalls.py */
#include <asm/unistd.h>
.text
.globl __setresuid
.globl setresuid
.align 4
.ent __setresuid
.ent setresuid
__setresuid:
setresuid:
.set noreorder
.cpload $t9
li $v0, __NR_setresuid
@ -19,4 +19,4 @@ __setresuid:
j $t9
nop
.set reorder
.end __setresuid
.end setresuid

View File

@ -1,11 +1,11 @@
/* autogenerated by gensyscalls.py */
#include <asm/unistd.h>
.text
.globl __setreuid
.globl setreuid
.align 4
.ent __setreuid
.ent setreuid
__setreuid:
setreuid:
.set noreorder
.cpload $t9
li $v0, __NR_setreuid
@ -19,4 +19,4 @@ __setreuid:
j $t9
nop
.set reorder
.end __setreuid
.end setreuid

View File

@ -1,11 +1,11 @@
/* autogenerated by gensyscalls.py */
#include <asm/unistd.h>
.text
.globl __setuid
.globl setuid
.align 4
.ent __setuid
.ent setuid
__setuid:
setuid:
.set noreorder
.cpload $t9
li $v0, __NR_setuid
@ -19,4 +19,4 @@ __setuid:
j $t9
nop
.set reorder
.end __setuid
.end setuid

View File

@ -8,7 +8,6 @@ syscall_src += arch-x86/syscalls/__waitid.S
syscall_src += arch-x86/syscalls/wait4.S
syscall_src += arch-x86/syscalls/__sys_clone.S
syscall_src += arch-x86/syscalls/execve.S
syscall_src += arch-x86/syscalls/__setuid.S
syscall_src += arch-x86/syscalls/getuid.S
syscall_src += arch-x86/syscalls/getgid.S
syscall_src += arch-x86/syscalls/geteuid.S
@ -23,8 +22,9 @@ syscall_src += arch-x86/syscalls/getppid.S
syscall_src += arch-x86/syscalls/getsid.S
syscall_src += arch-x86/syscalls/setsid.S
syscall_src += arch-x86/syscalls/setgid.S
syscall_src += arch-x86/syscalls/__setreuid.S
syscall_src += arch-x86/syscalls/__setresuid.S
syscall_src += arch-x86/syscalls/setuid.S
syscall_src += arch-x86/syscalls/setreuid.S
syscall_src += arch-x86/syscalls/setresuid.S
syscall_src += arch-x86/syscalls/setresgid.S
syscall_src += arch-x86/syscalls/__brk.S
syscall_src += arch-x86/syscalls/kill.S

View File

@ -3,7 +3,7 @@
#include <linux/err.h>
#include <machine/asm.h>
ENTRY(__setresuid)
ENTRY(setresuid)
pushl %ebx
pushl %ecx
pushl %edx
@ -24,4 +24,4 @@ ENTRY(__setresuid)
popl %ecx
popl %ebx
ret
END(__setresuid)
END(setresuid)

View File

@ -3,7 +3,7 @@
#include <linux/err.h>
#include <machine/asm.h>
ENTRY(__setreuid)
ENTRY(setreuid)
pushl %ebx
pushl %ecx
mov 12(%esp), %ebx
@ -21,4 +21,4 @@ ENTRY(__setreuid)
popl %ecx
popl %ebx
ret
END(__setreuid)
END(setreuid)

View File

@ -3,7 +3,7 @@
#include <linux/err.h>
#include <machine/asm.h>
ENTRY(__setuid)
ENTRY(setuid)
pushl %ebx
mov 8(%esp), %ebx
movl $__NR_setuid32, %eax
@ -18,4 +18,4 @@ ENTRY(__setuid)
1:
popl %ebx
ret
END(__setuid)
END(setuid)

View File

@ -7,7 +7,6 @@ syscall_src += arch-x86_64/syscalls/__waitid.S
syscall_src += arch-x86_64/syscalls/wait4.S
syscall_src += arch-x86_64/syscalls/__sys_clone.S
syscall_src += arch-x86_64/syscalls/execve.S
syscall_src += arch-x86_64/syscalls/__setuid.S
syscall_src += arch-x86_64/syscalls/getuid.S
syscall_src += arch-x86_64/syscalls/getgid.S
syscall_src += arch-x86_64/syscalls/geteuid.S
@ -22,8 +21,9 @@ syscall_src += arch-x86_64/syscalls/getppid.S
syscall_src += arch-x86_64/syscalls/getsid.S
syscall_src += arch-x86_64/syscalls/setsid.S
syscall_src += arch-x86_64/syscalls/setgid.S
syscall_src += arch-x86_64/syscalls/__setreuid.S
syscall_src += arch-x86_64/syscalls/__setresuid.S
syscall_src += arch-x86_64/syscalls/setuid.S
syscall_src += arch-x86_64/syscalls/setreuid.S
syscall_src += arch-x86_64/syscalls/setresuid.S
syscall_src += arch-x86_64/syscalls/setresgid.S
syscall_src += arch-x86_64/syscalls/__brk.S
syscall_src += arch-x86_64/syscalls/kill.S

View File

@ -3,7 +3,7 @@
#include <linux/err.h>
#include <machine/asm.h>
ENTRY(__setresuid)
ENTRY(setresuid)
movl $__NR_setresuid, %eax
syscall
cmpq $-MAX_ERRNO, %rax
@ -14,4 +14,4 @@ ENTRY(__setresuid)
orq $-1, %rax
1:
ret
END(__setresuid)
END(setresuid)

View File

@ -3,7 +3,7 @@
#include <linux/err.h>
#include <machine/asm.h>
ENTRY(__setreuid)
ENTRY(setreuid)
movl $__NR_setreuid, %eax
syscall
cmpq $-MAX_ERRNO, %rax
@ -14,4 +14,4 @@ ENTRY(__setreuid)
orq $-1, %rax
1:
ret
END(__setreuid)
END(setreuid)

View File

@ -3,7 +3,7 @@
#include <linux/err.h>
#include <machine/asm.h>
ENTRY(__setuid)
ENTRY(setuid)
movl $__NR_setuid, %eax
syscall
cmpq $-MAX_ERRNO, %rax
@ -14,4 +14,4 @@ ENTRY(__setuid)
orq $-1, %rax
1:
ret
END(__setuid)
END(setuid)

View File

@ -1,68 +0,0 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <sys/stat.h>
#include "cpuacct.h"
#include <fcntl.h>
int cpuacct_add(uid_t uid)
{
int count;
int fd;
char buf[80];
ssize_t n;
int ret = 0;
count = snprintf(buf, sizeof(buf), "/acct/uid/%d/tasks", uid);
fd = open(buf, O_RDWR | O_CREAT, 0666);
if (fd == -1) {
/* Note: sizeof("tasks") returns 6, which includes the NULL char */
buf[count - sizeof("tasks")] = 0;
if (mkdir(buf, 0775) < 0)
return -errno;
/* Note: sizeof("tasks") returns 6, which includes the NULL char */
buf[count - sizeof("tasks")] = '/';
fd = open(buf, O_RDWR | O_CREAT, 0666);
}
if (fd == -1)
return -errno;
n = TEMP_FAILURE_RETRY(write(fd, "0", 1));
if (n < 0)
ret = -errno;
else if (n == 0)
ret = -EIO;
if (TEMP_FAILURE_RETRY(close(fd)) == -1)
return -errno;
return ret;
}

View File

@ -1,41 +0,0 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _BIONIC_CPUACCT_H
#define _BIONIC_CPUACCT_H
#include <sys/cdefs.h>
#include <sys/types.h>
__BEGIN_DECLS
extern int cpuacct_add(uid_t uid);
__END_DECLS
#endif /* _BIONIC_CPUACCT_H */

View File

@ -1,66 +0,0 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <unistd.h>
#include "pthread_internal.h"
#include "cpuacct.h"
#include "private/bionic_pthread.h"
extern int __fork(void);
int fork(void)
{
int ret;
/* Posix mandates that the timers of a fork child process be
* disarmed, but not destroyed. To avoid a race condition, we're
* going to stop all timers now, and only re-start them in case
* of error, or in the parent process
*/
__timer_table_start_stop(1);
__bionic_atfork_run_prepare();
ret = __fork();
if (ret != 0) { /* not a child process */
__timer_table_start_stop(0);
__bionic_atfork_run_parent();
} else {
// Fix the tid in the pthread_internal_t struct after a fork.
__pthread_settid(pthread_self(), gettid());
/*
* 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());
__bionic_atfork_run_child();
}
return ret;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -25,14 +25,30 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <unistd.h>
#include "cpuacct.h"
#include "pthread_internal.h"
extern int __setresuid(uid_t ruid, uid_t euid, uid_t suid);
#include "private/bionic_pthread.h"
int setresuid(uid_t ruid, uid_t euid, uid_t suid)
{
cpuacct_add(euid);
return __setresuid(ruid, euid, suid);
extern "C" int __fork();
int fork() {
// POSIX mandates that the timers of a fork child process be
// disarmed, but not destroyed. To avoid a race condition, we're
// going to stop all timers now, and only re-start them in case
// of error, or in the parent process
__timer_table_start_stop(1);
__bionic_atfork_run_prepare();
int result = __fork();
if (result != 0) { // Not a child process.
__timer_table_start_stop(0);
__bionic_atfork_run_parent();
} else {
// Fix the tid in the pthread_internal_t struct after a fork.
__pthread_settid(pthread_self(), gettid());
__bionic_atfork_run_child();
}
return result;
}

View File

@ -25,9 +25,9 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <unistd.h>
int setegid(gid_t egid)
{
return setresgid(-1, egid, -1);
int setegid(gid_t egid) {
return setresgid(-1, egid, -1);
}

View File

@ -25,13 +25,9 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <unistd.h>
#include "cpuacct.h"
extern int __setresuid(uid_t, uid_t, uid_t);
int seteuid(uid_t euid)
{
cpuacct_add(euid);
return __setresuid(-1, euid,-1);
int seteuid(uid_t euid) {
return setresuid(-1, euid,-1);
}

View File

@ -1,37 +0,0 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <unistd.h>
#include "cpuacct.h"
extern int __setreuid(uid_t ruid, uid_t euid);
int setreuid(uid_t ruid, uid_t euid)
{
cpuacct_add(euid);
return __setreuid(ruid, euid);
}

View File

@ -1,37 +0,0 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <unistd.h>
#include "cpuacct.h"
extern int __setuid(uid_t);
int setuid(uid_t uid)
{
cpuacct_add(uid);
return __setuid(uid);
}