'Open a symbolic file.
:param name:            Path of the symbolic file.
:param mode:            File operation mode.
:param preferred_fd:    Assign this fd if it\'s not already claimed.'

def open(self, name, mode, preferred_fd=None):

    fd = None
    if ((preferred_fd is not None) and (preferred_fd not in self.files)):
        fd = preferred_fd
    else:
        for fd_ in xrange(0, 8192):
            if (fd_ not in self.files):
                fd = fd_
                break
    if (fd is None):
        raise SimPosixError('exhausted    file    descriptors')
    if (name in self.fs):
        f = self.fs[name]
    elif (self.concrete_fs and (not os.path.abspath(name).startswith('/dev'))):
        if (self.chroot is not None):
            name = self._chrootize(name)
        backing = SimSymbolicMemory(memory_id=('file_%s' % name))
        backing.set_state(self.state)
        if (not isinstance(mode, (int, long))):
            mode = self.state.se.any_int(mode)
        if ((mode == Flags.O_RDONLY) or (mode & Flags.O_RDWR)):
            try:
                with open(name, 'r') as fp:
                    content = fp.read()
            except IOError:
                return (-1)
            cbvv = self.state.se.BVV(content)
            backing.store(0, cbvv)
            f = SimFile(name, mode, content=backing, size=len(content))
        else:
            f = SimFile(name, mode)
    else:
        f = SimFile(name, mode)
    if (self.state is not None):
        f.set_state(self.state)
    self.files[fd] = f
    self.fs[name] = f
    return fd
