Sponsored Content
Top Forums Programming waiting for multiple childs - C - waitpid Post 302500870 by Corona688 on Tuesday 1st of March 2011 10:08:00 PM
Old 03-01-2011
You're right, I didn't quite catch that.
 

10 More Discussions You Might Find Interesting

1. Programming

problems with FORK() and WAITPID()

Dear All, I'm trying to write multithreading TCP Daemon which executes external program when new network connection arrives on a socket. After accept() I'm doing fork() for initiating of new child process, in which will be executed external program. After child creation I'm doing fork() again,... (3 Replies)
Discussion started by: Polkovnik
3 Replies

2. Shell Programming and Scripting

How to kill a process and its childs given pid and userid

I need to write a shell script which would take 2 arguments pid , userid. Then it should kill all the child process under it. If a child process is not killed then it should wait for 1 minute and should kill. can anybody give me the idea to write it? (0 Replies)
Discussion started by: nani_g
0 Replies

3. Programming

share file descriptor between childs

#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/wait.h> #include <fcntl.h> #include <signal.h> #include <unistd.h> #include <string.h> #define BUFF_SIZE 256 #define CHILDS 4 #define DATAFILE "Client_Files.txt" void worker(int n);... (3 Replies)
Discussion started by: dlcpereira
3 Replies

4. Programming

forking. sharing global data in childs

hi, i want to write a code for forking 3 4 child. n wants that every child process one of the account from global account list. i wrote a program for that, but problem is every child is processing every account in list. what can me done to avoid it. attaching code with it #include <stdio.h>... (2 Replies)
Discussion started by: anup13
2 Replies

5. Programming

Need help with fork, forking multiple childs and shared memory

Hi all, I m writing an application, where i need to fork multiple childs and those child should handle particular task given to them. More descriptive. For example, suppose i have 4 Network, each network has multiple nodes. Now on the basis of network child should be forked and these child... (8 Replies)
Discussion started by: helpmeforlinux
8 Replies

6. Shell Programming and Scripting

Executing multiple processes without waiting for their exit status.

Hello Friends, Hope you are doing well. I just need a help in executing multiple processes. I've written a shell script which calls another scritps. But the problem is there are too many processes to run, and each process takes about a min to finish its execution. So, I want to just... (3 Replies)
Discussion started by: singh.chandan18
3 Replies

7. Programming

How Can I share a socket between childs?

Hello guys! I had seen some posts at this forum talking about my problem, but maybe my scenario is a little different, and I want other solutions. I saw users of this forums saying that the way to shared sockets is using UNIX Sockets, but this is the only way in my scenario? My Scenario:... (4 Replies)
Discussion started by: serpens11
4 Replies

8. Programming

[C]Fork and waitpid

Hi folks, I am writing a simple program to understand how fork() and waitpid works, but it doesn't seem that is working like I wanted. if(fork()==0){ //el hijo pid1=getpid(); printf("\nSoy el hijo %d",pid1); }else { //el padre if (fork()==0) { //el hijo pid2=getpid();... (2 Replies)
Discussion started by: lamachejo
2 Replies

9. Programming

waitpid and grandchildren

I'm attempting to write a daemon that will start, stop, and monitor processes across a network of servers, meaning that a daemon would start on each server, attempt to connect to siblings at regular intervals (if there are unconnected siblings), and start services as remote dependencies are... (3 Replies)
Discussion started by: kshots
3 Replies

10. Programming

Pipe between Childs

Hey guys, I have to make a C program that simulates this command : cat (files here) | sort > file.txt So, I start and create a pipe. Then create the first child. This first child will execute the Cat through the pipe. Then create a second child that will execute sort, with input from... (4 Replies)
Discussion started by: Poppo
4 Replies
catch(n)						       Tcl Built-In Commands							  catch(n)

__________________________________________________________________________________________________________________________________________________

NAME
       catch - Evaluate script and trap exceptional returns

SYNOPSIS
       catch script ?resultVarName? ?optionsVarName?
_________________________________________________________________

DESCRIPTION
       The  catch  command may be used to prevent errors from aborting command interpretation.	The catch command calls the Tcl interpreter recur-
       sively to execute script, and always returns without raising an error, regardless of any errors that might occur while executing script.

       If script raises an error, catch will return a non-zero integer value corresponding to the exceptional return code returned  by	evaluation
       of  script.  Tcl defines the normal return code from script evaluation to be zero (0), or TCL_OK.  Tcl also defines four exceptional return
       codes: 1 (TCL_ERROR), 2 (TCL_RETURN), 3 (TCL_BREAK), and 4 (TCL_CONTINUE).  Errors during evaluation of a script are indicated by a  return
       code of TCL_ERROR.  The other exceptional return codes are returned by the return, break, and continue commands and in other special situa-
       tions as documented.  Tcl packages can define new commands that return other integer values as return codes as well, and scripts that  make
       use of the return -code command can also have return codes other than the five defined by Tcl.

       If  the	resultVarName  argument  is given, then the variable it names is set to the result of the script evaluation.  When the return code
       from the script is 1 (TCL_ERROR), the value stored in resultVarName is an error message.  When  the  return  code  from	the  script  is  0
       (TCL_OK), the value stored in resultVarName is the value returned from script.

       If  the	optionsVarName	argument  is  given, then the variable it names is set to a dictionary of return options returned by evaluation of |
       script.	Tcl specifies two entries that are always defined in the dictionary: -code and -level.	When the return code  from  evaluation	of |
       script  is  not	TCL_RETURN, the value of the -level entry will be 0, and the value of the -code entry will be the same as the return code. |
       Only when the return code is TCL_RETURN will the values of the -level and -code entries be something else, as further described in the doc- |
       umentation for the return command.													   |

       When  the  return  code	from  evaluation  of script is TCL_ERROR, three additional entries are defined in the dictionary of return options |
       stored in optionsVarName: -errorinfo, -errorcode, and -errorline.  The value of the -errorinfo entry is a formatted stack trace	containing |
       more  information  about the context in which the error happened.  The formatted stack trace is meant to be read by a person.  The value of |
       the -errorcode entry is additional information about the error stored as a list.  The -errorcode value is meant to be further processed	by |
       programs,  and may not be particularly readable by people.  The value of the -errorline entry is an integer indicating which line of script |
       was being evaluated when the error occurred.  The values of the -errorinfo and -errorcode entries of the most recent error are also  avail- |
       able as values of the global variables ::errorInfo and ::errorCode respectively. 							   |

       Tcl packages may provide commands that set other entries in the dictionary of return options, and the return command may be used by scripts |
       to set return options in addition to those defined above.

EXAMPLES
       The catch command may be used in an if to branch based on the success of a script.
	      if { [catch {open $someFile w} fid] } {
		  puts stderr "Could not open $someFile for writing
$fid"
		  exit 1
	      }

       There are more complex examples of catch usage in the documentation for the return command.

SEE ALSO
       break(n), continue(n), dict(n), error(n), return(n), tclvars(n)

KEYWORDS
       catch, error

Tcl									8.5								  catch(n)
All times are GMT -4. The time now is 09:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy