Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • P poppler
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 675
    • Issues 675
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 55
    • Merge requests 55
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

Due to an influx of spam, we have had to impose restrictions on new accounts. Please see this wiki page for instructions on how to get full permissions. Sorry for the inconvenience.

  • poppler
  • poppler
  • Merge requests
  • !1024

Convert st_mtim reference to returning a copy

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Calvin Buckley requested to merge calvin/poppler:aix-mtim into master Dec 31, 2021
  • Overview 1
  • Commits 1
  • Pipelines 0
  • Changes 1

The reason why we need to do this is because on AIX, st_mtim is not defined as a timespec, but rather, as a a struct { time_t, int }, which isn't compatible. As such, we can't return a direct reference, nor just pass through the struct itself (except the macOS case), so we instead return a new struct with the same field values.

Specifically, from the AIX sys/stat.h...

// [...]

#ifdef _POSIX_SOURCE 

#if _XOPEN_SOURCE>=700
#ifndef _TIMESPEC
#define _TIMESPEC
struct timespec {
        time_t  tv_sec;         /* seconds */
        long    tv_nsec;        /* and nanoseconds */
};
#endif

/* internal timespec to preserve binary compatibility */
typedef struct st_timespec {
        time_t  tv_sec;         /* seconds */
        int     tv_nsec;        /* and nanoseconds */
} st_timespec_t;
#endif

// [...]

struct stat {
        // [...]
#if _XOPEN_SOURCE>=700
        st_timespec_t st_atim;  /* Time of last access  */
        st_timespec_t st_mtim;  /* Time of last data modification */
        st_timespec_t st_ctim;  /* Time of last file status change */
#else
        time_t  st_atime;       /* Time of last access  */
        int     st_atime_n;
        time_t  st_mtime;       /* Time of last data modification */
        int     st_mtime_n;
        time_t  st_ctime;       /* Time of last file status change */
        int     st_ctime_n;
#endif
        // [...]
};

// [...]

I think the performance impact should be minimal.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: aix-mtim