libc: add sid function for porting CRuby