×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Hello,
As far as the IFS use goes, I opened a call log with IBM support on
this at end of last year. I could not find a way to exclusively lock
an IFS file to prevent OTHER processes from accessing it or
destroying it.
That's what O_SHARE_NONE does. Have you tried it? It works for me...
I believe if everyone is 'playing nice' and all using the same way to
access the file and checking results of open() it is different - but
if you want it locked exclusively because you are not sure how
someone else might access it, that seems to not work.
Assuming that you're using a file system that supports it, O_SHARE_NONE
does exactly that. No other process can open() the file when you have
it opened with O_SHARE_NONE. Anyone trying to open it will fail, and
errno will be EBUSY
creating a file and tried to open it with some locking in the open( )
... I tested this ... but I could even delete it from another job
while mine first one was 'locking' it and I wanted to prevent exactly
this sort of thing from happening.
O_SHARE_NONE only blocks others from opening the file. I don't think it
blocks others from unlinking it. I don't know why this matters, though?
What difference does it make if they unlink it while you have it open,
or whether they wait until the instant you close it? Either way, it's
deleted the second you close it.
Again, it's going to depend on the file system. But in the file systems
that we typically think of as "IFS file systems" (such as the root and
/QOpenSys ones) files aren't actually deleted when you unlink them.
You understand that, right? If a user runs the RMVLNK or DEL or ERASE
CL command against an object in / or /QopenSys, it will remove the
filename from the directory, but it won't actually delete the file's
data unless no jobs have the file open. (Plus, there can be no other
hard-links to the file, but that probably goes without saying.)
So if you have a file open, it can be unlinked, but you can continue to
use it without problems... the file isn't actually deleted (i.e. the
data sectors it occupies aren't marked as "unused") until you close it.
As an Amazon Associate we earn from qualifying purchases.