'Fake os.listdir, depending on what mode we\'re in to simulate behaviour.
@param arg: the directory to list'

def listdir(self, arg):

    accurate = map(str, self._files)
    if (self.procfs and (arg == ('/proc/%d/fd' % (self.getpid(),)))):
        return accurate
    if (self.devfs and (arg == '/dev/fd')):
        if self.accurateDevFDResults:
            return accurate
        return ['0', '1', '2']
    raise OSError()
