[Gambas-bugtracker] Bug #2534: Libc mmap() call always returns -1

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Sat Apr 30 20:15:35 CEST 2022


http://gambaswiki.org/bugtracker/edit?object=BUG.2534&from=L21haW4-

Comment #7 by Gary SPRANG:

No, it still works the same.  All of the Gambas reads from shared memory work great, but writes are not working.  This may be the old method, it's what I used when I was using shmat() to get shared memory-
Public Sub btn_killsys_Click()

  Dim a As Integer
  Dim shmaddr5 As Pointer
  Dim SPstream As Stream
  shmaddr5 = global.shmaddr ' this is the memory address we got from mmap()
  SPstream = Open Memory shmaddr5 For Write
  
  'message types: Delete  Error  Info  Question  Warning
  Message.title = "Shut Down SPOCS"
  a = message.Question("Are You Sure?", "YES", "NO")
  If a = 1 Then ' yes
    Seek #SPstream, 66 ' the command character is indexed 66 bytes from the beginning of memory
    Write #SPstream, "Q" ' remember that the stream pointer gets incremented
    Message.Info("SPOCS is Shutting Down!", "OK")
    Endif
  If a = 2 Then ' no
      'do nothing
  Endif

End
When I run this, and then I use the memory peek page in the Gambas app, it says the byte got changed.  But the scanner program does not see it.




More information about the Bugtracker mailing list