version 1.257.4.1, 2008/01/02 21:55:48 |
version 1.257.4.2, 2008/01/08 22:11:32 |
Line 86 static int exec_sigcode_map(struct proc |
|
Line 86 static int exec_sigcode_map(struct proc |
|
#define DPRINTF(a) |
#define DPRINTF(a) |
#endif /* DEBUG_EXEC */ |
#endif /* DEBUG_EXEC */ |
|
|
MALLOC_DEFINE(M_EXEC, "exec", "argument lists & other mem used by exec"); |
|
|
|
/* |
/* |
* Exec function switch: |
* Exec function switch: |
* |
* |
Line 1168 emul_register(const struct emul *emul, i |
|
Line 1166 emul_register(const struct emul *emul, i |
|
goto out; |
goto out; |
} |
} |
|
|
MALLOC(ee, struct emul_entry *, sizeof(struct emul_entry), |
ee = kmem_alloc(sizeof(*ee), KM_SLEEP); |
M_EXEC, M_WAITOK); |
|
ee->el_emul = emul; |
ee->el_emul = emul; |
ee->ro_entry = ro_entry; |
ee->ro_entry = ro_entry; |
LIST_INSERT_HEAD(&el_head, ee, el_list); |
LIST_INSERT_HEAD(&el_head, ee, el_list); |
Line 1238 emul_unregister(const char *name) |
|
Line 1235 emul_unregister(const char *name) |
|
|
|
/* entry is not used, remove it */ |
/* entry is not used, remove it */ |
LIST_REMOVE(it, el_list); |
LIST_REMOVE(it, el_list); |
FREE(it, M_EXEC); |
kmem_free(it, sizeof(*it)); |
|
|
out: |
out: |
rw_exit(&exec_lock); |
rw_exit(&exec_lock); |
Line 1276 exec_add(struct execsw *esp, const char |
|
Line 1273 exec_add(struct execsw *esp, const char |
|
} |
} |
|
|
/* if we got here, the entry doesn't exist yet */ |
/* if we got here, the entry doesn't exist yet */ |
MALLOC(it, struct exec_entry *, sizeof(struct exec_entry), |
it = kmem_alloc(sizeof(*it), KM_SLEEP); |
M_EXEC, M_WAITOK); |
|
it->es = esp; |
it->es = esp; |
LIST_INSERT_HEAD(&ex_head, it, ex_list); |
LIST_INSERT_HEAD(&ex_head, it, ex_list); |
|
|
Line 1315 exec_remove(const struct execsw *esp) |
|
Line 1311 exec_remove(const struct execsw *esp) |
|
|
|
/* remove item from list and free resources */ |
/* remove item from list and free resources */ |
LIST_REMOVE(it, ex_list); |
LIST_REMOVE(it, ex_list); |
FREE(it, M_EXEC); |
kmem_free(it, sizeof(*it)); |
|
|
/* update execsw[] */ |
/* update execsw[] */ |
exec_init(0); |
exec_init(0); |
Line 1418 exec_init(int init_boot) |
|
Line 1414 exec_init(int init_boot) |
|
* Now that we have sorted all execw entries, create new execsw[] |
* Now that we have sorted all execw entries, create new execsw[] |
* and free no longer needed memory in the process. |
* and free no longer needed memory in the process. |
*/ |
*/ |
new_es = malloc(es_sz * sizeof(struct execsw *), M_EXEC, M_WAITOK); |
new_es = kmem_alloc(es_sz * sizeof(struct execsw *), KM_SLEEP); |
for(i=0; list; i++) { |
for(i=0; list; i++) { |
new_es[i] = list->es; |
new_es[i] = list->es; |
e1 = list->next; |
e1 = list->next; |
Line 1431 exec_init(int init_boot) |
|
Line 1427 exec_init(int init_boot) |
|
* used memory. |
* used memory. |
*/ |
*/ |
old_es = execsw; |
old_es = execsw; |
execsw = new_es; |
|
nexecs = es_sz; |
|
if (old_es) |
if (old_es) |
/*XXXUNCONST*/ |
/*XXXUNCONST*/ |
free(__UNCONST(old_es), M_EXEC); |
kmem_free(__UNCONST(old_es), nexecs * sizeof(struct execsw *)); |
|
execsw = new_es; |
|
nexecs = es_sz; |
|
|
/* |
/* |
* Figure out the maximum size of an exec header. |
* Figure out the maximum size of an exec header. |
Line 1467 exec_init(int init_boot) |
|
Line 1463 exec_init(int init_boot) |
|
|
|
/* do one-time initializations */ |
/* do one-time initializations */ |
nexecs = nexecs_builtin; |
nexecs = nexecs_builtin; |
execsw = malloc(nexecs*sizeof(struct execsw *), M_EXEC, M_WAITOK); |
execsw = kmem_alloc(nexecs * sizeof(struct execsw *), KM_SLEEP); |
|
|
/* |
/* |
* Fill in execsw[] and figure out the maximum size of an exec header. |
* Fill in execsw[] and figure out the maximum size of an exec header. |