delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/02/12/08:14:44

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Ralf Habacker" <Ralf DOT Habacker AT freenet DOT de>
To: "cygwin" <cygwin AT cygwin DOT com>
Subject: RE: unix domain socket with shared memory ?
Date: Tue, 12 Feb 2002 14:07:52 +0100
Message-ID: <005601c1b3c6$4759ab80$4f2efea9@BRAMSCHE>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
In-Reply-To: <00f001c1b13e$e90bfc10$0200a8c0@lifelesswks>
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Importance: Normal

------=_NextPart_000_0057_01C1B3CE.A91E1380
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

http://i30www.ira.uka.de/courses/winter00-01/Prosem_LinuxInternals/4.4ipc.ppt

> > Hi all,
> >
> > cfg has told me about the current process of cygwin daemon
> implementation with ipc support.
> >
> > I initial have heard last year, that this work would be started, but
> because of so much other work I have lost the
> > contact to the ongoing process.
>
> It's currently paused, waiting for the development team to persuade
> Chris that the _core_ (not the IPC part) is ready for (finaly filenaming
> and then) inclusion.
>
> > Now I was looking into the ongoing work and it seems to me in a mostly
> read state, isn't it. I like to say: Great
> > work to all who have worked on it. :-)
>
> Thank you. The main folk are Egor Duda who created an inital
> proof-of-concept for solving a security issue, most of the developers
> list bouncing round ideas, and then I (*bow*) took Egors proof of
> concept and created the generic daemon, and the win9x support that it
> now has. Gary R. Van Sickle has also spent some time recently being a
> guinea pig, which I appreciate :].
>
> > The reason why I'm writing this is that I have recognized some
> performance issues with unix domain sockets, which
> ...
>
> > Because the cygwin-daemon branch provides the long missed ipc support,
> the way for for speeding up unix domain
> > sockets with a shared memory implementation may be free. (I not be not
> first one, who tells about this, because I
> > have seen some guys before talking about this possibility)
>
> Hmm, the cygwin-daemon IPC implementation may allow this, but so does
> the existing mmap implementation. So I think a better approach may be
> via mmap (more mature code) with the daemon providing
> cross-process-persistence (if needed).
>
> > One open topic for me is how to handle forking. I imagine, that
> because the file handles are duplicated, the shared
> > memory has to be duplicatd too, but because the socket file name is
> the same, does it use the same shared memory
> > area as the parent or not ???
>
> Forking is easy to implement (see the fixup_after_fork functions) but
> shouldn't be needed if implemented on top of mmap or IPC memory regions.
> What maybe an issue is the logic for how it should behave.
>
> If you write, who reads? The parent or the child? The first reader? Once
> this question is answered, you will find making fork() work straight
> forward. Advice can be offered at that point if needed.
>

How is it implemented in the current implementation ?

> > My intention whis this thread is to make sure, that this strategy is a
> possible way and I'm willing to spent some t
> > ime to get this running, although I think I'm not be able to handle
> this whole task alone.
>
> Yes, it's possible. Is the daemon needed? Maybe not, maybe. You will get
> assistance in doing this.
>
So this is my current strategy for the beginning.

The first task seems to me to reorganice net.cc, so that all AF_INET/AF_LOCAL specific functions are located into
methods of fhandler_socket. After doing this net.cc contains only wrappers for the above mentioned functions.

See a snippet of my current fhandler.h

class fhandler_socket
....
#ifdef NEW_NET
  // a FIXME means, this functions isn't moved into class fhandler_socket yet
  // a CHECK means, this functions is implemented and has to be check for valid functionality

  // FIXME: move from net.cc to fhandler_socker.cc
  int socketpair (int family, int type, int protocol, int *sb);
  // FIXME: move from net.cc to fhandler_socker.cc
  int socket (int af, int type, int protocol);
  // CHECK:
  int bind (const struct sockaddr *my_addr, int addrlen);
  // CHECK:
  int listen (int backlog);
  // CHECK:
  int accept (struct sockaddr *peer, int *len);
  // CHECK:
  int recv (const void *buf, int len, unsigned int flags);
  // CHECK:
  int send (const void *buf, int len, unsigned int flags);
  // CHECK:
  int connect (const struct sockaddr *name, int namelen);
  // CHECK:
  int shutdown (int how);
  // CHECK:
  int getsockname (struct sockaddr *addr, int *namelen);
  // CHECK:
  int getpeername (struct sockaddr *name, int *len);
#endif

This seems to me as a general optimation, which should be incorporated also in the main cygwin branch, because it
would simplifies the process of integrating other socket implementations. Any comments to this ?

The second task is to fork a new fhandler_local class from fhandler_socket, change the above mentioned methods into
virtual methods, which contains all AF_LOCAL specific stuff.

Perhaps is is better to create a base fhandler_socket class with virtual functions and than derivate
fhandler_socket_tcp (which is currently named fhandler_socket) and fhandler_socket_local from this.

net.cc and other files should only use the basic socket class "fhandler_socket", so that the right virtual
functions are used.

This class has be added to the fhandler instance creation dispatcher in path.cc.
I have also seen some FH_SOCKET related stuff in dtable.cc:dtable::release() and net.cc:fdsock(). In fdsock, the
depending on the protocol familiy, the propper objects should be created from fhandler_socket_tcp for tcp sockets
and fhandler_socket_local for unix domain sockets.

If the current fhandler_socket.cc is copied into fhandler_socket_tcp.cc and fhandler_socket_local.cc in this step,
the cygwin1.dll should work as before, because the changes has no functionality changed only source layout.

This step could be also done in the main cygwin tree.

The third step seems to me to implement the new af_local stuff in fhandler_socket_local.cc, which should be
discussed. A sample implementation could be found unter
http://i30www.ira.uka.de/courses/winter00-01/Prosem_LinuxInternals/4.4ipc.ppt, but currently I don't know if there
are some copyrights on this.

For step one a patch is appended (about 95% complete, socket and socketpair are missing, because they don't use an
existing fhandler_socket, instead they create such, so integrating it into fhandler_socket seems not right for me).
The patch was created from the winsup dir assuming that the cygwin-daemon source is located into cygwin-daemon.
Additional it uses a MACRO named NEW_NET, which enables the moved code. If this macro is unset the present
implementation is used. (see Makefile.in)
Because I have checked out the winsup/cygwin tree and the winsup/cygwin-daemon tree in one directory, a patched
winsup/Makefile.common-daemon is needed.
This isn't a ready-for-check-in-patch, so I don't have added a ChangeLog. Also there are no functionality changes,
so I think no copyright assignment is nessessary.
I see this patch as as discussion base. Any comments ?
I have verified propper operation with a sample unix socket client/server from
http://www.ecst.csuchico.edu/~beej/guide/ipc/usock.html. I know, that this does not check all patched methods, so
it would be nice if somebody else could add some tests.

Note: There may be some need to add some sigframe lines, but I'm not sure, where this should be placed.

Another topic which would be nesessary to observe seems to me be the comunication latencies, which the benchmark
shows.
Currently I don't know how much the influence on unix domain socket performance is, but what I see is that for pies
and AF_UNIX the latency are about 700 times respective 370 times more thant for linux with the same hardware.
Tcp shows similar results. UDP has a latency of more than 100 and tcp about 2570 times.

*Local* Communication latencies in microseconds - smaller is better
-------------------------------------------------------------------
Host                 OS 2p/0K  Pipe AF     UDP  RPC/   TCP  RPC/ TCP
                        ctxsw       UNIX         UDP         TCP conn
--------- ------------- ----- ----- ---- ----- ----- ----- ----- ----
BRAMSCHE  CYGWIN_NT-5.0 4970. 14.7K 14.K 107.1       13.5K       550K
BRAMSCHE   Linux 2.2.18 3.290  19.2 39.6  76.8  85.3 128.0 238.0 214.
                               ^^^^ ^^^^             ^^^^        ^^^^
Currently it seems to me, that this latencies are caused by the windows and/or cygwin context/task switching
implementation.

The reason why I suggess this are

1. context switching seems to be a general optimization topic if you see in the results shown below.

Context switching - times in microseconds - smaller is better
-------------------------------------------------------------
Host                 OS 2p/0K 2p/16K 2p/64K 8p/16K 8p/64K 16p/16K 16p/64K
                        ctxsw  ctxsw  ctxsw ctxsw  ctxsw   ctxsw   ctxsw
--------- ------------- ----- ------ ------ ------ ------ ------- -------
BRAMSCHE  CYGWIN_NT-5.0 4970. 5959.5 5933.2 3177.0 8706.5  4218.8  6200.8
BRAMSCHE   Linux 2.2.18 3.530   12.6   25.1   19.8  161.3    31.4   162.6

2. UDP transfer has much less latencies, so this says it is possible to avoid latencies, but I haven't found the
difference yet.

Any comments ?

Ralf









------=_NextPart_000_0057_01C1B3CE.A91E1380
Content-Type: application/octet-stream;
	name="cygwin-daemon_NEW_NET_01.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="cygwin-daemon_NEW_NET_01.patch"

? cygwin-daemon/.new.ROADMAP=0A=
? cygwin-daemon/fhandler.h_new_af_local=0A=
? cygwin-daemon/fhandler_local.cc=0A=
? cygwin-daemon/fhandler_socket.cc_new_af_local=0A=
? cygwin-daemon/net.cc_new_af_local=0A=
? cygwin-daemon/SharedMem.cc=0A=
? cygwin-daemon/SharedMem.h=0A=
Index: cygwin-daemon//Makefile.in=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cygwin/Makefile.in,v=0A=
retrieving revision 1.63.2.11=0A=
diff -u -b -B -r1.63.2.11 Makefile.in=0A=
--- Makefile.in	2002/01/29 09:48:25	1.63.2.11=0A=
+++ Makefile.in	2002/02/10 20:28:49=0A=
@@ -51,7 +51,7 @@=0A=
 # FIXME: Which is it, CC or CC_FOR_TARGET?=0A=
 CC_FOR_TARGET:=3D$(CC)=0A=
 CFLAGS:=3D AT CFLAGS@=0A=
-CFLAGS+=3D-MMD -fbuiltin=0A=
+CFLAGS+=3D-MMD -fbuiltin -DNEW_NET =0A=
 CXX:=3D AT CXX@=0A=
 CXXFLAGS:=3D AT CXXFLAGS@=0A=
 =0A=
@@ -71,7 +71,7 @@=0A=
 #=0A=
 # Include common definitions for winsup directory=0A=
 #=0A=
-include $(srcdir)/../Makefile.common=0A=
+include $(srcdir)/../Makefile.common-daemon=0A=
 =0A=
 INSTALL_DATA:=3D$(SHELL) $(updir1)/install-sh -c=0A=
 =0A=
@@ -202,8 +202,8 @@=0A=
 	    $(INSTALL_DATA) $$i $(tooldir)/man/man7/`basename $$i` ; \=0A=
 	done=0A=
 =0A=
-install_target: cygserver.exe=0A=
-	$(INSTALL_PROGRAM) cygserver.exe $(bindir)/cygserver.exe=0A=
+install-bin: cygserver.exe=0A=
+	$(INSTALL_DATA) cygserver.exe $(bindir)/cygserver.exe=0A=
 	=0A=
 install_host:=0A=
 =0A=
Index: cygwin-daemon//fhandler.h=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cygwin/fhandler.h,v=0A=
retrieving revision 1.83.2.4=0A=
diff -u -b -B -r1.83.2.4 fhandler.h=0A=
--- fhandler.h	2002/01/04 03:56:07	1.83.2.4=0A=
+++ fhandler.h	2002/02/10 20:28:53=0A=
@@ -402,7 +402,41 @@=0A=
   void signal_secret_event ();=0A=
   void close_secret_event ();=0A=
   int __stdcall fstat (struct stat *buf, path_conv *) __attribute__ =
((regparm (3)));=0A=
+#if NEW_NET=0A=
+	// a FIXME means, this functions isn't moved into class fhandler_socket=0A=
+	// a CHECK means, check this function of valid functionality =0A=
+=0A=
+  // FIXME: move from net.cc to fhandler_socker.cc=0A=
+	int socketpair (int family, int type, int protocol, int *sb); =0A=
+  // FIXME: move from net.cc to fhandler_socker.cc=0A=
+  int socket (int af, int type, int protocol);=0A=
+  // CHECK: =0A=
+  int bind (const struct sockaddr *my_addr, int addrlen); =0A=
+  // CHECK: =0A=
+	int listen (int backlog);=0A=
+  // CHECK: =0A=
+	int accept (struct sockaddr *peer, int *len);=0A=
+  // CHECK: =0A=
+	int recv (const void *buf, int len, unsigned int flags);=0A=
+  // CHECK: =0A=
+	int send (const void *buf, int len, unsigned int flags);=0A=
+  // CHECK: =0A=
+	int connect (const struct sockaddr *name, int namelen);=0A=
+  // CHECK: =0A=
+	int shutdown (int how);=0A=
+  // CHECK: =0A=
+	int getsockname (struct sockaddr *addr, int *namelen); =0A=
+  // CHECK: =0A=
+	int getpeername (struct sockaddr *name, int *len);=0A=
+#endif =0A=
 };=0A=
+=0A=
+class fhandler_local: public fhandler_socket=0A=
+{ =0A=
+  private:=0A=
+=0A=
+ public: 	=0A=
+}; =0A=
 =0A=
 class fhandler_pipe: public fhandler_base=0A=
 {=0A=
Index: cygwin-daemon//fhandler_socket.cc=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cygwin/fhandler_socket.cc,v=0A=
retrieving revision 1.24.2.2=0A=
diff -u -b -B -r1.24.2.2 fhandler_socket.cc=0A=
--- fhandler_socket.cc	2002/01/04 03:56:08	1.24.2.2=0A=
+++ fhandler_socket.cc	2002/02/10 20:28:55=0A=
@@ -10,11 +10,14 @@=0A=
 =0A=
 /* #define DEBUG_NEST_ON 1 */=0A=
 =0A=
+#define DEBUG 1=0A=
+=0A=
 #define  __INSIDE_CYGWIN_NET__=0A=
 =0A=
 #include "winsup.h"=0A=
 #include <errno.h>=0A=
 #include <sys/socket.h>=0A=
+#include <sys/un.h>=0A=
 #include <asm/byteorder.h>=0A=
 =0A=
 #include <stdlib.h>=0A=
@@ -93,7 +96,7 @@=0A=
   struct sockaddr_in sin;=0A=
   int sin_len =3D sizeof (sin);=0A=
 =0A=
-  if (getsockname (get_socket (), (struct sockaddr*) &sin, &sin_len))=0A=
+  if (::getsockname (get_socket (), (struct sockaddr*) &sin, &sin_len))=0A=
     {=0A=
       debug_printf ("error getting local socket name (%d)", =
WSAGetLastError ());=0A=
       return NULL;=0A=
@@ -255,7 +258,7 @@=0A=
 fhandler_socket::read (void *ptr, size_t len)=0A=
 {=0A=
   sigframe thisframe (mainthread);=0A=
-  int res =3D recv (get_socket (), (char *) ptr, len, 0);=0A=
+  int res =3D ::recv (get_socket (), (char *) ptr, len, 0);=0A=
   if (res =3D=3D SOCKET_ERROR)=0A=
     set_winsock_errno ();=0A=
   return res;=0A=
@@ -265,7 +268,7 @@=0A=
 fhandler_socket::write (const void *ptr, size_t len)=0A=
 {=0A=
   sigframe thisframe (mainthread);=0A=
-  int res =3D send (get_socket (), (const char *) ptr, len, 0);=0A=
+  int res =3D ::send (get_socket (), (const char *) ptr, len, 0);=0A=
   if (res =3D=3D SOCKET_ERROR)=0A=
     {=0A=
       set_winsock_errno ();=0A=
@@ -488,3 +491,394 @@=0A=
     cfree (sun_path);=0A=
   sun_path =3D cstrdup (path);=0A=
 }=0A=
+=0A=
+#if NEW_NET=0A=
+fhandler_socket *=0A=
+fdsock (int& fd, const char *name, SOCKET soc);=0A=
+=0A=
+// FIXME: this class definition is a copy from net.cc and has to =
updated =0A=
+// there in case of making any changes here. =0A=
+// The hack is done, because putting this class from net.cc into =
fhandler.h =0A=
+// needs some more work, which I cannot oversee yet. =0A=
+class wsock_event=0A=
+{=0A=
+  WSAEVENT		event;=0A=
+  WSAOVERLAPPED		ovr;=0A=
+public:=0A=
+  wsock_event () : event (NULL) {};=0A=
+  ~wsock_event ()=0A=
+    {=0A=
+      if (event)=0A=
+	WSACloseEvent (event);=0A=
+      event =3D NULL;=0A=
+    };=0A=
+=0A=
+  LPWSAOVERLAPPED prepare ();=0A=
+  int wait (int socket, LPDWORD flags);=0A=
+};=0A=
+=0A=
+=0A=
+int fhandler_socket::socket (int af, int type, int protocol)=0A=
+{=0A=
+	return -1; =0A=
+}=0A=
+=0A=
+int fhandler_socket::bind (const struct sockaddr *my_addr, int addrlen)=0A=
+{=0A=
+	int res =3D -1;=0A=
+	=0A=
+	if (my_addr->sa_family =3D=3D AF_LOCAL)=0A=
+	{=0A=
+#define un_addr ((struct sockaddr_un *) my_addr)=0A=
+	  struct sockaddr_in sin;=0A=
+	  int len =3D sizeof sin;=0A=
+=0A=
+	  if (strlen (un_addr->sun_path) >=3D UNIX_PATH_LEN)=0A=
+	    {=0A=
+	      set_errno (ENAMETOOLONG);=0A=
+	      goto out;=0A=
+	    }=0A=
+=0A=
+	  sin.sin_family =3D AF_INET;=0A=
+	  sin.sin_port =3D 0;=0A=
+	  sin.sin_addr.s_addr =3D htonl (INADDR_LOOPBACK);=0A=
+	  if (::bind (get_socket (), (sockaddr *) &sin, len))=0A=
+	    {=0A=
+	      syscall_printf ("AF_LOCAL: bind failed %d", get_errno ());=0A=
+	      set_winsock_errno ();=0A=
+	      goto out;=0A=
+	    }=0A=
+	  if (::getsockname (get_socket (), (sockaddr *) &sin, &len))=0A=
+	    {=0A=
+	      syscall_printf ("AF_LOCAL: getsockname failed %d", get_errno ());=0A=
+	      set_winsock_errno ();=0A=
+	      goto out;=0A=
+	    }=0A=
+=0A=
+	  sin.sin_port =3D ntohs (sin.sin_port);=0A=
+	  debug_printf ("AF_LOCAL: socket bound to port %u", sin.sin_port);=0A=
+=0A=
+	  /* bind must fail if file system socket object already exists=0A=
+	     so _open () is called with O_EXCL flag. */=0A=
+	  int _fd =3D _open (un_addr->sun_path,=0A=
+		      O_WRONLY | O_CREAT | O_EXCL | O_BINARY,=0A=
+		      0);=0A=
+	  if (_fd < 0)=0A=
+	    {=0A=
+	      if (get_errno () =3D=3D EEXIST)=0A=
+		set_errno (EADDRINUSE);=0A=
+	      goto out;=0A=
+	    }=0A=
+=0A=
+	  set_connect_secret ();=0A=
+=0A=
+	  char buf[sizeof (SOCKET_COOKIE) + 80];=0A=
+	  __small_sprintf (buf, "%s%u ", SOCKET_COOKIE, sin.sin_port);=0A=
+	  get_connect_secret (strchr (buf, '\0'));=0A=
+	  len =3D strlen (buf) + 1;=0A=
+=0A=
+	  /* Note that the terminating nul is written.  */=0A=
+	  if (_write (_fd, buf, len) !=3D len)=0A=
+	    {=0A=
+	      save_errno here;=0A=
+	      _close (_fd);=0A=
+	      _unlink (un_addr->sun_path);=0A=
+	    }=0A=
+	  else=0A=
+	    {=0A=
+	      _close (_fd);=0A=
+	      chmod (un_addr->sun_path,=0A=
+		(S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO) & ~cygheap->umask);=0A=
+	      set_sun_path (un_addr->sun_path);=0A=
+	      res =3D 0;=0A=
+	    }=0A=
+#undef un_addr=0A=
+	}=0A=
+      else if (::bind (get_socket (), my_addr, addrlen))=0A=
+	set_winsock_errno ();=0A=
+      else=0A=
+	res =3D 0;=0A=
+=0A=
+out:=0A=
+  return res;=0A=
+}=0A=
+=0A=
+int fhandler_socket::listen (int backlog)=0A=
+{    =0A=
+	int res =3D ::listen (get_socket (), backlog);=0A=
+  	if (res)=0A=
+	set_winsock_errno ();=0A=
+	return res;=0A=
+}=0A=
+=0A=
+int fhandler_socket::accept (struct sockaddr *peer, int *len)=0A=
+{=0A=
+  BOOL secret_check_failed =3D FALSE;=0A=
+  BOOL in_progress =3D FALSE;=0A=
+  sigframe thisframe (mainthread);=0A=
+	int res =3D -1;=0A=
+	{=0A=
+  /* Allows NULL peer and len parameters. */=0A=
+  struct sockaddr_in peer_dummy;=0A=
+  int len_dummy;=0A=
+=0A=
+	  if (!peer)=0A=
+	peer =3D (struct sockaddr *) &peer_dummy;=0A=
+      if (!len)=0A=
+	{=0A=
+	  len_dummy =3D sizeof (struct sockaddr_in);=0A=
+	  len =3D &len_dummy;=0A=
+	}=0A=
+=0A=
+      /* accept on NT fails if len < sizeof (sockaddr_in)=0A=
+       * some programs set len to=0A=
+       * sizeof (name.sun_family) + strlen (name.sun_path) for UNIX =
domain=0A=
+       */=0A=
+      if (len && ((unsigned) *len < sizeof (struct sockaddr_in)))=0A=
+	*len =3D sizeof (struct sockaddr_in);=0A=
+=0A=
+      res =3D ::accept (get_socket (), peer, len);  // can't use a =
blocking call inside a lock=0A=
+=0A=
+      if ((SOCKET) res =3D=3D (SOCKET) INVALID_SOCKET &&=0A=
+	  WSAGetLastError () =3D=3D WSAEWOULDBLOCK)=0A=
+	in_progress =3D TRUE;=0A=
+=0A=
+      if (get_addr_family () =3D=3D AF_LOCAL)=0A=
+	{=0A=
+	  if ((SOCKET) res !=3D (SOCKET) INVALID_SOCKET || in_progress)=0A=
+	    {=0A=
+	      if (!create_secret_event ())=0A=
+		secret_check_failed =3D TRUE;=0A=
+	      else if (in_progress)=0A=
+		signal_secret_event ();=0A=
+	    }=0A=
+=0A=
+	  if (!secret_check_failed &&=0A=
+	      (SOCKET) res !=3D (SOCKET) INVALID_SOCKET)=0A=
+	    {=0A=
+	      if (!check_peer_secret_event ((struct sockaddr_in*) peer))=0A=
+		{=0A=
+		  debug_printf ("connect from unauthorized client");=0A=
+		  secret_check_failed =3D TRUE;=0A=
+		}=0A=
+	    }=0A=
+=0A=
+	  if (secret_check_failed)=0A=
+	    {=0A=
+	      close_secret_event ();=0A=
+	      if ((SOCKET) res !=3D (SOCKET) INVALID_SOCKET)=0A=
+		closesocket (res);=0A=
+	      set_errno (ECONNABORTED);=0A=
+	      res =3D -1;=0A=
+	      goto done;=0A=
+	    }=0A=
+	}=0A=
+=0A=
+=0A=
+      cygheap_fdnew res_fd;=0A=
+      if (res_fd < 0)=0A=
+	/* FIXME: what is correct errno? */;=0A=
+      else if ((SOCKET) res =3D=3D (SOCKET) INVALID_SOCKET)=0A=
+	set_winsock_errno ();=0A=
+      else=0A=
+	{=0A=
+	  fhandler_socket* res_fh =3D fdsock (res_fd, get_name (), res);=0A=
+	  if (get_addr_family () =3D=3D AF_LOCAL)=0A=
+	    res_fh->set_sun_path (get_sun_path ());=0A=
+	  res_fh->set_addr_family (get_addr_family ());=0A=
+	  res =3D res_fd;=0A=
+	}=0A=
+ }=0A=
+ done:=0A=
+ 	return res; =0A=
+ }=0A=
+=0A=
+int fhandler_socket::recv (const void *buf, int len, unsigned int flags)=0A=
+{=0A=
+	int res =3D -1;=0A=
+  wsock_event wsock_evt;=0A=
+  LPWSAOVERLAPPED ovr;=0A=
+  sigframe thisframe (mainthread);=0A=
+=0A=
+    if (is_nonblocking () || !(ovr =3D wsock_evt.prepare ()))=0A=
+	{=0A=
+	  debug_printf ("Fallback to winsock 1 recv call");=0A=
+	  if ((res =3D ::recv (get_socket (), (char *) buf, len, flags))=0A=
+	      =3D=3D SOCKET_ERROR)=0A=
+	    {=0A=
+	      set_winsock_errno ();=0A=
+	      res =3D -1;=0A=
+	    }=0A=
+	}=0A=
+	    else=0A=
+	{=0A=
+	  WSABUF wsabuf =3D { len, (char *) buf };=0A=
+	  DWORD ret =3D 0;=0A=
+	  if (::WSARecv (get_socket (), &wsabuf, 1, &ret, (DWORD *)&flags,=0A=
+		       ovr, NULL) !=3D SOCKET_ERROR)=0A=
+	    res =3D ret;=0A=
+	  else if ((res =3D WSAGetLastError ()) !=3D WSA_IO_PENDING)=0A=
+	    {=0A=
+	      set_winsock_errno ();=0A=
+	      res =3D -1;=0A=
+	    }=0A=
+	  else if ((res =3D wsock_evt.wait (get_socket (), (DWORD *)&flags)) =
=3D=3D -1)=0A=
+	    set_winsock_errno ();=0A=
+	}=0A=
+	return res; =0A=
+}=0A=
+=0A=
+int fhandler_socket::send (const void *buf, int len, unsigned int flags)=0A=
+{=0A=
+  wsock_event wsock_evt;=0A=
+  LPWSAOVERLAPPED ovr;=0A=
+	int res =3D -1;=0A=
+  sigframe thisframe (mainthread);=0A=
+=0A=
+      if (is_nonblocking () || !(ovr =3D wsock_evt.prepare ()))=0A=
+	{=0A=
+	  debug_printf ("Fallback to winsock 1 send call");=0A=
+	  if ((res =3D ::send (get_socket (), (const char *) buf, len, flags))=0A=
+	      =3D=3D SOCKET_ERROR)=0A=
+	    {=0A=
+	      set_winsock_errno ();=0A=
+	      res =3D -1;=0A=
+	    }=0A=
+	}=0A=
+      else=0A=
+	{=0A=
+	  WSABUF wsabuf =3D { len, (char *) buf };=0A=
+	  DWORD ret =3D 0;=0A=
+	  if (::WSASend (get_socket (), &wsabuf, 1, &ret, (DWORD)flags,=0A=
+		       ovr, NULL) !=3D SOCKET_ERROR)=0A=
+	    res =3D ret;=0A=
+	  else if ((res =3D WSAGetLastError ()) !=3D WSA_IO_PENDING)=0A=
+	    {=0A=
+	      set_winsock_errno ();=0A=
+	      res =3D -1;=0A=
+	    }=0A=
+	  else if ((res =3D wsock_evt.wait (get_socket (), (DWORD *)&flags)) =
=3D=3D -1)=0A=
+	    set_winsock_errno ();=0A=
+	}=0A=
+	return res; =0A=
+}=0A=
+=0A=
+int fhandler_socket::connect (const struct sockaddr *name, int namelen) =0A=
+{=0A=
+  BOOL secret_check_failed =3D FALSE;=0A=
+  BOOL in_progress =3D FALSE;=0A=
+  sockaddr_in sin;=0A=
+  int secret [4];=0A=
+  sigframe thisframe (mainthread);=0A=
+=0A=
+	int res =3D ::connect (get_socket (), (sockaddr *) &sin, namelen);=0A=
+  if (res)=0A=
+	{=0A=
+	  /* Special handling for connect to return the correct error code=0A=
+	     when called on a non-blocking socket. */=0A=
+	  if (is_nonblocking ())=0A=
+	    {=0A=
+	      DWORD err =3D WSAGetLastError ();=0A=
+	      if (err =3D=3D WSAEWOULDBLOCK || err =3D=3D WSAEALREADY)=0A=
+		{=0A=
+		  WSASetLastError (WSAEINPROGRESS);=0A=
+		  in_progress =3D TRUE;=0A=
+		}=0A=
+	      else if (err =3D=3D WSAEINVAL)=0A=
+		WSASetLastError (WSAEISCONN);=0A=
+	    }=0A=
+	  set_winsock_errno ();=0A=
+	}=0A=
+      if (get_addr_family () =3D=3D AF_LOCAL)=0A=
+	{=0A=
+	  if (!res || in_progress)=0A=
+	    {=0A=
+	      if (!create_secret_event (secret))=0A=
+		{=0A=
+		  secret_check_failed =3D TRUE;=0A=
+		}=0A=
+	      else if (in_progress)=0A=
+		signal_secret_event ();=0A=
+	    }=0A=
+=0A=
+	  if (!secret_check_failed && !res)=0A=
+	    {=0A=
+	      if (!check_peer_secret_event (&sin, secret))=0A=
+		{=0A=
+		  debug_printf ( "accept from unauthorized server" );=0A=
+		  secret_check_failed =3D TRUE;=0A=
+		}=0A=
+	   }=0A=
+=0A=
+	  if (secret_check_failed)=0A=
+	    {=0A=
+	      close_secret_event ();=0A=
+	      if (res)=0A=
+		closesocket (res);=0A=
+	      set_errno (ECONNREFUSED);=0A=
+	      res =3D -1;=0A=
+	    }=0A=
+	}=0A=
+	return res; =0A=
+}=0A=
+=0A=
+int fhandler_socket::shutdown (int how)=0A=
+{=0A=
+	int res =3D ::shutdown (get_socket (), how);=0A=
+      if (res)=0A=
+	set_winsock_errno ();=0A=
+      else=0A=
+	switch (how)=0A=
+	  {=0A=
+	  case SHUT_RD:=0A=
+	    set_shutdown_read ();=0A=
+	    break;=0A=
+	  case SHUT_WR:=0A=
+	    set_shutdown_write ();=0A=
+	    break;=0A=
+	  case SHUT_RDWR:=0A=
+	    set_shutdown_read ();=0A=
+	    set_shutdown_write ();=0A=
+	    break;=0A=
+	  }=0A=
+	return res;=0A=
+}=0A=
+=0A=
+int fhandler_socket::getsockname (struct sockaddr *addr, int *namelen)=0A=
+{=0A=
+	int res =3D -1; =0A=
+=0A=
+	if (get_addr_family () =3D=3D AF_LOCAL)=0A=
+	{=0A=
+	  struct sockaddr_un *sun =3D (struct sockaddr_un *) addr;=0A=
+	  memset (sun, 0, *namelen);=0A=
+	  sun->sun_family =3D AF_LOCAL;=0A=
+	  /* According to SUSv2 "If the actual length of the address is greater=0A=
+	     than the length of the supplied sockaddr structure, the stored=0A=
+	     address will be truncated."  We play it save here so that the=0A=
+	     path always has a trailing 0 even if it's truncated. */=0A=
+	  strncpy (sun->sun_path, get_sun_path (),=0A=
+		   *namelen - sizeof *sun + sizeof sun->sun_path - 1);=0A=
+	  *namelen =3D sizeof *sun - sizeof sun->sun_path=0A=
+		     + strlen (sun->sun_path) + 1;=0A=
+	  res =3D 0;=0A=
+	}=0A=
+      else=0A=
+	{=0A=
+	  res =3D ::getsockname (get_socket (), addr, namelen);=0A=
+	  if (res)=0A=
+	    set_winsock_errno ();=0A=
+	}=0A=
+	return res; =0A=
+}=0A=
+=0A=
+int fhandler_socket::getpeername (struct sockaddr *name, int *len)=0A=
+{=0A=
+	int res =3D ::getpeername (get_socket (), name, len);=0A=
+      if (res)=0A=
+	set_winsock_errno ();    =0A=
+  return res; =0A=
+}=0A=
+=0A=
+#endif =0A=
+=0A=
Index: cygwin-daemon//ipc.cc=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cygwin/Attic/ipc.cc,v=0A=
retrieving revision 1.1.2.1=0A=
diff -u -b -B -r1.1.2.1 ipc.cc=0A=
--- ipc.cc	2001/09/25 06:31:04	1.1.2.1=0A=
+++ ipc.cc	2002/02/10 20:28:55=0A=
@@ -22,7 +22,7 @@=0A=
 ftok(const char *path, int id)=0A=
 {=0A=
   struct stat statbuf;=0A=
-  if (stat(path, &statbuf))=0A=
+  if (stat(path, &statbuf) < 0)=0A=
     {=0A=
       /* stat set the appropriate errno for us */=0A=
       return (key_t) -1;=0A=
Index: cygwin-daemon//net.cc=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cygwin/net.cc,v=0A=
retrieving revision 1.77.2.3=0A=
diff -u -b -B -r1.77.2.3 net.cc=0A=
--- net.cc	2002/01/22 04:52:40	1.77.2.3=0A=
+++ net.cc	2002/02/10 20:29:01=0A=
@@ -879,6 +878,9 @@=0A=
   if (!sock)=0A=
     res =3D -1;=0A=
   else=0A=
+#ifdef NEW_NET =0A=
+		res =3D sock->connect(name,namelen);=0A=
+#else =0A=
     {=0A=
       res =3D connect (sock->get_socket (), (sockaddr *) &sin, namelen);=0A=
       if (res)=0A=
@@ -929,6 +931,7 @@=0A=
 	    }=0A=
 	}=0A=
     }=0A=
+#endif =0A=
   return res;=0A=
 }=0A=
 =0A=
@@ -1191,6 +1194,9 @@=0A=
 =0A=
   fhandler_socket *sock =3D get (fd);=0A=
   if (sock)=0A=
+#ifdef NEW_NET=0A=
+  	res =3D sock->accept(peer,len);=0A=
+#else =0A=
     {=0A=
       /* Allows NULL peer and len parameters. */=0A=
       struct sockaddr_in peer_dummy;=0A=
@@ -1263,6 +1269,7 @@=0A=
 	}=0A=
     }=0A=
  done:=0A=
+#endif =0A=
   syscall_printf ("%d =3D accept (%d, %x, %x)", res, fd, peer, len);=0A=
   return res;=0A=
 }=0A=
@@ -1278,6 +1285,9 @@=0A=
 =0A=
   fhandler_socket *sock =3D get (fd);=0A=
   if (sock)=0A=
+#ifdef NEW_NET=0A=
+  	res =3D sock->bind(my_addr,addrlen);=0A=
+#else =0A=
     {=0A=
       if (my_addr->sa_family =3D=3D AF_LOCAL)=0A=
 	{=0A=
@@ -1352,6 +1362,8 @@=0A=
 	res =3D 0;=0A=
     }=0A=
 =0A=
+#endif =0A=
+=0A=
 out:=0A=
   syscall_printf ("%d =3D bind (%d, %x, %d)", res, fd, my_addr, =
addrlen);=0A=
   return res;=0A=
@@ -1369,6 +1381,9 @@=0A=
 =0A=
   fhandler_socket *sock =3D get (fd);=0A=
   if (sock)=0A=
+#ifdef NEW_NET=0A=
+  	res =3D sock->getsockname(addr,namelen);=0A=
+#else =0A=
     {=0A=
       if (sock->get_addr_family () =3D=3D AF_LOCAL)=0A=
 	{=0A=
@@ -1392,6 +1407,7 @@=0A=
 	    set_winsock_errno ();=0A=
 	}=0A=
     }=0A=
+#endif =0A=
   syscall_printf ("%d =3D getsockname (%d, %x, %d)", res, fd, addr, =
namelen);=0A=
   return res;=0A=
 }=0A=
@@ -1405,11 +1421,15 @@=0A=
 =0A=
   fhandler_socket *sock =3D get (fd);=0A=
   if (sock)=0A=
+#ifdef NEW_NET=0A=
+  	res =3D sock->listen(backlog);=0A=
+#else =0A=
     {=0A=
       res =3D listen (sock->get_socket (), backlog);=0A=
       if (res)=0A=
 	set_winsock_errno ();=0A=
     }=0A=
+#endif =0A=
   syscall_printf ("%d =3D listen (%d, %d)", res, fd, backlog);=0A=
   return res;=0A=
 }=0A=
@@ -1423,6 +1443,9 @@=0A=
 =0A=
   fhandler_socket *sock =3D get (fd);=0A=
   if (sock)=0A=
+#ifdef NEW_NET=0A=
+  	res =3D sock->shutdown(how);=0A=
+#else =0A=
     {=0A=
       res =3D shutdown (sock->get_socket (), how);=0A=
       if (res)=0A=
@@ -1442,6 +1465,7 @@=0A=
 	    break;=0A=
 	  }=0A=
     }=0A=
+#endif =0A=
   syscall_printf ("%d =3D shutdown (%d, %d)", res, fd, how);=0A=
   return res;=0A=
 }=0A=
@@ -1507,12 +1530,15 @@=0A=
   if (!h)=0A=
     res =3D -1;=0A=
   else=0A=
+#ifdef NEW_NET=0A=
+  	res =3D h->getpeername(name,len);=0A=
+#else =0A=
     {=0A=
       res =3D getpeername (h->get_socket (), name, len);=0A=
       if (res)=0A=
 	set_winsock_errno ();=0A=
     }=0A=
-=0A=
+#endif =0A=
   debug_printf ("%d =3D getpeername %d", res, h->get_socket ());=0A=
   return res;=0A=
 }=0A=
@@ -1529,6 +1555,9 @@=0A=
   if (__check_null_invalid_struct_errno (buf, len) || !h)=0A=
     res =3D -1;=0A=
   else=0A=
+#ifdef NEW_NET=0A=
+  	res =3D h->recv(buf,len,flags);=0A=
+#else =0A=
     {=0A=
       sigframe thisframe (mainthread);=0A=
 =0A=
@@ -1558,7 +1587,7 @@=0A=
 	    set_winsock_errno ();=0A=
 	}=0A=
     }=0A=
-=0A=
+#endif 					    =0A=
   syscall_printf ("%d =3D recv (%d, %x, %x, %x)", res, fd, buf, len, =
flags);=0A=
 =0A=
   return res;=0A=
@@ -1576,6 +1605,9 @@=0A=
   if (__check_invalid_read_ptr_errno (buf, len) || !h)=0A=
     res =3D -1;=0A=
   else=0A=
+#ifdef NEW_NET=0A=
+  	res =3D h->send(buf,len,flags);=0A=
+#else =0A=
     {=0A=
       sigframe thisframe (mainthread);=0A=
 =0A=
@@ -1606,6 +1638,7 @@=0A=
 	}=0A=
     }=0A=
 =0A=
+#endif =0A=
   syscall_printf ("%d =3D send (%d, %x, %d, %x)", res, fd, buf, len, =
flags);=0A=
 =0A=
   return res;=0A=

------=_NextPart_000_0057_01C1B3CE.A91E1380
Content-Type: application/octet-stream;
	name="Makefile.common-daemon"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="Makefile.common-daemon"

# Makefile.common - common definitions for the winsup directory=0A=
#=0A=
# Copyright 2000, 2001 Red Hat, Inc.=0A=
#=0A=
# This file is part of Cygwin.=0A=
#=0A=
# This software is a copyrighted work licensed under the terms of the=0A=
# Cygwin license.  Please consult the file "CYGWIN_LICENSE" for=0A=
# details.=0A=
=0A=
# This makefile requires GNU make.=0A=
=0A=
CFLAGS_COMMON:=3D-Wall -Wwrite-strings -fno-common -pipe -Winline =
-fbuiltin# -finline-functions=0A=
MALLOC_DEBUG:=3D#-DMALLOC_DEBUG =
-I/cygnus/src/uberbaum/winsup/cygwin-daemon/dlmalloc=0A=
MALLOC_OBJ:=3D#/cygnus/src/uberbaum/winsup/cygwin-daemon/dlmalloc/malloc.=
o=0A=
=0A=
override srcdir:=3D${shell cd $(srcdir); pwd}=0A=
ifneq (,${filter-out /%,$(srcdir)})=0A=
    updir:=3D$(srcdir)/..=0A=
    updir1:=3D$(updir)/..=0A=
else=0A=
    updir:=3D${patsubst %:::,%,${patsubst %/:::,%,$(dir $(srcdir)):::}}=0A=
ifneq (,${findstring /,$(updir)})=0A=
    updir1:=3D${patsubst %:::,%,${patsubst %/:::,%,$(dir $(updir)):::}}=0A=
else=0A=
    updir1:=3D$(updir)/..=0A=
endif=0A=
endif=0A=
=0A=
pwd:=3D${shell pwd}=0A=
ifneq "${filter winsup%,${notdir $(pwd)}}" ""=0A=
a:=3D${shell ${filter winsup%,${notdir $(pwd)}} >/dev/tty}=0A=
    here:=3D${pwd}/cygwin=0A=
else=0A=
a:=3D${shell ${filter winsup%,${notdir $(pwd)}} >/dev/tty}=0A=
    here:=3D${dir $(pwd)}cygwin=0A=
endif=0A=
bupdir:=3D${shell cd $(here)/..; pwd}=0A=
ifneq (,${filter-out /%,$(bupdir)})=0A=
    bupdir1:=3D../..=0A=
    bupdir2:=3D../../..=0A=
else=0A=
ifneq (,${findstring /,$(bupdir)})=0A=
    bupdir1:=3D${patsubst %:::,%,${patsubst %/:::,%,$(dir $(bupdir)):::}}=0A=
else=0A=
    bupdir1:=3D$(bupdir)/..=0A=
endif=0A=
ifneq (,${findstring /,$(bupdir1)})=0A=
    bupdir2:=3D${patsubst %:::,%,${patsubst %/:::,%,$(dir =
$(bupdir1)):::}}=0A=
else=0A=
    bupdir2:=3D$(bupdir1)/..=0A=
endif=0A=
endif=0A=
=0A=
zlib_source:=3D$(updir)/zlib=0A=
zlib_build:=3D$(bupdir)/zlib=0A=
bz2lib_source:=3D$(updir)/bz2lib=0A=
bz2lib_build:=3D$(bupdir)/bz2lib=0A=
w32api_source:=3D$(updir)/w32api=0A=
w32api_build:=3D$(bupdir)/w32api=0A=
ifeq (,${findstring $(w32api_source),$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})=0A=
w32api_include:=3D-I$(w32api_source)/include=0A=
endif=0A=
w32api_lib:=3D$(w32api_build)/lib=0A=
newlib_source:=3D$(updir1)/newlib=0A=
newlib_build:=3D$(bupdir1)/newlib=0A=
cygwin_build:=3D$(bupdir)/cygwin-daemon=0A=
cygwin_source:=3D$(updir)/cygwin-daemon=0A=
mingw_build:=3D$(bupdir)/mingw=0A=
mingw_source:=3D$(updir)/mingw=0A=
utils_build:=3D$(bupdir)/utils=0A=
utils_source:=3D$(updir)/utils=0A=
ifeq (,${findstring $(newlib_source)/libc/include,$(CFLAGS) $(CXXFLAGS) =
$(CXX) $(CC)})=0A=
newlib_include:=3D-I$(newlib_source)/libc/include=0A=
endif=0A=
ifeq (,${findstring $(newlib_source)/libc/sys/cygwin,$(CFLAGS) =
$(CXXFLAGS) $(CXX) $(CC)})=0A=
newlib_sys_include:=3D-I$(newlib_source)/libc/sys/cygwin=0A=
endif=0A=
ifeq (,${findstring $(newlib_source)/libc/sys/cygwin/include,$(CFLAGS) =
$(CXXFLAGS) $(CXX) $(CC)})=0A=
newlib_sys_include_include:=3D-I$(newlib_source)/libc/sys/cygwin/include=0A=
endif=0A=
ifeq (,${findstring $(cygwin_source)/include,$(CFLAGS) $(CXXFLAGS) =
$(CXX) $(CC)})=0A=
cygwin_include:=3D-I$(cygwin_source)/include=0A=
endif=0A=
=0A=
INCLUDES:=3D-I. $(cygwin_include) -I$(cygwin_source) =
$(newlib_sys_include) $(newlib_include)  $(newlib_sys_include_include) =
$(w32api_include)=0A=
ifdef CONFIG_DIR=0A=
INCLUDES+=3D-I$(CONFIG_DIR)=0A=
endif=0A=
=0A=
MINGW_INCLUDES:=3D-I$(updir)/mingw/include $(INCLUDES)=0A=
=0A=
GCC_DEFAULT_OPTIONS:=3D$(CFLAGS_COMMON) $(CFLAGS_CONFIG) $(INCLUDES)=0A=
=0A=
# Link in libc and libm from newlib=0A=
=0A=
LIBC:=3D$(newlib_build)/libc/libc.a=0A=
LIBM:=3D$(newlib_build)/libm/libm.a=0A=
CRT0:=3D$(newlib_build)/libc/crt0.o=0A=
=0A=
ALL_CFLAGS:=3D$(DEFS) $(MALLOC_DEBUG) $(CFLAGS) $(GCC_DEFAULT_OPTIONS)=0A=
ALL_CXXFLAGS:=3D$(DEFS) $(MALLOC_DEBUG) $(CXXFLAGS) =
$(GCC_DEFAULT_OPTIONS)=0A=
=0A=
ifndef PREPROCESS=0A=
c=3D-c=0A=
o=3D.o=0A=
else=0A=
c=3D-E=0A=
o=3D.E=0A=
endif=0A=
=0A=
libgcc:=3D${subst \,/,${shell $(CC_FOR_TARGET) -print-libgcc-file-name}}=0A=
gcc_libdir:=3D${word 1,${dir $(libgcc)}}=0A=
ifeq (,${findstring $(gcc_libdir),$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})=0A=
GCC_INCLUDE:=3D-I$(gcc_libdir)/include=0A=
endif=0A=
=0A=
COMPILE_CXX:=3D$(CXX) $c -nostdinc++ -nostdinc $(ALL_CXXFLAGS) =
$(GCC_INCLUDE) \=0A=
	     -fno-rtti -fno-exceptions=0A=
COMPILE_CC:=3D$(CC) $c -nostdinc $(ALL_CFLAGS) $(GCC_INCLUDE)=0A=
=0A=
vpath %.a	=
$(cygwin_build):$(w32api_lib):$(newlib_build)/libc:$(newlib_build)/libm=0A=
=0A=
MAKEOVERRIDES_WORKAROUND=3D${wordlist 2,1,a b c}=0A=
=0A=
ifneq ($(MAKEOVERRIDES_WORKAROUND),)=0A=
    override MAKE:=3D$(MAKE) $(MAKEOVERRIDES)=0A=
    MAKEOVERRIDES:=3D=0A=
    export MAKEOVERRIDES=0A=
endif=0A=
=0A=
ifdef RPATH_ENVVAR=0A=
VERBOSE=3D1=0A=
endif=0A=
=0A=
ifneq "${findstring -B,$(COMPILE_CXX) $(COMPILE_CC)}" ""=0A=
VERBOSE=3D1=0A=
endif=0A=
=0A=
.PRECIOUS: %.o=0A=
=0A=
%.o: %.cc=0A=
ifdef VERBOSE=0A=
	$(COMPILE_CXX) -o $(@D)/$(*F)$o $<=0A=
else=0A=
	@echo $(CXX) $c $(CXXFLAGS) ... $(*F).cc=0A=
	@$(COMPILE_CXX) -o $(@D)/$(*F)$o $<=0A=
endif=0A=
=0A=
%.o: %.c=0A=
ifdef VERBOSE=0A=
	$(COMPILE_CC) -o $(@D)/$(*F)$o $<=0A=
else=0A=
	@echo $(CC) $c $(CFLAGS) ... $(*F).c=0A=
	@$(COMPILE_CC) -o $(@D)/$(*F)$o $<=0A=
endif=0A=
=0A=
$(bupdir1)/libiberty/%.o: $(updir1)/libiberty/%.c=0A=
	@$(MAKE) -C $(@D) $(@F)=0A=
=0A=
$(w32api_lib)/%.a: $(w32api_lib)/Makefile=0A=
	@$(MAKE) --no-print-dir -C $(@D) $(@F)=0A=
=0A=
$(bz2lib)/%.a: $(bz2lib)/Makefile=0A=
	@$(MAKE) --no-print-dir -C $(@D) $(@F)=0A=
=0A=
$(zlib)/%.a: $(zlib)/Makefile=0A=
	@$(MAKE) --no-print-dir -C $(@D) $(@F)=0A=
=0A=
all:=0A=
=0A=
# For auto-rebuilding the Makefile=0A=
=0A=
.PRECIOUS: Makefile=0A=
=0A=
Makefile: Makefile.in $(srcdir)/configure.in config.status=0A=
	$(SHELL) config.status=0A=
=0A=
config.status: configure=0A=
	$(SHELL) config.status --recheck=0A=


------=_NextPart_000_0057_01C1B3CE.A91E1380
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
------=_NextPart_000_0057_01C1B3CE.A91E1380--


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019