[gambit-list] Error with iOS 5.0

Marc Feeley feeley at iro.umontreal.ca
Wed Jun 15 07:44:15 EDT 2011


On 2011-06-14, at 10:54 PM, Adam King wrote:

>  Alright - that might very well be true - and it probably did say that in the 60 or more pages of legalese that I doubt most devs have time to read through.  I know... that's not a valid excuse  :)
> 
>  So, let me reframe the question: in what circumstances could 'with-input-from-file' and 'load' generate an 'Operation not permitted' error on a unix type system even when the file is readable?  I tried tracing both funcs in the gambit lib, but soon got lost.  Maybe the lib is doing more than just fopen/fread?  I thought Marc might have an idea.
>    

On Mac OS X (and Unix) the path to the file is opened with a call to "open", and then the file descriptor is set to non-blocking mode with a call to set_fd_blocking_mode (defined in os_io.c) which calls fcntl(fd,F_GETFL, 0) and fcntl(fd,F_SETFL, ...).  You might want to change the call to set_fd_blocking_mode on line 6072 of os_io.c

      if (set_fd_blocking_mode (fd, 0) != 0) /* set nonblocking mode */
        return err_code_from_errno ();

to

      if (kind != ___FILE_DEVICE_KIND)
        if (set_fd_blocking_mode (fd, 0) != 0) /* set nonblocking mode */
          return err_code_from_errno ();

and see if that eliminates the problem.  Of course this makes I/O to files blocking, so the thread multiplexing will not work when doing I/O to files.

Have you tried compiling the Gambit library with the --enable-debug configuration flag?  It will output traces for all the system calls which return errors, with the name of the source file and line number where the error was detected.

Marc




More information about the Gambit-list mailing list