]> git.pond.sub.org Git - empserver/blob - src/lib/lwp/lwpint.h
Don't declare things in more than one place. Move some declarations
[empserver] / src / lib / lwp / lwpint.h
1 /*
2  * lwpint.h -- lwp internal structures
3  *
4  * Copyright (C) 1991-3 Stephen Crane.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  * 
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  * 
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  * author: Stephen Crane, (jsc@doc.ic.ac.uk), Department of Computing,
21  * Imperial College of Science, Technology and Medicine, 180 Queen's
22  * Gate, London SW7 2BZ, England.
23  */
24 #ifndef _LWPINT_H
25 #define _LWPINT_H
26
27 /* `liveness' counter: check signals every `n' visits to the scheduler */
28 /* note: the lower this value, the more responsive the system but the */
29 /* more inefficient the context switch time */
30 #define LCOUNT  -1
31
32 #ifdef hpc
33 extern struct lwpProc *initcontext;
34 extern int startpoint;
35 #endif
36
37 #ifdef hpux
38 int lwpSave(jmp_buf);
39 void lwpRestore(jmp_buf);
40 #endif
41
42 #if defined(MIPS) || defined(AIX32) || defined(ALPHA) || defined(__vax)
43 int lwpSave(jmp_buf);
44 void lwpRestore(jmp_buf);
45 #elif defined(SUN4)
46 #define lwpSave(x)      _setjmp(x)
47 #define lwpRestore(x)   _longjmp(x, 1)
48 #elif defined (UCONTEXT)
49 #define lwpSave(x)    getcontext(&(x))
50 #define lwpRestore(x) setcontext(&(x))
51 #else
52 #ifdef hpc
53 #define lwpSave(x)      setjmp(x)
54 #define lwpRestore(x)   longjmp(x, 1)
55 #else
56 #ifndef hpux
57 #define lwpSave(x)      setjmp(x)
58 #define lwpRestore(x)   longjmp(x, 1)
59 #endif /* hpux */
60 #endif /* hpc */
61 #endif
62
63 #ifdef AIX32
64 /* AIX needs 12 extra bytes above the stack; we add it here */
65 #define LWP_EXTRASTACK  3*sizeof(long)
66 #else
67 #define LWP_EXTRASTACK  0
68 #endif
69
70 #define LWP_REDZONE     1024    /* make this a multiple of 1024 */
71
72 /* XXX Note that this assumes sizeof(long) == 4 */
73 #define LWP_CHECKMARK   0x5a5a5a5aL
74
75 #define SIGNALS sigmask(SIGALRM)
76
77 #ifndef hpux
78 typedef double stkalign_t;
79 #else
80 typedef struct {
81     char x[64];
82 } stkalign_t;
83 #endif
84
85 /* internal routines */
86 void lwpAddTail(struct lwpQueue *, struct lwpProc *);
87 struct lwpProc *lwpGetFirst(struct lwpQueue *);
88 void lwpReady(struct lwpProc *);
89 void lwpOnalarm(void);
90
91 #ifdef UCONTEXT
92 void lwpInitContext(struct lwpProc *, stack_t *);
93 #else  /* GETCONTEXT */
94 #ifdef hpc
95 void lwpInitContext(struct lwpProc *, void *);
96 #else
97 #ifdef hpux
98 void lwpInitContext(volatile struct lwpProc * volatile, void *);
99 #else
100 void lwpInitContext(struct lwpProc *, void *);
101 #endif /* hpux */
102 #endif /* hpc */
103 #endif /* GETCONTEXT */
104 void lwpEntryPoint(void);
105 void lwpInitSelect(struct lwpProc * self);
106 void lwpDestroy(struct lwpProc * proc);
107
108 #endif /* _LWP_H */