Commit Graph

11725 Commits

Author SHA1 Message Date
Baptiste Daroussin
b6f4a0a1c7 Remove uneeded sbuf header 2015-04-09 21:23:27 +00:00
Baptiste Daroussin
d56eff2c31 iscsictl(8) does not actually needs to be linked to libcam nor libutil 2015-04-09 21:14:40 +00:00
Ed Maste
0f9b4b57c1 Avoid escaping EOL for line continuation
Reported by:	kib
2015-04-09 15:08:39 +00:00
Ed Maste
56ad941995 ar: Disallow directory traversal
Set ARCHIVE_EXTRACT_SECURE_SYMLINKS and ARCHIVE_EXTRACT_SECURE_NODOTDOT
as in bsdtar to prevent extraction of archive entries whose pathnames
contain .. or whose target directory would be altered by a symlink.
Also disallow absolute pathnames.

We don't currently provide an option to disable this behaviour (as
bsdtar's -P does). It is unlikely to be a problem in practice for ar(1),
but the -P option is not currently used and available if we want to
consider it for this purpose.

Differential Revision:	https://reviews.freebsd.org/D1524
Reported by:	Alexander Cherepanov <cherepan@mccme.ru>
Approved by:	delphij
Obtained from:	ELF tool chain ar, Ticket #474
MFC after:	1 week
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2015-04-09 13:45:17 +00:00
John Baldwin
dbee5c671a Move the 32-bit compatible procfs types from freebsd32.h to <sys/procfs.h>
and export them to userland.
- Define __HAVE_REG32 on platforms that define a reg32 structure and check
  for this in <sys/procfs.h> to control when to export prstatus32, etc.
- Add prstatus32_t and prpsinfo32_t typedefs for the 32-bit structures.
  libbfd looks for these types, and having them fixes 'gcore' in gdb of a
  32-bit process on a 64-bit platform.
- Use the structure definitions from <sys/procfs.h> in gcore's elf32 core
  dump code instead of duplicating the definitions.

Differential Revision:	https://reviews.freebsd.org/D2142
Reviewed by:	kib, nathanw (powerpc bits)
MFC after:	1 week
2015-04-08 16:30:45 +00:00
Pedro F. Giffuni
a45060f0cc patch: Bring small updates from OpenBSD
Prevent null pointer dereference on empty input files when diff requires
a specific version.

Fix division by zero for files with long lines (> 1024) in Plan B mode
by supporting arbitrarily long lines.

Obtained from:	OpenBSD (CVS Rev 1.41, 1.42)
MFC after:	1 week
2015-04-07 18:06:46 +00:00
Takanori Watanabe
8d6f425ddd Check l2cap socket initialisation and define L2CAP_SOCKET_CHECKED
This will fix build.
2015-04-07 16:48:23 +00:00
Allan Jude
212236608c Fix missing AUTHOR section for jot(1), rs(1), and lam(1)
PR:		196786
Differential Revision:	https://reviews.freebsd.org/D2115
Submitted by:	John A. Kunze (Author)
Approved by:	wblock (mentor)
MFC after:	1 week
Sponsored by:	ScaleEngine Inc.
2015-04-07 15:56:08 +00:00
Michael Tuexen
25044bbcfb The code says "or", not "either or". So fix the documentation.
MFC after: 1 week
2015-04-07 14:33:03 +00:00
Gleb Smirnoff
6fe1796015 Like it was already done for 'netstat -i', drop the kvm(3) support
in 'netstat -r'.

The netstat/route.c was the last abuser of struct ifnet and struct
rtentry in the tree. With this change if_var.h can become kernel
only include, _WANT_RTENTRY can go away and projects/ifnet and
projects/routing can go forward.

Differential Revision:	https://reviews.freebsd.org/D2242
Reviewed by:		melifaro, gnn
Sponsored by:		Nginx, Inc.
Sponsored by:		Netflix
2015-04-07 05:50:45 +00:00
Pedro F. Giffuni
0f4b9a9057 Remove custom getdelim(3) and fix a small memory leak.
Originally from Andre Smagin.

Obtained from:	OpenBSD
MFC after:	1 week
2015-04-07 01:17:49 +00:00
Pedro F. Giffuni
b904ab99bc sort(1): Cleanups and a small memory leak.
Remove useless check for leading blanks in the month name.  The
code didn't adjust len after stripping blanks so even if a month
*did* start with a blank we'd end up copying garbage at the end.
Also convert a malloc + memcpy to strdup and fix a memory leak in
the wide char version if mbstowcs() fails.
Originally from Andre Smagin.

Obtained from:  OpenBSD (CVS rev. 1.2, 1.3)
MFC after:	1 week
2015-04-07 01:17:29 +00:00
Mark Johnston
bef6922b96 lockf(1): add a reference to lockf(3).
Submitted by:	Conrad Meyer
MFC after:	1 week
2015-04-06 22:53:23 +00:00
Gleb Smirnoff
c151f24d08 o Make net.inet6.ip6.mif6table return special API structure, that doesn't
contain kernel pointers, and instead has interface index.
  Bump __FreeBSD_version for that change.
o Now, netstat/mroute6.c no longer needs to kvm_read(3) struct ifnet, and
  no longer needs to include if_var.h

Note that this change is far from being a complete move of IPv6 multicast
routing to a proper API. Other structures are still dumped into their
sysctls as is, requiring userland application to #define _KERNEL when
including ip6_mroute.h and then call kvm_read(3) to gather all bits and
pieces. But fixing this is out of scope of the opaque ifnet project.

Sponsored by:	Nginx, Inc.
Sponsored by:	Netflix
2015-04-06 22:12:18 +00:00
Gleb Smirnoff
56d5e0967c Stop including if_var.h from userland.
Sponsored by:	Nginx, Inc.
2015-04-06 09:42:23 +00:00
Pedro F. Giffuni
45e151e97d sort: style knits / cleanups.
Minor cleanups that got accidentally reverted.

Obtained from:	OpenBSD
2015-04-06 03:02:20 +00:00
Pedro F. Giffuni
e5f71a07e4 Revert (partial) r281123, r281125:
sort: style knits / cleanups.

Our style guide(9) specifies that in absence of local variables
an empty line must be inserted.

Pointed out by:	eadler
2015-04-06 02:35:55 +00:00
Pedro F. Giffuni
db8026c7bb sort: style knits / cleanups.
Obtained from:	OpenBSD
2015-04-05 23:06:42 +00:00
Pedro F. Giffuni
bd0f80c667 sort: Fix a comment.
Obtained from:	OpenBSD
2015-04-05 22:34:03 +00:00
Pedro F. Giffuni
f79477ebd5 sort: Cleanup small issues with spaces.
Obtained from:	OpenBSD
2015-04-05 22:22:43 +00:00
Dimitry Andric
fe2efc8c43 Add the llvm-cov and llvm-profdata tools, when WITH_CLANG_EXTRAS is
defined.  These help with processing coverage and profile data.
2015-04-03 19:43:39 +00:00
Edward Tomasz Napierala
42e70ae82a Add IPv6 example to iscsi.conf(5) and tweak ordering.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-04-02 11:52:34 +00:00
Edward Tomasz Napierala
dfc58cbca2 Rewrite iscsi.conf(5) to better match iscsictl(8).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-04-02 11:18:43 +00:00
Kevin Lo
18463c7749 Remove bogus cast. 2015-03-31 15:03:58 +00:00
Ed Maste
6744fea6b3 Switch to ELF toolchain readelf(1)
ELF toolchain readelf lacked some functionality at the time other tools
(like size, strip, nm, etc.) were switched over to the ELF toolchain
versions. That has been addressed as of the last update, so we can add
it to the list.

PR:		198950 [exp-run]
Reviewed by:	bapt, imp, rpaulo
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2156
2015-03-30 17:38:25 +00:00
Kristof Provost
09a3b0db35 Clarify the ministat default width
The man page states that:
'-w width    Width of ASCII-art plot in characters, default is 74.'

This is not entirely correct. The mini-help is more accurate:
'-w : width of graph/test output (default 74 or terminal width)'

In other words: the man page fails to explain that ministat will default
to the terminal width, not 74. It will only fall back to 74 if stdout is
not a TTY.

Submitted by:	Ben Hutchings <ben@decadent.org.uk>
Approved by:	philip (mentor)
2015-03-26 17:13:11 +00:00
Kevin Lo
cf7f8a9de8 Print size_t's with %zu rather than "%zd.
Reviewed by:	bde
2015-03-26 09:13:16 +00:00
Jung-uk Kim
01ed3ca3de Remove defunct SSLv2 support from fetch(1) and fetch(3). 2015-03-25 18:56:36 +00:00
Pedro F. Giffuni
c0089353cf xlint: update.
Bring some important updates from NetBSD up to about 2008/04/25.
The main feature is initial support for C99.

This is a very basic update to make it easier to merge new
compiler attirbutes but more updates are likely to follow.

Obtained from:	NetBSD
MFC after:	2 weeks
2015-03-23 18:45:29 +00:00
Warren Block
8c2eccbf4b Describe the behavior when both -f and a message are given. Pointed out by
Raphael Abreu <raphael.lorenzeto@gmail.com> on freebsd-doc.

MFC after:	1 week
2015-03-22 01:25:57 +00:00
Pedro F. Giffuni
2fa7a2afac bsdgrep: fix regression in the -f option since r268799
Caused by an incomplete merge from NetBSD.

PR:		198725
MFC after:	3 days
2015-03-21 00:21:30 +00:00
Kenneth D. Merry
d788649d0c Improve the mt(1) rblim display.
The granularity reported by READ BLOCK LIMITS is an exponent, not a
byte value.  So a granularity of 0 means 2^0, or 1 byte.  A
granularity of 1 means 2^1, or 2 bytes.

Print out the individual block limits on separate lines to improve
readability and avoid exceeding 80 columns.

usr.bin/mt/mt.c:
	Fix and improve the 'mt rblim' output.  Add a MT_PLURAL()
	macro so we can print "byte" or "bytes" as appropriate.

Sponsored by:	Spectra Logic
MFC after:	4 days
2015-03-18 20:54:54 +00:00
Kenneth D. Merry
74a177ac50 Fix a couple of problems in the sa(4) media type reports.
The only drives I have discovered so far that support medium type
reports are newer HP LTO (LTO-5 and LTO-6) drives.  IBM drives
only support the density reports.

sys/cam/scsi/scsi_sa.h:
	The number of possible density codes in the medium type
	report is 9, not 8.  This caused problems parsing all of
	the medium type report after this point in the structure.

usr.bin/mt/mt.c:
	Run the density codes returned in the medium type report
	through denstostring(), just like the primary and secondary
	density codes in the density report.  This will print the
	density code in hex, and give a text description if it
	is available.

Thanks to Rudolf Cejka for doing extensive testing with HP LTO drives
and Bacula and discovering these problems.

Tested by:	Rudolf Cejka <cejkar at fit.vutbr.cz>
Sponsored by:	Spectra Logic
MFC after:	4 days
2015-03-18 20:52:34 +00:00
Andrew Turner
e1f65999b6 Allowus to exclude a.out support from ldd and use it with arm64 as it won't
support the a.out format.

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
2015-03-18 13:59:04 +00:00
Ed Maste
42a8247119 xlint: add arm64 #define
Submitted by:	andrew@
Sponsored by:	The FreeBSD Foundation
2015-03-18 13:07:19 +00:00
Ed Maste
8f75a87acd Add arm64 xlint support.
Obtained from:	NetBSD
Sponsored by:	The FreeBSD Foundation
2015-03-17 19:16:51 +00:00
Baptiste Daroussin
ba44fb709d Remove bad and useless LINKS 2015-03-15 23:31:20 +00:00
Jilles Tjoelker
7a970ca937 unzip: Don't subvert vfs.timestamp_precision when setting atime to now.
Also, preserve nanoseconds from libarchive, even though the zip file format
does not currently support nanoseconds in timestamps.
2015-03-15 21:29:20 +00:00
Dimitry Andric
07f4251006 Regenerated llvm/clang manpages. 2015-03-14 19:22:15 +00:00
Dimitry Andric
e0125cfdd1 Merge ^/head r279893 through r279984. 2015-03-14 13:08:00 +00:00
Warner Losh
5f1c186b14 TARGET_* shouldn't be used here. Use MACHINE_* instead. 2015-03-12 08:32:24 +00:00
Warner Losh
2aa222b153 These local variables are unused. gc them. 2015-03-12 08:32:22 +00:00
Dimitry Andric
a857c4c833 Merge ^/head r279759 through r279892. 2015-03-11 19:04:01 +00:00
Scott Long
a506f1dd7f Fix a typo and update the date in the man page.
Submitted by:	emax
Obtained from:	Netflix, Inc.
MFC after:	3 days
2015-03-11 08:08:54 +00:00
Baptiste Daroussin
7d6e57b6c6 Add OpenBSD copyright for reallocarray
Move the function at the bottom of the misc.c file to clearly state the
copyright only stand for this function

PR:		198484
Submitted by:	logan@elandsys.com
2015-03-10 14:22:28 +00:00
Scott Long
cee9136cc6 Implement basic cpuset reporting in procstat via the -S flag.
Obtained from:	Netflix, Inc.
MFC after:	3 days
2015-03-10 09:41:48 +00:00
Mark Johnston
10b92369a1 Call xo_finish(3) before exiting in usage(). 2015-03-09 03:31:26 +00:00
Jilles Tjoelker
33df3caae6 touch(1): Xref utimensat(2) instead of utimes(2). 2015-03-08 22:49:34 +00:00
Dmitry Morozovsky
b4ed898162 Ouch, I've misread the original text.
Still reword phrase a bit, hopefully in a bit less misleading form than before.

MFC after:	1 week
X-MFC-With:	r279783
Pointy Hat to:	marck
2015-03-08 19:50:30 +00:00
Dmitry Morozovsky
2e7a899b36 Correct wordings a bit.
MFC after:	1 week
2015-03-08 17:34:06 +00:00
Jilles Tjoelker
6ab1d4d9c3 env: Fix crash when -S string is not empty but no operand follows.
split_spaces() set argc in main() incorrectly, which caused trouble for
getopt().

Examples:
  env -S '\c'
  env -S -i

PR:		197769
MFC after:	1 week
2015-03-08 14:12:43 +00:00
Dimitry Andric
6404f697a0 Merging ^/head r279596 through r279758. 2015-03-07 23:01:27 +00:00
Pedro F. Giffuni
20254bfa69 rlogin(1): initialize term variable.
CID:		1011522
Obtained from:	NetBSD (CVS 1.18, partial)
2015-03-05 19:51:37 +00:00
Baptiste Daroussin
8ae63aa054 r* commands are not precious anymore 2015-03-04 22:01:44 +00:00
Baptiste Daroussin
e061f95e7b Rework calendar(1) parser
Support includes surrounded by '"' or '<' '>'
Print warnings about bad syntax
Correctly navigate through include directories to find calendar files
Correctly support multiple includes

Tested by:	gjb
MFC after:	1 week
2015-03-04 20:04:23 +00:00
Dimitry Andric
ca65be80fd Merge ^/head r279313 through r279595. 2015-03-04 19:47:33 +00:00
Marcel Moolenaar
315ca438f3 Fix typo in dropped-packets attribute (missing s).
Pointed-out by: allanjude (excellent catch!)
2015-03-04 02:56:32 +00:00
Kenneth D. Merry
5090c893b7 Add density code for DAT-72, and notes on DAT-160.
As it turns out, the density code for DAT-160 (0x48) is the same
as for SDLT220.  Since the SDLT values are already in the table,
we will leave them in place.

Thanks to Harald Schmalzbauer for confirming the DAT-72 density code.

lib/libmt/mtlib.c:
	Add DAT-72 density code, and commented out DAT-160 density
	code.  Explain why DAT-160 is commented out.  Add notes
	explaining where the bpi values for these formats came from.

usr.bin/mt/mt.1:
	Add DAT-72 density code, and add a note explaining that
	the SDLTTapeI(110) density code (0x48) is the same as
	DAT-160.

Sponsored by:	Spectra Logic
MFC after:	3 weeks
2015-03-03 22:49:07 +00:00
Baptiste Daroussin
849684b013 Update mandoc to cvs snaphot from 20150302
Use the new unsupp warning level to detect the unsupported manpages in man(1)
2015-03-02 16:58:57 +00:00
Jilles Tjoelker
22ea47ec90 sh: Fix compiler warnings related to duplicate or missing declarations. 2015-03-01 21:46:55 +00:00
Dimitry Andric
0d56a8cba1 Merge ^/head r279163 through r279308. 2015-02-26 07:26:56 +00:00
Hans Petter Selasky
39b86a6a6f Update to upstream version 2.10
The most notable new feature is support for definition files.

Obtained from:	http://dotat.at/prog/unifdef
MFC after:	1 week
2015-02-25 21:10:03 +00:00
Xin LI
3b557094a2 Explicitly crypt_set_format("des") and bail out if we
can't.  This would prevent problem when we changed the
default crypt(3) algorithm or removed it in the future.

PR:		bin/189958
MFC after:	1 month
2015-02-25 20:47:25 +00:00
Marcel Moolenaar
65f2833127 Fix "netstat -hdw 1" output.
Reported by: np@
2015-02-25 17:06:27 +00:00
Kenneth D. Merry
7b7c7a0533 Fix several problems found by Coverity.
lib/libmt/mtlib.c:
	In mt_start_element(), make sure we don't overflow the
	cur_sb array.  CID 1271325

usr.bin/mt/mt.c:
	In main(), bzero the mt_com structure so that we aren't
	using any uninitialized stack variables.  CID 1271319

	In mt_param(), only allow one -s and one -p argument.  This
	will prevent a memory leak caused by overwriting the
	param_name and/or param_value variables.  CID 1271320 and
	CID 1271322

	To make things simpler in mt_param(), make sure there
	there is only one exit path for the function.  Make sure
	the arguments are explicitly freed.

Sponsored by:	Spectra Logic
Pointed out by:	emaste
MFC after:	1 month
2015-02-25 04:30:23 +00:00
Kenneth D. Merry
43518607b2 Significant upgrades to sa(4) and mt(1).
The primary focus of these changes is to modernize FreeBSD's
tape infrastructure so that we can take advantage of some of the
features of modern tape drives and allow support for LTFS.

Significant changes and new features include:

 o sa(4) driver status and parameter information is now exported via an
   XML structure.  This will allow for changes and improvements later
   on that will not break userland applications.  The old MTIOCGET
   status ioctl remains, so applications using the existing interface
   will not break.

 o 'mt status' now reports drive-reported tape position information
   as well as the previously available calculated tape position
   information.  These numbers will be different at times, because
   the drive-reported block numbers are relative to BOP (Beginning
   of Partition), but the block numbers calculated previously via
   sa(4) (and still provided) are relative to the last filemark.
   Both numbers are now provided.  'mt status' now also shows the
   drive INQUIRY information, serial number and any position flags
   (BOP, EOT, etc.) provided with the tape position information.
   'mt status -v' adds information on the maximum possible I/O size,
   and the underlying values used to calculate it.

 o The extra sa(4) /dev entries (/dev/saN.[0-3]) have been removed.

   The extra devices were originally added as place holders for
   density-specific device nodes.  Some OSes (NetBSD, NetApp's OnTap
   and Solaris) have had device nodes that, when you write to them,
   will automatically select a given density for particular tape drives.

   This is a convenient way of switching densities, but it was never
   implemented in FreeBSD.  Only the device nodes were there, and that
   sometimes confused users.

   For modern tape devices, the density is generally not selectable
   (e.g. with LTO) or defaults to the highest availble density when
   the tape is rewritten from BOT (e.g. TS11X0).  So, for most users,
   density selection won't be necessary.  If they do need to select
   the density, it is easy enough to use 'mt density' to change it.

 o Protection information is now supported.  This is either a
   Reed-Solomon CRC or CRC32 that is included at the end of each block
   read and written.  On write, the tape drive verifies the CRC, and
   on read, the tape drive provides a CRC for the userland application
   to verify.

 o New, extensible tape driver parameter get/set interface.

 o Density reporting information.  For drives that support it,
   'mt getdensity' will show detailed information on what formats the
   tape drive supports, and what formats the tape drive supports.

 o Some mt(1) functionality moved into a new mt(3) library so that
   external applications can reuse the code.

 o The new mt(3) library includes helper routines to aid in parsing
   the XML output of the sa(4) driver, and build a tree of driver
   metadata.

 o Support for the MTLOAD (load a tape in the drive) and MTWEOFI
   (write filemark immediate) ioctls needed by IBM's LTFS
   implementation.

 o Improve device departure behavior for the sa(4) driver.  The previous
   implementation led to hangs when the device was open.

 o This has been tested on the following types of drives:
	IBM TS1150
	IBM TS1140
	IBM LTO-6
	IBM LTO-5
	HP LTO-2
	Seagate DDS-4
	Quantum DLT-4000
	Exabyte 8505
	Sony DDS-2

contrib/groff/tmac/doc-syms,
share/mk/bsd.libnames.mk,
lib/Makefile,
	Add libmt.

lib/libmt/Makefile,
lib/libmt/mt.3,
lib/libmt/mtlib.c,
lib/libmt/mtlib.h,
	New mt(3) library that contains functions moved from mt(1) and
	new functions needed to interact with the updated sa(4) driver.

	This includes XML parser helper functions that application writers
	can use when writing code to query tape parameters.

rescue/rescue/Makefile:
	Add -lmt to CRUNCH_LIBS.

src/share/man/man4/mtio.4
	Clarify this man page a bit, and since it contains what is
	essentially the mtio.h header file, add new ioctls and structure
	definitions from mtio.h.

src/share/man/man4/sa.4
	Update BUGS and maintainer section.

sys/cam/scsi/scsi_all.c,
sys/cam/scsi/scsi_all.h:
	Add SCSI SECURITY PROTOCOL IN/OUT CDB definitions and CDB building
	functions.

sys/cam/scsi/scsi_sa.c
sys/cam/scsi/scsi_sa.h
	Many tape driver changes, largely outlined above.

	Increase the sa(4) driver read/write timeout from 4 to 32
	minutes.  This is based on the recommended values for IBM LTO
	5/6 drives.  This may also avoid timeouts for other tape
	hardware that can take a long time to do retries and error
	recovery.  Longer term, a better way to handle this is to ask
	the drive for recommended timeout values using the REPORT
	SUPPORTED OPCODES command.  Modern IBM and Oracle tape drives
	at least support that command, and it would allow for more
	accurate timeout values.

	Add XML status generation.  This is done with a series of
	macros to eliminate as much duplicate code as possible.  The
	new XML-based status values are reported through the new
	MTIOCEXTGET ioctl.

	Add XML driver parameter reporting, using the new MTIOCPARAMGET
	ioctl.

	Add a new driver parameter setting interface, using the new
	MTIOCPARAMSET and MTIOCSETLIST ioctls.

	Add a new MTIOCRBLIM ioctl to get block limits information.

	Add CCB/CDB building routines scsi_locate_16, scsi_locate_10,
	and scsi_read_position_10().

	scsi_locate_10 implements the LOCATE command, as does the
	existing scsi_set_position() command.  It just supports
	additional arguments and features.  If/when we figure out a
	good way to provide backward compatibility for older
	applications using the old function API, we can just revamp
	scsi_set_position().  The same goes for
	scsi_read_position_10() and the existing scsi_read_position()
	function.

	Revamp sasetpos() to take the new mtlocate structure as an
	argument.  It now will use either scsi_locate_10() or
	scsi_locate_16(), depending upon the arguments the user
	supplies.  As before, once we change position we don't have a
	clear idea of what the current logical position of the tape
	drive is.

	For tape drives that support long form position data, we
	read the current position and store that for later reporting
	after changing the position.  This should help applications
	like Bacula speed tape access under FreeBSD once they are
	modified to support the new ioctls.

	Add a new quirk, SA_QUIRK_NO_LONG_POS, that is set for all
	drives that report SCSI-2 or older, as well as drives that
	report an Illegal Request type error for READ POSITION with
	the long format.  So we should automatically detect drives
	that don't support the long form and stop asking for it after
	an initial try.

	Add a partition number to the sa(4) softc.

	Improve device departure handling. The previous implementation
	led to hangs when the device was open.

	If an application had the sa(4) driver open, and attempted to
	close it after it went away, the cam_periph_release() call in
	saclose() would cause the periph to get destroyed because that
	was the last reference to it.  Because destroy_dev() was
	called from the sa(4) driver's cleanup routine (sacleanup()),
	and would block waiting for the close to happen, a deadlock
	would result.

	So instead of calling destroy_dev() from the cleanup routine,
	call destroy_dev_sched_cb() from saoninvalidate() and wait for
	the callback.

	Acquire a reference for devfs in saregister(), and release it
	in the new sadevgonecb() routine when all devfs devices for
	the particular sa(4) driver instance are gone.

	Add a new function, sasetupdev(), to centralize setting
	per-instance devfs device parameters instead of repeating the
	code in saregister().

	Add an open count to the softc, so we know how many
	peripheral driver references are a result of open
       	sessions.

	Add the D_TRACKCLOSE flag to the cdevsw flags so
	that we get a 1:1 mapping of open to close calls
	instead of a N:1 mapping.

	This should be a no-op for everything except the
	control device, since we don't allow more than one
	open on non-control devices.

	However, since we do allow multiple opens on the
	control device, the combination of the open count
	and the D_TRACKCLOSE flag should result in an
	accurate peripheral driver reference count, and an
	accurate open count.

	The accurate open count allows us to release all
	peripheral driver references that are the result
	of open contexts once we get the callback from devfs.

sys/sys/mtio.h:
	Add a number of new mt(4) ioctls and the requisite data
	structures.  None of the existing interfaces been removed
	or changed.

	This includes definitions for the following new ioctls:

	MTIOCRBLIM      /* get block limits */
	MTIOCEXTLOCATE	/* seek to position */
	MTIOCEXTGET     /* get tape status */
	MTIOCPARAMGET	/* get tape params */
	MTIOCPARAMSET	/* set tape params */
	MTIOCSETLIST	/* set N params */

usr.bin/mt/Makefile:
	mt(1) now depends on libmt, libsbuf and libbsdxml.

usr.bin/mt/mt.1:
	Document new mt(1) features and subcommands.

usr.bin/mt/mt.c:
	Implement support for mt(1) subcommands that need to
	use getopt(3) for their arguments.

	Implement a new 'mt status' command to replace the old
	'mt status' command.  The old status command has been
	renamed 'ostatus'.

	The new status function uses the MTIOCEXTGET ioctl, and
	therefore parses the XML data to determine drive status.
	The -x argument to 'mt status' allows the user to dump out
	the raw XML reported by the kernel.

	The new status display is mostly the same as the old status
	display, except that it doesn't print the redundant density
	mode information, and it does print the current partition
	number and position flags.

	Add a new command, 'mt locate', that will supersede the
	old 'mt setspos' and 'mt sethpos' commands.  'mt locate'
	implements all of the functionality of the MTIOCEXTLOCATE
	ioctl, and allows the user to change the logical position
	of the tape drive in a number of ways.  (Partition,
	block number, file number, set mark number, end of data.)
	The immediate bit and the explicit address bits are
	implemented, but not documented in the man page.

	Add a new 'mt weofi' command to use the new MTWEOFI ioctl.
	This allows the user to ask the drive to write a filemark
	without waiting around for the operation to complete.

	Add a new 'mt getdensity' command that gets the XML-based
	tape drive density report from the sa(4) driver and displays
	it.  This uses the SCSI REPORT DENSITY SUPPORT command
	to get comprehensive information from the tape drive about
	what formats it is able to read and write.

	Add a new 'mt protect' command that allows getting and setting
	tape drive protection information.  The protection information
	is a CRC tacked on to the end of every read/write from and to
	the tape drive.

Sponsored by:	Spectra Logic
MFC after:	1 month
2015-02-23 21:59:30 +00:00
Dimitry Andric
9b2a0d91b8 Merge ^/head r279023 through r279162. 2015-02-22 16:04:37 +00:00
Marcel Moolenaar
e6679c1a71 Add the -c option for specifying the capacity of the disk image. When
a capcity is given, no partitions are required. When no partitions are
given, no scheme needs to be specified either. This makes it possible
to create an entirely empty disk image. To add an empty partitioning
table, specify the scheme.

Bump the version to 20150222.
2015-02-22 04:50:47 +00:00
Marcel Moolenaar
aba885c960 Don't require a scheme if no partitions are given. Change the code
to handle that case. Note that we still require partitions, so the
change is effectively a no-op.
2015-02-22 01:20:49 +00:00
Marcel Moolenaar
b5380f2a09 In scheme_write(), don't overwrite the end parameter with the
return value of image_get_size(). As it so happens, the only
caller of scheme_write() passes exactly that.
2015-02-22 01:01:02 +00:00
Marcel Moolenaar
29eac8d790 Remove extraneous parenthesis in assignment. 2015-02-22 00:58:10 +00:00
Marcel Moolenaar
6504b42f68 Document that netstat(1) supports libxo(3). 2015-02-22 00:01:42 +00:00
Marcel Moolenaar
ade9ccfe21 Convert netstat to use libxo.
Obtained from:  Phil Shafer <phil@juniper.net>
Ported to -current by: alfred@ (mostly), Kim Shrier
Formatting: marcel@
Sponsored by:   Juniper Networks, Inc.
2015-02-21 23:47:20 +00:00
Dimitry Andric
0d36d957d3 Merging ^/head r278916 through r279022. 2015-02-19 21:10:01 +00:00
Gleb Smirnoff
de5ef1dfee Burn bridges to FreeBSD 7.x IGMP stats. 2015-02-19 19:36:54 +00:00
Pedro F. Giffuni
7e8dfdf113 ministat(1): replace malloc + memset with calloc.
Reviewed by:	phk
2015-02-17 23:20:19 +00:00
Pedro F. Giffuni
8c5a59ee44 du(1): replace malloc + memset with calloc. 2015-02-17 21:12:45 +00:00
Dimitry Andric
714e3c812d Merge ^/head r278756 through r278915. 2015-02-17 19:53:41 +00:00
Jilles Tjoelker
d6b3ef634c compress,gzip,xz: Preserve timestamps with nanosecond precision. 2015-02-17 13:12:54 +00:00
Sergey Kandaurov
723ea6bc93 kdump: sendfile(2) "flags" argument needs casting on 64-bit platforms.
MFC after:	1 week
Sponsored by:	Nginx, Inc.
2015-02-16 17:19:28 +00:00
Jilles Tjoelker
51492908f9 touch: Fix some subtle bugs related to NULL times fallback:
* Do not subvert vfs.timestamp_precision by reading the time and passing
  that to utimensat(). Instead, pass UTIME_NOW. A fallback to a NULL times
  pointer is no longer used.

* Do not ignore -a/-m if the user has write access but does not own the
  file. Leave timestamps unchanged using UTIME_OMIT and do not fall back to
  a NULL times pointer (which would set both timestamps) if that fails.

Reviewed by:	bde
2015-02-15 21:28:00 +00:00
Ed Maste
b0aa0c6e1b timeout: handle zombie grandchildren
timeout previously collected only one child status with wait(2). If this
was one of the grandchildren timeout would return to sigsuspend and wait
until the timeout expired. Instead, loop for all children.

PR:		kern/197608
Reviewed by:	bapt, kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2015-02-15 20:10:53 +00:00
John Baldwin
bc411bc2d0 Include OBJT_PHYS VM objects in ELF core dumps. In particular this
includes the shared page allowing debuggers to use the signal trampoline
code to identify signal frames in core dumps.

Differential Revision:	https://reviews.freebsd.org/D1828
Reviewed by:	alc, kib
MFC after:	1 week
2015-02-14 17:12:31 +00:00
Dimitry Andric
44f7b0dcc5 Merge llvm 3.6.0rc3 from ^/vendor/llvm/dist, merge clang 3.6.0rc3 from
^/vendor/clang/dist, resolve conflicts, and update patches README.
2015-02-14 14:13:00 +00:00
Dimitry Andric
569e61a4fc Merge ^/head r278499 through r278755. 2015-02-14 13:12:03 +00:00
Baptiste Daroussin
5c5b28d0d7 Revert r278642
install(1) does not handle chflags on hardlinks
2015-02-13 09:02:15 +00:00
Baptiste Daroussin
e707eb9bc2 Partially revert 278642
On reinstall (overwrite) install(1) does not handle chflags

Reported by:	ian
2015-02-13 07:51:26 +00:00
Baptiste Daroussin
9f65be6caf Use PRECIOUSPROG instead of custom code to handle schg
This allows to preserve schg when installed with -DNO_ROOT

MFC after:	1 week
2015-02-12 23:08:27 +00:00
Colin Percival
11d9aa6707 Step 1 of eliminating the "games" distribution: Move binaries to /usr/bin;
update paths; and include everything in the "base" distribution.

The "games" distribution being optional made sense when there were more
games and we had small disks; but the "games-like" games were moved into
the ports tree a dozen years ago and the remaining "utility-like" games
occupy less than 0.001% of my laptop's small hard drive.  Meanwhile every
new user is confronted by the question "do you want games installed" when
they they try to install FreeBSD.

The next steps will be:

2. Removing punch card (bcd, ppt), phase-of-moon (pom), clock (grdc), and
caesar cipher (caesar, rot13) utilities.  I intend to keep fortune, factor,
morse, number, primes, and random, since there is evidence that those are
still being used.

3. Merging src/games into src/usr.bin.

This change will not be MFCed.

Reviewed by:	jmg
Discussed at:	EuroBSDCon
Approved by:	gjb (release-affecting changes)
2015-02-12 05:35:00 +00:00
Glen Barber
21c31ec174 Reduce number of lines to set ORGANIZATION_NAME in
freebsd-organization.h.

Patched by:	ian
PR:		197540
MFC after:	3 days
X-MFC-with:	r278603
Sponsored by:	The FreeBSD Foundation
2015-02-12 00:17:14 +00:00
Glen Barber
81e4e017b6 Ensure ORGANIZATION_NAME is quoted when ORGANIZATION
could contain strings of two or more words.

Reviewed by:	peter
Reported by:	karl@denninger.net
PR:		197540
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2015-02-11 22:59:24 +00:00
Marcel Moolenaar
399d34850f Close the file list before opening the container that holds the
totals, otherwise we end up emitting invalid JSON -- provided
libxo does not prevent us from doing that.

PR:		197499
Submitted by:	allanjude@
2015-02-11 17:56:24 +00:00
Michael Gmelin
441ee032a3 Add xo_finish() to w.c in case it's invoked as uptime
Reviewed by:	marcel
Approved by:	marcel
Differential Revision: https://reviews.freebsd.org/D1821
2015-02-10 22:23:52 +00:00
Dimitry Andric
93466fc60f Merge ^/head r278351 through r278498. 2015-02-10 07:56:14 +00:00
Rui Paulo
532000256b Merge xz 5.2.0.
This brings support for multi-threaded compression.  This brings close
N times faster compression where N is the number of CPU cores.
Because of this, liblzma now depends on libthr.

Soon libarchive will be modified to use the new lzma API.

Thanks to antoine@ for the exp-run.

Differential Revision:	 https://reviews.freebsd.org/D1786
Reviewed by:	bapt
2015-02-09 06:20:34 +00:00
Ed Maste
9d984acfb7 Update FreeBSD LLDB build for 3.6 update
Sponsored by:	DARPA, AFRL
2015-02-08 17:26:41 +00:00
Alexander Motin
d5a6319ac7 Fix couple issues in ctlstat header printing.
MFC after:	1 week
2015-02-07 17:53:47 +00:00
Dimitry Andric
b40d827331 Merging ^/head r278298 through r278350. 2015-02-07 12:57:40 +00:00
John Baldwin
330c544318 Change ktrdump to use the more standard -M/-N flags to specify the path
to a crash dump and kernel, respectively.  The existing -m/-e flags are
still supported for backwards compatiblity but are no longer documented.

Requested by:	np
MFC after:	2 weeks
2015-02-06 19:41:23 +00:00
Dimitry Andric
bd9cc051b3 Merging ^/head r278224 through r278297. 2015-02-05 22:34:29 +00:00
Edward Tomasz Napierala
82babffba9 Make it possible to set (via iscsi.conf(5)) and query (via iscsictl -v)
initiator iSCSI offload.  Pass maximum data segment size supported by
chosen offload module to iscsid(8), and make iscsid(8) not try to negotiate
anything larger than that.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-05 06:37:59 +00:00
Dimitry Andric
a403ab7f64 Merge ^/head r278110 through r278223. 2015-02-04 21:08:28 +00:00
Enji Cooper
c7b6816fa9 Add MK_FILE to control whether or not to build file(1), libmagic(3), etc
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-02-04 10:24:40 +00:00
Enji Cooper
11981695fc Add the following options to enable/disable several features in the base system
WITHOUT_BOOTPARAMD - bootparamd
WITHOUT_BOOTPD - bootpd
WITHOUT_FINGER - finger, fingerd
WITHOUT_FTP - ftp, ftpd
WITHOUT_INETD - inetd
WITHOUT_RBOOTD - rbootd
WITHOUT_TCP_WRAPPERS - tcpd, et al
WITHOUT_TFTP - tftp, tftp-server
WITHOUT_TIMED - timed

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-02-04 10:19:32 +00:00
Dimitry Andric
f72f83dcae Merge ^/head r277902 through r277944. 2015-01-30 18:34:56 +00:00
Enji Cooper
b7c2ba84c9 Create MANLINKS for lzgrep, etc when MK_LZMA_SUPPORT != no
MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
2015-01-30 18:07:46 +00:00
Dimitry Andric
6402890244 Merge ^/head r277804 through r277843. 2015-01-28 18:45:40 +00:00
Pedro F. Giffuni
76c76d54f8 sed: fix pasto from previous r277802.
MFC after:	3 days
2015-01-27 19:46:19 +00:00
Dimitry Andric
76f411ce48 Merging ^/head r277777 through r277803. 2015-01-27 19:40:08 +00:00
Pedro F. Giffuni
fc04dce059 Fix resource leak and dereference after NULL.
process.c:
Protect access against NULL.

main.c:
Prevent outfile overwrite resource leak.

CID:	271181
CID:	1006930

Obtained from:	NetBSD
MFC after:	3 days
2015-01-27 18:58:24 +00:00
Dimitry Andric
1ae6788e51 Update llvm and clang library and binary Makefiles for 3.6.0 rc1. 2015-01-26 18:48:27 +00:00
Dag-Erling Smørgrav
4ac1e0a9fc Allow tracing dlfunc() / dlsym() events.
MFC after:	1 week
2015-01-25 12:11:50 +00:00
Enji Cooper
3f802165ba Add MK_TALK knob for building the talk and talkd
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-01-25 04:37:44 +00:00
Enji Cooper
b29d6977f3 Add MK_ISCSI knob for building the iscsi initiator, iscsi daemon, kernel
modules, etc

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-01-25 04:20:11 +00:00
Enji Cooper
79a86dafb7 Add MK_EE knob to control installing edit, ee, etc
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-01-25 00:03:44 +00:00
Jilles Tjoelker
5faf2ae160 cp,mv,touch: Set timestamps with nanosecond precision.
This uses utimensat().
2015-01-24 13:50:13 +00:00
Jilles Tjoelker
2205e0d1bd Add futimens and utimensat system calls.
The core kernel part is patch file utimes.2008.4.diff from
pluknet@FreeBSD.org. I updated the code for API changes, added the manual
page and added compatibility code for old kernels. There is also audit and
Capsicum support.

A new UTIME_* constant might allow setting birthtimes in future.

Differential Revision:	https://reviews.freebsd.org/D1426
Submitted by:	pluknet (partially)
Reviewed by:	delphij, pluknet, rwatson
Relnotes:	yes
2015-01-23 21:07:08 +00:00
Will Andrews
d0fde85e65 Use clock_gettime to measure the time that we spent asleep during
"vmstat -i" instead of assuming it's what we asked for.

Submitted by:	asomers
MFC after:	1 week
Sponsored by:	Spectra Logic
MFSpectraBSD:	1066751 on 2014/06/04
2015-01-23 16:21:31 +00:00
Will Andrews
157b158ea9 Use CLOCK_UPTIME to get the uptime instead of CLOCK_MONOTONIC.
Submitted by:	asomers
MFC after:	1 week
Sponsored by:	Spectra Logic
MFSpectraBSD:	1066740 on 2014/06/04
2015-01-23 16:18:39 +00:00
Will Andrews
961a5dae5c Make "vmstat -i" respect the -c <count> and -i <interval> options together.
Submitted by:	asomers
MFC after:	1 week
Sponsored by:	Spectra Logic
MFSpectraBSD:	1066735 on 2014/06/04
2015-01-23 16:15:55 +00:00
Xin LI
a5e43ff69e Fix xz handling for files larger than 32K.
Submitted by:	Stefan Ehmann <shoesoft gmx net>
PR:		bin/186861
MFC after:	2 weeks
2015-01-21 01:11:37 +00:00
Will Andrews
7a37b5fc17 Add a ${CP} alias for copying files in the build.
Some users build FreeBSD as non-root in Perforce workspaces.  By default,
Perforce sets files read-only unless they're explicitly being edited.
As a result, the -f argument must be used to cp in order to override the
read-only flag when copying source files to object directories.  Bare use of
'cp' should be avoided in the future.

Update all current users of 'cp' in the src tree.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	Spectra Logic
2015-01-16 21:39:08 +00:00
Justin Hibbits
b5d4909ec3 Make use of the new Altivec ptrace support, to save the Altivec registers in
gcore.

MFC after:	2 weeks
Relnotes:	yes
2015-01-14 07:02:21 +00:00
Pedro F. Giffuni
a161398ab8 Replace __inline GNUism with the standard inline.
MFC after:	1 week
2015-01-13 00:04:22 +00:00
Dimitry Andric
c369979c46 Add the llvm-symbolizer tool, which enables the sanitizers to report
more complete debugging information.  This tools is only enabled when
WITH_CLANG_EXTRAS is on.

Submitted by:	Dan McGregor <danismostlikely@gmail.com>
2015-01-10 22:22:42 +00:00
Dimitry Andric
f91be99b1f Remove a few redundant DPADD/LDADD pairs in llvm utilities. 2015-01-10 22:11:49 +00:00
Dimitry Andric
559f16f0dd Regenerate the manpages for the additional llvm/clang tools. This
contains only very minor updates.
2015-01-10 21:44:31 +00:00
Jeremie Le Hen
98648ee85e Add a regression test for PR 192108.
I won't go through the hassle of MFCing it since I expect all changes to go
first through HEAD anyway.

PR:		192108
2015-01-10 10:16:22 +00:00
Ed Maste
8fb02d8847 mkimg: Add MBR EFI partition type
Sponsored by:	The FreeBSD Foundation
2015-01-09 19:34:48 +00:00
John Baldwin
e275993995 Document CPU_WHICH_DOMAIN and bump Dd for cpuset.1.
Missed in:	r276829
2015-01-08 18:53:11 +00:00
Pedro F. Giffuni
bfffbac603 Partial revert of r276832:
Do not bump the warns level as it still breaks the gcc build on sparc64

Reported by:	jenkins
2015-01-08 17:23:59 +00:00
Pedro F. Giffuni
707c9cc5d1 sed: Address warnings with clang and gcc48.
MFC after:	2 weeks
2015-01-08 16:33:15 +00:00
John Baldwin
c0ae66888b Create a cpuset mask for each NUMA domain that is available in the
kernel via the global cpuset_domain[] array. To export these to userland,
add a CPU_WHICH_DOMAIN level that can be used to fetch the mask for a
specific domain. Add a -d flag to cpuset(1) that can be used to fetch
the mask for a given domain.

Differential Revision:	https://reviews.freebsd.org/D1232
Submitted by:	jeff (kernel bits)
Reviewed by:	adrian, jeff
2015-01-08 15:53:13 +00:00
Dimitry Andric
47a80b9264 Add the AArch64 llvm backend to the build to allow for early testing and
to ease any rework of how clang is built to take arm64 in to account.

Submitted by:	andrew
Reviewed by:	andrew, emaste
Differential Revision: https://reviews.freebsd.org/D1446
2015-01-07 19:06:27 +00:00
Ed Maste
63bf16a1c4 ar: Avoid null pointer deref while reading corrupt archives
ELF Tool Chain ticket #467

Reported by:	Alexander Cherepanov <cherepan@mccme.ru>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2015-01-07 01:51:02 +00:00
Baptiste Daroussin
ff7c6d42f3 Use the new process reaper functionality
When not using the --foreground option timeout(1) is supported to signal all
command children hierarchy, timeout(1) now acquire the reaper to ensure this
really happens and no children process can escaper from timeout(1) control
2015-01-06 23:40:39 +00:00
Dmitry Chagin
78ec874dd3 kdump: eliminate new clang warnings.
MFC after:	1 week
2015-01-06 18:53:09 +00:00
Joel Dahl
385385fb1c mdoc: use An macro. 2015-01-04 12:42:08 +00:00
Baptiste Daroussin
0489fbcd33 Only manpages with fatal errors should be rendered by groff(1) 2015-01-03 23:39:44 +00:00
Ed Maste
2432082836 Add Makefile for elftoolchain readelf(1)
Sponsored by:	The FreeBSD Foundation
2015-01-02 22:26:54 +00:00
Dimitry Andric
ccd2f3b61a Merge ^/head r274961 through r276472. 2014-12-31 16:50:46 +00:00
Pedro F. Giffuni
f718bedc4f Fixes to exit status.
Exit with EXIT_FAILURE for invalid arguments.
Fixes NetBSD-PR 43517.

Print version string to stdout instead of stderr;
it is user-requested and not an error.

Obtained from:	NetBSD
MFC after:	5 days
2014-12-31 16:30:33 +00:00
Dimitry Andric
3ed527f1b5 Merge ^/head r274961 through r276418. 2014-12-30 20:23:03 +00:00
Joel Dahl
f7e00d4bbd mdoc: remove EOL whitespace. 2014-12-29 13:50:59 +00:00
Dimitry Andric
8007ee2b0c Merge ^/head r274961 through r276301. 2014-12-27 14:58:52 +00:00
Joel Dahl
914f6e6290 mdoc: sort SEE ALSO. 2014-12-26 21:56:23 +00:00
Baptiste Daroussin
fd83961f72 mandoc -Tlocale is now the default, no need to enforce it anymore 2014-12-25 22:04:16 +00:00
Baptiste Daroussin
47ed86a875 Update mandoc to 1.13.2 2014-12-25 21:56:56 +00:00
Pedro F. Giffuni
547e0acbec patch: Bring in xstrdup and use it when appropriate.
The function savestr allows NULL return values during Plan A patching so in
case of out of memory conditions, Plan B can step in.  In many cases, NULL
value is not properly handled, so use xstrdup here (it's outside Plan A/B
patching, which means that even Plan B relies on successful operations).

Clean up some whitespaces while here

Obtained from:	OpenBSD
MFC after:	2 weeks
2014-12-25 21:51:28 +00:00
Xin LI
bf855dd342 Sync with NetBSD, mainly address NetBSD bug #43355:
Fix valid_format() to be more careful about allowing only valid
printf formats.

Obtained from:	NetBSD
MFC after:	2 weeks
2014-12-18 20:23:19 +00:00
Dimitry Andric
e65720e1ac Merge ^/head r275759 through r275911. 2014-12-18 18:44:22 +00:00
Gleb Kurtsou
9b33705411 Adjust printf format specifiers for dev_t and ino_t in user space.
ino_t and dev_t are about to become uint64_t.

Reviewed by:	kib, mckusick
2014-12-17 07:10:48 +00:00
Pedro F. Giffuni
a34b42e43c sed: Bounds check the file path used in the 'w' command.
Modified version of a diff from Sebastien Marie to prevent a crash found
with the afl fuzzer.

Obtained from:	OpenBSD (CVS Rev. 1.37)
MFC after:	1 week
2014-12-16 20:26:11 +00:00
Dimitry Andric
be281d7007 Merge ^/head r275715 through r275748. 2014-12-13 19:45:18 +00:00
Marcel Moolenaar
0f49f14626 The size of the first level reference count table is given in terms of the
number of clusters it occupies. It's not the number of entries in the table,
as it is for the L1 cluster table.

For small images, the two are the same. With the unit tests based on small
images, this change has therefore no effect on the unit test.  For larger
images (like the FreeBSD 10.1-RELEASE image), this gives a discrepancy that
actually shows up when running "qemu-img check".

Bump the version number of mkimg.

While here, fix a white-space bug.

MFC after: 1 week
2014-12-12 06:13:31 +00:00
Dimitry Andric
d7e0694a59 Merge ^/head r275478 through r275622. 2014-12-08 19:56:34 +00:00
Pedro F. Giffuni
d3fc0cb884 patch(1): avoid line number overflows
Introduce strtolinenum to properly check line numbers while parsing:
no signs, no spaces, just digits, 0 <= x <= LONG_MAX

Properly validate line ranges supplied in diff file to prevent overflows.
Also fixes an out of boundary memory access because the resulting values
are used as array indices.

PR:	195436
Obtained from:	OpenBSD (CVS pch.c rev 1.45, 1,46, common.h rev 1.28)
MFC after:	1 week
2014-12-08 15:10:48 +00:00
Pedro F. Giffuni
2b468ebac3 Small space changes
Mostly to keep in sync with OpenBSD and update the TAG.

Obtained from:	OpenBSD
MFC after:	5 days
2014-12-07 20:32:24 +00:00
Pedro F. Giffuni
ab761cdbfa Prefer setvbuf() to setlinebuf().
On FreeBSD's libc setlinebuf is a wrapper to setvbuf anyways.

Obtained from:	OpenBSD
MFC after:	5 days
2014-12-07 20:15:07 +00:00
Pedro F. Giffuni
e91a64de38 Merge fixes from OpenBSD.
Check fstat return value.  Also, use off_t for file size and offsets.
Avoid iterating over end of string.

Obtained from:	OpenBSD (CVS rev. 1.41, 1.43)
MFC after:	1 week
2014-12-06 01:21:12 +00:00
Pedro F. Giffuni
dbfbf4a8af Update OpenBSD CVS revision for our r255232.
This is a no-op to make it easier to track changes from OpenBSD

MFC after:	3 days
2014-12-05 23:08:39 +00:00
Edward Tomasz Napierala
de29f585af Move iscsi.conf.5 from sbin/iscontrol/ to usr.bin/iscsictl/, as the
former is obsolete.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-12-05 12:38:01 +00:00
Dimitry Andric
24ce0a02e5 Merge ^/head r275387 through r275477. 2014-12-04 17:38:32 +00:00
Baptiste Daroussin
1fb816da82 Update to mandoc cvs version as of 20141201
- Compatiblity with existing manpages has been improved
- Now support ".so" directive with compressed manpages (which fixes a regression
we have since we have new man(1))
2014-12-02 23:24:57 +00:00
Dimitry Andric
2383695dc3 Merge ^/head r274961 through r275386. 2014-12-02 01:45:04 +00:00
Ed Maste
3194293903 Build infrastructure for elftoolchain tools
Set WITH_ELFTOOLCHAIN_TOOLS in src.conf to use the elftoolchain version
of the following tools:

 * addr2line
 * elfcopy (strip / mcs)
 * nm
 * size
 * strings

Reviewed by:	bapt (earlier version)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D1224
2014-12-01 17:49:42 +00:00
Dimitry Andric
60c317af72 Merge ^/head r275262 through r275363. 2014-12-01 13:14:39 +00:00
Gleb Smirnoff
0f9d0a73a4 Merge from projects/sendfile:
o Introduce a notion of "not ready" mbufs in socket buffers.  These
mbufs are now being populated by some I/O in background and are
referenced outside.  This forces following implications:
- An mbuf which is "not ready" can't be taken out of the buffer.
- An mbuf that is behind a "not ready" in the queue neither.
- If sockbet buffer is flushed, then "not ready" mbufs shouln't be
  freed.

o In struct sockbuf the sb_cc field is split into sb_ccc and sb_acc.
  The sb_ccc stands for ""claimed character count", or "committed
  character count".  And the sb_acc is "available character count".
  Consumers of socket buffer API shouldn't already access them directly,
  but use sbused() and sbavail() respectively.
o Not ready mbufs are marked with M_NOTREADY, and ready but blocked ones
  with M_BLOCKED.
o New field sb_fnrdy points to the first not ready mbuf, to avoid linear
  search.
o New function sbready() is provided to activate certain amount of mbufs
  in a socket buffer.

A special note on SCTP:
  SCTP has its own sockbufs.  Unfortunately, FreeBSD stack doesn't yet
allow protocol specific sockbufs.  Thus, SCTP does some hacks to make
itself compatible with FreeBSD: it manages sockbufs on its own, but keeps
sb_cc updated to inform the stack of amount of data in them.  The new
notion of "not ready" data isn't supported by SCTP.  Instead, only a
mechanical substitute is done: s/sb_cc/sb_ccc/.
  A proper solution would be to take away struct sockbuf from struct
socket and allow protocols to implement their own socket buffers, like
SCTP already does.  This was discussed with rrs@.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2014-11-30 12:52:33 +00:00
Dimitry Andric
980e47cff3 Merge ^/head r274961 through r275261. 2014-11-29 18:44:52 +00:00
Enji Cooper
391343f4a2 MF projects/building-blocks r275198:
Use ${.TARGET} instead of hardcoding the name in the dump build rule
2014-11-29 06:53:06 +00:00
Dimitry Andric
344e0332fb Merge ^/head r275118 through r275209. 2014-11-28 13:25:57 +00:00
Enji Cooper
2d561fcbcf Use ${.TARGET} instead of hardcoding the name in the dump build rule 2014-11-27 23:42:32 +00:00
Kevin Lo
8bc29bb269 Init array field in the proper place.
Obtained from:	OpenBSD
2014-11-27 01:37:01 +00:00
Ed Maste
1a559761c7 Update build for LLDB snapshot at upstream rev 216948
Sponsored by:	DARPA, AFRL
2014-11-26 17:40:03 +00:00
Dimitry Andric
1181e9f8a2 After some horrible wrestling with Subversion's worthless merge
implementation, merge ^/head r275078 through r275117.

Note that all the extraneous mergeinfo is there because Subversion
created it.  I'll hopefully be able to remove it again when merging back
to head.
2014-11-26 14:36:04 +00:00
Enji Cooper
466046ec0d Conditionalize a number of components in the tree
- bootparamd
- bootpd
- finger/fingerd
- ftp/ftpd
- hastctl/hastd
- iscsid, et al
- rbootd
- talk/talkd
- tcpd, et al
- tftp/tftpd

Add src.conf entries for the various components and do a best effort
at adding components to tools/build/mk/OptionalObsoleteFiles.inc
2014-11-26 08:44:05 +00:00
Baptiste Daroussin
9c141de192 Convert svn to LIBADD reduce overlinking 2014-11-25 21:43:51 +00:00
Dimitry Andric
2c97f721e7 r274961 through r275075 2014-11-25 21:43:01 +00:00
Baptiste Daroussin
9215669c36 Readd protect(2) removed by mistake
Reported by:	emaste
2014-11-25 14:40:38 +00:00
Baptiste Daroussin
3e11bd9e2a Convert to usr.bin/ to LIBADD
Reduce overlinking
2014-11-25 14:29:10 +00:00
Baptiste Daroussin
39cffbbf4a Forgot to convert demandoc along with mandoc 2014-11-24 23:29:56 +00:00
Baptiste Daroussin
ebadd13c08 Convert mandoc to LIBADD
While here remove the ugly LDMANDOC
2014-11-24 22:12:27 +00:00
Dimitry Andric
046ffce1c3 Update llvm and clang binary Makefiles. 2014-11-24 19:47:59 +00:00
Christian Brueffer
9efc7e72bb Limit descriptors and enter capability mode.
Differential:	D1009
Reviewed by:	jonathan, pjd
MFC after:	2 weeks
Relnotes:	yes
2014-11-24 09:31:38 +00:00
Baptiste Daroussin
15eb6e34a6 Workaround help2man defficiency that prevents mandoc from rendering 2014-11-23 23:17:18 +00:00
Baptiste Daroussin
b8d52ac37c Install mdoc(7) and man(7) from mdoc instead of the one from groff 2014-11-23 22:28:46 +00:00
Baptiste Daroussin
b156563c0c Regenerate the manpage in mdoc(7) format using pod2mdoc
Now mandoc can render the manpage properly
2014-11-23 22:16:43 +00:00
Joel Dahl
d4d112e34a Misc mdoc fixes:
- Remove superfluous paragraph macros.
- Remove/fix empty or incorrect macros.
- Sort sections into conventional order.
- Terminate quoted strings properly.
- Remove EOL whitespace.
2014-11-23 21:00:00 +00:00
Baptiste Daroussin
b43edc06e6 Fix comments 2014-11-23 00:30:32 +00:00
Baptiste Daroussin
f17575acc9 Fix typo 2014-11-23 00:08:43 +00:00
Baptiste Daroussin
d6096801f1 Change man(1) to use mandoc to render manpages
man(1) now first test the manpage to run with mandoc to make sure it can be
rendered.
In case groff cannot be found (because base has been built WITHOUT_GROFF) it
recommands to install groff from the packages
2014-11-23 00:08:04 +00:00
Baptiste Daroussin
c3e5ebe1fc Lower warnings to fix build with gcc 2014-11-22 22:13:00 +00:00
Baptiste Daroussin
71bcdff764 Lower warning to allow building with gcc 2014-11-22 22:11:35 +00:00
Baptiste Daroussin
2421b90f47 Add the demandoc utility from the mandoc project
This is a modern version of the deroff utility, useful for example to do
spellchecking on manpages
2014-11-22 21:11:17 +00:00
Baptiste Daroussin
4357ec0f20 Add the preconv utility from mandoc project
it recodes multibyte UNIX manual files into mandoc(1)
2014-11-22 20:55:36 +00:00
Baptiste Daroussin
6cfe9d90da Rework mandoc Makefile to ease maintainance
Add compat_reallocarray into libmandoc given other mandoc components will use
it.
2014-11-22 20:48:21 +00:00
Baptiste Daroussin
362492e53e Promote SQLite3 as a privatelib as it will also be used by mandoc
While here ensure sqlite3 is using pread(2) and enable the suppot for FTS4
2014-11-22 19:44:49 +00:00
Baptiste Daroussin
d08b6add14 Add missing dependencies on pthread (sqlite being built with threadsafety on) 2014-11-22 19:17:05 +00:00
Baptiste Daroussin
6653664b44 Update mandoc to 1.13.1 2014-11-22 18:57:23 +00:00
Ian Lepore
dbd3f10702 Add libm to eliminate "undefined reference to sqrt" on arm 'softfp' builds. 2014-11-22 14:53:50 +00:00