image activators, rather than listing them inline in the code.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* 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 "exec.h"
#include "mman.h"
#include "imgact.h"
#include "exec.h"
#include "mman.h"
#include "imgact.h"
+
+/*
+ * 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);
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* 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 "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 /* #! */
#define SHELLMAGIC 0x2123 /* #! */
+#else
+#define SHELLMAGIC 0x2321
+#endif
+
#define MAXSHELLCMDLEN 64
/*
#define MAXSHELLCMDLEN 64
/*
+
+/*
+ * 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);
* SUCH DAMAGE.
*
* from: @(#)init_main.c 7.41 (Berkeley) 5/15/91
* SUCH DAMAGE.
*
* from: @(#)init_main.c 7.41 (Berkeley) 5/15/91
- * $Id: init_main.c,v 1.10 1993/11/25 13:16:07 davidg Exp $
+ * $Id: init_main.c,v 1.11 1993/12/19 00:51:18 wollman Exp $
+const char copyright[] =
"Copyright (c) 1989,1990,1991,1992 William F. Jolitz. All rights reserved.\n\
Copyright (c) 1982,1986,1989,1991 The Regents of the University\n\
of California. All rights reserved.\n\n";
"Copyright (c) 1989,1990,1991,1992 William F. Jolitz. All rights reserved.\n\
Copyright (c) 1982,1986,1989,1991 The Regents of the University\n\
of California. All rights reserved.\n\n";
+/*
+ * This table is filled in by the linker with functions that need to be
+ * called to initialize various pseudo-devices and whatnot.
+ */
+typedef void (*pseudo_func_t)(void);
+extern const struct linker_set pseudo_set;
+static const pseudo_func_t *pseudos =
+ (const pseudo_func_t *)&pseudo_set.ls_items[0];
+
/*
* System startup; initialize the world, create process 0,
* mount root filesystem, and fork to create init and pagedaemon.
/*
* System startup; initialize the world, create process 0,
* mount root filesystem, and fork to create init and pagedaemon.
* Initialize tables, protocols, and set up well-known inodes.
*/
mbinit();
* Initialize tables, protocols, and set up well-known inodes.
*/
mbinit();
-#ifdef SYSVSHM
- shminit();
-#endif
-#include "sl.h"
-#if NSL > 0
- slattach(); /* XXX */
-#endif
-#include "ppp.h"
-#if NPPP > 0
- pppattach(); /* XXX */
-#endif
-#include "loop.h"
-#if NLOOP > 0
- loattach(); /* XXX */
-#endif
+
+ while(*pseudos) {
+ (**pseudos)();
+ }
+
/*
* Block reception of incoming packets
* until protocols have been initialized.
/*
* Block reception of incoming packets
* until protocols have been initialized.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: kern_execve.c,v 1.10 1993/12/12 12:23:19 davidg Exp $
+ * $Id: kern_execve.c,v 1.11 1993/12/19 00:51:23 wollman Exp $
#include "signalvar.h"
#include "resourcevar.h"
#include "imgact.h"
#include "signalvar.h"
#include "resourcevar.h"
#include "imgact.h"
#include "mount.h"
#include "file.h"
#include "acct.h"
#include "mount.h"
#include "file.h"
#include "acct.h"
int exec_extract_strings __P((struct image_params *));
caddr_t exec_copyout_strings __P((struct image_params *));
int exec_extract_strings __P((struct image_params *));
caddr_t exec_copyout_strings __P((struct image_params *));
-int exec_aout_imgact __P((struct image_params *));
-int exec_shell_imgact __P((struct image_params *));
-
-struct execsw {
- int (*imgact) __P((struct image_params *));
-};
-
-struct execsw execsw[] = {
- { exec_aout_imgact },
- { exec_shell_imgact },
- { NULL },
- { NULL },
- { NULL },
- { NULL },
- { NULL },
- { NULL },
-};
+/*
+ * execsw_set is constructed for us by the linker. Each of the items
+ * is a pointer to a `const struct execsw', hence the double pointer here.
+ */
+extern const struct linker_set execsw_set;
+const struct execsw **execsw = (const struct execsw **)&execsw_set.ls_items[0];
/*
* execve() system call.
*/
/*
* execve() system call.
*/
int
execve(p, uap, retval)
struct proc *p;
int
execve(p, uap, retval)
struct proc *p;
* image is interpreted, loop back up and try activating
* the interpreter.
*/
* image is interpreted, loop back up and try activating
* the interpreter.
*/
- for (i = 0; i < sizeof(execsw)/sizeof(execsw[0]); ++i) {
- if (execsw[i].imgact)
- error = (*execsw[i].imgact)(iparams);
+ for (i = 0; execsw[i]; ++i) {
+ if (execsw[i]->ex_imgact)
+ error = (*execsw[i]->ex_imgact)(iparams);
*
* from: Utah $Hdr: uipc_shm.c 1.9 89/08/14$
* from: @(#)sysv_shm.c 7.15 (Berkeley) 5/13/91
*
* from: Utah $Hdr: uipc_shm.c 1.9 89/08/14$
* from: @(#)sysv_shm.c 7.15 (Berkeley) 5/13/91
- * $Id: sysv_shm.c,v 1.6 1993/11/25 01:33:24 wollman Exp $
+ * $Id: sysv_shm.c,v 1.7 1993/12/19 00:51:37 wollman Exp $
+TEXT_SET(pseudo_set, shminit);
+
/*
* Entry point for all SHM calls
*/
/*
* Entry point for all SHM calls
*/
* SUCH DAMAGE.
*
* from: @(#)if_loop.c 7.13 (Berkeley) 4/26/91
* SUCH DAMAGE.
*
* from: @(#)if_loop.c 7.13 (Berkeley) 4/26/91
- * $Id: if_loop.c,v 1.4 1993/11/15 20:45:58 wollman Exp $
+ * $Id: if_loop.c,v 1.5 1993/11/25 01:34:03 wollman Exp $
#include "socket.h"
#include "errno.h"
#include "ioctl.h"
#include "socket.h"
#include "errno.h"
#include "ioctl.h"
#include "../net/if.h"
#include "../net/if_types.h"
#include "../net/if.h"
#include "../net/if_types.h"
#include "bpfilter.h"
#if NBPFILTER > 0
#include "bpfilter.h"
#if NBPFILTER > 0
-#include <sys/time.h>
-#include <net/bpf.h>
+#include "sys/time.h"
+#include "net/bpf.h"
static caddr_t lo_bpf;
#endif
static caddr_t lo_bpf;
#endif
+TEXT_SET(pseudo_set, loattach);
+
int
looutput(ifp, m, dst, rt)
struct ifnet *ifp;
int
looutput(ifp, m, dst, rt)
struct ifnet *ifp;
- * $Id: if_ppp.c,v 1.5 1993/11/25 01:34:04 wollman Exp $
+ * $Id: if_ppp.c,v 1.6 1993/12/19 00:52:03 wollman Exp $
* From: if_ppp.c,v 1.22 1993/08/31 23:20:40 paulus Exp
* From: if_ppp.c,v 1.21 1993/08/29 11:22:37 paulus Exp
* From: if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp
* From: if_ppp.c,v 1.22 1993/08/31 23:20:40 paulus Exp
* From: if_ppp.c,v 1.21 1993/08/29 11:22:37 paulus Exp
* From: if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp
#include "systm.h"
#include "proc.h"
#include "mbuf.h"
#include "systm.h"
#include "proc.h"
#include "mbuf.h"
-#include "buf.h"
-#include "dkstat.h"
#include "socket.h"
#include "ioctl.h"
#include "file.h"
#include "tty.h"
#include "kernel.h"
#include "conf.h"
#include "socket.h"
#include "ioctl.h"
#include "file.h"
#include "tty.h"
#include "kernel.h"
#include "conf.h"
#include "if.h"
#include "if_types.h"
#include "if.h"
#include "if_types.h"
+TEXT_SET(pseudo_set, pppattach);
+
/*
* Line specific open routine.
* Attach the given tty to the first available ppp unit.
/*
* Line specific open routine.
* Attach the given tty to the first available ppp unit.
* SUCH DAMAGE.
*
* from: @(#)if_sl.c 7.22 (Berkeley) 4/20/91
* SUCH DAMAGE.
*
* from: @(#)if_sl.c 7.22 (Berkeley) 4/20/91
- * $Id: if_sl.c,v 1.5 1993/11/16 02:47:24 wollman Exp $
+ * $Id: if_sl.c,v 1.6 1993/11/25 01:34:06 wollman Exp $
* interrupts and network activity; thus, splimp must be >= spltty.
*/
* interrupts and network activity; thus, splimp must be >= spltty.
*/
-/* $Id: if_sl.c,v 1.5 1993/11/16 02:47:24 wollman Exp $ */
+/* $Id: if_sl.c,v 1.6 1993/11/25 01:34:06 wollman Exp $ */
/* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
#include "sl.h"
/* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
#include "sl.h"
#include "netinet/in_var.h"
#include "netinet/ip.h"
#else
#include "netinet/in_var.h"
#include "netinet/ip.h"
#else
+#error "Huh? Slip without inet?"
#endif
#include "machine/mtpr.h"
#endif
#include "machine/mtpr.h"
#include "bpfilter.h"
#if NBPFILTER > 0
#include "bpfilter.h"
#if NBPFILTER > 0
-#include <sys/time.h>
-#include <net/bpf.h>
+#include "sys/time.h"
+#include "net/bpf.h"
+TEXT_SET(pseudo_set, slattach);
+
static int
slinit(sc)
register struct sl_softc *sc;
static int
slinit(sc)
register struct sl_softc *sc;
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* 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"
#include "proc.h"
#include "namei.h"
#include "vnode.h"
char interpreted; /* flag - this executable is interpreted */
char interpreter_name[64]; /* name of the interpreter */
};
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 */
* SUCH DAMAGE.
*
* from: @(#)kernel.h 7.4 (Berkeley) 2/15/91
* SUCH DAMAGE.
*
* from: @(#)kernel.h 7.4 (Berkeley) 2/15/91
- * $Id: kernel.h,v 1.6 1993/12/19 00:55:17 wollman Exp $
+ * $Id: kernel.h,v 1.7 1993/12/20 16:13:05 wollman Exp $
*/
#ifndef _SYS_KERNEL_H_
*/
#ifndef _SYS_KERNEL_H_
#endif
extern const char *panicstr; /* panic message */
#endif
extern const char *panicstr; /* panic message */
-extern char version[]; /* system version */
-extern char copyright[]; /* system copyright */
+extern const char version[]; /* system version */
+extern const char copyright[]; /* system copyright */
extern int nblkdev; /* number of entries in bdevsw */
extern int nchrdev; /* number of entries in cdevsw */
extern int nblkdev; /* number of entries in bdevsw */
extern int nchrdev; /* number of entries in cdevsw */