From aa970c616cd499b5bcf88c7f44c3b17ad7c45e4d Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 9 Apr 2001 00:44:25 +0000 Subject: [PATCH] * Makefile.in: Put -lgcc last in list of libraries, since stdc++ library needs it. * cygwin.din: Remove obsolete "__empty" export. * exceptions.cc (call_signal_handler_now): Force inclusion of function even when -finline-functions is specified. * sigproc.h: Remove obsolete call_signal_handler declaration. * fhandler_console.cc (cp_get_internal): New function. (cp_convert): New function. (con_to_str): New function. (str_to_con): New function. (fhandler_console::read): Replace OemToCharBuff with con_to_str. (fhandler_console::write_normal): Replace CharToOemBuff with str_to_con. --- winsup/cygwin/ChangeLog | 18 ++ winsup/cygwin/Makefile.in | 2 +- winsup/cygwin/cygwin.din | 1 - winsup/cygwin/exceptions.cc | 4 + winsup/cygwin/fhandler_console.cc | 189 +++++++++------ winsup/cygwin/pthread.cc | 368 +++++++++++++++--------------- winsup/cygwin/sigproc.h | 1 - winsup/cygwin/thread.cc | 326 +++++++++++++------------- 8 files changed, 493 insertions(+), 416 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index c7537da97..9a4f4a955 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,21 @@ +Sun Apr 8 20:40:58 2001 Christopher Faylor + + * Makefile.in: Put -lgcc last in list of libraries, since stdc++ + library needs it. + * cygwin.din: Remove obsolete "__empty" export. + * exceptions.cc (call_signal_handler_now): Force inclusion of function + even when -finline-functions is specified. + * sigproc.h: Remove obsolete call_signal_handler declaration. + +Sun Apr 8 20:36:55 2001 Benjamin Riefenstahl + + * fhandler_console.cc (cp_get_internal): New function. + (cp_convert): New function. + (con_to_str): New function. + (str_to_con): New function. + (fhandler_console::read): Replace OemToCharBuff with con_to_str. + (fhandler_console::write_normal): Replace CharToOemBuff with str_to_con. + Thu Apr 5 22:41:00 2001 Corinna Vinschen * syscalls.cc (stat_worker): Fix conditional which still allowed diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index d7d6e8464..456c89426 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -190,7 +190,7 @@ new-$(LIB_NAME): $(LIB_NAME) new-$(DLL_NAME): $(DLL_OFILES) $(DEF_FILE) $(DLL_IMPORTS) $(LIBC) $(LIBM) Makefile winver_stamp $(CXX) $(CXXFLAGS) -nostdlib -Wl,-shared -o $@ -e $(DLL_ENTRY) $(DEF_FILE) $(DLL_OFILES) version.o \ - winver.o $(DLL_IMPORTS) $(MALLOC_OBJ) $(LIBM) $(LIBC) -lgcc -lstdc++ -lshell32 -luuid + winver.o $(DLL_IMPORTS) $(MALLOC_OBJ) $(LIBM) $(LIBC) -lstdc++ -lshell32 -luuid -lgcc dll_ofiles: $(DLL_OFILES) diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index 8d0eaccec..453785f7e 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -938,7 +938,6 @@ getpgrp _getpgrp = getpgrp getgrent _getgrent = getgrent -__empty ntohl _ntohl = ntohl htonl diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 3a3bdb918..880c4033f 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1128,6 +1128,10 @@ call_signal_handler_now () sigdelayed0 (); return sa_flags & SA_RESTART; } +/* This kludge seems to keep a copy of call_signal_handler_now around + even when compiling with -finline-functions. */ +static int __stdcall call_signal_handler_now_dummy () + __attribute__((alias ("call_signal_handler_now"))); }; int diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 47cd3aa82..75b464cc9 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -18,6 +18,7 @@ details. */ #include #include #include +#include // MultiByteToWideChar () and friends #include #include #include "cygheap.h" @@ -29,6 +30,53 @@ details. */ #include "shared_info.h" #include "security.h" +#define CONVERT_LIMIT 4096 + +/* The codepages are resolved here instead of using CP_ACP and + CP_OEMCP, so that they can later be compared for equality. */ +inline UINT +cp_get_internal () +{ + return current_codepage == ansi_cp ? GetACP() : GetOEMCP(); +} + +static BOOL +cp_convert (UINT destcp, char * dest, UINT srccp, const char * src, DWORD size) +{ + if (!size) + /* no action */; + else if (destcp == srccp) + { + if (dest != src) + memcpy (dest, src, size); + } + else + { + WCHAR wbuffer[CONVERT_LIMIT]; /* same size as the maximum input, s.b. */ + if (!MultiByteToWideChar (srccp, 0, src, size, wbuffer, sizeof (wbuffer))) + return FALSE; + if (!WideCharToMultiByte (destcp, 0, wbuffer, size, dest, size, + NULL, NULL)) + return FALSE; + } + return TRUE; +} + +/* The results of GetConsoleCP() and GetConsoleOutputCP() cannot be + cached, because a program or the user can change these values at + any time. */ +inline BOOL +con_to_str (char *d, const char *s, DWORD sz) +{ + return cp_convert (cp_get_internal (), d, GetConsoleCP (), s, sz); +} + +inline BOOL +str_to_con (char *d, const char *s, DWORD sz) +{ + return cp_convert (GetConsoleOutputCP (), d, cp_get_internal (), s, sz); +} + /* * Scroll the screen context. * x1, y1 - ul corner @@ -124,7 +172,7 @@ fhandler_console::set_cursor_maybe () { CONSOLE_SCREEN_BUFFER_INFO now; - if (!GetConsoleScreenBufferInfo (get_output_handle(), &now)) + if (!GetConsoleScreenBufferInfo (get_output_handle (), &now)) return; if (dwLastCursorPosition.X != now.dwCursorPosition.X || @@ -216,13 +264,13 @@ fhandler_console::read (void *pv, size_t buflen) if (raw_win32_keyboard_mode) { - __small_sprintf(tmp, "\033{%u;%u;%u;%u;%u;%luK", - input_rec.Event.KeyEvent.bKeyDown, - input_rec.Event.KeyEvent.wRepeatCount, - input_rec.Event.KeyEvent.wVirtualKeyCode, - input_rec.Event.KeyEvent.wVirtualScanCode, - input_rec.Event.KeyEvent.uChar.UnicodeChar, - input_rec.Event.KeyEvent.dwControlKeyState); + __small_sprintf (tmp, "\033{%u;%u;%u;%u;%u;%luK", + input_rec.Event.KeyEvent.bKeyDown, + input_rec.Event.KeyEvent.wRepeatCount, + input_rec.Event.KeyEvent.wVirtualKeyCode, + input_rec.Event.KeyEvent.wVirtualScanCode, + input_rec.Event.KeyEvent.uChar.UnicodeChar, + input_rec.Event.KeyEvent.dwControlKeyState); toadd = tmp; nread = strlen (toadd); break; @@ -248,8 +296,8 @@ fhandler_console::read (void *pv, size_t buflen) tmp[1] = ich; /* Need this check since US code page seems to have a bug when converting a CTRL-U. */ - if ((unsigned char)ich > 0x7f && current_codepage == ansi_cp) - OemToCharBuff (tmp + 1, tmp + 1, 1); + if ((unsigned char)ich > 0x7f) + con_to_str (tmp + 1, tmp + 1, 1); /* Determine if the keystroke is modified by META. */ if (!(input_rec.Event.KeyEvent.dwControlKeyState & meta_mask)) toadd = tmp + 1; @@ -273,7 +321,7 @@ fhandler_console::read (void *pv, size_t buflen) /* Treat the double-click event like a regular button press */ if (mouse_event.dwEventFlags == DOUBLE_CLICK) { - syscall_printf("mouse: double-click -> click"); + syscall_printf ("mouse: double-click -> click"); mouse_event.dwEventFlags = 0; } @@ -287,7 +335,7 @@ fhandler_console::read (void *pv, size_t buflen) int y = mouse_event.dwMousePosition.Y; if ((x + ' ' + 1 > 0xFF) || (y + ' ' + 1 > 0xFF)) { - syscall_printf("mouse: position out of range"); + syscall_printf ("mouse: position out of range"); continue; } @@ -300,28 +348,28 @@ fhandler_console::read (void *pv, size_t buflen) char sz[32]; if (mouse_event.dwButtonState == dwLastButtonState) { - syscall_printf("mouse: button state unchanged"); + syscall_printf ("mouse: button state unchanged"); continue; } else if (mouse_event.dwButtonState < dwLastButtonState) { b = 3; - strcpy(sz, "btn up"); + strcpy (sz, "btn up"); } else if ((mouse_event.dwButtonState & 1) != (dwLastButtonState & 1)) { b = 0; - strcpy(sz, "btn1 down"); + strcpy (sz, "btn1 down"); } else if ((mouse_event.dwButtonState & 2) != (dwLastButtonState & 2)) { b = 1; - strcpy(sz, "btn2 down"); + strcpy (sz, "btn2 down"); } else if ((mouse_event.dwButtonState & 4) != (dwLastButtonState & 4)) { b = 2; - strcpy(sz, "btn3 down"); + strcpy (sz, "btn3 down"); } /* Remember the current button state */ @@ -342,8 +390,8 @@ fhandler_console::read (void *pv, size_t buflen) b |= nModifiers; /* We can now create the code. */ - sprintf(tmp, "\033[M%c%c%c", b + ' ', x + ' ' + 1, y + ' ' + 1); - syscall_printf("mouse: %s at (%d,%d)", sz, x, y); + sprintf (tmp, "\033[M%c%c%c", b + ' ', x + ' ' + 1, y + ' ' + 1); + syscall_printf ("mouse: %s at (%d,%d)", sz, x, y); toadd = tmp; nread = 6; @@ -399,7 +447,7 @@ fhandler_console::fillin_info (void) BOOL ret; CONSOLE_SCREEN_BUFFER_INFO linfo; - if ((ret = GetConsoleScreenBufferInfo (get_output_handle(), &linfo))) + if ((ret = GetConsoleScreenBufferInfo (get_output_handle (), &linfo))) { info.winTop = linfo.srWindow.Top; info.winBottom = linfo.srWindow.Bottom; @@ -513,7 +561,7 @@ fhandler_console::open (const char *, int flags, mode_t) TTYCLEARF (RSTCONS); set_ctty (TTY_CONSOLE, flags); - debug_printf("opened conin$ %p, conout$ %p", + debug_printf ("opened conin$ %p, conout$ %p", get_io_handle (), get_output_handle ()); return 1; @@ -539,7 +587,7 @@ fhandler_console::dup (fhandler_base *child) { fhandler_console *fhc = (fhandler_console *) child; - if (!fhc->open(get_name (), get_flags (), 0)) + if (!fhc->open (get_name (), get_flags (), 0)) system_printf ("error opening console, %E"); fhc->default_color = default_color; @@ -569,9 +617,9 @@ fhandler_console::dup (fhandler_base *child) if (savebuf) { fhc->savebuf = (PCHAR_INFO) malloc (sizeof (CHAR_INFO) * - savebufsiz.X * savebufsiz.Y); + savebufsiz.X * savebufsiz.Y); memcpy (fhc->savebuf, savebuf, sizeof (CHAR_INFO) * - savebufsiz.X * savebufsiz.Y); + savebufsiz.X * savebufsiz.Y); } fhc->scroll_region = scroll_region; @@ -874,11 +922,11 @@ fhandler_console::clear_screen (int x1, int y1, int x2, int y2) (void)fillin_info (); if (x1 < 0) - x1 = info.dwWinSize.X-1; + x1 = info.dwWinSize.X - 1; if (y1 < 0) y1 = info.winBottom; if (x2 < 0) - x2 = info.dwWinSize.X-1; + x2 = info.dwWinSize.X - 1; if (y2 < 0) y2 = info.winBottom; @@ -1097,12 +1145,12 @@ fhandler_console::char_command (char c) case 'h': case 'l': if (!saw_question_mark) - { + { switch (args_[0]) { case 4: /* Insert mode */ insert_mode = (c == 'h') ? TRUE : FALSE; - syscall_printf("insert mode %sabled", insert_mode ? "en" : "dis"); + syscall_printf ("insert mode %sabled", insert_mode ? "en" : "dis"); break; } break; @@ -1116,15 +1164,15 @@ fhandler_console::char_command (char c) COORD cob = { 0, 0 }; if (!GetConsoleScreenBufferInfo (get_output_handle (), &now)) - break; + break; savebufsiz.X = now.srWindow.Right - now.srWindow.Left; savebufsiz.Y = now.srWindow.Bottom - now.srWindow.Top; if (savebuf) - free (savebuf); + free (savebuf); savebuf = (PCHAR_INFO) malloc (sizeof (CHAR_INFO) * - savebufsiz.X * savebufsiz.Y); + savebufsiz.X * savebufsiz.Y); ReadConsoleOutputA (get_output_handle (), savebuf, savebufsiz, cob, &now.srWindow); @@ -1135,13 +1183,13 @@ fhandler_console::char_command (char c) COORD cob = { 0, 0 }; if (!GetConsoleScreenBufferInfo (get_output_handle (), &now)) - break; + break; if (!savebuf) - break; + break; WriteConsoleOutputA (get_output_handle (), savebuf, - savebufsiz, cob, &now.srWindow); + savebufsiz, cob, &now.srWindow); free (savebuf); savebuf = NULL; @@ -1151,7 +1199,7 @@ fhandler_console::char_command (char c) case 1000: /* Mouse support */ use_mouse = (c == 'h') ? TRUE : FALSE; - syscall_printf("mouse support %sabled", use_mouse ? "en" : "dis"); + syscall_printf ("mouse support %sabled", use_mouse ? "en" : "dis"); break; case 2000: /* Raw keyboard mode */ @@ -1159,7 +1207,7 @@ fhandler_console::char_command (char c) break; default: /* Ignore */ - syscall_printf("unknown h/l command: %d", args_[0]); + syscall_printf ("unknown h/l command: %d", args_[0]); break; } break; @@ -1235,7 +1283,7 @@ fhandler_console::char_command (char c) break; case 'I': /* TAB */ cursor_get (&x, &y); - cursor_set (FALSE, 8*(x/8+1), y); + cursor_set (FALSE, 8 * (x / 8 + 1), y); break; case 'L': /* AL - insert blank lines */ args_[0] = args_[0] ? args_[0] : 1; @@ -1259,7 +1307,7 @@ fhandler_console::char_command (char c) break; case 'S': /* SF - Scroll forward */ args_[0] = args_[0] ? args_[0] : 1; - scroll_screen(0, args_[0], -1, -1, 0, 0); + scroll_screen (0, args_[0], -1, -1, 0, 0); break; case 'T': /* SR - Scroll down */ fillin_info (); @@ -1279,7 +1327,7 @@ fhandler_console::char_command (char c) case 'b': /* Repeat char #1 #2 times */ if (insert_mode) { - cursor_get (&x, &y); + cursor_get (&x, &y); scroll_screen (x, y, -1, y, x + args_[1], y); } while (args_[1]--) @@ -1330,33 +1378,42 @@ fhandler_console::write_normal (const unsigned char *src, break; found++; } + /* Print all the base ones out */ if (found != src) { - char buf[4096]; - size_t len = found - src; - do { - size_t l2 = min (sizeof (buf), len); - if (current_codepage == ansi_cp) - CharToOemBuff ((LPCSTR)src, buf, l2); - else - strncpy (buf, (LPCSTR)src, l2); - if (insert_mode) - { - int x, y; - cursor_get (&x, &y); - scroll_screen (x, y, -1, y, x + l2, y); - } - if (!WriteFile (get_output_handle (), buf, l2, &done, 0)) + DWORD len = found - src; + do { - debug_printf ("write failed, handle %p", get_output_handle ()); - __seterrno (); - return 0; + DWORD buf_len; + char buf[CONVERT_LIMIT]; + done = buf_len = min (sizeof (buf), len); + if (!str_to_con (buf, (const char *) src, buf_len)) + { + debug_printf ("conversion error, handle %p", get_output_handle ()); + __seterrno (); + return 0; + } + + if (insert_mode) + { + int x, y; + cursor_get (&x, &y); + scroll_screen (x, y, -1, y, x + buf_len, y); + } + + if (!WriteFile (get_output_handle (), buf, buf_len, &done, 0)) + { + debug_printf ("write failed, handle %p", get_output_handle ()); + __seterrno (); + return 0; + } + len -= done; + src += done; } - len -= done; - src += done; - } while (len > 0); + while (len > 0); } + if (src < end) { int x, y; @@ -1368,7 +1425,7 @@ fhandler_console::write_normal (const unsigned char *src, case ESC: state_ = gotesc; break; - case DWN: /* WriteFile("\n") always adds CR... */ + case DWN: /* WriteFile ("\n") always adds CR... */ cursor_get (&x, &y); if (y >= srBottom) { @@ -1496,7 +1553,7 @@ fhandler_console::write (const void *vsrc, size_t len) state_ = normal; break; case gotrsquare: - if (isdigit(*src)) + if (isdigit (*src)) rarg = rarg * 10 + (*src - '0'); else if (*src == ';' && (rarg == 2 || rarg == 0)) state_ = gettitle; @@ -1663,7 +1720,7 @@ fhandler_console::fixup_after_fork (HANDLE) /* Windows does not allow duplication of console handles between processes so open the console explicitly. */ - if (!open(get_name (), get_flags (), 0)) + if (!open (get_name (), get_flags (), 0)) system_printf ("error opening console after fork, %E"); if (!get_close_on_exec ()) @@ -1678,8 +1735,8 @@ set_console_title (char *title) { int rc; char buf[257]; - strncpy(buf, title, sizeof(buf) - 1); - buf[sizeof(buf) - 1] = '\0'; + strncpy (buf, title, sizeof (buf) - 1); + buf[sizeof (buf) - 1] = '\0'; if ((rc = WaitForSingleObject (title_mutex, 15000)) != WAIT_OBJECT_0) sigproc_printf ("wait for title mutex failed rc %d, %E", rc); SetConsoleTitle (buf); @@ -1693,7 +1750,7 @@ fhandler_console::fixup_after_exec (HANDLE) HANDLE h = get_handle (); HANDLE oh = get_output_handle (); - if (!open(get_name (), get_flags (), 0)) + if (!open (get_name (), get_flags (), 0)) { int sawerr = 0; if (!get_io_handle ()) diff --git a/winsup/cygwin/pthread.cc b/winsup/cygwin/pthread.cc index 7a92d1d2a..171fe6386 100644 --- a/winsup/cygwin/pthread.cc +++ b/winsup/cygwin/pthread.cc @@ -16,237 +16,237 @@ extern "C" { /* ThreadCreation */ - int - pthread_create (pthread_t * thread, const pthread_attr_t * attr, - void *(*start_routine) (void *), void *arg) - { - return __pthread_create (thread, attr, start_routine, arg); - } +int + pthread_create (pthread_t * thread, const pthread_attr_t * attr, + void *(*start_routine) (void *), void *arg) +{ + return __pthread_create (thread, attr, start_routine, arg); +} - int pthread_attr_init (pthread_attr_t * attr) - { - return __pthread_attr_init (attr); - } +int pthread_attr_init (pthread_attr_t * attr) +{ + return __pthread_attr_init (attr); +} - int pthread_attr_destroy (pthread_attr_t * attr) - { - return __pthread_attr_destroy (attr); - } +int pthread_attr_destroy (pthread_attr_t * attr) +{ + return __pthread_attr_destroy (attr); +} - int pthread_attr_setdetachstate (pthread_attr_t * attr, int detachstate) - { - return __pthread_attr_setdetachstate (attr, detachstate); - } +int pthread_attr_setdetachstate (pthread_attr_t * attr, int detachstate) +{ + return __pthread_attr_setdetachstate (attr, detachstate); +} - int - pthread_attr_getdetachstate (const pthread_attr_t * attr, - int *detachstate) - { - return __pthread_attr_getdetachstate (attr, detachstate); - } +int + pthread_attr_getdetachstate (const pthread_attr_t * attr, + int *detachstate) +{ + return __pthread_attr_getdetachstate (attr, detachstate); +} - int pthread_attr_setstacksize (pthread_attr_t * attr, size_t size) - { - return __pthread_attr_setstacksize (attr, size); - } +int pthread_attr_setstacksize (pthread_attr_t * attr, size_t size) +{ + return __pthread_attr_setstacksize (attr, size); +} - int pthread_attr_getstacksize (pthread_attr_t * attr, size_t * size) - { - return __pthread_attr_getstacksize (attr, size); - } +int pthread_attr_getstacksize (pthread_attr_t * attr, size_t * size) +{ + return __pthread_attr_getstacksize (attr, size); +} /* - pthread_attr_setstackaddr(...){}; - pthread_attr_getstackaddr(...){}; - */ + pthread_attr_setstackaddr(...){}; + pthread_attr_getstackaddr(...){}; +*/ /* Thread Exit */ - void pthread_exit (void *value_ptr) - { - return __pthread_exit (value_ptr); - } +void pthread_exit (void *value_ptr) +{ + return __pthread_exit (value_ptr); +} - int pthread_join (pthread_t thread, void **return_val) - { - return __pthread_join (&thread, (void **) return_val); - } +int pthread_join (pthread_t thread, void **return_val) +{ + return __pthread_join (&thread, (void **) return_val); +} - int pthread_detach (pthread_t thread) - { - return __pthread_detach (&thread); - } +int pthread_detach (pthread_t thread) +{ + return __pthread_detach (&thread); +} - int pthread_suspend (pthread_t thread) - { - return __pthread_suspend (&thread); - } +int pthread_suspend (pthread_t thread) +{ + return __pthread_suspend (&thread); +} - int pthread_continue (pthread_t thread) - { - return __pthread_continue (&thread); - } +int pthread_continue (pthread_t thread) +{ + return __pthread_continue (&thread); +} - unsigned long pthread_getsequence_np (pthread_t * thread) - { - return __pthread_getsequence_np (thread); - } +unsigned long pthread_getsequence_np (pthread_t * thread) +{ + return __pthread_getsequence_np (thread); +} /* Thread SpecificData */ - int pthread_key_create (pthread_key_t * key, void (*destructor) (void *)) - { - return __pthread_key_create (key, destructor); - } +int pthread_key_create (pthread_key_t * key, void (*destructor) (void *)) +{ + return __pthread_key_create (key, destructor); +} - int pthread_key_delete (pthread_key_t * key) - { - return __pthread_key_delete (key); - } +int pthread_key_delete (pthread_key_t * key) +{ + return __pthread_key_delete (key); +} - int pthread_setspecific (pthread_key_t key, const void *value) - { - return __pthread_setspecific (key, value); - } +int pthread_setspecific (pthread_key_t key, const void *value) +{ + return __pthread_setspecific (key, value); +} - void *pthread_getspecific (pthread_key_t key) - { - return (void *) __pthread_getspecific (key); - } +void *pthread_getspecific (pthread_key_t key) +{ + return (void *) __pthread_getspecific (key); +} /* Thread signal */ - int pthread_kill (pthread_t * thread, int sig) - { - return __pthread_kill (thread, sig); - } +int pthread_kill (pthread_t * thread, int sig) +{ + return __pthread_kill (thread, sig); +} - int - pthread_sigmask (int operation, const sigset_t * set, sigset_t * old_set) - { - return __pthread_sigmask (operation, set, old_set); - } +int + pthread_sigmask (int operation, const sigset_t * set, sigset_t * old_set) +{ + return __pthread_sigmask (operation, set, old_set); +} /* ID */ - pthread_t pthread_self () - { - return __pthread_self (); - } +pthread_t pthread_self () +{ + return __pthread_self (); +} - int pthread_equal (pthread_t t1, pthread_t t2) - { - return __pthread_equal (&t1, &t2); - } +int pthread_equal (pthread_t t1, pthread_t t2) +{ + return __pthread_equal (&t1, &t2); +} /* Mutexes */ - int - pthread_mutex_init (pthread_mutex_t * mutex, - const pthread_mutexattr_t * attr) - { - return __pthread_mutex_init (mutex, attr); - } +int + pthread_mutex_init (pthread_mutex_t * mutex, + const pthread_mutexattr_t * attr) +{ + return __pthread_mutex_init (mutex, attr); +} - int pthread_mutex_lock (pthread_mutex_t * mutex) - { - return __pthread_mutex_lock (mutex); - } +int pthread_mutex_lock (pthread_mutex_t * mutex) +{ + return __pthread_mutex_lock (mutex); +} - int pthread_mutex_trylock (pthread_mutex_t * mutex) - { - return __pthread_mutex_trylock (mutex); - } +int pthread_mutex_trylock (pthread_mutex_t * mutex) +{ + return __pthread_mutex_trylock (mutex); +} - int pthread_mutex_unlock (pthread_mutex_t * mutex) - { - return __pthread_mutex_unlock (mutex); - } +int pthread_mutex_unlock (pthread_mutex_t * mutex) +{ + return __pthread_mutex_unlock (mutex); +} - int pthread_mutex_destroy (pthread_mutex_t * mutex) - { - return __pthread_mutex_destroy (mutex); - } +int pthread_mutex_destroy (pthread_mutex_t * mutex) +{ + return __pthread_mutex_destroy (mutex); +} /* Synchronisation */ - int pthread_cond_destroy (pthread_cond_t * cond) - { - return __pthread_cond_destroy (cond); - } +int pthread_cond_destroy (pthread_cond_t * cond) +{ + return __pthread_cond_destroy (cond); +} - int - pthread_cond_init (pthread_cond_t * cond, const pthread_condattr_t * attr) - { - return __pthread_cond_init (cond, attr); - } +int + pthread_cond_init (pthread_cond_t * cond, const pthread_condattr_t * attr) +{ + return __pthread_cond_init (cond, attr); +} - int pthread_cond_signal (pthread_cond_t * cond) - { - return __pthread_cond_signal (cond); - } +int pthread_cond_signal (pthread_cond_t * cond) +{ + return __pthread_cond_signal (cond); +} - int pthread_cond_broadcast (pthread_cond_t * cond) - { - return __pthread_cond_broadcast (cond); - } +int pthread_cond_broadcast (pthread_cond_t * cond) +{ + return __pthread_cond_broadcast (cond); +} - int - pthread_cond_timedwait (pthread_cond_t * cond, - pthread_mutex_t * mutex, - const struct timespec *abstime) - { - return __pthread_cond_timedwait (cond, mutex, abstime); - } +int + pthread_cond_timedwait (pthread_cond_t * cond, + pthread_mutex_t * mutex, + const struct timespec *abstime) +{ + return __pthread_cond_timedwait (cond, mutex, abstime); +} - int pthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex) - { - return __pthread_cond_wait (cond, mutex); - } +int pthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex) +{ + return __pthread_cond_wait (cond, mutex); +} - int pthread_condattr_init (pthread_condattr_t * condattr) - { - return __pthread_condattr_init (condattr); - } +int pthread_condattr_init (pthread_condattr_t * condattr) +{ + return __pthread_condattr_init (condattr); +} - int pthread_condattr_destroy (pthread_condattr_t * condattr) - { - return __pthread_condattr_destroy (condattr); - } +int pthread_condattr_destroy (pthread_condattr_t * condattr) +{ + return __pthread_condattr_destroy (condattr); +} - int - pthread_condattr_getpshared (const pthread_condattr_t * attr, - int *pshared) - { - return __pthread_condattr_getpshared (attr, pshared); - } +int + pthread_condattr_getpshared (const pthread_condattr_t * attr, + int *pshared) +{ + return __pthread_condattr_getpshared (attr, pshared); +} - int pthread_condattr_setpshared (pthread_condattr_t * attr, int pshared) - { - return __pthread_condattr_setpshared (attr, pshared); - } +int pthread_condattr_setpshared (pthread_condattr_t * attr, int pshared) +{ + return __pthread_condattr_setpshared (attr, pshared); +} /* Semaphores */ - int sem_init (sem_t * sem, int pshared, unsigned int value) - { - return __sem_init (sem, pshared, value); - } - - int sem_destroy (sem_t * sem) - { - return __sem_destroy (sem); - } - - int sem_wait (sem_t * sem) - { - return __sem_wait (sem); - } - - int sem_trywait (sem_t * sem) - { - return __sem_trywait (sem); - } - - int sem_post (sem_t * sem) - { - return __sem_post (sem); - } +int sem_init (sem_t * sem, int pshared, unsigned int value) +{ + return __sem_init (sem, pshared, value); +} + +int sem_destroy (sem_t * sem) +{ + return __sem_destroy (sem); +} + +int sem_wait (sem_t * sem) +{ + return __sem_wait (sem); +} + +int sem_trywait (sem_t * sem) +{ + return __sem_trywait (sem); +} + +int sem_post (sem_t * sem) +{ + return __sem_post (sem); +} } diff --git a/winsup/cygwin/sigproc.h b/winsup/cygwin/sigproc.h index 295170389..9d8a8c520 100644 --- a/winsup/cygwin/sigproc.h +++ b/winsup/cygwin/sigproc.h @@ -110,7 +110,6 @@ BOOL __stdcall pid_exists (pid_t) __attribute__ ((regparm(1))); int __stdcall sig_send (_pinfo *, int, DWORD ebp = (DWORD) __builtin_frame_address (0)) __attribute__ ((regparm(3))); void __stdcall signal_fixup_after_fork (); void __stdcall signal_fixup_after_exec (bool); -extern "C" int __stdcall call_signal_handler (); extern char myself_nowait_dummy[]; extern char myself_nowait_nonmain_dummy[]; diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 571f3ee18..78ce8116f 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -1079,172 +1079,172 @@ __sem_post (sem_t * sem) // empty functions needed when makeing the dll without mt_safe support extern "C" { - int __pthread_create (pthread_t *, const pthread_attr_t *, - TFD (start_routine), void *arg) - { - return -1; - } - int __pthread_attr_init (pthread_attr_t * attr) - { - return -1; - } - int __pthread_attr_destroy (pthread_attr_t * attr) - { - return -1; - } - int __pthread_attr_setdetachstate (pthread_attr_t * attr, int detachstate) - { - return -1; - } - int - __pthread_attr_getdetachstate (const pthread_attr_t * attr, - int *detachstate) - { - return -1; - } - int __pthread_attr_setstacksize (pthread_attr_t * attr, size_t size) - { - return -1; - } - int __pthread_attr_getstacksize (pthread_attr_t * attr, size_t * size) - { - return -1; - } +int __pthread_create (pthread_t *, const pthread_attr_t *, + TFD (start_routine), void *arg) +{ + return -1; +} +int __pthread_attr_init (pthread_attr_t * attr) +{ + return -1; +} +int __pthread_attr_destroy (pthread_attr_t * attr) +{ + return -1; +} +int __pthread_attr_setdetachstate (pthread_attr_t * attr, int detachstate) +{ + return -1; +} +int + __pthread_attr_getdetachstate (const pthread_attr_t * attr, + int *detachstate) +{ + return -1; +} +int __pthread_attr_setstacksize (pthread_attr_t * attr, size_t size) +{ + return -1; +} +int __pthread_attr_getstacksize (pthread_attr_t * attr, size_t * size) +{ + return -1; +} /* these cannot be supported on win32 - the os allocates it's own stack space.. - __pthread_attr_setstackaddr (...){ return -1; }; - __pthread_attr_getstackaddr (...){ return -1; }; - */ - int __pthread_exit (void *value_ptr) - { - return -1; - } + __pthread_attr_setstackaddr (...){ return -1; }; + __pthread_attr_getstackaddr (...){ return -1; }; +*/ +int __pthread_exit (void *value_ptr) +{ + return -1; +} - int __pthread_join (pthread_t thread_id, void **return_val) - { - return -1; - } +int __pthread_join (pthread_t thread_id, void **return_val) +{ + return -1; +} - unsigned long __pthread_getsequence_np (pthread_t * thread) - { - return 0; - } - int __pthread_key_create (pthread_key_t * key) - { - return -1; - } - int __pthread_key_delete (pthread_key_t * key) - { - return -1; - } - int __pthread_setspecific (pthread_key_t * key, const void *value) - { - return -1; - } - void *__pthread_getspecific (pthread_key_t * key) - { - return NULL; - } - int __pthread_kill (pthread_t * thread, int sig) - { - return -1; - } - int __pthread_sigmask (int operation, const sigset_t * set, - sigset_t * old_set) - { - return -1; - } - pthread_t __pthread_self () - { - return -1; - } - int __pthread_equal (pthread_t * t1, pthread_t * t2) - { - return -1; - } - int __pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *) - { - return -1; - } - int __pthread_mutex_lock (pthread_mutex_t *) - { - return -1; - } - int __pthread_mutex_trylock (pthread_mutex_t *) - { - return -1; - } - int __pthread_mutex_unlock (pthread_mutex_t *) - { - return -1; - } - int __pthread_mutex_destroy (pthread_mutex_t *) - { - return -1; - } - int __pthread_cond_destroy (pthread_cond_t *) - { - return -1; - } - int __pthread_cond_init (pthread_cond_t *, const pthread_condattr_t *) - { - return -1; - } - int __pthread_cond_signal (pthread_cond_t *) - { - return -1; - } - int __pthread_cond_broadcast (pthread_cond_t *) - { - return -1; - } - int __pthread_cond_timedwait (pthread_cond_t *, pthread_mutex_t *, - const struct timespec *) - { - return -1; - } - int __pthread_cond_wait (pthread_cond_t *, pthread_mutex_t *) - { - return -1; - } - int __pthread_condattr_init (pthread_condattr_t *) - { - return -1; - } - int __pthread_condattr_destroy (pthread_condattr_t *) - { - return -1; - } - int __pthread_condattr_getpshared (pthread_condattr_t *, int *) - { - return -1; - } - int __pthread_condattr_setpshared (pthread_condattr_t *, int) - { - return -1; - } - int __sem_init (sem_t * sem, int pshared, unsigned int value) - { - return -1; - } - int __sem_destroy (sem_t * sem) - { - return -1; - } - int __sem_wait (sem_t * sem) - { - return -1; - } - int __sem_trywait (sem_t * sem) - { - return -1; - } - int __sem_post (sem_t * sem) - { - return -1; - } - struct _reent *_reent_clib () - { - return NULL; +unsigned long __pthread_getsequence_np (pthread_t * thread) +{ + return 0; +} +int __pthread_key_create (pthread_key_t * key) +{ + return -1; +} +int __pthread_key_delete (pthread_key_t * key) +{ + return -1; +} +int __pthread_setspecific (pthread_key_t * key, const void *value) +{ + return -1; +} +void *__pthread_getspecific (pthread_key_t * key) +{ + return NULL; +} +int __pthread_kill (pthread_t * thread, int sig) +{ + return -1; +} +int __pthread_sigmask (int operation, const sigset_t * set, + sigset_t * old_set) +{ + return -1; +} +pthread_t __pthread_self () +{ + return -1; +} +int __pthread_equal (pthread_t * t1, pthread_t * t2) +{ + return -1; +} +int __pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *) +{ + return -1; +} +int __pthread_mutex_lock (pthread_mutex_t *) +{ + return -1; +} +int __pthread_mutex_trylock (pthread_mutex_t *) +{ + return -1; +} +int __pthread_mutex_unlock (pthread_mutex_t *) +{ + return -1; +} +int __pthread_mutex_destroy (pthread_mutex_t *) +{ + return -1; +} +int __pthread_cond_destroy (pthread_cond_t *) +{ + return -1; +} +int __pthread_cond_init (pthread_cond_t *, const pthread_condattr_t *) +{ + return -1; +} +int __pthread_cond_signal (pthread_cond_t *) +{ + return -1; +} +int __pthread_cond_broadcast (pthread_cond_t *) +{ + return -1; +} +int __pthread_cond_timedwait (pthread_cond_t *, pthread_mutex_t *, + const struct timespec *) +{ + return -1; +} +int __pthread_cond_wait (pthread_cond_t *, pthread_mutex_t *) +{ + return -1; +} +int __pthread_condattr_init (pthread_condattr_t *) +{ + return -1; +} +int __pthread_condattr_destroy (pthread_condattr_t *) +{ + return -1; +} +int __pthread_condattr_getpshared (pthread_condattr_t *, int *) +{ + return -1; +} +int __pthread_condattr_setpshared (pthread_condattr_t *, int) +{ + return -1; +} +int __sem_init (sem_t * sem, int pshared, unsigned int value) +{ + return -1; +} +int __sem_destroy (sem_t * sem) +{ + return -1; +} +int __sem_wait (sem_t * sem) +{ + return -1; +} +int __sem_trywait (sem_t * sem) +{ + return -1; +} +int __sem_post (sem_t * sem) +{ + return -1; +} +struct _reent *_reent_clib () +{ + return NULL; } }