-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetLimits.cpp
More file actions
33 lines (30 loc) · 1.31 KB
/
Copy pathSetLimits.cpp
File metadata and controls
33 lines (30 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//
// Created by Will on 12/5/2019.
//
/*******************************************************************************
* File name: *
* Project: CS 460 Project 2 Fall 2019 *
* Author(s): *
* Date: *
* Description: This file contains *
*******************************************************************************/
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#include "SetLimits.h"
void SetLimits ()
{
// Beginning of resource limit code
int getrlimit(int resource, struct rlimit *rlim);
int getrusage(int who, struct rusage *usage);
int setrlimit(int resource, const struct rlimit *rlim);
struct rlimit __trl1;
const int __trl1r = getrlimit(RLIMIT_CPU, & __trl1);
struct rlimit __trl2 = {20, __trl1.rlim_max};
const int __trl2r = setrlimit(RLIMIT_CPU, & __trl2);
struct rlimit __trl3;
const int __trl3r = getrlimit(RLIMIT_FSIZE, & __trl3);
struct rlimit __trl4 = {10000000, __trl3.rlim_max};
const int __trl4r = setrlimit(RLIMIT_FSIZE, & __trl4);
// End of time limit code
}