1 / 7

리눅스 시스템 프로그래밍

리눅스 시스템 프로그래밍. 예 제 3-2 2004242028 김주현. 목 차. 함수설명 소스 실행화 면. 함수설명. ulimit 프로세스의 파일의 크기를 제한하는 기능을 한다 getrlimit 시스템 호출은 프로세스의 파일 제한을 제어하기 위해서 보다 일반적인 인터페이스를 제한한다 . 처리가 정상 종료되면 음이 아닌 값으로 반환된다 . 그렇지 않을 경우에는 -1 이 반환되고 errno 에 그 오류를 표시하는 값이 설정된다. 함수설명. UL_GETFSIZE

durin
Download Presentation

리눅스 시스템 프로그래밍

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 리눅스 시스템 프로그래밍 예제 3-2 2004242028 김주현

  2. 목차 • 함수설명 • 소스 • 실행화면

  3. 함수설명 • ulimit • 프로세스의 파일의 크기를 제한하는 기능을 한다 • getrlimit시스템 호출은 프로세스의 파일 제한을 제어하기 위해서 보다 일반적인 인터페이스를 제한한다. • 처리가 정상 종료되면 음이 아닌 값으로 반환된다. 그렇지 않을 경우에는 -1이 반환되고 errno에 그 오류를 표시하는 값이 설정된다.

  4. 함수설명 • UL_GETFSIZE • 프로세스의 일반적인 파일크기의 제한값을 얻는다. 이 제한은 512바이트 블록단위로 되어있고 자식 프로세스가 이어받는다. • UL_SETFSIZE • 프로세스의 파일 크기를 제한하기 위해 long형을 취한 newlimit의 값을 설정한다.

  5. 소스 #include <stdio.h> #define GETFSIZE 1 #define SETFSIZE 2 #define GETBRK 3 #define DUMMY 0 main(intargc, char *argv[]) { long newlimit, atoi(), ulimit(); void perror(), exit(); fprintf(stderr, “Maximum File size : %ld\n”, ulimit(GETFSIZE, DUMMY); newlimit= atoi(argv[1]); ulimit(SETFSIZE, newlimit);

  6. 소스 fprintf(stderr, “New maximum file size : %ld\n”, ulimit(GETFSIZE, DUMMY); if(fork() == 0) { execvp(argv[2], &argv[2]); perror(argv[2]); exit(127); } }

More Related