Commit Graph

16982 Commits

Author SHA1 Message Date
John Baldwin
7f911abe54 Add support to libkvm for reading vmcores from other architectures.
- Add a kvaddr_type to represent kernel virtual addresses instead of
  unsigned long.
- Add a struct kvm_nlist which is a stripped down version of struct nlist
  that uses kvaddr_t for n_value.
- Add a kvm_native() routine that returns true if an open kvm descriptor
  is for a native kernel and memory image.
- Add a kvm_open2() function similar to kvm_openfiles().  It drops the
  unused 'swapfile' argument and adds a new function pointer argument for
  a symbol resolving function.  Native kernels still use _fdnlist() from
  libc to resolve symbols if a resolver function is not supplied, but cross
  kernels require a resolver.
- Add a kvm_nlist2() function similar to kvm_nlist() except that it uses
  struct kvm_nlist instead of struct nlist.
- Add a kvm_read2() function similar to kvm_read() except that it uses
  kvaddr_t instead of unsigned long for the kernel virtual address.
- Add a new kvm_arch switch of routines needed by a vmcore backend.
  Each backend is responsible for implementing kvm_read2() for a given
  vmcore format.
- Use libelf to read headers from ELF kernels and cores (except for
  powerpc cores).
- Add internal helper routines for the common page offset hash table used
  by the minidump backends.
- Port all of the existing kvm backends to implement a kvm_arch switch and
  to be cross-friendly by using private constants instead of ones that
  vary by platform (e.g. PAGE_SIZE).  Static assertions are present when
  a given backend is compiled natively to ensure the private constants
  match the real ones.
- Enable all of the existing vmcore backends on all platforms.  This means
  that libkvm on any platform should be able to perform KVA translation
  and read data from a vmcore of any platform.

Tested on:	amd64, i386, sparc64 (marius)
Differential Revision:	https://reviews.freebsd.org/D3341
2015-11-27 18:58:26 +00:00
John Baldwin
9789cd30e5 Remove trailing whitespace. 2015-11-26 19:42:10 +00:00
John Baldwin
8296e78c83 Remove kvm_sparc.c. This is for 32-bit sparc support and was imported
from 4.4BSD.  It has never been used by FreeBSD.
2015-11-26 19:39:15 +00:00
Bryan Drewery
0d9e60c857 Always build libevent, which fixes the build for usr.sbin/ypldap after r291230.
The dependency for ypldap is only with WITH_NIS, but libevent is small
enough to not warrant the extra logic and maintenance cost here so just
always build it.

Sponsored by:	EMC / Isilon Storage Division
2015-11-26 01:54:09 +00:00
Bryan Drewery
7fdd45b091 Use LIBEXECDIR for /usr/libexec.
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-11-26 01:14:40 +00:00
Bryan Drewery
c196e3988a Follow-up r291330: h_testbits.h is only needed by xdr_test.
X-MFC-With:	r291330
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-11-25 22:33:25 +00:00
Enji Cooper
45d1fa1891 Link fclose(3) to fdclose(3)
X-MFC with: r285140
MFC after: 3 weeks (need to evaluate whether or not r285140 can be MFCed)
Sponsored by: EMC / Isilon Storage Division
2015-11-25 22:07:18 +00:00
Bryan Drewery
114350b9de Replace DPSRCS that work fine in SRCS.
This is so that 'make depend' is not a required build step in these
files.

DPSRCS is overall unneeded.  DPSRCS already contains SRCS, so anything
which can safely be in SRCS should be.  DPSRCS is mostly just a way to
generate files that should not be linked into the final PROG/LIB.  For
headers and grammars it is safe for them to be in SRCS since they will
be excluded during linking and installation.

The only remaining uses of DPSRCS are for generating .c or .o files that
must be built before 'make depend' can run 'mkdep' on the SRCS c files
list.  A semi-proper example is in tests/sys/kern/acct/Makefile where a
checked-in .c file has an #include on a generated .c file.  The
generated .c file should not be linked into the final PROG though since
it is #include'd.  The more proper way here is just to build/link it in
though without DPSRCS.  Another example is in sys/modules/linux/Makefile
where a shell script runs to parse a DPSRCS .o file that should not be
linked into the module.  Beyond those, the need for DPSRCS is largely
unneeded, redundant, and forces 'make depend' to be ran.  Generally,
these Makefiles should avoid the need for DPSRCS and define proper
dependencies for their files as well.

An example of an improper usage and why this matters is in usr.bin/netstat.
nl_defs.h was only in DPSRCS and so was not generated during 'make all',
but only during 'make depend'.  The files including it lacked proper
depenencies on it, which forced running 'make depend' to workaround that
bug.  The 'make depend' target should mostly be used for incremental build
help, not to produce a working build.  This specific example was broken in
the meta build until r287905 since it does not run 'make depend'.

The gnu/lib/libreadline/readline case is fine since bsd.lib.mk has 'OBJS:
SRCS:M*.h' when there is no .depend file.

Sponsored by:	EMC / Isilon Storage Division
MFC after:	1 week
2015-11-25 20:38:17 +00:00
Bryan Drewery
277fbb92d5 Remove redundant DPSRCS which were already in SRCS.
DPSRCS already contains all of SRCS.

MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-11-25 20:38:07 +00:00
Bryan Drewery
c2a55defd7 META MODE: Avoid dirdep dependency on lib/libmd.
This avoids using the staged headers for sys/crypto/sha2/*.h, such as sha256.h,
which added an unneeded pre-build dependency on libmd to libcrypt.  This
header is an INCS in lib/libmd, but found via .PATH in sys/crypto/sha2.
Since the libcrypt build was already using the in-src libmd headers
directly, just teach it how to find the sha256.h header as well.

Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:45:04 +00:00
Bryan Drewery
5a0d38b3aa META MODE: Remove unneeded libmd.host dependency for xinstall.host.
This is chasing r291026.

Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:44:55 +00:00
Bryan Drewery
4aa63711a7 META MODE: Fix 'make bootstrap-tools'.
The main problem was bitrot after elftoolchain being swapped in for the
GNU toolchain.

This also reworks how the list of 'host allowed' libraries is determined
to only allow INTERNALLIBs, which is needed for libelftc to come in.

For usr.bin/readelf use the same hack, as libelf and libdward, to bring in
the needed sys/ headers for host builds.  This has not yet been a problem due
to readelf not being built as a host tool in buildworld.  This is possible
in the meta build though when building the toolchain.

Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:44:51 +00:00
Bryan Drewery
b791fbe630 META MODE: Don't create .meta files when symlinking sources into the obj directory.
Tracking these leads to situations where meta mode will consider the
file to be out of date if /bin/sh or /bin/ln are newer than the source
file.  There's no reason for meta mode to do this as make is already
handling the rebuild dependency fine.

Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:44:43 +00:00
Bryan Drewery
db548a6148 META MODE: Rework circular dependency guard for librtld_db/libproc.
librtld_db only needs libutil.h to build, not the libproc library.  So
it can safely use its header and allow libproc to depend on librtld_rb
to be built first to link.  This is required after fixing ld --sysroot
in r291226.

Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:13:35 +00:00
Bryan Drewery
7b3ea376a2 META MODE: Prefer INSTALL=tools/install.sh to lessen the need for xinstall.host.
This both avoids some dependencies on xinstall.host and allows
bootstrapping on older releases to work due to lack of at least 'install -l'
support.

Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:10:28 +00:00
Enji Cooper
0b5cc81d3b Link localeconv(3) to localeconv_l(3)
MFC after: 3 days
2015-11-25 09:12:30 +00:00
Bryan Drewery
6a270e17f3 Remove unneeded libutil dependency for sendmail.
It included libutil.h for setproctitle(3), which was moved from libutil to libc
in r65353 in 2000.

Reviewed by:	gshapiro [sendmail change]
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D4261
2015-11-24 04:19:55 +00:00
Dag-Erling Smørgrav
2e59a758fd markup fixes 2015-11-23 12:47:08 +00:00
Enji Cooper
2b4bcea740 Use __MAKE_SHELL instead of HOST_SHELL when generating aton_ether_subr.c
(HOST_SHELL is used in NetBSD)

This fixes permission denied issues when gen_ether_subr is not executable

MFC after: 3 days
Reported by: José Pérez <fbl@aoek.com>
Suggested by: bdrewery, sjg
2015-11-23 07:57:41 +00:00
Xin LI
fe50a38eb0 MFV r291123:
xz 5.2.2.

MFC after:	1 month
Relnotes:	yes
2015-11-21 09:09:25 +00:00
Ravi Pokala
3945141fa2 popen() requires check for fdopen() failure
Move fdopen() up near other resource allocation like malloc(); do proper
deallocation on failure later on in the function.

Submitted by:	Ramachandra Topannavar <rtopannavar@panasas.com>
Reviewed by:	jilles
Approved by:	jhb (mentor)
MFC after:	2 weeks
Sponsored by:	Panasas, Inc.
Differential Revision:	https://reviews.freebsd.org/D4126

M    lib/libc/gen/popen.c
2015-11-20 22:36:41 +00:00
Marcelo Araujo
c1dfca84c6 If a NIS server has long entries on its database that is bigger than
1024 specified on YPMAXRECORD the ypmatch can get in an infinite retry
loop when is requesting the information from the NIS server.

The ypmatch(1) will return an error until the command receives an
kill(1).

To avoid this problem, we check the MAX_RETRIES that is by default set
to 20 and avoid get in infinet loop at the client side.

NOTE: FreeBSD nis(8) server doesn't present this issue.

Submitted by:	Ravi Pokala <rpokala@panasas.com>,
		Lakshmi N. Sundararajan <lakshmi.n@msystechnologies.com>,
		Lewis, Fred <flewis@panasas.com>,
		Pushkar Kothavade <pushkar.kothavade@msystechnologies.com>
Approved by:	bapt (mentor)
MFC after:	1 month
Differential Revision:	D4095
2015-11-19 13:36:53 +00:00
Enji Cooper
dc5c5b1da8 Do not print out errno if the call succeeded unexpectedly; this was a mistake
made in r290868

MFC after: 4 days
X-MFC with: r290563, r290868
Reported by: jilles
Sponsored by: EMC / Isilon Storage Division
2015-11-18 23:42:44 +00:00
Craig Rodrigues
fa3d9adad2 Temporarily comment out the libcrypt tests.
They are emitting characters which are triggering
a kyua bug which causes kyua to emit invalid XML.
This invalid XML is causing false failures in Jenkins.

On a separate note, kyua needs to be fixed with this:
  https://github.com/jmmv/kyua/pull/148
or something similar.
2015-11-18 13:19:34 +00:00
Jonathan T. Looney
e64ba55dd2 Change the driver stats to what they really are: unsigned values.
When pmcstat exits after some samples were dropped, give the user an
idea of how many were lost. (Granted, these are global numbers, but
they may still help quantify the scope of the loss.)

Differential Revision:	https://reviews.freebsd.org/D4123
Approved by:	gnn (mentor)
MFC after:	1 month
Sponsored by:	Juniper Networks
2015-11-16 15:16:09 +00:00
Enji Cooper
f443c488b0 Add some initial tests for SLIST and STAILQ macros
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-11-16 04:15:39 +00:00
Enji Cooper
e514d4718a Integrate contrib/netbsd-tests/lib/libcrypt/t_crypt.c in to the FreeBSD
test suite as lib/libcrypt/crypt_test

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-11-16 04:06:14 +00:00
Baptiste Daroussin
4ba17eaff6 Fix unused-but-set-variable
Spotted by:	gcc 5.2
2015-11-15 20:44:22 +00:00
Enji Cooper
bea1d37ed7 Disable -Wformat with scanfloat_test when compiling with gcc to avoid a
"use of assignment suppression and length modifier together in scanf format"
warning on line 90 (it's intentional)

MFC after: 1 week
X-MFC with: r290537, r290856, r290860
Sponsored by: EMC / Isilon Storage Division
2015-11-15 18:56:58 +00:00
Enji Cooper
0fc72683be Fix -Wformat issues
X-MFC with: r290563
MFC after: 1 week
Reported by: gcc
Sponsored by: EMC / Isilon Storage Division
2015-11-15 18:45:04 +00:00
Baptiste Daroussin
95631a07b2 Remove unused variables to fix building world 2015-11-15 12:48:42 +00:00
Enji Cooper
6157e90c35 Change WARNS to 2 across the board with all the libc testcases
This effectively "reverts" r290846

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-11-15 05:21:58 +00:00
Enji Cooper
dd3d75ba5f Fix -Wmissing-braces warnings by adding braces around all the
testcase inputs

MFC after: 1 week
X-MFC with: r290572
Sponsored by: EMC / Isilon Storage Division
2015-11-15 05:13:33 +00:00
Enji Cooper
397f4a0de5 Fix -Wunused warnings
MFC after: 1 week
X-MFC with: r290572
Sponsored by: EMC / Isilon Storage Division
2015-11-15 05:02:41 +00:00
Enji Cooper
e426f1f48f Bump WARNS to 2
MFC after: 1 week
X-MFC with: r290532
Sponsored by: EMC / Isilon Storage Division
2015-11-15 04:51:14 +00:00
Enji Cooper
c384ef563e Remove unused variables; sort by alignment where needed
MFC after: 1 week
X-MFC with: r290532
Sponsored by: EMC / Isilon Storage Division
2015-11-15 04:50:54 +00:00
Enji Cooper
a244e42201 Polish up iswctype_test
- Split up the testcases into C locale and ja_JP.eucJP testcases.
- Avoid a segfault in the event that setlocale fails, similar to r290843
- Replace `sizeof(x) / sizeof(*x)` pattern with `nitems(x)`

MFC after: 1 week
X-MFC with: r290532
Sponsored by: EMC / Isilon Storage Division
2015-11-15 04:50:08 +00:00
Enji Cooper
cc4ac19cb0 Polish up the tests a bit more after projects/collation was merged to head
Provide more meaningful diagnostic messages if LC_CTYPE can't be set properly
instead of segfaulting, because setlocale returns NULL and strcmp(NULL, b) will
always segfault

Split up the testcases so one failing (in this case en_US.ISO8859-15) won't
cause the rest of the testcases to be skipped

Remove some unused variables

MFC after: 1 week
X-MFC with: r290532
Sponsored by: EMC / Isilon Storage Division
2015-11-15 04:33:14 +00:00
Enji Cooper
252f1a84f7 Fix the Indian numbering system (hi_IN.ISCII-DEV) tests
Submitted by: ache
X-MFC with: r290494 (if that ever happens)
Sponsored by: EMC / Isilon Storage Division
2015-11-15 03:56:09 +00:00
Craig Rodrigues
677640a2fa Fix bootstrapping of libopenbsd on build hosts where KERN_PROC_NFDS
it not defined.
2015-11-14 23:43:59 +00:00
Craig Rodrigues
649e1da360 Add imsg to libopenbsd.
This will help with importing OpenBSD programs such as ypldap
into the base system.
2015-11-14 23:13:15 +00:00
Craig Rodrigues
1bbc47cb35 Implemtn getdtablecount() to count open file descriptors for current process.
Use underlying sysctl implemented by mjg in r290473.

PR:                    194985
Reviewed by:           bapt, mjg
Differential Revision: https://reviews.freebsd.org/D4084
2015-11-14 23:07:38 +00:00
Andrey A. Chernov
0856628198 1) Remove my overcomplicated error fallback and just return error
immediatelly as old code does, now for append modes too.
Real use case for such fallback is impossible (unless specially crafted).

2) Remove now unneded include I forgot to remove in prev. commits.

MFC after:      1 week
2015-11-12 22:24:39 +00:00
Enji Cooper
79346959a2 Add missing licensing boilerplate to test-fnmatch.c
Carry over licensing author info from fnmatch_test.c (jilles@)

MFC after: 1 week
X-MFC with: r290572
Sponsored by: EMC / Isilon Storage Division
2015-11-10 11:28:02 +00:00
Baptiste Daroussin
87101cb572 return "US-ASCII" instead of "POSIX" for "C" and "POSIX" locales
as it used to be in previous version of the locales. Returning
"POSIX" has too many fallouts.
2015-11-10 08:11:27 +00:00
Baptiste Daroussin
403105944d nl_langinfo: Simplify case ladder
The NONE:US-ASCII case isn't necessary.  The "NONE:" case will handle
US-ASCII, so let's remove the redundant handling.

Submitted by:	marino
Obtained from:	DragonflyBSD
2015-11-09 22:29:47 +00:00
Baptiste Daroussin
22b87a3555 Readd ascii.c forgotten in r290618 2015-11-09 22:11:37 +00:00
Baptiste Daroussin
473aa0b7ee locales: Enforce US-ASCII encoding (limited to 7-bit)
The US-ASCII format was getting treated identically to POSIX.  It is
supposed to throw an ILSEQ errno if a value of 0x80 or greater is
encountered, so let's bring back the "ASCII" handling.

While here, change nl_codeset to return US-ASCII only when the encoding
really is "US-ASCII".  Before "C" and "POSIX" encoding returned this
string, so now they return "POSIX".

Discussed with:	ache
Submitted by:	marino
Obtained from:	DragonflyBSD
2015-11-09 22:06:22 +00:00
Enji Cooper
fdb319ca66 Bump .Dd 2015-11-09 10:41:27 +00:00
Enji Cooper
6922f80018 Document powl(3)
PR: 191751
Sponsored by: EMC / Isilon Storage Division
2015-11-09 10:40:16 +00:00