Re: LINUX shm_open::Bad file descriptor / (SGI Runs Well)

From: David Anderson (davea_at_quasar.engr.sgi.com)
Date: 11/17/04

  • Next message: Christopher M. Lusardi: "Linux: shm_open::Bad file descriptor/ (SGI Runs Well)"
    Date: 17 Nov 2004 21:19:06 GMT
    
    

    In article <d5cfdc47.0411171245.4525d26a@posting.google.com>,
    Christopher M. Lusardi <clusardi2k@aol.com> wrote:
    >Hello,
    >
    > Does anyone know why I get the message on the subject line when I
    >execute the following code on Linux and/or how to fix it?
    >
    > The routine appears to run nicely on SGI!

    > my_memory = shm_open ("/var/tmp/my_memory", (O_RDWR | O_CREAT),
    > (S_IRWXO | S_IRWXG | S_IRWXU)); /* r/w others group users */
    >
    > chmod ("/var/tmp/my_memory",(S_IRWXG | S_IRWXU)); /* g/u */
    >
    > ftruncate (my_memory,my_size); /* Truncate CREATE file! */

    the following is a mistake, and is confusing you.

    > if ( my_memory == -1 )
    > {
    > perror (shm_open:");
    > exit (1);
    > }

    The problem is that either the chmod or the ftruncate
    could have changed errno. And likely did.

    Test my_memory only *immediately* after the shm_open
    if you want the perror to report anything even remotely meaningful.
    And test the result codes from chmod and ftruncate (immediately
    after each operation, of course)!

    David Anderson


  • Next message: Christopher M. Lusardi: "Linux: shm_open::Bad file descriptor/ (SGI Runs Well)"

    Relevant Pages

    • Re: LINUX shm_open::Bad file descriptor / (SGI Runs Well)
      ... Christopher M. Lusardi wrote: ... >execute the following code on Linux and/or how to fix it? ... And test the result codes from chmod and ftruncate (immediately ...
      (comp.sys.sgi.misc)
    • Re: [opensuse] Scary enough for Halloween...
      ... he has to do "chmod u+x" on it before he can execute it. ... other people same, that Linux was secure and unhackable, ... I haven't seen any mention of vulnerabilities in this thread ...
      (SuSE)
    • Re: Chmod
      ... it would only work if i chmod the folder 777, ... The x on a directory means search, not execute. ... echo "File is valid, and was successfully uploaded."; ...
      (comp.lang.php)
    • Re: Executable programs
      ... > first project in Linux and I have no idea how to run things. ... execute usually, but is ... ... If you want to learn how to manipulate these, look up the chmod command. ... -- * Does the walker choose the path, or does the path choose the walker? ...
      (comp.os.linux.setup)
    • Re: Query in adding application in Linux
      ... But i couldn't execute it. ... I tried chmod +x helloworld. ... As root: ... Do you execute from a shell script? ...
      (comp.os.linux.development.apps)