On Fri, May 13, 2016 at 14:32:06 +0200, Michal Privoznik wrote: > There is some magic going on when it comes to stat() or lstat(). > Basically, stat() can either be a regular function, an inline > function that calls __xstat(_STAT_VER, ...) or a macro that does > the same as the inline func. Don't ask why is that, just read the > documentation in sys/stat.h and make sure you have a bucket next > to you. Anyway, currently there will not be both stat and __xstat > symbols at the same time, as one of them gets overwritten to the > other one during compilation. But this is not true anymore once > we start chaining our mocking libraries. Therefore we need a > wrapper that calls desired function from glibc. > > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> > --- > tests/vircgroupmock.c | 14 +++++++------- > tests/virmock.h | 23 +++++++++++++++++++++++ > tests/virpcimock.c | 19 +++++++++---------- > 3 files changed, 39 insertions(+), 17 deletions(-) > [...] > diff --git a/tests/virmock.h b/tests/virmock.h > index 62a7c8f..27c03ba 100644 > --- a/tests/virmock.h > +++ b/tests/virmock.h > @@ -254,6 +255,28 @@ > static void (*real_##name)(void); \ > void name(void) > > +static inline int > +callStat(int (*realStat)(const char *, struct stat *), > + int (*realXstat)(int, const char *, struct stat *), This is a bit ugly, but it's in the mock code and I don't know of a better option. ACK
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list