Re: multiple symbols of select(), do they matter?
Re: multiple symbols of select(), do they matter?
- Subject: Re: multiple symbols of select(), do they matter?
- From: Jean-Daniel Dupas <email@hidden>
- Date: Sun, 7 Sep 2008 10:42:12 +0200
Le 7 sept. 08 à 02:57, Luke Daley a écrit :
Hi,
For my library that interposes read(), write(), open(), close() and
select(), I am wondering if I need to be a bit smarter about what I
do depending on which _variant_ of each of these is actually called.
My select() stuff looks like this…
int select(int, fd_set * __restrict, fd_set * __restrict, fd_set *
__restrict, struct timeval * __restrict) __asm("_select");
int select_darwinextsn(int, fd_set * __restrict, fd_set *
__restrict, fd_set * __restrict, struct timeval * __restrict)
__asm("_select$DARWIN_EXTSN");
int select_darwinextsn_nocancel(int, fd_set * __restrict, fd_set *
__restrict, fd_set * __restrict, struct timeval * __restrict)
__asm("_select$DARWIN_EXTSN$NOCANCEL");
int select_nocancel_unix2003(int, fd_set * __restrict, fd_set *
__restrict, fd_set * __restrict, struct timeval * __restrict)
__asm("_select$NOCANCEL$UNIX2003");
int select_unix2003(int, fd_set * __restrict, fd_set * __restrict,
fd_set * __restrict, struct timeval * __restrict) __asm("_select
$UNIX2003");
int select(int nfds, fd_set * __restrict readfds, fd_set *
__restrict writefds, fd_set * __restrict errorfds, struct timeval *
__restrict timeout) {
// my code
int (*real_select)(int nfds, fd_set * __restrict readfds, fd_set
* __restrict writefds, fd_set * __restrict errorfds, struct timeval
* __restrict timeout) = dlsym(RTLD_NEXT, "select");
result = real_select(nfds, readfds, writefds, errorfds, timeout);
// my code
return result;
}
int select_darwinextsn(int nfds, fd_set * __restrict readfds, fd_set
* __restrict writefds, fd_set * __restrict errorfds, struct timeval
* __restrict timeout) {
return select(nfds, readfds, writefds, errorfds, timeout);
}
int select_darwinextsn_nocancel(int nfds, fd_set * __restrict
readfds, fd_set * __restrict writefds, fd_set * __restrict errorfds,
struct timeval * __restrict timeout) {
return select(nfds, readfds, writefds, errorfds, timeout);
}
int select_nocancel_unix2003(int nfds, fd_set * __restrict readfds,
fd_set * __restrict writefds, fd_set * __restrict errorfds, struct
timeval * __restrict timeout) {
return select(nfds, readfds, writefds, errorfds, timeout);
}
int select_unix2003(int nfds, fd_set * __restrict readfds, fd_set *
__restrict writefds, fd_set * __restrict errorfds, struct timeval *
__restrict timeout) {
return select(nfds, readfds, writefds, errorfds, timeout);
}
So my question is really two parts; Do they different variants of
select() in libSystem actually do different things? And should I be
actually fetching the implementation with dlsym() that matches what
was actually called by the client of my code?
For example, the 'NOCANCEL' variant makes me nervous, seems like I
should be doing something there. But, I have no idea what.
I am asking this for read(), write(), open() and close() as well.
Thanks,
Why you do no simply call the matching function instead of using the
same select call for all variants ?
for example
int select_unix2003(int nfds, fd_set * __restrict readfds, fd_set *
__restrict writefds, fd_set * __restrict errorfds, struct timeval *
__restrict timeout) {
my_before_select();
int result;
int (*real_select)(int nfds, fd_set * __restrict readfds, fd_set *
__restrict writefds, fd_set * __restrict errorfds, struct timeval *
__restrict timeout) = dlsym(RTLD_NEXT, "select$UNIX2003");
result = real_select(nfds, readfds, writefds, errorfds, timeout);
my_after_select();
return result;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden