Commit dafb9e03 authored by rtoy's avatar rtoy
Browse files

Add os_init0 to allow for some really early OS inits.

On Linux, os_init can re-exec lisp to set up the correct personality.
Not normally a problem, but if any output happens before os_init is
called, the output appears to happen twice.  So add os_init0 to do
this early on, before any output.  This is a bit of a kludge.

lisp/lisp.c:
o Call os_init0 early in main.

lisp/Linux-os.c:
o Move the personality stuff from os_init to os_init0.

lisp/Darwin-os.c:
lisp/FreeBSD-os.c:
lisp/NetBSD-os.c:
lisp/OpenBSD-os.c:
lisp/hpux-os.c:
lisp/irix-os.c:
lisp/mach-os.c:
lisp/osf1-os.c:
lisp/solaris-os.c:
lisp/sunos-os.c:
o Add dummy implementation of os_init0.  These OSes don't (currently)
  need anything special.

lisp/os.h:
o Declare os_init0.
parent 4970f6a7
......@@ -14,7 +14,7 @@
* Frobbed for OpenBSD by Pierre R. Mai, 2001.
* Frobbed for Darwin by Pierre R. Mai, 2003.
*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Darwin-os.c,v 1.32 2011/09/01 04:39:56 rtoy Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Darwin-os.c,v 1.33 2011/09/01 05:18:26 rtoy Exp $
*
*/
......@@ -99,6 +99,9 @@ timebase_init(void)
}
#endif
void
os_init0(const char *argv[], const char *envp[])
{}
void
os_init(const char *argv[], const char *envp[])
......
......@@ -12,7 +12,7 @@
* Much hacked by Paul Werkowski
* GENCGC support by Douglas Crosher, 1996, 1997.
*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/FreeBSD-os.c,v 1.37 2010/12/26 16:04:43 rswindells Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/FreeBSD-os.c,v 1.38 2011/09/01 05:18:26 rtoy Exp $
*
*/
......@@ -38,6 +38,10 @@
vm_size_t os_vm_page_size;
void
os_init0(const char *argv[], const char *envp[])
{}
void
os_init(const char *argv[], const char *envp[])
{
......
......@@ -15,7 +15,7 @@
* GENCGC support by Douglas Crosher, 1996, 1997.
* Alpha support by Julian Dolby, 1999.
*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.c,v 1.51 2010/12/26 16:04:43 rswindells Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.c,v 1.52 2011/09/01 05:18:26 rtoy Exp $
*
*/
......@@ -131,6 +131,15 @@ check_personality(struct utsname *name, const char *argv[], const char *envp[])
#endif
}
void
os_init0(const char *argv[], const char *envp[])
{
struct utsname name;
uname(&name);
check_personality(&name, argv, envp);
}
void
os_init(const char *argv[], const char *envp[])
{
......@@ -146,8 +155,6 @@ os_init(const char *argv[], const char *envp[])
}
os_vm_page_size = getpagesize();
check_personality(&name, argv, envp);
}
#ifdef __i386
......
......@@ -15,7 +15,7 @@
* Frobbed for OpenBSD by Pierre R. Mai, 2001.
* Frobbed for NetBSD by Pierre R. Mai, 2002.
*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/NetBSD-os.c,v 1.19 2010/12/26 16:04:43 rswindells Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/NetBSD-os.c,v 1.20 2011/09/01 05:18:26 rtoy Exp $
*
*/
......@@ -45,6 +45,10 @@ size_t os_vm_page_size;
#endif
void
os_init0(const char *argv[], const char *envp[])
{}
void
os_init(const char *argv[], const char *envp[])
{
......
......@@ -13,7 +13,7 @@
* GENCGC support by Douglas Crosher, 1996, 1997.
* Frobbed for OpenBSD by Pierre R. Mai, 2001.
*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/OpenBSD-os.c,v 1.10 2010/02/01 16:04:43 rtoy Rel $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/OpenBSD-os.c,v 1.11 2011/09/01 05:18:26 rtoy Exp $
*
*/
......@@ -40,6 +40,10 @@ vm_size_t os_vm_page_size;
#endif
void
os_init0(const char *argv[], const char *envp[])
{}
void
os_init(const char *argv[], const char *envp[])
{
......
/*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/hpux-os.c,v 1.10 2010/02/01 16:04:43 rtoy Rel $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/hpux-os.c,v 1.11 2011/09/01 05:18:26 rtoy Exp $
*
* OS-dependent routines. This file (along with os.h) exports an
* OS-independent interface to the operating system VM facilities.
......@@ -52,6 +52,10 @@ static struct segment {
os_vm_address_t protected;
} segments[MAX_SEGMENTS];
void
os_init0(const char *argv[], const char *envp[])
{}
void
os_init(const char *argv[], const char *envp[])
{
......
/*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/irix-os.c,v 1.6 2010/02/01 16:04:43 rtoy Rel $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/irix-os.c,v 1.7 2011/09/01 05:18:26 rtoy Exp $
*
* OS-dependent routines. This file (along with os.h) exports an
* OS-independent interface to the operating system VM facilities.
......@@ -29,6 +29,10 @@ os_vm_size_t os_vm_page_size = (-1);
int zero_fd;
void
os_init0(const char *argv[], const char *envp[])
{}
void
os_init(const char *argv[], const char *envp[])
{
......
/*
* main() entry point for a stand alone lisp image.
*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.83 2011/06/10 19:32:31 rtoy Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.84 2011/09/01 05:18:26 rtoy Exp $
*
*/
......@@ -461,6 +461,16 @@ main(int argc, const char *argv[], const char *envp[])
}
/*
* Do any special OS initialization that needs to be done early.
* In particular, on Linux, we might re-exec ourselves to set our
* personality correctly. Not normally a problem, but this does
* cause any output to happen twice. That can be confusing.
*
* So make sure we don't do any output before this point!
*/
os_init0(argv, envp);
#if defined(SVR4)
tzset();
#endif
......
/*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/mach-os.c,v 1.8 2010/02/01 16:04:43 rtoy Rel $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/mach-os.c,v 1.9 2011/09/01 05:18:26 rtoy Exp $
*
* OS-dependent routines. This file (along with os.h) exports an
* OS-independent interface to the operating system VM facilities.
......@@ -37,6 +37,10 @@ task_self(void)
}
#endif
void
os_init0(const char *argv[], const char *envp[])
{}
void
os_init(const char *argv[], const char *envp[])
{
......
/*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/os.h,v 1.27 2010/12/26 16:04:43 rswindells Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/os.h,v 1.28 2011/09/01 05:18:26 rtoy Exp $
*
* Common interface for os-dependent functions.
*
......@@ -72,6 +72,7 @@
extern os_vm_size_t os_vm_page_size;
extern void os_init0(const char *argv[], const char *envp[]);
extern void os_init(const char *argv[], const char *envp[]);
extern void os_install_interrupt_handlers(void);
......
/*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/osf1-os.c,v 1.6 2010/02/01 16:04:43 rtoy Rel $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/osf1-os.c,v 1.7 2011/09/01 05:18:26 rtoy Exp $
*
* OS-dependent routines. This file (along with os.h) exports an
* OS-independent interface to the operating system VM facilities.
......@@ -25,6 +25,10 @@
vm_size_t os_vm_page_size;
void
os_init0(const char *argv[], const char *envp[])
{}
void
os_init(const char *argv[], const char *envp[])
{
......
/*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/solaris-os.c,v 1.29 2010/12/26 16:04:43 rswindells Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/solaris-os.c,v 1.30 2011/09/01 05:18:26 rtoy Exp $
*
* OS-dependent routines. This file (along with os.h) exports an
* OS-independent interface to the operating system VM facilities.
......@@ -72,6 +72,10 @@ os_init_bailout(char *arg)
exit(1);
}
void
os_init0(const char *argv[], const char *envp[])
{}
void
os_init(const char *argv[], const char *envp[])
{
......
/*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/sunos-os.c,v 1.12 2010/02/01 16:04:43 rtoy Rel $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/sunos-os.c,v 1.13 2011/09/01 05:18:26 rtoy Exp $
*
* OS-dependent routines. This file (along with os.h) exports an
* OS-independent interface to the operating system VM facilities.
......@@ -80,6 +80,10 @@ os_init_bailout(arg)
exit(1);
}
void
os_init0(const char *argv[], const char *envp[])
{}
void
os_init(const char *argv[], const char *envp[])
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment