diff options
author | Yossi Gottlieb <yossigo@gmail.com> | 2020-12-13 17:09:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-13 17:09:54 +0200 |
commit | 86e3395c117d9450d52ee3ebbc62c386d11f1b79 (patch) | |
tree | f01054125b9bf5db15095382a318c8f7d45804d6 /src/zmalloc.c | |
parent | f74c32cad27fcd078f7bb8517c87be178e7339eb (diff) | |
download | redis-86e3395c117d9450d52ee3ebbc62c386d11f1b79.tar.gz |
Several (mostly Solaris-related) cleanups (#8171)
* Allow runtest-moduleapi use a different 'make', for systems where GNU Make is 'gmake'.
* Fix issue with builds on Solaris re-building everything from scratch due to CFLAGS/LDFLAGS not stored.
* Fix compile failure on Solaris due to atomicvar and a bunch of warnings.
* Fix garbled log timestamps on Solaris.
Diffstat (limited to 'src/zmalloc.c')
-rw-r--r-- | src/zmalloc.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/zmalloc.c b/src/zmalloc.c index 2f9b4029d..86b15b0ee 100644 --- a/src/zmalloc.c +++ b/src/zmalloc.c @@ -31,6 +31,7 @@ #include <stdio.h> #include <stdlib.h> #include <stdint.h> +#include <unistd.h> /* This function provide us access to the original libc free(). This is useful * for instance to free results obtained by backtrace_symbols(). We need @@ -333,7 +334,6 @@ void zmalloc_set_oom_handler(void (*oom_handler)(size_t)) { * version of the function. */ #if defined(HAVE_PROC_STAT) -#include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -346,7 +346,7 @@ size_t zmalloc_get_rss(void) { int fd, count; char *p, *x; - snprintf(filename,256,"/proc/%d/stat",getpid()); + snprintf(filename,256,"/proc/%ld/stat",(long) getpid()); if ((fd = open(filename,O_RDONLY)) == -1) return 0; if (read(fd,buf,4096) <= 0) { close(fd); @@ -370,9 +370,6 @@ size_t zmalloc_get_rss(void) { return rss; } #elif defined(HAVE_TASKINFO) -#include <unistd.h> -#include <stdio.h> -#include <stdlib.h> #include <sys/types.h> #include <sys/sysctl.h> #include <mach/task.h> @@ -393,7 +390,6 @@ size_t zmalloc_get_rss(void) { #include <sys/types.h> #include <sys/sysctl.h> #include <sys/user.h> -#include <unistd.h> size_t zmalloc_get_rss(void) { struct kinfo_proc info; @@ -416,7 +412,6 @@ size_t zmalloc_get_rss(void) { #elif defined(__NetBSD__) #include <sys/types.h> #include <sys/sysctl.h> -#include <unistd.h> size_t zmalloc_get_rss(void) { struct kinfo_proc2 info; @@ -443,7 +438,7 @@ size_t zmalloc_get_rss(void) { char filename[256]; int fd; - snprintf(filename,256,"/proc/%d/psinfo",getpid()); + snprintf(filename,256,"/proc/%ld/psinfo",(long) getpid()); if ((fd = open(filename,O_RDONLY)) == -1) return 0; if (ioctl(fd, PIOCPSINFO, &info) == -1) { |