1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 13:55:00 +00:00

Kernel: Get rid of the "cool globals" thingy.

This was something I used while debugging with Computron. I haven't needed
it for months, so let's get rid of it. It's trivial to readd if needed.
This commit is contained in:
Andreas Kling 2019-04-21 12:33:14 +02:00
parent 84f96c393c
commit a9d09e9020
3 changed files with 5 additions and 28 deletions

View file

@ -27,7 +27,6 @@
//#define TASK_DEBUG //#define TASK_DEBUG
//#define FORK_DEBUG //#define FORK_DEBUG
#define SIGNAL_DEBUG #define SIGNAL_DEBUG
#define MAX_PROCESS_GIDS 32
//#define SHARED_BUFFER_DEBUG //#define SHARED_BUFFER_DEBUG
static pid_t next_pid; static pid_t next_pid;
@ -35,13 +34,8 @@ InlineLinkedList<Process>* g_processes;
static String* s_hostname; static String* s_hostname;
static Lock* s_hostname_lock; static Lock* s_hostname_lock;
CoolGlobals* g_cool_globals;
void Process::initialize() void Process::initialize()
{ {
#ifdef COOL_GLOBALS
g_cool_globals = reinterpret_cast<CoolGlobals*>(0x1000);
#endif
next_pid = 0; next_pid = 0;
g_processes = new InlineLinkedList<Process>; g_processes = new InlineLinkedList<Process>;
s_hostname = new String("courage"); s_hostname = new String("courage");
@ -1612,7 +1606,6 @@ int Process::sys$getgroups(ssize_t count, gid_t* gids)
{ {
if (count < 0) if (count < 0)
return -EINVAL; return -EINVAL;
ASSERT(m_gids.size() < MAX_PROCESS_GIDS);
if (!count) if (!count)
return m_gids.size(); return m_gids.size();
if (count != (int)m_gids.size()) if (count != (int)m_gids.size())
@ -1631,8 +1624,6 @@ int Process::sys$setgroups(ssize_t count, const gid_t* gids)
return -EINVAL; return -EINVAL;
if (!is_superuser()) if (!is_superuser())
return -EPERM; return -EPERM;
if (count >= MAX_PROCESS_GIDS)
return -EINVAL;
if (!validate_read(gids, count)) if (!validate_read(gids, count))
return -EFAULT; return -EFAULT;
m_gids.clear(); m_gids.clear();

View file

@ -1,15 +1,16 @@
#pragma once #pragma once
#include <AK/Types.h> #include <AK/Types.h>
#include <Kernel/TTY/TTY.h>
#include "Syscall.h"
#include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/UnixTypes.h>
#include <AK/InlineLinkedList.h> #include <AK/InlineLinkedList.h>
#include <AK/AKString.h> #include <AK/AKString.h>
#include <AK/Vector.h> #include <AK/Vector.h>
#include <AK/WeakPtr.h> #include <AK/WeakPtr.h>
#include <AK/Weakable.h> #include <AK/Weakable.h>
#include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/TTY/TTY.h>
#include <Kernel/Syscall.h>
#include <Kernel/UnixTypes.h>
#include <Kernel/Thread.h> #include <Kernel/Thread.h>
#include <Kernel/Lock.h> #include <Kernel/Lock.h>
@ -17,17 +18,6 @@ class FileDescriptor;
class PageDirectory; class PageDirectory;
class Region; class Region;
class VMObject; class VMObject;
class Zone;
class WSWindow;
class GraphicsBitmap;
#define COOL_GLOBALS
#ifdef COOL_GLOBALS
struct CoolGlobals {
pid_t current_pid;
};
extern CoolGlobals* g_cool_globals;
#endif
void kgettimeofday(timeval&); void kgettimeofday(timeval&);

View file

@ -321,10 +321,6 @@ bool Scheduler::context_switch(Thread& thread)
current = &thread; current = &thread;
thread.set_state(Thread::Running); thread.set_state(Thread::Running);
#ifdef COOL_GLOBALS
g_cool_globals->current_pid = thread.process().pid();
#endif
if (!thread.selector()) { if (!thread.selector()) {
thread.set_selector(gdt_alloc_entry()); thread.set_selector(gdt_alloc_entry());
auto& descriptor = get_gdt_entry(thread.selector()); auto& descriptor = get_gdt_entry(thread.selector());