Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] gdbserver removal of getprotobyname()
@ 2002-03-19 18:39 Martin M. Hunt
  2002-03-19 20:48 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Martin M. Hunt @ 2002-03-19 18:39 UTC (permalink / raw)
  To: gdb-patches

I posted this as part of a discussion but never 
formally submitted a patch for approval.

Embedded implementations of TCP often don't implement 
getprotobyname() because it is expensive, slow, and 
generally useless. So remove it.

-- 
Martin Hunt
GDB Engineer
Red Hat, Inc.

2002-03-19  Martin M. Hunt  <hunt@redhat.com>

	* gdbserver/remote-utils.c (remote_open): Don't call
	getprotobyname, we're all using TCP here so just use
	IPPROTO_TCP.
	* gdbserver/gdbreplay.c (remote_open): Ditto.	

Index: gdbreplay.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/gdbreplay.c,v
retrieving revision 1.4
diff -u -u -r1.4 gdbreplay.c
--- gdbreplay.c	2001/03/06 08:21:43	1.4
+++ gdbreplay.c	2002/03/20 02:37:02
@@ -97,7 +97,6 @@
       int port;
       struct sockaddr_in sockaddr;
       int tmp;
-      struct protoent *protoent;
       int tmp_desc;
 
       port_str = strchr (name, ':');
@@ -126,10 +125,6 @@
       if (remote_desc == -1)
 	perror_with_name ("Accept failed");
 
-      protoent = getprotobyname ("tcp");
-      if (!protoent)
-	perror_with_name ("getprotobyname");
-
       /* Enable TCP keep alive process. */
       tmp = 1;
       setsockopt (tmp_desc, SOL_SOCKET, SO_KEEPALIVE, (char *) &tmp, sizeof (tmp));
@@ -137,7 +132,7 @@
       /* Tell TCP not to delay small packets.  This greatly speeds up
          interactive response. */
       tmp = 1;
-      setsockopt (remote_desc, protoent->p_proto, TCP_NODELAY,
+      setsockopt (remote_desc, IPPROTO_TCP, TCP_NODELAY,
 		  (char *) &tmp, sizeof (tmp));
 
       close (tmp_desc);		/* No longer need this */
Index: remote-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/remote-utils.c,v
retrieving revision 1.9
diff -u -u -r1.9 remote-utils.c
--- remote-utils.c	2002/03/13 20:42:16	1.9
+++ remote-utils.c	2002/03/20 02:37:02
@@ -107,7 +107,6 @@
       int port;
       struct sockaddr_in sockaddr;
       int tmp;
-      struct protoent *protoent;
       int tmp_desc;
 
       port_str = strchr (name, ':');
@@ -136,10 +135,6 @@
       if (remote_desc == -1)
 	perror_with_name ("Accept failed");
 
-      protoent = getprotobyname ("tcp");
-      if (!protoent)
-	perror_with_name ("getprotobyname");
-
       /* Enable TCP keep alive process. */
       tmp = 1;
       setsockopt (tmp_desc, SOL_SOCKET, SO_KEEPALIVE, (char *) &tmp, sizeof (tmp));
@@ -147,7 +142,7 @@
       /* Tell TCP not to delay small packets.  This greatly speeds up
          interactive response. */
       tmp = 1;
-      setsockopt (remote_desc, protoent->p_proto, TCP_NODELAY,
+      setsockopt (remote_desc, IPPROTO_TCP, TCP_NODELAY,
 		  (char *) &tmp, sizeof (tmp));
 
       close (tmp_desc);		/* No longer need this */



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] gdbserver removal of getprotobyname()
  2002-03-19 18:39 [RFA] gdbserver removal of getprotobyname() Martin M. Hunt
@ 2002-03-19 20:48 ` Daniel Jacobowitz
  2002-03-20 12:32   ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-03-19 20:48 UTC (permalink / raw)
  To: gdb-patches

On Tue, Mar 19, 2002 at 06:39:25PM -0800, Martin M. Hunt wrote:
> I posted this as part of a discussion but never 
> formally submitted a patch for approval.
> 
> Embedded implementations of TCP often don't implement 
> getprotobyname() because it is expensive, slow, and 
> generally useless. So remove it.

(I can't approve it but) thanks for taking care of this.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] gdbserver removal of getprotobyname()
  2002-03-19 20:48 ` Daniel Jacobowitz
@ 2002-03-20 12:32   ` Andrew Cagney
  2002-03-20 18:16     ` Martin M. Hunt
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2002-03-20 12:32 UTC (permalink / raw)
  To: Daniel Jacobowitz, Martin M. Hunt; +Cc: gdb-patches

> On Tue, Mar 19, 2002 at 06:39:25PM -0800, Martin M. Hunt wrote:
> 
>> I posted this as part of a discussion but never 
>> formally submitted a patch for approval.
>> 
>> Embedded implementations of TCP often don't implement 
>> getprotobyname() because it is expensive, slow, and 
>> generally useless. So remove it.
> 
> 
> (I can't approve it but) thanks for taking care of this.

Yes, fine.

Andrew




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] gdbserver removal of getprotobyname()
  2002-03-20 12:32   ` Andrew Cagney
@ 2002-03-20 18:16     ` Martin M. Hunt
  0 siblings, 0 replies; 4+ messages in thread
From: Martin M. Hunt @ 2002-03-20 18:16 UTC (permalink / raw)
  To: Andrew Cagney, Daniel Jacobowitz; +Cc: gdb-patches

On Wednesday 20 March 2002 12:32 pm, Andrew Cagney wrote:
> > On Tue, Mar 19, 2002 at 06:39:25PM -0800, Martin M. Hunt wrote:
> >> I posted this as part of a discussion but never
> >> formally submitted a patch for approval.
> >>
> >> Embedded implementations of TCP often don't implement
> >> getprotobyname() because it is expensive, slow, and
> >> generally useless. So remove it.
> >
> > (I can't approve it but) thanks for taking care of this.
>
> Yes, fine.
>
> Andrew

Committed

-- 
Martin Hunt
GDB Engineer
Red Hat, Inc.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-03-21  2:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-19 18:39 [RFA] gdbserver removal of getprotobyname() Martin M. Hunt
2002-03-19 20:48 ` Daniel Jacobowitz
2002-03-20 12:32   ` Andrew Cagney
2002-03-20 18:16     ` Martin M. Hunt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox