LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Tags used in this thread
Popular LQ Tags , , , ,

Reply
 
Thread Tools
Old 10-25-2009, 12:45 AM   #1
zeegeek
LQ Newbie
 
Registered: Oct 2009
Posts: 2
Thanked: 0
library interposition


[Log in to get rid of this advertisement]
Hi,

I'm writing a simple libc interposition library for some library calls like open(), connect(), etc. However, it didn't seem to work on php's mysql module in particular. I created a simple php script which creates a connection to a mysql database, then closes it. However, none of the connect() calls showed up in my trace log produced by my interposition library. strace does show the connect() system call took place. I also used ltrace to see if the actual libc connect() was called, but it didn't show up. So it leads to the thinking of maybe the mysql module in php is statically linked. But running 'file' on the module said differently. 'ldd' also showed that it links to libc.

Is php compiled so that it's statically linked by default? If not, what else might cause it to make system calls without calling the corresponding libc functions?

I'm using Fedora 11 64-bit version.

Thank you.
linux zeegeek is offline  
Tag This Post , , , ,
Reply With Quote
Old 10-26-2009, 02:21 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 1,034
Thanked: 50
Quote:
Originally Posted by zeegeek View Post
Hi,

I'm writing a simple libc interposition library for some library calls like open(), connect(), etc. However, it didn't seem to work on php's mysql module in particular. I created a simple php script which creates a connection to a mysql database, then closes it. However, none of the connect() calls showed up in my trace log produced by my interposition library. strace does show the connect() system call took place. I also used ltrace to see if the actual libc connect() was called, but it didn't show up. So it leads to the thinking of maybe the mysql module in php is statically linked. But running 'file' on the module said differently. 'ldd' also showed that it links to libc.

Is php compiled so that it's statically linked by default? If not, what else might cause it to make system calls without calling the corresponding libc functions?

I'm using Fedora 11 64-bit version.

Thank you.
You told us nothing about what you did to make your library visible to the application.

I am particularly interested in your (in)actions regarding LD_LIBRARY_PATH, LD_RUN_PATH environment libraries.
linuxsuse Sergei Steshenko is offline     Reply With Quote
Old 10-26-2009, 09:30 AM   #3
zeegeek
LQ Newbie
 
Registered: Oct 2009
Posts: 2
Thanked: 0

Original Poster
Quote:
Originally Posted by Sergei Steshenko View Post
You told us nothing about what you did to make your library visible to the application.

I am particularly interested in your (in)actions regarding LD_LIBRARY_PATH, LD_RUN_PATH environment libraries.
Sorry for the lack of information in the original post. I used LD_PRELOAD to load my library when starting the application.

As a side note, I used my library on mysql-query-browser and it seemed to catch all the library calls from mysql client library. This might help to narrow the problem down to PHP's mysql module or the way it links to mysql client library.
linuxfedora zeegeek is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ldd reports shared library missing, but library exists on disk athv_gr Linux - Newbie 7 05-13-2009 01:31 PM
install from source - unable to find the libcurl library - but library is installed pulper Linux - Newbie 2 02-23-2009 10:00 PM
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-05-2007 12:11 AM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 05:20 AM
what is the function library of the basic graphics library in rethat9.0? zerwolve Red Hat 0 04-29-2004 10:18 PM


All times are GMT -5. The time now is 03:28 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration