diff -u --recursive v1.1.10/linux/CREDITS linux/CREDITS --- v1.1.10/linux/CREDITS Wed Apr 27 09:46:03 1994 +++ linux/CREDITS Sat Apr 30 12:55:15 1994 @@ -186,6 +186,14 @@ E: rfflaxa@immd4.informatik.uni-erlangen.de D: The Linux Support Team Erlangen +N: Lawrence Foard +E: entropy@world.std.com +D: Floppy track reading, fs code +S: Suite #108 +S: 217 Park Ave. +S: Worcester Ma 01609 +S: USA + N: Nigel Gamble E: nigel%gamble.uucp@gate.net D: Interrupt-driven printer driver diff -u --recursive v1.1.10/linux/Makefile linux/Makefile --- v1.1.10/linux/Makefile Sun May 1 12:12:22 1994 +++ linux/Makefile Sun May 1 12:21:07 1994 @@ -1,6 +1,6 @@ VERSION = 1 PATCHLEVEL = 1 -SUBLEVEL = 10 +SUBLEVEL = 11 all: Version zImage diff -u --recursive v1.1.10/linux/drivers/block/genhd.c linux/drivers/block/genhd.c --- v1.1.10/linux/drivers/block/genhd.c Mon Apr 25 10:04:31 1994 +++ linux/drivers/block/genhd.c Mon May 2 14:56:30 1994 @@ -52,8 +52,9 @@ * This block is from a device that we're about to stomp on. * So make sure nobody thinks this block is usable. */ - bh->b_dirt=0; - bh->b_uptodate=0; + bh->b_dirt = 0; + bh->b_uptodate = 0; + bh->b_req = 0; if (*(unsigned short *) (bh->b_data+510) == 0xAA55) { p = (struct partition *) (0x1BE + bh->b_data); /* @@ -193,7 +194,7 @@ blk_size[dev->major] = dev->sizes; } -void device_setup(void * BIOS) +void device_setup(void) { struct gendisk *p; int nr=0; diff -u --recursive v1.1.10/linux/drivers/char/mem.c linux/drivers/char/mem.c --- v1.1.10/linux/drivers/char/mem.c Sun Jan 30 19:05:24 1994 +++ linux/drivers/char/mem.c Sun May 1 12:20:29 1994 @@ -109,7 +109,7 @@ mpnt->vm_offset = off; mpnt->vm_ops = NULL; insert_vm_struct(current, mpnt); - merge_segments(current->mmap, NULL, NULL); + merge_segments(current->mm->mmap, NULL, NULL); return 0; } @@ -202,7 +202,7 @@ mpnt->vm_offset = off; mpnt->vm_ops = NULL; insert_vm_struct(current, mpnt); - merge_segments(current->mmap, ignoff_mergep, inode); + merge_segments(current->mm->mmap, ignoff_mergep, inode); return 0; } diff -u --recursive v1.1.10/linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c --- v1.1.10/linux/drivers/char/tty_io.c Tue Mar 1 19:00:15 1994 +++ linux/drivers/char/tty_io.c Mon May 2 18:34:24 1994 @@ -1650,7 +1650,7 @@ send_sig(SIGKILL, *p, 1); else { for (i=0; i < NR_OPEN; i++) { - filp = (*p)->filp[i]; + filp = (*p)->files->fd[i]; if (filp && (filp->f_op == &tty_fops) && (MINOR(filp->f_rdev) == line)) { send_sig(SIGKILL, *p, 1); diff -u --recursive v1.1.10/linux/drivers/scsi/aha1542.c linux/drivers/scsi/aha1542.c --- v1.1.10/linux/drivers/scsi/aha1542.c Sat Mar 26 15:58:41 1994 +++ linux/drivers/scsi/aha1542.c Sat Apr 30 13:02:25 1994 @@ -596,7 +596,7 @@ struct mailbox * mb; struct ccb *ccb; - unchar cmd[5] = {CMD_MBINIT, AHA1542_MAILBOXES}; + unchar cmd[5] = {CMD_MBINIT, AHA1542_MAILBOXES, 0, 0, 0}; mb = HOSTDATA(shpnt)->mb; ccb = HOSTDATA(shpnt)->ccb; Only in v1.1.10/linux/drivers/sound: .blurb~ diff -u --recursive v1.1.10/linux/drivers/sound/sb_dsp.c linux/drivers/sound/sb_dsp.c --- v1.1.10/linux/drivers/sound/sb_dsp.c Sun May 1 12:12:41 1994 +++ linux/drivers/sound/sb_dsp.c Sun May 1 10:29:36 1994 @@ -160,9 +160,13 @@ irq_ok = 1; break; +#ifndef EXCLUDE_MIDI + case IMODE_MIDI: sb_midi_interrupt (unit); break; + +#endif default: printk ("SoundBlaster: Unexpected interrupt\n"); diff -u --recursive v1.1.10/linux/fs/binfmt_coff.c linux/fs/binfmt_coff.c --- v1.1.10/linux/fs/binfmt_coff.c Mon Feb 14 18:41:55 1994 +++ linux/fs/binfmt_coff.c Mon May 2 18:34:24 1994 @@ -384,7 +384,7 @@ status = fd; } else - fp = current->filp[fd]; + fp = current->files->fd[fd]; } else fd = -1; /* Invalidate the open file descriptor */ @@ -441,8 +441,8 @@ /* * Define the initial locations for the various items in the new process */ - current->mmap = NULL; - current->rss = 0; + current->mm->mmap = NULL; + current->mm->rss = 0; /* * Construct the parameter and environment string table entries. */ @@ -455,20 +455,20 @@ /* * Do the end processing once the stack has been constructed */ - current->start_code = text_vaddr & PAGE_MASK; - current->end_code = text_vaddr + text_size; - current->end_data = data_vaddr + data_size; - current->start_brk = - current->brk = bss_vaddr + bss_size; - current->suid = - current->euid = bprm->e_uid; - current->sgid = - current->egid = bprm->e_gid; - current->executable = bprm->inode; /* Store inode for file */ + current->mm->start_code = text_vaddr & PAGE_MASK; + current->mm->end_code = text_vaddr + text_size; + current->mm->end_data = data_vaddr + data_size; + current->mm->start_brk = + current->mm->brk = bss_vaddr + bss_size; + current->suid = + current->euid = bprm->e_uid; + current->sgid = + current->egid = bprm->e_gid; + current->executable = bprm->inode; /* Store inode for file */ ++bprm->inode->i_count; /* Count the open inode */ - regs->eip = start_addr; /* Current EIP register */ - regs->esp = - current->start_stack = bprm->p; + regs->eip = start_addr; /* Current EIP register */ + regs->esp = + current->mm->start_stack = bprm->p; } /* * Map the text pages @@ -756,7 +756,7 @@ memset (bprm, '\0', sizeof (struct linux_binprm)); - file = current->filp[fd]; + file = current->files->fd[fd]; bprm->inode = file->f_inode; /* The only item _really_ needed */ bprm->filename = ""; /* Make it a legal string */ /* diff -u --recursive v1.1.10/linux/fs/binfmt_elf.c linux/fs/binfmt_elf.c --- v1.1.10/linux/fs/binfmt_elf.c Thu Feb 17 09:07:27 1994 +++ linux/fs/binfmt_elf.c Mon May 2 18:34:25 1994 @@ -63,7 +63,7 @@ mpnt->vm_offset = 0; mpnt->vm_ops = NULL; insert_vm_struct(current, mpnt); - current->stk_vma = mpnt; + current->mm->stk_vma = mpnt; } sp = (unsigned long *) (0xfffffffc & (unsigned long) p); if(exec) sp -= DLINFO_ITEMS*2; @@ -94,19 +94,19 @@ }; put_fs_long((unsigned long)argc,--sp); - current->arg_start = (unsigned long) p; + current->mm->arg_start = (unsigned long) p; while (argc-->0) { put_fs_long((unsigned long) p,argv++); while (get_fs_byte(p++)) /* nothing */ ; } put_fs_long(0,argv); - current->arg_end = current->env_start = (unsigned long) p; + current->mm->arg_end = current->mm->env_start = (unsigned long) p; while (envc-->0) { put_fs_long((unsigned long) p,envp++); while (get_fs_byte(p++)) /* nothing */ ; } put_fs_long(0,envp); - current->env_end = (unsigned long) p; + current->mm->env_end = (unsigned long) p; return sp; } @@ -161,7 +161,7 @@ elf_exec_fileno = open_inode(interpreter_inode, O_RDONLY); if (elf_exec_fileno < 0) return 0xffffffff; - file = current->filp[elf_exec_fileno]; + file = current->files->fd[elf_exec_fileno]; eppnt = elf_phdata; for(i=0; ie_phnum; i++, eppnt++) @@ -210,9 +210,9 @@ int retval; unsigned int elf_entry; - current->brk = interp_ex->a_bss + - (current->end_data = interp_ex->a_data + - (current->end_code = interp_ex->a_text)); + current->mm->brk = interp_ex->a_bss + + (current->mm->end_data = interp_ex->a_data + + (current->mm->end_code = interp_ex->a_text)); elf_entry = interp_ex->a_entry; @@ -318,7 +318,7 @@ return elf_exec_fileno; } - file = current->filp[elf_exec_fileno]; + file = current->files->fd[elf_exec_fileno]; elf_stack = 0xffffffff; elf_interpreter = NULL; @@ -416,17 +416,17 @@ /* OK, This is the point of no return */ flush_old_exec(bprm); - current->end_data = 0; - current->end_code = 0; - current->start_mmap = ELF_START_MMAP; - current->mmap = NULL; + current->mm->end_data = 0; + current->mm->end_code = 0; + current->mm->start_mmap = ELF_START_MMAP; + current->mm->mmap = NULL; elf_entry = (unsigned int) elf_ex.e_entry; /* Do this so that we can load the interpreter, if need be. We will change some of these later */ - current->rss = 0; + current->mm->rss = 0; bprm->p += change_ldt(0, bprm->page); - current->start_stack = bprm->p; + current->mm->start_stack = bprm->p; /* Now we do a little grungy work by mmaping the ELF image into the correct location in memory. At this point, we assume that @@ -512,18 +512,18 @@ load_addr, (interpreter_type == INTERPRETER_AOUT ? 0 : 1)); if(interpreter_type == INTERPRETER_AOUT) - current->arg_start += strlen(passed_fileno) + 1; - current->start_brk = current->brk = elf_brk; - current->end_code = end_code; - current->start_code = start_code; - current->end_data = end_data; - current->start_stack = bprm->p; + current->mm->arg_start += strlen(passed_fileno) + 1; + current->mm->start_brk = current->mm->brk = elf_brk; + current->mm->end_code = end_code; + current->mm->start_code = start_code; + current->mm->end_data = end_data; + current->mm->start_stack = bprm->p; current->suid = current->euid = bprm->e_uid; current->sgid = current->egid = bprm->e_gid; /* Calling sys_brk effectively mmaps the pages that we need for the bss and break sections */ - current->brk = (elf_bss + 0xfff) & 0xfffff000; + current->mm->brk = (elf_bss + 0xfff) & 0xfffff000; sys_brk((elf_brk + 0xfff) & 0xfffff000); padzero(elf_bss); @@ -558,7 +558,7 @@ int i,j, k; len = 0; - file = current->filp[fd]; + file = current->files->fd[fd]; inode = file->f_inode; elf_bss = 0; diff -u --recursive v1.1.10/linux/fs/buffer.c linux/fs/buffer.c --- v1.1.10/linux/fs/buffer.c Wed Apr 27 09:46:08 1994 +++ linux/fs/buffer.c Mon May 2 18:34:25 1994 @@ -254,7 +254,7 @@ struct file * file; struct inode * inode; - if (fd>=NR_OPEN || !(file=current->filp[fd]) || !(inode=file->f_inode)) + if (fd>=NR_OPEN || !(file=current->files->fd[fd]) || !(inode=file->f_inode)) return -EBADF; if (!file->f_op || !file->f_op->fsync) return -EINVAL; @@ -1096,7 +1096,7 @@ while (nrbuf-- > 0) brelse(bh[nrbuf]); free_page(address); - ++current->min_flt; + ++current->mm->min_flt; return page; no_go: while (nrbuf-- > 0) @@ -1154,7 +1154,7 @@ read_buffers(arr,block); while (block-- > 0) brelse(arr[block]); - ++current->maj_flt; + ++current->mm->maj_flt; return address; not_aligned: while ((tmp = bh) != NULL) { @@ -1213,7 +1213,7 @@ if (where) return where; } - ++current->maj_flt; + ++current->mm->maj_flt; for (i=0, j=0; jfilp; + fpp = current->files->fd; for (;;) { if (!*fpp) break; @@ -164,8 +164,8 @@ dump.magic = CMAGIC; dump.start_code = 0; dump.start_stack = regs->esp & ~(PAGE_SIZE - 1); - dump.u_tsize = ((unsigned long) current->end_code) >> 12; - dump.u_dsize = ((unsigned long) (current->brk + (PAGE_SIZE-1))) >> 12; + dump.u_tsize = ((unsigned long) current->mm->end_code) >> 12; + dump.u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> 12; dump.u_dsize -= dump.u_tsize; dump.u_ssize = 0; for(i=0; i<8; i++) dump.u_debugreg[i] = current->debugreg[i]; @@ -244,7 +244,7 @@ fd = sys_open(library, 0, 0); if (fd < 0) return fd; - file = current->filp[fd]; + file = current->files->fd[fd]; retval = -ENOEXEC; if (file && file->f_inode && file->f_op && file->f_op->read) { fmt = formats; @@ -282,7 +282,7 @@ mpnt->vm_offset = 0; mpnt->vm_ops = NULL; insert_vm_struct(current, mpnt); - current->stk_vma = mpnt; + current->mm->stk_vma = mpnt; } sp = (unsigned long *) (0xfffffffc & (unsigned long) p); sp -= envc+1; @@ -294,19 +294,19 @@ put_fs_long((unsigned long)argv,--sp); } put_fs_long((unsigned long)argc,--sp); - current->arg_start = (unsigned long) p; + current->mm->arg_start = (unsigned long) p; while (argc-->0) { put_fs_long((unsigned long) p,argv++); while (get_fs_byte(p++)) /* nothing */ ; } put_fs_long(0,argv); - current->arg_end = current->env_start = (unsigned long) p; + current->mm->arg_end = current->mm->env_start = (unsigned long) p; while (envc-->0) { put_fs_long((unsigned long) p,envp++); while (get_fs_byte(p++)) /* nothing */ ; } put_fs_long(0,envp); - current->env_end = (unsigned long) p; + current->mm->env_end = (unsigned long) p; return sp; } @@ -400,12 +400,12 @@ code_limit = TASK_SIZE; data_limit = TASK_SIZE; code_base = data_base = 0; - current->start_code = code_base; + current->mm->start_code = code_base; data_base += data_limit; for (i=MAX_ARG_PAGES-1 ; i>=0 ; i--) { data_base -= PAGE_SIZE; if (page[i]) { - current->rss++; + current->mm->rss++; put_dirty_page(current,page[i],data_base); } } @@ -486,9 +486,9 @@ } /* Release all of the old mmap stuff. */ - mpnt = current->mmap; - current->mmap = NULL; - current->stk_vma = NULL; + mpnt = current->mm->mmap; + current->mm->mmap = NULL; + current->mm->stk_vma = NULL; while (mpnt) { mpnt1 = mpnt->vm_next; if (mpnt->vm_ops && mpnt->vm_ops->close) @@ -523,9 +523,9 @@ current->sigaction[i].sa_handler = NULL; } for (i=0 ; iclose_on_exec)) + if (FD_ISSET(i,¤t->files->close_on_exec)) sys_close(i); - FD_ZERO(¤t->close_on_exec); + FD_ZERO(¤t->files->close_on_exec); clear_page_tables(current); if (last_task_used_math == current) last_task_used_math = NULL; @@ -799,15 +799,15 @@ /* OK, This is the point of no return */ flush_old_exec(bprm); - current->end_code = N_TXTADDR(ex) + ex.a_text; - current->end_data = ex.a_data + current->end_code; - current->start_brk = current->end_data; - current->brk = current->start_brk + ex.a_bss; - current->start_code += N_TXTADDR(ex); - current->rss = 0; - current->suid = current->euid = bprm->e_uid; - current->mmap = NULL; + current->mm->brk = ex.a_bss + + (current->mm->start_brk = + (current->mm->end_data = ex.a_data + + (current->mm->end_code = ex.a_text + + (current->mm->start_code = N_TXTADDR(ex))))); + current->mm->rss = 0; + current->mm->mmap = NULL; current->executable = NULL; /* for OMAGIC files */ + current->suid = current->euid = bprm->e_uid; current->sgid = current->egid = bprm->e_gid; if (N_MAGIC(ex) == OMAGIC) { do_mmap(NULL, 0, ex.a_text+ex.a_data, @@ -822,7 +822,7 @@ if (fd < 0) return fd; - file = current->filp[fd]; + file = current->files->fd[fd]; if (!file->f_op || !file->f_op->mmap) { sys_close(fd); do_mmap(NULL, 0, ex.a_text+ex.a_data, @@ -854,12 +854,12 @@ bprm->inode->i_count++; } beyond_if: - set_brk(current->start_brk, current->brk); + set_brk(current->mm->start_brk, current->mm->brk); p += change_ldt(ex.a_text,bprm->page); p -= MAX_ARG_PAGES*PAGE_SIZE; p = (unsigned long) create_tables((char *)p,bprm->argc,bprm->envc,0); - current->start_stack = p; + current->mm->start_stack = p; regs->eip = ex.a_entry; /* eip, magic happens :-) */ regs->esp = p; /* stack pointer */ if (current->flags & PF_PTRACED) @@ -878,7 +878,7 @@ unsigned int start_addr; int error; - file = current->filp[fd]; + file = current->files->fd[fd]; inode = file->f_inode; set_fs(KERNEL_DS); diff -u --recursive v1.1.10/linux/fs/ext/namei.c linux/fs/ext/namei.c --- v1.1.10/linux/fs/ext/namei.c Tue Apr 19 10:53:21 1994 +++ linux/fs/ext/namei.c Mon May 2 18:34:26 1994 @@ -447,7 +447,7 @@ inode->i_nlink = 2; mark_buffer_dirty(dir_block, 1); brelse(dir_block); - inode->i_mode = S_IFDIR | (mode & 0777 & ~current->umask); + inode->i_mode = S_IFDIR | (mode & 0777 & ~current->fs->umask); if (dir->i_mode & S_ISGID) inode->i_mode |= S_ISGID; inode->i_dirt = 1; diff -u --recursive v1.1.10/linux/fs/ext/symlink.c linux/fs/ext/symlink.c --- v1.1.10/linux/fs/ext/symlink.c Wed Dec 1 14:44:15 1993 +++ linux/fs/ext/symlink.c Mon May 2 18:34:26 1994 @@ -52,7 +52,7 @@ *res_inode = NULL; if (!dir) { - dir = current->root; + dir = current->fs->root; dir->i_count++; } if (!inode) { diff -u --recursive v1.1.10/linux/fs/ext2/namei.c linux/fs/ext2/namei.c --- v1.1.10/linux/fs/ext2/namei.c Tue Apr 19 10:53:22 1994 +++ linux/fs/ext2/namei.c Mon May 2 18:34:26 1994 @@ -519,7 +519,7 @@ inode->i_nlink = 2; mark_buffer_dirty(dir_block, 1); brelse (dir_block); - inode->i_mode = S_IFDIR | (mode & S_IRWXUGO & ~current->umask); + inode->i_mode = S_IFDIR | (mode & S_IRWXUGO & ~current->fs->umask); if (dir->i_mode & S_ISGID) inode->i_mode |= S_ISGID; inode->i_dirt = 1; diff -u --recursive v1.1.10/linux/fs/ext2/symlink.c linux/fs/ext2/symlink.c --- v1.1.10/linux/fs/ext2/symlink.c Fri Dec 31 11:59:50 1993 +++ linux/fs/ext2/symlink.c Mon May 2 18:34:26 1994 @@ -56,7 +56,7 @@ *res_inode = NULL; if (!dir) { - dir = current->root; + dir = current->fs->root; dir->i_count++; } if (!inode) { diff -u --recursive v1.1.10/linux/fs/fcntl.c linux/fs/fcntl.c --- v1.1.10/linux/fs/fcntl.c Wed Dec 1 14:44:15 1993 +++ linux/fs/fcntl.c Mon May 2 18:34:26 1994 @@ -19,25 +19,25 @@ static int dupfd(unsigned int fd, unsigned int arg) { - if (fd >= NR_OPEN || !current->filp[fd]) + if (fd >= NR_OPEN || !current->files->fd[fd]) return -EBADF; if (arg >= NR_OPEN) return -EINVAL; while (arg < NR_OPEN) - if (current->filp[arg]) + if (current->files->fd[arg]) arg++; else break; if (arg >= NR_OPEN) return -EMFILE; - FD_CLR(arg, ¤t->close_on_exec); - (current->filp[arg] = current->filp[fd])->f_count++; + FD_CLR(arg, ¤t->files->close_on_exec); + (current->files->fd[arg] = current->files->fd[fd])->f_count++; return arg; } asmlinkage int sys_dup2(unsigned int oldfd, unsigned int newfd) { - if (oldfd >= NR_OPEN || !current->filp[oldfd]) + if (oldfd >= NR_OPEN || !current->files->fd[oldfd]) return -EBADF; if (newfd == oldfd) return newfd; @@ -67,18 +67,18 @@ { struct file * filp; - if (fd >= NR_OPEN || !(filp = current->filp[fd])) + if (fd >= NR_OPEN || !(filp = current->files->fd[fd])) return -EBADF; switch (cmd) { case F_DUPFD: return dupfd(fd,arg); case F_GETFD: - return FD_ISSET(fd, ¤t->close_on_exec); + return FD_ISSET(fd, ¤t->files->close_on_exec); case F_SETFD: if (arg&1) - FD_SET(fd, ¤t->close_on_exec); + FD_SET(fd, ¤t->files->close_on_exec); else - FD_CLR(fd, ¤t->close_on_exec); + FD_CLR(fd, ¤t->files->close_on_exec); return 0; case F_GETFL: return filp->f_flags; diff -u --recursive v1.1.10/linux/fs/hpfs/hpfs_fs.c linux/fs/hpfs/hpfs_fs.c --- v1.1.10/linux/fs/hpfs/hpfs_fs.c Tue Apr 19 10:52:57 1994 +++ linux/fs/hpfs/hpfs_fs.c Mon May 2 18:34:27 1994 @@ -543,7 +543,7 @@ *uid = current->uid; *gid = current->gid; - *umask = current->umask; + *umask = current->fs->umask; *lowercase = 1; *conv = CONV_BINARY; diff -u --recursive v1.1.10/linux/fs/ioctl.c linux/fs/ioctl.c --- v1.1.10/linux/fs/ioctl.c Wed Dec 1 14:44:15 1993 +++ linux/fs/ioctl.c Mon May 2 18:34:27 1994 @@ -59,15 +59,15 @@ struct file * filp; int on; - if (fd >= NR_OPEN || !(filp = current->filp[fd])) + if (fd >= NR_OPEN || !(filp = current->files->fd[fd])) return -EBADF; switch (cmd) { case FIOCLEX: - FD_SET(fd, ¤t->close_on_exec); + FD_SET(fd, ¤t->files->close_on_exec); return 0; case FIONCLEX: - FD_CLR(fd, ¤t->close_on_exec); + FD_CLR(fd, ¤t->files->close_on_exec); return 0; case FIONBIO: diff -u --recursive v1.1.10/linux/fs/isofs/symlink.c linux/fs/isofs/symlink.c --- v1.1.10/linux/fs/isofs/symlink.c Wed Dec 1 14:44:15 1993 +++ linux/fs/isofs/symlink.c Mon May 2 18:34:27 1994 @@ -49,7 +49,7 @@ char * pnt; if (!dir) { - dir = current->root; + dir = current->fs->root; dir->i_count++; } if (!inode) { diff -u --recursive v1.1.10/linux/fs/locks.c linux/fs/locks.c --- v1.1.10/linux/fs/locks.c Wed Dec 1 14:44:15 1993 +++ linux/fs/locks.c Mon May 2 18:34:27 1994 @@ -58,7 +58,7 @@ struct file *filp; struct file_lock *fl,file_lock; - if (fd >= NR_OPEN || !(filp = current->filp[fd])) + if (fd >= NR_OPEN || !(filp = current->files->fd[fd])) return -EBADF; error = verify_area(VERIFY_WRITE,l, sizeof(*l)); if (error) @@ -102,7 +102,7 @@ * Get arguments and validate them ... */ - if (fd >= NR_OPEN || !(filp = current->filp[fd])) + if (fd >= NR_OPEN || !(filp = current->files->fd[fd])) return -EBADF; error = verify_area(VERIFY_WRITE, l, sizeof(*l)); if (error) diff -u --recursive v1.1.10/linux/fs/minix/namei.c linux/fs/minix/namei.c --- v1.1.10/linux/fs/minix/namei.c Tue Apr 19 10:53:23 1994 +++ linux/fs/minix/namei.c Mon May 2 18:34:28 1994 @@ -349,7 +349,7 @@ inode->i_nlink = 2; mark_buffer_dirty(dir_block, 1); brelse(dir_block); - inode->i_mode = S_IFDIR | (mode & 0777 & ~current->umask); + inode->i_mode = S_IFDIR | (mode & 0777 & ~current->fs->umask); if (dir->i_mode & S_ISGID) inode->i_mode |= S_ISGID; inode->i_dirt = 1; diff -u --recursive v1.1.10/linux/fs/minix/symlink.c linux/fs/minix/symlink.c --- v1.1.10/linux/fs/minix/symlink.c Wed Dec 1 14:44:15 1993 +++ linux/fs/minix/symlink.c Mon May 2 18:34:28 1994 @@ -46,7 +46,7 @@ *res_inode = NULL; if (!dir) { - dir = current->root; + dir = current->fs->root; dir->i_count++; } if (!inode) { diff -u --recursive v1.1.10/linux/fs/msdos/fat.c linux/fs/msdos/fat.c --- v1.1.10/linux/fs/msdos/fat.c Tue Apr 19 10:53:24 1994 +++ linux/fs/msdos/fat.c Sat Apr 30 13:02:26 1994 @@ -7,6 +7,7 @@ #include #include #include +#include #include diff -u --recursive v1.1.10/linux/fs/msdos/inode.c linux/fs/msdos/inode.c --- v1.1.10/linux/fs/msdos/inode.c Tue Apr 19 10:53:24 1994 +++ linux/fs/msdos/inode.c Mon May 2 18:34:28 1994 @@ -75,7 +75,7 @@ *conversion = 'b'; *uid = current->uid; *gid = current->gid; - *umask = current->umask; + *umask = current->fs->umask; *debug = *fat = *quiet = 0; if (!options) return 1; for (this_char = strtok(options,","); this_char; this_char = strtok(NULL,",")) { diff -u --recursive v1.1.10/linux/fs/namei.c linux/fs/namei.c --- v1.1.10/linux/fs/namei.c Sun May 1 12:12:45 1994 +++ linux/fs/namei.c Mon May 2 18:34:28 1994 @@ -103,7 +103,7 @@ /* check permissions before traversing mount-points */ perm = permission(dir,MAY_EXEC); if (len==2 && name[0] == '.' && name[1] == '.') { - if (dir == current->root) { + if (dir == current->fs->root) { *result = dir; return 0; } else if ((sb = dir->i_sb) && (dir == sb->s_mounted)) { @@ -163,12 +163,12 @@ *res_inode = NULL; if (!base) { - base = current->pwd; + base = current->fs->pwd; base->i_count++; } if ((c = *pathname) == '/') { iput(base); - base = current->root; + base = current->fs->root; pathname++; base->i_count++; } @@ -279,7 +279,7 @@ struct inode * dir, *inode; struct task_struct ** p; - mode &= S_IALLUGO & ~current->umask; + mode &= S_IALLUGO & ~current->fs->umask; mode |= S_IFREG; error = dir_namei(pathname,&namelen,&basename,base,&dir); if (error) @@ -357,7 +357,7 @@ iput(inode); return -ETXTBSY; } - for(mpnt = (*p)->mmap; mpnt; mpnt = mpnt->vm_next) { + for(mpnt = (*p)->mm->mmap; mpnt; mpnt = mpnt->vm_next) { if (mpnt->vm_page_prot & PAGE_RW) continue; if (inode == mpnt->vm_inode) { @@ -387,7 +387,7 @@ int namelen, error; struct inode * dir; - mode &= ~current->umask; + mode &= ~current->fs->umask; error = dir_namei(filename,&namelen,&basename, NULL, &dir); if (error) return error; diff -u --recursive v1.1.10/linux/fs/nfs/inode.c linux/fs/nfs/inode.c --- v1.1.10/linux/fs/nfs/inode.c Wed Dec 1 14:44:15 1993 +++ linux/fs/nfs/inode.c Mon May 2 18:34:28 1994 @@ -77,7 +77,7 @@ printk("nfs warning: mount version %s than kernel\n", data->version < NFS_MOUNT_VERSION ? "older" : "newer"); } - if (fd >= NR_OPEN || !(filp = current->filp[fd])) { + if (fd >= NR_OPEN || !(filp = current->files->fd[fd])) { printk("nfs_read_super: invalid file descriptor\n"); sb->s_dev = 0; return NULL; diff -u --recursive v1.1.10/linux/fs/nfs/mmap.c linux/fs/nfs/mmap.c --- v1.1.10/linux/fs/nfs/mmap.c Wed Dec 1 14:44:15 1993 +++ linux/fs/nfs/mmap.c Sun May 1 12:20:30 1994 @@ -79,7 +79,7 @@ mpnt->vm_offset = off; mpnt->vm_ops = &nfs_file_mmap; insert_vm_struct(current, mpnt); - merge_segments(current->mmap, NULL, NULL); + merge_segments(current->mm->mmap, NULL, NULL); return 0; } @@ -101,11 +101,11 @@ page = get_free_page(GFP_KERNEL); if (share_page(area, area->vm_task, inode, address, error_code, page)) { - ++area->vm_task->min_flt; + ++area->vm_task->mm->min_flt; return; } - ++area->vm_task->maj_flt; + ++area->vm_task->mm->maj_flt; if (!page) { oom(current); put_page(area->vm_task, BAD_PAGE, address, PAGE_PRIVATE); diff -u --recursive v1.1.10/linux/fs/nfs/symlink.c linux/fs/nfs/symlink.c --- v1.1.10/linux/fs/nfs/symlink.c Wed Dec 1 14:44:15 1993 +++ linux/fs/nfs/symlink.c Mon May 2 18:34:28 1994 @@ -48,7 +48,7 @@ *res_inode = NULL; if (!dir) { - dir = current->root; + dir = current->fs->root; dir->i_count++; } if (!inode) { diff -u --recursive v1.1.10/linux/fs/open.c linux/fs/open.c --- v1.1.10/linux/fs/open.c Fri Jan 28 08:40:16 1994 +++ linux/fs/open.c Mon May 2 18:34:29 1994 @@ -55,7 +55,7 @@ error = verify_area(VERIFY_WRITE, buf, sizeof(struct statfs)); if (error) return error; - if (fd >= NR_OPEN || !(file = current->filp[fd])) + if (fd >= NR_OPEN || !(file = current->files->fd[fd])) return -EBADF; if (!(inode = file->f_inode)) return -ENOENT; @@ -96,7 +96,7 @@ struct inode * inode; struct file * file; - if (fd >= NR_OPEN || !(file = current->filp[fd])) + if (fd >= NR_OPEN || !(file = current->files->fd[fd])) return -EBADF; if (!(inode = file->f_inode)) return -ENOENT; @@ -205,8 +205,8 @@ iput(inode); return -EACCES; } - iput(current->pwd); - current->pwd = inode; + iput(current->fs->pwd); + current->fs->pwd = inode; return (0); } @@ -215,7 +215,7 @@ struct inode * inode; struct file * file; - if (fd >= NR_OPEN || !(file = current->filp[fd])) + if (fd >= NR_OPEN || !(file = current->files->fd[fd])) return -EBADF; if (!(inode = file->f_inode)) return -ENOENT; @@ -223,8 +223,8 @@ return -ENOTDIR; if (!permission(inode,MAY_EXEC)) return -EACCES; - iput(current->pwd); - current->pwd = inode; + iput(current->fs->pwd); + current->fs->pwd = inode; inode->i_count++; return (0); } @@ -245,8 +245,8 @@ iput(inode); return -EPERM; } - iput(current->root); - current->root = inode; + iput(current->fs->root); + current->fs->root = inode; return (0); } @@ -255,7 +255,7 @@ struct inode * inode; struct file * file; - if (fd >= NR_OPEN || !(file = current->filp[fd])) + if (fd >= NR_OPEN || !(file = current->files->fd[fd])) return -EBADF; if (!(inode = file->f_inode)) return -ENOENT; @@ -306,7 +306,7 @@ struct inode * inode; struct file * file; - if (fd >= NR_OPEN || !(file = current->filp[fd])) + if (fd >= NR_OPEN || !(file = current->files->fd[fd])) return -EBADF; if (!(inode = file->f_inode)) return -ENOENT; @@ -380,15 +380,15 @@ int flag,error,fd; for(fd=0 ; fdfilp[fd]) + if (!current->files->fd[fd]) break; if (fd>=NR_OPEN) return -EMFILE; - FD_CLR(fd,¤t->close_on_exec); + FD_CLR(fd,¤t->files->close_on_exec); f = get_empty_filp(); if (!f) return -ENFILE; - current->filp[fd] = f; + current->files->fd[fd] = f; f->f_flags = flag = flags; f->f_mode = (flag+1) & O_ACCMODE; if (f->f_mode) @@ -397,7 +397,7 @@ flag |= 2; error = open_namei(filename,flag,mode,&inode,NULL); if (error) { - current->filp[fd]=NULL; + current->files->fd[fd]=NULL; f->f_count--; return error; } @@ -413,7 +413,7 @@ if (error) { iput(inode); f->f_count--; - current->filp[fd]=NULL; + current->files->fd[fd]=NULL; return error; } } @@ -468,10 +468,10 @@ if (fd >= NR_OPEN) return -EBADF; - FD_CLR(fd, ¤t->close_on_exec); - if (!(filp = current->filp[fd])) + FD_CLR(fd, ¤t->files->close_on_exec); + if (!(filp = current->files->fd[fd])) return -EBADF; - current->filp[fd] = NULL; + current->files->fd[fd] = NULL; return (close_fp (filp, fd)); } diff -u --recursive v1.1.10/linux/fs/pipe.c linux/fs/pipe.c --- v1.1.10/linux/fs/pipe.c Mon Jan 31 10:54:22 1994 +++ linux/fs/pipe.c Mon May 2 18:34:29 1994 @@ -394,20 +394,20 @@ return -ENFILE; j=0; for(i=0;j<2 && ifilp[i]) { - current->filp[ fd[j]=i ] = f[j]; + if (!current->files->fd[i]) { + current->files->fd[ fd[j]=i ] = f[j]; j++; } if (j==1) - current->filp[fd[0]]=NULL; + current->files->fd[fd[0]]=NULL; if (j<2) { f[0]->f_count--; f[1]->f_count--; return -EMFILE; } if (!(inode=get_pipe_inode())) { - current->filp[fd[0]] = NULL; - current->filp[fd[1]] = NULL; + current->files->fd[fd[0]] = NULL; + current->files->fd[fd[1]] = NULL; f[0]->f_count--; f[1]->f_count--; return -ENFILE; diff -u --recursive v1.1.10/linux/fs/proc/array.c linux/fs/proc/array.c --- v1.1.10/linux/fs/proc/array.c Tue Apr 19 10:53:25 1994 +++ linux/fs/proc/array.c Sun May 1 12:20:30 1994 @@ -236,7 +236,7 @@ if (!p || !*p) return 0; - return get_array(p, (*p)->env_start, (*p)->env_end, buffer); + return get_array(p, (*p)->mm->env_start, (*p)->mm->env_end, buffer); } static int get_arg(int pid, char * buffer) @@ -245,7 +245,7 @@ if (!p || !*p) return 0; - return get_array(p, (*p)->arg_start, (*p)->arg_end, buffer); + return get_array(p, (*p)->mm->arg_start, (*p)->mm->arg_end, buffer); } static unsigned long get_wchan(struct task_struct *p) @@ -294,7 +294,7 @@ if (vsize) { eip = KSTK_EIP(vsize); esp = KSTK_ESP(vsize); - vsize = (*p)->brk - (*p)->start_code + PAGE_SIZE-1; + vsize = (*p)->mm->brk - (*p)->mm->start_code + PAGE_SIZE-1; if (esp) vsize += TASK_SIZE - esp; } @@ -312,7 +312,7 @@ else tty_pgrp = -1; return sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \ -%lu %lu %lu %ld %ld %ld %ld %ld %ld %lu %lu %ld %lu %u %u %lu %lu %lu %lu %lu %lu \ +%lu %lu %lu %ld %ld %ld %ld %ld %ld %lu %lu %ld %lu %lu %u %lu %lu %lu %lu %lu %lu \ %lu %lu %lu %lu\n", pid, (*p)->comm, @@ -323,10 +323,10 @@ (*p)->tty, tty_pgrp, (*p)->flags, - (*p)->min_flt, - (*p)->cmin_flt, - (*p)->maj_flt, - (*p)->cmaj_flt, + (*p)->mm->min_flt, + (*p)->mm->cmin_flt, + (*p)->mm->maj_flt, + (*p)->mm->cmaj_flt, (*p)->utime, (*p)->stime, (*p)->cutime, @@ -339,11 +339,11 @@ (*p)->it_real_value, (*p)->start_time, vsize, - (*p)->rss, /* you might want to shift this left 3 */ + (*p)->mm->rss, /* you might want to shift this left 3 */ (*p)->rlim[RLIMIT_RSS].rlim_cur, - (*p)->start_code, - (*p)->end_code, - (*p)->start_stack, + (*p)->mm->start_code, + (*p)->mm->end_code, + (*p)->mm->start_stack, esp, eip, (*p)->signal, @@ -362,7 +362,7 @@ if (!p || !*p) return 0; - tpag = (*p)->end_code / PAGE_SIZE; + tpag = (*p)->mm->end_code / PAGE_SIZE; if ((*p)->state != TASK_ZOMBIE) { pagedir = (unsigned long *) (*p)->tss.cr3; for (i = 0; i < 0x300; ++i) { @@ -409,7 +409,7 @@ if (!p || !*p) return 0; - for(map = (*p)->mmap; map != NULL; map = map->vm_next) { + for(map = (*p)->mm->mmap; map != NULL; map = map->vm_next) { char str[7], *cp = str; int prot = map->vm_page_prot; int perms, flags; @@ -466,6 +466,7 @@ extern int get_module_list(char *); extern int get_device_list(char *); +extern int get_filesystem_list(char *); static int array_read(struct inode * inode, struct file * file,char * buf, int count) { @@ -525,6 +526,9 @@ break; case 18: length = get_device_list(page); + break; + case 19: + length = get_filesystem_list(page); break; default: free_page((unsigned long) page); diff -u --recursive v1.1.10/linux/fs/proc/fd.c linux/fs/proc/fd.c --- v1.1.10/linux/fs/proc/fd.c Wed Dec 1 14:44:15 1993 +++ linux/fs/proc/fd.c Mon May 2 18:34:29 1994 @@ -105,13 +105,13 @@ if (!pid || i >= NR_TASKS) return -ENOENT; if (!ino) { - if (fd >= NR_OPEN || !p->filp[fd] || !p->filp[fd]->f_inode) + if (fd >= NR_OPEN || !p->files->fd[fd] || !p->files->fd[fd]->f_inode) return -ENOENT; ino = (pid << 16) + 0x100 + fd; } else { int j = 0; struct vm_area_struct * mpnt; - for (mpnt = p->mmap; mpnt; mpnt = mpnt->vm_next) + for (mpnt = p->mm->mmap; mpnt; mpnt = mpnt->vm_next) if (mpnt->vm_inode) j++; if (fd >= j) @@ -163,12 +163,12 @@ if (!ino) { if (fd >= NR_OPEN) break; - if (!p->filp[fd] || !p->filp[fd]->f_inode) + if (!p->files->fd[fd] || !p->files->fd[fd]->f_inode) continue; } else { int j = 0; struct vm_area_struct * mpnt; - for (mpnt = p->mmap ; mpnt ; mpnt = mpnt->vm_next) + for (mpnt = p->mm->mmap ; mpnt ; mpnt = mpnt->vm_next) if (mpnt->vm_inode) j++; if (fd >= j) diff -u --recursive v1.1.10/linux/fs/proc/inode.c linux/fs/proc/inode.c --- v1.1.10/linux/fs/proc/inode.c Wed Feb 23 09:47:59 1994 +++ linux/fs/proc/inode.c Mon May 2 18:34:29 1994 @@ -169,7 +169,7 @@ switch (ino >> 8) { case 1: ino &= 0xff; - if (ino >= NR_OPEN || !p->filp[ino]) + if (ino >= NR_OPEN || !p->files->fd[ino]) return; inode->i_op = &proc_link_inode_operations; inode->i_size = 64; @@ -180,7 +180,7 @@ { int j = 0; struct vm_area_struct * mpnt; - for (mpnt = p->mmap ; mpnt ; mpnt = mpnt->vm_next) + for (mpnt = p->mm->mmap ; mpnt ; mpnt = mpnt->vm_next) if(mpnt->vm_inode) j++; if (ino >= j) diff -u --recursive v1.1.10/linux/fs/proc/link.c linux/fs/proc/link.c --- v1.1.10/linux/fs/proc/link.c Fri Mar 11 11:28:10 1994 +++ linux/fs/proc/link.c Mon May 2 18:34:29 1994 @@ -66,10 +66,10 @@ inode = NULL; switch (ino) { case 4: - inode = p->pwd; + inode = p->fs->pwd; break; case 5: - inode = p->root; + inode = p->fs->root; break; case 6: inode = p->executable; @@ -78,14 +78,14 @@ switch (ino >> 8) { case 1: ino &= 0xff; - if (ino < NR_OPEN && p->filp[ino]) - inode = p->filp[ino]->f_inode; + if (ino < NR_OPEN && p->files->fd[ino]) + inode = p->files->fd[ino]->f_inode; break; case 2: ino &= 0xff; { int j = ino; struct vm_area_struct * mpnt; - for(mpnt = p->mmap; mpnt && j >= 0; + for(mpnt = p->mm->mmap; mpnt && j >= 0; mpnt = mpnt->vm_next){ if(mpnt->vm_inode) { if(j == 0) { diff -u --recursive v1.1.10/linux/fs/proc/root.c linux/fs/proc/root.c --- v1.1.10/linux/fs/proc/root.c Tue Apr 19 10:53:25 1994 +++ linux/fs/proc/root.c Mon May 2 13:03:26 1994 @@ -68,6 +68,7 @@ {16,7,"modules" }, {17,4,"stat" }, {18,7,"devices" }, + {19,11,"filesystems" }, }; #define NR_ROOT_DIRENTRY ((sizeof (root_dir))/(sizeof (root_dir[0]))) diff -u --recursive v1.1.10/linux/fs/read_write.c linux/fs/read_write.c --- v1.1.10/linux/fs/read_write.c Wed Dec 1 14:44:15 1993 +++ linux/fs/read_write.c Mon May 2 18:34:29 1994 @@ -22,7 +22,7 @@ struct file * file; struct inode * inode; - if (fd >= NR_OPEN || !(file = current->filp[fd]) || + if (fd >= NR_OPEN || !(file = current->files->fd[fd]) || !(inode = file->f_inode)) return -EBADF; error = -ENOTDIR; @@ -39,7 +39,7 @@ struct file * file; int tmp = -1; - if (fd >= NR_OPEN || !(file=current->filp[fd]) || !(file->f_inode)) + if (fd >= NR_OPEN || !(file=current->files->fd[fd]) || !(file->f_inode)) return -EBADF; if (origin > 2) return -EINVAL; @@ -73,7 +73,7 @@ struct file * file; struct inode * inode; - if (fd>=NR_OPEN || !(file=current->filp[fd]) || !(inode=file->f_inode)) + if (fd>=NR_OPEN || !(file=current->files->fd[fd]) || !(inode=file->f_inode)) return -EBADF; if (!(file->f_mode & 1)) return -EBADF; @@ -93,7 +93,7 @@ struct file * file; struct inode * inode; - if (fd>=NR_OPEN || !(file=current->filp[fd]) || !(inode=file->f_inode)) + if (fd>=NR_OPEN || !(file=current->files->fd[fd]) || !(inode=file->f_inode)) return -EBADF; if (!(file->f_mode & 2)) return -EBADF; diff -u --recursive v1.1.10/linux/fs/select.c linux/fs/select.c --- v1.1.10/linux/fs/select.c Mon Mar 14 16:38:45 1994 +++ linux/fs/select.c Mon May 2 18:34:29 1994 @@ -95,9 +95,9 @@ goto end_check; if (!(set & 1)) continue; - if (!current->filp[i]) + if (!current->files->fd[i]) return -EBADF; - if (!current->filp[i]->f_inode) + if (!current->files->fd[i]->f_inode) return -EBADF; max = i; } @@ -116,17 +116,17 @@ repeat: current->state = TASK_INTERRUPTIBLE; for (i = 0 ; i < n ; i++) { - if (FD_ISSET(i,in) && check(SEL_IN,wait,current->filp[i])) { + if (FD_ISSET(i,in) && check(SEL_IN,wait,current->files->fd[i])) { FD_SET(i, res_in); count++; wait = NULL; } - if (FD_ISSET(i,out) && check(SEL_OUT,wait,current->filp[i])) { + if (FD_ISSET(i,out) && check(SEL_OUT,wait,current->files->fd[i])) { FD_SET(i, res_out); count++; wait = NULL; } - if (FD_ISSET(i,ex) && check(SEL_EX,wait,current->filp[i])) { + if (FD_ISSET(i,ex) && check(SEL_EX,wait,current->files->fd[i])) { FD_SET(i, res_ex); count++; wait = NULL; diff -u --recursive v1.1.10/linux/fs/stat.c linux/fs/stat.c --- v1.1.10/linux/fs/stat.c Wed Dec 1 14:44:15 1993 +++ linux/fs/stat.c Mon May 2 18:34:29 1994 @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -33,9 +34,10 @@ static void cp_new_stat(struct inode * inode, struct new_stat * statbuf) { - struct new_stat tmp = {0, }; + struct new_stat tmp; unsigned int blocks, indirect; + memset(&tmp, 0, sizeof(tmp)); tmp.st_dev = inode->i_dev; tmp.st_ino = inode->i_ino; tmp.st_mode = inode->i_mode; @@ -159,7 +161,7 @@ error = verify_area(VERIFY_WRITE,statbuf,sizeof (*statbuf)); if (error) return error; - if (fd >= NR_OPEN || !(f=current->filp[fd]) || !(inode=f->f_inode)) + if (fd >= NR_OPEN || !(f=current->files->fd[fd]) || !(inode=f->f_inode)) return -EBADF; cp_old_stat(inode,statbuf); return 0; @@ -174,7 +176,7 @@ error = verify_area(VERIFY_WRITE,statbuf,sizeof (*statbuf)); if (error) return error; - if (fd >= NR_OPEN || !(f=current->filp[fd]) || !(inode=f->f_inode)) + if (fd >= NR_OPEN || !(f=current->files->fd[fd]) || !(inode=f->f_inode)) return -EBADF; cp_new_stat(inode,statbuf); return 0; diff -u --recursive v1.1.10/linux/fs/super.c linux/fs/super.c --- v1.1.10/linux/fs/super.c Mon Apr 25 10:04:34 1994 +++ linux/fs/super.c Mon May 2 18:34:30 1994 @@ -7,6 +7,8 @@ /* * super.c contains code to handle the super-block tables. */ +#include + #include #include #include @@ -71,6 +73,101 @@ return -EINVAL; } +static int fs_index(const char * __name) +{ + struct file_system_type * tmp; + char * name; + int err, index; + + err = getname(__name, &name); + if (err) + return err; + index = 0; + for (tmp = file_systems ; tmp ; tmp = tmp->next) { + if (strcmp(tmp->name, name) == 0) { + putname(name); + return index; + } + index++; + } + putname(name); + return -EINVAL; +} + +static int fs_name(unsigned int index, char * buf) +{ + struct file_system_type * tmp; + int err, len; + + tmp = file_systems; + while (tmp && index > 0) { + tmp = tmp->next; + index--; + } + if (!tmp) + return -EINVAL; + len = strlen(tmp->name) + 1; + err = verify_area(VERIFY_WRITE, buf, len); + if (err) + return err; + memcpy_tofs(buf, tmp->name, len); + return 0; +} + +static int fs_maxindex(void) +{ + struct file_system_type * tmp; + int index; + + index = 0; + for (tmp = file_systems ; tmp ; tmp = tmp->next) + index++; + return index; +} + +/* + * Whee.. Weird sysv syscall. + */ +asmlinkage int sys_sysfs(int option, ...) +{ + va_list args; + int retval = -EINVAL; + unsigned int index; + + va_start(args, option); + switch (option) { + case 1: + retval = fs_index(va_arg(args, const char *)); + break; + + case 2: + index = va_arg(args, unsigned int); + retval = fs_name(index, va_arg(args, char *)); + break; + + case 3: + retval = fs_maxindex(); + break; + } + va_end(args); + return retval; +} + +int get_filesystem_list(char * buf) +{ + int len = 0; + struct file_system_type * tmp; + + tmp = file_systems; + while (tmp && len < PAGE_SIZE - 80) { + len += sprintf(buf+len, "%s\t%s\n", + tmp->requires_dev ? "" : "nodev", + tmp->name); + tmp = tmp->next; + } + return len; +} + struct file_system_type *get_fs_type(char *name) { struct file_system_type * fs = file_systems; @@ -422,7 +519,7 @@ if (!data) return 0; - for (vma = current->mmap ; ; ) { + for (vma = current->mm->mmap ; ; ) { if (!vma || (unsigned long) data < vma->vm_start) { return -EFAULT; @@ -557,8 +654,8 @@ inode->i_count += 3 ; /* NOTE! it is logically used 4 times, not 1 */ sb->s_covered = inode; sb->s_flags = root_mountflags; - current->pwd = inode; - current->root = inode; + current->fs->pwd = inode; + current->fs->root = inode; printk ("VFS: Mounted root (%s filesystem)%s.\n", fs_type->name, (sb->s_flags & MS_RDONLY) ? " readonly" : ""); diff -u --recursive v1.1.10/linux/fs/sysv/namei.c linux/fs/sysv/namei.c --- v1.1.10/linux/fs/sysv/namei.c Tue Apr 19 10:53:26 1994 +++ linux/fs/sysv/namei.c Mon May 2 18:34:30 1994 @@ -351,7 +351,7 @@ inode->i_nlink = 2; mark_buffer_dirty(dir_block, 1); brelse(dir_block); - inode->i_mode = S_IFDIR | (mode & 0777 & ~current->umask); + inode->i_mode = S_IFDIR | (mode & 0777 & ~current->fs->umask); if (dir->i_mode & S_ISGID) inode->i_mode |= S_ISGID; inode->i_dirt = 1; diff -u --recursive v1.1.10/linux/fs/sysv/symlink.c linux/fs/sysv/symlink.c --- v1.1.10/linux/fs/sysv/symlink.c Sun Jul 4 03:20:03 1993 +++ linux/fs/sysv/symlink.c Mon May 2 18:34:30 1994 @@ -53,7 +53,7 @@ *res_inode = NULL; if (!dir) { - dir = current->root; + dir = current->fs->root; dir->i_count++; } if (!inode) { diff -u --recursive v1.1.10/linux/fs/xiafs/namei.c linux/fs/xiafs/namei.c --- v1.1.10/linux/fs/xiafs/namei.c Tue Apr 19 10:53:28 1994 +++ linux/fs/xiafs/namei.c Mon May 2 18:34:30 1994 @@ -377,7 +377,7 @@ inode->i_nlink = 2; mark_buffer_dirty(dir_block, 1); brelse(dir_block); - inode->i_mode = S_IFDIR | (mode & S_IRWXUGO & ~current->umask); + inode->i_mode = S_IFDIR | (mode & S_IRWXUGO & ~current->fs->umask); if (dir->i_mode & S_ISGID) inode->i_mode |= S_ISGID; inode->i_dirt = 1; diff -u --recursive v1.1.10/linux/fs/xiafs/symlink.c linux/fs/xiafs/symlink.c --- v1.1.10/linux/fs/xiafs/symlink.c Wed Dec 1 14:44:15 1993 +++ linux/fs/xiafs/symlink.c Mon May 2 18:34:31 1994 @@ -80,7 +80,7 @@ *res_inode = NULL; if (!dir) { - dir = current->root; + dir = current->fs->root; dir->i_count++; } if (!inode) { diff -u --recursive v1.1.10/linux/include/linux/sched.h linux/include/linux/sched.h --- v1.1.10/linux/include/linux/sched.h Sun May 1 12:12:46 1994 +++ linux/include/linux/sched.h Mon May 2 18:34:31 1994 @@ -172,6 +172,75 @@ union i387_union i387; }; +#define INIT_TSS { \ + 0,0, \ + sizeof(init_kernel_stack) + (long) &init_kernel_stack, \ + KERNEL_DS, 0, \ + 0,0,0,0,0,0, \ + (long) &swapper_pg_dir, \ + 0,0,0,0,0,0,0,0,0,0, \ + USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0, \ + _LDT(0),0, \ + 0, 0x8000, \ + {~0, }, /* ioperm */ \ + _TSS(0), 0, 0,0, \ + { { 0, }, } /* 387 state */ \ +} + +struct files_struct { + int count; + fd_set close_on_exec; + struct file * fd[NR_OPEN]; +}; + +#define INIT_FILES { \ + 0, \ + { { 0, } }, \ + { NULL, } \ +} + +struct fs_struct { + int count; + unsigned short umask; + struct inode * root, * pwd; +}; + +#define INIT_FS { \ + 0, \ + 0022, \ + NULL, NULL \ +} + +struct mm_struct { + int count; + unsigned long start_code, end_code, end_data; + unsigned long start_brk, brk, start_stack, start_mmap; + unsigned long arg_start, arg_end, env_start, env_end; + unsigned long rss; + unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; + int swappable:1; +#ifdef NEW_SWAP + unsigned long old_maj_flt; /* old value of maj_flt */ + unsigned long dec_flt; /* page fault count of the last time */ + unsigned long swap_cnt; /* number of pages to swap on next pass */ + short swap_table; /* current page table */ + short swap_page; /* current page */ +#endif NEW_SWAP + struct vm_area_struct * mmap; + struct vm_area_struct * stk_vma; +}; + +#define INIT_MM { \ + 0, \ + 0, 0, 0, \ + 0, 0, 0, 0, \ + 0, 0, 0, 0, \ + 0, \ +/* ?_flt */ 0, 0, 0, 0, \ + 0, \ +/* swap */ 0, 0, 0, 0, 0, \ + NULL, NULL } + struct task_struct { /* these are hardcoded - don't touch */ volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ @@ -190,10 +259,7 @@ int exit_code, exit_signal; int elf_executable:1; int dumpable:1; - int swappable:1; int did_exec:1; - unsigned long start_code,end_code,end_data,start_brk,brk,start_stack,start_mmap; - unsigned long arg_start, arg_end, env_start, env_end; int pid,pgrp,session,leader; int groups[NGROUPS]; /* @@ -201,23 +267,16 @@ * older sibling, respectively. (p->father can be replaced with * p->p_pptr->pid) */ - struct task_struct *p_opptr,*p_pptr, *p_cptr, *p_ysptr, *p_osptr; + struct task_struct *p_opptr, *p_pptr, *p_cptr, *p_ysptr, *p_osptr; struct wait_queue *wait_chldexit; /* for wait4() */ - /* - * For ease of programming... Normal sleeps don't need to - * keep track of a wait-queue: every task has an entry of its own - */ unsigned short uid,euid,suid; unsigned short gid,egid,sgid; unsigned long timeout; unsigned long it_real_value, it_prof_value, it_virt_value; unsigned long it_real_incr, it_prof_incr, it_virt_incr; - long utime,stime,cutime,cstime,start_time; - unsigned long min_flt, maj_flt; - unsigned long cmin_flt, cmaj_flt; + long utime, stime, cutime, cstime, start_time; struct rlimit rlim[RLIM_NLIMITS]; unsigned short used_math; - unsigned short rss; /* number of resident pages */ char comm[16]; /* virtual 86 mode stuff */ struct vm86_struct * vm86_info; @@ -226,27 +285,19 @@ /* file system info */ int link_count; int tty; /* -1 if no tty, so it must be signed */ - unsigned short umask; - struct inode * pwd; - struct inode * root; struct inode * executable; - struct vm_area_struct * mmap; struct shm_desc *shm; struct sem_undo *semun; - struct file * filp[NR_OPEN]; - fd_set close_on_exec; /* ldt for this task - used by Wine. If NULL, default_ldt is used */ struct desc_struct *ldt; /* tss for this task */ struct tss_struct tss; -#ifdef NEW_SWAP - unsigned long old_maj_flt; /* old value of maj_flt */ - unsigned long dec_flt; /* page fault count of the last time */ - unsigned long swap_cnt; /* number of pages to swap on next pass */ - short swap_table; /* current page table */ - short swap_page; /* current page */ -#endif NEW_SWAP - struct vm_area_struct *stk_vma; +/* filesystem information */ + struct fs_struct fs[1]; +/* open file information */ + struct files_struct files[1]; +/* memory management info */ + struct mm_struct mm[1]; }; /* @@ -274,38 +325,25 @@ /* schedlink */ &init_task,&init_task, \ /* signals */ {{ 0, },}, \ /* stack */ 0,(unsigned long) &init_kernel_stack, \ -/* ec,brk... */ 0,0,0,0,0,0,0,0,0,0,0,0,0, \ -/* argv.. */ 0,0,0,0, \ +/* ec,brk... */ 0,0,0,0,0, \ /* pid etc.. */ 0,0,0,0, \ /* suppl grps*/ {NOGROUP,}, \ /* proc links*/ &init_task,&init_task,NULL,NULL,NULL,NULL, \ /* uid etc */ 0,0,0,0,0,0, \ /* timeout */ 0,0,0,0,0,0,0,0,0,0,0,0, \ -/* min_flt */ 0,0,0,0, \ /* rlimits */ { {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \ {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \ { 0, LONG_MAX}, {LONG_MAX, LONG_MAX}}, \ /* math */ 0, \ -/* rss */ 2, \ /* comm */ "swapper", \ /* vm86_info */ NULL, 0, 0, 0, 0, \ -/* fs info */ 0,-1,0022,NULL,NULL,NULL,NULL, \ +/* fs info */ 0,-1,NULL, \ /* ipc */ NULL, NULL, \ -/* filp */ {NULL,}, \ -/* cloe */ {{ 0, }}, \ /* ldt */ NULL, \ -/*tss*/ {0,0, \ - sizeof(init_kernel_stack) + (long) &init_kernel_stack, KERNEL_DS, 0, \ - 0,0,0,0,0,0, \ - (long) &swapper_pg_dir, \ - 0,0,0,0,0,0,0,0,0,0, \ - USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0, \ - _LDT(0),0, \ - 0, 0x8000, \ -/* ioperm */ {~0, }, \ - _TSS(0), 0, 0,0, \ -/* 387 state */ { { 0, }, } \ - } \ +/* tss */ INIT_TSS, \ +/* fs */ { INIT_FS }, \ +/* files */ { INIT_FILES }, \ +/* mm */ { INIT_MM } \ } extern struct task_struct init_task; diff -u --recursive v1.1.10/linux/include/linux/unistd.h linux/include/linux/unistd.h --- v1.1.10/linux/include/linux/unistd.h Mon Jan 31 16:31:56 1994 +++ linux/include/linux/unistd.h Mon May 2 13:30:59 1994 @@ -141,6 +141,7 @@ #define __NR_getpgid 132 #define __NR_fchdir 133 #define __NR_bdflush 134 +#define __NR_sysfs 135 extern int errno; diff -u --recursive v1.1.10/linux/include/linux/vm86.h linux/include/linux/vm86.h --- v1.1.10/linux/include/linux/vm86.h Sun May 1 12:12:47 1994 +++ linux/include/linux/vm86.h Mon May 2 15:31:55 1994 @@ -102,6 +102,7 @@ #ifdef __KERNEL__ void handle_vm86_fault(struct vm86_regs *, long); +void handle_vm86_debug(struct vm86_regs *, long); #endif diff -u --recursive v1.1.10/linux/ipc/shm.c linux/ipc/shm.c --- v1.1.10/linux/ipc/shm.c Sun May 1 12:12:48 1994 +++ linux/ipc/shm.c Sun May 1 12:20:31 1994 @@ -344,7 +344,7 @@ if (!remap) return -EINVAL; if (*page_table & PAGE_PRESENT) { - --current->rss; + --current->mm->rss; free_page (*page_table & PAGE_MASK); } else @@ -419,7 +419,7 @@ else return -EINVAL; } - if ((addr > current->start_stack - 16384 - PAGE_SIZE*shp->shm_npages)) + if ((addr > current->mm->start_stack - 16384 - PAGE_SIZE*shp->shm_npages)) return -EINVAL; if (shmflg & SHM_REMAP) for (shmd = current->shm; shmd; shmd = shmd->task_next) { @@ -449,7 +449,7 @@ shmd->task = current; shp->shm_nattch++; /* prevent destruction */ - if (addr < current->end_data) { + if (addr < current->mm->end_data) { iput (current->executable); current->executable = NULL; /* current->end_data = current->end_code = 0; */ @@ -626,10 +626,10 @@ shm_rss++; shp->shm_pages[idx] = page | (PAGE_SHARED | PAGE_DIRTY); } else - --current->maj_flt; /* was incremented in do_no_page */ + --current->mm->maj_flt; /* was incremented in do_no_page */ done: - current->min_flt++; + current->mm->min_flt++; page = shp->shm_pages[idx]; if (code & SHM_READ_ONLY) /* write-protect */ page &= ~2; @@ -717,7 +717,7 @@ tmp = shmd->shm_sgn | idx << SHM_IDX_SHIFT; *pte = tmp; mem_map[MAP_NR(page)]--; - shmd->task->rss--; + shmd->task->mm->rss--; invalid++; } diff -u --recursive v1.1.10/linux/kernel/exit.c linux/kernel/exit.c --- v1.1.10/linux/kernel/exit.c Tue Apr 19 22:20:35 1994 +++ linux/kernel/exit.c Mon May 2 18:34:31 1994 @@ -350,33 +350,18 @@ } } -NORET_TYPE void do_exit(long code) +static void exit_mm(void) { - struct task_struct *p; - int i; + struct vm_area_struct * mpnt; - if (intr_count) { - printk("Aiee, killing interrupt handler\n"); - intr_count = 0; - } -fake_volatile: - if (current->semun) - sem_exit(); - if (current->shm) - shm_exit(); - /* Release all of the old mmap stuff. */ - - { - struct vm_area_struct * mpnt, *mpnt1; - mpnt = current->mmap; - current->mmap = NULL; - while (mpnt) { - mpnt1 = mpnt->vm_next; - if (mpnt->vm_ops && mpnt->vm_ops->close) - mpnt->vm_ops->close(mpnt); - kfree(mpnt); - mpnt = mpnt1; - } + mpnt = current->mm->mmap; + current->mm->mmap = NULL; + while (mpnt) { + struct vm_area_struct * next = mpnt->vm_next; + if (mpnt->vm_ops && mpnt->vm_ops->close) + mpnt->vm_ops->close(mpnt); + kfree(mpnt); + mpnt = next; } /* forget local segments */ @@ -391,16 +376,44 @@ } free_page_tables(current); +} + +static void exit_files(void) +{ + int i; + for (i=0 ; ifilp[i]) + if (current->files->fd[i]) sys_close(i); - forget_original_parent(current); - iput(current->pwd); - current->pwd = NULL; - iput(current->root); - current->root = NULL; +} + +static void exit_fs(void) +{ + iput(current->fs->pwd); + current->fs->pwd = NULL; + iput(current->fs->root); + current->fs->root = NULL; iput(current->executable); current->executable = NULL; +} + +NORET_TYPE void do_exit(long code) +{ + struct task_struct *p; + + if (intr_count) { + printk("Aiee, killing interrupt handler\n"); + intr_count = 0; + } +fake_volatile: + if (current->semun) + sem_exit(); + if (current->shm) + shm_exit(); + exit_mm(); + exit_files(); + exit_fs(); + forget_original_parent(current); /* * Check to see if any process groups have become orphaned * as a result of our exiting, and if they have any stopped @@ -461,7 +474,7 @@ last_task_used_math = NULL; current->state = TASK_ZOMBIE; current->exit_code = code; - current->rss = 0; + current->mm->rss = 0; #ifdef DEBUG_PROC_TREE audit_ptree(); #endif @@ -533,8 +546,8 @@ case TASK_ZOMBIE: current->cutime += p->utime + p->cutime; current->cstime += p->stime + p->cstime; - current->cmin_flt += p->min_flt + p->cmin_flt; - current->cmaj_flt += p->maj_flt + p->cmaj_flt; + current->mm->cmin_flt += p->mm->min_flt + p->mm->cmin_flt; + current->mm->cmaj_flt += p->mm->maj_flt + p->mm->cmaj_flt; if (ru != NULL) getrusage(p, RUSAGE_BOTH, ru); flag = p->pid; diff -u --recursive v1.1.10/linux/kernel/fork.c linux/kernel/fork.c --- v1.1.10/linux/kernel/fork.c Fri Mar 18 10:15:28 1994 +++ linux/kernel/fork.c Mon May 2 19:07:32 1994 @@ -89,14 +89,14 @@ return new_file; } -int dup_mmap(struct task_struct * tsk) +static int dup_mmap(struct task_struct * tsk) { struct vm_area_struct * mpnt, **p, *tmp; - tsk->mmap = NULL; - tsk->stk_vma = NULL; - p = &tsk->mmap; - for (mpnt = current->mmap ; mpnt ; mpnt = mpnt->vm_next) { + tsk->mm->mmap = NULL; + tsk->mm->stk_vma = NULL; + p = &tsk->mm->mmap; + for (mpnt = current->mm->mmap ; mpnt ; mpnt = mpnt->vm_next) { tmp = (struct vm_area_struct *) kmalloc(sizeof(struct vm_area_struct), GFP_KERNEL); if (!tmp) return -ENOMEM; @@ -107,14 +107,63 @@ tmp->vm_inode->i_count++; *p = tmp; p = &tmp->vm_next; - if (current->stk_vma == mpnt) - tsk->stk_vma = tmp; + if (current->mm->stk_vma == mpnt) + tsk->mm->stk_vma = tmp; } return 0; } +/* + * SHAREFD not yet implemented.. + */ +static void copy_files(unsigned long clone_flags, struct task_struct * p) +{ + int i; + struct file * f; + + if (clone_flags & COPYFD) { + for (i=0; ifiles->fd[i]) != NULL) + p->files->fd[i] = copy_fd(f); + } else { + for (i=0; ifiles->fd[i]) != NULL) + f->f_count++; + } +} + +/* + * CLONEVM not yet correctly implemented: needs to clone the mmap + * instead of duplicating it.. + */ +static int copy_mm(unsigned long clone_flags, struct task_struct * p) +{ + if (clone_flags & COPYVM) { + p->mm->swappable = 1; + p->mm->min_flt = p->mm->maj_flt = 0; + p->mm->cmin_flt = p->mm->cmaj_flt = 0; + if (copy_page_tables(p)) + return 1; + dup_mmap(p); + } else { + if (clone_page_tables(p)) + return 1; + dup_mmap(p); /* wrong.. */ + } + return 0; +} + +static void copy_fs(unsigned long clone_flags, struct task_struct * p) +{ + if (current->fs->pwd) + current->fs->pwd->i_count++; + if (current->fs->root) + current->fs->root->i_count++; + if (current->executable) + current->executable->i_count++; +} + #define IS_CLONE (regs.orig_eax == __NR_clone) -#define copy_vm(p) ((clone_flags & COPYVM)?copy_page_tables(p):clone_page_tables(p)) /* * Ok, this is the main fork-routine. It copies the system process @@ -126,7 +175,6 @@ struct pt_regs * childregs; struct task_struct *p; int i,nr; - struct file *f; unsigned long clone_flags = COPYVM | SIGCHLD; if(!(p = (struct task_struct*)__get_free_page(GFP_KERNEL))) @@ -141,7 +189,6 @@ p->state = TASK_UNINTERRUPTIBLE; p->flags &= ~(PF_PTRACED|PF_TRACESYS); p->pid = last_pid; - p->swappable = 1; p->p_pptr = p->p_opptr = current; p->p_cptr = NULL; SET_LINKS(p); @@ -151,8 +198,6 @@ p->leader = 0; /* process leadership doesn't inherit */ p->utime = p->stime = 0; p->cutime = p->cstime = 0; - p->min_flt = p->maj_flt = 0; - p->cmin_flt = p->cmaj_flt = 0; p->start_time = jiffies; /* * set up new TSS and kernel stack @@ -196,24 +241,10 @@ if (last_task_used_math == current) __asm__("clts ; fnsave %0 ; frstor %0":"=m" (p->tss.i387)); p->semun = NULL; p->shm = NULL; - if (copy_vm(p) || shm_fork(current, p)) + if (copy_mm(clone_flags, p) || shm_fork(current, p)) goto bad_fork_cleanup; - if (clone_flags & COPYFD) { - for (i=0; ifilp[i]) != NULL) - p->filp[i] = copy_fd(f); - } else { - for (i=0; ifilp[i]) != NULL) - f->f_count++; - } - if (current->pwd) - current->pwd->i_count++; - if (current->root) - current->root->i_count++; - if (current->executable) - current->executable->i_count++; - dup_mmap(p); + copy_files(clone_flags, p); + copy_fs(clone_flags, p); set_tss_desc(gdt+(nr<<1)+FIRST_TSS_ENTRY,&(p->tss)); if (p->ldt) set_ldt_desc(gdt+(nr<<1)+FIRST_LDT_ENTRY,p->ldt, 512); diff -u --recursive v1.1.10/linux/kernel/ksyms.c linux/kernel/ksyms.c --- v1.1.10/linux/kernel/ksyms.c Mon Apr 25 10:04:36 1994 +++ linux/kernel/ksyms.c Sun May 1 10:22:28 1994 @@ -10,6 +10,12 @@ #include #include #include +#include +#include +#include +#include + +extern void *sys_call_table; #define X(name) { (void *) &name, "_" #name } @@ -18,12 +24,30 @@ extern void (*do_floppy)(void); #endif +#ifdef CONFIG_BINFMT_IBCS +extern int do_execve(char * filename, char ** argv, char ** envp, + struct pt_regs * regs); +extern void flush_old_exec(struct linux_binprm * bprm); +extern int open_inode(struct inode * inode, int mode); +extern int read_exec(struct inode *inode, unsigned long offset, + char * addr, unsigned long count); + +extern void check_pending(int signum); +extern int do_signal(unsigned long oldmask, struct pt_regs * regs); +extern int (*ibcs_invmapsig)(int); + +extern void (* iABI_hook)(struct pt_regs * regs); +#endif + struct { void *addr; const char *name; } symbol_table[] = { - /* process memory management */ + /* system info variables */ + X(EISA_bus), X(wp_works_ok), + + /* process memory management */ X(__verify_write), X(do_mmap), X(do_munmap), @@ -50,6 +74,10 @@ X(register_blkdev), X(unregister_blkdev), + /* filesystem registration */ + X(register_filesystem), + X(unregister_filesystem), + /* interrupt handling */ X(request_irq), X(free_irq), @@ -66,11 +94,43 @@ X(printk), X(sprintf), X(vsprintf), + X(system_utsname), + X(sys_call_table), #ifdef CONFIG_FTAPE /* The next labels are needed for ftape driver. */ X(ftape_big_buffer), X(do_floppy), +#endif + +#ifdef CONFIG_BINFMT_IBCS +/* + * The following are needed if iBCS support is modular rather than + * compiled in. + */ + /* Emulator hooks. */ + X(iABI_hook), + X(ibcs_invmapsig), + + /* Signal interfaces */ + X(do_signal), + X(check_pending), + X(send_sig), + + /* Program loader interfaces */ + X(change_ldt), + X(copy_strings), + X(create_tables), + X(do_execve), + X(flush_old_exec), + X(formats), + X(insert_vm_struct), + X(open_inode), + X(read_exec), + X(zeromap_page_range), + + /* Miscellaneous access points */ + X(si_meminfo), #endif }; diff -u --recursive v1.1.10/linux/kernel/sys.c linux/kernel/sys.c --- v1.1.10/linux/kernel/sys.c Sun May 1 12:12:49 1994 +++ linux/kernel/sys.c Mon May 2 18:40:24 1994 @@ -190,12 +190,16 @@ /* - * This is done BSD-style, with no consideration of the saved gid, except - * that if you set the effective gid, it sets the saved gid too. This - * makes it possible for a setgid program to completely drop its privileges, - * which is often a useful assertion to make when you are doing a security - * audit over a program. + * Unprivileged users may change the real gid to the effective gid + * or vice versa. (BSD-style) + * + * If you set the real gid at all, or set the effective gid to a value not + * equal to the real gid, then the saved gid is set to the new effective gid. * + * This makes it possible for a setgid program to completely drop its + * privileges, which is often a useful assertion to make when you are doing + * a security audit over a program. + * * The general idea is that a program which uses just setregid() will be * 100% compatible with BSD. A program which uses just setgid() will be * 100% compatible with POSIX w/ Saved ID's. @@ -215,14 +219,16 @@ if (egid != (gid_t) -1) { if ((old_rgid == egid) || (current->egid == egid) || - suser()) { + suser()) current->egid = egid; - current->sgid = egid; - } else { + else { current->gid = old_rgid; return(-EPERM); } } + if (rgid != (gid_t) -1 || + egid != (gid_t) -1 && egid != old_rgid) + current->sgid = current->egid; return 0; } @@ -271,14 +277,16 @@ } /* - * Unprivileged users may change the real user id to the effective uid + * Unprivileged users may change the real uid to the effective uid * or vice versa. (BSD-style) * - * When you set the effective uid, it sets the saved uid too. This - * makes it possible for a setuid program to completely drop its privileges, - * which is often a useful assertion to make when you are doing a security - * audit over a program. + * If you set the real uid at all, or set the effective uid to a value not + * equal to the real uid, then the saved uid is set to the new effective uid. * + * This makes it possible for a setuid program to completely drop its + * privileges, which is often a useful assertion to make when you are doing + * a security audit over a program. + * * The general idea is that a program which uses just setreuid() will be * 100% compatible with BSD. A program which uses just setuid() will be * 100% compatible with POSIX w/ Saved ID's. @@ -286,10 +294,10 @@ asmlinkage int sys_setreuid(uid_t ruid, uid_t euid) { int old_ruid = current->uid; - + if (ruid != (uid_t) -1) { if ((current->euid==ruid) || - (old_ruid == ruid) || + (old_ruid == ruid) || suser()) current->uid = ruid; else @@ -298,14 +306,16 @@ if (euid != (uid_t) -1) { if ((old_ruid == euid) || (current->euid == euid) || - suser()) { + suser()) current->euid = euid; - current->suid = euid; - } else { + else { current->uid = old_ruid; return(-EPERM); } } + if (ruid != (uid_t) -1 || + euid != (uid_t) -1 && euid != old_ruid) + current->suid = current->euid; return 0; } @@ -351,18 +361,18 @@ unsigned long rlim; unsigned long newbrk, oldbrk; - if (brk < current->end_code) - return current->brk; + if (brk < current->mm->end_code) + return current->mm->brk; newbrk = PAGE_ALIGN(brk); - oldbrk = PAGE_ALIGN(current->brk); + oldbrk = PAGE_ALIGN(current->mm->brk); if (oldbrk == newbrk) - return current->brk = brk; + return current->mm->brk = brk; /* * Always allow shrinking brk */ - if (brk <= current->brk) { - current->brk = brk; + if (brk <= current->mm->brk) { + current->mm->brk = brk; do_munmap(newbrk, oldbrk-newbrk); return brk; } @@ -372,8 +382,9 @@ rlim = current->rlim[RLIMIT_DATA].rlim_cur; if (rlim >= RLIM_INFINITY) rlim = ~0; - if (brk - current->end_code > rlim || brk >= current->start_stack - 16384) - return current->brk; + if (brk - current->mm->end_code > rlim || + brk >= current->mm->start_stack - 16384) + return current->mm->brk; /* * stupid algorithm to decide if we have enough memory: while * simple, it hopefully works in most obvious cases.. Easy to @@ -385,17 +396,17 @@ freepages -= (high_memory - 0x100000) >> 16; freepages -= (newbrk-oldbrk) >> 12; if (freepages < 0) - return current->brk; + return current->mm->brk; #if 0 - freepages += current->rss; + freepages += current->mm->rss; freepages -= oldbrk >> 12; if (freepages < 0) - return current->brk; + return current->mm->brk; #endif /* * Ok, we have probably got enough memory - let it rip. */ - current->brk = brk; + current->mm->brk = brk; do_mmap(NULL, oldbrk, newbrk-oldbrk, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_FIXED|MAP_PRIVATE, 0); @@ -688,24 +699,24 @@ r.ru_utime.tv_usec = CT_TO_USECS(p->utime); r.ru_stime.tv_sec = CT_TO_SECS(p->stime); r.ru_stime.tv_usec = CT_TO_USECS(p->stime); - r.ru_minflt = p->min_flt; - r.ru_majflt = p->maj_flt; + r.ru_minflt = p->mm->min_flt; + r.ru_majflt = p->mm->maj_flt; break; case RUSAGE_CHILDREN: r.ru_utime.tv_sec = CT_TO_SECS(p->cutime); r.ru_utime.tv_usec = CT_TO_USECS(p->cutime); r.ru_stime.tv_sec = CT_TO_SECS(p->cstime); r.ru_stime.tv_usec = CT_TO_USECS(p->cstime); - r.ru_minflt = p->cmin_flt; - r.ru_majflt = p->cmaj_flt; + r.ru_minflt = p->mm->cmin_flt; + r.ru_majflt = p->mm->cmaj_flt; break; default: r.ru_utime.tv_sec = CT_TO_SECS(p->utime + p->cutime); r.ru_utime.tv_usec = CT_TO_USECS(p->utime + p->cutime); r.ru_stime.tv_sec = CT_TO_SECS(p->stime + p->cstime); r.ru_stime.tv_usec = CT_TO_USECS(p->stime + p->cstime); - r.ru_minflt = p->min_flt + p->cmin_flt; - r.ru_majflt = p->maj_flt + p->cmaj_flt; + r.ru_minflt = p->mm->min_flt + p->mm->cmin_flt; + r.ru_majflt = p->mm->maj_flt + p->mm->cmaj_flt; break; } lp = (unsigned long *) &r; @@ -725,8 +736,8 @@ asmlinkage int sys_umask(int mask) { - int old = current->umask; + int old = current->fs->umask; - current->umask = mask & S_IRWXUGO; + current->fs->umask = mask & S_IRWXUGO; return (old); } diff -u --recursive v1.1.10/linux/kernel/sys_call.S linux/kernel/sys_call.S --- v1.1.10/linux/kernel/sys_call.S Tue Apr 5 09:01:38 1994 +++ linux/kernel/sys_call.S Mon May 2 13:30:32 1994 @@ -531,5 +531,6 @@ .long _sys_getpgid .long _sys_fchdir .long _sys_bdflush + .long _sys_sysfs /* 135 */ - .space (NR_syscalls-130)*4 + .space (NR_syscalls-135)*4 diff -u --recursive v1.1.10/linux/kernel/traps.c linux/kernel/traps.c --- v1.1.10/linux/kernel/traps.c Mon Apr 25 10:04:37 1994 +++ linux/kernel/traps.c Mon May 2 15:39:19 1994 @@ -148,20 +148,22 @@ asmlinkage void do_debug(struct pt_regs * regs, long error_code) { + if (regs->eflags & VM_MASK) { + handle_vm86_debug((struct vm86_regs *) regs, error_code); + return; + } if (current->flags & PF_PTRACED) current->blocked &= ~(1 << (SIGTRAP-1)); send_sig(SIGTRAP, current, 1); current->tss.trap_no = 1; current->tss.error_code = error_code; - if((regs->cs & 3) == 0) { - /* If this is a kernel mode trap, then reset db7 and allow us to continue */ - __asm__("movl $0,%%edx\n\t" \ - "movl %%edx,%%db7\n\t" \ - : /* no output */ \ - : /* no input */ :"dx"); - - return; - }; + if ((regs->cs & 3) == 0) { + /* If this is a kernel mode trap, then reset db7 and allow us to continue */ + __asm__("movl %0,%%db7" + : /* no output */ + : "r" (0)); + return; + } die_if_kernel("debug",regs,error_code); } diff -u --recursive v1.1.10/linux/kernel/vm86.c linux/kernel/vm86.c --- v1.1.10/linux/kernel/vm86.c Sun May 1 12:12:50 1994 +++ linux/kernel/vm86.c Mon May 2 15:30:52 1994 @@ -14,8 +14,25 @@ #include /* - * 16-bit register defines.. + * Known problems: + * + * Interrupt handling is not guaranteed: + * - a real x86 will disable all interrupts for one instruction + * after a "mov ss,xx" to make stack handling atomic even without + * the 'lss' instruction. We can't guarantee this in v86 mode, + * as the next instruction might result in a page fault or similar. + * - a real x86 will have interrupts disabled for one instruction + * past the 'sti' that enables them. We don't bother with all the + * details yet.. + * + * Hopefully these problems do not actually matter for anything. */ + +/* + * 8- and 16-bit register defines.. + */ +#define AL(regs) (((unsigned char *) ((regs)->eax))[0]) +#define AH(regs) (((unsigned char *) ((regs)->eax))[1]) #define IP(regs) (*(unsigned short *)&((regs)->eip)) #define SP(regs) (*(unsigned short *)&((regs)->esp)) @@ -272,7 +289,7 @@ if (seg == BIOSSEG || regs->cs == BIOSSEG || is_revectored(i, ¤t->vm86_info->int_revectored)) return_to_32bit(regs, VM86_INTx + (i << 8)); - if (i==0x21 && is_revectored((regs->eax >> 4) & 0xff,¤t->vm86_info->int21_revectored)) { + if (i==0x21 && is_revectored(AH(regs),¤t->vm86_info->int21_revectored)) { return_to_32bit(regs, VM86_INTx + (i << 8)); } pushw(ssp, sp, get_vflags(regs)); @@ -286,6 +303,10 @@ return; } +void handle_vm86_debug(struct vm86_regs * regs, long error_code) +{ + do_int(regs, 3, (unsigned char *) (regs->ss << 4), SP(regs)); +} void handle_vm86_fault(struct vm86_regs * regs, long error_code) { @@ -359,6 +380,12 @@ return; /* sti */ + /* + * Damn. This is incorrect: the 'sti' instruction should actually + * enable interrupts after the /next/ instruction. Not good. + * + * Probably needs some horsing around with the TF flag. Aiee.. + */ case 0xfb: IP(regs)++; set_IF(regs); diff -u --recursive v1.1.10/linux/mm/memory.c linux/mm/memory.c --- v1.1.10/linux/mm/memory.c Sun May 1 12:12:51 1994 +++ linux/mm/memory.c Sun May 1 12:20:31 1994 @@ -307,8 +307,8 @@ *page_table = 0; if (1 & page) { if (!(mem_map[MAP_NR(page)] & MAP_PAGE_RESERVED)) - if (current->rss > 0) - --current->rss; + if (current->mm->rss > 0) + --current->mm->rss; free_page(PAGE_MASK & page); } else swap_free(page); @@ -367,8 +367,8 @@ *page_table = 0; if (page & PAGE_PRESENT) { if (!(mem_map[MAP_NR(page)] & MAP_PAGE_RESERVED)) - if (current->rss > 0) - --current->rss; + if (current->mm->rss > 0) + --current->mm->rss; free_page(PAGE_MASK & page); } else swap_free(page); @@ -429,8 +429,8 @@ *page_table = 0; if (PAGE_PRESENT & page) { if (!(mem_map[MAP_NR(page)] & MAP_PAGE_RESERVED)) - if (current->rss > 0) - --current->rss; + if (current->mm->rss > 0) + --current->mm->rss; free_page(PAGE_MASK & page); } else swap_free(page); @@ -451,7 +451,7 @@ else { *page_table++ = (to | mask); if (!(mem_map[MAP_NR(to)] & MAP_PAGE_RESERVED)) { - ++current->rss; + ++current->mm->rss; mem_map[MAP_NR(to)]++; } } @@ -572,13 +572,13 @@ goto bad_wp_page; if (old_page & PAGE_RW) goto end_wp_page; - tsk->min_flt++; + tsk->mm->min_flt++; prot = (old_page & ~PAGE_MASK) | PAGE_RW; old_page &= PAGE_MASK; if (mem_map[MAP_NR(old_page)] != 1) { if (new_page) { if (mem_map[MAP_NR(old_page)] & MAP_PAGE_RESERVED) - ++tsk->rss; + ++tsk->mm->rss; copy_page(old_page,new_page); *(unsigned long *) pte = new_page | prot; free_page(old_page); @@ -770,7 +770,7 @@ we can share pages with */ if(area){ struct vm_area_struct * mpnt; - for (mpnt = (*p)->mmap; mpnt; mpnt = mpnt->vm_next) { + for (mpnt = (*p)->mm->mmap; mpnt; mpnt = mpnt->vm_next) { if (mpnt->vm_ops == area->vm_ops && mpnt->vm_inode->i_ino == area->vm_inode->i_ino&& mpnt->vm_inode->i_dev == area->vm_inode->i_dev){ @@ -836,15 +836,15 @@ tmp = *(unsigned long *) page; if (tmp & PAGE_PRESENT) return; - ++tsk->rss; + ++tsk->mm->rss; if (tmp) { - ++tsk->maj_flt; + ++tsk->mm->maj_flt; swap_in((unsigned long *) page); return; } address &= 0xfffff000; tmp = 0; - for (mpnt = tsk->mmap; mpnt != NULL; mpnt = mpnt->vm_next) { + for (mpnt = tsk->mm->mmap; mpnt != NULL; mpnt = mpnt->vm_next) { if (address < mpnt->vm_start) break; if (address >= mpnt->vm_end) { @@ -852,7 +852,7 @@ continue; } if (!mpnt->vm_ops || !mpnt->vm_ops->nopage) { - ++tsk->min_flt; + ++tsk->mm->min_flt; get_empty_page(tsk,address); return; } @@ -861,9 +861,9 @@ } if (tsk != current) goto ok_no_page; - if (address >= tsk->end_data && address < tsk->brk) + if (address >= tsk->mm->end_data && address < tsk->mm->brk) goto ok_no_page; - if (mpnt && mpnt == tsk->stk_vma && + if (mpnt && mpnt == tsk->mm->stk_vma && address - tmp > mpnt->vm_start - address && tsk->rlim[RLIMIT_STACK].rlim_cur > mpnt->vm_end - address) { mpnt->vm_start = address; @@ -876,7 +876,7 @@ if (error_code & 4) /* user level access? */ return; ok_no_page: - ++tsk->min_flt; + ++tsk->mm->min_flt; get_empty_page(tsk,address); } @@ -1166,11 +1166,11 @@ page = get_free_page(GFP_KERNEL); if (share_page(area, area->vm_task, inode, address, error_code, page)) { - ++area->vm_task->min_flt; + ++area->vm_task->mm->min_flt; return; } - ++area->vm_task->maj_flt; + ++area->vm_task->mm->maj_flt; if (!page) { oom(current); put_page(area->vm_task, BAD_PAGE, address, PAGE_PRIVATE); diff -u --recursive v1.1.10/linux/mm/mmap.c linux/mm/mmap.c --- v1.1.10/linux/mm/mmap.c Fri Feb 4 11:59:35 1994 +++ linux/mm/mmap.c Mon May 2 18:34:32 1994 @@ -86,7 +86,7 @@ /* Maybe this works.. Ugly it is. */ addr = SHM_RANGE_START; while (addr+len < SHM_RANGE_END) { - for (vmm = current->mmap ; vmm ; vmm = vmm->vm_next) { + for (vmm = current->mm->mmap ; vmm ; vmm = vmm->vm_next) { if (addr >= vmm->vm_end) continue; if (addr + len <= vmm->vm_start) @@ -146,7 +146,7 @@ flags = get_fs_long(buffer+3); if (!(flags & MAP_ANONYMOUS)) { unsigned long fd = get_fs_long(buffer+4); - if (fd >= NR_OPEN || !(file = current->filp[fd])) + if (fd >= NR_OPEN || !(file = current->files->fd[fd])) return -EBADF; } return do_mmap(file, get_fs_long(buffer), get_fs_long(buffer+1), @@ -259,7 +259,7 @@ * every area affected in some way (by any overlap) is put * on the list. If nothing is put on, nothing is affected. */ - npp = ¤t->mmap; + npp = ¤t->mm->mmap; free = NULL; for (mpnt = *npp; mpnt != NULL; mpnt = *npp) { unsigned long end = addr+len; @@ -346,7 +346,7 @@ mpnt->vm_offset = off; mpnt->vm_ops = &file_mmap; insert_vm_struct(current, mpnt); - merge_segments(current->mmap, NULL, NULL); + merge_segments(current->mm->mmap, NULL, NULL); return 0; } @@ -361,9 +361,9 @@ { struct vm_area_struct **nxtpp, *mpnt; - nxtpp = &t->mmap; + nxtpp = &t->mm->mmap; - for(mpnt = t->mmap; mpnt != NULL; mpnt = mpnt->vm_next) + for(mpnt = t->mm->mmap; mpnt != NULL; mpnt = mpnt->vm_next) { if (mpnt->vm_start > vmp->vm_start) break; @@ -464,7 +464,7 @@ mpnt->vm_offset = 0; mpnt->vm_ops = NULL; insert_vm_struct(current, mpnt); - merge_segments(current->mmap, ignoff_mergep, NULL); + merge_segments(current->mm->mmap, ignoff_mergep, NULL); return 0; } diff -u --recursive v1.1.10/linux/mm/swap.c linux/mm/swap.c --- v1.1.10/linux/mm/swap.c Sun May 1 12:12:51 1994 +++ linux/mm/swap.c Sun May 1 12:20:32 1994 @@ -317,7 +317,7 @@ } p = task[swap_task]; - if(p && p->swappable && p->rss) + if(p && p->mm->swappable && p->mm->rss) break; swap_task++; @@ -326,23 +326,23 @@ /* * Determine the number of pages to swap from this process. */ - if(! p -> swap_cnt) { - p->dec_flt = (p->dec_flt * 3) / 4 + p->maj_flt - p->old_maj_flt; - p->old_maj_flt = p->maj_flt; - - if(p->dec_flt >= SWAP_RATIO / SWAP_MIN) { - p->dec_flt = SWAP_RATIO / SWAP_MIN; - p->swap_cnt = SWAP_MIN; - } else if(p->dec_flt <= SWAP_RATIO / SWAP_MAX) - p->swap_cnt = SWAP_MAX; + if(! p->mm->swap_cnt) { + p->mm->dec_flt = (p->mm->dec_flt * 3) / 4 + p->mm->maj_flt - p->mm->old_maj_flt; + p->mm->old_maj_flt = p->mm->maj_flt; + + if(p->mm->dec_flt >= SWAP_RATIO / SWAP_MIN) { + p->mm->dec_flt = SWAP_RATIO / SWAP_MIN; + p->mm->swap_cnt = SWAP_MIN; + } else if(p->mm->dec_flt <= SWAP_RATIO / SWAP_MAX) + p->mm->swap_cnt = SWAP_MAX; else - p->swap_cnt = SWAP_RATIO / p->dec_flt; + p->mm->swap_cnt = SWAP_RATIO / p->mm->dec_flt; } /* * Go through process' page directory. */ - for(table = p->swap_table; table < 1024; table++) { + for(table = p->mm->swap_table; table < 1024; table++) { pg_table = ((unsigned long *) p->tss.cr3)[table]; if(pg_table >= high_memory) continue; @@ -359,34 +359,34 @@ /* * Go through this page table. */ - for(page = p->swap_page; page < 1024; page++) { + for(page = p->mm->swap_page; page < 1024; page++) { switch(try_to_swap_out(page + (unsigned long *) pg_table)) { case 0: break; case 1: - p->rss--; + p->mm->rss--; /* continue with the following page the next time */ - p->swap_table = table; - p->swap_page = page + 1; - if((--p->swap_cnt) == 0) + p->mm->swap_table = table; + p->mm->swap_page = page + 1; + if((--p->mm->swap_cnt) == 0) swap_task++; return 1; default: - p->rss--; + p->mm->rss--; break; } } - p->swap_page = 0; + p->mm->swap_page = 0; } /* * Finish work with this process, if we reached the end of the page * directory. Mark restart from the beginning the next time. */ - p->swap_table = 0; + p->mm->swap_table = 0; } return 0; } @@ -419,7 +419,7 @@ goto check_task; } p = task[swap_task]; - if (!p || !p->swappable) { + if (!p || !p->mm->swappable) { swap_task++; goto check_task; } @@ -450,8 +450,8 @@ } switch (try_to_swap_out(swap_page + (unsigned long *) pg_table)) { case 0: break; - case 1: p->rss--; return 1; - default: p->rss--; + case 1: p->mm->rss--; return 1; + default: p->mm->rss--; } swap_page++; goto check_table; @@ -689,7 +689,7 @@ read_swap_page(page, (char *) tmp); if (*ppage == page) { *ppage = tmp | (PAGE_DIRTY | PAGE_PRIVATE); - ++p->rss; + ++p->mm->rss; swap_free(page); tmp = 0; } diff -u --recursive v1.1.10/linux/net/socket.c linux/net/socket.c --- v1.1.10/linux/net/socket.c Tue Apr 19 10:54:08 1994 +++ linux/net/socket.c Mon May 2 18:34:33 1994 @@ -112,13 +112,13 @@ file = get_empty_filp(); if (!file) return(-1); for (fd = 0; fd < NR_OPEN; ++fd) - if (!current->filp[fd]) break; + if (!current->files->fd[fd]) break; if (fd == NR_OPEN) { file->f_count = 0; return(-1); } - FD_CLR(fd, ¤t->close_on_exec); - current->filp[fd] = file; + FD_CLR(fd, ¤t->files->close_on_exec); + current->files->fd[fd] = file; file->f_op = &socket_file_ops; file->f_mode = 3; file->f_flags = 0; @@ -166,7 +166,7 @@ { struct file *file; - if (fd < 0 || fd >= NR_OPEN || !(file = current->filp[fd])) return(NULL); + if (fd < 0 || fd >= NR_OPEN || !(file = current->files->fd[fd])) return(NULL); if (pfile) *pfile = file; return(socki_lookup(file->f_inode)); } @@ -548,7 +548,7 @@ int i; DPRINTF((net_debug, "NET: sock_bind: fd = %d\n", fd)); - if (fd < 0 || fd >= NR_OPEN || current->filp[fd] == NULL) + if (fd < 0 || fd >= NR_OPEN || current->files->fd[fd] == NULL) return(-EBADF); if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK); if ((i = sock->ops->bind(sock, umyaddr, addrlen)) < 0) { @@ -570,7 +570,7 @@ struct socket *sock; DPRINTF((net_debug, "NET: sock_listen: fd = %d\n", fd)); - if (fd < 0 || fd >= NR_OPEN || current->filp[fd] == NULL) + if (fd < 0 || fd >= NR_OPEN || current->files->fd[fd] == NULL) return(-EBADF); if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK); if (sock->state != SS_UNCONNECTED) { @@ -596,7 +596,7 @@ int i; DPRINTF((net_debug, "NET: sock_accept: fd = %d\n", fd)); - if (fd < 0 || fd >= NR_OPEN || ((file = current->filp[fd]) == NULL)) + if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL)) return(-EBADF); if (!(sock = sockfd_lookup(fd, &file))) return(-ENOTSOCK); @@ -651,7 +651,7 @@ int i; DPRINTF((net_debug, "NET: sock_connect: fd = %d\n", fd)); - if (fd < 0 || fd >= NR_OPEN || (file=current->filp[fd]) == NULL) + if (fd < 0 || fd >= NR_OPEN || (file=current->files->fd[fd]) == NULL) return(-EBADF); if (!(sock = sockfd_lookup(fd, &file))) return(-ENOTSOCK); @@ -686,7 +686,7 @@ struct socket *sock; DPRINTF((net_debug, "NET: sock_getsockname: fd = %d\n", fd)); - if (fd < 0 || fd >= NR_OPEN || current->filp[fd] == NULL) + if (fd < 0 || fd >= NR_OPEN || current->files->fd[fd] == NULL) return(-EBADF); if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK); return(sock->ops->getname(sock, usockaddr, usockaddr_len, 0)); @@ -699,7 +699,7 @@ struct socket *sock; DPRINTF((net_debug, "NET: sock_getpeername: fd = %d\n", fd)); - if (fd < 0 || fd >= NR_OPEN || current->filp[fd] == NULL) + if (fd < 0 || fd >= NR_OPEN || current->files->fd[fd] == NULL) return(-EBADF); if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK); return(sock->ops->getname(sock, usockaddr, usockaddr_len, 1)); @@ -716,7 +716,7 @@ "NET: sock_send(fd = %d, buff = %X, len = %d, flags = %X)\n", fd, buff, len, flags)); - if (fd < 0 || fd >= NR_OPEN || ((file = current->filp[fd]) == NULL)) + if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL)) return(-EBADF); if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK); @@ -735,7 +735,7 @@ "NET: sock_sendto(fd = %d, buff = %X, len = %d, flags = %X," " addr=%X, alen = %d\n", fd, buff, len, flags, addr, addr_len)); - if (fd < 0 || fd >= NR_OPEN || ((file = current->filp[fd]) == NULL)) + if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL)) return(-EBADF); if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK); @@ -754,7 +754,7 @@ "NET: sock_recv(fd = %d, buff = %X, len = %d, flags = %X)\n", fd, buff, len, flags)); - if (fd < 0 || fd >= NR_OPEN || ((file = current->filp[fd]) == NULL)) + if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL)) return(-EBADF); if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK); @@ -773,7 +773,7 @@ "NET: sock_recvfrom(fd = %d, buff = %X, len = %d, flags = %X," " addr=%X, alen=%X\n", fd, buff, len, flags, addr, addr_len)); - if (fd < 0 || fd >= NR_OPEN || ((file = current->filp[fd]) == NULL)) + if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL)) return(-EBADF); if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK); @@ -793,7 +793,7 @@ DPRINTF((net_debug, " optval = %X, optlen = %d)\n", optval, optlen)); - if (fd < 0 || fd >= NR_OPEN || ((file = current->filp[fd]) == NULL)) + if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL)) return(-EBADF); if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK); @@ -812,7 +812,7 @@ DPRINTF((net_debug, " optval = %X, optlen = %X)\n", optval, optlen)); - if (fd < 0 || fd >= NR_OPEN || ((file = current->filp[fd]) == NULL)) + if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL)) return(-EBADF); if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK); @@ -829,7 +829,7 @@ DPRINTF((net_debug, "NET: sock_shutdown(fd = %d, how = %d)\n", fd, how)); - if (fd < 0 || fd >= NR_OPEN || ((file = current->filp[fd]) == NULL)) + if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL)) return(-EBADF); if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK);