Commit Graph

11201 Commits

Author SHA1 Message Date
pfg
c41fd18fc0 MFC r291155:
bc: sync with OpenBSD

tty.c Rev. 1.3
Avoid unintended problems with operator precedence when doing an
assignment and comparison.

bc.1, Rev. 1.31, 1.32
'.Ql Quit' -> '.Ql quit' because only the lowercase command is valid.
Clarify sentence about `quit` in BUGS section.

extern.h, Rev. 1.12
whitespace

bc.y, Rev. 1.47
Prefer setvbuf() to setlinebuf() for portability

Obtained from:	OpenBSD
2015-12-26 18:26:44 +00:00
delphij
897a072717 MFC: xz 5.2.2.
Relnotes:	yes
2015-12-22 08:03:23 +00:00
emaste
f2aaab3d83 MFC r289349: mkimg: support fat16b partitions (MBR type 06h)
Sponsored by:	The FreeBSD Foundation
2015-12-16 16:44:56 +00:00
bdrewery
e16d0d1c5c MFC r266566:
Add .../share/mk to the default system make path. This will fix the problem
  with broken in-tree builds (which are used far more pervasively than I'd
  known outside the tree). However, weird results may now happen if at any
  point in the tree above you there happens to be a directory that has
  subdirectory of share/mk, as unpredictable results will follow. This was
  considered the lessor of the two evils, at least for now. In the future this
  will be removed again when the underlying issues are resolved.

  For MFCing, this is to ensure that when upgrading to head the share/mk
  in-tree is always used.  Otherwise several build features will not work.
  This passes a build using head's bmake which has this as the default
  already.

Relnotes:	yes
2015-12-14 21:33:31 +00:00
sjg
65747233a8 Merge bmake-20151201 2015-12-10 23:44:34 +00:00
bdrewery
233987c6df Fix mis-merge in r291816, nl_defs.h not used here. 2015-12-04 21:11:17 +00:00
bapt
6dbd460022 MFC: r291091
install: do not follow symlinks

In case the target of install is a dead symlink, install(1) used to not
consider it as "existing" because of the usage of stat(2) instead of
lstat(2).  meaning the old file (the symlink) is not removed before the new
file is created. The symlink is being followed and the new file becoming the
target of the symlink instead of the target of install(1)

Reviewed by:	jhb, brooks
Differential Revision:	https://reviews.freebsd.org/D4191
2015-12-04 20:41:44 +00:00
bdrewery
8e2550bfa6 MFC r291348:
Use LIBEXECDIR for /usr/libexec.
2015-12-04 19:16:56 +00:00
bdrewery
c941b9a56b MFC r291330:
Replace DPSRCS that work fine in SRCS.
2015-12-04 19:04:04 +00:00
bdrewery
563146937c MFC r284289,r288267:
r284289:
    Misc fixes from projects/bmake
  r288267:
    Remove redundant .NOPATH.
2015-12-04 18:59:20 +00:00
bdrewery
092e8d5213 MFC r291329:
Remove redundant DPSRCS which were already in SRCS.
2015-12-04 18:50:12 +00:00
bdrewery
b38bd3ffca MFC r291026:
Remove unneeded libmd from bootstrap-tools (reverting r246784).
2015-12-04 18:48:08 +00:00
bdrewery
2ffafbd8c7 MFC r290431:
Add SUBDIR_PARALLEL.
2015-12-04 18:31:19 +00:00
bdrewery
21a7306566 MFC r290083:
Use more appropriate ${SHAREDIR} rather than /usr/share.
2015-12-04 18:21:05 +00:00
bdrewery
241e144b76 MFC r289872:
Replace gcc reference with 'cc' and document the default ${CC}.
2015-12-04 18:04:56 +00:00
ume
11814c27fd MFC r291097:
Don't truncate an interface name when -W option is specified.
2015-11-27 03:48:02 +00:00
jkim
4aff854e25 MFC: r289425
Add support for ARM EABI.  Note it is not a direct MFC because some macros
are not defined in this branch.
2015-11-24 23:04:03 +00:00
ume
9aec66905f MFC r290367, r290370, r290437:
Change to not truncate an interface name when -W option
is specified.

MFC Requested by:	Jim Thompson <jim__at__netgate.com>
2015-11-20 16:10:58 +00:00
ngie
97443342e5 MFC r290567:
Add some basic tests that exercise cputime limits with limits(1)

Sponsored by: EMC / Isilon Storage Division
2015-11-16 00:58:31 +00:00
ngie
2f2934388e MFC r289195:
Integrate the tests from lib/libarchive, usr.bin/cpio, and usr.bin/tar in to
the FreeBSD test suite

functional_test.sh was ported from bin/sh/tests/functional_test.sh, as a
small wrapper around libarchive_test, bsdcpio_test, and bsdtar_test provided
by upstream.

A handful of testcases in lib/libarchive/tests have been disabled as they
were failing when run with kyua test (see BROKEN_TESTS in
lib/libarchive/tests/Makefile)

As a sidenote: this removes the check/test targets from the Makefiles as they
don't match the pattern used in the rest of the FreeBSD test suite.

Sponsored by: EMC / Isilon Storage Division

Conflicts:
	lib/libarchive/test
	usr.bin/cpio/test
2015-11-15 22:13:41 +00:00
ngie
69b1aae668 MFC r283245:
r283245 (by imp):

Remove stray DEBUG_FLAGS=-g that snuck in with r184761.
2015-11-15 21:56:15 +00:00
delphij
e812570142 MFC r290024,290073:
In gunzip(1), treat trailing garbage as a warning and not an error.  This
allows scripts to distinguish it between real fatal errors, for instance a
CRC mismatch.

Update manual page for the behavior change.

PR:		bin/203873
Submitted by:	Eugene Grosbein <eugen grosbein net>
2015-11-09 01:53:54 +00:00
ache
fab4b61ecb MFC: r290329,r290336
PR: 204230

r290329:

Use meaningful errno for ssize_t overflow in read().
Catch size_t overflow in malloc().

r290336:

Check for (old|new)size + 1 overflows off_t.
2015-11-08 14:22:57 +00:00
jhb
bff6260e96 MFC 271389,286330,286331,286358,286378,286380,286381,286383,286388,286848,
286849,286857,286860,286913,286914,286937-286940,286962,286963,288405,
288406,288424,288454-288456,288625,288626,288832,288834,288950,288997,
289080:
Merge most of the recent changes to truss in HEAD.  The largest effects
are that fork following now uses a single truss process (and thus truss -c
reports counts for the entire tree of processes instead of separate dumps
for each process).  truss -c also reports counts for all system calls
instead of only a subset.  More system call arguments are also decoded.
System calls should now report the correct number of arguments (instead
of 6), and some platforms that did not properly decode arguments might
now do so (e.g. mips64).

Changes relative to the equivalent commits to HEAD include:
- The ia64 backend was refactored similar to the other backends.
- _umtx_lock/_umtx_unlock entries were updated similar to other system
  call entries.
- 10 does not have futimens(), utimensat(), EVFILT_PROCDESC, EVFILT_SENDFILE,
  RLIMIT_KQUEUES, O_VERIFY, NOTE_FILE_POLL, or EV_FORCEONESHOT.

271389:
Stop accessing the saved stack pointer by looking past the end of the
array of registers.

286330:
Whitespace fix: remove some spurious spaces before commas.

286331:
Rework get_string() to make it more robust when fetching strings of unknown
length.  In particular, instead of blinding fetching 1k blocks, do an initial
fetch up to the end of the current page followed by page-sized fetches up to
the maximum size.  Previously if the 1k buffer crossed a page boundary and
the second page was not valid, the entire operation would fail.

286358:
Add recently added values of various flags and enumerations including
kevent filters, kevent flags, flags to mmap, seek locations, fcntl
operations, file flags, socket domains, open flags, resource limits, and
pathconf values.

286378:
Don't mark the fcntl flag argument as an output parameter so that it is
always decoded.  Previously the argument was not decoded if fcntl() failed.

286380:
Decode the arguments to mkfifo() and fix an off-by-one error in the arguments
to mknod().

286381:
Decode the arguments passed to the *at() family of system calls.  This is
especially useful now that libc's open() always calls openat().  While here,
fix a few other things:
- Decode the mode argument passed to access(), eaccess(), and faccessat().
- Decode the atfd paramete to pretty-print AT_FDCWD.
- Decode the special AT_* flags used with some of the *at() system calls.
- Decode arguments for fchmod(), lchmod(), fchown(), lchown(), eaccess(),
  and futimens().
- Decode both of the timeval structures passed to futimes() instead of just
  the first one.

286383:
Whitespace fixes to consistently use spaces before }'s and
wrap long lines.

286388:
Consistently use both leading and trailing spaces inside of the {}'s
when pretty-printing structures.  Most structures used both spaces,
but some only used a trailing space and some used neither.

286848:
- Decode the arguments for several signal-related system calls: sigpending,
  sigqueue, sigreturn, sigsuspend, sigtimedwait, sigwait, sigwaitinfo, and
  thr_kill.
- Print signal sets as a structure (with {}'s) and in particular use this to
  differentiate empty sets from a NULL pointer.
- Decode arguments for some other system calls: issetugid, pipe2, sysarch
  (operations are only decoded for amd64 and i386), and thr_self.

286849:
Decode the optional SOCK_NONBLOCK and SOCK_CLOEXEC flags passed in a
socket type.

286857:
Tidy the linux_socketcall decoding:
- Don't exit if get_struct() fails, instead print the raw pointer value to
  match all other argument decoding cases.
- Use an xlat table instead of a home-rolled switch for the operation name.
- Display the nested socketcall args structure as a structure instead of as
  two inline arguments.

286860:
Use an xlat table and xlookup() instead of a home-rolled version for the
sigprocmask operation type.

286913:
Change the argument formatting function to use a stdio FILE object opened
with open_memstream() to build the string for each argument.  This allows
for more complicated argument building without resorting to intermediate
malloc's, etc.

Related, the strsig*() functions no longer return allocated strings but
use a static global buffer instead.

286914:
Expand the decoding of kevent structures.
- Print the ident value as decimal instead of hexadecimal for filter types
  that use "small" values such as file descriptors and PIDs.
- Decode NOTE_* flags in the fflags field of kevents for several system
  filter types.

286937:
Use nitems().

286938:
Various style and whitespace fixes.

287939:
Always use %j with an intmax_t cast to print time_t values.  time_t is
longer than long on 32-bit platforms with a 64-bit time_t.

286940:
ino_t is unsigned, so use uintmax_t instead of intmax_t when printing it.

286962:
Rework the argv and env string fetching for execve to be more robust.
Before truss would fetch 100 string pointers and happily walk off the end
of the array if it never found a NULL.  This also means for a short argv
list it could fail entirely if the 100 string pointers spanned into an
unmapped page.

Instead, fetch page-aligned blocks of string pointers in a loop fetching
each string until a NULL is found.

While here, make use of the open memstream file descriptor instead of
allocating a temporary array.  This allows us to fetch each string once
instead of twice.

286963:
Handle the conditional decoding of execve() argument and environment
arrays generically rather than duplicating a hack in all of the backends.
- Add two new system call argument types and use them instead of StringArray
  for the argument and environment arguments execve and linux_execve.
- Honor the -a/-e flags in the handling of these new types.
- Instead of printing "<missing argument>" when the decoding is disabled,
  print the raw pointer value.

288405:
Decode recently added procctl(2) operations.

288406:
Trim trailing whitespace.

288424:
Several changes to truss.
- Refactor the interface between the ABI-independent code and the
  ABI-specific backends.  The backends now provide smaller hooks to
  fetch system call arguments and return values.  The rest of the
  system call entry and exit handling that was previously duplicated
  among all the backends has been moved to one place.
- Merge the loop when waiting for an event with the loop for handling stops.
  This also means not emulating a procfs-like interface on top of ptrace().
  Instead, use a single event loop that fetches process events via waitid().
  Among other things this allows us to report the full 32-bit exit value.
- Use PT_FOLLOW_FORK to follow new child processes instead of forking a new
  truss process for each new child.  This allows one truss process to monitor
  a tree of processes and truss -c should now display one total for the
  entire tree instead of separate summaries per process.
- Use the recently added fields to ptrace_lwpinfo to determine the current
  system call number and argument count.  The latter is especially useful
  and fixes a regression since the conversion from procfs.  truss now
  generally prints the correct number of arguments for most system calls
  rather than printing extra arguments for any call not listed in the
  table in syscalls.c.
- Actually check the new ABI when processes call exec.  The comments claimed
  that this happened but it was not being done (perhaps this was another
  regression in the conversion to ptrace()).  If the new ABI after exec
  is not supported, truss detaches from the process.  If truss does not
  support the ABI for a newly executed process the process is killed
  before it returns from exec.
- Along with the refactor, teach the various ABI-specific backends to
  fetch both return values, not just the first.  Use this to properly
  report the full 64-bit return value from lseek().  In addition, the
  handler for "pipe" now pulls the pair of descriptors out of the
  return values (which is the true kernel system call interface) but
  displays them as an argument (which matches the interface exported by
  libc).
- Each ABI handler adds entries to a linker set rather than requiring
  a statically defined table of handlers in main.c.
- The arm and mips system call fetching code was changed to follow the
  same pattern as amd64 (and the in-kernel handler) of fetching register
  arguments first and then reading any remaining arguments from the
  stack.  This should fix indirect system call arguments on at least
  arm.
- The mipsn32 and n64 ABIs will now look for arguments in A4 through A7.
- Use register %ebp for the 6th system call argument for Linux/i386 ABIs
  to match the in-kernel argument fetch code.
- For powerpc binaries on a powerpc64 system, fetch the extra arguments
  on the stack as 32-bit values that are then copied into the 64-bit
  argument array instead of reading the 32-bit values directly into the
  64-bit array.

288454:
- Remove extra integer argument from truncate() and ftruncate().  This is
  probably fallout from the removal of the extra padding argument before
  off_t in 7.  However, that padding still exists for 32-bit powerpc, so
  use QUAD_ALIGN.
- Fix QUAD_ALIGN to be zero for powerpc64.  It should only be set to 1
  for 32-bit platforms that add padding to align 64-bit arguments.

288455:
The id_t type used to pass IDs to wait6(2) and procctl(6) is a 64-bit
integer.  Fix the argument decoding to treat this as a quad instead of an
int.  This includes using QUAD_ALIGN and QUAD_SLOTS as necessary.  To
continue printing IDs in decimal, add a new QuadHex argument type that
prints a 64-bit integer in hex, use QuadHex for the existing off_t arguments,
repurpose Quad to print a 64-bit integer in decimal, and use Quad for id_t
arguments.

This fixes the decoding of wait6(2) and procctl(2) on 32-bit platforms.

288456:
Rather than groveling around in a socket address structure for a socket
address's length (and then overriding it if it "looks wrong"), use the
next argument to the system call to determine the length.  This is more
reliable since this is what the kernel depends on anyway and is also
simpler.

288625:
Add decoding for struct statfs.

288626:
Style fix.

288832:
Fix tracking of unknown syscalls for 'truss -c'.

This is done by changing get_syscall() to either lookup the known syscall
or add it into the list with the default handlers for printing.

This also simplifies some code to not have to check if the syscall variable
is set or NULL.

288834:
Add decoding for modfind(2)

288950:
Group the decoded system calls by ABI and sort the calls within each ABI.

288997:
Correct a comment.

289080:
Let -c imply -S (hide signal output).

Without this, the signals are shown seemingly randomly in the output before
the final summary is shown.  This is especially noticeable when there is
not much output from the application being traced.
2015-10-27 17:00:04 +00:00
bapt
6a0c65530b MFC: r289878
timeout(1): fix the acceptable range values for parse_signal()

Before both 0 and sys_nsig would be successfully returned by parse_signal()
although being invalid signal numbers.

Submitted by:	Alexandre Perrin <alex@kaworu.ch>
2015-10-27 07:08:47 +00:00
ngie
471d0645dc MFC r282339,r282341:
r282339 (by bapt):

Add regression test about reverse line feed to col(1)

r282341 (by bapt):

Actually push the right tests
2015-10-26 03:15:06 +00:00
bapt
a372d7e311 getconf(1): Fix typo. _POSIX_V6_LP64_OFFBIG -> _POSIX_V6_LPBIG_OFFBIG.
Submitted by:	Sascha Wildner <saw@online.de>
Obtained from:	DragonflyBSD
2015-10-22 06:32:33 +00:00
bdrewery
8db7e0379c MFC r288903:
Fix crash if a process sends itself a SIGTRAP.  Just forward it as expected.

  This does not match head as the code was rewritten significantly there.

Relnotes:	yes
2015-10-20 18:35:52 +00:00
trasz
a8182c4d10 MFC r287785:
Make it clear that 'swapuse' is swap reservation and not actual swap usage.

Sponsored by:	The FreeBSD Foundation
2015-10-18 15:03:47 +00:00
bdrewery
f8a9ff862c MFC r288266:
Add more SUBDIR_PARALLEL.
2015-10-13 18:56:50 +00:00
hselasky
8096b85f20 MFC r288335:
Store PID after becoming a daemon() and not before to ensure the
correct PID gets written to the PID file.

PR:		203252
2015-10-13 08:21:15 +00:00
peter
6a8fa4cab5 MFC: r269851,r272076,r274884,r282328,r285644,r286503,r286504,r286505,
r286506,r286510,r286561,r286562,r287034

Update svnlite from 1.8.10 to 1.8.14, and the support components:
serf->1.3.8, apr->1.5.2, apr-util->1.5.4, sqlite3->3.8.11.1

This includes syncing the developer templates with head.
2015-10-12 04:57:36 +00:00
mav
4a2038e9a9 MFC r288059: Bunch of improvements to ctlstat.
Add -p option to allow filtering by ports.
Make -l and -p options work in all modes as filters.
Improve output formatting to better fit columns.
2015-10-05 10:49:01 +00:00
mav
4add53bf36 MFC r288043:
Output times as normal microseconds, rather then in bintime format.
2015-10-05 10:48:14 +00:00
mav
656a5c3136 MFC r286806: Drop "internal" CTL frontend.
Its idea was to be a simple initiator and execute several commands from
kernel level, but FreeBSD never had consumer for that functionality,
while its implementation polluted many unrelated places.
2015-10-05 08:42:43 +00:00
bdrewery
d55e00843a MFC r288199,r288246:
Add missing CLEANFILES.
2015-10-03 16:01:16 +00:00
jhb
050b8bd1a6 MFC 283624,283630:
Export a list of VM objects in the system via a sysctl.  The list can be
examined via 'vmstat -o'.  It can be used to determine which files are
using physical pages of memory and how much each is using.
2015-10-01 17:09:20 +00:00
jhb
bbc4a5345e MFC 269727:
Update vmstat usage for last-argument count/wait parameters

Correct the usage in both the manpage and in usage() to indicate
that the wait interval and repetition count may be given either
with the respective -w/-c arguments, or as the final positional
arguments. [0]

The corresponding code to implement the positional arguments has
been conditional on the (always-enabled) BACKWARD_COMPATIBILITY
macro since the original 4.4-lite import.  It's no longer reasonable
to remove the functionality, so remove the macro and conditional
instead.

Note that multiple disks may be given on the command line.

While here, sort arguments and apply minor mdoc fixes.

PR:		184755 [0]
2015-09-30 00:11:06 +00:00
bdrewery
4432171c46 MFC r288154:
Similar to r266147, don't define PROG in the test subdirs.
2015-09-29 22:00:03 +00:00
emaste
a5313e9c06 MFC r286010: ar: enable deterministic mode by default
Ar cannot handle UIDs with more than 6 digits, and storing the mtime,
uid, gid and mode provides little to negative value anyhow for ar's
uses. Turn on deterministic (-D) mode by default; it can be disabled by
the user with -U.

Also MFC follow-on fixes in r286024 and r287324.

PR:		196929
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2015-09-25 00:23:36 +00:00
emaste
c472cfaaf0 MFC r287340: vtfontcvt: fix buffer overflow for non-default size .hex fonts
And r287336 which introduced xmalloc.

Sponsored by:	The FreeBSD Foundation
2015-09-24 13:06:19 +00:00
emaste
6dd9d3e499 MFC r282916: Add ELF machine EM_IAMCU, 32-bit Intel MCU
It is e_machine 6, which was previously reserved for 486.
2015-09-24 12:54:50 +00:00
emaste
5bfff19cb0 MFC r287327: ar: Deobfuscate a while loop 2015-09-24 12:47:31 +00:00
emaste
09f805e314 MFC r285841: Add RISC-V ELF machine type definition
EM_RISCV is now officially registered as e_machine 243.

Sponsored by:	The FreeBSD Foundation
2015-09-24 12:44:02 +00:00
delphij
1a5b0b1eee MFC r287634:
login.c doesn't really need libutil.h, don't include it.

login_fbtab.c includes paths.h and pathnames.h, and pathnames.h includes
paths.h.  Eliminate the paths.h inclusion in login_fbtab.c.
2015-09-24 00:54:46 +00:00
delphij
d812607618 MFC r287633:
- Avoid accessing window properties directly, instead, use accessors.
   This should be no-op for now, but allows the code to work if we
   move to NCURSES_OPAQUE.
 - Use calloc() instead of malloc+bzero.
2015-09-24 00:50:17 +00:00
delphij
0e2b30291c MFC r287590:
w(1) is not setgid binary since r53279, so remove the setgid() call.

Reviewed By:	wollman
2015-09-23 01:07:45 +00:00
pfg
af1f6583e1 MFC r286891, r286893:
calendar(1): add a few more dates to the Christian calendar

Bring some well established holidays that also happen to be legal
holidays in many Catholic countries.
2015-09-17 00:36:18 +00:00
delphij
9a0c37807b MFC r287320:
- uri is expected to be nul-terminated (strchr used later),
   so use strlcpy instead of strncpy.
 - replace the other two cases of strncpy+\0 with strlcpy.
2015-09-14 18:57:50 +00:00
delphij
3908360148 MFC r287319:
Constify opt_f and opt_t and eliminate unneeded copying.  This fixes
memory leaks.

Reported by:	clang static analyzer
2015-09-14 18:52:41 +00:00