I'm writing a module which exports an interface similar to send and recv.
Since those functions are supposed to return respectively the number of sent and received bytes, I cannot do proper error management as I would do normally (i.e. using enumeratives and returning mnemonic values).
In a situation like this should I set errno as the standard library does? If so, since errno is thread specific, is there a particular way of writing on it, or can I simply assign a value to it?
Edit: experimenting it I noticed that setting errno by assignment is working. Still: is this safe and portable for any system?