diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b4fb6b4..0000000 --- a/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# ---> VisualStudioCode -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace - diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 204b93d..0000000 --- a/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -MIT License Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice (including the next -paragraph) shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS -OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/execve2.c b/execve2.c deleted file mode 100644 index dd2d18f..0000000 --- a/execve2.c +++ /dev/null @@ -1,359 +0,0 @@ -/* - * linux/fs/exec.c - * - * (C) 1991 Linus Torvalds - */ - -/* - * #!-checking implemented by tytso. - */ - -/* - * Demand-loading implemented 01.12.91 - no need to read anything but - * the header into memory. The inode of the executable is put into - * "current->executable", and page faults do the actual loading. Clean. - * - * Once more I can proudly say that linux stood up to being changed: it - * was less than 2 hours work to get demand-loading completely implemented. - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -extern int sys_exit(int exit_code); -extern int sys_close(int fd); - -/* - * MAX_ARG_PAGES defines the number of pages allocated for arguments - * and envelope for the new program. 32 should suffice, this gives - * a maximum env+arg of 128kB ! - */ -#define MAX_ARG_PAGES 32 - -/* - * create_tables() parses the env- and arg-strings in new user - * memory and creates the pointer tables from them, and puts their - * addresses on the "stack", returning the new stack pointer value. - */ -static unsigned long * create_tables(char * p,int argc,int envc) -{ - unsigned long *argv,*envp; - unsigned long * sp; - - sp = (unsigned long *) (0xfffffffc & (unsigned long) p); - sp -= envc+1; - envp = sp; - sp -= argc+1; - argv = sp; - put_fs_long((unsigned long)envp,--sp); - put_fs_long((unsigned long)argv,--sp); - put_fs_long((unsigned long)argc,--sp); - while (argc-->0) { - put_fs_long((unsigned long) p,argv++); - while (get_fs_byte(p++)) /* nothing */ ; - } - put_fs_long(0,argv); - while (envc-->0) { - put_fs_long((unsigned long) p,envp++); - while (get_fs_byte(p++)) /* nothing */ ; - } - put_fs_long(0,envp); - return sp; -} - -/* - * count() counts the number of arguments/envelopes - */ -static int count(char ** argv) -{ - int i=0; - char ** tmp; - - if (tmp = argv) - while (get_fs_long((unsigned long *) (tmp++))) - i++; - - return i; -} - -/* - * 'copy_string()' copies argument/envelope strings from user - * memory to free pages in kernel mem. These are in a format ready - * to be put directly into the top of new user memory. - * - * Modified by TYT, 11/24/91 to add the from_kmem argument, which specifies - * whether the string and the string array are from user or kernel segments: - * - * from_kmem argv * argv ** - * 0 user space user space - * 1 kernel space user space - * 2 kernel space kernel space - * - * We do this by playing games with the fs segment register. Since it - * it is expensive to load a segment register, we try to avoid calling - * set_fs() unless we absolutely have to. - */ -static unsigned long copy_strings(int argc,char ** argv,unsigned long *page, - unsigned long p, int from_kmem) -{ - char *tmp, *pag; - int len, offset = 0; - unsigned long old_fs, new_fs; - - if (!p) - return 0; /* bullet-proofing */ - new_fs = get_ds(); - old_fs = get_fs(); - if (from_kmem==2) - set_fs(new_fs); - while (argc-- > 0) { - if (from_kmem == 1) - set_fs(new_fs); - if (!(tmp = (char *)get_fs_long(((unsigned long *)argv)+argc))) - panic("argc is wrong"); - if (from_kmem == 1) - set_fs(old_fs); - len=0; /* remember zero-padding */ - do { - len++; - } while (get_fs_byte(tmp++)); - if (p-len < 0) { /* this shouldn't happen - 128kB */ - set_fs(old_fs); - return 0; - } - while (len) { - --p; --tmp; --len; - if (--offset < 0) { - offset = p % PAGE_SIZE; - if (from_kmem==2) - set_fs(old_fs); - if (!(pag = (char *) page[p/PAGE_SIZE]) && - !(pag = (char *) (page[p/PAGE_SIZE] = - (unsigned long *) get_free_page()))) - return 0; - if (from_kmem==2) - set_fs(new_fs); - - } - *(pag + offset) = get_fs_byte(tmp); - } - } - if (from_kmem==2) - set_fs(old_fs); - return p; -} - -static unsigned long change_ldt(unsigned long text_size,unsigned long * page) -{ - unsigned long code_limit,data_limit,code_base,data_base; - int i; - - code_limit = text_size+PAGE_SIZE -1; - code_limit &= 0xFFFFF000; - data_limit = 0x4000000; - code_base = get_base(current->ldt[1]); - data_base = code_base; - set_base(current->ldt[1],code_base); - set_limit(current->ldt[1],code_limit); - set_base(current->ldt[2],data_base); - set_limit(current->ldt[2],data_limit); -/* make sure fs points to the NEW data segment */ - __asm__("pushl $0x17\n\tpop %%fs"::); - data_base += data_limit; - for (i=MAX_ARG_PAGES-1 ; i>=0 ; i--) { - data_base -= PAGE_SIZE; - if (page[i]) - put_page(page[i],data_base); - } - return data_limit; -} - -/* - * 'do_execve()' executes a new program. - */ -int do_execve2(unsigned long * eip,long tmp,char * filename, - char ** argv, char ** envp) -{ - struct m_inode * inode; - struct buffer_head * bh; - struct exec ex; - unsigned long page[MAX_ARG_PAGES]; - int i,argc,envc; - int e_uid, e_gid; - int retval; - unsigned long cur_adr; - int sh_bang = 0; - unsigned long p=PAGE_SIZE*MAX_ARG_PAGES-4; - - if ((0xffff & eip[1]) != 0x000f) - panic("execve called from supervisor mode"); - for (i=0 ; ii_mode)) { /* must be regular file */ - retval = -EACCES; - goto exec_error2; - } - i = inode->i_mode; - e_uid = (i & S_ISUID) ? inode->i_uid : current->euid; - e_gid = (i & S_ISGID) ? inode->i_gid : current->egid; - if (current->euid == inode->i_uid) - i >>= 6; - else if (current->egid == inode->i_gid) - i >>= 3; - if (!(i & 1) && - !((inode->i_mode & 0111) && suser())) { - retval = -ENOEXEC; - goto exec_error2; - } - if (!(bh = bread(inode->i_dev,inode->i_zone[0]))) { - retval = -EACCES; - goto exec_error2; - } - ex = *((struct exec *) bh->b_data); /* read exec-header */ - if ((bh->b_data[0] == '#') && (bh->b_data[1] == '!') && (!sh_bang)) { - /* - * This section does the #! interpretation. - * Sorta complicated, but hopefully it will work. -TYT - */ - - char buf[1023], *cp, *interp, *i_name, *i_arg; - unsigned long old_fs; - - strncpy(buf, bh->b_data+2, 1022); - brelse(bh); - iput(inode); - buf[1022] = '\0'; - if (cp = strchr(buf, '\n')) { - *cp = '\0'; - for (cp = buf; (*cp == ' ') || (*cp == '\t'); cp++); - } - if (!cp || *cp == '\0') { - retval = -ENOEXEC; /* No interpreter name found */ - goto exec_error1; - } - interp = i_name = cp; - i_arg = 0; - for ( ; *cp && (*cp != ' ') && (*cp != '\t'); cp++) { - if (*cp == '/') - i_name = cp+1; - } - if (*cp) { - *cp++ = '\0'; - i_arg = cp; - } - /* - * OK, we've parsed out the interpreter name and - * (optional) argument. - */ - if (sh_bang++ == 0) { - p = copy_strings(envc, envp, page, p, 0); - p = copy_strings(--argc, argv+1, page, p, 0); - } - /* - * Splice in (1) the interpreter's name for argv[0] - * (2) (optional) argument to interpreter - * (3) filename of shell script - * - * This is done in reverse order, because of how the - * user environment and arguments are stored. - */ - p = copy_strings(1, &filename, page, p, 1); - argc++; - if (i_arg) { - p = copy_strings(1, &i_arg, page, p, 2); - argc++; - } - p = copy_strings(1, &i_name, page, p, 2); - argc++; - if (!p) { - retval = -ENOMEM; - goto exec_error1; - } - /* - * OK, now restart the process with the interpreter's inode. - */ - old_fs = get_fs(); - set_fs(get_ds()); - if (!(inode=namei(interp))) { /* get executables inode */ - set_fs(old_fs); - retval = -ENOENT; - goto exec_error1; - } - set_fs(old_fs); - goto restart_interp; - } - brelse(bh); - if (N_MAGIC(ex) != ZMAGIC || ex.a_trsize || ex.a_drsize || - ex.a_text+ex.a_data+ex.a_bss>0x3000000 || - inode->i_size < ex.a_text+ex.a_data+ex.a_syms+N_TXTOFF(ex)) { - retval = -ENOEXEC; - goto exec_error2; - } - if (N_TXTOFF(ex) != BLOCK_SIZE) { - printk("%s: N_TXTOFF != BLOCK_SIZE. See a.out.h.", filename); - retval = -ENOEXEC; - goto exec_error2; - } - if (!sh_bang) { - p = copy_strings(envc,envp,page,p,0); - p = copy_strings(argc,argv,page,p,0); - if (!p) { - retval = -ENOMEM; - goto exec_error2; - } - } -/* OK, This is the point of no return */ - if (current->executable) - iput(current->executable); - current->executable = inode; - for (i=0 ; i<32 ; i++) - current->sigaction[i].sa_handler = NULL; - for (i=0 ; iclose_on_exec>>i)&1) - sys_close(i); - current->close_on_exec = 0; - free_page_tables(get_base(current->ldt[1]),get_limit(0x0f)); - free_page_tables(get_base(current->ldt[2]),get_limit(0x17)); - if (last_task_used_math == current) - last_task_used_math = NULL; - current->used_math = 0; - p += change_ldt(ex.a_text,page)-MAX_ARG_PAGES*PAGE_SIZE; - p = (unsigned long) create_tables((char *)p,argc,envc); - current->brk = ex.a_bss + - (current->end_data = ex.a_data + - (current->end_code = ex.a_text)); - current->start_stack = p & 0xfffff000; - current->euid = e_uid; - current->egid = e_gid; - - - for (cur_adr=0; cur_adrbrk; cur_adr+=0x1000) - do_no_page_plus(6, cur_adr+current->start_code); - - i = ex.a_text+ex.a_data; - while (i&0xfff) - put_fs_byte(0,(char *) (i++)); - eip[0] = ex.a_entry; /* eip, magic happens :-) */ - eip[3] = p; /* stack pointer */ - return 0; -exec_error2: - iput(inode); -exec_error1: - for (i=0 ; iexecutable", and page faults do the actual loading. Clean. - * - * Once more I can proudly say that linux stood up to being changed: it - * was less than 2 hours work to get demand-loading completely implemented. - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -extern int sys_exit(int exit_code); -extern int sys_close(int fd); - -/* - * MAX_ARG_PAGES defines the number of pages allocated for arguments - * and envelope for the new program. 32 should suffice, this gives - * a maximum env+arg of 128kB ! - */ -#define MAX_ARG_PAGES 32 - -/* - * create_tables() parses the env- and arg-strings in new user - * memory and creates the pointer tables from them, and puts their - * addresses on the "stack", returning the new stack pointer value. - */ -static unsigned long * create_tables(char * p,int argc,int envc) -{ - unsigned long *argv,*envp; - unsigned long * sp; - - sp = (unsigned long *) (0xfffffffc & (unsigned long) p); - sp -= envc+1; - envp = sp; - sp -= argc+1; - argv = sp; - put_fs_long((unsigned long)envp,--sp); - put_fs_long((unsigned long)argv,--sp); - put_fs_long((unsigned long)argc,--sp); - while (argc-->0) { - put_fs_long((unsigned long) p,argv++); - while (get_fs_byte(p++)) /* nothing */ ; - } - put_fs_long(0,argv); - while (envc-->0) { - put_fs_long((unsigned long) p,envp++); - while (get_fs_byte(p++)) /* nothing */ ; - } - put_fs_long(0,envp); - return sp; -} - -/* - * count() counts the number of arguments/envelopes - */ -static int count(char ** argv) -{ - int i=0; - char ** tmp; - - if (tmp = argv) - while (get_fs_long((unsigned long *) (tmp++))) - i++; - - return i; -} - -/* - * 'copy_string()' copies argument/envelope strings from user - * memory to free pages in kernel mem. These are in a format ready - * to be put directly into the top of new user memory. - * - * Modified by TYT, 11/24/91 to add the from_kmem argument, which specifies - * whether the string and the string array are from user or kernel segments: - * - * from_kmem argv * argv ** - * 0 user space user space - * 1 kernel space user space - * 2 kernel space kernel space - * - * We do this by playing games with the fs segment register. Since it - * it is expensive to load a segment register, we try to avoid calling - * set_fs() unless we absolutely have to. - */ -static unsigned long copy_strings(int argc,char ** argv,unsigned long *page, - unsigned long p, int from_kmem) -{ - char *tmp, *pag; - int len, offset = 0; - unsigned long old_fs, new_fs; - - if (!p) - return 0; /* bullet-proofing */ - new_fs = get_ds(); - old_fs = get_fs(); - if (from_kmem==2) - set_fs(new_fs); - while (argc-- > 0) { - if (from_kmem == 1) - set_fs(new_fs); - if (!(tmp = (char *)get_fs_long(((unsigned long *)argv)+argc))) - panic("argc is wrong"); - if (from_kmem == 1) - set_fs(old_fs); - len=0; /* remember zero-padding */ - do { - len++; - } while (get_fs_byte(tmp++)); - if (p-len < 0) { /* this shouldn't happen - 128kB */ - set_fs(old_fs); - return 0; - } - while (len) { - --p; --tmp; --len; - if (--offset < 0) { - offset = p % PAGE_SIZE; - if (from_kmem==2) - set_fs(old_fs); - if (!(pag = (char *) page[p/PAGE_SIZE]) && - !(pag = (char *) (page[p/PAGE_SIZE] = - (unsigned long *) get_free_page()))) - return 0; - if (from_kmem==2) - set_fs(new_fs); - - } - *(pag + offset) = get_fs_byte(tmp); - } - } - if (from_kmem==2) - set_fs(old_fs); - return p; -} - -static unsigned long change_ldt(unsigned long text_size,unsigned long * page) -{ - unsigned long code_limit,data_limit,code_base,data_base; - int i; - - code_limit = text_size+PAGE_SIZE -1; - code_limit &= 0xFFFFF000; - data_limit = 0x4000000; - code_base = get_base(current->ldt[1]); - data_base = code_base; - set_base(current->ldt[1],code_base); - set_limit(current->ldt[1],code_limit); - set_base(current->ldt[2],data_base); - set_limit(current->ldt[2],data_limit); -/* make sure fs points to the NEW data segment */ - __asm__("pushl $0x17\n\tpop %%fs"::); - data_base += data_limit; - for (i=MAX_ARG_PAGES-1 ; i>=0 ; i--) { - data_base -= PAGE_SIZE; - if (page[i]) - put_page(page[i],data_base); - } - return data_limit; -} - -/* - * 'do_execve()' executes a new program. - */ -int do_execve2(unsigned long * eip,long tmp,char * filename, - char ** argv, char ** envp) -{ - struct m_inode * inode; - struct buffer_head * bh; - struct exec ex; - unsigned long page[MAX_ARG_PAGES]; - int i,argc,envc; - int e_uid, e_gid; - int retval; - unsigned long cur_adr; - int sh_bang = 0; - unsigned long p=PAGE_SIZE*MAX_ARG_PAGES-4; - - if ((0xffff & eip[1]) != 0x000f) - panic("execve called from supervisor mode"); - for (i=0 ; ii_mode)) { /* must be regular file */ - retval = -EACCES; - goto exec_error2; - } - i = inode->i_mode; - e_uid = (i & S_ISUID) ? inode->i_uid : current->euid; - e_gid = (i & S_ISGID) ? inode->i_gid : current->egid; - if (current->euid == inode->i_uid) - i >>= 6; - else if (current->egid == inode->i_gid) - i >>= 3; - if (!(i & 1) && - !((inode->i_mode & 0111) && suser())) { - retval = -ENOEXEC; - goto exec_error2; - } - if (!(bh = bread(inode->i_dev,inode->i_zone[0]))) { - retval = -EACCES; - goto exec_error2; - } - ex = *((struct exec *) bh->b_data); /* read exec-header */ - if ((bh->b_data[0] == '#') && (bh->b_data[1] == '!') && (!sh_bang)) { - /* - * This section does the #! interpretation. - * Sorta complicated, but hopefully it will work. -TYT - */ - - char buf[1023], *cp, *interp, *i_name, *i_arg; - unsigned long old_fs; - - strncpy(buf, bh->b_data+2, 1022); - brelse(bh); - iput(inode); - buf[1022] = '\0'; - if (cp = strchr(buf, '\n')) { - *cp = '\0'; - for (cp = buf; (*cp == ' ') || (*cp == '\t'); cp++); - } - if (!cp || *cp == '\0') { - retval = -ENOEXEC; /* No interpreter name found */ - goto exec_error1; - } - interp = i_name = cp; - i_arg = 0; - for ( ; *cp && (*cp != ' ') && (*cp != '\t'); cp++) { - if (*cp == '/') - i_name = cp+1; - } - if (*cp) { - *cp++ = '\0'; - i_arg = cp; - } - /* - * OK, we've parsed out the interpreter name and - * (optional) argument. - */ - if (sh_bang++ == 0) { - p = copy_strings(envc, envp, page, p, 0); - p = copy_strings(--argc, argv+1, page, p, 0); - } - /* - * Splice in (1) the interpreter's name for argv[0] - * (2) (optional) argument to interpreter - * (3) filename of shell script - * - * This is done in reverse order, because of how the - * user environment and arguments are stored. - */ - p = copy_strings(1, &filename, page, p, 1); - argc++; - if (i_arg) { - p = copy_strings(1, &i_arg, page, p, 2); - argc++; - } - p = copy_strings(1, &i_name, page, p, 2); - argc++; - if (!p) { - retval = -ENOMEM; - goto exec_error1; - } - /* - * OK, now restart the process with the interpreter's inode. - */ - old_fs = get_fs(); - set_fs(get_ds()); - if (!(inode=namei(interp))) { /* get executables inode */ - set_fs(old_fs); - retval = -ENOENT; - goto exec_error1; - } - set_fs(old_fs); - goto restart_interp; - } - brelse(bh); - if (N_MAGIC(ex) != ZMAGIC || ex.a_trsize || ex.a_drsize || - ex.a_text+ex.a_data+ex.a_bss>0x3000000 || - inode->i_size < ex.a_text+ex.a_data+ex.a_syms+N_TXTOFF(ex)) { - retval = -ENOEXEC; - goto exec_error2; - } - if (N_TXTOFF(ex) != BLOCK_SIZE) { - printk("%s: N_TXTOFF != BLOCK_SIZE. See a.out.h.", filename); - retval = -ENOEXEC; - goto exec_error2; - } - if (!sh_bang) { - p = copy_strings(envc,envp,page,p,0); - p = copy_strings(argc,argv,page,p,0); - if (!p) { - retval = -ENOMEM; - goto exec_error2; - } - } -/* OK, This is the point of no return */ - if (current->executable) - iput(current->executable); - current->executable = inode; - for (i=0 ; i<32 ; i++) - current->sigaction[i].sa_handler = NULL; - for (i=0 ; iclose_on_exec>>i)&1) - sys_close(i); - current->close_on_exec = 0; - free_page_tables(get_base(current->ldt[1]),get_limit(0x0f)); - free_page_tables(get_base(current->ldt[2]),get_limit(0x17)); - if (last_task_used_math == current) - last_task_used_math = NULL; - current->used_math = 0; - p += change_ldt(ex.a_text,page)-MAX_ARG_PAGES*PAGE_SIZE; - p = (unsigned long) create_tables((char *)p,argc,envc); - current->brk = ex.a_bss + - (current->end_data = ex.a_data + - (current->end_code = ex.a_text)); - current->start_stack = p & 0xfffff000; - current->euid = e_uid; - current->egid = e_gid; - - - for (cur_adr=0; cur_adrbrk; cur_adr+=0x1000) - do_no_page_plus(6, cur_adr+current->start_code); - - i = ex.a_text+ex.a_data; - while (i&0xfff) - put_fs_byte(0,(char *) (i++)); - eip[0] = ex.a_entry; /* eip, magic happens :-) */ - eip[3] = p; /* stack pointer */ - return 0; -exec_error2: - iput(inode); -exec_error1: - for (i=0 ; i -#include -#include -#include - -#include -#include -#include -#include -#include - -struct linux_dirent { - long d_ino; - off_t d_off; - unsigned short d_reclen; - char d_name[14]; -}; - -int sys_getdents(unsigned int fd, struct linux_dirent *d, unsigned int count) -{ - struct file *f; - struct m_inode * m; - struct buffer_head * b; - struct dir_entry * dir; - int i,j,k,res; - struct linux_dirent usrd; - i=0; - res=0; - f=current->filp[fd]; - m=f->f_inode; - b=bread(m->i_dev,m->i_zone[0]); - dir=(struct dir_entry*)b->b_data; - while(dir[i].inode>0) - { - if(res+sizeof(struct linux_dirent)>count) - break; - usrd.d_ino=dir[i].inode; - usrd.d_off=0; - usrd.d_reclen=sizeof(struct linux_dirent); - for(j=0;j<14;j++) - usrd.d_name[j]=dir[i].name[j]; - for(k=0;k -#include -#include -#include - -#include -#include -#include -#include -#include - -struct linux_dirent { - long d_ino; - off_t d_off; - unsigned short d_reclen; - char d_name[14]; -}; - -int sys_getdents(unsigned int fd, struct linux_dirent *d, unsigned int count) -{ - struct file *f; - struct m_inode * m; - struct buffer_head * b; - struct dir_entry * dir; - int i,j,k,res; - struct linux_dirent usrd; - i=0; - res=0; - f=current->filp[fd]; - m=f->f_inode; - b=bread(m->i_dev,m->i_zone[0]); - dir=(struct dir_entry*)b->b_data; - while(dir[i].inode>0) - { - if(res+sizeof(struct linux_dirent)>count) - break; - usrd.d_ino=dir[i].inode; - usrd.d_off=0; - usrd.d_reclen=sizeof(struct linux_dirent); - for(j=0;j<14;j++) - usrd.d_name[j]=dir[i].name[j]; - for(k=0;k - -#include -#include /* for get_free_page */ -#include - - -int sys_pipe2(unsigned long * fildes,int flag) -{ - struct m_inode * inode; - struct file * f[2]; - int fd[2]; - int i,j; - if(flag==0){ - j=0; - for(i=0;j<2 && if_count++; - if (j==1) - f[0]->f_count=0; - if (j<2) - return -1; - j=0; - for(i=0;j<2 && ifilp[i]) { - current->filp[ fd[j]=i ] = f[j]; - j++; - } - if (j==1) - current->filp[fd[0]]=NULL; - if (j<2) { - f[0]->f_count=f[1]->f_count=0; - return -1; - } - if (!(inode=get_pipe_inode())) { - current->filp[fd[0]] = - current->filp[fd[1]] = NULL; - f[0]->f_count = f[1]->f_count = 0; - return -1; - } - f[0]->f_inode = f[1]->f_inode = inode; - f[0]->f_pos = f[1]->f_pos = 0; - f[0]->f_mode = 1; /* read */ - f[1]->f_mode = 2; /* write */ - put_fs_long(fd[0],0+fildes); - put_fs_long(fd[1],1+fildes); - } - return 0; -} diff --git a/pipe2_1.c b/pipe2_1.c deleted file mode 100644 index bbc99db..0000000 --- a/pipe2_1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * linux/fs/pipe.c - * - * (C) 1991 Linus Torvalds - */ - -#include - -#include -#include /* for get_free_page */ -#include - - -int sys_pipe2(unsigned long * fildes,int flag) -{ - struct m_inode * inode; - struct file * f[2]; - int fd[2]; - int i,j; - if(flag==0){ - j=0; - for(i=0;j<2 && if_count++; - if (j==1) - f[0]->f_count=0; - if (j<2) - return -1; - j=0; - for(i=0;j<2 && ifilp[i]) { - current->filp[ fd[j]=i ] = f[j]; - j++; - } - if (j==1) - current->filp[fd[0]]=NULL; - if (j<2) { - f[0]->f_count=f[1]->f_count=0; - return -1; - } - if (!(inode=get_pipe_inode())) { - current->filp[fd[0]] = - current->filp[fd[1]] = NULL; - f[0]->f_count = f[1]->f_count = 0; - return -1; - } - f[0]->f_inode = f[1]->f_inode = inode; - f[0]->f_pos = f[1]->f_pos = 0; - f[0]->f_mode = 1; /* read */ - f[1]->f_mode = 2; /* write */ - put_fs_long(fd[0],0+fildes); - put_fs_long(fd[1],1+fildes); - } - return 0; -} diff --git a/sys.h b/sys.h deleted file mode 100644 index 20b731a..0000000 --- a/sys.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Why isn't this a .c file? Enquiring minds.... - */ - -extern int sys_setup(); -extern int sys_exit(); -extern int sys_fork(); -extern int sys_read(); -extern int sys_write(); -extern int sys_open(); -extern int sys_close(); -extern int sys_waitpid(); -extern int sys_creat(); -extern int sys_link(); -extern int sys_unlink(); -extern int sys_execve(); -extern int sys_chdir(); -extern int sys_time(); -extern int sys_mknod(); -extern int sys_chmod(); -extern int sys_chown(); -extern int sys_break(); -extern int sys_stat(); -extern int sys_lseek(); -extern int sys_getpid(); -extern int sys_mount(); -extern int sys_umount(); -extern int sys_setuid(); -extern int sys_getuid(); -extern int sys_stime(); -extern int sys_ptrace(); -extern int sys_alarm(); -extern int sys_fstat(); -extern int sys_pause(); -extern int sys_utime(); -extern int sys_stty(); -extern int sys_gtty(); -extern int sys_access(); -extern int sys_nice(); -extern int sys_ftime(); -extern int sys_sync(); -extern int sys_kill(); -extern int sys_rename(); -extern int sys_mkdir(); -extern int sys_rmdir(); -extern int sys_dup(); -extern int sys_pipe(); -extern int sys_times(); -extern int sys_prof(); -extern int sys_brk(); -extern int sys_setgid(); -extern int sys_getgid(); -extern int sys_signal(); -extern int sys_geteuid(); -extern int sys_getegid(); -extern int sys_acct(); -extern int sys_phys(); -extern int sys_lock(); -extern int sys_ioctl(); -extern int sys_fcntl(); -extern int sys_mpx(); -extern int sys_setpgid(); -extern int sys_ulimit(); -extern int sys_uname(); -extern int sys_umask(); -extern int sys_chroot(); -extern int sys_ustat(); -extern int sys_dup2(); -extern int sys_getppid(); -extern int sys_getpgrp(); -extern int sys_setsid(); -extern int sys_sigaction(); -extern int sys_sgetmask(); -extern int sys_ssetmask(); -extern int sys_setreuid(); -extern int sys_setregid(); -extern int sys_sigpending(); -extern int sys_sigsuspend(); -extern int sys_sethostname(); -extern int sys_setrlimit(); -extern int sys_getrlimit(); -extern int sys_getrusage(); -extern int sys_gettimeofday(); -extern int sys_settimeofday(); -extern int sys_getgroups(); -extern int sys_setgroups(); -extern int sys_select(); -extern int sys_symlink(); -extern int sys_lstat(); -extern int sys_readlink(); -extern int sys_uselib(); -extern int sys_execve2(); -extern int sys_getdents(); -extern int sys_pipe2(); -extern int sys_sleep(); -fn_ptr sys_call_table[] = { sys_setup, sys_exit, sys_fork, sys_read, -sys_write, sys_open, sys_close, sys_waitpid, sys_creat, sys_link, -sys_unlink, sys_execve, sys_chdir, sys_time, sys_mknod, sys_chmod, -sys_chown, sys_break, sys_stat, sys_lseek, sys_getpid, sys_mount, -sys_umount, sys_setuid, sys_getuid, sys_stime, sys_ptrace, sys_alarm, -sys_fstat, sys_pause, sys_utime, sys_stty, sys_gtty, sys_access, -sys_nice, sys_ftime, sys_sync, sys_kill, sys_rename, sys_mkdir, -sys_rmdir, sys_dup, sys_pipe, sys_times, sys_prof, sys_brk, sys_setgid, -sys_getgid, sys_signal, sys_geteuid, sys_getegid, sys_acct, sys_phys, -sys_lock, sys_ioctl, sys_fcntl, sys_mpx, sys_setpgid, sys_ulimit, -sys_uname, sys_umask, sys_chroot, sys_ustat, sys_dup2, sys_getppid, -sys_getpgrp, sys_setsid, sys_sigaction, sys_sgetmask, sys_ssetmask, -sys_setreuid,sys_setregid, sys_sigsuspend, sys_sigpending, sys_sethostname, -sys_setrlimit, sys_getrlimit, sys_getrusage, sys_gettimeofday, -sys_settimeofday, sys_getgroups, sys_setgroups, sys_select, sys_symlink, -sys_lstat, sys_readlink, sys_uselib, sys_execve2, sys_getdents, sys_pipe2, -sys_sleep}; - -/* So we don't have to do any more manual updating.... */ -int NR_syscalls = sizeof(sys_call_table)/sizeof(fn_ptr); diff --git a/sys_1.h b/sys_1.h deleted file mode 100644 index 20b731a..0000000 --- a/sys_1.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Why isn't this a .c file? Enquiring minds.... - */ - -extern int sys_setup(); -extern int sys_exit(); -extern int sys_fork(); -extern int sys_read(); -extern int sys_write(); -extern int sys_open(); -extern int sys_close(); -extern int sys_waitpid(); -extern int sys_creat(); -extern int sys_link(); -extern int sys_unlink(); -extern int sys_execve(); -extern int sys_chdir(); -extern int sys_time(); -extern int sys_mknod(); -extern int sys_chmod(); -extern int sys_chown(); -extern int sys_break(); -extern int sys_stat(); -extern int sys_lseek(); -extern int sys_getpid(); -extern int sys_mount(); -extern int sys_umount(); -extern int sys_setuid(); -extern int sys_getuid(); -extern int sys_stime(); -extern int sys_ptrace(); -extern int sys_alarm(); -extern int sys_fstat(); -extern int sys_pause(); -extern int sys_utime(); -extern int sys_stty(); -extern int sys_gtty(); -extern int sys_access(); -extern int sys_nice(); -extern int sys_ftime(); -extern int sys_sync(); -extern int sys_kill(); -extern int sys_rename(); -extern int sys_mkdir(); -extern int sys_rmdir(); -extern int sys_dup(); -extern int sys_pipe(); -extern int sys_times(); -extern int sys_prof(); -extern int sys_brk(); -extern int sys_setgid(); -extern int sys_getgid(); -extern int sys_signal(); -extern int sys_geteuid(); -extern int sys_getegid(); -extern int sys_acct(); -extern int sys_phys(); -extern int sys_lock(); -extern int sys_ioctl(); -extern int sys_fcntl(); -extern int sys_mpx(); -extern int sys_setpgid(); -extern int sys_ulimit(); -extern int sys_uname(); -extern int sys_umask(); -extern int sys_chroot(); -extern int sys_ustat(); -extern int sys_dup2(); -extern int sys_getppid(); -extern int sys_getpgrp(); -extern int sys_setsid(); -extern int sys_sigaction(); -extern int sys_sgetmask(); -extern int sys_ssetmask(); -extern int sys_setreuid(); -extern int sys_setregid(); -extern int sys_sigpending(); -extern int sys_sigsuspend(); -extern int sys_sethostname(); -extern int sys_setrlimit(); -extern int sys_getrlimit(); -extern int sys_getrusage(); -extern int sys_gettimeofday(); -extern int sys_settimeofday(); -extern int sys_getgroups(); -extern int sys_setgroups(); -extern int sys_select(); -extern int sys_symlink(); -extern int sys_lstat(); -extern int sys_readlink(); -extern int sys_uselib(); -extern int sys_execve2(); -extern int sys_getdents(); -extern int sys_pipe2(); -extern int sys_sleep(); -fn_ptr sys_call_table[] = { sys_setup, sys_exit, sys_fork, sys_read, -sys_write, sys_open, sys_close, sys_waitpid, sys_creat, sys_link, -sys_unlink, sys_execve, sys_chdir, sys_time, sys_mknod, sys_chmod, -sys_chown, sys_break, sys_stat, sys_lseek, sys_getpid, sys_mount, -sys_umount, sys_setuid, sys_getuid, sys_stime, sys_ptrace, sys_alarm, -sys_fstat, sys_pause, sys_utime, sys_stty, sys_gtty, sys_access, -sys_nice, sys_ftime, sys_sync, sys_kill, sys_rename, sys_mkdir, -sys_rmdir, sys_dup, sys_pipe, sys_times, sys_prof, sys_brk, sys_setgid, -sys_getgid, sys_signal, sys_geteuid, sys_getegid, sys_acct, sys_phys, -sys_lock, sys_ioctl, sys_fcntl, sys_mpx, sys_setpgid, sys_ulimit, -sys_uname, sys_umask, sys_chroot, sys_ustat, sys_dup2, sys_getppid, -sys_getpgrp, sys_setsid, sys_sigaction, sys_sgetmask, sys_ssetmask, -sys_setreuid,sys_setregid, sys_sigsuspend, sys_sigpending, sys_sethostname, -sys_setrlimit, sys_getrlimit, sys_getrusage, sys_gettimeofday, -sys_settimeofday, sys_getgroups, sys_setgroups, sys_select, sys_symlink, -sys_lstat, sys_readlink, sys_uselib, sys_execve2, sys_getdents, sys_pipe2, -sys_sleep}; - -/* So we don't have to do any more manual updating.... */ -int NR_syscalls = sizeof(sys_call_table)/sizeof(fn_ptr); diff --git a/ttttt.c b/ttttt.c deleted file mode 100644 index e69de29..0000000