fstests/fstime errors

Sebastian Huber sebastian.huber at embedded-brains.de
Sun Jul 28 12:31:42 UTC 2013


On 2013-07-28 06:46, Chris Johns wrote:
>> WARNING - log/mrfs_fstime did not appear to complete execution
>
> This one is a little more interesting. The test is correct and the RFS 
> fails however it passes this ...
>
>   f = open (file03, O_CREAT | O_WRONLY);
>   close (f);
>   sleep (for_a_few_seconds);
>   f = open (file03, O_TRUNC | O_WRONLY);
>   close (f);
>
> RTEMS implements the truncate in the open call for the file system 
> with an ftruncate call. In this case the file system follows the 
> truncate call's requirements of not updating the mtime and ctime 
> fields, however open states ..

For ftruncate we have this:

http://pubs.opengroup.org/onlinepubs/009695399/functions/ftruncate.html

"Upon successful completion, if /fildes/ refers to a regular file, the 
/ftruncate/() function shall mark for update the /st_ctime/ and 
/st_mtime/ fields of the file and the S_ISUID and S_ISGID bits of the 
file mode may be cleared. If the /ftruncate/() function is unsuccessful, 
the file is unaffected."

[...]

"The following new requirements on POSIX implementations derive from 
alignment with the Single UNIX Specification:

  *

    The DESCRIPTION is changed to indicate that if the file size is
    changed, and if the file is a regular file, the S_ISUID and S_ISGID
    bits in the file mode may be cleared."

>
>  "If O_TRUNC is set and the file did previously exist, upon
>   successful completion, open() shall mark for update the last
>   data modification and last file status change timestamps of
>   the file."
>
> I assume the open's requirements override the truncate's requirements 
> here. I will fix the RFS to follow the truncate requirements and add 
> this test to the test suite. I suspect the fix for this requires the 
> truncate op handler needing a parameter to say how to handle the time 
> fields. 

If I read this correctly, then the O_TRUNC and ftruncate() are similar 
with respect to the mtime and ctime update.  What is unclear is if this 
should only happen if the file size changes.

Regarding the atime I would not support this.  See also

http://en.wikipedia.org/wiki/Stat_%28system_call%29#Criticism_of_atime

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the devel mailing list