tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Questions regarding 'struct modstat'
In sys/sys/module.h, we have the following definition of the 'struct
modstat' structure, (used by modctl(MODCTL_STAT, ...) to return kernel
data to userland):
...
/*
* This structure intentionally has the same layout for 32 and 64
* bit builds.
*/
typedef struct modstat {
char ms_name[MAXMODNAME];
char ms_required[MAXMODNAME * MAXMODDEPS];
uint64_t ms_addr;
modsrc_t ms_source;
modclass_t ms_class;
u_int ms_size;
u_int ms_refcnt;
u_int ms_reserved[4];
} modstat_t;
...
I have some questions:
1. Despite the comment, aren't the u_int fields of different sizes in
32- vs 64-bit builds? The comment seems to be somewhat misleading.
2. Is there any assurance that the module's load address (in ms_addr)
can fit in a uint64_t?
3. If I wanted to add another address field (ms_modaddr for the address
of the module's 'struct module'), would it be better to
a) insert a new uint64_t in the middle of this structure,
after the current ms_addr field,
b) insert a new uint64_t in the middle of this structure,
immediately before the ms_reserved[] array,
c) append a new uint64_t at the end of this structure, or
d) replace some number of the ms_reserved[] array with a
new uint64_t structure (and how many to replace?)
+------------------+--------------------------+-------------------------+
| Paul Goyette | PGP Key fingerprint: | E-mail addresses: |
| (Retired) | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+------------------+--------------------------+-------------------------+
Home |
Main Index |
Thread Index |
Old Index