salut,
i-am adus io modificari. (man wait)
#include <stdio.h>
#include <pty.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
void sigchld_handler(int chld)
{
while(waitpid(-1, &chld, WNOHANG) > 0 );
}
int main()
{
int master, pid;
signal(SIGCHLD, sigchld_handler);
if ((pid=forkpty(&master, NULL, NULL, NULL))==-1) {
perror("forkpty()");
}
if (!pid) {
sleep(1); return 0;
} else sleep(2);
close(master);
printf("asta e\n");
getchar();
return 0;
}
On Thu, 11 Apr 2002, Bogdan HARJOC wrote:
>
>
> buna
>
> poate cineva sa-mi raspunda altfel decat prin "rtfm" la intrebarea "de
> ce, dupa ce creez un proces si ii aloc un terminal cu forkpty(), atunci
> cand ma intorc din el, ramane ca <defunct>, pana la terminarea
> procesului initial ?" ?
>
> libutil, glibc sunt cele din slackware 8.0, si cam asa arata
> programelul:
>
> #include <stdio.h>
> #include <pty.h>
> #include <unistd.h>
>
> int main()
> {
> int master, pid;
>
> if ((pid=forkpty(&master, NULL, NULL, NULL))==-1) {
> perror("forkpty()");
> }
> if (!pid) {
> sleep(1); return 0;
> } else sleep(2);
> close(master);
> printf("asta e\n");
> getchar();
> return 0;
> }
>
> /*
> * orice remarca e binevenita
> * bogdan
> */
>
>
> ---
> <a href="mailto:[EMAIL PROTECTED]?Subject=unsubscribe%20rlug">unsubscribe</a>
>
> REGULI, arhive si alte informatii: http://www.lug.ro/mlist/
>
>
----
Besides, I think Slackware sounds better than 'Microsoft', don't you?
-- Patrick Volkerding
---
<a href="mailto:[EMAIL PROTECTED]?Subject=unsubscribe%20rlug">unsubscribe</a>
REGULI, arhive si alte informatii: http://www.lug.ro/mlist/