Bugzilla bug 121872: define _PR_MD_LISTEN as a function so that we can set

error codes if listen() fails.  The patch is contributed by Javier
Pedemonte <pedemont@us.ibm.com>.
Modified files: _os2.h _os2_errors.h os2sock.c
This commit is contained in:
wtc%netscape.com 2002-01-27 02:59:44 +00:00
Родитель 195619a7d0
Коммит c4573652ad
3 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -258,7 +258,7 @@ extern void _MD_MakeNonblock(PRFileDesc *f);
#define _MD_INIT_FD_INHERITABLE (_PR_MD_INIT_FD_INHERITABLE)
#define _MD_QUERY_FD_INHERITABLE (_PR_MD_QUERY_FD_INHERITABLE)
#define _MD_SHUTDOWN (_PR_MD_SHUTDOWN)
#define _MD_LISTEN(s, backlog) listen(s->secret->md.osfd,backlog)
#define _MD_LISTEN _PR_MD_LISTEN
extern PRInt32 _MD_CloseSocket(PRInt32 osfd);
#define _MD_CLOSE_SOCKET _MD_CloseSocket
#define _MD_SENDTO (_PR_MD_SENDTO)

Просмотреть файл

@ -40,6 +40,9 @@
#include <assert.h>
#endif
NSPR_API(void) _MD_os2_map_default_error(PRInt32 err);
#define _PR_MD_MAP_DEFAULT_ERROR _MD_os2_map_default_error
NSPR_API(void) _MD_os2_map_opendir_error(PRInt32 err);
#define _PR_MD_MAP_OPENDIR_ERROR _MD_os2_map_opendir_error

Просмотреть файл

@ -357,6 +357,19 @@ _PR_MD_BIND(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen)
}
PRInt32
_PR_MD_LISTEN(PRFileDesc *fd, PRIntn backlog)
{
PRInt32 rv, err;
rv = listen(fd->secret->md.osfd, backlog);
if (rv < 0) {
err = sock_errno();
_PR_MD_MAP_DEFAULT_ERROR(err);
}
return(rv);
}
PRInt32
_PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags,
PRIntervalTime timeout)