Merge ^/head r337646 through r338014.

This commit is contained in:
Dimitry Andric 2018-08-18 12:15:54 +00:00
commit 3611ec6048
2107 changed files with 105511 additions and 12229 deletions

View File

@ -833,7 +833,7 @@ IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
# When generating install media, do not allow user and group information from
# the build host to affect the contents of the distribution.
.if make(distributeworld)
.if make(distributeworld) || make(distrib-dirs) || make(distribution)
DB_FROM_SRC= yes
.endif
@ -1765,7 +1765,7 @@ create-packages: .PHONY create-packages-world create-packages-kernel
create-world-packages: _pkgbootstrap .PHONY
@rm -f ${WSTAGEDIR}/*.plist 2>/dev/null || :
@cd ${WSTAGEDIR} ; \
env -i LC_COLLATE=C sort ${WSTAGEDIR}/METALOG | \
env -i LC_COLLATE=C sort ${WSTAGEDIR}/${DISTDIR}/METALOG | \
awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk
@for plist in ${WSTAGEDIR}/*.plist; do \
plist=$${plist##*/} ; \
@ -2524,7 +2524,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
${_cddl_lib_libuutil} \
${_cddl_lib_libavl} \
${_cddl_lib_libzfs_core} \
${_cddl_lib_libzfs_core} ${_cddl_lib_libzfs} \
${_cddl_lib_libctf} \
lib/libufs \
lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
@ -2597,7 +2597,15 @@ _cddl_lib_libavl= cddl/lib/libavl
_cddl_lib_libuutil= cddl/lib/libuutil
.if ${MK_ZFS} != "no"
_cddl_lib_libzfs_core= cddl/lib/libzfs_core
_cddl_lib_libzfs= cddl/lib/libzfs
cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
cddl/lib/libzfs__L: cddl/lib/libzfs_core__L lib/msun__L lib/libutil__L
cddl/lib/libzfs__L: lib/libthr__L lib/libmd__L lib/libz__L cddl/lib/libumem__L
cddl/lib/libzfs__L: cddl/lib/libuutil__L cddl/lib/libavl__L lib/libgeom__L
lib/libbe__L: cddl/lib/libzfs__L
.endif
_cddl_lib_libctf= cddl/lib/libctf
_cddl_lib= cddl/lib

View File

@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20180815:
ls(1) now respects the COLORTERM environment variable used in other
systems and software to indicate that a colored terminal is both
supported and desired. If ls(1) is suddenly emitting colors, they may
be disabled again by either removing the unwanted COLORTERM from your
environment, or using `ls --color=never`. The ls(1) specific CLICOLOR
may not be observed in a future release.
20180808:
The default pager for most commands has been changed to "less". To
restore the old behavior, set PAGER="more" and MANPAGER="more -s" in

View File

@ -8,6 +8,8 @@
.include <src.opts.mk>
CONFGROUPS= ETC
ETC= csh.cshrc csh.login csh.logout
PACKAGE=runtime
TCSHDIR= ${SRCTOP}/contrib/tcsh
.PATH: ${TCSHDIR}

View File

@ -6,6 +6,7 @@
PACKAGE=runtime
PROG= dd
SRCS= args.c conv.c conv_tab.c dd.c misc.c position.c
LIBADD= util
#
# Test the character conversion functions. We have to be explicit about

View File

@ -95,6 +95,8 @@ volatile sig_atomic_t need_progress;
int
main(int argc __unused, char *argv[])
{
struct itimerval itv = { { 1, 0 }, { 1, 0 } }; /* SIGALARM every second, if needed */
(void)setlocale(LC_CTYPE, "");
jcl(argv);
setup();
@ -104,7 +106,10 @@ main(int argc __unused, char *argv[])
err(1, "unable to enter capability mode");
(void)signal(SIGINFO, siginfo_handler);
(void)signal(SIGALRM, sigalrm_handler);
if (ddflags & C_PROGRESS) {
(void)signal(SIGALRM, sigalarm_handler);
setitimer(ITIMER_REAL, &itv, NULL);
}
(void)signal(SIGINT, terminate);
atexit(summary);
@ -284,14 +289,6 @@ setup(void)
ctab = casetab;
}
if ((ddflags & C_PROGRESS)) {
struct itimerval timer = {
.it_interval = { .tv_sec = 1, .tv_usec = 0 },
.it_value = { .tv_sec = 1, .tv_usec = 0 },
};
setitimer(ITIMER_REAL, &timer, NULL);
}
if (clock_gettime(CLOCK_MONOTONIC, &st.start))
err(1, "clock_gettime");
}
@ -469,12 +466,10 @@ dd_in(void)
in.dbp += in.dbrcnt;
(*cfunc)();
if (need_summary) {
if (need_summary)
summary();
}
if (need_progress) {
if (need_progress)
progress();
}
}
}

View File

@ -45,10 +45,10 @@ void jcl(char **);
void pos_in(void);
void pos_out(void);
double secs_elapsed(void);
void summary(void);
void progress(void);
void summary(void);
void sigalarm_handler(int);
void siginfo_handler(int);
void sigalrm_handler(int);
void terminate(int);
void unblock(void);
void unblock_close(void);

View File

@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <inttypes.h>
#include <libutil.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@ -56,8 +57,6 @@ __FBSDID("$FreeBSD$");
#include "dd.h"
#include "extern.h"
static int need_newline;
double
secs_elapsed(void)
{
@ -85,7 +84,7 @@ summary(void)
if (ddflags & C_NOINFO)
return;
if (need_newline && !need_summary)
if (ddflags & C_PROGRESS)
fprintf(stderr, "\n");
secs = secs_elapsed();
@ -110,22 +109,25 @@ summary(void)
void
progress(void)
{
static int outlen;
char si[4 + 1 + 2 + 1]; /* 123 <space> <suffix> NUL */
char iec[4 + 1 + 2 + 1]; /* 123 <space> <suffix> NUL */
char persec[4 + 1 + 2 + 1]; /* 123 <space> <suffix> NUL */
char *buf;
double secs;
static int lastlen;
int len;
secs = secs_elapsed();
len = fprintf(stderr,
"\r%ju bytes transferred in %.0f secs (%.0f bytes/sec)",
st.bytes, secs, st.bytes / secs);
if (len > 0) {
if (len < lastlen)
(void)fprintf(stderr, "%*s", len - lastlen, "");
lastlen = len;
}
need_newline = 1;
humanize_number(si, sizeof(si), (int64_t)st.bytes, "B", HN_AUTOSCALE,
HN_DECIMAL | HN_DIVISOR_1000);
humanize_number(iec, sizeof(iec), (int64_t)st.bytes, "B", HN_AUTOSCALE,
HN_DECIMAL | HN_IEC_PREFIXES);
humanize_number(persec, sizeof(iec), (int64_t)(st.bytes / secs), "B",
HN_AUTOSCALE, HN_DECIMAL | HN_DIVISOR_1000);
asprintf(&buf, " %'ju bytes (%s, %s) transferred %.3fs, %s/s",
(uintmax_t)st.bytes, si, iec, secs, persec);
outlen = fprintf(stderr, "%-*s\r", outlen, buf);
fflush(stderr);
free(buf);
need_progress = 0;
}
@ -139,7 +141,7 @@ siginfo_handler(int signo __unused)
/* ARGSUSED */
void
sigalrm_handler(int signo __unused)
sigalarm_handler(int signo __unused)
{
need_progress = 1;

View File

@ -125,6 +125,8 @@ pos_in(void)
--cnt;
if (need_summary)
summary();
if (need_progress)
progress();
continue;
}

View File

@ -32,6 +32,8 @@
* $FreeBSD$
*/
#include <stdbool.h>
int acccmp(const FTSENT *, const FTSENT *);
int revacccmp(const FTSENT *, const FTSENT *);
int birthcmp(const FTSENT *, const FTSENT *);
@ -64,5 +66,12 @@ extern char *ansi_bgcol;
extern char *ansi_coloff;
extern char *attrs_off;
extern char *enter_bold;
extern int colorflag;
extern bool explicitansi;
#define COLORFLAG_NEVER 0
#define COLORFLAG_AUTO 1
#define COLORFLAG_ALWAYS 2
#endif
extern int termwidth;

View File

@ -32,7 +32,7 @@
.\" @(#)ls.1 8.7 (Berkeley) 7/29/94
.\" $FreeBSD$
.\"
.Dd August 8, 2018
.Dd August 16, 2018
.Dt LS 1
.Os
.Sh NAME
@ -41,6 +41,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl ABCFGHILPRSTUWZabcdfghiklmnopqrstuwxy1,
.Op Fl -color Ns = Ns Ar when
.Op Fl D Ar format
.Op Ar
.Sh DESCRIPTION
@ -210,6 +211,47 @@ This option is not defined in
.St -p1003.1-2001 .
.It Fl c
Use time when file status was last changed for sorting or printing.
.It Fl -color Ns = Ns Ar when
Output colored escape sequences based on
.Ar when ,
which may be set to either
.Cm always ,
.Cm auto
(default), or
.Cm never .
.Pp
.Cm always
will make
.Nm
always output color.
If
.Ev TERM
is unset or set to an invalid terminal, then
.Nm
will fall back to explicit
.Tn ANSI
escape sequences without the help of
.Xr termcap 5 .
.Cm always
is the default if
.Fl -color
is specified without an argument.
.Pp
.Cm auto
will make
.Nm
output escape sequences based on
.Xr termcap 5 ,
but only if
.Dv stdout
is a tty and either the
.Fl G
flag is specified or the
.Ev COLORTERM
environment variable is set and not empty.
.Pp
.Cm never
will disable color regardless of environment variables.
.It Fl d
Directories are listed as plain files (not searched recursively).
.It Fl f
@ -620,7 +662,10 @@ Colorization
is silently disabled if the output is not directed to a terminal
unless the
.Ev CLICOLOR_FORCE
variable is defined.
variable is defined or
.Fl -color
is set to
.Dq always .
.It Ev CLICOLOR_FORCE
Color sequences are normally disabled if the output is not directed to
a terminal.

View File

@ -55,11 +55,13 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <fts.h>
#include <getopt.h>
#include <grp.h>
#include <inttypes.h>
#include <limits.h>
#include <locale.h>
#include <pwd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -98,6 +100,16 @@ static void display(const FTSENT *, FTSENT *, int);
static int mastercmp(const FTSENT * const *, const FTSENT * const *);
static void traverse(int, char **, int);
#define COLOR_OPT (CHAR_MAX + 1)
static const struct option long_opts[] =
{
#ifdef COLORLS
{"color", optional_argument, NULL, COLOR_OPT},
#endif
{NULL, no_argument, NULL, 0}
};
static void (*printfcn)(const DISPLAY *);
static int (*sortfcn)(const FTSENT *, const FTSENT *);
@ -139,10 +151,10 @@ static int f_stream; /* stream the output, separate with commas */
static int f_timesort; /* sort by time vice name */
int f_type; /* add type character for non-regular files */
static int f_whiteout; /* show whiteout entries */
#ifdef COLORLS
int colorflag = COLORFLAG_AUTO; /* passed in colorflag */
int f_color; /* add type in color for non-regular files */
bool explicitansi; /* Explicit ANSI sequences, no termcap(5) */
char *ansi_bgcol; /* ANSI sequence to set background colour */
char *ansi_fgcol; /* ANSI sequence to set foreground colour */
char *ansi_coloff; /* ANSI sequence to reset colours */
@ -152,6 +164,42 @@ char *enter_bold; /* ANSI sequence to set color to bold mode */
static int rval;
static bool
do_color_from_env(void)
{
const char *p;
bool doit;
doit = false;
p = getenv("CLICOLOR");
if (p == NULL) {
/*
* COLORTERM is the more standard name for this variable. We'll
* honor it as long as it's both set and not empty.
*/
p = getenv("COLORTERM");
if (p != NULL && *p != '\0')
doit = true;
} else
doit = true;
return (doit &&
(isatty(STDOUT_FILENO) || getenv("CLICOLOR_FORCE")));
}
static bool
do_color(void)
{
#ifdef COLORLS
if (colorflag == COLORFLAG_NEVER)
return (false);
else if (colorflag == COLORFLAG_ALWAYS)
return (true);
#endif
return (do_color_from_env());
}
int
main(int argc, char *argv[])
{
@ -163,7 +211,7 @@ main(int argc, char *argv[])
#ifdef COLORLS
char termcapbuf[1024]; /* termcap definition buffer */
char tcapbuf[512]; /* capability buffer */
char *bp = tcapbuf;
char *bp = tcapbuf, *term;
#endif
(void)setlocale(LC_ALL, "");
@ -191,8 +239,9 @@ main(int argc, char *argv[])
fts_options = FTS_PHYSICAL;
if (getenv("LS_SAMESORT"))
f_samesort = 1;
while ((ch = getopt(argc, argv,
"1ABCD:FGHILPRSTUWXZabcdfghiklmnopqrstuwxy,")) != -1) {
while ((ch = getopt_long(argc, argv,
"+1ABCD:FGHILPRSTUWXZabcdfghiklmnopqrstuwxy,", long_opts,
NULL)) != -1) {
switch (ch) {
/*
* The -1, -C, -x and -l options all override each other so
@ -355,6 +404,19 @@ main(int argc, char *argv[])
case 'y':
f_samesort = 1;
break;
#ifdef COLORLS
case COLOR_OPT:
if (optarg == NULL || strcmp(optarg, "always") == 0)
colorflag = COLORFLAG_ALWAYS;
else if (strcmp(optarg, "auto") == 0)
colorflag = COLORFLAG_AUTO;
else if (strcmp(optarg, "never") == 0)
colorflag = COLORFLAG_NEVER;
else
errx(2, "unsupported --color value '%s' (must be always, auto, or never)",
optarg);
break;
#endif
default:
case '?':
usage();
@ -367,11 +429,14 @@ main(int argc, char *argv[])
if (!f_listdot && getuid() == (uid_t)0 && !f_noautodot)
f_listdot = 1;
/* Enabling of colours is conditional on the environment. */
if ((getenv("CLICOLOR") || getenv("COLORTERM")) &&
(isatty(STDOUT_FILENO) || getenv("CLICOLOR_FORCE")))
/*
* Enabling of colours is conditional on the environment in conjunction
* with the --color and -G arguments, if supplied.
*/
if (do_color()) {
#ifdef COLORLS
if (tgetent(termcapbuf, getenv("TERM")) == 1) {
if ((term = getenv("TERM")) != NULL &&
tgetent(termcapbuf, term) == 1) {
ansi_fgcol = tgetstr("AF", &bp);
ansi_bgcol = tgetstr("AB", &bp);
attrs_off = tgetstr("me", &bp);
@ -385,10 +450,19 @@ main(int argc, char *argv[])
ansi_coloff = tgetstr("oc", &bp);
if (ansi_fgcol && ansi_bgcol && ansi_coloff)
f_color = 1;
} else if (colorflag == COLORFLAG_ALWAYS) {
/*
* If we're *always* doing color but we don't have
* a functional TERM supplied, we'll fallback to
* outputting raw ANSI sequences.
*/
f_color = 1;
explicitansi = true;
}
#else
warnx("color support not compiled in");
#endif /*COLORLS*/
}
#ifdef COLORLS
if (f_color) {

View File

@ -73,6 +73,8 @@ static void printtime(time_t);
static int printtype(u_int);
static void printsize(size_t, off_t);
#ifdef COLORLS
static void endcolor_termcap(int);
static void endcolor_ansi(void);
static void endcolor(int);
static int colortype(mode_t);
#endif
@ -540,7 +542,7 @@ writech(int c)
}
static void
printcolor(Colors c)
printcolor_termcap(Colors c)
{
char *ansiseq;
@ -560,12 +562,55 @@ printcolor(Colors c)
}
static void
endcolor(int sig)
printcolor_ansi(Colors c)
{
printf("\033[");
if (colors[c].bold)
printf("1");
if (colors[c].num[0] != -1)
printf(";3%d", colors[c].num[0]);
if (colors[c].num[1] != -1)
printf(";4%d", colors[c].num[1]);
printf("m");
}
static void
printcolor(Colors c)
{
if (explicitansi)
printcolor_ansi(c);
else
printcolor_termcap(c);
}
static void
endcolor_termcap(int sig)
{
tputs(ansi_coloff, 1, sig ? writech : putch);
tputs(attrs_off, 1, sig ? writech : putch);
}
static void
endcolor_ansi(void)
{
printf("\33[m");
}
static void
endcolor(int sig)
{
if (explicitansi)
endcolor_ansi();
else
endcolor_termcap(sig);
}
static int
colortype(mode_t mode)
{

View File

@ -227,7 +227,7 @@ usage(void)
{
(void)fprintf(stderr,
#ifdef COLORLS
"usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwxy1,] [-D format]"
"usage: ls [-ABCFGHILPRSTUWZabcdfghiklmnopqrstuwxy1,] [--color=when] [-D format]"
#else
"usage: ls [-ABCFHILPRSTUWZabcdfghiklmnopqrstuwxy1,] [-D format]"
#endif

View File

@ -3,6 +3,7 @@
.include <src.opts.mk>
CONFS= profile
PACKAGE=runtime
PROG= sh
INSTALLFLAGS= -S

View File

@ -1,4 +1,3 @@
'\" te
.\" CDDL HEADER START
.\"
.\" The contents of this file are subject to the terms of the
@ -21,7 +20,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd April 18, 2015
.Dd August 16, 2018
.Dt DTRACE 1
.Os
.Sh NAME
@ -523,6 +522,116 @@ Enable or modify a DTrace runtime option or D compiler option.
Boolean options are enabled by specifying their name.
Options with values are set by separating the option name and value with an
equals sign (=).
.Pp
A
.Ar size
argument may be suffixed with one of
.Cm K ,
.Cm M ,
.Cm G
or
.Cm T
(either upper or lower case) to indicate a multiple of
Kilobytes, Megabytes, Gigabytes or Terabytes
respectively.
.Pp
A
.Ar time
argument may be suffixed with one of
.Cm ns ,
.Cm nsec ,
.Cm us ,
.Cm usec ,
.Cm ms ,
.Cm msec ,
.Cm s ,
.Cm sec ,
.Cm m ,
.Cm min ,
.Cm h ,
.Cm hour ,
.Cm d ,
.Cm day ,
.Cm hz .
If no suffix is specified
.Cm hz
will be used as the unit.
.Bl -tag -width indent
.It Sy aggrate Ns = Ns Ar time
Rate of aggregation reading.
.It Sy aggsize Ns = Ns Ar size
Size of the aggregation buffer.
.It Sy bufpolicy Ns = Ns Cm fill Ns | Ns Cm switch Ns | Ns Cm ring
Specifies the buffer policy for the principal buffer.
.It Sy bufresize Ns = Ns Cm auto Ns | Ns Cm manual
Buffer resizing policy.
.It Sy bufsize Ns = Ns Ar size
Size of the per-CPU principal buffer.
Same as the
.Fl b
flag.
.It Sy cleanrate Ns = Ns Ar time
Cleaning rate.
Must be specified in number-per-second with the
.Dq Li hz
suffix.
.It Sy cpu Ns = Ns Ar scalar
Specifies the CPU on which to enable tracing.
.It Sy defaultargs
Allow references to unspecified macro arguments.
.It Sy destructive
Allow destructive actions.
Same as the
.Fl w
flag.
.It Sy dynvarsize Ns = Ns Ar size
Size of the dynamic variable space.
.It Sy flowindent
Turn on flow indentation.
Same as the
.Fl F
flag.
.It Sy grabanon
Claim anonymous state.
Same as the
.Fl a
flag.
.It Sy jstackframes Ns = Ns Ar scalar
Number of default stack frames for
.Fn jstack .
.It Sy jstackstrsize Ns = Ns Ar scalar
Default string space size for
.Fn jstack .
.It Sy nspec Ns = Ns Ar scalar
Number of speculations.
.It Sy quiet
Set quiet mode.
Same as the
.Fl q
flag.
.It Sy specsize Ns = Ns Ar size
Size of the speculation buffer.
.It Sy strsize Ns = Ns Ar size
Maximum size of strings.
.It Sy stackframes Ns = Ns Ar scalar
Maximum number of kernelspace stack frames to unwind when executing the
.Fn stack
action.
.It Sy stackindent Ns = Ns Ar scalar
Number of whitespace characters to use when indenting
.Fn stack
and
.Fn ustack
output.
.It Sy statusrate Ns = Ns Ar time
Rate of status checking.
.It Sy switchrate Ns = Ns Ar time
Rate of buffer switching.
.It Sy ustackframes Ns = Ns Ar scalar
Maximum number of userspace stack frames to unwind when executing the
.Fn ustack
action.
.El
.It Fl X Cm a | c | s | t
Specify the degree of conformance to the ISO C standard that should be selected
when invoking

View File

@ -2096,7 +2096,7 @@ dump_object(objset_t *os, uint64_t object, int verbosity, int *print_header)
dnode_t *dn;
void *bonus = NULL;
size_t bsize = 0;
char iblk[32], dblk[32], lsize[32], asize[32], fill[32];
char iblk[32], dblk[32], lsize[32], asize[32], fill[32], dnsize[32];
char bonus_size[32];
char aux[50];
int error;
@ -2109,9 +2109,9 @@ dump_object(objset_t *os, uint64_t object, int verbosity, int *print_header)
CTASSERT(sizeof (bonus_size) >= NN_NUMBUF_SZ);
if (*print_header) {
(void) printf("\n%10s %3s %5s %5s %5s %5s %6s %s\n",
"Object", "lvl", "iblk", "dblk", "dsize", "lsize",
"%full", "type");
(void) printf("\n%10s %3s %5s %5s %5s %6s %5s %6s %s\n",
"Object", "lvl", "iblk", "dblk", "dsize", "dnsize",
"lsize", "%full", "type");
*print_header = 0;
}
@ -2133,6 +2133,7 @@ dump_object(objset_t *os, uint64_t object, int verbosity, int *print_header)
zdb_nicenum(doi.doi_max_offset, lsize, sizeof (lsize));
zdb_nicenum(doi.doi_physical_blocks_512 << 9, asize, sizeof (asize));
zdb_nicenum(doi.doi_bonus_size, bonus_size, sizeof (bonus_size));
zdb_nicenum(doi.doi_dnodesize, dnsize, sizeof (dnsize));
(void) sprintf(fill, "%6.2f", 100.0 * doi.doi_fill_count *
doi.doi_data_block_size / (object == 0 ? DNODES_PER_BLOCK : 1) /
doi.doi_max_offset);
@ -2149,13 +2150,13 @@ dump_object(objset_t *os, uint64_t object, int verbosity, int *print_header)
ZDB_COMPRESS_NAME(doi.doi_compress));
}
(void) printf("%10lld %3u %5s %5s %5s %5s %6s %s%s\n",
(void) printf("%10lld %3u %5s %5s %5s %6s %5s %6s %s%s\n",
(u_longlong_t)object, doi.doi_indirection, iblk, dblk,
asize, lsize, fill, ZDB_OT_NAME(doi.doi_type), aux);
asize, dnsize, lsize, fill, ZDB_OT_NAME(doi.doi_type), aux);
if (doi.doi_bonus_type != DMU_OT_NONE && verbosity > 3) {
(void) printf("%10s %3s %5s %5s %5s %5s %6s %s\n",
"", "", "", "", "", bonus_size, "bonus",
(void) printf("%10s %3s %5s %5s %5s %5s %5s %6s %s\n",
"", "", "", "", "", "", bonus_size, "bonus",
ZDB_OT_NAME(doi.doi_bonus_type));
}

View File

@ -84,8 +84,10 @@ zil_prt_rec_create(zilog_t *zilog, int txtype, void *arg)
}
(void) printf("%s%s", tab_prefix, ctime(&crtime));
(void) printf("%sdoid %llu, foid %llu, mode %llo\n", tab_prefix,
(u_longlong_t)lr->lr_doid, (u_longlong_t)lr->lr_foid,
(void) printf("%sdoid %llu, foid %llu, slots %llu, mode %llo\n", tab_prefix,
(u_longlong_t)lr->lr_doid,
(u_longlong_t)LR_FOID_GET_OBJ(lr->lr_foid),
(u_longlong_t)LR_FOID_GET_SLOTS(lr->lr_foid),
(longlong_t)lr->lr_mode);
(void) printf("%suid %llu, gid %llu, gen %llu, rdev 0x%llx\n",
tab_prefix,

View File

@ -32,7 +32,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd December 6, 2017
.Dd August 11, 2018
.Dt ZFS 8
.Os
.Sh NAME
@ -462,8 +462,11 @@ responsible for mounting and unmounting the file system.
dataset can be attached to a jail by using the
.Qq Nm Cm jail
subcommand. You cannot attach a dataset to one jail and the children of the
same dataset to another jails. To allow management of the dataset from within
a jail, the
same dataset to another jail. You can also not attach the root file system
of the jail or any dataset which needs to be mounted before the zfs rc script
is run inside the jail, as it would be attached unmounted until it is
mounted from the rc script inside the jail. To allow management of the
dataset from within a jail, the
.Sy jailed
property has to be set and the jail needs access to the
.Pa /dev/zfs

View File

@ -226,6 +226,7 @@ typedef struct ztest_block_tag {
uint64_t bt_magic;
uint64_t bt_objset;
uint64_t bt_object;
uint64_t bt_dnodesize;
uint64_t bt_offset;
uint64_t bt_gen;
uint64_t bt_txg;
@ -274,6 +275,7 @@ typedef struct ztest_od {
dmu_object_type_t od_crtype;
uint64_t od_blocksize;
uint64_t od_crblocksize;
uint64_t od_crdnodesize;
uint64_t od_gen;
uint64_t od_crgen;
char od_name[ZFS_MAX_DATASET_NAME_LEN];
@ -350,6 +352,7 @@ ztest_func_t ztest_device_removal;
ztest_func_t ztest_remap_blocks;
ztest_func_t ztest_spa_checkpoint_create_discard;
ztest_func_t ztest_initialize;
ztest_func_t ztest_verify_dnode_bt;
uint64_t zopt_always = 0ULL * NANOSEC; /* all the time */
uint64_t zopt_incessant = 1ULL * NANOSEC / 10; /* every 1/10 second */
@ -394,7 +397,8 @@ ztest_info_t ztest_info[] = {
{ ztest_device_removal, 1, &zopt_sometimes },
{ ztest_remap_blocks, 1, &zopt_sometimes },
{ ztest_spa_checkpoint_create_discard, 1, &zopt_rarely },
{ ztest_initialize, 1, &zopt_sometimes }
{ ztest_initialize, 1, &zopt_sometimes },
{ ztest_verify_dnode_bt, 1, &zopt_sometimes }
};
#define ZTEST_FUNCS (sizeof (ztest_info) / sizeof (ztest_info_t))
@ -440,8 +444,8 @@ static spa_t *ztest_spa = NULL;
static ztest_ds_t *ztest_ds;
static kmutex_t ztest_vdev_lock;
static kmutex_t ztest_checkpoint_lock;
static boolean_t ztest_device_removal_active = B_FALSE;
static kmutex_t ztest_checkpoint_lock;
/*
* The ztest_name_lock protects the pool and dataset namespace used by
@ -1010,6 +1014,36 @@ ztest_random_blocksize(void)
return (1 << (SPA_MINBLOCKSHIFT + block_shift));
}
static int
ztest_random_dnodesize(void)
{
int slots;
int max_slots = spa_maxdnodesize(ztest_spa) >> DNODE_SHIFT;
if (max_slots == DNODE_MIN_SLOTS)
return (DNODE_MIN_SIZE);
/*
* Weight the random distribution more heavily toward smaller
* dnode sizes since that is more likely to reflect real-world
* usage.
*/
ASSERT3U(max_slots, >, 4);
switch (ztest_random(10)) {
case 0:
slots = 5 + ztest_random(max_slots - 4);
break;
case 1 ... 4:
slots = 2 + ztest_random(3);
break;
default:
slots = 1;
break;
}
return (slots << DNODE_SHIFT);
}
static int
ztest_random_ibshift(void)
{
@ -1287,11 +1321,13 @@ ztest_pattern_match(void *buf, uint64_t size, uint64_t value)
static void
ztest_bt_generate(ztest_block_tag_t *bt, objset_t *os, uint64_t object,
uint64_t offset, uint64_t gen, uint64_t txg, uint64_t crtxg)
uint64_t dnodesize, uint64_t offset, uint64_t gen, uint64_t txg,
uint64_t crtxg)
{
bt->bt_magic = BT_MAGIC;
bt->bt_objset = dmu_objset_id(os);
bt->bt_object = object;
bt->bt_dnodesize = dnodesize;
bt->bt_offset = offset;
bt->bt_gen = gen;
bt->bt_txg = txg;
@ -1300,11 +1336,13 @@ ztest_bt_generate(ztest_block_tag_t *bt, objset_t *os, uint64_t object,
static void
ztest_bt_verify(ztest_block_tag_t *bt, objset_t *os, uint64_t object,
uint64_t offset, uint64_t gen, uint64_t txg, uint64_t crtxg)
uint64_t dnodesize, uint64_t offset, uint64_t gen, uint64_t txg,
uint64_t crtxg)
{
ASSERT3U(bt->bt_magic, ==, BT_MAGIC);
ASSERT3U(bt->bt_objset, ==, dmu_objset_id(os));
ASSERT3U(bt->bt_object, ==, object);
ASSERT3U(bt->bt_dnodesize, ==, dnodesize);
ASSERT3U(bt->bt_offset, ==, offset);
ASSERT3U(bt->bt_gen, <=, gen);
ASSERT3U(bt->bt_txg, <=, txg);
@ -1325,6 +1363,52 @@ ztest_bt_bonus(dmu_buf_t *db)
return (bt);
}
/*
* Generate a token to fill up unused bonus buffer space. Try to make
* it unique to the object, generation, and offset to verify that data
* is not getting overwritten by data from other dnodes.
*/
#define ZTEST_BONUS_FILL_TOKEN(obj, ds, gen, offset) \
(((ds) << 48) | ((gen) << 32) | ((obj) << 8) | (offset))
/*
* Fill up the unused bonus buffer region before the block tag with a
* verifiable pattern. Filling the whole bonus area with non-zero data
* helps ensure that all dnode traversal code properly skips the
* interior regions of large dnodes.
*/
void
ztest_fill_unused_bonus(dmu_buf_t *db, void *end, uint64_t obj,
objset_t *os, uint64_t gen)
{
uint64_t *bonusp;
ASSERT(IS_P2ALIGNED((char *)end - (char *)db->db_data, 8));
for (bonusp = db->db_data; bonusp < (uint64_t *)end; bonusp++) {
uint64_t token = ZTEST_BONUS_FILL_TOKEN(obj, dmu_objset_id(os),
gen, bonusp - (uint64_t *)db->db_data);
*bonusp = token;
}
}
/*
* Verify that the unused area of a bonus buffer is filled with the
* expected tokens.
*/
void
ztest_verify_unused_bonus(dmu_buf_t *db, void *end, uint64_t obj,
objset_t *os, uint64_t gen)
{
uint64_t *bonusp;
for (bonusp = db->db_data; bonusp < (uint64_t *)end; bonusp++) {
uint64_t token = ZTEST_BONUS_FILL_TOKEN(obj, dmu_objset_id(os),
gen, bonusp - (uint64_t *)db->db_data);
VERIFY3U(*bonusp, ==, token);
}
}
/*
* ZIL logging ops
*/
@ -1333,7 +1417,7 @@ ztest_bt_bonus(dmu_buf_t *db)
#define lrz_blocksize lr_uid
#define lrz_ibshift lr_gid
#define lrz_bonustype lr_rdev
#define lrz_bonuslen lr_crtime[1]
#define lrz_dnodesize lr_crtime[1]
static void
ztest_log_create(ztest_ds_t *zd, dmu_tx_t *tx, lr_create_t *lr)
@ -1449,6 +1533,7 @@ ztest_replay_create(void *arg1, void *arg2, boolean_t byteswap)
dmu_tx_t *tx;
uint64_t txg;
int error = 0;
int bonuslen;
if (byteswap)
byteswap_uint64_array(lr, sizeof (*lr));
@ -1471,26 +1556,27 @@ ztest_replay_create(void *arg1, void *arg2, boolean_t byteswap)
return (ENOSPC);
ASSERT(dmu_objset_zil(os)->zl_replay == !!lr->lr_foid);
bonuslen = DN_BONUS_SIZE(lr->lrz_dnodesize);
if (lr->lrz_type == DMU_OT_ZAP_OTHER) {
if (lr->lr_foid == 0) {
lr->lr_foid = zap_create(os,
lr->lr_foid = zap_create_dnsize(os,
lr->lrz_type, lr->lrz_bonustype,
lr->lrz_bonuslen, tx);
bonuslen, lr->lrz_dnodesize, tx);
} else {
error = zap_create_claim(os, lr->lr_foid,
error = zap_create_claim_dnsize(os, lr->lr_foid,
lr->lrz_type, lr->lrz_bonustype,
lr->lrz_bonuslen, tx);
bonuslen, lr->lrz_dnodesize, tx);
}
} else {
if (lr->lr_foid == 0) {
lr->lr_foid = dmu_object_alloc(os,
lr->lr_foid = dmu_object_alloc_dnsize(os,
lr->lrz_type, 0, lr->lrz_bonustype,
lr->lrz_bonuslen, tx);
bonuslen, lr->lrz_dnodesize, tx);
} else {
error = dmu_object_claim(os, lr->lr_foid,
error = dmu_object_claim_dnsize(os, lr->lr_foid,
lr->lrz_type, 0, lr->lrz_bonustype,
lr->lrz_bonuslen, tx);
bonuslen, lr->lrz_dnodesize, tx);
}
}
@ -1510,7 +1596,9 @@ ztest_replay_create(void *arg1, void *arg2, boolean_t byteswap)
VERIFY3U(0, ==, dmu_bonus_hold(os, lr->lr_foid, FTAG, &db));
bbt = ztest_bt_bonus(db);
dmu_buf_will_dirty(db, tx);
ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_gen, txg, txg);
ztest_bt_generate(bbt, os, lr->lr_foid, lr->lrz_dnodesize, -1ULL,
lr->lr_gen, txg, txg);
ztest_fill_unused_bonus(db, bbt, lr->lr_foid, os, lr->lr_gen);
dmu_buf_rele(db, FTAG);
VERIFY3U(0, ==, zap_add(os, lr->lr_doid, name, sizeof (uint64_t), 1,
@ -1660,7 +1748,7 @@ ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap)
VERIFY(dmu_read(os, lr->lr_foid, offset,
sizeof (rbt), &rbt, prefetch) == 0);
if (rbt.bt_magic == BT_MAGIC) {
ztest_bt_verify(&rbt, os, lr->lr_foid,
ztest_bt_verify(&rbt, os, lr->lr_foid, 0,
offset, gen, txg, crtxg);
}
}
@ -1672,7 +1760,7 @@ ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap)
* as it was when the write was generated.
*/
if (zd->zd_zilog->zl_replay) {
ztest_bt_verify(bt, os, lr->lr_foid, offset,
ztest_bt_verify(bt, os, lr->lr_foid, 0, offset,
MAX(gen, bt->bt_gen), MAX(txg, lrtxg),
bt->bt_crtxg);
}
@ -1681,7 +1769,8 @@ ztest_replay_write(void *arg1, void *arg2, boolean_t byteswap)
* Set the bt's gen/txg to the bonus buffer's gen/txg
* so that all of the usual ASSERTs will work.
*/
ztest_bt_generate(bt, os, lr->lr_foid, offset, gen, txg, crtxg);
ztest_bt_generate(bt, os, lr->lr_foid, 0, offset, gen, txg,
crtxg);
}
if (abuf == NULL) {
@ -1753,7 +1842,7 @@ ztest_replay_setattr(void *arg1, void *arg2, boolean_t byteswap)
dmu_tx_t *tx;
dmu_buf_t *db;
ztest_block_tag_t *bbt;
uint64_t txg, lrtxg, crtxg;
uint64_t txg, lrtxg, crtxg, dnodesize;
if (byteswap)
byteswap_uint64_array(lr, sizeof (*lr));
@ -1776,6 +1865,7 @@ ztest_replay_setattr(void *arg1, void *arg2, boolean_t byteswap)
ASSERT3U(bbt->bt_magic, ==, BT_MAGIC);
crtxg = bbt->bt_crtxg;
lrtxg = lr->lr_common.lrc_txg;
dnodesize = bbt->bt_dnodesize;
if (zd->zd_zilog->zl_replay) {
ASSERT(lr->lr_size != 0);
@ -1794,7 +1884,7 @@ ztest_replay_setattr(void *arg1, void *arg2, boolean_t byteswap)
/*
* Verify that the current bonus buffer is not newer than our txg.
*/
ztest_bt_verify(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode,
ztest_bt_verify(bbt, os, lr->lr_foid, dnodesize, -1ULL, lr->lr_mode,
MAX(txg, lrtxg), crtxg);
dmu_buf_will_dirty(db, tx);
@ -1804,8 +1894,9 @@ ztest_replay_setattr(void *arg1, void *arg2, boolean_t byteswap)
VERIFY0(dmu_set_bonus(db, lr->lr_size, tx));
bbt = ztest_bt_bonus(db);
ztest_bt_generate(bbt, os, lr->lr_foid, -1ULL, lr->lr_mode, txg, crtxg);
ztest_bt_generate(bbt, os, lr->lr_foid, dnodesize, -1ULL, lr->lr_mode,
txg, crtxg);
ztest_fill_unused_bonus(db, bbt, lr->lr_foid, os, bbt->bt_gen);
dmu_buf_rele(db, FTAG);
(void) ztest_log_setattr(zd, tx, lr);
@ -2037,7 +2128,7 @@ ztest_create(ztest_ds_t *zd, ztest_od_t *od, int count)
lr->lrz_blocksize = od->od_crblocksize;
lr->lrz_ibshift = ztest_random_ibshift();
lr->lrz_bonustype = DMU_OT_UINT64_OTHER;
lr->lrz_bonuslen = dmu_bonus_max();
lr->lrz_dnodesize = od->od_crdnodesize;
lr->lr_gen = od->od_crgen;
lr->lr_crtime[0] = time(NULL);
@ -2216,7 +2307,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t offset)
switch (io_type) {
case ZTEST_IO_WRITE_TAG:
ztest_bt_generate(&wbt, zd->zd_os, object, offset, 0, 0, 0);
ztest_bt_generate(&wbt, zd->zd_os, object, doi.doi_dnodesize,
offset, 0, 0, 0);
(void) ztest_write(zd, object, offset, sizeof (wbt), &wbt);
break;
@ -2277,13 +2369,15 @@ ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t offset)
*/
static void
ztest_od_init(ztest_od_t *od, uint64_t id, char *tag, uint64_t index,
dmu_object_type_t type, uint64_t blocksize, uint64_t gen)
dmu_object_type_t type, uint64_t blocksize, uint64_t dnodesize,
uint64_t gen)
{
od->od_dir = ZTEST_DIROBJ;
od->od_object = 0;
od->od_crtype = type;
od->od_crblocksize = blocksize ? blocksize : ztest_random_blocksize();
od->od_crdnodesize = dnodesize ? dnodesize : ztest_random_dnodesize();
od->od_crgen = gen;
od->od_type = DMU_OT_NONE;
@ -3726,7 +3820,7 @@ ztest_dmu_object_alloc_free(ztest_ds_t *zd, uint64_t id)
int batchsize = sizeof (od) / sizeof (od[0]);
for (int b = 0; b < batchsize; b++)
ztest_od_init(&od[b], id, FTAG, b, DMU_OT_UINT64_OTHER, 0, 0);
ztest_od_init(&od[b], id, FTAG, b, DMU_OT_UINT64_OTHER, 0, 0, 0);
/*
* Destroy the previous batch of objects, create a new batch,
@ -3786,8 +3880,8 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id)
/*
* Read the directory info. If it's the first time, set things up.
*/
ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, 0, chunksize);
ztest_od_init(&od[1], id, FTAG, 1, DMU_OT_UINT64_OTHER, 0, chunksize);
ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0, chunksize);
ztest_od_init(&od[1], id, FTAG, 1, DMU_OT_UINT64_OTHER, 0, 0, chunksize);
if (ztest_object_init(zd, od, sizeof (od), B_FALSE) != 0)
return;
@ -4056,8 +4150,8 @@ ztest_dmu_read_write_zcopy(ztest_ds_t *zd, uint64_t id)
/*
* Read the directory info. If it's the first time, set things up.
*/
ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, blocksize, 0);
ztest_od_init(&od[1], id, FTAG, 1, DMU_OT_UINT64_OTHER, 0, chunksize);
ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, blocksize, 0, 0);
ztest_od_init(&od[1], id, FTAG, 1, DMU_OT_UINT64_OTHER, 0, 0, chunksize);
if (ztest_object_init(zd, od, sizeof (od), B_FALSE) != 0)
return;
@ -4257,7 +4351,7 @@ ztest_dmu_write_parallel(ztest_ds_t *zd, uint64_t id)
* to verify that parallel writes to an object -- even to the
* same blocks within the object -- doesn't cause any trouble.
*/
ztest_od_init(&od[0], ID_PARALLEL, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0);
ztest_od_init(&od[0], ID_PARALLEL, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0, 0);
if (ztest_object_init(zd, od, sizeof (od), B_FALSE) != 0)
return;
@ -4276,7 +4370,7 @@ ztest_dmu_prealloc(ztest_ds_t *zd, uint64_t id)
uint64_t blocksize = ztest_random_blocksize();
void *data;
ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, blocksize, 0);
ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, blocksize, 0, 0);
if (ztest_object_init(zd, od, sizeof (od), !ztest_random(2)) != 0)
return;
@ -4322,7 +4416,7 @@ ztest_zap(ztest_ds_t *zd, uint64_t id)
int error;
char *hc[2] = { "s.acl.h", ".s.open.h.hyLZlg" };
ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_ZAP_OTHER, 0, 0);
ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_ZAP_OTHER, 0, 0, 0);
if (ztest_object_init(zd, od, sizeof (od), !ztest_random(2)) != 0)
return;
@ -4454,7 +4548,7 @@ ztest_fzap(ztest_ds_t *zd, uint64_t id)
ztest_od_t od[1];
uint64_t object, txg;
ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_ZAP_OTHER, 0, 0);
ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_ZAP_OTHER, 0, 0, 0);
if (ztest_object_init(zd, od, sizeof (od), !ztest_random(2)) != 0)
return;
@ -4500,7 +4594,7 @@ ztest_zap_parallel(ztest_ds_t *zd, uint64_t id)
char name[20], string_value[20];
void *data;
ztest_od_init(&od[0], ID_PARALLEL, FTAG, micro, DMU_OT_ZAP_OTHER, 0, 0);
ztest_od_init(&od[0], ID_PARALLEL, FTAG, micro, DMU_OT_ZAP_OTHER, 0, 0, 0);
if (ztest_object_init(zd, od, sizeof (od), B_FALSE) != 0)
return;
@ -4688,7 +4782,7 @@ ztest_dmu_commit_callbacks(ztest_ds_t *zd, uint64_t id)
uint64_t old_txg, txg;
int i, error;
ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0);
ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0, 0);
if (ztest_object_init(zd, od, sizeof (od), B_FALSE) != 0)
return;
@ -4802,6 +4896,41 @@ ztest_dmu_commit_callbacks(ztest_ds_t *zd, uint64_t id)
dmu_tx_commit(tx);
}
/*
* Visit each object in the dataset. Verify that its properties
* are consistent what was stored in the block tag when it was created,
* and that its unused bonus buffer space has not been overwritten.
*/
void
ztest_verify_dnode_bt(ztest_ds_t *zd, uint64_t id)
{
objset_t *os = zd->zd_os;
uint64_t obj;
int err = 0;
for (obj = 0; err == 0; err = dmu_object_next(os, &obj, FALSE, 0)) {
ztest_block_tag_t *bt = NULL;
dmu_object_info_t doi;
dmu_buf_t *db;
if (dmu_bonus_hold(os, obj, FTAG, &db) != 0)
continue;
dmu_object_info_from_db(db, &doi);
if (doi.doi_bonus_size >= sizeof (*bt))
bt = ztest_bt_bonus(db);
if (bt && bt->bt_magic == BT_MAGIC) {
ztest_bt_verify(bt, os, obj, doi.doi_dnodesize,
bt->bt_offset, bt->bt_gen, bt->bt_txg,
bt->bt_crtxg);
ztest_verify_unused_bonus(db, bt, obj, os, bt->bt_gen);
}
dmu_buf_rele(db, FTAG);
}
}
/* ARGSUSED */
void
ztest_dsl_prop_get_set(ztest_ds_t *zd, uint64_t id)
@ -5286,7 +5415,7 @@ ztest_ddt_repair(ztest_ds_t *zd, uint64_t id)
blocksize = ztest_random_blocksize();
blocksize = MIN(blocksize, 2048); /* because we write so many */
ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, blocksize, 0);
ztest_od_init(&od[0], id, FTAG, 0, DMU_OT_UINT64_OTHER, blocksize, 0, 0);
if (ztest_object_init(zd, od, sizeof (od), B_FALSE) != 0)
return;
@ -6212,7 +6341,7 @@ ztest_freeze(void)
numloops++ < ztest_opts.zo_maxloops &&
metaslab_class_get_alloc(spa_normal_class(spa)) < capacity) {
ztest_od_t od;
ztest_od_init(&od, 0, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0);
ztest_od_init(&od, 0, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0, 0);
VERIFY0(ztest_object_init(zd, &od, sizeof (od), B_FALSE));
ztest_io(zd, od.od_object,
ztest_random(ZTEST_RANGE_LOCKS) << SPA_MAXBLOCKSHIFT);

View File

@ -5,6 +5,7 @@
LIB= nvpair
INCS= libnvpair.h
SRCS= libnvpair.c \
nvpair_alloc_system.c \
nvpair_json.c \

View File

@ -9,6 +9,7 @@
LIB= zfs_core
LIBADD= nvpair
INCS= libzfs_core.h
SRCS= libzfs_core.c \
libzfs_core_compat.c \
zfs_ioctl_compat.c

View File

@ -23,6 +23,9 @@ CSTD= c99
# Since there are many asserts in this program, it makes no sense to compile
# it without debugging.
CFLAGS+= -g -DDEBUG=1
CFLAGS+= -g -DDEBUG=1 -Wno-format
HAS_TESTS=
SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>

View File

@ -0,0 +1,7 @@
# $FreeBSD$
.include <bsd.own.mk>
ATF_TESTS_SH+= ztest
.include <bsd.test.mk>

View File

@ -0,0 +1,52 @@
#
# Test Case: ztest
# $FreeBSD$
#
atf_test_case ztest
ztest_head()
{
atf_set "descr" "Run ztest"
atf_set "timeout" 900
atf_set "require.config" "rt_long"
}
ztest_body()
{
ARGS="-VVVVV -f ${TMPDIR:-/tmp}"
if atf_config_has ztest_extra_args; then
ARGS="${ARGS} $(atf_config_get ztest_extra_args)"
fi
ztest ${ARGS}
if [ $? != 0 ]; then
echo "failing"
save_ztest_artifacts
atf_fail "Testcase failed"
else
echo "passing"
atf_pass
fi
}
#
# ATF Test Program Init Function
#
atf_init_test_cases()
{
atf_add_test_case ztest
}
save_ztest_artifacts()
{
# If artifacts_dir is defined, save test artifacts for
# post-mortem analysis
if atf_config_has artifacts_dir; then
TC_ARTIFACTS_DIR=`atf_config_get artifacts_dir`/cddl/usr.bin/ztest/$(atf_get ident)
mkdir -p $TC_ARTIFACTS_DIR
TC_CORE_DIR=/var/crash
if atf_config_has core_dir; then
TC_CORE_DIR=`atf_config_get core_dir`
fi
mv *ztest*.core* $TC_ARTIFACTS_DIR || true
mv ${TC_CORE_DIR}/*ztest*.core* $TC_ARTIFACTS_DIR || true
fi
}

View File

@ -78,6 +78,8 @@ Local changes:
r1.5 mdoc(7)NG
r1.3 describe all of the command line options
r1.2 un-mandocafied, un4.4BSD'ed
hlfsd/hlfsd.8
- Fix a broken SEE ALSO section and some mdoc issues
mk-amd-map/mk-amd-map.8
r1.4 removed HISTORY info from the .Os call.
r1.2 un-mandocafied, un4.4BSD'ed

View File

@ -80,9 +80,7 @@ anywhere.
The
.Nm
utility
operates by mounting itself as an
.Tn NFS
server for the directory containing
operates by mounting itself as an NFS server for the directory containing
.Ar linkname ,
which defaults to
.Pa /hlfs/home .
@ -334,8 +332,8 @@ symbolic link returned by
points if it is unable to verify the that
user's home directory is accessible.
.El
.SH "SEE ALSO"
.Xr mail1 ,
.Sh "SEE ALSO"
.Xr mail 1 ,
.Xr getgrent 3 ,
.Xr getpwent 3 ,
.Xr mnttab 4 ,
@ -343,7 +341,7 @@ user's home directory is accessible.
.Xr mtab 5 ,
.Xr amd 8 ,
.Xr automount 8 ,
.Xr cron8 ,
.Xr cron 8 ,
.Xr mount 8 ,
.Xr sendmail 8 ,
.Xr umount 8

View File

@ -439,11 +439,15 @@ mibif_restart_mibII_poll_timer(void)
int
mib_fetch_ifmib(struct mibif *ifp)
{
static int kmib[2] = { -1, 0 }; /* for sysctl net.ifdescr_maxlen */
int name[6];
size_t kmiblen = nitems(kmib);
size_t len;
void *newmib;
struct ifmibdata oldmib = ifp->mib;
struct ifreq irr;
unsigned int alias_maxlen = MIBIF_ALIAS_SIZE_MAX;
if (fetch_generic_mib(ifp, &oldmib) == -1)
return (-1);
@ -515,18 +519,69 @@ mib_fetch_ifmib(struct mibif *ifp)
}
out:
/*
* Find sysctl mib for net.ifdescr_maxlen (one time).
* kmib[0] == -1 at first call to mib_fetch_ifmib().
* Then kmib[0] > 0 if we found sysctl mib for net.ifdescr_maxlen.
* Else, kmib[0] == 0 (unexpected error from a kernel).
*/
if (kmib[0] < 0 &&
sysctlnametomib("net.ifdescr_maxlen", kmib, &kmiblen) < 0) {
kmib[0] = 0;
syslog(LOG_WARNING, "sysctlnametomib net.ifdescr_maxlen: %m");
}
/*
* Fetch net.ifdescr_maxlen value every time to catch up with changes.
*/
len = sizeof(alias_maxlen);
if (kmib[0] > 0 && sysctl(kmib, 2, &alias_maxlen, &len, NULL, 0) < 0) {
/* unexpected error from the kernel, use default value */
alias_maxlen = MIBIF_ALIAS_SIZE_MAX;
syslog(LOG_WARNING, "sysctl net.ifdescr_maxlen: %m");
}
/*
* Kernel limit might be decreased after interfaces got
* their descriptions assigned. Try to obtain them anyway.
*/
if (alias_maxlen == 0)
alias_maxlen = MIBIF_ALIAS_SIZE_MAX;
/*
* Allocate maximum memory for a buffer and later reallocate
* to free extra memory.
*/
if ((ifp->alias = malloc(alias_maxlen)) == NULL) {
syslog(LOG_WARNING, "malloc(%d) failed: %m", (int)alias_maxlen);
goto fin;
}
strlcpy(irr.ifr_name, ifp->name, sizeof(irr.ifr_name));
irr.ifr_buffer.buffer = MIBIF_PRIV(ifp)->alias;
irr.ifr_buffer.length = sizeof(MIBIF_PRIV(ifp)->alias);
irr.ifr_buffer.buffer = ifp->alias;
irr.ifr_buffer.length = alias_maxlen;
if (ioctl(mib_netsock, SIOCGIFDESCR, &irr) == -1) {
MIBIF_PRIV(ifp)->alias[0] = 0;
free(ifp->alias);
ifp->alias = NULL;
if (errno != ENOMSG)
syslog(LOG_WARNING, "SIOCGIFDESCR (%s): %m", ifp->name);
} else if (irr.ifr_buffer.buffer == NULL) {
MIBIF_PRIV(ifp)->alias[0] = 0;
free(ifp->alias);
ifp->alias = NULL;
syslog(LOG_WARNING, "SIOCGIFDESCR (%s): too long (%zu)",
ifp->name, irr.ifr_buffer.length);
} else {
ifp->alias_size = strnlen(ifp->alias, alias_maxlen) + 1;
if (ifp->alias_size > MIBIF_ALIAS_SIZE)
ifp->alias_size = MIBIF_ALIAS_SIZE;
if (ifp->alias_size < alias_maxlen)
ifp->alias = realloc(ifp->alias, ifp->alias_size);
}
fin:
ifp->mibtick = get_ticks();
return (0);
}
@ -706,6 +761,10 @@ mibif_free(struct mibif *ifp)
mibif_reset_hc_timer();
}
if (ifp->alias != NULL) {
free(ifp->alias);
ifp->alias = NULL;
}
free(ifp->private);
ifp->private = NULL;
free(ifp->physaddr);

View File

@ -57,8 +57,9 @@
#include "snmp_mibII.h"
#include "mibII_tree.h"
/* maximum size of the interface alias */
/* maximum size of the interface alias unless overridden with net.ifdescr_maxlen */
#define MIBIF_ALIAS_SIZE (64 + 1)
#define MIBIF_ALIAS_SIZE_MAX 1024
/*
* Interface list and flags.
@ -81,8 +82,6 @@ struct mibif_private {
uint64_t hc_imcasts;
uint64_t hc_ipackets;
/* this should be made public */
char alias[MIBIF_ALIAS_SIZE];
};
#define MIBIF_PRIV(IFP) ((struct mibif_private *)((IFP)->private))

View File

@ -528,7 +528,7 @@ op_ifxtable(struct snmp_context *ctx, struct snmp_value *value,
break;
case LEAF_ifAlias:
ret = string_get(value, MIBIF_PRIV(ifp)->alias, -1);
ret = string_get(value, ifp->alias, ifp->alias_size - 1);
break;
case LEAF_ifCounterDiscontinuityTime:

View File

@ -80,6 +80,9 @@ struct mibif {
/* to be set by ifType specific modules. This is ifSpecific. */
struct asn_oid spec_oid;
char *alias;
size_t alias_size;
/* private data - don't touch */
void *private;
};

View File

@ -409,7 +409,8 @@ static int next_entry_seek(struct archive_read *, struct iso9660 *,
struct file_info **);
static struct file_info *
parse_file_info(struct archive_read *a,
struct file_info *parent, const unsigned char *isodirrec);
struct file_info *parent, const unsigned char *isodirrec,
size_t reclen);
static int parse_rockridge(struct archive_read *a,
struct file_info *file, const unsigned char *start,
const unsigned char *end);
@ -1022,7 +1023,7 @@ read_children(struct archive_read *a, struct file_info *parent)
if (*(p + DR_name_len_offset) == 1
&& *(p + DR_name_offset) == '\001')
continue;
child = parse_file_info(a, parent, p);
child = parse_file_info(a, parent, p, b - p);
if (child == NULL) {
__archive_read_consume(a, skip_size);
return (ARCHIVE_FATAL);
@ -1112,7 +1113,7 @@ choose_volume(struct archive_read *a, struct iso9660 *iso9660)
*/
seenJoliet = iso9660->seenJoliet;/* Save flag. */
iso9660->seenJoliet = 0;
file = parse_file_info(a, NULL, block);
file = parse_file_info(a, NULL, block, vd->size);
if (file == NULL)
return (ARCHIVE_FATAL);
iso9660->seenJoliet = seenJoliet;
@ -1144,7 +1145,7 @@ choose_volume(struct archive_read *a, struct iso9660 *iso9660)
return (ARCHIVE_FATAL);
}
iso9660->seenJoliet = 0;
file = parse_file_info(a, NULL, block);
file = parse_file_info(a, NULL, block, vd->size);
if (file == NULL)
return (ARCHIVE_FATAL);
iso9660->seenJoliet = seenJoliet;
@ -1749,7 +1750,7 @@ archive_read_format_iso9660_cleanup(struct archive_read *a)
*/
static struct file_info *
parse_file_info(struct archive_read *a, struct file_info *parent,
const unsigned char *isodirrec)
const unsigned char *isodirrec, size_t reclen)
{
struct iso9660 *iso9660;
struct file_info *file, *filep;
@ -1763,16 +1764,20 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
iso9660 = (struct iso9660 *)(a->format->data);
dr_len = (size_t)isodirrec[DR_length_offset];
if (reclen != 0)
dr_len = (size_t)isodirrec[DR_length_offset];
/*
* Sanity check that reclen is not zero and dr_len is greater than
* reclen but at least 34
*/
if (reclen == 0 || reclen < dr_len || dr_len < 34) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Invalid length of directory record");
return (NULL);
}
name_len = (size_t)isodirrec[DR_name_len_offset];
location = archive_le32dec(isodirrec + DR_extent_offset);
fsize = toi(isodirrec + DR_size_offset, DR_size_size);
/* Sanity check that dr_len needs at least 34. */
if (dr_len < 34) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Invalid length of directory record");
return (NULL);
}
/* Sanity check that name_len doesn't exceed dr_len. */
if (dr_len - 33 < name_len || name_len == 0) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,

View File

@ -1,5 +1,5 @@
This is Lua 5.3.4, released on 12 Jan 2017.
This is Lua 5.3.5, released on 26 Jun 2018.
For installation instructions, license details, and
further information about Lua, see doc/readme.html.

View File

@ -32,7 +32,7 @@ For a complete introduction to Lua programming, see the book
<P>
<SMALL>
Copyright &copy; 2015&ndash;2017 Lua.org, PUC-Rio.
Copyright &copy; 2015&ndash;2018 Lua.org, PUC-Rio.
Freely available under the terms of the
<A HREF="http://www.lua.org/license.html">Lua license</A>.
</SMALL>
@ -609,10 +609,10 @@ Freely available under the terms of the
<P CLASS="footer">
Last update:
Thu Dec 22 18:29:39 BRST 2016
Mon Jun 18 22:56:06 -03 2018
</P>
<!--
Last change: revised for Lua 5.3.4
Last change: revised for Lua 5.3.5
-->
</BODY>

View File

@ -10,7 +10,7 @@ body {
line-height: 1.25 ;
margin: 16px auto ;
padding: 32px ;
border: solid #a0a0a0 1px ;
border: solid #ccc 1px ;
border-radius: 20px ;
max-width: 70em ;
width: 90% ;
@ -111,36 +111,29 @@ pre.session {
border-radius: 8px ;
}
td.gutter {
width: 4% ;
}
table.columns {
table {
border: none ;
border-spacing: 0 ;
border-collapse: collapse ;
}
td {
padding: 0 ;
margin: 0 ;
}
td.gutter {
width: 4% ;
}
table.columns td {
vertical-align: top ;
padding: 0 ;
padding-bottom: 1em ;
text-align: justify ;
line-height: 1.25 ;
}
p.logos a:link:hover, p.logos a:visited:hover {
background-color: inherit ;
}
table.book {
border: none ;
border-spacing: 0 ;
border-collapse: collapse ;
}
table.book td {
padding: 0 ;
vertical-align: top ;
}
@ -159,6 +152,10 @@ table.book span {
margin-top: 0.25em ;
}
p.logos a:link:hover, p.logos a:visited:hover {
background-color: inherit ;
}
img {
background-color: white ;
}

View File

@ -19,7 +19,7 @@ by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes
<P>
<SMALL>
Copyright &copy; 2015&ndash;2017 Lua.org, PUC-Rio.
Copyright &copy; 2015&ndash;2018 Lua.org, PUC-Rio.
Freely available under the terms of the
<a href="http://www.lua.org/license.html">Lua license</a>.
</SMALL>
@ -35,7 +35,7 @@ Freely available under the terms of the
<!-- ====================================================================== -->
<p>
<!-- $Id: manual.of,v 1.167 2017/01/09 15:18:11 roberto Exp $ -->
<!-- $Id: manual.of,v 1.167.1.2 2018/06/26 15:49:07 roberto Exp $ -->
@ -203,8 +203,8 @@ even those that do not support threads natively.
<p>
The type <em>table</em> implements associative arrays,
that is, arrays that can be indexed not only with numbers,
but with any Lua value except <b>nil</b> and NaN.
that is, arrays that can have as indices not only numbers,
but any Lua value except <b>nil</b> and NaN.
(<em>Not a Number</em> is a special value used to represent
undefined or unrepresentable numerical results, such as <code>0/0</code>.)
Tables can be <em>heterogeneous</em>;
@ -400,6 +400,8 @@ with the event name prefixed by two underscores;
the corresponding values are called <em>metamethods</em>.
In the previous example, the key is "<code>__add</code>"
and the metamethod is the function that performs the addition.
Unless stated otherwise,
metamethods should be function values.
<p>
@ -597,7 +599,7 @@ it is also slower than a real <code>__le</code> metamethod.)
</li>
<li><b><code>__index</code>: </b>
The indexing access <code>table[key]</code>.
The indexing access operation <code>table[key]</code>.
This event happens when <code>table</code> is not a table or
when <code>key</code> is not present in <code>table</code>.
The metamethod is looked up in <code>table</code>.
@ -1276,13 +1278,8 @@ Square brackets are used to index a table:
<pre>
var ::= prefixexp &lsquo;<b>[</b>&rsquo; exp &lsquo;<b>]</b>&rsquo;
</pre><p>
The meaning of accesses to table fields can be changed via metatables.
An access to an indexed variable <code>t[i]</code> is equivalent to
a call <code>gettable_event(t,i)</code>.
(See <a href="#2.4">&sect;2.4</a> for a complete description of the
<code>gettable_event</code> function.
This function is not defined or callable in Lua.
We use it here only for explanatory purposes.)
The meaning of accesses to table fields can be changed via metatables
(see <a href="#2.4">&sect;2.4</a>).
<p>
@ -1476,23 +1473,18 @@ and
cyclically permutes the values of <code>x</code>, <code>y</code>, and <code>z</code>.
<p>
The meaning of assignments to global variables
and table fields can be changed via metatables.
An assignment to an indexed variable <code>t[i] = val</code> is equivalent to
<code>settable_event(t,i,val)</code>.
(See <a href="#2.4">&sect;2.4</a> for a complete description of the
<code>settable_event</code> function.
This function is not defined or callable in Lua.
We use it here only for explanatory purposes.)
<p>
An assignment to a global name <code>x = val</code>
is equivalent to the assignment
<code>_ENV.x = val</code> (see <a href="#2.2">&sect;2.2</a>).
<p>
The meaning of assignments to table fields and
global variables (which are actually table fields, too)
can be changed via metatables (see <a href="#2.4">&sect;2.4</a>).
@ -1831,17 +1823,17 @@ Here are some examples:
g(f(), x) -- f() is adjusted to 1 result
g(x, f()) -- g gets x plus all results from f()
a,b,c = f(), x -- f() is adjusted to 1 result (c gets nil)
a,b = ... -- a gets the first vararg parameter, b gets
a,b = ... -- a gets the first vararg argument, b gets
-- the second (both a and b can get nil if there
-- is no corresponding vararg parameter)
-- is no corresponding vararg argument)
a,b,c = x, f() -- f() is adjusted to 2 results
a,b,c = f() -- f() is adjusted to 3 results
return f() -- returns all results from f()
return ... -- returns all received vararg parameters
return ... -- returns all received vararg arguments
return x,y,f() -- returns x, y, and all results from f()
{f()} -- creates a list with all results from f()
{...} -- creates a list with all vararg parameters
{...} -- creates a list with all vararg arguments
{f(), nil} -- f() is adjusted to 1 result
</pre>
@ -2039,9 +2031,12 @@ two objects are considered equal only if they are the same object.
Every time you create a new object
(a table, userdata, or thread),
this new object is different from any previously existing object.
Closures with the same reference are always equal.
A closure is always equal to itself.
Closures with any detectable difference
(different behavior, different definition) are always different.
Closures created at different times but with no detectable differences
may be classified as equal or not
(depending on internal caching details).
<p>
@ -2303,7 +2298,7 @@ If the value of prefixexp has type <em>function</em>,
then this function is called
with the given arguments.
Otherwise, the prefixexp "call" metamethod is called,
having as first parameter the value of prefixexp,
having as first argument the value of prefixexp,
followed by the original call arguments
(see <a href="#2.4">&sect;2.4</a>).
@ -2881,7 +2876,7 @@ it can do whatever it wants on that Lua state,
as it should be already protected.
However,
when C code operates on other Lua states
(e.g., a Lua parameter to the function,
(e.g., a Lua argument to the function,
a Lua state stored in the registry, or
the result of <a href="#lua_newthread"><code>lua_newthread</code></a>),
it should use them only in API calls that cannot raise errors.
@ -3370,7 +3365,7 @@ it is left unchanged.
Destroys all objects in the given Lua state
(calling the corresponding garbage-collection metamethods, if any)
and frees all dynamic memory used by this state.
On several platforms, you may not need to call this function,
In several platforms, you may not need to call this function,
because all resources are naturally released when the host program ends.
On the other hand, long-running programs that create multiple states,
such as daemons or web servers,
@ -5584,7 +5579,7 @@ given as argument to a hook (see <a href="#lua_Hook"><code>lua_Hook</code></a>).
<p>
To get information about a function you push it onto the stack
To get information about a function, you push it onto the stack
and start the <code>what</code> string with the character '<code>&gt;</code>'.
(In that case,
<code>lua_getinfo</code> pops the function from the top of the stack.)
@ -6462,7 +6457,7 @@ file-related functions in the standard library
<p>
Pushes onto the stack the field <code>e</code> from the metatable
of the object at index <code>obj</code> and returns the type of pushed value.
of the object at index <code>obj</code> and returns the type of the pushed value.
If the object does not have a metatable,
or if the metatable does not have this field,
pushes nothing and returns <code>LUA_TNIL</code>.
@ -6749,7 +6744,7 @@ In words, if the argument <code>arg</code> is nil or absent,
the macro results in the default <code>dflt</code>.
Otherwise, it results in the result of calling <code>func</code>
with the state <code>L</code> and the argument index <code>arg</code> as
parameters.
arguments.
Note that it evaluates the expression <code>dflt</code> only if needed.
@ -8680,7 +8675,7 @@ the lowercase letters plus the '<code>-</code>' character.
<p>
You can put a closing square bracket in a set
by positioning it as the first character in the set.
You can put an hyphen in a set
You can put a hyphen in a set
by positioning it as the first or the last character in the set.
(You can also use an escape for both cases.)
@ -9082,8 +9077,8 @@ Returns the destination table <code>a2</code>.
<p>
Returns a new table with all parameters stored into keys 1, 2, etc.
and with a field "<code>n</code>" with the total number of parameters.
Returns a new table with all arguments stored into keys 1, 2, etc.
and with a field "<code>n</code>" with the total number of arguments.
Note that the resulting table may not be a sequence.
@ -9215,7 +9210,7 @@ Returns the arc sine of <code>x</code> (in radians).
<p>
Returns the arc tangent of <code>y/x</code> (in radians),
but uses the signs of both parameters to find the
but uses the signs of both arguments to find the
quadrant of the result.
(It also handles correctly the case of <code>x</code> being zero.)
@ -9516,7 +9511,7 @@ all I/O functions return <b>nil</b> on failure
(plus an error message as a second result and
a system-dependent error code as a third result)
and some value different from <b>nil</b> on success.
On non-POSIX systems,
In non-POSIX systems,
the computation of the error message and error code
in case of errors
may be not thread safe,
@ -9553,7 +9548,7 @@ When called with a file name, it opens the named file (in text mode),
and sets its handle as the default input file.
When called with a file handle,
it simply sets this file handle as the default input file.
When called without parameters,
When called without arguments,
it returns the current default input file.
@ -9580,7 +9575,7 @@ it returns no values (to finish the loop) and automatically closes the file.
The call <code>io.lines()</code> (with no file name) is equivalent
to <code>io.input():lines("*l")</code>;
that is, it iterates over the lines of the default input file.
In this case it does not close the file when the loop ends.
In this case, the iterator does not close the file when the loop ends.
<p>
@ -9963,7 +9958,7 @@ the host system and on the current locale.
<p>
On non-POSIX systems,
In non-POSIX systems,
this function may be not thread safe
because of its reliance on C&nbsp;function <code>gmtime</code> and C&nbsp;function <code>localtime</code>.
@ -10163,7 +10158,7 @@ and explicitly removed when no longer needed.
<p>
On POSIX systems,
In POSIX systems,
this function also creates a file with that name,
to avoid security risks.
(Someone else might create the file with wrong permissions
@ -10301,8 +10296,8 @@ The first parameter or local variable has index&nbsp;1, and so on,
following the order that they are declared in the code,
counting only the variables that are active
in the current scope of the function.
Negative indices refer to vararg parameters;
-1 is the first vararg parameter.
Negative indices refer to vararg arguments;
-1 is the first vararg argument.
The function returns <b>nil</b> if there is no variable with the given index,
and raises an error when called with a level out of range.
(You can call <a href="#pdf-debug.getinfo"><code>debug.getinfo</code></a> to check whether the level is valid.)
@ -10400,7 +10395,7 @@ When called without arguments,
<p>
When the hook is called, its first parameter is a string
When the hook is called, its first argument is a string
describing the event that has triggered its call:
<code>"call"</code> (or <code>"tail call"</code>),
<code>"return"</code>,
@ -10551,7 +10546,8 @@ The options are:
<ul>
<li><b><code>-e <em>stat</em></code>: </b> executes string <em>stat</em>;</li>
<li><b><code>-l <em>mod</em></code>: </b> "requires" <em>mod</em>;</li>
<li><b><code>-l <em>mod</em></code>: </b> "requires" <em>mod</em> and assigns the
result to global @<em>mod</em>;</li>
<li><b><code>-i</code>: </b> enters interactive mode after running <em>script</em>;</li>
<li><b><code>-v</code>: </b> prints version information;</li>
<li><b><code>-E</code>: </b> ignores environment variables;</li>
@ -10629,7 +10625,7 @@ For instance, the call
</pre><p>
will print "<code>-e</code>".
If there is a script,
the script is called with parameters
the script is called with arguments
<code>arg[1]</code>, &middot;&middot;&middot;, <code>arg[#arg]</code>.
(Like all chunks in Lua,
the script is compiled as a vararg function.)
@ -10815,7 +10811,7 @@ The following functions were deprecated in the mathematical library:
<code>frexp</code>, and <code>ldexp</code>.
You can replace <code>math.pow(x,y)</code> with <code>x^y</code>;
you can replace <code>math.atan2</code> with <code>math.atan</code>,
which now accepts one or two parameters;
which now accepts one or two arguments;
you can replace <code>math.ldexp(x,exp)</code> with <code>x * 2.0^exp</code>.
For the other operations,
you can either use an external library or
@ -10850,7 +10846,7 @@ of the first result.)
<ul>
<li>
Continuation functions now receive as parameters what they needed
Continuation functions now receive as arguments what they needed
to get through <code>lua_getctx</code>,
so <code>lua_getctx</code> has been removed.
Adapt your code accordingly.
@ -10973,12 +10969,13 @@ and LiteralString, see <a href="#3.1">&sect;3.1</a>.)
<P CLASS="footer">
Last update:
Mon Jan 9 13:30:53 BRST 2017
Tue Jun 26 13:16:37 -03 2018
</P>
<!--
Last change: revised for Lua 5.3.4
Last change: revised for Lua 5.3.5
-->
</body></html>

View File

@ -107,7 +107,7 @@ Here are the details.
<OL>
<LI>
Open a terminal window and move to
the top-level directory, which is named <TT>lua-5.3.x</TT>.
the top-level directory, which is named <TT>lua-5.3.5</TT>.
The <TT>Makefile</TT> there controls both the build process and the installation process.
<P>
<LI>
@ -355,10 +355,10 @@ THE SOFTWARE.
<P CLASS="footer">
Last update:
Thu Dec 22 18:22:57 BRST 2016
Mon Jun 18 22:57:33 -03 2018
</P>
<!--
Last change: revised for Lua 5.3.4
Last change: revised for Lua 5.3.5
-->
</BODY>

View File

@ -102,7 +102,7 @@ c89:
freebsd:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -lreadline"
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc"
generic: $(ALL)
@ -110,7 +110,7 @@ linux:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
macosx:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" CC=cc
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline"
mingw:
$(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \

View File

@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 2.259 2016/02/29 14:27:14 roberto Exp $
** $Id: lapi.c,v 2.259.1.2 2017/12/06 18:35:12 roberto Exp $
** Lua API
** See Copyright Notice in lua.h
*/
@ -533,6 +533,7 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
lua_lock(L);
if (n == 0) {
setfvalue(L->top, fn);
api_incr_top(L);
}
else {
CClosure *cl;
@ -546,9 +547,9 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
/* does not need barrier because closure is white */
}
setclCvalue(L, L->top, cl);
api_incr_top(L);
luaC_checkGC(L);
}
api_incr_top(L);
luaC_checkGC(L);
lua_unlock(L);
}

