语言

Menu
Sites
Language
File E_ILLEGAL_ACCESS to open the /proc/<PID>/cmdline /pro file of an Called app from the Caller app.

Hi Everyone,

To know the called app process is running, I have created a application which iterates through the processes available in the /proc and tries to open the cmdline file. Called app successfully launches and when tries to read cmdline of that particualar process file open result shows E_ILLEGAL_ACCESS. For all the remaining processes cmdline file opens successfully.

...
    Tizen::Io::File logFile;
    logFile.Construct(L"statfile", "a+");

	Tizen::Io::File statFile;
	String strStatFileName;
	strStatFileName.Append(L"/proc/");
	strStatFileName.Append(dir->d_name); // Process ID
	strStatFileName.Append(L"/cmdline");

	result r = statFile.Construct(strStatFileName, L"r");
	AppLog(" File Open result : %s", GetErrorMessage(r));
	if(E_SUCCESS == r)
	{
		String strFileContent;
		statFile.Read(strFileContent);

		if(true == strFileContent.Contains(L"5JuPoKN5Pe"))
		{
			AppLog("Process ID of Called App :: %s", dir->d_name);
			AppLog("Called App cmdline File Content :: %S", strFileContent.GetPointer());
		}
	}
	else
	{
		AppLog("File Not Opened.");
	}
...

AppLog shows:

11-26 13:55:25.992 : INFO / TizenSecondAppLaunching ( 3140 : 3140 ) : void processdir(const struct dirent *)(29) >  File Open result : E_ILLEGAL_ACCESS
11-26 13:55:25.992 : INFO / TizenSecondAppLaunching ( 3140 : 3140 ) : void processdir(const struct dirent *)(43) > File Not Opened

Please provide me pointers to get the Called app running status.

Thanks,

Anil

 

响应

1 回复
hgw7

Changed the 'dir->d_name' with a few proc id's and checked, and it worked fine.

12-11 18:19:20.850 : INFO / test ( 3244 : 3244 ) : virtual void testForm::OnActionPerformed(const Tizen::Ui::Control &, int)(92) >  File Open result : E_SUCCESS