@@ -47,12 +47,14 @@ __FBSDID("$FreeBSD$");
#include <fts.h>
#include <langinfo.h>
#include <libutil.h>
#include <limits.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <wchar.h>
#ifdef COLORLS
#include <ctype.h>
#include <termcap.h>
@@ -105,6 +107,9 @@ static struct {
} colors[C_NUMCOLORS];
#endif

static size_t padding_for_month[12];
static size_t month_max_size = 0;

void
printscol(const DISPLAY *dp)
{
@@ -138,6 +143,70 @@ printname(const char *field, const char *name)
return rc;
}

static const char *
get_abmon(int mon)
{

switch (mon) {
case 0: return (nl_langinfo(ABMON_1));
case 1: return (nl_langinfo(ABMON_2));
case 2: return (nl_langinfo(ABMON_3));
case 3: return (nl_langinfo(ABMON_4));
case 4: return (nl_langinfo(ABMON_5));
case 5: return (nl_langinfo(ABMON_6));
case 6: return (nl_langinfo(ABMON_7));
case 7: return (nl_langinfo(ABMON_8));
case 8: return (nl_langinfo(ABMON_9));
case 9: return (nl_langinfo(ABMON_10));
case 10: return (nl_langinfo(ABMON_11));
case 11: return (nl_langinfo(ABMON_12));
}

/* should never happen */
abort();
}

static size_t
mbswidth(const char *month)
{
wchar_t wc;
size_t width, donelen, clen, w;

width = donelen = 0;
while ((clen = mbrtowc(&wc, month + donelen, MB_LEN_MAX, NULL)) != 0) {
if (clen == (size_t)-1 || clen == (size_t)-2)
return (-1);
donelen += clen;
if ((w = wcwidth(wc)) == (size_t)-1)
return (-1);
width += w;
}

return (width);
}

static void
compute_abbreviated_month_size(void)
{
int i;
size_t width;
size_t months_width[12];

for (i = 0; i < 12; i++) {
width = mbswidth(get_abmon(i));
if (width == (size_t)-1) {
month_max_size = -1;
return;
}
months_width[i] = width;
if (width > month_max_size)
month_max_size = width;
}

for (i = 0; i < 12; i++)
padding_for_month[i] = month_max_size - months_width[i];
}

/*
* print name in current style
*/
@@ -425,6 +494,31 @@ printdev(size_t width, dev_t dev)
xo_emit("{:device/%#*jx} ", (u_int)width, (uintmax_t)dev);
}

static size_t
ls_strftime(char *str, size_t len, const char *fmt, const struct tm *tm)
{
char *posb, nfmt[BUFSIZ];
const char *format = fmt;
size_t ret;

if ((posb = strstr(fmt, "%b")) != NULL) {
if (month_max_size == 0) {
compute_abbreviated_month_size();
}
if (month_max_size > 0) {
snprintf(nfmt, sizeof(nfmt), "%.*s%s%*s%s",
(int)(posb - fmt), fmt,
get_abmon(tm->tm_mon),
(int)padding_for_month[tm->tm_mon],
"",
posb + 2);
format = nfmt;
}
}
ret = strftime(str, len, format, tm);
return (ret);
}

static void
printtime(const char *field, time_t ftime)
{
@@ -451,7 +545,7 @@ printtime(const char *field, time_t ftime)
else
/* mmm dd yyyy || dd mmm yyyy */
format = d_first ? "%e %b %Y" : "%b %e %Y";
strftime(longstring, sizeof(longstring), format, localtime(&ftime));
ls_strftime(longstring, sizeof(longstring), format, localtime(&ftime));

snprintf(fmt, sizeof(fmt), "{d:%s/%%hs} ", field);
xo_attr("value", "%ld", (long) ftime);
@@ -170,8 +170,6 @@ B_flag_head()

B_flag_body()
{
atf_skip "kyua report-jenkins doesn't properly escape non-printable chars: https://github.com/jmmv/kyua/issues/136"

atf_check -e empty -o empty -s exit:0 touch "$(printf "y\013z")"
atf_check -e empty -o match:'y\\013z' -s exit:0 ls -B
}
@@ -467,8 +465,6 @@ b_flag_head()

b_flag_body()
{
atf_skip "kyua report-jenkins doesn't properly escape non-printable chars: https://github.com/jmmv/kyua/issues/136"

atf_check -e empty -o empty -s exit:0 touch "$(printf "y\013z")"
atf_check -e empty -o match:'y\\vz' -s exit:0 ls -b
}
@@ -747,8 +743,6 @@ q_flag_and_w_flag_head()

q_flag_and_w_flag_body()
{
atf_skip "kyua report-jenkins doesn't properly escape non-printable chars: https://github.com/jmmv/kyua/issues/136"

create_test_dir

test_file="$(printf "y\01z")"
@@ -330,7 +330,7 @@ setvareq(char *s, int flags)
if (vp->flags & VREADONLY) {
if ((flags & (VTEXTFIXED|VSTACK)) == 0)
ckfree(s);
error("%.*s: is read only", vp->name_len, s);
error("%.*s: is read only", vp->name_len, vp->text);
}
if (flags & VNOSET) {
if ((flags & (VTEXTFIXED|VSTACK)) == 0)
@@ -1,2 +1,3 @@
Sun, 25 Jan 2004 13:00:00 PST
2004 Jan 25 13:00:00

@@ -0,0 +1,99 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright (c) 2015, Joyent, Inc. All rights reserved.
#

#
# This test assures that we can have the same provider name across multiple
# probe definitions, and that the result will be the union of those
# definitions. In particular, libusdt depends on this when (for example)
# node modules that create a provider are loaded multiple times due to
# being included by different modules.
#

if [ $# != 1 ]; then
echo expected one argument: '<'dtrace-path'>'
exit 2
fi

dtrace=$1
DIR=/var/tmp/dtest.$$

mkdir $DIR
cd $DIR

cat > test.c <<EOF
#include <unistd.h>
void
main()
{
EOF

objs=

for oogle in bagnoogle stalloogle cockoogle; do
cat > $oogle.c <<EOF
#include <sys/sdt.h>
void
$oogle()
{
DTRACE_PROBE(doogle, $oogle);
}
EOF

cat > $oogle.d <<EOF
provider doogle {
probe $oogle();
};
EOF

cc -c $oogle.c

if [ $? -ne 0 ]; then
print -u2 "failed to compile $oogle.c"
exit 1
fi

$dtrace -G -s $oogle.d $oogle.o -o $oogle.d.o

if [ $? -ne 0 ]; then
print -u2 "failed to process $oogle.d"
exit 1
fi

objs="$objs $oogle.o $oogle.d.o"
echo $oogle'();' >> test.c
done
echo "}" >> test.c
cc -o test test.c $objs
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
fi
$dtrace -n 'doogle$target:::{@[probename] = count()}' \
-n 'END{printa("%-10s %@d\n", @)}' -x quiet -x aggsortkey -Zc ./test
if [ $? -ne 0 ]; then
print -u2 "failed to execute test"
exit 1
fi
cd /
rm -rf $DIR
exit 0
@@ -0,0 +1,4 @@
bagnoogle 1
cockoogle 1
stalloogle 1

@@ -571,12 +571,6 @@ dt_pid_usdt_mapping(void *data, const prmap_t *pmp, const char *oname)
prsyminfo_t sip;
dof_helper_t dh;
GElf_Half e_type;
#ifdef __FreeBSD__
dof_hdr_t hdr;
size_t sz;
uint64_t dofmax;
void *dof;
#endif
const char *mname;
const char *syms[] = { "___SUNW_dof", "__SUNW_dof" };
int i, fd = -1;
@@ -606,61 +600,25 @@ dt_pid_usdt_mapping(void *data, const prmap_t *pmp, const char *oname)
continue;
}

#ifdef __FreeBSD__
dh.dofhp_dof = sym.st_value;
dh.dofhp_addr = (e_type == ET_EXEC) ? 0 : pmp->pr_vaddr;
if (Pread(P, &hdr, sizeof (hdr), sym.st_value) !=
sizeof (hdr)) {
dt_dprintf("read of DOF header failed\n");
continue;
}

sz = sizeof(dofmax);
if (sysctlbyname("kern.dtrace.dof_maxsize", &dofmax, &sz,
NULL, 0) != 0) {
dt_dprintf("failed to read dof_maxsize: %s\n",
strerror(errno));
continue;
}
if (dofmax < hdr.dofh_loadsz) {
dt_dprintf("DOF load size exceeds maximum\n");
continue;
}

if ((dof = malloc(hdr.dofh_loadsz)) == NULL)
return (-1);

if (Pread(P, dof, hdr.dofh_loadsz, sym.st_value) !=
hdr.dofh_loadsz) {
free(dof);
dt_dprintf("read of DOF section failed\n");
continue;
}

dh.dofhp_dof = (uintptr_t)dof;
dh.dofhp_pid = proc_getpid(P);

dt_pid_objname(dh.dofhp_mod, sizeof (dh.dofhp_mod),
sip.prs_lmid, mname);

#ifdef __FreeBSD__
dh.dofhp_pid = proc_getpid(P);

if (fd == -1 &&
(fd = open("/dev/dtrace/helper", O_RDWR, 0)) < 0) {
dt_dprintf("open of helper device failed: %s\n",
strerror(errno));
free(dof);
return (-1); /* errno is set for us */
}

if (ioctl(fd, DTRACEHIOC_ADDDOF, &dh, sizeof (dh)) < 0)
dt_dprintf("DOF was rejected for %s\n", dh.dofhp_mod);

free(dof);
#else
dh.dofhp_dof = sym.st_value;
dh.dofhp_addr = (e_type == ET_EXEC) ? 0 : pmp->pr_vaddr;

dt_pid_objname(dh.dofhp_mod, sizeof (dh.dofhp_mod),
sip.prs_lmid, mname);

if (fd == -1 &&
(fd = pr_open(P, "/dev/dtrace/helper", O_RDWR, 0)) < 0) {
dt_dprintf("pr_open of helper device failed: %s\n",
@@ -24,6 +24,6 @@ CFILES= \
tst.sigwait.c \


LIBADD.tst.sigwait.exe=rt
LIBADD.tst.sigwait.exe+= rt

.include "../../dtrace.test.mk"
@@ -46,6 +46,8 @@ TESTFILES= \
tst.onlyenabled.ksh \
tst.reap.ksh \
tst.reeval.ksh \
tst.sameprovmulti.ksh \
tst.sameprovmulti.ksh.out \
tst.static.ksh \
tst.static.ksh.out \
tst.static2.ksh \
@@ -1,3 +1,35 @@
2015-12-01 Simon J. Gerraty <sjg@bad.crufty.net>

* Makefile (MAKE_VERSION): 20151201
Merge with NetBSD make, pick up
o cond.c: CondCvtArg: avoid access beyond end of empty buffer.
o meta.c: meta_oodate: use lstat(2) for checking link target
in case it is a symlink.
o var.c: avoid calling brk_string and Var_Export1 with empty
strings.

2015-11-26 Simon J. Gerraty <sjg@bad.crufty.net>

* Makefile (MAKE_VERSION): 20151126
Merge with NetBSD make, pick up
o parse.c: ParseTrackInput don't access beyond
end of old value.

2015-10-22 Simon J. Gerraty <sjg@bad.crufty.net>

* Makefile (MAKE_VERSION): 20151022

* Add support for BSD/OS which lacks inttypes.h
and really needs sys/param.h for sys/sysctl.h
also 'type' is not a shell builtin.

* var.c: eliminate uint32_t and need for inttypes.h

* main.c: PrintOnError flush stdout before run .ERROR

* parse.c: cope with _SC_PAGESIZE not being defined.


2015-10-20 Simon J. Gerraty <sjg@bad.crufty.net>

* Makefile (MAKE_VERSION): 20151020
@@ -1,7 +1,7 @@
# $Id: Makefile,v 1.44 2015/10/20 21:41:40 sjg Exp $
# $Id: Makefile,v 1.48 2015/12/02 00:36:42 sjg Exp $

# Base version on src date
MAKE_VERSION= 20151020
MAKE_VERSION= 20151201

PROG= bmake

@@ -111,7 +111,7 @@
# Simon J. Gerraty <sjg@crufty.net>

# RCSid:
# $Id: boot-strap,v 1.45 2014/04/05 22:56:54 sjg Exp $
# $Id: boot-strap,v 1.48 2015/10/25 05:20:48 sjg Exp $
#
# @(#) Copyright (c) 2001 Simon J. Gerraty
#
@@ -395,8 +395,15 @@ Bmake() {
)
}

# there is actually a shell where type is not a builtin
# if type is missing, which(1) had better exists!
if (type cat) > /dev/null 2>&1; then
which() {
type "$@" | sed 's,[()],,g;s,^[^/][^/]*,,;q'
}
fi
# make sure test below uses the same diff that configure did
TOOL_DIFF=`type diff | sed 's,[()],,g;s,^[^/][^/]*,,;q'`
TOOL_DIFF=`which diff`
export TOOL_DIFF

op_configure() {
@@ -1,4 +1,4 @@
/* $NetBSD: cond.c,v 1.69 2015/10/11 04:51:24 sjg Exp $ */
/* $NetBSD: cond.c,v 1.71 2015/12/02 00:28:24 sjg 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.69 2015/10/11 04:51:24 sjg Exp $";
static char rcsid[] = "$NetBSD: cond.c,v 1.71 2015/12/02 00:28:24 sjg 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.69 2015/10/11 04:51:24 sjg Exp $");
__RCSID("$NetBSD: cond.c,v 1.71 2015/12/02 00:28:24 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -490,6 +490,10 @@ CondCvtArg(char *str, double *value)
double d_val;

errno = 0;
if (!*str) {
*value = (double)0;
return TRUE;
}
l_val = strtoul(str, &eptr, str[1] == 'x' ? 16 : 10);
ech = *eptr;
if (ech == 0 && errno != ERANGE) {
@@ -59,6 +59,12 @@
/* Define to 1 if you have the `killpg' function. */
#undef HAVE_KILLPG

/* Define to 1 if you have the <libgen.h> header file. */
#undef HAVE_LIBGEN_H

/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

@@ -158,6 +164,9 @@
*/
#undef HAVE_SYS_NDIR_H

/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H

/* Define to 1 if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H

@@ -304,6 +313,11 @@
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE

/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT32_T

/* C99 function name */
#undef __func__

@@ -319,5 +333,9 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#undef uint32_t

/* Define as `fork' if `vfork' does not work. */
#undef vfork
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.64 for bmake 20140214.
# Generated by GNU Autoconf 2.64 for bmake 20151022.
#
# Report bugs to <sjg@NetBSD.org>.
#
@@ -549,8 +549,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bmake'
PACKAGE_TARNAME='bmake'
PACKAGE_VERSION='20140214'
PACKAGE_STRING='bmake 20140214'
PACKAGE_VERSION='20151022'
PACKAGE_STRING='bmake 20151022'
PACKAGE_BUGREPORT='sjg@NetBSD.org'
PACKAGE_URL=''

@@ -1221,7 +1221,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures bmake 20140214 to adapt to many kinds of systems.
\`configure' configures bmake 20151022 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1282,7 +1282,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bmake 20140214:";;
short | recursive ) echo "Configuration of bmake 20151022:";;
esac
cat <<\_ACEOF
@@ -1387,7 +1387,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bmake configure 20140214
bmake configure 20151022
generated by GNU Autoconf 2.64
Copyright (C) 2009 Free Software Foundation, Inc.
@@ -1742,6 +1742,58 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_type
# ac_fn_c_find_uintX_t LINENO BITS VAR
# ------------------------------------
# Finds an unsigned integer type with width BITS, setting cache variable VAR
# accordingly.
ac_fn_c_find_uintX_t ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
$as_echo_n "checking for uint$2_t... " >&6; }
if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
$as_echo_n "(cached) " >&6
else
eval "$3=no"
for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \
'unsigned long long int' 'unsigned short int' 'unsigned char'; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(($ac_type) -1 >> ($2 - 1) == 1)];
test_array [0] = 0
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
case $ac_type in #(
uint$2_t) :
eval "$3=yes" ;; #(
*) :
eval "$3=\$ac_type" ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
eval as_val=\$$3
if test "x$as_val" = x""no; then :
else
break
fi
done
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
} # ac_fn_c_find_uintX_t
# ac_fn_c_check_decl LINENO SYMBOL VAR
# ------------------------------------
# Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
@@ -1908,7 +1960,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bmake $as_me 20140214, which was
It was created by bmake $as_me 20151022, which was
generated by GNU Autoconf 2.64. Invocation command line was
$ $0 $@
@@ -4569,18 +4621,48 @@ fi
fi
for ac_header in sys/param.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_param_h" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_SYS_PARAM_H 1
_ACEOF
fi
done
for ac_header in sys/sysctl.h
do :
ac_fn_c_check_header_compile "$LINENO" "sys/sysctl.h" "ac_cv_header_sys_sysctl_h" "#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
# endif
"
if test "x$ac_cv_header_sys_sysctl_h" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_SYS_SYSCTL_H 1
_ACEOF
fi
done
for ac_header in \
ar.h \
err.h \
fcntl.h \
libgen.h \
limits.h \
paths.h \
poll.h \
ranlib.h \
string.h \
sys/mman.h \
sys/select.h \
sys/socket.h \
sys/sysctl.h \
sys/time.h \
sys/uio.h \
unistd.h \
@@ -5006,6 +5088,20 @@ _ACEOF
fi
ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
case $ac_cv_c_uint32_t in #(
no|yes) ;; #(
*)
$as_echo "#define _UINT32_T 1" >>confdefs.h
cat >>confdefs.h <<_ACEOF
#define uint32_t $ac_cv_c_uint32_t
_ACEOF
;;
esac
ac_fn_c_check_decl "$LINENO" "sys_siglist" "ac_cv_have_decl_sys_siglist" "#include <signal.h>
/* NetBSD declares sys_siglist in unistd.h. */
#ifdef HAVE_UNISTD_H
@@ -6406,7 +6502,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bmake $as_me 20140214, which was
This file was extended by bmake $as_me 20151022, which was
generated by GNU Autoconf 2.64. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -6466,7 +6562,7 @@ Report bugs to <sjg@NetBSD.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
bmake config.status 20140214
bmake config.status 20151022
configured by $0, generated by GNU Autoconf 2.64,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
@@ -1,11 +1,11 @@
dnl
dnl RCSid:
dnl $Id: configure.in,v 1.54 2015/10/10 04:17:10 sjg Exp $
dnl $Id: configure.in,v 1.56 2015/10/25 05:20:48 sjg Exp $
dnl
dnl Process this file with autoconf to produce a configure script
dnl
AC_PREREQ(2.50)
AC_INIT([bmake], [20151009], [sjg@NetBSD.org])
AC_INIT([bmake], [20151022], [sjg@NetBSD.org])
AC_CONFIG_HEADERS(config.h)

dnl make srcdir absolute
@@ -101,10 +101,19 @@ AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
dnl Keep this list sorted
AC_CHECK_HEADERS(sys/param.h)
dnl On BSDi at least we really need sys/param.h for sys/sysctl.h
AC_CHECK_HEADERS([sys/sysctl.h], [], [],
[#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
# endif
])

AC_CHECK_HEADERS( \
ar.h \
err.h \
fcntl.h \
libgen.h \
limits.h \
paths.h \
poll.h \
@@ -113,7 +122,6 @@ AC_CHECK_HEADERS( \
sys/mman.h \
sys/select.h \
sys/socket.h \
sys/sysctl.h \
sys/time.h \
sys/uio.h \
unistd.h \
@@ -143,6 +151,7 @@ AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_DECL_SYS_SIGLIST
AC_HEADER_TIME
AC_STRUCT_TM
@@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.234 2015/10/11 04:51:24 sjg Exp $ */
/* $NetBSD: main.c,v 1.235 2015/10/25 05:24:44 sjg Exp $ */

/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/

#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: main.c,v 1.234 2015/10/11 04:51:24 sjg Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.235 2015/10/25 05:24:44 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.234 2015/10/11 04:51:24 sjg Exp $");
__RCSID("$NetBSD: main.c,v 1.235 2015/10/25 05:24:44 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -1902,6 +1902,8 @@ PrintOnError(GNode *gn, const char *s)
printf("%s", cp);
free(cp);
}
fflush(stdout);

/*
* Finally, see if there is a .ERROR target, and run it if so.
*/
@@ -1,4 +1,4 @@
/* $NetBSD: meta.c,v 1.40 2015/10/11 04:51:24 sjg Exp $ */
/* $NetBSD: meta.c,v 1.41 2015/11/30 23:37:56 sjg Exp $ */

/*
* Implement 'meta' mode.
@@ -38,7 +38,11 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#ifdef HAVE_LIBGEN_H
#include <libgen.h>
#elif !defined(HAVE_DIRNAME)
char * dirname(char *);
#endif
#include <errno.h>
#if !defined(HAVE_CONFIG_H) || defined(HAVE_ERR_H)
#include <err.h>
@@ -1183,7 +1187,8 @@ meta_oodate(GNode *gn, Boolean oodate)
if ((strstr("tmp", p)))
break;

if (stat(p, &fs) < 0) {
if ((link_src != NULL && lstat(p, &fs) < 0) ||
(link_src == NULL && stat(p, &fs) < 0)) {
Lst_AtEnd(missingFiles, bmake_strdup(p));
}
break;
@@ -1,3 +1,29 @@
2015-11-14 Simon J. Gerraty <sjg@bad.crufty.net>

* install-mk (MK_VERSION): 20151111

* meta.sys.mk: include sys.dependfile.mk

* sys.mk (OPTIONS_DEFAULT_NO): use options.mk
to set MK_AUTO_OBJ and MK_DIRDEPS_BUILD
include local.sys.env.mk early
include local.sys.mk later

* own.mk (OPTIONS_DEFAULT_NO): AUTO_OBJ etc moved to sys.mk

2015-11-13 Simon J. Gerraty <sjg@bad.crufty.net>

* meta.sys.mk (META_COOKIE_TOUCH):
add ${META_COOKIE_TOUCH} to the end of scripts to touch cookie

* meta.stage.mk: stage_libs should ignore SYMLINKS.

2015-10-23 Simon J. Gerraty <sjg@bad.crufty.net>

* install-mk (MK_VERSION): 20151022

* sys.mk: BSD/OS does not have 'type' as a shell builtin.

2015-10-20 Simon J. Gerraty <sjg@bad.crufty.net>

* install-mk (MK_VERSION): 20151020
@@ -460,7 +486,7 @@
needed.
* gendirdeps.mk: only produce unqualified deps if no
.MAKE.DEPENDFILE_PREFERENCE ends in .${MACHINE}
* meta.subdir.mk: apply SUBDIREPS_FILTER
* meta.subdir.mk: apply SUBDIRDEPS_FILTER

2012-04-20 Simon J. Gerraty <sjg@bad.crufty.net>

@@ -1,5 +1,5 @@
# RCSid:
# $Id: host-target.mk,v 1.9 2015/09/10 18:42:57 sjg Exp $
# $Id: host-target.mk,v 1.11 2015/10/25 00:07:20 sjg Exp $

# Host platform information; may be overridden
.if !defined(_HOST_OSNAME)
@@ -21,7 +21,7 @@ _HOST_ARCH := ${_HOST_MACHINE}
.else
_HOST_ARCH != uname -p 2> /dev/null || uname -m
# uname -p may produce garbage on linux
.if ${_HOST_ARCH:[\#]} > 1
.if ${_HOST_ARCH:[\#]} > 1 || ${_HOST_ARCH:Nunknown} == ""
_HOST_ARCH := ${_HOST_MACHINE}
.endif
.endif
@@ -33,10 +33,10 @@ HOST_MACHINE := ${_HOST_MACHINE}
.endif

HOST_OSMAJOR := ${_HOST_OSREL:C/[^0-9].*//}
HOST_OSTYPE := ${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//}-${_HOST_ARCH}
HOST_OSTYPE := ${_HOST_OSNAME:S,/,,g}-${_HOST_OSREL:C/\([^\)]*\)//}-${_HOST_ARCH}
HOST_OS := ${_HOST_OSNAME}
host_os := ${_HOST_OSNAME:tl}
HOST_TARGET := ${host_os}${HOST_OSMAJOR}-${_HOST_ARCH}
HOST_TARGET := ${host_os:S,/,,g}${HOST_OSMAJOR}-${_HOST_ARCH}

# tr is insanely non-portable, accommodate the lowest common denominator
TR ?= tr
@@ -1,4 +1,4 @@
# $Id: init.mk,v 1.9 2013/07/18 05:46:24 sjg Exp $
# $Id: init.mk,v 1.10 2015/12/07 04:28:31 sjg Exp $
#
# @(#) Copyright (c) 2002, Simon J. Gerraty
#
@@ -47,4 +47,8 @@ PROFFLAGS?= -DGPROF -DPROF
_SKIP_BUILD = not building at level 0
.endif

.if !empty(_SKIP_BUILD)
all: .PHONY
.warning ${_SKIP_BUILD}
.endif
.endif
@@ -55,7 +55,7 @@
# Simon J. Gerraty <sjg@crufty.net>

# RCSid:
# $Id: install-mk,v 1.115 2015/10/20 22:04:53 sjg Exp $
# $Id: install-mk,v 1.117 2015/11/14 18:09:57 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@@ -70,7 +70,7 @@
# sjg@crufty.net
#

MK_VERSION=20151020
MK_VERSION=20151111
OWNER=
GROUP=
MODE=444
@@ -1,4 +1,4 @@
# $Id: lib.mk,v 1.51 2014/05/23 01:30:36 sjg Exp $
# $Id: lib.mk,v 1.52 2015/11/14 18:09:57 sjg Exp $

.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@@ -254,7 +254,7 @@ DLLIB ?= -ldl
# is a waste of time, this tells meta.autodep.mk to just pick one
# (typically .So)
# yes, 42 is a random number.
.if ${MK_META_MODE} == "yes" && ${SRCS:Uno:[\#]} > 42
.if ${MK_DIRDEPS_BUILD} == "yes" && ${SRCS:Uno:[\#]} > 42
OPTIMIZE_OBJECT_META_FILES ?= yes
.endif

@@ -1,4 +1,4 @@
# $Id: meta.autodep.mk,v 1.37 2015/06/16 06:29:17 sjg Exp $
# $Id: meta.autodep.mk,v 1.39 2015/12/07 04:35:32 sjg Exp $

#
# @(#) Copyright (c) 2010, Simon J. Gerraty
@@ -50,6 +50,9 @@ UPDATE_DEPENDFILE = NO
.endif

_CURDIR ?= ${.CURDIR}
_OBJDIR ?= ${.OBJDIR}
_OBJTOP ?= ${OBJTOP}
_OBJROOT ?= ${OBJROOT:U${_OBJTOP}}
_DEPENDFILE := ${_CURDIR}/${.MAKE.DEPENDFILE:T}

.if ${.MAKE.LEVEL} == 0
@@ -190,7 +193,7 @@ gendirdeps: ${_DEPENDFILE}
# anything which matches ${_OBJROOT}* but not ${_OBJTOP}*
# needs to be qualified in DIRDEPS
# The pseudo machine "host" is used for HOST_TARGET
DIRDEPS = \
DIRDEPS += \
${DPADD:M${_OBJTOP}*:H:C,${_OBJTOP}[^/]*/,,:N.:O:u} \
${DPADD:M${_OBJROOT}*:N${_OBJTOP}*:H:S,${_OBJROOT},,:C,^([^/]+)/(.*),\2.\1,:S,${HOST_TARGET}$,host,:N.*:O:u}

@@ -1,4 +1,4 @@
# $Id: meta.stage.mk,v 1.40 2015/10/04 17:36:54 sjg Exp $
# $Id: meta.stage.mk,v 1.41 2015/11/13 17:34:04 sjg Exp $
#
# @(#) Copyright (c) 2011, Simon J. Gerraty
#
@@ -155,7 +155,7 @@ stage_libs: .dirdep
@${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_LIBDIR:${STAGE_DIR_FILTER}} \
${SHLIB_LINKS:@t@${STAGE_LIBS:T:M$t.*} $t@}
.elif !empty(SHLIB_LINK) && !empty(SHLIB_NAME)
@${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_LIBDIR:${STAGE_DIR_FILTER}} ${SHLIB_NAME} ${SHLIB_LINK} ${SYMLINKS:T}
@${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_LIBDIR:${STAGE_DIR_FILTER}} ${SHLIB_NAME} ${SHLIB_LINK}
.endif
.endif
@touch $@
@@ -1,4 +1,4 @@
# $Id: meta.subdir.mk,v 1.10 2012/07/03 05:26:46 sjg Exp $
# $Id: meta.subdir.mk,v 1.11 2015/11/24 22:26:51 sjg Exp $

#
# @(#) Copyright (c) 2010, Simon J. Gerraty
@@ -62,7 +62,7 @@ _subdeps != cd ${.CURDIR} && \
DIRDEPS =
.else
# clean up if needed
DIRDEPS := ${DIRDEPS:S,^./,,:S,/./,/,g:${SUBDIREPS_FILTER:Uu}}
DIRDEPS := ${DIRDEPS:S,^./,,:S,/./,/,g:${SUBDIRDEPS_FILTER:Uu}}
.endif
# we just dealt with it, if we leave it defined,
# dirdeps.mk will compute some interesting combinations.
@@ -1,4 +1,4 @@
# $Id: meta.sys.mk,v 1.22 2015/06/16 06:31:05 sjg Exp $
# $Id: meta.sys.mk,v 1.26 2015/11/14 21:16:13 sjg Exp $

#
# @(#) Copyright (c) 2010, Simon J. Gerraty
@@ -51,17 +51,6 @@ META_MODE += silent=yes
.endif
.endif

# make defaults .MAKE.DEPENDFILE to .depend
# that won't work for us.
.if ${.MAKE.DEPENDFILE} == ".depend"
.undef .MAKE.DEPENDFILE
.endif

# if you don't cross build for multiple MACHINEs concurrently, then
# .MAKE.DEPENDFILE = Makefile.depend
# probably makes sense - you can set that in local.sys.mk
.MAKE.DEPENDFILE ?= Makefile.depend.${MACHINE}

# we use the pseudo machine "host" for the build host.
# this should be taken care of before we get here
.if ${OBJTOP:Ua} == ${HOST_OBJTOP:Ub}
@@ -109,10 +98,27 @@ _metaError: .NOMETA .NOTMAIN

.endif

META_COOKIE_TOUCH=
# some targets need to be .PHONY in non-meta mode
META_NOPHONY= .PHONY
# Are we, after all, in meta mode?
.if ${.MAKE.MODE:Mmeta*} != ""
MKDEP_MK = meta.autodep.mk

.if ${.MAKE.MAKEFILES:M*sys.dependfile.mk} == ""
# this does all the smarts of setting .MAKE.DEPENDFILE
.-include <sys.dependfile.mk>
# check if we got anything sane
.if ${.MAKE.DEPENDFILE} == ".depend"
.undef .MAKE.DEPENDFILE
.endif
.MAKE.DEPENDFILE ?= Makefile.depend
.endif

# we can afford to use cookies to prevent some targets
# re-running needlessly
META_COOKIE_TOUCH= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET}}
META_NOPHONY=
.if ${UPDATE_DEPENDFILE:Uyes:tl} != "no"
.if ${.MAKEFLAGS:Uno:M-k} != ""
# make this more obvious
@@ -1,4 +1,4 @@
# $Id: own.mk,v 1.29 2015/09/08 06:15:31 sjg Exp $
# $Id: own.mk,v 1.30 2015/11/14 18:09:57 sjg Exp $

.if !target(__${.PARSEFILE}__)
__${.PARSEFILE}__:
@@ -89,12 +89,10 @@ OPTIONS_DEFAULT_NO+= DPADD_MK

# process options
OPTIONS_DEFAULT_NO+= \
AUTO_OBJ \
INSTALL_AS_USER \
GPROF \
LIBTOOL \
LINT \
META_MODE \

OPTIONS_DEFAULT_YES+= \
ARCHIVE \
@@ -1,4 +1,4 @@
# $Id: sys.mk,v 1.36 2014/05/11 00:30:19 sjg Exp $
# $Id: sys.mk,v 1.41 2015/11/14 20:20:34 sjg Exp $
#
# @(#) Copyright (c) 2003-2009, Simon J. Gerraty
#
@@ -75,8 +75,12 @@ M_L_TARGETS = ${M_ListToMatch:S,V,_TARGETS,}
M_ListToSkip= O:u:ts::S,:,:N,g:S,^,N,

# type should be a builtin in any sh since about 1980,
# but sadly there are exceptions!
.if ${.MAKE.OS:Unknown:NBSD/OS} == ""
_type_sh = which
.endif
# AUTOCONF := ${autoconf:L:${M_whence}}
M_type = @x@(type $$x 2> /dev/null); echo;@:sh:[0]:N* found*:[@]:C,[()],,g
M_type = @x@(${_type_sh:Utype} $$x) 2> /dev/null; echo;@:sh:[0]:N* found*:[@]:C,[()],,g
M_whence = ${M_type}:M/*:[1]

# convert a path to a valid shell variable
@@ -102,6 +106,9 @@ _TARGETS := ${.TARGETS}
# we need HOST_TARGET etc below.
.include <host-target.mk>

# early customizations
.-include <local.sys.env.mk>

# find the OS specifics
.if defined(SYS_OS_MK)
.include <${SYS_OS_MK}>
@@ -126,11 +133,30 @@ SYS_OS_MK := ${_sys_mk}
.export SYS_OS_MK
.endif

# allow customization without editing.
.-include <local.sys.mk>
# some options we need to know early
OPTIONS_DEFAULT_NO += \
DIRDEPS_BUILD \
DIRDEPS_CACHE \
META_MODE

OPTIONS_DEFAULT_DEPENDENT += \
AUTO_OBJ/DIRDEPS_BUILD \
STAGING/DIRDEPS_BUILD \

.-include "options.mk"

.if ${MK_DIRDEPS_BUILD:Uno} == "yes"
MK_META_MODE = yes
.-include <meta.sys.mk>
.elif ${MK_META_MODE:Uno} == "yes"
.MAKE.MODE = meta verbose
.endif
# make sure we have a harmless value
.MAKE.MODE ?= normal

# if you want objdirs make them automatic
.if ${MKOBJDIRS:Uno} == "auto"
# and do it early before we compute .PATH
.if ${MK_AUTO_OBJ:Uno} == "yes" || ${MKOBJDIRS:Uno} == "auto"
.include <auto.obj.mk>
.endif

@@ -178,17 +204,8 @@ Mkdirs= Mkdirs() { \
.cc.cpp-out:
@${COMPILE.cc:N-c} -E ${.IMPSRC} | grep -v '^[ ]*$$'

# we don't include own.mk but user can expect -DWITH_META_MODE to work
.if defined(WITHOUT_META_MODE)
USE_META= no
.elif defined(WITH_META_MODE)
USE_META= yes
.endif
.if ${USE_META:Uno} == "yes"
.-include <meta.sys.mk>
.endif
# make sure we have a harmless value
.MAKE.MODE ?= normal
# late customizations
.-include <local.sys.mk>

# if .CURDIR is matched by any entry in DEBUG_MAKE_DIRS we
# will apply DEBUG_MAKE_FLAGS, now.
@@ -17,7 +17,7 @@
# Simon J. Gerraty <sjg@crufty.net>

# RCSid:
# $Id: os.sh,v 1.47 2015/09/10 05:53:10 sjg Exp $
# $Id: os.sh,v 1.49 2015/10/25 00:05:40 sjg Exp $
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
@@ -44,7 +44,7 @@ MACHINE_ARCH=`uname -p 2>/dev/null || echo $MACHINE`
# there is at least one case of `uname -p` outputting
# a bunch of usless drivel
case "$MACHINE_ARCH" in
*[!A-Za-z0-9_-]*) MACHINE_ARCH="$MACHINE";;
unknown|*[!A-Za-z0-9_-]*) MACHINE_ARCH="$MACHINE";;
esac

# we need this here, and it is not always available...
@@ -213,7 +213,7 @@ LN=${LN:-ln}
TR=${TR:-tr}

# Some people like have /share/$HOST_TARGET/bin etc.
HOST_TARGET=`echo ${OS}${OSMAJOR}-$HOST_ARCH | toLower`
HOST_TARGET=`echo ${OS}${OSMAJOR}-$HOST_ARCH | tr -d / | toLower`
export HOST_TARGET

case `echo -n .` in -n*) N=; C="\c";; *) N=-n; C=;; esac
@@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.205 2015/10/11 04:51:24 sjg Exp $ */
/* $NetBSD: parse.c,v 1.206 2015/11/26 00:23:04 sjg Exp $ */

/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/

#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: parse.c,v 1.205 2015/10/11 04:51:24 sjg Exp $";
static char rcsid[] = "$NetBSD: parse.c,v 1.206 2015/11/26 00:23:04 sjg 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.205 2015/10/11 04:51:24 sjg Exp $");
__RCSID("$NetBSD: parse.c,v 1.206 2015/11/26 00:23:04 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -508,7 +508,11 @@ loadfile(const char *path, int fd)
#ifdef HAVE_MMAP
if (load_getsize(fd, &lf->len) == SUCCESS) {
/* found a size, try mmap */
#ifdef _SC_PAGESIZE
pagesize = sysconf(_SC_PAGESIZE);
#else
pagesize = 0;
#endif
if (pagesize <= 0) {
pagesize = 0x1000;
}
@@ -1,4 +1,4 @@
# $Id: Makefile.in,v 1.47 2015/05/05 21:58:06 sjg Exp $
# $Id: Makefile.in,v 1.48 2015/12/07 04:06:29 sjg Exp $
#
# $NetBSD: Makefile,v 1.52 2015/05/05 21:51:09 sjg Exp $
#
@@ -128,7 +128,7 @@ SED_CMDS.varshell = -e 's,^[a-z]*sh: ,,' \
test: ${OUTFILES} .PHONY
@failed= ; \
for test in ${TESTNAMES}; do \
${TOOL_DIFF} -u ${UNIT_TESTS}/$${test}.exp $${test}.out \
${TOOL_DIFF} ${DIFF_FLAGS} ${UNIT_TESTS}/$${test}.exp $${test}.out \
|| failed="$${failed}$${failed:+ }$${test}" ; \
done ; \
if [ -n "$${failed}" ]; then \
@@ -1,4 +1,4 @@
# $Id: cond2.mk,v 1.1.1.1 2015/05/05 21:53:13 sjg Exp $
# $Id: cond2.mk,v 1.1.1.2 2015/12/02 00:34:27 sjg Exp $

TEST_UNAME_S= NetBSD

@@ -21,5 +21,9 @@ Y!= echo TEST_NOT_SET is empty or not defined >&2; echo
Y= oops
.endif

.if defined(.NDEF) && ${.NDEF} > 0
Z= yes
.endif

all:
@echo $@
@@ -1,9 +1,9 @@
At first, I am
happy
and now: sad
.ERROR: Looks like 'sad' is upset.
*** Error code 1

Stop.
make: stopped in unit-tests
.ERROR: Looks like 'sad' is upset.
exit status 1
@@ -12,9 +12,9 @@ all: mod-ts
# Use print or printf iff they are builtin.
# XXX note that this causes problems, when make decides
# there is no need to use a shell, so avoid where possible.
.if ${type print 2> /dev/null || echo:L:sh:Mbuiltin} != ""
.if ${(type print) 2> /dev/null || echo:L:sh:Mbuiltin} != ""
PRINT= print -r --
.elif ${type printf 2> /dev/null || echo:L:sh:Mbuiltin} != ""
.elif ${(type printf) 2> /dev/null || echo:L:sh:Mbuiltin} != ""
PRINT= printf '%s\n'
.else
PRINT= echo
@@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.199 2015/10/20 21:30:57 sjg Exp $ */
/* $NetBSD: var.c,v 1.200 2015/12/01 07:26:08 sjg Exp $ */

/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/

#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: var.c,v 1.199 2015/10/20 21:30:57 sjg Exp $";
static char rcsid[] = "$NetBSD: var.c,v 1.200 2015/12/01 07:26:08 sjg 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.199 2015/10/20 21:30:57 sjg Exp $");
__RCSID("$NetBSD: var.c,v 1.200 2015/12/01 07:26:08 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -129,7 +129,6 @@ __RCSID("$NetBSD: var.c,v 1.199 2015/10/20 21:30:57 sjg Exp $");
#include <regex.h>
#endif
#include <ctype.h>
#include <inttypes.h>
#include <stdlib.h>
#include <limits.h>
#include <time.h>
@@ -702,13 +701,15 @@ Var_ExportVars(void)
int i;

val = Var_Subst(NULL, tmp, VAR_GLOBAL, FALSE, TRUE);
av = brk_string(val, &ac, FALSE, &as);
for (i = 0; i < ac; i++) {
Var_Export1(av[i], 0);
if (*val) {
av = brk_string(val, &ac, FALSE, &as);
for (i = 0; i < ac; i++) {
Var_Export1(av[i], 0);
}
free(as);
free(av);
}
free(val);
free(as);
free(av);
}
}

@@ -740,35 +741,37 @@ Var_Export(char *str, int isExport)
track = VAR_EXPORT_PARENT;
}
val = Var_Subst(NULL, str, VAR_GLOBAL, FALSE, TRUE);
av = brk_string(val, &ac, FALSE, &as);
for (i = 0; i < ac; i++) {
name = av[i];
if (!name[1]) {
/*
* A single char.
* If it is one of the vars that should only appear in
* local context, skip it, else we can get Var_Subst
* into a loop.
*/
switch (name[0]) {
case '@':
case '%':
case '*':
case '!':
continue;
if (*val) {
av = brk_string(val, &ac, FALSE, &as);
for (i = 0; i < ac; i++) {
name = av[i];
if (!name[1]) {
/*
* A single char.
* If it is one of the vars that should only appear in
* local context, skip it, else we can get Var_Subst
* into a loop.
*/
switch (name[0]) {
case '@':
case '%':
case '*':
case '!':
continue;
}
}
}
if (Var_Export1(name, track)) {
if (VAR_EXPORTED_ALL != var_exportedVars)
var_exportedVars = VAR_EXPORTED_YES;
if (isExport && track) {
Var_Append(MAKE_EXPORTED, name, VAR_GLOBAL);
if (Var_Export1(name, track)) {
if (VAR_EXPORTED_ALL != var_exportedVars)
var_exportedVars = VAR_EXPORTED_YES;
if (isExport && track) {
Var_Append(MAKE_EXPORTED, name, VAR_GLOBAL);
}
}
}
free(as);
free(av);
}
free(val);
free(as);
free(av);
}


@@ -2306,7 +2309,7 @@ VarHash(char *str)
Buffer buf;
size_t len, len2;
unsigned char *ustr = (unsigned char *)str;
uint32_t h, k, c1, c2;
unsigned int h, k, c1, c2;

h = 0x971e137bU;
c1 = 0x95543787U;
@@ -22,20 +22,23 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Id: addr2line.1 3195 2015-05-12 17:22:19Z emaste $
.\" $Id: addr2line.1 3263 2015-11-30 04:25:54Z kaiwang27 $
.\"
.Dd July 25, 2010
.Dd November 30, 2015
.Os
.Dt ADDR2LINE 1
.Sh NAME
.Nm addr2line
.Nd translate program addresses to source file names and line numbers
.Sh SYNOPSIS
.Nm
.Op Fl a | Fl -addresses
.Op Fl b Ar target | Fl -target Ns = Ns Ar target
.Op Fl e Ar pathname | Fl -exe Ns = Ns Ar pathname
.Op Fl f | Fl -functions
.Op Fl i | Fl -inlines
.Op Fl j Ar sectionname | Fl -section Ns = Ns Ar sectionname
.Op Fl p | Fl -pretty-print
.Op Fl s | Fl -basename
.Op Fl C | Fl -demangle
.Op Fl H | Fl -help
@@ -69,6 +72,8 @@ The
.Nm
utility recognizes the following options:
.Bl -tag -width indent
.It Fl a | Fl -addresses
Display the address prior to the line number information.
.It Fl b Ar target | Fl -target Ns = Ns Ar target
This option is recognized by
.Nm
@@ -84,11 +89,17 @@ will use the file
.Dq Pa a.out .
.It Fl f | Fl -functions
Display function names in addition to file and line number information.
.It Fl i | Fl -inlines
If the address specified belongs to an inlined function, also display the line
number information for its caller, recursively until the first non-inlined
caller.
.It Fl j Ar sectionname | Fl -section Ns = Ns Ar sectionname
The values specified by arguments
.Ar hexaddress
are to be treated as offsets into the section named
.Ar sectionname .
.It Fl p | -pretty-print
Display the line number information on one line, in human readable manner.
.It Fl s | -basename
Display only the base name for each file name.
.It Fl C | Fl -demangle
@@ -115,6 +126,18 @@ to program address
.Ar hexaddress ,
followed by a line with the file name and line number.
.Pp
If the
.Fl p
option was specified,
.Nm
will print line number information and function name on one line in
human readable manner. If the
.Fl i
option was also specified,
.Nm
will print the caller function information prefixed with
.Dq (inlined by) .
.Pp
The
.Nm
utility prints the file name and line number using the format

Large diffs are not rendered by default.

@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: elfdefinitions.h 3247 2015-09-22 16:57:51Z emaste $
* $Id: elfdefinitions.h 3253 2015-10-10 18:31:33Z kaiwang27 $
*/

/*
@@ -35,7 +35,7 @@

#include "elfcopy.h"

ELFTC_VCSID("$Id: binary.c 3174 2015-03-27 17:13:41Z emaste $");
ELFTC_VCSID("$Id: binary.c 3270 2015-12-11 18:48:56Z emaste $");

/*
* Convert ELF object to `binary'. Sections with SHF_ALLOC flag set
@@ -140,6 +140,7 @@ create_elf_from_binary(struct elfcopy *ecp, int ifd, const char *ifn)
GElf_Shdr sh;
void *content;
uint64_t off, data_start, data_end, data_size;
char *sym_basename, *p;

/* Reset internal section list. */
if (!TAILQ_EMPTY(&ecp->v_sec))
@@ -210,8 +211,13 @@ create_elf_from_binary(struct elfcopy *ecp, int ifd, const char *ifn)
/* Count in .symtab and .strtab section headers. */
shtab->sz += gelf_fsize(ecp->eout, ELF_T_SHDR, 2, EV_CURRENT);

if ((sym_basename = strdup(ifn)) == NULL)
err(1, "strdup");
p = sym_basename;
while ((p = strchr(p, '.')) != NULL)
*p++ = '_';
#define _GEN_SYMNAME(S) do { \
snprintf(name, sizeof(name), "%s%s%s", "_binary_", ifn, S); \
snprintf(name, sizeof(name), "%s%s%s", "_binary_", sym_basename, S); \
} while (0)

/*
@@ -233,6 +239,7 @@ create_elf_from_binary(struct elfcopy *ecp, int ifd, const char *ifn)
finalize_external_symtab(ecp);
create_symtab_data(ecp);
#undef _GEN_SYMNAME
free(sym_basename);

/*
* Write the underlying ehdr. Note that it should be called
@@ -21,9 +21,9 @@
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id: elfcopy.1 3195 2015-05-12 17:22:19Z emaste $
.\" $Id: elfcopy.1 3266 2015-12-07 15:38:26Z emaste $
.\"
.Dd March 27, 2015
.Dd December 7, 2015
.Os
.Dt ELFCOPY 1
.Sh NAME
@@ -47,6 +47,7 @@
.Op Fl p | Fl -preserve-dates
.Op Fl w | Fl -wildcard
.Op Fl x | Fl -discard-all
.Op Fl -add-gnu-debuglink Ns = Ns Ar filename
.Op Fl -add-section Ar sectionname Ns = Ns Ar filename
.Oo
.Fl -adjust-section-vma Ar section Ns {+|-|=} Ns Ar val |
@@ -165,6 +166,10 @@ Mark the end of a character class.
.El
.It Fl x | Fl -discard-all
Do not copy non-global symbols to the output.
.It Fl -add-gnu-debuglink Ns = Ns Ar filename
Create a .gnu_debuglink section in the output file that references the
debug data in
.Ar filename .
.It Fl -add-section Ar sectionname Ns = Ns Ar filename
Add a new section to the output file with name
.Ar sectionname .
@@ -39,7 +39,7 @@

#include "elfcopy.h"

ELFTC_VCSID("$Id: main.c 3216 2015-05-23 21:16:36Z kaiwang27 $");
ELFTC_VCSID("$Id: main.c 3268 2015-12-07 20:30:55Z emaste $");

enum options
{
@@ -1375,11 +1375,13 @@ Usage: %s [options] infile [outfile]\n\
-w | --wildcard Use shell-style patterns to name symbols.\n\
-x | --discard-all Do not copy non-globals to the output.\n\
-I FORMAT | --input-target=FORMAT\n\
(Accepted but ignored).\n\
Specify object format for the input file.\n\
-K SYM | --keep-symbol=SYM Copy symbol SYM to the output.\n\
-L SYM | --localize-symbol=SYM\n\
Make symbol SYM local to the output file.\n\
-N SYM | --strip-symbol=SYM Do not copy symbol SYM to the output.\n\
-O FORMAT | --output-target=FORMAT\n\
Specify object format for the output file.\n\
-R NAME | --remove-section=NAME\n\
Remove the named section.\n\
-S | --strip-all Remove all symbol and relocation information\n\
@@ -34,7 +34,7 @@

#include "elfcopy.h"

ELFTC_VCSID("$Id: sections.c 3225 2015-06-06 02:35:23Z kaiwang27 $");
ELFTC_VCSID("$Id: sections.c 3272 2015-12-11 20:00:54Z kaiwang27 $");

static void add_gnu_debuglink(struct elfcopy *ecp);
static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc);
@@ -457,11 +457,17 @@ create_scn(struct elfcopy *ecp)

/*
* If strip action is STRIP_NONDEBUG(only keep debug),
* change sections flags of loadable sections to SHF_NOBITS,
* and the content of those sections will be ignored.
* change sections type of loadable sections and section
* groups to SHT_NOBITS, and the content of those sections
* will be discarded. However, SHT_NOTE sections should
* be kept.
*/
if (ecp->strip == STRIP_NONDEBUG && (ish.sh_flags & SHF_ALLOC))
s->type = SHT_NOBITS;
if (ecp->strip == STRIP_NONDEBUG) {
if (((ish.sh_flags & SHF_ALLOC) ||
(ish.sh_flags & SHF_GROUP)) &&
ish.sh_type != SHT_NOTE)
s->type = SHT_NOBITS;
}

check_section_rename(ecp, s);

@@ -34,7 +34,7 @@

#include "elfcopy.h"

ELFTC_VCSID("$Id: segments.c 3196 2015-05-12 17:33:48Z emaste $");
ELFTC_VCSID("$Id: segments.c 3269 2015-12-11 18:38:43Z kaiwang27 $");

static void insert_to_inseg_list(struct segment *seg, struct section *sec);

@@ -77,8 +77,6 @@ add_to_inseg_list(struct elfcopy *ecp, struct section *s)
if (s->off + s->sz > seg->off + seg->fsz &&
s->type != SHT_NOBITS)
continue;
if (s->off + s->sz > seg->off + seg->msz)
continue;
if (s->vma + s->sz > seg->addr + seg->msz)
continue;

@@ -32,7 +32,7 @@

#include "_libelf.h"

ELFTC_VCSID("$Id: elf_data.c 3177 2015-03-30 18:19:41Z emaste $");
ELFTC_VCSID("$Id: elf_data.c 3258 2015-11-20 18:59:43Z emaste $");

Elf_Data *
elf_getdata(Elf_Scn *s, Elf_Data *ed)
@@ -253,6 +253,12 @@ elf_rawdata(Elf_Scn *s, Elf_Data *ed)
return (NULL);
}

if (sh_type != SHT_NOBITS &&
sh_offset + sh_size > (uint64_t) e->e_rawsize) {
LIBELF_SET_ERROR(SECTION, 0);
return (NULL);
}

if ((d = _libelf_allocate_data(s)) == NULL)
return (NULL);

Large diffs are not rendered by default.

@@ -1,4 +1,4 @@
.Dd June 7, 2012 \" DATE
.Dd December 16, 2015 \" DATE
.Dt LLDB 1 \" Program name and manual section number
.Os
.Sh NAME \" Section Header - required - don't modify
@@ -8,6 +8,7 @@
.Nm lldb
.Op Fl hvdexw
.Op Fl a Ar arch
.Op Fl c Ar core-file
.Op Fl l Ar script-language
.Op Fl s Ar lldb-commands
.Op Fl n Ar process-name
@@ -52,6 +53,8 @@ to it as early in the process-launch as possible.
Specifies a currently running process that
.Nm
should attach to.
.It Fl c, -core Ar core-file
Specifies the core file to examine.
.It Fl l, -script-language Ar language
Tells the debugger to use the specified scripting language for
user-defined scripts, rather than the default. Valid scripting
@@ -24,6 +24,7 @@
* Be sure to escape strings.
*/

LINE("lib80211", "802.11 Wireless Network Management Library (lib80211, \\-l80211)")
LINE("libarchive", "Streaming Archive Library (libarchive, \\-larchive)")
LINE("libarm", "ARM Architecture Library (libarm, \\-larm)")
LINE("libarm32", "ARM32 Architecture Library (libarm32, \\-larm32)")
@@ -110,6 +111,7 @@ LINE("libsdp", "Bluetooth Service Discovery Protocol User Library (libsdp, \\-l
LINE("libssp", "Buffer Overflow Protection Library (libssp, \\-lssp)")
LINE("libstdthreads", "C11 Threads Library (libstdthreads, \\-lstdthreads)")
LINE("libSystem", "System Library (libSystem, \\-lSystem)")
LINE("libsysdecode", "System Argument Decoding Library (libsysdecode, \\-lsysdecode)")
LINE("libtacplus", "TACACS+ Client Library (libtacplus, \\-ltacplus)")
LINE("libtcplay", "TrueCrypt-compatible API library (libtcplay, \\-ltcplay)")
LINE("libtermcap", "Termcap Access Library (libtermcap, \\-ltermcap)")
@@ -5,7 +5,7 @@

PROG= ibaddr
SRCS= ibaddr.c ibdiag_common.c
LDADD= -libumad -libcommon -libmad
LIBADD= ibumad ibcommon ibmad
CFLAGS+= -I${DIAGPATH}/include
MAN= ibaddr.8

@@ -5,8 +5,8 @@

PROG= ibnetdiscover
SRCS= ibnetdiscover.c grouping.c ibdiag_common.c
LDADD= -libumad -libcommon -libmad -losmcomp
CFLAGS+= -pthread -I${DIAGPATH}/include
LIBADD= ibumad ibcommon ibmad osmcomp pthread
CFLAGS+= -I${DIAGPATH}/include
MAN= ibnetdiscover.8

WARNS?= 1
@@ -5,7 +5,7 @@

PROG= ibping
SRCS= ibping.c ibdiag_common.c
LDADD= -libumad -libcommon -libmad
LIBADD= ibumad ibcommon ibmad
CFLAGS+= -I${DIAGPATH}/include
MAN= ibping.8

@@ -5,7 +5,7 @@

PROG= ibportstate
SRCS= ibportstate.c ibdiag_common.c
LDADD= -libumad -libcommon -libmad
LIBADD= ibumad ibcommon ibmad
CFLAGS+= -I${DIAGPATH}/include
MAN= ibportstate.8

@@ -5,8 +5,8 @@

PROG= ibroute
SRCS= ibroute.c ibdiag_common.c
LDADD= -libumad -libcommon -libmad -losmcomp
CFLAGS+= -pthread -I${DIAGPATH}/include
LIBADD= ibumad ibcommon ibmad osmcomp pthread
CFLAGS+= -I${DIAGPATH}/include
MAN= ibroute.8

WARNS?= 1
@@ -5,7 +5,7 @@

PROG= ibsendtrap
SRCS= ibsendtrap.c ibdiag_common.c
LDADD= -libumad -libcommon -libmad
LIBADD= ibumad ibcommon ibmad
CFLAGS+= -I${DIAGPATH}/include
MAN=

@@ -5,7 +5,7 @@

PROG= ibstat
SRCS= ibstat.c
LDADD= -libumad -libcommon
LIBADD= ibumad ibcommon
CFLAGS+= -I${DIAGPATH}/include
MAN= ibstat.8

@@ -5,7 +5,7 @@

PROG= ibsysstat
SRCS= ibsysstat.c ibdiag_common.c
LDADD= -libumad -libcommon -libmad
LIBADD= ibumad ibcommon ibmad
CFLAGS+= -I${DIAGPATH}/include
MAN= ibsysstat.8

@@ -5,8 +5,8 @@

PROG= ibtracert
SRCS= ibtracert.c ibdiag_common.c
LDADD= -libumad -libcommon -libmad -losmcomp
CFLAGS+= -pthread -I${DIAGPATH}/include
LIBADD= ibumad ibcommon ibmad osmcomp pthread
CFLAGS+= -I${DIAGPATH}/include
MAN= ibtracert.8

WARNS?= 1
@@ -29,8 +29,7 @@ SRCS+= osm_vl_arb_rcv.c st.c osm_perfmgr.c osm_perfmgr_db.c osm_event_plugin.c
SRCS+= osm_dump.c osm_ucast_cache.c osm_qos_parser_y.y osm_qos_parser_l.l
SRCS+= osm_qos_policy.c

LDADD= -lopensm -losmvendor -losmcomp -libmad -libumad -libcommon
CFLAGS+= -pthread
LIBADD= opensm osmvendor osmcomp ibmad ibumad ibcommon pthread
CFLAGS+= -DVENDOR_RMPP_SUPPORT -DDUAL_SIDED_RMPP

MAN= opensm.8
@@ -16,14 +16,7 @@ SRCS= main.c \
osmt_slvl_vl_arb.c \
osmtest.c

LDADD= -libcommon \
-libmad \
-libumad \
-losmvendor \
-losmcomp \
-lopensm \

LIBADD+= pthread
LIBADD= ibcommon ibmad ibumad osmvendor osmcomp opensm pthread

CFLAGS= -DVENDOR_RMPP_SUPPORT -DDUAL_SIDED_RMPP \
-I${OPENSM}/osmtest/include
@@ -5,7 +5,7 @@

PROG= perfquery
SRCS= perfquery.c ibdiag_common.c
LDADD= -libumad -libcommon -libmad
LIBADD= ibumad ibcommon ibmad
CFLAGS+= -I${DIAGPATH}/include
MAN= perfquery.8

@@ -5,10 +5,9 @@

PROG= saquery
SRCS= saquery.c ibdiag_common.c
LDADD= -libumad -libcommon -libmad -losmcomp -losmvendor -lopensm
LIBADD= ibumad ibcommon ibmad osmcomp osmvendor opensm pthread
CFLAGS+= -I${DIAGPATH}/include
CFLAGS+= -DOSM_VENDOR_INTF_OPENIB -DVENDOR_RMPP_SUPPORT -DDUAL_SIDED_RMPP
CFLAGS+= -pthread
MAN= saquery.8

WARNS?= 1
@@ -5,7 +5,7 @@

PROG= sminfo
SRCS= sminfo.c ibdiag_common.c
LDADD= -libumad -libcommon -libmad
LIBADD= ibumad ibcommon ibmad
CFLAGS+= -I${DIAGPATH}/include
MAN= sminfo.8

@@ -5,7 +5,7 @@

PROG= smpdump
SRCS= smpdump.c
LDADD= -libumad -libcommon -libmad
LIBADD= ibumad ibcommon ibmad
CFLAGS+= -I${DIAGPATH}/include
MAN= smpdump.8

@@ -5,8 +5,8 @@

PROG= smpquery
SRCS= smpquery.c ibdiag_common.c
LDADD= -libumad -libcommon -libmad -losmcomp
CFLAGS+= -pthread -I${DIAGPATH}/include
LIBADD= ibumad ibcommon ibmad osmcomp pthread
CFLAGS+= -I${DIAGPATH}/include
MAN= smpquery.8

WARNS?= 1
@@ -5,7 +5,7 @@

PROG= vendstat
SRCS= vendstat.c ibdiag_common.c
LDADD= -libumad -libcommon -libmad
LIBADD= ibumad ibcommon ibmad
CFLAGS+= -I${DIAGPATH}/include
MAN= vendstat.8

@@ -15,22 +15,22 @@ It is a complete, kernel side implementation of SMB requester and filesystem.

Darwin maintained in the Darwin's tree.

I'm would be very grateful for any feedback, bug reports etc.
I would be very grateful for any feedback, bug reports etc.

Supported SMB servers:
Samba
Windows 95/98/ME/2000/NT4.0 (SPs 4, 5, 6)
IBM LanManager
NetApp

An updated versions of this package can be retrieved from ftp server:
An updated version of this package can be retrieved from ftp server:

ftp://ftp.butya.kz/pub/smbfs/smbfs.tar.gz

Perfomance
Performance
==========

There is some perfomance benchmarks over 10Mbit network:
These are some performance benchmarks over a 10Mbit network:

Win95 machine as server:
IOZONE: auto-test mode
@@ -19,10 +19,10 @@
*
* Defined types: load_avg for load averages, pctcpu for cpu percentages.
*/
#if defined(mips) && !defined(NetBSD)
#if defined(mips) && !(defined(NetBSD) || defined(FreeBSD))
# include <sys/fixpoint.h>
# if defined(FBITS) && !defined(FSCALE)
# define FSCALE (1 << FBITS) /* mips */
# define FSCALE (1 << FBITS) /* RISC/os on mips */
# endif
#endif

@@ -0,0 +1,38 @@
*.lo
*.o
/.libs/
/Makefile
/autom4te.cache/
/config.h
/config.log
/config.status
/dnstap/dnstap_config.h
/doc/example.conf
/doc/libunbound.3
/doc/unbound-anchor.8
/doc/unbound-checkconf.8
/doc/unbound-control.8
/doc/unbound-host.1
/doc/unbound.8
/doc/unbound.conf.5
/libtool
/libunbound.la
/smallapp/unbound-control-setup.sh
/unbound
/unbound-anchor
/unbound-checkconf
/unbound-control
/unbound-control-setup
/unbound-host
/unbound.h
/asynclook
/delayer
/lock-verify
/memstats
/perf
/petal
/pktview
/streamtcp
/testbound
/unittest

Large diffs are not rendered by default.

@@ -2,7 +2,9 @@
# Copyright 2009, Wouter Wijngaards, NLnet Labs.
# BSD licensed.
#
# Version 28
# Version 30
# 2015-11-18 spelling check fix.
# 2015-11-05 ACX_SSL_CHECKS no longer adds -ldl needlessly.
# 2015-08-28 ACX_CHECK_PIE and ACX_CHECK_RELRO_NOW added.
# 2015-03-17 AHX_CONFIG_REALLOCARRAY added
# 2013-09-19 FLTO help text improved.
@@ -24,7 +26,7 @@
# 2010-07-02 Add check for ss_family (for minix).
# 2010-04-26 Fix to use CPPFLAGS for CHECK_COMPILER_FLAGS.
# 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end.
# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS seperate, -ldl
# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS separate, -ldl
# 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN
# 2010-01-20 added AHX_COONFIG_STRLCAT
# 2009-07-14 U_CHAR detection improved for windows crosscompile.
@@ -715,12 +717,6 @@ AC_DEFUN([ACX_SSL_CHECKS], [
fi
AC_SUBST(HAVE_SSL)
AC_SUBST(RUNTIME_PATH)
# openssl engine functionality needs dlopen().
BAKLIBS="$LIBS"
AC_SEARCH_LIBS([dlopen], [dl])
if test "$LIBS" != "$BAKLIBS"; then
LIBSSL_LIBS="$LIBSSL_LIBS -ldl"
fi
fi
AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT])
@@ -26,7 +26,9 @@
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -46,7 +46,12 @@
#include <errno.h>
#include <unistd.h>
#include <time.h>

#if defined(HAVE_SSL)
#include <openssl/sha.h>
#elif defined(HAVE_NETTLE)
#include <nettle/sha.h>
#endif

#include <linux/types.h>
#include <linux/random.h>
@@ -67,9 +72,21 @@
HD(b); \
} while (0)

#if defined(HAVE_SSL)
#define CRYPTO_SHA512_CTX SHA512_CTX
#define CRYPTO_SHA512_INIT(x) SHA512_Init(x)
#define CRYPTO_SHA512_FINAL(r, c) SHA512_Final(r, c)
#define HR(x, l) (SHA512_Update(&ctx, (char *)(x), (l)))
#define HD(x) (SHA512_Update(&ctx, (char *)&(x), sizeof (x)))
#define HF(x) (SHA512_Update(&ctx, (char *)&(x), sizeof (void*)))
#elif defined(HAVE_NETTLE)
#define CRYPTO_SHA512_CTX struct sha512_ctx
#define CRYPTO_SHA512_INIT(x) sha512_init(x)
#define CRYPTO_SHA512_FINAL(r, c) sha512_digest(c, SHA512_DIGEST_SIZE, r)
#define HR(x, l) (sha512_update(&ctx, (l), (uint8_t *)(x)))
#define HD(x) (sha512_update(&ctx, sizeof (x), (uint8_t *)&(x)))
#define HF(x) (sha512_update(&ctx, sizeof (void*), (uint8_t *)&(x)))
#endif

int getentropy(void *buf, size_t len);

@@ -122,7 +139,7 @@ getentropy(void *buf, size_t len)
* Try to use sysctl CTL_KERN, KERN_RANDOM, RANDOM_UUID.
* sysctl is a failsafe API, so it guarantees a result. This
* should work inside a chroot, or when file descriptors are
* exhuasted.
* exhausted.
*
* However this can fail if the Linux kernel removes support
* for sysctl. Starting in 2007, there have been efforts to
@@ -337,7 +354,7 @@ getentropy_fallback(void *buf, size_t len)
struct rusage ru;
sigset_t sigset;
struct stat st;
SHA512_CTX ctx;
CRYPTO_SHA512_CTX ctx;
static pid_t lastpid;
pid_t pid;
size_t i, ii, m;
@@ -354,7 +371,7 @@ getentropy_fallback(void *buf, size_t len)
}
for (i = 0; i < len; ) {
int j;
SHA512_Init(&ctx);
CRYPTO_SHA512_INIT(&ctx);
for (j = 0; j < repeat; j++) {
HX((e = gettimeofday(&tv, NULL)) == -1, tv);
if (e != -1) {
@@ -526,7 +543,7 @@ getentropy_fallback(void *buf, size_t len)
# endif
#endif /* HAVE_GETAUXVAL */

SHA512_Final(results, &ctx);
CRYPTO_SHA512_FINAL(results, &ctx);
memcpy((char*)buf + i, results, min(sizeof(results), len - i));
i += min(sizeof(results), len - i);
}
@@ -30,7 +30,9 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <stdlib.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <stdio.h>
#include <termios.h>
#include <fcntl.h>
@@ -39,10 +41,14 @@
#include <errno.h>
#include <unistd.h>
#include <time.h>
#ifdef HAVE_SYS_SHA2_H
#include <sys/sha2.h>
#define SHA512_Init SHA512Init
#define SHA512_Update SHA512Update
#define SHA512_Final SHA512Final
#else
#include "openssl/sha.h"
#endif

#include <sys/vfs.h>
#include <sys/statfs.h>
@@ -0,0 +1,45 @@
/* isblank - compatibility implementation of isblank
*
* Copyright (c) 2015, NLnet Labs. All rights reserved.
*
* This software is open source.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of the NLNET LABS nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "config.h"

/* return true for a blank character: space or tab */
int isblank(int c);

/* implementation of isblank. unsigned char is the argument */
int
isblank(int c)
{
return (c==' ' || c=='\t');
}
@@ -18,7 +18,10 @@
#include "config.h"
#include <sys/types.h>
#include <errno.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <limits.h>
#include <stdlib.h>

/*
@@ -70,7 +70,7 @@ unsigned char *SHA512(void *data, unsigned int data_len, unsigned char *digest);
* Please make sure that your system defines BYTE_ORDER. If your
* architecture is little-endian, make sure it also defines
* LITTLE_ENDIAN and that the two (BYTE_ORDER and LITTLE_ENDIAN) are
* equivilent.
* equivalent.
*
* If your system does not define the above, then you can do so by
* hand like this:
@@ -42,6 +42,7 @@
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <limits.h>

/* for test */
/* #define SNPRINTF_TEST 1 */
@@ -428,7 +429,7 @@ print_num_llp(char** at, size_t* left, int* ret, void* value,
char buf[PRINT_DEC_BUFSZ];
int negative = 0;
int zero = (value == 0);
#if defined(UINTPTR_MAX) && defined(UINT32_MAX) && (UINTPTR_MAX == UINT32_MAX)
#if defined(SIZE_MAX) && defined(UINT32_MAX) && (UINT32_MAX == SIZE_MAX || INT32_MAX == SIZE_MAX)
/* avoid warning about upcast on 32bit systems */
unsigned long long llvalue = (unsigned long)value;
#else
@@ -85,7 +85,7 @@

/* Define to 1 if you have the declaration of `SSL_CTX_set_ecdh_auto', and to
0 if you don't. */
#define HAVE_DECL_SSL_CTX_SET_ECDH_AUTO 0
#define HAVE_DECL_SSL_CTX_SET_ECDH_AUTO 1

/* Define to 1 if you have the declaration of `strlcat', and to 0 if you
don't. */
@@ -95,6 +95,10 @@
don't. */
/* #undef HAVE_DECL_STRLCPY */

/* Define to 1 if you have the declaration of `XML_StopParser', and to 0 if
you don't. */
#define HAVE_DECL_XML_STOPPARSER 1

/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1

@@ -152,6 +156,9 @@
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#define HAVE_FSEEKO 1

/* Define to 1 if you have the `fsync' function. */
#define HAVE_FSYNC 1

/* Whether getaddrinfo is available */
#define HAVE_GETADDRINFO 1

@@ -206,6 +213,9 @@
/* Define to 1 if you have the <iphlpapi.h> header file. */
/* #undef HAVE_IPHLPAPI_H */

/* Define to 1 if you have the `isblank' function. */
#define HAVE_ISBLANK 1

/* Define to 1 if you have the `kill' function. */
#define HAVE_KILL 1

@@ -233,6 +243,9 @@
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1

/* Use libnettle for crypto */
/* #undef HAVE_NETTLE */

/* Use libnss for crypto */
/* #undef HAVE_NSS */

@@ -497,7 +510,7 @@
#define PACKAGE_NAME "unbound"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "unbound 1.5.5"
#define PACKAGE_STRING "unbound 1.5.7"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "unbound"
@@ -506,7 +519,7 @@
#define PACKAGE_URL ""

/* Define to the version of this package. */
#define PACKAGE_VERSION "1.5.5"
#define PACKAGE_VERSION "1.5.7"

/* default pidfile location */
#define PIDFILE "/var/unbound/unbound.pid"
@@ -525,7 +538,7 @@
#define ROOT_CERT_FILE "/var/unbound/icannbundle.pem"

/* version number for resource files */
#define RSRC_PACKAGE_VERSION 1,5,5,0
#define RSRC_PACKAGE_VERSION 1,5,7,0

/* Directory to chdir to */
#define RUN_DIR "/var/unbound"
@@ -536,6 +549,9 @@
/* The size of `time_t', as computed by sizeof. */
#define SIZEOF_TIME_T 8

/* define if (v)snprintf does not return length needed, (but length used) */
/* #undef SNPRINTF_RET_BROKEN */

/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1

@@ -570,7 +586,7 @@
/* #undef USE_ECDSA_EVP_WORKAROUND */

/* Define this to enable GOST support. */
/* #undef USE_GOST */
#define USE_GOST 1

/* Define if you want to use internal select based events */
#define USE_MINI_EVENT 1
@@ -849,15 +865,13 @@
#define MAXHOSTNAMELEN 256
#endif


#ifndef HAVE_SNPRINTF
#if !defined(HAVE_SNPRINTF) || defined(SNPRINTF_RET_BROKEN)
#define snprintf snprintf_unbound
#define vsnprintf vsnprintf_unbound
#include <stdarg.h>
int snprintf (char *str, size_t count, const char *fmt, ...);
int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
#endif /* HAVE_SNPRINTF */

#endif /* HAVE_SNPRINTF or SNPRINTF_RET_BROKEN */

#ifndef HAVE_INET_PTON
#define inet_pton inet_pton_unbound
@@ -953,6 +967,11 @@ int memcmp(const void *x, const void *y, size_t n);
char *ctime_r(const time_t *timep, char *buf);
#endif

#ifndef HAVE_ISBLANK
#define isblank unbound_isblank
int isblank(int c);
#endif

#if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS)
#define strptime unbound_strptime
struct tm;
@@ -94,6 +94,10 @@
don't. */
#undef HAVE_DECL_STRLCPY

/* Define to 1 if you have the declaration of `XML_StopParser', and to 0 if
you don't. */
#undef HAVE_DECL_XML_STOPPARSER

/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H

@@ -151,6 +155,9 @@
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO

/* Define to 1 if you have the `fsync' function. */
#undef HAVE_FSYNC

/* Whether getaddrinfo is available */
#undef HAVE_GETADDRINFO

@@ -205,6 +212,9 @@
/* Define to 1 if you have the <iphlpapi.h> header file. */
#undef HAVE_IPHLPAPI_H

/* Define to 1 if you have the `isblank' function. */
#undef HAVE_ISBLANK

/* Define to 1 if you have the `kill' function. */
#undef HAVE_KILL

@@ -232,6 +242,9 @@
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H

/* Use libnettle for crypto */
#undef HAVE_NETTLE

/* Use libnss for crypto */
#undef HAVE_NSS

@@ -535,6 +548,9 @@
/* The size of `time_t', as computed by sizeof. */
#undef SIZEOF_TIME_T

/* define if (v)snprintf does not return length needed, (but length used) */
#undef SNPRINTF_RET_BROKEN

/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

@@ -848,15 +864,13 @@
#define MAXHOSTNAMELEN 256
#endif


#ifndef HAVE_SNPRINTF
#if !defined(HAVE_SNPRINTF) || defined(SNPRINTF_RET_BROKEN)
#define snprintf snprintf_unbound
#define vsnprintf vsnprintf_unbound
#include <stdarg.h>
int snprintf (char *str, size_t count, const char *fmt, ...);
int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
#endif /* HAVE_SNPRINTF */

#endif /* HAVE_SNPRINTF or SNPRINTF_RET_BROKEN */

#ifndef HAVE_INET_PTON
#define inet_pton inet_pton_unbound
@@ -952,6 +966,11 @@ int memcmp(const void *x, const void *y, size_t n);
char *ctime_r(const time_t *timep, char *buf);
#endif

#ifndef HAVE_ISBLANK
#define isblank unbound_isblank
int isblank(int c);
#endif

#if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS)
#define strptime unbound_strptime
struct tm;
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for unbound 1.5.5.
# Generated by GNU Autoconf 2.69 for unbound 1.5.7.
#
# Report bugs to <unbound-bugs@nlnetlabs.nl>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='unbound'
PACKAGE_TARNAME='unbound'
PACKAGE_VERSION='1.5.5'
PACKAGE_STRING='unbound 1.5.5'
PACKAGE_VERSION='1.5.7'
PACKAGE_STRING='unbound 1.5.7'
PACKAGE_BUGREPORT='unbound-bugs@nlnetlabs.nl'
PACKAGE_URL=''

@@ -661,6 +661,7 @@ CHECKLOCK_OBJ
staticexe
UNBOUND_EVENT_UNINSTALL
UNBOUND_EVENT_INSTALL
SSLLIB
HAVE_SSL
CONFIG_DATE
NETBSD_LINTFLAGS
@@ -823,6 +824,7 @@ with_solaris_threads
with_pyunbound
with_pythonmodule
with_nss
with_nettle
with_ssl
enable_sha2
enable_gost
@@ -1391,7 +1393,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures unbound 1.5.5 to adapt to many kinds of systems.
\`configure' configures unbound 1.5.7 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

@@ -1456,7 +1458,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of unbound 1.5.5:";;
short | recursive ) echo "Configuration of unbound 1.5.7:";;
esac
cat <<\_ACEOF

@@ -1534,6 +1536,7 @@ Optional Packages:
--with-pythonmodule build Python module, or --without-pythonmodule to
disable script engine. (default=no)
--with-nss=path use libnss instead of openssl, installed at path.
--with-nettle=path use libnettle as crypto library, installed at path.
--with-ssl=pathname enable SSL (will check /usr/local/ssl /usr/lib/ssl
/usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw
/usr)
@@ -1635,7 +1638,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
unbound configure 1.5.5
unbound configure 1.5.7
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2344,7 +2347,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by unbound $as_me 1.5.5, which was
It was created by unbound $as_me 1.5.7, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
@@ -2696,11 +2699,11 @@ UNBOUND_VERSION_MAJOR=1

UNBOUND_VERSION_MINOR=5

UNBOUND_VERSION_MICRO=5
UNBOUND_VERSION_MICRO=7


LIBUNBOUND_CURRENT=5
LIBUNBOUND_REVISION=8
LIBUNBOUND_REVISION=10
LIBUNBOUND_AGE=3
# 1.0.0 had 0:12:0
# 1.0.1 had 0:13:0
@@ -2745,6 +2748,8 @@ LIBUNBOUND_AGE=3
# 1.5.3 had 5:6:3
# 1.5.4 had 5:7:3
# 1.5.5 had 5:8:3
# 1.5.6 had 5:9:3
# 1.5.7 had 5:10:3

# Current -- the number of the binary API that we're implementing
# Revision -- which iteration of the implementation of the binary
@@ -16406,13 +16411,44 @@ $as_echo "#define HAVE_NSS 1" >>confdefs.h
CPPFLAGS="-I/usr/include/nspr4 $CPPFLAGS"
fi
LIBS="$LIBS -lnss3 -lnspr4"
SSLLIB=""


fi


# libnettle
USE_NETTLE="no"

# Check whether --with-nettle was given.
if test "${with_nettle+set}" = set; then :
withval=$with_nettle;
USE_NETTLE="yes"

$as_echo "#define HAVE_NETTLE 1" >>confdefs.h

if test "$withval" != "" -a "$withval" != "yes"; then
CPPFLAGS="$CPPFLAGS -I$withval/include/nettle"
LDFLAGS="$LDFLAGS -L$withval/lib"

if test "x$enable_rpath" = xyes; then
if echo "$withval/lib" | grep "^/" >/dev/null; then
RUNTIME_PATH="$RUNTIME_PATH -R$withval/lib"
fi
fi

else
CPPFLAGS="$CPPFLAGS -I/usr/include/nettle"
fi
LIBS="$LIBS -lhogweed -lnettle -lgmp"
SSLLIB=""


fi


# openssl
if test $USE_NSS = "no"; then
if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then


# Check whether --with-ssl was given.
@@ -16581,67 +16617,6 @@ rm -f core conftest.err conftest.$ac_objext \
fi


# openssl engine functionality needs dlopen().
BAKLIBS="$LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
$as_echo_n "checking for library containing dlopen... " >&6; }
if ${ac_cv_search_dlopen+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char dlopen ();
int
main ()
{
return dlopen ();
;
return 0;
}
_ACEOF
for ac_lib in '' dl; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_dlopen=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_dlopen+:} false; then :
break
fi
done
if ${ac_cv_search_dlopen+:} false; then :

else
ac_cv_search_dlopen=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5
$as_echo "$ac_cv_search_dlopen" >&6; }
ac_res=$ac_cv_search_dlopen
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"

fi

if test "$LIBS" != "$BAKLIBS"; then
LIBSSL_LIBS="$LIBSSL_LIBS -ldl"
fi
fi
for ac_header in openssl/ssl.h
do :
@@ -16779,6 +16754,7 @@ fi
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
SSLLIB="-lssl"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LibreSSL" >&5
$as_echo_n "checking for LibreSSL... " >&6; }
if grep VERSION_TEXT $ssldir/include/openssl/opensslv.h | grep "LibreSSL" >/dev/null; then
@@ -16976,6 +16952,7 @@ _ACEOF
fi



# Check whether --enable-sha2 was given.
if test "${enable_sha2+set}" = set; then :
enableval=$enable_sha2;
@@ -16999,7 +16976,7 @@ if test "${enable_gost+set}" = set; then :
fi

use_gost="no"
if test $USE_NSS = "no"; then
if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then
case "$enable_gost" in
no)
;;
@@ -17152,7 +17129,7 @@ case "$enable_ecdsa" in
no)
;;
*)
if test $USE_NSS = "no"; then
if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then
ac_fn_c_check_func "$LINENO" "ECDSA_sign" "ac_cv_func_ECDSA_sign"
if test "x$ac_cv_func_ECDSA_sign" = xyes; then :

@@ -17643,6 +17620,20 @@ fi

done

ac_fn_c_check_decl "$LINENO" "XML_StopParser" "ac_cv_have_decl_XML_StopParser" "$ac_includes_default
#include <expat.h>

"
if test "x$ac_cv_have_decl_XML_StopParser" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi

cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_XML_STOPPARSER $ac_have_decl
_ACEOF


# set static linking if requested

@@ -18100,7 +18091,7 @@ if test "$ac_res" != no; then :

fi

for ac_func in tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill chown sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent
for ac_func in tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill chown sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent fsync
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -18221,6 +18212,48 @@ esac
fi


# test if snprintf return the proper length
if test "x$ac_cv_func_snprintf" = xyes; then
if test c${cross_compiling} = cno; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for correct snprintf return value" >&5
$as_echo_n "checking for correct snprintf return value... " >&6; }
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default

int main(void) { return !(snprintf(NULL, 0, "test") == 4); }

_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }

$as_echo "#define SNPRINTF_RET_BROKEN /**/" >>confdefs.h

case " $LIBOBJS " in
*" snprintf.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS snprintf.$ac_objext"
;;
esac


fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

fi
fi
ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat"
if test "x$ac_cv_func_strlcat" = xyes; then :
$as_echo "#define HAVE_STRLCAT 1" >>confdefs.h
@@ -18277,6 +18310,20 @@ esac
fi


ac_fn_c_check_func "$LINENO" "isblank" "ac_cv_func_isblank"
if test "x$ac_cv_func_isblank" = xyes; then :
$as_echo "#define HAVE_ISBLANK 1" >>confdefs.h

else
case " $LIBOBJS " in
*" isblank.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS isblank.$ac_objext"
;;
esac

fi


LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"

ac_fn_c_check_func "$LINENO" "reallocarray" "ac_cv_func_reallocarray"
@@ -19017,7 +19064,7 @@ _ACEOF



version=1.5.5
version=1.5.7

date=`date +'%b %e, %Y'`

@@ -19532,7 +19579,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by unbound $as_me 1.5.5, which was
This file was extended by unbound $as_me 1.5.7, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
@@ -19598,7 +19645,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
unbound config.status 1.5.5
unbound config.status 1.5.7
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

@@ -10,14 +10,14 @@ sinclude(dnstap/dnstap.m4)
# must be numbers. ac_defun because of later processing
m4_define([VERSION_MAJOR],[1])
m4_define([VERSION_MINOR],[5])
m4_define([VERSION_MICRO],[5])
m4_define([VERSION_MICRO],[7])
AC_INIT(unbound, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), unbound-bugs@nlnetlabs.nl, unbound)
AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR])
AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR])
AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO])

LIBUNBOUND_CURRENT=5
LIBUNBOUND_REVISION=8
LIBUNBOUND_REVISION=10
LIBUNBOUND_AGE=3
# 1.0.0 had 0:12:0
# 1.0.1 had 0:13:0
@@ -62,6 +62,8 @@ LIBUNBOUND_AGE=3
# 1.5.3 had 5:6:3
# 1.5.4 had 5:7:3
# 1.5.5 had 5:8:3
# 1.5.6 had 5:9:3
# 1.5.7 had 5:10:3

# Current -- the number of the binary API that we're implementing
# Revision -- which iteration of the implementation of the binary
@@ -561,13 +563,34 @@ AC_ARG_WITH([nss], AC_HELP_STRING([--with-nss=path],
CPPFLAGS="-I/usr/include/nspr4 $CPPFLAGS"
fi
LIBS="$LIBS -lnss3 -lnspr4"
SSLLIB=""
]
)

# libnettle
USE_NETTLE="no"
AC_ARG_WITH([nettle], AC_HELP_STRING([--with-nettle=path],
[use libnettle as crypto library, installed at path.]),
[
USE_NETTLE="yes"
AC_DEFINE(HAVE_NETTLE, 1, [Use libnettle for crypto])
if test "$withval" != "" -a "$withval" != "yes"; then
CPPFLAGS="$CPPFLAGS -I$withval/include/nettle"
LDFLAGS="$LDFLAGS -L$withval/lib"
ACX_RUNTIME_PATH_ADD([$withval/lib])
else
CPPFLAGS="$CPPFLAGS -I/usr/include/nettle"
fi
LIBS="$LIBS -lhogweed -lnettle -lgmp"
SSLLIB=""
]
)

# openssl
if test $USE_NSS = "no"; then
if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then
ACX_WITH_SSL
ACX_LIB_SSL
SSLLIB="-lssl"
AC_MSG_CHECKING([for LibreSSL])
if grep VERSION_TEXT $ssldir/include/openssl/opensslv.h | grep "LibreSSL" >/dev/null; then
AC_MSG_RESULT([yes])
@@ -602,6 +625,7 @@ AC_INCLUDES_DEFAULT
#include <openssl/evp.h>
])
fi
AC_SUBST(SSLLIB)


AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support]))
@@ -713,7 +737,7 @@ AC_MSG_RESULT($ac_cv_c_gost_works)

AC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support]))
use_gost="no"
if test $USE_NSS = "no"; then
if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then
case "$enable_gost" in
no)
;;
@@ -727,15 +751,15 @@ case "$enable_gost" in
fi
;;
esac
fi dnl !USE_NSS
fi dnl !USE_NSS && !USE_NETTLE

AC_ARG_ENABLE(ecdsa, AC_HELP_STRING([--disable-ecdsa], [Disable ECDSA support]))
use_ecdsa="no"
case "$enable_ecdsa" in
no)
;;
*)
if test $USE_NSS = "no"; then
if test $USE_NSS = "no" -a $USE_NETTLE = "no"; then
AC_CHECK_FUNC(ECDSA_sign, [], [AC_MSG_ERROR([OpenSSL does not support ECDSA: please upgrade or rerun with --disable-ecdsa])])
AC_CHECK_FUNC(SHA384_Init, [], [AC_MSG_ERROR([OpenSSL does not support SHA384: please upgrade or rerun with --disable-ecdsa])])
AC_CHECK_DECLS([NID_X9_62_prime256v1, NID_secp384r1], [], [AC_MSG_ERROR([OpenSSL does not support the ECDSA curves: please upgrade or rerun with --disable-ecdsa])], [AC_INCLUDES_DEFAULT
@@ -881,6 +905,9 @@ if test x_$found_libexpat != x_yes; then
AC_ERROR([Could not find libexpat, expat.h])
fi
AC_CHECK_HEADERS([expat.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_DECLS([XML_StopParser], [], [], [AC_INCLUDES_DEFAULT
#include <expat.h>
])

# set static linking if requested
AC_SUBST(staticexe)
@@ -985,7 +1012,7 @@ AC_INCLUDES_DEFAULT
#endif
])
AC_SEARCH_LIBS([setusercontext], [util])
AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill chown sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent])
AC_CHECK_FUNCS([tzset sigprocmask fcntl getpwnam getrlimit setrlimit setsid sbrk chroot kill chown sleep usleep random srandom recvmsg sendmsg writev socketpair glob initgroups strftime localtime_r setusercontext _beginthreadex endservent endprotoent fsync])
AC_CHECK_FUNCS([setresuid],,[AC_CHECK_FUNCS([setreuid])])
AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])])

@@ -997,10 +1024,25 @@ AC_REPLACE_FUNCS(inet_aton)
AC_REPLACE_FUNCS(inet_pton)
AC_REPLACE_FUNCS(inet_ntop)
AC_REPLACE_FUNCS(snprintf)
# test if snprintf return the proper length
if test "x$ac_cv_func_snprintf" = xyes; then
if test c${cross_compiling} = cno; then
AC_MSG_CHECKING([for correct snprintf return value])
AC_RUN_IFELSE([AC_LANG_SOURCE(AC_INCLUDES_DEFAULT
[[
int main(void) { return !(snprintf(NULL, 0, "test") == 4); }
]])], [AC_MSG_RESULT(yes)], [
AC_MSG_RESULT(no)
AC_DEFINE([SNPRINTF_RET_BROKEN], [], [define if (v)snprintf does not return length needed, (but length used)])
AC_LIBOBJ(snprintf)
])
fi
fi
AC_REPLACE_FUNCS(strlcat)
AC_REPLACE_FUNCS(strlcpy)
AC_REPLACE_FUNCS(memmove)
AC_REPLACE_FUNCS(gmtime_r)
AC_REPLACE_FUNCS(isblank)
dnl without CTIME, ARC4-functions and without reallocarray.
LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"
AC_SUBST(LIBOBJ_WITHOUT_CTIMEARC4)
@@ -1235,7 +1277,13 @@ AHX_CONFIG_FORMAT_ATTRIBUTE
AHX_CONFIG_UNUSED_ATTRIBUTE
AHX_CONFIG_FSEEKO
AHX_CONFIG_MAXHOSTNAMELEN
AHX_CONFIG_SNPRINTF(unbound)
#if !defined(HAVE_SNPRINTF) || defined(SNPRINTF_RET_BROKEN)
#define snprintf snprintf_unbound
#define vsnprintf vsnprintf_unbound
#include <stdarg.h>
int snprintf (char *str, size_t count, const char *fmt, ...);
int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);
#endif /* HAVE_SNPRINTF or SNPRINTF_RET_BROKEN */
AHX_CONFIG_INET_PTON(unbound)
AHX_CONFIG_INET_NTOP(unbound)
AHX_CONFIG_INET_ATON(unbound)
@@ -1258,6 +1306,11 @@ AHX_MEMCMP_BROKEN(unbound)
char *ctime_r(const time_t *timep, char *buf);
#endif

#ifndef HAVE_ISBLANK
#define isblank unbound_isblank
int isblank(int c);
#endif

#if !defined(HAVE_STRPTIME) || !defined(STRPTIME_WORKS)
#define strptime unbound_strptime
struct tm;
@@ -208,12 +208,14 @@ daemon_remote_create(struct config_file* cfg)
return NULL;
}
/* no SSLv2, SSLv3 because has defects */
if(!(SSL_CTX_set_options(rc->ctx, SSL_OP_NO_SSLv2) & SSL_OP_NO_SSLv2)){
if((SSL_CTX_set_options(rc->ctx, SSL_OP_NO_SSLv2) & SSL_OP_NO_SSLv2)
!= SSL_OP_NO_SSLv2){
log_crypto_err("could not set SSL_OP_NO_SSLv2");
daemon_remote_delete(rc);
return NULL;
}
if(!(SSL_CTX_set_options(rc->ctx, SSL_OP_NO_SSLv3) & SSL_OP_NO_SSLv3)){
if((SSL_CTX_set_options(rc->ctx, SSL_OP_NO_SSLv3) & SSL_OP_NO_SSLv3)
!= SSL_OP_NO_SSLv3){
log_crypto_err("could not set SSL_OP_NO_SSLv3");
daemon_remote_delete(rc);
return NULL;
@@ -180,6 +180,8 @@ static void usage()
SSLeay_version(SSLEAY_VERSION)
#elif defined(HAVE_NSS)
NSS_GetVersion()
#elif defined(HAVE_NETTLE)
"nettle"
#endif
);
printf("linked modules:");
@@ -450,6 +452,9 @@ perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
/* endpwent below, in case we need pwd for setusercontext */
}
#endif
#ifdef UB_ON_WINDOWS
w_config_adjust_directory(cfg);
#endif

/* init syslog (as root) if needed, before daemonize, otherwise
* a fork error could not be printed since daemonize closed stderr.*/
@@ -866,11 +866,16 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
goto send_reply;
}
if((ret=parse_edns_from_pkt(c->buffer, &edns)) != 0) {
struct edns_data reply_edns;
verbose(VERB_ALGO, "worker parse edns: formerror.");
log_addr(VERB_CLIENT,"from",&repinfo->addr, repinfo->addrlen);
sldns_buffer_rewind(c->buffer);
LDNS_QR_SET(sldns_buffer_begin(c->buffer));
memset(&reply_edns, 0, sizeof(reply_edns));
reply_edns.edns_present = 1;
reply_edns.udp_size = EDNS_ADVERTISED_SIZE;
LDNS_RCODE_SET(sldns_buffer_begin(c->buffer), ret);
error_encode(c->buffer, ret, &qinfo,
*(uint16_t*)(void *)sldns_buffer_begin(c->buffer),
sldns_buffer_read_u16_at(c->buffer, 2), &reply_edns);
server_stats_insrcode(&worker->stats, c->buffer);
goto send_reply;
}