Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/runtime/c-libs/posix-filesys/stat.c
ViewVC logotype

Diff of /sml/trunk/runtime/c-libs/posix-filesys/stat.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5265, Sun Jun 2 05:34:07 2019 UTC revision 5266, Sun Jun 2 06:13:34 2019 UTC
# Line 35  Line 35 
35  PVT ml_val_t mkStatRep (ml_state_t *msp, struct stat *buf)  PVT ml_val_t mkStatRep (ml_state_t *msp, struct stat *buf)
36  {  {
37      int             ftype;      int             ftype;
38        Int64_t     aTim, mTim, cTim;
39      ml_val_t        mode, ino, dev, uid, gid, nlink, sr, atime, mtime, ctime, size;      ml_val_t        mode, ino, dev, uid, gid, nlink, sr, atime, mtime, ctime, size;
40    
41  #if ((S_IFDIR != 0x4000) || (S_IFCHR != 0x2000) || (S_IFBLK != 0x6000) || (S_IFREG != 0x8000) || (S_IFIFO != 0x1000) || (S_IFLNK != 0xA000) || (S_IFSOCK != 0xC000))  #if ((S_IFDIR != 0x4000) || (S_IFCHR != 0x2000) || (S_IFBLK != 0x6000) || (S_IFREG != 0x8000) || (S_IFIFO != 0x1000) || (S_IFLNK != 0xA000) || (S_IFSOCK != 0xC000))
# Line 64  Line 65 
65      WORD_ALLOC (msp, uid, (Word_t)(buf->st_uid));      WORD_ALLOC (msp, uid, (Word_t)(buf->st_uid));
66      WORD_ALLOC (msp, gid, (Word_t)(buf->st_gid));      WORD_ALLOC (msp, gid, (Word_t)(buf->st_gid));
67      INT64_ALLOC (msp, size, buf->st_size);      INT64_ALLOC (msp, size, buf->st_size);
68    
69  #if !defined(STAT_HAS_TIMESPEC)  #if !defined(STAT_HAS_TIMESPEC)
70    /* the old API with second-level granularity */    /* the old API with second-level granularity */
71      INT64_ALLOC (msp, atime, buf->st_atime * 1000000000);      aTim = 1000000000 * (Int64_t)buf->st_atime;
72      INT64_ALLOC (msp, mtime, buf->st_mtime * 1000000000);      mTim = 1000000000 * (Int64_t)buf->st_mtime;
73      INT64_ALLOC (msp, ctime, buf->st_ctime * 1000000000);      cTim = 1000000000 * (Int64_t)buf->st_ctime;
74  #elif defined(OPSYS_DARWIN)  #elif defined(OPSYS_DARWIN)
75    /* macOS uses non-standard names for the fields */    /* macOS uses non-standard names for the fields */
76      INT64_ALLOC (msp, atime, buf->st_atimespec.tv_sec * 1000000000 + buf->st_atimespec.tv_nsec);      aTim = 1000000000 * (Int64_t)buf->st_atimespec.tv_sec + (Int64_t)buf->st_atimespec.tv_nsec;
77      INT64_ALLOC (msp, mtime, buf->st_mtimespec.tv_sec * 1000000000 + buf->st_mtimespec.tv_nsec);      mTim = 1000000000 * (Int64_t)buf->st_mtimespec.tv_sec + (Int64_t)buf->st_mtimespec.tv_nsec;
78      INT64_ALLOC (msp, ctime, buf->st_ctimespec.tv_sec * 1000000000 + buf->st_ctimespec.tv_nsec);      cTim = 1000000000 * (Int64_t)buf->st_ctimespec.tv_sec + (Int64_t)buf->st_ctimespec.tv_nsec;
79  #else  #else
80      INT64_ALLOC (msp, atime, buf->st_atim.tv_sec * 1000000000 + buf->st_atim.tv_nsec);      aTim = 1000000000 * (Int64_t)buf->st_atim.tv_sec + (Int64_t)buf->st_atim.tv_nsec;
81      INT64_ALLOC (msp, mtime, buf->st_mtim.tv_sec * 1000000000 + buf->st_mtim.tv_nsec);      mTim = 1000000000 * (Int64_t)buf->st_mtim.tv_sec + (Int64_t)buf->st_mtim.tv_nsec;
82      INT64_ALLOC (msp, ctime, buf->st_ctim.tv_sec * 1000000000 + buf->st_ctim.tv_nsec);      cTim = 1000000000 * (Int64_t)buf->st_ctim.tv_sec + (Int64_t)buf->st_ctim.tv_nsec;
83  #endif  #endif
84        INT64_ALLOC (msp, atime, aTim);
85        INT64_ALLOC (msp, mtime, mTim);
86        INT64_ALLOC (msp, ctime, cTim);
87    
88    /* allocate the stat record */    /* allocate the stat record */
89      ML_AllocWrite(msp,  0, MAKE_DESC(11, DTAG_record));      ML_AllocWrite(msp,  0, MAKE_DESC(11, DTAG_record));

Legend:
Removed from v.5265  
changed lines
  Added in v.5266

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0