Commit Graph

12998 Commits

Author SHA1 Message Date
Ed Schouten
a7607816bf Just ignore the timestamps given to pututxline().
I've noticed many applications do a bad job at timekeeping, for several
reasons:

- Applications like screen(1) don't update time records when restoring
  the old user login record.
- Many applications only set ut_tv.tv_sec, not ut_tv.tv_usec.

This causes many problems for tools such as ac(8), which require the
timestamps to be properly ordered. This is why I've decided to let the
utmpx code obtain valid timestamps itself.
2010-01-23 08:43:21 +00:00
Tim Kientzle
e066c90bb2 Don't try to hardlink block or character device nodes that come out
of cpio archives.
2010-01-23 07:57:17 +00:00
Tim Kientzle
54d2369731 Use a simpler memory-management strategy for the file objects.
Instead of trying to reference-count them and free them as soon
as they are no longer needed, we now just keep them around and free
them all when we release the archive object.  This fixes a number
of minor memory leaks, especially when reading damaged archives.
2010-01-23 07:55:53 +00:00
Tim Kientzle
58efb33976 If we can't stat a file, return the correct ARCHIVE_FAILED (this entry can't
be processed any further) and a suitable error string.
In particular, this improves the error-reporting when cpio -o is
given a nonexistent filename.
2010-01-23 07:54:15 +00:00
Tim Kientzle
8b0eda3700 Initialize the allocated 'struct zip'. 2010-01-23 07:52:44 +00:00
Tim Kientzle
68c43d86d1 Fix a memory leak when a filter fails to initialize. 2010-01-23 07:52:13 +00:00
Ed Schouten
f5ec5ddec2 English nitpicking.
Submitted by:	jmallett
2010-01-22 05:19:51 +00:00
Ed Schouten
5b2e6b2a90 Describe why pututxline() doesn't entirely conform to standards. 2010-01-22 05:09:10 +00:00
Ed Schouten
d17ad825d6 Remove comments about breaking the specification.
I've discussed this issue with the Austin Group and it will be fixed in
future revisions of the specification. The issue was that ut_line fields
weren't supposed to be valid for LOGIN_PROCESS entries, while
getutxline() would try to match these records anyway.

They also agreed on our way of implementing pututxline() without
getutxid() (which other operating systems also do), but unfortunately
they disagreed with our way of replacing DEAD_PROCESS entries, which is
a pity. The current specification allows the utmpx database to become
infinitely big over time.

See also:	http://austingroupbugs.net/view.php?id=213#c378
2010-01-22 04:53:08 +00:00
Ed Schouten
0806dd9238 Remove stale references to utmp(5) and its corresponding filenames.
I removed utmp and its manpage, but not other manpages referring to it.
2010-01-21 17:25:12 +00:00
Ed Schouten
84bee0d7fb Remove libulog from the bootstrap again.
libulog now only provides functions that are used by various packages
from the ports tree, namely the libutempter ones. There is no reason to
link it into the crunch/fixit binaries anymore.
2010-01-21 16:56:27 +00:00
Ed Maste
bc7622b746 Correct comment typo. 2010-01-21 15:01:09 +00:00
Gabor Kovesdan
124493a1de - Update Galician catalog 2010-01-21 11:36:40 +00:00
Pawel Jakub Dawidek
bb30676c15 The waitpid(2) function needs neither sys/time.h nor sys/resource.h. 2010-01-20 22:26:36 +00:00
Andrey A. Chernov
5fc5e42a2e Style: reword comment.
Submitted by:   bde
2010-01-20 11:59:46 +00:00
Andrey A. Chernov
e5732e1803 For alphasort() add reference to strcoll(3) 2010-01-20 11:55:14 +00:00
Andrey A. Chernov
e5c9c8533d Style: rename internal function to opendir_compar()
Pointed by:     bde
2010-01-20 07:36:29 +00:00
Andrey A. Chernov
888ee87295 Style: remove extra empty line in the comment.
Pointed by:     bde
2010-01-20 07:27:56 +00:00
Ed Schouten
26f87cc6ff Revert r202447 by re-exposing the old uname(3) function.
It makes hardly any sense to expose a symbol which should only be
provided for binary compatibility, but it seems we don't have a lot of
choice here. There are many autoconf scripts out there that try to
create a binary that links against the old symbol to see whether
uname(3) is present. These scripts fail to detect uname(3) now.

It should be noted that the behaviour we implement is not against the
standards:

| The following shall be declared as a function and may also be defined
| as a macro:
|
| int uname(struct utsname *);
2010-01-19 23:07:12 +00:00
Dag-Erling Smørgrav
66c82e578c Add missing DPADD and fix whitespace.
Submitted by:	ru
2010-01-19 13:31:57 +00:00
Dag-Erling Smørgrav
79ad329d0c Add HTTP digest authentication.
Submitted by:	Jean-Francois Dockes <jf@dockes.org>
Forgotten by:	des (repeatedly)
2010-01-19 10:19:55 +00:00
Andriy Gapon
9e515b1d82 fix a comment typo
MFC after:	3 days
2010-01-18 19:10:14 +00:00
Andrey A. Chernov
b9a74f2ad5 Double checking my commit I found that comment saying that
POSIX 2008 and XSI 7require strcoll() for opendir() is not true.
I can't find such requirement in POSIX 2008 and XSI 7.

So, back out that part of my commit, returning old strcmp(), and remove
this misleading comment.
2010-01-18 13:44:44 +00:00
Ed Schouten
d1b8647f1c Let pam_lastlog use random ut_id's.
By using random values for ut_id, not based on the TTY name, it is
possible to run for example login(1) multiple times on the same TTY,
without overwriting any previous records.

The output of w(1) will then be as follows:

| 12:26PM  up 2 days,  2:31, 5 users, load averages: 0.01, 0.03, 0.03
| USER       TTY      FROM                      LOGIN@  IDLE WHAT
| ed         pts/2    mekker.80386.nl          12:26PM     - w
| root       pts/2    -                        12:26PM     - w
| root       pts/2    -                        12:26PM     - w
| root       pts/2    -                        12:26PM     - w

Approved by:	des
2010-01-18 11:29:51 +00:00
David Xu
4c1c132bf4 preserve errno when processing error cases. 2010-01-18 10:29:04 +00:00
Andrey A. Chernov
dcdafd0e92 a) Use strcoll() in opendir() and alphasort() as POSIX 2008 requires.
It also matches now how our 'ls' works for years.

b) Remove comment expressed 2 fears:
 1) One just simple describe how strcoll() works in _any_ context,
 not for directories only. Are we plan to remove strcoll() from everything
 just because it is little more complex than strcmp()? I doubt, and
 directories give nothing different here. Moreover, strcoll() used
 in 'ls' for years and nobody complaints yet.

 2) Plain wrong statement about undefined strcoll() behaviour. strcoll()
 always gives predictable results, falling back to strcmp() on any
 trouble, see strcoll(3).

No objections from -current list discussion.
2010-01-18 10:17:51 +00:00
Ed Schouten
98c63a48e9 Perform several small cleanups to the utmpx code.
- Massively reduce BSS usage. Let futx_to_utx() dynamically allocate the
  structure. There is only a very small amount of applications out there
  that needs to use the utmpx database. Wasting 1 KB on unused
  structures makes little sense.

- Just let getutxid() search for matching ut_id's for any *PROCESS-type.
  This makes the code a bit more future-proof.

- Fix a POSIX-mistake: when reading POSIX and the OpenSolaris
  implementation, getutxline() must return USER_PROCESS and
  LOGIN_PROCESS records whose ut_lines match. When reading POSIX, it
  seems LOGIN_PROCESS should not use ut_line at the first place. I have
  reported this issue.
2010-01-17 21:40:05 +00:00
Ed Schouten
e35a88d3a6 Add forgotten break; keyword to getutxid().
We should not fall through to the ut_id comparison. Only ut_type should
be compared when using OLD_TIME, NEW_TIME, BOOT_TIME or SHUTDOWN_TIME.
2010-01-17 21:00:29 +00:00
Marcel Moolenaar
d3e5c802a9 Unbreak builds with _FREEFALL_CONFIG=yes, by forcing a lower WARNS
level in that case.
2010-01-17 19:47:42 +00:00
Ed Schouten
2c8d07a874 Fix a regression that was introduced in r191882.
I changed login_tty() to only work when the application is not a session
leader yet. This works fine for applications in the base system, but it
turns out various applications call this function after daemonizing,
which means they already use their own session.

If setsid() fails, just call tcsetsid() on the current session.
tcsetsid() will already perform proper security checks.

Reported by:	Oliver Lehmann
MFC after:	1 week
2010-01-17 17:52:35 +00:00
Ed Schouten
79a7dbf111 Simplify ttyslot(3).
After comparing how other systems deal with utmp/utmpx, I noticed many
systems don't even care about ttyslot(3) anymore, since utmpx doesn't
use TTY slots anyway. We don't provide any tools to access old utmp
files anymore, so there is no use in letting applications write to a
proper offset within the utmp file.

Just let ttyslot(3) always return 0, which seems to be the default
behaviour on operating systems like Linux as well.
2010-01-17 15:43:14 +00:00
Xin LI
1750e4f8d7 Correct a typo (when we talk about offset, it should
be offset, not size).

Submitted by:	pluknet at gmail com
2010-01-17 08:12:28 +00:00
Xin LI
35daa28f30 Expose stripe offset and stripe size through libgeom and geom(8) userland
utilities.

Reviewed by:	pjd, mav (earlier version)
2010-01-17 06:20:30 +00:00
Ed Schouten
023b02dea7 Unexpose the old uname(3) function.
Nowadays uname(3) is an inline function around __xuname(3). Prevent
linkage of new binaries against this compatibility function, similar to
what I did with ttyslot(3).
2010-01-16 17:05:27 +00:00
David Xu
764ce7ce7d Also call sem_module_init in sem_close to initialize mutex
with some attributes.
2010-01-15 01:19:58 +00:00
Ed Schouten
5ab7f1fc40 Add wtmpcvt(1).
This utility allows users to convert their wtmp databases to the new
format. It makes no sense for users to keep their wtmp log files if they
are unable to view them.

It basically copies ut_line into ut_id as well. This makes it possible
for last(1) and ac(8) to match login records with their corresponding
logout record.
2010-01-14 20:58:45 +00:00
Ed Schouten
c068466245 Remove ttyslot from Symbol.map anyway.
Requested by:	kan
2010-01-14 15:20:46 +00:00
Ed Schouten
6386f4da2a Unbreak pututxline() on 32-bit architectures.
I forgot to cast the size_t's back to off_t before negating them,
causing all sorts of artifacts where the log files would grow to 2^32 -
197 bytes.

Reported by:	ume
2010-01-14 15:20:09 +00:00
Ed Schouten
d496b9d0d4 Revert the change to Symbol.map, made in r202274.
Even though we use __sym_compat(), we should list the symbol in
Symbol.map.

ttyslot() is now listed as follows, which seems to do the right thing:

| Symbol table '.dynsym' contains 2755 entries:
|    Num:    Value          Size Type    Bind   Vis      Ndx Name
|    613: 00000000000477b0   121 FUNC    GLOBAL DEFAULT   10 ttyslot@FBSD_1.0

Reported by:	kib
2010-01-14 10:00:01 +00:00
Ed Schouten
7bc9f25fd0 Don't use fseeko() to obtain the file offset.
I was a bit confused with lseek(), which returns the new offset. We
should ftello() to obtain it using stdio.
2010-01-14 08:08:55 +00:00
Ed Schouten
9457bcdc60 Add two changes that should have gone into commit r202274.
Phase out ttyslot(3).

  The ttyslot() function was originally part for SUSv1, marked LEGACY in
  SUSv2 and removed later on. This function only makes sense when using
  utmp(5), because it was used to determine the offset of the record for
  the controlling TTY. It makes little sense to keep it here, because the
  new utmpx file format doesn't index based on TTY slots.
2010-01-14 05:37:43 +00:00
Ed Schouten
88b69f52ee Phase out ttyslot(3).
The ttyslot() function was originally part for SUSv1, marked LEGACY in
SUSv2 and removed later on. This function only makes sense when using
utmp(5), because it was used to determine the offset of the record for
the controlling TTY. It makes little sense to keep it here, because the
new utmpx file format doesn't index based on TTY slots.
2010-01-14 05:35:32 +00:00
Ed Schouten
21470ecd91 Remove login(3), logout(3) and logwtmp(3) from libutil.
These functions only apply to utmp(5). They cannot be kept intact when
moving towards utmpx. The login(3) function would break, because its
argument is an utmp structure. The logout(3) and logwtmp(3) functions
cannot be used, since they provide a functionality which partially
overlaps.

Increment SHLIB_MAJOR to 9 to indicate the removal.
2010-01-13 18:59:51 +00:00
Ed Schouten
691ac623d7 Remove utmpx stub from libulog.
I'm not increasing the shlib major version for this, because not a
single application outside the base system should have used these
functions in such a short timespan.

Rewrite ulog_login(3) and ulog_logout(3) to build on top of the utmpx
implementation in libc.
2010-01-13 18:53:06 +00:00
Ed Schouten
2957240805 Let pam_lastlog use utmpx instead of libulog's utmpx interface.
It will still use ulog_login(3) and ulog_logout(3), which will remain
present.
2010-01-13 18:32:31 +00:00
Ed Schouten
057ee500e5 Let libopie use utmpx instead of utmp. 2010-01-13 18:02:30 +00:00
Ed Schouten
a627ac61ab Implement <utmpx.h>.
The utmpx interface is the standardized interface of the user accounting
database. The standard only defines a subset of the functions that were
present in System V-like systems.

I'd like to highlight some of the traits my implementation has:

- The standard allows the on-disk format to be different than the
  in-memory representation (struct utmpx). Most operating systems don't
  do this, but we do. This allows us to keep our ABI more stable, while
  giving us the opportunity to modify the on-disk format. It also allows
  us to use a common file format across different architectures (i.e.
  byte ordering).

- Our implementation of pututxline() also updates wtmp and lastlog (now
  called utx.log and utx.lastlogin). This means the databases are more
  likely to be in sync.

- Care must be taken that our implementation discard any fields that are
  not applicable. For example, our DEAD_PROCESS records do not hold a
  TTY name. Just a time stamp, a record identifier and a process
  identifier. It also guarantees that strings (ut_host, ut_line and
  ut_user) are null terminated. ut_id is obviously not null terminated,
  because it's not a string.

- The API and its behaviour should be conformant to POSIX, but there may
  be things that slightly deviate from the standard. This implementation
  uses separate file descriptors when writing to the log files. It also
  doesn't use getutxid() to search for a field to overwrite. It uses an
  allocation strategy similar to getutxid(), but prevents DEAD_PROCESS
  records from accumulating.

Make sure libulog doesn't overwrite the manpages shipped with our C
library. Also keep the symbol list in Symbol.map sorted.

I'll bump __FreeBSD_version later this evening. I first want to convert
everything to <utmpx.h> and get rid of <utmp.h>.
2010-01-13 17:29:55 +00:00
David Xu
41e160536a Return SEM_FAILED instead of NULL, though there are same, but the
SEM_FAILED is more suitable name.
In function, sem_close(), always set errno on error.
2010-01-13 08:53:23 +00:00
Christian Brueffer
a47698f8d6 Miscellaneous mdoc, spelling and inconsistency fixes.
PR:		142573, 142576 (mostly)
Submitted by:	brucec
MFC after:	1 week
2010-01-12 21:45:03 +00:00
Christian Brueffer
0ae739d6b2 Remove useless .TE groff macro.
Submitted by:	Joerg Sonnenberger
MFC after:	3 days
2010-01-12 17:38:23 +00:00
Joseph Koshy
bc315bbd5a Bug fix: add a missing initializer.
Submitted by:	Luca Pizzamiglio <luca.pizzamiglio at gmail dot com>
PR:		i386/142742
2010-01-12 17:03:55 +00:00
David Xu
7bf27b2dde Update manuals of sem_open and sem_init.
Submitted by:	ru
2010-01-12 01:30:05 +00:00
Andrew Thompson
c740e8e4b2 Reset variable fields in case the transfer is opened again
Submitted by:	Hans Petter Selasky
2010-01-10 19:18:49 +00:00
Colin Percival
c6a96a8441 Give a less silly response to a silly request.
Prior to this commit, fread/fwrite calls with size * nmemb > SIZE_MAX
were handled by reading or writing (size_t)(size * nmemb) bytes; for
example, on 32-bit platforms, fread(ptr, 641, 6700417, f) would read 1
byte and indicate that the requested 6700417 blocks had been read.

This commit adds a check for such integer overflows, and treats them as
if an overly large request was passed to read/write; i.e., it sets errno
to EINVAL, sets the error indicator on the file, and returns a short
object count (0, to be specific).

The overflow check involves an integer division, so as a performance
optimization we check first to see if both size and nmemb are less than
2^16; if they are, no overflow is possible and we avoid the division.
We assume here that size_t is at least 32 bits; this appears to be true
on all platforms FreeBSD supports.

Although this commit fixes an integer overflow, it is not likely to have
any security implications, since any program which would be affected by
this bug fix is quite clearly already very confused.

Reviewed by:	kib
MFC after:	1 month
2010-01-10 14:30:30 +00:00
Brooks Davis
9d8e1a8300 Use the correct types to store uids and gids in the credential cache. 2010-01-09 23:36:51 +00:00
Marcel Moolenaar
f8fd9e4820 Implement the fo_readdir method. This does not support long
file names.

Obtained from:	Juniper Networks, Inc.
MFC after:	1 week
2010-01-09 22:33:34 +00:00
Xin LI
777f8cebf3 Add a set of manual pages for pthread[_attr]_[sg]etaffinity(3).
Reviewed by:	davidxu
MFC after:	2 weeks
2010-01-09 12:31:11 +00:00
David Xu
a455039e3a Update manual for sem_init and sem_open, restrictions of shared semaphore
and 14 characters in name length no longer exist.

Reviewed by:	deischen@
2010-01-09 05:40:46 +00:00
Warner Losh
b543d9ad75 Merge r195129 from project/mips to head by hand:
r195129 | gonzo | 2009-06-27 17:28:56 -0600 (Sat, 27 Jun 2009) | 2 lines
- Use sysarch(2) in MIPS version of _tcb_set/_tcb_get
2010-01-09 00:07:47 +00:00
Warner Losh
52e0ea7a0d Merge r195030 from project/mips to head by hand
r195030 | gonzo | 2009-06-25 19:27:31 -0600 (Thu, 25 Jun 2009) | 4 lines
- Switch to libc softfloat from libgcc implementation. The problem
    with latter is that it is not complete, fpsetXXX/fpgetXXX
    functions are missing.
2010-01-09 00:01:35 +00:00
Warner Losh
87e925fb53 Merge r197800 from projects/mips to head by hand:
r197800 | gonzo | 2009-10-06 00:35:52 -0600 (Tue, 06 Oct 2009) | 3 lines
- curbrk variable for sbrk and brk should be the same
- Add correct variable names to Symbol.map
2010-01-08 23:59:04 +00:00
Warner Losh
9cd8780a69 Merge r195025 from projects/mips to head by hand:
r195025 | gonzo | 2009-06-25 19:01:50 -0600 (Thu, 25 Jun 2009) | 4 lines
- Move fpgetXXX.c/fpsetXXX.c sources to hardfloat subdir/
    to prevenmt them from being mixed up with lib/libc/softfloat
    files with the same names
2010-01-08 23:50:39 +00:00
Christian Brueffer
37dc3d28cb Remove unnecessary quoting and markup, add missing punctuation.
PR:		140494
Submitted by:	Jeremy Huddleston <jeremyhu@apple.com>, bde
MFC after:	1 week
2010-01-08 22:02:42 +00:00
Konstantin Belousov
4319da1319 Further fix grammar.
Suggested by:	alc
MFC after:	3 days
2010-01-07 21:14:46 +00:00
Christian Brueffer
44640a5251 Fix a typo and bump date for the previous commit. 2010-01-07 21:08:22 +00:00
Edward Tomasz Napierala
10302b1ade Remove BUGS section that no longer applies after recent changes to semaphore
code.

OK-ed by:	davidxu
2010-01-07 16:52:00 +00:00
Konstantin Belousov
0b56296772 Give some information on SF_MNOWAIT flag.
MFC after:	3 days
2010-01-07 13:31:00 +00:00
David Xu
323d80a0a7 Don't forget to use fourth argument if O_CREAT is set in argument oflag.
The fourth specifies initial value for the semaphore.
2010-01-07 04:15:49 +00:00
John Baldwin
8feb1ea45e Use _pthread_once() rather than _once() for localtime() and gmtime(). These
methods are only invoked when __isthreaded is true at which point it is safe
to use _pthread_once() directly.

MFC after:	1 week
2010-01-06 20:43:40 +00:00
Konstantin Belousov
f5636f881b Do not rely on behaviour undefined by ANSI C, use thunks to adapt
alphasort-like interface to the comparision function required by
qsort() and qsort_r().

For opendir() thunk and alphasort(), comment on why we deviated from
POSIX by using strcmp() instead of strcoll().

Requested and reviewed by:	bde
MFC after:	2 weeks
2010-01-05 20:20:31 +00:00
Christian Brueffer
7b331f63c5 Fix a double free().
PR:		142339
Submitted by:	Henning Petersen <henning.petersen@t-online.de>
MFC after:	2 weeks
2010-01-05 20:18:41 +00:00
David Xu
60e9cdf158 remove file thr_sem_new.c. 2010-01-05 07:50:31 +00:00
David Xu
523a738f77 More cleanup, remove _libc prefix because libthr no longer has stubs
referencing them.
2010-01-05 06:40:27 +00:00
David Xu
791f7a99e2 Remove extra new semaphore stubs, because libc already has them, and
ld can find the newest version which is default.

Poked by: kan@
2010-01-05 06:21:29 +00:00
David Xu
3e18aa9869 forgot to remove SYM_FBP10. ;-) 2010-01-05 05:47:18 +00:00
David Xu
79aaab046d Remove unused macros. 2010-01-05 05:44:52 +00:00
David Xu
d802aa25d2 Don't check has_waiters twice, inline some small functions.
performance result on my machine:
	mutex     Elapsed: 902115 us; per iteration: 90 ns.
	semaphore Elapsed: 958780 us; per iteration: 95 ns.
2010-01-05 03:39:31 +00:00
David Xu
9b0f1823b5 Use umtx to implement process sharable semaphore, to make this work,
now type sema_t is a structure which can be put in a shared memory area,
and multiple processes can operate it concurrently.
User can either use mmap(MAP_SHARED) + sem_init(pshared=1) or use sem_open()
to initialize a shared semaphore.
Named semaphore uses file system and is located in /tmp directory, and its
file name is prefixed with 'SEMD', so now it is chroot or jail friendly.
In simplist cases, both for named and un-named semaphore, userland code
does not have to enter kernel to reduce/increase semaphore's count.
The semaphore is designed to be crash-safe, it means even if an application
is crashed in the middle of operating semaphore, the semaphore state is
still safely recovered by later use, there is no waiter counter maintained
by userland code.
The main semaphore code is in libc and libthr only has some necessary stubs,
this makes it possible that a non-threaded application can use semaphore
without linking to thread library.
Old semaphore implementation is kept libc to maintain binary compatibility.
The kernel ksem API is no longer used in the new implemenation.

Discussed on: threads@
2010-01-05 02:37:59 +00:00
Konstantin Belousov
4176dd5267 Modernize scandir(3) and alphasort(3) interfaces according to the IEEE
Std 1003.1-2008. Both Linux and Solaris conforms to the new definitions,
so we better follow too (older glibc used old BSDish alphasort prototype
and corresponding type of the comparision function for scandir). While
there, change the definitions of the functions to ANSI C and fix several
style issues nearby.

Remove requirement for "sys/types.h" include for functions from manpage.

POSIX also requires that alphasort(3) sorts as if strcoll(3) was used,
but leave the strcmp(3) call in the function for now.

Adapt in-tree callers of scandir(3) to new declaration. The fact that
select_sections() from catman(1) could modify supplied struct dirent is
a bug.

PR:	standards/142255
MFC after:	2 weeks
2010-01-04 15:40:17 +00:00
Ed Schouten
442aea92f6 Don't forget to clean up the file copied from the kernel sources.
MFC after:	1 week
2010-01-02 20:27:14 +00:00
Ed Schouten
daaf575910 Build lib/ with WARNS=6 by default.
Similar to libexec/, do the same with lib/. Make WARNS=6 the norm and
lower it when needed.

I'm setting WARNS?=0 for secure/. It seems secure/ includes the
Makefile.inc provided by lib/. I'm not going to touch that directory.
Most of the code there is contributed anyway.
2010-01-02 09:58:07 +00:00
Brooks Davis
a6fffd6cb0 The devices that supported EVFILT_NETDEV kqueue filters were removed in
r195175.  Remove all definitions, documentation, and usage.

fifo_misc.c:
	Remove all kqueue tests as fifo_io.c performs all those that
	would have remained.

Reviewed by:	rwatson
MFC after:	3 weeks
X-MFC note:	don't change vlan_link_state() function signature
2009-12-31 20:29:58 +00:00
Ed Schouten
26fac73c1c Remove an unused variable. 2009-12-31 01:38:12 +00:00
Ed Schouten
e17aa6ff32 Add missing `void' keyword. 2009-12-31 01:37:26 +00:00
John Baldwin
bac2c9636c Use _once() to initialize the pthread key for thread-local storage to hold
the results of gmtime() instead of using a pthread mutex directly.

MFC after:	1 week
2009-12-30 19:06:16 +00:00
Tim Kientzle
e02dd0d514 Remove some test files that are no longer used. 2009-12-30 06:37:58 +00:00
Tim Kientzle
8c78c2959a Reserve constants for RPM unwrapper and XAR reader. 2009-12-30 06:28:30 +00:00
Tim Kientzle
b54f125538 Libarchive in FreeBSD is now synced up with 2.7.901a from
libarchive.googlecode.com
2009-12-30 06:25:19 +00:00
Tim Kientzle
8088bef24c UU decoder. Now that libarchive can recursively taste input streams,
you can do things like this:  tar xvf archive.tar.gz.uu
2009-12-30 06:12:03 +00:00
Tim Kientzle
0a1d787383 A raft of test changes and improvements from the Googlecode repository.
In particular, this includes tests for the new features I've merged
over the last few days.
2009-12-30 05:59:21 +00:00
Tim Kientzle
f124826e0d Merge Michihiro NAKAJIMA's significant work on the ISO9660 reader
from googlecode:
 * Support for zisofs compressed entries
 * Support for relocated deep directories
 * Direct calculation of link counts for accurate nlink values
   even on images that lack Rockridge extensions
 * Faster handling of the internal file lists.
 * Better detection of ISO variants
2009-12-30 05:30:35 +00:00
Konstantin Belousov
d439b6c223 Document _FAST and _PRECISE clocks.
Submitted by:	Valentin Nechayev <netch segfault kiev ua>
MFC after:	3 days
2009-12-29 15:58:10 +00:00
Konstantin Belousov
5d2874abdd Document CLOCK_SECOND, add cross-reference from time(3) to clock_gettime(2).
Based on submission by:	pluknet gmail com
MFC after:	3 days
2009-12-29 14:29:08 +00:00
Konstantin Belousov
358ed16f75 Use clock_gettime(CLOCK_SECOND) instead of gettimeofday(2) for
implementation of time(3). CLOCK_SECOND is much faster.

No objections from:	phk
Submitted by:	Valentin Nechayev <netch segfault kiev ua>
MFC after:	1 week
2009-12-29 12:47:47 +00:00
Tim Kientzle
24b76fe47f Rationalize the support for cryptographic hashes. 2009-12-29 06:39:07 +00:00
Tim Kientzle
87a571f88a Essentially eliminate problems with false hardlinks in POSIX cpio
archives by generating synthetic ino values and mapping values
from disk into the new values.
2009-12-29 06:34:23 +00:00
Tim Kientzle
9d7dd12525 Clear extraneous error messages. 2009-12-29 06:27:19 +00:00
Tim Kientzle
b1657eb07c Zip write support for libarchive.
The initial implementation was developed by Anselm Strauss as part of
Google Summer of Code 2008, then completed by Joerg Sonnenberger.
2009-12-29 06:15:32 +00:00
Tim Kientzle
84b1d75646 If we're linking against liblzma, allow the decompressor to use up to
1<<30 bytes of memory, which is required for some streams.

Also, try to make the taster more discriminating about raw lzma streams.
The detection here is still really weak, though; please use xz instead
of lzma.
2009-12-29 06:06:20 +00:00
Tim Kientzle
25557ee5f4 Minor style fixes plus a fix for an obscure crash on certain malformed
mtree files.
2009-12-29 05:52:13 +00:00
Tim Kientzle
7f16f13149 Be a little more skeptical of dev/ino matches when reading cpio files.
This eliminates some false-positives in the hardlink detection logic.
2009-12-29 05:50:34 +00:00
Tim Kientzle
023a748ef3 Style and portability fixes for pax writer. Mostly very routine, except for:
* Use ino64 where appropriate
 * Don't pass atime or nsec to ustar formatter
2009-12-29 05:47:46 +00:00
Tim Kientzle
1f8bbec2a4 Style fixes to tar reader:
For portability, prefer int64_t to off_t.
  Improve numeric overflow handling when parsing.
  Fix some variable types.
  Eliminate some unused results.
2009-12-29 05:44:39 +00:00
Tim Kientzle
88f5df0d39 Various style fixes to the 'newc' cpio writer:
* Warn about truncation of ino
 * Use a macro to hide the somewhat obscure pad-to-multiple-of-4 calculation
 * Eliminate some unused variables
2009-12-29 05:41:57 +00:00
Tim Kientzle
bb8a41af51 Various fixes when creating objects on disk:
* Write xattrs last instead of first (required on platforms that use
   system xattrs for security attributes)
 * Better handling of chdir() failures
 * Don't bother trying to shorten files via seek()/write()
 * Fix build on systems that lack link()/symlink()/mknod()
 * Prefer futimens()/utimensat() when they're present
2009-12-29 05:35:40 +00:00
Tim Kientzle
dee0ce0cbd Catch decompression failures earlier. In particular, this gives
immediate feedback if we fail to fork an external decompression program.
2009-12-29 05:30:23 +00:00
Tim Kientzle
e2196d3e85 Various style and portability fixes, including:
* Enforce option interface can only be used before the archive is opened
 * Correctly handle large skips on platforms with 32-bit off_t
 * Use int64_t instead of off_t
2009-12-29 05:28:28 +00:00
Tim Kientzle
081e9a983c 64-bit ino support and discourage bad use of this header. 2009-12-29 05:20:12 +00:00
Antoine Brodin
13e403fdea (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.
Fix some wrong usages.
Note: this does not affect generated binaries as this argument is not used.

PR:		137213
Submitted by:	Eygene Ryabinkin (initial version)
MFC after:	1 month
2009-12-28 22:56:30 +00:00
Xin LI
31faa7deeb Grammar fix.
Submitted by:	Kenyon Ralph <kenyon kenyonralph com>
MFC after:	1 week
2009-12-28 18:51:26 +00:00
Luigi Rizzo
e59084e086 bring the NGM_IPFW_COOKIE back into ng_ipfw.h, libnetgraph expects
to find it there. Unfortunately this reintroduces the dependency
on ip_fw_pfil.c
2009-12-28 12:29:13 +00:00
Luigi Rizzo
b6d33186d2 this file is also affected by the ipfw changes 2009-12-28 10:48:01 +00:00
Tim Kientzle
989f6ccc3f Portability. 2009-12-28 06:59:35 +00:00
Tim Kientzle
0d722d6394 Remove some dead assignments, fix some declarations. 2009-12-28 03:33:05 +00:00
Tim Kientzle
e15da0400a Clarify an example so Linux folks won't keep getting confused by this point. 2009-12-28 03:31:29 +00:00
Tim Kientzle
456bd00333 Compatibility with old systems with non-POSIX getpwuid_r/getgrgid_r. 2009-12-28 03:30:31 +00:00
Tim Kientzle
f773eba566 Fix some unused variables and dead assignments. 2009-12-28 03:28:21 +00:00
Tim Kientzle
108f9d8324 Remove an unused variable and an unreachable statement. 2009-12-28 03:25:33 +00:00
Tim Kientzle
409cc2477d Fix line endings. 2009-12-28 03:24:56 +00:00
Tim Kientzle
354c05f65d Discourage external use of this header. 2009-12-28 03:20:54 +00:00
Tim Kientzle
4ffba49a6f Remove unused variable. 2009-12-28 03:14:30 +00:00
Tim Kientzle
6f1d1a5084 O_BINARY for Windows. 2009-12-28 03:13:49 +00:00
Tim Kientzle
966062dd11 Handle Zip CRC validation for uncompressed Zip archives even on
platforms that lack zlib.
2009-12-28 03:11:36 +00:00
Tim Kientzle
10f117ebc2 Include limits.h; remove unused variable. 2009-12-28 03:06:27 +00:00
Tim Kientzle
09bf59d4b9 Use ino64 interface. 2009-12-28 03:05:31 +00:00
Tim Kientzle
2b1f175936 Use new ino64 interface. 2009-12-28 03:03:00 +00:00
Tim Kientzle
9adedf9679 New archive_file_count() utility. 2009-12-28 02:58:14 +00:00
Tim Kientzle
042c735c81 Portability fixes. 2009-12-28 02:45:56 +00:00
Tim Kientzle
65d5426feb Various portability fixes, plus:
* New "ino64" field.
 * New UTF8 interfaces for hardlink/symlink updates
2009-12-28 02:41:27 +00:00
Tim Kientzle
13f322aec3 Remove an unused variable and an unnecessary increment. 2009-12-28 02:33:22 +00:00
Tim Kientzle
cc1e3ebe54 Eliminate an unused assignment. 2009-12-28 02:29:21 +00:00
Tim Kientzle
2866e9d5d0 Portability: Set the file descriptor to binary mode on Win32 2009-12-28 02:28:44 +00:00
Tim Kientzle
c0840e91d3 Discourage outside use of this internal header. 2009-12-28 02:26:06 +00:00
Tim Kientzle
c17fd585bb Remove dead assignment. 2009-12-28 02:22:41 +00:00
Tim Kientzle
a5a14ed059 Portability:
* some non-FreeBSD platforms do actually define __FBSDID() in sys/cdefs.h
 * Borland C <sigh>
2009-12-28 02:22:04 +00:00
Tim Kientzle
e9cb23e15d Portability: terminate abnormally via abort() instead of segfault,
watch the return value from write(), and avoid signed arithmetic on
unsigned values.
2009-12-28 02:20:23 +00:00
Tim Kientzle
06225a399b Allow more formats to be active at a time; discourage outside use. 2009-12-28 02:18:55 +00:00
Tim Kientzle
8ead7c052b Enforce this as an internal-only header. 2009-12-28 02:18:26 +00:00
Tim Kientzle
ee674fd0b9 Discourage people from using this header outside of libarchive. 2009-12-28 02:17:53 +00:00
Tim Kientzle
1bb8e82188 Compatibility: I found some more compilers that don't like 'inline' keyword.
Protection:  Discourage people from using this header outside libarchive.
2009-12-28 02:17:15 +00:00
Tim Kientzle
f1bfc23207 Sync with googlecode some changes that have no impact on FreeBSD. 2009-12-28 02:14:09 +00:00
Tim Kientzle
96de948146 Compatibility fix for some older systems with non-POSIX getgrnam_r/getpwnam_r
and a minor style fix for the hash function.
2009-12-28 02:09:57 +00:00
Tim Kientzle
94cb976997 Catch certain gzip failures at close time. 2009-12-28 02:05:28 +00:00
Tim Kientzle
153ee32724 Remove a dead assignment. 2009-12-28 02:04:42 +00:00
Tim Kientzle
b4a4198e53 Remove some unused variables and dead assignments. 2009-12-28 02:03:54 +00:00
Tim Kientzle
23e37d63dc Update the hard-coded configuration for libarchive. 2009-12-28 02:01:42 +00:00
Tim Kientzle
ff30341ebf Update format manpages for libarchive. 2009-12-28 01:50:23 +00:00
Ed Schouten
4a1f09d742 Parse DEAD_PROCESS entries properly.
The TTY line name should always be set for DEAD_PROCESS entries right
now. When we parse a clean utmp entry, we don't want to interpret it as
a DEAD_PROCESS entry if the TTY has never been used yet.
2009-12-27 22:26:29 +00:00
Ed Schouten
444999a314 Several refinements to libulog's API.
- Only set the fields in the ulog_utmpx structure that are valid for the
  command in question. This means that strings like "shutdown" or "~"
  are not visible to the user anymore.
- Rename UTXF_* to UTXI_*, indicating the indexation, instead of using
  the `antique' filename. If we ever get rid of utmp, it makes little
  sense calling it by its old name.
2009-12-26 22:36:05 +00:00
Ed Schouten
bfa3a5e5bc Don't corrupt logout entries in utmp files.
An older version of the code used a structure on the stack, instead of a
pointer to the structure. It looks like I didn't adjust the parameters
of the write(2) call, causing the first four/eight bytes of the entry to
be corrupted, instead of writing the entire entry to disk.
2009-12-25 20:04:36 +00:00