Sponsored Content
Full Discussion: pclose returning -1
Top Forums UNIX for Advanced & Expert Users pclose returning -1 Post 302098049 by jim mcnamara on Thursday 30th of November 2006 10:12:06 AM
Old 11-30-2006
The ECHILD errno means that waitid failed. It basically means there are no children to wait for - they have all terminated before the call was made.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

returning value from sqlplus

Hi, I need to return one value from sqlplus to UNIX environment. Can anyone give me an example? i.e. select username from v$session where sid=15; This query will return username value which I require in UNIX after exiting from sqlplus. Malay (1 Reply)
Discussion started by: malaymaru
1 Replies

2. UNIX for Dummies Questions & Answers

FTP not returning CR

Hi all, I have a mainframe file which i am ftping to unix box. even though i have three records in my mainframe file the file on unix is coming as a single record. Can you help me out. Thanks, Hari (3 Replies)
Discussion started by: harikiranr
3 Replies

3. Shell Programming and Scripting

Returning the name of function used

Hi All In my script, I can call on several functions. I have a logging function that is called by any of these functions. What I would like is some way of identifying which function I am using and pass this to the log function as some parameter. Is there some built in command or way of... (3 Replies)
Discussion started by: kingpin2502
3 Replies

4. Red Hat

ps-eo returning wrong value

Hi Need some help, bit of a noobie here. This command work perfectly with unix. returns a value of 1 which is what i want. ps -eo user,comm |grep -v grep |grep -c /path to file When i run the same command on a linux server it returns a value of 0., something maybe wrong with the command.... (4 Replies)
Discussion started by: wneutt
4 Replies

5. UNIX for Advanced & Expert Users

popen and pclose solved

Hi I am trying to use popen function with wrtie option to give inputs to ftp command. #include "stdio.h" int main(int argv ,char *argc) { int size=0; char *buf; FILE *fp; fp = popen("ftp","w"); while(getline(&buf,&size,stdin) != -1) write(fp,buf);... (0 Replies)
Discussion started by: kumaran_5555
0 Replies

6. Programming

how exactly does pclose work in C?

If i have the pointer to the pipe, which is given to pclose, what exactly does pclose do with it? (10 Replies)
Discussion started by: omega666
10 Replies

7. Shell Programming and Scripting

Returning -ve value in a pattern

Dear Friends, I need your help once more. I want to write a simple select as follows select amount from books where sr=1234 However, if value of "Amount" is negative then it should print it as follows. "3000-" and not as "-3000" Can you help me in this? Waiting for reply Anu. (2 Replies)
Discussion started by: anushree.a
2 Replies

8. Shell Programming and Scripting

Script returning 0

hello i write a script which calculate free space but he always is 0 thats wrong with my script? getFileSystemPerformanceData() { if ; then if grep -q "Ubuntu" /etc/issue ; then CMD="df -lP | grep -v "\/home" | grep -v "\/dev/mapper/VolGroup-lv_root"" elif grep... (5 Replies)
Discussion started by: donatas1234
5 Replies

9. UNIX for Dummies Questions & Answers

Not returning from a sub script?

My problem in brief is that I execute a script from another script and I can not pick up the return code from that script, or otherwise I am not returning from that script. I have an echo in the executed script and we get a response code of 0 and exit that script with the return code. I then try to... (1 Reply)
Discussion started by: Charles Swart
1 Replies

10. What is on Your Mind?

Returning to the forum

hey guys, Im back! I hadnt thought about yall in a long time. I was googling away this morning and found a solution I needed from unix.com. good to see yall are still here and going strong! Im working as a Bladelogic Automation Engineer and have been doing HP and BMC server automation... (0 Replies)
Discussion started by: Kelam_Magnus
0 Replies
WAITID(P)						     POSIX Programmer's Manual							 WAITID(P)

NAME
waitid - wait for a child process to change state SYNOPSIS
#include <sys/wait.h> int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options); DESCRIPTION
The waitid() function shall suspend the calling thread until one child of the process containing the calling thread changes state. It records the current state of a child in the structure pointed to by infop. If a child process changed state prior to the call to waitid(), waitid() shall return immediately. If more than one thread is suspended in wait() or waitpid() waiting for termination of the same process, exactly one thread shall return the process status at the time of the target process termination. The idtype and id arguments are used to specify which children waitid() waits for. If idtype is P_PID, waitid() shall wait for the child with a process ID equal to (pid_t)id. If idtype is P_PGID, waitid() shall wait for any child with a process group ID equal to (pid_t)id. If idtype is P_ALL, waitid() shall wait for any children and id is ignored. The options argument is used to specify which state changes waitid() shall wait for. It is formed by OR'ing together one or more of the following flags: WEXITED Wait for processes that have exited. WSTOPPED Status shall be returned for any child that has stopped upon receipt of a signal. WCONTINUED Status shall be returned for any child that was stopped and has been continued. WNOHANG Return immediately if there are no children to wait for. WNOWAIT Keep the process whose status is returned in infop in a waitable state. This shall not affect the state of the process; the process may be waited for again after this call completes. The application shall ensure that the infop argument points to a siginfo_t structure. If waitid() returns because a child process was found that satisfied the conditions indicated by the arguments idtype and options, then the structure pointed to by infop shall be filled in by the system with the status of the process. The si_signo member shall always be equal to SIGCHLD. RETURN VALUE
If WNOHANG was specified and there are no children to wait for, 0 shall be returned. If waitid() returns due to the change of state of one of its children, 0 shall be returned. Otherwise, -1 shall be returned and errno set to indicate the error. ERRORS
The waitid() function shall fail if: ECHILD The calling process has no existing unwaited-for child processes. EINTR The waitid() function was interrupted by a signal. EINVAL An invalid value was specified for options, or idtype and id specify an invalid set of processes. The following sections are informative. EXAMPLES
None. APPLICATION USAGE
None. RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
exec() , exit() , wait() , the Base Definitions volume of IEEE Std 1003.1-2001, <sys/wait.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 WAITID(P)
All times are GMT -4. The time now is 08:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy