Rtems Networking
Joel Sherrill
joel.sherrill at oarcorp.com
Thu Nov 16 12:32:04 UTC 2006
Ralf Corsepius wrote:
> On Wed, 2006-11-15 at 16:57 -0600, Joel Sherrill wrote:
>
>> Luca Germano wrote:
>>
>>> Hi
>>> I try to use network under RTEMS. I look the RTEMS netdemos examples.
>>> Compling my application I have the following warning message:
>>> /opt/rtems-4.6/lib/gcc-lib/sparc-rtems/3.2.3/../../../../sparc-rtems/bin/ld:
>>> Warning: size of symbol `timeout' changed from 4 to 244 in
>>> /opt/rtems-4.6/sparc-rtems/leon3/lib/librtemscpu.a(rtems_glue.o)
>>> /opt/rtems-4.6/lib/gcc-lib/sparc-rtems/3.2.3/../../../../sparc-rtems/bin/ld:
>>> Warning: type of symbol `timeout' changed from 1 to 2 in
>>> /opt/rtems-4.6/sparc-rtems/leon3/lib/librtemscpu.a(rtems_glue.o)
>>> Someone have had this warning message or can explain me how to solve?
>>>
>>>
>> This usually indicates that the symbol is defined in two different
>> object files.
>>
>> Can you poke around with nm and grep on the libraries and see if it is
>> duplicately defined?
>> timeout is such a common word, it wouldn't surprise me to find it in two
>> places.
>>
>
> As others already pointed out, RTEMS is partially guilty for not being
> "namespace clean".
>
> To avoid this particular clash, I'd like to propose the patch (against
> CVS-HEAD/rtems-4.8) below.
>
I'm all for making the namespace cleaner and my personal goal is to fix
a few
other places on the CVS head that I think the names stink. :)
Are there places where timeout() is actually used that need to change?
Did you mean to mix in the argument type change to BSD malloc? It seems
unrelated to timeout. I don't mind that change either just wonder if it is
related and I don't see it.
And let this be a lesson to us all to use good function and variable
names. :)
--joel
> Ralf
>
>
> ------------------------------------------------------------------------
>
> Index: cpukit/libnetworking/rtems/rtems_bsdnet_internal.h
> ===================================================================
> RCS file: /usr1/CVS/rtems/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h,v
> retrieving revision 1.26
> diff -u -r1.26 rtems_bsdnet_internal.h
> --- cpukit/libnetworking/rtems/rtems_bsdnet_internal.h 31 Aug 2006 01:10:02 -0000 1.26
> +++ cpukit/libnetworking/rtems/rtems_bsdnet_internal.h 16 Nov 2006 09:55:08 -0000
> @@ -127,11 +127,12 @@
> /*
> * Redo kernel memory allocation
> */
> -#define malloc rtems_bsdnet_malloc
> -#define free rtems_bsdnet_free
> +#define malloc(size,type,flags) rtems_bsdnet_malloc(size,type,flags)
> +#define free(ptr,type) rtems_bsdnet_free(ptr,type)
> +#define timeout(a,b,c) rtems_bsdnet_timeout(a,b,c)
>
> #define M_NOWAIT 0x0001
> -void *rtems_bsdnet_malloc (unsigned long size, int type, int flags);
> +void *rtems_bsdnet_malloc (size_t size, int type, int flags);
> void rtems_bsdnet_free (void *addr, int type);
>
> void rtems_bsdnet_semaphore_obtain (void);
> Index: cpukit/libnetworking/rtems/rtems_glue.c
> ===================================================================
> RCS file: /usr1/CVS/rtems/cpukit/libnetworking/rtems/rtems_glue.c,v
> retrieving revision 1.40
> diff -u -r1.40 rtems_glue.c
> --- cpukit/libnetworking/rtems/rtems_glue.c 1 Sep 2006 18:15:01 -0000 1.40
> +++ cpukit/libnetworking/rtems/rtems_glue.c 16 Nov 2006 09:55:11 -0000
> @@ -108,7 +108,7 @@
> extern void *malloc (size_t);
> extern void free (void *);
> void *
> -rtems_bsdnet_malloc (unsigned long size, int type, int flags)
> +rtems_bsdnet_malloc (size_t size, int type, int flags)
> {
> void *p;
> int try = 0;
> @@ -683,7 +683,7 @@
> * Callout list processing
> */
> void
> -timeout(void (*ftn)(void *), void *arg, int ticks)
> +rtems_bsdnet_timeout(void (*ftn)(void *), void *arg, int ticks)
> {
> register struct callout *new, *p, *t;
>
> Index: cpukit/libnetworking/sys/malloc.h
> ===================================================================
> RCS file: /usr1/CVS/rtems/cpukit/libnetworking/sys/malloc.h,v
> retrieving revision 1.2
> diff -u -r1.2 malloc.h
> --- cpukit/libnetworking/sys/malloc.h 20 Apr 2004 12:27:38 -0000 1.2
> +++ cpukit/libnetworking/sys/malloc.h 16 Nov 2006 09:55:12 -0000
> @@ -345,11 +345,8 @@
> extern char *kmembase;
> extern struct kmembuckets bucket[];
>
> -void *contigmalloc __P((unsigned long size, int type, int flags,
> - unsigned long low, unsigned long high,
> - unsigned long alignment, unsigned long boundary));
> -void free __P((void *addr, int type));
> -void *malloc __P((unsigned long size, int type, int flags));
> +void free (void *addr, int type);
> +void *malloc (size_t size, int type, int flags);
> #endif /* _KERNEL */
>
> #endif /* !_SYS_MALLOC_H_ */
>
More information about the users
mailing list