[pypy-dev] System calls in Java

Samuele Pedroni pedronis at openend.se
Mon Dec 3 16:44:24 CET 2007

Carl Friedrich Bolz wrote:
> Niko Matsakis wrote:
>> So, there are a few system calls that I don't think Java supports, but  
>> Python does.  So far I have found getpid() and setenv(), but probably  
>> I will run into a few more.  Rather than implement the native wrappers  
>> required myself, I was considering linking against a pre-written  
>> library.  I found two, jnios, used by Jython, and jtux, which seems a  
>> bit more general.  The Jython wrapper is a bit problematic because it  
>> relies on a lot of Jython classes for building tuples and things.  I  
>> haven't experimented with jtux yet, but it seems to be a  
>> straightforward wrapper.  The biggest problem is that it does not have  
>> lots of easy-to-download-and-install jar files available for various  
>> platforms.
>> 	http://basepath.com/aup/jtux/
>> The idea would be that if the library were not present on the  
>> CLASSPATH, everything would continue to work except those methods that  
>> require extra support.
>> Does this make sense?  Anybody have a better idea?
> This makes sense to me, for such low-level functions as getpid and 
> setenv and whatever else is missing from the os module. 
there's been some discussion on Jython lists and some experimenting by JRuby
people to use JNA (https://jna.dev.java.net/ ) which is a sort of ctypes 
for java,
for this sort of purposes.
> For things like 
> the socket module I guess it would make more sense to use some 
> high-level java api that is more readily available.
yes, also there's been lot of recent work in Jython to use java.nio to 
get select etc
functionality in Jython. Is probably worth to look at it.

More information about the Pypy-dev mailing list