jobout.c
来自「作业调度程序」· C语言 代码 · 共 46 行
C
46 行
#include <unistd.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/ipc.h>#include <fcntl.h>#include "job.h"/* * command syntax * deq jid */void usage(){ printf("Usage: jobout jid\n" "\tjid\t\t the job id\n");}int main(int argc,char *argv[]){ struct jobcmd deqcmd; int fd; if (argc != 2) { usage(); return 1; } deqcmd.type = DEQ; deqcmd.defpri = 0; deqcmd.owner = getuid(); deqcmd.argnum = 1; strcpy(deqcmd.data,*++argv); printf("jid %s\n",deqcmd.data); if ((fd = open("/tmp/server",O_WRONLY)) < 0) error_sys("jobout open fifo failed"); if (write(fd,&deqcmd,DATALEN)< 0) error_sys("jobout write failed"); close(fd); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?