您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ wait_for_file函数代码示例

51自学网 2021-06-03 09:50:54
  C++
这篇教程C++ wait_for_file函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中wait_for_file函数的典型用法代码示例。如果您正苦于以下问题:C++ wait_for_file函数的具体用法?C++ wait_for_file怎么用?C++ wait_for_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了wait_for_file函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: do_wait

int do_wait(int nargs, char **args){    if (nargs == 2) {        return wait_for_file(args[1], COMMAND_RETRY_TIMEOUT);    } else if (nargs == 3) {        return wait_for_file(args[1], atoi(args[2]));    } else        return -1;}
开发者ID:JoonyLi,项目名称:platform_system_core,代码行数:9,


示例2: mount_and_run

static int mount_and_run(struct fstab *fstab){    struct fstab_part *datap = fstab_find_first_by_path(fstab, "/data");    if(!datap)    {        ERROR("Failed to find /data partition in fstab/n");        return -1;    }    if(access(datap->device, R_OK) < 0)    {        INFO("Waiting for %s/n", datap->device);        if(wait_for_file(datap->device, 5) < 0)        {            ERROR("Waiting too long for dev %s/n", datap->device);            return -1;        }    }    mkdir(REALDATA, 0755);    if(try_mount_all_entries(fstab, datap) < 0)    {#ifndef MR_ENCRYPTION        ERROR("Failed to mount /data with all possible filesystems!/n");        return -1;#else        INFO("Failed to mount /data, trying encryption.../n");        switch(encryption_before_mount(fstab))        {            case ENC_RES_ERR:                ERROR("/data decryption failed!/n");                return -1;            case ENC_RES_BOOT_INTERNAL:                return 0;            default:            case ENC_RES_OK:            {                if(try_mount_all_entries(fstab, datap) < 0)                {                    ERROR("Failed to mount decrypted /data with all possible filesystems!/n");                    return -1;                }                break;            }        }#endif    }    if(find_multirom() == -1)    {        ERROR("Could not find multirom folder!/n");        return -1;    }    adb_init(path_multirom);    run_multirom();    adb_quit();    return 0;}
开发者ID:Diewi,项目名称:multirom,代码行数:60,


示例3: do_wait

int do_wait(int nargs, char **args){    if (nargs == 2) {        return wait_for_file(args[1], COMMAND_RETRY_TIMEOUT);    }    return -1;}
开发者ID:output,项目名称:platform_system_core,代码行数:7,


示例4: fs_mgr_do_mount

/* If tmp_mount_point is non-null, mount the filesystem there.  This is for the * tmp mount we do to check the user password */int fs_mgr_do_mount(struct fstab *fstab, char *n_name, char *n_blk_device,                    char *tmp_mount_point){    int i = 0;    int ret = -1;    char *m;    if (!fstab) {        return ret;    }    for (i = 0; i < fstab->num_entries; i++) {        if (!fs_match(fstab->recs[i].mount_point, n_name)) {            continue;        }        /* We found our match */        /* If this is a raw partition, report an error */        if (!strcmp(fstab->recs[i].fs_type, "emmc") ||            !strcmp(fstab->recs[i].fs_type, "mtd")) {            ERROR("Cannot mount filesystem of type %s on %s/n",                  fstab->recs[i].fs_type, n_blk_device);            goto out;        }        /* First check the filesystem if requested */        if (fstab->recs[i].fs_mgr_flags & MF_WAIT) {            wait_for_file(n_blk_device, WAIT_TIMEOUT);        }        if (fstab->recs[i].fs_mgr_flags & MF_CHECK) {            check_fs(n_blk_device, fstab->recs[i].fs_type,                     fstab->recs[i].mount_point);        }        /* Now mount it where requested */        if (tmp_mount_point) {            m = tmp_mount_point;        } else {            m = fstab->recs[i].mount_point;        }        if (mount(n_blk_device, m, fstab->recs[i].fs_type,                  fstab->recs[i].flags, fstab->recs[i].fs_options)) {            ERROR("Cannot mount filesystem on %s at %s/n",                    n_blk_device, m);            goto out;        } else {            ret = 0;            goto out;        }    }    /* We didn't find a match, say so and return an error */    ERROR("Cannot find mount point %s in fstab/n", fstab->recs[i].mount_point);out:    return ret;}
开发者ID:TeamDevious,项目名称:android_system_core,代码行数:61,


示例5: fs_mgr_mount_all

int fs_mgr_mount_all(char *fstab_file){    int i = 0;    int encrypted = 0;    int ret = -1;    int mret;    struct fstab_rec *fstab = 0;    if (!(fstab = read_fstab(fstab_file))) {        return ret;    }    for (i = 0; fstab[i].blk_dev; i++) {        if (fstab[i].fs_mgr_flags & MF_WAIT) {            wait_for_file(fstab[i].blk_dev, WAIT_TIMEOUT);        }        if (fstab[i].fs_mgr_flags & MF_CHECK) {            check_fs(fstab[i].blk_dev, fstab[i].type, fstab[i].mnt_point);        }        mret = mount(fstab[i].blk_dev, fstab[i].mnt_point, fstab[i].type,                     fstab[i].flags, fstab[i].fs_options);        if (!mret) {            /* Success!  Go get the next one */            continue;        }        /* mount(2) returned an error, check if it's encrypted and deal with it */        if ((fstab[i].fs_mgr_flags & MF_CRYPT) && !partition_wiped(fstab[i].blk_dev)) {            /* Need to mount a tmpfs at this mountpoint for now, and set             * properties that vold will query later for decrypting             */            if (mount("tmpfs", fstab[i].mnt_point, "tmpfs",                  MS_NOATIME | MS_NOSUID | MS_NODEV, CRYPTO_TMPFS_OPTIONS) < 0) {                ERROR("Cannot mount tmpfs filesystem for encrypted fs at %s/n",                        fstab[i].mnt_point);                goto out;            }            encrypted = 1;        } else {            ERROR("Cannot mount filesystem on %s at %s/n",                    fstab[i].blk_dev, fstab[i].mnt_point);            goto out;        }    }    if (encrypted) {        ret = 1;    } else {        ret = 0;    }out:    free_fstab(fstab);    return ret;}
开发者ID:AndroidStudio,项目名称:android-4.2_r1,代码行数:57,


示例6: wait_for_coldboot_done_action

static int wait_for_coldboot_done_action(int nargs, char **args){    int ret;    INFO("wait for %s/n", coldboot_done);    ret = wait_for_file(coldboot_done, COMMAND_RETRY_TIMEOUT);    if (ret)        ERROR("Timed out waiting for %s/n", coldboot_done);    return ret;}
开发者ID:qubir,项目名称:PhoenixA20_android_system_sourcecode,代码行数:9,


示例7: fs_mgr_do_mount

/* If tmp_mnt_point is non-null, mount the filesystem there.  This is for the * tmp mount we do to check the user password */int fs_mgr_do_mount(char *fstab_file, char *n_name, char *n_blk_dev, char *tmp_mnt_point){    int i = 0;    int ret = -1;    struct fstab_rec *fstab = 0;    char *m;    if (!(fstab = read_fstab(fstab_file))) {        return ret;    }    for (i = 0; fstab[i].blk_dev; i++) {        if (!fs_match(fstab[i].mnt_point, n_name)) {            continue;        }        /* We found our match */        /* First check the filesystem if requested */        if (fstab[i].fs_mgr_flags & MF_WAIT) {            wait_for_file(fstab[i].blk_dev, WAIT_TIMEOUT);        }        if (fstab[i].fs_mgr_flags & MF_CHECK) {            check_fs(fstab[i].blk_dev, fstab[i].type, fstab[i].mnt_point);        }        /* Now mount it where requested */        if (tmp_mnt_point) {            m = tmp_mnt_point;        } else {            m = fstab[i].mnt_point;        }        if (mount(n_blk_dev, m, fstab[i].type,                  fstab[i].flags, fstab[i].fs_options)) {            ERROR("Cannot mount filesystem on %s at %s/n",                    n_blk_dev, m);            goto out;        } else {            ret = 0;            goto out;        }    }    /* We didn't find a match, say so and return an error */    ERROR("Cannot find mount point %s in fstab/n", fstab[i].mnt_point);out:    free_fstab(fstab);    return ret;}
开发者ID:AndroidStudio,项目名称:android-4.2_r1,代码行数:53,


示例8: wait_for_coldboot_done_action

static int wait_for_coldboot_done_action(const std::vector<std::string>& args) {    Timer t;    NOTICE("Waiting for %s.../n", COLDBOOT_DONE);    // Any longer than 1s is an unreasonable length of time to delay booting.    // If you're hitting this timeout, check that you didn't make your    // sepolicy regular expressions too expensive (http://b/19899875).    if (wait_for_file(COLDBOOT_DONE, 1)) {        ERROR("Timed out waiting for %s/n", COLDBOOT_DONE);    }    NOTICE("Waiting for %s took %.2fs./n", COLDBOOT_DONE, t.duration());    return 0;}
开发者ID:ArtBears,项目名称:platform_system_core,代码行数:14,


示例9: run_core

static int run_core(void){    int res = -1;    struct fstab *fstab = NULL;    if(wait_for_file("/dev/graphics/fb0", 5) < 0)    {        ERROR("Waiting too long for fb0");        goto exit;    }#ifdef MR_POPULATE_BY_NAME_PATH    Populate_ByName_using_emmc();#endif    fstab = fstab_auto_load();    if(!fstab)        goto exit;#if 0    fstab_dump(fstab); //debug#endif    // mount and run multirom from sdcard    res = mount_and_run(fstab);    if(res < 0 && mrom_is_second_boot())    {        ERROR("This is second boot and we couldn't mount /data, reboot!/n");        sync();        //android_reboot(ANDROID_RB_RESTART, 0, 0);        android_reboot(ANDROID_RB_RESTART2, 0, "recovery"); // favour reboot to recovery, to avoid possible bootlooping        while(1)            sleep(1);    }    if(access(KEEP_REALDATA, F_OK) < 0) {        umount(REALDATA);        rmdir(REALDATA);        encryption_destroy();    }    encryption_cleanup();exit:    if(fstab)        fstab_destroy(fstab);    return res;}
开发者ID:nkk71,项目名称:multirom,代码行数:49,


示例10: main

int main(int argc, char *argv[]){    int i, res;    static char *const cmd[] = { "/init", NULL };    struct fstab *fstab = NULL;    for(i = 1; i < argc; ++i)    {        if(strcmp(argv[i], "-v") == 0)        {            printf("%d/n", VERSION_TRAMPOLINE);            fflush(stdout);            return 0;        }    }    umask(000);    // Init only the little we need, leave the rest for real init    mkdir("/dev", 0755);    mkdir("/dev/pts", 0755);    mkdir("/dev/socket", 0755);    mkdir("/proc", 0755);    mkdir("/sys", 0755);    mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755");    mount("devpts", "/dev/pts", "devpts", 0, NULL);    mount("proc", "/proc", "proc", 0, NULL);    mount("sysfs", "/sys", "sysfs", 0, NULL);    klog_init();    ERROR("Running trampoline v%d/n", VERSION_TRAMPOLINE);    if(is_charger_mode())    {        ERROR("Charger mode detected, skipping multirom/n");        goto run_main_init;    }#if MR_DEVICE_HOOKS >= 3    tramp_hook_before_device_init();#endif    ERROR("Initializing devices...");    devices_init();    ERROR("Done initializing");    if(wait_for_file("/dev/graphics/fb0", 5) < 0)    {        ERROR("Waiting too long for fb0");        goto exit;    }    fstab = fstab_auto_load();    if(!fstab)        goto exit;#if 0     fstab_dump(fstab); //debug#endif    // mount and run multirom from sdcard    mount_and_run(fstab);exit:    if(fstab)        fstab_destroy(fstab);    // close and destroy everything    devices_close();run_main_init:    if(access(KEEP_REALDATA, F_OK) < 0)    {        umount(REALDATA);        umount("/dev/pts");        umount("/dev");        rmdir("/dev/pts");        rmdir("/dev/socket");        rmdir("/dev");        rmdir(REALDATA);    }    umount("/proc");    umount("/sys");    rmdir("/proc");    rmdir("/sys");    ERROR("Running main_init/n");    fixup_symlinks();    chmod("/main_init", EXEC_MASK);    rename("/main_init", "/init");    res = execve(cmd[0], cmd, NULL);    ERROR("execve returned %d %d %s/n", res, errno, strerror(errno));    return 0;}
开发者ID:Ever-Never,项目名称:multirom,代码行数:99,


示例11: fs_mgr_mount_all

/* When multiple fstab records share the same mount_point, it will * try to mount each one in turn, and ignore any duplicates after a * first successful mount. * Returns -1 on error, and  FS_MGR_MNTALL_* otherwise. */int fs_mgr_mount_all(struct fstab *fstab){    int i = 0;    int encryptable = FS_MGR_MNTALL_DEV_NOT_ENCRYPTED;    int error_count = 0;    int mret = -1;    int mount_errno = 0;    int attempted_idx = -1;    if (!fstab) {        return -1;    }    for (i = 0; i < fstab->num_entries; i++) {        /* Don't mount entries that are managed by vold */        if (fstab->recs[i].fs_mgr_flags & (MF_VOLDMANAGED | MF_RECOVERYONLY)) {            continue;        }        /* Skip swap and raw partition entries such as boot, recovery, etc */        if (!strcmp(fstab->recs[i].fs_type, "swap") ||            !strcmp(fstab->recs[i].fs_type, "emmc") ||            !strcmp(fstab->recs[i].fs_type, "mtd")) {            continue;        }        /* Translate LABEL= file system labels into block devices */        if (!strcmp(fstab->recs[i].fs_type, "ext2") ||            !strcmp(fstab->recs[i].fs_type, "ext3") ||            !strcmp(fstab->recs[i].fs_type, "ext4")) {            int tret = translate_ext_labels(&fstab->recs[i]);            if (tret < 0) {                ERROR("Could not translate label to block device/n");                continue;            }        }        if (fstab->recs[i].fs_mgr_flags & MF_WAIT) {            wait_for_file(fstab->recs[i].blk_device, WAIT_TIMEOUT);        }        if ((fstab->recs[i].fs_mgr_flags & MF_VERIFY) && device_is_secure()) {            int rc = fs_mgr_setup_verity(&fstab->recs[i]);            if (device_is_debuggable() && rc == FS_MGR_SETUP_VERITY_DISABLED) {                INFO("Verity disabled");            } else if (rc != FS_MGR_SETUP_VERITY_SUCCESS) {                ERROR("Could not set up verified partition, skipping!/n");                continue;            }        }        int last_idx_inspected;        mret = mount_with_alternatives(fstab, i, &last_idx_inspected, &attempted_idx);        i = last_idx_inspected;        mount_errno = errno;        /* Deal with encryptability. */        if (!mret) {            int status = handle_encryptable(fstab, &fstab->recs[attempted_idx]);            if (status == FS_MGR_MNTALL_FAIL) {                /* Fatal error - no point continuing */                return status;            }            if (status != FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) {                if (encryptable != FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) {                    // Log and continue                    ERROR("Only one encryptable/encrypted partition supported/n");                }                encryptable = status;            }            /* Success!  Go get the next one */            continue;        }        /* mount(2) returned an error, check if it's encryptable and deal with it */        if (mret && mount_errno != EBUSY && mount_errno != EACCES &&            fs_mgr_is_encryptable(&fstab->recs[attempted_idx])) {            if(partition_wiped(fstab->recs[attempted_idx].blk_device)) {                ERROR("%s(): %s is wiped and %s %s is encryptable. Suggest recovery.../n", __func__,                      fstab->recs[attempted_idx].blk_device, fstab->recs[attempted_idx].mount_point,                      fstab->recs[attempted_idx].fs_type);                encryptable = FS_MGR_MNTALL_DEV_NEEDS_RECOVERY;                continue;            } else {                /* Need to mount a tmpfs at this mountpoint for now, and set                 * properties that vold will query later for decrypting                 */                ERROR("%s(): possibly an encryptable blkdev %s for mount %s type %s )/n", __func__,                      fstab->recs[attempted_idx].blk_device, fstab->recs[attempted_idx].mount_point,                      fstab->recs[attempted_idx].fs_type);                if (fs_mgr_do_tmpfs_mount(fstab->recs[attempted_idx].mount_point) < 0) {                    ++error_count;                    continue;//.........这里部分代码省略.........
开发者ID:00zhengfu00,项目名称:platform_system_core,代码行数:101,


示例12: main

int main(int argc, char **argv){    struct fstab *fstab;    int ret=0, syspart, i, status;    char filenamePatched[PATH_MAX], filenameSystem[PATH_MAX];    // check arguments    if(argc!=2) {        ERROR("Invalid Arguments");        return -EINVAL;    }    // get syspart from cmdline    syspart = getDualbootSyspart();    if(syspart<0) {        ERROR("Cannot read system number");        return -EINVAL;    }    // patch fstab    sprintf(filenamePatched, "%s.patched", argv[1]);    sprintf(filenameSystem, "%s.system", argv[1]);    patch_fstab(argv[1], filenamePatched, filenameSystem, syspart);    // mount system    fstab = fs_mgr_read_fstab(filenameSystem);    ret = fs_mgr_mount_all(fstab);    fs_mgr_free_fstab(fstab);    if (ret == -1) {        ERROR("fs_mgr_mount_all returned an error/n");    }    // mount data    fstab = fs_mgr_read_fstab(argv[1]);    for (i = 0; i < fstab->num_entries; ++i) {        struct fstab_rec* v = &fstab->recs[i];                if(strcmp(PARTITION_USERDATA, v->blk_device))            continue;        if (v->fs_mgr_flags & MF_WAIT) {            wait_for_file(v->blk_device, WAIT_TIMEOUT);        }        if (v->fs_mgr_flags & MF_CHECK) {            check_fs(v->blk_device, v->fs_type, v->mount_point);        }        if(mountScriptExists()) {            char *e2fsck_argv[] = {                "/system/bin/mount_ext4.sh",                v->blk_device,                v->mount_point            };            ret = android_fork_execvp_ext(ARRAY_SIZE(e2fsck_argv), e2fsck_argv, &status, true, LOG_KLOG, true, NULL);        }        else {            ret = mount(v->blk_device, v->mount_point,  v->fs_type, v->flags, v->fs_options);        }    }    fs_mgr_free_fstab(fstab);    if (ret == -1) {        ERROR("error mounting userdata/n");    }        return ret;}
开发者ID:Mi-PAD-DEVS,项目名称:android_device_mocha,代码行数:67,


示例13: do_mount

/* mount <type> <device> <path> <flags ...> <options> */int do_mount(int nargs, char **args){    char tmp[64];    char *source, *target, *system;    char *options = NULL;    unsigned flags = 0;    int n, i;    int wait = 0;    for (n = 4; n < nargs; n++) {        for (i = 0; mount_flags[i].name; i++) {            if (!strcmp(args[n], mount_flags[i].name)) {                flags |= mount_flags[i].flag;                break;            }        }        if (!mount_flags[i].name) {            if (!strcmp(args[n], "wait"))                wait = 1;            /* if our last argument isn't a flag, wolf it up as an option string */            else if (n + 1 == nargs)                options = args[n];        }    }    system = args[1];    source = args[2];    target = args[3];    if (!strncmp(source, "[email
C++ wait_for_pid函数代码示例
C++ wait_for_event函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。