X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Freadahead%2Fsd-readahead.c;h=4a096eed427779c3b326c3bef08daa903d5dc419;hb=29f6aadd5302320d5a7a3868b607eb83687bdfd0;hp=c5cfe6710732c900a459510fd937aefca26ec44e;hpb=e5e83e8362e946890ac991fc86a2c5869f9befdf;p=elogind.git diff --git a/src/readahead/sd-readahead.c b/src/readahead/sd-readahead.c index c5cfe6710..4a096eed4 100644 --- a/src/readahead/sd-readahead.c +++ b/src/readahead/sd-readahead.c @@ -25,7 +25,7 @@ ***/ #ifndef _GNU_SOURCE -#define _GNU_SOURCE +# define _GNU_SOURCE #endif #include @@ -37,6 +37,18 @@ #include "sd-readahead.h" +#if (__GNUC__ >= 4) +# ifdef SD_EXPORT_SYMBOLS +/* Export symbols */ +# define _sd_export_ __attribute__ ((visibility("default"))) +# else +/* Don't export the symbols */ +# define _sd_export_ __attribute__ ((visibility("hidden"))) +# endif +#else +# define _sd_export_ +#endif + static int touch(const char *path) { #if !defined(DISABLE_SYSTEMD) && defined(__linux__) @@ -45,7 +57,8 @@ static int touch(const char *path) { mkdir("/run/systemd", 0755); mkdir("/run/systemd/readahead", 0755); - if ((fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, 0666)) < 0) + fd = open(path, O_WRONLY|O_CREAT|O_CLOEXEC|O_NOCTTY, 0666); + if (fd < 0) return -errno; for (;;) { @@ -60,7 +73,7 @@ static int touch(const char *path) { return 0; } -int sd_readahead(const char *action) { +_sd_export_ int sd_readahead(const char *action) { if (!action) return -EINVAL;