[m-rev.] posix patch (stat, pipe, kill)
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Jul 23 20:18:02 AEST 2001
On 19-Jul-2001, Michael Day <mikeday at corplink.com.au> wrote:
>
> % module: posix.m
Please don't repost whole modules if you have only changed a small part;
just post a diff (which you can obtain using `cvs diff -u') that shows
your changes.
> :- module posix__stat.
...
> :- func dev(stat) = dev.
> :- func ino(stat) = ino.
> :- func mode(stat) = (mode).
> :- func file_type(stat) = file_type.
> :- func nlink(stat) = int.
> :- func uid(stat) = uid.
> :- func gid(stat) = gid.
> :- func rdev(stat) = dev.
> :- func size(stat) = int.
> :- func blksize(stat) = int.
> :- func blocks(stat) = int.
> :- func atime(stat) = time_t.
> :- func mtime(stat) = time_t.
> :- func ctime(stat) = time_t.
I think you should stick with the Posix names: dev_t, ino_t, uid_t, etc.
This is consistent with the approach taken in library/time.m.
> :- pragma c_code(stat0(Path::in, Res::out, Stat::out, IO0::di, IO::uo),
> [will_not_call_mercury, thread_safe], "{
> Stat = (MR_Word) GC_NEW(struct stat);
> Res = stat(Path, (struct stat *)Stat);
`GC_NEW' is not the right allocation primitive to use here.
That will do the wrong thing when compiled with e.g. `GRADEFLAGS = --gc none'.
Use `MR_NEW' or `MR_GC_NEW' (see runtime/mercury_memory.h) --
I think `MR_NEW' is probably the right one to use here.
The rest of it looks fine.
--
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