Commit Graph

12994 Commits

Author SHA1 Message Date
ed
2bf206e001 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
c47f4ccef3 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
fc12a579a0 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
fee8e21b50 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
e846918be8 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
3ad23bc14f Let libopie use utmpx instead of utmp. 2010-01-13 18:02:30 +00:00
ed
ed79cccfab 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
davidxu
028e43e0f7 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
brueffer
197dc264ae 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
brueffer
ea3ef695e2 Remove useless .TE groff macro.
Submitted by:	Joerg Sonnenberger
MFC after:	3 days
2010-01-12 17:38:23 +00:00
jkoshy
63fd65d19b 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
davidxu
5d104fe3d7 Update manuals of sem_open and sem_init.
Submitted by:	ru
2010-01-12 01:30:05 +00:00
thompsa
0008a6fee1 Reset variable fields in case the transfer is opened again
Submitted by:	Hans Petter Selasky
2010-01-10 19:18:49 +00:00
cperciva
030d49b206 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
0b0c771825 Use the correct types to store uids and gids in the credential cache. 2010-01-09 23:36:51 +00:00
marcel
764d98dd0b 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
delphij
6761d75fb4 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
davidxu
c74318c2e3 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
imp
c27b492e47 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
imp
f0d3132729 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
imp
0ec6bf46ab 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
imp
5bd0838ff5 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
brueffer
ca938e57e7 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
kib
c80db57072 Further fix grammar.
Suggested by:	alc
MFC after:	3 days
2010-01-07 21:14:46 +00:00
brueffer
ad6b20aa0f Fix a typo and bump date for the previous commit. 2010-01-07 21:08:22 +00:00
trasz
d121f05cac 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
kib
fe8ccb0bf3 Give some information on SF_MNOWAIT flag.
MFC after:	3 days
2010-01-07 13:31:00 +00:00
davidxu
d206161359 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
jhb
52e7326f46 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
kib
95ccd2a39d 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
brueffer
bdeb978682 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
davidxu
46ad5872cf remove file thr_sem_new.c. 2010-01-05 07:50:31 +00:00
davidxu
3f563b5b5f More cleanup, remove _libc prefix because libthr no longer has stubs
referencing them.
2010-01-05 06:40:27 +00:00
davidxu
451e3b67a4 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
davidxu
a3e15a64d4 forgot to remove SYM_FBP10. ;-) 2010-01-05 05:47:18 +00:00
davidxu
d3f9024243 Remove unused macros. 2010-01-05 05:44:52 +00:00
davidxu
8ea6a66616 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
davidxu
87c8a1faf2 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
kib
d061de008a 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
a922794e92 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
09818ac28e 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
a5cc24440b 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
e85525874a Remove an unused variable. 2009-12-31 01:38:12 +00:00
ed
eec85dbb58 Add missing `void' keyword. 2009-12-31 01:37:26 +00:00
jhb
ab18b95f4c 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
kientzle
cf3a89cae5 Remove some test files that are no longer used. 2009-12-30 06:37:58 +00:00
kientzle
55e0fdf678 Reserve constants for RPM unwrapper and XAR reader. 2009-12-30 06:28:30 +00:00
kientzle
62d14f706b Libarchive in FreeBSD is now synced up with 2.7.901a from
libarchive.googlecode.com
2009-12-30 06:25:19 +00:00
kientzle
2e55106068 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
kientzle
fa94194ff8 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
kientzle
c6d0b4dd8b 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
kib
04f9b92f28 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
kib
fb28939ce7 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
kib
aa28c32138 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
kientzle
6e9959a0d1 Rationalize the support for cryptographic hashes. 2009-12-29 06:39:07 +00:00
kientzle
3558b2ba52 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
kientzle
4ccc9e75ff Clear extraneous error messages. 2009-12-29 06:27:19 +00:00
kientzle
98c884f078 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
kientzle
40c74f9008 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
kientzle
9f1cacc2a4 Minor style fixes plus a fix for an obscure crash on certain malformed
mtree files.
2009-12-29 05:52:13 +00:00
kientzle
a587aab420 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
kientzle
b51f9a7986 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
kientzle
97620eccc8 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
kientzle
de6816e634 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
kientzle
cbe5f60f48 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
kientzle
25112939de 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
kientzle
8471ffeefd 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
kientzle
7bdc19612b 64-bit ino support and discourage bad use of this header. 2009-12-29 05:20:12 +00:00
antoine
bfd388c026 (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
delphij
2443a07e4f Grammar fix.
Submitted by:	Kenyon Ralph <kenyon kenyonralph com>
MFC after:	1 week
2009-12-28 18:51:26 +00:00
luigi
b41c473d90 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
3065c48390 this file is also affected by the ipfw changes 2009-12-28 10:48:01 +00:00
kientzle
e86a477412 Portability. 2009-12-28 06:59:35 +00:00
kientzle
1a725d203e Remove some dead assignments, fix some declarations. 2009-12-28 03:33:05 +00:00
kientzle
36429d6a27 Clarify an example so Linux folks won't keep getting confused by this point. 2009-12-28 03:31:29 +00:00
kientzle
751833b2d3 Compatibility with old systems with non-POSIX getpwuid_r/getgrgid_r. 2009-12-28 03:30:31 +00:00
kientzle
749f336c04 Fix some unused variables and dead assignments. 2009-12-28 03:28:21 +00:00
kientzle
2533f9e873 Remove an unused variable and an unreachable statement. 2009-12-28 03:25:33 +00:00
kientzle
8ae7c78a5f Fix line endings. 2009-12-28 03:24:56 +00:00
kientzle
49d75536f6 Discourage external use of this header. 2009-12-28 03:20:54 +00:00
kientzle
77b3bad2c6 Remove unused variable. 2009-12-28 03:14:30 +00:00
kientzle
6bd6257279 O_BINARY for Windows. 2009-12-28 03:13:49 +00:00
kientzle
21be9a3355 Handle Zip CRC validation for uncompressed Zip archives even on
platforms that lack zlib.
2009-12-28 03:11:36 +00:00
kientzle
c3c58ccb3c Include limits.h; remove unused variable. 2009-12-28 03:06:27 +00:00
kientzle
9a47973065 Use ino64 interface. 2009-12-28 03:05:31 +00:00
kientzle
4fa2e480dc Use new ino64 interface. 2009-12-28 03:03:00 +00:00
kientzle
b1d1d36a22 New archive_file_count() utility. 2009-12-28 02:58:14 +00:00
kientzle
cd7df27c58 Portability fixes. 2009-12-28 02:45:56 +00:00
kientzle
5b4a30a490 Various portability fixes, plus:
* New "ino64" field.
 * New UTF8 interfaces for hardlink/symlink updates
2009-12-28 02:41:27 +00:00
kientzle
a591c39057 Remove an unused variable and an unnecessary increment. 2009-12-28 02:33:22 +00:00
kientzle
d9802a8c44 Eliminate an unused assignment. 2009-12-28 02:29:21 +00:00
kientzle
0ce60e8858 Portability: Set the file descriptor to binary mode on Win32 2009-12-28 02:28:44 +00:00
kientzle
110ffdeb53 Discourage outside use of this internal header. 2009-12-28 02:26:06 +00:00
kientzle
8b011c5d8a Remove dead assignment. 2009-12-28 02:22:41 +00:00
kientzle
49f605d812 Portability:
* some non-FreeBSD platforms do actually define __FBSDID() in sys/cdefs.h
 * Borland C <sigh>
2009-12-28 02:22:04 +00:00
kientzle
5796104304 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
kientzle
0e3650b26a Allow more formats to be active at a time; discourage outside use. 2009-12-28 02:18:55 +00:00
kientzle
d2acaa3902 Enforce this as an internal-only header. 2009-12-28 02:18:26 +00:00
kientzle
ac6b305380 Discourage people from using this header outside of libarchive. 2009-12-28 02:17:53 +00:00
kientzle
c28b62ef5f 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
kientzle
55a923f0e8 Sync with googlecode some changes that have no impact on FreeBSD. 2009-12-28 02:14:09 +00:00
kientzle
c947d50aa1 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
kientzle
9de6e5e034 Catch certain gzip failures at close time. 2009-12-28 02:05:28 +00:00
kientzle
2c11cde23a Remove a dead assignment. 2009-12-28 02:04:42 +00:00
kientzle
9901fb459e Remove some unused variables and dead assignments. 2009-12-28 02:03:54 +00:00
kientzle
2a6c4953df Update the hard-coded configuration for libarchive. 2009-12-28 02:01:42 +00:00
kientzle
4b77c8c24b Update format manpages for libarchive. 2009-12-28 01:50:23 +00:00
ed
1fbd42b09d 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
2062dc2dbf 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
b2c0c6915e 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
markus
de21e8d4af Use a local copy of entry_d for finding matches. Otherwise, if entry_d pointed
to an entry of 'acl', all ACL entries starting with entry_d would be deleted.

Reviewed by:	trasz
Approved by:	emax (mentor)
MFC after:	3 days
2009-12-25 18:05:06 +00:00
rpaulo
f7db53a9d1 Intel XScale hwpmc(4) support.
This brings hwpmc(4) support for 2nd and 3rd generation XScale cores.
Right now it's enabled by default to make sure we test this a bit.
When the time comes it can be disabled by default.
Tested on Gateworks boards.

A man page is coming.

Obtained from:	//depot/user/rpaulo/xscalepmc/...
2009-12-23 23:16:54 +00:00
jhb
0ea3a0b2ea Fix a bug in gzipfs that prevented lseek() from working and add lseek()
support to bzip2fs.  This fixes problems with loading compressed amd64
kernel modules containing debug symbols.

Submitted by:	David Naylor  naylor.b.david (gmail)
MFC after:	1 week
2009-12-23 21:11:03 +00:00
edwin
eddea47c4f MFV of tzdata2009t, r200831
zic:
- Fix URL / reference to Calendrical Calculations: Third Edition

libc/stdtime:
- Fix typo in tzfile.5 (no changes in our part)

MFC after:	1 week
2009-12-22 11:17:10 +00:00
delphij
e3103880d8 Use vsprintf instead of rolling our own.
PR:		bin/140496
Submitted by:	Jeremy Huddleston <jeremyhu apple.com>
MFC after:	1 month
2009-12-21 19:59:38 +00:00
delphij
45f47d9a5f Use vsscanf instead of rolling our own.
PR:		bin/140530
Submitted by:	Jeremy Huddleston <jeremyhu apple.com>
MFC after:	1 month
2009-12-21 19:56:03 +00:00
delphij
71977347f2 K&R -> ANSI prototype.
MFC after:	1 month
2009-12-21 19:55:05 +00:00
jhb
257e93c9a0 Use _once() to initialize the pthread key for thread-local storage to hold
the results of localtime() instead of using a pthread mutex directly.

MFC after:	1 week
2009-12-21 19:43:23 +00:00
jamie
cf8736c474 Add a null pointer check so "name" can be used as a key parameter in
jailparam_get.

PR:		bin/141692
Submitted by:	delphij
MFC after:	3 days
2009-12-17 05:06:56 +00:00
matteo
fbf6bc755d 2009-12-16 04:19:23 +00:00
jilles
2a4bb5bd52 cpuset(2): fix a typo and a markup error in the man page
MFC after:	1 week
2009-12-15 21:02:29 +00:00
marcel
5c1d0ca7f5 Work-around a race condition on ia64 while unlocking a contested lock.
The race condition is believed to be in UMTX_OP_MUTEX_WAKE. On ia64,
we simply go to the kernel to unlock.
The big question is why this is only a race condition on ia64...

MFC after:	3 days
2009-12-14 01:26:01 +00:00
delphij
4a7171bdc0 Explicitly say that this is an internal library which is intended to be
used within FreeBSD base system only, and discourage user applications
from using it.  User applications should use the expat version from the
ports/package collection.

Reviewed by:	simon (earlier version)
MFC after:	2 weeks
2009-12-13 03:29:05 +00:00
scf
26de328278 Fix libusb_open_device_with_vid_pid() to return a NULL if no device is
found instead of the last device in its search list.

Reviewed by:	thompsa
MFC after:	5 days
2009-12-12 00:24:30 +00:00
scf
02d6bc865e Remove a dead store.
MFC after:	5 days
2009-12-12 00:11:40 +00:00
ed
ae165eac2a The hostname passed to ulog_login(3) may be optional.
Don't trip on a null pointer being passed to this function when
performing a local login.

Noticed by:	dougb
2009-12-11 23:52:42 +00:00
ed
caa83cf255 Convert pam_lastlog(8) to libulog.
The information used by the "Last login:"-line is obtained by using
ulog_setutxfile(3) to switch to the lastlog database. Login and logout
are performed using the utility functions ulog_login(3) and
ulog_logout(3).

This also means we must build libulog during bootstrap.

Approved by:	des
2009-12-11 14:15:55 +00:00
syrinx
c5db4e0d33 Bump the man page date to the date of the last update.
Noticed by:	bz
2009-12-11 13:05:09 +00:00
syrinx
c5bdafde93 Add support for TACACS+ accounting to libtacplus(3).
Submitted by:	Michael Pounov misho@aitbg.com
OKed by:	emaste
2009-12-11 07:53:44 +00:00
brooks
67de47b8de Add a missing else that negated the truncation of ki_ngroups to
NGROUPS.

Submitted by:	Dmitry Pryanishnikov <lynx dot ripe at gmail dot com>
2009-12-10 21:16:16 +00:00
kientzle
4cc001f60b Merge two cpio fixes from libarchive.googlecode.com:
1) Avoid an infinite loop in the header resync for certain malformed
    archives.
 2) Don't try to match hardlinks if the nlinks count is < 2.   This
    reduces the likelihood of a false hardlink match due to ino truncation.

MFC after:	7 days
2009-12-10 06:42:28 +00:00
jasone
6e354b089d Simplify arena_run_reg_dalloc(), and remove a bug that was due to incorrect
initialization of ssize_invs.
2009-12-10 02:51:40 +00:00
jasone
06dc67d8bb Fix the posix_memalign() changes in r196861 to actually return a NULL pointer
as intended.

PR:		standards/138307
2009-12-10 00:16:11 +00:00
jilles
55d035ed41 sem_init(3): document process shared semaphores and their restrictions 2009-12-08 20:48:06 +00:00
ed
2f3558914c Install libulog in /lib.
Because several applications in /bin use libulog (or may use it in the
nearby future), it must not live inside /usr. It seems like we don't
need to add the copy from /usr/lib to ObsoleteFiles.inc, because it's
cleaned up during installation of libulog automatically.

Reported by:	ume
2009-12-07 05:57:28 +00:00
scf
c1fd4ec15e Revert behavior change to setenv(), unsetenv() and putenv() until a more
thorough security review has been completed.
2009-12-07 00:22:10 +00:00
scf
07b9b1d87c Update the getenv(3) man page to reflect the recent change to the behavior
of setenv(), putenv() and unsetenv() when dealing with corrupt entries in
environ.  They now output a warning and complete their task without error.

MFC after:	1 week
2009-12-06 23:51:27 +00:00
scf
cc8ac32844 Change the behavior of setenv(), putenv() and unsetenv() to continue parsing
instead of returning an error if a corrupt (not a "name=value" string) entry
in the environ array is detected when (re)-building the internal
environment.  This should prevent applications or libraries from
experiencing issues arising from the expectation that these calls will
complete even with corrupt entries.  The behavior is now as it was prior to
7.0.

Reviewed by:	jilles
MFC after:	1 week
2009-12-06 23:27:24 +00:00
scf
3a10c02213 Improve the comment within getenv() explaining the search order it takes to
find a variable.  Include a note that it must not cause the internal
environment to be generated since malloc() depends upon getenv().  To call
malloc() would create a circular dependency.

Recommended by:	green
Approved by:	jilles
MFC after:	1 week
2009-12-06 23:05:17 +00:00
ed
4fc18b0e9c Add a libutempter compatibility interface to libulog.
The ulog_login_pseudo(3) and ulog_logout_pseudo(3) interfaces provide a
functionality identical to what libutempter has to offer. Just transform
libutempter's calls into the before mentioned functions.

libutempter doesn't work with utmpx, so instead of fixing I thought the
easiest way would be to integrate this functionality. libutempter is
used by applications like xterm and the KDE libraries, so if I ever
change the underlying file format, these applications will keep working
automatically.

Also increase __FreeBSD_version to indicate the addition (as well as the
import of libulog).
2009-12-06 20:30:21 +00:00
ed
d48cd1eb37 Massively extend libulog:
- Just like struct utmp, store strings inside struct utmpx itself. This
  is needed to make things like pututxline() work.
- Add ut_id and ut_pid fields, even though they have little use in our
  implementation.
- It turns out our "reboot" wtmp entries indicate a system boot, so
  remove REBOOT_TIME
- Implement getutxline() and pututxline
- Add getutxuser() and setutxfile(), which allows us to crawl wtmp and
  lastlog files as well.
- Add _ULOG_POSIX_NAMES, so we can already use the POSIX names if we
  really want to.
2009-12-05 19:53:29 +00:00
ed
06fcc20479 Fix many "function declaration isn't a prototype" warnings in libc.
I've only fixed code that seems to be written by `us'. There are still
many warnings like this present in resolv/, rpc/, stdtime/ and yp/.
2009-12-05 19:31:38 +00:00
ed
e912442e98 Don't let the C library depend on <utmp.h>.
The maximum length of a username has nothing to do with the size of the
username in the utmp files. Use MAXLOGNAME, which is defined as 17
(UT_USERSIZE + 1).
2009-12-05 19:04:21 +00:00
ed
1a90ab9d6e Remove warnings from exec.c.
The entries in the argv array are not const themselves, but sometimes we
want to fill in const values. Just make the array const and use
__DECONST() to make it const for the execve()-call itself.

Also convert the only K&R prototype to ANSI.
2009-12-05 18:55:16 +00:00
ed
ad8df71883 Use ANSI C prototypes inside termios.
While there, add a missing __unused to hide a warning in tcsetbreak().
2009-12-05 18:53:04 +00:00
ed
8b25a2a3d0 Remove (hidden) warning about missing prototypes for fdevname(3). 2009-12-05 18:51:44 +00:00
trhodes
50b1bbf2fa Add a missing word to a sentence in the return values section. 2009-12-04 09:20:20 +00:00
gabor
786e403e1b - Update the Spanish NLS catalog
Reviewed by:	carvay,
		the.infamous.paul@gmail.com,
		Joan Picanyol i Puig <lists-freebsd-es@biaix.org>,
		Ing . Marcos Luis Ortiz Valmaseda <mlortiz@uci.cu>,
		eskanete@gmail.com,
		Jose M Rodriguez <josemi@freebsd.jazztel.es>,
		Guillermo Hernandez <guillermo@QuerySoft.es>,
		dani.doni@gmail.com
2009-12-03 19:27:12 +00:00
ed
8ed84589ca Use USER_PROCESS instead of LOGIN_PROCESS.
POSIX isn't clear about how the fields should be used, but according to
utmpx(5) on Linux, LOGIN_PROCESS refers to a TTY that's still running a
getty.
2009-12-03 17:05:36 +00:00
ed
de31befa07 Also implement ut_type.
I thought we couldn't emulate this field, but we can derive this field
by looking at special values for ut_host, ut_line and ut_name.
2009-12-03 16:33:47 +00:00