Skip to content

Incorrect newlib stat struct definition #2795

@zetanumbers

Description

@zetanumbers

pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
pub st_size: ::off_t,
pub st_atime: ::time_t,
pub st_spare1: ::c_long,
pub st_mtime: ::time_t,
pub st_spare2: ::c_long,
pub st_ctime: ::time_t,
pub st_spare3: ::c_long,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt_t,
pub st_spare4: [::c_long; 2usize],
}

newlib/libc/include/sys/stat.h

struct  stat 
{
  dev_t         st_dev;
  ino_t         st_ino;
  mode_t        st_mode;
  nlink_t       st_nlink;
  uid_t         st_uid;
  gid_t         st_gid;
  dev_t         st_rdev;
  off_t         st_size;
#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
  time_t        st_atime;
  time_t        st_mtime;
  time_t        st_ctime;
#else
  struct timespec st_atim;
  struct timespec st_mtim;
  struct timespec st_ctim;
  blksize_t     st_blksize;
  blkcnt_t      st_blocks;
#if !defined(__rtems__)
  long          st_spare4[2];
#endif
#endif
};

#if !(defined(__svr4__) && !defined(__PPC__) && !defined(__sun__))
#define st_atime st_atim.tv_sec
#define st_ctime st_ctim.tv_sec
#define st_mtime st_mtim.tv_sec
#endif

I would like to see defined(__svr4__) && !defined(__PPC__) && !defined(__sun__) case being handled for targets without nanoseconds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.O-newlib

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions