Back to index

php5  5.3.10
start.c
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2010 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Author: Novell, Inc.                                                 |
00016    +----------------------------------------------------------------------+
00017  */
00018 
00019 
00020 #include <library.h>
00021 #include <netware.h>
00022 #include <nks/synch.h>
00023 
00024 void          *gLibHandle = (void *) NULL;
00025 rtag_t        gAllocTag = (rtag_t) NULL;
00026 NXMutex_t     *gLibLock = (NXMutex_t *) NULL;
00027 int                  gLibId = 0;
00028 
00029 
00030 int DisposeLibraryData(     void   *data)
00031 {
00032        return 0;
00033 }
00034 
00035 
00036 int _NonAppStart
00037 (
00038        void                 *NLMHandle,
00039        void                 *errorScreen,
00040        const char    *cmdLine,
00041        const char    *loadDirPath,
00042        size_t        uninitializedDataLength,
00043        void                 *NLMFileHandle,
00044        int                  (*readRoutineP)( int conn, void *fileHandle, size_t offset,
00045                                                         size_t nbytes, size_t *bytesRead, void *buffer ),
00046        size_t        customDataOffset,
00047        size_t        customDataSize,
00048        int                  messageCount,
00049        const char    **messages
00050 )
00051 {
00052        NX_LOCK_INFO_ALLOC(liblock, "Per-Application Data Lock", 0);
00053 
00054 #pragma unused(cmdLine)
00055 #pragma unused(loadDirPath)
00056 #pragma unused(uninitializedDataLength)
00057 #pragma unused(NLMFileHandle)
00058 #pragma unused(readRoutineP)
00059 #pragma unused(customDataOffset)
00060 #pragma unused(customDataSize)
00061 #pragma unused(messageCount)
00062 #pragma unused(messages)
00063 
00064 /* Here we process our command line, post errors (to the error screen),
00065  * perform initializations and anything else we need to do before being able
00066  * to accept calls into us. If we succeed, we return non-zero and the NetWare
00067  * Loader will leave us up, otherwise we fail to load and get dumped.
00068  */
00078        gLibId = register_library(DisposeLibraryData);
00079        if (gLibId == -1) {
00080               OutputToScreen(errorScreen, "Unable to register library with kernel.\n");
00081               return -1;
00082        }
00083 
00084        gLibHandle = NLMHandle;
00085 
00086        gLibLock = NXMutexAlloc(0, 0, &liblock);
00087        if (!gLibLock) {
00088               OutputToScreen(errorScreen, "Unable to allocate library data lock.\n");
00089               return -1;
00090        }
00091 
00092        return 0;
00093 }
00094 
00095 
00096 void _NonAppStop( void )
00097 {
00098 /* Here we clean up any resources we allocated. Resource tags is a big part
00099  * of what we created, but NetWare doesn't ask us to free those.
00100  */
00101        (void) unregister_library(gLibId);
00102        NXMutexFree(gLibLock);
00103 }
00104 
00105 
00106 int  _NonAppCheckUnload( void )
00107 {
00108 /* This function cannot be the first in the file for if the file is linked
00109  * first, then the check-unload function's offset will be nlmname.nlm+0
00110  * which is how to tell that there isn't one. When the check function is
00111  * first in the linked objects, it is ambiguous. For this reason, we will
00112  * put it inside this file after the stop function.
00113  *
00114  * Here we check to see if it's alright to ourselves to be unloaded. If not,
00115  * we return a non-zero value. Right now, there isn't any reason not to allow
00116  * it.
00117  */
00118        return 0;
00119 }