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: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ RUN apk add --no-cache \
xargs apk add --no-cache < ${PREFIX_DIR}/DEPENDENCIES

# Checks the operating status every 5 minutes with a timeout of 5 seconds
HEALTHCHECK --interval=5m --timeout=5s CMD nc -z 127.0.0.1 4822 || exit 1
HEALTHCHECK --interval=5m --timeout=5s --start-period=15s CMD nc -z 127.0.0.1 4822 || exit 1

# Create a new user guacd
ARG UID=1000
Expand Down
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/socket.h time.h sys/time.h syslo
AC_DEFINE([_GNU_SOURCE], [1], [Uses GNU-specific APIs (if available)])
AC_DEFINE([_XOPEN_SOURCE], [700], [Uses X/Open and POSIX APIs])
AC_DEFINE([__BSD_VISIBLE], [1], [Uses BSD-specific APIs (if available)])
AC_DEFINE([_GNU_SOURCE], [1], [Use GNU sources (if available)])

# Check for availability of non-portable sched_getaffinity() function (one of
# several possible routes for determining the number of available processors)
Expand Down Expand Up @@ -76,6 +77,9 @@ AC_CHECK_LIB([pthread], [pthread_create], [PTHREAD_LIBS=-lpthread
AC_DEFINE([HAVE_LIBPTHREAD],,
[Whether libpthread was found])])

# Check for pthread_setattr_default_np
AC_CHECK_DECLS([pthread_setattr_default_np], , , [[#include <pthread.h>]])

# librt
AC_CHECK_FUNC([timer_create], [AC_MSG_RESULT([timer_create was found without librt.])],
[AC_CHECK_LIB([rt], [timer_create],
Expand Down
9 changes: 9 additions & 0 deletions src/guacd/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <libgen.h>
#include <netdb.h>
#include <netinet/in.h>
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -320,6 +321,14 @@ int main(int argc, char* argv[]) {
/* General */
int retval;

#ifdef HAVE_DECL_PTHREAD_SETATTR_DEFAULT_NP
/* Set default stack size */
pthread_attr_t default_pthread_attr;
pthread_attr_init(&default_pthread_attr);
pthread_attr_setstacksize(&default_pthread_attr, GUACD_THREAD_STACK_SIZE);
pthread_setattr_default_np(&default_pthread_attr);
#endif // HAVE_DECL_PTHREAD_SETATTR_DEFAULT_NP

/* Load configuration */
guacd_config* config = guacd_conf_load();
if (config == NULL || guacd_conf_parse_args(config, argc, argv))
Expand Down
5 changes: 5 additions & 0 deletions src/guacd/proc-map.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
*/
#define GUACD_CLIENT_MAX_CONNECTIONS 65536

/**
* The pthread stack size for the guacd daemon.
*/
#define GUACD_THREAD_STACK_SIZE 8388608

/**
* The number of hash buckets in each process map.
*/
Expand Down