Patch: 006-sock_fd_type.diff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



#6 in series.

Patch file:	006-sock_fd_type.diff
Purpose:	Fetch socket type with fd
Created:	2002-01-07
Applies:	CVS 2002-01-07
		(with 005-recv.diff applied)

Add functionality to retrieve the socket type & flags together with the
socket fd if needed, like in FILE_GetUnixHandleType().
Preparation for implementing overlapped IO on sockets.

include/file.h:
	include prototype for FILE_GetUnixHandleType().

dlls/winsock/socket.c:
	_get_sock_fd_type(): 	New function, calls FILE_GetUnixHandleType().
	_get_sock_fd():		Now a wrapper around _get_sock_fd_type().
	WSARecvFrom():		Call _get_sock_fd_type() to get socket flags.

Martin Wilck <Martin.Wilck@Fujitsu-Siemens.com>

diff -ruX diffignore CVS/wine/dlls/winsock/socket.c MW/wine/dlls/winsock/socket.c
--- CVS/wine/dlls/winsock/socket.c	Mon Jan  7 15:32:22 2002
+++ MW/wine/dlls/winsock/socket.c	Mon Jan  7 15:34:19 2002
@@ -241,14 +241,19 @@

 static char* check_buffer(int size);

-static int _get_sock_fd(SOCKET s)
+static int _get_sock_fd_type (SOCKET s, LPDWORD type)
 {
-    int fd = FILE_GetUnixHandle( s, GENERIC_READ );
+    int fd = FILE_GetUnixHandleType ( s, GENERIC_READ, type );
     if (fd == -1)
         FIXME("handle %d is not a socket (GLE %ld)\n",s,GetLastError());
     return fd;
 }

+static int _get_sock_fd (SOCKET s)
+{
+    return _get_sock_fd_type (s, NULL);
+}
+
 static void _enable_event(SOCKET s, unsigned int event,
 			  unsigned int sstate, unsigned int cstate)
 {
@@ -3367,13 +3372,15 @@
     struct iovec* iovec;
     struct msghdr msghdr;
     int fd, i, length, err = WSAENOTSOCK;
+    DWORD type;

-    TRACE("socket %04x, wsabuf %p, nbufs %ld, flags %ld, from %p, fromlen %ld, ovl %p, func %p\n",
+    fd = _get_sock_fd_type (s, &type);
+
+    TRACE("socket %04x, wsabuf %p, nbufs %ld, flags %ld, from %p, fromlen %ld, ovl %p, func %p, fd %d, type %lx\n",
           s, lpBuffers, dwBufferCount, *lpFlags, lpFrom,
           (lpFromlen ? *lpFromlen : -1L),
-          lpOverlapped, lpCompletionRoutine);
-
-    fd = _get_sock_fd(s);
+          lpOverlapped, lpCompletionRoutine,
+          fd, type);

     if (fd == -1)
     {
diff -ruX diffignore CVS/wine/include/file.h MW/wine/include/file.h
--- CVS/wine/include/file.h	Mon Jan  7 13:59:51 2002
+++ MW/wine/include/file.h	Mon Jan  7 15:30:45 2002
@@ -74,6 +74,7 @@
 extern int FILE_strncasecmp( const char *str1, const char *str2, int len );
 extern void FILE_SetDosError(void);
 extern HANDLE FILE_DupUnixHandle( int fd, DWORD access, BOOL inherit );
+extern int FILE_GetUnixHandleType ( HANDLE handle, DWORD access, LPDWORD type );
 extern int FILE_GetUnixHandle( HANDLE handle, DWORD access );
 extern BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info );
 extern HFILE16 FILE_Dup2( HFILE16 hFile1, HFILE16 hFile2 );







[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux