/share/man/man9/vslock.9

https://bitbucket.org/freebsd/freebsd-head/ · Unknown · 88 lines · 88 code · 0 blank · 0 comment · 0 complexity · 183c417f453ead333c729bb988af2be5 MD5 · raw file

  1. .\" $NetBSD: vslock.9,v 1.1 1996/06/15 20:47:29 pk Exp $
  2. .\"
  3. .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
  4. .\" All rights reserved.
  5. .\"
  6. .\" This code is derived from software contributed to The NetBSD Foundation
  7. .\" by Paul Kranenburg.
  8. .\"
  9. .\" Redistribution and use in source and binary forms, with or without
  10. .\" modification, are permitted provided that the following conditions
  11. .\" are met:
  12. .\" 1. Redistributions of source code must retain the above copyright
  13. .\" notice, this list of conditions and the following disclaimer.
  14. .\" 2. Redistributions in binary form must reproduce the above copyright
  15. .\" notice, this list of conditions and the following disclaimer in the
  16. .\" documentation and/or other materials provided with the distribution.
  17. .\"
  18. .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  19. .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  20. .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  21. .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
  22. .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  23. .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  24. .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  25. .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  26. .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  27. .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  28. .\" POSSIBILITY OF SUCH DAMAGE.
  29. .\"
  30. .\" $FreeBSD$
  31. .\"
  32. .Dd August 29, 2012
  33. .Dt VSLOCK 9
  34. .Os
  35. .Sh NAME
  36. .Nm vslock ,
  37. .Nm vsunlock
  38. .Nd lock/unlock user space addresses in memory
  39. .Sh SYNOPSIS
  40. .In sys/param.h
  41. .In sys/proc.h
  42. .In vm/vm.h
  43. .In vm/vm_extern.h
  44. .Ft int
  45. .Fn vslock "void *addr" "size_t len"
  46. .Ft void
  47. .Fn vsunlock "void *addr" "size_t len"
  48. .Sh DESCRIPTION
  49. The
  50. .Fn vslock
  51. and
  52. .Fn vsunlock
  53. functions respectively lock and unlock a range of
  54. addresses belonging to the currently running process into memory.
  55. The actual amount of memory locked is a multiple of the machine's page size.
  56. The starting page number is computed by truncating
  57. .Fa addr
  58. to the nearest preceding page boundary, and by rounding up
  59. .Fa addr +
  60. .Fa len
  61. to the next page boundary.
  62. The process context to use for this operation is taken from the
  63. global variable
  64. .Va curproc .
  65. .Sh RETURN VALUES
  66. The
  67. .Fn vslock
  68. function will return 0 on success, otherwise it will return
  69. one of the errors listed below.
  70. .Sh ERRORS
  71. The
  72. .Fn vslock
  73. function will fail if:
  74. .Bl -tag -width Er
  75. .It Bq Er EINVAL
  76. The
  77. .Fa addr
  78. and
  79. .Fa len
  80. parameters specify a memory range that wraps around the end of the
  81. machine address space.
  82. .It Bq Er ENOMEM
  83. The size of the specified address range exceeds the system
  84. limit on locked memory.
  85. .It Bq Er EFAULT
  86. Some portion of the indicated address range is not allocated.
  87. There was an error faulting/mapping a page.
  88. .El