Adding madvise function in cygwin with a #define
Eric Blake
eblake@redhat.com
Tue Jan 11 14:56:00 GMT 2011
On 01/11/2011 04:13 AM, jdzstz - gmail dot com wrote:
> Testing a linux application that uses "madvise", varnish cache, I have
> realized that in cygwin doesnot exists this function but exists the
> alternative "posix_madvise".
>
> Adding inside configure.ac script:
> + AC_DEFINE([madvise], [posix_madvise], [In CYGWIN, madvise function
> is not defined, instead we use posix_madvise])
> + AC_DEFINE([MADV_RANDOM], [POSIX_MADV_RANDOM], [In CYGWIN,
> MADV_RANDOM define is not defined, instead we use POSIX_MADV_RANDOM])
madvise is more powerful than posix_madvise; while this workaround may
have let you get varnish working, it is not a panacea for all clients of
madvise. You are better off filing a bug report against varnish that
they should either use the POSIX interface, or add a configure-time
check for the presence of madvise.
> I think it could be interesting adding this defines to cygwin headers,
> at the end of <sys/mman.h> file
>
> #define madvise posix_madvise
> #define MADV_NORMAL POSIX_MADV_NORMAL
> #define MADV_SEQUENTIAL POSIX_MADV_SEQUENTIAL
> #define MADV_RANDOM POSIX_MADV_RANDOM
> #define MADV_WILLNEED POSIX_MADV_WILLNEED
> #define MADV_DONTNEED POSIX_MADV_DONTNEED
While these defines may make sense _once madvise is implemented_ in
cygwin, I don't want them any sooner. In other words, we need a cygwin
port of madvise before we pollute the namespace with MADV_* constants.
That said, since Linux supports madvise and cygwin tries to emulate
Linux, a patch to implement madvise() is more than welcome.
--
Eric Blake eblake@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20110111/95020128/attachment.sig>
More information about the Cygwin
mailing list