Sync to HEAD@r274766

This commit is contained in:
Alexander V. Chernikov 2014-11-21 01:22:33 +00:00
commit 4d56c133fb
696 changed files with 9213 additions and 10923 deletions

View File

@ -48,7 +48,6 @@ cd(4) ken Pre-commit review requested.
pass(4) ken Pre-commit review requested.
ch(4) ken Pre-commit review requested.
em(4) jfv Pre-commit review requested.
bxe(4) davidch Pre-commit review requested.
tdfx(4) cokane Just keep me informed of changes, try not to break it.
sendmail gshapiro Pre-commit review requested.
etc/mail gshapiro Pre-commit review requested.
@ -81,6 +80,8 @@ contrib/pf glebius Pre-commit review recommended.
file obrien Insists to keep file blocked from other's unapproved
commits
contrib/bzip2 obrien Pre-commit review required.
contrib/netbsd-tests freebsd-testing,ngie Pre-commit review requested.
contrib/pjdfstest freebsd-testing,ngie Pre-commit review requested.
geom_concat pjd Pre-commit review preferred.
geom_eli pjd Pre-commit review preferred.
geom_gate pjd Pre-commit review preferred.

View File

@ -1447,12 +1447,31 @@ NXBMAKE= ${NXBENV} ${MAKE} \
MK_CLANG_FULL=no MK_LLDB=no
native-xtools: .MAKE
mkdir -p ${OBJTREE}/nxb-bin/bin
mkdir -p ${OBJTREE}/nxb-bin/sbin
mkdir -p ${OBJTREE}/nxb-bin/usr
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
-p ${OBJTREE}/nxb-bin/usr >/dev/null
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${OBJTREE}/nxb-bin/usr/include >/dev/null
.for _tool in \
bin/cat \
bin/chmod \
bin/cp \
bin/csh \
bin/echo \
bin/expr \
bin/hostname \
bin/ln \
bin/ls \
bin/mkdir \
bin/mv \
bin/ps \
bin/realpath \
bin/rm \
bin/rmdir \
bin/sh \
bin/sleep \
${_clang_tblgen} \
usr.bin/ar \
${_binutils} \
@ -1460,12 +1479,39 @@ native-xtools: .MAKE
${_gcc_tools} \
${_clang_libs} \
${_clang} \
sbin/md5 \
sbin/sysctl \
gnu/usr.bin/diff \
usr.bin/awk \
usr.bin/basename \
usr.bin/bmake \
usr.bin/bzip2 \
usr.bin/cmp \
usr.bin/dirname \
usr.bin/env \
usr.bin/fetch \
usr.bin/find \
usr.bin/grep \
usr.bin/gzip \
usr.bin/id \
usr.bin/lex \
usr.bin/lorder \
usr.bin/mktemp \
usr.bin/mt \
usr.bin/patch \
usr.bin/sed \
usr.bin/yacc
usr.bin/sort \
usr.bin/tar \
usr.bin/touch \
usr.bin/tr \
usr.bin/true \
usr.bin/uniq \
usr.bin/unzip \
usr.bin/xargs \
usr.bin/xinstall \
usr.bin/xz \
usr.bin/yacc \
usr.sbin/chown
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
cd ${.CURDIR}/${_tool} && \
${NXBMAKE} DIRPRFX=${_tool}/ obj && \

View File

@ -38,6 +38,12 @@
# xargs -n1 | sort | uniq -d;
# done
# 20141109: faith/faithd removal
OLD_FILES+=etc/rc.d/faith
OLD_FILES+=usr/share/man/man4/faith.4.gz
OLD_FILES+=usr/share/man/man4/if_faith.4.gz
OLD_FILES+=usr/sbin/faithd
OLD_FILES+=usr/share/man/man8/faithd.8.gz
# 20141102: postrandom obsoleted by new /dev/random code
OLD_FILES+=etc/rc.d/postrandom
# 20141031: initrandom obsoleted by new /dev/random code

View File

@ -31,6 +31,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20141109:
faith(4) and faithd(8) has been removed from base system. It
has been obsolete for a very long time.
20141104:
vt(4), the new console driver, is enabled by default. It brings
support for Unicode and double-width characters, as well as
@ -833,8 +837,8 @@ COMMON ITEMS:
2.) update the ZFS boot block on your boot drive
The following example updates the ZFS boot block on the first
partition (freebsd-boot) of a GPT partitioned drive ad0:
"gpart bootcode -p /boot/gptzfsboot -i 1 ad0"
partition (freebsd-boot) of a GPT partitioned drive ada0:
"gpart bootcode -p /boot/gptzfsboot -i 1 ada0"
Non-boot pools do not need these updates.

View File

@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
.Dd November 7, 2014
.Dd November 14, 2014
.Dt SH 1
.Os
.Sh NAME
@ -795,10 +795,13 @@ should indicate the various exit codes and what they mean.
Additionally, the built-in commands return exit codes, as does
an executed shell function.
.Pp
If a command is terminated by a signal, its exit status is 128 plus
the signal number.
Signal numbers are defined in the header file
.In sys/signal.h .
If a command is terminated by a signal, its exit status is greater than 128.
The signal name can be found by passing the exit status to
.Li kill -l .
.Pp
If there is no command word,
the exit status is the exit status of the last command substitution executed,
or zero if the command does not contain any command substitutions.
.Ss Complex Commands
Complex commands are combinations of simple commands
with control operators or keywords, together creating a larger complex
@ -818,7 +821,8 @@ function definition
.El
.Pp
Unless otherwise stated, the exit status of a command is
that of the last simple command executed by the command.
that of the last simple command executed by the command,
or zero if no simple command was executed.
.Ss Pipelines
A pipeline is a sequence of one or more commands separated
by the control operator
@ -902,6 +906,8 @@ The format for running a command in background is:
If the shell is not interactive, the standard input of an
asynchronous command is set to
.Pa /dev/null .
.Pp
The exit status is zero.
.Ss Lists (Generally Speaking)
A list is a sequence of zero or more commands separated by
newlines, semicolons, or ampersands,
@ -940,6 +946,13 @@ command is:
.Ic fi
.Ed
.Pp
The exit status is that of selected
.Ic then
or
.Ic else
list,
or zero if no list was selected.
.Pp
The syntax of the
.Ic while
command is:
@ -960,6 +973,9 @@ in place of
which causes it to
repeat until the exit status of the first list is zero.
.Pp
The exit status is that of the last execution of the second list,
or zero if it was never executed.
.Pp
The syntax of the
.Ic for
command is:
@ -1040,10 +1056,6 @@ continuing until a list terminated with
or the end of the
.Ic case
command.
The exit code of the
.Ic case
command is the exit code of the last command executed in the list or
zero if no patterns were matched.
.Ss Grouping Commands Together
Commands may be grouped by writing either
.Pp
@ -1131,6 +1143,8 @@ and the syntax is:
The
.Ic local
command is implemented as a built-in command.
The exit status is zero
unless the command is not in a function or a variable name is invalid.
.Pp
When a variable is made local, it inherits the initial
value and exported and readonly flags from the variable

View File

@ -2147,6 +2147,8 @@ dump_label(const char *dev)
(void) close(fd);
}
static uint64_t num_large_blocks;
/*ARGSUSED*/
static int
dump_one_dir(const char *dsname, void *arg)
@ -2159,6 +2161,8 @@ dump_one_dir(const char *dsname, void *arg)
(void) printf("Could not open %s, error %d\n", dsname, error);
return (0);
}
if (dmu_objset_ds(os)->ds_large_blocks)
num_large_blocks++;
dump_dir(os);
dmu_objset_disown(os, FTAG);
fuid_table_destroy();
@ -2169,7 +2173,7 @@ dump_one_dir(const char *dsname, void *arg)
/*
* Block statistics.
*/
#define PSIZE_HISTO_SIZE (SPA_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 1)
#define PSIZE_HISTO_SIZE (SPA_OLD_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 2)
typedef struct zdb_blkstats {
uint64_t zb_asize;
uint64_t zb_lsize;
@ -2234,7 +2238,15 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t *zilog, const blkptr_t *bp,
zb->zb_lsize += BP_GET_LSIZE(bp);
zb->zb_psize += BP_GET_PSIZE(bp);
zb->zb_count++;
zb->zb_psize_histogram[BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT]++;
/*
* The histogram is only big enough to record blocks up to
* SPA_OLD_MAXBLOCKSIZE; larger blocks go into the last,
* "other", bucket.
*/
int idx = BP_GET_PSIZE(bp) >> SPA_MINBLOCKSHIFT;
idx = MIN(idx, SPA_OLD_MAXBLOCKSIZE / SPA_MINBLOCKSIZE + 1);
zb->zb_psize_histogram[idx]++;
zb->zb_gangs += BP_COUNT_GANG(bp);
@ -2946,6 +2958,7 @@ dump_zpool(spa_t *spa)
dump_metaslab_groups(spa);
if (dump_opt['d'] || dump_opt['i']) {
uint64_t refcount;
dump_dir(dp->dp_meta_objset);
if (dump_opt['d'] >= 3) {
dump_bpobj(&spa->spa_deferred_bpobj,
@ -2965,8 +2978,21 @@ dump_zpool(spa_t *spa)
}
(void) dmu_objset_find(spa_name(spa), dump_one_dir,
NULL, DS_FIND_SNAPSHOTS | DS_FIND_CHILDREN);
(void) feature_get_refcount(spa,
&spa_feature_table[SPA_FEATURE_LARGE_BLOCKS], &refcount);
if (num_large_blocks != refcount) {
(void) printf("large_blocks feature refcount mismatch: "
"expected %lld != actual %lld\n",
(longlong_t)num_large_blocks,
(longlong_t)refcount);
rc = 2;
} else {
(void) printf("Verified large_blocks feature refcount "
"is correct (%llu)\n", (longlong_t)refcount);
}
}
if (dump_opt['b'] || dump_opt['c'])
if (rc == 0 && (dump_opt['b'] || dump_opt['c']))
rc = dump_block_stats(spa);
if (rc == 0)

View File

@ -27,10 +27,11 @@
.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
.\" Copyright (c) 2013, Steven Hartland <smh@FreeBSD.org>
.\" Copyright (c) 2014, Xin LI <delphij@FreeBSD.org>
.\" Copyright (c) 2014, The FreeBSD Foundation, All Rights Reserved.
.\"
.\" $FreeBSD$
.\"
.Dd June 30, 2014
.Dd November 12, 2014
.Dt ZFS 8
.Os
.Sh NAME
@ -179,12 +180,12 @@
.Ar bookmark
.Nm
.Cm send
.Op Fl DnPpRve
.Op Fl DnPpRveL
.Op Fl i Ar snapshot | Fl I Ar snapshot
.Ar snapshot
.Nm
.Cm send
.Op Fl e
.Op Fl eL
.Op Fl i Ar snapshot Ns | Ns bookmark
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Nm
@ -1187,6 +1188,12 @@ systems is strongly discouraged, and may adversely affect performance.
.Pp
The size specified must be a power of two greater than or equal to 512 and less
than or equal to 128 Kbytes.
If the
.Sy large_blocks
feature is enabled on the pool, the size may be up to 1 Mbyte.
See
.Xr zpool-features 7
for details on ZFS feature flags.
.Pp
Changing the file system's
.Sy recordsize
@ -1785,7 +1792,7 @@ descendent file systems.
Recursively destroy all clones of these snapshots, including the clones,
snapshots, and children.
If this flag is specified, the
.Op fl d
.Fl d
flag will have no effect.
.It Fl n
Do a dry-run ("No-op") deletion. No data will be deleted. This is useful in
@ -2477,7 +2484,7 @@ feature.
.It Xo
.Nm
.Cm send
.Op Fl DnPpRve
.Op Fl DnPpRveL
.Op Fl i Ar snapshot | Fl I Ar snapshot
.Ar snapshot
.Xc
@ -2549,6 +2556,22 @@ be used regardless of the dataset's
property, but performance will be much better if the filesystem uses a
dedup-capable checksum (eg.
.Sy sha256 ) .
.It Fl L
Generate a stream which may contain blocks larger than 128KB.
This flag
has no effect if the
.Sy large_blocks
pool feature is disabled, or if the
.Sy recordsize
property of this filesystem has never been set above 128KB.
The receiving system must have the
.Sy large_blocks
pool feature enabled as well.
See
.Xr zpool-features 7
for details on ZFS feature flags and the
.Sy large_blocks
feature.
.It Fl e
Generate a more compact stream by using WRITE_EMBEDDED records for blocks
which are stored more compactly on disk by the
@ -2596,7 +2619,7 @@ on future versions of
.It Xo
.Nm
.Cm send
.Op Fl e
.Op Fl eL
.Op Fl i Ar snapshot Ns | Ns Ar bookmark
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
.Xc
@ -2622,6 +2645,22 @@ specified as the last component of the name
If the incremental target is a clone, the incremental source can
be the origin snapshot, or an earlier snapshot in the origin's filesystem,
or the origin's origin, etc.
.It Fl L
Generate a stream which may contain blocks larger than 128KB.
This flag
has no effect if the
.Sy large_blocks
pool feature is disabled, or if the
.Sy recordsize
property of this filesystem has never been set above 128KB.
The receiving system must have the
.Sy large_blocks
pool feature enabled as well.
See
.Xr zpool-features 7
for details on ZFS feature flags and the
.Sy large_blocks
feature.
.It Fl e
Generate a more compact stream by using WRITE_EMBEDDED records for blocks
which are stored more compactly on disk by the

View File

@ -274,9 +274,9 @@ get_usage(zfs_help_t idx)
case HELP_ROLLBACK:
return (gettext("\trollback [-rRf] <snapshot>\n"));
case HELP_SEND:
return (gettext("\tsend [-DnPpRve] [-[iI] snapshot] "
return (gettext("\tsend [-DnPpRvLe] [-[iI] snapshot] "
"<snapshot>\n"
"\tsend [-e] [-i snapshot|bookmark] "
"\tsend [-Le] [-i snapshot|bookmark] "
"<filesystem|volume|snapshot>\n"));
case HELP_SET:
return (gettext("\tset <property=value> "
@ -3709,7 +3709,7 @@ zfs_do_send(int argc, char **argv)
boolean_t extraverbose = B_FALSE;
/* check options */
while ((c = getopt(argc, argv, ":i:I:RDpvnPe")) != -1) {
while ((c = getopt(argc, argv, ":i:I:RDpvnPLe")) != -1) {
switch (c) {
case 'i':
if (fromname)
@ -3744,6 +3744,9 @@ zfs_do_send(int argc, char **argv)
case 'n':
flags.dryrun = B_TRUE;
break;
case 'L':
flags.largeblock = B_TRUE;
break;
case 'e':
flags.embed_data = B_TRUE;
break;
@ -3800,6 +3803,8 @@ zfs_do_send(int argc, char **argv)
if (zhp == NULL)
return (1);
if (flags.largeblock)
lzc_flags |= LZC_SEND_FLAG_LARGE_BLOCK;
if (flags.embed_data)
lzc_flags |= LZC_SEND_FLAG_EMBED_DATA;

View File

@ -23,7 +23,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd July 1, 2014
.Dd November 10, 2014
.Dt ZPOOL-FEATURES 7
.Os
.Sh NAME
@ -427,6 +427,33 @@ This feature becomes
as soon as it is enabled and will
never return to being
.Sy enabled .
.It Sy large_blocks
.Bl -column "READ\-ONLY COMPATIBLE" "org.open-zfs:large_block"
.It GUID Ta org.open-zfs:large_block
.It READ\-ONLY COMPATIBLE Ta no
.It DEPENDENCIES Ta extensible_dataset
.El
.Pp
The
.Sy large_block
feature allows the record size on a dataset to be
set larger than 128KB.
.Pp
This feature becomes
.Sy active
once a
.Sy recordsize
property has been set larger than 128KB, and will return to being
.Sy enabled
once all filesystems that have ever had their recordsize larger than 128KB
are destroyed.
.Pp
Please note that booting from datasets that have recordsize greater than
128KB is
.Em NOT
supported by the
.Fx
boot loader.
.El
.Sh SEE ALSO
.Xr zpool 8

View File

@ -54,7 +54,6 @@ uint64_t total_stream_len = 0;
FILE *send_stream = 0;
boolean_t do_byteswap = B_FALSE;
boolean_t do_cksum = B_TRUE;
#define INITIAL_BUFLEN (1<<20)
static void
usage(void)
@ -67,6 +66,18 @@ usage(void)
exit(1);
}
static void *
safe_malloc(size_t size)
{
void *rv = malloc(size);
if (rv == NULL) {
(void) fprintf(stderr, "ERROR; failed to allocate %zu bytes\n",
size);
abort();
}
return (rv);
}
/*
* ssread - send stream read.
*
@ -158,7 +169,7 @@ print_block(char *buf, int length)
int
main(int argc, char *argv[])
{
char *buf = malloc(INITIAL_BUFLEN);
char *buf = safe_malloc(SPA_MAXBLOCKSIZE);
uint64_t drr_record_count[DRR_NUMTYPES] = { 0 };
uint64_t total_records = 0;
dmu_replay_record_t thedrr;
@ -307,9 +318,9 @@ main(int argc, char *argv[])
nvlist_t *nv;
int sz = drr->drr_payloadlen;
if (sz > INITIAL_BUFLEN) {
if (sz > SPA_MAXBLOCKSIZE) {
free(buf);
buf = malloc(sz);
buf = safe_malloc(sz);
}
(void) ssread(buf, sz, &zc);
if (ferror(send_stream))

View File

@ -987,9 +987,15 @@ ztest_spa_get_ashift() {
static int
ztest_random_blocksize(void)
{
// Choose a block size >= the ashift.
uint64_t block_shift =
ztest_random(SPA_MAXBLOCKSHIFT - ztest_spa_get_ashift() + 1);
uint64_t block_shift;
/*
* Choose a block size >= the ashift.
* If the SPA supports new MAXBLOCKSIZE, test up to 1MB blocks.
*/
int maxbs = SPA_OLD_MAXBLOCKSHIFT;
if (spa_maxblocksize(ztest_spa) == SPA_MAXBLOCKSIZE)
maxbs = 20;
block_shift = ztest_random(maxbs - ztest_spa_get_ashift() + 1);
return (1 << (SPA_MINBLOCKSHIFT + block_shift));
}
@ -4789,7 +4795,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
char path0[MAXPATHLEN];
char pathrand[MAXPATHLEN];
size_t fsize;
int bshift = SPA_MAXBLOCKSHIFT + 2; /* don't scrog all labels */
int bshift = SPA_OLD_MAXBLOCKSHIFT + 2; /* don't scrog all labels */
int iters = 1000;
int maxfaults;
int mirror_save;

View File

@ -469,7 +469,7 @@ dof_add_probe(dt_idhash_t *dhp, dt_ident_t *idp, void *data)
* locally so an alternate symbol is added for the purpose
* of this relocation.
*/
if (pip->pi_rname[0] == '\0')
if (pip->pi_rname == NULL)
dofr.dofr_name = dofpr.dofpr_func;
else
dofr.dofr_name = dof_add_string(ddo, pip->pi_rname);

View File

@ -520,6 +520,8 @@ dt_probe_destroy(dt_probe_t *prp)
for (pip = prp->pr_inst; pip != NULL; pip = pip_next) {
pip_next = pip->pi_next;
dt_free(dtp, pip->pi_rname);
dt_free(dtp, pip->pi_fname);
dt_free(dtp, pip->pi_offs);
dt_free(dtp, pip->pi_enoffs);
dt_free(dtp, pip);
@ -552,28 +554,18 @@ dt_probe_define(dt_provider_t *pvp, dt_probe_t *prp,
if ((pip = dt_zalloc(dtp, sizeof (*pip))) == NULL)
return (-1);
if ((pip->pi_offs = dt_zalloc(dtp,
sizeof (uint32_t))) == NULL) {
dt_free(dtp, pip);
return (-1);
}
if ((pip->pi_offs = dt_zalloc(dtp, sizeof (uint32_t))) == NULL)
goto nomem;
if ((pip->pi_enoffs = dt_zalloc(dtp,
sizeof (uint32_t))) == NULL) {
dt_free(dtp, pip->pi_offs);
dt_free(dtp, pip);
return (-1);
}
sizeof (uint32_t))) == NULL)
goto nomem;
(void) strlcpy(pip->pi_fname, fname, sizeof (pip->pi_fname));
if (rname != NULL) {
if (strlen(rname) + 1 > sizeof (pip->pi_rname)) {
dt_free(dtp, pip->pi_offs);
dt_free(dtp, pip);
return (dt_set_errno(dtp, EDT_COMPILER));
}
(void) strcpy(pip->pi_rname, rname);
}
if ((pip->pi_fname = strdup(fname)) == NULL)
goto nomem;
if (rname != NULL && (pip->pi_rname = strdup(rname)) == NULL)
goto nomem;
pip->pi_noffs = 0;
pip->pi_maxoffs = 1;
@ -618,6 +610,13 @@ dt_probe_define(dt_provider_t *pvp, dt_probe_t *prp,
(*offs)[(*noffs)++] = offset;
return (0);
nomem:
dt_free(dtp, pip->pi_fname);
dt_free(dtp, pip->pi_enoffs);
dt_free(dtp, pip->pi_offs);
dt_free(dtp, pip);
return (dt_set_errno(dtp, EDT_NOMEM));
}
/*

View File

@ -64,8 +64,8 @@ typedef struct dt_probe_iter {
} dt_probe_iter_t;
typedef struct dt_probe_instance {
char pi_fname[DTRACE_FUNCNAMELEN]; /* function name */
char pi_rname[DTRACE_FUNCNAMELEN + 20]; /* mangled relocation name */
char *pi_fname; /* function name */
char *pi_rname; /* mangled relocation name */
uint32_t *pi_offs; /* offsets into the function */
uint32_t *pi_enoffs; /* is-enabled offsets */
uint_t pi_noffs; /* number of offsets */

View File

@ -609,6 +609,9 @@ typedef struct sendflags {
/* show progress (ie. -v) */
boolean_t progress;
/* large blocks (>128K) are permitted */
boolean_t largeblock;
/* WRITE_EMBEDDED records of type DATA are permitted */
boolean_t embed_data;
} sendflags_t;

View File

@ -1080,21 +1080,36 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
break;
}
case ZFS_PROP_RECORDSIZE:
case ZFS_PROP_VOLBLOCKSIZE:
/* must be power of two within SPA_{MIN,MAX}BLOCKSIZE */
case ZFS_PROP_RECORDSIZE:
{
int maxbs = SPA_MAXBLOCKSIZE;
if (zhp != NULL) {
maxbs = zpool_get_prop_int(zhp->zpool_hdl,
ZPOOL_PROP_MAXBLOCKSIZE, NULL);
}
/*
* Volumes are limited to a volblocksize of 128KB,
* because they typically service workloads with
* small random writes, which incur a large performance
* penalty with large blocks.
*/
if (prop == ZFS_PROP_VOLBLOCKSIZE)
maxbs = SPA_OLD_MAXBLOCKSIZE;
/*
* The value must be a power of two between
* SPA_MINBLOCKSIZE and maxbs.
*/
if (intval < SPA_MINBLOCKSIZE ||
intval > SPA_MAXBLOCKSIZE || !ISP2(intval)) {
intval > maxbs || !ISP2(intval)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"'%s' must be power of 2 from %u "
"to %uk"), propname,
(uint_t)SPA_MINBLOCKSIZE,
(uint_t)SPA_MAXBLOCKSIZE >> 10);
"'%s' must be power of 2 from 512B "
"to %uKB"), propname, maxbs >> 10);
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
goto error;
}
break;
}
case ZFS_PROP_MLSLABEL:
{
#ifdef sun
@ -1471,7 +1486,9 @@ zfs_setprop_error(libzfs_handle_t *hdl, zfs_prop_t prop, int err,
break;
case ERANGE:
if (prop == ZFS_PROP_COMPRESSION) {
case EDOM:
if (prop == ZFS_PROP_COMPRESSION ||
prop == ZFS_PROP_RECORDSIZE) {
(void) zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"property setting is not allowed on "
"bootable datasets"));
@ -3197,9 +3214,7 @@ zfs_create(libzfs_handle_t *hdl, const char *path, zfs_type_t type,
case EDOM:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"volume block size must be power of 2 from "
"%u to %uk"),
(uint_t)SPA_MINBLOCKSIZE,
(uint_t)SPA_MAXBLOCKSIZE >> 10);
"512B to 128KB"));
return (zfs_error(hdl, EZFS_BADPROP, errbuf));

View File

@ -215,7 +215,7 @@ static void *
cksummer(void *arg)
{
dedup_arg_t *dda = arg;
char *buf = malloc(1<<20);
char *buf = zfs_alloc(dda->dedup_hdl, SPA_MAXBLOCKSIZE);
dmu_replay_record_t thedrr;
dmu_replay_record_t *drr = &thedrr;
struct drr_begin *drrb = &thedrr.drr_u.drr_begin;
@ -280,9 +280,9 @@ cksummer(void *arg)
DMU_COMPOUNDSTREAM && drr->drr_payloadlen != 0) {
int sz = drr->drr_payloadlen;
if (sz > 1<<20) {
free(buf);
buf = malloc(sz);
if (sz > SPA_MAXBLOCKSIZE) {
buf = zfs_realloc(dda->dedup_hdl, buf,
SPA_MAXBLOCKSIZE, sz);
}
(void) ssread(buf, sz, ofp);
if (ferror(stdin))
@ -815,7 +815,7 @@ typedef struct send_dump_data {
char prevsnap[ZFS_MAXNAMELEN];
uint64_t prevsnap_obj;
boolean_t seenfrom, seento, replicate, doall, fromorigin;
boolean_t verbose, dryrun, parsable, progress, embed_data;
boolean_t verbose, dryrun, parsable, progress, embed_data, large_block;
int outfd;
boolean_t err;
nvlist_t *fss;
@ -1163,6 +1163,8 @@ dump_snapshot(zfs_handle_t *zhp, void *arg)
}
enum lzc_send_flags flags = 0;
if (sdd->large_block)
flags |= LZC_SEND_FLAG_LARGE_BLOCK;
if (sdd->embed_data)
flags |= LZC_SEND_FLAG_EMBED_DATA;
@ -1511,6 +1513,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
sdd.parsable = flags->parsable;
sdd.progress = flags->progress;
sdd.dryrun = flags->dryrun;
sdd.large_block = flags->largeblock;
sdd.embed_data = flags->embed_data;
sdd.filter_cb = filter_func;
sdd.filter_cb_arg = cb_arg;
@ -2545,7 +2548,7 @@ static int
recv_skip(libzfs_handle_t *hdl, int fd, boolean_t byteswap)
{
dmu_replay_record_t *drr;
void *buf = malloc(1<<20);
void *buf = zfs_alloc(hdl, SPA_MAXBLOCKSIZE);
char errbuf[1024];
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,

View File

@ -502,6 +502,10 @@ lzc_get_holds(const char *snapname, nvlist_t **holdsp)
*
* "fd" is the file descriptor to write the send stream to.
*
* If "flags" contains LZC_SEND_FLAG_LARGE_BLOCK, the stream is permitted
* to contain DRR_WRITE records with drr_length > 128K, and DRR_OBJECT
* records with drr_blksz > 128K.
*
* If "flags" contains LZC_SEND_FLAG_EMBED_DATA, the stream is permitted
* to contain DRR_WRITE_EMBEDDED records with drr_etype==BP_EMBEDDED_TYPE_DATA,
* which the receiving system must support (as indicated by support
@ -518,6 +522,8 @@ lzc_send(const char *snapname, const char *from, int fd,
fnvlist_add_int32(args, "fd", fd);
if (from != NULL)
fnvlist_add_string(args, "fromsnap", from);
if (flags & LZC_SEND_FLAG_LARGE_BLOCK)
fnvlist_add_boolean(args, "largeblockok");
if (flags & LZC_SEND_FLAG_EMBED_DATA)
fnvlist_add_boolean(args, "embedok");
err = lzc_ioctl(ZFS_IOC_SEND_NEW, snapname, args, NULL);

View File

@ -54,7 +54,8 @@ int lzc_release(nvlist_t *, nvlist_t **);
int lzc_get_holds(const char *, nvlist_t **);
enum lzc_send_flags {
LZC_SEND_FLAG_EMBED_DATA = 1 << 0
LZC_SEND_FLAG_EMBED_DATA = 1 << 0,
LZC_SEND_FLAG_LARGE_BLOCK = 1 << 1
};
int lzc_send(const char *, const char *, int, enum lzc_send_flags);

View File

@ -24,6 +24,8 @@
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved.
* Copyright (c) 2014 by Delphix. All rights reserved.
*/
#include <sys/zfs_context.h>
@ -32,8 +34,10 @@ int taskq_now;
taskq_t *system_taskq;
#define TASKQ_ACTIVE 0x00010000
#define TASKQ_NAMELEN 31
struct taskq {
char tq_name[TASKQ_NAMELEN + 1];
kmutex_t tq_lock;
krwlock_t tq_threadlock;
kcondvar_t tq_dispatch_cv;
@ -136,6 +140,7 @@ taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t tqflags)
t->tqent_prev->tqent_next = t;
t->tqent_func = func;
t->tqent_arg = arg;
t->tqent_flags = 0;
cv_signal(&tq->tq_dispatch_cv);
mutex_exit(&tq->tq_lock);
return (1);
@ -245,6 +250,7 @@ taskq_create(const char *name, int nthreads, pri_t pri,
cv_init(&tq->tq_dispatch_cv, NULL, CV_DEFAULT, NULL);
cv_init(&tq->tq_wait_cv, NULL, CV_DEFAULT, NULL);
cv_init(&tq->tq_maxalloc_cv, NULL, CV_DEFAULT, NULL);
(void) strncpy(tq->tq_name, name, TASKQ_NAMELEN + 1);
tq->tq_flags = flags | TASKQ_ACTIVE;
tq->tq_active = nthreads;
tq->tq_nthreads = nthreads;

View File

@ -766,7 +766,8 @@ die_array_resolve(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private)
debug(3, "trying to resolve array %d (cont %d)\n", tdp->t_id,
tdp->t_ardef->ad_contents->t_id);
if ((sz = tdesc_size(tdp->t_ardef->ad_contents)) == 0) {
if ((sz = tdesc_size(tdp->t_ardef->ad_contents)) == 0 &&
(tdp->t_ardef->ad_contents->t_flags & TDESC_F_RESOLVED) == 0) {
debug(3, "unable to resolve array %s (%d) contents %d\n",
tdesc_name(tdp), tdp->t_id,
tdp->t_ardef->ad_contents->t_id);
@ -1138,12 +1139,17 @@ die_sou_resolve(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private)
/*
* For empty members, or GCC/C99 flexible array
* members, a size of 0 is correct.
* members, a size of 0 is correct. Structs and unions
* consisting of flexible array members will also have
* size 0.
*/
if (mt->t_members == NULL)
continue;
if (mt->t_type == ARRAY && mt->t_ardef->ad_nelems == 0)
continue;
if ((mt->t_flags & TDESC_F_RESOLVED) != 0 &&
(mt->t_type == STRUCT || mt->t_type == UNION))
continue;
dw->dw_nunres++;
return (1);

View File

@ -287,19 +287,11 @@ equiv_su(tdesc_t *stdp, tdesc_t *ttdp, equiv_data_t *ed)
while (ml1 && ml2) {
if (ml1->ml_offset != ml2->ml_offset ||
strcmp(ml1->ml_name, ml2->ml_name) != 0)
strcmp(ml1->ml_name, ml2->ml_name) != 0 ||
ml1->ml_size != ml2->ml_size ||
!equiv_node(ml1->ml_type, ml2->ml_type, ed))
return (0);
/*
* Don't do the recursive equivalency checking more than
* we have to.
*/
if (olm1 == NULL || olm1->ml_type->t_id != ml1->ml_type->t_id) {
if (ml1->ml_size != ml2->ml_size ||
!equiv_node(ml1->ml_type, ml2->ml_type, ed))
return (0);
}
olm1 = ml1;
ml1 = ml1->ml_next;
ml2 = ml2->ml_next;
@ -357,7 +349,7 @@ equiv_node(tdesc_t *ctdp, tdesc_t *mtdp, equiv_data_t *ed)
int (*equiv)(tdesc_t *, tdesc_t *, equiv_data_t *);
int mapping;
if (ctdp->t_emark > ed->ed_clear_mark ||
if (ctdp->t_emark > ed->ed_clear_mark &&
mtdp->t_emark > ed->ed_clear_mark)
return (ctdp->t_emark == mtdp->t_emark);

View File

@ -150,7 +150,7 @@ extern int YYPARSE_DECL();
#define LETTER 258
#define UMINUS 259
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT calc_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View File

@ -175,7 +175,7 @@ extern int YYPARSE_DECL();
#define CONST 259
#define UMINUS 260
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT calc1_lhs[] = { -1,
3, 3, 0, 0, 0, 0, 0, 1, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2,

View File

@ -152,7 +152,7 @@ extern int YYPARSE_DECL();
#define LETTER 258
#define UMINUS 259
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT calc2_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View File

@ -157,7 +157,7 @@ extern int YYPARSE_DECL();
#define LETTER 258
#define UMINUS 259
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT calc3_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View File

@ -160,7 +160,7 @@ typedef int YYSTYPE;
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
extern int YYPARSE_DECL();
typedef short YYINT;
typedef int YYINT;
extern YYINT yylhs[];
extern YYINT yylen[];
extern YYINT yydefred[];

View File

@ -1,4 +1,4 @@
typedef short YYINT;
typedef int YYINT;
const YYINT calc_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View File

@ -152,7 +152,7 @@ typedef int YYSTYPE;
#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
extern int YYPARSE_DECL();
typedef short YYINT;
typedef int YYINT;
extern YYINT yylhs[];
extern YYINT yylen[];
extern YYINT yydefred[];

View File

@ -1,4 +1,4 @@
typedef short YYINT;
typedef int YYINT;
const YYINT error_lhs[] = { -1,
0,
};

View File

@ -144,7 +144,7 @@ typedef int YYSTYPE;
extern int YYPARSE_DECL();
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT empty_lhs[] = { -1,
0,
};

View File

@ -134,7 +134,7 @@ static void yyerror(const char *);
extern int YYPARSE_DECL();
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT err_syntax10_lhs[] = { -1,
0,
};

View File

@ -140,7 +140,7 @@ typedef int YYSTYPE;
extern int YYPARSE_DECL();
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT err_syntax11_lhs[] = { -1,
0,
};

View File

@ -141,7 +141,7 @@ extern int YYPARSE_DECL();
#define text 456
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT err_syntax12_lhs[] = { -1,
0,
};

View File

@ -140,7 +140,7 @@ typedef int YYSTYPE;
extern int YYPARSE_DECL();
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT err_syntax18_lhs[] = { -1,
0,
};

View File

@ -135,7 +135,7 @@ extern int YYPARSE_DECL();
#define recur 257
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT err_syntax20_lhs[] = { -1,
0,
};

View File

@ -140,7 +140,7 @@ typedef int YYSTYPE;
extern int YYPARSE_DECL();
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT error_lhs[] = { -1,
0,
};

View File

@ -453,7 +453,7 @@ extern int YYPARSE_DECL();
#define T_ASMARG 290
#define T_VA_DCL 291
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT grammar_lhs[] = { -1,
0, 0, 26, 26, 27, 27, 27, 27, 27, 27,
27, 31, 30, 30, 28, 28, 34, 28, 32, 32,

View File

@ -178,7 +178,7 @@ extern int YYPARSE_DECL();
#define VT 272
#define UMINUS 273
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT ok_syntax1_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View File

@ -160,7 +160,7 @@ extern int YYPARSE_DECL();
#define LETTER 258
#define UMINUS 259
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT calc_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View File

@ -152,7 +152,7 @@ typedef int YYSTYPE;
extern int YYPARSE_DECL();
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT error_lhs[] = { -1,
0,
};

View File

@ -156,7 +156,7 @@ extern int YYPARSE_DECL();
#define LETTER 270
#define UMINUS 271
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT quote_calc_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View File

@ -162,7 +162,7 @@ extern int YYPARSE_DECL();
#define LETTER 270
#define UMINUS 271
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT quote_calc_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View File

@ -156,7 +156,7 @@ extern int YYPARSE_DECL();
#define LETTER 270
#define UMINUS 271
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT quote_calc2_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View File

@ -162,7 +162,7 @@ extern int YYPARSE_DECL();
#define LETTER 270
#define UMINUS 271
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT quote_calc2_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View File

@ -156,7 +156,7 @@ extern int YYPARSE_DECL();
#define LETTER 270
#define UMINUS 271
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT quote_calc3_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View File

@ -156,7 +156,7 @@ extern int YYPARSE_DECL();
#define LETTER 270
#define UMINUS 271
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT quote_calc3_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View File

@ -156,7 +156,7 @@ extern int YYPARSE_DECL();
#define LETTER 270
#define UMINUS 271
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT quote_calc4_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View File

@ -156,7 +156,7 @@ extern int YYPARSE_DECL();
#define LETTER 270
#define UMINUS 271
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT quote_calc4_lhs[] = { -1,
0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 3, 3,

View File

@ -16,7 +16,7 @@
#line 17 "rename_debug.c"
#include "rename_debug.i"
#include "rename_debug.h"
typedef short YYINT;
typedef int YYINT;
static const YYINT yylhs[] = { -1,
0,
};

View File

@ -176,7 +176,7 @@ extern int YYPARSE_DECL();
#define CONST 259
#define UMINUS 260
#define YYERRCODE 256
typedef short YYINT;
typedef int YYINT;
static const YYINT varsyntax_calc1_lhs[] = { -1,
3, 3, 0, 0, 0, 0, 0, 1, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2,

View File

@ -285,7 +285,7 @@ kvp_file_init(void)
int alloc_unit = sizeof(struct kvp_record) * ENTRIES_PER_BLOCK;
if (mkdir("/var/db/hyperv/pool", S_IRUSR | S_IWUSR | S_IROTH) < 0 &&
errno != EISDIR) {
(errno != EEXIST && errno != EISDIR)) {
KVP_LOG(LOG_ERR, " Failed to create /var/db/hyperv/pool\n");
exit(EXIT_FAILURE);
}
@ -511,25 +511,25 @@ kvp_get_value(int pool, __u8 *key, int key_size, __u8 *value,
static int
kvp_pool_enumerate(int pool, int index, __u8 *key, int key_size,
kvp_pool_enumerate(int pool, int idx, __u8 *key, int key_size,
__u8 *value, int value_size)
{
struct kvp_record *record;
KVP_LOG(LOG_DEBUG, "kvp_pool_enumerate: pool = %d, index = %d\n,",
pool, index);
pool, idx);
/* First update our in-memory state first. */
kvp_update_mem_state(pool);
record = kvp_pools[pool].records;
/* Index starts with 0 */
if (index >= kvp_pools[pool].num_records) {
if (idx >= kvp_pools[pool].num_records) {
return (1);
}
memcpy(key, record[index].key, key_size);
memcpy(value, record[index].value, value_size);
memcpy(key, record[idx].key, key_size);
memcpy(value, record[idx].value, value_size);
return (0);
}

View File

@ -60,3 +60,5 @@ option:
View the beautiful documentation at:
http://juniper.github.io/libxo/libxo-manual.html
[![Analytics](https://ga-beacon.appspot.com/UA-56056421-1/Juniper/libxo/Readme)](https://github.com/Juniper/libxo)

View File

@ -12,7 +12,7 @@
#
AC_PREREQ(2.2)
AC_INIT([libxo], [0.1.4], [phil@juniper.net])
AC_INIT([libxo], [0.1.6], [phil@juniper.net])
AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability])
# Support silent build rules. Requires at least automake-1.11.

View File

@ -79,7 +79,7 @@ struct xo_handle_s {
unsigned short xo_indent; /* Indent level (if pretty) */
unsigned short xo_indent_by; /* Indent amount (tab stop) */
xo_write_func_t xo_write; /* Write callback */
xo_close_func_t xo_close; /* Clo;se callback */
xo_close_func_t xo_close; /* Close callback */
xo_formatter_t xo_formatter; /* Custom formating function */
xo_checkpointer_t xo_checkpointer; /* Custom formating support function */
void *xo_opaque; /* Opaque data for write function */
@ -317,7 +317,7 @@ xo_init_handle (xo_handle_t *xop)
cp = getenv("LC_ALL");
if (cp == NULL)
cp = "UTF-8"; /* Optimistic? */
cp = setlocale(LC_CTYPE, cp);
(void) setlocale(LC_CTYPE, cp);
}
/*
@ -607,8 +607,10 @@ xo_vsnprintf (xo_handle_t *xop, xo_buffer_t *xbp, const char *fmt, va_list vap)
rc = vsnprintf(xbp->xb_curp, left, fmt, va_local);
if (rc > xbp->xb_size) {
if (!xo_buf_has_room(xbp, rc))
if (!xo_buf_has_room(xbp, rc)) {
va_end(va_local);
return -1;
}
/*
* After we call vsnprintf(), the stage of vap is not defined.
@ -648,8 +650,10 @@ xo_printf_v (xo_handle_t *xop, const char *fmt, va_list vap)
rc = vsnprintf(xbp->xb_curp, left, fmt, va_local);
if (rc > xbp->xb_size) {
if (!xo_buf_has_room(xbp, rc))
if (!xo_buf_has_room(xbp, rc)) {
va_end(va_local);
return -1;
}
va_end(va_local); /* Reset vap to the start */
va_copy(va_local, vap);
@ -974,8 +978,10 @@ xo_warn_hcv (xo_handle_t *xop, int code, int check_warn,
int left = xbp->xb_size - (xbp->xb_curp - xbp->xb_bufp);
int rc = vsnprintf(xbp->xb_curp, left, newfmt, vap);
if (rc > xbp->xb_size) {
if (!xo_buf_has_room(xbp, rc))
if (!xo_buf_has_room(xbp, rc)) {
va_end(va_local);
return;
}
va_end(vap); /* Reset vap to the start */
va_copy(vap, va_local);
@ -1118,8 +1124,10 @@ xo_message_hcv (xo_handle_t *xop, int code, const char *fmt, va_list vap)
int left = xbp->xb_size - (xbp->xb_curp - xbp->xb_bufp);
rc = vsnprintf(xbp->xb_curp, left, fmt, vap);
if (rc > xbp->xb_size) {
if (!xo_buf_has_room(xbp, rc))
if (!xo_buf_has_room(xbp, rc)) {
va_end(va_local);
return;
}
va_end(vap); /* Reset vap to the start */
va_copy(vap, va_local);
@ -1154,14 +1162,15 @@ xo_message_hcv (xo_handle_t *xop, int code, const char *fmt, va_list vap)
va_copy(va_local, vap);
rc = vsnprintf(buf, bufsiz, fmt, va_local);
rc = vsnprintf(bp, bufsiz, fmt, va_local);
if (rc > bufsiz) {
bufsiz = rc + BUFSIZ;
bp = alloca(bufsiz);
va_end(va_local);
va_copy(va_local, vap);
rc = vsnprintf(buf, bufsiz, fmt, va_local);
rc = vsnprintf(bp, bufsiz, fmt, va_local);
}
va_end(va_local);
cp = bp + rc;
if (need_nl) {
@ -1302,9 +1311,9 @@ xo_create_to_file (FILE *fp, xo_style_t style, xo_xof_flags_t flags)
* @xop XO handle to alter (or NULL for default handle)
*/
void
xo_destroy (xo_handle_t *xop)
xo_destroy (xo_handle_t *xop_arg)
{
xop = xo_default(xop);
xo_handle_t *xop = xo_default(xop_arg);
if (xop->xo_close && (xop->xo_flags & XOF_CLOSE_FP))
xop->xo_close(xop->xo_opaque);
@ -1315,7 +1324,7 @@ xo_destroy (xo_handle_t *xop)
xo_buf_cleanup(&xop->xo_predicate);
xo_buf_cleanup(&xop->xo_attrs);
if (xop == &xo_default_handle) {
if (xop_arg == NULL) {
bzero(&xo_default_handle, sizeof(&xo_default_handle));
xo_default_inited = 0;
} else
@ -1743,7 +1752,7 @@ xo_format_string_direct (xo_handle_t *xop, xo_buffer_t *xbp,
int need_enc, int have_enc)
{
int cols = 0;
wchar_t wc;
wchar_t wc = 0;
int ilen, olen, width;
int attr = (flags & XFF_ATTR);
const char *sp;
@ -1912,6 +1921,7 @@ xo_format_string (xo_handle_t *xop, xo_buffer_t *xbp, xo_xff_flags_t flags,
xo_format_t *xfp)
{
static char null[] = "(null)";
char *cp = NULL;
wchar_t *wcp = NULL;
int len, cols = 0, rc = 0;
@ -1922,16 +1932,33 @@ xo_format_string (xo_handle_t *xop, xo_buffer_t *xbp, xo_xff_flags_t flags,
if (xo_check_conversion(xop, xfp->xf_enc, need_enc))
return 0;
len = xfp->xf_width[XF_WIDTH_SIZE];
if (xfp->xf_enc == XF_ENC_WIDE) {
wcp = va_arg(xop->xo_vap, wchar_t *);
if (xfp->xf_skip)
return 0;
/*
* Dont' deref NULL; use the traditional "(null)" instead
* of the more accurate "who's been a naughty boy, then?".
*/
if (wcp == NULL) {
cp = null;
len = sizeof(null) - 1;
}
} else {
cp = va_arg(xop->xo_vap, char *); /* UTF-8 or native */
if (xfp->xf_skip)
return 0;
/* Echo "Dont' deref NULL" logic */
if (cp == NULL) {
cp = null;
len = sizeof(null) - 1;
}
/*
* Optimize the most common case, which is "%s". We just
* need to copy the complete string to the output buffer.
@ -1957,17 +1984,6 @@ xo_format_string (xo_handle_t *xop, xo_buffer_t *xbp, xo_xff_flags_t flags,
}
}
len = xfp->xf_width[XF_WIDTH_SIZE];
/*
* Dont' deref NULL; use the traditional "(null)" instead
* of the more accurate "who's been a naughty boy, then?".
*/
if (cp == NULL && wcp == NULL) {
cp = null;
len = sizeof(null) - 1;
}
cols = xo_format_string_direct(xop, xbp, flags, wcp, cp, len,
xfp->xf_width[XF_WIDTH_MAX],
need_enc, xfp->xf_enc);
@ -3859,7 +3875,7 @@ xo_close_list_h (xo_handle_t *xop, const char *name)
rc = xo_printf(xop, "%s%*s]", pre_nl, xo_indent(xop), "");
xop->xo_stack[xop->xo_depth].xs_flags |= XSF_NOT_FIRST;
return 0;
return rc;
}
int

View File

@ -158,7 +158,7 @@
#define PACKAGE_NAME "libxo"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libxo 0.1.4"
#define PACKAGE_STRING "libxo 0.1.6"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libxo"
@ -167,7 +167,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.1.4"
#define PACKAGE_VERSION "0.1.6"
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
@ -181,7 +181,7 @@
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "0.1.4"
#define VERSION "0.1.6"
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */

View File

@ -18,17 +18,17 @@
/**
* The version string
*/
#define LIBXO_VERSION "0.1.4"
#define LIBXO_VERSION "0.1.6"
/**
* The version number
*/
#define LIBXO_VERSION_NUMBER 1004
#define LIBXO_VERSION_NUMBER 1006
/**
* The version number as a string
*/
#define LIBXO_VERSION_STRING "1004"
#define LIBXO_VERSION_STRING "1006"
/**
* The version number extra info as a string

View File

@ -30,7 +30,7 @@ test_07_test_SOURCES = test_07.c
# TEST_CASES := $(shell cd ${srcdir} ; echo *.c )
bin_PROGRAMS = ${TEST_CASES:.c=.test}
noinst_PROGRAMS = ${TEST_CASES:.c=.test}
LDADD = \
${top_builddir}/libxo/libxo.la
@ -66,7 +66,7 @@ valgrind:
TEST_ONE = \
LIBXO_OPTIONS=:W$$fmt \
${CHECKER} $$base.test ${TEST_OPTS} \
${CHECKER} ./$$base.test ${TEST_OPTS} \
> out/$$base.$$fmt.out 2> out/$$base.$$fmt.err ; \
${DIFF} -Nu ${srcdir}/saved/$$base.$$fmt.out out/$$base.$$fmt.out ${S2O} ; \
${DIFF} -Nu ${srcdir}/saved/$$base.$$fmt.err out/$$base.$$fmt.err ${S2O}

View File

@ -1,2 +1,2 @@
{"employees": {"v1":"γιγνώσκειν","v2":"ὦ ἄνδρες ᾿Αθηναῖοι","columns":28,"columns":2,"v1":"ახლავე გაიაროთ რეგისტრაცია","v2":"Unicode-ის მეათე საერთაშორისო","columns":55, "employee": ["columns":0, {"first-name":"Jim","nic-name":"\"რეგტ\"","last-name":"გთხოვთ ახ","department":431,"percent-time":90,"columns":23,"benefits":"full"}, {"first-name":"Terry","nic-name":"\"<one\"","last-name":"Οὐχὶ ταὐτὰ παρίσταταί μοι Jones","department":660,"percent-time":90,"columns":47,"benefits":"full"}, {"first-name":"Leslie","nic-name":"\"Les\"","last-name":"Patterson","department":341,"percent-time":60,"columns":25,"benefits":"full"}, {"first-name":"Ashley","nic-name":"\"Ash\"","last-name":"Meter & Smith","department":1440,"percent-time":40,"columns":30}, {"first-name":"0123456789","nic-name":"\"0123456789\"","last-name":"012345678901234567890","department":1440,"percent-time":40,"columns":49}, {"first-name":"ახლა","nic-name":"\"გაიარო\"","last-name":"საერთაშორისო","department":123,"percent-time":90,"columns":29,"benefits":"full"}]}
{"employees": {"test": [{"filename":"(null)"}],"v1":"γιγνώσκειν","v2":"ὦ ἄνδρες ᾿Αθηναῖοι","columns":28,"columns":2,"v1":"ახლავე გაიაროთ რეგისტრაცია","v2":"Unicode-ის მეათე საერთაშორისო","columns":55, "employee": ["columns":0, {"first-name":"Jim","nic-name":"\"რეგტ\"","last-name":"გთხოვთ ახ","department":431,"percent-time":90,"columns":23,"benefits":"full"}, {"first-name":"Terry","nic-name":"\"<one\"","last-name":"Οὐχὶ ταὐτὰ παρίσταταί μοι Jones","department":660,"percent-time":90,"columns":47,"benefits":"full"}, {"first-name":"Leslie","nic-name":"\"Les\"","last-name":"Patterson","department":341,"percent-time":60,"columns":25,"benefits":"full"}, {"first-name":"Ashley","nic-name":"\"Ash\"","last-name":"Meter & Smith","department":1440,"percent-time":40,"columns":30}, {"first-name":"0123456789","nic-name":"\"0123456789\"","last-name":"012345678901234567890","department":1440,"percent-time":40,"columns":49}, {"first-name":"ახლა","nic-name":"\"გაიარო\"","last-name":"საერთაშორისო","department":123,"percent-time":90,"columns":29,"benefits":"full"}]}
}

View File

@ -1,5 +1,10 @@
{
"employees": {
"test": [
{
"filename": "(null)"
}
],
"v1": "γιγνώσκειν",
"v2": "ὦ ἄνδρες ᾿Αθηναῖοι",
"columns": 28,

View File

@ -1 +1 @@
<employees><v1>γιγνώσκειν</v1><v2>ὦ ἄνδρες ᾿Αθηναῖοι</v2><columns>28</columns><columns>2</columns><v1>ახლავე გაიაროთ რეგისტრაცია</v1><v2>Unicode-ის მეათე საერთაშორისო</v2><columns>55</columns><columns>0</columns><employee><first-name>Jim</first-name><nic-name>"რეგტ"</nic-name><last-name>გთხოვთ ახ</last-name><department>431</department><percent-time>90</percent-time><columns>23</columns><benefits full-time="honest &amp; for true">full</benefits></employee><employee><first-name>Terry</first-name><nic-name>"&lt;one"</nic-name><last-name>Οὐχὶ ταὐτὰ παρίσταταί μοι Jones</last-name><department>660</department><percent-time>90</percent-time><columns>47</columns><benefits full-time="honest &amp; for true">full</benefits></employee><employee><first-name>Leslie</first-name><nic-name>"Les"</nic-name><last-name>Patterson</last-name><department>341</department><percent-time>60</percent-time><columns>25</columns><benefits full-time="honest &amp; for true">full</benefits></employee><employee><first-name>Ashley</first-name><nic-name>"Ash"</nic-name><last-name>Meter &amp; Smith</last-name><department>1440</department><percent-time>40</percent-time><columns>30</columns></employee><employee><first-name>0123456789</first-name><nic-name>"0123456789"</nic-name><last-name>012345678901234567890</last-name><department>1440</department><percent-time>40</percent-time><columns>49</columns></employee><employee><first-name>ახლა</first-name><nic-name>"გაიარო"</nic-name><last-name>საერთაშორისო</last-name><department>123</department><percent-time>90</percent-time><columns>29</columns><benefits full-time="honest &amp; for true">full</benefits></employee></employees>
<employees><test><filename>(null)</filename></test><v1>γιγνώσκειν</v1><v2>ὦ ἄνδρες ᾿Αθηναῖοι</v2><columns>28</columns><columns>2</columns><v1>ახლავე გაიაროთ რეგისტრაცია</v1><v2>Unicode-ის მეათე საერთაშორისო</v2><columns>55</columns><columns>0</columns><employee><first-name>Jim</first-name><nic-name>"რეგტ"</nic-name><last-name>გთხოვთ ახ</last-name><department>431</department><percent-time>90</percent-time><columns>23</columns><benefits full-time="honest &amp; for true">full</benefits></employee><employee><first-name>Terry</first-name><nic-name>"&lt;one"</nic-name><last-name>Οὐχὶ ταὐτὰ παρίσταταί μοι Jones</last-name><department>660</department><percent-time>90</percent-time><columns>47</columns><benefits full-time="honest &amp; for true">full</benefits></employee><employee><first-name>Leslie</first-name><nic-name>"Les"</nic-name><last-name>Patterson</last-name><department>341</department><percent-time>60</percent-time><columns>25</columns><benefits full-time="honest &amp; for true">full</benefits></employee><employee><first-name>Ashley</first-name><nic-name>"Ash"</nic-name><last-name>Meter &amp; Smith</last-name><department>1440</department><percent-time>40</percent-time><columns>30</columns></employee><employee><first-name>0123456789</first-name><nic-name>"0123456789"</nic-name><last-name>012345678901234567890</last-name><department>1440</department><percent-time>40</percent-time><columns>49</columns></employee><employee><first-name>ახლა</first-name><nic-name>"გაიარო"</nic-name><last-name>საერთაშორისო</last-name><department>123</department><percent-time>90</percent-time><columns>29</columns><benefits full-time="honest &amp; for true">full</benefits></employee></employees>

View File

@ -1,4 +1,7 @@
<employees>
<test>
<filename>(null)</filename>
</test>
<v1>γιγνώσκειν</v1>
<v2>ὦ ἄνδρες ᾿Αθηναῖοι</v2>
<columns>28</columns>

View File

@ -52,6 +52,12 @@ main (int argc, char **argv)
xo_open_container("employees");
xo_open_list("test");
xo_open_instance("test");
xo_emit("{ek:filename/%s}", NULL);
xo_close_instance("test");
xo_close_list("test");
rc = xo_emit("Οὐχὶ ταὐτὰ παρίσταταί μοι {:v1/%s}, {:v2/%s}\n",
"γιγνώσκειν", "ὦ ἄνδρες ᾿Αθηναῖοι");
rc = xo_emit("{:columns/%d}\n", rc);

View File

@ -28,6 +28,19 @@ sub main {
extract_samples() if /^-X/;
}
if ($#ARGV < 0) {
print STDERR "xolint [options] files ...\n";
print STDERR " -c invoke 'cpp' on input\n";
print STDERR " -C flags Pass flags to cpp\n";
print STDERR " -d Show debug output\n";
print STDERR " -D Extract xolint documentation\n";
print STDERR " -I Print xo_info_t data\n";
print STDERR " -p Print input data on errors\n";
print STDERR " -V Print vocabulary (list of tags)\n";
print STDERR " -X Print examples of invalid use\n";
exit(1);
}
for $file (@ARGV) {
parse_file($file);
}
@ -269,9 +282,9 @@ sub check_format {
$last = $prev;
next;
}
$prev = $ch;
}
$prev = $ch;
$build[$phase] .= $ch;
}
@ -346,18 +359,6 @@ sub check_field {
info("potential missing slash after N, L, or T with format")
if $field[1] =~ /%/;
#@ Format cannot be given when content is present (roles: DNLT)
#@ xo_emit("{T:Max/%6.6s}", "Max");
#@ Fields with the D, N, L, or T roles can't have both
#@ static literal content ("{T:Title}") and a
#@ format ("{T:/%s}").
#@ This error will also occur when the content has a backslash
#@ in it, like "{N:Type of I/O}"; backslashes should be escaped,
#@ like "{N:Type of I\\/O}". Note the double backslash, one for
#@ handling 'C' strings, and one for libxo.
error("format cannot be given when content is present")
if $field[1] && $field[2];
#@ An encoding format cannot be given (roles: DNLT)
#@ xo_emit("{T:Max//%s}", "Max");
#@ Fields with the D, N, L, and T roles are not emitted in
@ -367,6 +368,21 @@ sub check_field {
if $field[3];
}
# Field is a decoration, label, or title
if ($field[0] =~ /DLN/) {
#@ Format cannot be given when content is present (roles: DLN)
#@ xo_emit("{N:Max/%6.6s}", "Max");
#@ Fields with the D, L, or N roles can't have both
#@ static literal content ("{L:Label}") and a
#@ format ("{L:/%s}").
#@ This error will also occur when the content has a backslash
#@ in it, like "{N:Type of I/O}"; backslashes should be escaped,
#@ like "{N:Type of I\\/O}". Note the double backslash, one for
#@ handling 'C' strings, and one for libxo.
error("format cannot be given when content is present")
if $field[1] && $field[2];
}
# A value field
if (length($field[0]) == 0 || $field[0] =~ /V/) {
@ -527,7 +543,7 @@ sub check_field_format {
#@ for non-strings. This error may occur from a typo,
#@ like "{:tag/%6..6d}" where only one period should be used.
error("max width only valid for strings")
if $#chunks >= 2 && $fc =~ /[sS]/;
if $#chunks >= 2 && $fc !~ /[sS]/;
}
sub error {

View File

@ -127,6 +127,10 @@ class SDDbgInfo {
DbgValMap[Node].push_back(V);
}
/// \brief Invalidate all DbgValues attached to the node and remove
/// it from the Node-to-DbgValues map.
void erase(const SDNode *Node);
void clear() {
DbgValMap.clear();
DbgValues.clear();

View File

@ -625,6 +625,15 @@ void SelectionDAG::DeleteNodeNotInCSEMaps(SDNode *N) {
DeallocateNode(N);
}
void SDDbgInfo::erase(const SDNode *Node) {
DbgValMapType::iterator I = DbgValMap.find(Node);
if (I == DbgValMap.end())
return;
for (unsigned J = 0, N = I->second.size(); J != N; ++J)
I->second[J]->setIsInvalidated();
DbgValMap.erase(I);
}
void SelectionDAG::DeallocateNode(SDNode *N) {
if (N->OperandsNeedDelete)
delete[] N->OperandList;
@ -635,10 +644,9 @@ void SelectionDAG::DeallocateNode(SDNode *N) {
NodeAllocator.Deallocate(AllNodes.remove(N));
// If any of the SDDbgValue nodes refer to this SDNode, invalidate them.
ArrayRef<SDDbgValue*> DbgVals = DbgInfo->getSDDbgValues(N);
for (unsigned i = 0, e = DbgVals.size(); i != e; ++i)
DbgVals[i]->setIsInvalidated();
// If any of the SDDbgValue nodes refer to this SDNode, invalidate
// them and forget about that node.
DbgInfo->erase(N);
}
/// RemoveNodeFromCSEMaps - Take the specified node out of the CSE map that

View File

@ -0,0 +1,73 @@
Pull in r221709 from upstream llvm trunk (by Frédéric Riss):
Totally forget deallocated SDNodes in SDDbgInfo.
What would happen before that commit is that the SDDbgValues associated with
a deallocated SDNode would be marked Invalidated, but SDDbgInfo would keep
a map entry keyed by the SDNode pointer pointing to this list of invalidated
SDDbgNodes. As the memory gets reused, the list might get wrongly associated
with another new SDNode. As the SDDbgValues are cloned when they are transfered,
this can lead to an exponential number of SDDbgValues being produced during
DAGCombine like in http://llvm.org/bugs/show_bug.cgi?id=20893
Note that the previous behavior wasn't really buggy as the invalidation made
sure that the SDDbgValues won't be used. This commit can be considered a
memory optimization and as such is really hard to validate in a unit-test.
This should fix abnormally large memory usage and resulting OOM crashes
when compiling certain ports with debug information.
Reported by: Dmitry Marakasov <amdmi3@amdmi3.ru>
Upstream PRs: http://llvm.org/PR19031 http://llvm.org/PR20893
Introduced here: http://svnweb.freebsd.org/changeset/base/274442
Index: include/llvm/CodeGen/SelectionDAG.h
===================================================================
--- include/llvm/CodeGen/SelectionDAG.h
+++ include/llvm/CodeGen/SelectionDAG.h
@@ -127,6 +127,10 @@ class SDDbgInfo {
DbgValMap[Node].push_back(V);
}
+ /// \brief Invalidate all DbgValues attached to the node and remove
+ /// it from the Node-to-DbgValues map.
+ void erase(const SDNode *Node);
+
void clear() {
DbgValMap.clear();
DbgValues.clear();
Index: lib/CodeGen/SelectionDAG/SelectionDAG.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -625,6 +625,15 @@ void SelectionDAG::DeleteNodeNotInCSEMaps(SDNode *
DeallocateNode(N);
}
+void SDDbgInfo::erase(const SDNode *Node) {
+ DbgValMapType::iterator I = DbgValMap.find(Node);
+ if (I == DbgValMap.end())
+ return;
+ for (unsigned J = 0, N = I->second.size(); J != N; ++J)
+ I->second[J]->setIsInvalidated();
+ DbgValMap.erase(I);
+}
+
void SelectionDAG::DeallocateNode(SDNode *N) {
if (N->OperandsNeedDelete)
delete[] N->OperandList;
@@ -635,10 +644,9 @@ void SelectionDAG::DeallocateNode(SDNode *N) {
NodeAllocator.Deallocate(AllNodes.remove(N));
- // If any of the SDDbgValue nodes refer to this SDNode, invalidate them.
- ArrayRef<SDDbgValue*> DbgVals = DbgInfo->getSDDbgValues(N);
- for (unsigned i = 0, e = DbgVals.size(); i != e; ++i)
- DbgVals[i]->setIsInvalidated();
+ // If any of the SDDbgValue nodes refer to this SDNode, invalidate
+ // them and forget about that node.
+ DbgInfo->erase(N);
}
/// RemoveNodeFromCSEMaps - Take the specified node out of the CSE map that

View File

@ -31,7 +31,7 @@
*/
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <sys/stat.h>
#endif
#include <atf-c.h>
@ -251,7 +251,7 @@ ATF_TC_BODY(t_spawn_open_nonexistent, tc)
posix_spawn_file_actions_destroy(&fa);
}
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_TC(t_spawn_open_nonexistent_diag);
ATF_TC_HEAD(t_spawn_open_nonexistent_diag, tc)
@ -381,7 +381,7 @@ ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, t_spawn_fileactions);
ATF_TP_ADD_TC(tp, t_spawn_open_nonexistent);
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_TP_ADD_TC(tp, t_spawn_open_nonexistent_diag);
#endif
ATF_TP_ADD_TC(tp, t_spawn_reopen);

View File

@ -56,7 +56,7 @@ ATF_TC_BODY(getcwd_err, tc)
ATF_REQUIRE(getcwd(buf, 0) == NULL);
ATF_REQUIRE(errno == EINVAL);
#if defined(__NetBSD__)
#ifdef __NetBSD__
errno = 0;
ATF_REQUIRE(getcwd((void *)-1, sizeof(buf)) == NULL);

View File

@ -46,7 +46,7 @@ __RCSID("$NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin Exp $");
#include <string.h>
#include <errno.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include "h_macros.h"
#define __gl_stat_t struct stat
#define _S_IFDIR S_IFDIR
@ -138,7 +138,7 @@ gl_readdir(void *v)
dir.d_ino = dd->pos;
dir.d_type = f->dir ? DT_DIR : DT_REG;
DPRINTF(("readdir %s %d\n", dir.d_name, dir.d_type));
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
dir.d_reclen = -1; /* Does not have _DIRENT_RECLEN */
#else
dir.d_reclen = _DIRENT_RECLEN(&dir, dir.d_namlen);
@ -223,7 +223,7 @@ run(const char *p, int flags, const char **res, size_t len)
}
#if !defined(__FreeBSD__)
#ifndef __FreeBSD__
ATF_TC(glob_star);
ATF_TC_HEAD(glob_star, tc)
{
@ -272,7 +272,7 @@ ATF_TC_BODY(glob_nocheck, tc)
ATF_TP_ADD_TCS(tp)
{
#if !defined(__FreeBSD__)
#ifndef __FreeBSD__
ATF_TP_ADD_TC(tp, glob_star);
#endif
ATF_TP_ADD_TC(tp, glob_star_not);

View File

@ -34,7 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <libutil.h>
#else
#include <util.h>
@ -82,7 +82,7 @@ const struct hnopts {
/*
* Truncated output. Rev. 1.7 produces "1.0 K".
*/
#if !defined(__FreeBSD__)
#ifndef __FreeBSD__
{ 6, 1000, "A", HN_AUTOSCALE, HN_DECIMAL, -1, "" },
/*

View File

@ -72,7 +72,7 @@ ATF_TC_BODY(nice_err, tc)
{
int i;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_expect_fail("nice(incr) with incr < 0 fails with unprivileged "
"users and sets errno == EPERM; see PR # 189821 for more details");
#endif
@ -98,7 +98,7 @@ ATF_TC_HEAD(nice_priority, tc)
ATF_TC_BODY(nice_priority, tc)
{
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
int i, pri, pri2, nic;
#else
int i, pri, nic;
@ -115,7 +115,7 @@ ATF_TC_BODY(nice_priority, tc)
pri = getpriority(PRIO_PROCESS, 0);
ATF_REQUIRE(errno == 0);
#if defined(__NetBSD__)
#ifdef __NetBSD__
if (nic != pri)
atf_tc_fail("nice(3) and getpriority(2) conflict");
#endif
@ -130,14 +130,14 @@ ATF_TC_BODY(nice_priority, tc)
if (pid == 0) {
errno = 0;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
pri = getpriority(PRIO_PROCESS, 0);
#else
pri2 = getpriority(PRIO_PROCESS, 0);
#endif
ATF_REQUIRE(errno == 0);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
if (pri != pri2)
#else
if (nic != pri)
@ -180,7 +180,7 @@ ATF_TC_HEAD(nice_thread, tc)
ATF_TC_BODY(nice_thread, tc)
{
pthread_t tid[5];
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
int pri, rv, val;
#else
int rv, val;
@ -196,7 +196,7 @@ ATF_TC_BODY(nice_thread, tc)
val = nice(i);
ATF_REQUIRE(val != -1);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
pri = getpriority(PRIO_PROCESS, 0);
rv = pthread_create(&tid[i], NULL, threadfunc, &pri);
#else

View File

@ -43,7 +43,7 @@ static int count;
static void handler_err(int);
static void handler_ret(int);
static void handler_stress(int);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
static int sig[] = { SIGALRM, SIGIO, SIGUSR1, SIGUSR2 };
#else
static int sig[] = { SIGALRM, SIGIO, SIGUSR1, SIGUSR2, SIGPWR };

View File

@ -63,7 +63,7 @@ ATF_TC_BODY(setdomainname_basic, tc)
(void)memset(name, 0, sizeof(name));
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
/*
* Sanity checks to ensure that the wrong invariant isn't being
* tested for per PR # 181127
@ -101,7 +101,7 @@ ATF_TC_BODY(setdomainname_limit, tc)
(void)memset(name, 0, sizeof(name));
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
ATF_REQUIRE(setdomainname(name, MAXHOSTNAMELEN - 1 ) == 0);
ATF_REQUIRE(setdomainname(name, MAXHOSTNAMELEN) == -1);
#endif

View File

@ -28,7 +28,7 @@
#include <atf-c.h>
#if defined(__NetBSD__)
#ifdef __NetBSD__
#include <sys/inttypes.h>
#endif
#include <sys/resource.h>
@ -87,7 +87,7 @@ sig_debug(int signo, siginfo_t *info, ucontext_t *ctx)
printf("uc_stack %p %lu 0x%x\n", ctx->uc_stack.ss_sp,
(unsigned long)ctx->uc_stack.ss_size,
ctx->uc_stack.ss_flags);
#if defined(__NetBSD__)
#ifdef __NetBSD__
for (i = 0; i < __arraycount(ctx->uc_mcontext.__gregs); i++)
printf("uc_mcontext.greg[%d] 0x%lx\n", i,
(long)ctx->uc_mcontext.__gregs[i]);
@ -144,7 +144,7 @@ sigchild_action(int signo, siginfo_t *info, void *ptr)
printf("si_uid=%d\n", info->si_uid);
printf("si_pid=%d\n", info->si_pid);
printf("si_status=%d\n", info->si_status);
#if defined(__NetBSD__)
#ifdef __NetBSD__
printf("si_utime=%lu\n", (unsigned long int)info->si_utime);
printf("si_stime=%lu\n", (unsigned long int)info->si_stime);
#endif

View File

@ -31,7 +31,7 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_time.c,v 1.2 2011/11/11 05:03:38 jruoho Exp $");
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <sys/time.h>
#endif
#include <atf-c.h>

View File

@ -107,7 +107,7 @@ ATF_TC_BODY(ttyname_r_err, tc)
ATF_REQUIRE(rv == ERANGE);
}
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_expect_fail("FreeBSD returns ENOTTY instead of EBADF; see bin/191936");
#endif
rv = ttyname_r(-1, buf, ttymax);

View File

@ -132,7 +132,7 @@ h_ctype2(const struct test *t, bool use_mbstate)
size_t n;
ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL);
#else
if (setlocale(LC_CTYPE, t->locale) == NULL) {
@ -245,7 +245,7 @@ ATF_TC_BODY(mbrtowc_internal, tc)
{
struct test *t;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_expect_fail("ja_* locale fails");
#endif
for (t = &tests[0]; t->data != NULL; ++t)

View File

@ -150,7 +150,7 @@ ATF_TC_BODY(mbstowcs_basic, tc)
int i;
ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL);
#else
if (setlocale(LC_CTYPE, t->locale) == NULL) {

View File

@ -76,7 +76,7 @@ h_mbtowc(const char *locale, const char *illegal, const char *legal)
char *str;
ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_REQUIRE(setlocale(LC_CTYPE, locale) != NULL);
#else
if (setlocale(LC_CTYPE, locale) == NULL) {
@ -137,13 +137,13 @@ ATF_TC_BODY(mbtowc, tc)
h_mbtowc("ja_JP.ISO2022-JP", "\033$B", "\033$B$\"\033(B");
h_mbtowc("ja_JP.SJIS", "\202", "\202\240");
h_mbtowc("ja_JP.eucJP", "\244", "\244\242");
#if !defined(__FreeBSD__)
#ifndef __FreeBSD__
/* Moved last as it fails */
h_mbtowc("zh_CN.GB18030", "\241", "\241\241");
#endif
h_mbtowc("zh_TW.Big5", "\241", "\241@");
h_mbtowc("zh_TW.eucTW", "\241", "\241\241");
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_expect_fail("zh_CN.GB18030");
h_mbtowc("zh_CN.GB18030", "\241", "\241\241");
#endif

View File

@ -66,7 +66,7 @@ __RCSID("$NetBSD: t_wcstod.c,v 1.3 2011/10/01 17:56:11 christos Exp $");
#include <atf-c.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <stdio.h>
#endif

View File

@ -109,7 +109,7 @@ h_wctomb(const struct test *t, char tc)
size_t sz, ret, i;
ATF_REQUIRE_STREQ(setlocale(LC_ALL, "C"), "C");
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_REQUIRE(setlocale(LC_CTYPE, t->locale) != NULL);
#else
if (setlocale(LC_CTYPE, t->locale) == NULL) {

View File

@ -46,14 +46,14 @@ __RCSID("$NetBSD: t_ether_aton.c,v 1.1 2011/11/01 22:36:53 pgoyette Exp $");
#include <string.h>
#include <errno.h>
#if !defined(__NetBSD__)
#if defined(__linux__)
#ifndef __NetBSD__
#ifdef __linux__
#include <netinet/ether.h>
#endif
#include <net/ethernet.h>
#endif
#if defined(__NetBSD__)
#ifdef __NetBSD__
#define ETHER_ADDR_LEN 6
int ether_aton_r(u_char *dest, size_t len, const char *str);
@ -65,7 +65,7 @@ static const struct {
int error;
} tests[] = {
{ { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab }, "01:23:45:67:89:ab", 0 },
#if defined(__NetBSD__)
#ifdef __NetBSD__
{ { 0x00, 0x01, 0x22, 0x03, 0x14, 0x05 }, "0:1:22-3:14:05", 0 },
{ { 0x00, 0x01, 0x22, 0x03, 0x14, 0x05 }, "000122031405", 0 },
{ { 0x0a, 0x0B, 0xcc, 0xdD, 0xEE, 0x0f }, "0a0BccdDEE0f", 0 },
@ -86,13 +86,13 @@ ATF_TC_HEAD(tc_ether_aton, tc)
ATF_TC_BODY(tc_ether_aton, tc)
{
#if defined(__NetBSD__)
#ifdef __NetBSD__
u_char dest[ETHER_ADDR_LEN];
#else
struct ether_addr dest;
#endif
size_t t;
#if defined(__NetBSD__)
#ifdef __NetBSD__
int e, r;
#else
int e;
@ -103,7 +103,7 @@ ATF_TC_BODY(tc_ether_aton, tc)
for (t = 0; tests[t].str; t++) {
s = tests[t].str;
if ((e = tests[t].error) == 0) {
#if defined(__NetBSD__)
#ifdef __NetBSD__
if (ether_aton_r(dest, sizeof(dest), s) != e)
atf_tc_fail("failed on `%s'", s);
if (memcmp(dest, tests[t].res, sizeof(dest)) != 0)
@ -115,7 +115,7 @@ ATF_TC_BODY(tc_ether_aton, tc)
atf_tc_fail("unexpected result on `%s'", s);
#endif
} else {
#if defined(__NetBSD__)
#ifdef __NetBSD__
if ((r = ether_aton_r(dest, sizeof(dest), s)) != e)
atf_tc_fail("unexpectedly succeeded on `%s' "
"(%d != %d)", s, r, e);

View File

@ -34,7 +34,7 @@
#include <string.h>
#include <sys/types.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <wchar.h>
#include <wctype.h>
#endif
@ -54,7 +54,7 @@ static char *regchar(int);
void
regprint(regex_t *r, FILE *d)
{
#if defined(__NetBSD__)
#ifdef __NetBSD__
struct re_guts *g = r->re_g;
int c;
int last;
@ -177,7 +177,7 @@ s_print(struct re_guts *g, FILE *d)
break;
case OANYOF:
fprintf(d, "[(%ld)", (long)opnd);
#if defined(__NetBSD__)
#ifdef __NetBSD__
cs = &g->sets[opnd];
last = -1;
for (size_t i = 0; i < g->csetsize+1; i++) /* +1 flushes */
@ -250,7 +250,7 @@ s_print(struct re_guts *g, FILE *d)
fprintf(d, ">");
break;
default:
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
fprintf(d, "!%ld(%ld)!", OP(*s), opnd);
#else
fprintf(d, "!%d(%d)!", OP(*s), opnd);

View File

@ -45,7 +45,7 @@ __RCSID("$NetBSD: t_exhaust.c,v 1.7 2011/11/16 18:37:31 christos Exp $");
#include <stdlib.h>
#include <err.h>
#include <atf-c.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <sys/resource.h>
#endif
@ -179,7 +179,7 @@ ATF_TC_HEAD(regcomp_too_big, tc)
" crash, but return a proper error code");
// libtre needs it.
atf_tc_set_md_var(tc, "timeout", "600");
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_set_md_var(tc, "require.memory", "64M");
#else
atf_tc_set_md_var(tc, "require.memory", "120M");
@ -189,12 +189,12 @@ ATF_TC_HEAD(regcomp_too_big, tc)
ATF_TC_BODY(regcomp_too_big, tc)
{
regex_t re;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
struct rlimit limit;
#endif
int e;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
limit.rlim_cur = limit.rlim_max = 64 * 1024 * 1024;
ATF_REQUIRE(setrlimit(RLIMIT_VMEM, &limit) != -1);
#endif

View File

@ -48,7 +48,7 @@ __RCSID("$NetBSD: t_regex_att.c,v 1.1 2012/08/24 20:24:40 jmmv Exp $");
#include <vis.h>
#include <ctype.h>
#include <atf-c.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <libutil.h>
#endif
@ -377,7 +377,7 @@ checkmatches(const char *matches, size_t nm, const regmatch_t *pm,
" cur=%d, max=%zu", res, l, len - off);
off += l;
}
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
ATF_CHECK_STREQ_MSG(res, matches, " at line %zu", lineno);
#else
ATF_REQUIRE_STREQ_MSG(res, matches, " at line %zu", lineno);
@ -580,7 +580,7 @@ ATF_TC_BODY(leftassoc, tc)
* any explation. Mark as broken here, but I don't know why. */
atf_tc_expect_fail("Reason for breakage unknown");
#endif
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_expect_fail("The expected and matched groups are mismatched on FreeBSD");
#endif
att_test(tc, "leftassoc");

View File

@ -42,7 +42,7 @@ __RCSID("$NetBSD: h_atexit.c,v 1.1 2011/01/12 19:44:08 pgoyette Exp $");
extern int __cxa_atexit(void (*func)(void *), void *, void *);
extern void __cxa_finalize(void *);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
/*
* On shared object unload, in __cxa_finalize, call and clear all installed
* atexit and __cxa_atexit handlers that are either installed by unloaded
@ -191,7 +191,7 @@ main(int argc, char *argv[])
ASSERT(0 == atexit(normal_handler_0));
ASSERT(0 == atexit(normal_handler_1));
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
ASSERT(0 == __cxa_atexit(cxa_handler_4, &arg_1, dso_handle_1));
ASSERT(0 == __cxa_atexit(cxa_handler_5, &arg_1, dso_handle_1));
ASSERT(0 == __cxa_atexit(cxa_handler_3, &arg_2, dso_handle_2));

View File

@ -34,7 +34,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <err.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <libutil.h>
#endif

View File

@ -36,7 +36,7 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <libutil.h>
#endif

View File

@ -40,7 +40,7 @@ __RCSID("$NetBSD: t_getenv.c,v 1.2 2011/07/15 13:54:31 jruoho Exp $");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <signal.h>
#endif
@ -155,7 +155,7 @@ ATF_TC_BODY(setenv_basic, tc)
ATF_CHECK_ERRNO(EINVAL, setenv(NULL, "val", 1) == -1);
ATF_CHECK_ERRNO(EINVAL, setenv("", "val", 1) == -1);
ATF_CHECK_ERRNO(EINVAL, setenv("v=r", "val", 1) == -1);
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
/*
Both FreeBSD and OS/X does not validate the second
argument to setenv(3)

View File

@ -75,7 +75,7 @@ __RCSID("$NetBSD: t_hsearch.c,v 1.4 2014/07/20 20:17:21 christos Exp $");
#define REQUIRE_ERRNO(x) ATF_REQUIRE_MSG(x, "%s", strerror(errno))
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_TC(hsearch_basic);
ATF_TC_HEAD(hsearch_basic, tc)
{
@ -231,7 +231,7 @@ ATF_TC_BODY(hsearch_two, tc)
hdestroy();
}
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_TC(hsearch_r_basic);
ATF_TC_HEAD(hsearch_r_basic, tc)
{
@ -389,14 +389,14 @@ ATF_TC_BODY(hsearch_r_two, tc)
ATF_TP_ADD_TCS(tp)
{
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_TP_ADD_TC(tp, hsearch_basic);
#endif
ATF_TP_ADD_TC(tp, hsearch_duplicate);
ATF_TP_ADD_TC(tp, hsearch_nonexistent);
ATF_TP_ADD_TC(tp, hsearch_two);
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_TP_ADD_TC(tp, hsearch_r_basic);
#endif
ATF_TP_ADD_TC(tp, hsearch_r_duplicate);

View File

@ -51,7 +51,7 @@ unsigned char *start[BLOCKTYPES] = {
};
char result[100];
#if defined(__NetBSD__)
#ifdef __NetBSD__
const char goodResult[] = "7b405d24bc03195474c70ddae9e1f8fb";
#else
const char goodResult[] = "217b4fbe456916bf62a2f85df752e4ab";
@ -93,7 +93,7 @@ ATF_TC_BODY(memcpy_basic, tc)
start[2] = auto1;
start[3] = auto2;
#if defined(__NetBSD__)
#ifdef __NetBSD__
srandom(0L);
#else
/*

View File

@ -37,7 +37,7 @@ __RCSID("$NetBSD: t_strerror.c,v 1.3 2011/05/10 06:55:27 jruoho Exp $");
#include <locale.h>
#include <string.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <stdio.h>
#endif

View File

@ -40,7 +40,7 @@ __RCSID("$NetBSD: t_access.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $");
#include <atf-c.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <sys/stat.h>
#endif

View File

@ -63,7 +63,7 @@ __RCSID("$NetBSD: t_clock_gettime.c,v 1.1 2011/10/15 06:42:16 jruoho Exp $");
#include <sys/param.h>
#include <sys/sysctl.h>
#if defined(__NetBSD__)
#ifdef __NetBSD__
#include <machine/int_limits.h>
#endif
@ -75,7 +75,7 @@ __RCSID("$NetBSD: t_clock_gettime.c,v 1.1 2011/10/15 06:42:16 jruoho Exp $");
#include <time.h>
#include <unistd.h>
#if defined(__NetBSD__)
#ifdef __NetBSD__
#include "../../../h_macros.h"
#else
#include <limits.h>

View File

@ -57,7 +57,7 @@ ATF_TC_BODY(getgroups_err, tc)
errno = 0;
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
atf_tc_expect_fail("Reported as kern/189941");
#endif
ATF_REQUIRE(getgroups(-1, gidset) == -1);

View File

@ -47,7 +47,7 @@ static void sighandler(int);
static const size_t maxiter = 2000;
static void
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
sighandler(int signo __unused)
#else
sighandler(int signo)

View File

@ -149,11 +149,11 @@ ATF_TC_BODY(kqueue_desc_passing, tc)
printf("parent (pid %d): sending kq fd %d\n", getpid(), kq);
if (sendmsg(s[0], &m, 0) == -1) {
#if defined(__NetBSD__)
#ifdef __NetBSD__
ATF_REQUIRE_EQ_MSG(errno, EBADF, "errno is %d", errno);
atf_tc_skip("PR kern/46523");
#endif
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
ATF_REQUIRE_EQ_MSG(errno, EOPNOTSUPP, "errno is %d", errno);
close(s[0]);
#endif

View File

@ -36,7 +36,7 @@
#include <arpa/inet.h>
#include <netinet/in.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <sys/socket.h>
#endif

View File

@ -47,7 +47,7 @@ __RCSID("$NetBSD: t_msgrcv.c,v 1.3 2013/07/24 11:44:10 skrll Exp $");
#include <time.h>
#include <unistd.h>
#if defined(__FreeBSD__)
#ifdef __FreeBSD__
#include <limits.h>
#endif

Some files were not shown because too many files have changed in this diff Show More