These imponderables happen constantly. Why *is* it so hard to exclusively
open a file in perl? Since the build doesn't make, install, or test
essentials like sys/syscalls.ph, and even that wouldn't guarantee an
O_EXCL thing, I think that at a bare minimum, a sysopen() in 5.002 would
sure help this out:
use Fcntl;
sysopen(FH, "foo", O_WRONLY | O_EXCL | O_CREAT, 0755) || die;
Perhaps we could get a bug in the database open sysopen sometimes being
infeasible given the current setup (although maybe this wouldn't change,
you'd think that ANSI would give you a lot of what you want.)
------- Forwarded Message
Date: Wed, 1 Nov 1995 13:33:05 +0100 (MET)
From: pvr@igd.fhg.de
Subject: Re: lockfile
To: tchrist@mox.perl.com (Tom Christiansen)
In-reply-to: <9278.814623391@mox> from "Tom Christiansen" at Oct 25, 95 06:16:31 am
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 835
Me again,
still being the pain in your neck :-)
>
> typo
> &SYS_open would come from "syscalls.ph" or "sys/syscalls.ph"
I looked in sys/syscalls.ph and there is no "open" at all,
so I think you now have an idea of how good our systam is maintained.
Do you know any other way to open a file something like
$flags = &O_WRONLY | &O_EXCL | &O_CREAT;
syscall(&SYS_open, "foo", $flags+0, 0777);
There are a lot of other opens in the sys/*-files but a bit too many
to test them all :-(
I tries to replace SYS_open with
file.ph: eval 'sub FOPEN {0xFFFFFFFF;}';
which didn't report errors :-)
and didn't open the file :-(
Buuhuu, why is it so difficult for me to open a file just once !?
- --
Andreas
http://www.igd.fhg.de/~pvr
- ------------------------------------------------
>>> This mail was written in 8 minutes and 15 seconds
------- End of Forwarded Message
Although I still like for increased legibility and
maybe even portability:
use FileHandle;
$fh = new File {
PATH => "foo",
FLAGS => O_WRONLY | O_EXCL | O_CREAT,
MODE => 0644
};
or
$fh = new File {
PATH => "foo",
FLAGS => [ "write", "exclusive", "create" ]
MODE => 0644
};
or
$fh = new File {
PATH => "foo",
FLAGS => "write exclusive create",
MODE => S_IRWXU|S_IRGRP|S_IROTH,
};
or
$fh = new File {
PATH => "foo",
FLAGS => "write exclusive create write-lock nodelay",
MODE => {
USER => "read, write, execute",
GROUP => "read",
OTHER => "read",
};
};
--tom
open a file in perl? Since the build doesn't make, install, or test
essentials like sys/syscalls.ph, and even that wouldn't guarantee an
O_EXCL thing, I think that at a bare minimum, a sysopen() in 5.002 would
sure help this out:
use Fcntl;
sysopen(FH, "foo", O_WRONLY | O_EXCL | O_CREAT, 0755) || die;
Perhaps we could get a bug in the database open sysopen sometimes being
infeasible given the current setup (although maybe this wouldn't change,
you'd think that ANSI would give you a lot of what you want.)
------- Forwarded Message
Date: Wed, 1 Nov 1995 13:33:05 +0100 (MET)
From: pvr@igd.fhg.de
Subject: Re: lockfile
To: tchrist@mox.perl.com (Tom Christiansen)
In-reply-to: <9278.814623391@mox> from "Tom Christiansen" at Oct 25, 95 06:16:31 am
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 835
Me again,
still being the pain in your neck :-)
>
> typo
> &SYS_open would come from "syscalls.ph" or "sys/syscalls.ph"
I looked in sys/syscalls.ph and there is no "open" at all,
so I think you now have an idea of how good our systam is maintained.
Do you know any other way to open a file something like
$flags = &O_WRONLY | &O_EXCL | &O_CREAT;
syscall(&SYS_open, "foo", $flags+0, 0777);
There are a lot of other opens in the sys/*-files but a bit too many
to test them all :-(
I tries to replace SYS_open with
file.ph: eval 'sub FOPEN {0xFFFFFFFF;}';
which didn't report errors :-)
and didn't open the file :-(
Buuhuu, why is it so difficult for me to open a file just once !?
- --
Andreas
http://www.igd.fhg.de/~pvr
- ------------------------------------------------
>>> This mail was written in 8 minutes and 15 seconds
------- End of Forwarded Message
Although I still like for increased legibility and
maybe even portability:
use FileHandle;
$fh = new File {
PATH => "foo",
FLAGS => O_WRONLY | O_EXCL | O_CREAT,
MODE => 0644
};
or
$fh = new File {
PATH => "foo",
FLAGS => [ "write", "exclusive", "create" ]
MODE => 0644
};
or
$fh = new File {
PATH => "foo",
FLAGS => "write exclusive create",
MODE => S_IRWXU|S_IRGRP|S_IROTH,
};
or
$fh = new File {
PATH => "foo",
FLAGS => "write exclusive create write-lock nodelay",
MODE => {
USER => "read, write, execute",
GROUP => "read",
OTHER => "read",
};
};
--tom