Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!snorkelwacker!bloom-beacon!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.programmer Subject: Re: how to put a program into a .plan file Message-ID: <1990Sep26.201406.12663@athena.mit.edu> Date: 26 Sep 90 20:14:06 GMT References: <978@bbt.UUCP> Sender: daemon@athena.mit.edu (Mr Background) Reply-To: jik@athena.mit.edu (Jonathan I. Kamens) Organization: Massachusetts Institute of Technology Lines: 23 In article <978@bbt.UUCP>, rgs@bbt.UUCP (steinbeiser) writes: |> Ok, how do you check the status of the file to see if it has |> been open by someone else? Its not obvious how (or if) stat() would do this. |> Also, would the C program have to be running constantly in the background |> someplace? 1. You open the pipe for write, and do a select() on it, and when you get an OK to write from select(), you know that someone has opened the other end. 2. Yes, it would have to be running constantly in the background someplace. I suppose another thing you could do would be to write a program that talks NFS, and mount it under your home directory (for kernels which support the use of programs that speak the NFS protocol in this way), and then put a symbolic link from your .plan into that filesystem -- when something tries to open your .plan file, your NFS protocol program will get called and you'll be able to claim whatever you want for the contents of the .plan file. -- Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8495 Home: 617-782-0710