home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / programm / 4317 < prev    next >
Encoding:
Internet Message Format  |  1992-08-15  |  1.5 KB

  1. Xref: sparky comp.unix.programmer:4317 comp.unix.misc:3237
  2. Path: sparky!uunet!sybus.sybus.com!myrddin!tscs!bailey
  3. From: bill@bailey.UUCP (Bill Glidden 882-8369)
  4. Subject: Re: Process & Signal Question
  5. Newsgroups: comp.unix.programmer,comp.unix.misc
  6. Date: 15 Aug 92 05:39:24 GMT
  7. Distribution: world
  8. Message-ID: <1759227@bailey.UUCP>
  9. Organization: Ben Bailey's Home..Tampa Fl.
  10. Sender: news@bailey.UUCP (GNEWS Version 2.0 news poster.)
  11. Lines: 18
  12.  
  13. bill@bailey.UUCP (Bill Glidden 882-8369) writes:
  14. > herberj@prism.CS.ORST.EDU (John Wesley Herberg) writes:
  15. > > 
  16. > > 1 - Is there an effecient way for one process to know if another is running 
  17. > > when the only thing you know about it is its name.  The way I'm doing it now
  18. > > is grabbing info for all the processes by using pstat(an HP-UX call) &
  19. > > searching through that info for a matching process name.  Is there some type 
  20. > > of call I could do on the executable to see if it is in use.  I noticed
  21. > > make doesn't allow you to update a file when its being used - how does it know?
  22. > > 
  23. > Make knows the executable is in use because when you fopen or open a file for
  24. > create and it is in use, the operating system returns an error condition to
  25. > the calling program. Of course, I don't recommend this for your situation.
  26. You could also try opening the executable file in exclusive mode. However,
  27. that may not be 100% reliable. For instance, someone may be compiling
  28. the program and your program would not be able to open the file exclusively,
  29. even if no one is currently executing it.
  30.