Path: utzoo!utgpu!jarvis.csri.toronto.edu!torsqnt!hybrid!mdapoz From: mdapoz@hybrid.UUCP (Mark Dapoz) Newsgroups: unix-pc.general Subject: Possible bug with socket code Keywords: uipc locking Message-ID: <1989Oct16.032605.279@hybrid.UUCP> Date: 16 Oct 89 03:26:05 GMT Reply-To: mdapoz@hybrid.UUCP (Mark Dapoz) Organization: The Home for Unemployed Basselopes, Toronto, Ontario, Canada Lines: 46 I think I may have stumbled across a bug in the ipc code recently posted. I was working on trying to write a program which uses the locking(3C) facilities and I kept running into problems. Whenever I would call the locking() routine, it would always return with an error, which perror indicates is invalid address. If I remove the ipc device driver, the program works just fine. I don't know what the ipc device driver is doing, but whatever it is, it sure does interfere with the locking() routine. Below is the program which shows this behaviour. The following error is reported when run with the ipc device driver. Locking....... lock: Bad address The program should just lock the file "mutex" (create the file before running the program) and then unlock it. -mark #include #include #include #include main() { int fd; if ((fd = open("mutex", O_RDONLY)) < 0 ) { perror("open"); exit(1); } printf("Locking.......\n"); if (locking(fd, F_LOCK, 0L) < 0) { perror("lock"); exit(1); } sleep(5); printf("Unlocking.......\n"); if (locking(fd, F_ULOCK, 0L) < 0) { perror("unlock"); exit(1); } } -- Mark Dapoz (mdapoz@hybrid.UUCP) ...uunet!mnetor!hybrid!mdapoz I remind you that humans are only a tiny minority in this galaxy. -- Spock, "The Apple," stardate 3715.6.