This is the mail archive of the cygwin-developers 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: MSYS mode (continue)


On Fri, Jul 26, 2013 at 06:47:16PM +0200, Corinna Vinschen wrote:
>On Jul 26 12:37, Christopher Faylor wrote:
>> On Fri, Jul 26, 2013 at 06:12:05PM +0200, Corinna Vinschen wrote:
>> >I don't know if that's a problem for them, but this reminds me... maybe
>> >we can use the LD_PRELOAD mechanism in hookapi.cc for that?
>> 
>> I was thinking that we'd use something like that (re my use of PRELOAD
>> and your use of CW_HOOK) but, you're right.  Someone could potentially
>> implement MSYS.dll via LD_PRELOAD:
>> 
>> LD_PRELOAD=msys.dll
>> 
>> and then have msys.dll hook the functions that it is interested in using
>> via CW_HOOK.
>
>Two points come to mind.
>
>- Does CW_HOOK still work?  I had to change a lot of code in
>  hook_or_detect_cygwin to handle big executables and 32 vs. 64 bit, so
>  I have no idea if it still does the righht thing in terms of CW_HOOK.

Who knows?  That's something that should be fixed, regardless.

>- Isn't CW_HOOK a bit heavy handed for MSYS?  MSYS only replaces partial
>  functionality, not entire functions.  Something like a CW_HOOK2 which
>  only results in Cygwin calling certain function pointers for minor
>  tweaks could be the result...

MSYS is free to call the old function first if it needs to and then modify
the output.  That's basically what any hook would do anyway.

Daniel Colascione's point is a stumbling block though since the
LD_PRELOAD method doesn't currently allow hooking anything other than
the main executable.  That means that, say, ncurses wouldn't know about
an MSYS-hooked uname.  It is possible to work around that but it would
require the addition of new code to the LD_PRELOAD mechanism, requiring
that we keep a table of hooked functions.

cgf


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