Re: WIN32 PSAPI patch

From: Robert Collins <robert.collins@dont-contact.us>
Date: Sun, 21 Oct 2001 18:46:57 +1000

----- Original Message -----
From: "Guido Serassio" <serassio@libero.it>
> >1)
> >+ * You can't rename open files on Microsoft "operating systems"
> >+ * so we close before renaming.
> >+ */
> >+#ifdef _SQUID_MSWIN_
> >+ if (debug_log != stderr)
> >+ fclose(debug_log);
> >+#endif
> >
> >this looks like to would affect cygwin too... Do you know if it does
or
> >does not affect cygwin?
>
> _SQUID_CYGWIN_ and _SQUID_MSWIN_ defines are mutually exclusives:
...
> So Cygwin is not affected.

Sorry, I was not clear. I meant that perhaps the code should be
+#if defined (_SQUID_MSWIN_) || defined (_SQUID_MSWIN_)

> >2)
> >
> >+#ifndef _SQUID_MSWIN_
> >getrusage(RUSAGE_SELF, r);
> >+#endif
> >
> >Should be
> >#if HAVE_GETRUSAGE
> >getrusage...
> >endif
> >
> >so that if someone has a usuable getrusage on win32 they can use it.
>
> Here we are already in a #if HAVE_GETRUSAGE code section, the idea is
to
> emulate getrusage function on native port. I know that the better
solution > is to add an external getrusage function for MS Compilers,
but at this
> moment we have a shared code section between Cygwin and native port.
> IMO, MS Compilers doesn't have getrusage, and they will never have it.
> I know that there is MS Interix environment too, but I think that
compile
> Squid on it requires a significative porting work.

Then I'd put the emulated getrusage in either win32.o or as an extra
library in the lib source directory.

> >3) I note that you overwrite the ru_macrsss and ru_majflt on Cygwin
on
> >NT platforms - IIRC Cygwin alrready uses PSAPI to provide this
> >information, so you are in effect getting it twice. If you've noted
that
> >cygwin doesn't return this info, then that part is fine. Long term
I'll
> >get a fix into Cygwin to provide that seamlessly though.
>
> Yes, I've found that Cygwin lacks theses process memory informations.
> But, I have just checked the latest cygwin1.dll with the MS Dependency
> Walker tool, and I haven't found any reference to psapi.dll on it.
> Are You sure that Cygwin uses it ?
> IMO, Cygwin lacks theses process memory informations because doesn't
use
> psapi.

Cygwin autoloads such dlls as PSAPI via a little bit of assembly
language. This allows it to use NT only code on NT, and still run on 9x
correctly. Dependency walker doesn't show half the libraries actually
used by cygwin1.dll.

> >Lastly, your xrename alteration to remove(to) is IIRC to handle win32
> >rename semantics? A comment in the code there would be useful if that
is
> >indeed the case.
>
> OK, I add a more complete comment, and if this code is ok for you, I
will
> post a new patch.

Yes, please do. I do think that a wrapper getrusage lib function is the
Right Way to do this.

Rob
Received on Sun Oct 21 2001 - 02:43:37 MDT

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