Correctly call right callback depending on unix events