Why does getpagesize () return an int?

Why does syscall getpagesize()return int, not unsigned intor size_t?

The prototype and short description below:

GETPAGESIZE(2)                                                             
    NAME
           getpagesize - get memory page size
    SYNOPSIS
           #include <unistd.h>
           int getpagesize(void);
+4
source share
1 answer

intwas probably sufficient when it was invented. But this is no longer a problem because it has getpagesize()been removed from the POSIX standard since 2001 and has been replaced by sysconf(). You must use sysconf(_SC_PAGESIZE).

getpagesize() The return of int was one of the main reasons for removing it:

getpagesize

getpagesize() . sysconf (_SC_PAGE_SIZE) sysconf (_SC_PAGESIZE). , int, , . , . (, ). , . Application Application, Legacy - , sysconf().

( ).

+8

Source: https://habr.com/ru/post/1667968/


All Articles