tools/include/nolibc/time.h
Source file repositories/reference/linux-study-clean/tools/include/nolibc/time.h
File Facts
- System
- Linux kernel
- Corpus path
tools/include/nolibc/time.h- Extension
.h- Size
- 5655 bytes
- Lines
- 206
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
nolibc.hstd.harch.htypes.hsys.hlinux/signal.hlinux/time.h
Detected Declarations
function clock_nanosleepfunction __attribute__function __attribute__function __attribute__function __attribute__function __attribute__function __attribute__function __attribute__function difftimefunction nanosleepfunction __attribute__function __attribute__function __attribute__function __attribute__function __attribute__function __attribute__function __attribute__function __attribute__function __attribute__
Annotated Snippet
#include "nolibc.h"
#ifndef _NOLIBC_TIME_H
#define _NOLIBC_TIME_H
#include "std.h"
#include "arch.h"
#include "types.h"
#include "sys.h"
#include <linux/signal.h>
#include <linux/time.h>
#define __nolibc_assert_time64_type(t) \
__nolibc_static_assert(sizeof(t) == 8)
#define __nolibc_assert_native_time64() \
__nolibc_assert_time64_type(__kernel_old_time_t)
/*
* int clock_getres(clockid_t clockid, struct timespec *res);
* int clock_gettime(clockid_t clockid, struct timespec *tp);
* int clock_settime(clockid_t clockid, const struct timespec *tp);
* int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp,
* struct timespec *rmtp)
*/
static __attribute__((unused))
int _sys_clock_getres(clockid_t clockid, struct timespec *res)
{
#if defined(__NR_clock_getres_time64)
__nolibc_assert_time64_type(res->tv_sec);
return __nolibc_syscall2(__NR_clock_getres_time64, clockid, res);
#else
__nolibc_assert_native_time64();
return __nolibc_syscall2(__NR_clock_getres, clockid, res);
#endif
}
static __attribute__((unused))
int clock_getres(clockid_t clockid, struct timespec *res)
{
return __sysret(_sys_clock_getres(clockid, res));
}
static __attribute__((unused))
int _sys_clock_gettime(clockid_t clockid, struct timespec *tp)
{
#if defined(__NR_clock_gettime64)
__nolibc_assert_time64_type(tp->tv_sec);
return __nolibc_syscall2(__NR_clock_gettime64, clockid, tp);
#else
__nolibc_assert_native_time64();
return __nolibc_syscall2(__NR_clock_gettime, clockid, tp);
#endif
}
static __attribute__((unused))
int clock_gettime(clockid_t clockid, struct timespec *tp)
{
return __sysret(_sys_clock_gettime(clockid, tp));
}
static __attribute__((unused))
int _sys_clock_settime(clockid_t clockid, struct timespec *tp)
{
#if defined(__NR_clock_settime64)
__nolibc_assert_time64_type(tp->tv_sec);
return __nolibc_syscall2(__NR_clock_settime64, clockid, tp);
#else
__nolibc_assert_native_time64();
return __nolibc_syscall2(__NR_clock_settime, clockid, tp);
#endif
}
static __attribute__((unused))
int clock_settime(clockid_t clockid, struct timespec *tp)
{
return __sysret(_sys_clock_settime(clockid, tp));
}
static __attribute__((unused))
int _sys_clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp,
struct timespec *rmtp)
{
#if defined(__NR_clock_nanosleep_time64)
__nolibc_assert_time64_type(rqtp->tv_sec);
return __nolibc_syscall4(__NR_clock_nanosleep_time64, clockid, flags, rqtp, rmtp);
#else
__nolibc_assert_native_time64();
Annotation
- Immediate include surface: `nolibc.h`, `std.h`, `arch.h`, `types.h`, `sys.h`, `linux/signal.h`, `linux/time.h`.
- Detected declarations: `function clock_nanosleep`, `function __attribute__`, `function __attribute__`, `function __attribute__`, `function __attribute__`, `function __attribute__`, `function __attribute__`, `function __attribute__`, `function difftime`, `function nanosleep`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.