[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

syscalls in glibc

From: devnetfs
Subject: syscalls in glibc
Date: Mon, 20 Jan 2003 11:13:20 -0800 (PST)

Hello Gurus,

I have a C program that uses clone(2) system call on Linux. The program
also links with pthreads library (why -- please dont ask!), but does
not use ANY pthread_XXX functions.

When I try to use system calls close(2), open(2) etc. in the clone
thread I get SIGSEGV. I know that NOT good, but I want to use clone(). 
I guess that's because by *linking* with pthread redefines errno etc.
and these syscall wrappers of glibc touch errno if the syscall returns
an error (can somebody give the EXACT reason why a SIGSEGV happens?).

Ok, so I thought maybe I can use internal __libc_close() kindof calls
that (maybe) dont touch "errno" and return the value of syscall
directly. But they do touch errno :(

So is there a way in glibc to call system calls directly (without
resorting to assembly) and get the return value of the syscall
directly instead of putting it in errno. Even the syscall() function
touches "errno". This will help me do some basic system calls in the
clone() thread context. Is this possible? If yes how?

I did download the glibc source rpm (redhat) and tried searching
the sources but I could NOT find the implementation of syscalls?
for e.g. ioctl() calls __ioctl(). but where is __ioctl() defined?
same for __open()... got confused and left that search :( 

If somebody can tell me what magic goes there I would be glad to see
the sources and NOT bug you people.

Thanks in Advance,

ps: if this is NOT the right list to post such queries please tell me
the correct one and sorry for the spam.

Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]