]> sourceware.org Git - newlib-cygwin.git/commitdiff
* dtable.cc (dtable::dup2): Store fd for fhandler_socket.
authorCorinna Vinschen <corinna@vinschen.de>
Fri, 8 Feb 2002 11:54:10 +0000 (11:54 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Fri, 8 Feb 2002 11:54:10 +0000 (11:54 +0000)
* fhandler.h (fhandler_base::set_fd): New virtual method.
(fhandler_base::get_fd): Ditto.
(fhandler_socket::set_fd): Ditto.
(fhandler_socket::get_fd): Ditto.
* fhandler_socket.cc (fhandler_socket::read): Call cygwin_recv instead
of native Winsock recv.
(fhandler_socket::write): Call cygwin_send instead of native Winsock
send.
* net.cc (fdsock): Store fd in fhandler_socket.

winsup/cygwin/ChangeLog
winsup/cygwin/dtable.cc
winsup/cygwin/fhandler.h
winsup/cygwin/fhandler_socket.cc
winsup/cygwin/net.cc

index 84daf61e344c224197799fb44e053da25fcb6abd..10e3df7c185cacee166260d1aae3278b844082b5 100644 (file)
@@ -1,3 +1,16 @@
+2002-02-08  Corinna Vinschen  <corinna@vinschen.de>
+
+       * dtable.cc (dtable::dup2): Store fd for fhandler_socket.
+       * fhandler.h (fhandler_base::set_fd): New virtual method.
+       (fhandler_base::get_fd): Ditto.
+       (fhandler_socket::set_fd): Ditto.
+       (fhandler_socket::get_fd): Ditto.
+       * fhandler_socket.cc (fhandler_socket::read): Call cygwin_recv instead
+       of native Winsock recv.
+       (fhandler_socket::write): Call cygwin_send instead of native Winsock
+       send.
+       * net.cc (fdsock): Store fd in fhandler_socket.
+
 2002-02-07  Corinna Vinschen  <corinna@vinschen.de>
 
        * net.cc (cygwin_getsockname): Fix handling of NULL sun_path.
index f09ddec6c0e6c11044f4eeee4493ef19e47adda7..ab6f3c218b04ccb2588628f5c3ddb8b9e1b56a4e 100644 (file)
@@ -411,6 +411,7 @@ dtable::dup2 (int oldfd, int newfd)
   if (!not_open (newfd))
     _close (newfd);
   fds[newfd] = newfh;
+  newfh->set_fd (newfd);
 
   ReleaseResourceLock (LOCK_FD_LIST, WRITE_LOCK | READ_LOCK, "dup");
   MALLOC_CHECK;
index 039615d4da9975b7c5bbaa0f793919c57620c029..f2b3f13878801802680116649aba7f78a39fdeca 100644 (file)
@@ -351,6 +351,9 @@ class fhandler_base
   virtual void seekdir (DIR *, off_t);
   virtual void rewinddir (DIR *);
   virtual int closedir (DIR *);
+
+  virtual void set_fd (int nfd) {}
+  virtual int get_fd () { return -1; }
 };
 
 class fhandler_socket: public fhandler_base
@@ -361,6 +364,7 @@ class fhandler_socket: public fhandler_base
   HANDLE secret_event;
   struct _WSAPROTOCOL_INFOA *prot_info_ptr;
   char *sun_path;
+  int fd;
 
  public:
   fhandler_socket ();
@@ -391,8 +395,10 @@ class fhandler_socket: public fhandler_base
   select_record *select_read (select_record *s);
   select_record *select_write (select_record *s);
   select_record *select_except (select_record *s);
-  int get_addr_family () {return addr_family;}
+  void set_fd (int nfd) { fd = nfd; }
+  int get_fd () { return fd; }
   void set_addr_family (int af) {addr_family = af;}
+  int get_addr_family () {return addr_family;}
   void set_sun_path (const char *path);
   char *get_sun_path () {return sun_path;}
   void set_connect_secret ();
index b62a203bfdda49b7fd98841e5d6f76dae6fde7ca..33e9b39f3820a65e3a9f47678f5cf3838cc7a015 100644 (file)
@@ -251,27 +251,35 @@ fhandler_socket::fstat (struct stat *buf, path_conv *pc)
   return fh.fstat (buf, pc);
 }
 
+extern "C" int cygwin_recv (int, void *, int, unsigned int);
+
 int __stdcall
 fhandler_socket::read (void *ptr, size_t len)
 {
   sigframe thisframe (mainthread);
-  int res = recv (get_socket (), (char *) ptr, len, 0);
+  int res = cygwin_recv (get_fd (), (char *) ptr, len, 0);
+#if 0
   if (res == SOCKET_ERROR)
     set_winsock_errno ();
+#endif
   return res;
 }
 
+extern "C" int cygwin_send (int, const void *, int, unsigned int);
+
 int
 fhandler_socket::write (const void *ptr, size_t len)
 {
   sigframe thisframe (mainthread);
-  int res = send (get_socket (), (const char *) ptr, len, 0);
+  int res = cygwin_send (get_fd (), (const char *) ptr, len, 0);
+#if 0
   if (res == SOCKET_ERROR)
     {
       set_winsock_errno ();
       if (get_errno () == ECONNABORTED || get_errno () == ECONNRESET)
        _raise (SIGPIPE);
     }
+#endif
   return res;
 }
 
index a564f44fb137a8986d049356028258f580da785a..2f8ce8b1cec39dcaf00d3763e88ca70bdee89680 100644 (file)
@@ -522,6 +522,7 @@ fdsock (int& fd, const char *name, SOCKET soc)
   else
     debug_printf ("not setting socket inheritance since winsock2_active %d", winsock2_active);
   fhandler_socket *fh = (fhandler_socket *) cygheap->fdtab.build_fhandler (fd, FH_SOCKET, name);
+  fh->set_fd (fd);
   fh->set_io_handle ((HANDLE) soc);
   fh->set_flags (O_RDWR);
   fh->set_name (name, name);
This page took 0.037267 seconds and 5 git commands to generate.