Let the linker keep track of pseudo-devices needing initialization and

image activators, rather than listing them inline in the code.
This commit is contained in:
Garrett Wollman 1993-12-20 19:31:41 +00:00
parent cfefd68703
commit 92d91f7638
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=886
3 changed files with 39 additions and 3 deletions

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: aout_imgact.c,v 1.2 1993/12/19 00:51:14 wollman Exp $
* $Id: imgact_aout.c,v 1.1 1993/12/20 16:16:45 wollman Exp $
*/
#include "param.h"
@ -37,6 +37,7 @@
#include "exec.h"
#include "mman.h"
#include "imgact.h"
#include "kernel.h"
#include "vm/vm.h"
@ -179,3 +180,12 @@ exec_aout_imgact(iparams)
return (0);
}
/*
* Tell kern_execve.c about it, with a little help from the linker.
* Since `const' objects end up in the text segment, TEXT_SET is the
* correct directive to use.
*/
static const struct execsw aout_execsw = { exec_aout_imgact };
TEXT_SET(execsw_set, aout_execsw);

View File

@ -28,15 +28,22 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: shell_imgact.c,v 1.1 1993/12/12 12:23:20 davidg Exp $
* $Id: imgact_shell.c,v 1.1 1993/12/20 16:16:46 wollman Exp $
*/
#include "param.h"
#include "systm.h"
#include "resourcevar.h"
#include "imgact.h"
#include "kernel.h"
#include "machine/endian.h"
#if BYTE_ORDER == LITTLE_ENDIAN
#define SHELLMAGIC 0x2123 /* #! */
#else
#define SHELLMAGIC 0x2321
#endif
#define MAXSHELLCMDLEN 64
/*
@ -127,3 +134,11 @@ exec_shell_imgact(iparams)
return(0);
}
/*
* Tell kern_execve.c about it, with a little help from the linker.
* Since `const' objects end up in the text segment, TEXT_SET is the
* correct directive to use.
*/
static const struct execsw shell_execsw = { exec_shell_imgact };
TEXT_SET(execsw_set, shell_execsw);

View File

@ -30,9 +30,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: imgact.h,v 1.2 1993/12/11 06:56:02 davidg Exp davidg $
* $Id: imgact.h,v 1.1 1993/12/12 12:31:40 davidg Exp $
*/
#ifndef __h_imgact
#define __h_imgact 1
#include "proc.h"
#include "namei.h"
#include "vnode.h"
@ -58,3 +61,11 @@ struct image_params {
char interpreted; /* flag - this executable is interpreted */
char interpreter_name[64]; /* name of the interpreter */
};
struct execsw {
int (*ex_imgact)(struct image_params *);
};
extern const struct execsw **execsw;
#endif /* __h_imgact */