Home | History | Annotate | Download | only in swapctl
History log of /src/sbin/swapctl/swapctl.c
RevisionDateAuthorComments
 1.43  01-Mar-2023  kre Fix a typo in a newly added comment.

Someone please tell me why these things become obvious only after
the code has been committed!

NFC
 1.42  01-Mar-2023  kre When processing swapon -a (or swapctl -A, or swapctl -U) ignore lines in
fstab that have nothing to do with swapping (fs_type is neither "sw" nor "dp")
before running getfsspecname() on the fs_spec field of the line.

This avoids entries like this:

NAME=OFTEN_UNCONNECTED /local/archived ffs rw,log,noauto 0 0

in fstab from generating spurious error messages when the wedge named
is not currently connected to the system - that is the drive on which the
wedge exists is not connected, or not powered on. "noauto" handles that
for some other uses, the "0"s in fs_freq and fs_passno work for other uses,
but swap{on,ctl} never look at those fields (not for this purpose).

Non "sw"/"dp" lines were being ignored anyway, but not until (a little) later.
 1.41  04-Apr-2022  andvar fix various typos, mainly in comments.
 1.40  11-Oct-2015  mrg don't stop processing /etc/fstab when one entry fails, both for
add and remove loops. now when you add a new swap file and run
"swapctl -A" it won't give up after the existing one gives EBUSY
and move on to the rest.
 1.39  01-Jan-2013  dsl Explicitly include sys/ioctl.h
 1.38  26-Dec-2012  mlelstv Allow named wedges to be used on command line, also fix name lookup
for the dump device.
 1.37  07-Apr-2012  christos branches: 1.37.2;
use getfsspecname()
 1.36  27-Aug-2011  joerg branches: 1.36.2;
static + __dead
 1.35  24-Sep-2009  apb Make the exit status from "swapctl -A" and "swapctl -U" tri-state:
0 for success; 1 for error; and 2 when no devices of the appropriate type
are defined in fstab(5). Previously, "no apropriate devices" was
indistinguishable from "error".
 1.34  28-Dec-2008  christos fix dev_t format.
 1.33  29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.32  27-Aug-2006  martin branches: 1.32.18; 1.32.20; 1.32.22;
As discussed on tech-userlevel: enhance the -A/-U commands to take a -t
auto flag, which queries all local harddisks for swap partitions/
wedges and adds/removes them as swap device, a -f option to use the
first found swap device as dump device, and a -o option to only
auto-configure the dump device, but leave swap alone.

Add a -n option to make swapctl only say what it would do, but not
change any system state.
 1.31  23-Aug-2006  wiz Sort options. Sync usage with man page.
 1.30  22-Aug-2006  martin Allow unsetting the dump device via "swapctl -D none".
For -l (list swap partitions) and -z (list dump device) return a usefull
error status, so scripts can easily decide if swap or dump are configured.
 1.29  12-Jun-2005  christos Remove some const. This is better than using __UNCONST at the second
argument of swapctl.
 1.28  09-Feb-2005  xtraeme Kill __P(), use ANSI function declarations, constify; WARNS=3.

Reviewed by mrg@.
 1.27  10-Jan-2005  lukem support RESCUEDIR (for mount_nfs and umount)
 1.26  08-Jun-2004  cjep Fix usage string (i.e. add information about -z). Fixes PR#25865 from
Kouichirou Hiratsuka.
 1.25  20-Dec-2003  mrg branches: 1.25.2;
support "-g" and "-m" as well as "-k" and "-h". swapctl & swaplist code
from Martin Weber, adapted for pstat by myself.
 1.24  20-Dec-2003  mrg add a "-h" (humanize_number(3)) option to swapctl(8) and pstat(8), from
Martin Weber in PR#23805.

ps: now we only need someone to do ls(1) :-)
 1.23  21-Oct-2003  fvdl The 3rd argument to swapctl() is an int, don't pass NULL in it.
 1.22  23-Jun-2003  agc Add NetBSD RCS Ids.
 1.21  18-Sep-2002  drochner print something sensible on -z if no dump device is set
 1.20  21-Jun-2002  jdolecek Support 'dp' as mount option for 'sw' fstype, so it DTRT for entries like:
/dev/wd0b none swap sw,dp 0 0
 1.19  26-Nov-2001  pooka Add word "WARNING" when complaining about swap being world-read/writeable
to clarify that this was not an error condition and that swap was indeed
added despite the problem.
 1.18  19-Feb-2001  cgd convert to use getprogname()
 1.17  17-Nov-2000  lukem fix incorrect comment; -d does work!
 1.16  17-Nov-2000  mrg support new `swapctl -z' that shows the dump device.
 1.15  07-Jul-2000  itojun warnx?/errx? audit. don't pass variable/function return value alone.
use with "%s". from openbsd.
 1.14  13-Apr-2000  mrg branches: 1.14.4;
use <sys/swap.h>. should have happened years ago.
 1.13  13-Mar-2000  soren Fix doubled 'the's.
 1.12  05-Mar-2000  lukem * add support for -U, which is the opposite of -A (i.e, it unconfigures
all swap devices in /etc/fstab).
* fix description of -D
 1.11  26-Apr-1999  mrg add a -D line to usage().
 1.10  23-Feb-1999  mrg add a new fstab type "dp" for the user-specified dump device.
change swapctl -A to see this and add it via swapctl(2). also
add a new swapctl -D <device> to change the dump device on the
fly.
 1.9  26-Jul-1998  mycroft const poisoning.
 1.8  10-Feb-1998  mrg make swapctl exit with non-zero if -A and nothing swapped on
 1.7  10-Oct-1997  mrg remove advertising clause from all my licenses.
 1.6  15-Sep-1997  lukem * fix .Nm usage
* prototype main() for WARNS=1
 1.5  11-Jul-1997  mikel add comparisons to NULL implicit in my last changes
 1.4  25-Jun-1997  thorpej Add a "-t blk|noblk" device type option to swapctl -A. This allows the
user to specify "only add block devices" or "only add non-block devices".
This is useful during early system startup where swapping may be needed
before swap files are available (e.g. if fsck'ing large file systems).
 1.3  24-Jun-1997  mikel include <err.h> for err*() and warn*() prototypes
cast long to int for use by printf("%d",..)
add parens for gcc -Wall
 1.2  15-Jun-1997  thorpej Totally rework the command parsing, eliminating a few walk-offs of
bogus pointers, etc.
 1.1  12-Jun-1997  mrg branches: 1.1.1;
Initial revision
 1.1.1.1  12-Jun-1997  mrg swapctl program for new swap code.
 1.14.4.1  27-Jul-2000  itojun pullup (approved by releng-1-5)
printf-like format pedant. do not pass string variable alone. use "%s".
from openbsd.

/cvsroot/basesrc/sbin/swapctl/swapctl.c 1.14 -> 1.15
/cvsroot/basesrc/sbin/ping6/ping6.c 1.15 -> 1.16
/cvsroot/basesrc/sbin/disklabel/disklabel.c 1.84 -> 1.85
/cvsroot/basesrc/sbin/ccdconfig/ccdconfig.c 1.30 -> 1.31
 1.25.2.1  13-Jun-2004  jdc Pull up revision 1.26 (requested by cjep in ticket #460).

Fix usage string (i.e. add information about -z). Fixes PR#25865 from
Kouichirou Hiratsuka.
 1.32.22.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.32.20.1  04-Jun-2008  yamt sync with head
 1.32.18.2  17-Jan-2009  mjf Sync with HEAD.
 1.32.18.1  02-Jun-2008  mjf Sync with HEAD.
 1.36.2.2  23-Jan-2013  yamt sync with head
 1.36.2.1  17-Apr-2012  yamt sync with head
 1.37.2.1  25-Feb-2013  tls resync with head

RSS XML Feed