Commit Graph

2613 Commits

Author SHA1 Message Date
Edward Tomasz Napierala
1aeaf00340 Add some basic regression tests for mdconfig(8). 2012-01-24 13:23:52 +00:00
Alexander Leidinger
02068a2420 We are in FreeBSD 10 now: define __FreeBSD__ to 10. 2012-01-24 11:06:22 +00:00
Alexander Leidinger
07c1584e76 Mechanically add a config for all missing drivers.
No cross-referencing was added to the configs, so no
automatic linking to the documentation of other subsystems.

Drivers which already contain doxygen markup:
agp ath bktr bxe cxgb cxgbe dpt drm e1000 iir
ixgbe mwl nxge ofw pccard siba wpi xen
2012-01-23 11:37:40 +00:00
Jilles Tjoelker
6eff4a75d5 sh: Fix $? in the first command of a 'for'.
In the first command of a 'for', $? should be the exit status of the last
pipeline (command substitution in the word list or command before 'for'),
not always 0.
2012-01-22 14:00:33 +00:00
Adrian Chadd
11e66657d7 Bring over the visibility control tool for Monthadar's wtap project.
This allows basic control over which wtap nodes can see which other
wtap nodes.
2012-01-22 04:51:00 +00:00
David Schultz
b831cdf6b1 These tests check whether the compiler evaluates floating-point
expressions properly.  Some of the tests depend on the compiler
implementing C99's FENV_ACCESS pragma, and only commercial compilers
do; those tests are currently skipped.  If any of the enabled tests
fail, then odds are the libm regression tests will fail also.
This should make it easier to diagnose reported problems on platforms
I don't have.

Currently, gcc passes all the tests that don't depend on FENV_ACCESS
on amd64 and sparc64.  Clang fails a few on amd64 (see clang bug
11406).  Both gcc and clang fare poorly on i386, which has well-known
issues.
2012-01-20 06:57:21 +00:00
Jean-Sébastien Pédron
01a43bcf7b sh: Fix execution of multiple statements in a trap when evalskip is set
Before this fix, only the first statement of the trap was executed if
evalskip was set. This is for example the case when:
    o  "-e" is set for this shell
    o  a trap is set on EXIT
    o  a function returns 1 and causes the script to abort

Reviewed by:	jilles
MFC after:	2 weeks
2012-01-16 11:07:46 +00:00
Jean-Sébastien Pédron
cb1c8e8ced sh: Test EXIT trap with multiple statements in it
Reviewed by:	jilles
MFC after:	2 weeks
2012-01-16 10:59:44 +00:00
Jilles Tjoelker
93fcb2511b sh: Fix some bugs with exit status from case containing ;&.
Also, rework evalcase() to not evaluate any tree. Instead, return the
NCLISTFALLTHRU node and handle it in evaltree().

Fixed bugs:

* If a ;& list with non-zero exit status is followed by an empty ;; or final
  list, the exit status of the case command should be equal to the exit
  status of the ;& list, not 0.

* An empty ;& case should not reset $?.
2012-01-15 21:39:38 +00:00
Jilles Tjoelker
92371efca2 sh: Fix two bugs with case and exit status:
* If no pattern is matched, POSIX says the exit status shall be 0 (even if
  there are command substitutions).
* If a pattern is matched and there are no command substitutions, the first
  command should see the $? from before the case command, not always 0.
2012-01-15 20:04:05 +00:00
Jilles Tjoelker
d0766f8d45 sh: Add testcases that should not be broken by future optimizations. 2012-01-14 23:10:18 +00:00
David Schultz
d302778ed3 Add .t files for tests, missed in prior checkins, so that prove(1) works
in this directory.
2012-01-14 21:38:31 +00:00
David Schultz
5d9e02dba4 Update the tests for arm and other ports where long double is the same
as double, similar to r178141.
2012-01-14 21:09:54 +00:00
David Schultz
3e7ed66b1e Fix a test that doesn't work on architectures where long double is no
wider than double.  Thanks to Ian Lepore for catching the bug.
2012-01-14 08:11:40 +00:00
Jilles Tjoelker
e94e3511bd sh: Properly show "Not a directory" error in cd builtin.
The errno message display added in r222292 did not take attempting to
cd to a non-directory or something that cannot be stat()ed into account.

PR:		bin/164070
MFC after:	10 days
2012-01-13 23:32:27 +00:00
Ed Schouten
f9d9bcd45e Remove wtmpcvt(1).
The wtmpcvt(1) utility converts wtmp files to the new format used by
utmpx(3). Now that HEAD has been branched to stable/9 and 9.0 is
released, there is no need for it in HEAD.

MFC after:	never
2012-01-13 15:40:49 +00:00
Adrian Chadd
418b9e0c1b Bring over a tool to create and destroy wtap instances.
Submitted by:	Monthadar Al Jaberi <monthadar@gmail.com>
2012-01-11 17:51:56 +00:00
Eitan Adler
2394cc2228 X11BASE has been deprecated for a long time and will die soon
Approved by:	x11 (eadler)
Approved by:	brucec
MFC after:	1 week
2012-01-09 00:48:19 +00:00
Jilles Tjoelker
c6791c926e sh: Avoid possible echo options in a testcase. 2012-01-06 23:20:33 +00:00
Adrian Chadd
6b1dcfcd83 Import the first cut of "bsdbox".
This uses the existing crunchgen infrastructure to build
a series of tools designed to replace the base and networking
tools on an embedded system.

It reuses 'bsd.crunchgen.mk' to drive the actual file
creation. The rescue build system also uses this.

Unlike busybox, it doesn't include its own source - instead,
it just builds from the sources in /usr/src/ and leverages
the existing BSD framework.

Thie is still quite messy and could do with a whole lot of
cleaning up.   However it is proving to be very useful with
my current build framework, allowing me to build binary root
images that are about 30% less than simply cherrypicking files
and libraries from an installworld.
2012-01-06 00:56:31 +00:00
Ulrich Spörlein
381edcda1e Convert files over to UTF-8.
These files contained various combinations of Big5, eucJP and KOI8-U
encoded strings. The byte representations of their respective encodings
have been translated to $'...' escape sequences as understood by our sh(1).

With help from:	jilles
2012-01-05 21:36:53 +00:00
Pawel Jakub Dawidek
ba804f54f9 Fix an obvious typo. We do want to specify file permission when we pass O_CREAT. 2012-01-03 22:52:29 +00:00
Robert Watson
6508f34eb6 Add WITHOUT_CAPSICUM src.conf(5) define, which can be used to compile out
use of Capsicum by userspace applications.

MFC after:	3 weeks
Sponsored by:	Google, Inc.
2012-01-02 21:57:58 +00:00
Jean-Sébastien Pédron
840fac731b Adapt testsuite following change in Domain Search error handling
In this testsuite, warning() and error() have the same behaviour.

PR:		bin/163431
Sponsored by:	Yakaz (http://www.yakaz.com)
2011-12-30 14:41:47 +00:00
Ulrich Spörlein
8ce070c1b2 Spelling fixes for tools/
Add some $FreeBSD$ tags so svn will allow the commit.
2011-12-30 00:04:11 +00:00
Robert Watson
b77dd854a8 Fix typo in comment.
MFC after:	3 days
2011-12-29 15:34:59 +00:00
Ulrich Spörlein
47e236b178 Reencode files from latin1 to UTF-8. 2011-12-29 12:33:27 +00:00
Jilles Tjoelker
3a1b9c9e82 sh: Allow quoting ^ and ] in bracket expressions. 2011-12-28 23:51:17 +00:00
Olivier Houchard
0044d1b553 Oops, if we want to check from 0 to nsock, the test condition should be
< nsock, not >.

Pointy hat to:	cognet
Submitted by:	Olivier Cochard-Labbe <olivier AT cochard doT me>
2011-12-28 13:01:12 +00:00
Adrian Chadd
d015e7e4d2 Oops, my bad. Fix a broken thing I introduced earlier. 2011-12-26 19:41:46 +00:00
Jilles Tjoelker
80cdf644e6 sh: Add some testcases for pasting $*/$@ directly to a literal.
This also passes on stable/8.
2011-12-25 13:24:48 +00:00
Adrian Chadd
61c0c6fe76 Add in ath_ee_9287_print. 2011-12-23 02:57:18 +00:00
Navdeep Parhar
7be5be337a Catch up with new driver ioctls in cxgbe.
MFC after:	1 month
2011-12-16 20:38:22 +00:00
Navdeep Parhar
733b92779e Many updates to cxgbe(4)
- Device configuration via plain text config file.  Also able to operate
  when not attached to the chip as the master driver.

- Generic "work request" queue that serves as the base for both ctrl and
  ofld tx queues.

- Generic interrupt handler routine that can process any event on any
  kind of ingress queue (via a dispatch table).

- A couple of new driver ioctls.  cxgbetool can now install a firmware
  to the card ("loadfw" command) and can read the card's memory
  ("memdump" and "tcb" commands).

- Lots of assorted information within dev.t4nex.X.misc.*  This is
  primarily for debugging and won't show up in sysctl -a.

- Code to manage the L2 tables on the chip.

- Updates to cxgbe(4) man page to go with the tunables that have changed.

- Updates to the shared code in common/

- Updates to the driver-firmware interface (now at fw 1.4.16.0)

MFC after:	1 month
2011-12-16 02:09:51 +00:00
Max Khon
548f8e2d41 Fix last-minute typo. 2011-12-15 06:12:43 +00:00
Max Khon
174da58b23 Add job error output test.
make(1) with openpty() currently fails this test: there's a race condition
and error output is sometimes lost.
2011-12-15 06:01:06 +00:00
Jilles Tjoelker
1fc7f6471e Add a test for r228510. 2011-12-14 23:26:48 +00:00
Dimitry Andric
8f506e9e08 Add more files to cleanup with 'make delete-old' when WITHOUT_CLANG is
in effect.

MFC after:	1 week
2011-12-11 14:01:11 +00:00
John Baldwin
f627c55e7e - Add a test for PR 151758.
- While here, make this compile and work on non-i386:
  - Use CMSG_SPACE(), CMSG_LEN(), and CMSG_FIRSTHDR() instead of ignoring
    padding between 'struct cmsghdr' and control message payloads.
  - Don't initialize the control message before calling recvmsg().
    Instead, check that we get a valid control message on return from
    recvmsg().
- Use errx() instead of err() for some errors that don't report failures
  that set errno.

Requested by:	kib (1)
2011-12-09 19:24:17 +00:00
Dimitry Andric
d4c8b5d2e8 Vendor import of llvm 3.0 final release:
http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_30/final@145349
2011-12-09 18:27:22 +00:00
Luigi Rizzo
506cc70cce 1. Fix the handling of link reset while in netmap more.
A link reset now is completely transparent for the netmap client:
   even if the NIC resets its own ring (e.g. restarting from 0),
   the client will not see any change in the current rx/tx positions,
   because the driver will keep track of the offset between the two.

2. make the device-specific code more uniform across different drivers
   There were some inconsistencies in the implementation of the netmap
   support routines, now drivers have been aligned to a common
   code structure.

3. import netmap support for ixgbe . This is implemented as a very
   small patch for ixgbe.c (233 lines, 11 chunks, mostly comments:
   in total the patch has only 54 lines of new code) , as most of
   the code is in an external file sys/dev/netmap/ixgbe_netmap.h ,
   following some initial comments from Jack Vogel about making
   changes less intrusive.
   (Note, i have emailed Jack multiple times asking if he had
   comments on this structure of the code; i got no reply so
   i assume he is fine with it).

Support for other drivers (em, lem, re, igb) will come later.

"ixgbe" is now the reference driver for netmap support. Both the
external file (sys/dev/netmap/ixgbe_netmap.h) and the device-specific
patches (in sys/dev/ixgbe/ixgbe.c) are heavily commented and should
serve as a reference for other device drivers.

Tested on i386 and amd64 with the pkt-gen program in tools/tools/netmap,
the sender does 14.88 Mpps at 1050 Mhz and 14.2 Mpps at 900 MHz
on an i7-860 with 4 cores and 82599 card. Haven't tried yet more
aggressive optimizations such as adding 'prefetch' instructions
in the time-critical parts of the code.
2011-12-05 12:06:53 +00:00
Eitan Adler
0a79dbc6b5 Fix some uninitialized variables in pipe regression tests that result in
failure.

PR:		misc/161175
Submitted by:	gianni@
Approved by:	nwhitehorn@
MFC after:	1 week
2011-12-05 04:20:13 +00:00
Jean-Sébastien Pédron
409139f051 Support domain-search in dhclient(8)
The "domain-search" option (option 119) allows a DHCP server to publish
a list of implicit domain suffixes used during name lookup. This option
is described in RFC 3397.

For instance, if the domain-search option says:
    ".example.org .example.com"
and one wants to resolve "foobar", the resolver will try:
    1. "foobar.example.org"
    2. "foobar.example.com"

The file /etc/resolv.conf is updated with a "search" directive if the
DHCP server provides "domain-search".

A regression test suite is included in this patch under
tools/regression/sbin/dhclient.

PR:		bin/151940
Sponsored by	Yakaz (http://www.yakaz.com)
2011-12-04 14:44:31 +00:00
Max Khon
5f73185f0f Revert to conservative defaults. WITH_PROFILE is a default now.
NO_PROFILE overrides in Makefile.inc1 and bsd.own.m are left intact
so that the reversal to the WITHOUT_PROFILE will be easier in future.
2011-12-02 09:09:54 +00:00
Konstantin Belousov
8df934eb55 Add a simple test for pipe inode numbers reported by fstat(2).
Submitted by:	gianni
MFC after:	1 week
2011-12-01 11:20:25 +00:00
Max Khon
e90e78598e Add WITH_CTF description. 2011-11-30 18:22:44 +00:00
Max Khon
df62aec1a0 Add three execution tests for make(1):
- plus: execute "+command" when run with -jX -n
- ellipsis: ellipsis ("...") from variable
- empty: empty command (from variable)

Currently make(1) fails all three tests:
- plus: segmentation fault due to incorrect command list handling
- ellipsis: works in compat mode but fails in job (-jX) mode
- empty:
        - compat mode: prints error message
	- job mode: works but prints empty string
2011-11-30 05:49:17 +00:00
Max Khon
d0ed1ea4b7 Turn off profiled libs build by default.
Can be enabled back using WITH_PROFILE=yes in /etc/src.conf
2011-11-29 19:46:17 +00:00
Jilles Tjoelker
f4f4b264b5 test: Add more testcases.
The new testcases pass even on old stable/7, but some other implementations
manage to get them wrong.

Also remove a few duplicate testcases.
2011-11-28 23:10:53 +00:00
Dimitry Andric
34b874d804 Add WITH_LIBCPLUSPLUS under tools/build/options; the knob itself was
already added in a previous revision.
2011-11-28 17:56:46 +00:00
Max Khon
c33e09b444 Add a comment that shows how to limit the build to the specific list of arches. 2011-11-28 14:03:36 +00:00
Jilles Tjoelker
0d4c3087c0 sh: Add tests for some corner cases of 'case' exit status.
These already work properly.
2011-11-26 22:28:25 +00:00
Max Khon
b8a1e4a8c3 Add missing ;; 2011-11-24 14:22:05 +00:00
Max Khon
bc14d7f4c4 Utility script to build specific parts of the source tree on all arches 2011-11-24 14:16:01 +00:00
Adrian Chadd
317d14cf46 Tidy up the statistic documentation.
Sponsored by:	Hobnob, Inc.
2011-11-23 05:03:27 +00:00
Adrian Chadd
1df8da4c64 Add the new statistics introduced in r227868.
Sponsored by:	Hobnob, Inc.
2011-11-23 05:01:23 +00:00
Jilles Tjoelker
bf3db314f7 sh: Allow unsetting OPTIND.
Note that only assigning the decimal value 1 resets getopts, as before.
2011-11-20 21:48:50 +00:00
Dimitry Andric
fd75cb79ce Revert r227538, since it doesn't compile with clang at all (it doesn't
allow the built-in operations to be redefined, at least not without
excessive force).

Instead, just disable LLVM's support for atomic operations for now.
Nothing in either clang or the tablegen tools currently depends on it.

This still allows users of head built before r198344 to upgrade to
top-of-head seamlessly.
2011-11-17 21:06:53 +00:00
Luigi Rizzo
68b8534bdf Bring in support for netmap, a framework for very efficient packet
I/O from userspace, capable of line rate at 10G, see

	http://info.iet.unipi.it/~luigi/netmap/

At this time I am bringing in only the generic code (sys/dev/netmap/
plus two headers under sys/net/), and some sample applications in
tools/tools/netmap. There is also a manpage in share/man/man4 [1]

In order to make use of the framework you need to build a kernel
with "device netmap", and patch individual drivers with the code
that you can find in

	sys/dev/netmap/head.diff

The file will go away as the relevant pieces are committed to
the various device drivers, which should happen in a few days
after talking to the driver maintainers.

Netmap support is available at the moment for Intel 10G and 1G
cards (ixgbe, em/lem/igb), and for the Realtek 1G card ("re").
I have partial patches for "bge" and am starting to work on "cxgbe".
Hopefully changes are trivial enough so interested third parties
can submit their patches. Interested people can contact me
for advice on how to add netmap support to specific devices.

CREDITS:
    Netmap has been developed by Luigi Rizzo and other collaborators
    at the Universita` di Pisa, and supported by EU project CHANGE
    (http://www.change-project.eu/)
    The code is distributed under a BSD Copyright.

[1] In my opinion is a bad idea to have all manpage in one directory.
  We should place kernel documentation in the same dir that contains
  the code, which would make it much simpler to keep doc and code
  in sync, reduce the clutter in share/man/ and incidentally is
  the policy used for all of userspace code.
  Makefiles and doc tools can be trivially adjusted to find the
  manpages in the relevant subdirs.
2011-11-17 12:17:39 +00:00
Dimitry Andric
5a880d34e1 LLVM uses atomic operations, which are not supported on i386 and GCC
emits calls for them, rather than expanding them inline.  Older FreeBSD
versions compile for i386 by default and as such we end up with
unresolved symbols when we build LLVM's TableGen utility as a build
tool on them.  Add the functions that GCC emits here, but don't bother
to make them atomic. Such is not needed.

Submitted by:	marcel
MFC after:	1 week
2011-11-15 20:15:58 +00:00
David Schultz
35ee51e291 A regression test to ensure that arc4random returns different sequences
in parent and child processes after a fork.
2011-11-15 05:55:15 +00:00
Olivier Houchard
c2a24727c8 Add IPv6 support to netblast/netsend/netreceive
PR:		bin/161368
Submitted by:	Olivier Cochard-Labbe <olivier AT cochard doT me>
2011-11-08 17:23:43 +00:00
Jilles Tjoelker
ddc13b6f44 fifo_misc test: Fix swapped lseek arguments.
It worked regardless because SEEK_CUR happens to be 1.
2011-11-05 22:33:19 +00:00
Jilles Tjoelker
06842f4c3e sh: Add test for exit status of for loop without items.
POSIX says the exit status of a for loop without any items shall be 0. There
are no exceptions if the exit status of the previous command was not 0 or if
the item list contains a command substitution with non-zero exit status.
2011-10-28 23:02:21 +00:00
Adrian Chadd
b1b75b3b75 Bring over the new aggregate statistics from the 11n branch.
Some of these values are currently updated by the driver (the 11n
RX related statistics) so they are immediately useful.
2011-10-26 16:11:49 +00:00
Pawel Jakub Dawidek
13e6fd986b Fix resize regressions tests - we need to destroy BSDlabel before we can
create GPT.

MFC after:	3 days
2011-10-25 13:41:12 +00:00
Poul-Henning Kamp
b2d1ddebf1 Add a "-P olddistfiles" facility to prefetch ports distfiles, using an
old distfile directory as primary source:

      mkdir /freebsd/ports/distfiles.old
      mv /freebsd/ports/distfiles/* /freebsd/ports/distfiles.old
      sh sysbuild.sh -c $yourconfig -P /freebsd/ports/distfiles.old
      rm -rf /freebsd/ports/distfiles.old

Unfortunately bsd.ports.mk does not attempt to use a hard-link so
while this runs you need diskspace for both your old and your "new"
distfiles.
2011-10-23 19:46:01 +00:00
Pawel Jakub Dawidek
1ae7ff8ba6 Because ZFS boot code was very fragile in the past and real PITA to debug,
introduce zfsboottest.sh script that will verify if it will be possible to boot
from the given pool.

	# zfsboottest.sh system

Where "system" is pool name of the pool we want to boot from.

What is being verified by the script:
- Does the pool exist?
- Does it have bootfs property configured?
- Is mountpoint property of the boot dataset set to 'legacy'?

Dataset configured in bootfs property has to be mounted to perform more
checks:
- Does the /boot directory in boot dataset exist?
- Is this dataset configured as root file system in /etc/fstab or set
  in vfs.root.mountfrom variable in /boot/loader.conf?

By using zfsboottest tool the script will read all the files in /boot
directory using ZFS boot code and calculate their checksums.
Then, it will walk /boot directory using find(1) though regular file sytem
and also read all the files in /boot directory and calculate their checksums.
If any of the files cannot be looked up, read or checksum is invalid it will
be reported and booting off of this pool is probably not possible.

Some additional checks may be interesting as well. For example if the disks
contain proper pmbr and gptzfsboot code or if all expected files in /boot/
are present.

When upgrading FreeBSD, one should snapshot datasets that contain operating
system, upgrade (install new world and kernel) and use zfsboottest.sh to verify
if it will be possible to boot from new configuration. If all is good one
should upgrade boot blocks, by eg.:

	# gpart -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1

If something is wrong, one should rollback datasets and report the problems.

MFC after:	3 days
2011-10-21 13:44:26 +00:00
Pawel Jakub Dawidek
cf43b453ec - Allow to specify multiple files to check, eg.
zfsboottest gpt/system0 gpt/system1 - /boot/kernel/kernel /boot/zfsloader

- Instead of printing file's content calculate MD5 hash of the file,
  so it can be easly compared to the hash calculated via file system.
- Some other minor improvements.

MFC after:	3 days
2011-10-21 13:13:18 +00:00
David Schultz
417c551014 Add regression tests for modf{,f,l}(). 2011-10-21 06:36:40 +00:00
David Schultz
6fcec4dd2b Tests for complex trig and hyperbolic functions. 2011-10-21 06:34:38 +00:00
David Schultz
417f648842 Tests for cancellation in fma(). Also include more tests for 128-bit
long doubles. Thanks for clusteradm (simon) for making the needed
hardware available.
2011-10-21 06:32:54 +00:00
Dimitry Andric
36981b17ed Vendor import of clang release_30 branch r142614:
http://llvm.org/svn/llvm-project/cfe/branches/release_30@142614
2011-10-20 21:14:49 +00:00
Dimitry Andric
30815c536b Vendor import of llvm release_30 branch r142614:
http://llvm.org/svn/llvm-project/llvm/branches/release_30@142614
2011-10-20 21:10:27 +00:00
Jilles Tjoelker
b0e4234a5a Fix some memory errors in *at() regression tests. 2011-10-18 22:51:40 +00:00
David Schultz
31b4d3aef3 Add some tests for corner cases of log() in unusual rounding modes.
I wrote these ages ago, but they've been failing until now.
2011-10-15 05:28:13 +00:00
David Schultz
9c7781b7a3 Add some tests for double-rounding bugs in fma(). 2011-10-15 05:26:16 +00:00
Andrew Thompson
b1657d09e6 Fix build after TARGET_BIG_ENDIAN was nuked from orbit. 2011-10-11 01:11:57 +00:00
Stanislav Sedov
7c450da7b4 - Import Heimdal 1.5 distribution. 2011-10-05 07:23:29 +00:00
Stanislav Sedov
b4e3a10e93 - Kill files that do not belong to the laters heimdal version imported. 2011-09-29 05:58:09 +00:00
Stanislav Sedov
31f1e9c17f - Flatten the vendor heimdal tree. 2011-09-29 05:23:57 +00:00
Stanislav Sedov
611ff617cf - Add missing interdependencies to kerberos libraries. Some of the
kerberos libraries were not linked properly (missing dependencies),
  which causes 3rd party applications linking to fail when --as-needed
  ld flag is used.  I also added the --no-undefined ld(1) flag to make
  sure that there're no missing dependencies.

MFC after:	3 days
2011-09-27 07:14:12 +00:00
Andriy Gapon
ed8945cb71 zfsboottest: some additional enhancements
- redirect diagnostics printfs in the boot code to stderr
- do not read trailing garbage from a trailing block of a file

Also add my copyright to the file after making so many changes.

Approved by:	re (kib)
MFC after:	1 week
2011-09-16 08:24:31 +00:00
Andriy Gapon
d560f3523c zfstest: rename to zfsboottest and move to tools
Approved by:	re (kib)
MFC after:	1 week
2011-09-16 08:22:48 +00:00
Marius Strobl
7493181297 Fix alignment assumptions.
PR:		160289
Approved by:	re (kib)
MFC after:	3 days
2011-09-02 16:40:18 +00:00
Bjoern A. Zeeb
8a006adb24 Add support for IPv6 to ipfw fwd:
Distinguish IPv4 and IPv6 addresses and optional port numbers in
user space to set the option for the correct protocol family.
Add support in the kernel for carrying the new IPv6 destination
address and port.
Add support to TCP and UDP for IPv6 and fix UDP IPv4 to not change
the address in the IP header.
Add support for IPv6 forwarding to a non-local destination.
Add a regession test uitilizing VIMAGE to check all 20 possible
combinations I could think of.

Obtained from:	David Dolson at Sandvine Incorporated
		(original version for ipfw fwd IPv6 support)
Sponsored by:	Sandvine Incorporated
PR:		bin/117214
MFC after:	4 weeks
Approved by:	re (kib)
2011-08-20 17:05:11 +00:00
Jonathan Anderson
b465884f42 Test process descriptors.
Ensure that process descriptors work as expected. We should be able to:
 - pdfork(), like regular fork(), but producing a process descriptor
 - pdgetpid() to convert a PD into a PID
 - pdkill() to send signals to a process identified by a PD

Approved by:  re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-18 23:15:04 +00:00
Jonathan Anderson
d6f7248983 poll(2) implementation for capabilities.
When calling poll(2) on a capability, unwrap first and then poll the
underlying object.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-16 14:14:56 +00:00
Jonathan Anderson
d1b6899e83 Rename CAP_*_KEVENT to CAP_*_EVENT.
Change the names of a couple of capability rights to be less
FreeBSD-specific.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-12 14:26:47 +00:00
Jonathan Anderson
a0108be612 Test *at(2) calls with capability-mode lookup.
This commit adds regression testing for openat(), fstatat(), etc. with
capability scoping ("strict relative" lookup), which applies:
 - in capability mode
 - when performing any *at() lookup relative to a capability

These tests will fail until the *at() code is committed; on my local
instance, with the *at() changes, they all pass.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-12 10:52:46 +00:00
Jonathan Anderson
dbb202b398 Use the right printf() format string without a cast to maxint_t.
As per kib's suggestion, we also change test_count from a size_t to an int;
its value at the moment is 4, and we only expect it to go up to 7.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-11 15:52:06 +00:00
Robert Watson
a9d2f8d84f Second-to-last commit implementing Capsicum capabilities in the FreeBSD
kernel for FreeBSD 9.0:

Add a new capability mask argument to fget(9) and friends, allowing system
call code to declare what capabilities are required when an integer file
descriptor is converted into an in-kernel struct file *.  With options
CAPABILITIES compiled into the kernel, this enforces capability
protection; without, this change is effectively a no-op.

Some cases require special handling, such as mmap(2), which must preserve
information about the maximum rights at the time of mapping in the memory
map so that they can later be enforced in mprotect(2) -- this is done by
narrowing the rights in the existing max_protection field used for similar
purposes with file permissions.

In namei(9), we assert that the code is not reached from within capability
mode, as we're not yet ready to enforce namespace capabilities there.
This will follow in a later commit.

Update two capability names: CAP_EVENT and CAP_KEVENT become
CAP_POST_KEVENT and CAP_POLL_KEVENT to more accurately indicate what they
represent.

Approved by:	re (bz)
Submitted by:	jonathan
Sponsored by:	Google Inc
2011-08-11 12:30:23 +00:00
Navdeep Parhar
223eb00dd0 Move cxgbtool from usr.sbin to tools/tools.
Approved by:	re (kib)
MFC after:	1 month
2011-08-10 22:03:34 +00:00
Robert Watson
e397f116c3 Properly initialise the "len" argument to getsockname(2) in the tcpdrop
regression test so that it works (more) consistently.

Approved by:	re (bz)
Sponsored by:	Juniper Networks
2011-08-06 19:20:17 +00:00
Jonathan Anderson
b7f2d66a79 Expect fchflags(2) to fail with EOPNOTSUPP on NFS.
Even if we have CAP_FCHFLAGS, fchflags(2) fails on NFS. This is normal
and expected, so don't fail the test because of it.

Note that, whether or not we are on NFS, fchflags(2) should always fail
with ENOTCAPABLE if we are using a capability that does not have the
CAP_FCHFLAGS right.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-05 17:43:11 +00:00
Jonathan Anderson
da7496721e Flesh out the cap_test regression test.
Add more regression testing, some of which is expected to fail until we
commit more kernel implementation.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-04 17:17:57 +00:00
Jonathan Anderson
f8c6c2cf5a Flesh out the cap_test regression test.
Add more regression testing, some of which is expected to fail until we
commit more kernel implementation.

Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc
2011-08-04 14:20:13 +00:00
Andriy Gapon
235cc4c620 update smp related documentation after recent changes
Remove references to machdep.hlt_logical_cpus and
machdep.hlt_cpus sysctls and tunables.
Document machdep.hyperthreading_allowed and
hint.lapic.X.disabled tunables.

Prompted by:	ru
Proofreading:	bf
Reviewed by:	jhb
Approved by:	re (kib)
2011-07-30 20:42:14 +00:00
Adrian Chadd
9381916024 Add athradar, an implementation of the radar parameter diagnostic
API.

This is a reimplementation from scratch.

Approved by:	re (kib)
2011-07-22 09:34:31 +00:00
Dimitry Andric
180abc3db9 Vendor import of clang trunk r135360:
http://llvm.org/svn/llvm-project/cfe/trunk@135360
2011-07-17 15:40:56 +00:00
Dimitry Andric
411bd29eea Vendor import of llvm trunk r135360:
http://llvm.org/svn/llvm-project/llvm/trunk@135360
2011-07-17 15:36:56 +00:00
Jilles Tjoelker
53b93f2f8a sh: Add a test for a fairly obscure case with aliases.
This also passes on stable/8.
2011-07-16 16:14:14 +00:00
Philip Paeps
daf097c040 Garbage-collect the tools for maintaining the previous PCI vendors list. The
sources this tool collates are no longer available and the format of the
current database is directly usable by pciconf(8) without needing any special
processing.
2011-07-16 15:43:14 +00:00
Jilles Tjoelker
9ea47cacda posix_spawn: If an error is detected in the child process, reap the zombie.
Formerly, in this case an error was returned but the pid was also returned
to the application, requiring the application to use unspecified behaviour
(the returned pid in error situations) to avoid zombies.

Now, reap the zombie and do not return the pid.

MFC after:	2 weeks
2011-07-10 14:20:11 +00:00
Jonathan Anderson
345f2b96e2 Clarify the meaning of a test.
Rather than using err() if either of two failure conditions
fires (which can produce spurious error messages), just use
errx() if the one condition that really matters fires.

In practice, this single test is enough to detect the failure
mode we're looking for (kqueue being inherited across fork).

Approved by: mentor (rwatson), re (Capsicum blanket)
Sponsored by: Google Inc
2011-07-08 12:16:30 +00:00
Jonathan Anderson
0136244a52 Ensure that kqueue is not inherited across fork().
Modify the existing unit test (from libkqueue) which already exercises process events via
fork() and kill(). Now, the child process simply checks that the 'kqfd' descriptor is invalid.

Some minor modifications were required to make err() work correctly. It seems that this test
was imported using the output of a configure script, but config.h was not included in key
places, nor was its syntax correct (need '#define HAVE_FOO 1' rather than '#define HAVE_FOO').

Finally, change main() to run the "proc" suite by default, but widened the '#if TODO' in
proc.c to include the non-functioning test event_trigger().

Approved by: mentor (rwatson), re (Capsicum blanket)
Sponsored by: Google Inc
2011-07-07 18:07:03 +00:00
Jilles Tjoelker
b5845df384 sh: Test that '!' is literal if quoted and first char of bracket expression
This also works on stable/8.
2011-06-25 20:37:43 +00:00
Hans Petter Selasky
c9a6ce0cd8 - Need to respect the module name and the USB mode when accumulating device ID's.
- Be more verbose on file seek failures. Allow a file size of zero.
- Improve the wrapper shell.

MFC after:	14 days
2011-06-25 15:22:44 +00:00
Hans Petter Selasky
4449ead376 - Improve bus_autoconf tool.
- Implement simple and generic language which can
be used to describe any kind of device ID structures.
- Fix endian issues.
- Add an example format file.

Suggested by:	imp @
MFC after:	14 days
2011-06-25 13:44:05 +00:00
Hans Petter Selasky
a433a3d8c9 - We need to sort all USB device ID's together. Else the matching order will
be wrong. This is required because devd only executes one entry.

MFC after:	14 days
2011-06-24 21:27:33 +00:00
Hans Petter Selasky
160d9dc32b - Make sure we don't match the wrong device by adding
a match for the bus the device belongs to.

PR:		misc/157903
MFC after:	14 days
2011-06-24 04:35:58 +00:00
Hans Petter Selasky
e71c21385e - Add additional information to the PnP info of USB HUBs children which
is now required by bus_autoconf.
- Allow interface class matching even if device class is vendor specific.
- Update bus_autoconf tool to not generate system and subsystem match lines
  for the nomatch event.

PR:		misc/157903
MFC after:	14 days
2011-06-24 04:16:06 +00:00
Hans Petter Selasky
f1a16106b6 - Move all USB device ID arrays into so-called sections,
sorted according to the mode which they support:
	host, device or dual mode
- Add generic tool to extract these data:
	tools/bus_autoconf

Discussed with:	imp
Suggested by:	Robert Millan <rmh@debian.org>
PR:		misc/157903
MFC after:	14 days
2011-06-24 02:30:02 +00:00
Jilles Tjoelker
57b1b54fdd sh: Add test for r223282. 2011-06-19 00:00:36 +00:00
Ed Schouten
9f0c9022c2 Add WITHOUT_UTMPX switch to the build system.
This knob removes the tools that are exclusively used to view and
maintain the databases maintained by utmpx, namely last, users, who,
wtmpcvt, ac, lastlogin and utxrm.

The tool w is not in this list, because it has some other functionality
which is unrelated to utmpx; it is hardlinked to the uptime tool.
2011-06-17 21:30:21 +00:00
Ed Schouten
2663175a9e Don't remove the periodic script for ac(8) when setting WITHOUT_ACCT. 2011-06-17 21:20:41 +00:00
Ed Schouten
f1c344b293 Don't omit ac(8) as part of WITHOUT_ACCT.
The WITHOUT_ACCT switch is supposed to omit tools related to process
accounting, namely accton and sa. ac(8) is just a simple tool that
prints statistics based on data in the utx.log database. It has nothing
to do with the former.
2011-06-17 20:47:44 +00:00
Jilles Tjoelker
c9afaa6389 sh: Add case statement fallthrough (with ';&' instead of ';;').
Replacing ;; with the new control operator ;& will cause the next list to be
executed as well without checking its pattern, continuing until a list ends
with ;; or until the end of the case statement. This is like omitting
"break" in a C "switch" statement.

The sequence ;& was formerly invalid.

This feature is proposed for the next POSIX issue in Austin Group issue
#449.
2011-06-17 13:03:49 +00:00
Jilles Tjoelker
f5f215e251 sh: Skip variables with invalid names in "set", "export -p", "readonly -p".
This ensures the output of these commands is valid shell input.
2011-06-17 10:21:24 +00:00
Jilles Tjoelker
c5aef5377c sh: Reduce unnecessary forks with eval.
The eval special builtin now runs the code with EV_EXIT if it was run
with EV_EXIT itself.

In particular, this eliminates one fork when a command substitution contains
an eval command that ends with an external program or a subshell.

This is similar to what r220978 did for functions.
2011-06-16 21:50:28 +00:00
Jilles Tjoelker
ff4dc67299 sh: Add support for named character classes in bracket expressions.
Example:
  case x in [[:alpha:]]) echo yes ;; esac
2011-06-15 21:48:10 +00:00
Dimitry Andric
29cafa66ad Vendor import of clang trunk r132879:
http://llvm.org/svn/llvm-project/cfe/trunk@132879
2011-06-12 15:46:16 +00:00
Dimitry Andric
56fe8f1409 Vendor import of llvm trunk r132879:
http://llvm.org/svn/llvm-project/llvm/trunk@132879
2011-06-12 15:42:51 +00:00
Jilles Tjoelker
7de40d014f sh: Add test for LC_COLLATE-based character ranges in case. 2011-06-12 12:55:46 +00:00
Jilles Tjoelker
477a50a6f6 sh: Add test for case pattern matching with iso-8859-1 charset.
This also passes on stable/8.
2011-06-12 12:27:17 +00:00
Navdeep Parhar
df262243ac Add "context" subcommand to fetch and display SGE context. 2011-06-11 04:55:15 +00:00
Jilles Tjoelker
1a62d8843d sh: Do parameter expansion on ENV before using it.
This is required by POSIX, and allows things like ENV=\$HOME/.shrc.

Note that tilde expansion is explicitly not performed.
2011-06-10 22:42:00 +00:00
Jilles Tjoelker
292e667663 sh: Do parameter expansion before printing PS4 (set -x).
The function name expandstr() and the general idea of doing this kind of
expansion by treating the text as a here document without end marker is from
dash.

All variants of parameter expansion and arithmetic expansion also work (the
latter is not required by POSIX but it does not take extra code and many
other shells also allow it).

Command substitution is prevented because I think it causes too much code to
be re-entered (for example creating an unbounded recursion of trace lines).

Unfortunately, our LINENO is somewhat crude, otherwise PS4='$LINENO+ ' would
be quite useful.
2011-06-09 23:12:23 +00:00
Navdeep Parhar
8a6a6922d9 cxgbetool: a tool for the cxgbe(4) driver. 2011-06-09 20:21:45 +00:00
Jilles Tjoelker
725cc7854e sh: Add simple tests for set -x and PS4. 2011-06-08 21:58:19 +00:00
Jilles Tjoelker
b3f892d9e0 sh: Fix $? in heredocs on simple commands.
PR:		bin/41410
2011-06-05 14:13:15 +00:00
Jilles Tjoelker
b17788c1a9 sh: Add already working testcases for $? in here-document.
If the here-document is attached to a compound command or subshell, $?
already works properly. This is both a workaround for bin/41410 and a
requirement for a true fix for bin/41410.

PR:		bin/41410
MFC after:	1 week
2011-06-05 12:46:26 +00:00
Robert Watson
7fcc404b47 Add a very simple IPDIVERT test, which creates IP divert sockets and
checks for collision/non-collision properties in binding them.  This
test would have identified a bug recently reported on current@
involding my disaggregation of the pcbinfo lock.

It would be nice if this test also exercised packet diversion and
injection, but that is for another day.

MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-06-04 16:25:12 +00:00
Jilles Tjoelker
47a5ab295a sh: Reduce more needless differences between error messages. 2011-06-04 15:05:52 +00:00
Jilles Tjoelker
9338c85c31 sh: Honour -n while processing -c string. 2011-06-04 11:28:42 +00:00
Jilles Tjoelker
3eee62c606 sh: Add tests for -n flag. These already pass. 2011-06-03 21:17:42 +00:00
Warner Losh
1d6fbefd90 Don't need (and can't use) -L to copy links here. 2011-05-31 17:14:06 +00:00
Jilles Tjoelker
36ae1a9441 sh: Add tests for some somewhat obscure aspects of function definitions. 2011-05-30 21:49:59 +00:00
Bjoern A. Zeeb
3e622db1cb Upgrade jail(2) to latest jail(2) API to make the regression test work
again.  Eventually should switch to jail_set(2).

Reported by:	rwatson
MFC after:	10 days
2011-05-30 09:41:38 +00:00
Robert Watson
0d9535331d Rework TIMEWAIT regression test so that kernel-allocated port numbers are
used rather than a fixed userspace one, avoiding conflicts between the two
test runs.

MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-05-30 09:34:15 +00:00
Robert Watson
57431792c8 Add missing include of stdio.h.
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-05-30 09:06:24 +00:00
Robert Watson
e8c546028b In the tcpdrop regression test, allow the kernel to allocate us a port
rather than using a fixed port number.  This means that the regression test
can be run many times in a row without waiting on TIMEWAIT to release a
hard-coded port number.

MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-05-30 09:04:35 +00:00
Robert Watson
27d36ca1a8 Add missing #include of err.h.
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
2011-05-30 08:54:32 +00:00
Jilles Tjoelker
562c9f003e sh: Add test for 'set +o'. 2011-05-29 15:02:10 +00:00
Jilles Tjoelker
98102dabd3 printf: Allow multibyte characters for '<char> form, avoid negative codes.
Examples:
  LC_ALL=en_US.UTF-8 printf '%d\n' $(printf \'\\303\\244)
  LC_ALL=en_US.ISO8859-1 printf '%d\n' $(printf \'\\344)
Both of these should print 228.

Like some other shells, incomplete or invalid multibyte characters yield the
value of the first byte without a warning.

Note that there is no general way to go back from the character code to the
character.
2011-05-28 11:37:47 +00:00
Jilles Tjoelker
64fa41f3e1 sh: Correct criterion for using CDPATH in cd.
CDPATH should be ignored not only for pathnames starting with '/' but also
for pathnames whose first component is '.' or '..'.

The man page already describes this behaviour.
2011-05-27 20:01:46 +00:00
Jilles Tjoelker
4daae0cde6 sh: Add simple CDPATH test. 2011-05-27 19:36:07 +00:00
Jilles Tjoelker
715a0dd556 sh: Fix unquoted $@/$* if IFS=''.
If IFS is null, unquoted $@/$* should still expand to separate words.
This differs from quoted $@ (which does not depend on IFS) in that pathname
generation is performed and empty words are removed.
2011-05-27 15:56:13 +00:00
Adrian Chadd
775b7a6663 Include an EEPROM dump program for the AR9287 EEPROM format. 2011-05-26 19:49:32 +00:00
David E. O'Brien
3c24f8e827 + Tighten up (and simplify) the pass_cmd_vars_1 "variable definition arrived
from the calling make" test.
+ Be more tolerant of newlines in the plus_flag "supports the '+' flag" test.
2011-05-25 23:33:49 +00:00
Ruslan Ermilov
a6d11f7139 [mdoc] Fixed .Dt call. 2011-05-25 14:13:53 +00:00
David E. O'Brien
a23d1c70b3 Build and install a BSD licensed grep.
If WITH_BSD_GREP is not set, it will be 'bsdgrep' and GNUgrep will be
'[ef]grep'.  Otherwise, BSD-grep will be the grep family, and GNUgrep
will be 'gnugrep'.

Discussed with: brooks
2011-05-25 01:04:12 +00:00
Warner Losh
3a58f40e09 Add the description properly... 2011-05-22 18:23:17 +00:00
Warner Losh
becb5566df Add documentation for WITHOUT_KERNEL_SYMBOLS 2011-05-22 18:12:59 +00:00
Jilles Tjoelker
4d79e0296a sh: Add test for r222173. 2011-05-22 12:15:14 +00:00
Ulrich Spörlein
c5917de726 Update URLs and fix regex to work with current version of the files. 2011-05-22 09:48:25 +00:00
Jilles Tjoelker
05a447d0b9 sh: Expand aliases after assignments and redirections. 2011-05-21 22:03:06 +00:00
Jilles Tjoelker
47fb896960 sh: Add test for positional parameters with more than one digit.
This also passes on stable/8.
2011-05-21 14:52:26 +00:00
Jilles Tjoelker
d6ee26ad02 sh: Implement the cd -e flag proposed for the next POSIX issue.
This reflects failure to determine the pathname of the new directory in the
exit status (1). Normally, cd returns successfully if it did chdir() and the
call was successful.

In POSIX, -e only has meaning with -P; because our -L is not entirely
compliant and may fall back to -P mode, -e has some effect with -L as well.
2011-05-20 22:55:18 +00:00
Jilles Tjoelker
85307c9ed9 sh: Allow terminating a heredoc with a terminator at EOF without a newline.
This is sometimes used with eval or old-style command substitution, and most
shells other than ash derivatives allow it.

It can also be used with scripts that violate POSIX's requirement on the
application that they end in a newline (scripts must be text files except
that line length is unlimited).

Example:
v=`cat <<EOF
foo
EOF`
echo $v

This commit does not add support for the similar construct with new-style
command substitution, like
v=$(cat <<EOF
foo
EOF)
This continues to require a newline after the terminator.
2011-05-20 16:03:36 +00:00
Warner Losh
0163af2360 Implement WITH{,OUT}_{GCC,BINUTILS} to provide finer-grained control
over building gcc and binutils.  They default to true, unless
MK_TOOLCHAIN is no.

Reviewed by:	ru@
2011-05-19 05:13:25 +00:00
Ruslan Ermilov
1562ef0218 Added description for WITH_OFED. 2011-05-17 11:06:41 +00:00
Jilles Tjoelker
d69e16c977 sh: Add tests for lines that look like heredoc delimiters but are not. 2011-05-14 14:19:30 +00:00
Warner Losh
9df02b5476 Restore BOOT2CFG, accidentally removed in r212938.
PR:		157020
2011-05-14 04:32:30 +00:00
Warner Losh
9a6e729a11 If there's no package directory, don't try to install packages from
it.  Instead, report that 0 packages are reported.

PR:		misc/140436
2011-05-13 19:40:02 +00:00
Warner Losh
14f9771b27 Add ${} around variable dereference...
Submitted by:	garrett coopper
2011-05-13 18:46:20 +00:00
Warner Losh
94a74d9427 Implement -f to inhibit copying s1 partition out for speed.
(-z not taken from PR, it is no longer needed since we basically always
 do that now)

PR:		misc/151698
Submitted by:	lev@
2011-05-13 18:36:24 +00:00
Warner Losh
b0effdce7c Copy symbolic links as files rather than recreating the links.
PR:		misc/151697
Submitted by:	lev@
MFC after:	2 weeks
2011-05-13 18:28:25 +00:00
Ruslan Ermilov
e6a714e703 Reassurance for impatient. 2011-05-10 13:01:11 +00:00
Ruslan Ermilov
cae68bef11 Style. 2011-05-10 12:57:39 +00:00
Ruslan Ermilov
2701a1b7a1 - There now exist options that have different defaults depending on
the architecture, reflect this in documentation.  For such
  options, both WITH_FOO and WITHOUT_FOO description files should
  be provided.

  Prodded by:	des

- Setting a build option may enforce other build options, try harder
  to detect this case.

- Setting a build option may change other option's default value,
  try harder to detect this case.
2011-05-10 11:14:40 +00:00
Ruslan Ermilov
37730efb9a The Objective C support was removed in r220755.
Submitted by:	des
2011-05-10 11:06:14 +00:00
Adrian Chadd
9a086c6988 This is a full 32 bit field for kite. 2011-05-09 10:39:15 +00:00
Jilles Tjoelker
07eb7033a6 sh: Add \u/\U support (in $'...') for UTF-8.
Because we have no iconv in base, support for other charsets is not
possible.

Note that \u/\U are processed using the locale that was active when the
shell started. This is necessary to avoid behaviour that depends on the
parse/execute split (for example when placing braces around an entire
script). Therefore, UTF-8 encoding is implemented manually.
2011-05-08 17:40:10 +00:00
Jilles Tjoelker
7cc6b3df80 sh: Add UTF-8 support to pattern matching.
?, [...] patterns match codepoints instead of bytes. They do not match
invalid sequences. [...] patterns must not contain invalid sequences
otherwise they will not match anything. This is so that ${var#?} removes the
first codepoint, not the first byte, without putting UTF-8 knowledge into
the ${var#pattern} code. However, * continues to match any string and an
invalid sequence matches an identical invalid sequence. (This differs from
fnmatch(3).)
2011-05-08 11:32:20 +00:00
Jilles Tjoelker
4c244ed255 sh: Add UTF-8 support to ${#var}.
If the current locale uses UTF-8, ${#var} counts codepoints (more precisely,
bytes b with (b & 0xc0) != 0x80).
2011-05-07 14:32:16 +00:00
Ruslan Ermilov
751f92ecc8 MK_GPIO changed its default; reflect. 2011-05-06 19:14:06 +00:00
Ruslan Ermilov
a7a066b13f Removed trailing whitespace. 2011-05-06 19:13:03 +00:00
Ruslan Ermilov
64a9cf7693 Tidy up formatting. 2011-05-06 19:10:27 +00:00
Jilles Tjoelker
a62ab0274a sh: Add $'quoting' (C-style escape sequences).
A string between $' and ' may contain backslash escape sequences similar to
the ones in a C string constant (except that a single-quote must be escaped
and a double-quote need not be). Details are in the sh(1) man page.

This construct is useful to include unprintable characters, tabs and
newlines in strings; while this can be done with a command substitution
containing a printf command, that needs ugly workarounds if the result is to
end with a newline as command substitution removes all trailing newlines.

The construct may also be useful in future to describe unprintable
characters without needing to write those characters themselves in 'set -x',
'export -p' and the like.

The implementation attempts to comply to the proposal for the next issue of
the POSIX specification. Because this construct is not in POSIX.1-2008,
using it in scripts intended to be portable is unwise.

Matching the minimal locale support in the rest of sh, the \u and \U
sequences are currently not useful.

Exp-run done by: pav (with some other sh(1) changes)
2011-05-05 20:55:55 +00:00
Jilles Tjoelker
3937fc9c26 sh: Apply set -u to variables in arithmetic.
Note that this only applies to variables that are actually used.
Things like (0 && unsetvar) do not cause an error.

Exp-run done by: pav (with some other sh(1) changes)
2011-05-04 22:12:22 +00:00
Jilles Tjoelker
fc0818fef3 sh: Detect an error for ${#var<GARBAGE>}.
In particular, this makes things like ${#foo[0]} and ${#foo[@]} errors
rather than silent equivalents of ${#foo}.

PR:		bin/151720
Submitted by:	Mark Johnston
Exp-run done by: pav (with some other sh(1) changes)
2011-05-04 21:49:34 +00:00
Jonathan Anderson
ceb42a13a1 Regression tests for Capsicum capability mode.
Ensure that system calls that access global namespaces, e.g. open(2), are not permitted, and that whitelisted sysctls like kern.osreldate are.

Approved by: rwatson
Sponsored by: Google, Inc.
2011-05-04 12:44:46 +00:00
George V. Neville-Neil
c3b14674a7 Give some sort of message when the program is not run as root.
Root privileges are required to talk to the device.

Submitted by:	Sriram Rapuru at Wipro for Exar Inc.
MFC after:	2 weeks
2011-05-03 16:00:36 +00:00
Dimitry Andric
01af97d3b2 Vendor import of clang trunk r130700:
http://llvm.org/svn/llvm-project/cfe/trunk@130700
2011-05-02 19:39:53 +00:00
Dimitry Andric
6b943ff3a3 Vendor import of llvm trunk r130700:
http://llvm.org/svn/llvm-project/llvm/trunk@130700
2011-05-02 19:34:44 +00:00
Bjoern A. Zeeb
970a765389 Introduce two new options MK_INET and MK_INET_SUPPORT analogically
with INET6 equivalents. Patch reather than re-genenerating src.conf
(given the current problem with the script that does the re-gen).

Reviewed by:	gnn
Sponsored by:	The FreeBSD Foundation
Sponsored by:	iXsystems
MFC after:	2 weeks
2011-04-30 17:58:28 +00:00
George V. Neville-Neil
3c31540d7c A diagnostic tool to go along with the vxge(4) 10GbE driver.
This tool can be used to print statistics, registers, and
other device specific information once the driver is loaded
into the kernel.

Submitted by:	Sriram Rapuru from Exar
MFC after:	2 weeks
2011-04-28 16:29:19 +00:00
Dag-Erling Smørgrav
158e440d2b executable 2011-04-28 11:21:49 +00:00
Jilles Tjoelker
03b3a844d0 sh: Set $? to 0 for background commands.
For backgrounded pipelines and subshells, the previous value of $? was being
preserved, which is incorrect.

For backgrounded simple commands containing a command substitution, the
status of the last command substitution was returned instead of 0.

If fork() fails, this is an error.
2011-04-25 20:54:12 +00:00
Jilles Tjoelker
45496405c6 sh: Allow EV_EXIT through function calls, make {...} <redir more consistent.
If EV_EXIT causes an exit, use the exception mechanism to unwind
redirections and local variables. This way, if the final command is a
redirected command, an EXIT trap now executes without the redirections.

Because of these changes, EV_EXIT can now be inherited by the body of a
function, so do so. This means that a function no longer prevents a fork
before an exec being skipped, such as in
  f() { head -1 /etc/passwd; }; echo $(f)

Wrapping a single builtin in a function may still cause an otherwise
unnecessary fork with command substitution, however.

An exit command or -e failure still invokes the EXIT trap with the
original redirections and local variables in place.

Note: this depends on SHELLPROC being gone. A SHELLPROC depended on
keeping the redirections and local variables and only cleaning up the
state to restore them.
2011-04-23 22:28:56 +00:00
Simon L. B. Nielsen
d95c6beaac Expand / correct newsyslog regression tests:
- Test newslog with clasic naming of rotates files to actually test
  the correct number of log files as newsyslog now does the correct
  thing post r220926.
- Add some more newsyslog tests which tests keeping 0, 1, and 2
  logfiles.
2011-04-21 16:40:34 +00:00
Jilles Tjoelker
caa7ccdc54 sh: Do not word split "${#parameter}".
This is only a problem if IFS contains digits, which is unusual but valid.

Because of an incorrect fix for PR bin/12137, "${#parameter}" was treated
as ${#parameter}. The underlying problem was that "${#parameter}"
erroneously added CTLESC bytes before determining the length. This
was properly fixed for PR bin/56147 but the incorrect fix was not backed
out.

Reported by:	Seeker on forums.freebsd.org
MFC after:	2 weeks
2011-04-20 22:24:54 +00:00
Jilles Tjoelker
1e5dccaa9b sh: Add test for bin/12137. 2011-04-15 15:33:24 +00:00
Jilles Tjoelker
9638724dc8 sh: Add test for obscure and ambiguous ${#?}. 2011-04-15 15:26:05 +00:00
Jilles Tjoelker
149cf1e03b sh: Add test for bin/56147. 2011-04-15 15:14:58 +00:00
Adrian Chadd
6b3664c018 Generate opt_ah.h now for all ath tools, a recent HAL change of mine
now requires it.
2011-04-11 06:53:45 +00:00
Ulrich Spörlein
cebea500a0 Regenerate after r220401. It turns out makeman is clever about implied
flags, so remove that part from WITHOUT_CXX again.

This is only partially regenerated, as the entries for FDT and GPIO seem to
have switched their default state, too.
2011-04-06 20:19:07 +00:00
Ulrich Spörlein
b3eb927f6e Complete WITHOUT_CXX support. It implies WITHOUT_GROFF and
WITHOUT_CLANG.

Don't build clang bootstrap/build-tools depending on this flag. We also
keep gperf, devd and libstdc++ around to prevent foot-shooting and to
make this a two-way street.
2011-04-06 20:08:23 +00:00
Jilles Tjoelker
2973057493 Allow strerror(0) and strerror_r(0, ...).
Of course, strerror_r() may still fail with ERANGE.

Although the POSIX specification said this could fail with EINVAL and
doing this likely indicates invalid use of errno, most other
implementations permitted it, various POSIX testsuites require it to
work (matching the older sys_errlist array) and apparently some
applications depend on it.

PR:		standards/151316
MFC after:	1 week
2011-04-05 21:56:05 +00:00