Commit Graph

12118 Commits

Author SHA1 Message Date
David Schultz
e18701f4ac Consolidate some variable initializations. No substantive change. 2008-12-11 02:39:27 +00:00
David Schultz
33bff5d3e4 Move the xprintf hook to where it belongs; it shouldn't be in the
middle of vfprintf's variable declarations.
2008-12-10 02:32:06 +00:00
Maxim Konovalov
9435575dbe o Use full month name in .Dd macro. 2008-12-09 09:24:25 +00:00
Konstantin Belousov
20e76cb365 Add strndup(3) prototype to string.h.
This change was erronously ommitted from the r185690, and attempt
to simply add the prototype to string.h has revealed that several
contributed programs defined local prototypes for strndup(), controlled
by autoconfed config.h. So, manually change #undef HAVE_STRNDUP to
#define HAVE_STRNDUP 1. Next import of the corresponding program would
regenerate config.h, overriding the changes in this commit.

No objections from: kan
2008-12-08 21:04:24 +00:00
Tim Kientzle
18f815b95c Obey the TMPDIR, TMP, TEMP, or TEMPDIR environment variables
when choosing a scratch directory for the tests.  Fallback
to "/tmp", of course.
2008-12-08 17:22:44 +00:00
Joseph Koshy
3c83ff13e9 Document processor errata that affect performance measurement. 2008-12-08 12:28:48 +00:00
Peter Wemm
ce4a8bcbee Add filler man pages for the kinfo functions I added recently.
While here, hook up the hexdump(3) man page which wasn't being installed.
2008-12-07 03:33:36 +00:00
Peter Wemm
70ba1e8fc1 When libthr and rtld start up, there are a number of magic spells cast
in order to get the symbol binding state "just so".  This is to allow
locking to be activated and not run into recursion problems later.

However, one of the magic bits involves an explicit call to _umtx_op()
to force symbol resolution.  It does a wakeup operation on a fake,
uninitialized (ie: random contents) umtx.  Since libthr isn't active, this
is harmless.  Nothing can match the random wakeup.

However, valgrind finds this and is not amused.  Normally I'd just
write a suppression record for it, but the idea of passing random
args to syscalls (on purpose) just doesn't feel right.
2008-12-07 02:32:49 +00:00
Konstantin Belousov
f0eca40a14 Import the strndup(3) function.
Copyright attribution is kept the same as in original NetBSD source.

Submitted by:	Florian Smeets <flo kasimir com>
Obtained from:	NetBSD
MFC after:	2 weeks
2008-12-06 09:37:54 +00:00
Konstantin Belousov
6197062881 Order the str*.c files mostly alphabetical.
Submitted by:	Florian Smeets <flo kasimir com>
MFC after:	2 weeks
2008-12-06 09:28:46 +00:00
Tim Kientzle
dff5b8bc1f New tests:
* support for bzip2 file with multiple concatenated bzip2 streams
 * support for bzip2 file with junk after bzip2 stream
 * support for gzip file with junk after gzip stream
 * "fuzz" tester randomly modifies a bunch of input files in order to try
   to crash libarchive (this found an amusing hang in the ISO9660 code
   when trying to read images that advertised a zero blocksize).

This test is implemented, but commented out for now:
 * support for gzip file with multiple concatenated gzip streams
2008-12-06 07:08:08 +00:00
Tim Kientzle
dc8cb157dd Strip ";1" and trailing "." from ISO9660 entries.
This seems a better match for people's expectations.
2008-12-06 06:57:45 +00:00
Tim Kientzle
08da6f539c General improvements to Rockridge parsing and ISO9660 format detection. 2008-12-06 06:55:07 +00:00
Tim Kientzle
ebcb29a003 Conditionalize a bunch of debugging messages; this also
eliminates what should be the only remaining stdio dependency.
2008-12-06 06:50:09 +00:00
Tim Kientzle
b1ff9c25b8 MfP4: Big read filter refactoring.
This is an attempt to eliminate a lot of redundant
code from the read ("decompression") filters by
changing them to juggle arbitrary-sized blocks
and consolidate reblocking code at a single point
in archive_read.c.

Along the way, I've changed the internal read/consume
API used by the format handlers to a slightly
different style originally suggested by des@.  It
does seem to simplify a lot of common cases.

The most dramatic change is, of course, to
archive_read_support_compression_none(), which
has just evaporated into a no-op as the blocking
code this used to hold has all been moved up
a level.

There's at least one more big round of refactoring
yet to come before the individual filters are as
straightforward as I think they should be...
2008-12-06 06:45:15 +00:00
Tim Kientzle
72a4c788ff Style: tabs after #define 2008-12-06 06:23:37 +00:00
Tim Kientzle
da28fde4f9 Use GCC-specific dead function markers only when using GCC. 2008-12-06 06:20:21 +00:00
Tim Kientzle
9d822fe4b1 Structure declarations can't be dllexported. 2008-12-06 06:18:46 +00:00
Tim Kientzle
485698c170 Style fixes:
* Wrap long declarations to fit 80 chars
 * #undef macros that shouldn't be exported
 * Organize the version-dependent conditionals a
   bit more consistently

Speculative:
 * libarchive 3.0 will (eventually) use int64_t
   instead of off_t.  This is an attempt to avoid
   some the headaches caused by Linux LFS.  (I'll
   still have to do ugly things for the struct stat
   references in archive_entry.h, of course.)
2008-12-06 06:17:18 +00:00
Tim Kientzle
0373bf6531 A couple of portability fixes from Joerg Sonnenberger 2008-12-06 06:12:24 +00:00
Tim Kientzle
605fc11462 Recover after test failure. 2008-12-06 06:02:26 +00:00
Tim Kientzle
796b668980 Style: skipping() function correctly counts this as a skipped test. 2008-12-06 06:01:50 +00:00
Tim Kientzle
f1bcf83200 Style improvements. 2008-12-06 06:00:52 +00:00
Tim Kientzle
39bb5e0dd0 Better reporting of test failures. 2008-12-06 05:59:46 +00:00
Tim Kientzle
23fb0d7a7c Recover from a test failure here. 2008-12-06 05:58:24 +00:00
Tim Kientzle
0a68927a88 New internal archive_string_concat utility function. 2008-12-06 05:56:43 +00:00
Tim Kientzle
fe7350cb22 Minor portability: Declare 'r' only within the conditional
block where it's used; S_ISLNK is more portable than S_ISLINK.
2008-12-06 05:55:46 +00:00
Tim Kientzle
b55ef4a75a Windows build now uses PLATFORM_CONFIG_H macro, so we can eliminate the
special case for it.
2008-12-06 05:53:05 +00:00
Tim Kientzle
a8d0992f23 2 is more portable than STDERR_FILENO 2008-12-06 05:52:01 +00:00
Luigi Rizzo
7e8cc2bd03 Some libstand/bootp.c extension (written by Danny Braniss, slightly
revised/modified by me) to store dhcp options into kenv variables,
so the information is available to the boot loader and can be used
to customize the boot process.

The change is totally unintrusive, essentially made of a single
function to be called while parsing a dhcp response, and a couple
of tables to classify options.  The values extracted from dhcp
options are stored in the kenv environment in one of these forms:

 + options whose name and type is known are saved as
        dhcp.name = value     (string, or number/ip addresses lists)

 + unknown options are assumed to be strings and saved as
        dhcp.option-NNN = "value"

 + options listed as '__INDIR' and sent on the wire as e.g.
        option unknown-252 "some.name=the actual value"
   are saved as
        some.name = "the actual value"

 + options listed as '__ILIST' and sent on the wire as e.g.
        option unknown-249 "a.b=foo bar; c.d= 123; e.f=done"
   are saved as multiple values
        a.b="foo bar"
        c.d="123"
        e.f="done"

As you can see there is quite a bit of flexibility on what can
be passed to the loader or the kernel.

For the time being the vendor-specific table is mostly disabled,
because there is no standard set of options for FreeBSD, and I don't
know all the pxe-specific vendor options.

Also, applications using libstand may live in memory-constrained
environments, so it makes sense to keep these tables as small as
possible, especially considering that one can generate arbitrary
name=value pairs using site-specific options of type __INDIR or
__ILIST (there are 4 __ILIST and 5 __INDIR in the table, numbered
246..249 and 250..254).

Actually, considering that probably 75% of the standard dhcp options
are totally useless, it might make sense to remove them as well.

Submitted by:	Danny Braniss
MFC after:	4 weeks
2008-12-05 17:13:40 +00:00
Pawel Jakub Dawidek
3027fbe00b Add an easier example.
Reviewed by:	trasz
2008-12-05 15:50:59 +00:00
Joseph Koshy
b4d091f3a4 Fixes for Core2 Extreme support.
Submitted by:	 "Artem Belevich" <artemb at gmail dot com>
2008-12-03 17:30:36 +00:00
Poul-Henning Kamp
8372089626 Make the "test" target test the compiled version, instead of the
installed version of the md library.
2008-12-02 19:49:41 +00:00
Konstantin Belousov
10b4034657 Provide custom simple allocator for rtld locks in libthr. The allocator
does not use any external symbols, thus avoiding possible recursion into
rtld to resolve symbols, when called.

Reviewed by:	kan, davidxu
Tested by:	rink
MFC after:	1 month
2008-12-02 11:58:31 +00:00
Peter Wemm
de94a63bd1 Attempt a quick bandaid for arm build breakage. I went to the trouble of
maintaining alignment, but I'm not sure how to tell gcc this.
2008-12-02 10:10:50 +00:00
Peter Wemm
43151ee6cf Merge user/peter/kinfo branch as of r185547 into head.
This changes struct kinfo_filedesc and kinfo_vmentry such that they are
same on both 32 and 64 bit platforms like i386/amd64 and won't require
sysctl wrapping.

Two new OIDs are assigned.  The old ones are available under
COMPAT_FREEBSD7 - but it isn't that simple.  The superceded interface
was never actually released on 7.x.

The other main change is to pack the data passed to userland via the
sysctl.  kf_structsize and kve_structsize are reduced for the copyout.
If you have a process with 100,000+ sockets open, the unpacked records
require a 132MB+ copyout.  With packing, it is "only" ~35MB.  (Still
seriously unpleasant, but not quite as devastating).  A similar problem
exists for the vmentry structure - have lots and lots of shared libraries
and small mmaps and its copyout gets expensive too.

My immediate problem is valgrind.  It traditionally achieves this
functionality by parsing procfs output, in a packed format.  Secondly, when
tracing 32 bit binaries on amd64 under valgrind, it uses a cross compiled
32 bit binary which ran directly into the differing data structures in 32
vs 64 bit mode.  (valgrind uses this to track file descriptor operations
and this therefore affected every single 32 bit binary)

I've added two utility functions to libutil to unpack the structures into
a fixed record length and to make it a little more convenient to use.
2008-12-02 06:50:26 +00:00
Alexander Kabaev
97df383415 Invoke _rtld_atfork_post earlier, before we reinitialize rtld locks
by switching into single-thread mode.

libthr ignores broken use of lock bitmaps used by default rtld locking
implementation, this in turn turns lock handoff in _rtld_thread_init
into NOP. This in turn makes child processes of forked multi-threaded
programs to run with _thr_signal_block still in effect, with most
signals blocked.

Reported by: phk, kib
2008-12-01 21:00:25 +00:00
Giorgos Keramidas
a294460257 The times(3) function returns the number of CLK_TCKs since the
startup time of FreeBSD, not since the UNIX Epoch.

PR:		docs/122359
Submitted by:	Viktor &#352;tujber
MFC after:	1 week
2008-12-01 15:27:00 +00:00
Ruslan Ermilov
e95f37bb69 Fix fread() to return a correct value on platforms where sizeof(int) !=
sizeof(size_t), i.e. on all 64-bit platforms.

Reported by:	Andrey V. Elsukov
MFC after:	3 days
2008-12-01 14:33:34 +00:00
Jason Evans
d7ba3e423a Fix a lock order reversal bug that could cause deadlock during fork(2).
Reported by:	kib
2008-12-01 10:20:59 +00:00
Ivan Voras
1a2bea865b It's silly to claim recv(2) is to be removed in favour of recvfrom(2)
(at least at this time :) ).

Approved by:	gnn (mentor)
2008-11-30 21:40:01 +00:00
Jason Evans
17daa728ae Adjust an assertion to handle the case where a lock is contested, but
spinning is avoided due to running on a single-CPU system.

Reported by:	stefanf
2008-11-30 19:30:31 +00:00
Jason Evans
93e34865fa Do not spin when trying to lock on a single-CPU system.
Reported by:	davidxu
2008-11-30 05:55:24 +00:00
Konstantin Belousov
e711c6f0d1 Unlock the malloc() locks in the child process after fork(). This gives
us working malloc in the fork child of the multithreaded process.

Although POSIX requires that only async-signal safe functions shall be
operable after fork in multithreaded process, not having malloc lower
the quality of our implementation.

Tested by:	rink
Discussed with:	kan, davidxu
Reviewed by:	kan
MFC after:	1 month
2008-11-29 21:46:28 +00:00
Bjoern A. Zeeb
413628a7e3 MFp4:
Bring in updated jail support from bz_jail branch.

This enhances the current jail implementation to permit multiple
addresses per jail. In addtion to IPv4, IPv6 is supported as well.
Due to updated checks it is even possible to have jails without
an IP address at all, which basically gives one a chroot with
restricted process view, no networking,..

SCTP support was updated and supports IPv6 in jails as well.

Cpuset support permits jails to be bound to specific processor
sets after creation.

Jails can have an unrestricted (no duplicate protection, etc.) name
in addition to the hostname. The jail name cannot be changed from
within a jail and is considered to be used for management purposes
or as audit-token in the future.

DDB 'show jails' command was added to aid debugging.

Proper compat support permits 32bit jail binaries to be used on 64bit
systems to manage jails. Also backward compatibility was preserved where
possible: for jail v1 syscalls, as well as with user space management
utilities.

Both jail as well as prison version were updated for the new features.
A gap was intentionally left as the intermediate versions had been
used by various patches floating around the last years.

Bump __FreeBSD_version for the afore mentioned and in kernel changes.

Special thanks to:
- Pawel Jakub Dawidek (pjd) for his multi-IPv4 patches
  and Olivier Houchard (cognet) for initial single-IPv6 patches.
- Jeff Roberson (jeff) and Randall Stewart (rrs) for their
  help, ideas and review on cpuset and SCTP support.
- Robert Watson (rwatson) for lots and lots of help, discussions,
  suggestions and review of most of the patch at various stages.
- John Baldwin (jhb) for his help.
- Simon L. Nielsen (simon) as early adopter testing changes
  on cluster machines as well as all the testers and people
  who provided feedback the last months on freebsd-jail and
  other channels.
- My employer, CK Software GmbH, for the support so I could work on this.

Reviewed by:	(see above)
MFC after:	3 months (this is just so that I get the mail)
X-MFC Before:   7.2-RELEASE if possible
2008-11-29 14:32:14 +00:00
Konstantin Belousov
cb5c4b10ba Add two rtld exported symbols, _rtld_atfork_pre and _rtld_atfork_post.
Threading library calls _pre before the fork, allowing the rtld to
lock itself to ensure that other threads of the process are out of
dynamic linker. _post releases the locks.

This allows the rtld to have consistent state in the child. Although
child may legitimately call only async-safe functions, the call may
need plt relocation resolution, and this requires working rtld.

Reported and debugging help by:	rink
Reviewed by:	kan, davidxu
MFC after:	1 month (anyway, not before 7.1 is out)
2008-11-27 11:27:59 +00:00
Joseph Koshy
d95afe050e Update description of an event.
Submitted by:	"Verplanke, Edwin" <edwin dot verplanke at intel dot com>
2008-11-27 09:21:37 +00:00
Joseph Koshy
0cfab8ddc1 - Add support for PMCs in Intel CPUs of Family 6, model 0xE (Core Solo
and Core Duo), models 0xF (Core2), model 0x17 (Core2Extreme) and
  model 0x1C (Atom).

  In these CPUs, the actual numbers, kinds and widths of PMCs present
  need to queried at run time.  Support for specific "architectural"
  events also needs to be queried at run time.

  Model 0xE CPUs support programmable PMCs, subsequent CPUs
  additionally support "fixed-function" counters.

- Use event names that are close to vendor documentation, taking in
  account that:
  - events with identical semantics on two or more CPUs in this family
    can have differing names in vendor documentation,
  - identical vendor event names may map to differing events across
    CPUs,
  - each type of CPU supports a different subset of measurable
    events.

  Fixed-function and programmable counters both use the same vendor
  names for events.  The use of a class name prefix ("iaf-" or
  "iap-" respectively) permits these to be distinguished.

- In libpmc, refactor pmc_name_of_event() into a public interface
  and an internal helper function, for use by log handling code.

- Minor code tweaks: staticize a global, freshen a few comments.

Tested by:	gnn
2008-11-27 09:00:47 +00:00
Joseph Koshy
d5ec7b69ec Fix buglets. 2008-11-26 03:48:20 +00:00
Alfred Perlstein
6fda742dfe src/lib/libusb20/libusb20_compat01.c
Fix some issues about re-scanning of the devices.

src/lib/libusb20/libusb20_ugen20.c

Fix issue about libusb20 having to release the
USB transfers before doing a SET_CONFIG, else
the kernel will kill the file handle.

src/sys/dev/usb2/core/usb2_device.
src/sys/dev/usb2/core/usb2_generic.c
src/sys/dev/usb2/core/usb2_generic.h

Add support for U3G devices.
Improve and cleanup FIFO free handling.
Improve device re-enumeration.

src/sys/dev/usb2/core/usb2_msctest.c
src/sys/dev/usb2/core/usb2_msctest.h

Fix some problems in the USB Mass Storage Test.
Add Huawei vendor specific quirks.

src/sys/dev/usb2/core/usb2_request.c

Improve device re-enumeration.

src/sys/dev/usb2/ethernet/if_aue2.c
src/sys/dev/usb2/include/usb2_devid.h
src/sys/dev/usb2/include/usb2_devtable.h
src/sys/dev/usb2/quirk/usb2_quirk.c

Integrate changes from the old USB driver.

src/sys/dev/usb2/include/usb2_standard.h

Add definition of USB3.0 structures from USB.org.

src/sys/dev/usb2/serial/u3g2.c
src/sys/dev/usb2/serial/ugensa2.c
src/sys/modules/usb2/Makefile
src/sys/modules/usb2/serial_3g/Makefile

Import U3G driver.

Submitted by:	Hans Petter Selasky (usb4bsd)
2008-11-25 08:04:40 +00:00