Mailing List Archive

sysopen for 5.002?
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
Re: sysopen for 5.002? [ In reply to ]
On Wed, 1 Nov 1995, Tom Christiansen wrote:

> 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:

sys/syscalls.ph can't be "essential" because not everyone has
<sys/syscalls.h>. Also, not everyone has the 3-arg form of open.
There's a lot of #ifdef's that have to go somewhere. And someone's got
to write them.

Volunteers?

Andy Dougherty doughera@lafcol.lafayette.edu
Re: sysopen for 5.002? [ In reply to ]
>From: Tom Christiansen <tchrist@mox.perl.com>

>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

Don't have sys/syscalls.ph on UNICOS.

There is a 3-arg open(2) interface in POSIX.xs.

Okay, I'll volunteer--starting now. I'll document the POSIX module. I'll
use whatever I find in 5.001n.

Dean
Re: sysopen for 5.002? [ In reply to ]
>Don't have sys/syscalls.ph on UNICOS.

>There is a 3-arg open(2) interface in POSIX.xs.

>Okay, I'll volunteer--starting now. I'll document the POSIX module. I'll
>use whatever I find in 5.001n.

Bravissimo!

One small question: should we force people to sign a POSIX contract
(which I promise will fail on many systems) just to get a 3-arg open?

--tom
Re: sysopen for 5.002? [ In reply to ]
> From: Dean Roehrich <roehrich@cray.com>
>
> >From: Tom Christiansen <tchrist@mox.perl.com>
>
> >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
>
> Don't have sys/syscalls.ph on UNICOS.
>
> There is a 3-arg open(2) interface in POSIX.xs.
>
> Okay, I'll volunteer--starting now. I'll document the POSIX module. I'll
> use whatever I find in 5.001n.

Er, don't forget the major POSIX + FileHandle + DirHandle + Symbol etc patch.

Tim.
Re: sysopen for 5.002? [ In reply to ]
> From: Tom Christiansen <tchrist@mox.perl.com>

> One small question: should we force people to sign a POSIX contract
> (which I promise will fail on many systems) just to get a 3-arg open?

Ug, that again.

I suggest those people start submitting patches...so we don't have to argue
about it anymore, because the next step in the argument is that we
round-file the POSIX extension and forbid anyone to use it for fear of
creating portability problems, real or potential. (the irony of it)

Dean
Re: sysopen for 5.002? [ In reply to ]
> From: Tim Bunce <Tim.Bunce@ig.co.uk>
> > Okay, I'll volunteer--starting now. I'll document the POSIX module. I'll
> > use whatever I find in 5.001n.
>
> Er, don't forget the major POSIX + FileHandle + DirHandle + Symbol etc patch.

I will document what can be found in POSIX.xs and POSIX.pm. I think it
would be quite cool if the people responsible for those other things would
write manpages for them.

Dean
Re: sysopen for 5.002? [ In reply to ]
On Wed, 1 Nov 1995, Dean Roehrich wrote:

> > From: Tom Christiansen <tchrist@mox.perl.com>
>
> > One small question: should we force people to sign a POSIX contract
> > (which I promise will fail on many systems) just to get a 3-arg open?

No. Maybe we should put it in Fcntl? I'd prefer to see the functionality
duplicated in another extension.

Andy Dougherty doughera@lafcol.lafayette.edu
Re: sysopen for 5.002? [ In reply to ]
> From: Dean Roehrich <roehrich@cray.com>
>
> > From: Tim Bunce <Tim.Bunce@ig.co.uk>
> > > Okay, I'll volunteer--starting now. I'll document the POSIX module. I'll
> > > use whatever I find in 5.001n.
> >
> > Er, don't forget the major POSIX + FileHandle + DirHandle + Symbol etc patch.
>
> I will document what can be found in POSIX.xs and POSIX.pm. I think it
> would be quite cool if the people responsible for those other things would
> write manpages for them.

Sure, I agree. I'm just pointing out that POSIX.pm is still a moving target.

Tim.
Re: sysopen for 5.002? [ In reply to ]
On Wed, 1 Nov 1995, Andy Dougherty wrote:

> On Wed, 1 Nov 1995, Dean Roehrich wrote:
>
> > > From: Tom Christiansen <tchrist@mox.perl.com>
> >
> > > One small question: should we force people to sign a POSIX contract
> > > (which I promise will fail on many systems) just to get a 3-arg open?
>
> No. Maybe we should put it in Fcntl? I'd prefer to see the functionality
> duplicated in another extension.

I'd go with this too. Fcntl seems a good immediate home.

> Andy Dougherty doughera@lafcol.lafayette.edu

--
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)