Re: Proper use of mlock(2)
- From: Thomas Maier-Komor <thomas@xxxxxxxxxxxxxx>
- Date: Wed, 29 Mar 2006 12:57:55 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Daniel Rudy wrote:
What is the proper use of mlock(2)? In the man page, it states that the
addr param *should* be aligned on a page boundary. The question is how
do you find out if it is or isn't? Or better yet, how do you force an
allocation on a page boundary?
I can use getpagesize(2) to find out what the page size is, but with
FreeBSD and it's virtual address memory model, how do you force a memory
allocation in the virtual address space to align to a physical page
boundary?
My OS is FreeBSD 6.0.
Thanks.
you don't have to care about virtual to physical mapping. If your
virtual address is a multiple of pagesize everything is fine. You cannot
force a malloc to return a multiple of pagesize as the base address of
the allocated memory block, but you can allocate a big enough block, so
that you can calculate an aligned address within that block.
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (SunOS)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEKmgz6U+hp8PKQZIRAhZwAKC/JkccwNeDYNfmy9457FzZ6bvGVQCfQU/a
4hlFLvcBLsfhgDY2dd7Vd/A=
=Y5Jn
-----END PGP SIGNATURE-----
.
- References:
- Proper use of mlock(2)
- From: Daniel Rudy
- Proper use of mlock(2)
- Prev by Date: Re: sendto () and recvfrom() with the same IP address
- Next by Date: objdump -r a.o not giving static function call
- Previous by thread: Proper use of mlock(2)
- Next by thread: objdump -r a.o not giving static function call
- Index(es):
Relevant Pages
|