Commit Graph

772 Commits

Author SHA1 Message Date
Xin LI
fb90888521 Plug a memory leak.
MFC after:	2 weeks
2015-08-13 18:45:52 +00:00
Alexander Motin
0d0def87fe MFV 286707: 5959 clean up per-dataset feature count code
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Matthew Ahrens <mahrens@delphix.com>

illumos/illumos-gate@ca0cc3918a

A ZFS feature flags (large blocks) tracks its refcounts as the number of
datasets that have ever used the feature. Several features of this type
are planned to be added (new checksum functions). This code should be made
common infrastructure rather than duplicating the code for each feature.
2015-08-12 23:59:17 +00:00
Alexander Motin
b696497df0 MFV r286704: 5960 zfs recv should prefetch indirect blocks
5925 zfs receive -o origin=

Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Author: Paul Dagnelie <pcd@delphix.com>

While running 'zfs recv' we noticed that every 128th 8K block required a
read. We were seeing that restore_write() was calling dmu_tx_hold_write()
and the indirect block was not cached. We should prefetch upcoming indirect
blocks to avoid having to go to disk and blocking the restore_write().

Allow an incremental send stream to be received as a clone, even if the
stream does not mark it as a clone.
2015-08-12 22:41:06 +00:00
Alexander Motin
ebf527de10 MFV r286682: 5765 add support for estimating send stream size with
lzc_send_space when source is a bookmark

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: Steven Hartland <killing@multiplay.co.uk>
Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com>
Approved by: Albert Lee <trisk@nexenta.com>
Author: Max Grossman <max.grossman@delphix.com>

illumos/illumos-gate@643da460c8
2015-08-12 18:23:08 +00:00
Alexander Motin
799f47828d MFV 286602: 5810 zdb should print details of bpobj
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Will Andrews <will@freebsd.org>
Reviewed by: Simon Klinkert <simon.klinkert@gmail.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Matthew Ahrens <mahrens@delphix.com>

illumos/illumos-gate@732885fca0
2015-08-10 21:32:40 +00:00
Alexander Motin
57f7c5acf5 MFV 286586: 5746 more checksumming in zfs send
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com>
Approved by: Albert Lee <trisk@omniti.com>
Author: Matthew Ahrens <mahrens@delphix.com>

illumos/illumos-gate@98110f08fa
2015-08-10 19:32:58 +00:00
Alexander Motin
4ff9527edc MFV 286546:
5661 ZFS: "compression = on" should use lz4 if feature is enabled

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Xin LI <delphij@freebsd.org>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Justin T. Gibbs <justing@spectralogic.com>

illumos/illumos-gate@db1741f555
2015-08-09 20:02:16 +00:00
Mark Johnston
7e518a6648 - Use an explicit "depends_on module kernel" guard in DTrace libraries that
reference types defined in the kernel. Otherwise dtrace(1) expects to find
  CTF definitions for all referenced types, which is not very reasonable
  when it is being used in a build environment. This was previously worked
  around by adding "-x nolibs" to dtrace -h or -G invocations, but as of
  r283025, dtrace(1) actually handles dependencies properly, so this is no
  longer necessary.
- Remove "pragma ident" directives from DTrace libraries, as they're being
  phased out upstream as well.

Submitted by:	Krister Johansen <Krister.Johansen@isilon.com> [1]
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-08-07 19:56:22 +00:00
Mark Johnston
d912066c36 Add a src.conf option to build and install the DTrace test suite.
Reviewed by:	gnn, ngie
Differential Revision:	https://reviews.freebsd.org/D3195
2015-08-02 00:37:33 +00:00
Mark Johnston
88f578841f Don't hardcode the module or function component of lockstat probes.
MFC after:	1 week
2015-08-02 00:24:21 +00:00
Mark Johnston
6b9db41be6 - Remove hardcoded paths for the perl executable.
- Rather than assuming that a process is listening on 127.0.0.1:22, use
  nc(1) to find an available port and bind to it for the duration of the
  test.

MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-08-02 00:23:18 +00:00
Mark Johnston
61ab25cd3d Perform bounds checking when constructing a format string.
This was detected by the FORTIFY_SOURCE build.

PR:		201657
Reported by:	pfg
MFC after:	2 weeks
2015-08-02 00:18:48 +00:00
Glen Barber
f5827b16eb Fix a rendering issue in the zfs(8) manual.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2015-07-30 19:34:24 +00:00
Mark Johnston
de2c95cc00 Consistently use a reader/writer flag for lockstat probes in rwlock(9) and
sx(9), rather than using the probe function name to determine whether a
given lock is a read lock or a write lock. Update lockstat(1) accordingly.
2015-07-19 22:24:33 +00:00
Mariusz Zaborski
306a82f8f4 Rename zfs nvpair files to not colidate with our nvlist.
PR:		201356
Approved by:	pjd (mentor)
2015-07-09 21:53:40 +00:00
Ruslan Bukin
b78ee15e9f First cut of DTrace for AArch64.
Reviewed by:	andrew, emaste
Sponsored by:	ARM Limited
Differential Revision:	https://reviews.freebsd.org/D2738
2015-07-01 15:51:11 +00:00
Baptiste Daroussin
18b2ee82db Revert r284417 it is not necessary anymore 2015-06-15 19:28:07 +00:00
Baptiste Daroussin
4232f82668 Enforce overwritting SHLIBDIR
Since METAMODE has been added, sys.mk loads bsd.mkopt.mk which ends load loading
bsd.own.mk which then defines SHLIBDIR before all the Makefile.inc everywhere.

This makes /lib being populated again.

Reported by:	many
2015-06-15 15:34:20 +00:00
Baptiste Daroussin
13500839f2 Fix circular dependency between libzfs and libzfs_core
libzfs_core is the wrapper around kernel ioctls, the ioctl compat code belongs
to it
2015-06-15 10:48:48 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Andriy Gapon
a565264d3c zfs clone should not mount the clone if canmount == noauto
Creation of a new filesystem does not imply an intent to mount it.

Since canmount property is not inherited and its default value is 'on',
the only scenario where this matters is zfs clone -o canmount=noauto.
zfs create -o canmount=noauto already does not mount the new filesystem.

Also see:
https://www.illumos.org/issues/5984
https://reviews.csiden.org/r/228/
dd0e0e69f5
https://github.com/zfsonlinux/zfs/issues/2241

Reviewed by:	mahrens
MFC after:	8 days
Sponsored by:	ClusterHQ
2015-06-12 11:21:35 +00:00
Andriy Gapon
01628dbd09 MFV r284042: 1778 Assertion failed: rn->rn_nozpool == B_FALSE, file
../common/libzfs_import.c, line 1077, function zpool_open_func

illumos/illumos-gate@bd0f709169

Author:		Andrew Stormont <andyjstormont@gmail.com>
MFC after:	13 days
2015-06-12 11:16:43 +00:00
Andriy Gapon
ff7e06fbf4 MFV r284030: 5818 zfs {ref}compressratio is incorrect with 4k sector size
illumos/illumos-gate@81cd5c555f

Author:	Matthew Ahrens <mahrens@delphix.com>
MFC after:	17 days
2015-06-12 10:57:05 +00:00
Andriy Gapon
076dd8eb2e several lockstat improvements
0. For spin events report time spent spinning, not a loop count.
While loop count is much easier and cheaper to obtain it is hard
to reason about the reported numbers, espcially for adaptive locks
where both spinning and sleeping can happen.
So, it's better to compare apples and apples.

1. Teach lockstat about FreeBSD rw locks.
This is done in part by changing the corresponding probes
and in part by changing what probes lockstat should expect.

2. Teach lockstat that rw locks are adaptive and can spin on FreeBSD.

3. Report lock acquisition events for successful rw try-lock operations.

4. Teach lockstat about FreeBSD sx locks.
Reporting of events for those locks completely mirrors
rw locks.

5. Report spin and block events before acquisition event.
This is behavior documented for the upstream, so it makes sense to stick
to it.  Note that because of FreeBSD adaptive lock implementations
both the spin and block events may be reported for the same acquisition
while the upstream reports only one of them.

Differential Revision:	https://reviews.freebsd.org/D2727
Reviewed by:	markj
MFC after:	17 days
Relnotes:	yes
Sponsored by:	ClusterHQ
2015-06-12 10:01:24 +00:00
Marcelo Araujo
217ff3d044 At revision r247852 accidentally was removed from print the variable obj.
While here, declare some global variables as static to silence clang
warnings.

Differential Revision:	D2722
Reviewed by:		delphij, mahrens
2015-06-12 02:16:14 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Mark Johnston
8436cb81cd libdtrace: allow D libraries to declare dependencies on kernel modules
The "depends_on module" pragma can be used to declare a dependency on a
DTrace module, which for kernel probes corresponds to a KLD. Such
dependencies cannot be checked if the KLD is compiled into the kernel.
Therefore, allow a module dependency to be satisfied if either a kernel
module or a KLD with the specified name is loaded.

Differential Revision:	https://reviews.freebsd.org/D2653
Reviewed by:	gnn, rpaulo
Reported by:	gnn
2015-06-06 16:47:45 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Mark Johnston
9b055b7404 lockstat(1): document the -V option.
MFC after:	3 days
2015-05-25 01:18:46 +00:00
Warner Losh
dca3ef63ee Remove stray DEBUG_FLAGS=-g that's been here since the initial import. 2015-05-21 14:36:12 +00:00
Enji Cooper
6b32ba6294 Build cddl/{sbin,usr.bin,usr.sbin} in parallel as all of the applications are
freestanding (they require libraries build via make libraries in buildworld)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-05-20 12:26:09 +00:00
Enji Cooper
2e4335f79b Add dependencies for libzfs_core and libzpool I missed on my first pass on this
Makefile

MFC with: r283144
Sponsored by: EMC / Isilon Storage Division
2015-05-20 11:16:17 +00:00
Enji Cooper
8326c25e61 Articulate dependencies for cddl/lib/libdtrace and cddl/lib/libzfs
Parallelize the build in this subdirectory

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-05-20 11:03:53 +00:00
Baptiste Daroussin
738dbe7419 Reduce overlinking.
Because of libdtrace there is still a bit a overlinking but nothing we can deal
with easily
2015-05-19 22:29:11 +00:00
Baptiste Daroussin
53d5099dfd Correctly link libdtrace and convert to LIBADD
Make dtrace only link to libdtrace
2015-05-19 22:24:19 +00:00
Baptiste Daroussin
32fc46cd6f Convert to LIBADD 2015-05-19 21:59:00 +00:00
Baptiste Daroussin
dc4eeb59c7 Convert to LIBADD
Remove dependency on pthread, it is not needed
2015-05-19 21:57:11 +00:00
Mark Johnston
6bd8f7ee09 Fix a typo that snuck in with r283024, and remove the EXFAIL annotation from
a test which now passes as a result of that change.
2015-05-17 23:09:58 +00:00
Mark Johnston
0fff3baa0b Respect the libdir option when linking drti.o, rather than hardcoding the
default path of /usr/lib(32)/dtrace.

