more improvements for vzlogger

This commit is contained in:
Steffen Vogel 2011-06-12 21:27:28 +02:00
parent d96a11af23
commit 74df1da603
28 changed files with 1303 additions and 60 deletions

View file

@ -0,0 +1,862 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by vzlogger configure 0.2, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ ./configure --build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --libexecdir=${prefix}/lib/vzlogger --disable-maintainer-mode --disable-dependency-tracking
## --------- ##
## Platform. ##
## --------- ##
hostname = steffen-laptop
uname -m = x86_64
uname -r = 2.6.32-5-amd64
uname -s = Linux
uname -v = #1 SMP Wed May 18 23:13:22 UTC 2011
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/bin/X11
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2271: checking for a BSD-compatible install
configure:2339: result: /usr/bin/install -c
configure:2350: checking whether build environment is sane
configure:2400: result: yes
configure:2541: checking for a thread-safe mkdir -p
configure:2580: result: /bin/mkdir -p
configure:2593: checking for gawk
configure:2609: found /usr/bin/gawk
configure:2620: result: gawk
configure:2631: checking whether make sets $(MAKE)
configure:2653: result: yes
configure:2788: checking for gcc
configure:2804: found /usr/bin/gcc
configure:2815: result: gcc
configure:3044: checking for C compiler version
configure:3053: gcc --version >&5
gcc (Debian 4.4.5-8) 4.4.5
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3064: $? = 0
configure:3053: gcc -v >&5
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-8' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.5 (Debian 4.4.5-8)
configure:3064: $? = 0
configure:3053: gcc -V >&5
gcc: '-V' option must have argument
configure:3064: $? = 1
configure:3053: gcc -qversion >&5
gcc: unrecognized option '-qversion'
gcc: no input files
configure:3064: $? = 1
configure:3084: checking whether the C compiler works
configure:3106: gcc -g -O2 conftest.c >&5
configure:3110: $? = 0
configure:3158: result: yes
configure:3161: checking for C compiler default output file name
configure:3163: result: a.out
configure:3169: checking for suffix of executables
configure:3176: gcc -o conftest -g -O2 conftest.c >&5
configure:3180: $? = 0
configure:3202: result:
configure:3224: checking whether we are cross compiling
configure:3232: gcc -o conftest -g -O2 conftest.c >&5
configure:3236: $? = 0
configure:3243: ./conftest
configure:3247: $? = 0
configure:3262: result: no
configure:3267: checking for suffix of object files
configure:3289: gcc -c -g -O2 conftest.c >&5
configure:3293: $? = 0
configure:3314: result: o
configure:3318: checking whether we are using the GNU C compiler
configure:3337: gcc -c -g -O2 conftest.c >&5
configure:3337: $? = 0
configure:3346: result: yes
configure:3355: checking whether gcc accepts -g
configure:3375: gcc -c -g conftest.c >&5
configure:3375: $? = 0
configure:3416: result: yes
configure:3433: checking for gcc option to accept ISO C89
configure:3497: gcc -c -g -O2 conftest.c >&5
configure:3497: $? = 0
configure:3510: result: none needed
configure:3541: checking for style of include used by make
configure:3569: result: GNU
configure:3594: checking dependency style of gcc
configure:3704: result: none
configure:3774: checking for pkg-config
configure:3792: found /usr/bin/pkg-config
configure:3804: result: /usr/bin/pkg-config
configure:3829: checking pkg-config is at least version 0.9.0
configure:3832: result: yes
configure:3842: checking for DEPS
configure:3849: $PKG_CONFIG --exists --print-errors "json >= 0.9 libcurl >= 7.21.0 libmicrohttpd >= 0.9.3"
configure:3852: $? = 0
configure:3865: $PKG_CONFIG --exists --print-errors "json >= 0.9 libcurl >= 7.21.0 libmicrohttpd >= 0.9.3"
configure:3868: $? = 0
configure:3925: result: yes
configure:3937: checking how to run the C preprocessor
configure:3968: gcc -E conftest.c
configure:3968: $? = 0
configure:3982: gcc -E conftest.c
conftest.c:11:28: error: ac_nonexistent.h: No such file or directory
configure:3982: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "vzlogger"
| #define PACKAGE_TARNAME "vzlogger"
| #define PACKAGE_VERSION "0.2"
| #define PACKAGE_STRING "vzlogger 0.2"
| #define PACKAGE_BUGREPORT "info@steffenvogel.de"
| #define PACKAGE_URL ""
| #define PACKAGE "vzlogger"
| #define VERSION "0.2"
| /* end confdefs.h. */
| #include <ac_nonexistent.h>
configure:4007: result: gcc -E
configure:4027: gcc -E conftest.c
configure:4027: $? = 0
configure:4041: gcc -E conftest.c
conftest.c:11:28: error: ac_nonexistent.h: No such file or directory
configure:4041: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "vzlogger"
| #define PACKAGE_TARNAME "vzlogger"
| #define PACKAGE_VERSION "0.2"
| #define PACKAGE_STRING "vzlogger 0.2"
| #define PACKAGE_BUGREPORT "info@steffenvogel.de"
| #define PACKAGE_URL ""
| #define PACKAGE "vzlogger"
| #define VERSION "0.2"
| /* end confdefs.h. */
| #include <ac_nonexistent.h>
configure:4070: checking for grep that handles long lines and -e
configure:4128: result: /bin/grep
configure:4133: checking for egrep
configure:4195: result: /bin/grep -E
configure:4200: checking for ANSI C header files
configure:4220: gcc -c -g -O2 conftest.c >&5
configure:4220: $? = 0
configure:4293: gcc -o conftest -g -O2 conftest.c >&5
configure:4293: $? = 0
configure:4293: ./conftest
configure:4293: $? = 0
configure:4304: result: yes
configure:4317: checking for sys/types.h
configure:4317: gcc -c -g -O2 conftest.c >&5
configure:4317: $? = 0
configure:4317: result: yes
configure:4317: checking for sys/stat.h
configure:4317: gcc -c -g -O2 conftest.c >&5
configure:4317: $? = 0
configure:4317: result: yes
configure:4317: checking for stdlib.h
configure:4317: gcc -c -g -O2 conftest.c >&5
configure:4317: $? = 0
configure:4317: result: yes
configure:4317: checking for string.h
configure:4317: gcc -c -g -O2 conftest.c >&5
configure:4317: $? = 0
configure:4317: result: yes
configure:4317: checking for memory.h
configure:4317: gcc -c -g -O2 conftest.c >&5
configure:4317: $? = 0
configure:4317: result: yes
configure:4317: checking for strings.h
configure:4317: gcc -c -g -O2 conftest.c >&5
configure:4317: $? = 0
configure:4317: result: yes
configure:4317: checking for inttypes.h
configure:4317: gcc -c -g -O2 conftest.c >&5
configure:4317: $? = 0
configure:4317: result: yes
configure:4317: checking for stdint.h
configure:4317: gcc -c -g -O2 conftest.c >&5
configure:4317: $? = 0
configure:4317: result: yes
configure:4317: checking for unistd.h
configure:4317: gcc -c -g -O2 conftest.c >&5
configure:4317: $? = 0
configure:4317: result: yes
configure:4332: checking fcntl.h usability
configure:4332: gcc -c -g -O2 conftest.c >&5
configure:4332: $? = 0
configure:4332: result: yes
configure:4332: checking fcntl.h presence
configure:4332: gcc -E conftest.c
configure:4332: $? = 0
configure:4332: result: yes
configure:4332: checking for fcntl.h
configure:4332: result: yes
configure:4332: checking stddef.h usability
configure:4332: gcc -c -g -O2 conftest.c >&5
configure:4332: $? = 0
configure:4332: result: yes
configure:4332: checking stddef.h presence
configure:4332: gcc -E conftest.c
configure:4332: $? = 0
configure:4332: result: yes
configure:4332: checking for stddef.h
configure:4332: result: yes
configure:4332: checking for stdint.h
configure:4332: result: yes
configure:4332: checking for stdlib.h
configure:4332: result: yes
configure:4332: checking for string.h
configure:4332: result: yes
configure:4332: checking sys/time.h usability
configure:4332: gcc -c -g -O2 conftest.c >&5
configure:4332: $? = 0
configure:4332: result: yes
configure:4332: checking sys/time.h presence
configure:4332: gcc -E conftest.c
configure:4332: $? = 0
configure:4332: result: yes
configure:4332: checking for sys/time.h
configure:4332: result: yes
configure:4332: checking termios.h usability
configure:4332: gcc -c -g -O2 conftest.c >&5
configure:4332: $? = 0
configure:4332: result: yes
configure:4332: checking termios.h presence
configure:4332: gcc -E conftest.c
configure:4332: $? = 0
configure:4332: result: yes
configure:4332: checking for termios.h
configure:4332: result: yes
configure:4332: checking for unistd.h
configure:4332: result: yes
configure:4344: checking for mode_t
configure:4344: gcc -c -g -O2 conftest.c >&5
configure:4344: $? = 0
configure:4344: gcc -c -g -O2 conftest.c >&5
conftest.c: In function 'main':
conftest.c:65: error: expected expression before ')' token
configure:4344: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "vzlogger"
| #define PACKAGE_TARNAME "vzlogger"
| #define PACKAGE_VERSION "0.2"
| #define PACKAGE_STRING "vzlogger 0.2"
| #define PACKAGE_BUGREPORT "info@steffenvogel.de"
| #define PACKAGE_URL ""
| #define PACKAGE "vzlogger"
| #define VERSION "0.2"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_STDDEF_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_TERMIOS_H 1
| #define HAVE_UNISTD_H 1
| /* end confdefs.h. */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| # include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| # include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| int
| main ()
| {
| if (sizeof ((mode_t)))
| return 0;
| ;
| return 0;
| }
configure:4344: result: yes
configure:4355: checking for size_t
configure:4355: gcc -c -g -O2 conftest.c >&5
configure:4355: $? = 0
configure:4355: gcc -c -g -O2 conftest.c >&5
conftest.c: In function 'main':
conftest.c:65: error: expected expression before ')' token
configure:4355: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "vzlogger"
| #define PACKAGE_TARNAME "vzlogger"
| #define PACKAGE_VERSION "0.2"
| #define PACKAGE_STRING "vzlogger 0.2"
| #define PACKAGE_BUGREPORT "info@steffenvogel.de"
| #define PACKAGE_URL ""
| #define PACKAGE "vzlogger"
| #define VERSION "0.2"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_STDDEF_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_TERMIOS_H 1
| #define HAVE_UNISTD_H 1
| /* end confdefs.h. */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| # include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| # include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| int
| main ()
| {
| if (sizeof ((size_t)))
| return 0;
| ;
| return 0;
| }
configure:4355: result: yes
configure:4370: checking for stdlib.h
configure:4370: result: yes
configure:4380: checking for GNU libc compatible malloc
configure:4404: gcc -o conftest -g -O2 conftest.c >&5
configure:4404: $? = 0
configure:4404: ./conftest
configure:4404: $? = 0
configure:4414: result: yes
configure:4437: checking for stdlib.h
configure:4437: result: yes
configure:4447: checking for GNU libc compatible realloc
configure:4471: gcc -o conftest -g -O2 conftest.c >&5
configure:4471: $? = 0
configure:4471: ./conftest
configure:4471: $? = 0
configure:4481: result: yes
configure:4502: checking whether strerror_r is declared
configure:4502: gcc -c -g -O2 conftest.c >&5
configure:4502: $? = 0
configure:4502: result: yes
configure:4515: checking for strerror_r
configure:4515: gcc -o conftest -g -O2 conftest.c >&5
configure:4515: $? = 0
configure:4515: result: yes
configure:4524: checking whether strerror_r returns char *
configure:4548: gcc -c -g -O2 conftest.c >&5
conftest.c: In function 'main':
conftest.c:73: error: invalid type argument of 'unary *' (have 'int')
conftest.c:74: warning: initialization makes pointer from integer without a cast
configure:4548: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "vzlogger"
| #define PACKAGE_TARNAME "vzlogger"
| #define PACKAGE_VERSION "0.2"
| #define PACKAGE_STRING "vzlogger 0.2"
| #define PACKAGE_BUGREPORT "info@steffenvogel.de"
| #define PACKAGE_URL ""
| #define PACKAGE "vzlogger"
| #define VERSION "0.2"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_STDDEF_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_TERMIOS_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_MALLOC 1
| #define HAVE_STDLIB_H 1
| #define HAVE_REALLOC 1
| #define HAVE_DECL_STRERROR_R 1
| #define HAVE_STRERROR_R 1
| /* end confdefs.h. */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| # include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| # include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| int
| main ()
| {
|
| char buf[100];
| char x = *strerror_r (0, buf, sizeof buf);
| char *p = strerror_r (0, buf, sizeof buf);
| return !p || x;
|
| ;
| return 0;
| }
configure:4586: result: no
configure:4597: checking for gettimeofday
configure:4597: gcc -o conftest -g -O2 conftest.c >&5
configure:4597: $? = 0
configure:4597: result: yes
configure:4597: checking for memset
configure:4597: gcc -o conftest -g -O2 conftest.c >&5
conftest.c:59: warning: conflicting types for built-in function 'memset'
configure:4597: $? = 0
configure:4597: result: yes
configure:4597: checking for sqrt
configure:4597: gcc -o conftest -g -O2 conftest.c >&5
conftest.c:60: warning: conflicting types for built-in function 'sqrt'
/tmp/ccgAyKgc.o: In function `main':
/home/stv0g/workspace/volkszaehler.org/misc/controller/vzlogger/conftest.c:71: undefined reference to `sqrt'
collect2: ld returned 1 exit status
configure:4597: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "vzlogger"
| #define PACKAGE_TARNAME "vzlogger"
| #define PACKAGE_VERSION "0.2"
| #define PACKAGE_STRING "vzlogger 0.2"
| #define PACKAGE_BUGREPORT "info@steffenvogel.de"
| #define PACKAGE_URL ""
| #define PACKAGE "vzlogger"
| #define VERSION "0.2"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_STDDEF_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_TERMIOS_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_MALLOC 1
| #define HAVE_STDLIB_H 1
| #define HAVE_REALLOC 1
| #define HAVE_DECL_STRERROR_R 1
| #define HAVE_STRERROR_R 1
| #define HAVE_GETTIMEOFDAY 1
| #define HAVE_MEMSET 1
| /* end confdefs.h. */
| /* Define sqrt to an innocuous variant, in case <limits.h> declares sqrt.
| For example, HP-UX 11i <limits.h> declares gettimeofday. */
| #define sqrt innocuous_sqrt
|
| /* System header to define __stub macros and hopefully few prototypes,
| which can conflict with char sqrt (); below.
| Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
| <limits.h> exists even on freestanding compilers. */
|
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|
| #undef sqrt
|
| /* Override any GCC internal prototype to avoid an error.
| Use char because int might match the return type of a GCC
| builtin and then its argument prototype would still apply. */
| #ifdef __cplusplus
| extern "C"
| #endif
| char sqrt ();
| /* The GNU C library defines this for functions which it implements
| to always fail with ENOSYS. Some functions are actually named
| something starting with __ and the normal name is an alias. */
| #if defined __stub_sqrt || defined __stub___sqrt
| choke me
| #endif
|
| int
| main ()
| {
| return sqrt ();
| ;
| return 0;
| }
configure:4597: result: no
configure:4597: checking for strchr
configure:4597: gcc -o conftest -g -O2 conftest.c >&5
conftest.c:60: warning: conflicting types for built-in function 'strchr'
configure:4597: $? = 0
configure:4597: result: yes
configure:4597: checking for strtol
configure:4597: gcc -o conftest -g -O2 conftest.c >&5
configure:4597: $? = 0
configure:4597: result: yes
configure:4608: checking whether to build with debug information
configure:4617: result: no
configure:4751: creating ./config.status
## ---------------------- ##
## Running config.status. ##
## ---------------------- ##
This file was extended by vzlogger config.status 0.2, which was
generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES =
CONFIG_HEADERS =
CONFIG_LINKS =
CONFIG_COMMANDS =
$ ./config.status
on steffen-laptop
config.status:882: creating Makefile
config.status:882: creating src/Makefile
config.status:882: creating docs/Makefile
config.status:882: creating config.h
config.status:1110: executing depfiles commands
configure:6075: WARNING: unrecognized options: --disable-maintainer-mode
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-g -O2'
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_DEPS_CFLAGS_set=
ac_cv_env_DEPS_CFLAGS_value=
ac_cv_env_DEPS_LIBS_set=
ac_cv_env_DEPS_LIBS_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_PKG_CONFIG_LIBDIR_set=
ac_cv_env_PKG_CONFIG_LIBDIR_value=
ac_cv_env_PKG_CONFIG_PATH_set=
ac_cv_env_PKG_CONFIG_PATH_value=
ac_cv_env_PKG_CONFIG_set=
ac_cv_env_PKG_CONFIG_value=
ac_cv_env_build_alias_set=set
ac_cv_env_build_alias_value=x86_64-linux-gnu
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_func_gettimeofday=yes
ac_cv_func_malloc_0_nonnull=yes
ac_cv_func_memset=yes
ac_cv_func_realloc_0_nonnull=yes
ac_cv_func_sqrt=no
ac_cv_func_strchr=yes
ac_cv_func_strerror_r=yes
ac_cv_func_strerror_r_char_p=no
ac_cv_func_strtol=yes
ac_cv_have_decl_strerror_r=yes
ac_cv_header_fcntl_h=yes
ac_cv_header_inttypes_h=yes
ac_cv_header_memory_h=yes
ac_cv_header_stdc=yes
ac_cv_header_stddef_h=yes
ac_cv_header_stdint_h=yes
ac_cv_header_stdlib_h=yes
ac_cv_header_string_h=yes
ac_cv_header_strings_h=yes
ac_cv_header_sys_stat_h=yes
ac_cv_header_sys_time_h=yes
ac_cv_header_sys_types_h=yes
ac_cv_header_termios_h=yes
ac_cv_header_unistd_h=yes
ac_cv_objext=o
ac_cv_path_EGREP='/bin/grep -E'
ac_cv_path_GREP=/bin/grep
ac_cv_path_ac_pt_PKG_CONFIG=/usr/bin/pkg-config
ac_cv_path_install='/usr/bin/install -c'
ac_cv_path_mkdir=/bin/mkdir
ac_cv_prog_AWK=gawk
ac_cv_prog_CPP='gcc -E'
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_cc_c89=
ac_cv_prog_cc_g=yes
ac_cv_prog_make_make_set=yes
ac_cv_type_mode_t=yes
ac_cv_type_size_t=yes
am_cv_CC_dependencies_compiler_type=none
pkg_cv_DEPS_CFLAGS='-I/usr/include/json '
pkg_cv_DEPS_LIBS='-ljson -lcurl -lmicrohttpd '
## ----------------- ##
## Output variables. ##
## ----------------- ##
ACLOCAL='${SHELL} /home/stv0g/workspace/volkszaehler.org/misc/controller/vzlogger/missing --run aclocal-1.11'
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE='#'
AMTAR='${SHELL} /home/stv0g/workspace/volkszaehler.org/misc/controller/vzlogger/missing --run tar'
AUTOCONF='${SHELL} /home/stv0g/workspace/volkszaehler.org/misc/controller/vzlogger/missing --run autoconf'
AUTOHEADER='${SHELL} /home/stv0g/workspace/volkszaehler.org/misc/controller/vzlogger/missing --run autoheader'
AUTOMAKE='${SHELL} /home/stv0g/workspace/volkszaehler.org/misc/controller/vzlogger/missing --run automake-1.11'
AWK='gawk'
CC='gcc'
CCDEPMODE='depmode=none'
CFLAGS='-g -O2'
CPP='gcc -E'
CPPFLAGS=''
CYGPATH_W='echo'
DEFS='-DHAVE_CONFIG_H'
DEPDIR='.deps'
DEPS_CFLAGS='-I/usr/include/json '
DEPS_LIBS='-ljson -lcurl -lmicrohttpd '
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP='/bin/grep -E'
EXEEXT=''
GREP='/bin/grep'
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LDFLAGS=''
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
MAKEINFO='${SHELL} /home/stv0g/workspace/volkszaehler.org/misc/controller/vzlogger/missing --run makeinfo'
MKDIR_P='/bin/mkdir -p'
OBJEXT='o'
PACKAGE='vzlogger'
PACKAGE_BUGREPORT='info@steffenvogel.de'
PACKAGE_NAME='vzlogger'
PACKAGE_STRING='vzlogger 0.2'
PACKAGE_TARNAME='vzlogger'
PACKAGE_URL=''
PACKAGE_VERSION='0.2'
PATH_SEPARATOR=':'
PKG_CONFIG='/usr/bin/pkg-config'
PKG_CONFIG_LIBDIR=''
PKG_CONFIG_PATH=''
SET_MAKE=''
SHELL='/bin/bash'
STRIP=''
VERSION='0.2'
ac_ct_CC='gcc'
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE='#'
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE='#'
am__include='include'
am__isrc=''
am__leading_dot='.'
am__quote=''
am__tar='${AMTAR} chof - "$$tardir"'
am__untar='${AMTAR} xf -'
bindir='${exec_prefix}/bin'
build_alias='x86_64-linux-gnu'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='${prefix}'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${prefix}/share/info'
install_sh='${SHELL} /home/stv0g/workspace/volkszaehler.org/misc/controller/vzlogger/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${prefix}/lib/vzlogger'
localedir='${datarootdir}/locale'
localstatedir='/var'
mandir='${prefix}/share/man'
mkdir_p='/bin/mkdir -p'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/usr'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "vzlogger"
#define PACKAGE_TARNAME "vzlogger"
#define PACKAGE_VERSION "0.2"
#define PACKAGE_STRING "vzlogger 0.2"
#define PACKAGE_BUGREPORT "info@steffenvogel.de"
#define PACKAGE_URL ""
#define PACKAGE "vzlogger"
#define VERSION "0.2"
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_FCNTL_H 1
#define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_TERMIOS_H 1
#define HAVE_UNISTD_H 1
#define HAVE_STDLIB_H 1
#define HAVE_MALLOC 1
#define HAVE_STDLIB_H 1
#define HAVE_REALLOC 1
#define HAVE_DECL_STRERROR_R 1
#define HAVE_STRERROR_R 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_MEMSET 1
#define HAVE_STRCHR 1
#define HAVE_STRTOL 1
#define NDEBUG /**/
configure: exit 0

View file

@ -2,7 +2,7 @@ Source: vzlogger
Section: net
Priority: optional
Maintainer: Steffen Vogel <info@steffenvogel.de>
Build-Depends: debhelper (>= 7.0.50~)
Build-Depends: debhelper (>= 7.0.50~), pkg-config (>= 0.25)
Standards-Version: 3.8.4
Homepage: http://wiki.volkszaehler.org/software/controller/vzlogger
Vcs-Git: git://github.com/volkszaehler/volkszaehler.org.git

View file

@ -0,0 +1 @@
vzlogger_0.2_amd64.deb net optional

View file

@ -0,0 +1,45 @@
dh_auto_configure
dh_auto_build
dh_auto_test
dh_prep
dh_installdirs
dh_auto_install
dh_install
dh_installdocs
dh_installchangelogs
dh_installexamples
dh_installman
dh_installcatalogs
dh_installcron
dh_installdebconf
dh_installemacsen
dh_installifupdown
dh_installinfo
dh_pysupport
dh_installinit
dh_installmenu
dh_installmime
dh_installmodules
dh_installlogcheck
dh_installlogrotate
dh_installpam
dh_installppp
dh_installudev
dh_installwm
dh_installxfonts
dh_bugfiles
dh_lintian
dh_gconf
dh_icons
dh_perl
dh_usrlocal
dh_link
dh_compress
dh_fixperms
dh_strip
dh_makeshlibs
dh_shlibdeps
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb

View file

@ -0,0 +1,10 @@
# Automatically added by dh_installinit
if [ -x "/etc/init.d/vzlogger" ]; then
update-rc.d vzlogger defaults >/dev/null
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d vzlogger start || exit $?
else
/etc/init.d/vzlogger start || exit $?
fi
fi
# End automatically added section

View file

@ -0,0 +1,5 @@
# Automatically added by dh_installinit
if [ "$1" = "purge" ] ; then
update-rc.d vzlogger remove >/dev/null
fi
# End automatically added section

View file

@ -0,0 +1,9 @@
# Automatically added by dh_installinit
if [ -x "/etc/init.d/vzlogger" ]; then
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d vzlogger stop || exit $?
else
/etc/init.d/vzlogger stop || exit $?
fi
fi
# End automatically added section

View file

@ -0,0 +1,2 @@
shlibs:Depends=libc6 (>= 2.3.4), libcurl3 (>= 7.16.2-1), libjson0, libmicrohttpd10
misc:Depends=

View file

@ -0,0 +1,2 @@
/etc/vzlogger.conf
/etc/init.d/vzlogger

View file

@ -0,0 +1,17 @@
Package: vzlogger
Version: 0.2
Architecture: amd64
Maintainer: Steffen Vogel <info@steffenvogel.de>
Installed-Size: 112
Depends: libc6 (>= 2.3.4), libcurl3 (>= 7.16.2-1), libjson0, libmicrohttpd10
Section: net
Priority: optional
Homepage: http://wiki.volkszaehler.org/software/controller/vzlogger
Description: program for logging measurements to an volkszaehler.org middelware
vzlogger...
* is a tiny shell tool to log measurements of a wide variety of
smartmeters, sensors & protocols against the volkszaehler.org middleware.
* can run as a daemon or can be invoked periodically by cron.
* includes a tiny onboard httpd to serve
realtime readings to the ajax web frontend.
* is written in pure ansi c and should run on most embedded devices.

View file

@ -0,0 +1,4 @@
8fa7aec7174dbeb8a1c32fb55ecac55c usr/bin/vzlogger
dd95570da959bb157be4953e996ab8cf usr/share/doc/vzlogger/changelog.gz
38632dd7fa88edb0c2d049ff22e862d3 usr/share/doc/vzlogger/copyright
fd5b637cf1823a1b8202c7ad5242b9cf usr/share/man/man1/vzlogger.1.gz

View file

@ -0,0 +1,12 @@
#!/bin/sh
set -e
# Automatically added by dh_installinit
if [ -x "/etc/init.d/vzlogger" ]; then
update-rc.d vzlogger defaults >/dev/null
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d vzlogger start || exit $?
else
/etc/init.d/vzlogger start || exit $?
fi
fi
# End automatically added section

View file

@ -0,0 +1,7 @@
#!/bin/sh
set -e
# Automatically added by dh_installinit
if [ "$1" = "purge" ] ; then
update-rc.d vzlogger remove >/dev/null
fi
# End automatically added section

View file

@ -0,0 +1,11 @@
#!/bin/sh
set -e
# Automatically added by dh_installinit
if [ -x "/etc/init.d/vzlogger" ]; then
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
invoke-rc.d vzlogger stop || exit $?
else
/etc/init.d/vzlogger stop || exit $?
fi
fi
# End automatically added section

View file

@ -0,0 +1,151 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: vzlogger
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: logging measurements to an volkszaehler.org middelware
### END INIT INFO
# Author: Steffen Vogel <info@steffenvogel.de>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=vzlogger # Introduce a short description here
NAME=vzlogger # Introduce the short server's name here
DAEMON=/usr/sbin/vzlogger # Introduce the server's location here
DAEMON_ARGS="" # Arguments to run the daemon with
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x $DAEMON ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View file

@ -0,0 +1,11 @@
; vzlogger configuration
; use tabs, spaces as delimiter
; use ; to introduce a comment
;prot intval uuid middleware options
;1wire 3 52960fe0-8882-11e0-b356-85eba28c1922 http://localhost/workspace/volkszaehler.org/htdocs/middleware /mnt/1wire/10.12E6D3000800/temperature
;obis 10 ef0e9adf-cd9e-4d9a-92c5-b4fb4c89ff98 http://volkszaehler.org/demo/middleware.php /dev/ttyS0
;rawS0 10 27a1b4c0-8f8a-11e0-ad82-db6efbc4ba2e http://volkszaehler.org/demo/middleware.php /dev/ttyUSB2
random 3 52960fe0-8882-11e0-b356-85eba28c1922 http://localhost/workspace/volkszaehler.org/htdocs/middleware 40
;random 7 473d35b0-945b-11e0-beb1-918e8c2ce5a0 http://volkszaehler.org/demo/middleware.php 10

Binary file not shown.

View file

@ -0,0 +1,32 @@
This work was packaged for Debian by:
Steffen Vogel <info@steffenvogel.de> on Thu, 09 Jun 2011 16:04:25 +0200
It was downloaded from:
http://volkszaehler.org
Upstream Author(s):
Steffen Vogel <info@steffenvogel.de>
Copyright:
Copyright (C) 2011 Steffen Vogel
License:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
The Debian packaging is:
Copyright (C) 2011 Steffen Vogel <info@steffenvogel.de>
and is licensed under the GPL version 3, see above.

View file

@ -78,7 +78,7 @@ size_t curl_custom_write_callback(void *ptr, size_t size, size_t nmemb, void *da
memcpy(&(response->data[response->size]), ptr, realsize);
response->size += realsize;
//response->data[response->size] = 0;
response->data[response->size] = 0;
return realsize;
}
@ -88,24 +88,28 @@ json_object * api_json_tuples(channel_t *ch, bool_t all) {
json_object *json_tuples = json_object_new_array();
int index = ch->queue.read_p;
size_t index = ch->queue.read_p;
size_t end = (all) ? ch->queue.read_p : ch->queue.write_p;
do {
pthread_mutex_lock(&ch->mutex);
rd = ch->queue.buf[index];
queue_get(&ch->queue, index, &rd);
pthread_mutex_unlock(&ch->mutex);
struct json_object *json_tuple = json_object_new_array();
if (rd.tv.tv_sec) { /* skip empty buffers */
struct json_object *json_tuple = json_object_new_array();
int timestamp = rd.tv.tv_sec * 1000 + rd.tv.tv_usec / 1000;
unsigned long timestamp = rd.tv.tv_sec * 1000 + rd.tv.tv_usec / 1000;
json_object_array_add(json_tuple, json_object_new_int(timestamp));
json_object_array_add(json_tuple, json_object_new_double(rd.value));
json_object_array_add(json_tuple, json_object_new_double(timestamp));
json_object_array_add(json_tuple, json_object_new_double(rd.value));
json_object_array_add(json_tuples, json_tuple);
json_object_array_add(json_tuples, json_tuple);
}
index++;
index %= ch->queue.size;
} while (index != (all) ? ch->queue.read_p : ch->queue.write_p);
index %= ch->queue.size; /* increment pointer */
} while (index != end);
return json_tuples;
}
@ -115,6 +119,7 @@ CURL * api_curl_init(channel_t *ch) {
struct curl_slist *header = NULL;
char url[255], agent[255];
/* prepare header & url */
sprintf(agent, "User-Agent: vzlogger/%s (%s)", VZ_VERSION, curl_version()); /* build user agent */
sprintf(url, "%s/data/%s.json", ch->middleware, ch->uuid); /* build url */
@ -124,7 +129,7 @@ CURL * api_curl_init(channel_t *ch) {
curl = curl_easy_init();
if (!curl) {
print(-1, "Cannot create curl handle", ch);
print(-1, "CURL: cannot create handle", ch);
exit(EXIT_FAILURE);
}
@ -169,7 +174,7 @@ void api_parse_exception(CURLresponse response, char *err) {
*
* Logs buffered readings against middleware
*/
void *api_thread(void *arg) {
void * api_thread(void *arg) {
CURL *curl;
channel_t *ch = (channel_t *) arg; /* casting argument */
@ -179,14 +184,13 @@ void *api_thread(void *arg) {
do { /* start thread mainloop */
CURLresponse response;
int curl_code;
long int http_code;
long int http_code, curl_code;
char *json_str;
/* initialize response */
response.data = NULL;
response.size = 0;
pthread_mutex_lock(&ch->mutex);
while (queue_is_empty(&ch->queue)) { /* detect spurious wakeups */
pthread_cond_wait(&ch->condition, &ch->mutex); /* sleep until new data has been read */
@ -194,7 +198,6 @@ void *api_thread(void *arg) {
pthread_mutex_unlock(&ch->mutex);
json_str = json_object_to_json_string(api_json_tuples(ch, FALSE));
print(1, "JSON request body: %s", ch, json_str);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json_str);
@ -202,12 +205,10 @@ void *api_thread(void *arg) {
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *) &response);
curl_code = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
if (curl_code == CURLE_OK && http_code == 200) { /* everything is ok */
print(1, "Request succeeded with code: %i", ch, http_code);
queue_clear(&ch->queue);
}
else { /* error */

View file

@ -42,7 +42,7 @@ typedef struct {
int curl_custom_debug_callback(CURL *curl, curl_infotype type, char *data, size_t size, void *custom);
size_t curl_custom_write_callback(void *ptr, size_t size, size_t nmemb, void *data);
json_object * api_build_json(channel_t *ch);
json_object * api_json_tuples(channel_t *ch, bool_t all);
void * api_thread(void *arg);
#endif /* _API_H_ */

View file

@ -52,8 +52,8 @@ int handle_request(void *cls, struct MHD_Connection *connection, const char *url
if (strcmp(url, "/") == 0 || strcmp(ch->uuid, url + 1) == 0) {
pthread_mutex_lock(&ch->mutex);
/* wait for new data comet-like blocking of HTTP response */
pthread_cond_wait(&ch->condition, &ch->mutex); // TODO use pthread_cond_timedwait()
/* wait for new data comet-like blocking of HTTP response */
pthread_cond_wait(&ch->condition, &ch->mutex); // TODO use pthread_cond_timedwait()
pthread_mutex_unlock(&ch->mutex);
struct json_object *json_tuples = api_json_tuples(ch, TRUE);

View file

@ -74,7 +74,7 @@ static struct option long_options[] = {
/**
* Descriptions vor command line options
*/
static char * long_options_descs[] = {
static char *long_options_descs[] = {
"config file with channel -> uuid mapping",
"run as daemon",
"activate local interface (tiny webserver)",
@ -85,10 +85,12 @@ static char * long_options_descs[] = {
NULL /* stop condition for iterator */
};
/* Global variables */
/*
* Global variables
*/
channel_t chans[MAX_CHANNELS]; // TODO use dynamic allocation
options_t opts = { /* setting default options */
"vzlogger.conf", /* config file */
NULL, /* config file */
8080, /* port for local interface */
0, /* debug level / verbosity */
FALSE, /* daemon mode */
@ -209,15 +211,41 @@ void parse_options(int argc, char * argv[], options_t * opts) {
exit((c == '?') ? EXIT_FAILURE : EXIT_SUCCESS);
}
}
if (opts->config == NULL) { /* search for config file */
if (access("vzlogger.conf", R_OK) == 0) {
opts->config = "vzlogger.conf";
}
else if (access("/etc/vzlogger.conf", R_OK) == 0) {
opts->config = "/etc/vzlogger.conf";
}
else { /* search in home directory */
char *home_config = malloc(255);
strcat(home_config, getenv("HOME")); /* get home dir */
strcat(home_config, "/.vzlogger.conf"); /* append my filename */
if (access(home_config, R_OK) == 0) {
opts->config = home_config;
}
}
}
}
int parse_channels(char * filename, channel_t * chans) {
int parse_channels(char *filename, channel_t *chans) {
if (filename == NULL) {
fprintf(stderr, "No config file found! Please specify with --config!\n");
exit(EXIT_FAILURE);
}
FILE *file = fopen(filename, "r"); /* open configuration */
if (file == NULL) {
perror(filename); /* why didn't the file open? */
exit(EXIT_FAILURE);
}
else {
print(2, "Start parsing configuration from %s", NULL, filename);
}
char line[256];
int chan_num = 0, line_num = 1;
@ -308,22 +336,33 @@ int parse_channels(char * filename, channel_t * chans) {
*/
void *read_thread(void *arg) {
channel_t *ch = (channel_t *) arg; /* casting argument */
print(1, "Started reading thread", ch);
/* initalize channel */
ch->handle = ch->prot->init_func(ch->options); /* init sensor/meter */
do {
reading_t rd = ch->prot->read_func(ch->handle); /* aquire reading */
/**
* Aquire reading,
* may be blocking if mode == MODE_METER
*/
reading_t rd = ch->prot->read_func(ch->handle);
pthread_mutex_lock(&ch->mutex);
queue_push(&ch->queue, rd);
if (!queue_push(&ch->queue, rd)) {
print(6, "Warning queue is full, discarding first tuple!", ch);
}
pthread_cond_broadcast(&ch->condition); /* notify webserver and logging thread */
pthread_mutex_unlock(&ch->mutex);
print(1, "Value read: %.1f", ch, rd.value);
if (opts.verbose > 5) queue_print(&ch->queue); /* Debugging */
/* Debugging */
if (opts.verbose >= 10) {
char *queue_str = queue_print(&ch->queue);
print(10, "Queue dump: %s write_p = %lu\t read_p = %lu", ch, queue_str, ch->queue.write_p, ch->queue.read_p);
free(queue_str);
}
if (ch->prot->mode != MODE_METER) { /* for meters, the read_func call is blocking */
print(5, "Next reading in %i seconds", ch, ch->interval);
@ -342,9 +381,9 @@ void *read_thread(void *arg) {
/**
* The main loop
*/
int main(int argc, char * argv[]) {
int main(int argc, char *argv[]) {
int num_chans;
struct MHD_Daemon * d;
struct MHD_Daemon *httpd_handle = NULL;
parse_options(argc, argv, &opts); /* parse command line arguments */
num_chans = parse_channels(opts.config, chans); /* parse channels from configuration */
@ -354,9 +393,10 @@ int main(int argc, char * argv[]) {
curl_global_init(CURL_GLOBAL_ALL); /* global intialization for all threads */
for (int i = 0; i < num_chans; i++) {
channel_t * ch = &chans[i];
channel_t *ch = &chans[i];
queue_init(&ch->queue, (BUFFER_LENGTH / ch->interval) + 1); /* initialize queue to buffer 10 minutes of data */
/* initialize queue to buffer data */
queue_init(&ch->queue, (BUFFER_LENGTH / ch->interval) + 1);
/* initialize thread syncronization helpers */
pthread_mutex_init(&ch->mutex, NULL);
@ -369,7 +409,7 @@ int main(int argc, char * argv[]) {
/* start webserver for local interface */
if (opts.local) {
d = MHD_start_daemon(
httpd_handle = MHD_start_daemon(
MHD_USE_THREAD_PER_CONNECTION,
opts.port,
NULL, NULL,
@ -380,25 +420,28 @@ int main(int argc, char * argv[]) {
}
/* wait for all threads to terminate */
// TODO bind signal for termination
for (int i = 0; i < num_chans; i++) {
channel_t * ch = &chans[i];
pthread_join(ch->reading_thread, NULL);
pthread_join(ch->logging_thread, NULL);
// TODO close protocol handles
free(ch->middleware);
free(ch->uuid);
free(ch->options);
queue_free(&ch->queue);
pthread_cond_destroy(&ch->condition);
pthread_mutex_destroy(&ch->mutex);
}
if (opts.local) { /* stop webserver */
MHD_stop_daemon(d);
/* stop webserver */
if (httpd_handle) {
MHD_stop_daemon(httpd_handle);
}
return 0;
return EXIT_SUCCESS;
}

View file

@ -36,8 +36,8 @@
#define VZ_VERSION "0.2"
#define MAX_CHANNELS 16
#define RETRY_PAUSE 10 //600 /* seconds to wait after failed request */
#define BUFFER_LENGTH 600 /* in seconds */
#define RETRY_PAUSE 10 //600 /* seconds to wait after failed request */
#define BUFFER_LENGTH 60 //600 /* in seconds */
#ifndef TRUE
#define TRUE 1

View file

@ -3,17 +3,17 @@
#include "queue.h"
queue_t * queue_init(queue_t *q, size_t size) {
bool_t queue_init(queue_t *q, size_t size) {
q->buf = malloc(sizeof(reading_t) * size); /* keep one slot open */
if (q->buf) {
q->size = size;
q->read_p = q->write_p = 0; /* queue is empty */
return q;
return TRUE;
}
else { /* cannot allocat memory */
return NULL;
else { /* cannot allocate memory */
return FALSE;
}
}
@ -30,16 +30,34 @@ void queue_clear(queue_t *q) {
q->read_p = q->write_p;
}
void queue_push(queue_t *q, reading_t rd) {
q->buf[q->write_p] = rd;
q->write_p++;
bool_t queue_push(queue_t *q, reading_t rd) {
q->buf[q->write_p] = rd; /* copy data to buffer */
q->write_p++; /* increment write pointer */
q->write_p %= q->size;
if (q->read_p == q->write_p) { /* queue full */
q->read_p++; /* discarding first tuple */
return FALSE;
}
return TRUE;
}
bool_t queue_get(queue_t *q, size_t index, reading_t *rd) {
*rd = q->buf[index];
return (index < q->size);
}
void queue_print(queue_t *q) {
printf("Queue dump: [%.1f", q->buf[0].value);
char * queue_print(queue_t *q) {
char *buf = malloc(q->size * 6);
char *ret = buf;
buf += sprintf(buf, "[%.1f", q->buf[0].value);
for (int i = 1; i < q->size; i++) {
printf("|%.2f", q->buf[i].value);
buf += sprintf(buf, "|%.2f", q->buf[i].value);
}
printf("] write_p = %i\t read_p = %i\n", q->write_p, q->read_p);
buf += sprintf(buf, "]");
return ret;
}

View file

@ -41,20 +41,19 @@ typedef char bool_t;
typedef struct {
size_t size;
int read_p;
int write_p;
int fill_count;
size_t read_p;
size_t write_p;
reading_t *buf;
} queue_t;
queue_t * queue_init(queue_t *q, size_t size);
bool_t queue_init(queue_t *q, size_t size);
bool_t queue_is_empty(queue_t *q);
void queue_push(queue_t *q, reading_t rd);
bool_t queue_get(queue_t *q, size_t index, reading_t *rd);
bool_t queue_push(queue_t *q, reading_t rd);
void queue_clear(queue_t *q);
void queue_free(queue_t *q);
void queue_print(queue_t *q);
char * queue_print(queue_t *q);
#endif /* _QUEUE_H_ */

View file

@ -6,5 +6,6 @@
;1wire 3 52960fe0-8882-11e0-b356-85eba28c1922 http://localhost/workspace/volkszaehler.org/htdocs/middleware /mnt/1wire/10.12E6D3000800/temperature
;obis 10 ef0e9adf-cd9e-4d9a-92c5-b4fb4c89ff98 http://volkszaehler.org/demo/middleware.php /dev/ttyS0
;rawS0 10 27a1b4c0-8f8a-11e0-ad82-db6efbc4ba2e http://volkszaehler.org/demo/middleware.php /dev/ttyUSB2
random 5 473d35b0-945b-11e0-beb1-918e8c2ce5a0 http://volkszaehler.org/demo/middleware.php 40
random 3 52960fe0-8882-11e0-b356-85eba28c1922 http://localhost/workspace/volkszaehler.org/htdocs/middleware 40
;random 7 473d35b0-945b-11e0-beb1-918e8c2ce5a0 http://volkszaehler.org/demo/middleware.php 10