Commit Graph

8740 Commits

Author SHA1 Message Date
Yaroslav Tykhiy
cf99a6bebb Fix a few obvious errors in the znew(1) script.
PR:		bin/120249
Submitted by:	Jaakko Heinonen <see the PR for email>
2008-02-09 13:04:01 +00:00
David Malone
d3e5e11ce6 WARNS fixes:
1) Add missing parens around assignment that is compared to zero.
2) Make some variables that only take non-negative values unsigned.
3) Some casts/type changes to fix other constness warnings.
4) Make one variable a const char *.
5) Make sure termwidth is positive, it doesn't make sense for it to be negative.

Approved by:	dds
2008-02-09 09:12:02 +00:00
Joe Marcus Clarke
f280594937 Add support for displaying a process' current working directory, root
directory, and jail directory within procstat.  While this functionality
is available already in fstat, encapsulating it in the kern.proc.filedesc
sysctl makes it accessible without using kvm and thus without needing
elevated permissions.

The new procstat output looks like:

  PID COMM               FD T V FLAGS    REF  OFFSET PRO NAME
  76792 tcsh              cwd v d --------   -       - -   /usr/src
  76792 tcsh             root v d --------   -       - -   /
  76792 tcsh               15 v c rw------  16    9130 -   -
  76792 tcsh               16 v c rw------  16    9130 -   -
  76792 tcsh               17 v c rw------  16    9130 -   -
  76792 tcsh               18 v c rw------  16    9130 -   -
  76792 tcsh               19 v c rw------  16    9130 -   -

I am also bumping __FreeBSD_version for this as this new feature will be
used in at least one port.

Reviewed by:	rwatson
Approved by:	rwatson
2008-02-09 05:16:26 +00:00
Guy Helmer
8a4313c59c Fix truncation of lines at LINE_MAX characters by dynamically
extending line buffers.

PR:		bin/76578
2008-02-08 23:04:13 +00:00
David Malone
97ce0ae60f WARNS fixes: mainly constness and avoid comparing signed with
unsigned by making array indicies unsigned. Also note one or two
unused parameters.
2008-02-08 11:03:05 +00:00
David Malone
84eebcc257 WARNS fixes: remove two unused variables and add some constness. 2008-02-08 10:58:50 +00:00
Marius Strobl
bc784cfe1b Fix netname() [1] and routename() on big-endian LP64 archs.
Submitted by:	Yuri Pankov [1]
MFC after:	3 days
2008-02-07 23:00:40 +00:00
Antoine Brodin
9298b21daf Add my birthday.
Approved by:	rwatson (mentor)
2008-02-05 19:34:54 +00:00
David E. O'Brien
d870d44d20 Minor style(9) nit. 2008-02-05 17:34:44 +00:00
Dag-Erling Smørgrav
5fb6bed92c Revert CLEANDEPFILES commit per ru@'s request; it does not really solve
the problem.  The correct fix will follow.
2008-02-05 08:52:36 +00:00
Dag-Erling Smørgrav
0d7cc1d0eb Normally, when a header file is removed from the build (as i4b headers
were recently), a simple 'make cleandepend; make depend' is sufficient
to keep the tree buildable after a cvs update when doing incremental
builds.

However, kdump and truss use a script which searches for header files
that define ioctls, and generates C code that includes them.  This
script will usually not need updating when a header file is removed,
so the normal dependency mechanism will not realize that it needs to
be re-run.  One is therefore left with code that references dead files
but will only be removed by a full 'make clean', which defeats the
purpose of incremental builds.

To work around this, modify the cleandepend target in bsd.dep.mk to
also remove any files listed in a new variable named CLEANDEPFILES,
and modify kdump's and truss's Makefiles accordingly.

MFC after:	2 weeks
2008-02-03 11:34:56 +00:00
Dag-Erling Smørgrav
72d1e737b5 These are files are shell scripts; give smart editors a chance to figure
it out by adding the usual shebang.

MFC after:	2 weeks
2008-02-03 11:33:27 +00:00
Ruslan Ermilov
3aefeab5df Christos decided to keep the manpages in mdoc(7) format,
so stop using our own versions of these.
2008-01-30 12:56:59 +00:00
Xin LI
2f487fe4e4 Use calloc() when requesting zero'ed memory allocation rather than rolling
our own.
2008-01-29 00:06:44 +00:00
Giorgos Keramidas
86ca3fd005 Revive '-opt' flags which I accidentally removed.
Noticed by:	simon
2008-01-27 16:20:36 +00:00
Giorgos Keramidas
a502340a03 Document the no-op -r option of BSD xargs(1).
PR:		docs/106416
Submitted by:	Pete Slagle, freebsd-stable at voidcaptain.com
MFC after:	3 days
2008-01-26 12:38:19 +00:00
Ruslan Ermilov
47dd70868b Flag a hack. 2008-01-24 07:25:13 +00:00
Ruslan Ermilov
f0c2fb2d04 Style. 2008-01-24 07:24:30 +00:00
Tim Kientzle
97f576d0a4 Make -l always have the SUSv2 meaning of "check links."
GNU tar changed -l to match SUSv2 a couple of years ago,
so bsdtar no longer needs to pander to this particular GNUism.

Thanks to: Debian maintainers
MFC after: 7 days
2008-01-22 07:23:44 +00:00
Andrey A. Chernov
8d4b16f8bb Understand newly introduced "ASCII" encoding 2008-01-22 00:04:50 +00:00
Tom Rhodes
e322ed0f05 Note what options are only for DDS drives.
PR:	35608
2008-01-21 22:08:05 +00:00
Robert Watson
87cb56f6df When printing process file descriptor lists, show a type of 'h' for
POSIX shared memory descriptors.
2008-01-20 19:57:33 +00:00
Peter Wemm
248e52ada8 Fix some boolean logic errors. && vs & and other sillyness. *blush*
This would prevent it from skipping non-present cpus in -P output.

Submitted by:  Pieter de Goeje <pieter@degoeje.nl>
2008-01-18 22:09:44 +00:00
Peter Wemm
031175705e Add a -P flag to display per-cpu cpu usage stats. 2008-01-18 01:43:14 +00:00
Xin LI
93b9f50404 ANSIfy and remove register.
Resulting binary verified with strip(1)+md5(1).
2008-01-16 19:27:43 +00:00
David Schultz
3c58f6ddbd Fix some bugs in wall(1):
- Handle wrapping correctly when \r appears in the input, and don't
  remove the \r from the output.
- For lines longer than 79 characters, don't drop every 80th character.
- Style: Braces around compound while statement.

PR:		114498
Submitted by:	Niclas Zeising <niclas.zeising@gmail.com> (earlier version)
2008-01-15 07:40:30 +00:00
David E. O'Brien
ef19c627f8 Update for the 'file' 4.23 import. 2008-01-13 20:37:19 +00:00
Xin LI
5abb148f43 - Handle the case where interface from "middle" is missing by
more carefully inspecting the return value from sysctl(3). [1]
 - Use calloc instead of malloc+memset of zero.

Submitted by:	Alexander Chernikov <admin su29 net> [1]
PR:		bin/119581
MFC after:	2 weeks
2008-01-12 00:11:26 +00:00
Andrew Thompson
a3ab9923ff Add IFT_BRIDGE to the Ethernet section so l2 addresses are formatted correctly.
PR:		bin/119542
Submitted by:	Niki Denev
2008-01-10 20:53:13 +00:00
Sam Leffler
7627e00431 quiet compiler complaint about unused parameters 2008-01-10 04:28:26 +00:00
David E. O'Brien
dbb2956620 Improve -u (limit uid lookups) behavior.
Submitted by:	David Frascone <dave@frascone.com>
PR:		119490
2008-01-09 18:06:24 +00:00
Dag-Erling Smørgrav
497a8b25b5 Welcome unzip(1), a pure BSD drop-in replacement for ports/unzip. In its
current state, it can handle all but four of the 991 zip files (including
jar files) I was able to identify in the ports tree.  The remaining four
are two self-extracting archives and two which have garbage preceding the
first local header.  This limitation is a feature of libarchive(3) which
I am currently working to resolve.

The code is unnecessarily large due to the need to emulate the exact
command-line syntax and behaviour of ports/unzip.  My initial incompatible
implementation was one quarter the size of the one I am committing here.
2008-01-08 08:00:06 +00:00
John Baldwin
0460d3516d Only use sockoptname() to parse socket option names for SOL_SOCKET
requests.

MFC after:	3 days
Reported by:	Michiel Boland  michiel boland.org
2008-01-07 18:50:25 +00:00
David E. O'Brien
bc215f5905 Make a few messages more consistant with the others. 2008-01-04 03:09:28 +00:00
David E. O'Brien
3feeb33206 more style(9) 2008-01-04 03:08:49 +00:00
Jason Evans
9a62623a15 The break() system call takes a pointer argument, not an integer. This
change fixes output for break() on LP64 systems.
2008-01-03 00:18:03 +00:00
David E. O'Brien
65475bc8e6 style(9)
+ kread is not a boolean, so check it as such
+ fix $FreeBSD$ Ids
+ denote copyrights with /*-
+ misc whitespace changes.
2008-01-02 23:26:11 +00:00
Tim Kientzle
4a1f529a56 Remove the old bsdtar test scripts; something much
better is almost ready to commit.
2008-01-02 00:28:44 +00:00
Tim Kientzle
d671137571 A couple of miscellaneous fixes:
* prototypes for optarg/optind on platforms that don't already have them
  * Disambiguate version number macros
  * Remove unnecessary PACKAGE_NAME macro
  * Hook for forthcoming bsdtar test suite
  * Sync version number up with the portable distribution
2008-01-02 00:27:14 +00:00
Tim Kientzle
ec3df377a1 Fill in the approximate date when tar(1) first appeared. 2008-01-02 00:24:10 +00:00
Tim Kientzle
e3bd5f097c Include a suitable stub definition of __FBSDID() for non-FreeBSD platforms. 2008-01-02 00:23:00 +00:00
Tim Kientzle
fd3fd2a992 Use archive_entry_strmode() instead of a local bsdtar_strmode().
(This does a couple of things that the standard library's strmode()
doesn't; it proved useful in bsdcpio as well, so I pushed it down
into libarchive.)
2008-01-02 00:21:27 +00:00
Tim Kientzle
b47d2925d7 Include Guido's copyright for the fnmatch() code I cribbed from.
(It's in the C source, just wasn't in the COPYING file until now.)
2008-01-02 00:19:49 +00:00
Weongyo Jeong
6bfc16da36 Add my birthday to the calendar.
Approved by:	thompsa (mentor)
2008-01-01 10:29:22 +00:00
Warner Losh
b428ff6b67 follow style(9) more closely and list sys/types.h first after sys/defs.h.
Submitted by: max@
2008-01-01 10:04:10 +00:00
Greg Lehey
8ddfe1c32c style(9) 2007-12-30 22:04:04 +00:00
Greg Lehey
cd59b2cd17 If we can't open a calendar file, don't guess why. Check the error
return and print a useful message.

Prior to this commit, access problems could give rise to messages that
the file didn't exist.
2007-12-30 22:02:50 +00:00
Warner Losh
ee4f10a0e0 Some systems need the types defined in sys/types.h, but lack the
sys/types.h polution  that FreeBSD  has in one  of its  include files.
Since  this  is  a  bootstrap  tool, include  more  than  is  strictly
necessary for FreeBSD.
2007-12-29 05:15:54 +00:00
Dag-Erling Smørgrav
0fc781ff32 List all environment variables supported by libfetch, along with a reference
to the fetch(3) man page.

MFC after:	1 week
2007-12-28 19:47:37 +00:00
Edwin Groothuis
55e2cb41f2 Add the ability to clean up all shared memory segments which are
unused in one go.

From the original PR:

	I've observed that linux apps running under the linuxulator
	have a habit of leaving behind shared memory segments which
	are unused, but which eventually cause the system to run
	out of free segments and these apps will stop working.
	ipcrm(1) currently only allows removal of unused message
	queues, shared memory segments and semaphores on an individual
	basis, or those having a matching (non-zero) key. However
	it would often be convenient to just do a complete cleanup
	of everything, usually as root.

PR:		bin/118292
Submitted by:	Callum Gibson <callumgibson@optusnet.com.au>
Not reviewed by:	grog@
Approved by:	grog@
2007-12-25 00:52:24 +00:00
Warner Losh
f7d681bc5d usbhidctl appears to not report features and write size correctly
This turns out to be due to an argument botch for hid_report_size.
The PR contained patches to fix the argument botch.

Submitted by: Maurice Castro
PR: usb/118915
2007-12-21 03:40:36 +00:00
Ruslan Ermilov
a2854cdf20 Fix disorder introduced in previous commit. 2007-12-20 16:40:25 +00:00
Poul-Henning Kamp
8f2c52e6fb Pull ministat into the installed system and write it a man-page.
(Repocopied from src/tools/tools/ministat)
2007-12-20 10:17:07 +00:00
Ruslan Ermilov
0decbf9db9 Fix printing of the number of syncache entries added. 2007-12-18 12:07:10 +00:00
Edwin Groothuis
fa44a2923e Stylify ipcs/ipcs.c and ipcrm/ipcrm in preparation of the upcoming
changes as proposed in bin/118292.

Feel free to mention any I have missed, there is much to learn with
regarding to style(9).

Approved by:	grog@
2007-12-18 09:39:47 +00:00
Maxim Konovalov
fe832db659 o Fix a holiday to reflect a reality.
Submitted by:	Andrey V. Elsukov
MFC after:	1 week
2007-12-17 07:36:39 +00:00
Edwin Groothuis
1b61ad6f38 Give a better description when a install of multiple files fails
because of the absence of a destination directory or if the
"destination directory" is not a directory.

PR:		bin/11826
Submitted by:	Denis Eremenko <moonshade@pnhz.kz>
Approved by:	grog@
X-MFC after:	various freezes
2007-12-14 08:46:57 +00:00
Peter Wemm
4adb5266e8 Add the -H, -h and -P flags to vmstat. -P causes per-cpu output of
user/system/idle stats.  -h feeds the memory column through
humanize_number() to reduce the amount of column overflowing.  -H turns
this off.  -h is turned on by default if stdout is a tty.
2007-12-13 02:36:11 +00:00
Robert Watson
5a246d2912 Add 'COMM' column to a few more output modes of procstat(1). The only
one it's missing from is the VM display, where there's really not room,
and the file output display is looking quite cramped.
2007-12-10 20:55:43 +00:00
Warner Losh
640360c2f4 Use a clever definition of __FBSDID to allow building on !FreeBSD systems. 2007-12-09 16:48:51 +00:00
John Baldwin
b850a685ce Add several missing comma's in the fancy syscall parsing case before
some arguments that are parsed (e.g., semctl command names).

MFC after:	3 days
2007-12-06 08:49:43 +00:00
Robert Watson
45c29f5ba2 Display per-thread command line in TDNAME field for -k and -t; if
no per-thread name is available or the name is identical to the
process name, display "-" instead.  Very slightly shrink the COMM
entry to make a bit more room, although this doesn't help with
stack traces much.

Suggested by:	thompsa
2007-12-03 21:21:15 +00:00
Robert Watson
b59f38b57c Connect procstat(1) to the build. 2007-12-02 23:32:03 +00:00
Robert Watson
3d91be41d1 Add procstat(1), a process inspection utility. This provides both some
of the missing functionality from procfs(4) and new functionality for
monitoring and debugging specific processes.  procstat(1) operates in
the following modes:

  -b  Display binary information for the process.
  -c  Display command line arguments for the process.
  -f  Display file descriptor information for the process.
  -k  Display the stacks of kernel threads in the process.
  -s  Display security credential information for the process.
  -t  Display thread information for the process.
  -v  Display virtual memory mappings for the process.

Further revision and modes are expected.

Testing, ideas, etc:	cognet, sam, Skip Ford <skip at menantico dot com>
			Wesley Shields <wxs at atarininja dot org>
2007-12-02 23:31:45 +00:00
Philip Paeps
db3dfd0efa Add a cross-reference to newgrp(1).
Every time I need newgrp, I forget its name but I remember it's like
login for groups - newgrp(1) already cross-references login(1).

MFC after:	2 days
2007-11-30 11:02:36 +00:00
John Birrell
ee8a5fa77d Remove _SOLARIS_C_SOURCE now that it doesn't do anything in FreeBSD
headers. All OpenSolaris compatibility comes via the set of specific
compatibility headers in src/compat/opensolaris and
src/sys/compat/opensolaris.
2007-11-28 22:58:09 +00:00
Max Khon
cb0ed6eefb Fix -jX when makefiles are remade. 2007-11-25 20:43:27 +00:00
Tai-hwa Liang
e7356456ed Nuking the temporary pointer once it is properly tracked in local storage.
This should fix the double free() bug where there's no tailing newline(\n)
character:

	current# echo -n test | tail
	testAssertion failed: (run->magic == ARENA_RUN_MAGIC), function
	arena_dalloc, file /usr/src/lib/libc/stdlib/malloc.c, line 2448.
	Abort (core dumped)

Reviewed by:	kib
MFC after:	3 days
2007-11-22 01:51:46 +00:00
John Birrell
0aad0f2282 These are the things that the tinderbox has problems with because it
doesn't use the default CFLAGS which contain -fno-strict-aliasing.

Until the code is cleaned up, just add -fno-strict-aliasing to the
CFLAGS of these for the tinderboxes' sake, allowing the rest of the
tree to have -Werror enabled again.
2007-11-20 02:07:30 +00:00
John Birrell
844b78330c Generate code that doesn't fail gcc 4.2's strict aliasing test. 2007-11-20 01:46:12 +00:00
John Birrell
13959da95c Reduce the WARNS levels in a couple of places so that we can enable
-Werror at higher WARNS levels like we did before gcc4 was imported.
2007-11-18 00:29:36 +00:00
John Birrell
dd43ab7d9b Use variable types which match the function prototypes. 2007-11-17 23:21:38 +00:00
Xin LI
423c5ce59d Resolve conflicts; Update defines.h to reflect latest change. 2007-11-16 22:24:31 +00:00
Stefan Eßer
e291efbd86 Fix (uncritical) potential buffer overflow: the length of "buf" was not
extended when "jaiL" was added to fmt_flags().
MFC after:	1 week
2007-11-15 07:31:11 +00:00
Ruslan Ermilov
95d0af0c53 - Steal short description from POSIX; it's more technical and was
easier to translate.
- Fix some markup nits.
2007-11-13 11:34:20 +00:00
John Baldwin
a4cc298ac9 write(1) needs to strip off the leading /dev/ from the tty name for the
current tty as returned from ttyname(3) so it can try to avoid writing to
the current tty if possible.  Previously, it did this by trimming off any
leading directory (effectively performing a basename(3) on the path
returned from ttyname(3)).  However, this chopped off too much of the path
for ttys who have directories in their name such as pts(4).  Instead, just
strip off the leading /dev/ from the path returned by ttyname(3).  This
fixes write(1) when using pts(4).

MFC after:	1 week
Reported by:	rwatson
2007-11-12 20:02:21 +00:00
Ruslan Ermilov
bf2105c4a9 Fix a typo. 2007-11-09 16:31:47 +00:00
Ruslan Ermilov
0cf4978129 - Fix documentation to match code. Specifically, -c doesn't have
to be specified together with either -u or -t to have an effect,
  and exit status of 2 is not possible after a Perl->C conversion.

- While here, fix markup.
2007-11-09 16:02:10 +00:00
Ruslan Ermilov
b8272c9193 Fix numerous bugs when parsing options and arguments. 2007-11-09 15:14:08 +00:00
Diomidis Spinellis
e7d538131d Use static storage-class specifier where appropriate.
Found by: CScout
2007-11-08 11:13:03 +00:00
Diomidis Spinellis
c14530c701 Make function's definition follow its declared visibility.
Found by: CScout
2007-11-08 09:09:02 +00:00
Diomidis Spinellis
a511e63958 Fix visibility of "inplace".
Found by: CScout
2007-11-08 08:57:51 +00:00
Kevin Lo
d4c16fe37d setenv(3) sets errno on failure, use warn() instead
Pointed out by: ru
2007-11-08 01:24:31 +00:00
Rong-En Fan
e0350ca8f5 - Include runefile.h for _CACHED_RUNES 2007-11-07 14:46:22 +00:00
Ruslan Ermilov
b328ef0eba Markup nits. 2007-11-07 07:59:38 +00:00
Ruslan Ermilov
10f9229070 Fix markup. 2007-11-07 07:56:57 +00:00
Kevin Lo
ee8f97394e Check return value for setenv() 2007-11-06 10:35:50 +00:00
Ulf Lilleengen
eec1c21f61 - Add ZFS-support to fstat(1). This allows ZFS-filsystems to be including in
the open file-listing. It is added as a separate source file, so it can
  respect WITH_/WITHOUT_CDDL as compile-flags.
- The warnlevel of the Makefile was decreased to quell solaris #pragma
  warnings.
- Expect that fstat(1) doesn't work with kernel compiled with
  DEBUG_VFS_LOCKS/DEBUG_LOCKS for now.

Approved by:	pjd (mentor)
2007-11-05 23:15:03 +00:00
Philippe Charnier
f8c2d2bde1 initialize variables, WARNS=6 compliant 2007-11-02 18:06:51 +00:00
Ruslan Ermilov
46122f64a6 Markup revision. 2007-11-02 12:07:07 +00:00
Henrik Brix Andersen
b58389792d Add my birthday to the calendar.
Approved by:	erwin (mentor)
2007-11-01 21:56:09 +00:00
Ruslan Ermilov
8931e1d50e Also fix a "blank line" issue that sneaked in from rev. 1.19.
Submitted by:	John Hein
2007-10-31 19:26:01 +00:00
Yaroslav Tykhiy
7773f5ddf9 Give more details on the following topics:
o How global, command-line, and environment variables relate.
o What peculiarities the -f option has WRT ${MAKEFLAGS}.
2007-10-31 08:20:09 +00:00
Ruslan Ermilov
de8f7dcbae Remove newly acquired hard sentence breaks. 2007-10-30 19:23:42 +00:00
Ruslan Ermilov
65717f952e Apply style(9) to usage(), fix markup of the manpage. 2007-10-30 17:49:00 +00:00
Kevin Lo
0f10497bce Never use getenv("HOME") without checking for NULL and non-zero
Obtained from: OpenBSD
2007-10-30 03:44:10 +00:00
Julian Elischer
7ab24ea3b9 Introduce a way to make pure kernal threads.
kthread_add() takes the same parameters as the old kthread_create()
plus a pointer to a process structure, and adds a kernel thread
to that process.

kproc_kthread_add() takes the parameters for kthread_add,
plus a process name and a pointer to a pointer to a process instead of just
a pointer, and if the proc * is NULL, it creates the process to the
specifications required, before adding the thread to it.

All other old kthread_xxx() calls return, but act on (struct thread *)
instead of (struct proc *). One reason to change the name is so that
any old kernel modules that are lying around and expect kthread_create()
to make a process will not just accidentally link.

fix top to show  kernel threads by their thread name in -SH mode
add a tdnam formatting option to ps to show thread names.

make all idle threads actual kthreads and put them into their own idled process.
make all interrupt threads kthreads and put them in an interd process
(mainly for aesthetic and accounting reasons)
rename proc 0 to be 'kernel' and it's swapper thread is now 'swapper'

man page fixes to follow.
2007-10-26 08:00:41 +00:00
Ulf Lilleengen
26e4ee3b41 - Add my birthday to the calendar.
Approved by:	kib (mentor)
2007-10-25 19:35:09 +00:00
David E. O'Brien
149d554ac8 The AWK 23-Oct-2007 release includes fixes for FreeBSD PR's bin/104795
and bin/100443.
2007-10-25 12:43:22 +00:00
Ruslan Ermilov
4f6d329f1e - Convert NO_INSTALLLIB option to a new syntax: makefiles should
test MK_INSTALLLIB, users can set WITHOUT_INSTALLLIB.  The old
  NO_INSTALLLIB is still supported as several makefiles set it.

- While here, fix an install when instructed not to install libs
  (usr.bin/lex/lib/Makefile).

PR:		bin/114200
Submitted by:	Henrik Brix Andersen
2007-10-20 19:01:50 +00:00