* Use real functions in dummy mode

* Rename header files to correspond to code files
pull/7/head
Anton Smirnov 4 years ago
parent 47a388c827
commit e61ccc61ba

@ -0,0 +1,9 @@
#include "journald_native.h"
#ifdef JOURNALD_NATIVE_COMPILE_DUMMY
int sd_journal_print(int priority, const char *format, ...) { return 0; }
int sd_journal_sendv(const iovec_t *iov, int n) { return 0; }
int sd_journal_perror(const char *message) { return 0; }
#endif

@ -19,6 +19,11 @@
/* dummy code to be used in sd_journal.h on non-linux system */
#ifdef JOURNALD_NATIVE_COMPILE_DUMMY
#ifndef JOURNALD_NATIVE_JOURNALD_DUMMY_H
#define JOURNALD_NATIVE_JOURNALD_DUMMY_H
#include <stdlib.h>
#ifndef LOG_EMERG
@ -41,6 +46,9 @@ struct jdn_dummy_iovec {
size_t iov_len; /* Number of bytes to transfer */
};
inline int sd_journal_print(int priority, const char *format, ...) { return 0; }
inline int sd_journal_sendv(const iovec_t *iov, int n) { return 0; }
inline int sd_journal_perror(const char *message) { return 0; }
int sd_journal_print(int priority, const char *format, ...);
int sd_journal_sendv(const iovec_t *iov, int n);
int sd_journal_perror(const char *message);
#endif
#endif

@ -18,7 +18,7 @@
*/
#include <ruby.h>
#include "sd_journal.h"
#include "journald_native.h"
void Init_journald_native();

@ -17,10 +17,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdbool.h>
#ifndef JOURNALD_NATIVE_JOURNALD_NATIVE_H
#ifndef JOURNALD_NATIVE_SD_JOURNAL_H
#define JOURNALD_NATIVE_SD_JOURNAL_H
#include <stdbool.h>
#define JOURNALD_NATIVE_JOURNALD_NATIVE_H
#ifdef __linux__
@ -59,10 +60,11 @@
#else
#define JOURNALD_NATIVE_SD_JOURNAL_DUMMY true
#define JOURNALD_NATIVE_COMPILE_DUMMY
#warning Compiling dummy version of the gem for non-Linux OS
#include "sd_journal_dummy.h"
#include "journald_dummy.h"
#endif
Loading…
Cancel
Save