util_nw.c revision 8b53309823af3e793369a65df4e5b994292eb611
4139N/A/* Copyright 2002-2004 Apache Software Foundation
4139N/A *
4139N/A * Licensed under the Apache License, Version 2.0 (the "License");
4139N/A * you may not use this file except in compliance with the License.
4139N/A * You may obtain a copy of the License at
4139N/A *
4139N/A * http://www.apache.org/licenses/LICENSE-2.0
4139N/A *
4139N/A * Unless required by applicable law or agreed to in writing, software
4139N/A * distributed under the License is distributed on an "AS IS" BASIS,
4139N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4139N/A * See the License for the specific language governing permissions and
4139N/A * limitations under the License.
4139N/A */
4139N/A
4139N/A#include "httpd.h"
4139N/A#include "http_log.h"
4139N/A
4139N/A#include <netware.h>
4139N/A#include <nks\netware.h>
4139N/A
4139N/Aint nlmUnloadSignaled(int wait);
4139N/Aevent_handle_t eh;
4139N/AWarn_t ref;
4139N/AReport_t dum;
4139N/A
4139N/AAP_DECLARE(apr_status_t) ap_os_create_privileged_process(
4139N/A const request_rec *r,
4139N/A apr_proc_t *newproc, const char *progname,
4139N/A const char * const *args,
4139N/A const char * const *env,
4139N/A apr_procattr_t *attr, apr_pool_t *p)
4139N/A{
4139N/A return apr_proc_create(newproc, progname, args, env, attr, p);
4139N/A}
4139N/A
4139N/Aint _NonAppCheckUnload( void )
4139N/A{
4139N/A return nlmUnloadSignaled(1);
}
// down server event callback
void ap_down_server_cb(void *, void *)
{
nlmUnloadSignaled(0);
return;
}
// Required place holder event callback
void ap_dummy_cb(void *, void *)
{
return;
}
// destroy callback resources
void ap_cb_destroy(void *)
{
// cleanup down event notification
UnRegisterEventNotification(eh);
NX_UNWRAP_INTERFACE(ref);
NX_UNWRAP_INTERFACE(dum);
}
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
)
{
#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)
// register for down server event
rtag_t rt = AllocateResourceTag(NLMHandle, "Apache2 Down Server Callback",
EventSignature);
NX_WRAP_INTERFACE((void *)ap_down_server_cb, 2, (void **)&ref);
NX_WRAP_INTERFACE((void *)ap_dummy_cb, 2, (void **)&dum);
eh = RegisterForEventNotification(rt, EVENT_DOWN_SERVER,
EVENT_PRIORITY_APPLICATION,
ref, dum, NULL);
// clean-up
NXVmRegisterExitHandler(ap_cb_destroy, NULL);
}