View File

@ -1,5 +1,5 @@
/*
** $Id: lapi.h,v 2.9 2015/03/06 19:49:50 roberto Exp $
** $Id: lapi.h,v 2.9.1.1 2017/04/19 17:20:42 roberto Exp $
** Auxiliary functions from Lua API
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp $
** $Id: lauxlib.c,v 1.289.1.1 2017/04/19 17:20:42 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lauxlib.h,v 1.131 2016/12/06 14:54:31 roberto Exp $
** $Id: lauxlib.h,v 1.131.1.1 2017/04/19 17:20:42 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lbaselib.c,v 1.314 2016/09/05 19:06:34 roberto Exp $
** $Id: lbaselib.c,v 1.314.1.1 2017/04/19 17:39:34 roberto Exp $
** Basic library
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lbitlib.c,v 1.30 2015/11/11 19:08:09 roberto Exp $
** $Id: lbitlib.c,v 1.30.1.1 2017/04/19 17:20:42 roberto Exp $
** Standard library for bitwise operations
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lcode.c,v 2.112 2016/12/22 13:08:50 roberto Exp $
** $Id: lcode.c,v 2.112.1.1 2017/04/19 17:20:42 roberto Exp $
** Code generator for Lua
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lcode.h,v 1.64 2016/01/05 16:22:37 roberto Exp $
** $Id: lcode.h,v 1.64.1.1 2017/04/19 17:20:42 roberto Exp $
** Code generator for Lua
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lcorolib.c,v 1.10 2016/04/11 19:19:55 roberto Exp $
** $Id: lcorolib.c,v 1.10.1.1 2017/04/19 17:20:42 roberto Exp $
** Coroutine Library
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lctype.c,v 1.12 2014/11/02 19:19:04 roberto Exp $
** $Id: lctype.c,v 1.12.1.1 2017/04/19 17:20:42 roberto Exp $
** 'ctype' functions for Lua
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lctype.h,v 1.12 2011/07/15 12:50:29 roberto Exp $
** $Id: lctype.h,v 1.12.1.1 2013/04/12 18:48:47 roberto Exp $
** 'ctype' functions for Lua
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: ldblib.c,v 1.151 2015/11/23 11:29:43 roberto Exp $
** $Id: ldblib.c,v 1.151.1.1 2017/04/19 17:20:42 roberto Exp $
** Interface from Lua to its debug API
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: ldebug.c,v 2.121 2016/10/19 12:32:10 roberto Exp $
** $Id: ldebug.c,v 2.121.1.2 2017/07/10 17:21:50 roberto Exp $
** Debug Interface
** See Copyright Notice in lua.h
*/
@ -653,6 +653,7 @@ l_noret luaG_runerror (lua_State *L, const char *fmt, ...) {
CallInfo *ci = L->ci;
const char *msg;
va_list argp;
luaC_checkGC(L); /* error message uses memory */
va_start(argp, fmt);
msg = luaO_pushvfstring(L, fmt, argp); /* format message */
va_end(argp);

View File

@ -1,5 +1,5 @@
/*
** $Id: ldebug.h,v 2.14 2015/05/22 17:45:56 roberto Exp $
** $Id: ldebug.h,v 2.14.1.1 2017/04/19 17:20:42 roberto Exp $
** Auxiliary functions from Debug Interface module
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: ldo.c,v 2.157 2016/12/13 15:52:21 roberto Exp $
** $Id: ldo.c,v 2.157.1.1 2017/04/19 17:20:42 roberto Exp $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: ldo.h,v 2.29 2015/12/21 13:02:14 roberto Exp $
** $Id: ldo.h,v 2.29.1.1 2017/04/19 17:20:42 roberto Exp $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: ldump.c,v 2.37 2015/10/08 15:53:49 roberto Exp $
** $Id: ldump.c,v 2.37.1.1 2017/04/19 17:20:42 roberto Exp $
** save precompiled Lua chunks
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lfunc.c,v 2.45 2014/11/02 19:19:04 roberto Exp $
** $Id: lfunc.c,v 2.45.1.1 2017/04/19 17:39:34 roberto Exp $
** Auxiliary functions to manipulate prototypes and closures
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lfunc.h,v 2.15 2015/01/13 15:49:11 roberto Exp $
** $Id: lfunc.h,v 2.15.1.1 2017/04/19 17:39:34 roberto Exp $
** Auxiliary functions to manipulate prototypes and closures
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lgc.c,v 2.215 2016/12/22 13:08:50 roberto Exp $
** $Id: lgc.c,v 2.215.1.2 2017/08/31 16:15:27 roberto Exp $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@ -643,8 +643,9 @@ static void clearkeys (global_State *g, GCObject *l, GCObject *f) {
for (n = gnode(h, 0); n < limit; n++) {
if (!ttisnil(gval(n)) && (iscleared(g, gkey(n)))) {
setnilvalue(gval(n)); /* remove value ... */
removeentry(n); /* and remove entry from table */
}
if (ttisnil(gval(n))) /* is entry empty? */
removeentry(n); /* remove entry from table */
}
}
}

