diff options
author | xin.ouyang@windriver.com <xin.ouyang@windriver.com> | 2012-11-12 09:39:46 +0000 |
---|---|---|
committer | Joe MacDonald <joe.macdonald@windriver.com> | 2012-11-19 11:18:30 -0500 |
commit | b69b6e04f12b2fc45a3ebac8c741bda41fea6409 (patch) | |
tree | f91300ff9c5c6b506a20d1eb7a46633bf79c6fc1 /meta-networking | |
parent | 5955e22f6ecf0196a129c27641c6d85820f8b962 (diff) | |
download | meta-openembedded-b69b6e04f12b2fc45a3ebac8c741bda41fea6409.tar.gz |
netperf: import from oe-classic and upgrade to 2.6.0
Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
Diffstat (limited to 'meta-networking')
4 files changed, 207 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/netperf/files/cpu_set.patch b/meta-networking/recipes-support/netperf/files/cpu_set.patch new file mode 100644 index 000000000..434b79049 --- /dev/null +++ b/meta-networking/recipes-support/netperf/files/cpu_set.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | Subject: [PATCH] netperf: fix CPU_SETSIZE to build with eglibc | ||
2 | |||
3 | Upstream-Status: Pending | ||
4 | |||
5 | Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com> | ||
6 | --- | ||
7 | src/netlib.c | 7 ++++++- | ||
8 | 1 files changed, 6 insertions(+), 1 deletions(-) | ||
9 | |||
10 | diff --git a/src/netlib.c b/src/netlib.c | ||
11 | index 206e002..e33aae6 100644 | ||
12 | --- a/src/netlib.c | ||
13 | +++ b/src/netlib.c | ||
14 | @@ -2265,7 +2265,12 @@ bind_to_specific_processor(int processor_affinity, int use_cpu_map) | ||
15 | fall-back on what we had before, which is to use just the size of | ||
16 | an unsigned long. raj 2006-09-14 */ | ||
17 | |||
18 | -#if defined(__CPU_SETSIZE) | ||
19 | +#if defined(CPU_SETSIZE) | ||
20 | +#define NETPERF_CPU_SETSIZE CPU_SETSIZE | ||
21 | +#define NETPERF_CPU_SET(cpu, cpusetp) CPU_SET(cpu, cpusetp) | ||
22 | +#define NETPERF_CPU_ZERO(cpusetp) CPU_ZERO (cpusetp) | ||
23 | + typedef cpu_set_t netperf_cpu_set_t; | ||
24 | +#elif defined(__CPU_SETSIZE) | ||
25 | #define NETPERF_CPU_SETSIZE __CPU_SETSIZE | ||
26 | #if defined(__CPU_SET_S) | ||
27 | #define NETPERF_CPU_SET(cpu, cpusetp) __CPU_SET_S(cpu, sizeof (cpu_set_t), cpusetp) | ||
28 | -- | ||
29 | 1.7.1.1 | ||
30 | |||
diff --git a/meta-networking/recipes-support/netperf/files/init b/meta-networking/recipes-support/netperf/files/init new file mode 100644 index 000000000..8ba2a6373 --- /dev/null +++ b/meta-networking/recipes-support/netperf/files/init | |||
@@ -0,0 +1,62 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # | ||
4 | # Written by Miquel van Smoorenburg <miquels@cistron.nl>. | ||
5 | # Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.org>. | ||
6 | # Modified for Debian by Christoph Lameter <clameter@debian.org> | ||
7 | # Modified for openembedded by Bruno Randolf <bruno.randolf@4g-systems.biz> | ||
8 | |||
9 | ### BEGIN INIT INFO | ||
10 | # Provides: netperf | ||
11 | # Required-Start: $remote_fs $local_fs $time | ||
12 | # Required-Stop: $remote_fs $local_fs $time | ||
13 | # Should-Start: $network $named | ||
14 | # Should-Stop: $network $named | ||
15 | # Default-Start: 2 3 4 5 | ||
16 | # Default-Stop: 0 1 6 | ||
17 | # Short-Description: network benchmark | ||
18 | ### END INIT INFO | ||
19 | |||
20 | PATH=/bin:/usr/bin:/sbin:/usr/sbin | ||
21 | DAEMON=/usr/sbin/netserver | ||
22 | |||
23 | test -f $DAEMON || exit 0 | ||
24 | |||
25 | case "$1" in | ||
26 | start) | ||
27 | echo -n "Starting network benchmark server: netserver" | ||
28 | start-stop-daemon -S -x $DAEMON > /dev/null 2>&1 | ||
29 | echo "." | ||
30 | ;; | ||
31 | stop) | ||
32 | echo -n "Stopping network benchmark server: netserver" | ||
33 | start-stop-daemon -K -x $DAEMON | ||
34 | echo "." | ||
35 | ;; | ||
36 | #reload) | ||
37 | # | ||
38 | # If the daemon can reload its config files on the fly | ||
39 | # for example by sending it SIGHUP, do it here. | ||
40 | # | ||
41 | # If the daemon responds to changes in its config file | ||
42 | # directly anyway, make this a do-nothing entry. | ||
43 | # | ||
44 | # start-stop-daemon --stop --signal 1 --verbose --exec $DAEMON | ||
45 | # ;; | ||
46 | restart|force-reload) | ||
47 | # | ||
48 | # If the "reload" option is implemented, move the "force-reload" | ||
49 | # option to the "reload" entry above. If not, "force-reload" is | ||
50 | # just the same as "restart". | ||
51 | # | ||
52 | start-stop-daemon -K -x $DAEMON | ||
53 | sleep 1 | ||
54 | start-stop-daemon -S -x $DAEMON | ||
55 | ;; | ||
56 | *) | ||
57 | echo "Usage: /etc/init.d/netperf {start|stop|restart|force-reload}" | ||
58 | exit 1 | ||
59 | ;; | ||
60 | esac | ||
61 | |||
62 | exit 0 | ||
diff --git a/meta-networking/recipes-support/netperf/files/vfork.patch b/meta-networking/recipes-support/netperf/files/vfork.patch new file mode 100644 index 000000000..eff98bfde --- /dev/null +++ b/meta-networking/recipes-support/netperf/files/vfork.patch | |||
@@ -0,0 +1,58 @@ | |||
1 | Subject: [PATCH] netperf: fix vfork/fork | ||
2 | |||
3 | Upstream-Status: Pending | ||
4 | |||
5 | Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com> | ||
6 | --- | ||
7 | src/netserver.c | 12 ++++++++++-- | ||
8 | 1 files changed, 10 insertions(+), 2 deletions(-) | ||
9 | |||
10 | diff --git a/src/netserver.c b/src/netserver.c | ||
11 | index 379a106..f6a8b09 100644 | ||
12 | --- a/src/netserver.c | ||
13 | +++ b/src/netserver.c | ||
14 | @@ -1020,7 +1020,7 @@ process_requests() | ||
15 | void | ||
16 | spawn_child() { | ||
17 | |||
18 | -#if defined(HAVE_FORK) | ||
19 | +#if defined(HAVE_FORK) || defined(HAVE_VFORK) | ||
20 | |||
21 | if (debug) { | ||
22 | fprintf(where, | ||
23 | @@ -1038,7 +1038,11 @@ spawn_child() { | ||
24 | |||
25 | signal(SIGCLD,SIG_IGN); | ||
26 | |||
27 | +#if defined(HAVE_FORK) | ||
28 | switch (fork()) { | ||
29 | +#else | ||
30 | + switch (vfork()) { | ||
31 | +#endif | ||
32 | case -1: | ||
33 | fprintf(where, | ||
34 | "%s: fork() error %s (errno %d)\n", | ||
35 | @@ -1405,7 +1409,7 @@ scan_netserver_args(int argc, char *argv[]) { | ||
36 | |||
37 | void | ||
38 | daemonize() { | ||
39 | -#if defined(HAVE_FORK) | ||
40 | +#if defined(HAVE_FORK) || defined(HAVE_VFORK) | ||
41 | |||
42 | if (debug) { | ||
43 | fprintf(where, | ||
44 | @@ -1419,7 +1423,11 @@ daemonize() { | ||
45 | fflush(stdout); | ||
46 | fflush(stderr); | ||
47 | |||
48 | +#if defined(HAVE_FORK) | ||
49 | switch (fork()) { | ||
50 | +#else | ||
51 | + switch (vfork()) { | ||
52 | +#endif | ||
53 | case -1: | ||
54 | fprintf(stderr, | ||
55 | "%s: fork() error %s (errno %d)\n", | ||
56 | -- | ||
57 | 1.7.1.1 | ||
58 | |||
diff --git a/meta-networking/recipes-support/netperf/netperf_2.6.0.bb b/meta-networking/recipes-support/netperf/netperf_2.6.0.bb new file mode 100644 index 000000000..2c30951d4 --- /dev/null +++ b/meta-networking/recipes-support/netperf/netperf_2.6.0.bb | |||
@@ -0,0 +1,57 @@ | |||
1 | SUMMARY = "A networking benchmarking tool" | ||
2 | DESCRIPTION = "Network performance benchmark including tests for TCP, UDP, sockets, ATM and more." | ||
3 | SECTION = "console/network" | ||
4 | HOMEPAGE = "http://www.netperf.org/" | ||
5 | LICENSE = "netperf" | ||
6 | LICENSE_FLAGS = "commercial" | ||
7 | |||
8 | PR = "r0" | ||
9 | |||
10 | SRC_URI="ftp://ftp.netperf.org/netperf/netperf-${PV}.tar.bz2 \ | ||
11 | file://cpu_set.patch \ | ||
12 | file://vfork.patch \ | ||
13 | file://init" | ||
14 | SRC_URI[md5sum] = "9654ffdfd4c4f2c93ce3733cd9ed9236" | ||
15 | SRC_URI[sha256sum] = "cd8dac710d4273d29f70e8dbd09353a6362ac58a11926e0822233c0cb230323a" | ||
16 | |||
17 | LIC_FILES_CHKSUM = "file://COPYING;md5=a0ab17253e7a3f318da85382c7d5d5d6" | ||
18 | |||
19 | inherit update-rc.d autotools | ||
20 | |||
21 | S = "${WORKDIR}/netperf-${PV}" | ||
22 | |||
23 | # cpu_set.patch plus _GNU_SOURCE makes src/netlib.c compile with CPU_ macros | ||
24 | CFLAGS_append = " -DDO_UNIX -DDO_IPV6 -D_GNU_SOURCE" | ||
25 | |||
26 | # autotools.bbclass attends to include m4 files with path depth <= 2 by | ||
27 | # "find ${S} -maxdepth 2 -name \*.m4", so move m4 files from m4/m4. | ||
28 | do_configure_prepend() { | ||
29 | test -d m4/m4 && mv -f m4/m4 m4-files | ||
30 | } | ||
31 | |||
32 | do_install() { | ||
33 | sed -e 's#/usr/sbin/#${sbindir}/#g' -i ${WORKDIR}/init | ||
34 | |||
35 | install -d ${D}${sbindir} ${D}${bindir} ${D}${sysconfdir}/init.d | ||
36 | install -m 4755 src/netperf ${D}${bindir} | ||
37 | install -m 4755 src/netserver ${D}${sbindir} | ||
38 | install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/netperf | ||
39 | |||
40 | # man | ||
41 | install -d ${D}${mandir}/man1/ | ||
42 | install -m 0644 doc/netserver.man ${D}${mandir}/man1/netserver.1 | ||
43 | install -m 0644 doc/netperf.man ${D}${mandir}/man1/netperf.1 | ||
44 | |||
45 | # move scripts to examples directory | ||
46 | install -d ${D}${docdir}/netperf/examples | ||
47 | install -m 0644 doc/examples/*_script ${D}${docdir}/netperf/examples/ | ||
48 | |||
49 | # docs .. | ||
50 | install -m 0644 COPYING ${D}${docdir}/netperf | ||
51 | install -m 0644 Release_Notes ${D}${docdir}/netperf | ||
52 | install -m 0644 README ${D}${docdir}/netperf | ||
53 | install -m 0644 doc/netperf_old.ps ${D}${docdir}/netperf | ||
54 | } | ||
55 | |||
56 | INITSCRIPT_NAME="netperf" | ||
57 | INITSCRIPT_PARAMS="defaults" | ||