Commit Graph

67 Commits

Author SHA1 Message Date
jmc
c9554ba295 make SYNOPSIS match usage to indicate -l is optional in:
swapctl [[-l] | -s] [-k]

from martin vahlensieck
2021-08-24 13:15:07 +00:00
jca
b922e4d52b Initialize rejecttype to appease static analyzers
-t has already been checked in main() and can only be "blk" or "noblk",
but static analyzers like scan-build fail to spot this.  From miod@
2020-02-11 18:16:38 +00:00
mpi
0af614b442 Remove clause #3 from mrg@NetBSD license.
In May 29 2008, Matthew R. Green removed it in NetBSD:
  github.com/IIJ-NetBSD/netbsd-src/commit/7ea20401d535da9996394136ef

ok deraadt@
2019-12-05 12:46:54 +00:00
deraadt
df69c215c7 When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.
2019-06-28 13:32:41 +00:00
jmc
faa33665ab for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung
2016-03-30 06:38:40 +00:00
krw
5340846403 Last parameter to execl[e]() functions *must* be cast to a pointer.
Just NULL is not good practise as NULL is theoretically allowed to
be an integer rather than a pointer.

Use (char *)NULL consistently instead of scattering a few (char *)0
and (void *)NULL into the mix.

Prompted by and probably ok deraadt@ millert@ kettenis@

Definitely ok mestre@ ratchov@
2016-03-17 19:40:43 +00:00
mmcc
5ce950dec1 Remove NULL-checks before free(). ok tb@ 2015-12-10 17:26:59 +00:00
schwarze
9efad6cfce update spacing in usage(); reminded by jmc@ 2015-09-15 17:46:23 +00:00
schwarze
f078491151 fix markup of the -t argument 2015-09-15 16:23:25 +00:00
deraadt
5ae94ef8a2 <stdlib.h> is included, so do not need to cast result from
malloc, calloc, realloc*
ok krw millert
2015-08-20 22:02:20 +00:00
semarie
821ff4bf8e switch from system(3) to vfork(2)+execl(2) for invoking mount_nfs(8) when fstab
contains option for swapping to NFS files.

ok millert@
2015-08-14 08:56:21 +00:00
deraadt
a47b6461a1 Convert many atoi() calls to strtonum(), adding range checks and failure
handling along the way.
Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert
2015-04-18 18:28:36 +00:00
deraadt
b9fc9a728f Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible.  Annotate <sys/param.h> lines with their current reasons.  Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc.  Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution.  These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)
2015-01-16 06:39:28 +00:00
guenther
99a960a11f Only need <stdint.h> and not all of <inttypes.h> here 2014-08-10 05:00:25 +00:00
schwarze
d69fc7e0d6 Add missing .Mt macros for AUTHORS email addresses.
From Jan Stary <hans at stare dot cz>.
ok jmc@
2013-07-16 09:45:27 +00:00
jasper
ddf2d7df6c swapctl -s was showing 1k blocks, regardless of -k. so fix this by showing
1k block when we're supposed to.

fix from tyr@poczta.fm in pr 6609
ok otto@
2011-06-24 21:02:09 +00:00
jmc
2a9e630654 a little more tweaking; ok krw 2011-04-17 21:20:25 +00:00
krw
43fc2dc28d Tweak verbiage, bring examples up to date.
Suggestions from deraadt@ and jmc@.

ok jmc@
2011-04-17 20:17:12 +00:00
stsp
0045368472 Fix swapctl -A with DUIDs in /etc/fstab, and plug a small memory leak.
ok jsing@ (who also pointed out a DPADD tweak missing from my diff)
2010-12-29 12:14:41 +00:00
jmc
77a299bac3 add an EXIT STATUS section for /sbin; 2010-09-03 10:08:22 +00:00
deraadt
fdae1d23fc if no arguments given, assume a nice default; ok miod jakemsr deanna 2007-11-26 13:36:33 +00:00
deraadt
940f496417 use calloc() instead of malloc(); zinovik@cs.karelia.ru 2007-07-26 17:03:05 +00:00
jmc
a35de2858a sync swapon usage(); from Igor Zinovik 2007-07-17 18:26:05 +00:00
jmc
e766254b47 do not try to list which options go with -p: the list is currently out of
date, and even if i update it, it will obsolete itself if we add or remove
options. it works when it makes sense, like it should.

after a request from Igor Zinovik
2007-07-17 18:18:36 +00:00
millert
03b50a27f8 Remove dead code and fix incorrect comment. From Igor Zinovik. 2007-07-16 21:05:46 +00:00
millert
f7b14ab5b1 No need to include <sys/param.h> or <errno.h>. Also reorder includes
while here.  Adapted from a diff by Igor Zinovik.
2007-07-16 20:59:47 +00:00
jmc
9490d37cb6 convert to new .Dd format; 2007-05-31 19:19:00 +00:00
grunk
b34bb05303 fix .Xr's to mount_vnd(8)
suggested and ok jmc@
2007-05-27 04:17:17 +00:00
jmc
c16d45407b add .Ex; 2006-08-24 08:51:55 +00:00
jmc
de50962e5c - expand the text on priorities: from netbsd
- move WARNINGS to BUGS: from netbsd
2006-08-24 08:47:58 +00:00
jmc
21014c5741 reword a scary sentence; 2006-08-24 08:30:26 +00:00
jmc
f43b91f73d sort options; 2006-08-24 07:47:16 +00:00
deraadt
d83100965c handle snprintf potential -1 case 2005-04-12 06:39:29 +00:00
avsm
1a6152b99b - avoid variable sized static array (from millert@)
- check for snprintf overflow
- errx -> err for strdup

commit #1000!
2004-01-12 19:46:08 +00:00
deraadt
ca198d9fd5 check strdup failure; ok anil millert 2003-09-26 16:09:27 +00:00
jmc
2b65e200c8 - section reorder
- some mdoc fixes
2003-06-03 13:16:07 +00:00
jmc
ff989cf6c9 document that kernel automatically handles first swap partition
("swap_device" in swapctl -l) and does not need to be added to /etc/fstab.

krw@, fries@, rohee@, millert@, henning@ ok.
2003-05-10 06:33:38 +00:00
miod
6bef6715c5 Fix inaccuracies in comments. 2003-03-03 13:41:23 +00:00
jmc
ce9dbd6529 typos;
setextattr(8): example markus@
spamd(8): someone else found some of these on bugs/misc, but for the life
	  of me i can't find out who
pf.conf(5): from openbsd@davidkrause.com
raidctl(8): from ian@darwinsys.com
2003-02-13 08:23:39 +00:00
deraadt
8737bc477c no you 2002-12-19 00:39:57 +00:00
deraadt
bc52e260ac ansi 2002-07-03 22:32:32 +00:00
art
0bbbe69594 typo in comment.
From Sam Smith S at mSmith.net
2002-05-15 23:30:08 +00:00
art
52edb1a824 Kill commented out stubs for swapoff. 2002-05-15 23:24:43 +00:00
art
d572e9e758 kill the reference to swapoff. 2002-05-15 23:22:50 +00:00
millert
c72b5b24e1 Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically. 2002-02-16 21:27:05 +00:00
mpech
3316fe2d8b Initial patch for a new mdoc issue.
Powered by @mantoya:
o) kill extra line in the end of file;
o) kill extra space in the end of line;
o) replace blank lines with .Pp;

millert@ ok
2001-12-21 11:41:49 +00:00
mpech
b566709843 o) .Sh AUTHOR -> .Sh AUTHORS;
o) .Sh EXAMPLE -> .Sh EXAMPLES;
o) Delete .Sh OPTIONS. Text moved to .Sh DESCRIPTION;

millert@ ok
2001-08-02 18:37:33 +00:00
pvalchev
efe7637242 Remove BUGS section, swapoff now works. ok art@ 2001-07-26 20:00:04 +00:00
mickey
664208979e return from main() don't exit 2001-06-04 14:59:46 +00:00
miod
590f2c1ac8 Various swapctl(8) improvements:
- don't print an error message when trying to enable swap on an
  already active swap point.
- better handling of -t option.
- silently ignores swap points which are neither block devices nor
  regular files, and don't consider swap points not starting with /dev/
  as valid block devices, when invoked with -A.

Work by deraadt@ and myself, ok millert@
2001-06-02 03:04:44 +00:00