Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Function Interposition in Linux Post 302661771 by chercheur857 on Monday 25th of June 2012 05:54:57 PM
Old 06-25-2012
Quote:
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.
--> i have done all what you say , i have modified the code like that:
Quote:
size_t write(int fd, const void *buf, size_t count)
{
static size_t (*write_func)(int, const void *, size_t) = NULL;

/* get reference to original (libc provided) write */
if (!write_func)
{
write_func = (size_t(*)(int, const void *, size_t)) dlsym(RTLD_NEXT, "write");
}
return write_func(fd, buffer, sizeof (buffer));
}
I have a question please :how canget the buffer "const void *buf" because I want to change it before sending ?

Thank you so much for help
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing global variable to a function which is called by another function

Hi , I have three funcions f1, f2 and f3 . f1 calls f2 and f2 calls f3 . I have a global variable "period" which i want to pass to f3 . Can i pass the variable directly in the definition of f3 ? Pls help . sars (4 Replies)
Discussion started by: sars
4 Replies

2. Shell Programming and Scripting

SHELL SCRIPT Function Calling Another Function Please Help...

This is my function which is creating three variables based on counter & writing these variable to database by calling another function writeRecord but only one record is getting wrote in DB.... Please advise ASAP...:confused: function InsertFtg { FTGSTR="" echo "Saurabh is GREAT $#" let... (2 Replies)
Discussion started by: omkar.sonawane
2 Replies

3. Shell Programming and Scripting

system() function nd backtrick term in linux

I want to know about the difference between system() function nd backtrick term in linux???? (1 Reply)
Discussion started by: Mac91
1 Replies

4. UNIX for Advanced & Expert Users

What is the function to get address of the virtual memory block in linux??

I want address of current virtual memory block? i am using fedora10:wall::wall: (1 Reply)
Discussion started by: powyama
1 Replies

5. UNIX for Dummies Questions & Answers

cut function in linux

hi; i have file with a lote of data i would like to cut only numbers that start with prefix 20408 my file contain thousands of rows like this ,204080700152648,20111215,,,20 31630536259,204080662332510,20 31622520779,204080660098298,20 31651343790,204080130071280,20... (2 Replies)
Discussion started by: kpinto
2 Replies

6. Programming

[C/Linux]Help in replacing obsolete function

Hi guys, I need help on some function replacement cause I get obsolete function warning(and I must remove it): -gethostbyaddr(arg1,arg2,arg3) -gethostbyname(arg1) -getservbyname(arg1,arg2) can be replaced with getaddrinfo(arg1,arg2,arg3,arg4) but I'm not able to undestand how(libraries... (0 Replies)
Discussion started by: fracche
0 Replies

7. Homework & Coursework Questions

C++ with Linux - writing a "tee"-like function

Greetings, everyone. 1. The problem statement, all variables and given/known data: I'm running into a problem with my program concerning the actual output it does. When I open the file that gets the output, it contains a large number of hex(?) variables and not what the user wants. The... (0 Replies)
Discussion started by: assignmentoper
0 Replies

8. Shell Programming and Scripting

Will files, creaetd in one function of the same script will be recognized in another function?

Dear All. I have a script, which process files one by one. In the script I have two functions. one sftp files to different server the other from existing file create file with different name. My question is: Will sftp function recognize files names , which are created in another... (1 Reply)
Discussion started by: digioleg54
1 Replies

9. Shell Programming and Scripting

Need help on awk for printing the function name inside each function

Hi, I am having script which contains many functions. Need to print each function name at the starting of the function. Like below, functionname() { echo "functionname" commands.... } I've tried like below, func=`grep "()" scriptname | cut -d "(" -f1` for i in $func do nawk -v... (4 Replies)
Discussion started by: Sumanthsv
4 Replies

10. Shell Programming and Scripting

Function - Make your function return an exit status

Hi All, Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition. #Body function1() { if then echo "exist" else echo "not exist" } #if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies
ldns(3) 						     Library Functions Manual							   ldns(3)

NAME
ldns_buffer_write_at, ldns_buffer_write_at, ldns_buffer_write, ldns_buffer_write_string_at, ldns_buffer_write_string, ldns_buf- fer_write_u8_at, ldns_buffer_write_u8, ldns_buffer_write_u16_at, ldns_buffer_write_u16, ldns_buffer_read_at, ldns_buffer_read, ldns_buf- fer_read_u8_at, ldns_buffer_read_u8, ldns_buffer_read_u16_at, ldns_buffer_read_u16, ldns_buffer_read_u32_at, ldns_buffer_read_u32 SYNOPSIS
#include <stdint.h> #include <stdbool.h> #include <ldns/ldns.h> void ldns_buffer_write_at(ldns_buffer *buffer, size_t at, const void *data, size_t count); void ldns_buffer_write_at(ldns_buffer *buffer, size_t at, const void *data, size_t count); void ldns_buffer_write(ldns_buffer *buffer, const void *data, size_t count); void ldns_buffer_write_string_at(ldns_buffer *buffer, size_t at, const char *str); void ldns_buffer_write_string(ldns_buffer *buffer, const char *str); void ldns_buffer_write_u8_at(ldns_buffer *buffer, size_t at, uint8_t data); void ldns_buffer_write_u8(ldns_buffer *buffer, uint8_t data); void ldns_buffer_write_u16_at(ldns_buffer *buffer, size_t at, uint16_t data); void ldns_buffer_write_u16(ldns_buffer *buffer, uint16_t data); void ldns_buffer_read_at(ldns_buffer *buffer, size_t at, void *data, size_t count); void ldns_buffer_read(ldns_buffer *buffer, void *data, size_t count); uint8_t ldns_buffer_read_u8_at(ldns_buffer *buffer, size_t at); uint8_t ldns_buffer_read_u8(ldns_buffer *buffer); uint16_t ldns_buffer_read_u16_at(ldns_buffer *buffer, size_t at); uint16_t ldns_buffer_read_u16(ldns_buffer *buffer); uint32_t ldns_buffer_read_u32_at(ldns_buffer *buffer, size_t at); uint32_t ldns_buffer_read_u32(ldns_buffer *buffer); DESCRIPTION
ldns_buffer_write_at() writes the given data to the buffer at the specified position buffer: the buffer at: the position (in number of bytes) to write the data at data: pointer to the data to write to the buffer count: the number of bytes of data to write ldns_buffer_write_at() writes the given data to the buffer at the specified position buffer: the buffer at: the position (in number of bytes) to write the data at data: pointer to the data to write to the buffer count: the number of bytes of data to write ldns_buffer_write() writes count bytes of data to the current position of the buffer buffer: the buffer data: the data to write count: the lenght of the data to write ldns_buffer_write_string_at() copies the given (null-delimited) string to the specified position at the buffer buffer: the buffer at: the position in the buffer str: the string to write ldns_buffer_write_string() copies the given (null-delimited) string to the current position at the buffer buffer: the buffer str: the string to write ldns_buffer_write_u8_at() writes the given byte of data at the given position in the buffer buffer: the buffer at: the position in the buffer data: the 8 bits to write ldns_buffer_write_u8() writes the given byte of data at the current position in the buffer buffer: the buffer data: the 8 bits to write ldns_buffer_write_u16_at() writes the given 2 byte integer at the given position in the buffer buffer: the buffer at: the position in the buffer data: the 16 bits to write ldns_buffer_write_u16() writes the given 2 byte integer at the current position in the buffer buffer: the buffer data: the 16 bits to write ldns_buffer_read_at() copies count bytes of data at the given position to the given data-array buffer: the buffer at: the position in the buffer to start data: buffer to copy to count: the length of the data to copy ldns_buffer_read() copies count bytes of data at the current position to the given data-array buffer: the buffer data: buffer to copy to count: the length of the data to copy ldns_buffer_read_u8_at() returns the byte value at the given position in the buffer buffer: the buffer at: the position in the buffer Returns 1 byte integer ldns_buffer_read_u8() returns the byte value at the current position in the buffer buffer: the buffer Returns 1 byte integer ldns_buffer_read_u16_at() returns the 2-byte integer value at the given position in the buffer buffer: the buffer at: position in the buffer Returns 2 byte integer ldns_buffer_read_u16() returns the 2-byte integer value at the current position in the buffer buffer: the buffer Returns 2 byte integer ldns_buffer_read_u32_at() returns the 4-byte integer value at the given position in the buffer buffer: the buffer at: position in the buffer Returns 4 byte integer ldns_buffer_read_u32() returns the 4-byte integer value at the current position in the buffer buffer: the buffer Returns 4 byte integer AUTHOR
The ldns team at NLnet Labs. Which consists out of Jelte Jansen and Miek Gieben. REPORTING BUGS
Please report bugs to ldns-team@nlnetlabs.nl or in our bugzilla at http://www.nlnetlabs.nl/bugs/index.html COPYRIGHT
Copyright (c) 2004 - 2006 NLnet Labs. Licensed under the BSD License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
ldns_buffer. And perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035. REMARKS
This manpage was automaticly generated from the ldns source code by use of Doxygen and some perl. 30 May 2006 ldns(3)
All times are GMT -4. The time now is 10:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy