*** ./src/iperf_api.c.ORIG Mon May 23 18:45:38 2016 --- ./src/iperf_api.c Mon May 23 18:47:42 2016 @@ -35,7 +35,11 @@ #include #include #include +#ifdef _AIX +#include "getopt_long.h" +#else #include +#endif #include #include #include *** ./src/iperf_server_api.c.ORIG Mon May 23 18:47:51 2016 --- ./src/iperf_server_api.c Mon May 23 18:48:09 2016 *************** *** 30,36 **** --- 30,40 ---- #include #include #include + #ifdef _AIX + #include "getopt_long.h" + #else #include + #endif #include #include #include *** ./src/main.c.ORIG Mon May 23 18:52:24 2016 --- ./src/main.c Mon May 23 18:55:28 2016 *************** *** 29,35 **** --- 29,40 ---- #include #include #include + #ifdef _AIX + #include "getopt_long.h" + #include "getopt_long.c" + #else #include + #endif #include #include #include *** ./src/daemon.c.ORIG Mon May 23 18:53:57 2016 --- ./src/daemon.c Mon May 23 18:53:53 2016 *************** *** 0 **** --- 1,120 ---- + /*---------------------------------------------------------------------------*\ + NAME + daemon.c - replacement daemon(3) function + DESCRIPTION + This source file contains a version of a BSD-style daemon(3) + function, a function to "daemonize" the calling process. This + implementation is based both on the generic daemon logic defined in + the Unix Programmer's FAQ and on the daemon_start() function in + W. Richard Stevens' _Unix_Network_Programming_ book (Prentice-Hall, + 1990). At the time of this writing, the Unix Programmer's FAQ is + located at `http://www.whitefang.com/unix/faq_toc.html' (among + other places). + LICENSE + This source code is released under a BSD-style. See the LICENSE + file for details. + Copyright (c) 2003-2015 Brian M. Clapper, bmc@clapper.org + \*---------------------------------------------------------------------------*/ + + /*---------------------------------------------------------------------------*\ + Includes + \*---------------------------------------------------------------------------*/ + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + /*---------------------------------------------------------------------------*\ + Static Routines + \*---------------------------------------------------------------------------*/ + + /* redirect_fds(): redirect stdin, stdout, and stderr to /dev/NULL */ + + static void redirect_fds() + { + (void) close(0); + (void) close(1); + (void) close(2); + + if (open("/dev/null", O_RDWR) != 0) + { + syslog(LOG_ERR, "Unable to open /dev/null: %s", strerror(errno)); + exit(1); + } + + (void) dup(0); + (void) dup(0); + } + + static int do_fork(void) + { + int status = 0; + + switch(fork()) + { + case 0: + /* This is the child that will become the daemon. */ + break; + + case -1: + /* Fork failure. */ + status = -1; + break; + + default: + /* Parent: Exit. */ + _exit(0); + } + + return status; + } + + /*---------------------------------------------------------------------------*\ + Public Routines + \*---------------------------------------------------------------------------*/ + + int daemon(int nochdir, int noclose) + { + int status = 0; + + openlog("daemonize", LOG_PID, LOG_DAEMON); + + /* Fork once to go into the background. */ + if((status = do_fork()) < 0 ) + ; + + /* Create new session */ + else if(setsid() < 0) /* shouldn't fail */ + status = -1; + + /* Fork again to ensure that daemon never reacquires a control terminal. */ + else if((status = do_fork()) < 0 ) + ; + + else + { + /* clear any inherited umask(2) value */ + + umask(0); + + /* We're there. */ + + if(! nochdir) + { + /* Go to a neutral corner. */ + chdir("/"); + } + + if(! noclose) + redirect_fds(); + } + + return status; + } #*** ./src/Makefile.in.ORIG Fri Nov 18 00:49:39 2016 #--- ./src/Makefile.in Fri Nov 18 00:50:10 2016 #*************** #*** 140,146 **** # am_libiperf_la_OBJECTS = cjson.lo iperf_api.lo iperf_error.lo \ # iperf_client_api.lo iperf_locale.lo iperf_server_api.lo \ # iperf_tcp.lo iperf_udp.lo iperf_sctp.lo iperf_util.lo net.lo \ #! tcp_info.lo tcp_window_size.lo timer.lo units.lo # libiperf_la_OBJECTS = $(am_libiperf_la_OBJECTS) # AM_V_lt = $(am__v_lt_@AM_V@) # am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) #--- 140,146 ---- # am_libiperf_la_OBJECTS = cjson.lo iperf_api.lo iperf_error.lo \ # iperf_client_api.lo iperf_locale.lo iperf_server_api.lo \ # iperf_tcp.lo iperf_udp.lo iperf_sctp.lo iperf_util.lo net.lo \ #! tcp_info.lo tcp_window_size.lo timer.lo units.lo getopt_long.lo # libiperf_la_OBJECTS = $(am_libiperf_la_OBJECTS) # AM_V_lt = $(am__v_lt_@AM_V@) # am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) #*** ./src/iperf.h.ORIG Fri Nov 18 00:27:58 2016 #--- ./src/iperf.h Fri Nov 18 00:28:07 2016 #*************** #*** 36,42 **** # #endif # #include # #include #! #include # # #if defined(HAVE_CPUSET_SETAFFINITY) # #include #--- 36,42 ---- # #endif # #include # #include #! #include # # #if defined(HAVE_CPUSET_SETAFFINITY) # #include #*** ./src/units.c.ORIG Fri Nov 18 00:26:28 2016 #--- ./src/units.c Fri Nov 18 00:26:34 2016 #*************** #*** 60,66 **** # #include # #include # #include #! #include # # # #include "iperf.h" #--- 60,66 ---- # #include # #include # #include #! #include # # # #include "iperf.h" --- ./src/Makefile.in.orig 2020-01-31 01:18:10 +0000 +++ ./src/Makefile.in 2020-01-31 01:19:02 +0000 @@ -670,9 +670,9 @@ @ENABLE_PROFILING_TRUE@iperf3_profile_SOURCES = main.c \ @ENABLE_PROFILING_TRUE@ $(libiperf_la_SOURCES) -@ENABLE_PROFILING_TRUE@iperf3_profile_CFLAGS = -pg -g +@ENABLE_PROFILING_TRUE@iperf3_profile_CFLAGS = @ENABLE_PROFILING_TRUE@iperf3_profile_LDADD = libiperf.la -@ENABLE_PROFILING_TRUE@iperf3_profile_LDFLAGS = -pg -g +@ENABLE_PROFILING_TRUE@iperf3_profile_LDFLAGS = # Specify the sources and various flags for the test cases t_timer_SOURCES = t_timer.c --- ./src/iperf_api.c.orig 2020-01-31 01:24:55 +0000 +++ ./src/iperf_api.c 2020-01-31 01:27:09 +0000 @@ -3607,6 +3607,10 @@ } /**************************************************************************/ +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + struct iperf_stream * iperf_new_stream(struct iperf_test *test, int s, int sender) { --- ./src/main.c.orig 2021-12-20 05:13:08 +0000 +++ ./src/main.c 2021-12-20 05:13:34 +0000 @@ -54,6 +54,11 @@ #include "net.h" #include "units.h" +/* AIX does not have the daemon() system call */ +#ifdef _AIX +#include "daemon.c" +#endif + static int run(struct iperf_test *test); --- ./src/portable_endian.h.orig 2021-12-20 05:14:55 +0000 +++ ./src/portable_endian.h 2021-12-20 05:15:29 +0000 @@ -65,7 +65,7 @@ # define __LITTLE_ENDIAN LITTLE_ENDIAN # define __PDP_ENDIAN PDP_ENDIAN -#elif defined(__sun) && defined(__SVR4) +#elif defined(__sun) && defined(__SVR4) || defined(_AIX) # include # include --- ./src/iperf_error.c.orig 2021-12-20 05:17:12 +0000 +++ ./src/iperf_error.c 2021-12-20 05:17:39 +0000 @@ -33,6 +33,10 @@ #include "iperf.h" #include "iperf_api.h" +#ifndef hstrerror +extern const char * hstrerror(int); +#endif + int gerror; char iperf_timestrerr[100]; --- ./src/Makefile.in.orig 2021-12-20 05:19:05 +0000 +++ ./src/Makefile.in 2021-12-20 05:20:21 +0000 @@ -671,9 +671,9 @@ # Specify the sources and various flags for the iperf binary iperf3_SOURCES = main.c -iperf3_CFLAGS = -g +iperf3_CFLAGS = iperf3_LDADD = libiperf.la -iperf3_LDFLAGS = -g +iperf3_LDFLAGS = # If the iperf-profiled-binary is enabled # Specify the sources and various flags for the profiled iperf binary. This @@ -687,15 +687,15 @@ # Specify the sources and various flags for the test cases t_timer_SOURCES = t_timer.c -t_timer_CFLAGS = -g +t_timer_CFLAGS = t_timer_LDFLAGS = t_timer_LDADD = libiperf.la t_units_SOURCES = t_units.c -t_units_CFLAGS = -g +t_units_CFLAGS = t_units_LDFLAGS = t_units_LDADD = libiperf.la t_uuid_SOURCES = t_uuid.c -t_uuid_CFLAGS = -g +t_uuid_CFLAGS = t_uuid_LDFLAGS = t_uuid_LDADD = libiperf.la t_api_SOURCES = t_api.c --- src/iperf_client_api.c_orig 2025-01-27 06:39:34.090683213 -0600 +++ src/iperf_client_api.c 2025-01-27 06:42:03.425038655 -0600 @@ -45,6 +45,9 @@ #include "iperf_time.h" #include "net.h" #include "timer.h" +#ifdef _AIX +#include +#endif #if defined(HAVE_TCP_CONGESTION) #if !defined(TCP_CA_NAME_MAX) --- src/Makefile.in_orig 2025-01-27 06:44:06.075548330 -0600 +++ src/Makefile.in 2025-01-27 06:48:40.130027351 -0600 @@ -152,7 +152,7 @@ iperf_auth.lo iperf_client_api.lo iperf_locale.lo \ iperf_server_api.lo iperf_tcp.lo iperf_udp.lo iperf_sctp.lo \ iperf_util.lo iperf_time.lo iperf_pthread.lo dscp.lo net.lo \ - tcp_info.lo timer.lo units.lo + tcp_info.lo timer.lo units.lo getopt_long.lo libiperf_la_OBJECTS = $(am_libiperf_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) --- src/units.c_orig 2025-11-18 03:34:41.408143850 -0600 +++ src/units.c 2025-11-18 03:35:02.034524789 -0600 @@ -58,7 +58,7 @@ #include #include #include - +#include #include "iperf.h" #include "iperf_api.h"