types.h
来自「linux——shell nachos 的课程设计 第一个」· C头文件 代码 · 共 55 行
H
55 行
/* This file define the common structers which used in job control */
#if! defined (__TYPES_H_)
#define __TYPES_H_
#include <glob.h>
#include <sys/types.h>
enum redirection_type {
REDIRECT_READ, REDIRECT_OVERWRITE,
REDIRECT_APPEND, REDIRECT_READWRITE
};
/* Structure describing a redirection. */
struct redirection_specifier
{
enum redirection_type type;
int fd; /* File descriptor */
char *filename; /* File name */
};
/* Each child of the shell is remembered in a STRUCT PROCESS. */
typedef struct process {
pid_t pid; /* Process ID. */
int is_stopped; /* Non-zero if this process is running. */
char **argv; /* The particular program that is running. */
int num_redirections;
struct redirection_specifier *redirections;
glob_t glob_result;
int free_glob;
} PROCESS;
typedef struct job {
int id; /* Job ID. */
int num_progs; /* Number of the programs in this job. */
int running_progs; /* Number of the programs still running in this job. */
pid_t pgrp; /* The process ID of the process group (necessary). */
PROCESS *progs; /* The pipeline of processes that make up this job. */
struct job *next;
int stopped_progs;
char *text;
char *cmd_buf;
} JOB;
/* Chain of the jobs */
typedef struct job_set {
JOB *head; /* The head of the chain. */
JOB *fg; /* The job which currently running in foreground. */
} CHAIN;
extern CHAIN job_list;
#endif /* __TYPES_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?