#!/bin/sh
# @file cpsudo_count_file_descriptors
# @brief Returns the number of file descriptors used by the process idetified by the pid 
# @description used to deal with situations that cause a leak, like certain
#   libCurl SSL interactions.

pid=$(cat /var/run/catchpoint/cpsns.pid)
if [ pid = "" ]; then
    echo "pid is not found"
fi
res=$(ls /proc/$pid/fd | wc -l)
if [ $? ]; then
    echo $res
else
    echo "Failed to get fd list"
fi