network stack sysctl problems.

Steven Johnson sjohnson at sakuraindustries.com
Fri Aug 25 10:03:44 UTC 2006


Will test it Monday morning and feedback on the results.

Steven J

Thomas Doerfler wrote:

> Steven,
>
> I am on holidays, so I don't have access to our changes, but I filed a
> PR1119 about sysctl not working and a patch to get it working again some
> time ago. My solution was to change the attribute "__unused__" to
> "__used__" for the relevant data structures. At least for us the sysctl
> interface then worked again.
>
> Can you try ot the patch here:
>
> http://www.rtems.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=RTEMS&pr=1119&return_url=http%3A%2F%2Fwww.rtems.com%2Fcgi-bin%2Fgnatsweb.pl%3Fdatabase%3DRTEMS%3Bdebug%3D%3BCategory%3Dany%3BConfidential%3Dany%3BSeverity%3Dany%3BPriority%3Dany%3BResponsible%3Dany%3BState%3Dany%3Bignoreclosed%3DIgnore%2520Closed%3BClass%3Dany%3BSubmitter-Id%3Dany%3Boriginatedbyme%3DOriginated%2520by%2520You%3BSynopsis%3Dsysctl%3Bmultitext%3D%3Bcolumns%3DNotify-List%3Bcolumns%3DCategory%3Bcolumns%3DSynopsis%3Bcolumns%3DConfidential%3Bcolumns%3DSeverity%3Bcolumns%3DPriority%3Bcolumns%3DResponsible%3Bcolumns%3DState%3Bcolumns%3DClass%3Bcolumns%3DSubmitter-Id%3Bcolumns%3DArrival-Date%3Bcolumns%3DClosed-Date%3Bcolumns%3DLast-Modified%3Bcolumns%3DOriginator%3Bcolumns%3DRelease%3Bsortby%3DNumber%3Bdisplaydate%3DCurrent%2520Date%3Bcmd%3Dsubmit%2520query
>
> wkr,
> Thomas.
>
> Steven Johnson schrieb:
>
> >Please see attached patch against rtems 4.6.99.3.
>
> >It appeared to us that when building rtems, the network sysctl's were
> >being excluded by either the compiler or linker such that after the
> >program was being built they were invisible. (This is with GCC 4.1, and
> >latest binutils, etc)
>
> >We had to remove the static declarations in __MAKE_SET and SYSCTL_OID,
> >to force them to be public, so the compiler/linker wouldn't make
> >incorrect assumptions about them being referenced or not.  We noticed
> >that in kern_sysctl.c there is an rtems change of
>
> >#if defined(__rtems__)
> >void
> >#else
> >static void
> >#endif
> >sysctl_register_all(void *arg)
>
> >So we made our patch reflect this.
>
> >The only other change we made, which isn't reflected by the diff,
> >because it is part of our code and not the rtems code case was:
>
> >*(set_sysctl_*);
> >line in the link script changed to be
> >KEEP(*(set_sysctl_*))
>
> >This may effect the standard BSP's, but I don't use or build those, so
> >it wasn't possible for me to test that it was necessary for the standard
> >BSP's.
>
> >Also, I asked this before, but I don't remember getting a reply,  is it
> >possible to get "sysctlbyname" added as a standard network stack
> >function in rtems for 4.7?  The wiki mentions the function.  Its useful
> >for editing these types of sysctl values and isn't much code.  I know
> >its not currently an impediment to anyone because they can just include
> >the routine in their own code like I did, but it does seem like a useful
> >thin to have available as standard, without having to go to the wiki,
> >and add the code to your own project.  Just asking, it isn't an
> >impediment to me either way.
>
> >Steven J
>
>
>
>
> >------------------------------------------------------------------------
>
> >diff -Naur rtems-4.6.99.3/cpukit/libnetworking/sys/linker_set.h
> rtems-4.6.99.3-sysctl-non-static-fix/cpukit/libnetworking/sys/linker_set.h
> >--- rtems-4.6.99.3/cpukit/libnetworking/sys/linker_set.h  
>  2003-03-19 06:42:51.000000000 +1000
> >+++
> rtems-4.6.99.3-sysctl-non-static-fix/cpukit/libnetworking/sys/linker_set.h  
>  2006-07-24 16:08:29.621286581 +1000
> >@@ -40,9 +40,15 @@
> >  * Private macros, not to be used outside this header file.
> >  */
> > #ifdef __GNUC__
> >+#if defined(__rtems__)
> >+#define __MAKE_SET(set, sym)                        \
> >+    void const * const __set_##set##_sym_##sym         \
> >+    __attribute((section("set_" #set))) __unused = &sym
> >+#else
> > #define __MAKE_SET(set, sym)                        \
> >     static void const * const __set_##set##_sym_##sym         \
> >     __attribute((section("set_" #set))) __unused = &sym
> >+#endif    
> > #else /* !__GNUC__ */
> > #ifndef lint
> > #error "This file needs to be compiled by GCC or lint"
> >diff -Naur rtems-4.6.99.3/cpukit/libnetworking/sys/sysctl.h
> rtems-4.6.99.3-sysctl-non-static-fix/cpukit/libnetworking/sys/sysctl.h
> >--- rtems-4.6.99.3/cpukit/libnetworking/sys/sysctl.h    2005-02-22
> 02:24:43.000000000 +1000
> >+++
> rtems-4.6.99.3-sysctl-non-static-fix/cpukit/libnetworking/sys/sysctl.h  
>  2006-07-24 16:09:53.351392686 +1000
> >@@ -200,11 +200,19 @@
> >     sysctl_##parent##_##name##_children
>
> > /* This constructs a "raw" MIB oid. */
> >+#if defined(__rtems__)
> >+#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt,
> descr) \
> >+    struct sysctl_oid sysctl__##parent##_##name = {         \
> >+        &sysctl_##parent##_children, { 0 },             \
> >+        nbr, kind, a1, a2, #name, handler, fmt, 0, descr };     \
> >+    DATA_SET(sysctl_set, sysctl__##parent##_##name)
> >+#else
> > #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt,
> descr) \
> >     static struct sysctl_oid sysctl__##parent##_##name = {         \
> >         &sysctl_##parent##_children, { 0 },             \
> >         nbr, kind, a1, a2, #name, handler, fmt, 0, descr };     \
> >     DATA_SET(sysctl_set, sysctl__##parent##_##name)
> >+#endif
>
> > #define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2,
> handler, fmt, descr) \
> >     sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler,
> fmt, descr)
>
>
>
> --
> --------------------------------------------
> IMD Ingenieurbuero fuer Microcomputertechnik
> Thomas Doerfler           Herbststrasse 8
> D-82178 Puchheim          Germany
> email:    Thomas.Doerfler at imd-systems.de
> PGP public key available at:
>      http://www.imd-systems.de/pgpkey_en.html




More information about the users mailing list