Commit Graph

10873 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav
011a8335f8 mdoc nit 2013-07-21 07:24:25 +00:00
Pawel Jakub Dawidek
de89bd6bc2 Close uniq(1) in the capability mode sandbox and limit descriptors using
capability rights.
2013-07-18 22:11:27 +00:00
Pawel Jakub Dawidek
e14da991ec - Make localtime(3) to work in sandbox.
- Move strerror(3) initialization to its own function.
2013-07-18 21:56:10 +00:00
Gleb Smirnoff
c780f37850 Sweep unused nlist entries.
Sponsored by:	Nginx, Inc.
2013-07-16 12:22:36 +00:00
Gleb Smirnoff
2898a92a21 Nuke "systat -mbuf". It was broken since FreeBSD 5, and since there
haven't been any complaints, no one used it.
2013-07-15 12:15:14 +00:00
Andrey V. Elsukov
05d1f5bce0 Introduce new structure sfstat for collecting sendfile's statistics
and remove corresponding fields from struct mbstat. Use PCPU counters
and SFSTAT_INC() macro for update these statistics.

Discussed with:	glebius
2013-07-15 06:16:57 +00:00
Hiroki Sato
3fddef95af Add -F fibnum option to specify an FIB number for -r flag. 2013-07-12 17:11:30 +00:00
David Chisnall
3334a61716 Report error for out-of-range numerical inputs. Requested by brooks. 2013-07-10 10:57:09 +00:00
Andrey V. Elsukov
db8c087944 Migrate structs ahstat, espstat, ipcompstat, ipipstat, pfkeystat,
ipsec4stat, ipsec6stat to PCPU counters.
2013-07-09 10:08:13 +00:00
Andrey V. Elsukov
69edf037d7 Migrate struct carpstats to PCPU counters. 2013-07-09 10:02:51 +00:00
Andrey V. Elsukov
a786f67981 Migrate structs ip6stat, icmp6stat and rip6stat to PCPU counters. 2013-07-09 09:54:54 +00:00
Andrey V. Elsukov
5b7cb97c2b Migrate structs arpstat, icmpstat, mrtstat, pimstat and udpstat to PCPU
counters.
2013-07-09 09:50:15 +00:00
Andrey V. Elsukov
5da0521fce Use new macros to implement ipstat and tcpstat using PCPU counters.
Change interface of kread_counters() similar ot kread() in the netstat(1).
2013-07-09 09:43:03 +00:00
Andrey V. Elsukov
c80211e3cf Prepare network statistics structures for migration to PCPU counters.
Use uint64_t as type for all fields of structures.

Changed structures: ahstat, arpstat, espstat, icmp6_ifstat, icmp6stat,
in6_ifstat, ip6stat, ipcompstat, ipipstat, ipsecstat, mrt6stat, mrtstat,
pfkeystat, pim6stat, pimstat, rip6stat, udpstat.

Discussed with:	arch@
2013-07-09 09:32:06 +00:00
Kevin Lo
ed74b69c2d Remove unnecessary cast to pid_t. 2013-07-04 03:24:58 +00:00
David E. O'Brien
6d85e39be1 Merge r252513 from src/gnu/usr.bin/patch into src/usr.bin/patch:
Properly handle input lines containing NUL characters such that pgets()
accurately fills the read buffer.

Callers of pgets() still mis-process the buffer contents if the read line
contains NUL characters, but this at least makes pgets() accurate.
2013-07-03 22:46:30 +00:00
David E. O'Brien
0571fd57a1 Merge r252512 from src/gnu/usr.bin/patch into src/usr.bin/patch:
Make it so that 'patch < FUBAR' and 'patch -i FUBAR' operate the same.

The former makes a copy of stdin, but was not accurately putting the
content of stdin into a temp file.  This lead to the undercounting
the number of lines in hunks containing NUL characters when reading
from stdin.  Thus resulting in "unexpected end of file in patch" errors.
2013-07-03 22:44:26 +00:00
Pawel Jakub Dawidek
d7499324a8 Few more style nits.
MFC after:	1 month
2013-07-03 20:44:47 +00:00
Pawel Jakub Dawidek
7c33a30a7a Sandbox rwho(1) using capability mode and Capsicum capabilities.
rwho(1) gets only read-only access to /var/rwho/ directory.

Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>
Sponsored by:	Google Summer of Code 2013
Reviewed by:	pjd
MFC after:	1 month
2013-07-03 20:42:10 +00:00
Pawel Jakub Dawidek
c05bfdd395 Style cleanups.
Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>
Sponsored by:	Google Summer of Code 2013
Reviewed by:	pjd
MFC after:	1 month
2013-07-03 20:28:33 +00:00
Peter Wemm
7900abff04 As a followup to r252547, propate const down the call stack. 2013-07-03 18:27:45 +00:00
Peter Wemm
33e7ec3e83 Attempt to deal with a compile failure that shows up with gcc, which
has -Werror on.  Without this, yylex() is inconsistently or redundantly
defined.
2013-07-03 18:25:27 +00:00
Peter Wemm
0d5daade6d If you've compiled your base system with WITH_ICONV, then use it for svn
alongside the other consumers (bsdtar, csh etc).

The svnlite build gets upset when it hits non-ascii characters in
inconvenient places.
2013-07-01 07:07:35 +00:00
Peter Wemm
e513819332 Update to current configuration. 2013-07-01 07:00:12 +00:00
Mateusz Guzik
214e08782b killall: add -q flag to suppress error message when no processes are matched
Man-page text provided by wblock.

PR:		bin/30542
Submitted by:	Tony Finch <dot@dotat.at> (original version)
MFC after:	1 week
2013-06-30 20:27:31 +00:00
Mateusz Guzik
8f99c21f94 truss: recognize O_DIRECTORY, O_EXEC, O_TTY_INIT and O_CLOEXEC
MFC after:	3 days
2013-06-30 13:14:46 +00:00
Hiren Panchasara
0536a9b831 Adding myself to the calendar!
Approved by:	sbruno (mentor)
2013-06-30 01:20:59 +00:00
Tim Kientzle
ad4422d3cd Enable svnlite on armv6. 2013-06-29 15:31:23 +00:00
Davide Italiano
237abf0c56 - Trim an unused and bogus Makefile for mount_smbfs.
- Reconnect with some minor modifications, in particular now selsocket()
internals are adapted to use sbintime units after recent'ish calloutng
switch.
2013-06-28 21:00:08 +00:00
Pedro F. Giffuni
1a2a4fc8ce sed: use getline() instead of fgetln().
In BSD, fgetln() available in libc but in Illumos the Solaris port had to
include it internally. It also seems to have caused problems [1].

Aid portability by using getline() instead.

Reference:
https://www.illumos.org/issues/3820 [1]

Submitted by:	Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.com>
Reviewed by:	dds
MFC after:	2 weeks
2013-06-26 04:14:19 +00:00
Mark Felder
87230f6c4b - Adding myself to the committers-ports.dot
- Adding myself to the freebsd calendar

Approved by: swills (mentor)
2013-06-26 02:21:37 +00:00
Peter Wemm
4cc6982f98 Only enable svn on amd64/ia64/sparc64/i386. 2013-06-20 02:26:32 +00:00
Don Lewis
89f5f8a61e Fix a couple of typos that broke buildworld for me.
Reviewed by:	peter
2013-06-19 19:44:57 +00:00
Peter Wemm
982a0f2d8a Bandaid: mips doesn't seem to have the full set of atomics builtins. I
will investigate more.
2013-06-19 02:16:04 +00:00
Peter Wemm
5431bd0230 Tweak generated config to make it more likely to work on 32 bit systems.
Pointed out by:	Trond.Endrestol@fagskolen.gjovik.no
2013-06-18 16:05:33 +00:00
David Chisnall
95b63ba99b Fix bug in destructor for checker manager in DTC that caused segfaults on
exit.
2013-06-18 10:26:22 +00:00
Peter Wemm
937a200089 Introduce svnlite so that we can check out our source code again.
This is actually a fully functional build except:
* All internal shared libraries are static linked to make sure there
  is no interference with ports (and to reduce build time).
* It does not have the python/perl/etc plugin or API support.
* By default, it installs as "svnlite" rather than "svn".
* If WITH_SVN added in make.conf, you get "svn".
* If WITHOUT_SVNLITE is in make.conf, this is completely disabled.

To be absolutely clear, this is not intended for any use other than
checking out freebsd source and committing, like we once did with cvs.

It should be usable for small scale local repositories that don't
need the python/perl plugin architecture.
2013-06-18 02:53:45 +00:00
Eitan Adler
702a1889cc Fix header guards.
This was ready about the same time as r251862 so just make one final cleanup

Submitted by:	dt71@gmx.com
2013-06-17 20:15:39 +00:00
Sergey Kandaurov
77b2b60dcf Clean up -Wheader-guard warnings.
Submitted by:	<dt71@gmx.com>
MFC after:	3 days
X-MFC with:	r251848
2013-06-17 20:11:04 +00:00
David Chisnall
e29c18df28 Add a checker to dtc, based on a feature request from rwatson / brooks.
This checks that every node that has children specifies their register sizes.
This is not enabled by default, as the default sizes are sometimes required
(including by some DTS in the tree), but can help when writing new device
trees so that you can check that you actually meant the defaults.
2013-06-17 15:34:22 +00:00
Ruslan Makhmatkhanov
a9536ef606 - add myself 2013-06-17 04:00:46 +00:00
Greg Lehey
13b01d1d47 Revert revision 251648. style(9) requires an empty line here.
Reported by:	mdf@
2013-06-13 04:11:21 +00:00
Dimitry Andric
284c197886 Upgrade our copy of llvm/clang to 3.3 release.
Release notes are still in the works, these will follow soon.

MFC after:	1 month
2013-06-12 18:48:53 +00:00
Greg Lehey
33d6ebecd5 style(9)
MFC after:	2 weeks
2013-06-12 07:53:59 +00:00
Greg Lehey
90c72ba909 Handle some expression regressions.
Explicitly use GNU cpp for preprocessing.
Remove explicit debugging code.
Change some variable names to be less confusing.
Improve some comments.
Improve indentation.

PR:		162211
		168785
MFC after:	2 weeks
2013-06-12 07:52:49 +00:00
John Baldwin
49e3bde165 Bump the CPU/WCPU column width by one so that it fits values from 100% up
to 999.99% CPU.  It still won't be aligned if you have a multithreaded
process using more than 1000% CPU (e.g. idle process on an idle 12-way
system), but 100% is a common case.

Submitted by:	Jeremy Chadwick (partial)
MFC after:	1 week
2013-06-11 19:05:29 +00:00
Rick Macklem
7c44c1146b Modify nfsstat.c so that it prints out an error when a non-root
user attempts to use the "-m" option and it fails.

Requested by:	danny@cs.huji.ac.il
MFC after:	2 weeks
2013-06-09 21:54:19 +00:00
Hiroki Sato
c0f826e652 - Add file system type number (vfc_typenum) in the list. This is useful
for debugging when changing vfs.typenumhash configuration.
- Refactor fmt_flags().

MFC after:	1 week
2013-06-09 16:33:32 +00:00
Jaakko Heinonen
849d265d53 Print file names without stdio buffering to avoid mixing buffered and
unbuffered ouput.

PR:		bin/176886
Reviewed by:	mjg
2013-06-09 08:06:26 +00:00
Andrey V. Elsukov
b9ef8051ae Use getnameinfo(3) instead of inet_ntop(3) to make printable versions of
sockaddr_in6 structures. getnameinfo(3) does the same thing, but it is
also able to represent a scope zone id as described in the RFC 4007.

MFC after:	2 weeks
2013-06-07 08:06:48 +00:00
Jung-uk Kim
ee852b9c75 Adjust CFLAGS to pick up correct regex.h and posix/regex.h. Note this
actually reverts r250860 and r250861.

Reported by:	gjb, tinderbox
2013-06-06 11:59:38 +00:00
Brooks Davis
78229472cf New install flags were merged to 9-STABLE and will appear in FreeBSD-9.2.
Sponsored by:	DARPA, AFRL
Submitted by:	ru
MFC after:	3 days
2013-06-05 17:02:21 +00:00
Simon J. Gerraty
74d2e02b85 Update to bmake-20130604 to fix file descriptor leak. 2013-06-05 16:12:50 +00:00
Joel Dahl
580dbd6574 mdoc: convert .Fd to .In, which is much nicer. 2013-06-04 07:37:06 +00:00
Eitan Adler
a96469b791 Correct check to see if file changes.
Reported by:	swildner@DragonFlyBSD.org
Reviewed by:	des
2013-06-02 18:10:07 +00:00
Gabor Kovesdan
c859c6dd54 - Update Oleg Moskalenko's email address
Requested by:	Oleg Moskalenko <mom040267@gmail.com>
2013-06-02 09:43:48 +00:00
Pawel Jakub Dawidek
d2c9ca44c3 If the -r option is given we cannot enter capability mode.
The option tells kdump to convert numeric UIDs and GIDs into user and
group names plus to convert times and dates into locallized versions.
This all needs opening various files at various occasions.
2013-05-30 21:59:29 +00:00
Pawel Jakub Dawidek
f9b20fc804 MFp4 @229086:
Make use of Capsicum to protect kdump(1), as it might be used to parse data
from untrusted sources:

- Sandbox kdump(1) using capability mode.
- Limit stdin descriptor (where opened file is moved to) to only
  CAP_READ and CAP_FSTAT rights.
- Limit stdout descriptor to only CAP_WRITE, CAP_FSTAT and CAP_IOCTL.
  Plus limit allowed ioctls to TIOCGETA only, which is needed for
  isatty() to work.
- Limit stderr descriptor to only CAP_WRITE and CAP_FSTAT. In addition
  if the -s option is not given, grant CAP_IOCTL right, but allow for
  TIOCGWINSZ ioctl only, as we need screen width to dump the data.
- Before entering capability mode call catopen("libc", NL_CAT_LOCALE),
  which opens message catalogs and caches data, so that strerror(3)
  and strsignal(3) can work in a sandbox.

Sponsored by:	The FreeBSD Foundation
Discussed with:	rwatson
2013-05-28 21:25:28 +00:00
Pawel Jakub Dawidek
4b0ae51212 MFp4 @229085:
Rearrange the code so we don't call ioctl(TIOCGWINSZ) if the -s option is given,
as the result won't be used then.

Sponsored by:	The FreeBSD Foundation
2013-05-28 21:21:46 +00:00
Ed Schouten
af8e44c84a Prevent shadowing.
The name line_number seems to be used as a function parameter name for
one of the Lex functions. Change the name to linenumber.
2013-05-25 15:36:15 +00:00
Glen Barber
ffca5883e8 Revert r250972 to fix build. 2013-05-25 07:17:16 +00:00
Stefan Eßer
2360cb0eea The error handling for writes to the target file could lead to the final
fclose() being skipped. Fix this by using boolean "&" and "|" instead of
short-cut operators "&&" and "||".
While here, increment the last part of the version string. The reason is
the fixed output file selection logic in pch.c, which was committed as
r250943, yesterday.

Reviewed by:	pfg
2013-05-24 18:54:52 +00:00
Stefan Eßer
6b239879f8 Fix target selection logic, which did not comply with the man page.
Instead of using the file with the least order of path name components,
shortest filename and finally the shortest basename (with the search
stopping as soon as one of these conditions is true), the first filename
checked was used as the reference, and another filename was only selected
if all of the above comparisons are in favour of the latter file.

This was wrong, because filenames with path less components were only
considered, if both of the other conditions were true as well. In fact,
the first filename to be checked had good chances to be selected in the
end, since it only needed to be better with regard to any one of the
three criteria ...

Reviewed by:	delphij@freebsd.org
2013-05-23 20:57:20 +00:00
Guy Helmer
08ad1a7ac6 Add support for netgroup, based on patch in the PR but made consistent
with existing style.

PR:		bin/132692
2013-05-23 20:52:30 +00:00
Ed Schouten
b94c7c3e21 Let iconv build on -HEAD properly.
- Add NO_WMISSING_VARIABLE_DECLARATIONS where we use Yacc/Lex.
- Add variable declarations where possible.
- Add missing static keyword.
2013-05-23 18:07:01 +00:00
Jung-uk Kim
9c5a52cf88 Work around build breakages with GCC 4.2.
Reported by:	tinderbox
2013-05-23 05:42:35 +00:00
Eitan Adler
89c5c3aab8 Avoid signed overflow in error handling code.
Reviewed by:	cperciva, bjk
2013-05-21 19:56:03 +00:00
Jung-uk Kim
ab76bc977a Connect flex 2.5.37 to the build and bump __FreeBSD_version. 2013-05-21 19:32:35 +00:00
Simon J. Gerraty
52d8625616 Sync with upstream version (20130520) that includes same fixes made last week. 2013-05-20 22:51:11 +00:00
Simon J. Gerraty
3c1c0edeef Per the comment, we cannot rely on bsd.own.mk
we could be on an old system that knows noting of MK_BMAKE
or on an almost up to date one that is defaulting it to "no"
neither of which will work.
2013-05-17 22:18:27 +00:00
Simon J. Gerraty
8ebb983529 We really need to get the bsd.own.mk from this tree so the
correct options are set.
Also defined NO_PWD_OVERRIDE to match behavior of fmake.
2013-05-17 19:37:16 +00:00
Xin LI
f26784139f guard against MK_SHARED_TOOLCHAIN not being defined. 2013-05-16 22:35:33 +00:00
Xin LI
ac2c0328ca Similar to r250719: guard against MK_BMAKE not being defined. 2013-05-16 22:25:17 +00:00
Simon J. Gerraty
4c67ba2c7b Reverse the sense of the test wrt bmake, and guard against
MK_BMAKE not being defined.
2013-05-16 21:26:46 +00:00
Simon J. Gerraty
3ddfb24d3a Build bmake by default.
If someone explicitly builds usr.bin/make while MK_BMAKE==yes,
install it as 'fmake'.

Reviewed by:	brooks
2013-05-16 15:28:38 +00:00
Joel Dahl
2710751bc3 mdoc sweep. 2013-05-12 22:22:12 +00:00
Antoine Brodin
290b7b224a Add some missing DPADD. 2013-05-11 13:46:05 +00:00
Xin LI
4262755097 REST IN PEACE
Alexander Botero-Lowry

Born June 2, 1986 in Austin, Texas
Died August 24, 2012 in San Francisco, California

Thank you for your contributions, you will be
greatly missed.
2013-05-10 20:02:15 +00:00
Eitan Adler
b5be420a7c Add option to lockf to avoid creating a file if it does not exist.
PR:	bin/170775
Submitted by:	Matthew Story <matthewstory@gmail.com>
Reviewed by:	scottl
MFC after:	1 week
2013-05-10 17:30:29 +00:00
Eitan Adler
a93b9b7d11 Bump .Dd for recent content change.
Reported by:	delphij
2013-05-10 12:49:16 +00:00
Eitan Adler
7f418e3407 Implement 'split -d' which allows a numeric suffix instead of an
alphabetic one.

PR:		bin/116209
Submitted by:	Marcin Gryszkalis <mg@fork.pl> (adapted from)
Reviewed by:	will
MFC after:	1 week
2013-05-10 04:23:03 +00:00
Eitan Adler
a274be7720 Style(9) changes fo xargs.c 2013-05-10 03:49:05 +00:00
Jung-uk Kim
a7880d59c9 Improve compatibility with recent flex from flex.sourceforge.net. 2013-05-03 23:51:32 +00:00
Jung-uk Kim
8ce3644c91 Reduce diff with upstream. 2013-05-03 23:29:38 +00:00
John Baldwin
958aa57537 Similar to 233760 and 236717, export some more useful info about the
kernel-based POSIX semaphore descriptors to userland via procstat(1) and
fstat(1):
- Change sem file descriptors to track the pathname they are associated
  with and add a ksem_info() method to copy the path out to a
  caller-supplied buffer.
- Use the fo_stat() method of shared memory objects and ksem_info() to
  export the path, mode, and value of a semaphore via struct kinfo_file.
- Add a struct semstat to the libprocstat(3) interface along with a
  procstat_get_sem_info() to export the mode and value of a semaphore.
- Teach fstat about semaphores and to display their path, mode, and value.

MFC after:	2 weeks
2013-05-03 21:11:57 +00:00
Edwin Groothuis
3b48e348d5 Op 30 April 2013 trad koninging Beatrix af en werd kroonprins Willem
Alexander de nieuwe koning. Koningsdag is op 27 April.

On 30 April 2013 queen Beatrix resigned and crownprince Willem
Alexander became the new king. King's day is on 27 April.

MFC after:	1 week
2013-05-03 02:03:35 +00:00
Rick Macklem
af3ed447c5 Document that the NFSv4 server statistics are operation counts and
not RPC counts.
This is a content change.

MFC after:	2 weeks
2013-05-01 22:16:29 +00:00
Eitan Adler
b4634967f0 When the world is built WITHOUT_OPENSSH also don't
install ssh-copy-id.

PR:		misc/177590
Submitted by:	Oleg Ginzburg <olevole@olevole.ru>
Reviewed by:	imp
2013-04-28 17:58:11 +00:00
Joel Dahl
927853b45c Fix EXIT STATUS. biff reports its status when it was invoked.
Submitted by:	Ryan Kavanagh,
		Jason McIntyre <jmc@kerhand.co.uk>
Obtained from:	OpenBSD
2013-04-28 09:29:44 +00:00
Eitan Adler
b268ae6440 Constify where appropriate.
Reported by:	emaste
Approved by:	cperciva (mentor)
MFC After:	3 days
2013-04-23 13:03:17 +00:00
Eitan Adler
4145c5f17e Cleanups to touch.c
- use const where appropriate
	- use static where appropriate
	- use explicit checks checks for error conditions

Reviewed by:	sbruno
Approved by:	cperciva (mentor)
Obtained by:	DragonFlyBSD
2013-04-23 13:03:14 +00:00
Mikolaj Golub
e344fb0222 Wrong cast.
MFC after:	1 month
2013-04-20 15:37:33 +00:00
Mikolaj Golub
7fe6d16ef9 Sync gcore(1) with the recent changes in kernel code aimed at adding
procstat notes to a process core file.

Suggested by:	jhb
MFC after:	1 month
2013-04-20 08:23:19 +00:00
Mikolaj Golub
948baa409b Make use of newly added libprocstat(3) ability to extract procstat
info from a process core file.

So now one can run procstat(1) on a process core e.g. to get a list of
files opened by a process when it crashed:

root@lisa:/ # procstat -f /root/vi.core
  PID COMM               FD T V FLAGS     REF  OFFSET PRO NAME
  658 vi               text v r r--------   -       - -   /usr/bin/vi
  658 vi               ctty v c rw-------   -       - -   /dev/pts/0
  658 vi                cwd v d r--------   -       - -   /root
  658 vi               root v d r--------   -       - -   /
  658 vi                  0 v c rw-------  11    3208 -   /dev/pts/0
  658 vi                  1 v c rw-------  11    3208 -   /dev/pts/0
  658 vi                  2 v c rw-------  11    3208 -   /dev/pts/0
  658 vi                  3 v r r----n-l-   1       0 -   /tmp/vi.0AYKz3Lps7
  658 vi                  4 v r rw-------   1       0 -   /var/tmp/vi.recover/vi.GaGYsz
  658 vi                  5 v r rw-------   1       0 -   -

PR:		kern/173723
Suggested by:	jhb
MFC after:	1 month
2013-04-20 08:22:09 +00:00
Mikolaj Golub
d86fa0c72c Use procstat_getkstack(3) for retrieving process kernel stacks
instead of direct sysctl calls.

MFC after:	1 month
2013-04-20 08:19:06 +00:00
Mikolaj Golub
61e1b7c67b Use libprocstat(3) to retrieve ELF auxiliary vector.
MFC after:	1 month
2013-04-20 08:15:43 +00:00
Mikolaj Golub
729e63c34b Use libprocstat(3) to retrieve process command line arguments and
environment variables.

MFC after:	1 month
2013-04-20 08:08:29 +00:00
Mikolaj Golub
66e2f9998b Use libprocstat(3) when retrieving binary information for a process.
MFC after:	1 month
2013-04-20 08:05:04 +00:00
Mikolaj Golub
21b4f75a2c Use procstat_getrlimit(3) for retrieving rlimit information instead of
direct sysctl calls.

MFC after:	1 month
2013-04-20 08:01:00 +00:00
Mikolaj Golub
90a15eb9cb Use procstat_getumask(3) for retrieving umaks information instead of
direct sysctl.

MFC after:	1 month
2013-04-20 07:58:20 +00:00
Mikolaj Golub
e40d6078cd Use procstat_getgroups(3) for retrieving groups information instead of
direct sysctl.

MFC after:	1 month
2013-04-20 07:55:31 +00:00
Mikolaj Golub
eee7107cfb Use more generic procstat_getvmmap(3) for retrieving VM layout of a process.
MFC after:	1 month
2013-04-20 07:52:23 +00:00
Mikolaj Golub
efade1503b Use procstat_getprocs(3) for retrieving thread information instead of
direct sysctl calls.

MFC after:	1 month
2013-04-20 07:50:59 +00:00
Ed Schouten
7e659f9491 Add the Clang specific -Wmissing-variable-declarations to WARNS=6.
This compiler flag enforces that that people either mark variables
static or use an external declarations for the variable, similar to how
-Wmissing-prototypes works for functions.

Due to the fact that Yacc/Lex generate code that cannot trivially be
changed to not warn because of this (lots of yy* variables), add a
NO_WMISSING_VARIABLE_DECLARATIONS that can be used to turn off this
specific compiler warning.

Announced on:	toolchain@
2013-04-19 19:45:00 +00:00
Andrey V. Elsukov
b543f3b167 Replace hardcoded numbers. Also use interface-local scope name instead
of node-local.
2013-04-16 11:25:45 +00:00
Joel Dahl
74dbdd24b9 Fix typo from previous commit.
Submitted by:	Ronald Klop <ronald-freebsd8@klop.yi.org>
2013-04-14 08:49:35 +00:00
Joel Dahl
67a07ea1bf LSD first synthesised 16/11/38, not 7/4/43.
Submitted by:	James J. Lippard
Obtained from:	OpenBSD
2013-04-14 08:47:01 +00:00
Joel Dahl
6857ced81d Correct spelling is "Christiaan Huygens".
Submitted by:	James J. Lippard
Obtained from:	OpenBSD
2013-04-14 08:40:24 +00:00
Dimitry Andric
139f7f9bf5 Upgrade our copy of llvm/clang to trunk r178860, in preparation of the
upcoming 3.3 release (branching and freezing expected in a few weeks).

Preliminary release notes can be found at the usual location:
<http://llvm.org/docs/ReleaseNotes.html>

An MFC is planned once the actual 3.3 release is finished.
2013-04-12 17:57:40 +00:00
Pietro Cerutti
1a47f28b71 - Do not bail out if stat(2) fails with ENOENT in the spool directory. This
happens if another atrm process removes a job while we're scanning through
  the directory.
- While at it, optimize a bit the directory scanning, so that we quit looping
  as soon as all jobs specified in argv have been dealt with.

Approved by:	cognet
2013-04-12 14:32:16 +00:00
Pietro Cerutti
b9e6237dab - Switch order of setting real uid and gid. If we set uid first, then we
don't have enough privileges to set gid.

  This looks like a long standing bug, just recently revealed by r241852.

Approved by:	cognet
2013-04-12 14:19:44 +00:00
Kenneth D. Merry
5e79631638 Fix bugs in the elapsed time calculation in ctlstat_standard()
pointed out by bde:

- Casting to long double isn't needed.
- The division isn't needed, multiplication can be used.
  "When 1 nanosecond is in a floating point literal, the whole
  expression is automatically promoted correctly."
- non-KNF indentation (1 tab) for the newly split line
- different non-KNF indentation (5 spaces) for the previously split
  line
- exessive parentheses around the division operation
- bogus blank line which splits up the etime initialization
- general verboseness from the above.

Submitted by:	bde
MFC after:	3 days
2013-04-11 21:18:04 +00:00
Joel Dahl
2063b2c09b Minor spelling and grammar fixes. 2013-04-11 19:05:24 +00:00
Joel Dahl
b1edef175b Remove contractions. 2013-04-11 18:46:41 +00:00
Eitan Adler
680b190c84 fuser(1) requires a filename.
Reviewed by:	lstewart
Approved by:	bcr (mentor)
MFC after:	3 days
2013-04-11 12:24:29 +00:00
Gleb Smirnoff
29dde48df4 Use kvm_counter_u64_fetch() to fix obtaining ipstat and tcpstat from
kernel core files.

Sponsored by:	Nginx, Inc.
2013-04-10 20:29:23 +00:00
Kenneth D. Merry
ffc3b12c07 Fix a time calculation error in ctlstat_standard().
ctlstat.c:	When converting a timeval to a floating point
		number in ctlstat_standard(), cast the nanoseconds
		calculation to a long double, so we don't lose
		precision.  Without the cast, we wind up with a
		time in whole seconds only.

Sponsored by:	Spectra Logic
MFC after:	3 days
2013-04-10 16:01:45 +00:00
Gleb Smirnoff
5923c29332 Merge from projects/counters: TCP/IP stats.
Convert 'struct ipstat' and 'struct tcpstat' to counter(9).

  This speeds up IP forwarding at extreme packet rates, and
makes accounting more precise.

Sponsored by:	Nginx, Inc.
2013-04-08 19:57:21 +00:00
Jaakko Heinonen
67e09bb94c Correct the path.
PR:		176256
Submitted by:	jhs
2013-04-06 13:42:37 +00:00
William Grzybowski
6678108f37 Add myself as a ports committer and my mentor relationship.
While in the repository, add myself to calendar.freebsd.

Approved by:	jpaetzel (mentor)
2013-04-04 23:11:56 +00:00
Simon J. Gerraty
1748de26cb Update to bmake-20130330 2013-04-02 21:31:11 +00:00
Edward Tomasz Napierala
325621458d Make it possible to build CTL as a module.
Reviewed by:	ken
Sponsored by:	FreeBSD Foundation
2013-04-02 09:42:42 +00:00
Tony Finch
31f5980bd9 Update to upstream version 2.7
The most notable new feature is support for processing multiple
files in one invocation. There is also support for more make-friendly
exit statuses.

The most notable bug fix is #line directives now include the input
file name.

Obtained from: http://dotat.at/prog/unifdef
2013-03-28 20:33:07 +00:00
Alexander Motin
8d2419b571 Make systat -vmstat to use suffixes to display big floating point numbers
that are not fitting into the specified field width, same as done for ints.
In particular that allows to properly display disk tps above 100k, that are
reachable with modern SSDs.
2013-03-23 13:11:54 +00:00
Martin Matuska
acc60b03c1 MFV r248590,248594:
Update libarchive to 3.1.2

Some of new features:
  - support for lrzip and grzip compression
  - support for writing tar v7 format
  - b64encode and uuencode filters
  - support for __MACOSX directory in Zip archives
  - support for lzop compresion (external utility)
2013-03-22 13:36:03 +00:00
Martin Matuska
ebb8fc42be Replace deprecated (or remove obsolete) libarchive 2.8 functions
with libarchive 3.0 counterparts
2013-03-22 10:17:42 +00:00
Jilles Tjoelker
ddd956b0b7 find: Include nanoseconds when comparing timestamps of files.
When comparing to the timestamp of a given file using -newer, -Xnewer and
-newerXY (where X and Y are one of m, c, a, B), include nanoseconds in the
comparison.

The primaries that compare a timestamp of a file to a given value (-Xmin,
-Xtime, -newerXt) continue to compare times in whole seconds.

Note that the default value 0 of vfs.timestamp_precision almost always
causes the nanoseconds part to be 0. However, touch -d can set a timestamp
to the microsecond regardless of that sysctl.

MFC after:	1 week
2013-03-17 22:51:58 +00:00
Joel Dahl
9ca6ee33d0 Remove EOL whitespace accidentally introduced in r248393. 2013-03-17 06:57:25 +00:00
Joel Dahl
d04158c3c6 Move example to EXAMPLES. 2013-03-17 06:36:04 +00:00
Joel Dahl
b16958a100 Add a couple of examples.
Obtained from:	OpenBSD
2013-03-16 22:53:38 +00:00
Sergey Kandaurov
99f23359a5 Fix version in the .Fx macro.
Reported by:	<deeptech71@gmail.com>
2013-03-16 22:37:56 +00:00
Brooks Davis
f1f8908049 Replace our (un)vis(1) commands with implementations from NetBSD to
match our import of the (un)vis(3) APIs.

This adds support for multibyte encoding and the -h and -m flags which
support HTTP and MIME encoding respectively.

PR:		bin/175418
Obtained from:	NetBSD
2013-03-15 00:05:50 +00:00
David E. O'Brien
64508c55f2 No need to call an external program. 2013-03-13 22:50:14 +00:00
Mark Johnston
e16c1e1fd2 Revert r246917, as it is causing incorrect behaviour as reported on
freebsd-current.

PR:		bin/175213
Approved by:	emaste (co-mentor)
2013-03-12 19:18:10 +00:00
John Baldwin
ee66c8b94e Fix the 'C' field for a running thread to match the behavior described
in the manpage by having it display the current CPU (ki_oncpu) rather
than the previously used CPU (ki_lastcpu).  ki_lastcpu is still used for
all other thread states.

Reported by:	Chris Ross <cross+freebsd@distal.com>
MFC after:	1 week
2013-03-11 16:33:05 +00:00
Gleb Smirnoff
2a75563d4a Fix spelling.
PR:		176777
Submitted by:	Andrey Simonenko <simon comsys.ntu-kpi.kiev.ua>
2013-03-11 13:08:32 +00:00
Alexander V. Chernikov
7e4f8ab64a Add forgotten .El
MFC with:	r248112
2013-03-09 20:04:47 +00:00
Alexander V. Chernikov
69cf5b29fd Document netstat -Q flags meaning.
MFC after:	1 week
2013-03-09 20:01:35 +00:00
Attilio Rao
a92189b377 Garbage collect NWFS and NCP bits which are now completely disconnected
from the tree since few months.

This patch is not targeted for MFC.
2013-03-09 12:45:36 +00:00
Olivier Houchard
57fb38ba93 Add arm bits to truss. 2013-03-07 23:44:35 +00:00
Dimitry Andric
d023c5ae25 Make c99(1) invoke /usr/bin/cc with argv[0] set to "/usr/bin/cc" instead
of just "cc", since there is no reason to cause additional path searches
in this case.

MFC after:	3 days
2013-03-07 21:37:23 +00:00
Dimitry Andric
b1bbb41f96 Make c89(1) invoke /usr/bin/cc with argv[0] also set to /usr/bin/cc,
similar to what c99(1) does, to prevent "c89: illegal option -- 1"
messages, when clang is /usr/bin/cc.

Reported by:	tijl
MFC after:	3 days
2013-03-07 21:34:16 +00:00
Eitan Adler
240299864c Fix typo ('1' != 'l')
PR:		bin/175975
Submitted by:	William Ahern <william@25thandclement.com>
Approved by:	cperciva (mentor)
2013-03-04 02:21:06 +00:00
Eitan Adler
fd9593d55a Due to calendar(1)'s abuse of the C preprocessor "unix" gets expanded to
"1".  'Fix' this.

PR:		bin/175790
Submitted by:	ak
Approved by:	cperciva (mentor)
2013-03-04 02:21:03 +00:00
David Malone
9ed0c92c91 Add an option for finding sparse files.
Reviewed by:	iedowse
MFC after:	3 weeks
2013-03-03 20:10:56 +00:00
Pawel Jakub Dawidek
7493f24ee6 - Implement two new system calls:
int bindat(int fd, int s, const struct sockaddr *addr, socklen_t addrlen);
	int connectat(int fd, int s, const struct sockaddr *name, socklen_t namelen);

  which allow to bind and connect respectively to a UNIX domain socket with a
  path relative to the directory associated with the given file descriptor 'fd'.

- Add manual pages for the new syscalls.

- Make the new syscalls available for processes in capability mode sandbox.

- Add capability rights CAP_BINDAT and CAP_CONNECTAT that has to be present on
  the directory descriptor for the syscalls to work.

- Update audit(4) to support those two new syscalls and to handle path
  in sockaddr_un structure relative to the given directory descriptor.

- Update procstat(1) to recognize the new capability rights.

- Document the new capability rights in cap_rights_limit(2).

Sponsored by:	The FreeBSD Foundation
Discussed with:	rwatson, jilles, kib, des
2013-03-02 21:11:30 +00:00
Pawel Jakub Dawidek
2609222ab4 Merge Capsicum overhaul:
- Capability is no longer separate descriptor type. Now every descriptor
  has set of its own capability rights.

- The cap_new(2) system call is left, but it is no longer documented and
  should not be used in new code.

- The new syscall cap_rights_limit(2) should be used instead of
  cap_new(2), which limits capability rights of the given descriptor
  without creating a new one.

- The cap_getrights(2) syscall is renamed to cap_rights_get(2).

- If CAP_IOCTL capability right is present we can further reduce allowed
  ioctls list with the new cap_ioctls_limit(2) syscall. List of allowed
  ioctls can be retrived with cap_ioctls_get(2) syscall.

- If CAP_FCNTL capability right is present we can further reduce fcntls
  that can be used with the new cap_fcntls_limit(2) syscall and retrive
  them with cap_fcntls_get(2).

- To support ioctl and fcntl white-listing the filedesc structure was
  heavly modified.

- The audit subsystem, kdump and procstat tools were updated to
  recognize new syscalls.

- Capability rights were revised and eventhough I tried hard to provide
  backward API and ABI compatibility there are some incompatible changes
  that are described in detail below:

	CAP_CREATE old behaviour:
	- Allow for openat(2)+O_CREAT.
	- Allow for linkat(2).
	- Allow for symlinkat(2).
	CAP_CREATE new behaviour:
	- Allow for openat(2)+O_CREAT.

	Added CAP_LINKAT:
	- Allow for linkat(2). ABI: Reuses CAP_RMDIR bit.
	- Allow to be target for renameat(2).

	Added CAP_SYMLINKAT:
	- Allow for symlinkat(2).

	Removed CAP_DELETE. Old behaviour:
	- Allow for unlinkat(2) when removing non-directory object.
	- Allow to be source for renameat(2).

	Removed CAP_RMDIR. Old behaviour:
	- Allow for unlinkat(2) when removing directory.

	Added CAP_RENAMEAT:
	- Required for source directory for the renameat(2) syscall.

	Added CAP_UNLINKAT (effectively it replaces CAP_DELETE and CAP_RMDIR):
	- Allow for unlinkat(2) on any object.
	- Required if target of renameat(2) exists and will be removed by this
	  call.

	Removed CAP_MAPEXEC.

	CAP_MMAP old behaviour:
	- Allow for mmap(2) with any combination of PROT_NONE, PROT_READ and
	  PROT_WRITE.
	CAP_MMAP new behaviour:
	- Allow for mmap(2)+PROT_NONE.

	Added CAP_MMAP_R:
	- Allow for mmap(PROT_READ).
	Added CAP_MMAP_W:
	- Allow for mmap(PROT_WRITE).
	Added CAP_MMAP_X:
	- Allow for mmap(PROT_EXEC).
	Added CAP_MMAP_RW:
	- Allow for mmap(PROT_READ | PROT_WRITE).
	Added CAP_MMAP_RX:
	- Allow for mmap(PROT_READ | PROT_EXEC).
	Added CAP_MMAP_WX:
	- Allow for mmap(PROT_WRITE | PROT_EXEC).
	Added CAP_MMAP_RWX:
	- Allow for mmap(PROT_READ | PROT_WRITE | PROT_EXEC).

	Renamed CAP_MKDIR to CAP_MKDIRAT.
	Renamed CAP_MKFIFO to CAP_MKFIFOAT.
	Renamed CAP_MKNODE to CAP_MKNODEAT.

	CAP_READ old behaviour:
	- Allow pread(2).
	- Disallow read(2), readv(2) (if there is no CAP_SEEK).
	CAP_READ new behaviour:
	- Allow read(2), readv(2).
	- Disallow pread(2) (CAP_SEEK was also required).

	CAP_WRITE old behaviour:
	- Allow pwrite(2).
	- Disallow write(2), writev(2) (if there is no CAP_SEEK).
	CAP_WRITE new behaviour:
	- Allow write(2), writev(2).
	- Disallow pwrite(2) (CAP_SEEK was also required).

	Added convinient defines:

	#define	CAP_PREAD		(CAP_SEEK | CAP_READ)
	#define	CAP_PWRITE		(CAP_SEEK | CAP_WRITE)
	#define	CAP_MMAP_R		(CAP_MMAP | CAP_SEEK | CAP_READ)
	#define	CAP_MMAP_W		(CAP_MMAP | CAP_SEEK | CAP_WRITE)
	#define	CAP_MMAP_X		(CAP_MMAP | CAP_SEEK | 0x0000000000000008ULL)
	#define	CAP_MMAP_RW		(CAP_MMAP_R | CAP_MMAP_W)
	#define	CAP_MMAP_RX		(CAP_MMAP_R | CAP_MMAP_X)
	#define	CAP_MMAP_WX		(CAP_MMAP_W | CAP_MMAP_X)
	#define	CAP_MMAP_RWX		(CAP_MMAP_R | CAP_MMAP_W | CAP_MMAP_X)
	#define	CAP_RECV		CAP_READ
	#define	CAP_SEND		CAP_WRITE

	#define	CAP_SOCK_CLIENT \
		(CAP_CONNECT | CAP_GETPEERNAME | CAP_GETSOCKNAME | CAP_GETSOCKOPT | \
		 CAP_PEELOFF | CAP_RECV | CAP_SEND | CAP_SETSOCKOPT | CAP_SHUTDOWN)
	#define	CAP_SOCK_SERVER \
		(CAP_ACCEPT | CAP_BIND | CAP_GETPEERNAME | CAP_GETSOCKNAME | \
		 CAP_GETSOCKOPT | CAP_LISTEN | CAP_PEELOFF | CAP_RECV | CAP_SEND | \
		 CAP_SETSOCKOPT | CAP_SHUTDOWN)

	Added defines for backward API compatibility:

	#define	CAP_MAPEXEC		CAP_MMAP_X
	#define	CAP_DELETE		CAP_UNLINKAT
	#define	CAP_MKDIR		CAP_MKDIRAT
	#define	CAP_RMDIR		CAP_UNLINKAT
	#define	CAP_MKFIFO		CAP_MKFIFOAT
	#define	CAP_MKNOD		CAP_MKNODAT
	#define	CAP_SOCK_ALL		(CAP_SOCK_CLIENT | CAP_SOCK_SERVER)

Sponsored by:	The FreeBSD Foundation
Reviewed by:	Christoph Mallon <christoph.mallon@gmx.de>
Many aspects discussed with:	rwatson, benl, jonathan
ABI compatibility discussed with:	kib
2013-03-02 00:53:12 +00:00
Glen Barber
eff269ee18 Properly handle '-h' argument.
PR:		176332
Reviewed by:	scottl
MFC after:	3 days
2013-02-28 01:22:14 +00:00
Xin LI
d9dcc46365 Revert r247300 for now. I'll post a new changeset for review. 2013-02-26 19:46:59 +00:00
Xin LI
285a4c7c59 Expose timespec and timeval macros when __BSD_VISIBLE is defined. This
allows userland application to use the following macros:

	timespecclear, timespecisset, timespeccmp, timespecadd,
	timespecsub;

	timevalclear, timevalisset, timevalcmp.

MFC after:	1 month
2013-02-26 02:13:02 +00:00