tools/include/nolibc/sys/stat.h
Source file repositories/reference/linux-study-clean/tools/include/nolibc/sys/stat.h
File Facts
- System
- Linux kernel
- Corpus path
tools/include/nolibc/sys/stat.h- Extension
.h- Size
- 2587 bytes
- Lines
- 92
- 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.h../arch.h../types.h../sys.h../sys/sysmacros.h
Detected Declarations
function __attribute__function __attribute__function __attribute__function __attribute__function __attribute__function __attribute__
Annotated Snippet
#include "../nolibc.h"
#ifndef _NOLIBC_SYS_STAT_H
#define _NOLIBC_SYS_STAT_H
#include "../arch.h"
#include "../types.h"
#include "../sys.h"
#include "../sys/sysmacros.h"
/*
* int statx(int fd, const char *path, int flags, unsigned int mask, struct statx *buf);
* int stat(const char *path, struct stat *buf);
* int fstatat(int fd, const char *path, struct stat *buf, int flag);
* int fstat(int fildes, struct stat *buf);
* int lstat(const char *path, struct stat *buf);
*/
static __attribute__((unused))
int _sys_statx(int fd, const char *path, int flags, unsigned int mask, struct statx *buf)
{
#ifdef __NR_statx
return __nolibc_syscall5(__NR_statx, fd, path, flags, mask, buf);
#else
return __nolibc_enosys(__func__, fd, path, flags, mask, buf);
#endif
}
static __attribute__((unused))
int statx(int fd, const char *path, int flags, unsigned int mask, struct statx *buf)
{
return __sysret(_sys_statx(fd, path, flags, mask, buf));
}
static __attribute__((unused))
int fstatat(int fd, const char *path, struct stat *buf, int flag)
{
struct statx statx;
long ret;
ret = __sysret(_sys_statx(fd, path, flag | AT_NO_AUTOMOUNT, STATX_BASIC_STATS, &statx));
if (ret == -1)
return ret;
buf->st_dev = makedev(statx.stx_dev_major, statx.stx_dev_minor);
buf->st_ino = statx.stx_ino;
buf->st_mode = statx.stx_mode;
buf->st_nlink = statx.stx_nlink;
buf->st_uid = statx.stx_uid;
buf->st_gid = statx.stx_gid;
buf->st_rdev = makedev(statx.stx_rdev_major, statx.stx_rdev_minor);
buf->st_size = statx.stx_size;
buf->st_blksize = statx.stx_blksize;
buf->st_blocks = statx.stx_blocks;
buf->st_atim.tv_sec = statx.stx_atime.tv_sec;
buf->st_atim.tv_nsec = statx.stx_atime.tv_nsec;
buf->st_mtim.tv_sec = statx.stx_mtime.tv_sec;
buf->st_mtim.tv_nsec = statx.stx_mtime.tv_nsec;
buf->st_ctim.tv_sec = statx.stx_ctime.tv_sec;
buf->st_ctim.tv_nsec = statx.stx_ctime.tv_nsec;
return 0;
}
static __attribute__((unused))
int stat(const char *path, struct stat *buf)
{
return fstatat(AT_FDCWD, path, buf, 0);
}
static __attribute__((unused))
int fstat(int fildes, struct stat *buf)
{
return fstatat(fildes, "", buf, AT_EMPTY_PATH);
}
static __attribute__((unused))
int lstat(const char *path, struct stat *buf)
{
return fstatat(AT_FDCWD, path, buf, AT_SYMLINK_NOFOLLOW);
}
#endif /* _NOLIBC_SYS_STAT_H */
Annotation
- Immediate include surface: `../nolibc.h`, `../arch.h`, `../types.h`, `../sys.h`, `../sys/sysmacros.h`.
- Detected declarations: `function __attribute__`, `function __attribute__`, `function __attribute__`, `function __attribute__`, `function __attribute__`, `function __attribute__`.
- 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.