You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Hiroyuki Hanai <ha...@imgsrc.co.jp> on 2001/07/13 11:08:38 UTC

a patch for apr_sms_threads.h

hi,

The included is a patch which will help you making
httpd-2.0 successfully on such OSs as FreeBSD.
Unless applying this patch, the correct apr.exports
file cannot be created and the make fails when server/exports.c
is being compiled.

cheers,

hiro hanai

Index: apr_sms_threads.h
===================================================================
RCS file: /pub/cvs/Apache/apr/include/apr_sms_threads.h,v
retrieving revision 1.1
diff -u -r1.1 apr_sms_threads.h
--- apr_sms_threads.h	2001/07/12 16:50:14	1.1
+++ apr_sms_threads.h	2001/07/13 09:02:17
@@ -58,12 +58,12 @@
 #include "apr.h"
 #include "apr_sms.h"
 
-#if APR_HAS_THREADS
- 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#if APR_HAS_THREADS
+ 
 /**
  * @package APR threads memory system
  */

Re: Exports, make_export.awk WAS: RE: a patch for apr_sms_threads.h

Posted by Hiroyuki Hanai <ha...@imgsrc.co.jp>.
> PS. Hiroyuki, could you send me your httpd-2.0/srclib/apr/apr.exports
>     please? I'm curious if my thoughts are matching the behaviour on
>     your machine.

apr.exports and apr.exports.patched are attached in this mail.
the former is created from apr_sms_threads.h rev 1.1 and the
latter from that after applying my patch.
The diff is very simple as follows.

--- apr.exports	Fri Jul 13 23:36:11 2001
+++ apr.exports.patched	Fri Jul 13 23:35:04 2001
@@ -262,8 +262,10 @@
 	apr_sms_dump_stats
 /APR_SMS_ALLOC_STATS
 apr_sms_blocks_create
-apr_sms_threads_create
-apr_sms_threads_create_ex
+APR_HAS_THREADS
+	apr_sms_threads_create
+	apr_sms_threads_create_ex
+/APR_HAS_THREADS
 apr_sms_tracking_create
 apr_sms_trivial_create
 apr_sms_trivial_create_ex

My system is FreeBSD-current which is built a few days before.
/usr/bin/awk is gawk 3.0.6; same as Sander's.

cheers,

hiro hanai

Re: Exports, make_export.awk WAS: RE: a patch for apr_sms_threads.h

Posted by Hiroyuki Hanai <ha...@imgsrc.co.jp>.
Ciao Sander,

> $ awk -f build/make_export.awk include/apr_sms_threads.h
> APR_HAS_THREADS
>         apr_sms_threads_create
>         apr_sms_threads_create_ex
> /APR_HAS_THREADS
> 
> As you can see this produces the correct output on my
> box. I can't imagine that awk on FreeBSD is generating
> something different, but can you please check?

As you can see from my previous mail(just have sent a
few minutes before), awk on my FreeBSD box work as follows;

$ awk -f build/make_export.awk include/apr_sms_threads.h
apr_sms_threads_create
apr_sms_threads_create_ex
$

Also as I've written in the previous mail,
awk on my system seems to be the same as yours.
Hmm...

hiro hanai

RE: Exports, make_export.awk WAS: RE: a patch for apr_sms_threads.h

Posted by Sander Striker <st...@apache.org>.
Hi Hiroyuki,

I've thought about it some more and tried the following
(in the apr directory _without_ any changes to the
 apr_sms_threads.h file):

$ awk -f build/make_export.awk include/apr_sms_threads.h
APR_HAS_THREADS
        apr_sms_threads_create
        apr_sms_threads_create_ex
/APR_HAS_THREADS

As you can see this produces the correct output on my
box. I can't imagine that awk on FreeBSD is generating
something different, but can you please check?

Thanks,

Sander



Exports, make_export.awk WAS: RE: a patch for apr_sms_threads.h

Posted by Sander Striker <st...@apache.org>.
> hi,
> 
> The included is a patch which will help you making
> httpd-2.0 successfully on such OSs as FreeBSD.
> Unless applying this patch, the correct apr.exports
> file cannot be created and the make fails when server/exports.c
> is being compiled.

Oh dear, I got bitten by buildexports/make_export, didn't I?
Ok, I'll move the #if down a few lines (and the matching
#endif up) and see if that fixes the problem.

Someone should really look into make_export one day and
resolve the issues you won't expect when you code outside
of httpd (ie, in apr).

#if APR_HAS_THREADS

#ifdef __cplusplus
#endif

#ifdef __cplusplus
#endif

#endif

Shouldn't be any different (from buildexports point of view) than:

#ifdef __cplusplus
#endif

#if APR_HAS_THREADS
#endif

#ifdef __cplusplus
#endif

The problem seems to be in apr/build/make_export:

/^#[ \t]*if(def)? (AP[RU]?_|!?defined).*/ {
        if (old_filename != FILENAME) {
                if (old_filename != "") printf("%s", line)
                macro_no = 0
                found = 0
                count = 0
                old_filename = FILENAME
                line = ""
        }
        macro_stack[macro_no++] = macro
        macro = substr($0, length($1)+2)
        count++
        line = line macro "\n"
        next
}

/^#[ \t]*endif/ {
        if (count > 0) {
                count--
                line = line "/" macro "\n"
                macro = macro_stack[--macro_no]
        }
        if (count == 0) {
                if (found != 0) {
                        printf("%s", line)
                }
                line = ""
        }
        next
}

The 'endif rule' reduces the count, but the count isn't increased
when an if other than #if APR_ or defined is present. So
#ifdef __cplusplus doesn't bump the count, where the matching
#endif does reduce it. Am I missing something? If not, I can't
think of a decent fix right now, but it should be possible.

Hmmm, total weirdness, I can't reproduce Hiroyukis problem on
my machine... (linux from scratch, linux 2.4.2, glibc 2.2.2,
gawk 3.0.6). Can someone reproduce it on their systems, so
maybe we can look for a constructive fix?

Thoughts anyone?

Sander

PS. Hiroyuki, could you send me your httpd-2.0/srclib/apr/apr.exports
    please? I'm curious if my thoughts are matching the behaviour on
    your machine.