Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Oct 2001 19:49:02 +0200
From:      Paolo Pisati <flag@libero.it>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   First prg with sysctl
Message-ID:  <20011013194902.A38183@newluxor.skynet.org>

next in thread | raw e-mail | index | archive | help

Someone can tell me why this piece of code doesn't work?

#include<stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <net/if.h>
#include <net/if_mib.h>

int main(void) {
  int mib[5], *count;

  mib[0]=CTL_NET;
  mib[1]=PF_LINK;
  mib[2]=NETLINK_GENERIC;
  mib[3]=IFMIB_SYSTEM;
  mib[4]=IFMIB_IFCOUNT;

  sysctl(mib, 5, count, sizeof(int),(void *)NULL, NULL);

  printf("count: %d\n",*count);
  
}

I'm searching the number of interfaces available.

thanks.

-- 

Paolo

Visit the Italian FreeBSD User Group Site: www.gufi.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011013194902.A38183>