title: Should I set errno?
body: <p>I'm writing a module which exports an interface similar to <code>send</code> and <code>recv</code>.</p>
  
  <p>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).</p>
  
  <p>In a situation like this should I set <code>errno</code> as the standard library does? If so, since <code>errno</code> is thread specific, is there a particular way of writing on it, or can I simply assign a value to it?</p>
  
  <p><strong>Edit:</strong> experimenting it I noticed that setting <code>errno</code> by assignment is working. Still: is this safe and portable for any system?</p>