int getpeername(int s, struct sockaddr *name, int *namelen) { int a; if ((a = _getpeername(s, name, namelen)) == -1) maperror(errno); return (a); }
int connect(int s, struct sockaddr *name, int namelen) { int a; if ((a = _connect(s, name, namelen)) == -1) maperror(); return (a); }
int ioctl(int des, int request, int arg) { int ret; if ((ret = _bc_ioctl(des, request, arg)) == -1) maperror(); return (ret); }
int bind(int s, struct sockaddr *name, int namelen) { int a; if ((a = _so_bind(s, name, namelen, SOV_SOCKBSD)) != 0) { maperror(errno); } return (a); }
int accept(int s, struct sockaddr *addr, int *addrlen) { int a; if ((a = _accept(s, addr, addrlen)) == -1) { if (errno == N_AGAIN) errno = EWOULDBLOCK; else maperror(errno); } return (a); }
static void reply(RegPort* rp, LONG result) { char sbuf[256]; if (result == ERROR_SUCCESS) { sbuf[0] = 'o'; driver_output(rp->port, sbuf, 1); } else { char* s; char* t; int err; sbuf[0] = 'e'; err = maperror(result); for (s = erl_errno_id(err), t = sbuf+1; *s; s++, t++) { *t = tolower(*s); } driver_output(rp->port, sbuf, t-sbuf); } /* return 1; */ }