This file is indexed.

/usr/share/phoronix-test-suite/pts-core/objects/phodevi/parsers/phodevi_parser.php is in phoronix-test-suite 4.8.3-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<?php

/*
	Phoronix Test Suite
	URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
	Copyright (C) 2008 - 2013, Phoronix Media
	Copyright (C) 2008 - 2013, Michael Larabel
	phodevi_parser.php: General parsing functions used by different parts of Phodevi that are supported by more than one OS

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

class phodevi_parser
{
	public static function read_nvidia_extension($attribute)
	{
		// Read NVIDIA's NV Extension
		$nv_info = false;

		if(pts_client::executable_in_path('nvidia-settings'))
		{
			$info = shell_exec('nvidia-settings --query ' . $attribute . ' 2> /dev/null');

			if(($pos = strpos($info, pts_strings::last_in_string($attribute, '/'))) > 0 && strpos($info, 'ERROR:') === false)
			{
				$nv_info = substr($info, strpos($info, '):') + 3);
				$nv_info = trim(substr($nv_info, 0, strpos($nv_info, "\n")));

				if(substr($nv_info, -1) == '.')
				{
					$nv_info = substr($nv_info, 0, -1);
				}
			}
		}

		return $nv_info;
	}
	public static function read_xdpy_monitor_info()
	{
		// Read xdpyinfo monitor information
		return array();
		static $monitor_info = null;

		if($monitor_info == null)
		{
			$monitor_info = array();

			if(pts_client::executable_in_path('xdpyinfo'))
			{
				$info = trim(shell_exec('xdpyinfo -ext XINERAMA 2>&1 | grep head'));

				foreach(explode("\n", $info) as $xdpyinfo_line)
				{
					if(!empty($xdpyinfo_line) && strpos($xdpyinfo_line, '0x0') == false)
					{
						array_push($monitor_info, $xdpyinfo_line);
					}
				}
			}
		}

		return $monitor_info;
	}
	public static function read_glx_renderer()
	{
		if(isset(phodevi::$vfs->glxinfo))
		{
			$info = phodevi::$vfs->glxinfo;
		}
		else if(PTS_IS_CLIENT && pts_client::executable_in_path('fglrxinfo'))
		{
			$info = shell_exec('fglrxinfo 2>&1');
		}
		else
		{
			return false;
		}

		if(($pos = strpos($info, 'OpenGL renderer string:')) !== false)
		{
			$info = substr($info, $pos + 24);
			$info = trim(substr($info, 0, strpos($info, "\n")));
		}
		else
		{
			$info = false;
		}

		if(stripos($info, 'Software Rasterizer') !== false)
		{
			$info = false;
		}

		return $info;
	}
	public static function read_hddtemp($disk = null)
	{
		// Read hard drive temperature using hddtemp
		$hdd_temperature = -1;

		if(pts_client::executable_in_path('hddtemp'))
		{
			if(empty($disk))
			{
				$disks = glob('/dev/sd*');

				if(count($disks) > 0)
				{
					$disk = array_shift($disks);
				}
			}

			// For most situations this won't work since hddtemp usually requires root access
			$info = trim(shell_exec('hddtemp ' . $disk . ' 2>&1'));

			if(($start_pos = strrpos($info, ': ')) > 0 && ($end_pos = strrpos($info, '°')) > $start_pos)
			{
				$temperature = substr($info, ($start_pos + 2), ($end_pos - $start_pos - 2));

				if(is_numeric($temperature))
				{
					$unit = substr($info, $end_pos + 2, 1);
					if($unit == 'F')
					{
						$temperature = round((($temperature - 32) * 5 / 9), 2);
					}

					$hdd_temperature = $temperature;
				}
			}
		}

		return $hdd_temperature;
	}
	public static function read_xorg_module_version($module)
	{
		$module_version = false;
		if(isset(phodevi::$vfs->xorg_log))
		{
			$xorg_log = phodevi::$vfs->xorg_log;
			if(($module_start = strpos($xorg_log, $module)) > 0)
			{
				$xorg_log = substr($xorg_log, $module_start);
				$temp_version = substr($xorg_log, strpos($xorg_log, 'module version =') + 17);
				$temp_version = substr($temp_version, 0, strpos($temp_version, "\n"));

				if(is_numeric(str_replace('.', null, $temp_version)))
				{
					$module_version = $temp_version;
				}
			}
		}

		return $module_version;
	}
	public static function parse_equal_delimited_file($file, $key)
	{
		$return_value = false;

		foreach(explode("\n", pts_file_io::file_get_contents($file)) as $build_line)
		{
			list($descriptor, $value) = pts_strings::trim_explode('=', $build_line);

			if($descriptor == $key)
			{
				$return_value = $value;
				break;
			}
		}

		return $return_value;
	}
	public static function hardware_values_to_remove()
	{
		return array(
		'empty',
		'null',
		'unknown',
		'unknow',
		'system manufacturer',
		'system version',
		'system name',
		'system product name',
		'to be filled by o.e.m.',
		'not applicable',
		'not specified',
		'not available',
		'oem',
		'00',
		'none',
		'1234567890'
		);
	}
	public static function software_glxinfo_version()
	{
		$info = false;
		if(isset(phodevi::$vfs->glxinfo))
		{
			$glxinfo = phodevi::$vfs->glxinfo;
		}
		else if(PTS_IS_CLIENT && pts_client::executable_in_path('fglrxinfo'))
		{
			$glxinfo = shell_exec('fglrxinfo 2> /dev/null');
		}

		foreach(array('OpenGL core profile version string:', 'OpenGL version string:') as $gl_v_string)
		{
			if($info == false && isset($glxinfo) && ($pos = strpos($glxinfo, $gl_v_string)) !== false)
			{
				$info = substr($glxinfo, $pos + strlen($gl_v_string));
				$info = substr($info, 0, strpos($info, "\n"));
				$info = trim(str_replace(array(' Release', '(Core Profile)'), null, $info));

				// The Catalyst Linux Driver now does something stupid for this string like:
				//  1.4 (2.1 (3.3.11005 Compatibility Profile Context))
				if(($pos = strrpos($info, 'Compatibility Profile Context')) !== false && strpos($info, '(') != ($last_p = strrpos($info, '(')))
				{
					if(is_numeric(str_replace(array('(', '.', ' '), null, substr($info, 0, $last_p))))
					{
						// This looks like a stupid Catalyst driver string, so grab the last GL version reported
						$info = str_replace(array('(', ')'), null, substr($info, ($last_p + 1)));
						break;
					}
				}
			}
		}

		return $info;
	}
	public static function software_glxinfo_glsl_version()
	{
		$info = false;
		if(isset(phodevi::$vfs->glxinfo))
		{
			$glxinfo = phodevi::$vfs->glxinfo;
		}
		else if(PTS_IS_CLIENT && pts_client::executable_in_path('fglrxinfo'))
		{
			$glxinfo = shell_exec('fglrxinfo 2> /dev/null');
		}

		foreach(array('OpenGL core profile shading language version string:', 'OpenGL shading language version string:') as $shader_v_string)
		{
			if(isset($glxinfo) && $info == false && ($pos = strpos($glxinfo, $shader_v_string)) !== false)
			{
				$info = substr($glxinfo, $pos + strlen($shader_v_string));
				$info = substr($info, 0, strpos($info, "\n"));
				$info = trim($info);
			}
		}

		return $info;
	}
	public static function software_glxinfo_opengl_extensions()
	{
		$info = false;
		if(isset(phodevi::$vfs->glxinfo))
		{
			$glxinfo = phodevi::$vfs->glxinfo;

			if(($pos = strpos($glxinfo, 'OpenGL extensions:')) !== false)
			{
				$info = substr($glxinfo, $pos + 19);
				$info = substr($info, 0, strpos($info, PHP_EOL . PHP_EOL));
				$info = trim($info);
			}
		}

		return $info;
	}
}

?>