Can anyone help me to get Harddisk serial number or NIC serial number or mac address of NIC ?
Hi balwant,
#include <fcntl.h>
#include <devctl.h>
#include <hw/nicinfo.h>
#include <sys/dcmd_io-net.h>
nic_config_t cfg;
int fd = open( “/dev/io-net/en0”, O_RDONLY );
devctl( fd, DCMD_IO_NET_GET_CONFIG, &cfg, sizeof cfg, NULL );
Gives you, among other things, …
cfg.permanent_address : permanent MAC address
cfg.current_address : current MAC address
cfg.mac_length : length of both addresses (in bytes)
For what I think your purposes are, you’ll propably want the permant address…
Hope this helps,
- Thomas