M
Marc Girod
Hello,
A script saves mails sent by a crontab--so, there may be bursts...
It uses sysopen, I assume to make sure it doesn't overwrite existing
files.
At times, we get bursts of errors (File exists), which I trace to the
sysopen call.
However, I cannot find that all the corresponding files would have
existed.
I read the doc and get to:
In many systems the "O_EXCL" flag is available for opening
files
in exclusive mode. This is not locking: exclusiveness
means here
that if the file already exists, sysopen() fails. "O_EXCL"
may
not work on network filesystems, and has no effect unless
the
"O_CREAT" flag is set as well.
The script does write to a network filesystems (home directory on a
remote filer, 4 ms round-trip).
Shoud I look for a replacement for sysopen?
Or for an other theory to explain the problem?
The bit of code doing the open:
if(defined($mode)? sysopen(FILE, $file, O_EXCL | O_CREAT | O_WRONLY,
$mode):
sysopen(FILE, $file, O_EXCL | O_CREAT | O_WRONLY))
{
_dump(*FILE, @$r_lines);
return close(FILE);
}
return(0);
Thanks,
Marc
A script saves mails sent by a crontab--so, there may be bursts...
It uses sysopen, I assume to make sure it doesn't overwrite existing
files.
At times, we get bursts of errors (File exists), which I trace to the
sysopen call.
However, I cannot find that all the corresponding files would have
existed.
I read the doc and get to:
In many systems the "O_EXCL" flag is available for opening
files
in exclusive mode. This is not locking: exclusiveness
means here
that if the file already exists, sysopen() fails. "O_EXCL"
may
not work on network filesystems, and has no effect unless
the
"O_CREAT" flag is set as well.
The script does write to a network filesystems (home directory on a
remote filer, 4 ms round-trip).
Shoud I look for a replacement for sysopen?
Or for an other theory to explain the problem?
The bit of code doing the open:
if(defined($mode)? sysopen(FILE, $file, O_EXCL | O_CREAT | O_WRONLY,
$mode):
sysopen(FILE, $file, O_EXCL | O_CREAT | O_WRONLY))
{
_dump(*FILE, @$r_lines);
return close(FILE);
}
return(0);
Thanks,
Marc