29 #include <sys/sunddi.h>
30 #include <sys/stddef.h>
31 #endif /* _KERNEL */
32
33 #include <core_shstrtab.h>
34
35 const char *shstrtab_data[STR_NUM] = {
36 "",
37 ".SUNW_ctf",
38 ".symtab",
39 ".dynsym",
40 ".strtab",
41 ".dynstr",
42 ".shstrtab"
43 };
44
45 static void *
46 shstrtab_alloc(void)
47 {
48 #ifdef _KERNEL
49 return (kmem_zalloc(sizeof (shstrtab_ent_t),
50 KM_NOSLEEP | KM_NORMALPRI));
51 #else
52 return (calloc(1, sizeof (shstrtab_ent_t)));
53 #endif
54 }
55
56 static void
57 shstrtab_free(shstrtab_ent_t *ent)
58 {
59 #ifdef _KERNEL
60 if (ent->sste_name != NULL) {
61 strfree(ent->sste_name);
62 }
63 kmem_free(ent, sizeof (*ent));
64 #else
65 free(ent->sste_name);
66 free(ent);
67 #endif
68 }
69
70
|
29 #include <sys/sunddi.h>
30 #include <sys/stddef.h>
31 #endif /* _KERNEL */
32
33 #include <core_shstrtab.h>
34
35 const char *shstrtab_data[STR_NUM] = {
36 "",
37 ".SUNW_ctf",
38 ".symtab",
39 ".dynsym",
40 ".strtab",
41 ".dynstr",
42 ".shstrtab"
43 };
44
45 static void *
46 shstrtab_alloc(void)
47 {
48 #ifdef _KERNEL
49 return (kmem_zalloc(sizeof (shstrtab_ent_t), KM_NOSLEEP_LAZY));
50 #else
51 return (calloc(1, sizeof (shstrtab_ent_t)));
52 #endif
53 }
54
55 static void
56 shstrtab_free(shstrtab_ent_t *ent)
57 {
58 #ifdef _KERNEL
59 if (ent->sste_name != NULL) {
60 strfree(ent->sste_name);
61 }
62 kmem_free(ent, sizeof (*ent));
63 #else
64 free(ent->sste_name);
65 free(ent);
66 #endif
67 }
68
69
|