* 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.
This commit is contained in:
Christopher Faylor 2001-04-09 00:44:25 +00:00
parent 97101b51aa
commit aa970c616c
8 changed files with 493 additions and 416 deletions

View File

@ -1,3 +1,21 @@
Sun Apr 8 20:40:58 2001 Christopher Faylor <cgf@cygnus.com>
* 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 <Benjamin.Riefenstahl@epost.de>
* 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 <corinna@vinschen.de> Thu Apr 5 22:41:00 2001 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (stat_worker): Fix conditional which still allowed * syscalls.cc (stat_worker): Fix conditional which still allowed

View File

@ -190,7 +190,7 @@ new-$(LIB_NAME): $(LIB_NAME)
new-$(DLL_NAME): $(DLL_OFILES) $(DEF_FILE) $(DLL_IMPORTS) $(LIBC) $(LIBM) Makefile winver_stamp 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 \ $(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) dll_ofiles: $(DLL_OFILES)

View File

@ -938,7 +938,6 @@ getpgrp
_getpgrp = getpgrp _getpgrp = getpgrp
getgrent getgrent
_getgrent = getgrent _getgrent = getgrent
__empty
ntohl ntohl
_ntohl = ntohl _ntohl = ntohl
htonl htonl

View File

@ -1128,6 +1128,10 @@ call_signal_handler_now ()
sigdelayed0 (); sigdelayed0 ();
return sa_flags & SA_RESTART; 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 int

View File

@ -18,6 +18,7 @@ details. */
#include <wingdi.h> #include <wingdi.h>
#include <winuser.h> #include <winuser.h>
#include <wincon.h> #include <wincon.h>
#include <winnls.h> // MultiByteToWideChar () and friends
#include <ctype.h> #include <ctype.h>
#include <sys/cygwin.h> #include <sys/cygwin.h>
#include "cygheap.h" #include "cygheap.h"
@ -29,6 +30,53 @@ details. */
#include "shared_info.h" #include "shared_info.h"
#include "security.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. * Scroll the screen context.
* x1, y1 - ul corner * x1, y1 - ul corner
@ -124,7 +172,7 @@ fhandler_console::set_cursor_maybe ()
{ {
CONSOLE_SCREEN_BUFFER_INFO now; CONSOLE_SCREEN_BUFFER_INFO now;
if (!GetConsoleScreenBufferInfo (get_output_handle(), &now)) if (!GetConsoleScreenBufferInfo (get_output_handle (), &now))
return; return;
if (dwLastCursorPosition.X != now.dwCursorPosition.X || if (dwLastCursorPosition.X != now.dwCursorPosition.X ||
@ -216,13 +264,13 @@ fhandler_console::read (void *pv, size_t buflen)
if (raw_win32_keyboard_mode) if (raw_win32_keyboard_mode)
{ {
__small_sprintf(tmp, "\033{%u;%u;%u;%u;%u;%luK", __small_sprintf (tmp, "\033{%u;%u;%u;%u;%u;%luK",
input_rec.Event.KeyEvent.bKeyDown, input_rec.Event.KeyEvent.bKeyDown,
input_rec.Event.KeyEvent.wRepeatCount, input_rec.Event.KeyEvent.wRepeatCount,
input_rec.Event.KeyEvent.wVirtualKeyCode, input_rec.Event.KeyEvent.wVirtualKeyCode,
input_rec.Event.KeyEvent.wVirtualScanCode, input_rec.Event.KeyEvent.wVirtualScanCode,
input_rec.Event.KeyEvent.uChar.UnicodeChar, input_rec.Event.KeyEvent.uChar.UnicodeChar,
input_rec.Event.KeyEvent.dwControlKeyState); input_rec.Event.KeyEvent.dwControlKeyState);
toadd = tmp; toadd = tmp;
nread = strlen (toadd); nread = strlen (toadd);
break; break;
@ -248,8 +296,8 @@ fhandler_console::read (void *pv, size_t buflen)
tmp[1] = ich; tmp[1] = ich;
/* Need this check since US code page seems to have a bug when /* Need this check since US code page seems to have a bug when
converting a CTRL-U. */ converting a CTRL-U. */
if ((unsigned char)ich > 0x7f && current_codepage == ansi_cp) if ((unsigned char)ich > 0x7f)
OemToCharBuff (tmp + 1, tmp + 1, 1); con_to_str (tmp + 1, tmp + 1, 1);
/* Determine if the keystroke is modified by META. */ /* Determine if the keystroke is modified by META. */
if (!(input_rec.Event.KeyEvent.dwControlKeyState & meta_mask)) if (!(input_rec.Event.KeyEvent.dwControlKeyState & meta_mask))
toadd = tmp + 1; 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 */ /* Treat the double-click event like a regular button press */
if (mouse_event.dwEventFlags == DOUBLE_CLICK) if (mouse_event.dwEventFlags == DOUBLE_CLICK)
{ {
syscall_printf("mouse: double-click -> click"); syscall_printf ("mouse: double-click -> click");
mouse_event.dwEventFlags = 0; mouse_event.dwEventFlags = 0;
} }
@ -287,7 +335,7 @@ fhandler_console::read (void *pv, size_t buflen)
int y = mouse_event.dwMousePosition.Y; int y = mouse_event.dwMousePosition.Y;
if ((x + ' ' + 1 > 0xFF) || (y + ' ' + 1 > 0xFF)) if ((x + ' ' + 1 > 0xFF) || (y + ' ' + 1 > 0xFF))
{ {
syscall_printf("mouse: position out of range"); syscall_printf ("mouse: position out of range");
continue; continue;
} }
@ -300,28 +348,28 @@ fhandler_console::read (void *pv, size_t buflen)
char sz[32]; char sz[32];
if (mouse_event.dwButtonState == dwLastButtonState) if (mouse_event.dwButtonState == dwLastButtonState)
{ {
syscall_printf("mouse: button state unchanged"); syscall_printf ("mouse: button state unchanged");
continue; continue;
} }
else if (mouse_event.dwButtonState < dwLastButtonState) else if (mouse_event.dwButtonState < dwLastButtonState)
{ {
b = 3; b = 3;
strcpy(sz, "btn up"); strcpy (sz, "btn up");
} }
else if ((mouse_event.dwButtonState & 1) != (dwLastButtonState & 1)) else if ((mouse_event.dwButtonState & 1) != (dwLastButtonState & 1))
{ {
b = 0; b = 0;
strcpy(sz, "btn1 down"); strcpy (sz, "btn1 down");
} }
else if ((mouse_event.dwButtonState & 2) != (dwLastButtonState & 2)) else if ((mouse_event.dwButtonState & 2) != (dwLastButtonState & 2))
{ {
b = 1; b = 1;
strcpy(sz, "btn2 down"); strcpy (sz, "btn2 down");
} }
else if ((mouse_event.dwButtonState & 4) != (dwLastButtonState & 4)) else if ((mouse_event.dwButtonState & 4) != (dwLastButtonState & 4))
{ {
b = 2; b = 2;
strcpy(sz, "btn3 down"); strcpy (sz, "btn3 down");
} }
/* Remember the current button state */ /* Remember the current button state */
@ -342,8 +390,8 @@ fhandler_console::read (void *pv, size_t buflen)
b |= nModifiers; b |= nModifiers;
/* We can now create the code. */ /* We can now create the code. */
sprintf(tmp, "\033[M%c%c%c", b + ' ', x + ' ' + 1, y + ' ' + 1); sprintf (tmp, "\033[M%c%c%c", b + ' ', x + ' ' + 1, y + ' ' + 1);
syscall_printf("mouse: %s at (%d,%d)", sz, x, y); syscall_printf ("mouse: %s at (%d,%d)", sz, x, y);
toadd = tmp; toadd = tmp;
nread = 6; nread = 6;
@ -399,7 +447,7 @@ fhandler_console::fillin_info (void)
BOOL ret; BOOL ret;
CONSOLE_SCREEN_BUFFER_INFO linfo; 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.winTop = linfo.srWindow.Top;
info.winBottom = linfo.srWindow.Bottom; info.winBottom = linfo.srWindow.Bottom;
@ -513,7 +561,7 @@ fhandler_console::open (const char *, int flags, mode_t)
TTYCLEARF (RSTCONS); TTYCLEARF (RSTCONS);
set_ctty (TTY_CONSOLE, flags); 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 ()); get_io_handle (), get_output_handle ());
return 1; return 1;
@ -539,7 +587,7 @@ fhandler_console::dup (fhandler_base *child)
{ {
fhandler_console *fhc = (fhandler_console *) 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"); system_printf ("error opening console, %E");
fhc->default_color = default_color; fhc->default_color = default_color;
@ -569,9 +617,9 @@ fhandler_console::dup (fhandler_base *child)
if (savebuf) if (savebuf)
{ {
fhc->savebuf = (PCHAR_INFO) malloc (sizeof (CHAR_INFO) * fhc->savebuf = (PCHAR_INFO) malloc (sizeof (CHAR_INFO) *
savebufsiz.X * savebufsiz.Y); savebufsiz.X * savebufsiz.Y);
memcpy (fhc->savebuf, savebuf, sizeof (CHAR_INFO) * memcpy (fhc->savebuf, savebuf, sizeof (CHAR_INFO) *
savebufsiz.X * savebufsiz.Y); savebufsiz.X * savebufsiz.Y);
} }
fhc->scroll_region = scroll_region; fhc->scroll_region = scroll_region;
@ -874,11 +922,11 @@ fhandler_console::clear_screen (int x1, int y1, int x2, int y2)
(void)fillin_info (); (void)fillin_info ();
if (x1 < 0) if (x1 < 0)
x1 = info.dwWinSize.X-1; x1 = info.dwWinSize.X - 1;
if (y1 < 0) if (y1 < 0)
y1 = info.winBottom; y1 = info.winBottom;
if (x2 < 0) if (x2 < 0)
x2 = info.dwWinSize.X-1; x2 = info.dwWinSize.X - 1;
if (y2 < 0) if (y2 < 0)
y2 = info.winBottom; y2 = info.winBottom;
@ -1097,12 +1145,12 @@ fhandler_console::char_command (char c)
case 'h': case 'h':
case 'l': case 'l':
if (!saw_question_mark) if (!saw_question_mark)
{ {
switch (args_[0]) switch (args_[0])
{ {
case 4: /* Insert mode */ case 4: /* Insert mode */
insert_mode = (c == 'h') ? TRUE : FALSE; 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;
} }
break; break;
@ -1116,15 +1164,15 @@ fhandler_console::char_command (char c)
COORD cob = { 0, 0 }; COORD cob = { 0, 0 };
if (!GetConsoleScreenBufferInfo (get_output_handle (), &now)) if (!GetConsoleScreenBufferInfo (get_output_handle (), &now))
break; break;
savebufsiz.X = now.srWindow.Right - now.srWindow.Left; savebufsiz.X = now.srWindow.Right - now.srWindow.Left;
savebufsiz.Y = now.srWindow.Bottom - now.srWindow.Top; savebufsiz.Y = now.srWindow.Bottom - now.srWindow.Top;
if (savebuf) if (savebuf)
free (savebuf); free (savebuf);
savebuf = (PCHAR_INFO) malloc (sizeof (CHAR_INFO) * savebuf = (PCHAR_INFO) malloc (sizeof (CHAR_INFO) *
savebufsiz.X * savebufsiz.Y); savebufsiz.X * savebufsiz.Y);
ReadConsoleOutputA (get_output_handle (), savebuf, ReadConsoleOutputA (get_output_handle (), savebuf,
savebufsiz, cob, &now.srWindow); savebufsiz, cob, &now.srWindow);
@ -1135,13 +1183,13 @@ fhandler_console::char_command (char c)
COORD cob = { 0, 0 }; COORD cob = { 0, 0 };
if (!GetConsoleScreenBufferInfo (get_output_handle (), &now)) if (!GetConsoleScreenBufferInfo (get_output_handle (), &now))
break; break;
if (!savebuf) if (!savebuf)
break; break;
WriteConsoleOutputA (get_output_handle (), savebuf, WriteConsoleOutputA (get_output_handle (), savebuf,
savebufsiz, cob, &now.srWindow); savebufsiz, cob, &now.srWindow);
free (savebuf); free (savebuf);
savebuf = NULL; savebuf = NULL;
@ -1151,7 +1199,7 @@ fhandler_console::char_command (char c)
case 1000: /* Mouse support */ case 1000: /* Mouse support */
use_mouse = (c == 'h') ? TRUE : FALSE; 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; break;
case 2000: /* Raw keyboard mode */ case 2000: /* Raw keyboard mode */
@ -1159,7 +1207,7 @@ fhandler_console::char_command (char c)
break; break;
default: /* Ignore */ default: /* Ignore */
syscall_printf("unknown h/l command: %d", args_[0]); syscall_printf ("unknown h/l command: %d", args_[0]);
break; break;
} }
break; break;
@ -1235,7 +1283,7 @@ fhandler_console::char_command (char c)
break; break;
case 'I': /* TAB */ case 'I': /* TAB */
cursor_get (&x, &y); cursor_get (&x, &y);
cursor_set (FALSE, 8*(x/8+1), y); cursor_set (FALSE, 8 * (x / 8 + 1), y);
break; break;
case 'L': /* AL - insert blank lines */ case 'L': /* AL - insert blank lines */
args_[0] = args_[0] ? args_[0] : 1; args_[0] = args_[0] ? args_[0] : 1;
@ -1259,7 +1307,7 @@ fhandler_console::char_command (char c)
break; break;
case 'S': /* SF - Scroll forward */ case 'S': /* SF - Scroll forward */
args_[0] = args_[0] ? args_[0] : 1; 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; break;
case 'T': /* SR - Scroll down */ case 'T': /* SR - Scroll down */
fillin_info (); fillin_info ();
@ -1279,7 +1327,7 @@ fhandler_console::char_command (char c)
case 'b': /* Repeat char #1 #2 times */ case 'b': /* Repeat char #1 #2 times */
if (insert_mode) if (insert_mode)
{ {
cursor_get (&x, &y); cursor_get (&x, &y);
scroll_screen (x, y, -1, y, x + args_[1], y); scroll_screen (x, y, -1, y, x + args_[1], y);
} }
while (args_[1]--) while (args_[1]--)
@ -1330,33 +1378,42 @@ fhandler_console::write_normal (const unsigned char *src,
break; break;
found++; found++;
} }
/* Print all the base ones out */ /* Print all the base ones out */
if (found != src) if (found != src)
{ {
char buf[4096]; DWORD len = found - src;
size_t len = found - src; do
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))
{ {
debug_printf ("write failed, handle %p", get_output_handle ()); DWORD buf_len;
__seterrno (); char buf[CONVERT_LIMIT];
return 0; 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; while (len > 0);
src += done;
} while (len > 0);
} }
if (src < end) if (src < end)
{ {
int x, y; int x, y;
@ -1368,7 +1425,7 @@ fhandler_console::write_normal (const unsigned char *src,
case ESC: case ESC:
state_ = gotesc; state_ = gotesc;
break; break;
case DWN: /* WriteFile("\n") always adds CR... */ case DWN: /* WriteFile ("\n") always adds CR... */
cursor_get (&x, &y); cursor_get (&x, &y);
if (y >= srBottom) if (y >= srBottom)
{ {
@ -1496,7 +1553,7 @@ fhandler_console::write (const void *vsrc, size_t len)
state_ = normal; state_ = normal;
break; break;
case gotrsquare: case gotrsquare:
if (isdigit(*src)) if (isdigit (*src))
rarg = rarg * 10 + (*src - '0'); rarg = rarg * 10 + (*src - '0');
else if (*src == ';' && (rarg == 2 || rarg == 0)) else if (*src == ';' && (rarg == 2 || rarg == 0))
state_ = gettitle; state_ = gettitle;
@ -1663,7 +1720,7 @@ fhandler_console::fixup_after_fork (HANDLE)
/* Windows does not allow duplication of console handles between processes /* Windows does not allow duplication of console handles between processes
so open the console explicitly. */ 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"); system_printf ("error opening console after fork, %E");
if (!get_close_on_exec ()) if (!get_close_on_exec ())
@ -1678,8 +1735,8 @@ set_console_title (char *title)
{ {
int rc; int rc;
char buf[257]; char buf[257];
strncpy(buf, title, sizeof(buf) - 1); strncpy (buf, title, sizeof (buf) - 1);
buf[sizeof(buf) - 1] = '\0'; buf[sizeof (buf) - 1] = '\0';
if ((rc = WaitForSingleObject (title_mutex, 15000)) != WAIT_OBJECT_0) if ((rc = WaitForSingleObject (title_mutex, 15000)) != WAIT_OBJECT_0)
sigproc_printf ("wait for title mutex failed rc %d, %E", rc); sigproc_printf ("wait for title mutex failed rc %d, %E", rc);
SetConsoleTitle (buf); SetConsoleTitle (buf);
@ -1693,7 +1750,7 @@ fhandler_console::fixup_after_exec (HANDLE)
HANDLE h = get_handle (); HANDLE h = get_handle ();
HANDLE oh = get_output_handle (); HANDLE oh = get_output_handle ();
if (!open(get_name (), get_flags (), 0)) if (!open (get_name (), get_flags (), 0))
{ {
int sawerr = 0; int sawerr = 0;
if (!get_io_handle ()) if (!get_io_handle ())

View File

@ -16,237 +16,237 @@
extern "C" extern "C"
{ {
/* ThreadCreation */ /* ThreadCreation */
int int
pthread_create (pthread_t * thread, const pthread_attr_t * attr, pthread_create (pthread_t * thread, const pthread_attr_t * attr,
void *(*start_routine) (void *), void *arg) void *(*start_routine) (void *), void *arg)
{ {
return __pthread_create (thread, attr, start_routine, arg); return __pthread_create (thread, attr, start_routine, arg);
} }
int pthread_attr_init (pthread_attr_t * attr) int pthread_attr_init (pthread_attr_t * attr)
{ {
return __pthread_attr_init (attr); return __pthread_attr_init (attr);
} }
int pthread_attr_destroy (pthread_attr_t * attr) int pthread_attr_destroy (pthread_attr_t * attr)
{ {
return __pthread_attr_destroy (attr); return __pthread_attr_destroy (attr);
} }
int pthread_attr_setdetachstate (pthread_attr_t * attr, int detachstate) int pthread_attr_setdetachstate (pthread_attr_t * attr, int detachstate)
{ {
return __pthread_attr_setdetachstate (attr, detachstate); return __pthread_attr_setdetachstate (attr, detachstate);
} }
int int
pthread_attr_getdetachstate (const pthread_attr_t * attr, pthread_attr_getdetachstate (const pthread_attr_t * attr,
int *detachstate) int *detachstate)
{ {
return __pthread_attr_getdetachstate (attr, detachstate); return __pthread_attr_getdetachstate (attr, detachstate);
} }
int pthread_attr_setstacksize (pthread_attr_t * attr, size_t size) int pthread_attr_setstacksize (pthread_attr_t * attr, size_t size)
{ {
return __pthread_attr_setstacksize (attr, size); return __pthread_attr_setstacksize (attr, size);
} }
int pthread_attr_getstacksize (pthread_attr_t * attr, size_t * size) int pthread_attr_getstacksize (pthread_attr_t * attr, size_t * size)
{ {
return __pthread_attr_getstacksize (attr, size); return __pthread_attr_getstacksize (attr, size);
} }
/* /*
pthread_attr_setstackaddr(...){}; pthread_attr_setstackaddr(...){};
pthread_attr_getstackaddr(...){}; pthread_attr_getstackaddr(...){};
*/ */
/* Thread Exit */ /* Thread Exit */
void pthread_exit (void *value_ptr) void pthread_exit (void *value_ptr)
{ {
return __pthread_exit (value_ptr); return __pthread_exit (value_ptr);
} }
int pthread_join (pthread_t thread, void **return_val) int pthread_join (pthread_t thread, void **return_val)
{ {
return __pthread_join (&thread, (void **) return_val); return __pthread_join (&thread, (void **) return_val);
} }
int pthread_detach (pthread_t thread) int pthread_detach (pthread_t thread)
{ {
return __pthread_detach (&thread); return __pthread_detach (&thread);
} }
int pthread_suspend (pthread_t thread) int pthread_suspend (pthread_t thread)
{ {
return __pthread_suspend (&thread); return __pthread_suspend (&thread);
} }
int pthread_continue (pthread_t thread) int pthread_continue (pthread_t thread)
{ {
return __pthread_continue (&thread); return __pthread_continue (&thread);
} }
unsigned long pthread_getsequence_np (pthread_t * thread) unsigned long pthread_getsequence_np (pthread_t * thread)
{ {
return __pthread_getsequence_np (thread); return __pthread_getsequence_np (thread);
} }
/* Thread SpecificData */ /* Thread SpecificData */
int pthread_key_create (pthread_key_t * key, void (*destructor) (void *)) int pthread_key_create (pthread_key_t * key, void (*destructor) (void *))
{ {
return __pthread_key_create (key, destructor); return __pthread_key_create (key, destructor);
} }
int pthread_key_delete (pthread_key_t * key) int pthread_key_delete (pthread_key_t * key)
{ {
return __pthread_key_delete (key); return __pthread_key_delete (key);
} }
int pthread_setspecific (pthread_key_t key, const void *value) int pthread_setspecific (pthread_key_t key, const void *value)
{ {
return __pthread_setspecific (key, value); return __pthread_setspecific (key, value);
} }
void *pthread_getspecific (pthread_key_t key) void *pthread_getspecific (pthread_key_t key)
{ {
return (void *) __pthread_getspecific (key); return (void *) __pthread_getspecific (key);
} }
/* Thread signal */ /* Thread signal */
int pthread_kill (pthread_t * thread, int sig) int pthread_kill (pthread_t * thread, int sig)
{ {
return __pthread_kill (thread, sig); return __pthread_kill (thread, sig);
} }
int int
pthread_sigmask (int operation, const sigset_t * set, sigset_t * old_set) pthread_sigmask (int operation, const sigset_t * set, sigset_t * old_set)
{ {
return __pthread_sigmask (operation, set, old_set); return __pthread_sigmask (operation, set, old_set);
} }
/* ID */ /* ID */
pthread_t pthread_self () pthread_t pthread_self ()
{ {
return __pthread_self (); return __pthread_self ();
} }
int pthread_equal (pthread_t t1, pthread_t t2) int pthread_equal (pthread_t t1, pthread_t t2)
{ {
return __pthread_equal (&t1, &t2); return __pthread_equal (&t1, &t2);
} }
/* Mutexes */ /* Mutexes */
int int
pthread_mutex_init (pthread_mutex_t * mutex, pthread_mutex_init (pthread_mutex_t * mutex,
const pthread_mutexattr_t * attr) const pthread_mutexattr_t * attr)
{ {
return __pthread_mutex_init (mutex, attr); return __pthread_mutex_init (mutex, attr);
} }
int pthread_mutex_lock (pthread_mutex_t * mutex) int pthread_mutex_lock (pthread_mutex_t * mutex)
{ {
return __pthread_mutex_lock (mutex); return __pthread_mutex_lock (mutex);
} }
int pthread_mutex_trylock (pthread_mutex_t * mutex) int pthread_mutex_trylock (pthread_mutex_t * mutex)
{ {
return __pthread_mutex_trylock (mutex); return __pthread_mutex_trylock (mutex);
} }
int pthread_mutex_unlock (pthread_mutex_t * mutex) int pthread_mutex_unlock (pthread_mutex_t * mutex)
{ {
return __pthread_mutex_unlock (mutex); return __pthread_mutex_unlock (mutex);
} }
int pthread_mutex_destroy (pthread_mutex_t * mutex) int pthread_mutex_destroy (pthread_mutex_t * mutex)
{ {
return __pthread_mutex_destroy (mutex); return __pthread_mutex_destroy (mutex);
} }
/* Synchronisation */ /* Synchronisation */
int pthread_cond_destroy (pthread_cond_t * cond) int pthread_cond_destroy (pthread_cond_t * cond)
{ {
return __pthread_cond_destroy (cond); return __pthread_cond_destroy (cond);
} }
int int
pthread_cond_init (pthread_cond_t * cond, const pthread_condattr_t * attr) pthread_cond_init (pthread_cond_t * cond, const pthread_condattr_t * attr)
{ {
return __pthread_cond_init (cond, attr); return __pthread_cond_init (cond, attr);
} }
int pthread_cond_signal (pthread_cond_t * cond) int pthread_cond_signal (pthread_cond_t * cond)
{ {
return __pthread_cond_signal (cond); return __pthread_cond_signal (cond);
} }
int pthread_cond_broadcast (pthread_cond_t * cond) int pthread_cond_broadcast (pthread_cond_t * cond)
{ {
return __pthread_cond_broadcast (cond); return __pthread_cond_broadcast (cond);
} }
int int
pthread_cond_timedwait (pthread_cond_t * cond, pthread_cond_timedwait (pthread_cond_t * cond,
pthread_mutex_t * mutex, pthread_mutex_t * mutex,
const struct timespec *abstime) const struct timespec *abstime)
{ {
return __pthread_cond_timedwait (cond, mutex, abstime); return __pthread_cond_timedwait (cond, mutex, abstime);
} }
int pthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex) int pthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex)
{ {
return __pthread_cond_wait (cond, mutex); return __pthread_cond_wait (cond, mutex);
} }
int pthread_condattr_init (pthread_condattr_t * condattr) int pthread_condattr_init (pthread_condattr_t * condattr)
{ {
return __pthread_condattr_init (condattr); return __pthread_condattr_init (condattr);
} }
int pthread_condattr_destroy (pthread_condattr_t * condattr) int pthread_condattr_destroy (pthread_condattr_t * condattr)
{ {
return __pthread_condattr_destroy (condattr); return __pthread_condattr_destroy (condattr);
} }
int int
pthread_condattr_getpshared (const pthread_condattr_t * attr, pthread_condattr_getpshared (const pthread_condattr_t * attr,
int *pshared) int *pshared)
{ {
return __pthread_condattr_getpshared (attr, pshared); return __pthread_condattr_getpshared (attr, pshared);
} }
int pthread_condattr_setpshared (pthread_condattr_t * attr, int pshared) int pthread_condattr_setpshared (pthread_condattr_t * attr, int pshared)
{ {
return __pthread_condattr_setpshared (attr, pshared); return __pthread_condattr_setpshared (attr, pshared);
} }
/* Semaphores */ /* Semaphores */
int sem_init (sem_t * sem, int pshared, unsigned int value) int sem_init (sem_t * sem, int pshared, unsigned int value)
{ {
return __sem_init (sem, pshared, value); return __sem_init (sem, pshared, value);
} }
int sem_destroy (sem_t * sem) int sem_destroy (sem_t * sem)
{ {
return __sem_destroy (sem); return __sem_destroy (sem);
} }
int sem_wait (sem_t * sem) int sem_wait (sem_t * sem)
{ {
return __sem_wait (sem); return __sem_wait (sem);
} }
int sem_trywait (sem_t * sem) int sem_trywait (sem_t * sem)
{ {
return __sem_trywait (sem); return __sem_trywait (sem);
} }
int sem_post (sem_t * sem) int sem_post (sem_t * sem)
{ {
return __sem_post (sem); return __sem_post (sem);
} }
} }

View File

@ -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))); 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_fork ();
void __stdcall signal_fixup_after_exec (bool); void __stdcall signal_fixup_after_exec (bool);
extern "C" int __stdcall call_signal_handler ();
extern char myself_nowait_dummy[]; extern char myself_nowait_dummy[];
extern char myself_nowait_nonmain_dummy[]; extern char myself_nowait_nonmain_dummy[];

View File

@ -1079,172 +1079,172 @@ __sem_post (sem_t * sem)
// empty functions needed when makeing the dll without mt_safe support // empty functions needed when makeing the dll without mt_safe support
extern "C" extern "C"
{ {
int __pthread_create (pthread_t *, const pthread_attr_t *, int __pthread_create (pthread_t *, const pthread_attr_t *,
TFD (start_routine), void *arg) TFD (start_routine), void *arg)
{ {
return -1; return -1;
} }
int __pthread_attr_init (pthread_attr_t * attr) int __pthread_attr_init (pthread_attr_t * attr)
{ {
return -1; return -1;
} }
int __pthread_attr_destroy (pthread_attr_t * attr) int __pthread_attr_destroy (pthread_attr_t * attr)
{ {
return -1; return -1;
} }
int __pthread_attr_setdetachstate (pthread_attr_t * attr, int detachstate) int __pthread_attr_setdetachstate (pthread_attr_t * attr, int detachstate)
{ {
return -1; return -1;
} }
int int
__pthread_attr_getdetachstate (const pthread_attr_t * attr, __pthread_attr_getdetachstate (const pthread_attr_t * attr,
int *detachstate) int *detachstate)
{ {
return -1; return -1;
} }
int __pthread_attr_setstacksize (pthread_attr_t * attr, size_t size) int __pthread_attr_setstacksize (pthread_attr_t * attr, size_t size)
{ {
return -1; return -1;
} }
int __pthread_attr_getstacksize (pthread_attr_t * attr, size_t * size) int __pthread_attr_getstacksize (pthread_attr_t * attr, size_t * size)
{ {
return -1; return -1;
} }
/* these cannot be supported on win32 - the os allocates it's own stack space.. /* these cannot be supported on win32 - the os allocates it's own stack space..
__pthread_attr_setstackaddr (...){ return -1; }; __pthread_attr_setstackaddr (...){ return -1; };
__pthread_attr_getstackaddr (...){ return -1; }; __pthread_attr_getstackaddr (...){ return -1; };
*/ */
int __pthread_exit (void *value_ptr) int __pthread_exit (void *value_ptr)
{ {
return -1; return -1;
} }
int __pthread_join (pthread_t thread_id, void **return_val) int __pthread_join (pthread_t thread_id, void **return_val)
{ {
return -1; return -1;
} }
unsigned long __pthread_getsequence_np (pthread_t * thread) unsigned long __pthread_getsequence_np (pthread_t * thread)
{ {
return 0; return 0;
} }
int __pthread_key_create (pthread_key_t * key) int __pthread_key_create (pthread_key_t * key)
{ {
return -1; return -1;
} }
int __pthread_key_delete (pthread_key_t * key) int __pthread_key_delete (pthread_key_t * key)
{ {
return -1; return -1;
} }
int __pthread_setspecific (pthread_key_t * key, const void *value) int __pthread_setspecific (pthread_key_t * key, const void *value)
{ {
return -1; return -1;
} }
void *__pthread_getspecific (pthread_key_t * key) void *__pthread_getspecific (pthread_key_t * key)
{ {
return NULL; return NULL;
} }
int __pthread_kill (pthread_t * thread, int sig) int __pthread_kill (pthread_t * thread, int sig)
{ {
return -1; return -1;
} }
int __pthread_sigmask (int operation, const sigset_t * set, int __pthread_sigmask (int operation, const sigset_t * set,
sigset_t * old_set) sigset_t * old_set)
{ {
return -1; return -1;
} }
pthread_t __pthread_self () pthread_t __pthread_self ()
{ {
return -1; return -1;
} }
int __pthread_equal (pthread_t * t1, pthread_t * t2) int __pthread_equal (pthread_t * t1, pthread_t * t2)
{ {
return -1; return -1;
} }
int __pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *) int __pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *)
{ {
return -1; return -1;
} }
int __pthread_mutex_lock (pthread_mutex_t *) int __pthread_mutex_lock (pthread_mutex_t *)
{ {
return -1; return -1;
} }
int __pthread_mutex_trylock (pthread_mutex_t *) int __pthread_mutex_trylock (pthread_mutex_t *)
{ {
return -1; return -1;
} }
int __pthread_mutex_unlock (pthread_mutex_t *) int __pthread_mutex_unlock (pthread_mutex_t *)
{ {
return -1; return -1;
} }
int __pthread_mutex_destroy (pthread_mutex_t *) int __pthread_mutex_destroy (pthread_mutex_t *)
{ {
return -1; return -1;
} }
int __pthread_cond_destroy (pthread_cond_t *) int __pthread_cond_destroy (pthread_cond_t *)
{ {
return -1; return -1;
} }
int __pthread_cond_init (pthread_cond_t *, const pthread_condattr_t *) int __pthread_cond_init (pthread_cond_t *, const pthread_condattr_t *)
{ {
return -1; return -1;
} }
int __pthread_cond_signal (pthread_cond_t *) int __pthread_cond_signal (pthread_cond_t *)
{ {
return -1; return -1;
} }
int __pthread_cond_broadcast (pthread_cond_t *) int __pthread_cond_broadcast (pthread_cond_t *)
{ {
return -1; return -1;
} }
int __pthread_cond_timedwait (pthread_cond_t *, pthread_mutex_t *, int __pthread_cond_timedwait (pthread_cond_t *, pthread_mutex_t *,
const struct timespec *) const struct timespec *)
{ {
return -1; return -1;
} }
int __pthread_cond_wait (pthread_cond_t *, pthread_mutex_t *) int __pthread_cond_wait (pthread_cond_t *, pthread_mutex_t *)
{ {
return -1; return -1;
} }
int __pthread_condattr_init (pthread_condattr_t *) int __pthread_condattr_init (pthread_condattr_t *)
{ {
return -1; return -1;
} }
int __pthread_condattr_destroy (pthread_condattr_t *) int __pthread_condattr_destroy (pthread_condattr_t *)
{ {
return -1; return -1;
} }
int __pthread_condattr_getpshared (pthread_condattr_t *, int *) int __pthread_condattr_getpshared (pthread_condattr_t *, int *)
{ {
return -1; return -1;
} }
int __pthread_condattr_setpshared (pthread_condattr_t *, int) int __pthread_condattr_setpshared (pthread_condattr_t *, int)
{ {
return -1; return -1;
} }
int __sem_init (sem_t * sem, int pshared, unsigned int value) int __sem_init (sem_t * sem, int pshared, unsigned int value)
{ {
return -1; return -1;
} }
int __sem_destroy (sem_t * sem) int __sem_destroy (sem_t * sem)
{ {
return -1; return -1;
} }
int __sem_wait (sem_t * sem) int __sem_wait (sem_t * sem)
{ {
return -1; return -1;
} }
int __sem_trywait (sem_t * sem) int __sem_trywait (sem_t * sem)
{ {
return -1; return -1;
} }
int __sem_post (sem_t * sem) int __sem_post (sem_t * sem)
{ {
return -1; return -1;
} }
struct _reent *_reent_clib () struct _reent *_reent_clib ()
{ {
return NULL; return NULL;
} }
} }