Closed Bug 62877 Opened 24 years ago Closed 24 years ago

OS/2 changes to allow PSM to work

Categories

(NSPR :: NSPR, defect, P1)

x86
OS/2
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: jhpedemonte, Assigned: larryh)

Details

Attachments

(8 files)

Several files need to be changed in NSPR to allow the PSM build to 
work; most importantly, that of setting the loopback device to be 
equal to 127.0.0.1.  Patch included below.
These patches appear to have bad side effects, at least with the OS/2 emx+gtk
build I'm presently working on. Normal page loads, and particularly images,
slowed down horrendously and at times failed completely. Backed them out and
everything was back to normal. If that doesn't happen with VACPP, perhaps wrap
them in ifdef XP_OS2_VACPP for now until I can have a look in the debugger.
After culling all the cosmetic fixes from your patch, Javier, I end up with:

204c203
<     fd_set wd, ex;
---
>     fd_set wd;
229,231c227
<             FD_ZERO(&ex);
<             FD_SET(osfd, &ex);
<             rv = select(osfd + 1, NULL, &wd, &ex, tvp);
---
>             rv = select(osfd + 1, NULL, &wd, NULL, tvp);
241c237
<             rv = select(socks, 0, 1, 1, lTimeout);
---
>             rv = select(socks, 0, 1, 0, lTimeout);
246c242
<                if (FD_ISSET(osfd, &ex))
---
>                if (FD_ISSET(osfd, &wd))
256a254
>                    {
258,260d255
<                    else
<                        PR_SetError(PR_UNKNOWN_ERROR, 0);
<                    return -1;
262,265c257,259
<                if (FD_ISSET(osfd, &wd))
<                {
<                    /* it's connected */
<                    return 0;
---
>                    else
>                        return 0;   /* it's connected */
> 
266a261,262
>                else
>                    return -1;
267a264,266
>                if (socks[0] == osfd)
>                {
>                  len = sizeof(err);
273a273,281
> 
>                  if (err != 0)
>                  {
>                    _PR_MD_MAP_CONNECT_ERROR(err);
>                    return -1;
>                  }
>                  else
>                    return 0;   /* it's connected */
>                }
275c283
<                   return 0; /* It's connected ! */
---
>                  return -1;

Something in these 50-odd lines is most likely the culprit.

h~


the reason i changed those lines is because select (the bsd version, not the 
os/2 version) on os/2 sets the write bit if connect comes back with EWOULDBLOCK.  
however, on win32, select would set the exception bit in this case.  so this 
file was originally written by copying the win32 code, but it wasn't working 
since the exception bit never gets set on os/2 (at least , in this case).  so i 
removed the exception bit and just had the code check the write bit.  does emx 
use a different version of select?
emx provides its own implementation of select() and a quick scan of the src 
shows nothing obvious to suggest bits aren't set as specified in the args. 
Also, EM is very explicit about any such limitations in his software and, and 
there's no mention of it in the docs. Since the problem seems confined to 
VAC++'s select(), just #ifdef your fix and let emx use the existing code.
Attached file full files for EMX
this attach is .ZIP file with _os2.h, os2sock.c and os2poll.c
Status: NEW → ASSIGNED
Priority: P3 → P1
os2sock.c must be changed too: use XP_OS2_VACPP code for EMX too.
so, replace XP_OS2_VACPP by XP_OS2 or clean up it.
Confirming that the latest nspr patches (#24813, 25253, 25343) work fine here 
with an emx build of the 0.8 src. Thanks for the improved select(), Dimitry.
EMX-PSM is still not working on SMP machines... I can't fix this until someone
donate SMP system for me (hehe). VAC-PSM works on SMP.
Except SMP issue, everything works fine.
Target Milestone: --- → 4.2
Assigned the bug to Larry.

Which patches should we review and merge?
Assignee: wtc → larryh
Status: ASSIGNED → NEW
#24813 for the two headers, 25253 and 25343 (the latter two override the rest 
of the first).

Thanks for answering that, Henry.  Does this all work now for EMX?
Yes, both for Dimitry and here.
Thanks.  I will review those patches, and Larry will pick up where
I left off next Monday.  (I'm going on sabbatical on Saturday.)
In patch #24813, you added the following to _os2.h:
+#include <sys/builtin.h>
+#include <sys/smutex.h>
+static _smutex _md_shm_lock = 0;

Is this really necessary?  I don't see _md_shm_lock get used
anywhere. The reason I asked is that it is unusual to *define*
a static variable in a .h file as we will have an instance of
that static variable in every file that includes _os2.h.
I checked in the combined patch (id=26597) on the tip and
NSPRPUB_CLIENT_BRANCH of NSPR.  Please verify that I merged
the patches correctly.

I'd also like to know if the following can be removed from _os2.h:
+#include <sys/builtin.h>
+#include <sys/smutex.h>
+static _smutex _md_shm_lock = 0;

Thanks!
Yes. I don't see it used anywhere. Likely just something Dimitry was playing 
with.
OK, I deleted those three lines of unused code from _os2.h.
Marked the bug fixed.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
verified
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: