Coda Distributed File System
lwp.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 IBM COPYRIGHT NOTICE
19
20 Copyright (C) 1986
21 International Business Machines Corporation
22 All Rights Reserved
23
24This file contains some code identical to or derived from the 1986
25version of the Andrew File System ("AFS"), which is owned by the IBM
26Corporation. This code is provided "AS IS" and IBM does not warrant
27that it is free of infringement of any intellectual rights of any
28third party. IBM disclaims liability of any kind for any damages
29whatsoever resulting directly or indirectly from use of this software
30or of any derivative work. Carnegie Mellon University has obtained
31permission to modify, distribute and sublicense this code, which is
32based on Version 2 of AFS and does not contain the features and
33enhancements that are part of Version 3 of AFS. Version 3 of AFS is
34commercially available and supported by Transarc Corporation,
35Pittsburgh, PA.
36*/
37
38#ifndef _LWP_LWP_H_
39#define _LWP_LWP_H_
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45#include <sys/time.h>
46#include <sys/types.h>
47#include <time.h>
48#include <unistd.h>
49#include <stdio.h>
50
51/*
52 LWP_VERSION is first argument to LWP_Init().
53 Ensures header matches library.
54*/
55/* Change this if you make an incompatible change of some kind */
56#if !defined(_REENTRANT) && !defined(_THREAD_SAFE)
57#define LWP_VERSION 210888002 /* old lwp */
58#else
59#define LWP_VERSION 210888003 /* pthreaded lwp */
60#endif
61
62#define LWP_SUCCESS 0
63#define LWP_EBADPID -1
64#define LWP_EBLOCKED -2
65#define LWP_EINIT -3
66#define LWP_EMAXPROC -4
67#define LWP_ENOBLOCK -5
68#define LWP_ENOMEM -6
69#define LWP_ENOPROCESS -7
70#define LWP_ENOWAIT -8
71#define LWP_EBADCOUNT -9
72#define LWP_EBADEVENT -10
73#define LWP_EBADPRI -11
74#define LWP_NO_STACK -12
75/* These two are for the signal mechanism. */
76#define LWP_EBADSIG -13 /* bad signal number */
77#define LWP_ESYSTEM -14 /* system call failed */
78/* These are for the rock mechanism */
79#define LWP_ENOROCKS -15 /* all rocks are in use */
80#define LWP_EBADROCK -16 /* the specified rock does not exist */
81
82/* Maximum priority permissible (minimum is always 0) */
83#define LWP_MAX_PRIORITY 4
84
85/* Usual priority used by user LWPs */
86#define LWP_NORMAL_PRIORITY (LWP_MAX_PRIORITY - 1)
87
88/* Users aren't really supposed to know what a pcb is, but .....*/
89typedef struct lwp_pcb *PROCESS;
90
91extern int lwp_debug; /* ON = show LWP debugging trace */
92
93/* Action to take on stack overflow. */
94#define LWP_SOQUIET 1 /* do nothing */
95#define LWP_SOABORT 2 /* abort the program */
96#define LWP_SOMESSAGE 3 /* print a message and be quiet */
97extern int lwp_overflowAction;
98
99/* Tells if stack size counting is enabled. */
100extern int lwp_stackUseEnabled;
101
102/* variables used for checking work time of an lwp */
103extern struct timeval last_context_switch; /* how long a lwp was running */
104extern struct timeval cont_sw_threshold; /* how long a lwp is allowed to run */
105
106extern struct timeval run_wait_threshold;
107
108void LWP_SetLog(FILE *file, int level);
109extern int LWP_QWait();
110extern int LWP_QSignal(PROCESS pid);
111extern int LWP_Init(int version, int priority, PROCESS *pid);
112extern int LWP_TerminateProcessSupport();
113extern int LWP_CreateProcess(void (*ep)(void *), int stacksize, int priority,
114 void *parm, const char *name, PROCESS *pid);
115extern int LWP_CurrentProcess(PROCESS *pid);
117extern void LWP_SetLog(FILE *, int);
118extern int LWP_DestroyProcess(PROCESS pid);
119extern int LWP_DispatchProcess();
120extern int LWP_GetProcessPriority(PROCESS pid, int *priority);
121extern int LWP_INTERNALSIGNAL(const void *event, int yield);
122extern int LWP_WaitProcess(const void *event);
123extern int LWP_MwaitProcess(int wcount, const void *evlist[]);
124extern int LWP_StackUsed(PROCESS pid, int *max, int *used);
125extern int LWP_NewRock(int Tag, char *Value);
126extern int LWP_GetRock(int Tag, char **Value);
127extern char *LWP_Name(); /* NOTE: returs a char * !! */
128extern int LWP_Index();
129extern int LWP_HighestIndex();
130extern void LWP_UnProtectStacks(); /* only available for newlwp */
131extern void LWP_ProtectStacks();
132
133#define LWP_SignalProcess(event) LWP_INTERNALSIGNAL(event, 1)
134#define LWP_NoYieldSignal(event) LWP_INTERNALSIGNAL(event, 0)
135
136void PRE_Concurrent(int on);
137void PRE_BeginCritical(void);
138void PRE_EndCritical(void);
139
140/* extern definitions for the io manager routines */
141extern int IOMGR_SoftSig(void (*aproc)(void *), char *arock);
142extern int IOMGR_Initialize();
143extern int IOMGR_Finalize();
144extern int IOMGR_Poll();
145extern int IOMGR_Select(int fds, fd_set *readfds, fd_set *writefds,
146 fd_set *exceptfds, struct timeval *timeout);
147extern int IOMGR_Cancel(PROCESS pid);
148extern int IOMGR_Signal(int signo, char *event);
149extern int IOMGR_CancelSignal(int signo);
150
151/* declarations for fasttime.c routines */
152extern int FT_Init(int printErrors, int notReally);
153extern int FT_GetTimeOfDay(struct timeval *tv, struct timezone *tz);
154extern int TM_GetTimeOfDay(struct timeval *tv, struct timezone *tz);
155extern int FT_AGetTimeOfDay(struct timeval *tv, struct timezone *tz);
156extern unsigned int FT_ApproxTime();
157
158#ifdef __cplusplus
159}
160#endif
161
162#endif /* _LWP_LWP_H_ */
FILE * file
Definition: dirtest.c:723
int IOMGR_Signal(int signo, char *event)
Definition: iomgr_pt.c:96
int LWP_NewRock(int Tag, char *Value)
Definition: lwp_pt.c:521
void LWP_UnProtectStacks()
Definition: lwp_pt.c:610
void PRE_BeginCritical(void)
Definition: preempt_pt.c:43
int LWP_QWait()
Definition: lwp_pt.c:416
int LWP_StackUsed(PROCESS pid, int *max, int *used)
Definition: lwp_pt.c:591
int LWP_Index()
Definition: lwp_pt.c:600
int LWP_CreateProcess(void(*ep)(void *), int stacksize, int priority, void *parm, const char *name, PROCESS *pid)
Definition: lwp_pt.c:297
struct timeval cont_sw_threshold
Definition: lwp_pt.c:37
int LWP_DispatchProcess()
Definition: mklka.c:49
int IOMGR_Select(int fds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
Definition: iomgr_pt.c:48
int FT_Init(int printErrors, int notReally)
Definition: fasttime.c:57
int LWP_TerminateProcessSupport()
Definition: lwp_pt.c:355
int FT_AGetTimeOfDay(struct timeval *tv, struct timezone *tz)
Definition: fasttime.c:98
int IOMGR_CancelSignal(int signo)
Definition: iomgr_pt.c:102
int TM_GetTimeOfDay(struct timeval *tv, struct timezone *tz)
Definition: fasttime.c:93
char * LWP_Name()
Definition: lwp_pt.c:561
int FT_GetTimeOfDay(struct timeval *tv, struct timezone *tz)
Definition: fasttime.c:81
int LWP_MwaitProcess(int wcount, const void *evlist[])
Definition: lwp_pt.c:472
struct timeval run_wait_threshold
Definition: lwp_pt.c:38
PROCESS LWP_ThisProcess()
Definition: lwp_pt.c:583
void PRE_EndCritical(void)
Definition: preempt_pt.c:52
struct lwp_pcb * PROCESS
Definition: lwp.h:89
int IOMGR_Poll()
Definition: iomgr_pt.c:71
struct timeval last_context_switch
Definition: lwp_pt.c:36
int LWP_Init(int version, int priority, PROCESS *pid)
Definition: lwp_pt.c:174
int IOMGR_SoftSig(void(*aproc)(void *), char *arock)
Definition: iomgr_pt.c:90
int IOMGR_Initialize()
Definition: iomgr_pt.c:42
int IOMGR_Cancel(PROCESS pid)
Definition: iomgr_pt.c:76
int lwp_debug
Definition: lwp_pt.c:32
int LWP_INTERNALSIGNAL(const void *event, int yield)
Definition: lwp_pt.c:430
int lwp_overflowAction
Definition: lwp_pt.c:33
int LWP_DestroyProcess(PROCESS pid)
Definition: lwp_pt.c:345
int LWP_GetProcessPriority(PROCESS pid, int *priority)
Definition: lwp_pt.c:569
int IOMGR_Finalize()
Definition: iomgr_pt.c:84
int lwp_stackUseEnabled
Definition: lwp_pt.c:34
void LWP_SetLog(FILE *file, int level)
Definition: lwp_pt.c:576
int LWP_GetRock(int Tag, char **Value)
Definition: lwp_pt.c:543
int LWP_WaitProcess(const void *event)
Definition: lwp_pt.c:512
void LWP_ProtectStacks()
Definition: lwp_pt.c:615
int LWP_CurrentProcess(PROCESS *pid)
Definition: lwp_pt.c:214
int LWP_HighestIndex()
Definition: lwp_pt.c:605
unsigned int FT_ApproxTime()
Definition: fasttime.c:108
int LWP_QSignal(PROCESS pid)
Definition: lwp_pt.c:410
void PRE_Concurrent(int on)
Definition: preempt_pt.c:24
used
Definition: find_unused_symbols.py:78
level
Definition: make_certs.py:100
name
Definition: pwdtopdbtool.py:40
PeerInfo RemoteSubsys Tag
Definition: sftp6.c:135
Definition: lwp.private_pt.h:33