⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 job.h

📁 实现一个多进程的作业控制系统
💻 H
字号:
#ifndef JOB_H#define JOB_H#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <stdarg.h>#include <signal.h>#include <sys/types.h>#ifndef DEBUG #define DEBUG#endif#undef DEBUG#define BUFLEN 100#define GLOBALFILE "screendump"enum jobstate {  READY, RUNNING, DONE};enum cmdtype {  ENQ = -1, DEQ = -2, STAT = -3};/* this is data passed in fifo */struct jobcmd {  enum cmdtype type;  int argnum;  int owner;  int defpri;  char data[BUFLEN];};#define DATALEN sizeof(struct jobcmd)struct jobinfo {  int    jid;                 /* job id */  int    pid;                 /* process id */  char** cmdarg;              /* the command & args to execute */  int    defpri;              /* default priority */  int    curpri;              /* current priority */  int    ownerid;             /* the job owner id */  int    wait_time;           /* the time job in waitqueue */  time_t create_time;         /* the time job create */  int    run_time;            /* the time job running */  enum   jobstate state;      /* job state */};struct waitqueue {            /* double link list */  struct waitqueue *next;  struct jobinfo *job;};void schedule();void sig_handler(int sig,siginfo_t *info,void *notused);int  allocjid();void add_queue(struct jobinfo *job);void del_queue(struct jobinfo *job);void do_enq(struct jobinfo *newjob,struct jobcmd enqcmd);void do_deq(struct jobcmd deqcmd);void do_stat(struct jobcmd statcmd);void updateall();struct waitqueue* jobselect();void jobswitch();void error_doit(int errnoflag,const char *fmt,va_list ap);void error_sys(const char *fmt,...);void error_msg(const char *fmt,...);void error_quit(const char *fmt,...);#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -