delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_TO_NO_BRKTS_FREEMAIL |
X-Spam-Check-By: | sourceware.org |
MIME-Version: | 1.0 |
Date: | Tue, 11 Jan 2011 12:13:18 +0100 |
Message-ID: | <AANLkTimioT4OZ7CfW1Kh7R1nWv7uKz6v_3w=Hcgv-J6D@mail.gmail.com> |
Subject: | Adding madvise function in cygwin with a #define |
From: | jdzstz - gmail dot com <jdzstz AT gmail DOT com> |
To: | cygwin AT cygwin DOT com |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
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]) allows compiling successfuly the aplication, without any other source changes. 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 This allows us to make less changes when compiling linux applications. I have seen that correct POSIX function is "posix_madvise" and "madvise" is defined in some systems: Linux and FreeBSD but seems people in this systems prefer use it instead posix_* alternative. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |