You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Steps to reproduce. Include the #includes that wait() requires:
#include <sys/types.h>
#include <sys/wait.h>
I found resource.h using
ls -l /usr/include/bits
However it looks like it is "sticky"
(there are some other suspicious zero length files in there too e.g. user.h)
Switching to root. rm-ing and touch-ing resource.h 'fixes' the original problem.
i.e. We can now compile and run the following example -
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
pid_t childid;
void child() {
// ______ Make the alarm go in 1 second
alarm(1);
sleep(2);
puts("I'm the child exiting normally");
exit(0);
}
void parent() {
int status;
waitpid(childid, &status, 0);
if(WIFSIGNALED (status)) {
printf("Child exited due to signal %d\n", WTERMSIG(status));
if(WTERMSIG (status) == SIGALRM)
puts("ALARM CLOCK");
}else
if( WIFEXITED(status)) {
printf("Child exited with %d\n", WEXITSTATUS(status));
}
}
int main() {
printf("Hello world!\n");
childid = fork ();
if(childid >0) parent();
else if(childid == 0) child();
else puts ("fork failed"); // print error
return 0;
}
The text was updated successfully, but these errors were encountered:
Short term workaround suggestion: temporary scriptable fixes/hacks (e.g. su/rm/touch) can be added to the bootup java script easier than maintaining the linux disk image.
(Also would also be useful to make changes to the disk image more repeatable i.e. repeatable buildscript/patch listing that can be applied to vanilla jor1k image)
Steps to reproduce. Include the #includes that wait() requires:
I found resource.h using
ls -l /usr/include/bits
However it looks like it is "sticky"
(there are some other suspicious zero length files in there too e.g. user.h)
Switching to root. rm-ing and touch-ing resource.h 'fixes' the original problem.
i.e. We can now compile and run the following example -
The text was updated successfully, but these errors were encountered: