Syslog with inline C

Anders Nordby anders at fupp.net
Tue Jan 20 12:05:00 CET 2009


Hi,

I want to use syslog() two places in vcl_recv.

If I put this one two places:

C{
	#include <syslog.h>
	syslog(LOG_ERR, "Bogus request: %s/%s", VRT_GetHdr(sp, HDR_REQ, "\005host:"), VRT_r_req_url(sp));
}C

I get this error (also if I use that block with #include <syslog.h> only
in the first block):

C-compiler said: ./vcl.eOj4OB3l.c: In function 'VGC_function_vcl_recv':
C-compiler said: ./vcl.eOj4OB3l.c:922: error: incompatible implicit
declaration of function 'syslog'
C-compiler said: /usr/include/syslog.h:195: error: previous implicit
declaration of 'syslog' was here
mgt_run_cc(): Compiler failed, exit 1VCL compilation failed

If I make a separate block with #include <syslog.h> before the ones with
syslog(), I get:

C-compiler said: ./vcl.yBWJKX4u.c: In function 'VGC_function_vcl_recv':
C-compiler said: ./vcl.yBWJKX4u.c:905: error: incompatible implicit
declaration of function 'syslog'
C-compiler said: /usr/include/syslog.h:195: error: previous implicit
declaration of 'syslog' was here
C-compiler said: ./vcl.yBWJKX4u.c:923: error: incompatible implicit
declaration of function 'syslog'
C-compiler said: /usr/include/syslog.h:195: error: previous implicit
declaration of 'syslog' was here
mgt_run_cc(): Compiler failed, exit 1VCL compilation failed

If I simply drop having #include <syslog.h> at all, I get:

C-compiler said: ./vcl.Qwyqx8g0.c: In function 'VGC_function_vcl_recv':
C-compiler said: ./vcl.Qwyqx8g0.c:902: error: 'LOG_ERR' undeclared
(first use in this function)
C-compiler said: ./vcl.Qwyqx8g0.c:902: error: (Each undeclared
identifier is reported only once
C-compiler said: ./vcl.Qwyqx8g0.c:902: error: for each function it
appears in.)
mgt_run_cc(): Compiler failed, exit 1VCL compilation failed

How can I use syslog() several places in one VCL function (like
vcl_recv)?

I wish we have syslog() in VCL one day. :)

Bye,

-- 
Anders.



More information about the varnish-misc mailing list