@@ -138,7 +138,7 @@ bool read_process_status(int *active_processes, int *running_processes,
138
138
{
139
139
FILE * fpstat ;
140
140
DIR * dirp ;
141
- struct dirent * ent , dbuf ;
141
+ struct dirent * ent ;
142
142
char file_name [MIN_BUFFER_SIZE ];
143
143
char process_type ;
144
144
unsigned int running_threads ;
@@ -156,14 +156,11 @@ bool read_process_status(int *active_processes, int *running_processes,
156
156
}
157
157
158
158
/* Read the proc directory for process status */
159
- while (readdir_r ( dirp , & dbuf , & ent ) == 0 )
159
+ while (( ent = readdir ( dirp )) != NULL )
160
160
{
161
161
memset (file_name , 0x00 , MIN_BUFFER_SIZE );
162
162
process_type = '\0' ;
163
163
164
- if (!ent )
165
- break ;
166
-
167
164
/* Iterate only digit as name because it is process id */
168
165
if (!isdigit (* ent -> d_name ))
169
166
continue ;
@@ -182,7 +179,7 @@ bool read_process_status(int *active_processes, int *running_processes,
182
179
183
180
if (process_type == 'R' )
184
181
running_pro ++ ;
185
- else if (process_type == 'S' || process_type == 'D' )
182
+ else if (process_type == 'S' || process_type == 'D' )
186
183
sleeping_pro ++ ;
187
184
else if (process_type == 'T' )
188
185
stopped_pro ++ ;
@@ -209,6 +206,7 @@ bool read_process_status(int *active_processes, int *running_processes,
209
206
return true;
210
207
}
211
208
209
+
212
210
void ReadFileContent (const char * file_name , uint64 * data )
213
211
{
214
212
FILE * fp = NULL ;
0 commit comments