------------------------------------------------------------------------ I'm sponsoring the following case for myself. This case qualifies for Architectural self-review, but I wish to record the following information.
------------------------------------------------------------------------ A request has been made for ld.so.1 to return an objects segment mapping information. This method of obtaining the data would be more light weight than having to go through things like /proc. 6237063 request extension to dl* family to provide segment bounds information With the approach of mmapobj(2), this request was put on hold, so that we could return a public/consistent data structure. mmapobj(2) has integrated, and ld.so.1 now uses it(6686372). dlinfo() will return mmapobj_result_t data by using two new flags: > #define RTLD_DI_MMAPS 12 /* obtain objects mappings or */ > #define RTLD_DI_MMAPCNT 13 /* mapping count */ An auxiliary structure is used to maintain the data: > typedef struct { > uint_t dlm_cnt; /* number of mapings */ > mmapobj_result_t *dlm_maps; /* mapping information */ > } Dl_mapinfo_t; The user will first determine the number of mappings using a RTLD_DI_MMAPCNT request, and then provide the appropriate buffer to a RTLD_DI_MMAPS request. This model follows the RTLD_DI_SERINFOSIZE/RTLD_DI_SERINFO model, approved with PSARC/2000/164 (bug id 4239213). ------------------------------------------------------------------------ Standard C Library Functions dlinfo(3C) ..... RTLD_DI_MMAPCNT Initialize a Dl_mapinfo_t structure for the handle that is specified, for use in a RTLD_DI_MMAPS request. The p argument is a Dl_mapinfo_t pointer (Dl_mapinfo_t *p). On return from a RTLD_DI_MMAPCNT request, the dlm_cnt member indicates the number of segment mappings that the associated object uses. To obtain the complete mapping information for an object, a mmapobj_result_t array for dlm_cnt entries must be allocated and assigned to the dlm_maps member. This initialized structure is then passed to a RTLD_DI_MMAPS request. See EXAMPLES. RTLD_DI_MMAPS Obtain segment mapping information for the handle that is specified. The p argument is a Dl_mapinfo_t pointer (Dl_mapinfo_t *p). This structure must be initialized from a previous RTLD_DI_MMAPCNT request. Segment mapping information is provided in an array of mmapobj_result_t structures that originate from the mma- pobj(2) of the associated object. The dlm_cnt member from a previous RTLD_DI_MMAPCNT request must be used to allocate a mmapobj_result_t array. This array should be assigned to the dlm_maps member. This initialized struc- ture is then passed to a RTLD_DI_MMAPS request, where the segment mapping information is copied to the allo- cated mmapobj_result_t array. See EXAMPLES. ..... Example 2: Use dlinfo() to obtain segment information. The following example demonstrates how a dynamic object can inspect its segment mapping information. For simplicity, error checking has been omitted Dl_mapinfo_t mi; uint_t cnt; /* determine the number of segment mappings */ dlinfo(RTLD_SELF, RTLD_DI_MMAPCNT, &mi); /* allocate the appropriate mapping array */ mi.dlm_maps = malloc(mi.dlm_cnt * sizeof (mmapobj_result_t)); /* obtain the mapping information */ dlinfo(RTLD_SELF, RTLD_DI_MMAPS, &mi); for (cnt = 0; cnt < mi.dlm_cnt; cnt++) { (void) printf("addr=%x - memory size=%x\n", mi.dlm_maps[cnt].mr_addr, mi.dlm_maps[cnt].mr_msize); } ------------------------------------------------------------------------ Release binding: Patch/Micro dlfcn.h: Dl_mapinfo_t Committed. RTLD_DI_SERINFO Committed. RTLD_DI_SERINFOSIZE Committed. -- Rod.