Skip to content

Commit 6426849

Browse files
authored
int -> process_state_t (#300)
1 parent c70fe65 commit 6426849

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

kernel/process.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ void process_launch(struct process *p)
242242
list_push_tail(&ready_list, &p->node);
243243
}
244244

245-
static void process_switch(int newstate)
245+
static void process_switch( process_state_t newstate )
246246
{
247247
interrupt_block();
248248

kernel/process.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ See the file LICENSE for details.
1515
#include "x86.h"
1616
#include "fs.h"
1717

18-
#define PROCESS_STATE_CRADLE 0
19-
#define PROCESS_STATE_READY 1
20-
#define PROCESS_STATE_RUNNING 2
21-
#define PROCESS_STATE_BLOCKED 3
22-
#define PROCESS_STATE_GRAVE 4
18+
typedef enum {
19+
PROCESS_STATE_CRADLE,
20+
PROCESS_STATE_READY,
21+
PROCESS_STATE_RUNNING,
22+
PROCESS_STATE_BLOCKED,
23+
PROCESS_STATE_GRAVE,
24+
} process_state_t;
2325

2426
#define PROCESS_MAX_OBJECTS 32
2527
#define PROCESS_MAX_PID 1024
@@ -29,7 +31,7 @@ See the file LICENSE for details.
2931

3032
struct process {
3133
struct list_node node;
32-
int state;
34+
process_state_t state;
3335
int exitcode;
3436
int exitreason;
3537
struct pagetable *pagetable;

0 commit comments

Comments
 (0)