Date: Mon, 29 Jul 2013 06:38:21 +1000 From: Chris Johns <chrisj@rtems.org> To: freebsd-standards@freebsd.org Subject: truncate and open(O_TRUNC) times. Message-ID: <51F5813D.2030806@rtems.org>
next in thread | raw e-mail | index | archive | help
Hello, In the RTEMS project we have some test code that appears to fail on FreeBSD. You can find a stripped down version at http://www.rtems.org/ftp/pub/rtems/people/chrisj/fstimes/truncate-time-test.c The code does .. fd = open (file01, O_CREAT | O_WRONLY, mode); n = write (fd, databuf, len); assert (n == len); status = close (fd); assert (status == 0); sleep(2); status = truncate (file01, len); assert (status == 0); The length does not change and given the file does not change our interpretation of the truncate call is the times should not change. In the case of .. fd = open (file03, O_CREAT | O_WRONLY, mode); status = close (fd); assert (status == 0); sleep(2); fd = open (file03, O_TRUNC | O_WRONLY, mode); status = close (fd); assert (status == 0); the times do change as expected. Chris
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51F5813D.2030806>