19 messages in net.java.dev.jna.usersRe: [jna-users] stat() not mapping on...
FromSent OnAttachments
Thomas EneboNov 26, 2007 11:00 am 
Timothy WallNov 26, 2007 1:07 pm 
Timothy WallNov 26, 2007 1:58 pm 
Thomas E EneboNov 27, 2007 8:36 am 
Timothy WallNov 27, 2007 9:16 am 
Glick, Gene (GE Indust, Security)Nov 27, 2007 12:45 pm 
Stephen ConnollyNov 27, 2007 3:18 pm 
Glick, Gene (GE Indust, Security)Nov 28, 2007 6:16 am 
Timothy WallNov 28, 2007 9:15 am 
Glick, Gene (GE Indust, Security)Nov 28, 2007 11:37 am 
Glick, Gene (GE Indust, Security)Nov 28, 2007 11:59 am 
Glick, Gene (GE Indust, Security)Nov 28, 2007 12:05 pm 
Timothy WallNov 28, 2007 12:05 pm 
Wayne MeissnerNov 28, 2007 7:59 pm 
Glick, Gene (GE Indust, Security)Nov 29, 2007 6:43 am 
Nikolas LotzNov 29, 2007 7:41 am 
Glick, Gene (GE Indust, Security)Nov 30, 2007 9:05 am 
Timothy WallNov 30, 2007 11:13 am 
Glick, Gene (GE Indust, Security)Nov 30, 2007 11:56 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] stat() not mapping on Linux for me...Actions...
From:Timothy Wall (twal@dev.java.net)
Date:Nov 27, 2007 9:16:35 am
List:net.java.dev.jna.users

On Nov 27, 2007, at 11:36 AM, Thomas E Enebo wrote:

On Mon, 26 Nov 2007, Timothy Wall defenestrated me:

Looks like GCC maps "stat" (and fstat/lstat) to an inline function, which would explain why it doesn't show up in libc.so:

extern __inline__ int __attribute__ ((__nothrow__)) stat (__const char *__path, struct stat *__statbuf ) { return __xstat (3, __path, __statbuf); }

Library.Handler.invoke or Function.invoke seem like the logical points to tweak the invocation. If this is common, it might make sense to make a function mogrifier option for the library.

So would the invoke capture the UnsatisifiedLink and then try and invoke __xstat? Would I need to add __xstat to the Library interface too?

I think the easiest thing would be that if you're on Linux, wrap the original library in an extended interface which includes __xstat (so you don't clutter the original interface), then generate a new proxy using the extended interface. the invocation handler for the new proxy forwards most calls to the original, but intercepts stat/fstat/ lstat and redirects them to __xstat, after fiddling with the arguments the way the inline function does. The extended interface can be used interchangeably with the generic one, so everything is transparent.