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

	Files affected by this part are:

/usr/lib/lint/llib-lc
/usr/src/lib/libc/gen/errlst.c
/usr/src/lib/libc/pdp/sys/Makefile
/usr/src/usr.lib/libcurses/cr_tty.c
/usr/src/usr.lib/libcurses/curses.c
/usr/src/usr.lib/libcurses/curses.h

=====================cut  here========================
*** /usr/lib/lint/llib-lc.old	Thu Apr 21 22:52:01 1994
--- /usr/lib/lint/llib-lc	Thu Dec 15 20:27:35 1994
***************
*** 1,4 ****
! /*	@(#)llib-lc	1.37 (Berkeley) 5/17/86	*/
  
  /* LINTLIBRARY */
  
--- 1,4 ----
! /*	@(#)llib-lc	1.38 (2.11BSD GTE) 11/29/94	*/
  
  /* LINTLIBRARY */
  
***************
*** 46,51 ****
--- 46,52 ----
  int	bind(s, n, l) struct sockaddr *n; { return 0; }
  char	*brk(a) char *a; { return(a); }
  int	chdir(s) char *s; { return(0); }
+ int	chflags(s, m) char *s; u_short m; { return(0); }
  int	chmod(s, m) char *s; { return(0); }
  int	chown(s, u, g) char *s; { return(0); }
  int	chroot( d ) char *d; { return 0; }
***************
*** 56,61 ****
--- 57,63 ----
  	execve(s, v, e) char *s, *v[], *e[]; {;}
  	_exit(s) {;}
  int	fchdir(f) int f; { return(0); }
+ int	fchflags(f, m) int f; u_short m; { return(0); }
  int	fchmod(f, m) { return(0); }
  int	fchown(f, u, g) { return(0); }
  int	fcntl(f, c, a) { return (0); }
*** /usr/src/lib/libc/gen/errlst.c.old	Sun Mar  9 19:45:56 1986
--- /usr/src/lib/libc/gen/errlst.c	Thu Dec 15 20:30:03 1994
***************
*** 5,11 ****
   */
  
  #if defined(LIBC_SCCS) && !defined(lint)
! static char sccsid[] = "@(#)errlst.c	5.2 (Berkeley) 3/9/86";
  #endif LIBC_SCCS and not lint
  
  char	*sys_errlist[] = {
--- 5,11 ----
   */
  
  #if defined(LIBC_SCCS) && !defined(lint)
! static char sccsid[] = "@(#)errlst.c	5.2.1 (2.11BSD GTE) 11/26/94";
  #endif LIBC_SCCS and not lint
  
  char	*sys_errlist[] = {
***************
*** 90,94 ****
--- 90,108 ----
  	"Too many processes",			/* 67 - EPROCLIM */
  	"Too many users",			/* 68 - EUSERS */
  	"Disc quota exceeded",			/* 69 - EDQUOT */
+ /* Network File System */
+ 	"Stale NFS file handle",		/* 70 - ESTALE */
+ 	"Too many levels of remote in path",	/* 71 - EREMOTE */
+ 	"RPC struct is bad",			/* 72 - EBADRPC */
+ 	"RPC version wrong",			/* 73 - ERPCMISMATCH */
+ 	"RPC prog. not avail",			/* 74 - EPROGUNAVAIL */
+ 	"Program version wrong",		/* 75 - EPROGMISMATCH */
+ 	"Bad procedure for program",		/* 76 - EPROCUNAVAIL */
+ 
+ 	"No locks available",			/* 77 - ENOLCK */
+ 	"Function not implemented",		/* 78 - ENOSYS */
+ 	"Inappropriate file type or format",	/* 79 - EFTYPE */
+ 	"Authentication error",			/* 80 - EAUTH */
+ 	"Need authenticator",			/* 81 - ENEEDAUTH */
  };
  int	sys_nerr = { sizeof sys_errlist/sizeof sys_errlist[0] };
*** /usr/src/lib/libc/pdp/sys/Makefile.old	Thu Apr 21 21:36:25 1994
--- /usr/src/lib/libc/pdp/sys/Makefile	Sun Nov 27 00:34:44 1994
***************
*** 3,14 ****
  # All rights reserved.  The Berkeley software License Agreement
  # specifies the terms and conditions for redistribution.
  #
! #	@(#)Makefile	5.6.2 (2.11BSD GTE) 4/21/94
  #
  SRCS=	_exit.s accept.s access.s acct.s adjtime.s bind.s brk.s chdir.s \
  	chmod.s chown.s chroot.s close.s connect.s creat.s dup.s dup2.s \
  	execl.s execle.s execv.s execve.s fchdir.s fchmod.s fchown.s fcntl.s \
! 	flock.s fork.s fstat.s fsync.s ftruncate.s getdopt.s getdtablesiz.s \
  	getegid.s geteuid.s getgid.s getgroups.s gethostid.s gethostname.s \
  	getitimer.s getpagesize.s getpeername.s getpgrp.s getpid.s getppid.s \
  	getpriority.s getrlimit.s getrusage.s getsockname.s getsockopt.s \
--- 3,16 ----
  # All rights reserved.  The Berkeley software License Agreement
  # specifies the terms and conditions for redistribution.
  #
! #	@(#)Makefile	5.6.3 (2.11BSD GTE) 11/25/94
  #
  SRCS=	_exit.s accept.s access.s acct.s adjtime.s bind.s brk.s chdir.s \
+ 	chflags.s \
  	chmod.s chown.s chroot.s close.s connect.s creat.s dup.s dup2.s \
  	execl.s execle.s execv.s execve.s fchdir.s fchmod.s fchown.s fcntl.s \
! 	fchflags.s \
! 	flock.s fork.s fstat.s fsync.s ftruncate.s getdtablesiz.s \
  	getegid.s geteuid.s getgid.s getgroups.s gethostid.s gethostname.s \
  	getitimer.s getpagesize.s getpeername.s getpgrp.s getpid.s getppid.s \
  	getpriority.s getrlimit.s getrusage.s getsockname.s getsockopt.s \
***************
*** 16,22 ****
  	lseek.s lstat.s mkdir.s mknod.s mount.s open.s pipe.s profil.s \
  	ptrace.s quota.s read.s readlink.s readv.s reboot.s recv.s recvfrom.s \
  	recvmsg.s rename.s rmdir.s sbrk.s select.s send.s sendmsg.s sendto.s \
! 	setdopt.s setgroups.s sethostid.s sethostname.s setitimer.s \
  	setpgrp.s setpriority.s setquota.s setregid.s setreuid.s setrlimit.s \
  	setsockopt.s settimeofday.s shutdown.s sigblock.s sigpause.s \
  	sigreturn.s sigsetmask.s sigstack.s sigvec.s socket.s socketpair.s \
--- 18,24 ----
  	lseek.s lstat.s mkdir.s mknod.s mount.s open.s pipe.s profil.s \
  	ptrace.s quota.s read.s readlink.s readv.s reboot.s recv.s recvfrom.s \
  	recvmsg.s rename.s rmdir.s sbrk.s select.s send.s sendmsg.s sendto.s \
! 	setgroups.s sethostid.s sethostname.s setitimer.s \
  	setpgrp.s setpriority.s setquota.s setregid.s setreuid.s setrlimit.s \
  	setsockopt.s settimeofday.s shutdown.s sigblock.s sigpause.s \
  	sigreturn.s sigsetmask.s sigstack.s sigvec.s socket.s socketpair.s \
***************
*** 23,31 ****
  	stat.s symlink.s sync.s truncate.s umask.s umount.s unlink.s \
  	utimes.s vfork.s vhangup.s wait4.s write.s writev.s
  OBJS=	_exit.o accept.o access.o acct.o adjtime.o bind.o brk.o chdir.o \
  	chmod.o chown.o chroot.o close.o connect.o creat.o dup.o dup2.o \
  	execl.o execle.o execv.o execve.o fchdir.o fchmod.o fchown.o fcntl.o \
! 	flock.o fork.o fstat.o fsync.o ftruncate.o getdopt.o getdtablesiz.o \
  	getegid.o geteuid.o getgid.o getgroups.o gethostid.o gethostname.o \
  	getitimer.o getpagesize.o getpeername.o getpgrp.o getpid.o getppid.o \
  	getpriority.o getrlimit.o getrusage.o getsockname.o getsockopt.o \
--- 25,35 ----
  	stat.s symlink.s sync.s truncate.s umask.s umount.s unlink.s \
  	utimes.s vfork.s vhangup.s wait4.s write.s writev.s
  OBJS=	_exit.o accept.o access.o acct.o adjtime.o bind.o brk.o chdir.o \
+ 	chflags.o \
  	chmod.o chown.o chroot.o close.o connect.o creat.o dup.o dup2.o \
  	execl.o execle.o execv.o execve.o fchdir.o fchmod.o fchown.o fcntl.o \
! 	fchflags.o \
! 	flock.o fork.o fstat.o fsync.o ftruncate.o getdtablesiz.o \
  	getegid.o geteuid.o getgid.o getgroups.o gethostid.o gethostname.o \
  	getitimer.o getpagesize.o getpeername.o getpgrp.o getpid.o getppid.o \
  	getpriority.o getrlimit.o getrusage.o getsockname.o getsockopt.o \
***************
*** 33,39 ****
  	lseek.o lstat.o mkdir.o mknod.o mount.o open.o pipe.o profil.o \
  	ptrace.o quota.o read.o readlink.o readv.o reboot.o recv.o recvfrom.o \
  	recvmsg.o rename.o rmdir.o sbrk.o select.o send.o sendmsg.o sendto.o \
! 	setdopt.o setgroups.o sethostid.o sethostname.o setitimer.o \
  	setpgrp.o setpriority.o setquota.o setregid.o setreuid.o setrlimit.o \
  	setsockopt.o settimeofday.o shutdown.o sigblock.o sigpause.o \
  	sigreturn.o sigsetmask.o sigstack.o sigvec.o socket.o socketpair.o \
--- 37,43 ----
  	lseek.o lstat.o mkdir.o mknod.o mount.o open.o pipe.o profil.o \
  	ptrace.o quota.o read.o readlink.o readv.o reboot.o recv.o recvfrom.o \
  	recvmsg.o rename.o rmdir.o sbrk.o select.o send.o sendmsg.o sendto.o \
! 	setgroups.o sethostid.o sethostname.o setitimer.o \
  	setpgrp.o setpriority.o setquota.o setregid.o setreuid.o setrlimit.o \
  	setsockopt.o settimeofday.o shutdown.o sigblock.o sigpause.o \
  	sigreturn.o sigsetmask.o sigstack.o sigvec.o socket.o socketpair.o \
***************
*** 98,103 ****
--- 102,108 ----
  bind.o: bind.s ./SYS.h /usr/include/syscall.h
  brk.o: brk.s ./SYS.h /usr/include/syscall.h
  chdir.o: chdir.s ./SYS.h /usr/include/syscall.h
+ chflags.o: chflags.s ./SYS.h /usr/include/syscall.h
  chmod.o: chmod.s ./SYS.h /usr/include/syscall.h
  chown.o: chown.s ./SYS.h /usr/include/syscall.h
  chroot.o: chroot.s ./SYS.h /usr/include/syscall.h
***************
*** 114,125 ****
  fchmod.o: fchmod.s ./SYS.h /usr/include/syscall.h
  fchown.o: fchown.s ./SYS.h /usr/include/syscall.h
  fcntl.o: fcntl.s ./SYS.h /usr/include/syscall.h
  flock.o: flock.s ./SYS.h /usr/include/syscall.h
  fork.o: fork.s ./SYS.h /usr/include/syscall.h
  fstat.o: fstat.s ./SYS.h /usr/include/syscall.h
  fsync.o: fsync.s ./SYS.h /usr/include/syscall.h
  ftruncate.o: ftruncate.s ./SYS.h /usr/include/syscall.h
- getdopt.o: getdopt.s ./SYS.h /usr/include/syscall.h
  getdtablesiz.o: getdtablesiz.s ./SYS.h /usr/include/syscall.h
  getegid.o: getegid.s ./SYS.h /usr/include/syscall.h
  geteuid.o: geteuid.s ./SYS.h /usr/include/syscall.h
--- 119,130 ----
  fchmod.o: fchmod.s ./SYS.h /usr/include/syscall.h
  fchown.o: fchown.s ./SYS.h /usr/include/syscall.h
  fcntl.o: fcntl.s ./SYS.h /usr/include/syscall.h
+ fchflags.o: fchflags.s ./SYS.h /usr/include/syscall.h
  flock.o: flock.s ./SYS.h /usr/include/syscall.h
  fork.o: fork.s ./SYS.h /usr/include/syscall.h
  fstat.o: fstat.s ./SYS.h /usr/include/syscall.h
  fsync.o: fsync.s ./SYS.h /usr/include/syscall.h
  ftruncate.o: ftruncate.s ./SYS.h /usr/include/syscall.h
  getdtablesiz.o: getdtablesiz.s ./SYS.h /usr/include/syscall.h
  getegid.o: getegid.s ./SYS.h /usr/include/syscall.h
  geteuid.o: geteuid.s ./SYS.h /usr/include/syscall.h
***************
*** 169,175 ****
  send.o: send.s ./SYS.h /usr/include/syscall.h
  sendmsg.o: sendmsg.s ./SYS.h /usr/include/syscall.h
  sendto.o: sendto.s ./SYS.h /usr/include/syscall.h
- setdopt.o: setdopt.s ./SYS.h /usr/include/syscall.h
  setgroups.o: setgroups.s ./SYS.h /usr/include/syscall.h
  sethostid.o: sethostid.s ./SYS.h /usr/include/syscall.h
  sethostname.o: sethostname.s ./SYS.h /usr/include/syscall.h
--- 174,179 ----
*** /usr/src/usr.lib/libcurses/cr_tty.c.old	Sat Jul 25 16:07:16 1987
--- /usr/src/usr.lib/libcurses/cr_tty.c	Thu Dec 15 20:31:10 1994
***************
*** 5,11 ****
   */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char sccsid[] = "@(#)cr_tty.c	5.2 (Berkeley) 11/8/85";
  #endif
  
  /*
--- 5,11 ----
   */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char sccsid[] = "@(#)cr_tty.c	5.2.1 (2.11BSD GTE) 12/9/94";
  #endif
  
  /*
***************
*** 56,68 ****
  		_tty.sg_flags = _res_flg;
  	ospeed = _tty.sg_ospeed;
  	_res_flg = _tty.sg_flags;
- 	UPPERCASE = (_tty.sg_flags & LCASE) != 0;
  	GT = ((_tty.sg_flags & XTABS) == 0);
  	NONL = ((_tty.sg_flags & CRMOD) == 0);
  	_tty.sg_flags &= ~XTABS;
  	stty(_tty_ch, &_tty);
  # ifdef DEBUG
- 	fprintf(outf, "GETTMODE: UPPERCASE = %s\n", UPPERCASE ? "TRUE":"FALSE");
  	fprintf(outf, "GETTMODE: GT = %s\n", GT ? "TRUE" : "FALSE");
  	fprintf(outf, "GETTMODE: NONL = %s\n", NONL ? "TRUE" : "FALSE");
  	fprintf(outf, "GETTMODE: ospeed = %d\n", ospeed);
--- 56,66 ----
*** /usr/src/usr.lib/libcurses/curses.c.old	Sat Jul 25 16:07:23 1987
--- /usr/src/usr.lib/libcurses/curses.c	Thu Dec 15 20:31:38 1994
***************
*** 5,11 ****
   */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char sccsid[] = "@(#)curses.c	5.2 (Berkeley) 11/8/85";
  #endif
  
  /*
--- 5,11 ----
   */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char sccsid[] = "@(#)curses.c	5.2.1 (2.11BSD GTE) 12/9/94";
  #endif
  
  /*
***************
*** 50,53 ****
   * From the tty modes...
   */
  
! bool	GT, NONL, UPPERCASE, normtty, _pfast;
--- 50,53 ----
   * From the tty modes...
   */
  
! bool	GT, NONL, normtty, _pfast;
*** /usr/src/usr.lib/libcurses/curses.h.old	Fri Jun  7 11:45:48 1985
--- /usr/src/usr.lib/libcurses/curses.h	Thu Dec 15 20:32:10 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;
