Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!decvax!cwruecmp!neoucom!cbosgd!soma!masscomp From: masscomp@soma.UUCP (Stan Barber, Moderator) Newsgroups: mod.computers.masscomp Subject: Update on my Shared Memory Examples Message-ID: <963@soma.UUCP> Date: Sat, 28-Jun-86 03:21:45 EDT Article-I.D.: soma.963 Posted: Sat Jun 28 03:21:45 1986 Date-Received: Sat, 28-Jun-86 22:58:17 EDT References: <939@soma.UUCP> Reply-To: stan@drillsys.UUCP (Stan Hanks) Followup-To: <939@soma.UUCP> Organization: Teleco Oilfield Services -- Drilling Systems Technology, Houston, Tx Lines: 146 Keywords: shared memory, System V Approved: masscomp@soma.uucp Thanks to Guy Harris at Sun Microsystems for pointing out 3 problems with my shared memory examples. 1) The BIT macro needed to be surrounded by parentheses 2) The variable "which" couldn't be declared and initialized inside the loops as "which" would then be initialized to zero each time around the loop 3) As the third argument to "shmget" included IPC_CREAT, it was required to specify the permissions of the shared memory segment Guy also enclosed an updated copy of the code, which follows with only a couple of other changes ============================================= #include #include #include extern char *shmat(); extern int shmctl(); extern int shmdt(); extern int shmget(); /* warning! good for 32 bit unsigned only !!!! */ #define BIS(flag, bit) (flag |= (1<