home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / question / 10254 < prev    next >
Encoding:
Text File  |  1992-08-20  |  2.5 KB  |  81 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!mcsun!Germany.EU.net!murignis!ap542!D012S436!frank
  3. From: frank@D012S436.sniap.mchp.sni.de ()
  4. Subject: Re: Shared memory baby question on ultrix 4.2
  5. Message-ID: <1992Aug21.103445.1279@sniap.mchp.sni.de>
  6. Sender: news@sniap.mchp.sni.de (News Admin)
  7. Organization: Siemens-Nixdorf AG
  8. References: <1992Aug17.152207.3268@otago.ac.nz>
  9. Date: Fri, 21 Aug 92 10:34:45 GMT
  10. Lines: 69
  11.  
  12. aipost@otago.ac.nz writes:
  13. : Help Help Help
  14. : !!!! please e-mail me at deano@piglet.otago.ac.nz not the posting address
  15. : I don't understand shared memory.  Sorry, but all I can find in the
  16. : documentation for our DECstations is the man pages which tell me what to use
  17. : and what to pass but not HOW to use ?!?!?!?!?!?
  18. : I am using Ultrix 4.2 etc ...... on DECstation 5000/200's
  19. : at the moment I do this :
  20. : key = ftok("/tmp", 'a');
  21. : shmid = shmget(key, 64, IPC_CREAT | IPC_EXCL);
  22.  
  23.             what permissions does this give your shm?
  24.             (you can check by typing 'ipcs'
  25.             at the command line.)
  26.             it may be that you don't have RW access
  27.             for the shm
  28.             try IPC_CREAT | IPC_EXCL | 0660
  29.  
  30.             also this may return -1  if the shm has
  31.             already been created.  If so you should
  32.             try again with IPC_CREAT | 0660 (no EXCL)
  33.  
  34. : s = shmat(shmid, 0, SHM_R | SHM_W);
  35.  
  36. why not check these calls for (-1) return codes and do a perror()
  37. if you get a failure.  At least then you'll know which call fails.
  38. Sometimes the message even makes sense!
  39.  
  40. i.e. if ((r=nastysystemcall(nastyparameters))==-1)
  41.      {
  42.     perror("nastysystemcall");
  43.     exit(1);
  44.      }
  45.     
  46. Check your man page (yes, again) to ensure that the call in
  47. question does in fact return -1 on error.  There's always
  48. one that doesn't.
  49. : *s = 1; /* BARF BARF BARF, kernel acces since s == -1 */
  50. : help help help 
  51. : sorry this is probably a really dumb question on the wrong roup
  52. : but hey it's all I know how to do !!!!
  53.  
  54. Seems like the right group to me...
  55.  
  56. : deano
  57. : p.s: please e-mail me at deano@piglet.otago.ac.nz not the posting address
  58. : -- 
  59. : ==============================================================================
  60. :                               "The AI Kids"
  61. :                      Department of Computer Science
  62. :                            University of Otago
  63. :                                New Zealand
  64. :                        Internet: AIPOST@otago.ac.nz
  65. --
  66. Frank O'Dwyer                           Disclaimer: 
  67. Siemens-Nixdorf AG                             I will deny everything
  68. Tel.  : +49 (89) 636-40639                      Fax.  : +49 (89) 636-45860
  69. e-mail: Frank.ODwyer@sniap.mchp.sni.de
  70.