|
|
|
@ -38,13 +38,14 @@
|
|
|
|
|
#include <cstring>
|
|
|
|
|
#include "It_process_plimits.h"
|
|
|
|
|
|
|
|
|
|
//write function to get process file mode
|
|
|
|
|
static std::string GetFileMode(const char* filePath)
|
|
|
|
|
{
|
|
|
|
|
const int MODE_COUNT = 11;
|
|
|
|
|
char fileProperty[MODE_COUNT] = "----------";
|
|
|
|
|
char fileMode[MODE_COUNT] = "-rwxrwxrwx";
|
|
|
|
|
struct stat buf;
|
|
|
|
|
stat(filePath, &buf);
|
|
|
|
|
stat(filePath, &buf);//get state of the file
|
|
|
|
|
unsigned int off = 256;
|
|
|
|
|
const int LOOP_VARY = 10;
|
|
|
|
|
for (int i = 1; i < LOOP_VARY; i++) {
|
|
|
|
@ -55,6 +56,7 @@ static std::string GetFileMode(const char* filePath)
|
|
|
|
|
return fileProperty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//check the Property
|
|
|
|
|
static int IsFilePropertyR1(const char* filePath)
|
|
|
|
|
{
|
|
|
|
|
std::string fileOrg = "-r--r--r--";
|
|
|
|
@ -64,6 +66,7 @@ static int IsFilePropertyR1(const char* filePath)
|
|
|
|
|
|
|
|
|
|
void ItProcessPlimits008(void)
|
|
|
|
|
{
|
|
|
|
|
//define process function ID
|
|
|
|
|
std::string filePath = "/proc/plimits/";
|
|
|
|
|
std::vector<std::string> fileName;
|
|
|
|
|
fileName.push_back("plimits.procs");
|
|
|
|
@ -86,3 +89,12 @@ void ItProcessPlimits008(void)
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*It is used primarily to verify access to specific files in
|
|
|
|
|
the /proc/plimit/directory, ensuring that these files are read-only
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|