This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add FCNTL_CAN_LOCK.
authorAndy Dougherty <doughera@lafayette.edu>
Fri, 3 Nov 2000 15:32:14 +0000 (10:32 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Sat, 4 Nov 2000 00:20:02 +0000 (00:20 +0000)
Subject: Re: [ID 20001030.011] Not OK: perl v5.7.0 +DEVEL7481 on VMS_AXP V7.1 (UNINSTALLED)
Message-ID: <Pine.SOL.4.10.10011031528090.29-100000@maxwell.phys.lafayette.edu>

Subject: Re: [ID 20001030.011] Not OK: perl v5.7.0 +DEVEL7481 on VMS_AXP V7.1 (UNINSTALLED)
From: Andy Dougherty <doughera@lafayette.edu>
In-Reply-To: <4.3.1.0.20001031222203.00b24b20@pop5.banet.net>
Message-ID: <Pine.SOL.4.10.10011031532170.29-100000@maxwell.phys.lafayette.edu>

p4raw-id: //depot/metaconfig@7536

U/perl/d_fcntl_can_lock.U [new file with mode: 0644]
U/perl/startperl.U

diff --git a/U/perl/d_fcntl_can_lock.U b/U/perl/d_fcntl_can_lock.U
new file mode 100644 (file)
index 0000000..23d4783
--- /dev/null
@@ -0,0 +1,75 @@
+?RCS: $Id: d_fcntl_can_lock.U,v$
+?RCS:
+?RCS: Copyright (c) 2000, Andrew Dougherty
+?RCS:
+?RCS: You may distribute under the terms of either the GNU General Public
+?RCS: License or the Artistic License, as specified in the README file.
+?RCS:
+?RCS: $Log: d_fcntl_can_lock.U,v $
+?RCS:
+?MAKE:d_fcntl_can_lock: d_fcntl Compile Setvar cat rm
+?MAKE: -pick add $@ %<
+?S:d_fcntl_can_lock:
+?S:    This variable conditionally defines the FCNTL_CAN_LOCK symbol
+?S:    and indicates whether file locking with fcntl() works.
+?S:.
+?C:FCNTL_CAN_LOCK:
+?C:    This symbol, if defined, indicates that fcntl() can be used
+?C:    for file locking.  Normally on Unix systems this is defined.
+?C:    It may be undefined on VMS.
+?C:.
+?H:#$d_fcntl_can_lock FCNTL_CAN_LOCK           /**/
+?H:.
+?LINT: set d_fcntl_can_lock
+?F: !try
+?X: fcntl may not be fully functional.  As of November 2000, on VMS and
+?X: DOS/DJGPP, fctnl-based locking doesn't work.
+?X: Thanks to Craig A. Berry <craig.berry@psinetcs.com> for this test.
+echo " "
+: See if fcntl-based locking works.
+$cat >try.c <<'EOCP'
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+int main() {
+#if defined(F_SETLK) && defined(F_SETLKW)
+     struct flock flock;
+     int retval, fd;
+     fd = open("try.c", O_RDONLY);
+     flock.l_type = F_RDLCK;
+     flock.l_whence = SEEK_SET;
+     flock.l_start = flock.l_len = 0;
+     retval = fcntl(fd, F_SETLK, &flock);
+     close(fd);
+     (retval < 0 ? exit(2) : exit(0));
+#else
+     exit(2);
+#endif
+}
+EOCP
+echo "Checking if fcntl-based file locking works... "
+case "$d_fcntl" in
+"$define")
+       set try
+       if eval $compile_ok; then
+               if ./try; then
+                       echo "Yes, it seems to work."
+                       val="$define"
+               else
+                       echo "Nope, it didn't work."
+                       val="$undef"
+               fi
+       else
+               echo "I'm unable to compile the test program, so I'll assume not."
+               val="$undef"
+       fi
+       ;;
+*) val="$undef";
+       echo "Nope, since you don't even have fcntl()."
+       ;;
+esac
+set d_fcntl_can_lock
+eval $setvar
+$rm -f try*
+
+
index c26e0ce..363683d 100644 (file)
@@ -15,7 +15,7 @@
 ?RCS: Revision 3.0  1993/08/18  12:09:50  ram
 ?RCS: Baseline for dist 3.0 netwide release.
 ?RCS:
-?MAKE:startperl: cat Myread sharpbang binexp test versiononly
+?MAKE:startperl: cat Myread sharpbang binexp test versiononly version
 ?MAKE: -pick add $@ %<
 ?Y:TOP
 ?X: This is different from dist's standard startperl.U unit because