http://www.gnu.org/software/libc/#CurrentStatus
get source code
git clone git://sourceware.org/git/glibc.git
do branch
cd glibc
git checkout --track -b glibc-2_11-branch origin/release/2.11/master
android bionic system function:
int
system(const char *command)
{
pid_t pid;
sig_t intsave, quitsave;
sigset_t mask, omask;
int pstat;
char *argp[] = {"sh", "-c", NULL, NULL};
if (!command) /* just checking... */
return(1);
argp[2] = (char *)command;
sigemptyset(&mask);
sigaddset(&mask, SIGCHLD);
sigprocmask(SIG_BLOCK, &mask, &omask);
switch (pid = vfork()) {
case -1: /* error */
sigprocmask(SIG_SETMASK, &omask, NULL);
return(-1);
case 0: /* child */
sigprocmask(SIG_SETMASK, &omask, NULL);
execve(_PATH_BSHELL, argp, environ);
_exit(127);
}
intsave = (sig_t) bsd_signal(SIGINT, SIG_IGN);
quitsave = (sig_t) bsd_signal(SIGQUIT, SIG_IGN);
pid = waitpid(pid, (int *)&pstat, 0);
sigprocmask(SIG_SETMASK, &omask, NULL);
(void)bsd_signal(SIGINT, intsave);
(void)bsd_signal(SIGQUIT, quitsave);
return (pid == -1 ? -1 : pstat);
}
glibc system
/* Execute LINE as a shell command. */
int
__libc_system (line)
const char *line;
{
if (line == NULL)
return 0; /* This indicates no command processor. */
__set_errno (ENOSYS);
return -1;
}
weak_alias (__libc_system, system)
stub_warning (system)
#include
It's a big difference.
沒有留言:
張貼留言