mremap(2) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

mremap(2)

mremap(2)                        System Calls                        mremap(2)

NAME
       mremap - re-map pages of memory

SYNOPSIS
       #include <sys/mman.h>

       void *mremap(void *addr, size_t len, size_t newlen, int flags, ...
           /* void *newaddr */);

DESCRIPTION
       The  mremap()  function  re-maps a portion of a process's address space
       previously mapped using mmap().


       pa = mremap(addr, len, newlen, flags, newaddr);


       Using mremap(), a virtual memory segment can be  expanded,  shrunk,  or
       moved to a new location in the address space of a process.


       The  mremap() function is supported only for mapped files and anonymous
       memory.


       The flags argument provides information about how to handle  the  call.
       The  value  of  the flags is the bitwise inclusive OR of one or more of
       the  other  flags  in  the  following  table,  defined  in  the  header
       <sys/mman.h>:

       MREMAP_MAYMOVE    The  kernel may move the existing mapping if there is
                         not space to expand the mapping at its current  loca‐
                         tion.


       MREMAP_FIXED      Re-map  addr  starting at newaddr. If MREMAP_FIXED is
                         not specified, the value of newaddr  is  ignored  and
                         need  not  be  passed. Use of this flag requires that
                         the MREMAP_MAYMOVE flag is also specified.


RETURN VALUES
       Upon successful completion, the mremap() function returns  the  address
       at  which the mapping was placed (pa); otherwise, it returns a value of
       MAP_FAILED and sets errno to indicate the error. The symbol  MAP_FAILED
       is  defined  in  the  header  <sys/mman.h>.  No  successful return from
       mremap() will return the value MAP_FAILED.

ERRORS
       The mremap() function will fail if:

       EAGAIN       The mapping could not be locked in memory.

                    There was insufficient room to reserve swap space for  the
                    mapping.

                    The  flag is MAP_ADI and the memory identified by this op‐
                    eration would exceed a limit or resource  control  on  ADI
                    memory or the total amount of system memory is temporarily
                    insufficient to allocate ADI metadata.


       EEXIST       A mapping already exists that conflicts with the requested
                    operation.


       EFBIG        The  mremap()  system  call returns EFBIG when it tries to
                    map a section of a file at an offset equal or larger  than
                    0x7fffffff from a NFSv2 filesystem.


       EINVAL       The arguments addr (and newaddr if MREMAP_FIXED was speci‐
                    fied)  are  not  multiples of the page size as returned by
                    sysconf().

                    The arguments len or newlen are not multiples of the  page
                    size as returned by sysconf().

                    The   flags   argument   is   invalid  (flags  other  than
                    MREMAP_MAYMOVE or MREMAP_FIXED were specified).

                    MREMAP_FIXED was specified without MREMAP_MAYMOVE.

                    The argument len or newlen has a value equal to 0.

                    The memory region specified by  addr  and  len  is  not  a
                    mapped file or anonymous memory.


       ENOMEM       There  is insufficient room in the address space to effect
                    the mapping.

                    The mapping could not be locked in memory, if required  by
                    mlockall(3C), because it would require more space than the
                    system is able to supply.

                    The operation would exceed RLIMIT_VMEM (see getrlimit(2)).


       EOVERFLOW    The  file  is  a regular file and the mapping would exceed
                    the maximum offset established by the existing mapping  to
                    the file.


USAGE
       Use of mremap() may reduce the amount of memory available to other mem‐
       ory allocation functions.

ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:

       tab()  box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
       TRIBUTE VALUE _ Interface  StabilityCommitted  _  MT-LevelAsync-Signal-
       Safe


SEE ALSO
       getrlimit(2),   memcntl(2),  mmap(2),  mprotect(2),  munmap(2),  mlock‐
       all(3C), sysconf(3C), adi(7), attributes(7), resource-controls(7)

HISTORY
       The mremap() function was added in the Solaris 11.4.45 release.

Oracle Solaris 11.4               18 Oct 2021                        mremap(2)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3