GPMProcessEntry::GPMProcessEntry ( JTree* tree, const JDirEntry& entry ) : JNamedTreeNode(tree, "", kJFalse), itsLastUTime(0), itsLastSTime(0) { itsProcPath = entry.GetFullName(); itsUID = entry.GetUserID(); itsUser = entry.GetUserName(); JUInt value; entry.GetName().ConvertToUInt(&value); itsPID = value; }
JBoolean MatchesCookie ( const JCharacter* cookie, const JDirEntry& entry ) { JString file = entry.GetFullName(); if (!JFileReadable(file)) { return kJFalse; } mode_t perms; JError err = JGetPermissions(file, &perms); if (!err.OK()) { perms = 0600; } ifstream is(file); is >> ws; JString line1 = JReadLine(is); is.close(); if (line1 == "") { return kJTrue; } JArray<JIndexRange> subList; JRegex regex; err = regex.SetPattern(cookie); JBoolean matched = regex.Match(line1, &subList); if (matched) { return kJTrue; } return kJFalse; }