Home | History | Annotate | only in /src/sbin/ping
History log of /src/sbin/ping
RevisionDateAuthorComments
 1.18 07-Oct-2023  rin Drop -O[01] hacks for vax; no longer necessary for patched GCC 10

PR port-vax/57646: Import major vax toolchain fix by Kalvis Duckmanton

XXXRO: GCC 12 may require hacks for a while, but it turned out that
GCC 12 should be treated differently from older versions; a lot of new
files need -O[01] flags, while some may no longer require it.

I will take a look later.

Note that these hacks are not required if Kalvis's patches for GCC 12
are applied.

Keep doc/HACKS entries for a while (will be sync with update for GCC 12).

diff --git a/crypto/external/bsd/openssh/lib/Makefile b/crypto/external/bsd/openssh/lib/Makefile
index 96a93f5e396..4e38be1b642 100644
--- a/crypto/external/bsd/openssh/lib/Makefile
+++ b/crypto/external/bsd/openssh/lib/Makefile
@@ -117,12 +117,6 @@ COPTS.${f}.c+= -Wno-pointer-sign
# XXX
COPTS.channels.c+= -fno-strict-aliasing

-# XXX
-.if ${MACHINE} == "vax"
-COPTS.poly1305.c+= -O0
-COPTS.umac.c+= -O0
-.endif
-
COPTS.hostfile.c+= ${CC_WNO_FORMAT_TRUNCATION}
COPTS.sshkey.c+= ${CC_WNO_FORMAT_TRUNCATION}
COPTS.cipher.c+= -Wno-error=deprecated-declarations
diff --git a/distrib/utils/x_ping/Makefile b/distrib/utils/x_ping/Makefile
index f1c452a0d60..8ee77580a3f 100644
--- a/distrib/utils/x_ping/Makefile
+++ b/distrib/utils/x_ping/Makefile
@@ -12,10 +12,6 @@ CPPFLAGS+= -I${SRCDIR} -DCRUNCHOPS
DPADD= ${LIBM}
LDADD= -lm

-.if ${MACHINE_ARCH} == "vax"
-COPTS.ping.c=-O0
-.endif
-
.include <bsd.prog.mk>

.PATH: ${SRCDIR}
diff --git a/external/apache2/argon2/lib/libargon2/Makefile.inc b/external/apache2/argon2/lib/libargon2/Makefile.inc
index d3f4470c6c7..6a1dd146d7d 100644
--- a/external/apache2/argon2/lib/libargon2/Makefile.inc
+++ b/external/apache2/argon2/lib/libargon2/Makefile.inc
@@ -16,7 +16,3 @@ CFLAGS+= -pthread
LDADD+=-lpthread
DPADD+=${LIBPTHREAD}
.endif
-
-.if ${MACHINE} == "vax"
-COPTS.blake2b.c+= -O0
-.endif
diff --git a/external/bsd/jemalloc/lib/Makefile.inc b/external/bsd/jemalloc/lib/Makefile.inc
index 2f524358f46..d5da774f293 100644
--- a/external/bsd/jemalloc/lib/Makefile.inc
+++ b/external/bsd/jemalloc/lib/Makefile.inc
@@ -53,12 +53,6 @@ COPTS.ctl.c+=-Wno-error=stack-protector
COPTS.stats.c+=-Wno-error=stack-protector
COPTS.tcache.c+=-Wno-error=stack-protector

-.if ${MACHINE_ARCH} == "vax"
-# in merge_overlapping_regs, at regrename.c
-COPTS.arena.c+=-O0
-COPTS.extent.c+=-O0
-.endif
-
SRCS+=${JEMALLOC_SRCS}

jemalloc.d jemalloc.pico jemalloc.o jemalloc.ln jemalloc.po jemalloc.go: \
diff --git a/external/bsd/mdocml/lib/libmandoc/Makefile b/external/bsd/mdocml/lib/libmandoc/Makefile
index 40d7e29ae88..dfd3077a2c7 100644
--- a/external/bsd/mdocml/lib/libmandoc/Makefile
+++ b/external/bsd/mdocml/lib/libmandoc/Makefile
@@ -39,11 +39,6 @@ tbl_opts.c

MAN= mandoc.3

-# XXX
-.if ${MACHINE} == "vax"
-COPTS.mdoc_macro.c+=-O0
-.endif
-
COPTS.man_validate.c+=-Wno-error=array-bounds

.include <bsd.lib.mk>
diff --git a/external/gpl3/binutils.old/lib/libbfd/Makefile b/external/gpl3/binutils.old/lib/libbfd/Makefile
index 03477232b55..74a354532fa 100644
--- a/external/gpl3/binutils.old/lib/libbfd/Makefile
+++ b/external/gpl3/binutils.old/lib/libbfd/Makefile
@@ -41,10 +41,6 @@ CPPFLAGS+= -I${.CURDIR}/arch/${BFD_MACHINE_ARCH} -I${DIST}/include -I. \
-DDEBUGDIR=\"${DEBUGDIR}\" -DLIBDIR=\"${LIBDIR}\" \
-DBINDIR=\"${BINDIR}\"

-.if (${BFD_MACHINE_ARCH} == "vax")
-CPPFLAGS.elf.c += -O0
-.endif
-
COPTS.pei-x86_64.c+= -Wno-stack-protector
COPTS.elfxx-mips.c+= -Wno-stack-protector
COPTS.elf.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -Wno-overflow :}
diff --git a/external/gpl3/binutils/lib/libbfd/Makefile b/external/gpl3/binutils/lib/libbfd/Makefile
index 00cb2b20081..a3f0c25fd35 100644
--- a/external/gpl3/binutils/lib/libbfd/Makefile
+++ b/external/gpl3/binutils/lib/libbfd/Makefile
@@ -41,10 +41,6 @@ CPPFLAGS+= -I${.CURDIR}/arch/${BFD_MACHINE_ARCH} -I${DIST}/include -I. \
-DDEBUGDIR=\"${DEBUGDIR}\" -DLIBDIR=\"${LIBDIR}\" \
-DBINDIR=\"${BINDIR}\"

-.if (${BFD_MACHINE_ARCH} == "vax")
-CPPFLAGS.elf.c += -O0
-.endif
-
COPTS.pei-x86_64.c+= -Wno-stack-protector
COPTS.elfxx-mips.c+= -Wno-stack-protector
COPTS.elf.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -Wno-overflow :}
diff --git a/external/gpl3/gcc.old/lib/Makefile.sanitizer b/external/gpl3/gcc.old/lib/Makefile.sanitizer
index efd36ae4bee..5173a5109a0 100644
--- a/external/gpl3/gcc.old/lib/Makefile.sanitizer
+++ b/external/gpl3/gcc.old/lib/Makefile.sanitizer
@@ -88,22 +88,3 @@ COPTS+=-fno-builtin -fno-exceptions -fno-rtti -funwind-tables

# Can't profile without it`
#-fomit-frame-pointer
-
-.if ${MACHINE_ARCH} == "vax"
-COPTS.sanitizer_allocator.cc += -O1
-COPTS.sanitizer_common.cc += -O1
-COPTS.sanitizer_common_libcdep.cc += -O1
-COPTS.sanitizer_coverage_libcdep.cc += -O1
-COPTS.sanitizer_coverage_mapping_libcdep.cc += -O1
-COPTS.sanitizer_deadlock_detector1.cc += -O1
-COPTS.sanitizer_mac.cc += -O1
-COPTS.sanitizer_netbsd.cc += -O1
-COPTS.sanitizer_posix.cc += -O1
-COPTS.sanitizer_printf.cc += -O1
-COPTS.sanitizer_procmaps_common.cc += -O1
-COPTS.sanitizer_stackdepot.cc += -O1
-COPTS.sanitizer_symbolizer_libcdep.cc += -O1
-COPTS.sanitizer_symbolizer_report.cc += -O1
-COPTS.ubsan_diag.cc += -O1
-COPTS.ubsan_init.cc += -O1
-.endif
diff --git a/external/gpl3/gcc.old/lib/libasan/Makefile b/external/gpl3/gcc.old/lib/libasan/Makefile
index 1e6f9608abe..3da7bbf2f58 100644
--- a/external/gpl3/gcc.old/lib/libasan/Makefile
+++ b/external/gpl3/gcc.old/lib/libasan/Makefile
@@ -49,14 +49,6 @@ LIBDPLIBS+= m ${NETBSDSRCDIR}/lib/libm
LIBDPLIBS+= pthread ${NETBSDSRCDIR}/lib/libpthread
CPPFLAGS+=-DCAN_SANITIZE_UB=0

-.if ${MACHINE_ARCH} == "vax"
-COPTS.asan_allocator.cc += -O1
-COPTS.asan_report.cc += -O1
-COPTS.sanitizer_file.cc += -O1
-COPTS.ubsan_diag.cc += -O1
-COPTS.ubsan_init.cc += -O1
-.endif
-
.if ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
COPTS.asan_interceptors.cc += -O1
.endif
diff --git a/external/gpl3/gcc.old/lib/liblsan/Makefile b/external/gpl3/gcc.old/lib/liblsan/Makefile
index 4578544a9a8..ddb7981077c 100644
--- a/external/gpl3/gcc.old/lib/liblsan/Makefile
+++ b/external/gpl3/gcc.old/lib/liblsan/Makefile
@@ -16,11 +16,6 @@ LSAN_SRCS+= \
lsan_linux.cc \
lsan_thread.cc

-.if ${MACHINE_ARCH} == "vax"
-COPTS.lsan_allocator.cc += -O1
-COPTS.sanitizer_file.cc += -O1
-.endif
-
LIB= lsan
SRCS+= ${LSAN_SRCS}
LIBDPLIBS+= m ${NETBSDSRCDIR}/lib/libm
diff --git a/external/gpl3/gcc.old/lib/libubsan/Makefile b/external/gpl3/gcc.old/lib/libubsan/Makefile
index 2e2faca7b1c..9de82550d14 100644
--- a/external/gpl3/gcc.old/lib/libubsan/Makefile
+++ b/external/gpl3/gcc.old/lib/libubsan/Makefile
@@ -26,10 +26,6 @@ UBSAN_SRCS= \
COPTS.${_s}.cc+=-frtti
.endfor

-.if ${MACHINE_ARCH} == "vax"
-COPTS.sanitizer_file.cc += -O1
-.endif
-
LIB= ubsan
SRCS+= ${UBSAN_SRCS}
LIBDPLIBS+= m ${NETBSDSRCDIR}/lib/libm
diff --git a/external/gpl3/gcc.old/usr.bin/cc1/Makefile b/external/gpl3/gcc.old/usr.bin/cc1/Makefile
index c55e292ee8e..ff12a5be524 100644
--- a/external/gpl3/gcc.old/usr.bin/cc1/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/cc1/Makefile
@@ -46,17 +46,6 @@ CPPFLAGS.default-c.c+= -I${BACKENDOBJ}
BUILDSYMLINKS+= ${GNUHOSTDIST}/gcc/config/sh/sh-c.cc sh-c.c
.endif

-.if ${MACHINE_CPU} == "vax"
-COPTS.c-decl.c+=-O0
-COPTS.c-typeck.c+=-O0
-COPTS.c-array-notation.c+=-O0
-COPTS.c-common.c+=-O0
-COPTS.c-ada-spec.c+=-O0
-COPTS.cilk.c+=-O0
-COPTS.c-ubsan.c+=-O0
-COPTS.cc1-checksum.c+=-O0
-.endif
-
.if ${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel"
COPTS.c-common.c+=-O3
.endif
diff --git a/external/gpl3/gcc.old/usr.bin/cc1obj/Makefile b/external/gpl3/gcc.old/usr.bin/cc1obj/Makefile
index 3123ee0d60b..aab82ad3448 100644
--- a/external/gpl3/gcc.old/usr.bin/cc1obj/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/cc1obj/Makefile
@@ -44,16 +44,8 @@ COPTS.objc-act.c+= -Wno-stack-protector
COPTS.objc-gnu-runtime-abi-01.c+= -Wno-stack-protector
COPTS.objc-next-runtime-abi-01.c+= -Wno-stack-protector

-.if ${MACHINE_ARCH} == "vax"
-COPTS.c-decl.c+=-O0
-COPTS.c-typeck.c+=-O0
-COPTS.c-array-notation.c+=-O0
-COPTS.c-common.c+=-O0
-COPTS.c-ada-spec.c+=-O0
-COPTS.cilk.c+=-O0
-COPTS.c-ubsan.c+=-O0
-COPTS.cc1obj-checksum.c+=-O0
-.endif
+COPTS.c-cppbuiltin.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 8:? -Wno-error=format-overflow :}
+COPTS.c-typeck.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 8:? -Wno-error=format-overflow :}

.if ${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel"
COPTS.c-common.c+=-O3
diff --git a/external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile b/external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile
index b9c108251c5..e04e8fc7f53 100644
--- a/external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile
@@ -69,18 +69,6 @@ COPTS.objc-act.c+= -Wno-stack-protector
COPTS.objc-gnu-runtime-abi-01.c+= -Wno-stack-protector
COPTS.objc-next-runtime-abi-01.c+= -Wno-stack-protector

-.if ${MACHINE_ARCH} == "vax"
-COPTS.c-decl.c+=-O0
-COPTS.c-typeck.c+=-O0
-COPTS.c-array-notation.c+=-O0
-COPTS.c-common.c+=-O0
-COPTS.c-ada-spec.c+=-O0
-COPTS.cilk.c+=-O0
-COPTS.c-ubsan.c+=-O0
-COPTS.cc1obj-checksum.c+=-O0
-COPTS.decl.c+=-O0
-.endif
-
.if ${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel"
COPTS.c-common.c+=-O3
.endif
diff --git a/external/gpl3/gcc.old/usr.bin/cc1plus/Makefile b/external/gpl3/gcc.old/usr.bin/cc1plus/Makefile
index 7936efd3a5e..7c54559e21a 100644
--- a/external/gpl3/gcc.old/usr.bin/cc1plus/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/cc1plus/Makefile
@@ -31,23 +31,6 @@ CHECKSUM_OBJS= ${LIBBACKTRACEOBJ}/libbacktrace.a \

CFLAGS+= -Wno-error=stack-protector

-.if ${MACHINE_ARCH} == "vax"
-COPTS.call.c+=-O0
-COPTS.decl.c+=-O0
-COPTS.typeck2.c+=-O0
-COPTS.class.c+=-O0
-COPTS.typeck.c+=-O0
-COPTS.init.c+=-O0
-COPTS.semantics.c+=-O0
-COPTS.mangle.c+=-O0
-COPTS.constexpr.c+=-O0
-COPTS.c-common.c+=-O0
-COPTS.c-ada-spec.c+=-O0
-COPTS.cilk.c+=-O0
-COPTS.c-ubsan.c+=-O0
-COPTS.cc1plus-checksum.c+=-O0
-.endif
-
.if ${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel"
COPTS.c-common.c+=-O3
.endif
diff --git a/external/gpl3/gcc.old/usr.bin/gcc/Makefile b/external/gpl3/gcc.old/usr.bin/gcc/Makefile
index 7a66d77ffc7..a5a4b1c3adf 100644
--- a/external/gpl3/gcc.old/usr.bin/gcc/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/gcc/Makefile
@@ -25,9 +25,6 @@ ${SRCS}: ${GCCARCH}/defs.mk
.include <bsd.info.mk>

COPTS.gcc.c= -Wno-stack-protector
-.if ${MACHINE_ARCH} == "vax"
-COPTS.dse.c= -O1
-.endif

.PATH: ${DIST}/gcc ${DIST}/gcc/doc ${DIST}/gcc/c

diff --git a/external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile b/external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile
index 751d1513eec..33aeb1c9898 100644
--- a/external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile
@@ -14,10 +14,6 @@ SRCS= decNumber.c decContext.c decimal32.c decimal64.c decimal128.c
CPPFLAGS+= -I${.CURDIR}/arch/${GCC_MACHINE_ARCH} -I${DIST}/libdecnumber
CPPFLAGS+= -I${DIST}/libgcc

-.if ${MACHINE_ARCH} == "vax"
-COPTS.decNumber.c=-O0
-.endif
-
.include <bsd.lib.mk>

# Force using C++ for this
diff --git a/external/gpl3/gcc.old/usr.bin/lto-dump/Makefile b/external/gpl3/gcc.old/usr.bin/lto-dump/Makefile
index 90f44a9fcf6..fd251464fb7 100644
--- a/external/gpl3/gcc.old/usr.bin/lto-dump/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/lto-dump/Makefile
@@ -24,11 +24,6 @@ COPTS.lto-common.c+= -Wno-stack-protector
.include "../Makefile.backtrace"
.include "../Makefile.libdecnumber"

-.if ${MACHINE_ARCH} == "vax"
-COPTS.lto-lang.c+=-O0
-COPTS.lto-symtab.c+=-O0
-.endif
-
LDADD+= ${LIBIBERTY} ${LIBMPC} ${LIBMPFR} ${LIBGMP} -lintl -lz -lm
DPADD+= ${LIBIBERTY} ${LIBMPC} ${LIBMPFR} ${LIBGMP} ${LIBINTL} ${LIBZ} ${LIBM}

diff --git a/external/gpl3/gcc.old/usr.bin/lto1/Makefile b/external/gpl3/gcc.old/usr.bin/lto1/Makefile
index 4c49161a64c..340d3c6124f 100644
--- a/external/gpl3/gcc.old/usr.bin/lto1/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/lto1/Makefile
@@ -21,11 +21,6 @@ COPTS.lto-common.c+= -Wno-stack-protector
.include "../Makefile.libcpp"
.include "../Makefile.libdecnumber"

-.if ${MACHINE_ARCH} == "vax"
-COPTS.lto-lang.c+=-O0
-COPTS.lto-symtab.c+=-O0
-.endif
-
LDADD+= ${LIBIBERTYOBJ}/libiberty.a
DPADD+= ${LIBIBERTYOBJ}/libiberty.a
LDADD+= ${LIBIBERTY} ${LIBMPC} ${LIBMPFR} ${LIBGMP} -lintl -lz -lm
diff --git a/external/gpl3/gdb.old/lib/libdecnumber/Makefile b/external/gpl3/gdb.old/lib/libdecnumber/Makefile
index bcd4ae5b222..ce28811526b 100644
--- a/external/gpl3/gdb.old/lib/libdecnumber/Makefile
+++ b/external/gpl3/gdb.old/lib/libdecnumber/Makefile
@@ -18,10 +18,6 @@ CPPFLAGS+= -I${.CURDIR}/arch/${GDB_MACHINE_ARCH} \

SRCS= ${G_OBJS:.o=.c} ${G_SOURCES}

-.if ${MACHINE_ARCH} == "vax"
-COPTS.decNumber.c=-O0
-.endif
-
.PATH: ${DIST}/libdecnumber ${DIST}/libdecnumber/dpd

.include <bsd.lib.mk>
diff --git a/external/gpl3/gdb/lib/libdecnumber/Makefile b/external/gpl3/gdb/lib/libdecnumber/Makefile
index c95d36e3dfa..e3169865304 100644
--- a/external/gpl3/gdb/lib/libdecnumber/Makefile
+++ b/external/gpl3/gdb/lib/libdecnumber/Makefile
@@ -18,10 +18,6 @@ CPPFLAGS+= -I${.CURDIR}/arch/${GDB_MACHINE_ARCH} \

SRCS= ${G_OBJS:.o=.c} ${G_SOURCES}

-.if ${MACHINE_ARCH} == "vax"
-COPTS.decNumber.c=-O0
-.endif
-
.PATH: ${DIST}/libdecnumber ${DIST}/libdecnumber/dpd ${DIST}/libdecnumber/bid

.include <bsd.lib.mk>
diff --git a/external/gpl3/gdb/lib/libgdb/Makefile b/external/gpl3/gdb/lib/libgdb/Makefile
index b87a515d13a..c118c363975 100644
--- a/external/gpl3/gdb/lib/libgdb/Makefile
+++ b/external/gpl3/gdb/lib/libgdb/Makefile
@@ -66,12 +66,6 @@ CFLAGS:= ${CXXFLAGS} -std=gnu++17 -Wno-error=stack-protector

ada-exp.c: ada-lex.c

-.if ${MACHINE} == "vax"
-. if ${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8
-COPTS.read.c+= -O0
-. endif
-.endif
-
# These are generated by implicit rules and are not easy to generate
CLEANDIRFILES+= \
ada-exp.c ada-lex.c \
diff --git a/external/mit/xorg/lib/gallium.old/Makefile b/external/mit/xorg/lib/gallium.old/Makefile
index 55b2fe3d1c1..bfa40c8974f 100644
--- a/external/mit/xorg/lib/gallium.old/Makefile
+++ b/external/mit/xorg/lib/gallium.old/Makefile
@@ -1211,10 +1211,6 @@ SYMLINKS+= gallium_dri.so.${SHLIB_MAJOR}.debug ${DRIDEBUGDIR}/${_d}_dri.so.${SHL
COPTS+= ${${ACTIVE_CC} == "clang":? -Wa,-Av8plus :}
.endif

-.if ${MACHINE_ARCH} == "vax"
-COPTS.nir.c += -O1
-.endif
-
# XXXGCC12
.if ${MACHINE_ARCH} == "m68k"
COPTS.st_glsl_to_tgsi.cpp += -O1
diff --git a/external/mit/xorg/lib/gallium/Makefile b/external/mit/xorg/lib/gallium/Makefile
index 6778a8c11c8..9f1422080fe 100644
--- a/external/mit/xorg/lib/gallium/Makefile
+++ b/external/mit/xorg/lib/gallium/Makefile
@@ -1428,10 +1428,6 @@ SYMLINKS+= gallium_dri.so.${SHLIB_MAJOR}.debug ${DRIDEBUGDIR}/${_d}_dri.so.${SHL
COPTS+= ${${ACTIVE_CC} == "clang":? -Wa,-Av8plus :}
.endif

-.if ${MACHINE_ARCH} == "vax"
-COPTS.nir.c += -O1
-.endif
-
COPTS.u_atomic.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -Wno-builtin-declaration-mismatch :}

.include <bsd.lib.mk>
diff --git a/external/mit/xorg/lib/libX11/Makefile.libx11 b/external/mit/xorg/lib/libX11/Makefile.libx11
index e103d9ace12..0e55c2a4732 100644
--- a/external/mit/xorg/lib/libX11/Makefile.libx11
+++ b/external/mit/xorg/lib/libX11/Makefile.libx11
@@ -471,11 +471,6 @@ COPTS.OpenDis.c+= -Wno-error # XXX xf86bigfstr.h
COPTS.XlibInt.c+= -Wno-error # XXX xcmiscstr.h
COPTS.XKBBind.c+= -Wno-deprecated-declarations # uses XKeycodeToKeysym

-# XXX
-.if ${MACHINE} == "vax"
-COPTS.lcWrap.c+= -O0
-.endif
-
CWARNFLAGS.clang+= -Wno-string-plus-int

.include "${NETBSDSRCDIR}/external/mit/xorg/tools/makekeys/Makefile.makekeys"
diff --git a/games/gomoku/Makefile b/games/gomoku/Makefile
index e86a63aaea7..678537066ed 100644
--- a/games/gomoku/Makefile
+++ b/games/gomoku/Makefile
@@ -9,10 +9,6 @@ LDADD= -lcurses -lterminfo
HIDEGAME=hidegame
CPPFLAGS+= ${DEBUG:D-DDEBUG}

-.if ${MACHINE} == "vax"
-COPTS.pickmove.c += -O0
-.endif
-
#WARNS= 6 # would produce warnings about small integer types
LINTFLAGS+= -w # treat warnings as errors
LINTFLAGS+= -T # strict bool mode
diff --git a/games/phantasia/Makefile b/games/phantasia/Makefile
index e9c53f23ae5..b919dac17c6 100644
--- a/games/phantasia/Makefile
+++ b/games/phantasia/Makefile
@@ -52,7 +52,3 @@ map: map.c
./map | plot > /dev/tty

.include <bsd.prog.mk>
-
-.if defined(HAVE_GCC) && ${MACHINE_ARCH} == "vax"
-COPTS.misc.c+= -O0
-.endif
diff --git a/lib/i18n_module/UTF7/Makefile b/lib/i18n_module/UTF7/Makefile
index 712c1515d42..7136f7f0cc3 100644
--- a/lib/i18n_module/UTF7/Makefile
+++ b/lib/i18n_module/UTF7/Makefile
@@ -3,6 +3,3 @@
SRCPRE=citrus_
.include <bsd.lib.mk>

-.if ${MACHINE_ARCH} == "vax" && defined(HAVE_GCC)
-COPTS.citrus_utf7.c+= -O0
-.endif
diff --git a/lib/libbz2/Makefile b/lib/libbz2/Makefile
index b2aea1e04b0..e60a2862d48 100644
--- a/lib/libbz2/Makefile
+++ b/lib/libbz2/Makefile
@@ -15,11 +15,6 @@ SRCS= blocksort.c huffman.c crctable.c randtable.c compress.c \
INCS= bzlib.h
INCSDIR= /usr/include

-# XXX huffman.c gets mis-compiled with 2.95.3
-.if ${MACHINE_ARCH} == "vax"
-COPTS+= -O0
-.endif
-
COPTS+= ${CC_WNO_IMPLICIT_FALLTHROUGH}

# XXX blocksort.c gets mis-compiled with 4.1
diff --git a/lib/libc/gdtoa/Makefile.inc b/lib/libc/gdtoa/Makefile.inc
index 132686fc33d..609da919803 100644
--- a/lib/libc/gdtoa/Makefile.inc
+++ b/lib/libc/gdtoa/Makefile.inc
@@ -44,10 +44,3 @@ SRCS+= dmisc.c \
.if ${MACHINE_ARCH} != "vax"
SRCS+= strtord.c
.endif
-
-# XXX revisit with newer GCC.
-# Ensure numbers like 0xffff319f5fa95963 print correctly
-# ("999999999999999.98", not garbage like "?A>C>@>C:BA;A><.:<")
-.if ${MACHINE_ARCH} == "vax" && defined(HAVE_GCC)
-COPTS.misc.c+= -O0
-.endif
diff --git a/lib/libcrypt/Makefile b/lib/libcrypt/Makefile
index cb3f89d6d09..e9c8be820da 100644
--- a/lib/libcrypt/Makefile
+++ b/lib/libcrypt/Makefile
@@ -30,9 +30,6 @@ SRCS+= crypt-argon2.c
SRCS+= ${src}
COPTS.${src}+= -fvisibility=hidden
. endfor
-. if ${MACHINE} == "vax"
-COPTS.blake2b.c+= -O0
-. endif
.endif

WARNS?= 5
diff --git a/libexec/ld.elf_so/Makefile b/libexec/ld.elf_so/Makefile
index f5baae1e883..24f7e1121e5 100644
--- a/libexec/ld.elf_so/Makefile
+++ b/libexec/ld.elf_so/Makefile
@@ -141,10 +141,6 @@ CPPFLAGS+= -DRTLD_DEFAULT_LIBRARY_PATH=\"${SHLIBDIR}:${LIBDIR}\"
COPTS.rtld.c+= -Wno-stack-protector
COPTS.symbol.c+=-Wno-stack-protector

-.if ${MACHINE_CPU} == "vax"
-COPTS.rtld.c+= -O0
-.endif
-
LDADD+= -Wl,--version-script=${.CURDIR}/symbols.map
LDADD+= -L${CLIBOBJ} -L${DESTDIR}${LIBDIR}
.if ${MKPICLIB} != "no"
diff --git a/sbin/fsck_ffs/Makefile.common b/sbin/fsck_ffs/Makefile.common
index 765638b2801..824e3bf2628 100644
--- a/sbin/fsck_ffs/Makefile.common
+++ b/sbin/fsck_ffs/Makefile.common
@@ -36,7 +36,3 @@ COPTS.ffs_appleufs.c+= -Wno-pointer-sign
.if ${MACHINE_ARCH} == "m68000"
COPTS.pass1.c+= -fno-tree-fre -fno-tree-lrs
.endif
-.if ${MACHINE_ARCH} == "vax"
-COPTS.pass1.c+= -O0
-COPTS.inode.c+= -O0
-.endif
diff --git a/sbin/fsdb/Makefile b/sbin/fsdb/Makefile
index c039f73a1eb..3b0331e5880 100644
--- a/sbin/fsdb/Makefile
+++ b/sbin/fsdb/Makefile
@@ -39,12 +39,6 @@ COPTS.${f}.c+= -Wno-pointer-sign
COPTS.pass1.c+= -fno-tree-fre -fno-tree-lrs
.endif

-.if ${MACHINE_ARCH} == "vax"
-COPTS.pass1.c+= -O0
-COPTS.inode.c+= -O0
-COPTS.fsdb.c+= -O0
-.endif
-
CWARNFLAGS.gcc+= ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}

.include <bsd.prog.mk>
diff --git a/sbin/newfs_ext2fs/Makefile b/sbin/newfs_ext2fs/Makefile
index 40a44b9a038..ecfdbff4d3a 100644
--- a/sbin/newfs_ext2fs/Makefile
+++ b/sbin/newfs_ext2fs/Makefile
@@ -20,8 +20,4 @@ DPADD+=${LIBPROP}

.PATH: ${NETBSDSRCDIR}/sys/ufs/ext2fs ${FSCK}

-.if ${MACHINE_ARCH} == "vax"
-COPTS.mke2fs.c=-O0
-.endif
-
.include <bsd.prog.mk>
diff --git a/sbin/ping/Makefile b/sbin/ping/Makefile
index 4f33501ea7a..1f7f56e3ea5 100644
--- a/sbin/ping/Makefile
+++ b/sbin/ping/Makefile
@@ -12,8 +12,4 @@ CPPFLAGS+= -DIPSEC
LDADD+= -lipsec
DPADD+= ${LIBIPSEC}

-.if ${MACHINE_ARCH} == "vax"
-COPTS.ping.c=-O0
-.endif
-
.include <bsd.prog.mk>
diff --git a/sys/arch/vax/conf/Makefile.vax b/sys/arch/vax/conf/Makefile.vax
index cf095d54a86..c483eaa644a 100644
--- a/sys/arch/vax/conf/Makefile.vax
+++ b/sys/arch/vax/conf/Makefile.vax
@@ -34,7 +34,6 @@ GENASSYM_CONF= ${VAX}/vax/genassym.cf
CPPFLAGS+= -D_VAX_INLINE_
AFLAGS+= -x assembler-with-cpp -fno-pic
CFLAGS+= -fno-pic
-COPTS.wsmux.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 9:? -O1 :}


##
diff --git a/sys/lib/libsa/Makefile b/sys/lib/libsa/Makefile
index 718c97ce857..4ef3840c753 100644
--- a/sys/lib/libsa/Makefile
+++ b/sys/lib/libsa/Makefile
@@ -96,7 +96,3 @@ SRCS+= ufs.c
lib${LIB}.o:: ${OBJS:O} __buildstdlib

CPPFLAGS+= -Wno-pointer-sign
-
-.if defined(HAVE_GCC) && ${MACHINE_ARCH} == "vax"
-COPTS.bootp.c+= -O0
-.endif
diff --git a/sys/lib/libz/Makefile b/sys/lib/libz/Makefile
index 6945c0da6c6..61fb7d4f652 100644
--- a/sys/lib/libz/Makefile
+++ b/sys/lib/libz/Makefile
@@ -25,7 +25,3 @@ CLEANFILES+= lib${LIB}.o
.include <bsd.lib.mk>

lib${LIB}.o:: ${OBJS:O} __buildstdlib
-
-.if defined(HAVE_GCC) && ${MACHINE_ARCH} == "vax"
-COPTS.inftrees.c+= -O0
-.endif
diff --git a/sys/modules/lfs/Makefile b/sys/modules/lfs/Makefile
index 962538821a5..ea8f187e160 100644
--- a/sys/modules/lfs/Makefile
+++ b/sys/modules/lfs/Makefile
@@ -18,9 +18,4 @@ SRCS+= ulfs_bmap.c ulfs_dirhash.c ulfs_inode.c ulfs_lookup.c \

WARNS= 3

-.if ${MACHINE} == "vax"
-# GCC 6.5 and 7.4 cannot compile this with -DDIAGNOSTIC and -O2/-O1
-COPTS.lfs_inode.c+= -O0
-.endif
-
.include <bsd.kmodule.mk>
diff --git a/sys/rump/fs/lib/liblfs/Makefile b/sys/rump/fs/lib/liblfs/Makefile
index abade3767d9..68b74c62502 100644
--- a/sys/rump/fs/lib/liblfs/Makefile
+++ b/sys/rump/fs/lib/liblfs/Makefile
@@ -17,9 +17,6 @@ SRCS+= ulfs_bmap.c ulfs_dirhash.c ulfs_extattr.c \


CFLAGS+= -DLFS_KERNEL_RFW
-.if ${MACHINE_ARCH} == "vax"
-COPTS.lfs_inode.c+=-O0
-.endif

.include <bsd.lib.mk>
.include <bsd.klinks.mk>
diff --git a/usr.sbin/mtrace/Makefile b/usr.sbin/mtrace/Makefile
index aef09db6198..9c125c15265 100644
--- a/usr.sbin/mtrace/Makefile
+++ b/usr.sbin/mtrace/Makefile
@@ -12,10 +12,6 @@ PROG= mtrace
SRCS= igmp.c inet.c kern.c mtrace.c
MAN= mtrace.8

-.if ${MACHINE_ARCH} == "vax"
-COPTS.mtrace.c=-O0
-.endif
-
BINMODE=4555
BINOWN= root

diff --git a/external/gpl3/gcc.old/usr.bin/backend/Makefile b/external/gpl3/gcc.old/usr.bin/backend/Makefile
index d69a26fe619..99e881c783d 100644
--- a/external/gpl3/gcc.old/usr.bin/backend/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/backend/Makefile
@@ -533,68 +533,9 @@ COPTS.insn-recog.c+=-Wno-error

.if ${GCC_MACHINE_ARCH} == "vax"
CPPFLAGS+=-I${.CURDIR}/../../lib/libgcc/libgcov/arch/${GCC_MACHINE_ARCH}
-COPTS.builtins.c+=-O0
-COPTS.calls.c+=-O0
-COPTS.convert.c+=-O0
-COPTS.data-streamer-out.c+=-O0
-COPTS.dse.c+=-O0 # XXX port-vax/51967
-COPTS.dwarf2out.c+=-O0
-COPTS.expmed.c+=-O0
-COPTS.expr.c+=-O0 -Wno-error=tautological-compare
-COPTS.fixed-value.c+=-O0
-COPTS.fold-const.c+=-O0
-COPTS.generic-match.c+=-O0
-COPTS.gimple-fold.c+=-O0
-COPTS.gimple-match.c+=-O0
-COPTS.gimple-ssa-strength-reduction.c+=-O0
-COPTS.gimple-ssa-warn-restrict.c+=-O0
-COPTS.gimple.c+=-O0
-COPTS.internal-fn.c+=-O0
-COPTS.lto-streamer-out.c+=-O0
-COPTS.omp-low.c+=-O0
-COPTS.predict.c+=-O0
-COPTS.range-op.cc+=-O0
-COPTS.recog.c+=-O0
-COPTS.sanopt.c+=-O0
-COPTS.stmt.c+=-O0
-COPTS.stor-layout.c+=-O0
-COPTS.targhooks.c+=-O0
-COPTS.tree-affine.c+=-O0
-COPTS.tree-cfg.c+=-O0
-COPTS.tree-data-ref.c+=-O0
-COPTS.tree-eh.c+=-O0
-COPTS.tree-if-conv.c+=-O0
-COPTS.tree-object-size.c+=-O0
-COPTS.tree-parloops.c+=-O0
-COPTS.tree-predcom.c+=-O0
-COPTS.tree-pretty-print.c+=-O0
-COPTS.tree-ssa-alias.c+=-O0
-COPTS.tree-ssa-ccp.c+=-O0
-COPTS.tree-ssa-forwprop.c+=-O0
-COPTS.tree-ssa-loop-ivopts.c+=-O0
-COPTS.tree-ssa-loop-manip.c+=-O0
-COPTS.tree-ssa-loop-niter.c+=-O0
-COPTS.tree-ssa-math-opts.c+=-O0
-COPTS.tree-ssa-phiopt.c+= -O0
-COPTS.tree-ssa-pre.c+=-O0
-COPTS.tree-ssa-reassoc.c+=-O0
-COPTS.tree-ssa-strlen.c+=-O0
-COPTS.tree-ssa-uninit.c+=-O0
-COPTS.tree-ssa.c+=-O0
-COPTS.tree-switch-conversion.c+=-O0
-COPTS.tree-vect-data-refs.c+=-O0
-COPTS.tree-vect-loop-manip.c+=-O0
-COPTS.tree-vect-loop.c+=-O0
-COPTS.tree-vect-patterns.c+=-O0
-COPTS.tree-vect-stmts.c+=-O0
-COPTS.tree-vrp.c+=-O0
-COPTS.tree.c+=-O0
-COPTS.ubsan.c+=-O0
-COPTS.varasm.c+=-O0
-COPTS.vr-values.c+=-O0
-COPTS.web.c+=-O0
-COPTS.wide-int-range.cc+=-O0
-COPTS.wide-int.cc+=-O0
+
+COPTS.expmed.c+=-Wno-error=tautological-compare
+COPTS.expr.c+=-Wno-error=tautological-compare
.else
COPTS.tree.c= ${${ACTIVE_CC} == "clang" :? -O0 :}
.endif
 1.17 09-Nov-2013  christos branches: 1.17.36;
vax specific gcc 4.8.1 hacks
 1.16 13-Dec-2010  pooka branches: 1.16.6; 1.16.12;
RUMP_ACTION -> RUMPPRG
 1.15 11-Nov-2010  pooka add compile-conditional rumpclient support
 1.14 28-May-2007  tls Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry. RedHat has
evidently built all "core system packages" with this option for some time.

This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.

This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros. Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.

Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default. Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
 1.13 20-Feb-2001  bjh21 Add a dependency on libm.
 1.12 12-Jul-1999  itojun correct typo. s/LDADD/DPADD/
 1.11 02-Jul-1999  itojun IPsec support (specify policy on ping - quite useful to test
if IPsec is working or not) is added.
 1.10 24-Feb-1999  jwise Add code from Daniel Hagerty <hag@ai.mit.edu> to print standard deviation
when printing out final statistics line.

Closes PR bin/6198
 1.9 11-Mar-1997  christos - remove -g from Makefile
- fix setsockopt and recvfrom casts.
 1.8 11-Mar-1997  christos - Use err, warn, errx
- Don't use floor, because we would need libm
- Add maxwait option from old ping
- Add a centralized gethost() to get hostnames
- Fix PR/1014 and PR/2017; (adds -D, -T options, and -I and -t for unicast)
- Document exit status
 1.7 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.6 22-Dec-1994  cgd specify man pages the new way.
 1.5 23-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.4 16-Sep-1997  lukem imported from lite-2
 1.1.1.3 11-Mar-1997  christos From Vernon Schryver <vjs@sgi.com>
 1.1.1.2 23-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.16.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.17.36.1 08-Oct-2023  martin Pull up following revision(s) (requested by rin in ticket #394):

external/gpl3/binutils/dist/gas/config/tc-vax.h: revision 1.10
tools/gcc/Makefile: revision 1.109
external/gpl3/binutils/dist/gas/config/tc-vax.c: revision 1.16
external/gpl3/binutils/dist/gas/config/tc-vax.c: revision 1.17
external/gpl3/binutils/dist/gas/config/tc-vax.c: revision 1.18
external/gpl3/gcc.old/dist/gcc/recog.c: revision 1.12
external/gpl3/gcc.old/dist/gcc/function.c: revision 1.16
external/gpl3/gcc.old/dist/gcc/dse.c: revision 1.14 - 1.16
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.13
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.14
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.15
external/gpl3/gcc.old/dist/gcc/doc/tm.texi.in: revision 1.10
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.16
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.17
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.18
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.19
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.13
external/gpl3/gcc.old/usr.bin/backend/Makefile: revision 1.20
external/gpl3/gcc.old/dist/gcc/targhooks.c: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.14
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.15
external/gpl3/gcc.old/dist/gcc/config/vax/builtins.md: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.16
external/gpl3/gcc.old/dist/gcc/config/vax/builtins.md: revision 1.13
external/gpl3/gcc.old/dist/gcc/doc/tm.texi: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.17
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.18
external/gpl3/gcc.old/dist/gcc/config/vax/elf.h: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/elf.h: revision 1.13
external/gpl3/gcc.old/dist/gcc/targhooks.h: revision 1.12
external/gpl3/gcc.old/dist/gcc/target.def: revision 1.10
external/gpl3/gcc.old/dist/gcc/rtlanal.c: revision 1.14
external/gpl3/gcc.old/dist/gcc/reload.c: revision 1.12
external/gpl3/gcc.old/usr.bin/gcc/Makefile: revision 1.11
external/gpl3/gcc.old/usr.bin/lto-dump/Makefile: revision 1.3
external/gpl3/gcc.old/lib/Makefile.sanitizer: revision 1.7
external/gpl3/binutils.old/lib/libbfd/Makefile: revision 1.10
distrib/utils/x_ping/Makefile: revision 1.9
games/phantasia/Makefile: revision 1.38
external/apache2/argon2/lib/libargon2/Makefile.inc: revision 1.2
external/gpl3/gcc.old/lib/libubsan/Makefile: revision 1.8
external/bsd/mdocml/lib/libmandoc/Makefile: revision 1.13
sbin/ping/Makefile: revision 1.18
sbin/newfs_ext2fs/Makefile: revision 1.7
sys/lib/libz/Makefile: revision 1.24
sys/lib/libsa/Makefile: revision 1.97
external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile: revision 1.3
external/gpl3/gdb/lib/libgdb/Makefile: revision 1.36
sys/modules/lfs/Makefile: revision 1.11
external/mit/xorg/lib/gallium/Makefile: revision 1.51
external/gpl3/gdb.old/lib/libdecnumber/Makefile: revision 1.10
external/mit/xorg/lib/libX11/Makefile.libx11: revision 1.26
libexec/ld.elf_so/Makefile: revision 1.148
external/bsd/jemalloc/lib/Makefile.inc: revision 1.16
external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile: revision 1.14
crypto/external/bsd/openssh/lib/Makefile: revision 1.38
external/gpl3/gcc.old/usr.bin/backend/Makefile: revision 1.21
external/gpl3/gcc.old/usr.bin/cc1/Makefile: revision 1.12
external/gpl3/gcc.old/lib/libasan/Makefile: revision 1.11
external/gpl3/gcc.old/usr.bin/cc1plus/Makefile: revision 1.13
lib/libcrypt/Makefile: revision 1.36
external/gpl3/gdb/lib/libdecnumber/Makefile: revision 1.5
lib/libc/gdtoa/Makefile.inc: revision 1.13
games/gomoku/Makefile: revision 1.13
sbin/fsdb/Makefile: revision 1.43
external/gpl3/gcc.old/usr.bin/lto1/Makefile: revision 1.9
external/mit/xorg/lib/gallium.old/Makefile: revision 1.8
lib/libbz2/Makefile: revision 1.22
external/gpl3/gcc.old/usr.bin/cc1obj/Makefile: revision 1.12
usr.sbin/mtrace/Makefile: revision 1.14
external/gpl3/gcc.old/usr.bin/cc1obj/Makefile: revision 1.13
sys/arch/vax/conf/Makefile.vax: revision 1.86
sys/rump/fs/lib/liblfs/Makefile: revision 1.18
sbin/fsck_ffs/Makefile.common: revision 1.3
external/gpl3/binutils/lib/libbfd/Makefile: revision 1.27
lib/i18n_module/UTF7/Makefile: revision 1.5
external/gpl3/gcc.old/lib/liblsan/Makefile: revision 1.7
doc/CHANGES (apply patch)
(all external/gpl3/gcc.old/ changes applied to external/gpl3/gcc/)

PR 57646: Import major vax toolchain fix.
 1.50 10-Sep-2011  wiz Another option order fix.
 1.49 10-Sep-2011  wiz Sort options and descriptions in standard order.
Remove unecessary Bk/Ek in SYNOPSIS.
 1.48 10-Sep-2011  christos PR/45257: Instead of passing a 32bit sec and 32 bit usec timestamp in little
endian format by default, pass a struct timespec in native host format. Add
-C flag to produce a compatible timestamp like before.
 1.47 21-Mar-2006  pavel Clarify and correct the description of the -R (Record Route) flag.
Reviewed by jnemeth, whith help from him.
 1.46 21-Mar-2006  pavel Bump date, requested by wiz.
 1.45 21-Mar-2006  pavel -I does work for unicast pings too (it sets the source address).
With some language help from dsl.
Reviewed by jnemeth.
 1.44 08-Jun-2004  cjep add -h option in synopsis. Fixes PR#25863 from Kouichirou Hiratsuka.
 1.43 07-Aug-2003  agc branches: 1.43.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22308, verified by myself.
 1.42 25-Feb-2003  wiz .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
 1.41 26-Oct-2002  jdolecek change description of -w option to match reality
this fixes bin/12113 by Jim Bernard and bin/16011 by gabriel rosenkoetter
 1.40 01-Oct-2002  wiz New sentence, new line. By Robert Elz with minimal fixes.
 1.39 06-Apr-2002  bjh21 .Nm . -> .Nm "" .
 1.38 20-Dec-2001  wiz Sync options with usage.
 1.37 16-Nov-2001  wiz Simplify markup, use .Nx, sort sections.
 1.36 16-Nov-2001  wiz Whitespace nits
 1.35 10-Oct-2001  yamt - use IP_MAXPACKET instead of 65535.
- change max packet size from 65468 to 65467(= IP_MAXPACKET-60-8).
 1.34 25-Jun-2001  jhawk Update Dd to rev 1.31 (ipsec changes)
Some hosts and gateways ignore record route, but not "many." Of course,
more are firewalled. But that's not what was meant here.
Expand flood-pinging admonition to include multicast addresses.
Note flags that conflict with ping under Solaris and FreeBSD.
Reorder BUGS in rough order of significance.
 1.33 05-Jun-2001  wiz Drop arguments of .Os.
 1.32 03-Apr-2001  jhawk Xr icmp(4), inet(4), ip(4)
 1.31 02-Jul-1999  itojun IPsec support (specify policy on ping - quite useful to test
if IPsec is working or not) is added.
 1.30 19-Jun-1999  sommerfeld Support for ping -a: beep when packet received.
Slightly tweaked from version submitted by andrew@untraceable.net in PR7815
 1.29 12-Jun-1999  tron Fix a typo.
 1.28 29-Apr-1999  mjl Remove duplicate paragraph. Closes PR/7498 by Geoff C. Wing.
 1.27 07-Mar-1999  mycroft branches: 1.27.2;
Clean up SYNOPSIS formatting.
 1.26 22-Dec-1998  jtk typo: should be loose source routing
 1.25 17-Nov-1998  msaitoh delete .TP (because this document is written in "mdoc" format)
 1.24 25-Oct-1998  christos Update to the 980911 version from ftp.rhyolite.com:/src/ping.tar.Z
 1.23 14-Sep-1998  tv Restrict -l to the superuser as suggested in PR 3973 from <soren@t.dk>.
Also distinguish "-f" from "-i 0.x" in the superuser restriction messages.
 1.22 29-Apr-1998  fair fix bad .Xr references
 1.21 28-Apr-1998  fair Change occurrences of "UNIX" to .Ux or .At as appropriate.
 1.20 06-Feb-1998  perry macroize BSD, NetBSD, FreeBSD and misc cleanup
 1.19 06-Nov-1997  fair Fix man page confusion about the -R option, per PR#4246
Add some paragraph breaks for readability,
and a traceroute(8) reference.
 1.18 03-Oct-1997  hubertf branches: 1.18.2;
PR misc/4206: internal -> interval;
Reported by William O Ferry.
 1.17 15-Sep-1997  lukem * cleanup .Nm
* deprecate register
* cleanup for WARNS=1
* bzero(), bcopy() -> memset(), memmove()
* prefix hex numbers with '0x'
 1.16 26-Jun-1997  kleink Fix formatting directives; from SAITOH Masanobu <msaitoh@spa.is.uec.ac.jp>
in PR misc/3795.
 1.15 01-Jun-1997  christos Update from Vernon Schryver, fixing the kluge to flush the route cache.
 1.14 10-Apr-1997  mikel flag is -f, not --f; from Saitoh Masanobu in PR misc/3469.
 1.13 18-Mar-1997  christos PR/3329: From David Jones: Add F_ONCE
 1.12 11-Mar-1997  christos - Use err, warn, errx
- Don't use floor, because we would need libm
- Add maxwait option from old ping
- Add a centralized gethost() to get hostnames
- Fix PR/1014 and PR/2017; (adds -D, -T options, and -I and -t for unicast)
- Document exit status
 1.11 06-Nov-1996  cgd make ping(8) print out statistics when given a SIGINFO.
 1.10 31-Dec-1995  ghudson The maxwait option was accidentally placed in the "options for
multicast pings" section of the description.
 1.9 02-Oct-1995  pk Fix typo (from Mark Weaver PR#1556);
 1.8 27-Jul-1995  ghudson Add and document options -w (to specify a maximum wait timeout, useful
for testing network interfaces) and -S (to specify a source address
on a machine with multiple interfaces).
 1.7 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.6 29-Nov-1994  glass misc/596: fix from James Jegers for missing host and add cross ref to spray.
 1.5 23-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.4 01-Aug-1993  mycroft Add RCS indentifiers.
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.4 16-Sep-1997  lukem imported from lite-2
 1.1.1.3 11-Mar-1997  christos From Vernon Schryver <vjs@sgi.com>
 1.1.1.2 23-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.18.2.1 06-Nov-1997  mellon Pull rev 1.19 up from trunk (fair)
 1.27.2.1 24-Jun-1999  perry pullup 1.27->1.30 (sommerfeld)
 1.43.2.1 13-Jun-2004  jdc Pull up revision 1.44 (requested by cjep in ticket #459).

add -h option in synopsis. Fixes PR#25863 from Kouichirou Hiratsuka.
 1.122 01-Dec-2022  christos fix sign.
 1.121 01-Dec-2022  christos Add a sanity check for the ip header length (from FreeBSD)
 1.120 22-May-2022  andvar fix various small typos, mainly in comments.
 1.119 07-Apr-2022  andvar fix various typos in comments.
 1.118 11-Jun-2021  rillig ping, ping6: fix comment about ID field

Since ping.c 1.76 and ping6.c 1.58 from 2004-04-22, the ID field
contains random bits instead of a process ID.
 1.117 02-Oct-2017  maya un-ifdef sgi. NFC
 1.116 17-Mar-2017  ryo Fix cksum calculation for clearing the cached route.

In ping.c:r1.104, the size of echoreply packet was changed to ICMP_MINLEN,
Therefore also calculation size must be ICMP_MINLEN.
 1.115 11-Jan-2017  joerg branches: 1.115.2;
Use an explicitly aligned buffer for ip.
 1.114 18-Dec-2016  dholland PR bin/36997 Zafer Aydogan: ping doesn't validate numeric inputs enough.

Reject packet intervals < 1 ns as they lead to infinite loops adding
zero timespecs.

Fix the behind-schedule behavior so it doesn't spend all its time in
that loop adding very small timespecs. Try ping -c 500 -i 0.000000001
to see this in action with the old ping.
 1.113 18-Dec-2016  dholland PR bin/36997 Zafer Aydogan: ping doesn't validate numeric inputs enough.

Check for values between INT_MAX and LONG_MAX (if they're different)
when using strtol to get an int. This applies to the -c and -l options;
the other uses were already checked.

Also limit the inter-packet interval given with -i to values that
don't cause integer overflow calling poll() with milliseconds.

Really large intervals (the number is read as floating point) can
produce positive poll() values but negative integers when converted to
struct timespec; this produces behavior akin to using -l at first and
could be construed as a local DoS vulnerability.
 1.112 07-Oct-2016  joerg Make optspace an array of uint8_t, since some of the bytes written into
it are outside the signed char range.
 1.111 31-Jul-2016  dholland Manipulate the signal masks so signals only arrive while we're waiting,
so they can't illegally reenter libc.

Fixes the problem Greg A. Woods describes in PR 51267, which might or
might not be the original submitter's problem.
 1.110 31-Jul-2016  dholland Don't call variables that are used "dummy".
 1.109 29-Nov-2014  christos branches: 1.109.2;
Adjust default packet size to 56 data bytes (64 total).
Make error messages consistent.
 1.108 27-Nov-2014  christos PR/49423: Martin Husemann: ping for small packets does not work in -7 or
-current
XXX: pullup 7?
 1.107 19-Oct-2013  christos branches: 1.107.4;
avoid bogus uninitialized gcc warning
 1.106 06-Mar-2013  yamt more precision for F_TIMING64
 1.105 30-Dec-2012  christos deduct phdrlen after computing max size.
 1.104 30-Dec-2012  christos 1. Allocate the max packet size before accounting for phdrlen, harmless.
2. In the clear-route-cache sendto, don't send 0 bytes (if -s was specified
with < 8, phdrlen would be 0).
3. Always send ICMP_MINLEN packets; this is what everyone else does. Makes
ping -s n where n < 8 work.
4. The condition for checking the data bytes was completely wrong. only check
the data bytes if we got all of them.
5. The condition for printing a newline was wrong; before it would not print
a newline before printing the data bytes, and it would append to the previous
error message.
 1.103 18-Sep-2012  msaitoh Fix a bug that misunderstand F_TIMING64, F_POLICY and F_AUTHHDR.
 1.102 04-Jan-2012  drochner branches: 1.102.2; 1.102.6; 1.102.8;
include <netipsec/ipsec.h> rather than <netinet6/ipsec.h> from userland
where possible, for consistency and compatibility to FreeBSD
(exception: KAME specific statistics gathering in netstat(1) and systat(1))
 1.101 11-Sep-2011  christos branches: 1.101.2;
print summary stats.
 1.100 10-Sep-2011  wiz Sort options and descriptions in standard order.
Remove unecessary Bk/Ek in SYNOPSIS.
 1.99 10-Sep-2011  christos PR/45257: Instead of passing a 32bit sec and 32 bit usec timestamp in little
endian format by default, pass a struct timespec in native host format. Add
-C flag to produce a compatible timestamp like before.
 1.98 27-Aug-2011  joerg static + __dead
 1.97 21-Aug-2011  christos handle the first loop where time == 0.
 1.96 20-Aug-2011  christos we need difftime to return a signed result, so clamp the timeval's to
uint32_t but then, return a signed result of their difference.
 1.95 19-Aug-2011  christos PR/45257: Ryo Shimizu: ping(8) prints bogus round-trip times after Year 2038
Clamp all time computations to 32 bits; idea from dsl@
 1.94 09-Aug-2011  joerg Don't use array access to compute addresses that are definitely beyond
the static array boundaries.
 1.93 11-Mar-2011  pooka Make get/setuid prog ops (so that i can do rump.ping -f regardless
of host privs).
 1.92 13-Dec-2010  pooka RUMP_ACTION -> RUMPPRG
 1.91 11-Nov-2010  pooka add compile-conditional rumpclient support
 1.90 02-Nov-2009  christos remove ancient ifdefs (Aleksej Saushev)
 1.89 11-Apr-2009  lukem fix sign-compare issues
 1.88 31-Mar-2009  christos PR/41111: Ed Ravin: ping -R gives misleading error when remote side doesn't
support record route
Deal with source route and record route specially giving a meaningful error
message.
Pullup to 5.0?
 1.87 08-Jan-2008  seanb branches: 1.87.10; 1.87.12; 1.87.16;
Shutdown sloop socket for read as it's never read on to
prevent mbufs from queueing in its recv buf.
PR:21459
 1.86 17-Jan-2007  hubertf branches: 1.86.4; 1.86.6;
Remove more duplicate #includes,
from Slava Semushin <slava.semushin@gmail.com>
 1.85 28-Sep-2006  elad Change error message to say "setuid", forgotten in previous commit.

Pointed out by Ray Lai, thanks!
 1.84 24-Sep-2006  elad On 2nd thought, setuid() is better here.
 1.83 24-Sep-2006  elad PR/28741: Michael Santos: ping does [not] drop root privileges

Moved socket calls way up, and called seteuid(getuid()).
 1.82 14-Jul-2006  yamt prtsig: remove a mysterious abort().
 1.81 03-Jun-2006  christos Use SA_NOKERNINFO instead of playing with the tty.
 1.80 01-Jun-2006  christos Factor out the tty code and explain we prefer to stop in the ^Z bg case
when we exit, rather than kill the tty setting.
 1.79 01-Jun-2006  christos PR/33623: Chuck Cranor: Ping stops when ran in the background
because it tries to set the tty not to print kerninfo. Change it
to only only play with the tty when ping is running in the foreground
(and will not stop when calling tcsetattr()). In my opinion, it is
preferable to print the kerninfo line with the ping info message
rather than to mess with the tty, but that's just me.
 1.78 09-May-2006  mrg change (mostly) int to socklen_t. GCC 4 doesn't like that int and
socklen_t are different signness.
 1.77 13-May-2004  kleink branches: 1.77.2; 1.77.4; 1.77.6;
There's no point in bringing PRNG output to network byteorder prior to
transmission.
 1.76 22-Apr-2004  itojun do not disclose endian. henning@openbsd
 1.75 26-Jan-2004  itojun branches: 1.75.2; 1.75.4; 1.75.6;
do not disclose endianness/sizeof(long) on probe packet. idea from openbsd
 1.74 05-Jan-2004  jmmv Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
 1.73 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22308, verified by myself.
 1.72 14-Apr-2003  itojun permit -s 0. from Maxim Konovalov
 1.71 16-Nov-2002  itojun set sa_len right
 1.70 16-Nov-2002  itojun die if strdup fails
 1.69 16-Nov-2002  itojun use strlcpy. initialize sa_len correctly.
 1.68 21-Sep-2002  mycroft Touch up error/warning messages.
 1.67 21-Sep-2002  mycroft select() -> poll()
 1.66 12-Aug-2002  matt Add support for printing out messages about missing packet gaps. This is
done with the -v switch. If -q is also given with -v, then only the
packet gap messages will be printed along with summary after each gap
message.
 1.65 01-Aug-2002  itojun u_short cleansing (use u_int16_t where appropriate)
 1.64 31-May-2002  itojun clarify comment when nreceived > ntransmitted. from deraadt
 1.63 20-Dec-2001  soren Sync getopt() / man page with actual getopt options.
 1.62 01-Nov-2001  lukem fix a couple of -Wshadow warnings
 1.61 10-Oct-2001  yamt - use IP_MAXPACKET instead of 65535.
- change max packet size from 65468 to 65467(= IP_MAXPACKET-60-8).
 1.60 09-Oct-2001  yamt - fix overrun bug.
- bump bufsize to fix "packet loss" with large packet.
 1.59 19-Feb-2001  cgd convert to use getprogname()
 1.58 12-Jan-2001  itojun correct use of howmany() for fd_set. commented by deraadt
 1.57 10-Oct-2000  is Format string cleanups by Bill Sommerfeld.
 1.56 07-Oct-2000  itojun avoid fd_set overflow. see openbsd select(2).
 1.55 31-Jan-2000  itojun branches: 1.55.4;
sync with latest libipsec and kernel.
 1.54 20-Jan-2000  mycroft Fix data comparison to not overrun array bounds.
 1.53 04-Jul-1999  itojun do not pass NULL to errx().

From: Chris Joness <cjones@rupert.honors.montana.edu>
 1.52 04-Jul-1999  itojun do not bark even if ipsec policy setting for "route flushing 127.0.0.1"
ping socket is not successful. it usually means that the kernel is
not ipsec ready, and in that case this should be just okay.
 1.51 03-Jul-1999  kleink 0 -> STDIN_FILENO
 1.50 02-Jul-1999  itojun IPsec support (specify policy on ping - quite useful to test
if IPsec is working or not) is added.
 1.49 19-Jun-1999  sommerfeld Support for ping -a: beep when packet received.
Slightly tweaked from version submitted by andrew@untraceable.net in PR7815
 1.48 17-Apr-1999  mjl Correct nokerninfo tty flag being left set in most error cases.
Closes PR/7388 by Dave Huang <khym@bga.com>.
 1.47 08-Mar-1999  sommerfe branches: 1.47.2;
Don't bother doing stddev calculation when n==1, since that results in
a computation of 0.0/0.0.
On IEEE systems you get a NaN from this; non-IEEE systems probably
give you a SIGFPE.
 1.46 25-Feb-1999  jwise Once more around the hickory shrub. Faster and simpler stddev calculation from
Bill Studenmund.
 1.45 25-Feb-1999  jwise Fix calculation of standard deviation. From Brian C. Grayson <bgrayson@orac.ece.utexas.edu>
 1.44 24-Feb-1999  jwise Add code from Daniel Hagerty <hag@ai.mit.edu> to print standard deviation
when printing out final statistics line.

Closes PR bin/6198
 1.43 06-Nov-1998  christos char -> unsigned char
 1.42 26-Oct-1998  enami Fix usage string;
- option to specify maxwait is -w, not -i.
- add missing -h host and -Q option.
 1.41 25-Oct-1998  christos Update to the 980911 version from ftp.rhyolite.com:/src/ping.tar.Z
 1.40 01-Oct-1998  frueauf Add getuid() check if -f is set, fixes pr 6222 by Uwe Arndt.
 1.39 14-Sep-1998  tv Restrict -l to the superuser as suggested in PR 3973 from <soren@t.dk>.
Also distinguish "-f" from "-i 0.x" in the superuser restriction messages.
 1.38 14-Sep-1998  tv Nuke the termios stuff from the 1997/03/11 import, which prevents ping
from being run in the background of most shells without redirecting stdin
from /dev/null. (AFAICT, the termios stuff is useless and does not
interfere with SIGINFO handling.)
 1.37 28-Jul-1998  mycroft __AUDIT__ cleanup.
 1.36 16-Apr-1998  kleink Take into consideration that icmp_nextmtu is stored in network byte order;
from Leonard Samuelson in PR bin/5230.
 1.35 01-Dec-1997  christos PR/4615: David Jones: Ping usage does not show -o option.
 1.34 30-Nov-1997  christos Make the "failed to clear cached route" a warning only if verbose is set.
This always happens when lo0 is not configured and confuses new users.
 1.33 05-Nov-1997  cgd lint
 1.32 15-Sep-1997  lukem branches: 1.32.2;
* cleanup .Nm
* deprecate register
* cleanup for WARNS=1
* bzero(), bcopy() -> memset(), memmove()
* prefix hex numbers with '0x'
 1.31 17-Jul-1997  mikel convert to host byte order when printing stats of received ICMP
packets other than echo-replies; from Dave Huang in PR bin/3876
 1.30 01-Jun-1997  christos Update from Vernon Schryver, fixing the kluge to flush the route cache.
 1.29 02-Apr-1997  augustss Make ping obey the -n flag in places.
 1.28 24-Mar-1997  christos Don't allow < 1 sec ping interval to regular users.
 1.27 19-Mar-1997  christos Try adding `o' option again; connection died.
 1.26 19-Mar-1997  christos Take care of alignment problems on the alpha: From John Birell, via cgd.
 1.25 18-Mar-1997  christos PR/3329: From David Jones: Add F_ONCE
 1.24 13-Mar-1997  christos Fix PR/3327: rcvd_tbl index was assumed to be in host order, creating
incorrect dup reports. From enami tsugutomo
 1.23 11-Mar-1997  christos - remove -g from Makefile
- fix setsockopt and recvfrom casts.
 1.22 11-Mar-1997  christos - Use err, warn, errx
- Don't use floor, because we would need libm
- Add maxwait option from old ping
- Add a centralized gethost() to get hostnames
- Fix PR/1014 and PR/2017; (adds -D, -T options, and -I and -t for unicast)
- Document exit status
 1.21 06-Nov-1996  cgd make ping(8) print out statistics when given a SIGINFO.
 1.20 11-Aug-1995  cgd fix a couple of bugs pointed out by John Birrell, though fix some
differently he did. (1) don't assume that the timeval in
the packet is correctly aligned, (2) don't compare beyond the end
of the packet, (3) minor cast for printf happiness.
 1.19 27-Jul-1995  ghudson Add and document options -w (to specify a maximum wait timeout, useful
for testing network interfaces) and -S (to specify a source address
on a machine with multiple interfaces).
 1.18 26-Jun-1995  jtc sys/signal.h -> signal.h
 1.17 03-Jun-1995  mycroft Fill in sin_len.
 1.16 21-May-1995  mycroft Use inet_aton(), not inet_addr().
 1.15 22-Apr-1995  cgd if no packets were received, exit with status 1. this should be
documented somewhere. As suggested by Rens Troost.
 1.14 21-Mar-1995  mycroft Update to use timer{add,sub}().
 1.13 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.12 18-Dec-1994  cgd -Wall cleanups from Jim Jegers
 1.11 31-Oct-1994  cgd will need <sys/queue.h>
 1.10 23-Sep-1994  mycroft Remove some more uses of obsolete functions.
 1.9 23-Sep-1994  mycroft Eliminate uses of some obsolete functions.
 1.8 23-Sep-1994  mycroft Merge with 4.4-Lite version.
 1.7 15-Dec-1993  hpeyerl Another multicast patch.
>From LBL and Steve Mccanne
 1.6 23-Sep-1993  mycroft Use doubles to rather than longs to avoid tsum overflowing so quickly.
 1.5 01-Aug-1993  mycroft Add RCS identifiers.
 1.4 22-Jul-1993  cgd have ping do the right thing, wrt microseconds.
actually, now it'll overflow its counters sooner than before, and everything
should *really* be converted to doubles and/or "unsigned long long"s
 1.3 23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2 22-Mar-1993  cgd added rcs ids to all files
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.4 16-Sep-1997  lukem imported from lite-2
 1.1.1.3 11-Mar-1997  christos From Vernon Schryver <vjs@sgi.com>
 1.1.1.2 23-Sep-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.32.2.2 05-May-1998  mycroft Pull up 1.36, per request of kleink.
 1.32.2.1 01-Dec-1997  mellon Pull rev 1.33, 1.34 and 1.35 up from trunk (christos) (reviewed by mellon)
 1.47.2.2 10-Oct-2000  he Pull up revision 1.57 (via patch, requested by is):
Format string cleanup.
 1.47.2.1 24-Jun-1999  perry pullup 1.47->1.48 (sommerfeld)
 1.55.4.2 18-Oct-2000  tv Pullup 1.56 [itojun]:
avoid fd_set overflow.
 1.55.4.1 18-Oct-2000  tv Pullup sbin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.
 1.75.6.1 11-Aug-2007  bouyer Pull up following revision(s) (requested by ghen in ticket #11352):
sbin/ping/ping.c: revision 1.83 - 1.85
PR/28741: Michael Santos: ping does [not] drop root privileges
Moved socket calls way up, and called seteuid(getuid()).
On 2nd thought, setuid() is better here.
Change error message to say "setuid", forgotten in previous commit.
Pointed out by Ray Lai, thanks!
 1.75.4.2 11-Aug-2007  bouyer Pull up following revision(s) (requested by ghen in ticket #11352):
sbin/ping/ping.c: revision 1.83 - 1.85
PR/28741: Michael Santos: ping does [not] drop root privileges
Moved socket calls way up, and called seteuid(getuid()).
On 2nd thought, setuid() is better here.
Change error message to say "setuid", forgotten in previous commit.
Pointed out by Ray Lai, thanks!
 1.75.4.1 11-Aug-2007  bouyer Pull up following revision(s) (requested by ghen in ticket #11351):
sbin/ping/ping.c: revision 1.79, 1.80
PR/33623: Chuck Cranor: Ping stops when ran in the background
because it tries to set the tty not to print kerninfo. Change it
to only only play with the tty when ping is running in the foreground
(and will not stop when calling tcsetattr()). In my opinion, it is
preferable to print the kerninfo line with the ping info message
rather than to mess with the tty, but that's just me.
Factor out the tty code and explain we prefer to stop in the ^Z bg case
when we exit, rather than kill the tty setting.
 1.75.2.1 11-Aug-2007  bouyer Pull up following revision(s) (requested by ghen in ticket #11352):
sbin/ping/ping.c: revision 1.83 - 1.85
PR/28741: Michael Santos: ping does [not] drop root privileges
Moved socket calls way up, and called seteuid(getuid()).
On 2nd thought, setuid() is better here.
Change error message to say "setuid", forgotten in previous commit.
Pointed out by Ray Lai, thanks!
 1.77.6.1 26-Aug-2007  bouyer Pull up following revision(s) (requested by ghen in ticket #1818):
sbin/ping/ping.c: revisions 1.83 - 1.85
PR/28741: Michael Santos: ping does [not] drop root privileges
 1.77.4.1 26-Aug-2007  bouyer Pull up following revision(s) (requested by ghen in ticket #1818):
sbin/ping/ping.c: revisions 1.83 - 1.85
PR/28741: Michael Santos: ping does [not] drop root privileges
 1.77.2.2 26-Aug-2007  bouyer Pull up following revision(s) (requested by ghen in ticket #1818):
sbin/ping/ping.c: revisions 1.83 - 1.85
PR/28741: Michael Santos: ping does [not] drop root privileges
 1.77.2.1 26-Aug-2007  bouyer Pull up following revision(s) (requested by ghen in ticket #1817):
sbin/ping/ping.c: revisions 1.79 - 1.80
PR/33623: Chuck Cranor: Ping stops when ran in the background
because it tries to set the tty not to print kerninfo. Change it
to only only play with the tty when ping is running in the foreground
(and will not stop when calling tcsetattr()). In my opinion, it is
preferable to print the kerninfo line with the ping info message
rather than to mess with the tty, but that's just me.
Factor out the tty code and explain we prefer to stop in the ^Z bg case
when we exit, rather than kill the tty setting.
 1.86.6.1 18-Feb-2008  mjf Sync with HEAD.
 1.86.4.1 23-Mar-2008  matt sync with HEAD
 1.87.16.1 21-Apr-2010  matt sync to netbsd-5
 1.87.12.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.87.10.1 03-May-2009  snj Pull up following revision(s) (requested by christos in ticket #636):
sbin/ping/ping.c: revision 1.88
PR/41111: Ed Ravin: ping -R gives misleading error when remote side doesn't
support record route
Deal with source route and record route specially giving a meaningful error
message.
 1.101.2.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.101.2.3 23-Jan-2013  yamt sync with head
 1.101.2.2 30-Oct-2012  yamt sync with head
 1.101.2.1 17-Apr-2012  yamt sync with head
 1.102.8.1 11-Jul-2017  snj Pull up following revision(s) (requested by dholland in ticket #1424):
sbin/ping/ping.c: revision 1.113 via patch
PR bin/36997 Zafer Aydogan: ping doesn't validate numeric inputs enough.
Check for values between INT_MAX and LONG_MAX (if they're different)
when using strtol to get an int. This applies to the -c and -l options;
the other uses were already checked.
Also limit the inter-packet interval given with -i to values that
don't cause integer overflow calling poll() with milliseconds.
Really large intervals (the number is read as floating point) can
produce positive poll() values but negative integers when converted to
struct timespec; this produces behavior akin to using -l at first and
could be construed as a local DoS vulnerability.
 1.102.6.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.102.6.3 23-Jun-2013  tls resync from head
 1.102.6.2 25-Feb-2013  tls resync with head
 1.102.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.102.2.2 11-Jul-2017  snj Pull up following revision(s) (requested by dholland in ticket #1424):
sbin/ping/ping.c: revision 1.113 via patch
PR bin/36997 Zafer Aydogan: ping doesn't validate numeric inputs enough.
Check for values between INT_MAX and LONG_MAX (if they're different)
when using strtol to get an int. This applies to the -c and -l options;
the other uses were already checked.
Also limit the inter-packet interval given with -i to values that
don't cause integer overflow calling poll() with milliseconds.
Really large intervals (the number is read as floating point) can
produce positive poll() values but negative integers when converted to
struct timespec; this produces behavior akin to using -l at first and
could be construed as a local DoS vulnerability.
 1.102.2.1 23-Oct-2012  riz branches: 1.102.2.1.2;
Pull up following revision(s) (requested by msaitoh in ticket #621):
sbin/ping/ping.c: revision 1.103
Fix a bug that misunderstand F_TIMING64, F_POLICY and F_AUTHHDR.
 1.102.2.1.2.1 11-Jul-2017  snj Pull up following revision(s) (requested by dholland in ticket #1424):
sbin/ping/ping.c: revision 1.113 via patch
PR bin/36997 Zafer Aydogan: ping doesn't validate numeric inputs enough.
Check for values between INT_MAX and LONG_MAX (if they're different)
when using strtol to get an int. This applies to the -c and -l options;
the other uses were already checked.
Also limit the inter-packet interval given with -i to values that
don't cause integer overflow calling poll() with milliseconds.
Really large intervals (the number is read as floating point) can
produce positive poll() values but negative integers when converted to
struct timespec; this produces behavior akin to using -l at first and
could be construed as a local DoS vulnerability.
 1.107.4.3 12-May-2017  snj Pull up following revision(s) (requested by ryo in ticket #1390):
sbin/ping/ping.c: revision 1.116
Fix cksum calculation for clearing the cached route.
In ping.c:r1.104, the size of echoreply packet was changed to ICMP_MINLEN,
Therefore also calculation size must be ICMP_MINLEN.
 1.107.4.2 18-Dec-2016  snj branches: 1.107.4.2.2;
Pull up following revision(s) (requested by dholland in ticket #1333):
sbin/ping/ping.c: revision 1.113
PR bin/36997 Zafer Aydogan: ping doesn't validate numeric inputs enough.
Check for values between INT_MAX and LONG_MAX (if they're different)
when using strtol to get an int. This applies to the -c and -l options;
the other uses were already checked.
Also limit the inter-packet interval given with -i to values that
don't cause integer overflow calling poll() with milliseconds.
Really large intervals (the number is read as floating point) can
produce positive poll() values but negative integers when converted to
struct timespec; this produces behavior akin to using -l at first and
could be construed as a local DoS vulnerability.
 1.107.4.1 14-Apr-2015  snj branches: 1.107.4.1.2; 1.107.4.1.4;
Pull up following revision(s) (requested by christos in ticket #692):
sbin/ping/ping.c: revisions 1.108, 1.109
PR/49423: Martin Husemann: ping for small packets does not work in -7 or
-current
--
Adjust default packet size to 56 data bytes (64 total).
Make error messages consistent.
 1.107.4.2.2.1 12-May-2017  snj Pull up following revision(s) (requested by ryo in ticket #1390):
sbin/ping/ping.c: revision 1.116
Fix cksum calculation for clearing the cached route.
In ping.c:r1.104, the size of echoreply packet was changed to ICMP_MINLEN,
Therefore also calculation size must be ICMP_MINLEN.
 1.107.4.1.4.1 18-Jan-2017  skrll Sync with netbsd-5
 1.107.4.1.2.2 12-May-2017  snj Pull up following revision(s) (requested by ryo in ticket #1390):
sbin/ping/ping.c: revision 1.116
Fix cksum calculation for clearing the cached route.
In ping.c:r1.104, the size of echoreply packet was changed to ICMP_MINLEN,
Therefore also calculation size must be ICMP_MINLEN.
 1.107.4.1.2.1 18-Dec-2016  snj Pull up following revision(s) (requested by dholland in ticket #1333):
sbin/ping/ping.c: revision 1.113
PR bin/36997 Zafer Aydogan: ping doesn't validate numeric inputs enough.
Check for values between INT_MAX and LONG_MAX (if they're different)
when using strtol to get an int. This applies to the -c and -l options;
the other uses were already checked.
Also limit the inter-packet interval given with -i to values that
don't cause integer overflow calling poll() with milliseconds.
Really large intervals (the number is read as floating point) can
produce positive poll() values but negative integers when converted to
struct timespec; this produces behavior akin to using -l at first and
could be construed as a local DoS vulnerability.
 1.109.2.4 20-Mar-2017  pgoyette Sync with HEAD
 1.109.2.3 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.109.2.2 04-Nov-2016  pgoyette Sync with HEAD
 1.109.2.1 06-Aug-2016  pgoyette Sync with HEAD
 1.115.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.2 11-Mar-2011  pooka Make get/setuid prog ops (so that i can do rump.ping -f regardless
of host privs).
 1.1 13-Dec-2010  pooka RUMP_ACTION -> RUMPPRG
 1.2 11-Mar-2011  pooka Make get/setuid prog ops (so that i can do rump.ping -f regardless
of host privs).
 1.1 13-Dec-2010  pooka RUMP_ACTION -> RUMPPRG
 1.3 11-Mar-2011  pooka Make get/setuid prog ops (so that i can do rump.ping -f regardless
of host privs).
 1.2 13-Dec-2010  pooka be a happy crunch build
 1.1 13-Dec-2010  pooka RUMP_ACTION -> RUMPPRG

RSS XML Feed