본문 바로가기

IT-Consultant

HPUX page size 알아내기

#include <sys/param.h>
#include <sys/pstat.h>
#include <sys/unistd.h>
#include <string.h>
#include <pwd.h>

int main()
{
    struct pst_static pmt;
    int page_size = 0;

    // 페이지 크기를 얻어온다.
    // 페이지 크기는 메모리와 같은 자원의 크기를 검사하는데 중요하게 사용된다.
    if (pstat_getstatic(&pmt, sizeof(pmt), (size_t)1, 0) != -1)
    {
        page_size = pmt.page_size;
    }
    else
    {
        perror("static error");
    }

    printf("page size is %ld\n", page_size);
   
    return 0;
}