Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

Porting to a new system

Writing the system-dependent code

What needs to be written

To port sigsafe to a new system, you need to implement:

And you can optionally implement:

Finding resources

I've had good luck so far finding information about how to implement raw system calls under various platforms. You might find the following resources helpful:

Step-by-step tutorial

...doesn't exist yet. Sorry! Come back in a while.

Testing your implementation

Using the race condition checker

Ideally, the race condition checker works on your platform. Then testing is fairly simple:

$ tests/build-myplatform/race_checker -qm
...
  Test                 Result               Expected            
----------------------------------------------------------------
  sigsafe_read         success              success             
  racebefore_read      ignored signal       ignored signal      
  raceafter_read       forgotten result     forgotten result    

If the the results are different from expected, it will mark the guilty tests with a '*' and note it at the bottom.

If the quick tests pass, you can run a full test with:

$ ./race_checker -a

but you might go out for coffee or perhaps dinner while this happens. It traces through a lot of instructions one-by-one, so it is slow.

Testing for races with gdb

This is not as thorough as the automated race checker, but these are all the critical values. You can be reasonable confident in your implementation if all these tests pass.

Some handy gdb commands:

Testing for races with dbx

The process is as above, with gdb. The only real difference is in the syntax. Some handy commands here:

Testing performance

You should also run time build-myplatform/tests/bench_read_raw and time build-myplatform/tests/bench_read_safe. They should not differ in time significantly. (User time is where you'll find the difference, if any.) In theory the safe version should be slightly more processor-intensive since it makes a call to pthread_getspecific with every system call. In practice, I often find no statistically significant difference or even that the safe version is faster.


Generated on Fri Feb 4 11:13:32 2005 for sigsafe by doxygen 1.3.5