alloc pipes

This commit is contained in:
twoneis 2025-04-03 23:07:30 +02:00
parent 4d08c68e78
commit e700ab4b60
2 changed files with 278 additions and 222 deletions

View file

@ -1,4 +1,19 @@
#include <sys/socket.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
// where does this come from?
#define OBJS_PER_SLAB 42
#define PIPE_BUFFER (OBJS_PER_SLAB * 10)
int pipes[PIPE_BUFFER][2];
void alloc_pipes(int[2], int);
int
main(void)
@ -8,6 +23,16 @@ main(void)
printf("main: fopen: %p\n", device);
for (size_t i = 0; i < PIPE_BUFFER; i++) {
alloc_pipes(pipes[i], O_NONBLOCK);
}
fclose(device);
printf("main: done\n");
}
void
alloc_pipes(int fd[2], int flags)
{
pipe2(pipes, flags);
}