Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#21088 closed defect (fixed)

sysutils/ifstat compiles but do not work on snow leopard

Reported by: mpapamanz@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 1.8.0
Keywords: Cc: mpapamanz@…
Port: ifstat

Description (last modified by nerdling (Jeremy Lavergne))

When compiled on snow leopard there are just two warning:

gcc -I. -g -O2 -DHAVE_CONFIG_H  -DNETSNMP_ENABLE_IPV6 -g -Os -pipe -DBUILD=127 -DMACOSX_DEPLOYMENT_TARGET=10.6 -F/System/Library/PrivateFrameworks/ -F/System/Library/Frameworks/ -Udarwin10 -Ddarwin10=darwin10 -I/usr/local/include -c drivers.c -o drivers.o
drivers.c: In function ‘get_ifcount’:
drivers.c:599: warning: passing argument 4 of ‘sysctl’ from incompatible pointer type
drivers.c: In function ‘get_ifdata’:
drivers.c:612: warning: passing argument 4 of ‘sysctl’ from incompatible pointer type

but, once installed, the program gives the following error

$ ./ifstat 
ifstat: sysctl(net.link.generic.ifmib.ifcount): Bad address
ifstat: no interfaces to monitor!

The issue seems related to a wrong use of sysctl syscall: they pass an integer instead of a size_t, with 32 bit gcc the two types have the same size, but with 64 bit gcc the size_t variables are 64bit long (instead of 32bit).

Attachments (2)

ifstat-size_t.diff (658 bytes) - added by mpapamanz@… 15 years ago.
Portfile (967 bytes) - added by mpapamanz@… 15 years ago.

Download all attachments as: .zip

Change History (5)

Changed 15 years ago by mpapamanz@…

Attachment: ifstat-size_t.diff added

Changed 15 years ago by mpapamanz@…

Attachment: Portfile added

comment:1 Changed 15 years ago by nerdling (Jeremy Lavergne)

Description: modified (diff)
Port: ifstat added

comment:2 Changed 15 years ago by tobypeterson

Resolution: fixed
Status: newclosed

comment:3 Changed 15 years ago by mpapamanz@…

Cc: mpapamanz@… added

Cc Me!

Note: See TracTickets for help on using tickets.