···11#include "../errno.h"
2233+#ifndef USE_NEW_PSYNC_CODE
44+ #define USE_NEW_PSYNC_CODE 0
55+#endif
66+37// psynch syscalls send back extra bits and leave only the bottom 8 bits for errors
48// So we have to filter out the top 24 bits, translate errno and put the 24 bits back.
59int psynch_errno(int rv)
···10141115 rv = -rv;
1216 top = rv & 0xffffff00;
1717+#if USE_NEW_PSYNC_CODE
1818+ rv = rv & 0xff;
1919+#else
1320 rv = errno_linux_to_bsd(rv & 0xff);
2121+#endif
1422 rv |= top;
15231624 return -rv;