summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC/sys
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-14 15:36:26 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-14 19:58:11 +0200
commit740140a661df037087f2efc0d2adb47472726c3b (patch)
treef32c165319f3552e7232d35705eac16538d3f3fc /Userland/Libraries/LibC/sys
parent5c3440c5db431ff2f61c2fbecb7c0a2f509d9b16 (diff)
downloadserenity-740140a661df037087f2efc0d2adb47472726c3b.zip
Kernel+LibC: Share definitions in fcntl.h and sys/types.h
This patch begins the work of sharing types and macros between Kernel and LibC instead of duplicating them via the kludge in UnixTypes.h. The basic idea is that the Kernel vends various POSIX headers via Kernel/API/POSIX/ and LibC simply #include's them to get the macros.
Diffstat (limited to 'Userland/Libraries/LibC/sys')
-rw-r--r--Userland/Libraries/LibC/sys/types.h87
1 files changed, 2 insertions, 85 deletions
diff --git a/Userland/Libraries/LibC/sys/types.h b/Userland/Libraries/LibC/sys/types.h
index ad21502176..0910186712 100644
--- a/Userland/Libraries/LibC/sys/types.h
+++ b/Userland/Libraries/LibC/sys/types.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -10,87 +10,4 @@
#include <stddef.h>
#include <sys/cdefs.h>
-__BEGIN_DECLS
-
-/* There is no __SSIZE_TYPE__ but we can trick the preprocessor into defining it for us anyway! */
-#define unsigned signed
-typedef __SIZE_TYPE__ ssize_t;
-#undef unsigned
-
-typedef unsigned char u_char;
-typedef unsigned short u_short;
-typedef unsigned int u_int;
-typedef unsigned long u_long;
-
-typedef uint32_t uid_t;
-typedef uint32_t gid_t;
-
-typedef int __pid_t;
-#define pid_t __pid_t
-
-typedef char* caddr_t;
-
-typedef int id_t;
-
-typedef uint64_t ino_t;
-typedef int64_t off_t;
-
-typedef uint32_t blkcnt_t;
-typedef uint32_t blksize_t;
-typedef uint32_t dev_t;
-typedef uint16_t mode_t;
-typedef uint32_t nlink_t;
-
-typedef int64_t time_t;
-typedef uint32_t useconds_t;
-typedef int32_t suseconds_t;
-typedef uint32_t clock_t;
-
-typedef uint64_t fsblkcnt_t;
-typedef uint64_t fsfilcnt_t;
-
-#define __socklen_t_defined
-#define __socklen_t uint32_t
-typedef __socklen_t socklen_t;
-
-struct utimbuf {
- time_t actime;
- time_t modtime;
-};
-
-typedef int pthread_t;
-typedef int pthread_key_t;
-typedef uint32_t pthread_once_t;
-
-typedef struct __pthread_mutex_t {
- uint32_t lock;
- pthread_t owner;
- int level;
- int type;
-} pthread_mutex_t;
-
-typedef void* pthread_attr_t;
-typedef struct __pthread_mutexattr_t {
- int type;
-} pthread_mutexattr_t;
-
-typedef struct __pthread_cond_t {
- pthread_mutex_t* mutex;
- uint32_t value;
- int clockid; // clockid_t
-} pthread_cond_t;
-
-typedef uint64_t pthread_rwlock_t;
-typedef void* pthread_rwlockattr_t;
-typedef struct __pthread_spinlock_t {
- int m_lock;
-} pthread_spinlock_t;
-typedef struct __pthread_condattr_t {
- int clockid; // clockid_t
-} pthread_condattr_t;
-
-static inline dev_t makedev(unsigned int major, unsigned int minor) { return (minor & 0xffu) | (major << 8u) | ((minor & ~0xffu) << 12u); }
-static inline unsigned int major(dev_t dev) { return (dev & 0xfff00u) >> 8u; }
-static inline unsigned int minor(dev_t dev) { return (dev & 0xffu) | ((dev >> 12u) & 0xfff00u); }
-
-__END_DECLS
+#include <Kernel/API/POSIX/sys/types.h>