Cygwin: pty: Limit API hook to the program linked with the APIs.
- API hook used for pseudo console support causes slow down. This patch limits API hook to only program which is linked with the corresponding APIs. Normal cygwin program is not linked with such APIs (such as WriteFile, etc...) directly, therefore, no slow down occurs. However, console access by cygwin.dll itself cannot switch the r/w pipe to pseudo console side. Therefore, the code to switch it forcely to pseudo console side is added to smallprint.cc and strace.cc.
This commit is contained in:
committed by
Corinna Vinschen
parent
583102e7c9
commit
83b2d576c8
@ -405,6 +405,7 @@ small_printf (const char *fmt, ...)
|
||||
count = __small_vsprintf (buf, fmt, ap);
|
||||
va_end (ap);
|
||||
|
||||
set_ishybrid_and_switch_to_pcon (GetStdHandle (STD_ERROR_HANDLE));
|
||||
WriteFile (GetStdHandle (STD_ERROR_HANDLE), buf, count, &done, NULL);
|
||||
FlushFileBuffers (GetStdHandle (STD_ERROR_HANDLE));
|
||||
}
|
||||
@ -431,6 +432,7 @@ console_printf (const char *fmt, ...)
|
||||
count = __small_vsprintf (buf, fmt, ap);
|
||||
va_end (ap);
|
||||
|
||||
set_ishybrid_and_switch_to_pcon (console_handle);
|
||||
WriteFile (console_handle, buf, count, &done, NULL);
|
||||
FlushFileBuffers (console_handle);
|
||||
}
|
||||
|
Reference in New Issue
Block a user