109 """parse the fds of the processs -> build fds_dict"""
113 msg.info(
"extract_fds: making snapshot of parent process file descriptors")
114 self.
curdir = os.path.abspath(os.curdir)
117 procfd =
"/proc/self/fd"
118 fds = os.listdir(procfd)
121 if fd == 1
or fd == 2:
129 realname = os.path.realpath(os.path.join(procfd, i))
130 except (OSError, IOError, TypeError):
133 msg.debug(
"failed to resolve: %s ... skipping", os.path.join(procfd, i))
136 if os.path.exists(realname):
138 flags = fcntl.fcntl(fd, fcntl.F_GETFL)
139 if (flags & _O_ACCMODE) == 0:
144 self.
add(fd, realname, iomode, flags)
145 except (OSError, IOError):
148 msg.debug(
"failed access to: %s ... skipping", realname)
156 msg.debug(
"extract_fds.fds_dict=%s" % self)