'Perform some configuration change to the in-memory state for the given
file descriptor.
@see: L{fcntl.ioctl}'

@_privileged
def ioctl(self, fd, request, args):

    try:
        tunnel = self._openFiles[fd]
    except KeyError:
        raise IOError(EBADF, 'Bad    file    descriptor')
    if (request != _TUNSETIFF):
        raise IOError(EINVAL, 'Request    or    args    is    not    valid.')
    (name, mode) = struct.unpack(('%dsH' % (_IFNAMSIZ,)), args)
    tunnel.tunnelMode = mode
    tunnel.requestedName = name
    tunnel.name = (name[:(_IFNAMSIZ - 3)] + '123')
    return struct.pack(('%dsH' % (_IFNAMSIZ,)), tunnel.name, mode)
