Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@

# Editor backups
*~
*.sw?

8 changes: 4 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ bin_PROGRAMS = trickle trickled tricklectl

trickle_DEPENDENCIES = @ERRO@ $(LIBOBJS)
trickle_SOURCES = trickle.c util.c getopt.c
trickle_LDADD = @ERRO@ $(LIBOBJS)
trickle_LDADD = @ERRO@ @RPCLIB@ $(LIBOBJS)

trickled_SOURCES = trickled.c atomicio.c print.c bwstat.c client.c conf.c \
util.c cleanup.c getopt.c xdr.c
trickled_LDADD = @EVENTLIB@ $(LIBOBJS)
trickled_LDADD = @EVENTLIB@ @RPCLIB@ $(LIBOBJS)

tricklectl_SOURCES = tricklectl.c trickledu.c atomicio.c xdr.c
tricklectl_LDADD = @ERRO@ $(LIBOBJS)
tricklectl_LDADD = @ERRO@ @RPCLIB@ $(LIBOBJS)

AM_CFLAGS = -Wall -Icompat @EVENTINC@
AM_CFLAGS = -Wall -Icompat @EVENTINC@ @RPCINC@

overloaddir = $(libdir)
overload_DATA = libtrickle.so
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ Description
trickle is a voluntary, cooperative bandwidth shaper. trickle works
entirely in userland and is cross platform compatible.

Pre-Install
-----------

Ubuntu:

```bash
sudo apt install autoconf automake libtool
sudo apt install libevent-dev
sudo apt install libtirpc-dev

```

Install
-------

Expand Down
20 changes: 11 additions & 9 deletions config.h.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* config.h.in. Generated from configure.ac by autoheader. */
#undef socklen_t
#undef u_int16_t
#undef u_int32_t
Expand Down Expand Up @@ -38,9 +38,6 @@
/* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H

Expand All @@ -62,6 +59,9 @@
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H

/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

Expand Down Expand Up @@ -101,8 +101,7 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR

/* Name of package */
Expand Down Expand Up @@ -133,10 +132,13 @@
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE

/* Define to 1 if you have the ANSI C header files. */
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS

/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. This
macro is obsolete. */
#undef TIME_WITH_SYS_TIME

/* Version number of package */
Expand All @@ -145,7 +147,7 @@
/* Define to empty if `const' does not conform to ANSI C. */
#undef const

/* Define to `int' if <sys/types.h> does not define. */
/* Define as a signed integer type capable of holding a process identifier. */
#undef pid_t

/* Define to `unsigned int' if <sys/types.h> does not define. */
Expand Down
80 changes: 51 additions & 29 deletions configure.in → configure.ac
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
dnl $Id: configure.in,v 1.22 2004/02/13 06:14:01 marius Exp $
AC_INIT([trickle], [1.07])
AC_INIT([trickle],[1.07])
AC_CONFIG_SRCDIR([trickle.c])

AC_CANONICAL_SYSTEM
dnl AC_LIBTOOL_DLOPEN
AC_CANONICAL_TARGET

AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
Expand All @@ -12,7 +11,7 @@ AC_CONFIG_MACRO_DIR([m4])

AC_PROG_CC

AM_PROG_LIBTOOL
LT_INIT([dlopen])
AC_PROG_MAKE_SET

dnl intitialization
Expand Down Expand Up @@ -43,15 +42,13 @@ dnl ugly ugly hack
AC_CHECK_LIB(c, err, [ ERRO="" ], [ ERRO="err.o" ],)
AC_SUBST(ERRO)

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT

dnl Checks for pthread
threadsafe="yes"

AC_ARG_ENABLE([threadsafe],
[AC_HELP_STRING([--disable-threadsafe],[disable trickle thread safety (default enabled)])],
[AS_HELP_STRING([--disable-threadsafe],[disable trickle thread safety (default enabled)])],
[threadsafe=$enableval]
)

Expand All @@ -62,11 +59,8 @@ fi

dnl Check for __progname; from OpenSSHp
AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
AC_TRY_LINK([],
[ extern char *__progname; printf("%s", __progname); ],
[ ac_cv_libc_defines___progname="yes" ],
[ ac_cv_libc_defines___progname="no" ]
)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ extern char *__progname; printf("%s", __progname); ]])],[ ac_cv_libc_defines___progname="yes" ],[ ac_cv_libc_defines___progname="no"
])
])
if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
AC_DEFINE(HAVE___PROGNAME)
Expand All @@ -78,7 +72,20 @@ dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
m4_warn([obsolete],
[Update your code to rely only on HAVE_SYS_TIME_H,
then remove this warning and the obsolete code below it.
All current systems provide time.h; it need not be checked for.
Not all systems provide sys/time.h, but those that do, all allow
you to include it and time.h simultaneously.])dnl
AC_CHECK_HEADERS_ONCE([sys/time.h])
# Obsolete code to be removed.
if test $ac_cv_header_sys_time_h = yes; then
AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include both <sys/time.h>
and <time.h>. This macro is obsolete.])
fi
# End of obsolete code.

AC_CHECK_TYPE(u_int64_t, unsigned long long)
AC_CHECK_TYPE(u_int32_t, unsigned int)
AC_CHECK_TYPE(u_int16_t, unsigned short)
Expand All @@ -87,7 +94,19 @@ AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t],[unsigned long],[])], [#incl

dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
m4_warn([obsolete],
[your code may safely assume C89 semantics that RETSIGTYPE is void.
Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl
AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <sys/types.h>
#include <signal.h>
],
[return *(signal (0, 0)) (0) == 1;])],
[ac_cv_type_signal=int],
[ac_cv_type_signal=void])])
AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
(`int' or `void').])

AC_CHECK_FUNCS(socket)
AC_REPLACE_FUNCS(strlcat strlcpy daemon setenv strsep)

Expand Down Expand Up @@ -115,7 +134,7 @@ AC_ARG_WITH(libevent,
EVENTINC="-I$withval"
EVENTLIB="-L$withval -levent"
else
AC_ERROR(event.h or libevent.a not found in $withval)
AC_MSG_ERROR(event.h or libevent.a not found in $withval)
fi
;;
esac ],
Expand All @@ -127,7 +146,7 @@ then
EVENTLIB="-levent"
else
AC_MSG_RESULT(no)
AC_ERROR(libevent not found)
AC_MSG_ERROR(libevent not found)
fi
AC_MSG_RESULT(yes) ]
)
Expand All @@ -136,8 +155,7 @@ AC_SUBST(EVENTLIB)

dnl check if underscores are needed
AC_MSG_CHECKING(if underscores are needed for symbols)
AC_TRY_RUN(
#include <dlfcn.h>
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <dlfcn.h>
#include <stdio.h>

int underscoreprobe(void) { return (31415); }
Expand All @@ -154,14 +172,13 @@ main(int argc, char **argv)
exit(0);

exit(1);
}, [AC_MSG_RESULT(yes)
AC_DEFINE(DL_NEED_UNDERSCORE)], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
}]])],[AC_MSG_RESULT(yes)
AC_DEFINE(DL_NEED_UNDERSCORE)],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])

HAVEMETHOD=no

AC_MSG_CHECKING(if we can access libc without dlopen)
AC_TRY_RUN(
#include <dlfcn.h>
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <dlfcn.h>
#include <stdio.h>

int
Expand All @@ -175,9 +192,9 @@ main(int argc, char **argv)
exit(0);

exit(1);
}, [AC_MSG_RESULT(yes)
}]])],[AC_MSG_RESULT(yes)
AC_DEFINE(NODLOPEN)
HAVEMETHOD=yes], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
HAVEMETHOD=yes],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])

if test "$HAVEMETHOD" = "no"; then
dnl ugly, ugly hack
Expand All @@ -195,8 +212,7 @@ if test "$HAVEMETHOD" = "no"; then
for TESTLIB in libc.so `echo $USRLIBCGUESS` `echo $LIBCGUESS`
do
AC_MSG_CHECKING(if we can access libc with $TESTLIB)
AC_TRY_RUN(
#include <dlfcn.h>
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <dlfcn.h>
#include <stdio.h>

int
Expand All @@ -208,9 +224,9 @@ if test "$HAVEMETHOD" = "no"; then
exit(0);

exit(1);
}, [AC_MSG_RESULT(yes)
}]])],[AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(DLOPENLIBC, "$TESTLIB")
HAVEMETHOD=yes], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
HAVEMETHOD=yes],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])

if test "$HAVEMETHOD" = "yes"; then
break
Expand Down Expand Up @@ -239,5 +255,11 @@ if test "$havesendfile" = "yes"; then
AC_DEFINE(HAVE_SENDFILE, 1, [Define if your system has the sendfile system call])
fi

AC_OUTPUT(Makefile)
RPCINC="-I${prefix}/include/tirpc"
RPCLIB="-L${prefix}/lib -ltirpc -lc"
AC_SUBST(RPCINC)
AC_SUBST(RPCLIB)

AC_CONFIG_FILES([Makefile])
AC_OUTPUT

2 changes: 1 addition & 1 deletion xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* $Id: xdr.c,v 1.3 2003/06/01 18:39:12 marius Exp $
*/

#include <rpc/rpc.h>
#include <rpc/xdr.h>

#include "message.h"

Expand Down