Kernel+LibC: Share definitions for serenity.h
This commit is contained in:
parent
6f78377864
commit
77c2c0f620
Notes:
sideshowbarker
2024-07-18 06:54:18 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/77c2c0f6203
3 changed files with 49 additions and 54 deletions
47
Kernel/API/POSIX/serenity.h
Normal file
47
Kernel/API/POSIX/serenity.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Kernel/API/POSIX/sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PURGE_ALL_VOLATILE 0x1
|
||||
#define PURGE_ALL_CLEAN_INODE 0x2
|
||||
|
||||
enum {
|
||||
PERF_EVENT_SAMPLE = 1,
|
||||
PERF_EVENT_MALLOC = 2,
|
||||
PERF_EVENT_FREE = 4,
|
||||
PERF_EVENT_MMAP = 8,
|
||||
PERF_EVENT_MUNMAP = 16,
|
||||
PERF_EVENT_PROCESS_CREATE = 32,
|
||||
PERF_EVENT_PROCESS_EXEC = 64,
|
||||
PERF_EVENT_PROCESS_EXIT = 128,
|
||||
PERF_EVENT_THREAD_CREATE = 256,
|
||||
PERF_EVENT_THREAD_EXIT = 512,
|
||||
PERF_EVENT_CONTEXT_SWITCH = 1024,
|
||||
PERF_EVENT_KMALLOC = 2048,
|
||||
PERF_EVENT_KFREE = 4096,
|
||||
PERF_EVENT_PAGE_FAULT = 8192,
|
||||
PERF_EVENT_SYSCALL = 16384,
|
||||
PERF_EVENT_SIGNPOST = 32768,
|
||||
};
|
||||
|
||||
#define PERF_EVENT_MASK_ALL (~0ull)
|
||||
|
||||
#define THREAD_PRIORITY_MIN 1
|
||||
#define THREAD_PRIORITY_LOW 10
|
||||
#define THREAD_PRIORITY_NORMAL 30
|
||||
#define THREAD_PRIORITY_HIGH 50
|
||||
#define THREAD_PRIORITY_MAX 99
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -14,6 +14,7 @@
|
|||
#include <Kernel/API/POSIX/net/if_arp.h>
|
||||
#include <Kernel/API/POSIX/net/route.h>
|
||||
#include <Kernel/API/POSIX/netinet/in.h>
|
||||
#include <Kernel/API/POSIX/serenity.h>
|
||||
#include <Kernel/API/POSIX/signal.h>
|
||||
#include <Kernel/API/POSIX/sys/mman.h>
|
||||
#include <Kernel/API/POSIX/sys/socket.h>
|
||||
|
@ -45,25 +46,6 @@ enum {
|
|||
_SC_CLK_TCK,
|
||||
};
|
||||
|
||||
enum {
|
||||
PERF_EVENT_SAMPLE = 1,
|
||||
PERF_EVENT_MALLOC = 2,
|
||||
PERF_EVENT_FREE = 4,
|
||||
PERF_EVENT_MMAP = 8,
|
||||
PERF_EVENT_MUNMAP = 16,
|
||||
PERF_EVENT_PROCESS_CREATE = 32,
|
||||
PERF_EVENT_PROCESS_EXEC = 64,
|
||||
PERF_EVENT_PROCESS_EXIT = 128,
|
||||
PERF_EVENT_THREAD_CREATE = 256,
|
||||
PERF_EVENT_THREAD_EXIT = 512,
|
||||
PERF_EVENT_CONTEXT_SWITCH = 1024,
|
||||
PERF_EVENT_KMALLOC = 2048,
|
||||
PERF_EVENT_KFREE = 4096,
|
||||
PERF_EVENT_PAGE_FAULT = 8192,
|
||||
PERF_EVENT_SYSCALL = 16384,
|
||||
PERF_EVENT_SIGNPOST = 32768,
|
||||
};
|
||||
|
||||
#define R_OK 4
|
||||
#define W_OK 2
|
||||
#define X_OK 1
|
||||
|
@ -157,9 +139,6 @@ struct sched_param {
|
|||
#define AT_FDCWD -100
|
||||
#define AT_SYMLINK_NOFOLLOW 0x100
|
||||
|
||||
#define PURGE_ALL_VOLATILE 0x1
|
||||
#define PURGE_ALL_CLEAN_INODE 0x2
|
||||
|
||||
#define PT_TRACE_ME 1
|
||||
#define PT_ATTACH 2
|
||||
#define PT_CONTINUE 3
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <Kernel/API/POSIX/futex.h>
|
||||
#include <Kernel/API/POSIX/serenity.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -24,12 +23,6 @@ int profiling_enable(pid_t, uint64_t);
|
|||
int profiling_disable(pid_t);
|
||||
int profiling_free_buffer(pid_t);
|
||||
|
||||
#define THREAD_PRIORITY_MIN 1
|
||||
#define THREAD_PRIORITY_LOW 10
|
||||
#define THREAD_PRIORITY_NORMAL 30
|
||||
#define THREAD_PRIORITY_HIGH 50
|
||||
#define THREAD_PRIORITY_MAX 99
|
||||
|
||||
int futex(uint32_t* userspace_address, int futex_op, uint32_t value, const struct timespec* timeout, uint32_t* userspace_address2, uint32_t value3);
|
||||
|
||||
static ALWAYS_INLINE int futex_wait(uint32_t* userspace_address, uint32_t value, const struct timespec* abstime, int clockid)
|
||||
|
@ -52,32 +45,8 @@ static ALWAYS_INLINE int futex_wake(uint32_t* userspace_address, uint32_t count)
|
|||
return futex(userspace_address, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, count, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
#define PURGE_ALL_VOLATILE 0x1
|
||||
#define PURGE_ALL_CLEAN_INODE 0x2
|
||||
|
||||
int purge(int mode);
|
||||
|
||||
enum {
|
||||
PERF_EVENT_SAMPLE = 1,
|
||||
PERF_EVENT_MALLOC = 2,
|
||||
PERF_EVENT_FREE = 4,
|
||||
PERF_EVENT_MMAP = 8,
|
||||
PERF_EVENT_MUNMAP = 16,
|
||||
PERF_EVENT_PROCESS_CREATE = 32,
|
||||
PERF_EVENT_PROCESS_EXEC = 64,
|
||||
PERF_EVENT_PROCESS_EXIT = 128,
|
||||
PERF_EVENT_THREAD_CREATE = 256,
|
||||
PERF_EVENT_THREAD_EXIT = 512,
|
||||
PERF_EVENT_CONTEXT_SWITCH = 1024,
|
||||
PERF_EVENT_KMALLOC = 2048,
|
||||
PERF_EVENT_KFREE = 4096,
|
||||
PERF_EVENT_PAGE_FAULT = 8192,
|
||||
PERF_EVENT_SYSCALL = 16384,
|
||||
PERF_EVENT_SIGNPOST = 32768,
|
||||
};
|
||||
|
||||
#define PERF_EVENT_MASK_ALL (~0ull)
|
||||
|
||||
int perf_event(int type, uintptr_t arg1, uintptr_t arg2);
|
||||
int perf_register_string(char const* string, size_t string_length);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue