X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fdrv%2Ffifo.c;h=5d344e5833b605f0995d2688f8b4262209a92827;hb=7d93d587d578835ee64b93c04b2987acc3b59507;hp=f957d2851145295930a102f3c6ea9eede82182ad;hpb=5ebd6360ceccc5b686f84775d6a0f7330ddef768;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/drv/fifo.c b/KernelLand/Kernel/drv/fifo.c index f957d285..5d344e58 100644 --- a/KernelLand/Kernel/drv/fifo.c +++ b/KernelLand/Kernel/drv/fifo.c @@ -280,6 +280,7 @@ size_t FIFO_Read(tVFS_Node *Node, off_t Offset, size_t Length, void *Buffer) // Mark some flags if( pipe->ReadPos == pipe->WritePos ) { + LOG("%i == %i, marking none to read", pipe->ReadPos, pipe->WritePos); VFS_MarkAvaliable(Node, 0); } VFS_MarkFull(Node, 0); // Buffer can't still be full @@ -315,9 +316,12 @@ size_t FIFO_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buff while(remaining) { // Wait for buffer to empty - if(pipe->Flags & PF_BLOCKING) { - if( pipe->ReadPos == (pipe->WritePos+1)%pipe->BufSize ) + if(pipe->Flags & PF_BLOCKING) + { + if( pipe->ReadPos == (pipe->WritePos+1)%pipe->BufSize ) { + LOG("Blocking write on FIFO"); VFS_SelectNode(Node, VFS_SELECT_WRITE, NULL, "FIFO_Write"); + } len = remaining; if( pipe->ReadPos > pipe->WritePos ) @@ -363,6 +367,7 @@ size_t FIFO_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buff // Mark some flags if( pipe->ReadPos == pipe->WritePos ) { + LOG("Buffer is full"); VFS_MarkFull(Node, 1); // Buffer full } VFS_MarkAvaliable(Node, 1); @@ -393,7 +398,7 @@ tPipe *FIFO_Int_NewPipe(int Size, const char *Name) ret = calloc(1, allocsize); if(!ret) LEAVE_RET('n', NULL); - // Clear Return + // Set default flags ret->Flags = PF_BLOCKING; // Allocate Buffer