From owner-freebsd-questions Mon Aug 4 17:23:36 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id RAA07979 for questions-outgoing; Mon, 4 Aug 1997 17:23:36 -0700 (PDT) Received: from dfw-ix11.ix.netcom.com (dfw-ix11.ix.netcom.com [206.214.98.11]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id RAA07974 for ; Mon, 4 Aug 1997 17:23:33 -0700 (PDT) From: rtwalsh@ix.netcom.com Received: (from smap@localhost) by dfw-ix11.ix.netcom.com (8.8.4/8.8.4) id TAA11138 for questions@freebsd.org; Mon, 4 Aug 1997 19:22:36 -0500 (CDT) Date: Mon, 4 Aug 1997 19:22:36 -0500 (CDT) Received: from sjx-ca12-08.ix.netcom.com(199.182.128.136) by dfw-ix11.ix.netcom.com via smap (V1.3) id sma011099; Mon Aug 4 19:22:22 1997 To: questions@freebsd.org Message-Id: <199784172215241@> Subject: mmap and MAP_ANON X-Mailer: NETCOMplete v3.27, from NETCOM On-Line Communications, Inc. MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hello there, Sorry to bug you with a question, but I couldn't find the answer anywhere, so here goes: I am trying to create a "named" memory map, with the name being "69", as in the function call below: pMem1 = mmap( NULL, 100000, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, 69, 0 ); However, this does not work (returns -1, with errno 22 (invalid argument)). If I use the invalid fd of -1, then it does work, but then it is not named and I cannot get at this memory map from another process. The man page for mmap() suggests that I should be able to do this: MAP_ANON Map anonymous memory not associated with any specific file. The file descriptor used for creating MAP_ANON regions is used only for naming, and may be specified as -1 if no name is associated with the region. I am using FreeBSD 2.1.6. Is there a bug with this particular feature, or am I missing something? If you cannot help me with this particular problem, perhaps you can give me a suggestion as to how to solve the problem that I am trying to use this mmap for. I need to share memory between processes and the data in the memory is confidential, thus the shared memory functions (shmget(), etc.) are not appropriate, since anyone can use ipcs -m to get the shared memory id and write a tiny program to go get the contents of the shared memory. Any suggestions as to how I can get a moderately secure block of shared memory? Many thanks for your time, Robin. --------------------- Robin Walsh rtwalsh@ix.netcom.com