Sponsored Content
Top Forums UNIX for Advanced & Expert Users User defined stacks for threads using glibc-2.3.5 Post 302180377 by mysterious on Monday 31st of March 2008 01:47:49 AM
Old 03-31-2008
User defined stacks for threads using glibc-2.3.5

Hi,

I am currently working with threads using linux 2.6.11 and glibc 2.3.5 on x86. When i am trying to create thread with user defined stacks glibc gives segmentation fault. I have written a wrapper to pthread_create () and generated shared object for the same. When i am trying to create any thread (for user defined stack) using this shared object i am getting segmentation fault. If i don't create shared object and try to create thread (with user defined stack) using same code, it works fine. I am not able to understand this behavior. Why creating a thread using shared object shall result in segfault. And how to overcome this situation.

NOTE: I got same behavior when tried with linux 2.6.12 and glibc-2.3.6 on arm platform.


gdb output for the behavior is :

Loaded symbols for /lib/libgcc_s.so.1
#0 0x0018a777 in memset () from /lib/libc.so.6
(gdb) bt'
#0 0x0018a777 in memset () from /lib/libc.so.6
No symbol table info available.
#1 0x003e27ef in pthread_create@@GLIBC_2.1 () from /lib/libpthread.so.0
No symbol table info available.
#2 0x003e29fd in pthread_create@GLIBC_2.0 () from /lib/libpthread.so.0
No symbol table info available.
#3 0x00ed9880 in process_create (entry_point=0x8048f4c <ThreadEntryPoint>, pArg=0x1, pStack=0x82e08a8, ulStack_Size=16384, ulPrio=127)
at multithreading.c:1916
stThAttr = {__size = "c\000\000\000\002\000\000\000j\000\000\000\000\02 0\000\000¨H.\b\000@", '\0' <repeats 13 times>, __align = 99}
stSchedParam = {__sched_priority = 99}
pstTd = (ThreadData_t *) 0xedd7d8
state = 0
chPriority = 99 'c'
ulRetVal = 0
pRetVal = 0x0
__FUNCTION__ = "process_create"
#4 0x08049af8 in process_create_test (ulInParam=1) at multithreading_test.c:539
ulIndex = 0
lRetVal = -1
ulThreadIndex = 1
lTestPassFlag = 0
stack = (void *) 0x82d88a8
pStack = (void *) 0x82e08a8
ulPrio = 127
stackSize = 16384
__FUNCTION__ = "process_create_test"
#5 0x0804b14b in main () at multithreading_test.c:1460
chChoice = "1"
lChoice = 1
stack = (void *) 0x0
stackSize = 0
ulPrio = 0
ulLoopIndex = 0
stTime = 134533384
stTimeInfo = {tm_sec = 4, tm_min = 53, tm_hour = 7, tm_mday = 7, tm_mon = 3, tm_year = 74, tm_wday = 0, tm_yday = 96, tm_isdst = 0,
tm_gmtoff = 19800, tm_zone = 0x82d81b8 "IST"}
achTimebuf = "04/07/1974 07:53:w"
stThAttr = {__size = '\0' <repeats 13 times>, "\020", '\0' <repeats 21 times>, __align = 0}
lFlag = 1
chFlag = 0
lTestPassFlag = 0
ulThreadIndex = 0
ulloopIndex = 1
ulThreadId = {0, 0, 0, 0}
__FUNCTION__ = "main"
(gdb) f 0
#0 0x0018a777 in memset () from /lib/libc.so.6
(gdb) f 1
#1 0x003e27ef in pthread_create@@GLIBC_2.1 () from /lib/libpthread.so.0
(gdb)


Please let me know if someone can help me.

Thanks,
Ashish
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Nawk user-defined function

HELP!!!! I am in an on-line shell programming class and have a question. Here is the data: Mike Harrington:(510) 548-1278:250:100:175 Christian Dobbins:(408) 538-2358:155:90:201 Susan Dalsass:(206) 654-6279:250:60:50 (There are 12 contribuors total) This database contains names, phone... (1 Reply)
Discussion started by: NewbieGirl
1 Replies

2. AIX

User defined signal 1

Hi, I am just running a incremental back-up on one of my server. But these days It abrubtly fails with below error. ========== User defined signal 1 =========== When I rerun the back-up, It completed successfully.Earlier this was not happening. Any Idea, what could be the problem... (0 Replies)
Discussion started by: nitesh_raj
0 Replies

3. UNIX for Dummies Questions & Answers

User defined service

I want to add a new IP service which executes a script on SCO OS5. I have amended /etc/services and added to port number (3333) I have amended /etc/inetd.conf and added a line for this service but I can't get it to execute my own shell script When I telnet to the IP address on port 3333 I... (1 Reply)
Discussion started by: markdrury
1 Replies

4. Shell Programming and Scripting

need help with User Defined Function

Dear Friends, I need a help regarding User defined function in shell script. My problem is as follows: my_func.sh my_funcI(){ grep 'mystring' I.dat } my_funcQ(){ grep 'mystring' Q.dat } myfuncI myfuncQ But As both the function has same function only the... (11 Replies)
Discussion started by: user_prady
11 Replies

5. Linux

User defined stacks for threads using glibc-2.3.5

Hi, I am currently working with threads using linux 2.6.11 and glibc 2.3.5 on x86. When i am trying to create thread with user defined stacks glibc gives segmentation fault. I have written a wrapper to pthread_create () and generated shared object for the same. When i am trying to create any... (0 Replies)
Discussion started by: mysterious
0 Replies

6. Programming

add more user-defined signals

Hi Is there a way to add more user-defined signals? I am currently using SIGUSR1 and SIGUSR2 - but I need another one. How can I do that? Thanks! (9 Replies)
Discussion started by: naamabm
9 Replies

7. Shell Programming and Scripting

User defined functions in awk

Hi; Is der ne to to use user defined functions for the values in awk find $1 -type f -ls | nawk '{{print "|"$3"|"$5"|"$6"|"$8"|"$9"|"$10"|"} for(i=11;i<=NF;i++){printf("%s",$i)}}' In above command i want to append some values returned by user functions on line. thnks; ajay (1 Reply)
Discussion started by: ajaypadvi
1 Replies

8. UNIX for Dummies Questions & Answers

user defined commands

Hi, i would like to create user defined commands. e,g: if an user executes , mkdircd test then a directory called test should be created and it should be cd to test. How i can create the command mkdircd with below action: mkdir $1 && cd $1. Please help me in achieving this (7 Replies)
Discussion started by: pandeesh
7 Replies

9. UNIX and Linux Applications

Install glibc-debug for glibc-2.11.3-17.31.1 on SLES 11

I have to debug a function getopt_long in glibc-2.11.3-17.31.1. For that how can I download and install its corresponding glibc-debug on SLES 11? (8 Replies)
Discussion started by: rupeshkp728
8 Replies
libpthread(3LIB)						Interface Libraries						  libpthread(3LIB)

NAME
libpthread - POSIX threads library SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ -lrt library... ] DESCRIPTION
Historically, functions in this library provided POSIX threading support. See standards(5). This functionality now resides in libc(3LIB). This library is maintained to provide backward compatibility for both runtime and compilation environments. The shared object is imple- mented as a filter on libc.so.1. New application development needs to specify -lpthread only to obtain POSIX semantics for fork(2) that assumes the behavior of fork1(2) rather than the default behavior that forks all threads. INTERFACES
The shared object libpthread.so.1 provides the public interfaces defined below. See intro(3) for additional information on shared object interfaces. __pthread_cleanup_pop __pthread_cleanup_push pthread_attr_destroy pthread_attr_getdetachstate pthread_attr_getguardsize pthread_attr_getinheritsched pthread_attr_getschedparam pthread_attr_getschedpolicy pthread_attr_getscope pthread_attr_getstackaddr pthread_attr_getstacksize pthread_attr_init pthread_attr_setdetachstate pthread_attr_setguardsize pthread_attr_setinheritsched pthread_attr_setschedparam pthread_attr_setschedpolicy pthread_attr_setscope pthread_attr_setstackaddr pthread_attr_setstacksize pthread_cancel pthread_cond_broadcast pthread_cond_destroy pthread_cond_init pthread_cond_reltimedwait_np pthread_cond_signal pthread_cond_timedwait pthread_cond_wait pthread_condattr_destroy pthread_condattr_getpshared pthread_condattr_init pthread_condattr_setpshared pthread_create pthread_detach pthread_equal pthread_exit pthread_getconcurrency pthread_getschedparam pthread_getspecific pthread_join pthread_key_create pthread_key_delete pthread_kill pthread_mutex_consistent_np pthread_mutex_destroy pthread_mutex_getprioceiling pthread_mutex_init pthread_mutex_lock pthread_mutex_setprioceiling pthread_mutex_trylock pthread_mutex_unlock pthread_mutexattr_destroy pthread_mutexattr_getprioceiling pthread_mutexattr_getprotocol pthread_mutexattr_getpshared pthread_mutexattr_getrobust_np pthread_mutexattr_gettype pthread_mutexattr_init pthread_mutexattr_setprioceiling pthread_mutexattr_setprotocol pthread_mutexattr_setpshared pthread_mutexattr_setrobust_np pthread_mutexattr_settype pthread_once pthread_rwlock_destroy pthread_rwlock_init pthread_rwlock_rdlock pthread_rwlock_tryrdlock pthread_rwlock_trywrlock pthread_rwlock_unlock pthread_rwlock_wrlock pthread_rwlockattr_destroy pthread_rwlockattr_getpshared pthread_rwlockattr_init pthread_rwlockattr_setpshared pthread_self pthread_setcancelstate pthread_setcanceltype pthread_setconcurrency pthread_setschedparam pthread_setspecific pthread_sigmask pthread_testcancel FILES
/lib/libpthread.so.1 a filter on /lib/libc.so.1 /lib/64/libpthread.so.1 a filter on /lib/64/libc.so.1 ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsl (32-bit) | +-----------------------------+-----------------------------+ | |SUNWcslx (64-bit) | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
pvs(1), intro(2), intro(3), libc(3LIB), libc_db(3LIB), libthread(3LIB), attributes(5), standards(5), threads(5) SunOS 5.10 24 Mar 2004 libpthread(3LIB)
All times are GMT -4. The time now is 11:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy