Some systems (like PowerPC) cannot work with 64k thread stacks. Setting the
stack lower will error and the whole process aborts. An example error:
$ growisofs -dvd-compat -Z /dev/hda=my.iso
Executing 'builtin_dd if=my.iso of=/dev/hda obs=32k seek=0'
:-( failed to create thread: Input/output error
So if the minimum required size is larger than 64k, we'll just use whatever
the system defines. If it is smaller, we'll stick with 64k.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
--- dvd+rw-tools-7.0/mp.h
+++ dvd+rw-tools-7.0/mp.h
@@ -31,6 +31,16 @@
#include <sched.h>
#include <semaphore.h>
#include <stdlib.h>
+#include <limits.h>
+
+/* some systems (like powerpc) cannot work with 64k stacks */
+#define MY_STACK_SIZE 64*1024
+#ifdef PTHREAD_STACK_MIN
+# if MY_STACK_SIZE < PTHREAD_STACK_MIN
+# undef MY_STACK_SIZE
+# define MY_STACK_SIZE PTHREAD_STACK_MIN
+# endif
+#endif
#define THR_TYPE int
@@ -39,7 +49,7 @@
pthread_attr_t attr;
if (pthread_attr_init(&attr)==0 &&
- pthread_attr_setstacksize(&attr,64*1024)==0 &&
+ pthread_attr_setstacksize(&attr,MY_STACK_SIZE)==0 &&
pthread_attr_setscope(&attr,PTHREAD_SCOPE_SYSTEM)==0 &&
pthread_create(&h,&attr,(void *(*)(void *))func,arg)==0 )
return (void *)h;
Attachment:
signature.asc
Description: This is a digitally signed message part.