This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: MSYS mode (continue)
- From: Christopher Faylor <cgf-use-the-mailinglist-please at cygwin dot com>
- To: cygwin-developers at cygwin dot com
- Date: Fri, 26 Jul 2013 13:01:00 -0400
- Subject: Re: MSYS mode (continue)
- References: <20130711111744 dot GG15346 at calimero dot vinschen dot de> <51F123EB dot 9000900 at cwilson dot fastmail dot fm> <20130725150209 dot GA15619 at calimero dot vinschen dot de> <51F16C82 dot 7030509 at cwilson dot fastmail dot fm> <20130725205320 dot GA2725 at ednor dot casa dot cgf dot cx> <20130726081510 dot GN5086 at calimero dot vinschen dot de> <20130726151432 dot GA4495 at ednor dot casa dot cgf dot cx> <20130726161205 dot GR5086 at calimero dot vinschen dot de> <20130726163708 dot GF4495 at ednor dot casa dot cgf dot cx> <20130726164716 dot GU5086 at calimero dot vinschen dot de>
- Reply-to: cygwin-developers at cygwin dot com
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