diff -rc --new-file linuxpl14/fs/exec.c linux/fs/exec.c
*** linuxpl14/fs/exec.c	Sat Oct 30 23:20:41 1993
--- linux/fs/exec.c	Wed Dec  8 10:44:22 1993
***************
*** 156,161 ****
--- 156,162 ----
  	if (!file.f_op->write)
  		goto close_coredump;
  	has_dumped = 1;
+ 	current->flags |= PF_DUMPCORE;
  /* changed the size calculations - should hopefully work better. lbt */
  	dump.magic = CMAGIC;
  	dump.start_code = 0;
***************
*** 779,784 ****
--- 780,786 ----
  	current->mmap = NULL;
  	current->executable = NULL;  /* for OMAGIC files */
  	current->sgid = current->egid = bprm->e_gid;
+ 	current->flags &= ~PF_FORKNOEXEC;
  	if (N_MAGIC(ex) == OMAGIC) {
  		do_mmap(NULL, 0, ex.a_text+ex.a_data,
  			PROT_READ|PROT_WRITE|PROT_EXEC,
diff -rc --new-file linuxpl14/include/linux/acct.h linux/include/linux/acct.h
*** linuxpl14/include/linux/acct.h
--- linux/include/linux/acct.h	Wed Dec  8 09:53:41 1993
***************
*** 0 ****
--- 1,29 ----
+ #ifndef __LINUX_ACCT_H
+ #define __LINUX_ACCT_H
+ 
+ #define ACCT_COMM 16
+ 
+ struct acct
+ {
+ 	char	ac_comm[ACCT_COMM];	/* Accounting command name */
+ 	time_t	ac_utime;		/* Accounting user time */
+ 	time_t	ac_stime;		/* Accounting system time */
+ 	time_t	ac_etime;		/* Accounting elapsed time */
+ 	time_t	ac_btime;		/* Beginning time */
+ 	uid_t	ac_uid;			/* Accounting user ID */
+ 	gid_t	ac_gid;			/* Accounting group ID */
+ 	dev_t	ac_tty;			/* controlling tty */
+ 	char	ac_flag;		/* Accounting flag */
+ 	long	ac_minflt;		/* Accounting minor pagefaults */
+ 	long	ac_majflt;		/* Accounting major pagefaults */
+ 	long	ac_exitcode;		/* Accounting process exitcode */
+ };
+ 
+ #define AFORK	0001	/* has executed fork, but no exec */
+ #define ASU	0002	/* used super-user privileges */
+ #define ACORE	0004	/* dumped core */
+ #define AXSIG	0010	/* killed by a signal */
+ 
+ #define AHZ     100
+ 
+ #endif
diff -rc --new-file linuxpl14/include/linux/kernel.h linux/include/linux/kernel.h
*** linuxpl14/include/linux/kernel.h	Mon Nov 29 22:40:36 1993
--- linux/include/linux/kernel.h	Wed Dec  8 09:53:41 1993
***************
*** 55,69 ****
  asmlinkage int printk(const char * fmt, ...)
  	__attribute__ ((format (printf, 1, 2)));
  
- /*
-  * This is defined as a macro, but at some point this might become a
-  * real subroutine that sets a flag if it returns true (to do
-  * BSD-style accounting where the process is flagged if it uses root
-  * privs).  The implication of this is that you should do normal
-  * permissions checks first, and check suser() last.
-  */
- #define suser() (current->euid == 0)
- 
  #endif /* __KERNEL__ */
  
  #define SI_LOAD_SHIFT	16
--- 55,60 ----
diff -rc --new-file linuxpl14/include/linux/sched.h linux/include/linux/sched.h
*** linuxpl14/include/linux/sched.h	Tue Nov 23 19:43:11 1993
--- linux/include/linux/sched.h	Wed Dec  8 09:53:41 1993
***************
*** 230,235 ****
--- 230,239 ----
  					/* Not implemented yet, only for 486*/
  #define PF_PTRACED	0x00000010	/* set if ptrace (0) has been called. */
  #define PF_TRACESYS	0x00000020	/* tracing system calls */
+ #define PF_FORKNOEXEC	0x00000040	/* forked but didn't exec */
+ #define PF_SUPERPREV	0x00000100	/* used super-user privileges */
+ #define PF_DUMPCORE	0x00000200	/* dumped core */
+ #define PF_SIGNALED	0x00000400	/* killed by a signal */
  
  /*
   * cloning flags:
***************
*** 385,390 ****
--- 389,407 ----
  #define set_base(ldt,base) _set_base( ((char *)&(ldt)) , base )
  #define set_limit(ldt,limit) _set_limit( ((char *)&(ldt)) , (limit-1)>>12 )
  
+ /*
+  * This has now become a routine instead of a macro, it sets a flag if
+  * it returns true (to do BSD-style accounting where the process is flagged
+  * if it uses root privs). The implication of this is that you should do
+  * normal permissions checks first, and check suser() last.
+  */
+ extern inline int suser(void)
+ {
+ 	if (current->euid == 0)
+ 		current->flags |= PF_SUPERPREV;
+ 	return (current->euid == 0);
+ }
+ 
  /*
   * The wait-queues are circular lists, and you have to be *very* sure
   * to keep them correct. Use only these two functions to add/remove
diff -rc --new-file linuxpl14/kernel/exit.c linux/kernel/exit.c
*** linuxpl14/kernel/exit.c	Mon Nov 29 22:40:36 1993
--- linux/kernel/exit.c	Wed Dec  8 09:53:42 1993
***************
*** 19,24 ****
--- 19,25 ----
  #include <asm/segment.h>
  extern void shm_exit (void);
  extern void sem_exit (void);
+ extern void acct_process (long exitcode);
  
  int getrusage(struct task_struct *, int, struct rusage *);
  
***************
*** 354,359 ****
--- 355,361 ----
  	int i;
  
  fake_volatile:
+ 	acct_process(code);
  	if (current->semun)
  		sem_exit();
  	if (current->shm)
diff -rc --new-file linuxpl14/kernel/fork.c linux/kernel/fork.c
*** linuxpl14/kernel/fork.c	Wed Oct 27 14:52:52 1993
--- linux/kernel/fork.c	Wed Dec  8 09:53:42 1993
***************
*** 136,142 ****
  	*p = *current;
  	p->kernel_stack_page = 0;
  	p->state = TASK_UNINTERRUPTIBLE;
! 	p->flags &= ~(PF_PTRACED|PF_TRACESYS);
  	p->pid = last_pid;
  	p->swappable = 1;
  	p->p_pptr = p->p_opptr = current;
--- 136,143 ----
  	*p = *current;
  	p->kernel_stack_page = 0;
  	p->state = TASK_UNINTERRUPTIBLE;
! 	p->flags &= ~(PF_PTRACED|PF_TRACESYS|PF_SUPERPREV);
! 	p->flags |= PF_FORKNOEXEC;
  	p->pid = last_pid;
  	p->swappable = 1;
  	p->p_pptr = p->p_opptr = current;
diff -rc --new-file linuxpl14/kernel/signal.c linux/kernel/signal.c
*** linuxpl14/kernel/signal.c	Sun Nov 14 17:31:31 1993
--- linux/kernel/signal.c	Wed Dec  8 09:53:42 1993
***************
*** 362,367 ****
--- 362,368 ----
  				/* fall through */
  			default:
  				current->signal |= _S(signr & 0x7f);
+ 				current->flags |= PF_SIGNALED;
  				do_exit(signr);
  			}
  		}
diff -rc --new-file linuxpl14/kernel/sys.c linux/kernel/sys.c
*** linuxpl14/kernel/sys.c	Tue Nov 23 19:43:12 1993
--- linux/kernel/sys.c	Wed Dec  8 09:53:42 1993
***************
*** 18,24 ****
  #include <linux/ptrace.h>
  #include <linux/stat.h>
  #include <linux/mman.h>
! 
  #include <asm/segment.h>
  #include <asm/io.h>
  
--- 18,27 ----
  #include <linux/ptrace.h>
  #include <linux/stat.h>
  #include <linux/mman.h>
! #include <linux/fcntl.h>
! #include <linux/acct.h>
! #include <sys/sysmacros.h>
!   
  #include <asm/segment.h>
  #include <asm/io.h>
  
***************
*** 291,300 ****
  		return -EPERM;
  	return 0;
  }
! 
! asmlinkage int sys_acct(void)
! {
! 	return -ENOSYS;
  }
  
  asmlinkage int sys_phys(void)
--- 294,405 ----
  		return -EPERM;
  	return 0;
  }
!   
! static char acct_active = 0;
! static struct file acct_file;
! 
! int acct_process(long exitcode)
! {
!    struct acct ac;
!    unsigned short fs;
! 
!    if (acct_active) {
!       strncpy(ac.ac_comm, current->comm, ACCT_COMM);
!       ac.ac_comm[ACCT_COMM] = '\0';
!       ac.ac_utime = current->utime;
!       ac.ac_stime = current->stime;
!       ac.ac_btime = CT_TO_SECS(current->start_time) + (xtime.tv_sec - (jiffies / HZ));
!       ac.ac_etime = CURRENT_TIME - ac.ac_btime;
!       ac.ac_uid   = current->uid;
!       ac.ac_gid   = current->gid;
!       ac.ac_tty   = makedev(4, current->tty);
!       ac.ac_flag  = 0;
!       if (current->flags & PF_FORKNOEXEC)
!          ac.ac_flag |= AFORK;
!       if (current->flags & PF_SUPERPREV)
!          ac.ac_flag |= ASU;
!       if (current->flags & PF_DUMPCORE)
!          ac.ac_flag |= ACORE;
!       if (current->flags & PF_SIGNALED)
!          ac.ac_flag |= AXSIG;
!       ac.ac_minflt = current->min_flt;
!       ac.ac_majflt = current->maj_flt;
!       ac.ac_exitcode = exitcode;
! 
!       /* Kernel segment override */
!       fs = get_fs();
!       set_fs(KERNEL_DS);
! 
!       acct_file.f_op->write(acct_file.f_inode, &acct_file,
!                              (char *)&ac, sizeof(struct acct));
! 
!       set_fs(fs);
!    }
!    return 0;
! }
! 
! asmlinkage int sys_acct(const char *name)
! {
!    struct inode *inode = (struct inode *)0;
!    char *tmp;
!    int error;
! 
!    if (!suser())
!       return -EPERM;
! 
!    if (name == (char *)0) {
!       if (acct_active) {
!          if (acct_file.f_op->release)
!             acct_file.f_op->release(acct_file.f_inode, &acct_file);
! 
!          if (acct_file.f_inode != (struct inode *) 0)
!             iput(acct_file.f_inode);
! 
!          acct_active = 0;
!       }
!       return 0;
!    } else {
!       if (!acct_active) {
! 
!          if ((error = getname(name, &tmp)) != 0)
!             return (error);
! 
!          error = open_namei(tmp, O_RDWR, 0600, &inode, 0);
!          putname(tmp);
! 
!          if (error)
!             return (error);
! 
!          if (!S_ISREG(inode->i_mode)) {
!             iput(inode);
!             return -EACCES;
!          }
! 
!          if (!inode->i_op || !inode->i_op->default_file_ops || 
!              !inode->i_op->default_file_ops->write) {
!             iput(inode);
!             return -EIO;
!          }
! 
!          acct_file.f_mode = 3;
!          acct_file.f_flags = 0;
!          acct_file.f_count = 1;
!          acct_file.f_inode = inode;
!          acct_file.f_pos = inode->i_size;
!          acct_file.f_reada = 0;
!          acct_file.f_op = inode->i_op->default_file_ops;
! 
!          if (acct_file.f_op->open)
!             if (acct_file.f_op->open(acct_file.f_inode, &acct_file)) {
!                iput(inode);
!                return -EIO;
!             }
! 
!          acct_active = 1;
!          return 0;
!       } else
!          return -EBUSY;
!    }
  }
  
  asmlinkage int sys_phys(void)
