1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#include <linux/config.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/a.out.h>
#include <linux/malloc.h>
#include <linux/sched.h>
#include <linux/user.h>
#include <asm/pgtable.h>
#if LINUX_VERSION_CODE >= 66375
unsigned long *
create_ibcs_tables(char *p, struct linux_binprm *bprm, int ibcs)
{
unsigned long *argv,*envp;
unsigned long * sp;
int argc = bprm->argc;
int envc = bprm->envc;
sp = (unsigned long *) ((-(unsigned long)sizeof(char *)) & (unsigned long) p);
sp -= envc+1;
envp = sp;
sp -= argc+1;
argv = sp;
if (!ibcs) {
put_user(envp,--sp);
put_user(argv,--sp);
}
put_user(argc,--sp);
current->mm->arg_start = (unsigned long) p;
while (argc-->0) {
put_user(p,argv++);
while (get_user(p++)) /* nothing */ ;
}
put_user(NULL,argv);
current->mm->arg_end = current->mm->env_start = (unsigned long) p;
while (envc-->0) {
put_user(p,envp++);
while (get_user(p++)) /* nothing */ ;
}
put_user(NULL,envp);
current->mm->env_end = (unsigned long) p;
return sp;
}
#endif
|