[cmucl-cvs] CMUCL commit: src/lisp (13 files)

Raymond Toy rtoy at common-lisp.net
Thu Sep 1 05:18:26 UTC 2011


    Date: Wednesday, August 31, 2011 @ 22:18:26
  Author: rtoy
    Path: /project/cmucl/cvsroot/src/lisp

Modified: Darwin-os.c FreeBSD-os.c Linux-os.c NetBSD-os.c OpenBSD-os.c
          hpux-os.c irix-os.c lisp.c mach-os.c os.h osf1-os.c solaris-os.c
          sunos-os.c

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.


--------------+
 Darwin-os.c  |    5 ++++-
 FreeBSD-os.c |    6 +++++-
 Linux-os.c   |   13 ++++++++++---
 NetBSD-os.c  |    6 +++++-
 OpenBSD-os.c |    6 +++++-
 hpux-os.c    |    6 +++++-
 irix-os.c    |    6 +++++-
 lisp.c       |   12 +++++++++++-
 mach-os.c    |    6 +++++-
 os.h         |    3 ++-
 osf1-os.c    |    6 +++++-
 solaris-os.c |    6 +++++-
 sunos-os.c   |    6 +++++-
 13 files changed, 72 insertions(+), 15 deletions(-)


Index: src/lisp/Darwin-os.c
diff -u src/lisp/Darwin-os.c:1.32 src/lisp/Darwin-os.c:1.33
--- src/lisp/Darwin-os.c:1.32	Wed Aug 31 21:39:56 2011
+++ src/lisp/Darwin-os.c	Wed Aug 31 22:18:26 2011
@@ -14,7 +14,7 @@
  * Frobbed for OpenBSD by Pierre R. Mai, 2001.
  * Frobbed for Darwin by Pierre R. Mai, 2003.
  *
- * $Header: /project/cmucl/cvsroot/src/lisp/Darwin-os.c,v 1.32 2011/09/01 04:39:56 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/Darwin-os.c,v 1.33 2011/09/01 05:18:26 rtoy Exp $
  *
  */
 
@@ -99,6 +99,9 @@
 }
 #endif
 
+void
+os_init0(const char *argv[], const char *envp[])
+{}
 
 void
 os_init(const char *argv[], const char *envp[])
Index: src/lisp/FreeBSD-os.c
diff -u src/lisp/FreeBSD-os.c:1.37 src/lisp/FreeBSD-os.c:1.38
--- src/lisp/FreeBSD-os.c:1.37	Sun Dec 26 08:04:43 2010
+++ src/lisp/FreeBSD-os.c	Wed Aug 31 22:18:26 2011
@@ -12,7 +12,7 @@
  * Much hacked by Paul Werkowski
  * GENCGC support by Douglas Crosher, 1996, 1997.
  *
- * $Header: /project/cmucl/cvsroot/src/lisp/FreeBSD-os.c,v 1.37 2010/12/26 16:04:43 rswindells Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/FreeBSD-os.c,v 1.38 2011/09/01 05:18:26 rtoy Exp $
  *
  */
 
@@ -39,6 +39,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[])
 {
     os_vm_page_size = getpagesize();
Index: src/lisp/Linux-os.c
diff -u src/lisp/Linux-os.c:1.51 src/lisp/Linux-os.c:1.52
--- src/lisp/Linux-os.c:1.51	Sun Dec 26 08:04:43 2010
+++ src/lisp/Linux-os.c	Wed Aug 31 22:18:26 2011
@@ -15,7 +15,7 @@
  * GENCGC support by Douglas Crosher, 1996, 1997.
  * Alpha support by Julian Dolby, 1999.
  *
- * $Header: /project/cmucl/cvsroot/src/lisp/Linux-os.c,v 1.51 2010/12/26 16:04:43 rswindells Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/Linux-os.c,v 1.52 2011/09/01 05:18:26 rtoy Exp $
  *
  */
 
@@ -132,6 +132,15 @@
 }
 
 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[])
 {
     struct utsname name;
@@ -146,8 +155,6 @@
     }
 
     os_vm_page_size = getpagesize();
-
-    check_personality(&name, argv, envp);
 }
 
 #ifdef __i386
Index: src/lisp/NetBSD-os.c
diff -u src/lisp/NetBSD-os.c:1.19 src/lisp/NetBSD-os.c:1.20
--- src/lisp/NetBSD-os.c:1.19	Sun Dec 26 08:04:43 2010
+++ src/lisp/NetBSD-os.c	Wed Aug 31 22:18:26 2011
@@ -15,7 +15,7 @@
  * Frobbed for OpenBSD by Pierre R. Mai, 2001.
  * Frobbed for NetBSD by Pierre R. Mai, 2002.
  *
- * $Header: /project/cmucl/cvsroot/src/lisp/NetBSD-os.c,v 1.19 2010/12/26 16:04:43 rswindells Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/NetBSD-os.c,v 1.20 2011/09/01 05:18:26 rtoy Exp $
  *
  */
 
@@ -46,6 +46,10 @@
 
 
 void
+os_init0(const char *argv[], const char *envp[])
+{}
+
+void
 os_init(const char *argv[], const char *envp[])
 {
     os_vm_page_size = OS_VM_DEFAULT_PAGESIZE;
Index: src/lisp/OpenBSD-os.c
diff -u src/lisp/OpenBSD-os.c:1.10 src/lisp/OpenBSD-os.c:1.11
--- src/lisp/OpenBSD-os.c:1.10	Mon Feb  1 08:04:43 2010
+++ src/lisp/OpenBSD-os.c	Wed Aug 31 22:18:26 2011
@@ -13,7 +13,7 @@
  * GENCGC support by Douglas Crosher, 1996, 1997.
  * Frobbed for OpenBSD by Pierre R. Mai, 2001.
  *
- * $Header: /project/cmucl/cvsroot/src/lisp/OpenBSD-os.c,v 1.10 2010/02/01 16:04:43 rtoy Rel $
+ * $Header: /project/cmucl/cvsroot/src/lisp/OpenBSD-os.c,v 1.11 2011/09/01 05:18:26 rtoy Exp $
  *
  */
 
@@ -41,6 +41,10 @@
 
 
 void
+os_init0(const char *argv[], const char *envp[])
+{}
+
+void
 os_init(const char *argv[], const char *envp[])
 {
     os_vm_page_size = OS_VM_DEFAULT_PAGESIZE;
Index: src/lisp/hpux-os.c
diff -u src/lisp/hpux-os.c:1.10 src/lisp/hpux-os.c:1.11
--- src/lisp/hpux-os.c:1.10	Mon Feb  1 08:04:43 2010
+++ src/lisp/hpux-os.c	Wed Aug 31 22:18:26 2011
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/hpux-os.c,v 1.10 2010/02/01 16:04:43 rtoy Rel $
+ * $Header: /project/cmucl/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.
@@ -53,6 +53,10 @@
 } segments[MAX_SEGMENTS];
 
 void
+os_init0(const char *argv[], const char *envp[])
+{}
+
+void
 os_init(const char *argv[], const char *envp[])
 {
     int i;
Index: src/lisp/irix-os.c
diff -u src/lisp/irix-os.c:1.6 src/lisp/irix-os.c:1.7
--- src/lisp/irix-os.c:1.6	Mon Feb  1 08:04:43 2010
+++ src/lisp/irix-os.c	Wed Aug 31 22:18:26 2011
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/irix-os.c,v 1.6 2010/02/01 16:04:43 rtoy Rel $
+ * $Header: /project/cmucl/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.
@@ -30,6 +30,10 @@
 int zero_fd;
 
 void
+os_init0(const char *argv[], const char *envp[])
+{}
+
+void
 os_init(const char *argv[], const char *envp[])
 {
     zero_fd = open("/dev/zero", O_RDONLY);
Index: src/lisp/lisp.c
diff -u src/lisp/lisp.c:1.83 src/lisp/lisp.c:1.84
--- src/lisp/lisp.c:1.83	Fri Jun 10 12:32:31 2011
+++ src/lisp/lisp.c	Wed Aug 31 22:18:26 2011
@@ -1,7 +1,7 @@
 /*
  * main() entry point for a stand alone lisp image.
  *
- * $Header: /project/cmucl/cvsroot/src/lisp/lisp.c,v 1.83 2011/06/10 19:32:31 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/lisp.c,v 1.84 2011/09/01 05:18:26 rtoy Exp $
  *
  */
 
@@ -461,6 +461,16 @@
     }
     
 
+    /*
+     * 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
Index: src/lisp/mach-os.c
diff -u src/lisp/mach-os.c:1.8 src/lisp/mach-os.c:1.9
--- src/lisp/mach-os.c:1.8	Mon Feb  1 08:04:43 2010
+++ src/lisp/mach-os.c	Wed Aug 31 22:18:26 2011
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/mach-os.c,v 1.8 2010/02/01 16:04:43 rtoy Rel $
+ * $Header: /project/cmucl/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.
@@ -38,6 +38,10 @@
 #endif
 
 void
+os_init0(const char *argv[], const char *envp[])
+{}
+
+void
 os_init(const char *argv[], const char *envp[])
 {
     os_vm_page_size = vm_page_size;
Index: src/lisp/os.h
diff -u src/lisp/os.h:1.27 src/lisp/os.h:1.28
--- src/lisp/os.h:1.27	Sun Dec 26 08:04:43 2010
+++ src/lisp/os.h	Wed Aug 31 22:18:26 2011
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/os.h,v 1.27 2010/12/26 16:04:43 rswindells Exp $
+ * $Header: /project/cmucl/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);
 
Index: src/lisp/osf1-os.c
diff -u src/lisp/osf1-os.c:1.6 src/lisp/osf1-os.c:1.7
--- src/lisp/osf1-os.c:1.6	Mon Feb  1 08:04:43 2010
+++ src/lisp/osf1-os.c	Wed Aug 31 22:18:26 2011
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/osf1-os.c,v 1.6 2010/02/01 16:04:43 rtoy Rel $
+ * $Header: /project/cmucl/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.
@@ -26,6 +26,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[])
 {
     int buf[2] = { SSIN_UACPROC, UAC_SIGBUS | UAC_NOPRINT };
Index: src/lisp/solaris-os.c
diff -u src/lisp/solaris-os.c:1.29 src/lisp/solaris-os.c:1.30
--- src/lisp/solaris-os.c:1.29	Sun Dec 26 08:04:43 2010
+++ src/lisp/solaris-os.c	Wed Aug 31 22:18:26 2011
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/solaris-os.c,v 1.29 2010/12/26 16:04:43 rswindells Exp $
+ * $Header: /project/cmucl/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.
@@ -73,6 +73,10 @@
 }
 
 void
+os_init0(const char *argv[], const char *envp[])
+{}
+
+void
 os_init(const char *argv[], const char *envp[])
 {
     zero_fd = open(ZEROFILE, O_RDONLY);
Index: src/lisp/sunos-os.c
diff -u src/lisp/sunos-os.c:1.12 src/lisp/sunos-os.c:1.13
--- src/lisp/sunos-os.c:1.12	Mon Feb  1 08:04:43 2010
+++ src/lisp/sunos-os.c	Wed Aug 31 22:18:26 2011
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/sunos-os.c,v 1.12 2010/02/01 16:04:43 rtoy Rel $
+ * $Header: /project/cmucl/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.
@@ -81,6 +81,10 @@
 }
 
 void
+os_init0(const char *argv[], const char *envp[])
+{}
+
+void
 os_init(const char *argv[], const char *envp[])
 {
     char *empty_file = getenv("CMUCL_EMPTYFILE");




More information about the cmucl-cvs mailing list