Coda Distributed File System
lwp.private.h
Go to the documentation of this file.
1/* BLURB lgpl
2
3 Coda File System
4 Release 5
5
6 Copyright (c) 1987-2008 Carnegie Mellon University
7 Additional copyrights listed below
8
9This code is distributed "AS IS" without warranty of any kind under
10the terms of the GNU Library General Public Licence Version 2, as
11shown in the file LICENSE. The technical and financial contributors to
12Coda are listed in the file CREDITS.
13
14 Additional copyrights
15
16#*/
17
18/*
19 IBM COPYRIGHT NOTICE
20
21 Copyright (C) 1986
22 International Business Machines Corporation
23 All Rights Reserved
24
25This file contains some code identical to or derived from the 1986
26version of the Andrew File System ("AFS"), which is owned by the IBM
27Corporation. This code is provided "AS IS" and IBM does not warrant
28that it is free of infringement of any intellectual rights of any
29third party. IBM disclaims liability of any kind for any damages
30whatsoever resulting directly or indirectly from use of this software
31or of any derivative work. Carnegie Mellon University has obtained
32permission to modify, distribute and sublicense this code, which is
33based on Version 2 of AFS and does not contain the features and
34enhancements that are part of Version 3 of AFS. Version 3 of AFS is
35commercially available and supported by Transarc Corporation,
36Pittsburgh, PA.
37
38*/
39
40#ifndef _LWP_PRIVATE_
41#define _LWP_PRIVATE_
42
43#ifdef HAVE_CONFIG_H
44#include "config.h"
45#endif
46
47#include <sys/time.h>
48#include <stdio.h>
49#include "lwp_ucontext.h"
50
51/* Initial size of eventlist in a PCB; grows dynamically */
52#define EVINITSIZE 5
53
54struct rock { /* to hide things associated with this LWP under */
55 int tag; /* unique identifier for this rock */
56 char *value; /* pointer to some arbitrary data structure */
57};
58
59#define MAXROCKS 8 /* max no. of rocks per LWP */
60
61struct lwp_pcb { /* process control block */
62 char *name; /* ASCII name */
63 int rc; /* most recent return code */
64 char status; /* status flags */
65 const void **eventlist; /* ptr to array of eventids */
66 char eventlistsize; /* size of eventlist array */
67 int eventcnt; /* no. of events currently in eventlist array*/
68 int wakevent; /* index of eventid causing wakeup */
69 int waitcnt; /* min number of events awaited */
70 int qpending; /* number of pending QSignal events */
71 int priority; /* dispatching priority */
72 PROCESS misc; /* for LWP internal use only */
73 long stackcheck; /* first word of stack for overflow checking */
74 unsigned int valgrind_stackid; /* stack identifier from valgrind */
75 void *topstack; /* stack ptr value during last yield */
76 void (*ep)(void *); /* initial entry point */
77 char *parm; /* initial parm for process */
78 int rused; /* no of rocks presently in use */
79 struct rock rlist[MAXROCKS]; /* set of rocks to hide things under */
80 PROCESS next, prev; /* ptrs to next and previous pcb */
81 int level; /* nesting level of critical sections */
82 struct IoRequest *iomgrRequest; /* request we're waiting for */
83 int index; /* LWP index: should be small index; actually is
84 incremented on each lwp_create_process */
85 struct timeval lastReady; /* if ready, time placed in the run queue */
86
87 stack_t stack; /* allocated stack for this thread */
88 struct lwp_ucontext ctx; /* saved context for next dispatch */
89};
90
91extern int lwp_nextindex; /* Next lwp index to assign */
92
93extern PROCESS lwp_cpptr; /* pointer to current process pcb */
94struct lwp_ctl { /* LWP control structure */
95 int processcnt; /* number of lightweight processes */
96 PROCESS outerpid; /* process carved by Initialize */
97 void *outersp;
98};
99
100/* Debugging macro */
101#ifdef LWPDEBUG
102extern FILE *lwp_logfile;
103#define lwpdebug(level, msg...) \
104 if (lwp_debug > level && lwp_logfile) { \
105 fprintf(lwp_logfile, "***LWP (%p): ", lwp_cpptr); \
106 fprintf(lwp_logfile, ##msg); \
107 fprintf(lwp_logfile, "\n"); \
108 fflush(lwp_logfile); \
109 }
110#else /* !LWPDEBUG */
111#define lwpdebug(level, msg...)
112#endif /* !LWPDEBUG */
113
114#endif /* _LWP_PRIVATE_ */
PROCESS lwp_cpptr
Definition: lwp_pt.c:59
int lwp_nextindex
Definition: lwp.c:134
#define MAXROCKS
Definition: lwp.private.h:59
FILE * lwp_logfile
Definition: lwp_pt.c:41
Definition: iomgr.c:73
Definition: lwp.private.h:94
int processcnt
Definition: lwp.private.h:95
void * outersp
Definition: lwp.private.h:97
PROCESS outerpid
Definition: lwp.private.h:96
Definition: lwp.private_pt.h:33
PROCESS prev
Definition: lwp.private.h:80
int index
Definition: lwp.private.h:83
int priority
Definition: lwp.private_pt.h:39
int rused
Definition: lwp.private.h:78
struct IoRequest * iomgrRequest
Definition: lwp.private.h:82
stack_t stack
Definition: lwp.private.h:87
long stackcheck
Definition: lwp.private.h:73
void(* ep)(void *)
Definition: lwp.private.h:76
PROCESS misc
Definition: lwp.private.h:72
int rc
Definition: lwp.private.h:63
int eventcnt
Definition: lwp.private_pt.h:53
int waitcnt
Definition: lwp.private_pt.h:54
struct rock rlist[MAXROCKS]
Definition: lwp.private.h:79
char status
Definition: lwp.private.h:64
PROCESS next
Definition: lwp.private.h:80
int wakevent
Definition: lwp.private.h:68
void * topstack
Definition: lwp.private.h:75
struct timeval lastReady
Definition: lwp.private.h:85
char * name
Definition: lwp.private_pt.h:41
char eventlistsize
Definition: lwp.private.h:66
char * parm
Definition: lwp.private.h:77
int qpending
Definition: lwp.private.h:70
const void ** eventlist
Definition: lwp.private.h:65
struct lwp_ucontext ctx
Definition: lwp.private.h:88
unsigned int valgrind_stackid
Definition: lwp.private.h:74
int level
Definition: lwp.private.h:81
Definition: lwp_ucontext.h:38
Definition: lwp.private_pt.h:28
int tag
Definition: lwp.private_pt.h:29
char * value
Definition: lwp.private_pt.h:30
Definition: lwp_stacktrace.h:29