mirror of
https://github.com/roytam1/basilisk55.git
synced 2026-05-26 15:02:46 +00:00
update NSPR to 4.24 and keep NSPR Bug 1586070 and win64 patch intact.
This commit is contained in:
@@ -26,14 +26,10 @@ mkdir HP-UXB.11.00_64_DBG.OBJ
|
||||
mkdir HP-UXB.11.00_64_OPT.OBJ
|
||||
mkdir HP-UXB.11.00_DBG.OBJ
|
||||
mkdir HP-UXB.11.00_OPT.OBJ
|
||||
mkdir IRIX6.5_n32_PTH_DBG.OBJ
|
||||
mkdir IRIX6.5_n32_PTH_OPT.OBJ
|
||||
mkdir Linux2.2_x86_glibc_PTH_DBG.OBJ
|
||||
mkdir Linux2.2_x86_glibc_PTH_OPT.OBJ
|
||||
mkdir Linux2.4_x86_glibc_PTH_DBG.OBJ
|
||||
mkdir Linux2.4_x86_glibc_PTH_OPT.OBJ
|
||||
mkdir OSF1V4.0D_DBG.OBJ
|
||||
mkdir OSF1V4.0D_OPT.OBJ
|
||||
mkdir SunOS5.6_DBG.OBJ
|
||||
mkdir SunOS5.6_OPT.OBJ
|
||||
mkdir SunOS5.7_64_DBG.OBJ
|
||||
|
||||
@@ -33,9 +33,6 @@ ln -s SunOS5.6_OPT.OBJ SunOS5.8_OPT.OBJ
|
||||
ln -s SunOS5.7_64_DBG.OBJ SunOS5.8_64_DBG.OBJ
|
||||
ln -s SunOS5.7_64_OPT.OBJ SunOS5.8_64_OPT.OBJ
|
||||
|
||||
ln -s OSF1V4.0D_DBG.OBJ OSF1V5.0_DBG.OBJ
|
||||
ln -s OSF1V4.0D_OPT.OBJ OSF1V5.0_OPT.OBJ
|
||||
|
||||
ln -s WINNT4.0_DBG.OBJ WINNT5.0_DBG.OBJ
|
||||
ln -s WINNT4.0_DBG.OBJD WINNT5.0_DBG.OBJD
|
||||
ln -s WINNT4.0_OPT.OBJ WINNT5.0_OPT.OBJ
|
||||
|
||||
@@ -48,22 +48,6 @@ ifeq (,$(filter-out QNX SCOOS UNIXWARE,$(OS_ARCH)))
|
||||
DEFINES += -DOMIT_LIB_BUILD_TIME
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), IRIX)
|
||||
ifeq ($(basename $(OS_RELEASE)),6)
|
||||
ifndef NS_USE_GCC
|
||||
ifeq ($(USE_N32),1)
|
||||
XLDOPTS += -n32 -Wl,-woff,85
|
||||
else
|
||||
ifeq ($(USE_64),1)
|
||||
XLDOPTS += -64
|
||||
else
|
||||
XLDOPTS += -32
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), HP-UX)
|
||||
ifeq ($(USE_64),1)
|
||||
XLDOPTS += +DD64
|
||||
@@ -81,7 +65,7 @@ PROGS = $(OBJDIR)/now$(PROG_SUFFIX)
|
||||
ifeq (,$(CROSS_COMPILE)$(filter-out OS2 WINNT,$(OS_ARCH)))
|
||||
TARGETS = $(PROGS)
|
||||
else
|
||||
ifeq (,$(filter-out SYMBIAN WINCE,$(OS_ARCH)))
|
||||
ifeq (,$(filter-out WINCE,$(OS_ARCH)))
|
||||
TARGETS = $(PROGS)
|
||||
else
|
||||
PROGS += $(OBJDIR)/nsinstall$(PROG_SUFFIX)
|
||||
|
||||
@@ -140,7 +140,6 @@ endif
|
||||
|
||||
MACOS_SDK_DIR = @MACOS_SDK_DIR@
|
||||
|
||||
SYMBIAN_SDK_DIR = @SYMBIAN_SDK_DIR@
|
||||
|
||||
NEXT_ROOT = @NEXT_ROOT@
|
||||
ifdef NEXT_ROOT
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#define R_STRTOK_INIT_R() \
|
||||
char *r_strtok_r=NULL
|
||||
|
||||
#define R_STRTOK_R(return,source,delim) \
|
||||
#define R_STRTOK_R(return,source,delim) \
|
||||
return=strtok_r(source,delim,&r_strtok_r)
|
||||
|
||||
#define R_STRTOK_NORET_R(source,delim) \
|
||||
@@ -68,14 +68,14 @@
|
||||
|
||||
#define R_LOCALTIME_R(val) \
|
||||
localtime_r(val,&r_localtime_r)
|
||||
|
||||
|
||||
/***********/
|
||||
/* crypt */
|
||||
/***********/
|
||||
#include <crypt.h>
|
||||
#define R_CRYPT_INIT_R() \
|
||||
CRYPTD r_cryptd_r; \
|
||||
bzero(&r_cryptd_r,sizeof(CRYPTD))
|
||||
bzero(&r_cryptd_r,sizeof(CRYPTD))
|
||||
|
||||
#define R_CRYPT_R(pass,salt) \
|
||||
crypt_r(pass,salt,&r_cryptd_r)
|
||||
|
||||
+277
-242
@@ -30,9 +30,6 @@
|
||||
|
||||
#define HAVE_FCHMOD
|
||||
|
||||
#if defined(BEOS)
|
||||
#undef HAVE_FCHMOD
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Does getcwd() take NULL as the first argument and malloc
|
||||
@@ -42,13 +39,13 @@
|
||||
#define GETCWD_CAN_MALLOC
|
||||
#endif
|
||||
|
||||
#if defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
|
||||
#if defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#if defined(SCO) || defined(UNIXWARE)
|
||||
#if !defined(S_ISLNK) && defined(S_IFLNK)
|
||||
#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
|
||||
#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -60,9 +57,9 @@ static void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s [-C cwd] [-L linkprefix] [-m mode] [-o owner] [-g group]\n"
|
||||
" %*s [-DdltR] file [file ...] directory\n",
|
||||
program, (int)strlen(program), "");
|
||||
"usage: %s [-C cwd] [-L linkprefix] [-m mode] [-o owner] [-g group]\n"
|
||||
" %*s [-DdltR] file [file ...] directory\n",
|
||||
program, (int)strlen(program), "");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
@@ -72,24 +69,27 @@ mkdirs(char *path, mode_t mode)
|
||||
char *cp;
|
||||
struct stat sb;
|
||||
int res;
|
||||
|
||||
while (*path == '/' && path[1] == '/')
|
||||
path++;
|
||||
|
||||
while (*path == '/' && path[1] == '/') {
|
||||
path++;
|
||||
}
|
||||
for (cp = strrchr(path, '/'); cp && cp != path && cp[-1] == '/'; cp--)
|
||||
;
|
||||
;
|
||||
if (cp && cp != path) {
|
||||
*cp = '\0';
|
||||
if ((stat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
|
||||
mkdirs(path, mode) < 0) {
|
||||
return -1;
|
||||
}
|
||||
*cp = '/';
|
||||
*cp = '\0';
|
||||
if ((stat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
|
||||
mkdirs(path, mode) < 0) {
|
||||
return -1;
|
||||
}
|
||||
*cp = '/';
|
||||
}
|
||||
res = mkdir(path, mode);
|
||||
if ((res != 0) && (errno == EEXIST))
|
||||
return 0;
|
||||
else
|
||||
return res;
|
||||
if ((res != 0) && (errno == EEXIST)) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
static uid_t
|
||||
@@ -100,11 +100,13 @@ touid(char *owner)
|
||||
char *cp;
|
||||
|
||||
pw = getpwnam(owner);
|
||||
if (pw)
|
||||
return pw->pw_uid;
|
||||
if (pw) {
|
||||
return pw->pw_uid;
|
||||
}
|
||||
uid = strtol(owner, &cp, 0);
|
||||
if (uid == 0 && cp == owner)
|
||||
fail("cannot find uid for %s", owner);
|
||||
if (uid == 0 && cp == owner) {
|
||||
fail("cannot find uid for %s", owner);
|
||||
}
|
||||
return uid;
|
||||
}
|
||||
|
||||
@@ -116,11 +118,13 @@ togid(char *group)
|
||||
char *cp;
|
||||
|
||||
gr = getgrnam(group);
|
||||
if (gr)
|
||||
return gr->gr_gid;
|
||||
if (gr) {
|
||||
return gr->gr_gid;
|
||||
}
|
||||
gid = strtol(group, &cp, 0);
|
||||
if (gid == 0 && cp == group)
|
||||
fail("cannot find gid for %s", group);
|
||||
if (gid == 0 && cp == group) {
|
||||
fail("cannot find gid for %s", group);
|
||||
}
|
||||
return gid;
|
||||
}
|
||||
|
||||
@@ -140,65 +144,68 @@ main(int argc, char **argv)
|
||||
onlydir = dodir = dolink = dorelsymlink = dotimes = lplen = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "C:DdlL:Rm:o:g:t")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'C':
|
||||
cwd = optarg;
|
||||
break;
|
||||
case 'D':
|
||||
onlydir = 1;
|
||||
break;
|
||||
case 'd':
|
||||
dodir = 1;
|
||||
break;
|
||||
case 'l':
|
||||
dolink = 1;
|
||||
break;
|
||||
case 'L':
|
||||
linkprefix = optarg;
|
||||
lplen = strlen(linkprefix);
|
||||
dolink = 1;
|
||||
break;
|
||||
case 'R':
|
||||
dolink = dorelsymlink = 1;
|
||||
break;
|
||||
case 'm':
|
||||
mode = strtoul(optarg, &cp, 8);
|
||||
if (mode == 0 && cp == optarg)
|
||||
usage();
|
||||
break;
|
||||
case 'o':
|
||||
owner = optarg;
|
||||
break;
|
||||
case 'g':
|
||||
group = optarg;
|
||||
break;
|
||||
case 't':
|
||||
dotimes = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
switch (opt) {
|
||||
case 'C':
|
||||
cwd = optarg;
|
||||
break;
|
||||
case 'D':
|
||||
onlydir = 1;
|
||||
break;
|
||||
case 'd':
|
||||
dodir = 1;
|
||||
break;
|
||||
case 'l':
|
||||
dolink = 1;
|
||||
break;
|
||||
case 'L':
|
||||
linkprefix = optarg;
|
||||
lplen = strlen(linkprefix);
|
||||
dolink = 1;
|
||||
break;
|
||||
case 'R':
|
||||
dolink = dorelsymlink = 1;
|
||||
break;
|
||||
case 'm':
|
||||
mode = strtoul(optarg, &cp, 8);
|
||||
if (mode == 0 && cp == optarg) {
|
||||
usage();
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
owner = optarg;
|
||||
break;
|
||||
case 'g':
|
||||
group = optarg;
|
||||
break;
|
||||
case 't':
|
||||
dotimes = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc < 2 - onlydir)
|
||||
usage();
|
||||
if (argc < 2 - onlydir) {
|
||||
usage();
|
||||
}
|
||||
|
||||
todir = argv[argc-1];
|
||||
if ((stat(todir, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
|
||||
mkdirs(todir, 0777) < 0) {
|
||||
fail("cannot make directory %s", todir);
|
||||
mkdirs(todir, 0777) < 0) {
|
||||
fail("cannot make directory %s", todir);
|
||||
}
|
||||
if (onlydir) {
|
||||
return 0;
|
||||
}
|
||||
if (onlydir)
|
||||
return 0;
|
||||
|
||||
if (!cwd) {
|
||||
#ifdef GETCWD_CAN_MALLOC
|
||||
cwd = getcwd(0, PATH_MAX);
|
||||
cwd = getcwd(0, PATH_MAX);
|
||||
#else
|
||||
cwd = malloc(PATH_MAX + 1);
|
||||
cwd = getcwd(cwd, PATH_MAX);
|
||||
cwd = malloc(PATH_MAX + 1);
|
||||
cwd = getcwd(cwd, PATH_MAX);
|
||||
#endif
|
||||
}
|
||||
xchdir(todir);
|
||||
@@ -215,120 +222,134 @@ main(int argc, char **argv)
|
||||
gid = group ? togid(group) : -1;
|
||||
|
||||
while (--argc > 0) {
|
||||
name = *argv++;
|
||||
len = strlen(name);
|
||||
base = xbasename(name);
|
||||
bnlen = strlen(base);
|
||||
toname = (char*)xmalloc(tdlen + 1 + bnlen + 1);
|
||||
sprintf(toname, "%s/%s", todir, base);
|
||||
exists = (lstat(toname, &tosb) == 0);
|
||||
name = *argv++;
|
||||
len = strlen(name);
|
||||
base = xbasename(name);
|
||||
bnlen = strlen(base);
|
||||
toname = (char*)xmalloc(tdlen + 1 + bnlen + 1);
|
||||
sprintf(toname, "%s/%s", todir, base);
|
||||
exists = (lstat(toname, &tosb) == 0);
|
||||
|
||||
if (dodir) {
|
||||
/* -d means create a directory, always */
|
||||
if (exists && !S_ISDIR(tosb.st_mode)) {
|
||||
(void) unlink(toname);
|
||||
exists = 0;
|
||||
}
|
||||
if (!exists && mkdir(toname, mode) < 0)
|
||||
fail("cannot make directory %s", toname);
|
||||
if ((owner || group) && chown(toname, uid, gid) < 0)
|
||||
fail("cannot change owner of %s", toname);
|
||||
} else if (dolink) {
|
||||
if (*name == '/') {
|
||||
/* source is absolute pathname, link to it directly */
|
||||
linkname = 0;
|
||||
} else {
|
||||
if (linkprefix) {
|
||||
/* -L implies -l and prefixes names with a $cwd arg. */
|
||||
len += lplen + 1;
|
||||
linkname = (char*)xmalloc(len + 1);
|
||||
sprintf(linkname, "%s/%s", linkprefix, name);
|
||||
} else if (dorelsymlink) {
|
||||
/* Symlink the relative path from todir to source name. */
|
||||
linkname = (char*)xmalloc(PATH_MAX);
|
||||
if (dodir) {
|
||||
/* -d means create a directory, always */
|
||||
if (exists && !S_ISDIR(tosb.st_mode)) {
|
||||
(void) unlink(toname);
|
||||
exists = 0;
|
||||
}
|
||||
if (!exists && mkdir(toname, mode) < 0) {
|
||||
fail("cannot make directory %s", toname);
|
||||
}
|
||||
if ((owner || group) && chown(toname, uid, gid) < 0) {
|
||||
fail("cannot change owner of %s", toname);
|
||||
}
|
||||
} else if (dolink) {
|
||||
if (*name == '/') {
|
||||
/* source is absolute pathname, link to it directly */
|
||||
linkname = 0;
|
||||
} else {
|
||||
if (linkprefix) {
|
||||
/* -L implies -l and prefixes names with a $cwd arg. */
|
||||
len += lplen + 1;
|
||||
linkname = (char*)xmalloc(len + 1);
|
||||
sprintf(linkname, "%s/%s", linkprefix, name);
|
||||
} else if (dorelsymlink) {
|
||||
/* Symlink the relative path from todir to source name. */
|
||||
linkname = (char*)xmalloc(PATH_MAX);
|
||||
|
||||
if (*todir == '/') {
|
||||
/* todir is absolute: skip over common prefix. */
|
||||
lplen = relatepaths(todir, cwd, linkname);
|
||||
strcpy(linkname + lplen, name);
|
||||
} else {
|
||||
/* todir is named by a relative path: reverse it. */
|
||||
reversepath(todir, name, len, linkname);
|
||||
xchdir(cwd);
|
||||
}
|
||||
if (*todir == '/') {
|
||||
/* todir is absolute: skip over common prefix. */
|
||||
lplen = relatepaths(todir, cwd, linkname);
|
||||
strcpy(linkname + lplen, name);
|
||||
} else {
|
||||
/* todir is named by a relative path: reverse it. */
|
||||
reversepath(todir, name, len, linkname);
|
||||
xchdir(cwd);
|
||||
}
|
||||
|
||||
len = strlen(linkname);
|
||||
}
|
||||
name = linkname;
|
||||
}
|
||||
len = strlen(linkname);
|
||||
}
|
||||
name = linkname;
|
||||
}
|
||||
|
||||
/* Check for a pre-existing symlink with identical content. */
|
||||
if (exists &&
|
||||
(!S_ISLNK(tosb.st_mode) ||
|
||||
readlink(toname, buf, sizeof buf) != len ||
|
||||
strncmp(buf, name, len) != 0)) {
|
||||
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
|
||||
exists = 0;
|
||||
}
|
||||
if (!exists && symlink(name, toname) < 0)
|
||||
fail("cannot make symbolic link %s", toname);
|
||||
/* Check for a pre-existing symlink with identical content. */
|
||||
if (exists &&
|
||||
(!S_ISLNK(tosb.st_mode) ||
|
||||
readlink(toname, buf, sizeof buf) != len ||
|
||||
strncmp(buf, name, len) != 0)) {
|
||||
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
|
||||
exists = 0;
|
||||
}
|
||||
if (!exists && symlink(name, toname) < 0) {
|
||||
fail("cannot make symbolic link %s", toname);
|
||||
}
|
||||
#ifdef HAVE_LCHOWN
|
||||
if ((owner || group) && lchown(toname, uid, gid) < 0)
|
||||
fail("cannot change owner of %s", toname);
|
||||
if ((owner || group) && lchown(toname, uid, gid) < 0) {
|
||||
fail("cannot change owner of %s", toname);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (linkname) {
|
||||
free(linkname);
|
||||
linkname = 0;
|
||||
}
|
||||
} else {
|
||||
/* Copy from name to toname, which might be the same file. */
|
||||
fromfd = open(name, O_RDONLY);
|
||||
if (fromfd < 0 || fstat(fromfd, &sb) < 0)
|
||||
fail("cannot access %s", name);
|
||||
if (exists && (!S_ISREG(tosb.st_mode) || access(toname, W_OK) < 0))
|
||||
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
|
||||
tofd = open(toname, O_CREAT | O_WRONLY, 0666);
|
||||
if (tofd < 0)
|
||||
fail("cannot create %s", toname);
|
||||
if (linkname) {
|
||||
free(linkname);
|
||||
linkname = 0;
|
||||
}
|
||||
} else {
|
||||
/* Copy from name to toname, which might be the same file. */
|
||||
fromfd = open(name, O_RDONLY);
|
||||
if (fromfd < 0 || fstat(fromfd, &sb) < 0) {
|
||||
fail("cannot access %s", name);
|
||||
}
|
||||
if (exists && (!S_ISREG(tosb.st_mode) || access(toname, W_OK) < 0)) {
|
||||
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
|
||||
}
|
||||
tofd = open(toname, O_CREAT | O_WRONLY, 0666);
|
||||
if (tofd < 0) {
|
||||
fail("cannot create %s", toname);
|
||||
}
|
||||
|
||||
bp = buf;
|
||||
while ((cc = read(fromfd, bp, sizeof buf)) > 0) {
|
||||
while ((wc = write(tofd, bp, cc)) > 0) {
|
||||
if ((cc -= wc) == 0)
|
||||
break;
|
||||
bp += wc;
|
||||
}
|
||||
if (wc < 0)
|
||||
fail("cannot write to %s", toname);
|
||||
}
|
||||
if (cc < 0)
|
||||
fail("cannot read from %s", name);
|
||||
bp = buf;
|
||||
while ((cc = read(fromfd, bp, sizeof buf)) > 0) {
|
||||
while ((wc = write(tofd, bp, cc)) > 0) {
|
||||
if ((cc -= wc) == 0) {
|
||||
break;
|
||||
}
|
||||
bp += wc;
|
||||
}
|
||||
if (wc < 0) {
|
||||
fail("cannot write to %s", toname);
|
||||
}
|
||||
}
|
||||
if (cc < 0) {
|
||||
fail("cannot read from %s", name);
|
||||
}
|
||||
|
||||
if (ftruncate(tofd, sb.st_size) < 0)
|
||||
fail("cannot truncate %s", toname);
|
||||
if (dotimes) {
|
||||
utb.actime = sb.st_atime;
|
||||
utb.modtime = sb.st_mtime;
|
||||
if (utime(toname, &utb) < 0)
|
||||
fail("cannot set times of %s", toname);
|
||||
}
|
||||
if (ftruncate(tofd, sb.st_size) < 0) {
|
||||
fail("cannot truncate %s", toname);
|
||||
}
|
||||
if (dotimes) {
|
||||
utb.actime = sb.st_atime;
|
||||
utb.modtime = sb.st_mtime;
|
||||
if (utime(toname, &utb) < 0) {
|
||||
fail("cannot set times of %s", toname);
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_FCHMOD
|
||||
if (fchmod(tofd, mode) < 0)
|
||||
if (fchmod(tofd, mode) < 0)
|
||||
#else
|
||||
if (chmod(toname, mode) < 0)
|
||||
if (chmod(toname, mode) < 0)
|
||||
#endif
|
||||
fail("cannot change mode of %s", toname);
|
||||
if ((owner || group) && fchown(tofd, uid, gid) < 0)
|
||||
fail("cannot change owner of %s", toname);
|
||||
fail("cannot change mode of %s", toname);
|
||||
if ((owner || group) && fchown(tofd, uid, gid) < 0) {
|
||||
fail("cannot change owner of %s", toname);
|
||||
}
|
||||
|
||||
/* Must check for delayed (NFS) write errors on close. */
|
||||
if (close(tofd) < 0)
|
||||
fail("cannot write to %s", toname);
|
||||
close(fromfd);
|
||||
}
|
||||
/* Must check for delayed (NFS) write errors on close. */
|
||||
if (close(tofd) < 0) {
|
||||
fail("cannot write to %s", toname);
|
||||
}
|
||||
close(fromfd);
|
||||
}
|
||||
|
||||
free(toname);
|
||||
free(toname);
|
||||
}
|
||||
|
||||
free(cwd);
|
||||
@@ -362,10 +383,10 @@ fail(char *format, ...)
|
||||
if (error)
|
||||
|
||||
#ifdef USE_REENTRANT_LIBC
|
||||
R_STRERROR_R(errno);
|
||||
fprintf(stderr, ": %s", r_strerror_r);
|
||||
R_STRERROR_R(errno);
|
||||
fprintf(stderr, ": %s", r_strerror_r);
|
||||
#else
|
||||
fprintf(stderr, ": %s", strerror(errno));
|
||||
fprintf(stderr, ": %s", strerror(errno));
|
||||
#endif
|
||||
|
||||
putc('\n', stderr);
|
||||
@@ -375,18 +396,20 @@ fail(char *format, ...)
|
||||
char *
|
||||
getcomponent(char *path, char *name)
|
||||
{
|
||||
if (*path == '\0')
|
||||
return 0;
|
||||
if (*path == '\0') {
|
||||
return 0;
|
||||
}
|
||||
if (*path == '/') {
|
||||
*name++ = '/';
|
||||
*name++ = '/';
|
||||
} else {
|
||||
do {
|
||||
*name++ = *path++;
|
||||
} while (*path != '/' && *path != '\0');
|
||||
do {
|
||||
*name++ = *path++;
|
||||
} while (*path != '/' && *path != '\0');
|
||||
}
|
||||
*name = '\0';
|
||||
while (*path == '/')
|
||||
path++;
|
||||
while (*path == '/') {
|
||||
path++;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -394,14 +417,14 @@ getcomponent(char *path, char *name)
|
||||
/* Sigh. The static buffer in Unixware's readdir is too small. */
|
||||
struct dirent * readdir(DIR *d)
|
||||
{
|
||||
static struct dirent *buf = NULL;
|
||||
static struct dirent *buf = NULL;
|
||||
#define MAX_PATH_LEN 1024
|
||||
|
||||
|
||||
if(buf == NULL)
|
||||
buf = (struct dirent *) malloc(sizeof(struct dirent) + MAX_PATH_LEN)
|
||||
;
|
||||
return(readdir_r(d, buf));
|
||||
if(buf == NULL)
|
||||
buf = (struct dirent *) malloc(sizeof(struct dirent) + MAX_PATH_LEN)
|
||||
;
|
||||
return(readdir_r(d, buf));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -413,13 +436,16 @@ ino2name(ino_t ino, char *dir)
|
||||
char *name;
|
||||
|
||||
dp = opendir("..");
|
||||
if (!dp)
|
||||
fail("cannot read parent directory");
|
||||
if (!dp) {
|
||||
fail("cannot read parent directory");
|
||||
}
|
||||
for (;;) {
|
||||
if (!(ep = readdir(dp)))
|
||||
fail("cannot find current directory");
|
||||
if (ep->d_ino == ino)
|
||||
break;
|
||||
if (!(ep = readdir(dp))) {
|
||||
fail("cannot find current directory");
|
||||
}
|
||||
if (ep->d_ino == ino) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
name = xstrdup(ep->d_name);
|
||||
closedir(dp);
|
||||
@@ -430,8 +456,9 @@ void *
|
||||
xmalloc(size_t size)
|
||||
{
|
||||
void *p = malloc(size);
|
||||
if (!p)
|
||||
fail("cannot allocate %u bytes", size);
|
||||
if (!p) {
|
||||
fail("cannot allocate %u bytes", size);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -446,17 +473,21 @@ xbasename(char *path)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
while ((cp = strrchr(path, '/')) && cp[1] == '\0')
|
||||
*cp = '\0';
|
||||
if (!cp) return path;
|
||||
while ((cp = strrchr(path, '/')) && cp[1] == '\0') {
|
||||
*cp = '\0';
|
||||
}
|
||||
if (!cp) {
|
||||
return path;
|
||||
}
|
||||
return cp + 1;
|
||||
}
|
||||
|
||||
void
|
||||
xchdir(char *dir)
|
||||
{
|
||||
if (chdir(dir) < 0)
|
||||
fail("cannot change directory to %s", dir);
|
||||
if (chdir(dir) < 0) {
|
||||
fail("cannot change directory to %s", dir);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
@@ -468,27 +499,29 @@ relatepaths(char *from, char *to, char *outpath)
|
||||
|
||||
assert(*from == '/' && *to == '/');
|
||||
for (cp = to, cp2 = from; *cp == *cp2; cp++, cp2++)
|
||||
if (*cp == '\0')
|
||||
break;
|
||||
while (cp[-1] != '/')
|
||||
cp--, cp2--;
|
||||
if (*cp == '\0') {
|
||||
break;
|
||||
}
|
||||
while (cp[-1] != '/') {
|
||||
cp--, cp2--;
|
||||
}
|
||||
if (cp - 1 == to) {
|
||||
/* closest common ancestor is /, so use full pathname */
|
||||
len = strlen(strcpy(outpath, to));
|
||||
if (outpath[len] != '/') {
|
||||
outpath[len++] = '/';
|
||||
outpath[len] = '\0';
|
||||
}
|
||||
/* closest common ancestor is /, so use full pathname */
|
||||
len = strlen(strcpy(outpath, to));
|
||||
if (outpath[len] != '/') {
|
||||
outpath[len++] = '/';
|
||||
outpath[len] = '\0';
|
||||
}
|
||||
} else {
|
||||
len = 0;
|
||||
while ((cp2 = getcomponent(cp2, buf)) != 0) {
|
||||
strcpy(outpath + len, "../");
|
||||
len += 3;
|
||||
}
|
||||
while ((cp = getcomponent(cp, buf)) != 0) {
|
||||
sprintf(outpath + len, "%s/", buf);
|
||||
len += strlen(outpath + len);
|
||||
}
|
||||
len = 0;
|
||||
while ((cp2 = getcomponent(cp2, buf)) != 0) {
|
||||
strcpy(outpath + len, "../");
|
||||
len += 3;
|
||||
}
|
||||
while ((cp = getcomponent(cp, buf)) != 0) {
|
||||
sprintf(outpath + len, "%s/", buf);
|
||||
len += strlen(outpath + len);
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@@ -503,23 +536,25 @@ reversepath(char *inpath, char *name, int len, char *outpath)
|
||||
cp = strcpy(outpath + PATH_MAX - (len + 1), name);
|
||||
cp2 = inpath;
|
||||
while ((cp2 = getcomponent(cp2, buf)) != 0) {
|
||||
if (strcmp(buf, ".") == 0)
|
||||
continue;
|
||||
if (strcmp(buf, "..") == 0) {
|
||||
if (stat(".", &sb) < 0)
|
||||
fail("cannot stat current directory");
|
||||
name = ino2name(sb.st_ino, "..");
|
||||
len = strlen(name);
|
||||
cp -= len + 1;
|
||||
strcpy(cp, name);
|
||||
cp[len] = '/';
|
||||
free(name);
|
||||
xchdir("..");
|
||||
} else {
|
||||
cp -= 3;
|
||||
strncpy(cp, "../", 3);
|
||||
xchdir(buf);
|
||||
}
|
||||
if (strcmp(buf, ".") == 0) {
|
||||
continue;
|
||||
}
|
||||
if (strcmp(buf, "..") == 0) {
|
||||
if (stat(".", &sb) < 0) {
|
||||
fail("cannot stat current directory");
|
||||
}
|
||||
name = ino2name(sb.st_ino, "..");
|
||||
len = strlen(name);
|
||||
cp -= len + 1;
|
||||
strcpy(cp, name);
|
||||
cp[len] = '/';
|
||||
free(name);
|
||||
xchdir("..");
|
||||
} else {
|
||||
cp -= 3;
|
||||
memcpy(cp, "../", 3);
|
||||
xchdir(buf);
|
||||
}
|
||||
}
|
||||
strcpy(outpath, cp);
|
||||
}
|
||||
|
||||
@@ -280,10 +280,13 @@ ifdef ENABLE_STRIP
|
||||
$(STRIP) $@
|
||||
endif
|
||||
|
||||
$(LIBRARY): $(OBJS)
|
||||
# Same as OBJS, but without any file that matches p*vrsion.o, since these
|
||||
# collide for static libraries, and are not useful for that case anyway.
|
||||
STATICLIB_OBJS = $(filter-out $(OBJDIR)/p%vrsion.$(OBJ_SUFFIX),$(OBJS))
|
||||
$(LIBRARY): $(STATICLIB_OBJS)
|
||||
@$(MAKE_OBJDIR)
|
||||
rm -f $@
|
||||
$(AR) $(AR_FLAGS) $(OBJS) $(AR_EXTRA_ARGS)
|
||||
$(AR) $(AR_FLAGS) $(STATICLIB_OBJS) $(AR_EXTRA_ARGS)
|
||||
$(RANLIB) $@
|
||||
|
||||
ifeq ($(OS_TARGET), OS2)
|
||||
|
||||
Vendored
+28
-440
@@ -623,7 +623,6 @@ ac_subst_vars='LTLIBOBJS
|
||||
LIBOBJS
|
||||
MT
|
||||
NEXT_ROOT
|
||||
SYMBIAN_SDK_DIR
|
||||
MACOS_SDK_DIR
|
||||
WRAP_SYSTEM_INCLUDES
|
||||
VISIBILITY_FLAGS
|
||||
@@ -757,6 +756,7 @@ infodir
|
||||
docdir
|
||||
oldincludedir
|
||||
includedir
|
||||
runstatedir
|
||||
localstatedir
|
||||
sharedstatedir
|
||||
sysconfdir
|
||||
@@ -792,10 +792,8 @@ enable_optimize
|
||||
enable_debug
|
||||
enable_debug_symbols
|
||||
enable_win32_target
|
||||
enable_symbian_target
|
||||
enable_debug_rtl
|
||||
enable_static_rtl
|
||||
enable_n32
|
||||
enable_x32
|
||||
enable_64bit
|
||||
enable_mdupdate
|
||||
@@ -811,13 +809,11 @@ with_arch
|
||||
with_fpu
|
||||
with_float_abi
|
||||
with_soft_float
|
||||
with_symbian_sdk
|
||||
with_ccache
|
||||
enable_strip
|
||||
with_pthreads
|
||||
enable_user_pthreads
|
||||
enable_nspr_threads
|
||||
with_bthreads
|
||||
enable_ipv6
|
||||
enable_wrap_malloc
|
||||
with_wrap_malloc
|
||||
@@ -872,7 +868,7 @@ datadir='${datarootdir}'
|
||||
sysconfdir='${prefix}/etc'
|
||||
sharedstatedir='${prefix}/com'
|
||||
localstatedir='${prefix}/var'
|
||||
|
||||
runstatedir='${localstatedir}/run'
|
||||
includedir='${prefix}/include'
|
||||
oldincludedir='/usr/include'
|
||||
docdir='${datarootdir}/doc/${PACKAGE}'
|
||||
@@ -1125,6 +1121,15 @@ do
|
||||
| -silent | --silent | --silen | --sile | --sil)
|
||||
silent=yes ;;
|
||||
|
||||
-runstatedir | --runstatedir | --runstatedi | --runstated \
|
||||
| --runstate | --runstat | --runsta | --runst | --runs \
|
||||
| --run | --ru | --r)
|
||||
ac_prev=runstatedir ;;
|
||||
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
|
||||
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
|
||||
| --run=* | --ru=* | --r=*)
|
||||
runstatedir=$ac_optarg ;;
|
||||
|
||||
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
||||
ac_prev=sbindir ;;
|
||||
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
||||
@@ -1262,7 +1267,7 @@ fi
|
||||
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
||||
datadir sysconfdir sharedstatedir localstatedir includedir \
|
||||
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
||||
libdir localedir mandir
|
||||
libdir localedir mandir runstatedir
|
||||
do
|
||||
eval ac_val=\$$ac_var
|
||||
# Remove trailing slashes.
|
||||
@@ -1415,6 +1420,7 @@ Fine tuning of the installation directories:
|
||||
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
||||
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
||||
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
||||
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
|
||||
--libdir=DIR object code libraries [EPREFIX/lib]
|
||||
--includedir=DIR C header files [PREFIX/include]
|
||||
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
||||
@@ -1453,11 +1459,8 @@ Optional Features:
|
||||
(using compiler flags DBG)
|
||||
--enable-win32-target=\$t
|
||||
Specify win32 flavor. (WIN95 or WINNT)
|
||||
--enable-symbian-target=\$t
|
||||
Specify symbian flavor. (WINSCW or GCCE)
|
||||
--enable-debug-rtl Use the MSVC debug runtime library
|
||||
--enable-static-rtl Use the MSVC static runtime library
|
||||
--enable-n32 Enable n32 ABI support (IRIX only)
|
||||
--enable-x32 Enable x32 ABI support (x86_64 only)
|
||||
--enable-64bit Enable 64-bit support (on certain platforms)
|
||||
--enable-mdupdate Enable use of certain compilers' mdupdate feature
|
||||
@@ -1506,13 +1509,9 @@ Optional Packages:
|
||||
Use specific arm float ABI (-mfloat-abi=type)
|
||||
--with-soft-float[=yes|no|toolchain-default]
|
||||
Use soft float library (-msoft-float)
|
||||
--with-symbian-sdk=SYMBIAN_SDK_DIR
|
||||
The path to the Symbian SDK
|
||||
--with-ccache=path/to/ccache
|
||||
Enable compiling with ccache
|
||||
--with-pthreads Use system pthreads library as thread subsystem
|
||||
--with-bthreads Use system bthreads library as thread subsystem
|
||||
(BeOS only)
|
||||
--with-wrap-malloc=SHAREDLIB Location of malloc wrapper library
|
||||
|
||||
Some influential environment variables:
|
||||
@@ -2487,7 +2486,7 @@ test -n "$target_alias" &&
|
||||
program_prefix=${target_alias}-
|
||||
|
||||
MOD_MAJOR_VERSION=4
|
||||
MOD_MINOR_VERSION=21
|
||||
MOD_MINOR_VERSION=24
|
||||
MOD_PATCH_VERSION=0
|
||||
NSPR_MODNAME=nspr20
|
||||
_HAVE_PTHREADS=
|
||||
@@ -2641,6 +2640,12 @@ fi
|
||||
|
||||
|
||||
case "$target" in
|
||||
x86_64-linux*-android*)
|
||||
android_tool_prefix="x86_64-linux-android"
|
||||
;;
|
||||
aarch64-linux*-android*)
|
||||
android_tool_prefix="aarch64-linux-android"
|
||||
;;
|
||||
arm-linux*-android*|*-linuxandroid*)
|
||||
android_tool_prefix="arm-linux-androideabi"
|
||||
;;
|
||||
@@ -2855,11 +2860,6 @@ if test "${enable_win32_target+set}" = set; then :
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-symbian-target was given.
|
||||
if test "${enable_symbian_target+set}" = set; then :
|
||||
enableval=$enable_symbian_target; OS_TARGET=`echo $enableval | tr a-z A-Z`
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-debug-rtl was given.
|
||||
if test "${enable_debug_rtl+set}" = set; then :
|
||||
@@ -2879,17 +2879,6 @@ if test "${enable_static_rtl+set}" = set; then :
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-n32 was given.
|
||||
if test "${enable_n32+set}" = set; then :
|
||||
enableval=$enable_n32; if test "$enableval" = "yes"; then
|
||||
USE_N32=1
|
||||
else if test "$enableval" = "no"; then
|
||||
USE_N32=
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-x32 was given.
|
||||
if test "${enable_x32+set}" = set; then :
|
||||
enableval=$enable_x32; if test "$enableval" = "yes"; then
|
||||
@@ -2978,14 +2967,6 @@ if test -z "$CC"; then
|
||||
CC=cc
|
||||
;;
|
||||
|
||||
*-irix*)
|
||||
CC=cc
|
||||
;;
|
||||
|
||||
*-osf*)
|
||||
CC=cc
|
||||
;;
|
||||
|
||||
*-solaris*)
|
||||
CC=cc
|
||||
;;
|
||||
@@ -3018,14 +2999,6 @@ if test -z "$CXX"; then
|
||||
esac
|
||||
;;
|
||||
|
||||
*-irix*)
|
||||
CXX=CC
|
||||
;;
|
||||
|
||||
*-osf*)
|
||||
CXX=cxx
|
||||
;;
|
||||
|
||||
*-solaris*)
|
||||
CXX=CC
|
||||
;;
|
||||
@@ -3083,9 +3056,6 @@ if test -n "$MOZ_DEBUG"; then
|
||||
DEFINES="$DEFINES -UNDEBUG"
|
||||
|
||||
case "${target_os}" in
|
||||
beos*)
|
||||
DEFINES="$DEFINES -DDEBUG_${USER}"
|
||||
;;
|
||||
mks*|cygwin*|mingw*|msys*|os2*)
|
||||
DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
|
||||
;;
|
||||
@@ -5626,10 +5596,6 @@ else
|
||||
OS_TEST=`uname -m`
|
||||
fi
|
||||
|
||||
if test "$OS_ARCH" = "IRIX64"; then
|
||||
OS_ARCH=IRIX
|
||||
fi
|
||||
|
||||
if test "$OS_ARCH" = "AIX"; then
|
||||
OS_RELEASE=`uname -v`.`uname -r`
|
||||
fi
|
||||
@@ -6016,9 +5982,6 @@ case "$host" in
|
||||
CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
|
||||
fi
|
||||
;;
|
||||
*-beos*)
|
||||
HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
|
||||
;;
|
||||
*os2*)
|
||||
;;
|
||||
*)
|
||||
@@ -6374,77 +6337,6 @@ fi
|
||||
RESOLVE_LINK_SYMBOLS=1
|
||||
;;
|
||||
|
||||
*-beos*)
|
||||
$as_echo "#define XP_BEOS 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define BeOS 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define BEOS 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
|
||||
|
||||
DSO_LDOPTS=-nostart
|
||||
MDCPUCFG_H=_beos.cfg
|
||||
USE_BTHREADS=1
|
||||
PR_MD_ARCH_DIR=beos
|
||||
RESOLVE_LINK_SYMBOLS=1
|
||||
case "${target_cpu}" in
|
||||
i*86)
|
||||
_OPTIMIZE_FLAGS=-O2
|
||||
_DEBUG_FLAGS='-gdwarf-2 -O0'
|
||||
MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyaddr in -lbind" >&5
|
||||
$as_echo_n "checking for gethostbyaddr in -lbind... " >&6; }
|
||||
if ${ac_cv_lib_bind_gethostbyaddr+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lbind $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char gethostbyaddr ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return gethostbyaddr ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_lib_bind_gethostbyaddr=yes
|
||||
else
|
||||
ac_cv_lib_bind_gethostbyaddr=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bind_gethostbyaddr" >&5
|
||||
$as_echo "$ac_cv_lib_bind_gethostbyaddr" >&6; }
|
||||
if test "x$ac_cv_lib_bind_gethostbyaddr" = xyes; then :
|
||||
OS_LIBS="$OS_LIBS -lbind -lsocket"
|
||||
fi
|
||||
|
||||
;;
|
||||
powerpc)
|
||||
CC=mwcc
|
||||
CCC=mwcc
|
||||
LD=mwld
|
||||
DSO_LDOPTS='-xms -export pragma -init _init_routine_ -term _term_routine_ -lroot -lnet /boot/develop/lib/ppc/glue-noinit.a /boot/develop/lib/ppc/init_term_dyn.o /boot/develop/lib/ppc/start_dyn.o'
|
||||
_OPTIMIZE_FLAGS=-O2
|
||||
_DEBUG_FLAGS='-g -O0'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*-bsdi*)
|
||||
$as_echo "#define XP_UNIX 1" >>confdefs.h
|
||||
|
||||
@@ -6667,28 +6559,6 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
|
||||
fi
|
||||
;;
|
||||
|
||||
*-dgux*)
|
||||
$as_echo "#define XP_UNIX 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _PR_LOCAL_THREADS_ONLY 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define SVR4 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define SYSV 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define DGUX 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _DGUX_SOURCE 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _POSIX4A_DRAFT6_SOURCE 1" >>confdefs.h
|
||||
|
||||
DSO_LDOPTS=-G
|
||||
_OPTIMIZE_FLAGS=-O2
|
||||
_DEBUG_FLAGS=
|
||||
MDCPUCFG_H=_dgux.cfg
|
||||
PR_MD_CSRCS=dgux.c
|
||||
;;
|
||||
|
||||
*-freebsd*)
|
||||
if test -z "$USE_NSPR_THREADS"; then
|
||||
USE_PTHREADS=1
|
||||
@@ -6724,7 +6594,7 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
|
||||
|
||||
$as_echo "#define _HPUX_SOURCE 1" >>confdefs.h
|
||||
|
||||
# OSF1 and HPUX report the POLLHUP event for a socket when the
|
||||
# HPUX report the POLLHUP event for a socket when the
|
||||
# shutdown(SHUT_WR) operation is called for the remote end, even though
|
||||
# the socket is still writeable. Use select(), instead of poll(), to
|
||||
# workaround this problem.
|
||||
@@ -6890,110 +6760,6 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
|
||||
fi
|
||||
;;
|
||||
|
||||
*-irix*)
|
||||
$as_echo "#define XP_UNIX 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define IRIX 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define SVR4 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _SGI_MP_SOURCE 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define HAVE_FCNTL_FILE_LOCKING 1" >>confdefs.h
|
||||
|
||||
PR_MD_CSRCS=irix.c
|
||||
PR_MD_ASFILES=os_Irix.s
|
||||
MKSHLIB='$(LD) $(DSO_LDOPTS) -rdata_shared -shared -soname $(notdir $@) -o $@'
|
||||
STRIP="$STRIP -f"
|
||||
RESOLVE_LINK_SYMBOLS=1
|
||||
if test -n "$USE_64"; then
|
||||
MDCPUCFG_H=_irix64.cfg
|
||||
else
|
||||
MDCPUCFG_H=_irix32.cfg
|
||||
fi
|
||||
case "${target_os}" in
|
||||
irix6*)
|
||||
$as_echo "#define IRIX6 1" >>confdefs.h
|
||||
|
||||
USE_PTHREADS=1
|
||||
USE_N32=1
|
||||
COMPILER_TAG=_n32
|
||||
IMPL_STRATEGY=_PTH
|
||||
;;
|
||||
irix5*)
|
||||
$as_echo "#define IRIX5 1" >>confdefs.h
|
||||
|
||||
USE_NSPR_THREADS=1
|
||||
;;
|
||||
*)
|
||||
USE_PTHREADS=1
|
||||
USE_N32=1
|
||||
;;
|
||||
esac
|
||||
if test "$GNU_CC"; then
|
||||
AS='$(CC) -Wp,-P -x assembler-with-cpp -D_ASM -mips2 $(INCLUDES)'
|
||||
CFLAGS="$CFLAGS -Wall -Wno-format"
|
||||
_OPTIMIZE_FLAGS="-O6"
|
||||
else
|
||||
if test -n "$USE_N32"; then
|
||||
AS='as -D_ASM $(INCLUDES) -n32'
|
||||
else
|
||||
AS='as -D_ASM $(INCLUDES)'
|
||||
fi
|
||||
CFLAGS="$CFLAGS -fullwarn -xansi"
|
||||
if test "$USE_N32"; then
|
||||
_OPTIMIZE_FLAGS="-O -OPT:Olimit=4000"
|
||||
else
|
||||
_OPTIMIZE_FLAGS="-O -Olimit 4000"
|
||||
fi
|
||||
if test "$USE_MDUPDATE"; then
|
||||
CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
|
||||
fi
|
||||
case "${target}" in
|
||||
*-irix6.*)
|
||||
CFLAGS="$CFLAGS -multigot"
|
||||
DSO_LDOPTS="-no_unresolved"
|
||||
if test "$USE_N32"; then
|
||||
CFLAGS="$CFLAGS -n32 -woff 1209"
|
||||
DSO_LDOPTS="$DSO_LDOPTS -n32"
|
||||
else
|
||||
if test "$USE_64"; then
|
||||
CFLAGS="$CFLAGS -64"
|
||||
else
|
||||
CFLAGS="$CFLAGS -32"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
CFLAGS="$CFLAGS -xgot"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test "${target_os}" = "irix5.3"; then
|
||||
$as_echo "#define IRIX5_3 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
case "${target_os}" in
|
||||
irix6.5)
|
||||
if test -z "$GNU_CC"; then
|
||||
CFLAGS="$CFLAGS -mips3"
|
||||
fi
|
||||
$as_echo "#define _PR_HAVE_GETPROTO_R 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _PR_HAVE_GETPROTO_R_POINTER 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _PR_HAVE_SGI_PRDA_PROCMASK 1" >>confdefs.h
|
||||
|
||||
;;
|
||||
irix5*)
|
||||
;;
|
||||
*)
|
||||
$as_echo "#define _PR_HAVE_SGI_PRDA_PROCMASK 1" >>confdefs.h
|
||||
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*-linux*|*-gnu*|*-k*bsd*-gnu|*-android*|*-linuxandroid*)
|
||||
if test -z "$USE_NSPR_THREADS"; then
|
||||
USE_PTHREADS=1
|
||||
@@ -7290,6 +7056,11 @@ $as_echo "$as_me: WARNING: Unknown version of the Microsoft (R) Manifest Tool."
|
||||
x86_64)
|
||||
$as_echo "#define _AMD64_ 1" >>confdefs.h
|
||||
|
||||
USE_64=1
|
||||
;;
|
||||
aarch64)
|
||||
$as_echo "#define _ARM64_ 1" >>confdefs.h
|
||||
|
||||
USE_64=1
|
||||
;;
|
||||
ia64)
|
||||
@@ -7387,61 +7158,6 @@ $as_echo "$as_me: WARNING: Unknown version of the Microsoft (R) Manifest Tool."
|
||||
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
|
||||
;;
|
||||
|
||||
*-osf*)
|
||||
SHELL_OVERRIDE="SHELL = /usr/bin/ksh"
|
||||
$as_echo "#define XP_UNIX 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define OSF1 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _REENTRANT 1" >>confdefs.h
|
||||
|
||||
# OSF1 and HPUX report the POLLHUP event for a socket when the
|
||||
# shutdown(SHUT_WR) operation is called for the remote end, even though
|
||||
# the socket is still writeable. Use select(), instead of poll(), to
|
||||
# workaround this problem.
|
||||
$as_echo "#define _PR_POLL_WITH_SELECT 1" >>confdefs.h
|
||||
|
||||
|
||||
if echo "$OS_RELEASE" | egrep -c '(V2.0|V3.2)' 2>/dev/null ; then
|
||||
USE_NSPR_THREADS=1
|
||||
fi
|
||||
|
||||
if test -z "$GNU_CC"; then
|
||||
CC="$CC -std1 -ieee_with_inexact"
|
||||
if test "$OS_RELEASE" != "V2.0"; then
|
||||
CC="$CC -readonly_strings"
|
||||
fi
|
||||
_OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "machine/builtins.h" "ac_cv_header_machine_builtins_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_machine_builtins_h" = xyes; then :
|
||||
$as_echo "#define OSF1_HAVE_MACHINE_BUILTINS_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
CFLAGS="$CFLAGS -mieee"
|
||||
CXXFLAGS="$CXXFLAGS -mieee"
|
||||
fi
|
||||
|
||||
if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
|
||||
$as_echo "#define HAVE_INT_LOCALTIME_R 1" >>confdefs.h
|
||||
|
||||
else
|
||||
$as_echo "#define HAVE_FCNTL_FILE_LOCKING 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define HAVE_POINTER_LOCALTIME_R 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
if echo $OS_RELEASE | grep -c V4.0 >/dev/null; then
|
||||
$as_echo "#define OSF1V4_MAP_PRIVATE_BUG 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
DSO_LDOPTS='-shared -all -expect_unresolved "*" -soname $(notdir $@)'
|
||||
MDCPUCFG_H=_osf1.cfg
|
||||
PR_MD_CSRCS=osf1.c
|
||||
;;
|
||||
|
||||
*-qnx*)
|
||||
$as_echo "#define XP_UNIX 1" >>confdefs.h
|
||||
|
||||
@@ -7683,94 +7399,6 @@ fi
|
||||
CPU_ARCH=x86
|
||||
;;
|
||||
|
||||
*-symbian*)
|
||||
|
||||
# Check whether --with-symbian-sdk was given.
|
||||
if test "${with_symbian_sdk+set}" = set; then :
|
||||
withval=$with_symbian_sdk; SYMBIAN_SDK_DIR=$withval
|
||||
fi
|
||||
|
||||
|
||||
echo -----------------------------------------------------------------------------
|
||||
echo Building with Symbian SDK in: $SYMBIAN_SDK_DIR
|
||||
echo -----------------------------------------------------------------------------
|
||||
|
||||
$as_echo "#define XP_UNIX 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define SYMBIAN 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define __arm__ 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define __SYMBIAN32__ 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _UNICODE 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define NDEBUG 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define __SUPPORT_CPP_EXCEPTIONS__ 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define MOZ_STDERR_TO_STDOUT 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define HAVE_FCNTL_FILE_LOCKING 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define HAVE_SOCKLEN_T 1" >>confdefs.h
|
||||
|
||||
USE_PTHREADS=1
|
||||
LIB_SUFFIX=lib
|
||||
DLL_SUFFIX=dll
|
||||
MKSHLIB=
|
||||
DSO_LDOPTS=
|
||||
DSO_CFLAGS=
|
||||
VISIBILITY_FLAGS=
|
||||
MDCPUCFG_H=_symbian.cfg
|
||||
PR_MD_CSRCS=symbian.c
|
||||
NSINSTALL=nsinstall
|
||||
RANLIB='echo no ranlib '
|
||||
CPU_ARCH=ARM
|
||||
OS_ARCH=SYMBIAN
|
||||
OS_EXE_CFLAGS="$OS_EXE_CFLAGS -D__EXE__"
|
||||
CFLAGS="$CFLAGS -MD -nostdinc"
|
||||
SYMBIAN_SYS_INCLUDE="-I$SYMBIAN_SDK_DIR/Epoc32/include/variant -I$SYMBIAN_SDK_DIR/Epoc32/include -I$SYMBIAN_SDK_DIR/Epoc32/include/stdapis"
|
||||
echo -------------------------------------------------------
|
||||
echo SYMBIAN_SYS_INCLUDE is: $SYMBIAN_SYS_INCLUDE
|
||||
echo -------------------------------------------------------
|
||||
case "$OS_TARGET" in
|
||||
WINSCW)
|
||||
CC=mwccsym2.exe
|
||||
CXX=mwccsym2.exe
|
||||
LD=mwldsym2.exe
|
||||
AR=mwldsym2.exe
|
||||
WINSCW_LD_DIR="\$(SYMBIAN_SDK_DIR)/EPOC32/RELEASE/WINSCW/UDEB"
|
||||
CFLAGS="$CFLAGS -O0 -inline off -wchar_t off -align 4 -warnings on -w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on -nostderr -gccdep -cwd source -i- -I\$(VPATH)"
|
||||
SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include Symbian_OS_v9.2.hrh"
|
||||
AR_FLAGS="-library -msgstyle gcc -stdlib -subsystem windows -noimplib -o \$@"
|
||||
$as_echo "#define _DEBUG 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define __CW32__ 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define __WINS__ 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define __WINSCW__ 1" >>confdefs.h
|
||||
|
||||
DEFINES="$DEFINES -U_WIN32"
|
||||
;;
|
||||
GCCE)
|
||||
CFLAGS="$CFLAGS -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -x c -msoft-float"
|
||||
CXXFLAGS="$CXXFLAGS $CFLAGS -Wno-ctor-dtor-privacy"
|
||||
SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include $SYMBIAN_SDK_DIR/EPOC32/INCLUDE/GCCE/GCCE.h"
|
||||
$as_echo "#define __GCCE__ 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define __EABI__ 1" >>confdefs.h
|
||||
|
||||
DEFINES="$DEFINES -D__PRODUCT_INCLUDE__=$SYMBIAN_SDK_DIR/Epoc32/include/variant/Symbian_OS_v9.2.hrh"
|
||||
;;
|
||||
*)
|
||||
as_fn_error $? "Missing OS_TARGET for ${target}. Set --enable-symbian-target to with 'WINSCW' or 'GCCE'." "$LINENO" 5
|
||||
;;
|
||||
esac
|
||||
CFLAGS="$CFLAGS ${SYMBIAN_SYS_INCLUDE}"
|
||||
;;
|
||||
|
||||
*-os2*)
|
||||
$as_echo "#define XP_OS2 1" >>confdefs.h
|
||||
|
||||
@@ -7828,7 +7456,7 @@ if test -z "$SKIP_LIBRARY_CHECKS"; then
|
||||
|
||||
|
||||
case $target in
|
||||
*-darwin*|*-beos*|*-os2*)
|
||||
*-darwin*|*-os2*)
|
||||
;;
|
||||
*)
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
|
||||
@@ -8281,21 +7909,6 @@ if test "${enable_nspr_threads+set}" = set; then :
|
||||
fi
|
||||
|
||||
|
||||
case "$target" in
|
||||
*-beos*)
|
||||
|
||||
# Check whether --with-bthreads was given.
|
||||
if test "${with_bthreads+set}" = set; then :
|
||||
withval=$with_bthreads; if test "$withval" = "yes"; then
|
||||
USE_BTHREADS=1
|
||||
USE_USER_PTHREADS=
|
||||
USE_PTHREADS=
|
||||
fi
|
||||
fi
|
||||
|
||||
;;
|
||||
esac
|
||||
|
||||
fi # SKIP_LIBRARY_CHECKS
|
||||
|
||||
# Check whether --enable-ipv6 was given.
|
||||
@@ -8473,23 +8086,13 @@ _ACEOF
|
||||
|
||||
fi
|
||||
;;
|
||||
*-irix*)
|
||||
if test "${target_os}" = "irix6.5"; then
|
||||
if test -n "$USE_PTHREADS"; then
|
||||
$as_echo "#define _PR_HAVE_GETHOST_R 1" >>confdefs.h
|
||||
|
||||
$as_echo "#define _PR_HAVE_GETHOST_R_POINTER 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*-linux*|*-gnu*|*-k*bsd*-gnu)
|
||||
if test -n "$USE_NSPR_THREADS"; then
|
||||
$as_echo "#define _PR_LOCAL_THREADS_ONLY 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
;;
|
||||
*-mingw*|*-msys*|*-cygwin*|*-mks*|*-os2*|*-beos*)
|
||||
*-mingw*|*-msys*|*-cygwin*|*-mks*|*-os2*)
|
||||
USE_PTHREADS=
|
||||
_PTHREAD_LDFLAGS=
|
||||
USE_USER_PTHREADS=
|
||||
@@ -8500,20 +8103,6 @@ _ACEOF
|
||||
|
||||
fi
|
||||
;;
|
||||
*-osf*)
|
||||
if test -n "$USE_NSPR_THREADS"; then
|
||||
$as_echo "#define _PR_LOCAL_THREADS_ONLY 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
if test -n "$USE_PTHREADS"; then
|
||||
if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
|
||||
:
|
||||
else
|
||||
$as_echo "#define _PR_HAVE_THREADSAFE_GETHOST 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*-solaris*)
|
||||
if test -n "$USE_NSPR_THREADS"; then
|
||||
$as_echo "#define _PR_LOCAL_THREADS_ONLY 1" >>confdefs.h
|
||||
@@ -8715,7 +8304,6 @@ fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MAKEFILES="
|
||||
|
||||
+11
-331
@@ -15,7 +15,7 @@ dnl ========================================================
|
||||
dnl = Defaults
|
||||
dnl ========================================================
|
||||
MOD_MAJOR_VERSION=4
|
||||
MOD_MINOR_VERSION=21
|
||||
MOD_MINOR_VERSION=24
|
||||
MOD_PATCH_VERSION=0
|
||||
NSPR_MODNAME=nspr20
|
||||
_HAVE_PTHREADS=
|
||||
@@ -133,6 +133,12 @@ AC_ARG_WITH(android-platform,
|
||||
android_platform=$withval)
|
||||
|
||||
case "$target" in
|
||||
x86_64-linux*-android*)
|
||||
android_tool_prefix="x86_64-linux-android"
|
||||
;;
|
||||
aarch64-linux*-android*)
|
||||
android_tool_prefix="aarch64-linux-android"
|
||||
;;
|
||||
arm-linux*-android*|*-linuxandroid*)
|
||||
android_tool_prefix="arm-linux-androideabi"
|
||||
;;
|
||||
@@ -333,10 +339,6 @@ AC_ARG_ENABLE(win32-target,
|
||||
Specify win32 flavor. (WIN95 or WINNT)],
|
||||
OS_TARGET=`echo $enableval | tr a-z A-Z`)
|
||||
|
||||
AC_ARG_ENABLE(symbian-target,
|
||||
[ --enable-symbian-target=\$t
|
||||
Specify symbian flavor. (WINSCW or GCCE)],
|
||||
OS_TARGET=`echo $enableval | tr a-z A-Z`)
|
||||
|
||||
AC_ARG_ENABLE(debug-rtl,
|
||||
[ --enable-debug-rtl Use the MSVC debug runtime library],
|
||||
@@ -352,15 +354,6 @@ AC_ARG_ENABLE(static-rtl,
|
||||
USE_STATIC_RTL=1
|
||||
fi ])
|
||||
|
||||
AC_ARG_ENABLE(n32,
|
||||
[ --enable-n32 Enable n32 ABI support (IRIX only)],
|
||||
[ if test "$enableval" = "yes"; then
|
||||
USE_N32=1
|
||||
else if test "$enableval" = "no"; then
|
||||
USE_N32=
|
||||
fi
|
||||
fi ])
|
||||
|
||||
AC_ARG_ENABLE(x32,
|
||||
[ --enable-x32 Enable x32 ABI support (x86_64 only)],
|
||||
[ if test "$enableval" = "yes"; then
|
||||
@@ -448,14 +441,6 @@ if test -z "$CC"; then
|
||||
CC=cc
|
||||
;;
|
||||
|
||||
*-irix*)
|
||||
CC=cc
|
||||
;;
|
||||
|
||||
*-osf*)
|
||||
CC=cc
|
||||
;;
|
||||
|
||||
*-solaris*)
|
||||
CC=cc
|
||||
;;
|
||||
@@ -493,14 +478,6 @@ if test -z "$CXX"; then
|
||||
esac
|
||||
;;
|
||||
|
||||
*-irix*)
|
||||
CXX=CC
|
||||
;;
|
||||
|
||||
*-osf*)
|
||||
CXX=cxx
|
||||
;;
|
||||
|
||||
*-solaris*)
|
||||
CXX=CC
|
||||
;;
|
||||
@@ -517,9 +494,6 @@ if test -n "$MOZ_DEBUG"; then
|
||||
DEFINES="$DEFINES -UNDEBUG"
|
||||
|
||||
case "${target_os}" in
|
||||
beos*)
|
||||
DEFINES="$DEFINES -DDEBUG_${USER}"
|
||||
;;
|
||||
mks*|cygwin*|mingw*|msys*|os2*)
|
||||
DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
|
||||
;;
|
||||
@@ -856,10 +830,6 @@ else
|
||||
OS_TEST=`uname -m`
|
||||
fi
|
||||
|
||||
if test "$OS_ARCH" = "IRIX64"; then
|
||||
OS_ARCH=IRIX
|
||||
fi
|
||||
|
||||
if test "$OS_ARCH" = "AIX"; then
|
||||
OS_RELEASE=`uname -v`.`uname -r`
|
||||
fi
|
||||
@@ -1193,9 +1163,6 @@ case "$host" in
|
||||
CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
|
||||
fi
|
||||
;;
|
||||
*-beos*)
|
||||
HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
|
||||
;;
|
||||
*os2*)
|
||||
;;
|
||||
*)
|
||||
@@ -1268,34 +1235,6 @@ case "$target" in
|
||||
RESOLVE_LINK_SYMBOLS=1
|
||||
;;
|
||||
|
||||
*-beos*)
|
||||
AC_DEFINE(XP_BEOS)
|
||||
AC_DEFINE(BeOS)
|
||||
AC_DEFINE(BEOS)
|
||||
AC_DEFINE(_POSIX_SOURCE)
|
||||
DSO_LDOPTS=-nostart
|
||||
MDCPUCFG_H=_beos.cfg
|
||||
USE_BTHREADS=1
|
||||
PR_MD_ARCH_DIR=beos
|
||||
RESOLVE_LINK_SYMBOLS=1
|
||||
case "${target_cpu}" in
|
||||
i*86)
|
||||
_OPTIMIZE_FLAGS=-O2
|
||||
_DEBUG_FLAGS='-gdwarf-2 -O0'
|
||||
MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
|
||||
AC_CHECK_LIB(bind, gethostbyaddr, [OS_LIBS="$OS_LIBS -lbind -lsocket"])
|
||||
;;
|
||||
powerpc)
|
||||
CC=mwcc
|
||||
CCC=mwcc
|
||||
LD=mwld
|
||||
DSO_LDOPTS='-xms -export pragma -init _init_routine_ -term _term_routine_ -lroot -lnet /boot/develop/lib/ppc/glue-noinit.a /boot/develop/lib/ppc/init_term_dyn.o /boot/develop/lib/ppc/start_dyn.o'
|
||||
_OPTIMIZE_FLAGS=-O2
|
||||
_DEBUG_FLAGS='-g -O0'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*-bsdi*)
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(BSDI)
|
||||
@@ -1521,21 +1460,6 @@ tools are selected during the Xcode/Developer Tools installation.])
|
||||
fi
|
||||
;;
|
||||
|
||||
*-dgux*)
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
|
||||
AC_DEFINE(SVR4)
|
||||
AC_DEFINE(SYSV)
|
||||
AC_DEFINE(DGUX)
|
||||
AC_DEFINE(_DGUX_SOURCE)
|
||||
AC_DEFINE(_POSIX4A_DRAFT6_SOURCE)
|
||||
DSO_LDOPTS=-G
|
||||
_OPTIMIZE_FLAGS=-O2
|
||||
_DEBUG_FLAGS=
|
||||
MDCPUCFG_H=_dgux.cfg
|
||||
PR_MD_CSRCS=dgux.c
|
||||
;;
|
||||
|
||||
*-freebsd*)
|
||||
if test -z "$USE_NSPR_THREADS"; then
|
||||
USE_PTHREADS=1
|
||||
@@ -1563,7 +1487,7 @@ tools are selected during the Xcode/Developer Tools installation.])
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(HPUX)
|
||||
AC_DEFINE(_HPUX_SOURCE)
|
||||
# OSF1 and HPUX report the POLLHUP event for a socket when the
|
||||
# HPUX report the POLLHUP event for a socket when the
|
||||
# shutdown(SHUT_WR) operation is called for the remote end, even though
|
||||
# the socket is still writeable. Use select(), instead of poll(), to
|
||||
# workaround this problem.
|
||||
@@ -1708,105 +1632,6 @@ tools are selected during the Xcode/Developer Tools installation.])
|
||||
fi
|
||||
;;
|
||||
|
||||
*-irix*)
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(IRIX)
|
||||
AC_DEFINE(SVR4)
|
||||
AC_DEFINE(_SGI_MP_SOURCE)
|
||||
AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
|
||||
PR_MD_CSRCS=irix.c
|
||||
PR_MD_ASFILES=os_Irix.s
|
||||
MKSHLIB='$(LD) $(DSO_LDOPTS) -rdata_shared -shared -soname $(notdir $@) -o $@'
|
||||
STRIP="$STRIP -f"
|
||||
RESOLVE_LINK_SYMBOLS=1
|
||||
if test -n "$USE_64"; then
|
||||
MDCPUCFG_H=_irix64.cfg
|
||||
else
|
||||
MDCPUCFG_H=_irix32.cfg
|
||||
fi
|
||||
case "${target_os}" in
|
||||
irix6*)
|
||||
AC_DEFINE(IRIX6)
|
||||
USE_PTHREADS=1
|
||||
USE_N32=1
|
||||
COMPILER_TAG=_n32
|
||||
IMPL_STRATEGY=_PTH
|
||||
;;
|
||||
irix5*)
|
||||
AC_DEFINE(IRIX5)
|
||||
USE_NSPR_THREADS=1
|
||||
;;
|
||||
*)
|
||||
USE_PTHREADS=1
|
||||
USE_N32=1
|
||||
;;
|
||||
esac
|
||||
if test "$GNU_CC"; then
|
||||
dnl
|
||||
dnl If we are using gcc with native binutils, we need to
|
||||
dnl suppress the
|
||||
dnl #lineno "filename" num num
|
||||
dnl lines, which confuse IRIX native as. Add -Wp,-P to the
|
||||
dnl gcc command line, which passes -P to the preprocessor.
|
||||
dnl
|
||||
AS='$(CC) -Wp,-P -x assembler-with-cpp -D_ASM -mips2 $(INCLUDES)'
|
||||
CFLAGS="$CFLAGS -Wall -Wno-format"
|
||||
_OPTIMIZE_FLAGS="-O6"
|
||||
else
|
||||
if test -n "$USE_N32"; then
|
||||
AS='as -D_ASM $(INCLUDES) -n32'
|
||||
else
|
||||
AS='as -D_ASM $(INCLUDES)'
|
||||
fi
|
||||
CFLAGS="$CFLAGS -fullwarn -xansi"
|
||||
if test "$USE_N32"; then
|
||||
_OPTIMIZE_FLAGS="-O -OPT:Olimit=4000"
|
||||
else
|
||||
_OPTIMIZE_FLAGS="-O -Olimit 4000"
|
||||
fi
|
||||
if test "$USE_MDUPDATE"; then
|
||||
CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
|
||||
fi
|
||||
case "${target}" in
|
||||
*-irix6.*)
|
||||
CFLAGS="$CFLAGS -multigot"
|
||||
DSO_LDOPTS="-no_unresolved"
|
||||
if test "$USE_N32"; then
|
||||
CFLAGS="$CFLAGS -n32 -woff 1209"
|
||||
DSO_LDOPTS="$DSO_LDOPTS -n32"
|
||||
else
|
||||
if test "$USE_64"; then
|
||||
CFLAGS="$CFLAGS -64"
|
||||
else
|
||||
CFLAGS="$CFLAGS -32"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
CFLAGS="$CFLAGS -xgot"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test "${target_os}" = "irix5.3"; then
|
||||
AC_DEFINE(IRIX5_3)
|
||||
fi
|
||||
case "${target_os}" in
|
||||
irix6.5)
|
||||
if test -z "$GNU_CC"; then
|
||||
CFLAGS="$CFLAGS -mips3"
|
||||
fi
|
||||
AC_DEFINE(_PR_HAVE_GETPROTO_R)
|
||||
AC_DEFINE(_PR_HAVE_GETPROTO_R_POINTER)
|
||||
AC_DEFINE(_PR_HAVE_SGI_PRDA_PROCMASK)
|
||||
;;
|
||||
irix5*)
|
||||
;;
|
||||
*)
|
||||
AC_DEFINE(_PR_HAVE_SGI_PRDA_PROCMASK)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*-linux*|*-gnu*|*-k*bsd*-gnu|*-android*|*-linuxandroid*)
|
||||
if test -z "$USE_NSPR_THREADS"; then
|
||||
USE_PTHREADS=1
|
||||
@@ -2173,47 +1998,6 @@ tools are selected during the Xcode/Developer Tools installation.])
|
||||
MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
|
||||
;;
|
||||
|
||||
*-osf*)
|
||||
SHELL_OVERRIDE="SHELL = /usr/bin/ksh"
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(OSF1)
|
||||
AC_DEFINE(_REENTRANT)
|
||||
# OSF1 and HPUX report the POLLHUP event for a socket when the
|
||||
# shutdown(SHUT_WR) operation is called for the remote end, even though
|
||||
# the socket is still writeable. Use select(), instead of poll(), to
|
||||
# workaround this problem.
|
||||
AC_DEFINE(_PR_POLL_WITH_SELECT)
|
||||
|
||||
if echo "$OS_RELEASE" | egrep -c '(V2.0|V3.2)' 2>/dev/null ; then
|
||||
USE_NSPR_THREADS=1
|
||||
fi
|
||||
|
||||
if test -z "$GNU_CC"; then
|
||||
CC="$CC -std1 -ieee_with_inexact"
|
||||
if test "$OS_RELEASE" != "V2.0"; then
|
||||
CC="$CC -readonly_strings"
|
||||
fi
|
||||
_OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
|
||||
AC_CHECK_HEADER(machine/builtins.h, AC_DEFINE(OSF1_HAVE_MACHINE_BUILTINS_H))
|
||||
else
|
||||
CFLAGS="$CFLAGS -mieee"
|
||||
CXXFLAGS="$CXXFLAGS -mieee"
|
||||
fi
|
||||
|
||||
if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
|
||||
AC_DEFINE(HAVE_INT_LOCALTIME_R)
|
||||
else
|
||||
AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
|
||||
AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
|
||||
fi
|
||||
if echo $OS_RELEASE | grep -c V4.0 >/dev/null; then
|
||||
AC_DEFINE(OSF1V4_MAP_PRIVATE_BUG)
|
||||
fi
|
||||
DSO_LDOPTS='-shared -all -expect_unresolved "*" -soname $(notdir $@)'
|
||||
MDCPUCFG_H=_osf1.cfg
|
||||
PR_MD_CSRCS=osf1.c
|
||||
;;
|
||||
|
||||
*-qnx*)
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(QNX)
|
||||
@@ -2421,76 +2205,6 @@ tools are selected during the Xcode/Developer Tools installation.])
|
||||
CPU_ARCH=x86
|
||||
;;
|
||||
|
||||
*-symbian*)
|
||||
AC_ARG_WITH(symbian-sdk,
|
||||
[ --with-symbian-sdk=SYMBIAN_SDK_DIR
|
||||
The path to the Symbian SDK],
|
||||
SYMBIAN_SDK_DIR=$withval)
|
||||
|
||||
echo -----------------------------------------------------------------------------
|
||||
echo Building with Symbian SDK in: $SYMBIAN_SDK_DIR
|
||||
echo -----------------------------------------------------------------------------
|
||||
|
||||
AC_DEFINE(XP_UNIX)
|
||||
AC_DEFINE(SYMBIAN)
|
||||
AC_DEFINE(__arm__)
|
||||
AC_DEFINE(__SYMBIAN32__)
|
||||
AC_DEFINE(_UNICODE)
|
||||
AC_DEFINE(NDEBUG)
|
||||
AC_DEFINE(__SUPPORT_CPP_EXCEPTIONS__)
|
||||
AC_DEFINE(MOZ_STDERR_TO_STDOUT)
|
||||
AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
|
||||
AC_DEFINE(HAVE_SOCKLEN_T)
|
||||
USE_PTHREADS=1
|
||||
LIB_SUFFIX=lib
|
||||
DLL_SUFFIX=dll
|
||||
MKSHLIB=
|
||||
DSO_LDOPTS=
|
||||
DSO_CFLAGS=
|
||||
VISIBILITY_FLAGS=
|
||||
MDCPUCFG_H=_symbian.cfg
|
||||
PR_MD_CSRCS=symbian.c
|
||||
NSINSTALL=nsinstall
|
||||
RANLIB='echo no ranlib '
|
||||
CPU_ARCH=ARM
|
||||
OS_ARCH=SYMBIAN
|
||||
OS_EXE_CFLAGS="$OS_EXE_CFLAGS -D__EXE__"
|
||||
CFLAGS="$CFLAGS -MD -nostdinc"
|
||||
SYMBIAN_SYS_INCLUDE="-I$SYMBIAN_SDK_DIR/Epoc32/include/variant -I$SYMBIAN_SDK_DIR/Epoc32/include -I$SYMBIAN_SDK_DIR/Epoc32/include/stdapis"
|
||||
echo -------------------------------------------------------
|
||||
echo SYMBIAN_SYS_INCLUDE is: $SYMBIAN_SYS_INCLUDE
|
||||
echo -------------------------------------------------------
|
||||
case "$OS_TARGET" in
|
||||
WINSCW)
|
||||
CC=mwccsym2.exe
|
||||
CXX=mwccsym2.exe
|
||||
LD=mwldsym2.exe
|
||||
AR=mwldsym2.exe
|
||||
WINSCW_LD_DIR="\$(SYMBIAN_SDK_DIR)/EPOC32/RELEASE/WINSCW/UDEB"
|
||||
CFLAGS="$CFLAGS -O0 -inline off -wchar_t off -align 4 -warnings on -w nohidevirtual,nounusedexpr -msgstyle gcc -enum int -str pool -exc ms -trigraphs on -nostderr -gccdep -cwd source -i- -I\$(VPATH)"
|
||||
SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include Symbian_OS_v9.2.hrh"
|
||||
AR_FLAGS="-library -msgstyle gcc -stdlib -subsystem windows -noimplib -o \$@"
|
||||
AC_DEFINE(_DEBUG)
|
||||
AC_DEFINE(__CW32__)
|
||||
AC_DEFINE(__WINS__)
|
||||
AC_DEFINE(__WINSCW__)
|
||||
DEFINES="$DEFINES -U_WIN32"
|
||||
;;
|
||||
GCCE)
|
||||
CFLAGS="$CFLAGS -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -x c -msoft-float"
|
||||
CXXFLAGS="$CXXFLAGS $CFLAGS -Wno-ctor-dtor-privacy"
|
||||
SYMBIAN_SYS_INCLUDE="$SYMBIAN_SYS_INCLUDE -include $SYMBIAN_SDK_DIR/EPOC32/INCLUDE/GCCE/GCCE.h"
|
||||
AC_DEFINE(__GCCE__)
|
||||
AC_DEFINE(__EABI__)
|
||||
DEFINES="$DEFINES -D__PRODUCT_INCLUDE__=$SYMBIAN_SDK_DIR/Epoc32/include/variant/Symbian_OS_v9.2.hrh"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Missing OS_TARGET for ${target}. Set --enable-symbian-target to with 'WINSCW' or 'GCCE'.])
|
||||
;;
|
||||
esac
|
||||
CFLAGS="$CFLAGS ${SYMBIAN_SYS_INCLUDE}"
|
||||
;;
|
||||
|
||||
*-os2*)
|
||||
AC_DEFINE(XP_OS2)
|
||||
AC_DEFINE(XP_PC)
|
||||
@@ -2548,7 +2262,7 @@ dnl The same goes for BeOS.
|
||||
dnl OS/2 has dlfcn in libc.
|
||||
|
||||
case $target in
|
||||
*-darwin*|*-beos*|*-os2*)
|
||||
*-darwin*|*-os2*)
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_LIB(dl, dlopen,
|
||||
@@ -2714,19 +2428,6 @@ AC_ARG_ENABLE(nspr-threads,
|
||||
USE_NSPR_THREADS=1
|
||||
fi])
|
||||
|
||||
case "$target" in
|
||||
*-beos*)
|
||||
AC_ARG_WITH(bthreads,
|
||||
[ --with-bthreads Use system bthreads library as thread subsystem
|
||||
(BeOS only)],
|
||||
[ if test "$withval" = "yes"; then
|
||||
USE_BTHREADS=1
|
||||
USE_USER_PTHREADS=
|
||||
USE_PTHREADS=
|
||||
fi])
|
||||
;;
|
||||
esac
|
||||
|
||||
fi # SKIP_LIBRARY_CHECKS
|
||||
|
||||
AC_ARG_ENABLE(ipv6,
|
||||
@@ -2884,21 +2585,13 @@ case "$target" in
|
||||
AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L)
|
||||
fi
|
||||
;;
|
||||
*-irix*)
|
||||
if test "${target_os}" = "irix6.5"; then
|
||||
if test -n "$USE_PTHREADS"; then
|
||||
AC_DEFINE(_PR_HAVE_GETHOST_R)
|
||||
AC_DEFINE(_PR_HAVE_GETHOST_R_POINTER)
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*-linux*|*-gnu*|*-k*bsd*-gnu)
|
||||
if test -n "$USE_NSPR_THREADS"; then
|
||||
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
|
||||
fi
|
||||
;;
|
||||
*-mingw*|*-msys*|*-cygwin*|*-mks*|*-os2*|*-beos*)
|
||||
dnl win32, os2 & beos cannot use pthreads
|
||||
*-mingw*|*-msys*|*-cygwin*|*-mks*|*-os2*)
|
||||
dnl win32, os2 cannot use pthreads
|
||||
USE_PTHREADS=
|
||||
_PTHREAD_LDFLAGS=
|
||||
USE_USER_PTHREADS=
|
||||
@@ -2908,18 +2601,6 @@ case "$target" in
|
||||
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
|
||||
fi
|
||||
;;
|
||||
*-osf*)
|
||||
if test -n "$USE_NSPR_THREADS"; then
|
||||
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
|
||||
fi
|
||||
if test -n "$USE_PTHREADS"; then
|
||||
if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then
|
||||
:
|
||||
else
|
||||
AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*-solaris*)
|
||||
if test -n "$USE_NSPR_THREADS"; then
|
||||
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
|
||||
@@ -3124,7 +2805,6 @@ AC_SUBST(CYGWIN_WRAPPER)
|
||||
AC_SUBST(VISIBILITY_FLAGS)
|
||||
AC_SUBST(WRAP_SYSTEM_INCLUDES)
|
||||
AC_SUBST(MACOS_SDK_DIR)
|
||||
AC_SUBST(SYMBIAN_SDK_DIR)
|
||||
AC_SUBST(NEXT_ROOT)
|
||||
AC_SUBST(MT)
|
||||
|
||||
|
||||
@@ -43,10 +43,6 @@ OS_LIBS = -lc_r
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),IRIX)
|
||||
OS_LIBS = -lc
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),SunOS)
|
||||
OS_LIBS = -lc
|
||||
MAPFILE = $(OBJDIR)/pldsmap.sun
|
||||
|
||||
+39
-25
@@ -35,34 +35,40 @@ PR_IMPLEMENT(void) PL_InitArenaPool(
|
||||
* align = 1 to 32.
|
||||
*/
|
||||
static const PRUint8 pmasks[33] = {
|
||||
0, /* not used */
|
||||
0, 1, 3, 3, 7, 7, 7, 7,15,15,15,15,15,15,15,15, /* 1 ... 16 */
|
||||
31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31}; /* 17 ... 32 */
|
||||
0, /* not used */
|
||||
0, 1, 3, 3, 7, 7, 7, 7,15,15,15,15,15,15,15,15, /* 1 ... 16 */
|
||||
31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31 /* 17 ... 32 */
|
||||
};
|
||||
|
||||
if (align == 0)
|
||||
if (align == 0) {
|
||||
align = PL_ARENA_DEFAULT_ALIGN;
|
||||
}
|
||||
|
||||
if (align < sizeof(pmasks)/sizeof(pmasks[0]))
|
||||
if (align < sizeof(pmasks)/sizeof(pmasks[0])) {
|
||||
pool->mask = pmasks[align];
|
||||
else
|
||||
}
|
||||
else {
|
||||
pool->mask = PR_BITMASK(PR_CeilingLog2(align));
|
||||
}
|
||||
|
||||
pool->first.next = NULL;
|
||||
/* Set all three addresses in pool->first to the same dummy value.
|
||||
* These addresses are only compared with each other, but never
|
||||
* dereferenced. */
|
||||
pool->first.base = pool->first.avail = pool->first.limit =
|
||||
(PRUword)PL_ARENA_ALIGN(pool, &pool->first + 1);
|
||||
(PRUword)PL_ARENA_ALIGN(pool, &pool->first + 1);
|
||||
pool->current = &pool->first;
|
||||
/*
|
||||
* Compute the net size so that each arena's gross size is |size|.
|
||||
* sizeof(PLArena) + pool->mask is the header and alignment slop
|
||||
* that PL_ArenaAllocate adds to the net size.
|
||||
*/
|
||||
if (size > sizeof(PLArena) + pool->mask)
|
||||
if (size > sizeof(PLArena) + pool->mask) {
|
||||
pool->arenasize = size - (sizeof(PLArena) + pool->mask);
|
||||
else
|
||||
}
|
||||
else {
|
||||
pool->arenasize = size;
|
||||
}
|
||||
#ifdef PL_ARENAMETER
|
||||
memset(&pool->stats, 0, sizeof pool->stats);
|
||||
pool->stats.name = strdup(name);
|
||||
@@ -74,15 +80,15 @@ PR_IMPLEMENT(void) PL_InitArenaPool(
|
||||
|
||||
/*
|
||||
** PL_ArenaAllocate() -- allocate space from an arena pool
|
||||
**
|
||||
**
|
||||
** Description: PL_ArenaAllocate() allocates space from an arena
|
||||
** pool.
|
||||
** pool.
|
||||
**
|
||||
** First, try to satisfy the request from arenas starting at
|
||||
** pool->current. Then try to allocate a new arena from the heap.
|
||||
**
|
||||
** Returns: pointer to allocated space or NULL
|
||||
**
|
||||
**
|
||||
** Notes: The original implementation had some difficult to
|
||||
** solve bugs; the code was difficult to read. Sometimes it's
|
||||
** just easier to rewrite it. I did that. larryh.
|
||||
@@ -93,16 +99,17 @@ PR_IMPLEMENT(void) PL_InitArenaPool(
|
||||
|
||||
PR_IMPLEMENT(void *) PL_ArenaAllocate(PLArenaPool *pool, PRUint32 nb)
|
||||
{
|
||||
PLArena *a;
|
||||
PLArena *a;
|
||||
char *rp; /* returned pointer */
|
||||
PRUint32 nbOld;
|
||||
|
||||
PR_ASSERT((nb & pool->mask) == 0);
|
||||
|
||||
|
||||
nbOld = nb;
|
||||
nb = (PRUword)PL_ARENA_ALIGN(pool, nb); /* force alignment */
|
||||
if (nb < nbOld)
|
||||
if (nb < nbOld) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* attempt to allocate from arenas at pool->current */
|
||||
{
|
||||
@@ -117,8 +124,8 @@ PR_IMPLEMENT(void *) PL_ArenaAllocate(PLArenaPool *pool, PRUint32 nb)
|
||||
} while( NULL != (a = a->next) );
|
||||
}
|
||||
|
||||
/* attempt to allocate from the heap */
|
||||
{
|
||||
/* attempt to allocate from the heap */
|
||||
{
|
||||
PRUint32 sz = PR_MAX(pool->arenasize, nb);
|
||||
if (PR_UINT32_MAX - sz < sizeof *a + pool->mask) {
|
||||
a = NULL;
|
||||
@@ -133,13 +140,14 @@ PR_IMPLEMENT(void *) PL_ArenaAllocate(PLArenaPool *pool, PRUint32 nb)
|
||||
rp = (char *)a->avail;
|
||||
a->avail += nb;
|
||||
PR_ASSERT(a->avail <= a->limit);
|
||||
/* the newly allocated arena is linked after pool->current
|
||||
/* the newly allocated arena is linked after pool->current
|
||||
* and becomes pool->current */
|
||||
a->next = pool->current->next;
|
||||
pool->current->next = a;
|
||||
pool->current = a;
|
||||
if ( NULL == pool->first.next )
|
||||
if ( NULL == pool->first.next ) {
|
||||
pool->first.next = a;
|
||||
}
|
||||
PL_COUNT_ARENA(pool,++);
|
||||
COUNT(pool, nmallocs);
|
||||
return(rp);
|
||||
@@ -155,11 +163,13 @@ PR_IMPLEMENT(void *) PL_ArenaGrow(
|
||||
{
|
||||
void *newp;
|
||||
|
||||
if (PR_UINT32_MAX - size < incr)
|
||||
if (PR_UINT32_MAX - size < incr) {
|
||||
return NULL;
|
||||
}
|
||||
PL_ARENA_ALLOCATE(newp, pool, size + incr);
|
||||
if (newp)
|
||||
if (newp) {
|
||||
memcpy(newp, p, size);
|
||||
}
|
||||
return newp;
|
||||
}
|
||||
|
||||
@@ -182,8 +192,9 @@ PR_IMPLEMENT(void) PL_ClearArenaPool(PLArenaPool *pool, PRInt32 pattern)
|
||||
static void FreeArenaList(PLArenaPool *pool, PLArena *head)
|
||||
{
|
||||
PLArena *a = head->next;
|
||||
if (!a)
|
||||
if (!a) {
|
||||
return;
|
||||
}
|
||||
|
||||
head->next = NULL;
|
||||
|
||||
@@ -224,8 +235,9 @@ PR_IMPLEMENT(void) PL_FinishArenaPool(PLArenaPool *pool)
|
||||
{
|
||||
PLArenaStats *stats, **statsp;
|
||||
|
||||
if (pool->stats.name)
|
||||
if (pool->stats.name) {
|
||||
PR_DELETE(pool->stats.name);
|
||||
}
|
||||
for (statsp = &arena_stats_list; (stats = *statsp) != 0;
|
||||
statsp = &stats->next) {
|
||||
if (stats == &pool->stats) {
|
||||
@@ -266,8 +278,9 @@ PR_IMPLEMENT(void) PL_ArenaCountAllocation(PLArenaPool *pool, PRUint32 nb)
|
||||
{
|
||||
pool->stats.nallocs++;
|
||||
pool->stats.nbytes += nb;
|
||||
if (nb > pool->stats.maxalloc)
|
||||
if (nb > pool->stats.maxalloc) {
|
||||
pool->stats.maxalloc = nb;
|
||||
}
|
||||
pool->stats.variance += nb * nb;
|
||||
}
|
||||
|
||||
@@ -284,8 +297,9 @@ PR_IMPLEMENT(void) PL_ArenaCountGrowth(
|
||||
pool->stats.nbytes += incr;
|
||||
pool->stats.variance -= size * size;
|
||||
size += incr;
|
||||
if (size > pool->stats.maxalloc)
|
||||
if (size > pool->stats.maxalloc) {
|
||||
pool->stats.maxalloc = size;
|
||||
}
|
||||
pool->stats.variance += size * size;
|
||||
}
|
||||
|
||||
|
||||
+28
-16
@@ -51,8 +51,9 @@ DefaultAllocEntry(void *pool, const void *key)
|
||||
static void PR_CALLBACK
|
||||
DefaultFreeEntry(void *pool, PLHashEntry *he, PRUintn flag)
|
||||
{
|
||||
if (flag == HT_FREE_ENTRY)
|
||||
if (flag == HT_FREE_ENTRY) {
|
||||
PR_Free(he);
|
||||
}
|
||||
}
|
||||
|
||||
static PLHashAllocOps defaultHashAllocOps = {
|
||||
@@ -72,15 +73,19 @@ PL_NewHashTable(PRUint32 n, PLHashFunction keyHash,
|
||||
n = MINBUCKETSLOG2;
|
||||
} else {
|
||||
n = PR_CeilingLog2(n);
|
||||
if ((PRInt32)n < 0)
|
||||
if ((PRInt32)n < 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!allocOps) allocOps = &defaultHashAllocOps;
|
||||
if (!allocOps) {
|
||||
allocOps = &defaultHashAllocOps;
|
||||
}
|
||||
|
||||
ht = (PLHashTable*)((*allocOps->allocTable)(allocPriv, sizeof *ht));
|
||||
if (!ht)
|
||||
return 0;
|
||||
if (!ht) {
|
||||
return 0;
|
||||
}
|
||||
memset(ht, 0, sizeof *ht);
|
||||
ht->shift = PL_HASH_BITS - n;
|
||||
n = 1 << n;
|
||||
@@ -202,7 +207,7 @@ PL_HashTableRawAdd(PLHashTable *ht, PLHashEntry **hep,
|
||||
oldbuckets = ht->buckets;
|
||||
nb = 2 * n * sizeof(PLHashEntry *);
|
||||
ht->buckets = (PLHashEntry**)
|
||||
((*ht->allocOps->allocTable)(ht->allocPriv, nb));
|
||||
((*ht->allocOps->allocTable)(ht->allocPriv, nb));
|
||||
if (!ht->buckets) {
|
||||
ht->buckets = oldbuckets;
|
||||
return 0;
|
||||
@@ -231,8 +236,9 @@ PL_HashTableRawAdd(PLHashTable *ht, PLHashEntry **hep,
|
||||
|
||||
/* Make a new key value entry */
|
||||
he = (*ht->allocOps->allocEntry)(ht->allocPriv, key);
|
||||
if (!he)
|
||||
return 0;
|
||||
if (!he) {
|
||||
return 0;
|
||||
}
|
||||
he->keyHash = keyHash;
|
||||
he->key = key;
|
||||
he->value = value;
|
||||
@@ -256,8 +262,9 @@ PL_HashTableAdd(PLHashTable *ht, const void *key, void *value)
|
||||
/* key,value pair is already present in table */
|
||||
return he;
|
||||
}
|
||||
if (he->value)
|
||||
if (he->value) {
|
||||
(*ht->allocOps->freeEntry)(ht->allocPriv, he, HT_FREE_VALUE);
|
||||
}
|
||||
he->value = value;
|
||||
return he;
|
||||
}
|
||||
@@ -280,7 +287,7 @@ PL_HashTableRawRemove(PLHashTable *ht, PLHashEntry **hep, PLHashEntry *he)
|
||||
oldbuckets = ht->buckets;
|
||||
nb = n * sizeof(PLHashEntry*) / 2;
|
||||
ht->buckets = (PLHashEntry**)(
|
||||
(*ht->allocOps->allocTable)(ht->allocPriv, nb));
|
||||
(*ht->allocOps->allocTable)(ht->allocPriv, nb));
|
||||
if (!ht->buckets) {
|
||||
ht->buckets = oldbuckets;
|
||||
return;
|
||||
@@ -315,8 +322,9 @@ PL_HashTableRemove(PLHashTable *ht, const void *key)
|
||||
|
||||
keyHash = (*ht->keyHash)(key);
|
||||
hep = PL_HashTableRawLookup(ht, keyHash, key);
|
||||
if ((he = *hep) == 0)
|
||||
if ((he = *hep) == 0) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
/* Hit; remove element */
|
||||
PL_HashTableRawRemove(ht, hep, he);
|
||||
@@ -414,11 +422,13 @@ PL_HashTableDumpMeter(PLHashTable *ht, PLHashEnumerator dump, FILE *fp)
|
||||
nbuckets = NBUCKETS(ht);
|
||||
for (i = 0; i < nbuckets; i++) {
|
||||
he = ht->buckets[i];
|
||||
if (!he)
|
||||
if (!he) {
|
||||
continue;
|
||||
}
|
||||
nchains++;
|
||||
for (n = 0; he; he = he->next)
|
||||
for (n = 0; he; he = he->next) {
|
||||
n++;
|
||||
}
|
||||
variance += n * n;
|
||||
if (n > maxChainLen) {
|
||||
maxChainLen = n;
|
||||
@@ -434,15 +444,16 @@ PL_HashTableDumpMeter(PLHashTable *ht, PLHashEnumerator dump, FILE *fp)
|
||||
fprintf(fp, " number of grows: %u\n", ht->ngrows);
|
||||
fprintf(fp, " number of shrinks: %u\n", ht->nshrinks);
|
||||
fprintf(fp, " mean steps per hash: %g\n", (double)ht->nsteps
|
||||
/ ht->nlookups);
|
||||
/ ht->nlookups);
|
||||
fprintf(fp, "mean hash chain length: %g\n", mean);
|
||||
fprintf(fp, " standard deviation: %g\n", sqrt(variance));
|
||||
fprintf(fp, " max hash chain length: %u\n", maxChainLen);
|
||||
fprintf(fp, " max hash chain: [%u]\n", maxChain);
|
||||
|
||||
for (he = ht->buckets[maxChain], i = 0; he; he = he->next, i++)
|
||||
if ((*dump)(he, i, fp) != HT_ENUMERATE_NEXT)
|
||||
if ((*dump)(he, i, fp) != HT_ENUMERATE_NEXT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif /* HASHMETER */
|
||||
|
||||
@@ -465,8 +476,9 @@ PL_HashString(const void *key)
|
||||
const PRUint8 *s;
|
||||
|
||||
h = 0;
|
||||
for (s = (const PRUint8*)key; *s; s++)
|
||||
for (s = (const PRUint8*)key; *s; s++) {
|
||||
h = PR_ROTATE_LEFT32(h, 4) ^ *s;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@ PRVersionDescription VERSION_DESC_NAME =
|
||||
* must not end in a '$' to prevent rcs keyword substitution.
|
||||
*/
|
||||
static char rcsid[] = "$Header: NSPR " PR_VERSION _DEBUG_STRING
|
||||
" " _BUILD_STRING " $";
|
||||
" " _BUILD_STRING " $";
|
||||
static char sccsid[] = "@(#)NSPR " PR_VERSION _DEBUG_STRING
|
||||
" " _BUILD_STRING;
|
||||
" " _BUILD_STRING;
|
||||
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
@@ -86,7 +86,7 @@ PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint()
|
||||
* from being optimized away as unused variables.
|
||||
*/
|
||||
const char *dummy;
|
||||
|
||||
|
||||
dummy = rcsid;
|
||||
dummy = sccsid;
|
||||
#endif
|
||||
|
||||
@@ -19,11 +19,11 @@ PR_BEGIN_EXTERN_C
|
||||
* is zero, the source data is assumed to be null-terminated, and PL_strlen
|
||||
* is used to determine the source length. If the "dest" parameter is not
|
||||
* null, it is assumed to point to a buffer of sufficient size (which may be
|
||||
* calculated: ((srclen + 2)/3)*4) into which the encoded data is placed
|
||||
* calculated: ((srclen + 2)/3)*4) into which the encoded data is placed
|
||||
* (without any termination). If the "dest" parameter is null, a buffer is
|
||||
* allocated from the heap to hold the encoded data, and the result *will*
|
||||
* be terminated with an extra null character. It is the caller's
|
||||
* responsibility to free the result when it is allocated. A null is returned
|
||||
* be terminated with an extra null character. It is the caller's
|
||||
* responsibility to free the result when it is allocated. A null is returned
|
||||
* if the allocation fails.
|
||||
*
|
||||
* NOTE: when calculating ((srclen + 2)/3)*4), first ensure that
|
||||
@@ -56,7 +56,7 @@ PL_Base64Encode
|
||||
* caller's responsibility to free the result when it is allocated. A null
|
||||
* is retuned if the allocation fails, or if the source is not well-coded.
|
||||
*
|
||||
* NOTE: when calculating (srclen * 3)/4, first ensure that
|
||||
* NOTE: when calculating (srclen * 3)/4, first ensure that
|
||||
* srclen <= PR_UINT32_MAX/3
|
||||
* to avoid PRUint32 overflow. Alternatively, calculate
|
||||
* (srclen/4) * 3 + ((srclen%4) * 3)/4
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
typedef struct PLOptionInternal PLOptionInternal;
|
||||
typedef struct PLOptionInternal PLOptionInternal;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PL_OPT_OK, /* all's well with the option */
|
||||
PL_OPT_EOL, /* end of options list */
|
||||
PL_OPT_BAD /* invalid option (and value) */
|
||||
PL_OPT_OK, /* all's well with the option */
|
||||
PL_OPT_EOL, /* end of options list */
|
||||
PL_OPT_BAD /* invalid option (and value) */
|
||||
} PLOptStatus;
|
||||
|
||||
typedef struct PLLongOpt
|
||||
@@ -30,7 +30,7 @@ typedef struct PLLongOpt
|
||||
const char * longOptName; /* long option name string */
|
||||
PRIntn longOption; /* value put in PLOptState for this option. */
|
||||
PRBool valueRequired; /* If option name not followed by '=', */
|
||||
/* value is the next argument from argv. */
|
||||
/* value is the next argument from argv. */
|
||||
} PLLongOpt;
|
||||
|
||||
typedef struct PLOptState
|
||||
@@ -47,27 +47,27 @@ typedef struct PLOptState
|
||||
/*
|
||||
* PL_CreateOptState
|
||||
*
|
||||
* The argument "options" points to a string of single-character option
|
||||
* names. Option names that may have an option argument value must be
|
||||
* followed immediately by a ':' character.
|
||||
* The argument "options" points to a string of single-character option
|
||||
* names. Option names that may have an option argument value must be
|
||||
* followed immediately by a ':' character.
|
||||
*/
|
||||
PR_EXTERN(PLOptState*) PL_CreateOptState(
|
||||
PRIntn argc, char **argv, const char *options);
|
||||
PRIntn argc, char **argv, const char *options);
|
||||
|
||||
/*
|
||||
/*
|
||||
* PL_CreateLongOptState
|
||||
*
|
||||
* Alternative to PL_CreateOptState.
|
||||
* Allows caller to specify BOTH a string of single-character option names,
|
||||
* AND an array of structures describing "long" (keyword) option names.
|
||||
* The array is terminated by a structure in which longOptName is NULL.
|
||||
* Alternative to PL_CreateOptState.
|
||||
* Allows caller to specify BOTH a string of single-character option names,
|
||||
* AND an array of structures describing "long" (keyword) option names.
|
||||
* The array is terminated by a structure in which longOptName is NULL.
|
||||
* Long option values (arguments) may always be given as "--name=value".
|
||||
* If PLLongOpt.valueRequired is not PR_FALSE, and the option name was not
|
||||
* followed by '=' then the next argument from argv is taken as the value.
|
||||
* If PLLongOpt.valueRequired is not PR_FALSE, and the option name was not
|
||||
* followed by '=' then the next argument from argv is taken as the value.
|
||||
*/
|
||||
PR_EXTERN(PLOptState*) PL_CreateLongOptState(
|
||||
PRIntn argc, char **argv, const char *options,
|
||||
const PLLongOpt *longOpts);
|
||||
PRIntn argc, char **argv, const char *options,
|
||||
const PLLongOpt *longOpts);
|
||||
/*
|
||||
* PL_DestroyOptState
|
||||
*
|
||||
@@ -79,39 +79,39 @@ PR_EXTERN(void) PL_DestroyOptState(PLOptState *opt);
|
||||
/*
|
||||
* PL_GetNextOpt
|
||||
*
|
||||
* When this function returns PL_OPT_OK,
|
||||
* - opt->option will hold the single-character option name that was parsed,
|
||||
* or zero.
|
||||
* When opt->option is zero, the token parsed was either a "long" (keyword)
|
||||
* option or a positional parameter.
|
||||
* For a positional parameter,
|
||||
* When this function returns PL_OPT_OK,
|
||||
* - opt->option will hold the single-character option name that was parsed,
|
||||
* or zero.
|
||||
* When opt->option is zero, the token parsed was either a "long" (keyword)
|
||||
* option or a positional parameter.
|
||||
* For a positional parameter,
|
||||
* - opt->longOptIndex will contain -1, and
|
||||
* - opt->value will point to the positional parameter string.
|
||||
* For a long option name,
|
||||
* - opt->longOptIndex will contain the non-negative index of the
|
||||
* PLLongOpt structure in the caller's array of PLLongOpt structures
|
||||
* corresponding to the long option name, and
|
||||
* For a single-character or long option,
|
||||
* For a long option name,
|
||||
* - opt->longOptIndex will contain the non-negative index of the
|
||||
* PLLongOpt structure in the caller's array of PLLongOpt structures
|
||||
* corresponding to the long option name, and
|
||||
* For a single-character or long option,
|
||||
* - opt->longOption will contain the value of the single-character option
|
||||
* name, or the value of the longOption from the PLLongOpt structure
|
||||
* for that long option. See notes below.
|
||||
* - opt->value will point to the argument option string, or will
|
||||
* be NULL if option does not require argument. If option requires
|
||||
* argument but it is not provided, PL_OPT_BAD is returned.
|
||||
* When opt->option is non-zero,
|
||||
* When opt->option is non-zero,
|
||||
* - opt->longOptIndex will be -1
|
||||
* When this function returns PL_OPT_EOL, or PL_OPT_BAD, the contents of
|
||||
* opt are undefined.
|
||||
*
|
||||
* Notes: It is possible to ignore opt->option, and always look at
|
||||
* Notes: It is possible to ignore opt->option, and always look at
|
||||
* opt->longOption instead. opt->longOption will contain the same value
|
||||
* as opt->option for single-character option names, and will contain the
|
||||
* value of longOption from the PLLongOpt structure for long option names.
|
||||
* This means that it is possible to equivalence long option names to
|
||||
* This means that it is possible to equivalence long option names to
|
||||
* single character names by giving the longOption in the PLLongOpt struct
|
||||
* the same value as the single-character option name.
|
||||
* the same value as the single-character option name.
|
||||
* For long options that are NOT intended to be equivalent to any single-
|
||||
* character option, the longOption value should be chosen to not match
|
||||
* character option, the longOption value should be chosen to not match
|
||||
* any possible single character name. It might be advisable to choose
|
||||
* longOption values greater than 0xff for such long options.
|
||||
*/
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
* plstr.h
|
||||
*
|
||||
* This header file exports the API to the NSPR portable library or string-
|
||||
* handling functions.
|
||||
*
|
||||
* This API was not designed as an "optimal" or "ideal" string library; it
|
||||
* handling functions.
|
||||
*
|
||||
* This API was not designed as an "optimal" or "ideal" string library; it
|
||||
* was based on the good ol' unix string.3 functions, and was written to
|
||||
*
|
||||
* 1) replace the libc functions, for cross-platform consistency,
|
||||
* 2) complete the API on platforms lacking common functions (e.g.,
|
||||
* 1) replace the libc functions, for cross-platform consistency,
|
||||
* 2) complete the API on platforms lacking common functions (e.g.,
|
||||
* strcase*), and
|
||||
* 3) to implement some obvious "closure" functions that I've seen
|
||||
* people hacking around in our code.
|
||||
@@ -76,13 +76,13 @@ PL_strncpy(char *dest, const char *src, PRUint32 max);
|
||||
/*
|
||||
* PL_strncpyz
|
||||
*
|
||||
* Copies the source string into the destination buffer, up to and including
|
||||
* the trailing '\0' or up but not including the max'th character, whichever
|
||||
* Copies the source string into the destination buffer, up to and including
|
||||
* the trailing '\0' or up but not including the max'th character, whichever
|
||||
* comes first. It does not (can not) verify that the destination buffer is
|
||||
* large enough. The destination string is always terminated with a '\0',
|
||||
* unlike the traditional libc implementation. It returns the "dest" argument.
|
||||
*
|
||||
* NOTE: If you call this with a source "abcdefg" and a max of 5, the
|
||||
* NOTE: If you call this with a source "abcdefg" and a max of 5, the
|
||||
* destination will end up with "abcd\0" (i.e., its strlen length will be 4)!
|
||||
*
|
||||
* This means you can do this:
|
||||
@@ -152,7 +152,7 @@ PL_strcat(char *dst, const char *src);
|
||||
* Appends a copy of the string pointed to by the second argument, up to
|
||||
* the maximum size specified, to the end of the string pointed to by the
|
||||
* first. The destination buffer is not (can not be) checked for sufficient
|
||||
* size. A null destination argument returns null; otherwise, the first
|
||||
* size. A null destination argument returns null; otherwise, the first
|
||||
* argument is returned. If the maximum size limits the copy, then the
|
||||
* result will *not* be null-terminated (JLRU). A null destination
|
||||
* returns null; otherwise, the destination argument is returned.
|
||||
@@ -189,10 +189,10 @@ PL_strcmp(const char *a, const char *b);
|
||||
|
||||
/*
|
||||
* PL_strncmp
|
||||
*
|
||||
*
|
||||
* Returns an integer, the sign of which -- positive, zero, or negative --
|
||||
* reflects the lexical sorting order of the two strings indicated, up to
|
||||
* the maximum specified. The result is positive if the first string comes
|
||||
* the maximum specified. The result is positive if the first string comes
|
||||
* after the second. The NSPR implementation is not i18n. If the maximum
|
||||
* is zero, only the existance or non-existance (pointer is null) of the
|
||||
* strings is compared.
|
||||
@@ -206,7 +206,7 @@ PL_strncmp(const char *a, const char *b, PRUint32 max);
|
||||
*
|
||||
* Returns an integer, the sign of which -- positive, zero or negative --
|
||||
* reflects the case-insensitive lexical sorting order of the two strings
|
||||
* indicated. The result is positive if the first string comes after the
|
||||
* indicated. The result is positive if the first string comes after the
|
||||
* second. The NSPR implementation is not i18n.
|
||||
*/
|
||||
|
||||
@@ -218,7 +218,7 @@ PL_strcasecmp(const char *a, const char *b);
|
||||
*
|
||||
* Returns an integer, the sign of which -- positive, zero or negative --
|
||||
* reflects the case-insensitive lexical sorting order of the first n characters
|
||||
* of the two strings indicated. The result is positive if the first string comes
|
||||
* of the two strings indicated. The result is positive if the first string comes
|
||||
* after the second. The NSPR implementation is not i18n.
|
||||
*/
|
||||
|
||||
@@ -249,7 +249,7 @@ PL_strrchr(const char *s, char c);
|
||||
|
||||
/*
|
||||
* PL_strnchr
|
||||
*
|
||||
*
|
||||
* Returns a pointer to the first instance of the specified character within the
|
||||
* first n characters of the provided string. It returns null if the character
|
||||
* is not found, or if the provided string is null. The character may be the
|
||||
@@ -386,7 +386,7 @@ PL_strcaserstr(const char *big, const char *little);
|
||||
* PL_strncasestr
|
||||
*
|
||||
* Returns a pointer to the first instance of the little string within the first
|
||||
* n characters of the big one, ignoring case. It returns null if either string is
|
||||
* n characters of the big one, ignoring case. It returns null if either string is
|
||||
* null. It returns null if the length of the little string is greater than n.
|
||||
*/
|
||||
|
||||
|
||||
@@ -52,10 +52,6 @@ OS_LIBS = -lc_r
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),IRIX)
|
||||
OS_LIBS = -lc
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),SunOS)
|
||||
OS_LIBS = -lc
|
||||
MAPFILE = $(OBJDIR)/plcmap.sun
|
||||
|
||||
@@ -100,8 +100,8 @@ encode
|
||||
/*
|
||||
* PL_Base64Encode
|
||||
*
|
||||
* If the destination argument is NULL, a return buffer is
|
||||
* allocated, and the data therein will be null-terminated.
|
||||
* If the destination argument is NULL, a return buffer is
|
||||
* allocated, and the data therein will be null-terminated.
|
||||
* If the destination argument is not NULL, it is assumed to
|
||||
* be of sufficient size, and the contents will not be null-
|
||||
* terminated by this routine.
|
||||
@@ -341,8 +341,8 @@ decode
|
||||
* If the destination argument is not null, it is assumed
|
||||
* to be of sufficient size, and the data will not be null-
|
||||
* terminated by this routine.
|
||||
*
|
||||
* Returns null if the allocation fails, or if the source string is
|
||||
*
|
||||
* Returns null if the allocation fails, or if the source string is
|
||||
* not well-formed.
|
||||
*/
|
||||
|
||||
|
||||
@@ -16,14 +16,16 @@
|
||||
|
||||
PR_IMPLEMENT(void) PL_FPrintError(PRFileDesc *fd, const char *msg)
|
||||
{
|
||||
PRErrorCode error = PR_GetError();
|
||||
PRInt32 oserror = PR_GetOSError();
|
||||
const char *name = PR_ErrorToName(error);
|
||||
PRErrorCode error = PR_GetError();
|
||||
PRInt32 oserror = PR_GetOSError();
|
||||
const char *name = PR_ErrorToName(error);
|
||||
|
||||
if (NULL != msg) PR_fprintf(fd, "%s: ", msg);
|
||||
if (NULL != msg) {
|
||||
PR_fprintf(fd, "%s: ", msg);
|
||||
}
|
||||
if (NULL == name)
|
||||
PR_fprintf(
|
||||
fd, " (%d)OUT OF RANGE, oserror = %d\n", error, oserror);
|
||||
fd, " (%d)OUT OF RANGE, oserror = %d\n", error, oserror);
|
||||
else
|
||||
PR_fprintf(
|
||||
fd, "%s(%d), oserror = %d\n",
|
||||
@@ -32,9 +34,11 @@ const char *name = PR_ErrorToName(error);
|
||||
|
||||
PR_IMPLEMENT(void) PL_PrintError(const char *msg)
|
||||
{
|
||||
static PRFileDesc *fd = NULL;
|
||||
if (NULL == fd) fd = PR_GetSpecialFD(PR_StandardError);
|
||||
PL_FPrintError(fd, msg);
|
||||
static PRFileDesc *fd = NULL;
|
||||
if (NULL == fd) {
|
||||
fd = PR_GetSpecialFD(PR_StandardError);
|
||||
}
|
||||
PL_FPrintError(fd, msg);
|
||||
} /* PL_PrintError */
|
||||
|
||||
/* plerror.c */
|
||||
|
||||
@@ -45,20 +45,20 @@ PR_IMPLEMENT(PLOptState*) PL_CreateOptState(
|
||||
} /* PL_CreateOptState */
|
||||
|
||||
PR_IMPLEMENT(PLOptState*) PL_CreateLongOptState(
|
||||
PRIntn argc, char **argv, const char *options,
|
||||
PRIntn argc, char **argv, const char *options,
|
||||
const PLLongOpt *longOpts)
|
||||
{
|
||||
PLOptState *opt = NULL;
|
||||
PLOptionInternal *internal;
|
||||
|
||||
if (NULL == options)
|
||||
if (NULL == options)
|
||||
{
|
||||
PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
|
||||
return opt;
|
||||
}
|
||||
|
||||
opt = PR_NEWZAP(PLOptState);
|
||||
if (NULL == opt)
|
||||
if (NULL == opt)
|
||||
{
|
||||
PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
|
||||
return opt;
|
||||
@@ -124,15 +124,15 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(PLOptState *opt)
|
||||
}
|
||||
internal->xargv = internal->argv[internal->xargc];
|
||||
internal->minus = 0;
|
||||
if (!internal->endOfOpts && ('-' == *internal->xargv))
|
||||
if (!internal->endOfOpts && ('-' == *internal->xargv))
|
||||
{
|
||||
internal->minus++;
|
||||
internal->xargv++; /* and consume */
|
||||
if ('-' == *internal->xargv && internal->longOpts)
|
||||
if ('-' == *internal->xargv && internal->longOpts)
|
||||
{
|
||||
internal->minus++;
|
||||
internal->xargv++;
|
||||
if (0 == *internal->xargv)
|
||||
if (0 == *internal->xargv)
|
||||
{
|
||||
internal->endOfOpts = PR_TRUE;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(PLOptState *opt)
|
||||
** option. See if we can find a match in the list of possible
|
||||
** options supplied.
|
||||
*/
|
||||
if (internal->minus == 2)
|
||||
if (internal->minus == 2)
|
||||
{
|
||||
char * foundEqual = strchr(internal->xargv,'=');
|
||||
PRIntn optNameLen = foundEqual ? (foundEqual - internal->xargv) :
|
||||
@@ -156,19 +156,21 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(PLOptState *opt)
|
||||
opt->option = 0;
|
||||
opt->value = NULL;
|
||||
|
||||
for (; longOpt->longOptName; ++longOpt)
|
||||
for (; longOpt->longOptName; ++longOpt)
|
||||
{
|
||||
if (strncmp(longOpt->longOptName, internal->xargv, optNameLen))
|
||||
continue; /* not a possible match */
|
||||
if (strlen(longOpt->longOptName) != optNameLen)
|
||||
continue; /* not a match */
|
||||
if (strncmp(longOpt->longOptName, internal->xargv, optNameLen)) {
|
||||
continue; /* not a possible match */
|
||||
}
|
||||
if (strlen(longOpt->longOptName) != optNameLen) {
|
||||
continue; /* not a match */
|
||||
}
|
||||
/* option name match */
|
||||
opt->longOptIndex = longOpt - internal->longOpts;
|
||||
opt->longOption = longOpt->longOption;
|
||||
/* value is part of the current argv[] element if = was found */
|
||||
/* note: this sets value even for long options that do not
|
||||
* require option if specified as --long=value */
|
||||
if (foundEqual)
|
||||
if (foundEqual)
|
||||
{
|
||||
opt->value = foundEqual + 1;
|
||||
}
|
||||
@@ -227,8 +229,9 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(PLOptState *opt)
|
||||
internal->xargv = &static_Nul;
|
||||
internal->minus = 0;
|
||||
}
|
||||
else
|
||||
opt->value = NULL;
|
||||
else {
|
||||
opt->value = NULL;
|
||||
}
|
||||
return PL_OPT_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,9 +68,9 @@ PRVersionDescription VERSION_DESC_NAME =
|
||||
* must not end in a '$' to prevent rcs keyword substitution.
|
||||
*/
|
||||
static char rcsid[] = "$Header: NSPR " PR_VERSION _DEBUG_STRING
|
||||
" " _BUILD_STRING " $";
|
||||
" " _BUILD_STRING " $";
|
||||
static char sccsid[] = "@(#)NSPR " PR_VERSION _DEBUG_STRING
|
||||
" " _BUILD_STRING;
|
||||
" " _BUILD_STRING;
|
||||
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
@@ -86,7 +86,7 @@ PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint()
|
||||
* from being optimized away as unused variables.
|
||||
*/
|
||||
const char *dummy;
|
||||
|
||||
|
||||
dummy = rcsid;
|
||||
dummy = sccsid;
|
||||
#endif
|
||||
|
||||
@@ -48,10 +48,12 @@ PL_strcasecmp(const char *a, const char *b)
|
||||
const unsigned char *ua = (const unsigned char *)a;
|
||||
const unsigned char *ub = (const unsigned char *)b;
|
||||
|
||||
if( (const char *)0 == a )
|
||||
if( (const char *)0 == a ) {
|
||||
return ((const char *)0 == b) ? 0 : -1;
|
||||
if( (const char *)0 == b )
|
||||
}
|
||||
if( (const char *)0 == b ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
while( (uc[*ua] == uc[*ub]) && ('\0' != *a) )
|
||||
{
|
||||
@@ -69,10 +71,12 @@ PL_strncasecmp(const char *a, const char *b, PRUint32 max)
|
||||
const unsigned char *ua = (const unsigned char *)a;
|
||||
const unsigned char *ub = (const unsigned char *)b;
|
||||
|
||||
if( (const char *)0 == a )
|
||||
if( (const char *)0 == a ) {
|
||||
return ((const char *)0 == b) ? 0 : -1;
|
||||
if( (const char *)0 == b )
|
||||
}
|
||||
if( (const char *)0 == b ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
while( max && (uc[*ua] == uc[*ub]) && ('\0' != *a) )
|
||||
{
|
||||
@@ -82,7 +86,9 @@ PL_strncasecmp(const char *a, const char *b, PRUint32 max)
|
||||
max--;
|
||||
}
|
||||
|
||||
if( 0 == max ) return (PRIntn)0;
|
||||
if( 0 == max ) {
|
||||
return (PRIntn)0;
|
||||
}
|
||||
|
||||
return (PRIntn)(uc[*ua] - uc[*ub]);
|
||||
}
|
||||
@@ -92,15 +98,20 @@ PL_strcasestr(const char *big, const char *little)
|
||||
{
|
||||
PRUint32 ll;
|
||||
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
ll = strlen(little);
|
||||
|
||||
for( ; *big; big++ )
|
||||
/* obvious improvement available here */
|
||||
if( 0 == PL_strncasecmp(big, little, ll) )
|
||||
return (char *)big;
|
||||
if( 0 == PL_strncasecmp(big, little, ll) ) {
|
||||
return (char *)big;
|
||||
}
|
||||
|
||||
return (char *)0;
|
||||
}
|
||||
@@ -111,18 +122,25 @@ PL_strcaserstr(const char *big, const char *little)
|
||||
const char *p;
|
||||
PRUint32 bl, ll;
|
||||
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
bl = strlen(big);
|
||||
ll = strlen(little);
|
||||
if( bl < ll ) return (char *)0;
|
||||
if( bl < ll ) {
|
||||
return (char *)0;
|
||||
}
|
||||
p = &big[ bl - ll ];
|
||||
|
||||
for( ; p >= big; p-- )
|
||||
/* obvious improvement available here */
|
||||
if( 0 == PL_strncasecmp(p, little, ll) )
|
||||
return (char *)p;
|
||||
if( 0 == PL_strncasecmp(p, little, ll) ) {
|
||||
return (char *)p;
|
||||
}
|
||||
|
||||
return (char *)0;
|
||||
}
|
||||
@@ -132,18 +150,25 @@ PL_strncasestr(const char *big, const char *little, PRUint32 max)
|
||||
{
|
||||
PRUint32 ll;
|
||||
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
ll = strlen(little);
|
||||
if( ll > max ) return (char *)0;
|
||||
if( ll > max ) {
|
||||
return (char *)0;
|
||||
}
|
||||
max -= ll;
|
||||
max++;
|
||||
|
||||
for( ; max && *big; big++, max-- )
|
||||
/* obvious improvement available here */
|
||||
if( 0 == PL_strncasecmp(big, little, ll) )
|
||||
return (char *)big;
|
||||
if( 0 == PL_strncasecmp(big, little, ll) ) {
|
||||
return (char *)big;
|
||||
}
|
||||
|
||||
return (char *)0;
|
||||
}
|
||||
@@ -154,8 +179,12 @@ PL_strncaserstr(const char *big, const char *little, PRUint32 max)
|
||||
const char *p;
|
||||
PRUint32 ll;
|
||||
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
ll = strlen(little);
|
||||
|
||||
@@ -163,12 +192,15 @@ PL_strncaserstr(const char *big, const char *little, PRUint32 max)
|
||||
;
|
||||
|
||||
p -= ll;
|
||||
if( p < big ) return (char *)0;
|
||||
if( p < big ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
for( ; p >= big; p-- )
|
||||
/* obvious improvement available here */
|
||||
if( 0 == PL_strncasecmp(p, little, ll) )
|
||||
return (char *)p;
|
||||
if( 0 == PL_strncasecmp(p, little, ll) ) {
|
||||
return (char *)p;
|
||||
}
|
||||
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
PR_IMPLEMENT(char *)
|
||||
PL_strcat(char *dest, const char *src)
|
||||
{
|
||||
if( ((char *)0 == dest) || ((const char *)0 == src) )
|
||||
if( ((char *)0 == dest) || ((const char *)0 == src) ) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
return strcat(dest, src);
|
||||
}
|
||||
@@ -20,8 +21,9 @@ PL_strncat(char *dest, const char *src, PRUint32 max)
|
||||
{
|
||||
char *rv;
|
||||
|
||||
if( ((char *)0 == dest) || ((const char *)0 == src) || (0 == max) )
|
||||
if( ((char *)0 == dest) || ((const char *)0 == src) || (0 == max) ) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
for( rv = dest; *dest; dest++ )
|
||||
;
|
||||
@@ -36,13 +38,16 @@ PL_strcatn(char *dest, PRUint32 max, const char *src)
|
||||
char *rv;
|
||||
PRUint32 dl;
|
||||
|
||||
if( ((char *)0 == dest) || ((const char *)0 == src) )
|
||||
if( ((char *)0 == dest) || ((const char *)0 == src) ) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
for( rv = dest, dl = 0; *dest; dest++, dl++ )
|
||||
;
|
||||
|
||||
if( max <= dl ) return rv;
|
||||
if( max <= dl ) {
|
||||
return rv;
|
||||
}
|
||||
(void)PL_strncpyz(dest, src, max-dl);
|
||||
|
||||
return rv;
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
PR_IMPLEMENT(char *)
|
||||
PL_strchr(const char *s, char c)
|
||||
{
|
||||
if( (const char *)0 == s ) return (char *)0;
|
||||
if( (const char *)0 == s ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
return strchr(s, c);
|
||||
}
|
||||
@@ -17,7 +19,9 @@ PL_strchr(const char *s, char c)
|
||||
PR_IMPLEMENT(char *)
|
||||
PL_strrchr(const char *s, char c)
|
||||
{
|
||||
if( (const char *)0 == s ) return (char *)0;
|
||||
if( (const char *)0 == s ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
return strrchr(s, c);
|
||||
}
|
||||
@@ -25,13 +29,18 @@ PL_strrchr(const char *s, char c)
|
||||
PR_IMPLEMENT(char *)
|
||||
PL_strnchr(const char *s, char c, PRUint32 n)
|
||||
{
|
||||
if( (const char *)0 == s ) return (char *)0;
|
||||
if( (const char *)0 == s ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
for( ; n && *s; s++, n-- )
|
||||
if( *s == c )
|
||||
if( *s == c ) {
|
||||
return (char *)s;
|
||||
}
|
||||
|
||||
if( ((char)0 == c) && (n > 0) && ((char)0 == *s) ) return (char *)s;
|
||||
if( ((char)0 == c) && (n > 0) && ((char)0 == *s) ) {
|
||||
return (char *)s;
|
||||
}
|
||||
|
||||
return (char *)0;
|
||||
}
|
||||
@@ -41,16 +50,21 @@ PL_strnrchr(const char *s, char c, PRUint32 n)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
if( (const char *)0 == s ) return (char *)0;
|
||||
if( (const char *)0 == s ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
for( p = s; n && *p; p++, n-- )
|
||||
;
|
||||
|
||||
if( ((char)0 == c) && (n > 0) && ((char)0 == *p) ) return (char *)p;
|
||||
if( ((char)0 == c) && (n > 0) && ((char)0 == *p) ) {
|
||||
return (char *)p;
|
||||
}
|
||||
|
||||
for( p--; p >= s; p-- )
|
||||
if( *p == c )
|
||||
if( *p == c ) {
|
||||
return (char *)p;
|
||||
}
|
||||
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
PR_IMPLEMENT(PRIntn)
|
||||
PL_strcmp(const char *a, const char *b)
|
||||
{
|
||||
if( (const char *)0 == a )
|
||||
if( (const char *)0 == a ) {
|
||||
return ((const char *)0 == b) ? 0 : -1;
|
||||
if( (const char *)0 == b )
|
||||
}
|
||||
if( (const char *)0 == b ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (PRIntn)strcmp(a, b);
|
||||
}
|
||||
@@ -20,10 +22,12 @@ PL_strcmp(const char *a, const char *b)
|
||||
PR_IMPLEMENT(PRIntn)
|
||||
PL_strncmp(const char *a, const char *b, PRUint32 max)
|
||||
{
|
||||
if( (const char *)0 == a )
|
||||
if( (const char *)0 == a ) {
|
||||
return ((const char *)0 == b) ? 0 : -1;
|
||||
if( (const char *)0 == b )
|
||||
}
|
||||
if( (const char *)0 == b ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (PRIntn)strncmp(a, b, (size_t)max);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
PR_IMPLEMENT(char *)
|
||||
PL_strcpy(char *dest, const char *src)
|
||||
{
|
||||
if( ((char *)0 == dest) || ((const char *)0 == src) ) return (char *)0;
|
||||
if( ((char *)0 == dest) || ((const char *)0 == src) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
return strcpy(dest, src);
|
||||
}
|
||||
@@ -18,17 +20,22 @@ PR_IMPLEMENT(char *)
|
||||
PL_strncpy(char *dest, const char *src, PRUint32 max)
|
||||
{
|
||||
char *rv;
|
||||
|
||||
if( (char *)0 == dest ) return (char *)0;
|
||||
if( (const char *)0 == src ) return (char *)0;
|
||||
|
||||
if( (char *)0 == dest ) {
|
||||
return (char *)0;
|
||||
}
|
||||
if( (const char *)0 == src ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
for( rv = dest; max && ((*dest = *src) != 0); dest++, src++, max-- )
|
||||
;
|
||||
|
||||
#ifdef JLRU
|
||||
/* XXX I (wtc) think the -- and ++ operators should be postfix. */
|
||||
while( --max )
|
||||
while( --max ) {
|
||||
*++dest = '\0';
|
||||
}
|
||||
#endif /* JLRU */
|
||||
|
||||
return rv;
|
||||
@@ -38,10 +45,16 @@ PR_IMPLEMENT(char *)
|
||||
PL_strncpyz(char *dest, const char *src, PRUint32 max)
|
||||
{
|
||||
char *rv;
|
||||
|
||||
if( (char *)0 == dest ) return (char *)0;
|
||||
if( (const char *)0 == src ) return (char *)0;
|
||||
if( 0 == max ) return (char *)0;
|
||||
|
||||
if( (char *)0 == dest ) {
|
||||
return (char *)0;
|
||||
}
|
||||
if( (const char *)0 == src ) {
|
||||
return (char *)0;
|
||||
}
|
||||
if( 0 == max ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
for( rv = dest, max--; max && ((*dest = *src) != 0); dest++, src++, max-- )
|
||||
;
|
||||
|
||||
@@ -13,13 +13,16 @@ PL_strdup(const char *s)
|
||||
char *rv;
|
||||
size_t n;
|
||||
|
||||
if( (const char *)0 == s )
|
||||
if( (const char *)0 == s ) {
|
||||
s = "";
|
||||
}
|
||||
|
||||
n = strlen(s) + 1;
|
||||
|
||||
rv = (char *)malloc(n);
|
||||
if( (char *)0 == rv ) return rv;
|
||||
if( (char *)0 == rv ) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
(void)memcpy(rv, s, n);
|
||||
|
||||
@@ -38,13 +41,16 @@ PL_strndup(const char *s, PRUint32 max)
|
||||
char *rv;
|
||||
size_t l;
|
||||
|
||||
if( (const char *)0 == s )
|
||||
if( (const char *)0 == s ) {
|
||||
s = "";
|
||||
}
|
||||
|
||||
l = PL_strnlen(s, max);
|
||||
|
||||
rv = (char *)malloc(l+1);
|
||||
if( (char *)0 == rv ) return rv;
|
||||
if( (char *)0 == rv ) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
(void)memcpy(rv, s, l);
|
||||
rv[l] = '\0';
|
||||
|
||||
@@ -13,17 +13,20 @@ PL_strlen(const char *str)
|
||||
{
|
||||
size_t l;
|
||||
|
||||
if( (const char *)0 == str ) return 0;
|
||||
if( (const char *)0 == str ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
l = strlen(str);
|
||||
|
||||
/* error checking in case we have a 64-bit platform -- make sure
|
||||
* we don't have ultra long strings that overflow an int32
|
||||
*/
|
||||
*/
|
||||
if( sizeof(PRUint32) < sizeof(size_t) )
|
||||
{
|
||||
if( l > PR_INT32_MAX )
|
||||
if( l > PR_INT32_MAX ) {
|
||||
PR_Assert("l <= PR_INT32_MAX", __FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
return (PRUint32)l;
|
||||
@@ -34,7 +37,9 @@ PL_strnlen(const char *str, PRUint32 max)
|
||||
{
|
||||
register const char *s;
|
||||
|
||||
if( (const char *)0 == str ) return 0;
|
||||
if( (const char *)0 == str ) {
|
||||
return 0;
|
||||
}
|
||||
for( s = str; max && *s; s++, max-- )
|
||||
;
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
PR_IMPLEMENT(char *)
|
||||
PL_strpbrk(const char *s, const char *list)
|
||||
{
|
||||
if( ((const char *)0 == s) || ((const char *)0 == list) ) return (char *)0;
|
||||
if( ((const char *)0 == s) || ((const char *)0 == list) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
return strpbrk(s, list);
|
||||
}
|
||||
@@ -20,15 +22,18 @@ PL_strprbrk(const char *s, const char *list)
|
||||
const char *p;
|
||||
const char *r;
|
||||
|
||||
if( ((const char *)0 == s) || ((const char *)0 == list) ) return (char *)0;
|
||||
if( ((const char *)0 == s) || ((const char *)0 == list) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
for( r = s; *r; r++ )
|
||||
;
|
||||
|
||||
for( r--; r >= s; r-- )
|
||||
for( p = list; *p; p++ )
|
||||
if( *r == *p )
|
||||
if( *r == *p ) {
|
||||
return (char *)r;
|
||||
}
|
||||
|
||||
return (char *)0;
|
||||
}
|
||||
@@ -38,12 +43,15 @@ PL_strnpbrk(const char *s, const char *list, PRUint32 max)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
if( ((const char *)0 == s) || ((const char *)0 == list) ) return (char *)0;
|
||||
if( ((const char *)0 == s) || ((const char *)0 == list) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
for( ; max && *s; s++, max-- )
|
||||
for( p = list; *p; p++ )
|
||||
if( *s == *p )
|
||||
if( *s == *p ) {
|
||||
return (char *)s;
|
||||
}
|
||||
|
||||
return (char *)0;
|
||||
}
|
||||
@@ -54,15 +62,18 @@ PL_strnprbrk(const char *s, const char *list, PRUint32 max)
|
||||
const char *p;
|
||||
const char *r;
|
||||
|
||||
if( ((const char *)0 == s) || ((const char *)0 == list) ) return (char *)0;
|
||||
if( ((const char *)0 == s) || ((const char *)0 == list) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
for( r = s; max && *r; r++, max-- )
|
||||
;
|
||||
|
||||
for( r--; r >= s; r-- )
|
||||
for( p = list; *p; p++ )
|
||||
if( *r == *p )
|
||||
if( *r == *p ) {
|
||||
return (char *)r;
|
||||
}
|
||||
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,12 @@
|
||||
PR_IMPLEMENT(char *)
|
||||
PL_strstr(const char *big, const char *little)
|
||||
{
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
return strstr(big, little);
|
||||
}
|
||||
@@ -22,18 +26,25 @@ PL_strrstr(const char *big, const char *little)
|
||||
size_t ll;
|
||||
size_t bl;
|
||||
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
ll = strlen(little);
|
||||
bl = strlen(big);
|
||||
if( bl < ll ) return (char *)0;
|
||||
if( bl < ll ) {
|
||||
return (char *)0;
|
||||
}
|
||||
p = &big[ bl - ll ];
|
||||
|
||||
for( ; p >= big; p-- )
|
||||
if( *little == *p )
|
||||
if( 0 == strncmp(p, little, ll) )
|
||||
if( 0 == strncmp(p, little, ll) ) {
|
||||
return (char *)p;
|
||||
}
|
||||
|
||||
return (char *)0;
|
||||
}
|
||||
@@ -43,18 +54,25 @@ PL_strnstr(const char *big, const char *little, PRUint32 max)
|
||||
{
|
||||
size_t ll;
|
||||
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
ll = strlen(little);
|
||||
if( ll > (size_t)max ) return (char *)0;
|
||||
if( ll > (size_t)max ) {
|
||||
return (char *)0;
|
||||
}
|
||||
max -= (PRUint32)ll;
|
||||
max++;
|
||||
|
||||
for( ; max && *big; big++, max-- )
|
||||
if( *little == *big )
|
||||
if( 0 == strncmp(big, little, ll) )
|
||||
if( 0 == strncmp(big, little, ll) ) {
|
||||
return (char *)big;
|
||||
}
|
||||
|
||||
return (char *)0;
|
||||
}
|
||||
@@ -65,8 +83,12 @@ PL_strnrstr(const char *big, const char *little, PRUint32 max)
|
||||
const char *p;
|
||||
size_t ll;
|
||||
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) return (char *)0;
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) return (char *)0;
|
||||
if( ((const char *)0 == big) || ((const char *)0 == little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
if( ((char)0 == *big) || ((char)0 == *little) ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
ll = strlen(little);
|
||||
|
||||
@@ -74,12 +96,15 @@ PL_strnrstr(const char *big, const char *little, PRUint32 max)
|
||||
;
|
||||
|
||||
p -= ll;
|
||||
if( p < big ) return (char *)0;
|
||||
if( p < big ) {
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
for( ; p >= big; p-- )
|
||||
if( *little == *p )
|
||||
if( 0 == strncmp(p, little, ll) )
|
||||
if( 0 == strncmp(p, little, ll) ) {
|
||||
return (char *)p;
|
||||
}
|
||||
|
||||
return (char *)0;
|
||||
}
|
||||
|
||||
@@ -14,21 +14,24 @@ PL_strtok_r(char *s1, const char *s2, char **lasts)
|
||||
|
||||
if( s1 == NULL )
|
||||
{
|
||||
if( *lasts == NULL )
|
||||
if( *lasts == NULL ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s1 = *lasts;
|
||||
}
|
||||
|
||||
|
||||
for( ; (c = *s1) != 0; s1++ )
|
||||
{
|
||||
for( sepp = s2 ; (sc = *sepp) != 0 ; sepp++ )
|
||||
{
|
||||
if( c == sc )
|
||||
if( c == sc ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( sc == 0 ) {
|
||||
break;
|
||||
}
|
||||
if( sc == 0 )
|
||||
break;
|
||||
}
|
||||
|
||||
if( c == 0 )
|
||||
@@ -36,7 +39,7 @@ PL_strtok_r(char *s1, const char *s2, char **lasts)
|
||||
*lasts = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
tok = s1++;
|
||||
|
||||
for( ; (c = *s1) != 0; s1++ )
|
||||
|
||||
@@ -14,12 +14,6 @@ include $(MOD_DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
ifeq ($(OS_ARCH), IRIX)
|
||||
ifneq ($(OS_RELEASE),5.3)
|
||||
CCC_ONLY_FLAGS += -exceptions
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), BeOS)
|
||||
CFLAGS += -frtti -fexceptions
|
||||
endif
|
||||
|
||||
@@ -68,9 +68,9 @@ PRVersionDescription VERSION_DESC_NAME =
|
||||
* must not end in a '$' to prevent rcs keyword substitution.
|
||||
*/
|
||||
static char rcsid[] = "$Header: NSPR " PR_VERSION _DEBUG_STRING
|
||||
" " _BUILD_STRING " $";
|
||||
" " _BUILD_STRING " $";
|
||||
static char sccsid[] = "@(#)NSPR " PR_VERSION _DEBUG_STRING
|
||||
" " _BUILD_STRING;
|
||||
" " _BUILD_STRING;
|
||||
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
@@ -86,7 +86,7 @@ PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint()
|
||||
* from being optimized away as unused variables.
|
||||
*/
|
||||
const char *dummy;
|
||||
|
||||
|
||||
dummy = rcsid;
|
||||
dummy = sccsid;
|
||||
#endif
|
||||
|
||||
@@ -115,7 +115,7 @@ PRfilebuf *PRfilebuf::open(
|
||||
_opened = true;
|
||||
|
||||
if (ate &&
|
||||
seekoff(0, ios_base::end, flags) == pos_type(traits_type::eof())) {
|
||||
seekoff(0, ios_base::end, flags) == pos_type(traits_type::eof())) {
|
||||
close();
|
||||
return NULL;
|
||||
}
|
||||
@@ -138,13 +138,14 @@ PRfilebuf *PRfilebuf::attach(PRFileDesc *fd)
|
||||
|
||||
PRfilebuf *PRfilebuf::close()
|
||||
{
|
||||
if (_fd == NULL)
|
||||
if (_fd == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int status = sync();
|
||||
|
||||
if (PR_Close(_fd) == PR_FAILURE ||
|
||||
traits_type::eq_int_type(status, traits_type::eof())) {
|
||||
traits_type::eq_int_type(status, traits_type::eof())) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,24 +34,26 @@ public:
|
||||
PRfilebuf(PRFileDesc *fd, char_type *ptr, std::streamsize len);
|
||||
virtual ~PRfilebuf();
|
||||
|
||||
bool is_open() const { return _fd != NULL; }
|
||||
bool is_open() const {
|
||||
return _fd != NULL;
|
||||
}
|
||||
|
||||
PRfilebuf *open(
|
||||
const char *name,
|
||||
std::ios_base::openmode flags,
|
||||
PRIntn mode);
|
||||
const char *name,
|
||||
std::ios_base::openmode flags,
|
||||
PRIntn mode);
|
||||
PRfilebuf *attach(PRFileDesc *fd);
|
||||
PRfilebuf *close();
|
||||
|
||||
protected:
|
||||
virtual std::streambuf *setbuf(char_type *ptr, std::streamsize len);
|
||||
virtual pos_type seekoff(
|
||||
off_type offset,
|
||||
std::ios_base::seekdir dir,
|
||||
std::ios_base::openmode flags);
|
||||
off_type offset,
|
||||
std::ios_base::seekdir dir,
|
||||
std::ios_base::openmode flags);
|
||||
virtual pos_type seekpos(
|
||||
pos_type pos,
|
||||
std::ios_base::openmode flags) {
|
||||
pos_type pos,
|
||||
std::ios_base::openmode flags) {
|
||||
return seekoff(pos, std::ios_base::beg, flags);
|
||||
}
|
||||
virtual int sync();
|
||||
@@ -83,8 +85,12 @@ public:
|
||||
PRifstream(const char *name, openmode flags = in, PRIntn mode = 0);
|
||||
virtual ~PRifstream();
|
||||
|
||||
PRfilebuf *rdbuf() const { return &_filebuf; }
|
||||
bool is_open() const { return _filebuf.is_open(); }
|
||||
PRfilebuf *rdbuf() const {
|
||||
return &_filebuf;
|
||||
}
|
||||
bool is_open() const {
|
||||
return _filebuf.is_open();
|
||||
}
|
||||
|
||||
void open(const char *name, openmode flags = in, PRIntn mode = 0);
|
||||
void attach(PRFileDesc *fd);
|
||||
@@ -104,8 +110,12 @@ public:
|
||||
PRofstream(const char *name, openmode flags = out, PRIntn mode = 0);
|
||||
virtual ~PRofstream();
|
||||
|
||||
PRfilebuf *rdbuf() const { return &_filebuf; }
|
||||
bool is_open() const { return _filebuf.is_open(); }
|
||||
PRfilebuf *rdbuf() const {
|
||||
return &_filebuf;
|
||||
}
|
||||
bool is_open() const {
|
||||
return _filebuf.is_open();
|
||||
}
|
||||
|
||||
void open(const char *name, openmode flags = out, PRIntn mode = 0);
|
||||
void attach(PRFileDesc *fd);
|
||||
@@ -125,8 +135,12 @@ public:
|
||||
PRfstream(const char *name, openmode flags = in | out, PRIntn mode = 0);
|
||||
virtual ~PRfstream();
|
||||
|
||||
PRfilebuf *rdbuf() const { return &_filebuf; }
|
||||
bool is_open() const { return _filebuf.is_open(); }
|
||||
PRfilebuf *rdbuf() const {
|
||||
return &_filebuf;
|
||||
}
|
||||
bool is_open() const {
|
||||
return _filebuf.is_open();
|
||||
}
|
||||
|
||||
void open(const char *name, openmode flags = in | out, PRIntn mode = 0);
|
||||
void attach(PRFileDesc *fd);
|
||||
|
||||
@@ -57,14 +57,6 @@ ifneq ($(OS_ARCH), WINNT)
|
||||
PWD = $(shell pwd)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), IRIX)
|
||||
LDOPTS += -rpath $(PWD)/$(dist_libdir)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), OSF1)
|
||||
LDOPTS += -rpath $(PWD)/$(dist_libdir)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), HP-UX)
|
||||
LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
|
||||
endif
|
||||
|
||||
@@ -28,7 +28,7 @@ typedef struct threadarg {
|
||||
|
||||
void threadwork(threadarg *arg);
|
||||
|
||||
void
|
||||
void
|
||||
threadmain(void *mytag)
|
||||
{
|
||||
threadarg arg;
|
||||
@@ -41,131 +41,132 @@ threadmain(void *mytag)
|
||||
void
|
||||
threadwork(threadarg *arg)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int i;
|
||||
|
||||
char fname1[256];
|
||||
char fname2[256];
|
||||
char fname1[256];
|
||||
char fname2[256];
|
||||
|
||||
strcpy(fname1, arg->mytag);
|
||||
strcpy(fname2, arg->mytag);
|
||||
strcat(fname2, "2");
|
||||
PR_Delete(fname1);
|
||||
PR_Delete(fname2);
|
||||
strcpy(fname1, arg->mytag);
|
||||
strcpy(fname2, arg->mytag);
|
||||
strcat(fname2, "2");
|
||||
PR_Delete(fname1);
|
||||
PR_Delete(fname2);
|
||||
|
||||
PRfilebuf *fb[MaxCnt];
|
||||
PRifstream *ifs[MaxCnt];
|
||||
PRofstream *ofs[MaxCnt];
|
||||
int mode = 0;
|
||||
PRfilebuf *fb[MaxCnt];
|
||||
PRifstream *ifs[MaxCnt];
|
||||
PRofstream *ofs[MaxCnt];
|
||||
int mode = 0;
|
||||
#ifdef XP_UNIX
|
||||
mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH;
|
||||
mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Allocate a bunch
|
||||
cout << "Testing unused filebufs ----------------" << endl;
|
||||
for (i=0; i < MaxCnt; i++){
|
||||
fb[i] = new PRfilebuf;
|
||||
}
|
||||
// Delete them
|
||||
for (i=0; i < MaxCnt; i++){
|
||||
delete fb[i];
|
||||
}
|
||||
cout << "Unused filebufs complete ---------------" << endl;
|
||||
//
|
||||
// Allocate a bunch
|
||||
cout << "Testing unused filebufs ----------------" << endl;
|
||||
for (i=0; i < MaxCnt; i++) {
|
||||
fb[i] = new PRfilebuf;
|
||||
}
|
||||
// Delete them
|
||||
for (i=0; i < MaxCnt; i++) {
|
||||
delete fb[i];
|
||||
}
|
||||
cout << "Unused filebufs complete ---------------" << endl;
|
||||
|
||||
//
|
||||
// Allocate a bunch
|
||||
cout << "Testing unused ifstream -----------------" << endl;
|
||||
for (i=0; i < MaxCnt; i++){
|
||||
ifs[i] = new PRifstream;
|
||||
}
|
||||
//
|
||||
// Delete them
|
||||
for (i=0; i < MaxCnt; i++){
|
||||
delete ifs[i];
|
||||
}
|
||||
cout << "Unused ifstream complete ----------------" << endl;
|
||||
//
|
||||
// Allocate a bunch
|
||||
cout << "Testing unused ofstream -----------------" << endl;
|
||||
for (i=0; i < MaxCnt; i++){
|
||||
ofs[i] = new PRofstream;
|
||||
}
|
||||
for (i=0; i < MaxCnt; i++){
|
||||
*(ofs[i]) << "A"; // Write a bit
|
||||
delete ofs[i]; // Delete it.
|
||||
}
|
||||
cout << "Unused ofstream complete ----------------" << endl;
|
||||
//
|
||||
// Allocate a bunch
|
||||
cout << "Testing unused ifstream -----------------" << endl;
|
||||
for (i=0; i < MaxCnt; i++) {
|
||||
ifs[i] = new PRifstream;
|
||||
}
|
||||
//
|
||||
// Delete them
|
||||
for (i=0; i < MaxCnt; i++) {
|
||||
delete ifs[i];
|
||||
}
|
||||
cout << "Unused ifstream complete ----------------" << endl;
|
||||
//
|
||||
// Allocate a bunch
|
||||
cout << "Testing unused ofstream -----------------" << endl;
|
||||
for (i=0; i < MaxCnt; i++) {
|
||||
ofs[i] = new PRofstream;
|
||||
}
|
||||
for (i=0; i < MaxCnt; i++) {
|
||||
*(ofs[i]) << "A"; // Write a bit
|
||||
delete ofs[i]; // Delete it.
|
||||
}
|
||||
cout << "Unused ofstream complete ----------------" << endl;
|
||||
|
||||
cout << "Testing use of ofstream 1 (extra filebuf allocated) ---------" << endl;
|
||||
PRofstream *aos = new PRofstream(fname1, ios::out|ios::ate, mode);
|
||||
for (i=0; i < MaxCnt; i++){
|
||||
for (int j=0; j < 8192; j++)
|
||||
*aos << "AaBbCcDdEeFfGg" << endl;
|
||||
fb[i] = new PRfilebuf; // Allocate as we go to hack at the heap
|
||||
}
|
||||
//
|
||||
// Delete the extra foo we allocated
|
||||
for (i=0; i < MaxCnt; i++){
|
||||
delete fb[i];
|
||||
}
|
||||
aos->flush(); // Explicit flush
|
||||
delete aos;
|
||||
cout << "Testing use of ofstream 1 complete (extra filebuf deleted) --" << endl;
|
||||
cout << "Testing use of ofstream 2 (extra filebuf allocated) ---------" << endl;
|
||||
PRofstream *aos2 = new PRofstream(fname2, ios::out, mode);
|
||||
cout << "Testing use of ofstream 1 (extra filebuf allocated) ---------" << endl;
|
||||
PRofstream *aos = new PRofstream(fname1, ios::out|ios::ate, mode);
|
||||
for (i=0; i < MaxCnt; i++) {
|
||||
for (int j=0; j < 8192; j++) {
|
||||
*aos << "AaBbCcDdEeFfGg" << endl;
|
||||
}
|
||||
fb[i] = new PRfilebuf; // Allocate as we go to hack at the heap
|
||||
}
|
||||
//
|
||||
// Delete the extra foo we allocated
|
||||
for (i=0; i < MaxCnt; i++) {
|
||||
delete fb[i];
|
||||
}
|
||||
aos->flush(); // Explicit flush
|
||||
delete aos;
|
||||
cout << "Testing use of ofstream 1 complete (extra filebuf deleted) --" << endl;
|
||||
cout << "Testing use of ofstream 2 (extra filebuf allocated) ---------" << endl;
|
||||
PRofstream *aos2 = new PRofstream(fname2, ios::out, mode);
|
||||
|
||||
for (i=0; i < MaxCnt; i++){
|
||||
*aos2 << "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz";
|
||||
}
|
||||
// Force flushing in the dtor
|
||||
delete aos2;
|
||||
cout << "Testing use of ofstream 2 complete (extra filebuf deleted) --" << endl;
|
||||
char line[1024];
|
||||
cout << "Testing use of ifstream 1 (stack allocation) -------------" << endl;
|
||||
PRifstream ais(fname1);
|
||||
for (i=0; i < MaxCnt; i++){
|
||||
ais >> line;
|
||||
}
|
||||
cout << "Testing use of ifstream 1 complete -----------------------" << endl;
|
||||
cout << "Testing use of ifstream 2 ----------------------" << endl;
|
||||
PRifstream *ais2 = new PRifstream(fname2);
|
||||
char achar;
|
||||
for (i=0; i < MaxCnt*10; i++){
|
||||
*ais2 >> achar;
|
||||
}
|
||||
delete ais2;
|
||||
cout << "Testing use of ifstream 2 complete -------------" << endl;
|
||||
for (i=0; i < MaxCnt; i++) {
|
||||
*aos2 << "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz";
|
||||
}
|
||||
// Force flushing in the dtor
|
||||
delete aos2;
|
||||
cout << "Testing use of ofstream 2 complete (extra filebuf deleted) --" << endl;
|
||||
char line[1024];
|
||||
cout << "Testing use of ifstream 1 (stack allocation) -------------" << endl;
|
||||
PRifstream ais(fname1);
|
||||
for (i=0; i < MaxCnt; i++) {
|
||||
ais >> line;
|
||||
}
|
||||
cout << "Testing use of ifstream 1 complete -----------------------" << endl;
|
||||
cout << "Testing use of ifstream 2 ----------------------" << endl;
|
||||
PRifstream *ais2 = new PRifstream(fname2);
|
||||
char achar;
|
||||
for (i=0; i < MaxCnt*10; i++) {
|
||||
*ais2 >> achar;
|
||||
}
|
||||
delete ais2;
|
||||
cout << "Testing use of ifstream 2 complete -------------" << endl;
|
||||
}
|
||||
|
||||
#define STACKSIZE 1024*1024
|
||||
int
|
||||
main()
|
||||
{
|
||||
PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 256);
|
||||
threadmain(const_cast<char *>("TestFile"));
|
||||
PRThread *thr1 = PR_CreateThread(PR_SYSTEM_THREAD,
|
||||
threadmain,
|
||||
const_cast<char *>("TestFile1"),
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_JOINABLE_THREAD,
|
||||
STACKSIZE);
|
||||
PRThread *thr2 = PR_CreateThread(PR_SYSTEM_THREAD,
|
||||
threadmain,
|
||||
const_cast<char *>("TestFile2"),
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_JOINABLE_THREAD,
|
||||
STACKSIZE);
|
||||
PRThread *thr3 = PR_CreateThread(PR_SYSTEM_THREAD,
|
||||
threadmain,
|
||||
const_cast<char *>("TestFile3"),
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_JOINABLE_THREAD,
|
||||
STACKSIZE);
|
||||
PR_JoinThread(thr1);
|
||||
PR_JoinThread(thr2);
|
||||
PR_JoinThread(thr3);
|
||||
return 0;
|
||||
PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 256);
|
||||
threadmain(const_cast<char *>("TestFile"));
|
||||
PRThread *thr1 = PR_CreateThread(PR_SYSTEM_THREAD,
|
||||
threadmain,
|
||||
const_cast<char *>("TestFile1"),
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_JOINABLE_THREAD,
|
||||
STACKSIZE);
|
||||
PRThread *thr2 = PR_CreateThread(PR_SYSTEM_THREAD,
|
||||
threadmain,
|
||||
const_cast<char *>("TestFile2"),
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_JOINABLE_THREAD,
|
||||
STACKSIZE);
|
||||
PRThread *thr3 = PR_CreateThread(PR_SYSTEM_THREAD,
|
||||
threadmain,
|
||||
const_cast<char *>("TestFile3"),
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_JOINABLE_THREAD,
|
||||
STACKSIZE);
|
||||
PR_JoinThread(thr1);
|
||||
PR_JoinThread(thr2);
|
||||
PR_JoinThread(thr3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -64,10 +64,6 @@ ifneq ($(OS_ARCH), WINNT)
|
||||
PWD = $(shell pwd)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), IRIX)
|
||||
LDOPTS += -rpath $(PWD)/$(dist_libdir)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), Linux)
|
||||
ifeq ($(OS_RELEASE), 1.2)
|
||||
EXTRA_LIBS = -ldl
|
||||
@@ -85,10 +81,6 @@ ifeq (,$(filter-out OpenBSD,$(OS_ARCH)))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), OSF1)
|
||||
LDOPTS += -rpath $(PWD)/$(dist_libdir) -lpthread
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), HP-UX)
|
||||
LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
|
||||
endif
|
||||
|
||||
+110
-108
@@ -33,7 +33,7 @@ PRIntn stressThreads = 4;
|
||||
|
||||
void DumpAll( void )
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -43,34 +43,34 @@ static void ArenaAllocate( void )
|
||||
{
|
||||
PLArenaPool ap;
|
||||
void *ptr;
|
||||
PRInt32 i;
|
||||
PRInt32 i;
|
||||
|
||||
PL_InitArenaPool( &ap, "AllocArena", 2048, sizeof(double));
|
||||
PR_LOG( tLM, PR_LOG_DEBUG, ("AA, InitPool -- Pool: %p. first: %p, current: %p, size: %d",
|
||||
&ap, ap.first, ap.current, ap.arenasize ));
|
||||
PR_LOG( tLM, PR_LOG_DEBUG, ("AA, InitPool -- Pool: %p. first: %p, current: %p, size: %d",
|
||||
&ap, ap.first, ap.current, ap.arenasize ));
|
||||
|
||||
for( i = 0; i < 150; i++ )
|
||||
{
|
||||
PL_ARENA_ALLOCATE( ptr, &ap, 512 );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,("AA, after alloc -- Pool: %p. first: %p, current: %p, size: %d",
|
||||
&ap, ap.first, ap.current, ap.arenasize ));
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,(
|
||||
"AA -- Pool: %p. alloc: %p ", &ap, ptr ));
|
||||
}
|
||||
for( i = 0; i < 150; i++ )
|
||||
{
|
||||
PL_ARENA_ALLOCATE( ptr, &ap, 512 );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,("AA, after alloc -- Pool: %p. first: %p, current: %p, size: %d",
|
||||
&ap, ap.first, ap.current, ap.arenasize ));
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,(
|
||||
"AA -- Pool: %p. alloc: %p ", &ap, ptr ));
|
||||
}
|
||||
|
||||
PL_FreeArenaPool( &ap );
|
||||
|
||||
for( i = 0; i < 221; i++ )
|
||||
{
|
||||
PL_ARENA_ALLOCATE( ptr, &ap, 512 );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,("AA, after alloc -- Pool: %p. first: %p, current: %p, size: %d",
|
||||
&ap, ap.first, ap.current, ap.arenasize ));
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,(
|
||||
"AA -- Pool: %p. alloc: %p ", &ap, ptr ));
|
||||
}
|
||||
for( i = 0; i < 221; i++ )
|
||||
{
|
||||
PL_ARENA_ALLOCATE( ptr, &ap, 512 );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,("AA, after alloc -- Pool: %p. first: %p, current: %p, size: %d",
|
||||
&ap, ap.first, ap.current, ap.arenasize ));
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,(
|
||||
"AA -- Pool: %p. alloc: %p ", &ap, ptr ));
|
||||
}
|
||||
|
||||
PL_FreeArenaPool( &ap );
|
||||
|
||||
|
||||
return;
|
||||
} /* end ArenaGrow() */
|
||||
/*
|
||||
@@ -80,18 +80,18 @@ static void ArenaGrow( void )
|
||||
{
|
||||
PLArenaPool ap;
|
||||
void *ptr;
|
||||
PRInt32 i;
|
||||
PRInt32 i;
|
||||
|
||||
PL_InitArenaPool( &ap, "TheArena", 4096, sizeof(double));
|
||||
PL_ARENA_ALLOCATE( ptr, &ap, 512 );
|
||||
|
||||
PR_LOG( tLM, PR_LOG_DEBUG, ("Before growth -- Pool: %p. alloc: %p ", &ap, ptr ));
|
||||
PR_LOG( tLM, PR_LOG_DEBUG, ("Before growth -- Pool: %p. alloc: %p ", &ap, ptr ));
|
||||
|
||||
for( i = 0; i < 10; i++ )
|
||||
{
|
||||
PL_ARENA_GROW( ptr, &ap, 512, 7000 );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG, ("After growth -- Pool: %p. alloc: %p ", &ap, ptr ));
|
||||
}
|
||||
for( i = 0; i < 10; i++ )
|
||||
{
|
||||
PL_ARENA_GROW( ptr, &ap, 512, 7000 );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG, ("After growth -- Pool: %p. alloc: %p ", &ap, ptr ));
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
@@ -111,69 +111,69 @@ static void MarkAndRelease( void )
|
||||
PL_InitArenaPool( &ap, "TheArena", 4096, sizeof(double));
|
||||
mark0 = PL_ARENA_MARK( &ap );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,
|
||||
("mark0. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p, m0: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr, mark0 ));
|
||||
("mark0. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p, m0: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr, mark0 ));
|
||||
|
||||
for( i = 0; i < 201; i++ )
|
||||
{
|
||||
PL_ARENA_ALLOCATE( ptr, &ap, 512 );
|
||||
for( i = 0; i < 201; i++ )
|
||||
{
|
||||
PL_ARENA_ALLOCATE( ptr, &ap, 512 );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,
|
||||
("mr. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr ));
|
||||
}
|
||||
("mr. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr ));
|
||||
}
|
||||
|
||||
mark1 = PL_ARENA_MARK( &ap );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,
|
||||
("mark1. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p, m1: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr, mark1 ));
|
||||
("mark1. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p, m1: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr, mark1 ));
|
||||
|
||||
|
||||
for( i = 0; i < 225; i++ )
|
||||
{
|
||||
PL_ARENA_ALLOCATE( ptr, &ap, 512 );
|
||||
for( i = 0; i < 225; i++ )
|
||||
{
|
||||
PL_ARENA_ALLOCATE( ptr, &ap, 512 );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,
|
||||
("mr. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr ));
|
||||
}
|
||||
("mr. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr ));
|
||||
}
|
||||
|
||||
PL_ARENA_RELEASE( &ap, mark1 );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,
|
||||
("Release-1: %p -- Pool: %p. first: %p, current: %p, size: %d",
|
||||
mark1, &ap, ap.first, ap.current, ap.arenasize ));
|
||||
("Release-1: %p -- Pool: %p. first: %p, current: %p, size: %d",
|
||||
mark1, &ap, ap.first, ap.current, ap.arenasize ));
|
||||
|
||||
for( i = 0; i < 20; i++ )
|
||||
{
|
||||
PL_ARENA_ALLOCATE( ptr, &ap, 512 );
|
||||
for( i = 0; i < 20; i++ )
|
||||
{
|
||||
PL_ARENA_ALLOCATE( ptr, &ap, 512 );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,
|
||||
("mr. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr ));
|
||||
}
|
||||
("mr. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr ));
|
||||
}
|
||||
|
||||
PL_ARENA_RELEASE( &ap, mark1 );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,
|
||||
("Release-1. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr ));
|
||||
("Release-1. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr ));
|
||||
|
||||
PL_ARENA_RELEASE( &ap, mark0 );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,
|
||||
("Release-0. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr ));
|
||||
("Release-0. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr ));
|
||||
|
||||
PL_FreeArenaPool( &ap );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,
|
||||
("Free. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr ));
|
||||
|
||||
("Free. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr ));
|
||||
|
||||
PL_FinishArenaPool( &ap );
|
||||
PR_LOG( tLM, PR_LOG_DEBUG,
|
||||
("Finish. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr ));
|
||||
("Finish. ap: %p, ap.f: %p, ap.c: %p, ap.siz: %d, alloc: %p",
|
||||
&ap, ap.first.next, ap.current, ap.arenasize, ptr ));
|
||||
|
||||
return;
|
||||
} /* end MarkAndRelease() */
|
||||
|
||||
/*
|
||||
** RandSize() returns a random number in the range
|
||||
** RandSize() returns a random number in the range
|
||||
** min..max, rounded to the next doubleword
|
||||
**
|
||||
*/
|
||||
@@ -230,15 +230,15 @@ static void PR_CALLBACK StressThread( void *arg )
|
||||
PR_EnterMonitor(tMon);
|
||||
threadCount--;
|
||||
PR_Notify(tMon);
|
||||
PR_ExitMonitor(tMon);
|
||||
PR_ExitMonitor(tMon);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Stress()
|
||||
** Flog the hell out of arenas multi-threaded.
|
||||
** Do NOT pass an individual arena to another thread.
|
||||
**
|
||||
**
|
||||
*/
|
||||
static void Stress( void )
|
||||
{
|
||||
@@ -251,24 +251,24 @@ static void Stress( void )
|
||||
{
|
||||
PR_EnterMonitor(tMon);
|
||||
tt = PR_CreateThread(PR_USER_THREAD,
|
||||
StressThread,
|
||||
NULL,
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_UNJOINABLE_THREAD,
|
||||
0);
|
||||
StressThread,
|
||||
NULL,
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_UNJOINABLE_THREAD,
|
||||
0);
|
||||
threadCount++;
|
||||
PR_ExitMonitor(tMon);
|
||||
}
|
||||
|
||||
/* Wait for all threads to exit */
|
||||
PR_EnterMonitor(tMon);
|
||||
while ( threadCount != 0 )
|
||||
while ( threadCount != 0 )
|
||||
{
|
||||
PR_Wait(tMon, PR_INTERVAL_NO_TIMEOUT);
|
||||
}
|
||||
PR_ExitMonitor(tMon);
|
||||
PR_DestroyMonitor(tMon);
|
||||
PR_DestroyMonitor(tMon);
|
||||
|
||||
return;
|
||||
} /* end Stress() */
|
||||
@@ -286,7 +286,7 @@ static PRIntn EvaluateResults(void)
|
||||
{
|
||||
PR_LOG( tLM, PR_LOG_DEBUG, ("FAIL\n"));
|
||||
rc =1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PR_LOG( tLM, PR_LOG_DEBUG, ("PASS\n"));
|
||||
@@ -308,55 +308,57 @@ void Help( void )
|
||||
printf("-d enable debug mode\n");
|
||||
printf("\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
PRIntn main(PRIntn argc, char *argv[])
|
||||
{
|
||||
PLOptStatus os;
|
||||
PLOptState *opt = PL_CreateOptState(argc, argv, "dhp:P:a:A:i:s:t:");
|
||||
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
|
||||
PLOptState *opt = PL_CreateOptState(argc, argv, "dhp:P:a:A:i:s:t:");
|
||||
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
|
||||
{
|
||||
if (PL_OPT_BAD == os) continue;
|
||||
if (PL_OPT_BAD == os) {
|
||||
continue;
|
||||
}
|
||||
switch (opt->option)
|
||||
{
|
||||
case 'a': /* arena Min size */
|
||||
arenaMin = atol( opt->value );
|
||||
break;
|
||||
case 'A': /* arena Max size */
|
||||
arenaMax = atol( opt->value );
|
||||
break;
|
||||
case 'p': /* pool Min size */
|
||||
poolMin = atol( opt->value );
|
||||
break;
|
||||
case 'P': /* pool Max size */
|
||||
poolMax = atol( opt->value );
|
||||
break;
|
||||
case 'i': /* Iterations in stress tests */
|
||||
stressIterations = atol( opt->value );
|
||||
break;
|
||||
case 's': /* storage to get per iteration */
|
||||
maxAlloc = atol( opt->value );
|
||||
break;
|
||||
case 't': /* Number of stress threads to create */
|
||||
stressThreads = atol( opt->value );
|
||||
break;
|
||||
case 'd': /* debug mode */
|
||||
debug_mode = 1;
|
||||
break;
|
||||
case 'h': /* help */
|
||||
default:
|
||||
Help();
|
||||
case 'a': /* arena Min size */
|
||||
arenaMin = atol( opt->value );
|
||||
break;
|
||||
case 'A': /* arena Max size */
|
||||
arenaMax = atol( opt->value );
|
||||
break;
|
||||
case 'p': /* pool Min size */
|
||||
poolMin = atol( opt->value );
|
||||
break;
|
||||
case 'P': /* pool Max size */
|
||||
poolMax = atol( opt->value );
|
||||
break;
|
||||
case 'i': /* Iterations in stress tests */
|
||||
stressIterations = atol( opt->value );
|
||||
break;
|
||||
case 's': /* storage to get per iteration */
|
||||
maxAlloc = atol( opt->value );
|
||||
break;
|
||||
case 't': /* Number of stress threads to create */
|
||||
stressThreads = atol( opt->value );
|
||||
break;
|
||||
case 'd': /* debug mode */
|
||||
debug_mode = 1;
|
||||
break;
|
||||
case 'h': /* help */
|
||||
default:
|
||||
Help();
|
||||
} /* end switch() */
|
||||
} /* end while() */
|
||||
PL_DestroyOptState(opt);
|
||||
PL_DestroyOptState(opt);
|
||||
|
||||
srand( (unsigned)time( NULL ) ); /* seed random number generator */
|
||||
tLM = PR_NewLogModule("testcase");
|
||||
|
||||
|
||||
#if 0
|
||||
ArenaAllocate();
|
||||
ArenaGrow();
|
||||
ArenaAllocate();
|
||||
ArenaGrow();
|
||||
#endif
|
||||
|
||||
MarkAndRelease();
|
||||
|
||||
+2007
-1632
File diff suppressed because it is too large
Load Diff
+12
-11
@@ -12,16 +12,16 @@
|
||||
|
||||
|
||||
static const PLLongOpt optArray[] = {
|
||||
{ "longa", 'a' , PR_TRUE },
|
||||
{ "longb", 'b' , PR_TRUE },
|
||||
{ "longc", 'c' , PR_FALSE },
|
||||
{ "longa", 'a', PR_TRUE },
|
||||
{ "longb", 'b', PR_TRUE },
|
||||
{ "longc", 'c', PR_FALSE },
|
||||
{ "longd", 'd' | 0x100, PR_TRUE },
|
||||
{ "longe", 'e' | 0x100, PR_FALSE },
|
||||
{ NULL, }
|
||||
};
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
PLOptState *opt;
|
||||
PLOptStatus ostat;
|
||||
@@ -29,13 +29,14 @@ main(int argc, char **argv)
|
||||
opt = PL_CreateLongOptState(argc, argv, "a:b:c", optArray);
|
||||
|
||||
while (PL_OPT_OK == (ostat = PL_GetNextOpt(opt))) {
|
||||
if (opt->option == 0 && opt->longOptIndex < 0)
|
||||
printf("Positional parameter: \"%s\"\n", opt->value);
|
||||
else
|
||||
printf("%s option: %x (\'%c\', index %d), argument: \"%s\"\n",
|
||||
(ostat == PL_OPT_BAD) ? "BAD" : "GOOD",
|
||||
opt->longOption, opt->option ? opt->option : ' ',
|
||||
opt->longOptIndex, opt->value);
|
||||
if (opt->option == 0 && opt->longOptIndex < 0) {
|
||||
printf("Positional parameter: \"%s\"\n", opt->value);
|
||||
}
|
||||
else
|
||||
printf("%s option: %x (\'%c\', index %d), argument: \"%s\"\n",
|
||||
(ostat == PL_OPT_BAD) ? "BAD" : "GOOD",
|
||||
opt->longOption, opt->option ? opt->option : ' ',
|
||||
opt->longOptIndex, opt->value);
|
||||
|
||||
}
|
||||
printf("last result was %s\n", (ostat == PL_OPT_BAD) ? "BAD" : "EOL");
|
||||
|
||||
+1388
-1344
File diff suppressed because it is too large
Load Diff
@@ -1,27 +0,0 @@
|
||||
diff --git a/nsprpub/pr/src/md/windows/w95sock.c b/nsprpub/pr/src/md/windows/w95sock.c
|
||||
index 0429c65..c3c4634 100644
|
||||
--- a/nsprpub/pr/src/md/windows/w95sock.c
|
||||
+++ b/nsprpub/pr/src/md/windows/w95sock.c
|
||||
@@ -4,16 +4,22 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* Win95 Sockets module
|
||||
*
|
||||
*/
|
||||
|
||||
#include "primpl.h"
|
||||
|
||||
+#if defined(_WIN64)
|
||||
+#if defined(_MSC_VER)
|
||||
+#pragma comment(lib, "ws2_32.lib")
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
#define READ_FD 1
|
||||
#define WRITE_FD 2
|
||||
#define CONNECT_FD 3
|
||||
|
||||
static PRInt32 socket_io_wait(
|
||||
PROsfd osfd,
|
||||
PRInt32 fd_type,
|
||||
PRIntervalTime timeout);
|
||||
+59
-59
@@ -5,62 +5,56 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(sgi)
|
||||
#ifndef IRIX
|
||||
error - IRIX is not defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__sun)
|
||||
#ifndef SOLARIS
|
||||
error - SOLARIS is not defined
|
||||
error - SOLARIS is not defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__hpux)
|
||||
#ifndef HPUX
|
||||
error - HPUX is not defined
|
||||
error - HPUX is not defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__alpha)
|
||||
#if !(defined(_WIN32)) && !(defined(OSF1)) && !(defined(__linux)) && !(defined(__FreeBSD__))
|
||||
error - None of OSF1, _WIN32, __linux, or __FreeBSD__ is defined
|
||||
#if defined(__alpha)
|
||||
#if !(defined(_WIN32)) && !(defined(__linux)) && !(defined(__FreeBSD__))
|
||||
error - None of _WIN32, __linux, or __FreeBSD__ is defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_IBMR2)
|
||||
#ifndef AIX
|
||||
error - AIX is not defined
|
||||
error - AIX is not defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(linux)
|
||||
#ifndef LINUX
|
||||
error - LINUX is not defined
|
||||
error - LINUX is not defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(bsdi)
|
||||
#ifndef BSDI
|
||||
error - BSDI is not defined
|
||||
error - BSDI is not defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(M_UNIX)
|
||||
#ifndef SCO
|
||||
error - SCO is not defined
|
||||
error - SCO is not defined
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(M_UNIX) && defined(_USLC_)
|
||||
#ifndef UNIXWARE
|
||||
error - UNIXWARE is not defined
|
||||
error - UNIXWARE is not defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#ifndef DARWIN
|
||||
error - DARWIN is not defined
|
||||
error - DARWIN is not defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -70,15 +64,15 @@
|
||||
|
||||
#ifdef XP_PC
|
||||
#ifdef WIN32
|
||||
#define INT64 _PRInt64
|
||||
#define INT64 _PRInt64
|
||||
#else
|
||||
#define INT64 long
|
||||
#define INT64 long
|
||||
#endif
|
||||
#else
|
||||
#if defined(HPUX) || defined(SCO) || defined(UNIXWARE)
|
||||
#define INT64 long
|
||||
#define INT64 long
|
||||
#else
|
||||
#define INT64 long long
|
||||
#define INT64 long long
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -101,7 +95,7 @@ struct align_PRInt64 {
|
||||
struct align_fakelonglong {
|
||||
char c;
|
||||
struct {
|
||||
long hi, lo;
|
||||
long hi, lo;
|
||||
} a;
|
||||
};
|
||||
struct align_float {
|
||||
@@ -129,18 +123,24 @@ static int Log2(int n)
|
||||
{
|
||||
int log2 = 0;
|
||||
|
||||
if (n & (n-1))
|
||||
log2++;
|
||||
if (n >> 16)
|
||||
log2 += 16, n >>= 16;
|
||||
if (n >> 8)
|
||||
log2 += 8, n >>= 8;
|
||||
if (n >> 4)
|
||||
log2 += 4, n >>= 4;
|
||||
if (n >> 2)
|
||||
log2 += 2, n >>= 2;
|
||||
if (n >> 1)
|
||||
log2++;
|
||||
if (n & (n-1)) {
|
||||
log2++;
|
||||
}
|
||||
if (n >> 16) {
|
||||
log2 += 16, n >>= 16;
|
||||
}
|
||||
if (n >> 8) {
|
||||
log2 += 8, n >>= 8;
|
||||
}
|
||||
if (n >> 4) {
|
||||
log2 += 4, n >>= 4;
|
||||
}
|
||||
if (n >> 2) {
|
||||
log2 += 2, n >>= 2;
|
||||
}
|
||||
if (n >> 1) {
|
||||
log2++;
|
||||
}
|
||||
return log2;
|
||||
}
|
||||
|
||||
@@ -148,34 +148,34 @@ static int Log2(int n)
|
||||
static void do64(void)
|
||||
{
|
||||
union {
|
||||
int i;
|
||||
char c[4];
|
||||
int i;
|
||||
char c[4];
|
||||
} u;
|
||||
|
||||
u.i = 0x01020304;
|
||||
if (u.c[0] == 0x01) {
|
||||
fprintf(stream, "#undef IS_LITTLE_ENDIAN\n");
|
||||
fprintf(stream, "#define IS_BIG_ENDIAN 1\n\n");
|
||||
fprintf(stream, "#undef IS_LITTLE_ENDIAN\n");
|
||||
fprintf(stream, "#define IS_BIG_ENDIAN 1\n\n");
|
||||
} else {
|
||||
fprintf(stream, "#define IS_LITTLE_ENDIAN 1\n");
|
||||
fprintf(stream, "#undef IS_BIG_ENDIAN\n\n");
|
||||
fprintf(stream, "#define IS_LITTLE_ENDIAN 1\n");
|
||||
fprintf(stream, "#undef IS_BIG_ENDIAN\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void do32(void)
|
||||
{
|
||||
union {
|
||||
long i;
|
||||
char c[4];
|
||||
long i;
|
||||
char c[4];
|
||||
} u;
|
||||
|
||||
u.i = 0x01020304;
|
||||
if (u.c[0] == 0x01) {
|
||||
fprintf(stream, "#undef IS_LITTLE_ENDIAN\n");
|
||||
fprintf(stream, "#define IS_BIG_ENDIAN 1\n\n");
|
||||
fprintf(stream, "#undef IS_LITTLE_ENDIAN\n");
|
||||
fprintf(stream, "#define IS_BIG_ENDIAN 1\n\n");
|
||||
} else {
|
||||
fprintf(stream, "#define IS_LITTLE_ENDIAN 1\n");
|
||||
fprintf(stream, "#undef IS_BIG_ENDIAN\n\n");
|
||||
fprintf(stream, "#define IS_LITTLE_ENDIAN 1\n");
|
||||
fprintf(stream, "#undef IS_BIG_ENDIAN\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,8 +201,8 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
stream = stdout;
|
||||
}
|
||||
stream = stdout;
|
||||
}
|
||||
|
||||
fprintf(stream, "#ifndef nspr_cpucfg___\n");
|
||||
fprintf(stream, "#define nspr_cpucfg___\n\n");
|
||||
@@ -210,9 +210,9 @@ int main(int argc, char **argv)
|
||||
fprintf(stream, "/* AUTOMATICALLY GENERATED - DO NOT EDIT */\n\n");
|
||||
|
||||
if (sizeof(long) == 8) {
|
||||
do64();
|
||||
do64();
|
||||
} else {
|
||||
do32();
|
||||
do32();
|
||||
}
|
||||
fprintf(stream, "#define PR_BYTES_PER_BYTE %d\n", sizeof(char));
|
||||
fprintf(stream, "#define PR_BYTES_PER_SHORT %d\n", sizeof(short));
|
||||
@@ -228,31 +228,31 @@ int main(int argc, char **argv)
|
||||
fprintf(stream, "#define PR_BITS_PER_INT64 %d\n", bpb * 8);
|
||||
fprintf(stream, "#define PR_BITS_PER_LONG %d\n", bpb * sizeof(long));
|
||||
fprintf(stream, "#define PR_BITS_PER_FLOAT %d\n", bpb * sizeof(float));
|
||||
fprintf(stream, "#define PR_BITS_PER_DOUBLE %d\n\n",
|
||||
fprintf(stream, "#define PR_BITS_PER_DOUBLE %d\n\n",
|
||||
bpb * sizeof(double));
|
||||
|
||||
fprintf(stream, "#define PR_BITS_PER_BYTE_LOG2 %d\n", Log2(bpb));
|
||||
fprintf(stream, "#define PR_BITS_PER_SHORT_LOG2 %d\n",
|
||||
fprintf(stream, "#define PR_BITS_PER_SHORT_LOG2 %d\n",
|
||||
Log2(bpb * sizeof(short)));
|
||||
fprintf(stream, "#define PR_BITS_PER_INT_LOG2 %d\n",
|
||||
fprintf(stream, "#define PR_BITS_PER_INT_LOG2 %d\n",
|
||||
Log2(bpb * sizeof(int)));
|
||||
fprintf(stream, "#define PR_BITS_PER_INT64_LOG2 %d\n", 6);
|
||||
fprintf(stream, "#define PR_BITS_PER_LONG_LOG2 %d\n",
|
||||
fprintf(stream, "#define PR_BITS_PER_LONG_LOG2 %d\n",
|
||||
Log2(bpb * sizeof(long)));
|
||||
fprintf(stream, "#define PR_BITS_PER_FLOAT_LOG2 %d\n",
|
||||
fprintf(stream, "#define PR_BITS_PER_FLOAT_LOG2 %d\n",
|
||||
Log2(bpb * sizeof(float)));
|
||||
fprintf(stream, "#define PR_BITS_PER_DOUBLE_LOG2 %d\n\n",
|
||||
fprintf(stream, "#define PR_BITS_PER_DOUBLE_LOG2 %d\n\n",
|
||||
Log2(bpb * sizeof(double)));
|
||||
|
||||
fprintf(stream, "#define PR_ALIGN_OF_SHORT %d\n", ALIGN_OF(short));
|
||||
fprintf(stream, "#define PR_ALIGN_OF_INT %d\n", ALIGN_OF(int));
|
||||
fprintf(stream, "#define PR_ALIGN_OF_LONG %d\n", ALIGN_OF(long));
|
||||
if (sizeof(INT64) < 8) {
|
||||
/* this machine doesn't actually support PRInt64's */
|
||||
fprintf(stream, "#define PR_ALIGN_OF_INT64 %d\n",
|
||||
/* this machine doesn't actually support PRInt64's */
|
||||
fprintf(stream, "#define PR_ALIGN_OF_INT64 %d\n",
|
||||
ALIGN_OF(fakelonglong));
|
||||
} else {
|
||||
fprintf(stream, "#define PR_ALIGN_OF_INT64 %d\n", ALIGN_OF(PRInt64));
|
||||
fprintf(stream, "#define PR_ALIGN_OF_INT64 %d\n", ALIGN_OF(PRInt64));
|
||||
}
|
||||
fprintf(stream, "#define PR_ALIGN_OF_FLOAT %d\n", ALIGN_OF(float));
|
||||
fprintf(stream, "#define PR_ALIGN_OF_DOUBLE %d\n", ALIGN_OF(double));
|
||||
|
||||
@@ -22,22 +22,22 @@
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "aix"
|
||||
#define _PR_SI_SYSNAME "AIX"
|
||||
#define _PR_SI_ARCHITECTURE "rs6000"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
#define _PR_SI_SYSNAME "AIX"
|
||||
#define _PR_SI_ARCHITECTURE "rs6000"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE (2*65536L)
|
||||
#define _MD_MINIMUM_STACK_SIZE (2*65536L)
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE (2*65536L)
|
||||
#define _MD_MINIMUM_STACK_SIZE (2*65536L)
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#define NEED_TIME_R
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#undef HAVE_WEAK_IO_SYMBOLS
|
||||
#undef HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#undef HAVE_WEAK_IO_SYMBOLS
|
||||
#undef HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
@@ -85,13 +85,13 @@ extern PRIntervalTime _MD_AixIntervalPerSec(void);
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _MD_GET_SP(_t) (_t)->md.jb[3]
|
||||
#define _MD_SET_THR_SP(_t, _sp) ((_t)->md.jb[3] = (int) (_sp - 2 * 64))
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define _MD_GET_SP(_t) (_t)->md.jb[3]
|
||||
#define _MD_SET_THR_SP(_t, _sp) ((_t)->md.jb[3] = (int) (_sp - 2 * 64))
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.jb)
|
||||
#define SAVE_CONTEXT(_th) _setjmp(CONTEXT(_th))
|
||||
#define GOTO_CONTEXT(_th) _longjmp(CONTEXT(_th), 1)
|
||||
#define CONTEXT(_th) ((_th)->md.jb)
|
||||
#define SAVE_CONTEXT(_th) _setjmp(CONTEXT(_th))
|
||||
#define GOTO_CONTEXT(_th) _longjmp(CONTEXT(_th), 1)
|
||||
|
||||
#ifdef PTHREADS_USER
|
||||
#include "_nspr_pthread.h"
|
||||
@@ -100,26 +100,26 @@ extern PRIntervalTime _MD_AixIntervalPerSec(void);
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
*status = PR_TRUE; \
|
||||
if (setjmp(CONTEXT(_thread))) { \
|
||||
(*_main)(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (int) (_sp - 2 * 64); \
|
||||
if (setjmp(CONTEXT(_thread))) { \
|
||||
(*_main)(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (int) (_sp - 2 * 64); \
|
||||
PR_END_MACRO
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
longjmp(CONTEXT(_thread), 1); \
|
||||
@@ -166,28 +166,28 @@ struct _MDCPU_Unix {
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
@@ -205,19 +205,19 @@ struct _MDCPU {
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
#endif /* PTHREADS_USER */
|
||||
|
||||
#ifdef AIX_RENAME_SELECT
|
||||
#define _MD_SELECT select
|
||||
#define _MD_POLL poll
|
||||
#define _MD_SELECT select
|
||||
#define _MD_POLL poll
|
||||
#endif
|
||||
|
||||
extern void _MD_aix_map_sendfile_error(int err);
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#ifndef nspr_cpucfg___
|
||||
#define nspr_cpucfg___
|
||||
|
||||
#ifndef XP_BEOS
|
||||
#define XP_BEOS
|
||||
#undef XP_UNIX
|
||||
#endif
|
||||
|
||||
#ifndef BEOS
|
||||
#define BEOS
|
||||
#endif
|
||||
|
||||
#define PR_AF_INET6 5 /* same as AF_INET6 */
|
||||
|
||||
#ifdef __powerpc__
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
#define IS_BIG_ENDIAN 1
|
||||
#else
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#define PR_BYTES_PER_BYTE 1
|
||||
#define PR_BYTES_PER_SHORT 2
|
||||
#define PR_BYTES_PER_INT 4
|
||||
#define PR_BYTES_PER_INT64 8
|
||||
#define PR_BYTES_PER_LONG 4
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 4
|
||||
#define PR_BYTES_PER_DWORD 8
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#define PR_BITS_PER_BYTE 8
|
||||
#define PR_BITS_PER_SHORT 16
|
||||
#define PR_BITS_PER_INT 32
|
||||
#define PR_BITS_PER_INT64 64
|
||||
#define PR_BITS_PER_LONG 32
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 32
|
||||
|
||||
#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 6
|
||||
#define PR_BITS_PER_LONG_LOG2 5
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 5
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_INT64 4
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_DOUBLE 4
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
|
||||
#ifndef HAVE_LONG_LONG
|
||||
#define HAVE_LONG_LONG
|
||||
#endif
|
||||
/*
|
||||
* XXX These two macros need to be investigated for different architectures.
|
||||
*/
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
#define HAVE_ALIGNED_LONGLONGS
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
|
||||
#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
|
||||
#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
|
||||
#define BYTES_PER_INT PR_BYTES_PER_INT
|
||||
#define BYTES_PER_INT64 PR_BYTES_PER_INT64
|
||||
#define BYTES_PER_LONG PR_BYTES_PER_LONG
|
||||
#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
|
||||
#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
|
||||
#define BYTES_PER_WORD PR_BYTES_PER_WORD
|
||||
#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
|
||||
|
||||
#define BITS_PER_BYTE PR_BITS_PER_BYTE
|
||||
#define BITS_PER_SHORT PR_BITS_PER_SHORT
|
||||
#define BITS_PER_INT PR_BITS_PER_INT
|
||||
#define BITS_PER_INT64 PR_BITS_PER_INT64
|
||||
#define BITS_PER_LONG PR_BITS_PER_LONG
|
||||
#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
|
||||
#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
|
||||
#define BITS_PER_WORD PR_BITS_PER_WORD
|
||||
|
||||
#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
|
||||
#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
|
||||
#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
|
||||
#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
|
||||
#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
|
||||
#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
|
||||
#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
|
||||
#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
|
||||
|
||||
#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
|
||||
#define ALIGN_OF_INT PR_ALIGN_OF_INT
|
||||
#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
|
||||
#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
|
||||
#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
|
||||
#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
|
||||
#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
|
||||
#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
|
||||
|
||||
#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
|
||||
#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
|
||||
#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
|
||||
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#endif /* nspr_cpucfg___ */
|
||||
@@ -1,583 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#ifndef nspr_beos_defs_h___
|
||||
#define nspr_beos_defs_h___
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "prio.h"
|
||||
#include "prthread.h"
|
||||
#include "prproces.h"
|
||||
#include "prmem.h"
|
||||
#include "obsolete/prsem.h"
|
||||
#include <errno.h>
|
||||
|
||||
#include <support/SupportDefs.h>
|
||||
#include <kernel/OS.h>
|
||||
#include <dirent.h>
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#ifdef BONE_VERSION
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define HAVE_NETINET_TCP_H
|
||||
#endif
|
||||
|
||||
#define PR_LINKER_ARCH "beos"
|
||||
#define _PR_SI_SYSNAME "BEOS"
|
||||
#ifdef __powerpc__
|
||||
#define _PR_SI_ARCHITECTURE "ppc"
|
||||
#else
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define _PR_NO_CLOCK_TIMER
|
||||
|
||||
/*
|
||||
* The Atomic operations
|
||||
*/
|
||||
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC _MD_AtomicInit
|
||||
#define _MD_ATOMIC_INCREMENT _MD_AtomicIncrement
|
||||
#define _MD_ATOMIC_ADD _MD_AtomicAdd
|
||||
#define _MD_ATOMIC_DECREMENT _MD_AtomicDecrement
|
||||
#define _MD_ATOMIC_SET _MD_AtomicSet
|
||||
|
||||
#define HAVE_CVAR_BUILT_ON_SEM
|
||||
#define _PR_GLOBAL_THREADS_ONLY
|
||||
#define _PR_BTHREADS
|
||||
#define _PR_NEED_FAKE_POLL
|
||||
#define _PR_HAVE_PEEK_BUFFER
|
||||
#define _PR_PEEK_BUFFER_MAX (16 * 1024)
|
||||
#define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) 1
|
||||
#define _PR_CONNECT_DOES_NOT_BIND
|
||||
#define _PR_HAVE_O_APPEND
|
||||
|
||||
/* Define threading functions and objects as native BeOS */
|
||||
struct _MDThread {
|
||||
thread_id tid; /* BeOS thread handle */
|
||||
sem_id joinSem; /* sems used to synchronzie joining */
|
||||
PRBool is_joining; /* TRUE if someone is currently waiting to
|
||||
join this thread */
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* Lock and Semaphore related definitions
|
||||
*/
|
||||
|
||||
struct _MDLock {
|
||||
sem_id semaphoreID;
|
||||
int32 benaphoreCount;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
sem_id sem1;
|
||||
sem_id sem2;
|
||||
int16 count;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
sem_id sid;
|
||||
};
|
||||
|
||||
/*
|
||||
** CPU-related definitions
|
||||
*/
|
||||
struct _MDCPU {
|
||||
int8 unused;
|
||||
};
|
||||
|
||||
/*
|
||||
** Process-related definitions
|
||||
*/
|
||||
struct _MDProcess {
|
||||
pid_t pid;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
** File- and directory-related definitions
|
||||
*/
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
#define BE_SOCK_SHUTDOWN_READ 0x01
|
||||
#define BE_SOCK_SHUTDOWN_WRITE 0x02
|
||||
#endif
|
||||
|
||||
struct _MDFileDesc {
|
||||
PRInt32 osfd;
|
||||
PRInt32 sock_state;
|
||||
PRBool accepted_socket;
|
||||
PRNetAddr peer_addr;
|
||||
#ifndef BONE_VERSION
|
||||
PRBool connectValueValid;
|
||||
int connectReturnValue;
|
||||
int connectReturnError;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _MDDir {
|
||||
DIR *d;
|
||||
};
|
||||
|
||||
#define PR_DIRECTORY_SEPARATOR '/'
|
||||
#define PR_DIRECTORY_SEPARATOR_STR "/"
|
||||
#define PR_PATH_SEPARATOR ':'
|
||||
#define PR_PATH_SEPARATOR_STR ":"
|
||||
|
||||
#define GETTIMEOFDAY(tp) gettimeofday((tp), NULL)
|
||||
|
||||
/* --- Memory-mapped files stuff --- not implemented on BeOS */
|
||||
|
||||
struct _MDFileMap {
|
||||
PRInt8 unused;
|
||||
};
|
||||
|
||||
/*
|
||||
* Network related definitions.
|
||||
*/
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
#define IPPROTO_IP 0
|
||||
#define AF_UNIX 2
|
||||
#define TCP_NODELAY SO_NONBLOCK
|
||||
#define SO_LINGER -1
|
||||
#define SO_ERROR 4
|
||||
#endif
|
||||
|
||||
#define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
/* these aren't actually used. if they are, we're screwed */
|
||||
struct protoent {
|
||||
char *p_name; /* official protocol name */
|
||||
char **p_aliases; /* alias list */
|
||||
int p_proto; /* protocol # */
|
||||
};
|
||||
|
||||
struct protoent* getprotobyname(const char* name);
|
||||
struct protoent* getprotobynumber(int number);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* malloc() related definitions.
|
||||
*/
|
||||
|
||||
#undef _PR_OVERRIDE_MALLOC
|
||||
|
||||
/* Miscellaneous */
|
||||
|
||||
#define _MD_ERRNO() (errno)
|
||||
|
||||
#define _MD_CLEANUP_BEFORE_EXIT _MD_cleanup_before_exit
|
||||
#define _MD_EXIT _MD_exit
|
||||
|
||||
#define _MD_GET_ENV getenv
|
||||
#define _MD_PUT_ENV putenv
|
||||
|
||||
#define _MD_EARLY_INIT _MD_early_init
|
||||
#define _MD_FINAL_INIT _MD_final_init
|
||||
#define _MD_EARLY_CLEANUP()
|
||||
|
||||
/* CPU Stuff */
|
||||
|
||||
#define _MD_INIT_CPUS _MD_init_cpus
|
||||
#define _MD_WAKEUP_CPUS _MD_wakeup_cpus
|
||||
#define _MD_START_INTERRUPTS _MD_start_interrupts
|
||||
#define _MD_STOP_INTERRUPTS _MD_stop_interrupts
|
||||
#define _MD_DISABLE_CLOCK_INTERRUPTS _MD_disable_clock_interrupts
|
||||
#define _MD_BLOCK_CLOCK_INTERRUPTS _MD_block_clock_interrupts
|
||||
#define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_unblock_clock_interrupts
|
||||
#define _MD_CLOCK_INTERRUPT _MD_clock_interrupt
|
||||
#define _MD_INIT_STACK _MD_init_stack
|
||||
#define _MD_CLEAR_STACK _MD_clear_stack
|
||||
// #define _MD_GET_INTSOFF _MD_get_intsoff
|
||||
// #define _MD_SET_INTSOFF _MD_set_intsoff
|
||||
#define _MD_CURRENT_CPU _MD_current_cpu
|
||||
#define _MD_SET_CURRENT_CPU _MD_set_current_cpu
|
||||
#define _MD_INIT_RUNNING_CPU _MD_init_running_cpu
|
||||
#define _MD_PAUSE_CPU _MD_pause_cpu
|
||||
|
||||
/* Thread stuff */
|
||||
|
||||
#define _MD_CURRENT_THREAD() PR_GetCurrentThread()
|
||||
// #define _MD_GET_ATTACHED_THREAD _MD_get_attached_thread
|
||||
#define _MD_LAST_THREAD _MD_last_thread
|
||||
#define _MD_SET_CURRENT_THREAD _MD_set_current_THREAD
|
||||
#define _MD_SET_LAST_THREAD _MD_set_last_thread
|
||||
#define _MD_INIT_THREAD _MD_init_thread
|
||||
#define _MD_EXIT_THREAD _MD_exit_thread
|
||||
#define _MD_INIT_ATTACHED_THREAD _MD_init_attached_thread
|
||||
|
||||
#define _MD_SUSPEND_THREAD _MD_suspend_thread
|
||||
#define _MD_RESUME_THREAD _MD_resume_thread
|
||||
#define _MD_SUSPEND_CPU _MD_suspend_cpu
|
||||
#define _MD_RESUME_CPU _MD_resume_cpu
|
||||
#define _MD_BEGIN_SUSPEND_ALL _MD_begin_suspend_all
|
||||
#define _MD_END_SUSPEND_ALL _MD_end_suspend_all
|
||||
#define _MD_BEGIN_RESUME_ALL _MD_begin_resume_all
|
||||
#define _MD_END_RESUME_ALL _MD_end_resume_all
|
||||
|
||||
#define _MD_GET_SP _MD_get_sp
|
||||
|
||||
#define _MD_CLEAN_THREAD _MD_clean_thread
|
||||
#define _MD_CREATE_PRIMORDIAL_USER_THREAD _MD_create_primordial_user_thread
|
||||
#define _MD_CREATE_USER_THREAD _MD_create_user_thread
|
||||
#define _MD_INIT_PRIMORDIAL_THREAD _MD_init_primordial_thread
|
||||
#define _MD_CREATE_THREAD _MD_create_thread
|
||||
#define _MD_YIELD _MD_yield
|
||||
#define _MD_SET_PRIORITY _MD_set_priority
|
||||
|
||||
#define _MD_SUSPENDALL _MD_suspendall
|
||||
#define _MD_RESUMEALL _MD_resumeall
|
||||
|
||||
#define _MD_SWITCH_CONTEXT _MD_switch_context
|
||||
#define _MD_RESTORE_CONTEXT _MD_restore_context
|
||||
|
||||
#define _MD_WAIT _MD_wait
|
||||
#define _MD_WAKEUP_WAITER _MD_wakeup_waiter
|
||||
|
||||
#define _MD_SETTHREADAFFINITYMASK _MD_setthreadaffinitymask
|
||||
#define _MD_GETTHREADAFFINITYMASK _MD_getthreadaffinitymask
|
||||
|
||||
/* Thread Synchronization */
|
||||
|
||||
#define _MD_INIT_LOCKS _MD_init_locks
|
||||
#define _MD_NEW_LOCK _MD_new_lock
|
||||
#define _MD_FREE_LOCK _MD_free_lock
|
||||
#define _MD_LOCK _MD_lock
|
||||
#define _MD_TEST_AND_LOCK _MD_test_and_lock
|
||||
#define _MD_UNLOCK _MD_unlock
|
||||
#define _MD_IOQ_LOCK _MD_ioq_lock
|
||||
#define _MD_IOQ_UNLOCK _MD_ioq_unlock
|
||||
#define _MD_NEW_SEM _MD_new_sem
|
||||
#define _MD_DESTROY_SEM _MD_destroy_sem
|
||||
#define _MD_TIMED_WAIT_SEM _MD_timed_wait_sem
|
||||
#define _MD_WAIT_SEM _MD_wait_sem
|
||||
#define _MD_POST_SEM _MD_post_sem
|
||||
// #define _MD_NEW_CV _MD_new_cv
|
||||
// #define _MD_FREE_CV _MD_free_cv
|
||||
// #define _MD_WAIT_CV _MD_wait_cv
|
||||
// #define _MD_NOTIFY_CV _MD_notify_cv
|
||||
// #define _MD_NOTIFYALL_CV _MD_notifyall_cv
|
||||
|
||||
/* File I/O */
|
||||
|
||||
/* don't need any I/O initializations */
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_INIT_FILEDESC(fd)
|
||||
|
||||
#define _MD_OPEN_DIR _MD_open_dir
|
||||
#define _MD_READ_DIR _MD_read_dir
|
||||
#define _MD_CLOSE_DIR _MD_close_dir
|
||||
#define _MD_MAKE_NONBLOCK _MD_make_nonblock
|
||||
#define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable
|
||||
#define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable
|
||||
#define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable
|
||||
#define _MD_OPEN _MD_open
|
||||
#define _MD_OPEN_FILE _MD_open
|
||||
#define _MD_CLOSE_FILE _MD_close_file
|
||||
#define _MD_READ _MD_read
|
||||
#define _MD_WRITE _MD_write
|
||||
#define _MD_WRITEV _MD_writev
|
||||
#define _MD_LSEEK _MD_lseek
|
||||
#define _MD_LSEEK64 _MD_lseek64
|
||||
#define _MD_FSYNC _MD_fsync
|
||||
#define _MD_DELETE _MD_delete
|
||||
#define _MD_GETFILEINFO _MD_getfileinfo
|
||||
#define _MD_GETFILEINFO64 _MD_getfileinfo64
|
||||
#define _MD_GETOPENFILEINFO _MD_getopenfileinfo
|
||||
#define _MD_GETOPENFILEINFO64 _MD_getopenfileinfo64
|
||||
#define _MD_RENAME _MD_rename
|
||||
#define _MD_ACCESS _MD_access
|
||||
#define _MD_STAT stat
|
||||
#define _MD_MKDIR _MD_mkdir
|
||||
#define _MD_MAKE_DIR _MD_mkdir
|
||||
#define _MD_RMDIR _MD_rmdir
|
||||
#define _MD_PR_POLL _MD_pr_poll
|
||||
|
||||
/* Network I/O */
|
||||
|
||||
#define _MD_CLOSE_SOCKET _MD_close_socket
|
||||
#define _MD_CONNECT _MD_connect
|
||||
#define _MD_ACCEPT _MD_accept
|
||||
#define _MD_BIND _MD_bind
|
||||
#define _MD_LISTEN _MD_listen
|
||||
#define _MD_SHUTDOWN _MD_shutdown
|
||||
#define _MD_RECV _MD_recv
|
||||
#define _MD_SEND _MD_send
|
||||
#define _MD_ACCEPT_READ _MD_accept_read
|
||||
#define _MD_GETSOCKNAME _MD_getsockname
|
||||
#define _MD_GETPEERNAME _MD_getpeername
|
||||
#define _MD_GETSOCKOPT _MD_getsockopt
|
||||
#define _MD_SETSOCKOPT _MD_setsockopt
|
||||
#define _MD_RECVFROM _MD_recvfrom
|
||||
#define _MD_SENDTO _MD_sendto
|
||||
#define _MD_SOCKETPAIR _MD_socketpair
|
||||
#define _MD_SOCKET _MD_socket
|
||||
#define _MD_SOCKETAVAILABLE _MD_socketavailable
|
||||
#define _MD_PIPEAVAILABLE _MD_socketavailable
|
||||
|
||||
#define _MD_GET_SOCKET_ERROR() (errno)
|
||||
#define _MD_GETHOSTNAME _MD_gethostname
|
||||
|
||||
#define _MD_SELECT select
|
||||
|
||||
/* Process management */
|
||||
|
||||
#define _MD_CREATE_PROCESS _MD_create_process
|
||||
#define _MD_DETACH_PROCESS _MD_detach_process
|
||||
#define _MD_WAIT_PROCESS _MD_wait_process
|
||||
#define _MD_KILL_PROCESS _MD_kill_process
|
||||
|
||||
/* Atomic data operations */
|
||||
|
||||
// #define _MD_INIT_ATOMIC _MD_init_atomic
|
||||
// #define _MD_ATOMIC_INCREMENT _MD_atomic_increment
|
||||
// #define _MD_ATOMIC_DECREMENT _MD_atomic_decrement
|
||||
// #define _MD_ATOMIC_SET _MD_atomic_set
|
||||
|
||||
/* memory management */
|
||||
|
||||
#define _MD_INIT_SEGS _MD_init_segs
|
||||
#define _MD_ALLOC_SEGMENT _MD_alloc_segment
|
||||
#define _MD_FREE_SEGMENT _MD_free_segment
|
||||
|
||||
/* Memory mapped file I/O */
|
||||
|
||||
#define _MD_CREATE_FILE_MAP _MD_create_file_map
|
||||
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_get_mem_map_alignment
|
||||
#define _MD_MEM_MAP _MD_mem_map
|
||||
#define _MD_MEM_UNMAP _MD_mem_unmap
|
||||
#define _MD_CLOSE_FILE_MAP _MD_close_file_map
|
||||
|
||||
/* Time related */
|
||||
|
||||
#define _MD_NOW _MD_now
|
||||
#define _MD_INTERVAL_INIT _MD_interval_init
|
||||
#define _MD_GET_INTERVAL _MD_get_interval
|
||||
#define _MD_INTERVAL_PER_SEC _MD_interval_per_sec
|
||||
|
||||
/* File locking */
|
||||
|
||||
#define _MD_LOCKFILE _MD_lockfile
|
||||
#define _MD_TLOCKFILE _MD_tlockfile
|
||||
#define _MD_UNLOCKFILE _MD_unlockfile
|
||||
|
||||
/**
|
||||
* Prototypes for machine dependent function implementations. (Too bad
|
||||
* NSPR's MD system blows so much that we have to reiterate every stinking
|
||||
* thing we implement here in our MD header file.)
|
||||
*/
|
||||
|
||||
/* Miscellaneous */
|
||||
|
||||
NSPR_API(void) _MD_cleanup_before_exit(void);
|
||||
NSPR_API(void) _MD_exit(PRIntn status);
|
||||
|
||||
NSPR_API(char*) _MD_get_env(const char *name);
|
||||
NSPR_API(PRIntn) _MD_put_env(const char *name);
|
||||
|
||||
NSPR_API(void) _MD_early_init(void);
|
||||
NSPR_API(void) _MD_final_init(void);
|
||||
|
||||
/* CPU Stuff */
|
||||
|
||||
NSPR_API(void) _MD_init_cpus();
|
||||
NSPR_API(void) _MD_wakeup_cpus();
|
||||
NSPR_API(void) _MD_start_interrupts(void);
|
||||
NSPR_API(void) _MD_stop_interrupts(void);
|
||||
NSPR_API(void) _MD_disable_clock_interrupts(void);
|
||||
NSPR_API(void) _MD_block_clock_interrupts(void);
|
||||
NSPR_API(void) _MD_unblock_clock_interrupts(void);
|
||||
NSPR_API(void) _MD_clock_interrupt(void);
|
||||
// NSPR_API(void) _MD_init_stack(PRThreadStack *ts, PRIntn redzone);
|
||||
// NSPR_API(void) _MD_clear_stack(PRThreadStack* ts);
|
||||
// NSPR_API(PRInt32) _MD_get_intsoff(void);
|
||||
// NSPR_API(void) _MD_set_intsoff(PRInt32 _val);
|
||||
// NSPR_API(_PRCPU*) _MD_current_cpu(void);
|
||||
// NSPR_API(void) _MD_set_current_cpu(_PRCPU *cpu);
|
||||
// NSPR_API(void) _MD_init_running_cpu(_PRCPU *cpu);
|
||||
NSPR_API(PRInt32) _MD_pause_cpu(PRIntervalTime timeout);
|
||||
|
||||
/* Thread stuff */
|
||||
|
||||
// NSPR_API(PRThread*) _MD_current_thread(void);
|
||||
NSPR_API(PRThread*) _MD_get_attached_thread(void);
|
||||
NSPR_API(PRThread*) _MD_last_thread(void);
|
||||
NSPR_API(void) _MD_set_current_thread(PRThread *thread);
|
||||
NSPR_API(void) _MD_set_last_thread(PRThread *thread);
|
||||
NSPR_API(PRStatus) _MD_init_thread(PRThread *thread);
|
||||
NSPR_API(void) _MD_exit_thread(PRThread *thread);
|
||||
NSPR_API(PRStatus) _MD_init_attached_thread(PRThread *thread);
|
||||
|
||||
NSPR_API(void) _MD_suspend_thread(PRThread *thread);
|
||||
NSPR_API(void) _MD_resume_thread(PRThread *thread);
|
||||
// NSPR_API(void) _MD_suspend_cpu(_PRCPU *cpu);
|
||||
// NSPR_API(void) _MD_resume_cpu(_PRCPU *cpu);
|
||||
NSPR_API(void) _MD_begin_suspend_all(void);
|
||||
NSPR_API(void) _MD_end_suspend_all(void);
|
||||
NSPR_API(void) _MD_begin_resume_all(void);
|
||||
NSPR_API(void) _MD_end_resume_all(void);
|
||||
|
||||
NSPR_API(void *) _MD_get_sp(PRThread *thread);
|
||||
|
||||
NSPR_API(void) _MD_clean_thread(PRThread *thread);
|
||||
NSPR_API(void) _MD_create_primordial_user_thread(PRThread *);
|
||||
NSPR_API(PRThread*) _MD_create_user_thread(PRUint32 stacksize, void (*start)(void *), void *arg);
|
||||
NSPR_API(void) _MD_init_primordial_thread(PRThread *thread);
|
||||
NSPR_API(PRStatus) _MD_create_thread(PRThread *thread, void (*start)(void *), PRThreadPriority priority, PRThreadScope scope, PRThreadState state, PRUint32 stackSize);
|
||||
NSPR_API(void) _MD_yield(void);
|
||||
NSPR_API(void) _MD_set_priority(struct _MDThread *md, PRThreadPriority newPri);
|
||||
|
||||
NSPR_API(void) _MD_suspendall(void);
|
||||
NSPR_API(void) _MD_resumeall(void);
|
||||
|
||||
NSPR_API(void) _MD_init_context(PRThread *thread, char *top, void (*start) (void), PRBool *status);
|
||||
NSPR_API(void) _MD_switch_context(PRThread *thread);
|
||||
NSPR_API(void) _MD_restore_context(PRThread *thread);
|
||||
|
||||
NSPR_API(PRStatus) _MD_wait(PRThread *, PRIntervalTime timeout);
|
||||
NSPR_API(PRStatus) _MD_wakeup_waiter(PRThread *);
|
||||
|
||||
NSPR_API(PRInt32) _MD_setthreadaffinitymask(PRThread *thread, PRUint32 mask );
|
||||
NSPR_API(PRInt32) _MD_getthreadaffinitymask(PRThread *thread, PRUint32 *mask);
|
||||
|
||||
/* Thread Synchronization */
|
||||
|
||||
NSPR_API(void) _MD_init_locks(void);
|
||||
NSPR_API(PRStatus) _MD_new_lock(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_free_lock(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_lock(struct _MDLock *md);
|
||||
NSPR_API(PRIntn) _MD_test_and_lock(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_unlock(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_ioq_lock(void);
|
||||
NSPR_API(void) _MD_ioq_unlock(void);
|
||||
NSPR_API(void) _MD_new_sem(struct _MDSemaphore *md, PRUintn value);
|
||||
NSPR_API(void) _MD_destroy_sem(struct _MDSemaphore *md);
|
||||
NSPR_API(PRStatus) _MD_timed_wait_sem(struct _MDSemaphore *md, PRIntervalTime timeout);
|
||||
NSPR_API(PRStatus) _MD_wait_sem(struct _MDSemaphore *md);
|
||||
NSPR_API(void) _MD_post_sem(struct _MDSemaphore *md);
|
||||
// NSPR_API(PRInt32) _MD_new_cv(struct _MDCVar *md);
|
||||
// NSPR_API(void) _MD_free_cv(struct _MDCVar *md);
|
||||
// NSPR_API(void) _MD_wait_cv(struct _MDCVar *mdCVar, struct _MDLock *mdLock, PRIntervalTime timeout);
|
||||
// NSPR_API(void) _MD_notify_cv(struct _MDCVar *md, struct _MDLock *lock);
|
||||
// NSPR_API(void) _MD_notifyall_cv(struct _MDCVar *md, struct _MDLock *lock);
|
||||
|
||||
/* File I/O */
|
||||
|
||||
// NSPR_API(void) _MD_init_io(void);
|
||||
NSPR_API(PRStatus) _MD_open_dir(struct _MDDir *md,const char *name);
|
||||
NSPR_API(char *) _MD_read_dir(struct _MDDir *md, PRIntn flags);
|
||||
NSPR_API(PRInt32) _MD_close_dir(struct _MDDir *md);
|
||||
NSPR_API(void) _MD_make_nonblock(PRFileDesc *fd);
|
||||
NSPR_API(void) _MD_init_fd_inheritable(PRFileDesc *fd, PRBool imported);
|
||||
NSPR_API(void) _MD_query_fd_inheritable(PRFileDesc *fd);
|
||||
NSPR_API(PRInt32) _MD_open(const char *name, PRIntn osflags, PRIntn mode);
|
||||
NSPR_API(PRInt32) _MD_close_file(PRInt32 osfd);
|
||||
NSPR_API(PRInt32) _MD_read(PRFileDesc *fd, void *buf, PRInt32 amount);
|
||||
NSPR_API(PRInt32) _MD_write(PRFileDesc *fd, const void *buf, PRInt32 amount);
|
||||
NSPR_API(PRInt32) _MD_writev(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_lseek(PRFileDesc *fd, PRInt32 offset, int whence);
|
||||
NSPR_API(PRInt64) _MD_lseek64(PRFileDesc *fd, PRInt64 offset, int whence);
|
||||
NSPR_API(PRInt32) _MD_fsync(PRFileDesc *fd);
|
||||
NSPR_API(PRInt32) _MD_delete(const char *name);
|
||||
NSPR_API(PRInt32) _MD_getfileinfo(const char *fn, PRFileInfo *info);
|
||||
NSPR_API(PRInt32) _MD_getfileinfo64(const char *fn, PRFileInfo64 *info);
|
||||
NSPR_API(PRInt32) _MD_getopenfileinfo(const PRFileDesc *fd, PRFileInfo *info);
|
||||
NSPR_API(PRInt32) _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info);
|
||||
NSPR_API(PRInt32) _MD_rename(const char *from, const char *to);
|
||||
NSPR_API(PRInt32) _MD_access(const char *name, PRIntn how);
|
||||
NSPR_API(PRInt32) _MD_stat(const char *name, struct stat *buf);
|
||||
NSPR_API(PRInt32) _MD_mkdir(const char *name, PRIntn mode);
|
||||
NSPR_API(PRInt32) _MD_rmdir(const char *name);
|
||||
NSPR_API(PRInt32) _MD_pr_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout);
|
||||
|
||||
/* Network I/O */
|
||||
NSPR_API(PRInt32) _MD_close_socket(PRInt32 osfd);
|
||||
NSPR_API(PRInt32) _MD_connect(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen);
|
||||
NSPR_API(PRInt32) _MD_listen(PRFileDesc *fd, PRIntn backlog);
|
||||
NSPR_API(PRInt32) _MD_shutdown(PRFileDesc *fd, PRIntn how);
|
||||
NSPR_API(PRInt32) _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout);
|
||||
// NSPR_API(PRInt32) _MD_fast_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg);
|
||||
// NSPR_API(PRInt32) _MD_fast_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg);
|
||||
// NSPR_API(void) _MD_update_accept_context(PRInt32 s, PRInt32 ls);
|
||||
NSPR_API(PRStatus) _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen);
|
||||
NSPR_API(PRStatus) _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen);
|
||||
NSPR_API(PRStatus) _MD_getsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, PRInt32* optlen);
|
||||
NSPR_API(PRStatus) _MD_setsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* optval, PRInt32 optlen);
|
||||
NSPR_API(PRInt32) _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_socketpair(int af, int type, int flags, PRInt32 *osfd);
|
||||
NSPR_API(PRInt32) _MD_socket(int af, int type, int flags);
|
||||
NSPR_API(PRInt32) _MD_socketavailable(PRFileDesc *fd);
|
||||
|
||||
// NSPR_API(PRInt32) _MD_get_socket_error(void);
|
||||
NSPR_API(PRStatus) _MD_gethostname(char *name, PRUint32 namelen);
|
||||
|
||||
/* Process management */
|
||||
|
||||
NSPR_API(PRProcess *) _MD_create_process(const char *path, char *const *argv, char *const *envp, const PRProcessAttr *attr);
|
||||
NSPR_API(PRStatus) _MD_detach_process(PRProcess *process);
|
||||
NSPR_API(PRStatus) _MD_wait_process(PRProcess *process, PRInt32 *exitCode);
|
||||
NSPR_API(PRStatus) _MD_kill_process(PRProcess *process);
|
||||
|
||||
/* Atomic data operations */
|
||||
|
||||
// NSPR_API(void) _MD_init_atomic(void);
|
||||
// NSPR_API(PRInt32) _MD_atomic_increment(PRInt32 *);
|
||||
// NSPR_API(PRInt32) _MD_atomic_decrement(PRInt32 *);
|
||||
// NSPR_API(PRInt32) _MD_atomic_set(PRInt32 *, PRInt32);
|
||||
|
||||
/* Memory management */
|
||||
|
||||
NSPR_API(void) _MD_init_segs(void);
|
||||
NSPR_API(PRStatus) _MD_alloc_segment(PRSegment *seg, PRUint32 size, void *vaddr);
|
||||
NSPR_API(void) _MD_free_segment(PRSegment *seg);
|
||||
|
||||
/* Memory mapped file I/O */
|
||||
|
||||
NSPR_API(PRStatus) _MD_create_file_map(PRFileMap *fmap, PRInt64 size);
|
||||
NSPR_API(PRInt32) _MD_get_mem_map_alignment(void);
|
||||
NSPR_API(void *) _MD_mem_map(PRFileMap *fmap, PRInt64 offset, PRUint32 len);
|
||||
NSPR_API(PRStatus) _MD_mem_unmap(void *addr, PRUint32 size);
|
||||
NSPR_API(PRStatus) _MD_close_file_map(PRFileMap *fmap);
|
||||
|
||||
/* Time related */
|
||||
|
||||
NSPR_API(PRTime) _MD_now(void);
|
||||
NSPR_API(void) _MD_interval_init(void);
|
||||
NSPR_API(PRIntervalTime) _MD_get_interval(void);
|
||||
NSPR_API(PRIntervalTime) _MD_interval_per_sec(void);
|
||||
|
||||
/* File locking */
|
||||
|
||||
NSPR_API(PRStatus) _MD_lockfile(PRInt32 osfd);
|
||||
NSPR_API(PRStatus) _MD_tlockfile(PRInt32 osfd);
|
||||
NSPR_API(PRStatus) _MD_unlockfile(PRInt32 osfd);
|
||||
|
||||
#endif /* _nspr_beos_defs_h___*/
|
||||
@@ -10,9 +10,9 @@
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#include <sys/param.h> /* for _BSDI_VERSION */
|
||||
#include <sys/param.h> /* for _BSDI_VERSION */
|
||||
|
||||
#define PR_LINKER_ARCH "bsdi"
|
||||
#define PR_LINKER_ARCH "bsdi"
|
||||
#define _PR_SI_SYSNAME "BSDI"
|
||||
#if defined(__i386__)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
@@ -21,10 +21,10 @@
|
||||
#else
|
||||
#error "Unknown CPU architecture"
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#define HAVE_BSD_FLOCK
|
||||
@@ -49,39 +49,39 @@
|
||||
#include <setjmp.h>
|
||||
|
||||
#if defined(_PR_BSDI_JMPBUF_IS_ARRAY)
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[2]
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[2]
|
||||
#elif defined(_PR_BSDI_JMPBUF_IS_STRUCT)
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].jb_esp
|
||||
#else
|
||||
#error "Unknown BSDI jmp_buf type"
|
||||
#endif
|
||||
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define PR_CONTEXT_TYPE jmp_buf
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define PR_CONTEXT_TYPE jmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (setjmp(CONTEXT(_thread))) { \
|
||||
_main(); \
|
||||
} \
|
||||
if (setjmp(CONTEXT(_thread))) { \
|
||||
_main(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (int) (_sp - 64); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
longjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
@@ -127,31 +127,31 @@ struct _MDCPU_Unix {
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
@@ -171,7 +171,7 @@ struct _MDCPU {
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
|
||||
#include <sys/syscall.h>
|
||||
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <TargetConditionals.h>
|
||||
#endif
|
||||
|
||||
#define PR_LINKER_ARCH "darwin"
|
||||
#define PR_LINKER_ARCH "darwin"
|
||||
#define _PR_SI_SYSNAME "DARWIN"
|
||||
#ifdef __i386__
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
@@ -31,11 +31,11 @@
|
||||
#else
|
||||
#error "Unknown CPU architecture"
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".dylib"
|
||||
#define PR_DLL_SUFFIX ".dylib"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
@@ -45,7 +45,7 @@
|
||||
#else
|
||||
#define USE_MACH_DYLD
|
||||
#endif
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define _PR_STAT_HAS_ST_ATIMESPEC
|
||||
#define _PR_HAVE_LARGE_OFF_T
|
||||
#define _PR_HAVE_SYSV_SEMAPHORES
|
||||
@@ -146,11 +146,11 @@ static inline PRInt32 _MD_ATOMIC_SET(PRInt32 *val, PRInt32 newval)
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define PR_CONTEXT_TYPE jmp_buf
|
||||
#define PR_CONTEXT_TYPE jmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
#define _MD_GET_SP(_th) (((struct sigcontext *) (_th)->md.context)->sc_onstack)
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
@@ -166,8 +166,8 @@ static inline PRInt32 _MD_ATOMIC_SET(PRInt32 *val, PRInt32 newval)
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -221,31 +221,31 @@ struct _MDCPU_Unix {
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
@@ -281,7 +281,7 @@ extern void _MD_YIELD(void);
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INTERVAL_INIT _PR_Mach_IntervalInit
|
||||
#define _MD_GET_INTERVAL _PR_Mach_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_Mach_TicksPerSecond
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#ifndef nspr_cpucfg___
|
||||
#define nspr_cpucfg___
|
||||
|
||||
#ifndef XP_UNIX
|
||||
#define XP_UNIX
|
||||
#endif
|
||||
|
||||
#ifndef DGUX
|
||||
#define DGUX
|
||||
#endif
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
#ifndef HAVE_LONG_LONG
|
||||
#define HAVE_LONG_LONG
|
||||
#endif
|
||||
#undef HAVE_ALIGNED_DOUBLES
|
||||
#undef HAVE_ALIGNED_LONGLONGS
|
||||
|
||||
#define PR_BYTES_PER_BYTE 1
|
||||
#define PR_BYTES_PER_SHORT 2
|
||||
#define PR_BYTES_PER_INT 4
|
||||
#define PR_BYTES_PER_INT64 8
|
||||
#define PR_BYTES_PER_LONG 4
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 4
|
||||
#define PR_BYTES_PER_DWORD 8
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#define PR_BITS_PER_BYTE 8
|
||||
#define PR_BITS_PER_SHORT 16
|
||||
#define PR_BITS_PER_INT 32
|
||||
#define PR_BITS_PER_INT64 64
|
||||
#define PR_BITS_PER_LONG 32
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 32
|
||||
|
||||
#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 6
|
||||
#define PR_BITS_PER_LONG_LOG2 5
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 5
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_INT64 4
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_DOUBLE 4
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
|
||||
#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
|
||||
#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
|
||||
#define BYTES_PER_INT PR_BYTES_PER_INT
|
||||
#define BYTES_PER_INT64 PR_BYTES_PER_INT64
|
||||
#define BYTES_PER_LONG PR_BYTES_PER_LONG
|
||||
#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
|
||||
#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
|
||||
#define BYTES_PER_WORD PR_BYTES_PER_WORD
|
||||
#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
|
||||
|
||||
#define BITS_PER_BYTE PR_BITS_PER_BYTE
|
||||
#define BITS_PER_SHORT PR_BITS_PER_SHORT
|
||||
#define BITS_PER_INT PR_BITS_PER_INT
|
||||
#define BITS_PER_INT64 PR_BITS_PER_INT64
|
||||
#define BITS_PER_LONG PR_BITS_PER_LONG
|
||||
#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
|
||||
#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
|
||||
#define BITS_PER_WORD PR_BITS_PER_WORD
|
||||
|
||||
#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
|
||||
#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
|
||||
#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
|
||||
#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
|
||||
#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
|
||||
#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
|
||||
#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
|
||||
#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
|
||||
|
||||
#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
|
||||
#define ALIGN_OF_INT PR_ALIGN_OF_INT
|
||||
#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
|
||||
#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
|
||||
#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
|
||||
#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
|
||||
#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
|
||||
#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
|
||||
|
||||
#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
|
||||
#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
|
||||
#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
|
||||
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#endif /* nspr_cpucfg___ */
|
||||
@@ -1,188 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#ifndef nspr_dgux_defs_h___
|
||||
#define nspr_dgux_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "dgux"
|
||||
#define _PR_SI_SYSNAME "DGUX"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#endif
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_NETCONFIG
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define NEED_TIME_R
|
||||
#define _PR_NEED_STRCASECMP
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _SETJMP setjmp
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[4]
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures.
|
||||
* Don't use SVR4 native threads (yet).
|
||||
*/
|
||||
|
||||
struct _MDThread {
|
||||
_PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
/*
|
||||
* The following are copied from _sunos.h, _aix.h. This means
|
||||
* some of them should probably be moved into _unixos.h. But
|
||||
* _irix.h seems to be quite different in regard to these macros.
|
||||
*/
|
||||
#define _MD_INTERVAL_USE_GTOD
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/*
|
||||
* We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
* unwrapped version.
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *execptfds, struct timeval *timeout);
|
||||
#define _MD_SELECT _select
|
||||
|
||||
#define _MD_POLL _poll
|
||||
#include <poll.h>
|
||||
#include <stropts.h>
|
||||
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
|
||||
|
||||
#endif /* nspr_dgux_defs_h___ */
|
||||
@@ -13,7 +13,7 @@
|
||||
#endif
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#define PR_LINKER_ARCH "freebsd"
|
||||
#define PR_LINKER_ARCH "freebsd"
|
||||
#define _PR_SI_SYSNAME "FREEBSD"
|
||||
#if defined(__i386__)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
@@ -47,8 +47,8 @@
|
||||
#endif
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
@@ -91,12 +91,12 @@
|
||||
#ifndef _PR_PTHREADS
|
||||
#include <setjmp.h>
|
||||
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
#define _MD_GET_SP(_th) (_th)->md.context[0]._sjb[2]
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
@@ -112,8 +112,8 @@
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!sigsetjmp(CONTEXT(_thread), 1)) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -167,31 +167,31 @@ struct _MDCPU_Unix {
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
@@ -229,7 +229,7 @@ extern void _MD_YIELD(void);
|
||||
extern void _MD_EarlyInit(void);
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _PR_HAVE_CLOCK_MONOTONIC
|
||||
|
||||
/*
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#define PR_DLL_SUFFIX ".sl"
|
||||
#endif
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
/*
|
||||
* _USE_BIG_FDS increases the size of fd_set from 256 bytes to
|
||||
@@ -40,9 +40,9 @@
|
||||
#define NEED_TIME_R
|
||||
|
||||
#define HAVE_STACK_GROWING_UP
|
||||
#undef HAVE_WEAK_IO_SYMBOLS
|
||||
#undef HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#undef HAVE_WEAK_IO_SYMBOLS
|
||||
#undef HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#ifdef IS_64
|
||||
#define USE_DLFCN
|
||||
#else
|
||||
@@ -134,7 +134,7 @@ struct _md_sockaddr_in6 {
|
||||
/* Caveat: This makes jmp_buf full of doubles. */
|
||||
#define CONTEXT(_th) ((_th)->md.jb)
|
||||
|
||||
/* Stack needs two frames (64 bytes) at the bottom */ \
|
||||
/* Stack needs two frames (64 bytes) at the bottom */ \
|
||||
#define _MD_SET_THR_SP(_t, _sp) ((_MD_GET_SP(_t)) = (int) (_sp + 64 *2))
|
||||
#define SAVE_CONTEXT(_th) _setjmp(CONTEXT(_th))
|
||||
#define GOTO_CONTEXT(_th) _longjmp(CONTEXT(_th), 1)
|
||||
@@ -206,28 +206,28 @@ struct _MDCPU_Unix {
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
@@ -249,18 +249,18 @@ struct _MDCPU {
|
||||
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
#else /* PTHREADS_USER */
|
||||
#else /* PTHREADS_USER */
|
||||
|
||||
#include "_nspr_pthread.h"
|
||||
|
||||
#endif /* PTHREADS_USER */
|
||||
#endif /* PTHREADS_USER */
|
||||
|
||||
#endif /* !defined(_PR_PTHREADS) */
|
||||
|
||||
#if !defined(PTHREADS_USER)
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#endif
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#endif
|
||||
|
||||
#if defined(HPUX_LW_TIMER)
|
||||
extern void _PR_HPUX_LW_IntervalInit(void);
|
||||
|
||||
@@ -1,438 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#ifndef nspr_irix_defs_h___
|
||||
#define nspr_irix_defs_h___
|
||||
|
||||
#define _PR_HAVE_ATOMIC_CAS
|
||||
|
||||
/*
|
||||
* MipsPro assembler defines _LANGUAGE_ASSEMBLY
|
||||
*/
|
||||
#ifndef _LANGUAGE_ASSEMBLY
|
||||
|
||||
#include "prclist.h"
|
||||
#include "prthread.h"
|
||||
#include <sys/ucontext.h>
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "irix"
|
||||
#define _PR_SI_SYSNAME "IRIX"
|
||||
#define _PR_SI_ARCHITECTURE "mips"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _PR_NUM_GCREGS 9
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MIN_STACK_SIZE 16384L
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_STAT_HAS_ST_ATIM
|
||||
#define _PR_HAVE_OFF64_T
|
||||
#define HAVE_POINTER_LOCALTIME_R
|
||||
#define _PR_HAVE_POSIX_SEMAPHORES
|
||||
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
|
||||
#define _PR_ACCEPT_INHERIT_NONBLOCK
|
||||
|
||||
#ifdef _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#define _PR_HAVE_GETIPNODEBYNAME
|
||||
#define _PR_HAVE_GETIPNODEBYADDR
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#endif
|
||||
|
||||
/* Initialization entry points */
|
||||
NSPR_API(void) _MD_EarlyInit(void);
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
|
||||
NSPR_API(void) _MD_IrixInit(void);
|
||||
#define _MD_FINAL_INIT _MD_IrixInit
|
||||
|
||||
#define _MD_INIT_IO()
|
||||
|
||||
/* Timer operations */
|
||||
NSPR_API(PRIntervalTime) _MD_IrixGetInterval(void);
|
||||
#define _MD_GET_INTERVAL _MD_IrixGetInterval
|
||||
|
||||
NSPR_API(PRIntervalTime) _MD_IrixIntervalPerSec(void);
|
||||
#define _MD_INTERVAL_PER_SEC _MD_IrixIntervalPerSec
|
||||
|
||||
/* GC operations */
|
||||
NSPR_API(void *) _MD_GetSP(PRThread *thread);
|
||||
#define _MD_GET_SP _MD_GetSP
|
||||
|
||||
/* The atomic operations */
|
||||
#include <mutex.h>
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_INCREMENT(val) add_then_test((unsigned long*)val, 1)
|
||||
#define _MD_ATOMIC_ADD(ptr, val) add_then_test((unsigned long*)ptr, (unsigned long)val)
|
||||
#define _MD_ATOMIC_DECREMENT(val) add_then_test((unsigned long*)val, 0xffffffff)
|
||||
#define _MD_ATOMIC_SET(val, newval) test_and_set((unsigned long*)val, newval)
|
||||
|
||||
#if defined(_PR_PTHREADS)
|
||||
#else /* defined(_PR_PTHREADS) */
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <bstring.h>
|
||||
#include <sys/time.h>
|
||||
#include <ulocks.h>
|
||||
#include <sys/prctl.h>
|
||||
|
||||
|
||||
/*
|
||||
* Data region private to each sproc. This region is setup by calling
|
||||
* mmap(...,MAP_LOCAL,...). The private data is mapped at the same
|
||||
* address in every sproc, but every sproc gets a private mapping.
|
||||
*
|
||||
* Just make sure that this structure fits in a page, as only one page
|
||||
* is allocated for the private region.
|
||||
*/
|
||||
struct sproc_private_data {
|
||||
struct PRThread *me;
|
||||
struct _PRCPU *cpu;
|
||||
struct PRThread *last;
|
||||
PRUintn intsOff;
|
||||
int sproc_pid;
|
||||
};
|
||||
|
||||
extern char *_nspr_sproc_private;
|
||||
|
||||
#define _PR_PRDA() ((struct sproc_private_data *) _nspr_sproc_private)
|
||||
#define _MD_SET_CURRENT_THREAD(_thread) _PR_PRDA()->me = (_thread)
|
||||
#define _MD_THIS_THREAD() (_PR_PRDA()->me)
|
||||
#define _MD_LAST_THREAD() (_PR_PRDA()->last)
|
||||
#define _MD_SET_LAST_THREAD(_thread) _PR_PRDA()->last = (_thread)
|
||||
#define _MD_CURRENT_CPU() (_PR_PRDA()->cpu)
|
||||
#define _MD_SET_CURRENT_CPU(_cpu) _PR_PRDA()->cpu = (_cpu)
|
||||
#define _MD_SET_INTSOFF(_val) (_PR_PRDA()->intsOff = _val)
|
||||
#define _MD_GET_INTSOFF() (_PR_PRDA()->intsOff)
|
||||
|
||||
#define _MD_SET_SPROC_PID(_val) (_PR_PRDA()->sproc_pid = _val)
|
||||
#define _MD_GET_SPROC_PID() (_PR_PRDA()->sproc_pid)
|
||||
|
||||
NSPR_API(struct PRThread*) _MD_get_attached_thread(void);
|
||||
NSPR_API(struct PRThread*) _MD_get_current_thread(void);
|
||||
#define _MD_GET_ATTACHED_THREAD() _MD_get_attached_thread()
|
||||
#define _MD_CURRENT_THREAD() _MD_get_current_thread()
|
||||
|
||||
#define _MD_CHECK_FOR_EXIT() { \
|
||||
if (_pr_irix_exit_now) { \
|
||||
_PR_POST_SEM(_pr_irix_exit_sem); \
|
||||
_MD_Wakeup_CPUs(); \
|
||||
_exit(0); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define _MD_ATTACH_THREAD(threadp)
|
||||
|
||||
#define _MD_SAVE_ERRNO(_thread) (_thread)->md.errcode = errno;
|
||||
#define _MD_RESTORE_ERRNO(_thread) errno = (_thread)->md.errcode;
|
||||
|
||||
extern struct _PRCPU *_pr_primordialCPU;
|
||||
extern usema_t *_pr_irix_exit_sem;
|
||||
extern PRInt32 _pr_irix_exit_now;
|
||||
extern int _pr_irix_primoridal_cpu_fd[];
|
||||
extern PRInt32 _pr_irix_process_exit;
|
||||
extern PRInt32 _pr_irix_process_exit_code;
|
||||
|
||||
/* Thread operations */
|
||||
#define _PR_LOCK_HEAP() { \
|
||||
PRIntn _is; \
|
||||
if (_pr_primordialCPU) { \
|
||||
if (_MD_GET_ATTACHED_THREAD() && \
|
||||
!_PR_IS_NATIVE_THREAD( \
|
||||
_MD_GET_ATTACHED_THREAD())) \
|
||||
_PR_INTSOFF(_is); \
|
||||
_PR_LOCK(_pr_heapLock); \
|
||||
}
|
||||
|
||||
#define _PR_UNLOCK_HEAP() if (_pr_primordialCPU) { \
|
||||
_PR_UNLOCK(_pr_heapLock); \
|
||||
if (_MD_GET_ATTACHED_THREAD() && \
|
||||
!_PR_IS_NATIVE_THREAD( \
|
||||
_MD_GET_ATTACHED_THREAD())) \
|
||||
_PR_INTSON(_is); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define _PR_OPEN_POLL_SEM(_sem) usopenpollsema(_sem, 0666)
|
||||
#define _PR_WAIT_SEM(_sem) uspsema(_sem)
|
||||
#define _PR_POST_SEM(_sem) usvsema(_sem)
|
||||
|
||||
#define _MD_CVAR_POST_SEM(threadp) usvsema((threadp)->md.cvar_pollsem)
|
||||
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
struct _MDLock {
|
||||
ulock_t lock;
|
||||
usptr_t *arena;
|
||||
};
|
||||
|
||||
/*
|
||||
* disable pre-emption for the LOCAL threads when calling the arena lock
|
||||
* routines
|
||||
*/
|
||||
|
||||
#define _PR_LOCK(lock) { \
|
||||
PRIntn _is; \
|
||||
PRThread *me = _MD_GET_ATTACHED_THREAD(); \
|
||||
if (me && !_PR_IS_NATIVE_THREAD(me)) \
|
||||
_PR_INTSOFF(_is); \
|
||||
ussetlock(lock); \
|
||||
if (me && !_PR_IS_NATIVE_THREAD(me)) \
|
||||
_PR_FAST_INTSON(_is); \
|
||||
}
|
||||
|
||||
#define _PR_UNLOCK(lock) { \
|
||||
PRIntn _is; \
|
||||
PRThread *me = _MD_GET_ATTACHED_THREAD(); \
|
||||
if (me && !_PR_IS_NATIVE_THREAD(me)) \
|
||||
_PR_INTSOFF(_is); \
|
||||
usunsetlock(lock); \
|
||||
if (me && !_PR_IS_NATIVE_THREAD(me)) \
|
||||
_PR_FAST_INTSON(_is); \
|
||||
}
|
||||
|
||||
NSPR_API(PRStatus) _MD_NEW_LOCK(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_FREE_LOCK(struct _MDLock *lockp);
|
||||
|
||||
#define _MD_LOCK(_lockp) _PR_LOCK((_lockp)->lock)
|
||||
#define _MD_UNLOCK(_lockp) _PR_UNLOCK((_lockp)->lock)
|
||||
#define _MD_TEST_AND_LOCK(_lockp) (uscsetlock((_lockp)->lock, 1) == 0)
|
||||
|
||||
extern ulock_t _pr_heapLock;
|
||||
|
||||
struct _MDThread {
|
||||
jmp_buf jb;
|
||||
usptr_t *pollsem_arena;
|
||||
usema_t *cvar_pollsem;
|
||||
PRInt32 cvar_pollsemfd;
|
||||
PRInt32 cvar_pollsem_select; /* acquire sem by calling select */
|
||||
PRInt32 cvar_wait; /* if 1, thread is waiting on cvar Q */
|
||||
PRInt32 id;
|
||||
PRInt32 suspending_id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
usema_t *sem;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
ulock_t mdcvar_lock;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
|
||||
struct _MDCPU {
|
||||
PRInt32 id;
|
||||
PRInt32 suspending_id;
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
int *jb = (_thread)->md.jb; \
|
||||
*status = PR_TRUE; \
|
||||
(void) setjmp(jb); \
|
||||
(_thread)->md.jb[JB_SP] = (int) ((_sp) - 64); \
|
||||
(_thread)->md.jb[JB_PC] = (int) _main; \
|
||||
_thread->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Switch away from the current thread context by saving its state and
|
||||
** calling the thread scheduler. Reload cpu when we come back from the
|
||||
** context switch because it might have changed.
|
||||
*
|
||||
* XXX RUNQ lock needed before clearing _PR_NO_SCHED flag, because the
|
||||
* thread may be unr RUNQ?
|
||||
*/
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
PR_ASSERT(_thread->no_sched); \
|
||||
if (!setjmp(_thread->md.jb)) { \
|
||||
_MD_SAVE_ERRNO(_thread) \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
} else { \
|
||||
PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \
|
||||
_MD_LAST_THREAD()->no_sched = 0; \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Restore a thread context that was saved by _MD_SWITCH_CONTEXT or
|
||||
** initialized by _MD_INIT_CONTEXT.
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_newThread) \
|
||||
PR_BEGIN_MACRO \
|
||||
int *jb = (_newThread)->md.jb; \
|
||||
_MD_RESTORE_ERRNO(_newThread) \
|
||||
_MD_SET_CURRENT_THREAD(_newThread); \
|
||||
_newThread->no_sched = 1; \
|
||||
longjmp(jb, 1); \
|
||||
PR_END_MACRO
|
||||
|
||||
NSPR_API(PRStatus) _MD_InitThread(struct PRThread *thread,
|
||||
PRBool wakeup_parent);
|
||||
NSPR_API(PRStatus) _MD_InitAttachedThread(struct PRThread *thread,
|
||||
PRBool wakeup_parent);
|
||||
#define _MD_INIT_THREAD(thread) _MD_InitThread(thread, PR_TRUE)
|
||||
#define _MD_INIT_ATTACHED_THREAD(thread) \
|
||||
_MD_InitAttachedThread(thread, PR_FALSE)
|
||||
|
||||
NSPR_API(void) _MD_ExitThread(struct PRThread *thread);
|
||||
#define _MD_EXIT_THREAD _MD_ExitThread
|
||||
|
||||
NSPR_API(void) _MD_SuspendThread(struct PRThread *thread);
|
||||
#define _MD_SUSPEND_THREAD _MD_SuspendThread
|
||||
|
||||
NSPR_API(void) _MD_ResumeThread(struct PRThread *thread);
|
||||
#define _MD_RESUME_THREAD _MD_ResumeThread
|
||||
|
||||
NSPR_API(void) _MD_SuspendCPU(struct _PRCPU *thread);
|
||||
#define _MD_SUSPEND_CPU _MD_SuspendCPU
|
||||
|
||||
NSPR_API(void) _MD_ResumeCPU(struct _PRCPU *thread);
|
||||
#define _MD_RESUME_CPU _MD_ResumeCPU
|
||||
|
||||
#define _MD_BEGIN_SUSPEND_ALL()
|
||||
#define _MD_END_SUSPEND_ALL()
|
||||
#define _MD_BEGIN_RESUME_ALL()
|
||||
#define _MD_END_RESUME_ALL()
|
||||
|
||||
NSPR_API(void) _MD_InitLocks(void);
|
||||
#define _MD_INIT_LOCKS _MD_InitLocks
|
||||
|
||||
NSPR_API(void) _MD_CleanThread(struct PRThread *thread);
|
||||
#define _MD_CLEAN_THREAD _MD_CleanThread
|
||||
|
||||
#define _MD_YIELD() sginap(0)
|
||||
|
||||
/* The _PR_MD_WAIT_LOCK and _PR_MD_WAKEUP_WAITER functions put to sleep and
|
||||
* awaken a thread which is waiting on a lock or cvar.
|
||||
*/
|
||||
NSPR_API(PRStatus) _MD_wait(struct PRThread *, PRIntervalTime timeout);
|
||||
#define _MD_WAIT _MD_wait
|
||||
|
||||
NSPR_API(void) _PR_MD_primordial_cpu();
|
||||
NSPR_API(void) _PR_MD_WAKEUP_PRIMORDIAL_CPU();
|
||||
|
||||
NSPR_API(PRStatus) _MD_WakeupWaiter(struct PRThread *);
|
||||
#define _MD_WAKEUP_WAITER _MD_WakeupWaiter
|
||||
|
||||
NSPR_API(void ) _MD_exit(PRIntn status);
|
||||
#define _MD_EXIT _MD_exit
|
||||
|
||||
#include "prthread.h"
|
||||
|
||||
NSPR_API(void) _MD_SetPriority(struct _MDThread *thread,
|
||||
PRThreadPriority newPri);
|
||||
#define _MD_SET_PRIORITY _MD_SetPriority
|
||||
|
||||
NSPR_API(PRStatus) _MD_CreateThread(
|
||||
struct PRThread *thread,
|
||||
void (*start) (void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
#define _MD_CREATE_THREAD _MD_CreateThread
|
||||
|
||||
extern void _MD_CleanupBeforeExit(void);
|
||||
#define _MD_CLEANUP_BEFORE_EXIT _MD_CleanupBeforeExit
|
||||
|
||||
NSPR_API(void) _PR_MD_PRE_CLEANUP(PRThread *me);
|
||||
|
||||
|
||||
/* The following defines the unwrapped versions of select() and poll(). */
|
||||
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout);
|
||||
#define _MD_SELECT _select
|
||||
|
||||
#include <stropts.h>
|
||||
#include <poll.h>
|
||||
#define _MD_POLL _poll
|
||||
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
|
||||
|
||||
|
||||
#define HAVE_THREAD_AFFINITY 1
|
||||
|
||||
NSPR_API(PRInt32) _MD_GetThreadAffinityMask(PRThread *unused, PRUint32 *mask);
|
||||
#define _MD_GETTHREADAFFINITYMASK _MD_GetThreadAffinityMask
|
||||
|
||||
NSPR_API(void) _MD_InitRunningCPU(struct _PRCPU *cpu);
|
||||
#define _MD_INIT_RUNNING_CPU _MD_InitRunningCPU
|
||||
|
||||
#endif /* defined(_PR_PTHREADS) */
|
||||
|
||||
#endif /* _LANGUAGE_ASSEMBLY */
|
||||
|
||||
#endif /* nspr_irix_defs_h___ */
|
||||
@@ -1,119 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#ifndef nspr_cpucfg___
|
||||
#define nspr_cpucfg___
|
||||
|
||||
#ifndef _SGI_MP_SOURCE
|
||||
#define _SGI_MP_SOURCE
|
||||
#endif
|
||||
|
||||
#ifndef XP_UNIX
|
||||
#define XP_UNIX
|
||||
#endif
|
||||
|
||||
#ifndef IRIX
|
||||
#define IRIX
|
||||
#endif
|
||||
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
#define IS_BIG_ENDIAN 1
|
||||
|
||||
#define PR_AF_INET6 24 /* same as AF_INET6 */
|
||||
|
||||
#define PR_BYTES_PER_BYTE 1
|
||||
#define PR_BYTES_PER_SHORT 2
|
||||
#define PR_BYTES_PER_INT 4
|
||||
#define PR_BYTES_PER_INT64 8
|
||||
#define PR_BYTES_PER_LONG 4
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 4
|
||||
#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 64
|
||||
#define PR_BITS_PER_LONG 32
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 32
|
||||
|
||||
#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 6
|
||||
#define PR_BITS_PER_LONG_LOG2 5
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 5
|
||||
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_INT64 8
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_DOUBLE 8
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
#define PR_ALIGN_OF_WORD 4
|
||||
|
||||
#ifndef HAVE_LONG_LONG
|
||||
#define HAVE_LONG_LONG
|
||||
#endif
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
#define HAVE_ALIGNED_LONGLONGS
|
||||
|
||||
#define _PR_POLL_BACKCOMPAT
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
|
||||
#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
|
||||
#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
|
||||
#define BYTES_PER_INT PR_BYTES_PER_INT
|
||||
#define BYTES_PER_INT64 PR_BYTES_PER_INT64
|
||||
#define BYTES_PER_LONG PR_BYTES_PER_LONG
|
||||
#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
|
||||
#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
|
||||
#define BYTES_PER_WORD PR_BYTES_PER_WORD
|
||||
#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
|
||||
|
||||
#define BITS_PER_BYTE PR_BITS_PER_BYTE
|
||||
#define BITS_PER_SHORT PR_BITS_PER_SHORT
|
||||
#define BITS_PER_INT PR_BITS_PER_INT
|
||||
#define BITS_PER_INT64 PR_BITS_PER_INT64
|
||||
#define BITS_PER_LONG PR_BITS_PER_LONG
|
||||
#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
|
||||
#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
|
||||
#define BITS_PER_WORD PR_BITS_PER_WORD
|
||||
|
||||
#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
|
||||
#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
|
||||
#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
|
||||
#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
|
||||
#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
|
||||
#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
|
||||
#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
|
||||
#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
|
||||
|
||||
#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
|
||||
#define ALIGN_OF_INT PR_ALIGN_OF_INT
|
||||
#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
|
||||
#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
|
||||
#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
|
||||
#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
|
||||
#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
|
||||
#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
|
||||
|
||||
#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
|
||||
#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
|
||||
#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
|
||||
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#endif /* nspr_cpucfg___ */
|
||||
@@ -1,118 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#ifndef nspr_cpucfg___
|
||||
#define nspr_cpucfg___
|
||||
|
||||
#ifndef _SGI_MP_SOURCE
|
||||
#define _SGI_MP_SOURCE
|
||||
#endif
|
||||
|
||||
#ifndef XP_UNIX
|
||||
#define XP_UNIX
|
||||
#endif
|
||||
|
||||
#ifndef IRIX
|
||||
#define IRIX
|
||||
#endif
|
||||
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
#define IS_BIG_ENDIAN 1
|
||||
#define IS_64
|
||||
|
||||
#define PR_AF_INET6 24 /* same as AF_INET6 */
|
||||
|
||||
#define PR_BYTES_PER_BYTE 1
|
||||
#define PR_BYTES_PER_SHORT 2
|
||||
#define PR_BYTES_PER_INT 4
|
||||
#define PR_BYTES_PER_INT64 8
|
||||
#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 64
|
||||
#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 6
|
||||
#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_BYTES_PER_WORD_LOG2 3
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_INT64 8
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_DOUBLE 8
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
#define PR_ALIGN_OF_WORD 4
|
||||
|
||||
#ifndef HAVE_LONG_LONG
|
||||
#define HAVE_LONG_LONG
|
||||
#endif
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
#define HAVE_ALIGNED_LONGLONGS
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
|
||||
#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
|
||||
#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
|
||||
#define BYTES_PER_INT PR_BYTES_PER_INT
|
||||
#define BYTES_PER_INT64 PR_BYTES_PER_INT64
|
||||
#define BYTES_PER_LONG PR_BYTES_PER_LONG
|
||||
#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
|
||||
#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
|
||||
#define BYTES_PER_WORD PR_BYTES_PER_WORD
|
||||
#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
|
||||
|
||||
#define BITS_PER_BYTE PR_BITS_PER_BYTE
|
||||
#define BITS_PER_SHORT PR_BITS_PER_SHORT
|
||||
#define BITS_PER_INT PR_BITS_PER_INT
|
||||
#define BITS_PER_INT64 PR_BITS_PER_INT64
|
||||
#define BITS_PER_LONG PR_BITS_PER_LONG
|
||||
#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
|
||||
#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
|
||||
#define BITS_PER_WORD PR_BITS_PER_WORD
|
||||
|
||||
#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
|
||||
#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
|
||||
#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
|
||||
#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
|
||||
#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
|
||||
#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
|
||||
#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
|
||||
#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
|
||||
|
||||
#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
|
||||
#define ALIGN_OF_INT PR_ALIGN_OF_INT
|
||||
#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
|
||||
#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
|
||||
#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
|
||||
#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
|
||||
#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
|
||||
#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
|
||||
|
||||
#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
|
||||
#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
|
||||
#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
|
||||
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#endif /* nspr_cpucfg___ */
|
||||
@@ -1112,6 +1112,101 @@
|
||||
#define PR_BYTES_PER_WORD_LOG2 3
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#elif defined(__arc__)
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
|
||||
#define PR_BYTES_PER_BYTE 1
|
||||
#define PR_BYTES_PER_SHORT 2
|
||||
#define PR_BYTES_PER_INT 4
|
||||
#define PR_BYTES_PER_INT64 8
|
||||
#define PR_BYTES_PER_LONG 4
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 4
|
||||
#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 64
|
||||
#define PR_BITS_PER_LONG 32
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 32
|
||||
|
||||
#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 6
|
||||
#define PR_BITS_PER_LONG_LOG2 5
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 5
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_INT64 4
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_DOUBLE 4
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
#define PR_ALIGN_OF_WORD 4
|
||||
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#elif defined(__nios2__) || defined(__microblaze__) || defined(__nds32__)
|
||||
|
||||
#if defined(__microblaze__) && defined(__BIG_ENDIAN__)
|
||||
#define IS_BIG_ENDIAN 1
|
||||
#undef IS_LITTLE_ENDIAN
|
||||
#else
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#define PR_BYTES_PER_BYTE 1
|
||||
#define PR_BYTES_PER_SHORT 2
|
||||
#define PR_BYTES_PER_INT 4
|
||||
#define PR_BYTES_PER_INT64 8
|
||||
#define PR_BYTES_PER_LONG 4
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 4
|
||||
#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 64
|
||||
#define PR_BITS_PER_LONG 32
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 32
|
||||
|
||||
#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 6
|
||||
#define PR_BITS_PER_LONG_LOG2 5
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 5
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_INT64 4
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_DOUBLE 4
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
#define PR_ALIGN_OF_WORD 4
|
||||
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#else
|
||||
|
||||
#error "Unknown CPU architecture"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "linux"
|
||||
#define PR_LINKER_ARCH "linux"
|
||||
#define _PR_SI_SYSNAME "LINUX"
|
||||
#ifdef __powerpc64__
|
||||
#define _PR_SI_ARCHITECTURE "ppc64"
|
||||
@@ -61,21 +61,29 @@
|
||||
#define _PR_SI_ARCHITECTURE "riscv32"
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#define _PR_SI_ARCHITECTURE "riscv64"
|
||||
#elif defined(__arc__)
|
||||
#define _PR_SI_ARCHITECTURE "arc"
|
||||
#elif defined(__nios2__)
|
||||
#define _PR_SI_ARCHITECTURE "nios2"
|
||||
#elif defined(__microblaze__)
|
||||
#define _PR_SI_ARCHITECTURE "microblaze"
|
||||
#elif defined(__nds32__)
|
||||
#define _PR_SI_ARCHITECTURE "nds32"
|
||||
#else
|
||||
#error "Unknown CPU architecture"
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#if defined(__aarch64__) || defined(__mips__)
|
||||
#define _MD_MINIMUM_STACK_SIZE 0x20000
|
||||
#endif
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
|
||||
/*
|
||||
* Elf linux supports dl* functions
|
||||
@@ -329,7 +337,7 @@ extern void _MD_CleanupBeforeExit(void);
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
@@ -554,8 +562,8 @@ extern void _MD_CleanupBeforeExit(void);
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!sigsetjmp(CONTEXT(_thread), 1)) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -616,24 +624,24 @@ struct _MDCPU_Unix {
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
@@ -686,7 +694,7 @@ extern void _MD_EarlyInit(void);
|
||||
#ifdef _PR_POLL_AVAILABLE
|
||||
#include <sys/poll.h>
|
||||
extern int __syscall_poll(struct pollfd *ufds, unsigned long int nfds,
|
||||
int timeout);
|
||||
int timeout);
|
||||
#define _MD_POLL __syscall_poll
|
||||
#endif
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/param.h> /* for __NetBSD_Version__ */
|
||||
|
||||
#define PR_LINKER_ARCH "netbsd"
|
||||
#define PR_LINKER_ARCH "netbsd"
|
||||
#define _PR_SI_SYSNAME "NetBSD"
|
||||
#if defined(__i386__)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
@@ -33,14 +33,14 @@
|
||||
#endif
|
||||
|
||||
#if defined(__ELF__)
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
#else
|
||||
#define PR_DLL_SUFFIX ".so.1.0"
|
||||
#define PR_DLL_SUFFIX ".so.1.0"
|
||||
#endif
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
@@ -67,7 +67,7 @@
|
||||
#ifndef _PR_PTHREADS
|
||||
#include <setjmp.h>
|
||||
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
#endif
|
||||
#define _MD_GET_SP(_th) (_th)->md.context[JB_SP_INDEX]
|
||||
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
@@ -162,28 +162,28 @@ struct _MDCPU_Unix {
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
@@ -210,7 +210,7 @@ struct _MDCPU {
|
||||
extern void _MD_EarlyInit(void);
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _PR_HAVE_CLOCK_MONOTONIC
|
||||
|
||||
/*
|
||||
|
||||
@@ -11,79 +11,79 @@
|
||||
|
||||
#if defined(PTHREADS_USER)
|
||||
/*
|
||||
** Thread Local Storage
|
||||
** Thread Local Storage
|
||||
*/
|
||||
extern pthread_key_t current_thread_key;
|
||||
extern pthread_key_t current_cpu_key;
|
||||
extern pthread_key_t last_thread_key;
|
||||
extern pthread_key_t intsoff_key;
|
||||
|
||||
#define _MD_CURRENT_THREAD() \
|
||||
((struct PRThread *) pthread_getspecific(current_thread_key))
|
||||
#define _MD_CURRENT_CPU() \
|
||||
((struct _PRCPU *) pthread_getspecific(current_cpu_key))
|
||||
#define _MD_LAST_THREAD() \
|
||||
((struct PRThread *) pthread_getspecific(last_thread_key))
|
||||
|
||||
#define _MD_SET_CURRENT_THREAD(newval) \
|
||||
pthread_setspecific(current_thread_key, (void *)newval)
|
||||
#define _MD_CURRENT_THREAD() \
|
||||
((struct PRThread *) pthread_getspecific(current_thread_key))
|
||||
#define _MD_CURRENT_CPU() \
|
||||
((struct _PRCPU *) pthread_getspecific(current_cpu_key))
|
||||
#define _MD_LAST_THREAD() \
|
||||
((struct PRThread *) pthread_getspecific(last_thread_key))
|
||||
|
||||
#define _MD_SET_CURRENT_CPU(newval) \
|
||||
pthread_setspecific(current_cpu_key, (void *)newval)
|
||||
#define _MD_SET_CURRENT_THREAD(newval) \
|
||||
pthread_setspecific(current_thread_key, (void *)newval)
|
||||
|
||||
#define _MD_SET_LAST_THREAD(newval) \
|
||||
pthread_setspecific(last_thread_key, (void *)newval)
|
||||
#define _MD_SET_CURRENT_CPU(newval) \
|
||||
pthread_setspecific(current_cpu_key, (void *)newval)
|
||||
|
||||
#define _MD_SET_LAST_THREAD(newval) \
|
||||
pthread_setspecific(last_thread_key, (void *)newval)
|
||||
|
||||
#define _MD_SET_INTSOFF(_val)
|
||||
#define _MD_GET_INTSOFF() 1
|
||||
|
||||
#define _MD_GET_INTSOFF() 1
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
*status = PR_TRUE; \
|
||||
if (SAVE_CONTEXT(_thread)) { \
|
||||
(*_main)(); \
|
||||
} \
|
||||
_MD_SET_THR_SP(_thread, _sp); \
|
||||
_thread->no_sched = 0; \
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
*status = PR_TRUE; \
|
||||
if (SAVE_CONTEXT(_thread)) { \
|
||||
(*_main)(); \
|
||||
} \
|
||||
_MD_SET_THR_SP(_thread, _sp); \
|
||||
_thread->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
PR_ASSERT(_thread->no_sched); \
|
||||
if (!SAVE_CONTEXT(_thread)) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
} else { \
|
||||
(_MD_LAST_THREAD())->no_sched = 0; \
|
||||
} \
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
PR_ASSERT(_thread->no_sched); \
|
||||
if (!SAVE_CONTEXT(_thread)) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
} else { \
|
||||
(_MD_LAST_THREAD())->no_sched = 0; \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_thread->no_sched = 1; \
|
||||
GOTO_CONTEXT(_thread); \
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_thread->no_sched = 1; \
|
||||
GOTO_CONTEXT(_thread); \
|
||||
PR_END_MACRO
|
||||
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
jmp_buf jb;
|
||||
int id;
|
||||
int errcode;
|
||||
pthread_t pthread;
|
||||
pthread_mutex_t pthread_mutex;
|
||||
pthread_cond_t pthread_cond;
|
||||
int wait;
|
||||
jmp_buf jb;
|
||||
int id;
|
||||
int errcode;
|
||||
pthread_t pthread;
|
||||
pthread_mutex_t pthread_mutex;
|
||||
pthread_cond_t pthread_cond;
|
||||
int wait;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
@@ -91,7 +91,7 @@ struct _MDThreadStack {
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
pthread_mutex_t mutex;
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
@@ -99,7 +99,7 @@ struct _MDSemaphore {
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
pthread_mutex_t mutex;
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
@@ -119,33 +119,33 @@ struct _MDCPU_Unix {
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
jmp_buf jb;
|
||||
pthread_t pthread;
|
||||
struct _MDCPU_Unix md_unix;
|
||||
jmp_buf jb;
|
||||
pthread_t pthread;
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -162,15 +162,15 @@ extern pthread_mutex_t _pr_heapLock;
|
||||
#define _PR_UNLOCK(lock) pthread_mutex_unlock(lock)
|
||||
|
||||
|
||||
#define _PR_LOCK_HEAP() { \
|
||||
if (_pr_primordialCPU) { \
|
||||
_PR_LOCK(_pr_heapLock); \
|
||||
}
|
||||
#define _PR_LOCK_HEAP() { \
|
||||
if (_pr_primordialCPU) { \
|
||||
_PR_LOCK(_pr_heapLock); \
|
||||
}
|
||||
|
||||
#define _PR_UNLOCK_HEAP() if (_pr_primordialCPU) { \
|
||||
_PR_UNLOCK(_pr_heapLock); \
|
||||
} \
|
||||
}
|
||||
#define _PR_UNLOCK_HEAP() if (_pr_primordialCPU) { \
|
||||
_PR_UNLOCK(_pr_heapLock); \
|
||||
} \
|
||||
}
|
||||
|
||||
NSPR_API(PRStatus) _MD_NEW_LOCK(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_FREE_LOCK(struct _MDLock *lockp);
|
||||
@@ -219,12 +219,12 @@ NSPR_API(void) _MD_CleanThread(struct PRThread *thread);
|
||||
#define _MD_CLEAN_THREAD _MD_CleanThread
|
||||
|
||||
NSPR_API(PRStatus) _MD_CreateThread(
|
||||
struct PRThread *thread,
|
||||
void (*start) (void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
struct PRThread *thread,
|
||||
void (*start) (void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
#define _MD_CREATE_THREAD _MD_CreateThread
|
||||
|
||||
extern void _MD_CleanupBeforeExit(void);
|
||||
@@ -243,7 +243,7 @@ NSPR_API(PRStatus) _MD_WakeupWaiter(struct PRThread *);
|
||||
#define _MD_WAKEUP_WAITER _MD_WakeupWaiter
|
||||
|
||||
NSPR_API(void) _MD_SetPriority(struct _MDThread *thread,
|
||||
PRThreadPriority newPri);
|
||||
PRThreadPriority newPri);
|
||||
#define _MD_SET_PRIORITY _MD_SetPriority
|
||||
|
||||
#endif /* PTHREADS_USER */
|
||||
|
||||
@@ -9,19 +9,19 @@
|
||||
/*
|
||||
** Internal configuration macros
|
||||
*/
|
||||
#define PR_LINKER_ARCH "nto"
|
||||
#define _PR_SI_SYSNAME "NTO"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
#define PR_LINKER_ARCH "nto"
|
||||
#define _PR_SI_SYSNAME "NTO"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MINIMUM_STACK_SIZE 131072L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MINIMUM_STACK_SIZE 131072L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#endif
|
||||
|
||||
#undef _PR_POLL_AVAILABLE
|
||||
@@ -35,14 +35,14 @@
|
||||
#define _PR_HAVE_POSIX_SEMAPHORES
|
||||
|
||||
#undef FD_SETSIZE
|
||||
#define FD_SETSIZE 4096
|
||||
#define FD_SETSIZE 4096
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define NEED_TIME_R
|
||||
#define _PR_NEED_STRCASECMP
|
||||
@@ -55,39 +55,39 @@
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _SETJMP setjmp
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[7]
|
||||
#define _SETJMP setjmp
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[7]
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -122,7 +122,7 @@ struct _MDSegment {
|
||||
/*
|
||||
** md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
@@ -138,28 +138,28 @@ struct _MDCPU_Unix {
|
||||
#endif
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
@@ -168,20 +168,20 @@ struct _MDCPU {
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_INTERVAL_USE_GTOD
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/*
|
||||
** We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
** unwrapped version.
|
||||
*/
|
||||
#define _MD_SELECT select
|
||||
#define _MD_SELECT select
|
||||
|
||||
#define SA_RESTART 0
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#define PR_LINKER_ARCH "openbsd"
|
||||
#define PR_LINKER_ARCH "openbsd"
|
||||
#define _PR_SI_SYSNAME "OPENBSD"
|
||||
#if defined(__i386__)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
@@ -26,11 +26,11 @@
|
||||
#define _PR_SI_ARCHITECTURE "arm"
|
||||
#endif
|
||||
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
@@ -55,7 +55,7 @@
|
||||
#ifndef _PR_PTHREADS
|
||||
#include <setjmp.h>
|
||||
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
#endif
|
||||
#define _MD_GET_SP(_th) (_th)->md.context[JB_SP_INDEX]
|
||||
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
@@ -145,28 +145,28 @@ struct _MDCPU_Unix {
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
@@ -191,7 +191,7 @@ struct _MDCPU {
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _PR_HAVE_CLOCK_MONOTONIC
|
||||
|
||||
/*
|
||||
|
||||
@@ -48,24 +48,24 @@ extern struct PRLock *_pr_schedLock;
|
||||
typedef void (*FiberFunc)(void *);
|
||||
|
||||
#define PR_NUM_GCREGS 8
|
||||
typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
|
||||
typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
|
||||
#define GC_VMBASE 0x40000000
|
||||
#define GC_VMLIMIT 0x00FFFFFF
|
||||
typedef int (*FARPROC)();
|
||||
|
||||
#define _MD_MAGIC_THREAD 0x22222222
|
||||
#define _MD_MAGIC_THREADSTACK 0x33333333
|
||||
#define _MD_MAGIC_SEGMENT 0x44444444
|
||||
#define _MD_MAGIC_DIR 0x55555555
|
||||
#define _MD_MAGIC_THREAD 0x22222222
|
||||
#define _MD_MAGIC_THREADSTACK 0x33333333
|
||||
#define _MD_MAGIC_SEGMENT 0x44444444
|
||||
#define _MD_MAGIC_DIR 0x55555555
|
||||
#define _MD_MAGIC_CV 0x66666666
|
||||
|
||||
struct _MDSemaphore {
|
||||
HEV sem;
|
||||
HEV sem;
|
||||
};
|
||||
|
||||
struct _MDCPU {
|
||||
int unused;
|
||||
};
|
||||
};
|
||||
|
||||
struct _MDThread {
|
||||
HEV blocked_sema; /* Threads block on this when waiting
|
||||
@@ -154,7 +154,7 @@ struct _MDFileDesc {
|
||||
};
|
||||
|
||||
struct _MDProcess {
|
||||
PID pid;
|
||||
PID pid;
|
||||
};
|
||||
|
||||
/* --- Misc stuff --- */
|
||||
@@ -212,7 +212,7 @@ extern PRInt32 _MD_CloseFile(PRInt32 osfd);
|
||||
#define _MD_GET_SOCKET_ERROR() sock_errno()
|
||||
#ifndef INADDR_LOOPBACK /* For some reason this is not defined in OS2 tcpip */
|
||||
/* #define INADDR_LOOPBACK INADDR_ANY */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define _MD_INIT_FILEDESC(fd)
|
||||
extern void _MD_MakeNonblock(PRFileDesc *f);
|
||||
@@ -251,7 +251,7 @@ extern PRInt32 _MD_SocketAvailable(PRFileDesc *fd);
|
||||
#define _MD_PIPEAVAILABLE _MD_SocketAvailable
|
||||
#define _MD_CONNECT (_PR_MD_CONNECT)
|
||||
extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
|
||||
PRIntervalTime timeout);
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_ACCEPT _MD_Accept
|
||||
#define _MD_BIND (_PR_MD_BIND)
|
||||
#define _MD_RECV (_PR_MD_RECV)
|
||||
@@ -264,8 +264,8 @@ extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
|
||||
/* --- DIR stuff --- */
|
||||
#define PR_DIRECTORY_SEPARATOR '\\'
|
||||
#define PR_DIRECTORY_SEPARATOR_STR "\\"
|
||||
#define PR_PATH_SEPARATOR ';'
|
||||
#define PR_PATH_SEPARATOR_STR ";"
|
||||
#define PR_PATH_SEPARATOR ';'
|
||||
#define PR_PATH_SEPARATOR_STR ";"
|
||||
#define _MD_ERRNO() errno
|
||||
#define _MD_OPEN_DIR (_PR_MD_OPEN_DIR)
|
||||
#define _MD_CLOSE_DIR (_PR_MD_CLOSE_DIR)
|
||||
@@ -303,7 +303,7 @@ extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
|
||||
|
||||
/* --- Lock stuff --- */
|
||||
#define _PR_LOCK _MD_LOCK
|
||||
#define _PR_UNLOCK _MD_UNLOCK
|
||||
#define _PR_UNLOCK _MD_UNLOCK
|
||||
|
||||
#define _MD_NEW_LOCK (_PR_MD_NEW_LOCK)
|
||||
#define _MD_FREE_LOCK(lock) (DosCloseMutexSem((lock)->mutex))
|
||||
@@ -316,16 +316,16 @@ extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
|
||||
#define _MD_WAKEUP_WAITER (_PR_MD_WAKEUP_WAITER)
|
||||
|
||||
/* --- CVar ------------------- */
|
||||
#define _MD_WAIT_CV (_PR_MD_WAIT_CV)
|
||||
#define _MD_NEW_CV (_PR_MD_NEW_CV)
|
||||
#define _MD_FREE_CV (_PR_MD_FREE_CV)
|
||||
#define _MD_NOTIFY_CV (_PR_MD_NOTIFY_CV )
|
||||
#define _MD_NOTIFYALL_CV (_PR_MD_NOTIFYALL_CV)
|
||||
#define _MD_WAIT_CV (_PR_MD_WAIT_CV)
|
||||
#define _MD_NEW_CV (_PR_MD_NEW_CV)
|
||||
#define _MD_FREE_CV (_PR_MD_FREE_CV)
|
||||
#define _MD_NOTIFY_CV (_PR_MD_NOTIFY_CV )
|
||||
#define _MD_NOTIFYALL_CV (_PR_MD_NOTIFYALL_CV)
|
||||
|
||||
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
|
||||
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
|
||||
/* extern struct _MDLock _pr_ioq_lock; */
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
|
||||
/* --- Initialization stuff --- */
|
||||
@@ -357,8 +357,8 @@ extern PRStatus _PR_DetachOS2Process(struct PRProcess *process);
|
||||
|
||||
/* --- Wait for a child process to terminate --- */
|
||||
#define _MD_WAIT_PROCESS _PR_WaitOS2Process
|
||||
extern PRStatus _PR_WaitOS2Process(struct PRProcess *process,
|
||||
PRInt32 *exitCode);
|
||||
extern PRStatus _PR_WaitOS2Process(struct PRProcess *process,
|
||||
PRInt32 *exitCode);
|
||||
|
||||
#define _MD_KILL_PROCESS _PR_KillOS2Process
|
||||
extern PRStatus _PR_KillOS2Process(struct PRProcess *process);
|
||||
@@ -409,7 +409,7 @@ extern struct PRThread * _MD_CURRENT_THREAD(void);
|
||||
/* --- Scheduler stuff --- */
|
||||
#define LOCK_SCHEDULER() 0
|
||||
#define UNLOCK_SCHEDULER() 0
|
||||
#define _PR_LockSched() 0
|
||||
#define _PR_LockSched() 0
|
||||
#define _PR_UnlockSched() 0
|
||||
|
||||
/* --- Initialization stuff --- */
|
||||
@@ -434,7 +434,7 @@ extern PRInt32 _MD_GetMemMapAlignment(void);
|
||||
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
|
||||
|
||||
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
|
||||
PRUint32 len);
|
||||
PRUint32 len);
|
||||
#define _MD_MEM_MAP _MD_MemMap
|
||||
|
||||
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
|
||||
@@ -498,7 +498,7 @@ extern APIRET (* APIENTRY QueryThreadContext)(TID, ULONG, PCONTEXTRECORD);
|
||||
*/
|
||||
#define FreeLibrary(x) DosFreeModule((HMODULE)x)
|
||||
#define OutputDebugStringA(x)
|
||||
|
||||
|
||||
extern int _MD_os2_get_nonblocking_connect_error(int osfd);
|
||||
|
||||
#endif /* nspr_os2_defs_h___ */
|
||||
|
||||
@@ -8,119 +8,119 @@
|
||||
|
||||
#include "md/_os2.h"
|
||||
#ifndef assert
|
||||
#include <assert.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
NSPR_API(void) _MD_os2_map_default_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_DEFAULT_ERROR _MD_os2_map_default_error
|
||||
#define _PR_MD_MAP_DEFAULT_ERROR _MD_os2_map_default_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_opendir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_OPENDIR_ERROR _MD_os2_map_opendir_error
|
||||
#define _PR_MD_MAP_OPENDIR_ERROR _MD_os2_map_opendir_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_closedir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_CLOSEDIR_ERROR _MD_os2_map_closedir_error
|
||||
#define _PR_MD_MAP_CLOSEDIR_ERROR _MD_os2_map_closedir_error
|
||||
|
||||
NSPR_API(void) _MD_os2_readdir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_READDIR_ERROR _MD_os2_readdir_error
|
||||
#define _PR_MD_MAP_READDIR_ERROR _MD_os2_readdir_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_delete_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_DELETE_ERROR _MD_os2_map_delete_error
|
||||
#define _PR_MD_MAP_DELETE_ERROR _MD_os2_map_delete_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_stat_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_STAT_ERROR _MD_os2_map_stat_error
|
||||
#define _PR_MD_MAP_STAT_ERROR _MD_os2_map_stat_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_fstat_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_FSTAT_ERROR _MD_os2_map_fstat_error
|
||||
#define _PR_MD_MAP_FSTAT_ERROR _MD_os2_map_fstat_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_rename_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RENAME_ERROR _MD_os2_map_rename_error
|
||||
#define _PR_MD_MAP_RENAME_ERROR _MD_os2_map_rename_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_access_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_ACCESS_ERROR _MD_os2_map_access_error
|
||||
#define _PR_MD_MAP_ACCESS_ERROR _MD_os2_map_access_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_mkdir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_MKDIR_ERROR _MD_os2_map_mkdir_error
|
||||
#define _PR_MD_MAP_MKDIR_ERROR _MD_os2_map_mkdir_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_rmdir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RMDIR_ERROR _MD_os2_map_rmdir_error
|
||||
#define _PR_MD_MAP_RMDIR_ERROR _MD_os2_map_rmdir_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_read_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_READ_ERROR _MD_os2_map_read_error
|
||||
#define _PR_MD_MAP_READ_ERROR _MD_os2_map_read_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_transmitfile_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_TRANSMITFILE_ERROR _MD_os2_map_transmitfile_error
|
||||
#define _PR_MD_MAP_TRANSMITFILE_ERROR _MD_os2_map_transmitfile_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_write_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_WRITE_ERROR _MD_os2_map_write_error
|
||||
#define _PR_MD_MAP_WRITE_ERROR _MD_os2_map_write_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_lseek_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_LSEEK_ERROR _MD_os2_map_lseek_error
|
||||
#define _PR_MD_MAP_LSEEK_ERROR _MD_os2_map_lseek_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_fsync_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_FSYNC_ERROR _MD_os2_map_fsync_error
|
||||
#define _PR_MD_MAP_FSYNC_ERROR _MD_os2_map_fsync_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_close_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_CLOSE_ERROR _MD_os2_map_close_error
|
||||
#define _PR_MD_MAP_CLOSE_ERROR _MD_os2_map_close_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_socket_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SOCKET_ERROR _MD_os2_map_socket_error
|
||||
#define _PR_MD_MAP_SOCKET_ERROR _MD_os2_map_socket_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_recv_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RECV_ERROR _MD_os2_map_recv_error
|
||||
#define _PR_MD_MAP_RECV_ERROR _MD_os2_map_recv_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_recvfrom_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RECVFROM_ERROR _MD_os2_map_recvfrom_error
|
||||
#define _PR_MD_MAP_RECVFROM_ERROR _MD_os2_map_recvfrom_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_send_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SEND_ERROR _MD_os2_map_send_error
|
||||
#define _PR_MD_MAP_SEND_ERROR _MD_os2_map_send_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_sendto_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SENDTO_ERROR _MD_os2_map_sendto_error
|
||||
#define _PR_MD_MAP_SENDTO_ERROR _MD_os2_map_sendto_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_writev_error(int err);
|
||||
#define _PR_MD_MAP_WRITEV_ERROR _MD_os2_map_writev_error
|
||||
#define _PR_MD_MAP_WRITEV_ERROR _MD_os2_map_writev_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_accept_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_ACCEPT_ERROR _MD_os2_map_accept_error
|
||||
#define _PR_MD_MAP_ACCEPT_ERROR _MD_os2_map_accept_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_acceptex_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_ACCEPTEX_ERROR _MD_os2_map_acceptex_error
|
||||
#define _PR_MD_MAP_ACCEPTEX_ERROR _MD_os2_map_acceptex_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_connect_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_CONNECT_ERROR _MD_os2_map_connect_error
|
||||
#define _PR_MD_MAP_CONNECT_ERROR _MD_os2_map_connect_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_bind_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_BIND_ERROR _MD_os2_map_bind_error
|
||||
#define _PR_MD_MAP_BIND_ERROR _MD_os2_map_bind_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_listen_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_LISTEN_ERROR _MD_os2_map_listen_error
|
||||
#define _PR_MD_MAP_LISTEN_ERROR _MD_os2_map_listen_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_shutdown_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SHUTDOWN_ERROR _MD_os2_map_shutdown_error
|
||||
#define _PR_MD_MAP_SHUTDOWN_ERROR _MD_os2_map_shutdown_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_socketpair_error(int err);
|
||||
#define _PR_MD_MAP_SOCKETPAIR_ERROR _MD_os2_map_socketpair_error
|
||||
#define _PR_MD_MAP_SOCKETPAIR_ERROR _MD_os2_map_socketpair_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_getsockname_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETSOCKNAME_ERROR _MD_os2_map_getsockname_error
|
||||
#define _PR_MD_MAP_GETSOCKNAME_ERROR _MD_os2_map_getsockname_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_getpeername_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETPEERNAME_ERROR _MD_os2_map_getpeername_error
|
||||
#define _PR_MD_MAP_GETPEERNAME_ERROR _MD_os2_map_getpeername_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_getsockopt_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETSOCKOPT_ERROR _MD_os2_map_getsockopt_error
|
||||
#define _PR_MD_MAP_GETSOCKOPT_ERROR _MD_os2_map_getsockopt_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_setsockopt_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SETSOCKOPT_ERROR _MD_os2_map_setsockopt_error
|
||||
#define _PR_MD_MAP_SETSOCKOPT_ERROR _MD_os2_map_setsockopt_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_open_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_OPEN_ERROR _MD_os2_map_open_error
|
||||
#define _PR_MD_MAP_OPEN_ERROR _MD_os2_map_open_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_gethostname_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETHOSTNAME_ERROR _MD_os2_map_gethostname_error
|
||||
#define _PR_MD_MAP_GETHOSTNAME_ERROR _MD_os2_map_gethostname_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_select_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SELECT_ERROR _MD_os2_map_select_error
|
||||
#define _PR_MD_MAP_SELECT_ERROR _MD_os2_map_select_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_lockf_error(int err);
|
||||
#define _PR_MD_MAP_LOCKF_ERROR _MD_os2_map_lockf_error
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#ifndef nspr_cpucfg___
|
||||
#define nspr_cpucfg___
|
||||
|
||||
#ifndef XP_UNIX
|
||||
#define XP_UNIX
|
||||
#endif
|
||||
|
||||
#ifndef OSF1
|
||||
#define OSF1
|
||||
#endif
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
#ifndef HAVE_LONG_LONG
|
||||
#define HAVE_LONG_LONG
|
||||
#endif
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
#define HAVE_ALIGNED_LONGLONGS
|
||||
#ifndef IS_64
|
||||
#define IS_64
|
||||
#endif
|
||||
|
||||
#define PR_AF_INET6 26 /* same as AF_INET6 */
|
||||
|
||||
#define PR_BYTES_PER_BYTE 1
|
||||
#define PR_BYTES_PER_SHORT 2
|
||||
#define PR_BYTES_PER_INT 4
|
||||
#define PR_BYTES_PER_INT64 8
|
||||
#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 64
|
||||
#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 6
|
||||
#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_BYTES_PER_WORD_LOG2 3
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 8
|
||||
#define PR_ALIGN_OF_INT64 8
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_DOUBLE 8
|
||||
#define PR_ALIGN_OF_POINTER 8
|
||||
|
||||
#define _PR_POLL_BACKCOMPAT
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
|
||||
#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
|
||||
#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
|
||||
#define BYTES_PER_INT PR_BYTES_PER_INT
|
||||
#define BYTES_PER_INT64 PR_BYTES_PER_INT64
|
||||
#define BYTES_PER_LONG PR_BYTES_PER_LONG
|
||||
#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
|
||||
#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
|
||||
#define BYTES_PER_WORD PR_BYTES_PER_WORD
|
||||
#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
|
||||
|
||||
#define BITS_PER_BYTE PR_BITS_PER_BYTE
|
||||
#define BITS_PER_SHORT PR_BITS_PER_SHORT
|
||||
#define BITS_PER_INT PR_BITS_PER_INT
|
||||
#define BITS_PER_INT64 PR_BITS_PER_INT64
|
||||
#define BITS_PER_LONG PR_BITS_PER_LONG
|
||||
#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
|
||||
#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
|
||||
#define BITS_PER_WORD PR_BITS_PER_WORD
|
||||
|
||||
#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
|
||||
#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
|
||||
#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
|
||||
#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
|
||||
#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
|
||||
#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
|
||||
#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
|
||||
#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
|
||||
|
||||
#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
|
||||
#define ALIGN_OF_INT PR_ALIGN_OF_INT
|
||||
#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
|
||||
#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
|
||||
#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
|
||||
#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
|
||||
#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
|
||||
#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
|
||||
|
||||
#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
|
||||
#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
|
||||
#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
|
||||
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#endif /* nspr_cpucfg___ */
|
||||
@@ -1,222 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#ifndef nspr_osf1_defs_h___
|
||||
#define nspr_osf1_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "osf"
|
||||
#define _PR_SI_SYSNAME "OSF"
|
||||
#define _PR_SI_ARCHITECTURE "alpha"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 131072L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#undef HAVE_WEAK_IO_SYMBOLS
|
||||
#undef HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#define HAVE_BSD_FLOCK
|
||||
|
||||
#define NEED_TIME_R
|
||||
#define USE_DLFCN
|
||||
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
#define _PR_HAVE_LARGE_OFF_T
|
||||
#define _PR_HAVE_GETIPNODEBYNAME
|
||||
#define _PR_HAVE_GETIPNODEBYADDR
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#define _PR_INET6_PROBE
|
||||
#ifdef _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#else
|
||||
#define AF_INET6 26
|
||||
#ifndef AI_CANONNAME
|
||||
#define AI_CANONNAME 0x00000002
|
||||
struct addrinfo {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
size_t ai_addrlen;
|
||||
char *ai_canonname;
|
||||
struct sockaddr *ai_addr;
|
||||
struct addrinfo *ai_next;
|
||||
};
|
||||
#endif
|
||||
#define AI_V4MAPPED 0x00000010
|
||||
#define AI_ALL 0x00000008
|
||||
#define AI_ADDRCONFIG 0x00000020
|
||||
#endif
|
||||
#define _PR_HAVE_POSIX_SEMAPHORES
|
||||
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
/*
|
||||
* A jmp_buf is actually a struct sigcontext. The sc_sp field of
|
||||
* struct sigcontext is the stack pointer.
|
||||
*/
|
||||
#define _MD_GET_SP(_t) (((struct sigcontext *) (_t)->md.context)->sc_sp)
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (setjmp(CONTEXT(_thread))) { \
|
||||
(*_main)(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (long) ((_sp) - 64); \
|
||||
_MD_GET_SP(_thread) &= ~15; \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
longjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
jmp_buf context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#ifndef _PR_PTHREADS
|
||||
#define _MD_INIT_LOCKS()
|
||||
#endif
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
/*
|
||||
* The following are copied from _sunos.h, _aix.h. This means
|
||||
* some of them should probably be moved into _unixos.h. But
|
||||
* _irix.h seems to be quite different in regard to these macros.
|
||||
*/
|
||||
#define _MD_INTERVAL_USE_GTOD
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/* The following defines unwrapped versions of select() and poll(). */
|
||||
#include <sys/time.h>
|
||||
extern int __select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||
#define _MD_SELECT __select
|
||||
|
||||
#include <sys/poll.h>
|
||||
#define _MD_POLL __poll
|
||||
extern int __poll(struct pollfd filedes[], unsigned int nfds, int timeout);
|
||||
|
||||
/*
|
||||
* Atomic operations
|
||||
*/
|
||||
#ifdef OSF1_HAVE_MACHINE_BUILTINS_H
|
||||
#include <machine/builtins.h>
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_INCREMENT(val) (__ATOMIC_INCREMENT_LONG(val) + 1)
|
||||
#define _MD_ATOMIC_ADD(ptr, val) (__ATOMIC_ADD_LONG(ptr, val) + val)
|
||||
#define _MD_ATOMIC_DECREMENT(val) (__ATOMIC_DECREMENT_LONG(val) - 1)
|
||||
#define _MD_ATOMIC_SET(val, newval) __ATOMIC_EXCH_LONG(val, newval)
|
||||
#endif /* OSF1_HAVE_MACHINE_BUILTINS_H */
|
||||
|
||||
#endif /* nspr_osf1_defs_h___ */
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef prpcos_h___
|
||||
#define prpcos_h___
|
||||
|
||||
#define PR_DLL_SUFFIX ".dll"
|
||||
#define PR_DLL_SUFFIX ".dll"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -84,23 +84,23 @@
|
||||
* PR_EnterMonitor calls any of these functions, infinite
|
||||
* recursion ensues.
|
||||
*/
|
||||
#if defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \
|
||||
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||||
|| defined(HPUX) || defined(FREEBSD) \
|
||||
|| defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
|
||||
|| defined(NTO) || defined(DARWIN) \
|
||||
|| defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN)
|
||||
#if defined(AIX) || defined(SOLARIS) \
|
||||
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||||
|| defined(HPUX) || defined(FREEBSD) \
|
||||
|| defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
|
||||
|| defined(NTO) || defined(DARWIN) \
|
||||
|| defined(UNIXWARE) || defined(RISCOS)
|
||||
#define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t) (t) = 0
|
||||
#define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) (t) == 0
|
||||
#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st)
|
||||
#else
|
||||
#else
|
||||
#error "pthreads is not supported for this architecture"
|
||||
#endif
|
||||
|
||||
#if defined(_PR_PTHREADS)
|
||||
#define _PT_PTHREAD_ATTR_INIT pthread_attr_init
|
||||
#define _PT_PTHREAD_ATTR_DESTROY pthread_attr_destroy
|
||||
#define _PT_PTHREAD_CREATE(t, a, f, r) pthread_create(t, &a, f, r)
|
||||
#define _PT_PTHREAD_CREATE(t, a, f, r) pthread_create(t, &a, f, r)
|
||||
#define _PT_PTHREAD_KEY_CREATE pthread_key_create
|
||||
#define _PT_PTHREAD_ATTR_SETSCHEDPOLICY pthread_attr_setschedpolicy
|
||||
#define _PT_PTHREAD_ATTR_GETSTACKSIZE(a, s) pthread_attr_getstacksize(a, s)
|
||||
@@ -113,21 +113,14 @@
|
||||
* These platforms don't have sigtimedwait()
|
||||
*/
|
||||
#if (defined(AIX) && !defined(AIX4_3_PLUS)) \
|
||||
|| defined(LINUX) || defined(__GNU__)|| defined(__GLIBC__) \
|
||||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||||
|| defined(BSDI) || defined(UNIXWARE) \
|
||||
|| defined(DARWIN) || defined(SYMBIAN)
|
||||
|| defined(LINUX) || defined(__GNU__)|| defined(__GLIBC__) \
|
||||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||||
|| defined(BSDI) || defined(UNIXWARE) \
|
||||
|| defined(DARWIN)
|
||||
#define PT_NO_SIGTIMEDWAIT
|
||||
#endif
|
||||
|
||||
#if defined(OSF1)
|
||||
#define PT_PRIO_MIN PRI_OTHER_MIN
|
||||
#define PT_PRIO_MAX PRI_OTHER_MAX
|
||||
#elif defined(IRIX)
|
||||
#include <sys/sched.h>
|
||||
#define PT_PRIO_MIN PX_PRIO_MIN
|
||||
#define PT_PRIO_MAX PX_PRIO_MAX
|
||||
#elif defined(AIX)
|
||||
#if defined(AIX)
|
||||
#include <sys/priv.h>
|
||||
#include <sys/sched.h>
|
||||
#ifndef PTHREAD_CREATE_JOINABLE
|
||||
@@ -140,7 +133,7 @@
|
||||
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
|
||||
#define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER)
|
||||
#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||||
|| defined(FREEBSD) || defined(SYMBIAN)
|
||||
|| defined(FREEBSD)
|
||||
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
|
||||
#define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER)
|
||||
#elif defined(NTO)
|
||||
@@ -164,8 +157,8 @@
|
||||
#define PT_PRIO_MIN 0
|
||||
#define PT_PRIO_MAX 31
|
||||
#elif defined(NETBSD) \
|
||||
|| defined(BSDI) || defined(DARWIN) || defined(UNIXWARE) \
|
||||
|| defined(RISCOS) /* XXX */
|
||||
|| defined(BSDI) || defined(DARWIN) || defined(UNIXWARE) \
|
||||
|| defined(RISCOS) /* XXX */
|
||||
#define PT_PRIO_MIN 0
|
||||
#define PT_PRIO_MAX 126
|
||||
#else
|
||||
@@ -177,29 +170,15 @@
|
||||
* Needed for garbage collection -- Look at PR_Suspend/PR_Resume
|
||||
* implementation.
|
||||
*/
|
||||
#if defined(OSF1)
|
||||
/*
|
||||
* sched_yield can't be called from a signal handler. Must use
|
||||
* the _np version.
|
||||
*/
|
||||
#define _PT_PTHREAD_YIELD() pthread_yield_np()
|
||||
#elif defined(AIX)
|
||||
#if defined(AIX)
|
||||
extern int (*_PT_aix_yield_fcn)();
|
||||
#define _PT_PTHREAD_YIELD() (*_PT_aix_yield_fcn)()
|
||||
#elif defined(IRIX)
|
||||
#include <time.h>
|
||||
#define _PT_PTHREAD_YIELD() \
|
||||
PR_BEGIN_MACRO \
|
||||
struct timespec onemillisec = {0}; \
|
||||
onemillisec.tv_nsec = 1000000L; \
|
||||
nanosleep(&onemillisec,NULL); \
|
||||
PR_END_MACRO
|
||||
#define _PT_PTHREAD_YIELD() (*_PT_aix_yield_fcn)()
|
||||
#elif defined(HPUX) || defined(SOLARIS) \
|
||||
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||||
|| defined(BSDI) || defined(NTO) || defined(DARWIN) \
|
||||
|| defined(UNIXWARE) || defined(RISCOS) || defined(SYMBIAN)
|
||||
#define _PT_PTHREAD_YIELD() sched_yield()
|
||||
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|
||||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||||
|| defined(BSDI) || defined(NTO) || defined(DARWIN) \
|
||||
|| defined(UNIXWARE) || defined(RISCOS)
|
||||
#define _PT_PTHREAD_YIELD() sched_yield()
|
||||
#else
|
||||
#error "Need to define _PT_PTHREAD_YIELD for this platform"
|
||||
#endif
|
||||
|
||||
@@ -9,18 +9,18 @@
|
||||
/*
|
||||
** Internal configuration macros
|
||||
*/
|
||||
#define PR_LINKER_ARCH "qnx"
|
||||
#define _PR_SI_SYSNAME "QNX"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
#define PR_LINKER_ARCH "qnx"
|
||||
#define _PR_SI_SYSNAME "QNX"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#endif
|
||||
|
||||
#undef _PR_POLL_AVAILABLE
|
||||
@@ -33,8 +33,8 @@
|
||||
#include <sys/select.h>
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#undef HAVE_DLL
|
||||
#undef USE_DLFCN
|
||||
#undef HAVE_DLL
|
||||
#undef USE_DLFCN
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define NEED_TIME_R
|
||||
#define _PR_NEED_STRCASECMP
|
||||
@@ -47,38 +47,38 @@
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _SETJMP setjmp
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[7]
|
||||
#define _SETJMP setjmp
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[7]
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -113,7 +113,7 @@ struct _MDSegment {
|
||||
/*
|
||||
** md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
@@ -129,28 +129,28 @@ struct _MDCPU_Unix {
|
||||
#endif
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
@@ -159,13 +159,13 @@ struct _MDCPU {
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_INTERVAL_USE_GTOD
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/*
|
||||
@@ -175,7 +175,7 @@ struct _MDCPU {
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
#define _MD_SELECT select
|
||||
#define _MD_SELECT select
|
||||
|
||||
#define SA_RESTART 0
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
/*
|
||||
** Internal configuration macros
|
||||
*/
|
||||
#define PR_LINKER_ARCH "riscos"
|
||||
#define _PR_SI_SYSNAME "RISCOS"
|
||||
#define _PR_SI_ARCHITECTURE "arm"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
#define PR_LINKER_ARCH "riscos"
|
||||
#define _PR_SI_SYSNAME "RISCOS"
|
||||
#define _PR_SI_ARCHITECTURE "arm"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
@@ -42,39 +42,39 @@
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _SETJMP setjmp
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[7]
|
||||
#define _SETJMP setjmp
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[7]
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -109,7 +109,7 @@ struct _MDSegment {
|
||||
/*
|
||||
** md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
@@ -125,28 +125,28 @@ struct _MDCPU_Unix {
|
||||
#endif
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) /* */ ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_IOQ(_cpu) /* */ ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
@@ -155,13 +155,13 @@ struct _MDCPU {
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_INTERVAL_USE_GTOD
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/*
|
||||
@@ -171,6 +171,6 @@ struct _MDCPU {
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
#define _MD_SELECT select
|
||||
#define _MD_SELECT select
|
||||
|
||||
#endif /* nspr_riscos_defs_h___ */
|
||||
|
||||
@@ -10,26 +10,26 @@
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "scoos5"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
#define PR_LINKER_ARCH "scoos5"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_SI_SYSNAME "SCO"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
|
||||
#if !defined (HAVE_STRERROR)
|
||||
#define HAVE_STRERROR
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#endif
|
||||
|
||||
#define _PR_POLL_AVAILABLE
|
||||
@@ -47,34 +47,34 @@
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _MD_GET_SP(_t) (_t)->md.jb[4]
|
||||
#define PR_NUM_GCREGS _SIGJBLEN
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
#define PR_NUM_GCREGS _SIGJBLEN
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.jb)
|
||||
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (sigsetjmp(CONTEXT(_thread),1)) { \
|
||||
(*_main)(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 64); \
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (sigsetjmp(CONTEXT(_thread),1)) { \
|
||||
(*_main)(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 64); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!sigsetjmp(CONTEXT(_thread), 1)) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!sigsetjmp(CONTEXT(_thread), 1)) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->osErrorCode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
siglongjmp(CONTEXT(_thread), 1); \
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->osErrorCode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
siglongjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
#endif /* _PR_LOCAL_THREADS_ONLY */
|
||||
@@ -118,28 +118,28 @@ struct _MDCPU_Unix {
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
@@ -154,18 +154,18 @@ struct _MDCPU {
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
#define _MD_INTERVAL_USE_GTOD
|
||||
|
||||
#define _MD_SELECT _select
|
||||
#define _MD_POLL _poll
|
||||
#define _MD_SELECT _select
|
||||
#define _MD_POLL _poll
|
||||
|
||||
#endif /* nspr_scoos5_defs_h___ */
|
||||
|
||||
+151
-151
@@ -10,33 +10,33 @@
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "solaris"
|
||||
#define _PR_SI_SYSNAME "SOLARIS"
|
||||
#define PR_LINKER_ARCH "solaris"
|
||||
#define _PR_SI_SYSNAME "SOLARIS"
|
||||
#ifdef sparc
|
||||
#define _PR_SI_ARCHITECTURE "sparc"
|
||||
#define _PR_SI_ARCHITECTURE "sparc"
|
||||
#elif defined(__x86_64)
|
||||
#define _PR_SI_ARCHITECTURE "x86-64"
|
||||
#define _PR_SI_ARCHITECTURE "x86-64"
|
||||
#elif defined(i386)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#else
|
||||
#error unknown processor
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE (2*65536L)
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE (2*65536L)
|
||||
#define _MD_MMAP_FLAGS MAP_SHARED
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#endif
|
||||
|
||||
#undef HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#undef HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define NEED_STRFTIME_LOCK
|
||||
|
||||
/*
|
||||
@@ -82,7 +82,7 @@ struct addrinfo {
|
||||
struct addrinfo *ai_next;
|
||||
};
|
||||
#define AI_CANONNAME 0x0010
|
||||
#define AI_V4MAPPED 0x0001
|
||||
#define AI_V4MAPPED 0x0001
|
||||
#define AI_ALL 0x0002
|
||||
#define AI_ADDRCONFIG 0x0004
|
||||
#define _PR_HAVE_MD_SOCKADDR_IN6
|
||||
@@ -137,10 +137,10 @@ NSPR_API(PRInt32) _MD_AtomicSet(PRInt32 *val, PRInt32 newval);
|
||||
|
||||
#if defined(_PR_PTHREADS)
|
||||
|
||||
NSPR_API(void) _MD_EarlyInit(void);
|
||||
NSPR_API(void) _MD_EarlyInit(void);
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
|
||||
#else /* _PR_PTHREADS */
|
||||
|
||||
@@ -159,51 +159,51 @@ NSPR_API(void) _MD_EarlyInit(void);
|
||||
** Initialization Related definitions
|
||||
*/
|
||||
|
||||
NSPR_API(void) _MD_EarlyInit(void);
|
||||
NSPR_API(void) _MD_SolarisInit();
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _MD_SolarisInit
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
NSPR_API(void) _MD_EarlyInit(void);
|
||||
NSPR_API(void) _MD_SolarisInit();
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _MD_SolarisInit
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
|
||||
#ifdef USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
|
||||
#ifdef sparc
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[2]
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[2]
|
||||
#else
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[4]
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[4]
|
||||
#endif
|
||||
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define CONTEXT(_thread) (_thread)->md.context
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define CONTEXT(_thread) (_thread)->md.context
|
||||
|
||||
#else /* ! USE_SETJMP */
|
||||
|
||||
#ifdef sparc
|
||||
#define _PR_CONTEXT_TYPE ucontext_t
|
||||
#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[REG_SP]
|
||||
#define _PR_CONTEXT_TYPE ucontext_t
|
||||
#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[REG_SP]
|
||||
/*
|
||||
** Sparc's use register windows. the _MD_GetRegisters for the sparc's
|
||||
** doesn't actually store anything into the argument buffer; instead the
|
||||
** register windows are homed to the stack. I assume that the stack
|
||||
** always has room for the registers to spill to...
|
||||
*/
|
||||
#define PR_NUM_GCREGS 0
|
||||
#define PR_NUM_GCREGS 0
|
||||
#else
|
||||
#define _PR_CONTEXT_TYPE unsigned int edi; sigset_t oldMask, blockMask; ucontext_t
|
||||
#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[USP]
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define _PR_CONTEXT_TYPE unsigned int edi; sigset_t oldMask, blockMask; ucontext_t
|
||||
#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[USP]
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#endif
|
||||
|
||||
#define CONTEXT(_thread) (&(_thread)->md.context)
|
||||
#define CONTEXT(_thread) (&(_thread)->md.context)
|
||||
|
||||
#endif /* ! USE_SETJMP */
|
||||
|
||||
#include <time.h>
|
||||
/*
|
||||
/*
|
||||
* Because clock_gettime() on Solaris/x86 always generates a
|
||||
* segmentation fault, we use an emulated version _pr_solx86_clock_gettime(),
|
||||
* which is implemented using gettimeofday().
|
||||
@@ -214,35 +214,35 @@ NSPR_API(void) _MD_SolarisInit();
|
||||
#define GETTIME(tt) clock_gettime(CLOCK_REALTIME, (tt))
|
||||
#endif /* i386 */
|
||||
|
||||
#define _MD_SAVE_ERRNO(_thread) (_thread)->md.errcode = errno;
|
||||
#define _MD_RESTORE_ERRNO(_thread) errno = (_thread)->md.errcode;
|
||||
#define _MD_SAVE_ERRNO(_thread) (_thread)->md.errcode = errno;
|
||||
#define _MD_RESTORE_ERRNO(_thread) errno = (_thread)->md.errcode;
|
||||
|
||||
#ifdef sparc
|
||||
|
||||
#ifdef USE_SETJMP
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
int *context = (_thread)->md.context; \
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
int *context = (_thread)->md.context; \
|
||||
*status = PR_TRUE; \
|
||||
(void) setjmp(context); \
|
||||
(_thread)->md.context[1] = (int) ((_sp) - 64); \
|
||||
(_thread)->md.context[2] = (int) _main; \
|
||||
(_thread)->md.context[3] = (int) _main + 4; \
|
||||
(void) setjmp(context); \
|
||||
(_thread)->md.context[1] = (int) ((_sp) - 64); \
|
||||
(_thread)->md.context[2] = (int) _main; \
|
||||
(_thread)->md.context[3] = (int) _main + 4; \
|
||||
_thread->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
_MD_SAVE_ERRNO(_thread) \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
_MD_SAVE_ERRNO(_thread) \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
#define _MD_RESTORE_CONTEXT(_newThread) \
|
||||
{ \
|
||||
_MD_RESTORE_ERRNO(_newThread) \
|
||||
_MD_SET_CURRENT_THREAD(_newThread); \
|
||||
#define _MD_RESTORE_CONTEXT(_newThread) \
|
||||
{ \
|
||||
_MD_RESTORE_ERRNO(_newThread) \
|
||||
_MD_SET_CURRENT_THREAD(_newThread); \
|
||||
longjmp(CONTEXT(_newThread), 1); \
|
||||
}
|
||||
|
||||
@@ -250,19 +250,19 @@ NSPR_API(void) _MD_SolarisInit();
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_thread); \
|
||||
*status = PR_TRUE; \
|
||||
getcontext(uc); \
|
||||
uc->uc_stack.ss_sp = (char *) ((unsigned long)(_sp - WINDOWSIZE - SA(MINFRAME)) & 0xfffffff8); \
|
||||
uc->uc_stack.ss_size = _thread->stack->stackSize; \
|
||||
uc->uc_stack.ss_flags = 0; /* ? */ \
|
||||
uc->uc_mcontext.gregs[REG_SP] = (unsigned int) uc->uc_stack.ss_sp; \
|
||||
uc->uc_mcontext.gregs[REG_PC] = (unsigned int) _main; \
|
||||
uc->uc_mcontext.gregs[REG_nPC] = (unsigned int) ((char*)_main)+4; \
|
||||
uc->uc_flags = UC_ALL; \
|
||||
_thread->no_sched = 0; \
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_thread); \
|
||||
*status = PR_TRUE; \
|
||||
getcontext(uc); \
|
||||
uc->uc_stack.ss_sp = (char *) ((unsigned long)(_sp - WINDOWSIZE - SA(MINFRAME)) & 0xfffffff8); \
|
||||
uc->uc_stack.ss_size = _thread->stack->stackSize; \
|
||||
uc->uc_stack.ss_flags = 0; /* ? */ \
|
||||
uc->uc_mcontext.gregs[REG_SP] = (unsigned int) uc->uc_stack.ss_sp; \
|
||||
uc->uc_mcontext.gregs[REG_PC] = (unsigned int) _main; \
|
||||
uc->uc_mcontext.gregs[REG_nPC] = (unsigned int) ((char*)_main)+4; \
|
||||
uc->uc_flags = UC_ALL; \
|
||||
_thread->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
@@ -270,26 +270,26 @@ NSPR_API(void) _MD_SolarisInit();
|
||||
** calling the thread scheduler. Reload cpu when we come back from the
|
||||
** context switch because it might have changed.
|
||||
*/
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (!getcontext(CONTEXT(_thread))) { \
|
||||
_MD_SAVE_ERRNO(_thread); \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
} \
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (!getcontext(CONTEXT(_thread))) { \
|
||||
_MD_SAVE_ERRNO(_thread); \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Restore a thread context that was saved by _MD_SWITCH_CONTEXT or
|
||||
** initialized by _MD_INIT_CONTEXT.
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_newThread) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_newThread); \
|
||||
uc->uc_mcontext.gregs[11] = 1; \
|
||||
_MD_RESTORE_ERRNO(_newThread); \
|
||||
_MD_SET_CURRENT_THREAD(_newThread); \
|
||||
setcontext(uc); \
|
||||
#define _MD_RESTORE_CONTEXT(_newThread) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_newThread); \
|
||||
uc->uc_mcontext.gregs[11] = 1; \
|
||||
_MD_RESTORE_ERRNO(_newThread); \
|
||||
_MD_SET_CURRENT_THREAD(_newThread); \
|
||||
setcontext(uc); \
|
||||
PR_END_MACRO
|
||||
#endif
|
||||
|
||||
@@ -307,7 +307,7 @@ NSPR_API(void) _MD_SolarisInit();
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
_MD_SAVE_ERRNO(_thread) \
|
||||
_PR_Schedule(); \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
#define _MD_RESTORE_CONTEXT(_newThread) \
|
||||
@@ -319,71 +319,71 @@ NSPR_API(void) _MD_SolarisInit();
|
||||
|
||||
#else /* USE_SETJMP */
|
||||
|
||||
#define WINDOWSIZE 0
|
||||
|
||||
#define WINDOWSIZE 0
|
||||
|
||||
int getedi(void);
|
||||
void setedi(int);
|
||||
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_thread); \
|
||||
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_thread); \
|
||||
*status = PR_TRUE; \
|
||||
getcontext(uc); \
|
||||
/* Force sp to be double aligned! */ \
|
||||
uc->uc_mcontext.gregs[USP] = (int) ((unsigned long)(_sp - WINDOWSIZE - SA(MINFRAME)) & 0xfffffff8); \
|
||||
uc->uc_mcontext.gregs[PC] = (int) _main; \
|
||||
(_thread)->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
getcontext(uc); \
|
||||
/* Force sp to be double aligned! */ \
|
||||
uc->uc_mcontext.gregs[USP] = (int) ((unsigned long)(_sp - WINDOWSIZE - SA(MINFRAME)) & 0xfffffff8); \
|
||||
uc->uc_mcontext.gregs[PC] = (int) _main; \
|
||||
(_thread)->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
|
||||
/* getcontext() may return 1, contrary to what the man page says */
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_thread); \
|
||||
PR_ASSERT(_thread->no_sched); \
|
||||
sigfillset(&((_thread)->md.blockMask)); \
|
||||
sigprocmask(SIG_BLOCK, &((_thread)->md.blockMask), \
|
||||
&((_thread)->md.oldMask)); \
|
||||
(_thread)->md.edi = getedi(); \
|
||||
if (! getcontext(uc)) { \
|
||||
sigprocmask(SIG_SETMASK, &((_thread)->md.oldMask), NULL); \
|
||||
uc->uc_mcontext.gregs[EDI] = (_thread)->md.edi; \
|
||||
_MD_SAVE_ERRNO(_thread) \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
} else { \
|
||||
sigprocmask(SIG_SETMASK, &((_thread)->md.oldMask), NULL); \
|
||||
setedi((_thread)->md.edi); \
|
||||
PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \
|
||||
_MD_LAST_THREAD()->no_sched = 0; \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_thread); \
|
||||
PR_ASSERT(_thread->no_sched); \
|
||||
sigfillset(&((_thread)->md.blockMask)); \
|
||||
sigprocmask(SIG_BLOCK, &((_thread)->md.blockMask), \
|
||||
&((_thread)->md.oldMask)); \
|
||||
(_thread)->md.edi = getedi(); \
|
||||
if (! getcontext(uc)) { \
|
||||
sigprocmask(SIG_SETMASK, &((_thread)->md.oldMask), NULL); \
|
||||
uc->uc_mcontext.gregs[EDI] = (_thread)->md.edi; \
|
||||
_MD_SAVE_ERRNO(_thread) \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
} else { \
|
||||
sigprocmask(SIG_SETMASK, &((_thread)->md.oldMask), NULL); \
|
||||
setedi((_thread)->md.edi); \
|
||||
PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \
|
||||
_MD_LAST_THREAD()->no_sched = 0; \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _PR_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_newthread) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_newthread); \
|
||||
uc->uc_mcontext.gregs[EAX] = 1; \
|
||||
_MD_RESTORE_ERRNO(_newthread) \
|
||||
_MD_SET_CURRENT_THREAD(_newthread); \
|
||||
(_newthread)->no_sched = 1; \
|
||||
setcontext(uc); \
|
||||
PR_END_MACRO
|
||||
#define _MD_RESTORE_CONTEXT(_newthread) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_newthread); \
|
||||
uc->uc_mcontext.gregs[EAX] = 1; \
|
||||
_MD_RESTORE_ERRNO(_newthread) \
|
||||
_MD_SET_CURRENT_THREAD(_newthread); \
|
||||
(_newthread)->no_sched = 1; \
|
||||
setcontext(uc); \
|
||||
PR_END_MACRO
|
||||
#endif /* USE_SETJMP */
|
||||
|
||||
#endif /* sparc */
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDThread {
|
||||
@@ -413,35 +413,35 @@ struct _MDCPU_Unix {
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
@@ -449,8 +449,8 @@ struct _MDCPU {
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
@@ -461,15 +461,15 @@ extern PRStatus _MD_WAKEUP_WAITER(struct PRThread *);
|
||||
extern void _MD_YIELD(void);
|
||||
extern PRStatus _MD_InitializeThread(PRThread *thread);
|
||||
extern void _MD_SET_PRIORITY(struct _MDThread *thread,
|
||||
PRThreadPriority newPri);
|
||||
PRThreadPriority newPri);
|
||||
extern PRStatus _MD_CREATE_THREAD(PRThread *thread, void (*start) (void *),
|
||||
PRThreadPriority priority, PRThreadScope scope, PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
PRThreadPriority priority, PRThreadScope scope, PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
|
||||
/* The following defines the unwrapped versions of select() and poll(). */
|
||||
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout);
|
||||
#define _MD_SELECT _select
|
||||
fd_set *exceptfds, struct timeval *timeout);
|
||||
#define _MD_SELECT _select
|
||||
|
||||
#include <stropts.h>
|
||||
#include <poll.h>
|
||||
|
||||
@@ -1,170 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#ifndef nspr_cpucfg___
|
||||
#define nspr_cpucfg___
|
||||
|
||||
#ifndef XP_UNIX
|
||||
#define XP_UNIX
|
||||
#endif
|
||||
|
||||
#ifndef SYMBIAN
|
||||
#define SYMBIAN
|
||||
#endif
|
||||
|
||||
#define PR_AF_INET6 0x0806 /* same as AF_INET6 */
|
||||
|
||||
#ifdef __arm__
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
|
||||
#define PR_BYTES_PER_BYTE 1
|
||||
#define PR_BYTES_PER_SHORT 2
|
||||
#define PR_BYTES_PER_INT 4
|
||||
#define PR_BYTES_PER_INT64 8
|
||||
#define PR_BYTES_PER_LONG 4
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 4
|
||||
#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 64
|
||||
#define PR_BITS_PER_LONG 32
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 32
|
||||
|
||||
#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 6
|
||||
#define PR_BITS_PER_LONG_LOG2 5
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 5
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
#define PR_ALIGN_OF_WORD 4
|
||||
#define PR_ALIGN_OF_INT64 8
|
||||
#define PR_ALIGN_OF_DOUBLE 8
|
||||
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#elif defined(__WINS__)
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
|
||||
#define PR_BYTES_PER_BYTE 1
|
||||
#define PR_BYTES_PER_SHORT 2
|
||||
#define PR_BYTES_PER_INT 4
|
||||
#define PR_BYTES_PER_INT64 8
|
||||
#define PR_BYTES_PER_LONG 4
|
||||
#define PR_BYTES_PER_FLOAT 4
|
||||
#define PR_BYTES_PER_DOUBLE 8
|
||||
#define PR_BYTES_PER_WORD 4
|
||||
#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 64
|
||||
#define PR_BITS_PER_LONG 32
|
||||
#define PR_BITS_PER_FLOAT 32
|
||||
#define PR_BITS_PER_DOUBLE 64
|
||||
#define PR_BITS_PER_WORD 32
|
||||
|
||||
#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 6
|
||||
#define PR_BITS_PER_LONG_LOG2 5
|
||||
#define PR_BITS_PER_FLOAT_LOG2 5
|
||||
#define PR_BITS_PER_DOUBLE_LOG2 6
|
||||
#define PR_BITS_PER_WORD_LOG2 5
|
||||
|
||||
#define PR_ALIGN_OF_SHORT 2
|
||||
#define PR_ALIGN_OF_INT 4
|
||||
#define PR_ALIGN_OF_LONG 4
|
||||
#define PR_ALIGN_OF_FLOAT 4
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
#define PR_ALIGN_OF_WORD 4
|
||||
#define PR_ALIGN_OF_INT64 4
|
||||
#define PR_ALIGN_OF_DOUBLE 4
|
||||
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
#else
|
||||
|
||||
#error "Unknown CPU architecture"
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_LONG_LONG
|
||||
#define HAVE_LONG_LONG
|
||||
#endif
|
||||
#if PR_ALIGN_OF_DOUBLE == 8
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
#endif
|
||||
#if PR_ALIGN_OF_INT64 == 8
|
||||
#define HAVE_ALIGNED_LONGLONGS
|
||||
#endif
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
|
||||
#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
|
||||
#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
|
||||
#define BYTES_PER_INT PR_BYTES_PER_INT
|
||||
#define BYTES_PER_INT64 PR_BYTES_PER_INT64
|
||||
#define BYTES_PER_LONG PR_BYTES_PER_LONG
|
||||
#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
|
||||
#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
|
||||
#define BYTES_PER_WORD PR_BYTES_PER_WORD
|
||||
#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
|
||||
|
||||
#define BITS_PER_BYTE PR_BITS_PER_BYTE
|
||||
#define BITS_PER_SHORT PR_BITS_PER_SHORT
|
||||
#define BITS_PER_INT PR_BITS_PER_INT
|
||||
#define BITS_PER_INT64 PR_BITS_PER_INT64
|
||||
#define BITS_PER_LONG PR_BITS_PER_LONG
|
||||
#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
|
||||
#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
|
||||
#define BITS_PER_WORD PR_BITS_PER_WORD
|
||||
|
||||
#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
|
||||
#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
|
||||
#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
|
||||
#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
|
||||
#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
|
||||
#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
|
||||
#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
|
||||
#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
|
||||
|
||||
#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
|
||||
#define ALIGN_OF_INT PR_ALIGN_OF_INT
|
||||
#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
|
||||
#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
|
||||
#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
|
||||
#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
|
||||
#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
|
||||
#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
|
||||
|
||||
#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
|
||||
#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
|
||||
#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
|
||||
|
||||
#endif /* NO_NSPR_10_SUPPORT */
|
||||
|
||||
#endif /* nspr_cpucfg___ */
|
||||
@@ -1,50 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* 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/. */
|
||||
|
||||
#ifndef nspr_symbian_defs_h___
|
||||
#define nspr_symbian_defs_h___
|
||||
|
||||
#include "prthread.h"
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define _PR_SI_SYSNAME "SYMBIAN"
|
||||
#if defined(__WINS__)
|
||||
#define _PR_SI_ARCHITECTURE "i386"
|
||||
#elif defined(__arm__)
|
||||
#define _PR_SI_ARCHITECTURE "arm"
|
||||
#else
|
||||
#error "Unknown CPU architecture"
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".dll"
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
|
||||
#ifdef DYNAMIC_LIBRARY
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#endif
|
||||
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define _PR_HAVE_SYSV_SEMAPHORES
|
||||
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
|
||||
|
||||
#ifndef _PR_PTHREADS
|
||||
#error "Classic NSPR is not implemented"
|
||||
#endif
|
||||
|
||||
extern void _MD_EarlyInit(void);
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INTERVAL_USE_GTOD
|
||||
|
||||
/* For writev() */
|
||||
#include <sys/uio.h>
|
||||
|
||||
#endif /* nspr_symbian_defs_h___ */
|
||||
@@ -12,115 +12,115 @@
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
extern void _MD_unix_map_default_error(int err);
|
||||
#define _PR_MD_MAP_DEFAULT_ERROR _MD_unix_map_default_error
|
||||
#define _PR_MD_MAP_DEFAULT_ERROR _MD_unix_map_default_error
|
||||
|
||||
extern void _MD_unix_map_opendir_error(int err);
|
||||
#define _PR_MD_MAP_OPENDIR_ERROR _MD_unix_map_opendir_error
|
||||
#define _PR_MD_MAP_OPENDIR_ERROR _MD_unix_map_opendir_error
|
||||
|
||||
extern void _MD_unix_map_closedir_error(int err);
|
||||
#define _PR_MD_MAP_CLOSEDIR_ERROR _MD_unix_map_closedir_error
|
||||
#define _PR_MD_MAP_CLOSEDIR_ERROR _MD_unix_map_closedir_error
|
||||
|
||||
extern void _MD_unix_readdir_error(int err);
|
||||
#define _PR_MD_MAP_READDIR_ERROR _MD_unix_readdir_error
|
||||
#define _PR_MD_MAP_READDIR_ERROR _MD_unix_readdir_error
|
||||
|
||||
extern void _MD_unix_map_unlink_error(int err);
|
||||
#define _PR_MD_MAP_UNLINK_ERROR _MD_unix_map_unlink_error
|
||||
#define _PR_MD_MAP_UNLINK_ERROR _MD_unix_map_unlink_error
|
||||
|
||||
extern void _MD_unix_map_stat_error(int err);
|
||||
#define _PR_MD_MAP_STAT_ERROR _MD_unix_map_stat_error
|
||||
#define _PR_MD_MAP_STAT_ERROR _MD_unix_map_stat_error
|
||||
|
||||
extern void _MD_unix_map_fstat_error(int err);
|
||||
#define _PR_MD_MAP_FSTAT_ERROR _MD_unix_map_fstat_error
|
||||
#define _PR_MD_MAP_FSTAT_ERROR _MD_unix_map_fstat_error
|
||||
|
||||
extern void _MD_unix_map_rename_error(int err);
|
||||
#define _PR_MD_MAP_RENAME_ERROR _MD_unix_map_rename_error
|
||||
#define _PR_MD_MAP_RENAME_ERROR _MD_unix_map_rename_error
|
||||
|
||||
extern void _MD_unix_map_access_error(int err);
|
||||
#define _PR_MD_MAP_ACCESS_ERROR _MD_unix_map_access_error
|
||||
#define _PR_MD_MAP_ACCESS_ERROR _MD_unix_map_access_error
|
||||
|
||||
extern void _MD_unix_map_mkdir_error(int err);
|
||||
#define _PR_MD_MAP_MKDIR_ERROR _MD_unix_map_mkdir_error
|
||||
#define _PR_MD_MAP_MKDIR_ERROR _MD_unix_map_mkdir_error
|
||||
|
||||
extern void _MD_unix_map_rmdir_error(int err);
|
||||
#define _PR_MD_MAP_RMDIR_ERROR _MD_unix_map_rmdir_error
|
||||
#define _PR_MD_MAP_RMDIR_ERROR _MD_unix_map_rmdir_error
|
||||
|
||||
extern void _MD_unix_map_read_error(int err);
|
||||
#define _PR_MD_MAP_READ_ERROR _MD_unix_map_read_error
|
||||
#define _PR_MD_MAP_READ_ERROR _MD_unix_map_read_error
|
||||
|
||||
extern void _MD_unix_map_write_error(int err);
|
||||
#define _PR_MD_MAP_WRITE_ERROR _MD_unix_map_write_error
|
||||
#define _PR_MD_MAP_WRITE_ERROR _MD_unix_map_write_error
|
||||
|
||||
extern void _MD_unix_map_lseek_error(int err);
|
||||
#define _PR_MD_MAP_LSEEK_ERROR _MD_unix_map_lseek_error
|
||||
#define _PR_MD_MAP_LSEEK_ERROR _MD_unix_map_lseek_error
|
||||
|
||||
extern void _MD_unix_map_fsync_error(int err);
|
||||
#define _PR_MD_MAP_FSYNC_ERROR _MD_unix_map_fsync_error
|
||||
#define _PR_MD_MAP_FSYNC_ERROR _MD_unix_map_fsync_error
|
||||
|
||||
extern void _MD_unix_map_close_error(int err);
|
||||
#define _PR_MD_MAP_CLOSE_ERROR _MD_unix_map_close_error
|
||||
#define _PR_MD_MAP_CLOSE_ERROR _MD_unix_map_close_error
|
||||
|
||||
extern void _MD_unix_map_socket_error(int err);
|
||||
#define _PR_MD_MAP_SOCKET_ERROR _MD_unix_map_socket_error
|
||||
#define _PR_MD_MAP_SOCKET_ERROR _MD_unix_map_socket_error
|
||||
|
||||
extern void _MD_unix_map_socketavailable_error(int err);
|
||||
#define _PR_MD_MAP_SOCKETAVAILABLE_ERROR _MD_unix_map_socketavailable_error
|
||||
#define _PR_MD_MAP_SOCKETAVAILABLE_ERROR _MD_unix_map_socketavailable_error
|
||||
|
||||
extern void _MD_unix_map_recv_error(int err);
|
||||
#define _PR_MD_MAP_RECV_ERROR _MD_unix_map_recv_error
|
||||
#define _PR_MD_MAP_RECV_ERROR _MD_unix_map_recv_error
|
||||
|
||||
extern void _MD_unix_map_recvfrom_error(int err);
|
||||
#define _PR_MD_MAP_RECVFROM_ERROR _MD_unix_map_recvfrom_error
|
||||
#define _PR_MD_MAP_RECVFROM_ERROR _MD_unix_map_recvfrom_error
|
||||
|
||||
extern void _MD_unix_map_send_error(int err);
|
||||
#define _PR_MD_MAP_SEND_ERROR _MD_unix_map_send_error
|
||||
#define _PR_MD_MAP_SEND_ERROR _MD_unix_map_send_error
|
||||
|
||||
extern void _MD_unix_map_sendto_error(int err);
|
||||
#define _PR_MD_MAP_SENDTO_ERROR _MD_unix_map_sendto_error
|
||||
#define _PR_MD_MAP_SENDTO_ERROR _MD_unix_map_sendto_error
|
||||
|
||||
extern void _MD_unix_map_writev_error(int err);
|
||||
#define _PR_MD_MAP_WRITEV_ERROR _MD_unix_map_writev_error
|
||||
#define _PR_MD_MAP_WRITEV_ERROR _MD_unix_map_writev_error
|
||||
|
||||
extern void _MD_unix_map_accept_error(int err);
|
||||
#define _PR_MD_MAP_ACCEPT_ERROR _MD_unix_map_accept_error
|
||||
#define _PR_MD_MAP_ACCEPT_ERROR _MD_unix_map_accept_error
|
||||
|
||||
extern void _MD_unix_map_connect_error(int err);
|
||||
#define _PR_MD_MAP_CONNECT_ERROR _MD_unix_map_connect_error
|
||||
#define _PR_MD_MAP_CONNECT_ERROR _MD_unix_map_connect_error
|
||||
|
||||
extern void _MD_unix_map_bind_error(int err);
|
||||
#define _PR_MD_MAP_BIND_ERROR _MD_unix_map_bind_error
|
||||
#define _PR_MD_MAP_BIND_ERROR _MD_unix_map_bind_error
|
||||
|
||||
extern void _MD_unix_map_listen_error(int err);
|
||||
#define _PR_MD_MAP_LISTEN_ERROR _MD_unix_map_listen_error
|
||||
#define _PR_MD_MAP_LISTEN_ERROR _MD_unix_map_listen_error
|
||||
|
||||
extern void _MD_unix_map_shutdown_error(int err);
|
||||
#define _PR_MD_MAP_SHUTDOWN_ERROR _MD_unix_map_shutdown_error
|
||||
#define _PR_MD_MAP_SHUTDOWN_ERROR _MD_unix_map_shutdown_error
|
||||
|
||||
extern void _MD_unix_map_socketpair_error(int err);
|
||||
#define _PR_MD_MAP_SOCKETPAIR_ERROR _MD_unix_map_socketpair_error
|
||||
#define _PR_MD_MAP_SOCKETPAIR_ERROR _MD_unix_map_socketpair_error
|
||||
|
||||
extern void _MD_unix_map_getsockname_error(int err);
|
||||
#define _PR_MD_MAP_GETSOCKNAME_ERROR _MD_unix_map_getsockname_error
|
||||
#define _PR_MD_MAP_GETSOCKNAME_ERROR _MD_unix_map_getsockname_error
|
||||
|
||||
extern void _MD_unix_map_getpeername_error(int err);
|
||||
#define _PR_MD_MAP_GETPEERNAME_ERROR _MD_unix_map_getpeername_error
|
||||
#define _PR_MD_MAP_GETPEERNAME_ERROR _MD_unix_map_getpeername_error
|
||||
|
||||
extern void _MD_unix_map_getsockopt_error(int err);
|
||||
#define _PR_MD_MAP_GETSOCKOPT_ERROR _MD_unix_map_getsockopt_error
|
||||
#define _PR_MD_MAP_GETSOCKOPT_ERROR _MD_unix_map_getsockopt_error
|
||||
|
||||
extern void _MD_unix_map_setsockopt_error(int err);
|
||||
#define _PR_MD_MAP_SETSOCKOPT_ERROR _MD_unix_map_setsockopt_error
|
||||
#define _PR_MD_MAP_SETSOCKOPT_ERROR _MD_unix_map_setsockopt_error
|
||||
|
||||
extern void _MD_unix_map_open_error(int err);
|
||||
#define _PR_MD_MAP_OPEN_ERROR _MD_unix_map_open_error
|
||||
#define _PR_MD_MAP_OPEN_ERROR _MD_unix_map_open_error
|
||||
|
||||
extern void _MD_unix_map_mmap_error(int err);
|
||||
#define _PR_MD_MAP_MMAP_ERROR _MD_unix_map_mmap_error
|
||||
#define _PR_MD_MAP_MMAP_ERROR _MD_unix_map_mmap_error
|
||||
|
||||
extern void _MD_unix_map_gethostname_error(int err);
|
||||
#define _PR_MD_MAP_GETHOSTNAME_ERROR _MD_unix_map_gethostname_error
|
||||
#define _PR_MD_MAP_GETHOSTNAME_ERROR _MD_unix_map_gethostname_error
|
||||
|
||||
extern void _MD_unix_map_select_error(int err);
|
||||
#define _PR_MD_MAP_SELECT_ERROR _MD_unix_map_select_error
|
||||
#define _PR_MD_MAP_SELECT_ERROR _MD_unix_map_select_error
|
||||
|
||||
extern void _MD_unix_map_poll_error(int err);
|
||||
#define _PR_MD_MAP_POLL_ERROR _MD_unix_map_poll_error
|
||||
@@ -129,10 +129,10 @@ extern void _MD_unix_map_poll_revents_error(int err);
|
||||
#define _PR_MD_MAP_POLL_REVENTS_ERROR _MD_unix_map_poll_revents_error
|
||||
|
||||
extern void _MD_unix_map_flock_error(int err);
|
||||
#define _PR_MD_MAP_FLOCK_ERROR _MD_unix_map_flock_error
|
||||
#define _PR_MD_MAP_FLOCK_ERROR _MD_unix_map_flock_error
|
||||
|
||||
extern void _MD_unix_map_lockf_error(int err);
|
||||
#define _PR_MD_MAP_LOCKF_ERROR _MD_unix_map_lockf_error
|
||||
#define _PR_MD_MAP_LOCKF_ERROR _MD_unix_map_lockf_error
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
|
||||
+167
-171
@@ -46,20 +46,18 @@
|
||||
*/
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#if defined(AIX) || defined(SYMBIAN)
|
||||
#if defined(AIX)
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#ifndef SYMBIAN
|
||||
#define HAVE_NETINET_TCP_H
|
||||
#endif
|
||||
|
||||
#define _PR_HAVE_O_APPEND
|
||||
|
||||
#define PR_DIRECTORY_SEPARATOR '/'
|
||||
#define PR_DIRECTORY_SEPARATOR_STR "/"
|
||||
#define PR_PATH_SEPARATOR ':'
|
||||
#define PR_PATH_SEPARATOR_STR ":"
|
||||
#define PR_DIRECTORY_SEPARATOR '/'
|
||||
#define PR_DIRECTORY_SEPARATOR_STR "/"
|
||||
#define PR_PATH_SEPARATOR ':'
|
||||
#define PR_PATH_SEPARATOR_STR ":"
|
||||
typedef int (*FARPROC)();
|
||||
|
||||
/*
|
||||
@@ -89,9 +87,9 @@ extern PRIntervalTime intr_timeout_ticks;
|
||||
#endif /* _PR_USE_POLL */
|
||||
|
||||
typedef struct _PRUnixPollDesc {
|
||||
PRInt32 osfd;
|
||||
PRInt16 in_flags;
|
||||
PRInt16 out_flags;
|
||||
PRInt32 osfd;
|
||||
PRInt16 in_flags;
|
||||
PRInt16 out_flags;
|
||||
} _PRUnixPollDesc;
|
||||
|
||||
typedef struct PRPollQueue {
|
||||
@@ -130,7 +128,7 @@ struct _MDFileDesc {
|
||||
};
|
||||
|
||||
struct _MDDir {
|
||||
DIR *d;
|
||||
DIR *d;
|
||||
};
|
||||
|
||||
struct _PRCPU;
|
||||
@@ -148,52 +146,52 @@ extern void _MD_unix_init_running_cpu(struct _PRCPU *cpu);
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG) && !defined(DARWIN)
|
||||
#if !defined(SOLARIS)
|
||||
#if !defined(SOLARIS)
|
||||
#include <string.h> /* for memset() */
|
||||
#define _MD_INIT_STACK(ts,REDZONE) \
|
||||
PR_BEGIN_MACRO \
|
||||
(void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_NONE); \
|
||||
(void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
|
||||
REDZONE, PROT_NONE); \
|
||||
/* \
|
||||
** Fill stack memory with something that turns into an illegal \
|
||||
** pointer value. This will sometimes find runtime references to \
|
||||
** uninitialized pointers. We don't do this for solaris because we \
|
||||
** can use purify instead. \
|
||||
*/ \
|
||||
if (_pr_debugStacks) { \
|
||||
memset(ts->allocBase + REDZONE, 0xf7, ts->stackSize); \
|
||||
} \
|
||||
#define _MD_INIT_STACK(ts,REDZONE) \
|
||||
PR_BEGIN_MACRO \
|
||||
(void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_NONE); \
|
||||
(void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
|
||||
REDZONE, PROT_NONE); \
|
||||
/* \
|
||||
** Fill stack memory with something that turns into an illegal \
|
||||
** pointer value. This will sometimes find runtime references to \
|
||||
** uninitialized pointers. We don't do this for solaris because we \
|
||||
** can use purify instead. \
|
||||
*/ \
|
||||
if (_pr_debugStacks) { \
|
||||
memset(ts->allocBase + REDZONE, 0xf7, ts->stackSize); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
#else /* !SOLARIS */
|
||||
#define _MD_INIT_STACK(ts,REDZONE) \
|
||||
PR_BEGIN_MACRO \
|
||||
(void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_NONE); \
|
||||
(void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
|
||||
REDZONE, PROT_NONE); \
|
||||
#else /* !SOLARIS */
|
||||
#define _MD_INIT_STACK(ts,REDZONE) \
|
||||
PR_BEGIN_MACRO \
|
||||
(void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_NONE); \
|
||||
(void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
|
||||
REDZONE, PROT_NONE); \
|
||||
PR_END_MACRO
|
||||
#endif /* !SOLARIS */
|
||||
#endif /* !SOLARIS */
|
||||
|
||||
/*
|
||||
* _MD_CLEAR_STACK
|
||||
* Allow access to the redzone pages; the access was turned off in
|
||||
* _MD_INIT_STACK.
|
||||
* Allow access to the redzone pages; the access was turned off in
|
||||
* _MD_INIT_STACK.
|
||||
*/
|
||||
#define _MD_CLEAR_STACK(ts) \
|
||||
PR_BEGIN_MACRO \
|
||||
(void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_READ|PROT_WRITE);\
|
||||
(void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
|
||||
REDZONE, PROT_READ|PROT_WRITE); \
|
||||
#define _MD_CLEAR_STACK(ts) \
|
||||
PR_BEGIN_MACRO \
|
||||
(void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_READ|PROT_WRITE);\
|
||||
(void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
|
||||
REDZONE, PROT_READ|PROT_WRITE); \
|
||||
PR_END_MACRO
|
||||
|
||||
#else /* DEBUG */
|
||||
#else /* DEBUG */
|
||||
|
||||
#define _MD_INIT_STACK(ts,REDZONE)
|
||||
#define _MD_CLEAR_STACK(ts)
|
||||
|
||||
#endif /* DEBUG */
|
||||
#endif /* DEBUG */
|
||||
|
||||
#if !defined(SOLARIS)
|
||||
#if !defined(SOLARIS)
|
||||
|
||||
#define PR_SET_INTSOFF(newval)
|
||||
|
||||
@@ -230,7 +228,7 @@ extern PRStatus _MD_DetachUnixProcess(struct PRProcess *process);
|
||||
/* Wait for a child process to terminate */
|
||||
#define _MD_WAIT_PROCESS _MD_WaitUnixProcess
|
||||
extern PRStatus _MD_WaitUnixProcess(struct PRProcess *process,
|
||||
PRInt32 *exitCode);
|
||||
PRInt32 *exitCode);
|
||||
|
||||
#define _MD_KILL_PROCESS _MD_KillUnixProcess
|
||||
extern PRStatus _MD_KillUnixProcess(struct PRProcess *process);
|
||||
@@ -240,55 +238,53 @@ extern PRStatus _MD_KillUnixProcess(struct PRProcess *process);
|
||||
extern void _MD_EnableClockInterrupts(void);
|
||||
extern void _MD_DisableClockInterrupts(void);
|
||||
|
||||
#define _MD_START_INTERRUPTS _MD_StartInterrupts
|
||||
#define _MD_STOP_INTERRUPTS _MD_StopInterrupts
|
||||
#define _MD_DISABLE_CLOCK_INTERRUPTS _MD_DisableClockInterrupts
|
||||
#define _MD_ENABLE_CLOCK_INTERRUPTS _MD_EnableClockInterrupts
|
||||
#define _MD_BLOCK_CLOCK_INTERRUPTS _MD_BlockClockInterrupts
|
||||
#define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_UnblockClockInterrupts
|
||||
#define _MD_START_INTERRUPTS _MD_StartInterrupts
|
||||
#define _MD_STOP_INTERRUPTS _MD_StopInterrupts
|
||||
#define _MD_DISABLE_CLOCK_INTERRUPTS _MD_DisableClockInterrupts
|
||||
#define _MD_ENABLE_CLOCK_INTERRUPTS _MD_EnableClockInterrupts
|
||||
#define _MD_BLOCK_CLOCK_INTERRUPTS _MD_BlockClockInterrupts
|
||||
#define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_UnblockClockInterrupts
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
extern void _MD_InitCPUS(void);
|
||||
extern void _MD_InitCPUS(void);
|
||||
#define _MD_INIT_CPUS _MD_InitCPUS
|
||||
|
||||
extern void _MD_Wakeup_CPUs(void);
|
||||
extern void _MD_Wakeup_CPUs(void);
|
||||
#define _MD_WAKEUP_CPUS _MD_Wakeup_CPUs
|
||||
|
||||
#define _MD_PAUSE_CPU _MD_PauseCPU
|
||||
#define _MD_PAUSE_CPU _MD_PauseCPU
|
||||
|
||||
#if defined(_PR_LOCAL_THREADS_ONLY) || defined(_PR_GLOBAL_THREADS_ONLY)
|
||||
#define _MD_CLEANUP_BEFORE_EXIT()
|
||||
#endif
|
||||
|
||||
#ifndef IRIX
|
||||
#define _MD_EXIT(status) _exit(status)
|
||||
#endif
|
||||
#define _MD_EXIT(status) _exit(status)
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#define _MD_GET_ENV getenv
|
||||
#define _MD_PUT_ENV putenv
|
||||
#define _MD_GET_ENV getenv
|
||||
#define _MD_PUT_ENV putenv
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#define _MD_INIT_FILEDESC(fd)
|
||||
|
||||
extern void _MD_MakeNonblock(PRFileDesc *fd);
|
||||
#define _MD_MAKE_NONBLOCK _MD_MakeNonblock
|
||||
extern void _MD_MakeNonblock(PRFileDesc *fd);
|
||||
#define _MD_MAKE_NONBLOCK _MD_MakeNonblock
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#if !defined(_PR_PTHREADS)
|
||||
|
||||
extern void _MD_InitSegs(void);
|
||||
extern PRStatus _MD_AllocSegment(PRSegment *seg, PRUint32 size,
|
||||
void *vaddr);
|
||||
extern void _MD_FreeSegment(PRSegment *seg);
|
||||
extern void _MD_InitSegs(void);
|
||||
extern PRStatus _MD_AllocSegment(PRSegment *seg, PRUint32 size,
|
||||
void *vaddr);
|
||||
extern void _MD_FreeSegment(PRSegment *seg);
|
||||
|
||||
#define _MD_INIT_SEGS _MD_InitSegs
|
||||
#define _MD_ALLOC_SEGMENT _MD_AllocSegment
|
||||
#define _MD_FREE_SEGMENT _MD_FreeSegment
|
||||
#define _MD_INIT_SEGS _MD_InitSegs
|
||||
#define _MD_ALLOC_SEGMENT _MD_AllocSegment
|
||||
#define _MD_FREE_SEGMENT _MD_FreeSegment
|
||||
|
||||
#endif /* !defined(_PR_PTHREADS) */
|
||||
|
||||
@@ -298,25 +294,25 @@ extern void _MD_FreeSegment(PRSegment *seg);
|
||||
extern PRIntervalTime _PR_UNIX_GetInterval(void);
|
||||
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
|
||||
#define _MD_INTERVAL_INIT()
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
#endif
|
||||
|
||||
#ifdef _PR_HAVE_CLOCK_MONOTONIC
|
||||
extern PRIntervalTime _PR_UNIX_GetInterval2(void);
|
||||
extern PRIntervalTime _PR_UNIX_TicksPerSecond2(void);
|
||||
#define _MD_INTERVAL_INIT()
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval2
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond2
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval2
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond2
|
||||
#endif
|
||||
|
||||
#define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
|
||||
#define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
|
||||
#define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
|
||||
#define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#define _MD_ERRNO() (errno)
|
||||
#define _MD_GET_SOCKET_ERROR() (errno)
|
||||
#define _MD_ERRNO() (errno)
|
||||
#define _MD_GET_SOCKET_ERROR() (errno)
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
@@ -333,125 +329,125 @@ extern PRStatus _MD_open_dir(struct _MDDir *, const char *);
|
||||
extern PRInt32 _MD_close_dir(struct _MDDir *);
|
||||
extern char * _MD_read_dir(struct _MDDir *, PRIntn);
|
||||
extern PRInt32 _MD_open(const char *name, PRIntn osflags, PRIntn mode);
|
||||
extern PRInt32 _MD_delete(const char *name);
|
||||
extern PRInt32 _MD_getfileinfo(const char *fn, PRFileInfo *info);
|
||||
extern PRInt32 _MD_delete(const char *name);
|
||||
extern PRInt32 _MD_getfileinfo(const char *fn, PRFileInfo *info);
|
||||
extern PRInt32 _MD_getfileinfo64(const char *fn, PRFileInfo64 *info);
|
||||
extern PRInt32 _MD_getopenfileinfo(const PRFileDesc *fd, PRFileInfo *info);
|
||||
extern PRInt32 _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info);
|
||||
extern PRInt32 _MD_rename(const char *from, const char *to);
|
||||
extern PRInt32 _MD_access(const char *name, PRAccessHow how);
|
||||
extern PRInt32 _MD_mkdir(const char *name, PRIntn mode);
|
||||
extern PRInt32 _MD_rmdir(const char *name);
|
||||
extern PRInt32 _MD_accept_read(PRInt32 sock, PRInt32 *newSock,
|
||||
PRNetAddr **raddr, void *buf, PRInt32 amount);
|
||||
extern PRInt32 _PR_UnixSendFile(PRFileDesc *sd, PRSendFileData *sfd,
|
||||
PRTransmitFileFlags flags, PRIntervalTime timeout);
|
||||
extern PRInt32 _MD_rename(const char *from, const char *to);
|
||||
extern PRInt32 _MD_access(const char *name, PRAccessHow how);
|
||||
extern PRInt32 _MD_mkdir(const char *name, PRIntn mode);
|
||||
extern PRInt32 _MD_rmdir(const char *name);
|
||||
extern PRInt32 _MD_accept_read(PRInt32 sock, PRInt32 *newSock,
|
||||
PRNetAddr **raddr, void *buf, PRInt32 amount);
|
||||
extern PRInt32 _PR_UnixSendFile(PRFileDesc *sd, PRSendFileData *sfd,
|
||||
PRTransmitFileFlags flags, PRIntervalTime timeout);
|
||||
|
||||
extern PRStatus _MD_LockFile(PRInt32 osfd);
|
||||
extern PRStatus _MD_TLockFile(PRInt32 osfd);
|
||||
extern PRStatus _MD_UnlockFile(PRInt32 osfd);
|
||||
|
||||
#define _MD_OPEN_DIR(dir, name) _MD_open_dir(dir, name)
|
||||
#define _MD_CLOSE_DIR(dir) _MD_close_dir(dir)
|
||||
#define _MD_READ_DIR(dir, flags) _MD_read_dir(dir, flags)
|
||||
#define _MD_OPEN(name, osflags, mode) _MD_open(name, osflags, mode)
|
||||
#define _MD_OPEN_FILE(name, osflags, mode) _MD_open(name, osflags, mode)
|
||||
#define _MD_OPEN_DIR(dir, name) _MD_open_dir(dir, name)
|
||||
#define _MD_CLOSE_DIR(dir) _MD_close_dir(dir)
|
||||
#define _MD_READ_DIR(dir, flags) _MD_read_dir(dir, flags)
|
||||
#define _MD_OPEN(name, osflags, mode) _MD_open(name, osflags, mode)
|
||||
#define _MD_OPEN_FILE(name, osflags, mode) _MD_open(name, osflags, mode)
|
||||
extern PRInt32 _MD_read(PRFileDesc *fd, void *buf, PRInt32 amount);
|
||||
#define _MD_READ(fd,buf,amount) _MD_read(fd,buf,amount)
|
||||
#define _MD_READ(fd,buf,amount) _MD_read(fd,buf,amount)
|
||||
extern PRInt32 _MD_write(PRFileDesc *fd, const void *buf, PRInt32 amount);
|
||||
#define _MD_WRITE(fd,buf,amount) _MD_write(fd,buf,amount)
|
||||
#define _MD_DELETE(name) _MD_delete(name)
|
||||
#define _MD_GETFILEINFO(fn, info) _MD_getfileinfo(fn, info)
|
||||
#define _MD_GETFILEINFO64(fn, info) _MD_getfileinfo64(fn, info)
|
||||
#define _MD_GETOPENFILEINFO(fd, info) _MD_getopenfileinfo(fd, info)
|
||||
#define _MD_GETOPENFILEINFO64(fd, info) _MD_getopenfileinfo64(fd, info)
|
||||
#define _MD_RENAME(from, to) _MD_rename(from, to)
|
||||
#define _MD_ACCESS(name, how) _MD_access(name, how)
|
||||
#define _MD_MKDIR(name, mode) _MD_mkdir(name, mode)
|
||||
#define _MD_MAKE_DIR(name, mode) _MD_mkdir(name, mode)
|
||||
#define _MD_RMDIR(name) _MD_rmdir(name)
|
||||
#define _MD_ACCEPT_READ(sock, newSock, raddr, buf, amount) _MD_accept_read(sock, newSock, raddr, buf, amount)
|
||||
#define _MD_WRITE(fd,buf,amount) _MD_write(fd,buf,amount)
|
||||
#define _MD_DELETE(name) _MD_delete(name)
|
||||
#define _MD_GETFILEINFO(fn, info) _MD_getfileinfo(fn, info)
|
||||
#define _MD_GETFILEINFO64(fn, info) _MD_getfileinfo64(fn, info)
|
||||
#define _MD_GETOPENFILEINFO(fd, info) _MD_getopenfileinfo(fd, info)
|
||||
#define _MD_GETOPENFILEINFO64(fd, info) _MD_getopenfileinfo64(fd, info)
|
||||
#define _MD_RENAME(from, to) _MD_rename(from, to)
|
||||
#define _MD_ACCESS(name, how) _MD_access(name, how)
|
||||
#define _MD_MKDIR(name, mode) _MD_mkdir(name, mode)
|
||||
#define _MD_MAKE_DIR(name, mode) _MD_mkdir(name, mode)
|
||||
#define _MD_RMDIR(name) _MD_rmdir(name)
|
||||
#define _MD_ACCEPT_READ(sock, newSock, raddr, buf, amount) _MD_accept_read(sock, newSock, raddr, buf, amount)
|
||||
|
||||
#define _MD_LOCKFILE _MD_LockFile
|
||||
#define _MD_TLOCKFILE _MD_TLockFile
|
||||
#define _MD_UNLOCKFILE _MD_UnlockFile
|
||||
|
||||
|
||||
extern PRInt32 _MD_socket(int af, int type, int flags);
|
||||
#define _MD_SOCKET _MD_socket
|
||||
extern PRInt32 _MD_connect(PRFileDesc *fd, const PRNetAddr *addr,
|
||||
PRUint32 addrlen, PRIntervalTime timeout);
|
||||
#define _MD_CONNECT _MD_connect
|
||||
extern PRInt32 _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen,
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_ACCEPT _MD_accept
|
||||
extern PRInt32 _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen);
|
||||
#define _MD_BIND _MD_bind
|
||||
extern PRInt32 _MD_listen(PRFileDesc *fd, PRIntn backlog);
|
||||
#define _MD_LISTEN _MD_listen
|
||||
extern PRInt32 _MD_shutdown(PRFileDesc *fd, PRIntn how);
|
||||
#define _MD_SHUTDOWN _MD_shutdown
|
||||
extern PRInt32 _MD_socket(int af, int type, int flags);
|
||||
#define _MD_SOCKET _MD_socket
|
||||
extern PRInt32 _MD_connect(PRFileDesc *fd, const PRNetAddr *addr,
|
||||
PRUint32 addrlen, PRIntervalTime timeout);
|
||||
#define _MD_CONNECT _MD_connect
|
||||
extern PRInt32 _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen,
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_ACCEPT _MD_accept
|
||||
extern PRInt32 _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen);
|
||||
#define _MD_BIND _MD_bind
|
||||
extern PRInt32 _MD_listen(PRFileDesc *fd, PRIntn backlog);
|
||||
#define _MD_LISTEN _MD_listen
|
||||
extern PRInt32 _MD_shutdown(PRFileDesc *fd, PRIntn how);
|
||||
#define _MD_SHUTDOWN _MD_shutdown
|
||||
|
||||
extern PRInt32 _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount,
|
||||
PRIntn flags, PRIntervalTime timeout);
|
||||
#define _MD_RECV _MD_recv
|
||||
extern PRInt32 _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount,
|
||||
PRIntn flags, PRIntervalTime timeout);
|
||||
#define _MD_SEND _MD_send
|
||||
extern PRInt32 _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount,
|
||||
PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen,
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_RECVFROM _MD_recvfrom
|
||||
extern PRInt32 _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount,
|
||||
PRIntn flags, PRIntervalTime timeout);
|
||||
#define _MD_RECV _MD_recv
|
||||
extern PRInt32 _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount,
|
||||
PRIntn flags, PRIntervalTime timeout);
|
||||
#define _MD_SEND _MD_send
|
||||
extern PRInt32 _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount,
|
||||
PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen,
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_RECVFROM _MD_recvfrom
|
||||
extern PRInt32 _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount,
|
||||
PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen,
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_SENDTO _MD_sendto
|
||||
extern PRInt32 _MD_writev(PRFileDesc *fd, const struct PRIOVec *iov,
|
||||
PRInt32 iov_size, PRIntervalTime timeout);
|
||||
#define _MD_WRITEV _MD_writev
|
||||
PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen,
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_SENDTO _MD_sendto
|
||||
extern PRInt32 _MD_writev(PRFileDesc *fd, const struct PRIOVec *iov,
|
||||
PRInt32 iov_size, PRIntervalTime timeout);
|
||||
#define _MD_WRITEV _MD_writev
|
||||
|
||||
extern PRInt32 _MD_socketavailable(PRFileDesc *fd);
|
||||
#define _MD_SOCKETAVAILABLE _MD_socketavailable
|
||||
extern PRInt64 _MD_socketavailable64(PRFileDesc *fd);
|
||||
#define _MD_SOCKETAVAILABLE64 _MD_socketavailable64
|
||||
extern PRInt32 _MD_socketavailable(PRFileDesc *fd);
|
||||
#define _MD_SOCKETAVAILABLE _MD_socketavailable
|
||||
extern PRInt64 _MD_socketavailable64(PRFileDesc *fd);
|
||||
#define _MD_SOCKETAVAILABLE64 _MD_socketavailable64
|
||||
|
||||
#define _MD_PIPEAVAILABLE _MD_socketavailable
|
||||
#define _MD_PIPEAVAILABLE _MD_socketavailable
|
||||
|
||||
extern PRInt32 _MD_pr_poll(PRPollDesc *pds, PRIntn npds,
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_PR_POLL _MD_pr_poll
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_PR_POLL _MD_pr_poll
|
||||
|
||||
extern PRInt32 _MD_close(PRInt32 osfd);
|
||||
#define _MD_CLOSE_FILE _MD_close
|
||||
extern PRInt32 _MD_lseek(PRFileDesc*, PRInt32, PRSeekWhence);
|
||||
#define _MD_LSEEK _MD_lseek
|
||||
extern PRInt64 _MD_lseek64(PRFileDesc*, PRInt64, PRSeekWhence);
|
||||
#define _MD_LSEEK64 _MD_lseek64
|
||||
extern PRInt32 _MD_fsync(PRFileDesc *fd);
|
||||
#define _MD_FSYNC _MD_fsync
|
||||
extern PRInt32 _MD_close(PRInt32 osfd);
|
||||
#define _MD_CLOSE_FILE _MD_close
|
||||
extern PRInt32 _MD_lseek(PRFileDesc*, PRInt32, PRSeekWhence);
|
||||
#define _MD_LSEEK _MD_lseek
|
||||
extern PRInt64 _MD_lseek64(PRFileDesc*, PRInt64, PRSeekWhence);
|
||||
#define _MD_LSEEK64 _MD_lseek64
|
||||
extern PRInt32 _MD_fsync(PRFileDesc *fd);
|
||||
#define _MD_FSYNC _MD_fsync
|
||||
|
||||
extern PRInt32 _MD_socketpair(int af, int type, int flags, PRInt32 *osfd);
|
||||
#define _MD_SOCKETPAIR _MD_socketpair
|
||||
#define _MD_SOCKETPAIR _MD_socketpair
|
||||
|
||||
#define _MD_CLOSE_SOCKET _MD_close
|
||||
#define _MD_CLOSE_SOCKET _MD_close
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
#define _MD_STAT stat
|
||||
#define _MD_STAT stat
|
||||
#endif
|
||||
|
||||
extern PRStatus _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr,
|
||||
PRUint32 *addrlen);
|
||||
PRUint32 *addrlen);
|
||||
#define _MD_GETPEERNAME _MD_getpeername
|
||||
extern PRStatus _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr,
|
||||
PRUint32 *addrlen);
|
||||
PRUint32 *addrlen);
|
||||
#define _MD_GETSOCKNAME _MD_getsockname
|
||||
|
||||
extern PRStatus _MD_getsockopt(PRFileDesc *fd, PRInt32 level,
|
||||
PRInt32 optname, char* optval, PRInt32* optlen);
|
||||
#define _MD_GETSOCKOPT _MD_getsockopt
|
||||
PRInt32 optname, char* optval, PRInt32* optlen);
|
||||
#define _MD_GETSOCKOPT _MD_getsockopt
|
||||
extern PRStatus _MD_setsockopt(PRFileDesc *fd, PRInt32 level,
|
||||
PRInt32 optname, const char* optval, PRInt32 optlen);
|
||||
#define _MD_SETSOCKOPT _MD_setsockopt
|
||||
PRInt32 optname, const char* optval, PRInt32 optlen);
|
||||
#define _MD_SETSOCKOPT _MD_setsockopt
|
||||
|
||||
extern PRStatus _MD_set_fd_inheritable(PRFileDesc *fd, PRBool inheritable);
|
||||
#define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable
|
||||
@@ -463,10 +459,10 @@ extern void _MD_query_fd_inheritable(PRFileDesc *fd);
|
||||
#define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable
|
||||
|
||||
extern PRStatus _MD_gethostname(char *name, PRUint32 namelen);
|
||||
#define _MD_GETHOSTNAME _MD_gethostname
|
||||
#define _MD_GETHOSTNAME _MD_gethostname
|
||||
|
||||
extern PRStatus _MD_getsysinfo(PRSysInfo cmd, char *name, PRUint32 namelen);
|
||||
#define _MD_GETSYSINFO _MD_getsysinfo
|
||||
#define _MD_GETSYSINFO _MD_getsysinfo
|
||||
|
||||
extern int _MD_unix_get_nonblocking_connect_error(int osfd);
|
||||
|
||||
@@ -484,7 +480,7 @@ extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
|
||||
#define _MD_GET_MEM_MAP_ALIGNMENT() PR_GetPageSize()
|
||||
|
||||
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
|
||||
PRUint32 len);
|
||||
PRUint32 len);
|
||||
#define _MD_MEM_MAP _MD_MemMap
|
||||
|
||||
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
|
||||
@@ -531,19 +527,19 @@ struct pollfd {
|
||||
|
||||
/* poll events */
|
||||
|
||||
#define POLLIN 0x0001 /* fd is readable */
|
||||
#define POLLPRI 0x0002 /* high priority info at fd */
|
||||
#define POLLOUT 0x0004 /* fd is writeable (won't block) */
|
||||
#define POLLRDNORM 0x0040 /* normal data is readable */
|
||||
#define POLLWRNORM POLLOUT
|
||||
#define POLLRDBAND 0x0080 /* out-of-band data is readable */
|
||||
#define POLLWRBAND 0x0100 /* out-of-band data is writeable */
|
||||
#define POLLIN 0x0001 /* fd is readable */
|
||||
#define POLLPRI 0x0002 /* high priority info at fd */
|
||||
#define POLLOUT 0x0004 /* fd is writeable (won't block) */
|
||||
#define POLLRDNORM 0x0040 /* normal data is readable */
|
||||
#define POLLWRNORM POLLOUT
|
||||
#define POLLRDBAND 0x0080 /* out-of-band data is readable */
|
||||
#define POLLWRBAND 0x0100 /* out-of-band data is writeable */
|
||||
|
||||
#define POLLNORM POLLRDNORM
|
||||
#define POLLNORM POLLRDNORM
|
||||
|
||||
#define POLLERR 0x0008 /* fd has error condition */
|
||||
#define POLLHUP 0x0010 /* fd has been hung up on */
|
||||
#define POLLNVAL 0x0020 /* invalid pollfd entry */
|
||||
#define POLLERR 0x0008 /* fd has error condition */
|
||||
#define POLLHUP 0x0010 /* fd has been hung up on */
|
||||
#define POLLNVAL 0x0020 /* invalid pollfd entry */
|
||||
|
||||
extern int poll(struct pollfd *, unsigned long, int);
|
||||
|
||||
|
||||
@@ -10,18 +10,18 @@
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "unixware"
|
||||
#define _PR_SI_SYSNAME "UnixWare"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
#define PR_LINKER_ARCH "unixware"
|
||||
#define _PR_SI_SYSNAME "UnixWare"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#endif
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_NETCONFIG
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define HAVE_STRERROR
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define NEED_TIME_R
|
||||
@@ -44,7 +44,7 @@
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[4]
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
@@ -60,22 +60,22 @@
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures.
|
||||
* Don't use SVR4 native threads (yet).
|
||||
* Don't use SVR4 native threads (yet).
|
||||
*/
|
||||
|
||||
struct _MDThread {
|
||||
@@ -117,31 +117,31 @@ struct _MDCPU_Unix {
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
@@ -160,13 +160,13 @@ struct _MDCPU {
|
||||
*/
|
||||
#define _MD_INTERVAL_USE_GTOD
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/*
|
||||
@@ -177,7 +177,7 @@ struct _MDCPU {
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *execptfds, struct timeval *timeout);
|
||||
fd_set *execptfds, struct timeval *timeout);
|
||||
#define _MD_SELECT _select
|
||||
|
||||
#define _MD_POLL _poll
|
||||
|
||||
@@ -12,109 +12,109 @@
|
||||
|
||||
|
||||
extern void _MD_win32_map_default_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_DEFAULT_ERROR _MD_win32_map_default_error
|
||||
#define _PR_MD_MAP_DEFAULT_ERROR _MD_win32_map_default_error
|
||||
|
||||
extern void _MD_win32_map_opendir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_OPENDIR_ERROR _MD_win32_map_opendir_error
|
||||
#define _PR_MD_MAP_OPENDIR_ERROR _MD_win32_map_opendir_error
|
||||
|
||||
extern void _MD_win32_map_closedir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_CLOSEDIR_ERROR _MD_win32_map_closedir_error
|
||||
#define _PR_MD_MAP_CLOSEDIR_ERROR _MD_win32_map_closedir_error
|
||||
|
||||
extern void _MD_unix_readdir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_READDIR_ERROR _MD_unix_readdir_error
|
||||
#define _PR_MD_MAP_READDIR_ERROR _MD_unix_readdir_error
|
||||
|
||||
extern void _MD_win32_map_delete_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_DELETE_ERROR _MD_win32_map_delete_error
|
||||
#define _PR_MD_MAP_DELETE_ERROR _MD_win32_map_delete_error
|
||||
|
||||
extern void _MD_win32_map_stat_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_STAT_ERROR _MD_win32_map_stat_error
|
||||
#define _PR_MD_MAP_STAT_ERROR _MD_win32_map_stat_error
|
||||
|
||||
extern void _MD_win32_map_fstat_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_FSTAT_ERROR _MD_win32_map_fstat_error
|
||||
#define _PR_MD_MAP_FSTAT_ERROR _MD_win32_map_fstat_error
|
||||
|
||||
extern void _MD_win32_map_rename_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RENAME_ERROR _MD_win32_map_rename_error
|
||||
#define _PR_MD_MAP_RENAME_ERROR _MD_win32_map_rename_error
|
||||
|
||||
extern void _MD_win32_map_access_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_ACCESS_ERROR _MD_win32_map_access_error
|
||||
#define _PR_MD_MAP_ACCESS_ERROR _MD_win32_map_access_error
|
||||
|
||||
extern void _MD_win32_map_mkdir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_MKDIR_ERROR _MD_win32_map_mkdir_error
|
||||
#define _PR_MD_MAP_MKDIR_ERROR _MD_win32_map_mkdir_error
|
||||
|
||||
extern void _MD_win32_map_rmdir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RMDIR_ERROR _MD_win32_map_rmdir_error
|
||||
#define _PR_MD_MAP_RMDIR_ERROR _MD_win32_map_rmdir_error
|
||||
|
||||
extern void _MD_win32_map_read_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_READ_ERROR _MD_win32_map_read_error
|
||||
#define _PR_MD_MAP_READ_ERROR _MD_win32_map_read_error
|
||||
|
||||
extern void _MD_win32_map_transmitfile_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_TRANSMITFILE_ERROR _MD_win32_map_transmitfile_error
|
||||
#define _PR_MD_MAP_TRANSMITFILE_ERROR _MD_win32_map_transmitfile_error
|
||||
|
||||
extern void _MD_win32_map_write_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_WRITE_ERROR _MD_win32_map_write_error
|
||||
#define _PR_MD_MAP_WRITE_ERROR _MD_win32_map_write_error
|
||||
|
||||
extern void _MD_win32_map_lseek_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_LSEEK_ERROR _MD_win32_map_lseek_error
|
||||
#define _PR_MD_MAP_LSEEK_ERROR _MD_win32_map_lseek_error
|
||||
|
||||
extern void _MD_win32_map_fsync_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_FSYNC_ERROR _MD_win32_map_fsync_error
|
||||
#define _PR_MD_MAP_FSYNC_ERROR _MD_win32_map_fsync_error
|
||||
|
||||
extern void _MD_win32_map_close_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_CLOSE_ERROR _MD_win32_map_close_error
|
||||
#define _PR_MD_MAP_CLOSE_ERROR _MD_win32_map_close_error
|
||||
|
||||
extern void _MD_win32_map_socket_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SOCKET_ERROR _MD_win32_map_socket_error
|
||||
#define _PR_MD_MAP_SOCKET_ERROR _MD_win32_map_socket_error
|
||||
|
||||
extern void _MD_win32_map_recv_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RECV_ERROR _MD_win32_map_recv_error
|
||||
#define _PR_MD_MAP_RECV_ERROR _MD_win32_map_recv_error
|
||||
|
||||
extern void _MD_win32_map_recvfrom_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RECVFROM_ERROR _MD_win32_map_recvfrom_error
|
||||
#define _PR_MD_MAP_RECVFROM_ERROR _MD_win32_map_recvfrom_error
|
||||
|
||||
extern void _MD_win32_map_send_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SEND_ERROR _MD_win32_map_send_error
|
||||
#define _PR_MD_MAP_SEND_ERROR _MD_win32_map_send_error
|
||||
|
||||
extern void _MD_win32_map_sendto_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SENDTO_ERROR _MD_win32_map_sendto_error
|
||||
#define _PR_MD_MAP_SENDTO_ERROR _MD_win32_map_sendto_error
|
||||
|
||||
extern void _MD_win32_map_accept_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_ACCEPT_ERROR _MD_win32_map_accept_error
|
||||
#define _PR_MD_MAP_ACCEPT_ERROR _MD_win32_map_accept_error
|
||||
|
||||
extern void _MD_win32_map_acceptex_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_ACCEPTEX_ERROR _MD_win32_map_acceptex_error
|
||||
#define _PR_MD_MAP_ACCEPTEX_ERROR _MD_win32_map_acceptex_error
|
||||
|
||||
extern void _MD_win32_map_connect_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_CONNECT_ERROR _MD_win32_map_connect_error
|
||||
#define _PR_MD_MAP_CONNECT_ERROR _MD_win32_map_connect_error
|
||||
|
||||
extern void _MD_win32_map_bind_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_BIND_ERROR _MD_win32_map_bind_error
|
||||
#define _PR_MD_MAP_BIND_ERROR _MD_win32_map_bind_error
|
||||
|
||||
extern void _MD_win32_map_listen_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_LISTEN_ERROR _MD_win32_map_listen_error
|
||||
#define _PR_MD_MAP_LISTEN_ERROR _MD_win32_map_listen_error
|
||||
|
||||
extern void _MD_win32_map_shutdown_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SHUTDOWN_ERROR _MD_win32_map_shutdown_error
|
||||
#define _PR_MD_MAP_SHUTDOWN_ERROR _MD_win32_map_shutdown_error
|
||||
|
||||
extern void _MD_win32_map_getsockname_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETSOCKNAME_ERROR _MD_win32_map_getsockname_error
|
||||
#define _PR_MD_MAP_GETSOCKNAME_ERROR _MD_win32_map_getsockname_error
|
||||
|
||||
extern void _MD_win32_map_getpeername_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETPEERNAME_ERROR _MD_win32_map_getpeername_error
|
||||
#define _PR_MD_MAP_GETPEERNAME_ERROR _MD_win32_map_getpeername_error
|
||||
|
||||
extern void _MD_win32_map_getsockopt_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETSOCKOPT_ERROR _MD_win32_map_getsockopt_error
|
||||
#define _PR_MD_MAP_GETSOCKOPT_ERROR _MD_win32_map_getsockopt_error
|
||||
|
||||
extern void _MD_win32_map_setsockopt_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SETSOCKOPT_ERROR _MD_win32_map_setsockopt_error
|
||||
#define _PR_MD_MAP_SETSOCKOPT_ERROR _MD_win32_map_setsockopt_error
|
||||
|
||||
extern void _MD_win32_map_open_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_OPEN_ERROR _MD_win32_map_open_error
|
||||
#define _PR_MD_MAP_OPEN_ERROR _MD_win32_map_open_error
|
||||
|
||||
extern void _MD_win32_map_gethostname_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETHOSTNAME_ERROR _MD_win32_map_gethostname_error
|
||||
#define _PR_MD_MAP_GETHOSTNAME_ERROR _MD_win32_map_gethostname_error
|
||||
|
||||
extern void _MD_win32_map_select_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SELECT_ERROR _MD_win32_map_select_error
|
||||
#define _PR_MD_MAP_SELECT_ERROR _MD_win32_map_select_error
|
||||
|
||||
extern void _MD_win32_map_lockf_error(int err);
|
||||
#define _PR_MD_MAP_LOCKF_ERROR _MD_win32_map_lockf_error
|
||||
|
||||
@@ -84,14 +84,14 @@ extern struct PRLock *_pr_schedLock;
|
||||
typedef void (*FiberFunc)(void *);
|
||||
|
||||
#define PR_NUM_GCREGS 8
|
||||
typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
|
||||
typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
|
||||
#define GC_VMBASE 0x40000000
|
||||
#define GC_VMLIMIT 0x00FFFFFF
|
||||
|
||||
#define _MD_MAGIC_THREAD 0x22222222
|
||||
#define _MD_MAGIC_THREADSTACK 0x33333333
|
||||
#define _MD_MAGIC_SEGMENT 0x44444444
|
||||
#define _MD_MAGIC_DIR 0x55555555
|
||||
#define _MD_MAGIC_THREAD 0x22222222
|
||||
#define _MD_MAGIC_THREADSTACK 0x33333333
|
||||
#define _MD_MAGIC_SEGMENT 0x44444444
|
||||
#define _MD_MAGIC_DIR 0x55555555
|
||||
#define _MD_MAGIC_CV 0x66666666
|
||||
|
||||
struct _MDCPU {
|
||||
@@ -237,12 +237,12 @@ extern PRInt32 _MD_CloseFile(PROsfd osfd);
|
||||
#define _MD_GETOPENFILEINFO _PR_MD_GETOPENFILEINFO
|
||||
#define _MD_GETOPENFILEINFO64 _PR_MD_GETOPENFILEINFO64
|
||||
#define _MD_STAT _PR_MD_STAT
|
||||
#define _MD_RENAME _PR_MD_RENAME
|
||||
#define _MD_ACCESS _PR_MD_ACCESS
|
||||
#define _MD_DELETE _PR_MD_DELETE
|
||||
#define _MD_MKDIR _PR_MD_MKDIR
|
||||
#define _MD_RENAME _PR_MD_RENAME
|
||||
#define _MD_ACCESS _PR_MD_ACCESS
|
||||
#define _MD_DELETE _PR_MD_DELETE
|
||||
#define _MD_MKDIR _PR_MD_MKDIR
|
||||
#define _MD_MAKE_DIR _PR_MD_MAKE_DIR
|
||||
#define _MD_RMDIR _PR_MD_RMDIR
|
||||
#define _MD_RMDIR _PR_MD_RMDIR
|
||||
#define _MD_LOCKFILE _PR_MD_LOCKFILE
|
||||
#define _MD_TLOCKFILE _PR_MD_TLOCKFILE
|
||||
#define _MD_UNLOCKFILE _PR_MD_UNLOCKFILE
|
||||
@@ -310,7 +310,7 @@ extern PRInt32 _MD_CloseSocket(PROsfd osfd);
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#if defined(_M_IX86) || defined(_X86_)
|
||||
#define _MD_ATOMIC_INCREMENT _PR_MD_ATOMIC_INCREMENT
|
||||
#define _MD_ATOMIC_ADD _PR_MD_ATOMIC_ADD
|
||||
#define _MD_ATOMIC_ADD _PR_MD_ATOMIC_ADD
|
||||
#define _MD_ATOMIC_DECREMENT _PR_MD_ATOMIC_DECREMENT
|
||||
#else /* non-x86 processors */
|
||||
#define _MD_ATOMIC_INCREMENT(x) InterlockedIncrement((PLONG)x)
|
||||
@@ -329,7 +329,7 @@ extern PRInt32 _MD_SocketAvailable(PRFileDesc *fd);
|
||||
#define _MD_PIPEAVAILABLE _PR_MD_PIPEAVAILABLE
|
||||
#define _MD_CONNECT _PR_MD_CONNECT
|
||||
extern PROsfd _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
|
||||
PRIntervalTime timeout);
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_ACCEPT _MD_Accept
|
||||
#define _MD_BIND _PR_MD_BIND
|
||||
#define _MD_RECV _PR_MD_RECV
|
||||
@@ -343,8 +343,8 @@ extern PROsfd _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
|
||||
/* --- DIR stuff --- */
|
||||
#define PR_DIRECTORY_SEPARATOR '\\'
|
||||
#define PR_DIRECTORY_SEPARATOR_STR "\\"
|
||||
#define PR_PATH_SEPARATOR ';'
|
||||
#define PR_PATH_SEPARATOR_STR ";"
|
||||
#define PR_PATH_SEPARATOR ';'
|
||||
#define PR_PATH_SEPARATOR_STR ";"
|
||||
#define _MD_ERRNO() GetLastError()
|
||||
#define _MD_OPEN_DIR _PR_MD_OPEN_DIR
|
||||
#define _MD_CLOSE_DIR _PR_MD_CLOSE_DIR
|
||||
@@ -396,16 +396,16 @@ extern PROsfd _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
|
||||
#define _MD_WAKEUP_WAITER _PR_MD_WAKEUP_WAITER
|
||||
|
||||
/* --- CVar ------------------- */
|
||||
#define _MD_WAIT_CV _PR_MD_WAIT_CV
|
||||
#define _MD_NEW_CV _PR_MD_NEW_CV
|
||||
#define _MD_FREE_CV _PR_MD_FREE_CV
|
||||
#define _MD_NOTIFY_CV _PR_MD_NOTIFY_CV
|
||||
#define _MD_NOTIFYALL_CV _PR_MD_NOTIFYALL_CV
|
||||
#define _MD_WAIT_CV _PR_MD_WAIT_CV
|
||||
#define _MD_NEW_CV _PR_MD_NEW_CV
|
||||
#define _MD_FREE_CV _PR_MD_FREE_CV
|
||||
#define _MD_NOTIFY_CV _PR_MD_NOTIFY_CV
|
||||
#define _MD_NOTIFYALL_CV _PR_MD_NOTIFYALL_CV
|
||||
|
||||
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
|
||||
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
|
||||
// extern struct _MDLock _pr_ioq_lock;
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
|
||||
/* --- Initialization stuff --- */
|
||||
@@ -437,8 +437,8 @@ extern PRStatus _PR_DetachWindowsProcess(struct PRProcess *process);
|
||||
|
||||
/* --- Wait for a child process to terminate --- */
|
||||
#define _MD_WAIT_PROCESS _PR_WaitWindowsProcess
|
||||
extern PRStatus _PR_WaitWindowsProcess(struct PRProcess *process,
|
||||
PRInt32 *exitCode);
|
||||
extern PRStatus _PR_WaitWindowsProcess(struct PRProcess *process,
|
||||
PRInt32 *exitCode);
|
||||
|
||||
#define _MD_KILL_PROCESS _PR_KillWindowsProcess
|
||||
extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process);
|
||||
@@ -499,7 +499,7 @@ extern DWORD _pr_currentCPUIndex;
|
||||
/* --- Scheduler stuff --- */
|
||||
#define LOCK_SCHEDULER() 0
|
||||
#define UNLOCK_SCHEDULER() 0
|
||||
#define _PR_LockSched() 0
|
||||
#define _PR_LockSched() 0
|
||||
#define _PR_UnlockSched() 0
|
||||
|
||||
/* --- Initialization stuff --- */
|
||||
@@ -523,7 +523,7 @@ extern PRInt32 _MD_GetMemMapAlignment(void);
|
||||
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
|
||||
|
||||
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
|
||||
PRUint32 len);
|
||||
PRUint32 len);
|
||||
#define _MD_MEM_MAP _MD_MemMap
|
||||
|
||||
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
/* Need to force service-pack 3 extensions to be defined by
|
||||
** setting _WIN32_WINNT to NT 4.0 for winsock.h, winbase.h, winnt.h.
|
||||
*/
|
||||
*/
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#elif (_WIN32_WINNT < 0x0400)
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#endif /* _WIN32_WINNT */
|
||||
|
||||
#include <windows.h>
|
||||
@@ -103,14 +103,14 @@ extern struct PRLock *_pr_schedLock;
|
||||
typedef void (*FiberFunc)(void *);
|
||||
|
||||
#define PR_NUM_GCREGS 8
|
||||
typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
|
||||
typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
|
||||
#define GC_VMBASE 0x40000000
|
||||
#define GC_VMLIMIT 0x00FFFFFF
|
||||
|
||||
#define _MD_MAGIC_THREAD 0x22222222
|
||||
#define _MD_MAGIC_THREADSTACK 0x33333333
|
||||
#define _MD_MAGIC_SEGMENT 0x44444444
|
||||
#define _MD_MAGIC_DIR 0x55555555
|
||||
#define _MD_MAGIC_THREAD 0x22222222
|
||||
#define _MD_MAGIC_THREADSTACK 0x33333333
|
||||
#define _MD_MAGIC_SEGMENT 0x44444444
|
||||
#define _MD_MAGIC_DIR 0x55555555
|
||||
|
||||
struct _MDCPU {
|
||||
int unused;
|
||||
@@ -146,7 +146,7 @@ typedef struct _MDOverlapped {
|
||||
} _MDOverlapped;
|
||||
|
||||
struct _MDThread {
|
||||
/* The overlapped structure must be first! */
|
||||
/* The overlapped structure must be first! */
|
||||
struct _MDOverlapped overlapped; /* Used for async IO for this thread */
|
||||
void *acceptex_buf; /* Used for AcceptEx() */
|
||||
TRANSMIT_FILE_BUFFERS *xmit_bufs; /* Used for TransmitFile() */
|
||||
@@ -161,10 +161,10 @@ struct _MDThread {
|
||||
void *sp; /* only valid when suspended */
|
||||
PRUint32 magic; /* for debugging */
|
||||
PR_CONTEXT_TYPE gcContext; /* Thread context for GC */
|
||||
struct _PRCPU *thr_bound_cpu; /* thread bound to cpu */
|
||||
PRBool interrupt_disabled;/* thread cannot be interrupted */
|
||||
HANDLE thr_event; /* For native-threads-only support,
|
||||
thread blocks on this event */
|
||||
struct _PRCPU *thr_bound_cpu; /* thread bound to cpu */
|
||||
PRBool interrupt_disabled;/* thread cannot be interrupted */
|
||||
HANDLE thr_event; /* For native-threads-only support,
|
||||
thread blocks on this event */
|
||||
|
||||
/* The following are used only if this is a fiber */
|
||||
void *fiber_id; /* flag whether or not this is a fiber*/
|
||||
@@ -277,12 +277,12 @@ extern PRInt32 _PR_MD_CLOSE(PROsfd osfd, PRBool socket);
|
||||
#define _MD_GETOPENFILEINFO _PR_MD_GETOPENFILEINFO
|
||||
#define _MD_GETOPENFILEINFO64 _PR_MD_GETOPENFILEINFO64
|
||||
#define _MD_STAT _PR_MD_STAT
|
||||
#define _MD_RENAME _PR_MD_RENAME
|
||||
#define _MD_ACCESS _PR_MD_ACCESS
|
||||
#define _MD_DELETE _PR_MD_DELETE
|
||||
#define _MD_MKDIR _PR_MD_MKDIR
|
||||
#define _MD_RENAME _PR_MD_RENAME
|
||||
#define _MD_ACCESS _PR_MD_ACCESS
|
||||
#define _MD_DELETE _PR_MD_DELETE
|
||||
#define _MD_MKDIR _PR_MD_MKDIR
|
||||
#define _MD_MAKE_DIR _PR_MD_MAKE_DIR
|
||||
#define _MD_RMDIR _PR_MD_RMDIR
|
||||
#define _MD_RMDIR _PR_MD_RMDIR
|
||||
#define _MD_LOCKFILE _PR_MD_LOCKFILE
|
||||
#define _MD_TLOCKFILE _PR_MD_TLOCKFILE
|
||||
#define _MD_UNLOCKFILE _PR_MD_UNLOCKFILE
|
||||
@@ -307,7 +307,7 @@ extern PRInt32 _PR_MD_CLOSE(PROsfd osfd, PRBool socket);
|
||||
#define _MD_SETSOCKOPT _PR_MD_SETSOCKOPT
|
||||
#define _MD_SELECT select
|
||||
extern int _PR_NTFiberSafeSelect(int, fd_set *, fd_set *, fd_set *,
|
||||
const struct timeval *);
|
||||
const struct timeval *);
|
||||
#define _MD_FSYNC _PR_MD_FSYNC
|
||||
#define _MD_SOCKETAVAILABLE _PR_MD_SOCKETAVAILABLE
|
||||
#define _MD_PIPEAVAILABLE _PR_MD_PIPEAVAILABLE
|
||||
@@ -316,7 +316,7 @@ extern int _PR_NTFiberSafeSelect(int, fd_set *, fd_set *, fd_set *,
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#if defined(_M_IX86) || defined(_X86_)
|
||||
#define _MD_ATOMIC_INCREMENT _PR_MD_ATOMIC_INCREMENT
|
||||
#define _MD_ATOMIC_ADD _PR_MD_ATOMIC_ADD
|
||||
#define _MD_ATOMIC_ADD _PR_MD_ATOMIC_ADD
|
||||
#define _MD_ATOMIC_DECREMENT _PR_MD_ATOMIC_DECREMENT
|
||||
#else /* non-x86 processors */
|
||||
#define _MD_ATOMIC_INCREMENT(x) InterlockedIncrement((PLONG)x)
|
||||
@@ -342,7 +342,7 @@ extern int _PR_NTFiberSafeSelect(int, fd_set *, fd_set *, fd_set *,
|
||||
#define _MD_BIND _PR_MD_BIND
|
||||
#define _MD_RECV _PR_MD_RECV
|
||||
#define _MD_SEND _PR_MD_SEND
|
||||
#define _MD_SENDFILE _PR_MD_SENDFILE
|
||||
#define _MD_SENDFILE _PR_MD_SENDFILE
|
||||
#define _MD_PR_POLL _PR_MD_PR_POLL
|
||||
|
||||
/* --- Scheduler stuff --- */
|
||||
@@ -351,8 +351,8 @@ extern int _PR_NTFiberSafeSelect(int, fd_set *, fd_set *, fd_set *,
|
||||
/* --- DIR stuff --- */
|
||||
#define PR_DIRECTORY_SEPARATOR '\\'
|
||||
#define PR_DIRECTORY_SEPARATOR_STR "\\"
|
||||
#define PR_PATH_SEPARATOR ';'
|
||||
#define PR_PATH_SEPARATOR_STR ";"
|
||||
#define PR_PATH_SEPARATOR ';'
|
||||
#define PR_PATH_SEPARATOR_STR ";"
|
||||
#define _MD_ERRNO() GetLastError()
|
||||
#define _MD_OPEN_DIR _PR_MD_OPEN_DIR
|
||||
#define _MD_CLOSE_DIR _PR_MD_CLOSE_DIR
|
||||
@@ -414,13 +414,13 @@ extern void _PR_Unblock_IO_Wait(PRThread *thr);
|
||||
#define _MD_UNLOCK(lock) LeaveCriticalSection(&((lock)->mutex))
|
||||
#endif
|
||||
#define _PR_LOCK _MD_LOCK
|
||||
#define _PR_UNLOCK _MD_UNLOCK
|
||||
#define _PR_UNLOCK _MD_UNLOCK
|
||||
|
||||
/* --- lock and cv waiting --- */
|
||||
#define _MD_WAIT _PR_MD_WAIT
|
||||
#define _MD_WAKEUP_WAITER _PR_MD_WAKEUP_WAITER
|
||||
|
||||
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
|
||||
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
|
||||
extern struct _MDLock _pr_ioq_lock;
|
||||
#define _MD_IOQ_LOCK() _MD_LOCK(&_pr_ioq_lock)
|
||||
#define _MD_IOQ_UNLOCK() _MD_UNLOCK(&_pr_ioq_lock)
|
||||
@@ -456,8 +456,8 @@ extern PRStatus _PR_DetachWindowsProcess(struct PRProcess *process);
|
||||
|
||||
/* --- Wait for a child process to terminate --- */
|
||||
#define _MD_WAIT_PROCESS _PR_WaitWindowsProcess
|
||||
extern PRStatus _PR_WaitWindowsProcess(struct PRProcess *process,
|
||||
PRInt32 *exitCode);
|
||||
extern PRStatus _PR_WaitWindowsProcess(struct PRProcess *process,
|
||||
PRInt32 *exitCode);
|
||||
|
||||
#define _MD_KILL_PROCESS _PR_KillWindowsProcess
|
||||
extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process);
|
||||
@@ -573,7 +573,7 @@ extern PRInt32 _MD_GetMemMapAlignment(void);
|
||||
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
|
||||
|
||||
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
|
||||
PRUint32 len);
|
||||
PRUint32 len);
|
||||
#define _MD_MEM_MAP _MD_MemMap
|
||||
|
||||
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
|
||||
|
||||
@@ -49,15 +49,9 @@ PR_BEGIN_EXTERN_C
|
||||
#elif defined(HPUX)
|
||||
#include "md/_hpux.h"
|
||||
|
||||
#elif defined(IRIX)
|
||||
#include "md/_irix.h"
|
||||
|
||||
#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
|
||||
#include "md/_linux.h"
|
||||
|
||||
#elif defined(OSF1)
|
||||
#include "md/_osf1.h"
|
||||
|
||||
#elif defined(DARWIN)
|
||||
#include "md/_darwin.h"
|
||||
|
||||
@@ -70,9 +64,6 @@ PR_BEGIN_EXTERN_C
|
||||
#elif defined(UNIXWARE)
|
||||
#include "md/_unixware.h"
|
||||
|
||||
#elif defined(DGUX)
|
||||
#include "md/_dgux.h"
|
||||
|
||||
#elif defined(QNX)
|
||||
#include "md/_qnx.h"
|
||||
|
||||
@@ -82,9 +73,6 @@ PR_BEGIN_EXTERN_C
|
||||
#elif defined(RISCOS)
|
||||
#include "md/_riscos.h"
|
||||
|
||||
#elif defined(SYMBIAN)
|
||||
#include "md/_symbian.h"
|
||||
|
||||
#else
|
||||
#error unknown Unix flavor
|
||||
|
||||
@@ -93,14 +81,9 @@ PR_BEGIN_EXTERN_C
|
||||
#include "md/_unixos.h"
|
||||
#include "md/_unix_errors.h"
|
||||
|
||||
#elif defined(XP_BEOS)
|
||||
|
||||
#include "md/_beos.h"
|
||||
#include "md/_unix_errors.h"
|
||||
|
||||
#else
|
||||
|
||||
#error "The platform is not BeOS, Unix, Windows, or Mac"
|
||||
#error "The platform is not Unix, Windows, or Mac"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
** File: pralarm.h
|
||||
** Description: API to periodic alarms.
|
||||
** File: pralarm.h
|
||||
** Description: API to periodic alarms.
|
||||
**
|
||||
**
|
||||
** Alarms are defined to invoke some client specified function at
|
||||
** Alarms are defined to invoke some client specified function at
|
||||
** a time in the future. The notification may be a one time event
|
||||
** or repeated at a fixed interval. The interval at which the next
|
||||
** notification takes place may be modified by the client code only
|
||||
@@ -57,14 +57,14 @@ typedef PRBool (PR_CALLBACK *PRPeriodicAlarmFn)(
|
||||
** INPUTS: void
|
||||
** OUTPUTS: None
|
||||
** RETURN: PRAlarm*
|
||||
**
|
||||
**
|
||||
** SIDE EFFECTS:
|
||||
** This creates an alarm context, which is an object used for subsequent
|
||||
** notification creations. It also creates a thread that will be used to
|
||||
** deliver the notifications that are expected to be defined. The client
|
||||
** is resposible for destroying the context when appropriate.
|
||||
** RESTRICTIONS:
|
||||
** None.
|
||||
** None.
|
||||
** MEMORY: The object (PRAlarm) and a thread to support notifications.
|
||||
** ALGORITHM: N/A
|
||||
***********************************************************************/
|
||||
@@ -77,14 +77,14 @@ NSPR_API(PRAlarm*) PR_CreateAlarm(void);
|
||||
** INPUTS: PRAlarm*
|
||||
** OUTPUTS: None
|
||||
** RETURN: PRStatus
|
||||
**
|
||||
**
|
||||
** SIDE EFFECTS:
|
||||
** This destroys the context that was created by PR_CreateAlarm().
|
||||
** If there are any active alarms (PRAlarmID), they will be cancelled.
|
||||
** Once that is done, the thread that was used to deliver the alarms
|
||||
** will be joined.
|
||||
** will be joined.
|
||||
** RESTRICTIONS:
|
||||
** None.
|
||||
** None.
|
||||
** MEMORY: N/A
|
||||
** ALGORITHM: N/A
|
||||
***********************************************************************/
|
||||
@@ -105,7 +105,7 @@ NSPR_API(PRStatus) PR_DestroyAlarm(PRAlarm *alarm);
|
||||
** OUTPUTS: None
|
||||
** RETURN: PRAlarmID* Handle to the notifier just created
|
||||
** or NULL if the request failed.
|
||||
**
|
||||
**
|
||||
** SIDE EFFECTS:
|
||||
** A periodic notifier is created. The notifications will be delivered
|
||||
** by the alarm's internal thread at a fixed interval whose rate is the
|
||||
@@ -114,7 +114,7 @@ NSPR_API(PRStatus) PR_DestroyAlarm(PRAlarm *alarm);
|
||||
** the notifier routine indicates that they should cease of the alarm
|
||||
** context is destroyed (PR_DestroyAlarm).
|
||||
** RESTRICTIONS:
|
||||
** None.
|
||||
** None.
|
||||
** MEMORY: Memory for the notifier object.
|
||||
** ALGORITHM: The rate at which notifications are delivered are stated
|
||||
** to be "'rate' notifies per 'interval'". The exact time of
|
||||
@@ -124,7 +124,7 @@ NSPR_API(PRStatus) PR_DestroyAlarm(PRAlarm *alarm);
|
||||
** notification sequence number. Such notifications have the
|
||||
** potential to be late by not more than 'interval'/'rate'.
|
||||
** The amount of lateness of one notification is taken into
|
||||
** account on the next in an attempt to avoid long term slew.
|
||||
** account on the next in an attempt to avoid long term slew.
|
||||
***********************************************************************/
|
||||
NSPR_API(PRAlarmID*) PR_SetAlarm(
|
||||
PRAlarm *alarm, PRIntervalTime period, PRUint32 rate,
|
||||
@@ -141,7 +141,7 @@ NSPR_API(PRAlarmID*) PR_SetAlarm(
|
||||
** the notifies will be delivered.
|
||||
** OUTPUTS: None
|
||||
** RETURN: PRStatus Indication of completion.
|
||||
**
|
||||
**
|
||||
** SIDE EFFECTS:
|
||||
** An existing alarm may have its period and rate redefined. The
|
||||
** additional side effect is that the notifier's epoch is recomputed.
|
||||
@@ -150,10 +150,10 @@ NSPR_API(PRAlarmID*) PR_SetAlarm(
|
||||
** RESTRICTIONS:
|
||||
** This function may only be called in the notifier for that alarm.
|
||||
** MEMORY: N/A.
|
||||
** ALGORITHM: See PR_SetAlarm().
|
||||
** ALGORITHM: See PR_SetAlarm().
|
||||
***********************************************************************/
|
||||
NSPR_API(PRStatus) PR_ResetAlarm(
|
||||
PRAlarmID *id, PRIntervalTime period, PRUint32 rate);
|
||||
PRAlarmID *id, PRIntervalTime period, PRUint32 rate);
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
|
||||
@@ -48,51 +48,51 @@ typedef struct PR_fd_set {
|
||||
** DESCRIPTION:
|
||||
**
|
||||
** The call returns as soon as I/O is ready on one or more of the underlying
|
||||
** file/socket descriptors or an exceptional condition is pending. A count of the
|
||||
** number of ready descriptors is returned unless a timeout occurs in which case
|
||||
** zero is returned. On return, PR_Select replaces the given descriptor sets with
|
||||
** file/socket descriptors or an exceptional condition is pending. A count of the
|
||||
** number of ready descriptors is returned unless a timeout occurs in which case
|
||||
** zero is returned. On return, PR_Select replaces the given descriptor sets with
|
||||
** subsets consisting of those descriptors that are ready for the requested condition.
|
||||
** The total number of ready descriptors in all the sets is the return value.
|
||||
**
|
||||
** INPUTS:
|
||||
** PRInt32 num
|
||||
** PRInt32 num
|
||||
** This argument is unused but is provided for select(unix) interface
|
||||
** compatability. All input PR_fd_set arguments are self-describing
|
||||
** with its own maximum number of elements in the set.
|
||||
**
|
||||
**
|
||||
** PR_fd_set *readfds
|
||||
** A set describing the io descriptors for which ready for reading
|
||||
** condition is of interest.
|
||||
**
|
||||
** condition is of interest.
|
||||
**
|
||||
** PR_fd_set *writefds
|
||||
** A set describing the io descriptors for which ready for writing
|
||||
** condition is of interest.
|
||||
**
|
||||
** condition is of interest.
|
||||
**
|
||||
** PR_fd_set *exceptfds
|
||||
** A set describing the io descriptors for which exception pending
|
||||
** condition is of interest.
|
||||
** condition is of interest.
|
||||
**
|
||||
** Any of the above readfds, writefds or exceptfds may be given as NULL
|
||||
** pointers if no descriptors are of interest for that particular condition.
|
||||
**
|
||||
** PRIntervalTime timeout
|
||||
** Amount of time the call will block waiting for I/O to become ready.
|
||||
** Any of the above readfds, writefds or exceptfds may be given as NULL
|
||||
** pointers if no descriptors are of interest for that particular condition.
|
||||
**
|
||||
** PRIntervalTime timeout
|
||||
** Amount of time the call will block waiting for I/O to become ready.
|
||||
** If this time expires without any I/O becoming ready, the result will
|
||||
** be zero.
|
||||
**
|
||||
** OUTPUTS:
|
||||
** OUTPUTS:
|
||||
** PR_fd_set *readfds
|
||||
** A set describing the io descriptors which are ready for reading.
|
||||
**
|
||||
**
|
||||
** PR_fd_set *writefds
|
||||
** A set describing the io descriptors which are ready for writing.
|
||||
**
|
||||
**
|
||||
** PR_fd_set *exceptfds
|
||||
** A set describing the io descriptors which have pending exception.
|
||||
**
|
||||
** RETURN:PRInt32
|
||||
** Number of io descriptors with asked for conditions or zero if the function
|
||||
** timed out or -1 on failure. The reason for the failure is obtained by
|
||||
** timed out or -1 on failure. The reason for the failure is obtained by
|
||||
** calling PR_GetError().
|
||||
** XXX can we implement this on windoze and mac?
|
||||
**************************************************************************
|
||||
@@ -101,21 +101,21 @@ NSPR_API(PRInt32) PR_Select(
|
||||
PRInt32 num, PR_fd_set *readfds, PR_fd_set *writefds,
|
||||
PR_fd_set *exceptfds, PRIntervalTime timeout);
|
||||
|
||||
/*
|
||||
/*
|
||||
** The following are not thread safe for two threads operating on them at the
|
||||
** same time.
|
||||
**
|
||||
** The following routines are provided for manipulating io descriptor sets.
|
||||
** PR_FD_ZERO(&fdset) initializes a descriptor set fdset to the null set.
|
||||
** PR_FD_SET(fd, &fdset) includes a particular file descriptor fd in fdset.
|
||||
** PR_FD_CLR(fd, &fdset) removes a file descriptor fd from fdset.
|
||||
** PR_FD_ISSET(fd, &fdset) is nonzero if file descriptor fd is a member of
|
||||
** PR_FD_CLR(fd, &fdset) removes a file descriptor fd from fdset.
|
||||
** PR_FD_ISSET(fd, &fdset) is nonzero if file descriptor fd is a member of
|
||||
** fdset, zero otherwise.
|
||||
**
|
||||
** PR_FD_NSET(osfd, &fdset) includes a particular native file descriptor osfd
|
||||
** in fdset.
|
||||
** PR_FD_NCLR(osfd, &fdset) removes a native file descriptor osfd from fdset.
|
||||
** PR_FD_NISSET(osfd, &fdset) is nonzero if native file descriptor osfd is a member of
|
||||
** PR_FD_NCLR(osfd, &fdset) removes a native file descriptor osfd from fdset.
|
||||
** PR_FD_NISSET(osfd, &fdset) is nonzero if native file descriptor osfd is a member of
|
||||
** fdset, zero otherwise.
|
||||
*/
|
||||
|
||||
|
||||
@@ -27,14 +27,6 @@ typedef PRIntn intn;
|
||||
* defined by those standard headers.
|
||||
*/
|
||||
|
||||
/*
|
||||
* BeOS defines all the int types below in its standard header
|
||||
* file SupportDefs.h.
|
||||
*/
|
||||
#ifdef XP_BEOS
|
||||
#include <support/SupportDefs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SVR4 typedef of uint is commonly found on UNIX machines.
|
||||
*
|
||||
@@ -56,7 +48,7 @@ typedef PRIntn intn;
|
||||
* uint
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(XP_OS2) && !defined(XP_UNIX) || defined(NTO)
|
||||
#if !defined(XP_OS2) && !defined(XP_UNIX) || defined(NTO)
|
||||
typedef PRUintn uint;
|
||||
#endif
|
||||
|
||||
@@ -64,43 +56,35 @@ typedef PRUintn uint;
|
||||
* uint64
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS)
|
||||
typedef PRUint64 uint64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* uint32
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS)
|
||||
#if !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO)
|
||||
typedef PRUint32 uint32;
|
||||
#else
|
||||
typedef unsigned long uint32;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* uint16
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS)
|
||||
typedef PRUint16 uint16;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* uint8
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS)
|
||||
typedef PRUint8 uint8;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* int64
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES)
|
||||
#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES)
|
||||
typedef PRInt64 int64;
|
||||
#endif
|
||||
|
||||
@@ -108,7 +92,7 @@ typedef PRInt64 int64;
|
||||
* int32
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
&& !defined(HPUX)
|
||||
#if !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO)
|
||||
typedef PRInt32 int32;
|
||||
@@ -121,7 +105,7 @@ typedef long int32;
|
||||
* int16
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
&& !defined(HPUX)
|
||||
typedef PRInt16 int16;
|
||||
#endif
|
||||
@@ -130,7 +114,7 @@ typedef PRInt16 int16;
|
||||
* int8
|
||||
*/
|
||||
|
||||
#if !defined(XP_BEOS) && !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
#if !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
|
||||
&& !defined(HPUX)
|
||||
typedef PRInt8 int8;
|
||||
#endif
|
||||
@@ -142,9 +126,9 @@ typedef PRWord prword_t;
|
||||
|
||||
|
||||
/* Re: prbit.h */
|
||||
#define TEST_BIT PR_TEST_BIT
|
||||
#define SET_BIT PR_SET_BIT
|
||||
#define CLEAR_BIT PR_CLEAR_BIT
|
||||
#define TEST_BIT PR_TEST_BIT
|
||||
#define SET_BIT PR_SET_BIT
|
||||
#define CLEAR_BIT PR_CLEAR_BIT
|
||||
|
||||
/* Re: prarena.h->plarena.h */
|
||||
#define PRArena PLArena
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#define prsem_h___
|
||||
|
||||
/*
|
||||
** API for counting semaphores. Semaphores are counting synchronizing
|
||||
** variables based on a lock and a condition variable. They are lightweight
|
||||
** API for counting semaphores. Semaphores are counting synchronizing
|
||||
** variables based on a lock and a condition variable. They are lightweight
|
||||
** contention control for a given count of resources.
|
||||
*/
|
||||
#include "prtypes.h"
|
||||
@@ -30,23 +30,23 @@ NSPR_API(void) PR_DestroySem(PRSemaphore *sem);
|
||||
|
||||
/*
|
||||
** Wait on a Semaphore.
|
||||
**
|
||||
** This routine allows a calling thread to wait or proceed depending upon the
|
||||
** state of the semahore sem. The thread can proceed only if the counter value
|
||||
** of the semaphore sem is currently greater than 0. If the value of semaphore
|
||||
** sem is positive, it is decremented by one and the routine returns immediately
|
||||
** allowing the calling thread to continue. If the value of semaphore sem is 0,
|
||||
** the calling thread blocks awaiting the semaphore to be released by another
|
||||
**
|
||||
** This routine allows a calling thread to wait or proceed depending upon the
|
||||
** state of the semahore sem. The thread can proceed only if the counter value
|
||||
** of the semaphore sem is currently greater than 0. If the value of semaphore
|
||||
** sem is positive, it is decremented by one and the routine returns immediately
|
||||
** allowing the calling thread to continue. If the value of semaphore sem is 0,
|
||||
** the calling thread blocks awaiting the semaphore to be released by another
|
||||
** thread.
|
||||
**
|
||||
** This routine can return PR_PENDING_INTERRUPT if the waiting thread
|
||||
**
|
||||
** This routine can return PR_PENDING_INTERRUPT if the waiting thread
|
||||
** has been interrupted.
|
||||
*/
|
||||
NSPR_API(PRStatus) PR_WaitSem(PRSemaphore *sem);
|
||||
|
||||
/*
|
||||
** This routine increments the counter value of the semaphore. If other threads
|
||||
** are blocked for the semaphore, then the scheduler will determine which ONE
|
||||
** This routine increments the counter value of the semaphore. If other threads
|
||||
** are blocked for the semaphore, then the scheduler will determine which ONE
|
||||
** thread will be unblocked.
|
||||
*/
|
||||
NSPR_API(void) PR_PostSem(PRSemaphore *sem);
|
||||
|
||||
+18
-18
@@ -25,7 +25,7 @@ PR_BEGIN_EXTERN_C
|
||||
** RETURN:
|
||||
** the returned value is the result of the increment
|
||||
*/
|
||||
NSPR_API(PRInt32) PR_AtomicIncrement(PRInt32 *val);
|
||||
NSPR_API(PRInt32) PR_AtomicIncrement(PRInt32 *val);
|
||||
|
||||
/*
|
||||
** FUNCTION: PR_AtomicDecrement
|
||||
@@ -36,7 +36,7 @@ NSPR_API(PRInt32) PR_AtomicIncrement(PRInt32 *val);
|
||||
** RETURN:
|
||||
** the returned value is the result of the decrement
|
||||
*/
|
||||
NSPR_API(PRInt32) PR_AtomicDecrement(PRInt32 *val);
|
||||
NSPR_API(PRInt32) PR_AtomicDecrement(PRInt32 *val);
|
||||
|
||||
/*
|
||||
** FUNCTION: PR_AtomicSet
|
||||
@@ -56,11 +56,11 @@ NSPR_API(PRInt32) PR_AtomicSet(PRInt32 *val, PRInt32 newval);
|
||||
** Atomically add a 32 bit value.
|
||||
** INPUTS:
|
||||
** ptr: a pointer to the value to increment
|
||||
** val: value to be added
|
||||
** val: value to be added
|
||||
** RETURN:
|
||||
** the returned value is the result of the addition
|
||||
*/
|
||||
NSPR_API(PRInt32) PR_AtomicAdd(PRInt32 *ptr, PRInt32 val);
|
||||
NSPR_API(PRInt32) PR_AtomicAdd(PRInt32 *ptr, PRInt32 val);
|
||||
|
||||
/*
|
||||
** MACRO: PR_ATOMIC_INCREMENT
|
||||
@@ -137,8 +137,8 @@ NSPR_API(PRInt32) PR_AtomicAdd(PRInt32 *ptr, PRInt32 val);
|
||||
typedef struct PRStackElemStr PRStackElem;
|
||||
|
||||
struct PRStackElemStr {
|
||||
PRStackElem *prstk_elem_next; /* next pointer MUST be at offset 0;
|
||||
assembly language code relies on this */
|
||||
PRStackElem *prstk_elem_next; /* next pointer MUST be at offset 0;
|
||||
assembly language code relies on this */
|
||||
};
|
||||
|
||||
typedef struct PRStackStr PRStack;
|
||||
@@ -152,46 +152,46 @@ typedef struct PRStackStr PRStack;
|
||||
** RETURN:
|
||||
** A pointer to the created stack, if successful, else NULL.
|
||||
*/
|
||||
NSPR_API(PRStack *) PR_CreateStack(const char *stack_name);
|
||||
NSPR_API(PRStack *) PR_CreateStack(const char *stack_name);
|
||||
|
||||
/*
|
||||
** FUNCTION: PR_StackPush
|
||||
** DESCRIPTION:
|
||||
** Push an element on the top of the stack
|
||||
** INPUTS:
|
||||
** stack: pointer to the stack
|
||||
** stack_elem: pointer to the stack element
|
||||
** stack: pointer to the stack
|
||||
** stack_elem: pointer to the stack element
|
||||
** RETURN:
|
||||
** None
|
||||
*/
|
||||
NSPR_API(void) PR_StackPush(PRStack *stack, PRStackElem *stack_elem);
|
||||
NSPR_API(void) PR_StackPush(PRStack *stack, PRStackElem *stack_elem);
|
||||
|
||||
/*
|
||||
** FUNCTION: PR_StackPop
|
||||
** DESCRIPTION:
|
||||
** Remove the element on the top of the stack
|
||||
** INPUTS:
|
||||
** stack: pointer to the stack
|
||||
** stack: pointer to the stack
|
||||
** RETURN:
|
||||
** A pointer to the stack element removed from the top of the stack,
|
||||
** if non-empty,
|
||||
** if non-empty,
|
||||
** else NULL
|
||||
*/
|
||||
NSPR_API(PRStackElem *) PR_StackPop(PRStack *stack);
|
||||
NSPR_API(PRStackElem *) PR_StackPop(PRStack *stack);
|
||||
|
||||
/*
|
||||
** FUNCTION: PR_DestroyStack
|
||||
** DESCRIPTION:
|
||||
** Destroy the stack
|
||||
** INPUTS:
|
||||
** stack: pointer to the stack
|
||||
** stack: pointer to the stack
|
||||
** RETURN:
|
||||
** PR_SUCCESS - if successfully deleted
|
||||
** PR_FAILURE - if the stack is not empty
|
||||
** PR_GetError will return
|
||||
** PR_INVALID_STATE_ERROR - stack is not empty
|
||||
** PR_FAILURE - if the stack is not empty
|
||||
** PR_GetError will return
|
||||
** PR_INVALID_STATE_ERROR - stack is not empty
|
||||
*/
|
||||
NSPR_API(PRStatus) PR_DestroyStack(PRStack *stack);
|
||||
NSPR_API(PRStatus) PR_DestroyStack(PRStack *stack);
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
|
||||
+22
-22
@@ -18,18 +18,18 @@ PR_BEGIN_EXTERN_C
|
||||
defined(_M_ARM64))
|
||||
# include <intrin.h>
|
||||
# pragma intrinsic(_BitScanForward,_BitScanReverse)
|
||||
__forceinline static int __prBitScanForward32(unsigned int val)
|
||||
{
|
||||
__forceinline static int __prBitScanForward32(unsigned int val)
|
||||
{
|
||||
unsigned long idx;
|
||||
_BitScanForward(&idx, (unsigned long)val);
|
||||
return( (int)idx );
|
||||
}
|
||||
__forceinline static int __prBitScanReverse32(unsigned int val)
|
||||
{
|
||||
}
|
||||
__forceinline static int __prBitScanReverse32(unsigned int val)
|
||||
{
|
||||
unsigned long idx;
|
||||
_BitScanReverse(&idx, (unsigned long)val);
|
||||
return( (int)(31-idx) );
|
||||
}
|
||||
}
|
||||
# define pr_bitscan_ctz32(val) __prBitScanForward32(val)
|
||||
# define pr_bitscan_clz32(val) __prBitScanReverse32(val)
|
||||
# define PR_HAVE_BUILTIN_BITSCAN32
|
||||
@@ -56,18 +56,18 @@ typedef unsigned long prbitmap_t;
|
||||
/*
|
||||
** Compute the log of the least power of 2 greater than or equal to n
|
||||
*/
|
||||
NSPR_API(PRIntn) PR_CeilingLog2(PRUint32 i);
|
||||
NSPR_API(PRIntn) PR_CeilingLog2(PRUint32 i);
|
||||
|
||||
/*
|
||||
** Compute the log of the greatest power of 2 less than or equal to n
|
||||
*/
|
||||
NSPR_API(PRIntn) PR_FloorLog2(PRUint32 i);
|
||||
NSPR_API(PRIntn) PR_FloorLog2(PRUint32 i);
|
||||
|
||||
/*
|
||||
** Macro version of PR_CeilingLog2: Compute the log of the least power of
|
||||
** 2 greater than or equal to _n. The result is returned in _log2.
|
||||
*/
|
||||
#ifdef PR_HAVE_BUILTIN_BITSCAN32
|
||||
#ifdef PR_HAVE_BUILTIN_BITSCAN32
|
||||
#define PR_CEILING_LOG2(_log2,_n) \
|
||||
PR_BEGIN_MACRO \
|
||||
PRUint32 j_ = (PRUint32)(_n); \
|
||||
@@ -76,20 +76,20 @@ NSPR_API(PRIntn) PR_FloorLog2(PRUint32 i);
|
||||
#else
|
||||
#define PR_CEILING_LOG2(_log2,_n) \
|
||||
PR_BEGIN_MACRO \
|
||||
PRUint32 j_ = (PRUint32)(_n); \
|
||||
PRUint32 j_ = (PRUint32)(_n); \
|
||||
(_log2) = 0; \
|
||||
if ((j_) & ((j_)-1)) \
|
||||
(_log2) += 1; \
|
||||
(_log2) += 1; \
|
||||
if ((j_) >> 16) \
|
||||
(_log2) += 16, (j_) >>= 16; \
|
||||
(_log2) += 16, (j_) >>= 16; \
|
||||
if ((j_) >> 8) \
|
||||
(_log2) += 8, (j_) >>= 8; \
|
||||
(_log2) += 8, (j_) >>= 8; \
|
||||
if ((j_) >> 4) \
|
||||
(_log2) += 4, (j_) >>= 4; \
|
||||
(_log2) += 4, (j_) >>= 4; \
|
||||
if ((j_) >> 2) \
|
||||
(_log2) += 2, (j_) >>= 2; \
|
||||
(_log2) += 2, (j_) >>= 2; \
|
||||
if ((j_) >> 1) \
|
||||
(_log2) += 1; \
|
||||
(_log2) += 1; \
|
||||
PR_END_MACRO
|
||||
#endif /* PR_HAVE_BUILTIN_BITSCAN32 */
|
||||
|
||||
@@ -108,18 +108,18 @@ NSPR_API(PRIntn) PR_FloorLog2(PRUint32 i);
|
||||
#else
|
||||
#define PR_FLOOR_LOG2(_log2,_n) \
|
||||
PR_BEGIN_MACRO \
|
||||
PRUint32 j_ = (PRUint32)(_n); \
|
||||
PRUint32 j_ = (PRUint32)(_n); \
|
||||
(_log2) = 0; \
|
||||
if ((j_) >> 16) \
|
||||
(_log2) += 16, (j_) >>= 16; \
|
||||
(_log2) += 16, (j_) >>= 16; \
|
||||
if ((j_) >> 8) \
|
||||
(_log2) += 8, (j_) >>= 8; \
|
||||
(_log2) += 8, (j_) >>= 8; \
|
||||
if ((j_) >> 4) \
|
||||
(_log2) += 4, (j_) >>= 4; \
|
||||
(_log2) += 4, (j_) >>= 4; \
|
||||
if ((j_) >> 2) \
|
||||
(_log2) += 2, (j_) >>= 2; \
|
||||
(_log2) += 2, (j_) >>= 2; \
|
||||
if ((j_) >> 1) \
|
||||
(_log2) += 1; \
|
||||
(_log2) += 1; \
|
||||
PR_END_MACRO
|
||||
#endif /* PR_HAVE_BUILTIN_BITSCAN32 */
|
||||
|
||||
|
||||
@@ -14,42 +14,42 @@ typedef struct PRCListStr PRCList;
|
||||
** Circular linked list
|
||||
*/
|
||||
struct PRCListStr {
|
||||
PRCList *next;
|
||||
PRCList *prev;
|
||||
PRCList *next;
|
||||
PRCList *prev;
|
||||
};
|
||||
|
||||
/*
|
||||
** Insert element "_e" into the list, before "_l".
|
||||
*/
|
||||
#define PR_INSERT_BEFORE(_e,_l) \
|
||||
PR_BEGIN_MACRO \
|
||||
(_e)->next = (_l); \
|
||||
(_e)->prev = (_l)->prev; \
|
||||
(_l)->prev->next = (_e); \
|
||||
(_l)->prev = (_e); \
|
||||
#define PR_INSERT_BEFORE(_e,_l) \
|
||||
PR_BEGIN_MACRO \
|
||||
(_e)->next = (_l); \
|
||||
(_e)->prev = (_l)->prev; \
|
||||
(_l)->prev->next = (_e); \
|
||||
(_l)->prev = (_e); \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Insert element "_e" into the list, after "_l".
|
||||
*/
|
||||
#define PR_INSERT_AFTER(_e,_l) \
|
||||
PR_BEGIN_MACRO \
|
||||
(_e)->next = (_l)->next; \
|
||||
(_e)->prev = (_l); \
|
||||
(_l)->next->prev = (_e); \
|
||||
(_l)->next = (_e); \
|
||||
#define PR_INSERT_AFTER(_e,_l) \
|
||||
PR_BEGIN_MACRO \
|
||||
(_e)->next = (_l)->next; \
|
||||
(_e)->prev = (_l); \
|
||||
(_l)->next->prev = (_e); \
|
||||
(_l)->next = (_e); \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Return the element following element "_e"
|
||||
*/
|
||||
#define PR_NEXT_LINK(_e) \
|
||||
((_e)->next)
|
||||
#define PR_NEXT_LINK(_e) \
|
||||
((_e)->next)
|
||||
/*
|
||||
** Return the element preceding element "_e"
|
||||
*/
|
||||
#define PR_PREV_LINK(_e) \
|
||||
((_e)->prev)
|
||||
#define PR_PREV_LINK(_e) \
|
||||
((_e)->prev)
|
||||
|
||||
/*
|
||||
** Append an element "_e" to the end of the list "_l"
|
||||
@@ -68,10 +68,10 @@ struct PRCListStr {
|
||||
/*
|
||||
** Remove the element "_e" from it's circular list.
|
||||
*/
|
||||
#define PR_REMOVE_LINK(_e) \
|
||||
PR_BEGIN_MACRO \
|
||||
(_e)->prev->next = (_e)->next; \
|
||||
(_e)->next->prev = (_e)->prev; \
|
||||
#define PR_REMOVE_LINK(_e) \
|
||||
PR_BEGIN_MACRO \
|
||||
(_e)->prev->next = (_e)->next; \
|
||||
(_e)->next->prev = (_e)->prev; \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
@@ -79,11 +79,11 @@ struct PRCListStr {
|
||||
** linkage.
|
||||
*/
|
||||
#define PR_REMOVE_AND_INIT_LINK(_e) \
|
||||
PR_BEGIN_MACRO \
|
||||
(_e)->prev->next = (_e)->next; \
|
||||
(_e)->next->prev = (_e)->prev; \
|
||||
(_e)->next = (_e); \
|
||||
(_e)->prev = (_e); \
|
||||
PR_BEGIN_MACRO \
|
||||
(_e)->prev->next = (_e)->next; \
|
||||
(_e)->next->prev = (_e)->prev; \
|
||||
(_e)->next = (_e); \
|
||||
(_e)->prev = (_e); \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
@@ -97,9 +97,9 @@ struct PRCListStr {
|
||||
** Initialize a circular list
|
||||
*/
|
||||
#define PR_INIT_CLIST(_l) \
|
||||
PR_BEGIN_MACRO \
|
||||
(_l)->next = (_l); \
|
||||
(_l)->prev = (_l); \
|
||||
PR_BEGIN_MACRO \
|
||||
(_l)->next = (_l); \
|
||||
(_l)->prev = (_l); \
|
||||
PR_END_MACRO
|
||||
|
||||
#define PR_INIT_STATIC_CLIST(_l) \
|
||||
|
||||
+153
-153
@@ -13,43 +13,43 @@
|
||||
** something." Counters can be dynamically defined, incremented,
|
||||
** decremented, set, and deleted under application program
|
||||
** control.
|
||||
**
|
||||
** The Counter Feature is intended to be used as instrumentation,
|
||||
** not as operational data. If you need a counter for operational
|
||||
** data, use native integral types.
|
||||
**
|
||||
** Counters are 32bit unsigned intergers. On overflow, a counter
|
||||
** will wrap. No exception is recognized or reported.
|
||||
**
|
||||
**
|
||||
** The Counter Feature is intended to be used as instrumentation,
|
||||
** not as operational data. If you need a counter for operational
|
||||
** data, use native integral types.
|
||||
**
|
||||
** Counters are 32bit unsigned intergers. On overflow, a counter
|
||||
** will wrap. No exception is recognized or reported.
|
||||
**
|
||||
** A counter can be dynamically created using a two level naming
|
||||
** convention. A "handle" is returned when the counter is
|
||||
** created. The counter can subsequently be addressed by its
|
||||
** handle. An API is provided to get an existing counter's handle
|
||||
** given the names with which it was originally created.
|
||||
** given the names with which it was originally created.
|
||||
** Similarly, a counter's name can be retrieved given its handle.
|
||||
**
|
||||
**
|
||||
** The counter naming convention is a two-level hierarchy. The
|
||||
** QName is the higher level of the hierarchy; RName is the
|
||||
** lower level. RNames can be thought of as existing within a
|
||||
** QName. The same RName can exist within multiple QNames. QNames
|
||||
** are unique. The NSPR Counter is not a near-zero overhead
|
||||
** feature. Application designers should be aware of
|
||||
** feature. Application designers should be aware of
|
||||
** serialization issues when using the Counter API. Creating a
|
||||
** counter locks a large asset, potentially causing a stall. This
|
||||
** suggest that applications should create counters at component
|
||||
** initialization, for example, and not create and destroy them
|
||||
** willy-nilly. ... You have been warned.
|
||||
**
|
||||
**
|
||||
** Incrementing and Adding to counters uses atomic operations.
|
||||
** The performance of these operations will vary from platform
|
||||
** to platform. On platforms where atomic operations are not
|
||||
** supported the overhead may be substantial.
|
||||
**
|
||||
**
|
||||
** When traversing the counter database with FindNext functions,
|
||||
** the instantaneous values of any given counter is that at the
|
||||
** moment of extraction. The state of the entire counter database
|
||||
** may not be viewed as atomic.
|
||||
**
|
||||
**
|
||||
** The counter interface may be disabled (No-Op'd) at compile
|
||||
** time. When DEBUG is defined at compile time, the Counter
|
||||
** Feature is compiled into NSPR and applications invoking it.
|
||||
@@ -57,18 +57,18 @@
|
||||
** nothing. To force the Counter Feature to be compiled into an
|
||||
** optimized build, define FORCE_NSPR_COUNTERS at compile time
|
||||
** for both NSPR and the application intending to use it.
|
||||
**
|
||||
**
|
||||
** Application designers should use the macro form of the Counter
|
||||
** Feature methods to minimize performance impact in optimized
|
||||
** builds. The macros normally compile to nothing on optimized
|
||||
** builds.
|
||||
**
|
||||
**
|
||||
** Application designers should be aware of the effects of
|
||||
** debug and optimized build differences when using result of the
|
||||
** Counter Feature macros in expressions.
|
||||
**
|
||||
**
|
||||
** The Counter Feature is thread-safe and SMP safe.
|
||||
**
|
||||
**
|
||||
** /lth. 09-Jun-1998.
|
||||
*/
|
||||
|
||||
@@ -90,20 +90,20 @@ typedef void * PRCounterHandle;
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
** FUNCTION: PR_DEFINE_COUNTER() -- Define a PRCounterHandle
|
||||
**
|
||||
**
|
||||
** DESCRIPTION: PR_DEFINE_COUNTER() is used to define a counter
|
||||
** handle.
|
||||
**
|
||||
**
|
||||
*/
|
||||
#define PR_DEFINE_COUNTER(name) PRCounterHandle name
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
** FUNCTION: PR_INIT_COUNTER_HANDLE() -- Set the value of a PRCounterHandle
|
||||
**
|
||||
** DESCRIPTION:
|
||||
**
|
||||
** DESCRIPTION:
|
||||
** PR_INIT_COUNTER_HANDLE() sets the value of a PRCounterHandle
|
||||
** to value.
|
||||
**
|
||||
**
|
||||
*/
|
||||
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
||||
#define PR_INIT_COUNTER_HANDLE(handle,value)\
|
||||
@@ -114,32 +114,32 @@ typedef void * PRCounterHandle;
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
** FUNCTION: PR_CreateCounter() -- Create a counter
|
||||
**
|
||||
**
|
||||
** DESCRIPTION: PR_CreateCounter() creates a counter object and
|
||||
** initializes it to zero.
|
||||
**
|
||||
**
|
||||
** The macro form takes as its first argument the name of the
|
||||
** PRCounterHandle to receive the handle returned from
|
||||
** PR_CreateCounter().
|
||||
**
|
||||
**
|
||||
** INPUTS:
|
||||
** qName: The QName for the counter object. The maximum length
|
||||
** of qName is defined by PRCOUNTER_NAME_MAX
|
||||
**
|
||||
**
|
||||
** rName: The RName for the counter object. The maximum length
|
||||
** of qName is defined by PRCOUNTER_NAME_MAX
|
||||
**
|
||||
**
|
||||
** descrioption: The description of the counter object. The
|
||||
** maximum length of description is defined by
|
||||
** PRCOUNTER_DESC_MAX.
|
||||
**
|
||||
**
|
||||
** OUTPUTS:
|
||||
**
|
||||
**
|
||||
** RETURNS:
|
||||
** PRCounterHandle.
|
||||
**
|
||||
**
|
||||
** RESTRICTIONS:
|
||||
**
|
||||
**
|
||||
*/
|
||||
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
||||
#define PR_CREATE_COUNTER(handle,qName,rName,description)\
|
||||
@@ -148,29 +148,29 @@ typedef void * PRCounterHandle;
|
||||
#define PR_CREATE_COUNTER(handle,qName,rName,description)
|
||||
#endif
|
||||
|
||||
NSPR_API(PRCounterHandle)
|
||||
PR_CreateCounter(
|
||||
const char *qName,
|
||||
const char *rName,
|
||||
const char *description
|
||||
NSPR_API(PRCounterHandle)
|
||||
PR_CreateCounter(
|
||||
const char *qName,
|
||||
const char *rName,
|
||||
const char *description
|
||||
);
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
** FUNCTION: PR_DestroyCounter() -- Destroy a counter object.
|
||||
**
|
||||
**
|
||||
** DESCRIPTION: PR_DestroyCounter() removes a counter and
|
||||
** unregisters its handle from the counter database.
|
||||
**
|
||||
**
|
||||
** INPUTS:
|
||||
** handle: the PRCounterHandle of the counter to be destroyed.
|
||||
**
|
||||
** OUTPUTS:
|
||||
**
|
||||
** OUTPUTS:
|
||||
** The counter is destroyed.
|
||||
**
|
||||
**
|
||||
** RETURNS: void
|
||||
**
|
||||
**
|
||||
** RESTRICTIONS:
|
||||
**
|
||||
**
|
||||
*/
|
||||
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
||||
#define PR_DESTROY_COUNTER(handle) PR_DestroyCounter((handle))
|
||||
@@ -178,31 +178,31 @@ NSPR_API(PRCounterHandle)
|
||||
#define PR_DESTROY_COUNTER(handle)
|
||||
#endif
|
||||
|
||||
NSPR_API(void)
|
||||
PR_DestroyCounter(
|
||||
PRCounterHandle handle
|
||||
NSPR_API(void)
|
||||
PR_DestroyCounter(
|
||||
PRCounterHandle handle
|
||||
);
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
** FUNCTION: PR_GetCounterHandleFromName() -- Retreive a
|
||||
** counter's handle give its name.
|
||||
**
|
||||
**
|
||||
** DESCRIPTION: PR_GetCounterHandleFromName() retreives a
|
||||
** counter's handle from the counter database, given the name
|
||||
** the counter was originally created with.
|
||||
**
|
||||
**
|
||||
** INPUTS:
|
||||
** qName: Counter's original QName.
|
||||
** rName: Counter's original RName.
|
||||
**
|
||||
**
|
||||
** OUTPUTS:
|
||||
**
|
||||
** RETURNS:
|
||||
**
|
||||
** RETURNS:
|
||||
** PRCounterHandle or PRCounterError.
|
||||
**
|
||||
**
|
||||
** RESTRICTIONS:
|
||||
**
|
||||
**
|
||||
*/
|
||||
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
||||
#define PR_GET_COUNTER_HANDLE_FROM_NAME(handle,qName,rName)\
|
||||
@@ -211,31 +211,31 @@ NSPR_API(void)
|
||||
#define PR_GET_COUNTER_HANDLE_FROM_NAME(handle,qName,rName)
|
||||
#endif
|
||||
|
||||
NSPR_API(PRCounterHandle)
|
||||
PR_GetCounterHandleFromName(
|
||||
const char *qName,
|
||||
const char *rName
|
||||
NSPR_API(PRCounterHandle)
|
||||
PR_GetCounterHandleFromName(
|
||||
const char *qName,
|
||||
const char *rName
|
||||
);
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
** FUNCTION: PR_GetCounterNameFromHandle() -- Retreive a
|
||||
** counter's name, given its handle.
|
||||
**
|
||||
**
|
||||
** DESCRIPTION: PR_GetCounterNameFromHandle() retreives a
|
||||
** counter's name given its handle.
|
||||
**
|
||||
**
|
||||
** INPUTS:
|
||||
** qName: Where to store a pointer to qName.
|
||||
** rName: Where to store a pointer to rName.
|
||||
** description: Where to store a pointer to description.
|
||||
**
|
||||
**
|
||||
** OUTPUTS: Pointers to the Counter Feature's copies of the names
|
||||
** used when the counters were created.
|
||||
**
|
||||
**
|
||||
** RETURNS: void
|
||||
**
|
||||
**
|
||||
** RESTRICTIONS:
|
||||
**
|
||||
**
|
||||
*/
|
||||
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
||||
#define PR_GET_COUNTER_NAME_FROM_HANDLE(handle,qName,rName,description)\
|
||||
@@ -244,30 +244,30 @@ NSPR_API(PRCounterHandle)
|
||||
#define PR_GET_COUNTER_NAME_FROM_HANDLE(handle,qName,rName,description )
|
||||
#endif
|
||||
|
||||
NSPR_API(void)
|
||||
PR_GetCounterNameFromHandle(
|
||||
PRCounterHandle handle,
|
||||
const char **qName,
|
||||
const char **rName,
|
||||
const char **description
|
||||
NSPR_API(void)
|
||||
PR_GetCounterNameFromHandle(
|
||||
PRCounterHandle handle,
|
||||
const char **qName,
|
||||
const char **rName,
|
||||
const char **description
|
||||
);
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
** FUNCTION: PR_IncrementCounter() -- Add one to the referenced
|
||||
** counter.
|
||||
**
|
||||
**
|
||||
** DESCRIPTION: Add one to the referenced counter.
|
||||
**
|
||||
**
|
||||
** INPUTS:
|
||||
** handle: The PRCounterHandle of the counter to be incremented
|
||||
**
|
||||
**
|
||||
** OUTPUTS: The counter is incrementd.
|
||||
**
|
||||
**
|
||||
** RETURNS: void
|
||||
**
|
||||
**
|
||||
** RESTRICTIONS:
|
||||
**
|
||||
**
|
||||
*/
|
||||
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
||||
#define PR_INCREMENT_COUNTER(handle) PR_IncrementCounter(handle)
|
||||
@@ -275,28 +275,28 @@ NSPR_API(void)
|
||||
#define PR_INCREMENT_COUNTER(handle)
|
||||
#endif
|
||||
|
||||
NSPR_API(void)
|
||||
PR_IncrementCounter(
|
||||
PRCounterHandle handle
|
||||
NSPR_API(void)
|
||||
PR_IncrementCounter(
|
||||
PRCounterHandle handle
|
||||
);
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
** FUNCTION: PR_DecrementCounter() -- Subtract one from the
|
||||
** referenced counter
|
||||
**
|
||||
**
|
||||
** DESCRIPTION: Subtract one from the referenced counter.
|
||||
**
|
||||
** INPUTS:
|
||||
**
|
||||
** INPUTS:
|
||||
** handle: The PRCounterHandle of the coutner to be
|
||||
** decremented.
|
||||
**
|
||||
**
|
||||
** OUTPUTS: the counter is decremented.
|
||||
**
|
||||
**
|
||||
** RETURNS: void
|
||||
**
|
||||
**
|
||||
** RESTRICTIONS:
|
||||
**
|
||||
**
|
||||
*/
|
||||
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
||||
#define PR_DECREMENT_COUNTER(handle) PR_DecrementCounter(handle)
|
||||
@@ -304,27 +304,27 @@ NSPR_API(void)
|
||||
#define PR_DECREMENT_COUNTER(handle)
|
||||
#endif
|
||||
|
||||
NSPR_API(void)
|
||||
PR_DecrementCounter(
|
||||
PRCounterHandle handle
|
||||
NSPR_API(void)
|
||||
PR_DecrementCounter(
|
||||
PRCounterHandle handle
|
||||
);
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
** FUNCTION: PR_AddToCounter() -- Add a value to a counter.
|
||||
**
|
||||
**
|
||||
** DESCRIPTION: Add value to the counter referenced by handle.
|
||||
**
|
||||
**
|
||||
** INPUTS:
|
||||
** handle: the PRCounterHandle of the counter to be added to.
|
||||
**
|
||||
**
|
||||
** value: the value to be added to the counter.
|
||||
**
|
||||
**
|
||||
** OUTPUTS: new value for counter.
|
||||
**
|
||||
**
|
||||
** RETURNS: void
|
||||
**
|
||||
**
|
||||
** RESTRICTIONS:
|
||||
**
|
||||
**
|
||||
*/
|
||||
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
||||
#define PR_ADD_TO_COUNTER(handle,value)\
|
||||
@@ -333,32 +333,32 @@ NSPR_API(void)
|
||||
#define PR_ADD_TO_COUNTER(handle,value)
|
||||
#endif
|
||||
|
||||
NSPR_API(void)
|
||||
PR_AddToCounter(
|
||||
PRCounterHandle handle,
|
||||
PRUint32 value
|
||||
NSPR_API(void)
|
||||
PR_AddToCounter(
|
||||
PRCounterHandle handle,
|
||||
PRUint32 value
|
||||
);
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
** FUNCTION: PR_SubtractFromCounter() -- A value is subtracted
|
||||
** from a counter.
|
||||
**
|
||||
**
|
||||
** DESCRIPTION:
|
||||
** Subtract a value from a counter.
|
||||
**
|
||||
**
|
||||
** INPUTS:
|
||||
** handle: the PRCounterHandle of the counter to be subtracted
|
||||
** from.
|
||||
**
|
||||
**
|
||||
** value: the value to be subtracted from the counter.
|
||||
**
|
||||
**
|
||||
** OUTPUTS: new value for counter
|
||||
**
|
||||
**
|
||||
** RETURNS: void
|
||||
**
|
||||
**
|
||||
** RESTRICTIONS:
|
||||
**
|
||||
**
|
||||
*/
|
||||
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
||||
#define PR_SUBTRACT_FROM_COUNTER(handle,value)\
|
||||
@@ -367,28 +367,28 @@ NSPR_API(void)
|
||||
#define PR_SUBTRACT_FROM_COUNTER(handle,value)
|
||||
#endif
|
||||
|
||||
NSPR_API(void)
|
||||
PR_SubtractFromCounter(
|
||||
PRCounterHandle handle,
|
||||
PRUint32 value
|
||||
NSPR_API(void)
|
||||
PR_SubtractFromCounter(
|
||||
PRCounterHandle handle,
|
||||
PRUint32 value
|
||||
);
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
** FUNCTION: PR_GetCounter() -- Retreive the value of a counter
|
||||
**
|
||||
**
|
||||
** DESCRIPTION:
|
||||
** Retreive the value of a counter.
|
||||
**
|
||||
**
|
||||
** INPUTS:
|
||||
** handle: the PR_CounterHandle of the counter to be retreived
|
||||
**
|
||||
**
|
||||
** OUTPUTS:
|
||||
**
|
||||
**
|
||||
** RETURNS: The value of the referenced counter
|
||||
**
|
||||
**
|
||||
** RESTRICTIONS:
|
||||
**
|
||||
**
|
||||
*/
|
||||
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
||||
#define PR_GET_COUNTER(counter,handle)\
|
||||
@@ -397,30 +397,30 @@ NSPR_API(void)
|
||||
#define PR_GET_COUNTER(counter,handle) 0
|
||||
#endif
|
||||
|
||||
NSPR_API(PRUint32)
|
||||
PR_GetCounter(
|
||||
PRCounterHandle handle
|
||||
NSPR_API(PRUint32)
|
||||
PR_GetCounter(
|
||||
PRCounterHandle handle
|
||||
);
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
** FUNCTION: PR_SetCounter() -- Replace the content of counter
|
||||
** with value.
|
||||
**
|
||||
**
|
||||
** DESCRIPTION: The contents of the referenced counter are
|
||||
** replaced by value.
|
||||
**
|
||||
**
|
||||
** INPUTS:
|
||||
** handle: the PRCounterHandle of the counter whose contents
|
||||
** are to be replaced.
|
||||
**
|
||||
**
|
||||
** value: the new value of the counter.
|
||||
**
|
||||
**
|
||||
** OUTPUTS:
|
||||
**
|
||||
**
|
||||
** RETURNS: void
|
||||
**
|
||||
**
|
||||
** RESTRICTIONS:
|
||||
**
|
||||
**
|
||||
*/
|
||||
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
||||
#define PR_SET_COUNTER(handle,value) PR_SetCounter((handle),(value))
|
||||
@@ -428,17 +428,17 @@ NSPR_API(PRUint32)
|
||||
#define PR_SET_COUNTER(handle,value)
|
||||
#endif
|
||||
|
||||
NSPR_API(void)
|
||||
PR_SetCounter(
|
||||
PRCounterHandle handle,
|
||||
PRUint32 value
|
||||
NSPR_API(void)
|
||||
PR_SetCounter(
|
||||
PRCounterHandle handle,
|
||||
PRUint32 value
|
||||
);
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
** FUNCTION: PR_FindNextCounterQname() -- Retreive the next QName counter
|
||||
** handle iterator
|
||||
**
|
||||
**
|
||||
** DESCRIPTION:
|
||||
** PR_FindNextCounterQname() retreives the first or next Qname
|
||||
** the counter data base, depending on the value of handle. When
|
||||
@@ -446,23 +446,23 @@ NSPR_API(void)
|
||||
** QName handle in the database. When handle is a handle previosly
|
||||
** retreived QName handle, then the function attempts to retreive
|
||||
** the next QName handle.
|
||||
**
|
||||
** INPUTS:
|
||||
**
|
||||
** INPUTS:
|
||||
** handle: PRCounterHandle or NULL.
|
||||
**
|
||||
**
|
||||
** OUTPUTS: returned
|
||||
**
|
||||
**
|
||||
** RETURNS: PRCounterHandle or NULL when no more QName counter
|
||||
** handles are present.
|
||||
**
|
||||
**
|
||||
** RESTRICTIONS:
|
||||
** A concurrent PR_CreateCounter() or PR_DestroyCounter() may
|
||||
** cause unpredictable results.
|
||||
**
|
||||
**
|
||||
** A PRCounterHandle returned from this function may only be used
|
||||
** in another PR_FindNextCounterQname() function call; other
|
||||
** operations may cause unpredictable results.
|
||||
**
|
||||
**
|
||||
*/
|
||||
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
||||
#define PR_FIND_NEXT_COUNTER_QNAME(next,handle)\
|
||||
@@ -471,15 +471,15 @@ NSPR_API(void)
|
||||
#define PR_FIND_NEXT_COUNTER_QNAME(next,handle) NULL
|
||||
#endif
|
||||
|
||||
NSPR_API(PRCounterHandle)
|
||||
PR_FindNextCounterQname(
|
||||
PRCounterHandle handle
|
||||
NSPR_API(PRCounterHandle)
|
||||
PR_FindNextCounterQname(
|
||||
PRCounterHandle handle
|
||||
);
|
||||
|
||||
/* -----------------------------------------------------------------------
|
||||
** FUNCTION: PR_FindNextCounterRname() -- Retreive the next RName counter
|
||||
** handle iterator
|
||||
**
|
||||
**
|
||||
** DESCRIPTION:
|
||||
** PR_FindNextCounterRname() retreives the first or next RNname
|
||||
** handle from the counter data base, depending on the
|
||||
@@ -487,25 +487,25 @@ NSPR_API(PRCounterHandle)
|
||||
** retreive the first RName handle in the database. When handle is
|
||||
** a handle previosly retreived RName handle, then the function
|
||||
** attempts to retreive the next RName handle.
|
||||
**
|
||||
**
|
||||
** INPUTS:
|
||||
** handle: PRCounterHandle or NULL.
|
||||
** qhandle: PRCounterHandle of a previously aquired via
|
||||
** PR_FIND_NEXT_QNAME_HANDLE()
|
||||
**
|
||||
**
|
||||
** OUTPUTS: returned
|
||||
**
|
||||
**
|
||||
** RETURNS: PRCounterHandle or NULL when no more RName counter
|
||||
** handles are present.
|
||||
**
|
||||
**
|
||||
** RESTRICTIONS:
|
||||
** A concurrent PR_CreateCounter() or PR_DestroyCounter() may
|
||||
** cause unpredictable results.
|
||||
**
|
||||
**
|
||||
** A PRCounterHandle returned from this function may only be used
|
||||
** in another PR_FindNextCounterRname() function call; other
|
||||
** operations may cause unpredictable results.
|
||||
**
|
||||
**
|
||||
*/
|
||||
#if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
||||
#define PR_FIND_NEXT_COUNTER_RNAME(next,rhandle,qhandle)\
|
||||
@@ -514,10 +514,10 @@ NSPR_API(PRCounterHandle)
|
||||
#define PR_FIND_NEXT_COUNTER_RNAME(next,rhandle,qhandle)
|
||||
#endif
|
||||
|
||||
NSPR_API(PRCounterHandle)
|
||||
PR_FindNextCounterRname(
|
||||
PRCounterHandle rhandle,
|
||||
PRCounterHandle qhandle
|
||||
NSPR_API(PRCounterHandle)
|
||||
PR_FindNextCounterRname(
|
||||
PRCounterHandle rhandle,
|
||||
PRCounterHandle qhandle
|
||||
);
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
@@ -16,7 +16,7 @@ typedef struct PRCondVar PRCondVar;
|
||||
/*
|
||||
** Create a new condition variable.
|
||||
**
|
||||
** "lock" is the lock used to protect the condition variable.
|
||||
** "lock" is the lock used to protect the condition variable.
|
||||
**
|
||||
** Condition variables are synchronization objects that threads can use
|
||||
** to wait for some condition to occur.
|
||||
@@ -68,7 +68,7 @@ NSPR_API(PRStatus) PR_WaitCondVar(PRCondVar *cvar, PRIntervalTime timeout);
|
||||
** Notify ONE thread that is currently waiting on 'cvar'. Which thread is
|
||||
** dependent on the implementation of the runtime. Common sense would dictate
|
||||
** that all threads waiting on a single condition have identical semantics,
|
||||
** therefore which one gets notified is not significant.
|
||||
** therefore which one gets notified is not significant.
|
||||
**
|
||||
** The calling thead must hold the lock that protects the condition, as
|
||||
** well as the invariants that are tightly bound to the condition, when
|
||||
|
||||
@@ -44,7 +44,7 @@ NSPR_API(void) PR_cnvtf(char *buf, PRIntn bufsz, PRIntn prcsn, PRFloat64 fval);
|
||||
** and rounded to nearest.
|
||||
*/
|
||||
NSPR_API(PRStatus) PR_dtoa(PRFloat64 d, PRIntn mode, PRIntn ndigits,
|
||||
PRIntn *decpt, PRIntn *sign, char **rve, char *buf, PRSize bufsize);
|
||||
PRIntn *decpt, PRIntn *sign, char **rve, char *buf, PRSize bufsize);
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
|
||||
+26
-26
@@ -18,18 +18,18 @@ PR_BEGIN_EXTERN_C
|
||||
|
||||
/*
|
||||
** PR_GetEnv() -- Retrieve value of environment variable
|
||||
**
|
||||
**
|
||||
** Description:
|
||||
** PR_GetEnv() is modeled on Unix getenv().
|
||||
**
|
||||
**
|
||||
** Inputs:
|
||||
**
|
||||
**
|
||||
** Inputs:
|
||||
** var -- The name of the environment variable
|
||||
**
|
||||
**
|
||||
** Returns:
|
||||
** The value of the environment variable 'var' or NULL if
|
||||
** the variable is undefined.
|
||||
**
|
||||
**
|
||||
** Restrictions:
|
||||
** You'd think that a POSIX getenv(), putenv() would be
|
||||
** consistently implemented everywhere. Surprise! It is not. On
|
||||
@@ -42,33 +42,33 @@ PR_BEGIN_EXTERN_C
|
||||
** un-set; a subsequent call to getenv() returns NULL. On
|
||||
** other platforms, a subsequent call to getenv() returns a
|
||||
** pointer to a null-string (a byte of zero).
|
||||
**
|
||||
** PR_GetEnv(), PR_SetEnv() provide a consistent behavior
|
||||
**
|
||||
** PR_GetEnv(), PR_SetEnv() provide a consistent behavior
|
||||
** across all supported platforms. There are, however, some
|
||||
** restrictions and some practices you must use to achieve
|
||||
** consistent results everywhere.
|
||||
**
|
||||
**
|
||||
** When manipulating the environment there is no way to un-set
|
||||
** an environment variable across all platforms. We suggest
|
||||
** you interpret the return of a pointer to null-string to
|
||||
** mean the same as a return of NULL from PR_GetEnv().
|
||||
**
|
||||
**
|
||||
** A call to PR_SetEnv() where the parameter is of the form
|
||||
** "name" will return PR_FAILURE; the environment remains
|
||||
** unchanged. A call to PR_SetEnv() where the parameter is
|
||||
** of the form "name=" may un-set the envrionment variable on
|
||||
** some platforms; on others it may set the value of the
|
||||
** environment variable to the null-string.
|
||||
**
|
||||
**
|
||||
** For example, to test for NULL return or return of the
|
||||
** null-string from PR_GetEnv(), use the following code
|
||||
** fragment:
|
||||
**
|
||||
**
|
||||
** char *val = PR_GetEnv("foo");
|
||||
** if ((NULL == val) || ('\0' == *val)) {
|
||||
** ... interpret this as un-set ...
|
||||
** if ((NULL == val) || ('\0' == *val)) {
|
||||
** ... interpret this as un-set ...
|
||||
** }
|
||||
**
|
||||
**
|
||||
** The caller must ensure that the string passed
|
||||
** to PR_SetEnv() is persistent. That is: The string should
|
||||
** not be on the stack, where it can be overwritten
|
||||
@@ -77,16 +77,16 @@ PR_BEGIN_EXTERN_C
|
||||
** overwritten by other actions of the process. ... Some
|
||||
** platforms use the string by reference rather than copying
|
||||
** it into the environment space. ... You have been warned!
|
||||
**
|
||||
**
|
||||
** Use of platform-native functions that manipulate the
|
||||
** environment (getenv(), putenv(),
|
||||
** environment (getenv(), putenv(),
|
||||
** SetEnvironmentVariable(), etc.) must not be used with
|
||||
** NSPR's similar functions. The platform-native functions
|
||||
** may not be thread safe and/or may operate on different
|
||||
** conceptual environment space than that operated upon by
|
||||
** NSPR's functions or other environment manipulating
|
||||
** functions on the same platform. (!)
|
||||
**
|
||||
**
|
||||
*/
|
||||
NSPR_API(char*) PR_GetEnv(const char *var);
|
||||
|
||||
@@ -106,24 +106,24 @@ NSPR_API(char*) PR_GetEnvSecure(const char *var);
|
||||
|
||||
/*
|
||||
** PR_SetEnv() -- set, unset or change an environment variable
|
||||
**
|
||||
**
|
||||
** Description:
|
||||
** PR_SetEnv() is modeled on the Unix putenv() function.
|
||||
**
|
||||
** Inputs:
|
||||
**
|
||||
** Inputs:
|
||||
** string -- pointer to a caller supplied
|
||||
** constant, persistent string of the form name=value. Where
|
||||
** name is the name of the environment variable to be set or
|
||||
** changed; value is the value assigned to the variable.
|
||||
**
|
||||
** Returns:
|
||||
** Returns:
|
||||
** PRStatus.
|
||||
**
|
||||
** Restrictions:
|
||||
**
|
||||
** Restrictions:
|
||||
** See the Restrictions documented in the description of
|
||||
** PR_GetEnv() in this header file.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
*/
|
||||
NSPR_API(PRStatus) PR_SetEnv(const char *string);
|
||||
|
||||
|
||||
@@ -80,13 +80,13 @@ purpose. It is provided "as is" without express or implied warranty.
|
||||
|
||||
/*
|
||||
* NOTE:
|
||||
* The interfaces for error-code-translation described in the rest of
|
||||
* this file are preliminary in the 3.1 release of nspr and are subject
|
||||
* to change in future releases.
|
||||
* The interfaces for error-code-translation described in the rest of
|
||||
* this file are preliminary in the 3.1 release of nspr and are subject
|
||||
* to change in future releases.
|
||||
*/
|
||||
|
||||
/*
|
||||
** Description: Localizable error code to string function.
|
||||
** Description: Localizable error code to string function.
|
||||
**
|
||||
**
|
||||
** NSPR provides a mechanism for converting an error code to a
|
||||
@@ -171,7 +171,7 @@ struct PRErrorTable {
|
||||
/*
|
||||
* struct PRErrorCallbackPrivate --
|
||||
*
|
||||
* A private structure for the localization plugin
|
||||
* A private structure for the localization plugin
|
||||
*/
|
||||
struct PRErrorCallbackPrivate;
|
||||
|
||||
@@ -194,10 +194,10 @@ struct PRErrorCallbackTablePrivate;
|
||||
* if no description can be found.
|
||||
*/
|
||||
typedef const char *
|
||||
PRErrorCallbackLookupFn(PRErrorCode code, PRLanguageCode language,
|
||||
const struct PRErrorTable *table,
|
||||
struct PRErrorCallbackPrivate *cb_private,
|
||||
struct PRErrorCallbackTablePrivate *table_private);
|
||||
PRErrorCallbackLookupFn(PRErrorCode code, PRLanguageCode language,
|
||||
const struct PRErrorTable *table,
|
||||
struct PRErrorCallbackPrivate *cb_private,
|
||||
struct PRErrorCallbackTablePrivate *table_private);
|
||||
|
||||
/*
|
||||
* PRErrorCallbackNewTableFn --
|
||||
@@ -211,7 +211,7 @@ PRErrorCallbackLookupFn(PRErrorCode code, PRLanguageCode language,
|
||||
*/
|
||||
typedef struct PRErrorCallbackTablePrivate *
|
||||
PRErrorCallbackNewTableFn(const struct PRErrorTable *table,
|
||||
struct PRErrorCallbackPrivate *cb_private);
|
||||
struct PRErrorCallbackPrivate *cb_private);
|
||||
|
||||
/**********************************************************************/
|
||||
/****************************** FUNCTIONS *****************************/
|
||||
@@ -228,7 +228,7 @@ PRErrorCallbackNewTableFn(const struct PRErrorTable *table,
|
||||
**
|
||||
***********************************************************************/
|
||||
NSPR_API(const char *) PR_ErrorToString(PRErrorCode code,
|
||||
PRLanguageCode language);
|
||||
PRLanguageCode language);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -266,7 +266,7 @@ NSPR_API(const char * const *) PR_ErrorLanguages(void);
|
||||
** of the process.
|
||||
**
|
||||
** NOT THREAD SAFE!
|
||||
**
|
||||
**
|
||||
***********************************************************************/
|
||||
NSPR_API(PRErrorCode) PR_ErrorInstallTable(const struct PRErrorTable *table);
|
||||
|
||||
@@ -285,9 +285,9 @@ NSPR_API(PRErrorCode) PR_ErrorInstallTable(const struct PRErrorTable *table);
|
||||
**
|
||||
***********************************************************************/
|
||||
NSPR_API(void) PR_ErrorInstallCallback(const char * const * languages,
|
||||
PRErrorCallbackLookupFn *lookup,
|
||||
PRErrorCallbackNewTableFn *newtable,
|
||||
struct PRErrorCallbackPrivate *cb_private);
|
||||
PRErrorCallbackLookupFn *lookup,
|
||||
PRErrorCallbackNewTableFn *newtable,
|
||||
struct PRErrorCallbackPrivate *cb_private);
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
* File: prinet.h
|
||||
* File: prinet.h
|
||||
* Description:
|
||||
* Header file used to find the system header files for socket support[1].
|
||||
* This file serves the following purposes:
|
||||
@@ -32,9 +32,9 @@
|
||||
#ifndef prinet_h__
|
||||
#define prinet_h__
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
|
||||
#if defined(XP_UNIX) || defined(XP_OS2)
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h> /* AF_INET */
|
||||
#include <sys/socket.h> /* AF_INET */
|
||||
#include <netinet/in.h> /* INADDR_ANY, ..., ntohl(), ... */
|
||||
#ifdef XP_OS2
|
||||
#include <sys/ioctl.h>
|
||||
@@ -70,7 +70,7 @@ struct sockaddr_dl;
|
||||
* Prototypes of ntohl() etc. are declared in <machine/endian.h>
|
||||
* on these platforms.
|
||||
*/
|
||||
#if defined(BSDI) || defined(OSF1)
|
||||
#if defined(BSDI)
|
||||
#include <machine/endian.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ PR_BEGIN_EXTERN_C
|
||||
** The format of the version string is
|
||||
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
|
||||
*/
|
||||
#define PR_VERSION "4.21 Beta"
|
||||
#define PR_VERSION "4.24"
|
||||
#define PR_VMAJOR 4
|
||||
#define PR_VMINOR 21
|
||||
#define PR_VMINOR 24
|
||||
#define PR_VPATCH 0
|
||||
#define PR_BETA PR_TRUE
|
||||
#define PR_BETA PR_FALSE
|
||||
|
||||
/*
|
||||
** PRVersionCheck
|
||||
@@ -132,25 +132,25 @@ NSPR_API(PRStatus) PR_Cleanup(void);
|
||||
|
||||
/*
|
||||
** Disable Interrupts
|
||||
** Disables timer signals used for pre-emptive scheduling.
|
||||
** Disables timer signals used for pre-emptive scheduling.
|
||||
*/
|
||||
NSPR_API(void) PR_DisableClockInterrupts(void);
|
||||
|
||||
/*
|
||||
** Enables Interrupts
|
||||
** Enables timer signals used for pre-emptive scheduling.
|
||||
** Enables timer signals used for pre-emptive scheduling.
|
||||
*/
|
||||
NSPR_API(void) PR_EnableClockInterrupts(void);
|
||||
|
||||
/*
|
||||
** Block Interrupts
|
||||
** Blocks the timer signal used for pre-emptive scheduling
|
||||
** Blocks the timer signal used for pre-emptive scheduling
|
||||
*/
|
||||
NSPR_API(void) PR_BlockClockInterrupts(void);
|
||||
|
||||
/*
|
||||
** Unblock Interrupts
|
||||
** Unblocks the timer signal used for pre-emptive scheduling
|
||||
** Unblocks the timer signal used for pre-emptive scheduling
|
||||
*/
|
||||
NSPR_API(void) PR_UnblockClockInterrupts(void);
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
** File: prinrval.h
|
||||
** Description: API to interval timing functions of NSPR.
|
||||
** File: prinrval.h
|
||||
** Description: API to interval timing functions of NSPR.
|
||||
**
|
||||
**
|
||||
** NSPR provides interval times that are independent of network time
|
||||
@@ -34,7 +34,7 @@ typedef PRUint32 PRIntervalTime;
|
||||
** DESCRIPTION:
|
||||
** These two constants define the range (in ticks / second) of the
|
||||
** platform dependent type, PRIntervalTime. These constants bound both
|
||||
** the period and the resolution of a PRIntervalTime.
|
||||
** the period and the resolution of a PRIntervalTime.
|
||||
***********************************************************************/
|
||||
#define PR_INTERVAL_MIN 1000UL
|
||||
#define PR_INTERVAL_MAX 100000UL
|
||||
@@ -46,9 +46,9 @@ typedef PRUint32 PRIntervalTime;
|
||||
** Two reserved constants are defined in the PRIntervalTime namespace.
|
||||
** They are used to indicate that the process should wait no time (return
|
||||
** immediately) or wait forever (never time out), respectively.
|
||||
** Note: PR_INTERVAL_NO_TIMEOUT passed as input to PR_Connect is
|
||||
** Note: PR_INTERVAL_NO_TIMEOUT passed as input to PR_Connect is
|
||||
** interpreted as use the OS's connect timeout.
|
||||
**
|
||||
**
|
||||
***********************************************************************/
|
||||
#define PR_INTERVAL_NO_WAIT 0UL
|
||||
#define PR_INTERVAL_NO_TIMEOUT 0xffffffffUL
|
||||
@@ -66,13 +66,13 @@ typedef PRUint32 PRIntervalTime;
|
||||
** INPUTS: void
|
||||
** OUTPUTS: void
|
||||
** RETURN: PRIntervalTime
|
||||
**
|
||||
**
|
||||
** SIDE EFFECTS:
|
||||
** None
|
||||
** RESTRICTIONS:
|
||||
** The units of PRIntervalTime are platform dependent. They are chosen
|
||||
** such that they are appropriate for the host OS, yet provide sufficient
|
||||
** resolution and period to be useful to clients.
|
||||
** resolution and period to be useful to clients.
|
||||
** MEMORY: N/A
|
||||
** ALGORITHM: Platform dependent
|
||||
***********************************************************************/
|
||||
@@ -86,7 +86,7 @@ NSPR_API(PRIntervalTime) PR_IntervalNow(void);
|
||||
** INPUTS: void
|
||||
** OUTPUTS: void
|
||||
** RETURN: PRUint32
|
||||
**
|
||||
**
|
||||
** SIDE EFFECTS:
|
||||
** None
|
||||
** RESTRICTIONS:
|
||||
@@ -105,7 +105,7 @@ NSPR_API(PRUint32) PR_TicksPerSecond(void);
|
||||
** INPUTS: PRUint32
|
||||
** OUTPUTS: void
|
||||
** RETURN: PRIntervalTime
|
||||
**
|
||||
**
|
||||
** SIDE EFFECTS:
|
||||
** None
|
||||
** RESTRICTIONS:
|
||||
@@ -126,7 +126,7 @@ NSPR_API(PRIntervalTime) PR_MicrosecondsToInterval(PRUint32 micro);
|
||||
** INPUTS: PRIntervalTime
|
||||
** OUTPUTS: void
|
||||
** RETURN: PRUint32
|
||||
**
|
||||
**
|
||||
** SIDE EFFECTS:
|
||||
** None
|
||||
** RESTRICTIONS:
|
||||
|
||||
+94
-102
@@ -54,7 +54,7 @@ struct PRFileDesc {
|
||||
PRFilePrivate *secret; /* layer dependent data */
|
||||
PRFileDesc *lower, *higher; /* pointers to adjacent layers */
|
||||
void (PR_CALLBACK *dtor)(PRFileDesc *fd);
|
||||
/* A destructor function for layer */
|
||||
/* A destructor function for layer */
|
||||
PRDescIdentity identity; /* Identity of this particular layer */
|
||||
};
|
||||
|
||||
@@ -128,38 +128,30 @@ typedef enum PRTransmitFileFlags {
|
||||
*************************************************************************/
|
||||
|
||||
struct PRIPv6Addr {
|
||||
union {
|
||||
PRUint8 _S6_u8[16];
|
||||
PRUint16 _S6_u16[8];
|
||||
PRUint32 _S6_u32[4];
|
||||
PRUint64 _S6_u64[2];
|
||||
} _S6_un;
|
||||
union {
|
||||
PRUint8 _S6_u8[16];
|
||||
PRUint16 _S6_u16[8];
|
||||
PRUint32 _S6_u32[4];
|
||||
PRUint64 _S6_u64[2];
|
||||
} _S6_un;
|
||||
};
|
||||
#define pr_s6_addr _S6_un._S6_u8
|
||||
#define pr_s6_addr16 _S6_un._S6_u16
|
||||
#define pr_s6_addr32 _S6_un._S6_u32
|
||||
#define pr_s6_addr64 _S6_un._S6_u64
|
||||
#define pr_s6_addr _S6_un._S6_u8
|
||||
#define pr_s6_addr16 _S6_un._S6_u16
|
||||
#define pr_s6_addr32 _S6_un._S6_u32
|
||||
#define pr_s6_addr64 _S6_un._S6_u64
|
||||
|
||||
typedef struct PRIPv6Addr PRIPv6Addr;
|
||||
|
||||
union PRNetAddr {
|
||||
struct {
|
||||
PRUint16 family; /* address family (0x00ff maskable) */
|
||||
#ifdef XP_BEOS
|
||||
char data[10]; /* Be has a smaller structure */
|
||||
#else
|
||||
char data[14]; /* raw address data */
|
||||
#endif
|
||||
} raw;
|
||||
struct {
|
||||
PRUint16 family; /* address family (AF_INET) */
|
||||
PRUint16 port; /* port number */
|
||||
PRUint32 ip; /* The actual 32 bits of address */
|
||||
#ifdef XP_BEOS
|
||||
char pad[4]; /* Be has a smaller structure */
|
||||
#else
|
||||
char pad[8];
|
||||
#endif
|
||||
} inet;
|
||||
struct {
|
||||
PRUint16 family; /* address family (AF_INET6) */
|
||||
@@ -173,7 +165,7 @@ union PRNetAddr {
|
||||
PRUint16 family; /* address family (AF_UNIX) */
|
||||
#ifdef XP_OS2
|
||||
char path[108]; /* null-terminated pathname */
|
||||
/* bind fails if size is not 108. */
|
||||
/* bind fails if size is not 108. */
|
||||
#else
|
||||
char path[104]; /* null-terminated pathname */
|
||||
#endif
|
||||
@@ -217,13 +209,13 @@ typedef enum PRSockOption
|
||||
} PRSockOption;
|
||||
|
||||
typedef struct PRLinger {
|
||||
PRBool polarity; /* Polarity of the option's setting */
|
||||
PRIntervalTime linger; /* Time to linger before closing */
|
||||
PRBool polarity; /* Polarity of the option's setting */
|
||||
PRIntervalTime linger; /* Time to linger before closing */
|
||||
} PRLinger;
|
||||
|
||||
typedef struct PRMcastRequest {
|
||||
PRNetAddr mcaddr; /* IP multicast address of group */
|
||||
PRNetAddr ifaddr; /* local IP address of interface */
|
||||
PRNetAddr mcaddr; /* IP multicast address of group */
|
||||
PRNetAddr ifaddr; /* local IP address of interface */
|
||||
} PRMcastRequest;
|
||||
|
||||
typedef struct PRSocketOptionData
|
||||
@@ -341,8 +333,8 @@ typedef PRInt32 (PR_CALLBACK *PRAcceptreadFN)(
|
||||
PRFileDesc *sd, PRFileDesc **nd, PRNetAddr **raddr,
|
||||
void *buf, PRInt32 amount, PRIntervalTime t);
|
||||
typedef PRInt32 (PR_CALLBACK *PRTransmitfileFN)(
|
||||
PRFileDesc *sd, PRFileDesc *fd, const void *headers,
|
||||
PRInt32 hlen, PRTransmitFileFlags flags, PRIntervalTime t);
|
||||
PRFileDesc *sd, PRFileDesc *fd, const void *headers,
|
||||
PRInt32 hlen, PRTransmitFileFlags flags, PRIntervalTime t);
|
||||
typedef PRStatus (PR_CALLBACK *PRGetsocknameFN)(PRFileDesc *fd, PRNetAddr *addr);
|
||||
typedef PRStatus (PR_CALLBACK *PRGetpeernameFN)(PRFileDesc *fd, PRNetAddr *addr);
|
||||
typedef PRStatus (PR_CALLBACK *PRGetsocketoptionFN)(
|
||||
@@ -350,8 +342,8 @@ typedef PRStatus (PR_CALLBACK *PRGetsocketoptionFN)(
|
||||
typedef PRStatus (PR_CALLBACK *PRSetsocketoptionFN)(
|
||||
PRFileDesc *fd, const PRSocketOptionData *data);
|
||||
typedef PRInt32 (PR_CALLBACK *PRSendfileFN)(
|
||||
PRFileDesc *networkSocket, PRSendFileData *sendData,
|
||||
PRTransmitFileFlags flags, PRIntervalTime timeout);
|
||||
PRFileDesc *networkSocket, PRSendFileData *sendData,
|
||||
PRTransmitFileFlags flags, PRIntervalTime timeout);
|
||||
typedef PRStatus (PR_CALLBACK *PRConnectcontinueFN)(
|
||||
PRFileDesc *fd, PRInt16 out_flags);
|
||||
typedef PRIntn (PR_CALLBACK *PRReservedFN)(PRFileDesc *fd);
|
||||
@@ -386,16 +378,16 @@ struct PRIOMethods {
|
||||
PRReservedFN reserved_fn_6; /* reserved for future use */
|
||||
PRReservedFN reserved_fn_5; /* reserved for future use */
|
||||
PRGetsocketoptionFN getsocketoption;
|
||||
/* Get current setting of specified option */
|
||||
/* Get current setting of specified option */
|
||||
PRSetsocketoptionFN setsocketoption;
|
||||
/* Set value of specified option */
|
||||
PRSendfileFN sendfile; /* Send a (partial) file with header/trailer*/
|
||||
/* Set value of specified option */
|
||||
PRSendfileFN sendfile; /* Send a (partial) file with header/trailer*/
|
||||
PRConnectcontinueFN connectcontinue;
|
||||
/* Continue a nonblocking connect */
|
||||
PRReservedFN reserved_fn_3; /* reserved for future use */
|
||||
PRReservedFN reserved_fn_2; /* reserved for future use */
|
||||
PRReservedFN reserved_fn_1; /* reserved for future use */
|
||||
PRReservedFN reserved_fn_0; /* reserved for future use */
|
||||
/* Continue a nonblocking connect */
|
||||
PRReservedFN reserved_fn_3; /* reserved for future use */
|
||||
PRReservedFN reserved_fn_2; /* reserved for future use */
|
||||
PRReservedFN reserved_fn_1; /* reserved for future use */
|
||||
PRReservedFN reserved_fn_0; /* reserved for future use */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -426,9 +418,9 @@ typedef enum PRSpecialFD
|
||||
|
||||
NSPR_API(PRFileDesc*) PR_GetSpecialFD(PRSpecialFD id);
|
||||
|
||||
#define PR_STDIN PR_GetSpecialFD(PR_StandardInput)
|
||||
#define PR_STDOUT PR_GetSpecialFD(PR_StandardOutput)
|
||||
#define PR_STDERR PR_GetSpecialFD(PR_StandardError)
|
||||
#define PR_STDIN PR_GetSpecialFD(PR_StandardInput)
|
||||
#define PR_STDOUT PR_GetSpecialFD(PR_StandardOutput)
|
||||
#define PR_STDERR PR_GetSpecialFD(PR_StandardError)
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
@@ -498,7 +490,7 @@ NSPR_API(PRFileDesc*) PR_CreateIOLayerStub(
|
||||
* A new stack may be created by calling PR_CreateIOLayer(). The
|
||||
* file descriptor returned will point to the top of the stack, which has
|
||||
* the layer 'fd' as the topmost layer.
|
||||
*
|
||||
*
|
||||
* NOTE: This function creates a new style stack, which has a fixed, dummy
|
||||
* header. The old style stack, created by a call to PR_PushIOLayer,
|
||||
* results in modifying contents of the top layer of the stack, when
|
||||
@@ -551,18 +543,18 @@ NSPR_API(PRFileDesc*) PR_PopIOLayer(PRFileDesc *fd_stack, PRDescIdentity id);
|
||||
* The file status flags.
|
||||
* It is a bitwise OR of the following bit flags (only one of
|
||||
* the first three flags below may be used):
|
||||
* PR_RDONLY Open for reading only.
|
||||
* PR_WRONLY Open for writing only.
|
||||
* PR_RDWR Open for reading and writing.
|
||||
* PR_CREATE_FILE If the file does not exist, the file is created
|
||||
* PR_RDONLY Open for reading only.
|
||||
* PR_WRONLY Open for writing only.
|
||||
* PR_RDWR Open for reading and writing.
|
||||
* PR_CREATE_FILE If the file does not exist, the file is created
|
||||
* If the file exists, this flag has no effect.
|
||||
* PR_SYNC If set, each write will wait for both the file data
|
||||
* and file status to be physically updated.
|
||||
* PR_APPEND The file pointer is set to the end of
|
||||
* PR_APPEND The file pointer is set to the end of
|
||||
* the file prior to each write.
|
||||
* PR_TRUNCATE If the file exists, its length is truncated to 0.
|
||||
* PR_TRUNCATE If the file exists, its length is truncated to 0.
|
||||
* PR_EXCL With PR_CREATE_FILE, if the file does not exist,
|
||||
* the file is created. If the file already
|
||||
* the file is created. If the file already
|
||||
* exists, no action and NULL is returned
|
||||
*
|
||||
* PRIntn mode
|
||||
@@ -982,7 +974,7 @@ NSPR_API(PRInt64) PR_Available64(PRFileDesc *fd);
|
||||
************************************************************************
|
||||
*/
|
||||
|
||||
NSPR_API(PRStatus) PR_Sync(PRFileDesc *fd);
|
||||
NSPR_API(PRStatus) PR_Sync(PRFileDesc *fd);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
@@ -998,7 +990,7 @@ struct PRDirEntryUTF16 {
|
||||
#endif /* MOZ_UNICODE */
|
||||
|
||||
#if !defined(NO_NSPR_10_SUPPORT)
|
||||
#define PR_DirName(dirEntry) (dirEntry->name)
|
||||
#define PR_DirName(dirEntry) (dirEntry->name)
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -1425,8 +1417,8 @@ NSPR_API(PRStatus) PR_Shutdown(PRFileDesc *fd, PRShutdownHow how);
|
||||
* FUNCTION: PR_Recv
|
||||
* DESCRIPTION:
|
||||
* Receive a specified number of bytes from a connected socket.
|
||||
* The operation will block until some positive number of bytes are
|
||||
* transferred, a time out has occurred, or there is an error.
|
||||
* The operation will block until some positive number of bytes are
|
||||
* transferred, a time out has occurred, or there is an error.
|
||||
* No more than 'amount' bytes will be transferred.
|
||||
* INPUTS:
|
||||
* PRFileDesc *fd
|
||||
@@ -1452,15 +1444,15 @@ NSPR_API(PRStatus) PR_Shutdown(PRFileDesc *fd, PRShutdownHow how);
|
||||
#define PR_MSG_PEEK 0x2
|
||||
|
||||
NSPR_API(PRInt32) PR_Recv(PRFileDesc *fd, void *buf, PRInt32 amount,
|
||||
PRIntn flags, PRIntervalTime timeout);
|
||||
PRIntn flags, PRIntervalTime timeout);
|
||||
|
||||
/*
|
||||
*************************************************************************
|
||||
* FUNCTION: PR_Send
|
||||
* DESCRIPTION:
|
||||
* Send a specified number of bytes from a connected socket.
|
||||
* The operation will block until all bytes are
|
||||
* processed, a time out has occurred, or there is an error.
|
||||
* The operation will block until all bytes are
|
||||
* processed, a time out has occurred, or there is an error.
|
||||
* INPUTS:
|
||||
* PRFileDesc *fd
|
||||
* points to a PRFileDesc object representing a socket.
|
||||
@@ -1483,7 +1475,7 @@ NSPR_API(PRInt32) PR_Recv(PRFileDesc *fd, void *buf, PRInt32 amount,
|
||||
*/
|
||||
|
||||
NSPR_API(PRInt32) PR_Send(PRFileDesc *fd, const void *buf, PRInt32 amount,
|
||||
PRIntn flags, PRIntervalTime timeout);
|
||||
PRIntn flags, PRIntervalTime timeout);
|
||||
|
||||
/*
|
||||
*************************************************************************
|
||||
@@ -1491,8 +1483,8 @@ NSPR_API(PRInt32) PR_Send(PRFileDesc *fd, const void *buf, PRInt32 amount,
|
||||
* DESCRIPTION:
|
||||
* Receive up to a specified number of bytes from socket which may
|
||||
* or may not be connected.
|
||||
* The operation will block until one or more bytes are
|
||||
* transferred, a time out has occurred, or there is an error.
|
||||
* The operation will block until one or more bytes are
|
||||
* transferred, a time out has occurred, or there is an error.
|
||||
* No more than 'amount' bytes will be transferred.
|
||||
* INPUTS:
|
||||
* PRFileDesc *fd
|
||||
@@ -1526,8 +1518,8 @@ NSPR_API(PRInt32) PR_RecvFrom(
|
||||
* FUNCTION: PR_SendTo
|
||||
* DESCRIPTION:
|
||||
* Send a specified number of bytes from an unconnected socket.
|
||||
* The operation will block until all bytes are
|
||||
* sent, a time out has occurred, or there is an error.
|
||||
* The operation will block until all bytes are
|
||||
* sent, a time out has occurred, or there is an error.
|
||||
* INPUTS:
|
||||
* PRFileDesc *fd
|
||||
* points to a PRFileDesc object representing an unconnected socket.
|
||||
@@ -1558,10 +1550,10 @@ NSPR_API(PRInt32) PR_SendTo(
|
||||
*************************************************************************
|
||||
** FUNCTION: PR_TransmitFile
|
||||
** DESCRIPTION:
|
||||
** Transmitfile sends a complete file (sourceFile) across a socket
|
||||
** Transmitfile sends a complete file (sourceFile) across a socket
|
||||
** (networkSocket). If headers is non-NULL, the headers will be sent across
|
||||
** the socket prior to sending the file.
|
||||
**
|
||||
**
|
||||
** Optionally, the PR_TRANSMITFILE_CLOSE_SOCKET flag may be passed to
|
||||
** transmitfile. This flag specifies that transmitfile should close the
|
||||
** socket after sending the data.
|
||||
@@ -1578,7 +1570,7 @@ NSPR_API(PRInt32) PR_SendTo(
|
||||
** PRTransmitFileFlags flags
|
||||
** If the flags indicate that the connection should be closed,
|
||||
** it will be done immediately after transferring the file, unless
|
||||
** the operation is unsuccessful.
|
||||
** the operation is unsuccessful.
|
||||
.* PRIntervalTime timeout
|
||||
* Time limit for completion of the transmit operation.
|
||||
**
|
||||
@@ -1599,12 +1591,12 @@ NSPR_API(PRInt32) PR_TransmitFile(
|
||||
*************************************************************************
|
||||
** FUNCTION: PR_SendFile
|
||||
** DESCRIPTION:
|
||||
** PR_SendFile sends data from a file (sendData->fd) across a socket
|
||||
** PR_SendFile sends data from a file (sendData->fd) across a socket
|
||||
** (networkSocket). If specified, a header and/or trailer buffer are sent
|
||||
** before and after the file, respectively. The file offset, number of bytes
|
||||
** of file data to send, the header and trailer buffers are specified in the
|
||||
** sendData argument.
|
||||
**
|
||||
** before and after the file, respectively. The file offset, number of bytes
|
||||
** of file data to send, the header and trailer buffers are specified in the
|
||||
** sendData argument.
|
||||
**
|
||||
** Optionally, if the PR_TRANSMITFILE_CLOSE_SOCKET flag is passed, the
|
||||
** socket is closed after successfully sending the data.
|
||||
**
|
||||
@@ -1613,11 +1605,11 @@ NSPR_API(PRInt32) PR_TransmitFile(
|
||||
** The socket to send data over
|
||||
** PRSendFileData *sendData
|
||||
** Contains the FD, file offset and length, header and trailer
|
||||
** buffer specifications.
|
||||
** buffer specifications.
|
||||
** PRTransmitFileFlags flags
|
||||
** If the flags indicate that the connection should be closed,
|
||||
** it will be done immediately after transferring the file, unless
|
||||
** the operation is unsuccessful.
|
||||
** the operation is unsuccessful.
|
||||
.* PRIntervalTime timeout
|
||||
* Time limit for completion of the send operation.
|
||||
**
|
||||
@@ -1630,21 +1622,21 @@ NSPR_API(PRInt32) PR_TransmitFile(
|
||||
*/
|
||||
|
||||
struct PRSendFileData {
|
||||
PRFileDesc *fd; /* file to send */
|
||||
PRUint32 file_offset; /* file offset */
|
||||
PRSize file_nbytes; /* number of bytes of file data to send */
|
||||
/* if 0, send data from file_offset to */
|
||||
/* end-of-file. */
|
||||
const void *header; /* header buffer */
|
||||
PRInt32 hlen; /* header len */
|
||||
const void *trailer; /* trailer buffer */
|
||||
PRInt32 tlen; /* trailer len */
|
||||
PRFileDesc *fd; /* file to send */
|
||||
PRUint32 file_offset; /* file offset */
|
||||
PRSize file_nbytes; /* number of bytes of file data to send */
|
||||
/* if 0, send data from file_offset to */
|
||||
/* end-of-file. */
|
||||
const void *header; /* header buffer */
|
||||
PRInt32 hlen; /* header len */
|
||||
const void *trailer; /* trailer buffer */
|
||||
PRInt32 tlen; /* trailer len */
|
||||
};
|
||||
|
||||
|
||||
NSPR_API(PRInt32) PR_SendFile(
|
||||
PRFileDesc *networkSocket, PRSendFileData *sendData,
|
||||
PRTransmitFileFlags flags, PRIntervalTime timeout);
|
||||
PRTransmitFileFlags flags, PRIntervalTime timeout);
|
||||
|
||||
/*
|
||||
*************************************************************************
|
||||
@@ -1652,15 +1644,15 @@ NSPR_API(PRInt32) PR_SendFile(
|
||||
** DESCRIPTION:
|
||||
** AcceptRead accepts a new connection, returns the newly created
|
||||
** socket's descriptor and also returns the connecting peer's address.
|
||||
** AcceptRead, as its name suggests, also receives the first block of data
|
||||
** AcceptRead, as its name suggests, also receives the first block of data
|
||||
** sent by the peer.
|
||||
**
|
||||
** INPUTS:
|
||||
** PRFileDesc *listenSock
|
||||
** A socket descriptor that has been called with the PR_Listen()
|
||||
** A socket descriptor that has been called with the PR_Listen()
|
||||
** function, also known as the rendezvous socket.
|
||||
** void *buf
|
||||
** A pointer to a buffer to receive data sent by the client. This
|
||||
** A pointer to a buffer to receive data sent by the client. This
|
||||
** buffer must be large enough to receive <amount> bytes of data
|
||||
** and two PRNetAddr structures, plus an extra 32 bytes. See:
|
||||
** PR_ACCEPT_READ_BUF_OVERHEAD.
|
||||
@@ -1669,9 +1661,9 @@ NSPR_API(PRInt32) PR_SendFile(
|
||||
** the size of the PRNetAddr structures. If 0, no data will be read
|
||||
** from the client.
|
||||
** PRIntervalTime timeout
|
||||
** The timeout interval only applies to the read portion of the
|
||||
** operation. PR_AcceptRead will block indefinitely until the
|
||||
** connection is accepted; the read will timeout after the timeout
|
||||
** The timeout interval only applies to the read portion of the
|
||||
** operation. PR_AcceptRead will block indefinitely until the
|
||||
** connection is accepted; the read will timeout after the timeout
|
||||
** interval elapses.
|
||||
** OUTPUTS:
|
||||
** PRFileDesc **acceptedSock
|
||||
@@ -1681,13 +1673,13 @@ NSPR_API(PRInt32) PR_SendFile(
|
||||
** The address of the remote socket. This parameter will only be
|
||||
** valid if the function return does not indicate failure. The
|
||||
** returned address is not guaranteed to be properly aligned.
|
||||
**
|
||||
**
|
||||
** RETURNS:
|
||||
** The number of bytes read from the client or -1 on failure. The reason
|
||||
** The number of bytes read from the client or -1 on failure. The reason
|
||||
** for the failure is obtained by calling PR_GetError().
|
||||
**************************************************************************
|
||||
**/
|
||||
/* define buffer overhead constant. Add this value to the user's
|
||||
**/
|
||||
/* define buffer overhead constant. Add this value to the user's
|
||||
** data length when allocating a buffer to accept data.
|
||||
** Example:
|
||||
** #define USER_DATA_SIZE 10
|
||||
@@ -1714,7 +1706,7 @@ NSPR_API(PRInt32) PR_AcceptRead(
|
||||
** PRFileDesc *fds[2]
|
||||
** The file descriptor pair for the newly created TCP sockets.
|
||||
** RETURN: PRStatus
|
||||
** Upon successful completion of TCP socket pair, PR_NewTCPSocketPair
|
||||
** Upon successful completion of TCP socket pair, PR_NewTCPSocketPair
|
||||
** returns PR_SUCCESS. Otherwise, it returns PR_FAILURE. Further
|
||||
** failure information can be obtained by calling PR_GetError().
|
||||
** XXX can we implement this on windoze and mac?
|
||||
@@ -1735,18 +1727,18 @@ NSPR_API(PRStatus) PR_NewTCPSocketPair(PRFileDesc *fds[2]);
|
||||
** PRNetAddr *addr
|
||||
** Returns the address of the socket in its own communication space.
|
||||
** RETURN: PRStatus
|
||||
** Upon successful completion, PR_GetSockName returns PR_SUCCESS.
|
||||
** Otherwise, it returns PR_FAILURE. Further failure information can
|
||||
** Upon successful completion, PR_GetSockName returns PR_SUCCESS.
|
||||
** Otherwise, it returns PR_FAILURE. Further failure information can
|
||||
** be obtained by calling PR_GetError().
|
||||
**************************************************************************
|
||||
**/
|
||||
NSPR_API(PRStatus) PR_GetSockName(PRFileDesc *fd, PRNetAddr *addr);
|
||||
NSPR_API(PRStatus) PR_GetSockName(PRFileDesc *fd, PRNetAddr *addr);
|
||||
|
||||
/*
|
||||
*************************************************************************
|
||||
** FUNCTION: PR_GetPeerName
|
||||
** DESCRIPTION:
|
||||
** Get name of the connected peer. Return the network address for the
|
||||
** Get name of the connected peer. Return the network address for the
|
||||
** connected peer socket.
|
||||
**
|
||||
** INPUTS:
|
||||
@@ -1757,17 +1749,17 @@ NSPR_API(PRStatus) PR_GetSockName(PRFileDesc *fd, PRNetAddr *addr);
|
||||
** Returns the address of the connected peer in its own communication
|
||||
** space.
|
||||
** RETURN: PRStatus
|
||||
** Upon successful completion, PR_GetPeerName returns PR_SUCCESS.
|
||||
** Otherwise, it returns PR_FAILURE. Further failure information can
|
||||
** Upon successful completion, PR_GetPeerName returns PR_SUCCESS.
|
||||
** Otherwise, it returns PR_FAILURE. Further failure information can
|
||||
** be obtained by calling PR_GetError().
|
||||
**************************************************************************
|
||||
**/
|
||||
NSPR_API(PRStatus) PR_GetPeerName(PRFileDesc *fd, PRNetAddr *addr);
|
||||
NSPR_API(PRStatus) PR_GetPeerName(PRFileDesc *fd, PRNetAddr *addr);
|
||||
|
||||
NSPR_API(PRStatus) PR_GetSocketOption(
|
||||
NSPR_API(PRStatus) PR_GetSocketOption(
|
||||
PRFileDesc *fd, PRSocketOptionData *data);
|
||||
|
||||
NSPR_API(PRStatus) PR_SetSocketOption(
|
||||
NSPR_API(PRStatus) PR_SetSocketOption(
|
||||
PRFileDesc *fd, const PRSocketOptionData *data);
|
||||
|
||||
/*
|
||||
@@ -1792,8 +1784,8 @@ NSPR_API(PRStatus) PR_SetSocketOption(
|
||||
* by a child process. If PR_FALSE, the file descriptor is set
|
||||
* to be not inheritable by a child process.
|
||||
* RETURN: PRStatus
|
||||
* Upon successful completion, PR_SetFDInheritable returns PR_SUCCESS.
|
||||
* Otherwise, it returns PR_FAILURE. Further failure information can
|
||||
* Upon successful completion, PR_SetFDInheritable returns PR_SUCCESS.
|
||||
* Otherwise, it returns PR_FAILURE. Further failure information can
|
||||
* be obtained by calling PR_GetError().
|
||||
*************************************************************************
|
||||
*/
|
||||
@@ -1812,7 +1804,7 @@ NSPR_API(PRStatus) PR_SetFDInheritable(
|
||||
* The name of the inherited file descriptor.
|
||||
* RETURN: PRFileDesc *
|
||||
* Upon successful completion, PR_GetInheritedFD returns the
|
||||
* inherited file descriptor with the specified name. Otherwise,
|
||||
* inherited file descriptor with the specified name. Otherwise,
|
||||
* it returns NULL. Further failure information can be obtained
|
||||
* by calling PR_GetError().
|
||||
*************************************************************************
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
** File: pprio.h
|
||||
** File: pprio.h
|
||||
**
|
||||
** Description: Private definitions for I/O related structures
|
||||
** Description: Private definitions for I/O related structures
|
||||
*/
|
||||
|
||||
#ifndef pprio_h___
|
||||
@@ -51,10 +51,10 @@ NSPR_API(const PRIOMethods*) PR_GetPipeMethods(void);
|
||||
NSPR_API(PROsfd) PR_FileDesc2NativeHandle(PRFileDesc *);
|
||||
NSPR_API(void) PR_ChangeFileDescNativeHandle(PRFileDesc *, PROsfd);
|
||||
NSPR_API(PRFileDesc*) PR_AllocFileDesc(PROsfd osfd,
|
||||
const PRIOMethods *methods);
|
||||
const PRIOMethods *methods);
|
||||
NSPR_API(void) PR_FreeFileDesc(PRFileDesc *fd);
|
||||
/*
|
||||
** Import an existing OS file to NSPR.
|
||||
** Import an existing OS file to NSPR.
|
||||
*/
|
||||
NSPR_API(PRFileDesc*) PR_ImportFile(PROsfd osfd);
|
||||
NSPR_API(PRFileDesc*) PR_ImportPipe(PROsfd osfd);
|
||||
@@ -67,7 +67,7 @@ NSPR_API(PRFileDesc*) PR_ImportUDPSocket(PROsfd osfd);
|
||||
* FUNCTION: PR_CreateSocketPollFd
|
||||
* DESCRIPTION:
|
||||
* Create a PRFileDesc wrapper for a native socket handle, for use with
|
||||
* PR_Poll only
|
||||
* PR_Poll only
|
||||
* INPUTS:
|
||||
* None
|
||||
* OUTPUTS:
|
||||
@@ -80,7 +80,7 @@ NSPR_API(PRFileDesc*) PR_ImportUDPSocket(PROsfd osfd);
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
NSPR_API(PRFileDesc*) PR_CreateSocketPollFd(PROsfd osfd);
|
||||
NSPR_API(PRFileDesc*) PR_CreateSocketPollFd(PROsfd osfd);
|
||||
|
||||
/*
|
||||
*************************************************************************
|
||||
@@ -93,7 +93,7 @@ NSPR_API(PRFileDesc*) PR_CreateSocketPollFd(PROsfd osfd);
|
||||
* None
|
||||
* RETURN: PRFileDesc*
|
||||
* Upon successful completion, PR_DestroySocketPollFd returns
|
||||
* PR_SUCCESS, else PR_FAILURE
|
||||
* PR_SUCCESS, else PR_FAILURE
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
@@ -122,7 +122,7 @@ NSPR_API(PRStatus) PR_DestroySocketPollFd(PRFileDesc *fd);
|
||||
/*
|
||||
** Create a new Socket; this function is obsolete.
|
||||
*/
|
||||
NSPR_API(PRFileDesc*) PR_Socket(PRInt32 domain, PRInt32 type, PRInt32 proto);
|
||||
NSPR_API(PRFileDesc*) PR_Socket(PRInt32 domain, PRInt32 type, PRInt32 proto);
|
||||
|
||||
/* FUNCTION: PR_LockFile
|
||||
** DESCRIPTION:
|
||||
@@ -157,7 +157,7 @@ NSPR_API(PRStatus) PR_UnlockFile(PRFileDesc *fd);
|
||||
** Emulate acceptread by accept and recv.
|
||||
*/
|
||||
NSPR_API(PRInt32) PR_EmulateAcceptRead(PRFileDesc *sd, PRFileDesc **nd,
|
||||
PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout);
|
||||
PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout);
|
||||
|
||||
/*
|
||||
** Emulate sendfile by reading from the file and writing to the socket.
|
||||
@@ -177,7 +177,7 @@ NSPR_API(PRInt32) PR_EmulateSendFile(
|
||||
** updates the accept context. This version does not.
|
||||
**/
|
||||
NSPR_API(PRInt32) PR_NTFast_AcceptRead(PRFileDesc *sd, PRFileDesc **nd,
|
||||
PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime t);
|
||||
PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime t);
|
||||
|
||||
typedef void (*_PR_AcceptTimeoutCallback)(void *);
|
||||
|
||||
@@ -187,23 +187,23 @@ typedef void (*_PR_AcceptTimeoutCallback)(void *);
|
||||
** our daemon threads need to be able to wakeup and reliably flush their
|
||||
** log buffers if the Accept times out. However, with the current blocking
|
||||
** interface to AcceptRead, there is no way for us to timeout the Accept;
|
||||
** this is because when we timeout the Read, we can close the newly
|
||||
** this is because when we timeout the Read, we can close the newly
|
||||
** socket and continue; but when we timeout the accept itself, there is no
|
||||
** new socket to timeout. So instead, this version of the function is
|
||||
** provided. After the initial timeout period elapses on the accept()
|
||||
** portion of the function, it will call the callback routine and then
|
||||
** continue the accept. If the timeout occurs on the read, it will
|
||||
** continue the accept. If the timeout occurs on the read, it will
|
||||
** close the connection and return error.
|
||||
*/
|
||||
NSPR_API(PRInt32) PR_NTFast_AcceptRead_WithTimeoutCallback(
|
||||
PRFileDesc *sd,
|
||||
PRFileDesc **nd,
|
||||
PRNetAddr **raddr,
|
||||
void *buf,
|
||||
PRInt32 amount,
|
||||
PRIntervalTime t,
|
||||
_PR_AcceptTimeoutCallback callback,
|
||||
void *callback_arg);
|
||||
PRFileDesc *sd,
|
||||
PRFileDesc **nd,
|
||||
PRNetAddr **raddr,
|
||||
void *buf,
|
||||
PRInt32 amount,
|
||||
PRIntervalTime t,
|
||||
_PR_AcceptTimeoutCallback callback,
|
||||
void *callback_arg);
|
||||
|
||||
/* FUNCTION: PR_NTFast_Accept
|
||||
** DESCRIPTION:
|
||||
@@ -213,8 +213,8 @@ NSPR_API(PRInt32) PR_NTFast_AcceptRead_WithTimeoutCallback(
|
||||
** the acceptcontext. The generic version of PR_Accept always
|
||||
** updates the accept context. This version does not.
|
||||
**/
|
||||
NSPR_API(PRFileDesc*) PR_NTFast_Accept(PRFileDesc *fd, PRNetAddr *addr,
|
||||
PRIntervalTime timeout);
|
||||
NSPR_API(PRFileDesc*) PR_NTFast_Accept(PRFileDesc *fd, PRNetAddr *addr,
|
||||
PRIntervalTime timeout);
|
||||
|
||||
/* FUNCTION: PR_NTFast_Update
|
||||
** DESCRIPTION:
|
||||
@@ -224,8 +224,8 @@ NSPR_API(PRFileDesc*) PR_NTFast_Accept(PRFileDesc *fd, PRNetAddr *addr,
|
||||
** Without calling this, the only operations supported on the socket
|
||||
** Are PR_Read, PR_Write, PR_Transmitfile, and PR_Close.
|
||||
*/
|
||||
NSPR_API(void) PR_NTFast_UpdateAcceptContext(PRFileDesc *acceptSock,
|
||||
PRFileDesc *listenSock);
|
||||
NSPR_API(void) PR_NTFast_UpdateAcceptContext(PRFileDesc *acceptSock,
|
||||
PRFileDesc *listenSock);
|
||||
|
||||
|
||||
/* FUNCTION: PR_NT_CancelIo
|
||||
|
||||
@@ -27,9 +27,9 @@ PR_BEGIN_EXTERN_C
|
||||
|
||||
/*
|
||||
** Associate a thread object with an existing native thread.
|
||||
** "type" is the type of thread object to attach
|
||||
** "priority" is the priority to assign to the thread
|
||||
** "stack" defines the shape of the threads stack
|
||||
** "type" is the type of thread object to attach
|
||||
** "priority" is the priority to assign to the thread
|
||||
** "stack" defines the shape of the threads stack
|
||||
**
|
||||
** This can return NULL if some kind of error occurs, or if memory is
|
||||
** tight. This call invokes "start(obj,arg)" and returns when the
|
||||
@@ -39,8 +39,8 @@ PR_BEGIN_EXTERN_C
|
||||
** thread. PR_Init does this automatically for the primordial thread.
|
||||
*/
|
||||
NSPR_API(PRThread*) PR_AttachThread(PRThreadType type,
|
||||
PRThreadPriority priority,
|
||||
PRThreadStack *stack);
|
||||
PRThreadPriority priority,
|
||||
PRThreadStack *stack);
|
||||
|
||||
/*
|
||||
** Detach the nspr thread from the currently executing native thread.
|
||||
@@ -81,7 +81,7 @@ NSPR_API(void) PR_SetThreadDumpProc(
|
||||
NSPR_API(PRInt32) PR_GetThreadAffinityMask(PRThread *thread, PRUint32 *mask);
|
||||
|
||||
/*
|
||||
** Set this thread's affinity mask.
|
||||
** Set this thread's affinity mask.
|
||||
**
|
||||
** Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
@@ -105,11 +105,11 @@ NSPR_API(void) PR_SetThreadRecycleMode(PRUint32 flag);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
** THREAD PRIVATE FUNCTIONS FOR GARBAGE COLLECTIBLE THREADS
|
||||
** THREAD PRIVATE FUNCTIONS FOR GARBAGE COLLECTIBLE THREADS
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
** Only Garbage collectible threads participate in resume all, suspend all and
|
||||
/*
|
||||
** Only Garbage collectible threads participate in resume all, suspend all and
|
||||
** enumeration operations. They are also different during creation when
|
||||
** platform specific action may be needed (For example, all Solaris GC able
|
||||
** threads are bound threads).
|
||||
@@ -120,20 +120,20 @@ NSPR_API(void) PR_SetThreadRecycleMode(PRUint32 flag);
|
||||
** collectible.
|
||||
*/
|
||||
NSPR_API(PRThread*) PR_CreateThreadGCAble(PRThreadType type,
|
||||
void (*start)(void *arg),
|
||||
void *arg,
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
void (*start)(void *arg),
|
||||
void *arg,
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
|
||||
/*
|
||||
** Same as PR_AttachThread except that the thread being attached is marked as
|
||||
** Same as PR_AttachThread except that the thread being attached is marked as
|
||||
** garbage collectible.
|
||||
*/
|
||||
NSPR_API(PRThread*) PR_AttachThreadGCAble(PRThreadType type,
|
||||
PRThreadPriority priority,
|
||||
PRThreadStack *stack);
|
||||
PRThreadPriority priority,
|
||||
PRThreadStack *stack);
|
||||
|
||||
/*
|
||||
** Mark the thread as garbage collectible.
|
||||
@@ -146,19 +146,19 @@ NSPR_API(void) PR_SetThreadGCAble(void);
|
||||
NSPR_API(void) PR_ClearThreadGCAble(void);
|
||||
|
||||
/*
|
||||
** This routine prevents all other GC able threads from running. This call is needed by
|
||||
** This routine prevents all other GC able threads from running. This call is needed by
|
||||
** the garbage collector.
|
||||
*/
|
||||
NSPR_API(void) PR_SuspendAll(void);
|
||||
|
||||
/*
|
||||
** This routine unblocks all other GC able threads that were suspended from running by
|
||||
** This routine unblocks all other GC able threads that were suspended from running by
|
||||
** PR_SuspendAll(). This call is needed by the garbage collector.
|
||||
*/
|
||||
NSPR_API(void) PR_ResumeAll(void);
|
||||
|
||||
/*
|
||||
** Return the thread stack pointer of the given thread.
|
||||
** Return the thread stack pointer of the given thread.
|
||||
** Needed by the garbage collector.
|
||||
*/
|
||||
NSPR_API(void *) PR_GetSP(PRThread *thread);
|
||||
@@ -199,26 +199,26 @@ NSPR_API(void) SetExecutionEnvironment(PRThread* thread, void *environment);
|
||||
typedef PRStatus (PR_CALLBACK *PREnumerator)(PRThread *t, int i, void *arg);
|
||||
NSPR_API(PRStatus) PR_EnumerateThreads(PREnumerator func, void *arg);
|
||||
|
||||
/*
|
||||
/*
|
||||
** Signature of a thread stack scanning function. It is applied to every
|
||||
** contiguous group of potential pointers within a thread. Count denotes the
|
||||
** number of pointers.
|
||||
** number of pointers.
|
||||
*/
|
||||
typedef PRStatus
|
||||
typedef PRStatus
|
||||
(PR_CALLBACK *PRScanStackFun)(PRThread* t,
|
||||
void** baseAddr, PRUword count, void* closure);
|
||||
void** baseAddr, PRUword count, void* closure);
|
||||
|
||||
/*
|
||||
** Applies scanFun to all contiguous groups of potential pointers
|
||||
** Applies scanFun to all contiguous groups of potential pointers
|
||||
** within a thread. This includes the stack, registers, and thread-local
|
||||
** data. If scanFun returns a status value other than PR_SUCCESS the scan
|
||||
** is aborted, and the status value is returned.
|
||||
** is aborted, and the status value is returned.
|
||||
*/
|
||||
NSPR_API(PRStatus)
|
||||
PR_ThreadScanStackPointers(PRThread* t,
|
||||
PRScanStackFun scanFun, void* scanClosure);
|
||||
|
||||
/*
|
||||
/*
|
||||
** Calls PR_ThreadScanStackPointers for every thread.
|
||||
*/
|
||||
NSPR_API(PRStatus)
|
||||
@@ -226,14 +226,14 @@ PR_ScanStackPointers(PRScanStackFun scanFun, void* scanClosure);
|
||||
|
||||
/*
|
||||
** Returns a conservative estimate on the amount of stack space left
|
||||
** on a thread in bytes, sufficient for making decisions about whether
|
||||
** on a thread in bytes, sufficient for making decisions about whether
|
||||
** to continue recursing or not.
|
||||
*/
|
||||
NSPR_API(PRUword)
|
||||
PR_GetStackSpaceLeft(PRThread* t);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
** THREAD CPU PRIVATE FUNCTIONS
|
||||
** THREAD CPU PRIVATE FUNCTIONS
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
@@ -283,26 +283,6 @@ NSPR_API(PRMonitor*) PR_CTestAndEnterMonitor(void *address);
|
||||
/*---------------------------------------------------------------------------
|
||||
** PLATFORM-SPECIFIC INITIALIZATION FUNCTIONS
|
||||
---------------------------------------------------------------------------*/
|
||||
#if defined(IRIX)
|
||||
/*
|
||||
** Irix specific initialization funtion to be called before PR_Init
|
||||
** is called by the application. Sets the CONF_INITUSERS and CONF_INITSIZE
|
||||
** attributes of the shared arena set up by nspr.
|
||||
**
|
||||
** The environment variables _NSPR_IRIX_INITUSERS and _NSPR_IRIX_INITSIZE
|
||||
** can also be used to set these arena attributes. If _NSPR_IRIX_INITUSERS
|
||||
** is set, but not _NSPR_IRIX_INITSIZE, the value of the CONF_INITSIZE
|
||||
** attribute of the nspr arena is scaled as a function of the
|
||||
** _NSPR_IRIX_INITUSERS value.
|
||||
**
|
||||
** If the _PR_Irix_Set_Arena_Params() is called in addition to setting the
|
||||
** environment variables, the values of the environment variables are used.
|
||||
**
|
||||
*/
|
||||
NSPR_API(void) _PR_Irix_Set_Arena_Params(PRInt32 initusers, PRInt32 initsize);
|
||||
|
||||
#endif /* IRIX */
|
||||
|
||||
#if defined(XP_OS2)
|
||||
/*
|
||||
** These functions need to be called at the start and end of a thread.
|
||||
@@ -314,7 +294,7 @@ NSPR_API(void) PR_OS2_UnsetFloatExcpHandler(EXCEPTIONREGISTRATIONRECORD* e);
|
||||
#endif /* XP_OS2 */
|
||||
|
||||
/* I think PR_GetMonitorEntryCount is useless. All you really want is this... */
|
||||
#define PR_InMonitor(m) (PR_GetMonitorEntryCount(m) > 0)
|
||||
#define PR_InMonitor(m) (PR_GetMonitorEntryCount(m) > 0)
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
** Special X-Lock hack for client
|
||||
|
||||
+126
-151
@@ -10,10 +10,6 @@
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if defined(_PR_BTHREADS)
|
||||
#include <kernel/OS.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* Allow use of functions and symbols first defined in Win2k.
|
||||
@@ -51,19 +47,19 @@ typedef struct PRSegment PRSegment;
|
||||
*************************************************************************/
|
||||
|
||||
/*
|
||||
NSPR 2.0 must implement its function across a range of platforms
|
||||
NSPR 2.0 must implement its function across a range of platforms
|
||||
including: MAC, Windows/16, Windows/95, Windows/NT, and several
|
||||
variants of Unix. Each implementation shares common code as well
|
||||
variants of Unix. Each implementation shares common code as well
|
||||
as having platform dependent portions. This standard describes how
|
||||
the model dependent portions are to be implemented.
|
||||
|
||||
In header file pr/include/primpl.h, each publicly declared
|
||||
In header file pr/include/primpl.h, each publicly declared
|
||||
platform dependent function is declared as:
|
||||
|
||||
NSPR_API void _PR_MD_FUNCTION( long arg1, long arg2 );
|
||||
#define _PR_MD_FUNCTION _MD_FUNCTION
|
||||
|
||||
In header file pr/include/md/<platform>/_<platform>.h,
|
||||
In header file pr/include/md/<platform>/_<platform>.h,
|
||||
each #define'd macro is redefined as one of:
|
||||
|
||||
#define _MD_FUNCTION <blanks>
|
||||
@@ -73,26 +69,26 @@ each #define'd macro is redefined as one of:
|
||||
|
||||
Where:
|
||||
|
||||
<blanks> is no definition at all. In this case, the function is not implemented
|
||||
and is never called for this platform.
|
||||
For example:
|
||||
<blanks> is no definition at all. In this case, the function is not implemented
|
||||
and is never called for this platform.
|
||||
For example:
|
||||
#define _MD_INIT_CPUS()
|
||||
|
||||
<expanded macro> is a C language macro expansion.
|
||||
For example:
|
||||
<expanded macro> is a C language macro expansion.
|
||||
For example:
|
||||
#define _MD_CLEAN_THREAD(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
PR_DestroyCondVar(_thread->md.asyncIOCVar); \
|
||||
PR_DestroyLock(_thread->md.asyncIOLock); \
|
||||
PR_END_MACRO
|
||||
|
||||
<osFunction> is some function implemented by the host operating system.
|
||||
For example:
|
||||
<osFunction> is some function implemented by the host operating system.
|
||||
For example:
|
||||
#define _MD_EXIT exit
|
||||
|
||||
<_MD_function> is the name of a function implemented for this platform in
|
||||
pr/src/md/<platform>/<soruce>.c file.
|
||||
For example:
|
||||
<_MD_function> is the name of a function implemented for this platform in
|
||||
pr/src/md/<platform>/<soruce>.c file.
|
||||
For example:
|
||||
#define _MD_GETFILEINFO _MD_GetFileInfo
|
||||
|
||||
In <source>.c, the implementation is:
|
||||
@@ -137,7 +133,7 @@ struct _PT_Notified
|
||||
};
|
||||
|
||||
/*
|
||||
* bits defined for pthreads 'state' field
|
||||
* bits defined for pthreads 'state' field
|
||||
*/
|
||||
#define PT_THREAD_DETACHED 0x01 /* thread can't be joined */
|
||||
#define PT_THREAD_GLOBAL 0x02 /* a global thread (unlikely) */
|
||||
@@ -149,16 +145,16 @@ struct _PT_Notified
|
||||
#define PT_THREAD_FOREIGN 0x80 /* thread is not one of ours */
|
||||
#define PT_THREAD_BOUND 0x100 /* a bound-global thread */
|
||||
|
||||
#define _PT_THREAD_INTERRUPTED(thr) \
|
||||
(!(thr->interrupt_blocked) && (thr->state & PT_THREAD_ABORTED))
|
||||
#define _PT_THREAD_BLOCK_INTERRUPT(thr) \
|
||||
(thr->interrupt_blocked = 1)
|
||||
#define _PT_THREAD_UNBLOCK_INTERRUPT(thr) \
|
||||
(thr->interrupt_blocked = 0)
|
||||
#define _PT_THREAD_INTERRUPTED(thr) \
|
||||
(!(thr->interrupt_blocked) && (thr->state & PT_THREAD_ABORTED))
|
||||
#define _PT_THREAD_BLOCK_INTERRUPT(thr) \
|
||||
(thr->interrupt_blocked = 1)
|
||||
#define _PT_THREAD_UNBLOCK_INTERRUPT(thr) \
|
||||
(thr->interrupt_blocked = 0)
|
||||
|
||||
#define _PT_IS_GCABLE_THREAD(thr) ((thr)->state & PT_THREAD_GCABLE)
|
||||
|
||||
/*
|
||||
/*
|
||||
** Possible values for thread's suspend field
|
||||
** Note that the first two can be the same as they are really mutually exclusive,
|
||||
** i.e. both cannot be happening at the same time. We have two symbolic names
|
||||
@@ -209,13 +205,13 @@ NSPR_API(void) PT_FPrintStats(PRFileDesc *fd, const char *msg);
|
||||
*/
|
||||
#ifdef _PR_LOCAL_THREADS_ONLY
|
||||
|
||||
#define _PR_MD_SUSPEND_THREAD(thread)
|
||||
#define _PR_MD_RESUME_THREAD(thread)
|
||||
#define _PR_MD_SUSPEND_CPU(cpu)
|
||||
#define _PR_MD_RESUME_CPU(cpu)
|
||||
#define _PR_MD_BEGIN_SUSPEND_ALL()
|
||||
#define _PR_MD_END_SUSPEND_ALL()
|
||||
#define _PR_MD_BEGIN_RESUME_ALL()
|
||||
#define _PR_MD_SUSPEND_THREAD(thread)
|
||||
#define _PR_MD_RESUME_THREAD(thread)
|
||||
#define _PR_MD_SUSPEND_CPU(cpu)
|
||||
#define _PR_MD_RESUME_CPU(cpu)
|
||||
#define _PR_MD_BEGIN_SUSPEND_ALL()
|
||||
#define _PR_MD_END_SUSPEND_ALL()
|
||||
#define _PR_MD_BEGIN_RESUME_ALL()
|
||||
#define _PR_MD_END_RESUME_ALL()
|
||||
#define _PR_MD_INIT_ATTACHED_THREAD(thread) PR_FAILURE
|
||||
|
||||
@@ -256,7 +252,7 @@ struct _PRCPU {
|
||||
PRThread *thread; /* native thread for this CPUThread */
|
||||
PRThread *idle_thread; /* user-level idle thread for this CPUThread */
|
||||
|
||||
PRIntervalTime last_clock; /* the last time we went into
|
||||
PRIntervalTime last_clock; /* the last time we went into
|
||||
* _PR_ClockInterrupt() on this CPU
|
||||
*/
|
||||
|
||||
@@ -274,12 +270,12 @@ typedef struct _PRInterruptTable {
|
||||
#define _PR_CPU_PTR(_qp) \
|
||||
((_PRCPU*) ((char*) (_qp) - offsetof(_PRCPU,links)))
|
||||
|
||||
#if !defined(IRIX) && !defined(WIN32) && !defined(XP_OS2) \
|
||||
#if !defined(WIN32) && !defined(XP_OS2) \
|
||||
&& !(defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY))
|
||||
#define _MD_GET_ATTACHED_THREAD() (_PR_MD_CURRENT_THREAD())
|
||||
#endif
|
||||
|
||||
#ifdef _PR_LOCAL_THREADS_ONLY
|
||||
#ifdef _PR_LOCAL_THREADS_ONLY
|
||||
|
||||
NSPR_API(struct _PRCPU *) _pr_currentCPU;
|
||||
NSPR_API(PRThread *) _pr_currentThread;
|
||||
@@ -357,7 +353,7 @@ extern PRInt32 _native_threads_only;
|
||||
_PR_MD_SET_INTSOFF(_is); \
|
||||
PR_END_MACRO
|
||||
|
||||
#ifdef _PR_LOCAL_THREADS_ONLY
|
||||
#ifdef _PR_LOCAL_THREADS_ONLY
|
||||
|
||||
#define _PR_IS_NATIVE_THREAD(thread) 0
|
||||
#define _PR_THREAD_LOCK(_thread)
|
||||
@@ -387,10 +383,10 @@ extern PRInt32 _native_threads_only;
|
||||
PR_END_MACRO
|
||||
|
||||
#define _PR_ADD_SLEEPQ(_thread, _timeout) \
|
||||
_PR_AddSleepQ(_thread, _timeout);
|
||||
_PR_AddSleepQ(_thread, _timeout);
|
||||
|
||||
#define _PR_DEL_SLEEPQ(_thread, _propogate) \
|
||||
_PR_DelSleepQ(_thread, _propogate);
|
||||
_PR_DelSleepQ(_thread, _propogate);
|
||||
|
||||
#define _PR_ADD_JOINQ(_thread, _cpu) \
|
||||
PR_APPEND_LINK(&(_thread)->links, &_PR_WAITINGTOJOINQ(_cpu));
|
||||
@@ -422,7 +418,7 @@ extern PRInt32 _native_threads_only;
|
||||
PR_BEGIN_MACRO \
|
||||
_PR_MD_LOCK(&(_cpu)->queue->runQLock );\
|
||||
PR_END_MACRO
|
||||
|
||||
|
||||
#define _PR_RUNQ_UNLOCK(_cpu) \
|
||||
PR_BEGIN_MACRO \
|
||||
_PR_MD_UNLOCK(&(_cpu)->queue->runQLock );\
|
||||
@@ -471,12 +467,12 @@ extern PRInt32 _native_threads_only;
|
||||
#define _PR_ADD_SLEEPQ(_thread, _timeout) \
|
||||
PR_ASSERT((_thread)->queueCount == 0); \
|
||||
(_thread)->queueCount = QUEUE_SLEEP; \
|
||||
_PR_AddSleepQ(_thread, _timeout);
|
||||
_PR_AddSleepQ(_thread, _timeout);
|
||||
|
||||
#define _PR_DEL_SLEEPQ(_thread, _propogate) \
|
||||
PR_ASSERT((_thread)->queueCount == QUEUE_SLEEP);\
|
||||
(_thread)->queueCount = 0; \
|
||||
_PR_DelSleepQ(_thread, _propogate);
|
||||
_PR_DelSleepQ(_thread, _propogate);
|
||||
|
||||
#define _PR_ADD_JOINQ(_thread, _cpu) \
|
||||
PR_ASSERT((_thread)->queueCount == 0); \
|
||||
@@ -529,7 +525,7 @@ NSPR_API(void) _PR_PauseCPU(void);
|
||||
_PR_MD_LOCK(&(_lock)->ilock);
|
||||
#define _PR_LOCK_UNLOCK(_lock) \
|
||||
_PR_MD_UNLOCK(&(_lock)->ilock);
|
||||
|
||||
|
||||
extern void _PR_UnblockLockWaiter(PRLock *lock);
|
||||
extern PRStatus _PR_InitLock(PRLock *lock);
|
||||
extern void _PR_FreeLock(PRLock *lock);
|
||||
@@ -540,7 +536,7 @@ extern void _PR_FreeLock(PRLock *lock);
|
||||
/************************************************************************/
|
||||
|
||||
#define _PR_CVAR_LOCK(_cvar) \
|
||||
_PR_MD_LOCK(&(_cvar)->ilock);
|
||||
_PR_MD_LOCK(&(_cvar)->ilock);
|
||||
#define _PR_CVAR_UNLOCK(_cvar) \
|
||||
_PR_MD_UNLOCK(&(_cvar)->ilock);
|
||||
|
||||
@@ -565,7 +561,7 @@ NSPR_API(void) _PR_Notify(PRMonitor *mon, PRBool all, PRBool sticky);
|
||||
#define _PR_IDLE_THREAD 0x200 /* this is an idle thread */
|
||||
#define _PR_GCABLE_THREAD 0x400 /* this is a collectable thread */
|
||||
#define _PR_BOUND_THREAD 0x800 /* a bound thread */
|
||||
#define _PR_INTERRUPT_BLOCKED 0x1000 /* interrupts blocked */
|
||||
#define _PR_INTERRUPT_BLOCKED 0x1000 /* interrupts blocked */
|
||||
|
||||
/* PRThread.state */
|
||||
#define _PR_UNBORN 0
|
||||
@@ -583,7 +579,7 @@ NSPR_API(void) _PR_Notify(PRMonitor *mon, PRBool all, PRBool sticky);
|
||||
#define _PR_STACK_MAPPED 0x2 /* vm is mapped */
|
||||
#define _PR_STACK_PRIMORDIAL 0x4 /* stack for primordial thread */
|
||||
|
||||
/*
|
||||
/*
|
||||
** If the default stcksize from the client is zero, we need to pick a machine
|
||||
** dependent value. This is only for standard user threads. For custom threads,
|
||||
** 0 has a special meaning.
|
||||
@@ -591,7 +587,7 @@ NSPR_API(void) _PR_Notify(PRMonitor *mon, PRBool all, PRBool sticky);
|
||||
*/
|
||||
|
||||
#ifndef _MD_MINIMUM_STACK_SIZE
|
||||
#define _MD_MINIMUM_STACK_SIZE 0
|
||||
#define _MD_MINIMUM_STACK_SIZE 0
|
||||
#endif
|
||||
|
||||
#if (!defined(HAVE_CUSTOM_USER_THREADS))
|
||||
@@ -610,12 +606,12 @@ NSPR_API(void) _PR_Notify(PRMonitor *mon, PRBool all, PRBool sticky);
|
||||
|
||||
#define _PR_IS_GCABLE_THREAD(thr) ((thr)->flags & _PR_GCABLE_THREAD)
|
||||
|
||||
#define _PR_PENDING_INTERRUPT(thr) \
|
||||
(!((thr)->flags & _PR_INTERRUPT_BLOCKED) && ((thr)->flags & _PR_INTERRUPT))
|
||||
#define _PR_THREAD_BLOCK_INTERRUPT(thr) \
|
||||
(thr->flags |= _PR_INTERRUPT_BLOCKED)
|
||||
#define _PR_THREAD_UNBLOCK_INTERRUPT(thr) \
|
||||
(thr->flags &= ~_PR_INTERRUPT_BLOCKED)
|
||||
#define _PR_PENDING_INTERRUPT(thr) \
|
||||
(!((thr)->flags & _PR_INTERRUPT_BLOCKED) && ((thr)->flags & _PR_INTERRUPT))
|
||||
#define _PR_THREAD_BLOCK_INTERRUPT(thr) \
|
||||
(thr->flags |= _PR_INTERRUPT_BLOCKED)
|
||||
#define _PR_THREAD_UNBLOCK_INTERRUPT(thr) \
|
||||
(thr->flags &= ~_PR_INTERRUPT_BLOCKED)
|
||||
|
||||
#define _PR_THREAD_PTR(_qp) \
|
||||
((PRThread*) ((char*) (_qp) - offsetof(PRThread,links)))
|
||||
@@ -697,28 +693,28 @@ extern void _PR_SetThreadPriority(
|
||||
PRThread* thread, PRThreadPriority priority);
|
||||
|
||||
/***********************************************************************
|
||||
** FUNCTION: _PR_NewSegment()
|
||||
** FUNCTION: _PR_NewSegment()
|
||||
** DESCRIPTION:
|
||||
** Allocate a memory segment. The "size" value is rounded up to the
|
||||
** native system page size and a page aligned portion of memory is
|
||||
** returned. This memory is not part of the malloc heap. If "vaddr" is
|
||||
** not NULL then PR tries to allocate the segment at the desired virtual
|
||||
** address.
|
||||
** INPUTS: size: size of the desired memory segment
|
||||
** INPUTS: size: size of the desired memory segment
|
||||
** vaddr: address at which the newly aquired segment is to be
|
||||
** mapped into memory.
|
||||
** OUTPUTS: a memory segment is allocated, a PRSegment is allocated
|
||||
** RETURN: pointer to PRSegment
|
||||
** OUTPUTS: a memory segment is allocated, a PRSegment is allocated
|
||||
** RETURN: pointer to PRSegment
|
||||
***********************************************************************/
|
||||
extern PRSegment* _PR_NewSegment(PRUint32 size, void *vaddr);
|
||||
|
||||
/***********************************************************************
|
||||
** FUNCTION: _PR_DestroySegment()
|
||||
** FUNCTION: _PR_DestroySegment()
|
||||
** DESCRIPTION:
|
||||
** The memory segment and the PRSegment are freed
|
||||
** INPUTS: seg: pointer to PRSegment to be freed
|
||||
** OUTPUTS: the the PRSegment and its associated memory segment are freed
|
||||
** RETURN: void
|
||||
** INPUTS: seg: pointer to PRSegment to be freed
|
||||
** OUTPUTS: the the PRSegment and its associated memory segment are freed
|
||||
** RETURN: void
|
||||
***********************************************************************/
|
||||
extern void _PR_DestroySegment(PRSegment *seg);
|
||||
|
||||
@@ -739,7 +735,7 @@ NSPR_API(PRThread*) _PR_CreateThread(PRThreadType type,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize,
|
||||
PRUint32 flags);
|
||||
PRUint32 flags);
|
||||
|
||||
extern void _PR_NativeDestroyThread(PRThread *thread);
|
||||
extern void _PR_UserDestroyThread(PRThread *thread);
|
||||
@@ -948,10 +944,6 @@ extern void _PR_MD_BEGIN_RESUME_ALL(void);
|
||||
extern void _PR_MD_END_RESUME_ALL(void);
|
||||
#define _PR_MD_END_RESUME_ALL _MD_END_RESUME_ALL
|
||||
|
||||
#if defined(IRIX)
|
||||
NSPR_API(void) _PR_IRIX_CHILD_PROCESS(void);
|
||||
#endif /* IRIX */
|
||||
|
||||
#endif /* !_PR_LOCAL_THREADS_ONLY */
|
||||
|
||||
extern void _PR_MD_CLEAN_THREAD(PRThread *thread);
|
||||
@@ -962,19 +954,19 @@ extern void _PR_MD_CREATE_PRIMORDIAL_USER_THREAD(PRThread *);
|
||||
#define _PR_MD_CREATE_PRIMORDIAL_USER_THREAD _MD_CREATE_PRIMORDIAL_USER_THREAD
|
||||
|
||||
extern PRThread* _PR_MD_CREATE_USER_THREAD(
|
||||
PRUint32 stacksize,
|
||||
void (*start)(void *),
|
||||
void *arg);
|
||||
PRUint32 stacksize,
|
||||
void (*start)(void *),
|
||||
void *arg);
|
||||
#define _PR_MD_CREATE_USER_THREAD _MD_CREATE_USER_THREAD
|
||||
#endif
|
||||
|
||||
extern PRStatus _PR_MD_CREATE_THREAD(
|
||||
PRThread *thread,
|
||||
void (*start) (void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
PRThread *thread,
|
||||
void (*start) (void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
#define _PR_MD_CREATE_THREAD _MD_CREATE_THREAD
|
||||
|
||||
extern void _PR_MD_JOIN_THREAD(_MDThread *md);
|
||||
@@ -1141,32 +1133,32 @@ extern PRInt32 _PR_MD_LISTEN(PRFileDesc *fd, PRIntn backlog);
|
||||
extern PRInt32 _PR_MD_SHUTDOWN(PRFileDesc *fd, PRIntn how);
|
||||
#define _PR_MD_SHUTDOWN _MD_SHUTDOWN
|
||||
|
||||
extern PRInt32 _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount,
|
||||
PRIntn flags, PRIntervalTime timeout);
|
||||
extern PRInt32 _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount,
|
||||
PRIntn flags, PRIntervalTime timeout);
|
||||
#define _PR_MD_RECV _MD_RECV
|
||||
|
||||
extern PRInt32 _PR_MD_SEND(
|
||||
PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
|
||||
PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
|
||||
PRIntervalTime timeout);
|
||||
#define _PR_MD_SEND _MD_SEND
|
||||
|
||||
extern PRInt32 _PR_MD_ACCEPT_READ(PRFileDesc *sd, PROsfd *newSock,
|
||||
PRNetAddr **raddr, void *buf, PRInt32 amount,
|
||||
PRIntervalTime timeout);
|
||||
extern PRInt32 _PR_MD_ACCEPT_READ(PRFileDesc *sd, PROsfd *newSock,
|
||||
PRNetAddr **raddr, void *buf, PRInt32 amount,
|
||||
PRIntervalTime timeout);
|
||||
#define _PR_MD_ACCEPT_READ _MD_ACCEPT_READ
|
||||
|
||||
#ifdef WIN32
|
||||
extern PROsfd _PR_MD_FAST_ACCEPT(PRFileDesc *fd, PRNetAddr *addr,
|
||||
PRUint32 *addrlen, PRIntervalTime timeout,
|
||||
PRBool fast,
|
||||
_PR_AcceptTimeoutCallback callback,
|
||||
void *callbackArg);
|
||||
extern PROsfd _PR_MD_FAST_ACCEPT(PRFileDesc *fd, PRNetAddr *addr,
|
||||
PRUint32 *addrlen, PRIntervalTime timeout,
|
||||
PRBool fast,
|
||||
_PR_AcceptTimeoutCallback callback,
|
||||
void *callbackArg);
|
||||
|
||||
extern PRInt32 _PR_MD_FAST_ACCEPT_READ(PRFileDesc *sd, PROsfd *newSock,
|
||||
PRNetAddr **raddr, void *buf, PRInt32 amount,
|
||||
PRIntervalTime timeout, PRBool fast,
|
||||
_PR_AcceptTimeoutCallback callback,
|
||||
void *callbackArg);
|
||||
extern PRInt32 _PR_MD_FAST_ACCEPT_READ(PRFileDesc *sd, PROsfd *newSock,
|
||||
PRNetAddr **raddr, void *buf, PRInt32 amount,
|
||||
PRIntervalTime timeout, PRBool fast,
|
||||
_PR_AcceptTimeoutCallback callback,
|
||||
void *callbackArg);
|
||||
|
||||
extern void _PR_MD_UPDATE_ACCEPT_CONTEXT(PROsfd s, PROsfd ls);
|
||||
#define _PR_MD_UPDATE_ACCEPT_CONTEXT _MD_UPDATE_ACCEPT_CONTEXT
|
||||
@@ -1180,8 +1172,8 @@ extern const PRTime _pr_filetime_offset;
|
||||
#endif /* WIN32 */
|
||||
|
||||
extern PRInt32 _PR_MD_SENDFILE(
|
||||
PRFileDesc *sock, PRSendFileData *sfd,
|
||||
PRInt32 flags, PRIntervalTime timeout);
|
||||
PRFileDesc *sock, PRSendFileData *sfd,
|
||||
PRInt32 flags, PRIntervalTime timeout);
|
||||
#define _PR_MD_SENDFILE _MD_SENDFILE
|
||||
|
||||
extern PRStatus _PR_MD_GETSOCKNAME(
|
||||
@@ -1237,7 +1229,7 @@ extern PRInt32 _PR_MD_PIPEAVAILABLE(PRFileDesc *fd);
|
||||
#define _PR_MD_PIPEAVAILABLE _MD_PIPEAVAILABLE
|
||||
|
||||
extern PRInt32 _PR_MD_PR_POLL(PRPollDesc *pds, PRIntn npds,
|
||||
PRIntervalTime timeout);
|
||||
PRIntervalTime timeout);
|
||||
#define _PR_MD_PR_POLL _MD_PR_POLL
|
||||
|
||||
/*
|
||||
@@ -1265,8 +1257,8 @@ extern PRStatus _PR_MD_SET_FD_INHERITABLE(PRFileDesc *fd, PRBool inheritable);
|
||||
PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0); \
|
||||
} else { \
|
||||
PR_SetError(PR_IO_TIMEOUT_ERROR, 0); \
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern void *_PR_MD_GET_SP(PRThread *thread);
|
||||
#define _PR_MD_GET_SP _MD_GET_SP
|
||||
|
||||
@@ -1368,32 +1360,32 @@ extern PRUintn _PR_NetAddrSize(const PRNetAddr* addr);
|
||||
*/
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_OS2)
|
||||
#define PR_NETADDR_SIZE(_addr) \
|
||||
((_addr)->raw.family == PR_AF_INET \
|
||||
? sizeof((_addr)->inet) \
|
||||
: ((_addr)->raw.family == PR_AF_INET6 \
|
||||
? sizeof(struct _md_sockaddr_in6) \
|
||||
#define PR_NETADDR_SIZE(_addr) \
|
||||
((_addr)->raw.family == PR_AF_INET \
|
||||
? sizeof((_addr)->inet) \
|
||||
: ((_addr)->raw.family == PR_AF_INET6 \
|
||||
? sizeof(struct _md_sockaddr_in6) \
|
||||
: sizeof((_addr)->local)))
|
||||
#else
|
||||
#define PR_NETADDR_SIZE(_addr) \
|
||||
((_addr)->raw.family == PR_AF_INET \
|
||||
? sizeof((_addr)->inet) \
|
||||
#define PR_NETADDR_SIZE(_addr) \
|
||||
((_addr)->raw.family == PR_AF_INET \
|
||||
? sizeof((_addr)->inet) \
|
||||
: sizeof(struct _md_sockaddr_in6))
|
||||
#endif /* defined(XP_UNIX) */
|
||||
|
||||
#else
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_OS2)
|
||||
#define PR_NETADDR_SIZE(_addr) \
|
||||
((_addr)->raw.family == PR_AF_INET \
|
||||
? sizeof((_addr)->inet) \
|
||||
: ((_addr)->raw.family == PR_AF_INET6 \
|
||||
? sizeof((_addr)->ipv6) \
|
||||
#define PR_NETADDR_SIZE(_addr) \
|
||||
((_addr)->raw.family == PR_AF_INET \
|
||||
? sizeof((_addr)->inet) \
|
||||
: ((_addr)->raw.family == PR_AF_INET6 \
|
||||
? sizeof((_addr)->ipv6) \
|
||||
: sizeof((_addr)->local)))
|
||||
#else
|
||||
#define PR_NETADDR_SIZE(_addr) \
|
||||
((_addr)->raw.family == PR_AF_INET \
|
||||
? sizeof((_addr)->inet) \
|
||||
#define PR_NETADDR_SIZE(_addr) \
|
||||
((_addr)->raw.family == PR_AF_INET \
|
||||
? sizeof((_addr)->inet) \
|
||||
: sizeof((_addr)->ipv6))
|
||||
#endif /* defined(XP_UNIX) */
|
||||
|
||||
@@ -1411,14 +1403,14 @@ struct PRLock {
|
||||
PRBool locked; /* whether the mutex is locked */
|
||||
pthread_t owner; /* if locked, current lock owner */
|
||||
#elif defined(_PR_BTHREADS)
|
||||
sem_id semaphoreID; /* the underlying lock */
|
||||
int32 benaphoreCount; /* number of people in lock */
|
||||
thread_id owner; /* current lock owner */
|
||||
sem_id semaphoreID; /* the underlying lock */
|
||||
int32 benaphoreCount; /* number of people in lock */
|
||||
thread_id owner; /* current lock owner */
|
||||
#else /* not pthreads or Be threads */
|
||||
PRCList links; /* linkage for PRThread.lockList */
|
||||
struct PRThread *owner; /* current lock owner */
|
||||
PRCList waitQ; /* list of threads waiting for lock */
|
||||
PRThreadPriority priority; /* priority of lock */
|
||||
PRThreadPriority priority; /* priority of lock */
|
||||
PRThreadPriority boostPriority; /* boosted priority of lock owner */
|
||||
_MDLock ilock; /* Internal Lock to protect user-level fields */
|
||||
#endif
|
||||
@@ -1541,7 +1533,7 @@ struct PRThreadStack {
|
||||
PRUint32 stackSize; /* size of usable portion of the stack */
|
||||
|
||||
PRSegment *seg;
|
||||
PRThread* thr; /* back pointer to thread owning this stack */
|
||||
PRThread* thr; /* back pointer to thread owning this stack */
|
||||
|
||||
#if defined(_PR_PTHREADS)
|
||||
#else /* defined(_PR_PTHREADS) */
|
||||
@@ -1653,19 +1645,19 @@ struct PRThread {
|
||||
_PRCPU *cpu; /* cpu to which this thread is bound */
|
||||
PRUint32 threadAllocatedOnStack;/* boolean */
|
||||
|
||||
/* When an async IO is in progress and a second async IO cannot be
|
||||
/* When an async IO is in progress and a second async IO cannot be
|
||||
* initiated, the io_pending flag is set to true. Some platforms will
|
||||
* not use the io_pending flag. If the io_pending flag is true, then
|
||||
* io_fd is the OS-file descriptor on which IO is pending.
|
||||
*/
|
||||
PRBool io_pending;
|
||||
PRInt32 io_fd;
|
||||
|
||||
|
||||
/* If a timeout occurs or if an outstanding IO is interrupted and the
|
||||
* OS doesn't support a real cancellation (NT or MAC), then the
|
||||
* OS doesn't support a real cancellation (NT or MAC), then the
|
||||
* io_suspended flag will be set to true. The thread will be resumed
|
||||
* but may run into trouble issuing additional IOs until the io_pending
|
||||
* flag can be cleared
|
||||
* flag can be cleared
|
||||
*/
|
||||
PRBool io_suspended;
|
||||
|
||||
@@ -1743,8 +1735,8 @@ struct PRFilePrivate {
|
||||
_MDFileDesc md;
|
||||
#ifdef _PR_NEED_SECRET_AF
|
||||
PRUint16 af; /* If the platform's implementation of accept()
|
||||
* requires knowing the address family of the
|
||||
* socket, we save the address family here. */
|
||||
* requires knowing the address family of the
|
||||
* socket, we save the address family here. */
|
||||
#endif
|
||||
|
||||
#if defined(_WIN64)
|
||||
@@ -1778,10 +1770,10 @@ struct PRDir {
|
||||
};
|
||||
|
||||
#ifdef MOZ_UNICODE
|
||||
struct PRDirUTF16 {
|
||||
PRDirEntry d;
|
||||
_MDDirUTF16 md;
|
||||
};
|
||||
struct PRDirUTF16 {
|
||||
PRDirEntry d;
|
||||
_MDDirUTF16 md;
|
||||
};
|
||||
#endif /* MOZ_UNICODE */
|
||||
|
||||
extern void _PR_InitLocks(void);
|
||||
@@ -1921,7 +1913,7 @@ extern PRStatus _PR_MD_WAIT_PROCESS(PRProcess *process, PRInt32 *exitCode);
|
||||
#define _PR_MD_WAIT_PROCESS _MD_WAIT_PROCESS
|
||||
|
||||
extern PRStatus _PR_MD_KILL_PROCESS(PRProcess *process);
|
||||
#define _PR_MD_KILL_PROCESS _MD_KILL_PROCESS
|
||||
#define _PR_MD_KILL_PROCESS _MD_KILL_PROCESS
|
||||
|
||||
/* Current Time */
|
||||
NSPR_API(PRTime) _PR_MD_NOW(void);
|
||||
@@ -2024,7 +2016,7 @@ extern PRStatus _PR_MD_SYNC_MEM_MAP(
|
||||
/*
|
||||
** Declare PRSharedMemory.
|
||||
*/
|
||||
struct PRSharedMemory
|
||||
struct PRSharedMemory
|
||||
{
|
||||
char *ipcname; /* after conversion to native */
|
||||
PRSize size; /* from open */
|
||||
@@ -2042,8 +2034,8 @@ struct PRSharedMemory
|
||||
PRUint32 ident; /* guard word at end of struct */
|
||||
#define _PR_SHM_IDENT 0xdeadbad
|
||||
};
|
||||
|
||||
extern PRSharedMemory * _MD_OpenSharedMemory(
|
||||
|
||||
extern PRSharedMemory * _MD_OpenSharedMemory(
|
||||
const char *name,
|
||||
PRSize size,
|
||||
PRIntn flags,
|
||||
@@ -2063,7 +2055,7 @@ extern PRStatus _MD_CloseSharedMemory( PRSharedMemory *shm );
|
||||
extern PRStatus _MD_DeleteSharedMemory( const char *name );
|
||||
#define _PR_MD_DELETE_SHARED_MEMORY _MD_DeleteSharedMemory
|
||||
|
||||
extern PRFileMap* _md_OpenAnonFileMap(
|
||||
extern PRFileMap* _md_OpenAnonFileMap(
|
||||
const char *dirName,
|
||||
PRSize size,
|
||||
PRFileMapProtect prot
|
||||
@@ -2140,27 +2132,10 @@ extern PRSize _pr_CopyLowBits( void *dest, PRSize dstlen, void *src, PRSize srcl
|
||||
|
||||
/* end PR_GetRandomNoise() related */
|
||||
|
||||
#ifdef XP_BEOS
|
||||
|
||||
extern PRLock *_connectLock;
|
||||
|
||||
typedef struct _ConnectListNode {
|
||||
PRInt32 osfd;
|
||||
PRNetAddr addr;
|
||||
PRUint32 addrlen;
|
||||
PRIntervalTime timeout;
|
||||
} ConnectListNode;
|
||||
|
||||
extern ConnectListNode connectList[64];
|
||||
|
||||
extern PRUint32 connectCount;
|
||||
|
||||
#endif /* XP_BEOS */
|
||||
|
||||
#if defined(_WIN64) && defined(WIN95)
|
||||
typedef struct _PRFileDescList {
|
||||
PRFileDesc *fd;
|
||||
struct _PRFileDescList *next;
|
||||
PRFileDesc *fd;
|
||||
struct _PRFileDescList *next;
|
||||
} PRFileDescList;
|
||||
|
||||
extern PRLock *_fd_waiting_for_overlapped_done_lock;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user