Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

sysctl() not supported?

Is sysctl() in FreeBSD not supported in this port of eCos?

I write some code to check the ip forwarding status:

len = 4;

sysctlnametomib("pf.inet.ip.forwarding", mib, &len);

len = sizeof(ip_forward);

sysctl(mib, 4, &ip_forward, &len, NULL, 0);

diag_printf("ip_forward=%d\n",ip_forward);

error occured:

pingtest.o(.text.eth_init+0xd4): In function `eth_init':

/cygdrive/c/examples/pingtest.c:229: undefined reference to `sysctlnametomib'

pingtest.o(.text.eth_init+0xf4):/cygdrive/c/examples/pingtest.c:150: undefined r

eference to `sysctl'

collect2: ld returned 1 exit status

make: *** [pingtest] Error 1

I have added the following header files in order to make "sysctl()" and the mib work:# include <sys/types.h># include <sys/sysctl.h># include <sys/socket.h># include <netinet/in.h>

However, the error is still there.

Does that mean this port do not support sysctl()?

Thank you for any suggestions!

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I find the reason now.

    I didn&#39;t add the sysctl() support in configtool under FreeBSD.