2020-01-18 09:38:21 +01:00
|
|
|
/*
|
2021-02-02 19:48:39 +01:00
|
|
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
2020-01-18 09:38:21 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
|
2019-01-28 23:01:47 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
2021-08-14 17:12:54 +02:00
|
|
|
#include <Kernel/API/POSIX/futex.h>
|
2021-08-14 18:28:05 +02:00
|
|
|
#include <Kernel/API/POSIX/serenity.h>
|
2019-01-28 23:01:47 +01:00
|
|
|
#include <stdio.h>
|
2021-07-05 14:24:40 +03:00
|
|
|
#include <time.h>
|
2021-02-03 10:19:09 +01:00
|
|
|
#include <unistd.h>
|
2019-01-28 23:01:47 +01:00
|
|
|
|
2019-11-28 20:59:11 +01:00
|
|
|
__BEGIN_DECLS
|
|
|
|
|
|
2020-08-04 13:51:11 +02:00
|
|
|
int disown(pid_t);
|
|
|
|
|
|
2021-05-14 08:10:43 +02:00
|
|
|
int profiling_enable(pid_t, uint64_t);
|
2019-12-11 20:36:56 +01:00
|
|
|
int profiling_disable(pid_t);
|
2021-04-18 21:12:06 -07:00
|
|
|
int profiling_free_buffer(pid_t);
|
2019-12-11 20:36:56 +01:00
|
|
|
|
2020-12-21 23:21:58 -07:00
|
|
|
int futex(uint32_t* userspace_address, int futex_op, uint32_t value, const struct timespec* timeout, uint32_t* userspace_address2, uint32_t value3);
|
2019-12-22 21:29:47 +01:00
|
|
|
|
2021-07-05 14:24:40 +03:00
|
|
|
static ALWAYS_INLINE int futex_wait(uint32_t* userspace_address, uint32_t value, const struct timespec* abstime, int clockid)
|
|
|
|
|
{
|
|
|
|
|
int op;
|
|
|
|
|
|
|
|
|
|
if (abstime) {
|
|
|
|
|
// NOTE: FUTEX_WAIT takes a relative timeout, so use FUTEX_WAIT_BITSET instead!
|
2021-08-16 23:29:25 +02:00
|
|
|
op = FUTEX_WAIT_BITSET;
|
2021-07-05 14:24:40 +03:00
|
|
|
if (clockid == CLOCK_REALTIME || clockid == CLOCK_REALTIME_COARSE)
|
|
|
|
|
op |= FUTEX_CLOCK_REALTIME;
|
|
|
|
|
} else {
|
2021-08-16 23:29:25 +02:00
|
|
|
op = FUTEX_WAIT;
|
2021-07-05 14:24:40 +03:00
|
|
|
}
|
|
|
|
|
return futex(userspace_address, op, value, abstime, nullptr, FUTEX_BITSET_MATCH_ANY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ALWAYS_INLINE int futex_wake(uint32_t* userspace_address, uint32_t count)
|
|
|
|
|
{
|
2021-08-16 23:29:25 +02:00
|
|
|
return futex(userspace_address, FUTEX_WAKE, count, NULL, NULL, 0);
|
2021-07-05 14:24:40 +03:00
|
|
|
}
|
|
|
|
|
|
2020-01-02 13:37:02 +01:00
|
|
|
int purge(int mode);
|
|
|
|
|
|
2020-02-02 20:28:29 +01:00
|
|
|
int perf_event(int type, uintptr_t arg1, uintptr_t arg2);
|
2021-08-11 20:41:29 +02:00
|
|
|
int perf_register_string(char const* string, size_t string_length);
|
2020-02-02 20:28:29 +01:00
|
|
|
|
2020-03-16 19:06:33 +01:00
|
|
|
int get_stack_bounds(uintptr_t* user_stack_base, size_t* user_stack_size);
|
|
|
|
|
|
2021-01-15 11:28:07 +01:00
|
|
|
int anon_create(size_t size, int options);
|
|
|
|
|
|
2021-02-02 19:48:39 +01:00
|
|
|
int serenity_readlink(const char* path, size_t path_length, char* buffer, size_t buffer_size);
|
|
|
|
|
|
2021-02-05 12:16:30 +01:00
|
|
|
int getkeymap(char* name_buffer, size_t name_buffer_size, uint32_t* map, uint32_t* shift_map, uint32_t* alt_map, uint32_t* altgr_map, uint32_t* shift_altgr_map);
|
|
|
|
|
int setkeymap(const char* name, const uint32_t* map, uint32_t* const shift_map, const uint32_t* alt_map, const uint32_t* altgr_map, const uint32_t* shift_altgr_map);
|
2021-02-03 23:15:13 +01:00
|
|
|
|
2021-03-30 21:18:28 +03:00
|
|
|
uint16_t internet_checksum(const void* ptr, size_t count);
|
|
|
|
|
|
2021-08-08 03:00:17 +04:30
|
|
|
int emuctl(uintptr_t command, uintptr_t arg0, uintptr_t arg1);
|
|
|
|
|
|
2019-11-28 20:59:11 +01:00
|
|
|
__END_DECLS
|