1
0
mirror of https://github.com/php/php-src.git synced 2026-04-01 21:22:13 +02:00

Can't forget fd_isset()

This commit is contained in:
Evan Klinger
1999-11-24 03:47:58 +00:00
parent a4c75707fb
commit 633d18de0f
2 changed files with 27 additions and 1 deletions

View File

@@ -245,6 +245,7 @@ function_entry file_functions[] = {
PHP_FE(set_socket_timeout, NULL)
#endif
PHP_FE(fd_set, NULL)
PHP_FE(fd_isset, NULL)
PHP_FE(select, NULL)
{NULL, NULL, NULL}
};
@@ -1681,7 +1682,7 @@ PHP_FUNCTION(fd_set)
if(getParametersEx(1, &arg) == FAILURE) {
WRONG_PARAM_COUNT;
}
what = zend_fetch_resource(arg,-1,"Select",&type,3,le_fopen,le_socket,le_popen);
what = zend_fetch_resource(arg,-1,"select",&type,3,le_fopen,le_socket,le_popen);
ZEND_VERIFY_RESOURCE(what);
if(type == le_socket) {
fd = *(int *)what;
@@ -1733,3 +1734,27 @@ PHP_FUNCTION(select)
RETURN_LONG(select(max_fd + 1,&readfd,NULL,NULL,((*timeout)->value.lval <= 0) ? NULL : &tv));
}
PHP_FUNCTION(fd_isset)
{
pval **fdarg;
void *what;
int type, fd;
if(ARG_COUNT(ht) != 1 || getParametersEx(1, &fdarg) == FAILURE) {
WRONG_PARAM_COUNT;
}
what = zend_fetch_resource(fdarg,-1,"select",&type,3,le_fopen,le_socket,le_popen);
ZEND_VERIFY_RESOURCE(what);
if(type == le_socket) {
fd = *(int *)what;
} else {
fd = fileno((FILE *)what);
}
if(FD_ISSET(fd,&readfd)) {
RETURN_TRUE;
}
RETURN_FALSE;
}

View File

@@ -69,6 +69,7 @@ PHP_FUNCTION(set_file_buffer);
PHP_FUNCTION(get_meta_tags);
PHP_FUNCTION(flock);
PHP_FUNCTION(fd_set);
PHP_FUNCTION(fd_isset);
PHP_FUNCTION(select);
PHPAPI int _php3_set_sock_blocking(int socketd, int block);