From: semarie Date: Sun, 21 Mar 2021 11:29:38 +0000 (+0000) Subject: makes `struct execsw' to: X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c49c61c6189f292e7cc497671b99c396a5890d71;p=openbsd makes `struct execsw' to: - use C99-style initialization (grep works better with that) - use const as execsw is not modified during runtime ok mpi@ --- diff --git a/sys/kern/exec_conf.c b/sys/kern/exec_conf.c index 43b0ebb9c12..e35e229e0d4 100644 --- a/sys/kern/exec_conf.c +++ b/sys/kern/exec_conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_conf.c,v 1.36 2019/11/28 04:34:50 guenther Exp $ */ +/* $OpenBSD: exec_conf.c,v 1.37 2021/03/21 11:29:38 semarie Exp $ */ /* $NetBSD: exec_conf.c,v 1.16 1995/12/09 05:34:47 cgd Exp $ */ /* @@ -38,9 +38,15 @@ extern struct emul emul_native; -struct execsw execsw[] = { - { EXEC_SCRIPT_HDRSZ, exec_script_makecmds }, /* shell scripts */ - { sizeof(Elf_Ehdr), exec_elf_makecmds }, /* elf binaries */ +const struct execsw execsw[] = { + { /* shell scripts */ + .es_hdrsz = EXEC_SCRIPT_HDRSZ, + .es_check = exec_script_makecmds, + }, + { /* elf binaries */ + .es_hdrsz = sizeof(Elf_Ehdr), + .es_check = exec_elf_makecmds, + }, }; int nexecs = (sizeof execsw / sizeof(*execsw)); int exec_maxhdrsz; diff --git a/sys/sys/exec.h b/sys/sys/exec.h index 5158eb25e5c..a726202ebc6 100644 --- a/sys/sys/exec.h +++ b/sys/sys/exec.h @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.h,v 1.42 2020/06/28 09:29:57 kettenis Exp $ */ +/* $OpenBSD: exec.h,v 1.43 2021/03/21 11:29:38 semarie Exp $ */ /* $NetBSD: exec.h,v 1.59 1996/02/09 18:25:09 christos Exp $ */ /*- @@ -212,7 +212,7 @@ void new_vmcmd(struct exec_vmcmd_set *evsp, * Functions for specific exec types should be defined in their own * header file. */ -extern struct execsw execsw[]; +extern const struct execsw execsw[]; extern int nexecs; extern int exec_maxhdrsz;