Re-organised all Java source code under the java-api subdirectory, which
also contains a Makefile.in that performs the Java compilation. This
makefile is only invoked if ./configure finds a working Java compiler.
Improves support for running make from a current working directory that
is not the repo root. Only the files that reside in the repo root are
prefixed with $(SOURCE_PREFIX); the files that are created by
./configure are in the current working directory.
The new 'cmd_cleanup' trigger replaces the old command_cleanup()
function, which was causing linking problems on OS X and inverted strict
dependency. The keyring cmd_cleanup calls keyring_free(global_keyring),
instead of merely asserting keyring == NULL, so the error exit cases of
many CLI functions have been simplified.
Adds a CLI and RESTful API operation for "keyring remove", with simple
test cases. Added the corresponding Java API operation. Updated the
API documentation.
API change: for consistency with RESTful API design, the GET
/restful/keyring/add operation now returns "201 Created" not "200 OK" if
successful.
Trigger names cannot exceed 11 characters on OS X, so the new "config_change" trigger
has been renamed to "conf_change" and the "config_change_log" trigger has been renamed
to "conf_log".
Renamed libservald.so to libservaldaemon.so everywhere to avoid conflicts
with the "servald" module name in Android.mk, and to avoid the overly
generic name "libserval".
Include the JNI entry points in the Android build.
If an exception was raised while executing a CLI command via JNI, then
a warning was logged while cleaning up: calling GetObjectArrayElement()
while an exception is pending. This fix removes that call.
swiftc(1) requires every -D option to be prefixed with -Xcc, which
is not easy to achieve using autoconf.
Now instead of setting configuration macros like HAVE_LSEEK64 on the
command line using -D, they are defined in config.h, which is generated
by ./configure, ignored by Git, and included by all headers and source
files that use any configuration macro.
The dependency on Makefile has been replaced with a dependency on
Makefile.in and config.h, which helps avoid some redundant full
recompiles after running ./configure, because the configure script
does not overwrit config.h if its content does not change.
Recent changes such as the Makefile.in overhaul and the introduction of
feature-driven linking broke the Android build. This commit fixes the
breakage:
- detects the presence of gettid() in configure.ac and only defines
gettid() in serval.c if HAVE_GETTID is not defined
- builds libserval.so not libservald.so on Android, to avoid a conflict
on the module name "servald" in Android.mk
- renames cli_cleanup() to command_cleanup(), defines it in
commandline.h instead of cli.h, and supplies it in android.c
- supplies the 'keyring' global in android.c
- removes log_stderr.c from the Android build, since it conflicted with
log.c
Very occasionally, when the file logger was creating the symlink from
'serval.log' to the current log file, there was a race with another
process doing exactly the same, causing one of them to log an
symlink-failed ERROR that caused the server/StartTwice test to fail
(when asserting that the "start" command contained no ERROR log
messages). Now the symlink failure is logged at WARN level, which will
not cause the test to fail.
During the brief interval between a server creating its pidfile and
locking it, the pidfile could be removed by another process that
detected it as stale. This caused a non-deterministic failure of the
server/StartTwice test case.
To fix this race, the server now creates and locks a temporary pidfile
which it then hard-links to the real pidfile, guaranteeing that the
pidfile is already locked in the instant that it appears. This means
that an unlocked pidfile is guaranteed to be stale, not just in the
process of creation, so can be safely unlinked by any other process.