diff options
author | Gunnar Beutner <gunnar@beutner.name> | 2021-04-11 05:53:37 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-11 09:51:20 +0200 |
commit | 8ca5b8c0652bf73b53ddbbade9738432bd7c20c6 (patch) | |
tree | d69cdc937f652a6453302aa9a4b91f658ce149db | |
parent | be4b20c14d13246b6b798e931ede2df22de54737 (diff) | |
download | serenity-8ca5b8c0652bf73b53ddbbade9738432bd7c20c6.zip |
LibC: Move S_* defines into <fcntl.h>
According to the Single UNIX Specification, Version 2 that's where
those macros should be defined. This fixes the libiconv port.
This also fixes some (but not all) build errors for the diffutils and nano ports.
-rw-r--r-- | Userland/Applications/FileManager/DirectoryView.h | 1 | ||||
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibC/fcntl.h | 30 | ||||
-rw-r--r-- | Userland/Libraries/LibC/stdlib.cpp | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibC/sys/stat.h | 30 | ||||
-rw-r--r-- | Userland/Services/SystemServer/Service.cpp | 2 | ||||
-rw-r--r-- | Userland/Utilities/mktemp.cpp | 1 | ||||
-rw-r--r-- | Userland/Utilities/readelf.cpp | 1 | ||||
-rw-r--r-- | Userland/Utilities/tee.cpp | 1 | ||||
-rw-r--r-- | Userland/Utilities/truncate.cpp | 1 |
10 files changed, 37 insertions, 32 deletions
diff --git a/Userland/Applications/FileManager/DirectoryView.h b/Userland/Applications/FileManager/DirectoryView.h index 7c71191fe7..5ca87294c2 100644 --- a/Userland/Applications/FileManager/DirectoryView.h +++ b/Userland/Applications/FileManager/DirectoryView.h @@ -35,6 +35,7 @@ #include <LibGUI/IconView.h> #include <LibGUI/StackWidget.h> #include <LibGUI/TableView.h> +#include <fcntl.h> #include <sys/stat.h> namespace FileManager { diff --git a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp index e6418da153..e81cc100b0 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp @@ -29,6 +29,7 @@ #include "SimpleRegion.h" #include <AK/Debug.h> #include <AK/Format.h> +#include <fcntl.h> #include <sched.h> #include <serenity.h> #include <strings.h> diff --git a/Userland/Libraries/LibC/fcntl.h b/Userland/Libraries/LibC/fcntl.h index 5d6077cafd..38927e87c9 100644 --- a/Userland/Libraries/LibC/fcntl.h +++ b/Userland/Libraries/LibC/fcntl.h @@ -56,36 +56,6 @@ __BEGIN_DECLS #define O_CLOEXEC (1 << 11) #define O_DIRECT (1 << 12) -#define S_IFMT 0170000 -#define S_IFDIR 0040000 -#define S_IFCHR 0020000 -#define S_IFBLK 0060000 -#define S_IFREG 0100000 -#define S_IFIFO 0010000 -#define S_IFLNK 0120000 -#define S_IFSOCK 0140000 - -#define S_ISUID 04000 -#define S_ISGID 02000 -#define S_ISVTX 01000 -#define S_IRUSR 0400 -#define S_IWUSR 0200 -#define S_IXUSR 0100 -#define S_IREAD S_IRUSR -#define S_IWRITE S_IWUSR -#define S_IEXEC S_IXUSR -#define S_IRGRP 0040 -#define S_IWGRP 0020 -#define S_IXGRP 0010 -#define S_IROTH 0004 -#define S_IWOTH 0002 -#define S_IXOTH 0001 - -#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) - -#define S_IRWXG (S_IRWXU >> 3) -#define S_IRWXO (S_IRWXG >> 3) - int creat(const char* path, mode_t); int open(const char* path, int options, ...); #define AT_FDCWD -100 diff --git a/Userland/Libraries/LibC/stdlib.cpp b/Userland/Libraries/LibC/stdlib.cpp index 2ce2391646..e2e84feeba 100644 --- a/Userland/Libraries/LibC/stdlib.cpp +++ b/Userland/Libraries/LibC/stdlib.cpp @@ -35,6 +35,7 @@ #include <assert.h> #include <ctype.h> #include <errno.h> +#include <fcntl.h> #include <signal.h> #include <spawn.h> #include <stdio.h> diff --git a/Userland/Libraries/LibC/sys/stat.h b/Userland/Libraries/LibC/sys/stat.h index ed6d84458d..81f2d5175b 100644 --- a/Userland/Libraries/LibC/sys/stat.h +++ b/Userland/Libraries/LibC/sys/stat.h @@ -26,12 +26,40 @@ #pragma once -#include <fcntl.h> #include <sys/cdefs.h> #include <sys/types.h> __BEGIN_DECLS +#define S_IFMT 0170000 +#define S_IFDIR 0040000 +#define S_IFCHR 0020000 +#define S_IFBLK 0060000 +#define S_IFREG 0100000 +#define S_IFIFO 0010000 +#define S_IFLNK 0120000 +#define S_IFSOCK 0140000 + +#define S_ISUID 04000 +#define S_ISGID 02000 +#define S_ISVTX 01000 +#define S_IRUSR 0400 +#define S_IWUSR 0200 +#define S_IXUSR 0100 +#define S_IREAD S_IRUSR +#define S_IWRITE S_IWUSR +#define S_IEXEC S_IXUSR +#define S_IRGRP 0040 +#define S_IWGRP 0020 +#define S_IXGRP 0010 +#define S_IROTH 0004 +#define S_IWOTH 0002 +#define S_IXOTH 0001 + +#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) + +#define S_IRWXG (S_IRWXU >> 3) +#define S_IRWXO (S_IRWXG >> 3) #define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) #define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR) #define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK) diff --git a/Userland/Services/SystemServer/Service.cpp b/Userland/Services/SystemServer/Service.cpp index 2529dcdd90..dfb01dae5a 100644 --- a/Userland/Services/SystemServer/Service.cpp +++ b/Userland/Services/SystemServer/Service.cpp @@ -32,13 +32,13 @@ #include <LibCore/ConfigFile.h> #include <LibCore/File.h> #include <LibCore/Socket.h> +#include <fcntl.h> #include <grp.h> #include <libgen.h> #include <pwd.h> #include <sched.h> #include <stdio.h> #include <sys/ioctl.h> -#include <sys/stat.h> #include <unistd.h> static HashMap<pid_t, Service*> s_service_map; diff --git a/Userland/Utilities/mktemp.cpp b/Userland/Utilities/mktemp.cpp index 3b6b962690..5d9642d101 100644 --- a/Userland/Utilities/mktemp.cpp +++ b/Userland/Utilities/mktemp.cpp @@ -26,6 +26,7 @@ #include <AK/LexicalPath.h> #include <LibCore/ArgsParser.h> +#include <fcntl.h> #include <stdio.h> #include <string.h> #include <sys/stat.h> diff --git a/Userland/Utilities/readelf.cpp b/Userland/Utilities/readelf.cpp index 3024d765e7..06469680a1 100644 --- a/Userland/Utilities/readelf.cpp +++ b/Userland/Utilities/readelf.cpp @@ -35,6 +35,7 @@ #include <LibELF/Image.h> #include <LibELF/Validation.h> #include <ctype.h> +#include <fcntl.h> #include <stdio.h> #include <unistd.h> diff --git a/Userland/Utilities/tee.cpp b/Userland/Utilities/tee.cpp index 92c58c7031..dabdc6b157 100644 --- a/Userland/Utilities/tee.cpp +++ b/Userland/Utilities/tee.cpp @@ -30,6 +30,7 @@ #include <fcntl.h> #include <signal.h> #include <stdio.h> +#include <sys/stat.h> #include <unistd.h> static Vector<int> collect_fds(Vector<const char*> paths, bool append, bool* err) diff --git a/Userland/Utilities/truncate.cpp b/Userland/Utilities/truncate.cpp index f5c0e46259..4898c0eec9 100644 --- a/Userland/Utilities/truncate.cpp +++ b/Userland/Utilities/truncate.cpp @@ -26,6 +26,7 @@ #include <LibCore/ArgsParser.h> +#include <fcntl.h> #include <stdio.h> #include <sys/stat.h> #include <unistd.h> |