리눅스

chapter 04 시스템 정보( 01.개요 02.시스템 관련 정보 검색과 설정)

정지홍 2023. 3. 12. 18:11

유닉스 시스템의 기본 환경 정보를 검색할 수 있는 함수들은 기본 환경과 관련된 구조체나 상수를 사용해 정보를 검색

->주요대상은 h/w or os관련 정보와 메모리 페이지의 크기 , pw등 시스템 환경 설정 관련

 

uname명령

-os의 이름,버전,호스트명,하드웨어 종류 등 검색.

 

#include <sys/utsname.h>

int uname(struct utsname *name);


시스템의 정보 검색 및 설정

#include <sys/systeminfo.h>

long sysinfo(int command검색 혹은 설정할 명령 , char *buf버퍼주소 , long count버퍼 길이);

->command에 지정 명령에 따른 값은 버퍼에 일시 저장.


시스템 자원 정보 검색

#include <unistd.h>

long sysconf(int name검색할 정보를 나타내는 상수);

밑줄친걸로 바꿔서 사용, logname은 이제 지원 x


파일과 디렉토리 관련 자원 검색

#include <unistd.h>

long pathconf(const char *path , int name);

long fpathconf(int fildes, int name);