Back to index

php5  5.3.10
Functions | Variables
start.c File Reference
#include <library.h>
#include <netware.h>
#include <nks/synch.h>

Go to the source code of this file.

Functions

int DisposeLibraryData (void *data)
int _NonAppStart (void *NLMHandle, void *errorScreen, const char *cmdLine, const char *loadDirPath, size_t uninitializedDataLength, void *NLMFileHandle, int(*readRoutineP)(int conn, void *fileHandle, size_t offset, size_t nbytes, size_t *bytesRead, void *buffer), size_t customDataOffset, size_t customDataSize, int messageCount, const char **messages)
void _NonAppStop (void)
int _NonAppCheckUnload (void)

Variables

void * gLibHandle = (void *) NULL
rtag_t gAllocTag = (rtag_t) NULL
NXMutex_t * gLibLock = (NXMutex_t *) NULL
int gLibId = 0

Function Documentation

int _NonAppCheckUnload ( void  )

Definition at line 106 of file start.c.

{
/* This function cannot be the first in the file for if the file is linked
 * first, then the check-unload function's offset will be nlmname.nlm+0
 * which is how to tell that there isn't one. When the check function is
 * first in the linked objects, it is ambiguous. For this reason, we will
 * put it inside this file after the stop function.
 *
 * Here we check to see if it's alright to ourselves to be unloaded. If not,
 * we return a non-zero value. Right now, there isn't any reason not to allow
 * it.
 */
       return 0;
}
int _NonAppStart ( void *  NLMHandle,
void *  errorScreen,
const char *  cmdLine,
const char *  loadDirPath,
size_t  uninitializedDataLength,
void *  NLMFileHandle,
int(*)(int conn, void *fileHandle, size_t offset, size_t nbytes, size_t *bytesRead, void *buffer)  readRoutineP,
size_t  customDataOffset,
size_t  customDataSize,
int  messageCount,
const char **  messages 
)

gAllocTag = AllocateResourceTag(NLMHandle, "<library-name> memory allocations", AllocSignature); if (!gAllocTag) { OutputToScreen(errorScreen, "Unable to allocate resource tag for " "library memory allocations.\n"); return -1; }

Definition at line 37 of file start.c.

{
       NX_LOCK_INFO_ALLOC(liblock, "Per-Application Data Lock", 0);

#pragma unused(cmdLine)
#pragma unused(loadDirPath)
#pragma unused(uninitializedDataLength)
#pragma unused(NLMFileHandle)
#pragma unused(readRoutineP)
#pragma unused(customDataOffset)
#pragma unused(customDataSize)
#pragma unused(messageCount)
#pragma unused(messages)

/* Here we process our command line, post errors (to the error screen),
 * perform initializations and anything else we need to do before being able
 * to accept calls into us. If we succeed, we return non-zero and the NetWare
 * Loader will leave us up, otherwise we fail to load and get dumped.
 */
       gLibId = register_library(DisposeLibraryData);
       if (gLibId == -1) {
              OutputToScreen(errorScreen, "Unable to register library with kernel.\n");
              return -1;
       }

       gLibHandle = NLMHandle;

       gLibLock = NXMutexAlloc(0, 0, &liblock);
       if (!gLibLock) {
              OutputToScreen(errorScreen, "Unable to allocate library data lock.\n");
              return -1;
       }

       return 0;
}

Here is the call graph for this function:

void _NonAppStop ( void  )

Definition at line 96 of file start.c.

{
/* Here we clean up any resources we allocated. Resource tags is a big part
 * of what we created, but NetWare doesn't ask us to free those.
 */
       (void) unregister_library(gLibId);
       NXMutexFree(gLibLock);
}
int DisposeLibraryData ( void *  data)

Definition at line 30 of file start.c.

{
       return 0;
}

Here is the caller graph for this function:


Variable Documentation

rtag_t gAllocTag = (rtag_t) NULL

Definition at line 25 of file start.c.

void* gLibHandle = (void *) NULL

Definition at line 24 of file start.c.

int gLibId = 0

Definition at line 27 of file start.c.

NXMutex_t* gLibLock = (NXMutex_t *) NULL

Definition at line 26 of file start.c.