From: "Martin M. Hunt" <hunt@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] gdbserver removal of getprotobyname()
Date: Tue, 19 Mar 2002 18:39:00 -0000 [thread overview]
Message-ID: <200203200239.g2K2dPi16932@localhost.localdomain> (raw)
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 */
next reply other threads:[~2002-03-20 2:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-19 18:39 Martin M. Hunt [this message]
2002-03-19 20:48 ` Daniel Jacobowitz
2002-03-20 12:32 ` Andrew Cagney
2002-03-20 18:16 ` Martin M. Hunt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200203200239.g2K2dPi16932@localhost.localdomain \
--to=hunt@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox