summaryrefslogtreecommitdiffstats
path: root/usr.bin
Commit message (Collapse)AuthorAgeFilesLines
* Note that the .POSIX special target disables the "Remaking Makefiles" feature.obrien2008-06-271-0/+3
|
* Rework the lifetime management of the kernel implementation of POSIXjhb2008-06-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | semaphores. Specifically, semaphores are now represented as new file descriptor type that is set to close on exec. This removes the need for all of the manual process reference counting (and fork, exec, and exit event handlers) as the normal file descriptor operations handle all of that for us nicely. It is also suggested as one possible implementation in the spec and at least one other OS (OS X) uses this approach. Some bugs that were fixed as a result include: - References to a named semaphore whose name is removed still work after the sem_unlink() operation. Prior to this patch, if a semaphore's name was removed, valid handles from sem_open() would get EINVAL errors from sem_getvalue(), sem_post(), etc. This fixes that. - Unnamed semaphores created with sem_init() were not cleaned up when a process exited or exec'd. They were only cleaned up if the process did an explicit sem_destroy(). This could result in a leak of semaphore objects that could never be cleaned up. - On the other hand, if another process guessed the id (kernel pointer to 'struct ksem' of an unnamed semaphore (created via sem_init)) and had write access to the semaphore based on UID/GID checks, then that other process could manipulate the semaphore via sem_destroy(), sem_post(), sem_wait(), etc. - As part of the permission check (UID/GID), the umask of the proces creating the semaphore was not honored. Thus if your umask denied group read/write access but the explicit mode in the sem_init() call allowed it, the semaphore would be readable/writable by other users in the same group, for example. This includes access via the previous bug. - If the module refused to unload because there were active semaphores, then it might have deregistered one or more of the semaphore system calls before it noticed that there was a problem. I'm not sure if this actually happened as the order that modules are discovered by the kernel linker depends on how the actual .ko file is linked. One can make the order deterministic by using a single module with a mod_event handler that explicitly registers syscalls (and deregisters during unload after any checks). This also fixes a race where even if the sem_module unloaded first it would have destroyed locks that the syscalls might be trying to access if they are still executing when they are unloaded. XXX: By the way, deregistering system calls doesn't do any blocking to drain any threads from the calls. - Some minor fixes to errno values on error. For example, sem_init() isn't documented to return ENFILE or EMFILE if we run out of semaphores the way that sem_open() can. Instead, it should return ENOSPC in that case. Other changes: - Kernel semaphores now use a hash table to manage the namespace of named semaphores nearly in a similar fashion to the POSIX shared memory object file descriptors. Kernel semaphores can now also have names longer than 14 chars (up to MAXPATHLEN) and can include subdirectories in their pathname. - The UID/GID permission checks for access to a named semaphore are now done via vaccess() rather than a home-rolled set of checks. - Now that kernel semaphores have an associated file object, the various MAC checks for POSIX semaphores accept both a file credential and an active credential. There is also a new posixsem_check_stat() since it is possible to fstat() a semaphore file descriptor. - A small set of regression tests (using the ksem API directly) is present in src/tools/regression/posixsem. Reported by: kris (1) Tested by: kris Reviewed by: rwatson (lightly) MFC after: 1 month
* As reported by Alexey Shuvaev, -dumpl overwrote files afterkientzle2008-06-261-0/+2
| | | | linking them, with predictably bad results.
* Pass the entry down into the core write loop, so wekientzle2008-06-251-4/+6
| | | | | | can include the filename when reporting errors. Thanks to: Dan Nelson
* In -p mode, don't gaurd against '..' in paths. We continue tokientzle2008-06-241-0/+1
| | | | | | check in -i mode unless --insecure is specified. PR: bin/124924
* If we're using -l and can't hardlink the file because of a cross-devicekientzle2008-06-211-3/+17
| | | | | | | link, just ignore the -l option and copy the file instead. In particular, this should fix the COPYTREE_* macros used in the ports infrastructure which use -l to preserve space but often get used for cross-device copies.
* Rework line-processing framework to add support for --null andkientzle2008-06-214-62/+130
| | | | to eliminate a callback.
* Various long options for GNU cpio compat.kientzle2008-06-211-0/+8
|
* MfP4: test improvements, mostly for portability.kientzle2008-06-212-20/+68
|
* Make the search for sources in PATH_PORTS more accurate. I onlyjoerg2008-06-201-2/+21
| | | | | | | | | | noticed that a "whereis -qs qemu" matched the distfiles subdir of qemu rather than /usr/ports/emulators/qemu. It now ignores all dot entries in /usr/ports, plus all entries starting with a capital letter (maintenance stuff like Templates, but also includes subdir CVS), plus /usr/ports/distfiles which is simply a magic name in that respect.
* Add myself. Better late then never.mav2008-06-191-0/+1
|
* Add myself.amdmi32008-06-191-0/+1
| | | | Approved by: miwi (mentor)
* Remove superfluous eofmarker.remko2008-06-171-1/+0
| | | | | | | Requested by: Jaakko Heinonen Discussed with: Jaakko, edwin Approved by: imp (mentor, implicit)
* Add my birthday to the calendar.eri2008-06-161-0/+1
| | | | Approved by: mlaier (mentor)
* Struct cdev is always the member of the struct cdev_priv. When devfskib2008-06-161-3/+2
| | | | | | | | | | | needed to promote cdev to cdev_priv, the si_priv pointer was followed. Use member2struct() to calculate address of the wrapping cdev_priv. Rename si_priv to __si_reserved. Tested by: pho Reviewed by: ed MFC after: 2 weeks
* Include bsd.own.mk to pick up the definition of MK_GNU_CPIOdougb2008-06-161-0/+2
|
* 1. Make the BSD version of cpio the default [1]dougb2008-06-162-2/+6
| | | | | | | | | | | | | | | | | a. The BSD version will be built and installed unless WITHOUT_BSD_CPIO is defined. b. The GNU version will not be built or installed unless WITH_GNU_CPIO is defined. If this is defined, the symlink in /usr/bin will be to the GNU version whether the BSD version is present or not. When these changes are MFCed the defaults should be flipped. 2. Add a knob to disable the building of GNU grep. This will make it easier for those that want to test the BSD version in the ports. Approved by: kientzle [1]
* MfP4: Minor portability fix.kientzle2008-06-151-1/+9
|
* MfP4: test harness cleanup.kientzle2008-06-152-19/+21
|
* Add myself to the calendar.ivoras2008-06-121-0/+1
| | | | Approved by: gnn (mentor)
* Fix build of fstat after minor() changes.ed2008-06-121-1/+1
| | | | | | | | | | Even though I ran a `make universe' to see whether the changes to the device minor number macro's broke the build, I was not expecting `make universe' to silently continue if build errors occured, thus causing me to overlook the build error. Approved by: philip (mentor) Pointyhat to: me
* Make one-bit fields unsigned instead of signed. This has no effect,cperciva2008-06-091-1/+1
| | | | | | | since they are only tested for zero/nonzero; but it's arguably a bad idea to set a {-1, 0} variable to 1 (as happens in this code). Found by: Coverity Prevent
* Rework code to avoid using a pointer after freeing it. Aside from thecperciva2008-06-091-2/+4
| | | | | | | possibility of memory becoming undereferenceable when it is freed, this change should have no effect on bsdtar behaviour. Found by: Coverity Prevent
* I missed some "register"s in non-dot-C files.dwmalone2008-06-085-28/+28
|
* Make usage() 'static'.wkoszek2008-06-081-1/+1
|
* De-register declarations.dwmalone2008-06-049-86/+86
|
* Fix a strict aliasing warning - I think it is really telling usdwmalone2008-06-041-2/+3
| | | | | that the way char * and void * pointers may not be stored in the same way.
* Similar to changes previously made to src/usr.bin/uniq/uniq.c,ghelmer2008-05-281-22/+90
| | | | | fix truncation of lines at LINE_MAX characters by dynamically extending line buffers.
* Limit the EOF marker length to a maximum of 79remko2008-05-271-2/+5
| | | | | | | | | | | | characters. [1] Add $FreeBSD$ tag so that I can actually commit this. PR: bin/118782 Reported by: Bjoern Koenig Patch by: edwin, Jaakko Heinonen (not used patch) MFC after: 1 week Approved by: imp (mentor, implicit)
* Compatibility fix: define REG_BASIC if it isn't already. In particular,kientzle2008-05-271-0/+4
| | | | | | | glibc has a suitable regex implementation, but doesn't define this constant. Thanks to: Diego "Flameeyes" Pettenò
* Connect bsdcpio up to the build.kientzle2008-05-261-0/+1
| | | | | | | | | | | | | | | | | | | Starting now, there are two cpio programs in the base system: /usr/bin/gcpio - GNU cpio /usr/bin/bsdcpio - bsdcpio In addition, there is a symlink: /usr/bin/cpio -> /usr/bin/gcpio (default) /usr/bin/cpio -> /usr/bin/bsdcpio (WITH_BSDCPIO) In particular, WITH_BSDCPIO only controls the symlink; bsdcpio is always built regardless. Unless there are objections or problems, I intend: * to make /usr/bin/bsdcpio available in 7.1 * to have /usr/bin/cpio default to bsdcpio in 8.0 (WITH_GCPIO will be an option instead of WITH_BSDCPIO) * to leave /usr/bin/gcpio in the tree until 9.0
* bsdcpio is always installed as 'bsdcpio', symlink it to 'cpio'kientzle2008-05-261-1/+4
| | | | only if WITH_BSDCPIO is defined.
* Initial commit of bsdcpio 0.9.11b.kientzle2008-05-2644-0/+5986
| | | | | | | A new implementation of cpio that uses libarchive as it's back-end archiving/dearchiving infrastructure. Includes test harness; "make check" in the bsdcpio directory to build and run the test harness.
* MFp4: bsdtar 2.5.4bkientzle2008-05-2614-316/+695
| | | | | | | | | | | | | In addition to a number of bug fixes and minor changes: * --numeric-owner (ignore user/group names on create and extract) * -S (sparsify files on extraction) * -s (regex filename substitutions) * Use new libarchive 'linkify' to get correct hardlink handling for both old and new cpio formats * Rework 'copy' test to be insensitive to readdir() filename ordering Most of the credit for this work goes to Joerg Sonnenberger, who has been duplicating features from NetBSD's 'pax' program.
* Use _WANT_FILE to make struct file visible from userland. This ispjd2008-05-261-1/+2
| | | | | | similar to _WANT_UCRED and _WANT_PRISON and seems to be much nicer than defining _KERNEL. It is also needed for my sys/refcount.h change going in soon.
* Remove netatm from HEAD as it is not MPSAFE and relies on the now removedrwatson2008-05-252-7/+0
| | | | | | | | | | | | | | | | | | | NET_NEEDS_GIANT. netatm has been disconnected from the build for ten months in HEAD/RELENG_7. Specifics: - netatm include files - netatm command line management tools - libatm - ATM parts in rescue and sysinstall - sample configuration files and documents - kernel support as a module or in NOTES - netgraph wrapper nodes for netatm - ctags data for netatm. - netatm-specific device drivers. MFC after: 3 weeks Reviewed by: bz Discussed with: bms, bz, harti
* Add myself to the calendargonzo2008-05-241-0/+1
| | | | Approved by: cognet (mentor)
* Add myself to calendar.freebsdmanolis2008-05-241-0/+1
| | | | | | This will also help me not forget my own birthday :) Approved by: gabor (mentor)
* The value le->name cannot be NULL when we're freeing an entry in thecperciva2008-05-231-2/+1
| | | | | | | | | | | | | hardlink table for two reasons: 1. If le->name is set to NULL, the structure le won't be inserted into the table; 2. Even if le somehow did manage to get into the table with le->name equal to NULL, we would die when we dereferenced le->null before we could get to the point of freeing the entry. Remove the unnecessary "if (le->name != NULL)" test and just free the pointer. Found by: Coverity Prevent
* Improve portability via s/struct siginfo/struct siginfo_data/. This wascperciva2008-05-222-3/+3
| | | | running into a namespace collision on an avian operating system.
* Last but not least, add myself to the list of birthdays as well.ed2008-05-221-0/+1
| | | | Approved by: philip (mentor)
* Detect if argv[1] is "" and avoid calling malloc(0). Prior to this commit,cperciva2008-05-191-2/+2
| | | | | | running 'tar ""' would print 'No memory' instead of the correct error message, 'Must specify one of -c, -r, -t, -u, -x' if malloc is set to System V mode (malloc(0) == NULL).
* There's no way for entry to possibly be NULL at the end of write_entrycperciva2008-05-191-2/+1
| | | | | | | | (in fact, there has never been any way for it to be NULL, going all the way back to revision 1.1 of this file), so remove the check and unconditionally free entry. Found by: Coverity Prevent
* Add -L to usage().bms2008-05-191-1/+1
|
* Add an -L option to ignore loopback Internet sockets.bms2008-05-192-3/+24
| | | | MFC after: 2 weeks
* Add myself.rpaulo2008-05-181-0/+1
|
* Add SIGINFO (and for portability to SIGINFO-lacking systems, SIGUSR1)cperciva2008-05-185-1/+205
| | | | | | | | | | | handling to bsdtar. When writing archives (including copying via the @archive directive) a line is output to stderr indicating what is being done (adding or copying), the path, and how far through the file we are; extracting currently does not report progress within each file, but this is likely to happen eventually. Discussed with: kientzle Obtained from: tarsnap
* Add --keep-newer-files option (as in GNU tar: When in -x mode, ignorecperciva2008-05-172-0/+9
| | | | | | | | | | | files if the existing file is newer than the archive entry). Currently if any files are ignored, bsdtar will exit with a non-zero exit status; this is likely to change in the future, but requires some API changes in libarchive. Discussed with: kientzle Obtained from: tarsnap
* Retire some stale alpha references.jhb2008-05-162-7/+0
|
* Teach truss about 32-bit FreeBSD and Linux binaries on amd64. Somejhb2008-05-167-43/+108
| | | | | | | additional work is needed to handle ABI-specific syscall argument parsing, but this gets the basic tracing working. MFC after: 1 week
OpenPOWER on IntegriCloud