Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6943649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:11:01+00:00 2026-05-27T13:11:01+00:00

When I try to use LD_PRELOAD as following, LD_PRELOAD=getpid.so ./testpid I get the following

  • 0

When I try to use LD_PRELOAD as following,

LD_PRELOAD=getpid.so ./testpid

I get the following error…

ERROR: ld.so: object 'getpid.so' from LD_PRELOAD cannot be preloaded: ignored.

I compile getpid.so by using

gcc -Wall -fPIC -shared -o getpid.so getpid.c

and it contains the following code…

// getpid.c
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>

pid_t getpid(void)
{
    printf("Hello, world!\n");
    return syscall(SYS_getpid);
}

tespid.c constains code which uses getpid as shown below and which is compiled by doing

gcc testpid -o testpid.c

What can be the problem here? Why is LD_PRELOAD not working?

// testpid.c
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>

int main()
{
    printf( "pid = %d!\n", getpid() );

    return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:11:02+00:00Added an answer on May 27, 2026 at 1:11 pm

    Looks like the loader is unable to find getpid.so as you’ve not mentioned the path to the library.

    Try:

    LD_PRELOAD=/full/path/to/getpid.so ./testpid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whatever I try to compile in Cygwin I get the following output: checking for
I'm trying to use JSON parsing from RestKit, but I'm receiving the following compile
I try to use jboss-seam with a db2 database, the following error occurs com.ibm.db2.jcc.a.SqlException:
I try to use doctest from example from http://docs.python.org/library/doctest.html But when I run python
I try to use the following code: ArrayList<String> Map<String, String> Eclipse complains about both
I try to use amazon API using PHP. If I use print_r($parsed_xml->Items->Item->ItemAttributes) it show
I try to use the SQL statement SELECT * FROM table ORDER BY column
After adding Appirater to my iOS project, when I compile, I get the error:
Every time I try to use my add function and return a list from
When I try to compile that, I receive a particular error. But, it's not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.