pause(), wait() and infinity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Good times.
Look at the code. What do you think will be the result?

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

void trap1(int sig)
{
	fprintf(stderr, "signal\n");
}
int main()
{
	int stat;

	signal(SIGUSR1, trap1);
	if (fork()) {
		pause();
		wait(&stat);
		exit(0);
	}
	kill(getppid(), SIGUSR1);
	exit(0);
}

Both processes must be completed.
The result is that the parent process sleeps.

./test
signal
(zzzzzz)

At a different operating system, everything works as expected
(tested on OpenBSD 4.6/hppa, OpenBSD/sparc64)

I would like to know what you think about this.

-- 
Regards,
Denis

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux