Commit Graph

6674 Commits

Author SHA1 Message Date
Garance A Drosehn
d5ddb9bf52 Switch to checking P_KTHREAD instead of P_SYSTEM when deciding what
"system processes" to always ignore.  Based on my testing with `-D',
I am pretty sure this is what we want for 5.x-current.  If my thinking
is wrong, this also makes it easier to switch to a different check.
2004-03-26 17:51:49 +00:00
Ruslan Ermilov
ab82970ed2 Properly document the -M and -N options. 2004-03-26 11:01:45 +00:00
Ruslan Ermilov
376d460cff Correct the description of the -N option. 2004-03-26 10:48:35 +00:00
Ruslan Ermilov
f9a480abb1 Avoid the manpage layering violation and low-level implementation
details of libkvm, and just tell what the getbootfile(3) function
will return, by using the text from netstat(1) and dmesg(8).
2004-03-26 08:54:27 +00:00
Ruslan Ermilov
411ec5a7be Correct the description of options -N and -M to match reality. 2004-03-26 08:47:01 +00:00
Ruslan Ermilov
73bfeb89ca Apply style.Makefile(5). 2004-03-26 07:44:49 +00:00
Garance A Drosehn
f72f4d3a9c Send those -Debug messages to stderr, not stdout... 2004-03-26 02:20:52 +00:00
Garance A Drosehn
c44047c7a8 Add a debugging option, as I don't understand something that I'm seeing.
(this is a probably temporary option, and is not to be documented)
2004-03-26 01:43:19 +00:00
Garance A Drosehn
5def7269c2 Remove a redundant check against mypid (the check is done later, in
the "Take the appropriate action" section).

Obtained from:	the sysutils/pkill port
2004-03-26 01:30:15 +00:00
Garance A Drosehn
eb6d801134 Add a cast to get this to compile with WARNS=5 on sparc64. This is
needed because off_t == __int64_t, while size_t == __uint64_t.  This
also compiles with WARNS=5 on amd64, but I haven't tested the other
platforms yet.
2004-03-26 00:36:27 +00:00
Garance A Drosehn
ae1a248822 Fixes so this will compile with WARNS=5 on i386. 2004-03-26 00:15:20 +00:00
Garance A Drosehn
7ee9bb7817 Fix two cosmetic style(9) issues. 2004-03-25 23:35:14 +00:00
Garance A Drosehn
a6b60aa310 Add a comment for when these utilities were added to FreeBSD, and add
a cross-reference to killall(1).
2004-03-25 23:32:12 +00:00
Garance A Drosehn
998c10ebd9 Add -M' and -N' options to pkill' and pgrep', similar to
what are supported in `ps':

  -M  Extract values associated with the name list from the
      specified core instead of the default /dev/kmem.
  -N  Extract the name list from the specified system instead
      of the default /kernel.

Written by:	Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
Obtained from:	the sysutils/pkill port
2004-03-25 23:19:16 +00:00
Garance A Drosehn
69fd9fbfbc Use the correct type for some casts, thus avoiding a few warning messages
when compiling with WARNS=3

Written by:	Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
Obtained from:	the sysutils/pkill port
2004-03-25 22:08:52 +00:00
Garance A Drosehn
1b58b96b64 Change some routine and variable names to match the FreeBSD system.
Written by:	Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
Obtained from:	the sysutils/pkill port
2004-03-25 21:58:56 +00:00
Garance A Drosehn
0ddb37d879 Add the pkill' and pgrep' commands from NetBSD. This is the source
straight from NetBSD (except to add the RCS-ID lines for FreeBSD).
These will probably require a few updates before they are added to
the FreeBSD buildworld.  I might MFC these to 4.x-stable after 4.10.

Discussed on:	freebsd-arch
Obtained from:	NetBSD (and OpenBSD also has these)
2004-03-25 19:08:48 +00:00
Poul-Henning Kamp
743f91743d Respect decimal flag when dumping USER type records. 2004-03-25 12:33:55 +00:00
Bruce M Simpson
1d2a7e07d7 Sort SRCS in Makefile and document -g option additions.
Nudged by:	ru
2004-03-25 09:07:26 +00:00
Bruce M Simpson
3f2631c7ba Output style: Get rid of an unnecessary newline. 2004-03-25 08:51:14 +00:00
Bruce M Simpson
9fcc066d3e Teach netstat(1) how to print the multicast group memberships present
within the running system.

Sponsored by:	Ralf the Wonder Llama
2004-03-25 08:43:59 +00:00
Bosko Milekic
4d2e8e5fb8 Add -u option to ipcs(1) and document it in ipcs.1
It allows you to list IPC facilities owned by username/uid.

Submitted by: Christian S.J. Peron <maneo@bsdpro.com>
PR: bin/63463
2004-03-24 04:01:43 +00:00
Dag-Erling Smørgrav
6ae3893bf3 Remove doscmd from the base system now that it lives in the ports tree. 2004-03-23 22:27:24 +00:00
David Malone
e45a5a0d08 Add support for decoding Timespec, Timeval, Itimerval, Pollfd,
Fd_set and Sigaction structures. Use these for printing the arguments
to sigaction(), nanosleep(), select(), poll(), gettimeofday(),
clock_gettime(), recvfrom(), getitimer() and setitimer().

This is based on Dan's patch from the PR but I've hacked it for
style and some other issues. While Dan has checked this patch, any
goofs are probably my fault.

(The PR also contains support for the dual return values of pipe().
These will follow once I've ported that support to platforms other
than i386.)

PR:		52190
Submitted by:	Dan Nelson <dnelson@allantgroup.com>
2004-03-23 12:37:02 +00:00
David Malone
b637237cba Use pread to implement pread, rather than taking a detour throug stdio.
PR:		52190
Submitted by:	Dan Nelson <dnelson@allantgroup.com>
2004-03-23 12:29:17 +00:00
Alfred Perlstein
5214320f76 decode mprotect args while i'm here. 2004-03-23 09:16:18 +00:00
Alfred Perlstein
894b8f7afb decode fcntl and mmap arguments. 2004-03-23 09:04:06 +00:00
Tim J. Robbins
2fa2fea101 Use fseeko() to properly support large files. 2004-03-22 11:15:03 +00:00
Tim J. Robbins
23e7704b30 Use errc(). 2004-03-22 09:33:10 +00:00
Colin Percival
a616808417 1. Use socklen_t instead of int
2. Compare socket(2) return code to -1, not <= 0.

Obtained from:	OpenBSD rev. 1.9
2004-03-21 08:14:39 +00:00
Dag-Erling Smørgrav
efc4d24dd6 Support C-style comments in profile. 2004-03-21 04:47:54 +00:00
Ruslan Ermilov
6bb3f2072d More cleanups:
- 0 should have been -1 in previous commit (just to stay consistent),
- Spell null pointers as NULL, not 0,
- Fixed the comment about pr_usesysctl to not confuse it with boolean.

Pointed by:	bde
2004-03-18 07:21:31 +00:00
Ruslan Ermilov
52ded959f5 NULL -> 0. 2004-03-17 20:19:45 +00:00
Ruslan Ermilov
0222d5bc2d Improved incorrect usage diagnostics. 2004-03-17 11:06:40 +00:00
Ruslan Ermilov
5d8fdf31dd Trust bsd.prog.mk to set SRCS correctly. 2004-03-17 10:52:12 +00:00
Ruslan Ermilov
2dc7343e8e GC unnecessary include file. 2004-03-17 10:51:18 +00:00
Thierry Thomas
eb34a15088 Approved by: mat (mentor). 2004-03-16 19:39:11 +00:00
Ruslan Ermilov
1a490c95d2 Catch up with the removal of the wt(4) driver. 2004-03-14 12:09:43 +00:00
Juli Mallett
8714ee5954 Add multiple inclusion guards. Mostly this is for extern.h, which was
included twice by lprint.c, which included both finger.h and extern.h.
finger.h, in turn, includes extern.h.  The redundant include of extern.h
was removed from lprint.c, as part of this change, but the include guards
were added anyway out of spite.
2004-03-14 06:43:34 +00:00
Bruce Evans
9b987187ee Fixed misspellings of 0 as NULL. Fixed some nearby style bugs. 2004-03-14 05:55:16 +00:00
Bruce Evans
f342fec625 Fixed a misspelling of 0 as NULL. 2004-03-14 05:51:20 +00:00
Warner Losh
7cbabef2c2 With the passing of the asc driver, the sasc prograqm is no longer
necessary.
2004-03-14 04:59:17 +00:00
Dag-Erling Smørgrav
6d7c0d2fed Do not print a warning about net.inet.pim.stats if errno is
ENOENT, because that means we do not have PIM in the kernel.

Submitted by:	hmp
MFC after:	1 week
2004-03-12 11:22:50 +00:00
Bruce Evans
c044589554 Fixed a misspelling of 0 as NULL.
Fixed a nearby bug.  The "play it safe" code in dosysctl() was unsafe
because it overran the buffer by 1 if sysctl() filled all of the buffer.

Fixed a nearby style bug in output.  Not just 1, but 2 extra newlines
were printed at the end by "vmstat -m" and "vmstat -z".  Don't print
any newlines explicitly.  This depends on 2 of the many formatting
bugs in the corresponding sysctls.  First, the sysctls return an extra
newline at the end of the strings.  This also messes up output from
sysctl(8).  Second, the sysctls return an extra newline at the beginning
of the strings.  This is good for separating the 2 tables output by
"vmstat -mz" and for starting the header on a new line in plain sysctl
output, but gives a bogus extra newline at the beginning for "vm -[m | z]"
and "sysctl -n [kern.malloc | vm.zone]".

Fixed some nearby style bugs in the source code:
- the same line that misspelled 0 as NULL also spelled NULL as 0.
- the size was doubled twice in the realloc loop.
- the "play it safe" comment was misleading.  Terminating the buffer
  is bogus because dosysctl() is only meant to work with sysctls that
  return strings and the terminator is part of a string.  However, the
  kern.malloc sysctl has more than style bugs.  It also doesn't return
  a string.  Termination is needed to work around this bug.
2004-03-11 11:30:57 +00:00
Josef El-Rayes
55cc37447a Replace <iostream.h> with <iostream> to remove annoying warning
of using deprecated header.

Approved by:    dwhite, simon(mentor)
Reviewed by:    mlaier
Submitted by:   Stefan Farfeleder <stefan@fafoe.narf.at>
PR:             bin/63781
2004-03-11 10:43:35 +00:00
Bruce Evans
83e6e8406c Fixed a misspelling of '\0' as NULL. 2004-03-11 10:22:25 +00:00
Bruce Evans
00925a8e84 Fixed misspellings of 0 as NULL. 2004-03-11 10:19:45 +00:00
Bruce Evans
263bf898e0 Fixed misspellings of '\0' as NULL. 2004-03-11 10:12:05 +00:00
Bruce Evans
754df37025 Fixed a misspelling of 0 as NULL. 2004-03-11 10:09:01 +00:00
Ruslan Ermilov
30b800de8e Reworked the fix to print the useful line number on error in
the .for loop:

- Replaced four global variables in parse.c with one.
- Made Parse_FromString() accept the "lineno" as an argument.
- Fixed line numbering when there are escaped newlines in the
  body of the .for loop.

Adopted from:	NetBSD
2004-03-10 21:51:06 +00:00
Peter Edwards
c2026e4db2 Another April Fool signs up. 2004-03-10 00:06:01 +00:00
Ruslan Ermilov
577cf233eb Make it possible to ``.undef ${VAR}'' (expanding VAR to get
the variable name to undef).

Submitted by:	Cyrille Lefevre
2004-03-09 17:36:55 +00:00
David Malone
33dc549136 Fix the easy warnings:
1) Avoid shadowing index.
2) Constness.
3) Missing prototype for ifcmd.
4) Missing include of string.h.
5) Avoid shadowing error function.
6) ANSI definition for main.
2004-03-09 11:57:28 +00:00
David Malone
a77c5ad8b7 Misc fixes brought to light by WARNS=6:
1) Constness, unusedness and size_tness.
2) Don't clobber the value returned by hid_report_size in the daemon case.
3) Don't misspell "sizeof buf" as 100.
4) Don't run off the end of a buffer if the pid is about a google.
5) Avoid shadowing the usage function.
2004-03-09 11:35:43 +00:00
Ruslan Ermilov
d56ed147ae Fixed line numbering inside the .for loops.
Submitted by:	Cyrille Lefevre
2004-03-09 08:09:33 +00:00
Mike Heffner
43acc706ac These aren't all binary options. 2004-03-09 01:20:24 +00:00
Colin Percival
8c423a998e Make it possible for the %[eEfgG] formats to not result in an error
being reported by /usr/bin/printf.

This bug has been around for 22 months... either nobody uses printf
with floating-point values, or people are forgetting to check their
return codes.

Approved by:	rwatson (mentor)
2004-03-07 22:22:13 +00:00
Dag-Erling Smørgrav
7b8fd8e313 Fix markup.
Submitted by:	ru
2004-03-06 23:36:41 +00:00
Dag-Erling Smørgrav
bd43dc4256 Hook logins(1) up to the build. 2004-03-06 21:57:47 +00:00
Dag-Erling Smørgrav
0a5f38d4b1 Add a logins(1) utility similar to that found in SVr4 derivatives. This
particular implementation is based on the Solaris logins(1) man page.
2004-03-06 21:57:29 +00:00
Mike Heffner
761981e0e8 Assign checkmode boolean earlier to handle the goto jump.
Might fix PR bin/63769.
2004-03-06 13:27:59 +00:00
Wes Peters
0d1bf85301 Use getopt instead of hand-rolled argument parsing. Usage remains
the same, no man page changes required.

PR:		bin/48313
Submitted by:	Stefan Farfeleder <stefan@fafoe.dyndns.org>
Reviewed by:	joe@
2004-03-05 01:52:09 +00:00
Josef El-Rayes
edf075d085 Update URL of GCC status page to GCC 3.3
Approved by:    simon(mentor)
Submitted by:   Stefan Farfeleder <stefan@fafoe.narf.at>
PR:             docs/63370
2004-03-04 20:29:27 +00:00
Marc Fonvieille
ede93bc647 Typo fix.
PR:		docs/63677
Submitted by:	Volker Stolz <stolz@i2.informatik.rwth-aachen.de>
MFC after:	1 week
2004-03-03 09:15:07 +00:00
Jake Burkholder
d499047c83 Elf_Phdr.p_type 7 is "PT_TLS". 2004-03-02 14:06:27 +00:00
Mike Heffner
c92dfc231b Add the -e (mail presence test), -H (header summary mode), and -F
(message save as first recipient) options for standards
conformance.

Submitted by:	Wartan Hachaturow <wart@tepkom.ru> (with some changes)
PR:		standards/61934
2004-02-29 20:44:44 +00:00
Jens Schweikhardt
ec6001d98e Fix grammar bogon. 2004-02-29 12:52:21 +00:00
Bruce Evans
77585df415 Fixed style bugs in previous commit (.ifndef instead of .if defined(),
and tab lossage).

Garbage-collected NEED_LIBNAMES.
2004-02-29 06:39:11 +00:00
Tom Rhodes
e578c2421c Update the find manual page:
1: Document -follow under COMPATIBILITY.
2: Update an example to be a little more 'safe'.
3: Use '/' in place of '.' for an example; similar to other manual pages.

PR:		40196 (1), 39532 (2, 3)
Submitted by:	Marc Silver <marcs@draenor.org> (2 and 3)
Discussed with:	des (1)
2004-02-27 20:04:38 +00:00
Dag-Erling Smørgrav
76e4339aa7 I am a moron. 2004-02-27 19:00:41 +00:00
Dag-Erling Smørgrav
13ae56f84d Re-add the setuid bit, conditional on NO_SETUID_LOGIN being undefined. 2004-02-27 17:50:59 +00:00
Dag-Erling Smørgrav
ac9fd74eb1 Remove EXAMPLES section which duplicates text in fetch(3). 2004-02-27 10:27:01 +00:00
Dag-Erling Smørgrav
c9d0616d93 Cut through the bikeshed and remove login(1)'s setuid bit. It has no
business trying to impersonate su(1), and it does not need to be setuid
to function properly when invoked by getty(8) or telnetd(8).
2004-02-27 08:39:16 +00:00
Dag-Erling Smørgrav
e9c67f69d1 Use the -H option instead of the deprecated -follow predicate. 2004-02-25 21:45:41 +00:00
Bruce Evans
7501cdc8e5 Demangled vendor ids. Fixed misplaced FreeBSD id. 2004-02-25 13:26:53 +00:00
Bruce Evans
5dfef63412 Backed out rev.1.6. A bogus include was added to work around breakage of
<netinet/tcp_var.h>'s prerequisites.  Prerequistes should not grow for
userland headers, and <netinet/tcp_var.h> is unfortunately still needed
in userland.
2004-02-25 13:11:48 +00:00
Colin Percival
28ef1f9814 Send birthday presents to Wadham College, Oxford. :)
Approved by:	rwatson (mentor)
2004-02-24 01:44:47 +00:00
Markus Brueffer
538d21bfb9 Add my birthday.
Approved by:	arved (mentor)
2004-02-23 20:39:23 +00:00
Johan Karlsson
604d24db95 style.Makefile(5):
Use WARNS?= instead of WARNS=.
2004-02-23 20:25:27 +00:00
Dag-Erling Smørgrav
24126ee089 Typo. 2004-02-23 09:08:27 +00:00
Dag-Erling Smørgrav
5476ba5545 Use %zu for size_t, like God intended. 2004-02-18 21:51:02 +00:00
Dag-Erling Smørgrav
eae1afd9a2 Fix printf() format bug in previous commit (size_t != int).
Use %ju and an (uintmax_t) cast to print size_t values.
Use %jd and an (intmax_t) cast to print off_t values.
Use off_t variables to hold the difference between two off_t values.
Don't bother with unsigned char where char will do nicely.
2004-02-18 21:37:36 +00:00
Dag-Erling Smørgrav
3f59deafb3 Revamp the statistics code, and switch to a much more compact display
format.  The old code tried to produce the exact same output as the
pre-libfetch implementation, but I no longer see any value in this.
2004-02-18 15:12:00 +00:00
David Malone
c4dd6db19b Fix some WARNS:
1) Remove some unused variables.
2) Mark some things aas static or __unused.
3) Cast to make sure we're comparing the same types.
2004-02-15 22:48:25 +00:00
David Malone
feeb25809c Remove an unused variable. 2004-02-15 22:12:32 +00:00
David Malone
10f106f5fd Fix a few WARNS:
1) Include string.h for strcpy.
2) Don't make duplicate declaration of dump_file, we now include extern.h.
3) Help out with some constness.
4) Cast to slightly better types in some comparisons.
2004-02-15 22:01:23 +00:00
David Malone
baa8d9176f Include timeconv.h for _int_to_time and _time_to_int. 2004-02-15 21:52:59 +00:00
Colin Percival
d6a68195af Attempt #2 to fix script(1) if the standard input is closed: If we
read EOF from STDIN_FILENO, write zero bytes into the pseudo-terminal;
this is interpreted as an EOF by the program being scripted.

I've tested this with two non-interactive scripts:
# echo 5 | script foo sh -c 'read x; sleep $x; echo bar'
# echo bar | xargs script foo echo
and one interactive program:
# script foo more /etc/passwd
and everything seems to work properly...

