summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-12-21 16:00:08 -0800
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-21 18:16:48 -0800
commit1fdd1915c27fdfa01b55136c1eb1ecd90e88fb8b (patch)
tree4825e985833ac4b3d0a9439b0c9b7c8357bca986 /Userland/Libraries/LibC
parent890fba95f78a0e01ba8902f3339322c7e89816ca (diff)
downloadserenity-1fdd1915c27fdfa01b55136c1eb1ecd90e88fb8b.zip
LibC: Add POSIX spec comments for stat APIs
Diffstat (limited to 'Userland/Libraries/LibC')
-rw-r--r--Userland/Libraries/LibC/stat.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibC/stat.cpp b/Userland/Libraries/LibC/stat.cpp
index f693c2c283..b5f12904a3 100644
--- a/Userland/Libraries/LibC/stat.cpp
+++ b/Userland/Libraries/LibC/stat.cpp
@@ -15,11 +15,13 @@
extern "C" {
+// https://pubs.opengroup.org/onlinepubs/9699919799/functions/umask.html
mode_t umask(mode_t mask)
{
return syscall(SC_umask, mask);
}
+// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html
int mkdir(const char* pathname, mode_t mode)
{
if (!pathname) {
@@ -30,6 +32,7 @@ int mkdir(const char* pathname, mode_t mode)
__RETURN_WITH_ERRNO(rc, rc, -1);
}
+// https://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html
int chmod(const char* pathname, mode_t mode)
{
if (!pathname) {
@@ -40,12 +43,14 @@ int chmod(const char* pathname, mode_t mode)
__RETURN_WITH_ERRNO(rc, rc, -1);
}
+// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchmod.html
int fchmod(int fd, mode_t mode)
{
int rc = syscall(SC_fchmod, fd, mode);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
+// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkfifo.html
int mkfifo(const char* pathname, mode_t mode)
{
return mknod(pathname, mode | S_IFIFO, 0);
@@ -62,22 +67,26 @@ static int do_stat(int dirfd, const char* path, struct stat* statbuf, bool follo
__RETURN_WITH_ERRNO(rc, rc, -1);
}
+// https://pubs.opengroup.org/onlinepubs/9699919799/functions/lstat.html
int lstat(const char* path, struct stat* statbuf)
{
return do_stat(AT_FDCWD, path, statbuf, false);
}
+// https://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html
int stat(const char* path, struct stat* statbuf)
{
return do_stat(AT_FDCWD, path, statbuf, true);
}
+// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html
int fstat(int fd, struct stat* statbuf)
{
int rc = syscall(SC_fstat, fd, statbuf);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
+// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatat.html
int fstatat(int fd, const char* path, struct stat* statbuf, int flags)
{
return do_stat(fd, path, statbuf, !(flags & AT_SYMLINK_NOFOLLOW));