unix stat command on files via FFI

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

unix stat command on files via FFI

johnmci
I'm wondering if anyone has coded up the FFI for doing a unix stat  
command? If so could they share it?

--
=
=
=
========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
=
=
=
========================================================================



Reply | Threaded
Open this post in threaded view
|

Re: unix stat command on files via FFI

David T. Lewis
On Thu, Jan 03, 2008 at 02:29:37AM -0800, John M McIntosh wrote:
> I'm wondering if anyone has coded up the FFI for doing a unix stat  
> command? If so could they share it?

It's not FFI, but just in case you had not noticed it, you can do this:

  OSProcess accessor fileStat: '/bin/su'

The result is an array of stat() information, or an error string
derived from errno via strerror(). It's not the complete contents
of the stat structure though, see method comment of #primFileStat:
for details.

Also note that FFI is not yet working for 64bit host Linux (e.g.
Linux on AMD 64). Does it work on OS X?

Dave


Reply | Threaded
Open this post in threaded view
|

Re: unix stat command on files via FFI

johnmci

On Jan 3, 2008, at 5:09 AM, David T. Lewis wrote:
> Also note that FFI is not yet working for 64bit host Linux (e.g.
> Linux on AMD 64). Does it work on OS X?

nope.  A bit of assembler work in the

/* x86-sysv-asm.S -- 386 FFI trampoline for SVr4-like ABIs -*- asm -*-

well and C work too.


--
=
=
=
========================================================================
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
=
=
=
========================================================================



Reply | Threaded
Open this post in threaded view
|

Re: unix stat command on files via FFI

David T. Lewis
On Thu, Jan 03, 2008 at 01:46:07PM -0800, John M McIntosh wrote:

>
> On Jan 3, 2008, at 5:09 AM, David T. Lewis wrote:
> >Also note that FFI is not yet working for 64bit host Linux (e.g.
> >Linux on AMD 64). Does it work on OS X?
>
> nope.  A bit of assembler work in the
>
> /* x86-sysv-asm.S -- 386 FFI trampoline for SVr4-like ABIs -*- asm -*-
>
> well and C work too.

The FFIPlugin will need updates in addition to the support code.
There are a fair number of casts between 64-bit machine addresses
and 32-bit sqInt. I've been looking into this recently and will
report back if I make any kind of progress.

I don't have a clue how to write the stack frame setup in
assembler, but Andreas wrote the any-libffi.c that seems like
it should work fine if I can sort out the type casting problems.
If you or someone else knows how to do the assembler bits, that
would be a good thing too.

Dave