|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Function Interposition in Linux
Hello, Please I try to apply the mechanism Interposition Function in Linux on the function write (write a socket) as follows: Code:
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <arpa/inet.h>
# include <netdb.h>
# include <stdio.h>
# include <string.h>
int write (int n, char buffer [32], int sb)
{
int nb = write (so, "Ceci est un exemple de socket!!!", 32);
}I also have the server code and client code, when the client connects to the server, the server sends a message to the client but when running I got the following error: Erreur de segmentation Have you an idea please ? Thank you so much |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
write is a system call, and you have write as a local function name. At best this becomes a never-ending recursive call.
Call your function mywrite() or something else, do not name your functions the same thing as syscalls, -read write open and so on. Interposition is acheived by writing a shared library module (call it mylibrary.so as an example), compling it, then creating a special environment variable, LD_PRELOAD=mylibrary.so, and then running your code. But you still cannot do what your code shows. |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Quote:
Quote:
Thank you so much for help |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [C/Linux]Help in replacing obsolete function | fracche | Programming | 0 | 01-29-2012 09:11 AM |
| cut function in linux | kpinto | UNIX for Dummies Questions & Answers | 2 | 12-28-2011 12:04 PM |
| What is the function to get address of the virtual memory block in linux?? | powyama | UNIX for Advanced & Expert Users | 1 | 09-28-2011 01:04 AM |
| system() function nd backtrick term in linux | Mac91 | Shell Programming and Scripting | 1 | 05-05-2011 12:16 PM |
| Passing global variable to a function which is called by another function | sars | Shell Programming and Scripting | 4 | 06-30-2008 11:39 AM |
|
|