unknown type name ‘DIR’
krappix opened this issue · 2 comments
krappix commented
Hi,
I'am trying to compile this module on Ubuntu 16.04 with zabbix-3.2.6 and get the following error:
make all-recursive
make[1]: Entering directory '/home/sbe/zabbix-module-systemd'
Making all in src/modules/systemd
make[2]: Entering directory '/home/sbe/zabbix-module-systemd/src/modules/systemd'
/bin/bash ../../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../.. -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/home/sbe/zabbix-3.2.6/include -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -MT libzbxsystemd_la-libzbxcgroups.lo -MD -MP -MF .deps/libzbxsystemd_la-libzbxcgroups.Tpo -c -o libzbxsystemd_la-libzbxcgroups.lo `test -f 'libzbxcgroups.c' || echo './'`libzbxcgroups.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../.. -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/home/sbe/zabbix-3.2.6/include -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -MT libzbxsystemd_la-libzbxcgroups.lo -MD -MP -MF .deps/libzbxsystemd_la-libzbxcgroups.Tpo -c libzbxcgroups.c -fPIC -DPIC -o .libs/libzbxsystemd_la-libzbxcgroups.o
libzbxcgroups.c: In function ‘cgroup_init’:
libzbxcgroups.c:26:9: error: unknown type name ‘DIR’
DIR *dir;
^
libzbxcgroups.c:52:36: warning: implicit declaration of function ‘opendir’ [-Wimplicit-function-declaration]
if (NULL != (dir = opendir(ddir)))
^
libzbxcgroups.c:52:34: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
if (NULL != (dir = opendir(ddir)))
^
libzbxcgroups.c:54:21: warning: implicit declaration of function ‘closedir’ [-Wimplicit-function-declaration]
closedir(dir);
^
libzbxcgroups.c: In function ‘SYSTEMD_CGROUP_DEV’:
libzbxcgroups.c:298:9: warning: null argument where non-null required (argument 1) [-Wnonnull]
char *stat_file = malloc(strlen(get_rparam(request, 1)) + 2);
^
libzbxcgroups.c:299:9: warning: null argument where non-null required (argument 1) [-Wnonnull]
zbx_strlcpy(stat_file, "/", strlen(get_rparam(request, 1)) + 2);
^
libzbxcgroups.c:300:9: warning: null argument where non-null required (argument 1) [-Wnonnull]
zbx_strlcat(stat_file, get_rparam(request, 1), strlen(get_rparam(request, 1)) + 2);
^
Makefile:462: recipe for target 'libzbxsystemd_la-libzbxcgroups.lo' failed
make[2]: *** [libzbxsystemd_la-libzbxcgroups.lo] Error 1
make[2]: Leaving directory '/home/sbe/zabbix-module-systemd/src/modules/systemd'
Makefile:407: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/sbe/zabbix-module-systemd'
Makefile:339: recipe for target 'all' failed
make: *** [all] Error 2
Quick googling give me no matching answer. Can you help me with that?
jangaraj commented
Try now. I didn't notice this problem, because my zabbix source files includes dirent.h
(I've executed bootstrap.sh + configure
there). #include <dirent.h>
is IMHO more user friendly. Please test.
krappix commented
Thanks a lot, it compiles now.