This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Adding madvise function in cygwin with a #define

I have readed again the Linux man page
and perhaps the first text is outdated.

At the beginning of man page?it?says that:
"This call does not influence?the semantics of the application (except
in the case of MADV_DONTNEED), but?may influence its performance."

And "The kernel is free to ignore the advice."

But, in the other side, at the bottom it speaks about "flags which
affect the memory mapping behaviour on fork" as you said in your email
=> MADV_REMOVE, MADV_DONTFORK, MADV_DOFORK, etc...  and to ignore it
can be dangerous to application.

Maybe an implementation option could be:

1) Standard advices  that only has a influence in application
performance, can be executed as current posix_madvise, checking only
the parameters and doing nothing => MADV_NORMAL, MADV_SEQUENTIAL,

2) Rest of advices, that can modify the behaviour of application and
generate errors or security problems, so madvise returns always
"EINVAL"  (as you said in your mail) : MADV_REMOVE, MADV_DONTFORK,

To reduce problems with applications that uses advises of list number
2, this constants would be undefined, so if the aplication code make
for example an "madvise(p, sz, MADV_DONTFORK)" at least, the problem
will be detected at compilation time.

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]