Message ID | E9292D0C-BC4F-45BC-919C-290E3195FF13@bell.net |
---|---|
State | New |
Headers | show |
On Apr 16 2017, John David Anglin <dave.anglin@bell.net> wrote:
> +#define SHMLBA (__getpagesize ())
SHMLBA must be a constant.
Andreas.
On 2017-04-16, at 4:00 PM, Andreas Schwab wrote: > On Apr 16 2017, John David Anglin <dave.anglin@bell.net> wrote: > >> +#define SHMLBA (__getpagesize ()) > > SHMLBA must be a constant. Are you sure? __getpagesize() is used on some other targets including x86. Dave -- John David Anglin dave.anglin@bell.net
On Apr 16 2017, John David Anglin <dave.anglin@bell.net> wrote: > On 2017-04-16, at 4:00 PM, Andreas Schwab wrote: > >> On Apr 16 2017, John David Anglin <dave.anglin@bell.net> wrote: >> >>> +#define SHMLBA (__getpagesize ()) >> >> SHMLBA must be a constant. > > > Are you sure? http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_shm.h.html#tag_13_59_03 Andreas.
* John David Anglin: > On 2017-04-16, at 4:00 PM, Andreas Schwab wrote: > >> On Apr 16 2017, John David Anglin <dave.anglin@bell.net> wrote: >> >>> +#define SHMLBA (__getpagesize ()) >> >> SHMLBA must be a constant. > > > Are you sure? __getpagesize() is used on some other targets including x86. Well, we should probably fix that. I find it difficult to believe that we will ever get anything but 4K pages on x86-64 because much too much would break as a result. But it seems to me that POSIX is wrong here because the page size isn't a context in other contexts, and as you describe, just having some arbitrary multiple of the actual page size tends to cause problems.
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/shm.h b/sysdeps/unix/sysv/linux/hppa/bits/shm.h index 794f0ab2da..52632d0dea 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/shm.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/shm.h @@ -37,7 +37,7 @@ #define SHM_UNLOCK 12 /* unlock segment (root only) */ /* Segment low boundary address multiple. */ -#define SHMLBA 0x00400000 /* address needs to be 4 Mb aligned */ +#define SHMLBA (__getpagesize ()) /* Type to count number of attaches. */ typedef unsigned long int shmatt_t;