2
votes

I have a large amount of existing BSD socket code that I have ported to NaCl. I am able to build, link and run this code however the NaCl module crashes as soon as the socket code is reached.

I am now using nacl_io, but when I try to call TCP connect function I get an error with errno 38 which means

#define ENOSYS      38  /* Function not implemented */ 

Why would calling the connect function fail but I am able to successfully resolve host via gethostbyname()?

Note that I am using the example code from nacl_io demo. That code in the demo works fine, but when copied to my own project I get the errors when calling connect().

1

1 Answers

0
votes

As long as you call nacl_io_init_ppapi function first, connect() should not return ENOSYS.

I originally had nacl_io in the make file listed after pthread. moving nacl_io to the front of the linker list fixed this issue.

nacl_io defines few functions which are defined in libpthread as well. If libpthread is listed before nacl_io then functions from libpthread are used, if it's listed after nacl_io then functions from nacl_io are used.