summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsource3/configure183
-rw-r--r--source3/configure.in24
-rw-r--r--source3/include/config.h.in1
-rw-r--r--source3/include/includes.h60
-rw-r--r--source3/include/proto.h8
-rw-r--r--source3/lib/pidfile.c2
-rw-r--r--source3/lib/util.c112
-rw-r--r--source3/locking/locking.c41
-rw-r--r--source3/locking/locking_slow.c6
-rw-r--r--source3/locking/shmem.c8
-rw-r--r--source3/passdb/smbpassfile.c4
-rw-r--r--source3/smbd/connection.c18
-rw-r--r--source3/smbd/open.c4
13 files changed, 298 insertions, 173 deletions
diff --git a/source3/configure b/source3/configure
index 827e2984d4..30b28fbe41 100755
--- a/source3/configure
+++ b/source3/configure
@@ -3675,10 +3675,11 @@ then
#define SIZEOF_OFF_T 8
EOF
-echo no
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
fi
rm -fr conftest*
fi
@@ -3689,13 +3690,13 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3693 "configure"
+#line 3694 "configure"
#include "confdefs.h"
#include <stdio.h>
#include <sys/stat.h>
main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }
EOF
-if { (eval echo configure:3699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes;cat >> confdefs.h <<\EOF
#define HAVE_OFF64_T 1
@@ -3716,7 +3717,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3720 "configure"
+#line 3721 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -3724,7 +3725,7 @@ else
#include <sys/sem.h>
main() { union semun ss; exit(0); }
EOF
-if { (eval echo configure:3728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes;cat >> confdefs.h <<\EOF
#define HAVE_UNION_SEMUN 1
@@ -3745,12 +3746,12 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3749 "configure"
+#line 3750 "configure"
#include "confdefs.h"
#include <stdio.h>
main() { char c; c=250; exit((c > 0)?0:1); }
EOF
-if { (eval echo configure:3754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes;cat >> confdefs.h <<\EOF
#define HAVE_UNSIGNED_CHAR 1
@@ -3768,7 +3769,7 @@ fi
echo $ac_n "checking for sin_len in sock ... $ac_c"
cat > conftest.$ac_ext <<EOF
-#line 3772 "configure"
+#line 3773 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
@@ -3777,7 +3778,7 @@ int main() {
struct sockaddr_in sock; sock.sin_len = sizeof(sock);
; return 0; }
EOF
-if { (eval echo configure:3781: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3782: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo yes;cat >> confdefs.h <<\EOF
#define HAVE_SOCK_SIN_LEN 1
@@ -3793,14 +3794,14 @@ rm -f conftest*
echo $ac_n "checking for __FILE__ macro ... $ac_c"
cat > conftest.$ac_ext <<EOF
-#line 3797 "configure"
+#line 3798 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
printf("%s\n", __FILE__);
; return 0; }
EOF
-if { (eval echo configure:3804: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3805: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo yes;cat >> confdefs.h <<\EOF
#define HAVE_FILE_MACRO 1
@@ -3816,14 +3817,14 @@ rm -f conftest*
echo $ac_n "checking for __FUNCTION__ macro ... $ac_c"
cat > conftest.$ac_ext <<EOF
-#line 3820 "configure"
+#line 3821 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
printf("%s\n", __FUNCTION__);
; return 0; }
EOF
-if { (eval echo configure:3827: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3828: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo yes;cat >> confdefs.h <<\EOF
#define HAVE_FUNCTION_MACRO 1
@@ -3842,14 +3843,14 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3846 "configure"
+#line 3847 "configure"
#include "confdefs.h"
#include <sys/time.h>
#include <unistd.h>
main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}
EOF
-if { (eval echo configure:3853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes;cat >> confdefs.h <<\EOF
#define HAVE_GETTIMEOFDAY_TZ 1
@@ -3871,7 +3872,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3875 "configure"
+#line 3876 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <dirent.h>
@@ -3879,7 +3880,7 @@ main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
di->d_name[0] == 0) exit(0); exit(1);}
EOF
-if { (eval echo configure:3883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes - you are using the broken /usr/ucb/cc;cat >> confdefs.h <<\EOF
#define HAVE_BROKEN_READDIR 1
@@ -3897,7 +3898,7 @@ fi
echo $ac_n "checking for utimbuf ... $ac_c"
cat > conftest.$ac_ext <<EOF
-#line 3901 "configure"
+#line 3902 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <utime.h>
@@ -3905,7 +3906,7 @@ int main() {
struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));
; return 0; }
EOF
-if { (eval echo configure:3909: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3910: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo yes;cat >> confdefs.h <<\EOF
#define HAVE_UTIMBUF 1
@@ -3924,11 +3925,11 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3928 "configure"
+#line 3929 "configure"
#include "confdefs.h"
#include "tests/ftruncate.c"
EOF
-if { (eval echo configure:3932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes;cat >> confdefs.h <<\EOF
#define HAVE_FTRUNCATE_EXTEND 1
@@ -3949,11 +3950,11 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3953 "configure"
+#line 3954 "configure"
#include "confdefs.h"
#include "tests/getgroups.c"
EOF
-if { (eval echo configure:3957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes;cat >> confdefs.h <<\EOF
#define HAVE_BROKEN_GETGROUPS 1
@@ -3975,7 +3976,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3979 "configure"
+#line 3980 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -3987,7 +3988,7 @@ if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
exit(1);}
EOF
-if { (eval echo configure:3991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes;cat >> confdefs.h <<\EOF
#define REPLACE_INET_NTOA 1
@@ -4008,11 +4009,11 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4012 "configure"
+#line 4013 "configure"
#include "confdefs.h"
main() { exit(getuid() != 0); }
EOF
-if { (eval echo configure:4016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4017: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes;cat >> confdefs.h <<\EOF
#define HAVE_ROOT 1
@@ -4034,14 +4035,14 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4038 "configure"
+#line 4039 "configure"
#include "confdefs.h"
#define HAVE_NETMASK_IFCONF 1
#define AUTOCONF 1
#include "lib/netmask.c"
EOF
-if { (eval echo configure:4045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes;netmask=yes;cat >> confdefs.h <<\EOF
#define HAVE_NETMASK_IFCONF 1
@@ -4063,14 +4064,14 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4067 "configure"
+#line 4068 "configure"
#include "confdefs.h"
#define HAVE_NETMASK_IFREQ 1
#define AUTOCONF 1
#include "lib/netmask.c"
EOF
-if { (eval echo configure:4074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes;netmask=yes;cat >> confdefs.h <<\EOF
#define HAVE_NETMASK_IFREQ 1
@@ -4093,14 +4094,14 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4097 "configure"
+#line 4098 "configure"
#include "confdefs.h"
#define HAVE_NETMASK_AIX 1
#define AUTOCONF 1
#include "lib/netmask.c"
EOF
-if { (eval echo configure:4104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes;netmask=yes;cat >> confdefs.h <<\EOF
#define HAVE_NETMASK_AIX 1
@@ -4122,11 +4123,11 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4126 "configure"
+#line 4127 "configure"
#include "confdefs.h"
#include "tests/trapdoor.c"
EOF
-if { (eval echo configure:4130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4131: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo no
else
@@ -4147,11 +4148,11 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4151 "configure"
+#line 4152 "configure"
#include "confdefs.h"
#include "tests/shared_mmap.c"
EOF
-if { (eval echo configure:4155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4156: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes;cat >> confdefs.h <<\EOF
#define HAVE_SHARED_MMAP 1
@@ -4172,11 +4173,11 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4176 "configure"
+#line 4177 "configure"
#include "confdefs.h"
#include "tests/fcntl_lock.c"
EOF
-if { (eval echo configure:4180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes;cat >> confdefs.h <<\EOF
#define HAVE_FCNTL_LOCK 1
@@ -4192,16 +4193,58 @@ rm -fr conftest*
fi
+echo $ac_n "checking for 64 bit fcntl locking ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4202 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_SYS_FCNTL_H
+#include <sys/fcntl.h>
+#endif
+main() { struct flock64 fl64;
+#if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
+exit(0);
+#else
+exit(1);
+#endif
+}
+EOF
+if { (eval echo configure:4223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes;cat >> confdefs.h <<\EOF
+#define HAVE_STRUCT_FLOCK64 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
+fi
+rm -fr conftest*
+fi
+
+
echo $ac_n "checking for sysv ipc ... $ac_c"
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4201 "configure"
+#line 4244 "configure"
#include "confdefs.h"
#include "tests/sysv_ipc.c"
EOF
-if { (eval echo configure:4205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
echo yes;cat >> confdefs.h <<\EOF
#define HAVE_SYSV_IPC 1
@@ -4220,7 +4263,7 @@ fi
#################################################
# check for the AFS filesystem
echo $ac_n "checking whether to use AFS""... $ac_c" 1>&6
-echo "configure:4224: checking whether to use AFS" >&5
+echo "configure:4267: checking whether to use AFS" >&5
# Check whether --with-afs or --without-afs was given.
if test "${with_afs+set}" = set; then
withval="$with_afs"
@@ -4246,7 +4289,7 @@ fi
#################################################
# check for the DFS auth system
echo $ac_n "checking whether to use DFS auth""... $ac_c" 1>&6
-echo "configure:4250: checking whether to use DFS auth" >&5
+echo "configure:4293: checking whether to use DFS auth" >&5
# Check whether --with-dfs or --without-dfs was given.
if test "${with_dfs+set}" = set; then
withval="$with_dfs"
@@ -4271,7 +4314,7 @@ fi
#################################################
# check for automount support
echo $ac_n "checking whether to use AUTOMOUNT""... $ac_c" 1>&6
-echo "configure:4275: checking whether to use AUTOMOUNT" >&5
+echo "configure:4318: checking whether to use AUTOMOUNT" >&5
# Check whether --with-automount or --without-automount was given.
if test "${with_automount+set}" = set; then
withval="$with_automount"
@@ -4296,7 +4339,7 @@ fi
#################################################
# check for a LDAP password database
echo $ac_n "checking whether to use LDAP password database""... $ac_c" 1>&6
-echo "configure:4300: checking whether to use LDAP password database" >&5
+echo "configure:4343: checking whether to use LDAP password database" >&5
# Check whether --with-ldap or --without-ldap was given.
if test "${with_ldap+set}" = set; then
withval="$with_ldap"
@@ -4321,7 +4364,7 @@ fi
#################################################
# check for a NISPLUS password database
echo $ac_n "checking whether to use NISPLUS password database""... $ac_c" 1>&6
-echo "configure:4325: checking whether to use NISPLUS password database" >&5
+echo "configure:4368: checking whether to use NISPLUS password database" >&5
# Check whether --with-nisplus or --without-nisplus was given.
if test "${with_nisplus+set}" = set; then
withval="$with_nisplus"
@@ -4346,7 +4389,7 @@ fi
#################################################
# check for a NISPLUS_HOME support
echo $ac_n "checking whether to use NISPLUS_HOME""... $ac_c" 1>&6
-echo "configure:4350: checking whether to use NISPLUS_HOME" >&5
+echo "configure:4393: checking whether to use NISPLUS_HOME" >&5
# Check whether --with-nisplus-home or --without-nisplus-home was given.
if test "${with_nisplus_home+set}" = set; then
withval="$with_nisplus_home"
@@ -4371,7 +4414,7 @@ fi
#################################################
# check for the secure socket layer
echo $ac_n "checking whether to use SSL""... $ac_c" 1>&6
-echo "configure:4375: checking whether to use SSL" >&5
+echo "configure:4418: checking whether to use SSL" >&5
# Check whether --with-ssl or --without-ssl was given.
if test "${with_ssl+set}" = set; then
withval="$with_ssl"
@@ -4396,7 +4439,7 @@ fi
#################################################
# check for experimental mmap support
echo $ac_n "checking whether to use MMAP""... $ac_c" 1>&6
-echo "configure:4400: checking whether to use MMAP" >&5
+echo "configure:4443: checking whether to use MMAP" >&5
# Check whether --with-mmap or --without-mmap was given.
if test "${with_mmap+set}" = set; then
withval="$with_mmap"
@@ -4421,7 +4464,7 @@ fi
#################################################
# check for syslog logging
echo $ac_n "checking whether to use syslog logging""... $ac_c" 1>&6
-echo "configure:4425: checking whether to use syslog logging" >&5
+echo "configure:4468: checking whether to use syslog logging" >&5
# Check whether --with-syslog or --without-syslog was given.
if test "${with_syslog+set}" = set; then
withval="$with_syslog"
@@ -4446,7 +4489,7 @@ fi
#################################################
# check for experimental netatalk resource fork support
echo $ac_n "checking whether to support netatalk""... $ac_c" 1>&6
-echo "configure:4450: checking whether to support netatalk" >&5
+echo "configure:4493: checking whether to support netatalk" >&5
# Check whether --with-netatalk or --without-netatalk was given.
if test "${with_netatalk+set}" = set; then
withval="$with_netatalk"
@@ -4472,7 +4515,7 @@ fi
#################################################
# these tests are taken from the GNU fileutils package
echo "checking how to get filesystem space usage" 1>&6
-echo "configure:4476: checking how to get filesystem space usage" >&5
+echo "configure:4519: checking how to get filesystem space usage" >&5
space=no
# Perform only the link test since it seems there are no variants of the
@@ -4484,12 +4527,12 @@ space=no
if test $space = no; then
# SVR4
echo $ac_n "checking statvfs function (SVR4)""... $ac_c" 1>&6
-echo "configure:4488: checking statvfs function (SVR4)" >&5
+echo "configure:4531: checking statvfs function (SVR4)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statvfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4493 "configure"
+#line 4536 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/statvfs.h>
@@ -4497,7 +4540,7 @@ int main() {
struct statvfs fsd; statvfs (0, &fsd);
; return 0; }
EOF
-if { (eval echo configure:4501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
fu_cv_sys_stat_statvfs=yes
else
@@ -4522,7 +4565,7 @@ fi
if test $space = no; then
# DEC Alpha running OSF/1
echo $ac_n "checking for 3-argument statfs function (DEC OSF/1)""... $ac_c" 1>&6
-echo "configure:4526: checking for 3-argument statfs function (DEC OSF/1)" >&5
+echo "configure:4569: checking for 3-argument statfs function (DEC OSF/1)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs3_osf1'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4530,7 +4573,7 @@ else
fu_cv_sys_stat_statfs3_osf1=no
else
cat > conftest.$ac_ext <<EOF
-#line 4534 "configure"
+#line 4577 "configure"
#include "confdefs.h"
#include <sys/param.h>
@@ -4543,7 +4586,7 @@ else
exit (statfs (".", &fsd, sizeof (struct statfs)));
}
EOF
-if { (eval echo configure:4547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs3_osf1=yes
else
@@ -4570,7 +4613,7 @@ fi
if test $space = no; then
# AIX
echo $ac_n "checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)""... $ac_c" 1>&6
-echo "configure:4574: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5
+echo "configure:4617: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs2_bsize'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4578,7 +4621,7 @@ else
fu_cv_sys_stat_statfs2_bsize=no
else
cat > conftest.$ac_ext <<EOF
-#line 4582 "configure"
+#line 4625 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_PARAM_H
@@ -4597,7 +4640,7 @@ else
exit (statfs (".", &fsd));
}
EOF
-if { (eval echo configure:4601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs2_bsize=yes
else
@@ -4624,7 +4667,7 @@ fi
if test $space = no; then
# SVR3
echo $ac_n "checking for four-argument statfs (AIX-3.2.5, SVR3)""... $ac_c" 1>&6
-echo "configure:4628: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5
+echo "configure:4671: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs4'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4632,7 +4675,7 @@ else
fu_cv_sys_stat_statfs4=no
else
cat > conftest.$ac_ext <<EOF
-#line 4636 "configure"
+#line 4679 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/statfs.h>
@@ -4642,7 +4685,7 @@ else
exit (statfs (".", &fsd, sizeof fsd, 0));
}
EOF
-if { (eval echo configure:4646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs4=yes
else
@@ -4669,7 +4712,7 @@ fi
if test $space = no; then
# 4.4BSD and NetBSD
echo $ac_n "checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)""... $ac_c" 1>&6
-echo "configure:4673: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5
+echo "configure:4716: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs2_fsize'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4677,7 +4720,7 @@ else
fu_cv_sys_stat_statfs2_fsize=no
else
cat > conftest.$ac_ext <<EOF
-#line 4681 "configure"
+#line 4724 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
@@ -4693,7 +4736,7 @@ else
exit (statfs (".", &fsd));
}
EOF
-if { (eval echo configure:4697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_statfs2_fsize=yes
else
@@ -4720,7 +4763,7 @@ fi
if test $space = no; then
# Ultrix
echo $ac_n "checking for two-argument statfs with struct fs_data (Ultrix)""... $ac_c" 1>&6
-echo "configure:4724: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
+echo "configure:4767: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
if eval "test \"`echo '$''{'fu_cv_sys_stat_fs_data'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4728,7 +4771,7 @@ else
fu_cv_sys_stat_fs_data=no
else
cat > conftest.$ac_ext <<EOF
-#line 4732 "configure"
+#line 4775 "configure"
#include "confdefs.h"
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
@@ -4748,7 +4791,7 @@ else
exit (statfs (".", &fsd) != 1);
}
EOF
-if { (eval echo configure:4752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
fu_cv_sys_stat_fs_data=yes
else
diff --git a/source3/configure.in b/source3/configure.in
index 6904155a9d..a1992c0fe0 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -174,7 +174,7 @@ echo $ac_n "checking for 64 bit off_t ... $ac_c"
AC_TRY_RUN([#include <stdio.h>
#include <sys/stat.h>
main() { exit((sizeof(off_t) == 8) ? 0 : 1); }],
-echo yes;AC_DEFINE(SIZEOF_OFF_T,8)
+echo yes;AC_DEFINE(SIZEOF_OFF_T,8),
echo no)
echo $ac_n "checking for off64_t ... $ac_c"
@@ -315,6 +315,28 @@ AC_TRY_RUN([#include "tests/fcntl_lock.c"],
echo yes;AC_DEFINE(HAVE_FCNTL_LOCK),
echo no)
+echo $ac_n "checking for 64 bit fcntl locking ... $ac_c"
+AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_SYS_FCNTL_H
+#include <sys/fcntl.h>
+#endif
+main() { struct flock64 fl64;
+#if defined(F_SETLKW64) && defined(F_SETLK64) && defined(F_GETLK64)
+exit(0);
+#else
+exit(1);
+#endif
+}],
+ echo yes;AC_DEFINE(HAVE_STRUCT_FLOCK64),
+ echo no)
+
echo $ac_n "checking for sysv ipc ... $ac_c"
AC_TRY_RUN([#include "tests/sysv_ipc.c"],
echo yes;AC_DEFINE(HAVE_SYSV_IPC),
diff --git a/source3/include/config.h.in b/source3/include/config.h.in
index 71304c86b4..80160fb4b4 100644
--- a/source3/include/config.h.in
+++ b/source3/include/config.h.in
@@ -81,6 +81,7 @@
#undef HAVE_SHARED_MMAP
#undef HAVE_SYSV_IPC
#undef HAVE_FCNTL_LOCK
+#undef HAVE_STRUCT_FLOCK64
#undef HAVE_FTRUNCATE_EXTEND
#undef HAVE_TRAPDOOR_UID
#undef HAVE_ROOT
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 41fccce5fe..4086bd53fe 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -330,11 +330,11 @@
#endif
#ifndef SMB_OFF_T
-#ifdef HAVE_OFF64_T
-#define SMB_OFF_T off64_t
-#else
-#define SMB_OFF_T off_t
-#endif
+# ifdef HAVE_OFF64_T
+# define SMB_OFF_T off64_t
+# else
+# define SMB_OFF_T off_t
+# endif
#endif
/*
@@ -343,9 +343,9 @@
*/
#ifndef LARGE_SMB_OFF_T
-#if defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8))
-#define LARGE_SMB_OFF_T 1
-#endif
+# if defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8))
+# define LARGE_SMB_OFF_T 1
+# endif
#endif
/*
@@ -353,11 +353,47 @@
*/
#ifndef SMB_STRUCT_STAT
-#if defined(HAVE_STAT64) && defined(HAVE_OFF64_T)
-#define SMB_STRUCT_STAT struct stat64
-#else
-#define SMB_STRUCT_STAT struct stat
+# if defined(HAVE_STAT64) && defined(HAVE_OFF64_T)
+# define SMB_STRUCT_STAT struct stat64
+# else
+# define SMB_STRUCT_STAT struct stat
+# endif
+#endif
+
+/*
+ * Defines for 64 bit fcntl locks.
+ */
+
+#ifndef SMB_STRUCT_FLOCK
+# if defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
+# define SMB_STRUCT_FLOCK struct flock64
+# else
+# define SMB_STRUCT_FLOCK struct flock
+# endif
+#endif
+
+#ifndef SMB_F_SETLKW
+# if defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
+# define SMB_F_SETLKW F_SETLKW64
+# else
+# define SMB_F_SETLKW F_SETLKW
+# endif
#endif
+
+#ifndef SMB_F_SETLK
+# if defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
+# define SMB_F_SETLK F_SETLK64
+# else
+# define SMB_F_SETLK F_SETLK
+# endif
+#endif
+
+#ifndef SMB_F_GETLK
+# if defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
+# define SMB_F_GETLK F_GETLK64
+# else
+# define SMB_F_GETLK F_GETLK
+# endif
#endif
#ifndef MIN
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 0e6dc54d34..7313fef8f8 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -337,7 +337,7 @@ char *readdirname(void *p);
BOOL is_in_path(char *name, name_compare_entry *namelist);
void set_namearray(name_compare_entry **ppname_array, char *namelist);
void free_namearray(name_compare_entry *name_array);
-BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type);
+BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
int file_lock(char *name,int timeout);
void file_unlock(int fd);
BOOL is_myname(char *s);
@@ -493,12 +493,12 @@ char *smb_errstr(char *inbuf);
/*The following definitions come from locking/locking.c */
BOOL is_locked(files_struct *fsp,connection_struct *conn,
- uint32 count,uint32 offset, int lock_type);
+ SMB_OFF_T count,SMB_OFF_T offset, int lock_type);
BOOL do_lock(files_struct *fsp,connection_struct *conn,
- uint32 count,uint32 offset,int lock_type,
+ SMB_OFF_T count,SMB_OFF_T offset,int lock_type,
int *eclass,uint32 *ecode);
BOOL do_unlock(files_struct *fsp,connection_struct *conn,
- uint32 count,uint32 offset,int *eclass,uint32 *ecode);
+ SMB_OFF_T count,SMB_OFF_T offset,int *eclass,uint32 *ecode);
BOOL locking_init(int read_only);
BOOL locking_end(void);
BOOL lock_share_entry(connection_struct *conn,
diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c
index fecc759da9..b8c782f3d6 100644
--- a/source3/lib/pidfile.c
+++ b/source3/lib/pidfile.c
@@ -78,7 +78,7 @@ void pidfile_create(char *name)
exit(1);
}
- if (fcntl_lock(fd,F_SETLK,0,1,F_WRLCK)==False) {
+ if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_WRLCK)==False) {
DEBUG(0,("ERROR: %s : fcntl lock of file %s failed. Error was %s\n",
name, pidFile, strerror(errno)));
exit(1);
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 891b11facc..260435d9e8 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -4533,20 +4533,18 @@ void free_namearray(name_compare_entry *name_array)
/****************************************************************************
routine to do file locking
****************************************************************************/
-BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type)
+BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
{
#if HAVE_FCNTL_LOCK
- struct flock lock;
+ SMB_STRUCT_FLOCK lock;
int ret;
- /*
- * FIXME.
- * NB - this code will need re-writing to cope with large (64bit)
- * lock requests. JRA.
- */
-
if(lp_ole_locking_compat()) {
- uint32 mask = 0xC0000000;
+#ifdef LARGE_SMB_OFF_T
+ SMB_OFF_T mask = 0xC000000000000000LL;
+#else
+ SMB_OFF_T mask = 0xC0000000;
+#endif
/* make sure the count is reasonable, we might kill the lockd otherwise */
count &= ~mask;
@@ -4556,38 +4554,45 @@ BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type)
still allows OLE2 apps to operate, but should stop lockd from
dieing */
if ((offset & mask) != 0)
- offset = (offset & ~mask) | ((offset & mask) >> 2);
+#ifdef LARGE_SMB_OFF_T
+ offset = (offset & ~mask) | (((offset & mask) >> 2) & 0x3000000000000000LL);
+#else
+ offset = (offset & ~mask) | (((offset & mask) >> 2) & 0x30000000);
+#endif
} else {
- uint32 mask = ((unsigned)1<<31);
- int32 s_count = (int32) count; /* Signed count. */
- int32 s_offset = (int32)offset; /* Signed offset. */
+#ifdef LARGE_SMB_OFF_T
+ SMB_OFF_T mask = 0x8000000000000000LL;
+#else
+ SMB_OFF_T mask = 0x80000000;
+#endif
+ SMB_OFF_T neg_mask = ~mask;
/* interpret negative counts as large numbers */
- if (s_count < 0)
- s_count &= ~mask;
+ if (count < 0)
+ count &= ~mask;
/* no negative offsets */
- if(s_offset < 0)
- s_offset &= ~mask;
+ if(offset < 0)
+ offset &= ~mask;
/* count + offset must be in range */
- while ((s_offset < 0 || (s_offset + s_count < 0)) && mask)
+ while ((offset < 0 || (offset + count < 0)) && mask)
{
- s_offset &= ~mask;
- mask = mask >> 1;
+ offset &= ~mask;
+ mask = ((mask >> 1) & neg_mask);
}
-
- offset = (uint32)s_offset;
- count = (uint32)s_count;
}
-
+#ifdef LARGE_SMB_OFF_T
+ DEBUG(8,("fcntl_lock %d %d %.0f %.0f %d\n",fd,op,(double)offset,(double)count,type));
+#else
DEBUG(8,("fcntl_lock %d %d %d %d %d\n",fd,op,(int)offset,(int)count,type));
+#endif
lock.l_type = type;
lock.l_whence = SEEK_SET;
- lock.l_start = (int)offset;
- lock.l_len = (int)count;
+ lock.l_start = offset;
+ lock.l_len = count;
lock.l_pid = 0;
errno = 0;
@@ -4598,37 +4603,42 @@ BOOL fcntl_lock(int fd,int op,uint32 offset,uint32 count,int type)
DEBUG(3,("fcntl lock gave errno %d (%s)\n",errno,strerror(errno)));
/* a lock query */
- if (op == F_GETLK)
+ if (op == SMB_F_GETLK)
+ {
+ if ((ret != -1) &&
+ (lock.l_type != F_UNLCK) &&
+ (lock.l_pid != 0) &&
+ (lock.l_pid != getpid()))
{
- if ((ret != -1) &&
- (lock.l_type != F_UNLCK) &&
- (lock.l_pid != 0) &&
- (lock.l_pid != getpid()))
- {
- DEBUG(3,("fd %d is locked by pid %d\n",fd,(int)lock.l_pid));
- return(True);
- }
-
- /* it must be not locked or locked by me */
- return(False);
+ DEBUG(3,("fd %d is locked by pid %d\n",fd,(int)lock.l_pid));
+ return(True);
}
+ /* it must be not locked or locked by me */
+ return(False);
+ }
+
/* a lock set or unset */
if (ret == -1)
- {
- DEBUG(3,("lock failed at offset %d count %d op %d type %d (%s)\n",
- offset,count,op,type,strerror(errno)));
-
- /* perhaps it doesn't support this sort of locking?? */
- if (errno == EINVAL)
- {
- DEBUG(3,("locking not supported? returning True\n"));
- return(True);
- }
+ {
+#ifdef LARGE_SMB_OFF_T
+ DEBUG(3,("lock failed at offset %.0f count %.0f op %d type %d (%s)\n",
+ (double)offset,(double)count,op,type,strerror(errno)));
+#else
+ DEBUG(3,("lock failed at offset %d count %d op %d type %d (%s)\n",
+ offset,count,op,type,strerror(errno)));
+#endif
- return(False);
+ /* perhaps it doesn't support this sort of locking?? */
+ if (errno == EINVAL)
+ {
+ DEBUG(3,("locking not supported? returning True\n"));
+ return(True);
}
+ return(False);
+ }
+
/* everything went OK */
DEBUG(8,("Lock call successful\n"));
@@ -4651,7 +4661,7 @@ int file_lock(char *name,int timeout)
#if HAVE_FCNTL_LOCK
if (timeout) t = time(NULL);
while (!timeout || (time(NULL)-t < timeout)) {
- if (fcntl_lock(fd,F_SETLK,0,1,F_WRLCK)) return(fd);
+ if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_WRLCK)) return(fd);
msleep(LOCK_RETRY_TIMEOUT);
}
return(-1);
@@ -4667,7 +4677,7 @@ void file_unlock(int fd)
{
if (fd<0) return;
#if HAVE_FCNTL_LOCK
- fcntl_lock(fd,F_SETLK,0,1,F_UNLCK);
+ fcntl_lock(fd,SMB_F_SETLK,0,1,F_UNLCK);
#endif
close(fd);
}
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 856b7cfcf6..bd484a18b6 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -71,7 +71,7 @@ static int map_lock_type( files_struct *fsp, int lock_type)
Utility function called to see if a file region is locked.
****************************************************************************/
BOOL is_locked(files_struct *fsp,connection_struct *conn,
- uint32 count,uint32 offset, int lock_type)
+ SMB_OFF_T count,SMB_OFF_T offset, int lock_type)
{
int snum = SNUM(conn);
@@ -87,7 +87,7 @@ BOOL is_locked(files_struct *fsp,connection_struct *conn,
* fd. So we don't need to use map_lock_type here.
*/
- return(fcntl_lock(fsp->fd_ptr->fd,F_GETLK,offset,count,lock_type));
+ return(fcntl_lock(fsp->fd_ptr->fd,SMB_F_GETLK,offset,count,lock_type));
}
@@ -95,7 +95,7 @@ BOOL is_locked(files_struct *fsp,connection_struct *conn,
Utility function called by locking requests.
****************************************************************************/
BOOL do_lock(files_struct *fsp,connection_struct *conn,
- uint32 count,uint32 offset,int lock_type,
+ SMB_OFF_T count,SMB_OFF_T offset,int lock_type,
int *eclass,uint32 *ecode)
{
BOOL ok = False;
@@ -109,11 +109,16 @@ BOOL do_lock(files_struct *fsp,connection_struct *conn,
return False;
}
+#ifdef LARGE_SMB_OFF_T
+ DEBUG(10,("do_lock: lock type %d start=%.0f len=%.0f requested for file %s\n",
+ lock_type, (double)offset, (double)count, fsp->fsp_name ));
+#else /* LARGE_SMB_OFF_T */
DEBUG(10,("do_lock: lock type %d start=%d len=%d requested for file %s\n",
lock_type, (int)offset, (int)count, fsp->fsp_name ));
+#endif /* LARGE_SMB_OFF_T */
if (OPEN_FSP(fsp) && fsp->can_lock && (fsp->conn == conn))
- ok = fcntl_lock(fsp->fd_ptr->fd,F_SETLK,offset,count,
+ ok = fcntl_lock(fsp->fd_ptr->fd,SMB_F_SETLK,offset,count,
map_lock_type(fsp,lock_type));
if (!ok) {
@@ -129,18 +134,23 @@ BOOL do_lock(files_struct *fsp,connection_struct *conn,
Utility function called by unlocking requests.
****************************************************************************/
BOOL do_unlock(files_struct *fsp,connection_struct *conn,
- uint32 count,uint32 offset,int *eclass,uint32 *ecode)
+ SMB_OFF_T count,SMB_OFF_T offset,int *eclass,uint32 *ecode)
{
BOOL ok = False;
if (!lp_locking(SNUM(conn)))
return(True);
+#ifdef LARGE_SMB_OFF_T
+ DEBUG(10,("do_unlock: unlock start=%.0f len=%.0f requested for file %s\n",
+ (double)offset, (double)count, fsp->fsp_name ));
+#else
DEBUG(10,("do_unlock: unlock start=%d len=%d requested for file %s\n",
(int)offset, (int)count, fsp->fsp_name ));
+#endif
if (OPEN_FSP(fsp) && fsp->can_lock && (fsp->conn == conn))
- ok = fcntl_lock(fsp->fd_ptr->fd,F_SETLK,offset,count,F_UNLCK);
+ ok = fcntl_lock(fsp->fd_ptr->fd,SMB_F_SETLK,offset,count,F_UNLCK);
if (!ok) {
*eclass = ERRDOS;
@@ -150,28 +160,27 @@ BOOL do_unlock(files_struct *fsp,connection_struct *conn,
return True; /* Did unlock */
}
-
-
/****************************************************************************
Initialise the locking functions.
****************************************************************************/
BOOL locking_init(int read_only)
{
- if (share_ops) return True;
+ if (share_ops)
+ return True;
#ifdef FAST_SHARE_MODES
- share_ops = locking_shm_init(read_only);
+ share_ops = locking_shm_init(read_only);
#else
- share_ops = locking_slow_init(read_only);
+ share_ops = locking_slow_init(read_only);
#endif
- if (!share_ops) {
- DEBUG(0,("ERROR: Failed to initialise share modes!\n"));
- return False;
- }
+ if (!share_ops) {
+ DEBUG(0,("ERROR: Failed to initialise share modes!\n"));
+ return False;
+ }
- return True;
+ return True;
}
/*******************************************************************
diff --git a/source3/locking/locking_slow.c b/source3/locking/locking_slow.c
index c242baec4a..c9b8d2a687 100644
--- a/source3/locking/locking_slow.c
+++ b/source3/locking/locking_slow.c
@@ -174,7 +174,7 @@ static BOOL slow_lock_share_entry(connection_struct *conn,
/* At this point we have an open fd to the share mode file.
Lock the first byte exclusively to signify a lock. */
- if(fcntl_lock(fd, F_SETLKW, 0, 1, F_WRLCK) == False)
+ if(fcntl_lock(fd, SMB_F_SETLKW, 0, 1, F_WRLCK) == False)
{
DEBUG(0,("ERROR lock_share_entry: fcntl_lock on file %s failed with %s\n",
fname, strerror(errno)));
@@ -251,7 +251,7 @@ static BOOL slow_unlock_share_entry(connection_struct *conn,
/* token is the fd of the open share mode file. */
/* Unlock the first byte. */
- if(fcntl_lock(fd, F_SETLKW, 0, 1, F_UNLCK) == False)
+ if(fcntl_lock(fd, SMB_F_SETLKW, 0, 1, F_UNLCK) == False)
{
DEBUG(0,("ERROR unlock_share_entry: fcntl_lock failed with %s\n",
strerror(errno)));
@@ -980,7 +980,7 @@ static int slow_share_forall(void (*fn)(share_mode_entry *, char *))
/* Lock the share mode file while we read it. */
if(!read_only &&
- fcntl_lock(fd, F_SETLKW, 0, 1, F_WRLCK) == False) {
+ fcntl_lock(fd, SMB_F_SETLKW, 0, 1, F_WRLCK) == False) {
close(fd);
continue;
}
diff --git a/source3/locking/shmem.c b/source3/locking/shmem.c
index 8a81d0efff..3cdcf82f73 100644
--- a/source3/locking/shmem.c
+++ b/source3/locking/shmem.c
@@ -107,7 +107,7 @@ static BOOL smb_shm_global_lock(void)
return True;
/* Do an exclusive wait lock on the first byte of the file */
- if (fcntl_lock(smb_shm_fd, F_SETLKW, 0, 1, F_WRLCK) == False)
+ if (fcntl_lock(smb_shm_fd, SMB_F_SETLKW, 0, 1, F_WRLCK) == False)
{
DEBUG(0,("ERROR smb_shm_global_lock : fcntl_lock failed with code %s\n",strerror(errno)));
smb_shm_times_locked--;
@@ -144,7 +144,7 @@ static BOOL smb_shm_global_unlock(void)
return True;
/* Do a wait unlock on the first byte of the file */
- if (fcntl_lock(smb_shm_fd, F_SETLKW, 0, 1, F_UNLCK) == False)
+ if (fcntl_lock(smb_shm_fd, SMB_F_SETLKW, 0, 1, F_UNLCK) == False)
{
DEBUG(0,("ERROR smb_shm_global_unlock : fcntl_lock failed with code %s\n",strerror(errno)));
smb_shm_times_locked++;
@@ -682,7 +682,7 @@ static BOOL smb_shm_lock_hash_entry( unsigned int entry)
return True;
/* Do an exclusive wait lock on the 4 byte region mapping into this entry */
- if (fcntl_lock(smb_shm_fd, F_SETLKW, start, sizeof(int), F_WRLCK) == False)
+ if (fcntl_lock(smb_shm_fd, SMB_F_SETLKW, start, sizeof(int), F_WRLCK) == False)
{
DEBUG(0,("ERROR smb_shm_lock_hash_entry : fcntl_lock failed with code %s\n",strerror(errno)));
return False;
@@ -709,7 +709,7 @@ static BOOL smb_shm_unlock_hash_entry( unsigned int entry )
return True;
/* Do a wait lock on the 4 byte region mapping into this entry */
- if (fcntl_lock(smb_shm_fd, F_SETLKW, start, sizeof(int), F_UNLCK) == False)
+ if (fcntl_lock(smb_shm_fd, SMB_F_SETLKW, start, sizeof(int), F_UNLCK) == False)
{
DEBUG(0,("ERROR smb_shm_unlock_hash_entry : fcntl_lock failed with code %s\n",strerror(errno)));
return False;
diff --git a/source3/passdb/smbpassfile.c b/source3/passdb/smbpassfile.c
index 49cf194cc6..dcb69eb43a 100644
--- a/source3/passdb/smbpassfile.c
+++ b/source3/passdb/smbpassfile.c
@@ -40,7 +40,7 @@ static void gotalarm_sig(void)
BOOL do_file_lock(int fd, int waitsecs, int type)
{
- struct flock lock;
+ SMB_STRUCT_FLOCK lock;
int ret;
gotalarm = 0;
@@ -53,7 +53,7 @@ BOOL do_file_lock(int fd, int waitsecs, int type)
lock.l_pid = 0;
alarm(5);
- ret = fcntl(fd, F_SETLKW, &lock);
+ ret = fcntl(fd, SMB_F_SETLKW, &lock);
alarm(0);
CatchSignal(SIGALRM, SIGNAL_CAST SIG_DFL);
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c
index c3b6ba0199..0170fa5497 100644
--- a/source3/smbd/connection.c
+++ b/source3/smbd/connection.c
@@ -57,7 +57,7 @@ BOOL yield_connection(connection_struct *conn,char *name,int max_connections)
return(False);
}
- if (fcntl_lock(fd,F_SETLKW,0,1,F_WRLCK)==False) {
+ if (fcntl_lock(fd,SMB_F_SETLKW,0,1,F_WRLCK)==False) {
DEBUG(0,("ERROR: can't get lock on %s\n", fname));
return False;
}
@@ -66,7 +66,7 @@ BOOL yield_connection(connection_struct *conn,char *name,int max_connections)
for (i=0;i<max_connections;i++) {
if (read(fd, &crec,sizeof(crec)) != sizeof(crec)) {
DEBUG(2,("Entry not found in lock file %s\n",fname));
- if (fcntl_lock(fd,F_SETLKW,0,1,F_UNLCK)==False) {
+ if (fcntl_lock(fd,SMB_F_SETLKW,0,1,F_UNLCK)==False) {
DEBUG(0,("ERROR: can't release lock on %s\n", fname));
}
close(fd);
@@ -77,7 +77,7 @@ BOOL yield_connection(connection_struct *conn,char *name,int max_connections)
}
if (crec.pid != mypid || crec.cnum != conn->cnum) {
- if (fcntl_lock(fd,F_SETLKW,0,1,F_UNLCK)==False) {
+ if (fcntl_lock(fd,SMB_F_SETLKW,0,1,F_UNLCK)==False) {
DEBUG(0,("ERROR: can't release lock on %s\n", fname));
}
close(fd);
@@ -91,14 +91,14 @@ BOOL yield_connection(connection_struct *conn,char *name,int max_connections)
if (sys_lseek(fd,i*sizeof(crec),SEEK_SET) != i*sizeof(crec) ||
write(fd, &crec,sizeof(crec)) != sizeof(crec)) {
DEBUG(2,("Couldn't update lock file %s (%s)\n",fname,strerror(errno)));
- if (fcntl_lock(fd,F_SETLKW,0,1,F_UNLCK)==False) {
+ if (fcntl_lock(fd,SMB_F_SETLKW,0,1,F_UNLCK)==False) {
DEBUG(0,("ERROR: can't release lock on %s\n", fname));
}
close(fd);
return(False);
}
- if (fcntl_lock(fd,F_SETLKW,0,1,F_UNLCK)==False) {
+ if (fcntl_lock(fd,SMB_F_SETLKW,0,1,F_UNLCK)==False) {
DEBUG(0,("ERROR: can't release lock on %s\n", fname));
}
@@ -149,7 +149,7 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO
return(False);
}
- if (fcntl_lock(fd,F_SETLKW,0,1,F_WRLCK)==False) {
+ if (fcntl_lock(fd,SMB_F_SETLKW,0,1,F_WRLCK)==False) {
DEBUG(0,("ERROR: can't get lock on %s\n", fname));
return False;
}
@@ -180,7 +180,7 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO
if (foundi < 0) {
DEBUG(3,("no free locks in %s\n",fname));
- if (fcntl_lock(fd,F_SETLKW,0,1,F_UNLCK)==False) {
+ if (fcntl_lock(fd,SMB_F_SETLKW,0,1,F_UNLCK)==False) {
DEBUG(0,("ERROR: can't release lock on %s\n", fname));
}
close(fd);
@@ -208,14 +208,14 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO
/* make our mark */
if (sys_lseek(fd,foundi*sizeof(crec),SEEK_SET) != foundi*sizeof(crec) ||
write(fd, &crec,sizeof(crec)) != sizeof(crec)) {
- if (fcntl_lock(fd,F_SETLKW,0,1,F_UNLCK)==False) {
+ if (fcntl_lock(fd,SMB_F_SETLKW,0,1,F_UNLCK)==False) {
DEBUG(0,("ERROR: can't release lock on %s\n", fname));
}
close(fd);
return(False);
}
- if (fcntl_lock(fd,F_SETLKW,0,1,F_UNLCK)==False) {
+ if (fcntl_lock(fd,SMB_F_SETLKW,0,1,F_UNLCK)==False) {
DEBUG(0,("ERROR: can't release lock on %s\n", fname));
}
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 395de66a88..f24d4ac962 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -562,7 +562,11 @@ static void truncate_unless_locked(files_struct *fsp, connection_struct *conn, i
BOOL *share_locked)
{
if (fsp->can_write){
+#ifdef LARGE_SMB_OFF_T
+ if (is_locked(fsp,conn,0x3FFFFFFFFFFFFFFFLL,0,F_WRLCK)){
+#else
if (is_locked(fsp,conn,0x3FFFFFFF,0,F_WRLCK)){
+#endif
/* If share modes are in force for this connection we
have the share entry locked. Unlock it before closing. */
if (*share_locked && lp_share_modes(SNUM(conn)))