socket-util: Describe fd for Windows.
authorGurucharan Shetty <gshetty@nicira.com>
Wed, 19 Feb 2014 19:33:09 +0000 (11:33 -0800)
committerGurucharan Shetty <gshetty@nicira.com>
Fri, 21 Feb 2014 16:22:12 +0000 (08:22 -0800)
In windows there is no clear way to distinguish between a
socket fd and a file fd.

We use the function, describe_fd() mostly for debugging.
For now, return a generic statement.

Co-authored-by: Linda Sun <lsun@vmware.com>
Signed-off-by: Linda Sun <lsun@vmware.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/socket-util.c

index 506de6d..861cd9d 100644 (file)
@@ -1241,6 +1241,7 @@ describe_fd(int fd)
     struct stat s;
 
     ds_init(&string);
+#ifndef _WIN32
     if (fstat(fd, &s)) {
         ds_put_format(&string, "fstat failed (%s)", ovs_strerror(errno));
     } else if (S_ISSOCK(s.st_mode)) {
@@ -1260,6 +1261,9 @@ describe_fd(int fd)
         put_fd_filename(&string, fd);
 #endif
     }
+#else
+    ds_put_format(&string,"file descriptor");
+#endif /* _WIN32 */
     return ds_steal_cstr(&string);
 }