diff --git a/nsprpub/config/AIX.mk b/nsprpub/config/AIX.mk index 3c64804d4baa..0df9d2db53a6 100644 --- a/nsprpub/config/AIX.mk +++ b/nsprpub/config/AIX.mk @@ -134,6 +134,10 @@ ifeq ($(OS_RELEASE),4.3) OS_CFLAGS += -DHAVE_SOCKLEN_T endif +ifneq (,$(filter-out 3.2 4.1 4.2,$(OS_RELEASE))) +OS_CFLAGS += -DHAVE_FCNTL_FILE_LOCKING +endif + ifeq (,$(filter-out 4.2 4.3,$(OS_RELEASE))) # On these OS revisions, localtime_r() is declared if _THREAD_SAFE # is defined. diff --git a/nsprpub/config/HP-UX.mk b/nsprpub/config/HP-UX.mk index 475bb155173a..63208618a508 100644 --- a/nsprpub/config/HP-UX.mk +++ b/nsprpub/config/HP-UX.mk @@ -143,7 +143,7 @@ ifeq ($(OS_RELEASE),B.11.00) COMPILER_TAG = _32 endif endif -OS_CFLAGS += -DHPUX10 -DHPUX11 -D_LARGEFILE64_SOURCE -D_PR_HAVE_OFF64_T +OS_CFLAGS += -DHPUX10 -DHPUX11 -D_LARGEFILE64_SOURCE -D_PR_HAVE_OFF64_T -DHAVE_FCNTL_FILE_LOCKING DEFAULT_IMPL_STRATEGY = _PTH endif diff --git a/nsprpub/config/IRIX.mk b/nsprpub/config/IRIX.mk index 46e568055098..8620ea6590dc 100644 --- a/nsprpub/config/IRIX.mk +++ b/nsprpub/config/IRIX.mk @@ -116,7 +116,7 @@ else endif endif -ODD_CFLAGS += -DSVR4 -DIRIX +ODD_CFLAGS += -DSVR4 -DIRIX -DHAVE_FCNTL_FILE_LOCKING CPU_ARCH = mips diff --git a/nsprpub/config/Linux.mk b/nsprpub/config/Linux.mk index daad17f5b52b..eabdb5b1433b 100644 --- a/nsprpub/config/Linux.mk +++ b/nsprpub/config/Linux.mk @@ -82,7 +82,7 @@ OS_INCLUDES = G++INCLUDES = -I/usr/include/g++ PLATFORM_FLAGS = -ansi -Wall -pipe -DLINUX -Dlinux -PORT_FLAGS = -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -DHAVE_STRERROR +PORT_FLAGS = -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -DHAVE_STRERROR -DHAVE_FCNTL_FILE_LOCKING OS_CFLAGS = $(DSO_CFLAGS) $(PLATFORM_FLAGS) $(PORT_FLAGS) diff --git a/nsprpub/config/OSF1.mk b/nsprpub/config/OSF1.mk index 5a80c457f965..ad97558b5ae8 100644 --- a/nsprpub/config/OSF1.mk +++ b/nsprpub/config/OSF1.mk @@ -96,6 +96,10 @@ ifneq (,$(filter-out V2.0 V3.2,$(OS_RELEASE))) OS_CFLAGS += -DOSF1_HAVE_MACHINE_BUILTINS_H endif +ifneq (,$(filter-out V2.0 V3.2,$(OS_RELEASE))) +OS_CFLAGS += -DHAVE_FCNTL_FILE_LOCKING +endif + ifeq (,$(filter-out V2.0 V3.2,$(OS_RELEASE))) OS_CFLAGS += -DHAVE_INT_LOCALTIME_R else diff --git a/nsprpub/config/SunOS5.mk b/nsprpub/config/SunOS5.mk index af7973fdee24..176028343767 100644 --- a/nsprpub/config/SunOS5.mk +++ b/nsprpub/config/SunOS5.mk @@ -109,7 +109,7 @@ endif RANLIB = echo -OS_DEFINES = -DSVR4 -DSYSV -D__svr4 -D__svr4__ -DSOLARIS +OS_DEFINES = -DSVR4 -DSYSV -D__svr4 -D__svr4__ -DSOLARIS -DHAVE_FCNTL_FILE_LOCKING ifeq ($(OS_TEST),i86pc) CPU_ARCH = x86 diff --git a/nsprpub/pr/src/md/unix/unix.c b/nsprpub/pr/src/md/unix/unix.c index 1a9d25362866..ad97f4699dbc 100644 --- a/nsprpub/pr/src/md/unix/unix.c +++ b/nsprpub/pr/src/md/unix/unix.c @@ -3305,6 +3305,9 @@ _MD_LockFile(PRInt32 f) struct flock arg; arg.l_type = F_WRLCK; + arg.l_whence = SEEK_SET; + arg.l_start = 0; + arg.l_len = 0; /* until EOF */ rv = fcntl(f, F_SETLKW, &arg); if (rv == 0) return PR_SUCCESS; @@ -3319,6 +3322,9 @@ _MD_TLockFile(PRInt32 f) struct flock arg; arg.l_type = F_WRLCK; + arg.l_whence = SEEK_SET; + arg.l_start = 0; + arg.l_len = 0; /* until EOF */ rv = fcntl(f, F_SETLK, &arg); if (rv == 0) return PR_SUCCESS; @@ -3333,6 +3339,9 @@ _MD_UnlockFile(PRInt32 f) struct flock arg; arg.l_type = F_UNLCK; + arg.l_whence = SEEK_SET; + arg.l_start = 0; + arg.l_len = 0; /* until EOF */ rv = fcntl(f, F_SETLK, &arg); if (rv == 0) return PR_SUCCESS;