Support time namespace

"time" namespace was introduced in Linux v5.6
support new time namespace to set boottime and monotonic time offset

Example runtime spec

"timeOffsets": {
    "monotonic": {
        "secs": 172800,
        "nanosecs": 0
    },
    "boottime": {
        "secs": 604800,
        "nanosecs": 0
    }
}

Signed-off-by: Chethan Suresh <chethan.suresh@sony.com>
This commit is contained in:
Chethan Suresh
2023-08-03 10:12:01 +05:30
parent dbe8434359
commit ebc2e7c435
9 changed files with 61 additions and 0 deletions
@@ -106,6 +106,12 @@ func namespaces(config *configs.Config) error {
}
}
if config.Namespaces.Contains(configs.NEWTIME) {
if _, err := os.Stat("/proc/self/timens_offsets"); os.IsNotExist(err) {
return errors.New("time namespaces aren't enabled in the kernel")
}
}
return nil
}