Commit Graph

10017 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav
e4bb45b1ce Fix casting. 2011-10-08 12:21:51 +00:00
Dag-Erling Smørgrav
c02541ee80 Whitespace. 2011-10-08 12:10:16 +00:00
Dag-Erling Smørgrav
73430055e6 C has had swicth statements for 40 years or so. It's about time we
started using them.
2011-10-08 11:51:48 +00:00
Dag-Erling Smørgrav
77e23dbe07 Sort and line up. 2011-10-08 11:39:00 +00:00
Dag-Erling Smørgrav
34bb8e6d12 1) Some of the #defines or enums for which we auto-generate naming
functions may be wider than int, so use intmax_t throughout.  Also
   add missing casts in printf() calls.

2) Clean up some of the auto-generated code to improve readability.

3) Auto-generate kdump_subr.h.  Note that this requires a semi-ugly hack
   in the Makefile to make sure it is generated before make(1) tries to
   build kdump.c, or preprocess it for 'make depend'.

MFC after:	3 weeks
2011-10-08 09:57:29 +00:00
Ed Schouten
4a955f14cf Remove extraneous WARNS=7.
WARNS above 6 has no use. Also, all of usr.bin is also built with
WARNS=6 by default.

Discussed with:	edwin
2011-10-08 07:20:12 +00:00
Jakub Wojciech Klama
ae07436f81 Add myself.
Approved by:	wkoszek (mentor)
2011-10-07 23:12:33 +00:00
Xin LI
87ef283176 Fix build on i386 and arm.
Tested with:	make universe
Pointy hat to:	delphij
2011-10-06 04:39:18 +00:00
Gabor Kovesdan
f20f6f3fdf Update BSD grep to the latest development version. It has some code
backported that was written for the TRE integration project in Google
Summer of Code 2011.  This is a temporary solution until the whole
regex library is not replaced so that BSD grep development can continue
and the backported code gets some review and testing.  This change only
improves scalability slightly, there is no big performance boost yet
but several minor bugs have been found and fixed.

Approved by:	delphij (mentor)
Sposored by:	Google Summer of Code 2011
MFC after:	1 week
2011-10-05 09:56:43 +00:00
Dag-Erling Smørgrav
b6f6aba365 latin1 -> utf8 2011-10-04 15:00:54 +00:00
Adrian Chadd
c6ae748382 Handle the situation where fixups_close() has been called but more fixups
are still available on the queue.

Without this, the fixups producer/consumer pipeline will artifically terminate
before all of the fixups have been processed, leading to incomplete updates
and generally quite unhappy users.

Submitted by:	mux
2011-10-04 14:26:45 +00:00
Adrian Chadd
787ac3452c Update the comment to reflect what is actually going on.
Submitted by:	mux
2011-10-04 14:25:10 +00:00
Ed Schouten
05806a06c5 Correct column with for device numbers made in previous change.
The device number should be displayed using only five columns -- not eight.
2011-10-01 09:16:07 +00:00
Glen Barber
ef87c4dcd5 Fix a few grammar and mdoc nits in script.1
PR:		161088
Submitted by:	Ben Kaduk ( kaduk % mit ! edu )
MFC after:	1 week
Need-MFC:	225809
2011-09-29 02:29:32 +00:00
Eitan Adler
963527148e - I am not the oldest committer alive (yet)
Approved by:	bapt (mentor)
2011-09-28 21:42:13 +00:00
Eitan Adler
a2f4ffd69c - fix whitespace issue in calendar
- add a n after \

Submitted by:	brueffer
Approved by:	bapt (mentor)
2011-09-28 20:46:52 +00:00
Ed Schouten
9f365aa1d6 Get rid of major/minor number distinction.
As of FreeBSD 6, devices can only be opened through devfs. These device
nodes don't have major and minor numbers anymore. The st_rdev field in
struct stat is simply based a copy of st_ino.

Simply display device numbers as hexadecimal, using "%#jx". This is
allowed by POSIX, since it explicitly states things like the following
(example taken from ls(1)):

	"If the file is a character special or block special file, the
	size of the file may be replaced with implementation-defined
	information associated with the device in question."

This makes the output of these commands more compact. For example, ls(1)
now uses approximately four columns less. While there, simplify the
column length calculation from ls(1) by calling snprintf() with a NULL
buffer.

Don't be afraid; if needed one can still obtain individual major/minor
numbers using stat(1).
2011-09-28 18:53:36 +00:00
Eitan Adler
7d6060bd9c - add myself to calendar
Approved by:	sahil (mentor)
2011-09-28 18:49:37 +00:00
Xin LI
f13a03d89e Sync RCS id with NetBSD, this was intentionally omitted from the advisory
in order to reduce patchset size.

MFC after:	3 days
2011-09-28 18:03:53 +00:00
Chris Rees
ae7bd33eb5 Include limits.h instead of sys/limits.h to improve portability.
PR:		bin/150772
Submitted by:	Derrick Brashear <shadow@gmail.com>
Reviewed by:	Garrett Cooper <yanegomi@gmail.com>
Approved by:	cognet
2011-09-28 17:03:49 +00:00
Alexander Motin
7778ab7e0c MFprojects/hid:
Import the rest of HID improvements from the branch:
 - improve report descriptor parser in libusbhid to handle several kinds of
reports same time;
 - add to the libusbhid API two functions wrapping respective kernel IOCTLs
for reading and writing reports;
 - tune uhid IOCTL interface to allow reading and writing arbitrary report,
when multiple supported by the device;
 - teach usbhidctl to set output and feature reports;
 - make usbhidaction support all the same item names as bhidctl.

Sponsored by: iXsystems, inc.
2011-09-28 14:52:25 +00:00
Bjoern A. Zeeb
a06534c3c2 Fix handling of corrupt compress(1)ed data. [11:04]
Add missing length checks on unix socket addresses. [11:05]

Approved by:	so (cperciva)
Approved by:	re (kensmith)
Security:	FreeBSD-SA-11:04.compress
Security:	CVE-2011-2895 [11:04]
Security:	FreeBSD-SA-11:05.unix
2011-09-28 08:47:17 +00:00
Dag-Erling Smørgrav
bb6e332901 Document the fact that passive mode is now the default.
Update copyright dates and strip my middle name.
2011-09-27 19:02:44 +00:00
Mikolaj Golub
29da75477b When script(1) reads EOF from input it starts spinning on zero-byte
reads eating 100% CPU. Fix this by skipping select on STDIN after
reading EOF -- permanently if STDIN is not terminal and for one second
if it is.

Also after reading EOF from STDIN we have to pass it to the program
being scripted. The previous approach was to write zero bytes into the
pseudo-terminal. This does not work because zero-byte write does not
have any effect on read. Fix this by sending VEOF instead.

Submitted by:	Ronald Klop <ronald-freebsd8@klop.yi.org>
Discussed with:	kib, Chris Torek <chris.torek@gmail.com>
Approved by:	kib
MFC after:	1 week
2011-09-27 18:14:04 +00:00
Dag-Erling Smørgrav
5c5052cca4 Use fseeko() instead of fseek(). The rest of the code is off_t-aware,
but the use of fseek() means fetch(1) can't correctly resume a transfer
that was interrupted past the 2 GB mark.

Pointed out by:	ache@
MFC after:	3 weeks
2011-09-27 17:11:31 +00:00
Dag-Erling Smørgrav
27274e81b2 Followup to r225599: the fseek() was a no-op since the file was opened
in append mode.  Open it in read-write mode instead.  Also move the
fseek up one level to cover the (unlikely but not impossible) case where
the server accepts ranges but does not send a Content-Size header.

PR:		bin/117277
MFC after:	3 weeks
2011-09-27 15:57:13 +00:00
Dag-Erling Smørgrav
a17e51c108 When resuming an HTTP download, we failed to verify that the range
returned by the server matched what we requested, and blindly appended
what we received to what we already had.  This could go two ways: if the
delivered offset was higher than expected, the local file would contain
duplicate data, while if it was lower than expected, there would be data
missing from the middle of the file.  Furthermore, if the transfer was
interrupted again, each subsequent attempt would compound the error.
Fix the first problem by restarting the transfer from scratch if there
is a gap, and the second by explicitly seeking to the correct location
in the local file so as to overwrite any duplicated data.

PR:		bin/117277
Approved by:	re (kib)
MFC after:	3 weeks
2011-09-15 22:50:31 +00:00
David Malone
ab7e59168c It seems when I added code for affine unit changes to units, I
forgot to tell the man page we could now convert Celsius to Fahrenheit.

Approved by:	re (kib)
MFC after:	1 month
2011-09-15 19:52:43 +00:00
Christian Brueffer
43fb93b0da Fix typos in error messages.
Found by:	kib
Approved by:	re (kib)
MFC after:	1 week
2011-09-13 20:35:34 +00:00
Christian Brueffer
51ad0033d6 Fix csup to allow case insensitive server names in the auth file,
just as advertised in the manpage.

PR:		158652
Submitted by:	stephen
Approved by:	re (kib)
MFC after:	1 week
2011-09-13 20:33:27 +00:00
Rick Macklem
002c2778b1 Fix nfsstat(1) so that it prints out correct stats for the
new NFS server when the "-e" option is not used. The bug was
that srvrpccnt[] was being indexed by NFSPROC_XXX when it needs
to be indexed by NFSV4OP_XXX.

Tested by:	hrs
Approved by:	re (bz)
2011-08-23 13:44:56 +00:00
Rick Macklem
806f9b4262 Fix nfsstat(1) so that it prints out correct stats for the
new NFS server when the "-w" option is used. The problem was
spotted by hrs@ during testing where srvrpcnt[] must be indexed
by NFSV4OP_XXX and not NFSPROC_XXX.

Submitted by:	hrs
Approved by:	re (bz)
MFC after:	2 weeks
2011-08-23 13:17:09 +00:00
Gabor Kovesdan
ad92276ece - Fix exclusion of directories from a recursive search
- Use FTS_SKIP for exclusion instead of custom code

Submitted by:	ttsestt@gmail.com
Approved by:	re (kib), delphij (mentor)
2011-08-17 13:58:39 +00:00
Gabor Kovesdan
dab19f3084 - Fix handling of environmental variables when they are set to empty string
Submitted by:	ttsestt@gmail.com
Approved by:	re (kib), delphij (mentor)
2011-08-17 13:56:33 +00:00
Jilles Tjoelker
54d34ff63d tail: Fix crash if -F'ed file's filesystem disappears.
If tail notices that a file it is following no longer exists (because stat()
fails), it will output any final lines and then close the file. If the read
operation also causes an error, such as when the filesystem is forcefully
unmounted, it closes the file as well, leading to fclose(NULL) and a
segmentation fault.

PR:		bin/159750
Submitted by:	swills
Approved by:	re (kib)
MFC after:	1 week
2011-08-14 13:37:38 +00:00
Robert Watson
d57486e21c Updates to libprocstat(3) and procstat(1) to allow monitoring Capsicum
capability mode and capabilities.

Right now no attempt is made to unwrap capabilities when operating on
a crashdump, so further refinement is required.

Approved by:	re (bz)
Sponsored by:	Google Inc
2011-08-14 00:42:09 +00:00
Kevin Lo
8945a9a003 catstrg() does not set the resulting string length.
PR:	bin/152549
Submitted by:	Henning Petersen <henning dot petersen at t-online dot de>
Approved by:	re (hrs)
2011-08-08 05:22:09 +00:00
Ulrich Spörlein
72baa018d0 For POLA reasons, disable SGR sequences in catpages.
See r222647 for a similar change to bsd.doc.mk after SGR was generally
turned on in groff.

Suggested by:	ru
Approved by:	re (kib)
2011-08-05 15:07:28 +00:00
Ed Maste
cf933f5bf9 Don't try to free() an address returned by mmap(). This appears to be
triggered by the same .o being included twice on the command line.

Found by:	Nima Misaghian at Sandvine
Reviewed by:	kientzle, kaiw
Approved by:	re
MFC after:	1 week
2011-08-04 14:18:09 +00:00
Ruslan Ermilov
9f0f0b4d4c Clean up markup.
Approved by:	re (kib)
2011-08-04 08:50:33 +00:00
Ulrich Spörlein
a9c153d033 Unbreak catman(1) by removing calls to col(1).
col(1) was mangling the SGR escapes and is not strictly required.

See r222647, r222648, r222650, and r222653 for more details.

Reported by:	delphij
Reviewed by:	ru
Approved by:	re (kib)
MFC after:	3 weeks
2011-08-03 19:26:57 +00:00
Ulrich Spörlein
f0720ed5f8 Fix broken mdoc.
Found by:	manlint
Approved by:	re (kib)
2011-08-01 22:21:18 +00:00
Martin Matuska
83c03ed27d Correctly link bsdcpio and bsdtar against libmd and libcrpyto
by applying the change from r221472 (libarchive).

Reviewed by:	kientzle
Approved by:	re (kib)
MFC after:	3 days
2011-08-01 08:22:40 +00:00
Alexander Motin
1bee2ec756 MFprojects/hid:
- Fix usbhidctl and usbhidaction to handle HID devices with multiple
report ids, such as multimedia keyboards.
 - Add collection type and report id to the `usbhidctl -r` output. They
are important for proper device understanding and debugging.
 - Fix usbhidaction tool to properly handle items having report_count
more then 1.

Approved by:	re (kib)
MFC after:	2 weeks
2011-07-30 13:22:44 +00:00
Michael Tuexen
2e34c19b93 Fix the following bugs related to the SCTP support of netstat:
* Correctly handle -a.
* -A isn't supported.
* Show all closed 1-to-1 and 1-to-many style sockets.
* Show all listening 1-to-many style sockets.
* Use consistent formatting for -W.

PR: 150642
Approved by: re@
MFC after: 4 weeks.
2011-07-22 16:42:12 +00:00
John Baldwin
fcc3d62fa5 Rework the dynamic per-CPU stats code a bit. Always set 'statics->ncpus'
to the maximum number of CPUs to ensure that lcpustates[] array is always
allocated to the maximum size.  Previously, if top was started without
per-CPU stats it would allocate a smaller lcpustates[] array.  When
per-CPU stats were then enabled, it would overflow the array and trash
the cpustates_columns[] array causing the CPU stats to be printed in the
wrong locations.

Approved by:	re (kib)
MFC after:	1 week
2011-07-18 21:15:47 +00:00
Bjoern A. Zeeb
c618a5222e Constantly print the command name and if set include the thread
name in per-thread mode.

Discussed with:	jhb
Obtained from:	Ed Maste at Sandvine Incorporated
Sponsored by:	Sandvine Incorporated
MFC after:	1 week
Approved by:	re (kib)
2011-07-18 20:57:43 +00:00
Bjoern A. Zeeb
925af54487 Rename ki_ocomm to ki_tdname and OCOMMLEN to TDNAMLEN.
Provide backward compatibility defines under BURN_BRIDGES.

Suggested by:	jhb
Reviewed by:	emaste
Sponsored by:	Sandvine Incorporated
Approved by:	re (kib)
2011-07-18 20:06:15 +00:00
Sergey Kandaurov
8953ac4334 sintrcnt/sintrnames is the address of the size, not the actual size.
Use them appropriately to fetch the actual size.
That fixes vmstat -i with kvm backend.

Submitted by:	peter
Approved by:	re (kib)
2011-07-18 19:42:18 +00:00
John Baldwin
2417d97ebb - Export each thread's individual resource usage in in struct kinfo_proc's
ki_rusage member when KERN_PROC_INC_THREAD is passed to one of the
  process sysctls.
- Correctly account for the current thread's cputime in the thread when
  doing the runtime fixup in calcru().
- Use TIDs as the key to lookup the previous thread to compute IO stat
  deltas in IO mode in top when thread display is enabled.

Reviewed by:	kib
Approved by:	re (kib)
2011-07-18 17:33:08 +00:00