mirror of
				https://github.com/PowerShell/Win32-OpenSSH.git
				synced 2025-10-24 17:24:01 +02:00 
			
		
		
		
	1-3 C3
This commit is contained in:
		
							parent
							
								
									3c4a0b19ac
								
							
						
					
					
						commit
						533dec9304
					
				| @ -23,13 +23,15 @@ int fd_table_get_min_index() { | ||||
|     { | ||||
|         bitmap++; | ||||
|         min_index += 8; | ||||
|         if (min_index >= MAX_FDS) | ||||
|             return -1; | ||||
|     } | ||||
| 
 | ||||
|     tmp = *bitmap; | ||||
| 
 | ||||
|     while (tmp & 0x80) | ||||
|     { | ||||
|         tmp << 1; | ||||
|         tmp <<= 1; | ||||
|         min_index++; | ||||
|     } | ||||
| 
 | ||||
| @ -47,7 +49,7 @@ void fd_table_clear(int index) | ||||
| { | ||||
|     fd_table.w32_ios[index]->table_index = -1; | ||||
|     fd_table.w32_ios[index] = NULL; | ||||
|     FD_SET(index, &(fd_table.occupied)); | ||||
|     FD_CLR(index, &(fd_table.occupied)); | ||||
| } | ||||
| 
 | ||||
| void w32posix_initialize() { | ||||
| @ -134,6 +136,7 @@ int w32_close(int fd) { | ||||
|     fd_table_clear(pio->table_index); | ||||
|     if ((pio->type == LISTEN_FD) || (pio->type == SOCK_FD)) { | ||||
|         socketio_close(pio); | ||||
|         return 0; | ||||
|     } | ||||
|     else | ||||
|         return -1; | ||||
|  | ||||
| @ -6,16 +6,22 @@ | ||||
| #include <stdio.h> | ||||
| 
 | ||||
| //File Descriptor definitions
 | ||||
| #if !defined(MAX_FDS)  | ||||
| #define MAX_FDS 128 //a 2^n number
 | ||||
| #endif | ||||
| 
 | ||||
| typedef struct w32_fd_set_ { | ||||
| 	unsigned char bitmap[MAX_FDS >> 3]; | ||||
| }w32_fd_set; | ||||
| 
 | ||||
| #define fd_set w32_fd_set | ||||
| #undef FD_ZERO | ||||
| #define FD_ZERO(set) (memset( (set), 0, sizeof(w32_fd_set))) | ||||
| #undef FD_SET | ||||
| #define FD_SET(fd,set) ( (set)->bitmap[(fd) >> 3] |= (0x80 >> ((fd) % 8))) | ||||
| #undef FD_ISSET | ||||
| #define FD_ISSET(fd, set) (( (set)->bitmap[(fd) >> 3] & (0x80 >> ((fd) % 8)))?1:0) | ||||
| #undef FD_CLR | ||||
| #define FD_CLR(fd, set) ((set)->bitmap[(fd) >> 3] &= (~(0x80 >> ((fd) % 8)))) | ||||
| 
 | ||||
| #define STDIN_FILENO 0 | ||||
| @ -25,8 +31,8 @@ typedef struct w32_fd_set_ { | ||||
| //fcntl commands
 | ||||
| #define F_GETFL 0x1 | ||||
| #define F_SETFL 0x2 | ||||
| #define F_GETFL 0x4 | ||||
| #define F_SETFL 0x8 | ||||
| #define F_GETFD 0x4 | ||||
| #define F_SETFD 0x8 | ||||
| 
 | ||||
| //fd status flags
 | ||||
| #define O_NONBLOCK 0x1 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user