![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| close open files before remove | xramm | SUN Solaris | 9 | 09-14-2007 08:23 AM |
| Installing RedHat 8.0 onto Dell PowerEdge SC1425 - hdc: status error: status = 0x58 | fishsponge | Red Hat | 5 | 07-14-2006 02:53 PM |
| check the status and send an email with status | isingh786 | Shell Programming and Scripting | 3 | 12-29-2005 07:22 PM |
| Should a UNIX daemon process close open fds? | kunalashar | UNIX for Dummies Questions & Answers | 1 | 10-24-2002 09:10 AM |
| Couldn't open status file /var/samba/STATUS.LCK | macdonto | UNIX for Dummies Questions & Answers | 2 | 08-08-2001 08:42 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
|||||
|
I'm not sure but I think you're asking if one process
can tell if a file was opened for read/write by another process... correct? In the function... int fcntl(int fildes, int cmd, /* arg */ ...); fildes must be a file descriptor to an open file therefore, in order to use this, the current (or parent) process should have already opened the file so you should not get a "closed" file error. You can use fcntl() to try to set an exclusive lock on a file that you have previously opened and if another process has opened this file for write access, fcntl() will fail. However, if the other process has not opened the file for write access and just for reading (i.e. O_RDONLY), then fcntl() will not fail. Anyway, this is all system call level stuff. If you're looking for a command line program to tell you if a file is open or not, try lsof (LiSt Open Files) look at: http://www.ensta.fr/internet/unix/sys_admin/lsof.html |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|