Porting rnotify to C