aboutsummaryrefslogtreecommitdiff
path: root/include/job.h
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-08-31 07:38:14 +0000
committer_ov4 <ov4@ov4.org>2026-08-31 07:38:14 +0000
commit0e460c391c093f1eb074d3192c60d37fa425d48d (patch)
treeb2001ca54ef31abab8f2b951ffc6254467f17fe8 /include/job.h
parent11fa05b52caf991277ffe89690fe98819a40a84e (diff)
fix
Diffstat (limited to 'include/job.h')
-rw-r--r--include/job.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/include/job.h b/include/job.h
index e94bda6..293feb7 100644
--- a/include/job.h
+++ b/include/job.h
@@ -15,17 +15,31 @@
#define MAXJOBS 16 /* max jobs at any point in time */
#define MAXJID 1<<16 /* max job ID */
-#define UNDEF 0 /* undefined */
-#define FG 1 /* running in foreground */
-#define BG 2 /* running in background */
-#define ST 3 /* stopped */
-
namespace ov4
{
extern struct job_t jobs[];
extern int nextjid;
+
+
+/*
+ * Jobs states: FG (foreground), BG (background), ST (stopped)
+ * Job state transitions and enabling actions:
+ * FG -> ST : ctrl-z
+ * ST -> FG : fg command
+ * ST -> BG : bg command
+ * BG -> FG : fg command
+ * At most 1 job can be in the FG state.
+ */
+
+enum job_status
+{
+ UNDEF,
+ FG,
+ BG,
+ ST
+};
struct job_t { /* The job struct */
pid_t pid; /* job PID */