diff --git a/qse/lib/awk/std.c b/qse/lib/awk/std.c index 085f511b..e9afe3e5 100644 --- a/qse/lib/awk/std.c +++ b/qse/lib/awk/std.c @@ -40,7 +40,9 @@ # include # include #elif defined(__OS2__) - /* anything ? */ +# define INCL_DOSPROCESS +# define INCL_DOSERRORS +# include #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 diff --git a/qse/lib/cmn/nwio.c b/qse/lib/cmn/nwio.c index 6f6d7c73..bee8dbb6 100644 --- a/qse/lib/cmn/nwio.c +++ b/qse/lib/cmn/nwio.c @@ -30,6 +30,8 @@ # include # include # include +# include +# include # include # 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());