aboutsummaryrefslogtreecommitdiff
path: root/libgloss/kill.c
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2024-07-07 00:34:44 +0900
committerTakashi Yano <takashi.yano@nifty.ne.jp>2024-07-09 00:02:02 +0900
commitcc9dcdb11583f9625c2a5ef2f99b588976452f29 (patch)
tree7d785cd17ec35a34a39f8bb265595ffb32611162 /libgloss/kill.c
parentec71ae7a4bb1324ece373f9b4d67d84eabf1d7c6 (diff)
downloadnewlib-cc9dcdb11583f9625c2a5ef2f99b588976452f29.zip
newlib-cc9dcdb11583f9625c2a5ef2f99b588976452f29.tar.gz
newlib-cc9dcdb11583f9625c2a5ef2f99b588976452f29.tar.bz2
Cygwin: console: Fix race issue on allocating console simultaneously.
Previously, if two or more processes request to allocate a console at the same time, the same device number could be accidentally allocated. This patch fixes the issue by creating a named mutex (input_mutex) and checking if GetLastError() is ERROR_ALREADY_EXIST or not to ensure the unit number will be allocated in an atomic way. Thanks to this, EnumWindow() is not necessary anymore to scan console units. This also makes minor device numbers unique and console devices visible across sessions. This disallows duplicated device number for different sessions, so the MAX_CONS_DEV has been increased from 64 to 128. Additionally, the console allocation and scanning will be faster as a side effect of eliminating EnumWindows(). Fixes: 3721a756b0d8 ("Cygwin: console: Make the console accessible from other terminals.") Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp> (cherry picked from commit 10477d95ec401213d5bded5ae3600ab0d2d5ed94)
Diffstat (limited to 'libgloss/kill.c')
0 files changed, 0 insertions, 0 deletions