Lines Matching refs:kernel
77 openkmod(kernel_t *kernel)
79 kernel->size = 4096;
81 kernel->iov.iov_base = malloc(kernel->size);
82 kernel->iov.iov_len = kernel->size;
83 if (modctl(MODCTL_STAT, &kernel->iov)) {
87 if (kernel->size >= kernel->iov.iov_len) {
90 free(kernel->iov.iov_base);
91 kernel->size = kernel->iov.iov_len;
93 kernel->size = kernel->iov.iov_len / sizeof(modstat_t);
94 qsort(kernel->iov.iov_base, kernel->size, sizeof(modstat_t), modcmp);
100 readkmod(kernel_t *kernel, kmod_t *module)
104 if (kernel->c * sizeof(*ms) >= kernel->iov.iov_len) {
107 ms = kernel->iov.iov_base;
108 ms += kernel->c++;
135 closekmod(kernel_t *kernel)
137 (void) free(kernel->iov.iov_base);
145 kernel_t kernel;
149 (void) memset(&kernel, 0x0, sizeof(kernel));
151 if (!openkmod(&kernel)) {
152 (void) fprintf(stderr, "can't read kernel modules\n");
155 for (modc = 0 ; readkmod(&kernel, &module) ; ) {
176 (void) closekmod(&kernel);
180 /* load the named module into the kernel */
212 /* and unload the module from the kernel */