Xref: utzoo comp.sys.apollo:4442 comp.lang.perl:275 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think!snorkelwacker!bloom-beacon!eru!luth!sunic!tut!santra!mjolner!jnp From: jnp@mjolner.tele.nokia.fi (J|rgen N|rgaard) Newsgroups: comp.sys.apollo,comp.lang.perl Subject: perl under SR10.1; trouble with "stat" Message-ID: Date: 2 Feb 90 12:10:09 GMT Sender: news@mjolner.tele.nokia.fi Distribution: comp Organization: Nokia Telecommunications Oy, Espoo, Finland Lines: 80 On installing perl (latest release with patches) I had some worries because the tests some times would fail on "op.stat". Deciding to investigate on little on this I wrote the attached small c-piece. So my question os two-fold: i) how is "stat" supposed to work under BSD4.3 ? i.e. should "mtime" and "ctime" be equal upon creating of a fresh file ? ii) If so, why is Apollo different ? And what to do about it ? Is this fixed in SR10.2 ? (Machine: Apollo DN3500, SR10.1, BSD4.3, native cc) Any help appreciated. /j|rgen n|rgaard File "stat.c": #include #include #include #include #include main(argc,argv) int argc; char *argv[]; { int fd; struct stat buf; (void) unlink("./foo.tmp"); fd = open("./foo.tmp", O_CREAT | O_RDWR, 00200); printf("fd: %d, %d.\n", fd, errno); printf("stat: %d.\n", stat("./foo.tmp", &buf)); printf("stat.st_mtime: %u, stat.st_ctime: %u.\n", buf.st_mtime, buf.st_ctime); printf("stat: %d.\n", stat("./foo.tmp", &buf)); printf("stat.st_mtime: %u, stat.st_ctime: %u.\n", buf.st_mtime, buf.st_ctime); (void) unlink("foo.tmp"); }; Result: mjolner :~/src/c/test (1) a.out fd: 3, 2. stat: 0. stat.st_mtime: 633958917, stat.st_ctime: 633958918. stat: 0. stat.st_mtime: 633958917, stat.st_ctime: 633958918. mjolner :~/src/c/test (2) !! a.out fd: 3, 2. stat: 0. stat.st_mtime: 633958924, stat.st_ctime: 633958924. stat: 0. stat.st_mtime: 633958924, stat.st_ctime: 633958924. mjolner :~/src/c/test (3) !! a.out fd: 3, 2. stat: 0. stat.st_mtime: 633958926, stat.st_ctime: 633958927. stat: 0. stat.st_mtime: 633958926, stat.st_ctime: 633958927. mjolner :~/src/c/test (4) !! a.out fd: 3, 2. stat: 0. stat.st_mtime: 633958929, stat.st_ctime: 633958929. stat: 0. stat.st_mtime: 633958929, stat.st_ctime: 633958929. mjolner :~/src/c/test (5) -- ------------------------ ORIGIN '~jnp/stdDisclaimers' ------------------------ | Regards, J|rgen N|rgaard ('|' is '\o{}' in \LaTeX{}) | | e-mail: jnp@tele.nokia.fi | telephone: <..>-358-0-511-5671 | -- mail: Nokia Telecommunications, PL 33, SF-02601 Espoo, Suomi Finland --