Re: [Pharo-dev] Can I access symbolic constants from NB FFI?

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

Re: [Pharo-dev] Can I access symbolic constants from NB FFI?

Eliot Miranda-2
Hi Mariano,

On Dec 22, 2015, at 8:36 PM, Mariano Martinez Peck <[hidden email]> wrote:



On Tue, Dec 22, 2015 at 5:24 PM, [hidden email] <[hidden email]> wrote:
Hello Mariano, 
     WNOHANG is a constant is defined in sys/wait.h, after the compilation is not included in the object file. 

You will have to duplicate its value in the Smalltalk Code. It's value is 1, in linux is defined in bits/waitflags.h as 

#define WNOHANG 1


mmmmmm but then I would need to take care about its different values in different OS right? 

     sunos 4.1.3     : #define WNOHANG 1
        Solaris 2.4     : #define WNOHANG 0100
        OSF1 2.0        : #define WNOHANG 0x1
        Ultrix 4.4        : #define WNOHANG 1
        irix 4.0.5C     : #define WNOHANG 0x1
        irix 5.2        : #define WNOHANG 0100
        irix 6.0.1      : #define WNOHANG 0100


Exactly.  I've discussed this before.  Please read


OK..the thread is from 1995... I thought the POSIX standard would standardize that...

I am now checking at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/wait.h

and it says:

#define WNOHANG 0x00000001

But again..I wonder how portable is to stick to that... 

Ok...maybe I will need to go with a VM primitive as #primGetChildExitStatus:   that way I can do the:

self cCode: 'waitpid ( pidToHandle, &exitStatus, WNOHANG )'  inSmalltalk: [ exitStatus := -1 ].


pd: que groso Pablito verte por aca!!!!

Cheers,
Pablo

On Tue, Dec 22, 2015 at 5:12 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi guys,

Say I want to call to waitpid like this:

waitpid(childID, &status, WNOHANG);

How can I do since I don't have access to WNOHANG int value in order to send it via argument .... ???

Any idea?

Thanks in advance, 


Pablo Tesone.
[hidden email]


_,,,^..^,,,_ (phone)