From: wessels <> Date: Thu, 14 Jan 1999 06:24:09 +0000 (+0000) Subject: OS/2 fixes from Doug Nazar nazard@man-assoc.on.ca X-Git-Tag: SQUID_3_0_PRE1~2406 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cd3770650479af300ac44219406c23dc64ddb989;p=thirdparty%2Fsquid.git OS/2 fixes from Doug Nazar nazard@man-assoc.on.ca --- diff --git a/cfgaux/config.guess b/cfgaux/config.guess index b0f5dca307..d5da525231 100755 --- a/cfgaux/config.guess +++ b/cfgaux/config.guess @@ -555,6 +555,9 @@ EOF news*:NEWS-OS:[56].*:*) echo mips-sony-newsos${UNAME_RELEASE} exit 0 ;; + i?86:OS/2:*:*) + echo ${UNAME_MACHINE}-ibm-os2 + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/cfgaux/config.sub b/cfgaux/config.sub index 67d8f39aab..f751a9eed8 100755 --- a/cfgaux/config.sub +++ b/cfgaux/config.sub @@ -755,6 +755,8 @@ case $os in ;; -none) ;; + -os2) + ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` diff --git a/configure b/configure index c78c93bf2d..26207fbd76 100755 --- a/configure +++ b/configure @@ -587,7 +587,7 @@ fi -# From configure.in Revision: 1.161 +# From configure.in Revision: 1.162 ac_aux_dir= for ac_dir in cfgaux $srcdir/cfgaux; do if test -f $ac_dir/install-sh; then @@ -647,7 +647,7 @@ if test "$libexecdir" = '${exec_prefix}/libexec'; then fi case "$host_os" in -cygwin32) +cygwin32|os2) exec_suffix=".exe" cgi_suffix=".exe" ;; diff --git a/configure.in b/configure.in index 659ff484dd..8c3ae66a9e 100644 --- a/configure.in +++ b/configure.in @@ -3,13 +3,13 @@ dnl Configuration input file for Squid dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.162 1999/01/11 20:34:14 wessels Exp $ +dnl $Id: configure.in,v 1.163 1999/01/13 23:26:05 wessels Exp $ dnl dnl dnl AC_INIT(src/main.c) AC_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.162 $)dnl +AC_REVISION($Revision: 1.163 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AC_CONFIG_AUX_DIR(cfgaux) @@ -28,7 +28,7 @@ fi dnl use .exe suffix for executables on cygwin32 platform case "$host_os" in -cygwin32) +cygwin32|os2) exec_suffix=".exe" cgi_suffix=".exe" ;; diff --git a/src/Makefile.in b/src/Makefile.in index 7f8488390a..d15d3b4675 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.166 1998/12/31 23:50:25 wessels Exp $ +# $Id: Makefile.in,v 1.167 1999/01/13 23:24:09 wessels Exp $ # # Uncomment and customize the following to suit your needs: # @@ -238,7 +238,7 @@ squid.conf cf_parser.c: cf.data cf_gen ./cf_gen cf.data cf_gen: cf_gen.o - $(CC) -o $@ cf_gen.o $(STD_APP_LIBS) + $(CC) -o $@ $(LDFLAGS) cf_gen.o $(STD_APP_LIBS) cf.data: cf.data.pre Makefile sed "\ diff --git a/src/cache_manager.cc b/src/cache_manager.cc index 511bbccd59..2ed8eb61e7 100644 --- a/src/cache_manager.cc +++ b/src/cache_manager.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_manager.cc,v 1.18 1998/09/02 17:21:00 wessels Exp $ + * $Id: cache_manager.cc,v 1.19 1999/01/13 23:24:09 wessels Exp $ * * DEBUG: section 16 Cache Manager Objects * AUTHOR: Duane Wessels @@ -111,6 +111,14 @@ cachemgrParseUrl(const char *url) t = sscanf(url, "cache_object://%[^/]/%[^@]@%s", host, request, password); if (t < 2) { xstrncpy(request, "menu", MAX_URL); +#ifdef _SQUID_OS2_ + /* + * emx's sscanf insists of returning 2 because it sets request + * to null + */ + } else if (request[0] == '\0') { + xstrncpy(request, "menu", MAX_URL); +#endif } else if ((a = cachemgrFindAction(request)) == NULL) { debug(16, 1) ("cachemgrParseUrl: action '%s' not found\n", request); return NULL; diff --git a/src/cf_gen.cc b/src/cf_gen.cc index 57368b1e7a..a539b5e278 100644 --- a/src/cf_gen.cc +++ b/src/cf_gen.cc @@ -1,5 +1,5 @@ /* - * $Id: cf_gen.cc,v 1.29 1998/11/12 06:27:58 wessels Exp $ + * $Id: cf_gen.cc,v 1.30 1999/01/13 23:24:10 wessels Exp $ * * DEBUG: none * AUTHOR: Max Okumoto @@ -119,13 +119,18 @@ main(int argc, char *argv[]) enum State state; int rc = 0; char *ptr = NULL; +#ifdef _SQUID_OS2_ + const char *rmode = "rt"; +#else + const char *rmode = "r"; +#endif /*-------------------------------------------------------------------* * Parse input file *-------------------------------------------------------------------*/ /* Open input file */ - if ((fp = fopen(input_filename, "r")) == NULL) { + if ((fp = fopen(input_filename, rmode)) == NULL) { perror(input_filename); exit(1); } diff --git a/src/comm_select.cc b/src/comm_select.cc index 87dd2516b8..56009295af 100644 --- a/src/comm_select.cc +++ b/src/comm_select.cc @@ -1,6 +1,6 @@ /* - * $Id: comm_select.cc,v 1.27 1999/01/12 23:52:08 wessels Exp $ + * $Id: comm_select.cc,v 1.28 1999/01/13 23:24:10 wessels Exp $ * * DEBUG: section 5 Socket Functions * @@ -610,6 +610,10 @@ comm_select(int msec) } if (msec > MAX_POLL_TIME) msec = MAX_POLL_TIME; +#ifdef _SQUID_OS2_ + if (msec < 0) + msec = MAX_POLL_TIME; +#endif for (;;) { poll_time.tv_sec = msec / 1000; poll_time.tv_usec = (msec % 1000) * 1000; diff --git a/src/disk.cc b/src/disk.cc index fba5918517..50b5de7933 100644 --- a/src/disk.cc +++ b/src/disk.cc @@ -1,7 +1,7 @@ /* - * $Id: disk.cc,v 1.138 1999/01/12 16:42:16 wessels Exp $ + * $Id: disk.cc,v 1.139 1999/01/13 23:24:11 wessels Exp $ * * DEBUG: section 6 Disk I/O Routines * AUTHOR: Harvest Derived @@ -143,9 +143,18 @@ file_close(int fd) callback(-1, F->read_data); } if (F->flags.write_daemon) { +#if defined(_SQUID_MSWIN_) || defined(_SQUID_OS2_) + /* + * on some operating systems, you can not delete or rename + * open files, so we won't allow delayed close. + */ + while (!diskWriteIsComplete(fd)) + diskHandleWrite(fd, NULL); +#else F->flags.close_request = 1; debug(6, 2) ("file_close: FD %d, delaying close\n", fd); return; +#endif } /* * Assert there is no write callback. Otherwise we might be diff --git a/src/dnsserver.cc b/src/dnsserver.cc index fa46065598..784267d335 100644 --- a/src/dnsserver.cc +++ b/src/dnsserver.cc @@ -1,6 +1,6 @@ /* - * $Id: dnsserver.cc,v 1.55 1998/11/25 09:00:20 wessels Exp $ + * $Id: dnsserver.cc,v 1.56 1999/01/13 23:24:12 wessels Exp $ * * DEBUG: section 0 DNS Resolver * AUTHOR: Harvest Derived @@ -158,6 +158,11 @@ struct hostent *_res_gethostbyname(char *name); static struct in_addr no_addr; +#ifdef _SQUID_OS2_ +struct state _res = +{0}; /* it's not in any of the libraries */ +#endif + /* error messages from gethostbyname() */ static char * my_h_msgs(int x) diff --git a/src/main.cc b/src/main.cc index 57f3dfd5c9..a134402347 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.283 1999/01/13 21:00:10 wessels Exp $ + * $Id: main.cc,v 1.284 1999/01/13 23:24:14 wessels Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -360,6 +360,9 @@ static void setEffectiveUser(void) { leave_suid(); /* Run as non privilegied user */ +#ifdef _SQUID_OS2_ + return; +#endif if (geteuid() == 0) { debug(0, 0) ("Squid is not safe to run as root! If you must\n"); debug(0, 0) ("start Squid as root, then you must configure\n"); diff --git a/src/store_dir.cc b/src/store_dir.cc index 99a743f927..dff6b8f71b 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir.cc,v 1.83 1998/09/23 15:37:43 wessels Exp $ + * $Id: store_dir.cc,v 1.84 1999/01/13 23:24:15 wessels Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -545,6 +545,12 @@ storeDirCloseTmpSwapLog(int dirn) SwapDir *SD = &Config.cacheSwap.swapDirs[dirn]; int fd; file_close(SD->swaplog_fd); +#ifdef _SQUID_OS2_ + if (unlink(swaplog_path) < 0) { + debug(50, 0) ("%s: %s\n", swaplog_path, xstrerror()); + fatal("storeDirCloseTmpSwapLog: unlink failed"); + } +#endif if (rename(new_path, swaplog_path) < 0) { debug(50, 0) ("%s,%s: %s\n", new_path, swaplog_path, xstrerror()); fatal("storeDirCloseTmpSwapLog: rename failed"); @@ -767,25 +773,27 @@ storeDirWriteCleanLogs(int reopen) } safe_free(outbuf); safe_free(outbufoffset); -#ifdef _SQUID_MSWIN_ /* * You can't rename open files on Microsoft "operating systems" - * so we close before renaming. + * so we have to close before renaming. */ storeDirCloseSwapLogs(); -#endif /* rename */ for (dirn = 0; dirn < N; dirn++) { if (fd[dirn] < 0) continue; +#ifdef _SQUID_OS2_ + file_close(fd[dirn]); + fd[dirn] = -1; + if (unlink(cur[dirn]) < 0) + debug(50, 0) ("storeDirWriteCleanLogs: unlinkd failed: %s, %s\n", + xstrerror(), cur[dirn]); +#endif if (rename(new[dirn], cur[dirn]) < 0) { debug(50, 0) ("storeDirWriteCleanLogs: rename failed: %s, %s -> %s\n", xstrerror(), new[dirn], cur[dirn]); } } -#ifndef _SQUID_MSWIN_ - storeDirCloseSwapLogs(); -#endif if (reopen) storeDirOpenSwapLogs(); stop = squid_curtime;