This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to write unlink() wrapper for linux-i386?


I'd like to write a wrapper for the unlink() syscall that raises SIGSTOP
if the filename matches a certain pattern. 
AFAICS, glibc currently does not have an unlink wrapper that I could just
hack on (for the linux-i386 platform), so I'd be grateful if someone could
tell me 

a) what my wrapper should look like. My guess is that it should look like
sysdeps/unix/sysv/aix/unlink.c, i.e. with function name "__unlink" and
*without* the "weak_alias (__unlink, unlink)" statement I see in other
unlink.c files.

b) how I call the real syscall from my wrapper.
sysdeps/unix/sysv/aix/unlink.c just calls "unlink()" (without
underscores). Is that how it works?

c) where I should best put my unlink.c wrapper. sysdeps/unix/sysv/linux
looks like a good place.

d) what Makefiles (and possibly other files) I have to change in what way
to make glibc build my wrapper into the library. I'm completely lost here.

e) if I can just #include <signal.h> and call raise(SIGSTOP) in my
wrapper, or if there are some things I have to look out for (e.g. writing
"__raise" instead of "raise" or whatever)

Thanks for any help you can give me.

MSB

-- 
Who is this General Failure,
and why is he reading my disk ?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]