This is not necessarily the current version of this TIP.
|Title:||Portable Access Functions for Stat Buffers|
|Version:||$Revision: 1.4 $|
|Author:||Donal K. Fellows <donal dot k dot fellows at manchester dot ac dot uk>|
|Created:||Friday, 02 May 2008|
Tcl exposes the definition of the struct stat type to users of its C API, but this can vary between builds. This TIP proposes a set of portable functions for reading (portable) fields out of those structures so that code does not need to match the API version when reading the fields (the most common case by far).
The struct stat type used by Tcl can be one of many different types depending on compile-time options (as a consequence of 64-bit filesystem support). Tcl conceals these details by wrapping the type as a Tcl_StatBuf and providing a way to allocate these independently of compiler configuration. However, there is no way to access the contents of the field without binding to a particular type i.e. particular compile time configuration of Tcl (and not necessarily the extension code using the API!) This TIP proposes a set of simple access functions to conceal these details and enable the portable read-only use of the Tcl_StatBuf type.
This TIP proposes that the following functions will be defined. Each will take a pointer to a Tcl_StatBuf as its only argument, and will return the contents of the field indicated below.
Returns the st_dev field as an unsigned integer.
Returns the st_ino field as an unsigned integer.
Returns the st_mode field as an unsigned integer.
Returns the st_nlink field as an integer.
Returns the st_uid field as an integer.
Returns the st_gid field as an integer.
Returns the st_rdev field as an integer.
Returns the st_atime field as a wide inte