View File

@ -1,5 +1,5 @@
/*
** $Id: lgc.h,v 2.91 2015/12/21 13:02:14 roberto Exp $
** $Id: lgc.h,v 2.91.1.1 2017/04/19 17:39:34 roberto Exp $
** Garbage Collector
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: linit.c,v 1.39 2016/12/04 20:17:24 roberto Exp $
** $Id: linit.c,v 1.39.1.1 2017/04/19 17:20:42 roberto Exp $
** Initialization of libraries for lua.c and other clients
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: liolib.c,v 2.151 2016/12/20 18:37:00 roberto Exp $
** $Id: liolib.c,v 2.151.1.1 2017/04/19 17:29:57 roberto Exp $
** Standard I/O (and system) library
** See Copyright Notice in lua.h
*/
@ -206,11 +206,16 @@ static int aux_close (lua_State *L) {
}
static int f_close (lua_State *L) {
tofile(L); /* make sure argument is an open stream */
return aux_close(L);
}
static int io_close (lua_State *L) {
if (lua_isnone(L, 1)) /* no argument? */
lua_getfield(L, LUA_REGISTRYINDEX, IO_OUTPUT); /* use standard output */
tofile(L); /* make sure argument is an open stream */
return aux_close(L);
return f_close(L);
}
@ -712,7 +717,7 @@ static const luaL_Reg iolib[] = {
** methods for file handles
*/
static const luaL_Reg flib[] = {
{"close", io_close},
{"close", f_close},
{"flush", f_flush},
{"lines", f_lines},
{"read", f_read},

View File

@ -1,5 +1,5 @@
/*
** $Id: llex.c,v 2.96 2016/05/02 14:02:12 roberto Exp $
** $Id: llex.c,v 2.96.1.1 2017/04/19 17:20:42 roberto Exp $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: llex.h,v 1.79 2016/05/02 14:02:12 roberto Exp $
** $Id: llex.h,v 1.79.1.1 2017/04/19 17:20:42 roberto Exp $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: llimits.h,v 1.141 2015/11/19 19:16:22 roberto Exp $
** $Id: llimits.h,v 1.141.1.1 2017/04/19 17:20:42 roberto Exp $
** Limits, basic types, and some other 'installation-dependent' definitions
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lmathlib.c,v 1.119 2016/12/22 13:08:50 roberto Exp $
** $Id: lmathlib.c,v 1.119.1.1 2017/04/19 17:20:42 roberto Exp $
** Standard mathematical library
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lmem.c,v 1.91 2015/03/06 19:45:54 roberto Exp $
** $Id: lmem.c,v 1.91.1.1 2017/04/19 17:20:42 roberto Exp $
** Interface to Memory Manager
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lmem.h,v 1.43 2014/12/19 17:26:14 roberto Exp $
** $Id: lmem.h,v 1.43.1.1 2017/04/19 17:20:42 roberto Exp $
** Interface to Memory Manager
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: loadlib.c,v 1.130 2017/01/12 17:14:26 roberto Exp $
** $Id: loadlib.c,v 1.130.1.1 2017/04/19 17:20:42 roberto Exp $
** Dynamic library loader for Lua
** See Copyright Notice in lua.h
**

View File

@ -1,5 +1,5 @@
/*
** $Id: lobject.c,v 2.113 2016/12/22 13:08:50 roberto Exp $
** $Id: lobject.c,v 2.113.1.1 2017/04/19 17:29:57 roberto Exp $
** Some generic functions over Lua objects
** See Copyright Notice in lua.h
*/
@ -435,7 +435,8 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
}
case 'p': { /* a pointer */
char buff[4*sizeof(void *) + 8]; /* should be enough space for a '%p' */
int l = l_sprintf(buff, sizeof(buff), "%p", va_arg(argp, void *));
void *p = va_arg(argp, void *);
int l = lua_pointer2str(buff, sizeof(buff), p);
pushstr(L, buff, l);
break;
}

View File

@ -1,5 +1,5 @@
/*
** $Id: lobject.h,v 2.117 2016/08/01 19:51:24 roberto Exp $
** $Id: lobject.h,v 2.117.1.1 2017/04/19 17:39:34 roberto Exp $
** Type definitions for Lua objects
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lopcodes.c,v 1.55 2015/01/05 13:48:33 roberto Exp $
** $Id: lopcodes.c,v 1.55.1.1 2017/04/19 17:20:42 roberto Exp $
** Opcodes for Lua virtual machine
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lopcodes.h,v 1.149 2016/07/19 17:12:21 roberto Exp $
** $Id: lopcodes.h,v 1.149.1.1 2017/04/19 17:20:42 roberto Exp $
** Opcodes for Lua virtual machine
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: loslib.c,v 1.65 2016/07/18 17:58:58 roberto Exp $
** $Id: loslib.c,v 1.65.1.1 2017/04/19 17:29:57 roberto Exp $
** Standard Operating System library
** See Copyright Notice in lua.h
*/
@ -293,7 +293,8 @@ static int os_date (lua_State *L) {
else
stm = l_localtime(&t, &tmr);
if (stm == NULL) /* invalid date? */
luaL_error(L, "time result cannot be represented in this installation");
return luaL_error(L,
"time result cannot be represented in this installation");
if (strcmp(s, "*t") == 0) {
lua_createtable(L, 0, 9); /* 9 = number of fields */
setallfields(L, stm);
@ -340,7 +341,8 @@ static int os_time (lua_State *L) {
setallfields(L, &ts); /* update fields with normalized values */
}
if (t != (time_t)(l_timet)t || t == (time_t)(-1))
luaL_error(L, "time result cannot be represented in this installation");
return luaL_error(L,
"time result cannot be represented in this installation");
l_pushtime(L, t);
return 1;
}

View File

@ -1,5 +1,5 @@
/*
** $Id: lparser.c,v 2.155 2016/08/01 19:51:24 roberto Exp $
** $Id: lparser.c,v 2.155.1.2 2017/04/29 18:11:40 roberto Exp $
** Lua Parser
** See Copyright Notice in lua.h
*/
@ -1392,7 +1392,7 @@ static void test_then_block (LexState *ls, int *escapelist) {
luaK_goiffalse(ls->fs, &v); /* will jump to label if condition is true */
enterblock(fs, &bl, 0); /* must enter block before 'goto' */
gotostat(ls, v.t); /* handle goto/break */
skipnoopstat(ls); /* skip other no-op statements */
while (testnext(ls, ';')) {} /* skip colons */
if (block_follow(ls, 0)) { /* 'goto' is the entire block? */
leaveblock(fs);
return; /* and that is it */

View File

@ -1,5 +1,5 @@
/*
** $Id: lparser.h,v 1.76 2015/12/30 18:16:13 roberto Exp $
** $Id: lparser.h,v 1.76.1.1 2017/04/19 17:20:42 roberto Exp $
** Lua Parser
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $
** $Id: lprefix.h,v 1.2.1.1 2017/04/19 17:20:42 roberto Exp $
** Definitions for Lua code that must come before any other header file
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lstate.c,v 2.133 2015/11/13 12:16:51 roberto Exp $
** $Id: lstate.c,v 2.133.1.1 2017/04/19 17:39:34 roberto Exp $
** Global State
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lstate.h,v 2.133 2016/12/22 13:08:50 roberto Exp $
** $Id: lstate.h,v 2.133.1.1 2017/04/19 17:39:34 roberto Exp $
** Global State
** See Copyright Notice in lua.h
*/
@ -26,6 +26,24 @@
** 'tobefnz': all objects ready to be finalized;
** 'fixedgc': all objects that are not to be collected (currently
** only small strings, such as reserved words).
**
** Moreover, there is another set of lists that control gray objects.
** These lists are linked by fields 'gclist'. (All objects that
** can become gray have such a field. The field is not the same
** in all objects, but it always has this name.) Any gray object
** must belong to one of these lists, and all objects in these lists
** must be gray:
**
** 'gray': regular gray objects, still waiting to be visited.
** 'grayagain': objects that must be revisited at the atomic phase.
** That includes
** - black objects got in a write barrier;
** - all kinds of weak tables during propagation phase;
** - all threads.
** 'weak': tables with weak values to be cleared;
** 'ephemeron': ephemeron tables with white->white entries;
** 'allweak': tables with weak keys and/or weak values to be cleared.
** The last three lists are used only during the atomic phase.
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lstring.c,v 2.56 2015/11/23 11:32:51 roberto Exp $
** $Id: lstring.c,v 2.56.1.1 2017/04/19 17:20:42 roberto Exp $
** String table (keeps all strings handled by Lua)
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lstring.h,v 1.61 2015/11/03 15:36:01 roberto Exp $
** $Id: lstring.h,v 1.61.1.1 2017/04/19 17:20:42 roberto Exp $
** String table (keep all strings handled by Lua)
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lstrlib.c,v 1.254 2016/12/22 13:08:50 roberto Exp $
** $Id: lstrlib.c,v 1.254.1.1 2017/04/19 17:29:57 roberto Exp $
** Standard library for string operations and pattern-matching
** See Copyright Notice in lua.h
*/
@ -879,7 +879,7 @@ static int lua_number2strx (lua_State *L, char *buff, int sz,
buff[i] = toupper(uchar(buff[i]));
}
else if (fmt[SIZELENMOD] != 'a')
luaL_error(L, "modifiers for format '%%a'/'%%A' not implemented");
return luaL_error(L, "modifiers for format '%%a'/'%%A' not implemented");
return n;
}
@ -928,6 +928,7 @@ static void addquoted (luaL_Buffer *b, const char *s, size_t len) {
}
#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64
/*
** Ensures the 'buff' string uses a dot as the radix character.
*/
@ -938,7 +939,7 @@ static void checkdp (char *buff, int nb) {
if (ppoint) *ppoint = '.'; /* change it to a dot */
}
}
#endif
static void addliteral (lua_State *L, luaL_Buffer *b, int arg) {
switch (lua_type(L, arg)) {
@ -1209,8 +1210,8 @@ static int getnum (const char **fmt, int df) {
static int getnumlimit (Header *h, const char **fmt, int df) {
int sz = getnum(fmt, df);
if (sz > MAXINTSIZE || sz <= 0)
luaL_error(h->L, "integral size (%d) out of limits [1,%d]",
sz, MAXINTSIZE);
return luaL_error(h->L, "integral size (%d) out of limits [1,%d]",
sz, MAXINTSIZE);
return sz;
}

View File

@ -1,5 +1,5 @@
/*
** $Id: ltable.c,v 2.118 2016/11/07 12:38:35 roberto Exp $
** $Id: ltable.c,v 2.118.1.4 2018/06/08 16:22:51 roberto Exp $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@ -223,7 +223,9 @@ static unsigned int computesizes (unsigned int nums[], unsigned int *pna) {
unsigned int na = 0; /* number of elements to go to array part */
unsigned int optimal = 0; /* optimal size for array part */
/* loop while keys can fill more than half of total size */
for (i = 0, twotoi = 1; *pna > twotoi / 2; i++, twotoi *= 2) {
for (i = 0, twotoi = 1;
twotoi > 0 && *pna > twotoi / 2;
i++, twotoi *= 2) {
if (nums[i] > 0) {
a += nums[i];
if (a > twotoi/2) { /* more than half elements present? */
@ -330,17 +332,34 @@ static void setnodevector (lua_State *L, Table *t, unsigned int size) {
}
typedef struct {
Table *t;
unsigned int nhsize;
} AuxsetnodeT;
static void auxsetnode (lua_State *L, void *ud) {
AuxsetnodeT *asn = cast(AuxsetnodeT *, ud);
setnodevector(L, asn->t, asn->nhsize);
}
void luaH_resize (lua_State *L, Table *t, unsigned int nasize,
unsigned int nhsize) {
unsigned int i;
int j;
AuxsetnodeT asn;
unsigned int oldasize = t->sizearray;
int oldhsize = allocsizenode(t);
Node *nold = t->node; /* save old hash ... */
if (nasize > oldasize) /* array part must grow? */
setarrayvector(L, t, nasize);
/* create new hash part with appropriate size */
setnodevector(L, t, nhsize);
asn.t = t; asn.nhsize = nhsize;
if (luaD_rawrunprotected(L, auxsetnode, &asn) != LUA_OK) { /* mem. error? */
setarrayvector(L, t, oldasize); /* array back to its original size */
luaD_throw(L, LUA_ERRMEM); /* rethrow memory error */
}
if (nasize < oldasize) { /* array part must shrink? */
t->sizearray = nasize;
/* re-insert elements from vanishing slice */
@ -610,13 +629,13 @@ void luaH_setint (lua_State *L, Table *t, lua_Integer key, TValue *value) {
}
static int unbound_search (Table *t, unsigned int j) {
unsigned int i = j; /* i is zero or a present index */
static lua_Unsigned unbound_search (Table *t, lua_Unsigned j) {
lua_Unsigned i = j; /* i is zero or a present index */
j++;
/* find 'i' and 'j' such that i is present and j is not */
while (!ttisnil(luaH_getint(t, j))) {
i = j;
if (j > cast(unsigned int, MAX_INT)/2) { /* overflow? */
if (j > l_castS2U(LUA_MAXINTEGER) / 2) { /* overflow? */
/* table was built with bad purposes: resort to linear search */
i = 1;
while (!ttisnil(luaH_getint(t, i))) i++;
@ -626,7 +645,7 @@ static int unbound_search (Table *t, unsigned int j) {
}
/* now do a binary search between them */
while (j - i > 1) {
unsigned int m = (i+j)/2;
lua_Unsigned m = (i+j)/2;
if (ttisnil(luaH_getint(t, m))) j = m;
else i = m;
}
@ -638,7 +657,7 @@ static int unbound_search (Table *t, unsigned int j) {
** Try to find a boundary in table 't'. A 'boundary' is an integer index
** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil).
*/
int luaH_getn (Table *t) {
lua_Unsigned luaH_getn (Table *t) {
unsigned int j = t->sizearray;
if (j > 0 && ttisnil(&t->array[j - 1])) {
/* there is a boundary in the array part: (binary) search for it */

View File

@ -1,5 +1,5 @@
/*
** $Id: ltable.h,v 2.23 2016/12/22 13:08:50 roberto Exp $
** $Id: ltable.h,v 2.23.1.2 2018/05/24 19:39:05 roberto Exp $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@ -54,7 +54,7 @@ LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize,
LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize);
LUAI_FUNC void luaH_free (lua_State *L, Table *t);
LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key);
LUAI_FUNC int luaH_getn (Table *t);
LUAI_FUNC lua_Unsigned luaH_getn (Table *t);
#if defined(LUA_DEBUG)

View File

@ -1,5 +1,5 @@
/*
** $Id: ltablib.c,v 1.93 2016/02/25 19:41:54 roberto Exp $
** $Id: ltablib.c,v 1.93.1.1 2017/04/19 17:20:42 roberto Exp $
** Library for Table Manipulation
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: ltm.c,v 2.38 2016/12/22 13:08:50 roberto Exp $
** $Id: ltm.c,v 2.38.1.1 2017/04/19 17:39:34 roberto Exp $
** Tag methods
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: ltm.h,v 2.22 2016/02/26 19:20:15 roberto Exp $
** $Id: ltm.h,v 2.22.1.1 2017/04/19 17:20:42 roberto Exp $
** Tag methods
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lua.c,v 1.230 2017/01/12 17:14:26 roberto Exp $
** $Id: lua.c,v 1.230.1.1 2017/04/19 17:29:57 roberto Exp $
** Lua stand-alone interpreter
** See Copyright Notice in lua.h
*/
@ -138,7 +138,7 @@ static void print_usage (const char *badoption) {
"Available options are:\n"
" -e stat execute string 'stat'\n"
" -i enter interactive mode after executing 'script'\n"
" -l name require library 'name'\n"
" -l name require library 'name' into global 'name'\n"
" -v show version information\n"
" -E ignore environment variables\n"
" -- stop handling options\n"

View File

@ -1,5 +1,5 @@
/*
** $Id: lua.h,v 1.332 2016/12/22 15:51:20 roberto Exp $
** $Id: lua.h,v 1.332.1.2 2018/06/13 16:58:17 roberto Exp $
** Lua - A Scripting Language
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
** See Copyright Notice at the end of this file
@ -19,11 +19,11 @@
#define LUA_VERSION_MAJOR "5"
#define LUA_VERSION_MINOR "3"
#define LUA_VERSION_NUM 503
#define LUA_VERSION_RELEASE "4"
#define LUA_VERSION_RELEASE "5"
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2017 Lua.org, PUC-Rio"
#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2018 Lua.org, PUC-Rio"
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
@ -460,7 +460,7 @@ struct lua_Debug {
/******************************************************************************
* Copyright (C) 1994-2017 Lua.org, PUC-Rio.
* Copyright (C) 1994-2018 Lua.org, PUC-Rio.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@ -1,5 +1,5 @@
/*
** $Id: luac.c,v 1.75 2015/03/12 01:58:27 lhf Exp $
** $Id: luac.c,v 1.76 2018/06/19 01:32:02 lhf Exp $
** Lua compiler (saves bytecodes to files; also lists bytecodes)
** See Copyright Notice in lua.h
*/
@ -206,7 +206,7 @@ int main(int argc, char* argv[])
}
/*
** $Id: luac.c,v 1.75 2015/03/12 01:58:27 lhf Exp $
** $Id: luac.c,v 1.76 2018/06/19 01:32:02 lhf Exp $
** print bytecodes
** See Copyright Notice in lua.h
*/
@ -348,6 +348,7 @@ static void PrintCode(const Proto* f)
case OP_ADD:
case OP_SUB:
case OP_MUL:
case OP_MOD:
case OP_POW:
case OP_DIV:
case OP_IDIV:

View File

@ -1,5 +1,5 @@
/*
** $Id: lualib.h,v 1.45 2017/01/12 17:14:26 roberto Exp $
** $Id: lualib.h,v 1.45.1.1 2017/04/19 17:20:42 roberto Exp $
** Lua standard libraries
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lundump.c,v 2.44 2015/11/02 16:09:30 roberto Exp $
** $Id: lundump.c,v 2.44.1.1 2017/04/19 17:20:42 roberto Exp $
** load precompiled Lua chunks
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lundump.h,v 1.45 2015/09/08 15:41:05 roberto Exp $
** $Id: lundump.h,v 1.45.1.1 2017/04/19 17:20:42 roberto Exp $
** load precompiled Lua chunks
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lutf8lib.c,v 1.16 2016/12/22 13:08:50 roberto Exp $
** $Id: lutf8lib.c,v 1.16.1.1 2017/04/19 17:29:57 roberto Exp $
** Standard library for UTF-8 manipulation
** See Copyright Notice in lua.h
*/
@ -171,7 +171,7 @@ static int byteoffset (lua_State *L) {
}
else {
if (iscont(s + posi))
luaL_error(L, "initial position is a continuation byte");
return luaL_error(L, "initial position is a continuation byte");
if (n < 0) {
while (n < 0 && posi > 0) { /* move back */
do { /* find beginning of previous character */

View File

@ -1,5 +1,5 @@
/*
** $Id: lvm.c,v 2.268 2016/02/05 19:59:14 roberto Exp $
** $Id: lvm.c,v 2.268.1.1 2017/04/19 17:39:34 roberto Exp $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@ -41,7 +41,7 @@
** float without rounding. Used in comparisons. Left undefined if
** all integers fit in a float precisely.
*/
#if !defined(l_intfitsf)
#if !defined(l_intfitsf) && LUA_FLOAT_TYPE != LUA_FLOAT_INT64
/* number of bits in the mantissa of a float */
#define NBM (l_mathlim(MANT_DIG))

View File

@ -1,5 +1,5 @@
/*
** $Id: lvm.h,v 2.41 2016/12/22 13:08:50 roberto Exp $
** $Id: lvm.h,v 2.41.1.1 2017/04/19 17:20:42 roberto Exp $
** Lua virtual machine
** See Copyright Notice in lua.h
*/

View File

@ -1,5 +1,5 @@
/*
** $Id: lzio.c,v 1.37 2015/09/08 15:41:05 roberto Exp $
** $Id: lzio.c,v 1.37.1.1 2017/04/19 17:20:42 roberto Exp $
** Buffered streams
** See Copyright Notice in lua.h
*/

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