actually, we need the android lsmod to be a builtin not an alias…

This commit is contained in:
tg 2011-03-16 20:56:33 +00:00
parent 1c22b3cc48
commit 5239e8ea4c
3 changed files with 25 additions and 78 deletions

76
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.428 2011/03/16 20:26:34 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.429 2011/03/16 20:56:30 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -5528,7 +5528,7 @@ expected-stdout:
name: aliases-1-hartz4
description:
Check if built-in shell aliases are okay
category: arge
category: android,arge
stdin:
alias
typeset -f
@ -5546,28 +5546,6 @@ expected-stdout:
source='PATH=$PATH:. command .'
type='whence -v'
---
name: aliases-1-android
description:
Check if built-in shell aliases are okay
category: android
stdin:
alias
typeset -f
expected-stdout:
autoload='typeset -fu'
functions='typeset -f'
hash='alias -t'
history='fc -l'
integer='typeset -i'
local=typeset
login='exec login'
lsmod='cat /proc/modules'
nameref='typeset -n'
nohup='nohup '
r='fc -e -'
source='PATH=$PATH:. command .'
type='whence -v'
---
name: aliases-2a
description:
Check if set -o sh disables built-in aliases (except a few)
@ -5643,7 +5621,7 @@ expected-stdout:
name: aliases-2b-hartz4
description:
Check if set -o sh does not influence built-in aliases
category: arge
category: android,arge
arguments: !-o!sh!
stdin:
alias
@ -5665,7 +5643,7 @@ expected-stdout:
name: aliases-3b-hartz4
description:
Check if running as sh does not influence built-in aliases
category: arge
category: android,arge
stdin:
cp "$__progname" sh
./sh -c 'alias; typeset -f'
@ -5684,52 +5662,6 @@ expected-stdout:
source='PATH=$PATH:. command .'
type='whence -v'
---
name: aliases-2b-android
description:
Check if set -o sh does not influence built-in aliases
category: android
arguments: !-o!sh!
stdin:
alias
typeset -f
expected-stdout:
autoload='typeset -fu'
functions='typeset -f'
hash='alias -t'
history='fc -l'
integer='typeset -i'
local=typeset
login='exec login'
lsmod='cat /proc/modules'
nameref='typeset -n'
nohup='nohup '
r='fc -e -'
source='PATH=$PATH:. command .'
type='whence -v'
---
name: aliases-3b-android
description:
Check if running as sh does not influence built-in aliases
category: android
stdin:
cp "$__progname" sh
./sh -c 'alias; typeset -f'
rm -f sh
expected-stdout:
autoload='typeset -fu'
functions='typeset -f'
hash='alias -t'
history='fc -l'
integer='typeset -i'
local=typeset
login='exec login'
lsmod='cat /proc/modules'
nameref='typeset -n'
nohup='nohup '
r='fc -e -'
source='PATH=$PATH:. command .'
type='whence -v'
---
name: aliases-funcdef-1
description:
Check if POSIX functions take precedences over aliases

20
funcs.c
View File

@ -38,7 +38,7 @@
#endif
#endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.176 2011/03/13 01:20:19 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.177 2011/03/16 20:56:32 tg Exp $");
#if HAVE_KILLPG
/*
@ -60,6 +60,10 @@ __RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.176 2011/03/13 01:20:19 tg Exp $");
#define c_ulimit c_label
#endif
#if defined(ANDROID)
static int c_android_lsmod(const char **);
#endif
extern uint8_t set_refflag;
/*
@ -130,6 +134,9 @@ const struct builtin mkshbuiltins[] = {
#ifdef __MirBSD__
/* alias to "true" for historical reasons */
{"domainname", c_label},
#endif
#if defined(ANDROID)
{"lsmod", c_android_lsmod},
#endif
{NULL, (int (*)(const char **))NULL}
};
@ -3717,3 +3724,14 @@ c_sleep(const char **wp)
return (rv);
}
#endif
#if defined(ANDROID)
static int
c_android_lsmod(const char **wp MKSH_A_UNUSED)
{
const char *cwp[3] = { "cat", "/proc/modules", NULL };
builtin_argv0 = cwp[0];
return (c_cat(cwp));
}
#endif

7
main.c
View File

@ -33,7 +33,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.183 2011/03/16 20:43:34 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.184 2011/03/16 20:56:33 tg Exp $");
extern char **environ;
@ -70,10 +70,7 @@ static const char *initcoms[] = {
/* not "alias -t --": hash -r needs to work */
"hash=alias -t",
"type=whence -v",
#if defined(ANDROID)
/* evil hack */
"lsmod=cat /proc/modules",
#elif !defined(MKSH_UNEMPLOYED)
#if !defined(ANDROID) && !defined(MKSH_UNEMPLOYED)
/* not in Android for political reasons */
/* not in ARGE mksh due to no job control */
"stop=kill -STOP",