diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-04-13 10:07:46 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-04-13 10:55:49 +0300 |
commit | a9d38e5de5cceb667bec3db15fed68f7e8d96a8b (patch) | |
tree | 3dae7f0670f5308b321cf84b5fd9501e98f5a9ba /src/wydawca.h | |
parent | a9da878ff22f980cea3bf3102113d7f2e65f61e9 (diff) | |
download | wydawca-a9d38e5de5cceb667bec3db15fed68f7e8d96a8b.tar.gz wydawca-a9d38e5de5cceb667bec3db15fed68f7e8d96a8b.tar.bz2 |
Fix triplet processing in daemon mode.
* src/watcher.c (fopenat_ro): New function.
* src/verify.c (fill_project_name): Use fopenat_ro.
* src/gpg.c (recursive_rmdir): return silently if the directory
does not exist.
(verify_directive_signature): Use fopenat_ro.
* src/job.c: Change state definitions from bitmask to enum.
* src/triplet.c (triplet_processor): A pointer to the spool is passed
in proc_data. Process only triplets with this spool.
(triplet_processor): Modify accordingly.
Facilitate writing tests for daemon mode.
* src/wydawca.c (cron_option,daemon_mode): Remove.
(wy_mode, wy_mode_option): New variables.
(main): Use wy_mode to determine operating mode.
* src/wydawca.h (daemon_mode): Remove extern.
(wy_mode): New extern.
* src/cmdline.opt: New option --daemon.
* src/config.c: Change handling of the "daemon" statement.
* src/net.c: Test hook: if WYDAWCA_NOTIFY_PARENT=1 send SIGUSR1
to parent after setting up the listener.
* doc/wydawca.texi: Describe the --daemon option.
Testsuite:
1. Place source and destination directories in the working directory
for each particular test. Thus the spool cleanup function becomes
unnecessary.
2. Add tests for wydawca daemon mode (inotify).
* configure.ac (WY_INOTIFY): New substitution variable for use in
testsuite.
* tests/wyasync.c: New source. Auxiliary program to test wydawca
daemon mode.
* tests/wyinit.c: New source. Extract source and destination directory
names from the wydawca configuration file and create missing directories.
* tests/Makefile.am: Build wyasync and wyinit.
(TESTSUITE_AT): Add inotify-ok.at
* tests/atlocal.in (WY_INOTIFY): New variable.
(wydawca_init_testdirs): Remove.
(wydawca_clean_testdirs): Remove.
(wydawca_config): Call wyinit to initialize spools and
destinatiuon directories.
(wydawca_upload): Change source directory.
* tests/etc/mailstats.cfin: Put mail.out in CWD.
* tests/etc/notify.cfin: Likewise.
* tests/etc/wydawca.cfin: Add pidfile statement in case wydawca
is run as daemon.
Place all source and destination directories in CWD.
* tests/testsuite.at (AT_WYDAWCA_DAEMON): New macro.
* tests/inotify-ok.at: New test.
* tests/check-fail.at: Update.
* tests/check-notify.at: Update.
* tests/check-ok.at: Update.
* tests/mailstats.at: Update.
* tests/notify-upl.at: Update.
* tests/upl11.at: Update.
* tests/upl12f.at: Update.
* tests/upl12t.at: Update.
* tests/upload-dry.at: Update.
* tests/upload.at: Update.
Diffstat (limited to 'src/wydawca.h')
-rw-r--r-- | src/wydawca.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/wydawca.h b/src/wydawca.h index c2ae2de..fd0bbfb 100644 --- a/src/wydawca.h +++ b/src/wydawca.h @@ -334,7 +334,13 @@ extern time_t lock_expire_time; extern time_t lock_timeout; extern int enable_locking; -extern int daemon_mode; +enum { + WY_MODE_NORMAL, + WY_MODE_CRON, + WY_MODE_DAEMON, +}; +extern int wy_mode; + extern time_t wakeup_interval; extern int foreground; extern int single_process; @@ -601,3 +607,5 @@ int watcher_run(int); #endif int wy_stat_expansion(char **ret, char const *name, size_t len); +FILE *fopenat_ro(int dirfd, char const *name); + |