#ifndef MODUTILS_MODULE_H
#define MODUTILS_MODULE_H 1
-#ident "$Id: insmod.c,v 1.9 2000/06/19 19:53:30 andersen Exp $"
+#ident "$Id: insmod.c,v 1.10 2000/06/22 18:19:31 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
#ifndef MODUTILS_OBJ_H
#define MODUTILS_OBJ_H 1
-#ident "$Id: insmod.c,v 1.9 2000/06/19 19:53:30 andersen Exp $"
+#ident "$Id: insmod.c,v 1.10 2000/06/22 18:19:31 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
str = alloca(strlen(q));
for (r = str, q++; *q != '"'; ++q, ++r) {
if (*q == '\0') {
- fprintf(stderr,
- "improperly terminated string argument for %s\n",
- p);
+ fprintf(stderr, "improperly terminated string argument for %s\n", p);
return 0;
} else if (*q == '\\')
switch (*++q) {
nks = get_kernel_syms(NULL);
if (nks < 0) {
- perror("get_kernel_syms: %m");
+ errorMsg("get_kernel_syms: %s: %s", m_name, strerror(errno));
return 0;
}
m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN
: 0), &routines, symtab);
if (ret)
- perror("init_module: %m");
+ errorMsg("init_module: %s: %s", m_name, strerror(errno));
free(image);
free(symtab);
module_names = xrealloc(module_names, bufsize = ret);
goto retry_modules_load;
}
- perror("QM_MODULES: %m\n");
+ errorMsg("QM_MODULES: %s", strerror(errno));
return 0;
}
/* The module was removed out from underneath us. */
continue;
}
- perror("query_module: QM_INFO: %m");
+ errorMsg("query_module: QM_INFO: %s: %s", mn, strerror(errno));
return 0;
}
/* The module was removed out from underneath us. */
continue;
default:
- perror("query_module: QM_SYMBOLS: %m");
+ errorMsg("query_module: QM_SYMBOLS: %s: %s", mn, strerror(errno));
return 0;
}
}
syms = xrealloc(syms, bufsize = ret);
goto retry_kern_sym_load;
}
- perror("kernel: QM_SYMBOLS: %m");
+ errorMsg("kernel: QM_SYMBOLS: %s", strerror(errno));
return 0;
}
nksyms = nsyms = ret;
ret = new_sys_init_module(m_name, (struct new_module *) image);
if (ret)
- perror("init_module: %m");
+ errorMsg("init_module: %s: %s", m_name, strerror(errno));
free(image);
fseek(fp, 0, SEEK_SET);
if (fread(&f->header, sizeof(f->header), 1, fp) != 1) {
- perror("error reading ELF header: %m");
+ errorMsg("error reading ELF header: %s", strerror(errno));
return NULL;
}
section_headers = alloca(sizeof(ElfW(Shdr)) * shnum);
fseek(fp, f->header.e_shoff, SEEK_SET);
if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) {
- perror("error reading ELF section headers: %m");
+ errorMsg("error reading ELF section headers: %s", strerror(errno));
return NULL;
}
sec->contents = xmalloc(sec->header.sh_size);
fseek(fp, sec->header.sh_offset, SEEK_SET);
if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) {
- fprintf(stderr,
- "error reading ELF section data: %m\n");
+ errorMsg("error reading ELF section data: %s", strerror(errno));
return NULL;
}
} else {
if (m_filename[0] == '\0'
|| ((fp = fopen(m_filename, "r")) == NULL))
{
- perror("No module by that name found in " _PATH_MODULES
- "\n");
+ errorMsg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
exit(FALSE);
}
}
m_size);
goto out;
default:
- perror("create_module: %m");
+ errorMsg("create_module: %s: %s", m_name, strerror(errno));
goto out;
}
#ifndef MODUTILS_MODULE_H
#define MODUTILS_MODULE_H 1
-#ident "$Id: insmod.c,v 1.9 2000/06/19 19:53:30 andersen Exp $"
+#ident "$Id: insmod.c,v 1.10 2000/06/22 18:19:31 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
#ifndef MODUTILS_OBJ_H
#define MODUTILS_OBJ_H 1
-#ident "$Id: insmod.c,v 1.9 2000/06/19 19:53:30 andersen Exp $"
+#ident "$Id: insmod.c,v 1.10 2000/06/22 18:19:31 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
str = alloca(strlen(q));
for (r = str, q++; *q != '"'; ++q, ++r) {
if (*q == '\0') {
- fprintf(stderr,
- "improperly terminated string argument for %s\n",
- p);
+ fprintf(stderr, "improperly terminated string argument for %s\n", p);
return 0;
} else if (*q == '\\')
switch (*++q) {
nks = get_kernel_syms(NULL);
if (nks < 0) {
- perror("get_kernel_syms: %m");
+ errorMsg("get_kernel_syms: %s: %s", m_name, strerror(errno));
return 0;
}
m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN
: 0), &routines, symtab);
if (ret)
- perror("init_module: %m");
+ errorMsg("init_module: %s: %s", m_name, strerror(errno));
free(image);
free(symtab);
module_names = xrealloc(module_names, bufsize = ret);
goto retry_modules_load;
}
- perror("QM_MODULES: %m\n");
+ errorMsg("QM_MODULES: %s", strerror(errno));
return 0;
}
/* The module was removed out from underneath us. */
continue;
}
- perror("query_module: QM_INFO: %m");
+ errorMsg("query_module: QM_INFO: %s: %s", mn, strerror(errno));
return 0;
}
/* The module was removed out from underneath us. */
continue;
default:
- perror("query_module: QM_SYMBOLS: %m");
+ errorMsg("query_module: QM_SYMBOLS: %s: %s", mn, strerror(errno));
return 0;
}
}
syms = xrealloc(syms, bufsize = ret);
goto retry_kern_sym_load;
}
- perror("kernel: QM_SYMBOLS: %m");
+ errorMsg("kernel: QM_SYMBOLS: %s", strerror(errno));
return 0;
}
nksyms = nsyms = ret;
ret = new_sys_init_module(m_name, (struct new_module *) image);
if (ret)
- perror("init_module: %m");
+ errorMsg("init_module: %s: %s", m_name, strerror(errno));
free(image);
fseek(fp, 0, SEEK_SET);
if (fread(&f->header, sizeof(f->header), 1, fp) != 1) {
- perror("error reading ELF header: %m");
+ errorMsg("error reading ELF header: %s", strerror(errno));
return NULL;
}
section_headers = alloca(sizeof(ElfW(Shdr)) * shnum);
fseek(fp, f->header.e_shoff, SEEK_SET);
if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) {
- perror("error reading ELF section headers: %m");
+ errorMsg("error reading ELF section headers: %s", strerror(errno));
return NULL;
}
sec->contents = xmalloc(sec->header.sh_size);
fseek(fp, sec->header.sh_offset, SEEK_SET);
if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) {
- fprintf(stderr,
- "error reading ELF section data: %m\n");
+ errorMsg("error reading ELF section data: %s", strerror(errno));
return NULL;
}
} else {
if (m_filename[0] == '\0'
|| ((fp = fopen(m_filename, "r")) == NULL))
{
- perror("No module by that name found in " _PATH_MODULES
- "\n");
+ errorMsg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
exit(FALSE);
}
}
m_size);
goto out;
default:
- perror("create_module: %m");
+ errorMsg("create_module: %s: %s", m_name, strerror(errno));
goto out;
}