Age | Commit message (Collapse) | Author |
|
This adds SPDX license headers to all source files in pseudo so license
identification models current best practise.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
|
|
Original commit message:
The idea came up here:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=11309
and here:
http://lists.openembedded.org/pipermail/openembedded-core/2017-August/141491.html
Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
I've adapted this to make epoll a configure-time option; you must
use --enable-epoll to get the new behavior. I've also confirmed that
it builds both ways and appears to run, and restored the SIGUSR2
functionality (except for the state check) for the epoll case.
Signed-off-by: Seebs <seebs@seebs.net>
|
|
Currently, the Makefile rebuilds the binary at every invokation of
the command make:
$ make
cc -pipe -std=gnu99 -Wall -W -Wextra -fPIC
-D_LARGEFILE64_SOURCE -D_ATFILE_SOURCE -m64
-DPSEUDO_PREFIX='"/opt"' -DPSEUDO_SUFFIX='""'
-DPSEUDO_BINDIR='"bin"' -DPSEUDO_LIBDIR='"lib64"'
-DPSEUDO_LOCALSTATEDIR='"var/pseudo"' -DPSEUDO_VERSION='"1.8.1"'
-DUSE_MEMORY_DB -DPSEUDO_PASSWD_FALLBACK='""'
-DPSEUDO_XATTR_SUPPORT -O2 -g -o bin/pseudo \ pseudo.o
pseudo_server.o pseudo_client.o pseudo_ipc.o \ pseudo_db.o
pseudo_tables.o pseudo_util.o -lsqlite3 -lpthread -ldl
-lpthread cc -pipe -std=gnu99 -Wall -W -Wextra -fPIC
-D_LARGEFILE64_SOURCE -D_ATFILE_SOURCE -m64
-DPSEUDO_PREFIX='"/opt"' -DPSEUDO_SUFFIX='""'
-DPSEUDO_BINDIR='"bin"' -DPSEUDO_LIBDIR='"lib64"'
-DPSEUDO_LOCALSTATEDIR='"var/pseudo"' -DPSEUDO_VERSION='"1.8.1"'
-DUSE_MEMORY_DB -DPSEUDO_PASSWD_FALLBACK='""'
-DPSEUDO_XATTR_SUPPORT -O2 -g -o bin/pseudodb pseudodb.o \
pseudo_db.o pseudo_tables.o pseudo_util.o pseudo_ipc.o -lsqlite3
-lpthread -ldl -lpthread
The fault comes from the $(BIN) directory prerequesite.
According to the documention of GNU make(*), directory prerequesites
normally go to <order-only-prerequisites>:
targets: normal-prerequisites | order-only-prerequisites
> Consider an example where your targets are to be placed in a separate
> directory, and that directory might not exist before make is run. In
> this situation, you want the directory to be created before any
> targets are placed into it but, because the timestamps on directories
> change whenever a file is added, removed, or renamed, we certainly
> don’t want to rebuild all the targets whenever the directory’s
> timestamp changes. One way to manage this is with order-only
> prerequisites: make the directory an order-only prerequisite on all
> the targets.
>
> OBJDIR := objdir
> OBJS := $(addprefix $(OBJDIR)/,foo.o bar.o baz.o)
>
> $(OBJDIR)/%.o : %.c
> $(COMPILE.c) $(OUTPUT_OPTION) $<
>
> all: $(OBJS)
>
> $(OBJS): | $(OBJDIR)
>
> $(OBJDIR):
> mkdir $(OBJDIR)
>
> Now the rule to create the objdir directory will be run, if needed,
> before any ‘.o’ is built, but no ‘.o’ will be built because the
> objdir directory timestamp changed.
This patch fixes this behavior. No binaries are rebuilt when the command
make is re-run:
$ make
make: Nothing to be done for 'all'.
*: https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html
Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com>
Signed-off-by: Seebs <seebs@seebs.net>
|
|
|
|
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
These changes are enough to justify a .1 upgrade.
|
|
Respect environment-set $(LDFLAGS).
Fix provided by kergoth, I'm just merging it.
|
|
Recent fixes mostly to do with race conditions on server respawn, also
some xattr tweaks.
|
|
The f{re,}open{64,} functions use a default mode of 0666 & ~umask,
and defaulting to 0600 for the post-open chmod was breaking some use
cases. Problem and solution identified by Ross Burton, I just made the
local copy of the patch.
Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
|
|
So fchmodat(..., AT_SYMLINK_NOFOLLOW) isn't valid, and could
result in mkdirat/mkfifoat setting errno on success, which is
mostly harmless except for one or two programs which consider
a non-zero errno to be proof of failure.
Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
|
|
And another branch, for 1.7.2, because I think that'll be the last of it.
Hah.
Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
|
|
Two little bug fixes.
Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
|
|
This is a moderately experimental feature which stores values in an
extended attribute called 'user.pseudo_data' instead of in the database.
Still missing: Database<->filesystem synchronization for this.
For at least some workloads, this can dramatically improve performance.
Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
|
|
A partially-implemented profiler for client time, which basically just
inserts (optional) gettimeofday calls in various places and stashes data
in a flat file containing one data block per pid.
Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
|
|
Worked for trivial cases, but spuriously closed fd 0 and had
other issues. Separated implementations out.
|
|
|
|
There was supposed to be a check for filenames showing up
with a trailing slash when the file was not a directory. What
actually made it in was a check for a mismatch between "is
a directory" and "has trailing slash", which produced spurious
messages saying the path had a trailing slash whenever a
directory path did *not* have a trailing slash. But that's
valid and should not produce diagnostics. Let alone thousands
of diagnostics.
Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
|
|
|
|
|
|
|
|
|
|
The sqlite flags don't need to be present if they don't have
meaningful values. I think.
|
|
Turns out the checks for feature support were using plain cc,
not ${CC}, which could break tests. Also add a sanity check to the
xattr support to confirm that <attr/xattr.h> is available.
Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
|
|
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>
|
|
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>
|
|
|
|
In some cases, we'd rather pseudo fail than fall back to using
/etc/passwd or /etc/group. Make the determination of what to fall
back to when neither PSEUDO_PASSWD nor a chroot directory contains
passwd/group files controllable by a configure-time flag, controlled
by --with-passwd-fallback= or --without-passwd-fallback.
|
|
This is a moderately intrusive change. The basic overall effect:
Debugging messages are now controlled, not by a numeric "level",
but by a series of flags, which are expressed as a string of
letters. Each flag has a single-letter form used for string
specifications, a name, a description, a numeric value (1 through N),
and a flag value (which is 1 << the numeric value). (This does mean
that no flag has the value 1, so we only have 31 bits available.
Tiny violins play.)
The other significant change is that the pseudo_debug calls
are now implemented with a do/while macro containing a conditional,
so that computationally-expensive arguments are never evaluated
if the corresponding debug flags weren't set. The assumption is
that in the vast majority of cases (specifically, all of them
so far) the debug flags for a given call are a compile-time constant,
so the nested conditional will never actually show up in code
when compiled with optimization; we'll just see the appropriate
conditional test.
The VERBOSE flag is magical, in that if the VERBOSE flag is
used in a message, the debug flags have to have both VERBOSE and
at least one other flag for the call to be made.
This should dramatically improve performance for a lot of cases
without as much need for PSEUDO_NDEBUG, and improve the ability of
users to get coherent debugging output that means something and is
relevant to a given case.
It's also intended to set the stage for future development work
involving improving the clarity and legibility of pseudo's diagnostic
messages in general.
Old things which used numeric values for PSEUDO_DEBUG will sort
of continue to work, though they will almost always be less verbose
than they used to. There should probably be a pass through adding
"| PDBGF_CONSISTENCY" to a lot of the messages that are specific
to some other type.
|
|
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>
|
|
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.
|
|
It turns out that file databases don't get very large, and that
sqlite3 can be quite fast with an in-memory database. It also turns
out that dumping the database to disk on exit (or during idle times)
is pretty cheap compared to constant updates.
So: We add "--enable-memory-db", which defaults to on if you have
sqlite 3.7 or later, and off for 3.6 (because 3.6 has horrible
performance with in-memory db on some hosts we tried).
|
|
wrap_linkat() was trying to avoid "redundantly" expanding paths before
calling real_linkat(). Which is fine when you're not using an absolute
path in a chroot environment, but if you are, it ends up calling the
real syscall with the absolute path and no chroot prefix.
General observation: All the *at() implementations are expanding paths
into absolute paths, then dutifully calling real_*at() functions with
them anyway. This is silly. Added a note to Futures.txt to fix it some
day. In the mean time, linkat() is fixed correctly; it always expands
paths, does so exactly once, and then uses the underlying link()
call because it doesn't need special processing of directory fds
anymore. Also fixed errno stashing to reduce the risk that link()
will change errno in a circumstance where it doesn't actually fail.
|
|
The automatic path fixups invoked for names which end in the string
"path" was still applying to link(), which then called linkat(),
which would do the same path fixups; if you were chrooted, this would
produce bogus paths. On systems which actually have linkat(), this
would produce the even more mysterious behavior that the link would
succeed, but the following stat would fail.
Solution: Change the wrapfuncs prototypes for link() so it doesn't
invoke automatic path name fixups.
|
|
Fixed up the libdir stuff in a saner way, fixed the @GLIBC_2.7 thing,
want to avoid any risk of someone having a stale archive.
|
|
There's a few circumstances where sqlite's libdir isn't the same as
the directory name we want to use for libpseudo.so, so make it a
separate setting. This may obviate the need for --with-static-sqlite.
Signed-off-by: seebs <peter.seebach@windriver.com>
|
|
|
|
It turns out that the -L usage mostly doesn't matter (usually something
else has requested the right directory, or it's the default), but the
explicit path to libsqlite3.a hardcoded "lib", and on some systems
it should be something else, such as "lib64". Solution: Use $(LIB) for
that directory.
Note that this may not resolve things if, say, you're doing MIPS n32 on a
target where that lives in /usr/lib32, but I think in that case you'd
be specifying $libdir, so it should still work out.
Also added --with-static-sqlite=/path as an option in case people need
to further outsmart this.
Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
|
|
The _plain thing was added because of clashes between Linux
("struct stat64 for 64-bit file sizes") and Darwin ("struct stat
is already 64 bits"). But it turns out not to be enough,
because stat will *fail* if it cannot represent a file size,
so when something like unlinkat() calls a non-64-bit stat in
order to determine whether a file exists, it gets the wrong
answer if the file is over 2GB in size.
Solution: Continue using PSEUDO_STATBUF, and also provide
defines for base_stat() which can be either real_stat() or
real_stat64(), etcetera.
This eliminates any reason to need the _plain functions. It
also suggests that the other real___fxstatat() calls should
someday go away because that is an ugly, ugly, implementation
detail.
As part of testing this, fix up some bitrot which affected
Darwin (such as the continue outside of a loop, but inside
an #ifdef; that was left over from the conversion of
init_one_wrapper to a separate function).
|
|
Instead of using .tgz, use .tar.bz2 (and change czf to cjf). This makes
life easier for Yocto.
|
|
|
|
Pseudo should never have been the one picking -m32/-m64. That should be
coming from the build system in some way. Deprecate --arch, add --cflags.
|
|
Enough changes to justify a tag.
|
|
Long story short: ARM doesn't use -m32 and -m64, so make those
a little more dependent. We'll probably rework this completely "soon"
as we mess with more targets and x32 becomes an issue.
|
|
|
|
Some systems prefer to avoid messing with LD_LIBRARY_PATH as much,
and instead link sqlite statically.
|
|
In OE-Core we need to be able to configure for both 32-bit and 64-bit
libpseudo libraries. In order to avoid some complex manipulations,
we adjust the configure and Makefile to facilitate this.
Upstream-Status: Submitted
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
|
|
|
|
|
|
|