Re: Squid CygWin enhancement

From: Guido Serassio <serassio@dont-contact.us>
Date: Thu, 26 Apr 2001 18:18:14 +0200

Hi Robert,

Il 16.50 26/04/2001 Robert Collins ha scritto:
>I tried the cygwin branch on a win98 machine today, and it didn't seem
>to pickup the DNS from the registry.
>
>I'm going to look into that this weekend.

Do You use DHCP or static IP assignment ?

>I have a few questions/critiques about the code though (I don't have
>time to get in and help you just now - so constructive criticism is all
>I can offer):

Is the welcome ....

>1) in defines.h, you are defining _WIN_OS_WIN32S/9X/NT/2K - are these
>constants tested against the OS? If so should we use the equivalents
>from windows.h (or files that windows.h auto-includes) ?

These defines are my arbitrary defines, taken from a my code running on 9x,
NT and 2000 with
the GetOSVersion function. There is no useful defines about OS recognition
on MS (or CygWin compatible) include files, so i think this code may be rigth.

>2) You've broken parsing /etc/resolv.conf for cygwin. You should merge
>in the registry and /etc/resolv.conf, not have only one work.

My idea is that squid compiled with CygWin can be run on a Windows machine
without CygWin installed, so for this purpose is better don't use the
/etc/resolv.conf file. But if You think that the use of /etc/resolv.conf
may be useful, is very simple for me re-enable it, better making the path
of resolv.conf optionally defined on squid.conf.

>3) in tools.c you don't check that remove(to) succeeded. You should
>check that.

This is true, but this patch is needed only when running on native mode,
non under CygWin, and it is not always possible check if remove(to) is
succesful, because in some situation the 'to' file doesn't exist, for
example when we make a log file rotate for the first time.

>4) in src/Makefile.in you are always adding win32.o - this should be
>added conditionally (see how snmp.o is added). (Hint: in configure.in
>AC_SUBST a value with win32.o if your target in a win32 platform).

Correct, this Makefile.in is a test-only version, my intention was already
to ask you for a hint about to do this, so thanks for the hint.

>5) win 32.c you've brought in some winsock2 stuff that shouldn't be
>brought in just yet IMO. (reasoning: a) the cygwin port: cygwin cannot
>combine fork() and direct use of win32 sockets - fork only copies the
>fd's it knows about. b) for native NT, there is work going on in another
>squid branch to allow different socket code to be plugged in similiarly
>to the fs modules. The winsock2 code belongs there, not in a top level
>file).

the win32.c that you have seen is a brutal cut & paste from the Squid 2.3
Stable 4. Only a little section of the file that you seen is compiled, and
I'm working strong on hit, and now is very different and more clean.

>6) for the NT auth helper, you might want to look at libtool. (I'm using
>libtool for the generic modules code I'm writing which will provide the
>support for loading such modules as dll's. (You don't need to change
>anything now - but you might like to know where the compatible method
>for doing this is. libtool can build libraries for mingw32 - which if
>you don't know is essentially gcc that builds non-cygwin; MSVCRT based
>win32 applications). Also as a critique - the dll based version of that
>authenticator seems to be single-threaded. If your dll loading routines
>don't assign worker threads your squid process may block if NT delays
>the lookup for any reason.

This is the same code that runs on 2.3 Stable 4, I know that on native
mode, when compiled with MS Visual C, the dll code is single threaded, but
i have more like to work on the HEAD development instead on a old Squid
revision, I think that this is more useful.

>Other than that, great work!

Thanks, I'm happy to announce You that a CygWin squid.exe compiled as a NT
service is alive and running without problems.

Now I'm cleaning the code from WIN32 specific objects where possible, and i
will make a check on the dns-internal code on 9X.

Guido

>Rob

-
=======================================================
Serassio Guido
Via Albenga, 11/4 10134 - Torino - ITALY
Tel. : +39.011.610749
E-mail: serassio@interfree.it
            serassio@libero.it
WWW: http://serassio.interfree.it
Received on Thu Apr 26 2001 - 10:18:27 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:49 MST