Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-14-2007, 01:59 AM
dayrinni dayrinni is offline
Newbie
 
Join Date: Sep 2007
Posts: 1
Rep Power: 0
dayrinni is on a distinguished road
Default Job Control in a Shell

Hi,
I am writing a C shell for one of my classes. We are tasked to implement job control. I am not entirely sure on how to do this so I come here for some questions regarding the logic in handling this.

Essentially, I think it should work as follows:

When a fork occurs for a command, we will install the signal handlers to allow the correct actions for CTRL-Z and CTRL-C as we need to overwrite the current ones in the shell so we can't use those functions (You can't CTRL-C/Z your own shell). Then, we will set the setpgid of the new forked process and save this in the shell with getpgid (parent process). If the new child process is part of a pipeline, we shall continue calling setpgid on each process so that it is the current process.

In terms of doing the CTRL-Z and CTRL-C aspect, we will be able to refer to the currently controlled process because we saved the getpgid value in our data structure. This will allow us to send the SIGTSTP or SIGINT to the correct process during it's time through the pipeline. Then we can restore any stopped process with the SIGCONT signal.

Is the above correct in the thought process and general implementation?

Thanks for any help you can provide.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Printer control through Parallel fargo_182 General Programming 0 09-04-2007 11:58 PM
Custom Control McMillan0520 C# Programming 0 08-08-2007 11:12 AM
[PHP] Faking Shell Access Through PHP pranky PHP Tutorials 2 03-29-2007 07:28 AM
Standards without control? martinig General Programming 3 01-18-2007 10:57 AM


All times are GMT -5. The time now is 03:51 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%

Ads