|
42 | 42 | #include "utils_random.h" |
43 | 43 | #include "utils_time.h" |
44 | 44 |
|
| 45 | +#ifdef WIN32 |
| 46 | +#include <sys/stat.h> |
| 47 | +#include <unistd.h> |
| 48 | +#endif |
| 49 | + |
45 | 50 | #if HAVE_PTHREAD_NP_H |
46 | 51 | #include <pthread_np.h> /* for pthread_set_name_np(3) */ |
47 | 52 | #endif |
@@ -637,7 +642,7 @@ static void start_read_threads(size_t num) /* {{{ */ |
637 | 642 | } |
638 | 643 |
|
639 | 644 | char name[THREAD_NAME_MAX]; |
640 | | - snprintf(name, sizeof(name), "reader#%" PRIsz, read_threads_num); |
| 645 | + snprintf(name, sizeof(name), "reader#%" PRIu64, (uint64_t)read_threads_num); |
641 | 646 | set_thread_name(read_threads[read_threads_num], name); |
642 | 647 |
|
643 | 648 | read_threads_num++; |
@@ -843,7 +848,7 @@ static void start_write_threads(size_t num) /* {{{ */ |
843 | 848 | } |
844 | 849 |
|
845 | 850 | char name[THREAD_NAME_MAX]; |
846 | | - snprintf(name, sizeof(name), "writer#%" PRIsz, write_threads_num); |
| 851 | + snprintf(name, sizeof(name), "writer#%" PRIu64, (uint64_t)write_threads_num); |
847 | 852 | set_thread_name(write_threads[write_threads_num], name); |
848 | 853 |
|
849 | 854 | write_threads_num++; |
@@ -954,6 +959,11 @@ static void plugin_free_loaded(void) { |
954 | 959 | } |
955 | 960 |
|
956 | 961 | #define BUFSIZE 512 |
| 962 | +#ifdef WIN32 |
| 963 | +# define SHLIB_SUFFIX ".dll" |
| 964 | +#else |
| 965 | +# define SHLIB_SUFFIX ".so" |
| 966 | +#endif |
957 | 967 | int plugin_load(char const *plugin_name, _Bool global) { |
958 | 968 | DIR *dh; |
959 | 969 | const char *dir; |
@@ -990,11 +1000,11 @@ int plugin_load(char const *plugin_name, _Bool global) { |
990 | 1000 | (strcasecmp("python", plugin_name) == 0)) |
991 | 1001 | global = 1; |
992 | 1002 |
|
993 | | - /* `cpu' should not match `cpufreq'. To solve this we add `.so' to the |
| 1003 | + /* `cpu' should not match `cpufreq'. To solve this we add SHLIB_SUFFIX to the |
994 | 1004 | * type when matching the filename */ |
995 | | - status = snprintf(typename, sizeof(typename), "%s.so", plugin_name); |
| 1005 | + status = snprintf(typename, sizeof(typename), "%s" SHLIB_SUFFIX, plugin_name); |
996 | 1006 | if ((status < 0) || ((size_t)status >= sizeof(typename))) { |
997 | | - WARNING("plugin_load: Filename too long: \"%s.so\"", plugin_name); |
| 1007 | + WARNING("plugin_load: Filename too long: \"%s" SHLIB_SUFFIX "\"", plugin_name); |
998 | 1008 | return -1; |
999 | 1009 | } |
1000 | 1010 |
|
|
0 commit comments