LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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


Reply
  Search this Thread
Old 10-24-2009, 11:45 PM   #1
zeegeek
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Rep: Reputation: 0
library interposition


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.
 
Old 10-26-2009, 01:21 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
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.
 
Old 10-26-2009, 08:30 AM   #3
zeegeek
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
  


Reply

Tags
library, linking, php, static



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 12:31 PM
install from source - unable to find the libcurl library - but library is installed pulper Linux - Newbie 2 02-23-2009 09:00 PM
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-04-2007 11:11 PM
howto compile bin with my library using all-static and shared linked standart library stpg Programming 4 06-29-2004 04:20 AM
what is the function library of the basic graphics library in rethat9.0? zerwolve Red Hat 0 04-29-2004 09:18 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:25 AM.

Main Menu
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration