Xref: utzoo comp.lang.c:32222 comp.unix.programmer:101 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.lang.c,comp.unix.programmer Subject: Re: shared memory Message-ID: <1990Sep26.230857.29812@virtech.uucp> Date: 26 Sep 90 23:08:57 GMT References: <13991@hydra.gatech.EDU> <14140@hydra.gatech.EDU> Reply-To: cpcahil@virtech.UUCP (Conor P. Cahill) Organization: Virtual Technologies Inc., Sterling VA Lines: 23 In article <14140@hydra.gatech.EDU> gt0178a@prism.gatech.EDU (BURNS,JIM) writes: >HP-UX documents it; it tests out on A/UX 1.1 and Ultrix 4.0 : the first >call to shmat() (by any process) automatically zeroes out the shm seg, so >explicit initialization is NOT necessary. Is this standard? Which one? This is a basic rule of unix: All memory given to a program by the kernel must be cleared to zero. This applies to new sbrk()'d areas (not always to areas that you previously had and then released and then got back) uninitialized static data areas, and shared memory segments. It even applies to stack the first time it is used. This is a security measure (makes sure you can't see someone elses data). Note that it also applies to disk "memory" (if you seek past the end of a file, write a byte, seek back to the skipped portion and read, you will get all nulls). -- Conor P. Cahill (703)430-9247 Virtual Technologies, Inc., uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160 Sterling, VA 22170