MFC after:	3 weeks
2015-05-17 23:08:01 +00:00
Mark Johnston
81fdad5c0e Actually remove siftr-related definitions from tcp.d, missed in r283026. 2015-05-17 04:17:08 +00:00
Mark Johnston
d4a115af56 Move siftr-related definitions out of tcp.d and into a separate library
which declares a dependency on siftr(4). This is necessitated by a
reference to struct pkt_node, which is defined in siftr(4): otherwise,
dtrace(1) will return an error during startup if siftr.ko is not loaded.
2015-05-17 04:09:22 +00:00
Mark Johnston
f65e699c36 As dtrace(1) processes D libraries under /usr/lib/dtrace, the compiler may
return an error if one of the depends_on directives in a library is not
satisfied. In this case, libdtrace is supposed to ignore the library and
carry on. However, the remainder of the library may still be buffered by
the lexer, causing libdtrace to erroneously continue processing it on the
next call to yyparse(). Fix this by explicitly flushing the input buffer
each time the compiler state is reset.

MFC after:	3 weeks
2015-05-17 03:59:08 +00:00
Mark Johnston
ed09cc1b53 When in lazyload mode, write the DOF to a temporary file and rename it
rather than writing directly to the output file.

CID:	1147172
2015-05-17 03:50:42 +00:00
Mark Johnston
3e5645b78f ctf_add_type(): when looking up an integer or floating point type in the
list of pending dynamic type definitions, a match on the type name is not
sufficient - we need to compare the type encodings as well. For example,
bitfields have their own distinct type definitions which share the name of
the underlying integer type, and these types aren't generally
interchangeable.

This bug was causing the following libdtrace error when attempting to trace
the th_flags member of a struct tcphdr:
  cg: bad field: off 104 type <32877> bits 539620016

Reported by:	rwatson
MFC after:	3 weeks
2015-05-10 21:39:24 +00:00
George V. Neville-Neil
981ad3ecf9 Brief demo script showing the various values that can be read via
the new SIFTR statically defined tracepoint (SDT).

Differential Revision:	https://reviews.freebsd.org/D2387
Reviewed by:	bz, markj
2015-04-29 17:19:55 +00:00
Andriy Gapon
551652b60c dump_nvlist: handle DATA_TYPE_BOOLEAN_ARRAY
To do:	upstream (https://www.illumos.org/issues/5752)
MFC after:	10 days
2015-04-28 06:33:42 +00:00
Mark Johnston
b9d64941fb Add manual pages for the io, ip, proc, sched, tcp and udp DTrace providers.
The format of these pages is somewhat experimental, so they may be subject
to further tweaking.

Differential Revision:	https://reviews.freebsd.org/D2170
Reviewed by:	bcr, rpaulo
MFC after:	2 weeks
2015-04-18 21:00:36 +00:00
Baptiste Daroussin
4620173a5f Convert cftmerge to LIBADD and remove link on libdwarf which is not needed 2015-04-09 21:08:21 +00:00
Mark Johnston
67cf27b70f libdtrace: add support for lazyload mode.
Passing "-x lazyload" to dtrace -G during compilation causes dtrace(1) to
not link drti.o into the output object file, so the USDT probes are not created
during process startup. Instead, dtrace(1) will automatically discover and
create probes on the process' behalf when attaching.

Differential Revision:	https://reviews.freebsd.org/D2203
Reviewed by:		rpaulo
MFC after:		1 month
2015-04-08 02:36:37 +00:00
Mark Johnston
28cb2a5f4b Fix a misparenthesization that could cause a crash if TERM is not set.
Reported by:	Coverity (internal)
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2015-03-31 02:49:05 +00:00
Mark Johnston
16a62fc514 Fix ping(8) and ping6(8) usage in a couple of ip provider tests, and
update expected test output to reflect differences in default TTL and
payload length.

MFC after:	1 week
2015-03-30 04:06:36 +00:00
Mark Johnston
3f05af05ac Fix ping(8) usage in funcs/tst.system.d so that the test actually completes.
MFC after:	1 week
2015-03-30 04:03:01 +00:00
Mark Johnston
41aeaf2a30 Replace dtest.pl, the upstream DTrace test suite harness, with a shell
script. This reimplementation is much simpler than dtest.pl and is more
amenable to being run under Kyua - dtest.pl writes error output to a
temporary directory that is deleted when the run finishes, making it hard
to debug test failures. This change also removes the test suite's dependency
on perl.
2015-03-30 04:01:49 +00:00
Mark Johnston
784d339257 tcp provider tests: sleep for a bit after closing the socket so that
libdtrace has a chance to capture the traced data.

MFC after:	1 week
2015-03-28 01:11:18 +00:00
Mark Johnston
ad6fc754f3 Add a missing format string argument.
PR:		197391
MFC after:	3 days
2015-03-15 21:57:44 +00:00
Mark Johnston
f810bf0eaf When copying a type from a source CTF container to a destination container,
ctf_add_type() first performs a by-name lookup of the type in the
destination container. If this lookup returns a forward declaration for an
enum, struct, or union, reset dst_type back to CTF_ERR, indicating that the
source type is not in fact present in the destination container. This
ensures that ctf_add_type() will also search the destination container's
dynamic type list for the source type.

Without this change, a pair of mutually recursive struct definitions could
cause infinite recursion in ctf_add_type() if the destination container
only contained forward declarations for the struct types: ctf_add_type()
recursively calls itself on each struct member's type, and the forward
declarations meant that the dynamic type list search would be skipped.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-03-11 00:01:39 +00:00
Mark Johnston
b0ee912984 CTF containers use the ctf_dtoldid field as a threshold type index which
indicates the range of type indices which have been committed to the
container by ctf_update(). However, the top bit of the dtd_type field is
not part of the type index; rather, it is a flag used to indicate that the
corresponding CTF container is a parent. This is why the maximum CTF type
index is 2^15 - 1 rather than 2^16 - 1. Therefore, this flag must be masked
off (using the CTF_TYPE_TO_INDEX macro) when comparing a type index with the
ctf_dtoldid field of a container.

This bug was causing libctf to erroneously free committed type definitions
in ctf_discard(). libdtrace holds some references to such types, resulting
in a use-after-free.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-03-10 21:08:58 +00:00
Mark Johnston
ba8d15d3a8 ctf_discard(): fetch the next list element before restarting the loop. If
we end up skipping a dynamic type because it has already been committed to
the container, we would previously either set the loop variable to an
uninitialized local variable, or set it to itself, resulting in an infinite
loop.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-03-10 20:52:03 +00:00
Mark Johnston
26a222dc0c MFV r279822:
This merge is effectively a no-op since parts of it are already present
in FreeBSD, and the rest is incorrect since gelf_newehdr(3) and
gelf_newphdr(3) return pointers on FreeBSD rather than integers.

Illumos issue:
    5589 improper use of NULL in tools/ctf

MFC after:	3 days
2015-03-10 20:43:16 +00:00
George V. Neville-Neil
6b031ddd14 Summary: Remove the need for `mpid which is Illumos/Solaris specific. 2015-03-08 21:51:37 +00:00
Mark Johnston
4ddbe5ac37 Add infrastructure to integrate the DTrace test suite with Kyua.
For each test category, we generate a script containing ATF test cases for
the tests under that category. Each test case simply runs dtest.pl (the
upstream test harness) with the corresponding test files. The exclude.sh
script is used to record info about tests which should be skipped or are
expected to fail; it is used to generate atf_skip and atf_expect_fail calls.
The genmakefiles.sh script can be used to regenerate the test makefiles when
new tests are brought it from upstream.

The test suite is currently not connected to the build as there is a small
number of lingering test issues which still need to be worked out. In the
meantime however, the test suite can be easily built and installed
manually from cddl/usr.sbin/dtrace/tests.

Reviewed by:	ngie
Sponsored by:	EMC / Isilon Storage Division
2015-02-28 23:30:06 +00:00
Mark Johnston
d914572890 Use the -shared option to create a shared library.
MFC after:	1 week
2015-02-28 23:14:35 +00:00
Mark Johnston
24d6f0ffa5 Remove a leading tab that causes a make(1) error when running the test.
MFC after:	1 week
2015-02-28 23:11:18 +00:00
Mark Johnston
8ddb6d86de Only kill sleep processes that were forked from the test script.
MFC after:	1 week
2015-02-28 23:10:26 +00:00
Mark Johnston
2c4c1a261e Stop hard-coding an incorrect path to rm(1).
MFC after:	1 week
2015-02-28 23:09:01 +00:00
David E. O'Brien
01b792f1f5 These CTF tools do not use anything from libctf, so no need to link with it. 2015-02-27 22:10:31 +00:00
Xin LI
a51314a22f Set altroot if the user have specified it via -o altroot.
MFC after:	2 weeks
2015-02-27 19:13:13 +00:00
Mark Johnston
03a5f9f0fd Remove drti.o's dependency on libelf. This makes it possible to add DTrace
probes to userland programs and libraries without also needing to link
libelf.

dtrace -G places the __SUNW_dof symbol at the beginning of the DOF (DTrace
probe and provider metdata) section in the generated object file; drti.o
now just uses this symbol to locate the section. A complication occurs
when multiple dtrace-generated object files are linked together, since the
__SUNW_dof symbol defined in each file is global. This is handled by
using objcopy(1) to convert __SUNW_dof to a local symbol once drti.o has
been linked with the generated object file. Upstream, this is done using a
linker feature not present in GNU ld.

Differential Revision:	https://reviews.freebsd.org/D1757
Reviewed by:	rpaulo
MFC after:	1 month
Relnotes:	yes
2015-02-18 03:54:54 +00:00
Mark Johnston
c537027e53 Tweak the fds test program so that it actually compiles. Also use 0 instead
of -1 for the bogus ioctl command so that dmesg doesn't get spammed with
sign extension warnings when the test program runs.

MFC after:	1 week
2015-02-14 00:03:43 +00:00
George V. Neville-Neil
fcb5606706 Initial version of DTrace on ARM32.
Submitted by:	Howard Su based on work by Oleksandr Tymoshenko
Reviewed by:	ian, andrew, rpaulo, markj
2015-02-10 19:41:30 +00:00
Mark Johnston
feb031ce37 Avoid hard-coding a path to ksh in scripts that are executed directly by
the test harness. This is a problem in many of the *.ksh test scripts as
well, but those scripts are executed using a shell whose path is specified
in dtest.pl, so there's no need to modify them.

MFC after:	1 week
2015-02-03 06:22:46 +00:00
Mark Johnston
6ac0e4858a Let the standard deviation of the empty set be 0. This is consistent with
the behaviour for averages, and fixes a crash that can occur when attempting
to print a stddev aggregation containing no elements:

    dtrace:::BEGIN { @ = stddev(0); clear(@); printa("%@d", @); }

PR:		197260
MFC after:	2 week
2015-02-02 20:48:31 +00:00
Mark Johnston
072ff34e71 Fix mktemp(1) usage.
MFC after:	1 week
2015-01-31 23:12:29 +00:00
Mark Johnston
dfae589ef3 Use syscall::exit instead of the nonexistent syscall::rexit.
MFC after:	1 week
2015-01-31 23:11:57 +00:00
Mark Johnston
d040338533 Remove hard-coded invocations of gcc; use cc(1) instead.
MFC after:	1 week
2015-01-31 23:02:27 +00:00
Mark Johnston
1bc414c30e Remove a makefile that isn't present upstream.
MFC after:	1 week
2015-01-31 22:56:38 +00:00
Mark Johnston
0feb85424f Fix a number of DTrace scripting tests:
* Avoid hard-coding program paths.
* Use -x when searching for oneself in ps(1) output.
* Use the correct keyword (egid instead of pgid) in tst.egid.ksh.

MFC after:	1 week
2015-01-31 22:53:18 +00:00
Mark Johnston
9ed9976cd9 Fix some proc provider tests:
* Avoid hard-coding program paths, except when it's necessary in order to
  override the use of a shell builtin.
* Translate struct proc through psinfo_t so that we can access process
  arguments via the pr_psargs field of psinfo_t.
* Replace uses of pstop and prun with kill(1).

MFC after:	1 week
2015-01-31 22:38:43 +00:00
Mark Johnston
2afbb2e1b8 pause() isn't a system call on FreeBSD; use sigsuspend(2) instead.
MFC after:	1 week
2015-01-30 05:14:01 +00:00
Mark Johnston
c0d678c9dd The DTrace harness (dtest.pl) executes DTrace scripts with the -C flag,
which causes dtrace(1) to run the C preprocessor on input scripts before
executing them. Suppress some warnings emitted by the preprocessor which are
confusing the DTrace lexer tests.

MFC after:	1 week
2015-01-30 04:41:49 +00:00
Mark Johnston
6e9584fd15 Include required headers in DTrace test programs.
MFC after:	1 week
2015-01-30 04:37:57 +00:00
Mark Johnston
bc8eecf7d4 Replace Solaris identifiers and types with their FreeBSD equivalents.
MFC after:	1 week
2015-01-30 04:30:18 +00:00
Mark Johnston
7c39b67011 Use the correct field when reading the PID out of a struct proc.
MFC after:	1 week
2015-01-30 04:14:19 +00:00
Mark Johnston
ea2e7ddab1 When searching for an accompanying test program, look in the directory
containing the test script rather than the current directory. This is needed
in order to run the DTrace tests under Kyua.

MFC after:	1 week
2015-01-30 04:11:30 +00:00
Enji Cooper
9f02b3ec86 Follow up to r277449 by fixing the remaining NSEC_TO_TICK macro to have the same
named parameters

Reported by: Ben Perrault <ben.perrault@gmail.com>, Willem Jan Withagen <wjw@digiware.nl>
2015-01-21 10:47:28 +00:00
Xin LI
10a7450a2f MFV r277432:
Plug various memory leaks in libzfs import implementation.

Illumos issue:
    5518 Memory leaks in libzfs import implementation

MFC after:	2 weeks
2015-01-20 20:36:36 +00:00
Steven Hartland
bc96366c86 Mechanically convert cddl sun #ifdef's to illumos
Since the upstream for cddl code is now illumos not sun, mechanically
convert all sun #ifdef's to illumos #ifdef's which have been used in all
newer code for some time.

Also do a manual pass to correct the use if #ifdef comments as per style(9)
as well as few uses of #if defined(__FreeBSD__) vs #ifndef illumos.

MFC after:	1 month
Sponsored by:	Multiplay
2015-01-17 14:44:59 +00:00
Steven Hartland
828a2d9e5a Eliminate illumos whole disk special case when searching for a ZFS vdev
This special case prevented locating vdevs which start with c[0-9] e.g.
gptid/c6cde092-504b-11e4-ba52-c45444453598 hence it was impossible to
online a vdev via its path.

Submitted by:	Peter Xu <xzpeter@gmail.com>
MFC after:	2 weeks
Sponsored by:	Multiplay
2015-01-16 10:44:39 +00:00
Mark Johnston
db3cb3640f Revert r274569. It seems to be causing a crash when merging CTF data for
recent i386 GENERIC kernels.

Reported by:	David Wolfskill
2015-01-08 18:45:16 +00:00
Steven Hartland
7234ef453b Use the correct state name for unavailable pools in zpool list
This corrects inconsitencies between zpool list and zpool status which are
both described as displaying the pool <state> however zpool list would use
this hardcoded FAULTED instead of the correct UNAVAIL.

MFC after:	1 month
2014-12-31 04:11:29 +00:00
Joel Dahl
f7e00d4bbd mdoc: remove EOL whitespace. 2014-12-29 13:50:59 +00:00
Justin Hibbits
b08e2b04fe Add PowerPC64 function descriptor support for dt_link.c
Summary:
PowerPC64 uses function descriptors in a section .opd, exporting the descriptors
to the symbol table.  This adds support for these into dt_link.c so that dtrace
USDT probes can be compiled.

Test Plan:
Tested only on powerpc64.  No regression testing has been performed, so I want
someone with x86 hardware to regression test this.

Tested on amd64 by markj

Reviewers: #dtrace, markj

Reviewed By: #dtrace, markj

Subscribers: markj

Differential Revision: https://reviews.freebsd.org/D1267

MFC after:	3 weeks
2014-12-28 06:41:13 +00:00
Joel Dahl
4990a1c050 mdoc: improvements to SEE ALSO. 2014-12-27 08:31:52 +00:00
Mark Johnston
003e64df93 DOF tables are aligned according to the DOF section's alignment constraint,
so take this into account when iterating over DOF tables.

PR:		195555
Submitted by:	Fedor Indutny <fedor@indutny.com> (original version)
MFC after:	1 week
2014-12-26 18:53:29 +00:00
Steven Hartland
ec1b033c60 Enhancements to zpool upgrade processing
Introduce a seperate phase to list all unavailable pools when listing
pools to upgrade. This avoids confusing output when displaying older
and disabled feature pools. These existing phases now silently skip
unavailable pools.

Introduce cb_unavail to upgrade_cbdata_t which enables the final
output for zpool list to correctly detail if all pools or only all
available pools where up-to-date on version / features.

Correct the type of upgrade_cbdata_t.cb_first from int -> boolean_t.

Change the pool iteration when upgrading named pools to include
unavailable pools and update upgrade_one so it doesn't try to upgrade
unavailable pools but warns about them. This allows the correct error
to be displayed as well as upgrades with available and unavailable
pools intermixed to partially complete.

Also correct some missing trailing \n's from output in upgrade_one.

MFC after:	1 month
X-MFC-With:	r276194
2014-12-26 01:12:02 +00:00
Steven Hartland
fce5da5f71 Prevent zpool upgrade failing due to unavailable pools
Prior to this fix "zpool upgrade" and "zpool upgrade -a" would fail due to
an assert when operating on unavailable pools.

We now print a warning to stderr but allow the processing of other pools
to procesed.

MFC after:	1 month
2014-12-25 02:17:17 +00:00
Mark Johnston
2f6cde8eb4 We can stop iterating once we've found the DOF section.
Submitted by:	Fedor Indutny <fedor@indutny.com>
2014-12-23 15:42:33 +00:00
Will Andrews
9ad184a98c Initialize an argument to NULL instead of expecting dlinfo() to do it.
dlinfo() is a weak reference that may not be initialized at the time of
execution. The default implementation (in lib/libc/gen/dlfcn.c) neither
modifies the address pointed to by the third argument nor returns an error.

Differential Revision:	https://reviews.freebsd.org/D1326
Reviewed by:		markj
MFC after:		1 week
2014-12-17 00:22:41 +00:00
Xin LI
51515b6d7c MFV r275784:
Plug a memory leak in libzfs.  In zfs_iter_bookmarks, an nvlist is allocated
before calling lzc_get_bookmarks, which allocates the nvlist again (and
overwrites the pointer to previously allocated list).

Illumos issue:
    5427 memory leak in libzfs when doing rollback

MFC after:	2 weeks
2014-12-15 18:28:22 +00:00
Xin LI
a771fba68c MFV r275783:
Convert ARC flags to use enum.  Previously, public flags are defined in
arc.h and private flags are defined in arc.c which can lead to confusion
and programming errors.

Consistently use 'hdr' (when referencing arc_buf_hdr_t) instead of 'buf'
or 'ab' because arc_buf_t are often named 'buf' as well.

Illumos issue:
    5369 arc flags should be an enum
    5370 consistent arc_buf_hdr_t naming scheme

MFC after:	2 weeks
2014-12-15 18:22:45 +00:00