fixed bugs in nwio connect timeout for os2

added pid and tid into PROCINFO for os2 awk
This commit is contained in:
hyung-hwan 2012-08-02 04:20:01 +00:00
parent 3021fd0a82
commit be69e7b40c
2 changed files with 25 additions and 4 deletions

View File

@ -40,7 +40,9 @@
# include <windows.h>
# include <tchar.h>
#elif defined(__OS2__)
/* anything ? */
# define INCL_DOSPROCESS
# define INCL_DOSERRORS
# include <os2.h>
#elif defined(__DOS__)
/* anything ? */
#else
@ -1639,6 +1641,11 @@ static int build_procinfo (qse_awk_rtx_t* rtx, int gbl_id)
qse_awk_val_t* v_tmp;
qse_size_t i;
#if defined(__OS2__)
PTIB tib;
PPIB pib;
#endif
static qse_cstr_t names[] =
{
{ QSE_T("pid"), 3 },
@ -1662,6 +1669,14 @@ static int build_procinfo (qse_awk_rtx_t* rtx, int gbl_id)
return -1;
}
#if defined(__OS2__)
if (DosGetInfoBlocks (&tib, &pib) != NO_ERROR)
{
tib = QSE_NULL;
pib = QSE_NULL;
}
#endif
for (i = 0; i < QSE_COUNTOF(names); i++)
{
qse_long_t val = -99931; /* -99931 randomly chosen */
@ -1673,7 +1688,11 @@ static int build_procinfo (qse_awk_rtx_t* rtx, int gbl_id)
case 7: val = GetCurrentThreadId(); break;
}
#elif defined(__OS2__)
/* TODO: */
switch (i)
{
case 0: if (pib) val = pib->pib_ulpid; break;
case 7: if (tib && tib->tib_ptib2) val = tib->tib_ptib2->tib2_ultid; break;
}
#elif defined(__DOS__)
/* TODO: */
#else

View File

@ -30,6 +30,8 @@
# include <types.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <tcpustd.h>
# include <sys/ioctl.h>
# include <nerrno.h>
# pragma library("tcpip32.lib")
#elif defined(__DOS__)
@ -282,7 +284,7 @@ static int wait_for_data (qse_nwio_t* nwio, int tmout, int what)
count[what]++;
xret = select (&nwio->handle, count[0], count[1], 0, tmout);
xret = os2_select (&nwio->handle, count[0], count[1], 0, tmout);
if (xret <= -1)
{
nwio->errnum = syserr_to_errnum (sock_errno());
@ -586,7 +588,7 @@ int qse_nwio_init (
{
int noblk = 0;
if ((xret <= -1 && sock_errno() != SOCEWOULDBLOCK) ||
if ((xret <= -1 && sock_errno() != SOCEINPROGRESS) ||
ioctl (nwio->handle, FIONBIO, &noblk, QSE_SIZEOF(noblk)) <= -1)
{
nwio->errnum = syserr_to_errnum (sock_errno());