diff options
Diffstat (limited to 'nsprpub/pr')
51 files changed, 588 insertions, 462 deletions
diff --git a/nsprpub/pr/include/md/_darwin.h b/nsprpub/pr/include/md/_darwin.h index b3f89fbf8d..1d79d3d82d 100644 --- a/nsprpub/pr/include/md/_darwin.h +++ b/nsprpub/pr/include/md/_darwin.h @@ -40,7 +40,11 @@ #undef HAVE_STACK_GROWING_UP #define HAVE_DLL +#if defined(__x86_64__) || TARGET_OS_IPHONE #define USE_DLFCN +#else +#define USE_MACH_DYLD +#endif #define _PR_HAVE_SOCKADDR_LEN #define _PR_STAT_HAS_ST_ATIMESPEC #define _PR_HAVE_LARGE_OFF_T @@ -120,16 +124,7 @@ extern PRInt32 _PR_Darwin_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val); #define _MD_ATOMIC_ADD(ptr, val) _PR_Darwin_x86_64_AtomicAdd(ptr, val) #endif /* __x86_64__ */ -#ifdef __aarch64__ -#define _PR_HAVE_ATOMIC_OPS -#define _MD_INIT_ATOMIC() -#define _MD_ATOMIC_INCREMENT(val) __sync_add_and_fetch(val, 1) -#define _MD_ATOMIC_DECREMENT(val) __sync_sub_and_fetch(val, 1) -#define _MD_ATOMIC_SET(val, newval) __sync_lock_test_and_set(val, newval) -#define _MD_ATOMIC_ADD(ptr, val) __sync_add_and_fetch(ptr, val) -#endif /* __aarch64__ */ - -#if defined(__arm__) +#if defined(__arm__) || defined(__aarch64__) #define _PR_HAVE_ATOMIC_OPS #define _MD_INIT_ATOMIC() #define _MD_ATOMIC_INCREMENT(val) OSAtomicIncrement32(val) @@ -143,7 +138,7 @@ static inline PRInt32 _MD_ATOMIC_SET(PRInt32 *val, PRInt32 newval) return oldval; } #define _MD_ATOMIC_ADD(ptr, val) OSAtomicAdd32(val, ptr) -#endif /* __arm__ */ +#endif /* __arm__ || __aarch64__ */ #define USE_SETJMP diff --git a/nsprpub/pr/include/md/_linux.cfg b/nsprpub/pr/include/md/_linux.cfg index 23b160fde2..b0e67c1373 100644 --- a/nsprpub/pr/include/md/_linux.cfg +++ b/nsprpub/pr/include/md/_linux.cfg @@ -1157,8 +1157,7 @@ #define PR_BYTES_PER_WORD_LOG2 2 #define PR_BYTES_PER_DWORD_LOG2 3 -#elif defined(__nios2__) || defined(__microblaze__) || defined(__nds32__) || \ - defined(__xtensa__) +#elif defined(__nios2__) || defined(__microblaze__) || defined(__nds32__) #if defined(__microblaze__) && defined(__BIG_ENDIAN__) #define IS_BIG_ENDIAN 1 @@ -1208,53 +1207,6 @@ #define PR_BYTES_PER_WORD_LOG2 2 #define PR_BYTES_PER_DWORD_LOG2 3 -#elif defined(__e2k__) - -#define IS_LITTLE_ENDIAN 1 -#undef IS_BIG_ENDIAN - -#define IS_64 - -#define PR_BYTES_PER_BYTE 1 -#define PR_BYTES_PER_SHORT 2 -#define PR_BYTES_PER_INT 4 -#define PR_BYTES_PER_INT64 4 -#define PR_BYTES_PER_LONG 8 -#define PR_BYTES_PER_FLOAT 4 -#define PR_BYTES_PER_DOUBLE 8 -#define PR_BYTES_PER_WORD 8 -#define PR_BYTES_PER_DWORD 8 - -#define PR_BITS_PER_BYTE 8 -#define PR_BITS_PER_SHORT 16 -#define PR_BITS_PER_INT 32 -#define PR_BITS_PER_INT64 32 -#define PR_BITS_PER_LONG 64 -#define PR_BITS_PER_FLOAT 32 -#define PR_BITS_PER_DOUBLE 64 -#define PR_BITS_PER_WORD 64 - -#define PR_BITS_PER_BYTE_LOG2 3 -#define PR_BITS_PER_SHORT_LOG2 4 -#define PR_BITS_PER_INT_LOG2 5 -#define PR_BITS_PER_INT64_LOG2 5 -#define PR_BITS_PER_LONG_LOG2 6 -#define PR_BITS_PER_FLOAT_LOG2 5 -#define PR_BITS_PER_DOUBLE_LOG2 6 -#define PR_BITS_PER_WORD_LOG2 6 - -#define PR_ALIGN_OF_SHORT 2 -#define PR_ALIGN_OF_INT 4 -#define PR_ALIGN_OF_LONG 8 -#define PR_ALIGN_OF_INT64 4 -#define PR_ALIGN_OF_FLOAT 4 -#define PR_ALIGN_OF_DOUBLE 8 -#define PR_ALIGN_OF_POINTER 8 -#define PR_ALIGN_OF_WORD 8 - -#define PR_BYTES_PER_WORD_LOG2 3 -#define PR_BYTES_PER_DWORD_LOG2 3 - #else #error "Unknown CPU architecture" diff --git a/nsprpub/pr/include/md/_linux.h b/nsprpub/pr/include/md/_linux.h index a26291a806..3226a04b38 100644 --- a/nsprpub/pr/include/md/_linux.h +++ b/nsprpub/pr/include/md/_linux.h @@ -37,6 +37,8 @@ #define _PR_SI_ARCHITECTURE "sparc" #elif defined(__i386__) #define _PR_SI_ARCHITECTURE "x86" +#elif defined(__mips64__) +#define _PR_SI_ARCHITECTURE "mips64" #elif defined(__mips__) #define _PR_SI_ARCHITECTURE "mips" #elif defined(__arm__) @@ -61,8 +63,6 @@ #define _PR_SI_ARCHITECTURE "riscv32" #elif defined(__riscv) && (__riscv_xlen == 64) #define _PR_SI_ARCHITECTURE "riscv64" -#elif defined(__e2k__) -#define _PR_SI_ARCHITECTURE "e2k" #elif defined(__arc__) #define _PR_SI_ARCHITECTURE "arc" #elif defined(__nios2__) @@ -71,8 +71,6 @@ #define _PR_SI_ARCHITECTURE "microblaze" #elif defined(__nds32__) #define _PR_SI_ARCHITECTURE "nds32" -#elif defined(__xtensa__) -#define _PR_SI_ARCHITECTURE "xtensa" #else #error "Unknown CPU architecture" #endif diff --git a/nsprpub/pr/include/md/_netbsd.h b/nsprpub/pr/include/md/_netbsd.h index 1ec0fe6ec8..b262acee60 100644 --- a/nsprpub/pr/include/md/_netbsd.h +++ b/nsprpub/pr/include/md/_netbsd.h @@ -25,6 +25,8 @@ #define _PR_SI_ARCHITECTURE "sparc64" #elif defined(__sparc__) #define _PR_SI_ARCHITECTURE "sparc" +#elif defined(__mips64__) +#define _PR_SI_ARCHITECTURE "mips64" #elif defined(__mips__) #define _PR_SI_ARCHITECTURE "mips" #elif defined(__arm32__) || defined(__arm__) || defined(__armel__) \ diff --git a/nsprpub/pr/include/prinit.h b/nsprpub/pr/include/prinit.h index b00fe2c065..eb3cfa059a 100644 --- a/nsprpub/pr/include/prinit.h +++ b/nsprpub/pr/include/prinit.h @@ -31,9 +31,9 @@ PR_BEGIN_EXTERN_C ** The format of the version string is ** "<major version>.<minor version>[.<patch level>] [<Beta>]" */ -#define PR_VERSION "4.29" +#define PR_VERSION "4.24" #define PR_VMAJOR 4 -#define PR_VMINOR 29 +#define PR_VMINOR 24 #define PR_VPATCH 0 #define PR_BETA PR_FALSE diff --git a/nsprpub/pr/include/prsystem.h b/nsprpub/pr/include/prsystem.h index 577e60e061..1b9c7ed854 100644 --- a/nsprpub/pr/include/prsystem.h +++ b/nsprpub/pr/include/prsystem.h @@ -43,9 +43,8 @@ typedef enum { PR_SI_SYSNAME, PR_SI_RELEASE, PR_SI_ARCHITECTURE, - PR_SI_HOSTNAME_UNTRUNCATED, /* the hostname exactly as configured + PR_SI_HOSTNAME_UNTRUNCATED /* the hostname exactly as configured * on the system */ - PR_SI_RELEASE_BUILD } PRSysInfo; diff --git a/nsprpub/pr/src/Makefile.in b/nsprpub/pr/src/Makefile.in index d7c633daf5..2258dae614 100644 --- a/nsprpub/pr/src/Makefile.in +++ b/nsprpub/pr/src/Makefile.in @@ -159,6 +159,10 @@ ifeq ($(OS_TARGET),Android) OS_LIBS += -llog endif +ifeq ($(OS_TARGET),MacOSX) +OS_LIBS = -framework CoreServices -framework CoreFoundation +endif + EXTRA_LIBS += $(OS_LIBS) # diff --git a/nsprpub/pr/src/linking/prlink.c b/nsprpub/pr/src/linking/prlink.c index 011ff17e6b..4e73d9df1c 100644 --- a/nsprpub/pr/src/linking/prlink.c +++ b/nsprpub/pr/src/linking/prlink.c @@ -7,6 +7,11 @@ #include <string.h> +#if defined(XP_MACOSX) && defined(USE_MACH_DYLD) +#include <Carbon/Carbon.h> +#include <CoreFoundation/CoreFoundation.h> +#endif + #ifdef XP_UNIX #ifdef USE_DLFCN #include <dlfcn.h> @@ -31,6 +36,8 @@ #endif #elif defined(USE_HPSHL) #include <dl.h> +#elif defined(USE_MACH_DYLD) +#include <mach-o/dyld.h> #endif #endif /* XP_UNIX */ @@ -39,7 +46,8 @@ /* * On these platforms, symbols have a leading '_'. */ -#if defined(XP_OS2) \ +#if (defined(DARWIN) && defined(USE_MACH_DYLD)) \ + || defined(XP_OS2) \ || ((defined(OPENBSD) || defined(NETBSD)) && !defined(__ELF__)) #define NEED_LEADING_UNDERSCORE #endif @@ -62,9 +70,19 @@ struct PRLibrary { #endif #endif +#if defined(XP_MACOSX) && defined(USE_MACH_DYLD) + CFragConnectionID connection; + CFBundleRef bundle; + Ptr main; + CFMutableDictionaryRef wrappers; + const struct mach_header* image; +#endif + #ifdef XP_UNIX #if defined(USE_HPSHL) shl_t dlh; +#elif defined(USE_MACH_DYLD) + NSModule dlh; #else void* dlh; #endif @@ -152,7 +170,7 @@ void _PR_InitLinker(void) #elif defined(USE_HPSHL) h = NULL; /* don't abort with this NULL */ -#elif defined(NO_DLOPEN_NULL) +#elif defined(USE_MACH_DYLD) || defined(NO_DLOPEN_NULL) h = NULL; /* XXXX toshok */ /* XXXX vlad */ #else #error no dll strategy @@ -252,7 +270,7 @@ PR_GetLibraryPath(void) #endif #if defined(XP_UNIX) -#if defined(USE_DLFCN) +#if defined(USE_DLFCN) || defined(USE_MACH_DYLD) { char *p=NULL; int len; @@ -410,6 +428,203 @@ PR_LoadLibrary(const char *name) return PR_LoadLibraryWithFlags(libSpec, 0); } +#if defined(USE_MACH_DYLD) +static NSModule +pr_LoadMachDyldModule(const char *name) +{ + NSObjectFileImage ofi; + NSModule h = NULL; + if (NSCreateObjectFileImageFromFile(name, &ofi) + == NSObjectFileImageSuccess) { + h = NSLinkModule(ofi, name, NSLINKMODULE_OPTION_PRIVATE + | NSLINKMODULE_OPTION_RETURN_ON_ERROR); + if (h == NULL) { + NSLinkEditErrors linkEditError; + int errorNum; + const char *fileName; + const char *errorString; + NSLinkEditError(&linkEditError, &errorNum, &fileName, &errorString); + PR_LOG(_pr_linker_lm, PR_LOG_MIN, + ("LoadMachDyldModule error %d:%d for file %s:\n%s", + linkEditError, errorNum, fileName, errorString)); + } + if (NSDestroyObjectFileImage(ofi) == FALSE) { + if (h) { + (void)NSUnLinkModule(h, NSUNLINKMODULE_OPTION_NONE); + h = NULL; + } + } + } + return h; +} +#endif + +#if defined(XP_MACOSX) && defined(USE_MACH_DYLD) + +/* +** macLibraryLoadProc is a function definition for a Mac shared library +** loading method. The "name" param is the same full or partial pathname +** that was passed to pr_LoadLibraryByPathName. The function must fill +** in the fields of "lm" which apply to its library type. Returns +** PR_SUCCESS if successful. +*/ + +typedef PRStatus (*macLibraryLoadProc)(const char *name, PRLibrary *lm); + +#ifdef __ppc__ + +/* +** CFM and its TVectors only exist on PowerPC. Other OS X architectures +** only use Mach-O as a native binary format. +*/ + +static void* TV2FP(CFMutableDictionaryRef dict, const char* name, void *tvp) +{ + static uint32 glue[6] = { 0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420 }; + uint32* newGlue = NULL; + + if (tvp != NULL) { + CFStringRef nameRef = CFStringCreateWithCString(NULL, name, kCFStringEncodingASCII); + if (nameRef) { + CFMutableDataRef glueData = (CFMutableDataRef) CFDictionaryGetValue(dict, nameRef); + if (glueData == NULL) { + glueData = CFDataCreateMutable(NULL, sizeof(glue)); + if (glueData != NULL) { + newGlue = (uint32*) CFDataGetMutableBytePtr(glueData); + memcpy(newGlue, glue, sizeof(glue)); + newGlue[0] |= ((UInt32)tvp >> 16); + newGlue[1] |= ((UInt32)tvp & 0xFFFF); + MakeDataExecutable(newGlue, sizeof(glue)); + CFDictionaryAddValue(dict, nameRef, glueData); + CFRelease(glueData); + + PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("TV2FP: created wrapper for CFM function %s().", name)); + } + } else { + PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("TV2FP: found wrapper for CFM function %s().", name)); + + newGlue = (uint32*) CFDataGetMutableBytePtr(glueData); + } + CFRelease(nameRef); + } + } + + return newGlue; +} + +static PRStatus +pr_LoadViaCFM(const char *name, PRLibrary *lm) +{ + OSErr err; + Str255 errName; + FSRef ref; + FSSpec fileSpec; + Boolean tempUnusedBool; + + /* + * Make an FSSpec from the path name and call GetDiskFragment. + */ + + /* Use direct conversion of POSIX path to FSRef to FSSpec. */ + err = FSPathMakeRef((const UInt8*)name, &ref, NULL); + if (err != noErr) { + return PR_FAILURE; + } + err = FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, NULL, + &fileSpec, NULL); + if (err != noErr) { + return PR_FAILURE; + } + + /* Resolve an alias if this was one */ + err = ResolveAliasFile(&fileSpec, true, &tempUnusedBool, + &tempUnusedBool); + if (err != noErr) { + return PR_FAILURE; + } + + /* Finally, try to load the library */ + err = GetDiskFragment(&fileSpec, 0, kCFragGoesToEOF, fileSpec.name, + kLoadCFrag, &lm->connection, &lm->main, errName); + + if (err == noErr && lm->connection) { + /* + * if we're a mach-o binary, need to wrap all CFM function + * pointers. need a hash-table of already seen function + * pointers, etc. + */ + lm->wrappers = CFDictionaryCreateMutable(NULL, 16, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + if (lm->wrappers) { + lm->main = TV2FP(lm->wrappers, "main", lm->main); + } else { + err = memFullErr; + } + } + return (err == noErr) ? PR_SUCCESS : PR_FAILURE; +} +#endif /* __ppc__ */ + +/* +** Creates a CFBundleRef if the pathname refers to a Mac OS X bundle +** directory. The caller is responsible for calling CFRelease() to +** deallocate. +*/ + +static PRStatus +pr_LoadCFBundle(const char *name, PRLibrary *lm) +{ + CFURLRef bundleURL; + CFBundleRef bundle = NULL; + char pathBuf[PATH_MAX]; + const char *resolvedPath; + CFStringRef pathRef; + + /* Takes care of relative paths and symlinks */ + resolvedPath = realpath(name, pathBuf); + if (!resolvedPath) { + return PR_FAILURE; + } + + pathRef = CFStringCreateWithCString(NULL, pathBuf, kCFStringEncodingUTF8); + if (pathRef) { + bundleURL = CFURLCreateWithFileSystemPath(NULL, pathRef, + kCFURLPOSIXPathStyle, true); + if (bundleURL) { + bundle = CFBundleCreate(NULL, bundleURL); + CFRelease(bundleURL); + } + CFRelease(pathRef); + } + + lm->bundle = bundle; + return (bundle != NULL) ? PR_SUCCESS : PR_FAILURE; +} + +static PRStatus +pr_LoadViaDyld(const char *name, PRLibrary *lm) +{ + lm->dlh = pr_LoadMachDyldModule(name); + if (lm->dlh == NULL) { + lm->image = NSAddImage(name, NSADDIMAGE_OPTION_RETURN_ON_ERROR + | NSADDIMAGE_OPTION_WITH_SEARCHING); + if (lm->image == NULL) { + NSLinkEditErrors linkEditError; + int errorNum; + const char *fileName; + const char *errorString; + NSLinkEditError(&linkEditError, &errorNum, &fileName, &errorString); + PR_LOG(_pr_linker_lm, PR_LOG_MIN, + ("LoadMachDyldModule error %d:%d for file %s:\n%s", + linkEditError, errorNum, fileName, errorString)); + } + } + return (lm->dlh != NULL || lm->image != NULL) ? PR_SUCCESS : PR_FAILURE; +} + +#endif /* XP_MACOSX && USE_MACH_DYLD */ + /* ** Dynamically load a library. Only load libraries once, so scan the load ** map first. @@ -518,7 +733,36 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) } #endif /* WIN32 */ -#if defined(XP_UNIX) +#if defined(XP_MACOSX) && defined(USE_MACH_DYLD) + { + int i; + PRStatus status; + + static const macLibraryLoadProc loadProcs[] = { +#ifdef __ppc__ + pr_LoadViaDyld, pr_LoadCFBundle, pr_LoadViaCFM +#else /* __ppc__ */ + pr_LoadViaDyld, pr_LoadCFBundle +#endif /* __ppc__ */ + }; + + for (i = 0; i < sizeof(loadProcs) / sizeof(loadProcs[0]); i++) { + if ((status = loadProcs[i](name, lm)) == PR_SUCCESS) { + break; + } + } + if (status != PR_SUCCESS) { + oserr = cfragNoLibraryErr; + PR_DELETE(lm); + goto unlock; + } + lm->name = strdup(name); + lm->next = pr_loadmap; + pr_loadmap = lm; + } +#endif + +#if defined(XP_UNIX) && !(defined(XP_MACOSX) && defined(USE_MACH_DYLD)) #ifdef HAVE_DLL { #if defined(USE_DLFCN) @@ -563,7 +807,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) const size_t systemPrefixLen1 = strlen(systemPrefix1); const char systemPrefix2[] = "/usr/lib/"; const size_t systemPrefixLen2 = strlen(systemPrefix2); - const size_t name_len = strlen(name); + const name_len = strlen(name); if (((name_len > systemPrefixLen1) && (strncmp(name, systemPrefix1, systemPrefixLen1) == 0)) || ((name_len > systemPrefixLen2) && @@ -603,6 +847,8 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) } /* No equivalent of PR_LD_GLOBAL and PR_LD_LOCAL. */ h = shl_load(name, shl_flags, 0L); +#elif defined(USE_MACH_DYLD) + NSModule h = pr_LoadMachDyldModule(name); #else #error Configuration error #endif @@ -617,7 +863,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) pr_loadmap = lm; } #endif /* HAVE_DLL */ -#endif /* XP_UNIX */ +#endif /* XP_UNIX && !(XP_MACOSX && USE_MACH_DYLD) */ lm->refCount = 1; @@ -676,6 +922,10 @@ PR_UnloadLibrary(PRLibrary *lib) result = dlclose(lib->dlh); #elif defined(USE_HPSHL) result = shl_unload(lib->dlh); +#elif defined(USE_MACH_DYLD) + if (lib->dlh) { + result = NSUnLinkModule(lib->dlh, NSUNLINKMODULE_OPTION_NONE) ? 0 : -1; + } #else #error Configuration error #endif @@ -688,6 +938,20 @@ PR_UnloadLibrary(PRLibrary *lib) } #endif /* XP_PC */ +#if defined(XP_MACOSX) && defined(USE_MACH_DYLD) + /* Close the connection */ + if (lib->connection) { + CloseConnection(&(lib->connection)); + } + if (lib->bundle) { + CFRelease(lib->bundle); + } + if (lib->wrappers) { + CFRelease(lib->wrappers); + } + /* No way to unload an image (lib->image) */ +#endif + /* unlink from library search list */ if (pr_loadmap == lib) { pr_loadmap = pr_loadmap->next; @@ -777,6 +1041,53 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name) f = GetProcAddress(lm->dlh, name); #endif /* WIN32 */ +#if defined(XP_MACOSX) && defined(USE_MACH_DYLD) + /* add this offset to skip the leading underscore in name */ +#define SYM_OFFSET 1 + if (lm->bundle) { + CFStringRef nameRef = CFStringCreateWithCString(NULL, name + SYM_OFFSET, kCFStringEncodingASCII); + if (nameRef) { + f = CFBundleGetFunctionPointerForName(lm->bundle, nameRef); + CFRelease(nameRef); + } + } + if (lm->connection) { + Ptr symAddr; + CFragSymbolClass symClass; + Str255 pName; + + PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Looking up symbol: %s", name + SYM_OFFSET)); + + c2pstrcpy(pName, name + SYM_OFFSET); + + f = (FindSymbol(lm->connection, pName, &symAddr, &symClass) == noErr) ? symAddr : NULL; + +#ifdef __ppc__ + /* callers expect mach-o function pointers, so must wrap tvectors with glue. */ + if (f && symClass == kTVectorCFragSymbol) { + f = TV2FP(lm->wrappers, name + SYM_OFFSET, f); + } +#endif /* __ppc__ */ + + if (f == NULL && strcmp(name + SYM_OFFSET, "main") == 0) { + f = lm->main; + } + } + if (lm->image) { + NSSymbol symbol; + symbol = NSLookupSymbolInImage(lm->image, name, + NSLOOKUPSYMBOLINIMAGE_OPTION_BIND + | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR); + if (symbol != NULL) { + f = NSAddressOfSymbol(symbol); + } + else { + f = NULL; + } + } +#undef SYM_OFFSET +#endif /* XP_MACOSX && USE_MACH_DYLD */ + #ifdef XP_UNIX #ifdef HAVE_DLL #ifdef USE_DLFCN @@ -785,6 +1096,17 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name) if (shl_findsym(&lm->dlh, name, TYPE_PROCEDURE, &f) == -1) { f = NULL; } +#elif defined(USE_MACH_DYLD) + if (lm->dlh) { + NSSymbol symbol; + symbol = NSLookupSymbolInModule(lm->dlh, name); + if (symbol != NULL) { + f = NSAddressOfSymbol(symbol); + } + else { + f = NULL; + } + } #endif #endif /* HAVE_DLL */ #endif /* XP_UNIX */ @@ -967,6 +1289,23 @@ PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr) strcpy(result, dli.dli_fname); } return result; +#elif defined(USE_MACH_DYLD) + char *result; + const char *image_name; + int i, count = _dyld_image_count(); + + for (i = 0; i < count; i++) { + image_name = _dyld_get_image_name(i); + if (strstr(image_name, name) != NULL) { + result = PR_Malloc(strlen(image_name)+1); + if (result != NULL) { + strcpy(result, image_name); + } + return result; + } + } + PR_SetError(PR_LIBRARY_NOT_LOADED_ERROR, 0); + return NULL; #elif defined(AIX) char *result; #define LD_INFO_INCREMENT 64 diff --git a/nsprpub/pr/src/md/unix/os_Linux_ia64.s b/nsprpub/pr/src/md/unix/os_Linux_ia64.s index 39b724ae47..fef24ad109 100644 --- a/nsprpub/pr/src/md/unix/os_Linux_ia64.s +++ b/nsprpub/pr/src/md/unix/os_Linux_ia64.s @@ -68,4 +68,4 @@ _PR_ia64_AtomicSet: .endp _PR_ia64_AtomicSet# // Magic indicating no need for an executable stack -.section .note.GNU-stack, "", @progbits +.section .note.GNU-stack, "", @progbits ; .previous diff --git a/nsprpub/pr/src/md/unix/os_Linux_ppc.s b/nsprpub/pr/src/md/unix/os_Linux_ppc.s index 76da33bffc..a9a83174a7 100644 --- a/nsprpub/pr/src/md/unix/os_Linux_ppc.s +++ b/nsprpub/pr/src/md/unix/os_Linux_ppc.s @@ -72,4 +72,4 @@ _PR_ppc_AtomicAdd: .Lfe4: .size _PR_ppc_AtomicAdd,.Lfe4-_PR_ppc_AtomicAdd # Magic indicating no need for an executable stack -.section .note.GNU-stack, "", @progbits +.section .note.GNU-stack, "", @progbits ; .previous diff --git a/nsprpub/pr/src/md/unix/os_Linux_x86.s b/nsprpub/pr/src/md/unix/os_Linux_x86.s index 83e10b4552..a72acf5d70 100644 --- a/nsprpub/pr/src/md/unix/os_Linux_x86.s +++ b/nsprpub/pr/src/md/unix/os_Linux_x86.s @@ -82,4 +82,4 @@ _PR_x86_AtomicAdd: ret // Magic indicating no need for an executable stack -.section .note.GNU-stack, "", @progbits +.section .note.GNU-stack, "", @progbits ; .previous diff --git a/nsprpub/pr/src/md/unix/os_Linux_x86_64.s b/nsprpub/pr/src/md/unix/os_Linux_x86_64.s index f30e75d538..8e491f0e6d 100644 --- a/nsprpub/pr/src/md/unix/os_Linux_x86_64.s +++ b/nsprpub/pr/src/md/unix/os_Linux_x86_64.s @@ -71,4 +71,4 @@ _PR_x86_64_AtomicAdd: .size _PR_x86_64_AtomicAdd, .-_PR_x86_64_AtomicAdd // Magic indicating no need for an executable stack -.section .note.GNU-stack, "", @progbits +.section .note.GNU-stack, "", @progbits ; .previous diff --git a/nsprpub/pr/src/md/unix/unix.c b/nsprpub/pr/src/md/unix/unix.c index 56b58aa726..a8862a4ce5 100644 --- a/nsprpub/pr/src/md/unix/unix.c +++ b/nsprpub/pr/src/md/unix/unix.c @@ -3481,8 +3481,7 @@ PRStatus _MD_getsysinfo(PRSysInfo cmd, char *name, PRUint32 namelen) { struct utsname info; - PR_ASSERT((cmd == PR_SI_SYSNAME) || (cmd == PR_SI_RELEASE) || - (cmd == PR_SI_RELEASE_BUILD)); + PR_ASSERT((cmd == PR_SI_SYSNAME) || (cmd == PR_SI_RELEASE)); if (uname(&info) == -1) { _PR_MD_MAP_DEFAULT_ERROR(errno); @@ -3494,9 +3493,6 @@ PRStatus _MD_getsysinfo(PRSysInfo cmd, char *name, PRUint32 namelen) else if (PR_SI_RELEASE == cmd) { (void)PR_snprintf(name, namelen, info.release); } - else if (PR_SI_RELEASE_BUILD == cmd) { - (void)PR_snprintf(name, namelen, info.version); - } else { return PR_FAILURE; } diff --git a/nsprpub/pr/src/md/windows/ntio.c b/nsprpub/pr/src/md/windows/ntio.c index 40f5200789..040bbd3106 100644 --- a/nsprpub/pr/src/md/windows/ntio.c +++ b/nsprpub/pr/src/md/windows/ntio.c @@ -2252,7 +2252,6 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) int rv, err; LONG hiOffset = 0; LONG loOffset; - LARGE_INTEGER offset; /* use for a normalized add of len to offset */ if (!fd->secret->md.sync_file_io) { PRThread *me = _PR_MD_CURRENT_THREAD(); @@ -2369,14 +2368,7 @@ _PR_MD_READ(PRFileDesc *fd, void *buf, PRInt32 len) return -1; } - /* Apply the workaround from bug 70765 (see _PR_MD_WRITE) - * to the reading code, too. */ - - offset.LowPart = me->md.overlapped.overlapped.Offset; - offset.HighPart = me->md.overlapped.overlapped.OffsetHigh; - offset.QuadPart += me->md.blocked_io_bytes; - - SetFilePointer((HANDLE)f, offset.LowPart, &offset.HighPart, FILE_BEGIN); + SetFilePointer((HANDLE)f, me->md.blocked_io_bytes, 0, FILE_CURRENT); PR_ASSERT(me->io_pending == PR_FALSE); diff --git a/nsprpub/pr/src/md/windows/ntmisc.c b/nsprpub/pr/src/md/windows/ntmisc.c index 839e3de8d8..1ec6c2a5e5 100644 --- a/nsprpub/pr/src/md/windows/ntmisc.c +++ b/nsprpub/pr/src/md/windows/ntmisc.c @@ -812,8 +812,7 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen) { OSVERSIONINFO osvi; - PR_ASSERT((cmd == PR_SI_SYSNAME) || (cmd == PR_SI_RELEASE) || - (cmd == PR_SI_RELEASE_BUILD)); + PR_ASSERT((cmd == PR_SI_SYSNAME) || (cmd == PR_SI_RELEASE)); ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); @@ -828,13 +827,9 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen) if (PR_SI_SYSNAME == cmd) { (void)PR_snprintf(name, namelen, "Windows_NT"); } - else if (PR_SI_RELEASE == cmd) { + else if (PR_SI_RELEASE == cmd) (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, osvi.dwMinorVersion); - } - else if (PR_SI_RELEASE_BUILD == cmd) { - (void)PR_snprintf(name, namelen, "%d", osvi.dwBuildNumber); - } break; case VER_PLATFORM_WIN32_WINDOWS: if (PR_SI_SYSNAME == cmd) { @@ -848,8 +843,6 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen) } else if (PR_SI_RELEASE == cmd) { (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, osvi.dwMinorVersion); - } else if (PR_SI_RELEASE_BUILD == cmd) { - (void)PR_snprintf(name, namelen, "%d", osvi.dwBuildNumber); } break; #ifdef VER_PLATFORM_WIN32_CE @@ -857,15 +850,9 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen) if (PR_SI_SYSNAME == cmd) { (void)PR_snprintf(name, namelen, "Windows_CE"); } - else if (PR_SI_RELEASE == cmd) { + else if (PR_SI_RELEASE == cmd) (void)PR_snprintf(name, namelen, "%d.%d",osvi.dwMajorVersion, osvi.dwMinorVersion); - } - else if (PR_SI_RELEASE_BUILD == cmd) { - if (namelen) { - *name = 0; - } - } break; #endif default: @@ -875,11 +862,6 @@ PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen) else if (PR_SI_RELEASE == cmd) { (void)PR_snprintf(name, namelen, "%d.%d",0,0); } - else if (PR_SI_RELEASE_BUILD == cmd) { - if (namelen) { - *name = 0; - } - } break; } return PR_SUCCESS; diff --git a/nsprpub/pr/src/md/windows/w95sock.c b/nsprpub/pr/src/md/windows/w95sock.c index 5aff369be4..7d7362c608 100644 --- a/nsprpub/pr/src/md/windows/w95sock.c +++ b/nsprpub/pr/src/md/windows/w95sock.c @@ -7,9 +7,6 @@ * */ -#if defined(_WIN64) -#include <winsock2.h> -#endif #include "primpl.h" #define READ_FD 1 diff --git a/nsprpub/pr/src/misc/prdtoa.c b/nsprpub/pr/src/misc/prdtoa.c index 51b331bac8..f0963370f8 100644 --- a/nsprpub/pr/src/misc/prdtoa.c +++ b/nsprpub/pr/src/misc/prdtoa.c @@ -304,6 +304,17 @@ static double private_mem[PRIVATE_mem], *pmem_next = private_mem; #else /* ifndef Bad_float_h */ #include "float.h" +/* + * MacOS 10.2 defines the macro FLT_ROUNDS to an internal function + * which does not exist on 10.1. We can safely #define it to 1 here + * to allow 10.2 builds to run on 10.1, since we can't use fesetround() + * (which does not exist on 10.1 either). + */ +#if defined(XP_MACOSX) && (!defined(MAC_OS_X_VERSION_10_2) || \ + MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2) +#undef FLT_ROUNDS +#define FLT_ROUNDS 1 +#endif /* DT < 10.2 */ #endif /* Bad_float_h */ #ifndef __MATH_H__ diff --git a/nsprpub/pr/src/misc/prnetdb.c b/nsprpub/pr/src/misc/prnetdb.c index 0f645b6471..6ad0242d63 100644 --- a/nsprpub/pr/src/misc/prnetdb.c +++ b/nsprpub/pr/src/misc/prnetdb.c @@ -166,7 +166,9 @@ static PRBool _pr_have_inet6_if = PR_FALSE; #undef DEBUG_QUERY_IFS #if defined(AIX) \ - || (defined(DARWIN) && !defined(HAVE_GETIFADDRS)) + || (defined(DARWIN) && (!defined(HAVE_GETIFADDRS) \ + || (defined(XP_MACOSX) && (!defined(MAC_OS_X_VERSION_10_2) || \ + MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2)))) /* * Use SIOCGIFCONF ioctl on platforms that don't have routing diff --git a/nsprpub/pr/src/misc/prsystem.c b/nsprpub/pr/src/misc/prsystem.c index 109f1ed23f..825d3be0f6 100644 --- a/nsprpub/pr/src/misc/prsystem.c +++ b/nsprpub/pr/src/misc/prsystem.c @@ -152,19 +152,6 @@ PR_IMPLEMENT(PRStatus) PR_GetSystemInfo(PRSysInfo cmd, char *buf, PRUint32 bufle #endif /* OS2 */ break; - case PR_SI_RELEASE_BUILD: - /* Return the version of the operating system */ -#if defined(XP_UNIX) || defined(WIN32) - if (PR_FAILURE == _PR_MD_GETSYSINFO(cmd, buf, (PRUintn)buflen)) { - return PR_FAILURE; - } -#else - if (buflen) { - *buf = 0; - } -#endif /* XP_UNIX || WIN32 */ - break; - case PR_SI_ARCHITECTURE: /* Return the architecture of the machine (ie. x86, mips, alpha, ...)*/ (void)PR_snprintf(buf, buflen, _PR_SI_ARCHITECTURE); diff --git a/nsprpub/pr/tests/Makefile.in b/nsprpub/pr/tests/Makefile.in index a58a846927..8a87ad0949 100644 --- a/nsprpub/pr/tests/Makefile.in +++ b/nsprpub/pr/tests/Makefile.in @@ -211,7 +211,6 @@ ifdef NS_USE_GCC else EXTRA_LIBS += ws2_32.lib LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO - CFLAGS += -Fd$(@:.$(OBJ_SUFFIX)=.pdb) ifdef PROFILE LDOPTS += -PROFILE -MAP endif # profile @@ -443,4 +442,17 @@ endif ALWAYS: runtests:: $(PROGS) ALWAYS - $(topsrcdir)/pr/tests/runtests.sh $(DIST) + @$(ECHO) "\nNSPR Test Results - $(OBJDIR)\n" + @$(ECHO) "BEGIN\t\t\t`date`" + @$(ECHO) "NSPR_TEST_LOGFILE\t$(LOGFILE)\n" + @$(ECHO) "Test\t\t\tResult\n" + @cd $(OBJDIR); for i in $(PROGRAMS); do \ + $(ECHO) "$$i\c"; \ + ./$$i >> $(LOGFILE) 2>&1 ; \ + if [ 0 = $$? ] ; then \ + $(ECHO) "\t\t\tPassed"; \ + else \ + $(ECHO) "\t\t\tFAILED"; \ + fi; \ + done + @$(ECHO) "\nEND\t\t`date`\n" diff --git a/nsprpub/pr/tests/acceptread.c b/nsprpub/pr/tests/acceptread.c index 090b084555..d7fe079c4f 100644 --- a/nsprpub/pr/tests/acceptread.c +++ b/nsprpub/pr/tests/acceptread.c @@ -14,18 +14,7 @@ #include <stdlib.h> -#ifdef DEBUG -#define PORT_INC_DO +100 -#else -#define PORT_INC_DO -#endif -#ifdef IS_64 -#define PORT_INC_3264 +200 -#else -#define PORT_INC_3264 -#endif - -#define DEFAULT_PORT 12273 PORT_INC_DO PORT_INC_3264 +#define DEFAULT_PORT 12273 #define GET "GET / HTTP/1.0\n\n" static PRFileDesc *std_out, *err_out; static PRIntervalTime write_dally, accept_timeout; diff --git a/nsprpub/pr/tests/acceptreademu.c b/nsprpub/pr/tests/acceptreademu.c index 485b9d5025..75140c02f6 100644 --- a/nsprpub/pr/tests/acceptreademu.c +++ b/nsprpub/pr/tests/acceptreademu.c @@ -20,18 +20,7 @@ #include <stdlib.h> -#ifdef DEBUG -#define PORT_INC_DO +100 -#else -#define PORT_INC_DO -#endif -#ifdef IS_64 -#define PORT_INC_3264 +200 -#else -#define PORT_INC_3264 -#endif - -#define DEFAULT_PORT 12273 PORT_INC_DO PORT_INC_3264 +#define DEFAULT_PORT 12273 #define GET "GET / HTTP/1.0\n\n" static PRFileDesc *std_out, *err_out; static PRIntervalTime write_dally, accept_timeout; diff --git a/nsprpub/pr/tests/append.c b/nsprpub/pr/tests/append.c index 64fe3ff2c1..9d688a4f84 100644 --- a/nsprpub/pr/tests/append.c +++ b/nsprpub/pr/tests/append.c @@ -62,7 +62,7 @@ int main(int argc, char **argv) PL_DestroyOptState(opt); } /* end block "Get command line options" */ /* ---------------------------------------------------------------------- */ - fd = PR_Open( "./tmp-nsprAppend", (PR_APPEND | PR_CREATE_FILE | PR_TRUNCATE | PR_WRONLY), 0666 ); + fd = PR_Open( "/tmp/nsprAppend", (PR_APPEND | PR_CREATE_FILE | PR_TRUNCATE | PR_WRONLY), 0666 ); if ( NULL == fd ) { if (debug) { printf("PR_Open() failed for writing: %d\n", PR_GetError()); @@ -98,7 +98,7 @@ int main(int argc, char **argv) goto Finished; } /* ---------------------------------------------------------------------- */ - fd = PR_Open( "./tmp-nsprAppend", PR_RDONLY, 0 ); + fd = PR_Open( "/tmp/nsprAppend", PR_RDONLY, 0 ); if ( NULL == fd ) { if (debug) { printf("PR_Open() failed for reading: %d\n", PR_GetError()); diff --git a/nsprpub/pr/tests/cltsrv.c b/nsprpub/pr/tests/cltsrv.c index 2dbe4c7ae9..caf1ad4d66 100644 --- a/nsprpub/pr/tests/cltsrv.c +++ b/nsprpub/pr/tests/cltsrv.c @@ -64,20 +64,7 @@ #define DEFAULT_HIGH 0 #define BUFFER_SIZE 1024 #define DEFAULT_BACKLOG 5 - -#ifdef DEBUG -#define PORT_INC_DO +100 -#else -#define PORT_INC_DO -#endif -#ifdef IS_64 -#define PORT_INC_3264 +200 -#else -#define PORT_INC_3264 -#endif - -#define DEFAULT_PORT 12849 PORT_INC_DO PORT_INC_3264 - +#define DEFAULT_PORT 12849 #define DEFAULT_CLIENTS 1 #define ALLOWED_IN_ACCEPT 1 #define DEFAULT_CLIPPING 1000 @@ -805,16 +792,11 @@ static void PR_CALLBACK Server(void *arg) memset(&serverAddress, 0, sizeof(serverAddress)); if (PR_AF_INET6 != domain) { - TEST_LOG(cltsrv_log_file, TEST_LOG_ALWAYS, - ("server binding to ip port %s\n", DEFAULT_PORT)); rv = PR_InitializeNetAddr(PR_IpAddrAny, DEFAULT_PORT, &serverAddress); } - else { - TEST_LOG(cltsrv_log_file, TEST_LOG_ALWAYS, - ("server binding to ipv6 port %s\n", DEFAULT_PORT)); + else rv = PR_SetNetAddr(PR_IpAddrAny, PR_AF_INET6, DEFAULT_PORT, &serverAddress); - } rv = PR_Bind(server->listener, &serverAddress); TEST_ASSERT(PR_SUCCESS == rv); @@ -1149,24 +1131,16 @@ int main(int argc, char** argv) client[index].ml = PR_NewLock(); if (serverIsLocal) { - if (PR_AF_INET6 != domain) { - TEST_LOG(cltsrv_log_file, TEST_LOG_ALWAYS, - ("loopback client ip port %s\n", DEFAULT_PORT)); + if (PR_AF_INET6 != domain) (void)PR_InitializeNetAddr( PR_IpAddrLoopback, DEFAULT_PORT, &client[index].serverAddress); - } - else { - TEST_LOG(cltsrv_log_file, TEST_LOG_ALWAYS, - ("loopback client ipv6 port %s\n", DEFAULT_PORT)); + else rv = PR_SetNetAddr(PR_IpAddrLoopback, PR_AF_INET6, DEFAULT_PORT, &client[index].serverAddress); - } } else { - TEST_LOG(cltsrv_log_file, TEST_LOG_ALWAYS, - ("client enumerate port %s\n", DEFAULT_PORT)); (void)PR_EnumerateHostEnt( 0, &host, DEFAULT_PORT, &client[index].serverAddress); } diff --git a/nsprpub/pr/tests/fdcach.c b/nsprpub/pr/tests/fdcach.c index 5fa51b706a..2fb2e5b810 100644 --- a/nsprpub/pr/tests/fdcach.c +++ b/nsprpub/pr/tests/fdcach.c @@ -6,7 +6,7 @@ /* * File: fdcach.c * Description: - * This test verifies that the fd cache is working + * This test verifies that the fd cache and stack are working * correctly. */ @@ -18,7 +18,7 @@ /* * Define ORDER_PRESERVED if the implementation of PR_SetFDCacheSize * preserves the ordering of the fd's when moving them between the - * cache. + * cache and the stack. */ #define ORDER_PRESERVED 1 @@ -35,6 +35,12 @@ int main(int argc, char **argv) PRFileDesc *savefds[NUM_FDS]; int numfds = sizeof(fds)/sizeof(fds[0]); + /* + * Switch between cache and stack when they are empty. + * Then start with the fd cache. + */ + PR_SetFDCacheSize(0, FD_CACHE_SIZE); + PR_SetFDCacheSize(0, 0); PR_SetFDCacheSize(0, FD_CACHE_SIZE); /* Add some fd's to the fd cache. */ @@ -76,6 +82,59 @@ int main(int argc, char **argv) } } + /* Switch to the fd stack. */ + PR_SetFDCacheSize(0, 0); + + /* + * Create some fd's. These fd's should come from + * the fd stack. + */ + for (i = 0; i < numfds; i++) { + fds[i] = PR_NewTCPSocket(); + if (NULL == fds[i]) { + fprintf(stderr, "PR_NewTCPSocket failed\n"); + exit(1); + } +#ifdef ORDER_PRESERVED + if (fds[i] != savefds[numfds-1-i]) { + fprintf(stderr, "fd stack malfunctioned\n"); + exit(1); + } +#else + savefds[numfds-1-i] = fds[i]; +#endif + } + /* Put the fd's back to the fd stack. */ + for (i = 0; i < numfds; i++) { + if (PR_Close(savefds[i]) == PR_FAILURE) { + fprintf(stderr, "PR_Close failed\n"); + exit(1); + } + } + + /* + * Now create some fd's and verify the LIFO ordering of + * the fd stack. + */ + for (i = 0; i < numfds; i++) { + fds[i] = PR_NewTCPSocket(); + if (NULL == fds[i]) { + fprintf(stderr, "PR_NewTCPSocket failed\n"); + exit(1); + } + if (fds[i] != savefds[numfds-1-i]) { + fprintf(stderr, "fd stack malfunctioned\n"); + exit(1); + } + } + /* Put the fd's back to the fd stack. */ + for (i = 0; i < numfds; i++) { + if (PR_Close(savefds[i]) == PR_FAILURE) { + fprintf(stderr, "PR_Close failed\n"); + exit(1); + } + } + /* Switch to the fd cache. */ PR_SetFDCacheSize(0, FD_CACHE_SIZE); @@ -119,6 +178,49 @@ int main(int argc, char **argv) } } + /* Switch to the fd stack. */ + PR_SetFDCacheSize(0, 0); + + for (i = 0; i < numfds; i++) { + fds[i] = PR_NewTCPSocket(); + if (NULL == fds[i]) { + fprintf(stderr, "PR_NewTCPSocket failed\n"); + exit(1); + } +#ifdef ORDER_PRESERVED + if (fds[i] != savefds[numfds-1-i]) { + fprintf(stderr, "fd stack malfunctioned\n"); + exit(1); + } +#else + savefds[numfds-1-i]; +#endif + } + for (i = 0; i < numfds; i++) { + if (PR_Close(savefds[i]) == PR_FAILURE) { + fprintf(stderr, "PR_Close failed\n"); + exit(1); + } + } + + for (i = 0; i < numfds; i++) { + fds[i] = PR_NewTCPSocket(); + if (NULL == fds[i]) { + fprintf(stderr, "PR_NewTCPSocket failed\n"); + exit(1); + } + if (fds[i] != savefds[numfds-1-i]) { + fprintf(stderr, "fd stack malfunctioned\n"); + exit(1); + } + } + for (i = 0; i < numfds; i++) { + if (PR_Close(savefds[i]) == PR_FAILURE) { + fprintf(stderr, "PR_Close failed\n"); + exit(1); + } + } + PR_Cleanup(); printf("PASS\n"); return 0; diff --git a/nsprpub/pr/tests/foreign.c b/nsprpub/pr/tests/foreign.c index a1f5b5cbcc..a711b7580b 100644 --- a/nsprpub/pr/tests/foreign.c +++ b/nsprpub/pr/tests/foreign.c @@ -223,8 +223,7 @@ static void OneShot(void *arg) break; case 6: -#define TEMP_DIR "./tmp" - PR_MkDir(TEMP_DIR, 0700); +#define TEMP_DIR "/tmp/" dir = PR_OpenDir(TEMP_DIR); DPRINTF((output,"Thread[0x%x] called PR_OpenDir\n", PR_GetCurrentThread())); diff --git a/nsprpub/pr/tests/fsync.c b/nsprpub/pr/tests/fsync.c index 3e0fb175c1..ee2eeff7d9 100644 --- a/nsprpub/pr/tests/fsync.c +++ b/nsprpub/pr/tests/fsync.c @@ -19,7 +19,7 @@ static void Help(void) PR_fprintf(err, "\t-c Nuber of iterations (default: 10)\n"); PR_fprintf(err, "\t-S Sync the file (default: FALSE)\n"); PR_fprintf(err, "\t-K Size of file (K bytes) (default: 10)\n"); - PR_fprintf(err, "\t Name of file to write (default: ./tmp-sync.dat)\n"); + PR_fprintf(err, "\t Name of file to write (default: /usr/tmp/sync.dat)\n"); PR_fprintf(err, "\t-h This message and nothing else\n"); } /* Help */ diff --git a/nsprpub/pr/tests/gethost.c b/nsprpub/pr/tests/gethost.c index 71704a8454..8a15cb61c2 100644 --- a/nsprpub/pr/tests/gethost.c +++ b/nsprpub/pr/tests/gethost.c @@ -18,7 +18,7 @@ #include <stdio.h> #include <stdlib.h> -#define DEFAULT_HOST_NAME "mozilla.org" +#define DEFAULT_HOST_NAME "mcom.com" static void Help(void) { diff --git a/nsprpub/pr/tests/layer.c b/nsprpub/pr/tests/layer.c index 8ad32eeaa8..8579394dc3 100644 --- a/nsprpub/pr/tests/layer.c +++ b/nsprpub/pr/tests/layer.c @@ -40,19 +40,7 @@ typedef enum Verbosity {silent, quiet, chatty, noisy} Verbosity; static PRIntn minor_iterations = 5; static PRIntn major_iterations = 1; static Verbosity verbosity = quiet; - -#ifdef DEBUG -#define PORT_INC_DO +100 -#else -#define PORT_INC_DO -#endif -#ifdef IS_64 -#define PORT_INC_3264 +200 -#else -#define PORT_INC_3264 -#endif - -static PRUint16 default_port = 12273 PORT_INC_DO PORT_INC_3264; +static PRUint16 default_port = 12273; static PRFileDesc *PushLayer(PRFileDesc *stack) { diff --git a/nsprpub/pr/tests/lazyinit.c b/nsprpub/pr/tests/lazyinit.c index 2a910f2051..5ec1c9578e 100644 --- a/nsprpub/pr/tests/lazyinit.c +++ b/nsprpub/pr/tests/lazyinit.c @@ -70,7 +70,7 @@ int main(int argc, char **argv) PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0); break; - case 3: file = PR_Open("./tmp-", PR_RDONLY, 0); + case 3: file = PR_Open("/usr/tmp/", PR_RDONLY, 0); break; case 4: udp = PR_NewUDPSocket(); @@ -79,7 +79,7 @@ int main(int argc, char **argv) case 5: tcp = PR_NewTCPSocket(); break; - case 6: dir = PR_OpenDir("./tmp-"); + case 6: dir = PR_OpenDir("/usr/tmp/"); break; case 7: (void)PR_NewThreadPrivateIndex(&pdkey, NULL); diff --git a/nsprpub/pr/tests/multiwait.c b/nsprpub/pr/tests/multiwait.c index 62a07f0428..243b315e89 100644 --- a/nsprpub/pr/tests/multiwait.c +++ b/nsprpub/pr/tests/multiwait.c @@ -32,20 +32,9 @@ typedef struct Shared typedef enum Verbosity {silent, quiet, chatty, noisy} Verbosity; -#ifdef DEBUG -#define PORT_INC_DO +100 -#else -#define PORT_INC_DO -#endif -#ifdef IS_64 -#define PORT_INC_3264 +200 -#else -#define PORT_INC_3264 -#endif - static PRFileDesc *debug = NULL; static PRInt32 desc_allocated = 0; -static PRUint16 default_port = 12273 PORT_INC_DO PORT_INC_3264; +static PRUint16 default_port = 12273; static enum Verbosity verbosity = quiet; static PRInt32 ops_required = 1000, ops_done = 0; static PRThreadScope thread_scope = PR_LOCAL_THREAD; diff --git a/nsprpub/pr/tests/nameshm1.c b/nsprpub/pr/tests/nameshm1.c index ca24b4e813..3f7137e23e 100644 --- a/nsprpub/pr/tests/nameshm1.c +++ b/nsprpub/pr/tests/nameshm1.c @@ -72,20 +72,9 @@ #include <string.h> #include <private/primpl.h> -#ifdef DEBUG -#define SEM_D "D" -#else -#define SEM_D -#endif -#ifdef IS_64 -#define SEM_64 "64" -#else -#define SEM_64 -#endif - -#define SEM_NAME1 "/tmp/nameshmSEM1" SEM_D SEM_64 -#define SEM_NAME2 "/tmp/nameshmSEM2" SEM_D SEM_64 -#define OPT_NAME "/tmp/xxxNSPRshm" SEM_D SEM_64 +#define SEM_NAME1 "/tmp/nameshmSEM1" +#define SEM_NAME2 "/tmp/nameshmSEM2" +#define OPT_NAME "/tmp/xxxNSPRshm" #define EXE_NAME "nameshm1" #define SEM_MODE 0666 #define SHM_MODE 0666 diff --git a/nsprpub/pr/tests/nblayer.c b/nsprpub/pr/tests/nblayer.c index 9459866972..c9e6bf245a 100644 --- a/nsprpub/pr/tests/nblayer.c +++ b/nsprpub/pr/tests/nblayer.c @@ -53,19 +53,7 @@ typedef enum Verbosity {silent, quiet, chatty, noisy} Verbosity; static PRIntn minor_iterations = 5; static PRIntn major_iterations = 1; static Verbosity verbosity = quiet; - -#ifdef DEBUG -#define PORT_INC_DO +100 -#else -#define PORT_INC_DO -#endif -#ifdef IS_64 -#define PORT_INC_3264 +200 -#else -#define PORT_INC_3264 -#endif - -static PRUint16 default_port = 12273 PORT_INC_DO PORT_INC_3264; +static PRUint16 default_port = 12273; static PRFileDesc *PushLayer(PRFileDesc *stack) { diff --git a/nsprpub/pr/tests/ntioto.c b/nsprpub/pr/tests/ntioto.c index 809e0ae5c6..5fb01e7605 100644 --- a/nsprpub/pr/tests/ntioto.c +++ b/nsprpub/pr/tests/ntioto.c @@ -57,19 +57,7 @@ PRUint32 failed_already = 0; /* JITTER_DEFAULT: the number of times AcceptThread() and JitterThread() ping-pong */ #define JITTER_DEFAULT 100000 - -#ifdef DEBUG -#define PORT_INC_DO +100 -#else -#define PORT_INC_DO -#endif -#ifdef IS_64 -#define PORT_INC_3264 +200 -#else -#define PORT_INC_3264 -#endif - -#define BASE_PORT 9867 PORT_INC_DO PORT_INC_3264 +#define BASE_PORT 9867 PRIntervalTime timeout; PRNetAddr listenAddr; diff --git a/nsprpub/pr/tests/op_filnf.c b/nsprpub/pr/tests/op_filnf.c index b4ab2fb156..1f1e8eed87 100644 --- a/nsprpub/pr/tests/op_filnf.c +++ b/nsprpub/pr/tests/op_filnf.c @@ -31,7 +31,7 @@ PRIntn error_code; int main(int argc, char **argv) { PR_STDIO_INIT(); - t1 = PR_Open("./tmp-ttools/err03.tmp", PR_TRUNCATE | PR_RDWR, 0666); + t1 = PR_Open("/usr/tmp/ttools/err03.tmp", PR_TRUNCATE | PR_RDWR, 0666); if (t1 == NULL) { if (PR_GetError() == PR_FILE_NOT_FOUND_ERROR) { printf ("error code is %d \n", PR_GetError()); diff --git a/nsprpub/pr/tests/provider.c b/nsprpub/pr/tests/provider.c index 3450b20aea..1bd15fb6fc 100644 --- a/nsprpub/pr/tests/provider.c +++ b/nsprpub/pr/tests/provider.c @@ -58,22 +58,11 @@ ** This is the beginning of the test */ -#ifdef DEBUG -#define PORT_INC_DO +100 -#else -#define PORT_INC_DO -#endif -#ifdef IS_64 -#define PORT_INC_3264 +200 -#else -#define PORT_INC_3264 -#endif - #define RECV_FLAGS 0 #define SEND_FLAGS 0 #define BUFFER_SIZE 1024 #define DEFAULT_BACKLOG 5 -#define DEFAULT_PORT 13000 PORT_INC_DO PORT_INC_3264 +#define DEFAULT_PORT 13000 #define DEFAULT_CLIENTS 1 #define ALLOWED_IN_ACCEPT 1 #define DEFAULT_CLIPPING 1000 diff --git a/nsprpub/pr/tests/runtests.pl b/nsprpub/pr/tests/runtests.pl index 326c08f862..f1ab7647e4 100755 --- a/nsprpub/pr/tests/runtests.pl +++ b/nsprpub/pr/tests/runtests.pl @@ -289,6 +289,7 @@ $prog = shift; # Program to test "logfile", "logger", "many_cv", +"multiwait", "nameshm1", "nblayer", "nonblock", diff --git a/nsprpub/pr/tests/runtests.sh b/nsprpub/pr/tests/runtests.sh index 8d3144019d..c570bf8674 100755 --- a/nsprpub/pr/tests/runtests.sh +++ b/nsprpub/pr/tests/runtests.sh @@ -4,20 +4,6 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -if test -z $1 -then - echo "usage: $0 <path-to-dist>" - exit 1 -fi - -cd $1/lib -ABS_LIB=$PWD -cd - - -export DYLD_LIBRARY_PATH=${ABS_LIB}:${DYLD_LIBRARY_PATH} -export LD_LIBRARY_PATH=${ABS_LIB}:${LD_LIBRARY_PATH} -export PATH=${ABS_LIB}:${PATH} - # # runtests.sh # Bourne shell script for nspr tests @@ -71,35 +57,12 @@ fi # #forktest (failed on IRIX) -#multiwait - fails on Linux 64bit since NSPR v 4.4 from 2004. #nbconn - fails on some platforms #poll_er - fails on some platforms? limited use? #prpoll - the bad-FD test needs to be moved to a different test #sleep - specific to OS/2 -# -# all of the following were disabled in 2019 when reenabling CI tests, -# because they failed on at least one of the platforms: -# -# cltsrv -# cvar -# gethost -# getproto -# layer -# logfile -# nameshm1 -# nblayer -# nonblock -# ntioto -# op_2long -# parent -# provider -# ranfile -# socket -# sockopt -# vercheck -#LOGFILE=${NSPR_TEST_LOGFILE:-$NULL_DEVICE} -LOGFILE=nspr-test.log +LOGFILE=${NSPR_TEST_LOGFILE:-$NULL_DEVICE} # # Tests run on all platforms @@ -117,7 +80,9 @@ atomic attach bigfile cleanup +cltsrv concur +cvar cvar2 dlltest dtoa @@ -128,6 +93,8 @@ fileio foreign formattm fsync +gethost +getproto i2l initclk inrval @@ -141,18 +108,27 @@ joinkk joinku joinuk joinuu +layer lazyinit libfilename lltest lock lockfile +logfile logger many_cv +multiwait +nameshm1 +nblayer +nonblock +ntioto ntoh +op_2long op_excl op_filnf op_filok op_nofil +parent parsetm peek perf @@ -165,8 +141,10 @@ pollable prftest prfz primblok +provider prpollml pushtop +ranfile randseed reinit rwlocktest @@ -186,6 +164,8 @@ servr_ku servr_uu short_thread sigpipe +socket +sockopt sockping sprintf stack @@ -201,6 +181,7 @@ timemac timetest tpd udpsrv +vercheck version writev xnotify @@ -230,7 +211,7 @@ printf "Test\t\t\tResult\n\n" if [ $OS_PLATFORM = "Windows_95" ] || [ $OS_PLATFORM = "Windows_98" ] || [ $OS_PLATFORM = "Windows_NT" ] || [ $OS_PLATFORM = "OS/2" ] ; then for prog in $TESTS do - printf "$prog (`date +%T`)" + printf "$prog" printf "\nBEGIN TEST: $prog\n\n" >> ${LOGFILE} 2>&1 ./$prog >> ${LOGFILE} 2>&1 if [ 0 = $? ] ; then @@ -244,7 +225,7 @@ if [ $OS_PLATFORM = "Windows_95" ] || [ $OS_PLATFORM = "Windows_98" ] || [ $OS_P else for prog in $TESTS do - printf "$prog (`date +%T`)" + printf "$prog" printf "\nBEGIN TEST: $prog\n\n" >> ${LOGFILE} 2>&1 export test_rval ./$prog >> ${LOGFILE} 2>&1 & @@ -268,10 +249,22 @@ else done fi; -if [ $rval -ne 0 ]; then - cat ${LOGFILE} -fi - printf "END\t\t\t`date`\n" exit $rval + + + + + + + + + + + + + + + + diff --git a/nsprpub/pr/tests/sel_spd.c b/nsprpub/pr/tests/sel_spd.c index 6e3f66fedd..6c17042341 100644 --- a/nsprpub/pr/tests/sel_spd.c +++ b/nsprpub/pr/tests/sel_spd.c @@ -16,22 +16,7 @@ #include <errno.h> #include <string.h> -#if defined(XP_UNIX) -#include <unistd.h> -#endif - -#ifdef DEBUG -#define PORT_INC_DO +100 -#else -#define PORT_INC_DO -#endif -#ifdef IS_64 -#define PORT_INC_3264 +200 -#else -#define PORT_INC_3264 -#endif - -#define PORT_BASE 19000 PORT_INC_DO PORT_INC_3264 +#define PORT_BASE 19000 typedef struct timer_slot_t { unsigned long d_connect; diff --git a/nsprpub/pr/tests/sema.c b/nsprpub/pr/tests/sema.c index 81ccd01b7a..76198eb047 100644 --- a/nsprpub/pr/tests/sema.c +++ b/nsprpub/pr/tests/sema.c @@ -8,19 +8,8 @@ #include <stdio.h> -#ifdef DEBUG -#define SEM_D "D" -#else -#define SEM_D -#endif -#ifdef IS_64 -#define SEM_64 "64" -#else -#define SEM_64 -#endif - -#define SEM_NAME1 "/tmp/foo.sem" SEM_D SEM_64 -#define SEM_NAME2 "/tmp/bar.sem" SEM_D SEM_64 +#define SEM_NAME1 "/tmp/foo.sem" +#define SEM_NAME2 "/tmp/bar.sem" #define SEM_MODE 0666 #define ITERATIONS 1000 diff --git a/nsprpub/pr/tests/semaerr.c b/nsprpub/pr/tests/semaerr.c index f3c253b4f4..4e6a8ff27a 100644 --- a/nsprpub/pr/tests/semaerr.c +++ b/nsprpub/pr/tests/semaerr.c @@ -8,19 +8,8 @@ #include <stdio.h> -#ifdef DEBUG -#define SEM_D "D" -#else -#define SEM_D -#endif -#ifdef IS_64 -#define SEM_64 "64" -#else -#define SEM_64 -#endif - -#define NO_SUCH_SEM_NAME "/tmp/nosuchsem.sem" SEM_D SEM_64 -#define SEM_NAME1 "/tmp/foo.sem" SEM_D SEM_64 +#define NO_SUCH_SEM_NAME "/tmp/nosuchsem.sem" +#define SEM_NAME1 "/tmp/foo.sem" #define EXE_NAME "semaerr1" #define SEM_MODE 0666 diff --git a/nsprpub/pr/tests/semaerr1.c b/nsprpub/pr/tests/semaerr1.c index 9271663d69..b2e4987230 100644 --- a/nsprpub/pr/tests/semaerr1.c +++ b/nsprpub/pr/tests/semaerr1.c @@ -8,19 +8,8 @@ #include <stdio.h> -#ifdef DEBUG -#define SEM_D "D" -#else -#define SEM_D -#endif -#ifdef IS_64 -#define SEM_64 "64" -#else -#define SEM_64 -#endif - -#define SEM_NAME1 "/tmp/foo.sem" SEM_D SEM_64 -#define SEM_NAME2 "/tmp/bar.sem" SEM_D SEM_64 +#define SEM_NAME1 "/tmp/foo.sem" +#define SEM_NAME2 "/tmp/bar.sem" #define SEM_MODE 0666 static PRBool debug_mode = PR_FALSE; diff --git a/nsprpub/pr/tests/semaping.c b/nsprpub/pr/tests/semaping.c index 3b653d524e..2f31bd0bc7 100644 --- a/nsprpub/pr/tests/semaping.c +++ b/nsprpub/pr/tests/semaping.c @@ -8,20 +8,9 @@ #include <stdio.h> -#ifdef DEBUG -#define SEM_D "D" -#else -#define SEM_D -#endif -#ifdef IS_64 -#define SEM_64 "64" -#else -#define SEM_64 -#endif - -#define SHM_NAME "/tmp/counter" SEM_D SEM_64 -#define SEM_NAME1 "/tmp/foo.sem" SEM_D SEM_64 -#define SEM_NAME2 "/tmp/bar.sem" SEM_D SEM_64 +#define SHM_NAME "/tmp/counter" +#define SEM_NAME1 "/tmp/foo.sem" +#define SEM_NAME2 "/tmp/bar.sem" #define EXE_NAME "semapong" #define SEM_MODE 0666 #define SHM_MODE 0666 diff --git a/nsprpub/pr/tests/semapong.c b/nsprpub/pr/tests/semapong.c index fd24824e31..954f90f1d9 100644 --- a/nsprpub/pr/tests/semapong.c +++ b/nsprpub/pr/tests/semapong.c @@ -8,20 +8,9 @@ #include <stdio.h> -#ifdef DEBUG -#define SEM_D "D" -#else -#define SEM_D -#endif -#ifdef IS_64 -#define SEM_64 "64" -#else -#define SEM_64 -#endif - -#define SHM_NAME "/tmp/counter" SEM_D SEM_64 -#define SEM_NAME1 "/tmp/foo.sem" SEM_D SEM_64 -#define SEM_NAME2 "/tmp/bar.sem" SEM_D SEM_64 +#define SHM_NAME "/tmp/counter" +#define SEM_NAME1 "/tmp/foo.sem" +#define SEM_NAME2 "/tmp/bar.sem" #define ITERATIONS 1000 static PRBool debug_mode = PR_FALSE; diff --git a/nsprpub/pr/tests/socket.c b/nsprpub/pr/tests/socket.c index 232898f69e..a4925350c4 100644 --- a/nsprpub/pr/tests/socket.c +++ b/nsprpub/pr/tests/socket.c @@ -45,9 +45,9 @@ char *TEST_DIR = "prdir"; char *SMALL_FILE_NAME = "prsmallf"; char *LARGE_FILE_NAME = "prlargef"; #else -char *TEST_DIR = "./tmp-prsocket_test_dir"; -char *SMALL_FILE_NAME = "./tmp-prsocket_test_dir/small_file"; -char *LARGE_FILE_NAME = "./tmp-prsocket_test_dir/large_file"; +char *TEST_DIR = "/tmp/prsocket_test_dir"; +char *SMALL_FILE_NAME = "/tmp/prsocket_test_dir/small_file"; +char *LARGE_FILE_NAME = "/tmp/prsocket_test_dir/large_file"; #endif #define SMALL_FILE_SIZE (3 * 1024) /* 3 KB */ #define SMALL_FILE_OFFSET_1 (512) diff --git a/nsprpub/pr/tests/testfile.c b/nsprpub/pr/tests/testfile.c index 79d8a05f92..99cf94ddd5 100644 --- a/nsprpub/pr/tests/testfile.c +++ b/nsprpub/pr/tests/testfile.c @@ -17,10 +17,6 @@ #include <pthread.h> #endif -#if defined(XP_UNIX) -#include <unistd.h> -#endif - #if defined(XP_OS2) #define INCL_DOSFILEMGR #include <os2.h> @@ -75,7 +71,7 @@ char *TEST_DIR = "C:\\temp\\prdir"; char *FILE_NAME = "pr_testfile"; char *HIDDEN_FILE_NAME = "hidden_pr_testfile"; #else -char *TEST_DIR = "./tmp-testfile_dir"; +char *TEST_DIR = "/tmp/testfile_dir"; char *FILE_NAME = "pr_testfile"; char *HIDDEN_FILE_NAME = ".hidden_pr_testfile"; #endif diff --git a/nsprpub/pr/tests/thruput.c b/nsprpub/pr/tests/thruput.c index 156bbde9a3..a772deaab1 100644 --- a/nsprpub/pr/tests/thruput.c +++ b/nsprpub/pr/tests/thruput.c @@ -27,20 +27,7 @@ #include "plgetopt.h" #define ADDR_BUFFER 100 - -#ifdef DEBUG -#define PORT_INC_DO +100 -#else -#define PORT_INC_DO -#endif -#ifdef IS_64 -#define PORT_INC_3264 +200 -#else -#define PORT_INC_3264 -#endif - -#define PORT_NUMBER 51877 PORT_INC_DO PORT_INC_3264 - +#define PORT_NUMBER 51877 #define SAMPLING_INTERVAL 10 #define BUFFER_SIZE (32 * 1024) diff --git a/nsprpub/pr/tests/tmoacc.c b/nsprpub/pr/tests/tmoacc.c index d7e64cbea6..a4d14daaa8 100644 --- a/nsprpub/pr/tests/tmoacc.c +++ b/nsprpub/pr/tests/tmoacc.c @@ -11,18 +11,7 @@ #include "plerror.h" #include "plgetopt.h" -#ifdef DEBUG -#define PORT_INC_DO +100 -#else -#define PORT_INC_DO -#endif -#ifdef IS_64 -#define PORT_INC_3264 +200 -#else -#define PORT_INC_3264 -#endif - -#define BASE_PORT 9867 PORT_INC_DO PORT_INC_3264 +#define BASE_PORT 9867 #define DEFAULT_THREADS 1 #define DEFAULT_BACKLOG 10 #define DEFAULT_TIMEOUT 10 diff --git a/nsprpub/pr/tests/tmocon.c b/nsprpub/pr/tests/tmocon.c index 3d992c3443..9d214bc5d2 100644 --- a/nsprpub/pr/tests/tmocon.c +++ b/nsprpub/pr/tests/tmocon.c @@ -50,18 +50,7 @@ char *getcwd(char *buf, size_t size) } #endif -#ifdef DEBUG -#define PORT_INC_DO +100 -#else -#define PORT_INC_DO -#endif -#ifdef IS_64 -#define PORT_INC_3264 +200 -#else -#define PORT_INC_3264 -#endif - -#define BASE_PORT 9867 PORT_INC_DO PORT_INC_3264 +#define BASE_PORT 9867 #define DEFAULT_DALLY 1 #define DEFAULT_THREADS 1 diff --git a/nsprpub/pr/tests/vercheck.c b/nsprpub/pr/tests/vercheck.c index 7383960300..6217e97d21 100644 --- a/nsprpub/pr/tests/vercheck.c +++ b/nsprpub/pr/tests/vercheck.c @@ -41,7 +41,7 @@ static char *compatible_version[] = { "4.10.5", "4.10.6", "4.10.7", "4.10.8", "4.10.9", "4.10.10", "4.11", "4.12", "4.13", "4.14", "4.15", "4.16", "4.17", "4.18", "4.19", "4.20", "4.21", "4.22", - "4.23", "4.24", "4.25", "4,26", "4.27", "4.28", + "4.23", PR_VERSION }; @@ -57,8 +57,8 @@ static char *incompatible_version[] = { "3.0", "3.0.1", "3.1", "3.1.1", "3.1.2", "3.1.3", "3.5", "3.5.1", - "4.29.1", - "4.30", "4.30.1", + "4.24.1", + "4.25", "4.25.1", "10.0", "11.1", "12.14.20" }; diff --git a/nsprpub/pr/tests/writev.c b/nsprpub/pr/tests/writev.c index f72f00fb44..7b761648f8 100644 --- a/nsprpub/pr/tests/writev.c +++ b/nsprpub/pr/tests/writev.c @@ -15,18 +15,7 @@ #define IOV_MAX 16 #endif -#ifdef DEBUG -#define PORT_INC_DO +100 -#else -#define PORT_INC_DO -#endif -#ifdef IS_64 -#define PORT_INC_3264 +200 -#else -#define PORT_INC_3264 -#endif - -#define BASE_PORT 9867 PORT_INC_DO PORT_INC_3264 +#define BASE_PORT 9867 int PR_CALLBACK Writev(int argc, char **argv) { |