Changeset 101869 in vbox
- Timestamp:
- Nov 6, 2023 1:38:17 PM (15 months ago)
- Location:
- trunk/src/libs/xpcom18a4
- Files:
-
- 1 deleted
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/Makefile.kmk
r101863 r101869 221 221 NSPRPUB-OBS-HEADERS_IFFLAGS = -m 644 222 222 NSPRPUB-OBS-HEADERS_SOURCES = \ 223 nsprpub/pr/include/obsolete/probslet.h \ 224 nsprpub/pr/include/obsolete/protypes.h 223 nsprpub/pr/include/obsolete/probslet.h 225 224 226 225 NSPRPUB-PRIV-HEADERS_INST = $(INST_SDK)bindings/xpcom/include/nsprpub/private/ -
trunk/src/libs/xpcom18a4/nsprpub/lib/ds/plarena.c
r58734 r101869 53 53 static PLArena *arena_freelist; 54 54 55 #ifdef PL_ARENAMETER 56 static PLArenaStats *arena_stats_list; 57 58 #define COUNT(pool,what) (pool)->stats.what++ 59 #else 60 #define COUNT(pool,what) /* nothing */ 61 #endif 62 55 #define COUNT(pool,what) 63 56 #define PL_ARENA_DEFAULT_ALIGN sizeof(double) 64 57 … … 108 101 PLArenaPool *pool, const char *name, PRUint32 size, PRUint32 align) 109 102 { 110 #if defined(XP_MAC)111 #pragma unused (name)112 #endif113 114 103 if (align == 0) 115 104 align = PL_ARENA_DEFAULT_ALIGN; … … 122 111 (PRUword)PL_ARENA_ALIGN(pool, &pool->first + 1); 123 112 pool->current = &pool->first; 124 pool->arenasize = size; 125 #ifdef PL_ARENAMETER 126 memset(&pool->stats, 0, sizeof pool->stats); 127 pool->stats.name = strdup(name); 128 pool->stats.next = arena_stats_list; 129 arena_stats_list = &pool->stats; 130 #endif 113 pool->arenasize = size; 131 114 } 132 115 … … 322 305 { 323 306 FreeArenaList(pool, &pool->first, PR_TRUE); 324 #ifdef PL_ARENAMETER325 {326 PLArenaStats *stats, **statsp;327 328 if (pool->stats.name)329 PR_DELETE(pool->stats.name);330 for (statsp = &arena_stats_list; (stats = *statsp) != 0;331 statsp = &stats->next) {332 if (stats == &pool->stats) {333 *statsp = stats->next;334 return;335 }336 }337 }338 #endif339 307 } 340 308 341 309 PR_IMPLEMENT(void) PL_CompactArenaPool(PLArenaPool *ap) 342 310 { 343 #if XP_MAC344 #pragma unused (ap)345 #if 0346 PRArena *curr = &(ap->first);347 while (curr) {348 reallocSmaller(curr, curr->avail - (uprword_t)curr);349 curr->limit = curr->avail;350 curr = curr->next;351 }352 #endif353 #endif354 311 } 355 312 … … 370 327 } 371 328 372 #ifdef PL_ARENAMETER373 PR_IMPLEMENT(void) PL_ArenaCountAllocation(PLArenaPool *pool, PRUint32 nb)374 {375 pool->stats.nallocs++;376 pool->stats.nbytes += nb;377 if (nb > pool->stats.maxalloc)378 pool->stats.maxalloc = nb;379 pool->stats.variance += nb * nb;380 }381 382 PR_IMPLEMENT(void) PL_ArenaCountInplaceGrowth(383 PLArenaPool *pool, PRUint32 size, PRUint32 incr)384 {385 pool->stats.ninplace++;386 }387 388 PR_IMPLEMENT(void) PL_ArenaCountGrowth(389 PLArenaPool *pool, PRUint32 size, PRUint32 incr)390 {391 pool->stats.ngrows++;392 pool->stats.nbytes += incr;393 pool->stats.variance -= size * size;394 size += incr;395 if (size > pool->stats.maxalloc)396 pool->stats.maxalloc = size;397 pool->stats.variance += size * size;398 }399 400 PR_IMPLEMENT(void) PL_ArenaCountRelease(PLArenaPool *pool, char *mark)401 {402 pool->stats.nreleases++;403 }404 405 PR_IMPLEMENT(void) PL_ArenaCountRetract(PLArenaPool *pool, char *mark)406 {407 pool->stats.nfastrels++;408 }409 410 #include <math.h>411 #include <stdio.h>412 413 PR_IMPLEMENT(void) PL_DumpArenaStats(FILE *fp)414 {415 PLArenaStats *stats;416 double mean, variance;417 418 for (stats = arena_stats_list; stats; stats = stats->next) {419 if (stats->nallocs != 0) {420 mean = (double)stats->nbytes / stats->nallocs;421 variance = fabs(stats->variance / stats->nallocs - mean * mean);422 } else {423 mean = variance = 0;424 }425 426 fprintf(fp, "\n%s allocation statistics:\n", stats->name);427 fprintf(fp, " number of arenas: %u\n", stats->narenas);428 fprintf(fp, " number of allocations: %u\n", stats->nallocs);429 fprintf(fp, " number of free arena reclaims: %u\n", stats->nreclaims);430 fprintf(fp, " number of malloc calls: %u\n", stats->nmallocs);431 fprintf(fp, " number of deallocations: %u\n", stats->ndeallocs);432 fprintf(fp, " number of allocation growths: %u\n", stats->ngrows);433 fprintf(fp, " number of in-place growths: %u\n", stats->ninplace);434 fprintf(fp, "number of released allocations: %u\n", stats->nreleases);435 fprintf(fp, " number of fast releases: %u\n", stats->nfastrels);436 fprintf(fp, " total bytes allocated: %u\n", stats->nbytes);437 fprintf(fp, " mean allocation size: %g\n", mean);438 fprintf(fp, " standard deviation: %g\n", sqrt(variance));439 fprintf(fp, " maximum allocation size: %u\n", stats->maxalloc);440 }441 }442 #endif /* PL_ARENAMETER */ -
trunk/src/libs/xpcom18a4/nsprpub/lib/ds/plarena.h
r58734 r101869 60 60 }; 61 61 62 #ifdef PL_ARENAMETER63 typedef struct PLArenaStats PLArenaStats;64 65 struct PLArenaStats {66 PLArenaStats *next; /* next in arenaStats list */67 char *name; /* name for debugging */68 PRUint32 narenas; /* number of arenas in pool */69 PRUint32 nallocs; /* number of PL_ARENA_ALLOCATE() calls */70 PRUint32 nreclaims; /* number of reclaims from freeArenas */71 PRUint32 nmallocs; /* number of malloc() calls */72 PRUint32 ndeallocs; /* number of lifetime deallocations */73 PRUint32 ngrows; /* number of PL_ARENA_GROW() calls */74 PRUint32 ninplace; /* number of in-place growths */75 PRUint32 nreleases; /* number of PL_ARENA_RELEASE() calls */76 PRUint32 nfastrels; /* number of "fast path" releases */77 PRUint32 nbytes; /* total bytes allocated */78 PRUint32 maxalloc; /* maximum allocation size in bytes */79 PRFloat64 variance; /* size variance accumulator */80 };81 #endif82 83 62 struct PLArenaPool { 84 63 PLArena first; /* first arena in pool list */ … … 86 65 PRUint32 arenasize; /* net exact size of a new arena */ 87 66 PRUword mask; /* alignment mask (power-of-2 - 1) */ 88 #ifdef PL_ARENAMETER89 PLArenaStats stats;90 #endif91 67 }; 92 68 … … 171 147 PR_END_MACRO 172 148 173 #ifdef PL_ARENAMETER174 #define PL_COUNT_ARENA(pool,op) ((pool)->stats.narenas op)175 #else176 149 #define PL_COUNT_ARENA(pool,op) 177 #endif178 150 179 151 #define PL_ARENA_DESTROY(pool, a, pnext) \ … … 187 159 PR_END_MACRO 188 160 189 #ifdef PL_ARENAMETER190 191 #include <stdio.h>192 193 PR_EXTERN(void) PL_ArenaCountAllocation(PLArenaPool *pool, PRUint32 nb);194 195 PR_EXTERN(void) PL_ArenaCountInplaceGrowth(196 PLArenaPool *pool, PRUint32 size, PRUint32 incr);197 198 PR_EXTERN(void) PL_ArenaCountGrowth(199 PLArenaPool *pool, PRUint32 size, PRUint32 incr);200 201 PR_EXTERN(void) PL_ArenaCountRelease(PLArenaPool *pool, char *mark);202 203 PR_EXTERN(void) PL_ArenaCountRetract(PLArenaPool *pool, char *mark);204 205 PR_EXTERN(void) PL_DumpArenaStats(FILE *fp);206 207 #else /* !PL_ARENAMETER */208 209 161 #define PL_ArenaCountAllocation(ap, nb) /* nothing */ 210 162 #define PL_ArenaCountInplaceGrowth(ap, size, incr) /* nothing */ … … 213 165 #define PL_ArenaCountRetract(ap, mark) /* nothing */ 214 166 215 #endif /* !PL_ARENAMETER */216 217 167 PR_END_EXTERN_C 218 168 -
trunk/src/libs/xpcom18a4/nsprpub/lib/ds/plarenas.h
r11551 r101869 56 56 57 57 /* 58 ** Allocate an arena pool as specified by the parameters.59 **60 ** This is equivelant to allocating the space yourself and then61 ** calling PL_InitArenaPool().62 **63 ** This function may fail (and return a NULL) for a variety of64 ** reasons. The reason for a particular failure can be discovered65 ** by calling PR_GetError().66 */67 #if 0 /* Not implemented */68 PR_EXTERN(PLArenaPool*) PL_AllocArenaPool(69 const char *name, PRUint32 size, PRUint32 align);70 #endif71 72 /*73 ** Destroy an arena pool previously allocated by PL_AllocArenaPool().74 **75 ** This function may fail if the arena is not empty and the caller76 ** wishes to check for empty upon descruction.77 */78 #if 0 /* Not implemented */79 PR_EXTERN(PRStatus) PL_DestroyArenaPool(PLArenaPool *pool, PRBool checkEmpty);80 #endif81 82 83 /*84 58 ** Initialize an arena pool with the given name for debugging and metering, 85 59 ** with a minimum size per arena of size bytes. -
trunk/src/libs/xpcom18a4/nsprpub/lib/ds/plhash.c
r1 r101869 66 66 DefaultAllocTable(void *pool, PRSize size) 67 67 { 68 #if defined(XP_MAC)69 #pragma unused (pool)70 #endif71 72 68 return PR_MALLOC(size); 73 69 } … … 76 72 DefaultFreeTable(void *pool, void *item) 77 73 { 78 #if defined(XP_MAC)79 #pragma unused (pool)80 #endif81 82 74 PR_Free(item); 83 75 } … … 86 78 DefaultAllocEntry(void *pool, const void *key) 87 79 { 88 #if defined(XP_MAC)89 #pragma unused (pool,key)90 #endif91 92 80 return PR_NEW(PLHashEntry); 93 81 } … … 96 84 DefaultFreeEntry(void *pool, PLHashEntry *he, PRUintn flag) 97 85 { 98 #if defined(XP_MAC)99 #pragma unused (pool)100 #endif101 102 86 if (flag == HT_FREE_ENTRY) 103 87 PR_Free(he); … … 133 117 ht->shift = PL_HASH_BITS - n; 134 118 n = 1 << n; 135 #if defined(WIN16) 136 if (n > 16000) { 137 (*allocOps->freeTable)(allocPriv, ht); 138 return 0; 139 } 140 #endif /* WIN16 */ 119 141 120 nb = n * sizeof(PLHashEntry *); 142 121 ht->buckets = (PLHashEntry**)((*allocOps->allocTable)(allocPriv, nb)); … … 191 170 PLHashNumber h; 192 171 193 #ifdef HASHMETER194 ht->nlookups++;195 #endif196 172 h = keyHash * GOLDEN_RATIO; 197 173 h >>= ht->shift; … … 208 184 } 209 185 hep = &he->next; 210 #ifdef HASHMETER211 ht->nsteps++;212 #endif213 186 } 214 187 return hep; … … 225 198 PLHashNumber h; 226 199 227 #ifdef HASHMETER228 ht->nlookups++;229 #endif230 200 h = keyHash * GOLDEN_RATIO; 231 201 h >>= ht->shift; … … 236 206 } 237 207 hep = &he->next; 238 #ifdef HASHMETER239 ht->nsteps++;240 #endif241 208 } 242 209 return hep; … … 255 222 if (ht->nentries >= OVERLOADED(n)) { 256 223 oldbuckets = ht->buckets; 257 #if defined(WIN16) 258 if (2 * n > 16000) 259 return 0; 260 #endif /* WIN16 */ 224 261 225 nb = 2 * n * sizeof(PLHashEntry *); 262 226 ht->buckets = (PLHashEntry**) … … 267 231 } 268 232 memset(ht->buckets, 0, nb); 269 #ifdef HASHMETER270 ht->ngrows++;271 #endif272 233 ht->shift--; 273 234 … … 345 306 } 346 307 memset(ht->buckets, 0, nb); 347 #ifdef HASHMETER348 ht->nshrinks++;349 #endif350 308 ht->shift++; 351 309 … … 455 413 } 456 414 457 #ifdef HASHMETER458 #include <math.h>459 #include <stdio.h>460 461 PR_IMPLEMENT(void)462 PL_HashTableDumpMeter(PLHashTable *ht, PLHashEnumerator dump, FILE *fp)463 {464 double mean, variance;465 PRUint32 nchains, nbuckets;466 PRUint32 i, n, maxChain, maxChainLen;467 PLHashEntry *he;468 469 variance = 0;470 nchains = 0;471 maxChainLen = 0;472 nbuckets = NBUCKETS(ht);473 for (i = 0; i < nbuckets; i++) {474 he = ht->buckets[i];475 if (!he)476 continue;477 nchains++;478 for (n = 0; he; he = he->next)479 n++;480 variance += n * n;481 if (n > maxChainLen) {482 maxChainLen = n;483 maxChain = i;484 }485 }486 mean = (double)ht->nentries / nchains;487 variance = fabs(variance / nchains - mean * mean);488 489 fprintf(fp, "\nHash table statistics:\n");490 fprintf(fp, " number of lookups: %u\n", ht->nlookups);491 fprintf(fp, " number of entries: %u\n", ht->nentries);492 fprintf(fp, " number of grows: %u\n", ht->ngrows);493 fprintf(fp, " number of shrinks: %u\n", ht->nshrinks);494 fprintf(fp, " mean steps per hash: %g\n", (double)ht->nsteps495 / ht->nlookups);496 fprintf(fp, "mean hash chain length: %g\n", mean);497 fprintf(fp, " standard deviation: %g\n", sqrt(variance));498 fprintf(fp, " max hash chain length: %u\n", maxChainLen);499 fprintf(fp, " max hash chain: [%u]\n", maxChain);500 501 for (he = ht->buckets[maxChain], i = 0; he; he = he->next, i++)502 if ((*dump)(he, i, fp) != HT_ENUMERATE_NEXT)503 break;504 }505 #endif /* HASHMETER */506 507 415 PR_IMPLEMENT(int) 508 416 PL_HashTableDump(PLHashTable *ht, PLHashEnumerator dump, FILE *fp) … … 511 419 512 420 count = PL_HashTableEnumerateEntries(ht, dump, fp); 513 #ifdef HASHMETER514 PL_HashTableDumpMeter(ht, dump, fp);515 #endif516 421 return count; 517 422 } -
trunk/src/libs/xpcom18a4/nsprpub/lib/ds/plhash.h
r11551 r101869 70 70 typedef PLHashNumber (PR_CALLBACK *PLHashFunction)(const void *key); 71 71 typedef PRIntn (PR_CALLBACK *PLHashComparator)(const void *v1, const void *v2); 72 73 #if defined(XP_OS2_VACPP) && defined(VACPP_FLIP) /* for nsSpaceManager.cpp */74 PR_END_EXTERN_C /* and nsHTMLDocument.cpp */75 #endif76 72 typedef PRIntn (PR_CALLBACK *PLHashEnumerator)(PLHashEntry *he, PRIntn i, void *arg); 77 78 #if defined(XP_OS2_VACPP) && defined(VACPP_FLIP)79 PR_BEGIN_EXTERN_C80 #endif81 73 82 74 /* Flag bits in PLHashEnumerator's return value */ … … 112 104 const PLHashAllocOps *allocOps; /* allocation operations */ 113 105 void *allocPriv; /* allocation private data */ 114 #ifdef HASHMETER115 PRUint32 nlookups; /* total number of lookups */116 PRUint32 nsteps; /* number of hash chains traversed */117 PRUint32 ngrows; /* number of table expansions */118 PRUint32 nshrinks; /* number of table contractions */119 #endif120 106 }; 121 107 -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/md/prosdep.h
r46043 r101869 46 46 PR_BEGIN_EXTERN_C 47 47 48 #if def XP_PC48 #if defined(XP_UNIX) 49 49 50 #include "md/_pcos.h" 51 #ifdef WINNT 52 #include "md/_winnt.h" 53 #include "md/_win32_errors.h" 54 #elif defined(WIN95) 55 #include "md/_win95.h" 56 #include "md/_win32_errors.h" 57 #elif defined(WIN16) 58 #include "md/_win16.h" 59 #elif defined(OS2) 60 #include "md/_os2.h" 61 #include "md/_os2_errors.h" 62 #else 63 #error unknown Windows platform 64 #endif 65 66 #elif defined XP_MAC 67 68 #include "_macos.h" 69 70 #elif defined(XP_UNIX) 71 72 #if defined(AIX) 73 #include "md/_aix.h" 74 75 #elif defined(FREEBSD) 50 #if defined(FREEBSD) 76 51 #include "md/_freebsd.h" 77 52 … … 82 57 #include "md/_openbsd.h" 83 58 84 #elif defined(BSDI)85 #include "md/_bsdi.h"86 87 #elif defined(HPUX)88 #include "md/_hpux.h"89 90 #elif defined(IRIX)91 #include "md/_irix.h"92 93 59 #elif defined(LINUX) 94 60 #include "md/_linux.h" 95 96 #elif defined(OSF1)97 #include "md/_osf1.h"98 61 99 62 #elif defined(DARWIN) 100 63 #include "md/_darwin.h" 101 64 102 #elif defined(NEXTSTEP)103 #include "md/_nextstep.h"104 105 65 #elif defined(SOLARIS) 106 66 #include "md/_solaris.h" 107 108 #elif defined(SUNOS4)109 #include "md/_sunos4.h"110 111 #elif defined(SNI)112 #include "md/_reliantunix.h"113 114 #elif defined(SONY)115 #include "md/_sony.h"116 117 #elif defined(NEC)118 #include "md/_nec.h"119 120 #elif defined(SCO)121 #include "md/_scoos.h"122 123 #elif defined(UNIXWARE)124 #include "md/_unixware.h"125 126 #elif defined(NCR)127 #include "md/_ncr.h"128 129 #elif defined(DGUX)130 #include "md/_dgux.h"131 132 #elif defined(QNX)133 #include "md/_qnx.h"134 135 #elif defined(VMS)136 #include "md/_openvms.h"137 138 #elif defined(NTO)139 #include "md/_nto.h"140 67 141 68 #else … … 145 72 146 73 #include "md/_unixos.h" 147 #include "md/_unix_errors.h"148 149 #elif defined(XP_BEOS)150 151 #include "md/_beos.h"152 74 #include "md/_unix_errors.h" 153 75 -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/obsolete/probslet.h
r11551 r101869 173 173 174 174 #ifndef NO_NSPR_10_SUPPORT 175 #ifdef XP_MAC176 #include <stat.h>177 #else178 175 #include <sys/stat.h> 179 #endif180 176 181 177 NSPR_API(PRInt32) PR_Stat(const char *path, struct stat *buf); -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/prenv.h
r11551 r101869 151 151 NSPR_API(PRStatus) PR_SetEnv(const char *string); 152 152 153 /*154 ** DEPRECATED. Use PR_SetEnv() instead.155 */156 #ifdef XP_MAC157 NSPR_API(PRIntn) PR_PutEnv(const char *string);158 #endif159 160 153 PR_END_EXTERN_C 161 154 -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/prinet.h
r1 r101869 60 60 #define prinet_h__ 61 61 62 #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)62 #if defined(XP_UNIX) 63 63 #ifdef LINUX 64 64 #undef __STRICT_ANSI__ … … 68 68 #include <sys/socket.h> /* AF_INET */ 69 69 #include <netinet/in.h> /* INADDR_ANY, ..., ntohl(), ... */ 70 #ifdef XP_OS271 #include <sys/ioctl.h>72 #endif73 #ifdef XP_UNIX74 #ifdef AIX75 /*76 * On AIX 4.3, the header <arpa/inet.h> refers to struct77 * ether_addr and struct sockaddr_dl that are not declared.78 * The following struct declarations eliminate the compiler79 * warnings.80 */81 struct ether_addr;82 struct sockaddr_dl;83 #endif /* AIX */84 70 #include <arpa/inet.h> 85 #endif /* XP_UNIX */86 71 #include <netdb.h> 87 72 88 #if defined(FREEBSD) || defined(BSDI) || defined(QNX)73 #if defined(FREEBSD) 89 74 #include <rpc/types.h> /* the only place that defines INADDR_LOOPBACK */ 90 75 #endif 91 92 /*93 * OS/2 hack. For some reason INADDR_LOOPBACK is not defined in the94 * socket headers.95 */96 #if defined(OS2) && !defined(INADDR_LOOPBACK)97 #define INADDR_LOOPBACK 0x7f00000198 #endif99 100 /*101 * Prototypes of ntohl() etc. are declared in <machine/endian.h>102 * on these platforms.103 */104 #if defined(BSDI) || defined(OSF1)105 #include <machine/endian.h>106 #endif107 108 #elif defined(WIN32)109 110 /* Do not include any system header files. */111 112 #elif defined(WIN16)113 114 #include <winsock.h>115 116 #elif defined(XP_MAC)117 118 #include "macsocket.h"119 76 120 77 #else -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/prio.h
r101806 r101869 244 244 struct { 245 245 PRUint16 family; /* address family (0x00ff maskable) */ 246 #ifdef XP_BEOS247 char data[10]; /* Be has a smaller structure */248 #else249 246 char data[14]; /* raw address data */ 250 #endif251 247 } raw; 252 248 struct { … … 254 250 PRUint16 port; /* port number */ 255 251 PRUint32 ip; /* The actual 32 bits of address */ 256 #ifdef XP_BEOS257 char pad[4]; /* Be has a smaller structure */258 #else259 252 char pad[8]; 260 #endif261 253 } inet; 262 254 struct { … … 267 259 PRUint32 scope_id; /* set of interfaces for a scope */ 268 260 } ipv6; 269 #if defined(XP_UNIX) || defined(XP_OS2_EMX)261 #if defined(XP_UNIX) 270 262 struct { /* Unix domain socket address */ 271 263 PRUint16 family; /* address family (AF_UNIX) */ 272 #ifdef XP_OS2273 char path[108]; /* null-terminated pathname */274 /* bind fails if size is not 108. */275 #else276 264 char path[104]; /* null-terminated pathname */ 277 #endif278 265 } local; 279 266 #endif -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/pprio.h
r11551 r101869 151 151 */ 152 152 153 #ifdef WIN32154 155 #define PR_SOCK_STREAM 1156 #define PR_SOCK_DGRAM 2157 158 #else /* WIN32 */159 160 153 #define PR_SOCK_STREAM SOCK_STREAM 161 154 #define PR_SOCK_DGRAM SOCK_DGRAM 162 163 #endif /* WIN32 */164 155 165 156 /* … … 211 202 PRTransmitFileFlags flags, PRIntervalTime timeout); 212 203 213 #ifdef WIN32214 /* FUNCTION: PR_NTFast_AcceptRead215 ** DESCRIPTION:216 ** NT has the notion of an "accept context", which is only needed in217 ** order to make certain calls. By default, a socket connected via218 ** AcceptEx can only do a limited number of things without updating219 ** the acceptcontext. The generic version of PR_AcceptRead always220 ** updates the accept context. This version does not.221 **/222 NSPR_API(PRInt32) PR_NTFast_AcceptRead(PRFileDesc *sd, PRFileDesc **nd,223 PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime t);224 225 typedef void (*_PR_AcceptTimeoutCallback)(void *);226 227 /* FUNCTION: PR_NTFast_AcceptRead_WithTimeoutCallback228 ** DESCRIPTION:229 ** The AcceptEx call combines the accept with the read function. However,230 ** our daemon threads need to be able to wakeup and reliably flush their231 ** log buffers if the Accept times out. However, with the current blocking232 ** interface to AcceptRead, there is no way for us to timeout the Accept;233 ** this is because when we timeout the Read, we can close the newly234 ** socket and continue; but when we timeout the accept itself, there is no235 ** new socket to timeout. So instead, this version of the function is236 ** provided. After the initial timeout period elapses on the accept()237 ** portion of the function, it will call the callback routine and then238 ** continue the accept. If the timeout occurs on the read, it will239 ** close the connection and return error.240 */241 NSPR_API(PRInt32) PR_NTFast_AcceptRead_WithTimeoutCallback(242 PRFileDesc *sd,243 PRFileDesc **nd,244 PRNetAddr **raddr,245 void *buf,246 PRInt32 amount,247 PRIntervalTime t,248 _PR_AcceptTimeoutCallback callback,249 void *callback_arg);250 251 /* FUNCTION: PR_NTFast_Accept252 ** DESCRIPTION:253 ** NT has the notion of an "accept context", which is only needed in254 ** order to make certain calls. By default, a socket connected via255 ** AcceptEx can only do a limited number of things without updating256 ** the acceptcontext. The generic version of PR_Accept always257 ** updates the accept context. This version does not.258 **/259 NSPR_API(PRFileDesc*) PR_NTFast_Accept(PRFileDesc *fd, PRNetAddr *addr,260 PRIntervalTime timeout);261 262 /* FUNCTION: PR_NTFast_Update263 ** DESCRIPTION:264 ** For sockets accepted with PR_NTFast_Accept or PR_NTFastAcceptRead,265 ** this function will update the accept context for those sockets,266 ** so that the socket can make general purpose socket calls.267 ** Without calling this, the only operations supported on the socket268 ** Are PR_Read, PR_Write, PR_Transmitfile, and PR_Close.269 */270 NSPR_API(void) PR_NTFast_UpdateAcceptContext(PRFileDesc *acceptSock,271 PRFileDesc *listenSock);272 273 274 /* FUNCTION: PR_NT_CancelIo275 ** DESCRIPTION:276 ** Cancel IO operations on fd.277 */278 NSPR_API(PRStatus) PR_NT_CancelIo(PRFileDesc *fd);279 280 281 #endif /* WIN32 */282 283 /*284 ** Need external access to this on Mac so we can first set up our faux285 ** environment vars286 */287 #ifdef XP_MAC288 NSPR_API(void) PR_Init_Log(void);289 #endif290 291 292 204 PR_END_EXTERN_C 293 205 -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h
r101843 r101869 54 54 typedef struct PRSegment PRSegment; 55 55 56 #ifdef XP_MAC57 #include "prosdep.h"58 #include "probslet.h"59 #else60 56 #include "md/prosdep.h" 61 57 #include "obsolete/probslet.h" 62 #endif /* XP_MAC */63 58 64 59 #ifdef _PR_HAVE_POSIX_SEMAPHORES … … 748 743 #define _PR_MD_QUERY_FD_INHERITABLE _MD_QUERY_FD_INHERITABLE 749 744 750 #ifdef XP_BEOS751 752 extern PRLock *_connectLock;753 754 typedef struct _ConnectListNode {755 PRInt32 osfd;756 PRNetAddr addr;757 PRUint32 addrlen;758 PRIntervalTime timeout;759 } ConnectListNode;760 761 extern ConnectListNode connectList[64];762 763 extern PRUint32 connectCount;764 765 #endif /* XP_BEOS */766 767 745 PR_END_EXTERN_C 768 746 -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/prpriv.h
r1 r101869 43 43 */ 44 44 45 #ifndef XP_MAC46 45 #include "private/pprio.h" 47 46 #include "private/pprthred.h" 48 #else 49 #include "pprio.h" 50 #include "pprthred.h" 51 #endif 47 52 48 53 49 #endif /* prpriv_h___ */ -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/prtypes.h
r101806 r101869 82 82 ** 83 83 ***********************************************************************/ 84 #if defined(WIN32) 85 86 #define PR_EXPORT(__type) extern __declspec(dllexport) __type 87 #define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type 88 #define PR_IMPORT(__type) __declspec(dllimport) __type 89 #define PR_IMPORT_DATA(__type) __declspec(dllimport) __type 90 91 #define PR_EXTERN(__type) extern __declspec(dllexport) __type 92 #define PR_IMPLEMENT(__type) __declspec(dllexport) __type 93 #define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type 94 #define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type 95 96 #define PR_CALLBACK 97 #define PR_CALLBACK_DECL 98 #define PR_STATIC_CALLBACK(__x) static __x 99 100 #elif defined(XP_BEOS) 101 102 #define PR_EXPORT(__type) extern __declspec(dllexport) __type 103 #define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type 104 #define PR_IMPORT(__type) extern __declspec(dllexport) __type 105 #define PR_IMPORT_DATA(__type) extern __declspec(dllexport) __type 106 107 #define PR_EXTERN(__type) extern __declspec(dllexport) __type 108 #define PR_IMPLEMENT(__type) __declspec(dllexport) __type 109 #define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type 110 #define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type 111 112 #define PR_CALLBACK 113 #define PR_CALLBACK_DECL 114 #define PR_STATIC_CALLBACK(__x) static __x 115 116 #elif defined(WIN16) 117 118 #define PR_CALLBACK_DECL __cdecl 119 120 #if defined(_WINDLL) 121 #define PR_EXPORT(__type) extern __type _cdecl _export _loadds 122 #define PR_IMPORT(__type) extern __type _cdecl _export _loadds 123 #define PR_EXPORT_DATA(__type) extern __type _export 124 #define PR_IMPORT_DATA(__type) extern __type _export 125 126 #define PR_EXTERN(__type) extern __type _cdecl _export _loadds 127 #define PR_IMPLEMENT(__type) __type _cdecl _export _loadds 128 #define PR_EXTERN_DATA(__type) extern __type _export 129 #define PR_IMPLEMENT_DATA(__type) __type _export 130 131 #define PR_CALLBACK __cdecl __loadds 132 #define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK 133 134 #else /* this must be .EXE */ 135 #define PR_EXPORT(__type) extern __type _cdecl _export 136 #define PR_IMPORT(__type) extern __type _cdecl _export 137 #define PR_EXPORT_DATA(__type) extern __type _export 138 #define PR_IMPORT_DATA(__type) extern __type _export 139 140 #define PR_EXTERN(__type) extern __type _cdecl _export 141 #define PR_IMPLEMENT(__type) __type _cdecl _export 142 #define PR_EXTERN_DATA(__type) extern __type _export 143 #define PR_IMPLEMENT_DATA(__type) __type _export 144 145 #define PR_CALLBACK __cdecl __loadds 146 #define PR_STATIC_CALLBACK(__x) __x PR_CALLBACK 147 #endif /* _WINDLL */ 148 149 #elif defined(XP_MAC) 150 151 #define PR_EXPORT(__type) extern __declspec(export) __type 152 #define PR_EXPORT_DATA(__type) extern __declspec(export) __type 153 #define PR_IMPORT(__type) extern __declspec(export) __type 154 #define PR_IMPORT_DATA(__type) extern __declspec(export) __type 155 156 #define PR_EXTERN(__type) extern __declspec(export) __type 157 #define PR_IMPLEMENT(__type) __declspec(export) __type 158 #define PR_EXTERN_DATA(__type) extern __declspec(export) __type 159 #define PR_IMPLEMENT_DATA(__type) __declspec(export) __type 160 161 #define PR_CALLBACK 162 #define PR_CALLBACK_DECL 163 #define PR_STATIC_CALLBACK(__x) static __x 164 165 #elif defined(XP_OS2) && defined(__declspec) 166 167 #define PR_EXPORT(__type) extern __declspec(dllexport) __type 168 #define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type 169 #define PR_IMPORT(__type) __declspec(dllimport) __type 170 #define PR_IMPORT_DATA(__type) __declspec(dllimport) __type 171 172 #define PR_EXTERN(__type) extern __declspec(dllexport) __type 173 #define PR_IMPLEMENT(__type) __declspec(dllexport) __type 174 #define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type 175 #define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type 176 177 #define PR_CALLBACK 178 #define PR_CALLBACK_DECL 179 #define PR_STATIC_CALLBACK(__x) static __x 180 181 #elif defined(XP_OS2_VACPP) 182 183 #define PR_EXPORT(__type) extern __type 184 #define PR_EXPORT_DATA(__type) extern __type 185 #define PR_IMPORT(__type) extern __type 186 #define PR_IMPORT_DATA(__type) extern __type 187 188 #define PR_EXTERN(__type) extern __type 189 #define PR_IMPLEMENT(__type) __type 190 #define PR_EXTERN_DATA(__type) extern __type 191 #define PR_IMPLEMENT_DATA(__type) __type 192 #define PR_CALLBACK _Optlink 193 #define PR_CALLBACK_DECL 194 #define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK 195 196 #else /* Unix */ 197 198 # ifdef VBOX_HAVE_VISIBILITY_HIDDEN 199 # define PR_EXPORT(__type) __attribute__((visibility("default"))) extern __type 200 # define PR_EXPORT_DATA(__type) __attribute__((visibility("default"))) extern __type 201 # define PR_IMPORT(__type) extern __type 202 # define PR_IMPORT_DATA(__type) extern __type 203 # define PR_EXTERN(__type) __attribute__((visibility("default"))) extern __type 204 # define PR_IMPLEMENT(__type) __attribute__((visibility("default"))) __type 205 # define PR_EXTERN_DATA(__type) __attribute__((visibility("default"))) extern __type 206 # define PR_IMPLEMENT_DATA(__type) __attribute__((visibility("default"))) __type 207 # define PR_CALLBACK 208 # define PR_CALLBACK_DECL 209 # define PR_STATIC_CALLBACK(__x) static __x 210 # else 211 # define PR_EXPORT(__type) extern __type 212 # define PR_EXPORT_DATA(__type) extern __type 213 # define PR_IMPORT(__type) extern __type 214 # define PR_IMPORT_DATA(__type) extern __type 215 # define PR_EXTERN(__type) extern __type 216 # define PR_IMPLEMENT(__type) __type 217 # define PR_EXTERN_DATA(__type) extern __type 218 # define PR_IMPLEMENT_DATA(__type) __type 219 # define PR_CALLBACK 220 # define PR_CALLBACK_DECL 221 # define PR_STATIC_CALLBACK(__x) static __x 222 # endif 84 85 #ifdef VBOX_HAVE_VISIBILITY_HIDDEN 86 # define PR_EXPORT(__type) __attribute__((visibility("default"))) extern __type 87 # define PR_EXPORT_DATA(__type) __attribute__((visibility("default"))) extern __type 88 # define PR_IMPORT(__type) extern __type 89 # define PR_IMPORT_DATA(__type) extern __type 90 # define PR_EXTERN(__type) __attribute__((visibility("default"))) extern __type 91 # define PR_IMPLEMENT(__type) __attribute__((visibility("default"))) __type 92 # define PR_EXTERN_DATA(__type) __attribute__((visibility("default"))) extern __type 93 # define PR_IMPLEMENT_DATA(__type) __attribute__((visibility("default"))) __type 94 # define PR_CALLBACK 95 # define PR_CALLBACK_DECL 96 # define PR_STATIC_CALLBACK(__x) static __x 97 #else 98 # define PR_EXPORT(__type) extern __type 99 # define PR_EXPORT_DATA(__type) extern __type 100 # define PR_IMPORT(__type) extern __type 101 # define PR_IMPORT_DATA(__type) extern __type 102 # define PR_EXTERN(__type) extern __type 103 # define PR_IMPLEMENT(__type) __type 104 # define PR_EXTERN_DATA(__type) extern __type 105 # define PR_IMPLEMENT_DATA(__type) __type 106 # define PR_CALLBACK 107 # define PR_CALLBACK_DECL 108 # define PR_STATIC_CALLBACK(__x) static __x 223 109 #endif 224 110 … … 390 276 typedef long PRInt64; 391 277 typedef unsigned long PRUint64; 392 #elif defined(WIN16)393 typedef __int64 PRInt64;394 typedef unsigned __int64 PRUint64;395 #elif defined(WIN32) && !defined(__GNUC__)396 typedef __int64 PRInt64;397 typedef unsigned __int64 PRUint64;398 278 #else 399 279 typedef long long PRInt64; … … 506 386 typedef unsigned long PRUword; 507 387 508 #if defined(NO_NSPR_10_SUPPORT) 509 #else 510 /********* ???????????????? FIX ME ??????????????????????????? *****/ 511 /********************** Some old definitions until pr=>ds transition is done ***/ 512 /********************** Also, we are still using NSPR 1.0. GC ******************/ 513 /* 514 ** Fundamental NSPR macros, used nearly everywhere. 515 */ 516 517 #define PR_PUBLIC_API PR_IMPLEMENT 518 519 /* 520 ** Macro body brackets so that macros with compound statement definitions 521 ** behave syntactically more like functions when called. 522 */ 523 #define NSPR_BEGIN_MACRO do { 524 #define NSPR_END_MACRO } while (0) 525 526 /* 527 ** Macro shorthands for conditional C++ extern block delimiters. 528 */ 529 #ifdef NSPR_BEGIN_EXTERN_C 530 #undef NSPR_BEGIN_EXTERN_C 531 #endif 532 #ifdef NSPR_END_EXTERN_C 533 #undef NSPR_END_EXTERN_C 534 #endif 535 536 #ifdef __cplusplus 537 #define NSPR_BEGIN_EXTERN_C extern "C" { 538 #define NSPR_END_EXTERN_C } 539 #else 540 #define NSPR_BEGIN_EXTERN_C 541 #define NSPR_END_EXTERN_C 542 #endif 543 544 #ifdef XP_MAC 545 #include "protypes.h" 546 #else 547 #include "obsolete/protypes.h" 548 #endif 549 550 /********* ????????????? End Fix me ?????????????????????????????? *****/ 551 #endif /* NO_NSPR_10_SUPPORT */ 388 typedef uint8_t uint8; 389 typedef uint16_t uint16; 390 typedef uint32_t uint32; 391 typedef uint64_t uint64; 392 393 typedef int8_t int8; 394 typedef int16_t int16; 395 typedef int32_t int32; 396 typedef int64_t int64; 552 397 553 398 PR_END_EXTERN_C -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/prlog.c
r101805 r101869 74 74 #define _PR_LOCK_LOG() PR_Lock(_pr_logLock); 75 75 #define _PR_UNLOCK_LOG() PR_Unlock(_pr_logLock); 76 77 #if defined(XP_PC)78 #define strcasecmp stricmp79 #define strncasecmp strnicmp80 #endif81 82 /*83 * On NT, we can't define _PUT_LOG as PR_Write or _PR_MD_WRITE,84 * because every asynchronous file io operation leads to a fiber context85 * switch. So we define _PUT_LOG as fputs (from stdio.h). A side86 * benefit is that fputs handles the LF->CRLF translation. This87 * code can also be used on other platforms with file stream io.88 */89 #if defined(WIN32) || defined(XP_OS2)90 #define _PR_USE_STDIO_FOR_LOGGING91 #endif92 93 /*94 ** Coerce Win32 log output to use OutputDebugString() when95 ** NSPR_LOG_FILE is set to "WinDebug".96 */97 #if defined(XP_PC)98 #define WIN32_DEBUG_FILE (FILE*)-299 #endif100 76 101 77 /* … … 131 107 #elif defined(_PR_PTHREADS) 132 108 #define __PUT_LOG(fd, buf, nb) PR_Write(fd, buf, nb) 133 #elif defined(XP_MAC)134 #define __PUT_LOG(fd, buf, nb) _PR_MD_WRITE_SYNC(fd, buf, nb)135 109 #else 136 110 #define __PUT_LOG(fd, buf, nb) _PR_MD_WRITE(fd, buf, nb) … … 165 139 #define LINE_BUF_SIZE 512 166 140 #define DEFAULT_BUF_SIZE 16384 167 168 #ifdef _PR_NEED_STRCASECMP169 170 /*171 * strcasecmp is defined in /usr/ucblib/libucb.a on some platforms172 * such as NCR and Unixware. Linking with both libc and libucb173 * may cause some problem, so I just provide our own implementation174 * of strcasecmp here.175 */176 177 static const unsigned char uc[] =178 {179 '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',180 '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',181 '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',182 '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',183 ' ', '!', '"', '#', '$', '%', '&', '\'',184 '(', ')', '*', '+', ',', '-', '.', '/',185 '0', '1', '2', '3', '4', '5', '6', '7',186 '8', '9', ':', ';', '<', '=', '>', '?',187 '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',188 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',189 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',190 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',191 '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G',192 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',193 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',194 'X', 'Y', 'Z', '{', '|', '}', '~', '\177'195 };196 197 PRIntn strcasecmp(const char *a, const char *b)198 {199 const unsigned char *ua = (const unsigned char *)a;200 const unsigned char *ub = (const unsigned char *)b;201 202 if( ((const char *)0 == a) || (const char *)0 == b )203 return (PRIntn)(a-b);204 205 while( (uc[*ua] == uc[*ub]) && ('\0' != *a) )206 {207 a++;208 ua++;209 ub++;210 }211 212 return (PRIntn)(uc[*ua] - uc[*ub]);213 }214 215 #endif /* _PR_NEED_STRCASECMP */216 141 217 142 void _PR_InitLog(void) … … 271 196 if (ev && ev[0]) { 272 197 if (!PR_SetLogFile(ev)) { 273 #ifdef XP_PC274 char* str = PR_smprintf("Unable to create nspr log file '%s'\n", ev);275 if (str) {276 OutputDebugString(str);277 PR_smprintf_free(str);278 }279 #else280 198 fprintf(stderr, "Unable to create nspr log file '%s'\n", ev); 281 #endif282 199 } 283 200 } else { … … 455 372 } 456 373 logFile = newLogFile; 457 #if defined(XP_MAC)458 SetLogFileTypeCreator(file);459 #endif460 374 } 461 375 return (PRBool) (newLogFile != 0); … … 493 407 me = PR_GetCurrentThread(); 494 408 nb = PR_snprintf(line, sizeof(line)-1, "%ld[%p]: ", 495 #if defined(_PR_DCETHREADS)496 /* The problem is that for _PR_DCETHREADS, pthread_t is not a497 * pointer, but a structure; so you can't easily print it...498 */499 me ? &(me->id): 0L, me);500 #elif defined(_PR_BTHREADS)501 me, me);502 #else503 409 me ? me->id : 0L, me); 504 #endif505 410 506 411 nb += PR_vsnprintf(line+nb, sizeof(line)-nb-1, fmt, ap); 507 412 if (nb > 0) { 508 413 if (line[nb-1] != '\n') { 509 #ifndef XP_MAC510 line[nb++] = '\n';511 #else512 414 line[nb++] = '\015'; 513 #endif514 415 line[nb] = '\0'; 515 } else {516 #ifdef XP_MAC517 line[nb-1] = '\015';518 #endif519 416 } 520 417 } … … 554 451 } 555 452 556 #if defined(XP_OS2)557 /*558 * Added definitions for DebugBreak() for 2 different OS/2 compilers.559 * Doing the int3 on purpose for Visual Age so that a developer can560 * step over the instruction if so desired. Not always possible if561 * trapping due to exception handling IBM-AKR562 */563 #if defined(XP_OS2_VACPP)564 #include <builtin.h>565 static void DebugBreak(void) { _interrupt(3); }566 #elif defined(XP_OS2_EMX)567 static void DebugBreak(void) { asm("int $3"); }568 #else569 static void DebugBreak(void) { }570 #endif571 #endif /* XP_OS2 */572 573 453 PR_IMPLEMENT(void) PR_Assert(const char *s, const char *file, PRIntn ln) 574 454 { 575 455 PR_LogPrint("Assertion failure: %s, at %s:%d\n", s, file, ln); 576 #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)456 #if defined(XP_UNIX) 577 457 fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln); 578 458 #endif 579 #ifdef XP_MAC580 dprintf("Assertion failure: %s, at %s:%d\n", s, file, ln);581 #endif582 #if defined(WIN32) || defined(XP_OS2)583 DebugBreak();584 #endif585 #ifndef XP_MAC586 459 abort(); 587 #endif 588 } 589 590 #ifdef XP_MAC 591 PR_IMPLEMENT(void) PR_Init_Log(void) 592 { 593 _PR_InitLog(); 594 } 595 #endif 460 } 461 -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/prmapopt.c
r101805 r101869 66 66 #include "primpl.h" 67 67 68 #if defined(NEXTSTEP) 69 /* NEXTSTEP is special: this must come before netinet/tcp.h. */ 70 #include <netinet/in_systm.h> /* n_short, n_long, n_time */ 71 #endif 72 73 #if defined(XP_UNIX) || defined(OS2) || (defined(XP_BEOS) && defined(BONE_VERSION)) 68 #if defined(XP_UNIX) 74 69 #include <netinet/tcp.h> /* TCP_NODELAY, TCP_MAXSEG */ 75 70 #endif … … 85 80 ********************************************************************* 86 81 */ 87 88 #if defined(VMS)89 /*90 ** Sad but true. The DEC C header files define the following socket options91 ** differently to what UCX is expecting. The values that UCX expects are92 ** defined in SYS$LIBRARY:UCX$INETDEF.H. We redefine them here to the values93 ** that UCX expects. Note that UCX V4.x will only accept these values while94 ** UCX V5.x will accept either. So in theory this hack can be removed once95 ** UCX V5 is the minimum.96 */97 #undef IP_MULTICAST_IF98 #undef IP_MULTICAST_TTL99 #undef IP_MULTICAST_LOOP100 #undef IP_ADD_MEMBERSHIP101 #undef IP_DROP_MEMBERSHIP102 #include <ucx$inetdef.h>103 #define IP_MULTICAST_IF UCX$C_IP_MULTICAST_IF104 #define IP_MULTICAST_TTL UCX$C_IP_MULTICAST_TTL105 #define IP_MULTICAST_LOOP UCX$C_IP_MULTICAST_LOOP106 #define IP_ADD_MEMBERSHIP UCX$C_IP_ADD_MEMBERSHIP107 #define IP_DROP_MEMBERSHIP UCX$C_IP_DROP_MEMBERSHIP108 #endif109 82 110 83 /* … … 129 102 #if !defined(SO_LINGER) 130 103 #error "SO_LINGER is not defined" 131 #endif132 133 /*134 * Some platforms, such as NCR 2.03, don't have TCP_NODELAY defined135 * in <netinet/tcp.h>136 */137 #if !defined(NCR)138 #if !defined(TCP_NODELAY)139 #error "TCP_NODELAY is not defined"140 #endif141 104 #endif 142 105 -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/linking/prlink.c
r101840 r101869 196 196 /* initialize pr_currentLibPath */ 197 197 198 #if defined(XP_UNIX) || defined(XP_BEOS)199 #if defined(USE_DLFCN) || defined(USE_MACH_DYLD) || defined(XP_BEOS)198 #if defined(XP_UNIX) 199 #if defined(USE_DLFCN) || defined(USE_MACH_DYLD) 200 200 { 201 201 char *p=NULL; … … 251 251 char *fullname; 252 252 253 #if defined(XP_UNIX) || defined(XP_BEOS)253 #if defined(XP_UNIX) 254 254 if (strstr(lib, PR_DLL_SUFFIX) == NULL) 255 255 { … … 266 266 } 267 267 } 268 #endif /* XP_UNIX || XP_BEOS*/268 #endif /* XP_UNIX */ 269 269 return fullname; 270 270 } -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/md/prosdep.c
r1 r101869 42 42 #include <unistd.h> 43 43 #endif 44 #ifdef SUNOS445 #include "md/sunos4.h"46 #endif47 #ifdef _WIN3248 #include <windows.h>49 #endif50 #ifdef XP_BEOS51 #include <OS.h>52 #endif53 44 54 45 PRInt32 _pr_pageShift; … … 68 59 || defined DARWIN || defined NEXTSTEP 69 60 _pr_pageSize = getpagesize(); 70 #elif defined(HPUX)71 /* I have no idea. Don't get me started. --Rob */72 _pr_pageSize = sysconf(_SC_PAGE_SIZE);73 61 #else 74 62 _pr_pageSize = sysconf(_SC_PAGESIZE); 75 63 #endif 76 64 #endif /* XP_UNIX */ 77 78 #ifdef XP_MAC79 _pr_pageSize = 4096;80 #endif /* XP_MAC */81 82 #ifdef XP_BEOS83 _pr_pageSize = B_PAGE_SIZE;84 #endif85 86 #ifdef XP_PC87 #ifdef _WIN3288 SYSTEM_INFO info;89 GetSystemInfo(&info);90 _pr_pageSize = info.dwPageSize;91 #else92 _pr_pageSize = 4096;93 #endif94 #endif /* XP_PC */95 65 96 66 pageSize = _pr_pageSize; -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prenv.c
r101810 r101869 92 92 } 93 93 94 /*95 ** DEPRECATED. Use PR_SetEnv() instead.96 */97 #ifdef XP_MAC98 PR_IMPLEMENT(PRIntn) PR_PutEnv(const char *string)99 {100 return (PR_SetEnv(string) == PR_SUCCESS) ? PR_TRUE : PR_FALSE;101 }102 #endif -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prinit.c
r101839 r101869 126 126 PRInt32 _native_threads_only = 0; 127 127 128 #ifdef WINNT129 static void _pr_SetNativeThreadsOnlyMode(void)130 {131 HMODULE mainExe;132 PRBool *globalp;133 char *envp;134 135 mainExe = GetModuleHandle(NULL);136 PR_ASSERT(NULL != mainExe);137 globalp = (PRBool *) GetProcAddress(mainExe, "nspr_native_threads_only");138 if (globalp) {139 _native_threads_only = (*globalp != PR_FALSE);140 } else if (envp = getenv("NSPR_NATIVE_THREADS_ONLY")) {141 _native_threads_only = (atoi(envp) == 1);142 }143 }144 #endif145 146 #if !defined(_PR_INET6) || defined(_PR_INET6_PROBE)147 extern PRStatus _pr_init_ipv6(void);148 #endif149 150 128 static void _PR_InitStuff(void) 151 129 { … … 156 134 RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE); 157 135 #endif 158 #ifdef WINNT159 _pr_SetNativeThreadsOnlyMode();160 #endif161 162 136 163 137 (void) PR_GetPageSize(); … … 226 200 PRThreadType type, PRThreadPriority priority, PRUintn maxPTDs) 227 201 { 228 #if defined(XP_MAC)229 #pragma unused (type, priority, maxPTDs)230 #endif231 232 202 _PR_ImplicitInitialization(); 233 203 } … … 236 206 PRPrimordialFn prmain, PRIntn argc, char **argv, PRUintn maxPTDs) 237 207 { 238 #if defined(XP_MAC)239 #pragma unused (maxPTDs)240 #endif241 242 208 PRIntn rv; 243 209 _PR_ImplicitInitialization(); … … 602 568 { 603 569 #if defined(DEBUG) 604 #ifndef XP_MAC605 570 PR_fprintf( 606 571 PR_STDERR, "'%s' is obsolete. Use '%s' instead.\n", 607 572 obsolete, (NULL == preferred) ? "something else" : preferred); 608 #else609 #pragma unused (obsolete, preferred)610 #endif611 573 #endif 612 574 return PR_FALSE; -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prtime.c
r62263 r101869 51 51 #include <string.h> 52 52 #include <ctype.h> 53 54 #ifdef XP_MAC55 #include <time.h>56 #endif57 58 59 60 53 61 54 /* … … 247 240 *------------------------------------------------------------------------ 248 241 */ 249 #if defined(HAVE_WATCOM_BUG_2)250 PRTime __pascal __export __loadds251 #else252 242 PR_IMPLEMENT(PRTime) 253 #endif254 243 PR_ImplodeTime(const PRExplodedTime *exploded) 255 244 { … … 566 555 #else 567 556 568 #if defined(XP_MAC)569 extern struct tm *Maclocaltime(const time_t * t);570 #endif571 572 557 static PRLock *monitor = NULL; 573 558 … … 602 587 */ 603 588 604 #if defined(XP_MAC)605 tmPtr = Maclocaltime(clock);606 #else607 589 tmPtr = localtime(clock); 608 #endif609 610 #if defined(WIN16) || defined(XP_OS2_EMX)611 if ( (PRInt32) *clock < 0 ||612 ( (PRInt32) *clock == 0 && tmPtr->tm_year != 70))613 result = NULL;614 else615 *result = *tmPtr;616 #else617 590 if (tmPtr) { 618 591 *result = *tmPtr; … … 620 593 result = NULL; 621 594 } 622 #endif /* WIN16 */623 624 595 if (needLock) PR_Unlock(monitor); 625 596 … … 629 600 #endif /* definition of MT_safe_localtime() */ 630 601 631 #if defined(XP_UNIX) || defined(XP_PC) || defined(XP_BEOS)602 #if defined(XP_UNIX) 632 603 633 604 PR_IMPLEMENT(PRTimeParameters) … … 764 735 } 765 736 766 #endif /* defined(XP_UNIX) !! defined(XP_PC)*/737 #endif /* defined(XP_UNIX) */ 767 738 768 739 /* … … 884 855 PR_GMTParameters(const PRExplodedTime *gmt) 885 856 { 886 #if defined(XP_MAC)887 #pragma unused (gmt)888 #endif889 890 857 PRTimeParameters retVal = { 0, 0 }; 891 858 return retVal; … … 1589 1556 if (secs != (time_t) -1) 1590 1557 { 1591 #if defined(XP_MAC) && (__MSL__ < 0x6000)1592 /*1593 * The mktime() routine in MetroWerks MSL C1594 * Runtime library returns seconds since midnight,1595 * 1 Jan. 1900, not 1970 - in versions of MSL (Metrowerks Standard1596 * Library) prior to version 6. Only for older versions of1597 * MSL do we adjust the value of secs to the NSPR epoch1598 */1599 secs -= ((365 * 70UL) + 17) * 24 * 60 * 60;1600 #endif1601 1558 LL_I2L(*result, secs); 1602 1559 LL_I2L(usec_per_sec, PR_USEC_PER_SEC); … … 1671 1628 */ 1672 1629 1673 #if defined(SUNOS4) || (__GLIBC__ >= 2) || defined(XP_BEOS)\1630 #if defined(SUNOS4) || (__GLIBC__ >= 2) \ 1674 1631 || defined(NETBSD) || defined(OPENBSD) || defined(FREEBSD) \ 1675 1632 || defined(DARWIN) -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/threads/prtpd.c
r1 r101869 58 58 */ 59 59 60 /*61 ** As of this time, BeOS has its own TPD implementation. Integrating62 ** this standard one is a TODO for anyone with a bit of spare time on63 ** their hand. For now, we just #ifdef out this whole file and use64 ** the routines in pr/src/btthreads/65 */66 67 #ifndef XP_BEOS68 69 60 #include "primpl.h" 70 61 71 62 #include <string.h> 72 73 #if defined(WIN95)74 /*75 ** Some local variables report warnings on Win95 because the code paths76 ** using them are conditioned on HAVE_CUSTOME_USER_THREADS.77 ** The pragma suppresses the warning.78 **79 */80 #pragma warning(disable : 4101)81 #endif82 63 83 64 #define _PR_TPD_LIMIT 128 /* arbitary limit on the TPD slots */ … … 278 259 } /* _PR_DestroyThreadPrivate */ 279 260 280 #endif /* !XP_BEOS */
Note:
See TracChangeset
for help on using the changeset viewer.