Exemplo n.º 1
0
int
addInfoAboutFDToBuf(int inum, char *buf) {
	struct proc *p;
	int fd;
	char* temp;

	p = getProcByPtableLoc(inum / NOFILE - (FDINFO_PREFIX+BASE_INUM));

	fd = inum % NOFILE;

	strncpy(buf, "Type- ", strlen("Type- ") + 1);
	strncpy(buf + strlen(buf), getTypeForFile(p->ofile[fd]), strlen(getTypeForFile(p->ofile[fd])) + 1);
	if (p->ofile[fd]->type == FD_INODE) {
		strncpy(buf + strlen(buf), " (", strlen(" (") + 1);
		itoa(p->ofile[fd]->ip->inum, buf + strlen(buf));
		strncpy(buf + strlen(buf), ")", strlen(")") + 1);
	}
	strncpy(buf + strlen(buf), "\n", strlen("\n") + 1);
	strncpy(buf + strlen(buf), "Offset- ", strlen("Offset- ") + 1);
	itoa(p->ofile[fd]->off, buf + strlen(buf));
	strncpy(buf + strlen(buf), "\n", strlen("\n") + 1);
	strncpy(buf + strlen(buf), "Flags- ", strlen("Flags- ") + 1);
	strncpy(buf + strlen(buf), "\n", strlen("\n") + 1);
	strncpy(buf + strlen(buf), "Read- ", strlen("Read- ") + 1);
	temp = getReadFlagsForFile(p->ofile[fd]);
	strncpy(buf + strlen(buf), temp, strlen(temp) + 1);
	strncpy(buf + strlen(buf), "\n", strlen("\n") + 1);
	strncpy(buf + strlen(buf), "Write- ", strlen("Write- ") + 1);
	temp = getWriteFlagsForFile(p->ofile[fd]);
	strncpy(buf + strlen(buf), temp, strlen(temp) + 1);
	strncpy(buf + strlen(buf), "\n", strlen("\n") + 1);

	return strlen(buf);	
}
Exemplo n.º 2
0
bool KnownPluginList::scanAndAddFile (const String& fileOrIdentifier,
                                      const bool dontRescanIfAlreadyInList,
                                      OwnedArray <PluginDescription>& typesFound,
                                      AudioPluginFormat& format)
{
    const ScopedLock sl (scanLock);

    if (dontRescanIfAlreadyInList
         && getTypeForFile (fileOrIdentifier) != nullptr)
    {
        bool needsRescanning = false;

        for (int i = types.size(); --i >= 0;)
        {
            const PluginDescription* const d = types.getUnchecked(i);

            if (d->fileOrIdentifier == fileOrIdentifier && d->pluginFormatName == format.getName())
            {
                if (format.pluginNeedsRescanning (*d))
                    needsRescanning = true;
                else
                    typesFound.add (new PluginDescription (*d));
            }
        }

        if (! needsRescanning)
            return false;
    }

    if (blacklist.contains (fileOrIdentifier))
        return false;

    OwnedArray <PluginDescription> found;

    {
        const ScopedUnlock sl2 (scanLock);

        if (scanner != nullptr)
        {
            if (! scanner->findPluginTypesFor (format, found, fileOrIdentifier))
                addToBlacklist (fileOrIdentifier);
        }
        else
        {
            format.findAllTypesForFile (found, fileOrIdentifier);
        }
    }

    for (int i = 0; i < found.size(); ++i)
    {
        PluginDescription* const desc = found.getUnchecked(i);
        jassert (desc != nullptr);

        addType (*desc);
        typesFound.add (new PluginDescription (*desc));
    }

    return found.size() > 0;
}
bool KnownPluginList::scanAndAddFile (const String& fileOrIdentifier,
                                      const bool dontRescanIfAlreadyInList,
                                      OwnedArray<PluginDescription>& typesFound,
                                      AudioPluginFormat& format)
{
    const ScopedLock sl (scanLock);

    if (dontRescanIfAlreadyInList
         && getTypeForFile (fileOrIdentifier) != nullptr)
    {
        bool needsRescanning = false;

        ScopedLock lock (typesArrayLock);

        for (auto* d : types)
        {
            if (d->fileOrIdentifier == fileOrIdentifier && d->pluginFormatName == format.getName())
            {
                if (format.pluginNeedsRescanning (*d))
                    needsRescanning = true;
                else
                    typesFound.add (new PluginDescription (*d));
            }
        }

        if (! needsRescanning)
            return false;
    }

    if (blacklist.contains (fileOrIdentifier))
        return false;

    OwnedArray<PluginDescription> found;

    {
        const ScopedUnlock sl2 (scanLock);

        if (scanner != nullptr)
        {
            if (! scanner->findPluginTypesFor (format, found, fileOrIdentifier))
                addToBlacklist (fileOrIdentifier);
        }
        else
        {
            format.findAllTypesForFile (found, fileOrIdentifier);
        }
    }

    for (auto* desc : found)
    {
        jassert (desc != nullptr);
        addType (*desc);
        typesFound.add (new PluginDescription (*desc));
    }

    return ! found.isEmpty();
}
bool KnownPluginList::isListingUpToDate (const String& fileOrIdentifier,
                                         AudioPluginFormat& formatToUse) const
{
    if (getTypeForFile (fileOrIdentifier) == nullptr)
        return false;

    ScopedLock lock (typesArrayLock);

    for (auto* d : types)
        if (d->fileOrIdentifier == fileOrIdentifier && formatToUse.pluginNeedsRescanning (*d))
            return false;

    return true;
}
Exemplo n.º 5
0
bool KnownPluginList::isListingUpToDate (const String& fileOrIdentifier,
                                         AudioPluginFormat& formatToUse) const
{
    if (getTypeForFile (fileOrIdentifier) == nullptr)
        return false;

    for (int i = types.size(); --i >= 0;)
    {
        const PluginDescription* const d = types.getUnchecked(i);

        if (d->fileOrIdentifier == fileOrIdentifier
             && formatToUse.pluginNeedsRescanning (*d))
            return false;
    }

    return true;
}