From: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | goran(at)bildbasen(dot)se (Gran Thyni) |
Cc: | hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] mmap and MAP_ANON |
Date: | 1998-05-12 16:57:24 |
Message-ID: | 199805121657.MAA01881@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>
> Gran Thyni wrote:
> >
> > Bruce Momjian wrote:
> > >
> > > Would people tell me what platforms do NOT support the MAP_ANON flag to
> > > the mmap() system call? You should find it in the mmap() manual page.
> > >
> > > *BSD has it, but I am not sure of the others. I am researching cache
> > > size issues and the use of mmap vs. SYSV shared memory.
> >
> > SVR4 (at least older ones) does not support MMAP_ANON,
> > but the recommended in W. Richards Stevens'
> > "Advanced programming in the Unix environment" (aka the Bible part 2)
> > is to use /dev/zero.
> >
> > This should be configurable with autoconf:
> >
> > <PSEUDO CODE>
> >
> > if (exists MAP_ANON) use it; else use /dev/zero
> >
> > ------------
> >
> > flags = MAP_SHARED;
> > #ifdef HAS_MMAP_ANON
> > fd = -1;
> > flags |= MAP_ANON;
> > #else
> > fd = open('/dev/zero, O_RDWR);
> > #endif
> > area = mmap(0, size, PROT_READ|PROT_WRITE, flags, fd, 0);
> >
> > </PSEUDO CODE>
>
> Ouch, hate to say this but:
> I played around with this last night and
> I can't get either of the above technics to work with Linux 2.0.33
>
> I will try it with the upcoming 2.2,
> but for now, we can't loose shmem without loosing
> a large part of the users (including some developers).
> flags = MAP_SHARED;
>
> <PSEUDO CODE>
> #ifdef HAS_WORKING_MMAP
> #ifdef HAS_MMAP_ANON
> fd = -1;
> flags |= MAP_ANON;
> #else
> fd = open('/dev/zero, O_RDWR);
> #endif
> area = mmap(0, size, PROT_READ|PROT_WRITE, flags, fd, 0);
> #else
> id = shget(...);
> area = shmat(...);
> #endif
> </PSEUDO CODE>
>
What exactly did not work?
--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 1998-05-12 16:59:02 | Re: AW: [HACKERS] Re: [QUESTIONS] money or dollar type |
Previous Message | Bruce Momjian | 1998-05-12 16:54:09 | Re: [HACKERS] Re: [QUESTIONS] money or dollar type |