-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfg.c
More file actions
39 lines (33 loc) · 702 Bytes
/
fg.c
File metadata and controls
39 lines (33 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include"global.h"
void call_fg(char **karsh)
{
printf("fg\n");
int num;
sscanf(karsh[1],"%d",&num);
if(num>size)
{
fprintf(stderr,"Error: Given job number does not exist\n");
return;
}
int pg,status;
pg = runn_proc[num-1].pid;
printf("%d\n",pg);
if(pg!=-1)
{
printf("%s",runn_proc[num-1].proc_name);
printf("\n");
kill(pg, SIGCONT);
strcpy(curr_fg_proc_name,runn_proc[num-1].proc_name);
curr_fg_pid = pg;
ctrl_c_cond=1;
ctrl_z_cond=1;
waitpid(pg, &status, WUNTRACED);
int ss=0;
ss++;
ctrl_c_cond=0;
ctrl_z_cond=0;
}
else
{ fprintf(stderr,"Error: Given job number does not exist\n");
}
}