Subject: chflags - immutable|appendonly files come to 2BSD(#209 - Part 13 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 13 of 14 (#209).

	Files affected by this part are:

/usr/src/man/man1/ls.1
/usr/src/man/man2/Makefile
/usr/src/man/man2/fcntl.2
/usr/src/man/man2/open.2
/usr/src/man/man4/tty.4
/usr/src/man/man8/dump.8

=====================cut  here========================
*** /usr/src/man/man1/ls.1.old	Sun Dec 14 15:06:11 1986
--- /usr/src/man/man1/ls.1	Tue Dec 20 08:05:24 1994
***************
*** 2,10 ****
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)ls.1	6.4 (Berkeley) 5/12/86
  .\"
! .TH LS 1 "May 12, 1986"
  .UC
  .SH NAME
  ls \- list contents of directory
--- 2,10 ----
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)ls.1	6.4.1 (2.11BSD GTE) 12/12/94
  .\"
! .TH LS 1 "December 20, 1994"
  .UC
  .SH NAME
  ls \- list contents of directory
***************
*** 11,17 ****
  .SH SYNOPSIS
  .B ls
  [
! .B \-acdfgilqrstu1ACLFR
  ] name ...
  .br
  .SH DESCRIPTION
--- 11,17 ----
  .SH SYNOPSIS
  .B ls
  [
! .B \-acdfgiloqrstu1ACLFR
  ] name ...
  .br
  .SH DESCRIPTION
***************
*** 39,44 ****
--- 39,47 ----
  the major and minor device numbers.
  If the file is a symbolic link the pathname of
  the linked-to file is printed preceded by ``\->''.
+ .TP
+ .B \-o
+ Include the file flags in a long (\-l) output.
  .TP
  .B \-g
  Include the group ownership of the file in a long output.
*** /usr/src/man/man2/Makefile.old	Thu Apr 21 23:01:24 1994
--- /usr/src/man/man2/Makefile	Tue Dec 13 19:47:19 1994
***************
*** 14,24 ****
  # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  #
! #	@(#)Makefile	2.2 (2.11BSD GTE) 4/21/94
  #
  MDIR=	/usr/man/cat2
  SRCS=	accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 chmod.2 \
  	chown.2 chroot.2 close.2 connect.2 creat.2 dup.2 execve.2 exit.2 \
  	fcntl.2 fetchi.2 flock.2 fork.2 fperr.2 fsync.2 getdtablesize.2 \
  	getgid.2 getgroups.2 gethostid.2 gethostname.2 getitimer.2 \
  	getpagesize.2 getpeername.2 getpgrp.2 getpid.2 getpriority.2 \
--- 14,25 ----
  # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  #
! #	@(#)Makefile	2.3 (2.11BSD GTE) 12/12/94
  #
  MDIR=	/usr/man/cat2
  SRCS=	accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 chmod.2 \
  	chown.2 chroot.2 close.2 connect.2 creat.2 dup.2 execve.2 exit.2 \
+ 	chflags.2 \
  	fcntl.2 fetchi.2 flock.2 fork.2 fperr.2 fsync.2 getdtablesize.2 \
  	getgid.2 getgroups.2 gethostid.2 gethostname.2 getitimer.2 \
  	getpagesize.2 getpeername.2 getpgrp.2 getpid.2 getpriority.2 \
***************
*** 33,38 ****
--- 34,40 ----
  	umask.2 unlink.2 utimes.2 vfork.2 vhangup.2 wait.2 write.2
  OBJS=	accept.0 access.0 acct.0 adjtime.0 bind.0 brk.0 chdir.0 chmod.0 \
  	chown.0 chroot.0 close.0 connect.0 creat.0 dup.0 execve.0 exit.0 \
+ 	chflags.0 \
  	fcntl.0 fetchi.0 flock.0 fork.0 fperr.0 fsync.0 getdtablesize.0 \
  	getgid.0 getgroups.0 gethostid.0 gethostname.0 getitimer.0 \
  	getpagesize.0 getpeername.0 getpgrp.0 getpid.0 getpriority.0 \
***************
*** 86,91 ****
--- 88,95 ----
  	ln ${DESTDIR}${MDIR}/wait.0 ${DESTDIR}${MDIR}/waitpid.0
  	rm -f ${DESTDIR}${MDIR}/fchdir.0
  	ln ${DESTDIR}${MDIR}/chmod.0 ${DESTDIR}${MDIR}/fchdir.0
+ 	rm -f ${DESTDIR}${MDIR}/fchflags.0
+ 	ln ${DESTDIR}${MDIR}/chflags.0 ${DESTDIR}${MDIR}/fchflags.0
  	rm -f ${DESTDIR}${MDIR}/fchmod.0
  	ln ${DESTDIR}${MDIR}/chmod.0 ${DESTDIR}${MDIR}/fchmod.0
  	rm -f ${DESTDIR}${MDIR}/fchown.0
***************
*** 118,121 ****
  	ln ${DESTDIR}${MDIR}/gettimeofday.0 ${DESTDIR}${MDIR}/settimeofday.0
  
  FRC:
- 
--- 122,124 ----
*** /usr/src/man/man2/fcntl.2.old	Sun Dec 14 15:06:58 1986
--- /usr/src/man/man2/fcntl.2	Wed Nov 30 19:50:05 1994
***************
*** 2,10 ****
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)fcntl.2	6.4 (Berkeley) 5/22/86
  .\"
! .TH FCNTL 2 "May 22, 1986"
  .UC 5
  .SH NAME
  fcntl \- file control
--- 2,10 ----
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)fcntl.2	6.4.1 (2.11BSD GTE) 11/30/94
  .\"
! .TH FCNTL 2 "Nov 30, 1994"
  .UC 5
  .SH NAME
  fcntl \- file control
***************
*** 86,103 ****
  .LP
  The flags for the F_GETFL and F_SETFL flags are as follows:
  .TP 15
! FNDELAY
  Non-blocking I/O; if no data is available to a
  .I read
  call, or if a write operation would block,
  the call returns -1 with the error EWOULDBLOCK.
  .TP
! FAPPEND
  Force each write to append at the end of file;
  corresponds to the O_APPEND flag of
  .IR open (2).
  .TP
! FASYNC
  Enable the SIGIO signal to be sent to the process group
  when I/O is possible, e.g.,
  upon availability of data to be read.
--- 86,103 ----
  .LP
  The flags for the F_GETFL and F_SETFL flags are as follows:
  .TP 15
! O_NONBLOCK
  Non-blocking I/O; if no data is available to a
  .I read
  call, or if a write operation would block,
  the call returns -1 with the error EWOULDBLOCK.
  .TP
! O_APPEND
  Force each write to append at the end of file;
  corresponds to the O_APPEND flag of
  .IR open (2).
  .TP
! O_ASYNC
  Enable the SIGIO signal to be sent to the process group
  when I/O is possible, e.g.,
  upon availability of data to be read.
***************
*** 146,150 ****
  .SH "SEE ALSO
  close(2), execve(2), getdtablesize(2), open(2), sigvec(2)
  .SH BUGS
! The asynchronous I/O facilities of FNDELAY and FASYNC
  are currently available only for tty and socket operations.
--- 146,150 ----
  .SH "SEE ALSO
  close(2), execve(2), getdtablesize(2), open(2), sigvec(2)
  .SH BUGS
! The asynchronous I/O facilities of O_NONBLOCK and O_ASYNC
  are currently available only for tty and socket operations.
*** /usr/src/man/man2/open.2.old	Sun Dec 14 15:06:49 1986
--- /usr/src/man/man2/open.2	Thu Dec 15 19:46:40 1994
***************
*** 2,10 ****
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)open.2	6.4 (Berkeley) 5/14/86
  .\"
! .TH OPEN 2 "May 14, 1986"
  .UC 4
  .SH NAME
  open \- open a file for reading or writing, or create a new file
--- 2,10 ----
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)open.2	6.4.1 (2.11BSD GTE) 11/30/94
  .\"
! .TH OPEN 2 "Nov 30, 1994"
  .UC 4
  .SH NAME
  open \- open a file for reading or writing, or create a new file
***************
*** 11,17 ****
  .SH SYNOPSIS
  .nf
  .ft B
! #include <sys/file.h>
  .PP
  .ft B
  open(path, flags, mode)
--- 11,17 ----
  .SH SYNOPSIS
  .nf
  .ft B
! #include <fcntl.h>
  .PP
  .ft B
  open(path, flags, mode)
***************
*** 47,57 ****
   O_RDONLY	open for reading only
   O_WRONLY	open for writing only
   O_RDWR	open for reading and writing
!  O_NDELAY	do not block on open
   O_APPEND	append on each write
   O_CREAT	create file if it does not exist
   O_TRUNC	truncate size to 0
   O_EXCL	error if create and file exists
  .RE
  .PP
  Opening a file with O_APPEND set causes each write on the file
--- 47,60 ----
   O_RDONLY	open for reading only
   O_WRONLY	open for writing only
   O_RDWR	open for reading and writing
!  O_NONBLOCK	do not block on open
   O_APPEND	append on each write
   O_CREAT	create file if it does not exist
   O_TRUNC	truncate size to 0
   O_EXCL	error if create and file exists
+  O_NOCTTY	do not acquire as controlling terminal
+  O_SHLOCK	atomically obtain a shared lock
+  O_EXLOCK	atomically obtain an exclusive lock
  .RE
  .PP
  Opening a file with O_APPEND set causes each write on the file
***************
*** 63,73 ****
  If O_EXCL is set and the last component of the pathname is
  a symbolic link, the open will fail even if the symbolic
  link points to a non-existent name.
! If the O_NDELAY flag is specified and the open call would result
  in the process being blocked for some reason (e.g. waiting for
  carrier on a dialup line), the open returns immediately. 
  The first time the process attempts to perform i/o on the open
! file it will block (not currently implemented).
  .PP
  Upon successful completion a non-negative integer termed a
  file descriptor is returned.
--- 66,88 ----
  If O_EXCL is set and the last component of the pathname is
  a symbolic link, the open will fail even if the symbolic
  link points to a non-existent name.
! If the O_NONBLOCK flag is specified and the open call would result
  in the process being blocked for some reason (e.g. waiting for
  carrier on a dialup line), the open returns immediately. 
  The first time the process attempts to perform i/o on the open
! file it will block.
! .PP
! The flag O_NOCTTY indicates that even if the file is a terminal device,
! the call should not result in acquiring the terminal device as the 
! controlling terminal of the caller.  This flag is not the default and
! is currently unimplemented (it will be Real Soon Now).
! .PP
! When opening a file, a lock with 
! .IR flock(2)
! semantics can be obtained by
! setting O_SHLOCK for a shared lock, or O_EXLOCK for an exclusive lock.
! If creating a file with O_CREAT, the request for the lock will never
! fail.
  .PP
  Upon successful completion a non-negative integer termed a
  file descriptor is returned.
*** /usr/src/man/man4/tty.4.old	Sat Aug  1 11:12:47 1987
--- /usr/src/man/man4/tty.4	Fri Dec  9 20:22:11 1994
***************
*** 2,8 ****
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)tty.4	6.7 (Berkeley) 8/1/87
  .\"
  .TH TTY 4 "August 1, 1987"
  .UC 4
--- 2,8 ----
  .\" All rights reserved.  The Berkeley software License Agreement
  .\" specifies the terms and conditions for redistribution.
  .\"
! .\"	@(#)tty.4	6.7.1 (2.11BSD GTE) 12/9/94
  .\"
  .TH TTY 4 "August 1, 1987"
  .UC 4
***************
*** 327,353 ****
  to flush the characters in the input or output queues, TIOCFLUSH,
  is also available.
  .LP
- .B "Upper case terminals and Hazeltines"
- .PP
- If the LCASE bit is set in the tty flags, then
- all upper-case letters are mapped into
- the corresponding lower-case letter.
- The upper-case letter may be generated by preceding
- it by `\\'.
- Upper case letters are preceded by a `\e\|' when output.
- In addition, the following escape sequences can be generated
- on output and accepted on input:
- .PP
- .nf
- for	\`	|	~	{	}
- use	\e\|\'	\e\|!	\e\|^	\e\|(	\e\|)
- .fi
- .PP
- To deal with Hazeltine terminals, which do not understand that ~ has
- been made into an ASCII character, the LTILDE bit may be set in the local
- mode word; in this case the character
- ~ will be replaced with the character \` on output.
- .LP
  .B "Flow control."
  .PP
  There are two characters (the stop character, normally ^S, and the
--- 327,332 ----
***************
*** 587,593 ****
  RAW	0000040	Raw mode: wake up on all characters, 8-bit interface
  CRMOD	0000020	Map CR into LF; output LF as CR-LF
  ECHO	0000010	Echo (full duplex)
- LCASE	0000004	Map upper case to lower on input and lower to upper on output
  CBREAK	0000002	Return each character as soon as typed
  TANDEM	0000001	Automatic flow control
  .DT
--- 566,571 ----
***************
*** 834,840 ****
  LCRTBS	000001	Backspace on erase rather than echoing erase
  LPRTERA	000002	Printing terminal erase mode
  LCRTERA	000004	Erase character echoes as backspace-space-backspace
- LTILDE	000010	Convert ~ to \` on output (for Hazeltine terminals)
  LMDMBUF	000020	Stop/start output when carrier drops
  LLITOUT	000040	Suppress output translations
  LTOSTOP	000100	Send SIGTTOU for background output
--- 812,817 ----
*** /usr/src/man/man8/dump.8.old	Wed Aug 10 22:56:56 1988
--- /usr/src/man/man8/dump.8	Thu Dec 15 19:49:02 1994
***************
*** 1,3 ****
--- 1,6 ----
+ .\"
+ .\"	@(#)dump.8	1.1 (2.11BSD GTE) 12/10/94
+ .\"
  .TH DUMP 8
  .UC 4
  .SH NAME
***************
*** 4,12 ****
  dump \- incremental file system dump
  .SH SYNOPSIS
  .B /etc/dump
! [ key [
! .I argument
! \&... ] filesystem ]
  .SH DESCRIPTION
  .I Dump
  copies to magnetic tape all files
--- 7,13 ----
  dump \- incremental file system dump
  .SH SYNOPSIS
  .B /etc/dump
! [0123456789BchfusTdWwn [\fIargument\fP\& ...]] [filesystem]
  .SH DESCRIPTION
  .I Dump
  copies to magnetic tape all files
***************
*** 13,25 ****
  changed after a certain date
  in the
  .I filesystem.
! The
! .I key
! specifies the date and other options about the dump.
! .I Key
! consists of characters from
! the set
! .B 0123456789fuJsdWn.
  .TP 5
  .B  0\-9
  This number is the `dump level'.
--- 14,21 ----
  changed after a certain date
  in the
  .I filesystem.
! .PP
! The following options are supported by dump:
  .TP 5
  .B  0\-9
  This number is the `dump level'.
***************
*** 34,44 ****
  .B 0
  causes the entire filesystem to be dumped.
  .TP 5
  .B f
  Place the dump on the next 
  .I argument 
  file
! instead of the tape.
  .TP 5
  .B u
  If the dump completes successfully,
--- 30,54 ----
  .B 0
  causes the entire filesystem to be dumped.
  .TP 5
+ .B B records
+ The number of dump records per volume.  This option overrides the
+ calculation of tape size based on length and density.
+ .TP 5
+ .B c
+ This option requires no further options.  Used to specify that the
+ tape is a \fIcartridge\fP drive rather than a 9\-track.
+ .TP 5
+ .B h level
+ Honor the user 'nodump' flags only for dumps at or above the given
+ \fBlevel\fP.  The default honor level is 1, so that incremental backups
+ omit such files but full backups retain them.
+ .TP 5
  .B f
  Place the dump on the next 
  .I argument 
  file
! instead of the tape.  If '-' is given then standard out (stdout) is written
! to.
  .TP 5
  .B u
  If the dump completes successfully,
***************
*** 66,87 ****
  .I /etc/ddate,
  although the information content is identical.
  .TP 5
- .B  J
- This option is intended to be invoked only when
- the old format 
- .I /etc/ddate
- files are
- updated to the new format
- .I /etc/dumpdates
- format.
- The effect of this option is to convert between
- the old, obsolete format and to the new format.
- If the
- .B J
- option is invoked, all other options are ignored, and 
- .I dump
- terminates immediately.
- .TP 5
  .B s
  The size of the dump tape is specified in feet.
  The number of feet is taken from the next
--- 76,81 ----
***************
*** 97,102 ****
--- 91,104 ----
  .I argument.
  This is used in calculating the amount of tape
  used per reel. The default is 1600.
+ .TP 5
+ .B T date
+ Use the specified date as the starting time for the dump instead of
+ the time determined from looking in \fB/etc/dumpdates\fP.  The format
+ of \fBdate\fP is the same as that of \fIctime(3)\fP.  This option is
+ useful for automated dump scripts that wish to dump over a specific 
+ period of time.  The \fBT\fP option is mutually exclusive with the 
+ \fBu\fP option.
  .TP 5
  .B W
  .I Dump
