Subject: chflags - immutable|appendonly files come to 2BSD (#202 - Part 6 of 14)
Index:	bin,etc,lib,sys/many_files 2.11BSD

Description:
	Files/directories can not be declared append-only, immutable, archived 
	or not to be dumped under 2.11BSD.

	dump(8) lacked the ability to bypass files marked for 'nodump'.

	Upper case only and Hazeltine terminal support made the tty driver 
	(and several utilities - 'vi' and 'getty' to name two) needlessly
	complicated and larger (especially since those devices are obsolete).

	open(2) can not provide for atomically obtaining a flock(2)'d
	file descriptor.

	open(2)ing with O_NDELAY (now called O_NONBLOCK) would not wait
	for carrier on the first i/o operation.

	Obsolete stub system calls 'setdopt' and 'getdopt' were still
	present in the kernel even though they have never done anything
	except take up space.

Repeat-By:
	This section does not apply this time since this is an 'update'
	which adds new functionality rather than fixing an existing bug.

Fix:
	Refer to part 1 (#197) for the complete description and installation
	instructions.

	This is part 6 of 14 (#202).

	Files affected by this part are:

/usr/include/curses.h
/usr/include/fcntl.h
/usr/include/syscall.h
/usr/src/sys/h/errno.h
/usr/src/sys/h/file.h
/usr/src/sys/h/fs.h
/usr/src/sys/h/inode.h
/usr/src/sys/h/ioctl.h
/usr/src/sys/h/mount.h
/usr/src/sys/h/stat.h
/usr/src/sys/h/tty.h
/usr/src/sys/h/types.h
/usr/src/sys/h/uio.h

=====================cut  here========================
*** /usr/include/curses.h.old	Sun Dec 14 17:11:07 1986
--- /usr/include/curses.h	Fri Dec  9 21:55:16 1994
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)curses.h	5.1 (Berkeley) 6/7/85
   */
  
  # ifndef WINDOW
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)curses.h	5.1.1 (2.11BSD GTE) 12/9/94
   */
  
  # ifndef WINDOW
***************
*** 52,58 ****
   * From the tty modes...
   */
  
! extern bool	GT, NONL, UPPERCASE, normtty, _pfast;
  
  struct _win_st {
  	short		_cury, _curx;
--- 52,58 ----
   * From the tty modes...
   */
  
! extern bool	GT, NONL, normtty, _pfast;
  
  struct _win_st {
  	short		_cury, _curx;
*** /usr/include/fcntl.h.old	Sun Dec 14 17:11:18 1986
--- /usr/include/fcntl.h	Tue Nov 29 19:30:46 1994
***************
*** 1,40 ****
! /*
!  * Copyright (c) 1983 Regents of the University of California.
!  * All rights reserved.  The Berkeley software License Agreement
!  * specifies the terms and conditions for redistribution.
   *
!  *	@(#)fcntl.h	5.2 (Berkeley) 1/8/86
   */
  
  /*
!  * Flag values accessible to open(2) and fcntl(2)-- copied from
!  * <sys/file.h>.  (The first three can only be set by open.)
   */
- #define	O_RDONLY	000		/* open for reading */
- #define	O_WRONLY	001		/* open for writing */
- #define	O_RDWR		002		/* open for read & write */
- #define	O_NDELAY	FNDELAY		/* non-blocking open */
- 					/* really non-blocking I/O for fcntl */
- #define	O_APPEND	FAPPEND		/* append on each write */
- #define	O_CREAT		FCREAT		/* open with file create */
- #define	O_TRUNC		FTRUNC		/* open with truncation */
- #define	O_EXCL		FEXCL		/* error on create if file exists */
  
! #ifndef	F_DUPFD
! /* fcntl(2) requests */
! #define	F_DUPFD	0	/* Duplicate fildes */
! #define	F_GETFD	1	/* Get fildes flags */
! #define	F_SETFD	2	/* Set fildes flags */
! #define	F_GETFL	3	/* Get file flags */
! #define	F_SETFL	4	/* Set file flags */
! #define	F_GETOWN 5	/* Get owner */
! #define F_SETOWN 6	/* Set owner */
  
! /* flags for F_GETFL, F_SETFL-- copied from <sys/file.h> */
! #define	FNDELAY		00004		/* non-blocking reads */
! #define	FAPPEND		00010		/* append on each write */
! #define	FASYNC		00100		/* signal pgrp when data ready */
! #define	FCREAT		01000		/* create if nonexistant */
! #define	FTRUNC		02000		/* truncate to zero length */
! #define	FEXCL		04000		/* error if already created */
  #endif
--- 1,148 ----
! /*-
!  * Copyright (c) 1983, 1990, 1993
!  *	The Regents of the University of California.  All rights reserved.
!  * (c) UNIX System Laboratories, Inc.
!  * All or some portions of this file are derived from material licensed
!  * to the University of California by American Telephone and Telegraph
!  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
!  * the permission of UNIX System Laboratories, Inc.
   *
!  * Redistribution and use in source and binary forms, with or without
!  * modification, are permitted provided that the following conditions
!  * are met:
!  * 1. Redistributions of source code must retain the above copyright
!  *    notice, this list of conditions and the following disclaimer.
!  * 2. Redistributions in binary form must reproduce the above copyright
!  *    notice, this list of conditions and the following disclaimer in the
!  *    documentation and/or other materials provided with the distribution.
!  * 3. All advertising materials mentioning features or use of this software
!  *    must display the following acknowledgement:
!  *	This product includes software developed by the University of
!  *	California, Berkeley and its contributors.
!  * 4. Neither the name of the University nor the names of its contributors
!  *    may be used to endorse or promote products derived from this software
!  *    without specific prior written permission.
!  *
!  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
!  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
!  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
!  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
!  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
!  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
!  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
!  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
!  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
!  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
!  * SUCH DAMAGE.
!  *
!  *	@(#)fcntl.h	8.3.1 (2.11BSD GTE) 11/25/94
!  *
!  * Copied from 4.4-Lite and modified for 2.11BSD.  The modifications consisted
!  * of removing: function prototypes (I don't like them, the compiler does not
!  * support them, and it would mean dragging in cdefs.h to leave them in here),
!  * #ifndef _POSIX_SOURCE lines (silly) and record locking related definitions 
!  * If anyone adds any of the above it will be easy enough to modify this file.
!  * In the meantime why bog down (or blow up) cpp any further?
   */
  
+ #ifndef _FCNTL_H_
+ #define	_FCNTL_H_
+ 
  /*
!  * This file includes the definitions for open and fcntl
!  * described by POSIX for <fcntl.h>; it also includes
!  * related kernel definitions.
   */
  
! #ifndef KERNEL
! #include <sys/types.h>
! #endif
  
! /*
!  * File status flags: these are used by open(2), fcntl(2).
!  * They are also used (indirectly) in the kernel file structure f_flags,
!  * which is a superset of the open/fcntl flags.  Open flags and f_flags
!  * are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags).
!  * Open/fcntl flags begin with O_; kernel-internal flags begin with F.
!  */
! /* open-only flags */
! #define	O_RDONLY	0x0000		/* open for reading only */
! #define	O_WRONLY	0x0001		/* open for writing only */
! #define	O_RDWR		0x0002		/* open for reading and writing */
! #define	O_ACCMODE	0x0003		/* mask for above modes */
! 
! /*
!  * Kernel encoding of open mode; separate read and write bits that are
!  * independently testable: 1 greater than the above.
!  *
!  * XXX
!  * FREAD and FWRITE are excluded from the #ifdef KERNEL so that TIOCFLUSH,
!  * which was documented to use FREAD/FWRITE, continues to work.
!  */
! #define	FREAD		0x0001
! #define	FWRITE		0x0002
! #define	O_NONBLOCK	0x0004		/* no delay */
! #define	O_APPEND	0x0008		/* set append mode */
! #define	O_SHLOCK	0x0010		/* open with shared file lock */
! #define	O_EXLOCK	0x0020		/* open with exclusive file lock */
! #define	O_ASYNC		0x0040		/* signal pgrp when data ready */
! #define	O_FSYNC		0x0080		/* synchronous writes */
! #define	O_CREAT		0x0200		/* create if nonexistant */
! #define	O_TRUNC		0x0400		/* truncate to zero length */
! #define	O_EXCL		0x0800		/* error if already exists */
! #ifdef KERNEL
! #define	FMARK		0x1000		/* mark during gc() */
! #define	FDEFER		0x2000		/* defer for next gc pass */
  #endif
+ 
+ /* defined by POSIX 1003.1; not 2.11BSD default, so bit is required */
+ /* Not currently implemented but it may be placed on the TODO list shortly */
+ #define	O_NOCTTY	0x4000		/* don't assign controlling terminal */
+ 
+ #ifdef KERNEL
+ /* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */
+ #define	FFLAGS(oflags)	((oflags) + 1)
+ #define	OFLAGS(fflags)	((fflags) - 1)
+ 
+ /* bits to save after open */
+ #define	FMASK		(FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK)
+ /* bits settable by fcntl(F_SETFL, ...) */
+ #define	FCNTLFLAGS	(FAPPEND|FASYNC|FFSYNC|FNONBLOCK)
+ #endif
+ 
+ /*
+  * The O_* flags used to have only F* names, which were used in the kernel
+  * and by fcntl.  We retain the F* names for the kernel f_flags field
+  * and for backward compatibility for fcntl.
+  */
+ #define	FAPPEND		O_APPEND	/* kernel/compat */
+ #define	FASYNC		O_ASYNC		/* kernel/compat */
+ #define	FFSYNC		O_FSYNC		/* kernel */
+ #define	FEXLOCK		O_EXLOCK	/* kernel */
+ #define	FSHLOCK		O_SHLOCK	/* kernel */
+ #define	FNONBLOCK	O_NONBLOCK	/* kernel */
+ #define	FNDELAY		O_NONBLOCK	/* compat */
+ #define	O_NDELAY	O_NONBLOCK	/* compat */
+ 
+ /*
+  * Constants used for fcntl(2)
+  */
+ 
+ /* command values */
+ #define	F_DUPFD		0		/* duplicate file descriptor */
+ #define	F_GETFD		1		/* get file descriptor flags */
+ #define	F_SETFD		2		/* set file descriptor flags */
+ #define	F_GETFL		3		/* get file status flags */
+ #define	F_SETFL		4		/* set file status flags */
+ #define	F_GETOWN	5		/* get SIGIO/SIGURG proc/pgrp */
+ #define F_SETOWN	6		/* set SIGIO/SIGURG proc/pgrp */
+ 
+ /* file descriptor flags (F_GETFD, F_SETFD) */
+ #define	FD_CLOEXEC	1		/* close-on-exec flag */
+ 
+ /* lock operations for flock(2) */
+ #define	LOCK_SH		0x01		/* shared file lock */
+ #define	LOCK_EX		0x02		/* exclusive file lock */
+ #define	LOCK_NB		0x04		/* don't block when locking */
+ #define	LOCK_UN		0x08		/* unlock file */
+ #endif /* !_FCNTL_H_ */
*** /usr/include/syscall.h.old	Thu Apr 21 21:08:59 1994
--- /usr/include/syscall.h	Fri Nov 25 22:23:07 1994
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)syscall.h	5.4.2 (2.11BSD GTE) 4/21/94
   */
  
  #define	SYS_exit	1
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)syscall.h	5.4.3 (2.11BSD GTE) 11/25/94
   */
  
  #define	SYS_exit	1
***************
*** 22,29 ****
  #define	SYS_mknod	14
  #define	SYS_chmod	15
  #define	SYS_chown	16
! 				/* 17 is old: sbreak */
! 				/* 18 is old: stat */
  #define	SYS_lseek	19
  #define	SYS_getpid	20
  #define	SYS_mount	21
--- 22,29 ----
  #define	SYS_mknod	14
  #define	SYS_chmod	15
  #define	SYS_chown	16
! #define	SYS_chflags	17
! #define	SYS_fchflags	18
  #define	SYS_lseek	19
  #define	SYS_getpid	20
  #define	SYS_mount	21
***************
*** 70,89 ****
  #define	SYS_fstat	62
  				/* 63 is unused */
  #define	SYS_getpagesize 64
! #define	SYS_mremap	65
  #define	SYS_vfork	66
  				/* 67 is old: vread */
  				/* 68 is old: vwrite */
  #define	SYS_sbrk	69
  #define	SYS_sstk	70
! #define	SYS_mmap	71
! 				/* 72 is old: vadvise */
! #define	SYS_munmap	73
! #define	SYS_mprotect	74
! #define	SYS_madvise	75
  #define	SYS_vhangup	76
  				/* 77 is old: vlimit */
! #define	SYS_mincore	78
  #define	SYS_getgroups	79
  #define	SYS_setgroups	80
  #define	SYS_getpgrp	81
--- 70,89 ----
  #define	SYS_fstat	62
  				/* 63 is unused */
  #define	SYS_getpagesize 64
! 				/* 65 is unused 4.3: mremap */
  #define	SYS_vfork	66
  				/* 67 is old: vread */
  				/* 68 is old: vwrite */
  #define	SYS_sbrk	69
  #define	SYS_sstk	70
! 				/* 71 is unused 4.3: mmap */
! 				/* 72 is unused 4.3: vadvise */
! 				/* 73 is unused 4.3: munmap */
! 				/* 74 is unused 4.3: mprotect */
! 				/* 75 is unused 4.3: madvise */
  #define	SYS_vhangup	76
  				/* 77 is old: vlimit */
! 				/* 78 is unused 4.3: mincore */
  #define	SYS_getgroups	79
  #define	SYS_setgroups	80
  #define	SYS_getpgrp	81
***************
*** 96,105 ****
  #define	SYS_sethostname	88
  #define	SYS_getdtablesize 89
  #define	SYS_dup2	90
! #define	SYS_getdopt	91
  #define	SYS_fcntl	92
  #define	SYS_select	93
! #define	SYS_setdopt	94
  #define	SYS_fsync	95
  #define	SYS_setpriority	96
  #define	SYS_socket	97
--- 96,105 ----
  #define	SYS_sethostname	88
  #define	SYS_getdtablesize 89
  #define	SYS_dup2	90
! 				/* 91 is unused 4.3: getdopt */
  #define	SYS_fcntl	92
  #define	SYS_select	93
! 				/* 94 is unused 4.3: setdopt */
  #define	SYS_fsync	95
  #define	SYS_setpriority	96
  #define	SYS_socket	97
*** /usr/src/sys/h/errno.h.old	Sat May 16 11:29:22 1987
--- /usr/src/sys/h/errno.h	Sat Nov 26 21:25:30 1994
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)errno.h	7.1 (Berkeley) 6/4/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)errno.h	7.1.1 (2.11BSD GTE) 11/26/94
   */
  
  /*
***************
*** 96,98 ****
--- 96,115 ----
  #define	EPROCLIM	67		/* Too many processes */
  #define	EUSERS		68		/* Too many users */
  #define	EDQUOT		69		/* Disc quota exceeded */
+ 
+ /* Network File System */
+ #define	ESTALE		70		/* Stale NFS file handle */
+ #define	EREMOTE		71		/* Too many levels of remote in path */
+ #define	EBADRPC		72		/* RPC struct is bad */
+ #define	ERPCMISMATCH	73		/* RPC version wrong */
+ #define	EPROGUNAVAIL	74		/* RPC prog. not avail */
+ #define	EPROGMISMATCH	75		/* Program version wrong */
+ #define	EPROCUNAVAIL	76		/* Bad procedure for program */
+ 
+ #define	ENOLCK		77		/* No locks available */
+ #define	ENOSYS		78		/* Function not implemented */
+ 
+ #define	EFTYPE		79		/* Inappropriate file type or format */
+ #define	EAUTH		80		/* Authentication error */
+ #define	ENEEDAUTH	81		/* Need authenticator */
+ #define	ELAST		81		/* Must be equal largest errno */
*** /usr/src/sys/h/file.h.old	Sat Oct 26 13:33:49 1991
--- /usr/src/sys/h/file.h	Fri Nov 25 22:34:53 1994
***************
*** 3,11 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)file.h	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  #ifdef KERNEL
  /*
   * Descriptor table entry.
--- 3,13 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)file.h	1.2 (2.11BSD GTE) 11/25/94
   */
  
+ #include <fcntl.h>
+ 
  #ifdef KERNEL
  /*
   * Descriptor table entry.
***************
*** 41,108 ****
  struct	file *getf();
  struct	file *falloc();
  #endif
- 
- /*
-  * flags- also for fcntl call.
-  */
- #define	FOPEN		(-1)
- #define	FREAD		00001		/* descriptor read/receive'able */
- #define	FWRITE		00002		/* descriptor write/send'able */
- #ifndef	F_DUPFD
- #define	FNDELAY		00004		/* no delay */
- #define	FAPPEND		00010		/* append on each write */
- #endif
- #define	FMARK		00020		/* mark during gc() */
- #define	FDEFER		00040		/* defer for next gc pass */
- #ifndef	F_DUPFD
- #define	FASYNC		00100		/* signal pgrp when data ready */
- #endif
- #define	FSHLOCK		00200		/* shared lock present */
- #define	FEXLOCK		00400		/* exclusive lock present */
- 
- /* bits to save after open */
- #define	FMASK		00113
- #define	FCNTLCANT	(FREAD|FWRITE|FMARK|FDEFER|FSHLOCK|FEXLOCK)
- 
- /* open only modes */
- #define	FCREAT		01000		/* create if nonexistant */
- #define	FTRUNC		02000		/* truncate to zero length */
- #define	FEXCL		04000		/* error if already created */
- 
- #ifndef	F_DUPFD
- /* fcntl(2) requests--from <fcntl.h> */
- #define	F_DUPFD	0	/* Duplicate fildes */
- #define	F_GETFD	1	/* Get fildes flags */
- #define	F_SETFD	2	/* Set fildes flags */
- #define	F_GETFL	3	/* Get file flags */
- #define	F_SETFL	4	/* Set file flags */
- #define	F_GETOWN 5	/* Get owner */
- #define F_SETOWN 6	/* Set owner */
- #endif
- 
- /*
-  * User definitions.
-  */
- 
- /*
-  * Open call.
-  */
- #define	O_RDONLY	000		/* open for reading */
- #define	O_WRONLY	001		/* open for writing */
- #define	O_RDWR		002		/* open for read & write */
- #define	O_NDELAY	FNDELAY		/* non-blocking open */
- #define	O_APPEND	FAPPEND		/* append on each write */
- #define	O_CREAT		FCREAT		/* open with file create */
- #define	O_TRUNC		FTRUNC		/* open with truncation */
- #define	O_EXCL		FEXCL		/* error on create if file exists */
- 
- /*
-  * Flock call.
-  */
- #define	LOCK_SH		1	/* shared lock */
- #define	LOCK_EX		2	/* exclusive lock */
- #define	LOCK_NB		4	/* don't block when locking */
- #define	LOCK_UN		8	/* unlock */
  
  /*
   * Access call.
--- 43,48 ----
*** /usr/src/sys/h/fs.h.old	Fri Sep  2 20:25:31 1988
--- /usr/src/sys/h/fs.h	Sat Nov 26 14:58:48 1994
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)fs.h	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)fs.h	1.2 (2.11BSD GTE) 11/26/94
   */
  
  /*
***************
*** 58,63 ****
--- 58,64 ----
  	char	fs_fsmnt[MAXMNTLEN];	/* ordinary file mounted on */
  	ino_t	fs_lasti;		/* start place for circular search */
  	ino_t	fs_nbehind;		/* est # free inodes before s_lasti */
+ 	u_short	fs_flags;		/* mount time flags */
  /* actually longer */
  };
  
*** /usr/src/sys/h/inode.h.old	Sat Jun  2 16:19:44 1990
--- /usr/src/sys/h/inode.h	Fri Nov 25 23:26:41 1994
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)inode.h	1.2 (2.10BSD Berkeley) 1/26/90
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)inode.h	1.3 (2.11BSD GTE) 11/25/94
   */
  
  /*
***************
*** 78,83 ****
--- 78,89 ----
  		gid_t	ic_gid;		/* owner's group id */
  		off_t	ic_size;	/* number of bytes in file */
  	} i_ic1;
+ /*
+  * Can't afford another 4 bytes and mapping the flags out would be prohibitively
+  * expensive.  So, a 'u_short' is used for the flags - see the comments in
+  * stat.h for more information.
+ */
+ 	u_short	i_flags;		/* user changeable flags */ 
  #ifndef EXTERNALITIMES
  	struct icommon2 i_ic2;
  #endif
***************
*** 90,96 ****
  struct dinode {
  	struct	icommon1 di_icom1;
  	daddr_t	di_addr[7];		/* 7 block addresses 4 bytes each */
! 	daddr_t	di_reserved[3];		/* pad of 12 to make total size 64 */
  	struct	icommon2 di_icom2;
  };
  
--- 96,103 ----
  struct dinode {
  	struct	icommon1 di_icom1;
  	daddr_t	di_addr[7];		/* 7 block addresses 4 bytes each */
! 	u_short	di_reserved[5];		/* pad of 10 to make total size 64 */
! 	u_short	di_flags;
  	struct	icommon2 di_icom2;
  };
  
***************
*** 167,173 ****
  struct	inode *namei();
  #endif
  
! /* flags */
  #define	ILOCKED		0x1		/* inode is locked */
  #define	IUPD		0x2		/* file has been modified */
  #define	IACC		0x4		/* inode access time to be updated */
--- 174,180 ----
  struct	inode *namei();
  #endif
  
! /* i_flag */
  #define	ILOCKED		0x1		/* inode is locked */
  #define	IUPD		0x2		/* file has been modified */
  #define	IACC		0x4		/* inode access time to be updated */
***************
*** 185,191 ****
  #define	IWCOLL		0x4000		/* write select collision on pipe */
  #define	IXMOD		0x8000		/* inode is text, but impure (XXX) */
  
! /* modes */
  #define	IFMT		0170000		/* type of file */
  #define	IFCHR		0020000		/* character special */
  #define	IFDIR		0040000		/* directory */
--- 192,198 ----
  #define	IWCOLL		0x4000		/* write select collision on pipe */
  #define	IXMOD		0x8000		/* inode is text, but impure (XXX) */
  
! /* i_mode */
  #define	IFMT		0170000		/* type of file */
  #define	IFCHR		0020000		/* character special */
  #define	IFDIR		0040000		/* directory */
***************
*** 199,204 ****
--- 206,265 ----
  #define	IREAD		0400		/* read, write, execute permissions */
  #define	IWRITE		0200
  #define	IEXEC		0100
+ 
+ #if	defined(KERNEL) && !defined(SUPERVISOR)
+ /*
+  * Flags for va_cflags.
+  */
+ #define	VA_UTIMES_NULL	0x01		/* utimes argument was NULL */
+ 
+ /*
+  * Flags for ioflag.
+  */
+ #define	IO_UNIT		0x01		/* do I/O as atomic unit */
+ #define	IO_APPEND	0x02		/* append write to end */
+ #define	IO_SYNC		0x04		/* do I/O synchronously */
+ /* #define	IO_NODELOCKED	0x08		/* not implemented */
+ #define	IO_NDELAY	0x10		/* FNDELAY flag set in file table */
+ 
+ /*
+  * Token indicating no attribute value yet assigned.
+  */
+ #define	VNOVAL	(-1)
+ 
+ #define	VATTR_NULL(vp) (vattr_null(vp))
+ 
+ /*
+  * This is a bit of a misnomer.  2.11BSD does not have 'vnodes' but it was
+  * easier/simpler to keep the name 'vattr' than changing the name to something
+  * like 'iattr'.
+  *
+  * This structure is a _subset_ of 4.4BSD's vnode attribute structure.  ONLY
+  * those attributes which can be *changed by the user* are present.  Since we
+  * do not have vnodes why initialize (and carry around) un-used members.
+  *
+  * NOTE: For reasons of speed the function 'vattr_null()' was written in
+  * very compact assembly code and placed in pdp/mch_xxx.s.  If you change
+  * the 'vattr' structure be sure and change vattr_null in pdp/mch_xxx.s!
+ */
+ 
+ 	struct	vattr
+ 		{
+ 		mode_t	va_mode;
+ 		uid_t	va_uid;
+ 		gid_t	va_gid;
+ 		off_t	va_size;
+ 		time_t	va_atime;
+ 		time_t	va_mtime;
+ 		u_short	va_flags;
+ 		u_short	va_vaflags;
+ 		};
+ 
+ /*
+  * N.B:  If the above structure changes be sure to modify the function
+  * vattr_null in pdp/mch_xxx.s!
+ */
+ #endif
  
  #ifndef SUPERVISOR
  #define	ILOCK(ip) { \
*** /usr/src/sys/h/ioctl.h.old	Mon Aug 31 14:48:45 1987
--- /usr/src/sys/h/ioctl.h	Thu Dec 15 20:15:56 1994
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)ioctl.h	1.1 (2.10BSD Berkeley) 12/1/86
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)ioctl.h	1.2 (2.11BSD GTE) 12/9/94
   */
  
  /*
***************
*** 136,142 ****
  #define	TIOCGETC	_IOR(t,18,struct tchars)/* get special characters */
  #define		TANDEM		0x00000001	/* send stopc on out q full */
  #define		CBREAK		0x00000002	/* half-cooked mode */
! #define		LCASE		0x00000004	/* simulate lower case */
  #define		ECHO		0x00000008	/* echo input */
  #define		CRMOD		0x00000010	/* map \r to \r\n on output */
  #define		RAW		0x00000020	/* no i/o processing */
--- 136,142 ----
  #define	TIOCGETC	_IOR(t,18,struct tchars)/* get special characters */
  #define		TANDEM		0x00000001	/* send stopc on out q full */
  #define		CBREAK		0x00000002	/* half-cooked mode */
! #define		LCASE		0x00000004	/* (obsolete) - place holder */
  #define		ECHO		0x00000008	/* echo input */
  #define		CRMOD		0x00000010	/* map \r to \r\n on output */
  #define		RAW		0x00000020	/* no i/o processing */
***************
*** 168,174 ****
  #define		CRTBS		0x00010000	/* do backspacing for crt */
  #define		PRTERA		0x00020000	/* \ ... / erase */
  #define		CRTERA		0x00040000	/* " \b " to wipe out char */
! #define		TILDE		0x00080000	/* hazeltine tilde kludge */
  #define		MDMBUF		0x00100000	/* start/stop output on carrier intr */
  #define		LITOUT		0x00200000	/* literal output */
  #define		TOSTOP		0x00400000	/* SIGSTOP on background output */
--- 168,174 ----
  #define		CRTBS		0x00010000	/* do backspacing for crt */
  #define		PRTERA		0x00020000	/* \ ... / erase */
  #define		CRTERA		0x00040000	/* " \b " to wipe out char */
! #define		TILDE		0x00080000	/* (obsolete) place holder */
  #define		MDMBUF		0x00100000	/* start/stop output on carrier intr */
  #define		LITOUT		0x00200000	/* literal output */
  #define		TOSTOP		0x00400000	/* SIGSTOP on background output */
***************
*** 189,195 ****
  #define		LCRTBS		((int)(CRTBS>>16))
  #define		LPRTERA		((int)(PRTERA>>16))
  #define		LCRTERA		((int)(CRTERA>>16))
! #define		LTILDE		((int)(TILDE>>16))
  #define		LMDMBUF		((int)(MDMBUF>>16))
  #define		LLITOUT		((int)(LITOUT>>16))
  #define		LTOSTOP		((int)(TOSTOP>>16))
--- 189,195 ----
  #define		LCRTBS		((int)(CRTBS>>16))
  #define		LPRTERA		((int)(PRTERA>>16))
  #define		LCRTERA		((int)(CRTERA>>16))
! #define		LTILDE		((int)TILDE>>16)) /* (obsolete) place holder */
  #define		LMDMBUF		((int)(MDMBUF>>16))
  #define		LLITOUT		((int)(LITOUT>>16))
  #define		LTOSTOP		((int)(TOSTOP>>16))
*** /usr/src/sys/h/mount.h.old	Mon Jul  4 12:08:02 1988
--- /usr/src/sys/h/mount.h	Sat Nov 26 14:57:36 1994
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)mount.h	7.2 (Berkeley) 6/21/87
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)mount.h	7.2.1 (2.11BSD GTE) 11/26/94
   */
  
  /*
***************
*** 15,23 ****
--- 15,34 ----
  {
  	dev_t	m_dev;		/* device mounted */
  	struct	fs m_filsys;	/* superblock data */
+ #define	m_flags	(m_filsys.fs_flags)
  	struct	inode *m_inodp;	/* pointer to mounted on inode */
  	struct	inode *m_qinod; /* QUOTA: pointer to quota file */
  };
+ 
+ /*
+  * Mount flags.
+  */
+ #define	MNT_RDONLY	0x00000001	/* read only filesystem */
+ #define	MNT_SYNCHRONOUS	0x00000002	/* file system written synchronously */
+ #define	MNT_NOEXEC	0x00000004	/* can't exec from filesystem */
+ #define	MNT_NOSUID	0x00000008	/* don't honor setuid bits on fs */
+ #define	MNT_NODEV	0x00000010	/* don't interpret special files */
+ 
  #if defined(KERNEL) && !defined(SUPERVISOR)
  struct	mount mount[NMOUNT];
  #endif
*** /usr/src/sys/h/stat.h.old	Mon Jan 10 21:31:30 1994
--- /usr/src/sys/h/stat.h	Mon Nov 28 19:39:43 1994
***************
*** 3,11 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)stat.h	7.1.1 (2.11BSD GTE) 12/31/93
   */
  
  struct	stat
  {
  	dev_t	st_dev;
--- 3,14 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)stat.h	7.1.2 (2.11BSD GTE) 11/25/94
   */
  
+ #ifndef	_STAT_H_
+ #define	_STAT_H_
+ 
  struct	stat
  {
  	dev_t	st_dev;
***************
*** 24,30 ****
  	int	st_spare3;
  	long	st_blksize;
  	long	st_blocks;
! 	long	st_spare4[2];
  };
  
  #define	S_IFMT	0170000		/* type of file */
--- 27,34 ----
  	int	st_spare3;
  	long	st_blksize;
  	long	st_blocks;
! 	u_short	st_flags;
! 	u_short	st_spare4[3];
  };
  
  #define	S_IFMT	0170000		/* type of file */
***************
*** 40,42 ****
--- 44,76 ----
  #define	S_IREAD	0000400		/* read permission, owner */
  #define	S_IWRITE 0000200	/* write permission, owner */
  #define	S_IEXEC	0000100		/* execute/search permission, owner */
+ 
+ /*
+  * Definitions of flags stored in file flags word.  Different from 4.4 because
+  * 2.11BSD only could afford a u_short for the flags.  It is not a great
+  * inconvenience since there are still 5 bits in each byte available for
+  * future use.
+  *
+  * Super-user and owner changeable flags.
+  */
+ #define	UF_SETTABLE	0x00ff		/* mask of owner changeable flags */
+ #define	UF_NODUMP	0x0001		/* do not dump file */
+ #define	UF_IMMUTABLE	0x0002		/* file may not be changed */
+ #define	UF_APPEND	0x0004		/* writes to file may only append */
+ /*
+  * Super-user changeable flags.
+  */
+ #define	SF_SETTABLE	0xff00		/* mask of superuser changeable flags */
+ #define	SF_ARCHIVED	0x0100		/* file is archived */
+ #define	SF_IMMUTABLE	0x0200		/* file may not be changed */
+ #define	SF_APPEND	0x0400		/* writes to file may only append */
+ 
+ #ifdef KERNEL
+ /*
+  * Shorthand abbreviations of above.
+  */
+ #define	APPEND		(UF_APPEND | SF_APPEND)
+ #define	IMMUTABLE	(UF_IMMUTABLE | SF_IMMUTABLE)
+ #endif
+ 
+ #endif /* !_STAT_H_ */
*** /usr/src/sys/h/tty.h.old	Fri Apr 29 21:33:54 1988
--- /usr/src/sys/h/tty.h	Wed Dec  7 21:01:06 1994
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)tty.h	7.1 (Berkeley) 6/4/86
   */
  
  #ifdef KERNEL
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)tty.h	7.1.1 (2.11BSD GTE) 12/7/94
   */
  
  #ifdef KERNEL
***************
*** 115,121 ****
  #define	TS_TBLOCK	0x000400L	/* tandem queue blocked */
  #define	TS_RCOLL	0x000800L	/* collision in read select */
  #define	TS_WCOLL	0x001000L	/* collision in write select */
- #define	TS_NBIO		0x002000L	/* tty in non-blocking mode */
  #define	TS_ASYNC	0x004000L	/* tty in async i/o mode */
  /* state for intra-line fancy editing work */
  #define	TS_BKSL		0x010000L	/* state for lowercase \ work */
--- 115,120 ----
*** /usr/src/sys/h/types.h.old	Sat Jun  5 22:50:14 1993
--- /usr/src/sys/h/types.h	Sat Nov 26 23:09:38 1994
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)types.h	1.2 (2.11BSD Berkeley) 9/23/91
   */
  
  #ifndef _TYPES_
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)types.h	1.3 (2.11BSD Berkeley) 11/26/94
   */
  
  #ifndef _TYPES_
***************
*** 45,50 ****
--- 45,52 ----
  typedef	long	off_t;
  typedef	u_short	uid_t;
  typedef	u_short	gid_t;
+ typedef	int	pid_t;
+ typedef	u_short	mode_t;
  
  #define	NBBY	8		/* number of bits in a byte */
  /*
*** /usr/include/sys/uio.h.old	Thu Apr  5 21:34:00 1990
--- /usr/include/sys/uio.h	Tue Dec 20 12:46:09 1994
***************
*** 1,33 ****
  /*
!  * Copyright (c) 1982, 1986 Regents of the University of California.
!  * All rights reserved.  The Berkeley software License Agreement
!  * specifies the terms and conditions for redistribution.
   *
!  *	@(#)uio.h	7.1 (Berkeley) 6/4/86
   */
  
! #ifndef _UIO_
! #define	_UIO_
  
  struct iovec {
! 	caddr_t	iov_base;
! 	u_short	iov_len;
  };
  
  struct uio {
  	struct	iovec *uio_iov;
  	int	uio_iovcnt;
  	off_t	uio_offset;
- 	int	uio_segflg;
  	u_short	uio_resid;
  };
! 
! enum	uio_rw { UIO_READ, UIO_WRITE };
! 
! /*
!  * Segment flag values (should be enum).
!  */
! #define UIO_USERSPACE	0		/* from user data space */
! #define UIO_SYSSPACE	1		/* from system space */
! #define UIO_USERISPACE	2		/* from user I space */
! #endif
--- 1,69 ----
  /*
!  * Copyright (c) 1982, 1986, 1993, 1994
!  *	The Regents of the University of California.  All rights reserved.
   *
!  * Redistribution and use in source and binary forms, with or without
!  * modification, are permitted provided that the following conditions
!  * are met:
!  * 1. Redistributions of source code must retain the above copyright
!  *    notice, this list of conditions and the following disclaimer.
!  * 2. Redistributions in binary form must reproduce the above copyright
!  *    notice, this list of conditions and the following disclaimer in the
!  *    documentation and/or other materials provided with the distribution.
!  * 3. All advertising materials mentioning features or use of this software
!  *    must display the following acknowledgement:
!  *	This product includes software developed by the University of
!  *	California, Berkeley and its contributors.
!  * 4. Neither the name of the University nor the names of its contributors
!  *    may be used to endorse or promote products derived from this software
!  *    without specific prior written permission.
!  *
!  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
!  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
!  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
!  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
!  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
!  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
!  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
!  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
!  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
!  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
!  * SUCH DAMAGE.
!  *
!  *	@(#)uio.h	8.5.2 (2.11BSD GTE) 12/20/94
!  *
!  * Copied from 4.4-Lite and modified for 2.11BSD.  Modifications were removal
!  * of prototypes, limits for dynamic allocation of iovec structs and changing
!  * uio_resid to u_short from int.
   */
  
! #ifndef _SYS_UIO_H_
! #define	_SYS_UIO_H_
  
+ /*
+  * XXX
+  * iov_base should be a void *.
+  */
  struct iovec {
! 	char	*iov_base;	/* Base address. */
! 	size_t	 iov_len;	/* Length. */
  };
  
+ enum	uio_rw { UIO_READ, UIO_WRITE };
+ 
+ /* Segment flag values. */
+ enum uio_seg {
+ 	UIO_USERSPACE,		/* from user data space */
+ 	UIO_SYSSPACE,		/* from system space */
+ 	UIO_USERISPACE		/* from user I space */
+ };
+ 
  struct uio {
  	struct	iovec *uio_iov;
  	int	uio_iovcnt;
  	off_t	uio_offset;
  	u_short	uio_resid;
+ 	enum	uio_seg uio_segflg;
+ 	enum	uio_rw uio_rw;
  };
! #endif /* !_SYS_UIO_H_ */
