| 933 | } |
| 934 | |
| 935 | int monitor_processes(int *nb_pid) |
| 936 | { |
| 937 | int pid_count, fd_count, result_count; |
| 938 | int i,j; |
| 939 | pidinfo_t pidinfo_list[MAX_PIDS]; |
| 940 | fdinfo_t fdinfo; |
| 941 | fdinfo_t biggest_fd; |
| 942 | int fdnum_list[MAX_FD_PER_PID]; |
| 943 | off_t max_size; |
| 944 | char fsize[64]; |
| 945 | char fpos[64]; |
| 946 | char ftroughput[64]; |
| 947 | float perc; |
| 948 | result_t results[MAX_RESULTS]; |
| 949 | signed char still_there; |
| 950 | signed char search_all = 1; |
| 951 | static signed char first_pass = 1; |
| 952 | |
| 953 | pid_count = 0; |
| 954 | if (!flag_monitor && !flag_monitor_continuous) |
| 955 | first_pass = 0; |
| 956 | |
| 957 | |
| 958 | if (proc_specifiq_name_cnt) { |
| 959 | search_all = 0; |
| 960 | for (i = 0 ; i < proc_specifiq_name_cnt ; ++i) { |
| 961 | pid_count += find_pids_by_binary_name(proc_specifiq_name[i], |
| 962 | pidinfo_list + pid_count, |
| 963 | MAX_PIDS - pid_count); |
| 964 | if(pid_count >= MAX_PIDS) { |
| 965 | nfprintf(stderr, "Found too much procs (max = %d)\n",MAX_PIDS); |
| 966 | return 0; |
| 967 | } |
| 968 | } |
| 969 | } |
| 970 | |
| 971 | if (proc_specifiq_pid) { |
| 972 | search_all = 0; |
| 973 | for (i = 0 ; i < proc_specifiq_pid_cnt ; ++i) { |
| 974 | pid_count += find_pid_by_id(proc_specifiq_pid[i], |
| 975 | pidinfo_list + pid_count); |
| 976 | |
| 977 | if(pid_count >= MAX_PIDS) { |
| 978 | nfprintf(stderr, "Found too much procs (max = %d)\n",MAX_PIDS); |
| 979 | return 0; |
| 980 | } |
| 981 | } |
| 982 | } |
| 983 | |
| 984 | if (search_all) { |
| 985 | for (i = 0 ; i < proc_names_cnt ; i++) { |
| 986 | pid_count += find_pids_by_binary_name(proc_names[i], |
| 987 | pidinfo_list + pid_count, |
| 988 | MAX_PIDS - pid_count); |
| 989 | if(pid_count >= MAX_PIDS) { |
| 990 | nfprintf(stderr, "Found too much procs (max = %d)\n",MAX_PIDS); |
| 991 | return 0; |
| 992 | } |
no test coverage detected