Ravenports generated: 20 Sep 2017 15:35
[ravenports.git] / bucket_D2 / nspr
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               nspr
4 VERSION=                4.17
5 KEYWORDS=               devel
6 VARIANTS=               standard
7 SDESC[standard]=        Platform-neutral API for system-like functions
8 HOMEPAGE=               http://www.mozilla.org/projects/nspr/index.html
9 CONTACT=                nobody
10
11 DOWNLOAD_GROUPS=        main
12 SITES[main]=            MOZILLA/nspr/releases/v4.17/src
13 DISTFILE[1]=            nspr-4.17.tar.gz:main
14 DF_INDEX=               1
15 SPKGS[standard]=        single
16
17 OPTIONS_AVAILABLE=      none
18 OPTIONS_STANDARD=       none
19
20 USES=                   cpe gmake
21
22 DISTNAME=               nspr-4.17/nspr
23
24 CPE_PRODUCT=            netscape_portable_runtime
25 CPE_VENDOR=             mozilla
26 FPC_EQUIVALENT=         devel/nspr
27
28 MUST_CONFIGURE=         gnu
29 CONFIGURE_ARGS=         --enable-64bit
30
31 post-patch:
32         # Do not install tools to build itself
33         @${REINPLACE_CMD} -e '/RELEASE_BINS/d' \
34                 ${WRKSRC}/pr/src/misc/Makefile.in
35
36 post-install:
37         @${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/*.so
38
39 [FILE:207:descriptions/desc.single]
40 Netscape Portable Runtime (NSPR) provides a platform-neutral API for
41 system level and libc like functions. The API is used in the Mozilla
42 client, many of Netscape/AOL/iPlanet's and other software offerings.
43
44
45 [FILE:95:distinfo]
46 590a0aea29412ae22d7728038c21ef2ab42646e48172a47d2e4bb782846d1095      1141300 nspr-4.17.tar.gz
47
48
49 [FILE:1258:manifests/plist.single]
50 bin/nspr-config
51 include/nspr/md/
52  _aix32.cfg
53  _aix64.cfg
54  _beos.cfg
55  _bsdi.cfg
56  _darwin.cfg
57  _dgux.cfg
58 %%ONLY-DRAGONFLY%%include/nspr/md/_dragonfly.cfg
59  _freebsd.cfg
60  _hpux32.cfg
61  _hpux64.cfg
62  _irix32.cfg
63  _irix64.cfg
64  _linux.cfg
65  _netbsd.cfg
66  _nto.cfg
67  _openbsd.cfg
68  _os2.cfg
69  _osf1.cfg
70  _qnx.cfg
71  _riscos.cfg
72  _scoos.cfg
73  _solaris.cfg
74  _symbian.cfg
75  _unixware.cfg
76  _unixware7.cfg
77  _win95.cfg
78  _winnt.cfg
79 include/nspr/
80  nspr.h
81 include/nspr/obsolete/
82  pralarm.h
83  probslet.h
84  protypes.h
85  prsem.h
86 include/nspr/
87  plarena.h
88  plarenas.h
89  plbase64.h
90  plerror.h
91  plgetopt.h
92  plhash.h
93  plstr.h
94  pratom.h
95  prbit.h
96  prclist.h
97  prcmon.h
98  prcountr.h
99  prcpucfg.h
100  prcvar.h
101  prdtoa.h
102  prenv.h
103  prerr.h
104  prerror.h
105  prinet.h
106  prinit.h
107  prinrval.h
108  prio.h
109  pripcsem.h
110 include/nspr/private/
111  pprio.h
112  pprthred.h
113  prpriv.h
114 include/nspr/
115  prlink.h
116  prlock.h
117  prlog.h
118  prlong.h
119  prmem.h
120  prmon.h
121  prmwait.h
122  prnetdb.h
123  prolock.h
124  prpdce.h
125  prprf.h
126  prproces.h
127  prrng.h
128  prrwlock.h
129  prshm.h
130  prshma.h
131  prsystem.h
132  prthread.h
133  prtime.h
134  prtpool.h
135  prtrace.h
136  prtypes.h
137  prvrsion.h
138  prwin16.h
139 @(,,444) lib/libnspr4.a
140 @(,,444) lib/libnspr4.so
141 @(,,444) lib/libplc4.a
142 @(,,444) lib/libplc4.so
143 @(,,444) lib/libplds4.a
144 @(,,444) lib/libplds4.so
145 lib/pkgconfig/nspr.pc
146 share/aclocal/nspr.m4
147
148
149 [FILE:1298:patches/patch-bug301986]
150 pthread_t can well be a 64-bit value -- on FreeBSD/amd64, for example.
151 Better to just keep calling it pthread_t isntead of casting to anything.
152
153         -mi
154
155 --- pr/include/private/pprthred.h.orig  2015-10-16 13:22:19 UTC
156 +++ pr/include/private/pprthred.h
157 @@ -11,6 +11,7 @@
158  ** developers only.
159  */
160  #include "nspr.h"
161 +#include <pthread.h>
162  
163  #if defined(XP_OS2)
164  #define INCL_DOS
165 @@ -59,7 +60,7 @@ NSPR_API(void) PR_DetachThread(void);
166  ** Get the id of the named thread. Each thread is assigned a unique id
167  ** when it is created or attached.
168  */
169 -NSPR_API(PRUint32) PR_GetThreadID(PRThread *thread);
170 +NSPR_API(pthread_t) PR_GetThreadID(PRThread *thread);
171  
172  /*
173  ** Set the procedure that is called when a thread is dumped. The procedure
174 --- pr/src/pthreads/ptthread.c.orig     2015-10-16 13:22:19 UTC
175 +++ pr/src/pthreads/ptthread.c
176 @@ -1155,12 +1155,12 @@ PR_IMPLEMENT(void) PR_ProcessExit(PRIntn
177      _exit(status);
178  }
179  
180 -PR_IMPLEMENT(PRUint32) PR_GetThreadID(PRThread *thred)
181 +PR_IMPLEMENT(pthread_t) PR_GetThreadID(PRThread *thred)
182  {
183  #if defined(_PR_DCETHREADS)
184      return (PRUint32)&thred->id;  /* this is really a sham! */
185  #else
186 -    return (PRUint32)thred->id;  /* and I don't know what they will do with it */
187 +    return thred->id;  /* and I don't know what they will do with it */
188  #endif
189  }
190  
191
192
193 [FILE:916:patches/patch-bug782109]
194 --- pr/include/md/_freebsd.h.orig       2015-10-16 13:22:19 UTC
195 +++ pr/include/md/_freebsd.h
196 @@ -57,6 +57,14 @@
197  #define _PR_HAVE_LARGE_OFF_T
198  
199  #if defined(_PR_PTHREADS)
200 +#if __FreeBSD_version >= 602000
201 +#define _PR_HAVE_GETPROTO_R
202 +#define _PR_HAVE_5_ARG_GETPROTO_R
203 +#endif
204 +#if __FreeBSD_version >= 700016
205 +#define _PR_HAVE_GETHOST_R
206 +#define _PR_HAVE_GETHOST_R_INT
207 +#endif
208  #if __FreeBSD_version >= 400008
209  /*
210   * libc_r before this version of FreeBSD doesn't have poll().
211 --- pr/src/misc/prnetdb.c.orig  2015-10-16 13:22:19 UTC
212 +++ pr/src/misc/prnetdb.c
213 @@ -78,11 +78,6 @@ PRLock *_pr_dnsLock = NULL;
214  #define _PR_HAVE_GETPROTO_R_INT
215  #endif
216  
217 -#if __FreeBSD_version >= 602000
218 -#define _PR_HAVE_GETPROTO_R
219 -#define _PR_HAVE_5_ARG_GETPROTO_R
220 -#endif
221 -
222  /* BeOS has glibc but not the glibc-style getprotobyxxx_r functions. */
223  #if (defined(__GLIBC__) && __GLIBC__ >= 2 && !defined(XP_BEOS))
224  #define _PR_HAVE_GETPROTO_R
225
226
227 [FILE:489:patches/patch-config_nspr.pc.in]
228 --- config/nspr.pc.in.orig      2015-10-16 13:22:19 UTC
229 +++ config/nspr.pc.in
230 @@ -6,5 +6,5 @@ includedir=@includedir@
231  Name: NSPR
232  Description: The Netscape Portable Runtime
233  Version: @MOD_MAJOR_VERSION@.@MOD_MINOR_VERSION@.@MOD_PATCH_VERSION@
234 -Libs: -L@libdir@ -lplds@MOD_MAJOR_VERSION@ -lplc@MOD_MAJOR_VERSION@ -lnspr@MOD_MAJOR_VERSION@
235 -Cflags: -I@includedir@
236 +Libs: -L${libdir} -lplds@MOD_MAJOR_VERSION@ -lplc@MOD_MAJOR_VERSION@ -lnspr@MOD_MAJOR_VERSION@ @OS_LIBS@
237 +Cflags: -I${includedir}
238
239
240 [FILE:29847:patches/patch-libtests]
241 --- lib/tests/arena.c.orig      2015-10-16 13:22:19 UTC
242 +++ lib/tests/arena.c
243 @@ -36,6 +36,7 @@ void DumpAll( void )
244         return;
245  }
246  
247 +#if 0
248  /*
249  ** Test Arena allocation.
250  */
251 @@ -96,6 +97,7 @@ static void ArenaGrow( void )
252  
253      return;
254  } /* end ArenaGrow() */
255 +#endif
256  
257  
258  /*
259 --- lib/tests/base64t.c.orig    2015-10-16 13:22:19 UTC
260 +++ lib/tests/base64t.c
261 @@ -1987,7 +1987,6 @@ PRBool test_008(void)
262      for( i = 0; i < sizeof(array)/sizeof(array[0]); i++ )
263      {
264          PRUint32 plen = PL_strlen(array[i].plaintext);
265 -        PRUint32 clen = ((plen + 2)/3)*4;
266  
267          char *rv = PL_Base64Encode(array[i].plaintext, plen, (char *)0);
268  
269 @@ -2747,9 +2746,6 @@ PRBool test_024(void)
270  
271      for( i = 0; i < sizeof(array)/sizeof(array[0]); i++ )
272      {
273 -        PRUint32 plen = PL_strlen(array[i].plaintext);
274 -        PRUint32 clen = ((plen + 2)/3)*4;
275 -
276          char *rv = PL_Base64Encode(array[i].plaintext, 0, (char *)0);
277  
278          if( (char *)0 == rv )
279 @@ -2883,8 +2879,6 @@ PRBool test_027(void)
280  
281      for( i = 0; i < sizeof(array)/sizeof(array[0]); i++ )
282      {
283 -        PRUint32 clen = PL_strlen(array[i].cyphertext);
284 -
285          char *rv = PL_Base64Decode(array[i].cyphertext, 0, (char *)0);
286  
287          if( (char *)0 == rv )
288 --- lib/tests/string.c.orig     2015-10-16 13:22:19 UTC
289 +++ lib/tests/string.c
290 @@ -127,7 +127,7 @@ PRBool test_003(void)
291          rv = PL_strcpy(array[i].dest, array[i].str);
292          if( array[i].rv != rv )
293          {
294 -            printf("FAIL %d: (0x%x, %s)->0x%x\n", i, array[i].dest,
295 +            printf("FAIL %d: (%p, %s)->%p\n", i, array[i].dest,
296                     array[i].str ? array[i].str : "(null)", rv);
297              return PR_FALSE;
298          }
299 @@ -237,8 +237,8 @@ PRBool test_004(void)
300          rv = PL_strncpy(array[i].dest, array[i].str, array[i].len);
301          if( array[i].rv != rv )
302          {
303 -            printf("FAIL %d: (0x%x, %s, %lu)->0x%x\n", i, array[i].dest,
304 -                   array[i].str ? array[i].str : "(null)", array[i].len, rv);
305 +            printf("FAIL %d: (%p, %s, %u)->%p\n", i, array[i].dest,
306 +                   array[i].str ? array[i].str : "(null)", (unsigned)array[i].len, rv);
307              return PR_FALSE;
308          }
309  
310 @@ -363,8 +363,8 @@ PRBool test_005(void)
311          rv = PL_strncpyz(array[i].dest, array[i].str, array[i].len);
312          if( array[i].rv != rv )
313          {
314 -            printf("FAIL %d: (0x%x, %s, %lu)->0x%x\n", i, array[i].dest,
315 -                   array[i].str ? array[i].str : "(null)", array[i].len, rv);
316 +            printf("FAIL %d: (%p, %s, %u)->%p\n", i, array[i].dest,
317 +                   array[i].str ? array[i].str : "(null)", (unsigned)array[i].len, rv);
318              return PR_FALSE;
319          }
320  
321 @@ -415,7 +415,7 @@ PRBool test_006(void)
322  
323          if( (char *)0 == rv )
324          {
325 -            printf("FAIL %d: 0x%x -> 0\n", i, array[i]);
326 +            printf("FAIL %d: %p -> 0\n", i, array[i]);
327              return PR_FALSE;
328          }
329  
330 @@ -499,8 +499,8 @@ PRBool test_007(void)
331  
332          if( (char *)0 == rv )
333          {
334 -            printf("FAIL %d: %s,%lu -> 0\n", i, 
335 -                   array[i].str ? array[i].str : "(null)", array[i].len);
336 +            printf("FAIL %d: %s,%u -> 0\n", i, 
337 +                   array[i].str ? array[i].str : "(null)", (unsigned)array[i].len);
338              return PR_FALSE;
339          }
340  
341 @@ -684,10 +684,10 @@ PRBool test_009(void)
342          {
343              if( (char *)0 != rv )
344              {
345 -                printf("FAIL %d: %s+%s/%lu -> %.32s, not zero\n", i,
346 +                printf("FAIL %d: %s+%s/%u -> %.32s, not zero\n", i,
347                         array[i].first ? array[i].first : "(null)",
348                         array[i].second ? array[i].second : "(null)",
349 -                       array[i].length, rv);
350 +                       (unsigned)array[i].length, rv);
351                  return PR_FALSE;
352              }
353          }
354 @@ -695,10 +695,10 @@ PRBool test_009(void)
355          {
356              if( (char *)0 == rv )
357              {
358 -                printf("FAIL %d: %s+%s/%lu -> null, not %s\n", i,
359 +                printf("FAIL %d: %s+%s/%u -> null, not %s\n", i,
360                         array[i].first ? array[i].first : "(null)",
361                         array[i].second ? array[i].second : "(null)",
362 -                       array[i].length, array[i].result);
363 +                       (unsigned)array[i].length, array[i].result);
364                  return PR_FALSE;
365              }
366              else
367 @@ -710,10 +710,10 @@ PRBool test_009(void)
368                  {
369                      if( *a != *b )
370                      {
371 -                        printf("FAIL %d: %s+%s/%lu -> %.32s, not %s\n", i,
372 +                        printf("FAIL %d: %s+%s/%u -> %.32s, not %s\n", i,
373                                 array[i].first ? array[i].first : "(null)",
374                                 array[i].second ? array[i].second : "(null)",
375 -                               array[i].length, rv, array[i].result);
376 +                               (unsigned)array[i].length, rv, array[i].result);
377                          return PR_FALSE;
378                      }
379  
380 @@ -725,10 +725,10 @@ PRBool test_009(void)
381                  {
382                      if( (char)0 != *b )
383                      {
384 -                        printf("FAIL %d: %s+%s/%lu -> not nulled\n", i,
385 +                        printf("FAIL %d: %s+%s/%u -> not nulled\n", i,
386                                 array[i].first ? array[i].first : "(null)",
387                                 array[i].second ? array[i].second : "(null)",
388 -                               array[i].length);
389 +                               (unsigned)array[i].length);
390                          return PR_FALSE;
391                      }
392                  }
393 @@ -736,10 +736,10 @@ PRBool test_009(void)
394                  {
395                      if( (char)0 == *b )
396                      {
397 -                        printf("FAIL %d: %s+%s/%lu -> overrun\n", i,
398 +                        printf("FAIL %d: %s+%s/%u -> overrun\n", i,
399                                 array[i].first ? array[i].first : "(null)",
400                                 array[i].second ? array[i].second : "(null)",
401 -                               array[i].length);
402 +                               (unsigned)array[i].length);
403                          return PR_FALSE;
404                      }
405                  }
406 @@ -814,10 +814,10 @@ PRBool test_010(void)
407          {
408              if( (char *)0 != rv )
409              {
410 -                printf("FAIL %d: %s+%s/%lu -> %.32s, not zero\n", i,
411 +                printf("FAIL %d: %s+%s/%u -> %.32s, not zero\n", i,
412                         array[i].first ? array[i].first : "(null)",
413                         array[i].second ? array[i].second : "(null)",
414 -                       array[i].length, rv);
415 +                       (unsigned)array[i].length, rv);
416                  return PR_FALSE;
417              }
418          }
419 @@ -825,10 +825,10 @@ PRBool test_010(void)
420          {
421              if( (char *)0 == rv )
422              {
423 -                printf("FAIL %d: %s+%s/%lu -> null, not %s\n", i,
424 +                printf("FAIL %d: %s+%s/%u -> null, not %s\n", i,
425                         array[i].first ? array[i].first : "(null)",
426                         array[i].second ? array[i].second : "(null)",
427 -                       array[i].length, array[i].result);
428 +                       (unsigned)array[i].length, array[i].result);
429                  return PR_FALSE;
430              }
431              else
432 @@ -840,10 +840,10 @@ PRBool test_010(void)
433                  {
434                      if( *a != *b )
435                      {
436 -                        printf("FAIL %d: %s+%s/%lu -> %.32s, not %s\n", i,
437 +                        printf("FAIL %d: %s+%s/%u -> %.32s, not %s\n", i,
438                                 array[i].first ? array[i].first : "(null)",
439                                 array[i].second ? array[i].second : "(null)",
440 -                               array[i].length, rv, array[i].result);
441 +                               (unsigned)array[i].length, rv, array[i].result);
442                          return PR_FALSE;
443                      }
444  
445 @@ -1072,10 +1072,10 @@ PRBool test_012(void)
446                  break;
447          }
448  
449 -        printf("FAIL %d: %s-%s/%ld -> %d, not %d\n", i,
450 +        printf("FAIL %d: %s-%s/%d -> %d, not %d\n", i,
451                 array[i].one ? array[i].one : "(null)",
452                 array[i].two ? array[i].two : "(null)",
453 -               array[i].max, rv, array[i].sign);
454 +               (int)array[i].max, rv, array[i].sign);
455          return PR_FALSE;
456      }
457  
458 @@ -1294,10 +1294,10 @@ PRBool test_014(void)
459                  break;
460          }
461  
462 -        printf("FAIL %d: %s-%s/%ld -> %d, not %d\n", i,
463 +        printf("FAIL %d: %s-%s/%d -> %d, not %d\n", i,
464                 array[i].one ? array[i].one : "(null)",
465                 array[i].two ? array[i].two : "(null)",
466 -               array[i].max, rv, array[i].sign);
467 +               (int)array[i].max, rv, array[i].sign);
468          return PR_FALSE;
469      }
470  
471 @@ -1367,15 +1367,15 @@ PRBool test_015(void)
472          {
473              if( (char *)0 == rv )
474              {
475 -                printf("FAIL %d: %s,%c -> null, not +%lu\n", i, array[i].str,
476 -                       array[i].chr, array[i].off);
477 +                printf("FAIL %d: %s,%c -> null, not +%u\n", i, array[i].str,
478 +                       array[i].chr, (unsigned)array[i].off);
479                  return PR_FALSE;
480              }
481  
482              if( &array[i].str[ array[i].off ] != rv )
483              {
484 -                printf("FAIL %d: %s,%c -> 0x%x, not 0x%x+%lu\n", i, array[i].str,
485 -                       array[i].chr, rv, array[i].str, array[i].off);
486 +                printf("FAIL %d: %s,%c -> %p, not %p+%u\n", i, array[i].str,
487 +                       array[i].chr, rv, array[i].str, (unsigned)array[i].off);
488                  return PR_FALSE;
489              }
490          }
491 @@ -1447,15 +1447,15 @@ PRBool test_016(void)
492          {
493              if( (char *)0 == rv )
494              {
495 -                printf("FAIL %d: %s,%c -> null, not +%lu\n", i, array[i].str,
496 -                       array[i].chr, array[i].off);
497 +                printf("FAIL %d: %s,%c -> null, not +%u\n", i, array[i].str,
498 +                       array[i].chr, (unsigned)array[i].off);
499                  return PR_FALSE;
500              }
501  
502              if( &array[i].str[ array[i].off ] != rv )
503              {
504 -                printf("FAIL %d: %s,%c -> 0x%x, not 0x%x+%lu\n", i, array[i].str,
505 -                       array[i].chr, rv, array[i].str, array[i].off);
506 +                printf("FAIL %d: %s,%c -> %p, not %p+%u\n", i, array[i].str,
507 +                       array[i].chr, rv, array[i].str, (unsigned)array[i].off);
508                  return PR_FALSE;
509              }
510          }
511 @@ -1522,8 +1522,8 @@ PRBool test_017(void)
512          {
513              if( (char *)0 != rv )
514              {
515 -                printf("FAIL %d: %s,%c/%lu -> %.32s, not zero\n", i, array[i].str,
516 -                       array[i].chr, array[i].max, rv);
517 +                printf("FAIL %d: %s,%c/%u -> %.32s, not zero\n", i, array[i].str,
518 +                       array[i].chr, (unsigned)array[i].max, rv);
519                  return PR_FALSE;
520              }
521          }
522 @@ -1531,15 +1531,15 @@ PRBool test_017(void)
523          {
524              if( (char *)0 == rv )
525              {
526 -                printf("FAIL %d: %s,%c/%lu -> null, not +%lu\n", i, array[i].str,
527 -                       array[i].chr, array[i].max, array[i].off);
528 +                printf("FAIL %d: %s,%c/%u -> null, not +%u\n", i, array[i].str,
529 +                       array[i].chr, (unsigned)array[i].max, (unsigned)array[i].off);
530                  return PR_FALSE;
531              }
532  
533              if( &array[i].str[ array[i].off ] != rv )
534              {
535 -                printf("FAIL %d: %s,%c/%lu -> 0x%x, not 0x%x+%lu\n", i, array[i].str,
536 -                       array[i].chr, array[i].max, rv, array[i].str, array[i].off);
537 +                printf("FAIL %d: %s,%c/%u -> %p, not %p+%u\n", i, array[i].str,
538 +                       array[i].chr, (unsigned)array[i].max, rv, array[i].str, (unsigned)array[i].off);
539                  return PR_FALSE;
540              }
541          }
542 @@ -1606,8 +1606,8 @@ PRBool test_018(void)
543          {
544              if( (char *)0 != rv )
545              {
546 -                printf("FAIL %d: %s,%c/%lu -> %.32s, not zero\n", i, array[i].str,
547 -                       array[i].chr, array[i].max, rv);
548 +                printf("FAIL %d: %s,%c/%u -> %.32s, not zero\n", i, array[i].str,
549 +                       array[i].chr, (unsigned)array[i].max, rv);
550                  return PR_FALSE;
551              }
552          }
553 @@ -1615,15 +1615,15 @@ PRBool test_018(void)
554          {
555              if( (char *)0 == rv )
556              {
557 -                printf("FAIL %d: %s,%c/%lu -> null, not +%lu\n", i, array[i].str,
558 -                       array[i].chr, array[i].max, array[i].off);
559 +                printf("FAIL %d: %s,%c/%u -> null, not +%u\n", i, array[i].str,
560 +                       array[i].chr, (unsigned)array[i].max, (unsigned)array[i].off);
561                  return PR_FALSE;
562              }
563  
564 -            if( &array[i].str[ array[i].off ] != rv )
565 +            if( &array[i].str[ array[i].off ] != rv)
566              {
567 -                printf("FAIL %d: %s,%c/%lu -> 0x%x, not 0x%x+%lu\n", i, array[i].str,
568 -                       array[i].chr, array[i].max, rv, array[i].str, array[i].off);
569 +                printf("FAIL %d: %s,%c/%u -> %p, not %p+%u\n", i, array[i].str,
570 +                       array[i].chr, (unsigned)array[i].max, rv, array[i].str, (unsigned)array[i].off);
571                  return PR_FALSE;
572              }
573          }
574 @@ -1702,19 +1702,19 @@ PRBool test_019(void)
575          {
576              if( (char *)0 == rv )
577              {
578 -                printf("FAIL %d: %s,%s -> null, not +%lu\n", i,
579 +                printf("FAIL %d: %s,%s -> null, not +%u\n", i,
580                         array[i].str ? array[i].str : "(null)",
581                         array[i].chrs ? array[i].chrs : "(null)", 
582 -                       array[i].off);
583 +                       (unsigned)array[i].off);
584                  return PR_FALSE;
585              }
586  
587              if( &array[i].str[ array[i].off ] != rv )
588              {
589 -                printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i,
590 +                printf("FAIL %d: %s,%s -> %p, not %p+%u\n", i,
591                         array[i].str ? array[i].str : "(null)",
592                         array[i].chrs ? array[i].chrs : "(null)", 
593 -                       rv, array[i].str, array[i].off);
594 +                       rv, array[i].str, (unsigned)array[i].off);
595                  return PR_FALSE;
596              }
597          }
598 @@ -1793,19 +1793,19 @@ PRBool test_020(void)
599          {
600              if( (char *)0 == rv )
601              {
602 -                printf("FAIL %d: %s,%s -> null, not +%lu\n", i,
603 +                printf("FAIL %d: %s,%s -> null, not +%u\n", i,
604                         array[i].str ? array[i].str : "(null)",
605                         array[i].chrs ? array[i].chrs : "(null)", 
606 -                       array[i].off);
607 +                       (unsigned)array[i].off);
608                  return PR_FALSE;
609              }
610  
611              if( &array[i].str[ array[i].off ] != rv )
612              {
613 -                printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i,
614 +                printf("FAIL %d: %s,%s -> %p, not %p+%u\n", i,
615                         array[i].str ? array[i].str : "(null)",
616                         array[i].chrs ? array[i].chrs : "(null)", 
617 -                       rv, array[i].str, array[i].off);
618 +                       rv, array[i].str, (unsigned)array[i].off);
619                  return PR_FALSE;
620              }
621          }
622 @@ -1879,10 +1879,10 @@ PRBool test_021(void)
623          {
624              if( (char *)0 != rv )
625              {
626 -                printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i, 
627 +                printf("FAIL %d: %s,%s/%u -> %.32s, not null\n", i, 
628                         array[i].str ? array[i].str : "(null)",
629                         array[i].chrs ? array[i].chrs : "(null)", 
630 -                       array[i].max, rv);
631 +                       (unsigned)array[i].max, rv);
632                  return PR_FALSE;
633              }
634          }
635 @@ -1890,19 +1890,19 @@ PRBool test_021(void)
636          {
637              if( (char *)0 == rv )
638              {
639 -                printf("FAIL %d: %s,%s/%lu -> null, not +%lu\n", i,
640 +                printf("FAIL %d: %s,%s/%u -> null, not +%u\n", i,
641                         array[i].str ? array[i].str : "(null)",
642                         array[i].chrs ? array[i].chrs : "(null)", 
643 -                       array[i].max, array[i].off);
644 +                       (unsigned)array[i].max, array[i].off);
645                  return PR_FALSE;
646              }
647  
648              if( &array[i].str[ array[i].off ] != rv )
649              {
650 -                printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i,
651 +                printf("FAIL %d: %s,%s/%u -> %p, not %p+%u\n", i,
652                         array[i].str ? array[i].str : "(null)",
653                         array[i].chrs ? array[i].chrs : "(null)", 
654 -                       array[i].max, rv, array[i].str, array[i].off);
655 +                       (unsigned)array[i].max, rv, array[i].str, array[i].off);
656                  return PR_FALSE;
657              }
658          }
659 @@ -1985,10 +1985,10 @@ PRBool test_022(void)
660          {
661              if( (char *)0 != rv )
662              {
663 -                printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i, 
664 +                printf("FAIL %d: %s,%s/%u -> %.32s, not null\n", i, 
665                         array[i].str ? array[i].str : "(null)",
666                         array[i].chrs ? array[i].chrs : "(null)", 
667 -                       array[i].max, rv);
668 +                       (unsigned)array[i].max, rv);
669                  return PR_FALSE;
670              }
671          }
672 @@ -1996,19 +1996,19 @@ PRBool test_022(void)
673          {
674              if( (char *)0 == rv )
675              {
676 -                printf("FAIL %d: %s,%s/%lu -> null, not +%lu\n", i,
677 +                printf("FAIL %d: %s,%s/%u -> null, not +%u\n", i,
678                         array[i].str ? array[i].str : "(null)",
679                         array[i].chrs ? array[i].chrs : "(null)", 
680 -                       array[i].max, array[i].off);
681 +                       (unsigned)array[i].max, array[i].off);
682                  return PR_FALSE;
683              }
684  
685              if( &array[i].str[ array[i].off ] != rv )
686              {
687 -                printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i,
688 +                printf("FAIL %d: %s,%s/%u -> %p, not %p+%u\n", i,
689                         array[i].str ? array[i].str : "(null)",
690                         array[i].chrs ? array[i].chrs : "(null)", 
691 -                       array[i].max, rv, array[i].str, array[i].off);
692 +                       (unsigned)array[i].max, rv, array[i].str, array[i].off);
693                  return PR_FALSE;
694              }
695          }
696 @@ -2104,19 +2104,19 @@ PRBool test_023(void)
697          {
698              if( (char *)0 == rv )
699              {
700 -                printf("FAIL %d: %s,%s -> null, not 0x%x+%lu\n", i,
701 +                printf("FAIL %d: %s,%s -> null, not %p+%u\n", i,
702                         array[i].str ? array[i].str : "(null)",
703                         array[i].sub ? array[i].sub : "(null)",
704 -                       array[i].str, array[i].off);
705 +                       array[i].str, (unsigned)array[i].off);
706                  return PR_FALSE;
707              }
708  
709              if( &array[i].str[ array[i].off ] != rv )
710              {
711 -                printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i, 
712 +                printf("FAIL %d: %s,%s -> %p, not %p+%u\n", i, 
713                         array[i].str ? array[i].str : "(null)",
714                         array[i].sub ? array[i].sub : "(null)",
715 -                       rv, array[i].str, array[i].off);
716 +                       rv, array[i].str, (unsigned)array[i].off);
717                  return PR_FALSE;
718              }
719          }
720 @@ -2212,19 +2212,19 @@ PRBool test_024(void)
721          {
722              if( (char *)0 == rv )
723              {
724 -                printf("FAIL %d: %s,%s -> null, not 0x%x+%lu\n", i,
725 +                printf("FAIL %d: %s,%s -> null, not %p+%u\n", i,
726                         array[i].str ? array[i].str : "(null)",
727                         array[i].sub ? array[i].sub : "(null)",
728 -                       array[i].str, array[i].off);
729 +                       array[i].str, (unsigned)array[i].off);
730                  return PR_FALSE;
731              }
732  
733              if( &array[i].str[ array[i].off ] != rv )
734              {
735 -                printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i, 
736 +                printf("FAIL %d: %s,%s -> %p, not %p+%u\n", i, 
737                         array[i].str ? array[i].str : "(null)",
738                         array[i].sub ? array[i].sub : "(null)",
739 -                       rv, array[i].str, array[i].off);
740 +                       rv, array[i].str, (unsigned)array[i].off);
741                  return PR_FALSE;
742              }
743          }
744 @@ -2331,10 +2331,10 @@ PRBool test_025(void)
745          {
746              if( (char *)0 != rv )
747              {
748 -                printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i,
749 +                printf("FAIL %d: %s,%s/%u -> %.32s, not null\n", i,
750                         array[i].str ? array[i].str : "(null)",
751                         array[i].sub ? array[i].sub : "(null)",
752 -                       array[i].max, rv);
753 +                       (unsigned)array[i].max, rv);
754                  return PR_FALSE;
755              }
756          }
757 @@ -2342,19 +2342,19 @@ PRBool test_025(void)
758          {
759              if( (char *)0 == rv )
760              {
761 -                printf("FAIL %d: %s,%s/%lu -> null, not 0x%x+%lu\n", i,
762 +                printf("FAIL %d: %s,%s/%u -> null, not %p+%u\n", i,
763                         array[i].str ? array[i].str : "(null)",
764                         array[i].sub ? array[i].sub : "(null)",
765 -                       array[i].max, array[i].str, array[i].off);
766 +                       (unsigned)array[i].max, array[i].str, (unsigned)array[i].off);
767                  return PR_FALSE;
768              }
769  
770              if( &array[i].str[ array[i].off ] != rv )
771              {
772 -                printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i, 
773 +                printf("FAIL %d: %s,%s/%u -> %p, not %p+%u\n", i, 
774                         array[i].str ? array[i].str : "(null)",
775                         array[i].sub ? array[i].sub : "(null)",
776 -                       array[i].max, rv, array[i].str, array[i].off);
777 +                       (unsigned)array[i].max, rv, array[i].str, (unsigned)array[i].off);
778                  return PR_FALSE;
779              }
780          }
781 @@ -2463,10 +2463,10 @@ PRBool test_026(void)
782          {
783              if( (char *)0 != rv )
784              {
785 -                printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i,
786 +                printf("FAIL %d: %s,%s/%u -> %.32s, not null\n", i,
787                         array[i].str ? array[i].str : "(null)",
788                         array[i].sub ? array[i].sub : "(null)",
789 -                       array[i].max, rv);
790 +                       (unsigned)array[i].max, rv);
791                  return PR_FALSE;
792              }
793          }
794 @@ -2474,19 +2474,19 @@ PRBool test_026(void)
795          {
796              if( (char *)0 == rv )
797              {
798 -                printf("FAIL %d: %s,%s/%lu -> null, not 0x%x+%lu\n", i,
799 +                printf("FAIL %d: %s,%s/%u -> null, not %p+%u\n", i,
800                         array[i].str ? array[i].str : "(null)",
801                         array[i].sub ? array[i].sub : "(null)",
802 -                       array[i].max, array[i].str, array[i].off);
803 +                       (unsigned)array[i].max, array[i].str, (unsigned)array[i].off);
804                  return PR_FALSE;
805              }
806  
807              if( &array[i].str[ array[i].off ] != rv )
808              {
809 -                printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i, 
810 +                printf("FAIL %d: %s,%s/%u -> %p, not %p+%u\n", i, 
811                         array[i].str ? array[i].str : "(null)",
812                         array[i].sub ? array[i].sub : "(null)",
813 -                       array[i].max, rv, array[i].str, array[i].off);
814 +                       (unsigned)array[i].max, rv, array[i].str, (unsigned)array[i].off);
815                  return PR_FALSE;
816              }
817          }
818 @@ -2582,19 +2582,19 @@ PRBool test_027(void)
819          {
820              if( (char *)0 == rv )
821              {
822 -                printf("FAIL %d: %s,%s -> null, not 0x%x+%lu\n", i,
823 +                printf("FAIL %d: %s,%s -> null, not %p+%u\n", i,
824                         array[i].str ? array[i].str : "(null)",
825                         array[i].sub ? array[i].sub : "(null)",
826 -                       array[i].str, array[i].off);
827 +                       array[i].str, (unsigned)array[i].off);
828                  return PR_FALSE;
829              }
830  
831              if( &array[i].str[ array[i].off ] != rv )
832              {
833 -                printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i, 
834 +                printf("FAIL %d: %s,%s -> %p, not %p+%u\n", i, 
835                         array[i].str ? array[i].str : "(null)",
836                         array[i].sub ? array[i].sub : "(null)",
837 -                       rv, array[i].str, array[i].off);
838 +                       rv, array[i].str, (unsigned)array[i].off);
839                  return PR_FALSE;
840              }
841          }
842 @@ -2690,19 +2690,19 @@ PRBool test_028(void)
843          {
844              if( (char *)0 == rv )
845              {
846 -                printf("FAIL %d: %s,%s -> null, not 0x%x+%lu\n", i,
847 +                printf("FAIL %d: %s,%s -> null, not %p+%u\n", i,
848                         array[i].str ? array[i].str : "(null)",
849                         array[i].sub ? array[i].sub : "(null)",
850 -                       array[i].str, array[i].off);
851 +                       array[i].str, (unsigned)array[i].off);
852                  return PR_FALSE;
853              }
854  
855              if( &array[i].str[ array[i].off ] != rv )
856              {
857 -                printf("FAIL %d: %s,%s -> 0x%x, not 0x%x+%lu\n", i, 
858 +                printf("FAIL %d: %s,%s -> %p, not %p+%u\n", i, 
859                         array[i].str ? array[i].str : "(null)",
860                         array[i].sub ? array[i].sub : "(null)",
861 -                       rv, array[i].str, array[i].off);
862 +                       rv, array[i].str, (unsigned)array[i].off);
863                  return PR_FALSE;
864              }
865          }
866 @@ -2809,10 +2809,10 @@ PRBool test_029(void)
867          {
868              if( (char *)0 != rv )
869              {
870 -                printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i,
871 +                printf("FAIL %d: %s,%s/%u -> %.32s, not null\n", i,
872                         array[i].str ? array[i].str : "(null)",
873                         array[i].sub ? array[i].sub : "(null)",
874 -                       array[i].max, rv);
875 +                       (unsigned)array[i].max, rv);
876                  return PR_FALSE;
877              }
878          }
879 @@ -2820,19 +2820,19 @@ PRBool test_029(void)
880          {
881              if( (char *)0 == rv )
882              {
883 -                printf("FAIL %d: %s,%s/%lu -> null, not 0x%x+%lu\n", i,
884 +                printf("FAIL %d: %s,%s/%u -> null, not %p+%u\n", i,
885                         array[i].str ? array[i].str : "(null)",
886                         array[i].sub ? array[i].sub : "(null)",
887 -                       array[i].max, array[i].str, array[i].off);
888 +                       (unsigned)array[i].max, array[i].str, (unsigned)array[i].off);
889                  return PR_FALSE;
890              }
891  
892              if( &array[i].str[ array[i].off ] != rv )
893              {
894 -                printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i, 
895 +                printf("FAIL %d: %s,%s/%u -> %p, not %p+%u\n", i, 
896                         array[i].str ? array[i].str : "(null)",
897                         array[i].sub ? array[i].sub : "(null)",
898 -                       array[i].max, rv, array[i].str, array[i].off);
899 +                       (unsigned)array[i].max, rv, array[i].str, (unsigned)array[i].off);
900                  return PR_FALSE;
901              }
902          }
903 @@ -2941,10 +2941,10 @@ PRBool test_030(void)
904          {
905              if( (char *)0 != rv )
906              {
907 -                printf("FAIL %d: %s,%s/%lu -> %.32s, not null\n", i,
908 +                printf("FAIL %d: %s,%s/%u -> %.32s, not null\n", i,
909                         array[i].str ? array[i].str : "(null)",
910                         array[i].sub ? array[i].sub : "(null)",
911 -                       array[i].max, rv);
912 +                       (unsigned)array[i].max, rv);
913                  return PR_FALSE;
914              }
915          }
916 @@ -2952,19 +2952,19 @@ PRBool test_030(void)
917          {
918              if( (char *)0 == rv )
919              {
920 -                printf("FAIL %d: %s,%s/%lu -> null, not 0x%x+%lu\n", i,
921 +                printf("FAIL %d: %s,%s/%u -> null, not %p+%u\n", i,
922                         array[i].str ? array[i].str : "(null)",
923                         array[i].sub ? array[i].sub : "(null)",
924 -                       array[i].max, array[i].str, array[i].off);
925 +                       (unsigned)array[i].max, array[i].str, (unsigned)array[i].off);
926                  return PR_FALSE;
927              }
928  
929              if( &array[i].str[ array[i].off ] != rv )
930              {
931 -                printf("FAIL %d: %s,%s/%lu -> 0x%x, not 0x%x+%lu\n", i, 
932 +                printf("FAIL %d: %s,%s/%u -> %p, not %p+%u\n", i, 
933                         array[i].str ? array[i].str : "(null)",
934                         array[i].sub ? array[i].sub : "(null)",
935 -                       array[i].max, rv, array[i].str, array[i].off);
936 +                       (unsigned)array[i].max, rv, array[i].str, (unsigned)array[i].off);
937                  return PR_FALSE;
938              }
939          }
940
941
942 [FILE:85333:patches/patch-tests]
943 --- lib/tests/Makefile.in.orig  2015-10-16 13:22:19 UTC
944 +++ lib/tests/Makefile.in
945 @@ -167,7 +167,7 @@ else
946  ifeq ($(OS_ARCH),OS2)
947         $(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC)  $(LIBPLDS) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS)
948  else
949 -       $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPLDS) $(LIBPR) $(EXTRA_LIBS) -o $@
950 +       $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPLDS) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -o $@
951  endif
952  endif
953  endif
954 --- pr/tests/Makefile.in.orig   2015-10-16 13:22:19 UTC
955 +++ pr/tests/Makefile.in
956 @@ -489,17 +489,18 @@ endif
957  ALWAYS:
958  
959  runtests:: $(PROGS) ALWAYS
960 -       @$(ECHO) "\nNSPR Test Results - $(OBJDIR)\n"
961 -       @$(ECHO) "BEGIN\t\t\t`date`"
962 -       @$(ECHO) "NSPR_TEST_LOGFILE\t$(LOGFILE)\n"
963 -       @$(ECHO) "Test\t\t\tResult\n"
964 +       @$(ECHO) "NSPR Test Results - $(OBJDIR)"
965 +       @$(ECHO) "BEGIN                 `date`"
966 +       @$(ECHO) "Test                  Result"
967         @cd $(OBJDIR); for i in $(PROGRAMS); do                                 \
968 -       $(ECHO) "$$i\c";                                                                                \
969 -       ./$$i >> $(LOGFILE) 2>&1 ;                                                              \
970 +       printf "$$i";                                                                           \
971 +       ./$$i > $$i.output 2>&1;                                                                \
972         if  [ 0 = $$? ] ; then                                                                  \
973 -               $(ECHO) "\t\t\tPassed";                                                         \
974 -       else                                                                                                    \
975 -               $(ECHO) "\t\t\tFAILED";                                                         \
976 -       fi;                                                                                                             \
977 +               $(ECHO) "                       Passed";                                        \
978 +               rm $$i.output;                                                                  \
979 +       else                                                                                    \
980 +               $(ECHO) "                       FAILED";                                        \
981 +               cat $$i.output;                                                                 \
982 +       fi;                                                                                     \
983         done
984 -       @$(ECHO) "\nEND\t\t`date`\n"
985 +       @$(ECHO) "END           `date`"
986 --- pr/tests/cleanup.c.orig     2015-10-16 13:22:19 UTC
987 +++ pr/tests/cleanup.c
988 @@ -15,7 +15,7 @@
989  
990  static void PR_CALLBACK Thread(void *sleep)
991  {
992 -    PR_Sleep(PR_SecondsToInterval((PRUint32)sleep));
993 +    PR_Sleep(PR_SecondsToInterval((intptr_t)sleep));
994      printf("Thread exiting\n");
995  }
996  
997 @@ -39,7 +39,8 @@ int main(int argc, char **argv)
998         PRThreadScope type = PR_LOCAL_THREAD;
999      PRFileDesc *err = PR_GetSpecialFD(PR_StandardError);
1000      PLOptState *opt = PL_CreateOptState(argc, argv, "Ghs:S:t:cC:");
1001 -    PRIntn concurrency = 1, child_sleep = 10, main_sleep = 5, threads = 1;
1002 +    PRIntn concurrency = 1, main_sleep = 5, threads = 1;
1003 +    intptr_t child_sleep = 10;
1004  
1005      PR_STDIO_INIT();
1006      while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
1007 @@ -80,7 +81,7 @@ int main(int argc, char **argv)
1008          (PR_LOCAL_THREAD == type) ? "LOCAL" : "GLOBAL");
1009      PR_fprintf(err, "\tConcurrency: %d\n", concurrency);
1010      PR_fprintf(err, "\tNumber of threads: %d\n", threads);
1011 -    PR_fprintf(err, "\tThread sleep: %d\n", child_sleep);
1012 +    PR_fprintf(err, "\tThread sleep: %d\n", (int)child_sleep);
1013      PR_fprintf(err, "\tMain sleep: %d\n", main_sleep); 
1014      PR_fprintf(err, "\tCleanup will %sbe called\n\n", (cleanup) ? "" : "NOT "); 
1015  
1016 --- pr/tests/cltsrv.c.orig      2015-10-16 13:22:19 UTC
1017 +++ pr/tests/cltsrv.c
1018 @@ -887,7 +887,7 @@ int main(int argc, char** argv)
1019  {
1020      PRUintn index;
1021      PRBool boolean;
1022 -    CSClient_t *client;
1023 +    CSClient_t *client = NULL;
1024      PRStatus rv, joinStatus;
1025      CSServer_t *server = NULL;
1026  
1027 --- pr/tests/cvar.c.orig        2015-10-16 13:22:19 UTC
1028 +++ pr/tests/cvar.c
1029 @@ -135,14 +135,14 @@ static int alive;
1030  static void PR_CALLBACK CXReader(void *arg)
1031  {
1032         CircBuf *cbp = (CircBuf *)arg;
1033 -    PRInt32 i, n;
1034 +    intptr_t i, n;
1035      void *data;
1036  
1037      n = count / 2;
1038      for (i = 0; i < n; i++) {
1039                 data = GetCBData(cbp);
1040 -               if ((int)data != i)
1041 -               if (debug_mode) printf("data mismatch at for i = %d usec\n", i);
1042 +               if ((intptr_t)data != i)
1043 +               if (debug_mode) printf("data mismatch at for i = %ld usec\n", (long)i);
1044      }
1045   
1046      PR_EnterMonitor(mon);
1047 @@ -154,7 +154,7 @@ static void PR_CALLBACK CXReader(void *a
1048  static void PR_CALLBACK CXWriter(void *arg)
1049  {
1050         CircBuf *cbp = (CircBuf *)arg;
1051 -    PRInt32 i, n;
1052 +    intptr_t i, n;
1053  
1054      n = count / 2;
1055      for (i = 0; i < n; i++)
1056 --- pr/tests/cvar2.c.orig       2015-10-16 13:22:19 UTC
1057 +++ pr/tests/cvar2.c
1058 @@ -95,7 +95,7 @@ PrivateCondVarThread(void *_info)
1059      for (index=0; index<info->loops; index++) {
1060          PR_Lock(info->lock);
1061          if (*info->tcount == 0) {
1062 -           DPRINTF(("PrivateCondVarThread: thread 0x%lx waiting on cvar = 0x%lx\n",
1063 +           DPRINTF(("PrivateCondVarThread: thread %p waiting on cvar = %p\n",
1064                                 PR_GetCurrentThread(), info->cvar));
1065              PR_WaitCondVar(info->cvar, info->timeout);
1066         }
1067 @@ -108,8 +108,8 @@ PrivateCondVarThread(void *_info)
1068          PR_Lock(info->exitlock);
1069          (*info->exitcount)++;
1070          PR_NotifyCondVar(info->exitcvar);
1071 -DPRINTF(("PrivateCondVarThread: thread 0x%lx notified exitcvar = 0x%lx cnt = %ld\n",
1072 -                       PR_GetCurrentThread(), info->exitcvar,(*info->exitcount)));
1073 +DPRINTF(("PrivateCondVarThread: thread %p notified exitcvar = %p cnt = %d\n",
1074 +                       PR_GetCurrentThread(), info->exitcvar,(int)(*info->exitcount)));
1075          PR_Unlock(info->exitlock);
1076      }
1077  #if 0
1078 @@ -157,7 +157,7 @@ CreateTestThread(threadinfo *info, 
1079  void 
1080  CondVarTestSUU(void *_arg)
1081  {
1082 -    PRInt32 arg = (PRInt32)_arg;
1083 +    PRInt32 arg = (PRInt32)(intptr_t)_arg;
1084      PRInt32 index, loops;
1085      threadinfo *list;
1086      PRLock *sharedlock;
1087 @@ -189,7 +189,7 @@ CondVarTestSUU(void *_arg)
1088                           PR_TRUE,
1089                           PR_LOCAL_THREAD);
1090          index++;
1091 -       DPRINTF(("CondVarTestSUU: created thread 0x%lx\n",list[index].thread));
1092 +       DPRINTF(("CondVarTestSUU: created thread %p\n",list[index].thread));
1093      }
1094  
1095      for (loops = 0; loops < count; loops++) {
1096 @@ -199,7 +199,7 @@ CondVarTestSUU(void *_arg)
1097              (*list[index].tcount)++;
1098              PR_NotifyCondVar(list[index].cvar);
1099              PR_Unlock(list[index].lock);
1100 -           DPRINTF(("PrivateCondVarThread: thread 0x%lx notified cvar = 0x%lx\n",
1101 +           DPRINTF(("PrivateCondVarThread: thread %p notified cvar = %p\n",
1102                                 PR_GetCurrentThread(), list[index].cvar));
1103          }
1104  
1105 @@ -227,7 +227,7 @@ CondVarTestSUU(void *_arg)
1106  void 
1107  CondVarTestSUK(void *_arg)
1108  {
1109 -    PRInt32 arg = (PRInt32)_arg;
1110 +    PRInt32 arg = (PRInt32)(intptr_t)_arg;
1111      PRInt32 index, loops;
1112      threadinfo *list;
1113      PRLock *sharedlock;
1114 @@ -301,7 +301,7 @@ CondVarTestSUK(void *_arg)
1115  void 
1116  CondVarTestPUU(void *_arg)
1117  {
1118 -    PRInt32 arg = (PRInt32)_arg;
1119 +    PRInt32 arg = (PRInt32)(intptr_t)_arg;
1120      PRInt32 index, loops;
1121      threadinfo *list;
1122      PRLock *sharedlock;
1123 @@ -336,7 +336,7 @@ CondVarTestPUU(void *_arg)
1124                           PR_FALSE,
1125                           PR_LOCAL_THREAD);
1126  
1127 -       DPRINTF(("CondVarTestPUU: created thread 0x%lx\n",list[index].thread));
1128 +       DPRINTF(("CondVarTestPUU: created thread %p\n",list[index].thread));
1129          index++;
1130         tcount++;
1131      }
1132 @@ -354,8 +354,8 @@ CondVarTestPUU(void *_arg)
1133         PR_Lock(exitlock);
1134          /* Wait for threads to finish */
1135          while(exitcount < arg) {
1136 -DPRINTF(("CondVarTestPUU: thread 0x%lx waiting on exitcvar = 0x%lx cnt = %ld\n",
1137 -                               PR_GetCurrentThread(), exitcvar, exitcount));
1138 +DPRINTF(("CondVarTestPUU: thread %p waiting on exitcvar = %p cnt = %d\n",
1139 +                               PR_GetCurrentThread(), exitcvar, (int)exitcount));
1140                 PR_WaitCondVar(exitcvar, PR_SecondsToInterval(60));
1141         }
1142          PR_ASSERT(exitcount >= arg);
1143 @@ -365,7 +365,7 @@ DPRINTF(("CondVarTestPUU: thread 0x%lx w
1144  
1145      /* Join all the threads */
1146      for(index=0; index<(arg); index++)  {
1147 -       DPRINTF(("CondVarTestPUU: joining thread 0x%lx\n",list[index].thread));
1148 +       DPRINTF(("CondVarTestPUU: joining thread %p\n",list[index].thread));
1149          PR_JoinThread(list[index].thread);
1150          if (list[index].internal) {
1151              PR_Lock(list[index].lock);
1152 @@ -387,7 +387,7 @@ DPRINTF(("CondVarTestPUU: thread 0x%lx w
1153  void 
1154  CondVarTestPUK(void *_arg)
1155  {
1156 -    PRInt32 arg = (PRInt32)_arg;
1157 +    PRInt32 arg = (PRInt32)(intptr_t)_arg;
1158      PRInt32 index, loops;
1159      threadinfo *list;
1160      PRLock *sharedlock;
1161 @@ -468,7 +468,7 @@ CondVarTestPUK(void *_arg)
1162  void 
1163  CondVarTest(void *_arg)
1164  {
1165 -    PRInt32 arg = (PRInt32)_arg;
1166 +    PRInt32 arg = (PRInt32)(intptr_t)_arg;
1167      PRInt32 index, loops;
1168      threadinfo *list;
1169      PRLock *sharedlock;
1170 @@ -601,7 +601,7 @@ CondVarTest(void *_arg)
1171  void 
1172  CondVarTimeoutTest(void *_arg)
1173  {
1174 -    PRInt32 arg = (PRInt32)_arg;
1175 +    PRInt32 arg = (PRInt32)(intptr_t)_arg;
1176      PRInt32 index, loops;
1177      threadinfo *list;
1178      PRLock *sharedlock;
1179 @@ -712,7 +712,7 @@ CondVarTimeoutTest(void *_arg)
1180  void 
1181  CondVarMixedTest(void *_arg)
1182  {
1183 -    PRInt32 arg = (PRInt32)_arg;
1184 +    PRInt32 arg = (PRInt32)(intptr_t)_arg;
1185      PRInt32 index, loops;
1186      threadinfo *list;
1187      PRLock *sharedlock;
1188 @@ -802,7 +802,7 @@ CondVarMixedTest(void *_arg)
1189          for(index=0; index<(arg*4); index+=3) {
1190  
1191              PR_Lock(list[index].lock);
1192 -            *list[index].tcount++;
1193 +            list[index].tcount++;
1194              PR_NotifyCondVar(list[index].cvar);
1195              PR_Unlock(list[index].lock);
1196  
1197 @@ -873,7 +873,7 @@ static void Measure(void (*func)(void *)
1198      double d;
1199  
1200      start = PR_IntervalNow();
1201 -    (*func)((void *)arg);
1202 +    (*func)((void *)(intptr_t)arg);
1203      stop = PR_IntervalNow();
1204  
1205      d = (double)PR_IntervalToMicroseconds(stop - start);
1206 @@ -932,7 +932,7 @@ default_threads, default_threads*2, defa
1207      PR_SetConcurrency(2);
1208  
1209      for (threads = default_threads; threads < default_threads*5; threads+=default_threads) {
1210 -        printf("\n%ld Thread tests\n", threads);
1211 +        printf("\n%d Thread tests\n", (int)threads);
1212          Measure(CondVarTestSUU, threads, "Condvar simple test shared UU");
1213          Measure(CondVarTestSUK, threads, "Condvar simple test shared UK");
1214          Measure(CondVarTestPUU, threads, "Condvar simple test priv UU");
1215 --- pr/tests/foreign.c.orig     2015-10-16 13:22:19 UTC
1216 +++ pr/tests/foreign.c
1217 @@ -202,7 +202,7 @@ static void OneShot(void *arg)
1218      PRFileDesc *fd;
1219      PRDir *dir;
1220      PRFileDesc *pair[2];
1221 -    PRIntn test = (PRIntn)arg;
1222 +    intptr_t test = (intptr_t)arg;
1223  
1224         for (test = 0; test < 12; ++test) {
1225  
1226 @@ -302,7 +302,7 @@ static void OneShot(void *arg)
1227  int main(int argc, char **argv)
1228  {
1229      PRStatus rv;
1230 -       PRInt32 thread_cnt = DEFAULT_THREAD_COUNT;
1231 +       intptr_t        thread_cnt = DEFAULT_THREAD_COUNT;
1232         PLOptStatus os;
1233         PLOptState *opt = PL_CreateOptState(argc, argv, "dt:");
1234  
1235 --- pr/tests/forktest.c.orig    2015-10-16 13:22:19 UTC
1236 +++ pr/tests/forktest.c
1237 @@ -47,7 +47,7 @@ ClientThreadFunc(void *arg)
1238  {
1239      PRNetAddr addr;
1240      PRFileDesc *sock = NULL;
1241 -    PRInt32 tmp = (PRInt32)arg;
1242 +    intptr_t tmp = (intptr_t)arg;
1243  
1244      /*
1245       * Make sure the PR_Accept call will block
1246 @@ -143,7 +143,7 @@ DoIO(void)
1247          goto finish;
1248      }
1249      clientThread = PR_CreateThread( PR_USER_THREAD, ClientThreadFunc,
1250 -        (void *) PR_ntohs(addr.inet.port), PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
1251 +        (void *)(intptr_t)PR_ntohs(addr.inet.port), PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
1252          PR_JOINABLE_THREAD, 0);
1253      if (clientThread == NULL) {
1254          fprintf(stderr, "Cannot create client thread: (%d, %d)\n",
1255 @@ -151,6 +151,9 @@ DoIO(void)
1256          failed_already = 1;
1257          goto finish;
1258      }
1259 +    printf("Wait one second before accept\n");
1260 +    fflush(stdout);
1261 +    PR_Sleep(PR_SecondsToInterval(1));
1262      printf("Accepting connection at port %hu\n", PR_ntohs(addr.inet.port));
1263      fflush(stdout);
1264      sock = PR_Accept(listenSock, &addr, PR_SecondsToInterval(5));
1265 --- pr/tests/getai.c.orig       2015-10-16 13:22:19 UTC
1266 +++ pr/tests/getai.c
1267 @@ -13,8 +13,13 @@ int main(int argc, char **argv)
1268      PRAddrInfo *ai;
1269      void *iter;
1270      PRNetAddr addr;
1271 +    const char *host;
1272  
1273 -    ai = PR_GetAddrInfoByName(argv[1], PR_AF_UNSPEC, PR_AI_ADDRCONFIG);
1274 +    if (argc > 1)
1275 +       host = argv[1];
1276 +    else
1277 +       host = "www.FreeBSD.org";
1278 +    ai = PR_GetAddrInfoByName(host, PR_AF_UNSPEC, PR_AI_ADDRCONFIG);
1279      if (ai == NULL) {
1280          fprintf(stderr, "PR_GetAddrInfoByName failed: (%d, %d)\n",
1281              PR_GetError(), PR_GetOSError());
1282 --- pr/tests/instrumt.c.orig    2015-10-16 13:22:19 UTC
1283 +++ pr/tests/instrumt.c
1284 @@ -36,6 +36,7 @@
1285  */
1286  
1287  #include <stdio.h>
1288 +#define DEBUG
1289  #include <plstr.h>
1290  #include <prclist.h>
1291  #include <prmem.h>
1292 @@ -50,7 +51,6 @@
1293  #define COUNT_LIMIT  (10 * ( 1024))
1294  
1295  #define SMALL_TRACE_BUFSIZE  ( 60 * 1024 )
1296 -
1297  typedef enum 
1298  {
1299      CountLoop = 1,
1300 @@ -78,10 +78,10 @@ static void Help(void)
1301  
1302  static void ListCounters(void)
1303  {
1304 +#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
1305      PR_DEFINE_COUNTER( qh );
1306      PR_DEFINE_COUNTER( rh );
1307      const char *qn, *rn, *dn;
1308 -    const char **qname = &qn, **rname = &rn, **desc = &dn;
1309      PRUint32    tCtr;
1310  
1311      PR_INIT_COUNTER_HANDLE( qh, NULL );
1312 @@ -92,7 +92,7 @@ static void ListCounters(void)
1313          PR_FIND_NEXT_COUNTER_RNAME(rh, rh, qh );
1314          while ( rh != NULL )
1315          {
1316 -            PR_GET_COUNTER_NAME_FROM_HANDLE( rh, qname, rname, desc );
1317 +            PR_GET_COUNTER_NAME_FROM_HANDLE( rh, &qn, &rn, &dn );
1318              PR_GET_COUNTER(tCtr, rh);
1319              PR_LOG( lm, msgLevel,
1320                  ( "QName: %s  RName: %s  Desc: %s  Value: %ld\n", 
1321 @@ -101,15 +101,15 @@ static void ListCounters(void)
1322          } 
1323          PR_FIND_NEXT_COUNTER_QNAME(qh, qh);
1324      }
1325 -    return;    
1326 +#endif
1327  } /* end ListCounters() */
1328  
1329  static void ListTraces(void)
1330  {
1331 +#if defined(DEBUG) || defined(FORCE_NSPR_TRACE)
1332      PR_DEFINE_TRACE( qh );
1333      PR_DEFINE_TRACE( rh );
1334      const char *qn, *rn, *dn;
1335 -    const char **qname = &qn, **rname = &rn, **desc = &dn;
1336  
1337      PR_INIT_TRACE_HANDLE( qh, NULL );
1338      PR_FIND_NEXT_TRACE_QNAME(qh, qh );
1339 @@ -119,7 +119,7 @@ static void ListTraces(void)
1340          PR_FIND_NEXT_TRACE_RNAME(rh, rh, qh );
1341          while ( rh != NULL )
1342          {
1343 -            PR_GET_TRACE_NAME_FROM_HANDLE( rh, qname, rname, desc );
1344 +            PR_GET_TRACE_NAME_FROM_HANDLE( rh, &qn, &rn, &dn );
1345              PR_LOG( lm, msgLevel,
1346                  ( "QName: %s  RName: %s  Desc: %s", 
1347                  qn, rn, dn ));
1348 @@ -127,7 +127,7 @@ static void ListTraces(void)
1349          } 
1350          PR_FIND_NEXT_TRACE_QNAME(qh, qh);
1351      }
1352 -    return;    
1353 +#endif
1354  } /* end ListCounters() */
1355  
1356  
1357 @@ -326,7 +326,7 @@ static void PR_CALLBACK SampleTrace( voi
1358  */
1359  static void TraceTest( void )
1360  {
1361 -    PRInt32 i;
1362 +    PRIntn i = 0;
1363      PRInt32 size;
1364      PR_DEFINE_TRACE( th );
1365      PRThread *t1, *t2;
1366 --- pr/tests/io_timeout.c.orig  2015-10-16 13:22:19 UTC
1367 +++ pr/tests/io_timeout.c
1368 @@ -22,11 +22,13 @@
1369  /* Used to get the command line option */
1370  #include "plgetopt.h"
1371  
1372 +#include <errno.h>
1373  #include <stdio.h>
1374 +#include <string.h>
1375  #include "nspr.h"
1376  
1377  #define NUM_THREADS 1
1378 -#define BASE_PORT   8000
1379 +#define BASE_PORT   38011
1380  #define DEFAULT_ACCEPT_TIMEOUT 2
1381  
1382  typedef struct threadInfo {
1383 @@ -38,7 +40,7 @@ typedef struct threadInfo {
1384  } threadInfo;
1385  
1386  PRIntn failed_already = 0;
1387 -PRIntn debug_mode = 0;
1388 +PRIntn debug_mode = 1;
1389  
1390  #define        LOCAL_SCOPE_STRING                      "LOCAL scope"
1391  #define        GLOBAL_SCOPE_STRING                     "GLOBAL scope"
1392 @@ -54,7 +56,7 @@ thread_main(void *_info)
1393      PRFileDesc *clientSock;
1394      PRStatus rv;
1395         PRThreadScope tscope;
1396 -       char *scope_str;
1397 +       const char *scope_str;
1398  
1399   
1400         if (debug_mode)
1401 @@ -73,6 +75,7 @@ thread_main(void *_info)
1402                         break;
1403                 default:
1404                         PR_NOT_REACHED("Invalid thread scope");
1405 +                       scope_str = NULL;
1406                         break;
1407         }
1408         printf("thread id %d, scope %s\n", info->id, scope_str);
1409 @@ -91,7 +94,12 @@ thread_main(void *_info)
1410      rv = PR_Bind(listenSock, &listenAddr);
1411      if (rv == PR_FAILURE) {
1412                 if (debug_mode)
1413 -               printf("unable to bind\n");
1414 +                       printf("unable to bind to %d: %s\n",
1415 +                           BASE_PORT + info->id, strerror(PR_GetOSError()));
1416 +               if (PR_GetOSError() == EADDRINUSE) {
1417 +                       printf("can not proceed with this test\n");
1418 +                       exit(0);
1419 +               }
1420                 failed_already=1;
1421          goto dead;
1422      }
1423 @@ -113,8 +121,9 @@ thread_main(void *_info)
1424      if (clientSock == NULL) {
1425          if (PR_GetError() == PR_IO_TIMEOUT_ERROR) {
1426                         if (debug_mode) {       
1427 -               printf("PR_Accept() timeout worked!\n"); 
1428 -                               printf("TEST PASSED! PR_Accept() returned error %d\n",
1429 +                               printf("PR_Accept() timeout worked!\n"
1430 +                                   "TEST PASSED! PR_Accept() returned error "
1431 +                                   "PR_IO_TIMEOUT_ERROR (%ld)\n",
1432                                                         PR_IO_TIMEOUT_ERROR);
1433                         }
1434         } else {
1435 --- pr/tests/layer.c.orig       2015-10-16 13:22:19 UTC
1436 +++ pr/tests/layer.c
1437 @@ -45,7 +45,10 @@ static PRUint16 default_port = 12273;
1438  static PRFileDesc *PushLayer(PRFileDesc *stack)
1439  {
1440      PRFileDesc *layer = PR_CreateIOLayerStub(identity, &myMethods);
1441 -    PRStatus rv = PR_PushIOLayer(stack, PR_GetLayersIdentity(stack), layer);
1442 +#if defined(DEBUG) || defined(FORCE_PR_ASSERT)
1443 +    PRStatus rv = /* we only need rv for PR_ASSERT() */
1444 +#endif
1445 +       PR_PushIOLayer(stack, PR_GetLayersIdentity(stack), layer);
1446      if (verbosity > quiet)
1447          PR_fprintf(logFile, "Pushed layer(0x%x) onto stack(0x%x)\n", layer, stack);
1448      PR_ASSERT(PR_SUCCESS == rv);
1449 --- pr/tests/lazyinit.c.orig    2015-10-16 13:22:19 UTC
1450 +++ pr/tests/lazyinit.c
1451 @@ -43,7 +43,6 @@ int main(int argc, char **argv)
1452      char *path = NULL;
1453      PRDir *dir = NULL;
1454      PRLock *ml = NULL;
1455 -    PRCondVar *cv = NULL;
1456      PRThread *thread = NULL;
1457      PRIntervalTime interval = 0;
1458      PRFileDesc *file, *udp, *tcp, *pair[2];
1459 --- pr/tests/lltest.c.orig      2015-10-16 13:22:19 UTC
1460 +++ pr/tests/lltest.c
1461 @@ -545,6 +545,7 @@ TestConversion( void )
1462      return;
1463  }
1464  
1465 +#if 0
1466  static void ShiftCompileOnly()
1467  {
1468      /*
1469 @@ -561,6 +562,7 @@ static void ShiftCompileOnly()
1470      LL_ISHL(ia, 49, 32);
1471  
1472  }  /* ShiftCompileOnly */
1473 +#endif
1474     
1475  
1476  /*
1477 @@ -635,7 +637,6 @@ TestArithmetic( void )
1478      PRInt64 largeValPlusOne   = LL_INIT( 0x00000002, 0x00000000 );
1479      PRInt64 largeValTimesTwo  = LL_INIT( 0x00000003, 0xfffffffe );
1480      PRInt64 largeMultCand     = LL_INIT( 0x00000000, 0x7fffffff );
1481 -    PRInt64 largeMinusMultCand = LL_INIT( 0xffffffff, 0x10000001 );
1482      PRInt64 largeMultCandx64K = LL_INIT( 0x00007fff, 0xffff0000 );
1483      PRInt64 largeNumSHL5      = LL_INIT( 0x0000001f, 0xffffffe0 );        
1484      PRInt64 result, result2;
1485 --- pr/tests/mbcs.c.orig        2015-10-16 13:22:19 UTC
1486 +++ pr/tests/mbcs.c
1487 @@ -54,13 +54,12 @@ char *dirName =  NULL;  /* directory nam
1488  /*
1489  ** Traverse directory
1490  */
1491 -static void TraverseDirectory( unsigned char *dir )
1492 +static void TraverseDirectory(const char *dir)
1493  {
1494      PRDir *cwd;
1495      PRDirEntry *dirEntry;
1496      PRFileInfo info;
1497      PRStatus rc;
1498 -    PRInt32 err;
1499      PRFileDesc *fd;
1500      char    nextDir[256];
1501      char    file[256];
1502 @@ -81,16 +80,16 @@ static void TraverseDirectory( unsigned 
1503              exit(1);
1504          }
1505          if ( PR_FILE_FILE == info.type )  {
1506 -            printf("File: %s \tsize: %ld\n", dirEntry->name, info.size );
1507 +            printf("File: %s \tsize: %ld\n", dirEntry->name, (long)info.size );
1508              fd = PR_Open( file, PR_RDONLY, 0 );
1509              if ( NULL == fd )  {
1510                  printf("PR_Open() failed. Error: %ld, OSError: %ld\n", 
1511 -                    PR_GetError(), PR_GetOSError());
1512 +                    (long)PR_GetError(), (long)PR_GetOSError());
1513              }
1514              rc = PR_Close( fd );
1515              if ( PR_FAILURE == rc )  {
1516                  printf("PR_Close() failed. Error: %ld, OSError: %ld\n", 
1517 -                    PR_GetError(), PR_GetOSError());
1518 +                    (long)PR_GetError(), (long)PR_GetOSError());
1519              }
1520          } else if ( PR_FILE_DIRECTORY == info.type ) {
1521              sprintf( nextDir, "%s/%s", dir, dirEntry->name );
1522 --- pr/tests/nbconn.c.orig      2015-10-16 13:22:19 UTC
1523 +++ pr/tests/nbconn.c
1524 @@ -54,8 +54,7 @@ int main(int argc, char **argv)
1525      PRStatus rv;
1526      PRSocketOptionData optData;
1527         const char *hostname = NULL;
1528 -    PRIntn default_case, n, bytes_read, bytes_sent;
1529 -       PRInt32 failed_already = 0;
1530 +    PRIntn default_case, n;
1531  
1532      /*
1533       * -d           debug mode
1534 @@ -164,7 +163,7 @@ int main(int argc, char **argv)
1535                                 exit(1);
1536                         }
1537                         printf( "PR_GetConnectStatus: connect failed: (%ld, %ld)\n",
1538 -                                       PR_GetError(), PR_GetOSError());
1539 +                                       (long)PR_GetError(), (long)PR_GetOSError());
1540                 }
1541                 PR_Close(sock);
1542         printf( "PASS\n");
1543 @@ -235,7 +234,7 @@ connection_success_test()
1544         PRThread *thr = NULL;
1545         Server_Param sp;
1546         char send_buf[DATA_BUF_SIZE], recv_buf[DATA_BUF_SIZE];
1547 -    PRIntn default_case, n, bytes_read, bytes_sent;
1548 +    PRIntn n, bytes_read, bytes_sent;
1549      PRIntn failed_already = 0;
1550  
1551         /*
1552 @@ -311,7 +310,7 @@ connection_success_test()
1553                 failed_already=1;
1554                 goto def_exit;
1555         }
1556 -       DPRINTF(("Created TCP_Server thread [0x%x]\n",thr));
1557 +       DPRINTF(("Created TCP_Server thread [%p]\n", thr));
1558         pd.fd = conn_fd;
1559         pd.in_flags = PR_POLL_WRITE | PR_POLL_EXCEPT;
1560         n = PR_Poll(&pd, 1, PR_INTERVAL_NO_TIMEOUT);
1561 @@ -390,7 +389,7 @@ connection_success_test()
1562                 DPRINTF(("Data integrity verified\n"));
1563         } else {
1564                 fprintf(stderr,"PR_GetConnectStatus: connect failed: (%ld, %ld)\n",
1565 -                               PR_GetError(), PR_GetOSError());
1566 +                               (long)PR_GetError(), (long)PR_GetOSError());
1567                 failed_already = 1;
1568                 goto def_exit;
1569         }
1570 @@ -496,7 +495,6 @@ connection_failure_test()
1571                 goto def_exit;
1572         }
1573         if (PR_GetConnectStatus(&pd) == PR_SUCCESS) {
1574 -               PRInt32 rv;
1575                 fprintf(stderr,"PR_GetConnectStatus succeeded, expected to fail\n");
1576                 failed_already = 1;
1577                 goto def_exit;
1578 --- pr/tests/nblayer.c.orig     2015-10-16 13:22:19 UTC
1579 +++ pr/tests/nblayer.c
1580 @@ -299,7 +299,7 @@ static PRStatus PR_CALLBACK MyClose(PRFi
1581  static PRInt16 PR_CALLBACK MyPoll(
1582      PRFileDesc *fd, PRInt16 in_flags, PRInt16 *out_flags)
1583  {
1584 -    PRInt16 my_flags, new_flags;
1585 +    PRInt16 my_flags = -1, new_flags;
1586      PRFilePrivate *mine = (PRFilePrivate*)fd->secret;
1587      if (0 != (PR_POLL_READ & in_flags))
1588      {
1589 @@ -342,7 +342,7 @@ static PRFileDesc * PR_CALLBACK MyAccept
1590      PRFileDesc *fd, PRNetAddr *addr, PRIntervalTime timeout)
1591  {
1592      PRStatus rv;
1593 -    PRFileDesc *newfd, *layer = fd;
1594 +    PRFileDesc *newfd;
1595      PRFileDesc *newstack;
1596      PRFilePrivate *newsecret;
1597  
1598 @@ -428,6 +428,8 @@ static PRInt32 PR_CALLBACK MyRecv(
1599              mine->rcvinprogress = 0;
1600              return mine->rcvreq;  /* << -- that's it! */
1601          default:
1602 +            PR_ASSERT(!"How did I get this mine->rcvstate?");
1603 +            rv = -1;
1604              break;
1605          }
1606      } while (-1 != rv);
1607 @@ -484,6 +486,8 @@ static PRInt32 PR_CALLBACK MySend(
1608              mine->xmtinprogress = 0;
1609              return mine->xmtreq;  /* <<-- That's the one! */
1610          default:
1611 +            PR_ASSERT(!"How did I get this mine->xmtstate?");
1612 +            rv = -1;
1613              break;
1614          }
1615      } while (-1 != rv);
1616 --- pr/tests/nonblock.c.orig    2015-10-16 13:22:19 UTC
1617 +++ pr/tests/nonblock.c
1618 @@ -39,7 +39,7 @@
1619  static void PR_CALLBACK
1620  clientThreadFunc(void *arg)
1621  {
1622 -    PRUintn port = (PRUintn)arg;
1623 +    intptr_t port = (intptr_t)arg;
1624      PRFileDesc *sock;
1625      PRNetAddr addr;
1626      char buf[CHUNK_SIZE];
1627 @@ -147,7 +147,7 @@ static PRIntn PR_CALLBACK RealMain( PRIn
1628      printf("%s", buf);
1629  
1630      clientThread = PR_CreateThread(PR_USER_THREAD,
1631 -           clientThreadFunc, (void *) listenPort,
1632 +           clientThreadFunc, (void *) (intptr_t)listenPort,
1633             PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
1634             PR_UNJOINABLE_THREAD, 0);
1635      if (clientThread == NULL) {
1636 @@ -191,7 +191,7 @@ static PRIntn PR_CALLBACK RealMain( PRIn
1637         if (retVal != -1 || PR_GetError() != PR_WOULD_BLOCK_ERROR) {
1638          PL_PrintError("First Receive:\n");
1639             fprintf(stderr, "First PR_Recv: retVal: %ld, Error: %ld\n",
1640 -            retVal, PR_GetError());
1641 +            (long)retVal, (long)PR_GetError());
1642             exit(1);
1643          }
1644         printf("read: EWOULDBLOCK, good\n");
1645 @@ -201,7 +201,7 @@ static PRIntn PR_CALLBACK RealMain( PRIn
1646         if (retVal != CHUNK_SIZE) {
1647          PL_PrintError("Second Receive:\n");
1648             fprintf(stderr, "Second PR_Recv: retVal: %ld, Error: %ld\n", 
1649 -            retVal, PR_GetError());
1650 +            (long)retVal, (long)PR_GetError());
1651             exit(1);
1652          }
1653         printf("read: %d bytes, good\n", retVal);
1654 --- pr/tests/obsints.c.orig     2015-10-16 13:22:19 UTC
1655 +++ pr/tests/obsints.c
1656 @@ -25,6 +25,9 @@ int main(int argc, char **argv)
1657  #else /* NO_NSPR_10_SUPPORT */
1658  
1659  #include "prtypes.h"  /* which includes protypes.h */
1660 +#if !defined(__GNUC__)
1661 +#      define __unused
1662 +#endif
1663  
1664  int main(int argc, char **argv)
1665  {
1666 @@ -32,17 +35,17 @@ int main(int argc, char **argv)
1667       * Compilation fails if any of these integer types are not
1668       * defined by protypes.h.
1669       */
1670 -    intn in;
1671 -    uintn uin;
1672 -    uint ui;
1673 -    int8 i8;
1674 -    uint8 ui8;
1675 -    int16 i16;
1676 -    uint16 ui16;
1677 -    int32 i32;
1678 -    uint32 ui32;
1679 -    int64 i64;
1680 -    uint64 ui64;
1681 +    intn in __unused;
1682 +    uintn uin __unused;
1683 +    uint ui __unused;
1684 +    int8 i8 __unused;
1685 +    uint8 ui8 __unused;
1686 +    int16 i16 __unused;
1687 +    uint16 ui16 __unused;
1688 +    int32 i32 __unused;
1689 +    uint32 ui32 __unused;
1690 +    int64 i64 __unused;
1691 +    uint64 ui64 __unused;
1692  
1693      printf("PASS\n");
1694      return 0;
1695 --- pr/tests/parsetm.c.orig     2015-10-16 13:22:19 UTC
1696 +++ pr/tests/parsetm.c
1697 @@ -31,8 +31,8 @@ static void PrintExplodedTime(const PREx
1698  
1699      /* Print day of the week, month, day, hour, minute, and second */
1700      if (debug_mode) printf("%s %s %ld %02ld:%02ld:%02ld ",
1701 -           dayOfWeek[et->tm_wday], month[et->tm_month], et->tm_mday,
1702 -           et->tm_hour, et->tm_min, et->tm_sec);
1703 +           dayOfWeek[et->tm_wday], month[et->tm_month], (long)et->tm_mday,
1704 +           (long)et->tm_hour, (long)et->tm_min, (long)et->tm_sec);
1705  
1706      /* Print time zone */
1707      totalOffset = et->tm_params.tp_gmt_offset + et->tm_params.tp_dst_offset;
1708 @@ -47,7 +47,7 @@ static void PrintExplodedTime(const PREx
1709          hourOffset = totalOffset / 3600;
1710          minOffset = (totalOffset % 3600) / 60;
1711          if (debug_mode) 
1712 -            printf("%s%02ld%02ld ", sign, hourOffset, minOffset);
1713 +            printf("%s%02ld%02ld ", sign, (long)hourOffset, (long)minOffset);
1714      }
1715  
1716      /* Print year */
1717 --- pr/tests/peek.c.orig        2015-10-16 13:22:19 UTC
1718 +++ pr/tests/peek.c
1719 @@ -135,7 +135,7 @@ static void ClientNB(void *arg)
1720  {
1721      PRFileDesc *sock;
1722      PRSocketOptionData opt;
1723 -    PRUint16 port = (PRUint16) arg;
1724 +    PRUint16 port = (intptr_t) arg;
1725      PRNetAddr addr;
1726      char buf[BUFFER_SIZE];
1727      PRPollDesc pd;
1728 @@ -299,7 +299,7 @@ RunTest(PRThreadScope scope, PRFileDesc 
1729          exit(1);
1730      }
1731      client = PR_CreateThread(
1732 -            PR_USER_THREAD, ClientNB, (void *) port,
1733 +            PR_USER_THREAD, ClientNB, (void *)(intptr_t) port,
1734              PR_PRIORITY_NORMAL, scope, PR_JOINABLE_THREAD, 0);
1735      if (NULL == client) {
1736          fprintf(stderr, "PR_CreateThread failed\n");
1737 --- pr/tests/perf.c.orig        2015-10-16 13:22:19 UTC
1738 +++ pr/tests/perf.c
1739 @@ -141,7 +141,7 @@ static void PR_CALLBACK CXReader(void *a
1740      n = count / 2;
1741      for (i = 0; i < n; i++) {
1742      while (cxq == 0) {
1743 -            DPRINTF(("CXReader: thread = 0x%lx waiting\n",
1744 +            DPRINTF(("CXReader: thread = %p waiting\n",
1745                      PR_GetCurrentThread()));
1746          PR_Wait(mon, PR_INTERVAL_NO_TIMEOUT);
1747      }
1748 @@ -154,7 +154,7 @@ static void PR_CALLBACK CXReader(void *a
1749      --alive;
1750      PR_Notify(mon2);
1751      PR_ExitMonitor(mon2);
1752 -    DPRINTF(("CXReader: thread = 0x%lx exiting\n", PR_GetCurrentThread()));
1753 +    DPRINTF(("CXReader: thread = %p exiting\n", PR_GetCurrentThread()));
1754  }
1755  
1756  static void PR_CALLBACK CXWriter(void *arg)
1757 @@ -165,7 +165,7 @@ static void PR_CALLBACK CXWriter(void *a
1758      n = count / 2;
1759      for (i = 0; i < n; i++) {
1760      while (cxq == 1) {
1761 -            DPRINTF(("CXWriter: thread = 0x%lx waiting\n",
1762 +            DPRINTF(("CXWriter: thread = %p waiting\n",
1763                      PR_GetCurrentThread()));
1764          PR_Wait(mon, PR_INTERVAL_NO_TIMEOUT);
1765      }
1766 @@ -178,7 +178,7 @@ static void PR_CALLBACK CXWriter(void *a
1767      --alive;
1768      PR_Notify(mon2);
1769      PR_ExitMonitor(mon2);
1770 -    DPRINTF(("CXWriter: thread = 0x%lx exiting\n", PR_GetCurrentThread()));
1771 +    DPRINTF(("CXWriter: thread = %p exiting\n", PR_GetCurrentThread()));
1772  }
1773  
1774  static void ContextSwitch(PRThreadScope scope1, PRThreadScope scope2)
1775 @@ -198,7 +198,7 @@ static void ContextSwitch(PRThreadScope 
1776      if (NULL == t1) {
1777          fprintf(stderr, "ContextSwitch: cannot create thread\n");
1778      } else {
1779 -        DPRINTF(("ContextSwitch: created %s thread = 0x%lx\n",
1780 +        DPRINTF(("ContextSwitch: created %s thread = %p\n",
1781                  (scope1 == PR_GLOBAL_THREAD ?
1782                  "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD"),
1783                              t1));
1784 @@ -212,7 +212,7 @@ static void ContextSwitch(PRThreadScope 
1785      if (NULL == t2) {
1786          fprintf(stderr, "ContextSwitch: cannot create thread\n");
1787      } else {
1788 -        DPRINTF(("ContextSwitch: created %s thread = 0x%lx\n",
1789 +        DPRINTF(("ContextSwitch: created %s thread = %p\n",
1790                  (scope2 == PR_GLOBAL_THREAD ?
1791                  "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD"),
1792                              t2));
1793 @@ -254,10 +254,10 @@ static void PR_CALLBACK SemaThread(void 
1794  
1795      n = count / 2;
1796      for (i = 0; i < n; i++) {
1797 -        DPRINTF(("SemaThread: thread = 0x%lx waiting on sem = 0x%lx\n",
1798 +        DPRINTF(("SemaThread: thread = %p waiting on sem = %p\n",
1799                  PR_GetCurrentThread(), sem[0]));
1800          PR_WaitSem(sem[0]);
1801 -        DPRINTF(("SemaThread: thread = 0x%lx posting on sem = 0x%lx\n",
1802 +        DPRINTF(("SemaThread: thread = %p posting on sem = %p\n",
1803                  PR_GetCurrentThread(), sem[1]));
1804          PR_PostSem(sem[1]);
1805      }
1806 @@ -266,7 +266,7 @@ static void PR_CALLBACK SemaThread(void 
1807      --alive;
1808      PR_Notify(mon2);
1809      PR_ExitMonitor(mon2);
1810 -    DPRINTF(("SemaThread: thread = 0x%lx exiting\n", PR_GetCurrentThread()));
1811 +    DPRINTF(("SemaThread: thread = %p exiting\n", PR_GetCurrentThread()));
1812  }
1813  
1814  static  PRSemaphore *sem_set1[2];
1815 @@ -294,7 +294,7 @@ static void SemaContextSwitch(PRThreadSc
1816      if (NULL == t1) {
1817          fprintf(stderr, "SemaContextSwitch: cannot create thread\n");
1818      } else {
1819 -        DPRINTF(("SemaContextSwitch: created %s thread = 0x%lx\n",
1820 +        DPRINTF(("SemaContextSwitch: created %s thread = %p\n",
1821                  (scope1 == PR_GLOBAL_THREAD ?
1822                  "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD"),
1823                              t1));
1824 @@ -309,7 +309,7 @@ static void SemaContextSwitch(PRThreadSc
1825      if (NULL == t2) {
1826          fprintf(stderr, "SemaContextSwitch: cannot create thread\n");
1827      } else {
1828 -        DPRINTF(("SemaContextSwitch: created %s thread = 0x%lx\n",
1829 +        DPRINTF(("SemaContextSwitch: created %s thread = %p\n",
1830                  (scope2 == PR_GLOBAL_THREAD ?
1831                  "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD"),
1832                              t2));
1833 --- pr/tests/pipepong.c.orig    2015-10-16 13:22:19 UTC
1834 +++ pr/tests/pipepong.c
1835 @@ -36,7 +36,7 @@ int main(int argc, char **argv)
1836          nBytes = fread(buf, 1, 5, stdin);
1837          fprintf(stderr, "pong process: received \"%s\"\n", buf);
1838          if (nBytes != 5) {
1839 -            fprintf(stderr, "pong process: expected 5 bytes but got %d bytes\n",
1840 +            fprintf(stderr, "pong process: expected 5 bytes but got %zd bytes\n",
1841                      nBytes);
1842              exit(1);
1843          }
1844 --- pr/tests/poll_nm.c.orig     2015-10-16 13:22:19 UTC
1845 +++ pr/tests/poll_nm.c
1846 @@ -47,7 +47,7 @@ PRIntn debug_mode;
1847  static void PR_CALLBACK
1848  clientThreadFunc(void *arg)
1849  {
1850 -    PRUintn port = (PRUintn) arg;
1851 +    PRUintn port = (intptr_t) arg;
1852      PRFileDesc *sock;
1853      PRNetAddr addr;
1854      char buf[128];
1855 @@ -196,7 +196,7 @@ int main(int argc, char **argv)
1856      npds = 5;
1857  
1858      clientThread = PR_CreateThread(PR_USER_THREAD,
1859 -           clientThreadFunc, (void *) listenPort1,
1860 +           clientThreadFunc, (void *)(intptr_t)listenPort1,
1861             PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
1862             PR_UNJOINABLE_THREAD, 0);
1863      if (clientThread == NULL) {
1864 @@ -206,7 +206,7 @@ int main(int argc, char **argv)
1865      }
1866  
1867      clientThread = PR_CreateThread(PR_USER_THREAD,
1868 -           clientThreadFunc, (void *) listenPort2,
1869 +           clientThreadFunc, (void *)(intptr_t)listenPort2,
1870             PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
1871             PR_UNJOINABLE_THREAD, 0);
1872      if (clientThread == NULL) {
1873 --- pr/tests/prfz.c.orig        2015-10-16 13:22:19 UTC
1874 +++ pr/tests/prfz.c
1875 @@ -7,7 +7,7 @@
1876   */
1877  
1878  #include "prprf.h"
1879 -#include <sys/types.h>
1880 +#include <stdint.h>
1881  #include <limits.h>
1882  #include <string.h>
1883  
1884 --- pr/tests/provider.c.orig    2015-10-16 13:22:19 UTC
1885 +++ pr/tests/provider.c
1886 @@ -1049,7 +1049,7 @@ int main(int argc, char **argv)
1887  {
1888      PRUintn index;
1889      PRBool boolean;
1890 -    CSClient_t *client;
1891 +    CSClient_t *client = NULL;
1892      PRStatus rv, joinStatus;
1893      CSServer_t *server = NULL;
1894         char *thread_type;
1895 --- pr/tests/prpoll.c.orig      2015-10-16 13:22:19 UTC
1896 +++ pr/tests/prpoll.c
1897 @@ -39,7 +39,7 @@ int main(int argc, char **argv)
1898  static void
1899  clientThreadFunc(void *arg)
1900  {
1901 -    PRUint16 port = (PRUint16) arg;
1902 +    PRUint16 port = (PRUint16)(uintptr_t)arg;
1903      PRFileDesc *sock;
1904      PRNetAddr addr;
1905      char buf[BUF_SIZE];
1906 @@ -73,7 +73,7 @@ int main(int argc, char **argv)
1907      PRInt32 rv;
1908      PROsfd sd;
1909      struct sockaddr_in saddr;
1910 -    PRIntn saddr_len;
1911 +    socklen_t saddr_len;
1912      PRUint16 listenPort3;
1913      PRFileDesc *socket_poll_fd;
1914      PRIntn i, j;
1915 @@ -199,7 +199,7 @@ int main(int argc, char **argv)
1916      npds--;
1917  
1918      clientThread = PR_CreateThread(PR_USER_THREAD,
1919 -           clientThreadFunc, (void *) listenPort1,
1920 +           clientThreadFunc, (void *)(uintptr_t)listenPort1,
1921             PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
1922             PR_UNJOINABLE_THREAD, 0);
1923      if (clientThread == NULL) {
1924 @@ -208,7 +208,7 @@ int main(int argc, char **argv)
1925      }
1926  
1927      clientThread = PR_CreateThread(PR_USER_THREAD,
1928 -           clientThreadFunc, (void *) listenPort2,
1929 +           clientThreadFunc, (void *)(uintptr_t)listenPort2,
1930             PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
1931             PR_UNJOINABLE_THREAD, 0);
1932      if (clientThread == NULL) {
1933 @@ -217,7 +217,7 @@ int main(int argc, char **argv)
1934      }
1935  
1936      clientThread = PR_CreateThread(PR_USER_THREAD,
1937 -           clientThreadFunc, (void *) listenPort3,
1938 +           clientThreadFunc, (void *)(uintptr_t)listenPort3,
1939             PR_PRIORITY_NORMAL, PR_GLOBAL_BOUND_THREAD,
1940             PR_UNJOINABLE_THREAD, 0);
1941      if (clientThread == NULL) {
1942 --- pr/tests/randseed.c.orig    2015-10-16 13:22:19 UTC
1943 +++ pr/tests/randseed.c
1944 @@ -48,7 +48,6 @@ static void Help( void )
1945  static void PrintRand( void *buf, PRIntn size )
1946  {
1947      PRUint32 *rp = buf;
1948 -    PRIntn   i;
1949  
1950      printf("%4.4d--\n", size );
1951      while (size > 0 ) {
1952 --- pr/tests/ranfile.c.orig     2015-10-16 13:22:19 UTC
1953 +++ pr/tests/ranfile.c
1954 @@ -130,7 +130,7 @@ static void PR_CALLBACK Thread(void *arg
1955      PRStatus rv = PR_SUCCESS;
1956      Hammer_t *cd = (Hammer_t*)arg;
1957  
1958 -    (void)sprintf(filename, "%ssg%04ld.dat", baseName, cd->id);
1959 +    (void)sprintf(filename, "%ssg%04d.dat", baseName, (int)cd->id);
1960  
1961      if (debug_mode) printf("Starting work on %s\n", filename);
1962  
1963 @@ -364,14 +364,14 @@ int main(int argc, char **argv)
1964                  }
1965                  else
1966                      if (debug_mode) printf(
1967 -                        "%s: test failed %s after %ld seconds\n",
1968 -                        programName, where[hammer[poll].problem], duration);
1969 +                        "%s: test failed %s after %d seconds\n",
1970 +                        programName, where[hammer[poll].problem], (int)duration);
1971                                         else failed_already=1;
1972              }
1973          }
1974      }
1975      if (debug_mode) printf(
1976 -        "%s: [%ld [%ld] %ld] writes/sec average\n",
1977 +        "%s: [%d [%d] %d] writes/sec average\n",
1978          programName, writesMin, writesTot * 1000 / durationTot, writesMax);
1979  
1980      PR_DestroyCondVar(cv);
1981 --- pr/tests/runtests.sh.orig   2015-10-16 13:22:19 UTC
1982 +++ pr/tests/runtests.sh
1983 @@ -58,9 +58,6 @@ fi
1984  # Tests not run (but should)
1985  #
1986  
1987 -#forktest (failed on IRIX)
1988 -#nbconn - fails on some platforms 
1989 -#poll_er - fails on some platforms? limited use?
1990  #prpoll -  the bad-FD test needs to be moved to a different test
1991  #sleep -  specific to OS/2
1992  
1993 @@ -92,6 +89,7 @@ exit
1994  fdcach
1995  fileio
1996  foreign
1997 +forktest
1998  formattm
1999  fsync
2000  gethost
2001 @@ -99,7 +97,6 @@ getproto
2002  i2l
2003  initclk
2004  inrval
2005 -instrumt
2006  intrio
2007  intrupt
2008  io_timeout
2009 @@ -120,6 +117,7 @@ logger
2010  many_cv
2011  multiwait
2012  nameshm1
2013 +nbconn
2014  nblayer
2015  nonblock
2016  ntioto
2017 @@ -136,6 +134,7 @@ perf
2018  pipeping
2019  pipeping2
2020  pipeself
2021 +poll_er
2022  poll_nm
2023  poll_to
2024  pollable
2025 @@ -208,7 +207,7 @@ OBJDIR=`basename $PWD`
2026  printf "\nNSPR Test Results - $OBJDIR\n\n"
2027  printf "BEGIN\t\t\t`date`\n"
2028  printf "NSPR_TEST_LOGFILE\t${LOGFILE}\n\n"
2029 -printf "Test\t\t\tResult\n\n"
2030 +printf "            Test\t\t\tResult\n\n"
2031  if [ $OS_PLATFORM = "Windows_95" ] || [ $OS_PLATFORM = "Windows_98" ] || [ $OS_PLATFORM = "Windows_NT" ] || [ $OS_PLATFORM = "OS/2" ] ; then
2032         for prog in $TESTS
2033         do
2034 @@ -226,10 +225,8 @@ if [ $OS_PLATFORM = "Windows_95" ] || [ 
2035  else
2036         for prog in $TESTS
2037         do
2038 -               printf "$prog"
2039 -               printf "\nBEGIN TEST: $prog\n\n" >> ${LOGFILE} 2>&1
2040 -               export test_rval
2041 -               ./$prog >> ${LOGFILE} 2>&1 &
2042 +               printf %16s $prog
2043 +               ./$prog >> $prog.output 2>&1 &
2044                 test_pid=$!
2045                 sleep_pid=0
2046                 if test -n "$TEST_TIMEOUT" && test "$TEST_TIMEOUT" -gt 0
2047 @@ -244,28 +241,11 @@ else
2048                         printf "\t\t\tPassed\n";
2049                 else
2050                         printf "\t\t\tFAILED\n";
2051 +                       sed "s,^,       $prog:  ," < $prog.output
2052                         rval=1
2053                 fi;
2054 -               printf "\nEND TEST: $prog\n\n" >> ${LOGFILE} 2>&1
2055         done
2056  fi;
2057  
2058  printf "END\t\t\t`date`\n"
2059  exit $rval
2060 -
2061 -
2062 -
2063 -
2064 -
2065 -
2066 -
2067 -
2068 -
2069 -
2070 -
2071 -
2072 -
2073 -
2074 -
2075 -
2076 -
2077 --- pr/tests/sel_spd.c.orig     2015-10-16 13:22:19 UTC
2078 +++ pr/tests/sel_spd.c
2079 @@ -15,6 +15,9 @@
2080  #include <stdio.h>
2081  #include <errno.h>
2082  #include <string.h>
2083 +#if defined(XP_UNIX) || defined(XP_OS2_EMX)
2084 +#      include <unistd.h>      /* getopt(3) */
2085 +#endif
2086  #ifdef SYMBIAN
2087  #include <getopt.h>
2088  #endif
2089 @@ -22,16 +25,16 @@
2090  #define PORT_BASE 19000
2091  
2092  typedef struct timer_slot_t {
2093 -       unsigned long d_connect;
2094 -       unsigned long d_cl_data;
2095 -       unsigned long d_sv_data;
2096 -       unsigned long d_close;
2097 -       unsigned long d_total;
2098 -       unsigned long requests;
2099 +       unsigned int d_connect;
2100 +       unsigned int d_cl_data;
2101 +       unsigned int d_sv_data;
2102 +       unsigned int d_close;
2103 +       unsigned int d_total;
2104 +       unsigned int requests;
2105  } timer_slot_t;
2106  
2107 -static long _iterations = 5;
2108 -static long _client_data = 8192;
2109 +static int _iterations = 5;
2110 +static int _client_data = 8192;
2111  
2112  #ifdef SYMBIAN
2113  /*
2114 @@ -40,12 +43,11 @@ static long _client_data = 8192;
2115   * memory and not be able to allocate thread stack or client/server data
2116   * buffer.
2117   */
2118 -static long _server_data = (8*1024);
2119 -static long _threads_max = 10, _threads = 10;
2120 +static int _server_data = (8*1024);
2121  #else
2122 -static long _server_data = (128*1024);
2123 -static long _threads_max = 10, _threads = 10;
2124 +static int _server_data = (128*1024);
2125  #endif
2126 +static int _threads_max = 10, _threads = 10;
2127  
2128  static int verbose=0;
2129  static PRMonitor *exit_cv;
2130 @@ -101,7 +103,7 @@ _server_thread(void *arg_id)
2131         void _client_thread(void *);
2132         PRThread *thread;
2133         int *id =  (int *)arg_id;
2134 -       PRFileDesc *sock;
2135 +       PRFileDesc *sock = NULL;
2136         PRSocketOptionData sockopt;
2137         PRNetAddr sa;
2138         PRFileDesc * newsock;
2139 @@ -469,12 +471,12 @@ void
2140  tally_results(int verbose)
2141  {
2142         int index;
2143 -       unsigned long tot_connect = 0;
2144 -       unsigned long tot_cl_data = 0;
2145 -       unsigned long tot_sv_data = 0;
2146 -       unsigned long tot_close = 0;
2147 -       unsigned long tot_all = 0;
2148 -       unsigned long tot_requests = 0;
2149 +       unsigned int tot_connect = 0;
2150 +       unsigned int tot_cl_data = 0;
2151 +       unsigned int tot_sv_data = 0;
2152 +       unsigned int tot_close = 0;
2153 +       unsigned int tot_all = 0;
2154 +       unsigned int tot_requests = 0;
2155  
2156         fprintf(stdout, "Server results:\n\n");
2157         for (index=0; index<_threads_max*2; index+=2) {
2158 --- pr/tests/selct_nm.c.orig    2015-10-16 13:22:19 UTC
2159 +++ pr/tests/selct_nm.c
2160 @@ -45,7 +45,7 @@ PRIntn debug_mode;
2161  static void
2162  clientThreadFunc(void *arg)
2163  {
2164 -    PRUintn port = (PRUintn) arg;
2165 +    PRUintn port = (PRUintn)(uintptr_t)arg;
2166      PRFileDesc *sock;
2167      PRNetAddr addr;
2168      char buf[128];
2169 @@ -165,7 +165,7 @@ failed_already=1;
2170      if (debug_mode) printf("%s", buf);
2171  
2172      clientThread = PR_CreateThread(PR_USER_THREAD,
2173 -           clientThreadFunc, (void *) listenPort1,
2174 +           clientThreadFunc, (void *)(uintptr_t)listenPort1,
2175             PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
2176             PR_UNJOINABLE_THREAD, 0);
2177      if (clientThread == NULL) {
2178 @@ -175,7 +175,7 @@ failed_already=1;
2179      }
2180  
2181      clientThread = PR_CreateThread(PR_USER_THREAD,
2182 -           clientThreadFunc, (void *) listenPort2,
2183 +           clientThreadFunc, (void *)(uintptr_t)listenPort2,
2184             PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
2185             PR_UNJOINABLE_THREAD, 0);
2186      if (clientThread == NULL) {
2187 --- pr/tests/select2.c.orig     2015-10-16 13:22:19 UTC
2188 +++ pr/tests/select2.c
2189 @@ -53,6 +53,7 @@ PRInt32 count;
2190  **      
2191  ***********************************************************************/
2192  
2193 +static int exitcode = 2;
2194  
2195  static void Test_Result (int result)
2196  {
2197 @@ -60,9 +61,12 @@ static void Test_Result (int result)
2198         {
2199                 case PASS:
2200                         printf ("PASS\n");
2201 +                       if (exitcode == 2)
2202 +                               exitcode = 0;
2203                         break;
2204                 case FAIL:
2205                         printf ("FAIL\n");
2206 +                       exitcode = 1;
2207                         break;
2208                 default:
2209                         printf ("NOSTATUS\n");
2210 @@ -319,4 +323,5 @@ int main(int argc, char **argv)
2211      PR_Cleanup();
2212  
2213  
2214 +    return exitcode;
2215  }
2216 --- pr/tests/semaerr.c.orig     2015-10-16 13:22:19 UTC
2217 +++ pr/tests/semaerr.c
2218 @@ -65,7 +65,7 @@ int main(int argc, char **argv)
2219          exit(1);
2220      }
2221      if (PR_GetError() != PR_FILE_NOT_FOUND_ERROR) {
2222 -        fprintf(stderr, "Expected error is %d but got (%d, %d)\n",
2223 +        fprintf(stderr, "Expected error is %ld (PR_FILE_NOT_FOUND_ERROR) but got (%d, %d)\n",
2224                  PR_FILE_NOT_FOUND_ERROR, PR_GetError(), PR_GetOSError());
2225          exit(1);
2226      }
2227 --- pr/tests/semaerr1.c.orig    2015-10-16 13:22:19 UTC
2228 +++ pr/tests/semaerr1.c
2229 @@ -75,7 +75,7 @@ int main(int argc, char **argv)
2230          exit(1);
2231      }
2232      if (PR_GetError() != PR_FILE_EXISTS_ERROR) {
2233 -        fprintf(stderr, "Expect %d but got %d\n", PR_FILE_EXISTS_ERROR,
2234 +        fprintf(stderr, "Expected %ld (PR_FILE_EXISTS_ERROR) but got %d\n", PR_FILE_EXISTS_ERROR,
2235                  PR_GetError());
2236          exit(1);
2237      }
2238 --- pr/tests/sendzlf.c.orig     2015-10-16 13:22:19 UTC
2239 +++ pr/tests/sendzlf.c
2240 @@ -26,7 +26,7 @@ static void ClientThread(void *arg)
2241  {
2242      PRFileDesc *sock;
2243      PRNetAddr addr;
2244 -    PRUint16 port = (PRUint16) arg;
2245 +    PRUint16 port = (PRUint16)(uintptr_t)arg;
2246      char buf[1024];
2247      char *bufPtr;
2248      PRInt32 nbytes;
2249 @@ -184,7 +184,7 @@ int main(int argc, char **argv)
2250      }
2251  
2252      clientThread = PR_CreateThread(PR_USER_THREAD,
2253 -            ClientThread, (void *) PR_ntohs(PR_NetAddrInetPort(&addr)),
2254 +            ClientThread, (void *)(uintptr_t)PR_ntohs(PR_NetAddrInetPort(&addr)),
2255              PR_PRIORITY_NORMAL, scope, PR_JOINABLE_THREAD, 0);
2256      if (NULL == clientThread) {
2257          fprintf(stderr, "PR_CreateThread failed\n");
2258 --- pr/tests/server_test.c.orig 2015-10-16 13:22:19 UTC
2259 +++ pr/tests/server_test.c
2260 @@ -60,7 +60,7 @@ PRCondVar *ServerStateCV;
2261  #ifdef DEBUGPRINTS
2262  #define DPRINTF printf
2263  #else
2264 -#define DPRINTF
2265 +#define DPRINTF(...)
2266  #endif
2267  
2268  
2269 @@ -502,6 +502,7 @@ static void do_workUU(void)
2270      do_work();
2271  }
2272  
2273 +#if 0
2274  static void do_workUK(void)
2275  {
2276      ServerScope = PR_LOCAL_THREAD;
2277 @@ -522,6 +523,7 @@ static void do_workKK(void)
2278      ClientScope = PR_GLOBAL_THREAD;
2279      do_work();
2280  }
2281 +#endif
2282  
2283  
2284  static void Measure(void (*func)(void), const char *msg)
2285 --- pr/tests/servr_kk.c.orig    2015-10-16 13:22:19 UTC
2286 +++ pr/tests/servr_kk.c
2287 @@ -57,7 +57,7 @@ PRCondVar *ServerStateCV;
2288  #ifdef DEBUGPRINTS
2289  #define DPRINTF printf
2290  #else
2291 -#define DPRINTF
2292 +#define DPRINTF(...)
2293  #endif
2294  
2295  PRIntn failed_already=0;
2296 @@ -472,6 +472,7 @@ void do_work()
2297      PR_JoinThread(ServerThread);
2298  }
2299  
2300 +#if 0
2301  static void do_workUU(void)
2302  {
2303      ServerScope = PR_LOCAL_THREAD;
2304 @@ -492,6 +493,7 @@ static void do_workKU(void)
2305      ClientScope = PR_LOCAL_THREAD;
2306      do_work();
2307  }
2308 +#endif
2309  
2310  static void do_workKK(void)
2311  {
2312 --- pr/tests/servr_ku.c.orig    2015-10-16 13:22:19 UTC
2313 +++ pr/tests/servr_ku.c
2314 @@ -57,7 +57,7 @@ PRCondVar *ServerStateCV;
2315  #ifdef DEBUGPRINTS
2316  #define DPRINTF printf
2317  #else
2318 -#define DPRINTF
2319 +#define DPRINTF(...)
2320  #endif
2321  
2322  PRIntn failed_already=0;
2323 --- pr/tests/servr_uk.c.orig    2015-10-16 13:22:19 UTC
2324 +++ pr/tests/servr_uk.c
2325 @@ -57,7 +57,7 @@ PRCondVar *ServerStateCV;
2326  #ifdef DEBUGPRINTS
2327  #define DPRINTF printf
2328  #else
2329 -#define DPRINTF
2330 +#define DPRINTF(...)
2331  #endif
2332  
2333  PRIntn failed_already=0;
2334 --- pr/tests/servr_uu.c.orig    2015-10-16 13:22:19 UTC
2335 +++ pr/tests/servr_uu.c
2336 @@ -57,7 +57,7 @@ PRCondVar *ServerStateCV;
2337  #ifdef DEBUGPRINTS
2338  #define DPRINTF printf
2339  #else
2340 -#define DPRINTF
2341 +#define DPRINTF(...)
2342  #endif
2343  
2344  PRIntn failed_already=0;
2345 --- pr/tests/short_thread.c.orig        2015-10-16 13:22:19 UTC
2346 +++ pr/tests/short_thread.c
2347 @@ -43,8 +43,8 @@ int main (int argc, char **argv)
2348                                                  PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0)) 
2349                                                                                                                                                 == NULL ) {
2350                 fprintf(stderr,
2351 -                       "simple_test: Error - PR_CreateThread failed: (%ld, %ld)\n",
2352 -                                                                         PR_GetError(), PR_GetOSError());
2353 +                       "simple_test: Error - PR_CreateThread failed: (%d, %d)\n",
2354 +                                                 PR_GetError(), PR_GetOSError());
2355                 exit( 1 );
2356         }
2357         PR_Cleanup();
2358 --- pr/tests/socket.c.orig      2015-10-16 13:22:19 UTC
2359 +++ pr/tests/socket.c
2360 @@ -103,13 +103,15 @@ char *LARGE_FILE_NAME = "/tmp/prsocket_t
2361  #endif
2362  
2363  static PRInt32 num_tcp_clients = NUM_TCP_CLIENTS;
2364 -static PRInt32 num_udp_clients = NUM_UDP_CLIENTS;
2365  static PRInt32 num_transmitfile_clients = NUM_TRANSMITFILE_CLIENTS;
2366  static PRInt32 num_tcp_connections_per_client = NUM_TCP_CONNECTIONS_PER_CLIENT;
2367  static PRInt32 tcp_mesg_size = TCP_MESG_SIZE;
2368  static PRInt32 num_tcp_mesgs_per_connection = NUM_TCP_MESGS_PER_CONNECTION;
2369 +#if defined(SYMBIAN) && !defined(__WINSCW__)
2370 +static PRInt32 num_udp_clients = NUM_UDP_CLIENTS;
2371  static PRInt32 num_udp_datagrams_per_client = NUM_UDP_DATAGRAMS_PER_CLIENT;
2372  static PRInt32 udp_datagram_size = UDP_DGRAM_SIZE;
2373 +#endif
2374  
2375  static PRInt32 thread_count;
2376  PRUint16 server_domain = PR_AF_INET, client_domain = PR_AF_INET;
2377 @@ -181,19 +183,23 @@ readn(PRFileDesc *sockfd, char *buf, int
2378      int rem;
2379      int bytes;
2380      int offset = 0;
2381 +#ifdef WINNT
2382         int err;
2383 +#endif
2384         PRIntervalTime timeout = PR_INTERVAL_NO_TIMEOUT;
2385  
2386         if (test_cancelio)
2387                 timeout = PR_SecondsToInterval(2);
2388  
2389      for (rem=len; rem; offset += bytes, rem -= bytes) {
2390 -        DPRINTF(("thread = 0x%lx: calling PR_Recv, bytes = %d\n",
2391 +        DPRINTF(("thread = %p: calling PR_Recv, bytes = %d\n",
2392              PR_GetCurrentThread(), rem));
2393 +#ifdef WINNT
2394  retry:
2395 +#endif
2396          bytes = PR_Recv(sockfd, buf + offset, rem, 0,
2397                 timeout);
2398 -        DPRINTF(("thread = 0x%lx: returning from PR_Recv, bytes = %d\n",
2399 +        DPRINTF(("thread = %p: returning from PR_Recv, bytes = %d\n",
2400              PR_GetCurrentThread(), bytes));
2401          if (bytes < 0) {
2402  #ifdef WINNT
2403 @@ -224,11 +230,11 @@ writen(PRFileDesc *sockfd, char *buf, in
2404      int offset = 0;
2405  
2406      for (rem=len; rem; offset += bytes, rem -= bytes) {
2407 -        DPRINTF(("thread = 0x%lx: calling PR_Send, bytes = %d\n",
2408 +        DPRINTF(("thread = %p: calling PR_Send, bytes = %d\n",
2409              PR_GetCurrentThread(), rem));
2410          bytes = PR_Send(sockfd, buf + offset, rem, 0,
2411              PR_INTERVAL_NO_TIMEOUT);
2412 -        DPRINTF(("thread = 0x%lx: returning from PR_Send, bytes = %d\n",
2413 +        DPRINTF(("thread = %p: returning from PR_Send, bytes = %d\n",
2414              PR_GetCurrentThread(), bytes));
2415          if (bytes <= 0)
2416              return -1;
2417 @@ -279,7 +285,7 @@ Serve_Client(void *arg)
2418                  fprintf(stderr,"prsocket_test: ERROR - PR_Shutdown\n");
2419              }
2420  #endif
2421 -        DPRINTF(("Serve_Client [0x%lx]: inbuf[0] = 0x%lx\n",PR_GetCurrentThread(),
2422 +        DPRINTF(("Serve_Client [%p]: inbuf[0] = %d\n",PR_GetCurrentThread(),
2423              (*((int *) in_buf->data))));
2424          if (writen(sockfd, in_buf->data, bytes) < bytes) {
2425              fprintf(stderr,"prsocket_test: ERROR - Serve_Client:writen\n");
2426 @@ -418,7 +424,7 @@ TCP_Server(void *arg)
2427          goto exit;
2428      }
2429  
2430 -    DPRINTF(("TCP_Server: PR_BIND netaddr.inet.ip = 0x%lx, netaddr.inet.port = %d\n",
2431 +    DPRINTF(("TCP_Server: PR_BIND netaddr.inet.ip = 0x%x, netaddr.inet.port = %d\n",
2432          netaddr.inet.ip, netaddr.inet.port));
2433         if (PR_SetNetAddr(PR_IpAddrLoopback, client_domain,
2434                                                                         PR_ntohs(PR_NetAddrInetPort(&netaddr)),
2435 @@ -460,7 +466,7 @@ TCP_Server(void *arg)
2436          scp->datalen = sp->datalen;
2437  
2438          t = create_new_thread(PR_USER_THREAD,
2439 -            Serve_Client, (void *)scp, 
2440 +            Serve_Client, (void *)scp,
2441              PR_PRIORITY_NORMAL,
2442              PR_LOCAL_THREAD,
2443              PR_UNJOINABLE_THREAD,
2444 @@ -470,7 +476,7 @@ TCP_Server(void *arg)
2445              failed_already=1;
2446              goto exit;
2447          }
2448 -        DPRINTF(("TCP_Server: Created Serve_Client = 0x%lx\n", t));
2449 +        DPRINTF(("TCP_Server: Created Serve_Client = %p\n", t));
2450      }
2451  
2452  exit:
2453 @@ -486,9 +492,10 @@ exit:
2454      --(*sp->exit_counter);
2455      PR_Notify(sp->exit_mon);
2456      PR_ExitMonitor(sp->exit_mon);
2457 -    DPRINTF(("TCP_Server [0x%lx] exiting\n", PR_GetCurrentThread()));
2458 +    DPRINTF(("TCP_Server [%p] exiting\n", PR_GetCurrentThread()));
2459  }
2460  
2461 +#if defined(SYMBIAN) && !defined(__WINSCW__)
2462  /*
2463   * UDP Server
2464   *    Server Thread
2465 @@ -544,7 +551,7 @@ UDP_Server(void *arg)
2466          return;
2467      }
2468  
2469 -    DPRINTF(("PR_Bind: UDP Server netaddr.inet.ip = 0x%lx, netaddr.inet.port = %d\n",
2470 +    DPRINTF(("PR_Bind: UDP Server netaddr.inet.ip = 0x%x, netaddr.inet.port = %d\n",
2471          netaddr.inet.ip, netaddr.inet.port));
2472      /*
2473       * We can't use the IP address returned by PR_GetSockName in
2474 @@ -582,13 +589,13 @@ UDP_Server(void *arg)
2475       */
2476      memset(&netaddr, 0 , sizeof(netaddr));
2477      for (i = 0; i < (num_udp_clients * num_udp_datagrams_per_client); i++) {
2478 -        DPRINTF(("UDP_Server: calling PR_RecvFrom client  - ip = 0x%lx, port = %d bytes = %d inbuf = 0x%lx, inbuf[0] = 0x%lx\n",
2479 +        DPRINTF(("UDP_Server: calling PR_RecvFrom client  - ip = 0x%x, port = %d bytes = %d inbuf = %p, inbuf[0] = 0x%x\n",
2480              netaddr.inet.ip, netaddr.inet.port, bytes, in_buf->data,
2481              in_buf->data[0]));
2482  
2483          rv = PR_RecvFrom(sockfd, in_buf->data, bytes, 0, &netaddr,
2484              PR_INTERVAL_NO_TIMEOUT);
2485 -        DPRINTF(("UDP_Server: PR_RecvFrom client  - ip = 0x%lx, port = %d bytes = %d inbuf = 0x%lx, inbuf[0] = 0x%lx\n",
2486 +        DPRINTF(("UDP_Server: PR_RecvFrom client  - ip = 0x%x, port = %d bytes = %d inbuf = %p, inbuf[0] = 0x%x\n",
2487              netaddr.inet.ip, netaddr.inet.port, rv, in_buf->data,
2488              in_buf->data[0]));
2489          if (rv != bytes) {
2490 @@ -611,8 +618,9 @@ UDP_Server(void *arg)
2491      --(*sp->exit_counter);
2492      PR_Notify(sp->exit_mon);
2493      PR_ExitMonitor(sp->exit_mon);
2494 -    DPRINTF(("UDP_Server [0x%x] exiting\n", PR_GetCurrentThread()));
2495 +    DPRINTF(("UDP_Server [%p] exiting\n", PR_GetCurrentThread()));
2496  }
2497 +#endif /* defined(SYMBIAN) && !defined(__WINSCW__) */
2498  
2499  /*
2500   * TCP_Client
2501 @@ -655,7 +663,7 @@ TCP_Client(void *arg)
2502          }
2503          if (PR_Connect(sockfd, &netaddr,PR_INTERVAL_NO_TIMEOUT) < 0){
2504                 fprintf(stderr, "PR_Connect failed: (%ld, %ld)\n",
2505 -                       PR_GetError(), PR_GetOSError());
2506 +                       (long)PR_GetError(), (long)PR_GetOSError());
2507              failed_already=1;
2508              return;
2509          }
2510 @@ -663,7 +671,7 @@ TCP_Client(void *arg)
2511              /*
2512               * fill in random data
2513               */
2514 -            memset(out_buf->data, ((PRInt32) (&netaddr)) + i + j, bytes);
2515 +            memset(out_buf->data, ((intptr_t)(&netaddr)) + i + j, bytes);
2516              /*
2517               * write to server
2518               */
2519 @@ -676,7 +684,7 @@ TCP_Client(void *arg)
2520                  failed_already=1;
2521                  return;
2522              }
2523 -            DPRINTF(("TCP Client [0x%lx]: out_buf = 0x%lx out_buf[0] = 0x%lx\n",
2524 +            DPRINTF(("TCP Client [%p]: out_buf = %p out_buf[0] = 0x%x\n",
2525                  PR_GetCurrentThread(), out_buf, (*((int *) out_buf->data))));
2526              if (readn(sockfd, in_buf->data, bytes) < bytes) {
2527                  fprintf(stderr,"prsocket_test: ERROR - TCP_Client:readn\n");
2528 @@ -716,13 +724,14 @@ TCP_Client(void *arg)
2529      --(*cp->exit_counter);
2530      PR_Notify(cp->exit_mon);
2531      PR_ExitMonitor(cp->exit_mon);
2532 -    DPRINTF(("TCP_Client [0x%x] exiting\n", PR_GetCurrentThread()));
2533 +    DPRINTF(("TCP_Client [%p] exiting\n", PR_GetCurrentThread()));
2534  }
2535  
2536 +#if defined(SYMBIAN) && !defined(__WINSCW__)
2537  /*
2538   * UDP_Client
2539   *    Client Thread
2540 - *    Create a socket and bind an address 
2541 + *    Create a socket and bind an address
2542   *    Communicate with the server at the address specified in the argument.
2543   *    Fill in a buffer, write data to server, read it back and check
2544   *    for data corruption.
2545 @@ -780,7 +789,7 @@ UDP_Client(void *arg)
2546          return;
2547      }
2548  
2549 -    DPRINTF(("PR_Bind: UDP Client netaddr.inet.ip = 0x%lx, netaddr.inet.port = %d\n",
2550 +    DPRINTF(("PR_Bind: UDP Client netaddr.inet.ip = 0x%x, netaddr.inet.port = %d\n",
2551          netaddr.inet.ip, netaddr.inet.port));
2552  
2553      netaddr = cp->server_addr;
2554 @@ -797,9 +806,9 @@ UDP_Client(void *arg)
2555          /*
2556           * fill in random data
2557           */
2558 -        DPRINTF(("UDP_Client [0x%lx]: out_buf = 0x%lx bytes = 0x%lx\n",
2559 +        DPRINTF(("UDP_Client [%p]: out_buf = %p bytes = %d\n",
2560              PR_GetCurrentThread(), out_buf->data, bytes));
2561 -        memset(out_buf->data, ((PRInt32) (&netaddr)) + i, bytes);
2562 +        memset(out_buf->data, ((intptr_t)(&netaddr)) + i, bytes);
2563          /*
2564           * write to server
2565           */
2566 @@ -812,7 +821,7 @@ UDP_Client(void *arg)
2567          if (rv != bytes) {
2568              return;
2569          }
2570 -        DPRINTF(("UDP_Client [0x%lx]: out_buf = 0x%lx out_buf[0] = 0x%lx\n",
2571 +        DPRINTF(("UDP_Client [%p]: out_buf = %p out_buf[0] = 0x%x\n",
2572              PR_GetCurrentThread(), out_buf, (*((int *) out_buf->data))));
2573          if (cp->udp_connect)
2574              rv = PR_Recv(sockfd, in_buf->data, bytes, 0,
2575 @@ -823,7 +832,7 @@ UDP_Client(void *arg)
2576          if (rv != bytes) {
2577              return;
2578          }
2579 -        DPRINTF(("UDP_Client [0x%lx]: in_buf = 0x%lx in_buf[0] = 0x%lx\n",
2580 +        DPRINTF(("UDP_Client [%p]: in_buf = %p in_buf[0] = 0x%x\n",
2581              PR_GetCurrentThread(), in_buf, (*((int *) in_buf->data))));
2582          /*
2583           * verify the data read
2584 @@ -848,12 +857,13 @@ UDP_Client(void *arg)
2585      PR_Notify(cp->exit_mon);
2586      PR_ExitMonitor(cp->exit_mon);
2587      PR_DELETE(cp);
2588 -    DPRINTF(("UDP_Client [0x%x] exiting\n", PR_GetCurrentThread()));
2589 +    DPRINTF(("UDP_Client [%p] exiting\n", PR_GetCurrentThread()));
2590  }
2591 +#endif /* defined(SYMBIAN) && !defined(__WINSCW__) */
2592  
2593  /*
2594   * TCP_Socket_Client_Server_Test    - concurrent server test
2595 - *    
2596 + *
2597   *    One server and several clients are started
2598   *    Each client connects to the server and sends a chunk of data
2599   *    For each connection, server starts another thread to read the data
2600 @@ -905,7 +915,7 @@ TCP_Socket_Client_Server_Test(void)
2601      sparamp->exit_counter = &thread_count;
2602      sparamp->datalen = datalen;
2603      t = PR_CreateThread(PR_USER_THREAD,
2604 -        TCP_Server, (void *)sparamp, 
2605 +        TCP_Server, (void *)sparamp,
2606          PR_PRIORITY_NORMAL,
2607          PR_LOCAL_THREAD,
2608          PR_UNJOINABLE_THREAD,
2609 @@ -915,7 +925,7 @@ TCP_Socket_Client_Server_Test(void)
2610          failed_already=1;
2611          return -1;
2612      }
2613 -    DPRINTF(("Created TCP server = 0x%lx\n", t));
2614 +    DPRINTF(("Created TCP server = %p\n", t));
2615      thread_count++;
2616  
2617      /*
2618 @@ -949,7 +959,7 @@ TCP_Socket_Client_Server_Test(void)
2619              failed_already=1;
2620              return -1;
2621          }
2622 -        DPRINTF(("Created TCP client = 0x%lx\n", t));
2623 +        DPRINTF(("Created TCP client = %p\n", t));
2624          thread_count++;
2625      }
2626      /* Wait for server and client threads to exit */
2627 @@ -959,17 +969,18 @@ TCP_Socket_Client_Server_Test(void)
2628      }
2629      PR_ExitMonitor(mon2);
2630      printf("%30s","TCP_Socket_Client_Server_Test:");
2631 -    printf("%2ld Server %2ld Clients %2ld connections_per_client\n",1l,
2632 +    printf(" 1 Server %2d Clients %2d connections_per_client\n",
2633          num_tcp_clients, num_tcp_connections_per_client);
2634 -    printf("%30s %2ld messages_per_connection %4ld bytes_per_message\n",":",
2635 +    printf("%30s %2d messages_per_connection %4d bytes_per_message\n",":",
2636          num_tcp_mesgs_per_connection, tcp_mesg_size);
2637  
2638      return 0;
2639  }
2640  
2641 +#if defined(SYMBIAN) && !defined(__WINSCW__)
2642  /*
2643   * UDP_Socket_Client_Server_Test    - iterative server test
2644 - *    
2645 + *
2646   *    One server and several clients are started
2647   *    Each client connects to the server and sends a chunk of data
2648   *    For each connection, server starts another thread to read the data
2649 @@ -1023,7 +1034,7 @@ UDP_Socket_Client_Server_Test(void)
2650      sparamp->datalen = datalen;
2651      DPRINTF(("Creating UDP server"));
2652      t = PR_CreateThread(PR_USER_THREAD,
2653 -        UDP_Server, (void *)sparamp, 
2654 +        UDP_Server, (void *)sparamp,
2655          PR_PRIORITY_NORMAL,
2656          PR_LOCAL_THREAD,
2657          PR_UNJOINABLE_THREAD,
2658 @@ -1084,12 +1095,13 @@ UDP_Socket_Client_Server_Test(void)
2659      }
2660      PR_ExitMonitor(mon2);
2661      printf("%30s","UDP_Socket_Client_Server_Test: ");
2662 -    printf("%2ld Server %2ld Clients\n",1l, num_udp_clients);
2663 -    printf("%30s %2ld datagrams_per_client %4ld bytes_per_datagram\n",":",
2664 +    printf(" 1 Server %2d Clients\n", num_udp_clients);
2665 +    printf("%30s %2d datagrams_per_client %4d bytes_per_datagram\n",":",
2666          num_udp_datagrams_per_client, udp_datagram_size);
2667  
2668      return 0;
2669  }
2670 +#endif /* defined(SYMBIAN) && !defined(__WINSCW__) */
2671  
2672  static PRFileDesc *small_file_fd, *large_file_fd;
2673  static void *small_file_addr, *small_file_header, *large_file_addr;
2674 @@ -1441,7 +1453,7 @@ TransmitFile_Client(void *arg)
2675      --(*cp->exit_counter);
2676      PR_Notify(cp->exit_mon);
2677      PR_ExitMonitor(cp->exit_mon);
2678 -    DPRINTF(("TransmitFile_Client [0x%lx] exiting\n", PR_GetCurrentThread()));
2679 +    DPRINTF(("TransmitFile_Client [%p] exiting\n", PR_GetCurrentThread()));
2680  }
2681  
2682  /*
2683 @@ -1484,7 +1496,7 @@ Serve_TransmitFile_Client(void *arg)
2684      if (bytes != (SMALL_FILE_SIZE+ SMALL_FILE_HEADER_SIZE)) {
2685          fprintf(stderr,
2686              "prsocet_test: PR_TransmitFile failed: (%ld, %ld)\n",
2687 -            PR_GetError(), PR_GetOSError());
2688 +            (long)PR_GetError(), (long)PR_GetOSError());
2689          failed_already=1;
2690      }
2691      bytes = PR_TransmitFile(sockfd, local_large_file_fd, NULL, 0,
2692 @@ -1492,7 +1504,7 @@ Serve_TransmitFile_Client(void *arg)
2693      if (bytes != LARGE_FILE_SIZE) {
2694          fprintf(stderr,
2695              "prsocket_test: PR_TransmitFile failed: (%ld, %ld)\n",
2696 -            PR_GetError(), PR_GetOSError());
2697 +            (long)PR_GetError(), (long)PR_GetOSError());
2698          failed_already=1;
2699      }
2700  
2701 @@ -1520,7 +1532,7 @@ Serve_TransmitFile_Client(void *arg)
2702                                                                         slen, bytes);
2703          fprintf(stderr,
2704              "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
2705 -            PR_GetError(), PR_GetOSError());
2706 +            (long)PR_GetError(), (long)PR_GetOSError());
2707          failed_already=1;
2708      }
2709  
2710 @@ -1544,7 +1556,7 @@ Serve_TransmitFile_Client(void *arg)
2711                                                                         slen, bytes);
2712          fprintf(stderr,
2713              "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
2714 -            PR_GetError(), PR_GetOSError());
2715 +            (long)PR_GetError(), (long)PR_GetOSError());
2716          failed_already=1;
2717      }
2718         /*
2719 @@ -1566,7 +1578,7 @@ Serve_TransmitFile_Client(void *arg)
2720                                                                         slen, bytes);
2721          fprintf(stderr,
2722              "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
2723 -            PR_GetError(), PR_GetOSError());
2724 +            (long)PR_GetError(), (long)PR_GetOSError());
2725          failed_already=1;
2726      }
2727         /*
2728 @@ -1588,7 +1600,7 @@ Serve_TransmitFile_Client(void *arg)
2729                                                                         slen, bytes);
2730          fprintf(stderr,
2731              "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
2732 -            PR_GetError(), PR_GetOSError());
2733 +            (long)PR_GetError(), (long)PR_GetOSError());
2734          failed_already=1;
2735      }
2736         /*
2737 @@ -1610,7 +1622,7 @@ Serve_TransmitFile_Client(void *arg)
2738                                                                         slen, bytes);
2739          fprintf(stderr,
2740              "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
2741 -            PR_GetError(), PR_GetOSError());
2742 +            (long)PR_GetError(), (long)PR_GetOSError());
2743          failed_already=1;
2744      }
2745         /*
2746 @@ -1632,7 +1644,7 @@ Serve_TransmitFile_Client(void *arg)
2747                                                                         slen, bytes);
2748          fprintf(stderr,
2749              "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
2750 -            PR_GetError(), PR_GetOSError());
2751 +            (long)PR_GetError(), (long)PR_GetOSError());
2752          failed_already=1;
2753      }
2754         /*
2755 @@ -1654,7 +1666,7 @@ Serve_TransmitFile_Client(void *arg)
2756                                                                         slen, bytes);
2757          fprintf(stderr,
2758              "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
2759 -            PR_GetError(), PR_GetOSError());
2760 +            (long)PR_GetError(), (long)PR_GetOSError());
2761          failed_already=1;
2762      }
2763         /*
2764 @@ -1678,7 +1690,7 @@ Serve_TransmitFile_Client(void *arg)
2765                                                                         slen, bytes);
2766          fprintf(stderr,
2767              "prsocket_test: PR_SendFile failed: (%ld, %ld)\n",
2768 -            PR_GetError(), PR_GetOSError());
2769 +            (long)PR_GetError(), (long)PR_GetOSError());
2770          failed_already=1;
2771      }
2772  done:
2773 @@ -1752,7 +1764,7 @@ TransmitFile_Server(void *arg)
2774          goto exit;
2775      }
2776  
2777 -    DPRINTF(("TCP_Server: PR_BIND netaddr.inet.ip = 0x%lx, netaddr.inet.port = %d\n",
2778 +    DPRINTF(("TCP_Server: PR_BIND netaddr.inet.ip = 0x%x, netaddr.inet.port = %d\n",
2779          netaddr.inet.ip, netaddr.inet.port));
2780      tcp_server_addr.inet.family = netaddr.inet.family;
2781      tcp_server_addr.inet.port = netaddr.inet.port;
2782 @@ -1807,7 +1819,7 @@ TransmitFile_Server(void *arg)
2783          scp->datalen = sp->datalen;
2784  
2785          t[i] = PR_CreateThread(PR_USER_THREAD,
2786 -            Serve_TransmitFile_Client, (void *)scp, 
2787 +            Serve_TransmitFile_Client, (void *)scp,
2788              PR_PRIORITY_NORMAL,
2789              PR_LOCAL_THREAD,
2790              PR_JOINABLE_THREAD,
2791 @@ -1818,7 +1830,7 @@ TransmitFile_Server(void *arg)
2792              failed_already=1;
2793              goto exit;
2794          }
2795 -        DPRINTF(("TransmitFile_Server: Created Serve_TransmitFile_Client = 0x%lx\n", t));
2796 +        DPRINTF(("TransmitFile_Server: Created Serve_TransmitFile_Client = %p\n", t));
2797      }
2798  
2799      /*
2800 @@ -1846,12 +1858,12 @@ exit:
2801      --(*sp->exit_counter);
2802      PR_Notify(sp->exit_mon);
2803      PR_ExitMonitor(sp->exit_mon);
2804 -    DPRINTF(("TransmitFile_Server [0x%lx] exiting\n", PR_GetCurrentThread()));
2805 +    DPRINTF(("TransmitFile_Server [%p] exiting\n", PR_GetCurrentThread()));
2806  }
2807  
2808  /*
2809 - * Socket_Misc_Test    - test miscellaneous functions 
2810 - *    
2811 + * Socket_Misc_Test    - test miscellaneous functions
2812 + *
2813   */
2814  static PRInt32
2815  Socket_Misc_Test(void)
2816 @@ -1986,7 +1998,7 @@ Socket_Misc_Test(void)
2817              fprintf(stderr,
2818                  "prsocket_test failed to write to file %s: (%ld, %ld)\n",
2819                  LARGE_FILE_NAME,
2820 -                PR_GetError(), PR_GetOSError());
2821 +                (long)PR_GetError(), (long)PR_GetOSError());
2822              failed_already=1;
2823              rv = -1;
2824              goto done;
2825 @@ -2065,7 +2077,7 @@ Socket_Misc_Test(void)
2826      sparamp->exit_counter = &thread_count;
2827      sparamp->datalen = datalen;
2828      t = PR_CreateThread(PR_USER_THREAD,
2829 -        TransmitFile_Server, (void *)sparamp, 
2830 +        TransmitFile_Server, (void *)sparamp,
2831          PR_PRIORITY_NORMAL,
2832          PR_LOCAL_THREAD,
2833          PR_UNJOINABLE_THREAD,
2834 @@ -2076,7 +2088,7 @@ Socket_Misc_Test(void)
2835          rv = -1;
2836          goto done;
2837      }
2838 -    DPRINTF(("Created TCP server = 0x%x\n", t));
2839 +    DPRINTF(("Created TCP server = %p\n", t));
2840      thread_count++;
2841  
2842      /*
2843 @@ -2113,7 +2125,7 @@ Socket_Misc_Test(void)
2844              failed_already=1;
2845              goto done;
2846          }
2847 -        DPRINTF(("Created TransmitFile client = 0x%lx\n", t));
2848 +        DPRINTF(("Created TransmitFile client = %p\n", t));
2849          thread_count++;
2850      }
2851      /* Wait for server and client threads to exit */
2852 @@ -2144,7 +2156,7 @@ done:
2853      }
2854      if ((PR_RmDir(TEST_DIR)) == PR_FAILURE) {
2855          fprintf(stderr,"prsocket_test failed to rmdir %s: (%ld, %ld)\n",
2856 -            TEST_DIR, PR_GetError(), PR_GetOSError());
2857 +            TEST_DIR, (long)PR_GetError(), (long)PR_GetOSError());
2858          failed_already=1;
2859      }
2860  
2861 --- pr/tests/sprintf.c.orig     2015-10-16 13:22:19 UTC
2862 +++ pr/tests/sprintf.c
2863 @@ -127,7 +127,7 @@ static void test_l(char *pattern, char *
2864         (strncmp(s, sbuf, sizeof(sbuf)) != 0)) {
2865         fprintf(stderr,
2866            "pattern='%s' l=%ld\nPR_smprintf='%s'\nPR_snprintf='%s'\n    sprintf='%s'\n",
2867 -          pattern, l, s, buf, sbuf);
2868 +          pattern, (long)l, s, buf, sbuf);
2869         PR_smprintf_free(s);
2870         exit(-1);
2871      }
2872 --- pr/tests/stack.c.orig       2015-10-16 13:22:19 UTC
2873 +++ pr/tests/stack.c
2874 @@ -54,7 +54,7 @@ PRFileDesc  *errhandle;
2875  int main(int argc, char **argv)
2876  {
2877  #if !(defined(SYMBIAN) && defined(__WINS__))
2878 -    PRInt32 rv, cnt, sum;
2879 +    PRInt32 cnt, sum;
2880         DataRecord      *Item;
2881         PRStack         *list1, *list2;
2882         PRStackElem     *node;
2883 @@ -209,7 +209,7 @@ int main(int argc, char **argv)
2884  static void stackop(void *thread_arg)
2885  {
2886      PRInt32 val, cnt, index, loops;
2887 -       DataRecord      *Items, *Item;
2888 +       DataRecord      *Items;
2889         PRStack         *list1, *list2;
2890         PRStackElem     *node;
2891         stack_data *arg = (stack_data *) thread_arg;
2892 --- pr/tests/suspend.c.orig     2015-10-16 13:22:19 UTC
2893 +++ pr/tests/suspend.c
2894 @@ -30,14 +30,14 @@ void PR_CALLBACK
2895  Level_2_Thread(void *arg)
2896  {
2897      PR_Sleep(PR_MillisecondsToInterval(4 * 1000));
2898 -    printf("Level_2_Thread[0x%lx] exiting\n",PR_GetCurrentThread());
2899 +    printf("Level_2_Thread[%p] exiting\n",PR_GetCurrentThread());
2900      return;
2901  }
2902  
2903  void PR_CALLBACK
2904  Level_1_Thread(void *arg)
2905  {
2906 -    PRUint32 tmp = (PRUint32)arg;
2907 +    PRUint32 tmp = (PRUint32)(uintptr_t)arg;
2908      PRThreadScope scope = (PRThreadScope) tmp;
2909      PRThread *thr;
2910  
2911 @@ -52,7 +52,7 @@ Level_1_Thread(void *arg)
2912      if (!thr) {
2913          printf("Could not create thread!\n");
2914      } else {
2915 -        printf("Level_1_Thread[0x%lx] created %15s thread 0x%lx\n",
2916 +        printf("Level_1_Thread[%p] created %15s thread %p\n",
2917              PR_GetCurrentThread(),
2918              (scope == PR_GLOBAL_THREAD) ?
2919              "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD",
2920 @@ -63,7 +63,7 @@ Level_1_Thread(void *arg)
2921      alive--;
2922      PR_Notify(mon);
2923      PR_ExitMonitor(mon);
2924 -    printf("Thread[0x%lx] exiting\n",PR_GetCurrentThread());
2925 +    printf("Thread[%p] exiting\n",PR_GetCurrentThread());
2926  }
2927  
2928  static PRStatus PR_CALLBACK print_thread(PRThread *thread, int i, void *arg)
2929 @@ -72,14 +72,15 @@ static PRStatus PR_CALLBACK print_thread
2930      PRWord *registers;
2931  
2932      printf(
2933 -        "\nprint_thread[0x%lx]: %-20s - i = %ld\n",thread, 
2934 +        "\nprint_thread[%p]: %-20s - i = %ld\n",thread, 
2935          (PR_GLOBAL_THREAD == PR_GetThreadScope(thread)) ?
2936          "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD", i);
2937      registers = PR_GetGCRegisters(thread, 0, (int *)&words);
2938      if (registers)
2939 -        printf("Registers R0 = 0x%x R1 = 0x%x R2 = 0x%x R3 = 0x%x\n",
2940 -            registers[0],registers[1],registers[2],registers[3]);
2941 -    printf("Stack Pointer = 0x%lx\n", PR_GetSP(thread));
2942 +        printf("Regsters R0 = 0x%lx R1 = 0x%lx R2 = 0x%lx R3 = 0x%lx\n",
2943 +           (unsigned long)registers[0], (unsigned long)registers[1],
2944 +           (unsigned long)registers[2], (unsigned long)registers[3]);
2945 +    printf("Stack Pointer = %p\n", PR_GetSP(thread));
2946      return PR_SUCCESS;
2947  }
2948  
2949 @@ -107,7 +108,7 @@ static void Level_0_Thread(PRThreadScope
2950              printf("Could not create thread!\n");
2951              alive--;
2952          }
2953 -        printf("Level_0_Thread[0x%lx] created %15s thread 0x%lx\n",
2954 +        printf("Level_0_Thread[%p] created %15s thread %p\n",
2955              PR_GetCurrentThread(),
2956              (scope1 == PR_GLOBAL_THREAD) ?
2957              "PR_GLOBAL_THREAD" : "PR_LOCAL_THREAD",
2958 @@ -119,9 +120,10 @@ static void Level_0_Thread(PRThreadScope
2959      PR_EnumerateThreads(print_thread, NULL);
2960      registers = PR_GetGCRegisters(me, 1, (int *)&words);
2961      if (registers)
2962 -        printf("My Registers: R0 = 0x%x R1 = 0x%x R2 = 0x%x R3 = 0x%x\n",
2963 -            registers[0],registers[1],registers[2],registers[3]);
2964 -    printf("My Stack Pointer = 0x%lx\n", PR_GetSP(me));
2965 +        printf("My Registers: R0 = 0x%lx R1 = 0x%lx R2 = 0x%lx R3 = 0x%lx\n",
2966 +            (unsigned long)registers[0], (unsigned long)registers[1],
2967 +            (unsigned long)registers[2], (unsigned long)registers[3]);
2968 +    printf("My Stack Pointer = %p\n", PR_GetSP(me));
2969      PR_ResumeAll();
2970  
2971      /* Wait for all threads to exit */
2972 --- pr/tests/switch.c.orig      2015-10-16 13:22:19 UTC
2973 +++ pr/tests/switch.c
2974 @@ -80,7 +80,7 @@ PRIntn PR_CALLBACK Switch(PRIntn argc, c
2975      PRStatus status;
2976      PRBool help = PR_FALSE;
2977      PRUintn concurrency = 1;
2978 -    Shared *shared, *link;
2979 +    Shared *shared = NULL, *link;
2980      PRIntervalTime timein, timeout;
2981      PRThreadScope thread_scope = PR_LOCAL_THREAD;
2982      PRUintn thread_count, inner_count, loop_count, average;
2983 --- pr/tests/testfile.c.orig    2015-10-16 13:22:19 UTC
2984 +++ pr/tests/testfile.c
2985 @@ -36,6 +36,9 @@ static int _debug_on = 0;
2986  #ifdef XP_WIN
2987  #define mode_t int
2988  #endif
2989 +#if defined(XP_UNIX) || defined(XP_OS2_EMX)
2990 +#      include <unistd.h>      /* getopt(3) */
2991 +#endif
2992  
2993  #define DPRINTF(arg) if (_debug_on) printf arg
2994  
2995 @@ -93,7 +96,7 @@ static PRInt32 PR_CALLBACK DirTest(void 
2996  PRInt32 dirtest_failed = 0;
2997  
2998  PRThread* create_new_thread(PRThreadType type,
2999 -                                                       void (*start)(void *arg),
3000 +                                                       void *(*start)(void *arg),
3001                                                         void *arg,
3002                                                         PRThreadPriority priority,
3003                                                         PRThreadScope scope,
3004 @@ -155,7 +158,7 @@ PRInt32 native_thread = 0;
3005                 return((PRThread *) thandle);
3006  #endif
3007         } else {
3008 -               return(PR_CreateThread(type,start,arg,priority,scope,state,stackSize));
3009 +               return(PR_CreateThread(type,(void (*)(void*))start,arg,priority,scope,state,stackSize));
3010         }
3011  #else
3012         return(PR_CreateThread(type,start,arg,priority,scope,state,stackSize));
3013 @@ -316,8 +319,8 @@ char tmpname[1024];
3014                 printf(
3015                 "testfile PR_GetFileInfo returned incorrect status-change time: %s\n",
3016                 pathname);
3017 -               printf("ft = %lld, ft1 = %lld\n",file_info.creationTime,
3018 -                                                                       file_info1.creationTime);
3019 +               printf("ft = %lld, ft1 = %lld\n", (long long)file_info.creationTime,
3020 +                       (long long)file_info1.creationTime);
3021                 rv = -1;
3022                 goto cleanup;
3023         }
3024 @@ -342,8 +345,8 @@ char tmpname[1024];
3025                 printf(
3026                 "testfile PR_GetFileInfo returned incorrect modify time: %s\n",
3027                 pathname);
3028 -               printf("ft = %lld, ft1 = %lld\n",file_info.modifyTime,
3029 -                                                                       file_info1.modifyTime);
3030 +               printf("ft = %lld, ft1 = %lld\n", (long long)file_info.modifyTime,
3031 +                       (long long)file_info1.modifyTime);
3032                 rv = -1;
3033                 goto cleanup;
3034         }
3035 @@ -469,7 +472,7 @@ File_Rdwr_Param *fparamp;
3036                 memset(fparamp->buf, i, len);
3037  
3038                 t = create_new_thread(PR_USER_THREAD,
3039 -                             File_Write, (void *)fparamp, 
3040 +                             (void *(*)(void *))File_Write, (void *)fparamp, 
3041                               PR_PRIORITY_NORMAL,
3042                               scope,
3043                               PR_UNJOINABLE_THREAD,
3044 @@ -504,7 +507,7 @@ File_Rdwr_Param *fparamp;
3045                 fparamp->len = len;
3046  
3047                 t = create_new_thread(PR_USER_THREAD,
3048 -                             File_Read, (void *)fparamp, 
3049 +                             (void *(*)(void *))File_Read, (void *)fparamp, 
3050                               PR_PRIORITY_NORMAL,
3051                               scope,
3052                               PR_UNJOINABLE_THREAD,
3053 @@ -572,7 +575,7 @@ struct dirtest_arg thrarg;
3054  
3055                 thrarg.done= 0;
3056                 t = create_new_thread(PR_USER_THREAD,
3057 -                             DirTest, &thrarg, 
3058 +                             (void *(*)(void *))DirTest, &thrarg, 
3059                               PR_PRIORITY_NORMAL,
3060                               PR_LOCAL_THREAD,
3061                               PR_UNJOINABLE_THREAD,
3062 @@ -895,8 +898,6 @@ int main(int argc, char **argv)
3063  #endif
3064  #if defined(XP_UNIX) || defined(XP_OS2)
3065          int opt;
3066 -        extern char *optarg;
3067 -       extern int optind;
3068  #endif
3069  #if defined(XP_UNIX) || defined(XP_OS2)
3070          while ((opt = getopt(argc, argv, "d")) != EOF) {
3071 --- pr/tests/threads.c.orig     2015-10-16 13:22:19 UTC
3072 +++ pr/tests/threads.c
3073 @@ -27,7 +27,7 @@ void
3074  PR_CALLBACK
3075  DumbThread(void *arg)
3076  {
3077 -    PRInt32 tmp = (PRInt32)arg;
3078 +    PRInt32 tmp = (PRInt32)(intptr_t)arg;
3079      PRThreadScope scope = (PRThreadScope)tmp;
3080      PRThread *thr;
3081  
3082 @@ -167,10 +167,10 @@ int main(int argc, char **argv)
3083  
3084      if (debug_mode)
3085      {
3086 -    printf("\
3087 -** Tests lots of thread creations.  \n\
3088 -** Create %ld native threads %ld times. \n\
3089 -** Create %ld user threads %ld times \n", iterations,count,iterations,count);
3090 +    printf("** Tests lots of thread creations.\n"
3091 +       "** Create %d native threads %d times.\n"
3092 +       "** Create %d user threads %d times.\n", iterations, count,
3093 +       iterations, count);
3094      }
3095  
3096      for (index=0; index<iterations; index++) {
3097 --- pr/tests/thrpool_client.c.orig      2015-10-16 13:22:19 UTC
3098 +++ pr/tests/thrpool_client.c
3099 @@ -82,11 +82,11 @@ readn(PRFileDesc *sockfd, char *buf, int
3100         PRIntervalTime timeout = PR_INTERVAL_NO_TIMEOUT;
3101  
3102      for (rem=len; rem; offset += bytes, rem -= bytes) {
3103 -        DPRINTF(("thread = 0x%lx: calling PR_Recv, bytes = %d\n",
3104 +        DPRINTF(("thread = %p: calling PR_Recv, bytes = %d\n",
3105              PR_GetCurrentThread(), rem));
3106          bytes = PR_Recv(sockfd, buf + offset, rem, 0,
3107                 timeout);
3108 -        DPRINTF(("thread = 0x%lx: returning from PR_Recv, bytes = %d\n",
3109 +        DPRINTF(("thread = %p: returning from PR_Recv, bytes = %d\n",
3110              PR_GetCurrentThread(), bytes));
3111          if (bytes < 0) {
3112                         return -1;
3113 @@ -107,11 +107,11 @@ writen(PRFileDesc *sockfd, char *buf, in
3114      int offset = 0;
3115  
3116      for (rem=len; rem; offset += bytes, rem -= bytes) {
3117 -        DPRINTF(("thread = 0x%lx: calling PR_Send, bytes = %d\n",
3118 +        DPRINTF(("thread = %p: calling PR_Send, bytes = %d\n",
3119              PR_GetCurrentThread(), rem));
3120          bytes = PR_Send(sockfd, buf + offset, rem, 0,
3121              PR_INTERVAL_NO_TIMEOUT);
3122 -        DPRINTF(("thread = 0x%lx: returning from PR_Send, bytes = %d\n",
3123 +        DPRINTF(("thread = %p: returning from PR_Send, bytes = %d\n",
3124              PR_GetCurrentThread(), bytes));
3125          if (bytes <= 0)
3126              return -1;
3127 @@ -164,7 +164,7 @@ TCP_Client(void *arg)
3128  
3129          DPRINTF(("TCP client connecting to server:%d\n", server_port));
3130          if (PR_Connect(sockfd, &netaddr,PR_INTERVAL_NO_TIMEOUT) < 0){
3131 -               fprintf(stderr, "PR_Connect failed: (%ld, %ld)\n",
3132 +               fprintf(stderr, "PR_Connect failed: (%d, %d)\n",
3133                         PR_GetError(), PR_GetOSError());
3134              failed_already=1;
3135              return;
3136 @@ -173,7 +173,7 @@ TCP_Client(void *arg)
3137              /*
3138               * fill in random data
3139               */
3140 -            memset(out_buf->data, ((PRInt32) (&netaddr)) + i + j, bytes);
3141 +            memset(out_buf->data, ((intptr_t)(&netaddr)) + i + j, bytes);
3142              /*
3143               * write to server
3144               */
3145 @@ -281,7 +281,7 @@ TCP_Socket_Client_Server_Test(void)
3146         PR_EnterMonitor(mon2);
3147          connections++;
3148         PR_ExitMonitor(mon2);
3149 -        DPRINTF(("Created TCP client = 0x%lx\n", thr));
3150 +        DPRINTF(("Created TCP client = %p\n", thr));
3151      }
3152      /* Wait for client jobs to exit */
3153      PR_EnterMonitor(mon2);
3154 @@ -291,9 +291,9 @@ TCP_Socket_Client_Server_Test(void)
3155      }
3156      PR_ExitMonitor(mon2);
3157      printf("%30s","TCP_Socket_Client_Server_Test:");
3158 -    printf("%2ld Server %2ld Clients %2ld connections_per_client\n",1l,
3159 +    printf(" 1 Server %2d Clients %2d connections_per_client\n",
3160          num_tcp_clients, num_tcp_connections_per_client);
3161 -    printf("%30s %2ld messages_per_connection %4ld bytes_per_message\n",":",
3162 +    printf("%30s %2d messages_per_connection %4d bytes_per_message\n",":",
3163          num_tcp_mesgs_per_connection, tcp_mesg_size);
3164  
3165      PR_DELETE(cparamp);
3166 --- pr/tests/thrpool_server.c.orig      2015-10-16 13:22:19 UTC
3167 +++ pr/tests/thrpool_server.c
3168 @@ -329,7 +329,7 @@ TCP_Server(void *arg)
3169      }
3170  
3171      DPRINTF((
3172 -       "TCP_Server: PR_BIND netaddr.inet.ip = 0x%lx, netaddr.inet.port = %d\n",
3173 +       "TCP_Server: PR_BIND netaddr.inet.ip = 0x%x, netaddr.inet.port = %d\n",
3174          netaddr.inet.ip, netaddr.inet.port));
3175  
3176         sp = PR_NEW(Server_Param);
3177 @@ -341,7 +341,7 @@ TCP_Server(void *arg)
3178         sp->iod.socket = sockfd;
3179         sp->iod.timeout = PR_SecondsToInterval(60);
3180         sp->datalen = tcp_mesg_size;
3181 -       sp->exit_mon = sc_mon;
3182 +       sp->exit_mon = NULL;
3183         sp->job_counterp = &job_counter;
3184         sp->conn_counter = 0;
3185         sp->tp = tp;
3186 @@ -464,7 +464,7 @@ TCP_Server_Accept(void *arg)
3187                                                 PR_FALSE);
3188  
3189         PR_ASSERT(NULL != jobp);
3190 -       DPRINTF(("TCP_Server: Created Serve_Client = 0x%lx\n", jobp));
3191 +       DPRINTF(("TCP_Server: Created Serve_Client = %p\n", jobp));
3192  
3193         /*
3194          * single-threaded update; no lock needed
3195 @@ -481,7 +481,7 @@ TCP_Server_Accept(void *arg)
3196                                                 print_stats, sp, PR_FALSE);
3197  
3198         PR_ASSERT(NULL != jobp);
3199 -       DPRINTF(("TCP_Server: Created print_stats timer job = 0x%lx\n", jobp));
3200 +       DPRINTF(("TCP_Server: Created print_stats timer job = %p\n", jobp));
3201  
3202  exit:
3203         PR_EnterMonitor(sp->exit_mon);
3204 @@ -498,9 +498,9 @@ exit:
3205      }
3206         PR_DestroyMonitor(sp->exit_mon);
3207      printf("%30s","TCP_Socket_Client_Server_Test:");
3208 -    printf("%2ld Server %2ld Clients %2ld connections_per_client\n",1l,
3209 +    printf(" 1 Server %2d Clients %2d connections_per_client\n",
3210          num_tcp_clients, num_tcp_connections_per_client);
3211 -    printf("%30s %2ld messages_per_connection %4ld bytes_per_message\n",":",
3212 +    printf("%30s %2d messages_per_connection %4d bytes_per_message\n",":",
3213          num_tcp_mesgs_per_connection, tcp_mesg_size);
3214  
3215         DPRINTF(("%s: calling PR_ShutdownThreadPool\n", program_name));
3216 --- pr/tests/thruput.c.orig     2015-10-16 13:22:19 UTC
3217 +++ pr/tests/thruput.c
3218 @@ -66,7 +66,7 @@ static void PR_CALLBACK Clientel(void *a
3219  {
3220      PRStatus rv;
3221      PRFileDesc *xport;
3222 -    PRInt32 bytes, sampled;
3223 +    PRInt32 bytes, sampled = -1;
3224      PRIntervalTime now, interval;
3225      PRBool do_display = PR_FALSE;
3226      Shared *shared = (Shared*)arg;
3227 @@ -175,7 +175,7 @@ static void Client(const char *server_na
3228  
3229  static void PR_CALLBACK Servette(void *arg)
3230  {
3231 -    PRInt32 bytes, sampled;
3232 +    PRInt32 bytes, sampled = -1;
3233      PRIntervalTime now, interval;
3234      PRBool do_display = PR_FALSE;
3235      PRFileDesc *client = (PRFileDesc*)arg;
3236 @@ -373,6 +373,7 @@ int main(int argc, char **argv)
3237      else Client(server_name);
3238  
3239      return 0;
3240 +    return 0;
3241  }  /* main */
3242  
3243  /* thruput.c */
3244 --- pr/tests/timemac.c.orig     2015-10-16 13:22:19 UTC
3245 +++ pr/tests/timemac.c
3246 @@ -24,7 +24,7 @@ static void printExplodedTime(const PREx
3247      const char *sign;
3248  
3249      /* Print day of the week, month, day, hour, minute, and second */
3250 -    printf( "%s %s %ld %02ld:%02ld:%02ld ",
3251 +    printf( "%s %s %d %02d:%02d:%02d ",
3252             dayOfWeek[et->tm_wday], month[et->tm_month], et->tm_mday,
3253             et->tm_hour, et->tm_min, et->tm_sec);
3254  
3255 @@ -40,7 +40,7 @@ static void printExplodedTime(const PREx
3256          }
3257          hourOffset = totalOffset / 3600;
3258          minOffset = (totalOffset % 3600) / 60;
3259 -        printf("%s%02ld%02ld ", sign, hourOffset, minOffset);
3260 +        printf("%s%02d%02d ", sign, hourOffset, minOffset);
3261      }
3262  
3263      /* Print year */
3264 @@ -97,7 +97,7 @@ int main(int argc, char** argv)
3265          printf("Current local time is ");
3266         printExplodedTime(&et);
3267         printf("\n");
3268 -       printf("GMT offset is %ld, DST offset is %ld\n",
3269 +       printf("GMT offset is %d, DST offset is %d\n",
3270                 et.tm_params.tp_gmt_offset, et.tm_params.tp_dst_offset);
3271          t2 = PR_ImplodeTime(&et);
3272          if (LL_NE(t1, t2)) {
3273 --- pr/tests/timetest.c.orig    2015-10-16 13:22:19 UTC
3274 +++ pr/tests/timetest.c
3275 @@ -36,7 +36,7 @@ static void PrintExplodedTime(const PREx
3276      const char *sign;
3277  
3278      /* Print day of the week, month, day, hour, minute, and second */
3279 -    if (debug_mode) printf("%s %s %ld %02ld:%02ld:%02ld ",
3280 +    if (debug_mode) printf("%s %s %d %02d:%02d:%02d ",
3281             dayOfWeek[et->tm_wday], month[et->tm_month], et->tm_mday,
3282             et->tm_hour, et->tm_min, et->tm_sec);
3283  
3284 @@ -53,7 +53,7 @@ static void PrintExplodedTime(const PREx
3285          hourOffset = totalOffset / 3600;
3286          minOffset = (totalOffset % 3600) / 60;
3287          if (debug_mode) 
3288 -            printf("%s%02ld%02ld ", sign, hourOffset, minOffset);
3289 +            printf("%s%02d%02d ", sign, hourOffset, minOffset);
3290      }
3291  
3292      /* Print year */
3293 @@ -232,7 +232,7 @@ int main(int argc, char** argv)
3294          if (debug_mode) printf("Current local time is ");
3295         PrintExplodedTime(&et);
3296         if (debug_mode) printf("\n");
3297 -       if (debug_mode) printf("GMT offset is %ld, DST offset is %ld\n",
3298 +       if (debug_mode) printf("GMT offset is %d, DST offset is %d\n",
3299                 et.tm_params.tp_gmt_offset, et.tm_params.tp_dst_offset);
3300          t2 = PR_ImplodeTime(&et);
3301          if (LL_NE(t1, t2)) {
3302 --- pr/tests/y2k.c.orig 2015-10-16 13:22:19 UTC
3303 +++ pr/tests/y2k.c
3304 @@ -43,7 +43,7 @@ static void PrintExplodedTime(const PREx
3305      const char *sign;
3306  
3307      /* Print day of the week, month, day, hour, minute, and second */
3308 -    printf("%s %s %2ld %02ld:%02ld:%02ld ",
3309 +    printf("%s %s %2d %02d:%02d:%02d ",
3310             dayOfWeek[et->tm_wday], month[et->tm_month], et->tm_mday,
3311             et->tm_hour, et->tm_min, et->tm_sec);
3312  
3313 @@ -62,7 +62,7 @@ static void PrintExplodedTime(const PREx
3314          }
3315          hourOffset = totalOffset / 3600;
3316          minOffset = (totalOffset % 3600) / 60;
3317 -        printf("%s%02ld%02ld ", sign, hourOffset, minOffset);
3318 +        printf("%s%02d%02d ", sign, hourOffset, minOffset);
3319      }
3320  #ifdef PRINT_DETAILS
3321         printf("{%d, %d, %d, %d, %d, %d, %d, %d, %d, { %d, %d}}\n",et->tm_usec,
3322 --- pr/tests/y2ktmo.c.orig      2015-10-16 13:22:19 UTC
3323 +++ pr/tests/y2ktmo.c
3324 @@ -70,7 +70,7 @@ static struct _timeb start_time_tb;
3325  
3326  static void SleepThread(void *arg)
3327  {
3328 -    PRIntervalTime timeout = (PRIntervalTime) arg;
3329 +    PRIntervalTime timeout = (PRIntervalTime)(intptr_t)arg;
3330      PRIntervalTime elapsed;
3331  #if defined(XP_UNIX) || defined(WIN32)
3332      PRInt32 timeout_msecs = PR_IntervalToMilliseconds(timeout);
3333 @@ -121,7 +121,7 @@ static void SleepThread(void *arg)
3334  
3335  static void AcceptThread(void *arg)
3336  {
3337 -    PRIntervalTime timeout = (PRIntervalTime) arg;
3338 +    PRIntervalTime timeout = (PRIntervalTime)(intptr_t)arg;
3339      PRIntervalTime elapsed;
3340  #if defined(XP_UNIX) || defined(WIN32)
3341      PRInt32 timeout_msecs = PR_IntervalToMilliseconds(timeout);
3342 @@ -197,7 +197,7 @@ static void AcceptThread(void *arg)
3343  
3344  static void PollThread(void *arg)
3345  {
3346 -    PRIntervalTime timeout = (PRIntervalTime) arg;
3347 +    PRIntervalTime timeout = (PRIntervalTime)(intptr_t)arg;
3348      PRIntervalTime elapsed;
3349  #if defined(XP_UNIX) || defined(WIN32)
3350      PRInt32 timeout_msecs = PR_IntervalToMilliseconds(timeout);
3351 @@ -276,7 +276,7 @@ static void PollThread(void *arg)
3352  
3353  static void WaitCondVarThread(void *arg)
3354  {
3355 -    PRIntervalTime timeout = (PRIntervalTime) arg;
3356 +    PRIntervalTime timeout = (PRIntervalTime)(intptr_t)arg;
3357      PRIntervalTime elapsed;
3358  #if defined(XP_UNIX) || defined(WIN32)
3359      PRInt32 timeout_msecs = PR_IntervalToMilliseconds(timeout);
3360 @@ -340,7 +340,7 @@ static void WaitCondVarThread(void *arg)
3361  
3362  static void WaitMonitorThread(void *arg)
3363  {
3364 -    PRIntervalTime timeout = (PRIntervalTime) arg;
3365 +    PRIntervalTime timeout = (PRIntervalTime)(intptr_t)arg;
3366      PRIntervalTime elapsed;
3367  #if defined(XP_UNIX) || defined(WIN32)
3368      PRInt32 timeout_msecs = PR_IntervalToMilliseconds(timeout);
3369 @@ -397,7 +397,7 @@ static void WaitMonitorThread(void *arg)
3370  
3371  static void WaitCMonitorThread(void *arg)
3372  {
3373 -    PRIntervalTime timeout = (PRIntervalTime) arg;
3374 +    PRIntervalTime timeout = (PRIntervalTime)(intptr_t)arg;
3375      PRIntervalTime elapsed;
3376  #if defined(XP_UNIX) || defined(WIN32)
3377      PRInt32 timeout_msecs = PR_IntervalToMilliseconds(timeout);
3378 @@ -528,7 +528,7 @@ int main(int argc, char **argv)
3379      for (i = 0; i < num_thread_scopes; i++) { 
3380          for (j = 0; j < num_thread_funcs; j++) {
3381              threads[idx] = PR_CreateThread(PR_USER_THREAD, threadFuncs[j],
3382 -                (void*)PR_SecondsToInterval(secs), PR_PRIORITY_NORMAL,
3383 +                (void*)(intptr_t)PR_SecondsToInterval(secs), PR_PRIORITY_NORMAL,
3384                  threadScopes[i], PR_JOINABLE_THREAD, 0);
3385              if (threads[idx] == NULL) {
3386                  fprintf(stderr, "PR_CreateThread failed\n");
3387 --- pr/tests/zerolen.c.orig     2015-10-16 13:22:19 UTC
3388 +++ pr/tests/zerolen.c
3389 @@ -45,7 +45,7 @@ static void ClientThread(void *arg)
3390  {
3391      PRFileDesc *sock;
3392      PRNetAddr addr;
3393 -    PRUint16 port = (PRUint16) arg;
3394 +    PRUint16 port = (PRUint16)(uintptr_t)arg;
3395      char buf[1024];
3396      PRInt32 nbytes;
3397  
3398 @@ -127,7 +127,7 @@ int main()
3399       * First test PR_Writev.
3400       */
3401      clientThread = PR_CreateThread(PR_USER_THREAD,
3402 -            ClientThread, (void *) PR_ntohs(PR_NetAddrInetPort(&addr)),
3403 +            ClientThread, (void *)(uintptr_t)PR_ntohs(PR_NetAddrInetPort(&addr)),
3404              PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
3405      if (NULL == clientThread) {
3406          fprintf(stderr, "PR_CreateThread failed\n");
3407 @@ -171,7 +171,7 @@ int main()
3408       * Then test PR_Write.
3409       */
3410      clientThread = PR_CreateThread(PR_USER_THREAD,
3411 -            ClientThread, (void *) PR_ntohs(PR_NetAddrInetPort(&addr)),
3412 +            ClientThread, (void *)(uintptr_t)PR_ntohs(PR_NetAddrInetPort(&addr)),
3413              PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
3414      if (NULL == clientThread) {
3415          fprintf(stderr, "PR_CreateThread failed\n");
3416 @@ -216,7 +216,7 @@ int main()
3417       * Finally test PR_Send.
3418       */
3419      clientThread = PR_CreateThread(PR_USER_THREAD,
3420 -            ClientThread, (void *) PR_ntohs(PR_NetAddrInetPort(&addr)),
3421 +            ClientThread, (void *)(uintptr_t)PR_ntohs(PR_NetAddrInetPort(&addr)),
3422              PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
3423      if (NULL == clientThread) {
3424          fprintf(stderr, "PR_CreateThread failed\n");
3425
3426
3427 [FILE:2133:patches/patch-warnings]
3428 --- pr/include/prcountr.h.orig  2015-10-16 13:22:19 UTC
3429 +++ pr/include/prcountr.h
3430 @@ -394,7 +394,7 @@ NSPR_API(void) 
3431  #define PR_GET_COUNTER(counter,handle)\
3432      (counter) = PR_GetCounter((handle))
3433  #else
3434 -#define PR_GET_COUNTER(counter,handle) 0
3435 +#define PR_GET_COUNTER(counter,handle)
3436  #endif
3437  
3438  NSPR_API(PRUint32) 
3439 @@ -468,7 +468,7 @@ NSPR_API(void) 
3440  #define PR_FIND_NEXT_COUNTER_QNAME(next,handle)\
3441      (next) = PR_FindNextCounterQname((handle))
3442  #else
3443 -#define PR_FIND_NEXT_COUNTER_QNAME(next,handle) NULL
3444 +#define PR_FIND_NEXT_COUNTER_QNAME(next,handle)
3445  #endif
3446  
3447  NSPR_API(PRCounterHandle) 
3448 --- pr/src/misc/pralarm.c.orig  2015-10-16 13:22:19 UTC
3449 +++ pr/src/misc/pralarm.c
3450 @@ -101,7 +101,7 @@ static void PR_CALLBACK pr_alarmNotifier
3451  
3452      while (why != abort)
3453      {
3454 -        PRIntervalTime pause;
3455 +        PRIntervalTime pause = 0;
3456  
3457          PR_Lock(alarm->lock);
3458          while (why == scan)
3459 --- pr/src/misc/prdtoa.c.orig   2015-10-16 13:22:19 UTC
3460 +++ pr/src/misc/prdtoa.c
3461 @@ -2751,7 +2751,7 @@ dtoa
3462                 to hold the suppressed trailing zeros.
3463         */
3464  
3465 -       int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1,
3466 +       int bbits, b2, b5, be, dig, i, ieps, ilim = -1, ilim0, ilim1 = -1,
3467                 j, j1, k, k0, k_check, leftright, m2, m5, s2, s5,
3468                 spec_case, try_quick;
3469         Long L;
3470 --- pr/src/pthreads/ptio.c.orig 2015-10-16 13:22:19 UTC
3471 +++ pr/src/pthreads/ptio.c
3472 @@ -4934,6 +4934,7 @@ PR_IMPLEMENT(PRInt32) PR_Select(
3473  
3474      if (timeout == PR_INTERVAL_NO_TIMEOUT) {
3475          tvp = NULL;
3476 +        start = 0; /* Not needed, but shuts down a warning */
3477      } else {
3478          tv.tv_sec = (PRInt32)PR_IntervalToSeconds(timeout);
3479          tv.tv_usec = (PRInt32)PR_IntervalToMicroseconds(
3480 --- pr/src/pthreads/ptsynch.c.orig      2015-10-16 13:22:19 UTC
3481 +++ pr/src/pthreads/ptsynch.c
3482 @@ -30,7 +30,7 @@ static pthread_t pt_zero_tid;  /* a null
3483  #endif  /* defined(_PR_DCETHREADS) */
3484  #endif  /* defined(DEBUG) */
3485  
3486 -#if defined(FREEBSD)
3487 +#if defined(FREEBSD) && (defined(DEBUG) || defined(FORCE_PR_ASSERT))
3488  /*
3489   * On older versions of FreeBSD, pthread_mutex_trylock returns EDEADLK.
3490   * Newer versions return EBUSY.  We still need to support both.
3491
3492
3493 [FILE:1620:dragonfly/patch-nsprpub_configure]
3494 --- configure.intermediate      2015-11-29 10:31:49 UTC
3495 +++ configure
3496 @@ -6661,6 +6661,27 @@ tools are selected during the Xcode/Deve
3497      PR_MD_CSRCS=dgux.c
3498      ;;
3499  
3500 +*-dragonfly*)
3501 +    if test -z "$USE_NSPR_THREADS"; then
3502 +        USE_PTHREADS=1
3503 +    fi
3504 +    $as_echo "#define XP_UNIX 1" >>confdefs.h
3505 +
3506 +    $as_echo "#define HAVE_BSD_FLOCK 1" >>confdefs.h
3507 +
3508 +    $as_echo "#define HAVE_SOCKLEN_T 1" >>confdefs.h
3509 +
3510 +    CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
3511 +    
3512 +    
3513 +    
3514 +    MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
3515 +    DSO_CFLAGS=-fPIC
3516 +    DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
3517 +    MDCPUCFG_H=_dragonfly.cfg
3518 +    PR_MD_CSRCS=freebsd.c
3519 +    ;;
3520 +
3521  *-freebsd*)
3522      if test -z "$USE_NSPR_THREADS"; then
3523          USE_PTHREADS=1
3524 @@ -8284,7 +8305,7 @@ $as_echo_n "checking whether ${CC-cc} ac
3525         if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3526             ac_cv_have_dash_pthread=yes
3527                 case "$target_os" in
3528 -           freebsd*)
3529 +           freebsd*|dragonfly*)
3530  # Freebsd doesn't use -pthread for compiles, it uses them for linking
3531              ;;
3532             *)
3533 @@ -8322,7 +8343,7 @@ $as_echo "$ac_cv_have_dash_pthreads" >&6
3534              _PTHREAD_LDFLAGS=
3535          fi
3536             ;;
3537 -    *-freebsd*)
3538 +    *-freebsd*|*-dragonfly*)
3539             $as_echo "#define _REENTRANT 1" >>confdefs.h
3540  
3541             $as_echo "#define _THREAD_SAFE 1" >>confdefs.h
3542 @@ -8410,7 +8431,7 @@ case "$target" in
3543  
3544      fi
3545      ;;
3546 -*-freebsd*)
3547 +*-freebsd*|*dragonfly*)
3548      if test -n "$USE_NSPR_THREADS"; then
3549          $as_echo "#define _PR_LOCAL_THREADS_ONLY 1" >>confdefs.h
3550  
3551
3552
3553 [FILE:6239:dragonfly/patch-nsprpub_pr_include_md___dragonfly.cfg]
3554 --- pr/include/md/_dragonfly.cfg.orig   2013-06-06 16:24:16.620788000 +0000
3555 +++ pr/include/md/_dragonfly.cfg
3556 @@ -0,0 +1,208 @@
3557 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3558 +/* This Source Code Form is subject to the terms of the Mozilla Public
3559 + * License, v. 2.0. If a copy of the MPL was not distributed with this
3560 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
3561 +
3562 +#ifndef nspr_cpucfg___
3563 +#define nspr_cpucfg___
3564 +
3565 +#ifndef XP_UNIX
3566 +#define XP_UNIX
3567 +#endif
3568 +
3569 +#define PR_AF_INET6 28  /* same as AF_INET6 */
3570 +
3571 +#ifndef HAVE_LONG_LONG
3572 +#define HAVE_LONG_LONG
3573 +#endif
3574 +
3575 +#if defined(__i386__)
3576 +
3577 +#define IS_LITTLE_ENDIAN 1
3578 +#undef  IS_BIG_ENDIAN
3579 +#undef HAVE_ALIGNED_DOUBLES
3580 +#undef HAVE_ALIGNED_LONGLONGS
3581 +
3582 +#define PR_BYTES_PER_BYTE   1
3583 +#define PR_BYTES_PER_SHORT  2
3584 +#define PR_BYTES_PER_INT    4
3585 +#define PR_BYTES_PER_INT64  8
3586 +#define PR_BYTES_PER_LONG   4
3587 +#define PR_BYTES_PER_FLOAT  4
3588 +#define PR_BYTES_PER_DOUBLE 8
3589 +#define PR_BYTES_PER_WORD   4
3590 +#define PR_BYTES_PER_DWORD  8
3591 +#define PR_BYTES_PER_WORD_LOG2   2
3592 +#define PR_BYTES_PER_DWORD_LOG2  3
3593 +
3594 +#define PR_BITS_PER_BYTE    8
3595 +#define PR_BITS_PER_SHORT   16
3596 +#define PR_BITS_PER_INT     32
3597 +#define PR_BITS_PER_INT64   64
3598 +#define PR_BITS_PER_LONG    32
3599 +#define PR_BITS_PER_FLOAT   32
3600 +#define PR_BITS_PER_DOUBLE  64
3601 +#define PR_BITS_PER_WORD    32
3602 +
3603 +#define PR_BITS_PER_BYTE_LOG2   3
3604 +#define PR_BITS_PER_SHORT_LOG2  4
3605 +#define PR_BITS_PER_INT_LOG2    5
3606 +#define PR_BITS_PER_INT64_LOG2  6
3607 +#define PR_BITS_PER_LONG_LOG2   5
3608 +#define PR_BITS_PER_FLOAT_LOG2  5
3609 +#define PR_BITS_PER_DOUBLE_LOG2 6
3610 +#define PR_BITS_PER_WORD_LOG2   5
3611 +
3612 +#define PR_ALIGN_OF_SHORT   2
3613 +#define PR_ALIGN_OF_INT     4
3614 +#define PR_ALIGN_OF_LONG    4
3615 +#define PR_ALIGN_OF_INT64   4
3616 +#define PR_ALIGN_OF_FLOAT   4
3617 +#define PR_ALIGN_OF_DOUBLE  4
3618 +#define PR_ALIGN_OF_POINTER 4
3619 +
3620 +#elif defined(__alpha__)
3621 +
3622 +#define IS_LITTLE_ENDIAN 1
3623 +#undef  IS_BIG_ENDIAN
3624 +#define        HAVE_ALIGNED_DOUBLES
3625 +#define        HAVE_ALIGNED_LONGLONGS
3626 +#define IS_64
3627 +
3628 +#define PR_BYTES_PER_BYTE   1
3629 +#define PR_BYTES_PER_SHORT  2
3630 +#define PR_BYTES_PER_INT    4
3631 +#define PR_BYTES_PER_INT64  8
3632 +#define PR_BYTES_PER_LONG   8
3633 +#define PR_BYTES_PER_FLOAT  4
3634 +#define PR_BYTES_PER_DOUBLE 8
3635 +#define PR_BYTES_PER_WORD   8
3636 +#define PR_BYTES_PER_DWORD  8
3637 +#define PR_BYTES_PER_WORD_LOG2   3
3638 +#define PR_BYTES_PER_DWORD_LOG2  3
3639 +
3640 +#define PR_BITS_PER_BYTE    8
3641 +#define PR_BITS_PER_SHORT   16
3642 +#define PR_BITS_PER_INT     32
3643 +#define PR_BITS_PER_INT64   64
3644 +#define PR_BITS_PER_LONG    64
3645 +#define PR_BITS_PER_FLOAT   32
3646 +#define PR_BITS_PER_DOUBLE  64
3647 +#define PR_BITS_PER_WORD    64
3648 +
3649 +#define PR_BITS_PER_BYTE_LOG2   3
3650 +#define PR_BITS_PER_SHORT_LOG2  4
3651 +#define PR_BITS_PER_INT_LOG2    5
3652 +#define PR_BITS_PER_INT64_LOG2  6
3653 +#define PR_BITS_PER_LONG_LOG2   6
3654 +#define PR_BITS_PER_FLOAT_LOG2  5
3655 +#define PR_BITS_PER_DOUBLE_LOG2 6
3656 +#define PR_BITS_PER_WORD_LOG2   6
3657 +
3658 +#define PR_ALIGN_OF_SHORT   2
3659 +#define PR_ALIGN_OF_INT     4
3660 +#define PR_ALIGN_OF_LONG    8
3661 +#define PR_ALIGN_OF_INT64   8
3662 +#define PR_ALIGN_OF_FLOAT   4
3663 +#define PR_ALIGN_OF_DOUBLE  8
3664 +#define PR_ALIGN_OF_POINTER 8
3665 +
3666 +#elif defined(__amd64__)
3667 +
3668 +#define IS_LITTLE_ENDIAN 1
3669 +#undef  IS_BIG_ENDIAN
3670 +#define        HAVE_ALIGNED_DOUBLES
3671 +#define        HAVE_ALIGNED_LONGLONGS
3672 +#define IS_64
3673 +
3674 +#define PR_BYTES_PER_BYTE   1
3675 +#define PR_BYTES_PER_SHORT  2
3676 +#define PR_BYTES_PER_INT    4
3677 +#define PR_BYTES_PER_INT64  8
3678 +#define PR_BYTES_PER_LONG   8
3679 +#define PR_BYTES_PER_FLOAT  4
3680 +#define PR_BYTES_PER_DOUBLE 8
3681 +#define PR_BYTES_PER_WORD   8
3682 +#define PR_BYTES_PER_DWORD  8
3683 +#define PR_BYTES_PER_WORD_LOG2   3
3684 +#define PR_BYTES_PER_DWORD_LOG2  3
3685 +
3686 +#define PR_BITS_PER_BYTE    8
3687 +#define PR_BITS_PER_SHORT   16
3688 +#define PR_BITS_PER_INT     32
3689 +#define PR_BITS_PER_INT64   64
3690 +#define PR_BITS_PER_LONG    64
3691 +#define PR_BITS_PER_FLOAT   32
3692 +#define PR_BITS_PER_DOUBLE  64
3693 +#define PR_BITS_PER_WORD    64
3694 +
3695 +#define PR_BITS_PER_BYTE_LOG2   3
3696 +#define PR_BITS_PER_SHORT_LOG2  4
3697 +#define PR_BITS_PER_INT_LOG2    5
3698 +#define PR_BITS_PER_INT64_LOG2  6
3699 +#define PR_BITS_PER_LONG_LOG2   6
3700 +#define PR_BITS_PER_FLOAT_LOG2  5
3701 +#define PR_BITS_PER_DOUBLE_LOG2 6
3702 +#define PR_BITS_PER_WORD_LOG2   6
3703 +
3704 +#define PR_ALIGN_OF_SHORT   2
3705 +#define PR_ALIGN_OF_INT     4
3706 +#define PR_ALIGN_OF_LONG    8
3707 +#define PR_ALIGN_OF_INT64   8
3708 +#define PR_ALIGN_OF_FLOAT   4
3709 +#define PR_ALIGN_OF_DOUBLE  8
3710 +#define PR_ALIGN_OF_POINTER 8
3711 +#define PR_ALIGN_OF_WORD    8
3712 +
3713 +#else
3714 +
3715 +#error "Unknown CPU architecture"
3716 +
3717 +#endif
3718 +
3719 +#ifndef NO_NSPR_10_SUPPORT
3720 +
3721 +#define BYTES_PER_BYTE         PR_BYTES_PER_BYTE
3722 +#define BYTES_PER_SHORT        PR_BYTES_PER_SHORT
3723 +#define BYTES_PER_INT          PR_BYTES_PER_INT
3724 +#define BYTES_PER_INT64                PR_BYTES_PER_INT64
3725 +#define BYTES_PER_LONG         PR_BYTES_PER_LONG
3726 +#define BYTES_PER_FLOAT                PR_BYTES_PER_FLOAT
3727 +#define BYTES_PER_DOUBLE       PR_BYTES_PER_DOUBLE
3728 +#define BYTES_PER_WORD         PR_BYTES_PER_WORD
3729 +#define BYTES_PER_DWORD                PR_BYTES_PER_DWORD
3730 +
3731 +#define BITS_PER_BYTE          PR_BITS_PER_BYTE
3732 +#define BITS_PER_SHORT         PR_BITS_PER_SHORT
3733 +#define BITS_PER_INT           PR_BITS_PER_INT
3734 +#define BITS_PER_INT64         PR_BITS_PER_INT64
3735 +#define BITS_PER_LONG          PR_BITS_PER_LONG
3736 +#define BITS_PER_FLOAT         PR_BITS_PER_FLOAT
3737 +#define BITS_PER_DOUBLE                PR_BITS_PER_DOUBLE
3738 +#define BITS_PER_WORD          PR_BITS_PER_WORD
3739 +
3740 +#define BITS_PER_BYTE_LOG2     PR_BITS_PER_BYTE_LOG2
3741 +#define BITS_PER_SHORT_LOG2    PR_BITS_PER_SHORT_LOG2
3742 +#define BITS_PER_INT_LOG2      PR_BITS_PER_INT_LOG2
3743 +#define BITS_PER_INT64_LOG2    PR_BITS_PER_INT64_LOG2
3744 +#define BITS_PER_LONG_LOG2     PR_BITS_PER_LONG_LOG2
3745 +#define BITS_PER_FLOAT_LOG2    PR_BITS_PER_FLOAT_LOG2
3746 +#define BITS_PER_DOUBLE_LOG2   PR_BITS_PER_DOUBLE_LOG2
3747 +#define BITS_PER_WORD_LOG2     PR_BITS_PER_WORD_LOG2
3748 +
3749 +#define ALIGN_OF_SHORT         PR_ALIGN_OF_SHORT
3750 +#define ALIGN_OF_INT           PR_ALIGN_OF_INT
3751 +#define ALIGN_OF_LONG          PR_ALIGN_OF_LONG
3752 +#define ALIGN_OF_INT64         PR_ALIGN_OF_INT64
3753 +#define ALIGN_OF_FLOAT         PR_ALIGN_OF_FLOAT
3754 +#define ALIGN_OF_DOUBLE                PR_ALIGN_OF_DOUBLE
3755 +#define ALIGN_OF_POINTER       PR_ALIGN_OF_POINTER
3756 +#define ALIGN_OF_WORD          PR_ALIGN_OF_WORD
3757 +
3758 +#define BYTES_PER_WORD_LOG2    PR_BYTES_PER_WORD_LOG2
3759 +#define BYTES_PER_DWORD_LOG2   PR_BYTES_PER_DWORD_LOG2
3760 +#define WORDS_PER_DWORD_LOG2   PR_WORDS_PER_DWORD_LOG2
3761 +
3762 +#endif /* NO_NSPR_10_SUPPORT */
3763 +
3764 +#endif /* nspr_cpucfg___ */
3765
3766
3767 [FILE:6235:dragonfly/patch-nsprpub_pr_include_md___dragonfly.h]
3768 --- pr/include/md/_dragonfly.h.orig     2013-06-06 18:49:02.829118000 +0000
3769 +++ pr/include/md/_dragonfly.h
3770 @@ -0,0 +1,225 @@
3771 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3772 +/* This Source Code Form is subject to the terms of the Mozilla Public
3773 + * License, v. 2.0. If a copy of the MPL was not distributed with this
3774 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
3775 +
3776 +#ifndef nspr_dragonfly_defs_h___
3777 +#define nspr_dragonfly_defs_h___
3778 +
3779 +#include "prthread.h"
3780 +
3781 +#if 0
3782 +#if __FreeBSD__ >= 2
3783 +#include <osreldate.h>  /* for __FreeBSD_version */
3784 +#endif
3785 +#include <sys/syscall.h>
3786 +#endif
3787 +
3788 +#define PR_LINKER_ARCH "dragonfly"
3789 +#define _PR_SI_SYSNAME  "DRAGONFLY"
3790 +#if defined(__i386__)
3791 +#define _PR_SI_ARCHITECTURE "x86"
3792 +#elif defined(__amd64__)
3793 +#define _PR_SI_ARCHITECTURE "amd64"
3794 +#else
3795 +#error "Unknown CPU architecture"
3796 +#endif
3797 +
3798 +#define PR_DLL_SUFFIX          ".so"
3799 +
3800 +#define _PR_VMBASE              0x30000000
3801 +#define _PR_STACK_VMBASE       0x50000000
3802 +#define _MD_DEFAULT_STACK_SIZE 65536L
3803 +#define _MD_MMAP_FLAGS          MAP_PRIVATE
3804 +
3805 +#undef  HAVE_STACK_GROWING_UP
3806 +#define HAVE_DLL
3807 +#define USE_DLFCN
3808 +#define _PR_HAVE_SOCKADDR_LEN
3809 +#define _PR_STAT_HAS_ST_ATIMESPEC
3810 +#define _PR_HAVE_LARGE_OFF_T
3811 +
3812 +#define _PR_HAVE_GETPROTO_R
3813 +#define _PR_HAVE_5_ARG_GETPROTO_R
3814 +#define _PR_HAVE_GETHOST_R
3815 +#define _PR_HAVE_GETHOST_R_INT
3816 +
3817 +#define _PR_POLL_AVAILABLE
3818 +
3819 +#define _PR_HAVE_SYSV_SEMAPHORES
3820 +#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
3821 +
3822 +#define _PR_INET6
3823 +#define _PR_HAVE_INET_NTOP
3824 +#define _PR_HAVE_GETHOSTBYNAME2
3825 +#define _PR_HAVE_GETADDRINFO
3826 +#define _PR_INET6_PROBE
3827 +#define _PR_IPV6_V6ONLY_PROBE
3828 +
3829 +#define USE_SETJMP
3830 +
3831 +#ifndef _PR_PTHREADS
3832 +#include <setjmp.h>
3833 +
3834 +#define PR_CONTEXT_TYPE        sigjmp_buf
3835 +
3836 +#define CONTEXT(_th) ((_th)->md.context)
3837 +
3838 +#define _MD_GET_SP(_th)    (_th)->md.context[0]._sjb[2]
3839 +#define PR_NUM_GCREGS  _JBLEN
3840 +
3841 +/*
3842 +** Initialize a thread context to run "_main()" when started
3843 +*/
3844 +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status)  \
3845 +{  \
3846 +    *status = PR_TRUE;  \
3847 +    if (sigsetjmp(CONTEXT(_thread), 1)) {  \
3848 +        _main();  \
3849 +    }  \
3850 +    _MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 64); \
3851 +}
3852 +
3853 +#define _MD_SWITCH_CONTEXT(_thread)  \
3854 +    if (!sigsetjmp(CONTEXT(_thread), 1)) {  \
3855 +       (_thread)->md.errcode = errno;  \
3856 +       _PR_Schedule();  \
3857 +    }
3858 +
3859 +/*
3860 +** Restore a thread context, saved by _MD_SWITCH_CONTEXT
3861 +*/
3862 +#define _MD_RESTORE_CONTEXT(_thread) \
3863 +{   \
3864 +    errno = (_thread)->md.errcode;  \
3865 +    _MD_SET_CURRENT_THREAD(_thread);  \
3866 +    siglongjmp(CONTEXT(_thread), 1);  \
3867 +}
3868 +
3869 +/* Machine-dependent (MD) data structures */
3870 +
3871 +struct _MDThread {
3872 +    PR_CONTEXT_TYPE context;
3873 +    int id;
3874 +    int errcode;
3875 +};
3876 +
3877 +struct _MDThreadStack {
3878 +    PRInt8 notused;
3879 +};
3880 +
3881 +struct _MDLock {
3882 +    PRInt8 notused;
3883 +};
3884 +
3885 +struct _MDSemaphore {
3886 +    PRInt8 notused;
3887 +};
3888 +
3889 +struct _MDCVar {
3890 +    PRInt8 notused;
3891 +};
3892 +
3893 +struct _MDSegment {
3894 +    PRInt8 notused;
3895 +};
3896 +
3897 +/*
3898 + * md-specific cpu structure field
3899 + */
3900 +#define _PR_MD_MAX_OSFD FD_SETSIZE
3901 +
3902 +struct _MDCPU_Unix {
3903 +    PRCList ioQ;
3904 +    PRUint32 ioq_timeout;
3905 +    PRInt32 ioq_max_osfd;
3906 +    PRInt32 ioq_osfd_cnt;
3907 +#ifndef _PR_USE_POLL
3908 +    fd_set fd_read_set, fd_write_set, fd_exception_set;
3909 +    PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
3910 +                               fd_exception_cnt[_PR_MD_MAX_OSFD];
3911 +#else
3912 +       struct pollfd *ioq_pollfds;
3913 +       int ioq_pollfds_size;
3914 +#endif /* _PR_USE_POLL */
3915 +};
3916 +
3917 +#define _PR_IOQ(_cpu)                  ((_cpu)->md.md_unix.ioQ)
3918 +#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
3919 +#define _PR_FD_READ_SET(_cpu)          ((_cpu)->md.md_unix.fd_read_set)
3920 +#define _PR_FD_READ_CNT(_cpu)          ((_cpu)->md.md_unix.fd_read_cnt)
3921 +#define _PR_FD_WRITE_SET(_cpu)         ((_cpu)->md.md_unix.fd_write_set)
3922 +#define _PR_FD_WRITE_CNT(_cpu)         ((_cpu)->md.md_unix.fd_write_cnt)
3923 +#define _PR_FD_EXCEPTION_SET(_cpu)     ((_cpu)->md.md_unix.fd_exception_set)
3924 +#define _PR_FD_EXCEPTION_CNT(_cpu)     ((_cpu)->md.md_unix.fd_exception_cnt)
3925 +#define _PR_IOQ_TIMEOUT(_cpu)          ((_cpu)->md.md_unix.ioq_timeout)
3926 +#define _PR_IOQ_MAX_OSFD(_cpu)         ((_cpu)->md.md_unix.ioq_max_osfd)
3927 +#define _PR_IOQ_OSFD_CNT(_cpu)         ((_cpu)->md.md_unix.ioq_osfd_cnt)
3928 +#define _PR_IOQ_POLLFDS(_cpu)          ((_cpu)->md.md_unix.ioq_pollfds)
3929 +#define _PR_IOQ_POLLFDS_SIZE(_cpu)     ((_cpu)->md.md_unix.ioq_pollfds_size)
3930 +
3931 +#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
3932 +
3933 +struct _MDCPU {
3934 +       struct _MDCPU_Unix md_unix;
3935 +};
3936 +
3937 +#define _MD_INIT_LOCKS()
3938 +#define _MD_NEW_LOCK(lock) PR_SUCCESS
3939 +#define _MD_FREE_LOCK(lock)
3940 +#define _MD_LOCK(lock)
3941 +#define _MD_UNLOCK(lock)
3942 +#define _MD_INIT_IO()
3943 +#define _MD_IOQ_LOCK()
3944 +#define _MD_IOQ_UNLOCK()
3945 +
3946 +extern PRStatus _MD_InitializeThread(PRThread *thread);
3947 +
3948 +#define _MD_INIT_RUNNING_CPU(cpu)       _MD_unix_init_running_cpu(cpu)
3949 +#define _MD_INIT_THREAD                 _MD_InitializeThread
3950 +#define _MD_EXIT_THREAD(thread)
3951 +#define _MD_SUSPEND_THREAD(thread)      _MD_suspend_thread
3952 +#define _MD_RESUME_THREAD(thread)       _MD_resume_thread
3953 +#define _MD_CLEAN_THREAD(_thread)
3954 +
3955 +extern PRStatus _MD_CREATE_THREAD(
3956 +    PRThread *thread,
3957 +    void (*start) (void *),
3958 +    PRThreadPriority priority,
3959 +    PRThreadScope scope,
3960 +    PRThreadState state,
3961 +    PRUint32 stackSize);
3962 +extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
3963 +extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
3964 +extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
3965 +extern void _MD_YIELD(void);
3966 +
3967 +#endif /* ! _PR_PTHREADS */
3968 +
3969 +extern void _MD_EarlyInit(void);
3970 +
3971 +#define _MD_EARLY_INIT                  _MD_EarlyInit
3972 +#define _MD_FINAL_INIT                 _PR_UnixInit
3973 +#define _MD_INTERVAL_USE_GTOD
3974 +
3975 +/*
3976 + * We wrapped the select() call.  _MD_SELECT refers to the built-in,
3977 + * unwrapped version.
3978 + */
3979 +#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
3980 +
3981 +#if defined(_PR_POLL_AVAILABLE)
3982 +#include <poll.h>
3983 +#define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
3984 +#endif
3985 +
3986 +/* freebsd has INADDR_LOOPBACK defined, but in /usr/include/rpc/types.h, and I didn't
3987 +   want to be including that.. */
3988 +#ifndef INADDR_LOOPBACK
3989 +#define INADDR_LOOPBACK         (u_long)0x7F000001
3990 +#endif
3991 +
3992 +/* For writev() */
3993 +#include <sys/uio.h>
3994 +
3995 +#endif /* nspr_freebsd_defs_h___ */
3996
3997
3998 [FILE:895:dragonfly/patch-nsprpub_pr_include_md__freebsd.h]
3999 --- pr/include/md/_freebsd.h.intermediate       2014-06-20 12:34:59.566379000 +0000
4000 +++ pr/include/md/_freebsd.h
4001 @@ -59,7 +59,7 @@
4002  #define _PR_HAVE_GETHOST_R
4003  #define _PR_HAVE_GETHOST_R_INT
4004  #endif
4005 -#if __FreeBSD_version >= 400008
4006 +#if defined(__DragonFly__) || __FreeBSD_version >= 400008
4007  /*
4008   * libc_r before this version of FreeBSD doesn't have poll().
4009   * Although libc has poll(), it is not thread-safe so we can't
4010 @@ -68,7 +68,7 @@
4011  #define _PR_POLL_AVAILABLE
4012  #endif
4013  #else
4014 -#if __FreeBSD_version >= 300000
4015 +#if defined(__DragonFly__) || __FreeBSD_version >= 300000
4016  #define _PR_POLL_AVAILABLE
4017  #define _PR_USE_POLL
4018  #endif
4019 @@ -77,7 +77,7 @@
4020  #define _PR_HAVE_SYSV_SEMAPHORES
4021  #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
4022  
4023 -#if __FreeBSD_version >= 400014
4024 +#if defined(__DragonFly__) || __FreeBSD_version >= 400014
4025  #define _PR_INET6
4026  #define _PR_HAVE_INET_NTOP
4027  #define _PR_HAVE_GETHOSTBYNAME2
4028
4029
4030 [FILE:1399:dragonfly/patch-nsprpub_pr_include_md__pth.h]
4031 --- pr/include/md/_pth.h.orig   2014-06-05 21:42:08.000000000 +0000
4032 +++ pr/include/md/_pth.h
4033 @@ -114,7 +114,7 @@
4034  #define _PT_PTHREAD_COPY_THR_HANDLE(st, dt)   (dt) = (st)
4035  #elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \
4036         || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
4037 -       || defined(HPUX) || defined(FREEBSD) \
4038 +       || defined(HPUX) || defined(FREEBSD) || defined(__DragonFly__) \
4039         || defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
4040         || defined(NTO) || defined(DARWIN) \
4041         || defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN)
4042 @@ -201,7 +201,7 @@
4043  #endif /* defined(_PR_DCETHREADS) */
4044  
4045  #elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
4046 -       || defined(FREEBSD) || defined(SYMBIAN)
4047 +       || defined(FREEBSD) || defined(SYMBIAN) || defined(__DragonFly__)
4048  #define PT_PRIO_MIN            sched_get_priority_min(SCHED_OTHER)
4049  #define PT_PRIO_MAX            sched_get_priority_max(SCHED_OTHER)
4050  #elif defined(NTO)
4051 @@ -260,6 +260,7 @@ extern int (*_PT_aix_yield_fcn)();
4052  #elif defined(HPUX) || defined(SOLARIS) \
4053         || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
4054         || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
4055 +       || defined(__DragonFly__) \
4056         || defined(BSDI) || defined(NTO) || defined(DARWIN) \
4057         || defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN)
4058  #define _PT_PTHREAD_YIELD()                    sched_yield()
4059
4060
4061 [FILE:291:dragonfly/patch-nsprpub_pr_include_md_prosdep.h]
4062 --- pr/include/md/prosdep.h.orig        2014-06-05 21:42:08.000000000 +0000
4063 +++ pr/include/md/prosdep.h
4064 @@ -43,6 +43,9 @@ PR_BEGIN_EXTERN_C
4065  #elif defined(OPENBSD)
4066  #include "md/_openbsd.h"
4067  
4068 +#elif defined(__DragonFly__)
4069 +#include "md/_dragonfly.h"
4070 +
4071  #elif defined(BSDI)
4072  #include "md/_bsdi.h"
4073  
4074
4075
4076 [FILE:494:dragonfly/patch-nsprpub_pr_src_md_unix_uxrng.c]
4077 --- pr/src/md/unix/uxrng.c.orig 2014-06-05 21:42:08.000000000 +0000
4078 +++ pr/src/md/unix/uxrng.c
4079 @@ -86,7 +86,7 @@ GetHighResClock(void *buf, size_t maxbyt
4080  \f
4081  #elif (defined(LINUX) || defined(FREEBSD) || defined(__FreeBSD_kernel__) \
4082      || defined(NETBSD) || defined(__NetBSD_kernel__) || defined(OPENBSD) \
4083 -    || defined(SYMBIAN) || defined(__GNU__))
4084 +    || defined(SYMBIAN) || defined(__GNU__)) || defined(__DragonFly__)
4085  #include <sys/types.h>
4086  #include <sys/stat.h>
4087  #include <fcntl.h>
4088
4089
4090 [FILE:723:dragonfly/patch-nsprpub_pr_src_misc_prnetdb.c]
4091 --- pr/src/misc/prnetdb.c.orig  2014-06-20 12:34:59.566379000 +0000
4092 +++ pr/src/misc/prnetdb.c
4093 @@ -78,6 +78,11 @@ PRLock *_pr_dnsLock = NULL;
4094  #define _PR_HAVE_GETPROTO_R_INT
4095  #endif
4096  
4097 +#if defined(DRAGONFLY)
4098 +#define _PR_HAVE_GETPROTO_R
4099 +#define _PR_HAVE_5_ARG_GETPROTO_R
4100 +#endif
4101 +
4102  /* BeOS has glibc but not the glibc-style getprotobyxxx_r functions. */
4103  #if (defined(__GLIBC__) && __GLIBC__ >= 2 && !defined(XP_BEOS))
4104  #define _PR_HAVE_GETPROTO_R
4105 @@ -295,7 +300,7 @@ _pr_QueryNetIfs(void)
4106  }
4107  
4108  #elif (defined(DARWIN) && defined(HAVE_GETIFADDRS)) || defined(FREEBSD) \
4109 -    || defined(NETBSD) || defined(OPENBSD)
4110 +    || defined(NETBSD) || defined(OPENBSD) || defined(DRAGONFLY)
4111  
4112  /*
4113   * Use the BSD getifaddrs function.
4114
4115
4116 [FILE:1005:dragonfly/patch-nsprpub_pr_src_pthreads_ptio.c]
4117 --- pr/src/pthreads/ptio.c.orig 2014-06-20 12:34:59.616376000 +0000
4118 +++ pr/src/pthreads/ptio.c
4119 @@ -180,7 +180,8 @@ static PRBool _pr_ipv6_v6only_on_by_defa
4120      || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
4121      || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
4122      || defined(BSDI) || defined(NTO) || defined(DARWIN) \
4123 -    || defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN)
4124 +    || defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN) \
4125 +    || defined(__DragonFly__)
4126  #define _PRSelectFdSetArg_t fd_set *
4127  #else
4128  #error "Cannot determine architecture"
4129 @@ -3256,7 +3257,7 @@ static PRIOMethods _pr_socketpollfd_meth
4130      || defined(AIX) || defined(FREEBSD) || defined(NETBSD) \
4131      || defined(OPENBSD) || defined(BSDI) || defined(NTO) \
4132      || defined(DARWIN) || defined(UNIXWARE) || defined(RISCOS) \
4133 -    || defined(SYMBIAN)
4134 +    || defined(SYMBIAN) || defined(__DragonFly__)
4135  #define _PR_FCNTL_FLAGS O_NONBLOCK
4136  #else
4137  #error "Can't determine architecture"
4138
4139
4140 [FILE:533:dragonfly/patch-nsprpub_pr_src_pthreads_ptsynch.c]
4141 --- pr/src/pthreads/ptsynch.c.orig      2014-06-20 12:34:59.616376000 +0000
4142 +++ pr/src/pthreads/ptsynch.c
4143 @@ -919,7 +919,7 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphor
4144   */
4145  #if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)) \
4146      || defined(FREEBSD) || defined(OPENBSD) || defined(BSDI) \
4147 -    || defined(DARWIN) || defined(SYMBIAN)
4148 +    || defined(DARWIN) || defined(SYMBIAN) || defined(__DragonFly__)
4149  /* union semun is defined by including <sys/sem.h> */
4150  #else
4151  /* according to X/OPEN we have to define it ourselves */
4152
4153
4154 [FILE:700:dragonfly/patch-pr_tests_Makefile.in]
4155 --- pr/tests/Makefile.in.intermediate   2016-01-08 16:56:54.000000000 +0200
4156 +++ pr/tests/Makefile.in
4157 @@ -342,6 +342,12 @@ ifeq ($(OS_ARCH), UNIXWARE)
4158  export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR)
4159  endif
4160  
4161 +ifeq ($(OS_ARCH),DragonFly)
4162 +ifeq ($(USE_PTHREADS),1)
4163 +LDOPTS += -pthread
4164 +endif
4165 +endif
4166 +
4167  ifeq ($(OS_ARCH),FreeBSD)
4168  ifeq ($(USE_PTHREADS),1)
4169  LDOPTS += -pthread
4170 @@ -370,7 +376,7 @@ LIBPTHREAD = -lpthread
4171  ifeq ($(OS_ARCH),AIX)
4172  LIBPTHREAD = -lpthreads
4173  endif
4174 -ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS QNX Darwin OpenUNIX,$(OS_ARCH)))
4175 +ifeq (,$(filter-out DragonFly FreeBSD OpenBSD BSD_OS QNX Darwin OpenUNIX,$(OS_ARCH)))
4176  LIBPTHREAD =
4177  endif
4178  ifeq ($(OS_ARCH)$(basename $(OS_RELEASE)),HP-UXB.10)
4179