Merge ^/head r317216 through r317280.
This commit is contained in:
commit
d0338a294d
@ -25,13 +25,13 @@
|
||||
.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||
.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
|
||||
.\" Copyright (c) 2013, Steven Hartland <smh@FreeBSD.org>
|
||||
.\" Copyright (c) 2014 Nexenta Systems, Inc. All Rights Reserved.
|
||||
.\" Copyright (c) 2016 Nexenta Systems, Inc. All Rights Reserved.
|
||||
.\" Copyright (c) 2014, Xin LI <delphij@FreeBSD.org>
|
||||
.\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved.
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 31, 2016
|
||||
.Dd September 16, 2016
|
||||
.Dt ZFS 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -114,7 +114,7 @@
|
||||
.Op Fl t Ar type Ns Oo , Ns type Ns Oc Ns ...
|
||||
.Oo Fl s Ar property Oc Ns ...
|
||||
.Oo Fl S Ar property Oc Ns ...
|
||||
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
|
||||
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot | Ns Ar bookmark Ns ...
|
||||
.Nm
|
||||
.Cm set
|
||||
.Ar property Ns = Ns Ar value Oo Ar property Ns = Ns Ar value Oc Ns ...
|
||||
@ -2156,7 +2156,7 @@ section.
|
||||
.Op Fl t Ar type Ns Oo , Ns Ar type Oc Ns ...
|
||||
.Op Fl s Ar source Ns Oo , Ns Ar source Oc Ns ...
|
||||
.Ar all | property Ns Oo , Ns Ar property Oc Ns ...
|
||||
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns ...
|
||||
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns | Ns Ar bookmark Ns ...
|
||||
.Xc
|
||||
.Pp
|
||||
Displays properties for the given datasets. If no datasets are specified, then
|
||||
|
@ -243,7 +243,7 @@ get_usage(zfs_help_t idx)
|
||||
"[-o \"all\" | field[,...]]\n"
|
||||
"\t [-t type[,...]] [-s source[,...]]\n"
|
||||
"\t <\"all\" | property[,...]> "
|
||||
"[filesystem|volume|snapshot] ...\n"));
|
||||
"[filesystem|volume|snapshot|bookmark] ...\n"));
|
||||
case HELP_INHERIT:
|
||||
return (gettext("\tinherit [-rS] <property> "
|
||||
"<filesystem|volume|snapshot> ...\n"));
|
||||
@ -1622,7 +1622,7 @@ zfs_do_get(int argc, char **argv)
|
||||
{
|
||||
zprop_get_cbdata_t cb = { 0 };
|
||||
int i, c, flags = ZFS_ITER_ARGS_CAN_BE_PATHS;
|
||||
int types = ZFS_TYPE_DATASET;
|
||||
int types = ZFS_TYPE_DATASET | ZFS_TYPE_BOOKMARK;
|
||||
char *value, *fields;
|
||||
int ret = 0;
|
||||
int limit = 0;
|
||||
|
@ -103,7 +103,7 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *path, int type,
|
||||
char what;
|
||||
|
||||
(void) zfs_prop_get_table();
|
||||
if (dataset_namecheck(path, &why, &what) != 0) {
|
||||
if (entity_namecheck(path, &why, &what) != 0) {
|
||||
if (hdl != NULL) {
|
||||
switch (why) {
|
||||
case NAME_ERR_TOOLONG:
|
||||
@ -132,9 +132,10 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *path, int type,
|
||||
"'%c' in name"), what);
|
||||
break;
|
||||
|
||||
case NAME_ERR_MULTIPLE_AT:
|
||||
case NAME_ERR_MULTIPLE_DELIMITERS:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"multiple '@' delimiters in name"));
|
||||
"multiple '@' and/or '#' delimiters in "
|
||||
"name"));
|
||||
break;
|
||||
|
||||
case NAME_ERR_NOLETTER:
|
||||
@ -165,7 +166,7 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *path, int type,
|
||||
if (!(type & ZFS_TYPE_SNAPSHOT) && strchr(path, '@') != NULL) {
|
||||
if (hdl != NULL)
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"snapshot delimiter '@' in filesystem name"));
|
||||
"snapshot delimiter '@' is not expected here"));
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -176,6 +177,20 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *path, int type,
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (!(type & ZFS_TYPE_BOOKMARK) && strchr(path, '#') != NULL) {
|
||||
if (hdl != NULL)
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"bookmark delimiter '#' is not expected here"));
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (type == ZFS_TYPE_BOOKMARK && strchr(path, '#') == NULL) {
|
||||
if (hdl != NULL)
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"missing '#' delimiter in bookmark name"));
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (modifying && strchr(path, '%') != NULL) {
|
||||
if (hdl != NULL)
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
@ -613,8 +628,36 @@ make_bookmark_handle(zfs_handle_t *parent, const char *path,
|
||||
return (zhp);
|
||||
}
|
||||
|
||||
struct zfs_open_bookmarks_cb_data {
|
||||
const char *path;
|
||||
zfs_handle_t *zhp;
|
||||
};
|
||||
|
||||
static int
|
||||
zfs_open_bookmarks_cb(zfs_handle_t *zhp, void *data)
|
||||
{
|
||||
struct zfs_open_bookmarks_cb_data *dp = data;
|
||||
|
||||
/*
|
||||
* Is it the one we are looking for?
|
||||
*/
|
||||
if (strcmp(dp->path, zfs_get_name(zhp)) == 0) {
|
||||
/*
|
||||
* We found it. Save it and let the caller know we are done.
|
||||
*/
|
||||
dp->zhp = zhp;
|
||||
return (EEXIST);
|
||||
}
|
||||
|
||||
/*
|
||||
* Not found. Close the handle and ask for another one.
|
||||
*/
|
||||
zfs_close(zhp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Opens the given snapshot, filesystem, or volume. The 'types'
|
||||
* Opens the given snapshot, bookmark, filesystem, or volume. The 'types'
|
||||
* argument is a mask of acceptable types. The function will print an
|
||||
* appropriate error message and return NULL if it can't be opened.
|
||||
*/
|
||||
@ -623,6 +666,7 @@ zfs_open(libzfs_handle_t *hdl, const char *path, int types)
|
||||
{
|
||||
zfs_handle_t *zhp;
|
||||
char errbuf[1024];
|
||||
char *bookp;
|
||||
|
||||
(void) snprintf(errbuf, sizeof (errbuf),
|
||||
dgettext(TEXT_DOMAIN, "cannot open '%s'"), path);
|
||||
@ -630,20 +674,68 @@ zfs_open(libzfs_handle_t *hdl, const char *path, int types)
|
||||
/*
|
||||
* Validate the name before we even try to open it.
|
||||
*/
|
||||
if (!zfs_validate_name(hdl, path, ZFS_TYPE_DATASET, B_FALSE)) {
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"invalid dataset name"));
|
||||
if (!zfs_validate_name(hdl, path, types, B_FALSE)) {
|
||||
(void) zfs_error(hdl, EZFS_INVALIDNAME, errbuf);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to get stats for the dataset, which will tell us if it exists.
|
||||
* Bookmarks needs to be handled separately.
|
||||
*/
|
||||
errno = 0;
|
||||
if ((zhp = make_dataset_handle(hdl, path)) == NULL) {
|
||||
(void) zfs_standard_error(hdl, errno, errbuf);
|
||||
return (NULL);
|
||||
bookp = strchr(path, '#');
|
||||
if (bookp == NULL) {
|
||||
/*
|
||||
* Try to get stats for the dataset, which will tell us if it
|
||||
* exists.
|
||||
*/
|
||||
errno = 0;
|
||||
if ((zhp = make_dataset_handle(hdl, path)) == NULL) {
|
||||
(void) zfs_standard_error(hdl, errno, errbuf);
|
||||
return (NULL);
|
||||
}
|
||||
} else {
|
||||
char dsname[ZFS_MAX_DATASET_NAME_LEN];
|
||||
zfs_handle_t *pzhp;
|
||||
struct zfs_open_bookmarks_cb_data cb_data = {path, NULL};
|
||||
|
||||
/*
|
||||
* We need to cut out '#' and everything after '#'
|
||||
* to get the parent dataset name only.
|
||||
*/
|
||||
assert(bookp - path < sizeof (dsname));
|
||||
(void) strncpy(dsname, path, bookp - path);
|
||||
dsname[bookp - path] = '\0';
|
||||
|
||||
/*
|
||||
* Create handle for the parent dataset.
|
||||
*/
|
||||
errno = 0;
|
||||
if ((pzhp = make_dataset_handle(hdl, dsname)) == NULL) {
|
||||
(void) zfs_standard_error(hdl, errno, errbuf);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Iterate bookmarks to find the right one.
|
||||
*/
|
||||
errno = 0;
|
||||
if ((zfs_iter_bookmarks(pzhp, zfs_open_bookmarks_cb,
|
||||
&cb_data) == 0) && (cb_data.zhp == NULL)) {
|
||||
(void) zfs_error(hdl, EZFS_NOENT, errbuf);
|
||||
zfs_close(pzhp);
|
||||
return (NULL);
|
||||
}
|
||||
if (cb_data.zhp == NULL) {
|
||||
(void) zfs_standard_error(hdl, errno, errbuf);
|
||||
zfs_close(pzhp);
|
||||
return (NULL);
|
||||
}
|
||||
zhp = cb_data.zhp;
|
||||
|
||||
/*
|
||||
* Cleanup.
|
||||
*/
|
||||
zfs_close(pzhp);
|
||||
}
|
||||
|
||||
if (zhp == NULL) {
|
||||
|
@ -947,9 +947,10 @@ zpool_name_valid(libzfs_handle_t *hdl, boolean_t isopen, const char *pool)
|
||||
"trailing slash in name"));
|
||||
break;
|
||||
|
||||
case NAME_ERR_MULTIPLE_AT:
|
||||
case NAME_ERR_MULTIPLE_DELIMITERS:
|
||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
||||
"multiple '@' delimiters in name"));
|
||||
"multiple '@' and/or '#' delimiters in "
|
||||
"name"));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -718,7 +718,7 @@ zfs_get_pool_handle(const zfs_handle_t *zhp)
|
||||
* Given a name, determine whether or not it's a valid path
|
||||
* (starts with '/' or "./"). If so, walk the mnttab trying
|
||||
* to match the device number. If not, treat the path as an
|
||||
* fs/vol/snap name.
|
||||
* fs/vol/snap/bkmark name.
|
||||
*/
|
||||
zfs_handle_t *
|
||||
zfs_path_to_zhandle(libzfs_handle_t *hdl, char *path, zfs_type_t argtype)
|
||||
|
@ -1,3 +1,29 @@
|
||||
2017-04-20 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* Makefile (_MAKE_VERSION): 20170420
|
||||
Merge with NetBSD make, pick up
|
||||
o main.c: only use -C arg "as is" if it contains no
|
||||
relative component.
|
||||
|
||||
2017-04-18 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* Makefile (_MAKE_VERSION): 20170418
|
||||
Merge with NetBSD make, pick up
|
||||
o main.c: fix Main_SetObjdir() for relative paths (eg obj).
|
||||
|
||||
2017-04-17 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* Makefile (_MAKE_VERSION): 20170417
|
||||
Merge with NetBSD make, pick up
|
||||
o fixes a number of coverity complaints
|
||||
- check return value of fseek, fcntl
|
||||
- plug memory leak in Dir_FindFile, Var_LoopExpand,
|
||||
JobPrintCommand, ParseTraditionalInclude
|
||||
- use bmake_malloc() where NULL is not tollerated
|
||||
- use MAKE_ATTR_UNUSED rather that kludges like
|
||||
return(unused ? 0 : 0)
|
||||
- use purge_cached_realpaths() rather than abuse cached_realpath()
|
||||
|
||||
2017-04-13 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* Makefile (_MAKE_VERSION): 20170413
|
||||
|
@ -1,7 +1,7 @@
|
||||
# $Id: Makefile,v 1.85 2017/04/13 16:29:40 sjg Exp $
|
||||
# $Id: Makefile,v 1.88 2017/04/20 14:51:14 sjg Exp $
|
||||
|
||||
# Base version on src date
|
||||
_MAKE_VERSION= 20170413
|
||||
_MAKE_VERSION= 20170420
|
||||
|
||||
PROG= bmake
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $ */
|
||||
/* $NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $";
|
||||
static char rcsid[] = "$NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: arch.c,v 1.69 2016/04/06 09:57:00 gson Exp $");
|
||||
__RCSID("$NetBSD: arch.c,v 1.70 2017/04/16 20:49:09 riastradh Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -726,7 +726,8 @@ ArchStatMember(char *archive, char *member, Boolean hash)
|
||||
if (fread(memName, elen, 1, arch) != 1)
|
||||
goto badarch;
|
||||
memName[elen] = '\0';
|
||||
fseek(arch, -elen, SEEK_CUR);
|
||||
if (fseek(arch, -elen, SEEK_CUR) != 0)
|
||||
goto badarch;
|
||||
if (DEBUG(ARCH) || DEBUG(MAKE)) {
|
||||
fprintf(debug_file, "ArchStat: Extended format entry for %s\n", memName);
|
||||
}
|
||||
@ -737,7 +738,8 @@ ArchStatMember(char *archive, char *member, Boolean hash)
|
||||
Hash_SetValue(he, bmake_malloc(sizeof(struct ar_hdr)));
|
||||
memcpy(Hash_GetValue(he), &arh, sizeof(struct ar_hdr));
|
||||
}
|
||||
fseek(arch, (size + 1) & ~1, SEEK_CUR);
|
||||
if (fseek(arch, (size + 1) & ~1, SEEK_CUR) != 0)
|
||||
goto badarch;
|
||||
}
|
||||
|
||||
fclose(arch);
|
||||
@ -956,7 +958,10 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr,
|
||||
* the file at the actual member, rather than its header, but
|
||||
* not here...
|
||||
*/
|
||||
fseek(arch, -sizeof(struct ar_hdr), SEEK_CUR);
|
||||
if (fseek(arch, -sizeof(struct ar_hdr), SEEK_CUR) != 0) {
|
||||
fclose(arch);
|
||||
return NULL;
|
||||
}
|
||||
return (arch);
|
||||
}
|
||||
} else
|
||||
@ -986,10 +991,17 @@ ArchFindMember(char *archive, char *member, struct ar_hdr *arhPtr,
|
||||
}
|
||||
if (strncmp(ename, member, len) == 0) {
|
||||
/* Found as extended name */
|
||||
fseek(arch, -sizeof(struct ar_hdr) - elen, SEEK_CUR);
|
||||
if (fseek(arch, -sizeof(struct ar_hdr) - elen,
|
||||
SEEK_CUR) != 0) {
|
||||
fclose(arch);
|
||||
return NULL;
|
||||
}
|
||||
return (arch);
|
||||
}
|
||||
fseek(arch, -elen, SEEK_CUR);
|
||||
if (fseek(arch, -elen, SEEK_CUR) != 0) {
|
||||
fclose(arch);
|
||||
return NULL;
|
||||
}
|
||||
goto skip;
|
||||
} else
|
||||
#endif
|
||||
@ -1002,9 +1014,12 @@ skip:
|
||||
* extract the size of the file from the 'size' field of the
|
||||
* header and round it up during the seek.
|
||||
*/
|
||||
arhPtr->ar_size[sizeof(arhPtr->AR_SIZE)-1] = '\0';
|
||||
arhPtr->AR_SIZE[sizeof(arhPtr->AR_SIZE)-1] = '\0';
|
||||
size = (int)strtol(arhPtr->AR_SIZE, NULL, 10);
|
||||
fseek(arch, (size + 1) & ~1, SEEK_CUR);
|
||||
if (fseek(arch, (size + 1) & ~1, SEEK_CUR) != 0) {
|
||||
fclose(arch);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cond.c,v 1.74 2016/02/18 18:29:14 christos Exp $ */
|
||||
/* $NetBSD: cond.c,v 1.75 2017/04/16 20:59:04 riastradh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -70,14 +70,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: cond.c,v 1.74 2016/02/18 18:29:14 christos Exp $";
|
||||
static char rcsid[] = "$NetBSD: cond.c,v 1.75 2017/04/16 20:59:04 riastradh Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: cond.c,v 1.74 2016/02/18 18:29:14 christos Exp $");
|
||||
__RCSID("$NetBSD: cond.c,v 1.75 2017/04/16 20:59:04 riastradh Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -91,6 +91,7 @@ __RCSID("$NetBSD: cond.c,v 1.74 2016/02/18 18:29:14 christos Exp $");
|
||||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h> /* For strtoul() error checking */
|
||||
|
||||
@ -1174,8 +1175,9 @@ Cond_EvalExpression(const struct If *info, char *line, Boolean *value, int eprin
|
||||
break;
|
||||
dflt_info = info;
|
||||
}
|
||||
assert(info != NULL);
|
||||
|
||||
if_info = info != NULL ? info : ifs + 4;
|
||||
if_info = info;
|
||||
condExpr = line;
|
||||
condPushBack = TOK_NONE;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dir.c,v 1.69 2017/01/31 06:54:23 sjg Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -70,14 +70,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: dir.c,v 1.69 2017/01/31 06:54:23 sjg Exp $";
|
||||
static char rcsid[] = "$NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: dir.c,v 1.69 2017/01/31 06:54:23 sjg Exp $");
|
||||
__RCSID("$NetBSD: dir.c,v 1.71 2017/04/16 21:14:47 riastradh Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -803,11 +803,11 @@ DirExpandInt(const char *word, Lst path, Lst expansions)
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
DirPrintWord(void *word, void *dummy)
|
||||
DirPrintWord(void *word, void *dummy MAKE_ATTR_UNUSED)
|
||||
{
|
||||
fprintf(debug_file, "%s ", (char *)word);
|
||||
|
||||
return(dummy ? 0 : 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-
|
||||
@ -1315,8 +1315,14 @@ Dir_FindFile(const char *name, Lst path)
|
||||
fprintf(debug_file, " Trying exact path matches...\n");
|
||||
}
|
||||
|
||||
if (!hasLastDot && cur && (file = DirLookupAbs(cur, name, cp)) != NULL)
|
||||
return *file?file:NULL;
|
||||
if (!hasLastDot && cur && ((file = DirLookupAbs(cur, name, cp))
|
||||
!= NULL)) {
|
||||
if (file[0] == '\0') {
|
||||
free(file);
|
||||
return NULL;
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
(void)Lst_Open(path);
|
||||
while ((ln = Lst_Next(path)) != NULL) {
|
||||
@ -1325,13 +1331,23 @@ Dir_FindFile(const char *name, Lst path)
|
||||
continue;
|
||||
if ((file = DirLookupAbs(p, name, cp)) != NULL) {
|
||||
Lst_Close(path);
|
||||
return *file?file:NULL;
|
||||
if (file[0] == '\0') {
|
||||
free(file);
|
||||
return NULL;
|
||||
}
|
||||
return file;
|
||||
}
|
||||
}
|
||||
Lst_Close(path);
|
||||
|
||||
if (hasLastDot && cur && (file = DirLookupAbs(cur, name, cp)) != NULL)
|
||||
return *file?file:NULL;
|
||||
if (hasLastDot && cur && ((file = DirLookupAbs(cur, name, cp))
|
||||
!= NULL)) {
|
||||
if (file[0] == '\0') {
|
||||
free(file);
|
||||
return NULL;
|
||||
}
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1851,10 +1867,10 @@ Dir_PrintDirectories(void)
|
||||
}
|
||||
|
||||
static int
|
||||
DirPrintDir(void *p, void *dummy)
|
||||
DirPrintDir(void *p, void *dummy MAKE_ATTR_UNUSED)
|
||||
{
|
||||
fprintf(debug_file, "%s ", ((Path *)p)->name);
|
||||
return (dummy ? 0 : 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: for.c,v 1.52 2016/02/18 18:29:14 christos Exp $ */
|
||||
/* $NetBSD: for.c,v 1.53 2017/04/16 21:04:44 riastradh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, The Regents of the University of California.
|
||||
@ -30,14 +30,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: for.c,v 1.52 2016/02/18 18:29:14 christos Exp $";
|
||||
static char rcsid[] = "$NetBSD: for.c,v 1.53 2017/04/16 21:04:44 riastradh Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)for.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: for.c,v 1.52 2016/02/18 18:29:14 christos Exp $");
|
||||
__RCSID("$NetBSD: for.c,v 1.53 2017/04/16 21:04:44 riastradh Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -427,7 +427,7 @@ For_Iterate(void *v_arg, size_t *ret_len)
|
||||
for (cp = cmd_cp; (cp = strchr(cp, '$')) != NULL;) {
|
||||
char ech;
|
||||
ch = *++cp;
|
||||
if ((ch == '(' && (ech = ')')) || (ch == '{' && (ech = '}'))) {
|
||||
if ((ch == '(' && (ech = ')', 1)) || (ch == '{' && (ech = '}', 1))) {
|
||||
cp++;
|
||||
/* Check variable name against the .for loop variables */
|
||||
STRLIST_FOREACH(var, &arg->vars, i) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: job.c,v 1.188 2016/08/26 23:28:39 dholland Exp $ */
|
||||
/* $NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
@ -70,14 +70,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: job.c,v 1.188 2016/08/26 23:28:39 dholland Exp $";
|
||||
static char rcsid[] = "$NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: job.c,v 1.188 2016/08/26 23:28:39 dholland Exp $");
|
||||
__RCSID("$NetBSD: job.c,v 1.190 2017/04/16 21:23:43 riastradh Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -443,7 +443,7 @@ static void JobSigUnlock(sigset_t *omaskp)
|
||||
static void
|
||||
JobCreatePipe(Job *job, int minfd)
|
||||
{
|
||||
int i, fd;
|
||||
int i, fd, flags;
|
||||
|
||||
if (pipe(job->jobPipe) == -1)
|
||||
Punt("Cannot create pipe: %s", strerror(errno));
|
||||
@ -458,8 +458,10 @@ JobCreatePipe(Job *job, int minfd)
|
||||
}
|
||||
|
||||
/* Set close-on-exec flag for both */
|
||||
(void)fcntl(job->jobPipe[0], F_SETFD, FD_CLOEXEC);
|
||||
(void)fcntl(job->jobPipe[1], F_SETFD, FD_CLOEXEC);
|
||||
if (fcntl(job->jobPipe[0], F_SETFD, FD_CLOEXEC) == -1)
|
||||
Punt("Cannot set close-on-exec: %s", strerror(errno));
|
||||
if (fcntl(job->jobPipe[1], F_SETFD, FD_CLOEXEC) == -1)
|
||||
Punt("Cannot set close-on-exec: %s", strerror(errno));
|
||||
|
||||
/*
|
||||
* We mark the input side of the pipe non-blocking; we poll(2) the
|
||||
@ -467,8 +469,12 @@ JobCreatePipe(Job *job, int minfd)
|
||||
* race for the token when a new one becomes available, so the read
|
||||
* from the pipe should not block.
|
||||
*/
|
||||
fcntl(job->jobPipe[0], F_SETFL,
|
||||
fcntl(job->jobPipe[0], F_GETFL, 0) | O_NONBLOCK);
|
||||
flags = fcntl(job->jobPipe[0], F_GETFL, 0);
|
||||
if (flags == -1)
|
||||
Punt("Cannot get flags: %s", strerror(errno));
|
||||
flags |= O_NONBLOCK;
|
||||
if (fcntl(job->jobPipe[0], F_SETFL, flags) == -1)
|
||||
Punt("Cannot set flags: %s", strerror(errno));
|
||||
}
|
||||
|
||||
/*-
|
||||
@ -770,6 +776,7 @@ JobPrintCommand(void *cmdp, void *jobp)
|
||||
* but this one needs to be - use compat mode just for it.
|
||||
*/
|
||||
CompatRunCommand(cmdp, job->node);
|
||||
free(cmdStart);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@ -1398,16 +1405,28 @@ JobExec(Job *job, char **argv)
|
||||
execError("dup2", "job->cmdFILE");
|
||||
_exit(1);
|
||||
}
|
||||
(void)fcntl(0, F_SETFD, 0);
|
||||
(void)lseek(0, (off_t)0, SEEK_SET);
|
||||
if (fcntl(0, F_SETFD, 0) == -1) {
|
||||
execError("fcntl clear close-on-exec", "stdin");
|
||||
_exit(1);
|
||||
}
|
||||
if (lseek(0, (off_t)0, SEEK_SET) == -1) {
|
||||
execError("lseek to 0", "stdin");
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
if (Always_pass_job_queue ||
|
||||
(job->node->type & (OP_MAKE | OP_SUBMAKE))) {
|
||||
/*
|
||||
* Pass job token pipe to submakes.
|
||||
*/
|
||||
fcntl(tokenWaitJob.inPipe, F_SETFD, 0);
|
||||
fcntl(tokenWaitJob.outPipe, F_SETFD, 0);
|
||||
if (fcntl(tokenWaitJob.inPipe, F_SETFD, 0) == -1) {
|
||||
execError("clear close-on-exec", "tokenWaitJob.inPipe");
|
||||
_exit(1);
|
||||
}
|
||||
if (fcntl(tokenWaitJob.outPipe, F_SETFD, 0) == -1) {
|
||||
execError("clear close-on-exec", "tokenWaitJob.outPipe");
|
||||
_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1424,7 +1443,10 @@ JobExec(Job *job, char **argv)
|
||||
* it before routing the shell's error output to the same place as
|
||||
* its standard output.
|
||||
*/
|
||||
(void)fcntl(1, F_SETFD, 0);
|
||||
if (fcntl(1, F_SETFD, 0) == -1) {
|
||||
execError("clear close-on-exec", "stdout");
|
||||
_exit(1);
|
||||
}
|
||||
if (dup2(1, 2) == -1) {
|
||||
execError("dup2", "1, 2");
|
||||
_exit(1);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.260 2017/04/13 13:55:23 christos Exp $ */
|
||||
/* $NetBSD: main.c,v 1.264 2017/04/20 03:57:27 sjg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,7 +69,7 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.260 2017/04/13 13:55:23 christos Exp $";
|
||||
static char rcsid[] = "$NetBSD: main.c,v 1.264 2017/04/20 03:57:27 sjg Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.260 2017/04/13 13:55:23 christos Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.264 2017/04/20 03:57:27 sjg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -187,6 +187,7 @@ static const char * tracefile;
|
||||
static void MainParseArgs(int, char **);
|
||||
static int ReadMakefile(const void *, const void *);
|
||||
static void usage(void) MAKE_ATTR_DEAD;
|
||||
static void purge_cached_realpaths(void);
|
||||
|
||||
static Boolean ignorePWD; /* if we use -C, PWD is meaningless */
|
||||
static char objdir[MAXPATHLEN + 1]; /* where we chdir'ed to */
|
||||
@ -336,7 +337,7 @@ parse_debug_options(const char *argvalue)
|
||||
goto debug_setbuf;
|
||||
}
|
||||
len = strlen(modules);
|
||||
fname = malloc(len + 20);
|
||||
fname = bmake_malloc(len + 20);
|
||||
memcpy(fname, modules, len + 1);
|
||||
/* Let the filename be modified by the pid */
|
||||
if (strcmp(fname + len - 3, ".%d") == 0)
|
||||
@ -367,6 +368,32 @@ debug_setbuf:
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* does path contain any relative components
|
||||
*/
|
||||
static int
|
||||
is_relpath(const char *path)
|
||||
{
|
||||
const char *cp;
|
||||
|
||||
if (path[0] != '/')
|
||||
return TRUE;
|
||||
cp = path;
|
||||
do {
|
||||
cp = strstr(cp, "/.");
|
||||
if (!cp)
|
||||
break;
|
||||
cp += 2;
|
||||
if (cp[0] == '/' || cp[0] == '\0')
|
||||
return TRUE;
|
||||
else if (cp[0] == '.') {
|
||||
if (cp[1] == '/' || cp[1] == '\0')
|
||||
return TRUE;
|
||||
}
|
||||
} while (cp);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*-
|
||||
* MainParseArgs --
|
||||
* Parse a given argument vector. Called from main() and from
|
||||
@ -458,7 +485,7 @@ rearg:
|
||||
(void)fprintf(stderr, "%s: %s.\n", progname, strerror(errno));
|
||||
exit(2);
|
||||
}
|
||||
if (argvalue[0] == '/' &&
|
||||
if (!is_relpath(argvalue) &&
|
||||
stat(argvalue, &sa) != -1 &&
|
||||
stat(curdir, &sb) != -1 &&
|
||||
sa.st_ino == sb.st_ino &&
|
||||
@ -732,8 +759,10 @@ Main_SetObjdir(const char *fmt, ...)
|
||||
va_end(ap);
|
||||
|
||||
if (path[0] != '/') {
|
||||
snprintf(buf, MAXPATHLEN, "%s/%s", curdir, path);
|
||||
path = buf;
|
||||
char buf2[MAXPATHLEN + 1];
|
||||
|
||||
snprintf(buf2, MAXPATHLEN, "%s/%s", curdir, path);
|
||||
path = buf2;
|
||||
}
|
||||
|
||||
/* look for the directory and try to chdir there */
|
||||
@ -746,7 +775,7 @@ Main_SetObjdir(const char *fmt, ...)
|
||||
Var_Set(".OBJDIR", objdir, VAR_GLOBAL, 0);
|
||||
setenv("PWD", objdir, 1);
|
||||
Dir_InitDot();
|
||||
cached_realpath(".OBJDIR", NULL); /* purge */
|
||||
purge_cached_realpaths();
|
||||
rc = TRUE;
|
||||
if (enterFlag && strcmp(objdir, curdir) != 0)
|
||||
enterFlagObj = TRUE;
|
||||
@ -1907,42 +1936,56 @@ usage(void)
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* realpath(3) can get expensive, cache results...
|
||||
*/
|
||||
static GNode *cached_realpaths = NULL;
|
||||
|
||||
static GNode *
|
||||
get_cached_realpaths(void)
|
||||
{
|
||||
|
||||
if (!cached_realpaths) {
|
||||
cached_realpaths = Targ_NewGN("Realpath");
|
||||
#ifndef DEBUG_REALPATH_CACHE
|
||||
cached_realpaths->flags = INTERNAL;
|
||||
#endif
|
||||
}
|
||||
|
||||
return cached_realpaths;
|
||||
}
|
||||
|
||||
/* purge any relative paths */
|
||||
static void
|
||||
purge_cached_realpaths(void)
|
||||
{
|
||||
GNode *cache = get_cached_realpaths();
|
||||
Hash_Entry *he, *nhe;
|
||||
Hash_Search hs;
|
||||
|
||||
he = Hash_EnumFirst(&cache->context, &hs);
|
||||
while (he) {
|
||||
nhe = Hash_EnumNext(&hs);
|
||||
if (he->name[0] != '/') {
|
||||
if (DEBUG(DIR))
|
||||
fprintf(stderr, "cached_realpath: purging %s\n", he->name);
|
||||
Hash_DeleteEntry(&cache->context, he);
|
||||
}
|
||||
he = nhe;
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
cached_realpath(const char *pathname, char *resolved)
|
||||
{
|
||||
static GNode *cache;
|
||||
GNode *cache;
|
||||
char *rp, *cp;
|
||||
|
||||
if (!pathname || !pathname[0])
|
||||
return NULL;
|
||||
|
||||
if (!cache) {
|
||||
cache = Targ_NewGN("Realpath");
|
||||
#ifndef DEBUG_REALPATH_CACHE
|
||||
cache->flags = INTERNAL;
|
||||
#endif
|
||||
}
|
||||
if (resolved == NULL && strcmp(pathname, ".OBJDIR") == 0) {
|
||||
/* purge any relative paths */
|
||||
Hash_Entry *he, *nhe;
|
||||
Hash_Search hs;
|
||||
cache = get_cached_realpaths();
|
||||
|
||||
he = Hash_EnumFirst(&cache->context, &hs);
|
||||
while (he) {
|
||||
nhe = Hash_EnumNext(&hs);
|
||||
if (he->name[0] != '/') {
|
||||
if (DEBUG(DIR))
|
||||
fprintf(stderr, "cached_realpath: purging %s\n", he->name);
|
||||
Hash_DeleteEntry(&cache->context, he);
|
||||
}
|
||||
he = nhe;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
if ((rp = Var_Value(pathname, cache, &cp)) != NULL) {
|
||||
/* a hit */
|
||||
strlcpy(resolved, rp, MAXPATHLEN);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: make_malloc.c,v 1.10 2012/06/20 17:46:28 sjg Exp $ */
|
||||
/* $NetBSD: make_malloc.c,v 1.11 2017/04/16 20:20:24 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
#ifdef MAKE_NATIVE
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: make_malloc.c,v 1.10 2012/06/20 17:46:28 sjg Exp $");
|
||||
__RCSID("$NetBSD: make_malloc.c,v 1.11 2017/04/16 20:20:24 dholland Exp $");
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@ -39,13 +39,13 @@ __RCSID("$NetBSD: make_malloc.c,v 1.10 2012/06/20 17:46:28 sjg Exp $");
|
||||
#include "make.h"
|
||||
|
||||
#ifndef USE_EMALLOC
|
||||
static void enomem(void) MAKE_ATTR_DEAD;
|
||||
static MAKE_ATTR_DEAD void enomem(void);
|
||||
|
||||
/*
|
||||
* enomem --
|
||||
* die when out of memory.
|
||||
*/
|
||||
static void
|
||||
static MAKE_ATTR_DEAD void
|
||||
enomem(void)
|
||||
{
|
||||
(void)fprintf(stderr, "%s: %s.\n", progname, strerror(ENOMEM));
|
||||
|
@ -1,3 +1,10 @@
|
||||
2017-04-18 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* install-mk (MK_VERSION): 20170418
|
||||
|
||||
* auto.obj.mk: if using MAKEOBJDIRPREFIX check if it is a
|
||||
prefix match for .CURDIR - in which case .CURDIR *is* __objdir.
|
||||
|
||||
2017-04-01 Simon J. Gerraty <sjg@bad.crufty.net>
|
||||
|
||||
* install-mk (MK_VERSION): 20170401
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: auto.obj.mk,v 1.13 2017/03/24 20:53:22 sjg Exp $
|
||||
# $Id: auto.obj.mk,v 1.14 2017/04/18 23:53:18 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2004, Simon J. Gerraty
|
||||
#
|
||||
@ -41,6 +41,10 @@ MKOBJDIRS= auto
|
||||
# Use __objdir here so it is easier to tweak without impacting
|
||||
# the logic.
|
||||
.if !empty(MAKEOBJDIRPREFIX)
|
||||
.if ${.CURDIR:M${MAKEOBJDIRPREFIX}/*} != ""
|
||||
# we are already in obj tree!
|
||||
__objdir?= ${.CURDIR}
|
||||
.endif
|
||||
__objdir?= ${MAKEOBJDIRPREFIX}${.CURDIR}
|
||||
.endif
|
||||
__objdir?= ${MAKEOBJDIR:Uobj}
|
||||
|
@ -55,7 +55,7 @@
|
||||
# Simon J. Gerraty <sjg@crufty.net>
|
||||
|
||||
# RCSid:
|
||||
# $Id: install-mk,v 1.140 2017/04/03 21:04:09 sjg Exp $
|
||||
# $Id: install-mk,v 1.141 2017/04/18 23:53:18 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 1994 Simon J. Gerraty
|
||||
#
|
||||
@ -70,7 +70,7 @@
|
||||
# sjg@crufty.net
|
||||
#
|
||||
|
||||
MK_VERSION=20170401
|
||||
MK_VERSION=20170418
|
||||
OWNER=
|
||||
GROUP=
|
||||
MODE=444
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: parse.c,v 1.218 2017/03/01 16:39:49 sjg Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.225 2017/04/17 13:29:07 maya Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.218 2017/03/01 16:39:49 sjg Exp $";
|
||||
static char rcsid[] = "$NetBSD: parse.c,v 1.225 2017/04/17 13:29:07 maya Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: parse.c,v 1.218 2017/03/01 16:39:49 sjg Exp $");
|
||||
__RCSID("$NetBSD: parse.c,v 1.225 2017/04/17 13:29:07 maya Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -130,6 +130,7 @@ __RCSID("$NetBSD: parse.c,v 1.218 2017/03/01 16:39:49 sjg Exp $");
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "make.h"
|
||||
#include "hash.h"
|
||||
@ -539,7 +540,7 @@ loadfile(const char *path, int fd)
|
||||
if (lf->buf != MAP_FAILED) {
|
||||
/* succeeded */
|
||||
if (lf->len == lf->maplen && lf->buf[lf->len - 1] != '\n') {
|
||||
char *b = malloc(lf->len + 1);
|
||||
char *b = bmake_malloc(lf->len + 1);
|
||||
b[lf->len] = '\n';
|
||||
memcpy(b, lf->buf, lf->len++);
|
||||
munmap(lf->buf, lf->maplen);
|
||||
@ -560,9 +561,15 @@ loadfile(const char *path, int fd)
|
||||
while (1) {
|
||||
assert(bufpos <= lf->len);
|
||||
if (bufpos == lf->len) {
|
||||
if (lf->len > SIZE_MAX/2) {
|
||||
errno = EFBIG;
|
||||
Error("%s: file too large", path);
|
||||
exit(1);
|
||||
}
|
||||
lf->len *= 2;
|
||||
lf->buf = bmake_realloc(lf->buf, lf->len);
|
||||
}
|
||||
assert(bufpos < lf->len);
|
||||
result = read(fd, lf->buf + bufpos, lf->len - bufpos);
|
||||
if (result < 0) {
|
||||
Error("%s: read error: %s", path, strerror(errno));
|
||||
@ -1099,15 +1106,15 @@ ParseDoSrc(int tOp, const char *src)
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
ParseFindMain(void *gnp, void *dummy)
|
||||
ParseFindMain(void *gnp, void *dummy MAKE_ATTR_UNUSED)
|
||||
{
|
||||
GNode *gn = (GNode *)gnp;
|
||||
if ((gn->type & OP_NOTARGET) == 0) {
|
||||
mainNode = gn;
|
||||
Targ_SetMain(gn);
|
||||
return (dummy ? 1 : 1);
|
||||
return 1;
|
||||
} else {
|
||||
return (dummy ? 0 : 0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1145,10 +1152,10 @@ ParseAddDir(void *path, void *name)
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
ParseClearPath(void *path, void *dummy)
|
||||
ParseClearPath(void *path, void *dummy MAKE_ATTR_UNUSED)
|
||||
{
|
||||
Dir_ClearPath((Lst) path);
|
||||
return(dummy ? 0 : 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-
|
||||
@ -1685,10 +1692,12 @@ ParseDoDependency(char *line)
|
||||
}
|
||||
if (paths) {
|
||||
Lst_Destroy(paths, NULL);
|
||||
paths = NULL;
|
||||
}
|
||||
if (specType == ExPath)
|
||||
Dir_SetPATH();
|
||||
} else {
|
||||
assert(paths == NULL);
|
||||
while (*line) {
|
||||
/*
|
||||
* The targets take real sources, so we must beware of archive
|
||||
@ -1747,6 +1756,7 @@ ParseDoDependency(char *line)
|
||||
}
|
||||
|
||||
out:
|
||||
assert(paths == NULL);
|
||||
if (curTargs)
|
||||
Lst_Destroy(curTargs, NULL);
|
||||
}
|
||||
@ -2550,7 +2560,7 @@ ParseTraditionalInclude(char *line)
|
||||
if (*file == '\0') {
|
||||
Parse_Error(PARSE_FATAL,
|
||||
"Filename missing from \"include\"");
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (file = all_files; !done; file = cp + 1) {
|
||||
@ -2565,6 +2575,7 @@ ParseTraditionalInclude(char *line)
|
||||
|
||||
Parse_include_file(file, FALSE, FALSE, silent);
|
||||
}
|
||||
out:
|
||||
free(all_files);
|
||||
}
|
||||
#endif
|
||||
@ -2615,6 +2626,7 @@ ParseGmakeExport(char *line)
|
||||
*/
|
||||
value = Var_Subst(NULL, value, VAR_CMD, VARF_WANTRES);
|
||||
setenv(variable, value, 1);
|
||||
free(value);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -382,8 +382,11 @@ Str_Match(const char *string, const char *pattern)
|
||||
} else
|
||||
nomatch = 0;
|
||||
for (;;) {
|
||||
if ((*pattern == ']') || (*pattern == 0))
|
||||
return(nomatch);
|
||||
if ((*pattern == ']') || (*pattern == 0)) {
|
||||
if (nomatch)
|
||||
break;
|
||||
return(0);
|
||||
}
|
||||
if (*pattern == *string)
|
||||
break;
|
||||
if (pattern[1] == '-') {
|
||||
@ -400,7 +403,7 @@ Str_Match(const char *string, const char *pattern)
|
||||
}
|
||||
++pattern;
|
||||
}
|
||||
if (nomatch)
|
||||
if (nomatch && (*pattern != ']') && (*pattern != 0))
|
||||
return 0;
|
||||
while ((*pattern != ']') && (*pattern != 0))
|
||||
++pattern;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: suff.c,v 1.84 2016/06/30 05:34:04 dholland Exp $ */
|
||||
/* $NetBSD: suff.c,v 1.86 2017/04/16 20:38:18 riastradh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: suff.c,v 1.84 2016/06/30 05:34:04 dholland Exp $";
|
||||
static char rcsid[] = "$NetBSD: suff.c,v 1.86 2017/04/16 20:38:18 riastradh Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)suff.c 8.4 (Berkeley) 3/21/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: suff.c,v 1.84 2016/06/30 05:34:04 dholland Exp $");
|
||||
__RCSID("$NetBSD: suff.c,v 1.86 2017/04/16 20:38:18 riastradh Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -135,6 +135,7 @@ __RCSID("$NetBSD: suff.c,v 1.84 2016/06/30 05:34:04 dholland Exp $");
|
||||
* order to find the node.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include "make.h"
|
||||
#include "hash.h"
|
||||
@ -762,12 +763,10 @@ Suff_AddTransform(char *line)
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
Suff_EndTransform(void *gnp, void *dummy)
|
||||
Suff_EndTransform(void *gnp, void *dummy MAKE_ATTR_UNUSED)
|
||||
{
|
||||
GNode *gn = (GNode *)gnp;
|
||||
|
||||
(void)dummy;
|
||||
|
||||
if ((gn->type & OP_DOUBLEDEP) && !Lst_IsEmpty (gn->cohorts))
|
||||
gn = (GNode *)Lst_Datum(Lst_Last(gn->cohorts));
|
||||
if ((gn->type & OP_TRANSFORM) && Lst_IsEmpty(gn->commands) &&
|
||||
@ -1908,6 +1907,13 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
|
||||
eoarch = strchr(gn->name, '(');
|
||||
eoname = strchr(eoarch, ')');
|
||||
|
||||
/*
|
||||
* Caller guarantees the format `libname(member)', via
|
||||
* Arch_ParseArchive.
|
||||
*/
|
||||
assert(eoarch != NULL);
|
||||
assert(eoname != NULL);
|
||||
|
||||
*eoname = '\0'; /* Nuke parentheses during suffix search */
|
||||
*eoarch = '\0'; /* So a suffix can be found */
|
||||
|
||||
@ -2597,23 +2603,20 @@ Suff_End(void)
|
||||
|
||||
/********************* DEBUGGING FUNCTIONS **********************/
|
||||
|
||||
static int SuffPrintName(void *s, void *dummy)
|
||||
static int SuffPrintName(void *s, void *dummy MAKE_ATTR_UNUSED)
|
||||
{
|
||||
(void)dummy;
|
||||
|
||||
fprintf(debug_file, "%s ", ((Suff *)s)->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
SuffPrintSuff(void *sp, void *dummy)
|
||||
SuffPrintSuff(void *sp, void *dummy MAKE_ATTR_UNUSED)
|
||||
{
|
||||
Suff *s = (Suff *)sp;
|
||||
int flags;
|
||||
int flag;
|
||||
|
||||
(void)dummy;
|
||||
|
||||
fprintf(debug_file, "# `%s' [%d] ", s->name, s->refCount);
|
||||
|
||||
flags = s->flags;
|
||||
@ -2650,12 +2653,10 @@ SuffPrintSuff(void *sp, void *dummy)
|
||||
}
|
||||
|
||||
static int
|
||||
SuffPrintTrans(void *tp, void *dummy)
|
||||
SuffPrintTrans(void *tp, void *dummy MAKE_ATTR_UNUSED)
|
||||
{
|
||||
GNode *t = (GNode *)tp;
|
||||
|
||||
(void)dummy;
|
||||
|
||||
fprintf(debug_file, "%-16s: ", t->name);
|
||||
Targ_PrintType(t->type);
|
||||
fputc('\n', debug_file);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: targ.c,v 1.61 2016/01/17 17:45:21 christos Exp $ */
|
||||
/* $NetBSD: targ.c,v 1.62 2017/04/16 19:53:58 riastradh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: targ.c,v 1.61 2016/01/17 17:45:21 christos Exp $";
|
||||
static char rcsid[] = "$NetBSD: targ.c,v 1.62 2017/04/16 19:53:58 riastradh Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)targ.c 8.2 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: targ.c,v 1.61 2016/01/17 17:45:21 christos Exp $");
|
||||
__RCSID("$NetBSD: targ.c,v 1.62 2017/04/16 19:53:58 riastradh Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -521,10 +521,10 @@ TargPrintName(void *gnp, void *pflags MAKE_ATTR_UNUSED)
|
||||
|
||||
|
||||
int
|
||||
Targ_PrintCmd(void *cmd, void *dummy)
|
||||
Targ_PrintCmd(void *cmd, void *dummy MAKE_ATTR_UNUSED)
|
||||
{
|
||||
fprintf(debug_file, "\t%s\n", (char *)cmd);
|
||||
return (dummy ? 0 : 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-
|
||||
|
@ -16,4 +16,5 @@ LIB=e X_LIBS:M*/lib${LIB}.a:tu is "/TMP/LIBE.A"
|
||||
Mscanner=OK
|
||||
Upper=One Two Three Four
|
||||
Lower=five six seven
|
||||
nose=One Three five
|
||||
exit status 0
|
||||
|
@ -31,3 +31,4 @@ LIST= One Two Three Four five six seven
|
||||
check-cclass:
|
||||
@echo Upper=${LIST:M[A-Z]*}
|
||||
@echo Lower=${LIST:M[^A-Z]*}
|
||||
@echo nose=${LIST:M[^s]*[ex]}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: var.c,v 1.213 2017/02/01 18:39:27 sjg Exp $ */
|
||||
/* $NetBSD: var.c,v 1.215 2017/04/16 21:39:49 riastradh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
@ -69,14 +69,14 @@
|
||||
*/
|
||||
|
||||
#ifndef MAKE_NATIVE
|
||||
static char rcsid[] = "$NetBSD: var.c,v 1.213 2017/02/01 18:39:27 sjg Exp $";
|
||||
static char rcsid[] = "$NetBSD: var.c,v 1.215 2017/04/16 21:39:49 riastradh Exp $";
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: var.c,v 1.213 2017/02/01 18:39:27 sjg Exp $");
|
||||
__RCSID("$NetBSD: var.c,v 1.215 2017/04/16 21:39:49 riastradh Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
#endif
|
||||
@ -1181,7 +1181,7 @@ Var_Value(const char *name, GNode *ctxt, char **frp)
|
||||
static Boolean
|
||||
VarHead(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
||||
char *word, Boolean addSpace, Buffer *buf,
|
||||
void *dummy)
|
||||
void *dummy MAKE_ATTR_UNUSED)
|
||||
{
|
||||
char *slash;
|
||||
|
||||
@ -1202,7 +1202,7 @@ VarHead(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
||||
Buf_AddByte(buf, vpstate->varSpace);
|
||||
Buf_AddByte(buf, '.');
|
||||
}
|
||||
return(dummy ? TRUE : TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*-
|
||||
@ -1229,7 +1229,7 @@ VarHead(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
||||
static Boolean
|
||||
VarTail(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
||||
char *word, Boolean addSpace, Buffer *buf,
|
||||
void *dummy)
|
||||
void *dummy MAKE_ATTR_UNUSED)
|
||||
{
|
||||
char *slash;
|
||||
|
||||
@ -1245,7 +1245,7 @@ VarTail(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
||||
} else {
|
||||
Buf_AddBytes(buf, strlen(word), word);
|
||||
}
|
||||
return (dummy ? TRUE : TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*-
|
||||
@ -1271,7 +1271,7 @@ VarTail(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
||||
static Boolean
|
||||
VarSuffix(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
||||
char *word, Boolean addSpace, Buffer *buf,
|
||||
void *dummy)
|
||||
void *dummy MAKE_ATTR_UNUSED)
|
||||
{
|
||||
char *dot;
|
||||
|
||||
@ -1285,7 +1285,7 @@ VarSuffix(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
||||
dot[-1] = '.';
|
||||
addSpace = TRUE;
|
||||
}
|
||||
return (dummy ? addSpace : addSpace);
|
||||
return addSpace;
|
||||
}
|
||||
|
||||
/*-
|
||||
@ -1312,7 +1312,7 @@ VarSuffix(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
||||
static Boolean
|
||||
VarRoot(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
||||
char *word, Boolean addSpace, Buffer *buf,
|
||||
void *dummy)
|
||||
void *dummy MAKE_ATTR_UNUSED)
|
||||
{
|
||||
char *dot;
|
||||
|
||||
@ -1328,7 +1328,7 @@ VarRoot(GNode *ctx MAKE_ATTR_UNUSED, Var_Parse_State *vpstate,
|
||||
} else {
|
||||
Buf_AddBytes(buf, strlen(word), word);
|
||||
}
|
||||
return (dummy ? TRUE : TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*-
|
||||
@ -1836,8 +1836,8 @@ VarLoopExpand(GNode *ctx MAKE_ATTR_UNUSED,
|
||||
Buf_AddByte(buf, ' ');
|
||||
Buf_AddBytes(buf, (slen = strlen(s)), s);
|
||||
addSpace = (slen > 0 && s[slen - 1] != '\n');
|
||||
free(s);
|
||||
}
|
||||
free(s);
|
||||
}
|
||||
return addSpace;
|
||||
}
|
||||
|
@ -5,21 +5,17 @@
|
||||
|
||||
.if ${MK_CXX} != "no"
|
||||
SUBDIR.${MK_GCC}+= gperf
|
||||
SUBDIR.${MK_GROFF}+= groff
|
||||
.endif
|
||||
|
||||
SUBDIR.${MK_BINUTILS}+= binutils
|
||||
SUBDIR.${MK_DIALOG}+= dialog
|
||||
|
||||
.if ${MK_BINUTILS} != "no"
|
||||
SUBDIR.${MK_GDB}+= gdb
|
||||
SUBDIR_DEPEND_gdb= binutils
|
||||
.endif
|
||||
|
||||
SUBDIR.${MK_GCC}+= cc
|
||||
SUBDIR.${MK_GNU_DIFF}+= diff3
|
||||
SUBDIR.${MK_GNU_GREP}+= grep
|
||||
SUBDIR.${MK_GDB}+= gdb
|
||||
SUBDIR_DEPEND_gdb= binutils
|
||||
SUBDIR.${MK_GPL_DTC}+= dtc
|
||||
SUBDIR.${MK_GROFF}+= groff
|
||||
SUBDIR.${MK_TESTS}+= tests
|
||||
|
||||
SUBDIR_PARALLEL=
|
||||
|
@ -76,8 +76,8 @@ gss_add_buffer_set_member(OM_uint32 * minor_status,
|
||||
}
|
||||
|
||||
set = *buffer_set;
|
||||
set->elements = realloc(set->elements,
|
||||
(set->count + 1) * sizeof(set->elements[0]));
|
||||
set->elements = reallocarray(set->elements, set->count + 1,
|
||||
sizeof(set->elements[0]));
|
||||
if (set->elements == NULL) {
|
||||
*minor_status = ENOMEM;
|
||||
return (GSS_S_FAILURE);
|
||||
|
@ -259,8 +259,8 @@ get_recommend(_ISO2022EncodingInfo * __restrict ei,
|
||||
if (!ei->recommend[i])
|
||||
ei->recommend[i] = malloc(sizeof(_ISO2022Charset));
|
||||
else {
|
||||
p = realloc(ei->recommend[i],
|
||||
sizeof(_ISO2022Charset) * (ei->recommendsize[i] + 1));
|
||||
p = reallocarray(ei->recommend[i], ei->recommendsize[i] + 1,
|
||||
sizeof(_ISO2022Charset));
|
||||
if (!p)
|
||||
return (_PARSEFAIL);
|
||||
ei->recommend[i] = p;
|
||||
|
@ -227,7 +227,7 @@ pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th)
|
||||
|
||||
TDBG_FUNC();
|
||||
|
||||
if (id < 0 || id >= ta->map_len || ta->map[id].type == PT_NONE)
|
||||
if (id < 0 || id >= (long)ta->map_len || ta->map[id].type == PT_NONE)
|
||||
return (TD_NOTHR);
|
||||
|
||||
ret = thr_pread_ptr(ta, ta->thread_list_addr, &pt);
|
||||
@ -1062,7 +1062,7 @@ static int
|
||||
pt_validate(const td_thrhandle_t *th)
|
||||
{
|
||||
|
||||
if (th->th_tid < 0 || th->th_tid >= th->th_ta->map_len ||
|
||||
if (th->th_tid < 0 || th->th_tid >= (long)th->th_ta->map_len ||
|
||||
th->th_ta->map[th->th_tid].type == PT_NONE)
|
||||
return (TD_NOTHR);
|
||||
return (TD_OK);
|
||||
|
@ -205,7 +205,7 @@ gr_copy(int ffd, int tfd, const struct group *gr, struct group *old_gr)
|
||||
if (eof)
|
||||
break;
|
||||
while ((size_t)(q - p) >= size) {
|
||||
if ((tmp = realloc(buf, size * 2)) == NULL) {
|
||||
if ((tmp = reallocarray(buf, 2, size)) == NULL) {
|
||||
warnx("group line too long");
|
||||
goto err;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ allocarray(size_t sz)
|
||||
|
||||
if (sz <= internal_arraysz)
|
||||
p = internal_array;
|
||||
else if ((p = realloc(internal_array, sz * sizeof(char*))) != NULL) {
|
||||
else if ((p = reallocarray(internal_array, sz, sizeof(char*))) != NULL) {
|
||||
internal_arraysz = sz;
|
||||
internal_array = p;
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ pw_copy(int ffd, int tfd, const struct passwd *pw, struct passwd *old_pw)
|
||||
if (eof)
|
||||
break;
|
||||
while ((size_t)(q - p) >= size) {
|
||||
if ((tmp = realloc(buf, size * 2)) == NULL) {
|
||||
if ((tmp = reallocarray(buf, 2, size)) == NULL) {
|
||||
warnx("passwd line too long");
|
||||
goto err;
|
||||
}
|
||||
|
@ -1118,7 +1118,9 @@ eli_setkey_detached(struct gctl_req *req, const char *prov,
|
||||
|
||||
val = gctl_get_intmax(req, "iterations");
|
||||
/* Check if iterations number should and can be changed. */
|
||||
if (val != -1) {
|
||||
if (val != -1 && md->md_iterations == -1) {
|
||||
md->md_iterations = val;
|
||||
} else if (val != -1 && val != md->md_iterations) {
|
||||
if (bitcount32(md->md_keys) != 1) {
|
||||
gctl_error(req, "To be able to use '-i' option, only "
|
||||
"one key can be defined.");
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" DO NOT EDIT-- this file is generated by tools/build/options/makeman.
|
||||
.\" $FreeBSD$
|
||||
.Dd April 19, 2017
|
||||
.Dd April 21, 2017
|
||||
.Dt SRC.CONF 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -215,6 +215,11 @@ Set to not build the BSD licensed version of cpio based on
|
||||
.Xr libarchive 3 .
|
||||
.It Va WITH_BSD_GREP
|
||||
Install BSD-licensed grep as '[ef]grep' instead of GNU grep.
|
||||
.It Va WITHOUT_BSD_GREP_FASTMATCH
|
||||
Set this option to exclude the fastmatch implementation from
|
||||
.Xr bsdgrep 1 ,
|
||||
instead using only
|
||||
.Xr regex 3 .
|
||||
.It Va WITHOUT_BSNMP
|
||||
Set to not build or install
|
||||
.Xr bsnmpd 1
|
||||
@ -727,9 +732,10 @@ and
|
||||
.It Va WITHOUT_GNU_GREP
|
||||
Set to not build GNU
|
||||
.Xr grep 1 .
|
||||
.It Va WITHOUT_GNU_GREP_COMPAT
|
||||
Set this option to omit the gnu extensions to grep from being included in
|
||||
BSD grep.
|
||||
.It Va WITH_GNU_GREP_COMPAT
|
||||
Set this option to include GNU extensions in
|
||||
.Xr bsdgrep 1
|
||||
by linking against libgnuregex.
|
||||
.It Va WITHOUT_GPIO
|
||||
Set to not build
|
||||
.Xr gpioctl 8
|
||||
|
@ -62,6 +62,7 @@ __DEFAULT_YES_OPTIONS = \
|
||||
BOOTPARAMD \
|
||||
BOOTPD \
|
||||
BSD_CPIO \
|
||||
BSD_GREP_FASTMATCH \
|
||||
BSDINSTALL \
|
||||
BSNMP \
|
||||
BZIP2 \
|
||||
@ -98,7 +99,6 @@ __DEFAULT_YES_OPTIONS = \
|
||||
GCOV \
|
||||
GNU_DIFF \
|
||||
GNU_GREP \
|
||||
GNU_GREP_COMPAT \
|
||||
GPIO \
|
||||
GPL_DTC \
|
||||
GROFF \
|
||||
@ -180,6 +180,7 @@ __DEFAULT_NO_OPTIONS = \
|
||||
BSD_GREP \
|
||||
CLANG_EXTRAS \
|
||||
DTRACE_TESTS \
|
||||
GNU_GREP_COMPAT \
|
||||
HESIOD \
|
||||
LIBSOFT \
|
||||
NAND \
|
||||
|
@ -120,9 +120,9 @@ permset_namecheck(const char *path, namecheck_err_t *why, char *what)
|
||||
}
|
||||
|
||||
/*
|
||||
* Dataset names must be of the following form:
|
||||
* Entity names must be of the following form:
|
||||
*
|
||||
* [component][/]*[component][@component]
|
||||
* [component/]*[component][(@|#)component]?
|
||||
*
|
||||
* Where each component is made up of alphanumeric characters plus the following
|
||||
* characters:
|
||||
@ -133,10 +133,10 @@ permset_namecheck(const char *path, namecheck_err_t *why, char *what)
|
||||
* names for temporary clones (for online recv).
|
||||
*/
|
||||
int
|
||||
dataset_namecheck(const char *path, namecheck_err_t *why, char *what)
|
||||
entity_namecheck(const char *path, namecheck_err_t *why, char *what)
|
||||
{
|
||||
const char *loc, *end;
|
||||
int found_snapshot;
|
||||
const char *start, *end;
|
||||
int found_delim;
|
||||
|
||||
/*
|
||||
* Make sure the name is not too long.
|
||||
@ -161,12 +161,13 @@ dataset_namecheck(const char *path, namecheck_err_t *why, char *what)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
loc = path;
|
||||
found_snapshot = 0;
|
||||
start = path;
|
||||
found_delim = 0;
|
||||
for (;;) {
|
||||
/* Find the end of this component */
|
||||
end = loc;
|
||||
while (*end != '/' && *end != '@' && *end != '\0')
|
||||
end = start;
|
||||
while (*end != '/' && *end != '@' && *end != '#' &&
|
||||
*end != '\0')
|
||||
end++;
|
||||
|
||||
if (*end == '\0' && end[-1] == '/') {
|
||||
@ -176,25 +177,8 @@ dataset_namecheck(const char *path, namecheck_err_t *why, char *what)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Zero-length components are not allowed */
|
||||
if (loc == end) {
|
||||
if (why) {
|
||||
/*
|
||||
* Make sure this is really a zero-length
|
||||
* component and not a '@@'.
|
||||
*/
|
||||
if (*end == '@' && found_snapshot) {
|
||||
*why = NAME_ERR_MULTIPLE_AT;
|
||||
} else {
|
||||
*why = NAME_ERR_EMPTY_COMPONENT;
|
||||
}
|
||||
}
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Validate the contents of this component */
|
||||
while (loc != end) {
|
||||
for (const char *loc = start; loc != end; loc++) {
|
||||
if (!valid_char(*loc) && *loc != '%') {
|
||||
if (why) {
|
||||
*why = NAME_ERR_INVALCHAR;
|
||||
@ -202,43 +186,64 @@ dataset_namecheck(const char *path, namecheck_err_t *why, char *what)
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
loc++;
|
||||
}
|
||||
|
||||
/* Snapshot or bookmark delimiter found */
|
||||
if (*end == '@' || *end == '#') {
|
||||
/* Multiple delimiters are not allowed */
|
||||
if (found_delim != 0) {
|
||||
if (why)
|
||||
*why = NAME_ERR_MULTIPLE_DELIMITERS;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
found_delim = 1;
|
||||
}
|
||||
|
||||
/* Zero-length components are not allowed */
|
||||
if (start == end) {
|
||||
if (why)
|
||||
*why = NAME_ERR_EMPTY_COMPONENT;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* If we've reached the end of the string, we're OK */
|
||||
if (*end == '\0')
|
||||
return (0);
|
||||
|
||||
if (*end == '@') {
|
||||
/*
|
||||
* If we've found an @ symbol, indicate that we're in
|
||||
* the snapshot component, and report a second '@'
|
||||
* character as an error.
|
||||
*/
|
||||
if (found_snapshot) {
|
||||
if (why)
|
||||
*why = NAME_ERR_MULTIPLE_AT;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
found_snapshot = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is a '/' in a snapshot name
|
||||
* If there is a '/' in a snapshot or bookmark name
|
||||
* then report an error
|
||||
*/
|
||||
if (*end == '/' && found_snapshot) {
|
||||
if (*end == '/' && found_delim != 0) {
|
||||
if (why)
|
||||
*why = NAME_ERR_TRAILING_SLASH;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Update to the next component */
|
||||
loc = end + 1;
|
||||
start = end + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Dataset is any entity, except bookmark
|
||||
*/
|
||||
int
|
||||
dataset_namecheck(const char *path, namecheck_err_t *why, char *what)
|
||||
{
|
||||
int ret = entity_namecheck(path, why, what);
|
||||
|
||||
if (ret == 0 && strchr(path, '#') != NULL) {
|
||||
if (why != NULL) {
|
||||
*why = NAME_ERR_INVALCHAR;
|
||||
*what = '#';
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* mountpoint names must be of the following form:
|
||||
|
@ -38,7 +38,7 @@ typedef enum {
|
||||
NAME_ERR_EMPTY_COMPONENT, /* name contains an empty component */
|
||||
NAME_ERR_TRAILING_SLASH, /* name ends with a slash */
|
||||
NAME_ERR_INVALCHAR, /* invalid character found */
|
||||
NAME_ERR_MULTIPLE_AT, /* multiple '@' characters found */
|
||||
NAME_ERR_MULTIPLE_DELIMITERS, /* multiple '@'/'#' delimiters found */
|
||||
NAME_ERR_NOLETTER, /* pool doesn't begin with a letter */
|
||||
NAME_ERR_RESERVED, /* entire name is reserved */
|
||||
NAME_ERR_DISKLIKE, /* reserved disk name (c[0-9].*) */
|
||||
@ -49,6 +49,7 @@ typedef enum {
|
||||
#define ZFS_PERMSET_MAXLEN 64
|
||||
|
||||
int pool_namecheck(const char *, namecheck_err_t *, char *);
|
||||
int entity_namecheck(const char *, namecheck_err_t *, char *);
|
||||
int dataset_namecheck(const char *, namecheck_err_t *, char *);
|
||||
int mountpoint_namecheck(const char *, namecheck_err_t *);
|
||||
int zfs_component_namecheck(const char *, namecheck_err_t *, char *);
|
||||
|
@ -36,20 +36,22 @@ dmu_object_alloc(objset_t *os, dmu_object_type_t ot, int blocksize,
|
||||
dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx)
|
||||
{
|
||||
uint64_t object;
|
||||
uint64_t L2_dnode_count = DNODES_PER_BLOCK <<
|
||||
uint64_t L1_dnode_count = DNODES_PER_BLOCK <<
|
||||
(DMU_META_DNODE(os)->dn_indblkshift - SPA_BLKPTRSHIFT);
|
||||
dnode_t *dn = NULL;
|
||||
int restarted = B_FALSE;
|
||||
|
||||
mutex_enter(&os->os_obj_lock);
|
||||
for (;;) {
|
||||
object = os->os_obj_next;
|
||||
/*
|
||||
* Each time we polish off an L2 bp worth of dnodes
|
||||
* (2^13 objects), move to another L2 bp that's still
|
||||
* reasonably sparse (at most 1/4 full). Look from the
|
||||
* beginning once, but after that keep looking from here.
|
||||
* If we can't find one, just keep going from here.
|
||||
* Each time we polish off a L1 bp worth of dnodes (2^12
|
||||
* objects), move to another L1 bp that's still reasonably
|
||||
* sparse (at most 1/4 full). Look from the beginning at most
|
||||
* once per txg, but after that keep looking from here.
|
||||
* os_scan_dnodes is set during txg sync if enough objects
|
||||
* have been freed since the previous rescan to justify
|
||||
* backfilling again. If we can't find a suitable block, just
|
||||
* keep going from here.
|
||||
*
|
||||
* Note that dmu_traverse depends on the behavior that we use
|
||||
* multiple blocks of the dnode object before going back to
|
||||
@ -57,12 +59,19 @@ dmu_object_alloc(objset_t *os, dmu_object_type_t ot, int blocksize,
|
||||
* that property or find another solution to the issues
|
||||
* described in traverse_visitbp.
|
||||
*/
|
||||
if (P2PHASE(object, L2_dnode_count) == 0) {
|
||||
uint64_t offset = restarted ? object << DNODE_SHIFT : 0;
|
||||
int error = dnode_next_offset(DMU_META_DNODE(os),
|
||||
|
||||
if (P2PHASE(object, L1_dnode_count) == 0) {
|
||||
uint64_t offset;
|
||||
int error;
|
||||
if (os->os_rescan_dnodes) {
|
||||
offset = 0;
|
||||
os->os_rescan_dnodes = B_FALSE;
|
||||
} else {
|
||||
offset = object << DNODE_SHIFT;
|
||||
}
|
||||
error = dnode_next_offset(DMU_META_DNODE(os),
|
||||
DNODE_FIND_HOLE,
|
||||
&offset, 2, DNODES_PER_BLOCK >> 2, 0);
|
||||
restarted = B_TRUE;
|
||||
if (error == 0)
|
||||
object = offset >> DNODE_SHIFT;
|
||||
}
|
||||
|
@ -67,6 +67,13 @@ krwlock_t os_lock;
|
||||
*/
|
||||
int dmu_find_threads = 0;
|
||||
|
||||
/*
|
||||
* Backfill lower metadnode objects after this many have been freed.
|
||||
* Backfilling negatively impacts object creation rates, so only do it
|
||||
* if there are enough holes to fill.
|
||||
*/
|
||||
int dmu_rescan_dnode_threshold = 131072;
|
||||
|
||||
static void dmu_objset_find_dp_cb(void *arg);
|
||||
|
||||
void
|
||||
@ -1176,6 +1183,13 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx)
|
||||
if (dr->dr_zio)
|
||||
zio_nowait(dr->dr_zio);
|
||||
}
|
||||
|
||||
/* Enable dnode backfill if enough objects have been freed. */
|
||||
if (os->os_freed_dnodes >= dmu_rescan_dnode_threshold) {
|
||||
os->os_rescan_dnodes = B_TRUE;
|
||||
os->os_freed_dnodes = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Free intent log blocks up to this tx.
|
||||
*/
|
||||
|
@ -672,6 +672,7 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx)
|
||||
}
|
||||
|
||||
if (freeing_dnode) {
|
||||
dn->dn_objset->os_freed_dnodes++;
|
||||
dnode_sync_free(dn, tx);
|
||||
return;
|
||||
}
|
||||
|
@ -112,6 +112,8 @@ struct objset {
|
||||
zil_header_t os_zil_header;
|
||||
list_t os_synced_dnodes;
|
||||
uint64_t os_flags;
|
||||
uint64_t os_freed_dnodes;
|
||||
boolean_t os_rescan_dnodes;
|
||||
|
||||
/* Protected by os_obj_lock */
|
||||
kmutex_t os_obj_lock;
|
||||
|
@ -21,7 +21,7 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2015 by Delphix. All rights reserved.
|
||||
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright 2016 Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2013 Joyent, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
@ -743,16 +743,6 @@ vdev_disk_io_start(zio_t *zio)
|
||||
return;
|
||||
}
|
||||
|
||||
if (error == ENOTSUP || error == ENOTTY) {
|
||||
/*
|
||||
* If we get ENOTSUP or ENOTTY, we know that
|
||||
* no future attempts will ever succeed.
|
||||
* In this case we set a persistent bit so
|
||||
* that we don't bother with the ioctl in the
|
||||
* future.
|
||||
*/
|
||||
vd->vdev_nowritecache = B_TRUE;
|
||||
}
|
||||
zio->io_error = error;
|
||||
|
||||
break;
|
||||
|
@ -3302,6 +3302,16 @@ zio_vdev_io_assess(zio_t *zio)
|
||||
vd->vdev_cant_write = B_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* If a cache flush returns ENOTSUP or ENOTTY, we know that no future
|
||||
* attempts will ever succeed. In this case we set a persistent bit so
|
||||
* that we don't bother with it in the future.
|
||||
*/
|
||||
if ((zio->io_error == ENOTSUP || zio->io_error == ENOTTY) &&
|
||||
zio->io_type == ZIO_TYPE_IOCTL &&
|
||||
zio->io_cmd == DKIOCFLUSHWRITECACHE && vd != NULL)
|
||||
vd->vdev_nowritecache = B_TRUE;
|
||||
|
||||
if (zio->io_error)
|
||||
zio->io_pipeline = ZIO_INTERLOCK_PIPELINE;
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2015 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2013, 2016 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
|
||||
* Copyright 2013 Saso Kiselkov. All rights reserved.
|
||||
*/
|
||||
@ -392,12 +392,13 @@ zio_checksum_error(zio_t *zio, zio_bad_cksum_t *info)
|
||||
|
||||
error = zio_checksum_error_impl(spa, bp, checksum, data, size,
|
||||
offset, info);
|
||||
if (error != 0 && zio_injection_enabled && !zio->io_error &&
|
||||
(error = zio_handle_fault_injection(zio, ECKSUM)) != 0) {
|
||||
|
||||
info->zbc_injected = 1;
|
||||
return (error);
|
||||
if (zio_injection_enabled && error == 0 && zio->io_error == 0) {
|
||||
error = zio_handle_fault_injection(zio, ECKSUM);
|
||||
if (error != 0)
|
||||
info->zbc_injected = 1;
|
||||
}
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,6 @@ size_t
|
||||
chacha20_encrypt(chacha20_ctx *ctx, const void *vpt, uint8_t *ct, size_t len)
|
||||
{
|
||||
const uint8_t *pt = vpt;
|
||||
uint64_t ctr;
|
||||
uint32_t mix[16];
|
||||
uint8_t ks[64];
|
||||
unsigned int b, i;
|
||||
@ -157,8 +156,8 @@ chacha20_encrypt(chacha20_ctx *ctx, const void *vpt, uint8_t *ct, size_t len)
|
||||
for (i = 0; i < 64 && i < len; ++i)
|
||||
*ct++ = *pt++ ^ ks[i];
|
||||
}
|
||||
ctr = le64dec(ctx->state + 12);
|
||||
le64enc(ctx->state + 12, ++ctr);
|
||||
if (++ctx->state[12] == 0)
|
||||
++ctx->state[13];
|
||||
}
|
||||
return (len);
|
||||
}
|
||||
|
@ -71,7 +71,6 @@ static vr_clear_t vga_pxlclear_direct;
|
||||
static vr_clear_t vga_pxlclear_planar;
|
||||
static vr_draw_border_t vga_pxlborder_direct;
|
||||
static vr_draw_border_t vga_pxlborder_planar;
|
||||
static vr_draw_t vga_egadraw;
|
||||
static vr_draw_t vga_vgadraw_direct;
|
||||
static vr_draw_t vga_vgadraw_planar;
|
||||
static vr_set_cursor_t vga_pxlcursor_shape;
|
||||
@ -524,10 +523,7 @@ vga_rndrinit(scr_stat *scp)
|
||||
if (scp->sc->adp->va_info.vi_mem_model == V_INFO_MM_PLANAR) {
|
||||
scp->rndr->clear = vga_pxlclear_planar;
|
||||
scp->rndr->draw_border = vga_pxlborder_planar;
|
||||
if (scp->sc->adp->va_type == KD_VGA)
|
||||
scp->rndr->draw = vga_egadraw;
|
||||
else
|
||||
scp->rndr->draw = vga_vgadraw_planar;
|
||||
scp->rndr->draw = vga_vgadraw_planar;
|
||||
scp->rndr->draw_cursor = vga_pxlcursor_planar;
|
||||
scp->rndr->blink_cursor = vga_pxlblink_planar;
|
||||
scp->rndr->draw_mouse = vga_pxlmouse_planar;
|
||||
@ -684,64 +680,6 @@ vga_pxlborder_planar(scr_stat *scp, int color)
|
||||
outw(GDCIDX, 0x0001); /* set/reset enable */
|
||||
}
|
||||
|
||||
static void
|
||||
vga_egadraw(scr_stat *scp, int from, int count, int flip)
|
||||
{
|
||||
vm_offset_t d;
|
||||
vm_offset_t e;
|
||||
u_char *f;
|
||||
u_short bg;
|
||||
u_short col1, col2;
|
||||
int line_width;
|
||||
int i, j;
|
||||
int a;
|
||||
u_char c;
|
||||
|
||||
line_width = scp->sc->adp->va_line_width;
|
||||
|
||||
d = GET_PIXEL(scp, from, 1, line_width);
|
||||
|
||||
outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
|
||||
outw(GDCIDX, 0x0003); /* data rotate/function select */
|
||||
outw(GDCIDX, 0x0f01); /* set/reset enable */
|
||||
bg = -1;
|
||||
if (from + count > scp->xsize*scp->ysize)
|
||||
count = scp->xsize*scp->ysize - from;
|
||||
for (i = from; count-- > 0; ++i) {
|
||||
a = sc_vtb_geta(&scp->vtb, i);
|
||||
if (flip) {
|
||||
col1 = ((a & 0x7000) >> 4) | (a & 0x0800);
|
||||
col2 = ((a & 0x8000) >> 4) | (a & 0x0700);
|
||||
} else {
|
||||
col1 = (a & 0x0f00);
|
||||
col2 = (a & 0xf000) >> 4;
|
||||
}
|
||||
/* set background color in EGA/VGA latch */
|
||||
if (bg != col2) {
|
||||
bg = col2;
|
||||
outw(GDCIDX, bg | 0x00); /* set/reset */
|
||||
outw(GDCIDX, 0xff08); /* bit mask */
|
||||
writeb(d, 0);
|
||||
c = readb(d); /* set bg color in the latch */
|
||||
}
|
||||
/* foreground color */
|
||||
outw(GDCIDX, col1 | 0x00); /* set/reset */
|
||||
e = d;
|
||||
f = &(scp->font[sc_vtb_getc(&scp->vtb, i)*scp->font_size]);
|
||||
for (j = 0; j < scp->font_size; ++j, ++f) {
|
||||
outw(GDCIDX, (*f << 8) | 0x08); /* bit mask */
|
||||
writeb(e, 0);
|
||||
e += line_width;
|
||||
}
|
||||
++d;
|
||||
if ((i % scp->xsize) == scp->xsize - 1)
|
||||
d += scp->font_size * line_width - scp->xsize;
|
||||
}
|
||||
outw(GDCIDX, 0x0000); /* set/reset */
|
||||
outw(GDCIDX, 0x0001); /* set/reset enable */
|
||||
outw(GDCIDX, 0xff08); /* bit mask */
|
||||
}
|
||||
|
||||
static void
|
||||
vga_vgadraw_direct(scr_stat *scp, int from, int count, int flip)
|
||||
{
|
||||
@ -798,7 +736,7 @@ vga_vgadraw_planar(scr_stat *scp, int from, int count, int flip)
|
||||
vm_offset_t d;
|
||||
vm_offset_t e;
|
||||
u_char *f;
|
||||
u_short bg;
|
||||
u_short bg, fg;
|
||||
u_short col1, col2;
|
||||
int line_width;
|
||||
int i, j;
|
||||
@ -809,11 +747,14 @@ vga_vgadraw_planar(scr_stat *scp, int from, int count, int flip)
|
||||
|
||||
d = GET_PIXEL(scp, from, 1, line_width);
|
||||
|
||||
outw(GDCIDX, 0x0305); /* read mode 0, write mode 3 */
|
||||
if (scp->sc->adp->va_type == KD_VGA) {
|
||||
outw(GDCIDX, 0x0305); /* read mode 0, write mode 3 */
|
||||
outw(GDCIDX, 0xff08); /* bit mask */
|
||||
} else
|
||||
outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
|
||||
outw(GDCIDX, 0x0003); /* data rotate/function select */
|
||||
outw(GDCIDX, 0x0f01); /* set/reset enable */
|
||||
outw(GDCIDX, 0xff08); /* bit mask */
|
||||
bg = -1;
|
||||
fg = bg = -1;
|
||||
if (from + count > scp->xsize*scp->ysize)
|
||||
count = scp->xsize*scp->ysize - from;
|
||||
for (i = from; count-- > 0; ++i) {
|
||||
@ -828,25 +769,37 @@ vga_vgadraw_planar(scr_stat *scp, int from, int count, int flip)
|
||||
/* set background color in EGA/VGA latch */
|
||||
if (bg != col2) {
|
||||
bg = col2;
|
||||
outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
|
||||
fg = -1;
|
||||
outw(GDCIDX, bg | 0x00); /* set/reset */
|
||||
writeb(d, 0);
|
||||
if (scp->sc->adp->va_type != KD_VGA)
|
||||
outw(GDCIDX, 0xff08); /* bit mask */
|
||||
writeb(d, 0xff);
|
||||
c = readb(d); /* set bg color in the latch */
|
||||
outw(GDCIDX, 0x0305); /* read mode 0, write mode 3 */
|
||||
}
|
||||
/* foreground color */
|
||||
outw(GDCIDX, col1 | 0x00); /* set/reset */
|
||||
if (fg != col1) {
|
||||
fg = col1;
|
||||
outw(GDCIDX, col1 | 0x00); /* set/reset */
|
||||
}
|
||||
e = d;
|
||||
f = &(scp->font[sc_vtb_getc(&scp->vtb, i)*scp->font_size]);
|
||||
for (j = 0; j < scp->font_size; ++j, ++f) {
|
||||
writeb(e, *f);
|
||||
if (scp->sc->adp->va_type == KD_VGA)
|
||||
writeb(e, *f);
|
||||
else {
|
||||
outw(GDCIDX, (*f << 8) | 0x08); /* bit mask */
|
||||
writeb(e, 0);
|
||||
}
|
||||
e += line_width;
|
||||
}
|
||||
++d;
|
||||
if ((i % scp->xsize) == scp->xsize - 1)
|
||||
d += scp->font_size * line_width - scp->xsize;
|
||||
}
|
||||
outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
|
||||
if (scp->sc->adp->va_type == KD_VGA)
|
||||
outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
|
||||
else
|
||||
outw(GDCIDX, 0xff08); /* bit mask */
|
||||
outw(GDCIDX, 0x0000); /* set/reset */
|
||||
outw(GDCIDX, 0x0001); /* set/reset enable */
|
||||
}
|
||||
|
@ -272,8 +272,6 @@ fuse_vnode_open(struct vnode *vp, int32_t fuse_open_flags, struct thread *td)
|
||||
/*
|
||||
* Funcation is called for every vnode open.
|
||||
* Merge fuse_open_flags it may be 0
|
||||
*
|
||||
* XXXIP: Handle FOPEN_KEEP_CACHE
|
||||
*/
|
||||
/*
|
||||
* Ideally speaking, direct io should be enabled on
|
||||
@ -293,6 +291,8 @@ fuse_vnode_open(struct vnode *vp, int32_t fuse_open_flags, struct thread *td)
|
||||
VTOFUD(vp)->flag |= FN_DIRECTIO;
|
||||
fuse_io_invalbuf(vp, td);
|
||||
} else {
|
||||
if ((fuse_open_flags & FOPEN_KEEP_CACHE) == 0)
|
||||
fuse_io_invalbuf(vp, td);
|
||||
VTOFUD(vp)->flag &= ~FN_DIRECTIO;
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,8 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp,
|
||||
retries = nmp->nm_retry;
|
||||
} else
|
||||
retries = INT_MAX;
|
||||
if (NFSHASNFSV4N(nmp)) {
|
||||
/* cred == NULL for DS connects. */
|
||||
if (NFSHASNFSV4N(nmp) && cred != NULL) {
|
||||
/*
|
||||
* Make sure the nfscbd_pool doesn't get destroyed
|
||||
* while doing this.
|
||||
@ -1042,8 +1043,10 @@ tryagain:
|
||||
/*
|
||||
* If this op's status is non-zero, mark
|
||||
* that there is no more data to process.
|
||||
* The exception is Setattr, which always has xdr
|
||||
* when it has failed.
|
||||
*/
|
||||
if (j)
|
||||
if (j != 0 && i != NFSV4OP_SETATTR)
|
||||
nd->nd_flag |= ND_NOMOREDATA;
|
||||
|
||||
/*
|
||||
|
@ -63,8 +63,8 @@ int nfsrv_useacl = 1;
|
||||
struct nfssockreq nfsrv_nfsuserdsock;
|
||||
int nfsrv_nfsuserd = 0;
|
||||
struct nfsreqhead nfsd_reqq;
|
||||
uid_t nfsrv_defaultuid;
|
||||
gid_t nfsrv_defaultgid;
|
||||
uid_t nfsrv_defaultuid = UID_NOBODY;
|
||||
gid_t nfsrv_defaultgid = GID_NOGROUP;
|
||||
int nfsrv_lease = NFSRV_LEASE;
|
||||
int ncl_mbuf_mlen = MLEN;
|
||||
int nfsd_enable_stringtouid = 0;
|
||||
|
@ -471,6 +471,11 @@ nfscl_mtofh(struct nfsrv_descript *nd, struct nfsfh **nfhpp,
|
||||
flag = fxdr_unsigned(int, *tl);
|
||||
} else if (nd->nd_flag & ND_NFSV4) {
|
||||
NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
|
||||
/* If the GetFH failed, clear flag. */
|
||||
if (*++tl != 0) {
|
||||
nd->nd_flag |= ND_NOMOREDATA;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
error = nfsm_getfh(nd, nfhpp);
|
||||
@ -481,8 +486,12 @@ nfscl_mtofh(struct nfsrv_descript *nd, struct nfsfh **nfhpp,
|
||||
/*
|
||||
* Now, get the attributes.
|
||||
*/
|
||||
if (nd->nd_flag & ND_NFSV4) {
|
||||
if (flag != 0 && (nd->nd_flag & ND_NFSV4) != 0) {
|
||||
NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
|
||||
if (*++tl != 0) {
|
||||
nd->nd_flag |= ND_NOMOREDATA;
|
||||
flag = 0;
|
||||
}
|
||||
} else if (nd->nd_flag & ND_NFSV3) {
|
||||
NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
|
||||
if (flag) {
|
||||
|
@ -1436,7 +1436,9 @@ nfsvno_open(struct nfsrv_descript *nd, struct nameidata *ndp,
|
||||
vput(ndp->ni_vp);
|
||||
ndp->ni_vp = NULL;
|
||||
nd->nd_repstat = NFSERR_NOTSUPP;
|
||||
}
|
||||
} else
|
||||
NFSSETBIT_ATTRBIT(attrbitp,
|
||||
NFSATTRBIT_TIMEACCESS);
|
||||
} else {
|
||||
nfsrv_fixattr(nd, ndp->ni_vp, nvap,
|
||||
aclp, p, attrbitp, exp);
|
||||
|
@ -510,7 +510,7 @@ eli_metadata_dump(const struct g_eli_metadata *md)
|
||||
printf(" provsize: %ju\n", (uintmax_t)md->md_provsize);
|
||||
printf("sectorsize: %u\n", (u_int)md->md_sectorsize);
|
||||
printf(" keys: 0x%02x\n", (u_int)md->md_keys);
|
||||
printf("iterations: %u\n", (u_int)md->md_iterations);
|
||||
printf("iterations: %d\n", (int)md->md_iterations);
|
||||
bzero(str, sizeof(str));
|
||||
for (i = 0; i < sizeof(md->md_salt); i++) {
|
||||
str[i * 2] = hex[md->md_salt[i] >> 4];
|
||||
|
@ -618,7 +618,9 @@ g_eli_ctl_setkey(struct gctl_req *req, struct g_class *mp)
|
||||
return;
|
||||
}
|
||||
/* Check if iterations number should and can be changed. */
|
||||
if (*valp != -1) {
|
||||
if (*valp != -1 && md.md_iterations == -1) {
|
||||
md.md_iterations = *valp;
|
||||
} else if (*valp != -1 && *valp != md.md_iterations) {
|
||||
if (bitcount32(md.md_keys) != 1) {
|
||||
gctl_error(req, "To be able to use '-i' option, only "
|
||||
"one key can be defined.");
|
||||
|
@ -439,10 +439,8 @@ lagg_register_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
|
||||
return;
|
||||
|
||||
LAGG_RLOCK(sc, &tracker);
|
||||
if (!SLIST_EMPTY(&sc->sc_ports)) {
|
||||
SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
|
||||
EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
|
||||
}
|
||||
SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
|
||||
EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
|
||||
LAGG_RUNLOCK(sc, &tracker);
|
||||
}
|
||||
|
||||
@ -461,10 +459,8 @@ lagg_unregister_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
|
||||
return;
|
||||
|
||||
LAGG_RLOCK(sc, &tracker);
|
||||
if (!SLIST_EMPTY(&sc->sc_ports)) {
|
||||
SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
|
||||
EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
|
||||
}
|
||||
SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
|
||||
EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
|
||||
LAGG_RUNLOCK(sc, &tracker);
|
||||
}
|
||||
|
||||
@ -683,6 +679,7 @@ lagg_port_lladdr(struct lagg_port *lp, uint8_t *lladdr, lagg_llqtype llq_type)
|
||||
if (llq == NULL) /* XXX what to do */
|
||||
return;
|
||||
|
||||
if_ref(ifp);
|
||||
llq->llq_ifp = ifp;
|
||||
llq->llq_type = llq_type;
|
||||
bcopy(lladdr, llq->llq_lladdr, ETHER_ADDR_LEN);
|
||||
@ -731,6 +728,7 @@ lagg_port_setlladdr(void *arg, int pending)
|
||||
EVENTHANDLER_INVOKE(iflladdr_event, ifp);
|
||||
CURVNET_RESTORE();
|
||||
head = SLIST_NEXT(llq, llq_entries);
|
||||
if_rele(ifp);
|
||||
free(llq, M_DEVBUF);
|
||||
}
|
||||
}
|
||||
@ -805,6 +803,7 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet *ifp)
|
||||
lp->lp_output = ifp->if_output;
|
||||
ifp->if_output = lagg_port_output;
|
||||
|
||||
if_ref(ifp);
|
||||
lp->lp_ifp = ifp;
|
||||
lp->lp_softc = sc;
|
||||
|
||||
@ -958,6 +957,7 @@ lagg_port_destroy(struct lagg_port *lp, int rundelport)
|
||||
if (llq->llq_ifp == ifp) {
|
||||
SLIST_REMOVE(&sc->sc_llq_head, llq, lagg_llq,
|
||||
llq_entries);
|
||||
if_rele(llq->llq_ifp);
|
||||
free(llq, M_DEVBUF);
|
||||
break; /* Only appears once */
|
||||
}
|
||||
@ -967,6 +967,7 @@ lagg_port_destroy(struct lagg_port *lp, int rundelport)
|
||||
if (lp->lp_ifflags)
|
||||
if_printf(ifp, "%s: lp_ifflags unclean\n", __func__);
|
||||
|
||||
if_rele(ifp);
|
||||
free(lp, M_DEVBUF);
|
||||
|
||||
/* Update lagg capabilities */
|
||||
@ -1443,7 +1444,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||
break;
|
||||
case SIOCGLAGGPORT:
|
||||
if (rp->rp_portname[0] == '\0' ||
|
||||
(tpif = ifunit(rp->rp_portname)) == NULL) {
|
||||
(tpif = ifunit_ref(rp->rp_portname)) == NULL) {
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
@ -1453,18 +1454,20 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||
lp->lp_softc != sc) {
|
||||
error = ENOENT;
|
||||
LAGG_RUNLOCK(sc, &tracker);
|
||||
if_rele(tpif);
|
||||
break;
|
||||
}
|
||||
|
||||
lagg_port2req(lp, rp);
|
||||
LAGG_RUNLOCK(sc, &tracker);
|
||||
if_rele(tpif);
|
||||
break;
|
||||
case SIOCSLAGGPORT:
|
||||
error = priv_check(td, PRIV_NET_LAGG);
|
||||
if (error)
|
||||
break;
|
||||
if (rp->rp_portname[0] == '\0' ||
|
||||
(tpif = ifunit(rp->rp_portname)) == NULL) {
|
||||
(tpif = ifunit_ref(rp->rp_portname)) == NULL) {
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
@ -1491,13 +1494,14 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||
LAGG_WLOCK(sc);
|
||||
error = lagg_port_create(sc, tpif);
|
||||
LAGG_WUNLOCK(sc);
|
||||
if_rele(tpif);
|
||||
break;
|
||||
case SIOCSLAGGDELPORT:
|
||||
error = priv_check(td, PRIV_NET_LAGG);
|
||||
if (error)
|
||||
break;
|
||||
if (rp->rp_portname[0] == '\0' ||
|
||||
(tpif = ifunit(rp->rp_portname)) == NULL) {
|
||||
(tpif = ifunit_ref(rp->rp_portname)) == NULL) {
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
@ -1507,11 +1511,13 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||
lp->lp_softc != sc) {
|
||||
error = ENOENT;
|
||||
LAGG_WUNLOCK(sc);
|
||||
if_rele(tpif);
|
||||
break;
|
||||
}
|
||||
|
||||
error = lagg_port_destroy(lp, 1);
|
||||
LAGG_WUNLOCK(sc);
|
||||
if_rele(tpif);
|
||||
break;
|
||||
case SIOCSIFFLAGS:
|
||||
/* Set flags on ports too */
|
||||
|
@ -1306,6 +1306,20 @@ ieee80211_wme_updateparams(struct ieee80211vap *vap)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_wme_vap_getparams(struct ieee80211vap *vap, struct chanAccParams *wp)
|
||||
{
|
||||
|
||||
memcpy(wp, &vap->iv_ic->ic_wme.wme_chanParams, sizeof(*wp));
|
||||
}
|
||||
|
||||
void
|
||||
ieee80211_wme_ic_getparams(struct ieee80211com *ic, struct chanAccParams *wp)
|
||||
{
|
||||
|
||||
memcpy(wp, &ic->ic_wme.wme_chanParams, sizeof(*wp));
|
||||
}
|
||||
|
||||
static void
|
||||
parent_updown(void *arg, int npending)
|
||||
{
|
||||
|
@ -292,6 +292,10 @@ struct ieee80211_wme_state {
|
||||
void ieee80211_wme_initparams(struct ieee80211vap *);
|
||||
void ieee80211_wme_updateparams(struct ieee80211vap *);
|
||||
void ieee80211_wme_updateparams_locked(struct ieee80211vap *);
|
||||
void ieee80211_wme_vap_getparams(struct ieee80211vap *vap,
|
||||
struct chanAccParams *);
|
||||
void ieee80211_wme_ic_getparams(struct ieee80211com *ic,
|
||||
struct chanAccParams *);
|
||||
|
||||
/*
|
||||
* Return the WME TID from a QoS frame. If no TID
|
||||
|
@ -260,7 +260,8 @@ syncache_init(void)
|
||||
&V_tcp_syncache.hashbase[i].sch_mtx, 0);
|
||||
V_tcp_syncache.hashbase[i].sch_length = 0;
|
||||
V_tcp_syncache.hashbase[i].sch_sc = &V_tcp_syncache;
|
||||
V_tcp_syncache.hashbase[i].sch_last_overflow = INT64_MIN;
|
||||
V_tcp_syncache.hashbase[i].sch_last_overflow =
|
||||
-(SYNCOOKIE_LIFETIME + 1);
|
||||
}
|
||||
|
||||
/* Create the syncache entry zone. */
|
||||
|
@ -315,6 +315,7 @@ void devfs_free_cdp_inode(ino_t ino);
|
||||
#define GID_GAMES 13
|
||||
#define GID_VIDEO 44
|
||||
#define GID_DIALER 68
|
||||
#define GID_NOGROUP 65533
|
||||
#define GID_NOBODY 65534
|
||||
|
||||
typedef void (*dev_clone_fn)(void *arg, struct ucred *cred, char *name,
|
||||
|
5
tools/build/options/WITHOUT_BSD_GREP_FASTMATCH
Normal file
5
tools/build/options/WITHOUT_BSD_GREP_FASTMATCH
Normal file
@ -0,0 +1,5 @@
|
||||
.\" $FreeBSD$
|
||||
Set this option to exclude the fastmatch implementation from
|
||||
.Xr bsdgrep 1 ,
|
||||
instead using only
|
||||
.Xr regex 3 .
|
4
tools/build/options/WITH_GNU_GREP_COMPAT
Normal file
4
tools/build/options/WITH_GNU_GREP_COMPAT
Normal file
@ -0,0 +1,4 @@
|
||||
.\" $FreeBSD$
|
||||
Set this option to include GNU extensions in
|
||||
.Xr bsdgrep 1
|
||||
by linking against libgnuregex.
|
@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR}
|
||||
CLEANDIRS+= FreeBSD
|
||||
CLEANFILES+= bootstrap
|
||||
|
||||
# $Id: Makefile,v 1.85 2017/04/13 16:29:40 sjg Exp $
|
||||
# $Id: Makefile,v 1.88 2017/04/20 14:51:14 sjg Exp $
|
||||
|
||||
# Base version on src date
|
||||
_MAKE_VERSION= 20170413
|
||||
_MAKE_VERSION= 20170420
|
||||
|
||||
PROG?= ${.CURDIR:T}
|
||||
|
||||
|
@ -15,10 +15,14 @@ bsdgrep.1: grep.1
|
||||
.endif
|
||||
SRCS= file.c grep.c queue.c util.c
|
||||
|
||||
# Extra files ported backported form some regex improvements
|
||||
.if ${MK_BSD_GREP_FASTMATCH} == "yes"
|
||||
# Extra files ported backported for some regex improvements
|
||||
.PATH: ${.CURDIR}/regex
|
||||
SRCS+= fastmatch.c hashtable.c tre-compile.c tre-fastmatch.c
|
||||
CFLAGS+=-I${.CURDIR}/regex
|
||||
.else
|
||||
CFLAGS+= -DWITHOUT_FASTMATCH
|
||||
.endif
|
||||
|
||||
CFLAGS.gcc+= --param max-inline-insns-single=500
|
||||
|
||||
|
@ -49,7 +49,9 @@ __FBSDID("$FreeBSD$");
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef WITHOUT_FASTMATCH
|
||||
#include "fastmatch.h"
|
||||
#endif
|
||||
#include "grep.h"
|
||||
|
||||
#ifndef WITHOUT_NLS
|
||||
@ -86,7 +88,9 @@ unsigned int patterns;
|
||||
static unsigned int pattern_sz;
|
||||
struct pat *pattern;
|
||||
regex_t *r_pattern;
|
||||
#ifndef WITHOUT_FASTMATCH
|
||||
fastmatch_t *fg_pattern;
|
||||
#endif
|
||||
|
||||
/* Filename exclusion/inclusion patterns */
|
||||
unsigned int fpatterns, dpatterns;
|
||||
@ -715,20 +719,25 @@ main(int argc, char *argv[])
|
||||
usage();
|
||||
}
|
||||
|
||||
#ifndef WITHOUT_FASTMATCH
|
||||
fg_pattern = grep_calloc(patterns, sizeof(*fg_pattern));
|
||||
#endif
|
||||
r_pattern = grep_calloc(patterns, sizeof(*r_pattern));
|
||||
|
||||
/* Check if cheating is allowed (always is for fgrep). */
|
||||
for (i = 0; i < patterns; ++i) {
|
||||
#ifndef WITHOUT_FASTMATCH
|
||||
/* Attempt compilation with fastmatch regex and fallback to
|
||||
regex(3) if it fails. */
|
||||
if (fastncomp(&fg_pattern[i], pattern[i].pat,
|
||||
pattern[i].len, cflags) != 0) {
|
||||
/* Fall back to full regex library */
|
||||
c = regcomp(&r_pattern[i], pattern[i].pat, cflags);
|
||||
if (c != 0) {
|
||||
regerror(c, &r_pattern[i], re_error,
|
||||
RE_ERROR_BUF);
|
||||
errx(2, "%s", re_error);
|
||||
}
|
||||
pattern[i].len, cflags) == 0)
|
||||
continue;
|
||||
#endif
|
||||
c = regcomp(&r_pattern[i], pattern[i].pat, cflags);
|
||||
if (c != 0) {
|
||||
regerror(c, &r_pattern[i], re_error,
|
||||
RE_ERROR_BUF);
|
||||
errx(2, "%s", re_error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,9 @@
|
||||
#include <stdio.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#ifndef WITHOUT_FASTMATCH
|
||||
#include "fastmatch.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITHOUT_NLS
|
||||
#define getstr(n) errstr[n]
|
||||
@ -127,7 +129,9 @@ extern unsigned int dpatterns, fpatterns, patterns;
|
||||
extern struct pat *pattern;
|
||||
extern struct epat *dpattern, *fpattern;
|
||||
extern regex_t *er_pattern, *r_pattern;
|
||||
#ifndef WITHOUT_FASTMATCH
|
||||
extern fastmatch_t *fg_pattern;
|
||||
#endif
|
||||
|
||||
/* For regex errors */
|
||||
#define RE_ERROR_BUF 512
|
||||
|
@ -49,7 +49,9 @@ __FBSDID("$FreeBSD$");
|
||||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
|
||||
#ifndef WITHOUT_FASTMATCH
|
||||
#include "fastmatch.h"
|
||||
#endif
|
||||
#include "grep.h"
|
||||
|
||||
static int linesqueued;
|
||||
@ -317,10 +319,12 @@ procline(struct str *l, int nottext)
|
||||
for (i = 0; i < patterns; i++) {
|
||||
pmatch.rm_so = st;
|
||||
pmatch.rm_eo = l->len;
|
||||
#ifndef WITHOUT_FASTMATCH
|
||||
if (fg_pattern[i].pattern)
|
||||
r = fastexec(&fg_pattern[i],
|
||||
l->dat, 1, &pmatch, leflags);
|
||||
else
|
||||
#endif
|
||||
r = regexec(&r_pattern[i], l->dat, 1,
|
||||
&pmatch, leflags);
|
||||
r = (r == 0) ? 0 : REG_NOMATCH;
|
||||
@ -332,7 +336,11 @@ procline(struct str *l, int nottext)
|
||||
(size_t)pmatch.rm_eo != l->len)
|
||||
r = REG_NOMATCH;
|
||||
/* Check for whole word match */
|
||||
#ifndef WITHOUT_FASTMATCH
|
||||
if (r == 0 && (wflag || fg_pattern[i].word)) {
|
||||
#else
|
||||
if (r == 0 && wflag) {
|
||||
#endif
|
||||
wchar_t wbegin, wend;
|
||||
|
||||
wbegin = wend = L' ';
|
||||
|
@ -70,35 +70,35 @@ static const char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94";
|
||||
|
||||
static struct Info {
|
||||
long time[CPUSTATES];
|
||||
u_int v_swtch; /* context switches */
|
||||
u_int v_trap; /* calls to trap */
|
||||
u_int v_syscall; /* calls to syscall() */
|
||||
u_int v_intr; /* device interrupts */
|
||||
u_int v_soft; /* software interrupts */
|
||||
uint64_t v_swtch; /* context switches */
|
||||
uint64_t v_trap; /* calls to trap */
|
||||
uint64_t v_syscall; /* calls to syscall() */
|
||||
uint64_t v_intr; /* device interrupts */
|
||||
uint64_t v_soft; /* software interrupts */
|
||||
/*
|
||||
* Virtual memory activity.
|
||||
*/
|
||||
u_int v_vm_faults; /* number of address memory faults */
|
||||
u_int v_io_faults; /* page faults requiring I/O */
|
||||
u_int v_cow_faults; /* number of copy-on-writes */
|
||||
u_int v_zfod; /* pages zero filled on demand */
|
||||
u_int v_ozfod; /* optimized zero fill pages */
|
||||
u_int v_swapin; /* swap pager pageins */
|
||||
u_int v_swapout; /* swap pager pageouts */
|
||||
u_int v_swappgsin; /* swap pager pages paged in */
|
||||
u_int v_swappgsout; /* swap pager pages paged out */
|
||||
u_int v_vnodein; /* vnode pager pageins */
|
||||
u_int v_vnodeout; /* vnode pager pageouts */
|
||||
u_int v_vnodepgsin; /* vnode_pager pages paged in */
|
||||
u_int v_vnodepgsout; /* vnode pager pages paged out */
|
||||
u_int v_intrans; /* intransit blocking page faults */
|
||||
u_int v_reactivated; /* number of pages reactivated by pagedaemon */
|
||||
u_int v_pdwakeups; /* number of times daemon has awaken from sleep */
|
||||
u_int v_pdpages; /* number of pages analyzed by daemon */
|
||||
uint64_t v_vm_faults; /* number of address memory faults */
|
||||
uint64_t v_io_faults; /* page faults requiring I/O */
|
||||
uint64_t v_cow_faults; /* number of copy-on-writes */
|
||||
uint64_t v_zfod; /* pages zero filled on demand */
|
||||
uint64_t v_ozfod; /* optimized zero fill pages */
|
||||
uint64_t v_swapin; /* swap pager pageins */
|
||||
uint64_t v_swapout; /* swap pager pageouts */
|
||||
uint64_t v_swappgsin; /* swap pager pages paged in */
|
||||
uint64_t v_swappgsout; /* swap pager pages paged out */
|
||||
uint64_t v_vnodein; /* vnode pager pageins */
|
||||
uint64_t v_vnodeout; /* vnode pager pageouts */
|
||||
uint64_t v_vnodepgsin; /* vnode_pager pages paged in */
|
||||
uint64_t v_vnodepgsout; /* vnode pager pages paged out */
|
||||
uint64_t v_intrans; /* intransit blocking page faults */
|
||||
uint64_t v_reactivated; /* number of pages reactivated by pagedaemon */
|
||||
uint64_t v_pdwakeups; /* number of times daemon has awaken from sleep */
|
||||
uint64_t v_pdpages; /* number of pages analyzed by daemon */
|
||||
|
||||
u_int v_dfree; /* pages freed by daemon */
|
||||
u_int v_pfree; /* pages freed by exiting processes */
|
||||
u_int v_tfree; /* total pages freed */
|
||||
uint64_t v_dfree; /* pages freed by daemon */
|
||||
uint64_t v_pfree; /* pages freed by exiting processes */
|
||||
uint64_t v_tfree; /* total pages freed */
|
||||
/*
|
||||
* Distribution of page usages.
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@
|
||||
.\" @(#)tip.1 8.4 (Berkeley) 4/18/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 1, 2006
|
||||
.Dd April 22, 2017
|
||||
.Dt CU 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -494,6 +494,11 @@ line access log
|
||||
lock file to avoid conflicts with
|
||||
.Xr uucp 1 Pq Pa ports/net/freebsd-uucp
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
Connect to the first USB serial port at the speed of 115200 baud:
|
||||
.Bd -literal -offset indent
|
||||
cu -s 115200 -l /dev/cuaU0
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr tip 1
|
||||
.Sh HISTORY
|
||||
|
@ -413,12 +413,11 @@ retry_nlist:
|
||||
}
|
||||
|
||||
static int
|
||||
mysysctl(const char *name, void *oldp, size_t *oldlenp,
|
||||
void *newp, size_t newlen)
|
||||
mysysctl(const char *name, void *oldp, size_t *oldlenp)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = sysctlbyname(name, oldp, oldlenp, newp, newlen);
|
||||
error = sysctlbyname(name, oldp, oldlenp, NULL, 0);
|
||||
if (error != 0 && errno != ENOMEM)
|
||||
xo_err(1, "sysctl(%s)", name);
|
||||
return (error);
|
||||
@ -541,10 +540,12 @@ fill_vmmeter(struct __vmmeter *vmmp)
|
||||
GET_COUNTER(v_kthreadpages);
|
||||
#undef GET_COUNTER
|
||||
} else {
|
||||
size_t size = sizeof(uint64_t);
|
||||
size_t size;
|
||||
|
||||
#define GET_VM_STATS(cat, name) \
|
||||
mysysctl("vm.stats." #cat "." #name, &vmmp->name, &size, NULL, 0)
|
||||
#define GET_VM_STATS(cat, name) do { \
|
||||
size = sizeof(vmmp->name); \
|
||||
mysysctl("vm.stats." #cat "." #name, &vmmp->name, &size); \
|
||||
} while (0)
|
||||
/* sys */
|
||||
GET_VM_STATS(sys, v_swtch);
|
||||
GET_VM_STATS(sys, v_trap);
|
||||
@ -609,7 +610,7 @@ fill_vmtotal(struct vmtotal *vmtp)
|
||||
xo_errx(1, "not implemented");
|
||||
} else {
|
||||
size_t size = sizeof(*vmtp);
|
||||
mysysctl("vm.vmtotal", vmtp, &size, NULL, 0);
|
||||
mysysctl("vm.vmtotal", vmtp, &size);
|
||||
if (size != sizeof(*vmtp))
|
||||
xo_errx(1, "vm.total size mismatch");
|
||||
}
|
||||
@ -633,14 +634,14 @@ getcpuinfo(u_long *maskp, int *maxidp)
|
||||
mask = 0;
|
||||
ncpus = 0;
|
||||
size = sizeof(maxcpu);
|
||||
mysysctl("kern.smp.maxcpus", &maxcpu, &size, NULL, 0);
|
||||
mysysctl("kern.smp.maxcpus", &maxcpu, &size);
|
||||
if (size != sizeof(maxcpu))
|
||||
xo_errx(1, "sysctl kern.smp.maxcpus");
|
||||
size = sizeof(long) * maxcpu * CPUSTATES;
|
||||
times = malloc(size);
|
||||
if (times == NULL)
|
||||
xo_err(1, "malloc %zd bytes", size);
|
||||
mysysctl("kern.cp_times", times, &size, NULL, 0);
|
||||
mysysctl("kern.cp_times", times, &size);
|
||||
maxid = (size / CPUSTATES / sizeof(long)) - 1;
|
||||
for (i = 0; i <= maxid; i++) {
|
||||
empty = 1;
|
||||
@ -731,7 +732,7 @@ dovmstat(unsigned int interval, int reps)
|
||||
struct clockinfo clockrate;
|
||||
|
||||
size = sizeof(clockrate);
|
||||
mysysctl("kern.clockrate", &clockrate, &size, NULL, 0);
|
||||
mysysctl("kern.clockrate", &clockrate, &size);
|
||||
if (size != sizeof(clockrate))
|
||||
xo_errx(1, "clockrate size mismatch");
|
||||
hz = clockrate.hz;
|
||||
@ -751,13 +752,13 @@ dovmstat(unsigned int interval, int reps)
|
||||
xo_errx(1, "kvm_getcptime: %s", kvm_geterr(kd));
|
||||
} else {
|
||||
size = sizeof(cur.cp_time);
|
||||
mysysctl("kern.cp_time", &cur.cp_time, &size, NULL, 0);
|
||||
mysysctl("kern.cp_time", &cur.cp_time, &size);
|
||||
if (size != sizeof(cur.cp_time))
|
||||
xo_errx(1, "cp_time size mismatch");
|
||||
}
|
||||
if (Pflag) {
|
||||
size = size_cp_times;
|
||||
mysysctl("kern.cp_times", cur_cp_times, &size, NULL, 0);
|
||||
mysysctl("kern.cp_times", cur_cp_times, &size);
|
||||
if (size != size_cp_times)
|
||||
xo_errx(1, "cp_times mismatch");
|
||||
}
|
||||
@ -1110,7 +1111,7 @@ dosum(void)
|
||||
kread(X_NCHSTATS, &lnchstats, sizeof(lnchstats));
|
||||
} else {
|
||||
size_t size = sizeof(lnchstats);
|
||||
mysysctl("vfs.cache.nchstats", &lnchstats, &size, NULL, 0);
|
||||
mysysctl("vfs.cache.nchstats", &lnchstats, &size);
|
||||
if (size != sizeof(lnchstats))
|
||||
xo_errx(1, "vfs.cache.nchstats size mismatch");
|
||||
}
|
||||
@ -1300,8 +1301,7 @@ read_intrcnts(unsigned long **intrcnts)
|
||||
*intrcnts = reallocf(*intrcnts, intrcntlen);
|
||||
if (*intrcnts == NULL)
|
||||
err(1, "reallocf()");
|
||||
if (mysysctl("hw.intrcnt",
|
||||
*intrcnts, &intrcntlen, NULL, 0) == 0)
|
||||
if (mysysctl("hw.intrcnt", *intrcnts, &intrcntlen) == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1369,8 +1369,7 @@ dointr(unsigned int interval, int reps)
|
||||
for (intrnames = NULL, inamlen = 1024; ; inamlen *= 2) {
|
||||
if ((intrnames = reallocf(intrnames, inamlen)) == NULL)
|
||||
xo_err(1, "reallocf()");
|
||||
if (mysysctl("hw.intrnames",
|
||||
intrnames, &inamlen, NULL, 0) == 0)
|
||||
if (mysysctl("hw.intrnames", intrnames, &inamlen) == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 1, 2015
|
||||
.Dd April 21, 2017
|
||||
.Dt NFSUSERD 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -64,8 +64,8 @@ if that name is not a fully qualified host name, the canonical name as
|
||||
reported by
|
||||
.Xr getaddrinfo 3 .
|
||||
.It Fl usertimeout Ar minutes
|
||||
Overrides the default timeout for cache entries, in minutes. If the
|
||||
timeout is specified as 0, cache entries never time out. The longer the
|
||||
Overrides the default timeout for cache entries, in minutes.
|
||||
The longer the
|
||||
time out, the better the performance, but the longer it takes for replaced
|
||||
entries to be seen. If your user/group database management system almost
|
||||
never re-uses the same names or id numbers, a large timeout is recommended.
|
||||
|
Loading…
x
Reference in New Issue
Block a user