Wednesday, December 12, 2007

Trying To Debug Semaphores

We are trying to debug semaphore creation and usage on MacOS to get Signal Safe Semaphores implemented in SuperServer. But we are having some issues... (as per previous posts)
We have a gds__log print in semaphore.h to see whether the semaphore is created.

If we try and start the server automatically via
the StartupItem (Mac's method for starting Services)
we see:

If we try and run ./fbserver from gdb or the command
line we see
In the firebird.log file.

It looks like for darwin semaphore's handle is really a file descriptor - nothing more. When statring firebird as a service, there are no opened files passed to it, because it's supposed to be a daemon. Therefore the first opened file (or semaphore) is 0. When starting from the command line, stdin(0), stdout(1) and stderr(2) are already opened. Therefore - we get 3 which is the next free handle.

No comments: