]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/doc/smm/01.setup/3.t
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304460, and update
[FreeBSD/FreeBSD.git] / share / doc / smm / 01.setup / 3.t
1 .\" Copyright (c) 1980, 1986, 1988, 1993
2 .\"      The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\" $FreeBSD$
29 .\"     @(#)3.t 8.1 (Berkeley) 7/27/93
30 .\"
31 .ds lq ``
32 .ds rq ''
33 .ds RH "Upgrading a \*(Ps System
34 .ds CF \*(Dy
35 .Sh 1 "Upgrading a \*(Ps system"
36 .PP
37 This section describes the procedure for upgrading a \*(Ps
38 system to \*(4B.  This procedure may vary according to the version of
39 the system running before conversion.
40 If you are converting from a
41 System V system, some of this section will still apply (in particular,
42 the filesystem conversion).  However, many of the system configuration
43 files are different, and the executable file formats are completely
44 incompatible.
45 .PP
46 In particular be wary when using this information to upgrade
47 a \*(Ps HP300 system.
48 There are at least four different versions of ``\*(Ps'' out there:
49 .IP 1)
50 HPBSD 1.x from Utah.
51 .br
52 This was the original version of \*(Ps for HP300s from which the
53 other variants (and \*(4B) are derived.
54 It is largely a \*(Ps system with Sun's NFS 3.0 filesystem code and
55 some \*(Ps-Tahoe features (e.g. networking code).
56 Since the filesystem code is 4.2/4.3 vintage and the filesystem
57 hierarchy is largely \*(Ps, most of this section should apply.
58 .IP 2)
59 MORE/bsd from Mt. Xinu.
60 .br
61 This is a \*(Ps-Tahoe vintage system with Sun's NFS 4.0 filesystem code
62 upgraded with Tahoe UFS features.
63 The instructions for \*(Ps-Tahoe should largely apply.
64 .IP 3)
65 \*(Ps-Reno from CSRG.
66 .br
67 At least one site bootstrapped HP300 support from the Reno distribution.
68 The Reno filesystem code was somewhere between \*(Ps and \*(4B: the VFS switch
69 had been added but many of the UFS features (e.g. ``inline'' symlinks)
70 were missing.
71 The filesystem hierarchy reorganization first appeared in this release.
72 Be extremely careful following these instructions if you are
73 upgrading from the Reno distribution.
74 .IP 4)
75 HPBSD 2.0 from Utah.
76 .br
77 As if things were not bad enough already,
78 this release has the \*(4B filesystem and networking code
79 as well as some utilities, but still has a \*(Ps hierarchy.
80 No filesystem conversions are necessary for this upgrade,
81 but files will still need to be moved around.
82 .Sh 2 "Installation overview"
83 .PP
84 If you are running \*(Ps, upgrading your system
85 involves replacing your kernel and system utilities.
86 In general, there are three possible ways to install a new \*(Bs distribution:
87 (1) boot directly from the distribution tape, use it to load new binaries
88 onto empty disks, and then merge or restore any existing configuration files
89 and filesystems;
90 (2) use an existing \*(Ps or later system to extract the root and
91 .Pn /usr
92 filesystems from the distribution tape,
93 boot from the new system, then merge or restore existing
94 configuration files and filesystems; or
95 (3) extract the sources from the distribution tape onto an existing system,
96 and use that system to cross-compile and install \*(4B.
97 For this release, the second alternative is strongly advised,
98 with the third alternative reserved as a last resort.
99 In general, older binaries will continue to run under \*(4B,
100 but there are many exceptions that are on the critical path
101 for getting the system running.
102 Ideally, the new system binaries (root and
103 .Pn /usr
104 filesystems) should be installed on spare disk partitions,
105 then site-specific files should be merged into them.
106 Once the new system is up and fully merged, the previous root and
107 .Pn /usr
108 filesystems can be reused.
109 Other existing filesystems can be retained and used,
110 except that (as usual) the new
111 .Xr fsck
112 should be run before they are mounted.
113 .PP
114 It is \fBSTRONGLY\fP advised that you make full dumps of each filesystem
115 before beginning, especially any that you intend to modify in place
116 during the merge.
117 It is also desirable to run filesystem checks
118 of all filesystems to be converted to \*(4B before shutting down.
119 This is an excellent time to review your disk configuration
120 for possible tuning of the layout.
121 Most systems will need to provide a new filesystem for system use
122 mounted on
123 .Pn /var
124 (see below).
125 However, the
126 .Pn /tmp
127 filesystem can be an MFS virtual-memory-resident filesystem,
128 potentially freeing an existing disk partition.
129 (Additional swap space may be desirable as a consequence.)
130 See
131 .Xr mount_mfs (8).
132 .PP
133 The recommended installation procedure includes the following steps.
134 The order of these steps will probably vary according to local needs.
135 .IP \(bu
136 Extract root and
137 .Pn /usr
138 filesystems from the distribution tapes.
139 .IP \(bu
140 Extract kernel and/or user-level sources from the distribution tape
141 if space permits.
142 This can serve as the backup documentation as needed.
143 .IP \(bu
144 Configure and boot a kernel for the local system.
145 This can be delayed if the generic kernel from the distribution
146 supports enough hardware to proceed.
147 .IP \(bu
148 Build a skeletal
149 .Pn /var
150 filesystem (see
151 .Xr mtree (8)).
152 .IP \(bu
153 Merge site-dependent configuration files from
154 .Pn /etc
155 and
156 .Pn /usr/lib
157 into the new
158 .Pn /etc
159 directory.
160 Note that many file formats and contents have changed; see section 3.4
161 of this document.
162 .IP \(bu
163 Copy or merge files from
164 .Pn /usr/adm ,
165 .Pn /usr/spool ,
166 .Pn /usr/preserve ,
167 .Pn /usr/lib ,
168 and other locations into
169 .Pn /var .
170 .IP \(bu
171 Merge local macros, dictionaries, etc. into
172 .Pn /usr/share .
173 .IP \(bu
174 Merge and update local software to reflect the system changes.
175 .IP \(bu
176 Take off the rest of the morning, you've earned it!
177 .PP
178 Section 3.2 lists the files to be saved as part of the conversion process.
179 Section 3.3 describes the bootstrap process.
180 Section 3.4 discusses the merger of the saved files back into the new system.
181 Section 3.5 gives an overview of the major
182 bug fixes and changes between \*(Ps and \*(4B.
183 Section 3.6 provides general hints on possible problems to be
184 aware of when converting from \*(Ps to \*(4B.
185 .Sh 2 "Files to save"
186 .PP
187 The following list enumerates the standard set of files you will want to
188 save and suggests directories in which site-specific files should be present.
189 This list will likely be augmented with non-standard files you
190 have added to your system.
191 If you do not have enough space to create parallel
192 filesystems, you should create a
193 .Xr tar
194 image of the following files before the new filesystems are created.
195 The rest of this subsection describes where theses files
196 have moved and how they have changed.
197 .TS
198 lfC c l.
199 /.cshrc \(dg    root csh startup script (moves to \f(CW/root/.cshrc\fP)
200 /.login \(dg    root csh login script (moves to \f(CW/root/.login\fP)
201 /.profile       \(dg    root sh startup script (moves to \f(CW/root/.profile\fP)
202 /.rhosts        \(dg    for trusted machines and users (moves to \f(CW/root/.rhosts\fP)
203 /etc/disktab    \(dd    in case you changed disk partition sizes
204 /etc/fstab      *       disk configuration data
205 /etc/ftpusers   \(dg    for local additions
206 /etc/gettytab   \(dd    getty database
207 /etc/group      *       group data base
208 /etc/hosts      \(dg    for local host information
209 /etc/hosts.equiv        \(dg    for local host equivalence information
210 /etc/hosts.lpd  \(dg    printer access file
211 /etc/inetd.conf *       Internet services configuration data
212 /etc/named*     \(dg    named configuration files
213 /etc/netstart   \(dg    network initialization
214 /etc/networks   \(dg    for local network information
215 /etc/passwd     *       user data base
216 /etc/printcap   *       line printer database
217 /etc/protocols  \(dd    in case you added any local protocols
218 /etc/rc *       for any local additions
219 /etc/rc.local   *       site specific system startup commands
220 /etc/remote     \(dg    auto-dialer configuration
221 /etc/services   \(dd    for local additions
222 /etc/shells     \(dd    list of valid shells
223 /etc/syslog.conf        *       system logger configuration
224 /etc/securettys *       merged into ttys
225 /etc/ttys       *       terminal line configuration data
226 /etc/ttytype    *       merged into ttys
227 /etc/termcap    \(dd    for any local entries that may have been added
228 /lib    \(dd    for any locally developed language processors
229 /usr/dict/*     \(dd    for local additions to words and papers
230 /usr/include/*  \(dd    for local additions
231 /usr/lib/aliases        *       mail forwarding data base (moves to \f(CW/etc/aliases\fP)
232 /usr/lib/crontab        *       cron daemon data base (moves to \f(CW/etc/crontab\fP)
233 /usr/lib/crontab.local  *       local cron daemon data base (moves to \f(CW/etc/crontab.local\fP)
234 /usr/lib/lib*.a \(dg    for local libraries
235 /usr/lib/mail.rc        \(dg    system-wide mail(1) initialization (moves to \f(CW/etc/mail.rc\fP)
236 /usr/lib/sendmail.cf    *       sendmail configuration (moves to \f(CW/etc/sendmail.cf\fP)
237 /usr/lib/tmac/* \(dd    for locally developed troff/nroff macros (moves to \f(CW/usr/share/tmac/*\fP)
238 /usr/lib/uucp/* \(dg    for local uucp configuration files
239 /usr/man/manl   *       for manual pages for locally developed programs (moves to \f(CW/usr/local/man\fP)
240 /usr/spool/*    \(dg    for current mail, news, uucp files, etc. (moves to \f(CW/var/spool\fP)
241 /usr/src/local  \(dg    for source for locally developed programs
242 /sys/conf/HOST  \(dg    configuration file for your machine (moves to \f(CW/sys/<arch>/conf\fP)
243 /sys/conf/files.HOST    \(dg    list of special files in your kernel (moves to \f(CW/sys/<arch>/conf\fP)
244 /*/quotas       *       filesystem quota files (moves to \f(CW/*/quotas.user\fP)
245 .TE
246 .DS
247 \(dg\|Files that can be used from \*(Ps without change.
248 \(dd\|Files that need local changes merged into \*(4B files.
249 *\|Files that require special work to merge and are discussed in section 3.4.
250 .DE
251 .Sh 2 "Installing \*(4B"
252 .PP
253 The next step is to build a working \*(4B system.
254 This can be done by following the steps in section 2 of
255 this document for extracting the root and
256 .Pn /usr
257 filesystems from the distribution tape onto unused disk partitions.
258 For the SPARC, the root filesystem dump on the tape could also be
259 extracted directly.
260 For the HP300 and DECstation, the raw disk image can be copied
261 into an unused partition and this partition can then be dumped
262 to create an image that can be restored.
263 The exact procedure chosen will depend on the disk configuration
264 and the number of suitable disk partitions that may be used.
265 It is also desirable to run filesystem checks
266 of all filesystems to be converted to \*(4B before shutting down.
267 In any case, this is an excellent time to review your disk configuration
268 for possible tuning of the layout.
269 Section 2.5 and
270 .Xr config (8)
271 are required reading.
272 .LP
273 The filesystem in \*(4B has been reorganized in an effort to
274 meet several goals:
275 .IP 1)
276 The root filesystem should be small.
277 .IP 2)
278 There should be a per-architecture centrally-shareable read-only
279 .Pn /usr
280 filesystem.
281 .IP 3)
282 Variable per-machine directories should be concentrated below
283 a single mount point named
284 .Pn /var .
285 .IP 4)
286 Site-wide machine independent shareable text files should be separated
287 from architecture specific binary files and should be concentrated below
288 a single mount point named
289 .Pn /usr/share .
290 .LP
291 These goals are realized with the following general layouts.
292 The reorganized root filesystem has the following directories:
293 .TS
294 lfC l.
295 /etc    (config files)
296 /bin    (user binaries needed when single-user)
297 /sbin   (root binaries needed when single-user)
298 /local  (locally added binaries used only by this machine)
299 /tmp    (mount point for memory based filesystem)
300 /dev    (local devices)
301 /home   (mount point for AMD)
302 /var    (mount point for per-machine variable directories)
303 /usr    (mount point for multiuser binaries and files)
304 .TE
305 .LP
306 The reorganized
307 .Pn /usr
308 filesystem has the following directories:
309 .TS
310 lfC l.
311 /usr/bin        (user binaries)
312 /usr/contrib    (software contributed to \*(4B)
313 /usr/games      (binaries for games, score files in \f(CW/var\fP)
314 /usr/include    (standard include files)
315 /usr/lib        (lib*.a from old \f(CW/usr/lib\fP)
316 /usr/libdata    (databases from old \f(CW/usr/lib\fP)
317 /usr/libexec    (executables from old \f(CW/usr/lib\fP)
318 /usr/local      (locally added binaries used site-wide)
319 /usr/old        (deprecated binaries)
320 /usr/sbin       (root binaries)
321 /usr/share      (mount point for site-wide shared text)
322 /usr/src        (mount point for sources)
323 .TE
324 .LP
325 The reorganized
326 .Pn /usr/share
327 filesystem has the following directories:
328 .TS
329 lfC l.
330 /usr/share/calendar     (various useful calendar files)
331 /usr/share/dict (dictionaries)
332 /usr/share/doc  (\*(4B manual sources)
333 /usr/share/games        (games text files)
334 /usr/share/groff_font   (groff font information)
335 /usr/share/man  (typeset manual pages)
336 /usr/share/misc (dumping ground for random text files)
337 /usr/share/mk   (templates for \*(4B makefiles)
338 /usr/share/skel (template user home directory files)
339 /usr/share/tmac (various groff macro packages)
340 /usr/share/zoneinfo     (information on time zones)
341 .TE
342 .LP
343 The reorganized
344 .Pn /var
345 filesystem has the following directories:
346 .TS
347 lfC l.
348 /var/account    (accounting files, formerly \f(CW/usr/adm\fP)
349 /var/at (\fIat\fP\|(1) spooling area)
350 /var/backups    (backups of system files)
351 /var/crash      (crash dumps)
352 /var/db (system-wide databases, e.g. tags)
353 /var/games      (score files)
354 /var/log        (log files)
355 /var/mail       (users mail)
356 /var/obj        (hierarchy to build \f(CW/usr/src\fP)
357 /var/preserve   (preserve area for vi)
358 /var/quotas     (directory to store quota files)
359 /var/run        (directory to store *.pid files)
360 /var/rwho       (rwho databases)
361 /var/spool/ftp  (home directory for anonymous ftp)
362 /var/spool/mqueue       (sendmail spooling directory)
363 /var/spool/news (news spooling area)
364 /var/spool/output       (printer spooling area)
365 /var/spool/uucp (uucp spooling area)
366 /var/tmp        (disk-based temporary directory)
367 /var/users      (root of per-machine user home directories)
368 .TE
369 .PP
370 The \*(4B bootstrap routines pass the identity of the boot device
371 through to the kernel.
372 The kernel then uses that device as its root filesystem.
373 Thus, for example, if you boot from
374 .Pn /dev/\*(Dk1a ,
375 the kernel will use
376 .Pn \*(Dk1a
377 as its root filesystem. If
378 .Pn /dev/\*(Dk1b
379 is configured as a swap partition,
380 it will be used as the initial swap area,
381 otherwise the normal primary swap area (\c
382 .Pn /dev/\*(Dk0b )
383 will be used.
384 The \*(4B bootstrap is backward compatible with \*(Ps,
385 so you can replace your old bootstrap if you use it
386 to boot your first \*(4B kernel.
387 However, the \*(Ps bootstrap cannot access \*(4B filesystems,
388 so if you plan to convert your filesystems to \*(4B,
389 you must install a new bootstrap \fIbefore\fP doing the conversion.
390 Note that SPARC users cannot build a \*(4B compatible version
391 of the bootstrap, so must \fInot\fP convert their root filesystem
392 to the new \*(4B format.
393 .PP
394 Once you have extracted the \*(4B system and booted from it,
395 you will have to build a kernel customized for your configuration.
396 If you have any local device drivers,
397 they will have to be incorporated into the new kernel.
398 See section 4.1.3 and ``Building 4.3BSD UNIX Systems with Config'' (SMM:2).
399 .PP
400 If converting from \*(Ps, your old filesystems should be converted.
401 If you've modified the partition
402 sizes from the original \*(Ps ones, and are not already using the
403 \*(4B disk labels, you will have to modify the default disk partition
404 tables in the kernel.  Make the necessary table changes and boot
405 your custom kernel \fBBEFORE\fP trying to access any of your old
406 filesystems!  After doing this, if necessary, the remaining filesystems
407 may be converted in place by running the \*(4B version of
408 .Xr fsck (8)
409 on each filesystem and allowing it to make the necessary corrections.
410 The new version of
411 .Xr fsck
412 is more strict about the size of directories than
413 the version supplied with \*(Ps.
414 Thus the first time that it is run on a \*(Ps filesystem,
415 it will produce messages of the form:
416 .DS
417 \fBDIRECTORY ...: LENGTH\fP xx \fBNOT MULTIPLE OF 512 (ADJUSTED)\fP
418 .DE
419 Length ``xx'' will be the size of the directory;
420 it will be expanded to the next multiple of 512 bytes.
421 The new
422 .Xr fsck
423 will also set default \fIinterleave\fP and
424 \fInpsect\fP (number of physical sectors per track) values on older
425 filesystems, in which these fields were unused spares; this correction
426 will produce messages of the form:
427 .DS
428 \fBIMPOSSIBLE INTERLEAVE=0 IN SUPERBLOCK (SET TO DEFAULT)\fP\**
429 \fBIMPOSSIBLE NPSECT=0 IN SUPERBLOCK (SET TO DEFAULT)\fP
430 .DE
431 .FS
432 The defaults are to set \fIinterleave\fP to 1 and
433 \fInpsect\fP to \fInsect\fP.
434 This is correct on most drives;
435 it affects only performance (usually virtually unmeasurably).
436 .FE
437 Filesystems that have had their interleave and npsect values
438 set will be diagnosed by the old
439 .Xr fsck
440 as having a bad superblock; the old
441 .Xr fsck
442 will run only if given an alternate superblock
443 (\fIfsck \-b32\fP),
444 in which case it will re-zero these fields.
445 The \*(4B kernel will internally set these fields to their defaults
446 if fsck has not done so; again, the \fI\-b32\fP option may be
447 necessary for running the old
448 .Xr fsck .
449 .PP
450 In addition, \*(4B removes several limits on filesystem sizes
451 that were present in \*(Ps.
452 The limited filesystems
453 continue to work in \*(4B, but should be converted
454 as soon as it is convenient
455 by running
456 .Xr fsck
457 with the \fI\-c 2\fP option.
458 The sequence \fIfsck \-p \-c 2\fP will update them all,
459 fix the interleave and npsect fields,
460 fix any incorrect directory lengths,
461 expand maximum uid's and gid's to 32-bits,
462 place symbolic links less than 60 bytes into their inode,
463 and fill in directory type fields all at once.
464 The new filesystem formats are incompatible with older systems.
465 If you wish to continue using these filesystems with the older
466 systems you should make only the compatible changes using
467 \fIfsck \-c 1\fP.
468 .Sh 2 "Merging your files from \*(Ps into \*(4B"
469 .PP
470 When your system is booting reliably and you have the \*(4B root and
471 .Pn /usr
472 filesystems fully installed you will be ready
473 to continue with the next step in the conversion process,
474 merging your old files into the new system.
475 .PP
476 If you saved the files on a
477 .Xr tar
478 tape, extract them into a scratch directory, say
479 .Pn /usr/convert :
480 .DS
481 \fB#\fP \fImkdir /usr/convert\fP
482 \fB#\fP \fIcd /usr/convert\fP
483 \fB#\fP \fItar xp\fP
484 .DE
485 .PP
486 The data files marked in the previous table with a dagger (\(dg)
487 may be used without change from the previous system.
488 Those data files marked with a double dagger (\(dd) have syntax
489 changes or substantial enhancements.
490 You should start with the \*(4B version and carefully
491 integrate any local changes into the new file.
492 Usually these local changes can be incorporated
493 without conflict into the new file;
494 some exceptions are noted below.
495 The files marked with an asterisk (*) require
496 particular attention and are discussed below.
497 .PP
498 As described in section 3.3,
499 the most immediately obvious change in \*(4B is the reorganization
500 of the system filesystems.
501 Users of certain recent vendor releases have seen this general organization,
502 although \*(4B takes the reorganization a bit further.
503 The directories most affected are
504 .Pn /etc ,
505 that now contains only system configuration files;
506 .Pn /var ,
507 a new filesystem containing per-system spool and log files; and
508 .Pn /usr/share,
509 that contains most of the text files shareable across architectures
510 such as documentation and macros.
511 System administration programs formerly in
512 .Pn /etc
513 are now found in
514 .Pn /sbin
515 and
516 .Pn /usr/sbin .
517 Various programs and data files formerly in
518 .Pn /usr/lib
519 are now found in
520 .Pn /usr/libexec
521 and
522 .Pn /usr/libdata ,
523 respectively.
524 Administrative files formerly in
525 .Pn /usr/adm
526 are in
527 .Pn /var/account
528 and, similarly, log files are now in
529 .Pn /var/log .
530 The directory
531 .Pn /usr/ucb
532 has been merged into
533 .Pn /usr/bin ,
534 and the sources for programs in
535 .Pn /usr/bin
536 are in
537 .Pn /usr/src/usr.bin .
538 Other source directories parallel the destination directories;
539 .Pn /usr/src/etc
540 has been greatly expanded, and
541 .Pn /usr/src/share
542 is new.
543 The source for the manual pages, in general, are with the source
544 code for the applications they document.
545 Manual pages not closely corresponding to an application program
546 are found in
547 .Pn /usr/src/share/man .
548 The locations of all man pages is listed in
549 .Pn /usr/src/share/man/man0/man[1-8] .
550 The manual page
551 .Xr hier (7)
552 has been updated and made more detailed;
553 it is included in the printed documentation.
554 You should review it to familiarize yourself with the new layout.
555 .PP
556 A new utility,
557 .Xr mtree (8),
558 is provided to build and check filesystem hierarchies
559 with the proper contents, owners and permissions.
560 Scripts are provided in
561 .Pn /etc/mtree
562 (and
563 .Pn /usr/src/etc/mtree )
564 for the root,
565 .Pn /usr
566 and
567 .Pn /var
568 filesystems.
569 Once a filesystem has been made for
570 .Pn /var ,
571 .Xr mtree
572 can be used to create a directory hierarchy there
573 or you can simply use tar to extract the prototype from
574 the second file of the distribution tape.
575 .Sh 3 "Changes in the \f(CW/etc\fP directory"
576 .PP
577 The
578 .Pn /etc
579 directory now contains nearly all the host-specific configuration
580 files.
581 Note that some file formats have changed,
582 and those configuration files containing pathnames are nearly all affected
583 by the reorganization.
584 See the examples provided in
585 .Pn /etc
586 (installed from
587 .Pn /usr/src/etc )
588 as a guide.
589 The following table lists some of the local configuration files
590 whose locations and/or contents have changed.
591 .TS
592 l l l
593 lfC lfC l.
594 \*(Ps and Earlier       \*(4B   Comments
595 _       _       _
596 /etc/fstab      /etc/fstab      new format; see below
597 /etc/inetd.conf /etc/inetd.conf pathnames of executables changed
598 /etc/printcap   /etc/printcap   pathnames changed
599 /etc/syslog.conf        /etc/syslog.conf        pathnames of log files changed
600 /etc/ttys       /etc/ttys       pathnames of executables changed
601 /etc/passwd     /etc/master.passwd      new format; see below
602 /usr/lib/sendmail.cf    /etc/sendmail.cf        changed pathnames
603 /usr/lib/aliases        /etc/aliases    may contain changed pathnames
604 /etc/*.pid      /var/run/*.pid
605
606 .T&
607 l l l
608 lfC lfC l.
609 New in \*(Ps-Tahoe      \*(4B   Comments
610 _       _       _
611 /usr/games/dm.config    /etc/dm.conf    configuration for games (see \fIdm\fP\|(8))
612 /etc/zoneinfo/localtime /etc/localtime  timezone configuration
613 /etc/zoneinfo   /usr/share/zoneinfo     timezone configuration
614 .TE
615 .ne 1.5i
616 .TS
617 l l l
618 lfC lfC l.
619         New in \*(4B    Comments
620 _       _       _
621         /etc/aliases.db database version of the aliases file
622         /etc/amd-home   location database of home directories
623         /etc/amd-vol    location database of exported filesystems
624         /etc/changelist \f(CW/etc/security\fP files to back up
625         /etc/csh.cshrc  system-wide csh(1) initialization file
626         /etc/csh.login  system-wide csh(1) login file
627         /etc/csh.logout system-wide csh(1) logout file
628         /etc/disklabels directory for saving disklabels
629         /etc/exports    NFS list of export permissions
630         /etc/ftpwelcome message displayed for ftp users; see ftpd(8)
631         /etc/man.conf   lists directories searched by \fIman\fP\|(1)
632         /etc/mtree      directory for local mtree files; see mtree(8)
633         /etc/netgroup   NFS group list used in \f(CW/etc/exports\fP
634         /etc/pwd.db     non-secure hashed user data base file
635         /etc/spwd.db    secure hashed user data base file
636         /etc/security   daily system security checker
637 .TE
638 .PP
639 System security changes require adding several new ``well-known'' groups to
640 .Pn /etc/group .
641 The groups that are needed by the system as distributed are:
642 .TS
643 l n l.
644 name    number  purpose
645 _
646 wheel   0       users allowed superuser privilege
647 daemon  1       processes that need less than wheel privilege
648 kmem    2       read access to kernel memory
649 sys     3       access to kernel sources
650 tty     4       access to terminals
651 operator        5       read access to raw disks
652 bin     7       group for system binaries
653 news    8       group for news
654 wsrc    9       write access to sources
655 games   13      access to games
656 staff   20      system staff
657 guest   31      system guests
658 nobody  39      the least privileged group
659 utmp    45      access to utmp files
660 dialer  117     access to remote ports and dialers
661 .TE
662 Only users in the ``wheel'' group are permitted to
663 .Xr su
664 to ``root''.
665 Most programs that manage directories in
666 .Pn /var/spool
667 now run set-group-id to ``daemon'' so that users cannot
668 directly access the files in the spool directories.
669 The special files that access kernel memory,
670 .Pn /dev/kmem
671 and
672 .Pn /dev/mem ,
673 are made readable only by group ``kmem''.
674 Standard system programs that require this access are
675 made set-group-id to that group.
676 The group ``sys'' is intended to control access to kernel sources,
677 and other sources belong to group ``wsrc.''
678 Rather than make user terminals writable by all users,
679 they are now placed in group ``tty'' and made only group writable.
680 Programs that should legitimately have access to write on user terminals
681 such as
682 .Xr talkd
683 and
684 .Xr write
685 now run set-group-id to ``tty''.
686 The ``operator'' group controls access to disks.
687 By default, disks are readable by group ``operator'',
688 so that programs such as
689 .Xr dump
690 can access the filesystem information without being set-user-id to ``root''.
691 The
692 .Xr shutdown (8)
693 program is executable only by group operator
694 and is setuid to root so that members of group operator may shut down
695 the system without root access.
696 .PP
697 The ownership and modes of some directories have changed.
698 The
699 .Xr at
700 programs now run set-user-id ``root'' instead of ``daemon.''
701 Also, the uucp directory no longer needs to be publicly writable,
702 as
703 .Xr tip
704 reverts to privileged status to remove its lock files.
705 After copying your version of
706 .Pn /var/spool ,
707 you should do:
708 .DS
709 \fB#\fP \fIchown \-R root /var/spool/at\fP
710 \fB#\fP \fIchown \-R uucp:daemon /var/spool/uucp\fP
711 \fB#\fP \fIchmod \-R o\-w /var/spool/uucp\fP
712 .DE
713 .PP
714 The format of the cron table,
715 .Pn /etc/crontab ,
716 has been changed to specify the user-id that should be used to run a process.
717 The userid ``nobody'' is frequently useful for non-privileged programs.
718 Local changes are now put in a separate file,
719 .Pn /etc/crontab.local .
720 .PP
721 Some of the commands previously in
722 .Pn /etc/rc.local
723 have been moved to
724 .Pn /etc/rc ;
725 several new functions are now handled by
726 .Pn /etc/rc ,
727 .Pn /etc/netstart
728 and
729 .Pn /etc/rc.local .
730 You should look closely at the prototype version of these files
731 and read the manual pages for the commands contained in it
732 before trying to merge your local copy.
733 Note in particular that
734 .Xr ifconfig
735 has had many changes,
736 and that host names are now fully specified as domain-style names
737 (e.g., vangogh.CS.Berkeley.EDU) for the benefit of the name server.
738 .PP
739 Some of the commands previously in
740 .Pn /etc/daily
741 have been moved to
742 .Pn /etc/security ,
743 and several new functions have been added to
744 .Pn /etc/security
745 to do nightly security checks on the system.
746 The script
747 .Pn /etc/daily
748 runs
749 .Pn /etc/security
750 each night, and mails the output to the super-user.
751 Some of the checks done by
752 .Pn /etc/security
753 are:
754 .DS
755 \(bu Syntax errors in the password and group files.
756 \(bu Duplicate user and group names and id's.
757 \(bu Dangerous search paths and umask values for the superuser.
758 \(bu Dangerous values in various initialization files.
759 \(bu Dangerous .rhosts files.
760 \(bu Dangerous directory and file ownership or permissions.
761 \(bu Globally exported filesystems.
762 \(bu Dangerous owners or permissions for special devices.
763 .DE
764 In addition, it reports any changes to setuid and setgid files, special
765 devices, or the files in
766 .Pn /etc/changelist
767 since the last run of
768 .Pn /etc/security .
769 Backup copies of the files are saved in
770 .Pn /var/backups .
771 Finally, the system binaries are checksummed and their permissions
772 validated against the
773 .Xr mtree (8)
774 specifications in
775 .Pn /etc/mtree .
776 .PP
777 The C-library and system binaries on the distribution tape
778 are compiled with new versions of
779 .Xr gethostbyname
780 and
781 .Xr gethostbyaddr
782 that use the name server,
783 .Xr named (8).
784 If you have only a small network and are not connected
785 to a large network, you can use the distributed library routines without
786 any problems; they use a linear scan of the host table
787 .Pn /etc/hosts
788 if the name server is not running.
789 If you are on the Internet or have a large local network,
790 it is recommend that you set up
791 and use the name server.
792 For instructions on how to set up the necessary configuration files,
793 refer to ``Name Server Operations Guide for BIND'' (SMM:10).
794 Several programs rely on the host name returned by
795 .Xr gethostname
796 to determine the local domain name.
797 .PP
798 If you are using the name server, your
799 .Xr sendmail
800 configuration file will need some updates to accommodate it.
801 See the ``Sendmail Installation and Operation Guide'' (SMM:8) and
802 the sample
803 .Xr sendmail
804 configuration files in
805 .Pn /usr/src/usr.sbin/sendmail/cf .
806 The aliases file,
807 .Pn /etc/aliases
808 has also been changed to add certain well-known addresses.
809 .Sh 3 "Shadow password files"
810 .PP
811 The password file format adds change and expiration fields
812 and its location has changed to protect
813 the encrypted passwords stored there.
814 The actual password file is now stored in
815 .Pn /etc/master.passwd .
816 The hashed dbm password files do not contain encrypted passwords,
817 but contain the file offset to the entry with the password in
818 .Pn /etc/master.passwd
819 (that is readable only by root).
820 Thus, the
821 .Fn getpwnam
822 and
823 .Fn getpwuid
824 functions will no longer return an encrypted password string to non-root
825 callers.
826 An old-style passwd file is created in
827 .Pn /etc/passwd
828 by the
829 .Xr vipw (8)
830 and
831 .Xr pwd_mkdb (8)
832 programs.
833 See also
834 .Xr passwd (5).
835 .PP
836 Several new users have also been added to the group of ``well-known'' users in
837 .Pn /etc/passwd .
838 The current list is:
839 .DS
840 .TS
841 l c.
842 name    number
843 _
844 root    0
845 daemon  1
846 operator        2
847 bin     3
848 games   7
849 uucp    66
850 nobody  32767
851 .TE
852 .DE
853 The ``daemon'' user is used for daemon processes that
854 do not need root privileges.
855 The ``operator'' user-id is used as an account for dumpers
856 so that they can log in without having the root password.
857 By placing them in the ``operator'' group,
858 they can get read access to the disks.
859 The ``uucp'' login has existed long before \*(4B,
860 and is noted here just to provide a common user-id.
861 The password entry ``nobody'' has been added to specify
862 the user with least privilege.  The ``games'' user is a pseudo-user
863 that controls access to game programs.
864 .PP
865 After installing your updated password file, you must run
866 .Xr pwd_mkdb (8)
867 to create the password database.
868 Note that
869 .Xr pwd_mkdb (8)
870 is run whenever
871 .Xr vipw (8)
872 is run.
873 .Sh 3 "The \f(CW/var\fP filesystem"
874 .PP
875 The spooling directories saved on tape may be restored in their
876 eventual resting places without too much concern.  Be sure to
877 use the `\-p' option to
878 .Xr tar (1)
879 so that files are recreated with the same file modes.
880 The following commands provide a guide for copying spool and log files from
881 an existing system into a new
882 .Pn /var
883 filesystem.
884 At least the following directories should already exist on
885 .Pn /var :
886 .Pn output ,
887 .Pn log ,
888 .Pn backups
889 and
890 .Pn db .
891 .LP
892 .DS
893 .ft CW
894 SRC=/oldroot/usr
895
896 cd $SRC; tar cf - msgs preserve | (cd /var && tar xpf -)
897 .DE
898 .DS
899 .ft CW
900 # copy $SRC/spool to /var
901 cd $SRC/spool
902 tar cf - at mail rwho | (cd /var && tar xpf -)
903 tar cf - ftp mqueue news secretmail uucp uucppublic | \e
904         (cd /var/spool && tar xpf -)
905 .DE
906 .DS
907 .ft CW
908 # everything else in spool is probably a printer area
909 mkdir .save
910 mv at ftp mail mqueue rwho secretmail uucp uucppublic .save
911 tar cf - * | (cd /var/spool/output && tar xpf -)
912 mv .save/* .
913 rmdir .save
914 .DE
915 .DS
916 .ft CW
917 cd /var/spool/mqueue
918 mv syslog.7 /var/log/maillog.7
919 mv syslog.6 /var/log/maillog.6
920 mv syslog.5 /var/log/maillog.5
921 mv syslog.4 /var/log/maillog.4
922 mv syslog.3 /var/log/maillog.3
923 mv syslog.2 /var/log/maillog.2
924 mv syslog.1 /var/log/maillog.1
925 mv syslog.0 /var/log/maillog.0
926 mv syslog /var/log/maillog
927 .DE
928 .DS
929 .ft CW
930 # move $SRC/adm to /var
931 cd $SRC/adm
932 tar cf - . | (cd /var/account && tar  xpf -)
933 cd /var/account
934 rm -f msgbuf
935 mv messages messages.[0-9] ../log
936 mv wtmp wtmp.[0-9] ../log
937 mv lastlog ../log
938 .DE
939 .Sh 2 "Bug fixes and changes between \*(Ps and \*(4B"
940 .PP
941 The major new facilities available in the \*(4B release are
942 a new virtual memory system,
943 the addition of ISO/OSI networking support,
944 a new virtual filesystem interface supporting filesystem stacking,
945 a freely redistributable implementation of NFS,
946 a log-structured filesystem,
947 enhancement of the local filesystems to support
948 files and filesystems that are up to 2^63 bytes in size,
949 enhanced security and system management support,
950 and the conversion to and addition of the IEEE Std1003.1 (``POSIX'')
951 facilities and many of the IEEE Std1003.2 facilities.
952 In addition, many new utilities and additions to the C
953 library are present as well.
954 The kernel sources have been reorganized to collect all machine-dependent
955 files for each architecture under one directory,
956 and most of the machine-independent code is now free of code
957 conditional on specific machines.
958 The user structure and process structure have been reorganized
959 to eliminate the statically-mapped user structure and to make most
960 of the process resources shareable by multiple processes.
961 The system and include files have been converted to be compatible
962 with ANSI C, including function prototypes for most of the exported
963 functions.
964 There are numerous other changes throughout the system.
965 .Sh 3 "Changes to the kernel"
966 .PP
967 This release includes several important structural kernel changes.
968 The kernel uses a new internal system call convention;
969 the use of global (``u-dot'') variables for parameters and error returns
970 has been eliminated,
971 and interrupted system calls no longer abort using non-local goto's (longjmp's).
972 A new sleep interface separates signal handling from scheduling priority,
973 returning characteristic errors to abort or restart the current system call.
974 This sleep call also passes a string describing the process state,
975 that is used by the ps(1) program.
976 The old sleep interface can be used only for non-interruptible sleeps.
977 The sleep interface (\fItsleep\fP) can be used at any priority,
978 but is only interruptible if the PCATCH flag is set.
979 When interrupted, \fItsleep\fP returns EINTR or ERESTART.
980 .PP
981 Many data structures that were previously statically allocated
982 are now allocated dynamically.
983 These structures include mount entries, file entries,
984 user open file descriptors, the process entries, the vnode table,
985 the name cache, and the quota structures.
986 .PP
987 To protect against indiscriminate reading or writing of kernel
988 memory, all writing and most reading of kernel data structures
989 must be done using a new ``sysctl'' interface.
990 The information to be accessed is described through an extensible
991 ``Management Information Base'' (MIB) style name,
992 described as a dotted set of components.
993 A new utility,
994 .Xr sysctl (8),
995 retrieves kernel state and allows processes with appropriate
996 privilege to set kernel state.
997 .Sh 3 "Security"
998 .PP
999 The kernel runs with four different levels of security.
1000 Any superuser process can raise the security level, but only
1001 .Fn init (8)
1002 can lower it.
1003 Security levels are defined as follows:
1004 .IP \-1
1005 Permanently insecure mode \- always run system in level 0 mode.
1006 .IP "  0"
1007 Insecure mode \- immutable and append-only flags may be turned off.
1008 All devices may be read or written subject to their permissions.
1009 .IP "  1"
1010 Secure mode \- immutable and append-only flags may not be cleared;
1011 disks for mounted filesystems,
1012 .Pn /dev/mem ,
1013 and
1014 .Pn /dev/kmem
1015 are read-only.
1016 .IP "  2"
1017 Highly secure mode \- same as secure mode, plus disks are always
1018 read-only whether mounted or not.
1019 This level precludes tampering with filesystems by unmounting them,
1020 but also inhibits running
1021 .Xr newfs (8)
1022 while the system is multi-user.
1023 See
1024 .Xr chflags (1)
1025 and the \-\fBo\fP option to
1026 .Xr ls (1)
1027 for information on setting and displaying the immutable and append-only
1028 flags.
1029 .PP
1030 Normally, the system runs in level 0 mode while single user
1031 and in level 1 mode while multiuser.
1032 If the level 2 mode is desired while running multiuser,
1033 it can be set in the startup script
1034 .Pn /etc/rc
1035 using
1036 .Xr sysctl (1).
1037 If it is desired to run the system in level 0 mode while multiuser,
1038 the administrator must build a kernel with the variable
1039 .Li securelevel
1040 in the kernel source file
1041 .Pn /sys/kern/kern_sysctl.c
1042 initialized to \-1.
1043 .Sh 4 "Virtual memory changes"
1044 .PP
1045 The new virtual memory implementation is derived from the Mach
1046 operating system developed at Carnegie-Mellon,
1047 and was ported to the BSD kernel at the University of Utah.
1048 It is based on the 2.0 release of Mach
1049 (with some bug fixes from the 2.5 and 3.0 releases)
1050 and retains many of its essential features such as
1051 the separation of the machine dependent and independent layers
1052 (the ``pmap'' interface),
1053 efficient memory utilization using copy-on-write
1054 and other lazy-evaluation techniques,
1055 and support for large, sparse address spaces.
1056 It does not include the ``external pager'' interface instead using
1057 a primitive internal pager interface.
1058 The Mach virtual memory system call interface has been replaced with the
1059 ``mmap''-based interface described in the ``Berkeley Software
1060 Architecture Manual'' (see UNIX Programmer's Manual,
1061 Supplementary Documents, PSD:5).
1062 The interface is similar to the interfaces shipped
1063 by several commercial vendors such as Sun, USL, and Convex Computer Corp.
1064 The integration of the new virtual memory is functionally complete,
1065 but still has serious performance problems under heavy memory load.
1066 The internal kernel interfaces have not yet been completed
1067 and the memory pool and buffer cache have not been merged.
1068 Some additional caveats:
1069 .IP \(bu
1070 Since the code is based on the 2.0 release of Mach,
1071 bugs and misfeatures of the BSD version should not be considered
1072 short-comings of the current Mach virtual memory system.
1073 .IP \(bu
1074 Because of the disjoint virtual memory (page) and IO (buffer) caches,
1075 it is possible to see inconsistencies if using both the mmap and
1076 read/write interfaces on the same file simultaneously.
1077 .IP \(bu
1078 Swap space is allocated on-demand rather than up front and no
1079 allocation checks are performed so it is possible to over-commit
1080 memory and eventually deadlock.
1081 .IP \(bu
1082 The semantics of the
1083 .Xr vfork (2)
1084 system call are slightly different.
1085 The synchronization between parent and child is preserved,
1086 but the memory sharing aspect is not.
1087 In practice this has been enough for backward compatibility,
1088 but newer code should just use
1089 .Xr fork (2).
1090 .Sh 4 "Networking additions and changes"
1091 .PP
1092 The ISO/OSI Networking consists of a kernel implementation of
1093 transport class 4 (TP-4),
1094 connectionless networking protocol (CLNP),
1095 and 802.3-based link-level support (hardware-compatible with Ethernet\**).
1096 .FS
1097 Ethernet is a trademark of the Xerox Corporation.
1098 .FE
1099 We also include support for ISO Connection-Oriented Network Service,
1100 X.25, TP-0.
1101 The session and presentation layers are provided outside
1102 the kernel using the ISO Development Environment by Marshall Rose,
1103 that is available via anonymous FTP
1104 (but is not included on the distribution tape).
1105 Included in this development environment are file
1106 transfer and management (FTAM), virtual terminals (VT),
1107 a directory services implementation (X.500),
1108 and miscellaneous other utilities.
1109 .PP
1110 Kernel support for the ISO OSI protocols is enabled with the ISO option
1111 in the kernel configuration file.
1112 The
1113 .Xr iso (4)
1114 manual page describes the protocols and addressing;
1115 see also
1116 .Xr clnp (4),
1117 .Xr tp (4)
1118 and
1119 .Xr cltp (4).
1120 The OSI equivalent to ARP is ESIS (End System to Intermediate System Routing
1121 Protocol); running this protocol is mandatory, however one can manually add
1122 translations for machines that do not participate by use of the
1123 .Xr route (8)
1124 command.
1125 Additional information is provided in the manual page describing
1126 .Xr esis (4).
1127 .PP
1128 The command
1129 .Xr route (8)
1130 has a new syntax and several new capabilities:
1131 it can install routes with a specified destination and mask,
1132 and can change route characteristics such as hop count, packet size
1133 and window size.
1134 .PP
1135 Several important enhancements have been added to the TCP/IP
1136 protocols including TCP header prediction and
1137 serial line IP (SLIP) with header compression.
1138 The routing implementation has been completely rewritten
1139 to use a hierarchical routing tree with a mask per route
1140 to support the arbitrary levels of routing found in the ISO protocols.
1141 The routing table also stores and caches route characteristics
1142 to speed the adaptation of the throughput and congestion avoidance
1143 algorithms.
1144 .PP
1145 The format of the
1146 .I sockaddr
1147 structure (the structure used to describe a generic network address with an
1148 address family and family-specific data)
1149 has changed from previous releases,
1150 as have the address family-specific versions of this structure.
1151 The
1152 .I sa_family
1153 family field has been split into a length,
1154 .Pn sa_len ,
1155 and a family,
1156 .Pn sa_family .
1157 System calls that pass a
1158 .I sockaddr
1159 structure into the kernel (e.g.
1160 .Fn sendto
1161 and
1162 .Fn connect )
1163 have a separate parameter that specifies the
1164 .I sockaddr
1165 length, and thus it is not necessary to fill in the
1166 .I sa_len
1167 field for those system calls.
1168 System calls that pass a
1169 .I sockaddr
1170 structure back from the kernel (e.g.
1171 .Fn recvfrom
1172 and
1173 .Fn accept )
1174 receive a completely filled-in
1175 .I sockaddr
1176 structure, thus the length field is valid.
1177 Because this would not work for old binaries,
1178 the new library uses a different system call number.
1179 Thus, most networking programs compiled under \*(4B are incompatible
1180 with older systems.
1181 .PP
1182 Although this change is mostly source and binary compatible
1183 with old programs, there are three exceptions.
1184 Programs with statically initialized
1185 .I sockaddr
1186 structures
1187 (usually the Internet form, a
1188 .I sockaddr_in )
1189 are not compatible.
1190 Generally, such programs should be changed to fill in the structure
1191 at run time, as C allows no way to initialize a structure without
1192 assuming the order and number of fields.
1193 Also, programs with use structures to describe a network packet format
1194 that contain embedded
1195 .I sockaddr
1196 structures also require change; a definition of an
1197 .I osockaddr
1198 structure is provided for this purpose.
1199 Finally, programs that use the
1200 .Sm SIOCGIFCONF
1201 ioctl to get a complete list of interface addresses
1202 need to check the
1203 .I sa_len
1204 field when iterating through the array of addresses returned,
1205 as not all the structures returned have the same length
1206 (this variance in length is nearly guaranteed by the presence of link-layer
1207 address structures).
1208 .Sh 4 "Additions and changes to filesystems"
1209 .PP
1210 The \*(4B distribution contains most of the interfaces
1211 specified in the IEEE Std1003.1 system interface standard.
1212 Filesystem additions include IEEE Std1003.1 FIFOs,
1213 byte-range file locking, and saved user and group identifiers.
1214 .PP
1215 A new virtual filesystem interface has been added to the
1216 kernel to support multiple filesystems.
1217 In comparison with other interfaces,
1218 the Berkeley interface has been structured for more efficient support
1219 of filesystems that maintain state (such as the local filesystem).
1220 The interface has been extended with support for stackable
1221 filesystems done at UCLA.
1222 These extensions allow for filesystems to be layered on top of each
1223 other and allow new vnode operations to be added without requiring
1224 changes to existing filesystem implementations.
1225 For example,
1226 the umap filesystem (see
1227 .Xr mount_umap (8))
1228 is used to mount a sub-tree of an existing filesystem
1229 that uses a different set of uids and gids than the local system.
1230 Such a filesystem could be mounted from a remote site via NFS or it
1231 could be a filesystem on removable media brought from some foreign
1232 location that uses a different password file.
1233 .PP
1234 Other new filesystems that may be stacked include the loopback filesystem
1235 .Xr mount_lofs (8),
1236 and the kernel filesystem
1237 .Xr mount_kernfs (8).
1238 .PP
1239 The buffer cache in the kernel is now organized as a file block cache
1240 rather than a device block cache.
1241 As a consequence, cached blocks from a file
1242 and from the corresponding block device would no longer be kept consistent.
1243 The block device thus has little remaining value.
1244 Three changes have been made for these reasons:
1245 .IP 1)
1246 block devices may not be opened while they are mounted,
1247 and may not be mounted while open, so that the two versions of cached
1248 file blocks cannot be created,
1249 .IP 2)
1250 filesystem checks of the root now use the raw device
1251 to access the root filesystem, and
1252 .IP 3)
1253 the root filesystem is initially mounted read-only
1254 so that nothing can be written back to disk during or after change to
1255 the raw filesystem by
1256 .Xr fsck .
1257 .LP
1258 The root filesystem may be made writable while in single-user mode
1259 with the command:
1260 .DS
1261 .ft CW
1262 mount \-uw /
1263 .DE
1264 The mount command has an option to update the flags on a mounted filesystem,
1265 including the ability to upgrade a filesystem from read-only to read-write
1266 or downgrade it from read-write to read-only.
1267 .PP
1268 In addition to the local ``fast filesystem'',
1269 we have added an implementation of the network filesystem (NFS)
1270 that fully interoperates with the NFS shipped by Sun and its licensees.
1271 Because our NFS implementation was implemented
1272 by Rick Macklem of the University of Guelph
1273 using only the publicly available NFS specification,
1274 it does not require a license from Sun to use in source or binary form.
1275 By default it runs over UDP to be compatible with Sun's implementation.
1276 However, it can be configured on a per-mount basis to run over TCP.
1277 Using TCP allows it to be used quickly and efficiently through
1278 gateways and over long-haul networks.
1279 Using an extended protocol, it supports Leases to allow a limited
1280 callback mechanism that greatly reduces the network traffic necessary
1281 to maintain cache consistency between the server and its clients.
1282 Its use will be familiar to users of other implementations of NFS.
1283 See the manual pages
1284 .Xr mount (8),
1285 .Xr mountd (8),
1286 .Xr fstab (5),
1287 .Xr exports (5),
1288 .Xr netgroup (5),
1289 .Xr nfsd (8),
1290 .Xr nfsiod (8),
1291 and
1292 .Xr nfssvc (8).
1293 and the document ``The 4.4BSD NFS Implementation'' (SMM:6)
1294 for further information.
1295 The format of
1296 .Pn /etc/fstab
1297 has changed from previous \*(Bs releases
1298 to a blank-separated format to allow colons in pathnames.
1299 .PP
1300 A new local filesystem, the log-structured filesystem (LFS),
1301 has been added to the system.
1302 It provides near disk-speed output and fast crash recovery.
1303 This work is based, in part, on the LFS filesystem created
1304 for the Sprite operating system at Berkeley.
1305 While the kernel implementation is almost complete,
1306 only some of the utilities to support the
1307 filesystem have been written,
1308 so we do not recommend it for production use.
1309 See
1310 .Xr newlfs (8),
1311 .Xr mount_lfs (8)
1312 and
1313 .Xr lfs_cleanerd (8)
1314 for more information.
1315 For an in-depth description of the implementation and performance
1316 characteristics of log-structured filesystems in general,
1317 and this one in particular, see Dr. Margo Seltzer's doctoral thesis,
1318 available from the University of California Computer Science Department.
1319 .PP
1320 We have also added a memory-based filesystem that runs in
1321 pageable memory, allowing large temporary filesystems without
1322 requiring dedicated physical memory.
1323 .PP
1324 The local ``fast filesystem'' has been enhanced to do
1325 clustering that allows large pieces of files to be
1326 allocated contiguously resulting in near doubling
1327 of filesystem throughput.
1328 The filesystem interface has been extended to allow
1329 files and filesystems to grow to 2^63 bytes in size.
1330 The quota system has been rewritten to support both
1331 user and group quotas (simultaneously if desired).
1332 Quota expiration is based on time rather than
1333 the previous metric of number of logins over quota.
1334 This change makes quotas more useful on fileservers
1335 onto which users seldom login.
1336 .PP
1337 The system security has been greatly enhanced by the
1338 addition of additional file flags that permit a file to be
1339 marked as immutable or append only.
1340 Once set, these flags can only be cleared by the super-user
1341 when the system is running in insecure mode (normally, single-user).
1342 In addition to the immutable and append-only flags,
1343 the filesystem supports a new user-settable flag ``nodump''.
1344 (File flags are set using the
1345 .Xr chflags (1)
1346 utility.)
1347 When set on a file,
1348 .Xr dump (8)
1349 will omit the file from incremental backups
1350 but retain them on full backups.
1351 See the ``-h'' flag to
1352 .Xr dump (8)
1353 for details on how to change this default.
1354 The ``nodump'' flag is usually set on core dumps,
1355 system crash dumps, and object files generated by the compiler.
1356 Note that the flag is not preserved when files are copied
1357 so that installing an object file will cause it to be preserved.
1358 .PP
1359 The filesystem format used in \*(4B has several additions.
1360 Directory entries have an additional field,
1361 .Pn d_type ,
1362 that identifies the type of the entry
1363 (normally found in the
1364 .Pn st_mode
1365 field of the
1366 .Pn stat
1367 structure).
1368 This field is particularly useful for identifying
1369 directories without the need to use
1370 .Xr stat (2).
1371 .PP
1372 Short (less than sixty byte) symbolic links are now stored
1373 in the inode itself rather than in a separate data block.
1374 This saves disk space and makes access of symbolic links faster.
1375 Short symbolic links are not given a special type,
1376 so a user-level application is unaware of their special treatment.
1377 Unlike pre-\*(4B systems, symbolic links do
1378 not have an owner, group, access mode, times, etc.
1379 Instead, these attributes are taken from the directory that contains the link.
1380 The only attributes returned from an
1381 .Xr lstat (2)
1382 that refer to the symbolic link itself are the file type (S_IFLNK),
1383 size, blocks, and link count (always 1).
1384 .PP
1385 An implementation of an auto-mounter daemon,
1386 .Xr amd ,
1387 was contributed by Jan-Simon Pendry of the
1388 Imperial College of Science, Technology & Medicine.
1389 See the document ``AMD \- The 4.4BSD Automounter'' (SMM:13)
1390 for further information.
1391 .PP
1392 The directory
1393 .Pn /dev/fd
1394 contains special files
1395 .Pn 0
1396 through
1397 .Pn 63
1398 that, when opened, duplicate the corresponding file descriptor.
1399 The names
1400 .Pn /dev/stdin ,
1401 .Pn /dev/stdout
1402 and
1403 .Pn /dev/stderr
1404 refer to file descriptors 0, 1 and 2.
1405 See
1406 .Xr fd (4)
1407 and
1408 .Xr mount_fdesc (8)
1409 for more information.
1410 .Sh 4 "POSIX terminal driver changes"
1411 .PP
1412 The \*(4B system uses the IEEE P1003.1 (POSIX.1) terminal interface
1413 rather than the previous \*(Bs terminal interface.
1414 The terminal driver is similar to the System V terminal driver
1415 with the addition of the necessary extensions to get the
1416 functionality previously available in the \*(Ps terminal driver.
1417 Both the old
1418 .Xr ioctl
1419 calls and old options to
1420 .Xr stty (1)
1421 are emulated.
1422 This emulation is expected to be unavailable in many vendors releases,
1423 so conversion to the new interface is encouraged.
1424 .PP
1425 \*(4B also adds the IEEE Std1003.1 job control interface,
1426 that is similar to the \*(Ps job control interface,
1427 but adds a security model that was missing in the
1428 \*(Ps job control implementation.
1429 A new system call,
1430 .Fn setsid ,
1431 creates a job-control session consisting of a single process
1432 group with one member, the caller, that becomes a session leader.
1433 Only a session leader may acquire a controlling terminal.
1434 This is done explicitly via a
1435 .Sm TIOCSCTTY
1436 .Fn ioctl
1437 call, not implicitly by an
1438 .Fn open
1439 call.
1440 The call fails if the terminal is in use.
1441 Programs that allocate controlling terminals (or pseudo-terminals)
1442 require change to work in this environment.
1443 The versions of
1444 .Xr xterm
1445 provided in the X11R5 release includes the necessary changes.
1446 New library routines are available for allocating and initializing
1447 pseudo-terminals and other terminals as controlling terminal; see
1448 .Pn /usr/src/lib/libutil/pty.c
1449 and
1450 .Pn /usr/src/lib/libutil/login_tty.c .
1451 .PP
1452 The POSIX job control model formalizes the previous conventions
1453 used in setting up a process group.
1454 Unfortunately, this requires that changes be made in a defined order
1455 and with some synchronization that were not necessary in the past.
1456 Older job control shells (csh, ksh) will generally not operate correctly
1457 with the new system.
1458 .PP
1459 Most of the other kernel interfaces have been changed to correspond
1460 with the POSIX.1 interface, although that work is not complete.
1461 See the relevant manual pages and the IEEE POSIX standard.
1462 .Sh 4 "Native operating system compatibility"
1463 .PP
1464 Both the HP300 and SPARC ports feature the ability to run binaries
1465 built for the native operating system (HP-UX or SunOS) by emulating
1466 their system calls.
1467 Building an HP300 kernel with the HPUXCOMPAT and COMPAT_OHPUX options
1468 or a SPARC kernel with the COMPAT_SUNOS option will enable this feature
1469 (on by default in the generic kernel provided in the root filesystem image).
1470 Though this native operating system compatibility was provided by the
1471 developers as needed for their purposes and is by no means complete,
1472 it is complete enough to run several non-trivial applications including
1473 those that require HP-UX or SunOS shared libraries.
1474 For example, the vendor supplied X11 server and windowing environment
1475 can be used on both the HP300 and SPARC.
1476 .PP
1477 It is important to remember that merely copying over a native binary
1478 and executing it (or executing it directly across NFS) does not imply
1479 that it will run.
1480 All but the most trivial of applications are likely to require access
1481 to auxiliary files that do not exist under \*(4B (e.g.
1482 .Pn /etc/ld.so.cache )
1483 or have a slightly different format (e.g.
1484 .Pn /etc/passwd ).
1485 However, by using system call tracing and
1486 through creative use of symlinks,
1487 many problems can be tracked down and corrected.
1488 .PP
1489 The DECstation port also has code for ULTRIX emulation
1490 (kernel option ULTRIXCOMPAT, not compiled into the generic kernel)
1491 but it was used primarily for initially bootstrapping the port and
1492 has not been used since.
1493 Hence, some work may be required to make it generally useful.
1494 .Sh 3 "Changes to the utilities"
1495 .PP
1496 We have been tracking the IEEE Std1003.2 shell and utility work
1497 and have included prototypes of many of the proposed utilities
1498 based on draft 12 of the POSIX.2 Shell and Utilities document.
1499 Because most of the traditional utilities have been replaced
1500 with implementations conformant to the POSIX standards,
1501 you should realize that the utility software may not be as stable,
1502 reliable or well documented as in traditional Berkeley releases.
1503 In particular, almost the entire manual suite has been rewritten to
1504 reflect the POSIX defined interfaces, and in some instances
1505 it does not correctly reflect the current state of the software.
1506 It is also worth noting that, in rewriting this software, we have generally
1507 been rewarded with significant performance improvements.
1508 Most of the libraries and header files have been converted
1509 to be compliant with ANSI C.
1510 The shipped compiler (gcc) is a superset of ANSI C,
1511 but supports traditional C as a command-line option.
1512 The system libraries and utilities all compile
1513 with either ANSI or traditional C.
1514 .Sh 4 "Make and Makefiles"
1515 .PP
1516 This release uses a completely new version of the
1517 .Xr make
1518 program derived from the
1519 .Xr pmake
1520 program developed by the Sprite project at Berkeley.
1521 It supports existing makefiles, although certain incorrect makefiles
1522 may fail.
1523 The makefiles for the \*(4B sources make extensive use of the new
1524 facilities, especially conditionals and file inclusion, and are thus
1525 completely incompatible with older versions of
1526 .Xr make
1527 (but nearly all the makefiles are now trivial!).
1528 The standard include files for
1529 .Xr make
1530 are in
1531 .Pn /usr/share/mk .
1532 There is a
1533 .Pn bsd.README
1534 file in
1535 .Pn /usr/src/share/mk .
1536 .PP
1537 Another global change supported by the new
1538 .Xr make
1539 is designed to allow multiple architectures to share a copy of the sources.
1540 If a subdirectory named
1541 .Pn obj
1542 is present in the current directory,
1543 .Xr make
1544 descends into that directory and creates all object and other files there.
1545 We use this by building a directory hierarchy in
1546 .Pn /var/obj
1547 that parallels
1548 .Pn /usr/src .
1549 We then create the
1550 .Pn obj
1551 subdirectories in
1552 .Pn /usr/src
1553 as symbolic links to the corresponding directories in
1554 .Pn /var/obj .
1555 (This step is automated.
1556 The command ``make obj'' in
1557 .Pn /usr/src
1558 builds both the local symlink and the shadow directory,
1559 using
1560 .Pn /usr/obj ,
1561 that may be a symbolic link, as the root of the shadow tree.
1562 The use of
1563 .Pn /usr/obj
1564 is for historic reasons only, and the system make configuration files in
1565 .Pn /usr/share/mk
1566 can trivially be modified to use
1567 .Pn /var/obj
1568 instead.)
1569 We have one
1570 .Pn /var/obj
1571 hierarchy on the local system, and another on each
1572 system that shares the source filesystem.
1573 All the sources in
1574 .Pn /usr/src
1575 except for
1576 .Pn /usr/src/contrib
1577 and portions of
1578 .Pn /usr/src/old
1579 have been converted to use the new make and
1580 .Pn obj
1581 subdirectories;
1582 this change allows compilation for multiple
1583 architectures from the same source tree
1584 (that may be mounted read-only).
1585 .Sh 4 "Kerberos"
1586 .PP
1587 The Kerberos authentication system designed by MIT (version 5)
1588 is included in this release.
1589 See
1590 .Xr kerberos (8)
1591 for a general introduction.
1592 Pluggable Authentication Modules (PAM) can use Kerberos
1593 at the system administrator's discretion.
1594 If it is configured,
1595 apps such as 
1596 .Xr login (1),
1597 .Xr passwd (1),
1598 .Xr ftp (1)
1599 and
1600 .Xr ssh (1)
1601 can use it automatically.
1602 The file
1603 Each system needs the file
1604 .Pn /etc/krb5.conf
1605 to set its realm and local servers,
1606 and a private key stored in
1607 .Pn /etc/krb5.keytab
1608 (see
1609 .Xr ktutil (8)).
1610 The Kerberos server should be set up on a single,
1611 physically secure,
1612 server machine.
1613 Users and hosts may be added and modified with
1614 .Xr kadmin (8).
1615 .PP
1616 Note that the password-changing program
1617 .Xr passwd (1)
1618 can change the Kerberos password,
1619 if configured by the administrator using PAM.
1620 The
1621 .Li \-l
1622 option to
1623 .Xr passwd (1)
1624 changes the ``local'' password if one exists.
1625 .Sh 4 "Timezone support"
1626 .PP
1627 The timezone conversion code in the C library uses data files installed in
1628 .Pn /usr/share/zoneinfo
1629 to convert from ``GMT'' to various timezones.  The data file for the default
1630 timezone for the system should be copied to
1631 .Pn /etc/localtime .
1632 Other timezones can be selected by setting the TZ environment variable.
1633 .PP
1634 The data files initially installed in
1635 .Pn /usr/share/zoneinfo
1636 include corrections for leap seconds since the beginning of 1970.
1637 Thus, they assume that the
1638 kernel will increment the time at a constant rate during a leap second;
1639 that is, time just keeps on ticking.  The conversion routines will then
1640 name a leap second 23:59:60.  For purists, this effectively means that
1641 the kernel maintains TAI (International Atomic Time) rather than UTC
1642 (Coordinated Universal Time, aka GMT).
1643 .PP
1644 For systems that run current NTP (Network Time Protocol) implementations
1645 or that wish to conform to the letter of the POSIX.1 law, it is possible
1646 to rebuild the timezone data files so that leap seconds are not counted.
1647 (NTP causes the time to jump over a leap second, and POSIX effectively
1648 requires the clock to be reset by hand when a leap second occurs.
1649 In this mode, the kernel effectively runs UTC rather than TAI.)
1650 .PP
1651 The data files without leap second information
1652 are constructed from the source directory,
1653 .Pn /usr/src/share/zoneinfo .
1654 Change the variable REDO in Makefile
1655 from ``right'' to ``posix'', and then do
1656 .DS
1657 make obj        (if necessary)
1658 make
1659 make install
1660 .DE
1661 .PP
1662 You will then need to copy the correct default zone file to
1663 .Pn /etc/localtime ,
1664 as the old one would still have used leap seconds, and because the Makefile
1665 installs a default
1666 .Pn /etc/localtime
1667 each time ``make install'' is done.
1668 .PP
1669 It is possible to install both sets of timezone data files.  This results
1670 in subdirectories
1671 .Pn /usr/share/zoneinfo/right
1672 and
1673 .Pn /usr/share/zoneinfo/posix .
1674 Each contain a complete set of zone files.
1675 See
1676 .Pn /usr/src/share/zoneinfo/Makefile
1677 for details.
1678 .Sh 4 "Additions and changes to the libraries"
1679 .PP
1680 Notable additions to the libraries include functions to traverse a
1681 filesystem hierarchy, database interfaces to btree and hashing functions,
1682 a new, faster implementation of stdio and a radix and merge sort
1683 functions.
1684 .PP
1685 The
1686 .Xr fts (3)
1687 functions will do either physical or logical traversal of
1688 a file hierarchy as well as handle essentially infinite depth
1689 filesystems and filesystems with cycles.
1690 All the utilities in \*(4B which traverse file hierarchies
1691 have been converted to use
1692 .Xr fts (3).
1693 The conversion has always resulted in a significant performance
1694 gain, often of four or five to one in system time.
1695 .PP
1696 The
1697 .Xr dbopen (3)
1698 functions are intended to be a family of database access methods.
1699 Currently, they consist of
1700 .Xr hash (3),
1701 an extensible, dynamic hashing scheme,
1702 .Xr btree (3),
1703 a sorted, balanced tree structure (B+tree's), and
1704 .Xr recno (3),
1705 a flat-file interface for fixed or variable length records
1706 referenced by logical record number.
1707 Each of the access methods stores associated key/data pairs and
1708 uses the same record oriented interface for access.
1709 .PP
1710 The
1711 .Xr qsort (3)
1712 function has been rewritten for additional performance.
1713 In addition, three new types of sorting functions,
1714 .Xr heapsort (3),
1715 .Xr mergesort (3)
1716 and
1717 .Xr radixsort (3)
1718 have been added to the system.
1719 The
1720 .Xr mergesort
1721 function is optimized for data with pre-existing order,
1722 in which case it usually significantly outperforms
1723 .Xr qsort .
1724 The
1725 .Xr radixsort (3)
1726 functions are variants of most-significant-byte radix sorting.
1727 They take time linear to the number of bytes to be
1728 sorted, usually significantly outperforming
1729 .Xr qsort
1730 on data that can be sorted in this fashion.
1731 An implementation of the POSIX 1003.2 standard
1732 .Xr sort (1),
1733 based on
1734 .Xr radixsort ,
1735 is included in
1736 .Pn /usr/src/contrib/sort .
1737 .PP
1738 Some additional comments about the \*(4B C library:
1739 .IP \(bu
1740 The floating point support in the C library has been replaced
1741 and is now accurate.
1742 .IP \(bu
1743 The C functions specified by both ANSI C, POSIX 1003.1 and
1744 1003.2 are now part of the C library.
1745 This includes support for file name matching, shell globbing
1746 and both basic and extended regular expressions.
1747 .IP \(bu
1748 ANSI C multibyte and wide character support has been integrated.
1749 The rune functionality from the Bell Labs' Plan 9 system is provided
1750 as well.
1751 .IP \(bu
1752 The
1753 .Xr termcap (3)
1754 functions have been generalized and replaced with a general
1755 purpose interface named
1756 .Xr getcap (3).
1757 .IP \(bu
1758 The
1759 .Xr stdio (3)
1760 routines have been replaced, and are usually much faster.
1761 In addition, the
1762 .Xr funopen (3)
1763 interface permits applications to provide their own I/O stream
1764 function support.
1765 .PP
1766 The
1767 .Xr curses (3)
1768 library has been largely rewritten.
1769 Important additional features include support for scrolling and
1770 .Xr termios (3).
1771 .PP
1772 An application front-end editing library, named libedit, has been
1773 added to the system.
1774 .PP
1775 A superset implementation of the SunOS kernel memory interface library,
1776 libkvm, has been integrated into the system.
1777 .PP
1778 .Sh 4 "Additions and changes to other utilities"
1779 .PP
1780 There are many new utilities, offering many new capabilities,
1781 in \*(4B.
1782 Skimming through the section 1 and section 8 manual pages is sure
1783 to be useful.
1784 The additions to the utility suite include greatly enhanced versions of
1785 programs that display system status information, implementations of
1786 various traditional tools described in the IEEE Std1003.2 standard,
1787 new tools not previous available on Berkeley UNIX systems,
1788 and many others.
1789 Also, with only a very few exceptions, all the utilities from
1790 \*(Ps that included proprietary source code have been replaced,
1791 and their \*(4B counterparts are freely redistributable.
1792 Normally, this replacement resulted in significant performance
1793 improvements and the increase of the limits imposed on data by
1794 the utility as well.
1795 .PP
1796 A summary of specific additions and changes are as follows:
1797 .TS
1798 lfC l.
1799 amd     An auto-mounter implementation.
1800 ar      Replacement of the historic archive format with a new one.
1801 awk     Replaced by gawk; see /usr/src/old/awk for the historic version.
1802 bdes    Utility implementing DES modes of operation described in FIPS PUB 81.
1803 calendar        Addition of an interface for system calendars.
1804 cap_mkdb        Utility for building hashed versions of termcap style databases.
1805 cc      Replacement of pcc with gcc suite.
1806 chflags A utility for setting the per-file user and system flags.
1807 chfn    An editor based replacement for changing user information.
1808 chpass  An editor based replacement for changing user information.
1809 chsh    An editor based replacement for changing user information.
1810 cksum   The POSIX 1003.2 checksum utility; compatible with sum.
1811 column  A columnar text formatting utility.
1812 cp      POSIX 1003.2 compatible, able to copy special files.
1813 csh     Freely redistributable and 8-bit clean.
1814 date    User specified formats added.
1815 dd      New EBCDIC conversion tables, major performance improvements.
1816 dev_mkdb        Hashed interface to devices.
1817 dm      Dungeon master.
1818 find    Several new options and primaries, major performance improvements.
1819 fstat   Utility displaying information on files open on the system.
1820 ftpd    Connection logging added.
1821 hexdump A binary dump utility, superseding od.
1822 id      The POSIX 1003.2 user identification utility.
1823 inetd   Tcpmux added.
1824 jot     A text formatting utility.
1825 kdump   A system-call tracing facility.
1826 ktrace  A system-call tracing facility.
1827 kvm_mkdb        Hashed interface to the kernel name list.
1828 lam     A text formatting utility.
1829 lex     A new, freely redistributable, significantly faster version.
1830 locate  A database of the system files, by name, constructed weekly.
1831 logname The POSIX 1003.2 user identification utility.
1832 mail.local      New local mail delivery agent, replacing mail.
1833 make    Replaced with a new, more powerful make, supporting include files.
1834 man     Added support for man page location configuration.
1835 mkdep   A new utility for generating make dependency lists.
1836 mkfifo  The POSIX 1003.2 FIFO creation utility.
1837 mtree   A new utility for mapping file hierarchies to a file.
1838 nfsstat An NFS statistics utility.
1839 nvi     A freely redistributable replacement for the ex/vi editors.
1840 pax     The POSIX 1003.2 replacement for cpio and tar.
1841 printf  The POSIX 1003.2 replacement for echo.
1842 roff    Replaced by groff; see /usr/src/old/roff for the historic versions.
1843 rs      New utility for text formatting.
1844 shar    An archive building utility.
1845 sysctl  MIB-style interface to system state.
1846 tcopy   Fast tape-to-tape copying and verification.
1847 touch   Time and file reference specifications.
1848 tput    The POSIX 1003.2 terminal display utility.
1849 tr      Addition of character classes.
1850 uname   The POSIX 1003.2 system identification utility.
1851 vis     A filter for converting and displaying non-printable characters.
1852 xargs   The POSIX 1003.2 argument list constructor utility.
1853 yacc    A new, freely redistributable, significantly faster version.
1854 .TE
1855 .PP
1856 The new versions of
1857 .Xr lex (1)
1858 (``flex'') and
1859 .Xr yacc (1)
1860 (``zoo'') should be installed early on if attempting to
1861 cross-compile \*(4B on another system.
1862 Note that the new
1863 .Xr lex
1864 program is not completely backward compatible with historic versions of
1865 .Xr lex ,
1866 although it is believed that all documented features are supported.
1867 .PP
1868 The
1869 .Xr find
1870 utility has two new options that are important to be aware of if you
1871 intend to use NFS.
1872 The ``fstype'' and ``prune'' options can be used together to prevent
1873 find from crossing NFS mount points.
1874 See
1875 .Pn /etc/daily
1876 for an example of their use.
1877 .Sh 2 "Hints on converting from \*(Ps to \*(4B"
1878 .PP
1879 This section summarizes changes between
1880 \*(Ps and \*(4B that are likely to
1881 cause difficulty in doing the conversion.
1882 It does not include changes in the network;
1883 see section 5 for information on setting up the network.
1884 .PP
1885 Since the stat st_size field is now 64-bits instead of 32,
1886 doing something like:
1887 .DS
1888 .ft CW
1889 foo(st.st_size);
1890 .DE
1891 and then (improperly) defining foo with an ``int'' or ``long'' parameter:
1892 .DS
1893 .ft CW
1894 foo(size)
1895         int size;
1896 {
1897         ...
1898 }
1899 .DE
1900 will fail miserably (well, it might work on a little endian machine).
1901 This problem showed up in
1902 .Xr emacs (1)
1903 as well as several other programs.
1904 A related problem is improperly casting (or failing to cast)
1905 the second argument to
1906 .Xr lseek (2),
1907 .Xr truncate (2),
1908 or
1909 .Xr ftruncate (2)
1910 ala:
1911 .DS
1912 .ft CW
1913 lseek(fd, (long)off, 0);
1914 .DE
1915 or
1916 .DS
1917 .ft CW
1918 lseek(fd, 0, 0);
1919 .DE
1920 The best solution is to include
1921 .Pn <unistd.h>
1922 which has prototypes that catch these types of errors.
1923 .PP
1924 Determining the ``namelen'' parameter for a
1925 .Xr connect (2)
1926 call on a unix domain socket should use the ``SUN_LEN'' macro from
1927 .Pn <sys/un.h> .
1928 One old way that was used:
1929 .DS
1930 .ft CW
1931 addrlen = strlen(unaddr.sun_path) + sizeof(unaddr.sun_family);
1932 .DE
1933 no longer works as there is an additional
1934 .Pn sun_len
1935 field.
1936 .PP
1937 The kernel's limit on the number of open files has been
1938 increased from 20 to 64.
1939 It is now possible to change this limit almost arbitrarily.
1940 The standard I/O library
1941 autoconfigures to the kernel limit.
1942 Note that file (``_iob'') entries may be allocated by
1943 .Xr malloc
1944 from
1945 .Xr fopen ;
1946 this allocation has been known to cause problems with programs
1947 that use their own memory allocators.
1948 Memory allocation does not occur until after 20 files have been opened
1949 by the standard I/O library.
1950 .PP
1951 .Xr Select
1952 can be used with more than 32 descriptors
1953 by using arrays of \fBint\fPs for the bit fields rather than single \fBint\fPs.
1954 Programs that used
1955 .Xr getdtablesize
1956 as their first argument to
1957 .Xr select
1958 will no longer work correctly.
1959 Usually the program can be modified to correctly specify the number
1960 of bits in an \fBint\fP.
1961 Alternatively the program can be modified to use an array of \fBint\fPs.
1962 There are a set of macros available in
1963 .Pn <sys/types.h>
1964 to simplify this.
1965 See
1966 .Xr select (2).
1967 .PP
1968 Old core files will not be intelligible by the current debuggers
1969 because of numerous changes to the user structure
1970 and because the kernel stack has been enlarged.
1971 The
1972 .Xr a.out
1973 header that was in the user structure is no longer present.
1974 Locally-written debuggers that try to check the magic number
1975 will need to be changed.
1976 .PP
1977 Files may not be deleted from directories having the ``sticky'' (ISVTX) bit
1978 set in their modes
1979 except by the owner of the file or of the directory, or by the superuser.
1980 This is primarily to protect users' files in publicly-writable directories
1981 such as
1982 .Pn /tmp
1983 and
1984 .Pn /var/tmp .
1985 All publicly-writable directories should have their ``sticky'' bits set
1986 with ``chmod +t.''
1987 .PP
1988 The following two sections contain additional notes about
1989 changes in \*(4B that affect the installation of local files;
1990 be sure to read them as well.