On Tue, 31 Oct 2000, Craig A. Berry wrote:
> Thanks. Should this be one of those try.c tests? That could take
> care of Peter Farley's concern that the functionality not be
> unnecessarily disabled if it becomes available. Something like the
> following might work if Configure can check the exit status. This
> fails appropriately on VMS but I don't have anywhere to test for
> success.
>
>
> #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("manifest", O_RDONLY);
^^^^^^^
I think that you are showing your VMS-ishness here. Recall that
not all filesystems are cAsE inSenSitive (that file is MANIFEST on Unix).
Also, most of the test compilation stuff takes place in the UU sub
directory (hence you'd need "../MANIFEST" on unix or VMS "::MANIFEST" on
MacOS, either "..\\MANIFEST" or "../MANIFEST" on NT, possibly
"[-]MANIFEST" on VMS, etc.
Perhaps it'd be better to try open() ing "try.c" instead?
> 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
> }
Another possibility rather than exit status could be to
printf("define\n"); or printf("undef\n"); to be used as the value of
d_fcntl_has_no_lock (passed as symbol tmp within configure.com).
Of course you'd need to #include <stdio.h>. I am not too sure if this
would actually be helpful since many of the tests do seem to chack
then exit status.
Peter Prymmer