You can't just download an ELF file into memory and execute it because an ELF file needs processing to load in the first place. An ELF file has potentially many separate memory segments with different characteristics, not one glob that it just lives in.
Build a shared library, use dlopen, that's what they're there for. Not to mention that how libraries are handled can depend a lot on your architecture and configuration, doing that manually yourself would be very unportable(not to mention reinventing the wheel.)
It handles everything for you, from filename to symbol name in two easy steps. Here's an example:
Last edited by Corona688; 01-07-2010 at 12:39 PM..
Hi All,
I have a requirement to zip and compress files with dynamic names (which includes date and time component in their names) needs to be compressed with same name.
for example I have a file T.30.SLS_ORD.SO.27.2_2_2.20080623.041415.dat which needs to archived as... (1 Reply)
I have a few questions about elf files and how they are executed.
When gcc compiles a elf file it creates an executable. Is this executable then run directly by the hardware or does the kernel get involved, interpret the elf file and place the asm code directly in memory.
Cheers (0 Replies)
Hello guys,
i'm searching for a solution how to download all files from root-directory of an ftp-server through an ftp proxy
getting through the ftp proxy and download one file with get ist no problem, but mget * does nothing!
ftp -n -i -v <<EOF
open proxyHost proxyPort
user... (19 Replies)
Hi every one,
I have the requirement to download the files from FTP and move those files to unix box. Once after coping the files, i need to remove the files in FTP.
I'm a newbie in Unix script. Can you please suggest a script for this.. Thanks in advance.. (2 Replies)
Hi I have to run the script (a part of the code) in a loop for the no of times the files present in the directory, by taking one file and process and next another file.
For example, if we do ls and the result have:
$ls
abc.dat def.dat ghi.dat
The script code should loop for 3... (4 Replies)
hey
i have a text file thats filled with info like this
$ cat /private/var/lib/apt/lists/idwaneo.org_repo_._Packages
Package: org.idwaneo.ldid
Priority: optional
Section: iDWANEO.org
Maintainer: Admin <admin@idwaneo.org>
Architecture: iphoneos-arm
Version: 610-5
Pre-Depends: dpkg... (1 Reply)
Hello I'm having a little difficulty in writing a shell script for a few simple tasks.
First I have two files "file1.txt" and "file2.txt" and I want to read and compare the last line of each file. The files look like this.
File1.txt
File2.txt
After comparing the two lines I would... (2 Replies)
Hi All,
I got struck at the below point where i am unable to get the desired output after forming the dynamic conditions.Below is the design.
1. We are getting inputs from the shell arguments and storing in a variable like below.
CONDITIONS="1=CT,2=US_10,3=CT_US_10"
2. After this i am... (14 Replies)
Discussion started by: cskumar
14 Replies
LEARN ABOUT FREEBSD
elf_cntl
ELF_CNTL(3) BSD Library Functions Manual ELF_CNTL(3)NAME
elf_cntl -- control an elf file descriptor
LIBRARY
ELF Access Library (libelf, -lelf)
SYNOPSIS
#include <libelf.h>
int
elf_cntl(Elf *elf, Elf_Cmd cmd);
DESCRIPTION
Function elf_cntl() controls the ELF library's subsequent use of the file descriptor used to create ELF descriptor elf.
Argument cmd informs the library of the action to be taken:
ELF_C_FDDONE This value instructs the ELF library not to perform any further I/O on the file descriptor associated with argument elf. For
ELF descriptors opened with mode ELF_C_WRITE or ELF_C_RDWR subsequent elf_update() operations on the descriptor will fail.
ELF_C_FDREAD This value instructs the ELF library to read in all necessary data associated with ELF descriptor elf into memory so that the
underlying file descriptor can be safely closed with command ELF_C_FDDONE.
Argument elf must be an ELF descriptor associated with a file system object (e.g., an ar(1) archive, an ELF file, or other data file).
IMPLEMENTATION NOTES
Due to use of mmap(2) internally, this function is a no-op for ELF objects opened in ELF_C_READ mode.
RETURN VALUES
Function elf_cntl() returns 0 on success, or -1 if an error was detected.
ERRORS
[ELF_E_ARCHIVE] Argument elf is a descriptor for an archive member.
[ELF_E_ARGUMENT] Argument elf was NULL.
[ELF_E_ARGUMENT] Argument cmd was not recognized.
[ELF_E_MODE] An ELF_C_FDREAD operation was requested on an ELF descriptor opened for writing.
SEE ALSO elf(3), elf_begin(3), elf_end(3), elf_next(3), elf_update(3), gelf(3)BSD August 9, 2006 BSD