]> git.pond.sub.org Git - empserver/blobdiff - src/lib/lwp/arch.c
Clean up superfluous includes
[empserver] / src / lib / lwp / arch.c
index 05b1d7557b27070e67b7554c8bab335f4e178a2f..c3e726aecf27d9c3c675f81c911a0c6aa23739ff 100644 (file)
@@ -1,12 +1,12 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1994-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
+ *  Copyright (C) 1994-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *                Ken Stevens, Steve McClure, Markus Armbruster
  *  Copyright (C) 1991-3 Stephen Crane
  *
- *  This program is free software; you can redistribute it and/or modify
+ *  Empire is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
+ *  the Free Software Foundation, either version 3 of the License, or
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
@@ -15,8 +15,7 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  *  ---
  *
  *  ---
  *
  *  arch.c: architecture-dependant process context code
- * 
+ *
  *  Known contributors to this file:
  *     Dave Pare, 1994
  *     Steve McClure, 1994-2000
- *     Markus Armbruster, 2004-2007
+ *     Markus Armbruster, 2004-2008
  */
 
 #include <config.h>
 
 #include <stdlib.h>
-#include "lwp.h"
 #include "lwpint.h"
 
 /*
  */
 
 int
-lwpNewContext(struct lwpProc *newp, int stacksz)
+lwpNewContext(struct lwpProc *newp)
 {
-    char *s;
-    int size, redsize;
-
-    /* Make size a multiple of sizeof(long) to keep things aligned */
-    stacksz = (stacksz + sizeof(long) - 1) & -sizeof(long);
-    /* Add a red zone on each side of the stack for LWP_STACKCHECK */
-    redsize = newp->flags & LWP_STACKCHECK ? LWP_REDZONE : 0;
-    size = stacksz + 2 * redsize;
-
-    s = malloc(size);
-    if (!s)
+    if (getcontext(&newp->context) < 0)
        return -1;
-
-    newp->sbtm = s;
-    newp->size = size;
-    newp->ustack = s + redsize;
-    newp->usize = stacksz;
-
-    if (getcontext(&newp->context) < 0) {
-       free(s);
-       return -1;
-    }
 #ifdef MAKECONTEXT_SP_HIGH
     /*
      * Known systems that are broken that way: Solaris prior to 10,
      * IRIX.
      */
-    newp->context.uc_stack.ss_sp = newp->ustack + stacksz - 8;
+    newp->context.uc_stack.ss_sp = newp->ustack + newp->usize - 8;
 #else
     newp->context.uc_stack.ss_sp = newp->ustack;
 #endif