#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
//----------------------------------------------------------
int
main (void)
{
pid_t pid_child;
pid_t pid_dead;
int status;
//
pid_child = fork ();
if (pid_child == 0)
{
sleep (1);
}
printf ("Ho avviato il processo %i.\n", pid_child
); //
pid_dead = wait (&status);
//
printf ("Il processo %i si è concluso restituendo " "il valore %x.\n",
pid_dead, WEXITSTATUS (status));
//
return (0);
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDx1bmlzdGQuaD4KI2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8c3lzL3dhaXQuaD4KLy8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCmludAptYWluICh2b2lkKQp7CiAgICBwaWRfdCAgcGlkX2NoaWxkOwogICAgcGlkX3QgIHBpZF9kZWFkOwogICAgaW50ICAgIHN0YXR1czsKICAgIC8vCiAgICBwaWRfY2hpbGQgPSBmb3JrICgpOwogICAgaWYgKHBpZF9jaGlsZCA9PSAwKQogICAgICB7CiAgICAgICAgc2xlZXAgKDEpOwogICAgICAgIHByaW50ZiAoImNpYW8hXG4iKTsKICAgICAgICBleGl0ICg3KTsKICAgICAgfQogICAgcHJpbnRmICgiSG8gYXZ2aWF0byBpbCBwcm9jZXNzbyAlaS5cbiIsIHBpZF9jaGlsZCk7CiAgICAvLwogICAgcGlkX2RlYWQgPSB3YWl0ICgmc3RhdHVzKTsKICAgIC8vCiAgICBwcmludGYgKCJJbCBwcm9jZXNzbyAlaSBzaSDDqCBjb25jbHVzbyByZXN0aXR1ZW5kbyAiCiAgICAgICAgICAgICJpbCB2YWxvcmUgJXguXG4iLAogICAgICAgICAgICBwaWRfZGVhZCwgV0VYSVRTVEFUVVMgKHN0YXR1cykpOwogICAgLy8KICAgIHJldHVybiAoMCk7Cn0=