Cleanup and fixing warnings
This commit is contained in:
parent
a0a9f28e25
commit
5ed248c8ec
@ -12,6 +12,8 @@ typedef struct Handle Handle;
|
||||
#define HANDLE_TYPE_FILE 1
|
||||
#define HANDLE_TYPE_CONSOLE 2
|
||||
|
||||
typedef TAILQ_HEAD(HandleQueue, Handle) HandleQueue;
|
||||
|
||||
typedef struct Handle {
|
||||
uint64_t fd; // FD Number
|
||||
uint64_t type; // Type
|
||||
|
@ -8,12 +8,17 @@
|
||||
|
||||
struct Thread;
|
||||
typedef struct Thread Thread;
|
||||
struct Process;
|
||||
typedef struct Process Process;
|
||||
|
||||
#include <sys/semaphore.h>
|
||||
|
||||
#include <machine/pmap.h>
|
||||
#include <machine/thread.h>
|
||||
|
||||
typedef TAILQ_HEAD(ProcessQueue, Process) ProcessQueue;
|
||||
typedef TAILQ_HEAD(ThreadQueue, Thread) ThreadQueue;
|
||||
|
||||
#define SCHED_STATE_NULL 0
|
||||
#define SCHED_STATE_RUNNABLE 1
|
||||
#define SCHED_STATE_RUNNING 2
|
||||
@ -46,18 +51,23 @@ typedef struct Thread {
|
||||
#define PROCESS_HANDLE_SLOTS 128
|
||||
|
||||
typedef struct Process {
|
||||
uint64_t pid;
|
||||
AS *space;
|
||||
uintptr_t ustackNext; // Next user stack
|
||||
uint64_t pid;
|
||||
AS *space;
|
||||
uintptr_t ustackNext; // Next user stack
|
||||
TAILQ_ENTRY(Process) processList;
|
||||
// Process
|
||||
Process *parent;
|
||||
TAILQ_ENTRY(Process) siblingList;
|
||||
ProcessQueue childrenList;
|
||||
ProcessQueue zombieProc;
|
||||
// Threads
|
||||
uint64_t threads;
|
||||
TAILQ_HEAD(ThreadListHead, Thread) threadList;
|
||||
Semaphore zombieSemaphore;
|
||||
TAILQ_HEAD(ZombieQueueHead, Thread) zombieQueue;
|
||||
uint64_t threads;
|
||||
ThreadQueue threadList;
|
||||
Semaphore zombieSemaphore;
|
||||
ThreadQueue zombieQueue;
|
||||
// Handles
|
||||
uint64_t nextFD;
|
||||
TAILQ_HEAD(HandleQHead, Handle) handles[PROCESS_HANDLE_SLOTS];
|
||||
uint64_t nextFD;
|
||||
HandleQueue handles[PROCESS_HANDLE_SLOTS];
|
||||
} Process;
|
||||
|
||||
// Thread functions
|
||||
|
@ -104,7 +104,7 @@ Syscall_Spawn(uint64_t user_path)
|
||||
|
||||
Thread_SetRunnable(thr);
|
||||
|
||||
return 0;
|
||||
return proc->pid;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
|
@ -21,11 +21,11 @@ uint64_t nextThreadID;
|
||||
Thread *curProc;
|
||||
|
||||
// Scheduler Queues
|
||||
TAILQ_HEAD(WaitQueueHead, Thread) waitQueue;
|
||||
TAILQ_HEAD(RunnableQueueHead, Thread) runnableQueue;
|
||||
ThreadQueue waitQueue;
|
||||
ThreadQueue runnableQueue;
|
||||
|
||||
// Process List
|
||||
TAILQ_HEAD(ProcessListHead, Process) processList;
|
||||
ProcessQueue processList;
|
||||
|
||||
Slab processSlab;
|
||||
Slab threadSlab;
|
||||
|
@ -17,8 +17,6 @@ threadEntry(uint64_t arg)
|
||||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
printf("Thread Test\n");
|
||||
OSThreadCreate((uintptr_t)&threadEntry, 2);
|
||||
OSThreadCreate((uintptr_t)&threadEntry, 3);
|
||||
@ -32,5 +30,7 @@ main(int argc, const char *argv[])
|
||||
printf("Result %d\n", result);
|
||||
|
||||
printf("Success!\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user