Other tips for programming
- Parsing executables
- Executables/shared objects are ELF64; use libelf
or libgl to parse them when possible.
- 32- and 64-bit message compatibility
- Don't pass messages where a field changes size between 32- and 64-bit architectures.
- Change fields to a consistent type
-
- s/unsigned long/unsigned
- Use when additional length isn't required and the field type isn't specified by an external standard.
- Create a messenger type
-
- Use when field types are specified by an external standard, but we don't really need the extra space.
- Client side does field-by-field assignments to copy user type to/from the messenger type.
- For example, struct __msg_mq_attr
- Create a new message type
-
- Do this when there isn't enough space in the existing message structure.
- Hide extra information in previously reserved fields (e.g., _IO_READ64),
or extend the structure (e.g., _IO_NOTIFY64)
- Maintain field offsets for as many fields as possible to ease handling; add new fields to the
end, and rename existing fields rather than deleting them.