From: Hannah S. <ha...@sc...> - 2005-08-02 16:48:57
|
Hello! I've got to correct myself. On Mon, Aug 01, 2005 at 06:49:09PM +0200, Hannah Schroeter wrote: >[...] >>It's not obvious the reason why it's crashing because it supplies >>MAP_FIXED to mmap, which, under linux means "ignore any mappings I'm >>blasting over and map it anyways". >Oh *rolls eyes*. >Under OpenBSD it's > MAP_FIXED Do not permit the system to select a different address than > the one specified. If the specified address cannot be used, > mmap will fail. If MAP_FIXED is specified, addr must be a > multiple of the pagesize. Use of this option is discouraged. >The error code will be ENOMEM. This isn't true. Also on OpenBSD, the mapping could succeed and clobber an old mapping. You could map without MAP_FIXED but with a hint and check the return value whether the mapping succeeded. That would only work well if you somehow make sure that the space is free (e.g. the additional bss section trick). >[...] Kind regards, Hannah. |