Of course, when you took your wonderfully crafted program to a system where the sgtty structure was laid out differently, you program broke. Which is a shame. We've had Larry's h2ph translator, which helped, but that only works on cpp symbols, not real C, which was also very much needed. What I offer you is a symbolic way of getting at all the C structures. I've couched them in terms of packages and functions.
Regular fields are just their own names.
This takes no arguments, and is merely the number of first-level elements in the structure. This is the perl format definition for passing to pack and unpack. If you ask for the typedef of a nothing, you get the whole structure, otherwise you get that of the member you ask for. Padding is taken care of, as is the magic to guarantee that a union is unpacked into all its aliases. Bitfields are not quite yet supported however.