# gcc ifpromisc.c
ifpromisc.c: In function `if_fetch':
ifpromisc.c:310: error: `SIOCGIFFLAGS' undeclared (first use in this function)
ifpromisc.c:310: error: (Each undeclared identifier is reported only once
ifpromisc.c:310: error: for each function it appears in.)
ifpromisc.c: In function `if_print':
ifpromisc.c:334: error: `SIOCGIFCONF' undeclared (first use in this function)
Google told me that SIOCGIFFLAGS was related to ioctl.h
From that I searched my system for ioctl.h and found another header file.
Editing ifpromisc.c, I changed:
#include <sys/ioctl.h>
to
#include "/usr/ucbinclude/sys/ioctl.h"
and re-complied.
Additionally, instead of changing the .c file, just pass -DSOLARIS2 to gcc
# gcc ifpromisc.c
Undefined first referenced
symbol in file
socket /var/tmp//ccmCOAIH.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
Silly me, I forgot to compile as:
gcc ifpromisc.c -lsocket -lnsl