From 66ee8158b69525e12060ef558cb5d77feadab1dc Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 7 Dec 2006 00:25:44 +0100 Subject: [PATCH] Imported from util-linux-2.10s tarball. --- HISTORY | 74 + INSTALL | 5 + MAINTAINER | 4 +- MCONFIG | 59 +- Makefile | 4 +- README | 9 + VERSION | 2 +- configure | 326 +- disk-utils/Makefile | 11 +- disk-utils/blockdev.8 | 55 + disk-utils/elvtune.c | 19 +- disk-utils/fdformat.c | 6 +- disk-utils/isosize.8 | 29 + disk-utils/isosize.c | 218 + disk-utils/mkfs.bfs.c | 61 +- disk-utils/mkfs.minix.8 | 3 +- disk-utils/mkfs.minix.c | 10 +- disk-utils/mkswap.c | 9 +- disk-utils/raw.c | 1 + disk-utils/setfdprm.c | 40 +- fdisk/Makefile | 5 +- fdisk/common.h | 1 + fdisk/fdisk.c | 104 +- fdisk/fdiskbsdlabel.h | 2 +- fdisk/fdisksunlabel.c | 6 + fdisk/fdisksunlabel.h | 2 +- fdisk/i386_sys_types.c | 16 +- fdisk/llseek.c | 14 + fdisk/sfdisk.c | 18 +- getopt-1.0.3b/Changelog | 14 - {getopt-1.0.3b => getopt-1.1.0a}/COPYING | 0 getopt-1.1.0a/Changelog | 24 + {getopt-1.0.3b => getopt-1.1.0a}/Makefile | 4 +- {getopt-1.0.3b => getopt-1.1.0a}/README | 0 {getopt-1.0.3b => getopt-1.1.0a}/TODO | 0 getopt-1.1.0a/getopt-1.0.6.lsm | 19 + {getopt-1.0.3b => getopt-1.1.0a}/getopt.1 | 5 + {getopt-1.0.3b => getopt-1.1.0a}/getopt.c | 44 +- {getopt-1.0.3b => getopt-1.1.0a}/gnu/getopt.c | 0 {getopt-1.0.3b => getopt-1.1.0a}/gnu/getopt.h | 0 .../gnu/getopt1.c | 0 {getopt-1.0.3b => getopt-1.1.0a}/parse.bash | 0 {getopt-1.0.3b => getopt-1.1.0a}/parse.tcsh | 0 {getopt-1.0.3b => getopt-1.1.0a}/test.bash | 0 {getopt-1.0.3b => getopt-1.1.0a}/test.tcsh | 0 {clock => hwclock}/Makefile | 3 +- {clock => hwclock}/README.aeb | 0 {clock => hwclock}/README.hwclock | 0 {clock => hwclock}/README.shhopt-1.1 | 0 {clock => hwclock}/adjtime.patch | 0 {clock => hwclock}/clock-ppc.c | 0 {clock => hwclock}/clock.h | 3 +- {clock => hwclock}/cmos.c | 6 +- {clock => hwclock}/hwclock.8 | 95 +- {clock => hwclock}/hwclock.c | 53 +- {clock => hwclock}/kd.c | 4 +- {clock => hwclock}/rtc.c | 71 +- {clock => hwclock}/shhopt-1.1.lsm | 0 {clock => hwclock}/shhopt.c | 0 {clock => hwclock}/shhopt.h | 0 kbd/kbdrate.c | 3 +- lib/Makefile | 6 +- lib/carefulputc.c | 26 + lib/carefulputc.h | 1 + lib/nls.h | 1 + lib/pathnames.h | 2 +- lib/widechar.h | 2 + login-utils/Makefile | 54 +- login-utils/agetty.c | 39 +- login-utils/checktty.c | 17 +- login-utils/chfn.c | 31 +- login-utils/chsh.c | 31 +- login-utils/cryptocard.c | 4 +- login-utils/cryptocard.h | 7 + login-utils/{need.8 => initctl.8} | 51 +- login-utils/{need.c => initctl.c} | 120 +- login-utils/islocal.c | 2 + login-utils/islocal.h | 1 + login-utils/last.c | 54 +- login-utils/login.c | 105 +- login-utils/login.h | 8 + login-utils/newgrp.c | 1 + login-utils/passwd.c | 26 +- login-utils/setpwnam.c | 5 + login-utils/setpwnam.h | 7 +- login-utils/shutdown.c | 191 +- login-utils/simpleinit.8 | 47 +- login-utils/simpleinit.c | 563 +- login-utils/simpleinit.h | 3 + login-utils/ttymsg.c | 10 +- login-utils/ttymsg.h | 2 + login-utils/vipw.c | 28 +- login-utils/wall.c | 45 +- misc-utils/Makefile | 6 +- misc-utils/cal.1 | 8 +- misc-utils/cal.c | 113 +- misc-utils/ddate.c | 3 +- misc-utils/logger.1 | 7 +- misc-utils/logger.c | 24 +- misc-utils/look.c | 24 +- misc-utils/namei.c | 1 + misc-utils/procs.c | 4 +- misc-utils/script.1 | 14 +- misc-utils/script.c | 74 +- misc-utils/whereis.c | 2 + misc-utils/write.c | 64 +- mount/Makefile | 11 +- mount/README.mount | 2 +- mount/bind.c | 11 + mount/fstab.c | 350 +- mount/fstab.h | 8 +- mount/linux_fs.h | 49 + mount/lomount.c | 51 +- mount/lomount.h | 1 + mount/losetup.8 | 11 +- mount/mount.8 | 11 +- mount/mount.c | 666 +- mount/mount_by_label.c | 51 +- mount/mount_constants.h | 19 + mount/mount_guess_fstype.c | 170 +- mount/mount_guess_fstype.h | 2 +- mount/mount_guess_rootdev.c | 90 + mount/mount_guess_rootdev.h | 1 + mount/nfs_mount4.h | 1 + mount/nfsmount.c | 20 +- mount/pivot_root.c | 2 +- mount/umount.8 | 7 +- mount/umount.c | 297 +- po/Makefile | 16 +- po/POTFILES.in | 13 +- po/cat-id-tbl.c | 3250 +++--- po/cs.po | 3475 +++---- po/da.po | 9022 +++++++++++++++++ po/de.po | 3380 +++--- po/es.po | 3358 +++--- po/fr.po | 3507 ++++--- po/it.po | 3360 +++--- po/ja.po | 3865 +++---- po/nl.po | 3741 +++---- po/pt_BR.po | 4441 ++++---- sys-utils/Makefile | 4 +- sys-utils/ctrlaltdel.c | 1 + sys-utils/cytune.c | 18 +- sys-utils/ipcs.c | 76 +- sys-utils/rdev.8 | 16 +- sys-utils/rdev.c | 266 +- sys-utils/readprofile.c | 6 +- sys-utils/renice.c | 1 + sys-utils/tunelp.c | 1 + text-utils/Makefile | 4 +- text-utils/col.c | 24 +- text-utils/colcrt.c | 179 +- text-utils/colrm.c | 37 +- text-utils/column.c | 2 +- text-utils/display.c | 12 +- text-utils/more.c | 261 +- text-utils/more.help.ja | 24 + text-utils/ul.c | 128 +- 158 files changed, 30001 insertions(+), 17613 deletions(-) create mode 100644 README create mode 100644 disk-utils/blockdev.8 create mode 100644 disk-utils/isosize.8 create mode 100644 disk-utils/isosize.c delete mode 100644 getopt-1.0.3b/Changelog rename {getopt-1.0.3b => getopt-1.1.0a}/COPYING (100%) create mode 100644 getopt-1.1.0a/Changelog rename {getopt-1.0.3b => getopt-1.1.0a}/Makefile (94%) rename {getopt-1.0.3b => getopt-1.1.0a}/README (100%) rename {getopt-1.0.3b => getopt-1.1.0a}/TODO (100%) create mode 100644 getopt-1.1.0a/getopt-1.0.6.lsm rename {getopt-1.0.3b => getopt-1.1.0a}/getopt.1 (98%) rename {getopt-1.0.3b => getopt-1.1.0a}/getopt.c (93%) rename {getopt-1.0.3b => getopt-1.1.0a}/gnu/getopt.c (100%) rename {getopt-1.0.3b => getopt-1.1.0a}/gnu/getopt.h (100%) rename {getopt-1.0.3b => getopt-1.1.0a}/gnu/getopt1.c (100%) rename {getopt-1.0.3b => getopt-1.1.0a}/parse.bash (100%) rename {getopt-1.0.3b => getopt-1.1.0a}/parse.tcsh (100%) rename {getopt-1.0.3b => getopt-1.1.0a}/test.bash (100%) rename {getopt-1.0.3b => getopt-1.1.0a}/test.tcsh (100%) rename {clock => hwclock}/Makefile (88%) rename {clock => hwclock}/README.aeb (100%) rename {clock => hwclock}/README.hwclock (100%) rename {clock => hwclock}/README.shhopt-1.1 (100%) rename {clock => hwclock}/adjtime.patch (100%) rename {clock => hwclock}/clock-ppc.c (100%) rename {clock => hwclock}/clock.h (93%) rename {clock => hwclock}/cmos.c (98%) rename {clock => hwclock}/hwclock.8 (96%) rename {clock => hwclock}/hwclock.c (98%) rename {clock => hwclock}/kd.c (98%) rename {clock => hwclock}/rtc.c (83%) rename {clock => hwclock}/shhopt-1.1.lsm (100%) rename {clock => hwclock}/shhopt.c (100%) rename {clock => hwclock}/shhopt.h (100%) create mode 100644 lib/carefulputc.c create mode 100644 lib/carefulputc.h create mode 100644 login-utils/cryptocard.h rename login-utils/{need.8 => initctl.8} (73%) rename login-utils/{need.c => initctl.c} (62%) create mode 100644 login-utils/islocal.h create mode 100644 login-utils/login.h create mode 100644 login-utils/ttymsg.h create mode 100644 mount/bind.c create mode 100644 mount/mount_guess_rootdev.c create mode 100644 mount/mount_guess_rootdev.h create mode 100644 po/da.po create mode 100644 text-utils/more.help.ja diff --git a/HISTORY b/HISTORY index 9c6099de28..265d02f3e9 100644 --- a/HISTORY +++ b/HISTORY @@ -1,3 +1,76 @@ +util-linux 2.10s: + +* Danish messages (Claus Hindsgaul) +* fixes to make gcc happy (Joseph S. Myers) +* fix for more on parisc (Richard Hirst) +* change rdev to search subdirectories of /dev (Paul Clements) +* ul fix (Masao Kawamura) - set columns correctly +* cal fix (Brendan Kehoe) - don't overflow weekday array in Gaelic +* fdisk fix (niles@scyld.com) - flush stdout +* fdisk fix - don't forget to write out empty label +* login: make default tty mode 0600 +* script: refuse to write typescript if that is a symlink +* script: accept -V to output version +* whereis: also search /usr/share/man. +* hwclock: improve locale handling +* hwclock: fix for Nautilus (Neoklis Kyriazis) +* isosize: new + +util-linux 2.10r: + +* mount: support mount by uuid or label for xfs (Nathan Scott) +* mount: added probe for minix on bigendian systems (Nathan Scott) +* mount: added probes for cramfs, hfs, hpfs and adfs (Sepp Wijnands) +* mount: change setup; let umount remove at most one line from /etc/mtab +* mount: improve man page +* more, col, colcrt, colrm, column, ul: nls improvements (Masao Kawamura) + +util-linux 2.10q: + +* mount: accept nonnumeric uid= and gid= options +* write and wall: security improvement +* fixed fdformat flaw (Werner Almesberger) +* use right mountport upon umount (Glenn Lingle) +* simpleinit / need / initctl stuff (Richard Gooch) +* Portuguese messages (Rodrigo Stulzer Lopes et al.) + +util-linux 2.10p: + +* mount: don't set up a loop file with -o loop,remount (Marc Mutz) +* fdisk: changes for sectorsize different from 512 +* more: standout fix (Paul Vojta) +* more: improve usage message (Lincoln Myers) +* logger: Added -d option to use datagrams (Gerwin Pfab) +* cal: Added -3 option to also print prev/next month (Michael Charles Pruznick) +* French messages (Christophe Merlet) +* Japanese messages (Daisuke Yamashita) + +util-linux 2.10o: + +* fdformat: fixed to work with kernel 2.4.0test6 (Marek Wojtowicz) +* losetup: also return status when only showing loop device status (ewt) +* mount: do not retry ro if mount was ro; improve error message +* login: not installed suid +* getopt: by default install aux files in /usr/share/misc + +util-linux 2.10n: + +* added blockdev.8 +* change to elvtune (andrea) +* fixed overrun in agetty (vii@penguinpowered.com) +* shutdown: prefer umounting by mount point (rgooch) +* fdisk: added plan9 +* fdisk: remove empty links in chain of extended partitions +* mount: define ALWAYS_STAT +* mount: add replace, after, before, over, bind +* umount: also free loop device when not writing mtab +* lomount: try both /dev/loopN and /dev/loop/N +* hwclock: handle both /dev/rtc and /dev/efirtc (Bill Nottingham) +* script: added -f (flush) option (Ivan Schreter) +* script: added -q (quiet) option (Per Andreas Buer) +* getopt: updated to version 1.1.0 (Frodo Looijaard) +* Czech messages (Jiri Pavlovsky) + util-linux 2.10m: * chfn fix when PAM is used (Martin-D. Lacasse) @@ -6,6 +79,7 @@ util-linux 2.10m: * mount new option -l: also print label when listing mounts * mount add heuristic for xfs (Martin K. Petersen) * mount UUID and label cache (Erik Troan) +* mount improve check for `already mounted' in case of label or uuid * fdisk partition names more devfs-friendly * fdisk bsdlabel large disk support * setterm.1: options documented (Colin Watson) diff --git a/INSTALL b/INSTALL index 2f960b1f09..fe3359fca5 100644 --- a/INSTALL +++ b/INSTALL @@ -37,6 +37,10 @@ To install from source: If you have compilation problems: tell util-linux@math.uio.no about it. +Compilation will fail on a minix filesystem with 14-byte filenames +since for example mount_guess_fstype.h, mount_guess_fstype.c and +mount_guess_fstype.o will be the same file. (However, 30 bytes suffice.) + A glibc header bug causes /usr/include/bits/string2.h:419: warning: pointer of type `void *' used in arithmetic @@ -50,6 +54,7 @@ broken. Several old libc have complaints like /usr/include/sys/syslog.h:71: warning: missing braces around initializer + /usr/include/sys/syslog.h:87: warning: aggregate has a partly bracketed initializer /usr/include/rpc/xdr.h:103: warning: function declaration isn't a prototype /usr/include/rpc/auth.h:86: warning: function declaration isn't a prototype /usr/include/rpc/svc.h:79: warning: function declaration isn't a prototype diff --git a/MAINTAINER b/MAINTAINER index 5cd7a84e91..7fdaafc126 100644 --- a/MAINTAINER +++ b/MAINTAINER @@ -1,2 +1,4 @@ -Maintainer: Andries Brouwer (aeb@cwi.nl) +Maintainer: Andries Brouwer Maintainer address: util-linux@math.uio.no + +Maintainer of simpleinit: Richard Gooch diff --git a/MCONFIG b/MCONFIG index f1f0e3d076..a97f259d84 100644 --- a/MCONFIG +++ b/MCONFIG @@ -7,11 +7,11 @@ # - set USE_TTY_GROUP=no # - define DESTDIR -# Select for CPU one of intel, alpha, sparc, arm, m68k, mips -CPU=$(shell uname -m | sed 's/i.86/intel/;s/arm.*/arm/') - -# define where is locale directrory (default /usr/share/locale) -LOCALEDIR=/usr/share/locale +# Select for ARCH one of intel, alpha, sparc, arm, m68k, mips +# Select for CPU i386 if the binaries must be able to run on an intel 386 +# (by default i486 code is generated, see below) +CPU=$(shell uname -m) +ARCH=$(shell echo $(CPU) | sed 's/i.86/intel/;s/arm.*/arm/') # If HAVE_PAM is set to "yes", then login, chfn, chsh, and newgrp # will use PAM for authentication. Additionally, passwd will not be @@ -65,6 +65,12 @@ HAVE_GETTY=no # properly.] USE_TTY_GROUP=yes +# If ALLOW_VCS_USE is set to "yes", then login will chown /dev/vcsN +# to the current user, allowing her to make a screendump and do other +# nifty things on the console, but also allowing him to keep an open +# file descriptor after logging out to trick the next user. +ALLOW_VCS_USE=yes + # If HAVE_RESET is set to "yes", then reset won't be installed. The version # of reset that comes with the ncurses package is less aggressive. HAVE_RESET=yes @@ -81,40 +87,27 @@ HAVE_TSORT=no # If HAVE_FDUTILS is set to "yes", then setfdprm won't be installed. HAVE_FDUTILS=no -# Get CC from environment if defined -ifeq "$(CC)" "" - CC= gcc -endif - # Different optimizations for different cpus. -# Change the -m486 part if you have a 386. -ifeq "$(CPU)" "intel" - OPT= -pipe -O2 -m486 -fomit-frame-pointer +ifeq "$(ARCH)" "intel" + ifeq "$(CPU)" "i386" + OPT= -pipe -O2 -m386 -fomit-frame-pointer + else + OPT= -pipe -O2 -m486 -fomit-frame-pointer + endif else - ifeq "$(CPU)" "arm" + ifeq "$(ARCH)" "arm" OPT= -pipe -O2 -fsigned-char -fomit-frame-pointer else OPT= -O2 -fomit-frame-pointer endif endif -LDFLAGS = -s - WARNFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes LIB=../lib ERR_O=$(LIB)/err.o -CFLAGS = $(OPT) -I. -I$(LIB) $(WARNFLAGS) \ - $(CURSESFLAGS) $(SLANGFLAGS) \ - $(EXTRACFLAGS) \ - -DSBINDIR=\"$(SBINDIR)\" \ - -DUSRSBINDIR=\"$(USRSBINDIR)\" \ - -DLOGDIR=\"$(LOGDIR)\" \ - -DVARPATH=\"$(VARPATH)\" \ - -DLOCALEDIR=\"$(LOCALEDIR)\" - # Set HAVE_SLANG to yes if you have slang (and prefer to use that for cfdisk) # (If neither HAVE_NCURSES nor HAVE_SLANG is defined, cfdisk is not made.) # HAVE_SLANG=yes @@ -125,7 +118,6 @@ CFLAGS = $(OPT) -I. -I$(LIB) $(WARNFLAGS) \ # (no extra definition required). LIBSLANG=-lslang - DEVDIR= $(DESTDIR)/dev ETCDIR= $(DESTDIR)/etc SBINDIR= $(DESTDIR)/sbin @@ -133,6 +125,8 @@ USRSBINDIR= $(DESTDIR)/usr/sbin USRLIBDIR= $(DESTDIR)/usr/lib USRBINDIR= $(DESTDIR)/usr/bin USRGAMESDIR= $(DESTDIR)/usr/games +USRSHAREMISCDIR=$(DESTDIR)/usr/share/misc +LOCALEDIR= $(DESTDIR)/usr/share/locale BINDIR= $(DESTDIR)/bin VARPATH= $(DESTDIR)/var LOGDIR= $(DESTDIR)/var/log @@ -153,8 +147,8 @@ FSCKDIR= $(SBINDIR) # Directory for passwd PASSWDDIR= $(USRBINDIR) -# Directory for help file for more. Some may want /usr/share/misc . -MOREHELPDIR= $(USRLIBDIR) +# Directory for help file for more. Used to be /usr/lib. +MOREHELPDIR= $(USRSHAREMISCDIR) # Modes DIRMODE= 755 @@ -172,6 +166,15 @@ INSTALLMAN= $(INSTALL) -m $(MANMODE) INSTALLDAT= $(INSTALL) -m $(DATMODE) INSTALLSUID= $(INSTALL) -m $(SUIDMODE) -o root +CFLAGS := $(CFLAGS) $(OPT) -I$(LIB) $(WARNFLAGS) \ + $(CURSESFLAGS) $(SLANGFLAGS) \ + -DSBINDIR=\"$(SBINDIR)\" \ + -DUSRSBINDIR=\"$(USRSBINDIR)\" \ + -DLOGDIR=\"$(LOGDIR)\" \ + -DVARPATH=\"$(VARPATH)\" \ + -DLOCALEDIR=\"$(LOCALEDIR)\" + + %.o: %.c $(CC) -c $(CFLAGS) $< -o $@ diff --git a/Makefile b/Makefile index b67fb3d4b0..0d68c83336 100644 --- a/Makefile +++ b/Makefile @@ -10,14 +10,14 @@ include ./MCONFIG SUBDIRS=po \ lib \ - getopt-1.0.3b \ + getopt-1.1.0a \ disk-utils \ games \ login-utils \ misc-utils \ mount \ fdisk \ - clock \ + hwclock \ sys-utils \ text-utils \ kbd diff --git a/README b/README new file mode 100644 index 0000000000..48a0b13a16 --- /dev/null +++ b/README @@ -0,0 +1,9 @@ +util-linux is a random collection of Linux utilities + +The stuff in the subdirectories mount, fdisk, disk-utils, text-utils, +misc-utils, sys-utils, getopt-* should be rather distribution-neutral, +and installing it does no harm. +On the other hand, the stuff in login-utils defines initial boot-time +stuff, things that are done in different ways by different distributions. +If you install it, your machine may not boot anymore. +No RPMs are provided - get yours from your distributor. diff --git a/VERSION b/VERSION index d877938d22..77744d0d22 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.10m +2.10s diff --git a/configure b/configure index 4ac10b0463..fd5ab6422f 100755 --- a/configure +++ b/configure @@ -3,27 +3,35 @@ # # We need to find out the following things: # -# 1. For mount/nfsmount.c: is inet_aton() available? -# 2. For fdisk/fdisksunlabel.c: is there a ? -# For fdisk/fdisk.c: is there a ? -# 4. For sys-utils/cytune.c: do we need ? -# 5. For sys-utils/kbd_rate.c: does exist? -# 6. For cfdisk, setterm, more, ul: do we have ncurses? How installed? -# For more: do we have libtermcap? -# 7. For chfn, chsh, login, newgrp, passwd: do we need -lcrypt? -# 8. For sln: does static compilation work? -# 9. For lib/nls.h: do we have ? -# 10. For lib/nls.h: do we have and gettext()? -# 11. For xgettext: does it take the option --foreign-user? -# 12. For cal.c: do we have ? -# 13. For err.c: do we have __progname? -# 14. For script.c: do we have and openpty()? -# 15. For lib/widechar.h: do we have wide character support? -# 16. For clock/kd.c: do we have nanosleep()? -# 17. For mkswap: do we have personality()? -# 18. For pivot_root.c: does define __NR_pivot_root? -# 19. For hwclock.c: does struct tm have a field tm_gmtoff? -# 20. For nfsmount: does the output of rpcgen compile? +# Existence of header files: +# H1. For fdisksunlabel.c: is there a ? +# H2. For fdisk.c: is there a ? +# H3. For kbd_rate.c: does exist? +# H4. For nls.h: do we have ? +# H5. For cal.c: do we have ? +# H6. For mkswap.c: do we have ? +# H7. For nfsmount.h (nfsmount_xdr.c: int32_t): do we have ? +# +# Existence of functions: +# F1. For nfsmount.c: is inet_aton() available? +# F2. For mkswap.c: is fsync() available? +# F3. For agetty.c: is getdomainname() available? +# F4. For hwclock/kd.c: do we have nanosleep()? +# F5. For mkswap.c: do we have personality()? +# +# 1. For sys-utils/cytune.c: do we need ? +# 2. For cfdisk, setterm, more, ul: do we have ncurses? How installed? +# 3. For more: do we have libtermcap? +# 4. For chfn, chsh, login, newgrp, passwd: do we need -lcrypt? +# 5. For sln: does static compilation work? +# 6. For lib/nls.h: do we have and gettext()? +# 7. For xgettext: does it take the option --foreign-user? +# 8. For err.c: do we have __progname? +# 9. For script.c: do we have and openpty()? +# 10. For lib/widechar.h: do we have wide character support? +# 11. For pivot_root.c: does define __NR_pivot_root? +# 12. For hwclock.c: does struct tm have a field tm_gmtoff? +# 13. For nfsmount: does the output of rpcgen compile? rm -f make_include defines.h @@ -36,24 +44,13 @@ echo '#define UTIL_LINUX_VERSION "'$VERSION'"' > defines.h echo '#define util_linux_version "util-linux-'$VERSION'"' >> defines.h echo >> defines.h -if test -z "$CC" -then - if test "$RANDOM" = "$RANDOM"; then - # Plain old Bourne shell. - echo checking for gcc - test -z "$CC" -a -n "`gcc 2>&1`" && CC="gcc -O" - else - # ksh, bash or zsh. ksh and zsh write "command not found" to stderr. - echo checking for gcc - test -z "$CC" && type gcc && CC="gcc -O" - fi -else - echo "Using CC=\"$CC\"" - echo -fi - CC=${CC-cc} CFLAGS=${CFLAGS-"-O"} +LDFLAGS=${LDFLAGS-"-s"} +echo CC=$CC >> make_include +echo CFLAGS=$CFLAGS >> make_include +echo LDFLAGS=$LDFLAGS >> make_include + DEFS= LIBS= compile='$CC $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1' @@ -63,8 +60,80 @@ export COMPILE rm -f conftest.c conftest + +# +# Find out about the existence of header files +# + # -# 1. For mount/nfsmount.c: is inet_aton() available? +# H1. For fdisk/fdisksunlabel.c: is available? +# Some kernels have that uses u_char +# But maybe there is already a typedef. Let us use a #define +# +echo " +#define u_char unsigned char +#include +#undef u_char +main(){ exit(0); } +" > conftest.c +eval $compile +if test -s conftest && ./conftest 2>/dev/null; then + echo "#define HAVE_scsi_h" >> defines.h + echo "You have " +else + echo "You don't have " +fi +rm -f conftest conftest.c + +# +# H2. For fdisk/fdisk.c: is available? +# +if ./testincl "linux/blkpg.h"; then + echo "#define HAVE_blkpg_h" >> defines.h +fi + +# +# H3. Does exist? +# +if ./testincl "linux/kd.h"; then + echo "#define HAVE_kd_h" >> defines.h +fi + +# +# H4. For lib/nls.h: do we have ? +# +if ./testincl "locale.h"; then + echo "#define HAVE_locale_h" >> defines.h +fi + +# +# H5. For cal.c: do we have ? +# +if ./testincl "langinfo.h"; then + echo "#define HAVE_langinfo_h" >> defines.h +fi + +# +# H6. For mkswap.c: do we have ? +# +if ./testincl "asm/page.h"; then + echo "#define HAVE_asm_page_h" >> defines.h +fi + +# +# H7. For nfsmount.h: do we have ? +# +if ./testincl "asm/types.h"; then + echo "#define HAVE_asm_types_h" >> defines.h +fi + + +# +# Find out about the existence of functions +# + +# +# F1. For mount/nfsmount.c: is inet_aton() available? # echo " #include @@ -86,34 +155,88 @@ fi rm -f conftest conftest.c # -# 2. For fdisk/fdisksunlabel.c: is available? -# Some kernels have that uses u_char -# But maybe there is already a typedef. Let us use a #define +# F2. For mkswap.c: is fsync() available? # echo " -#define u_char unsigned char -#include -#undef u_char -main(){ exit(0); } +#include +main(int a, char **v){ + if (a == -1) /* false */ + fsync(0); + exit(0); +} " > conftest.c eval $compile if test -s conftest && ./conftest 2>/dev/null; then - echo "#define HAVE_scsi_h" >> defines.h - echo "You have " + echo "#define HAVE_fsync" >> defines.h + echo "You have fsync()" else - echo "You don't have " + echo "You don't have fsync()" fi rm -f conftest conftest.c # -# 2A. For fdisk/fdisk.c: is available? +# F3. For agetty.c: is getdomainname() available? # -if ./testincl "linux/blkpg.h"; then - echo "#define HAVE_blkpg_h" >> defines.h +echo " +#include +main(int a, char **v){ + char buf[1]; + if (a == -1) /* false */ + getdomainname(buf, sizeof buf); + exit(0); +} +" > conftest.c +eval $compile +if test -s conftest && ./conftest 2>/dev/null; then + echo "#define HAVE_getdomainname" >> defines.h + echo "You have getdomainname()" +else + echo "You don't have getdomainname()" fi +rm -f conftest conftest.c # -# 4. cytune.c may need struct tq_struct +# F4. For hwclock/kd.c: do we have nanosleep? +# +echo " +#include +int main () { + struct timespec sleep = { 0, 1 }; + nanosleep( &sleep, NULL ); + exit(0); +} +" > conftest.c +eval $compile +if test -s conftest && ./conftest 2>/dev/null; then + echo "#define HAVE_nanosleep" >> defines.h + echo "You have nanosleep()" +else + echo "You don't have nanosleep()" +fi +rm -f conftest conftest.c + +# +# F5. For mkswap.c: do we have personality()? +# +echo " +int main () { + extern int personality(unsigned long); + personality(0); + exit(0); +} +" > conftest.c +eval $compile +if test -s conftest && ./conftest 2>/dev/null; then + echo "#define HAVE_personality" >> defines.h + echo "You have personality()" +else + echo "You don't have personality()" +fi +rm -f conftest conftest.c + + +# +# 1. cytune.c may need struct tq_struct # echo " #include @@ -130,14 +253,7 @@ fi rm -f conftest conftest.c # -# 5. Does exist? -# -if ./testincl "linux/kd.h"; then - echo "#define HAVE_kd_h" >> defines.h -fi - -# -# 6. How is [n]curses installed? +# 2. How is [n]curses installed? # test_curses_h=0 have_ncurses=1 @@ -214,7 +330,7 @@ fi rm -f conftest conftest.c # -# 7. Do we need -lcrypt? +# 4. Do we need -lcrypt? # echo ' #define _XOPEN_SOURCE @@ -232,7 +348,7 @@ fi rm -f conftest conftest.c # -# 8. Does static compilation work? +# 5. Does static compilation work? # echo " main(){ return 0; } @@ -244,17 +360,10 @@ else echo "CAN_DO_STATIC=no" >> make_include echo "Strange... Static compilation fails here." fi +rm -f conftest.c conftest # -# 9. For lib/nls.h: do we have ? -# -if ./testincl "locale.h"; then - echo "#define HAVE_locale_h" >> defines.h -fi - - -# -# 10. For lib/nls.h: do we have and gettext() ? +# 6. For lib/nls.h: do we have and gettext() ? # echo ' #include @@ -280,7 +389,7 @@ rm -f conftest conftest.c # -# 11. Does xgettext exist and take the option --foreign-user? +# 7. Does xgettext exist and take the option --foreign-user? # if (test $ENABLE_NLS = yes && type xgettext > /dev/null 2>&1); then msg=`xgettext --foreign-user 2>&1 | grep unrecognized` @@ -294,16 +403,9 @@ else echo "HAVE_XGETTEXT=no" >> make_include fi -# -# 12. For cal.c: do we have ? -# -if ./testincl "langinfo.h"; then - echo "#define HAVE_langinfo_h" >> defines.h -fi - # -# 13. For err.c: do we have __progname? +# 8. For err.c: do we have __progname? # [make sure gcc -O does not optimize the access away] # echo " @@ -321,7 +423,7 @@ fi rm -f conftest conftest.c # -# 14. For script.c: do we have and openpty()? +# 9. For script.c: do we have and openpty()? # echo " #include @@ -340,7 +442,7 @@ fi rm -f conftest conftest.c # -# 15. For lib/widechar.h: do we have wide character support? +# 10. For lib/widechar.h: do we have wide character support? # [Do we have the headers , , the types wchar_t, wint_t # and the fgetwc, fputwc, WEOF functions/macros?] # @@ -368,46 +470,7 @@ fi rm -f conftest conftest.c # -# 16. For clock/kd.c: do we have nanosleep? -# -echo " -#include -int main () { - struct timespec sleep = { 0, 1 }; - nanosleep( &sleep, NULL ); - exit(0); -} -" > conftest.c -eval $compile -if test -s conftest && ./conftest 2>/dev/null; then - echo "#define HAVE_nanosleep" >> defines.h - echo "You have nanosleep()" -else - echo "You don't have nanosleep()" -fi -rm -f conftest conftest.c - -# -# 17. For mkswap.c: do we have personality()? -# -echo " -int main () { - extern int personality(unsigned long); - personality(0); - exit(0); -} -" > conftest.c -eval $compile -if test -s conftest && ./conftest 2>/dev/null; then - echo "#define HAVE_personality" >> defines.h - echo "You have personality()" -else - echo "You don't have personality()" -fi -rm -f conftest conftest.c - -# -# 18. For pivot_root.c: does define __NR_pivot_root? +# 11. For pivot_root.c: does define __NR_pivot_root? # echo " #include @@ -426,7 +489,7 @@ fi rm -f conftest conftest.c # -# 19. For hwclock.c: does struct tm have a field tm_gmtoff? +# 12. For hwclock.c: does struct tm have a field tm_gmtoff? # echo " #include @@ -449,9 +512,15 @@ fi rm -f conftest conftest.c # -# 20. For nfsmount: does the output of rpcgen compile? +# 13. For nfsmount: does the output of rpcgen compile? +# +# On some systems the output of rpcgen compiles with warnings +# Here we conclude "Your rpcgen output does not compile" +# and use pregenerated files. If one wishes to use rpcgen anyway, +# just add the line "HAVE_GOOD_RPC=yes" to make_include. # rm -f conftest conftestx.c conftestl.c conftest.h conftest.x +rm -f conftestx.o conftestl.o echo " #ifdef RPC_CLNT %#include /* for memset() */ @@ -476,10 +545,10 @@ program MOUNTPROG { } = 2; } = 100005; " > conftest.x -if rpcgen -h -o conftest.h conftest.x && \ - rpcgen -c -o conftestx.c conftest.x && \ - rpcgen -l -o conftestl.c conftest.x && \ - cc -c conftestx.c 2> conferrs && cc -c conftestl.c 2>> conferrs && \ +if rpcgen -h -o conftest.h conftest.x 2> conferrs && \ + rpcgen -c -o conftestx.c conftest.x 2>> conferrs && \ + rpcgen -l -o conftestl.c conftest.x 2>> conferrs && \ + cc -c conftestx.c 2>> conferrs && cc -c conftestl.c 2>> conferrs && \ test ! -s conferrs then echo "HAVE_GOOD_RPC=yes" >> make_include @@ -488,3 +557,4 @@ else echo "Your rpcgen output does not compile" fi rm -f conftest conftestx.c conftestl.c conftest.h conftest.x conferrs +rm -f conftestx.o conftestl.o diff --git a/disk-utils/Makefile b/disk-utils/Makefile index ab9237c88e..af15ee4105 100644 --- a/disk-utils/Makefile +++ b/disk-utils/Makefile @@ -8,16 +8,17 @@ include ../MCONFIG # Where to put man pages? -MAN8= fdformat.8 mkfs.8 mkswap.8 elvtune.8 fsck.minix.8 mkfs.minix.8 mkfs.bfs.8 +MAN8= blockdev.8 fdformat.8 isosize.8 mkfs.8 mkswap.8 elvtune.8 \ + fsck.minix.8 mkfs.minix.8 mkfs.bfs.8 # Where to put binaries? # See the "install" rule for the links. . . -SBIN= mkfs mkswap blockdev elvtune fsck.minix mkfs.minix mkfs.bfs +SBIN= mkfs mkswap blockdev elvtune fsck.minix mkfs.minix mkfs.bfs -USRBIN= fdformat +USRBIN= fdformat isosize -ETC= fdprm +ETC= fdprm ifneq "$(HAVE_FDUTILS)" "yes" USRBIN:=$(USRBIN) setfdprm @@ -47,4 +48,4 @@ endif .PHONY: clean clean: - -rm -f *.o *~ core $(SBIN) $(USRBIN) + -rm -f *.o *~ core $(SBIN) $(USRBIN) raw diff --git a/disk-utils/blockdev.8 b/disk-utils/blockdev.8 new file mode 100644 index 0000000000..bde64265f5 --- /dev/null +++ b/disk-utils/blockdev.8 @@ -0,0 +1,55 @@ +.\" -*- nroff -*- +.\" Copyright 1998 Andries E. Brouwer (aeb@cwi.nl) +.\" +.\" May be distributed under the GNU General Public License +.TH BLOCKDEV 8 "May 2000" "" +.SH NAME +blockdev \- call block device ioctls from the command line +.SH SYNOPSIS +.B blockdev +.RI [ options ] +.I commands devices +.SH DESCRIPTION +The utility +.B blockdev +allows one to call block device ioctls from the command line. +.SH OPTIONS +.TP +.B \-V +Print version and exit. +.TP +.B \-q +Be quiet. +.TP +.B \-v +Be verbose. +.SH COMMANDS +.TP +.B \--setro +Set read-only. +.TP +.B \--setrw +Set read-write. +.TP +.B \--getro +Get read-only. Print 1 if the device is read-only, 0 otherwise. +.TP +.B \--getss +Print sectorsize in bytes - usually 512. +.TP +.B \--getsize +Print device capacity (in 512-byte sectors). +.TP +.BI \--setra " N" +Set readahead to +.I N +512-byte sectors. +.TP +.B \--getra +Print readahead (in 512-byte sectors). +.TP +.B \--flushbufs +Flush buffers. +.TP +.B \--rereadpt +Reread partition table. diff --git a/disk-utils/elvtune.c b/disk-utils/elvtune.c index 00640fedec..75ab57c0e9 100644 --- a/disk-utils/elvtune.c +++ b/disk-utils/elvtune.c @@ -26,28 +26,33 @@ #include #include #include - -#define BLKELVGET _IO(0x12,106)/* elevator get */ -#define BLKELVSET _IO(0x12,107)/* elevator set */ +#include "nls.h" /* this has to match with the kernel structure */ +/* current version for ac19 and 2.2.16 */ typedef struct blkelv_ioctl_arg_s { - void * queue_ID; + int queue_ID; int read_latency; int write_latency; int max_bomb_segments; } blkelv_ioctl_arg_t; +#define BLKELVGET _IOR(0x12,106,sizeof(blkelv_ioctl_arg_t)) +#define BLKELVSET _IOW(0x12,107,sizeof(blkelv_ioctl_arg_t)) + static void usage(void) { - fprintf(stderr, "usage:\n\telvtune [-r r_lat] [-w w_lat] [-b b_lat] /dev/blkdev1 [/dev/blkdev2...]\n"); + fprintf(stderr, "elvtune (%s)\n", util_linux_version); + fprintf(stderr, _("usage:\n")); + fprintf(stderr, "\telvtune [-r r_lat] [-w w_lat] [-b b_lat]" + " /dev/blkdev1 [/dev/blkdev2...]\n"); fprintf(stderr, "\telvtune -h\n"); fprintf(stderr, "\telvtune -v\n"); } static void version(void) { - fprintf(stderr, "elvtune: version 1.0\n"); + fprintf(stderr, "elvtune (%s)\n", util_linux_version); } int @@ -128,7 +133,7 @@ main(int argc, char * argv[]) { } } - printf("\n%s elevator ID %p\n", devname, elevator.queue_ID); + printf("\n%s elevator ID\t\t%d\n", devname, elevator.queue_ID); printf("\tread_latency:\t\t%d\n", elevator.read_latency); printf("\twrite_latency:\t\t%d\n", elevator.write_latency); printf("\tmax_bomb_segments:\t%d\n\n", elevator.max_bomb_segments); diff --git a/disk-utils/fdformat.c b/disk-utils/fdformat.c index 0251e34404..b4aec0076b 100644 --- a/disk-utils/fdformat.c +++ b/disk-utils/fdformat.c @@ -1,4 +1,4 @@ -/* fdformat.c - Low-level formats a floppy disk. */ +/* fdformat.c - Low-level formats a floppy disk - Werner Almesberger */ /* 1999-02-22 Arkadiusz Mi¶kiewicz * - added Native Language Support @@ -135,11 +135,11 @@ int main(int argc,char **argv) exit(1); } if (access(argv[1],W_OK) < 0) PERROR(argv[1]); - if ((ctrl = open(argv[1],3)) < 0) PERROR(argv[1]); + if ((ctrl = open(argv[1],O_WRONLY)) < 0) PERROR(argv[1]); if (ioctl(ctrl,FDGETPRM,(long) ¶m) < 0) PERROR(_("Could not determine current format type")); printf(_("%s-sided, %d tracks, %d sec/track. Total capacity %d kB.\n"), - param.head ? _("Double") : _("Single"), + (param.head == 2) ? _("Double") : _("Single"), param.track, param.sect,param.size >> 1); format_disk(argv[1]); if (verify) verify_disk(argv[1]); diff --git a/disk-utils/isosize.8 b/disk-utils/isosize.8 new file mode 100644 index 0000000000..47ab71fc5e --- /dev/null +++ b/disk-utils/isosize.8 @@ -0,0 +1,29 @@ +.TH ISOSIZE "8" "December 2000" "sg3_utils-0.91" SG_UTILS +.SH NAME +isosize \- outputs the length of a iso9660 file system +.SH SYNOPSIS +.B isosize +[\fI-x\fR] [\fI-d \fR] \fI\fR... +.SH DESCRIPTION +.\" Add any additional description here +.PP +This command outputs the length of an iso9660 file system that +is contained in given file. That file may be a normal file or +a block device (e.g. /dev/hdd or /dev/sr0). In the absence of +any switches (or errors) it will output the size of the iso9660 +file system in bytes. This can now be a large number (> > 4 GB). +.TP +-x +output in humanly readable form the block count and the block +size. Output uses the term "sectors" for "blocks". +.TP +-d +only has affect when "-x" is not given. The number output (if no errors) +is the iso9660 file size in bytes divided by . So if is +the block size then the output number will be the block count. +.PP +The size of the file (or block device) holding a iso9660 file +system can be marginally larger than the actual size of the +iso9660 file system. One reason for this is that cd writers +are allowed to add "run out" sectors at the end of a iso9660 +image. diff --git a/disk-utils/isosize.c b/disk-utils/isosize.c new file mode 100644 index 0000000000..bff45d923b --- /dev/null +++ b/disk-utils/isosize.c @@ -0,0 +1,218 @@ +/* + * isosize.c - Andries Brouwer, 000608 + * + * use header info to find size of iso9660 file system + * output a number - useful in scripts + * + * Synopsis: + * isosize [-x] [-d ] + * where "-x" gives length in sectors and sector size while + * without this argument the size is given in bytes + * without "-x" gives length in bytes unless "-d " is + * given. In the latter case the length in bytes divided + * by is given + * + * Version 2.03 2000/12/21 + * - add "-d " option and use long long to fix things > 2 GB + * Version 2.02 2000/10/11 + * - error messages on IO failures [D. Gilbert] + * + */ +#include +#include +#include +#include +#include +#include + +#include "nls.h" + +#define ISODCL(from, to) (to - from + 1) + +int xflag; + +static int +isonum_721 (unsigned char * p) { + return ((p[0] & 0xff) + | ((p[1] & 0xff) << 8)); +} + +static int +isonum_722 (unsigned char * p) { + return ((p[1] & 0xff) + | ((p[0] & 0xff) << 8)); +} + +static int +isonum_723 (unsigned char * p) { + int le = isonum_721 (p); + int be = isonum_722 (p+2); + if (xflag && le != be) + /* translation is useless */ + fprintf(stderr, "723error: le=%d be=%d\n", le, be); + return (le); +} + +static int +isonum_731 (unsigned char * p) { + return ((p[0] & 0xff) + | ((p[1] & 0xff) << 8) + | ((p[2] & 0xff) << 16) + | ((p[3] & 0xff) << 24)); +} + +static int +isonum_732 (unsigned char * p) { + return ((p[3] & 0xff) + | ((p[2] & 0xff) << 8) + | ((p[1] & 0xff) << 16) + | ((p[0] & 0xff) << 24)); +} + + +static int +isonum_733 (unsigned char * p) { + int le = isonum_731 (p); + int be = isonum_732 (p+4); + if (xflag && le != be) + /* translation is useless */ + fprintf(stderr, "733error: le=%d be=%d\n", le, be); + return (le); +} + +struct iso_primary_descriptor { + unsigned char type [ISODCL ( 1, 1)]; /* 711 */ + unsigned char id [ISODCL ( 2, 6)]; + unsigned char version [ISODCL ( 7, 7)]; /* 711 */ + unsigned char unused1 [ISODCL ( 8, 8)]; + unsigned char system_id [ISODCL ( 9, 40)]; /* auchars */ + unsigned char volume_id [ISODCL ( 41, 72)]; /* duchars */ + unsigned char unused2 [ISODCL ( 73, 80)]; + unsigned char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ + unsigned char unused3 [ISODCL ( 89, 120)]; + unsigned char volume_set_size [ISODCL (121, 124)]; /* 723 */ + unsigned char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ + unsigned char logical_block_size [ISODCL (129, 132)]; /* 723 */ + unsigned char path_table_size [ISODCL (133, 140)]; /* 733 */ + unsigned char type_l_path_table [ISODCL (141, 144)]; /* 731 */ + unsigned char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ + unsigned char type_m_path_table [ISODCL (149, 152)]; /* 732 */ + unsigned char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ + unsigned char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ + unsigned char volume_set_id [ISODCL (191, 318)]; /* duchars */ + unsigned char publisher_id [ISODCL (319, 446)]; /* achars */ + unsigned char preparer_id [ISODCL (447, 574)]; /* achars */ + unsigned char application_id [ISODCL (575, 702)]; /* achars */ + unsigned char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ + unsigned char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ + unsigned char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ + unsigned char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ + unsigned char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ + unsigned char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ + unsigned char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ + unsigned char file_structure_version [ISODCL (882, 882)]; /* 711 */ + unsigned char unused4 [ISODCL (883, 883)]; + unsigned char application_data [ISODCL (884, 1395)]; + unsigned char unused5 [ISODCL (1396, 2048)]; +}; + +const char *progname; +int divisor = 0; + +static void +isosize(char *filenamep) { + int fd, nsecs, ssize; + struct iso_primary_descriptor ipd; + + if ((fd = open(filenamep, O_RDONLY)) < 0) { + perror(filenamep); + fprintf(stderr, _("%s: failed to open: %s\n"), + progname, filenamep); + exit(1); + } + if (lseek(fd, 16 << 11, 0) == (off_t)-1) { + perror("lseek"); + fprintf(stderr, _("%s: seek error on %s\n"), + progname, filenamep); + exit(1); + } + if (read(fd, &ipd, sizeof(ipd)) < 0) { + perror("read"); + fprintf(stderr, _("%s: read error on %s\n"), + progname, filenamep); + exit(1); + } + + nsecs = isonum_733(ipd.volume_space_size); + ssize = isonum_723(ipd.logical_block_size); /* nowadays always 2048 */ + + if (xflag) { + printf (_("sector count: %d, sector size: %d\n"), + nsecs, ssize); + } else { + long long product = nsecs; + + if (divisor == 0) + printf ("%lld\n", product * ssize); + else if (divisor == ssize) + printf ("%d\n", nsecs); + else + printf ("%lld\n", (product * ssize) / divisor); + } +} + +int +main(int argc, char * argv[]) { + int j, ct; + char *p; + + progname = argv[0]; + if ((p = strrchr(progname, '/')) != NULL) + progname = p+1; + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + if (argc >= 2 && + (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))) { + printf(_("%s from %s\n"), progname, util_linux_version); + exit(0); + } + + for (;;) { + int opt; + + opt = getopt(argc, argv, "xd:"); + if (opt < 0) + break; + switch (opt) { + case 'd': + divisor = atoi(optarg); + break; + case 'x': + xflag = 1; + break; + default: + fprintf(stderr, + _("%s: option parse error\n"), progname); + exit(1); + } + } + + ct = argc - optind; + + if (ct <= 0) { + fprintf(stderr, _("Usage: %s [-x] [-d ] iso9660-image\n"), + progname); + exit(1); + } + + for (j = optind; j < argc; j++) { + if (ct > 1) + printf("%s: ", argv[j]); + isosize(argv[j]); + } + + return 0; +} diff --git a/disk-utils/mkfs.bfs.c b/disk-utils/mkfs.bfs.c index a8f5578377..b27fd2eb69 100644 --- a/disk-utils/mkfs.bfs.c +++ b/disk-utils/mkfs.bfs.c @@ -15,14 +15,13 @@ #include #include #include +#include "nls.h" /* cannot include */ #ifndef BLKGETSIZE #define BLKGETSIZE _IO(0x12,96) /* return device size */ #endif -#include "../defines.h" /* for util_linux_version */ - #define BFS_ROOT_INO 2 #define BFS_NAMELEN 14 #define BFS_BLOCKSIZE 512 @@ -85,9 +84,9 @@ fatal(char *s, ...) { static void usage(void) { - fprintf(stderr, + fprintf(stderr, _( "Usage: %s [-v] [-N nr-of-inodes] [-V volume-name]\n" - " [-F fsname] device [block-count]\n", + " [-F fsname] device [block-count]\n"), progname); exit(1); } @@ -117,7 +116,7 @@ main(int argc, char *argv[]) { if (argc == 2 && (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))) { - printf("%s from %s\n", progname, util_linux_version); + printf(_("%s from %s\n"), progname, util_linux_version); exit(0); } @@ -133,14 +132,14 @@ main(int argc, char *argv[]) { case 'V': len = strlen(optarg); if (len <= 0 || len > 6) - fatal("volume name too long"); + fatal(_("volume name too long")); volume = strdup(optarg); break; case 'F': len = strlen(optarg); if (len <= 0 || len > 6) - fatal("fsname name too long"); + fatal(_("fsname name too long")); fsname = strdup(optarg); break; @@ -165,16 +164,16 @@ main(int argc, char *argv[]) { if (stat(device, &statbuf) == -1) { perror(device); - fatal("cannot stat device %s", device); + fatal(_("cannot stat device %s"), device); } if (!S_ISBLK(statbuf.st_mode)) - fatal("%s is not a block special device", device); + fatal(_("%s is not a block special device"), device); fd = open(device, O_RDWR); if (fd == -1) { perror(device); - fatal("cannot open %s", device); + fatal(_("cannot open %s"), device); } if (optind == argc-1) @@ -185,12 +184,12 @@ main(int argc, char *argv[]) { if (ioctl(fd, BLKGETSIZE, &total_blocks) == -1) { if (!user_specified_total_blocks) { perror("BLKGETSIZE"); - fatal("cannot get size of %s", device); + fatal(_("cannot get size of %s"), device); } total_blocks = user_specified_total_blocks; } else if (user_specified_total_blocks) { if (user_specified_total_blocks > total_blocks) - fatal("blocks argument too large, max is %d", + fatal(_("blocks argument too large, max is %lu"), total_blocks); total_blocks = user_specified_total_blocks; } @@ -205,7 +204,7 @@ main(int argc, char *argv[]) { } else { /* believe the user */ if (inodes > 512) - fatal("too many inodes - max is 512"); + fatal(_("too many inodes - max is 512")); } ino_bytes = inodes * sizeof(struct bfsi); @@ -214,7 +213,7 @@ main(int argc, char *argv[]) { /* mimic the behaviour of SCO's mkfs - maybe this limit is needed */ if (data_blocks < 32) - fatal("not enough space, need at least %d blocks", + fatal(_("not enough space, need at least %lu blocks"), ino_blocks + 33); memset(&sb, 0, sizeof(sb)); @@ -226,19 +225,23 @@ main(int argc, char *argv[]) { memcpy(sb.s_volume, volume, 6); if (verbose) { - fprintf(stderr, "Device: %s\n", device); - fprintf(stderr, "Volume: <%-6s>\n", volume); - fprintf(stderr, "FSname: <%-6s>\n", fsname); - fprintf(stderr, "BlockSize: %d\n", BFS_BLOCKSIZE); - fprintf(stderr, "Inodes: %d (in %ld block%s)\n", - inodes, ino_blocks, (ino_blocks==1) ? "" : "s"); - fprintf(stderr, "Blocks: %ld\n", total_blocks); - fprintf(stderr, "Inode end: %d, Data end: %d\n", + fprintf(stderr, _("Device: %s\n"), device); + fprintf(stderr, _("Volume: <%-6s>\n"), volume); + fprintf(stderr, _("FSname: <%-6s>\n"), fsname); + fprintf(stderr, _("BlockSize: %d\n"), BFS_BLOCKSIZE); + if (ino_blocks==1) + fprintf(stderr, _("Inodes: %d (in 1 block)\n"), + inodes); + else + fprintf(stderr, _("Inodes: %d (in %ld blocks)\n"), + inodes, ino_blocks); + fprintf(stderr, _("Blocks: %ld\n"), total_blocks); + fprintf(stderr, _("Inode end: %d, Data end: %d\n"), sb.s_start-1, sb.s_end); } if (write(fd, &sb, sizeof(sb)) != sizeof(sb)) - fatal("error writing superblock"); + fatal(_("error writing superblock")); memset(&ri, 0, sizeof(ri)); ri.i_ino = BFS_ROOT_INO; @@ -258,29 +261,29 @@ main(int argc, char *argv[]) { ri.i_ctime = now; if (write(fd, &ri, sizeof(ri)) != sizeof(ri)) - fatal("error writing root inode"); + fatal(_("error writing root inode")); memset(&ri, 0, sizeof(ri)); for (i=1; i /* for _IO */ #include #include +#include "nls.h" + +#ifdef HAVE_asm_page_h #include /* for PAGE_SIZE and PAGE_SHIFT */ /* we also get PAGE_SIZE via getpagesize() */ -#include "nls.h" +/* recent glibc systems also define this in */ +#endif + #ifndef _IO /* pre-1.3.45 */ @@ -609,7 +614,9 @@ the -f option to force it.\n"), * A subsequent swapon() will fail if the signature * is not actually on disk. (This is a kernel bug.) */ +#ifdef HAVE_fsync if (fsync(DEV)) die(_("fsync failed")); +#endif return 0; } diff --git a/disk-utils/raw.c b/disk-utils/raw.c index 54e1008cbe..4fc5e24706 100644 --- a/disk-utils/raw.c +++ b/disk-utils/raw.c @@ -161,6 +161,7 @@ int main(int argc, char *argv[]) break; default: + block_major = block_minor = 0; /* just to keep gcc happy */ usage(1); } diff --git a/disk-utils/setfdprm.c b/disk-utils/setfdprm.c index 73b3b7174e..958f98c16c 100644 --- a/disk-utils/setfdprm.c +++ b/disk-utils/setfdprm.c @@ -20,28 +20,29 @@ #define MAXLINE 200 -static int convert(char *arg) -{ +static int +convert(char *arg) { long result; char *end; result = strtol(arg,&end,0); - if (!*end) return (int) result; + if (!*end) + return (int) result; fprintf(stderr,_("Invalid number: %s\n"),arg); exit(1); } - -static void cmd_without_param(int cmd,int fd) -{ - if (ioctl(fd,cmd,NULL) >= 0) exit(0); +static void +cmd_without_param(int cmd,int fd) { + if (ioctl(fd,cmd,NULL) >= 0) + exit(0); perror("ioctl"); exit(1); } - -static void set_params(int cmd,int fd,char **params) -{ +/* set given fd parameters */ +static void +set_params(int cmd,int fd,char **params) { struct floppy_struct ft; ft.size = convert(params[0]); @@ -59,9 +60,9 @@ static void set_params(int cmd,int fd,char **params) exit(1); } - -static void find_params(int cmd,int fd,char *name) -{ +/* find parameter set in file, and use it */ +static void +find_params(int cmd,int fd,char *name) { FILE *file; char line[MAXLINE+2],this[MAXLINE+2],param[9][MAXLINE+2]; char *params[9],*start; @@ -91,9 +92,8 @@ static void find_params(int cmd,int fd,char *name) exit(1); } - -static void usage(char *name) -{ +static void +usage(char *name) { char *this; if ((this = strrchr(name,'/')) != NULL) name = this+1; @@ -109,8 +109,7 @@ gap rate spec1 fmt_gap\n"),name); } int -main(int argc, char **argv) -{ +main(int argc, char **argv) { int fd; unsigned int cmd; char *progname, *p; @@ -129,7 +128,8 @@ main(int argc, char **argv) exit(0); } - if (argc < 3) usage(progname); + if (argc < 2) + usage(progname); cmd = FDSETPRM; if (*argv[1] == '-') { switch (argv[1][1]) { @@ -156,7 +156,7 @@ main(int argc, char **argv) argc--; argv++; } - if ((fd = open(argv[1],3)) < 0) { /* 3 == no access at all */ + if ((fd = open(argv[1],3)) < 0) { /* O_WRONLY needed in a few kernels */ perror(argv[1]); exit(1); } diff --git a/fdisk/Makefile b/fdisk/Makefile index a319c2baf4..3a851fa027 100644 --- a/fdisk/Makefile +++ b/fdisk/Makefile @@ -18,12 +18,13 @@ NOTMADE=cfdisk endif endif -ifeq "$(CPU)" "m68k" +ifeq "$(ARCH)" "m68k" # It seems the m68k people do not want *fdisk else SBIN:=$(SBIN) fdisk MAN8:=$(MAN8) fdisk.8 -ifneq "$(CPU)" "sparc" + +ifneq "$(ARCH)" "sparc" SBIN:=$(SBIN) $(CFDISK) sfdisk MAN8:=$(MAN8) cfdisk.8 sfdisk.8 endif diff --git a/fdisk/common.h b/fdisk/common.h index c5e237148e..86802c41e2 100644 --- a/fdisk/common.h +++ b/fdisk/common.h @@ -5,6 +5,7 @@ #define BLKRRPART _IO(0x12,95) /* re-read partition table */ #define BLKGETSIZE _IO(0x12,96) /* return device size */ #define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */ +#define BLKSSZGET _IO(0x12,104) /* get block device sector size */ struct systypes { unsigned char type; diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index 45110ccd62..969bf87901 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -57,6 +57,8 @@ #include #endif +static void delete_partition(int i); + #define hex_val(c) ({ \ char _c = (c); \ isdigit(_c) ? _c - '0' : \ @@ -176,6 +178,7 @@ uint heads, sectors, cylinders, sector_size = DEFAULT_SECTOR_SIZE, + user_set_sector_size = 0, sector_offset = 1, units_per_sector = 1, display_in_cyl_units = 1, @@ -567,13 +570,13 @@ void update_units(void) static void warn_cylinders(void) { if (dos_label && cylinders > 1024 && !nowarn) - fprintf(stderr, "\n\ -The number of cylinders for this disk is set to %d.\n\ -There is nothing wrong with that, but this is larger than 1024,\n\ -and could in certain setups cause problems with:\n\ -1) software that runs at boot time (e.g., old versions of LILO)\n\ -2) booting and partitioning software from other OSs\n\ - (e.g., DOS FDISK, OS/2 FDISK)\n", + fprintf(stderr, _("\n" +"The number of cylinders for this disk is set to %d.\n" +"There is nothing wrong with that, but this is larger than 1024,\n" +"and could in certain setups cause problems with:\n" +"1) software that runs at boot time (e.g., old versions of LILO)\n" +"2) booting and partitioning software from other OSs\n" +" (e.g., DOS FDISK, OS/2 FDISK)\n"), cylinders); } @@ -588,9 +591,13 @@ read_extended(int ext) { pex->ext_pointer = pex->part_table; p = pex->part_table; - if (!get_start_sect(p)) - fprintf(stderr, _("Bad offset in primary extended partition\n")); - else while (IS_EXTENDED (p->sys_ind)) { + if (!get_start_sect(p)) { + fprintf(stderr, + _("Bad offset in primary extended partition\n")); + return; + } + + while (IS_EXTENDED (p->sys_ind)) { struct pte *pe = &ptes[partitions]; if (partitions >= MAXIMUM_PARTS) { @@ -613,7 +620,7 @@ read_extended(int ext) { extended_offset = get_start_sect(p); q = p = pt_offset(pe->sectorbuffer, 0); - for (i = 0; i < 4; i++, p++) { + for (i = 0; i < 4; i++, p++) if (get_nr_sects(p)) { if (IS_EXTENDED (p->sys_ind)) { if (pe->ext_pointer) fprintf(stderr, _("Warning: extra link" @@ -649,6 +656,18 @@ read_extended(int ext) { p = pe->ext_pointer; partitions++; } + + /* remove empty links */ + remove: + for (i = 4; i < partitions; i++) { + struct pte *pe = &ptes[i]; + + if (!get_nr_sects(pe->part_table)) { + printf("omitting empty partition (%d)\n", i+1); + delete_partition(i); + goto remove; /* numbering changed */ + } + } } static void @@ -672,19 +691,39 @@ create_doslabel(void) { get_boot(create_empty); } +#include +#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) + +static int +linux_version_code(void) { + static int kernel_version = 0; + struct utsname my_utsname; + int p, q, r; + + if (!kernel_version && uname(&my_utsname) == 0) { + p = atoi(strtok(my_utsname.release, ".")); + q = atoi(strtok(NULL, ".")); + r = atoi(strtok(NULL, ".")); + kernel_version = MAKE_VERSION(p,q,r); + } + return kernel_version; +} + static void get_sectorsize(int fd) { -#if defined(BLKSSZGET) && defined(HAVE_blkpg_h) - /* For a short while BLKSSZGET gave a wrong sector size */ - { int arg; - if (ioctl(fd, BLKSSZGET, &arg) == 0) - sector_size = arg; - if (sector_size != DEFAULT_SECTOR_SIZE) - printf(_("Note: sector size is %d (not %d)\n"), - sector_size, DEFAULT_SECTOR_SIZE); +#if defined(BLKSSZGET) + if (!user_set_sector_size && + linux_version_code() >= MAKE_VERSION(2,3,3)) { + int arg; + if (ioctl(fd, BLKSSZGET, &arg) == 0) + sector_size = arg; + if (sector_size != DEFAULT_SECTOR_SIZE) + printf(_("Note: sector size is %d (not %d)\n"), + sector_size, DEFAULT_SECTOR_SIZE); } #else - sector_size = DEFAULT_SECTOR_SIZE; + /* maybe the user specified it; and otherwise we still + have the DEFAULT_SECTOR_SIZE default */ #endif } @@ -818,9 +857,9 @@ got_table: pe->part_table = pt_offset(MBRbuffer, i); pe->ext_pointer = NULL; - pe->changed = 0; pe->offset = 0; pe->sectorbuffer = MBRbuffer; + pe->changed = (what == create_empty); } for (i = 0; i < 4; i++) { @@ -877,6 +916,7 @@ read_char(char *mesg) { do { fputs(mesg, stdout); + fflush (stdout); /* requested by niles@scyld.com */ } while (!read_line()); return *line_ptr; } @@ -885,6 +925,7 @@ char read_chars(char *mesg) { fputs(mesg, stdout); + fflush (stdout); /* niles@scyld.com */ if (!read_line()) { *line_ptr = '\n'; line_ptr[1] = 0; @@ -1079,10 +1120,12 @@ delete_partition(int i) { sun_delete_partition(i); return; } + if (sgi_label) { sgi_delete_partition(i); return; } + if (i < 4) { if (IS_EXTENDED (p->sys_ind) && i == ext_index) { partitions = 4; @@ -1090,14 +1133,15 @@ delete_partition(int i) { extended_offset = 0; } clear_partition(p); + return; } - else if (!q->sys_ind && i > 4) { + + if (!q->sys_ind && i > 4) { --partitions; --i; clear_partition(ptes[i].ext_pointer); ptes[i].changed = 1; - } - else if (i > 3) { + } else { if (i > 4) { p = ptes[i-1].ext_pointer; p->boot_ind = 0; @@ -1111,7 +1155,7 @@ delete_partition(int i) { set_start_sect(p, get_start_sect(q)); set_nr_sects(p, get_nr_sects(q)); ptes[i-1].changed = 1; - } else { + } else if (partitions > 5) { /* 5 will be moved to 4 */ struct pte *pe = &ptes[5]; if(pe->part_table) /* prevent SEGFAULT */ @@ -1121,6 +1165,7 @@ delete_partition(int i) { pe->offset = extended_offset; pe->changed = 1; } + if (partitions > 5) { partitions--; while (i < partitions) { @@ -1389,7 +1434,7 @@ list_table(int xtra) { struct pte *pe = &ptes[i]; p = pe->part_table; - if (p->sys_ind) { + if (p && p->sys_ind) { unsigned int psects = get_nr_sects(p); unsigned int pblocks = psects; unsigned int podd = 0; @@ -2030,6 +2075,8 @@ try(char *device, int user_specified) { if ((fd = open(disk_device, type_open)) >= 0) { if (get_boot(try_only) < 0) { list_disk_geometry(); + if (aix_label) + return; if (btrydev(device) < 0) fprintf(stderr, _("Disk %s doesn't contain a valid " @@ -2075,7 +2122,7 @@ tryprocpt(void) { if (isdigit(s[-1])) continue; sprintf(devname, "/dev/%s", ptname); - try(devname, 1); + try(devname, 0); } } @@ -2091,7 +2138,6 @@ int main(int argc, char **argv) { int j, c; int optl = 0, opts = 0; - int user_set_sector_size = 0; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); @@ -2194,6 +2240,8 @@ main(int argc, char **argv) { fatal(usage2); get_boot(fdisk); + if (aix_label) + exit(0); #ifdef __alpha__ /* On alpha, if we detect a disklabel, go directly to diff --git a/fdisk/fdiskbsdlabel.h b/fdisk/fdiskbsdlabel.h index 68747d48e3..e46e026142 100644 --- a/fdisk/fdiskbsdlabel.h +++ b/fdisk/fdiskbsdlabel.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include /* for __u32 etc */ +#include /* for __u32, __u16, __u8, __s16 */ #ifndef BSD_DISKMAGIC /* perhaps from */ #define BSD_DISKMAGIC ((__u32) 0x82564557) diff --git a/fdisk/fdisksunlabel.c b/fdisk/fdisksunlabel.c index 3ec5624a12..f96cb0b152 100644 --- a/fdisk/fdisksunlabel.c +++ b/fdisk/fdisksunlabel.c @@ -67,6 +67,12 @@ get_num_sectors(struct sun_partition p) { return SSWAP32(p.num_sectors); } +#ifndef IDE0_MAJOR +#define IDE0_MAJOR 3 +#endif +#ifndef IDE1_MAJOR +#define IDE1_MAJOR 22 +#endif void guess_device_type(int fd) { struct stat bootstat; diff --git a/fdisk/fdisksunlabel.h b/fdisk/fdisksunlabel.h index 424f462ea6..647a2cec1f 100644 --- a/fdisk/fdisksunlabel.h +++ b/fdisk/fdisksunlabel.h @@ -1,4 +1,4 @@ -#include /* for __u32 etc */ +#include /* for __u16, __u32 */ typedef struct { unsigned char info[128]; /* Informative text string */ diff --git a/fdisk/i386_sys_types.c b/fdisk/i386_sys_types.c index 0cad6fa72f..3e5f0f1b7e 100644 --- a/fdisk/i386_sys_types.c +++ b/fdisk/i386_sys_types.c @@ -29,6 +29,7 @@ struct systypes i386_sys_types[] = { {0x1c, N_("Hidden Win95 FAT32 (LBA)")}, {0x1e, N_("Hidden Win95 FAT16 (LBA)")}, {0x24, N_("NEC DOS")}, + {0x39, N_("Plan 9")}, {0x3c, N_("PartitionMagic recovery")}, {0x40, N_("Venix 80286")}, {0x41, N_("PPC PReP Boot")}, @@ -72,16 +73,21 @@ struct systypes i386_sys_types[] = { {0xc4, N_("DRDOS/sec (FAT-16 < 32M)")}, {0xc6, N_("DRDOS/sec (FAT-16)")}, {0xc7, N_("Syrinx")}, - {0xdb, N_("CP/M / CTOS / ...")},/* CP/M or Concurrent CP/M or Concurrent DOS or CTOS */ - {0xe1, N_("DOS access")}, /* DOS access or SpeedStor 12-bit FAT extended partition */ + {0xda, N_("Non-FS data")}, + {0xdb, N_("CP/M / CTOS / ...")},/* CP/M or Concurrent CP/M or + Concurrent DOS or CTOS */ + {0xe1, N_("DOS access")}, /* DOS access or SpeedStor 12-bit FAT + extended partition */ {0xe3, N_("DOS R/O")}, /* DOS R/O or SpeedStor */ - {0xe4, N_("SpeedStor")}, /* SpeedStor 16-bit FAT extended partition < 1024 cyl. */ + {0xe4, N_("SpeedStor")}, /* SpeedStor 16-bit FAT extended + partition < 1024 cyl. */ {0xeb, N_("BeOS fs")}, {0xf1, N_("SpeedStor")}, {0xf4, N_("SpeedStor")}, /* SpeedStor large partition */ {0xf2, N_("DOS secondary")}, /* DOS 3.3+ secondary */ - {0xfd, N_("Linux raid autodetect")},/* New (2.2.x) raid partition with autodetect - using persistent superblock */ + {0xfd, N_("Linux raid autodetect")},/* New (2.2.x) raid partition with + autodetect using persistent + superblock */ {0xfe, N_("LANstep")}, /* SpeedStor >1024 cyl. or LANstep */ {0xff, N_("BBT")}, /* Xenix Bad Block Table */ { 0, 0 } diff --git a/fdisk/llseek.c b/fdisk/llseek.c index 9e00d3e6df..b55dfa7922 100644 --- a/fdisk/llseek.c +++ b/fdisk/llseek.c @@ -35,10 +35,24 @@ extern ext2_loff_t ext2_llseek (unsigned int, ext2_loff_t, unsigned int); static int _llseek (unsigned int, unsigned long, unsigned long, ext2_loff_t *, unsigned int); +#ifdef __NR__llseek + static _syscall5(int,_llseek,unsigned int,fd,unsigned long,offset_high, unsigned long, offset_low,ext2_loff_t *,result, unsigned int, origin) +#else + +/* no __NR__llseek on compilation machine - might give it explicitly */ +static int _llseek (unsigned int fd, unsigned long oh, + unsigned long ol, ext2_loff_t *result, + unsigned int origin) { + errno = ENOSYS; + return -1; +} + +#endif + static ext2_loff_t my_llseek (unsigned int fd, ext2_loff_t offset, unsigned int origin) { diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c index 206ea28dc8..e60259849e 100644 --- a/fdisk/sfdisk.c +++ b/fdisk/sfdisk.c @@ -432,25 +432,25 @@ get_cylindersize(char *dev, int fd, int silent) { if (R.start && !force) { warn( - _("Warning: start=%d - this looks like a partition rather than\n" + _("Warning: start=%lu - this looks like a partition rather than\n" "the entire disk. Using fdisk on it is probably meaningless.\n" "[Use the --force option if you really want this]\n"), R.start); exit(1); } if (R.heads && B.heads != R.heads) - warn(_("Warning: HDIO_GETGEO says that there are %d heads\n"), + warn(_("Warning: HDIO_GETGEO says that there are %lu heads\n"), R.heads); if (R.sectors && B.sectors != R.sectors) - warn(_("Warning: HDIO_GETGEO says that there are %d sectors\n"), + warn(_("Warning: HDIO_GETGEO says that there are %lu sectors\n"), R.sectors); if (R.cylinders && B.cylinders != R.cylinders && B.cylinders < 65536 && R.cylinders < 65536) - warn(_("Warning: BLKGETSIZE/HDIO_GETGEO says that there are %d cylinders\n"), + warn(_("Warning: BLKGETSIZE/HDIO_GETGEO says that there are %lu cylinders\n"), R.cylinders); if (B.sectors > 63) - warn(_("Warning: unlikely number of sectors (%d) - usually at most 63\n" + warn(_("Warning: unlikely number of sectors (%lu) - usually at most 63\n" "This will give problems with all software that uses C/H/S addressing.\n"), B.sectors); if (!silent) @@ -537,17 +537,17 @@ chs_ok (chs a, char *v, char *w) { return 1; if (B.heads && aa.h >= B.heads) { warn(_("%s of partition %s has impossible value for head: " - "%d (should be in 0-%d)\n"), w, v, aa.h, B.heads-1); + "%lu (should be in 0-%lu)\n"), w, v, aa.h, B.heads-1); ret = 0; } if (B.sectors && (aa.s == 0 || aa.s > B.sectors)) { warn(_("%s of partition %s has impossible value for sector: " - "%d (should be in 1-%d)\n"), w, v, aa.s, B.sectors); + "%lu (should be in 1-%lu)\n"), w, v, aa.s, B.sectors); ret = 0; } if (B.cylinders && aa.c >= B.cylinders) { warn(_("%s of partition %s has impossible value for cylinders: " - "%d (should be in 0-%d)\n"), w, v, aa.c, B.cylinders-1); + "%lu (should be in 0-%lu)\n"), w, v, aa.c, B.cylinders-1); ret = 0; } return ret; @@ -2774,7 +2774,7 @@ do_change_id(char *dev, char *pnam, char *id) { } i = strtoul(id, NULL, 16); if (i > 255) - fatal(_("Bad Id %x\n"), i); + fatal(_("Bad Id %lx\n"), i); z->partitions[pno].p.sys_type = i; if(write_partitions(dev, fd, z)) diff --git a/getopt-1.0.3b/Changelog b/getopt-1.0.3b/Changelog deleted file mode 100644 index 24a4c3235d..0000000000 --- a/getopt-1.0.3b/Changelog +++ /dev/null @@ -1,14 +0,0 @@ -980628: Bumped up version number to 1.0.3 -980628: Removed remaining incompatibility with tcsh-6.02 from parse.tcsh -980626: Added separate Makefile for util-linux -980625: Removed several bugs from parse.tcsh, partly thanks to Volker Kuhlmann - (v.kuhlmann@elec.canterbury.ac.nz). -980612: Removed reference to getopt in util-linux -980611: Bumped up version number to 1.0.2 -980611: Fixed --version bug (was not available, though documented!) -980611: Removed compiler warnings. -980603: Bumped up version number to 1.0.1 -980603: Fixed sizeof() bug (should be strlen) in getopt.c, thanks to Bob Proulx - (rwp@hprwp.fc.hp.com). -980505: Changed date field in LSM to proper syntax -980505: Released version 1.0 diff --git a/getopt-1.0.3b/COPYING b/getopt-1.1.0a/COPYING similarity index 100% rename from getopt-1.0.3b/COPYING rename to getopt-1.1.0a/COPYING diff --git a/getopt-1.1.0a/Changelog b/getopt-1.1.0a/Changelog new file mode 100644 index 0000000000..e144bb0f86 --- /dev/null +++ b/getopt-1.1.0a/Changelog @@ -0,0 +1,24 @@ +20000630: Ported the Native Language Support patches from util-linux + They are written by Arkadiusz Mi¶kiewicz +20000627: Bumped up version number to 1.0.6 +20000627: A few manpage tweaks +20000616: Introduced DESTDIR and directory creation in the Makefile. +19990716: Bumped up version number to 1.0.5 +19990622: Made -u work +19990101: Bumped up version number to 1.0.4 (aka. 1.0.3a in util-linux) +19990101: Very small fix in main() +19990101: Updated util-linux Makefile +19980628: Bumped up version number to 1.0.3 +19980628: Removed remaining incompatibility with tcsh-6.02 from parse.tcsh +980626: Added separate Makefile for util-linux +19980625: Removed several bugs from parse.tcsh, partly thanks to Volker Kuhlmann + (v.kuhlmann@elec.canterbury.ac.nz). +19980612: Removed reference to getopt in util-linux +19980611: Bumped up version number to 1.0.2 +19980611: Fixed --version bug (was not available, though documented!) +19980611: Removed compiler warnings. +19980603: Bumped up version number to 1.0.1 +19980603: Fixed sizeof() bug (should be strlen) in getopt.c, thanks to + Bob Proulx (rwp@hprwp.fc.hp.com). +19980505: Changed date field in LSM to proper syntax +19980505: Released version 1.0 diff --git a/getopt-1.0.3b/Makefile b/getopt-1.1.0a/Makefile similarity index 94% rename from getopt-1.0.3b/Makefile rename to getopt-1.1.0a/Makefile index 92e99e9de2..6b50f849b0 100644 --- a/getopt-1.0.3b/Makefile +++ b/getopt-1.1.0a/Makefile @@ -3,7 +3,7 @@ include ../make_include include ../MCONFIG -GETOPTDIR=$(USRLIBDIR)/getopt +GETOPTDIR=$(USRSHAREMISCDIR)/getopt # Define this to 0 to use the getopt(3) routines in this package. LIBCGETOPT=1 @@ -26,7 +26,7 @@ WARNINGS=-Wall \ -W -Wshadow -Wpointer-arith -Wcast-qual \ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ -Wnested-externs -Winline -CFLAGS=$(WARNINGS) $(OPT) +# CFLAGS= $(WARNINGS) $(OPT) SOURCES=getopt.c ifeq ($(LIBCGETOPT),0) diff --git a/getopt-1.0.3b/README b/getopt-1.1.0a/README similarity index 100% rename from getopt-1.0.3b/README rename to getopt-1.1.0a/README diff --git a/getopt-1.0.3b/TODO b/getopt-1.1.0a/TODO similarity index 100% rename from getopt-1.0.3b/TODO rename to getopt-1.1.0a/TODO diff --git a/getopt-1.1.0a/getopt-1.0.6.lsm b/getopt-1.1.0a/getopt-1.0.6.lsm new file mode 100644 index 0000000000..6323916c31 --- /dev/null +++ b/getopt-1.1.0a/getopt-1.0.6.lsm @@ -0,0 +1,19 @@ +Begin3 +Title: Getopt +Version: 1.0.6 +Entered-date: 27JUN00 +Description: An improved implementation of getopt(1), a program to parse + options within a shell script. Fully compatible with other + getopt(1) implementations, but with many additions like + long options and mixing of options and parameters. +Keywords: getopt script parse bash tcsh +Author: frodol@dds.nl (Frodo Looijaard) +Primary-site: http://huizen.dds.nl/~frodol + 28kB getopt-1.0.6.tar.gz + 600 getopt-1.0.6.lsm +Alternate-site: sunsite.unc.edu /pub/Linux/utils/shell + 28kB getopt-1.0.6.tar.gz + 600 getopt-1.0.6.lsm +Copying-policy: GPL +End + diff --git a/getopt-1.0.3b/getopt.1 b/getopt-1.1.0a/getopt.1 similarity index 98% rename from getopt-1.0.3b/getopt.1 rename to getopt-1.1.0a/getopt.1 index c3aaa01950..b7e360315b 100644 --- a/getopt-1.0.3b/getopt.1 +++ b/getopt-1.1.0a/getopt.1 @@ -427,6 +427,11 @@ can parse long options with optional arguments that are given an empty optional argument (but can not do this for short options). This .BR getopt (1) treats optional arguments that are empty as if they were not present. + +The syntax if you do not want any short option variables at all is +not very intuitive (you have to set them explicitely to the empty +string). + .SH AUTHOR Frodo Looijaard .SH "SEE ALSO" diff --git a/getopt-1.0.3b/getopt.c b/getopt-1.1.0a/getopt.c similarity index 93% rename from getopt-1.0.3b/getopt.c rename to getopt-1.1.0a/getopt.c index 345c1b977a..86efe2f84a 100644 --- a/getopt-1.0.3b/getopt.c +++ b/getopt-1.1.0a/getopt.c @@ -1,6 +1,6 @@ /* getopt.c - Enhanced implementation of BSD getopt(1) - Copyright (c) 1997, 1998 Frodo Looijaard + Copyright (c) 1997, 1998, 1999, 2000 Frodo Looijaard This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,10 +28,13 @@ * Version 1.0.2: Thu Jun 11 1998 (not present) * Fixed gcc-2.8.1 warnings * Fixed --version/-V option (not present) - * Version 1.0.3 - * 1999-02-22 Arkadiusz Mi¶kiewicz - * - added Native Language Support - * + * Version 1.0.5: Tue Jun 22 1999 + * Make -u option work (not present) + * Version 1.0.6: Tue Jun 27 2000 + * No important changes + * Version 1.1.0: Tue Jun 30 2000 + * Added NLS support (partly written by Arkadiusz Mikiewicz + * ) */ #include @@ -39,7 +42,6 @@ #include #include #include -#include "../lib/nls.h" #if LIBCGETOPT #include @@ -47,6 +49,8 @@ #include "getopt.h" #endif +#include "../lib/nls.h" + /* NON_OPT is the code that is returned when a non-option is found in '+' mode */ #define NON_OPT 1 @@ -90,12 +94,12 @@ void *our_malloc(size_t size) void *our_realloc(void *ptr, size_t size) { - void *ret=realloc(ptr,size); - if (! ret && size) { - fprintf(stderr,_("%s: Out of memory!\n"), "getopt"); - exit(3); - } - return(ret); + void *ret=realloc(ptr,size); + if (! ret && size) { + fprintf(stderr,_("%s: Out of memory!\n"),"getopt"); + exit(3); + } + return(ret); } /* @@ -113,8 +117,8 @@ const char *normalize(const char *arg) const char *argptr=arg; char *bufptr; - if (BUFFER != NULL) - free(BUFFER); + if (BUFFER != NULL) + free(BUFFER); if (!quote) { /* Just copy arg */ BUFFER=our_malloc(strlen(arg)+1); @@ -320,16 +324,17 @@ void print_help(void) fputs(_("Usage: getopt optstring parameters\n"),stderr); fputs(_(" getopt [options] [--] optstring parameters\n"),stderr); fputs(_(" getopt [options] -o|--options optstring [options] [--]\n"),stderr); - fputs(_(" parameters\n"),stderr); + fputs(_(" parameters\n"),stderr); fputs(_(" -a, --alternative Allow long options starting with single -\n"),stderr); fputs(_(" -h, --help This small usage guide\n"),stderr); fputs(_(" -l, --longoptions=longopts Long options to be recognized\n"),stderr); fputs(_(" -n, --name=progname The name under which errors are reported\n"),stderr); fputs(_(" -o, --options=optstring Short options to be recognized\n"),stderr); - fputs(_(" -q, --quiet Disable error reporting by getopt(3)\n"),stderr); + fputs(_(" -q, --quiet Disable error reporting by getopt(3)\n"),stderr); fputs(_(" -Q, --quiet-output No normal output\n"),stderr); fputs(_(" -s, --shell=shell Set shell quoting conventions\n"),stderr); fputs(_(" -T, --test Test for getopt(1) version\n"),stderr); + fputs(_(" -u, --unqote Do not quote the output\n"),stderr); fputs(_(" -V, --version Output version information\n"),stderr); exit(2); } @@ -366,7 +371,7 @@ int main(int argc, char *argv[]) int opt; int compatible=0; - setlocale(LC_ALL, ""); + setlocale(LC_ALL,""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); @@ -429,8 +434,11 @@ int main(int argc, char *argv[]) break; case 'T': exit(4); + case 'u': + quote=0; + break; case 'V': - printf(_("getopt (enhanced) 1.0.3\n")); + printf(_("getopt (enhanced) 1.1.0\n")); exit(0); case '?': case ':': diff --git a/getopt-1.0.3b/gnu/getopt.c b/getopt-1.1.0a/gnu/getopt.c similarity index 100% rename from getopt-1.0.3b/gnu/getopt.c rename to getopt-1.1.0a/gnu/getopt.c diff --git a/getopt-1.0.3b/gnu/getopt.h b/getopt-1.1.0a/gnu/getopt.h similarity index 100% rename from getopt-1.0.3b/gnu/getopt.h rename to getopt-1.1.0a/gnu/getopt.h diff --git a/getopt-1.0.3b/gnu/getopt1.c b/getopt-1.1.0a/gnu/getopt1.c similarity index 100% rename from getopt-1.0.3b/gnu/getopt1.c rename to getopt-1.1.0a/gnu/getopt1.c diff --git a/getopt-1.0.3b/parse.bash b/getopt-1.1.0a/parse.bash similarity index 100% rename from getopt-1.0.3b/parse.bash rename to getopt-1.1.0a/parse.bash diff --git a/getopt-1.0.3b/parse.tcsh b/getopt-1.1.0a/parse.tcsh similarity index 100% rename from getopt-1.0.3b/parse.tcsh rename to getopt-1.1.0a/parse.tcsh diff --git a/getopt-1.0.3b/test.bash b/getopt-1.1.0a/test.bash similarity index 100% rename from getopt-1.0.3b/test.bash rename to getopt-1.1.0a/test.bash diff --git a/getopt-1.0.3b/test.tcsh b/getopt-1.1.0a/test.tcsh similarity index 100% rename from getopt-1.0.3b/test.tcsh rename to getopt-1.1.0a/test.tcsh diff --git a/clock/Makefile b/hwclock/Makefile similarity index 88% rename from clock/Makefile rename to hwclock/Makefile index 10e96051aa..70ff6436c5 100644 --- a/clock/Makefile +++ b/hwclock/Makefile @@ -23,7 +23,8 @@ hwclock: hwclock.o shhopt.o cmos.o rtc.o kd.o CWFLAGS := $(subst -Wmissing-prototypes,,$(CFLAGS)) cmos.o: cmos.c - $(CC) $(CWFLAGS) -c $< -o $@ + $(CC) $(CWFLAGS) -c cmos.c -o $@ +# $< expands to clock.h on some systems install: all $(INSTALLDIR) $(SBINDIR) $(BINDIR) $(USRBINDIR) diff --git a/clock/README.aeb b/hwclock/README.aeb similarity index 100% rename from clock/README.aeb rename to hwclock/README.aeb diff --git a/clock/README.hwclock b/hwclock/README.hwclock similarity index 100% rename from clock/README.hwclock rename to hwclock/README.hwclock diff --git a/clock/README.shhopt-1.1 b/hwclock/README.shhopt-1.1 similarity index 100% rename from clock/README.shhopt-1.1 rename to hwclock/README.shhopt-1.1 diff --git a/clock/adjtime.patch b/hwclock/adjtime.patch similarity index 100% rename from clock/adjtime.patch rename to hwclock/adjtime.patch diff --git a/clock/clock-ppc.c b/hwclock/clock-ppc.c similarity index 100% rename from clock/clock-ppc.c rename to hwclock/clock-ppc.c diff --git a/clock/clock.h b/hwclock/clock.h similarity index 93% rename from clock/clock.h rename to hwclock/clock.h index fc91826ce5..91d3df801a 100644 --- a/clock/clock.h +++ b/hwclock/clock.h @@ -1,4 +1,5 @@ #include +#include #include #include /* for errno, EPERM, EINVAL, ENOENT */ #include @@ -23,7 +24,7 @@ typedef int bool; extern char *progname; extern int debug; extern int epoch_option; -extern void outsyserr(char *msg); +extern void outsyserr(char *msg, ...); /* cmos.c */ extern void set_cmos_epoch(int ARCconsole, int SRM); diff --git a/clock/cmos.c b/hwclock/cmos.c similarity index 98% rename from clock/cmos.c rename to hwclock/cmos.c index 16705bf7fe..4fc82d7982 100644 --- a/clock/cmos.c +++ b/hwclock/cmos.c @@ -184,10 +184,12 @@ set_cmos_access(int Jensen, int funky_toy) { /* see whether we are dealing with PC164/LX164/SX164, as they have a TOY that must be accessed differently to work correctly. */ + /* Nautilus stuff reported by Neoklis Kyriazis */ if (funky_toy || is_in_cpuinfo("system variation", "PC164") || is_in_cpuinfo("system variation", "LX164") || - is_in_cpuinfo("system variation", "SX164")) { + is_in_cpuinfo("system variation", "SX164") || + is_in_cpuinfo("system type", "Nautilus")) { funkyTOY = 1; if (debug) printf (_("funky TOY!\n")); } @@ -553,7 +555,7 @@ set_hardware_clock_cmos(const struct tm *new_broken_time) { static int i386_iopl(const int level) { #if defined(__i386__) || defined(__alpha__) - extern int iopl(const int level); + extern int iopl(const int lvl); return iopl(level); #else return -2; diff --git a/clock/hwclock.8 b/hwclock/hwclock.8 similarity index 96% rename from clock/hwclock.8 rename to hwclock/hwclock.8 index f34bfac009..7e4106d453 100644 --- a/clock/hwclock.8 +++ b/hwclock/hwclock.8 @@ -33,21 +33,21 @@ Also, equivalent options \-r, \-w, \-s, \-a, \-v, \-u, with the program "clock", while \-h asks for a help message. .SH DESCRIPTION -.I hwclock +.B hwclock is a tool for accessing the Hardware Clock. You can display the current time, set the Hardware Clock to a specified time, set the Hardware Clock to the System Time, and set the System Time from the Hardware Clock. .PP You can also run -.I hwclock +.B hwclock periodically to insert or remove time from the Hardware Clock to compensate for systematic drift (where the clock consistently gains or loses time at a certain rate if left to run). .SH OPTIONS You need exactly one of the following options to tell -.I hwclock +.B hwclock what function to perform: .PP .TP @@ -106,7 +106,7 @@ option for details. .TP .B \-\-version Print the version of -.I hwclock +.B hwclock on Standard Output. .br You need the following option if you specify @@ -116,14 +116,14 @@ option. Otherwise, it is ignored. .B \-\-date=date_string Specifies the time to which to set the Hardware Clock. The value of this option is an argument to the -.I date(1) +.BR date (1) program. For example, .sp .I hwclock --set --date="9/22/96 16:45:05" .sp The argument is in local time, even if you keep your Hardware Clock in Coordinated Universal time. See the -.I \-\-utc +.B \-\-utc option. .TP @@ -146,7 +146,7 @@ Indicates that the Hardware Clock is kept in Coordinated Universal Time or local time, respectively. It is your choice whether to keep your clock in UTC or local time, but nothing in the clock tells which you've chosen. So this option is how you give that information to -.IR hwclock . +.BR hwclock . If you specify the wrong one of these options (or specify neither and take a wrong default), both setting and querying of the Hardware Clock @@ -157,7 +157,7 @@ If you specify neither nor .B \-\-localtime , the default is whichever was specified the last time -.I hwclock +.B hwclock was used to set the clock (i.e. hwclock was successfully run with the .B \-\-set , @@ -172,12 +172,12 @@ exist, the default is local time. .B \-\-directisa is meaningful only on an ISA machine or an Alpha (which implements enough of ISA to be, roughly speaking, an ISA machine for -.IR hwclock 's +.BR hwclock 's purposes). For other machines, it has no effect. This option tells -.I hwclock +.B hwclock to use explicit I/O instructions to access the Hardware Clock. Without this option, -.I hwclock +.B hwclock will try to use the /dev/rtc device (which it assumes to be driven by the rtc device driver). If it is unable to open the device (for read), it will use the explicit I/O instructions anyway. @@ -191,7 +191,7 @@ Award BIOSes made between 4/26/94 and 5/31/95) wherein they are unable to deal with years after 1999. If one attempts to set the year-of-century value to something less than 94 (or 95 in some cases), the value that actually gets set is 94 (or 95). Thus, if you have one of these machines, -.I hwclock +.B hwclock cannot set the year after 1999 and cannot use the value of the clock as the true time in the normal way. @@ -199,7 +199,7 @@ To compensate for this (without your getting a BIOS update, which would definitely be preferable), always use .B \-\-badyear if you have one of these machines. When -.I hwclock +.B hwclock knows it's working with a brain-damaged clock, it ignores the year part of the Hardware Clock value and instead tries to guess the year based on the last calibrated date in the adjtime file, by assuming that that date is @@ -210,7 +210,7 @@ or at least once a year! Though -.I hwclock +.B hwclock ignores the year value when it reads the Hardware Clock, it sets the year value when it sets the clock. It sets it to 1995, 1996, 1997, or 1998, whichever one has the same position in the leap year cycle as @@ -219,7 +219,7 @@ they belong. Again, if you let the Hardware Clock run for more than a year without setting it, this scheme could be defeated and you could end up losing a day. -.I hwclock +.B hwclock warns you that you probably need .B \-\-badyear whenever it finds your Hardware Clock set to 1994 or 1995. @@ -233,16 +233,16 @@ whenever it finds your Hardware Clock set to 1994 or 1995. .TP .B \-\-funky\-toy These options all tell -.I hwclock +.B hwclock what kind of Alpha machine you have. They are invalid if you don't have an Alpha and shouldn't be necessary if you do, because -.I hwclock +.B hwclock should be able to determine by itself what it's running on, at least when .I /proc is mounted. These options make it possible for -.I hwclock +.B hwclock to work even when its environment does not conform to its expectations and thus it cannot accurately determine what sort of system it is running on. If you think @@ -251,9 +251,9 @@ running with the .B \-\-debug option to see what conclusions the program is reaching and how. If you find you need one of these options to make -.I hwclock +.B hwclock work, contact the -.I hwclock +.B hwclock maintainer to see if the program can be improved to detect your system automatically. @@ -280,11 +280,11 @@ Do everything except actually updating the Hardware Clock or anything else. This is useful, especially in conjunction with .B \-\-debug, in learning about -.I hwclock. +.B hwclock. .TP .B \-\-debug Display a lot of information about what -.I hwclock +.B hwclock is doing internally. Some of its function is complex and this output can help you understand how the program works. @@ -308,7 +308,7 @@ ticks, so the clock actually has virtually infinite precision. This clock is commonly called the hardware clock, the real time clock, the RTC, the BIOS clock, and the CMOS clock. Hardware Clock, in its capitalized form, was coined for use by -.I hwclock +.B hwclock because all of the other names are inappropriate to the point of being misleading. .PP @@ -349,7 +349,7 @@ the kernel timezone value. An example is the vfat filesystem. If the kernel timezone value is wrong, the vfat filesystem will report and set the wrong timestamps on files. .PP -.I hwclock +.B hwclock sets the kernel timezone to the value indicated by TZ and/or /usr/local/timezone when you set the System Time using the .B \-\-hctosys @@ -366,7 +366,7 @@ This second field is not used under Linux and is always zero. .SH How hwclock Accesses the Hardware Clock .PP -.I hwclock +.B hwclock Uses many different ways to get and set Hardware Clock values. The most normal way is to do I/O to the device special file /dev/rtc, which is presumed to be driven by the rtc device driver. However, @@ -380,13 +380,13 @@ On older systems, the method of accessing the Hardware Clock depends on the system hardware. .PP On an ISA system, -.I hwclock +.B hwclock can directly access the "CMOS memory" registers that constitute the clock, by doing I/O to Ports 0x70 and 0x71. It does this with actual I/O instructions and consequently can only do it if running with superuser effective userid. (In the case of a Jensen Alpha, there is no way for -.I hwclock +.B hwclock to execute those I/O instructions, and so it uses instead the /dev/port device special file, which provides almost as low-level an interface to the I/O subsystem). @@ -399,17 +399,17 @@ working rtc device drivers available. .PP On an m68k system, -.I hwclock +.B hwclock can access the clock via the console driver, via the device special file /dev/tty1. .PP -.I hwclock +.B hwclock tries to use /dev/rtc. If it is compiled for a kernel that doesn't have that function or it is unable to open /dev/rtc, -.I hwclock +.B hwclock will fall back to another method, if available. On an ISA or Alpha machine, you can force -.I hwclock +.B hwclock to use the direct manipulation of the CMOS registers without even trying .I /dev/rtc by specifying the \-\-directisa option. @@ -420,12 +420,12 @@ by specifying the \-\-directisa option. The Hardware Clock is usually not very accurate. However, much of its inaccuracy is completely predictable - it gains or loses the same amount of time every day. This is called systematic drift. -.IR hwclock 's +.BR hwclock 's "adjust" function lets you make systematic corrections to correct the systematic drift. .PP It works like this: -.I hwclock +.B hwclock keeps a file, .I /etc/adjtime, that keeps some historical information. This is called the adjtime file. @@ -433,27 +433,26 @@ that keeps some historical information. This is called the adjtime file. Suppose you start with no adjtime file. You issue a .I hwclock \-\-set command to set the Hardware Clock to the true current time. -.I Hwclock +.B Hwclock creates the adjtime file and records in it the current time as the last time the clock was calibrated. -5 days -later, the clock has gained 10 seconds, so you issue another +5 days later, the clock has gained 10 seconds, so you issue another .I hwclock \-\-set command to set it back 10 seconds. -.I Hwclock +.B Hwclock updates the adjtime file to show the current time as the last time the clock was calibrated, and records 2 seconds per day as the systematic drift rate. 24 hours go by, and then you issue a .I hwclock \-\-adjust command. -.I Hwclock +.B Hwclock consults the adjtime file and sees that the clock gains 2 seconds per day when left alone and that it has been left alone for exactly one day. So it subtracts 2 seconds from the Hardware Clock. It then records the current time as the last time the clock was adjusted. Another 24 hours goes by and you issue another .I hwclock \-\-adjust. -.I Hwclock +.B Hwclock does the same thing: subtracts 2 seconds and updates the adjtime file with the current time as the last time the clock was adjusted. .PP @@ -462,18 +461,18 @@ Every time you calibrate (set) the clock (using or .I \-\-systohc ), -.I hwclock +.B hwclock recalculates the systematic drift rate based on how long it has been since the last calibration, how long it has been since the last adjustment, what drift rate was assumed in any intervening adjustments, and the amount by which the clock is presently off. .PP A small amount of error creeps in any time -.I hwclock +.B hwclock sets the clock, so it refrains from making an adjustment that would be less than 1 second. Later on, when you request an adjustment again, the accumulated drift will be more than a second and -.I hwclock +.B hwclock will do the adjustment then. .PP It is good to do a @@ -493,7 +492,7 @@ Line 1: 3 numbers, separated by blanks: 1) systematic drift rate in seconds per day, floating point decimal; 2) Resulting number of seconds since 1969 UTC of most recent adjustment or calibration, decimal integer; 3) zero (for compatibility with -.IR clock ) +.BR clock (8)) as a decimal integer. .PP Line 2: 1 number: Resulting number of seconds since 1969 UTC of most @@ -505,13 +504,13 @@ contain a valid time). This is a decimal integer. Line 3: "UTC" or "LOCAL". Tells whether the Hardware Clock is set to Coordinated Universal Time or local time. You can always override this value with options on the -.I hwclock +.B hwclock command line. .PP You can use an adjtime file that was previously used with the -.I clock +.BR clock (8) program with -.I hwclock. +.B hwclock. .SH "Automatic Hardware Clock Synchronization By the Kernel" @@ -552,14 +551,14 @@ minute mode. There is some sort of standard that defines CMOS memory Byte 50 on an ISA machine as an indicator of what century it is. -.I hwclock +.B hwclock does not use or set that byte because there are some machines that don't define the byte that way, and it really isn't necessary anyway, since the year-of-century does a good job of implying which century it is. If you have a bona fide use for a CMOS century byte, contact the -.I hwclock +.B hwclock maintainer; an option may be appropriate. Note that this section is only relevant when you are using the "direct diff --git a/clock/hwclock.c b/hwclock/hwclock.c similarity index 98% rename from clock/hwclock.c rename to hwclock/hwclock.c index d45516b4bc..3a3a94e1aa 100644 --- a/clock/hwclock.c +++ b/hwclock/hwclock.c @@ -20,6 +20,8 @@ * * Fix for Award 2094 bug, Dave Coffin (dcoffin@shore.net) 11/12/98 * Change of local time handling, Stefan Ring + * + * Distributed under GPL */ /* @@ -75,9 +77,9 @@ #include #include #include -#include #include +#include "shhopt.h" #include "clock.h" #include "nls.h" @@ -526,14 +528,12 @@ display_time(const bool hclock_valid, const time_t systime, "either invalid (e.g. 50th day of month) or beyond the range " "we can handle (e.g. Year 2095).\n")); else { - char *ctime_now; /* Address of static storage containing time string */ + struct tm *lt; + char *format = "%c"; + char ctime_now[200]; - /* For some strange reason, ctime() is designed to include a newline - character at the end. We have to remove that. - */ - ctime_now = ctime(&systime); /* Compute display value for time */ - *(ctime_now+strlen(ctime_now)-1) = '\0'; /* Cut off trailing newline */ - + lt = localtime(&systime); + strftime(ctime_now, sizeof(ctime_now), format, lt); printf(_("%s %.6f seconds\n"), ctime_now, -(sync_duration)); } } @@ -821,7 +821,7 @@ save_adjtime(const struct adjtime adjtime, const bool testing) { "in it (" ADJPATH ") for writing"); err = 1; } else { - if (fprintf(adjfile, newfile) < 0) { + if (fputs(newfile, adjfile) < 0) { outsyserr("Could not update file with the clock adjustment " "parameters (" ADJPATH ") in it"); err = 1; @@ -1075,6 +1075,12 @@ manipulate_epoch(const bool getepoch, const bool setepoch, #endif } +#if __ia64__ +#define RTC_DEV "/dev/efirtc" +#else +#define RTC_DEV "/dev/rtc" +#endif + /* usage - Output (error and) usage information @@ -1110,12 +1116,12 @@ usage( const char *fmt, ... ) { "\nOptions: \n" " --utc the hardware clock is kept in coordinated universal time\n" " --localtime the hardware clock is kept in local time\n" - " --directisa access the ISA bus directly instead of /dev/rtc\n" + " --directisa access the ISA bus directly instead of %s\n" " --badyear ignore rtc's year because the bios is broken\n" " --date specifies the time to which to set the hardware clock\n" " --epoch=year specifies the year which is the beginning of the \n" " hardware clock's epoch value\n" - )); + ),RTC_DEV); #ifdef __alpha__ fprintf( usageto, _( " --jensen, --arc, --srm, --funky-toy\n" @@ -1136,7 +1142,7 @@ usage( const char *fmt, ... ) { } int -main(int argc, char **argv, char **envp) { +main(int argc, char **argv) { struct timeval startup_time; /* The time we started up, in seconds into the epoch, including fractions. @@ -1190,9 +1196,13 @@ main(int argc, char **argv, char **envp) { gettimeofday(&startup_time, NULL); /* Remember what time we were invoked */ - /* not LC_ALL - the LC_NUMERIC part gives problems when - writing to /etc/adjtime - gqueri@mail.dotcom.fr */ - setlocale(LC_MESSAGES, ""); + setlocale(LC_ALL, ""); +#ifdef LC_NUMERIC + /* We need LC_CTYPE and LC_TIME and LC_MESSAGES, but must avoid + LC_NUMERIC since it gives problems when we write to /etc/adjtime. + - gqueri@mail.dotcom.fr */ + setlocale(LC_NUMERIC, "C"); +#endif bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); @@ -1301,9 +1311,16 @@ main(int argc, char **argv, char **envp) { /* A single routine for greater uniformity */ void -outsyserr(char *msg) { - fprintf(stderr, "%s: %s, errno=%d: %s.\n", - progname, msg, errno, strerror(errno)); +outsyserr(char *msg, ...) { + va_list args; + int errsv = errno; + + fprintf(stderr, "%s: ", progname); + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); + fprintf(stderr, ", errno=%d: %s.\n", + errsv, strerror(errsv)); } /**************************************************************************** diff --git a/clock/kd.c b/hwclock/kd.c similarity index 98% rename from clock/kd.c rename to hwclock/kd.c index 8fab619ff7..fd4fdd5a12 100644 --- a/clock/kd.c +++ b/hwclock/kd.c @@ -55,8 +55,8 @@ synchronize_to_clock_tick_kd(void) { to keep the machine from freezing. */ #ifdef HAVE_nanosleep - struct timespec sleep = { 0, 1 }; - nanosleep( &sleep, NULL ); + struct timespec xsleep = { 0, 1 }; + nanosleep( &xsleep, NULL ); #else usleep(1); #endif diff --git a/clock/rtc.c b/hwclock/rtc.c similarity index 83% rename from clock/rtc.c rename to hwclock/rtc.c index 652388430d..2874bfa14b 100644 --- a/clock/rtc.c +++ b/hwclock/rtc.c @@ -18,6 +18,13 @@ * used a struct rtc_time different from that used in mc146818rtc.h. */ +/* ia64 uses /dev/efirtc (char 10,136) */ +#if __ia64__ +#define RTC_DEV "/dev/efirtc" +#else +#define RTC_DEV "/dev/rtc" +#endif + /* On Sparcs, there is a that defines different ioctls (that are required on my machine). However, this include file does not exist on other architectures. */ @@ -95,7 +102,7 @@ do_rtc_read_ioctl(int rtc_fd, struct tm *tm) { #endif if (rc == -1) { perror(ioctlname); - fprintf(stderr, _("ioctl() to /dev/rtc to read the time failed.\n")); + fprintf(stderr, _("ioctl() to %s to read the time failed.\n"),RTC_DEV); exit(5); } #ifdef __sparc__ @@ -126,7 +133,7 @@ busywait_for_rtc_clock_tick(const int rtc_fd) { int rc; if (debug) - printf(_("Waiting in loop for time from /dev/rtc to change\n")); + printf(_("Waiting in loop for time from %s to change\n"),RTC_DEV); rc = do_rtc_read_ioctl(rtc_fd, &start_time); if (rc) @@ -160,9 +167,9 @@ synchronize_to_clock_tick_rtc(void) { int rtc_fd; /* File descriptor of /dev/rtc */ int ret; - rtc_fd = open("/dev/rtc",O_RDONLY); + rtc_fd = open(RTC_DEV,O_RDONLY); if (rtc_fd == -1) { - outsyserr(_("open() of /dev/rtc failed")); + outsyserr(_("open() of %s failed"),RTC_DEV); ret = 1; } else { int rc; /* Return code from ioctl */ @@ -179,16 +186,16 @@ int ret; on an Alpha, where the Hardware Clock interrupts are used by the kernel for the system clock, so aren't at the user's disposal. */ - if (debug) printf(_("/dev/rtc does not have interrupt functions. ")); + if (debug) + printf(_("%s does not have interrupt functions. "),RTC_DEV); ret = busywait_for_rtc_clock_tick(rtc_fd); - } else if (rc != -1) { - int rc; /* return code from ioctl */ + } else if (rc == 0) { unsigned long dummy; /* this blocks until the next update interrupt */ rc = read(rtc_fd, &dummy, sizeof(dummy)); if (rc == -1) { - outsyserr(_("read() to /dev/rtc to wait for clock tick failed")); + outsyserr(_("read() to %s to wait for clock tick failed"),RTC_DEV); ret = 1; } else { ret = 0; @@ -196,11 +203,11 @@ int ret; /* Turn off update interrupts */ rc = ioctl(rtc_fd, RTC_UIE_OFF, 0); if (rc == -1) - outsyserr(_("ioctl() to /dev/rtc to turn off update interrupts " - "failed")); + outsyserr(_("ioctl() to %s to turn off update interrupts " + "failed"),RTC_DEV); } else { - outsyserr(_("ioctl() to /dev/rtc to turn on update interrupts " - "failed unexpectedly")); + outsyserr(_("ioctl() to %s to turn on update interrupts " + "failed unexpectedly"),RTC_DEV); ret = 1; } close(rtc_fd); @@ -217,9 +224,9 @@ read_hardware_clock_rtc(struct tm *tm) { -----------------------------------------------------------------------------*/ int rtc_fd; /* File descriptor of /dev/rtc */ - rtc_fd = open("/dev/rtc",O_RDONLY); + rtc_fd = open(RTC_DEV,O_RDONLY); if (rtc_fd == -1) { - outsyserr(_("open() of /dev/rtc failed")); + outsyserr(_("open() of %s failed"),RTC_DEV); exit(5); } @@ -240,9 +247,9 @@ set_hardware_clock_rtc(const struct tm *new_broken_time) { int rc; int rtc_fd; - rtc_fd = open("/dev/rtc", O_RDONLY); + rtc_fd = open(RTC_DEV, O_RDONLY); if (rtc_fd < 0) { - outsyserr(_("Unable to open /dev/rtc")); + outsyserr(_("Unable to open %s"),RTC_DEV); exit(5); } else { char *ioctlname; @@ -265,7 +272,7 @@ set_hardware_clock_rtc(const struct tm *new_broken_time) { #endif if (rc == -1) { perror(ioctlname); - fprintf(stderr, _("ioctl() to /dev/rtc to set the time failed.\n")); + fprintf(stderr, _("ioctl() to %s to set the time failed.\n"),RTC_DEV); exit(5); } else { if (debug) @@ -293,13 +300,13 @@ static struct clock_ops rtc = { /* return &rtc if /dev/rtc can be opened, NULL otherwise */ struct clock_ops * probe_for_rtc_clock(){ - int rtc_fd = open("/dev/rtc", O_RDONLY); + int rtc_fd = open(RTC_DEV, O_RDONLY); if (rtc_fd > 0) { close(rtc_fd); return &rtc; } if (debug) - outsyserr(_("Open of /dev/rtc failed")); + outsyserr(_("Open of %s failed"),RTC_DEV); return NULL; } @@ -312,30 +319,30 @@ get_epoch_rtc(unsigned long *epoch_p, int silent) { ----------------------------------------------------------------------------*/ int rtc_fd; - rtc_fd = open("/dev/rtc", O_RDONLY); + rtc_fd = open(RTC_DEV, O_RDONLY); if (rtc_fd < 0) { if (!silent) { if (errno == ENOENT) fprintf(stderr, _( "To manipulate the epoch value in the kernel, we must " "access the Linux 'rtc' device driver via the device special " - "file /dev/rtc. This file does not exist on this system.\n")); + "file %s. This file does not exist on this system.\n"),RTC_DEV); else - outsyserr(_("Unable to open /dev/rtc")); + outsyserr(_("Unable to open %s"),RTC_DEV); } return 1; } if (ioctl(rtc_fd, RTC_EPOCH_READ, epoch_p) == -1) { if (!silent) - outsyserr(_("ioctl(RTC_EPOCH_READ) to /dev/rtc failed")); + outsyserr(_("ioctl(RTC_EPOCH_READ) to %s failed"),RTC_DEV); close(rtc_fd); return 1; } if (debug) - printf(_("we have read epoch %ld from /dev/rtc " - "with RTC_EPOCH_READ ioctl.\n"), *epoch_p); + printf(_("we have read epoch %ld from %s " + "with RTC_EPOCH_READ ioctl.\n"), *epoch_p,RTC_DEV); close(rtc_fd); return 0; @@ -359,27 +366,27 @@ set_epoch_rtc(unsigned long epoch) { return 1; } - rtc_fd = open("/dev/rtc", O_RDONLY); + rtc_fd = open(RTC_DEV, O_RDONLY); if (rtc_fd < 0) { if (errno == ENOENT) fprintf(stderr, _("To manipulate the epoch value in the kernel, we must " "access the Linux 'rtc' device driver via the device special " - "file /dev/rtc. This file does not exist on this system.\n")); + "file %s. This file does not exist on this system.\n"),RTC_DEV); else - outsyserr(_("Unable to open /dev/rtc")); + outsyserr(_("Unable to open %s"),RTC_DEV); return 1; } if (debug) printf(_("setting epoch to %ld " - "with RTC_EPOCH_SET ioctl to /dev/rtc.\n"), epoch); + "with RTC_EPOCH_SET ioctl to %s.\n"), epoch, RTC_DEV); if (ioctl(rtc_fd, RTC_EPOCH_SET, epoch) == -1) { if (errno == EINVAL) - fprintf(stderr, _("The kernel device driver for /dev/rtc " - "does not have the RTC_EPOCH_SET ioctl.\n")); + fprintf(stderr, _("The kernel device driver for %s " + "does not have the RTC_EPOCH_SET ioctl.\n"),RTC_DEV); else - outsyserr(_("ioctl(RTC_EPOCH_SET) to /dev/rtc failed")); + outsyserr(_("ioctl(RTC_EPOCH_SET) to %s failed"),RTC_DEV); close(rtc_fd); return 1; } diff --git a/clock/shhopt-1.1.lsm b/hwclock/shhopt-1.1.lsm similarity index 100% rename from clock/shhopt-1.1.lsm rename to hwclock/shhopt-1.1.lsm diff --git a/clock/shhopt.c b/hwclock/shhopt.c similarity index 100% rename from clock/shhopt.c rename to hwclock/shhopt.c diff --git a/clock/shhopt.h b/hwclock/shhopt.h similarity index 100% rename from clock/shhopt.h rename to hwclock/shhopt.h diff --git a/kbd/kbdrate.c b/kbd/kbdrate.c index 747757daf2..df116e1e07 100644 --- a/kbd/kbdrate.c +++ b/kbd/kbdrate.c @@ -273,7 +273,8 @@ int main( int argc, char **argv ) close( fd ); - if (!silent) printf( _("Typematic Rate set to %.1f cps (delay = %d ms)\n"), + if (!silent) + printf( _("Typematic Rate set to %.1f cps (delay = %d ms)\n"), valid_rates[value & 0x1f] / 10.0, valid_delays[ (value & 0x60) >> 5 ] ); diff --git a/lib/Makefile b/lib/Makefile index a9f8596d1c..31e953ce79 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,9 +1,7 @@ include ../make_include include ../MCONFIG -CFLAGS=-I$(LIB) $(OPT) - -all: err.o my_reboot.o setproctitle.o env.o +all: err.o my_reboot.o setproctitle.o env.o carefulputc.o err.o: err.c @@ -13,6 +11,8 @@ env.o: env.h setproctitle.o: setproctitle.h +carefulputc.o: carefulputc.h + .PHONY: clean clean: -rm -f *.o *~ core diff --git a/lib/carefulputc.c b/lib/carefulputc.c new file mode 100644 index 0000000000..9322337721 --- /dev/null +++ b/lib/carefulputc.c @@ -0,0 +1,26 @@ +/* putc() for use in write and wall (that sometimes are sgid tty) */ +/* Avoid control characters in our locale, and also ASCII control characters. + Note that the locale of the recipient is unknown. */ +#include +#include +#include "carefulputc.h" + +#define iso8859x_iscntrl(c) \ + (((c) & 0x7f) < 0x20 || (c) == 0x7f) + +int +carefulputc(int c, FILE *fp) { + int ret; + + if (c == '\007' || c == '\t' || c == '\r' || c == '\n' || + (!iso8859x_iscntrl(c) && (isprint(c) || isspace(c)))) + ret = putc(c, fp); + else if ((c & 0x80) || !isprint(c^0x40)) + ret = fprintf(fp, "\\%3o", (unsigned char) c); + else { + ret = putc('^', fp); + if (ret != EOF) + ret = putc(c^0x40, fp); + } + return (ret < 0) ? EOF : 0; +} diff --git a/lib/carefulputc.h b/lib/carefulputc.h new file mode 100644 index 0000000000..29cc75da0e --- /dev/null +++ b/lib/carefulputc.h @@ -0,0 +1 @@ +extern int carefulputc(int c, FILE *fp); diff --git a/lib/nls.h b/lib/nls.h index 67b42a9991..d36a5bc881 100644 --- a/lib/nls.h +++ b/lib/nls.h @@ -1,3 +1,4 @@ +int main(int argc, char *argv[]); #include "../defines.h" /* for HAVE_locale_h */ diff --git a/lib/pathnames.h b/lib/pathnames.h index 60797f94eb..672b58e92b 100644 --- a/lib/pathnames.h +++ b/lib/pathnames.h @@ -128,7 +128,7 @@ Libc5 and glibc 2.0-2.1 have /var/spool/mail, but glibc 2.1.1 has /var/mail. /* used in login-utils/shutdown.c */ #define _PATH_MTAB "/etc/mtab" #define _PATH_UMOUNT "/bin/umount" -#define UMOUNT_ARGS "umount", "-a" +#define UMOUNT_ARGS "umount", "-a", "-t", "nodevfs" #define SWAPOFF_ARGS "swapoff", "-a" /* used in login-utils/setpwnam.h and login-utils/islocal.c */ diff --git a/lib/widechar.h b/lib/widechar.h index a8d288298a..c440006f79 100644 --- a/lib/widechar.h +++ b/lib/widechar.h @@ -38,4 +38,6 @@ # define wcsdup strdup # define wcslen strlen +# define wcwidth(c) 1 + #endif diff --git a/login-utils/Makefile b/login-utils/Makefile index 0960854ecb..d986501e13 100644 --- a/login-utils/Makefile +++ b/login-utils/Makefile @@ -19,7 +19,7 @@ MAN1.PASSWD= passwd.1 MAN8.GETTY= agetty.8 MAN8.INIT= fastboot.8 fasthalt.8 halt.8 reboot.8 simpleinit.8 shutdown.8 \ - need.8 + initctl.8 MAN8.PUTILS= vipw.8 vigr.8 @@ -28,7 +28,7 @@ MAN8.PUTILS= vipw.8 vigr.8 SBIN.GETTY= agetty -SBIN.INIT= simpleinit shutdown need +SBIN.INIT= simpleinit shutdown initctl BIN.PUTILS= login @@ -84,14 +84,22 @@ all-misc: $(USRBIN.MISC) # Rules for everything else -agetty.o: $(LIB)/pathnames.h +checktty.o login.o: login.h +cryptocard.o login.o: cryptocard.h +chfn.o chsh.o islocal.o passwd.o: islocal.h +chfn.o chsh.o passwd.o setpwnam.o vipw.o: setpwnam.h +chfn.o chsh.o login.o newgrp.o passwd.o simpleinit.o: my_crypt.h +initctl.o simpleinit.o: simpleinit.h +agetty.o islocal.o last.o setpwnam.o shutdown.o simpleinit.o \ + vipw.o: $(LIB)/pathnames.h +shutdown.o simpleinit.o: $(LIB)/linux_reboot.h +wall.o: ttymsg.h $(LIB)/carefulputc.h + agetty: agetty.o chfn: chfn.o islocal.o setpwnam.o $(LIB)/env.o $(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM) chsh: chsh.o islocal.o setpwnam.o $(LIB)/env.o $(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM) -islocal.o: $(LIB)/pathnames.h -last.o: $(LIB)/pathnames.h last: last.o ifeq "$(HAVE_PAM)" "yes" @@ -107,36 +115,35 @@ mesg: mesg.o $(ERR_O) newgrp: newgrp.o $(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM) -setpwnam.o: $(LIB)/pathnames.h -shutdown.o: $(LIB)/pathnames.h $(LIB)/linux_reboot.h shutdown: shutdown.o $(LIB)/my_reboot.o -simpleinit.o: $(LIB)/pathnames.h $(LIB)/linux_reboot.h simpleinit.h -need.o: simpleinit.h simpleinit: simpleinit.o $(LIB)/my_reboot.o $(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) -need: need.o +initctl: initctl.o $(CC) $(LDFLAGS) -o $@ $^ -vipw.o: $(LIB)/pathnames.h vipw: vipw.o newgrp.o: $(LIB)/pathnames.h $(CC) -c $(CFLAGS) $(PAMFL) newgrp.c -wall: wall.o ttymsg.o +wall: wall.o ttymsg.o $(LIB)/carefulputc.o +LOGINFLAGS= ifeq "$(USE_TTY_GROUP)" "yes" + LOGINFLAGS += -DUSE_TTY_GROUP +endif +ifeq "$(ALLOW_VCS_USE)" "yes" + LOGINFLAGS += -DCHOWNVCS +endif + login.o: login.c $(LIB)/pathnames.h $(LIB)/setproctitle.c $(LIB)/setproctitle.h - $(CC) -c $(CFLAGS) $(PAMFL) -DUSE_TTY_GROUP login.c + $(CC) -c $(CFLAGS) $(PAMFL) $(LOGINFLAGS) login.c + +# LOGINFLAGS here only for -DUSE_TTY_GROUP mesg.o: mesg.c $(LIB)/errs.h - $(CC) -c $(CFLAGS) -DUSE_TTY_GROUP mesg.c -else -login.o: $(LIB)/pathnames.h - $(CC) -c $(CFLAGS) $(PAMFL) login.c -mesg.o: $(LIB)/errs.h -endif + $(CC) -c $(CFLAGS) $(LOGINFLAGS) mesg.c passwd: passwd.o islocal.o setpwnam.o $(LIB)/env.o $(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) @@ -159,7 +166,7 @@ install: all $(WHAT_TO_INSTALL) install-putils: $(BIN.PUTILS) $(USRBIN.PUTILS) $(USRSBIN.PUTILS) $(INSTALLDIR) $(BINDIR) $(USRBINDIR) $(USRSBINDIR) - $(INSTALLSUID) $(BIN.PUTILS) $(BINDIR) + $(INSTALLBIN) $(BIN.PUTILS) $(BINDIR) $(INSTALLSUID) $(USRBIN.PUTILS) $(USRBINDIR) $(INSTALLBIN) $(USRSBIN.PUTILS) $(USRSBINDIR) (cd $(USRSBINDIR); ln -sf vipw vigr) @@ -183,7 +190,12 @@ install-init: $(SBIN.INIT) (cd $(SHUTDOWNDIR); ln -sf shutdown fastboot) (cd $(SHUTDOWNDIR); ln -sf shutdown halt) (cd $(SHUTDOWNDIR); ln -sf shutdown fasthalt) - (cd $(SHUTDOWNDIR); ln -sf need display-services) + (cd $(SHUTDOWNDIR); ln -sf initctl need) + (cd $(SHUTDOWNDIR); ln -sf initctl display-services) + (cd $(SHUTDOWNDIR); ln -sf initctl provide) + (cd $(MAN8DIR); ln -sf initctl.8 need.8) + (cd $(MAN8DIR); ln -sf initctl.8 display-services.8) + (cd $(MAN8DIR); ln -sf initctl.8 provide.8) install-getty: $(SBIN.GETTY) diff --git a/login-utils/agetty.c b/login-utils/agetty.c index 6ae4e83358..63f4adfa65 100644 --- a/login-utils/agetty.c +++ b/login-utils/agetty.c @@ -489,6 +489,38 @@ parse_args(argc, argv, op) if (argc > optind && argv[optind]) setenv ("TERM", argv[optind], 1); +#ifdef DO_DEVFS_FIDDLING + /* + * some devfs junk, following Goswin Brederlow: + * turn ttyS into tts/ + * turn tty into vc/ + */ + if (op->tty && strlen(op->tty) < 90) { + char dev_name[100]; + struct stat st; + + if (strncmp(op->tty, "ttyS", 4) == 0) { + strcpy(dev_name, "/dev/"); + strcat(dev_name, op->tty); + if (stat(dev_name, &st) < 0) { + strcpy(dev_name, "/dev/tts/"); + strcat(dev_name, op->tty + 4); + if (stat(dev_name, &st) == 0) + op->tty = strdup(dev_name + 5); + } + } else if (strncmp(op->tty, "tty", 3) == 0) { + strcpy(dev_name, "/dev/"); + strncat(dev_name, op->tty, 90); + if (stat(dev_name, &st) < 0) { + strcpy(dev_name, "/dev/vc/"); + strcat(dev_name, op->tty + 3); + if (stat(dev_name, &st) == 0) + op->tty = strdup(dev_name + 5); + } + } + } +#endif + debug(_("exiting parseargs\n")); } @@ -505,7 +537,7 @@ parse_speeds(op, arg) for (cp = strtok(arg, ","); cp != 0; cp = strtok((char *) 0, ",")) { if ((op->speeds[op->numspeed++] = bcode(cp)) <= 0) error(_("bad speed: %s"), cp); - if (op->numspeed > MAX_SPEED) + if (op->numspeed >= MAX_SPEED) error(_("too many alternate speeds")); } debug(_("exiting parsespeeds\n")); @@ -847,8 +879,11 @@ do_prompt(op, tp) case 'o': { char domainname[256]; - +#ifdef HAVE_getdomainname getdomainname(domainname, sizeof(domainname)); +#else + strcpy(domainname, "unknown_domain"); +#endif domainname[sizeof(domainname)-1] = '\0'; printf ("%s", domainname); } diff --git a/login-utils/checktty.c b/login-utils/checktty.c index 66fee73385..6269b6b07d 100644 --- a/login-utils/checktty.c +++ b/login-utils/checktty.c @@ -29,12 +29,7 @@ #endif #include "pathnames.h" - -/* functions in login.c */ -void badlogin(const char *s); -void sleepexit(int); -extern struct hostent hostaddress; -extern char *hostname; +#include "login.h" #ifdef TESTING struct hostent hostaddress; @@ -43,13 +38,13 @@ char *hostname; void badlogin(const char *s) { - printf(_("badlogin: %s\n"), s); + printf("badlogin: %s\n", s); } void sleepexit(int x) { - printf(_("sleepexit %d\n"), x); + printf("sleepexit %d\n", x); exit(1); } #endif @@ -315,7 +310,7 @@ in_class(const char *tty, char *class) } /* start JDS - SBA */ -void +static void free_group(struct grplist *ge) { if (ge) { @@ -326,7 +321,7 @@ free_group(struct grplist *ge) } } -void +static void free_class(struct ttyclass *tc) { if (tc) { @@ -339,7 +334,7 @@ free_class(struct ttyclass *tc) } } -void +static void free_all(void) { free_class(ttyclasses); diff --git a/login-utils/chfn.c b/login-utils/chfn.c index 73a9b89186..de228241b8 100644 --- a/login-utils/chfn.c +++ b/login-utils/chfn.c @@ -34,6 +34,8 @@ #include #include #include "my_crypt.h" +#include "islocal.h" +#include "setpwnam.h" #include "nls.h" #include "env.h" @@ -42,15 +44,6 @@ #include #endif -extern int is_local(char *); - -#undef P -#if __STDC__ -#define P(foo) foo -#else -#define P(foo) () -#endif - typedef unsigned char boolean; #define false 0 #define true 1 @@ -69,17 +62,15 @@ struct finfo { char *other; }; -static boolean parse_argv P((int argc, char *argv[], struct finfo *pinfo)); -static void usage P((FILE *fp)); -static void parse_passwd P((struct passwd *pw, struct finfo *pinfo)); -static void ask_info P((struct finfo *oldfp, struct finfo *newfp)); -static char *prompt P((char *question, char *def_val)); -static int check_gecos_string P((char *msg, char *gecos)); -static boolean set_changed_data P((struct finfo *oldfp, struct finfo *newfp)); -static int save_new_data P((struct finfo *pinfo)); -static void *xmalloc P((int bytes)); - -extern int setpwnam P((struct passwd *pwd)); +static boolean parse_argv (int argc, char *argv[], struct finfo *pinfo); +static void usage (FILE *fp); +static void parse_passwd (struct passwd *pw, struct finfo *pinfo); +static void ask_info (struct finfo *oldfp, struct finfo *newfp); +static char *prompt (char *question, char *def_val); +static int check_gecos_string (char *msg, char *gecos); +static boolean set_changed_data (struct finfo *oldfp, struct finfo *newfp); +static int save_new_data (struct finfo *pinfo); +static void *xmalloc (int bytes); #define memzero(ptr, size) memset((char *) ptr, 0, size) diff --git a/login-utils/chsh.c b/login-utils/chsh.c index f17b176fb2..d1a3fa8207 100644 --- a/login-utils/chsh.c +++ b/login-utils/chsh.c @@ -37,6 +37,8 @@ #include #include #include "my_crypt.h" +#include "islocal.h" +#include "setpwnam.h" #include "nls.h" #include "env.h" @@ -45,15 +47,6 @@ #include #endif -extern int is_local(char *); - -#undef P -#if __STDC__ -#define P(foo) foo -#else -#define P(foo) () -#endif - typedef unsigned char boolean; #define false 0 #define true 1 @@ -71,19 +64,17 @@ struct sinfo { char *shell; }; -static void parse_argv P((int argc, char *argv[], struct sinfo *pinfo)); -static void usage P((FILE *fp)); -static char *prompt P((char *question, char *def_val)); -static int check_shell P((char *shell)); -static boolean get_shell_list P((char *shell)); -static void *xmalloc P((int bytes)); -extern int setpwnam P((struct passwd *pwd)); +static void parse_argv (int argc, char *argv[], struct sinfo *pinfo); +static void usage (FILE *fp); +static char *prompt (char *question, char *def_val); +static int check_shell (char *shell); +static boolean get_shell_list (char *shell); +static void *xmalloc (int bytes); + #define memzero(ptr, size) memset((char *) ptr, 0, size) -int main (argc, argv) - int argc; - char *argv[]; -{ +int +main (int argc, char *argv[]) { char *cp, *shell, *oldshell; uid_t uid; struct sinfo info; diff --git a/login-utils/cryptocard.c b/login-utils/cryptocard.c index 1195b2eb80..9e221cbe6d 100644 --- a/login-utils/cryptocard.c +++ b/login-utils/cryptocard.c @@ -54,9 +54,7 @@ #include "../libdes/des.h" #endif /* EAY_LIBDES */ -extern char *getpass(const char *prompt); -extern struct passwd *pwd; -extern int timeout; +#include "cryptocard.h" static char * generate_challenge(void) diff --git a/login-utils/cryptocard.h b/login-utils/cryptocard.h new file mode 100644 index 0000000000..a967137f9f --- /dev/null +++ b/login-utils/cryptocard.h @@ -0,0 +1,7 @@ +/* defined in cryptocard.c */ +extern int cryptocard (void); + +/* defined in login.c */ +extern struct passwd *pwd; +extern int timeout; + diff --git a/login-utils/need.8 b/login-utils/initctl.8 similarity index 73% rename from login-utils/need.8 rename to login-utils/initctl.8 index cc3712d747..1aa421a02c 100644 --- a/login-utils/need.8 +++ b/login-utils/initctl.8 @@ -18,26 +18,30 @@ .\" The postal address is: .\" Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia. .\" -.\" need.8 Richard Gooch 28-FEB-2000 +.\" initctl.8 Richard Gooch 6-NOV-2000 .\" -.TH NEED 8 "28 Feb 2000" "Util-Linux Package" +.TH INITCTL 8 "6 Nov 2000" "Util-Linux Package" .SH NAME -need \- utility to tell simpleinit(8) to start a service +initctl \- utility to control simpleinit(8) .SH SYNOPSIS .nf -\fBneed\fP [\fB-r\fP] [\fBservice\fP] +\fBneed\fP [\fB-r\fP] \fBservice\fP .BR display-services +\fBprovide service\fP .fi -.SH DESCRIPTION +.SH OVERVIEW +The \fBneed\fP programme is designed to help improve the robustness, +scalability and readability of system boot scripts. It is now possible +to write a modularised set of boot scripts without the complex and +fragile numbered symlink scheme used in SysV-style boot scripts. Each +script can simply declare, using \fBneed\fP(8), what must run before +them. +.SH DESCRIPTION for need The \fBneed\fP programme is a utility that tells \fBsimpleinit\fP(8) to start a \fIservice\fP (usually a script in \fI/sbin/init.d\fP) and will wait for the service to become available. If the service is already available, it will not be started again. -When invoked as \fBdisplay-services\fP it will write the list of -currently available services and the list of failed services to the -standard output. - The \fB-r\fP option is used to tell \fBsimpleinit\fP(8) to "roll back" (stop) services up to (but not including) \fIservice\fP. If \fIservice\fP is not specified, all services are stopped. The \fB-r\fP @@ -45,12 +49,24 @@ option thus allows the system to be partially or wholly shut down in an orderly fashion. The \fBshutdown\fP(8) programme still needs to be run. -The \fBneed\fP programme is designed to help improve the robustness, -scalability and readability of system boot scripts. It is now possible -to write a modularised set of boot scripts without the complex and -fragile numbered symlink scheme used in SysV-style boot scripts. Each -script can simply declare, using \fBneed\fP(8), what must run before -them. +.SH DESCRIPTION for display-services +When invoked as \fBdisplay-services\fP it will write the list of +currently available services and the list of failed services to the +standard output. + +.SH DESCRIPTION for provide +When invoked as \fBprovide\fP it tells \fBsimpleinit\fP(8) that the +parent (calling) process will be providing a service with name +\fIservice\fP. If the calling process exits successfully (status 0) +the service is deemed to be available. Only one instance of +\fIservice\fP may be started, so alternate providers will block and +may fail. + +Using \fBprovide\fP it is possible to have multiple potential +providers for the same (generic) service (e.g. \fBsendmail\fP and +\fBqmail\fP both provide a \fBmta\fP service), where only one actually +provides the service. This may be used by service startup scripts +which check for configuration files. .SH EXIT CODE The exit code from \fBneed\fP is 0 if the service was successfully started, 1 if the service failed badly, and 2 if the service is @@ -61,6 +77,11 @@ The exit code from \fBneed -r\fP is 0 if the service was successfully stopped, 1 if the service could not be stopped, and 2 if the service was not available to start with. The service shutdown scripts may only return 0 (for success) or 1 (for failure). + +The exit code from \fBprovide\fP is 0 if the service may be provided, +1 if it may not, and 2 if the parent process is not a child of +init. It may block waiting for another provider which is initialising +the service. .SH SIGNALS \fBneed\fP(8) uses \fBSIGUSR1\fP, \fBSIGUSR2\fP and \fBSIGPOLL\fP for communication with \fBsimpleinit\fP(8). Don't send these signals to diff --git a/login-utils/need.c b/login-utils/initctl.c similarity index 62% rename from login-utils/need.c rename to login-utils/initctl.c index 97690c4617..6fb8d097fe 100644 --- a/login-utils/need.c +++ b/login-utils/initctl.c @@ -1,6 +1,6 @@ -/* need.c +/* initctl.c - Source file for need (init(8) dependency tool). + Source file for initctl (init(8) control tool). Copyright (C) 2000 Richard Gooch @@ -24,16 +24,19 @@ */ /* - This tool will request init(8) to start a service and will wait for that - service to be available. If the service is already available, init(8) will - not start it again. + This tool will send control messages to init(8). For example, it may + request init(8) to start a service and will wait for that service to be + available. If the service is already available, init(8) will not start it + again. This tool may also be used to inspect the list of currently available services. Written by Richard Gooch 28-FEB-2000 - Last updated by Richard Gooch 28-FEB-2000 + Updated by Richard Gooch 11-OCT-2000: Added provide support. + + Last updated by Richard Gooch 6-NOV-2000: Renamed to initctl.c */ @@ -44,6 +47,7 @@ #include #include #include +#include #include #include "simpleinit.h" @@ -60,7 +64,7 @@ int main (int argc, char **argv) struct sigaction sa; sigset_t ss; char *ptr; - long buffer[COMMAND_SIZE / sizeof (long)]; + long buffer[COMMAND_SIZE / sizeof (long) + 1]; struct command_struct *command = (struct command_struct *) buffer; sigemptyset (&ss); @@ -75,11 +79,55 @@ int main (int argc, char **argv) sigaction (SIG_NOT_PRESENT, &sa, NULL); sigaction (SIG_FAILED, &sa, NULL); command->pid = getpid (); + command->ppid = getppid (); if ( ( ptr = strrchr (argv[0], '/') ) == NULL ) ptr = argv[0]; else ++ptr; + /* First generate command number by looking at invocation name */ if (strcmp (ptr, "display-services") == 0) - { command->command = COMMAND_DUMP_LIST; + else if (strcmp (ptr, "need") == 0) command->command = COMMAND_NEED; + else if (strcmp (ptr, "provide") == 0) command->command = COMMAND_PROVIDE; + else command->command = COMMAND_TEST; + /* Now check for switches */ + if ( (argc > 1) && (argv[1][0] == '-') ) + { + switch (argv[1][1]) + { + case 'n': + command->command = COMMAND_NEED; + break; + case 'r': + command->command = COMMAND_ROLLBACK; + break; + case 'd': + command->command = COMMAND_DUMP_LIST; + break; + case 'p': + command->command = COMMAND_PROVIDE; + break; + default: + fprintf (stderr, "Illegal switch: \"%s\"\n", argv[1]); + exit (1); + /*break;*/ + } + --argc; + ++argv; + } + switch (command->command) + { + case COMMAND_NEED: + case COMMAND_PROVIDE: + if (argc < 2) + { + fprintf (stderr, "Usage:\tneed|provide programme\n"); + exit (1); + } + /* Fall through */ + case COMMAND_ROLLBACK: + if (argc > 1) strcpy (command->name, argv[1]); + else command->name[0] = '\0'; + break; + case COMMAND_DUMP_LIST: if (tmpnam (command->name) == NULL) { fprintf (stderr, "Unable to create a unique filename\t%s\n", @@ -92,26 +140,7 @@ int main (int argc, char **argv) command->name, ERRSTRING); exit (1); } - } - else - { - if ( (argc > 1) && (strcmp (argv[1], "-r") == 0) ) - { - command->command = COMMAND_ROLLBACK; - --argc; - ++argv; - } - else command->command = COMMAND_NEED; - if (argc == 2) strcpy (command->name, argv[1]); - else - { - if (command->command == COMMAND_ROLLBACK) command->name[0] = '\0'; - else - { - fprintf (stderr, "Usage:\tneed programme\n"); - exit (1); - } - } + break; } if ( ( fd = open ("/dev/initctl", O_WRONLY, 0) ) < 0 ) { @@ -128,14 +157,35 @@ int main (int argc, char **argv) { sigemptyset (&ss); while (caught_signal == 0) sigsuspend (&ss); - switch (caught_signal) + switch (command->command) { - case SIG_PRESENT: - return 0; - case SIG_NOT_PRESENT: - return 2; - case SIG_FAILED: - return 1; + case COMMAND_PROVIDE: + switch (caught_signal) + { + case SIG_PRESENT: + return 1; + case SIG_NOT_PRESENT: + return 0; + case SIG_NOT_CHILD: + fprintf (stderr, "Error\n"); + return 2; + default: + return 3; + } + break; + default: + switch (caught_signal) + { + case SIG_PRESENT: + return 0; + case SIG_NOT_PRESENT: + return 2; + case SIG_FAILED: + return 1; + default: + return 3; + } + break; } return 3; } diff --git a/login-utils/islocal.c b/login-utils/islocal.c index 10a709b565..87f8f1cb24 100644 --- a/login-utils/islocal.c +++ b/login-utils/islocal.c @@ -17,10 +17,12 @@ */ #include +#include #include #include "nls.h" #include "pathnames.h" +#include "islocal.h" #define MAX_LENGTH 1024 diff --git a/login-utils/islocal.h b/login-utils/islocal.h new file mode 100644 index 0000000000..305bc57c68 --- /dev/null +++ b/login-utils/islocal.h @@ -0,0 +1 @@ +extern int is_local(char *user); diff --git a/login-utils/last.c b/login-utils/last.c index b78d00b868..8375f9f072 100644 --- a/login-utils/last.c +++ b/login-utils/last.c @@ -90,16 +90,16 @@ static char *file = _PATH_WTMP; /* wtmp file */ static int doyear = 0; /* output year in dates */ static int dolong = 0; /* print also ip-addr */ -static void wtmp(), addarg(), hostconv(); -static int want(); -TTY *addtty(); -static char *ttyconv(); +static void wtmp(void); +static void addarg(int, char *); +static void hostconv(char *); +static void onintr(int); +static int want(struct utmp *, int); +TTY *addtty(char *); +static char *ttyconv(char *); int -main(argc, argv) - int argc; - char **argv; -{ +main(int argc, char **argv) { extern int optind; extern char *optarg; int ch; @@ -159,10 +159,8 @@ main(argc, argv) * print_partial_line -- * print the first part of each output line according to specified format */ -void -print_partial_line(bp) - struct utmp *bp; -{ +static void +print_partial_line(struct utmp *bp) { char *ct; ct = ctime(&bp->ut_time); @@ -193,12 +191,10 @@ print_partial_line(bp) * read through the wtmp file */ static void -wtmp() -{ +wtmp(void) { register struct utmp *bp; /* current structure */ register TTY *T; /* tty list entry */ long delta; /* time difference */ - void onintr(); char *crmsg = NULL; char *ct = NULL; struct utmp **utmplist = NULL; @@ -310,10 +306,7 @@ wtmp() * see if want this entry */ static int -want(bp, check) - register struct utmp *bp; - int check; -{ +want(struct utmp *bp, int check) { register ARG *step; if (check) { @@ -357,10 +350,7 @@ want(bp, check) * add an entry to a linked list of arguments */ static void -addarg(type, arg) - int type; - char *arg; -{ +addarg(int type, char *arg) { register ARG *cur; if (!(cur = (ARG *)malloc((unsigned int)sizeof(ARG)))) { @@ -378,9 +368,7 @@ addarg(type, arg) * add an entry to a linked list of ttys */ TTY * -addtty(ttyname) - char *ttyname; -{ +addtty(char *ttyname) { register TTY *cur; if (!(cur = (TTY *)malloc((unsigned int)sizeof(TTY)))) { @@ -400,9 +388,7 @@ addtty(ttyname) * off the domain suffix since that's what login(1) does. */ static void -hostconv(arg) - char *arg; -{ +hostconv(char *arg) { static int first = 1; static char *hostdot, name[MAXHOSTNAMELEN]; @@ -427,9 +413,7 @@ hostconv(arg) * convert tty to correct name. */ static char * -ttyconv(arg) - char *arg; -{ +ttyconv(char *arg) { char *mval; /* @@ -459,10 +443,8 @@ ttyconv(arg) * onintr -- * on interrupt, we inform the user how far we've gotten */ -void -onintr(signo) - int signo; -{ +static void +onintr(int signo) { char *ct; ct = ctime(&utmpbuf.ut_time); diff --git a/login-utils/login.c b/login-utils/login.c index eaaf1a5204..3ad3b219c2 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -116,7 +116,9 @@ #include #include #include +#include "pathnames.h" #include "my_crypt.h" +#include "login.h" #include "nls.h" #ifdef __linux__ @@ -188,25 +190,22 @@ struct lastlog }; #endif -#include "pathnames.h" -#define P_(s) () -void opentty P_((const char *tty)); -void getloginname P_((void)); -void timedout P_((void)); -int rootterm P_((char *ttyn)); -void motd P_((void)); -void sigint P_((void)); -void checknologin P_((void)); -void dolastlog P_((int quiet)); -void badlogin P_((const char *name)); -char *stypeof P_((char *ttyid)); -void checktty P_((char *user, char *tty, struct passwd *pwd)); -void sleepexit P_((int eval)); +static void getloginname (void); +static void timedout (int); +static void sigint (int); +static int rootterm (char *ttyn); +static void motd (void); +static void checknologin (void); +static void dolastlog (int quiet); + +#ifndef __linux__ +static char *stypeof (char *ttyid); +#endif + #ifdef CRYPTOCARD -int cryptocard P_((void)); +#include "cryptocard.h" #endif -#undef P_ #ifdef KERBEROS #include @@ -235,14 +234,14 @@ int kerror = KSUCCESS, notickets = 1; #ifndef __linux__ int timeout = 300; #else -int timeout = 60; +int timeout = 60; /* used in cryptocard.c */ #endif -struct passwd *pwd; -int failures = 1; +struct passwd *pwd; /* used in cryptocard.c */ +struct hostent hostaddress; /* used in checktty.c */ char term[64], *hostname, *username, *tty; -struct hostent hostaddress; -char thishost[100]; +static char thishost[100]; +static int failures = 1; #ifndef __linux__ struct sgttyb sgttyb; @@ -266,7 +265,7 @@ const char *months[] = connection. I believe login should open the line in the non-blocking mode leaving the decision to make a connection to getty (where it actually belongs). */ -void +static void opentty(const char * tty) { int i; @@ -313,11 +312,7 @@ main(int argc, char **argv) int quietlog, passwd_req; char *domain, *ttyn; char tbuf[MAXPATHLEN + 2], tname[sizeof(_PATH_TTY) + 10]; - char *ctime(), *ttyname(), *stypeof(); - time_t time(); - void timedout(); char *termenv; - char vcsn[20], vcsan[20]; char * childArgv[10]; char * buff; int childArgc = 0; @@ -329,6 +324,9 @@ main(int argc, char **argv) #else char *salt, *pp; #endif +#ifdef CHOWNVCS + char vcsn[20], vcsan[20]; +#endif #ifndef __linux__ int ioctlval; #endif @@ -446,6 +444,7 @@ main(int argc, char **argv) ttyn = tname; } +#ifdef CHOWNVCS /* find names of Virtual Console devices, for later mode change */ { char *p = ttyn; @@ -455,6 +454,7 @@ main(int argc, char **argv) strcpy(vcsn, "/dev/vcs"); strcat(vcsn, p); strcpy(vcsan, "/dev/vcsa"); strcat(vcsan, p); } +#endif setpgrp(); @@ -464,8 +464,8 @@ main(int argc, char **argv) tcgetattr(0, &tt); ttt = tt; ttt.c_cflag &= ~HUPCL; - - if((chown(ttyn, 0, 0) == 0) && (chmod(ttyn, 0622) == 0)) { + + if((chown(ttyn, 0, 0) == 0) && (chmod(ttyn, TTY_MODE) == 0)) { tcsetattr(0,TCSAFLUSH,&ttt); signal(SIGHUP, SIG_IGN); /* so vhangup() wont kill us */ vhangup(); @@ -816,8 +816,8 @@ main(int argc, char **argv) else if (tp.tv_sec - pwd->pw_change < TWOWEEKS && !quietlog) { struct tm *ttp; ttp = localtime(&pwd->pw_change); - printf(_("Warning: your password expires on %s %d, %d\n"), - months[ttp->tm_mon], ttp->tm_mday, + printf(_("Warning: your password expires on %d %s %d.\n"), + ttp->tm_mday, months[ttp->tm_mon], TM_YEAR_BASE + ttp->tm_year); } } @@ -830,8 +830,8 @@ main(int argc, char **argv) else if (tp.tv_sec - pwd->pw_expire < TWOWEEKS && !quietlog) { struct tm *ttp; ttp = localtime(&pwd->pw_expire); - printf(_("Warning: your account expires on %s %d, %d\n"), - months[ttp->tm_mon], ttp->tm_mday, + printf(_("Warning: your account expires on %d %s %d.\n"), + ttp->tm_mday, months[ttp->tm_mon], TM_YEAR_BASE + ttp->tm_year); } } @@ -970,6 +970,7 @@ Michael Riepe (gr = getgrnam(TTYGRPNAME)) ? gr->gr_gid : pwd->pw_gid); chmod(ttyn, TTY_MODE); +#ifdef CHOWNVCS /* if tty is one of the VC's then change owner and mode of the special /dev/vcs devices as well */ if (consoletty(0)) { @@ -978,6 +979,7 @@ Michael Riepe chmod(vcsn, TTY_MODE); chmod(vcsan, TTY_MODE); } +#endif setgid(pwd->pw_gid); @@ -1184,12 +1186,10 @@ Michael Riepe } void -getloginname() -{ - register int ch; - register char *p; +getloginname(void) { + int ch, cnt, cnt2; + char *p; static char nbuf[UT_NAMESIZE + 1]; - int cnt, cnt2; cnt2 = 0; for (;;) { @@ -1231,8 +1231,7 @@ getloginname() } void -timedout() -{ +timedout(int sig) { struct termio ti; fprintf(stderr, _("Login timed out after %d seconds\n"), timeout); @@ -1245,8 +1244,7 @@ timedout() } int -rootterm(ttyn) - char *ttyn; +rootterm(char * ttyn) #ifndef __linux__ { struct ttyent *t; @@ -1286,10 +1284,9 @@ rootterm(ttyn) jmp_buf motdinterrupt; void -motd() -{ - register int fd, nchars; - void (*oldint)(), sigint(); +motd(void) { + int fd, nchars; + void (*oldint)(int); char tbuf[8192]; if ((fd = open(_PATH_MOTDFILE, O_RDONLY, 0)) < 0) @@ -1303,15 +1300,13 @@ motd() } void -sigint() -{ +sigint(int sig) { longjmp(motdinterrupt, 1); } #ifndef USE_PAM /* PAM takes care of this */ void -checknologin() -{ +checknologin(void) { register int fd, nchars; char tbuf[8192]; @@ -1324,9 +1319,7 @@ checknologin() #endif void -dolastlog(quiet) - int quiet; -{ +dolastlog(int quiet) { struct lastlog ll; int fd; @@ -1385,9 +1378,7 @@ badlogin(const char *name) #ifndef __linux__ char * -stypeof(ttyid) - char *ttyid; -{ +stypeof(char *ttyid) { struct ttyent *t; return(ttyid && (t = getttynam(ttyid)) ? t->ty_type : UNKNOWN); @@ -1396,9 +1387,7 @@ stypeof(ttyid) /* should not be called from PAM code... Why? */ void -sleepexit(eval) - int eval; -{ +sleepexit(int eval) { sleep(SLEEP_EXIT_TIMEOUT); exit(eval); } diff --git a/login-utils/login.h b/login-utils/login.h new file mode 100644 index 0000000000..14b698e320 --- /dev/null +++ b/login-utils/login.h @@ -0,0 +1,8 @@ +/* defined in login.c */ +extern void badlogin(const char *s); +extern void sleepexit(int); +extern struct hostent hostaddress; +extern char *hostname; + +/* defined in checktty.c */ +extern void checktty(const char *user, const char *tty, struct passwd *pwd); diff --git a/login-utils/newgrp.c b/login-utils/newgrp.c index 1f8be95f22..ade173e538 100644 --- a/login-utils/newgrp.c +++ b/login-utils/newgrp.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "pathnames.h" #include "my_crypt.h" diff --git a/login-utils/passwd.c b/login-utils/passwd.c index ba679cd239..6741ee210a 100644 --- a/login-utils/passwd.c +++ b/login-utils/passwd.c @@ -64,7 +64,10 @@ #include #include #include +#include #include "my_crypt.h" +#include "setpwnam.h" +#include "islocal.h" #include "nls.h" #include "env.h" @@ -79,9 +82,6 @@ #include #endif /* LOGALL */ -extern int is_local(char *); /* islocal.c */ -extern int setpwnam(struct passwd *); /* setpwnam.c */ - #define ascii_to_bin(c) ((c)>='a'?(c-59):(c)>='A'?((c)-53):(c)-'.') #define bin_to_ascii(c) ((c)>=38?((c)-38+'a'):(c)>=12?((c)-12+'A'):(c)+'.') @@ -104,9 +104,8 @@ pexit(char *str, ...) * This would probably be the best place for checking against * dictionaries. :-) */ - -int check_passwd_string(char *passwd, char *string) -{ +static int +check_passwd_string(char *passwd, char *string) { int r; char *p, *q; @@ -152,8 +151,8 @@ int check_passwd_string(char *passwd, char *string) return 1; } -int check_passwd(char *passwd, char *oldpasswd, char *user, char *gecos) -{ +static int +check_passwd(char *passwd, char *oldpasswd, char *user, char *gecos) { int ucase, lcase, digit, other; char *c, *g, *p; @@ -216,17 +215,16 @@ int check_passwd(char *passwd, char *oldpasswd, char *user, char *gecos) return 1; /* fine */ } -void usage() -{ +#if 0 +static void +usage(void) { printf (_("Usage: passwd [username [password]]\n")); printf(_("Only root may use the one and two argument forms.\n")); } +#endif int -main(argc, argv) - int argc; - char *argv[]; -{ +main(int argc, char *argv[]) { struct passwd *pe; uid_t gotuid = getuid(); char *pwdstr = NULL, *cryptstr, *oldstr; diff --git a/login-utils/setpwnam.c b/login-utils/setpwnam.c index 8631e7adc6..62d47a51c7 100644 --- a/login-utils/setpwnam.c +++ b/login-utils/setpwnam.c @@ -64,6 +64,11 @@ #include "setpwnam.h" +#define false 0 +#define true 1 + +typedef int boolean; + static void pw_init(void); /* diff --git a/login-utils/setpwnam.h b/login-utils/setpwnam.h index b4790f7abb..84d1c208f1 100644 --- a/login-utils/setpwnam.h +++ b/login-utils/setpwnam.h @@ -14,11 +14,6 @@ #include "pathnames.h" -#define false 0 -#define true 1 - -typedef int boolean; - #ifndef DEBUG #define PASSWD_FILE _PATH_PASSWD #define PTMP_FILE _PATH_PTMP @@ -36,3 +31,5 @@ typedef int boolean; #define GTMP_FILE "/tmp/gtmp" #define GTMPTMP_FILE "/tmp/gtmptmp" #endif + +extern int setpwnam (struct passwd *pwd); diff --git a/login-utils/shutdown.c b/login-utils/shutdown.c index e3ec93c1ec..d1034d5eb9 100644 --- a/login-utils/shutdown.c +++ b/login-utils/shutdown.c @@ -33,6 +33,19 @@ * * 2000-03-02 Richard Gooch * - pause forever if (pid == 1) and send SIGQUIT to pid = 1 + * + * 2000-11-04 Richard Gooch + * - continue reaping if (pid == 1) + * + * 2000-11-06 Richard Gooch + * - shut down "finalprog" from /etc/inittab + * - kill normal user (non-root and non-daemon) processes first with SIGTERM + * + * 2000-11-08 Richard Gooch + * - rollback services + * - do not unmount devfs (otherwise get harmless but annoying messages) + * - created syncwait() for faster shutting down + * - kill getty processes */ #include @@ -52,13 +65,22 @@ #include #include #include +#include +#include +#include +#include #include "linux_reboot.h" #include "pathnames.h" #include "nls.h" -static void usage(), int_handler(), write_user(struct utmp *); -static void wall(), write_wtmp(), unmount_disks(), unmount_disks_ourselves(); -static void swap_off(), do_halt(char *); +static void usage(void), int_handler(int), write_user(struct utmp *); +static void wall(void), write_wtmp(void), unmount_disks(void); +static void unmount_disks_ourselves(void); +static void swap_off(void), do_halt(char *); +static void kill_mortals (int sig); +static void stop_finalprog (void); +static void syncwait (int timeval); + char *prog; /* name of the program */ int opt_reboot; /* true if -r option or reboot command */ @@ -81,14 +103,14 @@ char halt_action[256]; /* to find out what to do upon halt */ void -usage() +usage(void) { fprintf(stderr, _("Usage: shutdown [-h|-r] [-fqs] [now|hh:ss|+mins]\n")); exit(1); } -void +static void my_puts(char *s) { /* Use a fresh stdout after forking */ @@ -98,7 +120,7 @@ my_puts(char *s) } void -int_handler() +int_handler(int sig) { unlink(_PATH_NOLOGIN); signal(SIGINT, SIG_DFL); @@ -106,7 +128,7 @@ int_handler() exit(1); } -int +static int iswhitespace(int a) { return (a == ' ' || a == '\t'); } @@ -120,14 +142,14 @@ main(int argc, char *argv[]) if (getpid () == 1) { for (i = 0; i < getdtablesize (); i++) close (i); - while (1) pause (); + while (1) wait (NULL); /* Grim reaper never stops */ } setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); #ifndef DEBUGGING - if(geteuid()) { + if(setreuid (0, 0)) { fprintf(stderr, _("%s: Only root can shut a system down.\n"), argv[0]); exit(1); @@ -350,6 +372,15 @@ main(int argc, char *argv[]) #ifndef DEBUGGING /* a gentle kill of all other processes except init */ + kill_mortals (SIGTERM); + stop_finalprog (); + sleep (1); /* Time for saves to start */ + kill (1, SIGTERM); /* Tell init to kill spawned gettys */ + usleep (100000); /* Wait for gettys to die */ + my_puts (""); /* Get past the login prompt */ + system ("/sbin/initctl -r"); /* Roll back services */ + syncwait (1); + my_puts ("Sending SIGTERM to all remaining processes..."); kill(-1, SIGTERM); sleep(2); /* default 2, some people need 5 */ @@ -371,17 +402,16 @@ main(int argc, char *argv[]) required. Need to sleep before remounting root read-only */ kill (1, SIGQUIT); - sync(); - sleep(2); + sleep (1); /* Time for processes to die and close files */ + syncwait (2); /* remove swap files and partitions using swapoff */ swap_off(); /* unmount disks... */ unmount_disks(); - sync(); - sleep(1); - + syncwait (1); + if(opt_reboot) { my_reboot(LINUX_REBOOT_CMD_RESTART); /* RB_AUTOBOOT */ my_puts(_("\nWhy am I still alive after reboot?")); @@ -390,6 +420,7 @@ main(int argc, char *argv[]) /* allow C-A-D now, faith@cs.unc.edu, re-fixed 8-Jul-96 */ my_reboot(LINUX_REBOOT_CMD_CAD_ON); /* RB_ENABLE_CAD */ + sleep (1); /* Wait for devices to finish writing to media */ do_halt(halt_action); } /* NOTREACHED */ @@ -432,6 +463,9 @@ write_user(struct utmp *ut) char msg[100]; minutes = timeout / 60; + hours = minutes / 60; + minutes %= 60; + (void) strncat(term, ut->ut_line, sizeof(ut->ut_line)); /* try not to get stuck on a mangled ut_line entry... */ @@ -443,16 +477,20 @@ write_user(struct utmp *ut) WR(msg); WRCRLF; - if(minutes == 0) { - sprintf(msg, _("System going down IMMEDIATELY!\n")); - } else if(minutes > 60) { - hours = minutes / 60; - sprintf(msg, _("System going down in %d hour%s %d minutes"), - hours, hours == 1 ? "" : _("s"), minutes - 60*hours); - } else { - sprintf(msg, _("System going down in %d minute%s\n"), - minutes, minutes == 1 ? "" : _("s")); - } + if (hours > 1) + sprintf(msg, _("System going down in %d hours %d minutes"), + hours, minutes); + else if (hours == 1) + sprintf(msg, _("System going down in 1 hour %d minutes"), + minutes); + else if (minutes > 1) + sprintf(msg, _("System going down in %d minutes\n"), + minutes); + else if (minutes == 1) + sprintf(msg, _("System going down in 1 minute\n")); + else + sprintf(msg, _("System going down IMMEDIATELY!\n")); + WR(msg); WRCRLF; @@ -464,7 +502,7 @@ write_user(struct utmp *ut) } void -wall() +wall(void) { /* write to all users, that the system is going down. */ struct utmp *ut; @@ -480,7 +518,7 @@ wall() } void -write_wtmp() +write_wtmp(void) { /* write in wtmp that we are dying */ int fd; @@ -500,7 +538,7 @@ write_wtmp() } void -swap_off() +swap_off(void) { /* swapoff esp. swap FILES so the underlying partition can be unmounted. It you don't have swapoff(1) or use mount to @@ -530,7 +568,7 @@ swap_off() } void -unmount_disks() +unmount_disks(void) { /* better to use umount directly because it may be smarter than us */ @@ -563,7 +601,7 @@ unmount_disks() } void -unmount_disks_ourselves() +unmount_disks_ourselves(void) { /* unmount all disks */ @@ -581,8 +619,8 @@ unmount_disks_ourselves() } n = 0; while (n < 100 && (mnt = getmntent(mtab))) { - mntlist[n++] = strdup(mnt->mnt_fsname[0] == '/' ? - mnt->mnt_fsname : mnt->mnt_dir); + if (strcmp (mnt->mnt_type, "devfs") == 0) continue; + mntlist[n++] = strdup(mnt->mnt_dir); } endmntent(mtab); @@ -594,7 +632,96 @@ unmount_disks_ourselves() printf("umount %s\n", filesys); #else if (umount(mntlist[i]) < 0) - printf(_("shutdown: Couldn't umount %s\n"), filesys); + printf(_("shutdown: Couldn't umount %s: %s\n"), + filesys, ERRSTRING); #endif } } + +static void kill_mortals (int sig) +{ + int npids = 0; + int index = 0; + int pid; + struct stat statbuf; + DIR *dp; + struct dirent *de; + pid_t *pids = NULL; + char path[256]; + + if ( ( dp = opendir ("/proc") ) == NULL ) return; + while ( ( de = readdir (dp) ) != NULL ) + { + if ( !isdigit (de->d_name[0]) ) continue; + pid = atoi (de->d_name); + sprintf (path, "/proc/%d", pid); + if (stat (path, &statbuf) != 0) continue; + if (statbuf.st_uid < 100) continue; + if (index <= npids) + { + pids = realloc (pids, npids + 16384); + if (pids == NULL) return; + npids += 16384; + } + pids[index++] = pid; + } + fputs ("Sending SIGTERM to mortals...", stderr); + for (--index; index >= 0; --index) kill (pids[index], sig); + free (pids); + closedir (dp); +} /* End Function kill_mortals */ + +static void stop_finalprog (void) +{ + char *p1, *p2; + FILE *fp; + char line[256]; + + if ( ( fp = fopen (_PATH_INITTAB, "r") ) == NULL ) return; + while (fgets (line, 256, fp) != NULL) + { + pid_t pid; + + line[strlen (line) - 1] = '\0'; + p1 = line; + while ( isspace (*p1) ) ++p1; + if (strncmp (p1, "finalprog", 9) != 0) continue; + if ( ( p1 = strchr (p1 + 9, '=') ) == NULL ) continue; + for (++p1; isspace (*p1); ++p1); + if (*p1 == '\0') continue; + for (p2 = p1; !isspace (*p2); ++p2); + *p2 = '\0'; + switch ( pid = fork () ) + { + case 0: /* Child */ + execl (p1, p1, "stop", NULL); + break; + case -1: /* Error */ + break; + default: /* Parent */ + waitpid (pid, NULL, 0); + break; + } + fclose (fp); + return; + } + fclose (fp); +} /* End Function stop_finalprog */ + +static void syncwait (int timeval) +{ + static int do_wait = 0; + static int first_time = 1; + + sync (); + /* Kernel version 1.3.20 and after are supposed to wait automatically */ + if (first_time) + { + struct utsname uts; + + first_time = 0; + uname (&uts); + if (uts.release[0] < '2') do_wait = 1; + } + if (do_wait) sleep (timeval); +} /* End Function syncwait */ diff --git a/login-utils/simpleinit.8 b/login-utils/simpleinit.8 index 2a2f666ed9..f367f2f63d 100644 --- a/login-utils/simpleinit.8 +++ b/login-utils/simpleinit.8 @@ -1,7 +1,7 @@ .\" Copyright 1992, 1993 Rickard E. Faith (faith@cs.unc.edu) .\" May be distributed under the GNU General Public License .\" " for emacs's hilit19 mode :-) -.TH SIMPLEINIT 8 "20 November 1993" "Linux 0.99" "Linux Programmer's Manual" +.TH SIMPLEINIT 8 "4 November 2000" "Linux 0.99" "Linux Programmer's Manual" .SH NAME simpleinit \- process control initialization .SH SYNOPSIS @@ -33,7 +33,9 @@ After single user mode is terminated, the .I /etc/rc file is executed, and the information in .I /etc/inittab -will be used to start processes. +will be used to start processes. Alternatively, the \fI/etc/inittab\fP +file may be configured to run a different boot script. See below for +details. .SH "THE INITTAB FILE" Because of the number of init programs which are appearing in the Linux @@ -52,16 +54,21 @@ The format is .B PATH=search path +.B INIT_PATH=search path + .B "ttyline:termcap-entry:getty-command" + +.B finalprog=path .RE An example is as follows: .nf .RS -bootprog = rc -fileprefix = /sbin/ -PATH = /sbin:/bin +bootprog = +fileprefix = /sbin/init.d/ +PATH = /usr/sbin:/usr/bin:/sbin:/bin +INIT_PATH = /sbin/init.d tty1:linux:/sbin/getty 9600 tty1 tty2:linux:/sbin/getty 9600 tty2 @@ -70,6 +77,8 @@ tty4:linux:/sbin/getty 9600 tty4 # tty5:linux:/sbin/getty 9600 tty5 # ttyS1:dumb:/sbin/getty 9600 ttyS1 # ttyS2:dumb:/sbin/getty -m -t60 2400 ttyS2 + +finalprog = /sbin/rc.xdm .RE .fi @@ -79,6 +88,26 @@ character are treated as comments. Please see documentation for the .B getty (8) command that you are using, since there are several of these in the Linux community at this time. + +The \fBbootprog\fP value is appended to the \fBfileprefix\fP value, +and the result specifies the boot programme (script) to run. If +unspecified, the default is \fI/etc/rc\fP. If the boot programme is a +directory, then all scripts in that directory tree are executed, in +parallel. See the \fBneed\fP(8) programme for details on how to +elegantly control order of execution and manage dependencies. + +The \fBPATH\fP value is assigned to the PATH environment variable of +child processes (boot scripts). The \fBINIT_PATH\fP value is used by +simpleinit(8) itself to find the location of scripts to run (if an +absolute path is not given). If unset the default value \fBPATH\fP is +used. This separation allows boot scripts to invoke programmes of the +same name without conflict and without needing to specify absolute +paths. + +The \fBfinalprog\fP value specifies the path of the programme to run +after all \fBgetty\fP(8) instances are spawned. At bootup, it is +passed a single argument: "start". At shutdown, it is called again, +this time with the argument: "stop". .SH SIGNALS \fBsimpleinit\fP(8) responds to signals in a variety of ways: .TP @@ -121,7 +150,8 @@ remount (read-only) the root filesystem, even if the old inode for the .BR termcap (5), .BR getty (8), .BR agetty (8), -.BR shutdown (8) +.BR shutdown (8), +.BR need (8) .SH BUGS This program is called .B simpleinit @@ -135,4 +165,7 @@ for correct functionality. Peter Orbaek (poe@daimi.aau.dk) .br Version 1.20, with patches for singleuser mode by Werner Almesberger - +.br +Richard Gooch +.br +Dependency support diff --git a/login-utils/simpleinit.c b/login-utils/simpleinit.c index 1baf50cd76..9c4b63a5f7 100644 --- a/login-utils/simpleinit.c +++ b/login-utils/simpleinit.c @@ -64,8 +64,10 @@ struct initline { struct initline inittab[NUMCMD]; int numcmd; int stopped = 0; /* are we stopped */ -static char boot_script[PATH_SIZE] = _PATH_RC; +static char boot_prog[PATH_SIZE] = _PATH_RC; static char script_prefix[PATH_SIZE] = "\0"; +static char final_prog[PATH_SIZE] = "\0"; +static char init_path[PATH_SIZE] = "\0"; static int caught_sigint = 0; static const char *initctl_name = "/dev/initctl"; static int initctl_fd = -1; @@ -73,23 +75,27 @@ static volatile int do_longjmp = 0; static sigjmp_buf jmp_env; -static void do_single (); +static void do_single (void); static int do_rc_tty (const char *path); static int process_path ( const char *path, int (*func) (const char *path) ); static int preload_file (const char *path); static int run_file (const char *path); -void spawn(), hup_handler(), read_inittab(); -void tstp_handler (); -void int_handler (); +static void spawn (int i), read_inittab (void); +static void hup_handler (int sig); +static void sigtstp_handler (int sig); +static void int_handler (int sig); static void sigchild_handler (int sig); static void sigquit_handler (int sig); -void set_tz(), write_wtmp(); -static pid_t mywaitpid (pid_t pid, int *status, int *rc_status); -static int run_command (const char *path, const char *name, pid_t pid); -static void forget_those_not_present (); +static void sigterm_handler (int sig); +#ifdef SET_TZ +static void set_tz (void); +#endif +static void write_wtmp (void); +static pid_t mywaitpid (pid_t pid, int *status); +static int run_command (const char *file, const char *name, pid_t pid); -void err(char *s) +static void err (char *s) { int fd; @@ -100,8 +106,7 @@ void err(char *s) close(fd); } -void -enter_single() +static void enter_single (void) { pid_t pid; int i; @@ -130,10 +135,13 @@ int main(int argc, char *argv[]) #ifdef SET_TZ set_tz(); #endif + signal (SIGINT, int_handler); sigemptyset (&sa.sa_mask); sa.sa_flags = 0; - signal (SIGTSTP, tstp_handler); - signal (SIGINT, int_handler); + sa.sa_handler = sigtstp_handler; + sigaction (SIGTSTP, &sa, NULL); + sa.sa_handler = sigterm_handler; + sigaction (SIGTERM, &sa, NULL); sa.sa_handler = sigchild_handler; sigaction (SIGCHLD, &sa, NULL); sa.sa_handler = sigquit_handler; @@ -156,7 +164,7 @@ int main(int argc, char *argv[]) strcpy (path, script_prefix); strcat (path, argv[i]); if (access (path, R_OK | X_OK) == 0) - strcpy (boot_script, path); + strcpy (boot_prog, path); } } @@ -172,7 +180,7 @@ int main(int argc, char *argv[]) while(stopped) pause(); - if ( do_rc_tty (boot_script) ) do_single (); + if ( do_rc_tty (boot_prog) ) do_single (); while(stopped) /*Also if /etc/rc fails & we get SIGTSTP*/ pause(); @@ -195,10 +203,26 @@ int main(int argc, char *argv[]) for(i = 0; i < numcmd; i++) spawn(i); - + + if (final_prog[0] != '\0') { + switch ( fork () ) + { + case 0: /* Child */ + execl (final_prog, final_prog, "start", NULL); + err ( _("error running finalprog\n") ); + _exit (1); + break; + case -1: /* Error */ + err ( _("error forking finalprog\n") ); + break; + default: /* Parent */ + break; + } + } + for ever { - pid = mywaitpid (-1, &vec, NULL); - if (pid == 0) continue; + pid = mywaitpid (-1, &vec); + if (pid < 1) continue; /* clear utmp entry, and append to wtmp if possible */ { @@ -249,7 +273,7 @@ int main(int argc, char *argv[]) * return true if singleuser mode is allowed. * If /etc/securesingle exists ask for root password, otherwise always OK. */ -static int check_single_ok () +static int check_single_ok (void) { char *pass, *rootpass = NULL; struct passwd *pwd; @@ -273,7 +297,7 @@ static int check_single_ok () return 0; } -static void do_single () +static void do_single (void) { char path[PATH_SIZE]; @@ -293,15 +317,15 @@ static void do_single () */ static int do_rc_tty (const char *path) { - int status, rc_status = 0; - pid_t pid; + int status; + pid_t pid, child; sigset_t ss; if (caught_sigint) return 0; process_path (path, preload_file); /* Launch off a subprocess to start a new session (required for frobbing the TTY) and capture control-C */ - switch ( pid = fork () ) + switch ( child = fork () ) { case 0: /* Child */ for (status = 1; status < NSIG; status++) signal (status, SIG_DFL); @@ -312,7 +336,7 @@ static int do_rc_tty (const char *path) setsid (); ioctl (0, TIOCSCTTY, 0); /* I want my control-C */ sigsuspend (&ss); /* Should never return, should just be killed */ - break; /* No-one is controlled by this TTY now */ + break; /* No-one else is controlled by this TTY now */ case -1: /* Error */ return (1); /*break;*/ @@ -321,13 +345,15 @@ static int do_rc_tty (const char *path) } /* Parent */ process_path (path, run_file); - while (rc_status == 0) - if (mywaitpid (-1, &status, &rc_status) == pid) + while (1) + { + if ( ( pid = mywaitpid (-1, &status) ) == child ) return (WTERMSIG (status) == SIGINT) ? 0 : 1; - forget_those_not_present (); - kill (pid, SIGKILL); - while (waitpid (pid, NULL, 0) != pid) /* Nothing */; - return (rc_status < 0) ? 1 : 0; + if (pid < 0) break; + } + kill (child, SIGKILL); + while (waitpid (child, NULL, 0) != child) /* Nothing */; + return 0; } /* End Function do_rc_tty */ static int process_path ( const char *path, int (*func) (const char *path) ) @@ -368,7 +394,7 @@ static int preload_file (const char *path) char ch; if ( ( fd = open (path, O_RDONLY, 0) ) < 0) return 0; - while (read (fd, &ch, 1) == 1) lseek (fd, 1023, SEEK_CUR); + while (read (fd, &ch, 1) == 1) lseek (fd, 1024, SEEK_CUR); close (fd); return 0; } /* End Function preload_file */ @@ -380,9 +406,9 @@ static int run_file (const char *path) if ( ( ptr = strrchr ( (char *) path, '/' ) ) == NULL ) ptr = path; else ++ptr; return (run_command (path, ptr, 0) == SIG_FAILED) ? 1 : 0; -} /* End Function preload_file */ +} /* End Function run_file */ -void spawn(int i) +static void spawn (int i) { pid_t pid; int j; @@ -419,6 +445,7 @@ void spawn(int i) /* this is the parent */ inittab[i].pid = pid; inittab[i].last_start = ct; + sched_yield (); return; } else { /* this is the child */ @@ -448,7 +475,7 @@ void spawn(int i) } } -void read_inittab() +static void read_inittab (void) { FILE *f; char buf[CMDSIZ]; @@ -460,7 +487,7 @@ void read_inittab() char tty[50]; struct stat stb; #endif - char *termenv, *getenv(); + char *termenv; termenv = getenv("TERM"); /* set by kernel */ /* termenv = "vt100"; */ @@ -502,6 +529,16 @@ void read_inittab() setenv ("PATH", ptr, 1); continue; } + if ( !strncmp (buf, "INIT_PATH", 9) ) { + while ( isspace (*ptr) ) ++ptr; + strcpy (init_path, ptr); + continue; + } + if ( !strncmp (buf, "finalprog", 8) ) { + while ( isspace (*ptr) ) ++ptr; + strcpy (final_prog, ptr); + continue; + } } @@ -549,11 +586,11 @@ void read_inittab() len = strlen (path); if (path[len - 1] == '/') path[len - 1] = '\0'; if (access (path, R_OK | X_OK) == 0) - strcpy (boot_script, path); + strcpy (boot_prog, path); } } -void hup_handler() +static void hup_handler (int sig) { int i,j; int oldnum; @@ -564,7 +601,7 @@ void hup_handler() memcpy(savetab, inittab, NUMCMD * sizeof(struct initline)); oldnum = numcmd; - read_inittab(); + read_inittab (); for(i = 0; i < numcmd; i++) { had_already = 0; @@ -581,15 +618,21 @@ void hup_handler() (void) signal(SIGHUP, hup_handler); } -void tstp_handler() +static void sigtstp_handler (int sig) { - stopped = ~stopped; - if(!stopped) hup_handler(); + stopped = ~stopped; + if (!stopped) hup_handler (sig); +} /* End Function sigtstp_handler */ - signal(SIGTSTP, tstp_handler); -} +static void sigterm_handler (int sig) +{ + int i; + + for (i = 0; i < numcmd; i++) + if (inittab[i].pid > 0) kill (inittab[i].pid, SIGTERM); +} /* End Function sigterm_handler */ -void int_handler() +static void int_handler (int sig) { pid_t pid; @@ -617,7 +660,8 @@ static void sigquit_handler (int sig) execl (_PATH_REBOOT, _PATH_REBOOT, NULL); /* It knows pid=1 must sleep */ } -void set_tz() +#ifdef SET_TZ +static void set_tz (void) { FILE *f; int len; @@ -629,8 +673,9 @@ void set_tz() tzone[len-1] = 0; /* get rid of the '\n' */ setenv("TZ", tzone, 0); } +#endif -void write_wtmp() +static void write_wtmp (void) { int fd, lf; struct utmp ut; @@ -653,44 +698,66 @@ void write_wtmp() } -struct waiter_struct +struct needer_struct { - struct waiter_struct *next; + struct needer_struct *next; pid_t pid; }; +struct service_struct +{ + struct service_struct *prev, *next; /* Script services chain */ + struct needer_struct *needers; /* Needers waiting for service */ + struct script_struct *attempting_providers; + int failed; /* TRUE if attempting provider failed badly */ + char name[1]; +}; + struct script_struct { pid_t pid; - struct script_struct *prev, *next; - struct waiter_struct *first_waiter; - char name[1]; + struct script_struct *prev, *next; /* For the list */ + struct service_struct *first_service, *last_service; /*First is true name*/ + struct script_struct *next_attempting_provider; /* Provider chain */ }; struct list_head { struct script_struct *first, *last; + unsigned int num_entries; }; -static struct list_head available_list = {NULL, NULL}; -static struct list_head starting_list = {NULL, NULL}; -static struct list_head failed_list = {NULL, NULL}; -static struct list_head unavailable_list = {NULL, NULL}; +static struct list_head available_list = {NULL, NULL, 0}; +static struct list_head starting_list = {NULL, NULL, 0}; +static struct service_struct *unavailable_services = NULL; /* For needers */ +static int num_needers = 0; -static void process_pidstat (pid_t pid, int status, int *rc_status); -static struct script_struct *find_script (const char *name, - struct list_head *head); +static int process_pidstat (pid_t pid, int status); +static void process_command (const struct command_struct *command); +static struct service_struct *find_service_in_list (const char *name, + struct service_struct *sv); +static struct script_struct *find_script_byname + (const char *name,struct list_head *head, struct service_struct **service); +static struct script_struct *find_script_bypid (pid_t pid, + struct list_head *head); static void insert_entry (struct list_head *head, struct script_struct *entry); static void remove_entry (struct list_head *head, struct script_struct *entry); -static void signal_waiters (struct script_struct *script, int sig); - - -static pid_t mywaitpid (pid_t pid, int *status, int *rc_status) +static void signal_needers (struct service_struct *service, int sig); +static void handle_nonworking (struct script_struct *script); +static int force_progress (void); +static void show_scripts (FILE *fp, const struct script_struct *script, + const char *type); +static const char *get_path (const char *file); + + +static pid_t mywaitpid (pid_t pid, int *status) +/* [RETURNS] The pid for a process to be reaped, 0 if no process is to be + reaped, and less than 0 if the boot scripts appear to have finished. +*/ { int ival; - struct script_struct *script; sigset_t ss_new, ss_old; long buffer[COMMAND_SIZE / sizeof (long)]; struct command_struct *command = (struct command_struct *) buffer; @@ -699,8 +766,7 @@ static pid_t mywaitpid (pid_t pid, int *status, int *rc_status) if (status == NULL) status = &ival; if ( ( pid = waitpid (pid, status, WNOHANG) ) > 0 ) { - process_pidstat (pid, *status, rc_status); - return pid; + return process_pidstat (pid, *status); } /* Some magic to avoid races */ command->command = -1; @@ -717,23 +783,76 @@ static pid_t mywaitpid (pid_t pid, int *status, int *rc_status) } if (command->command < 0) read (initctl_fd, buffer, COMMAND_SIZE); do_longjmp = 0; + process_command (command); + return 0; +} /* End Function mywaitpid */ + +static pid_t process_pidstat (pid_t pid, int status) +/* [RETURNS] The pid for a process to be reaped, 0 if no process is to be + reaped, and less than 0 if the boot scripts appear to have finished. +*/ +{ + int failed; + struct script_struct *script; + struct service_struct *service; + + if ( ( script = find_script_bypid (pid, &starting_list) ) == NULL ) + return pid; + remove_entry (&starting_list, script); + if ( WIFEXITED (status) && (WEXITSTATUS (status) == 0) ) + { + struct script_struct *provider; + + /* Notify needers and other providers */ + for (service = script->first_service; service != NULL; + service = service->next) + { + signal_needers (service, SIG_PRESENT); + for (provider = service->attempting_providers; provider != NULL; + provider = provider->next_attempting_provider) + kill (provider->pid, SIG_PRESENT); + service->attempting_providers = NULL; + } + insert_entry (&available_list, script); + return force_progress (); + } + failed = ( WIFEXITED (status) && (WEXITSTATUS (status) == 2) ) ? 0 : 1; + for (service = script->first_service; service != NULL; + service = service->next) + service->failed = failed; + handle_nonworking (script); + return force_progress (); +} /* End Function process_pidstat */ + +static void process_command (const struct command_struct *command) +{ + int ival; + struct script_struct *script; + struct service_struct *service; + switch (command->command) { case COMMAND_TEST: kill (command->pid, - (find_script (command->name, &available_list) == NULL) ? + (find_script_byname (command->name, &available_list, + NULL) == NULL) ? SIG_NOT_PRESENT : SIG_PRESENT); break; case COMMAND_NEED: ival = run_command (command->name, command->name, command->pid); - if (ival != 0) kill (command->pid, ival); + if (ival == 0) + { + ++num_needers; + force_progress (); + } + else kill (command->pid, ival); break; case COMMAND_ROLLBACK: if (command->name[0] == '\0') script = NULL; else { - if ( ( script = find_script (command->name, &available_list) ) - == NULL ) + if ( ( script = find_script_byname (command->name, &available_list, + NULL) ) == NULL ) { kill (command->pid, SIG_NOT_PRESENT); break; @@ -741,7 +860,9 @@ static pid_t mywaitpid (pid_t pid, int *status, int *rc_status) } while (script != available_list.first) { + pid_t pid; struct script_struct *victim = available_list.first; + char txt[256]; if ( ( pid = fork () ) == 0 ) /* Child */ { @@ -749,7 +870,8 @@ static pid_t mywaitpid (pid_t pid, int *status, int *rc_status) open ("/dev/console", O_RDONLY, 0); open ("/dev/console", O_RDWR, 0); dup2 (1, 2); - execlp (victim->name, victim->name, "stop", NULL); + execlp (get_path (victim->first_service->name), + victim->first_service->name, "stop", NULL); err ( _("error running programme\n") ); _exit (SIG_NOT_STOPPED); } @@ -759,8 +881,11 @@ static pid_t mywaitpid (pid_t pid, int *status, int *rc_status) while (waitpid (pid, &ival, 0) != pid) /* Nothing */; if ( WIFEXITED (ival) && (WEXITSTATUS (ival) == 0) ) { + sprintf (txt, "Stopped service: %s\n", + victim->first_service->name); remove_entry (&available_list, victim); free (victim); + err (txt); } else break; } @@ -769,119 +894,187 @@ static pid_t mywaitpid (pid_t pid, int *status, int *rc_status) (script ==available_list.first) ? SIG_STOPPED : SIG_NOT_STOPPED); break; case COMMAND_DUMP_LIST: - if (fork () == 0) + if (fork () == 0) /* Do it in a child process so pid=1 doesn't block */ { FILE *fp; if ( ( fp = fopen (command->name, "w") ) == NULL ) _exit (1); - fputs ("AVAILABLE SERVICES:\n", fp); - for (script = available_list.first; script != NULL; - script = script->next) fprintf (fp, "%s\n", script->name); - fputs ("FAILED SERVICES:\n", fp); - for (script = failed_list.first; script != NULL; - script = script->next) fprintf (fp, "%s\n", script->name); + show_scripts (fp, available_list.first, "AVAILABLE"); + show_scripts (fp, starting_list.first, "STARTING"); + fputs ("UNAVAILABLE SERVICES:\n", fp); + for (service = unavailable_services; service != NULL; + service = service->next) + fprintf (fp, "%s (%s)\n", service->name, + service->failed ? "FAILED" : "not configured"); fclose (fp); _exit (0); } break; + case COMMAND_PROVIDE: + /* Sanity check */ + if ( ( script = find_script_bypid (command->ppid, &starting_list) ) + == NULL ) + { + kill (command->pid, SIG_NOT_CHILD); + break; + } + if (find_script_byname (command->name, &available_list, NULL) != NULL) + { + kill (command->pid, SIG_PRESENT); + break; + } + if (find_script_byname (command->name, &starting_list, &service) + != NULL) + { /* Someone else is trying to provide */ + script->next_attempting_provider = service->attempting_providers; + service->attempting_providers = script; + break; + } + if ( ( service = find_service_in_list (command->name, + unavailable_services) ) + == NULL ) + { /* We're the first to try and provide: create it */ + if ( ( service = + calloc (1, strlen (command->name) + sizeof *service) ) + == NULL ) + { + kill (command->pid, SIG_NOT_CHILD); + break; + } + strcpy (service->name, command->name); + } + else + { /* Orphaned service: unhook and grab it */ + if (service->prev == NULL) unavailable_services = service->next; + else service->prev->next = service->next; + if (service->next != NULL) service->next->prev = service->prev; + service->next = NULL; + } + service->prev = script->last_service; + script->last_service->next = service; + script->last_service = service; + kill (command->pid, SIG_NOT_PRESENT); + break; case -1: default: break; } - return 0; -} /* End Function mywaitpid */ - -static void process_pidstat (pid_t pid, int status, int *rc_status) -{ - struct script_struct *script; - - if (initctl_fd < 0) return; - if (pid < 1) return; - for (script = starting_list.first; script != NULL; script = script->next) - if (script->pid == pid) break; - if (script == NULL) return; - remove_entry (&starting_list, script); - if ( WIFEXITED (status) && (WEXITSTATUS (status) == 0) ) - { - signal_waiters (script, SIG_PRESENT); - insert_entry (&available_list, script); - } - else if ( WIFEXITED (status) && (WEXITSTATUS (status) == 2) ) - { - signal_waiters (script, SIG_NOT_PRESENT); - insert_entry (&unavailable_list, script); - } - else - { - signal_waiters (script, SIG_FAILED); - insert_entry (&failed_list, script); - } - if ( (rc_status == NULL) || (starting_list.first != NULL) ) return; - *rc_status = (failed_list.first == NULL) ? 1 : -1; -} /* End Function process_pidstat */ +} /* End Function process_command */ -static int run_command (const char *path, const char *name, pid_t pid) +static int run_command (const char *file, const char *name, pid_t pid) { struct script_struct *script; - struct waiter_struct *waiter = NULL; + struct needer_struct *needer = NULL; + struct service_struct *service; - if (find_script (name, &available_list) != NULL) return SIG_PRESENT; - if (find_script (name, &failed_list) != NULL) return SIG_FAILED; - if (find_script (name, &unavailable_list) != NULL) return SIG_NOT_PRESENT; + if (find_script_byname (name, &available_list, NULL) != NULL) + return SIG_PRESENT; if (pid != 0) { - waiter = calloc (1, sizeof *waiter); - if (waiter == NULL) return SIG_FAILED; - waiter->pid = pid; + needer = calloc (1, sizeof *needer); + if (needer == NULL) return SIG_FAILED; + needer->pid = pid; } - script = find_script (name, &starting_list); + script = find_script_byname (name, &starting_list, &service); + if (script == NULL) + service = find_service_in_list (name, unavailable_services); if (script == NULL) { int i; + char txt[1024]; - script = calloc (1, strlen (name) + sizeof *script); - if (script == NULL) + if ( ( script = calloc (1, sizeof *script) ) == NULL ) { - if (waiter != NULL) free (waiter); + if (needer != NULL) free (needer); return SIG_FAILED; } - strcpy (script->name, name); + if (service == NULL) + { + service = calloc (1, strlen (name) + sizeof *service); + if (service == NULL) + { + free (script); + return SIG_FAILED; + } + strcpy (service->name, name); + } + else /* Unhook service from unavailable list */ + { + if (service->prev == NULL) unavailable_services = service->next; + else service->prev->next = service->next; + if (service->next != NULL) service->next->prev = service->prev; + service->prev = NULL; + service->next = NULL; + } switch ( script->pid = fork () ) { case 0: /* Child */ for (i = 1; i < NSIG; i++) signal (i, SIG_DFL); - execlp (path, script->name, "start", NULL); - err ( _("error running programme\n") ); + execlp (get_path (file), service->name, "start", NULL); + sprintf (txt, "error running programme: \"%s\"\n", service->name); + err ( _(txt) ); _exit (SIG_FAILED); break; case -1: /* Error */ + service->next = unavailable_services; + if (unavailable_services != NULL) + unavailable_services->prev = service; + unavailable_services = service; free (script); - if (waiter != NULL) free (waiter); + if (needer != NULL) free (needer); return SIG_FAILED; /*break;*/ default: /* Parent */ + script->first_service = service; + script->last_service = service; insert_entry (&starting_list, script); sched_yield (); break; } } - if (waiter == NULL) return 0; - waiter->next = script->first_waiter; - script->first_waiter = waiter; + if (needer == NULL) return 0; + needer->next = service->needers; + service->needers = needer; return 0; } /* End Function run_command */ -static struct script_struct *find_script (const char *name, - struct list_head *head) +static struct service_struct *find_service_in_list (const char *name, + struct service_struct *sv) +{ + for (; sv != NULL; sv = sv->next) + if (strcmp (sv->name, name) == 0) return (sv); + return NULL; +} /* End Function find_service_in_list */ + +static struct script_struct *find_script_byname (const char *name, + struct list_head *head, + struct service_struct **service) { - struct script_struct *entry; + struct script_struct *script; - for (entry = head->first; entry != NULL; entry = entry->next) + for (script = head->first; script != NULL; script = script->next) { - if (strcmp (entry->name, name) == 0) return (entry); + struct service_struct *sv; + + if ( ( sv = find_service_in_list (name, script->first_service) ) + != NULL ) + { + if (service != NULL) *service = sv; + return (script); + } } return NULL; -} /* End Function find_script */ +} /* End Function find_script_byname */ + +static struct script_struct *find_script_bypid (pid_t pid, + struct list_head *head) +{ + struct script_struct *script; + + for (script = head->first; script != NULL; script = script->next) + if (script->pid == pid) return (script); + return NULL; +} /* End Function find_script_bypid */ static void insert_entry (struct list_head *head, struct script_struct *entry) { @@ -891,6 +1084,7 @@ static void insert_entry (struct list_head *head, struct script_struct *entry) if (head->first != NULL) head->first->prev = entry; head->first = entry; if (head->last == NULL) head->last = entry; + ++head->num_entries; } /* End Function insert_entry */ static void remove_entry (struct list_head *head, struct script_struct *entry) @@ -899,37 +1093,96 @@ static void remove_entry (struct list_head *head, struct script_struct *entry) else entry->prev->next = entry->next; if (entry->next == NULL) head->last = entry->prev; else entry->next->prev = entry->prev; + --head->num_entries; } /* End Function remove_entry */ -static void signal_waiters (struct script_struct *script, int sig) +static void signal_needers (struct service_struct *service, int sig) { - struct waiter_struct *waiter, *next_waiter; + struct needer_struct *needer, *next_needer; - for (waiter = script->first_waiter; waiter != NULL; waiter = next_waiter) + for (needer = service->needers; needer != NULL; needer = next_needer) { - kill (waiter->pid, sig); - next_waiter = waiter->next; - free (waiter); + kill (needer->pid, sig); + next_needer = needer->next; + free (needer); + --num_needers; } - script->first_waiter = NULL; -} /* End Function signal_waiters */ + service->needers = NULL; +} /* End Function signal_needers */ -static void forget_those_not_present () +static void handle_nonworking (struct script_struct *script) { - struct script_struct *curr, *next; + struct service_struct *service, *next; - for (curr = failed_list.first; curr != NULL; curr = next) + for (service = script->first_service; service != NULL; service = next) { - next = curr->next; - free (curr); + struct script_struct *provider = service->attempting_providers; + + next = service->next; + if (provider == NULL) + { + service->next = unavailable_services; + if (unavailable_services != NULL) + unavailable_services->prev = service; + unavailable_services = service; + continue; + } + service->attempting_providers = provider->next_attempting_provider; + provider->last_service->next = service; + service->prev = provider->last_service; + provider->last_service = service; + service->next = NULL; + kill (provider->pid, SIG_NOT_PRESENT); } - failed_list.first = NULL; - failed_list.last = NULL; - for (curr = unavailable_list.first; curr != NULL; curr = next) + free (script); +} /* End Function handle_nonworking */ + +static int force_progress (void) +/* [RETURNS] 0 if boot scripts are still running, else -1. +*/ +{ + struct service_struct *service; + + if (starting_list.num_entries > num_needers) return 0; + /* No progress can be made: signal needers */ + for (service = unavailable_services; service != NULL; + service = service->next) + signal_needers (service, + service->failed ? SIG_FAILED : SIG_NOT_PRESENT); + return (starting_list.num_entries < 1) ? -1 : 0; +} /* End Function force_progress */ + +static void show_scripts (FILE *fp, const struct script_struct *script, + const char *type) +{ + fprintf (fp, "%s SERVICES:\n", type); + for (; script != NULL; script = script->next) + { + struct service_struct *service = script->first_service; + + fputs (service->name, fp); + for (service = service->next; service != NULL; service = service->next) + fprintf (fp, " (%s)", service->name); + putc ('\n', fp); + } +} /* End Function show_scripts */ + +static const char *get_path (const char *file) +{ + char *p1, *p2; + static char path[PATH_SIZE]; + + if (file[0] == '/') return file; + if (init_path[0] == '\0') return file; + for (p1 = init_path; *p1 != '\0'; p1 = p2) { - next = curr->next; - free (curr); + if ( ( p2 = strchr (p1, ':') ) == NULL ) + p2 = p1 + strlen (p1); + strncpy (path, p1, p2 - p1); + path[p2 - p1] = '/'; + strcat (path + (p2 - p1) + 1, file); + if (*p2 == ':') ++p2; + if (access (path, X_OK) == 0) return path; } - unavailable_list.first = NULL; - unavailable_list.last = NULL; -} /* End Function forget_those_not_present */ + return file; +} /* End Function get_path */ diff --git a/login-utils/simpleinit.h b/login-utils/simpleinit.h index ff26480f72..1d8762975d 100644 --- a/login-utils/simpleinit.h +++ b/login-utils/simpleinit.h @@ -10,16 +10,19 @@ #define COMMAND_NEED 1 /* Wait, signal */ #define COMMAND_ROLLBACK 2 /* Wait, signal */ #define COMMAND_DUMP_LIST 3 /* No wait, no signal */ +#define COMMAND_PROVIDE 4 /* Wait, signal */ #define SIG_PRESENT SIGUSR1 /* Service is available */ #define SIG_STOPPED SIGUSR1 /* Service was stopped OK */ #define SIG_NOT_PRESENT SIGUSR2 /* Not present, but that's OK */ #define SIG_FAILED SIGPOLL /* Startup failed */ #define SIG_NOT_STOPPED SIGPOLL /* Failed to stop */ +#define SIG_NOT_CHILD SIGPOLL /* Not a child of init */ struct command_struct /* Must always be COMMAND_SIZE */ { signed int command; pid_t pid; + pid_t ppid; char name[1]; }; diff --git a/login-utils/ttymsg.c b/login-utils/ttymsg.c index 6bf2f82f68..b422abb859 100644 --- a/login-utils/ttymsg.c +++ b/login-utils/ttymsg.c @@ -53,9 +53,8 @@ #include #include "nls.h" -#ifdef __linux__ #include "pathnames.h" -#endif +#include "ttymsg.h" /* * Display the contents of a uio structure on a terminal. Used by wall(1), @@ -65,12 +64,7 @@ * ignored (exclusive-use, lack of permission, etc.). */ char * -ttymsg(iov, iovcnt, line, tmout) - struct iovec *iov; - int iovcnt; - char *line; - int tmout; -{ +ttymsg(struct iovec *iov, int iovcnt, char *line, int tmout) { static char device[MAXNAMLEN]; static char errbuf[MAXNAMLEN+1024]; register int cnt, fd, left, wret; diff --git a/login-utils/ttymsg.h b/login-utils/ttymsg.h new file mode 100644 index 0000000000..5d27951977 --- /dev/null +++ b/login-utils/ttymsg.h @@ -0,0 +1,2 @@ +char *ttymsg(struct iovec *iov, int iovcnt, char *line, int tmout); + diff --git a/login-utils/vipw.c b/login-utils/vipw.c index dfcdca2ed5..665d77daab 100644 --- a/login-utils/vipw.c +++ b/login-utils/vipw.c @@ -77,11 +77,9 @@ char tmptmp_file[FILENAMELEN]; /* very tmp file */ void pw_error __P((char *, int, int)); -void -copyfile(from, to) - register int from, to; -{ - register int nr, nw, off; +static void +copyfile(int from, int to) { + int nr, nw, off; char buf[8*1024]; while ((nr = read(from, buf, sizeof(buf))) > 0) @@ -94,9 +92,8 @@ copyfile(from, to) } -void -pw_init() -{ +static void +pw_init(void) { struct rlimit rlim; /* Unlimited resource limits. */ @@ -125,9 +122,8 @@ pw_init() (void)umask(0); } -int -pw_lock() -{ +static int +pw_lock(void) { int lockfd, fd, ret; /* @@ -179,9 +175,8 @@ pw_lock() return(1); } -void -pw_unlock() -{ +static void +pw_unlock(void) { char tmp[FILENAMELEN]; sprintf(tmp, "%s%s", orig_file, ".OLD"); @@ -198,9 +193,8 @@ pw_unlock() } -void -pw_edit(int notsetuid) -{ +static void +pw_edit(int notsetuid) { int pstat; pid_t pid; char *p, *editor; diff --git a/login-utils/wall.c b/login-utils/wall.c index d476edd64d..6840015d40 100644 --- a/login-utils/wall.c +++ b/login-utils/wall.c @@ -55,8 +55,11 @@ #include #include #include + #include "nls.h" +#include "ttymsg.h" #include "pathnames.h" +#include "carefulputc.h" void makemsg __P((char *)); @@ -68,17 +71,13 @@ char *mbuf; char *progname = "wall"; -/* ARGSUSED */ int -main(argc, argv) - int argc; - char **argv; -{ +main(int argc, char **argv) { extern int optind; int ch; struct iovec iov; struct utmp *utmpptr; - char *p, *ttymsg(); + char *p; char line[sizeof(utmpptr->ut_line) + 1]; setlocale(LC_ALL, ""); @@ -139,7 +138,7 @@ makemsg(fname) struct tm *lt; struct passwd *pw; struct stat sbuf; - time_t now, time(); + time_t now; FILE *fp; int fd; char *p, *whom, *where, hostname[MAXHOSTNAMELEN], @@ -184,11 +183,26 @@ makemsg(fname) } (void)fprintf(fp, "%79s\r\n", " "); - if (fname && !(freopen(fname, "r", stdin))) { - (void)fprintf(stderr, _("%s: can't read %s.\n"), progname, fname); - exit(1); + if (fname) { + /* + * When we are not root, but suid or sgid, refuse to read files + * (e.g. device files) that the user may not have access to. + * After all, our invoker can easily do "wall < file" + * instead of "wall file". + */ + int uid = getuid(); + if (uid && (uid != geteuid() || getgid() != getegid())) { + fprintf(stderr, _("%s: will not read %s - use stdin.\n"), + progname, fname); + exit(1); + } + if (!freopen(fname, "r", stdin)) { + fprintf(stderr, _("%s: can't read %s.\n"), progname, fname); + exit(1); + } } - while (fgets(lbuf, sizeof(lbuf), stdin)) + + while (fgets(lbuf, sizeof(lbuf), stdin)) { for (cnt = 0, p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) { if (cnt == 79 || ch == '\n') { for (; cnt < 79; ++cnt) @@ -197,15 +211,10 @@ makemsg(fname) putc('\n', fp); cnt = 0; } else { - /* Test for control chars added Fri Mar 10 - 19:49:30 1995, faith@cs.unc.edu */ - if (!isprint(ch) && !isspace(ch) && ch != '\007') { - putc('^', fp); - putc(ch^0x40,fp); /* DEL to ?, others to alpha */ - } else - putc(ch, fp); + carefulputc(ch, fp); } } + } (void)fprintf(fp, "%79s\r\n", " "); rewind(fp); diff --git a/misc-utils/Makefile b/misc-utils/Makefile index 088d2ccee9..5b74dd39e5 100644 --- a/misc-utils/Makefile +++ b/misc-utils/Makefile @@ -21,6 +21,8 @@ BIN= kill USRBIN= cal chkdupexe ddate logger look mcookie \ namei rename script whereis write +MAYBE= reset setterm tsort + ifeq "$(HAVE_RESET)" "no" USRBIN:=$(USRBIN) reset MAN1:=$(MAN1) reset.1 @@ -79,6 +81,8 @@ mcookie.o: mcookie.c md5.h md5.o: md5.c md5.h reset: reset.sh script: script.o +write.o: $(LIB)/carefulputc.h +write: write.o $(LIB)/carefulputc.o ifeq "$(HAVE_NCURSES)" "yes" setterm: setterm.o @@ -97,4 +101,4 @@ endif .PHONY: clean clean: - -rm -f *.o *~ core $(BIN) $(USRBIN) + -rm -f *.o *~ core $(BIN) $(USRBIN) $(MAYBE) diff --git a/misc-utils/cal.1 b/misc-utils/cal.1 index 6a5ec5ae51..9bade9d0b4 100644 --- a/misc-utils/cal.1 +++ b/misc-utils/cal.1 @@ -42,7 +42,7 @@ .Nd displays a calendar .Sh SYNOPSIS .Nm cal -.Op Fl mjy +.Op Fl mjy13 .Op Ar month Op Ar year .Sh DESCRIPTION .Nm Cal @@ -51,6 +51,12 @@ If arguments are not specified, the current month is displayed. The options are as follows: .Bl -tag -width Ds +.It Fl 1 +Display single month output (use if cal was built with -3 as default to get +older traditional output) +.It Fl 3 +Display prev/current/next month output (use if cal was built with traditional +-1 as default to get newer improved output) .It Fl m Display Monday as the first day of the week. (The default is Sunday.) diff --git a/misc-utils/cal.c b/misc-utils/cal.c index bc0c1eff57..aba1b6f061 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -39,6 +39,12 @@ * 1999-02-22 Arkadiusz Mi¶kiewicz * - added Native Language Support * + * 2000-09-01 Michael Charles Pruznick + * Added "-3" option to print prev/next month with current. + * Added over-ridable default NUM_MONTHS and "-1" option to + * get traditional output when -3 is the default. I hope that + * enough people will like -3 as the default that one day the + * product can be shipped that way. */ #include @@ -60,6 +66,15 @@ # include /* libc4 only */ #endif +/* allow compile-time define to over-ride default */ +#ifndef NUM_MONTHS +#define NUM_MONTHS 1 +#endif + +#if ( NUM_MONTHS != 1 && NUM_MONTHS !=3 ) +#error NUM_MONTHS must be 1 or 3 +#endif + #define THURSDAY 4 /* for reformation */ #define SATURDAY 6 /* 1 Jan 1 was a Saturday */ @@ -102,7 +117,7 @@ int sep1752[MAXDAYS] = { char day_headings[] = " S M Tu W Th F S "; /* week1stday = 1 => " M Tu W Th F S S " */ -char j_day_headings[] = " S M Tu W Th F S "; +char j_day_headings[] = "Sun Mon Tue Wed Thu Fri Sat "; /* week1stday = 1 => " M Tu W Th F S S " */ const char *full_month[12]; @@ -127,13 +142,22 @@ const char *full_month[12]; int week1stday; int julian; +#define FMT_ST_LINES 8 +#define FMT_ST_CHARS 300 /* 90 suffices in most locales */ +struct fmt_st +{ + char s[FMT_ST_LINES][FMT_ST_CHARS]; +}; + void ascii_day __P((char *, int)); void center __P((const char *, int, int)); void day_array __P((int, int, int *)); int day_in_week __P((int, int, int)); int day_in_year __P((int, int, int)); void j_yearly __P((int)); +void do_monthly __P((int, int, struct fmt_st*)); void monthly __P((int, int)); +void monthly3 __P((int, int)); void trim_trailing_spaces __P((char *)); void usage __P((void)); void yearly __P((int)); @@ -146,6 +170,7 @@ main(int argc, char **argv) { time_t now; int ch, month, year, yflag; char *progname, *p; + int num_months = NUM_MONTHS; progname = argv[0]; if ((p = strrchr(progname, '/')) != NULL) @@ -157,8 +182,14 @@ main(int argc, char **argv) { textdomain(PACKAGE); yflag = 0; - while ((ch = getopt(argc, argv, "mjy")) != EOF) + while ((ch = getopt(argc, argv, "13mjyV")) != EOF) switch(ch) { + case '1': + num_months = 1; + break; + case '3': + num_months = 3; + break; case 'm': week1stday = 1; break; @@ -201,8 +232,10 @@ main(int argc, char **argv) { } headers_init(); - if (month) + if (month && num_months == 1) monthly(month, year); + else if (month && num_months == 3) + monthly3(month, year); else if (julian) j_yearly(year); else @@ -233,7 +266,7 @@ void headers_init(void) for(i = 0 ; i < 7 ; i++ ) { wd = (i + week1stday) % 7; strncat(day_headings,weekday(wd),2); - strcat(j_day_headings,weekday(wd)); + strncat(j_day_headings,weekday(wd),3); if (strlen(weekday(wd)) == 2) strcat(j_day_headings," "); strcat(day_headings," "); @@ -252,24 +285,86 @@ void headers_init(void) } void -monthly(month, year) +do_monthly(month, year, out) int month, year; + struct fmt_st* out; { int col, row, len, days[MAXDAYS]; char *p, lineout[300]; day_array(month, year, days); len = sprintf(lineout, "%s %d", full_month[month - 1], year); - (void)printf("%*s%s\n%s\n", - ((julian ? J_WEEK_LEN : WEEK_LEN) - len) / 2, "", - lineout, julian ? j_day_headings : day_headings); + (void)sprintf(out->s[0],"%*s%s", + ((julian ? J_WEEK_LEN : WEEK_LEN) - len) / 2, "", lineout ); + (void)sprintf(out->s[1],"%s", + julian ? j_day_headings : day_headings); for (row = 0; row < 6; row++) { for (col = 0, p = lineout; col < 7; col++, p += julian ? J_DAY_LEN : DAY_LEN) ascii_day(p, days[row * 7 + col]); *p = '\0'; trim_trailing_spaces(lineout); - (void)printf("%s\n", lineout); + (void)sprintf(out->s[row+2],"%s", lineout); + } +} + +void +monthly(month, year) + int month, year; +{ + int i; + struct fmt_st out; + + do_monthly(month, year, &out); + for ( i = 0; i < FMT_ST_LINES; i++ ) + { + printf("%s\n", out.s[i]); + } +} + +void +monthly3(month, year) + int month, year; +{ + int i; + int width; + struct fmt_st out_prev; + struct fmt_st out_curm; + struct fmt_st out_next; + int prev_month, prev_year; + int next_month, next_year; + + if ( month == 1 ) + { + prev_month = 12; + prev_year = year - 1; + } + else + { + prev_month = month - 1; + prev_year = year; + } + if ( month == 12 ) + { + next_month = 1; + next_year = year + 1; + } + else + { + next_month = month + 1; + next_year = year; + } + + do_monthly(prev_month, prev_year, &out_prev); + do_monthly(month, year, &out_curm); + do_monthly(next_month, next_year, &out_next); + width = (julian ? J_WEEK_LEN : WEEK_LEN); + for ( i = 0; i < FMT_ST_LINES; i++ ) + { + printf("%-*.*s %-*.*s %-*.*s\n", + width, width, out_prev.s[i], + width, width, out_curm.s[i], + width, width, out_next.s[i] ); } } diff --git a/misc-utils/ddate.c b/misc-utils/ddate.c index 304c31c60b..bf7a37f281 100644 --- a/misc-utils/ddate.c +++ b/misc-utils/ddate.c @@ -153,8 +153,7 @@ struct disc_time convert(int,int); struct disc_time makeday(int,int,int); int -main (int argc, char *argv[]) -{ +main (int argc, char *argv[]) { long t; struct tm *eris; int bob,raw; diff --git a/misc-utils/logger.1 b/misc-utils/logger.1 index b5459ed4c9..2c154ec096 100644 --- a/misc-utils/logger.1 +++ b/misc-utils/logger.1 @@ -41,7 +41,7 @@ .Nd make entries in the system log .Sh SYNOPSIS .Nm logger -.Op Fl is +.Op Fl isd .Op Fl f Ar file .Op Fl p Ar pri .Op Fl t Ar tag @@ -80,11 +80,12 @@ Mark every line in the log with the specified Write to socket as specified with .Ar socket instead of builtin syslog routines. +.It Fl d +Use a datagram instead of a stream connection to this socket. .It -- End the argument list. This is to allow the .Ar message -to start with a hyphen (\-). This feature was not present in the -original BSD logger command; it is a GNU-specific extra. +to start with a hyphen (\-). .It Ar message Write the message to log; if not specified, and the .Fl f diff --git a/misc-utils/logger.c b/misc-utils/logger.c index 372fe1eced..ae0ebec00b 100644 --- a/misc-utils/logger.c +++ b/misc-utils/logger.c @@ -45,6 +45,7 @@ #include #include #include +#include #include "nls.h" #define SYSLOG_NAMES @@ -54,20 +55,27 @@ int decode __P((char *, CODE *)); int pencode __P((char *)); void usage __P((void)); +static int optd = 0; + static int myopenlog(const char *sock) { int fd; - static struct sockaddr s_addr; /* AF_UNIX address of local logger */ + static struct sockaddr_un s_addr; /* AF_UNIX address of local logger */ + + if (strlen(sock) >= sizeof(s_addr.sun_path)) { + printf ("logger: openlog: pathname too long\n"); + exit(1); + } - s_addr.sa_family = AF_UNIX; - (void)strncpy(s_addr.sa_data, sock, sizeof(s_addr.sa_data)); + s_addr.sun_family = AF_UNIX; + (void)strcpy(s_addr.sun_path, sock); - if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { + if ((fd = socket(AF_UNIX, optd ? SOCK_DGRAM : SOCK_STREAM, 0)) == -1) { printf ("socket: %s.\n", strerror(errno)); exit (1); } - if (connect(fd, &s_addr, sizeof(s_addr.sa_family)+strlen(s_addr.sa_data)) == -1) { + if (connect(fd, (struct sockaddr *) &s_addr, sizeof(s_addr)) == -1) { printf ("connect: %s.\n", strerror(errno)); exit (1); } @@ -80,7 +88,6 @@ mysyslog(int fd, int logflags, int pri, char *tag, char *msg) { time_t now; if (fd > -1) { - /* there was a gethostname call here, but its output was not used */ /* avoid snprintf - it does not exist on ancient systems */ if (logflags & LOG_PID) sprintf (pid, "[%d]", getpid()); @@ -125,7 +132,7 @@ main(int argc, char **argv) { tag = NULL; pri = LOG_NOTICE; logflags = 0; - while ((ch = getopt(argc, argv, "f:ip:st:u:")) != EOF) + while ((ch = getopt(argc, argv, "f:ip:st:u:d")) != EOF) switch((char)ch) { case 'f': /* file to log */ if (freopen(optarg, "r", stdin) == NULL) { @@ -150,6 +157,9 @@ main(int argc, char **argv) { case 'u': /* unix socket */ usock = optarg; break; + case 'd': + optd = 1; /* use datagrams */ + break; case '?': default: usage(); diff --git a/misc-utils/look.c b/misc-utils/look.c index a8e826fa48..d601e1c97f 100644 --- a/misc-utils/look.c +++ b/misc-utils/look.c @@ -137,13 +137,25 @@ main(int argc, char *argv[]) if ((fd = open(file, O_RDONLY, 0)) < 0 || fstat(fd, &sb)) err("%s: %s", file, strerror(errno)); - if ((void *)(front = mmap(NULL, - (size_t)sb.st_size, - PROT_READ, - MAP_FILE|MAP_SHARED, - fd, - (off_t)0)) <= (void *)0) + front = mmap(NULL, (size_t) sb.st_size, PROT_READ, +#ifdef MAP_FILE + MAP_FILE | +#endif + MAP_SHARED, fd, (off_t) 0); + if +#ifdef MAP_FAILED + (front == MAP_FAILED) +#else + ((void *)(front) <= (void *)0) +#endif err("%s: %s", file, strerror(errno)); + +#if 0 + /* workaround for mmap problem (rmiller@duskglow.com) */ + if (front == (void *)0) + return 1; +#endif + back = front + sb.st_size; return look(front, back); } diff --git a/misc-utils/namei.c b/misc-utils/namei.c index 65faad4f3c..f77d501c45 100644 --- a/misc-utils/namei.c +++ b/misc-utils/namei.c @@ -47,6 +47,7 @@ chdir to /, or if it encounters an unknown file type. #include #include #include +#include #include #include #include diff --git a/misc-utils/procs.c b/misc-utils/procs.c index 715d9fb099..3f52387de7 100644 --- a/misc-utils/procs.c +++ b/misc-utils/procs.c @@ -14,14 +14,14 @@ #define _POSIX_SOURCE 1 +#include +#include #include #include #include #include #include #include -#include -#include #include "kill.h" extern char *mybasename (char *); diff --git a/misc-utils/script.1 b/misc-utils/script.1 index ddc35223d1..3edd82d4b7 100644 --- a/misc-utils/script.1 +++ b/misc-utils/script.1 @@ -31,15 +31,17 @@ .\" .\" @(#)script.1 6.5 (Berkeley) 7/27/91 .\" -.Dd July 27, 1991 +.Dd July 30, 2000 .Dt SCRIPT 1 -.Os BSD 4 +.Os Linux .Sh NAME .Nm script .Nd make typescript of terminal session .Sh SYNOPSIS .Nm script .Op Fl a +.Op Fl f +.Op Fl q .Op Ar file .Sh DESCRIPTION .Nm Script @@ -58,7 +60,7 @@ saves all dialogue in If no file name is given, the typescript is saved in the file .Pa typescript . .Pp -Option: +Options: .Bl -tag -width Ds .It Fl a Append the output to @@ -66,6 +68,12 @@ Append the output to or .Pa typescript , retaining the prior contents. +.It Fl f +Flush output after each write. This is nice for telecooperation: +One person does `mkfifo foo; script -f foo' and another can +supervise real-time what is being done using `cat foo'. +.It Fl q +Be quiet. .El .Pp The script ends when the forked shell exits (a diff --git a/misc-utils/script.c b/misc-utils/script.c index cb7ae1a967..c3bf142e6d 100644 --- a/misc-utils/script.c +++ b/misc-utils/script.c @@ -31,8 +31,11 @@ * SUCH DAMAGE. */ -/* 1999-02-22 Arkadiusz Mi¶kiewicz +/* + * 1999-02-22 Arkadiusz Mi¶kiewicz * - added Native Language Support + * + * 2000-07-30 Per Andreas Buer - added "q"-option */ /* @@ -86,25 +89,65 @@ int l; #ifndef HAVE_openpty char line[] = "/dev/ptyXX"; #endif -int aflg; +int aflg = 0; +int fflg = 0; +int qflg = 0; + +static char *progname; + +static void +die_if_symlink(char *fn) { + struct stat s; + + if (lstat(fn, &s) == 0 && S_ISLNK(s.st_mode)) { + fprintf(stderr, + _("Warning: `%s' is a symlink.\n" + "Use `%s [options] %s' if you really " + "want to use it.\n" + "Script not started.\n"), + fn, progname, fn); + exit(1); + } +} int main(int argc, char **argv) { extern int optind; + char *p; int ch; + progname = argv[0]; + if ((p = strrchr(progname, '/')) != NULL) + progname = p+1; + + setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - while ((ch = getopt(argc, argv, "a")) != EOF) + if (argc == 2) { + if (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version")) { + printf(_("%s from %s\n"), + progname, util_linux_version); + return 0; + } + } + + while ((ch = getopt(argc, argv, "afq")) != EOF) switch((char)ch) { case 'a': aflg++; break; + case 'f': + fflg++; + break; + case 'q': + qflg++; + break; case '?': default: - fprintf(stderr, _("usage: script [-a] [file]\n")); + fprintf(stderr, + _("usage: script [-a] [-f] [-q] [file]\n")); exit(1); } argc -= optind; @@ -112,8 +155,10 @@ main(int argc, char **argv) { if (argc > 0) fname = argv[0]; - else + else { fname = "typescript"; + die_if_symlink(fname); + } if ((fscript = fopen(fname, aflg ? "a" : "w")) == NULL) { perror(fname); fail(); @@ -124,7 +169,8 @@ main(int argc, char **argv) { shell = _PATH_BSHELL; getmaster(); - printf(_("Script started, file is %s\n"), fname); + if (!qflg) + printf(_("Script started, file is %s\n"), fname); fixtty(); (void) signal(SIGCHLD, finish); @@ -167,11 +213,11 @@ doinput() { void finish(int dummy) { - union wait status; + int status; register int pid; register int die = 0; - while ((pid = wait3((int *)&status, WNOHANG, 0)) > 0) + while ((pid = wait3(&status, WNOHANG, 0)) > 0) if (pid == child) die = 1; @@ -197,6 +243,8 @@ dooutput() { break; (void) write(1, obuf, cc); (void) fwrite(obuf, 1, cc, fscript); + if (fflg) + (void) fflush(fscript); } done(); } @@ -250,13 +298,17 @@ done() { time_t tvec; if (subchild) { - tvec = time((time_t *)NULL); - fprintf(fscript,_("\nScript done on %s"), ctime(&tvec)); + if (!qflg) { + tvec = time((time_t *)NULL); + fprintf(fscript, _("\nScript done on %s"), + ctime(&tvec)); + } (void) fclose(fscript); (void) close(master); } else { (void) tcsetattr(0, TCSAFLUSH, &tt); - printf(_("Script done, file is %s\n"), fname); + if (!qflg) + printf(_("Script done, file is %s\n"), fname); } exit(0); } diff --git a/misc-utils/whereis.c b/misc-utils/whereis.c index bc505c54f0..239b1f4aee 100644 --- a/misc-utils/whereis.c +++ b/misc-utils/whereis.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include "nls.h" @@ -111,6 +112,7 @@ static char *bindirs[] = { static char *mandirs[] = { "/usr/man/*", + "/usr/share/man/*", "/usr/X386/man/*", "/usr/X11/man/*", "/usr/TeX/man/*", diff --git a/misc-utils/write.c b/misc-utils/write.c index 1cf99c7f00..e794a4eee2 100644 --- a/misc-utils/write.c +++ b/misc-utils/write.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -60,10 +61,9 @@ #include #include #include -#ifdef __linux__ #include #include "pathnames.h" -#endif +#include "carefulputc.h" #include "nls.h" void search_utmp(char *, char *, char *, uid_t); @@ -73,7 +73,6 @@ static void done(int); int term_chk(char *, int *, time_t *, int); int utmp_chk(char *, char *); - int main(int argc, char **argv) { time_t atime; @@ -289,24 +288,25 @@ int term_chk(char *tty, int *msgsokP, time_t *atimeP, int showerror) * do_write - actually make the connection */ void do_write(char *tty, char *mytty, uid_t myuid) { - register char *login, *nows; - register struct passwd *pwd; + char *login, *pwuid, *nows; + struct passwd *pwd; time_t now; char path[MAXPATHLEN], host[MAXHOSTNAMELEN], line[512]; - /* Determine our login name before the we reopen() stdout */ - if ((login = getlogin()) == NULL) { - if ((pwd = getpwuid(myuid)) != NULL) - login = pwd->pw_name; - else - login = "???"; - } + /* Determine our login name(s) before the we reopen() stdout */ + if ((pwd = getpwuid(myuid)) != NULL) + pwuid = pwd->pw_name; + else + pwuid = "???"; + if ((login = getlogin()) == NULL) + login = pwuid; if (strlen(tty) + 6 > sizeof(path)) exit(1); (void)sprintf(path, "/dev/%s", tty); if ((freopen(path, "w", stdout)) == NULL) { - (void)fprintf(stderr, "write: %s: %s\n", path, strerror(errno)); + (void)fprintf(stderr, "write: %s: %s\n", + path, strerror(errno)); exit(1); } @@ -320,8 +320,12 @@ void do_write(char *tty, char *mytty, uid_t myuid) { nows = ctime(&now); nows[16] = '\0'; printf("\r\n\007\007\007"); - (void)printf(_("Message from %s@%s on %s at %s ..."), - login, host, mytty, nows + 11); + if (strcmp(login, pwuid)) + (void)printf(_("Message from %s@%s (as %s) on %s at %s ..."), + login, host, pwuid, mytty, nows + 11); + else + (void)printf(_("Message from %s@%s on %s at %s ..."), + login, host, mytty, nows + 11); printf("\r\n"); while (fgets(line, sizeof(line), stdin) != NULL) @@ -339,34 +343,24 @@ done(int dummy) { /* * wr_fputs - like fputs(), but makes control characters visible and - * turns \n into \r\n + * turns \n into \r\n. */ -void wr_fputs(char *s) - -{ +void +wr_fputs(char *s) { char c; -#define PUTC(c) if (putchar(c) == EOF) goto err; +#define PUTC(c) if (carefulputc(c,stdout) == EOF) goto err; - for (; *s != '\0'; ++s) { - c = *s; - if (c == '\n') { + while(*s) { + c = *s++; + if (c == '\n') PUTC('\r'); - PUTC('\n'); - } else if (!isprint(c) && !isspace(c) && c != '\007') { - if (c & 0x80) { - /* use some fallback? */ - (void)printf("\\%3o", (unsigned char) c); - } else { - PUTC('^'); - PUTC(c^0x40); /* DEL to ?, others to alpha */ - } - } else - PUTC(c); + PUTC(c); } return; -err: (void)fprintf(stderr, "write: %s\n", strerror(errno)); +err: + fprintf(stderr, "write: %s\n", strerror(errno)); exit(1); #undef PUTC } diff --git a/mount/Makefile b/mount/Makefile index 6f72413dbb..18e30cde6a 100644 --- a/mount/Makefile +++ b/mount/Makefile @@ -1,15 +1,13 @@ include ../make_include include ../MCONFIG -CFLAGS = -I$(LIB) $(OPT) -WARNFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes DEFINES = -DHAVE_NFS RPCSVCDIR = rpcsvc RPC_CFLAGS = -Wno-unused RPCGEN = rpcgen -COMPILE = $(CC) -c $(WARNFLAGS) $(CFLAGS) $(DEFINES) +COMPILE = $(CC) -c $(CFLAGS) $(DEFINES) LINK = $(CC) $(LDFLAGS) SUID_PROGS = mount umount @@ -24,6 +22,8 @@ endif PROGS = $(SUID_PROGS) $(NOSUID_PROGS) +MAYBE = pivot_root swapoff + # comment these out if you are not compiling in NFS support NFS_OBJS = nfsmount.o nfsmount_xdr.o nfsmount_clnt.o # uncomment this if you don't have libc-4.2 but do have the rpclib @@ -59,8 +59,7 @@ swapon: swapon.o version.o $(LINK) $^ -o $@ losetup.o: lomount.c - $(COMPILE) -DMAIN lomount.c - mv lomount.o losetup.o + $(COMPILE) -DMAIN lomount.c -o $@ losetup: losetup.o $(LINK) $^ -o $@ @@ -117,7 +116,7 @@ loop.h: sh mk_loop_h clean: - rm -f a.out core *~ *.o swapargs.h $(PROGS) swapoff + rm -f a.out core *~ *.o swapargs.h $(PROGS) $(MAYBE) rm -f loop.h nfs_mountversion.h clobber distclean realclean: clean diff --git a/mount/README.mount b/mount/README.mount index 2a8fae1c1f..f010a1bd86 100644 --- a/mount/README.mount +++ b/mount/README.mount @@ -6,5 +6,5 @@ Rick Sladkey , Stephen Tweedie . Presently maintained by Andries Brouwer . -Ftp site: ftp.win.tue.nl:/pub/linux/util . +Ftp site: ftp.win.tue.nl:/pub/linux/utils/util-linux diff --git a/mount/bind.c b/mount/bind.c new file mode 100644 index 0000000000..4af72a9c34 --- /dev/null +++ b/mount/bind.c @@ -0,0 +1,11 @@ +#include +#include + +main(int argc, char **argv) { + int ret; + + ret = mount(argv[1], argv[2], "bind", MS_MGC_VAL, NULL); + if (ret) + perror("bind"); + return ret; +} diff --git a/mount/fstab.c b/mount/fstab.c index aef26d90c8..3ee1f36a10 100644 --- a/mount/fstab.c +++ b/mount/fstab.c @@ -99,21 +99,19 @@ read_mntentchn(mntFILE *mfp, const char *fnam, struct mntentchn *mc0) { struct mntent *mnt; while ((mnt = my_getmntent (mfp)) != NULL) { - if (!streq (mnt->mnt_type, MNTTYPE_IGNORE)) { - mc->nxt = (struct mntentchn *) xmalloc(sizeof(*mc)); - mc->nxt->prev = mc; - mc = mc->nxt; - mc->mnt_fsname = mnt->mnt_fsname; - mc->mnt_dir = mnt->mnt_dir; - mc->mnt_type = mnt->mnt_type; - mc->mnt_opts = mnt->mnt_opts; - mc->nxt = NULL; - } + if (!streq (mnt->mnt_type, MNTTYPE_IGNORE)) { + mc->nxt = (struct mntentchn *) xmalloc(sizeof(*mc)); + mc->nxt->prev = mc; + mc = mc->nxt; + mc->m = *mnt; + mc->nxt = mc0; + } } mc0->prev = mc; if (ferror (mfp->mntent_fp)) { int errsv = errno; - error(_("warning: error reading %s: %s"), fnam, strerror (errsv)); + error(_("warning: error reading %s: %s"), + fnam, strerror (errsv)); mc0->nxt = mc0->prev = NULL; } my_endmntent(mfp); @@ -163,7 +161,8 @@ read_fstab() { mfp = my_setmntent (fnam, "r"); if (mfp == NULL || mfp->mntent_fp == NULL) { int errsv = errno; - error(_("warning: can't open %s: %s"), _PATH_FSTAB, strerror (errsv)); + error(_("warning: can't open %s: %s"), + _PATH_FSTAB, strerror (errsv)); return; } read_mntentchn(mfp, fnam, mc); @@ -173,13 +172,14 @@ read_fstab() { /* Given the name NAME, try to find it in mtab. */ struct mntentchn * getmntfile (const char *name) { - struct mntentchn *mc; - - for (mc = mtab_head()->nxt; mc; mc = mc->nxt) - if (streq (mc->mnt_dir, name) || (streq (mc->mnt_fsname, name))) - break; - - return mc; + struct mntentchn *mc, *mc0; + + mc0 = mtab_head(); + for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) + if (streq (mc->m.mnt_dir, name) || + streq (mc->m.mnt_fsname, name)) + return mc; + return NULL; } /* @@ -188,110 +188,108 @@ getmntfile (const char *name) { */ struct mntentchn * getmntfilesbackward (const char *name, struct mntentchn *mcprev) { - struct mntentchn *mc, *mh; - - mh = mtab_head(); - if (!mcprev) - mcprev = mh; - for (mc = mcprev->prev; mc && mc != mh; mc = mc->prev) - if (streq (mc->mnt_dir, name) || (streq (mc->mnt_fsname, name))) - return mc; - - return NULL; + struct mntentchn *mc, *mc0; + + mc0 = mtab_head(); + if (!mcprev) + mcprev = mc0; + for (mc = mcprev->prev; mc && mc != mc0; mc = mc->prev) + if (streq (mc->m.mnt_dir, name) || + streq (mc->m.mnt_fsname, name)) + return mc; + return NULL; } /* Given the name FILE, try to find the option "loop=FILE" in mtab. */ struct mntentchn * -getmntoptfile (const char *file) -{ - struct mntentchn *mc; - char *opts, *s; - int l; - - if (!file) - return NULL; - - l = strlen(file); - - for (mc = mtab_head()->nxt; mc; mc = mc->nxt) - if ((opts = mc->mnt_opts) != NULL - && (s = strstr(opts, "loop=")) - && !strncmp(s+5, file, l) - && (s == opts || s[-1] == ',') - && (s[l+5] == 0 || s[l+5] == ',')) - return mc; - - return NULL; +getmntoptfile (const char *file) { + struct mntentchn *mc, *mc0; + char *opts, *s; + int l; + + if (!file) + return NULL; + + l = strlen(file); + + mc0 = mtab_head(); + for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) + if ((opts = mc->m.mnt_opts) != NULL + && (s = strstr(opts, "loop=")) + && !strncmp(s+5, file, l) + && (s == opts || s[-1] == ',') + && (s[l+5] == 0 || s[l+5] == ',')) + return mc; + return NULL; } /* Find the entry (SPEC,FILE) in fstab */ struct mntentchn * getfsspecfile (const char *spec, const char *file) { - struct mntentchn *mc; - - for (mc = fstab_head()->nxt; mc; mc = mc->nxt) - if (streq (mc->mnt_dir, file) && streq (mc->mnt_fsname, spec)) - return mc; - for (mc = fstab_head()->nxt; mc; mc = mc->nxt) - if ((streq (mc->mnt_dir, file) || - streq (canonicalize(mc->mnt_dir), file)) - && (streq (mc->mnt_fsname, spec) || - streq (canonicalize(mc->mnt_fsname), spec))) - break; - return mc; + struct mntentchn *mc, *mc0; + + mc0 = fstab_head(); + for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) + if (streq (mc->m.mnt_dir, file) && + streq (mc->m.mnt_fsname, spec)) + return mc; + for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) + if ((streq (mc->m.mnt_dir, file) || + streq (canonicalize(mc->m.mnt_dir), file)) + && (streq (mc->m.mnt_fsname, spec) || + streq (canonicalize(mc->m.mnt_fsname), spec))) + return mc; + return NULL; } /* Find the dir FILE in fstab. */ struct mntentchn * getfsfile (const char *file) { - struct mntentchn *mc; - - for (mc = fstab_head()->nxt; mc; mc = mc->nxt) - if (streq (mc->mnt_dir, file)) - break; + struct mntentchn *mc, *mc0; - return mc; + mc0 = fstab_head(); + for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) + if (streq (mc->m.mnt_dir, file)) + return mc; + return NULL; } /* Find the device SPEC in fstab. */ struct mntentchn * -getfsspec (const char *spec) -{ - struct mntentchn *mc; - - for (mc = fstab_head()->nxt; mc; mc = mc->nxt) - if (streq (mc->mnt_fsname, spec)) - break; - - return mc; +getfsspec (const char *spec) { + struct mntentchn *mc, *mc0; + + mc0 = fstab_head(); + for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) + if (streq (mc->m.mnt_fsname, spec)) + return mc; + return NULL; } /* Find the uuid UUID in fstab. */ struct mntentchn * -getfsuuidspec (const char *uuid) -{ - struct mntentchn *mc; - - for (mc = fstab_head()->nxt; mc; mc = mc->nxt) - if (strncmp (mc->mnt_fsname, "UUID=", 5) == 0 - && streq(mc->mnt_fsname + 5, uuid)) - break; - - return mc; +getfsuuidspec (const char *uuid) { + struct mntentchn *mc, *mc0; + + mc0 = fstab_head(); + for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) + if (strncmp (mc->m.mnt_fsname, "UUID=", 5) == 0 + && streq(mc->m.mnt_fsname + 5, uuid)) + return mc; + return NULL; } /* Find the label LABEL in fstab. */ struct mntentchn * -getfsvolspec (const char *label) -{ - struct mntentchn *mc; - - for (mc = fstab_head()->nxt; mc; mc = mc->nxt) - if (strncmp (mc->mnt_fsname, "LABEL=", 6) == 0 - && streq(mc->mnt_fsname + 6, label)) - break; - - return mc; +getfsvolspec (const char *label) { + struct mntentchn *mc, *mc0; + + mc0 = fstab_head(); + for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) + if (strncmp (mc->m.mnt_fsname, "LABEL=", 6) == 0 + && streq(mc->m.mnt_fsname + 6, label)) + return mc; + return NULL; } /* Updating mtab ----------------------------------------------*/ @@ -371,7 +369,8 @@ lock_mtab (void) { int errsv = errno; /* linktargetfile does not exist (as a file) and we cannot create it. Read-only filesystem? - Too many files open in the system? Filesystem full? */ + Too many files open in the system? + Filesystem full? */ die (EX_FILEIO, _("can't create lock file %s: %s " "(use -n flag to override)"), linktargetfile, strerror (errsv)); @@ -455,7 +454,7 @@ unlock_mtab (void) { /* * Update the mtab. - * Used by umount with null INSTEAD: remove any DIR entries. + * Used by umount with null INSTEAD: remove the last DIR entry. * Used by mount upon a remount: update option part, * and complain if a wrong device or type was given. * [Note that often a remount will be a rw remount of / @@ -465,90 +464,87 @@ unlock_mtab (void) { void update_mtab (const char *dir, struct mntent *instead) { - struct mntent *mnt; - struct mntent *next; - struct mntent remnt; - int added = 0; - mntFILE *mfp, *mftmp; + mntFILE *mfp, *mftmp; + const char *fnam = MOUNTED; + struct mntentchn mtabhead; /* dummy */ + struct mntentchn *mc, *mc0, absent; - if (mtab_does_not_exist() || mtab_is_a_symlink()) - return; + if (mtab_does_not_exist() || mtab_is_a_symlink()) + return; - lock_mtab(); + lock_mtab(); - mfp = my_setmntent(MOUNTED, "r"); - if (mfp == NULL || mfp->mntent_fp == NULL) { - int errsv = errno; - error (_("cannot open %s (%s) - mtab not updated"), - MOUNTED, strerror (errsv)); - goto leave; - } + /* having locked mtab, read it again */ + mc0 = mc = &mtabhead; + mc->nxt = mc->prev = NULL; - mftmp = my_setmntent (MOUNTED_TEMP, "w"); - if (mftmp == NULL || mfp->mntent_fp == NULL) { - int errsv = errno; - error (_("cannot open %s (%s) - mtab not updated"), - MOUNTED_TEMP, strerror (errsv)); - goto leave; - } - - while ((mnt = my_getmntent (mfp))) { - if (streq (mnt->mnt_dir, dir) -#if 0 - /* Matthew Wilcox */ - /* This is meant for Patch 212 on Jitterbug, - still in incoming, to allow remounting - on a different directory. */ - || (instead && instead->mnt_fsname && - (!streq (instead->mnt_fsname, "none")) && - (streq (mnt->mnt_fsname, instead->mnt_fsname))) -#endif - ) { - added++; - if (instead) { /* a remount */ - remnt = *instead; - next = &remnt; - remnt.mnt_fsname = mnt->mnt_fsname; - remnt.mnt_type = mnt->mnt_type; - if (instead->mnt_fsname - && !streq(mnt->mnt_fsname, instead->mnt_fsname)) - printf(_("mount: warning: cannot change " - "mounted device with a remount\n")); - else if (instead->mnt_type - && !streq(instead->mnt_type, "unknown") - && !streq(mnt->mnt_type, instead->mnt_type)) - printf(_("mount: warning: cannot change " - "filesystem type with a remount\n")); - } else - next = NULL; - } else - next = mnt; - if (next && my_addmntent(mftmp, next) == 1) { - int errsv = errno; - die (EX_FILEIO, _("error writing %s: %s"), - MOUNTED_TEMP, strerror (errsv)); - } - } - if (instead && !added && my_addmntent(mftmp, instead) == 1) { - int errsv = errno; - die (EX_FILEIO, _("error writing %s: %s"), - MOUNTED_TEMP, strerror (errsv)); - } + mfp = my_setmntent(fnam, "r"); + if (mfp == NULL || mfp->mntent_fp == NULL) { + int errsv = errno; + error (_("cannot open %s (%s) - mtab not updated"), + fnam, strerror (errsv)); + goto leave; + } - my_endmntent (mfp); - if (fchmod (fileno (mftmp->mntent_fp), S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) { - int errsv = errno; - fprintf(stderr, _("error changing mode of %s: %s\n"), MOUNTED_TEMP, - strerror (errsv)); - } - my_endmntent (mftmp); + read_mntentchn(mfp, fnam, mc); + + /* find last occurrence of dir */ + for (mc = mc0->prev; mc && mc != mc0; mc = mc->prev) + if (streq (mc->m.mnt_dir, dir)) + break; + if (mc && mc != mc0) { + if (instead == NULL) { + /* An umount - remove entry */ + if (mc && mc != mc0) { + mc->prev->nxt = mc->nxt; + mc->nxt->prev = mc->prev; + } + } else { + /* A remount */ + mc->m.mnt_opts = instead->mnt_opts; + } + } else if (instead) { + /* not found, add a new entry */ + absent.m = *instead; + absent.nxt = mc0; + absent.prev = mc0->prev; + mc0->prev = &absent; + if (mc0->nxt == NULL) + mc0->nxt = &absent; + } - if (rename (MOUNTED_TEMP, MOUNTED) < 0) { - int errsv = errno; - fprintf(stderr, _("can't rename %s to %s: %s\n"), MOUNTED_TEMP, MOUNTED, - strerror(errsv)); - } + /* write chain to mtemp */ + mftmp = my_setmntent (MOUNTED_TEMP, "w"); + if (mftmp == NULL || mfp->mntent_fp == NULL) { + int errsv = errno; + error (_("cannot open %s (%s) - mtab not updated"), + MOUNTED_TEMP, strerror (errsv)); + goto leave; + } + + for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) { + if (my_addmntent(mftmp, &(mc->m)) == 1) { + int errsv = errno; + die (EX_FILEIO, _("error writing %s: %s"), + MOUNTED_TEMP, strerror (errsv)); + } + } + + if (fchmod (fileno (mftmp->mntent_fp), + S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) { + int errsv = errno; + fprintf(stderr, _("error changing mode of %s: %s\n"), + MOUNTED_TEMP, strerror (errsv)); + } + my_endmntent (mftmp); + + /* rename mtemp to mtab */ + if (rename (MOUNTED_TEMP, MOUNTED) < 0) { + int errsv = errno; + fprintf(stderr, _("can't rename %s to %s: %s\n"), + MOUNTED_TEMP, MOUNTED, strerror(errsv)); + } -leave: - unlock_mtab(); + leave: + unlock_mtab(); } diff --git a/mount/fstab.h b/mount/fstab.h index 65bf5dba6a..820f418a03 100644 --- a/mount/fstab.h +++ b/mount/fstab.h @@ -1,3 +1,4 @@ +#include #define _PATH_FSTAB "/etc/fstab" #ifdef _PATH_MOUNTED #define MOUNTED_LOCK _PATH_MOUNTED "~" @@ -13,11 +14,8 @@ int mtab_does_not_exist(void); int mtab_is_a_symlink(void); struct mntentchn { - struct mntentchn *nxt, *prev; - char *mnt_fsname; - char *mnt_dir; - char *mnt_type; - char *mnt_opts; + struct mntentchn *nxt, *prev; + struct mntent m; }; struct mntentchn *mtab_head (void); diff --git a/mount/linux_fs.h b/mount/linux_fs.h index 635389a010..043ac16a70 100644 --- a/mount/linux_fs.h +++ b/mount/linux_fs.h @@ -100,3 +100,52 @@ struct fat_super_block { u_char s_label2[11]; /* for Windows? */ u_char s_fs2[8]; /* garbage or "FAT32 " */ }; + +#define XFS_SUPER_MAGIC "XFSB" +#define XFS_SUPER_MAGIC2 "BSFX" +struct xfs_super_block { + u_char s_magic[4]; + u_char s_dummy[28]; + u_char s_uuid[16]; + u_char s_dummy2[60]; + u_char s_fname[12]; +}; + +#define CRAMFS_SUPER_MAGIC 0x28cd3d45 +struct cramfs_super_block { + u_char s_magic[4]; + u_char s_dummy[12]; + u_char s_id[16]; +}; +#define cramfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ + (((uint) s.s_magic[2]) << 16) + \ + (((uint) s.s_magic[3]) << 24)) + +#define HFS_SUPER_MAGIC 0x4244 +struct hfs_super_block { + u_char s_magic[2]; + u_char s_dummy[18]; + u_char s_blksize[4]; +}; +#define hfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8)) +#define hfsblksize(s) ((uint) s.s_blksize[0] + \ + (((uint) s.s_blksize[1]) << 8) + \ + (((uint) s.s_blksize[2]) << 16) + \ + (((uint) s.s_blksize[3]) << 24)) + +#define HPFS_SUPER_MAGIC 0xf995e849 +struct hpfs_super_block { + u_char s_magic[4]; + u_char s_magic2[4]; +}; +#define hpfsmagic(s) ((uint) s.s_magic[0] + (((uint) s.s_magic[1]) << 8) + \ + (((uint) s.s_magic[2]) << 16) + \ + (((uint) s.s_magic[3]) << 24)) + +struct adfs_super_block { + u_char s_dummy[448]; + u_char s_blksize[1]; + u_char s_dummy2[62]; + u_char s_checksum[1]; +}; +#define adfsblksize(s) ((uint) s.s_blksize[0]) diff --git a/mount/lomount.c b/mount/lomount.c index 52157a14a8..cabc444618 100644 --- a/mount/lomount.c +++ b/mount/lomount.c @@ -68,7 +68,7 @@ crypt_name (int id) { return "undefined"; } -static void +static int show_loop (char *device) { struct loop_info loopinfo; int fd; @@ -77,36 +77,69 @@ show_loop (char *device) { int errsv = errno; fprintf(stderr, _("loop: can't open device %s: %s\n"), device, strerror (errsv)); - return; + return 2; } if (ioctl (fd, LOOP_GET_STATUS, &loopinfo) < 0) { int errsv = errno; fprintf(stderr, _("loop: can't get info on device %s: %s\n"), device, strerror (errsv)); close (fd); - return; + return 1; } printf (_("%s: [%04x]:%ld (%s) offset %d, %s encryption\n"), device, loopinfo.lo_device, loopinfo.lo_inode, loopinfo.lo_name, loopinfo.lo_offset, crypt_name (loopinfo.lo_encrypt_type)); close (fd); + + return 0; } #endif +int +is_loop_device (const char *device) { + struct stat statbuf; + int loopmajor; +#if 1 + loopmajor = 7; +#else + FILE *procdev; + char line[100], *cp; + + loopmajor = 0; + if ((procdev = fopen(PROC_DEVICES, "r")) != NULL) { + while (fgets (line, sizeof(line), procdev)) { + if ((cp = strstr (line, " loop\n")) != NULL) { + *cp='\0'; + loopmajor=atoi(line); + break; + } + } + fclose(procdev); + } +#endif + return (loopmajor && stat(device, &statbuf) == 0 && + S_ISBLK(statbuf.st_mode) && + (statbuf.st_rdev>>8) == loopmajor); +} + +#define SIZE(a) (sizeof(a)/sizeof(a[0])) + char * find_unused_loop_device (void) { /* Just creating a device, say in /tmp, is probably a bad idea - people might have problems with backup or so. So, we just try /dev/loop[0-7]. */ char dev[20]; - int i, fd, somedev = 0, someloop = 0, loop_known = 0; + char *loop_formats[] = { "/dev/loop%d", "/dev/loop/%d" }; + int i, j, fd, somedev = 0, someloop = 0, loop_known = 0; struct stat statbuf; struct loop_info loopinfo; FILE *procdev; - for(i = 0; i < 256; i++) { - sprintf(dev, "/dev/loop%d", i); + for (j = 0; j < SIZE(loop_formats); j++) { + for(i = 0; i < 256; i++) { + sprintf(dev, loop_formats[j], i); if (stat (dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) { somedev++; fd = open (dev, O_RDONLY); @@ -121,8 +154,8 @@ find_unused_loop_device (void) { } continue;/* continue trying as long as devices exist */ } - if (i >= 7) - break; + break; + } } /* Nothing found. Why not? */ @@ -393,7 +426,7 @@ main(int argc, char **argv) { if (delete) res = del_loop(argv[optind]); else - show_loop(argv[optind]); + res = show_loop(argv[optind]); } else { if (offset && sscanf(offset,"%d",&off) != 1) usage(); diff --git a/mount/lomount.h b/mount/lomount.h index 00a49f5587..1a93c693f5 100644 --- a/mount/lomount.h +++ b/mount/lomount.h @@ -1,4 +1,5 @@ extern int verbose; extern int set_loop (const char *, const char *, int, const char *, int *); extern int del_loop (const char *); +extern int is_loop_device (const char *); extern char * find_unused_loop_device (void); diff --git a/mount/losetup.8 b/mount/losetup.8 index c2e41307d2..d364f4f1ec 100644 --- a/mount/losetup.8 +++ b/mount/losetup.8 @@ -46,6 +46,15 @@ attacks. .IP "\fB\-o \fIoffset\fP" the data start is moved \fIoffset\fP bytes into the specified file or device. +.SH RETURN VALUE +.B losetup +returns 0 on success, nonzero on failure. When +.B losetup +displays the status of a loop device, it returns 1 if the device +is not configured and 2 if an error occurred which prevented +.B losetup +from determining the status of the device. + .SH FILES .nf /dev/loop0,/dev/loop1,... loop devices (major=7) @@ -81,7 +90,5 @@ DES encryption is painfully slow. On the other hand, XOR is terribly weak. .SH AUTHORS .nf Original version: Theodore Ts'o -Maintained by: Werner Almesberger Original DES by: Eric Young -Modularized and updated 28-5-94: Mitch DSouza .fi diff --git a/mount/mount.8 b/mount/mount.8 index 7016ee5351..f903411984 100644 --- a/mount/mount.8 +++ b/mount/mount.8 @@ -98,6 +98,14 @@ lists all mounted file systems (of type The option \-l adds the (ext2) labels in this listing. See below. +.\" In fact since 2.3.99. At first the syntax was mount -t bind. +Since Linux 2.4.0 it is possible to remount part of the +file hierarchy somewhere else. The call is +.RS +.br +.B "mount --bind olddir newdir" +.RE + The .I proc file system is not associated with a special device, and when @@ -367,7 +375,8 @@ necessary. The nfs ad hoc code is built in, but smbfs and ncpfs have a separate mount program. In order to make it possible to treat all types in a uniform way, mount will execute the program .I /sbin/mount.TYPE -(if that exists) when called with type smb or ncp. +(if that exists) when called with type +.IR TYPE . Since various versions of the .I smbmount program have different calling conventions, diff --git a/mount/mount.c b/mount/mount.c index b8ee2ebec9..39ccd3e634 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -36,6 +36,7 @@ * - added `owner' mount option * 2000-05-11 Mark A. Peloquin * - check_special_mountprog now returns correct status + * 2000-11-08 aeb: accept nonnumeric uid=, gid= options */ #include @@ -45,6 +46,9 @@ #include #include +#include +#include + #include #include #include @@ -58,6 +62,7 @@ #include "lomount.h" #include "loop.h" #include "linux_fs.h" /* for BLKGETSIZE */ +#include "mount_guess_rootdev.h" #include "mount_guess_fstype.h" #include "mount_by_label.h" #include "getusername.h" @@ -96,6 +101,12 @@ static int optfork = 0; /* Add volumelabel in a listing of mounted devices (-l). */ static int list_with_volumelabel = 0; +/* Nonzero for mount --bind */ +static int bind = 0; + +/* Nonzero for mount {--replace|--before|--after|--over} */ +static int mounttype = 0; + /* True if ruid != euid. */ static int suid = 0; @@ -108,8 +119,7 @@ struct opt_map { }; /* Custom mount options for our own purposes. */ -/* We can use the high-order 16 bits, since the mount call - has MS_MGC_VAL there. */ +/* Maybe these should now be freed for kernel use again */ #define MS_NOAUTO 0x80000000 #define MS_USERS 0x40000000 #define MS_USER 0x20000000 @@ -141,6 +151,7 @@ static const struct opt_map opt_map[] = { { "sync", 0, 0, MS_SYNCHRONOUS}, /* synchronous I/O */ { "async", 0, 1, MS_SYNCHRONOUS}, /* asynchronous I/O */ { "remount", 0, 0, MS_REMOUNT}, /* Alter flags of mounted FS */ + { "bind", 0, 0, MS_BIND }, /* Remount part of tree elsewhere */ { "auto", 0, 1, MS_NOAUTO }, /* Can be mounted using -a */ { "noauto", 0, 0, MS_NOAUTO }, /* Can only be mounted explicitly */ { "users", 0, 0, MS_USERS }, /* Allow ordinary user to mount */ @@ -217,17 +228,17 @@ int mount_quiet=0; /* Report on a single mount. */ static void -print_one (const struct mntentchn *mc) { +print_one (const struct mntent *me) { if (mount_quiet) return; - printf ("%s on %s", mc->mnt_fsname, mc->mnt_dir); - if (mc->mnt_type != NULL && *(mc->mnt_type) != '\0') - printf (" type %s", mc->mnt_type); - if (mc->mnt_opts != NULL) - printf (" (%s)", mc->mnt_opts); + printf ("%s on %s", me->mnt_fsname, me->mnt_dir); + if (me->mnt_type != NULL && *(me->mnt_type) != '\0') + printf (" type %s", me->mnt_type); + if (me->mnt_opts != NULL) + printf (" (%s)", me->mnt_opts); if (list_with_volumelabel) { const char *label; - label = get_volume_label_by_spec(mc->mnt_fsname); + label = get_volume_label_by_spec(me->mnt_fsname); if (label) printf (" [%s]", label); } @@ -237,18 +248,22 @@ print_one (const struct mntentchn *mc) { /* Report on everything in mtab (of the specified types if any). */ static int print_all (string_list types) { - struct mntentchn *mc; + struct mntentchn *mc, *mc0; - for (mc = mtab_head()->nxt; mc; mc = mc->nxt) { - if (matching_type (mc->mnt_type, types)) - print_one (mc); + mc0 = mtab_head(); + for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) { + if (matching_type (mc->m.mnt_type, types)) + print_one (&(mc->m)); } exit (0); } -/* Look for OPT in opt_map table and return mask value. If OPT isn't found, - tack it onto extra_opts (which is non-NULL). */ +/* + * Look for OPT in opt_map table and return mask value. + * If OPT isn't found, tack it onto extra_opts (which is non-NULL). + * For the options uid= and gid= replace user or group name by its value. + */ static inline void parse_opt (const char *opt, int *mask, char *extra_opts) { const struct opt_map *om; @@ -272,36 +287,62 @@ parse_opt (const char *opt, int *mask, char *extra_opts) { #endif return; } + if (*extra_opts) strcat(extra_opts, ","); + + /* convert nonnumeric ids to numeric */ + if (!strncmp(opt, "uid=", 4) && !isdigit(opt[4])) { + struct passwd *pw = getpwnam(opt+4); + char uidbuf[20]; + + if (pw) { + sprintf(uidbuf, "uid=%d", pw->pw_uid); + strcat(extra_opts, uidbuf); + return; + } + } + if (!strncmp(opt, "gid=", 4) && !isdigit(opt[4])) { + struct group *gr = getgrnam(opt+4); + char gidbuf[20]; + + if (gr) { + sprintf(gidbuf, "gid=%d", gr->gr_gid); + strcat(extra_opts, gidbuf); + return; + } + } + strcat(extra_opts, opt); } /* Take -o options list and compute 4th and 5th args to mount(2). flags - gets the standard options and extra_opts anything we don't recognize. */ + gets the standard options (indicated by bits) and extra_opts all the rest */ static void parse_opts (char *opts, int *flags, char **extra_opts) { - char *opt; + char *opt; - *flags = 0; - *extra_opts = NULL; + *flags = 0; + *extra_opts = NULL; - clear_string_opts(); + clear_string_opts(); - if (opts != NULL) - { - *extra_opts = xmalloc (strlen (opts) + 1); - **extra_opts = '\0'; + if (opts != NULL) { + *extra_opts = xmalloc (strlen (opts) + 1); + **extra_opts = '\0'; - for (opt = strtok (opts, ","); opt; opt = strtok (NULL, ",")) - if (!parse_string_opt (opt)) - parse_opt (opt, flags, *extra_opts); - } + for (opt = strtok (opts, ","); opt; opt = strtok (NULL, ",")) + if (!parse_string_opt (opt)) + parse_opt (opt, flags, *extra_opts); + } - if (readonly) - *flags |= MS_RDONLY; - if (readwrite) - *flags &= ~MS_RDONLY; + if (readonly) + *flags |= MS_RDONLY; + if (readwrite) + *flags &= ~MS_RDONLY; + *flags |= mounttype; + if (bind) + *flags |= MS_BIND; } /* Try to build a canonical options string. */ @@ -340,10 +381,11 @@ already (const char *spec, const char *node) { if ((mc = getmntfile(node)) != NULL) error (_("mount: according to mtab, %s is already mounted on %s"), - mc->mnt_fsname, node); - else if ((mc = getmntfile(spec)) != NULL) + mc->m.mnt_fsname, node); + else if (spec && strcmp (spec, "none") && + (mc = getmntfile(spec)) != NULL) error (_("mount: according to mtab, %s is mounted on %s"), - spec, mc->mnt_dir); + spec, mc->m.mnt_dir); else ret = 0; return ret; @@ -369,10 +411,10 @@ create_mtab (void) { /* Find the root entry by looking it up in fstab */ if ((fstab = getfsfile ("/")) || (fstab = getfsfile ("root"))) { - parse_opts (xstrdup (fstab->mnt_opts), &flags, &extra_opts); + parse_opts (xstrdup (fstab->m.mnt_opts), &flags, &extra_opts); mnt.mnt_dir = "/"; - mnt.mnt_fsname = canonicalize (fstab->mnt_fsname); - mnt.mnt_type = fstab->mnt_type; + mnt.mnt_fsname = canonicalize (fstab->m.mnt_fsname); + mnt.mnt_type = fstab->m.mnt_type; mnt.mnt_opts = fix_opts_string (flags, extra_opts, NULL); mnt.mnt_freq = mnt.mnt_passno = 0; @@ -424,6 +466,9 @@ guess_fstype_and_mount (char *spec, char *node, char **type, if (*type && strcasecmp (*type, "auto") == 0) *type = NULL; + if (!*type && (flags & MS_BIND)) + *type = "none"; /* random, but not "bind" */ + if (!*type && !(flags & MS_REMOUNT)) { *type = guess_fstype_from_superblock(spec); if (*type && !strcmp(*type, "swap")) { @@ -547,21 +592,19 @@ loop_check(char **spec, char **type, int *flags, static void update_mtab_entry(char *spec, char *node, char *type, char *opts, int flags, int freq, int pass) { - struct mntentchn mcn; struct mntent mnt; - mcn.mnt_fsname = mnt.mnt_fsname = canonicalize (spec); - mcn.mnt_dir = mnt.mnt_dir = canonicalize (node); - mcn.mnt_type = mnt.mnt_type = type; - mcn.mnt_opts = mnt.mnt_opts = opts; - mcn.nxt = 0; + mnt.mnt_fsname = canonicalize (spec); + mnt.mnt_dir = canonicalize (node); + mnt.mnt_type = type; + mnt.mnt_opts = opts; mnt.mnt_freq = freq; mnt.mnt_passno = pass; /* We get chatty now rather than after the update to mtab since the mount succeeded, even if the write to /etc/mtab should fail. */ if (verbose) - print_one (&mcn); + print_one (&mnt); if (!nomtab && mtab_is_writable()) { if (flags & MS_REMOUNT) @@ -610,6 +653,8 @@ cdrom_setspeed(char *spec) { * If there is a special mount program for this type, exec it. * returns: 0: no exec was done, 1: exec was done, status has result */ +#define ALWAYS_STAT + static int check_special_mountprog(char *spec, char *node, char *type, int flags, char *extra_opts, int *status) { @@ -708,9 +753,15 @@ try_mount_one (const char *spec0, const char *node0, char *type0, if (opt_speed) cdrom_setspeed(spec); - res = loop_check (&spec, &type, &flags, &loop, &loopdev, &loopfile); - if (res) + if (!(flags & MS_REMOUNT)) { + /* don't set up a (new) loop device if we only remount - this left + * stale assignments of files to loop devices. Nasty when used for + * encryption. + */ + res = loop_check (&spec, &type, &flags, &loop, &loopdev, &loopfile); + if (res) return res; + } /* * Call mount.TYPE for types that require a separate mount program. @@ -836,6 +887,7 @@ retry_nfs: case EINVAL: { int fd; long size; + int warned=0; if (flags & MS_REMOUNT) { error (_("mount: %s not mounted already, or bad option"), node); @@ -846,10 +898,29 @@ retry_nfs: if (stat (spec, &statbuf) == 0 && S_ISBLK(statbuf.st_mode) && (fd = open(spec, O_RDONLY | O_NONBLOCK)) >= 0) { - if(ioctl(fd, BLKGETSIZE, &size) == 0 && size <= 2) + if(ioctl(fd, BLKGETSIZE, &size) == 0) { + if (size == 0) { + warned++; + error (" (could this be the IDE device where you in fact use\n" + " ide-scsi so that sr0 or sda or so is needed?)"); + } + if (size && size <= 2) { + warned++; error (" (aren't you trying to mount an extended partition,\n" " instead of some logical partition inside?)"); + } close(fd); + } +#if 0 + /* 0xf for SCSI, 0x3f for IDE. One might check /proc/partitions + to see whether this thing really is partitioned. + Do not suggest partitions for /dev/fd0. */ + if (!warned && (statbuf.st_rdev & 0xf) == 0) { + warned++; + error (" (could this be the whole disk device\n" + " where you need a partition?)"); + } +#endif } } break; @@ -859,9 +930,10 @@ retry_nfs: case EIO: error (_("mount: %s: can't read superblock"), spec); break; case ENODEV: - if (is_in_procfs(type) || !strcmp(type, "guess")) - error(_("mount: %s has wrong major or minor number"), spec); - else if (have_procfs()) { + { int pfs; + if ((pfs = is_in_procfs(type)) == 1 || !strcmp(type, "guess")) + error(_("mount: %s: unknown device"), spec); + else if (pfs == 0) { char *lowtype, *p; int u; @@ -876,15 +948,16 @@ retry_nfs: u++; } } - if (u && is_in_procfs(lowtype)) + if (u && is_in_procfs(lowtype) == 1) error (_("mount: probably you meant %s"), lowtype); - else if (!strncmp(lowtype, "iso", 3) && is_in_procfs("iso9660")) + else if (!strncmp(lowtype, "iso", 3) && is_in_procfs("iso9660") == 1) error (_("mount: maybe you meant iso9660 ?")); free(lowtype); } else error (_("mount: %s has wrong device number or fs type %s not supported"), spec, type); break; + } case ENOTBLK: if (stat (spec, &statbuf)) /* strange ... */ error (_("mount: %s is not a block device, and stat fails?"), spec); @@ -902,8 +975,8 @@ retry_nfs: case EACCES: /* pre-linux 1.1.38, 1.1.41 and later */ case EROFS: /* linux 1.1.38 and later */ { char *bd = (loop ? "" : _("block device ")); - if (ro) { - error (_("mount: %s%s is not permitted on its filesystem"), + if (ro || (flags & MS_RDONLY)) { + error (_("mount: cannot mount %s%s read-only"), bd, spec); break; } else if (readwrite) { @@ -1011,15 +1084,15 @@ mount_one (const char *spec, const char *node, char *type, const char *opts, if (specset) { if (nspec) { spec = nspec; - if (verbose) - printf(_("mount: consider mounting %s by %s\n"), spec, + if (verbose > 1) + printf(_("mount: going to mount %s by %s\n"), spec, (specset==1) ? _("UUID") : _("label")); } else if(!all) die (EX_USAGE, _("mount: no such partition found")); /* if -a then we may be rescued by a noauto option */ } - if (type == NULL) { + if (type == NULL && !bind) { if (strchr (spec, ':') != NULL) { type = "nfs"; if (verbose) @@ -1057,7 +1130,7 @@ mount_one (const char *spec, const char *node, char *type, const char *opts, /* Check if an fsname/dir pair was already in the old mtab. */ static int mounted (char *spec, char *node) { - struct mntentchn *mc; + struct mntentchn *mc, *mc0; char *nspec = NULL; if (!strncmp(spec, "UUID=", 5)) @@ -1071,8 +1144,9 @@ mounted (char *spec, char *node) { spec = canonicalize (spec); node = canonicalize (node); - for (mc = mtab_head()->nxt; mc; mc = mc->nxt) - if (streq (spec, mc->mnt_fsname) && streq (node, mc->mnt_dir)) + mc0 = mtab_head(); + for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) + if (streq (spec, mc->m.mnt_fsname) && streq (node, mc->m.mnt_dir)) return 1; return 0; } @@ -1085,7 +1159,7 @@ mounted (char *spec, char *node) { static int mount_all (string_list types, char *options) { - struct mntentchn *mc, *mtmp; + struct mntentchn *mc, *mc0, *mtmp; int status = 0; struct stat statbuf; struct child { @@ -1102,28 +1176,29 @@ mount_all (string_list types, char *options) { several chains, one for each major or NFS host */ childhead.nxt = 0; childtail = &childhead; - for (mc = fstab_head()->nxt; mc; mc = mc->nxt) { - if (matching_type (mc->mnt_type, types) - && !streq (mc->mnt_dir, "/") - && !streq (mc->mnt_dir, "root")) { - if (mounted (mc->mnt_fsname, mc->mnt_dir)) { + mc0 = fstab_head(); + for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) { + if (matching_type (mc->m.mnt_type, types) + && !streq (mc->m.mnt_dir, "/") + && !streq (mc->m.mnt_dir, "root")) { + if (mounted (mc->m.mnt_fsname, mc->m.mnt_dir)) { if (verbose) printf(_("mount: %s already mounted on %s\n"), - mc->mnt_fsname, mc->mnt_dir); + mc->m.mnt_fsname, mc->m.mnt_dir); } else { mtmp = (struct mntentchn *) xmalloc(sizeof(*mtmp)); *mtmp = *mc; mtmp->nxt = 0; g = NULL; if (optfork) { - if (stat(mc->mnt_fsname, &statbuf) == 0 && + if (stat(mc->m.mnt_fsname, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) { sprintf(major, "#%x", DISKMAJOR(statbuf.st_rdev)); g = major; } #ifdef HAVE_NFS - if (strcmp(mc->mnt_type, "nfs") == 0) { - g = xstrdup(mc->mnt_fsname); + if (strcmp(mc->m.mnt_type, "nfs") == 0) { + g = xstrdup(mc->m.mnt_fsname); colon = strchr(g, ':'); if (colon) *colon = '\0'; @@ -1166,8 +1241,8 @@ mount_all (string_list types, char *options) { /* if child, or not forked, do the mounting */ if (p == 0 || p == -1) { for (mc = cp->mec; mc; mc = mc->nxt) - status |= mount_one (mc->mnt_fsname, mc->mnt_dir, - mc->mnt_type, mc->mnt_opts, + status |= mount_one (mc->m.mnt_fsname, mc->m.mnt_dir, + mc->m.mnt_type, mc->m.mnt_opts, options, 0, 0); if (mountcount) status |= EX_SOMEOK; @@ -1198,222 +1273,271 @@ mount_all (string_list types, char *options) { } extern char version[]; -static struct option longopts[] = -{ - { "all", 0, 0, 'a' }, - { "fake", 0, 0, 'f' }, - { "fork", 0, 0, 'F' }, - { "help", 0, 0, 'h' }, - { "no-mtab", 0, 0, 'n' }, - { "read-only", 0, 0, 'r' }, - { "ro", 0, 0, 'r' }, - { "verbose", 0, 0, 'v' }, - { "version", 0, 0, 'V' }, - { "read-write", 0, 0, 'w' }, - { "rw", 0, 0, 'w' }, - { "options", 1, 0, 'o' }, - { "types", 1, 0, 't' }, - { NULL, 0, 0, 0 } +static struct option longopts[] = { + { "all", 0, 0, 'a' }, + { "fake", 0, 0, 'f' }, + { "fork", 0, 0, 'F' }, + { "help", 0, 0, 'h' }, + { "no-mtab", 0, 0, 'n' }, + { "read-only", 0, 0, 'r' }, + { "ro", 0, 0, 'r' }, + { "verbose", 0, 0, 'v' }, + { "version", 0, 0, 'V' }, + { "read-write", 0, 0, 'w' }, + { "rw", 0, 0, 'w' }, + { "options", 1, 0, 'o' }, + { "types", 1, 0, 't' }, + { "bind", 0, 0, 128 }, + { "replace", 0, 0, 129 }, + { "after", 0, 0, 130 }, + { "before", 0, 0, 131 }, + { "over", 0, 0, 132 }, + { NULL, 0, 0, 0 } }; +/* Keep the usage message at max 22 lines, each at most 70 chars long. + The user should not need a pager to read it. */ static void -usage (FILE *fp, int n) -{ - fprintf (fp, _("Usage: mount [-lhV]\n" - " mount -a [-nfFrsvw] [-t vfstypes]\n" - " mount [-nfrsvw] [-o options] special | node\n" - " mount [-nfrsvw] [-t vfstype] [-o options] special node\n" - " A special device can be indicated by -L label or -U uuid .\n")); - unlock_mtab(); - exit (n); +usage (FILE *fp, int n) { + fprintf(fp, _( + "Usage: mount -V : print version\n" + " mount -h : print this help\n" + " mount : list mounted filesystems\n" + " mount -l : idem, including volume labels\n" + "So far the informational part. Next the mounting.\n" + "The command is `mount [-t fstype] something somewhere'.\n" + "Details found in /etc/fstab may be omitted.\n" + " mount -a : mount all stuff from /etc/fstab\n" + " mount device : mount device at the known place\n" + " mount directory : mount known device here\n" + " mount -t type dev dir : ordinary mount command\n" + "Note that one does not really mount a device, one mounts\n" + "a filesystem (of the given type) found on the device.\n" + "One can also mount an already visible directory tree elsewhere:\n" + " mount --bind olddir newdir\n" + "A device can be given by name, say /dev/hda1 or /dev/cdrom,\n" + "or by label, using -L label or by uuid, using -U uuid .\n" + "Union or stack mounts are specified using one of\n" + " --replace, --after, --before, --over\n" + "Other options: [-nfFrsvw] [-o options].\n" + "For many more details, say man 8 mount .\n" + )); + unlock_mtab(); + exit (n); } int main (int argc, char *argv[]) { - int c, result = 0, specseen; - char *options = NULL, *spec, *node; - char *volumelabel = NULL; - char *uuid = NULL; - string_list types = NULL; - struct mntentchn *mc; - int fd; - - setlocale(LC_ALL, ""); - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); - - /* People report that a mount called from init without console - writes error messages to /etc/mtab - Let us try to avoid getting fd's 0,1,2 */ - while((fd = open("/dev/null", O_RDWR)) == 0 || fd == 1 || fd == 2) ; - if (fd > 2) - close(fd); + int c, result = 0, specseen; + char *options = NULL, *spec, *node; + char *volumelabel = NULL; + char *uuid = NULL; + string_list types = NULL; + struct mntentchn *mc; + int fd; + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + /* People report that a mount called from init without console + writes error messages to /etc/mtab + Let us try to avoid getting fd's 0,1,2 */ + while((fd = open("/dev/null", O_RDWR)) == 0 || fd == 1 || fd == 2) ; + if (fd > 2) + close(fd); #ifdef DO_PS_FIDDLING - initproctitle(argc, argv); + initproctitle(argc, argv); #endif - while ((c = getopt_long (argc, argv, "afFhlL:no:rsU:vVwt:", longopts, NULL)) - != EOF) - switch (c) { - case 'a': /* mount everything in fstab */ - ++all; - break; - case 'f': /* fake (don't actually do mount(2) call) */ - ++fake; - break; - case 'F': - ++optfork; - break; - case 'h': /* help */ - usage (stdout, 0); - break; - case 'l': - list_with_volumelabel = 1; - break; - case 'L': - volumelabel = optarg; - break; - case 'n': /* mount without writing in /etc/mtab */ - ++nomtab; - break; - case 'o': /* specify mount options */ - if (options) - options = xstrconcat3(options, ",", optarg); - else - options = xstrdup(optarg); - break; - case 'r': /* mount readonly */ - readonly = 1; - readwrite = 0; - break; - case 's': /* allow sloppy mount options */ - sloppy = 1; - break; - case 't': /* specify file system types */ - types = parse_list (optarg); - break; - case 'U': - uuid = optarg; - break; - case 'v': /* be chatty - very chatty if repeated */ - ++verbose; - break; - case 'V': /* version */ - printf ("mount: %s\n", version); - exit (0); - case 'w': /* mount read/write */ - readwrite = 1; - readonly = 0; - break; - case 0: - break; - case '?': - default: - usage (stderr, EX_USAGE); - } - - argc -= optind; - argv += optind; - - specseen = (uuid || volumelabel) ? 1 : 0; /* yes, .. i know */ + while ((c = getopt_long (argc, argv, "afFhlL:no:rsU:vVwt:", + longopts, NULL)) != EOF) { + switch (c) { + case 'a': /* mount everything in fstab */ + ++all; + break; + case 'f': /* fake: don't actually call mount(2) */ + ++fake; + break; + case 'F': + ++optfork; + break; + case 'h': /* help */ + usage (stdout, 0); + break; + case 'l': + list_with_volumelabel = 1; + break; + case 'L': + volumelabel = optarg; + break; + case 'n': /* do not write /etc/mtab */ + ++nomtab; + break; + case 'o': /* specify mount options */ + if (options) + options = xstrconcat3(options, ",", optarg); + else + options = xstrdup(optarg); + break; + case 'r': /* mount readonly */ + readonly = 1; + readwrite = 0; + break; + case 's': /* allow sloppy mount options */ + sloppy = 1; + break; + case 't': /* specify file system types */ + types = parse_list (optarg); + break; + case 'U': + uuid = optarg; + break; + case 'v': /* be chatty - more so if repeated */ + ++verbose; + break; + case 'V': /* version */ + printf ("mount: %s\n", version); + exit (0); + case 'w': /* mount read/write */ + readwrite = 1; + readonly = 0; + break; + case 0: + break; + + case 128: /* bind */ + ++bind; + break; + case 129: /* replace */ + mounttype = MS_REPLACE; + break; + case 130: /* after */ + mounttype = MS_AFTER; + break; + case 131: /* before */ + mounttype = MS_BEFORE; + break; + case 132: /* over */ + mounttype = MS_OVER; + break; + + case '?': + default: + usage (stderr, EX_USAGE); + } + } - if (argc+specseen == 0 && !all) { - if (options) - usage (stderr, EX_USAGE); - return print_all (types); - } + argc -= optind; + argv += optind; - if (getuid () != geteuid ()) { - suid = 1; - if (types || options || readwrite || nomtab || all || fake || - (argc + specseen) != 1) - die (EX_USAGE, _("mount: only root can do that")); - } + specseen = (uuid || volumelabel) ? 1 : 0; /* yes, .. i know */ - if (!nomtab && mtab_does_not_exist()) { - if (verbose > 1) - printf(_("mount: no %s found - creating it..\n"), MOUNTED); - create_mtab (); - } + if (argc+specseen == 0 && !all) { + if (options || mounttype || bind) + usage (stderr, EX_USAGE); + return print_all (types); + } - if (specseen) { - if (uuid) - spec = get_spec_by_uuid(uuid); - else - spec = get_spec_by_volume_label(volumelabel); - if (!spec) - die (EX_USAGE, _("mount: no such partition found")); - if (verbose) - printf(_("mount: mounting %s\n"), spec); - } else - spec = NULL; /* just for gcc */ - - switch (argc+specseen) { - case 0: - /* mount -a */ - result = mount_all (types, options); - if (result == 0 && verbose) - error(_("not mounted anything")); - break; + if (getuid () != geteuid ()) { + suid = 1; + if (types || options || readwrite || nomtab || all || fake || + bind || mounttype || (argc + specseen) != 1) + die (EX_USAGE, _("mount: only root can do that")); + } - case 1: - /* mount [-nfrvw] [-o options] special | node */ - if (types != NULL) - usage (stderr, EX_USAGE); - if (specseen) { - /* We know the device. Where shall we mount it? */ - mc = (uuid ? getfsuuidspec (uuid) : getfsvolspec (volumelabel)); - if (mc == NULL) - mc = getfsspec (spec); - if (mc == NULL) - die (EX_USAGE, _("mount: cannot find %s in %s"), - spec, _PATH_FSTAB); - mc->mnt_fsname = spec; - } else { - /* Try to find the other pathname in fstab. */ - spec = canonicalize (*argv); - if ((mc = getfsspec (spec)) == NULL && - (mc = getfsfile (spec)) == NULL && - /* Try noncanonical name in fstab - perhaps /dev/cdrom or /dos is a symlink */ - (mc = getfsspec (*argv)) == NULL && - (mc = getfsfile (*argv)) == NULL && - /* Try mtab - maybe this was a remount */ - (mc = getmntfile (spec)) == NULL) - die (EX_USAGE, _("mount: can't find %s in %s or %s"), - spec, _PATH_FSTAB, MOUNTED); - /* Earlier mtab was tried first, but this would - sometimes try the wrong mount in case mtab had - the root device entry wrong. */ - } + if (!nomtab && mtab_does_not_exist()) { + if (verbose > 1) + printf(_("mount: no %s found - creating it..\n"), + MOUNTED); + create_mtab (); + } - result = mount_one (xstrdup (mc->mnt_fsname), xstrdup (mc->mnt_dir), - xstrdup (mc->mnt_type), mc->mnt_opts, options, 0, 0); - break; + if (specseen) { + if (uuid) + spec = get_spec_by_uuid(uuid); + else + spec = get_spec_by_volume_label(volumelabel); + if (!spec) + die (EX_USAGE, _("mount: no such partition found")); + if (verbose) + printf(_("mount: mounting %s\n"), spec); + } else + spec = NULL; /* just for gcc */ + + switch (argc+specseen) { + case 0: + /* mount -a */ + result = mount_all (types, options); + if (result == 0 && verbose) + error(_("not mounted anything")); + break; + + case 1: + /* mount [-nfrvw] [-o options] special | node */ + if (types != NULL) + usage (stderr, EX_USAGE); + if (specseen) { + /* We know the device. Where shall we mount it? */ + mc = (uuid ? getfsuuidspec (uuid) + : getfsvolspec (volumelabel)); + if (mc == NULL) + mc = getfsspec (spec); + if (mc == NULL) + die (EX_USAGE, + _("mount: cannot find %s in %s"), + spec, _PATH_FSTAB); + mc->m.mnt_fsname = spec; + } else { + /* Try to find the other pathname in fstab. */ + spec = canonicalize (*argv); + if ((mc = getfsspec (spec)) == NULL && + (mc = getfsfile (spec)) == NULL && + /* Try noncanonical name in fstab + perhaps /dev/cdrom or /dos is a symlink */ + (mc = getfsspec (*argv)) == NULL && + (mc = getfsfile (*argv)) == NULL && + /* Try mtab - maybe this was a remount */ + (mc = getmntfile (spec)) == NULL) + die (EX_USAGE, + _("mount: can't find %s in %s or %s"), + spec, _PATH_FSTAB, MOUNTED); + /* Earlier mtab was tried first, but this would + sometimes try the wrong mount in case mtab had + the root device entry wrong. */ + } - case 2: - /* mount [-nfrvw] [-t vfstype] [-o options] special node */ - if (specseen) { - /* we have spec already */ - node = argv[0]; - } else { - spec = argv[0]; - node = argv[1]; - } - if (types == NULL) - result = mount_one (spec, node, NULL, NULL, options, 0, 0); - else if (cdr (types) == NULL) - result = mount_one (spec, node, car (types), NULL, options, 0, 0); - else - usage (stderr, EX_USAGE); - break; + result = mount_one (xstrdup (mc->m.mnt_fsname), + xstrdup (mc->m.mnt_dir), + xstrdup (mc->m.mnt_type), + mc->m.mnt_opts, options, 0, 0); + break; + + case 2: + /* mount [-nfrvw] [-t vfstype] [-o options] special node */ + if (specseen) { + /* we have spec already */ + node = argv[0]; + } else { + spec = argv[0]; + node = argv[1]; + } + if (types == NULL) + result = mount_one (spec, node, NULL, NULL, + options, 0, 0); + else if (cdr (types) == NULL) + result = mount_one (spec, node, car (types), NULL, + options, 0, 0); + else + usage (stderr, EX_USAGE); + break; - default: - usage (stderr, EX_USAGE); - } + default: + usage (stderr, EX_USAGE); + } - if (result == EX_SOMEOK) - result = 0; - exit (result); + if (result == EX_SOMEOK) + result = 0; + exit (result); } diff --git a/mount/mount_by_label.c b/mount/mount_by_label.c index 1567bfb184..e24d880d26 100644 --- a/mount/mount_by_label.c +++ b/mount/mount_by_label.c @@ -7,6 +7,8 @@ * - Added error message if /proc/partitions cannot be opened * 2000-05-09 Erik Troan * - Added cache for UUID and disk labels + * 2000-11-07 Nathan Scott + * - Added XFS support */ #include @@ -29,33 +31,44 @@ static struct uuidCache_s { char *device; } *uuidCache = NULL; -/* for now, only ext2 is supported */ +/* for now, only ext2 and xfs are supported */ static int get_label_uuid(const char *device, char **label, char *uuid) { - /* start with a test for ext2, taken from mount_guess_fstype */ + /* start with ext2 and xfs tests, taken from mount_guess_fstype */ /* should merge these later */ int fd; + int rv = 1; + size_t namesize; struct ext2_super_block e2sb; + struct xfs_super_block xfsb; fd = open(device, O_RDONLY); if (fd < 0) - return 1; - - if (lseek(fd, 1024, SEEK_SET) != 1024 - || read(fd, (char *) &e2sb, sizeof(e2sb)) != sizeof(e2sb) - || (ext2magic(e2sb) != EXT2_SUPER_MAGIC)) { - close(fd); - return 1; + return rv; + + if (lseek(fd, 1024, SEEK_SET) == 1024 + && read(fd, (char *) &e2sb, sizeof(e2sb)) == sizeof(e2sb) + && (ext2magic(e2sb) == EXT2_SUPER_MAGIC)) { + memcpy(uuid, e2sb.s_uuid, sizeof(e2sb.s_uuid)); + namesize = sizeof(e2sb.s_volume_name); + if ((*label = calloc(namesize + 1, 1)) != NULL) + memcpy(*label, e2sb.s_volume_name, namesize); + rv = 0; + } + else if (lseek(fd, 0, SEEK_SET) == 0 + && read(fd, (char *) &xfsb, sizeof(xfsb)) == sizeof(xfsb) + && (strncmp((char *) &xfsb.s_magic, XFS_SUPER_MAGIC, 4) == 0 || + strncmp((char *) &xfsb.s_magic, XFS_SUPER_MAGIC2,4) == 0)) { + memcpy(uuid, xfsb.s_uuid, sizeof(xfsb.s_uuid)); + namesize = sizeof(xfsb.s_fname); + if ((*label = calloc(namesize + 1, 1)) != NULL) + memcpy(*label, xfsb.s_fname, namesize); + rv = 0; } close(fd); - - /* superblock is ext2 - now what is its label? */ - memcpy(uuid, e2sb.s_uuid, sizeof(e2sb.s_uuid)); - *label = strdup(e2sb.s_volume_name); - - return 0; + return rv; } static void @@ -91,8 +104,14 @@ uuidcache_init(void) { return; procpt = fopen(PROC_PARTITIONS, "r"); - if (!procpt) + if (!procpt) { + static int warn = 0; + if (!warn++) + error (_("mount: could not open %s, so UUID and LABEL " + "conversion cannot be done.\n"), + PROC_PARTITIONS); return; + } for (firstPass = 1; firstPass >= 0; firstPass--) { fseek(procpt, 0, SEEK_SET); diff --git a/mount/mount_constants.h b/mount/mount_constants.h index aeb7edfb37..5fd2908291 100644 --- a/mount/mount_constants.h +++ b/mount/mount_constants.h @@ -19,12 +19,31 @@ #ifndef MS_MANDLOCK #define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ #endif +#ifndef MS_ACTION_MASK +#define MS_ACTION_MASK 0x380 +/* Remount, but new filesystem may be different from old. Atomic + (i.e. there is no interval when nothing is mounted at the mountpoint). + If new fs differs from the old one and old is busy - -EBUSY. */ +#define MS_REPLACE 0x080 /* 128 */ +/* After, Before: as soon as we get unions these will add a new member + in the end or beginning of the chain. Fail if there is a stack + on the mountpoint. */ +#define MS_AFTER 0x100 /* 256 */ +#define MS_BEFORE 0x180 +/* Over: if nothing mounted on a mountpoint - same as if none of these +flags had been set; if we have a union with more than one element - fail; +if we have a stack or plain mount - mount atop of it, forming a stack. */ +#define MS_OVER 0x200 /* 512 */ +#endif #ifndef MS_NOATIME #define MS_NOATIME 1024 /* Do not update access times. */ #endif #ifndef MS_NODIRATIME #define MS_NODIRATIME 2048 /* Do not update directory access times */ #endif +#ifndef MS_BIND +#define MS_BIND 4096 +#endif /* * Magic mount flag number. Has to be or-ed to the flag values. */ diff --git a/mount/mount_guess_fstype.c b/mount/mount_guess_fstype.c index ec39c531a4..5a3733f983 100644 --- a/mount/mount_guess_fstype.c +++ b/mount/mount_guess_fstype.c @@ -20,6 +20,9 @@ * 1999-02-22 Arkadiusz Mi¶kiewicz * - added Native Language Support * + * Fri Dec 1 23:31:00 2000: Sepp Wijnands + * added probes for cramfs, hfs, hpfs and adfs. + * * aeb - many changes. * */ @@ -63,24 +66,21 @@ swapped(unsigned short a) { Original routine by ; made into a function for mount(8) by Mike Grupenhoff . Read the superblock only once - aeb - Added a test for iso9660 - aeb + Added iso9660, romfs, qnx4, udf, swap - aeb Added a test for high sierra (iso9660) - quinlan@bucknell.edu Corrected the test for xiafs - aeb - Added romfs - aeb Added ufs from a patch by jj. But maybe there are several types of ufs? Added ntfs from a patch by Richard Russon. Added a very weak heuristic for vfat - aeb - Added qnx4 - aeb - Added swap - aeb Added xfs - 2000-03-21 Martin K. Petersen - - Currently supports: minix, ext, ext2, xiafs, iso9660, romfs, - ufs, ntfs, vfat, qnx4, bfs, xfs + Added cramfs, hfs, hpfs, adfs - Sepp Wijnands */ static char -*magic_known[] = { "minix", "ext", "ext2", "xiafs", "iso9660", "romfs", - "ufs", "ntfs", "qnx4", "bfs", "udf", "xfs", - "swap" /* last - just to warn the user */ +*magic_known[] = { + "adfs", "bfs", "cramfs", "ext", "ext2", + "hfs", "hpfs", "iso9660", "minix", "ntfs", + "qnx4", "romfs", "swap", "udf", "ufs", + "xfs", "xiafs" }; static int @@ -97,7 +97,6 @@ tested(const char *device) { causes a very large kernel delay, almost killing the machine. So, we do not try udf unless there is positive evidence that it might work. Try iso9660 first, it is much more likely. - Strings below taken from ECMA 167. */ static char *udf_magic[] = { "BEA01", "BOOT2", "CD001", "CDW02", "NSR02", @@ -119,6 +118,20 @@ may_be_swap(const char *s) { strncmp(s-10, "SWAPSPACE2", 10) == 0); } +/* rather weak necessary condition */ +static int +may_be_adfs(const u_char *s) { + u_char *p; + int sum; + + p = (u_char *) s + 511; + sum = 0; + while(--p != s) + sum = (sum >> 8) + (sum & 0xff) + *p; + + return (sum == p[511]); +} + static char * fstype(const char *device) { int fd; @@ -131,17 +144,21 @@ fstype(const char *device) { union { struct xiafs_super_block xiasb; char romfs_magic[8]; - char xfs_magic[4]; char qnx4fs_magic[10]; /* ignore first 4 bytes */ long bfs_magic; struct ntfs_super_block ntfssb; struct fat_super_block fatsb; + struct xfs_super_block xfsb; + struct cramfs_super_block cramfssb; } xsb; struct ufs_super_block ufssb; union { struct iso_volume_descriptor iso; struct hs_volume_descriptor hs; } isosb; + struct hfs_super_block hfssb; + struct hpfs_super_block hpfssb; + struct adfs_super_block adfssb; struct stat statbuf; /* opening and reading an arbitrary unknown path can have @@ -164,7 +181,8 @@ fstype(const char *device) { type = "ext2"; else if (minixmagic(sb.ms) == MINIX_SUPER_MAGIC - || minixmagic(sb.ms) == MINIX_SUPER_MAGIC2) + || minixmagic(sb.ms) == MINIX_SUPER_MAGIC2 + || minixmagic(sb.ms) == swapped(MINIX_SUPER_MAGIC2)) type = "minix"; else if (extmagic(sb.es) == EXT_SUPER_MAGIC) @@ -179,8 +197,8 @@ fstype(const char *device) { type = "xiafs"; else if(!strncmp(xsb.romfs_magic, "-rom1fs-", 8)) type = "romfs"; - else if(!strncmp(xsb.xfs_magic, "XFSB", 4) || - !strncmp(xsb.xfs_magic, "BSFX", 4)) + else if(!strncmp(xsb.xfsb.s_magic, XFS_SUPER_MAGIC, 4) || + !strncmp(xsb.xfsb.s_magic, XFS_SUPER_MAGIC2, 4)) type = "xfs"; else if(!strncmp(xsb.qnx4fs_magic+4, "QNX4FS", 6)) type = "qnx4fs"; @@ -189,6 +207,8 @@ fstype(const char *device) { else if(!strncmp(xsb.ntfssb.s_magic, NTFS_SUPER_MAGIC, sizeof(xsb.ntfssb.s_magic))) type = "ntfs"; + else if(cramfsmagic(xsb.cramfssb) == CRAMFS_SUPER_MAGIC) + type = "cramfs"; else if ((!strncmp(xsb.fatsb.s_os, "MSDOS", 5) || !strncmp(xsb.fatsb.s_os, "MSWIN", 5) || !strncmp(xsb.fatsb.s_os, "MTOOL", 5) || @@ -221,6 +241,43 @@ fstype(const char *device) { type = "udf"; } + if (!type) { + if (lseek(fd, 0x400, SEEK_SET) != 0x400 + || read(fd, (char *) &hfssb, sizeof(hfssb)) != sizeof(hfssb)) + goto io_error; + + /* also check if block size is equal to 512 bytes, + since the hfs driver currently only has support + for block sizes of 512 bytes long, and to be + more accurate (sb magic is only a short int) */ + if ((hfsmagic(hfssb) == HFS_SUPER_MAGIC && + hfsblksize(hfssb) == 0x20000) || + (swapped(hfsmagic(hfssb)) == HFS_SUPER_MAGIC && + hfsblksize(hfssb) == 0x200)) + type = "hfs"; + } + + if (!type) { + if (lseek(fd, 0x2000, SEEK_SET) != 0x2000 + || read(fd, (char *) &hpfssb, sizeof(hpfssb)) != sizeof(hpfssb)) + goto io_error; + + if (hpfsmagic(hpfssb) == HPFS_SUPER_MAGIC) + type = "hpfs"; + } + + if (!type) { + if (lseek(fd, 0xc00, SEEK_SET) != 0xc00 + || read(fd, (char *) &adfssb, sizeof(adfssb)) != sizeof(adfssb)) + goto io_error; + + /* only a weak test */ + if (may_be_adfs((u_char *) &adfssb) + && (adfsblksize(adfssb) >= 8 && + adfsblksize(adfssb) <= 10)) + type = "adfs"; + } + if (!type) { /* perhaps the user tries to mount the swap space on a new disk; warn her before she does mke2fs on it */ @@ -267,46 +324,40 @@ guess_fstype_from_superblock(const char *spec) { return type; } -static FILE *procfs; - -static void -procfsclose(void) { - if (procfs) - fclose (procfs); - procfs = 0; -} - -static int -procfsopen(void) { - procfs = fopen(ETC_FILESYSTEMS, "r"); - if (!procfs) - procfs = fopen(PROC_FILESYSTEMS, "r"); - return (procfs != NULL); -} - static char * -procfsnext(void) { +procfsnext(FILE *procfs) { char line[100]; - static char fsname[100]; + char fsname[100]; while (fgets(line, sizeof(line), procfs)) { if (sscanf (line, "nodev %[^\n]\n", fsname) == 1) continue; if (sscanf (line, " %[^ \n]\n", fsname) != 1) continue; - return fsname; + return strdup(fsname); } return 0; } +/* Only use /proc/filesystems here, this is meant to test what + the kernel knows about, so /etc/filesystems is irrelevant. + Return: 1: yes, 0: no, -1: cannot open procfs */ int is_in_procfs(const char *type) { + FILE *procfs; char *fsname; - - if (procfsopen()) { - while ((fsname = procfsnext()) != NULL) - if (!strcmp(fsname, type)) - return 1; + int ret = -1; + + procfs = fopen(PROC_FILESYSTEMS, "r"); + if (procfs) { + ret = 0; + while ((fsname = procfsnext(procfs)) != NULL) + if (!strcmp(fsname, type)) { + ret = 1; + break; + } + fclose(procfs); + procfs = NULL; } - return 0; + return ret; } /* return: 0: OK, -1: error in errno, 1: type not found */ @@ -314,12 +365,20 @@ is_in_procfs(const char *type) { int procfsloop(int (*mount_fn)(struct mountargs *), struct mountargs *args, char **type) { + FILE *procfs; char *fsname; + int ret = 1; + int errsv = 0; *type = NULL; - if (!procfsopen()) - return 1; - while ((fsname = procfsnext()) != NULL) { + + procfs = fopen(ETC_FILESYSTEMS, "r"); + if (!procfs) { + procfs = fopen(PROC_FILESYSTEMS, "r"); + if (!procfs) + return 1; + } + while ((fsname = procfsnext(procfs)) != NULL) { if (tested (fsname)) continue; args->type = fsname; @@ -328,20 +387,17 @@ procfsloop(int (*mount_fn)(struct mountargs *), struct mountargs *args, fflush(stdout); } if ((*mount_fn) (args) == 0) { - *type = xstrdup(fsname); - procfsclose(); - return 0; - } else if (errno != EINVAL) { + *type = fsname; + ret = 0; + break; + } else if (errno != EINVAL && is_in_procfs(fsname) == 1) { *type = "guess"; - procfsclose(); - return -1; + ret = -1; + errsv = errno; + break; } } - procfsclose(); - return 1; -} - -int -have_procfs(void) { - return procfs != NULL; + fclose(procfs); + errno = errsv; + return ret; } diff --git a/mount/mount_guess_fstype.h b/mount/mount_guess_fstype.h index 3663f74ca0..9c0903b541 100644 --- a/mount/mount_guess_fstype.h +++ b/mount/mount_guess_fstype.h @@ -12,4 +12,4 @@ char *guess_fstype_from_superblock(const char *device); int procfsloop(int (*mount_fn)(struct mountargs *), struct mountargs *args, char **type); int is_in_procfs(const char *fstype); -int have_procfs(void); + diff --git a/mount/mount_guess_rootdev.c b/mount/mount_guess_rootdev.c new file mode 100644 index 0000000000..072c09fc48 --- /dev/null +++ b/mount/mount_guess_rootdev.c @@ -0,0 +1,90 @@ +/* + * Having the wrong rootdevice listed in mtab is slightly inconvenient. + * Try to guess what it could be... + * In case /proc/cmdline exists, and has the format + * stuff root=R more stuff... + * and we think we understand the number R, decode it as a root device. + * + * Another possibility: + * Erik Andersen writes: + * I did a similar find_real_root_device_name() in busybox some time back. + * Basically, do a stat("/", &rootstat) then walk /dev stat'ing each file + * and if (statbuf.st_rdev == rootstat.st_rdev) then you have a match. + * Works fine. + */ +#include +#include +#include "mount_guess_rootdev.h" + +#define PROC_CMDLINE "/proc/cmdline" + +static char * +rootdev(char *p) { + unsigned long devno; + char *ep; + char *type = "hd"; + char let; + int ma, mi; + char devname[8]; + + devno = strtoul(p, &ep, 16); + if ((ep == p+3 || ep == p+4) && (*ep == ' ' || *ep == 0)) { + ma = (devno >> 8); + mi = (devno & 0xff); + switch(ma) { + case 8: + type = "sd"; + let = 'a'+(mi/16); + mi = mi%16; + break; + case 3: + let = 'a'; break; + case 0x16: + let = 'c'; break; + case 0x21: + let = 'e'; break; + case 0x22: + let = 'g'; break; + case 0x38: + let = 'i'; break; + case 0x39: + let = 'k'; break; + default: + return NULL; + } + if (mi & 0x40) { + mi -= 0x40; + let++; + } + if (mi == 0) + sprintf(devname, "/dev/%s%c", type, let); + else + sprintf(devname, "/dev/%s%c%d", type, let, mi); + return strdup(devname); + } + return NULL; +} + +char * +mount_guess_rootdev() { + FILE *cf; + char line[1024]; + char *p; + + cf = fopen(PROC_CMDLINE, "r"); + if (cf && fgets(line, sizeof(line), cf)) { + for (p = line; *p; p++) + if (!strncmp(p, " root=", 6)) + return rootdev(p+6); + } + return NULL; +} + +#if 0 +main(){ + char *p = mount_guess_rootdev(); + if (!p) + p = "/dev/root"; + printf("%s\n", p); +} +#endif diff --git a/mount/mount_guess_rootdev.h b/mount/mount_guess_rootdev.h new file mode 100644 index 0000000000..41b3270376 --- /dev/null +++ b/mount/mount_guess_rootdev.h @@ -0,0 +1 @@ +extern char *mount_guess_rootdev(void); diff --git a/mount/nfs_mount4.h b/mount/nfs_mount4.h index 0e3b052bde..85650773a4 100644 --- a/mount/nfs_mount4.h +++ b/mount/nfs_mount4.h @@ -50,4 +50,5 @@ struct nfs_mount_data { #define NFS_MOUNT_VER3 0x0080 /* 3 */ #define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ #define NFS_MOUNT_NONLM 0x0200 /* 3 */ +#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ diff --git a/mount/nfsmount.c b/mount/nfsmount.c index bf4be63694..6fc917db51 100644 --- a/mount/nfsmount.c +++ b/mount/nfsmount.c @@ -58,6 +58,13 @@ #include "../defines.h" /* for HAVE_inet_aton */ +#ifndef NFS_PORT +#define NFS_PORT 2049 +#endif +#ifndef NFS_FHSIZE +#define NFS_FHSIZE 32 +#endif + static char *nfs_strerror(int stat); #define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) @@ -90,7 +97,6 @@ int nfs_mount_version = NFS_MOUNT_VERSION; * and figure out what version the kernel expects. * * Variables: - * KERNEL_NFS_MOUNT_VERSION: kernel sources at compile time * NFS_MOUNT_VERSION: these nfsmount sources at compile time * nfs_mount_version: version this source and running kernel can handle */ @@ -106,6 +112,10 @@ find_kernel_nfs_mount_version(void) { if (kernel_version) { if (kernel_version < MAKE_VERSION(2,1,32)) nfs_mount_version = 1; + else if (kernel_version < MAKE_VERSION(2,2,18)) + nfs_mount_version = 3; + else if (kernel_version < MAKE_VERSION(2,3,0)) + nfs_mount_version = 4; /* since 2.2.18pre9 */ else if (kernel_version < MAKE_VERSION(2,3,99)) nfs_mount_version = 3; else @@ -201,6 +211,7 @@ int nfsmount(const char *spec, const char *node, int *flags, int nocto; int noac; int nolock; + int broken_suid; int retry; int tcp; int mountprog; @@ -297,6 +308,7 @@ int nfsmount(const char *spec, const char *node, int *flags, posix = 0; nocto = 0; nolock = 0; + broken_suid = 0; noac = 0; retry = 10000; /* 10000 minutes ~ 1 week */ tcp = 0; @@ -407,6 +419,8 @@ int nfsmount(const char *spec, const char *node, int *flags, nolock = !val; else printf(_("Warning: option nolock is not supported.\n")); + } else if (!strcmp(opt, "broken_suid")) { + broken_suid = val; } else { if (!sloppy) { printf(_("unknown nfs mount option: " @@ -430,6 +444,10 @@ int nfsmount(const char *spec, const char *node, int *flags, #if NFS_MOUNT_VERSION >= 3 if (nfs_mount_version >= 3) data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); +#endif +#if NFS_MOUNT_VERSION >= 4 + if (nfs_mount_version >= 4) + data.flags |= (broken_suid ? NFS_MOUNT_BROKEN_SUID : 0); #endif if (nfsvers > MAX_NFSPROT) { fprintf(stderr, "NFSv%d not supported!\n", nfsvers); diff --git a/mount/pivot_root.c b/mount/pivot_root.c index 4ab8be853b..fd4bef9dfd 100644 --- a/mount/pivot_root.c +++ b/mount/pivot_root.c @@ -6,7 +6,7 @@ #include #include - +static _syscall2(int,pivot_root,const char *,new_root,const char *,put_old) diff --git a/mount/umount.8 b/mount/umount.8 index 08d39888d6..0b67314c53 100644 --- a/mount/umount.8 +++ b/mount/umount.8 @@ -67,6 +67,10 @@ Unmount without writing in .B \-r In case unmounting fails, try to remount read-only. .TP +.B \-d +In case the unmounted device was a loop device, also +free this loop device. +.TP .B \-a All of the file systems described in .I /etc/mtab @@ -92,7 +96,8 @@ The .B umount command will free the loop device (if any) associated with the mount, in case it finds the option `loop=...' in -.IR /etc/mtab . +.IR /etc/mtab , +or when the \-d option was given. Any pending loop devices can be freed using `losetup -d', see .BR losetup (8). diff --git a/mount/umount.c b/mount/umount.c index 98a1d330a1..24622bc985 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -16,18 +16,21 @@ * 960223: aeb - several minor changes * 960324: aeb - added some changes from Rob Leslie * 960823: aeb - also try umount(spec) when umount(node) fails - * 970307: aeb - canonise names from fstab + * 970307: aeb - canonicalise names from fstab * 970726: aeb - remount read-only in cases where umount fails * 980810: aeb - umount2 support * 981222: aeb - If mount point or special file occurs several times * in mtab, try them all, with last one tried first * - Differentiate "user" and "users" key words in fstab + * 001202: aeb - remove at most one line from /etc/mtab */ +#include #include #include #include #include +#include #include #include #include "mount_constants.h" @@ -88,7 +91,10 @@ int remount = 0; /* Don't write a entry in /etc/mtab (-n). */ int nomtab = 0; -/* Nonzero for chatty (-v). This is a nonstandard flag (not in BSD). */ +/* Call losetup -d for each unmounted loop device. */ +int delloop = 0; + +/* Nonzero for chatty (-v). */ int verbose = 0; /* True if ruid != euid. */ @@ -107,6 +113,7 @@ nfs_umount_rpc_call(const char *spec, const char *opts) struct sockaddr_in saddr; struct timeval pertry, try; enum clnt_stat clnt_stat; + int port = 0; int so = RPC_ANYSOCK; struct hostent *hostp; char *hostname; @@ -131,6 +138,9 @@ nfs_umount_rpc_call(const char *spec, const char *opts) hostname = xstrndup(p,q-p); } + if (opts && (p = strstr(opts, "mountport=")) && isdigit(*(p+10))) + port = atoi(p+10); + if (hostname[0] >= '0' && hostname[0] <= '9') saddr.sin_addr.s_addr = inet_addr(hostname); else { @@ -147,7 +157,7 @@ nfs_umount_rpc_call(const char *spec, const char *opts) } saddr.sin_family = AF_INET; - saddr.sin_port = 0; + saddr.sin_port = htons(port); pertry.tv_sec = 3; pertry.tv_usec = 0; if ((clp = clntudp_create(&saddr, MOUNTPROG, MOUNTVERS, @@ -202,134 +212,147 @@ static void complain(int err, const char *dev) { on a non-fatal error. We lock/unlock around each umount. */ static int umount_one (const char *spec, const char *node, const char *type, - const char *opts, struct mntentchn *mc) -{ - int umnt_err, umnt_err2; - int isroot; - int res; - - /* Special case for root. As of 0.99pl10 we can (almost) unmount root; - the kernel will remount it readonly so that we can carry on running - afterwards. The readonly remount is illegal if any files are opened - for writing at the time, so we can't update mtab for an unmount of - root. As it is only really a remount, this doesn't matter too - much. [sct May 29, 1993] */ - isroot = (streq (node, "/") || streq (node, "root") - || streq (node, "rootfs")); - if (isroot) - nomtab++; + const char *opts, struct mntentchn *mc) { + int umnt_err, umnt_err2; + int isroot; + int res; + const char *loopdev; + + /* Special case for root. As of 0.99pl10 we can (almost) unmount root; + the kernel will remount it readonly so that we can carry on running + afterwards. The readonly remount is illegal if any files are opened + for writing at the time, so we can't update mtab for an unmount of + root. As it is only really a remount, this doesn't matter too + much. [sct May 29, 1993] */ + isroot = (streq (node, "/") || streq (node, "root") + || streq (node, "rootfs")); + if (isroot) + nomtab++; #ifdef HAVE_NFS - /* Ignore any RPC errors, so that you can umount the filesystem - if the server is down. */ - if (strcasecmp(type, "nfs") == 0) - nfs_umount_rpc_call(spec, opts); + /* Ignore any RPC errors, so that you can umount the filesystem + if the server is down. */ + if (strcasecmp(type, "nfs") == 0) + nfs_umount_rpc_call(spec, opts); #endif - umnt_err = umnt_err2 = 0; - if (force) { - /* completely untested - 2.1.116 only has some support in nfs case */ - /* probably this won't work */ - int flags = MNT_FORCE; - - res = umount2 (node, flags); - if (res == -1) { - perror("umount2"); - if (errno == ENOSYS) { - if (verbose) - printf(_("no umount2, trying umount...\n")); - res = umount (node); - } - } - } else - res = umount (node); - if (res < 0) { - umnt_err = errno; - /* A device might have been mounted on a node that has since - been deleted or renamed, so if node fails, also try spec. */ - /* if (umnt_err == ENOENT || umnt_err == EINVAL) */ - if (umnt_err != EBUSY && strcmp(node, spec)) { - if (verbose) - printf (_("could not umount %s - trying %s instead\n"), - node, spec); - res = umount (spec); - if (res < 0) - umnt_err2 = errno; - /* Do not complain about remote NFS mount points */ - if (errno == ENOENT && index(spec, ':')) - umnt_err2 = 0; - } - } - - if (res < 0 && remount && (umnt_err == EBUSY || umnt_err2 == EBUSY)) { - /* Umount failed - let us try a remount */ - res=mount(spec, node, NULL, MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); - if (res == 0) { - struct mntent remnt; - fprintf(stderr, _("umount: %s busy - remounted read-only\n"), spec); - remnt.mnt_type = remnt.mnt_fsname = NULL; - remnt.mnt_dir = xstrdup(node); - remnt.mnt_opts = "ro"; - update_mtab(node, &remnt); - return 0; - } else if (errno != EBUSY) { /* hmm ... */ - perror("remount"); - fprintf(stderr, _("umount: could not remount %s read-only\n"), - spec); - } - } - - if (res >= 0) { - /* Umount succeeded, update mtab. */ - if (verbose) - printf (_("%s umounted\n"), spec); - - if (!nomtab && mtab_is_writable()) { - /* Special stuff for loop devices */ - if (mc) { - char *optl; - - /* old style mtab line? */ - if (streq(mc->mnt_type, "loop")) - if (del_loop(spec)) - goto fail; - - /* new style mtab line? */ - optl = mc->mnt_opts ? xstrdup(mc->mnt_opts) : ""; - for (optl = strtok (optl, ","); optl; optl = strtok (NULL, ",")) { - if (!strncmp(optl, "loop=", 5)) { - if (del_loop(optl+5)) - goto fail; - break; - } - } - } else { - /* maybe spec is a loop device? */ - /* no del_loop() - just delete it from mtab */ - if ((mc = getmntoptfile (spec)) != NULL) - node = mc->mnt_dir; - } - - /* Non-loop stuff */ - update_mtab (node, NULL); - } - return 0; - } - -fail: - /* Umount or del_loop failed, complain, but don't die. */ - if (!nomtab) { - /* remove obsolete entry */ - if (umnt_err == EINVAL || umnt_err == ENOENT) - update_mtab (node, NULL); - } + umnt_err = umnt_err2 = 0; + if (force) { + /* completely untested; + 2.1.116 only has some support in nfs case */ + /* probably this won't work */ + int flags = MNT_FORCE; + + res = umount2 (node, flags); + if (res == -1) { + perror("umount2"); + if (errno == ENOSYS) { + if (verbose) + printf(_("no umount2, trying umount...\n")); + res = umount (node); + } + } + } else + res = umount (node); + + if (res < 0) { + umnt_err = errno; + /* A device might have been mounted on a node that has since + been deleted or renamed, so if node fails, also try spec. */ + /* Note that this is incorrect in case spec was mounted + several times. */ + /* if (umnt_err == ENOENT || umnt_err == EINVAL) */ + if (umnt_err != EBUSY && strcmp(node, spec)) { + if (verbose) + printf (_("could not umount %s - trying %s instead\n"), + node, spec); + res = umount (spec); + if (res < 0) + umnt_err2 = errno; + /* Do not complain about remote NFS mount points */ + if (errno == ENOENT && index(spec, ':')) + umnt_err2 = 0; + } + } + + if (res < 0 && remount && (umnt_err == EBUSY || umnt_err2 == EBUSY)) { + /* Umount failed - let us try a remount */ + res = mount(spec, node, NULL, + MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); + if (res == 0) { + struct mntent remnt; + fprintf(stderr, + _("umount: %s busy - remounted read-only\n"), + spec); + remnt.mnt_type = remnt.mnt_fsname = NULL; + remnt.mnt_dir = xstrdup(node); + remnt.mnt_opts = "ro"; + update_mtab(node, &remnt); + return 0; + } else if (errno != EBUSY) { /* hmm ... */ + perror("remount"); + fprintf(stderr, + _("umount: could not remount %s read-only\n"), + spec); + } + } + + loopdev = 0; + if (res >= 0) { + /* Umount succeeded */ + if (verbose) + printf (_("%s umounted\n"), spec); + + /* Free any loop devices that we allocated ourselves */ + if (mc) { + char *optl; + + /* old style mtab line? */ + if (streq(mc->m.mnt_type, "loop")) { + loopdev = spec; + goto gotloop; + } + + /* new style mtab line? */ + optl = mc->m.mnt_opts ? xstrdup(mc->m.mnt_opts) : ""; + for (optl = strtok (optl, ","); optl; + optl = strtok (NULL, ",")) { + if (!strncmp(optl, "loop=", 5)) { + loopdev = optl+5; + goto gotloop; + } + } + } else { + /* + * If option "-o loop=spec" occurs in mtab, + * note the mount point, and delete mtab line. + */ + if ((mc = getmntoptfile (spec)) != NULL) + node = mc->m.mnt_dir; + } + + /* Also free loop devices when -d flag is given */ + if (delloop && is_loop_device(spec)) + loopdev = spec; + } + gotloop: + if (loopdev) + del_loop(loopdev); + + if (!nomtab && mtab_is_writable() && + (umnt_err == 0 || umnt_err == EINVAL || umnt_err == ENOENT)) { + update_mtab (node, NULL); + } + + if (res >= 0) + return 0; - if (umnt_err2) - complain(umnt_err2, spec); - if (umnt_err && umnt_err != umnt_err2) - complain(umnt_err, node); - return 1; + if (umnt_err2) + complain(umnt_err2, spec); + if (umnt_err && umnt_err != umnt_err2) + complain(umnt_err, node); + return 1; } /* @@ -347,8 +370,8 @@ umount_one_bw (const char *file, struct mntentchn *mc) { int res = 1; while (res && mc) { - res = umount_one(mc->mnt_fsname, mc->mnt_dir, - mc->mnt_type, mc->mnt_opts, mc); + res = umount_one(mc->m.mnt_fsname, mc->m.mnt_dir, + mc->m.mnt_type, mc->m.mnt_opts, mc); mc = getmntfilesbackward (file, mc); } return res; @@ -368,9 +391,9 @@ umount_all (string_list types) { if (!hd->prev) die (2, _("umount: cannot find list of filesystems to unmount")); for (mc = hd->prev; mc != hd; mc = mc->prev) { - if (matching_type (mc->mnt_type, types)) { - errors |= umount_one (mc->mnt_fsname, mc->mnt_dir, - mc->mnt_type, mc->mnt_opts, mc); + if (matching_type (mc->m.mnt_type, types)) { + errors |= umount_one (mc->m.mnt_fsname, mc->m.mnt_dir, + mc->m.mnt_type, mc->m.mnt_opts, mc); } } @@ -424,6 +447,10 @@ main (int argc, char *argv[]) case 'a': /* umount everything */ ++all; break; + /* fall through? */ + case 'd': /* do losetup -d for unmounted loop devices */ + ++delloop; + break; case 'f': /* force umount */ ++force; break; @@ -489,7 +516,7 @@ main (int argc, char *argv[]) then "mount /dev/sda4" followed by "umount /mnt/zip" used to fail. So, we must not look for file, but for the pair (spec,file) in fstab. */ - fs = getfsspecfile(mc->mnt_fsname, mc->mnt_dir); + fs = getfsspecfile(mc->m.mnt_fsname, mc->m.mnt_dir); if (!fs) { if (!getfsspec (file) && !getfsfile (file)) die (2, @@ -508,7 +535,7 @@ main (int argc, char *argv[]) /* The option `owner' only allows (un)mounting by the owner. */ /* A convenient side effect is that the user who mounted is visible in mtab. */ - options = parse_list (fs->mnt_opts); + options = parse_list (fs->m.mnt_opts); while (options) { if (streq (car (options), "user") || streq (car (options), "users") || @@ -518,18 +545,18 @@ main (int argc, char *argv[]) } if (!options) die (2, _("umount: only root can unmount %s from %s"), - fs->mnt_fsname, fs->mnt_dir); + fs->m.mnt_fsname, fs->m.mnt_dir); if (streq (car (options), "user") || streq (car (options), "owner")) { char *user = getusername(); - options = parse_list (mc->mnt_opts); + options = parse_list (mc->m.mnt_opts); while (options) { char *co = car (options); if (!strncmp(co, "user=", 5)) { if (!user || !streq(co+5,user)) die(2, _("umount: only %s can unmount %s from %s"), - co+5, fs->mnt_fsname, fs->mnt_dir); + co+5, fs->m.mnt_fsname, fs->m.mnt_dir); break; } options = cdr (options); diff --git a/po/Makefile b/po/Makefile index 3e59fedc80..a93f77553a 100644 --- a/po/Makefile +++ b/po/Makefile @@ -13,12 +13,8 @@ INTL = /usr/share/gettext/intl SHELL = /bin/sh -prefix = $(DESTDIR)/usr -exec_prefix = ${prefix} -datadir = $(prefix)/share -localedir = $(datadir)/locale -gnulocaledir = $(prefix)/share/locale -gettextsrcdir = $(prefix)/share/gettext/po +localedir = $(LOCALEDIR) +gnulocaledir = $(LOCALEDIR) # Not giving an explicit path improves the chances of finding this INSTALL = install -c @@ -26,7 +22,7 @@ INSTALL_DATA = ${INSTALL} -m 644 # Not giving an explicit path improves the chances of finding these GENCAT = gencat -MSGFMT = msgfmt +MSGFMT = msgfmt -c # -c: undocumented, but useful option XGETTEXT = xgettext MSGMERGE = msgmerge @@ -38,9 +34,9 @@ INCLUDES = -I.. -I$(INTL) COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) # Enter here all .po files -POFILES = cs.po de.po es.po fr.po it.po ja.po nl.po pt_BR.po +POFILES = cs.po da.po de.po es.po fr.po it.po ja.po nl.po pt_BR.po # the same but with .gmo -GMOFILES = cs.gmo de.gmo es.gmo fr.gmo it.gmo ja.gmo nl.gmo pt_BR.gmo +GMOFILES = cs.gmo da.gmo de.gmo es.gmo fr.gmo it.gmo ja.gmo nl.gmo pt_BR.gmo CATALOGS = $(GMOFILES) CATOBJEXT = .gmo @@ -90,7 +86,6 @@ stamp-cat-id: util-linux.pot install: install-data-$(HAVE_XGETTEXT) install-data-no: all install-data-yes: all - ../mkinstalldirs $(datadir); @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ case "$$cat" in \ @@ -117,7 +112,6 @@ uninstall: rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/util-linux$(INSTOBJEXT); \ rm -f $(gnulocaledir)/$$lang/LC_MESSAGES/util-linux$(INSTOBJEXT).m; \ done - rm -f $(gettextsrcdir)/po-Makefile.in.in cat-id-tbl.o: $(INTL)/libgettext.h diff --git a/po/POTFILES.in b/po/POTFILES.in index 7ea5b80525..6ce99166c8 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,11 +1,12 @@ -clock/cmos.c -clock/hwclock.c -clock/kd.c -clock/rtc.c -clock/shhopt.c +hwclock/cmos.c +hwclock/hwclock.c +hwclock/kd.c +hwclock/rtc.c +hwclock/shhopt.c disk-utils/blockdev.c disk-utils/fdformat.c disk-utils/fsck.minix.c +disk-utils/isosize.c disk-utils/mkfs.c disk-utils/mkfs.minix.c disk-utils/mkswap.c @@ -20,7 +21,7 @@ fdisk/i386_sys_types.c fdisk/llseek.c fdisk/sfdisk.c games/banner.c -getopt-1.0.3b/getopt.c +getopt-1.1.0a/getopt.c lib/env.c lib/err.c lib/my_reboot.c diff --git a/po/cat-id-tbl.c b/po/cat-id-tbl.c index b5f9b13421..42dc43ade5 100644 --- a/po/cat-id-tbl.c +++ b/po/cat-id-tbl.c @@ -126,7 +126,7 @@ Functions:\n\ Options: \n\ --utc the hardware clock is kept in coordinated universal time\n\ --localtime the hardware clock is kept in local time\n\ - --directisa access the ISA bus directly instead of /dev/rtc\n\ + --directisa access the ISA bus directly instead of %s\n\ --badyear ignore rtc's year because the bios is broken\n\ --date specifies the time to which to set the hardware clock\n\ --epoch=year specifies the year which is the beginning of the \n\ @@ -159,29 +159,28 @@ method.\n", 74}, {"ioctl() to open /dev/tty1 failed", 80}, {"KDGHWCLK ioctl failed", 81}, {"Can't open /dev/tty1", 82}, - {"ioctl() to /dev/rtc to read the time failed.\n", 83}, - {"Waiting in loop for time from /dev/rtc to change\n", 84}, - {"open() of /dev/rtc failed", 85}, - {"/dev/rtc does not have interrupt functions. ", 86}, - {"read() to /dev/rtc to wait for clock tick failed", 87}, - {"ioctl() to /dev/rtc to turn off update interrupts failed", 88}, - {"ioctl() to /dev/rtc to turn on update interrupts failed unexpectedly", 89}, - {"Unable to open /dev/rtc", 90}, - {"ioctl() to /dev/rtc to set the time failed.\n", 91}, + {"ioctl() to %s to read the time failed.\n", 83}, + {"Waiting in loop for time from %s to change\n", 84}, + {"open() of %s failed", 85}, + {"%s does not have interrupt functions. ", 86}, + {"read() to %s to wait for clock tick failed", 87}, + {"ioctl() to %s to turn off update interrupts failed", 88}, + {"ioctl() to %s to turn on update interrupts failed unexpectedly", 89}, + {"Unable to open %s", 90}, + {"ioctl() to %s to set the time failed.\n", 91}, {"ioctl(%s) was successful.\n", 92}, - {"Open of /dev/rtc failed", 93}, + {"Open of %s failed", 93}, {"\ To manipulate the epoch value in the kernel, we must access the Linux 'rtc' \ -device driver via the device special file /dev/rtc. This file does not \ -exist on this system.\n", 94}, - {"ioctl(RTC_EPOCH_READ) to /dev/rtc failed", 95}, - {"we have read epoch %ld from /dev/rtc with RTC_EPOCH_READ ioctl.\n", 96}, +device driver via the device special file %s. This file does not exist on \ +this system.\n", 94}, + {"ioctl(RTC_EPOCH_READ) to %s failed", 95}, + {"we have read epoch %ld from %s with RTC_EPOCH_READ ioctl.\n", 96}, {"The epoch value may not be less than 1900. You requested %ld\n", 97}, - {"setting epoch to %ld with RTC_EPOCH_SET ioctl to /dev/rtc.\n", 98}, + {"setting epoch to %ld with RTC_EPOCH_SET ioctl to %s.\n", 98}, {"\ -The kernel device driver for /dev/rtc does not have the RTC_EPOCH_SET \ -ioctl.\n", 99}, - {"ioctl(RTC_EPOCH_SET) to /dev/rtc failed", 100}, +The kernel device driver for %s does not have the RTC_EPOCH_SET ioctl.\n", 99}, + {"ioctl(RTC_EPOCH_SET) to %s failed", 100}, {"invalid number `%s'\n", 101}, {"number `%s' to `%s' out of range\n", 102}, {"unrecognized option `%s'\n", 103}, @@ -311,267 +310,273 @@ namelen=%d\n\ ----------------------------\n\ FILE SYSTEM HAS BEEN CHANGED\n\ ----------------------------\n", 209}, - {"Usage: mkfs [-V] [-t fstype] [fs-options] device [size]\n", 210}, - {"%s: Out of memory!\n", 211}, - {"mkfs version %s (%s)\n", 212}, - {"Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n", 213}, - {"%s is mounted; will not make a filesystem here!", 214}, - {"seek to boot block failed in write_tables", 215}, - {"unable to clear boot sector", 216}, - {"seek failed in write_tables", 217}, - {"unable to write inode map", 218}, - {"unable to write zone map", 219}, - {"unable to write inodes", 220}, - {"write failed in write_block", 221}, - {"too many bad blocks", 222}, - {"not enough good blocks", 223}, - {"unable to allocate buffers for maps", 224}, - {"unable to allocate buffer for inodes", 225}, + {"%s: failed to open: %s\n", 210}, + {"%s: seek error on %s\n", 211}, + {"%s: read error on %s\n", 212}, + {"sector count: %d, sector size: %d\n", 213}, + {"%s: option parse error\n", 214}, + {"Usage: %s [-x] [-d ] iso9660-image\n", 215}, + {"Usage: mkfs [-V] [-t fstype] [fs-options] device [size]\n", 216}, + {"%s: Out of memory!\n", 217}, + {"mkfs version %s (%s)\n", 218}, + {"Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]\n", 219}, + {"%s is mounted; will not make a filesystem here!", 220}, + {"seek to boot block failed in write_tables", 221}, + {"unable to clear boot sector", 222}, + {"seek failed in write_tables", 223}, + {"unable to write inode map", 224}, + {"unable to write zone map", 225}, + {"unable to write inodes", 226}, + {"write failed in write_block", 227}, + {"too many bad blocks", 228}, + {"not enough good blocks", 229}, + {"unable to allocate buffers for maps", 230}, + {"unable to allocate buffer for inodes", 231}, {"\ Maxsize=%ld\n\ -\n", 226}, - {"seek failed during testing of blocks", 227}, - {"Weird values in do_check: probably bugs\n", 228}, - {"seek failed in check_blocks", 229}, - {"bad blocks before data-area: cannot make fs", 230}, - {"%d bad blocks\n", 231}, - {"one bad block\n", 232}, - {"can't open file of bad blocks", 233}, - {"%s: not compiled with minix v2 support\n", 234}, - {"strtol error: number of blocks not specified", 235}, - {"unable to open %s", 236}, - {"unable to stat %s", 237}, - {"will not try to make filesystem on '%s'", 238}, - {"Bad user-specified page size %d\n", 239}, - {"Using user-specified page size %d, instead of the system values %d/%d\n", 240}, - {"Assuming pages of size %d (not %d)\n", 241}, - {"Usage: %s [-c] [-v0|-v1] [-pPAGESZ] /dev/name [blocks]\n", 242}, - {"too many bad pages", 243}, - {"Out of memory", 244}, - {"one bad page\n", 245}, - {"%d bad pages\n", 246}, - {"%s: error: Nowhere to set up swap on?\n", 247}, - {"%s: error: size %ld is larger than device size %d\n", 248}, - {"%s: error: unknown version %d\n", 249}, - {"%s: error: swap area needs to be at least %ldkB\n", 250}, - {"%s: warning: truncating swap area to %ldkB\n", 251}, - {"Will not try to make swapdevice on '%s'", 252}, - {"fatal: first page unreadable", 253}, +\n", 232}, + {"seek failed during testing of blocks", 233}, + {"Weird values in do_check: probably bugs\n", 234}, + {"seek failed in check_blocks", 235}, + {"bad blocks before data-area: cannot make fs", 236}, + {"%d bad blocks\n", 237}, + {"one bad block\n", 238}, + {"can't open file of bad blocks", 239}, + {"%s: not compiled with minix v2 support\n", 240}, + {"strtol error: number of blocks not specified", 241}, + {"unable to open %s", 242}, + {"unable to stat %s", 243}, + {"will not try to make filesystem on '%s'", 244}, + {"Bad user-specified page size %d\n", 245}, + {"Using user-specified page size %d, instead of the system values %d/%d\n", 246}, + {"Assuming pages of size %d (not %d)\n", 247}, + {"Usage: %s [-c] [-v0|-v1] [-pPAGESZ] /dev/name [blocks]\n", 248}, + {"too many bad pages", 249}, + {"Out of memory", 250}, + {"one bad page\n", 251}, + {"%d bad pages\n", 252}, + {"%s: error: Nowhere to set up swap on?\n", 253}, + {"%s: error: size %ld is larger than device size %d\n", 254}, + {"%s: error: unknown version %d\n", 255}, + {"%s: error: swap area needs to be at least %ldkB\n", 256}, + {"%s: warning: truncating swap area to %ldkB\n", 257}, + {"Will not try to make swapdevice on '%s'", 258}, + {"fatal: first page unreadable", 259}, {"\ %s: Device '%s' contains a valid Sun disklabel.\n\ This probably means creating v0 swap would destroy your partition table\n\ No swap created. If you really want to create swap v0 on that device, use\n\ -the -f option to force it.\n", 254}, - {"Unable to set up swap-space: unreadable", 255}, - {"Setting up swapspace version %d, size = %ld bytes\n", 256}, - {"unable to rewind swap-device", 257}, - {"unable to write signature page", 258}, - {"fsync failed", 259}, - {"Invalid number: %s\n", 260}, - {"Syntax error: '%s'\n", 261}, - {"No such parameter set: '%s'\n", 262}, - {"usage: %s [ -p ] dev name\n", 263}, - {"\ - %s [ -p ] dev size sect heads tracks stretch gap rate spec1 fmt_gap\n", 264}, - {" %s [ -c | -y | -n | -d ] dev\n", 265}, - {" %s [ -c | -y | -n ] dev\n", 266}, - {"Unusable", 267}, - {"Free Space", 268}, - {"Linux ext2", 269}, - {"Linux", 270}, - {"OS/2 HPFS", 271}, - {"OS/2 IFS", 272}, - {"NTFS", 273}, - {"Disk has been changed.\n", 274}, - {"Reboot the system to ensure the partition table is correctly updated.\n", 275}, +the -f option to force it.\n", 260}, + {"Unable to set up swap-space: unreadable", 261}, + {"Setting up swapspace version %d, size = %ld bytes\n", 262}, + {"unable to rewind swap-device", 263}, + {"unable to write signature page", 264}, + {"fsync failed", 265}, + {"Invalid number: %s\n", 266}, + {"Syntax error: '%s'\n", 267}, + {"No such parameter set: '%s'\n", 268}, + {"usage: %s [ -p ] dev name\n", 269}, + {"\ + %s [ -p ] dev size sect heads tracks stretch gap rate spec1 fmt_gap\n", 270}, + {" %s [ -c | -y | -n | -d ] dev\n", 271}, + {" %s [ -c | -y | -n ] dev\n", 272}, + {"Unusable", 273}, + {"Free Space", 274}, + {"Linux ext2", 275}, + {"Linux", 276}, + {"OS/2 HPFS", 277}, + {"OS/2 IFS", 278}, + {"NTFS", 279}, + {"Disk has been changed.\n", 280}, + {"Reboot the system to ensure the partition table is correctly updated.\n", 281}, {"\ \n\ WARNING: If you have created or modified any\n\ DOS 6.x partitions, please see the cfdisk manual\n\ -page for additional information.\n", 276}, - {"FATAL ERROR", 277}, - {"Press any key to exit cfdisk", 278}, - {"Cannot seek on disk drive", 279}, - {"Cannot read disk drive", 280}, - {"Cannot write disk drive", 281}, - {"Too many partitions", 282}, - {"Partition begins before sector 0", 283}, - {"Partition ends before sector 0", 284}, - {"Partition begins after end-of-disk", 285}, - {"Partition ends after end-of-disk", 286}, - {"logical partitions not in disk order", 287}, - {"logical partitions overlap", 288}, - {"enlarged logical partitions overlap", 289}, - {"\ -!!!! Internal error creating logical drive with no extended partition !!!!", 290}, - {"\ -Cannot create logical drive here -- would create two extended partitions", 291}, - {"Menu item too long. Menu may look odd.", 292}, - {"Menu without direction. Defaulting horizontal.", 293}, - {"Illegal key", 294}, - {"Press a key to continue", 295}, - {"Primary", 296}, - {"Create a new primary partition", 297}, - {"Logical", 298}, - {"Create a new logical partition", 299}, - {"Cancel", 300}, - {"Don't create a partition", 301}, - {"!!! Internal error !!!", 302}, - {"Size (in MB): ", 303}, - {"Beginning", 304}, - {"Add partition at beginning of free space", 305}, - {"End", 306}, - {"Add partition at end of free space", 307}, - {"No room to create the extended partition", 308}, - {"Bad signature on partition table", 309}, - {"You specified more cylinders than fit on disk", 310}, - {"Cannot open disk drive", 311}, - {"Opened disk read-only - you have no permission to write", 312}, - {"Cannot get disk size", 313}, - {"Bad primary partition", 314}, - {"Bad logical partition", 315}, - {"Warning!! This may destroy data on your disk!", 316}, - {"Are you sure you want write the partition table to disk? (yes or no): ", 317}, - {"no", 318}, - {"Did not write partition table to disk", 319}, - {"yes", 320}, - {"Please enter `yes' or `no'", 321}, - {"Writing partition table to disk...", 322}, - {"Wrote partition table to disk", 323}, - {"\ -Wrote partition table, but re-read table failed. Reboot to update table.", 324}, - {"\ -Not precisely one primary partition is bootable. DOS MBR cannot boot this.", 325}, - {"Enter filename or press RETURN to display on screen: ", 326}, - {"Cannot open file '%s'", 327}, - {"Disk Drive: %s\n", 328}, - {"Sector 0:\n", 329}, - {"Sector %d:\n", 330}, - {" None ", 331}, - {" Pri/Log", 332}, - {" Primary", 333}, - {" Logical", 334}, - {"Unknown", 335}, - {"Boot (%02X)", 336}, - {"Unknown (%02X)", 337}, - {"None (%02X)", 338}, - {"Partition Table for %s\n", 339}, - {" First Last\n", 340}, - {"\ - # Type Sector Sector Offset Length Filesystem Type (ID) Flags\n", 341}, +page for additional information.\n", 282}, + {"FATAL ERROR", 283}, + {"Press any key to exit cfdisk", 284}, + {"Cannot seek on disk drive", 285}, + {"Cannot read disk drive", 286}, + {"Cannot write disk drive", 287}, + {"Too many partitions", 288}, + {"Partition begins before sector 0", 289}, + {"Partition ends before sector 0", 290}, + {"Partition begins after end-of-disk", 291}, + {"Partition ends after end-of-disk", 292}, + {"logical partitions not in disk order", 293}, + {"logical partitions overlap", 294}, + {"enlarged logical partitions overlap", 295}, + {"\ +!!!! Internal error creating logical drive with no extended partition !!!!", 296}, + {"\ +Cannot create logical drive here -- would create two extended partitions", 297}, + {"Menu item too long. Menu may look odd.", 298}, + {"Menu without direction. Defaulting horizontal.", 299}, + {"Illegal key", 300}, + {"Press a key to continue", 301}, + {"Primary", 302}, + {"Create a new primary partition", 303}, + {"Logical", 304}, + {"Create a new logical partition", 305}, + {"Cancel", 306}, + {"Don't create a partition", 307}, + {"!!! Internal error !!!", 308}, + {"Size (in MB): ", 309}, + {"Beginning", 310}, + {"Add partition at beginning of free space", 311}, + {"End", 312}, + {"Add partition at end of free space", 313}, + {"No room to create the extended partition", 314}, + {"Bad signature on partition table", 315}, + {"You specified more cylinders than fit on disk", 316}, + {"Cannot open disk drive", 317}, + {"Opened disk read-only - you have no permission to write", 318}, + {"Cannot get disk size", 319}, + {"Bad primary partition", 320}, + {"Bad logical partition", 321}, + {"Warning!! This may destroy data on your disk!", 322}, + {"Are you sure you want write the partition table to disk? (yes or no): ", 323}, + {"no", 324}, + {"Did not write partition table to disk", 325}, + {"yes", 326}, + {"Please enter `yes' or `no'", 327}, + {"Writing partition table to disk...", 328}, + {"Wrote partition table to disk", 329}, + {"\ +Wrote partition table, but re-read table failed. Reboot to update table.", 330}, + {"\ +Not precisely one primary partition is bootable. DOS MBR cannot boot this.", 331}, + {"Enter filename or press RETURN to display on screen: ", 332}, + {"Cannot open file '%s'", 333}, + {"Disk Drive: %s\n", 334}, + {"Sector 0:\n", 335}, + {"Sector %d:\n", 336}, + {" None ", 337}, + {" Pri/Log", 338}, + {" Primary", 339}, + {" Logical", 340}, + {"Unknown", 341}, + {"Boot (%02X)", 342}, + {"Unknown (%02X)", 343}, + {"None (%02X)", 344}, + {"Partition Table for %s\n", 345}, + {" First Last\n", 346}, + {"\ + # Type Sector Sector Offset Length Filesystem Type (ID) Flags\n", 347}, {"\ -- ------- -------- --------- ------ --------- ---------------------- \ ----------\n", 342}, - {" ---Starting--- ----Ending---- Start Number of\n", 343}, - {" # Flags Head Sect Cyl ID Head Sect Cyl Sector Sectors\n", 344}, - {"-- ----- ---- ---- ---- ---- ---- ---- ---- -------- ---------\n", 345}, - {"Raw", 346}, - {"Print the table using raw data format", 347}, - {"Sectors", 348}, - {"Print the table ordered by sectors", 349}, - {"Table", 350}, - {"Just print the partition table", 351}, - {"Don't print the table", 352}, - {"Help Screen for cfdisk", 353}, - {"This is cfdisk, a curses based disk partitioning program, which", 354}, - {"allows you to create, delete and modify partitions on your hard", 355}, - {"disk drive.", 356}, - {"Copyright (C) 1994-1999 Kevin E. Martin & aeb", 357}, - {"Command Meaning", 358}, - {"------- -------", 359}, - {" b Toggle bootable flag of the current partition", 360}, - {" d Delete the current partition", 361}, - {" g Change cylinders, heads, sectors-per-track parameters", 362}, - {" WARNING: This option should only be used by people who", 363}, - {" know what they are doing.", 364}, - {" h Print this screen", 365}, - {" m Maximize disk usage of the current partition", 366}, - {" Note: This may make the partition incompatible with", 367}, - {" DOS, OS/2, ...", 368}, - {" n Create new partition from free space", 369}, - {" p Print partition table to the screen or to a file", 370}, - {" There are several different formats for the partition", 371}, - {" that you can choose from:", 372}, - {" r - Raw data (exactly what would be written to disk)", 373}, - {" s - Table ordered by sectors", 374}, - {" t - Table in raw format", 375}, - {" q Quit program without writing partition table", 376}, - {" t Change the filesystem type", 377}, - {" u Change units of the partition size display", 378}, - {" Rotates through MB, sectors and cylinders", 379}, - {" W Write partition table to disk (must enter upper case W)", 380}, - {" Since this might destroy data on the disk, you must", 381}, - {" either confirm or deny the write by entering `yes' or", 382}, - {" `no'", 383}, - {"Up Arrow Move cursor to the previous partition", 384}, - {"Down Arrow Move cursor to the next partition", 385}, - {"CTRL-L Redraws the screen", 386}, - {" ? Print this screen", 387}, - {"Note: All of the commands can be entered with either upper or lower", 388}, - {"case letters (except for Writes).", 389}, - {"Cylinders", 390}, - {"Change cylinder geometry", 391}, - {"Heads", 392}, - {"Change head geometry", 393}, - {"Change sector geometry", 394}, - {"Done", 395}, - {"Done with changing geometry", 396}, - {"Enter the number of cylinders: ", 397}, - {"Illegal cylinders value", 398}, - {"Enter the number of heads: ", 399}, - {"Illegal heads value", 400}, - {"Enter the number of sectors per track: ", 401}, - {"Illegal sectors value", 402}, - {"Enter filesystem type: ", 403}, - {"Cannot change FS Type to empty", 404}, - {"Cannot change FS Type to extended", 405}, - {"Boot", 406}, - {"Unk(%02X)", 407}, - {", NC", 408}, - {"NC", 409}, - {"Pri/Log", 410}, - {"Disk Drive: %s", 411}, - {"Size: %lld bytes", 412}, - {"Heads: %d Sectors per Track: %d Cylinders: %d", 413}, - {"Name", 414}, - {"Flags", 415}, - {"Part Type", 416}, - {"FS Type", 417}, - {"[Label]", 418}, - {" Sectors", 419}, - {"Size (MB)", 420}, - {"Size (GB)", 421}, - {"Bootable", 422}, - {"Toggle bootable flag of the current partition", 423}, - {"Delete", 424}, - {"Delete the current partition", 425}, - {"Geometry", 426}, - {"Change disk geometry (experts only)", 427}, - {"Help", 428}, - {"Print help screen", 429}, - {"Maximize", 430}, - {"Maximize disk usage of the current partition (experts only)", 431}, - {"New", 432}, - {"Create new partition from free space", 433}, - {"Print", 434}, - {"Print partition table to the screen or to a file", 435}, - {"Quit", 436}, - {"Quit program without writing partition table", 437}, - {"Type", 438}, - {"Change the filesystem type (DOS, Linux, OS/2 and so on)", 439}, - {"Units", 440}, - {"Change units of the partition size display (MB, sect, cyl)", 441}, - {"Write", 442}, - {"Write partition table to disk (this might destroy data)", 443}, - {"Cannot make this partition bootable", 444}, - {"Cannot delete an empty partition", 445}, - {"Cannot maximize this partition", 446}, - {"This partition is unusable", 447}, - {"This partition is already in use", 448}, - {"Cannot change the type of an empty partition", 449}, - {"No more partitions", 450}, - {"Illegal command", 451}, - {"Copyright (C) 1994-2000 Kevin E. Martin & aeb\n", 452}, +---------\n", 348}, + {" ---Starting--- ----Ending---- Start Number of\n", 349}, + {" # Flags Head Sect Cyl ID Head Sect Cyl Sector Sectors\n", 350}, + {"-- ----- ---- ---- ---- ---- ---- ---- ---- -------- ---------\n", 351}, + {"Raw", 352}, + {"Print the table using raw data format", 353}, + {"Sectors", 354}, + {"Print the table ordered by sectors", 355}, + {"Table", 356}, + {"Just print the partition table", 357}, + {"Don't print the table", 358}, + {"Help Screen for cfdisk", 359}, + {"This is cfdisk, a curses based disk partitioning program, which", 360}, + {"allows you to create, delete and modify partitions on your hard", 361}, + {"disk drive.", 362}, + {"Copyright (C) 1994-1999 Kevin E. Martin & aeb", 363}, + {"Command Meaning", 364}, + {"------- -------", 365}, + {" b Toggle bootable flag of the current partition", 366}, + {" d Delete the current partition", 367}, + {" g Change cylinders, heads, sectors-per-track parameters", 368}, + {" WARNING: This option should only be used by people who", 369}, + {" know what they are doing.", 370}, + {" h Print this screen", 371}, + {" m Maximize disk usage of the current partition", 372}, + {" Note: This may make the partition incompatible with", 373}, + {" DOS, OS/2, ...", 374}, + {" n Create new partition from free space", 375}, + {" p Print partition table to the screen or to a file", 376}, + {" There are several different formats for the partition", 377}, + {" that you can choose from:", 378}, + {" r - Raw data (exactly what would be written to disk)", 379}, + {" s - Table ordered by sectors", 380}, + {" t - Table in raw format", 381}, + {" q Quit program without writing partition table", 382}, + {" t Change the filesystem type", 383}, + {" u Change units of the partition size display", 384}, + {" Rotates through MB, sectors and cylinders", 385}, + {" W Write partition table to disk (must enter upper case W)", 386}, + {" Since this might destroy data on the disk, you must", 387}, + {" either confirm or deny the write by entering `yes' or", 388}, + {" `no'", 389}, + {"Up Arrow Move cursor to the previous partition", 390}, + {"Down Arrow Move cursor to the next partition", 391}, + {"CTRL-L Redraws the screen", 392}, + {" ? Print this screen", 393}, + {"Note: All of the commands can be entered with either upper or lower", 394}, + {"case letters (except for Writes).", 395}, + {"Cylinders", 396}, + {"Change cylinder geometry", 397}, + {"Heads", 398}, + {"Change head geometry", 399}, + {"Change sector geometry", 400}, + {"Done", 401}, + {"Done with changing geometry", 402}, + {"Enter the number of cylinders: ", 403}, + {"Illegal cylinders value", 404}, + {"Enter the number of heads: ", 405}, + {"Illegal heads value", 406}, + {"Enter the number of sectors per track: ", 407}, + {"Illegal sectors value", 408}, + {"Enter filesystem type: ", 409}, + {"Cannot change FS Type to empty", 410}, + {"Cannot change FS Type to extended", 411}, + {"Boot", 412}, + {"Unk(%02X)", 413}, + {", NC", 414}, + {"NC", 415}, + {"Pri/Log", 416}, + {"Disk Drive: %s", 417}, + {"Size: %lld bytes", 418}, + {"Heads: %d Sectors per Track: %d Cylinders: %d", 419}, + {"Name", 420}, + {"Flags", 421}, + {"Part Type", 422}, + {"FS Type", 423}, + {"[Label]", 424}, + {" Sectors", 425}, + {"Size (MB)", 426}, + {"Size (GB)", 427}, + {"Bootable", 428}, + {"Toggle bootable flag of the current partition", 429}, + {"Delete", 430}, + {"Delete the current partition", 431}, + {"Geometry", 432}, + {"Change disk geometry (experts only)", 433}, + {"Help", 434}, + {"Print help screen", 435}, + {"Maximize", 436}, + {"Maximize disk usage of the current partition (experts only)", 437}, + {"New", 438}, + {"Create new partition from free space", 439}, + {"Print", 440}, + {"Print partition table to the screen or to a file", 441}, + {"Quit", 442}, + {"Quit program without writing partition table", 443}, + {"Type", 444}, + {"Change the filesystem type (DOS, Linux, OS/2 and so on)", 445}, + {"Units", 446}, + {"Change units of the partition size display (MB, sect, cyl)", 447}, + {"Write", 448}, + {"Write partition table to disk (this might destroy data)", 449}, + {"Cannot make this partition bootable", 450}, + {"Cannot delete an empty partition", 451}, + {"Cannot maximize this partition", 452}, + {"This partition is unusable", 453}, + {"This partition is already in use", 454}, + {"Cannot change the type of an empty partition", 455}, + {"No more partitions", 456}, + {"Illegal command", 457}, + {"Copyright (C) 1994-2000 Kevin E. Martin & aeb\n", 458}, {"\ \n\ Usage:\n\ @@ -587,7 +592,7 @@ Options:\n\ -z: Start with a zero partition table, instead of reading the pt from disk;\n\ -c C -h H -s S: Override the kernel's idea of the number of cylinders,\n\ the number of heads and the number of sectors/track.\n\ -\n", 453}, +\n", 459}, {"\ Usage: fdisk [-b SSZ] [-u] DISK Change partition table\n\ fdisk -l [-b SSZ] [-u] DISK List partition table(s)\n\ @@ -596,211 +601,219 @@ Usage: fdisk [-b SSZ] [-u] DISK Change partition table\n\ Here DISK is something like /dev/hdb or /dev/sda\n\ and PARTITION is something like /dev/hda7\n\ -u: give Start and End in sector (instead of cylinder) units\n\ --b 2048: (for certain MO drives) use 2048-byte sectors\n", 454}, +-b 2048: (for certain MO drives) use 2048-byte sectors\n", 460}, {"\ Usage: fdisk [-l] [-b SSZ] [-u] device\n\ E.g.: fdisk /dev/hda (for the first IDE disk)\n\ or: fdisk /dev/sdc (for the third SCSI disk)\n\ or: fdisk /dev/eda (for the first PS/2 ESDI drive)\n\ or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)\n\ - ...\n", 455}, - {"Unable to open %s\n", 456}, - {"Unable to read %s\n", 457}, - {"Unable to seek on %s\n", 458}, - {"Unable to write %s\n", 459}, - {"BLKGETSIZE ioctl failed on %s\n", 460}, - {"Unable to allocate any more memory\n", 461}, - {"Fatal error\n", 462}, - {"Command action", 463}, - {" a toggle a read only flag", 464}, - {" b edit bsd disklabel", 465}, - {" c toggle the mountable flag", 466}, - {" d delete a partition", 467}, - {" l list known partition types", 468}, - {" m print this menu", 469}, - {" n add a new partition", 470}, - {" o create a new empty DOS partition table", 471}, - {" p print the partition table", 472}, - {" q quit without saving changes", 473}, - {" s create a new empty Sun disklabel", 474}, - {" t change a partition's system id", 475}, - {" u change display/entry units", 476}, - {" v verify the partition table", 477}, - {" w write table to disk and exit", 478}, - {" x extra functionality (experts only)", 479}, - {" a select bootable partition", 480}, - {" b edit bootfile entry", 481}, - {" c select sgi swap partition", 482}, - {" a toggle a bootable flag", 483}, - {" c toggle the dos compatibility flag", 484}, - {" a change number of alternate cylinders", 485}, - {" c change number of cylinders", 486}, - {" d print the raw data in the partition table", 487}, - {" e change number of extra sectors per cylinder", 488}, - {" h change number of heads", 489}, - {" i change interleave factor", 490}, - {" o change rotation speed (rpm)", 491}, - {" r return to main menu", 492}, - {" s change number of sectors/track", 493}, - {" y change number of physical cylinders", 494}, - {" b move beginning of data in a partition", 495}, - {" e list extended partitions", 496}, - {" g create an IRIX partition table", 497}, - {" f fix partition order", 498}, - {"You must set", 499}, - {"heads", 500}, - {"sectors", 501}, - {"cylinders", 502}, + ...\n", 461}, + {"Unable to open %s\n", 462}, + {"Unable to read %s\n", 463}, + {"Unable to seek on %s\n", 464}, + {"Unable to write %s\n", 465}, + {"BLKGETSIZE ioctl failed on %s\n", 466}, + {"Unable to allocate any more memory\n", 467}, + {"Fatal error\n", 468}, + {"Command action", 469}, + {" a toggle a read only flag", 470}, + {" b edit bsd disklabel", 471}, + {" c toggle the mountable flag", 472}, + {" d delete a partition", 473}, + {" l list known partition types", 474}, + {" m print this menu", 475}, + {" n add a new partition", 476}, + {" o create a new empty DOS partition table", 477}, + {" p print the partition table", 478}, + {" q quit without saving changes", 479}, + {" s create a new empty Sun disklabel", 480}, + {" t change a partition's system id", 481}, + {" u change display/entry units", 482}, + {" v verify the partition table", 483}, + {" w write table to disk and exit", 484}, + {" x extra functionality (experts only)", 485}, + {" a select bootable partition", 486}, + {" b edit bootfile entry", 487}, + {" c select sgi swap partition", 488}, + {" a toggle a bootable flag", 489}, + {" c toggle the dos compatibility flag", 490}, + {" a change number of alternate cylinders", 491}, + {" c change number of cylinders", 492}, + {" d print the raw data in the partition table", 493}, + {" e change number of extra sectors per cylinder", 494}, + {" h change number of heads", 495}, + {" i change interleave factor", 496}, + {" o change rotation speed (rpm)", 497}, + {" r return to main menu", 498}, + {" s change number of sectors/track", 499}, + {" y change number of physical cylinders", 500}, + {" b move beginning of data in a partition", 501}, + {" e list extended partitions", 502}, + {" g create an IRIX partition table", 503}, + {" f fix partition order", 504}, + {"You must set", 505}, + {"heads", 506}, + {"sectors", 507}, + {"cylinders", 508}, {"\ %s%s.\n\ -You can do this from the extra functions menu.\n", 503}, - {" and ", 504}, - {"Bad offset in primary extended partition\n", 505}, - {"Warning: deleting partitions after %d\n", 506}, - {"Warning: extra link pointer in partition table %d\n", 507}, - {"Warning: ignoring extra data in partition table %d\n", 508}, +You can do this from the extra functions menu.\n", 509}, + {" and ", 510}, + {"\ +\n\ +The number of cylinders for this disk is set to %d.\n\ +There is nothing wrong with that, but this is larger than 1024,\n\ +and could in certain setups cause problems with:\n\ +1) software that runs at boot time (e.g., old versions of LILO)\n\ +2) booting and partitioning software from other OSs\n\ + (e.g., DOS FDISK, OS/2 FDISK)\n", 511}, + {"Bad offset in primary extended partition\n", 512}, + {"Warning: deleting partitions after %d\n", 513}, + {"Warning: extra link pointer in partition table %d\n", 514}, + {"Warning: ignoring extra data in partition table %d\n", 515}, {"\ Building a new DOS disklabel. Changes will remain in memory only,\n\ until you decide to write them. After that, of course, the previous\n\ content won't be recoverable.\n\ -\n", 509}, - {"Note: sector size is %d (not %d)\n", 510}, - {"You will not be able to write the partition table.\n", 511}, +\n", 516}, + {"Note: sector size is %d (not %d)\n", 517}, + {"You will not be able to write the partition table.\n", 518}, {"\ Device contains neither a valid DOS partition table, nor Sun, SGI or OSF \ -disklabel\n", 512}, - {"Internal error\n", 513}, - {"Ignoring extra extended partition %d\n", 514}, +disklabel\n", 519}, + {"Internal error\n", 520}, + {"Ignoring extra extended partition %d\n", 521}, {"\ Warning: invalid flag 0x%04x of partition table %d will be corrected by \ -w(rite)\n", 515}, +w(rite)\n", 522}, {"\ \n\ -got EOF thrice - exiting..\n", 516}, - {"Hex code (type L to list codes): ", 517}, - {"%s (%d-%d, default %d): ", 518}, - {"Using default value %d\n", 519}, - {"Value out of range.\n", 520}, - {"Partition number", 521}, - {"Warning: partition %d has empty type\n", 522}, - {"cylinder", 523}, - {"sector", 524}, - {"Changing display/entry units to %s\n", 525}, - {"WARNING: Partition %d is an extended partition\n", 526}, - {"DOS Compatibility flag is set\n", 527}, - {"DOS Compatibility flag is not set\n", 528}, - {"Partition %d does not exist yet!\n", 529}, +got EOF thrice - exiting..\n", 523}, + {"Hex code (type L to list codes): ", 524}, + {"%s (%d-%d, default %d): ", 525}, + {"Using default value %d\n", 526}, + {"Value out of range.\n", 527}, + {"Partition number", 528}, + {"Warning: partition %d has empty type\n", 529}, + {"cylinder", 530}, + {"sector", 531}, + {"Changing display/entry units to %s\n", 532}, + {"WARNING: Partition %d is an extended partition\n", 533}, + {"DOS Compatibility flag is set\n", 534}, + {"DOS Compatibility flag is not set\n", 535}, + {"Partition %d does not exist yet!\n", 536}, {"\ Type 0 means free space to many systems\n\ (but not to Linux). Having partitions of\n\ type 0 is probably unwise. You can delete\n\ -a partition using the `d' command.\n", 530}, +a partition using the `d' command.\n", 537}, {"\ You cannot change a partition into an extended one or vice versa\n\ -Delete it first.\n", 531}, +Delete it first.\n", 538}, {"\ Consider leaving partition 3 as Whole disk (5),\n\ as SunOS/Solaris expects it and even Linux likes it.\n\ -\n", 532}, +\n", 539}, {"\ Consider leaving partition 9 as volume header (0),\n\ and partition 11 as entire volume (6)as IRIX expects it.\n\ -\n", 533}, - {"Changed system type of partition %d to %x (%s)\n", 534}, - {"Partition %d has different physical/logical beginnings (non-Linux?):\n", 535}, - {" phys=(%d, %d, %d) ", 536}, - {"logical=(%d, %d, %d)\n", 537}, - {"Partition %d has different physical/logical endings:\n", 538}, - {"Partition %i does not start on cylinder boundary:\n", 539}, - {"should be (%d, %d, 1)\n", 540}, - {"Partition %i does not end on cylinder boundary:\n", 541}, - {"should be (%d, %d, %d)\n", 542}, +\n", 540}, + {"Changed system type of partition %d to %x (%s)\n", 541}, + {"Partition %d has different physical/logical beginnings (non-Linux?):\n", 542}, + {" phys=(%d, %d, %d) ", 543}, + {"logical=(%d, %d, %d)\n", 544}, + {"Partition %d has different physical/logical endings:\n", 545}, + {"Partition %i does not start on cylinder boundary:\n", 546}, + {"should be (%d, %d, 1)\n", 547}, + {"Partition %i does not end on cylinder boundary:\n", 548}, + {"should be (%d, %d, %d)\n", 549}, {"\ \n\ Disk %s: %d heads, %d sectors, %d cylinders\n\ Units = %s of %d * %d bytes\n\ -\n", 543}, +\n", 550}, {"\ Nothing to do. Ordering is correct already.\n\ -\n", 544}, - {"%*s Boot Start End Blocks Id System\n", 545}, - {"Device", 546}, +\n", 551}, + {"%*s Boot Start End Blocks Id System\n", 552}, + {"Device", 553}, {"\ \n\ -Partition table entries are not in disk order\n", 547}, +Partition table entries are not in disk order\n", 554}, {"\ \n\ Disk %s: %d heads, %d sectors, %d cylinders\n\ -\n", 548}, - {"Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID\n", 549}, - {"Warning: partition %d contains sector 0\n", 550}, - {"Partition %d: head %d greater than maximum %d\n", 551}, - {"Partition %d: sector %d greater than maximum %d\n", 552}, - {"Partitions %d: cylinder %d greater than maximum %d\n", 553}, - {"Partition %d: previous sectors %d disagrees with total %d\n", 554}, - {"Warning: bad start-of-data in partition %d\n", 555}, - {"Warning: partition %d overlaps partition %d.\n", 556}, - {"Warning: partition %d is empty\n", 557}, - {"Logical partition %d not entirely in partition %d\n", 558}, - {"Total allocated sectors %d greater than the maximum %d\n", 559}, - {"%d unallocated sectors\n", 560}, - {"Partition %d is already defined. Delete it before re-adding it.\n", 561}, - {"First %s", 562}, - {"Sector %d is already allocated\n", 563}, - {"No free sectors available\n", 564}, - {"Last %s or +size or +sizeM or +sizeK", 565}, - {"Warning: partition %d has an odd number of sectors.\n", 566}, - {"The maximum number of partitions has been created\n", 567}, - {"You must delete some partition and add an extended partition first\n", 568}, +\n", 555}, + {"Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID\n", 556}, + {"Warning: partition %d contains sector 0\n", 557}, + {"Partition %d: head %d greater than maximum %d\n", 558}, + {"Partition %d: sector %d greater than maximum %d\n", 559}, + {"Partitions %d: cylinder %d greater than maximum %d\n", 560}, + {"Partition %d: previous sectors %d disagrees with total %d\n", 561}, + {"Warning: bad start-of-data in partition %d\n", 562}, + {"Warning: partition %d overlaps partition %d.\n", 563}, + {"Warning: partition %d is empty\n", 564}, + {"Logical partition %d not entirely in partition %d\n", 565}, + {"Total allocated sectors %d greater than the maximum %d\n", 566}, + {"%d unallocated sectors\n", 567}, + {"Partition %d is already defined. Delete it before re-adding it.\n", 568}, + {"First %s", 569}, + {"Sector %d is already allocated\n", 570}, + {"No free sectors available\n", 571}, + {"Last %s or +size or +sizeM or +sizeK", 572}, + {"Warning: partition %d has an odd number of sectors.\n", 573}, + {"The maximum number of partitions has been created\n", 574}, + {"You must delete some partition and add an extended partition first\n", 575}, {"\ Command action\n\ %s\n\ - p primary partition (1-4)\n", 569}, - {"l logical (5 or over)", 570}, - {"e extended", 571}, - {"Invalid partition number for type `%c'\n", 572}, + p primary partition (1-4)\n", 576}, + {"l logical (5 or over)", 577}, + {"e extended", 578}, + {"Invalid partition number for type `%c'\n", 579}, {"\ The partition table has been altered!\n\ -\n", 573}, - {"Calling ioctl() to re-read partition table.\n", 574}, +\n", 580}, + {"Calling ioctl() to re-read partition table.\n", 581}, {"\ Re-read table failed with error %d: %s.\n\ -Reboot your system to ensure the partition table is updated.\n", 575}, +Reboot your system to ensure the partition table is updated.\n", 582}, {"\ \n\ WARNING: If you have created or modified any DOS 6.x\n\ partitions, please see the fdisk manual page for additional\n\ -information.\n", 576}, - {"Syncing disks.\n", 577}, - {"Device: %s\n", 578}, - {"Partition %d has no data area\n", 579}, - {"New beginning of data", 580}, - {"Expert command (m for help): ", 581}, - {"Number of cylinders", 582}, - {"Number of heads", 583}, - {"Number of sectors", 584}, - {"Warning: setting sector offset for DOS compatiblity\n", 585}, - {"Disk %s doesn't contain a valid partition table\n", 586}, - {"Cannot open %s\n", 587}, - {"cannot open %s\n", 588}, - {"%c: unknown command\n", 589}, - {"This kernel finds the sector size itself - -b option ignored\n", 590}, +information.\n", 583}, + {"Syncing disks.\n", 584}, + {"Device: %s\n", 585}, + {"Partition %d has no data area\n", 586}, + {"New beginning of data", 587}, + {"Expert command (m for help): ", 588}, + {"Number of cylinders", 589}, + {"Number of heads", 590}, + {"Number of sectors", 591}, + {"Warning: setting sector offset for DOS compatiblity\n", 592}, + {"Disk %s doesn't contain a valid partition table\n", 593}, + {"Cannot open %s\n", 594}, + {"cannot open %s\n", 595}, + {"%c: unknown command\n", 596}, + {"This kernel finds the sector size itself - -b option ignored\n", 597}, {"\ Warning: the -b (set sector size) option should be used with one specified \ -device\n", 591}, +device\n", 598}, {"\ Detected an OSF/1 disklabel on %s, entering disklabel mode.\n\ -To return to DOS partition table mode, use the 'r' command.\n", 592}, - {"Command (m for help): ", 593}, +To return to DOS partition table mode, use the 'r' command.\n", 599}, + {"Command (m for help): ", 600}, {"\ \n\ -The current boot file is: %s\n", 594}, - {"Please enter the name of the new boot file: ", 595}, - {"Boot file unchanged\n", 596}, +The current boot file is: %s\n", 601}, + {"Please enter the name of the new boot file: ", 602}, + {"Boot file unchanged\n", 603}, {"\ \n\ \tSorry, no experts menu for SGI partition tables available.\n\ -\n", 597}, +\n", 604}, {"\ \n\ \tThere is a valid AIX label on this disk.\n\ @@ -813,92 +826,92 @@ The current boot file is: %s\n", 594}, \t erase the other disks as well, if unmirrored.)\n\ \t3. Before deleting this physical volume be sure\n\ \t to remove the disk logically from your AIX\n\ -\t machine. (Otherwise you become an AIXpert).", 598}, +\t machine. (Otherwise you become an AIXpert).", 605}, {"\ \n\ -BSD label for device: %s\n", 599}, - {" d delete a BSD partition", 600}, - {" e edit drive data", 601}, - {" i install bootstrap", 602}, - {" l list known filesystem types", 603}, - {" n add a new BSD partition", 604}, - {" p print BSD partition table", 605}, - {" s show complete disklabel", 606}, - {" t change a partition's filesystem id", 607}, - {" u change units (cylinders/sectors)", 608}, - {" w write disklabel to disk", 609}, - {" x link BSD partition to non-BSD partition", 610}, - {"Partition %s has invalid starting sector 0.\n", 611}, - {"Reading disklabel of %s at sector %d.\n", 612}, - {"There is no *BSD partition on %s.\n", 613}, - {"BSD disklabel command (m for help): ", 614}, - {"type: %s\n", 615}, - {"type: %d\n", 616}, - {"disk: %.*s\n", 617}, - {"label: %.*s\n", 618}, - {"flags:", 619}, - {" removable", 620}, - {" ecc", 621}, - {" badsect", 622}, - {"bytes/sector: %ld\n", 623}, - {"sectors/track: %ld\n", 624}, - {"tracks/cylinder: %ld\n", 625}, - {"sectors/cylinder: %ld\n", 626}, - {"cylinders: %ld\n", 627}, - {"rpm: %d\n", 628}, - {"interleave: %d\n", 629}, - {"trackskew: %d\n", 630}, - {"cylinderskew: %d\n", 631}, - {"headswitch: %ld\t\t# milliseconds\n", 632}, - {"track-to-track seek: %ld\t# milliseconds\n", 633}, - {"drivedata: ", 634}, +BSD label for device: %s\n", 606}, + {" d delete a BSD partition", 607}, + {" e edit drive data", 608}, + {" i install bootstrap", 609}, + {" l list known filesystem types", 610}, + {" n add a new BSD partition", 611}, + {" p print BSD partition table", 612}, + {" s show complete disklabel", 613}, + {" t change a partition's filesystem id", 614}, + {" u change units (cylinders/sectors)", 615}, + {" w write disklabel to disk", 616}, + {" x link BSD partition to non-BSD partition", 617}, + {"Partition %s has invalid starting sector 0.\n", 618}, + {"Reading disklabel of %s at sector %d.\n", 619}, + {"There is no *BSD partition on %s.\n", 620}, + {"BSD disklabel command (m for help): ", 621}, + {"type: %s\n", 622}, + {"type: %d\n", 623}, + {"disk: %.*s\n", 624}, + {"label: %.*s\n", 625}, + {"flags:", 626}, + {" removable", 627}, + {" ecc", 628}, + {" badsect", 629}, + {"bytes/sector: %ld\n", 630}, + {"sectors/track: %ld\n", 631}, + {"tracks/cylinder: %ld\n", 632}, + {"sectors/cylinder: %ld\n", 633}, + {"cylinders: %ld\n", 634}, + {"rpm: %d\n", 635}, + {"interleave: %d\n", 636}, + {"trackskew: %d\n", 637}, + {"cylinderskew: %d\n", 638}, + {"headswitch: %ld\t\t# milliseconds\n", 639}, + {"track-to-track seek: %ld\t# milliseconds\n", 640}, + {"drivedata: ", 641}, {"\ \n\ -%d partitions:\n", 635}, - {"# start end size fstype [fsize bsize cpg]\n", 636}, - {"Writing disklabel to %s.\n", 637}, - {"%s contains no disklabel.\n", 638}, - {"Do you want to create a disklabel? (y/n) ", 639}, - {"bytes/sector", 640}, - {"sectors/track", 641}, - {"tracks/cylinder", 642}, - {"sectors/cylinder", 643}, - {"Must be <= sectors/track * tracks/cylinder (default).\n", 644}, - {"rpm", 645}, - {"interleave", 646}, - {"trackskew", 647}, - {"cylinderskew", 648}, - {"headswitch", 649}, - {"track-to-track seek", 650}, - {"Bootstrap: %sboot -> boot%s (%s): ", 651}, - {"Bootstrap overlaps with disk label!\n", 652}, - {"Bootstrap installed on %s.\n", 653}, - {"Partition (a-%c): ", 654}, - {"This partition already exists.\n", 655}, - {"Warning: too many partitions (%d, maximum is %d).\n", 656}, +%d partitions:\n", 642}, + {"# start end size fstype [fsize bsize cpg]\n", 643}, + {"Writing disklabel to %s.\n", 644}, + {"%s contains no disklabel.\n", 645}, + {"Do you want to create a disklabel? (y/n) ", 646}, + {"bytes/sector", 647}, + {"sectors/track", 648}, + {"tracks/cylinder", 649}, + {"sectors/cylinder", 650}, + {"Must be <= sectors/track * tracks/cylinder (default).\n", 651}, + {"rpm", 652}, + {"interleave", 653}, + {"trackskew", 654}, + {"cylinderskew", 655}, + {"headswitch", 656}, + {"track-to-track seek", 657}, + {"Bootstrap: %sboot -> boot%s (%s): ", 658}, + {"Bootstrap overlaps with disk label!\n", 659}, + {"Bootstrap installed on %s.\n", 660}, + {"Partition (a-%c): ", 661}, + {"This partition already exists.\n", 662}, + {"Warning: too many partitions (%d, maximum is %d).\n", 663}, {"\ \n\ -Syncing disks.\n", 657}, - {"SGI volhdr", 658}, - {"SGI trkrepl", 659}, - {"SGI secrepl", 660}, - {"SGI raw", 661}, - {"SGI bsd", 662}, - {"SGI sysv", 663}, - {"SGI volume", 664}, - {"SGI efs", 665}, - {"SGI lvol", 666}, - {"SGI rlvol", 667}, - {"SGI xfs", 668}, - {"SGI xlvol", 669}, - {"SGI rxlvol", 670}, - {"Linux swap", 671}, - {"Linux native", 672}, - {"Linux LVM", 673}, +Syncing disks.\n", 664}, + {"SGI volhdr", 665}, + {"SGI trkrepl", 666}, + {"SGI secrepl", 667}, + {"SGI raw", 668}, + {"SGI bsd", 669}, + {"SGI sysv", 670}, + {"SGI volume", 671}, + {"SGI efs", 672}, + {"SGI lvol", 673}, + {"SGI rlvol", 674}, + {"SGI xfs", 675}, + {"SGI xlvol", 676}, + {"SGI rxlvol", 677}, + {"Linux swap", 678}, + {"Linux native", 679}, + {"Linux LVM", 680}, {"\ According to MIPS Computer Systems, Inc the Label must not contain more than \ -512 bytes\n", 674}, - {"Detected sgi disklabel with wrong checksum.\n", 675}, +512 bytes\n", 681}, + {"Detected sgi disklabel with wrong checksum.\n", 682}, {"\ \n\ Disk %s (SGI disk label): %d heads, %d sectors\n\ @@ -906,139 +919,139 @@ Disk %s (SGI disk label): %d heads, %d sectors\n\ %d extra sects/cyl, interleave %d:1\n\ %s\n\ Units = %s of %d * 512 bytes\n\ -\n", 676}, +\n", 683}, {"\ \n\ Disk %s (SGI disk label): %d heads, %d sectors, %d cylinders\n\ Units = %s of %d * 512 bytes\n\ -\n", 677}, +\n", 684}, {"\ ----- partitions -----\n\ -%*s Info Start End Sectors Id System\n", 678}, +%*s Info Start End Sectors Id System\n", 685}, {"\ ----- bootinfo -----\n\ Bootfile: %s\n\ ------ directory entries -----\n", 679}, - {"%2d: %-10s sector%5u size%8u\n", 680}, +----- directory entries -----\n", 686}, + {"%2d: %-10s sector%5u size%8u\n", 687}, {"\ \n\ Invalid Bootfile!\n\ \tThe bootfile must be an absolute non-zero pathname,\n\ -\te.g. \"/unix\" or \"/unix.save\".\n", 681}, +\te.g. \"/unix\" or \"/unix.save\".\n", 688}, {"\ \n\ -\tName of Bootfile too long: 16 bytes maximum.\n", 682}, +\tName of Bootfile too long: 16 bytes maximum.\n", 689}, {"\ \n\ -\tBootfile must have a fully qualified pathname.\n", 683}, +\tBootfile must have a fully qualified pathname.\n", 690}, {"\ \n\ \tBe aware, that the bootfile is not checked for existence.\n\ -\tSGI's default is \"/unix\" and for backup \"/unix.save\".\n", 684}, +\tSGI's default is \"/unix\" and for backup \"/unix.save\".\n", 691}, {"\ \n\ -\tBootfile is changed to \"%s\".\n", 685}, - {"More than one entire disk entry present.\n", 686}, - {"No partitions defined\n", 687}, - {"IRIX likes when Partition 11 covers the entire disk.\n", 688}, +\tBootfile is changed to \"%s\".\n", 692}, + {"More than one entire disk entry present.\n", 693}, + {"No partitions defined\n", 694}, + {"IRIX likes when Partition 11 covers the entire disk.\n", 695}, {"\ The entire disk partition should start at block 0,\n\ -not at diskblock %d.\n", 689}, +not at diskblock %d.\n", 696}, {"\ The entire disk partition is only %d diskblock large,\n\ -but the disk is %d diskblocks long.\n", 690}, - {"One Partition (#11) should cover the entire disk.\n", 691}, - {"Partition %d does not start on cylinder boundary.\n", 692}, - {"Partition %d does not end on cylinder boundary.\n", 693}, - {"The Partition %d and %d overlap by %d sectors.\n", 694}, - {"Unused gap of %8d sectors - sectors %8d-%d\n", 695}, +but the disk is %d diskblocks long.\n", 697}, + {"One Partition (#11) should cover the entire disk.\n", 698}, + {"Partition %d does not start on cylinder boundary.\n", 699}, + {"Partition %d does not end on cylinder boundary.\n", 700}, + {"The Partition %d and %d overlap by %d sectors.\n", 701}, + {"Unused gap of %8d sectors - sectors %8d-%d\n", 702}, {"\ \n\ -The boot partition does not exist.\n", 696}, +The boot partition does not exist.\n", 703}, {"\ \n\ -The swap partition does not exist.\n", 697}, +The swap partition does not exist.\n", 704}, {"\ \n\ -The swap partition has no swap type.\n", 698}, - {"\tYou have chosen an unusual boot file name.\n", 699}, - {"Sorry You may change the Tag of non-empty partitions.\n", 700}, +The swap partition has no swap type.\n", 705}, + {"\tYou have chosen an unusual boot file name.\n", 706}, + {"Sorry You may change the Tag of non-empty partitions.\n", 707}, {"\ It is highly recommended that the partition at offset 0\n\ is of type \"SGI volhdr\", the IRIX system will rely on it to\n\ retrieve from its directory standalone tools like sash and fx.\n\ Only the \"SGI volume\" entire disk section may violate this.\n\ -Type YES if you are sure about tagging this partition differently.\n", 701}, - {"Do You know, You got a partition overlap on the disk?\n", 702}, - {"Attempting to generate entire disk entry automatically.\n", 703}, - {"The entire disk is already covered with partitions.\n", 704}, - {"You got a partition overlap on the disk. Fix it first!\n", 705}, +Type YES if you are sure about tagging this partition differently.\n", 708}, + {"Do You know, You got a partition overlap on the disk?\n", 709}, + {"Attempting to generate entire disk entry automatically.\n", 710}, + {"The entire disk is already covered with partitions.\n", 711}, + {"You got a partition overlap on the disk. Fix it first!\n", 712}, {"\ It is highly recommended that eleventh partition\n\ -covers the entire disk and is of type `SGI volume'\n", 706}, - {"You will get a partition overlap on the disk. Fix it first!\n", 707}, - {" Last %s", 708}, +covers the entire disk and is of type `SGI volume'\n", 713}, + {"You will get a partition overlap on the disk. Fix it first!\n", 714}, + {" Last %s", 715}, {"\ Building a new SGI disklabel. Changes will remain in memory only,\n\ until you decide to write them. After that, of course, the previous\n\ content will be unrecoverably lost.\n\ -\n", 709}, - {"Trying to keep parameters of partition %d.\n", 710}, - {"ID=%02x\tSTART=%d\tLENGTH=%d\n", 711}, - {"Empty", 712}, - {"SunOS root", 713}, - {"SunOS swap", 714}, - {"SunOS usr", 715}, - {"Whole disk", 716}, - {"SunOS stand", 717}, - {"SunOS var", 718}, - {"SunOS home", 719}, +\n", 716}, + {"Trying to keep parameters of partition %d.\n", 717}, + {"ID=%02x\tSTART=%d\tLENGTH=%d\n", 718}, + {"Empty", 719}, + {"SunOS root", 720}, + {"SunOS swap", 721}, + {"SunOS usr", 722}, + {"Whole disk", 723}, + {"SunOS stand", 724}, + {"SunOS var", 725}, + {"SunOS home", 726}, {"\ Detected sun disklabel with wrong checksum.\n\ Probably you'll have to set all the values,\n\ e.g. heads, sectors, cylinders and partitions\n\ -or force a fresh label (s command in main menu)\n", 720}, - {"Autoconfigure found a %s%s%s\n", 721}, +or force a fresh label (s command in main menu)\n", 727}, + {"Autoconfigure found a %s%s%s\n", 728}, {"\ Building a new sun disklabel. Changes will remain in memory only,\n\ until you decide to write them. After that, of course, the previous\n\ content won't be recoverable.\n\ -\n", 722}, +\n", 729}, {"\ Drive type\n\ ? auto configure\n\ - 0 custom (with hardware detected defaults)", 723}, - {"Select type (? for auto, 0 for custom): ", 724}, - {"Autoconfigure failed.\n", 725}, - {"Sectors/track", 726}, - {"Alternate cylinders", 727}, - {"Physical cylinders", 728}, - {"Rotation speed (rpm)", 729}, - {"Interleave factor", 730}, - {"Extra sectors per cylinder", 731}, - {"You may change all the disk params from the x menu", 732}, - {"3,5\" floppy", 733}, - {"Linux custom", 734}, - {"Partition %d doesn't end on cylinder boundary\n", 735}, - {"Partition %d overlaps with others in sectors %d-%d\n", 736}, - {"Unused gap - sectors 0-%d\n", 737}, - {"Unused gap - sectors %d-%d\n", 738}, + 0 custom (with hardware detected defaults)", 730}, + {"Select type (? for auto, 0 for custom): ", 731}, + {"Autoconfigure failed.\n", 732}, + {"Sectors/track", 733}, + {"Alternate cylinders", 734}, + {"Physical cylinders", 735}, + {"Rotation speed (rpm)", 736}, + {"Interleave factor", 737}, + {"Extra sectors per cylinder", 738}, + {"You may change all the disk params from the x menu", 739}, + {"3,5\" floppy", 740}, + {"Linux custom", 741}, + {"Partition %d doesn't end on cylinder boundary\n", 742}, + {"Partition %d overlaps with others in sectors %d-%d\n", 743}, + {"Unused gap - sectors 0-%d\n", 744}, + {"Unused gap - sectors %d-%d\n", 745}, {"\ Other partitions already cover the whole disk.\n\ -Delete some/shrink them before retry.\n", 739}, +Delete some/shrink them before retry.\n", 746}, {"\ You haven't covered the whole disk with the 3rd partition, but your value\n\ %d %s covers some other partition. Your entry has been changed\n\ -to %d %s\n", 740}, +to %d %s\n", 747}, {"\ If you want to maintain SunOS/Solaris compatibility, consider leaving this\n\ -partition as Whole disk (5), starting at 0, with %u sectors\n", 741}, +partition as Whole disk (5), starting at 0, with %u sectors\n", 748}, {"\ It is highly recommended that the partition at offset 0\n\ is UFS, EXT2FS filesystem or SunOS swap. Putting Linux swap\n\ there may destroy your partition table and bootblock.\n\ Type YES if you're very sure you would like that partition\n\ -tagged with 82 (Linux swap): ", 742}, +tagged with 82 (Linux swap): ", 749}, {"\ \n\ Disk %s (Sun disk label): %d heads, %d sectors, %d rpm\n\ @@ -1046,1099 +1059,1126 @@ Disk %s (Sun disk label): %d heads, %d sectors, %d rpm\n\ %d extra sects/cyl, interleave %d:1\n\ %s\n\ Units = %s of %d * 512 bytes\n\ -\n", 743}, +\n", 750}, {"\ \n\ Disk %s (Sun disk label): %d heads, %d sectors, %d cylinders\n\ Units = %s of %d * 512 bytes\n\ -\n", 744}, - {"%*s Flag Start End Blocks Id System\n", 745}, - {"Number of alternate cylinders", 746}, - {"Number of physical cylinders", 747}, - {"FAT12", 748}, - {"XENIX root", 749}, - {"XENIX usr", 750}, - {"FAT16 <32M", 751}, - {"Extended", 752}, - {"FAT16", 753}, - {"HPFS/NTFS", 754}, - {"AIX", 755}, - {"AIX bootable", 756}, - {"OS/2 Boot Manager", 757}, - {"Win95 FAT32", 758}, - {"Win95 FAT32 (LBA)", 759}, - {"Win95 FAT16 (LBA)", 760}, - {"Win95 Ext'd (LBA)", 761}, - {"OPUS", 762}, - {"Hidden FAT12", 763}, - {"Compaq diagnostics", 764}, - {"Hidden FAT16 <32M", 765}, - {"Hidden FAT16", 766}, - {"Hidden HPFS/NTFS", 767}, - {"AST Windows swapfile", 768}, - {"Hidden Win95 FAT32", 769}, - {"Hidden Win95 FAT32 (LBA)", 770}, - {"Hidden Win95 FAT16 (LBA)", 771}, - {"NEC DOS", 772}, - {"PartitionMagic recovery", 773}, - {"Venix 80286", 774}, - {"PPC PReP Boot", 775}, - {"SFS", 776}, - {"QNX4.x", 777}, - {"QNX4.x 2nd part", 778}, - {"QNX4.x 3rd part", 779}, - {"OnTrack DM", 780}, - {"OnTrack DM6 Aux1", 781}, - {"CP/M", 782}, - {"OnTrack DM6 Aux3", 783}, - {"OnTrackDM6", 784}, - {"EZ-Drive", 785}, - {"Golden Bow", 786}, - {"Priam Edisk", 787}, - {"SpeedStor", 788}, - {"GNU HURD or SysV", 789}, - {"Novell Netware 286", 790}, - {"Novell Netware 386", 791}, - {"DiskSecure Multi-Boot", 792}, - {"PC/IX", 793}, - {"Old Minix", 794}, - {"Minix / old Linux", 795}, - {"OS/2 hidden C: drive", 796}, - {"Linux extended", 797}, - {"NTFS volume set", 798}, - {"Amoeba", 799}, - {"Amoeba BBT", 800}, - {"BSD/OS", 801}, - {"IBM Thinkpad hibernation", 802}, - {"BSD/386", 803}, - {"OpenBSD", 804}, - {"NeXTSTEP", 805}, - {"BSDI fs", 806}, - {"BSDI swap", 807}, - {"DRDOS/sec (FAT-12)", 808}, - {"DRDOS/sec (FAT-16 < 32M)", 809}, - {"DRDOS/sec (FAT-16)", 810}, - {"Syrinx", 811}, - {"CP/M / CTOS / ...", 812}, - {"DOS access", 813}, - {"DOS R/O", 814}, - {"BeOS fs", 815}, - {"DOS secondary", 816}, - {"Linux raid autodetect", 817}, - {"LANstep", 818}, - {"BBT", 819}, - {"seek error on %s - cannot seek to %lu\n", 820}, - {"seek error: wanted 0x%08x%08x, got 0x%08x%08x\n", 821}, - {"out of memory - giving up\n", 822}, - {"read error on %s - cannot read sector %lu\n", 823}, - {"ERROR: sector %lu does not have an msdos signature\n", 824}, - {"write error on %s - cannot write sector %lu\n", 825}, - {"cannot open partition sector save file (%s)\n", 826}, - {"write error on %s\n", 827}, - {"cannot stat partition restore file (%s)\n", 828}, - {"partition restore file has wrong size - not restoring\n", 829}, - {"out of memory?\n", 830}, - {"cannot open partition restore file (%s)\n", 831}, - {"error reading %s\n", 832}, - {"cannot open device %s for writing\n", 833}, - {"error writing sector %lu on %s\n", 834}, - {"Disk %s: cannot get size\n", 835}, - {"Disk %s: cannot get geometry\n", 836}, - {"\ -Warning: start=%d - this looks like a partition rather than\n\ +\n", 751}, + {"%*s Flag Start End Blocks Id System\n", 752}, + {"Number of alternate cylinders", 753}, + {"Number of physical cylinders", 754}, + {"FAT12", 755}, + {"XENIX root", 756}, + {"XENIX usr", 757}, + {"FAT16 <32M", 758}, + {"Extended", 759}, + {"FAT16", 760}, + {"HPFS/NTFS", 761}, + {"AIX", 762}, + {"AIX bootable", 763}, + {"OS/2 Boot Manager", 764}, + {"Win95 FAT32", 765}, + {"Win95 FAT32 (LBA)", 766}, + {"Win95 FAT16 (LBA)", 767}, + {"Win95 Ext'd (LBA)", 768}, + {"OPUS", 769}, + {"Hidden FAT12", 770}, + {"Compaq diagnostics", 771}, + {"Hidden FAT16 <32M", 772}, + {"Hidden FAT16", 773}, + {"Hidden HPFS/NTFS", 774}, + {"AST Windows swapfile", 775}, + {"Hidden Win95 FAT32", 776}, + {"Hidden Win95 FAT32 (LBA)", 777}, + {"Hidden Win95 FAT16 (LBA)", 778}, + {"NEC DOS", 779}, + {"Plan 9", 780}, + {"PartitionMagic recovery", 781}, + {"Venix 80286", 782}, + {"PPC PReP Boot", 783}, + {"SFS", 784}, + {"QNX4.x", 785}, + {"QNX4.x 2nd part", 786}, + {"QNX4.x 3rd part", 787}, + {"OnTrack DM", 788}, + {"OnTrack DM6 Aux1", 789}, + {"CP/M", 790}, + {"OnTrack DM6 Aux3", 791}, + {"OnTrackDM6", 792}, + {"EZ-Drive", 793}, + {"Golden Bow", 794}, + {"Priam Edisk", 795}, + {"SpeedStor", 796}, + {"GNU HURD or SysV", 797}, + {"Novell Netware 286", 798}, + {"Novell Netware 386", 799}, + {"DiskSecure Multi-Boot", 800}, + {"PC/IX", 801}, + {"Old Minix", 802}, + {"Minix / old Linux", 803}, + {"OS/2 hidden C: drive", 804}, + {"Linux extended", 805}, + {"NTFS volume set", 806}, + {"Amoeba", 807}, + {"Amoeba BBT", 808}, + {"BSD/OS", 809}, + {"IBM Thinkpad hibernation", 810}, + {"BSD/386", 811}, + {"OpenBSD", 812}, + {"NeXTSTEP", 813}, + {"BSDI fs", 814}, + {"BSDI swap", 815}, + {"DRDOS/sec (FAT-12)", 816}, + {"DRDOS/sec (FAT-16 < 32M)", 817}, + {"DRDOS/sec (FAT-16)", 818}, + {"Syrinx", 819}, + {"Non-FS data", 820}, + {"CP/M / CTOS / ...", 821}, + {"DOS access", 822}, + {"DOS R/O", 823}, + {"BeOS fs", 824}, + {"DOS secondary", 825}, + {"Linux raid autodetect", 826}, + {"LANstep", 827}, + {"BBT", 828}, + {"seek error on %s - cannot seek to %lu\n", 829}, + {"seek error: wanted 0x%08x%08x, got 0x%08x%08x\n", 830}, + {"out of memory - giving up\n", 831}, + {"read error on %s - cannot read sector %lu\n", 832}, + {"ERROR: sector %lu does not have an msdos signature\n", 833}, + {"write error on %s - cannot write sector %lu\n", 834}, + {"cannot open partition sector save file (%s)\n", 835}, + {"write error on %s\n", 836}, + {"cannot stat partition restore file (%s)\n", 837}, + {"partition restore file has wrong size - not restoring\n", 838}, + {"out of memory?\n", 839}, + {"cannot open partition restore file (%s)\n", 840}, + {"error reading %s\n", 841}, + {"cannot open device %s for writing\n", 842}, + {"error writing sector %lu on %s\n", 843}, + {"Disk %s: cannot get size\n", 844}, + {"Disk %s: cannot get geometry\n", 845}, + {"\ +Warning: start=%lu - this looks like a partition rather than\n\ the entire disk. Using fdisk on it is probably meaningless.\n\ -[Use the --force option if you really want this]\n", 837}, - {"Warning: HDIO_GETGEO says that there are %d heads\n", 838}, - {"Warning: HDIO_GETGEO says that there are %d sectors\n", 839}, - {"Warning: BLKGETSIZE/HDIO_GETGEO says that there are %d cylinders\n", 840}, +[Use the --force option if you really want this]\n", 846}, + {"Warning: HDIO_GETGEO says that there are %lu heads\n", 847}, + {"Warning: HDIO_GETGEO says that there are %lu sectors\n", 848}, + {"Warning: BLKGETSIZE/HDIO_GETGEO says that there are %lu cylinders\n", 849}, {"\ -Warning: unlikely number of sectors (%d) - usually at most 63\n\ -This will give problems with all software that uses C/H/S addressing.\n", 841}, +Warning: unlikely number of sectors (%lu) - usually at most 63\n\ +This will give problems with all software that uses C/H/S addressing.\n", 850}, {"\ \n\ -Disk %s: %lu cylinders, %lu heads, %lu sectors/track\n", 842}, +Disk %s: %lu cylinders, %lu heads, %lu sectors/track\n", 851}, {"\ -%s of partition %s has impossible value for head: %d (should be in 0-%d)\n", 843}, +%s of partition %s has impossible value for head: %lu (should be in 0-%lu)\n", 852}, {"\ -%s of partition %s has impossible value for sector: %d (should be in 1-%d)\n", 844}, +%s of partition %s has impossible value for sector: %lu (should be in \ +1-%lu)\n", 853}, {"\ -%s of partition %s has impossible value for cylinders: %d (should be in \ -0-%d)\n", 845}, +%s of partition %s has impossible value for cylinders: %lu (should be in \ +0-%lu)\n", 854}, {"\ Id Name\n\ -\n", 846}, - {"Re-reading the partition table ...\n", 847}, +\n", 855}, + {"Re-reading the partition table ...\n", 856}, {"\ The command to re-read the partition table failed\n\ -Reboot your system now, before using mkfs\n", 848}, - {"Error closing %s\n", 849}, - {"%s: no such partition\n", 850}, - {"unrecognized format - using sectors\n", 851}, - {"# partition table of %s\n", 852}, - {"unimplemented format - using %s\n", 853}, +Reboot your system now, before using mkfs\n", 857}, + {"Error closing %s\n", 858}, + {"%s: no such partition\n", 859}, + {"unrecognized format - using sectors\n", 860}, + {"# partition table of %s\n", 861}, + {"unimplemented format - using %s\n", 862}, {"\ Units = cylinders of %lu bytes, blocks of 1024 bytes, counting from %d\n\ -\n", 854}, - {" Device Boot Start End #cyls #blocks Id System\n", 855}, +\n", 863}, + {" Device Boot Start End #cyls #blocks Id System\n", 864}, {"\ Units = sectors of 512 bytes, counting from %d\n\ -\n", 856}, - {" Device Boot Start End #sectors Id System\n", 857}, +\n", 865}, + {" Device Boot Start End #sectors Id System\n", 866}, {"\ Units = blocks of 1024 bytes, counting from %d\n\ -\n", 858}, - {" Device Boot Start End #blocks Id System\n", 859}, +\n", 867}, + {" Device Boot Start End #blocks Id System\n", 868}, {"\ Units = megabytes of 1048576 bytes, blocks of 1024 bytes, counting from %d\n\ -\n", 860}, - {" Device Boot Start End MB #blocks Id System\n", 861}, - {"\t\tstart: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 862}, - {"\t\tend: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 863}, - {"partition ends on cylinder %ld, beyond the end of the disk\n", 864}, - {"No partitions found\n", 865}, +\n", 869}, + {" Device Boot Start End MB #blocks Id System\n", 870}, + {"\t\tstart: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 871}, + {"\t\tend: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 872}, + {"partition ends on cylinder %ld, beyond the end of the disk\n", 873}, + {"No partitions found\n", 874}, {"\ Warning: The first partition looks like it was made\n\ for C/H/S=*/%ld/%ld (instead of %ld/%ld/%ld).\n\ -For this listing I'll assume that geometry.\n", 866}, - {"no partition table present.\n", 867}, - {"strange, only %d partitions defined.\n", 868}, - {"Warning: partition %s has size 0 but is not marked Empty\n", 869}, - {"Warning: partition %s has size 0 and is bootable\n", 870}, - {"Warning: partition %s has size 0 and nonzero start\n", 871}, - {"Warning: partition %s ", 872}, - {"is not contained in partition %s\n", 873}, - {"Warning: partitions %s ", 874}, - {"and %s overlap\n", 875}, - {"Warning: partition %s contains part of ", 876}, - {"the partition table (sector %lu),\n", 877}, - {"and will destroy it when filled\n", 878}, - {"Warning: partition %s starts at sector 0\n", 879}, - {"Warning: partition %s extends past end of disk\n", 880}, - {"Among the primary partitions, at most one can be extended\n", 881}, - {" (although this is not a problem under Linux)\n", 882}, - {"Warning: partition %s does not start at a cylinder boundary\n", 883}, - {"Warning: partition %s does not end at a cylinder boundary\n", 884}, +For this listing I'll assume that geometry.\n", 875}, + {"no partition table present.\n", 876}, + {"strange, only %d partitions defined.\n", 877}, + {"Warning: partition %s has size 0 but is not marked Empty\n", 878}, + {"Warning: partition %s has size 0 and is bootable\n", 879}, + {"Warning: partition %s has size 0 and nonzero start\n", 880}, + {"Warning: partition %s ", 881}, + {"is not contained in partition %s\n", 882}, + {"Warning: partitions %s ", 883}, + {"and %s overlap\n", 884}, + {"Warning: partition %s contains part of ", 885}, + {"the partition table (sector %lu),\n", 886}, + {"and will destroy it when filled\n", 887}, + {"Warning: partition %s starts at sector 0\n", 888}, + {"Warning: partition %s extends past end of disk\n", 889}, + {"Among the primary partitions, at most one can be extended\n", 890}, + {" (although this is not a problem under Linux)\n", 891}, + {"Warning: partition %s does not start at a cylinder boundary\n", 892}, + {"Warning: partition %s does not end at a cylinder boundary\n", 893}, {"\ Warning: more than one primary partition is marked bootable (active)\n\ -This does not matter for LILO, but the DOS MBR will not boot this disk.\n", 885}, +This does not matter for LILO, but the DOS MBR will not boot this disk.\n", 894}, {"\ Warning: usually one can boot from primary partitions only\n\ -LILO disregards the `bootable' flag.\n", 886}, +LILO disregards the `bootable' flag.\n", 895}, {"\ Warning: no primary partition is marked bootable (active)\n\ -This does not matter for LILO, but the DOS MBR will not boot this disk.\n", 887}, - {"\ -partition %s: start: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 888}, - {"partition %s: end: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 889}, - {"partition %s ends on cylinder %ld, beyond the end of the disk\n", 890}, - {"Warning: shifted start of the extd partition from %ld to %ld\n", 891}, - {"(For listing purposes only. Do not change its contents.)\n", 892}, - {"Warning: extended partition does not start at a cylinder boundary.\n", 893}, - {"DOS and Linux will interpret the contents differently.\n", 894}, - {"too many partitions - ignoring those past nr (%d)\n", 895}, - {"tree of partitions?\n", 896}, - {"detected Disk Manager - unable to handle that\n", 897}, - {"DM6 signature found - giving up\n", 898}, - {"strange..., an extended partition of size 0?\n", 899}, - {"strange..., a BSD partition of size 0?\n", 900}, - {" %s: unrecognized partition\n", 901}, - {"-n flag was given: Nothing changed\n", 902}, - {"Failed saving the old sectors - aborting\n", 903}, - {"Failed writing the partition on %s\n", 904}, - {"long or incomplete input line - quitting\n", 905}, - {"input error: `=' expected after %s field\n", 906}, - {"input error: unexpected character %c after %s field\n", 907}, - {"unrecognized input: %s\n", 908}, - {"number too big\n", 909}, - {"trailing junk after number\n", 910}, - {"no room for partition descriptor\n", 911}, - {"cannot build surrounding extended partition\n", 912}, - {"too many input fields\n", 913}, - {"No room for more\n", 914}, - {"Illegal type\n", 915}, - {"Warning: given size (%lu) exceeds max allowable size (%lu)\n", 916}, - {"Warning: empty partition\n", 917}, - {"Warning: bad partition start (earliest %lu)\n", 918}, - {"unrecognized bootable flag - choose - or *\n", 919}, - {"partial c,h,s specification?\n", 920}, - {"Extended partition not where expected\n", 921}, - {"bad input\n", 922}, - {"too many partitions\n", 923}, +This does not matter for LILO, but the DOS MBR will not boot this disk.\n", 896}, + {"\ +partition %s: start: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 897}, + {"partition %s: end: (c,h,s) expected (%ld,%ld,%ld) found (%ld,%ld,%ld)\n", 898}, + {"partition %s ends on cylinder %ld, beyond the end of the disk\n", 899}, + {"Warning: shifted start of the extd partition from %ld to %ld\n", 900}, + {"(For listing purposes only. Do not change its contents.)\n", 901}, + {"Warning: extended partition does not start at a cylinder boundary.\n", 902}, + {"DOS and Linux will interpret the contents differently.\n", 903}, + {"too many partitions - ignoring those past nr (%d)\n", 904}, + {"tree of partitions?\n", 905}, + {"detected Disk Manager - unable to handle that\n", 906}, + {"DM6 signature found - giving up\n", 907}, + {"strange..., an extended partition of size 0?\n", 908}, + {"strange..., a BSD partition of size 0?\n", 909}, + {" %s: unrecognized partition\n", 910}, + {"-n flag was given: Nothing changed\n", 911}, + {"Failed saving the old sectors - aborting\n", 912}, + {"Failed writing the partition on %s\n", 913}, + {"long or incomplete input line - quitting\n", 914}, + {"input error: `=' expected after %s field\n", 915}, + {"input error: unexpected character %c after %s field\n", 916}, + {"unrecognized input: %s\n", 917}, + {"number too big\n", 918}, + {"trailing junk after number\n", 919}, + {"no room for partition descriptor\n", 920}, + {"cannot build surrounding extended partition\n", 921}, + {"too many input fields\n", 922}, + {"No room for more\n", 923}, + {"Illegal type\n", 924}, + {"Warning: given size (%lu) exceeds max allowable size (%lu)\n", 925}, + {"Warning: empty partition\n", 926}, + {"Warning: bad partition start (earliest %lu)\n", 927}, + {"unrecognized bootable flag - choose - or *\n", 928}, + {"partial c,h,s specification?\n", 929}, + {"Extended partition not where expected\n", 930}, + {"bad input\n", 931}, + {"too many partitions\n", 932}, {"\ Input in the following format; absent fields get a default value.\n\ \n\ -Usually you only need to specify and (and perhaps ).\n", 924}, - {"version", 925}, - {"Usage: %s [options] device ...\n", 926}, - {"device: something like /dev/hda or /dev/sda", 927}, - {"useful options:", 928}, - {" -s [or --show-size]: list size of a partition", 929}, - {" -c [or --id]: print or change partition Id", 930}, - {" -l [or --list]: list partitions of each device", 931}, - {" -d [or --dump]: idem, but in a format suitable for later input", 932}, - {" -i [or --increment]: number cylinders etc. from 1 instead of from 0", 933}, +Usually you only need to specify and (and perhaps ).\n", 933}, + {"version", 934}, + {"Usage: %s [options] device ...\n", 935}, + {"device: something like /dev/hda or /dev/sda", 936}, + {"useful options:", 937}, + {" -s [or --show-size]: list size of a partition", 938}, + {" -c [or --id]: print or change partition Id", 939}, + {" -l [or --list]: list partitions of each device", 940}, + {" -d [or --dump]: idem, but in a format suitable for later input", 941}, + {" -i [or --increment]: number cylinders etc. from 1 instead of from 0", 942}, {"\ -uS, -uB, -uC, -uM: accept/report in units of \ -sectors/blocks/cylinders/MB", 934}, - {" -T [or --list-types]:list the known partition types", 935}, - {" -D [or --DOS]: for DOS-compatibility: waste a little space", 936}, - {" -R [or --re-read]: make kernel reread partition table", 937}, - {" -N# : change only the partition with number #", 938}, - {" -n : do not actually write to disk", 939}, - {"\ - -O file : save the sectors that will be overwritten to file", 940}, - {" -I file : restore these sectors again", 941}, - {" -v [or --version]: print version", 942}, - {" -? [or --help]: print this message", 943}, - {"dangerous options:", 944}, - {" -g [or --show-geometry]: print the kernel's idea of the geometry", 945}, +sectors/blocks/cylinders/MB", 943}, + {" -T [or --list-types]:list the known partition types", 944}, + {" -D [or --DOS]: for DOS-compatibility: waste a little space", 945}, + {" -R [or --re-read]: make kernel reread partition table", 946}, + {" -N# : change only the partition with number #", 947}, + {" -n : do not actually write to disk", 948}, + {"\ + -O file : save the sectors that will be overwritten to file", 949}, + {" -I file : restore these sectors again", 950}, + {" -v [or --version]: print version", 951}, + {" -? [or --help]: print this message", 952}, + {"dangerous options:", 953}, + {" -g [or --show-geometry]: print the kernel's idea of the geometry", 954}, {"\ -x [or --show-extended]: also list extended partitions on output\n\ - or expect descriptors for them on input", 946}, - {"\ - -L [or --Linux]: do not complain about things irrelevant for Linux", 947}, - {" -q [or --quiet]: suppress warning messages", 948}, - {" You can override the detected geometry using:", 949}, - {" -C# [or --cylinders #]:set the number of cylinders to use", 950}, - {" -H# [or --heads #]: set the number of heads to use", 951}, - {" -S# [or --sectors #]: set the number of sectors to use", 952}, - {"You can disable all consistency checking with:", 953}, - {" -f [or --force]: do what I say, even if it is stupid", 954}, - {"Usage:", 955}, - {"%s device\t\t list active partitions on device\n", 956}, - {"%s device n1 n2 ... activate partitions n1 ..., inactivate the rest\n", 957}, - {"%s -An device\t activate partition n, inactivate the other ones\n", 958}, - {"no command?\n", 959}, - {"total: %d blocks\n", 960}, - {"usage: sfdisk --print-id device partition-number\n", 961}, - {"usage: sfdisk --change-id device partition-number Id\n", 962}, - {"usage: sfdisk --id device partition-number [Id]\n", 963}, - {"can specify only one device (except with -l or -s)\n", 964}, - {"cannot open %s %s\n", 965}, - {"read-write", 966}, - {"for reading", 967}, - {"%s: OK\n", 968}, - {"%s: %ld cylinders, %ld heads, %ld sectors/track\n", 969}, - {"BLKGETSIZE ioctl failed for %s\n", 970}, - {"bad active byte: 0x%x instead of 0x80\n", 971}, + or expect descriptors for them on input", 955}, + {"\ + -L [or --Linux]: do not complain about things irrelevant for Linux", 956}, + {" -q [or --quiet]: suppress warning messages", 957}, + {" You can override the detected geometry using:", 958}, + {" -C# [or --cylinders #]:set the number of cylinders to use", 959}, + {" -H# [or --heads #]: set the number of heads to use", 960}, + {" -S# [or --sectors #]: set the number of sectors to use", 961}, + {"You can disable all consistency checking with:", 962}, + {" -f [or --force]: do what I say, even if it is stupid", 963}, + {"Usage:", 964}, + {"%s device\t\t list active partitions on device\n", 965}, + {"%s device n1 n2 ... activate partitions n1 ..., inactivate the rest\n", 966}, + {"%s -An device\t activate partition n, inactivate the other ones\n", 967}, + {"no command?\n", 968}, + {"total: %d blocks\n", 969}, + {"usage: sfdisk --print-id device partition-number\n", 970}, + {"usage: sfdisk --change-id device partition-number Id\n", 971}, + {"usage: sfdisk --id device partition-number [Id]\n", 972}, + {"can specify only one device (except with -l or -s)\n", 973}, + {"cannot open %s %s\n", 974}, + {"read-write", 975}, + {"for reading", 976}, + {"%s: OK\n", 977}, + {"%s: %ld cylinders, %ld heads, %ld sectors/track\n", 978}, + {"BLKGETSIZE ioctl failed for %s\n", 979}, + {"bad active byte: 0x%x instead of 0x80\n", 980}, {"\ Done\n\ -\n", 972}, +\n", 981}, {"\ You have %d active primary partitions. This does not matter for LILO,\n\ -but the DOS MBR will only boot a disk with 1 active partition.\n", 973}, - {"partition %s has id %x and is not hidden\n", 974}, - {"Bad Id %x\n", 975}, - {"This disk is currently in use.\n", 976}, - {"Fatal error: cannot find %s\n", 977}, - {"Warning: %s is not a block device\n", 978}, - {"Checking that no-one is using this disk right now ...\n", 979}, +but the DOS MBR will only boot a disk with 1 active partition.\n", 982}, + {"partition %s has id %x and is not hidden\n", 983}, + {"Bad Id %lx\n", 984}, + {"This disk is currently in use.\n", 985}, + {"Fatal error: cannot find %s\n", 986}, + {"Warning: %s is not a block device\n", 987}, + {"Checking that no-one is using this disk right now ...\n", 988}, {"\ \n\ This disk is currently in use - repartitioning is probably a bad idea.\n\ Umount all file systems, and swapoff all swap partitions on this disk.\n\ -Use the --no-reread flag to suppress this check.\n", 980}, - {"Use the --force flag to overrule all checks.\n", 981}, - {"OK\n", 982}, - {"Old situation:\n", 983}, - {"Partition %d does not exist, cannot change it\n", 984}, - {"New situation:\n", 985}, +Use the --no-reread flag to suppress this check.\n", 989}, + {"Use the --force flag to overrule all checks.\n", 990}, + {"OK\n", 991}, + {"Old situation:\n", 992}, + {"Partition %d does not exist, cannot change it\n", 993}, + {"New situation:\n", 994}, {"\ I don't like these partitions - nothing changed.\n\ -(If you really want this, use the --force option.)\n", 986}, - {"I don't like this - probably you should answer No\n", 987}, - {"Are you satisfied with this? [ynq] ", 988}, - {"Do you want to write this to disk? [ynq] ", 989}, +(If you really want this, use the --force option.)\n", 995}, + {"I don't like this - probably you should answer No\n", 996}, + {"Are you satisfied with this? [ynq] ", 997}, + {"Do you want to write this to disk? [ynq] ", 998}, {"\ \n\ -sfdisk: premature end of input\n", 990}, - {"Quitting - nothing changed\n", 991}, - {"Please answer one of y,n,q\n", 992}, +sfdisk: premature end of input\n", 999}, + {"Quitting - nothing changed\n", 1000}, + {"Please answer one of y,n,q\n", 1001}, {"\ Successfully wrote the new partition table\n\ -\n", 993}, +\n", 1002}, {"\ If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)\n\ to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1\n\ -(See fdisk(8).)\n", 994}, - {"usage: banner [-w width]\n", 995}, - {"Message: ", 996}, - {"The character '%c' is not in my character set", 997}, - {"Message '%s' is OK\n", 998}, - {"Try `getopt --help' for more information.\n", 999}, - {"empty long option after -l or --long argument", 1000}, - {"unknown shell after -s or --shell argument", 1001}, - {"Usage: getopt optstring parameters\n", 1002}, - {" getopt [options] [--] optstring parameters\n", 1003}, - {" getopt [options] -o|--options optstring [options] [--]\n", 1004}, - {" parameters\n", 1005}, - {"\ - -a, --alternative Allow long options starting with single -\n", 1006}, - {" -h, --help This small usage guide\n", 1007}, - {" -l, --longoptions=longopts Long options to be recognized\n", 1008}, - {"\ - -n, --name=progname The name under which errors are reported\n", 1009}, - {" -o, --options=optstring Short options to be recognized\n", 1010}, - {" -q, --quiet Disable error reporting by getopt(3)\n", 1011}, - {" -Q, --quiet-output No normal output\n", 1012}, - {" -s, --shell=shell Set shell quoting conventions\n", 1013}, - {" -T, --test Test for getopt(1) version\n", 1014}, - {" -V, --version Output version information\n", 1015}, - {"missing optstring argument", 1016}, - {"getopt (enhanced) 1.0.3\n", 1017}, - {"internal error, contact the author.", 1018}, - {"calling open_tty\n", 1019}, - {"calling termio_init\n", 1020}, - {"writing init string\n", 1021}, - {"before autobaud\n", 1022}, - {"waiting for cr-lf\n", 1023}, - {"read %c\n", 1024}, - {"reading login name\n", 1025}, - {"%s: can't exec %s: %m", 1026}, - {"can't malloc initstring", 1027}, - {"bad timeout value: %s", 1028}, - {"after getopt loop\n", 1029}, - {"exiting parseargs\n", 1030}, - {"entered parse_speeds\n", 1031}, - {"bad speed: %s", 1032}, - {"too many alternate speeds", 1033}, - {"exiting parsespeeds\n", 1034}, - {"%s: open for update: %m", 1035}, - {"%s: no utmp entry", 1036}, - {"/dev: chdir() failed: %m", 1037}, - {"/dev/%s: not a character device", 1038}, - {"open(2)\n", 1039}, - {"/dev/%s: cannot open as standard input: %m", 1040}, - {"%s: not open for read/write", 1041}, - {"duping\n", 1042}, - {"%s: dup problem: %m", 1043}, - {"term_io 2\n", 1044}, - {"user", 1045}, - {"users", 1046}, - {"%s: read: %m", 1047}, - {"%s: input overrun", 1048}, +(See fdisk(8).)\n", 1003}, + {"usage: banner [-w width]\n", 1004}, + {"Message: ", 1005}, + {"The character '%c' is not in my character set", 1006}, + {"Message '%s' is OK\n", 1007}, + {"Try `getopt --help' for more information.\n", 1008}, + {"empty long option after -l or --long argument", 1009}, + {"unknown shell after -s or --shell argument", 1010}, + {"Usage: getopt optstring parameters\n", 1011}, + {" getopt [options] [--] optstring parameters\n", 1012}, + {" getopt [options] -o|--options optstring [options] [--]\n", 1013}, + {" parameters\n", 1014}, + {"\ + -a, --alternative Allow long options starting with single -\n", 1015}, + {" -h, --help This small usage guide\n", 1016}, + {" -l, --longoptions=longopts Long options to be recognized\n", 1017}, + {"\ + -n, --name=progname The name under which errors are reported\n", 1018}, + {" -o, --options=optstring Short options to be recognized\n", 1019}, + {" -q, --quiet Disable error reporting by getopt(3)\n", 1020}, + {" -Q, --quiet-output No normal output\n", 1021}, + {" -s, --shell=shell Set shell quoting conventions\n", 1022}, + {" -T, --test Test for getopt(1) version\n", 1023}, + {" -u, --unqote Do not quote the output\n", 1024}, + {" -V, --version Output version information\n", 1025}, + {"missing optstring argument", 1026}, + {"getopt (enhanced) 1.1.0\n", 1027}, + {"internal error, contact the author.", 1028}, + {"calling open_tty\n", 1029}, + {"calling termio_init\n", 1030}, + {"writing init string\n", 1031}, + {"before autobaud\n", 1032}, + {"waiting for cr-lf\n", 1033}, + {"read %c\n", 1034}, + {"reading login name\n", 1035}, + {"%s: can't exec %s: %m", 1036}, + {"can't malloc initstring", 1037}, + {"bad timeout value: %s", 1038}, + {"after getopt loop\n", 1039}, + {"exiting parseargs\n", 1040}, + {"entered parse_speeds\n", 1041}, + {"bad speed: %s", 1042}, + {"too many alternate speeds", 1043}, + {"exiting parsespeeds\n", 1044}, + {"%s: open for update: %m", 1045}, + {"%s: no utmp entry", 1046}, + {"/dev: chdir() failed: %m", 1047}, + {"/dev/%s: not a character device", 1048}, + {"open(2)\n", 1049}, + {"/dev/%s: cannot open as standard input: %m", 1050}, + {"%s: not open for read/write", 1051}, + {"duping\n", 1052}, + {"%s: dup problem: %m", 1053}, + {"term_io 2\n", 1054}, + {"user", 1055}, + {"users", 1056}, + {"%s: read: %m", 1057}, + {"%s: input overrun", 1058}, {"\ Usage: %s [-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H \ login_host] baud_rate,... line [termtype]\n\ or\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] \ -line baud_rate,... [termtype]\n", 1049}, - {"badlogin: %s\n", 1050}, - {"sleepexit %d\n", 1051}, - {"login: memory low, login may fail\n", 1052}, - {"can't malloc for ttyclass", 1053}, - {"can't malloc for grplist", 1054}, - {"Login on %s from %s denied by default.\n", 1055}, - {"Login on %s from %s denied.\n", 1056}, - {"%s: you (user %d) don't exist.\n", 1057}, - {"%s: user \"%s\" does not exist.\n", 1058}, - {"%s: can only change local entries; use yp%s instead.\n", 1059}, - {"Changing finger information for %s.\n", 1060}, - {"Password error.", 1061}, - {"Password: ", 1062}, - {"Incorrect password.", 1063}, - {"Finger information not changed.\n", 1064}, - {"Usage: %s [ -f full-name ] [ -o office ] ", 1065}, +line baud_rate,... [termtype]\n", 1059}, + {"login: memory low, login may fail\n", 1060}, + {"can't malloc for ttyclass", 1061}, + {"can't malloc for grplist", 1062}, + {"Login on %s from %s denied by default.\n", 1063}, + {"Login on %s from %s denied.\n", 1064}, + {"%s: you (user %d) don't exist.\n", 1065}, + {"%s: user \"%s\" does not exist.\n", 1066}, + {"%s: can only change local entries; use yp%s instead.\n", 1067}, + {"Changing finger information for %s.\n", 1068}, + {"Password error.", 1069}, + {"Password: ", 1070}, + {"Incorrect password.", 1071}, + {"Finger information not changed.\n", 1072}, + {"Usage: %s [ -f full-name ] [ -o office ] ", 1073}, {"\ [ -p office-phone ]\n\ -\t[ -h home-phone ] ", 1066}, - {"[ --help ] [ --version ]\n", 1067}, +\t[ -h home-phone ] ", 1074}, + {"[ --help ] [ --version ]\n", 1075}, {"\ \n\ -Aborted.\n", 1068}, - {"field is too long.\n", 1069}, - {"'%c' is not allowed.\n", 1070}, - {"Control characters are not allowed.\n", 1071}, - {"Finger information *NOT* changed. Try again later.\n", 1072}, - {"Finger information changed.\n", 1073}, - {"malloc failed", 1074}, - {"%s: Your shell is not in /etc/shells, shell change denied\n", 1075}, - {"Changing shell for %s.\n", 1076}, - {"New shell", 1077}, - {"Shell not changed.\n", 1078}, - {"Shell *NOT* changed. Try again later.\n", 1079}, - {"Shell changed.\n", 1080}, - {"Usage: %s [ -s shell ] ", 1081}, - {"[ --list-shells ] [ --help ] [ --version ]\n", 1082}, - {" [ username ]\n", 1083}, - {"%s: shell must be a full path name.\n", 1084}, - {"%s: \"%s\" does not exist.\n", 1085}, - {"%s: \"%s\" is not executable.\n", 1086}, - {"%s: '%c' is not allowed.\n", 1087}, - {"%s: Control characters are not allowed.\n", 1088}, - {"Warning: \"%s\" is not listed in /etc/shells\n", 1089}, - {"%s: \"%s\" is not listed in /etc/shells.\n", 1090}, - {"%s: use -l option to see list\n", 1091}, - {"Warning: \"%s\" is not listed in /etc/shells.\n", 1092}, - {"Use %s -l to see list.\n", 1093}, - {"No known shells.\n", 1094}, - {"couldn't open /dev/urandom", 1095}, - {"couldn't read random data from /dev/urandom", 1096}, - {"can't open %s for reading", 1097}, - {"can't stat(%s)", 1098}, - {"%s doesn't have the correct filemodes", 1099}, - {"can't read data from %s", 1100}, - {"Can't read %s, exiting.", 1101}, - {"usage: last [-#] [-f file] [-t tty] [-h hostname] [user ...]\n", 1102}, - {" still logged in", 1103}, +Aborted.\n", 1076}, + {"field is too long.\n", 1077}, + {"'%c' is not allowed.\n", 1078}, + {"Control characters are not allowed.\n", 1079}, + {"Finger information *NOT* changed. Try again later.\n", 1080}, + {"Finger information changed.\n", 1081}, + {"malloc failed", 1082}, + {"%s: Your shell is not in /etc/shells, shell change denied\n", 1083}, + {"Changing shell for %s.\n", 1084}, + {"New shell", 1085}, + {"Shell not changed.\n", 1086}, + {"Shell *NOT* changed. Try again later.\n", 1087}, + {"Shell changed.\n", 1088}, + {"Usage: %s [ -s shell ] ", 1089}, + {"[ --list-shells ] [ --help ] [ --version ]\n", 1090}, + {" [ username ]\n", 1091}, + {"%s: shell must be a full path name.\n", 1092}, + {"%s: \"%s\" does not exist.\n", 1093}, + {"%s: \"%s\" is not executable.\n", 1094}, + {"%s: '%c' is not allowed.\n", 1095}, + {"%s: Control characters are not allowed.\n", 1096}, + {"Warning: \"%s\" is not listed in /etc/shells\n", 1097}, + {"%s: \"%s\" is not listed in /etc/shells.\n", 1098}, + {"%s: use -l option to see list\n", 1099}, + {"Warning: \"%s\" is not listed in /etc/shells.\n", 1100}, + {"Use %s -l to see list.\n", 1101}, + {"No known shells.\n", 1102}, + {"couldn't open /dev/urandom", 1103}, + {"couldn't read random data from /dev/urandom", 1104}, + {"can't open %s for reading", 1105}, + {"can't stat(%s)", 1106}, + {"%s doesn't have the correct filemodes", 1107}, + {"can't read data from %s", 1108}, + {"Can't read %s, exiting.", 1109}, + {"usage: last [-#] [-f file] [-t tty] [-h hostname] [user ...]\n", 1110}, + {" still logged in", 1111}, {"\ \n\ -wtmp begins %s", 1104}, - {"last: malloc failure.\n", 1105}, - {"last: gethostname", 1106}, +wtmp begins %s", 1112}, + {"last: malloc failure.\n", 1113}, + {"last: gethostname", 1114}, {"\ \n\ -interrupted %10.10s %5.5s \n", 1107}, - {"login: -h for super-user only.\n", 1108}, - {"usage: login [-fp] [username]\n", 1109}, - {"login: PAM Failure, aborting: %s\n", 1110}, - {"Couldn't initialize PAM: %s", 1111}, - {"login: ", 1112}, - {"FAILED LOGIN %d FROM %s FOR %s, %s", 1113}, +interrupted %10.10s %5.5s \n", 1115}, + {"login: -h for super-user only.\n", 1116}, + {"usage: login [-fp] [username]\n", 1117}, + {"login: PAM Failure, aborting: %s\n", 1118}, + {"Couldn't initialize PAM: %s", 1119}, + {"login: ", 1120}, + {"FAILED LOGIN %d FROM %s FOR %s, %s", 1121}, {"\ Login incorrect\n\ -\n", 1114}, - {"TOO MANY LOGIN TRIES (%d) FROM %s FOR %s, %s", 1115}, - {"FAILED LOGIN SESSION FROM %s FOR %s, %s", 1116}, +\n", 1122}, + {"TOO MANY LOGIN TRIES (%d) FROM %s FOR %s, %s", 1123}, + {"FAILED LOGIN SESSION FROM %s FOR %s, %s", 1124}, {"\ \n\ -Login incorrect\n", 1117}, - {"Illegal username", 1118}, - {"%s login refused on this terminal.\n", 1119}, - {"LOGIN %s REFUSED FROM %s ON TTY %s", 1120}, - {"LOGIN %s REFUSED ON TTY %s", 1121}, - {"Login incorrect\n", 1122}, +Login incorrect\n", 1125}, + {"Illegal username", 1126}, + {"%s login refused on this terminal.\n", 1127}, + {"LOGIN %s REFUSED FROM %s ON TTY %s", 1128}, + {"LOGIN %s REFUSED ON TTY %s", 1129}, + {"Login incorrect\n", 1130}, {"\ Too many users logged on already.\n\ -Try again later.\n", 1123}, - {"You have too many processes running.\n", 1124}, - {"Warning: no Kerberos tickets issued\n", 1125}, - {"Sorry -- your password has expired.\n", 1126}, - {"Warning: your password expires on %s %d, %d\n", 1127}, - {"Sorry -- your account has expired.\n", 1128}, - {"Warning: your account expires on %s %d, %d\n", 1129}, - {"DIALUP AT %s BY %s", 1130}, - {"ROOT LOGIN ON %s FROM %s", 1131}, - {"ROOT LOGIN ON %s", 1132}, - {"LOGIN ON %s BY %s FROM %s", 1133}, - {"LOGIN ON %s BY %s", 1134}, - {"You have %smail.\n", 1135}, - {"new ", 1136}, - {"login: failure forking: %s", 1137}, - {"setuid() failed", 1138}, - {"No directory %s!\n", 1139}, - {"Logging in with home = \"/\".\n", 1140}, - {"login: no memory for shell script.\n", 1141}, - {"login: couldn't exec shell script: %s.\n", 1142}, - {"login: no shell: %s.\n", 1143}, +Try again later.\n", 1131}, + {"You have too many processes running.\n", 1132}, + {"Warning: no Kerberos tickets issued\n", 1133}, + {"Sorry -- your password has expired.\n", 1134}, + {"Warning: your password expires on %d %s %d.\n", 1135}, + {"Sorry -- your account has expired.\n", 1136}, + {"Warning: your account expires on %d %s %d.\n", 1137}, + {"DIALUP AT %s BY %s", 1138}, + {"ROOT LOGIN ON %s FROM %s", 1139}, + {"ROOT LOGIN ON %s", 1140}, + {"LOGIN ON %s BY %s FROM %s", 1141}, + {"LOGIN ON %s BY %s", 1142}, + {"You have %smail.\n", 1143}, + {"new ", 1144}, + {"login: failure forking: %s", 1145}, + {"setuid() failed", 1146}, + {"No directory %s!\n", 1147}, + {"Logging in with home = \"/\".\n", 1148}, + {"login: no memory for shell script.\n", 1149}, + {"login: couldn't exec shell script: %s.\n", 1150}, + {"login: no shell: %s.\n", 1151}, {"\ \n\ -%s login: ", 1144}, - {"login name much too long.\n", 1145}, - {"NAME too long", 1146}, - {"login names may not start with '-'.\n", 1147}, - {"too many bare linefeeds.\n", 1148}, - {"EXCESSIVE linefeeds", 1149}, - {"Login timed out after %d seconds\n", 1150}, - {"Last login: %.*s ", 1151}, - {"from %.*s\n", 1152}, - {"on %.*s\n", 1153}, - {"LOGIN FAILURE FROM %s, %s", 1154}, - {"LOGIN FAILURE ON %s, %s", 1155}, - {"%d LOGIN FAILURES FROM %s, %s", 1156}, - {"%d LOGIN FAILURES ON %s, %s", 1157}, - {"is y\n", 1158}, - {"is n\n", 1159}, - {"usage: mesg [y | n]\n", 1160}, - {"newgrp: Who are you?", 1161}, - {"newgrp: setgid", 1162}, - {"newgrp: No such group.", 1163}, - {"newgrp: Permission denied", 1164}, - {"newgrp: setuid", 1165}, - {"No shell", 1166}, - {"The password must have at least 6 characters, try again.\n", 1167}, - {"The password must contain characters out of two of the following\n", 1168}, - {"classes: upper and lower case letters, digits and non alphanumeric\n", 1169}, - {"characters. See passwd(1) for more information.\n", 1170}, - {"You cannot reuse the old password.\n", 1171}, - {"Please don't use something like your username as password!\n", 1172}, - {"Please don't use something like your realname as password!\n", 1173}, - {"Usage: passwd [username [password]]\n", 1174}, - {"Only root may use the one and two argument forms.\n", 1175}, - {"Usage: passwd [-foqsvV] [user [password]]\n", 1176}, - {"Can't exec %s: %s\n", 1177}, - {"Cannot find login name", 1178}, - {"Only root can change the password for others.\n", 1179}, - {"Too many arguments.\n", 1180}, - {"Can't find username anywhere. Is `%s' really a user?", 1181}, - {"Sorry, I can only change local passwords. Use yppasswd instead.", 1182}, - {"UID and username does not match, imposter!", 1183}, - {"Changing password for %s\n", 1184}, - {"Enter old password: ", 1185}, - {"Illegal password, imposter.", 1186}, - {"Enter new password: ", 1187}, - {"Password not changed.", 1188}, - {"Re-type new password: ", 1189}, - {"You misspelled it. Password not changed.", 1190}, - {"password changed, user %s", 1191}, - {"ROOT PASSWORD CHANGED", 1192}, - {"password changed by root, user %s", 1193}, - {"calling setpwnam to set password.\n", 1194}, - {"Password *NOT* changed. Try again later.\n", 1195}, - {"Password changed.\n", 1196}, - {"Usage: shutdown [-h|-r] [-fqs] [now|hh:ss|+mins]\n", 1197}, - {"Shutdown process aborted", 1198}, - {"%s: Only root can shut a system down.\n", 1199}, - {"That must be tomorrow, can't you wait till then?\n", 1200}, - {"for maintenance; bounce, bounce", 1201}, - {"timeout = %d, quiet = %d, reboot = %d\n", 1202}, - {"The system is being shut down within 5 minutes", 1203}, - {"Login is therefore prohibited.", 1204}, - {"%s by %s: %s", 1205}, - {"rebooted", 1206}, - {"halted", 1207}, +%s login: ", 1152}, + {"login name much too long.\n", 1153}, + {"NAME too long", 1154}, + {"login names may not start with '-'.\n", 1155}, + {"too many bare linefeeds.\n", 1156}, + {"EXCESSIVE linefeeds", 1157}, + {"Login timed out after %d seconds\n", 1158}, + {"Last login: %.*s ", 1159}, + {"from %.*s\n", 1160}, + {"on %.*s\n", 1161}, + {"LOGIN FAILURE FROM %s, %s", 1162}, + {"LOGIN FAILURE ON %s, %s", 1163}, + {"%d LOGIN FAILURES FROM %s, %s", 1164}, + {"%d LOGIN FAILURES ON %s, %s", 1165}, + {"is y\n", 1166}, + {"is n\n", 1167}, + {"usage: mesg [y | n]\n", 1168}, + {"newgrp: Who are you?", 1169}, + {"newgrp: setgid", 1170}, + {"newgrp: No such group.", 1171}, + {"newgrp: Permission denied", 1172}, + {"newgrp: setuid", 1173}, + {"No shell", 1174}, + {"The password must have at least 6 characters, try again.\n", 1175}, + {"The password must contain characters out of two of the following\n", 1176}, + {"classes: upper and lower case letters, digits and non alphanumeric\n", 1177}, + {"characters. See passwd(1) for more information.\n", 1178}, + {"You cannot reuse the old password.\n", 1179}, + {"Please don't use something like your username as password!\n", 1180}, + {"Please don't use something like your realname as password!\n", 1181}, + {"Usage: passwd [username [password]]\n", 1182}, + {"Only root may use the one and two argument forms.\n", 1183}, + {"Usage: passwd [-foqsvV] [user [password]]\n", 1184}, + {"Can't exec %s: %s\n", 1185}, + {"Cannot find login name", 1186}, + {"Only root can change the password for others.\n", 1187}, + {"Too many arguments.\n", 1188}, + {"Can't find username anywhere. Is `%s' really a user?", 1189}, + {"Sorry, I can only change local passwords. Use yppasswd instead.", 1190}, + {"UID and username does not match, imposter!", 1191}, + {"Changing password for %s\n", 1192}, + {"Enter old password: ", 1193}, + {"Illegal password, imposter.", 1194}, + {"Enter new password: ", 1195}, + {"Password not changed.", 1196}, + {"Re-type new password: ", 1197}, + {"You misspelled it. Password not changed.", 1198}, + {"password changed, user %s", 1199}, + {"ROOT PASSWORD CHANGED", 1200}, + {"password changed by root, user %s", 1201}, + {"calling setpwnam to set password.\n", 1202}, + {"Password *NOT* changed. Try again later.\n", 1203}, + {"Password changed.\n", 1204}, + {"Usage: shutdown [-h|-r] [-fqs] [now|hh:ss|+mins]\n", 1205}, + {"Shutdown process aborted", 1206}, + {"%s: Only root can shut a system down.\n", 1207}, + {"That must be tomorrow, can't you wait till then?\n", 1208}, + {"for maintenance; bounce, bounce", 1209}, + {"timeout = %d, quiet = %d, reboot = %d\n", 1210}, + {"The system is being shut down within 5 minutes", 1211}, + {"Login is therefore prohibited.", 1212}, + {"%s by %s: %s", 1213}, + {"rebooted", 1214}, + {"halted", 1215}, {"\ \n\ -Why am I still alive after reboot?", 1208}, +Why am I still alive after reboot?", 1216}, {"\ \n\ -Now you can turn off the power...", 1209}, - {"Calling kernel power-off facility...\n", 1210}, - {"Error powering off\t%s\n", 1211}, - {"Executing the program \"%s\" ...\n", 1212}, - {"Error executing\t%s\n", 1213}, - {"URGENT: broadcast message from %s:", 1214}, - {"System going down IMMEDIATELY!\n", 1215}, - {"System going down in %d hour%s %d minutes", 1216}, - {"s", 1217}, - {"System going down in %d minute%s\n", 1218}, - {"\t... %s ...\n", 1219}, - {"Cannot fork for swapoff. Shrug!", 1220}, - {"Cannot exec swapoff, hoping umount will do the trick.", 1221}, - {"Cannot fork for umount, trying manually.", 1222}, - {"Cannot exec %s, trying umount.\n", 1223}, - {"Cannot exec umount, giving up on umount.", 1224}, - {"Unmounting any remaining filesystems...", 1225}, - {"shutdown: Couldn't umount %s\n", 1226}, - {"Booting to single user mode.\n", 1227}, - {"exec of single user shell failed\n", 1228}, - {"fork of single user shell failed\n", 1229}, - {"error opening fifo\n", 1230}, +Now you can turn off the power...", 1217}, + {"Calling kernel power-off facility...\n", 1218}, + {"Error powering off\t%s\n", 1219}, + {"Executing the program \"%s\" ...\n", 1220}, + {"Error executing\t%s\n", 1221}, + {"URGENT: broadcast message from %s:", 1222}, + {"System going down in %d hours %d minutes", 1223}, + {"System going down in 1 hour %d minutes", 1224}, + {"System going down in %d minutes\n", 1225}, + {"System going down in 1 minute\n", 1226}, + {"System going down IMMEDIATELY!\n", 1227}, + {"\t... %s ...\n", 1228}, + {"Cannot fork for swapoff. Shrug!", 1229}, + {"Cannot exec swapoff, hoping umount will do the trick.", 1230}, + {"Cannot fork for umount, trying manually.", 1231}, + {"Cannot exec %s, trying umount.\n", 1232}, + {"Cannot exec umount, giving up on umount.", 1233}, + {"Unmounting any remaining filesystems...", 1234}, + {"shutdown: Couldn't umount %s: %s\n", 1235}, + {"Booting to single user mode.\n", 1236}, + {"exec of single user shell failed\n", 1237}, + {"fork of single user shell failed\n", 1238}, + {"error opening fifo\n", 1239}, + {"error running finalprog\n", 1240}, + {"error forking finalprog\n", 1241}, {"\ \n\ -Wrong password.\n", 1231}, - {"stat of path failed\n", 1232}, - {"open of directory failed\n", 1233}, - {"fork failed\n", 1234}, - {"exec failed\n", 1235}, - {"cannot open inittab\n", 1236}, - {"no TERM or cannot stat tty\n", 1237}, - {"error running programme\n", 1238}, - {"too many iov's (change code in wall/ttymsg.c)", 1239}, - {"excessively long line arg", 1240}, - {"cannot fork", 1241}, - {"fork: %s", 1242}, - {"%s: BAD ERROR", 1243}, - {"%s: the %s file is busy.\n", 1244}, - {"%s: the %s file is busy (%s present)\n", 1245}, - {"%s: can't link %s: %s\n", 1246}, - {"%s: can't unlock %s: %s (your changes are still in %s)\n", 1247}, - {"%s: Cannot fork\n", 1248}, - {"%s: %s unchanged\n", 1249}, - {"%s: no changes made\n", 1250}, - {"usage: %s [file]\n", 1251}, - {"%s: can't open temporary file.\n", 1252}, - {"Broadcast Message from %s@%s", 1253}, - {"%s: can't read %s.\n", 1254}, - {"%s: can't stat temporary file.\n", 1255}, - {"%s: can't read temporary file.\n", 1256}, - {"illegal month value: use 1-12", 1257}, - {"illegal year value: use 1-9999", 1258}, - {"usage: cal [-mjyV] [[month] year]\n", 1259}, - {"usage: %s [+format] [day month year]\n", 1260}, - {"St. Tib's Day", 1261}, - {"%s: unknown signal %s\n", 1262}, - {"%s: can't find process \"%s\"\n", 1263}, - {"%s: unknown signal %s; valid signals:\n", 1264}, - {"usage: %s [ -s signal | -p ] [ -a ] pid ...\n", 1265}, - {" %s -l [ signal ]\n", 1266}, - {"logger: %s: %s.\n", 1267}, - {"logger: unknown facility name: %s.\n", 1268}, - {"logger: unknown priority name: %s.\n", 1269}, - {"\ -usage: logger [-is] [-f file] [-p pri] [-t tag] [-u socket] [ message ... ]\n", 1270}, - {"usage: look [-dfa] [-t char] string [file]\n", 1271}, - {"Could not open %s\n", 1272}, - {"Got %d bytes from %s\n", 1273}, - {"namei: unable to get current directory - %s\n", 1274}, - {"namei: unable to chdir to %s - %s (%d)\n", 1275}, - {"usage: namei [-mx] pathname [pathname ...]\n", 1276}, - {"namei: could not chdir to root!\n", 1277}, - {"namei: could not stat root!\n", 1278}, - {" ? could not chdir into %s - %s (%d)\n", 1279}, - {" ? problems reading symlink %s - %s (%d)\n", 1280}, - {" *** EXCEEDED UNIX LIMIT OF SYMLINKS ***\n", 1281}, - {"namei: unknown file type 0%06o on file %s\n", 1282}, - {"usage: script [-a] [file]\n", 1283}, - {"Script started, file is %s\n", 1284}, - {"Script started on %s", 1285}, +Wrong password.\n", 1242}, + {"stat of path failed\n", 1243}, + {"open of directory failed\n", 1244}, + {"fork failed\n", 1245}, + {"exec failed\n", 1246}, + {"cannot open inittab\n", 1247}, + {"no TERM or cannot stat tty\n", 1248}, + {"error running programme\n", 1249}, + {"too many iov's (change code in wall/ttymsg.c)", 1250}, + {"excessively long line arg", 1251}, + {"cannot fork", 1252}, + {"fork: %s", 1253}, + {"%s: BAD ERROR", 1254}, + {"%s: the %s file is busy.\n", 1255}, + {"%s: the %s file is busy (%s present)\n", 1256}, + {"%s: can't link %s: %s\n", 1257}, + {"%s: can't unlock %s: %s (your changes are still in %s)\n", 1258}, + {"%s: Cannot fork\n", 1259}, + {"%s: %s unchanged\n", 1260}, + {"%s: no changes made\n", 1261}, + {"usage: %s [file]\n", 1262}, + {"%s: can't open temporary file.\n", 1263}, + {"Broadcast Message from %s@%s", 1264}, + {"%s: will not read %s - use stdin.\n", 1265}, + {"%s: can't read %s.\n", 1266}, + {"%s: can't stat temporary file.\n", 1267}, + {"%s: can't read temporary file.\n", 1268}, + {"illegal month value: use 1-12", 1269}, + {"illegal year value: use 1-9999", 1270}, + {"usage: cal [-mjyV] [[month] year]\n", 1271}, + {"usage: %s [+format] [day month year]\n", 1272}, + {"St. Tib's Day", 1273}, + {"%s: unknown signal %s\n", 1274}, + {"%s: can't find process \"%s\"\n", 1275}, + {"%s: unknown signal %s; valid signals:\n", 1276}, + {"usage: %s [ -s signal | -p ] [ -a ] pid ...\n", 1277}, + {" %s -l [ signal ]\n", 1278}, + {"logger: %s: %s.\n", 1279}, + {"logger: unknown facility name: %s.\n", 1280}, + {"logger: unknown priority name: %s.\n", 1281}, + {"\ +usage: logger [-is] [-f file] [-p pri] [-t tag] [-u socket] [ message ... ]\n", 1282}, + {"usage: look [-dfa] [-t char] string [file]\n", 1283}, + {"Could not open %s\n", 1284}, + {"Got %d bytes from %s\n", 1285}, + {"namei: unable to get current directory - %s\n", 1286}, + {"namei: unable to chdir to %s - %s (%d)\n", 1287}, + {"usage: namei [-mx] pathname [pathname ...]\n", 1288}, + {"namei: could not chdir to root!\n", 1289}, + {"namei: could not stat root!\n", 1290}, + {" ? could not chdir into %s - %s (%d)\n", 1291}, + {" ? problems reading symlink %s - %s (%d)\n", 1292}, + {" *** EXCEEDED UNIX LIMIT OF SYMLINKS ***\n", 1293}, + {"namei: unknown file type 0%06o on file %s\n", 1294}, + {"\ +Warning: `%s' is a symlink.\n\ +Use `%s [options] %s' if you really want to use it.\n\ +Script not started.\n", 1295}, + {"usage: script [-a] [-f] [-q] [file]\n", 1296}, + {"Script started, file is %s\n", 1297}, + {"Script started on %s", 1298}, {"\ \n\ -Script done on %s", 1286}, - {"Script done, file is %s\n", 1287}, - {"openpty failed\n", 1288}, - {"Out of pty's\n", 1289}, - {"%s: Argument error, usage\n", 1290}, - {" [ -term terminal_name ]\n", 1291}, - {" [ -reset ]\n", 1292}, - {" [ -initialize ]\n", 1293}, - {" [ -cursor [on|off] ]\n", 1294}, - {" [ -snow [on|off] ]\n", 1295}, - {" [ -softscroll [on|off] ]\n", 1296}, - {" [ -repeat [on|off] ]\n", 1297}, - {" [ -appcursorkeys [on|off] ]\n", 1298}, - {" [ -linewrap [on|off] ]\n", 1299}, - {" [ -default ]\n", 1300}, - {" [ -foreground black|blue|green|cyan", 1301}, - {"|red|magenta|yellow|white|default ]\n", 1302}, - {" [ -background black|blue|green|cyan", 1303}, - {" [ -ulcolor black|grey|blue|green|cyan", 1304}, - {"|red|magenta|yellow|white ]\n", 1305}, - {" [ -ulcolor bright blue|green|cyan", 1306}, - {" [ -hbcolor black|grey|blue|green|cyan", 1307}, - {" [ -hbcolor bright blue|green|cyan", 1308}, - {" [ -standout [ attr ] ]\n", 1309}, - {" [ -inversescreen [on|off] ]\n", 1310}, - {" [ -bold [on|off] ]\n", 1311}, - {" [ -half-bright [on|off] ]\n", 1312}, - {" [ -blink [on|off] ]\n", 1313}, - {" [ -reverse [on|off] ]\n", 1314}, - {" [ -underline [on|off] ]\n", 1315}, - {" [ -store ]\n", 1316}, - {" [ -clear [all|rest] ]\n", 1317}, - {" [ -tabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)\n", 1318}, - {" [ -clrtabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)\n", 1319}, - {" [ -regtabs [1-160] ]\n", 1320}, - {" [ -blank [0-60] ]\n", 1321}, - {" [ -dump [1-NR_CONSOLES] ]\n", 1322}, - {" [ -append [1-NR_CONSOLES] ]\n", 1323}, - {" [ -file dumpfilename ]\n", 1324}, - {" [ -msg [on|off] ]\n", 1325}, - {" [ -msglevel [0-8] ]\n", 1326}, - {" [ -powersave [on|vsync|hsync|powerdown|off] ]\n", 1327}, - {" [ -powerdown [0-60] ]\n", 1328}, - {" [ -blength [0-2000] ]\n", 1329}, - {" [ -bfreq freqnumber ]\n", 1330}, - {"snow.on", 1331}, - {"snow.off", 1332}, - {"softscroll.on", 1333}, - {"softscroll.off", 1334}, - {"cannot (un)set powersave mode\n", 1335}, - {"klogctl error: %s\n", 1336}, - {"Error reading %s\n", 1337}, - {"Error writing screendump\n", 1338}, - {"couldn't read %s, and cannot ioctl dump\n", 1339}, - {"%s: $TERM is not defined.\n", 1340}, - {"usage: tsort [ inputfile ]\n", 1341}, - {"tsort: odd data count.\n", 1342}, - {"tsort: cycle in data.\n", 1343}, - {"tsort: internal error -- could not find cycle.\n", 1344}, - {"whereis [ -sbmu ] [ -SBM dir ... -f ] name...\n", 1345}, - {"write: can't find your tty's name\n", 1346}, - {"write: you have write permission turned off.\n", 1347}, - {"write: %s is not logged in on %s.\n", 1348}, - {"write: %s has messages disabled on %s\n", 1349}, - {"usage: write user [tty]\n", 1350}, - {"write: %s is not logged in\n", 1351}, - {"write: %s has messages disabled\n", 1352}, - {"write: %s is logged in more than once; writing to %s\n", 1353}, - {"Message from %s@%s on %s at %s ...", 1354}, - {"warning: error reading %s: %s", 1355}, - {"warning: can't open %s: %s", 1356}, - {"mount: could not open %s - using %s instead\n", 1357}, - {"can't create lock file %s: %s (use -n flag to override)", 1358}, - {"can't link lock file %s: %s (use -n flag to override)", 1359}, - {"can't open lock file %s: %s (use -n flag to override)", 1360}, - {"Can't lock lock file %s: %s\n", 1361}, - {"can't lock lock file %s: %s", 1362}, - {"timed out", 1363}, +Script done on %s", 1299}, + {"Script done, file is %s\n", 1300}, + {"openpty failed\n", 1301}, + {"Out of pty's\n", 1302}, + {"%s: Argument error, usage\n", 1303}, + {" [ -term terminal_name ]\n", 1304}, + {" [ -reset ]\n", 1305}, + {" [ -initialize ]\n", 1306}, + {" [ -cursor [on|off] ]\n", 1307}, + {" [ -snow [on|off] ]\n", 1308}, + {" [ -softscroll [on|off] ]\n", 1309}, + {" [ -repeat [on|off] ]\n", 1310}, + {" [ -appcursorkeys [on|off] ]\n", 1311}, + {" [ -linewrap [on|off] ]\n", 1312}, + {" [ -default ]\n", 1313}, + {" [ -foreground black|blue|green|cyan", 1314}, + {"|red|magenta|yellow|white|default ]\n", 1315}, + {" [ -background black|blue|green|cyan", 1316}, + {" [ -ulcolor black|grey|blue|green|cyan", 1317}, + {"|red|magenta|yellow|white ]\n", 1318}, + {" [ -ulcolor bright blue|green|cyan", 1319}, + {" [ -hbcolor black|grey|blue|green|cyan", 1320}, + {" [ -hbcolor bright blue|green|cyan", 1321}, + {" [ -standout [ attr ] ]\n", 1322}, + {" [ -inversescreen [on|off] ]\n", 1323}, + {" [ -bold [on|off] ]\n", 1324}, + {" [ -half-bright [on|off] ]\n", 1325}, + {" [ -blink [on|off] ]\n", 1326}, + {" [ -reverse [on|off] ]\n", 1327}, + {" [ -underline [on|off] ]\n", 1328}, + {" [ -store ]\n", 1329}, + {" [ -clear [all|rest] ]\n", 1330}, + {" [ -tabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)\n", 1331}, + {" [ -clrtabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)\n", 1332}, + {" [ -regtabs [1-160] ]\n", 1333}, + {" [ -blank [0-60] ]\n", 1334}, + {" [ -dump [1-NR_CONSOLES] ]\n", 1335}, + {" [ -append [1-NR_CONSOLES] ]\n", 1336}, + {" [ -file dumpfilename ]\n", 1337}, + {" [ -msg [on|off] ]\n", 1338}, + {" [ -msglevel [0-8] ]\n", 1339}, + {" [ -powersave [on|vsync|hsync|powerdown|off] ]\n", 1340}, + {" [ -powerdown [0-60] ]\n", 1341}, + {" [ -blength [0-2000] ]\n", 1342}, + {" [ -bfreq freqnumber ]\n", 1343}, + {"snow.on", 1344}, + {"snow.off", 1345}, + {"softscroll.on", 1346}, + {"softscroll.off", 1347}, + {"cannot (un)set powersave mode\n", 1348}, + {"klogctl error: %s\n", 1349}, + {"Error reading %s\n", 1350}, + {"Error writing screendump\n", 1351}, + {"couldn't read %s, and cannot ioctl dump\n", 1352}, + {"%s: $TERM is not defined.\n", 1353}, + {"usage: tsort [ inputfile ]\n", 1354}, + {"tsort: odd data count.\n", 1355}, + {"tsort: cycle in data.\n", 1356}, + {"tsort: internal error -- could not find cycle.\n", 1357}, + {"whereis [ -sbmu ] [ -SBM dir ... -f ] name...\n", 1358}, + {"write: can't find your tty's name\n", 1359}, + {"write: you have write permission turned off.\n", 1360}, + {"write: %s is not logged in on %s.\n", 1361}, + {"write: %s has messages disabled on %s\n", 1362}, + {"usage: write user [tty]\n", 1363}, + {"write: %s is not logged in\n", 1364}, + {"write: %s has messages disabled\n", 1365}, + {"write: %s is logged in more than once; writing to %s\n", 1366}, + {"Message from %s@%s (as %s) on %s at %s ...", 1367}, + {"Message from %s@%s on %s at %s ...", 1368}, + {"warning: error reading %s: %s", 1369}, + {"warning: can't open %s: %s", 1370}, + {"mount: could not open %s - using %s instead\n", 1371}, + {"can't create lock file %s: %s (use -n flag to override)", 1372}, + {"can't link lock file %s: %s (use -n flag to override)", 1373}, + {"can't open lock file %s: %s (use -n flag to override)", 1374}, + {"Can't lock lock file %s: %s\n", 1375}, + {"can't lock lock file %s: %s", 1376}, + {"timed out", 1377}, {"\ Cannot create link %s\n\ -Perhaps there is a stale lock file?\n", 1364}, - {"cannot open %s (%s) - mtab not updated", 1365}, - {"mount: warning: cannot change mounted device with a remount\n", 1366}, - {"mount: warning: cannot change filesystem type with a remount\n", 1367}, - {"error writing %s: %s", 1368}, - {"error changing mode of %s: %s\n", 1369}, - {"can't rename %s to %s: %s\n", 1370}, - {"loop: can't open device %s: %s\n", 1371}, - {"loop: can't get info on device %s: %s\n", 1372}, - {"%s: [%04x]:%ld (%s) offset %d, %s encryption\n", 1373}, - {"mount: could not find any device /dev/loop#", 1374}, +Perhaps there is a stale lock file?\n", 1378}, + {"cannot open %s (%s) - mtab not updated", 1379}, + {"error writing %s: %s", 1380}, + {"error changing mode of %s: %s\n", 1381}, + {"can't rename %s to %s: %s\n", 1382}, + {"loop: can't open device %s: %s\n", 1383}, + {"loop: can't get info on device %s: %s\n", 1384}, + {"%s: [%04x]:%ld (%s) offset %d, %s encryption\n", 1385}, + {"mount: could not find any device /dev/loop#", 1386}, {"\ mount: Could not find any loop device.\n\ - Maybe /dev/loop# has a wrong major number?", 1375}, + Maybe /dev/loop# has a wrong major number?", 1387}, {"\ mount: Could not find any loop device, and, according to %s,\n\ this kernel does not know about the loop device.\n\ - (If so, then recompile or `insmod loop.o'.)", 1376}, + (If so, then recompile or `insmod loop.o'.)", 1388}, {"\ mount: Could not find any loop device. Maybe this kernel does not know\n\ about the loop device (then recompile or `insmod loop.o'), or\n\ - maybe /dev/loop# has the wrong major number?", 1377}, - {"mount: could not find any free loop device", 1378}, - {"Unsupported encryption type %s\n", 1379}, - {"Couldn't lock into memory, exiting.\n", 1380}, - {"Init (up to 16 hex digits): ", 1381}, - {"Non-hex digit '%c'.\n", 1382}, - {"Don't know how to get key for encryption system %d\n", 1383}, - {"set_loop(%s,%s,%d): success\n", 1384}, - {"loop: can't delete device %s: %s\n", 1385}, - {"del_loop(%s): success\n", 1386}, - {"This mount was compiled without loop support. Please recompile.\n", 1387}, + maybe /dev/loop# has the wrong major number?", 1389}, + {"mount: could not find any free loop device", 1390}, + {"Unsupported encryption type %s\n", 1391}, + {"Couldn't lock into memory, exiting.\n", 1392}, + {"Init (up to 16 hex digits): ", 1393}, + {"Non-hex digit '%c'.\n", 1394}, + {"Don't know how to get key for encryption system %d\n", 1395}, + {"set_loop(%s,%s,%d): success\n", 1396}, + {"loop: can't delete device %s: %s\n", 1397}, + {"del_loop(%s): success\n", 1398}, + {"This mount was compiled without loop support. Please recompile.\n", 1399}, {"\ usage:\n\ %s loop_device # give info\n\ %s -d loop_device # delete\n\ - %s [ -e encryption ] [ -o offset ] loop_device file # setup\n", 1388}, - {"not enough memory", 1389}, - {"No loop support was available at compile time. Please recompile.\n", 1390}, - {"[mntent]: warning: no final newline at the end of %s\n", 1391}, - {"[mntent]: line %d in %s is bad%s\n", 1392}, - {"; rest of file ignored", 1393}, - {"mount: according to mtab, %s is already mounted on %s", 1394}, - {"mount: according to mtab, %s is mounted on %s", 1395}, - {"mount: can't open %s for writing: %s", 1396}, - {"mount: error writing %s: %s", 1397}, - {"mount: error changing mode of %s: %s", 1398}, - {"%s looks like swapspace - not mounted", 1399}, - {"mount failed", 1400}, - {"mount: only root can mount %s on %s", 1401}, - {"mount: loop device specified twice", 1402}, - {"mount: type specified twice", 1403}, - {"mount: skipping the setup of a loop device\n", 1404}, - {"mount: going to use the loop device %s\n", 1405}, - {"mount: failed setting up loop device\n", 1406}, - {"mount: setup loop device successfully\n", 1407}, - {"mount: can't open %s: %s", 1408}, - {"mount: cannot not open %s for setting speed", 1409}, - {"mount: cannot set speed: %s", 1410}, - {"mount: cannot fork: %s", 1411}, - {"mount: this version was compiled without support for the type `nfs'", 1412}, - {"mount: failed with nfs mount version 4, trying 3..\n", 1413}, - {"\ -mount: I could not determine the filesystem type, and none was specified", 1414}, - {"mount: you must specify the filesystem type", 1415}, - {"mount: mount failed", 1416}, - {"mount: mount point %s is not a directory", 1417}, - {"mount: permission denied", 1418}, - {"mount: must be superuser to use mount", 1419}, - {"mount: %s is busy", 1420}, - {"mount: proc already mounted", 1421}, - {"mount: %s already mounted or %s busy", 1422}, - {"mount: mount point %s does not exist", 1423}, - {"mount: mount point %s is a symbolic link to nowhere", 1424}, - {"mount: special device %s does not exist", 1425}, + %s [ -e encryption ] [ -o offset ] loop_device file # setup\n", 1400}, + {"not enough memory", 1401}, + {"No loop support was available at compile time. Please recompile.\n", 1402}, + {"[mntent]: warning: no final newline at the end of %s\n", 1403}, + {"[mntent]: line %d in %s is bad%s\n", 1404}, + {"; rest of file ignored", 1405}, + {"mount: according to mtab, %s is already mounted on %s", 1406}, + {"mount: according to mtab, %s is mounted on %s", 1407}, + {"mount: can't open %s for writing: %s", 1408}, + {"mount: error writing %s: %s", 1409}, + {"mount: error changing mode of %s: %s", 1410}, + {"%s looks like swapspace - not mounted", 1411}, + {"mount failed", 1412}, + {"mount: only root can mount %s on %s", 1413}, + {"mount: loop device specified twice", 1414}, + {"mount: type specified twice", 1415}, + {"mount: skipping the setup of a loop device\n", 1416}, + {"mount: going to use the loop device %s\n", 1417}, + {"mount: failed setting up loop device\n", 1418}, + {"mount: setup loop device successfully\n", 1419}, + {"mount: can't open %s: %s", 1420}, + {"mount: cannot not open %s for setting speed", 1421}, + {"mount: cannot set speed: %s", 1422}, + {"mount: cannot fork: %s", 1423}, + {"mount: this version was compiled without support for the type `nfs'", 1424}, + {"mount: failed with nfs mount version 4, trying 3..\n", 1425}, + {"\ +mount: I could not determine the filesystem type, and none was specified", 1426}, + {"mount: you must specify the filesystem type", 1427}, + {"mount: mount failed", 1428}, + {"mount: mount point %s is not a directory", 1429}, + {"mount: permission denied", 1430}, + {"mount: must be superuser to use mount", 1431}, + {"mount: %s is busy", 1432}, + {"mount: proc already mounted", 1433}, + {"mount: %s already mounted or %s busy", 1434}, + {"mount: mount point %s does not exist", 1435}, + {"mount: mount point %s is a symbolic link to nowhere", 1436}, + {"mount: special device %s does not exist", 1437}, {"\ mount: special device %s does not exist\n\ - (a path prefix is not a directory)\n", 1426}, - {"mount: %s not mounted already, or bad option", 1427}, + (a path prefix is not a directory)\n", 1438}, + {"mount: %s not mounted already, or bad option", 1439}, {"\ mount: wrong fs type, bad option, bad superblock on %s,\n\ - or too many mounted file systems", 1428}, - {"mount table full", 1429}, - {"mount: %s: can't read superblock", 1430}, - {"mount: %s has wrong major or minor number", 1431}, - {"mount: fs type %s not supported by kernel", 1432}, - {"mount: probably you meant %s", 1433}, - {"mount: maybe you meant iso9660 ?", 1434}, - {"mount: %s has wrong device number or fs type %s not supported", 1435}, - {"mount: %s is not a block device, and stat fails?", 1436}, + or too many mounted file systems", 1440}, + {"mount table full", 1441}, + {"mount: %s: can't read superblock", 1442}, + {"mount: %s: unknown device", 1443}, + {"mount: fs type %s not supported by kernel", 1444}, + {"mount: probably you meant %s", 1445}, + {"mount: maybe you meant iso9660 ?", 1446}, + {"mount: %s has wrong device number or fs type %s not supported", 1447}, + {"mount: %s is not a block device, and stat fails?", 1448}, {"\ mount: the kernel does not recognize %s as a block device\n\ - (maybe `insmod driver'?)", 1437}, - {"mount: %s is not a block device (maybe try `-o loop'?)", 1438}, - {"mount: %s is not a block device", 1439}, - {"mount: %s is not a valid block device", 1440}, - {"block device ", 1441}, - {"mount: %s%s is not permitted on its filesystem", 1442}, - {"mount: %s%s is write-protected but explicit `-w' flag given", 1443}, - {"mount: %s%s is write-protected, mounting read-only", 1444}, - {"mount: consider mounting %s by %s\n", 1445}, - {"UUID", 1446}, - {"label", 1447}, - {"mount: no such partition found", 1448}, - {"mount: no type was given - I'll assume nfs because of the colon\n", 1449}, - {"mount: backgrounding \"%s\"\n", 1450}, - {"mount: giving up \"%s\"\n", 1451}, - {"mount: %s already mounted on %s\n", 1452}, - {"\ -Usage: mount [-lhV]\n\ - mount -a [-nfFrsvw] [-t vfstypes]\n\ - mount [-nfrsvw] [-o options] special | node\n\ - mount [-nfrsvw] [-t vfstype] [-o options] special node\n\ - A special device can be indicated by -L label or -U uuid .\n", 1453}, - {"mount: only root can do that", 1454}, - {"mount: no %s found - creating it..\n", 1455}, - {"mount: mounting %s\n", 1456}, - {"not mounted anything", 1457}, - {"mount: cannot find %s in %s", 1458}, - {"mount: can't find %s in %s or %s", 1459}, - {"mount: bad UUID", 1460}, - {"mount: you didn't specify a filesystem type for %s\n", 1461}, - {" I will try all types mentioned in %s or %s\n", 1462}, - {" and it looks like this is swapspace\n", 1463}, - {" I will try type %s\n", 1464}, - {"Trying %s\n", 1465}, - {"mount: excessively long host:dir argument\n", 1466}, - {"mount: warning: multiple hostnames not supported\n", 1467}, - {"mount: directory to mount not in host:dir format\n", 1468}, - {"mount: can't get address for %s\n", 1469}, - {"mount: got bad hp->h_length\n", 1470}, - {"mount: excessively long option argument\n", 1471}, - {"Warning: Unrecognized proto= option.\n", 1472}, - {"Warning: Option namlen is not supported.\n", 1473}, - {"unknown nfs mount parameter: %s=%d\n", 1474}, - {"Warning: option nolock is not supported.\n", 1475}, - {"unknown nfs mount option: %s%s\n", 1476}, - {"mount: got bad hp->h_length?\n", 1477}, - {"NFS over TCP is not supported.\n", 1478}, - {"nfs socket", 1479}, - {"nfs bindresvport", 1480}, - {"used portmapper to find NFS port\n", 1481}, - {"using port %d for nfs deamon\n", 1482}, - {"nfs connect", 1483}, - {"unknown nfs status return value: %d", 1484}, - {"bug in xstrndup call", 1485}, + (maybe `insmod driver'?)", 1449}, + {"mount: %s is not a block device (maybe try `-o loop'?)", 1450}, + {"mount: %s is not a block device", 1451}, + {"mount: %s is not a valid block device", 1452}, + {"block device ", 1453}, + {"mount: cannot mount %s%s read-only", 1454}, + {"mount: %s%s is write-protected but explicit `-w' flag given", 1455}, + {"mount: %s%s is write-protected, mounting read-only", 1456}, + {"mount: going to mount %s by %s\n", 1457}, + {"UUID", 1458}, + {"label", 1459}, + {"mount: no such partition found", 1460}, + {"mount: no type was given - I'll assume nfs because of the colon\n", 1461}, + {"mount: backgrounding \"%s\"\n", 1462}, + {"mount: giving up \"%s\"\n", 1463}, + {"mount: %s already mounted on %s\n", 1464}, + {"\ +Usage: mount -V : print version\n\ + mount -h : print this help\n\ + mount : list mounted filesystems\n\ + mount -l : idem, including volume labels\n\ +So far the informational part. Next the mounting.\n\ +The command is `mount [-t fstype] something somewhere'.\n\ +Details found in /etc/fstab may be omitted.\n\ + mount -a : mount all stuff from /etc/fstab\n\ + mount device : mount device at the known place\n\ + mount directory : mount known device here\n\ + mount -t type dev dir : ordinary mount command\n\ +Note that one does not really mount a device, one mounts\n\ +a filesystem (of the given type) found on the device.\n\ +One can also mount an already visible directory tree elsewhere:\n\ + mount --bind olddir newdir\n\ +A device can be given by name, say /dev/hda1 or /dev/cdrom,\n\ +or by label, using -L label or by uuid, using -U uuid .\n\ +Union or stack mounts are specified using one of\n\ + --replace, --after, --before, --over\n\ +Other options: [-nfFrsvw] [-o options].\n\ +For many more details, say man 8 mount .\n", 1465}, + {"mount: only root can do that", 1466}, + {"mount: no %s found - creating it..\n", 1467}, + {"mount: mounting %s\n", 1468}, + {"not mounted anything", 1469}, + {"mount: cannot find %s in %s", 1470}, + {"mount: can't find %s in %s or %s", 1471}, + {"\ +mount: could not open %s, so UUID and LABEL conversion cannot be done.\n", 1472}, + {"mount: bad UUID", 1473}, + {"mount: you didn't specify a filesystem type for %s\n", 1474}, + {" I will try all types mentioned in %s or %s\n", 1475}, + {" and it looks like this is swapspace\n", 1476}, + {" I will try type %s\n", 1477}, + {"Trying %s\n", 1478}, + {"mount: excessively long host:dir argument\n", 1479}, + {"mount: warning: multiple hostnames not supported\n", 1480}, + {"mount: directory to mount not in host:dir format\n", 1481}, + {"mount: can't get address for %s\n", 1482}, + {"mount: got bad hp->h_length\n", 1483}, + {"mount: excessively long option argument\n", 1484}, + {"Warning: Unrecognized proto= option.\n", 1485}, + {"Warning: Option namlen is not supported.\n", 1486}, + {"unknown nfs mount parameter: %s=%d\n", 1487}, + {"Warning: option nolock is not supported.\n", 1488}, + {"unknown nfs mount option: %s%s\n", 1489}, + {"mount: got bad hp->h_length?\n", 1490}, + {"NFS over TCP is not supported.\n", 1491}, + {"nfs socket", 1492}, + {"nfs bindresvport", 1493}, + {"used portmapper to find NFS port\n", 1494}, + {"using port %d for nfs deamon\n", 1495}, + {"nfs connect", 1496}, + {"unknown nfs status return value: %d", 1497}, + {"bug in xstrndup call", 1498}, {"\ usage: %s [-hV]\n\ %s -a [-v]\n\ %s [-v] [-p priority] special ...\n\ - %s [-s]\n", 1486}, - {"%s on %s\n", 1487}, - {"swapon: cannot stat %s: %s\n", 1488}, - {"swapon: warning: %s has insecure permissions %04o, 0600 suggested\n", 1489}, - {"swapon: Skipping file %s - it appears to have holes.\n", 1490}, - {"%s: cannot open %s: %s\n", 1491}, - {"umount: compiled without support for -f\n", 1492}, - {"host: %s, directory: %s\n", 1493}, - {"umount: can't get address for %s\n", 1494}, - {"umount: got bad hostp->h_length\n", 1495}, - {"umount: %s: invalid block device", 1496}, - {"umount: %s: not mounted", 1497}, - {"umount: %s: can't write superblock", 1498}, - {"umount: %s: device is busy", 1499}, - {"umount: %s: not found", 1500}, - {"umount: %s: must be superuser to umount", 1501}, - {"umount: %s: block devices not permitted on fs", 1502}, - {"umount: %s: %s", 1503}, - {"no umount2, trying umount...\n", 1504}, - {"could not umount %s - trying %s instead\n", 1505}, - {"umount: %s busy - remounted read-only\n", 1506}, - {"umount: could not remount %s read-only\n", 1507}, - {"%s umounted\n", 1508}, - {"umount: cannot find list of filesystems to unmount", 1509}, + %s [-s]\n", 1499}, + {"%s on %s\n", 1500}, + {"swapon: cannot stat %s: %s\n", 1501}, + {"swapon: warning: %s has insecure permissions %04o, 0600 suggested\n", 1502}, + {"swapon: Skipping file %s - it appears to have holes.\n", 1503}, + {"%s: cannot open %s: %s\n", 1504}, + {"umount: compiled without support for -f\n", 1505}, + {"host: %s, directory: %s\n", 1506}, + {"umount: can't get address for %s\n", 1507}, + {"umount: got bad hostp->h_length\n", 1508}, + {"umount: %s: invalid block device", 1509}, + {"umount: %s: not mounted", 1510}, + {"umount: %s: can't write superblock", 1511}, + {"umount: %s: device is busy", 1512}, + {"umount: %s: not found", 1513}, + {"umount: %s: must be superuser to umount", 1514}, + {"umount: %s: block devices not permitted on fs", 1515}, + {"umount: %s: %s", 1516}, + {"no umount2, trying umount...\n", 1517}, + {"could not umount %s - trying %s instead\n", 1518}, + {"umount: %s busy - remounted read-only\n", 1519}, + {"umount: could not remount %s read-only\n", 1520}, + {"%s umounted\n", 1521}, + {"umount: cannot find list of filesystems to unmount", 1522}, {"\ Usage: umount [-hV]\n\ umount -a [-f] [-r] [-n] [-v] [-t vfstypes]\n\ - umount [-f] [-r] [-n] [-v] special | node...\n", 1510}, - {"umount: only root can do that", 1511}, - {"Trying to umount %s\n", 1512}, - {"Could not find %s in mtab\n", 1513}, - {"umount: %s is not mounted (according to mtab)", 1514}, - {"umount: it seems %s is mounted multiple times", 1515}, - {"umount: %s is not in the fstab (and you are not root)", 1516}, - {"umount: %s mount disagrees with the fstab", 1517}, - {"umount: only root can unmount %s from %s", 1518}, - {"umount: only %s can unmount %s from %s", 1519}, - {"You must be root to set the Ctrl-Alt-Del behaviour.\n", 1520}, - {"Usage: ctrlaltdel hard|soft\n", 1521}, + umount [-f] [-r] [-n] [-v] special | node...\n", 1523}, + {"umount: only root can do that", 1524}, + {"Trying to umount %s\n", 1525}, + {"Could not find %s in mtab\n", 1526}, + {"umount: %s is not mounted (according to mtab)", 1527}, + {"umount: it seems %s is mounted multiple times", 1528}, + {"umount: %s is not in the fstab (and you are not root)", 1529}, + {"umount: %s mount disagrees with the fstab", 1530}, + {"umount: only root can unmount %s from %s", 1531}, + {"umount: only %s can unmount %s from %s", 1532}, + {"You must be root to set the Ctrl-Alt-Del behaviour.\n", 1533}, + {"Usage: ctrlaltdel hard|soft\n", 1534}, {"\ File %s, For threshold value %lu, Maximum characters in fifo were %d,\n\ -and the maximum transfer rate in characters/second was %f\n", 1522}, +and the maximum transfer rate in characters/second was %f\n", 1535}, {"\ File %s, For threshold value %lu and timrout value %lu, Maximum characters \ in fifo were %d,\n\ -and the maximum transfer rate in characters/second was %f\n", 1523}, - {"Invalid interval value: %s\n", 1524}, - {"Invalid set value: %s\n", 1525}, - {"Invalid default value: %s\n", 1526}, - {"Invalid set time value: %s\n", 1527}, - {"Invalid default time value: %s\n", 1528}, +and the maximum transfer rate in characters/second was %f\n", 1536}, + {"Invalid interval value: %s\n", 1537}, + {"Invalid set value: %s\n", 1538}, + {"Invalid default value: %s\n", 1539}, + {"Invalid set time value: %s\n", 1540}, + {"Invalid default time value: %s\n", 1541}, {"\ Usage: %s [-q [-i interval]] ([-s value]|[-S value]) ([-t value]|[-T value]) \ -[-g|-G] file [file...]\n", 1529}, - {"Can't open %s: %s\n", 1530}, - {"Can't set %s to threshold %d: %s\n", 1531}, - {"Can't set %s to time threshold %d: %s\n", 1532}, - {"Can't get threshold for %s: %s\n", 1533}, - {"Can't get timeout for %s: %s\n", 1534}, - {"%s: %ld %s threshold and %ld %s timeout\n", 1535}, - {"current", 1536}, - {"default", 1537}, - {"Can't set signal handler", 1538}, - {"gettimeofday failed", 1539}, - {"Can't issue CYGETMON on %s: %s\n", 1540}, - {"%s: %lu ints, %lu/%lu chars; ", 1541}, - {"fifo: %lu thresh, %lu tmout, ", 1542}, - {"%lu max, %lu now\n", 1543}, - {" %f int/sec; %f rec, %f send (char/sec)\n", 1544}, - {"\ -%s: %lu ints, %lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n", 1545}, - {" %f int/sec; %f rec (char/sec)\n", 1546}, - {"Usage: %s [-c] [-n level] [-s bufsize]\n", 1547}, - {"invalid id: %s\n", 1548}, - {"cannot remove id %s (%s)\n", 1549}, - {"usage: %s {shm | msg | sem} id ...\n", 1550}, - {"unknown resource type: %s\n", 1551}, - {"resource(s) deleted\n", 1552}, - {"usage : %s -asmq -tclup \n", 1553}, - {"\t%s [-s -m -q] -i id\n", 1554}, - {"\t%s -h for help.\n", 1555}, - {"%s provides information on ipc facilities for", 1556}, - {" which you have read access.\n", 1557}, +[-g|-G] file [file...]\n", 1542}, + {"Can't open %s: %s\n", 1543}, + {"Can't set %s to threshold %d: %s\n", 1544}, + {"Can't set %s to time threshold %d: %s\n", 1545}, + {"Can't get threshold for %s: %s\n", 1546}, + {"Can't get timeout for %s: %s\n", 1547}, + {"%s: %ld %s threshold and %ld %s timeout\n", 1548}, + {"current", 1549}, + {"default", 1550}, + {"Can't set signal handler", 1551}, + {"gettimeofday failed", 1552}, + {"Can't issue CYGETMON on %s: %s\n", 1553}, + {"%s: %lu ints, %lu/%lu chars; ", 1554}, + {"fifo: %lu thresh, %lu tmout, ", 1555}, + {"%lu max, %lu now\n", 1556}, + {" %f int/sec; %f rec, %f send (char/sec)\n", 1557}, + {"\ +%s: %lu ints, %lu chars; fifo: %lu thresh, %lu tmout, %lu max, %lu now\n", 1558}, + {" %f int/sec; %f rec (char/sec)\n", 1559}, + {"Usage: %s [-c] [-n level] [-s bufsize]\n", 1560}, + {"invalid id: %s\n", 1561}, + {"cannot remove id %s (%s)\n", 1562}, + {"usage: %s {shm | msg | sem} id ...\n", 1563}, + {"unknown resource type: %s\n", 1564}, + {"resource(s) deleted\n", 1565}, + {"usage : %s -asmq -tclup \n", 1566}, + {"\t%s [-s -m -q] -i id\n", 1567}, + {"\t%s -h for help.\n", 1568}, + {"%s provides information on ipc facilities for", 1569}, + {" which you have read access.\n", 1570}, {"\ Resource Specification:\n\ \t-m : shared_mem\n\ -\t-q : messages\n", 1558}, +\t-q : messages\n", 1571}, {"\ \t-s : semaphores\n\ -\t-a : all (default)\n", 1559}, +\t-a : all (default)\n", 1572}, {"\ Output Format:\n\ \t-t : time\n\ \t-p : pid\n\ -\t-c : creator\n", 1560}, +\t-c : creator\n", 1573}, {"\ \t-l : limits\n\ -\t-u : summary\n", 1561}, - {"-i id [-s -q -m] : details on resource identified by id\n", 1562}, - {"kernel not configured for shared memory\n", 1563}, - {"------ Shared Memory Limits --------\n", 1564}, - {"max number of segments = %d\n", 1565}, - {"max seg size (kbytes) = %d\n", 1566}, - {"max total shared memory (kbytes) = %d\n", 1567}, - {"min seg size (bytes) = %d\n", 1568}, - {"------ Shared Memory Status --------\n", 1569}, - {"segments allocated %d\n", 1570}, - {"pages allocated %ld\n", 1571}, - {"pages resident %ld\n", 1572}, - {"pages swapped %ld\n", 1573}, - {"Swap performance: %ld attempts\t %ld successes\n", 1574}, - {"------ Shared Memory Segment Creators/Owners --------\n", 1575}, - {"%-10s%-10s%-10s%-10s%-10s%-10s\n", 1576}, - {"shmid", 1577}, - {"perms", 1578}, - {"cuid", 1579}, - {"cgid", 1580}, - {"uid", 1581}, - {"gid", 1582}, - {"------ Shared Memory Attach/Detach/Change Times --------\n", 1583}, - {"%-10s%-10s %-20s%-20s%-20s\n", 1584}, - {"owner", 1585}, - {"attached", 1586}, - {"detached", 1587}, - {"changed", 1588}, - {"------ Shared Memory Creator/Last-op --------\n", 1589}, - {"%-10s%-10s%-10s%-10s\n", 1590}, - {"cpid", 1591}, - {"lpid", 1592}, - {"------ Shared Memory Segments --------\n", 1593}, - {"%-10s%-10s%-10s%-10s%-10s%-10s%-12s\n", 1594}, - {"key", 1595}, - {"bytes", 1596}, - {"nattch", 1597}, - {"status", 1598}, - {"Not set", 1599}, - {"dest", 1600}, - {"locked", 1601}, - {"kernel not configured for semaphores\n", 1602}, - {"------ Semaphore Limits --------\n", 1603}, - {"max number of arrays = %d\n", 1604}, - {"max semaphores per array = %d\n", 1605}, - {"max semaphores system wide = %d\n", 1606}, - {"max ops per semop call = %d\n", 1607}, - {"semaphore max value = %d\n", 1608}, - {"------ Semaphore Status --------\n", 1609}, - {"used arrays = %d\n", 1610}, - {"allocated semaphores = %d\n", 1611}, - {"------ Semaphore Arrays Creators/Owners --------\n", 1612}, - {"semid", 1613}, - {"------ Shared Memory Operation/Change Times --------\n", 1614}, - {"%-8s%-10s %-26.24s %-26.24s\n", 1615}, - {"last-op", 1616}, - {"last-changed", 1617}, - {"------ Semaphore Arrays --------\n", 1618}, - {"%-10s%-10s%-10s%-10s%-10s%-12s\n", 1619}, - {"nsems", 1620}, - {"------ Messages: Limits --------\n", 1621}, - {"max queues system wide = %d\n", 1622}, - {"max size of message (bytes) = %d\n", 1623}, - {"default max size of queue (bytes) = %d\n", 1624}, - {"------ Messages: Status --------\n", 1625}, - {"allocated queues = %d\n", 1626}, - {"used headers = %d\n", 1627}, - {"used space = %d bytes\n", 1628}, - {"------ Message Queues: Creators/Owners --------\n", 1629}, - {"msqid", 1630}, - {"------ Message Queues Send/Recv/Change Times --------\n", 1631}, - {"%-8s%-10s %-20s%-20s%-20s\n", 1632}, - {"send", 1633}, - {"recv", 1634}, - {"change", 1635}, - {"------ Message Queues PIDs --------\n", 1636}, - {"lspid", 1637}, - {"lrpid", 1638}, - {"------ Message Queues --------\n", 1639}, - {"%-10s%-10s%-10s%-10s%-12s%-12s\n", 1640}, - {"used-bytes", 1641}, - {"messages", 1642}, +\t-u : summary\n", 1574}, + {"-i id [-s -q -m] : details on resource identified by id\n", 1575}, + {"kernel not configured for shared memory\n", 1576}, + {"------ Shared Memory Limits --------\n", 1577}, + {"max number of segments = %ld\n", 1578}, + {"max seg size (kbytes) = %ld\n", 1579}, + {"max total shared memory (kbytes) = %ld\n", 1580}, + {"min seg size (bytes) = %ld\n", 1581}, + {"------ Shared Memory Status --------\n", 1582}, + {"segments allocated %d\n", 1583}, + {"pages allocated %ld\n", 1584}, + {"pages resident %ld\n", 1585}, + {"pages swapped %ld\n", 1586}, + {"Swap performance: %ld attempts\t %ld successes\n", 1587}, + {"------ Shared Memory Segment Creators/Owners --------\n", 1588}, + {"%-10s%-10s%-10s%-10s%-10s%-10s\n", 1589}, + {"shmid", 1590}, + {"perms", 1591}, + {"cuid", 1592}, + {"cgid", 1593}, + {"uid", 1594}, + {"gid", 1595}, + {"------ Shared Memory Attach/Detach/Change Times --------\n", 1596}, + {"%-10s%-10s %-20s%-20s%-20s\n", 1597}, + {"owner", 1598}, + {"attached", 1599}, + {"detached", 1600}, + {"changed", 1601}, + {"------ Shared Memory Creator/Last-op --------\n", 1602}, + {"%-10s%-10s%-10s%-10s\n", 1603}, + {"cpid", 1604}, + {"lpid", 1605}, + {"------ Shared Memory Segments --------\n", 1606}, + {"%-10s%-10s%-10s%-10s%-10s%-10s%-12s\n", 1607}, + {"key", 1608}, + {"bytes", 1609}, + {"nattch", 1610}, + {"status", 1611}, + {"Not set", 1612}, + {"dest", 1613}, + {"locked", 1614}, + {"kernel not configured for semaphores\n", 1615}, + {"------ Semaphore Limits --------\n", 1616}, + {"max number of arrays = %d\n", 1617}, + {"max semaphores per array = %d\n", 1618}, + {"max semaphores system wide = %d\n", 1619}, + {"max ops per semop call = %d\n", 1620}, + {"semaphore max value = %d\n", 1621}, + {"------ Semaphore Status --------\n", 1622}, + {"used arrays = %d\n", 1623}, + {"allocated semaphores = %d\n", 1624}, + {"------ Semaphore Arrays Creators/Owners --------\n", 1625}, + {"semid", 1626}, + {"------ Shared Memory Operation/Change Times --------\n", 1627}, + {"%-8s%-10s %-26.24s %-26.24s\n", 1628}, + {"last-op", 1629}, + {"last-changed", 1630}, + {"------ Semaphore Arrays --------\n", 1631}, + {"%-10s%-10s%-10s%-10s%-10s%-12s\n", 1632}, + {"nsems", 1633}, + {"------ Messages: Limits --------\n", 1634}, + {"max queues system wide = %d\n", 1635}, + {"max size of message (bytes) = %d\n", 1636}, + {"default max size of queue (bytes) = %d\n", 1637}, + {"------ Messages: Status --------\n", 1638}, + {"allocated queues = %d\n", 1639}, + {"used headers = %d\n", 1640}, + {"used space = %d bytes\n", 1641}, + {"------ Message Queues: Creators/Owners --------\n", 1642}, + {"msqid", 1643}, + {"------ Message Queues Send/Recv/Change Times --------\n", 1644}, + {"%-8s%-10s %-20s%-20s%-20s\n", 1645}, + {"send", 1646}, + {"recv", 1647}, + {"change", 1648}, + {"------ Message Queues PIDs --------\n", 1649}, + {"lspid", 1650}, + {"lrpid", 1651}, + {"------ Message Queues --------\n", 1652}, + {"%-10s%-10s%-10s%-10s%-12s%-12s\n", 1653}, + {"used-bytes", 1654}, + {"messages", 1655}, {"\ \n\ -Shared memory Segment shmid=%d\n", 1643}, - {"uid=%d\tgid=%d\tcuid=%d\tcgid=%d\n", 1644}, - {"mode=%#o\taccess_perms=%#o\n", 1645}, - {"bytes=%d\tlpid=%d\tcpid=%d\tnattch=%d\n", 1646}, - {"att_time=%s", 1647}, - {"Not set\n", 1648}, - {"det_time=%s", 1649}, - {"change_time=%s", 1650}, +Shared memory Segment shmid=%d\n", 1656}, + {"uid=%d\tgid=%d\tcuid=%d\tcgid=%d\n", 1657}, + {"mode=%#o\taccess_perms=%#o\n", 1658}, + {"bytes=%d\tlpid=%d\tcpid=%d\tnattch=%ld\n", 1659}, + {"att_time=%s", 1660}, + {"Not set\n", 1661}, + {"det_time=%s", 1662}, + {"change_time=%s", 1663}, {"\ \n\ -Message Queue msqid=%d\n", 1651}, - {"uid=%d\tgid=%d\tcuid=%d\tcgid=%d\tmode=%#o\n", 1652}, - {"cbytes=%d\tqbytes=%d\tqnum=%d\tlspid=%d\tlrpid=%d\n", 1653}, - {"send_time=%srcv_time=%schange_time=%s", 1654}, - {"Not Set\n", 1655}, +Message Queue msqid=%d\n", 1664}, + {"uid=%d\tgid=%d\tcuid=%d\tcgid=%d\tmode=%#o\n", 1665}, + {"cbytes=%ld\tqbytes=%ld\tqnum=%ld\tlspid=%d\tlrpid=%d\n", 1666}, + {"send_time=%srcv_time=%schange_time=%s", 1667}, + {"Not Set\n", 1668}, {"\ \n\ -Semaphore Array semid=%d\n", 1656}, - {"uid=%d\t gid=%d\t cuid=%d\t cgid=%d\n", 1657}, - {"mode=%#o, access_perms=%#o\n", 1658}, - {"nsems = %d\n", 1659}, - {"otime = %s", 1660}, - {"ctime = %s", 1661}, - {"%-10s%-10s%-10s%-10s%-10s\n", 1662}, - {"semnum", 1663}, - {"value", 1664}, - {"ncount", 1665}, - {"zcount", 1666}, - {"pid", 1667}, - {"usage: rdev [ -rsv ] [ -o OFFSET ] [ IMAGE [ VALUE [ OFFSET ] ] ]", 1668}, - {"\ - rdev /dev/fd0 (or rdev /linux, etc.) displays the current ROOT device", 1669}, - {" rdev /dev/fd0 /dev/hda2 sets ROOT to /dev/hda2", 1670}, - {" rdev -R /dev/fd0 1 set the ROOTFLAGS (readonly status)", 1671}, - {" rdev -s /dev/fd0 /dev/hda2 set the SWAP device", 1672}, - {" rdev -r /dev/fd0 627 set the RAMDISK size", 1673}, - {" rdev -v /dev/fd0 1 set the bootup VIDEOMODE", 1674}, - {" rdev -o N ... use the byte offset N", 1675}, - {" rootflags ... same as rdev -R", 1676}, - {" swapdev ... same as rdev -s", 1677}, - {" ramsize ... same as rdev -r", 1678}, - {" vidmode ... same as rdev -v", 1679}, - {"\ -Note: video modes are: -3=Ask, -2=Extended, -1=NormalVga, 1=key1, 2=key2,...", 1680}, - {" use -R 1 to mount root readonly, -R 0 for read/write.", 1681}, +Semaphore Array semid=%d\n", 1669}, + {"uid=%d\t gid=%d\t cuid=%d\t cgid=%d\n", 1670}, + {"mode=%#o, access_perms=%#o\n", 1671}, + {"nsems = %ld\n", 1672}, + {"otime = %s", 1673}, + {"ctime = %s", 1674}, + {"%-10s%-10s%-10s%-10s%-10s\n", 1675}, + {"semnum", 1676}, + {"value", 1677}, + {"ncount", 1678}, + {"zcount", 1679}, + {"pid", 1680}, + {"usage: rdev [ -rsv ] [ -o OFFSET ] [ IMAGE [ VALUE [ OFFSET ] ] ]", 1681}, + {"\ + rdev /dev/fd0 (or rdev /linux, etc.) displays the current ROOT device", 1682}, + {" rdev /dev/fd0 /dev/hda2 sets ROOT to /dev/hda2", 1683}, + {" rdev -R /dev/fd0 1 set the ROOTFLAGS (readonly status)", 1684}, + {" rdev -s /dev/fd0 /dev/hda2 set the SWAP device", 1685}, + {" rdev -r /dev/fd0 627 set the RAMDISK size", 1686}, + {" rdev -v /dev/fd0 1 set the bootup VIDEOMODE", 1687}, + {" rdev -o N ... use the byte offset N", 1688}, + {" rootflags ... same as rdev -R", 1689}, + {" swapdev ... same as rdev -s", 1690}, + {" ramsize ... same as rdev -r", 1691}, + {" vidmode ... same as rdev -v", 1692}, + {"\ +Note: video modes are: -3=Ask, -2=Extended, -1=NormalVga, 1=key1, 2=key2,...", 1693}, + {" use -R 1 to mount root readonly, -R 0 for read/write.", 1694}, {"\ %s: Usage: \"%s [options]\n\ \t -m (default = \"%s\")\n\ @@ -2147,110 +2187,110 @@ Note: video modes are: -3=Ask, -2=Extended, -1=NormalVga, 1=key1, 2=key2,...", 1 \t -v print verbose data\n\ \t -a print all symbols, even if count is 0\n\ \t -r reset all the counters (root only)\n\ -\t -V print version and exit\n", 1682}, - {"%s Version %s\n", 1683}, - {"anything\n", 1684}, - {"Sampling_step: %i\n", 1685}, - {"%s: %s(%i): wrong map line\n", 1686}, - {"%s: can't find \"_stext\" in %s\n", 1687}, - {"total", 1688}, - {"\ -usage: renice priority [ [ -p ] pids ] [ [ -g ] pgrps ] [ [ -u ] users ]\n", 1689}, - {"renice: %s: unknown user\n", 1690}, - {"renice: %s: bad value\n", 1691}, - {"getpriority", 1692}, - {"setpriority", 1693}, - {"%d: old priority %d, new priority %d\n", 1694}, - {"usage: %s program [arg ...]\n", 1695}, +\t -V print version and exit\n", 1695}, + {"%s Version %s\n", 1696}, + {"anything\n", 1697}, + {"Sampling_step: %i\n", 1698}, + {"%s: %s(%i): wrong map line\n", 1699}, + {"%s: can't find \"_stext\" in %s\n", 1700}, + {"total", 1701}, + {"\ +usage: renice priority [ [ -p ] pids ] [ [ -g ] pgrps ] [ [ -u ] users ]\n", 1702}, + {"renice: %s: unknown user\n", 1703}, + {"renice: %s: bad value\n", 1704}, + {"getpriority", 1705}, + {"setpriority", 1706}, + {"%d: old priority %d, new priority %d\n", 1707}, + {"usage: %s program [arg ...]\n", 1708}, {"\ Usage: %s [ -i | -t