Daniel Ramsbrock
2005-10-13 20:23:10 UTC
The syscall table in the spec says to return -1 for all of the error
conditions, but semtest2 only tests for < 0. I assume it's OK to return
meaningful error codes defined in errno.h? For example, if P() is called
on an invalid (non-existing) semaphore, it would make sense to return
EINVALID (-12) rather than -1 (which is defined as EUNSPECIFIED).
Along those same lines, I assume it's also OK to define our own error
codes. For example, I defined two: one when Create_Semaphore is called
while the max semaphore count is reached and one for the case where
P(sem) and V(sem) are called by a process which did not previously
create the semaphore sem--but sem exists because another process has
created it (to me, this is a separate error from calling P() or V() on a
semaphore which doesn't exist).
Let me know if these assumptions are OK. I know it's a picky detail, but
I want to make sure I stick to the specs.
Thanks,
Daniel
conditions, but semtest2 only tests for < 0. I assume it's OK to return
meaningful error codes defined in errno.h? For example, if P() is called
on an invalid (non-existing) semaphore, it would make sense to return
EINVALID (-12) rather than -1 (which is defined as EUNSPECIFIED).
Along those same lines, I assume it's also OK to define our own error
codes. For example, I defined two: one when Create_Semaphore is called
while the max semaphore count is reached and one for the case where
P(sem) and V(sem) are called by a process which did not previously
create the semaphore sem--but sem exists because another process has
created it (to me, this is a separate error from calling P() or V() on a
semaphore which doesn't exist).
Let me know if these assumptions are OK. I know it's a picky detail, but
I want to make sure I stick to the specs.
Thanks,
Daniel