summaryrefslogtreecommitdiff
path: root/libthreads
diff options
context:
space:
mode:
Diffstat (limited to 'libthreads')
-rw-r--r--libthreads/call.c25
-rw-r--r--libthreads/cancel-cond.c4
-rw-r--r--libthreads/cprocs.c57
-rw-r--r--libthreads/cthread_internals.h47
-rw-r--r--libthreads/cthreads.c47
-rw-r--r--libthreads/cthreads.h24
-rw-r--r--libthreads/stack.c19
7 files changed, 126 insertions, 97 deletions
diff --git a/libthreads/call.c b/libthreads/call.c
index 26efc8fc..ec25345c 100644
--- a/libthreads/call.c
+++ b/libthreads/call.c
@@ -1,42 +1,45 @@
-/*
+/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
* HISTORY
- * $Log: call.c,v $
+ * $Log: call.c,v $
+ * Revision 1.1 1992/10/06 18:31:03 mib
+ * entered into RCS
+ *
* Revision 2.4 91/05/14 17:56:00 mrt
* Correcting copyright
- *
+ *
* Revision 2.3 91/02/14 14:19:20 mrt
* Added new Mach copyright
* [91/02/13 12:40:44 mrt]
- *
+ *
* Revision 2.2 90/01/19 14:36:50 rwd
* Created. Routines to replace thread_* and cthread_call_on.
* [90/01/03 rwd]
- *
+ *
*/
#include <cthreads.h>
@@ -78,4 +81,4 @@ cthread_t thread;
{
cproc_t p = thread->ur;
}
-#endif THREAD_CALLS
+#endif /* THREAD_CALLS */
diff --git a/libthreads/cancel-cond.c b/libthreads/cancel-cond.c
index b7780d03..b7793f85 100644
--- a/libthreads/cancel-cond.c
+++ b/libthreads/cancel-cond.c
@@ -77,7 +77,7 @@ hurd_condition_wait (condition_t c, mutex_t m)
#ifdef WAIT_DEBUG
p->waiting_for = (char *)c;
-#endif WAIT_DEBUG
+#endif /* WAIT_DEBUG */
mutex_unlock (m);
@@ -94,7 +94,7 @@ hurd_condition_wait (condition_t c, mutex_t m)
#ifdef WAIT_DEBUG
p->waiting_for = (char *)0;
-#endif WAIT_DEBUG
+#endif /* WAIT_DEBUG */
}
spin_lock (&ss->lock);
diff --git a/libthreads/cprocs.c b/libthreads/cprocs.c
index fe7615cf..759d0f5d 100644
--- a/libthreads/cprocs.c
+++ b/libthreads/cprocs.c
@@ -26,6 +26,11 @@
/*
* HISTORY
* $Log: cprocs.c,v $
+ * Revision 1.12 2000/01/10 14:42:30 kettenis
+ * 2000-01-10 Mark Kettenis <kettenis@gnu.org>
+ *
+ * * cprocs.c: Include <assert.h>
+ *
* Revision 1.11 2000/01/09 23:00:18 roland
* 2000-01-09 Roland McGrath <roland@baalperazim.frob.com>
*
@@ -306,7 +311,7 @@ int cthread_no_mutex = 0; /* total number times woken to get
mutex and couldn't */
private spin_lock_t mutex_count_lock = SPIN_LOCK_INITIALIZER;
/* lock for above */
-#endif STATISTICS
+#endif /* STATISTICS */
cproc_t cproc_list = NO_CPROC; /* list of all cprocs */
private cproc_list_lock = SPIN_LOCK_INITIALIZER;
@@ -389,7 +394,7 @@ void cthread_unwire()
spin_lock(&wired_lock);
cthread_wired--;
spin_unlock(&wired_lock);
-#endif STATISTICS
+#endif /* STATISTICS */
}
#endif
}
@@ -498,7 +503,7 @@ private int cproc_ready(p, preq)
mach_error("mach_msg", r);
exit(1);
}
-#endif CHECK_STATUS
+#endif /* CHECK_STATUS */
return TRUE;
}
spin_lock(&p->lock); /* is it ready to be queued? It
@@ -526,7 +531,7 @@ private int cproc_ready(p, preq)
}
#ifdef STATISTICS
cthread_ready++;
-#endif STATISTICS
+#endif /* STATISTICS */
ready_count++;
if ((s->state & CPROC_CONDWAIT) && !(s->wired)) {
@@ -552,7 +557,7 @@ private int cproc_ready(p, preq)
mach_error("mach_msg", r);
exit(1);
}
-#endif CHECK_STATUS
+#endif /* CHECK_STATUS */
return TRUE;
}
spin_unlock(&ready_lock);
@@ -577,7 +582,7 @@ cproc_waiting(p)
cthread_waiting++;
cthread_waiters++;
spin_unlock(&ready_lock);
-#endif STATISTICS
+#endif /* STATISTICS */
for (;;) {
MACH_CALL(mach_msg(&msg, MACH_RCV_MSG,
0, sizeof msg, wait_port,
@@ -589,14 +594,14 @@ cproc_waiting(p)
ready_count++;
#ifdef STATISTICS
cthread_none++;
-#endif STATISTICS
+#endif /* STATISTICS */
spin_unlock(&ready_lock);
}
#ifdef STATISTICS
cthread_ready--;
cthread_running++;
cthread_waiting--;
-#endif STATISTICS
+#endif /* STATISTICS */
spin_unlock(&ready_lock);
spin_lock(&new->lock);
new->state = CPROC_RUNNING;
@@ -628,7 +633,7 @@ cproc_waiter()
spin_lock(&waiters_lock);
cthread_wait_stacks++;
spin_unlock(&waiters_lock);
-#endif STATISTICS
+#endif /* STATISTICS */
waiter = cproc_alloc();
MACH_CALL(vm_allocate(mach_task_self(), &base,
cthread_wait_stack_size, TRUE), r);
@@ -667,13 +672,13 @@ cproc_block()
spin_lock(&ready_lock);
#ifdef STATISTICS
cthread_blocked++;
-#endif STATISTICS
+#endif /* STATISTICS */
cthread_queue_deq(&ready, cproc_t, new);
if (new) {
#ifdef STATISTICS
cthread_ready--;
cthread_switches++;
-#endif STATISTICS
+#endif /* STATISTICS */
ready_count--;
spin_unlock(&ready_lock);
spin_lock(&p->lock);
@@ -684,7 +689,7 @@ cproc_block()
cthread_wakeup++;
cthread_switches--;
spin_unlock(&ready_lock);
-#endif STATISTICS
+#endif /* STATISTICS */
cproc_ready(new, 1); /* requeue at head were it was */
} else {
p->state = CPROC_BLOCKED;
@@ -697,7 +702,7 @@ cproc_block()
wait_count++;
#ifdef STATISTICS
cthread_running--;
-#endif STATISTICS
+#endif /* STATISTICS */
spin_unlock(&ready_lock);
waiter = cproc_waiter();
spin_lock(&p->lock);
@@ -708,7 +713,7 @@ cproc_block()
#ifdef STATISTICS
cthread_running++;
cthread_wakeup++;
-#endif STATISTICS
+#endif /* STATISTICS */
spin_unlock(&ready_lock);
spin_lock(&waiters_lock);
cthread_queue_preq(&waiters, waiter);
@@ -756,7 +761,7 @@ cproc_create()
spin_lock(&ready_lock);
cthread_running++;
spin_unlock(&ready_lock);
-#endif STATISTICS
+#endif /* STATISTICS */
} else {
vm_offset_t stack;
spin_unlock(&n_kern_lock);
@@ -797,7 +802,7 @@ condition_wait(c, m)
spin_unlock(&c->lock);
#ifdef WAIT_DEBUG
p->waiting_for = (char *)c;
-#endif WAIT_DEBUG
+#endif /* WAIT_DEBUG */
mutex_unlock(m);
@@ -812,7 +817,7 @@ condition_wait(c, m)
#ifdef WAIT_DEBUG
p->waiting_for = (char *)0;
-#endif WAIT_DEBUG
+#endif /* WAIT_DEBUG */
/*
* Re-acquire the mutex and return.
@@ -921,7 +926,7 @@ cthread_yield()
spin_lock(&ready_lock);
#ifdef STATISTICS
cthread_yields++;
-#endif STATISTICS
+#endif /* STATISTICS */
cthread_queue_deq(&ready, cproc_t, new);
if (new) {
cthread_queue_enq(&ready, p);
@@ -952,7 +957,7 @@ __mutex_lock_solid(void *ptr)
#ifdef WAIT_DEBUG
p->waiting_for = (char *)m;
-#endif WAIT_DEBUG
+#endif /* WAIT_DEBUG */
while (1) {
spin_lock(&m->lock);
if (cthread_queue_head(&m->queue, cproc_t) == NO_CPROC) {
@@ -966,7 +971,7 @@ __mutex_lock_solid(void *ptr)
spin_unlock(&m->lock);
#ifdef WAIT_DEBUG
p->waiting_for = (char *)0;
-#endif WAIT_DEBUG
+#endif /* WAIT_DEBUG */
return;
} else {
if (!queued) cthread_queue_enq(&m->queue, p);
@@ -976,14 +981,14 @@ __mutex_lock_solid(void *ptr)
if (spin_try_lock(&m->held)) {
#ifdef WAIT_DEBUG
p->waiting_for = (char *)0;
-#endif WAIT_DEBUG
+#endif /* WAIT_DEBUG */
return;
}
#ifdef STATISTICS
spin_lock(&mutex_count_lock);
cthread_no_mutex++;
spin_unlock(&mutex_count_lock);
-#endif STATISTICS
+#endif /* STATISTICS */
}
}
}
@@ -1065,7 +1070,7 @@ cthread_msg_busy(port, min, max)
spin_lock(&port_lock);
cthread_rnone++;
spin_unlock(&port_lock);
-#endif STATISTICS
+#endif /* STATISTICS */
}
} else {
port_entry->held--;
@@ -1134,7 +1139,7 @@ cthread_mach_msg(header, option,
spin_unlock(&port_entry->lock);
#ifdef WAIT_DEBUG
p->waiting_for = (char *)port_entry;
-#endif WAIT_DEBUG
+#endif /* WAIT_DEBUG */
cproc_block();
} else {
port_entry->held++;
@@ -1149,7 +1154,7 @@ cthread_mach_msg(header, option,
}
#ifdef WAIT_DEBUG
p->waiting_for = (char *)0;
-#endif WAIT_DEBUG
+#endif /* WAIT_DEBUG */
p->busy = (int)port_entry;
if ((option & MACH_SEND_MSG) && !sent) {
r = mach_msg(header, option,
@@ -1209,7 +1214,7 @@ cproc_fork_child()
cthread_switches = 0;
cthread_no_mutex = 0;
spin_lock_init(&mutex_count_lock);
-#endif STATISTICS
+#endif /* STATISTICS */
for(l=cproc_list;l!=NO_CPROC;l=m) {
m=l->next;
diff --git a/libthreads/cthread_internals.h b/libthreads/cthread_internals.h
index c3aa8050..a2f1598e 100644
--- a/libthreads/cthread_internals.h
+++ b/libthreads/cthread_internals.h
@@ -1,79 +1,82 @@
-/*
+/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
* HISTORY
* $Log: cthread_internals.h,v $
+ * Revision 1.3 1995/08/29 14:49:20 mib
+ * (cproc_block): Provide decl.
+ *
* Revision 1.2 1994/05/05 10:58:01 roland
* entered into RCS
*
* Revision 2.14 92/08/03 18:03:56 jfriedl
* Made state element of struct cproc volatile.
* [92/08/02 jfriedl]
- *
+ *
* Revision 2.13 92/03/06 14:09:24 rpd
* Added yield, defined using thread_switch.
* [92/03/06 rpd]
- *
+ *
* Revision 2.12 92/03/01 00:40:23 rpd
* Removed exit declaration. It conflicted with the real thing.
* [92/02/29 rpd]
- *
+ *
* Revision 2.11 91/08/28 11:19:23 jsb
* Fixed MACH_CALL to allow multi-line expressions.
* [91/08/23 rpd]
- *
+ *
* Revision 2.10 91/07/31 18:33:33 dbg
* Protect against redefinition of ASSERT.
* [91/07/30 17:33:21 dbg]
- *
+ *
* Revision 2.9 91/05/14 17:56:24 mrt
* Correcting copyright
- *
+ *
* Revision 2.8 91/02/14 14:19:42 mrt
* Added new Mach copyright
* [91/02/13 12:41:02 mrt]
- *
+ *
* Revision 2.7 90/11/05 14:36:55 rpd
* Added spin_lock_t.
* [90/10/31 rwd]
- *
+ *
* Revision 2.6 90/09/09 14:34:51 rpd
* Remove special field.
* [90/08/24 rwd]
- *
+ *
* Revision 2.5 90/06/02 15:13:44 rpd
* Converted to new IPC.
* [90/03/20 20:52:47 rpd]
- *
+ *
* Revision 2.4 90/03/14 21:12:11 rwd
* Added waiting_for field for debugging deadlocks.
* [90/03/01 rwd]
* Added list field to keep a master list of all cprocs.
* [90/03/01 rwd]
- *
+ *
* Revision 2.3 90/01/19 14:37:08 rwd
* Keep track of real thread for use in thread_* substitutes.
* Add CPROC_ARUN for about to run and CPROC_HOLD to avoid holding
@@ -82,7 +85,7 @@
* Add busy field to be used by cthread_msg calls to make sure we
* have the right number of blocked kernel threads.
* [89/12/21 rwd]
- *
+ *
* Revision 2.2 89/12/08 19:53:28 rwd
* Added CPROC_CONDWAIT state
* [89/11/28 rwd]
@@ -101,7 +104,7 @@
* basically a merge of coroutine and thread. Added
* cthread_receivce call for use by servers.
* [89/10/23 rwd]
- *
+ *
*/
/*
* cthread_internals.h
@@ -139,7 +142,7 @@ typedef struct cproc {
struct cproc *list; /* for master cproc list */
#ifdef WAIT_DEBUG
volatile char *waiting_for; /* address of mutex/cond waiting for */
-#endif WAIT_DEBUG
+#endif /* WAIT_DEBUG */
#if 0
/* This is not needed in GNU; libc handles it. */
@@ -190,9 +193,9 @@ extern void mach_error();
quit(1, "error in %s at %d: %s\n", __FILE__, __LINE__, \
mach_error_string(ret)); \
} else
-#else CHECK_STATUS
+#else /* CHECK_STATUS */
#define MACH_CALL(expr, ret) (ret) = (expr)
-#endif CHECK_STATUS
+#endif /* CHECK_STATUS */
#define private static
#ifndef ASSERT
diff --git a/libthreads/cthreads.c b/libthreads/cthreads.c
index 9a3341da..cb8f76ed 100644
--- a/libthreads/cthreads.c
+++ b/libthreads/cthreads.c
@@ -1,31 +1,38 @@
-/*
+/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
* HISTORY
* $Log: cthreads.c,v $
+ * Revision 1.9 1998/11/22 18:18:10 roland
+ * 1998-11-12 Mark Kettenis <kettenis@phys.uva.nl>
+ *
+ * * cthreads.c (cthread_init): Move cthread_alloc call before
+ * cproc_init call, since cthread_alloc uses malloc, and malloc won't
+ * work between initializing the new stack and switching over to it.
+ *
* Revision 1.8 1998/06/10 19:38:01 tb
* Tue Jun 9 13:50:09 1998 Thomas Bushnell, n/BSG <tb@mit.edu>
*
@@ -57,50 +64,50 @@
* Revision 2.11 92/07/20 13:33:37 cmaeda
* In cthread_init, do machine dependent initialization if it's defined.
* [92/05/11 14:41:08 cmaeda]
- *
+ *
* Revision 2.10 91/08/28 11:19:26 jsb
* Fixed mig_init initialization in cthread_fork_child.
* [91/08/23 rpd]
- *
+ *
* Revision 2.9 91/07/31 18:34:23 dbg
* Fix bad self-pointer reference.
- *
+ *
* Don't declare _setjmp and _longjmp; they are included by
* cthreads.h.
* [91/07/30 17:33:50 dbg]
- *
+ *
* Revision 2.8 91/05/14 17:56:31 mrt
* Correcting copyright
- *
+ *
* Revision 2.7 91/02/14 14:19:47 mrt
* Added new Mach copyright
* [91/02/13 12:41:07 mrt]
- *
+ *
* Revision 2.6 90/11/05 14:37:03 rpd
* Added cthread_fork_{prepare,parent,child}.
* [90/11/02 rwd]
- *
+ *
* Add spin_lock_t.
* [90/10/31 rwd]
- *
+ *
* Revision 2.5 90/08/07 14:30:58 rpd
* Removed RCS keyword nonsense.
- *
+ *
* Revision 2.4 90/06/02 15:13:49 rpd
* Converted to new IPC.
* [90/03/20 20:56:44 rpd]
- *
+ *
* Revision 2.3 90/01/19 14:37:12 rwd
* Make cthread_init return pointer to new stack.
* [89/12/18 19:17:45 rwd]
- *
+ *
* Revision 2.2 89/12/08 19:53:37 rwd
* Change cproc and cthread counters to globals with better names.
* [89/11/02 rwd]
- *
+ *
* Revision 2.1 89/08/03 17:09:34 rwd
* Created.
- *
+ *
*
* 31-Dec-87 Eric Cooper (ecc) at Carnegie Mellon University
* Changed cthread_exit() logic for the case of the main thread,
@@ -155,7 +162,7 @@ extern void mig_init();
#ifdef DEBUG
int cthread_debug = FALSE;
-#endif DEBUG
+#endif /* DEBUG */
private struct cthread_queue cthreads = QUEUE_INITIALIZER;
private struct mutex cthread_lock = MUTEX_INITIALIZER;
diff --git a/libthreads/cthreads.h b/libthreads/cthreads.h
index c15e0377..787827aa 100644
--- a/libthreads/cthreads.h
+++ b/libthreads/cthreads.h
@@ -26,6 +26,12 @@
/*
* HISTORY
* $Log: cthreads.h,v $
+ * Revision 1.15 1999/06/13 18:54:42 roland
+ * 1999-06-13 Roland McGrath <roland@baalperazim.frob.com>
+ *
+ * * cthreads.h (MACRO_BEGIN, MACRO_END): #undef before unconditionally
+ * redefining. Use GCC extension for statement expression with value 0.
+ *
* Revision 1.14 1999/05/30 01:39:48 roland
* 1999-05-29 Roland McGrath <roland@baalperazim.frob.com>
*
@@ -487,7 +493,7 @@ typedef struct cthread {
char *name;
#ifdef CTHREAD_DATA
any_t data;
-#endif CTHREAD_DATA
+#endif /* CTHREAD_DATA */
any_t private_data;
struct ur_cthread *ur;
} *cthread_t;
@@ -527,11 +533,11 @@ extern int cthread_stack_mask;
#ifdef STACK_GROWTH_UP
#define ur_cthread_ptr(sp) \
(* (ur_cthread_t *) ((sp) & cthread_stack_mask))
-#else STACK_GROWTH_UP
+#else /* STACK_GROWTH_UP */
#define ur_cthread_ptr(sp) \
(* (ur_cthread_t *) ( ((sp) | cthread_stack_mask) + 1 \
- sizeof(ur_cthread_t *)) )
-#endif STACK_GROWTH_UP
+#endif /* STACK_GROWTH_UP */
#define ur_cthread_self() (ur_cthread_ptr(cthread_sp()))
@@ -569,7 +575,7 @@ cthread_set_data C_ARG_DECLS((cthread_t t, any_t x));
extern any_t
cthread_data C_ARG_DECLS((cthread_t t));
-#endif CTHREAD_DATA
+#endif /* CTHREAD_DATA */
/*
* Support for POSIX thread specific data
@@ -622,18 +628,18 @@ cthread_setspecific C_ARG_DECLS((cthread_key_t key, any_t value));
} \
MACRO_END
-#endif ASSERT
+#endif /* ASSERT */
#define SHOULDNT_HAPPEN 0
extern int cthread_debug;
-#else DEBUG
+#else /* DEBUG */
#ifndef ASSERT
#define ASSERT(p)
-#endif ASSERT
+#endif /* ASSERT */
-#endif DEBUG
+#endif /* DEBUG */
-#endif _CTHREADS_
+#endif /* _CTHREADS_ */
diff --git a/libthreads/stack.c b/libthreads/stack.c
index def4dc69..0115e6c3 100644
--- a/libthreads/stack.c
+++ b/libthreads/stack.c
@@ -26,6 +26,11 @@
/*
* HISTORY
* $Log: stack.c,v $
+ * Revision 1.6 1997/02/20 04:30:35 miles
+ * (__hurd_threadvar_stack_mask, __hurd_threadvar_stack_offset,
+ * __hurd_threadvar_max):
+ * Make extern.
+ *
* Revision 1.5 1995/12/10 13:41:30 roland
* (addr_range_check, probe_stack): Functions #if 0'd out.
* (stack_init): Don't call probe_stack or frob old stack at all.
@@ -178,7 +183,7 @@ setup_stack(p, base)
*/
#ifdef RED_ZONE
MACH_CALL(vm_protect(mach_task_self(), base + vm_page_size, vm_page_size, FALSE, VM_PROT_NONE), r);
-#endif RED_ZONE
+#endif /* RED_ZONE */
/*
* Store self pointer.
*/
@@ -324,9 +329,9 @@ stack_init(p)
#ifdef STACK_GROWTH_UP
cthread_stack_mask = ~(cthread_stack_size - 1);
-#else STACK_GROWTH_UP
+#else /* STACK_GROWTH_UP */
cthread_stack_mask = cthread_stack_size - 1;
-#endif STACK_GROWTH_UP
+#endif /* STACK_GROWTH_UP */
/* Set up the variables so GNU can find its per-thread variables. */
__hurd_threadvar_stack_mask = ~(cthread_stack_size - 1);
@@ -358,11 +363,11 @@ stack_init(p)
#ifdef STACK_GROWTH_UP
start = (cthread_sp() | (vm_page_size - 1)) + 1 + vm_page_size;
size = stack_top - start;
-#else STACK_GROWTH_UP
+#else /* STACK_GROWTH_UP */
start = stack_bottom;
size = (cthread_sp() & ~(vm_page_size - 1)) - stack_bottom -
vm_page_size;
-#endif STACK_GROWTH_UP
+#endif /* STACK_GROWTH_UP */
MACH_CALL(vm_deallocate(mach_task_self(),start,size),r);
#endif
@@ -407,9 +412,9 @@ cproc_stack_base(cproc, offset)
{
#ifdef STACK_GROWTH_UP
return (cproc->stack_base + offset);
-#else STACK_GROWTH_UP
+#else /* STACK_GROWTH_UP */
return (cproc->stack_base + cproc->stack_size - offset);
-#endif STACK_GROWTH_UP
+#endif /* STACK_GROWTH_UP */
}