sslab-gatech / opensgx

OpenSGX
Other
288 stars 80 forks source link

Propagate errno to enclave #27

Open jonhoo opened 8 years ago

jonhoo commented 8 years ago

When a system call fails, it should be possible to read the error out of errno. However, this doesn't seem to propagate through the trampoline and into the enclave? This makes patterns like eager-reading very difficult:

bytes = recv(s, buf, sizeof(buf), MSG_DONTWAIT);
if (bytes < 0 && errno == EAGAIN) {
    /* no data for now, wait for any byte */
    bytes = read(s, buf, 1);
}