PR:		bin/56166, bin/57414, ports/57415, ports/60534
Approved by:	rwatson (mentor)
MFC after:	2 weeks
2004-02-15 17:30:13 +00:00
Bruce Evans
a55a608e71 Only indent once for continuation lines when not lining up with
parentheses if the continuation indent is exactly half of the main
indent.  Indenting one contination indent for every level of
parentheses gives bad results in most cases and is not what is done
in about 90% of properly hand-formatted KNF code (sys/kern/*.c,
nvi/common/*.c).  The main advantage of the non-default KNF options
-nlp -ci4 is that continuation lines don't accidentally line up with
the next main indentation level or march to the right, and increasing
their indentation defeats this.

This behaviour change is limited to when the continuation indent is
exactly half of the main indent to avoid adding yet another option.
2004-02-12 16:25:12 +00:00
Wes Peters
d5a445b62b Add some presidential birthdays. 2004-02-10 18:41:52 +00:00
Max Laier
9c43d53bb8 Add my birthday (for those interested)
Approved by: bms (mentor)
2004-02-10 16:23:17 +00:00
Bruce Evans
88ce0e7f7e Added an option -ldi<N> to control indentation of local variable names.
The default is to be backwards compatible and non-KNF (use the same
indentation for locals as for globals; -ldi0 gives KNF indentation
for locals (none)).  The indentation for globals also applies to struct
member names in local declatations.  The indentation of variable names
in multi-line declarations is broken in various ways and this commit
gives some new variations.

indent.1:
Also clarified the description of -di<N>.
2004-02-09 21:48:51 +00:00
Bruce Evans
7b3b38c6db Only use tabs to indent variable names if the declaration indent is
nonzero (so that the 1-char indentation given by -di0 is never rendered
by a tab).

Removed garbage commented out code for setting the indentation of variable
names.
2004-02-09 20:42:08 +00:00
Bruce Evans
eebee5a754 Backed out a part of previous commit that wasn;t mentioned in the log
message and wasn't quite ready (it avoided indenting the names of local
variables).
2004-02-09 20:26:27 +00:00
Bruce Evans
e024a09064 Fixed tab lossage in indented variable names. The -diN option was
worse than useless because it caused things like mangling of
"^int\tfoo" to "int     foo" (this for N = 8).  This quick fix breaks
the invariant that characters between s_code and e_code have width 1,
but nothing seems to depend on this.
2004-02-09 15:57:35 +00:00
Bruce Evans
47fe027b66 Fixed misformatting of "struct foo *bar" in function parameter lists. It
was mangled to "struct foo * bar".  There should be an option to control
this, but no space is normal.  This finishes fixing the bugs in rev.1.4.

indent(1) still doesn't really understand types in parameter lists.  It
thinks keywords inside parentheses are for casts or sizeofs.  This works
accidentally for scalar types and this quick fix makes it work similarly
but not so accidentally for struct/union/enum types.
2004-02-09 15:27:02 +00:00
Bruce Evans
611e9fdbb4 Expanded the size of the keyword table from 100 to 1000 entries so that
the number of typedef-names is not so limited.  Same as in rev.1.4.

Added the "const" and "volatile" to the keyword table.  Rev.1.4 added
these but they were misclassified so they were not formatted as types.
indent still doesn't really understand them.  E.g., it mangles
"char * const *foo" and "char *const *foo".  This change mainly stops
it mangling "char const foo" to "char<declaration-indent>const foo".
2004-02-09 13:13:03 +00:00
Bruce Evans
43a3abfd1e Backed out rev.1.4 and 1.7 so they they can be implemented and committed
properly.  Of the 3 changes mentioned in the log message for rev.1.4,
the first (implementing -[n]fcb) was correct but didn't touch this
file, the second (no-space-after-sizeof) was not actually done (it is
the default and is controlled by the undcoumented -[n]bs options), and
the third (no-space-after 'struct foo *') was very buggy and was reduced
to wrong comments and other style bugs by backing out the main part
of it in rev.1.6.  Rev.1.4 had 2 changes which were not mentioned in
its commit log: expand specials[] so that more than -83 typedef-names
can be specified (this was the one working change in rev.1.4), and add
"const" and "volatile" to specials[] (this was buggy).
2004-02-09 12:52:15 +00:00
Ruslan Ermilov
b08f1446e3 - Demangle usage().
- Require the "directory" argument with the -d option.
2004-02-07 07:22:11 +00:00
Ruslan Ermilov
47d7e8a96f Fixed style of DPADD and LDADD assignments as per style.Makefile(5). 2004-02-05 22:44:25 +00:00