🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: de.comp.lang.perl
Article #15

Re: C open function in perl (lockfile)

#15
From: Greg Thelen
Date: Thu, 02 Nov 1995 00:00
24 lines
1446 bytes
In article <47asja$728@csnews.cs.colorado.edu> Tom Christiansen <tchrist@mox.perl.com> writes:

> In comp.lang.perl.misc, 
>     pvr@korfu.igd.fhg.de (Reiners Dirk) writes:
> :Can I emulate/call the normal C open function in/from perl.
> :I want to translate the following code to perl:
> :
> :st=open("foo",O_CREAT|O_EXCL,0777)
> :
> :for writing a lockfile function (some machines here don't support flock :-(
> :
> :I have already a solution like
> :
> :syscall(&SYS_open, "foo", O_CREAT|O_EXCL, 0777);
> :

Any reason not to use the following (assuming Perl5)?

$fd = POSIX::open($file, O_CREAT|O_EXCL|O_WRONLY, 0644);

--
Greg Thelen
The University of Michigan (Ann Arbor)
Computer Aided Engineering Network
Technical Details
Message-ID: <h1oohuu7sve.fsf@rackham.engin.umich.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <4786us$a0f@korfu.igd.fhg.de> <47asja$728@csnews.cs.colorado.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1043e7,5ddc5a1c50ff66cd
X-Google-Attributes: gid1043e7,public
X-Google-Thread: 1133f4,5ddc5a1c50ff66cd
X-Google-Attributes: gid1133f4,public
X-Google-Thread: fa0ae,5ddc5a1c50ff66cd
X-Google-Attributes: gidfa0ae,public
From: gthelen@engin.umich.edu (Greg Thelen)
Subject: Re: C open function in perl (lockfile)
Date: 1995/11/02
Message-ID: <h1oohuu7sve.fsf@rackham.engin.umich.edu>
X-Deja-AN: 118463941
sender: gthelen@rackham.engin.umich.edu
references: <4786us$a0f@korfu.igd.fhg.de> <47asja$728@csnews.cs.colorado.edu>
organization: The University of Michigan, Ann Arbor
newsgroups: de.comp.lang.perl,fj.lang.perl,comp.lang.perl.misc