Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
EventFilter
Processor
src
FileDescriptorHandler.cc
Go to the documentation of this file.
1
#include "
FileDescriptorHandler.h
"
2
3
#include <iostream>
4
#include <sstream>
5
6
#include <sys/types.h>
7
#include <sys/stat.h>
8
#include <dirent.h>
9
10
#include <stdlib.h>
11
12
13
namespace
evf{
14
15
FileDescriptorHandler::FileDescriptorHandler
(){
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
}
36
37
}
FileDescriptorHandler.h
evf::FileDescriptorHandler::FileDescriptorHandler
FileDescriptorHandler()
Definition:
FileDescriptorHandler.cc:15
evf::utils::pid
num pid
Definition:
procUtils.cc:73
AlCaRecoCosmics_cfg.name
tuple name
Definition:
AlCaRecoCosmics_cfg.py:24
path
int path() const
Definition:
HLTadd.h:3
linker.DIR
list DIR
Definition:
linker.py:124
dir
dbl *** dir
Definition:
mlp_gen.cc:35
Generated for CMSSW Reference Manual by
1.8.5