Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1:Test
multipath-tools
multipath-tools-set-stacksize-for-log-thread
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File multipath-tools-set-stacksize-for-log-thread of Package multipath-tools
From 3687c051b5f7026c193121f0b88fb75f079d96d2 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke <hare@suse.de> Date: Fri, 13 Mar 2009 14:05:52 +0100 Subject: [PATCH] Set pthread stacksize for log thread correctly Forgot to modify log pthread, too. Signed-off-by: Hannes Reinecke <hare@suse.de> --- libmultipath/log_pthread.c | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-) diff --git a/libmultipath/log_pthread.c b/libmultipath/log_pthread.c index 9e9aebe..106326f 100644 --- a/libmultipath/log_pthread.c +++ b/libmultipath/log_pthread.c @@ -4,6 +4,7 @@ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> +#include <limits.h> #include <pthread.h> #include <sys/mman.h> @@ -53,9 +54,30 @@ static void * log_thread (void * et) void log_thread_start (void) { pthread_attr_t attr; + size_t stacksize; logdbg(stderr,"enter log_thread_start\n"); + if (pthread_attr_init(&attr)) { + fprintf(stderr,"can't initialize log thread\n"); + exit(1); + } + + if (pthread_attr_getstacksize(&attr, &stacksize) != 0) + stacksize = PTHREAD_STACK_MIN; + + /* Check if the stacksize is large enough */ + if (stacksize < (64 * 1024)) + stacksize = 64 * 1024; + + /* Set stacksize and try to reinitialize attr if failed */ + if (stacksize > PTHREAD_STACK_MIN && + pthread_attr_setstacksize(&attr, stacksize) != 0 && + pthread_attr_init(&attr)) { + fprintf(stderr,"can't set log thread stack size\n"); + exit(1); + } + logq_lock = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t)); logev_lock = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t)); logev_cond = (pthread_cond_t *) malloc(sizeof(pthread_cond_t)); @@ -64,9 +86,6 @@ void log_thread_start (void) pthread_mutex_init(logev_lock, NULL); pthread_cond_init(logev_cond, NULL); - pthread_attr_init(&attr); - pthread_attr_setstacksize(&attr, 64 * 1024); - if (log_init("multipathd", 0)) { fprintf(stderr,"can't initialize log buffer\n"); exit(1); -- 1.6.0.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor