Thread View: comp.sys.next.programmer
2 messages
2 total messages
Started by Bryan Thompson
Wed, 08 Apr 1992 15:35
lockf - is it broken
Author: Bryan Thompson
Date: Wed, 08 Apr 1992 15:35
Date: Wed, 08 Apr 1992 15:35
49 lines
1729 bytes
1729 bytes
I am trying to port the Faircom ctree+ ISAM package to the next and I am
encountering a problem with lockf() - basically, lockf() persists in claiming
that it is being passed an invalid argument -- frankly it looks like lockf() is
broken.
So, is lockf() broken? If not, what can be done to make this code run? I have
included a small program with an abundance of trace statements and a sample of
the output that it generates for me. I am using version 2.1 of the NeXT OS and
the 'NeXT Release 2.0 (v31.1) -- GNU version 1.36' version of gcc.
------- cut here ---------
#include <stdio.h>
#include <sys/fcntl.h>
#include <stdlib.h>
#define BCREATE (O_RDWR | O_CREAT | O_EXCL)
void MyCreate(void)
{
int retval = open("tmp",BCREATE,0666); /* Create file. */
perror("create:"); printf("retval = %d.\n", retval);
if (retval > -1) { /* Open
ok. */
int lockval = lockf(retval,F_TLOCK,0L); /* Attempt lock on file. */
perror("lock:"); printf("lockval = %d.\n", lockval);
if (lockval) printf("lock failed.\n");
close(retval);
} else {
printf("create failed:");
}
printf("done");
}
main()
{
MyCreate();
}
------ cut here ------
My output is:
create:: Error 0
retval = 3.
lock:: Invalid argument
lockval = -1.
lock failed.
This is aggravating, help is greatly appreatiated.
Bryan Thompson
bryan@ad.cise.nsf.gov
Re: lockf - is it broken
Author: Brett Adam
Date: Sun, 12 Apr 1992 04:27
Date: Sun, 12 Apr 1992 04:27
23 lines
1333 bytes
1333 bytes
In article <1992Apr8.153515.3244@n1.nsf.gov> bryan@ad.cise.nsf.gov (Bryan Thompson) writes: > I am trying to port the Faircom ctree+ ISAM package to the next and I am > encountering a problem with lockf() - basically, lockf() persists in claiming > that it is being passed an invalid argument -- frankly it looks like lockf() is > broken. > > So, is lockf() broken? Yes. We went through the same long tirade and finally, NeXT admitted that they had 'disabled' lockf due to potential problems with NFS. Wait until 3.0 - maybe it's fixed - maybe it isn't. BTW. We've built the faircom stuff on the NeXT and it all works well. -- --------------------------------------------------------------- Brett Adam Codex Software Development Pty. Ltd. NeXTMail: bpja@codex.oz.au AppleLink: AUST0335 (Preferred.) (Only if you must)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads