/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
- *
+ *
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
#include <afsconfig.h>
#include <afs/param.h>
+#include <roken.h>
#ifdef AFS_NT40_ENV
-#include <stdio.h>
-#include <stdlib.h>
+#include <afs/opr.h>
#include <afs/afsutil.h>
#include "lwp.h"
/* Forward declarations */
static void Dispatcher(void);
-static void Exit_LWP(void);
static void Abort_LWP(char *msg);
static VOID WINAPI Enter_LWP(PVOID fiberData);
static void Initialize_PCB(PROCESS pcb, int priority, int stacksize,
* pid - return this process
* value:
* LWP_SUCCESS (else aborts)
- *
+ *
*/
int LWP_InitializeProcessSupport(int priority, PROCESS *pid)
Abort_LWP("Insufficient Storage to Initialize LWP PCB");
(void) memset((void*)pcb, 0, sizeof(*pcb));
pcb->fiber = ConvertThreadToFiber(pcb);
- if (pcb == NULL)
+ if (pcb == NULL)
Abort_LWP("Cannot convert main thread to LWP fiber");
lwp_init = (struct lwp_ctl *) malloc(sizeof(struct lwp_ctl));
Initialize_PCB(pcb, priority, 0, NULL, NULL,
- "Main Process [created by LWP]");
+ "Main Process [created by LWP]");
lwp_cpptr = pcb;
Debug(10, ("Init: Insert 0x%p into runnable at priority %d\n", pcb, priority))
insert(pcb, &runnable[priority]);
if ( ( value = getenv("AFS_LWP_STACK_SIZE")) == NULL )
- lwp_MinStackSize = AFS_LWP_MINSTACKSIZE;
+ lwp_MinStackSize = AFS_LWP_MINSTACKSIZE;
else
lwp_MinStackSize = (AFS_LWP_MINSTACKSIZE>atoi(value)?
AFS_LWP_MINSTACKSIZE : atoi(value));
-
+
*pid = pcb;
return LWP_SUCCESS;
*
* Arguments:
* funP - start function
- * stacksize - size of
+ * stacksize - size of
* priority - LWP priority
* argP - initial parameter for start function
* name - name of LWP
char *name, PROCESS *pid)
{
PROCESS pcb;
-
+
purge_dead_pcbs();
pcb = (PROCESS)malloc(sizeof(*pcb));
pcb->fiber = CreateFiber(stacksize, Enter_LWP, pcb);
if (pcb->fiber == NULL) {
- free((void*)pcb);
+ free(pcb);
return LWP_EINIT;
}
Debug(0, ("Create: pcb=0x%p, funP=0x%p, argP=0x%p\n", pcb, funP, argP))
if (!lwp_init)
return LWP_EINIT;
-
+
if (lwp_cpptr != pid) {
Dispose_of_Dead_PCB(pid);
} else {
if (ecount > lwp_cpptr->eventlistsize) {
void **save_eventlist = lwp_cpptr->eventlist;
- lwp_cpptr->eventlist = (char **)realloc(lwp_cpptr->eventlist,
- ecount*sizeof(char *));
+ lwp_cpptr->eventlist = realloc(lwp_cpptr->eventlist,
+ ecount*sizeof(char *));
if (lwp_cpptr->eventlist == NULL) {
lwp_cpptr->eventlist = save_eventlist;
Dispatcher();
printf("***LWP: Abort --- dumping PCBs ...\n");
Dump_Processes();
#endif
- Exit_LWP();
+ opr_abort();
}
#ifdef DEBUG
SwitchToFiber(lwp_cpptr->fiber);
}
-void lwp_abort(void)
-{
- afs_NTAbort();
-}
-
-static void Exit_LWP(void)
-{
-
- lwp_abort();
-}
-
static void Delete_PCB(PROCESS pid)
{
Debug(4, ("Entered Delete_PCB"))
if (pid->fiber != NULL) {
DeleteFiber(pid->fiber);
}
- if (pid->eventlist != NULL) free((void*)pid->eventlist);
- free((void*)pid);
+ if (pid->eventlist != NULL) free(pid->eventlist);
+ free(pid);
}
static void Dispose_of_Dead_PCB(PROCESS cur)