07955c83c6
* Finally bring syscall.h up to speed and include all syscalls in the syscall module of the C library. * Remove the third-party obfuscated C demos (we have nyancat, good enough) * Fix userspace apps to build without complaining about undeclared strtok_r by disable __STRICT_ANSI__ * Fix .eh_frame by including the proper stuff with libgcc.
32 lines
580 B
C
32 lines
580 B
C
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
|
* pipe test
|
|
*
|
|
* Makes a pipe. Pipes stuff to it. Yeah.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <syscall.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
int main(int argc, char ** argv) {
|
|
int fd = syscall_mkpipe();
|
|
printf("%d <- pipe\n", fd);
|
|
int pid = getpid();
|
|
uint32_t f = fork();
|
|
if (getpid() != pid) {
|
|
char buf[512];
|
|
int r = read(fd, buf, 13);
|
|
printf("[%d] %s\n", r, buf);
|
|
return 0;
|
|
} else {
|
|
char * buf = "Hello world!";
|
|
write(fd, buf, strlen(buf) + 1);
|
|
return 0;
|
|
}
|
|
|
|
return 0;
|
|
}
|