* libc/sys/sh/sys/syscall.h (SYS_get_argc, SYS_get_argN_len,
SYS_get_argN): * libc/sys/sh/syscalls.c (__setup_argv_for_main, __setup_argv_and_call_main): New.
This commit is contained in:
parent
67997034e8
commit
b5139f598b
|
@ -1,3 +1,10 @@
|
|||
2001-02-01 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
* libc/sys/sh/sys/syscall.h (SYS_get_argc, SYS_get_argN_len,
|
||||
SYS_get_argN):
|
||||
* libc/sys/sh/syscalls.c (__setup_argv_for_main,
|
||||
__setup_argv_and_call_main): New.
|
||||
|
||||
2001-01-31 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* libc/include/stdio.h (FILENAME_MAX): Changed to use __FILENAME_MAX__
|
||||
|
|
|
@ -27,5 +27,9 @@
|
|||
#define SYS_pipe 42
|
||||
#define SYS_execve 59
|
||||
|
||||
#define SYS_argc 172 /* == 0xAC, for Argument Count :-) */
|
||||
#define SYS_argnlen 173
|
||||
#define SYS_argn 174
|
||||
|
||||
#define SYS_utime 201 /* not really a system call */
|
||||
#define SYS_wait 202 /* nor is this */
|
||||
|
|
|
@ -191,3 +191,31 @@ _gettimeofday (struct timeval *tv, struct timezone *tz)
|
|||
tv->tv_sec = __trap34 (SYS_time);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
__setup_argv_for_main (int argc)
|
||||
{
|
||||
char **argv;
|
||||
int i = argc;
|
||||
|
||||
argv = __builtin_alloca ((1 + argc) * sizeof (*argv));
|
||||
|
||||
argv[i] = NULL;
|
||||
while (i--) {
|
||||
argv[i] = __builtin_alloca (1 + __trap34 (SYS_argnlen, i));
|
||||
__trap34 (SYS_argn, i, argv[i]);
|
||||
}
|
||||
|
||||
return main (argc, argv);
|
||||
}
|
||||
|
||||
int
|
||||
__setup_argv_and_call_main ()
|
||||
{
|
||||
int argc = __trap34 (SYS_argc);
|
||||
|
||||
if (argc <= 0)
|
||||
return main (argc, NULL);
|
||||
else
|
||||
return __setup_argv_for_main (argc);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue