diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2021-06-19 15:57:41 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2021-06-19 15:57:41 (GMT) |
commit | 5ed49bbc61a1cb188a4b5a069f2de046b1d8d910 (patch) | |
tree | 4841fec343ddf315e4c8abc86e570d996b05dc95 /unix/tclUnixChan.c | |
parent | fa0c0e6134dd5fa90b99a2156362074440f69f1b (diff) | |
download | tcl-5ed49bbc61a1cb188a4b5a069f2de046b1d8d910.zip tcl-5ed49bbc61a1cb188a4b5a069f2de046b1d8d910.tar.gz tcl-5ed49bbc61a1cb188a4b5a069f2de046b1d8d910.tar.bz2 |
Added in missing field
Diffstat (limited to 'unix/tclUnixChan.c')
-rw-r--r-- | unix/tclUnixChan.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index f5ab36e..f8b52a6 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -639,7 +639,7 @@ StoreElementInDict( Tcl_DictObjPut(NULL, dictObj, nameObj, valueObj); } -static const char * +static inline const char * GetTypeFromMode( int mode) { @@ -673,7 +673,8 @@ static Tcl_Obj * StatOpenFile( FileState *fsPtr) { - Tcl_StatBuf statBuf; + Tcl_StatBuf statBuf; /* Not allocated on heap; we're definitely + * API-synchronized with how Tcl is built! */ Tcl_Obj *dictObj; unsigned short mode; @@ -689,17 +690,22 @@ StatOpenFile( dictObj = Tcl_NewObj(); #define STORE_ELEM(name, value) StoreElementInDict(dictObj, name, value) - STORE_ELEM("dev", Tcl_NewWideIntObj((long)statBuf.st_dev)); - STORE_ELEM("ino", Tcl_NewWideIntObj((Tcl_WideInt)statBuf.st_ino)); - STORE_ELEM("nlink", Tcl_NewWideIntObj((long)statBuf.st_nlink)); - STORE_ELEM("uid", Tcl_NewWideIntObj((long)statBuf.st_uid)); - STORE_ELEM("gid", Tcl_NewWideIntObj((long)statBuf.st_gid)); - STORE_ELEM("size", Tcl_NewWideIntObj((Tcl_WideInt)statBuf.st_size)); + STORE_ELEM("dev", Tcl_NewWideIntObj((long) statBuf.st_dev)); + STORE_ELEM("ino", Tcl_NewWideIntObj((Tcl_WideInt) statBuf.st_ino)); + STORE_ELEM("nlink", Tcl_NewWideIntObj((long) statBuf.st_nlink)); + STORE_ELEM("uid", Tcl_NewWideIntObj((long) statBuf.st_uid)); + STORE_ELEM("gid", Tcl_NewWideIntObj((long) statBuf.st_gid)); + STORE_ELEM("size", Tcl_NewWideIntObj((Tcl_WideInt) statBuf.st_size)); #ifdef HAVE_STRUCT_STAT_ST_BLOCKS - STORE_ELEM("blocks", Tcl_NewWideIntObj((Tcl_WideInt)statBuf.st_blocks)); + STORE_ELEM("blocks", Tcl_NewWideIntObj((Tcl_WideInt) statBuf.st_blocks)); #endif #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE - STORE_ELEM("blksize", Tcl_NewWideIntObj((long)statBuf.st_blksize)); + STORE_ELEM("blksize", Tcl_NewWideIntObj((long) statBuf.st_blksize)); +#endif +#ifdef HAVE_STRUCT_STAT_ST_RDEV + if (S_ISCHR(statBuf.st_mode) || S_ISBLK(statBuf.st_mode)) { + STORE_ELEM("rdev", Tcl_NewWideIntObj((long) statBuf.st_rdev)); + } #endif STORE_ELEM("atime", Tcl_NewWideIntObj( Tcl_GetAccessTimeFromStat(&statBuf))); |