[m-rev.] posix patch (stat, pipe, kill)

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jul 25 17:54:46 AEST 2001


On 25-Jul-2001, Michael Day <mikeday at bigpond.net.au> wrote:
> 
> > I think that should be changed.
> > (With `:- type mode == mode_t. % XXX This is deprecated; please use mode_t.'
> > for backwards compatibility.)
> 
> In that case... here is a diff :)

Great, thanks.  That looks good.  I have some comments, but feel free to commit
what you just posted before addressing these.

> +:- module posix__stat.
...
> +:- func nlink(stat) = int.

Why not `= nlink_t'?

> +:- func size(stat) = int.
> +:- func blksize(stat) = int.
> +:- func blocks(stat) = int.

Why not off_t, blksize_t, and blkcnt_t respectively?
Those are the names used in the latest draft that I have
of the Posix standard.

Also, off_t (and probably also for blkcnt_t) should be `integer', not
`int', otherwise we'll have problems on 32-bit systems that support
files with sizes > 2G.  It's OK if the implementation doesn't handle
that case yet, but we should get the interface right.

> +:- pragma c_code(stat0(Path::in, Res::out, Stat::out, IO0::di, IO::uo),
> +		[will_not_call_mercury, thread_safe], "{
> +	Stat = (MR_Word) MR_NEW(struct stat);
> +	Res = stat(Path, (struct stat *)Stat);

Did I really suggest MR_NEW?  I must have been half-asleep.
That should be MR_GC_NEW, not MR_NEW, otherwise there will be a memory leak,
since the memory will never get deallocated or garbage collected.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list