Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 10th, 2003, 12:54 AM
Registered User
 
Join Date: Sep 2003
Location: , MI, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ohwail
Default Placing processes in the background

Hey there!

    I am new to this forum so bear with me. I am trying to write my own shell for Linux, and so using C I was able to write one which basicly reads in a command with arguments and executes it, however I want to make my shell to automaticlly run processes in the bakground everytime, which should return me to command line everytime I enter a command and not wait for it to be finished. I looked at the different exe() syscalls and didnt see one that will take as an argument and indicator that a particular process should be run in the background. Any pointers here would be helpfull.


Reply With Quote
  #2 (permalink)  
Old September 10th, 2003, 01:05 AM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Maybe you should use fork() to launch a separate child process, and that child process would then exec() your command.


Take care,

Nik
http://www.bigaction.org/
Reply With Quote
  #3 (permalink)  
Old September 10th, 2003, 11:47 AM
Registered User
 
Join Date: Sep 2003
Location: , MI, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ohwail
Default

Thats the thing I am already using fork() to call a child process to execute my command, but fork() issues a block in which I have to wait until the child is done before control is returned to the parent. I think I need to not include a wait() and trap the signal of the child when its done. Does anyone know how to trap the signal of a terminated child. I am going to palce and example of what I am trying to do. Notice I go back to command prompt after I hit enter and not wait for the grep command to finish executing.

[oci]$ grep back oci.c
[oci]$
[7] 5066
  int i, status, backg, direct;
      backg = 0;
          /*if(!backg)
          backg = 0;
[7] Done grep back oci.c
[oci]$



Reply With Quote
Reply


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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
remote processes gobotsoup ASP.NET 2.0 Basics 1 May 6th, 2007 01:50 PM
Checking Processes AggressiveFish Beginning VB 6 0 September 19th, 2006 01:29 PM
Manipulating Processes ? kush28 C# 1 October 26th, 2005 04:49 AM
processes in php Moharo Pro PHP 1 November 10th, 2003 08:47 AM



All times are GMT -4. The time now is 01:31 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.