removed NSPR

Mon, 31 Dec 2012 00:07:52 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 31 Dec 2012 00:07:52 +0100
changeset 40
56cda23f48d4
parent 39
de4bc3cd2d36
child 41
bb7a1f5a8b48

removed NSPR

.hgignore file | annotate | diff | comparison | revisions
Makefile file | annotate | diff | comparison | revisions
conf.mk file | annotate | diff | comparison | revisions
configure file | annotate | diff | comparison | revisions
make/install.mk file | annotate | diff | comparison | revisions
src/server/Makefile file | annotate | diff | comparison | revisions
src/server/util/pool.c file | annotate | diff | comparison | revisions
src/server/util/pool_pvt.h file | annotate | diff | comparison | revisions
src/server/util/systhr.c file | annotate | diff | comparison | revisions
src/server/util/systhr.h file | annotate | diff | comparison | revisions
templates/config/server.conf file | annotate | diff | comparison | revisions
templates/config/server.template file | annotate | diff | comparison | revisions
--- a/.hgignore	Sun Dec 30 15:49:44 2012 +0100
+++ b/.hgignore	Mon Dec 31 00:07:52 2012 +0100
@@ -1,2 +1,3 @@
 relre:^work/.*$
 relre:^build/.*$
+relre:^config.mk$
--- a/Makefile	Sun Dec 30 15:49:44 2012 +0100
+++ b/Makefile	Mon Dec 31 00:07:52 2012 +0100
@@ -26,44 +26,19 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-include conf.mk
-
-all:
+all: config.mk
 	@echo "build server"
 	cd src; $(MAKE) all
 
+config.mk:
+	@echo "create config"
+	./configure
+
 clean:
 	@echo "clean"
 	rm -f -R build
 	rm -f -R work
 
-install: all
-	@echo "install Webserver to $(WS_INSTALL_DIR)"
-	mkdir -p $(WS_INSTALL_DIR)bin
-	mkdir -p $(WS_INSTALL_DIR)lib
-	mkdir -p $(WS_INSTALL_DIR)config
-	mkdir -p $(WS_INSTALL_DIR)docs
-	mkdir -p $(WS_INSTALL_DIR)logs
-	mkdir -p $(WS_INSTALL_DIR)include
-	@echo "copy config"
-	cp templates/config/init.conf $(WS_INSTALL_DIR)config/init.conf
-	cp templates/config/obj.conf $(WS_INSTALL_DIR)config/obj.conf
-	cp templates/config/server.conf $(WS_INSTALL_DIR)config/server.conf
-	cp templates/config/mime.types $(WS_INSTALL_DIR)config/mime.types
-	@echo "copy binaries"
-	mv work/bin/webservd work/bin/webservd.bin
-	cp work/bin/webservd.bin $(WS_INSTALL_DIR)bin/webservd
-	rm work/bin/webservd.bin
-	@echo "copy includes"
-	cp src/server/public/nsapi.h $(WS_INSTALL_DIR)include/nsapi.h
-	@echo "copy scripts"
-	sed s:%%WS_INSTALL_DIR%%:$(WS_INSTALL_DIR):g templates/bin/startserv.template > $(WS_INSTALL_DIR)bin/startserv
-	chmod +x $(WS_INSTALL_DIR)bin/startserv
-	sed s:%%WS_INSTALL_DIR%%:$(WS_INSTALL_DIR):g templates/bin/stopserv.template > $(WS_INSTALL_DIR)bin/stopserv
-	chmod -x $(WS_INSTALL_DIR)bin/stopserv
-	sed s:%%WS_INSTALL_DIR%%:$(WS_INSTALL_DIR):g templates/bin/reconfig.template > $(WS_INSTALL_DIR)bin/reconfig
-	chmod -x $(WS_INSTALL_DIR)bin/reconfig
-	@echo "copy docs"
-	cp -R templates/docs $(WS_INSTALL_DIR)
-	
+install:
+	cd make; $(MAKE) -f install.mk install
 
--- a/conf.mk	Sun Dec 30 15:49:44 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2011 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-WS_INSTALL_DIR = work/
-
-OS = $(shell uname)
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configure	Mon Dec 31 00:07:52 2012 +0100
@@ -0,0 +1,66 @@
+#!/bin/sh
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 2011 Olaf Wintermann. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+#   1. Redistributions of source code must retain the above copyright
+#      notice, this list of conditions and the following disclaimer.
+#
+#   2. Redistributions in binary form must reproduce the above copyright
+#      notice, this list of conditions and the following disclaimer in the
+#      documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# TODO: parse arguments
+#
+
+OS=`uname -s`
+HOST=`uname -n`
+INSTALL_DIR=`pwd`/work
+
+# create config.mk
+echo "generate config.mk"
+
+cat > config.mk << __EOF__
+#
+# config.mk generated by configure
+#
+
+INSTALL_DIR = $INSTALL_DIR
+HOST = $HOST
+
+# make variables
+__EOF__
+
+# platform
+if [ $OS = SunOS ]; then
+echo "SUNOS = true" >> config.mk
+fi
+
+if [ $OS = Linux ]; then
+echo "LINUX = true" >> config.mk
+fi
+
+if [ $OS = Darwin ]; then
+echo "OSX = true" >> config.mk
+fi
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/install.mk	Mon Dec 31 00:07:52 2012 +0100
@@ -0,0 +1,58 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 2012 Olaf Wintermann. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+#   1. Redistributions of source code must retain the above copyright
+#      notice, this list of conditions and the following disclaimer.
+#
+#   2. Redistributions in binary form must reproduce the above copyright
+#      notice, this list of conditions and the following disclaimer in the
+#      documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+include ../config.mk
+
+install:
+	@echo "install Webserver to $(WS_INSTALL_DIR)"
+	mkdir -p $(INSTALL_DIR)/bin
+	mkdir -p $(INSTALL_DIR)/lib
+	mkdir -p $(INSTALL_DIR)/config
+	mkdir -p $(INSTALL_DIR)/docs
+	mkdir -p $(INSTALL_DIR)/logs
+	mkdir -p $(INSTALL_DIR)/include
+	@echo "copy config"
+	cp ../templates/config/init.conf $(INSTALL_DIR)/config/init.conf
+	cp ../templates/config/obj.conf $(INSTALL_DIR)/config/obj.conf
+	cp ../templates/config/mime.types $(INSTALL_DIR)/config/mime.types
+	sed s:%%WS_HOST%%:$(HOST):g ../templates/config/server.template > $(INSTALL_DIR)/config/server.conf
+	@echo "copy binaries"
+	mv ../work/bin/webservd ../work/bin/webservd.bin
+	cp ../work/bin/webservd.bin $(INSTALL_DIR)/bin/webservd
+	rm ../work/bin/webservd.bin
+	@echo "copy includes"
+	cp ../src/server/public/nsapi.h $(INSTALL_DIR)/include/nsapi.h
+	@echo "copy scripts"
+	sed s:%%WS_INSTALL_DIR%%:$(INSTALL_DIR):g ../templates/bin/startserv.template > $(INSTALL_DIR)/bin/startserv
+	chmod +x $(INSTALL_DIR)/bin/startserv
+	sed s:%%WS_INSTALL_DIR%%:$(INSTALL_DIR):g ../templates/bin/stopserv.template > $(INSTALL_DIR)/bin/stopserv
+	chmod -x $(INSTALL_DIR)/bin/stopserv
+	sed s:%%WS_INSTALL_DIR%%:$(INSTALL_DIR):g ../templates/bin/reconfig.template > $(INSTALL_DIR)/bin/reconfig
+	chmod -x $(INSTALL_DIR)/bin/reconfig
+	@echo "copy docs"
+	cp -R ../templates/docs $(INSTALL_DIR)/
--- a/src/server/Makefile	Sun Dec 30 15:49:44 2012 +0100
+++ b/src/server/Makefile	Mon Dec 31 00:07:52 2012 +0100
@@ -27,11 +27,11 @@
 #
 
 BUILD_ROOT = ../../
-include $(BUILD_ROOT)conf.mk
+include $(BUILD_ROOT)config.mk
 
 CFLAGS  = -xc99
 
-LDFLAGS = -pg -L/usr/lib/mps -R/usr/lib/mps -lplds4 -lplc4 -lnspr4 -lpthread -ldl -lposix4  -lsocket -lnsl -lgen -lm -lsendfile -lxerces-c -lldap
+LDFLAGS = -pg -lpthread -ldl -lposix4  -lsocket -lnsl -lgen -lm -lsendfile -lxerces-c -lldap
 
 OBJ_DIR = $(BUILD_ROOT)build/
 
--- a/src/server/util/pool.c	Sun Dec 30 15:49:44 2012 +0100
+++ b/src/server/util/pool.c	Mon Dec 31 00:07:52 2012 +0100
@@ -80,9 +80,9 @@
 static int 
 pool_internal_init()
 {
-    if (pool_global_stats.lock == NULL) {
-        pool_global_stats.lock = PR_NewLock();
-    }
+    //if (pool_global_stats.lock == NULL) {
+    //    pool_global_stats.lock = PR_NewLock(); // TODO: remove
+    //}
 
     if (pool_config.block_size == 0) {
         //ereport(LOG_INFORM, XP_GetAdminStr(DBT_poolInitInternalAllocatorDisabled_));
@@ -234,9 +234,9 @@
         /* Have to initialize now, as pools get created sometimes
          * before pool_init can be called...
          */
-        if (pool_global_stats.lock == NULL) {
-            pool_internal_init();
-        }
+        //if (pool_global_stats.lock == NULL) { // TODO: remove
+        //    pool_internal_init();
+        //}
 
         newpool->used_blocks = NULL;
         newpool->free_blocks = NULL;
@@ -262,14 +262,18 @@
         }
 
         /* Add to known pools list */
-        PR_Lock(pool_global_stats.lock);
-        newpool->next = pool_global_stats.poolList;
-        pool_global_stats.poolList = newpool;
-        ++pool_global_stats.createCnt;
+        
+        // NOTICE:
+        // known pools list removed
+        
+        //PR_Lock(pool_global_stats.lock);
+        //newpool->next = pool_global_stats.poolList;
+        //pool_global_stats.poolList = newpool;
+        //++pool_global_stats.createCnt;
 #ifdef PER_POOL_STATISTICS
         newpool->stats.poolId = pool_global_stats.createCnt;
 #endif /* PER_POOL_STATISTICS */
-        PR_Unlock(pool_global_stats.lock);
+        //PR_Unlock(pool_global_stats.lock);
 
     }
     else {
@@ -300,7 +304,7 @@
 {
     pool_t *pool = (pool_t *)pool_handle;
 
-    PR_ASSERT(pool != NULL);
+    //PR_ASSERT(pool != NULL);
 
     if (pool == NULL)
         return NULL;
@@ -337,14 +341,14 @@
     block_t *tmp_blk;
     unsigned long blen;
 
-    PR_ASSERT(pool != NULL);
+    //PR_ASSERT(pool != NULL);
 
     if (pool == NULL)
         return;
 
     /* Fix up curr_block.  There should always be a curr_block. */
     tmp_blk = pool->curr_block;
-    PR_ASSERT(tmp_blk != NULL);
+    //PR_ASSERT(tmp_blk != NULL);
 
     /* Start with curr_block, then scan blocks on used_blocks list */
     for (;;) {
@@ -365,7 +369,7 @@
                 blen = tmp_blk->end - (char *)mark;
             }
             pool->size -= blen;
-            PR_ASSERT(pool->size >= 0);
+            //PR_ASSERT(pool->size >= 0);
             tmp_blk->start = (char *)mark;
             pool->curr_block = tmp_blk;
             break;
@@ -382,14 +386,14 @@
         }
         tmp_blk->start = tmp_blk->data;
         pool->size -= blen;
-        PR_ASSERT(pool->size >= 0);
+        //PR_ASSERT(pool->size >= 0);
 
         /*
          * If there are no more used blocks after this one, then set
          * this block up as the current block and return.
          */
         if (pool->used_blocks == NULL) {
-            PR_ASSERT(mark == NULL);
+            //PR_ASSERT(mark == NULL);
             pool->curr_block = tmp_blk;
             break;
         }
@@ -418,7 +422,7 @@
         }
 
 #ifdef PER_POOL_STATISTICS
-        ++pool->stats.blkFree;
+        //++pool->stats.blkFree;
 #endif /* PER_POOL_STATISTICS */
 
         /* Remove next block from used blocks list */
@@ -433,7 +437,7 @@
     pool_t *pool = (pool_t *)pool_handle;
     block_t *tmp_blk;
 
-    PR_ASSERT(pool != NULL);
+    //PR_ASSERT(pool != NULL);
 
     if (pool == NULL)
         return;
@@ -457,6 +461,8 @@
         pool_t **ppool;
 
         /* Remove from the known pools list */
+        // NOTICE: known pools list removed
+        /*
         PR_Lock(pool_global_stats.lock);
         for (ppool = &pool_global_stats.poolList;
              *ppool; ppool = &(*ppool)->next) {
@@ -467,6 +473,7 @@
             }
         }
         PR_Unlock(pool_global_stats.lock);
+        */
     }
 
 #ifdef POOL_ZERO_DEBUG
@@ -509,7 +516,7 @@
 
         /* Count unallocated bytes in current block in pool size */
         pool->size += curr_block->end - curr_block->start;
-        PR_ASSERT(pool->size >= 0);
+        //PR_ASSERT(pool->size >= 0);
 #ifdef PER_POOL_STATISTICS
         if (pool->size > pool->stats.maxAlloc) {
             pool->stats.maxAlloc = pool->size;
@@ -540,7 +547,7 @@
     }
 
     pool->size += reqsize;
-    PR_ASSERT(pool->size >= 0);
+    //PR_ASSERT(pool->size >= 0);
 
 #ifdef PER_POOL_STATISTICS
     if (pool->size > pool->stats.maxAlloc) {
@@ -566,7 +573,7 @@
         return;
     }
 
-    PR_ASSERT(_ptr_in_pool(pool, ptr));
+    //PR_ASSERT(_ptr_in_pool(pool, ptr));
 
 #ifdef PER_POOL_STATISTICS
 
@@ -669,7 +676,7 @@
     if (pool == NULL)
         return;
 
-    PR_ASSERT(_ptr_in_pool(pool, ptr));
+    //PR_ASSERT(_ptr_in_pool(pool, ptr));
 }
 #endif
 
--- a/src/server/util/pool_pvt.h	Sun Dec 30 15:49:44 2012 +0100
+++ b/src/server/util/pool_pvt.h	Mon Dec 31 00:07:52 2012 +0100
@@ -36,6 +36,7 @@
 
 #ifndef BASE_POOL_H
 #include "pool.h"
+#include <inttypes.h>
 #endif /* BASE_POOL_H */
 
 /*
@@ -53,7 +54,7 @@
 #endif
 
 /* Define POOL_GLOBAL_STATISTICS to get global pool statistics */
-#define POOL_GLOBAL_STATISTICS
+//define POOL_GLOBAL_STATISTICS // TODO: redefine
 
 /*
  * When POOL_ZERO_DEBUG is defined, overwrite the contents of freed
@@ -109,9 +110,9 @@
 
 typedef struct pool_config_t pool_config_t;
 struct pool_config_t {
-    PRUint32 block_size;   /* size of blocks to allocate */
-    PRUint32 retain_size;  /* maximum bytes kept on per-pool free list */
-    PRUint32 retain_num;   /* maximum blocks kept on per-pool free list */
+    int32_t block_size;   /* size of blocks to allocate */
+    int32_t retain_size;  /* maximum bytes kept on per-pool free list */
+    int32_t retain_num;   /* maximum blocks kept on per-pool free list */
 };
 
 #define POOL_CONFIG_INIT { \
@@ -149,8 +150,8 @@
     block_t  *curr_block;       /* current block being used */
     block_t  *used_blocks;      /* blocks that are all used up */
     block_t  *free_blocks;      /* blocks that are free */
-    PRUint32  free_size;        /* number of bytes in free_blocks */
-    PRUint32  free_num;         /* number of blocks in free_blocks */
+    int32_t  free_size;        /* number of bytes in free_blocks */
+    int32_t  free_num;         /* number of blocks in free_blocks */
     size_t    size;             /* size of memory in pool */
     pool_t   *next;             /* known_pools list */
 #ifdef PER_POOL_STATISTICS
@@ -160,10 +161,10 @@
 
 typedef struct pool_global_stats_t pool_global_stats_t;
 struct pool_global_stats_t {
-    PRLock   *lock;        /* lock for access to poolList */
+    //PRLock   *lock;        /* lock for access to poolList */ // TODO: remove
     pool_t   *poolList;    /* list of known pools */
-    PRUint32  createCnt;   /* count of pools created */
-    PRUint32  destroyCnt;  /* count of pools destroyed */
+    int32_t  createCnt;   /* count of pools created */
+    int32_t  destroyCnt;  /* count of pools destroyed */
 #ifdef POOL_GLOBAL_STATISTICS
     PRUint32  blkAlloc;    /* count of block allocations from heap */
     PRUint32  blkFree;     /* count of blocks freed to heap */
--- a/src/server/util/systhr.c	Sun Dec 30 15:49:44 2012 +0100
+++ b/src/server/util/systhr.c	Mon Dec 31 00:07:52 2012 +0100
@@ -41,8 +41,8 @@
 #include "systhr.h"
 //include "ereport.h"
 
-#include "prinit.h"
-#include "prthread.h"
+//include "prinit.h"
+//include "prthread.h"
 #include "private/pprthred.h"
 
 #include "systems.h"
@@ -83,35 +83,29 @@
     return pthread_self();
 }
 
-void systhread_yield(void)
-{
+void systhread_yield(void) {
     sched_yield();
 }
 
 
-void systhread_timerset(int usec)
-{
+void systhread_timerset(int usec) {
    
 }
 
-SYS_THREAD systhread_attach(void)
-{
+SYS_THREAD systhread_attach(void) {
     /* TODO: what to do? */
     return 0;
 }
 
-void systhread_detach(SYS_THREAD thr)
-{
+void systhread_detach(SYS_THREAD thr) {
     pthread_detach(thr);
 }
 
-void systhread_terminate(SYS_THREAD thr)
-{
+void systhread_terminate(SYS_THREAD thr) {
     //PR_Interrupt((PRThread *)thr);
 }
 
-void systhread_sleep(int msec)
-{
+void systhread_sleep(int msec) {
     if(msec > 0) {
         poll(NULL, NULL, msec);
     } else {
@@ -119,11 +113,26 @@
     }
 }
 
+NSAPI_PUBLIC int systhread_newkey() {
+    pthread_key_t key;
+    pthread_key_create(&key, NULL);
+    
+    return (int)key; // TODO: don't use int
+}
+
+NSAPI_PUBLIC void* systhread_getdata(int key) {
+    return pthread_getspecific((pthread_key_t)key);
+}
+
+NSAPI_PUBLIC void systhread_setdata(int key, void *data) {
+    pthread_setspecific((pthread_key_t)key, data);
+}
+
 NSAPI_PUBLIC void systhread_init(char *name)
 {
-    if (!PR_Initialized()) {
-        PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 256);
-    }
+    //if (!PR_Initialized()) {
+    //    PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 256);
+    //}
     // XXX: ruslan - this bug can potentially exist on all plafroms due to
     //	possible priority inversion on NSPR spin locks. This code will
     //	need to be remove as we get new NSPR drop
@@ -139,33 +148,10 @@
     //	same effect as this fix. Debug version of NSPR always works as it doesn't
     //  have FD stack.
 
-    int maxPRFdCache = 8192;
-    PR_SetFDCacheSize(0, maxPRFdCache);
+    //int maxPRFdCache = 8192;
+    //PR_SetFDCacheSize(0, maxPRFdCache);
     // </WORKAROUND>
 }
 
-/*
- *  TODO: reimplement with pthread api
- */
-
-NSAPI_PUBLIC int systhread_newkey()
-{
-    uintn newkey;
-
-    PR_NewThreadPrivateIndex(&newkey, NULL);
-    return (newkey);
+NSAPI_PUBLIC void systhread_dummy(void) {
 }
-
-NSAPI_PUBLIC void *systhread_getdata(int key)
-{
-    return PR_GetThreadPrivate(key);
-}
-
-NSAPI_PUBLIC void systhread_setdata(int key, void *data)
-{
-    PR_SetThreadPrivate(key, data);
-}
-
-NSAPI_PUBLIC void systhread_dummy(void)
-{
-}
--- a/src/server/util/systhr.h	Sun Dec 30 15:49:44 2012 +0100
+++ b/src/server/util/systhr.h	Mon Dec 31 00:07:52 2012 +0100
@@ -47,7 +47,7 @@
 #ifndef NETSITE_H
 #include "../daemon/netsite.h"
 #include "../public/nsapi.h"
-#include "nspr.h"
+//include "nspr.h" // TODO: remove
 #endif /* !NETSITE_H */
 
 #define THREAD_ANY
--- a/templates/config/server.conf	Sun Dec 30 15:49:44 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-#
-# server.conf
-#
-
-<Runtime>
-	Temp        /tmp/webserver-rw6pgl8b/
-	User        webservd
-	MimeFile    mime.types
-</Runtime>
-
-<LogFile>
-	File        logs/errors
-	Level       INFO
-</LogFile>
-
-<EventHandler>
-    Name        default
-    Threads     1
-    Default     true
-</EventHandler>
-
-<Threadpool>
-    Name        default
-    MinThreads  4
-    MaxThreads  32
-</Threadpool>
-
-<AuthDB>
-    Name        keyfile
-    Type        keyfile
-</AuthDB>
-
-<Listener>
-    Name        http-listener-1
-    Port        9090
-    DefaultVS   x4
-</Listener>
-
-<Listener>
-    Name        http-listener-2
-    Port        9091
-    DefaultVS   x4
-</Listener>
-
-<VirtualServer>
-	Name        x4
-	Host        x4
-    Listener    http-listener-1
-    Listener    http-listener-2
-    ObjectFile  obj.conf
-    ACLFile     acl.conf
-    DAVFile     dav.conf
-    DocRoot     docs/ 
-</VirtualServer>
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/config/server.template	Mon Dec 31 00:07:52 2012 +0100
@@ -0,0 +1,56 @@
+#
+# server.conf
+#
+
+<Runtime>
+	Temp        /tmp/webserver-rw6pgl8b/
+	User        webservd
+	MimeFile    mime.types
+</Runtime>
+
+<LogFile>
+	File        logs/errors
+	Level       INFO
+</LogFile>
+
+<EventHandler>
+    Name        default
+    Threads     1
+    Default     true
+</EventHandler>
+
+<Threadpool>
+    Name        default
+    MinThreads  4
+    MaxThreads  32
+</Threadpool>
+
+<AuthDB>
+    Name        keyfile
+    Type        keyfile
+</AuthDB>
+
+<Listener>
+    Name        http-listener-1
+    Port        9090
+    DefaultVS   %%WS_HOST%%
+</Listener>
+
+<Listener>
+    Name        http-listener-2
+    Port        9091
+    DefaultVS   %%WS_HOST%%
+</Listener>
+
+<VirtualServer>
+	Name        %%WS_HOST%%
+	Host        %%WS_HOST%%
+    Listener    http-listener-1
+    Listener    http-listener-2
+    ObjectFile  obj.conf
+    ACLFile     acl.conf
+    DAVFile     dav.conf
+    DocRoot     docs/ 
+</VirtualServer>
+
+

mercurial