octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #65393] cant create a non blocking socket with


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #65393] cant create a non blocking socket with fcntl()
Date: Thu, 21 Mar 2024 13:16:16 -0400 (EDT)

Follow-up Comment #4, bug #65393 (group octave):

If I remember correctly... in the early days we didn't have a guarantee about
the Octave file ID matching the one used by the operating system.  So we were
just mapping Octave's file ID to a stream object or FILE pointer and getting
the operating system's file ID from that if we needed to do an operation that
required a file ID instead of a stream object or FILE pointer.

Now I think we try to ensure that the operating system's file ID *is* Octave's
file ID.

Either way, we could change Octave's functions so that if we fail to find the
file ID in Octave's internal list, we just attempt to perform the action on
the given file ID.

For fcntl, does the following change work?


diff --git a/libinterp/corefcn/syscalls.cc b/libinterp/corefcn/syscalls.cc
--- a/libinterp/corefcn/syscalls.cc
+++ b/libinterp/corefcn/syscalls.cc
@@ -452,7 +452,12 @@ message.
 
   // FIXME: Need better checking here?
   if (fid < 0)
-    error ("fcntl: invalid file id");
+    {
+      // The file is not known to Octave, so just try the operation on
+      // the provided file ID.
+
+      fid = args(0).int_value (true);
+    }
 
   octave_value_list retval;
   std::string msg;


Other functions that work directly on file IDs at the system library level
will need similar changes.  I think that is just dup2 and maybe fstat.  Are
there others?

If the above works for fcntl, then I can make that change and fix dup2 and
fstat at the same time.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65393>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]