GUACAMOLE-663: Set pthread stack size for guacd

This commit is contained in:
Virtually Nick 2022-01-02 23:41:18 -05:00
parent 47b9360d46
commit 1ab81c790c
2 changed files with 18 additions and 0 deletions

View File

@ -17,6 +17,12 @@
* under the License. * under the License.
*/ */
/**
* This is required for pthread_setattr_default_np() to be
* available and function correctly.
*/
#define _GNU_SOURCE 1
#include "config.h" #include "config.h"
#include "conf.h" #include "conf.h"
@ -35,6 +41,7 @@
#include <libgen.h> #include <libgen.h>
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <pthread.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -275,6 +282,12 @@ int main(int argc, char* argv[]) {
/* General */ /* General */
int retval; int retval;
/* Set default stack size of 8MB */
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);
/* Load configuration */ /* Load configuration */
guacd_config* config = guacd_conf_load(); guacd_config* config = guacd_conf_load();
if (config == NULL || guacd_conf_parse_args(config, argc, argv)) if (config == NULL || guacd_conf_parse_args(config, argc, argv))

View File

@ -33,6 +33,11 @@
*/ */
#define GUACD_CLIENT_MAX_CONNECTIONS 65536 #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. * The number of hash buckets in each process map.
*/ */