You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Randy Kobes <ra...@theoryx5.uwinnipeg.ca> on 2004/08/05 20:20:24 UTC
apreq_xs_tables.h w/o USE_ITHREADS
In the latest cvs httpd-apreq-2 on a linux machine w/o
USE_ITHREADS defined, I've run into a couple of problems in
the perl glue, specifically with apreq_xs_tables.h. One
problem, in apreq_xs_table_keys, is that *d is declared
within an #ifdef USE_ITHREADS/#endif block, so should be
moved out. However, another problem is that both within
APREQ_XS_DEFINE_TABLE_GET() and APREQ_XS_DEFINE_TABLE_DO,
there's a dTHXa() call, which I think should be within
#ifdef USE_ITHREADS/#endif. I'm not sure how to do that
though within the #define: this attempt:
===========================================================
Index: glue/perl/xsbuilder/apreq_xs_tables.h
===================================================================
RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_tables.h,v
retrieving revision 1.33
diff -u -r1.33 apreq_xs_tables.h
--- glue/perl/xsbuilder/apreq_xs_tables.h 4 Aug 2004 19:33:43 -0000 1.33
+++ glue/perl/xsbuilder/apreq_xs_tables.h 5 Aug 2004 17:54:58 -0000
@@ -181,8 +181,8 @@
static int apreq_xs_table_keys(void *data, const char *key,
const char *val)
{
-#ifdef USE_ITHREADS
struct apreq_xs_do_arg *d = (struct apreq_xs_do_arg *)data;
+#ifdef USE_ITHREADS
dTHXa(d->perl);
#endif
@@ -236,7 +236,9 @@
{ \
struct apreq_xs_do_arg *d = (struct apreq_xs_do_arg *)data; \
void *env; \
+#ifdef USE_ITHREADS \
dTHXa(d->perl); \
+#endif \
dSP; \
env = d->env; \
if (val) { \
@@ -403,7 +405,9 @@
struct apreq_xs_do_arg *d = data; \
apreq_##type##_t *RETVAL = apreq_value_to_##type( \
apreq_strtoval(val)); \
+#ifdef USE_ITHREADS \
dTHXa(d->perl); \
+#endif \
dSP; \
SV *sv; \
void *env; \
========================================================================
gives an error that '#' isn't followed by a macro parameter,
occurring at the lines in the patch above where I've
inserted the #ifdef USE_ITHREADS. Is there a way
to use an #ifdef/#endif like this within a #define?
--
best regards,
randy
Re: apreq_xs_tables.h w/o USE_ITHREADS
Posted by Joe Schaefer <jo...@sunstarsys.com>.
Randy Kobes <ra...@theoryx5.uwinnipeg.ca> writes:
[...]
> Is there a way to use an #ifdef/#endif like this within a #define?
Nope, you should porbably just create another macro outside the
#define, whose definition is conditional on USE_ITHREADS. Then
replace your #ifdef/#endif attempt with a call to that macro.
--
Joe Schaefer
Re: apreq_xs_tables.h w/o USE_ITHREADS
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Thu, 5 Aug 2004, Joe Schaefer wrote:
> [...]
>
> That's the aTHX call on line 262. Please reorder struct
> apreq_do_arg so that d->perl is the last attribute, and
> move the aTHX assignment to the end (of line 262).
Works great, and all tests pass. Thanks! I've just
committed that.
--
best regards,
randy
Re: apreq_xs_tables.h w/o USE_ITHREADS
Posted by Joe Schaefer <jo...@sunstarsys.com>.
Randy Kobes <ra...@theoryx5.uwinnipeg.ca> writes:
[...]
> You're right - it's a different problem I'm having. Here's
> what happens in compiling the perl glue (after
> fixing the declaration of *d above):
That's the aTHX call on line 262. Please reorder struct apreq_do_arg
so that d->perl is the last attribute, and move the aTHX assignment
to the end (of line 262).
--
Joe Schaefer
Re: apreq_xs_tables.h w/o USE_ITHREADS
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Thu, 5 Aug 2004, Joe Schaefer wrote:
> Randy Kobes <ra...@theoryx5.uwinnipeg.ca> writes:
>
> > In the latest cvs httpd-apreq-2 on a linux machine w/o
> > USE_ITHREADS defined, I've run into a couple of problems in
> > the perl glue, specifically with apreq_xs_tables.h. One
> > problem, in apreq_xs_table_keys, is that *d is declared
> > within an #ifdef USE_ITHREADS/#endif block, so should be
> > moved out.
>
> +1. It was originally put in there to evade a silly compiler
> warning. We now always require *d for the tainting mechanics,
> so it needs to come out of the ifdef.
>
> > However, another problem is that both within
> > APREQ_XS_DEFINE_TABLE_GET() and APREQ_XS_DEFINE_TABLE_DO, there's a
> > dTHXa() call, which I think should be within #ifdef
> > USE_ITHREADS/#endif.
>
> Why? Doesn't our ppport.h header define this to dNOOP?
You're right - it's a different problem I'm having. Here's
what happens in compiling the perl glue (after
fixing the declaration of *d above):
============================================================
/home/randy/httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Apache__Cookie.h:
In function `apreq_xs_jar_get':
/home/randy/httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Apache__Cookie.h:94:
parse error before ',' token
In file included from Cookie.xs:38:
/home/randy/httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Apache__Cookie.h:
In function `apreq_xs_table_get':
/home/randy/httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Apache__Cookie.h:95:
parse error before ',' token
In file included from Cookie.xs:38:
/home/randy/httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Apache__Cookie.h:
In function `apreq_xs_table_do':
/home/randy/httpd-apreq-2/glue/perl/xsbuilder/Apache/Cookie/Apache__Cookie.h:97:
parse error before ',' token
=================================================================
This is with perl -V:
=================================================================
Summary of my perl5 (revision 5 version 8 subversion 5) configuration:
Platform:
osname=linux, osvers=2.4.20-31.9, archname=i686-linux
uname='linux theoryx5.uwinnipeg.ca 2.4.20-31.9 #1 tue apr 13 18:04:23 edt 2004 i686 i686 i386 gnulinux '
config_args='-Dprefix=/opt'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2',
cppflags='-fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='3.2.2 20030222 (Red Hat Linux 3.2.2-5)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.3.2'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES
Built under linux
Compiled at Jul 26 2004 10:53:57
@INC:
/opt/lib/perl5/5.8.5/i686-linux
/opt/lib/perl5/5.8.5
/opt/lib/perl5/site_perl/5.8.5/i686-linux
/opt/lib/perl5/site_perl/5.8.5
/opt/lib/perl5/site_perl/5.8.4/i686-linux
/opt/lib/perl5/site_perl/5.8.4
/opt/lib/perl5/site_perl/5.8.3/i686-linux
/opt/lib/perl5/site_perl/5.8.3
/opt/lib/perl5/site_perl
.
--
best regards,
randy
Re: apreq_xs_tables.h w/o USE_ITHREADS
Posted by Joe Schaefer <jo...@sunstarsys.com>.
Randy Kobes <ra...@theoryx5.uwinnipeg.ca> writes:
> In the latest cvs httpd-apreq-2 on a linux machine w/o
> USE_ITHREADS defined, I've run into a couple of problems in
> the perl glue, specifically with apreq_xs_tables.h. One
> problem, in apreq_xs_table_keys, is that *d is declared
> within an #ifdef USE_ITHREADS/#endif block, so should be
> moved out.
+1. It was originally put in there to evade a silly compiler
warning. We now always require *d for the tainting mechanics,
so it needs to come out of the ifdef.
> However, another problem is that both within
> APREQ_XS_DEFINE_TABLE_GET() and APREQ_XS_DEFINE_TABLE_DO, there's a
> dTHXa() call, which I think should be within #ifdef
> USE_ITHREADS/#endif.
Why? Doesn't our ppport.h header define this to dNOOP?
--
Joe Schaefer