Bugzilla bug #62457: set the flock structure correctly and use fcntl

file locking on AIX 4.3, HP-UX 11.00, IRIX, Linux, OSF1 V4.0, and Solaris.
Modified Files: AIX.mk, HP-UX.mk, IRIX.mk, Linux.mk, OSF1.mk, SunOS5.mk,
and unix.c.
This commit is contained in:
wtc%netscape.com 2000-12-22 06:02:52 +00:00
Родитель 4b8a17e7d7
Коммит 80ad6dc3ae
7 изменённых файлов: 21 добавлений и 4 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -116,7 +116,7 @@ else
endif
endif
ODD_CFLAGS += -DSVR4 -DIRIX
ODD_CFLAGS += -DSVR4 -DIRIX -DHAVE_FCNTL_FILE_LOCKING
CPU_ARCH = mips

Просмотреть файл

@ -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)

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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;