Subject: Re: libpthread.so.1.60 on NetBSD 1.3.3
To: Andy Finnell <andyf@vei.net>
From: Roger Brown <rogerhb@xtra.co.nz>
List: port-mac68k
Date: 09/08/1999 17:50:16
When I add 

    extern int __syscall()

inside the 'machdep_sys_ftruncate' call I get the same redefinition error.
I got round this by putting the machdep_sys_lseek in a separate file which
does tally with your
idea that it works on the alpha only because '__syscall' is not referenced
again.

I tried moving the 'machdep_sys_lseek' function to the end of the file and
this did not solve the problem

Regards

Roger
----------
>From: Andy Finnell <andyf@vei.net>
>To: Roger Brown <rogerhb@xtra.co.nz>
>Cc: Christoph Badura <bad@oreilly.de>, port-mac68k@netbsd.org
>Subject: Re: libpthread.so.1.60 on NetBSD 1.3.3
>Date: Wed, Sep 8, 1999, 1:43 pm
>

>Roger Brown wrote:
>> 
>> The error from the compile is ...
>> 
>> cc -O -O -Werror  -I/usr/pkgsrc/devel/mit-pthreads/work/pthreads-1_60_beta6
>> -I/u
>> sr/pkgsrc/devel/mit-pthreads/work/pthreads-1_60_beta6/include
>> -I/usr/pkgsrc/deve
>> l/mit-pthreads/work/pthreads-1_60_beta6/include -DPTHREAD_KERNEL  -Werror
>> -I/us
>> r/pkgsrc/devel/mit-pthreads/work/pthreads-1_60_beta6
>> -I/usr/pkgsrc/devel/mit-pth
>> reads/work/pthreads-1_60_beta6/include
>> -I/usr/pkgsrc/devel/mit-pthreads/work/pth
>> reads-1_60_beta6/include -DPTHREAD_KERNEL -c
>> /usr/pkgsrc/devel/mit-pthreads/work
>> /pthreads-1_60_beta6/machdep.c
>> cc1: warnings being treated as errors
>> /usr/pkgsrc/devel/mit-pthreads/work/pthreads-1_60_beta6/machdep.c: In
>> function `
>> machdep_sys_ftruncate':
>> /usr/pkgsrc/devel/mit-pthreads/work/pthreads-1_60_beta6/machdep.c:243:
>> warning:
>> type mismatch with previous external decl
>> /usr/pkgsrc/devel/mit-pthreads/work/pthreads-1_60_beta6/machdep.c:233:
>> warning:
>> previous external decl of `__syscall'
>> *** Error code 1
>> 
>> Here it does not mention 'machdep_sys_lseek' but this is the immediately
>> preceeding function which defines __syscall.
>> 
>> On my machine if you have the code...
>> 
>> int a(char *p)
>> {
>>     extern char *f();
>> 
>>     p=f();
>> }
>> 
>> int b(int c)
>> {
>>     c=f();
>> }
>> 
>> It complains with
>> 
>> q.c: In function `b':
>> q.c:10: warning: type mismatch with previous external decl
>> q.c:3: warning: previous external decl of `f'
>> 
>> So here the function prototype for 'f()' is not only scoped within function
>> 'a()' but appears to be acting globally.
>> 
>> Regards
>> 
>> Roger
>> 
>
>It sounds like an issue with NetBSD 1.3.X using gcc and not egcs.  After
>looking at the Alpha port, it appears they get away with it because they
>never reference __syscall() call again.  What happens if you declare
>__syscall() inside of machdep_sys_ftruncate() the way it appears inside
>of machdep_sys_lseek()?  Unfortunately I don't have a 1.3.X system to do
>any these tests myself.  
>
>Thanks,
>
> -andy