Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa3b9d2168 |
No files matched your search
@@ -1,16 +1,5 @@
|
||||
2002-05-29 Robert James Kaes <rjkaes@flarenet.com>
|
||||
|
||||
* src/heap.c (malloc_shared_memory):
|
||||
Removed the MMAP_ANON and open("/dev/zero") since they are not
|
||||
portable across a while enough spectrum of machines. Right now
|
||||
tinyproxy is using a "classic" temporary file method of sharing
|
||||
memory. This will likely be improved in the future.
|
||||
|
||||
* src/child.c, src/stats.c:
|
||||
Changed the tests on the return value from malloc_shared_memory()
|
||||
to make tinyproxy more portable, since we can't be certain that
|
||||
"if (!ret_value)" would actually detect a mmap() error.
|
||||
|
||||
* src/reqs.c (add_header_to_connection):
|
||||
Removed the "double_cgi" boolean, since tinyproxy now ignores all
|
||||
the headers after a "double CGI" situation has occurred.
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
dnl $Id: configure.ac,v 2.35 2002-05-29 20:55:47 rjkaes Exp $
|
||||
dnl $Id: configure.ac,v 2.34 2002-05-29 18:15:40 rjkaes Exp $
|
||||
|
||||
dnl Devlopers, please strive to achieve this order:
|
||||
dnl
|
||||
@@ -14,7 +14,7 @@ dnl 8. System services
|
||||
dnl
|
||||
dnl Read the Autoconf manual for details.
|
||||
|
||||
AC_INIT([tinyproxy], [1.5.1pre3], [rjkaes@users.sourceforge.net])
|
||||
AC_INIT([tinyproxy], [1.5.1pre2], [rjkaes@users.sourceforge.net])
|
||||
AC_CONFIG_SRCDIR([src/tinyproxy.c])
|
||||
AC_PREREQ(2.52)
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
/* $Id: child.c,v 1.2 2002-05-29 20:49:55 rjkaes Exp $
|
||||
/* $Id: child.c,v 1.1 2002-05-26 18:45:26 rjkaes Exp $
|
||||
*
|
||||
* Handles the creation/destruction of the various children required for
|
||||
* processing incoming connections.
|
||||
@@ -276,7 +276,7 @@ child_pool_create(void)
|
||||
}
|
||||
|
||||
servers_waiting = malloc_shared_memory(sizeof(int));
|
||||
if (servers_waiting == MAP_FAILED) {
|
||||
if (!servers_waiting) {
|
||||
log_message(LOG_ERR, "Could not allocate memory for child counting.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
+11
-23
@@ -1,4 +1,4 @@
|
||||
/* $Id: heap.c,v 1.3 2002-05-29 20:51:35 rjkaes Exp $
|
||||
/* $Id: heap.c,v 1.2 2002-05-26 18:56:06 rjkaes Exp $
|
||||
*
|
||||
* Debugging versions of various heap related functions are combined
|
||||
* here. The debugging versions include assertions and also print
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "tinyproxy.h"
|
||||
#include "heap.h"
|
||||
#include "text.h"
|
||||
|
||||
void *
|
||||
debugging_calloc(size_t nmemb, size_t size, const char *file,
|
||||
@@ -93,35 +92,24 @@ debugging_strdup(const char* s, const char* file, unsigned long line)
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a block of memory in the "shared" memory region.
|
||||
*
|
||||
* FIXME: This uses the most basic (and slowest) means of creating a
|
||||
* shared memory location. It requires the use of a temporary file. We might
|
||||
* want to look into something like MM (Shared Memory Library) for a better
|
||||
* solution.
|
||||
* Allocate a block of memory in the "shared" memory region
|
||||
*/
|
||||
void*
|
||||
malloc_shared_memory(size_t size)
|
||||
{
|
||||
int fd;
|
||||
void* ptr;
|
||||
char buffer[128];
|
||||
|
||||
static char* shared_file = "/tmp/tinyproxy.shared";
|
||||
|
||||
assert(size > 0);
|
||||
assert(shared_file != NULL);
|
||||
|
||||
strlcpy(buffer, shared_file, sizeof(buffer) - 8);
|
||||
strlcat(buffer, ".XXXXXX", sizeof(buffer));
|
||||
#ifdef MAP_ANON
|
||||
ptr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
|
||||
#else
|
||||
fd = open("/dev/zero", O_RDWR, 0);
|
||||
|
||||
if ((fd = mkstemp(buffer)) == -1)
|
||||
return (void *)MAP_FAILED;
|
||||
unlink(buffer);
|
||||
|
||||
if (ftruncate(fd, size) == -1)
|
||||
return (void *)MAP_FAILED;
|
||||
ptr = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
ptr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
close(fd);
|
||||
#endif
|
||||
|
||||
return ptr;
|
||||
}
|
||||
@@ -142,8 +130,8 @@ calloc_shared_memory(size_t nmemb, size_t size)
|
||||
length = nmemb * size;
|
||||
|
||||
ptr = malloc_shared_memory(length);
|
||||
if (ptr == MAP_FAILED)
|
||||
return ptr;
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
|
||||
memset(ptr, 0, length);
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
/* $Id: stats.c,v 1.12 2002-05-29 20:49:55 rjkaes Exp $
|
||||
/* $Id: stats.c,v 1.11 2002-05-29 17:31:01 rjkaes Exp $
|
||||
*
|
||||
* This module handles the statistics for tinyproxy. There are only two
|
||||
* public API functions. The reason for the functions, rather than just a
|
||||
@@ -45,7 +45,7 @@ void
|
||||
init_stats(void)
|
||||
{
|
||||
stats = malloc_shared_memory(sizeof(struct stat_s));
|
||||
if (stats == MAP_FAILED)
|
||||
if (!stats)
|
||||
return;
|
||||
|
||||
memset(stats, 0, sizeof(struct stat));
|
||||
|
||||
Reference in new issue
Block a user