git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kernel - (experimental) Allowing THREAD_EVENT_TIMER to wake a semaphore
[tpg/acess2.git]
/
KernelLand
/
Kernel
/
drv
/
fifo.c
diff --git
a/KernelLand/Kernel/drv/fifo.c
b/KernelLand/Kernel/drv/fifo.c
index
f957d28
..
6c63578
100644
(file)
--- 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 ) {
// 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
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
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");
VFS_SelectNode(Node, VFS_SELECT_WRITE, NULL, "FIFO_Write");
+ }
len = remaining;
if( pipe->ReadPos > pipe->WritePos )
len = remaining;
if( pipe->ReadPos > pipe->WritePos )
@@
-349,11
+353,14
@@
size_t FIFO_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buff
if(len > pipe->BufSize - pipe->WritePos)
{
int ofs = pipe->BufSize - pipe->WritePos;
if(len > pipe->BufSize - pipe->WritePos)
{
int ofs = pipe->BufSize - pipe->WritePos;
+ LOG("pipe->Buffer = %p, pipe->WritePos = %i, ofs=%i, len=%i",
+ pipe->Buffer, pipe->WritePos, ofs, len);
memcpy(&pipe->Buffer[pipe->WritePos], Buffer, ofs);
memcpy(&pipe->Buffer[pipe->WritePos], Buffer, ofs);
- memcpy(&pipe->Buffer, (Uint8*)Buffer + ofs, len-ofs);
+ memcpy(&pipe->Buffer
[0]
, (Uint8*)Buffer + ofs, len-ofs);
}
else
{
}
else
{
+ LOG("pipe->Buffer = %p, pipe->WritePos = %i", pipe->Buffer, pipe->WritePos);
memcpy(&pipe->Buffer[pipe->WritePos], Buffer, len);
}
memcpy(&pipe->Buffer[pipe->WritePos], Buffer, len);
}
@@
-363,6
+370,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 ) {
// Mark some flags
if( pipe->ReadPos == pipe->WritePos ) {
+ LOG("Buffer is full");
VFS_MarkFull(Node, 1); // Buffer full
}
VFS_MarkAvaliable(Node, 1);
VFS_MarkFull(Node, 1); // Buffer full
}
VFS_MarkAvaliable(Node, 1);
@@
-393,7
+401,7
@@
tPipe *FIFO_Int_NewPipe(int Size, const char *Name)
ret = calloc(1, allocsize);
if(!ret) LEAVE_RET('n', NULL);
ret = calloc(1, allocsize);
if(!ret) LEAVE_RET('n', NULL);
- //
Clear Return
+ //
Set default flags
ret->Flags = PF_BLOCKING;
// Allocate Buffer
ret->Flags = PF_BLOCKING;
// Allocate Buffer
@@
-414,10
+422,10
@@
tPipe *FIFO_Int_NewPipe(int Size, const char *Name)
ret->Node.GID = Threads_GetGID();
ret->Node.NumACLs = 1;
ret->Node.ACLs = (void*)( (Uint)ret + sizeof(tPipe) );
ret->Node.GID = Threads_GetGID();
ret->Node.NumACLs = 1;
ret->Node.ACLs = (void*)( (Uint)ret + sizeof(tPipe) );
- ret->Node.ACLs->Group = 0;
- ret->Node.ACLs->ID = ret->Node.UID;
- ret->Node.ACLs->Inv = 0;
- ret->Node.ACLs->Perms = -1;
+ ret->Node.ACLs->
Ent.
Group = 0;
+ ret->Node.ACLs->
Ent.
ID = ret->Node.UID;
+ ret->Node.ACLs->
Perm.
Inv = 0;
+ ret->Node.ACLs->Perm
.Perm
s = -1;
ret->Node.CTime
= ret->Node.MTime
= ret->Node.ATime = now();
ret->Node.CTime
= ret->Node.MTime
= ret->Node.ATime = now();
UCC
git Repository :: git.ucc.asn.au