Sponsored Content
Top Forums Programming parent not waiting until child complete executing another program through execl() Post 302195881 by gautamdheeraj on Friday 16th of May 2008 06:00:39 AM
Old 05-16-2008
This should work. You should check for read() > 0 instead of !=0.

Code:
while( (rv = read(fd2[0], line, MAXLINE)) > 0)

Usually for any file, socket, pipe and any other stream read, we should always read in a loop and check for various conditions.

- Dheeraj
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

what are parent and child processes all about?

I don't follow what these are... this is what my text says... "When a process is started, a duplicate of that process is created. This new process is called the child and the process that created it is called the parent. The child process then replaces the copy for the code the parent... (1 Reply)
Discussion started by: xyyz
1 Replies

2. Programming

shared memory between parent and child, when execl()

Hi, Am new to Linux internals. I want to use shared memory segment between the parent and the child processess. if i create a shared memory before fork,the child inherits the attached shared memory segments but once i call exec in the child process, all attached shared memory segments... (1 Reply)
Discussion started by: rvan
1 Replies

3. Shell Programming and Scripting

parent shell is waiting upon the child shell

Hi, I haev to devlop a script which when executed will take in a sudo privelege and run a set of commands then will go back to parent shell and execute the rest of the command But the problem I am facing is that when the script is executed it takes the sudo privelege but it waits for the... (0 Replies)
Discussion started by: ruchirmayank
0 Replies

4. Solaris

Timed out waiting for Autonegotiation to complete

Received the Timed out message consistently when I tried to jumpstart an M5000 with: boot jsnet:speed=1000,duplex=full - install Made the error go away by adding link-clock parameter: boot jsnet:speed=1000,duplex=full,link-clock=master - install "link-clock=master" disables... (1 Reply)
Discussion started by: markoakley
1 Replies

5. Homework & Coursework Questions

Need help with deleting childīs parent and child subprocess

1. The problem statement, all variables and given/known data: I need to make an program that in a loop creates one parent and five children with fork(). The problem i'm trying to solve is how to delete the parent and child of the childīs process. 2. Relevant commands, code, scripts,... (0 Replies)
Discussion started by: WhiteFace
0 Replies

6. Shell Programming and Scripting

forking a child process and kill its parent to show that child process has init() as its parent

Hi everyone i am very new to linux , working on bash shell. I am trying to solve the given problem 1. Create a process and then create children using fork 2. Check the Status of the application for successful running. 3. Kill all the process(threads) except parent and first child... (2 Replies)
Discussion started by: vizz_k
2 Replies

7. Windows & DOS: Issues & Discussions

AutoSys Job not waiting for script to complete

I'm not sure if this is the right place to post this issue...but here goes... I am converting a set of windows jobs from Control-M to AutoSys r11.3. The same command line is being executed in both systems. The Control-M job runs to compltion in about 1.5 hours, waiting for the entire batch... (3 Replies)
Discussion started by: ajomarquez
3 Replies

8. Shell Programming and Scripting

Waiting for a process to complete in shell script

Hi, I need to initiate a process script which will start and do some processing and then shuts down. Then i need to other verifications. But the the process takes around 25 to 3o minutes. One thing i can monitor the nohup.out file for this process where i can wait for shutting down statement to... (3 Replies)
Discussion started by: Prashanth19
3 Replies

9. Homework & Coursework Questions

Help with Execl system call in a C program?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: "Your a7.c program should use printf to print a nice message. (You can decide what to say.) Then the process... (9 Replies)
Discussion started by: miniviking10
9 Replies

10. Shell Programming and Scripting

Subprocess.popen() should write to log without waiting for process to complete

Here is my test code process = sp.Popen( + , bufsize=1, universal_newlines=True, stdout=sp.PIPE, stderr=sp.STDOUT, cwd=src_home) output, _ =... (2 Replies)
Discussion started by: ezee
2 Replies
sockatmark(3N)															    sockatmark(3N)

NAME
sockatmark() - determine whether a socket is at the out-of-band mark SYNOPSIS
DESCRIPTION
The function determines whether the socket specified by the descriptor is at the out-of-band data mark. If the protocol for the socket supports out-of-band data by marking the stream with an out-of-band mark, the function returns 1 when all data preceding the mark has been read and the out-of-band mark is the first element in the receive queue. The function does not remove the mark from the stream. X/Open Sockets Only is new in RETURN VALUES
Upon successful completion, the function returns a value indicating whether the socket is at an out-of-band data mark: If the protocol has marked the data stream and all data preceding the mark has been read. If there is no mark, or if data precedes the mark in the receive queue. On failure, returns and sets to indicate the error. ERRORS
If fails, is set to one of the following values: The argument is not a valid file descriptor. The argument does not specify a descriptor for a socket. APPLICATION USAGE
The use of this function between receive operations allows an application to determine which received data precedes the out-of-band data and which follows the out-of-band data. There is an inherent race condition in the use of this function. On an empty receive queue, the current read of the location might be at the "mark". However, the system has no way of knowing that the next data segment arriving from the network is carrying the mark. Then returns false, and the next read operation silently consumes the mark. Hence, this function can only be used reliably in one or both ways: o when the application already knows that the out-of-band data has been seen by the system o and that it knows data is waiting to be read at the socket (by using or AUTHOR
was developed by HP and IEEE. SEE ALSO
ioctl(2), pselect(2), recv(2), recvmsg(2), socket(7). STANDARDS CONFORMANCE
sockatmark(3N)
All times are GMT -4. The time now is 05:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy