aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2018-08-11 04:26:29 +0000
committerKyle Evans <kevans@FreeBSD.org>2018-08-11 04:26:29 +0000
commit14b841d4a8e6c25d964f5e3bbda379a1541a27ec (patch)
tree01beba21222007fffb9203b614973505da4d8169 /tools
parent6eeb282e0017163803f12ad57945e00f76c109f8 (diff)
parenta04ed7615ed26cc2c22286b2f4c624dce23a758f (diff)
downloadsrc-14b841d4a8e6c25d964f5e3bbda379a1541a27ec.tar.gz
src-14b841d4a8e6c25d964f5e3bbda379a1541a27ec.zip
MFH @ r337607, in preparation for boarding
Notes
Notes: svn path=/projects/bectl/; revision=337608
Diffstat (limited to 'tools')
-rwxr-xr-xtools/boot/rootgen.sh3
-rwxr-xr-xtools/build/beinstall.sh121
-rw-r--r--tools/build/options/WITH_LLVM_TARGET_BPF5
-rw-r--r--tools/regression/posixsem/posixsem.c35
-rw-r--r--tools/regression/sockets/udp_pingpong/udp_pingpong.c41
-rw-r--r--tools/regression/sockets/unix_cmsg/uc_check_time.c18
-rw-r--r--tools/tools/git/HOWTO7
-rwxr-xr-xtools/tools/git/git-svn-init193
-rw-r--r--tools/tools/nanobsd/pcengines/Files/root/.cshrc2
-rw-r--r--tools/tools/nanobsd/rescue/Files/root/.cshrc6
-rw-r--r--tools/tools/netrate/juggle/juggle.c19
-rw-r--r--tools/tools/netrate/tcpp/tcpp_client.c12
-rw-r--r--tools/tools/sysbuild/sysbuild.sh4
-rw-r--r--tools/tools/syscall_timing/syscall_timing.c12
14 files changed, 335 insertions, 143 deletions
diff --git a/tools/boot/rootgen.sh b/tools/boot/rootgen.sh
index 10142cdbb876..f30c4c4ae4ea 100755
--- a/tools/boot/rootgen.sh
+++ b/tools/boot/rootgen.sh
@@ -799,7 +799,8 @@ echo -h -D -S115200 > ${DESTDIR}/boot.config
cat > ${DESTDIR}/boot/loader.conf <<EOF
console=comconsole
comconsole_speed=115200
-boot_serial=-h
+boot_serial=yes
+boot_multicons=yes
EOF
# XXX
cp /boot/device.hints ${DESTDIR}/boot/device.hints
diff --git a/tools/build/beinstall.sh b/tools/build/beinstall.sh
index a24fc2ad7787..9c0e93491c0d 100755
--- a/tools/build/beinstall.sh
+++ b/tools/build/beinstall.sh
@@ -69,7 +69,7 @@ cleanup() {
errx() {
cleanup
- echo "error: $*"
+ echo "error: $@"
exit 1
}
@@ -78,19 +78,84 @@ rmdir_be() {
rm -rf ${BE_MNTPT}
}
+unmount_be() {
+ mount | grep " on ${BE_MNTPT}" | awk '{print $3}' | sort -r | xargs -t umount -f
+}
+
cleanup_be() {
+ # Before destroying, unmount any child filesystems that may have
+ # been mounted under the boot environment. Sort them in reverse
+ # order so children are unmounted first.
+ unmount_be
+ # Finally, clean up any directories that were created by the
+ # operation, via cleanup_be_dirs().
+ if [ -n "${created_be_dirs}" ]; then
+ chroot ${BE_MNTPT} /bin/rm -rf ${created_be_dirs}
+ fi
beadm destroy -F ${BENAME}
}
+create_be_dirs() {
+ echo "${BE_MNTPT}: Inspecting dirs $*"
+ for dir in $*; do
+ curdir="$dir"
+ topdir="$dir"
+ while :; do
+ [ -e "${BE_MNTPT}${curdir}" ] && break
+ topdir=$curdir
+ curdir=$(dirname ${curdir})
+ done
+ [ "$curdir" = "$dir" ] && continue
+
+ # Add the top-most nonexistent directory to the list, then
+ # mkdir -p the innermost directory specified by the argument.
+ # This way the least number of directories are rm'd directly.
+ created_be_dirs="${topdir} ${created_be_dirs}"
+ echo "${BE_MNTPT}: Created ${dir}"
+ mkdir -p ${BE_MNTPT}${dir} || return $?
+ done
+ return 0
+}
+
+update_mergemaster_pre() {
+ mergemaster -p -m ${srcdir} -D ${BE_MNTPT} -t ${BE_MM_ROOT} ${MERGEMASTER_FLAGS}
+}
+
update_mergemaster() {
- mergemaster -m $(pwd) -D ${BE_MNTPT} -t ${BE_MM_ROOT} ${MERGEMASTER_FLAGS}
+ chroot ${BE_MNTPT} \
+ mergemaster -m ${srcdir} -t ${BE_MM_ROOT} ${MERGEMASTER_FLAGS}
+}
+
+update_etcupdate_pre() {
+ etcupdate -p -s ${srcdir} -D ${BE_MNTPT} ${ETCUPDATE_FLAGS} || return $?
+ etcupdate resolve -D ${BE_MNTPT} || return $?
}
update_etcupdate() {
- etcupdate -s $(pwd) -D ${BE_MNTPT} ${ETCUPDATE_FLAGS} || return $?
- etcupdate resolve -D ${BE_MNTPT}
+ chroot ${BE_MNTPT} \
+ etcupdate -s ${srcdir} ${ETCUPDATE_FLAGS} || return $?
+ chroot ${BE_MNTPT} etcupdate resolve
+}
+
+
+# Special command-line subcommand that can be used to do a full cleanup
+# after a manual post-mortem has been completed.
+postmortem() {
+ [ -n "${BENAME}" ] || errx "Must specify BENAME"
+ [ -n "${BE_MNTPT}" ] || errx "Must specify BE_MNTPT"
+ echo "Performing post-mortem on BE ${BENAME} at ${BE_MNTPT} ..."
+ unmount_be
+ rmdir_be
+ echo "Post-mortem cleanup complete."
+ echo "To destroy the BE (recommended), run: beadm destroy ${BENAME}"
+ echo "To instead continue with the BE, run: beadm activate ${BENAME}"
}
+if [ -n "$BEINSTALL_CMD" ]; then
+ ${BEINSTALL_CMD} $*
+ exit $?
+fi
+
cleanup_commands=""
trap 'errx "Interrupt caught"' HUP INT TERM
@@ -98,6 +163,7 @@ trap 'errx "Interrupt caught"' HUP INT TERM
[ "$(whoami)" != "root" ] && errx "Must be run as root"
[ ! -f "Makefile.inc1" ] && errx "Must be in FreeBSD source tree"
+srcdir=$(pwd)
objdir=$(make -V .OBJDIR 2>/dev/null)
[ ! -d "${objdir}" ] && errx "Must have built FreeBSD from source tree"
@@ -107,16 +173,17 @@ if [ -e .git ] ; then
[ $? -ne 0 ] && errx "Can't lookup git commit timestamp"
commit_ts=$(date -r ${commit_time} '+%Y%m%d.%H%M%S')
elif [ -d .svn ] ; then
- if [ -f /usr/bin/svnlite ]; then
- commit_ts=$( svnlite info --show-item last-changed-date | sed -e 's/\..*//' -e 's/T/./' -e 's/-//g' -e s'/://g' )
- elif [ -f /usr/local/bin/svn ]; then
- commit_ts=$( svn info --show-item last-changed-date | sed -e 's/\..*//' -e 's/T/./' -e 's/-//g' -e s'/://g' )
- else
- errx "Can't lookup Subversion commit timestamp"
- fi
+ if [ -e /usr/bin/svnlite ]; then
+ svn=/usr/bin/svnlite
+ elif [ -e /usr/local/bin/svn ]; then
+ svn=/usr/local/bin/svn
+ else
+ errx "Unable to find subversion"
+ fi
+ commit_ts="$( "$svn" info --show-item last-changed-date | sed -e 's/\..*//' -e 's/T/./' -e 's/-//g' -e s'/://g' )"
[ $? -ne 0 ] && errx "Can't lookup Subversion commit timestamp"
else
- errx "Unable to determine sandbox type"
+ errx "Unable to determine source control type"
fi
commit_ver=$(${objdir}/bin/freebsd-version/freebsd-version -u 2>/dev/null)
@@ -137,12 +204,25 @@ beadm create ${BENAME} >/dev/null || errx "Unable to create BE ${BENAME}"
beadm mount ${BENAME} ${BE_TMP}/mnt || errx "Unable to mount BE ${BENAME}."
echo "Mounted ${BENAME} to ${BE_MNTPT}, performing install/update ..."
-make $* DESTDIR=${BE_MNTPT} installkernel || errx "Installkernel failed!"
-make $* DESTDIR=${BE_MNTPT} installworld || errx "Installworld failed!"
+make "$@" DESTDIR=${BE_MNTPT} installkernel || errx "Installkernel failed!"
+if [ -n "${CONFIG_UPDATER}" ]; then
+ "update_${CONFIG_UPDATER}_pre"
+ [ $? -ne 0 ] && errx "${CONFIG_UPDATER} (pre-world) failed!"
+fi
+
+# Mount the source and object tree within the BE in order to account for any
+# changes applied by the pre-installworld updater. Cleanup any directories
+# created if they didn't exist previously.
+create_be_dirs "${srcdir}" "${objdir}" || errx "Unable to create BE dirs"
+mount -t nullfs "${srcdir}" "${BE_MNTPT}${srcdir}" || errx "Unable to mount src"
+mount -t nullfs "${objdir}" "${BE_MNTPT}${objdir}" || errx "Unable to mount obj"
+
+chroot ${BE_MNTPT} make "$@" -C ${srcdir} installworld || \
+ errx "Installworld failed!"
if [ -n "${CONFIG_UPDATER}" ]; then
"update_${CONFIG_UPDATER}"
- [ $? -ne 0 ] && errx "${CONFIG_UPDATER} failed!"
+ [ $? -ne 0 ] && errx "${CONFIG_UPDATER} (post-world) failed!"
fi
BE_PKG="chroot ${BE_MNTPT} env ASSUME_ALWAYS_YES=true pkg"
@@ -151,8 +231,15 @@ if [ -z "${NO_PKG_UPGRADE}" ]; then
${BE_PKG} upgrade || errx "Unable to upgrade pkgs"
fi
-beadm unmount ${BENAME} || errx "Unable to unmount BE"
-rmdir_be
+if [ -n "$NO_CLEANUP_BE" ]; then
+ echo "Boot Environment ${BENAME} may be examined in ${BE_MNTPT}."
+ echo "Afterwards, run this to cleanup:"
+ echo " env BENAME=${BENAME} BE_MNTPT=${BE_MNTPT} BEINSTALL_CMD=postmortem $0"
+ exit 0
+fi
+
+unmount_be || errx "Unable to unmount BE"
+rmdir_be || errx "Unable to cleanup BE"
beadm activate ${BENAME} || errx "Unable to activate BE"
echo
beadm list
diff --git a/tools/build/options/WITH_LLVM_TARGET_BPF b/tools/build/options/WITH_LLVM_TARGET_BPF
new file mode 100644
index 000000000000..cb4a6a5633f2
--- /dev/null
+++ b/tools/build/options/WITH_LLVM_TARGET_BPF
@@ -0,0 +1,5 @@
+.\" $FreeBSD$
+Set to build LLVM target support for BPF.
+The
+.Va LLVM_TARGET_ALL
+option should be used rather than this in most cases.
diff --git a/tools/regression/posixsem/posixsem.c b/tools/regression/posixsem/posixsem.c
index 693a923ab5e6..9d0465682951 100644
--- a/tools/regression/posixsem/posixsem.c
+++ b/tools/regression/posixsem/posixsem.c
@@ -55,35 +55,6 @@ __FBSDID("$FreeBSD$");
#include "test.h"
-/* Cut and pasted from kernel header, bah! */
-
-/* Operations on timespecs */
-#define timespecclear(tvp) ((tvp)->tv_sec = (tvp)->tv_nsec = 0)
-#define timespecisset(tvp) ((tvp)->tv_sec || (tvp)->tv_nsec)
-#define timespeccmp(tvp, uvp, cmp) \
- (((tvp)->tv_sec == (uvp)->tv_sec) ? \
- ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \
- ((tvp)->tv_sec cmp (uvp)->tv_sec))
-#define timespecadd(vvp, uvp) \
- do { \
- (vvp)->tv_sec += (uvp)->tv_sec; \
- (vvp)->tv_nsec += (uvp)->tv_nsec; \
- if ((vvp)->tv_nsec >= 1000000000) { \
- (vvp)->tv_sec++; \
- (vvp)->tv_nsec -= 1000000000; \
- } \
- } while (0)
-#define timespecsub(vvp, uvp) \
- do { \
- (vvp)->tv_sec -= (uvp)->tv_sec; \
- (vvp)->tv_nsec -= (uvp)->tv_nsec; \
- if ((vvp)->tv_nsec < 0) { \
- (vvp)->tv_sec--; \
- (vvp)->tv_nsec += 1000000000; \
- } \
- } while (0)
-
-
#define TEST_PATH "/tmp/posixsem_regression_test"
#define ELAPSED(elapsed, limit) (abs((elapsed) - (limit)) < 100)
@@ -791,7 +762,7 @@ timedwait(semid_t id, u_int msec, u_int *delta, int error)
}
end.tv_sec = msec / 1000;
end.tv_nsec = msec % 1000 * 1000000;
- timespecadd(&end, &start);
+ timespecadd(&end, &start, &end);
if (ksem_timedwait(id, &end) < 0) {
if (errno != error) {
fail_errno("ksem_timedwait");
@@ -805,7 +776,7 @@ timedwait(semid_t id, u_int msec, u_int *delta, int error)
fail_errno("clock_gettime(CLOCK_REALTIME)");
return (-1);
}
- timespecsub(&end, &start);
+ timespecsub(&end, &start, &end);
*delta = end.tv_nsec / 1000000;
*delta += end.tv_sec * 1000;
return (0);
@@ -944,7 +915,7 @@ testwait(semid_t id, u_int *delta)
fail_errno("clock_gettime(CLOCK_REALTIME)");
return (-1);
}
- timespecsub(&end, &start);
+ timespecsub(&end, &start, &end);
*delta = end.tv_nsec / 1000000;
*delta += end.tv_sec * 1000;
return (0);
diff --git a/tools/regression/sockets/udp_pingpong/udp_pingpong.c b/tools/regression/sockets/udp_pingpong/udp_pingpong.c
index 25750b0c3c0d..fc585d275db4 100644
--- a/tools/regression/sockets/udp_pingpong/udp_pingpong.c
+++ b/tools/regression/sockets/udp_pingpong/udp_pingpong.c
@@ -106,31 +106,6 @@ struct rtt {
#define NSEC_MAX 1000000000L
#define NSEC_IN_USEC 1000L
-#define timespecsub2(r, v, u) \
- do { \
- SEC(r) = SEC(v) - SEC(u); \
- NSEC(r) = NSEC(v) - NSEC(u); \
- if (NSEC(r) < 0 && (SEC(r) > 0 || NSEC(r) <= -NSEC_MAX)) { \
- SEC(r)--; \
- NSEC(r) += NSEC_MAX; \
- } \
- } while (0);
-
-#define timespecadd2(r, v, u) \
- do { \
- SEC(r) = SEC(v) + SEC(u); \
- NSEC(r) = NSEC(v) + NSEC(u); \
- if (NSEC(r) >= NSEC_MAX) { \
- SEC(r)++; \
- NSEC(r) -= NSEC_MAX; \
- } \
- } while (0);
-
-#define timespeccmp(t, c, u) \
- ((SEC(t) == SEC(u)) ? \
- (NSEC(t) c NSEC(u)) : \
- (SEC(t) c SEC(u)))
-
#define timeval2timespec(tv, ts) \
do { \
SEC(ts) = (tv)->tv_sec; \
@@ -536,10 +511,10 @@ static void
calc_rtt(struct test_pkt *tpp, struct rtt *rttp)
{
- timespecsub2(&rttp->a2b, &tpp->tss[1].recvd, &tpp->tss[0].sent);
- timespecsub2(&rttp->b2a, &tpp->tss[0].recvd, &tpp->tss[1].sent);
- timespecadd2(&rttp->a2b_b2a, &rttp->a2b, &rttp->b2a);
- timespecsub2(&rttp->e2e, &tpp->tss[0].recvd, &tpp->tss[0].sent);
+ timespecsub(&tpp->tss[1].recvd, &tpp->tss[0].sent, &rttp->a2b);
+ timespecsub(&tpp->tss[0].recvd, &tpp->tss[1].sent, &rttp->b2a);
+ timespecadd(&rttp->a2b, &rttp->b2a, &rttp->a2b_b2a);
+ timespecsub(&tpp->tss[0].recvd, &tpp->tss[0].sent, &rttp->e2e);
}
static void
@@ -604,13 +579,13 @@ test_run(int ts_type, int use_ipv6, int use_recvmsg, const char *name)
continue;
}
calc_rtt(&test_ctx.test_pkts[i], &rtt);
- if (!timespeccmp(&rtt.e2e, >, &rtt.a2b_b2a))
+ if (!timespeccmp(&rtt.e2e, &rtt.a2b_b2a, >))
errx(1, "end-to-end trip time is too small");
- if (!timespeccmp(&rtt.e2e, <, &max_ts))
+ if (!timespeccmp(&rtt.e2e, &max_ts, <))
errx(1, "end-to-end trip time is too large");
- if (!timespeccmp(&rtt.a2b, >, &zero_ts))
+ if (!timespeccmp(&rtt.a2b, &zero_ts, >))
errx(1, "A2B trip time is not positive");
- if (!timespeccmp(&rtt.b2a, >, &zero_ts))
+ if (!timespeccmp(&rtt.b2a, &zero_ts, >))
errx(1, "B2A trip time is not positive");
}
teardown_udp(&test_ctx);
diff --git a/tools/regression/sockets/unix_cmsg/uc_check_time.c b/tools/regression/sockets/unix_cmsg/uc_check_time.c
index 5b7dfe11bb89..682cd442077d 100644
--- a/tools/regression/sockets/unix_cmsg/uc_check_time.c
+++ b/tools/regression/sockets/unix_cmsg/uc_check_time.c
@@ -35,20 +35,6 @@ __FBSDID("$FreeBSD$");
static const struct timeval max_diff_tv = {.tv_sec = 1, .tv_usec = 0};
static const struct timespec max_diff_ts = {.tv_sec = 1, .tv_nsec = 0};
-#define timespeccmp(tvp, uvp, cmp) \
- (((tvp)->tv_sec == (uvp)->tv_sec) ? \
- ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \
- ((tvp)->tv_sec cmp (uvp)->tv_sec))
-#define timespecsub(vvp, uvp) \
- do { \
- (vvp)->tv_sec -= (uvp)->tv_sec; \
- (vvp)->tv_nsec -= (uvp)->tv_nsec; \
- if ((vvp)->tv_nsec < 0) { \
- (vvp)->tv_sec--; \
- (vvp)->tv_nsec += 1000000000; \
- } \
- } while (0)
-
int
uc_check_bintime(const struct bintime *mt)
{
@@ -79,7 +65,7 @@ uc_check_timespec_real(const struct timespec *bt)
if (clock_gettime(CLOCK_REALTIME, &ct) < 0)
return (-1);
- timespecsub(&ct, bt);
+ timespecsub(&ct, bt, &ct);
if (!timespeccmp(&ct, &max_diff_ts, <))
return (-1);
@@ -93,7 +79,7 @@ uc_check_timespec_mono(const struct timespec *bt)
if (clock_gettime(CLOCK_MONOTONIC, &ct) < 0)
return (-1);
- timespecsub(&ct, bt);
+ timespecsub(&ct, bt, &ct);
if (!timespeccmp(&ct, &max_diff_ts, <))
return (-1);
diff --git a/tools/tools/git/HOWTO b/tools/tools/git/HOWTO
index 48828e892a8a..3e95264789f0 100644
--- a/tools/tools/git/HOWTO
+++ b/tools/tools/git/HOWTO
@@ -157,3 +157,10 @@ and it will do its thing and leave the tree on the master branch.
Your tree must be clean to start this, and while it tries to catch
some failures, not all of them have been allowed for.
+
+IV. git-svn-init
+git-svn-init is a script that initializes the right git-svn connection as
+outlined in https://wiki.freebsd.org/GitWorkflow/GitSvn. It would be a precursor
+to the script git-svn-rebase. The script contains help, but generally you can
+run the script with no arguments and it will attempt to set up both src and
+ports repositories.
diff --git a/tools/tools/git/git-svn-init b/tools/tools/git/git-svn-init
new file mode 100755
index 000000000000..ed941f54d91c
--- /dev/null
+++ b/tools/tools/git/git-svn-init
@@ -0,0 +1,193 @@
+#!/bin/sh
+
+# $FreeBSD$
+
+# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+#
+# Copyright(c) 2018 Intel Corporation.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. 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.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+
+# This is the codified version of what was/is on the wiki page for using git in
+# your workflow. It sets up proper repositories, with the correct remotes.
+
+# Environment variables which can be overridden if desired. Not worth
+# parameterizing them.
+GIT_IN_PATH=$(which git)
+GIT=${GIT-${GIT_IN_PATH}}
+
+GIT_PORTS_REPO=${GIT_PORTS_REPO-git://github.com/freebsd/freebsd-ports.git}
+GIT_SVN_PORTS_ROOT_URI=${GIT_SVN_PORTS_ROOT_URI-svn.freebsd.org/ports}
+GIT_SVN_PORTS_URI=${GIT_SVN_PORTS_URI-repo.freebsd.org/ports}
+
+GIT_SRC_REPO=${GIT_SRC_REPO-git://github.com/freebsd/freebsd.git}
+GIT_SVN_SRC_ROOT_URI=${GIT_SVN_SRC_ROOT_URI-svn.freebsd.org/base}
+GIT_SVN_SRC_URI=${GIT_SVN_SRC_URI-repo.freebsd.org/base}
+
+GIT_SVN_PORTS_PUSH_URI=$GIT_SVN_PORTS_URI
+GIT_SVN_SRC_PUSH_URI=$GIT_SVN_SRC_URI
+
+usage()
+{
+ cat <<EOF
+Usage: git-svn-init: [-b base_path] [-n] [-p] [-s]
+
+git-svn-init will instantiate git repositories for src, and ports and connect
+them to the upstream SVN repository. By default it will attempt to do this for
+both ports and src under freebsd in the current working directory.
+-b Base path for the clone operation (default: freebsd)
+-n Dry run
+-p Exclude ports
+-s Exclude src
+
+EOF
+}
+
+clone()
+{
+ echo "Cloning ${3}"
+ ${GIT} clone "$repo" -o upstream "$base"/${3}
+}
+
+svn_init()
+{
+ # init git-svn to point to the subversion repo:
+ ${GIT} svn init -Thead --rewrite-root=svn+ssh://$1 svn+ssh://$2 .
+
+ # Replace to use upstream instead of the default origin
+ # TODO: Do this from git svn init
+ ${GIT} config svn-remote.svn.fetch head:refs/remotes/upstream/trunk
+
+ # Committers need to use proper URL for dcommit
+ ${GIT} config svn-remote.svn.pushurl svn+ssh://$3
+
+}
+
+svn_check()
+{
+ cat <<EOF
+[svn-remote "svn"]
+ url = svn+ssh://repo.freebsd.org/base
+ rewriteRoot = svn+ssh://svn.freebsd.org/base
+ pushurl = svn+ssh://repo.freebsd.org/base
+ fetch = head:refs/remotes/upstream/trunk
+EOF
+ [ -z ${DRY_RUN} ] && grep -A4 'svn-remote "svn"' .git/config
+}
+
+svn_connect()
+{
+ # Now make a git branch 'trunk' for git-svn to follow. What we want to
+ # do it set it to point to the final commit in upstream/svn_head.
+ local svn_head_sha=$(git show-ref upstream/svn_head|cut -d" " -f1)
+ ${GIT} update-ref refs/remotes/upstream/trunk $svn_head_sha # git-svn really needs this branch
+}
+
+svn_fetch()
+{
+ ${GIT} svn fetch
+}
+
+git_pulls()
+{
+ # Get pull requests from the repos:
+ ${GIT} config --add remote.upstream.fetch '+refs/pull/*:refs/remotes/upstream/pull/*'
+ ${GIT} fetch
+}
+
+git_checkout()
+{
+ # Arrange to have 'master' reference 'trunk'
+ ${GIT} checkout trunk
+
+ # Make master reference trunk
+ ${GIT} branch --force master trunk
+ ${GIT} checkout master
+}
+
+rebase()
+{
+ ${GIT} svn rebase
+}
+
+doit()
+{
+ local repo=${1}
+ local base=${2}
+
+ if [ "$3" = "src" ] ; then
+ local svn_root_uri=$GIT_SVN_SRC_ROOT_URI
+ local svn_uri=$GIT_SVN_SRC_URI
+ local svn_push_uri=$GIT_SVN_SRC_PUSH_URI
+ else
+ local svn_root_uri=$GIT_SVN_PORTS_ROOT_URI
+ local svn_uri=$GIT_SVN_PORTS_URI
+ local svn_push_uri=$GIT_SVN_PORTS_PUSH_URI
+ fi
+
+ clone ${repo} ${base} ${3}
+
+ cd "$base"/${3}
+ svn_init $svn_root_uri $svn_uri $svn_push_uri
+ svn_check $(basename $svn_uri) # get base or ports, not src/ports.
+ svn_connect
+ svn_fetch
+ git_pulls
+ git_checkout
+ rebase
+
+ cd -
+}
+
+ports=1
+source=1
+while getopts "hb:nr:sp" opt; do
+ case "$opt" in
+ b)
+ base_path="$OPTARG"
+ ;;
+ n)
+ DRY_RUN=1
+ ;;
+ p)
+ ports=0
+ ;;
+ s)
+ source=0
+ ;;
+ h|*)
+ usage
+ exit 0
+ esac
+done
+
+if [ ! -z "${DRY_RUN}" ] ; then
+ GIT='echo git'
+fi
+
+if [ "$source" -eq 1 ]; then
+ doit ${GIT_SRC_REPO} ${base_path:-freebsd} "src"
+fi
+
+if [ "$ports" -eq 1 ]; then
+ doit ${GIT_PORTS_REPO} ${base_path:-freebsd} "ports"
+fi
diff --git a/tools/tools/nanobsd/pcengines/Files/root/.cshrc b/tools/tools/nanobsd/pcengines/Files/root/.cshrc
index 49151c59e511..9d73f34de277 100644
--- a/tools/tools/nanobsd/pcengines/Files/root/.cshrc
+++ b/tools/tools/nanobsd/pcengines/Files/root/.cshrc
@@ -17,7 +17,7 @@ umask 22
set path = (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin $HOME/bin)
setenv EDITOR vi
-setenv PAGER more
+setenv PAGER less
setenv BLOCKSIZE K
if ($?prompt) then
diff --git a/tools/tools/nanobsd/rescue/Files/root/.cshrc b/tools/tools/nanobsd/rescue/Files/root/.cshrc
index 8098c1995404..50ab635e59c5 100644
--- a/tools/tools/nanobsd/rescue/Files/root/.cshrc
+++ b/tools/tools/nanobsd/rescue/Files/root/.cshrc
@@ -8,13 +8,13 @@
a la ls -a
a lf ls -FA
a ll ls -lA
- a lm 'll | more'
- a m more
+ a lm 'll | less'
+ a m less
set path = (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin /usr/X11R6/bin /usr/local/jdk1.6.0/bin /usr/local/jdk1.5.0/bin $HOME/bin)
setenv MANPATH "/usr/share/man:/usr/X11R6/man:/usr/local/man"
-setenv PAGER more
+setenv PAGER less
setenv EDITOR vi
setenv BLOCKSIZE K
setenv FTP_PASSIVE_MODE YES
diff --git a/tools/tools/netrate/juggle/juggle.c b/tools/tools/netrate/juggle/juggle.c
index 804dfc9173e0..226f34ad301a 100644
--- a/tools/tools/netrate/juggle/juggle.c
+++ b/tools/tools/netrate/juggle/juggle.c
@@ -93,19 +93,6 @@
*/
#define PIPELINE_MAX 4
-/*
- * As in all programs, steal timespecsub() from time.h.
- */
-#define timespecsub(vvp, uvp) \
- do { \
- (vvp)->tv_sec -= (uvp)->tv_sec; \
- (vvp)->tv_nsec -= (uvp)->tv_nsec; \
- if ((vvp)->tv_nsec < 0) { \
- (vvp)->tv_sec--; \
- (vvp)->tv_nsec += 1000000000; \
- } \
- } while (0)
-
static int
udp_create(int *fd1p, int *fd2p)
{
@@ -277,7 +264,7 @@ juggle(int fd1, int fd2, int pipeline)
if (clock_gettime(CLOCK_REALTIME, &tfinish) < 0)
err(-1, "juggle: clock_gettime");
- timespecsub(&tfinish, &tstart);
+ timespecsub(&tfinish, &tstart, &tfinish);
return (tfinish);
}
@@ -373,7 +360,7 @@ thread_juggle(int fd1, int fd2, int pipeline)
if (pthread_join(thread, NULL) != 0)
err(-1, "thread_juggle: pthread_join");
- timespecsub(&tfinish, &tstart);
+ timespecsub(&tfinish, &tstart, &tfinish);
return (tfinish);
}
@@ -458,7 +445,7 @@ process_juggle(int fd1, int fd2, int pipeline)
if (wpid != pid)
errx(-1, "process_juggle: waitpid: pid != wpid");
- timespecsub(&tfinish, &tstart);
+ timespecsub(&tfinish, &tstart, &tfinish);
return (tfinish);
}
diff --git a/tools/tools/netrate/tcpp/tcpp_client.c b/tools/tools/netrate/tcpp/tcpp_client.c
index 70620ce75225..e88976bedf8b 100644
--- a/tools/tools/netrate/tcpp/tcpp_client.c
+++ b/tools/tools/netrate/tcpp/tcpp_client.c
@@ -57,16 +57,6 @@
#define min(x, y) (x < y ? x : y)
-#define timespecsub(vvp, uvp) \
- do { \
- (vvp)->tv_sec -= (uvp)->tv_sec; \
- (vvp)->tv_nsec -= (uvp)->tv_nsec; \
- if ((vvp)->tv_nsec < 0) { \
- (vvp)->tv_sec--; \
- (vvp)->tv_nsec += 1000000000; \
- } \
- } while (0)
-
/*
* Gist of each client worker: build up to mflag connections at a time, and
@@ -336,7 +326,7 @@ tcpp_client(void)
if (sysctlbyname(SYSCTLNAME_CPTIME, &cp_time_finish, &size, NULL, 0)
< 0)
err(-1, "sysctlbyname: %s", SYSCTLNAME_CPTIME);
- timespecsub(&ts_finish, &ts_start);
+ timespecsub(&ts_finish, &ts_start, &ts_finish);
if (failed)
errx(-1, "Too many errors");
diff --git a/tools/tools/sysbuild/sysbuild.sh b/tools/tools/sysbuild/sysbuild.sh
index 6317d1d24830..950f9f4da50d 100644
--- a/tools/tools/sysbuild/sysbuild.sh
+++ b/tools/tools/sysbuild/sysbuild.sh
@@ -204,7 +204,7 @@ ports_recurse() (
echo "Missing port $d ($t) (fl $fl) (bd $bd)" 1>&2
continue
fi
- echo "Flavored port $d ($t) (fl $fl) (bd $bd)" 1>&2
+ # echo "Flavored port $d ($t) (fl $fl) (bd $bd)" 1>&2
d=$bd
fi
d=`cd /usr/ports && cd $d && /bin/pwd`
@@ -549,7 +549,7 @@ log_it Installworld
> ${SBMNT}/_.iw 2>&1
log_it distribution
-(cd /usr/src/etc && make -m /usr/src/share/mk distribution DESTDIR=${SBMNT} ${SRCCONF} ) \
+(cd /usr/src && make -m /usr/src/share/mk distribution DESTDIR=${SBMNT} ${SRCCONF} ) \
> ${SBMNT}/_.dist 2>&1
log_it Installkernel
diff --git a/tools/tools/syscall_timing/syscall_timing.c b/tools/tools/syscall_timing/syscall_timing.c
index 3a4fcd840bce..2a2caa25ac7d 100644
--- a/tools/tools/syscall_timing/syscall_timing.c
+++ b/tools/tools/syscall_timing/syscall_timing.c
@@ -59,16 +59,6 @@ static struct timespec ts_start, ts_end;
static int alarm_timeout;
static volatile int alarm_fired;
-#define timespecsub(vvp, uvp) \
- do { \
- (vvp)->tv_sec -= (uvp)->tv_sec; \
- (vvp)->tv_nsec -= (uvp)->tv_nsec; \
- if ((vvp)->tv_nsec < 0) { \
- (vvp)->tv_sec--; \
- (vvp)->tv_nsec += 1000000000; \
- } \
- } while (0)
-
#define BENCHMARK_FOREACH(I, NUM) for (I = 0; I < NUM && alarm_fired == 0; I++)
static void
@@ -1112,7 +1102,7 @@ main(int argc, char *argv[])
for (k = 0; k < loops; k++) {
calls = the_test->t_func(iterations, the_test->t_int,
path);
- timespecsub(&ts_end, &ts_start);
+ timespecsub(&ts_end, &ts_start, &ts_end);
printf("%s\t%ju\t", the_test->t_name, k);
printf("%ju.%09ju\t%ju\t", (uintmax_t)ts_end.tv_sec,
(uintmax_t)ts_end.tv_nsec, calls);