Subject: Re: can I open RAM?
To: village idiot <village_ldi0t@yahoo.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-help
Date: 05/01/2002 18:39:13
On Wed, May 01, 2002 at 08:45:46AM -0700, village idiot wrote:
> Chris,
> 
> thanks for helping me on my way. 
> 
> I think I can do something like this, for my sender
> side: (?)
> 
> static int ElfFD = 0;/* file descriptor */
> static size_t ElfExeSize = 0;
> static unsigned char *ElfStart = NULL; /* mapped
> addr*/
> 
> unsigned char *
> MapTargetFile(int fd)
>    {
>    ElfFD = fd;
>    ElfExeSize = lseek(ElfFD, 0, SEEK_END);
>    if (ElfExeSize == (size_t) - 1)
>       {
>       perror("Input file error seek");
>       exit(-1);
>       }
>    lseek(ElfFD, 0, SEEK_SET); /* seek back to start*/
> 
>    ElfStart = (unsigned char *)
>       mmap(NULL, 
> 	   ElfExeSize,
> 	   MAP_FILE | MAP_SHARED,
> 	   PROT_READ,			
> 	   ElfFD,			
> 	   0x00);
>    return ElfStart;
>    }
> 
> But what can I do on receiver side? Du I need to make
> a file first? I do not know how large that file will
> be. I am not updating, but making a new file. I would
> like to dump that to RAM instead of to the disk. 
> 
> Can I reserve a fixed size of RAM, and have a file
> pointer to it? Something like a RAM disk would be
> wicked here, like on old windows systems.

You can, with a MFS. Have a look at mount_mfs

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
--