CMUCL commit: src/lisp (12 files)

Raymond Toy rtoy at common-lisp.net
Mon Feb 1 17:04:43 CET 2010


    Date: Monday, February 1, 2010 @ 11:04:43
  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 mach-os.c os.h osf1-os.c solaris-os.c
          sunos-os.c

Linux-os.c:
o Follow CMUCL coding style.
o Argv and envp are const char*.

os.h:
lisp.c:
Darwin-os.c:
FreeBSD-os.c:
NetBSD-os.c:
OpenBSD-os.c:
hpux-os.c:
irix-os.c:
mach-os.c:
osf1-os.c:
solaris-os.c:
sunos-os.c:
o argv and envp are const char *.


--------------+
 Darwin-os.c  |    4 +-
 FreeBSD-os.c |    4 +-
 Linux-os.c   |   82 ++++++++++++++++++++++++++++-----------------------------
 NetBSD-os.c  |    4 +-
 OpenBSD-os.c |    4 +-
 hpux-os.c    |    4 +-
 irix-os.c    |    4 +-
 mach-os.c    |    4 +-
 os.h         |    4 +-
 osf1-os.c    |    4 +-
 solaris-os.c |    4 +-
 sunos-os.c   |    4 +-
 12 files changed, 63 insertions(+), 63 deletions(-)


Index: src/lisp/Darwin-os.c
diff -u src/lisp/Darwin-os.c:1.26 src/lisp/Darwin-os.c:1.27
--- src/lisp/Darwin-os.c:1.26	Mon Feb  1 10:16:08 2010
+++ src/lisp/Darwin-os.c	Mon Feb  1 11:04:43 2010
@@ -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.26 2010-02-01 15:16:08 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/Darwin-os.c,v 1.27 2010-02-01 16:04:43 rtoy Exp $
  *
  */
 
@@ -101,7 +101,7 @@
 
 
 void
-os_init(char *argv[], char *envp[])
+os_init(const char *argv[], const char *envp[])
 {
     os_vm_page_size = OS_VM_DEFAULT_PAGESIZE;
 #ifdef __ppc__
Index: src/lisp/FreeBSD-os.c
diff -u src/lisp/FreeBSD-os.c:1.32 src/lisp/FreeBSD-os.c:1.33
--- src/lisp/FreeBSD-os.c:1.32	Mon Feb  1 10:16:08 2010
+++ src/lisp/FreeBSD-os.c	Mon Feb  1 11:04:43 2010
@@ -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.32 2010-02-01 15:16:08 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/FreeBSD-os.c,v 1.33 2010-02-01 16:04:43 rtoy Exp $
  *
  */
 
@@ -39,7 +39,7 @@
 vm_size_t os_vm_page_size;
 
 void
-os_init(char *argv[], char *envp[])
+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.47 src/lisp/Linux-os.c:1.48
--- src/lisp/Linux-os.c:1.47	Mon Feb  1 10:16:09 2010
+++ src/lisp/Linux-os.c	Mon Feb  1 11:04:43 2010
@@ -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.47 2010-02-01 15:16:09 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/Linux-os.c,v 1.48 2010-02-01 16:04:43 rtoy Exp $
  *
  */
 
@@ -65,7 +65,7 @@
 #endif
 
 void
-check_personality(struct utsname *name, char *argv[], char *envp[])
+check_personality(struct utsname *name, const char *argv[], const char *envp[])
 {
     /* KLUDGE: Disable memory randomization on new Linux kernels
      * by setting a personality flag and re-executing. (We need
@@ -78,12 +78,12 @@
 #if defined(__i386) || defined(__x86_64)
     int major_version, minor_version, patch_version;
     char *p;
-    p=name->release;
-    major_version=atoi(p);
-    p=strchr(p,'.')+1;
-    minor_version=atoi(p);
-    p=strchr(p,'.')+1;
-    patch_version=atoi(p);
+    p = name->release;
+    major_version = atoi(p);
+    p = strchr(p,'.')+1;
+    minor_version = atoi(p);
+    p = strchr(p,'.')+1;
+    patch_version = atoi(p);
 
     if ((major_version == 2
          /* Some old kernels will apparently lose unsupported personality flags
@@ -93,46 +93,46 @@
              /* This is what RHEL 3 reports */
              || (minor_version == 4 && patch_version > 20)))
         || major_version >= 3)
-    {
-        int pers = personality(CURRENT_PERSONALITY);
-        if (!(pers & ADDR_NO_RANDOMIZE)) {
-            int retval = personality(pers | ADDR_NO_RANDOMIZE);
-            /* Allegedly some Linux kernels (the reported case was
-             * "hardened Linux 2.6.7") won't set the new personality,
-             * but nor will they return -1 for an error. So as a
-             * workaround query the new personality...
-             */
-            int newpers = personality(CURRENT_PERSONALITY);
-            /* ... and don't re-execute if either the setting resulted
-             * in an error or if the value didn't change. Otherwise
-             * this might result in an infinite loop.
-             */
-            if (retval != -1 && newpers != pers) {
-                /* Use /proc/self/exe instead of trying to figure out
-                 * the executable path from PATH and argv[0], since
-                 * that's unreliable. We follow the symlink instead of
-                 * executing the file directly in order to prevent top
-                 * from displaying the name of the process as "exe". */
-                char runtime[PATH_MAX+1];
-                int i = readlink("/proc/self/exe", runtime, PATH_MAX);
-                if (i != -1) {
-                    runtime[i] = '\0';
-                    execve(runtime, argv, envp);
+        {
+            int pers = personality(CURRENT_PERSONALITY);
+            if (!(pers & ADDR_NO_RANDOMIZE)) {
+                int retval = personality(pers | ADDR_NO_RANDOMIZE);
+                /* Allegedly some Linux kernels (the reported case was
+                 * "hardened Linux 2.6.7") won't set the new personality,
+                 * but nor will they return -1 for an error. So as a
+                 * workaround query the new personality...
+                 */
+                int newpers = personality(CURRENT_PERSONALITY);
+                /* ... and don't re-execute if either the setting resulted
+                 * in an error or if the value didn't change. Otherwise
+                 * this might result in an infinite loop.
+                 */
+                if (retval != -1 && newpers != pers) {
+                    /* Use /proc/self/exe instead of trying to figure out
+                     * the executable path from PATH and argv[0], since
+                     * that's unreliable. We follow the symlink instead of
+                     * executing the file directly in order to prevent top
+                     * from displaying the name of the process as "exe". */
+                    char runtime[PATH_MAX+1];
+                    int i = readlink("/proc/self/exe", runtime, PATH_MAX);
+                    if (i != -1) {
+                        runtime[i] = '\0';
+                        execve(runtime, argv, envp);
+                    }
                 }
+                /* Either changing the personality or execve() failed. Either
+                 * way we might as well continue, and hope that the random
+                 * memory maps are ok this time around.
+                 */
+                fprintf(stderr, "WARNING: Couldn't re-execute CMUCL with the proper personality flags"
+                        "(maybe /proc isn't mounted?). Trying to continue anyway.\n");
             }
-            /* Either changing the personality or execve() failed. Either
-             * way we might as well continue, and hope that the random
-             * memory maps are ok this time around.
-             */
-            fprintf(stderr, "WARNING: Couldn't re-execute CMUCL with the proper personality flags"
-                            "(maybe /proc isn't mounted?). Trying to continue anyway.\n");
         }
-    }
 #endif
 }
 
 void
-os_init(char *argv[], char *envp[])
+os_init(const char *argv[], const char *envp[])
 {
     struct utsname name;
 
Index: src/lisp/NetBSD-os.c
diff -u src/lisp/NetBSD-os.c:1.14 src/lisp/NetBSD-os.c:1.15
--- src/lisp/NetBSD-os.c:1.14	Mon Feb  1 10:16:09 2010
+++ src/lisp/NetBSD-os.c	Mon Feb  1 11:04:43 2010
@@ -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.14 2010-02-01 15:16:09 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/NetBSD-os.c,v 1.15 2010-02-01 16:04:43 rtoy Exp $
  *
  */
 
@@ -45,7 +45,7 @@
 
 
 void
-os_init(char *argv[], char *envp[])
+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.9 src/lisp/OpenBSD-os.c:1.10
--- src/lisp/OpenBSD-os.c:1.9	Mon Feb  1 10:16:09 2010
+++ src/lisp/OpenBSD-os.c	Mon Feb  1 11:04:43 2010
@@ -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.9 2010-02-01 15:16:09 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/OpenBSD-os.c,v 1.10 2010-02-01 16:04:43 rtoy Exp $
  *
  */
 
@@ -41,7 +41,7 @@
 
 
 void
-os_init(char *argv[], char *envp[])
+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.9 src/lisp/hpux-os.c:1.10
--- src/lisp/hpux-os.c:1.9	Mon Feb  1 10:16:09 2010
+++ src/lisp/hpux-os.c	Mon Feb  1 11:04:43 2010
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/hpux-os.c,v 1.9 2010-02-01 15:16:09 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/hpux-os.c,v 1.10 2010-02-01 16:04:43 rtoy Exp $
  *
  * OS-dependent routines.  This file (along with os.h) exports an
  * OS-independent interface to the operating system VM facilities.
@@ -53,7 +53,7 @@
 } segments[MAX_SEGMENTS];
 
 void
-os_init(char *argv[], char *envp[])
+os_init(const char *argv[], const char *envp[])
 {
     int i;
 
Index: src/lisp/irix-os.c
diff -u src/lisp/irix-os.c:1.5 src/lisp/irix-os.c:1.6
--- src/lisp/irix-os.c:1.5	Mon Feb  1 10:16:09 2010
+++ src/lisp/irix-os.c	Mon Feb  1 11:04:43 2010
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/irix-os.c,v 1.5 2010-02-01 15:16:09 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/irix-os.c,v 1.6 2010-02-01 16:04:43 rtoy Exp $
  *
  * OS-dependent routines.  This file (along with os.h) exports an
  * OS-independent interface to the operating system VM facilities.
@@ -30,7 +30,7 @@
 int zero_fd;
 
 void
-os_init(char *argv[], char *envp[])
+os_init(const char *argv[], const char *envp[])
 {
     zero_fd = open("/dev/zero", O_RDONLY);
     os_vm_page_size = getpagesize();
Index: src/lisp/mach-os.c
diff -u src/lisp/mach-os.c:1.7 src/lisp/mach-os.c:1.8
--- src/lisp/mach-os.c:1.7	Mon Feb  1 10:16:09 2010
+++ src/lisp/mach-os.c	Mon Feb  1 11:04:43 2010
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/mach-os.c,v 1.7 2010-02-01 15:16:09 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/mach-os.c,v 1.8 2010-02-01 16:04:43 rtoy Exp $
  *
  * OS-dependent routines.  This file (along with os.h) exports an
  * OS-independent interface to the operating system VM facilities.
@@ -38,7 +38,7 @@
 #endif
 
 void
-os_init(char *argv[], char *envp[])
+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.24 src/lisp/os.h:1.25
--- src/lisp/os.h:1.24	Mon Feb  1 10:16:09 2010
+++ src/lisp/os.h	Mon Feb  1 11:04:43 2010
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/os.h,v 1.24 2010-02-01 15:16:09 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/os.h,v 1.25 2010-02-01 16:04:43 rtoy Exp $
  *
  * Common interface for os-dependent functions.
  *
@@ -72,7 +72,7 @@
 
 extern os_vm_size_t os_vm_page_size;
 
-extern void os_init(char *argv[], char *envp[]);
+extern void os_init(const char *argv[], const char *envp[]);
 extern void os_install_interrupt_handlers(void);
 
 extern os_vm_address_t os_allocate(os_vm_size_t len);
Index: src/lisp/osf1-os.c
diff -u src/lisp/osf1-os.c:1.5 src/lisp/osf1-os.c:1.6
--- src/lisp/osf1-os.c:1.5	Mon Feb  1 10:16:09 2010
+++ src/lisp/osf1-os.c	Mon Feb  1 11:04:43 2010
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/osf1-os.c,v 1.5 2010-02-01 15:16:09 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/osf1-os.c,v 1.6 2010-02-01 16:04:43 rtoy Exp $
  *
  * OS-dependent routines.  This file (along with os.h) exports an
  * OS-independent interface to the operating system VM facilities.
@@ -26,7 +26,7 @@
 vm_size_t os_vm_page_size;
 
 void
-os_init(char *argv[], char *envp[])
+os_init(const char *argv[], const char *envp[])
 {
     int buf[2] = { SSIN_UACPROC, UAC_SIGBUS | UAC_NOPRINT };
     int error;
Index: src/lisp/solaris-os.c
diff -u src/lisp/solaris-os.c:1.24 src/lisp/solaris-os.c:1.25
--- src/lisp/solaris-os.c:1.24	Mon Feb  1 10:16:09 2010
+++ src/lisp/solaris-os.c	Mon Feb  1 11:04:43 2010
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/solaris-os.c,v 1.24 2010-02-01 15:16:09 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/solaris-os.c,v 1.25 2010-02-01 16:04:43 rtoy Exp $
  *
  * OS-dependent routines.  This file (along with os.h) exports an
  * OS-independent interface to the operating system VM facilities.
@@ -71,7 +71,7 @@
 }
 
 void
-os_init(char *argv[], char *envp[])
+os_init(const char *argv[], const char *envp[])
 {
     zero_fd = open(ZEROFILE, O_RDONLY);
     if (zero_fd < 0)
Index: src/lisp/sunos-os.c
diff -u src/lisp/sunos-os.c:1.11 src/lisp/sunos-os.c:1.12
--- src/lisp/sunos-os.c:1.11	Mon Feb  1 10:16:09 2010
+++ src/lisp/sunos-os.c	Mon Feb  1 11:04:43 2010
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/sunos-os.c,v 1.11 2010-02-01 15:16:09 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/sunos-os.c,v 1.12 2010-02-01 16:04:43 rtoy Exp $
  *
  * OS-dependent routines.  This file (along with os.h) exports an
  * OS-independent interface to the operating system VM facilities.
@@ -81,7 +81,7 @@
 }
 
 void
-os_init(char *argv[], char *envp[])
+os_init(const char *argv[], const char *envp[])
 {
     char *empty_file = getenv("CMUCL_EMPTYFILE");
 



More information about the cmucl-commit mailing list