mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:57:45 +00:00
Kernel: More PID/TID typing
This commit is contained in:
parent
7bdf54c837
commit
bee08a4b9f
21 changed files with 67 additions and 60 deletions
|
@ -282,7 +282,7 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
|
|||
m_master_tls_size = master_tls_size;
|
||||
m_master_tls_alignment = master_tls_alignment;
|
||||
|
||||
// FIXME: PID/TID BUG
|
||||
// FIXME: PID/TID ISSUE
|
||||
m_pid = new_main_thread->tid().value();
|
||||
new_main_thread->make_thread_specific_region({});
|
||||
new_main_thread->reset_fpu_state();
|
||||
|
|
|
@ -43,7 +43,7 @@ KResult Process::do_kill(Process& process, int signal)
|
|||
return KSuccess;
|
||||
}
|
||||
|
||||
KResult Process::do_killpg(pid_t pgrp, int signal)
|
||||
KResult Process::do_killpg(ProcessGroupID pgrp, int signal)
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
|
||||
|
@ -52,8 +52,7 @@ KResult Process::do_killpg(pid_t pgrp, int signal)
|
|||
// Send the signal to all processes in the given group.
|
||||
if (pgrp == 0) {
|
||||
// Send the signal to our own pgrp.
|
||||
// FIXME: PIF/PGID INCOMPLETE
|
||||
pgrp = pgid().value();
|
||||
pgrp = pgid();
|
||||
}
|
||||
|
||||
bool group_was_empty = true;
|
||||
|
|
|
@ -35,7 +35,7 @@ int Process::sys$yield()
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$donate(int tid)
|
||||
int Process::sys$donate(pid_t tid)
|
||||
{
|
||||
REQUIRE_PROMISE(stdio);
|
||||
if (tid < 0)
|
||||
|
@ -48,7 +48,7 @@ int Process::sys$donate(int tid)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$sched_setparam(int tid, Userspace<const struct sched_param*> user_param)
|
||||
int Process::sys$sched_setparam(int pid, Userspace<const struct sched_param*> user_param)
|
||||
{
|
||||
REQUIRE_PROMISE(proc);
|
||||
if (!validate_read_typed(user_param))
|
||||
|
@ -59,8 +59,8 @@ int Process::sys$sched_setparam(int tid, Userspace<const struct sched_param*> us
|
|||
|
||||
InterruptDisabler disabler;
|
||||
auto* peer = Thread::current();
|
||||
if (tid != 0)
|
||||
peer = Thread::from_tid(tid);
|
||||
if (pid != 0)
|
||||
peer = Thread::from_tid(pid);
|
||||
|
||||
if (!peer)
|
||||
return -ESRCH;
|
||||
|
@ -68,8 +68,7 @@ int Process::sys$sched_setparam(int tid, Userspace<const struct sched_param*> us
|
|||
if (!is_superuser() && m_euid != peer->process().m_uid && m_uid != peer->process().m_uid)
|
||||
return -EPERM;
|
||||
|
||||
if (desired_param.sched_priority < THREAD_PRIORITY_MIN ||
|
||||
desired_param.sched_priority > THREAD_PRIORITY_MAX)
|
||||
if (desired_param.sched_priority < THREAD_PRIORITY_MIN || desired_param.sched_priority > THREAD_PRIORITY_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
peer->set_priority((u32)desired_param.sched_priority);
|
||||
|
@ -84,8 +83,11 @@ int Process::sys$sched_getparam(pid_t pid, Userspace<struct sched_param*> user_p
|
|||
|
||||
InterruptDisabler disabler;
|
||||
auto* peer = Thread::current();
|
||||
if (pid != 0)
|
||||
if (pid != 0) {
|
||||
// FIXME: PID/TID BUG
|
||||
// The entire process is supposed to be affected.
|
||||
peer = Thread::from_tid(pid);
|
||||
}
|
||||
|
||||
if (!peer)
|
||||
return -ESRCH;
|
||||
|
@ -93,12 +95,14 @@ int Process::sys$sched_getparam(pid_t pid, Userspace<struct sched_param*> user_p
|
|||
if (!is_superuser() && m_euid != peer->process().m_uid && m_uid != peer->process().m_uid)
|
||||
return -EPERM;
|
||||
|
||||
struct sched_param param { (int) peer->priority() };
|
||||
struct sched_param param {
|
||||
(int)peer->priority()
|
||||
};
|
||||
copy_to_user(user_param, ¶m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$set_thread_boost(int tid, int amount)
|
||||
int Process::sys$set_thread_boost(pid_t tid, int amount)
|
||||
{
|
||||
REQUIRE_PROMISE(proc);
|
||||
if (amount < 0 || amount > 20)
|
||||
|
|
|
@ -73,7 +73,7 @@ int Process::sys$create_thread(void* (*entry)(void*), Userspace<const Syscall::S
|
|||
// length + 4 to give space for our extra junk at the end
|
||||
StringBuilder builder(m_name.length() + 4);
|
||||
builder.append(m_name);
|
||||
builder.appendf("[%d]", thread->tid());
|
||||
builder.appendf("[%d]", thread->tid().value());
|
||||
thread->set_name(builder.to_string());
|
||||
|
||||
thread->set_priority(requested_thread_priority);
|
||||
|
@ -102,7 +102,7 @@ void Process::sys$exit_thread(void* exit_value)
|
|||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
int Process::sys$detach_thread(int tid)
|
||||
int Process::sys$detach_thread(pid_t tid)
|
||||
{
|
||||
REQUIRE_PROMISE(thread);
|
||||
InterruptDisabler disabler;
|
||||
|
@ -117,7 +117,7 @@ int Process::sys$detach_thread(int tid)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$join_thread(int tid, void** exit_value)
|
||||
int Process::sys$join_thread(pid_t tid, void** exit_value)
|
||||
{
|
||||
REQUIRE_PROMISE(thread);
|
||||
if (exit_value && !validate_write_typed(exit_value))
|
||||
|
@ -169,7 +169,7 @@ int Process::sys$join_thread(int tid, void** exit_value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$set_thread_name(int tid, const char* user_name, size_t user_name_length)
|
||||
int Process::sys$set_thread_name(pid_t tid, const char* user_name, size_t user_name_length)
|
||||
{
|
||||
REQUIRE_PROMISE(thread);
|
||||
auto name = validate_and_copy_string_from_user(user_name, user_name_length);
|
||||
|
@ -188,7 +188,7 @@ int Process::sys$set_thread_name(int tid, const char* user_name, size_t user_nam
|
|||
thread->set_name(name);
|
||||
return 0;
|
||||
}
|
||||
int Process::sys$get_thread_name(int tid, char* buffer, size_t buffer_size)
|
||||
int Process::sys$get_thread_name(pid_t tid, char* buffer, size_t buffer_size)
|
||||
{
|
||||
REQUIRE_PROMISE(thread);
|
||||
if (buffer_size == 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue