From 45201a4c724923aae01ed891be9e125b229ad189 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Thu, 9 Feb 2012 23:16:51 +0100 Subject: [PATCH] Moved process-related functions to ucw/process.h --- ucw/Makefile | 5 +++-- ucw/exitstatus.c | 1 + ucw/lib.h | 20 -------------------- ucw/mainloop.c | 1 + ucw/mainloop.h | 1 + ucw/process.h | 33 +++++++++++++++++++++++++++++++++ ucw/proctitle.c | 1 + ucw/runcmd.c | 1 + ucw/shell/logoutput.c | 1 + 9 files changed, 42 insertions(+), 22 deletions(-) create mode 100644 ucw/process.h diff --git a/ucw/Makefile b/ucw/Makefile index d33b01fb..77c5a08f 100644 --- a/ucw/Makefile +++ b/ucw/Makefile @@ -12,7 +12,7 @@ LIBUCW_MODS= \ alloc alloc_str realloc bigalloc mempool mempool-str mempool-fmt eltpool \ partmap hashfunc \ slists simple-lists bitsig \ - log log-stream log-file log-syslog log-conf proctitle tbf \ + log log-stream log-file log-syslog log-conf tbf \ conf-alloc conf-dump conf-input conf-intr conf-journal conf-parse conf-section \ ipaccess \ fastbuf ff-binary ff-string ff-printf ff-unicode ff-stkstring \ @@ -23,7 +23,7 @@ LIBUCW_MODS= \ bit-ffs bit-fls \ url \ mainloop main-block main-rec \ - exitstatus runcmd sighandler \ + proctitle exitstatus runcmd sighandler \ lizard lizard-safe adler32 \ md5 sha1 sha1-hmac \ base64 base224 \ @@ -51,6 +51,7 @@ LIBUCW_MAIN_INCLUDES= \ fastbuf.h io.h ff-unicode.h ff-binary.h \ url.h \ mainloop.h \ + process.h \ lizard.h \ md5.h sha1.h \ base64.h base224.h \ diff --git a/ucw/exitstatus.c b/ucw/exitstatus.c index 4c04d49c..1d7b70a4 100644 --- a/ucw/exitstatus.c +++ b/ucw/exitstatus.c @@ -8,6 +8,7 @@ */ #include "ucw/lib.h" +#include "ucw/process.h" #include #include diff --git a/ucw/lib.h b/ucw/lib.h index 2b76b7a3..29c2d236 100644 --- a/ucw/lib.h +++ b/ucw/lib.h @@ -181,26 +181,6 @@ uns random_max(uns max); /** Return a pseudorandom 32-bit number in range [0,@ u64 random_u64(void); /** Return a pseudorandom 64-bit number. **/ u64 random_max_u64(u64 max); /** Return a pseudorandom 64-bit number in range [0,@max). **/ -/* proctitle.c */ - -void setproctitle_init(int argc, char **argv); -void setproctitle(const char *msg, ...) FORMAT_CHECK(printf,1,2); -char *getproctitle(void); - -/* exitstatus.c */ - -#define EXIT_STATUS_MSG_SIZE 32 -int format_exit_status(char *msg, int stat); - -/* runcmd.c */ - -int run_command(const char *cmd, ...); -void NONRET exec_command(const char *cmd, ...); -void echo_command(char *buf, int size, const char *cmd, ...); -int run_command_v(const char *cmd, va_list args); -void NONRET exec_command_v(const char *cmd, va_list args); -void echo_command_v(char *buf, int size, const char *cmd, va_list args); - /* sighandler.c */ typedef int (*ucw_sighandler_t)(int); // gets signum, returns nonzero if abort() should be called diff --git a/ucw/mainloop.c b/ucw/mainloop.c index 23eed5e1..3c9dc623 100644 --- a/ucw/mainloop.c +++ b/ucw/mainloop.c @@ -14,6 +14,7 @@ #include "ucw/mainloop.h" #include "ucw/threads.h" #include "ucw/gary.h" +#include "ucw/process.h" #include #include diff --git a/ucw/mainloop.h b/ucw/mainloop.h index 0a4a8bbf..336439be 100644 --- a/ucw/mainloop.h +++ b/ucw/mainloop.h @@ -11,6 +11,7 @@ #define _UCW_MAINLOOP_H #include "ucw/clists.h" +#include "ucw/process.h" #include diff --git a/ucw/process.h b/ucw/process.h new file mode 100644 index 00000000..1bbeedac --- /dev/null +++ b/ucw/process.h @@ -0,0 +1,33 @@ +/* + * UCW Library -- Processes + * + * (c) 2012 Martin Mares + * + * This software may be freely distributed and used according to the terms + * of the GNU Lesser General Public License. + */ + +#ifndef _UCW_PROCESS_H +#define _UCW_PROCESS_H + +/* proctitle.c */ + +void setproctitle_init(int argc, char **argv); +void setproctitle(const char *msg, ...) FORMAT_CHECK(printf,1,2); +char *getproctitle(void); + +/* exitstatus.c */ + +#define EXIT_STATUS_MSG_SIZE 32 +int format_exit_status(char *msg, int stat); + +/* runcmd.c */ + +int run_command(const char *cmd, ...); +void NONRET exec_command(const char *cmd, ...); +void echo_command(char *buf, int size, const char *cmd, ...); +int run_command_v(const char *cmd, va_list args); +void NONRET exec_command_v(const char *cmd, va_list args); +void echo_command_v(char *buf, int size, const char *cmd, va_list args); + +#endif /* !_UCW_PROCESS_H */ diff --git a/ucw/proctitle.c b/ucw/proctitle.c index c1f8ff78..1862f0b5 100644 --- a/ucw/proctitle.c +++ b/ucw/proctitle.c @@ -8,6 +8,7 @@ */ #include "ucw/lib.h" +#include "ucw/process.h" #include #include diff --git a/ucw/runcmd.c b/ucw/runcmd.c index 9670187d..6f82d40e 100644 --- a/ucw/runcmd.c +++ b/ucw/runcmd.c @@ -8,6 +8,7 @@ */ #include "ucw/lib.h" +#include "ucw/process.h" #include #include diff --git a/ucw/shell/logoutput.c b/ucw/shell/logoutput.c index 3705ce4b..aa0c2f47 100644 --- a/ucw/shell/logoutput.c +++ b/ucw/shell/logoutput.c @@ -16,6 +16,7 @@ #include "ucw/clists.h" #include "ucw/getopt.h" #include "ucw/conf.h" +#include "ucw/process.h" #include #include -- 2.39.5