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

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

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

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

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

示例1: procd_coldplug

void procd_coldplug(void){	char *argv[] = { "udevtrigger", NULL };	umount2("/dev/pts", MNT_DETACH);	umount2("/dev/", MNT_DETACH);	mount("tmpfs", "/dev", "tmpfs", 0, "mode=0755,size=512K");	mkdir("/dev/shm", 0755);	mkdir("/dev/pts", 0755);	mount("devpts", "/dev/pts", "devpts", 0, 0);	udevtrigger.cb = udevtrigger_complete;	udevtrigger.pid = fork();	if (!udevtrigger.pid) {		execvp(argv[0], argv);		ERROR("Failed to start coldplug/n");		exit(-1);	}	if (udevtrigger.pid <= 0) {		ERROR("Failed to start new coldplug instance/n");		return;	}	uloop_process_add(&udevtrigger);	DEBUG(4, "Launched coldplug instance, pid=%d/n", (int) udevtrigger.pid);}
开发者ID:Yui-Qi-Tang,项目名称:openwrtPKG,代码行数:27,


示例2: in

CFSMounter::UMountRes CFSMounter::umount(const char * const dir){	UMountRes res = UMRES_OK;	if (dir != NULL)	{		if (umount2(dir, MNT_FORCE) != 0)		{			return UMRES_ERR;		}	}	else	{		MountInfo mi;		std::ifstream in("/proc/mounts", std::ifstream::in);		while(in.good())		{			in >> mi.device >> mi.mountPoint >> mi.type;			in.ignore(std::numeric_limits<std::streamsize>::max(), '/n');			if(strcmp(mi.type.c_str(),"nfs")==0 && strcmp(mi.mountPoint.c_str(),"/")==0)			{				if (umount2(mi.mountPoint.c_str(),MNT_FORCE) != 0)				{					printf("[CFSMounter] Error umounting %s/n",mi.device.c_str());					res = UMRES_ERR;				}			}		}	}	if (nfs_mounted_once)		remove_modules(CFSMounter::NFS);	return res;}
开发者ID:FFTEAM,项目名称:neutrino-mp3-ddt,代码行数:33,


示例3: cleanup_dev

static voidcleanup_dev (void){	if (!access (MOVE_DEV_PATH "/kmsg", W_OK)) {		umount2 (MOVE_DEV_PATH PROC_PATH, MNT_DETACH);		umount2 (MOVE_DEV_PATH, MNT_DETACH);		rmdir (MOVE_DEV_PATH);	}}
开发者ID:Max-E,项目名称:bootchart,代码行数:9,


示例4: umount_api

static voidumount_api (const char *path){    verbose_do ("Unmounting ", path);    if (umount2 (path, 0) < 0 && umount2 (path, MNT_DETACH) < 0)        verbose_fail (errno);    else if (level > 0)        aa_put_title (0, "Unmounted", path, 1);}
开发者ID:jjk-jacky,项目名称:anopa,代码行数:9,


示例5: umount_nofollow_support

/* Check whether the kernel supports UMOUNT_NOFOLLOW flag */static int umount_nofollow_support(void){	int res = umount2("", UMOUNT_UNUSED);	if (res != -1 || errno != EINVAL)		return 0;	res = umount2("", UMOUNT_NOFOLLOW);	if (res != -1 || errno != ENOENT)		return 0;	return 1;}
开发者ID:efarrer,项目名称:util-linux,代码行数:13,


示例6: lxc_attach_remount_sys_proc

static int lxc_attach_remount_sys_proc(void){	int ret;	ret = unshare(CLONE_NEWNS);	if (ret < 0) {		SYSERROR("failed to unshare mount namespace");		return -1;	}	if (detect_shared_rootfs()) {		if (mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL)) {			SYSERROR("Failed to make / rslave");			ERROR("Continuing...");		}	}	/* assume /proc is always mounted, so remount it */	ret = umount2("/proc", MNT_DETACH);	if (ret < 0) {		SYSERROR("failed to unmount /proc");		return -1;	}	ret = mount("none", "/proc", "proc", 0, NULL);	if (ret < 0) {		SYSERROR("failed to remount /proc");		return -1;	}	/* try to umount /sys - if it's not a mount point,	 * we'll get EINVAL, then we ignore it because it	 * may not have been mounted in the first place	 */	ret = umount2("/sys", MNT_DETACH);	if (ret < 0 && errno != EINVAL) {		SYSERROR("failed to unmount /sys");		return -1;	} else if (ret == 0) {		/* remount it */		ret = mount("none", "/sys", "sysfs", 0, NULL);		if (ret < 0) {			SYSERROR("failed to remount /sys");			return -1;		}	}	return 0;}
开发者ID:Archer-sys,项目名称:lxc,代码行数:49,


示例7: unlink_fundamental_devices

int unlink_fundamental_devices(const char* chroot_path) {  unlink_fundamental_device(chroot_path,"/dev/null");  unlink_fundamental_device(chroot_path,"/dev/zero");  unlink_fundamental_device(chroot_path,"/dev/random");  unlink_fundamental_device(chroot_path,"/dev/urandom");  // unmount /dev/shm for linux only#ifdef __linux__    char *fullpath = (char *)        malloc(strlen(chroot_path) + strlen("/dev/shm") + 1);    sprintf(fullpath, "%s/dev/shm", chroot_path);    if (umount2(fullpath, MNT_FORCE) < 0)    {        fprintf(stderr, "Could not unmount %s (%s).  Aborting./n",            fullpath, strerror(errno));        exit(ERR_EXIT_CODE);    }    if (rmdir(fullpath) < 0)    {        fprintf(stderr, "Could not rmdir %s (%s).  Aborting./n",            fullpath, strerror(errno));        exit(ERR_EXIT_CODE);    }    free(fullpath);#endif  return 0;}
开发者ID:bloomberg,项目名称:userchroot,代码行数:26,


示例8: create_fundamental_devices

int create_fundamental_devices(const char* chroot_path) {  // we need to let the devices be created with the appropriate  // modes. However, since the file will be group-owned by  // the user creating the device, we make sure the umask prevent  // the user from having any permission granted just by the group.  mode_t original_mask = umask(0070);  create_fundamental_device(chroot_path,"/dev/null");  create_fundamental_device(chroot_path,"/dev/zero");  create_fundamental_device(chroot_path,"/dev/random");  create_fundamental_device(chroot_path,"/dev/urandom");  // add a mount for /dev/shm for linux only#ifdef __linux__    char *fullpath = (char *)        malloc(strlen(chroot_path) + strlen("/dev/shm") + 1);    sprintf(fullpath, "%s/dev/shm", chroot_path);    struct stat statbuf;    mode_t perms = (0777 | S_ISVTX);    // clean up from a previous run and set up for this one    umount2(fullpath, MNT_FORCE);    rmdir(fullpath);    mkdir(fullpath, perms);    if (chown(fullpath, 0, 0) < 0)    {        fprintf(stderr, "Could not chown %s to root.  Aborting./n", fullpath);        exit(ERR_EXIT_CODE);    }    if (chmod(fullpath, perms) < 0)    {        fprintf(stderr, "Could not chmod %s to 777+sticky.  Aborting./n",            fullpath);        exit(ERR_EXIT_CODE);    }    if (stat(fullpath, &statbuf) < 0)    {        fprintf(stderr, "Could not stat %s.  Aborting./n", fullpath);        exit(ERR_EXIT_CODE);    }    if (!S_ISDIR(statbuf.st_mode))    {        fprintf(stderr, "%s not a directory.  Aborting./n", fullpath);        exit(ERR_EXIT_CODE);    }    if ((statbuf.st_mode & perms) != perms)    {        fprintf(stderr, "Wrong perms on %s.  Aborting./n", fullpath);        exit(ERR_EXIT_CODE);    }    if (mount("tmpfs", fullpath, "tmpfs", MS_MGC_VAL, "size=128m") < 0)    {        fprintf(stderr, "Could not mount %s.  Aborting./n", fullpath);        exit(ERR_EXIT_CODE);    }    free(fullpath);#endif  umask(original_mask);  return 0;}
开发者ID:bloomberg,项目名称:userchroot,代码行数:60,


示例9: UndoBindMounts

void UndoBindMounts(char *DirList, int Flags){char *UmountList=NULL, *Token=NULL, *Tempstr=NULL, *ptr, *dptr;//Reverse dir list so we unmount in reverse order//to the mountsptr=GetToken(DirList,",",&Token,0);while (ptr){	dptr=Token;	Tempstr=MCopyStr(Tempstr,dptr,",",UmountList,NULL);	UmountList=CopyStr(UmountList,Tempstr);	ptr=GetToken(ptr,",",&Token,0);}ptr=GetToken(UmountList,",",&Token,0);while (ptr){	dptr=strrchr(Token,':');	if (dptr) dptr++; 	else dptr=Token;	while (*dptr=='/') dptr++;	umount2(dptr, MNT_DETACH);	RmDirPath(dptr);	ptr=GetToken(ptr,",",&Token,0);}DestroyString(Token);}
开发者ID:wedaa,项目名称:LongTail-Telnet-honeypot-v2,代码行数:31,


示例10: set_ct_root

static int set_ct_root(struct container *ct){	char put_root[] = "libct-root.XXXXXX";	if (!(ct->nsmask & CLONE_NEWNS))		return set_current_root(ct->root_path);	/*	 * We're in new mount namespace. No need in	 * just going into chroot, do pivot root, that	 * gives us the ability to umount old tree.	 */	if (mount(ct->root_path, ct->root_path, NULL, MS_BIND | MS_REC, NULL) == -1)		return -1;	if (chdir(ct->root_path))		return -1;	if (mkdtemp(put_root) == NULL)		return -1;	if (pivot_root(".", put_root)) {		rmdir(put_root);		return -1;	}	if (umount2(put_root, MNT_DETACH))		return -1;	rmdir(put_root);	return 0;}
开发者ID:mkatkar,项目名称:libct,代码行数:33,


示例11: menu

int CNFSSmallMenu::exec( CMenuTarget* parent, const std::string & actionKey ){	if (actionKey.empty())	{		CMenuWidget menu(LOCALE_NETWORKMENU_MOUNT, NEUTRINO_ICON_STREAMING);		CNFSMountGui mountGui;		CNFSUmountGui umountGui;		CMenuForwarder *remount_fwd = new CMenuForwarder(LOCALE_NFS_REMOUNT, true, NULL, this, "remount");		remount_fwd->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);		menu.addIntroItems();		menu.addItem(remount_fwd);		menu.addItem(new CMenuForwarder(LOCALE_NFS_MOUNT , true, NULL, & mountGui));		menu.addItem(new CMenuForwarder(LOCALE_NFS_UMOUNT, true, NULL, &umountGui));		return menu.exec(parent, actionKey);	}	else if(actionKey.substr(0,7) == "remount")	{		//umount automount dirs		for(int i = 0; i < NETWORK_NFS_NR_OF_ENTRIES; i++)		{			if(g_settings.network_nfs_automount[i])				umount2(g_settings.network_nfs_local_dir[i],MNT_FORCE);		}		CFSMounter::automount();		return menu_return::RETURN_REPAINT;	}	return menu_return::RETURN_REPAINT;}
开发者ID:silid,项目名称:tuxbox-cvs-apps,代码行数:28,


示例12: do_unmount

static int do_unmount(const char* mountpoint, int flags) {#if defined(__linux__) || defined(__sun__)    return umount2(mountpoint, flags);#else    return unmount(mountpoint, flags);#endif}
开发者ID:unsound,项目名称:jfuse,代码行数:7,


示例13: sc_do_umount

void sc_do_umount(const char *target, int flags){	char buf[10000] = { 0 };	const char *umount_cmd = NULL;	if (sc_is_debug_enabled()) {#ifdef SNAP_CONFINE_DEBUG_BUILD		umount_cmd = sc_umount_cmd(buf, sizeof(buf), target, flags);#else		umount_cmd = use_debug_build;#endif		debug("performing operation: %s", umount_cmd);	}	if (sc_faulty("umount", NULL) || umount2(target, flags) < 0) {		// Save errno as ensure can clobber it.		int saved_errno = errno;		// Drop privileges so that we can compute our nice error message		// without risking an attack on one of the string functions there.		sc_privs_drop();		// Compute the equivalent umount command.		umount_cmd = sc_umount_cmd(buf, sizeof(buf), target, flags);		// Restore errno and die.		errno = saved_errno;		die("cannot perform operation: %s", umount_cmd);	}}
开发者ID:jdstrand,项目名称:snapd,代码行数:28,


示例14: umount_and_exec

static int umount_and_exec(char **argv) {	char *mountpoint = argv[0];	char *cmd        = argv[1];	if (unshare(CLONE_NEWNS) == -1) {		if(!(flags&QUIET))			fprintf(stderr, "Cannot unshare(CLONE_NEWNS): %s (errno: %i)/n", strerror(errno), errno);		return errno;	}	if(mountpoint == NULL)		return EINVAL;	if(umount2(mountpoint, MNT_DETACH)) {		if(!(flags&QUIET))			fprintf(stderr, "Cannot umount2(/"%s/", MNT_DETACH) in the new namespace: %s (errno: %i)/n", mountpoint, strerror(errno), errno);		return errno;	}	if(cmd == NULL) {		char *argv_exec[2] = { NULL };		cmd = getenv("SHELL");		argv_exec[1] = cmd;		return my_execvp(cmd, argv_exec);	}	char **argv_exec = &argv[1];	return my_execvp(cmd, argv_exec);}
开发者ID:mephi-ut,项目名称:bypassmount,代码行数:29,


示例15: umount_if_needed

int umount_if_needed(char *sourcedir){	FILE *fp;	char line[PATH_MAX];	char *dev = NULL;	char *realdir;	int i;	realdir = g_strdup_printf("%s/%s", TARGETDIR, sourcedir);	if ((fp = fopen("/proc/mounts", "r")) == NULL) {		perror(_("Could not open output file for writing"));		return(1);	}	while(!feof(fp))	{		if(fgets(line, PATH_MAX, fp) == NULL)			break;		if(strstr(line, realdir))		{			for(i=0;i<strlen(line);i++)				if(line[i]==' ')					line[i]='/0';			dev = strdup(line);		}	}	fclose(fp);	if(dev != NULL)		return (umount2(dev,0));	return(0);}
开发者ID:frugalware,项目名称:fwife,代码行数:31,


示例16: main

int main(int argc, char **argv){	int fd, ret = 1;	char buf[1024], fname[PATH_MAX];	test_init(argc, argv);	mkdir(dirname, 0700);	if (mount("none", dirname, "tmpfs", MS_RDONLY, "") < 0) {		fail("Can't mount tmpfs");		return 1;	}	snprintf(fname, sizeof(buf), "%s/test.file", dirname);	test_daemon();	test_waitsig();	fd = open(fname, O_RDWR | O_CREAT, 0777);	if (fd >= 0 || errno != EROFS) {		pr_perror("open failed -> %d", fd);		goto err;	}	pass();	ret = 0;err:	umount2(dirname, MNT_DETACH);	rmdir(dirname);	return ret;}
开发者ID:0x7f454c46,项目名称:criu,代码行数:32,


示例17: __pumount

int__pumount(char *mntdir, int mntflags, char *looped_file){  int my_mntflags = 0;  if ((mntflags & PUMOUNT_FORCE) != 0)    my_mntflags |= MNT_FORCE;  if (umount2(mntdir, my_mntflags) == -1)    return -1;#ifdef USE_LOOP  if (looped_file != NULL)  {    verbose("%s: pumount claims the loop is %s/n", __func__, looped_file);    if (__clrloop(looped_file) == -1)      return -1;  }  else  {    verbose("%s: pumount claims there is no such loop./n", __func__);  }#endif  errno = 0;  return 0;}
开发者ID:guillemj,项目名称:libpmount,代码行数:26,


示例18: term_handler

static voidterm_handler (int sig){	int ret = 0;	if (unlink (TMPFS_PATH "/kmsg") < 0)		ret = 1;	if (umount2 (PROC_PATH, MNT_DETACH) < 0)		ret = 1;	if (umount2 (TMPFS_PATH, MNT_DETACH) < 0)		ret = 1;	_exit(ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);}
开发者ID:Max-E,项目名称:bootchart,代码行数:16,


示例19: container_unmount_oldroot

static void container_unmount_oldroot(char *path){	FILE *mtab;	struct mntent *mnt;	char *mntlist[128];	int i;	int n = 0;	char *filesys;	mtab = setmntent("/proc/mounts", "r");	if (mtab == NULL) {		fprintf(stderr, "cannot open /proc/mount");		return;	}	while (n < 128 && (mnt = getmntent(mtab))) {		if (strncmp(mnt->mnt_dir, path, strlen(path)))			continue;		mntlist[n++] = strdup(mnt->mnt_dir);	}	endmntent(mtab);	for (i = n - 1; i >= 0; i--) {		filesys = mntlist[i];		fprintf(stdout, "umount %s/n", filesys);		if (umount(mntlist[i]) < 0 && umount2(mntlist[i],			   MNT_DETACH) < 0) {			fprintf(stdout, "umount %s: %s failed/n",				filesys, strerror(errno));		}	}}
开发者ID:Crazykev,项目名称:hyperstart,代码行数:33,


示例20: rwnetns_mount_bind_resolv_conf

/** * This function is called whenever the process wants to override it's default resolv.conf with a custom one. * @param[in] A new resolv.conf file to override the existing resolv.conf in this process * @return 0 if success * @return errno if failed */int rwnetns_mount_bind_resolv_conf(const char *new_resolv_conf_path){  int fd = open(new_resolv_conf_path, O_RDONLY, 0);  int ret = 0;    if (fd < 0) {    return errno;  }  close(fd);  // Make sure any future mounts do not affect any other process.  if (unshare(CLONE_NEWNS) < 0) {      return errno;  }  // Make sure the resolv.conf mount does not propogate upwards  if (mount("", "/", "none", MS_SLAVE | MS_REC, NULL) < 0) {      return errno;  }  if (mount(new_resolv_conf_path, RESOLV_CONF_PATH, "none", MS_BIND, NULL) < 0) {    ret = errno;    umount2(RESOLV_CONF_PATH, MNT_DETACH);    return ret;  }  return 0;}
开发者ID:RIFTIO,项目名称:RIFT.ware,代码行数:35,


示例21: netns_exec

static int netns_exec(int argc, char **argv){	/* Setup the proper environment for apps that are not netns	 * aware, and execute a program in that environment.	 */	const char *name, *cmd;	char net_path[MAXPATHLEN];	int netns;	if (argc < 1) {		fprintf(stderr, "No netns name specified/n");		return EXIT_FAILURE;	}	if (argc < 2) {		fprintf(stderr, "No command specified/n");		return EXIT_FAILURE;	}	name = argv[0];	cmd = argv[1];	snprintf(net_path, sizeof(net_path), "%s/%s", NETNS_RUN_DIR, name);	netns = open(net_path, O_RDONLY);	if (netns < 0) {		fprintf(stderr, "Cannot open network namespace /"%s/": %s/n",			name, strerror(errno));		return EXIT_FAILURE;	}	if (setns(netns, CLONE_NEWNET) < 0) {		fprintf(stderr, "seting the network namespace /"%s/" failed: %s/n",			name, strerror(errno));		return EXIT_FAILURE;	}	if (unshare(CLONE_NEWNS) < 0) {		fprintf(stderr, "unshare failed: %s/n", strerror(errno));		return EXIT_FAILURE;	}	/* Don't let any mounts propogate back to the parent */	if (mount("", "/", "none", MS_SLAVE | MS_REC, NULL)) {		fprintf(stderr, "/"mount --make-rslave //" failed: %s/n",			strerror(errno));		return EXIT_FAILURE;	}	/* Mount a version of /sys that describes the network namespace */	if (umount2("/sys", MNT_DETACH) < 0) {		fprintf(stderr, "umount of /sys failed: %s/n", strerror(errno));		return EXIT_FAILURE;	}	if (mount(name, "/sys", "sysfs", 0, NULL) < 0) {		fprintf(stderr, "mount of /sys failed: %s/n",strerror(errno));		return EXIT_FAILURE;	}	/* Setup bind mounts for config files in /etc */	bind_etc(name);	if (execvp(cmd, argv + 1)  < 0)		fprintf(stderr, "exec of /"%s/" failed: %s/n",			cmd, strerror(errno));	return EXIT_FAILURE;}
开发者ID:Azzik,项目名称:iproute2,代码行数:60,


示例22: fuse_setup

static int fuse_setup(struct fuse* fuse, gid_t gid, mode_t mask) {    char opts[256];    fuse->fd = TEMP_FAILURE_RETRY(open("/dev/fuse", O_RDWR | O_CLOEXEC));    if (fuse->fd == -1) {        PLOG(ERROR) << "failed to open fuse device";        return -1;    }    umount2(fuse->dest_path, MNT_DETACH);    snprintf(opts, sizeof(opts),            "fd=%i,rootmode=40000,default_permissions,allow_other,user_id=%d,group_id=%d",            fuse->fd, fuse->global->uid, fuse->global->gid);    if (mount("/dev/fuse", fuse->dest_path, "fuse", MS_NOSUID | MS_NODEV | MS_NOEXEC | MS_NOATIME,              opts) == -1) {        PLOG(ERROR) << "failed to mount fuse filesystem";        return -1;    }    fuse->gid = gid;    fuse->mask = mask;    return 0;}
开发者ID:darkLord19,项目名称:system-core,代码行数:25,


示例23: unmount_and_fsck

static void unmount_and_fsck(const struct mntent *entry) {    if (strcmp(entry->mnt_type, "f2fs") && strcmp(entry->mnt_type, "ext4"))        return;    /* First, lazily unmount the directory. This unmount request finishes when     * all processes that open a file or directory in |entry->mnt_dir| exit.     */    TEMP_FAILURE_RETRY(umount2(entry->mnt_dir, MNT_DETACH));    /* Next, kill all processes except init, kthreadd, and kthreadd's     * children to finish the lazy unmount. Killing all processes here is okay     * because this callback function is only called right before reboot().     * It might be cleaner to selectively kill processes that actually use     * |entry->mnt_dir| rather than killing all, probably by reusing a function     * like killProcessesWithOpenFiles() in vold/, but the selinux policy does     * not allow init to scan /proc/<pid> files which the utility function     * heavily relies on. The policy does not allow the process to execute     * killall/pkill binaries either. Note that some processes might     * automatically restart after kill(), but that is not really a problem     * because |entry->mnt_dir| is no longer visible to such new processes.     */    ServiceManager::GetInstance().ForEachService([] (Service* s) { s->Stop(); });    TEMP_FAILURE_RETRY(kill(-1, SIGKILL));    int count = 0;    while (count++ < UNMOUNT_CHECK_TIMES) {        int fd = TEMP_FAILURE_RETRY(open(entry->mnt_fsname, O_RDONLY | O_EXCL));        if (fd >= 0) {            /* |entry->mnt_dir| has sucessfully been unmounted. */            close(fd);            break;        } else if (errno == EBUSY) {            /* Some processes using |entry->mnt_dir| are still alive. Wait for a             * while then retry.             */            TEMP_FAILURE_RETRY(                usleep(UNMOUNT_CHECK_MS * 1000 / UNMOUNT_CHECK_TIMES));            continue;        } else {            /* Cannot open the device. Give up. */            return;        }    }    int st;    if (!strcmp(entry->mnt_type, "f2fs")) {        const char *f2fs_argv[] = {            "/system/bin/fsck.f2fs", "-f", entry->mnt_fsname,        };        android_fork_execvp_ext(ARRAY_SIZE(f2fs_argv), (char **)f2fs_argv,                                &st, true, LOG_KLOG, true, NULL, NULL, 0);    } else if (!strcmp(entry->mnt_type, "ext4")) {        const char *ext4_argv[] = {            "/system/bin/e2fsck", "-f", "-y", entry->mnt_fsname,        };        android_fork_execvp_ext(ARRAY_SIZE(ext4_argv), (char **)ext4_argv,                                &st, true, LOG_KLOG, true, NULL, NULL, 0);    }}
开发者ID:muli547,项目名称:platform_system_core,代码行数:59,


示例24: generic_umount

int generic_umount(char *mntbuf){    if (!mntbuf)    {   errprintf("invalid param: mntbuf is null/n");        return -1;    }    msgprintf(MSG_DEBUG1, "unmount_partition(%s)/n", mntbuf);    return umount2(mntbuf, 0);}
开发者ID:DieterBaum,项目名称:qt-fasarchiver,代码行数:9,


示例25: umount_if_mounted

static bool umount_if_mounted(void){	if (umount2(basedir, MNT_DETACH) < 0 && errno != EINVAL) {		fprintf(stderr, "failed to umount %s: %s/n", basedir,			strerror(errno));		return false;	}	return true;}
开发者ID:Blub,项目名称:lxcfs,代码行数:9,


示例26: do_unmount

static int do_unmount(const char *mnt, int quiet, int lazy){    int res = umount2(mnt, lazy ? 2 : 0);    if (res == -1) {        if (!quiet)            fprintf(stderr, "%s: failed to unmount %s: %s/n",                    progname, mnt, strerror(errno));    }    return res;}
开发者ID:rolivia,项目名称:OS-Project,代码行数:10,


示例27: ui_umount

int ui_umount(const char * mnt) {  int rc;  if((rc = umount2(mnt, MNT_DETACH)) != 0) {    fprintf(stderr, "Failed to unmount %s./n", mnt);    fprintf(stderr, "Error (%d) %s/n", errno, strerror(errno));  }  return rc;}
开发者ID:alexchamberlain,项目名称:piimg,代码行数:10,


示例28: netns_exec

static int netns_exec(int argc, char **argv){	/* Setup the proper environment for apps that are not netns	 * aware, and execute a program in that environment.	 */	const char *name, *cmd;	char net_path[MAXPATHLEN];	int netns;	if (argc < 1) {		fprintf(stderr, "No netns name specified/n");		return -1;	}	if (argc < 2) {		fprintf(stderr, "No cmd specified/n");		return -1;	}	name = argv[0];	cmd = argv[1];	snprintf(net_path, sizeof(net_path), "%s/%s", NETNS_RUN_DIR, name);	netns = open(net_path, O_RDONLY);	if (netns < 0) {		fprintf(stderr, "Cannot open network namespace: %s/n",			strerror(errno));		return -1;	}	if (setns(netns, CLONE_NEWNET) < 0) {		fprintf(stderr, "seting the network namespace failed: %s/n",			strerror(errno));		return -1;	}/*	if (unshare(CLONE_NEWNS) < 0) {		fprintf(stderr, "unshare failed: %s/n", strerror(errno));		return -1;	}*/	/* Mount a version of /sys that describes the network namespace */	if (umount2("/sys", MNT_DETACH) < 0) {		fprintf(stderr, "umount of /sys failed: %s/n", strerror(errno));		return -1;	}	if (mount(name, "/sys", "sysfs", 0, NULL) < 0) {		fprintf(stderr, "mount of /sys failed: %s/n",strerror(errno));		return -1;	}	/* Setup bind mounts for config files in /etc */	bind_etc(name);	if (execvp(cmd, argv + 1)  < 0)		fprintf(stderr, "exec of %s failed: %s/n",			cmd, strerror(errno));	exit(-1);}
开发者ID:Tuccro,项目名称:LightVPN,代码行数:55,


示例29: lxc_attach_remount_sys_proc

int lxc_attach_remount_sys_proc(){	int ret;	ret = unshare(CLONE_NEWNS);	if (ret < 0) {		SYSERROR("failed to unshare mount namespace");		return -1;	}	/* assume /proc is always mounted, so remount it */	ret = umount2("/proc", MNT_DETACH);	if (ret < 0) {		SYSERROR("failed to unmount /proc");		return -1;	}	ret = mount("none", "/proc", "proc", 0, NULL);	if (ret < 0) {		SYSERROR("failed to remount /proc");		return -1;	}	/* try to umount /sys - if it's not a mount point,	 * we'll get EINVAL, then we ignore it because it	 * may not have been mounted in the first place	 */	ret = umount2("/sys", MNT_DETACH);	if (ret < 0 && errno != EINVAL) {		SYSERROR("failed to unmount /sys");		return -1;	} else if (ret == 0) {		/* remount it */		ret = mount("none", "/sys", "sysfs", 0, NULL);		if (ret < 0) {			SYSERROR("failed to remount /sys");			return -1;		}	}	return 0;}
开发者ID:ArikaChen,项目名称:lxc,代码行数:42,



注:本文中的umount2函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ umove函数代码示例
C++ umount函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。