diff options
| author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-08-30 16:19:30 +0200 |
|---|---|---|
| committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-08-30 16:19:30 +0200 |
| commit | a47bf12e211ba9fb3ec0bb86320e3150f9335282 (patch) | |
| tree | 3b80ac6716fe3394e56a5570ce08cf39bbc82762 | |
| parent | daeb21ab2819d1581979311faa87c45e17dacd03 (diff) | |
| download | abrt-a47bf12e211ba9fb3ec0bb86320e3150f9335282.tar.gz abrt-a47bf12e211ba9fb3ec0bb86320e3150f9335282.tar.xz abrt-a47bf12e211ba9fb3ec0bb86320e3150f9335282.zip | |
abrtlib.h: move move functions from C++ section to C
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
| -rw-r--r-- | inc/abrtlib.h | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/inc/abrtlib.h b/inc/abrtlib.h index 8f55c673..c574834f 100644 --- a/inc/abrtlib.h +++ b/inc/abrtlib.h @@ -46,6 +46,12 @@ # include <config.h> #endif +#if ENABLE_NLS +# include <libintl.h> +# define _(S) gettext(S) +#else +# define _(S) (S) +#endif /* Some libc's forget to declare these, do it ourself */ extern char **environ; @@ -53,38 +59,33 @@ extern char **environ; int vdprintf(int d, const char *format, va_list ap); #endif +#undef NORETURN #define NORETURN __attribute__ ((noreturn)) #undef ARRAY_SIZE #define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0]))) -#if ENABLE_NLS -# include <libintl.h> -# define _(S) gettext(S) -#else -# define _(S) (S) -#endif - - #include "abrt_types.h" #include "xfuncs.h" #include "logging.h" #include "read_write.h" -/* copyfd_XX print read/write errors and return -1 if they occur */ -enum { - COPYFD_SPARSE = 1 << 0, -}; #ifdef __cplusplus extern "C" { #endif + int prefixcmp(const char *str, const char *prefix); int suffixcmp(const char *str, const char *suffix); char *concat_path_file(const char *path, const char *filename); char *append_to_malloced_string(char *mstr, const char *append); char* skip_whitespace(const char *s); char* skip_non_whitespace(const char *s); + +/* On error, copyfd_XX prints error messages and returns -1 */ +enum { + COPYFD_SPARSE = 1 << 0, +}; off_t copyfd_eof(int src_fd, int dst_fd, int flags); off_t copyfd_size(int src_fd, int dst_fd, off_t size, int flags); void copyfd_exact_size(int src_fd, int dst_fd, off_t size); @@ -93,16 +94,6 @@ off_t copy_file(const char *src_name, const char *dst_name, int mode); /* Returns malloc'ed block */ char *encode_base64(const void *src, int length); -/* Returns command line of running program. - * Caller is responsible to free() the returned value. - * If the pid is not valid or command line can not be obtained, - * empty string is returned. - */ -char* get_cmdline(pid_t pid); - -/* Returns 1 if abrtd daemon is running, 0 otherwise. */ -int daemon_is_ok(); - unsigned xatou(const char *numstr); int xatoi(const char *numstr); /* Using xatoi() instead of naive atoi() is not always convenient - @@ -111,6 +102,10 @@ int xatoi(const char *numstr); * dies if input is not in [0, INT_MAX] range. Also will reject '-0' etc */ int xatoi_u(const char *numstr); +unsigned long long monotonic_ns(void); +unsigned long long monotonic_us(void); +unsigned monotonic_sec(void); + enum { EXECFLG_INPUT = 1 << 0, EXECFLG_OUTPUT = 1 << 1, @@ -135,16 +130,8 @@ char *run_in_shell_and_save_output(int flags, const char *cmd, const char *dir, size_t *size_p); -#ifdef __cplusplus -} -#endif - -unsigned long long monotonic_ns(void); -unsigned long long monotonic_us(void); -unsigned monotonic_sec(void); - -/* networking helpers */ +/* Networking helpers */ typedef struct len_and_sockaddr { socklen_t len; union { @@ -183,9 +170,23 @@ char* xmalloc_sockaddr2hostonly_noport(const struct sockaddr *sa); char* xmalloc_sockaddr2dotted(const struct sockaddr *sa); char* xmalloc_sockaddr2dotted_noport(const struct sockaddr *sa); - /* Random utility functions */ +/* Returns command line of running program. + * Caller is responsible to free() the returned value. + * If the pid is not valid or command line can not be obtained, + * empty string is returned. + */ +char* get_cmdline(pid_t pid); + +/* Returns 1 if abrtd daemon is running, 0 otherwise. */ +int daemon_is_ok(); + +#ifdef __cplusplus +} +#endif + + /* C++ style stuff */ #ifdef __cplusplus double get_dirsize(const char *pPath); |
