[SOLVED] shell 1.

$25

File Name: shell_1._.zip
File Size: 84.78 KB

5/5 - (1 vote)

1.
CGMSHGMU Shellshell GMSH/ Unix Unix-IOCh88.48.510.3

2.
shell ShellShell Shell shell

Shell shell shell shell

Shell

2.0
Shell logging.clogging.h IDpidcmd

2.1
shell
log_prompt

Shell 10050

fgets n exec / usr / bin / ls n / usr / bin / ls

strtok
2.2
ShellShell shell shell

shellviwc
/ bin / sleep/ bin / ls/ bin / pwd
/ bin / wc/bin/wc > /bin/ls ./test -l
total 8
-rw-rr. 1 yzhong itefacstaff 32 Nov 17 23:36 temp.txt
-rw-rr. 1 yzhong itefacstaff 2512 Nov 17 23:37 trivial.txt
Foreground Job 16952:/bin/ls ./test -l Terminated Normally
GMSH>> /bin/ls ./test -l &
Background Job 17767:/bin/ls ./test -l & Started
GMSH>> total 8
-rw-rr. 1 yzhong itefacstaff 32 Nov 17 23:36 temp.txt
-rw-rr. 1 yzhong itefacstaff 2512 Nov 17 23:37 trivial.txt
Background Job 17767:/bin/ls ./test -l & Terminated Normally

2.3 Shell

(help)
log_help
(quit)shell
log_quitShell
fg / bg / jobs / kill

Example Runs:
GMSH>> help
Welcome to GMSH (GMU Shell)!
Built-in Commands: fg, bg, jobs, kill, quit, help.
kill -SIGNAL PID
fg [JOBID]
bg JOBID
GMSH>> quit
Thanks for using GMSH! Good-bye!
zeus-2:~/

2.4
Shell01 0
IDID 1ID 1ID
ID0ID
IDID

IDID
IDID

log_job_numbernum_jobs
log_job_detailsjob_idpidstatecmdIDID
ID
oSIGCHLDwaitpidWIFEXITEDWIFSTOPPEDWIFSIGNALEDWIFCONTINUEUE
sigaction

Example Runs:
GMSH>> /bin/sleep 100 &
Background Job 1168:/bin/sleep 100 & Started
GMSH>> /bin/sleep 10 &
Background Job 1184:/bin/sleep 10 & Started
GMSH>> /bin/sleep 200 &
Background Job 1189:/bin/sleep 200 & Started
GMSH>> jobs
=====3 Jobs=====
1: 1168: Running /bin/sleep 100 &
2: 1184: Running /bin/sleep 10 &
3: 1189: Running /bin/sleep 200 &
GMSH>> Background Job 1184:/bin/sleep 10 & Terminated Normally
GMSH>> jobs
=====2 Jobs=====
1: 1168: Running /bin/sleep 100 &
3: 1189: Running /bin/sleep 200 &
GMSH>> /bin/sleep 400 &
Background Job 1210:/bin/sleep 400 & Started
GMSH>> jobs
=====3 Jobs=====
1: 1168: Running /bin/sleep 100 &
3: 1189: Running /bin/sleep 200 &
4: 1210: Running /bin/sleep 400 &

kill -SIGNAL PIDSIGNALPID
log_kill_errorpidsig
kill

Example Runs:
GMSH>> jobs
=====1 jobs=====
1: 30388: Running /bin/sleep 200 &
GMSH>> kill -19 30388
GMSH>> Background Job 30388:/bin/sleep 200 & Stopped
GMSH>> jobs
=====1 jobs=====
1: 30388: Stopped /bin/sleep 200 &

fg [JOBID] JOBIDID JOBID

og_job_fgpidcmd
log_no_bg_error
IDlog_fg_notfound_errorjob_id
log_job_fg_failint pidchar * cmd
kill

Example Runs:
GMSH>> /bin/sleep 10 &
Background Job 9746:/bin/sleep 10 & Started
GMSH>> jobs
=====1 Jobs=====
1: 9746: Running /bin/sleep 10 &
GMSH>> fg
Background Job 9746:/bin/sleep 10 & Moved to Foreground
Foreground Job 9746:/bin/sleep 10 & Terminated Normally
GMSH>> GMSH>> jobs
=====0 jobs=====

GMSH>> jobs
=====2 Jobs=====
1: 10862: Running /bin/sleep 100 &
2: 11693: Running /bin/sleep 300 &
GMSH>> fg 1
Background Job 10862:/bin/sleep 100 & Moved to Foreground
Foreground Job 10862:/bin/sleep 100 & Terminated Normally
GMSH>> jobs
=====1 Jobs=====
2: 11693: Running /bin/sleep 300 &

bg JOBIDshellJOBID JOBID

og_job_bgpidcmdbg
IDlog_bg_notfound_errorjob_id
log_job_bg_failint pidchar * cmd
kill

Example Runs:
GMSH>> jobs
=====1 Jobs=====
1: 20979: Stopped /bin/sleep 200 &
GMSH>> bg 1
Command bg applied to 20979:/bin/sleep 200 &
GMSH>> Background Job 20979:/bin/sleep 200 & Continued
GMSH>> jobs
=====1 Jobs=====
1: 20979: Running /bin/sleep 200 &

Shell

2.5
Shell Shell
setpgidID
sigaction
Shellkill/

Ctrl-cSIGINT2
Ctrl-zSIGTSTP20

Example Runs:
GMSH>> /bin/sleep 200
^CForeground Job 1340:/bin/sleep 200 Terminated by Signal
GMSH>> jobs
=====0 jobs=====
GMSH>> /bin/sleep 200
^ZForeground Job 1438:/bin/sleep 200 Stopped
GMSH>> jobs
=====1 jobs=====
1: 1438: Stopped /bin/sleep 200
GMSH>>

2.6
//
log_file_open_errorfile_name /

open
open// 0600open

2.7

ID pidcmd

SIGCHLDSIGINTSIGTSTP
sigaction signalsigaction sigaction sigaction
stdio STDOUT_FILENOusewrite logging.clog_job_fg_term

2.8
Shell
1. shell
2.SIGCHLD
3. SIGCHLD
4.
forkSIGCHLD sigprocmask execlexecv

3.
project3_handout.tar Zeustar xvf project3_handout.tarp3_handout
shell.c
shell.h
logging.c
logging.h logging.c
sigaction_example.c sigaction
Makefile

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] shell 1.
$25