本文整理汇总了C++中SLOGE函数的典型用法代码示例。如果您正苦于以下问题:C++ SLOGE函数的具体用法?C++ SLOGE怎么用?C++ SLOGE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SLOGE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMajorNumberForBadPartition
dev_t DirectVolume::getShareDevice() {
if (mPartIdx != -1) {
#ifdef VOLD_DISC_HAS_MULTIPLE_MAJORS
int major = getMajorNumberForBadPartition(mPartIdx);
if(major != -1) {
SLOGE("getShareDevice() returning correct major: %d, minor: %d", major, mPartMinors[mPartIdx - 1]);
return MKDEV(major, mPartMinors[mPartIdx - 1]);
}
else
#endif
return MKDEV(mDiskMajor, mPartIdx);
} else {
return MKDEV(mDiskMajor, mDiskMinor);
}
}
示例2: snprintf
int VolumeManager::unmountAsec(const char *id, bool force) {
char asecFileName[255];
char mountPoint[255];
snprintf(asecFileName, sizeof(asecFileName), "%s/%s.asec", Volume::SEC_ASECDIR, id);
snprintf(mountPoint, sizeof(mountPoint), "%s/%s", Volume::ASECDIR, id);
char idHash[33];
if (!asecHash(id, idHash, sizeof(idHash))) {
SLOGE("Hash of '%s' failed (%s)", id, strerror(errno));
return -1;
}
return unmountLoopImage(id, idHash, asecFileName, mountPoint, force);
}
示例3: SLOGE
int NetlinkManager::stop()
{
if (mHandler->stop())
{
SLOGE("Unable to stop NetlinkHandler: %s", strerror(errno));
return -1;
}
delete mHandler;
mHandler = NULL;
close(mSock);
mSock = -1;
return 0;
}
示例4: load_qseecom_library
static int load_qseecom_library()
{
const char *error = NULL;
if (loaded_library)
return loaded_library;
void * handle = dlopen(QSEECOM_LIBRARY_PATH, RTLD_NOW);
if(handle) {
dlerror(); /* Clear any existing error */
*(void **) (&qseecom_create_key) = dlsym(handle,"QSEECom_create_key");
if((error = dlerror()) == NULL) {
SLOGD("Success loading QSEECom_create_key \n");
*(void **) (&qseecom_update_key) = dlsym(handle,"QSEECom_update_key_user_info");
if ((error = dlerror()) == NULL) {
SLOGD("Success loading QSEECom_update_key_user_info\n");
*(void **) (&qseecom_wipe_key) = dlsym(handle,"QSEECom_wipe_key");
if ((error = dlerror()) == NULL) {
loaded_library = 1;
SLOGD("Success loading QSEECom_wipe_key \n");
}
else
SLOGE("Error %s loading symbols for QSEECom APIs \n", error);
}
else
SLOGE("Error %s loading symbols for QSEECom APIs \n", error);
}
} else {
SLOGE("Could not load libQSEEComAPI.so \n");
}
if(error)
dlclose(handle);
return loaded_library;
}
示例5: pthread_mutex_lock
bool SocketClient::decRef() {
bool deleteSelf = false;
pthread_mutex_lock(&mRefCountMutex);
mRefCount--;
if (mRefCount == 0) {
deleteSelf = true;
} else if (mRefCount < 0) {
SLOGE("SocketClient refcount went negative!");
}
pthread_mutex_unlock(&mRefCountMutex);
if (deleteSelf) {
delete this;
}
return deleteSelf;
}
示例6: main
int main(int argc, char **argv) {
if (argc != 2 || argv[1][0] != '/') {
usage(argv[0]);
return -1;
}
SLOGD("Running: %s %s", argv[0], argv[1]);
std::string target(argv[1]);
destroy_key(target);
if (unlink(argv[1]) != 0 && errno != ENOENT) {
SLOGE("Unable to delete %s: %s",
argv[1], strerror(errno));
return -1;
}
return 0;
}
示例7: SsServerDeleteFile
int SsServerDeleteFile(int sender_pid, const char* data_filepath, ssm_flag flag, const char* cookie, const char* group_id)
{
const char* in_filepath = data_filepath;
char out_filepath[MAX_FILENAME_LEN] = {0, };
//0. privilege check and get directory name
if(check_privilege(cookie, group_id) != 0)
{
SLOGE("[%s] permission denied\n", __func__);
return SS_PERMISSION_DENIED;
}
// 1. create out file name
ConvertFileName(sender_pid, out_filepath, in_filepath, flag, group_id);
// 2. delete designated file
if(unlink(out_filepath) != 0) // unlink fail?
{
SLOGE("[%s] error occured while deleting file\n", __func__);
return SS_FILE_WRITE_ERROR;
}
return 1;
}
示例8: e4crypt_install_key
static int e4crypt_install_key(const ext4_encryption_key &ext4_key, const std::string &ref)
{
key_serial_t device_keyring = e4crypt_keyring();
SLOGI("Found device_keyring - id is %d", device_keyring);
key_serial_t key_id = add_key("logon", ref.c_str(),
(void*)&ext4_key, sizeof(ext4_key),
device_keyring);
if (key_id == -1) {
SLOGE("Failed to insert key into keyring with error %s",
strerror(errno));
return -1;
}
SLOGI("Added key %d (%s) to keyring %d in process %d",
key_id, ref.c_str(), device_keyring, getpid());
return 0;
}
示例9: atoi
void DirectVolume::handlePartitionAdded(const char *devpath, NetlinkEvent *evt) {
int major = atoi(evt->findParam("MAJOR"));
int minor = atoi(evt->findParam("MINOR"));
int part_num;
const char *tmp = evt->findParam("PARTN");
if (tmp) {
part_num = atoi(tmp);
} else {
SLOGW("Kernel block uevent missing 'PARTN'");
part_num = 1;
}
if (part_num > MAX_PARTITIONS || part_num < 1) {
SLOGW("Invalid 'PARTN' value");
part_num = 1;
}
if (part_num > mDiskNumParts) {
mDiskNumParts = part_num;
}
if (major != mDiskMajor) {
SLOGE("Partition '%s' has a different major than its disk!", devpath);
return;
}
#ifdef PARTITION_DEBUG
SLOGD("Dv:partAdd: part_num = %d, minor = %d\n", part_num, minor);
#endif
mPartMinors[part_num -1] = minor;
mPendingPartMap &= ~(1 << part_num);
if (!mPendingPartMap) {
#ifdef PARTITION_DEBUG
SLOGD("Dv:partAdd: Got all partitions - ready to rock!");
#endif
if (getState() != Volume::State_Formatting) {
setState(Volume::State_Idle);
}
} else {
#ifdef PARTITION_DEBUG
SLOGD("Dv:partAdd: pending mask now = 0x%x", mPendingPartMap);
#endif
}
}
示例10: killProcessesWithOpenFiles
// hunt down and kill processes that have files open on the given mount point
void killProcessesWithOpenFiles(const char *path, int action)
{
DIR *dir;
struct dirent *de;
if (!(dir = opendir("/proc"))) {
SLOGE("opendir failed (%s)", strerror(errno));
return;
}
while ((de = readdir(dir))) {
int pid = getPid(de->d_name);
char name[PATH_MAX];
if (pid == -1)
continue;
getProcessName(pid, name, sizeof(name));
char openfile[PATH_MAX];
if (checkfileDescriptorSymLinks
(pid, path, openfile, sizeof(openfile))) {
SLOGE("Process %s (%d) has open file %s", name, pid,
openfile);
} else if (checkfileMaps(pid, path, openfile, sizeof(openfile))) {
SLOGE("Process %s (%d) has open filemap for %s", name,
pid, openfile);
} else if (checkSymLink(pid, path, "cwd")) {
SLOGE("Process %s (%d) has cwd within %s", name, pid,
path);
} else if (checkSymLink(pid, path, "root")) {
SLOGE("Process %s (%d) has chroot within %s", name, pid,
path);
} else if (checkSymLink(pid, path, "exe")) {
SLOGE("Process %s (%d) has executable path within %s",
name, pid, path);
} else {
continue;
}
if (action == 1) {
SLOGW("Sending SIGHUP to process %d", pid);
kill(pid, SIGTERM);
} else if (action == 2) {
SLOGE("Sending SIGKILL to process %d", pid);
kill(pid, SIGKILL);
}
}
closedir(dir);
}
示例11: SLOGE
int VolumeManager::getAsecFilesystemPath(const char *id, char *buffer, int maxlen) {
char asecFileName[255];
if (findAsec(id, asecFileName, sizeof(asecFileName))) {
SLOGE("Couldn't find ASEC %s", id);
return -1;
}
memset(buffer, 0, maxlen);
if (access(asecFileName, F_OK)) {
errno = ENOENT;
return -1;
}
snprintf(buffer, maxlen, "%s", asecFileName);
return 0;
}
示例12: destroy_key
// BLKSECDISCARD all content in "path", if it's small enough.
static void destroy_key(const std::string &path) {
uint64_t range[2];
if (file_device_range(path, range) < 0) {
return;
}
int fs_fd = open_block_device_for_path(path);
if (fs_fd < 0) {
return;
}
if (ioctl(fs_fd, BLKSECDISCARD, range) != 0) {
SLOGE("Unable to BLKSECDISCARD %s: %s", path.c_str(), strerror(errno));
close(fs_fd);
return;
}
close(fs_fd);
SLOGD("Discarded %s", path.c_str());
}
示例13: open
bool VolumeManager::isAsecInDirectory(const char *dir, const char *asecName) const {
int dirfd = open(dir, O_DIRECTORY);
if (dirfd < 0) {
SLOGE("Couldn't open internal ASEC dir (%s)", strerror(errno));
return -1;
}
bool ret = false;
if (!faccessat(dirfd, asecName, F_OK, AT_SYMLINK_NOFOLLOW)) {
ret = true;
}
close(dirfd);
return ret;
}
示例14: IsDirExist
int IsDirExist(char* dirpath)
{
DIR* dp = NULL;
if((dp = opendir(dirpath)) == NULL) // dir is not exist
{
SLOGE("[%s] directory [%s] is not exist.\n", __func__, dirpath);
return 0; // return value '0' represents dir is not exist
}
else
{
closedir(dp);
return 1;
}
return -1;
}
示例15: prctl
bool LogAudit::onDataAvailable(SocketClient *cli) {
prctl(PR_SET_NAME, "logd.auditd");
struct audit_message rep;
rep.nlh.nlmsg_type = 0;
rep.nlh.nlmsg_len = 0;
rep.data[0] = '\0';
if (audit_get_reply(cli->getSocket(), &rep, GET_REPLY_BLOCKING, 0) < 0) {
SLOGE("Failed on audit_get_reply with error: %s", strerror(errno));
return false;
}
logPrint("type=%d %.*s", rep.nlh.nlmsg_type, rep.nlh.nlmsg_len, rep.data);
return true;
}