PRInt32 osfd = fd->secret->md.osfd;
_MD_connect (PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen,             PRIntervalTime timeout){    PRInt32 osfd = fd->secret->md.osfd;    PRInt32 rv, err;    PRThread *me = _PR_MD_CURRENT_THREAD();#ifndef BONE_VERSION    fd->secret->md.connectValueValid = PR_FALSE;#endifretry:    if ((rv = connect(osfd, (struct sockaddr *)addr, addrlen)) == -1) {        err = _MD_ERRNO();#ifndef BONE_VERSION	fd->secret->md.connectReturnValue = rv;	fd->secret->md.connectReturnError = err;	fd->secret->md.connectValueValid = PR_TRUE;#endif	if( err == EINTR ) {	    if( _PR_PENDING_INTERRUPT(me)) {		me->flags &= ~_PR_INTERRUPT;                PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);                return -1;            }#ifndef BONE_VERSION	    snooze( 100000L );#endif            goto retry;        }#ifndef BONE_VERSION        if(!fd->secret->nonblocking && ((err == EINPROGRESS) || (err==EAGAIN) || (err==EALREADY))) {	    /*	    ** There's no timeout on this connect, but that's not	    ** a big deal, since the connect times out anyways	    ** after 30 seconds.   Just sleep for 1/10th of a second	    ** and retry until we go through or die.	    */	    if( _PR_PENDING_INTERRUPT(me)) {                me->flags &= ~_PR_INTERRUPT;                PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);                return -1;            } 	    goto retry;	}	if( fd->secret->nonblocking && ((err == EAGAIN) || (err == EINPROGRESS))) {	    PR_Lock(_connectLock);	    connectList[connectCount].osfd = osfd;	    memcpy(&connectList[connectCount].addr, addr, addrlen);	    connectList[connectCount].addrlen = addrlen;	    connectList[connectCount].timeout = timeout;	    connectCount++;	    PR_Unlock(_connectLock);	    _PR_MD_MAP_CONNECT_ERROR(err);	    return rv;	}#else /* BONE_VERSION */	if(!fd->secret->nonblocking && (err == EINPROGRESS)) {	    rv = socket_io_wait(osfd, WRITE_FD, timeout);	    if (rv == -1) {		return -1;	    }	    PR_ASSERT(rv == 1);	    if (_PR_PENDING_INTERRUPT(me)) {		me->flags &= ~_PR_INTERRUPT;		PR_SetError( PR_PENDING_INTERRUPT_ERROR, 0);		return -1;	    }	    err = _MD_beos_get_nonblocking_connect_error(osfd);	    if (err != 0) {		_PR_MD_MAP_CONNECT_ERROR(err);		return -1;	    }	    return 0;	} #endif	_PR_MD_MAP_CONNECT_ERROR(err);    }    return rv;}