aboutsummaryrefslogtreecommitdiffstats
path: root/makewrappers
AgeCommit message (Collapse)AuthorFilesLines
2014-05-27Honor umaskPeter Seebach1-0/+1
We used to rely on filesystem operations to apply the umask when appropriate, but when we started masking out 022, that stopped working. Start watching umask.
2014-04-24Make configure handle xattr guessing (or specifying)Peter Seebach1-2/+6
Clean-up: Allow specification of environment hints for subports scripts, such as whether xattr support is available. Also make configure guess at a bit width if none is specified. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2014-04-21Automatic dependency checking for wrappersPeter Seebach1-1/+16
Ports can provide pseudo_wrappers.c or portdefs.h, and individual functions have implementations. These dependencies aren't known until post-configure. Make the Makefile include two sub-Makefiles which can be updated by makewrappers. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2013-02-26PSEUDO_ALLOW_FSYNC: Allow fsync()pseudo-1.5PSEUDO_1_5Peter Seebach1-1/+2
Some filesystems have buggy semantics where stat(2) will return incorrect sizes for files for a while after some changes, sometimes, unless they've been fsync'd. We still want to disable fsync most of the time, but enabling it for specific programs can be useful. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2013-02-17Darwin fixes for fsync changes, uninitialized variablePeter Seebach1-0/+1
Darwin's off_t is a 64-bit type, so there's no off64_t. Also, there's an uninitialized variable usage in unlinkat which LLVM catches. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
2013-02-16allow pseudo to force asynchronous behaviorPeter Seebach1-1/+12
The openembedded build, at least with RPM or SMART, is heavily affected by the cost of calling fsync or fdatasync on package databases all the time. Gosh, wouldn't it be nice if we could suppress that without making dozens of highly intrusive and risky changes into RPM, various database packages, and so on? Yes, yes it would. If only there were a program which could intercept system calls and change their behavior! Enter --enable-force-async. There are now wrappers for fsync, fdatasync, and a few related functions. If --enable-force-async is set, these wrappers instantly return 0, even if PSEUDO_DISABLED is set. And with any luck, bitbake will now perform a bit better. Credit for this insight goes to Richard Purdie. I've reimplemented this to add the configure option, and make the fsync suppression work even when PSEUDO_DISABLED is set.
2012-12-12add linkat() implementationPeter Seebach1-2/+2
We never had an implementation for linkat() because no one used it; now someone uses it. link() is now implemented on top of linkat(). Note the abnormal AT_SYMLINK_FOLLOW (as opposed to _NOFOLLOW) flag.
2012-02-06fix spaces/tabs in python againPeter Seebach1-2/+2
2012-02-06Fix *at() function interface holesPeter Seebach1-5/+12
1. Fix *at() where dirfd is obtained through dirfd(DIR *). The dirfd(DIR *) interface allows you to get the fd for a DIR *, meaning you can use it with openat(), meaning you can need its path. This causes a segfault. Also fixed the base_path code not to segfault in that case, but first fix the underlying problem. 2. Implement renameat() After three long years, someone tried to use this. This was impossibly hard back when pseudo was written, because there was only one dirfd provided for. Thing is, now, the canonicalization happens in wrapfuncs, so a small tweak to makewrappers to recognize that oldpath should use olddirfd if it exists is enough to get us fully canonicalized paths when needed.
2011-06-09Fix realpath(name, NULL) when PSEUDO_DISABLED=1Peter Seebach1-0/+1
On some Linux systems, dlsym("realpath", RTLD_NEXT) prefers for reasons of its own to give a symbol that is also known as old_realpath, which fails and yields EINVAL when called with a null pointer as the second argument. This can be avoided, on some systems, by using dlvsym() to request the GLIBC_2.3 version of the symbol. The wrapper logic is enhanced to allow for specifying versions, although this currently only works for Linux (Darwin has no dlvsym, apparently?). The test case is a trivial program which calls realpath(name, NULL) run with PSEUDO_DISABLED=1.
2011-04-04Whitespace changes.Peter Seebach1-15/+15
2011-03-25Merge in ports workPeter Seebach1-24/+188
This is a spiffied-up rebase of a bunch of intermediate changes, presented as a whole because it is, surprisingly, less confusing that way. The basic idea is to separate the guts code into categories ranging from generic stuff that can be the same everywhere and specific variants. The big scary one is the Darwin support, which actually seems to run okay on 64-bit OS X 10.6. (No other variants were tested.) The other example given is support for the old clone() syscall on RHEL 4, which affects some wrlinux use cases. There's a few minor cleanup bits here, such as a function with inconsistent calling conventions, but nothing really exciting.
2010-12-07This is a merge of several commits from a tree which turned out toPeter Seebach1-7/+3
be out of sync in a very inconvenient way. Changes include: * Some whitespace fixes, also move the pseudo_variables definition into pseudo_util.c since it's not used anywhere else. * Further improvements in the fork() support: We now recognize both positive and negative forms of PSEUDO_DISABLED, so we can distinguish between "it was removed from the environment by env -i" (restore the old value) and "it was intentionally turned off" (the new value wins). * clone(2) support. This is a little primitive, and programs might still fail horribly due to clone's semantics, but at least it's there and passes easy test cases. Plus a big patch from Mark Hatle: Cleanup fork/clone and PSEUDO_DISABLED guts/fork.c: * cleanup function and make it more robust * be sure to call pseudo_setupenv prior to pseudo_client_reset to match exec behavior pseudo_wrappers.c: * fix mismatched type in execl_to_v call via typecast * Simplify fork call via single call to wrap_fork() * be sure to save pseudo_disabled * be sure to call pseudo_setupenv prior to pseudo_client_reset to match exec behavior tests: * Add a test of whether pseudo can be disabled/enabled on a fork. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2010-11-18Messing with makewrappers: Move templating code out (for planned usePeter Seebach1-102/+4
in an incoming "maketables".)
2010-10-25Clean up makewrappers a bit.Peter Seebach1-87/+134
2010-10-12Remove tabs from makewrappers.Peter Seebach1-221/+221
2010-10-12Was missing copyright in new makewrappers.Peter Seebach1-0/+16
2010-10-11Major change: Replace the shell-based makewrappers with a PythonPeter Seebach1-463/+451
one. There's a long story here, but to abbreviate it: The shell script was annoying at best to maintain and starting to show signs of not really being the right tool for the job. For various reasons, we have some other Python stuff in our build system, so we picked Python as the language we were already using for other stuff. We think this works with anything reasonably recent (around Python 2.4 through 2.6). There's a little bit of cleanup, also, of the wrapper templates.
2010-08-26Almost had it! The problem is that because the save ofseebs1-2/+2
pseudo_saved_sigmask occurred outside of the check against antimagic, calls to wrapped functions made by the internals of a wrapper resulted on overwriting pseudo_saved_sigmask, so we restored the already-blocked sigmask. This could result in programs getting their sigmask permanently changed to block various signals, most crucially SIGCHLD. We now stash the value immediately before calling a wrapper, and never stash it if we're not calling a wrapper. Now the anti-magic stuff happening inside wrappers isn't trashing the signal mask. YAY!
2010-08-25Initial attempt at fixing problems with SIGCHLD being blockedseebs1-1/+3
in processes started under pseudo.
2010-08-11Enable execl, execle, execlp, execv, and execvp wrappersMark Hatle1-6/+41
We wrap all of the execs so that we can ensure the environment is properly configured prior to the exec running. handle ... for the new execl* wrappers Add a test for the new execl* ... handling.
2010-04-30Miscellaneous cleanup.Peter Seebach1-4/+6
Address a couple of compiler warnings, add a couple of signals to the list of caught signals, etcetera.
2010-04-26Avoid signalling during mutex operations.Peter Seebach1-0/+14
remake(1) can try to close a file from a signal handler. Since any entrance to a pseudo-emulated function requires the mutex, this can result in a deadlock. Solution: Suspend SIGCHLD (and a couple of other signals likely to result in filesystem operations) for the duration of the lock.
2010-04-26Reduce race condition for unlinks.Peter Seebach1-0/+1
If multiple clients are active at once, the following could occur: * Client #1 unlinks file A * Client #2 creates file B, which reuses A's inode * Client #2 sends request to server * Client #1 sends request to server * Processing client #2's request creates a mismatch warning for file A/B. * Processing client #1's request creates a mismatch warning too. Note that this can happen even if Client #2 sends its request later, as there's no intrinsic guarantee of the order in which requests are processed; any SINGLE client is presumably executing operations in order, but multiple clients aren't. Fixing this in rmdir, unlink, and rename.
2010-04-05Shuffle some code around.Peter Seebach1-153/+6
Migrate the stable part of the wrapper code (not machine-generated) out of makewrappers, to make it easier to maintain.
2010-03-30Fix copyright information.Peter Seebach1-0/+6
Corporate policy is that each module should have a copyright notice.
2010-03-29Add password/group call emulation.Peter Seebach1-24/+54
This is a first pass at handling password/group calls, allowing the use of custom password/group files. In particular, when chroot()ed to a particular directory, pseudo picks files in that directory by default, to improve support for the typical use case where pseudo uses chroot() only to jump into a virtual target filesystem.
2010-03-26Updates: Enable additional warnings, fix a number of things.Peter Seebach1-1/+5
None of them seem to have been genuine problems, but it's prettier now, and some were questionable.
2010-03-24Prep for chroot handling:Peter Seebach1-12/+99
* Improve makewrappers handling of function pointer arguments. * Regenerate wrappers when makewrappers is touched. * Move path resolution from pseudo_client_op into wrapper functions. * Eliminate dependency on PATH_MAX. * Related cleanup, such as tracking CWD better, and using the tracked value for getcwd().
2010-03-16initial public releasePeter Seebach1-0/+429