Add process-specific error tracking to libudi.

Use struct for errmsg handling instead of passing the string
and size around.