CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
evf::FileDescriptorHandler Class Reference

#include <FileDescriptorHandler.h>

Public Member Functions

 FileDescriptorHandler ()
 

Detailed Description

Definition at line 5 of file FileDescriptorHandler.h.

Constructor & Destructor Documentation

evf::FileDescriptorHandler::FileDescriptorHandler ( )

Definition at line 15 of file FileDescriptorHandler.cc.

References dir, linker::DIR, AlCaRecoCosmics_cfg::name, path(), and evf::utils::pid.

15  {
16 
17  //find all socket file descriptors inherited from parent process and close them
18 
19  pid_t pid = ::getpid();
20  std::ostringstream ost;
21  ost << "/proc/" << pid << "/fd/";
22  DIR *dir = opendir(ost.str().c_str());
23  dirent *de;
24  struct stat buf;
25  while((de = readdir(dir))!=0){
26  char *name = de->d_name;
27  std::string path = ost.str()+name;
28  stat(path.c_str(),&buf);
29  if(S_ISSOCK(buf.st_mode)){
30  int fd = atoi(name);
31  close(fd);
32  }
33  }
34  closedir(dir);
35 }
int path() const
Definition: HLTadd.h:3
list DIR
Definition: linker.py:124
dbl *** dir
Definition: mlp_gen.cc:35