Skip to content
Browse files

Fix additional bugs in original newgrp(1) implementation.

- Fix compile errors in conditionally compiled code
  (!(defined(BSD) && BSD >= 199306)) as noted by Anon Ymous.

- Don't do anything with the supplementary group list when the new and old
  groups are the same.  (Based on discussions with Anon Ymous.)

  + This fixes a potential bug in the conditionally compiled code
    (!(defined(BSD) && BSD >= 199306)).  In this case the new group
    is incorrectly added to the supplementary list on a system where
    the effective group is not in this list.

  + This also simplifies processing on systems where the effective
    group is normally in the supplementary list.

- Handle unexpected errors in the addgrp function more consistently
  by using warn(3) throughout the function.
  • Loading branch information...
1 parent 2ca0636 commit a506dd9df42daf4ae5aa0001799f346f67143b4e ginsbach committed Oct 28, 2007
Showing with 0 additions and 19,726 deletions.
  1. +0 −811 BUILDING
  2. +0 −428 Makefile
  3. +0 −16 Makefile.inc
  4. +0 −266 UPDATING
  5. +0 −8 bin/Makefile
  6. +0 −11 bin/Makefile.inc
  7. +0 −6 bin/cat/Makefile
  8. +0 −209 bin/cat/cat.1
  9. +0 −316 bin/cat/cat.c
  10. +0 −5 bin/chio/Makefile
  11. +0 −263 bin/chio/chio.1
  12. +0 −865 bin/chio/chio.c
  13. +0 −69 bin/chio/defs.h
  14. +0 −45 bin/chio/pathnames.h
  15. +0 −6 bin/chmod/Makefile
  16. +0 −291 bin/chmod/chmod.1
  17. +0 −214 bin/chmod/chmod.c
  18. +0 −7 bin/cp/Makefile
  19. +0 −222 bin/cp/cp.1
  20. +0 −540 bin/cp/cp.c
  21. +0 −60 bin/cp/extern.h
  22. +0 −349 bin/cp/utils.c
  23. +0 −56 bin/csh/Makefile
  24. +0 −12 bin/csh/USD.doc/Makefile
  25. +0 −1,010 bin/csh/USD.doc/csh.1
  26. +0 −1,303 bin/csh/USD.doc/csh.2
  27. +0 −648 bin/csh/USD.doc/csh.3
  28. +0 −176 bin/csh/USD.doc/csh.4
  29. +0 −93 bin/csh/USD.doc/csh.a
  30. +0 −1,719 bin/csh/USD.doc/csh.g
  31. +0 −32 bin/csh/USD.doc/tabs
  32. +0 −117 bin/csh/alloc.c
  33. +0 −314 bin/csh/char.c
  34. +0 −99 bin/csh/char.h
  35. +0 −163 bin/csh/const.c
  36. +0 −2,299 bin/csh/csh.1
  37. +0 −1,360 bin/csh/csh.c
  38. +0 −552 bin/csh/csh.h
  39. +0 −900 bin/csh/dir.c
  40. +0 −48 bin/csh/dir.h
  41. +0 −965 bin/csh/dol.c
  42. +0 −388 bin/csh/err.c
  43. +0 −745 bin/csh/exec.c
  44. +0 −661 bin/csh/exp.c
  45. +0 −333 bin/csh/extern.h
  46. +0 −726 bin/csh/file.c
Sorry, we could not display the entire diff because too many files (82,956) changed.
View
811 BUILDING
@@ -1,811 +0,0 @@
-BUILDING(8) NetBSD System Manager's Manual BUILDING(8)
-
-NAME
- BUILDING -- Procedure for building NetBSD from source code.
-
-REQUIREMENTS
- NetBSD is designed to be buildable on most POSIX-compliant host systems.
- The basic build procedure is the same whether compiling natively (on the
- same NetBSD architecture) or cross compiling (on another architecture or
- OS).
-
- This source tree contains a special subtree, ``tools'', which uses the
- host system to create a build toolchain for the target architecture. The
- host system must have at least C and C++ compilers in order to create the
- toolchain (make is not required); all other tools are created as part of
- the NetBSD build process. (See the environment variables section below
- if you need to override or manually select your compilers.)
-
-FILES
- Source tree layout
- doc/BUILDING.mdoc
- This document (in -mdoc troff format; the original copy).
-
- BUILDING This document (in plaintext).
-
- tools/compat/README
- Special notes for cross-hosting a NetBSD build on non-
- NetBSD platforms.
-
- Makefile The main Makefile for NetBSD; should only be run for
- native builds with an appropriately up-to-date version of
- NetBSD make(1). (For building from out-of-date systems or
- on a non-native host, see the build.sh shell script.)
-
- UPDATING Special notes for updating from an earlier revision of
- NetBSD. It is important to read this file before every
- build of an updated source tree.
-
- build.sh Bourne-compatible shell script used for building the host
- build tools and the NetBSD system from scratch. Can be
- used for both native and cross builds, and should be used
- instead of make(1) for any source tree that is updated and
- recompiled regularly.
-
- crypto/dist/, dist/, gnu/dist/
- Sources imported verbatim from third parties, without man-
- gling the existing build structure. Other source trees in
- bin through usr.sbin use the NetBSD make(1) ``reachover''
- Makefile semantics when building these programs for a
- native host.
-
- distrib/, etc/
- Sources for items used when making a full release snap-
- shot, such as files installed in DESTDIR/etc on the desti-
- nation system, boot media, and release notes.
-
- regress/ Regression test harness. Can be cross-compiled, but only
- run natively.
-
- sys/ NetBSD kernel sources.
-
- tools/ ``Reachover'' build structure for the host build tools.
- This has a special method of determining out-of-date sta-
- tus.
-
- bin/ ... usr.sbin/
- Sources to the NetBSD userland (non-kernel) programs. If
- any of these directories are missing, they will be skipped
- during the build.
-
- x11/ ``Reachover'' build structure for X11R6; the source is in
- X11SRCDIR.
-
- Build tree layout
- The NetBSD build tree is described in hier(7), and the release layout is
- described in release(7).
-
-CONFIGURATION
- Environment variables
- Several environment variables control the behaviour of NetBSD builds.
-
- HOST_SH Path name to a POSIX-compliant shell. If this is not
- set explicitly, then the default is set using heuris-
- tics dependent on the host platform, or from the shell
- under which build.sh is executed (if that can be deter-
- mined), or using the first copy of sh found in PATH.
- If the host system's /bin/sh is not POSIX-compliant, we
- suggest that you build using commands like
-
- HOST_SH=/path/to/working/shell
- export HOST_SH
- ${HOST_SH} build.sh [options]
-
- HOST_CC Path name to C compiler used to create the toolchain.
-
- HOST_CXX Path name to C++ compiler used to create the toolchain.
-
- MACHINE Machine type.
-
- MACHINE_ARCH Machine architecture.
-
- MAKE Path name to invoke make(1) as.
-
- MAKEFLAGS Flags to invoke make(1) with.
-
- MAKEOBJDIR Directory to use as the .OBJDIR for the current direc-
- tory. The value is subjected to variable expansion by
- make(1). Used only if MAKEOBJDIRPREFIX is not defined.
- MAKEOBJDIR can only be provided in the environment or
- via the -O flag of build.sh.
-
- MAKEOBJDIRPREFIX Top level directory of the object directory tree. If
- specified, must be an absolute path. If this is
- defined, ${MAKEOBJDIRPREFIX}/${.CURDIR} is used as the
- .OBJDIR for the current directory. The current direc-
- tory may be read only. MAKEOBJDIRPREFIX can only be
- provided in the environment or via the -M flag of
- build.sh.
-
- "make" variables
- Several variables control the behavior of NetBSD builds. Unless other-
- wise specified, these variables may be set in either the process environ-
- ment or the make(1) configuration file specified by MAKECONF.
-
- BUILDID Identifier for the build. The identifier will be appended to
- object directory names, and can be consulted in the make(1)
- configuration file in order to set additional build parame-
- ters, such as compiler flags.
-
- DESTDIR Directory to contain the built NetBSD system. If set, spe-
- cial options are passed to the compilation tools to prevent
- their default use of the host system's /usr/include,
- /usr/lib, and so forth. This pathname must be an absolute
- path, and should not end with a slash (/) character. (For
- installation into the system's root directory, set DESTDIR to
- an empty string, not to ``/''). The directory must reside on
- a file system which supports long file names and hard links.
-
- Default: Empty string if USETOOLS is ``yes''; unset other-
- wise.
-
- Note: build.sh will provide a default of destdir.MACHINE (in
- the top-level .OBJDIR) unless run in `expert' mode
-
- MAKECONF The name of the make(1) configuration file. Only settable in
- the process environment.
-
- Default: ``/etc/mk.conf''
-
- MAKEVERBOSE
- Level of verbosity of status messages. Supported values:
-
- 0 No descriptive messages are shown.
-
- 1 Descriptive messages are shown.
-
- 2 Descriptive messages (prefixed with a `#') and command
- output is not suppressed.
-
- Default: 2
-
- MKCATPAGES Can be set to ``yes'' or ``no''. Indicates whether prefor-
- matted plaintext manual pages will be created during a build.
-
- Default: ``yes''
-
- MKCRYPTO Can be set to ``yes'' or ``no''. Indicates whether crypto-
- graphic code will be included in a build; provided for the
- benefit of countries that do not allow strong cryptography.
- Will not affect use of the standard low-security password
- encryption system, crypt(3).
-
- Default: ``yes''
-
- MKDOC Can be set to ``yes'' or ``no''. Indicates whether system
- documentation destined for DESTDIR/usr/share/doc will be
- installed during a build.
-
- Default: ``yes''
-
- MKHOSTOBJ Can be set to ``yes'' or ``no''. If set to ``yes'', then for
- programs intended to be run on the compile host, the name,
- release, and architecture of the host operating system will
- be suffixed to the name of the object directory created by
- ``make obj''. (This allows multiple host systems to compile
- NetBSD for a single target.) If set to ``no'', then programs
- built to be run on the compile host will use the same object
- directory names as programs built to be run on the target.
-
- Default: ``no''
-
- MKINFO Can be set to ``yes'' or ``no''. Indicates whether GNU Info
- files, used for the documentation for most of the compilation
- tools, will be created and installed during a build.
-
- Default: ``yes''
-
- MKLINT Can be set to ``yes'' or ``no''. Indicates whether lint(1)
- will be run against portions of the NetBSD source code during
- the build, and whether lint libraries will be installed into
- DESTDIR/usr/libdata/lint.
-
- Default: ``yes''
-
- MKMAN Can be set to ``yes'' or ``no''. Indicates whether manual
- pages will be installed during a build.
-
- Default: ``yes''
-
- MKNLS Can be set to ``yes'' or ``no''. Indicates whether Native
- Language System locale zone files will be compiled and
- installed during a build.
-
- Default: ``yes''
-
- MKOBJ Can be set to ``yes'' or ``no''. Indicates whether object
- directories will be created when running ``make obj''. If
- set to ``no'', then all built files will be located inside
- the regular source tree.
-
- Default: ``yes''
-
- MKPIC Can be set to ``yes'' or ``no''. Indicates whether shared
- objects and libraries will be created and installed during a
- build. If set to ``no'', the entire built system will be
- statically linked.
-
- Default: Platform dependent. As of this writing, all plat-
- forms except sh3 default to ``yes''.
-
- MKPICINSTALL
- Can be set to ``yes'' or ``no''. Indicates whether the ar(1)
- format libraries (lib*_pic.a), used to generate shared
- libraries, are installed during a build.
-
- Default: ``yes''
-
- MKPROFILE Can be set to ``yes'' or ``no''. Indicates whether profiled
- libraries (lib*_p.a) will be built and installed during a
- build.
-
- Default: ``yes''; however, some platforms turn off MKPROFILE
- by default at times due to toolchain problems with profiled
- code.
-
- MKSHARE Can be set to ``yes'' or ``no''. Indicates whether files
- destined to reside in DESTDIR/usr/share will be built and
- installed during a build. If set to ``no'', then all of
- MKCATPAGES, MKDOC, MKINFO, MKMAN, and MKNLS will be set to
- ``no'' unconditionally.
-
- Default: ``yes''
-
- MKTTINTERP Can be set to ``yes'' or ``no''. For X builds, decides if
- the TrueType bytecode interpreter is turned on. See
- http://www.freetype.org/patents.html for details.
-
- Default: ``no''
-
- MKUNPRIVED Can be set to ``yes'' or ``no''. Indicates whether an
- unprivileged install will occur. The user, group, permis-
- sions, and file flags, will not be set on the installed
- items; instead the information will be appended to a file
- called METALOG in DESTDIR. The contents of METALOG are used
- during the generation of the distribution tar files to ensure
- that the appropriate file ownership is stored.
-
- Default: ``no''
-
- MKUPDATE Can be set to ``yes'' or ``no''. Indicates whether all
- install operations intended to write to DESTDIR will compare
- file timestamps before installing, and skip the install phase
- if the destination files are up-to-date. This also has
- implications on full builds (see next subsection).
-
- Default: ``no''
-
- MKX11 Can be set to ``yes'' or ``no''. Indicates whether X11R6 is
- built from X11SRCDIR.
-
- Default: ``no''
-
- TOOLDIR Directory to hold the host tools, once built. If specified,
- must be an absolute path. This directory should be unique to
- a given host system and NetBSD source tree. (However, multi-
- ple targets may share the same TOOLDIR; the target-dependent
- files have unique names.) If unset, a default based on the
- uname(1) information of the host platform will be created in
- the .OBJDIR of src.
-
- Default: Unset.
-
- USETOOLS Indicates whether the tools specified by TOOLDIR should be
- used as part of a build in progress. Must be set to ``yes''
- if cross-compiling.
-
- yes Use the tools from TOOLDIR.
-
- no Do not use the tools from TOOLDIR, but refuse to build
- native compilation tool components that are version-
- specific for that tool.
-
- never Do not use the tools from TOOLDIR, even when building
- native tool components. This is similar to the tradi-
- tional NetBSD build method, but does not verify that
- the compilation tools in use are up-to-date enough in
- order to build the tree successfully. This may cause
- build or runtime problems when building the whole
- NetBSD source tree.
-
- Default: ``yes'' if building all or part of a whole NetBSD
- source tree (detected automatically); ``no'' otherwise (to
- preserve traditional semantics of the <bsd.*.mk> make(1)
- include files).
-
- X11SRCDIR Directory containing the X11R6 source. If specified, must be
- an absolute path. The main X11R6 source is found in
- X11SRCDIR/xfree/xc.
-
- Default: ``/usr/xsrc''
-
- "make" variables for full builds
- These variables only affect the top level ``Makefile'' and do not affect
- manually building subtrees of the NetBSD source code.
-
- INSTALLWORLDDIR Location for the ``make installworld'' target to install
- to. If specified, must be an absolute path.
-
- Default: ``/''
-
- MKOBJDIRS Can be set to ``yes'' or ``no''. Indicates whether
- object directories will be created automatically (via a
- ``make obj'' pass) at the start of a build.
-
- Default: ``no''
-
- MKUPDATE Can be set to ``yes'' or ``no''. If set, then in addi-
- tion to the effects described for MKUPDATE=yes above,
- this implies the effects of NOCLEANDIR (i.e., ``make
- cleandir'' is avoided).
-
- Default: ``no''
-
- NBUILDJOBS Now obsolete. Use the make(1) option -j, instead (see
- below)
-
- Default: Unset.
-
- NOCLEANDIR If set, avoids the ``make cleandir'' phase of a full
- build. This has the effect of allowing only changed
- files in a source tree to be recompiled. This can speed
- up builds when updating only a few files in the tree.
-
- Default: Unset.
-
- NODISTRIBDIRS If set, avoids the ``make distrib-dirs'' phase of a full
- build. This skips running mtree(8) on DESTDIR, useful
- on systems where building as an unprivileged user, or
- where it is known that the system-wide mtree files have
- not changed.
-
- Default: Unset.
-
- NOINCLUDES If set, avoids the ``make includes'' phase of a full
- build. This has the effect of preventing make(1) from
- thinking that some programs are out-of-date simply
- because the system include files have changed. However,
- this option should not be used when updating the entire
- NetBSD source tree arbitrarily; it is suggested to use
- MKUPDATE=yes in that case.
-
- Default: Unset.
-
- RELEASEDIR If set, specifies the directory to which a release(7)
- layout will be written at the end of a ``make release''.
- If specified, must be an absolute path.
-
- Default: Unset.
-
- Note: build.sh will provide a default of releasedir (in
- the top-level .OBJDIR) unless run in `expert' mode
-
-BUILDING
- "make" command line options
- This is not a summary of all the options available to make(1); only the
- options used most frequently with NetBSD builds are listed here.
-
- -j njob Run up to njob make(1) subjobs in parallel. Makefiles should
- use .WAIT or have explicit dependencies as necessary to
- enforce build ordering. If you see build failures with -j,
- please save complete build logs so the failures can be ana-
- lyzed.
-
- -m dir Specify the default directory for searching for system Make-
- file segments, mainly the <bsd.*.mk> files. When building any
- full NetBSD source tree, this should be set to the
- ``share/mk'' directory in the source tree. (This is set auto-
- matically when building from the top level.)
-
- -n Display the commands that would have been executed, but do not
- actually execute them. This will still cause recursion to
- take place.
-
- -V var Print make(1)'s idea of the value of var. Does not build any
- targets.
-
- var=value Set the variable var to value, overriding any setting speci-
- fied by the process environment, the MAKECONF configuration
- file, or the system Makefile segments.
-
- "make" targets
- These default targets may be built by running make(1) in any subtree of
- the NetBSD source code. It is recommended that none of these be used
- from the top level Makefile; as a specific exception, ``make obj'' and
- ``make cleandir'' are useful in that context.
-
- all Build programs, libraries, and preformatted documentation.
-
- clean Remove program and library object code files.
-
- cleandir Same as clean, but also remove preformatted documentation,
- dependency files generated by ``make depend'', and any other
- files known to be created at build time.
-
- depend Create dependency files (.depend) containing more detailed
- information about the dependencies of source code on header
- files. Allows programs to be recompiled automatically when a
- dependency changes.
-
- dependall Does a ``make depend'' immediately followed by a ``make all''.
- This improves cache locality of the build since both passes
- read the source files in their entirety.
-
- distclean Synonym for cleandir.
-
- includes Build and install system header files. Typically needed
- before any system libraries or programs can be built.
-
- install Install programs, libraries, and documentation into DESTDIR.
- Few files will be installed to DESTDIR/dev, DESTDIR/etc,
- DESTDIR/root or DESTDIR/var in order to prevent user supplied
- configuration data from being overwritten.
-
- lint Run lint(1) against the C source code, where appropriate, and
- generate system-installed lint libraries.
-
- obj Create object directories to be used for built files, instead
- of building directly in the source tree.
-
- tags Create ctags(1) searchable function lists usable by the ex(1)
- and vi(1) text editors.
-
- "make" targets for the top level
- Additional make(1) targets are usable specifically from the top source
- level to facilitate building the entire NetBSD source tree.
-
- build Build the entire NetBSD system. This orders portions of
- the source tree such that prerequisites will be built in
- the proper order.
-
- distribution Do a ``make build'', and then install a full distribution
- into DESTDIR, including files in DESTDIR/dev, DESTDIR/etc,
- DESTDIR/root and DESTDIR/var.
-
- buildworld As per ``make distribution'', except that it ensures that
- DESTDIR is not the root directory.
-
- installworld Install the distribution from DESTDIR to INSTALLWORLDDIR
- (which defaults to the root directory). Ensures that
- INSTALLWORLDDIR is not the root directory if cross compil-
- ing.
-
- The INSTALLSETS environment variable may be set to a list
- of distribution sets to be installed. By default, all sets
- except ``etc'' and ``xetc'' are installed (so most files in
- INSTALLWORLDDIR/etc will not be installed or modified).
-
- Note: Before performing this operation with
- INSTALLWORLDDIR=/, it is highly recommended that you
- upgrade your kernel and reboot. After performing this
- operation, it is recommended that you use etcupdate(8) to
- update files in INSTALLWORLDDIR/etc and that you use
- postinstall(8) to check for inconsistencies (and possibly
- to fix them).
-
- sets Create distribution sets from DESTDIR into
- RELEASEDIR/MACHINE/binary/sets. Should be run after ``make
- distribution'' (as ``make build'' does not install all of
- the required files).
-
- sourcesets Create source sets of the source tree into
- RELEASEDIR/source/sets.
-
- syspkgs Create syspkgs from DESTDIR into
- RELEASEDIR/MACHINE/binary/syspkgs. Should be run after
- ``make distribution'' (as ``make build'' does not install
- all of the required files).
-
- release Do a ``make distribution'', build kernels, distribution
- media, and install sets (this as per ``make sets''), and
- then package the system into a standard release layout as
- described by release(7). This requires that RELEASEDIR be
- set (see above).
-
- iso-image Create a NetBSD installation CD-ROM image in the
- RELEASEDIR/iso directory. The CD-ROM file system will have
- a layout as described in release(7).
-
- For most machine types, the CD-ROM will be bootable, and
- will automatically run the sysinst(8) menu-based installa-
- tion program, which can be used to install or upgrade a
- NetBSD system. Bootable CD-ROMs also contain tools that
- may be useful in repairing a damaged NetBSD installation.
-
- Before ``make iso-image'' is attempted, RELEASEDIR must be
- populated by ``make release'' or equivalent.
-
- Note that other, smaller, CD-ROM images may be created in
- the RELEASEDIR/MACHINE/installation/cdrom directory by
- ``make release''. These smaller images usually contain the
- same tools as the larger images in RELEASEDIR/iso, but do
- not contain additional content such as the distribution
- sets.
-
- Note that the mac68k port still uses an older method of
- creating CD-ROM images. This requires the mkisofs(1) util-
- ity, which is not part of NetBSD, but which can be
- installed from pkgsrc/sysutils/cdrtools.
-
- iso-image-source
- Create a NetBSD installation CD-ROM image in the
- RELEASEDIR/iso directory. The CD-ROM file system will have
- a layout as described in release(7). It will have top
- level directories for the machine type and source.
-
- For most machine types, the CD-ROM will be bootable, and
- will automatically run the sysinst(8) menu-based installa-
- tion program, which can be used to install or upgrade a
- NetBSD system. Bootable CD-ROMs also contain tools that
- may be useful in repairing a damaged NetBSD installation.
-
- Before ``make iso-image-source'' is attempted, RELEASEDIR
- must be populated by ``make sourcesets release'' or equiva-
- lent.
-
- Note that other, smaller, CD-ROM images may be created in
- the RELEASEDIR/MACHINE/installation/cdrom directory by
- ``make release''. These smaller images usually contain the
- same tools as the larger images in RELEASEDIR/iso, but do
- not contain additional content such as the distribution
- sets.
-
- Note that the mac68k port still uses an older method of
- creating CD-ROM images. This requires the mkisofs(1) util-
- ity, which is not part of NetBSD, but which can be
- installed from pkgsrc/sysutils/cdrtools.
-
- regression-tests
- Can only be run after building the regression tests in the
- directory ``regress''. Runs the compiled regression tests
- on the local host.
-
- The "build.sh" script
- This script file is a Bourne shell script designed to build the entire
- NetBSD system on any host with a Bourne shell in /bin/sh, including many
- that are not POSIX compliant. Note that if a host system's /bin/sh is
- unusually old and broken, the Korn Shell (/bin/ksh), if available, may be
- a usable alternative.
-
- All cross-compile builds, and most native builds, of the entire system
- should make use of build.sh rather than just running ``make''. This way,
- the make(1) program will be bootstrapped properly, in case the host sys-
- tem has an older or incompatible ``make'' program.
-
- When compiling the entire system via build.sh, many make(1) variables are
- set for you in order to help encapsulate the build process. In the list
- of options below, variables that are automatically set by build.sh are
- noted where applicable.
-
- The following operations are supported by build.sh:
-
- build Build the system as per ``make build''. This option
- implies the obj and tools operations.
-
- distribution Build a full distribution as per ``make distribution''.
- This option implies the build operation.
-
- release Build a full release as per ``make release''. This option
- implies the distribution operation.
-
- makewrapper Create the nbmake-MACHINE wrapper. This operation is auto-
- matically performed for any of the other operations.
-
- obj Perform ``make obj''.
-
- tools Build and install the host tools from src/tools.
-
- install=idir Install the contents of DESTDIR to idir, using ``make
- installworld''. Note that files that are part of the
- ``etc'' or ``xetc'' sets will not be installed.
-
- kernel=kconf Build a new kernel. The kconf argument is the name of a
- configuration file suitable for use by config(1). If kconf
- does not contain any `/' characters, the configuration file
- is expected to be found in the KERNCONFDIR directory, which
- is typically sys/arch/MACHINE/conf. The new kernel will be
- built in a subdirectory of KERNOBJDIR, which is typically
- sys/arch/MACHINE/compile or an associated object directory.
- In order to ensure that the kernel is built using up-to-
- date tools, it is strongly recommended that the tools be
- rebuilt (using the tools operation).
-
- releasekernel=kconf
- Install a gzip(1)ed copy of the kernel built by
- kernel=kconf into RELEASEDIR/MACHINE/binary/kernel, usually
- as netbsd-kconf.gz, although the ``netbsd'' prefix is
- determined from the ``config'' directives in kconf.
-
- sets Perform ``make sets''.
-
- sourcesets Perform ``make sourcesets''.
-
- syspkgs Perform ``make syspkgs''.
-
- iso-image Perform ``make iso-image''.
-
- iso-image-source
- Perform ``make iso-image-source''.
-
- The following command line options alter the behaviour of the build.sh
- operations described above:
-
- -a arch Set the value of MACHINE_ARCH to arch.
-
- -B buildid
- Set the value of BUILDID to buildid. This will also append the
- build idenfitier to the name of the ``make'' wrapper script so
- that the resulting name is of the form
- ``nbmake-MACHINE-BUILDID''.
-
- -C cddir Set the value of CDEXTRA to cddir. If a relative path is spec-
- ified, it will be converted to an absolute path before being
- used. When combined with ``iso-image'' or
- ``iso-image-source'', it will cause the contents of cddir to be
- added to the CD-ROM image.
-
- -D dest Set the value of DESTDIR to dest. If a relative path is speci-
- fied, it will be converted to an absolute path before being
- used.
-
- -E Set `expert' mode. This overrides various sanity checks, and
- allows: DESTDIR does not have to be set to a non-root path for
- builds, and MKUNPRIVED=yes does not have to be set when build-
- ing as a non-root user.
-
- Note: It is highly recommended that you know what you are doing
- when you use this option.
-
- -h Print a help message.
-
- -j njob Passed through to make(1). Makefiles should use .WAIT or have
- explicit dependancies as necessary to enforce build ordering.
- If you see build failures with -j, please save complete build
- logs so the failures can be analyzed.
-
- -M obj Set MAKEOBJDIRPREFIX to obj. If a relative path is specified,
- it will be converted to an absolute path before being used.
- Unsets MAKEOBJDIR.
-
- -m mach Set the value of MACHINE to mach, except in some special cases
- listed below. This will also override any value of
- MACHINE_ARCH in the process environment with a value deduced
- from mach, unless -a is specified. All cross builds require
- -m, but if unset on a NetBSD host, the host's value of MACHINE
- will be detected and used automatically.
-
- Some machines support multiple values for MACHINE_ARCH. The
- following special cases for the mach argument are defined to
- set the listed values of MACHINE and MACHINE_ARCH:
-
- mach MACHINE MACHINE_ARCH
- evbarm evbarm (not set)
- evbarm-eb evbarm armeb
- evbarm-el evbarm arm
- evbmips evbmips (not set)
- evbmips-eb evbmips mipseb
- evbmips-el evbmips mipsel
- evbsh3 evbsh3 (not set)
- evbsh3-eb evbsh3 sh3eb
- evbsh3-el evbsh3 sh3el
- sbmips sbmips (not set)
- sbmips-eb sbmips mipseb
- sbmips-el sbmips mipsel
-
- -N noiselevel
- Set the ``noisyness'' level of the build, by setting
- MAKEVERBOSE to noiselevel.
-
- -n Show the commands that would be executed by build.sh, but do
- not make any changes. This is similar in concept to ``make
- -n''.
-
- -O obj Create an appropriate transform macro for MAKEOBJDIR that will
- place the built object files under obj. If a relative path is
- specified, it will be converted to an absolute path before
- being used. For instance, a setting of /usr/obj will place
- build-time files under /usr/obj/bin, /usr/obj/lib,
- /usr/obj/usr.bin, and so forth. Unsets MAKEOBJDIRPREFIX.
-
- -o Set the value of MKOBJDIRS to ``no''. Otherwise, it will be
- automatically set to ``yes'' (which is opposite to the default
- behaviour).
-
- -R rel Set the value of RELEASEDIR to rel. If a relative path is
- specified, it will be converted to an absolute path before
- being used.
-
- -r Remove the contents of DESTDIR and TOOLDIR before building
- (provides a clean starting point). This will skip deleting
- DESTDIR if building on a native system to the root directory.
-
- -T tools Set the value of TOOLDIR to tools. If a relative path is spec-
- ified, it will be converted to an absolute path before being
- used. If set, the bootstrap ``make'' will only be rebuilt as
- needed (when the source files for make(1) change).
-
- -U Set MKUNPRIVED=yes.
-
- -u Set MKUPDATE=yes.
-
- -V var=[value]
- Set the environment variable var to an optional value. This is
- propagated to the nbmake wrapper.
-
- -w wrapper
- Create the nbmake wrapper script (see below) in a custom loca-
- tion, specified by wrapper. This allows, for instance, to
- place the wrapper in PATH automatically. Note that wrapper is
- the full name of the file, not just a directory name. If a
- relative path is specified, it will be converted to an absolute
- path before being used.
-
- -X x11src
- Set the value of X11SRCDIR to x11src. If a relative path is
- specified, it will be converted to an absolute path before
- being used.
-
- -x Set MKX11=yes.
-
- -Z var Unset ("zap") the environment variable var. This is propagated
- to the nbmake wrapper.
-
- The "nbmake-MACHINE" wrapper script
- If using the build.sh script to build NetBSD, a nbmake-MACHINE script
- will be created in TOOLDIR/bin upon the first build to assist in building
- subtrees on a cross-compile host.
-
- nbmake-MACHINE can be invoked in lieu of make(1), and will instead call
- the up-to-date version of ``nbmake'' installed into TOOLDIR/bin with sev-
- eral key variables pre-set, including MACHINE, MACHINE_ARCH, and TOOLDIR.
- build.sh will also set variables specified with -V, and unset variables
- specified with -Z.
-
- This script can be symlinked into a directory listed in PATH, or called
- with an absolute path.
-
-EXAMPLES
- 1. % ./build.sh tools kernel=GENERIC
-
- Build a new toolchain, and use the new toolchain to configure and
- build a new GENERIC kernel.
-
- 2. % ./build.sh -U distribution
-
- Using unprivileged mode, build a complete distribution to a DESTDIR
- directory that build.sh selects (and will display).
-
- 3. # ./build.sh -U install=/
-
- As root, install to / the distribution that was built by example 2.
- Even though this is run as root, -U is required so that the permis-
- sions stored in DESTDIR/METALOG are correctly applied to the files
- as they're copied to /.
-
- 4. % ./build.sh -U -u release
-
- Using unprivileged mode, build a complete release to DESTDIR and
- RELEASEDIR directories that build.sh selects (and will display).
- MKUPDATE=yes (-u) is set to prevent the ``make cleandir'', so that
- if this is run after example 2, it doesn't need to redo that portion
- of the release build.
-
-OBSOLETE VARIABLES
- NBUILDJOBS Use the make(1) option -j, instead.
-
- USE_NEW_TOOLCHAIN
- The new toolchain is now the default. To disable, use
- TOOLCHAIN_MISSING=yes.
-
-SEE ALSO
- make(1), hier(7), release(7), etcupdate(8), postinstall(8), sysinst(8),
- pkgsrc/sysutils/cdrtools
-
-HISTORY
- The build.sh based build scheme was introduced for NetBSD 1.6 as
- USE_NEW_TOOLCHAIN, and re-worked to TOOLCHAIN_MISSING after that.
-
-BUGS
- A few platforms are not yet using this build system.
-
-NetBSD September 1, 2007 NetBSD
View
428 Makefile
@@ -1,428 +0,0 @@
-# $NetBSD: Makefile,v 1.250 2007/10/07 16:35:21 pavel Exp $
-
-#
-# This is the top-level makefile for building NetBSD. For an outline of
-# how to build a snapshot or release, as well as other release engineering
-# information, see http://www.NetBSD.org/developers/releng/index.html
-#
-# Not everything you can set or do is documented in this makefile. In
-# particular, you should review the files in /usr/share/mk (especially
-# bsd.README) for general information on building programs and writing
-# Makefiles within this structure, and see the comments in src/etc/Makefile
-# for further information on installation and release set options.
-#
-# Variables listed below can be set on the make command line (highest
-# priority), in /etc/mk.conf (middle priority), or in the environment
-# (lowest priority).
-#
-# Variables:
-# DESTDIR is the target directory for installation of the compiled
-# software. It defaults to /. Note that programs are built against
-# libraries installed in DESTDIR.
-# MKMAN, if `no', will prevent building of manual pages.
-# MKOBJDIRS, if not `no', will build object directories at
-# an appropriate point in a build.
-# MKSHARE, if `no', will prevent building and installing
-# anything in /usr/share.
-# MKUPDATE, if not `no', will avoid a `make cleandir' at the start of
-# `make build', as well as having the effects listed in
-# /usr/share/mk/bsd.README.
-# NOCLEANDIR, if defined, will avoid a `make cleandir' at the start
-# of the `make build'.
-# NOINCLUDES will avoid the `make includes' usually done by `make build'.
-#
-# See mk.conf(5) for more details.
-#
-#
-# Targets:
-# build:
-# Builds a full release of NetBSD in DESTDIR, except for the
-# /etc configuration files.
-# If BUILD_DONE is set, this is an empty target.
-# distribution:
-# Builds a full release of NetBSD in DESTDIR, including the /etc
-# configuration files.
-# buildworld:
-# As per `make distribution', except that it ensures that DESTDIR
-# is not the root directory.
-# installworld:
-# Install the distribution from DESTDIR to INSTALLWORLDDIR (which
-# defaults to the root directory). Ensures that INSTALLWORLDDIR
-# is the not root directory if cross compiling.
-# release:
-# Does a `make distribution', and then tars up the DESTDIR files
-# into RELEASEDIR/${MACHINE}, in release(7) format.
-# (See etc/Makefile for more information on this.)
-# regression-tests:
-# Runs the regression tests in "regress" on this host.
-# sets:
-# Populate ${RELEASEDIR}/${MACHINE}/binary/sets from ${DESTDIR}
-# sourcesets:
-# Populate ${RELEASEDIR}/source/sets from ${NETBSDSRCDIR}
-# syspkgs:
-# Populate ${RELEASEDIR}/${MACHINE}/binary/syspkgs from ${DESTDIR}
-# iso-image:
-# Create CD-ROM image in RELEASEDIR/iso.
-# RELEASEDIR must already have been populated by `make release'
-# or equivalent.
-# iso-image-source:
-# Create CD-ROM image with source in RELEASEDIR/iso.
-# RELEASEDIR must already have been populated by
-# `make release sourcesets' or equivalent.
-#
-# Targets invoked by `make build,' in order:
-# cleandir: cleans the tree.
-# obj: creates object directories.
-# do-tools: builds host toolchain.
-# do-distrib-dirs: creates the distribution directories.
-# includes: installs include files.
-# do-tools-compat: builds the "libnbcompat" library; needed for some
-# random host tool programs in the source tree.
-# do-lib-csu: builds and installs prerequisites from lib/csu.
-# do-libgcc: builds and installs prerequisites from
-# gnu/lib/crtstuff${LIBGCC_EXT} (if necessary) and
-# gnu/lib/libgcc${LIBGCC_EXT}.
-# do-lib-libc: builds and installs prerequisites from lib/libc.
-# do-lib: builds and installs prerequisites from lib.
-# do-gnu-lib: builds and installs prerequisites from gnu/lib.
-# do-ld.so: builds and installs prerequisites from libexec/ld.*_so.
-# do-build: builds and installs the entire system.
-# do-x11: builds and installs X11R6 from src/x11 if ${MKX11} != "no"
-# do-obsolete: installs the obsolete sets (for the postinstall-* targets).
-#
-
-.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == ""
-.MAKEFLAGS: -m ${.CURDIR}/share/mk
-.endif
-
-#
-# If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may
-# not be the top level objdir, because "make obj" can happen in the *middle*
-# of "make build" (long after <bsd.own.mk> is calculated it). So, pre-set
-# _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}.
-#
-_SRC_TOP_OBJ_=
-
-.include <bsd.own.mk>
-
-#
-# Sanity check: make sure that "make build" is not invoked simultaneously
-# with a standard recursive target.
-#
-
-.if make(build) || make(release) || make(snapshot)
-.for targ in ${TARGETS:Nobj:Ncleandir}
-.if make(${targ}) && !target(.BEGIN)
-.BEGIN:
- @echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.'
- @false
-.endif
-.endfor
-.endif
-
-_SUBDIR= tools lib include gnu bin games libexec sbin usr.bin
-_SUBDIR+= usr.sbin share rescue sys etc .WAIT distrib regress
-
-#
-# Weed out directories that don't exist.
-#
-
-.for dir in ${_SUBDIR}
-.if ("${dir}" == ".WAIT") || exists(${dir}/Makefile) && (${BUILD_${dir}:Uyes} != "no")
-SUBDIR+= ${dir}
-.endif
-.endfor
-
-.if exists(regress)
-regression-tests: .PHONY .MAKE
- @echo Running regression tests...
- ${MAKEDIRTARGET} regress regress
-.endif
-
-.if ${MKUNPRIVED} != "no"
-NOPOSTINSTALL= # defined
-.endif
-
-afterinstall: .PHONY .MAKE
-.if ${MKMAN} != "no"
- ${MAKEDIRTARGET} share/man makedb
-.endif
-.if (${MKUNPRIVED} != "no" && ${MKINFO} != "no")
- ${MAKEDIRTARGET} gnu/usr.bin/texinfo/install-info infodir-meta
-.endif
-.if !defined(NOPOSTINSTALL)
- ${MAKEDIRTARGET} . postinstall-check
-.endif
-
-_POSTINSTALL= ${.CURDIR}/usr.sbin/postinstall/postinstall
-
-postinstall-check: .PHONY
- @echo " === Post installation checks ==="
- ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi
- @echo " ================================"
-
-postinstall-fix: .NOTMAIN .PHONY
- @echo " === Post installation fixes ==="
- ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix
- @echo " ==============================="
-
-postinstall-fix-obsolete: .NOTMAIN .PHONY
- @echo " === Removing obsolete files ==="
- ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} -d ${DESTDIR}/ fix obsolete
- @echo " ==============================="
-
-
-#
-# Targets (in order!) called by "make build".
-#
-.if ${HAVE_GCC} == "3"
-LIBGCC_EXT=3
-.else
-LIBGCC_EXT=4
-.endif
-
-BUILDTARGETS+= check-tools
-.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
-BUILDTARGETS+= cleandir
-.endif
-.if ${MKOBJDIRS} != "no"
-BUILDTARGETS+= obj
-.endif
-.if ${USETOOLS} == "yes"
-BUILDTARGETS+= do-tools
-.endif
-.if !defined(NODISTRIBDIRS)
-BUILDTARGETS+= do-distrib-dirs
-.endif
-.if !defined(NOINCLUDES)
-BUILDTARGETS+= includes
-.endif
-BUILDTARGETS+= do-tools-compat
-BUILDTARGETS+= do-lib-csu
-.if ${MKGCC} != "no"
-BUILDTARGETS+= do-libgcc
-.endif
-BUILDTARGETS+= do-lib-libc
-BUILDTARGETS+= do-lib do-gnu-lib
-BUILDTARGETS+= do-ld.so
-BUILDTARGETS+= do-build
-.if ${MKX11} != "no"
-BUILDTARGETS+= do-x11
-.endif
-BUILDTARGETS+= do-obsolete
-
-#
-# Enforce proper ordering of some rules.
-#
-
-.ORDER: ${BUILDTARGETS}
-includes-lib: .PHONY includes-include includes-sys
-includes-gnu: .PHONY includes-lib
-
-#
-# Build the system and install into DESTDIR.
-#
-
-START_TIME!= date
-
-build: .PHONY .MAKE
-.if defined(BUILD_DONE)
- @echo "Build already installed into ${DESTDIR}"
-.else
- @echo "Build started at: ${START_TIME}"
-.for tgt in ${BUILDTARGETS}
- ${MAKEDIRTARGET} . ${tgt}
-.endfor
- ${MAKEDIRTARGET} etc install-etc-release
- @echo "Build started at: ${START_TIME}"
- @printf "Build finished at: " && date
-.endif
-
-#
-# Build a full distribution, but not a release (i.e. no sets into
-# ${RELEASEDIR}). "buildworld" enforces a build to ${DESTDIR} != /
-#
-
-distribution buildworld: .PHONY .MAKE
-.if make(buildworld) && \
- (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
- @echo "Won't make ${.TARGET} with DESTDIR=/"
- @false
-.endif
- ${MAKEDIRTARGET} . build NOPOSTINSTALL=1
- ${MAKEDIRTARGET} etc distribution INSTALL_DONE=1
-.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/"
- ${MAKEDIRTARGET} . postinstall-fix-obsolete
- ${MAKEDIRTARGET} distrib/sets checkflist
-.endif
- @echo "make ${.TARGET} started at: ${START_TIME}"
- @printf "make ${.TARGET} finished at: " && date
-
-#
-# Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/')
-# If installing to /, ensures that the host's operating system is NetBSD and
-# the host's `uname -m` == ${MACHINE}.
-#
-
-HOST_UNAME_S!= uname -s
-HOST_UNAME_M!= uname -m
-
-installworld: .PHONY .MAKE
-.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
- @echo "Can't make ${.TARGET} to DESTDIR=/"
- @false
-.endif
-.if !defined(INSTALLWORLDDIR) || \
- ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/"
-.if (${HOST_UNAME_S} != "NetBSD")
- @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLWORLDDIR=/"
- @false
-.endif
-.if (${HOST_UNAME_M} != ${MACHINE})
- @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/"
- @false
-.endif
-.endif
- ${MAKEDIRTARGET} distrib/sets installsets \
- INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=
- ${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR}
- @echo "make ${.TARGET} started at: ${START_TIME}"
- @printf "make ${.TARGET} finished at: " && date
-
-#
-# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
-#
-
-.for tgt in sets sourcesets syspkgs
-${tgt}: .PHONY .MAKE
- ${MAKEDIRTARGET} distrib/sets ${tgt}
-.endfor
-
-#
-# Build a release or snapshot (implies "make distribution"). Note that
-# in this case, the set lists will be checked before the tar files
-# are made.
-#
-
-release snapshot: .PHONY .MAKE
- ${MAKEDIRTARGET} . distribution
- ${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1
- @echo "make ${.TARGET} started at: ${START_TIME}"
- @printf "make ${.TARGET} finished at: " && date
-
-#
-# Create a CD-ROM image.
-#
-
-iso-image: .PHONY
- ${MAKEDIRTARGET} distrib iso_image
- ${MAKEDIRTARGET} etc iso-image
- @echo "make ${.TARGET} started at: ${START_TIME}"
- @printf "make ${.TARGET} finished at: " && date
-
-iso-image-source: .PHONY
- ${MAKEDIRTARGET} distrib iso_image CDSOURCE=true
- ${MAKEDIRTARGET} etc iso-image
- @echo "make ${.TARGET} started at: ${START_TIME}"
- @printf "make ${.TARGET} finished at: " && date
-
-#
-# Special components of the "make build" process.
-#
-
-check-tools: .PHONY
-.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN)
- @echo '*** WARNING: Building on MACHINE=${MACHINE} with missing toolchain.'
- @echo '*** May result in a failed build or corrupt binaries!'
-.elif defined(EXTERNAL_TOOLCHAIN)
- @echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.'
-.endif
-.if defined(NBUILDJOBS)
- @echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!'
-.endif
-
-do-distrib-dirs: .PHONY .MAKE
-.if !defined(DESTDIR) || ${DESTDIR} == ""
- ${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/
-.else
- ${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR}
-.endif
-
-.for targ in cleandir obj includes
-do-${targ}: .PHONY ${targ}
- @true
-.endfor
-
-.for dir in tools tools/compat lib/csu gnu/lib/crtstuff${LIBGCC_EXT} gnu/lib/libgcc${LIBGCC_EXT} lib/libc lib/libdes lib gnu/lib
-do-${dir:S/\//-/g}: .PHONY .MAKE
-.for targ in dependall install
- ${MAKEDIRTARGET} ${dir} ${targ}
-.endfor
-.endfor
-
-do-libgcc: .PHONY .MAKE
-.if ${MKGCC} != "no"
-.if (${HAVE_GCC} == "3" || ${HAVE_GCC} == "4")
- ${MAKEDIRTARGET} . do-gnu-lib-crtstuff${LIBGCC_EXT}
-.endif
- ${MAKEDIRTARGET} . do-gnu-lib-libgcc${LIBGCC_EXT}
-.endif
-
-do-ld.so: .PHONY .MAKE
-.for targ in dependall install
-.if (${OBJECT_FMT} == "a.out")
- ${MAKEDIRTARGET} libexec/ld.aout_so ${targ}
-.endif
-.if (${OBJECT_FMT} == "ELF")
- ${MAKEDIRTARGET} libexec/ld.elf_so ${targ}
-.endif
-.endfor
-
-do-build: .PHONY .MAKE
-.for targ in dependall install
- ${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no
-.endfor
-
-do-x11: .PHONY .MAKE
- ${MAKEDIRTARGET} x11 build
-
-do-obsolete: .PHONY .MAKE
- ${MAKEDIRTARGET} etc install-obsolete-lists
-
-#
-# Speedup stubs for some subtrees that don't need to run these rules.
-# (Tells <bsd.subdir.mk> not to recurse for them.)
-#
-
-.for dir in bin etc distrib games libexec regress sbin usr.sbin tools
-includes-${dir}: .PHONY
- @true
-.endfor
-.for dir in etc distrib regress
-install-${dir}: .PHONY
- @true
-.endfor
-
-#
-# XXX this needs to change when distrib Makefiles are recursion compliant
-# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first...
-#
-dependall-distrib depend-distrib all-distrib: .PHONY
- @true
-
-.include <bsd.sys.mk>
-.include <bsd.obj.mk>
-.include <bsd.kernobj.mk>
-.include <bsd.subdir.mk>
-
-build-docs: .PHONY ${.CURDIR}/BUILDING
-${.CURDIR}/BUILDING: doc/BUILDING.mdoc
- ${_MKMSG_CREATE} ${.TARGET}
- ${TOOL_GROFF} -mdoc -Tascii -P-bou $> >$@
-
-
-#
-# Display current make(1) parameters
-#
-params: .PHONY .MAKE
- ${MAKEDIRTARGET} etc params
View
16 Makefile.inc
@@ -1,16 +0,0 @@
-# $NetBSD: Makefile.inc,v 1.4 2002/04/10 14:53:43 lukem Exp $
-
-.ifndef ABSTOP
-ABSTOP!= cd ${.PARSEDIR}; pwd
-
-.if (${.PARSEDIR} == ${.CURDIR})
-RELTOP:= .
-.else
-RELTOP:= ${.PARSEDIR:S,^${.CURDIR},,}
-.endif
-
-# you can set BSD{SRC,OBJ}DIR in Makefile.local.inc
-.if exists(${ABSTOP}/Makefile.local.inc)
-.include "${ABSTOP}/Makefile.local.inc"
-.endif
-.endif
View
266 UPDATING
@@ -1,266 +0,0 @@
-$NetBSD: UPDATING,v 1.164 2007/10/02 12:45:51 gdt Exp $
-
-This file (UPDATING) is intended to be a brief reference to recent
-changes that might cause problems in the build process, and a guide for
-what to do if something doesn't work.
-
-For a more detailed description of the recommended way to build NetBSD
-using build.sh, see the BUILDING file.
-
-Note that much of the advice in this UPDATING file was written before
-build.sh existed. Nevertheless, the advice here may be useful for
-working around specific problems with build.sh.
-
-See also: BUILDING, build.sh, Makefile.
-
-Recent changes:
-^^^^^^^^^^^^^^^
-
-20070913:
- A latent bug in dhclient/dhcpd that caused it to be unable to
- enumerate interfaces was fixed. The bug began to cause
- problems after 20070911 when the kernel's SIOCGIFCONF
- implementation was repaired. From 20070529 to 20070911 racoon
- could not enumerate interfaces. (These are noted because
- normal kernel/userspace version matching hygiene is not
- sufficient to avoid this problem.) Ensure that both kernel
- and userland are from after 20070913.
-
-20070703:
- nbinstall has been renamed as it calls the target specific and
- the logic to pass down STRIP from mk been removed. This forces
- a re-installation of tools.
-
-20070422:
- The way OS emulations lookup filenames inside the emulation root
- has been changed. Rather than modify the pathname (and copy back
- to userspace) namei() and lookup() directly check the emulation
- root. One side effect is that absolute symlinks inside the emulated
- root filesytem will be relative to that filesystem - unless they
- start /../ this is useful when the emulated root is a real install
- that has such links.
- This might affect symlinks that have been added to reference outside
- the emulated root.
-
-20070412:
- The pckbc driver on sgimips IP32 has been removed. Use macekbc
- instead. See the GENERIC32_IP3x kernel configuration for an
- example.
-
-20070319:
- src/lib/libc/Makefile revision 1.129 broke libc and ld.elf_so
- on many platforms due to incorrect flags settings. If you
- updated and built after about 20070315, do "nbmake-$arch
- cleandir" in src/lib/libc and src/libexec/ld.elf_so to force a
- rebuild of object files that might have been built
- incorrectly, and ensure that you have at least
- src/lib/libc/Makefile 1.130.
-
-20070210:
- src/sys/sys/{sa.h,savar.h} were removed.
- find ${OBJDIR} \( -name .depend -o -name '*.d' \) -print \
- | xargs egrep -l '/sa.h|/savar.h' | xargs rm
- will allow dependencies on those files to get get rebuilt
-
-20070209:
- The threading model was changed when the newlock2 branch
- was merged to NetBSD-current. If you boot with a new
- kernel (version 4.99.10), then you also need a new pthread
- library (/usr/lib/libpthread.so.0.7). If you boot with
- an old kernel, then you need the old pthread library
- (/usr/lib/libpthread.so.0.6). Provided you keep the kernel and
- the pthread library in sync, old threaded applications should
- continue to work with an old or new kernel. Note that named(8)
- is the only threaded application in the base system.
-
-20061214:
- Following the move of string_to_flags() and flags_to_string()
- from the bin/ls/ sources to libutil, users doing UPDATE builds
- will need to do a "make cleandir" in
- tools/mtree/, tools/makefs/, tools/binstall/, tools/pax/,
- bin/pax/, bin/ls/, usr.sbin/mtree/, usr.sbin/makefs/,
- usr.bin/xinstall/, libexec/ftpd/, rescue/, as well
- as the installation images in distrib/
- in order to excise stale references to the old stat_flags.h header
- file in the ls sources -- stat_flags.h has been removed.
-
-20061108:
- The configure script used in the src/tools/gcc compiler has been
- changed to indicate that our libc has ssp support built-in and
- does not depend on -lssp and -lssp-nonshared. You'll need to
- make clean in src/tools/gcc first to rebuild the compiler.
-
-20061009:
- The sysctl variables net.inet{,6}.tcp{,6}.newreno are no longer
- available. Use net.inet{,6}.tcp{,6}.congctl.selected instead.
-
-20060814:
- The vt, vidcconsole, kbd, and rpckbd drivers on acorn32 have been
- withdrawn. Use vidcvideo and pckbd instead. See the GENERIC
- kernel configuration for an example. X servers from the last
- few years should cope.
-
-20060703:
- MPACPI is no more. We always configure PCI interrupts using ACPI
- if we have an ACPI kernel. The option MPACPI_SCANPCI has been renamed
- to ACPI_SCANPCI. Thanks to work from fvdl.
-
-20060627:
- socket(2) has changed, and its system call has been versioned.
- For userlands with the old version of socket(2), make sure that
- your kernel has 'options COMPAT_30' set, or else 'bad system call'
- errors will result.
-
-Hints for a more successful build:
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Use build.sh, but do not use its "expert mode":
- This will automatically build the tools in the
- correct order, and it will keep the tools and the
- new build products from interfering with the running
- system. This will allow you to ignore most of the
- other advice in this file.
- Build a new kernel first:
- This makes sure that any new system calls or features
- expected by the new userland will be present. This
- helps to avoid critical errors when upgrading.
- Use object directories:
- This helps to keep stale object
- files from polluting the build if a Makefile "forgets"
- about one. It also makes it easier to clean up after
- a build. It's also necessary if you want to use the
- same source tree for multiple machines.
- To use object directories with build.sh:
- a) invoke build.sh with the "-M" or "-O" options.
- To use object directories without using build.sh:
- a) cd /usr/src ; make cleandir
- b) Add "OBJMACHINE=yes" to /etc/mk.conf
- c) Add "MKOBJDIRS=yes" to /etc/mk.conf
- d) cd /usr/src ; make build
- Note that running "make obj" in a directory will create
- in obj.$MACHINE directory.
- Build to a DESTDIR:
- This helps to keep old installed files (especially libraries)
- from interfering with the new build.
- To build to a DESTDIR with build.sh, use the "-D" option.
- To build to a DESTDIR without using build.sh, set the DESTDIR
- environment variable before running make build. It should be
- set to the pathname of an initially empty directory.
- Problems: if you do not use build.sh, you might need to
- update critical utilities without using DESTDIR since
- nothing is executed from what is installed in DESTDIR.
- (See critical utils, below.)
- Build often:
- This keeps critical utilities current enough to not choke
- on any other part of the source tree that depends on up to
- date functionality. If you use build.sh, you should not have
- this problem.
-
-What to do if things don't work:
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-When things don't work there is usually a few things that commonly
-should be done.
- 1) make includes
- This should be done automatically by make build.
- 2) cd share/mk && make install
- Again, automatically done by make build.
-
-Failsafe rebuild of a small part of the tree:
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-To make sure you rebuild something correctly you want to do
-something like the following:
- 1) Make sure the includes and .mk files are up to date.
- 2) Make sure any program used to build the particular
- utility is up to date. (yacc, lex, etc...)
- 3) cd ...path/to/util...
- make cleandir
- rm ...all obj directories...
- make cleandir # yes, again
- make obj
- make depend && make
-
-Failsafe rebuild of the entire tree:
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-If you really want to make sure the source tree is clean and
-ready for a build try the following. Note that sourcing /etc/mk.conf
-(a make(1) Makefile) in this manner is not right, and will not work
-for anyone who uses any make(1) features in /etc/mk.conf.
-
----cut here---
-#!/bin/sh
-. /etc/mk.conf
-
-if [ -z $NETBSDSRCDIR ] ; then
- NETBSDSRCDIR=/usr/src
-fi
-if [ \! -d $NETBSDSRCDIR ] ; then
- echo Unable to find sources
- exit 1
-fi
-find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
-
-if [ -z $BSDOBJDIR ] ; then
- BSDOBJDIR=/usr/obj
-fi
-if [ -d $BSDOBJDIR ] ; then
- rm -rf $BSDOBJDIR
-fi
-
-cd $NETBSDSRCDIR && make cleandir
-
----cut here---
-
-Critical utilities:
-^^^^^^^^^^^^^^^^^^^
- usr.bin/compile_et
- usr.bin/make
- usr.bin/yacc
- usr.bin/lex
- usr.bin/xlint
- usr.bin/config
-
-Other problems and possible solutions:
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Symptom:Complaints involving a Makefile.
-Fix: Rebuild usr.bin/make:
- cd usr.bin/make && make && make install
- Or, a failsafe method if that doesn't work:
- cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
-
-Fix: Make sure .mk files are up to date.
- cd share/mk && make install
-
-Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
-Fix: Rebuild usr.bin/config
-
-Symptom:
-Fix: Rebuild usr.bin/yacc
-
-Symptom:
-Fix: Rebuild usr.bin/lex
-
-Symptom:
-Fix: rm /usr/lib/libbfd.a
-
-Symptom:Obsolete intermediate files are used during compilation
-Fix: Try the following sequence of commands in the directory in question.
- make cleandir; rm `make print-objdir`; make cleandir; make obj
- (If you built the tree without "make obj" in the past, obsolete files
- may remain. The command tries to clean everything up)
-
-Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
-Fix: Rebuild and install usr.bin/menuc
-
-Symptom:mklocale not found during build in share/locale/ctype
-Fix: Build and install usr.bin/mklocale
-
-Symptom:undefined reference to `__assert13' or `__unsetenv13'
-Fix: Rebuild and install lib/libc
-
-Symptom:usr.bin/config fails to build.
-Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
-
-Symptom:undefined reference to `getprogname' or `setprogname'
-Fix: Rebuild and install lib/libc
-
-Symptom:lint does not understand the '-X' option
-Fix: May need to build & install libs with NOLINT=1 before rebuilding lint
View
8 bin/Makefile
@@ -1,8 +0,0 @@
-# $NetBSD: Makefile,v 1.21 2007/02/08 03:57:53 tls Exp $
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-
-SUBDIR= cat chio chmod cp csh date dd df domainname echo ed expr hostname \
- kill ksh ln ls mkdir mt mv pax ps pwd rcp rcmd rm rmdir sh \
- sleep stty sync systrace test
-
-.include <bsd.subdir.mk>
View
11 bin/Makefile.inc
@@ -1,11 +0,0 @@
-# $NetBSD: Makefile.inc,v 1.15 2005/06/26 19:10:48 christos Exp $
-# @(#)Makefile.inc 8.1 (Berkeley) 5/31/93
-
-.include <bsd.own.mk> # for MKDYNAMICROOT definition
-
-WARNS?= 3
-BINDIR?= /bin
-
-.if (${MKDYNAMICROOT} == "no")
-LDSTATIC?= -static
-.endif
View
6 bin/cat/Makefile
@@ -1,6 +0,0 @@
-# $NetBSD: Makefile,v 1.12 2003/05/18 07:57:31 lukem Exp $
-# @(#)Makefile 8.1 (Berkeley) 5/31/93
-
-PROG= cat
-
-.include <bsd.prog.mk>
View
209 bin/cat/cat.1
@@ -1,209 +0,0 @@
-.\" $NetBSD: cat.1,v 1.32 2006/09/23 11:24:44 wiz Exp $
-.\"
-.\" Copyright (c) 1989, 1990, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" the Institute of Electrical and Electronics Engineers, Inc.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)cat.1 8.3 (Berkeley) 5/2/95
-.\"
-.Dd September 23, 2006
-.Dt CAT 1
-.Os
-.Sh NAME
-.Nm cat
-.Nd concatenate and print files
-.Sh SYNOPSIS
-.Nm
-.Op Fl beflnstuv
-.Op Fl
-.Op Ar
-.Sh DESCRIPTION
-The
-.Nm
-utility reads files sequentially, writing them to the standard output.
-The
-.Ar file
-operands are processed in command line order.
-A single dash represents the standard input,
-and may appear multiple times in the
-.Ar file
-list.
-.Pp
-The word
-.Dq concatenate
-is just a verbose synonym for
-.Dq catenate .
-.Pp
-The options are as follows:
-.Bl -tag -width Ds
-.It Fl b
-Implies the
-.Fl n
-option but doesn't number blank lines.
-.It Fl e
-Implies the
-.Fl v
-option, and displays a dollar sign
-.Pq Ql \&$
-at the end of each line
-as well.
-.It Fl f
-Only attempt to display regular files.
-.It Fl l
-Set an exclusive advisory lock on the standard output file descriptor.
-This lock is set using
-.Xr fcntl 2
-with the
-.Dv F_SETLKW
-command.
-If the output file is already locked,
-.Nm
-will block until the lock is acquired.
-.It Fl n
-Number the output lines, starting at 1.
-.It Fl s
-Squeeze multiple adjacent empty lines, causing the output to be
-single spaced.
-.It Fl t
-Implies the
-.Fl v
-option, and displays tab characters as
-.Ql ^I
-as well.
-.It Fl u
-The
-.Fl u
-option guarantees that the output is unbuffered.
-.It Fl v
-Displays non-printing characters so they are visible.
-Control characters print as
-.Ql ^X
-for control-X; the delete
-character (octal 0177) prints as
-.Ql ^? .
-Non-ascii characters (with the high bit set) are printed as
-.Ql M-
-(for meta) followed by the character for the low 7 bits.
-.El
-.Sh EXIT STATUS
-The
-.Nm
-utility exits 0 on success, and \*[Gt]0 if an error occurs.
-.Sh EXAMPLES
-The command:
-.Bd -literal -offset indent
-.Ic cat file1
-.Ed
-.Pp
-will print the contents of
-.Ar file1
-to the standard output.
-.Pp
-The command:
-.Bd -literal -offset indent
-.Ic cat file1 file2 \*[Gt] file3
-.Ed
-.Pp
-will sequentially print the contents of
-.Ar file1
-and
-.Ar file2
-to the file
-.Ar file3 ,
-truncating
-.Ar file3
-if it already exists.
-See the manual page for your shell (i.e.,
-.Xr sh 1 )
-for more information on redirection.
-.Pp
-The command:
-.Bd -literal -offset indent
-.Ic cat file1 - file2 - file3
-.Ed
-.Pp
-will print the contents of
-.Ar file1 ,
-print data it receives from the standard input until it receives an
-.Dv EOF
-.Pq Sq ^D
-character, print the contents of
-.Ar file2 ,
-read and output contents of the standard input again, then finally output
-the contents of
-.Ar file3 .
-Note that if the standard input referred to a file, the second dash
-on the command-line would have no effect, since the entire contents of the file
-would have already been read and printed by
-.Nm
-when it encountered the first
-.Ql \&-
-operand.
-.Sh SEE ALSO
-.Xr head 1 ,
-.Xr hexdump 1 ,
-.Xr lpr 1 ,
-.Xr more 1 ,
-.Xr pr 1 ,
-.Xr tail 1 ,
-.Xr view 1 ,
-.Xr vis 1 ,
-.Xr fcntl 2
-.Rs
-.%A Rob Pike
-.%T "UNIX Style, or cat -v Considered Harmful"
-.%J "USENIX Summer Conference Proceedings"
-.%D 1983
-.Re
-.Sh STANDARDS
-The
-.Nm
-utility is expected to conform to the
-.St -p1003.2-92
-specification.
-.Pp
-The flags
-.Op Fl belnstv
-are extensions to the specification.
-.Sh HISTORY
-A
-.Nm
-utility appeared in
-.At v1 .
-Dennis Ritchie designed and wrote the first man page.
-It appears to have been
-.Xr cat 1 .
-.Sh BUGS
-Because of the shell language mechanism used to perform output
-redirection, the command
-.Dq Li cat file1 file2 \*[Gt] file1
-will cause the original data in file1 to be destroyed!
-This is performed by the shell before
-.Nm
-is run.
View
316 bin/cat/cat.c
@@ -1,316 +0,0 @@
-/* $NetBSD: cat.c,v 1.46 2007/01/13 11:51:59 cbiere Exp $ */
-
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Kevin Fall.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-#if !defined(lint)
-__COPYRIGHT(
-"@(#) Copyright (c) 1989, 1993\n\
- The Regents of the University of California. All rights reserved.\n");
-#if 0
-static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95";
-#else
-__RCSID("$NetBSD: cat.c,v 1.46 2007/01/13 11:51:59 cbiere Exp $");
-#endif
-#endif /* not lint */
-
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include <ctype.h>
-#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <locale.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-int bflag, eflag, fflag, lflag, nflag, sflag, tflag, vflag;
-int rval;
-const char *filename;
-
-int main(int, char *[]);
-void cook_args(char *argv[]);
-void cook_buf(FILE *);
-void raw_args(char *argv[]);
-void raw_cat(int);
-
-int
-main(int argc, char *argv[])
-{
- int ch;
- struct flock stdout_lock;
-
- setprogname(argv[0]);
- (void)setlocale(LC_ALL, "");
-
- while ((ch = getopt(argc, argv, "beflnstuv")) != -1)
- switch (ch) {
- case 'b':
- bflag = nflag = 1; /* -b implies -n */
- break;
- case 'e':
- eflag = vflag = 1; /* -e implies -v */
- break;
- case 'f':
- fflag = 1;
- break;
- case 'l':
- lflag = 1;
- break;
- case 'n':
- nflag = 1;
- break;
- case 's':
- sflag = 1;
- break;
- case 't':
- tflag = vflag = 1; /* -t implies -v */
- break;
- case 'u':
- setbuf(stdout, NULL);
- break;
- case 'v':
- vflag = 1;
- break;
- default:
- case '?':
- (void)fprintf(stderr,
- "usage: cat [-beflnstuv] [-] [file ...]\n");
- exit(EXIT_FAILURE);
- /* NOTREACHED */
- }
- argv += optind;
-
- if (lflag) {
- stdout_lock.l_len = 0;
- stdout_lock.l_start = 0;
- stdout_lock.l_type = F_WRLCK;
- stdout_lock.l_whence = SEEK_SET;
- if (fcntl(STDOUT_FILENO, F_SETLKW, &stdout_lock) == -1)
- err(EXIT_FAILURE, "stdout");
- }
-
- if (bflag || eflag || nflag || sflag || tflag || vflag)
- cook_args(argv);
- else
- raw_args(argv);
- if (fclose(stdout))
- err(EXIT_FAILURE, "stdout");
- return (rval);
-}
-
-void
-cook_args(char **argv)
-{
- FILE *fp;
-
- fp = stdin;
- filename = "stdin";
- do {
- if (*argv) {
- if (!strcmp(*argv, "-"))
- fp = stdin;
- else if ((fp = fopen(*argv,
- fflag ? "rf" : "r")) == NULL) {
- warn("%s", *argv);
- rval = EXIT_FAILURE;
- ++argv;
- continue;
- }
- filename = *argv++;
- }
- cook_buf(fp);
- if (fp != stdin)
- (void)fclose(fp);
- else
- clearerr(fp);
- } while (*argv);
-}
-
-void
-cook_buf(FILE *fp)
-{
- int ch, gobble, line, prev;
-
- line = gobble = 0;
- for (prev = '\n'; (ch = getc(fp)) != EOF; prev = ch) {
- if (prev == '\n') {
- if (ch == '\n') {
- if (sflag) {
- if (!gobble && nflag && !bflag)
- (void)fprintf(stdout,
- "%6d\t\n", ++line);
- else if (!gobble && putchar(ch) == EOF)
- break;
- gobble = 1;
- continue;
- }
- if (nflag) {
- if (!bflag) {
- (void)fprintf(stdout,
- "%6d\t", ++line);
- if (ferror(stdout))
- break;
- } else if (eflag) {
- (void)fprintf(stdout,
- "%6s\t", "");
- if (ferror(stdout))
- break;
- }
- }
- } else if (nflag) {
- (void)fprintf(stdout, "%6d\t", ++line);
- if (ferror(stdout))
- break;
- }
- }
- gobble = 0;
- if (ch == '\n') {
- if (eflag)
- if (putchar('$') == EOF)
- break;
- } else if (ch == '\t') {
- if (tflag) {
- if (putchar('^') == EOF || putchar('I') == EOF)
- break;
- continue;
- }
- } else if (vflag) {
- if (!isascii(ch)) {
- if (putchar('M') == EOF || putchar('-') == EOF)
- break;
- ch = toascii(ch);
- }
- if (iscntrl(ch)) {
- if (putchar('^') == EOF ||
- putchar(ch == '\177' ? '?' :
- ch | 0100) == EOF)
- break;
- continue;
- }
- }
- if (putchar(ch) == EOF)
- break;
- }
- if (ferror(fp)) {
- warn("%s", filename);
- rval = EXIT_FAILURE;
- clearerr(fp);
- }
- if (ferror(stdout))
- err(EXIT_FAILURE, "stdout");
-}
-
-void
-raw_args(char **argv)
-{
- int fd;
-
- fd = fileno(stdin);
- filename = "stdin";
- do {
- if (*argv) {
- if (!strcmp(*argv, "-"))
- fd = fileno(stdin);
- else if (fflag) {
- struct stat st;
- fd = open(*argv, O_RDONLY|O_NONBLOCK, 0);
- if (fd < 0)
- goto skip;
-
- if (fstat(fd, &st) == -1) {
- close(fd);
- goto skip;
- }
- if (!S_ISREG(st.st_mode)) {
- close(fd);
- warnx("%s: not a regular file", *argv);
- goto skipnomsg;
- }
- }
- else if ((fd = open(*argv, O_RDONLY, 0)) < 0) {
-skip:
- warn("%s", *argv);
-skipnomsg:
- rval = EXIT_FAILURE;
- ++argv;
- continue;
- }
- filename = *argv++;
- }
- raw_cat(fd);
- if (fd != fileno(stdin))
- (void)close(fd);
- } while (*argv);
-}
-
-void
-raw_cat(int rfd)
-{
- static char *buf;
- static char fb_buf[BUFSIZ];
- static size_t bsize;
-
- ssize_t nr, nw, off;
- int wfd;
-
- wfd = fileno(stdout);
- if (buf == NULL) {
- struct stat sbuf;
-
- if (fstat(wfd, &sbuf) == 0 &&
- sbuf.st_blksize > sizeof(fb_buf)) {
- bsize = sbuf.st_blksize;
- buf = malloc(bsize);
- }
- if (buf == NULL) {
- bsize = sizeof(fb_buf);
- buf = fb_buf;
- }
- }
- while ((nr = read(rfd, buf, bsize)) > 0)
- for (off = 0; nr; nr -= nw, off += nw)
- if ((nw = write(wfd, buf + off, (size_t)nr)) < 0)
- err(EXIT_FAILURE, "stdout");
- if (nr < 0) {
- warn("%s", filename);
- rval = EXIT_FAILURE;
- }
-}
View
5 bin/chio/Makefile
@@ -1,5 +0,0 @@
-# $NetBSD: Makefile,v 1.6 2003/07/18 02:18:57 lukem Exp $
-
-PROG= chio
-
-.include <bsd.prog.mk>
View
263 bin/chio/chio.1
@@ -1,263 +0,0 @@
-.\" $NetBSD: chio.1,v 1.14 2002/09/25 15:18:37 wiz Exp $
-.\"
-.\" Copyright (c) 1996, 1998, 1999 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
-.\" NASA Ames Research Center.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the NetBSD
-.\" Foundation, Inc. and its contributors.
-.\" 4. Neither the name of The NetBSD Foundation nor the names of its
-.\" contributors may be used to endorse or promote products derived
-.\" from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-.\" POSSIBILITY OF SUCH DAMAGE.
-.\"
-.Dd September 8, 1999
-.Dt CHIO 1
-.Os
-.Sh NAME
-.Nm chio
-.Nd medium changer control utility
-.Sh SYNOPSIS
-.Nm
-.Op Fl f Ar changer
-.Ar command
-.Ar arg1
-.Ar arg2
-.Oo
-.Ar arg3 Oo ...
-.Oc
-.Oc
-.Sh DESCRIPTION
-.Nm
-is used to control the operation of medium changers, such as those found
-in tape and optical disk jukeboxes.
-.Pp
-The options are as follows:
-.Bl -tag -width indent
-.It Fl f Ar changer
-Use the device
-.Pa changer
-rather than the default device
-.Pa /dev/ch0 .
-.El
-.Pp
-The default changer may be overridden by setting the environment variable
-.Ev CHANGER
-to the desired changer device.
-.Pp
-A medium changer apparatus is made up of
-.Pa elements .
-There are four element types:
-.Pa picker
-(medium transport),
-.Pa slot
-(storage),
-.Pa portal
-(import/export), and
-.Pa drive
-(data transfer).
-In this command description, the shorthand
-.Ic ET
-will be used to represent an element type, and
-.Ic EU
-will be used to represent an element unit.
-For example, to represent
-the first robotic arm in the changer, the ET would be
-.Dq picker
-and the EU would be
-.Dq 0 .
-.Sh SUPPORTED COMMANDS
-.Nm
-.Ic move
-.Ar \*[Lt]from ET\*[Gt] \*[Lt]from EU\*[Gt] \*[Lt]to ET\*[Gt] \*[Lt]to EU\*[Gt]
-.Op Ar inv
-.Pp
-Moves the media unit from
-.Pa \*[Lt]from ET/EU\*[Gt]
-to
-.Pa \*[Lt]to ET/EU\*[Gt] .
-If the optional modifier
-.Pa inv
-is specified, the media unit will be inverted before insertion.
-.Pp
-.Nm
-.Ic exchange
-.Ar \*[Lt]src ET\*[Gt] \*[Lt]src EU\*[Gt] \*[Lt]dst1 ET\*[Gt] \*[Lt]dst1 EU\*[Gt]
-.Op Ar \*[Lt]dst2 ET\*[Gt] \*[Lt]dst2 ET\*[Gt]
-.Op Ar inv1
-.Op Ar inv2
-.Pp
-Performs a media unit exchange operation.
-The media unit in
-.Pa \*[Lt]src ET/EU\*[Gt]
-is moved to
-.Pa \*[Lt]dst1 ET/EU\*[Gt]
-and the media unit previously in
-.Pa \*[Lt]dst1 ET/EU\*[Gt]
-is moved to
-.Pa \*[Lt]dst2 ET/EU\*[Gt] .
-In the case of a simple exchange,
-.Pa \*[Lt]dst2 ET/EU\*[Gt]
-is omitted and the values
-.Pa \*[Lt]src ET/EU\*[Gt]
-are used in their place.
-The optional modifiers
-.Pa inv1
-and
-.Pa inv2
-specify whether the media units are to be inverted before insertion into
-.Pa \*[Lt]dst1 ET/EU\*[Gt]
-and
-.Pa \*[Lt]dst2 ET/EU\*[Gt]
-respectively.
-.Pp
-Note that not all medium changers support the
-.Ic exchange
-operation; The changer must have multiple free pickers or emulate
-multiple free pickers with transient storage.
-.Pp
-.Nm
-.Ic position
-.Ar \*[Lt]to ET\*[Gt] \*[Lt]to EU\*[Gt]
-.Op Ar inv
-.Pp
-Position the picker in front of the element described by
-.Pa \*[Lt]to ET/EU\*[Gt] .
-If the optional modifier
-.Pa inv
-is specified, the media unit will be inverted before insertion.
-.Pp
-Note that not all changers behave as expected when issued this command.
-.Pp
-.Nm
-.Ic params
-.Pp
-Report the number of slots, drives, pickers, and portals in the changer,
-and which picker unit the changer is currently configured to use.
-.Pp
-.Nm
-.Ic getpicker
-.Pp
-Report which picker unit the changer is currently configured to use.
-.Pp
-.Nm
-.Ic setpicker
-.Ar \*[Lt]unit\*[Gt]
-.Pp
-Configure the changer to use picker
-.Pa \*[Lt]unit\*[Gt] .
-.Pp
-.Nm
-.Ic status
-.Oo Ar \*[Lt]type\*[Gt] Oo unit Oo count Oc Oc Oc
-.Op Ar voltags
-.Pp
-Report the status of all elements in the changer.
-If
-.Pa \*[Lt]type\*[Gt]
-is specified, report the status of all elements of type
-.Pa \*[Lt]type\*[Gt] .
-.Pp
-The status bits are defined as follows:
-.Bl -tag -width indent
-.It Nm FULL
-Element contains a media unit.
-.It Nm IMPEXP
-Media was deposited into element by an outside human operator.
-.It Nm EXCEPT
-Element is in an abnormal state.
-.It Nm ACCESS
-Media in this element is accessible by a picker.
-.It Nm EXENAB
-Element supports passing media (exporting) to an outside human operator.
-.It Nm INENAB
-Element supports receiving media (importing) from an outside human operator.
-.El
-.Pp
-If the element is a drive, the device name of the drive will be reported
-if it is available.
-.Pp
-If the
-.Op Ar voltags
-option is specified, primary and alternate volume tag information will
-be reported, if available.
-.Pp
-If the previous location of the media is available, it will also be reported.
-.Pp
-.Nm
-.Ic ielem
-.Pp
-Perform an
-.Em INITIALIZE ELEMENT STATUS
-operation on the changer.
-.Pp
-.Nm
-.Ic cdlu
-.Ar \*[Lt]sub-command\*[Gt]
-.Ar \*[Lt]slot\*[Gt]
-.Pp
-This command is provided for controlling CD-ROM changer mechanisms which
-cannot use the standard changer control interface.
-ATAPI CD-ROM changers fall into this category.
-There are 3 sub-commands:
-.Bl -tag -width indent
-.It Nm load
-Loads the media from the specified slot into the CD-ROM drive.
-.It Nm unload
-Unloads the media from the CD-ROM drive and returns it to the specified slot.
-.It Nm abort
-Aborts any pending load or unload operation.
-.El
-.Sh FILES
-/dev/ch0 - default changer device
-.Sh EXAMPLES
-.Dl chio -f /dev/ch0 move slot 3 drive 0
-.Pp
-Moves the media in slot 3 (fourth slot) to drive 0 (first drive).
-.Pp
-.Dl chio setpicker 2
-.Pp
-Configures the changer to use picker 2 (third picker) for operations.
-.Pp
-.Dl chio -f /dev/cd0a cdlu load 1
-.Pp
-Loads the media from slot (second slot) into the CD-ROM drive.
-.Pp
-.Dl chio -f /dev/ch1 status
-.Pp
-Returns status of all elements in the second changer.
-.Sh SEE ALSO
-.Xr mt 1 ,
-.Xr mount 8
-.Sh AUTHORS
-The
-.Nm
-program and SCSI changer driver were originally written by Jason R. Thorpe
-for And Communications, http://www.and.com/.
-Additional development was
-done by Jason R. Thorpe for the Numerical Aerospace Simulation Facility,
-NASA Ames Research Center.
View
865 bin/chio/chio.c
@@ -1,865 +0,0 @@
-/* $NetBSD: chio.c,v 1.28 2007/04/29 20:23:34 msaitoh Exp $ */
-
-/*-
- * Copyright (c) 1996, 1998, 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Additional Copyright (c) 1997, by Matthew Jacob, for NASA/Ames Research Ctr.
- */
-
-#include <sys/cdefs.h>
-#ifndef lint
-__COPYRIGHT(
-"@(#) Copyright (c) 1996, 1998, 1999\
- The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: chio.c,v 1.28 2007/04/29 20:23:34 msaitoh Exp $");
-#endif
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/chio.h>
-#include <sys/cdio.h> /* for ATAPI CD changer; too bad it uses a lame API */
-
-#include <ctype.h>
-#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "defs.h"
-#include "pathnames.h"
-
-int main(int, char *[]);
-static void usage(void);
-static void cleanup(void);
-static int parse_element_type(const char *);
-static int parse_element_unit(const char *);
-static int parse_special(const char *);
-static int is_special(const char *);
-static const char *bits_to_string(int, const char *);
-
-static int do_move(const char *, int, char **);
-static int do_exchange(const char *, int, char **);
-static int do_position(const char *, int, char **);
-static int do_params(const char *, int, char **);
-static int do_getpicker(const char *, int, char **);
-static int do_setpicker(const char *, int, char **);
-static int do_status(const char *, int, char **);
-static int do_ielem(const char *, int, char **);
-static int do_cdlu(const char *, int, char **);
-
-/* Valid changer element types. */
-const struct element_type elements[] = {
- { "picker", CHET_MT },
- { "slot", CHET_ST },
- { "portal", CHET_IE },
- { "drive", CHET_DT },
- { NULL, 0 },
-};
-
-/* Valid commands. */
-const struct changer_command commands[] = {
- { "move", " <from ET> <from EU> <to ET> <to EU> [inv]",
- do_move },
-
- { "exchange", " <src ET> <src EU> <dst1 ET> <dst1 EU>\n"
- "\t\t [<dst2 ET> <dst2 EU>] [inv1] [inv2]",
- do_exchange },
-
- { "position", " <to ET> <to EU> [inv]", do_position },
-
- { "params", "",
- do_params },
-
- { "getpicker", "",
- do_getpicker },
-
- { "setpicker", " <picker>",
- do_setpicker },
-
- { "status", " [<ET> [unit [count]]] [voltags]",
- do_status },
-
- { "ielem", "",
- do_ielem },
-
- { "cdlu", " load|unload <slot>\n"
- "\t abort",
- do_cdlu },
-
- { NULL, NULL,
- NULL },
-};
-
-/* Valid special words. */
-const struct special_word specials[] = {
- { "inv", SW_INVERT },
- { "inv1", SW_INVERT1 },
- { "inv2", SW_INVERT2 },
- { "voltags", SW_VOLTAGS },
- { NULL, 0 },
-};
-
-static const char *changer_name;
-static int changer_fd;
-
-int
-main(int argc, char *argv[])
-{
- int ch, i;
-
- setprogname(argv[0]);
- while ((ch = getopt(argc, argv, "f:")) != -1) {
- switch (ch) {
- case 'f':
- changer_name = optarg;
- break;
- default:
- usage();
- /* NOTREACHED */
- }
- }
- argc -= optind;
- argv += optind;
-
- if (argc == 0)
- usage();
- /* NOTREACHED */
-
- /* Get the default changer if not already specified. */
- if (changer_name == NULL)
- if ((changer_name = getenv(CHANGER_ENV_VAR)) == NULL)
- changer_name = _PATH_CH;
-
- /* Open the changer device. */
- if ((changer_fd = open(changer_name, O_RDWR, 0600)) == -1)
- err(EXIT_FAILURE, "%s: open", changer_name);
- /* NOTREACHED */
-
- /* Register cleanup function. */
- if (atexit(cleanup))
- err(EXIT_FAILURE, "can't register cleanup function");
- /* NOTREACHED */
-
- /* Find the specified command. */
- for (i = 0; commands[i].cc_name != NULL; ++i)
- if (strcmp(*argv, commands[i].cc_name) == 0)