None of this actually works, but whatever

This commit is contained in:
Kevin Lange 2013-08-19 19:38:15 -07:00
parent 9b130b916d
commit 922fdd5f38
3 changed files with 15 additions and 0 deletions

View File

@ -78,6 +78,12 @@ uint32_t read_pipe(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *buf
}
#endif
if (pipe->dead) {
debug_print(WARNING, "Pipe is dead?");
send_signal(getpid(), SIGPIPE);
return 0;
}
size_t collected = 0;
while (collected == 0) {
spin_lock(&pipe->lock);
@ -116,6 +122,12 @@ uint32_t write_pipe(fs_node_t *node, uint32_t offset, uint32_t size, uint8_t *bu
}
#endif
if (pipe->dead) {
debug_print(WARNING, "Pipe is dead?");
send_signal(getpid(), SIGPIPE);
return 0;
}
size_t written = 0;
while (written < size) {
spin_lock(&pipe->lock);
@ -219,6 +231,7 @@ fs_node_t * make_pipe(size_t size) {
pipe->size = size;
pipe->refcount = 0;
pipe->lock = 0;
pipe->dead = 0;
pipe->wait_queue = list_create();

View File

@ -167,6 +167,7 @@ int pty_ioctl(pty_t * pty, int request, void * argp) {
if (!argp) return -1;
validate(argp);
pty->fg_proc = *(pid_t *)argp;
debug_print(NOTICE, "Setting PTY group to %d", pty->fg_proc);
return 0;
case TIOCGPGRP:
if (!argp) return -1;

View File

@ -16,6 +16,7 @@ typedef struct _pipe_device {
size_t refcount;
uint8_t volatile lock;
list_t * wait_queue;
int dead;
} pipe_device_t;
fs_node_t * make_pipe(size_t size);