Hello community,
here is the log from the commit of package rds-tools
checked in at Fri Aug 24 02:00:36 CEST 2007.
--------
--- rds-tools/rds-tools.changes 2007-07-06 11:16:31.000000000 +0200
+++ /mounts/work_src_done/STABLE/rds-tools/rds-tools.changes 2007-08-21 12:38:59.000000000 +0200
@@ -1,0 +2,5 @@
+Tue Aug 21 12:38:49 CEST 2007 - hvogel@suse.de
+
+- Update to version from OFED 1.2.5
+
+-------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rds-tools.spec ++++++
--- /var/tmp/diff_new_pack.r13283/_old 2007-08-24 02:00:20.000000000 +0200
+++ /var/tmp/diff_new_pack.r13283/_new 2007-08-24 02:00:20.000000000 +0200
@@ -11,9 +11,9 @@
# norootforbuild
Name: rds-tools
-Summary: RDS support tools
+Summary: RDS Support Tools
Version: 1.0
-Release: 1
+Release: 12
License: BSD 3-Clause, GPL v2 only
Group: System/Console
URL: http://www.openfabrics.org
@@ -53,5 +53,7 @@
%{_mandir}/man1/*
%changelog
+* Tue Aug 21 2007 - hvogel@suse.de
+- Update to version from OFED 1.2.5
* Fri Jul 06 2007 - hvogel@suse.de
- Initial Package, Version 1.0
++++++ rds-tools-1.0.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/rds-tools-1.0/COPYING new/rds-tools-1.0/COPYING
--- old/rds-tools-1.0/COPYING 2007-07-06 13:24:19.000000000 +0200
+++ new/rds-tools-1.0/COPYING 2007-08-21 12:36:28.000000000 +0200
@@ -1,8 +1,9 @@
+
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111 USA
+ 675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -305,7 +306,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/rds-tools-1.0/Makefile new/rds-tools-1.0/Makefile
--- old/rds-tools-1.0/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ new/rds-tools-1.0/Makefile 2007-08-12 14:47:21.000000000 +0200
@@ -0,0 +1,81 @@
+
+all: all-programs
+
+CFLAGS = -O2 -Wall
+CPPFLAGS = -DDEBUG_EXE -MD -MP -MF $(@D)/.$(basename $(@F)).d
+
+HEADERS = kernel-list.h rdstool.h pfhack.h
+COMMON_SOURCES = options.c stats.c pfhack.c
+SOURCES = $(addsuffix .c,$(PROGRAMS)) $(COMMON_SOURCES)
+CLEAN_OBJECTS = $(addsuffix .o,$(PROGRAMS)) $(subst .c,.o,$(COMMON_SOURCES))
+
+# This is the default
+DYNAMIC_PF_RDS = true
+
+ifneq ($(DYNAMIC_PF_RDS),)
+CPPFLAGS += -DDYNAMIC_PF_RDS
+COMMON_OBJECTS = $(subst .c,.o,$(COMMON_SOURCES))
+else
+COMMON_OBJECTS = $(subst .c,.o,$(filter-out pfhack.c,$(COMMON_SOURCES)))
+endif
+
+PROGRAMS = rds-gen rds-sink rds-info rds-stress
+
+all-programs: $(PROGRAMS)
+
+clean:
+ rm -f $(PROGRAMS) $(CLEAN_OBJECTS)
+
+distclean: clean
+ rm -f .*.d
+
+
+
+$(PROGRAMS) : % : %.o $(COMMON_OBJECTS)
+ gcc $(CFLAGS) $(LDFLAGS) -o $@ $^
+
+LOCAL_DFILES := $(wildcard .*.d)
+ifneq ($(LOCAL_DFILES),)
+.PHONY: $(LOCAL_DFILES)
+-include $(LOCAL_DFILES)
+endif
+
+VERSION := 1.0
+RELEASE := 20
+
+TAR_PREFIX := rds-tools-$(VERSION)-$(RELEASE)
+TAR_FILE := $(TAR_PREFIX).tar.gz
+
+EXTRA_DIST := rds-info.1 \
+ rds-gen.1 \
+ rds-sink.1 \
+ rds-stress.1 \
+ Makefile.in \
+ rds-tools.spec.in \
+ configure.in \
+ README \
+ rds-tools.txt
+
+DISTFILES := $(SOURCES) $(HEADERS) $(EXTRA_DIST)
+
+$(TAR_FILE): Makefile rds-tools.spec
+ @rm -rf $@ $(TAR_PREFIX) || :
+ @mkdir $(TAR_PREFIX)
+ for a in $^ $(DISTFILES); do \
+ if [ ! -f $$a ]; then \
+ continue; \
+ fi; \
+ targ=$(TAR_PREFIX)/$$(dirname $$a); \
+ mkdir -p $$targ; \
+ cp $$a $$targ; \
+ done
+
+ tar -zcf $@ $(TAR_PREFIX)
+
+.PHONY: rpm
+rpm: $(TAR_FILE)
+ rpmbuild -ta $^
+
+.PHONY: dist
+dist: $(TAR_FILE)
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/rds-tools-1.0/rds-info.1 new/rds-tools-1.0/rds-info.1
--- old/rds-tools-1.0/rds-info.1 2007-07-06 11:09:17.000000000 +0200
+++ new/rds-tools-1.0/rds-info.1 2007-08-12 14:47:21.000000000 +0200
@@ -3,19 +3,21 @@
.Os
.Sh NAME
.Nm rds-info
-.Nd display information about RDS on the system
+.Nd display information from the RDS kernel module
.Pp
.Sh SYNOPSIS
.Nm rds-info
.Bk -words
-.Op Fl cfknrst
+.Op Fl cknrstT
.Sh DESCRIPTION
The
.Nm
utility presents various sources of information that
-the RDS subsystem maintains. The options specify which
-information source to display. Only one may be specified.
+the RDS kernel module maintains. When run without any optional arguments
+.Nm
+will output all the information it knows of. When options are specified then
+only the information associated with those options is displayed.
The options are as follows:
.Bl -tag -width Ds
@@ -24,41 +26,54 @@
occurs. The counters may not be reset. The set of supported counters
may change over time.
-.Dl # /var/zab/rds-tools/rds-info -c
-.Dl ack_entry_hit : 0
-.Dl ...
-
-.It Fl f
-Display all the flows in the system. When a message is queued for
-transmission on a socket it creates a flow from its source address
-and port to its destination address and port. Each flow is displayed
-on one line. Following its source and destination address and ports is
-the number of bytes that are queued for transmission in messages on
-that flow.
-
-.Dl # rds-info -f
-.Dl 127.0.0.1 11111 127.0.0.1 22222 0
-.Dl ...
+.Bl -tag -width 4
+.It CounterName
+The name of the counter. These names come from the kernel and can change
+depending on the capability of the kernel module.
+.It Value
+The number of times that the counter has been incremented since the kernel
+module was loaded.
+.El
.It Fl k
-Display all the RDS sockets in the system. Each socket displays first the
-address and port it is bound to, if any, and then address and port that it is
-connected to, if any, and then the default send buffer size. There will always
-be one socket listed that is neither bound to nor connected to any addresses --
-that is rds-info using an unbound socket to collect information.
+Display all the RDS sockets in the system. There will always be one socket
+listed that is neither bound to nor connected to any addresses because
+.Nm
+itself uses an unbound socket to collect information.
-.Dl # rds-info -k
-.Dl 0.0.0.0 0 0.0.0.0 0 262144
+.Bl -tag -width 4
+.It BoundAddr, BPort
+The IP address and port that the socket is bound to. 0.0.0.0 0 indicates that
+the socket has not been bound.
+.It ConnAddr, CPort
+The IP address and port that the socket is connected to. 0.0.0.0 0 indicates
+that the socket has not been connected.
+.It SndBuf, RcvBuf
+The number of bytes of message payload which can be queued for sending or
+receiving on the socket, respectively.
+.El
.It Fl n
Display all RDS connections. RDS connections are maintained between
-nodes by transports. Each connection lists the local and remote addresses
-followed by the next sequence number that will be assigned to the next
-sent message. Next comes the last sequence number that was received in
-an incoming message. A series of flags indicates the status of the
-connection:
+nodes by transports.
.Bl -tag -width 4
+.It LocalAddr
+The IP address of this node. For connections that originate and terminate on
+the same node the local address indicates which address initiated the
+connection establishment.
+.It RemoteAddr
+The IP address of the remote end of the connection.
+.It NextTX
+The sequence number that will be given to the next message that is sent
+over the connection.
+.It NextRX
+The sequence number that is expected from the next message to arrive over
+the connection. Any incoming messages with sequence numbers less than this
+will be dropped.
+.It Flg
+Flags which indicate the state of the connection.
+.Bl -tag -width 4
.It s
A process is currently sending a message down the connection.
.It c
@@ -66,34 +81,54 @@
.It C
The connection to the remote host is connected and active.
.El
+.El
+
+.It Fl r, Fl s, Fl t
+Display the messages in the receive, send, or retransmit queues respectively.
+.Bl -tag -width 4
+.It LocalAddr, LPort
+The local IP address and port on this node associated with the message. For
+sent messages this is the source address, for receive messages it is the
+destination address.
+.It RemoteAddr, RPort
+The remote IP address and port associated with the message. For sent messages
+this is the destination address, for receive messages it is the source address.
+.It Seq
+The sequence number of the message.
+.It Bytes
+The number of bytes in the message payload.
+.El
+
+The following information sources are dependent on specific transports which
+may not always be available.
+
+.It Fl T
+Display the TCP sockets which the TCP transport is using to provide
+RDS connections.
+
+.Bl -tag -width 4
+.It LocalAddr, LPort
+The local IP address and port of this socket.
+.It RemoteAddr, RPort
+The remote IP address and port that this socket is connected to.
+.It HdrRemain
+The number of bytes that must be read off the socket to complete the next
+full RDS header.
+.It DataRemain
+The number of bytes that must be read off the socket to complete the data
+payload of the message which is being received.
+.It SentNxt
+The TCP sequence number of the first byte of the last message that we sent
+down the connection.
+.It ExpectedUna
+The TCP sequence number of the byte past the last byte of the last message
+that we sent down the connection. When we see that the remote side has
+acked up to this byte then we know that the remote side has received all
+our RDS messages.
+.It SeenUna
+The TCP sequence number of the byte past the last byte which has been
+acked by the remote host.
+.El
-.Dl # rds-info -n
-.Dl 127.0.0.1 127.0.0.1 499995 499995 scC
-.Dl ...
-
-.It Fl s
-Display all messages that are in the send queue on RDS connections. Once
-messages are initially sent they move from the sent queue to the retransmit
-queue. Each message includes its source and destination address and port,
-followed by its sequence number and the number of data bytes included in the
-message.
-
-.Dl # rds-info -s
-.Dl 127.0.0.1 11111 192.168.110.17 22222 0 4096
-.Dl ...
-
-.It Fl r
-Display all messages that are in the receive queue on RDS sockets. This output
-matches the
-.Fl s
-option.
-
-.It Fl t
-Display all messages that are in the retransmit queue on RDS connections. As
-a connection is re-established all of the messages in its retransmit queue
-are moved back to the send queue.
-This output matches the
-.Fl s
-option.
.El
.Pp
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/rds-tools-1.0/rds-info.c new/rds-tools-1.0/rds-info.c
--- old/rds-tools-1.0/rds-info.c 2007-07-06 11:09:17.000000000 +0200
+++ new/rds-tools-1.0/rds-info.c 2007-08-12 14:47:21.000000000 +0200
@@ -49,27 +49,6 @@
#include "rdstool.h"
-void print_usage(int rc)
-{
- FILE *output = rc ? stderr : stdout;
-
- verbosef(0, output,
- "Usage: %s [-c] [-s]\n"
- " -c statistic counters\n"
- " -k sockets\n"
- " -n connections\n"
- " -r recv queue messages\n"
- " -s send queue messages\n"
- " -t retransmit queue messages\n"
- " -T TCP transport sockets\n",
- progname);
-
- exit(rc);
-}
-void print_version()
-{
-}
-
#define RDS_INFO_COUNTERS 10000
#define RDS_INFO_CONNECTIONS 10001
//#define RDS_INFO_FLOWS 10002 /* no longer exist */
@@ -116,7 +95,7 @@
uint32_t faddr;
uint16_t lport;
uint16_t fport;
- uint8_t flags;
+ uint8_t flags; /* currently unused */
} __attribute__((packed));
struct rds_info_tcp_socket {
@@ -137,6 +116,7 @@
(conn.flags & RDS_INFO_CONNECTION_FLAG_##flag ? letter : '-')
#define min(a, b) (a < b ? a : b)
+#define array_size(foo) (sizeof(foo) / sizeof(foo[0]))
#define copy_into(var, data, each) ({ \
int __ret = 1; \
@@ -149,169 +129,219 @@
for (;len > 0 && copy_into(var, data, each); \
data += each, len -= min(len, each))
-int main(int argc, char **argv)
+static void print_counters(void *data, int each, socklen_t len, void *extra)
{
- socklen_t len = 0;
- void *data = NULL;
- int status = 1;
- int info = 0;
- int fd;
- int each;
- int c;
+ struct rds_info_counter ctr;
- while ((c = getopt(argc, argv, "+cknrstT")) != EOF) {
- switch (c) {
- case 'c':
- info = RDS_INFO_COUNTERS;
- break;
- case 'k':
- info = RDS_INFO_SOCKETS;
- break;
- case 'n':
- info = RDS_INFO_CONNECTIONS;
- break;
- case 'r':
- info = RDS_INFO_RECV_MESSAGES;
- break;
- case 's':
- info = RDS_INFO_SEND_MESSAGES;
- break;
- case 't':
- info = RDS_INFO_RETRANS_MESSAGES;
- break;
- case 'T':
- info = RDS_INFO_TCP_SOCKETS;
- break;
- case '?':
- verbosef(0, stderr,
- "%s: Invalid option \'-%c\'\n",
- progname, optopt);
- print_usage(1);
- break;
- }
- }
+ printf("\nCounters:\n%25s %16s\n", "CounterName", "Value");
+
+ for_each(ctr, data, each, len)
+ printf("%25s %16"PRIu64"\n", ctr.name, ctr.value);
+}
+
+static void print_sockets(void *data, int each, socklen_t len, void *extra)
+{
+ struct rds_info_socket sk;
+ struct in_addr addr;
- if (info == 0) {
- verbosef(0, stderr, "%s: No output chosen\n", progname);
- print_usage(1);
+ printf("\nRDS Sockets:\n%15s %5s %15s %5s %10s %10s\n",
+ "BoundAddr", "BPort", "ConnAddr", "CPort", "SndBuf",
+ "RcvBuf");
+
+ for_each(sk, data, each, len) {
+ addr.s_addr = sk.bound_addr;
+ printf("%15s %5u ", inet_ntoa(addr),
+ ntohs(sk.bound_port));
+ addr.s_addr = sk.connected_addr;
+ printf("%15s %5u %10u %10u\n",
+ inet_ntoa(addr), ntohs(sk.connected_port),
+ sk.sndbuf, sk.rcvbuf);
}
+}
- fd = socket(PF_RDS, SOCK_SEQPACKET, 0);
- if (fd < 0) {
- verbosef(0, stderr, "%s: Unable to create socket: %s\n",
- progname, strerror(errno));
- goto out;
+static void print_conns(void *data, int each, socklen_t len, void *extra)
+{
+ struct rds_info_connection conn;
+ struct in_addr addr;
+
+ printf("\nRDS Connections:\n%15s %15s %16s %16s %3s\n",
+ "LocalAddr", "RemoteAddr", "NextTX", "NextRX", "Flg");
+
+ for_each(conn, data, each, len) {
+ addr.s_addr = conn.laddr;
+ printf("%15s ", inet_ntoa(addr));
+ addr.s_addr = conn.faddr;
+ printf("%15s %16"PRIu64" %16"PRIu64" ",
+ inet_ntoa(addr), conn.next_tx_seq,
+ conn.next_rx_seq);
+ printf("%c%c%c\n",
+ rds_conn_flag(conn, SENDING, 's'),
+ rds_conn_flag(conn, CONNECTING, 'c'),
+ rds_conn_flag(conn, CONNECTED, 'C'));
}
+}
- while ((each = getsockopt(fd, SOL_RDS, info, data, &len)) < 0) {
- if (errno != ENOSPC) {
- verbosef(0, stderr, "%s: Unable get statistics: %s\n",
- progname, strerror(errno));
- goto out;
- }
+static void print_msgs(void *data, int each, socklen_t len, void *extra)
+{
+ struct rds_info_message msg;
+ struct in_addr addr;
+ printf("\n%s Message Queue:\n%15s %5s %15s %5s %16s %10s\n",
+ (char *)extra,
+ "LocalAddr", "LPort", "RemoteAddr", "RPort", "Seq", "Bytes");
+
+ for_each(msg, data, each, len) {
+ addr.s_addr = msg.laddr;
+ printf("%15s %5u ", inet_ntoa(addr), ntohs(msg.lport));
+ addr.s_addr = msg.faddr;
+ printf("%15s %5u %16"PRIu64" %10u\n",
+ inet_ntoa(addr), ntohs(msg.fport), msg.seq, msg.len);
+ }
+}
- if (data)
- data = realloc(data, len);
- else
- data = malloc(len);
-
- if (data == NULL) {
- verbosef(0, stderr, "%s: Unable to allocate memory "
- "for %u bytes of info: %s\n", progname, len,
- strerror(errno));
- goto out;
- }
+static void print_tcp_socks(void *data, int each, socklen_t len, void *extra)
+{
+ struct rds_info_tcp_socket ts;
+ struct in_addr addr;
+
+ printf("\nTCP Connections:\n"
+ "%15s %5s %15s %5s %10s %10s %10s %10s %10s\n",
+ "LocalAddr", "LPort", "RemoteAddr", "RPort",
+ "HdrRemain", "DataRemain", "SentNxt", "ExpectUna", "SeenUna");
+
+ for_each(ts, data, each, len) {
+ addr.s_addr = ts.local_addr;
+ printf("%15s %5u ", inet_ntoa(addr),
+ ntohs(ts.local_port));
+ addr.s_addr = ts.local_addr;
+ printf("%15s %5u %10"PRIu64" %10"PRIu64" %10u %10u %10u\n",
+ inet_ntoa(addr), ntohs(ts.peer_port),
+ ts.hdr_rem, ts.data_rem, ts.last_sent_nxt,
+ ts.last_expected_una, ts.last_seen_una);
}
+}
+
+struct info {
+ int opt_val;
+ char *description;
+ void (*print)(void *data, int each, socklen_t len, void *extra);
+ void *extra;
+ int option_given;
+};
+
+struct info infos[] = {
+ ['c'] = { RDS_INFO_COUNTERS, "statistic counters",
+ print_counters, NULL, 0 },
+ ['k'] = { RDS_INFO_SOCKETS, "sockets",
+ print_sockets, NULL, 0 },
+ ['n'] = { RDS_INFO_CONNECTIONS, "connections",
+ print_conns, NULL, 0 },
+ ['r'] = { RDS_INFO_RECV_MESSAGES, "recv queue messages",
+ print_msgs, "Receive", 0 },
+ ['s'] = { RDS_INFO_SEND_MESSAGES, "send queue messages",
+ print_msgs, "Send", 0 },
+ ['t'] = { RDS_INFO_RETRANS_MESSAGES, "retransmit queue messages",
+ print_msgs, "Retransmit", 0 },
+ ['T'] = { RDS_INFO_TCP_SOCKETS, "TCP transport sockets",
+ print_tcp_socks, NULL, 0 },
+};
+
+void print_usage(int rc)
+{
+ FILE *output = rc ? stderr : stdout;
+ int i;
+
+ verbosef(0, output, "The following options limit output to the given "
+ "sources:\n");
- switch(info) {
- case RDS_INFO_COUNTERS: {
- struct rds_info_counter ctr;
-
- for_each(ctr, data, each, len)
- printf("%-25s: %"PRIu64"\n", ctr.name, ctr.value);
- break;
+ for (i = 0; i < array_size(infos); i++) {
+ if (!infos[i].opt_val)
+ continue;
+ printf(" -%c %s\n", i, infos[i].description);
}
- case RDS_INFO_CONNECTIONS: {
- struct rds_info_connection conn;
- struct in_addr addr;
-
- for_each(conn, data, each, len) {
- addr.s_addr = conn.laddr;
- printf("%15s ", inet_ntoa(addr));
- addr.s_addr = conn.faddr;
- printf("%15s %16"PRIu64" %16"PRIu64" ",
- inet_ntoa(addr), conn.next_tx_seq,
- conn.next_rx_seq);
- printf("%c%c%c\n",
- rds_conn_flag(conn, SENDING, 's'),
- rds_conn_flag(conn, CONNECTING, 'c'),
- rds_conn_flag(conn, CONNECTED, 'C'));
- }
- break;
+ verbosef(0, output,
+ "\n\nIf no options are given then all sources are used.\n");
+ exit(rc);
+}
+
+void print_version()
+{
+}
+
+int main(int argc, char **argv)
+{
+ char optstring[258] = "+";
+ int given_options = 0;
+ socklen_t len = 0;
+ void *data = NULL;
+ int fd;
+ int each;
+ int c;
+ char *last;
+ int i;
+
+ /* quickly append all our info options to the optstring */
+ last = &optstring[strlen(optstring)];
+ for (i = 0; i < array_size(infos); i++) {
+ if (!infos[i].opt_val)
+ continue;
+ *last = (char)i;
+ last++;
+ *last = '\0';
}
- case RDS_INFO_SOCKETS: {
- struct rds_info_socket sk;
- struct in_addr addr;
-
- for_each(sk, data, each, len) {
- addr.s_addr = sk.bound_addr;
- printf("%15s %5u", inet_ntoa(addr),
- ntohs(sk.bound_port));
- addr.s_addr = sk.connected_addr;
- printf("%15s %5u %10u %10u\n",
- inet_ntoa(addr), ntohs(sk.connected_port),
- sk.sndbuf, sk.rcvbuf);
+ while ((c = getopt(argc, argv, optstring)) != EOF) {
+ if (c >= array_size(infos) || !infos[c].opt_val) {
+ verbosef(0, stderr, "%s: Invalid option \'-%c\'\n",
+ progname, optopt);
+ print_usage(1);
}
- break;
+
+ infos[c].option_given = 1;
+ given_options++;
}
- case RDS_INFO_SEND_MESSAGES:
- case RDS_INFO_RECV_MESSAGES:
- case RDS_INFO_RETRANS_MESSAGES: {
- struct rds_info_message msg;
- struct in_addr addr;
- char c = ' ';
-
- for_each(msg, data, each, len) {
- if (msg.flags & RDS_INFO_MESSAGE_FLAG_ACK)
- c = 'a';
- else if (msg.flags & RDS_INFO_MESSAGE_FLAG_FAST_ACK)
- c = 'f';
-
- addr.s_addr = msg.laddr;
- printf("%15s %5u", inet_ntoa(addr), ntohs(msg.lport));
- addr.s_addr = msg.faddr;
- printf("%15s %5u %16"PRIu64" %10u %c\n",
- inet_ntoa(addr), ntohs(msg.fport), msg.seq,
- msg.len, c);
- }
- break;
+ fd = socket(PF_RDS, SOCK_SEQPACKET, 0);
+ if (fd < 0) {
+ verbosef(0, stderr, "%s: Unable to create socket: %s\n",
+ progname, strerror(errno));
+ return 1;
}
- case RDS_INFO_TCP_SOCKETS: {
- struct rds_info_tcp_socket ts;
- struct in_addr addr;
-
- for_each(ts, data, each, len) {
- addr.s_addr = ts.local_addr;
- printf("%15s %5u", inet_ntoa(addr),
- ntohs(ts.local_port));
- addr.s_addr = ts.local_addr;
- printf("%15s %5u %10"PRIu64" %10"PRIu64" %10u %10u %10u\n",
- inet_ntoa(addr), ntohs(ts.peer_port),
- ts.hdr_rem, ts.data_rem, ts.last_sent_nxt,
- ts.last_expected_una, ts.last_seen_una);
+ for (i = 0; i < array_size(infos); i++) {
+ if (!infos[i].opt_val ||
+ (given_options && !infos[i].option_given))
+ continue;
+
+ /* read in the info until we get a full snapshot */
+ while ((each = getsockopt(fd, SOL_RDS, infos[i].opt_val, data,
+ &len)) < 0) {
+ if (errno != ENOSPC) {
+ verbosef(0, stderr,
+ "%s: Unable get statistics: %s\n",
+ progname, strerror(errno));
+ return 1;
+ }
+ if (data)
+ data = realloc(data, len);
+ else
+ data = malloc(len);
+
+ if (data == NULL) {
+ verbosef(0, stderr,
+ "%s: Unable to allocate memory "
+ "for %u bytes of info: %s\n",
+ progname, len, strerror(errno));
+ return 1;
+ }
}
- break;
- }
- }
+ infos[i].print(data, each, len, infos[i].extra);
- status = 0;
+ if (given_options && --given_options == 0)
+ break;
+ }
-out:
- return status;
+ return 0;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/rds-tools-1.0/rds-tools.spec new/rds-tools-1.0/rds-tools.spec
--- old/rds-tools-1.0/rds-tools.spec 1970-01-01 01:00:00.000000000 +0100
+++ new/rds-tools-1.0/rds-tools.spec 2007-08-12 14:47:21.000000000 +0200
@@ -0,0 +1,36 @@
+Summary: RDS support tools
+Name: rds-tools
+Version: 1.0
+Release: 20
+License: GPL/BSD
+Group: Applications/Internet
+URL: http://oss.oracle.com/projects/rds/
+Source: rds-tools-%{version}-%{release}.tar.gz
+BuildRoot: /var/tmp/rds-tools-%{version}-%{release}
+
+%description
+rds-tools is a collection of support tools for the RDS socket API.
+
+%prep
+%setup -n rds-tools-%{version}-%{release}
+
+%build
+make
+
+%install
+
+mkdir -p $RPM_BUILD_ROOT/{%{_mandir}/man1,%{_bindir}}
+install -m 755 rds-info rds-gen rds-sink rds-stress $RPM_BUILD_ROOT/%{_bindir}
+install -m 755 rds-info.1 rds-gen.1 rds-sink.1 rds-stress.1 $RPM_BUILD_ROOT/%{_mandir}/man1
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+%{_bindir}/*
+%{_mandir}/*
+
+%changelog
+* Mon Oct 27 2006 Zach Brown
participants (1)
-
root@Hilbert.suse.de