From: 肖鹏 <xiaopeng_phy@163.com>
To: libc-help@sourceware.org
Subject: glibc interception problems
Date: Tue, 25 May 2021 10:30:58 +0800 (CST) [thread overview]
Message-ID: <cd6040e.12c1.179a15c68cf.Coremail.xiaopeng_phy@163.com> (raw)
Hi ,
I'm developping a library for a distributed file system, using LD_PRELOAD to intercept file related calls to glibc.
Programs directly using unbuffered IO (close/open/read/write) work well with my library. But programs using buffered IO (fclose/fopen/fread/fwrite) will call unbuffered functions of glibc instead of my library.
The reason is that in glibc, buffered IO depend on internal symbols, which cannot be intercepted.
I can see two ways to work around this:
1. Implement buffered IO in my library.
2. Modify glibc buffered IO to use public symbols, and maintain a custom version of glibc.
Both ways have drawbacks. Do you have any suggestions about this?
Thanks very much! Hope for your response.
next reply other threads:[~2021-05-25 2:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-25 2:30 肖鹏 [this message]
2021-05-25 3:10 ` Mike Frysinger
[not found] ` <4f73c540.6a6.179a6344524.Coremail.xiaopeng_phy@163.com>
2021-05-26 3:47 ` Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cd6040e.12c1.179a15c68cf.Coremail.xiaopeng_phy@163.com \
--to=xiaopeng_phy@163.com \
--cc=libc-help@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).