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

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

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

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

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

示例1: getObjectFlagMax

void SceneObject::unpackUpdate( NetConnection* conn, BitStream* stream ){   Parent::unpackUpdate( conn, stream );      // Rare updates   if ( stream->readFlag() )      	{      stream->read(&mCollisionMask);      mObjectFlags = stream->readRangedU32( 0, getObjectFlagMax() );      ColorI defaultColor;      for(U32 i = 0; i < Palette::NumSlots; i++)      {         if(stream->readFlag())            stream->read(&mPalette.colors[i]);         else            mPalette.colors[i] = Palette::defaultColor;		}	}   // Flicker time   if ( stream->readFlag() )         stream->read(&mFlickerTime);   // MountedMask   if ( stream->readFlag() )    {      if ( stream->readFlag() )       {         S32 gIndex = stream->readInt( NetConnection::GhostIdBitSize );         SceneObject* obj = dynamic_cast<SceneObject*>( conn->resolveGhost( gIndex ) );         S32 node = -1;         if ( stream->readFlag() ) // node != -1            node = stream->readInt( NumMountPointBits );         MatrixF xfm;         mathRead( *stream, &xfm );         if ( !obj )         {            conn->setLastError( "Invalid packet from server." );            return;         }         obj->mountObject( this, node, xfm );      }      else         unmount();   }}
开发者ID:mray,项目名称:terminal-overload,代码行数:47,


示例2: unmount_all

/*===========================================================================* *				unmount_all				     * *===========================================================================*/PRIVATE void unmount_all(void){/* Unmount all filesystems.  File systems are mounted on other file systems, * so you have to pull off the loose bits repeatedly to get it all undone. */  int i;  for (i= 0; i < NR_MNTS; i++) {  	struct vmnt *vmp;	/* Unmount at least one. */	for (vmp = &vmnt[0]; vmp < &vmnt[NR_MNTS]; vmp++) {		if (vmp->m_dev != NO_DEV) 			unmount(vmp->m_dev, NULL);	}  }}
开发者ID:mwilbur,项目名称:minix,代码行数:20,


示例3: gf_fuse_unmount

voidgf_fuse_unmount(const char *mountpoint, int fd){    int ret;    struct stat sbuf;    char dev[128];    char resolved_path[PATH_MAX];    char *ep, *rp = NULL;    unsigned int hs_complete = 0;    ret = ioctl(fd, FUSEDEVIOCGETHANDSHAKECOMPLETE, &hs_complete);    if (ret || !hs_complete) {        return;    }    /* XXX does this have any use here? */    ret = ioctl(fd,  FUSEDEVIOCSETDAEMONDEAD, &fd);    if (ret) {        return;    }    if (fstat(fd, &sbuf) == -1) {        return;    }    devname_r(sbuf.st_rdev, S_IFCHR, dev, 128);    if (strncmp(dev, MACFUSE_DEVICE_BASENAME,                sizeof(MACFUSE_DEVICE_BASENAME) - 1)) {        return;    }    strtol(dev + 4, &ep, 10);    if (*ep != '/0') {        return;    }    rp = realpath(mountpoint, resolved_path);    if (rp) {        ret = unmount(resolved_path, 0);    }    close(fd);    return;}
开发者ID:Kaushikbv,项目名称:glusterfs,代码行数:46,


示例4: umount2_fs

/* force unmount, no questions asked, without touching mnttab file */intumount2_fs(const char *mntdir, u_int unmount_flags){  int error = 0;  if (unmount_flags & AMU_UMOUNT_FORCE) {    plog(XLOG_INFO, "umount2_fs: trying unmount/forced on %s", mntdir);    error = unmount(mntdir, MNT2_GEN_OPT_FORCE);    if (error < 0 && (errno == EINVAL || errno == ENOENT))      error = 0;		/* ignore EINVAL/ENOENT */    if (error < 0)      plog(XLOG_WARNING, "%s: unmount/force: %m", mntdir);    else      dlog("%s: unmount/force: OK", mntdir);  }  return error;}
开发者ID:raven-au,项目名称:am-utils-6.1,代码行数:18,


示例5: umount_fs

intumount_fs(char *mntdir, const char *mnttabname, u_int unmount_flags){  int error;eintr:  error = unmount(mntdir, 0);  if (error < 0)    error = errno;  switch (error) {  case EINVAL:  case ENOTBLK:  case ENOENT:    plog(XLOG_WARNING, "unmount: %s is not mounted", mntdir);    error = 0;			/* Not really an error */    break;  case EINTR:    /* not sure why this happens, but it does.  ask kirk one day... */    dlog("%s: unmount: %m", mntdir);    goto eintr;#ifdef MNT2_GEN_OPT_FORCE  case EBUSY:  case EIO:  case ESTALE:    /* caller determines if forced unmounts should be used */    if (unmount_flags & AMU_UMOUNT_FORCE) {      error = umount2_fs(mntdir, unmount_flags);      if (error < 0)	error = errno;      else	return error;    }    /* fallthrough */#endif /* MNT2_GEN_OPT_FORCE */  default:    dlog("%s: unmount: %m", mntdir);    break;  }  return error;}
开发者ID:raven-au,项目名称:am-utils-6.1,代码行数:45,


示例6: mountpoints_unmount

static void mountpoints_unmount(void){	for ( size_t n = mountpoints_used; n != 0; n-- )	{		size_t i = n - 1;		struct mountpoint* mountpoint = &mountpoints[i];		if ( mountpoint->pid < 0 )			continue;		if ( unmount(mountpoint->absolute, 0) < 0 && errno != ENOMOUNT )			warning("unmount: %s: %m", mountpoint->entry.fs_file);		else if ( errno == ENOMOUNT )			kill(mountpoint->pid, SIGQUIT);		int code;		if ( waitpid(mountpoint->pid, &code, 0) < 0 )			note("waitpid: %m");		mountpoint->pid = -1;	}}
开发者ID:amanuel2,项目名称:IMPORTED_OS_MIRROR,代码行数:18,


示例7: test_create_file_system

static void test_create_file_system(void){  int rv;  rv = mkdir(mnt, S_IRWXU | S_IRWXG | S_IRWXO);  rtems_test_assert(rv == 0);  rv = rtems_rfs_format(rda, &rfs_config);  rtems_test_assert(rv == 0);  test_mount(true);  rv = mknod(file, S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO, 0);  rtems_test_assert(rv == 0);  rv = unmount(mnt);  rtems_test_assert(rv == 0);}
开发者ID:Avanznow,项目名称:rtems,代码行数:18,


示例8: main

intmain (int argc, char *argv[]){  GOptionContext *context;  GError *error;  GFile *file;    setlocale (LC_ALL, "");  g_type_init ();    error = NULL;  context = g_option_context_new ("- mount <location>");  g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);  g_option_context_parse (context, &argc, &argv, &error);  g_option_context_free (context);  main_loop = g_main_loop_new (NULL, FALSE);    if (mount_list)    list_monitor_items ();  else if (unmount_scheme != NULL)    {      unmount_all_with_scheme (unmount_scheme);    }  else if (argc > 1)    {      int i;            for (i = 1; i < argc; i++) {	file = g_file_new_for_commandline_arg (argv[i]);	if (mount_unmount)	  unmount (file);	else	  mount (file);	g_object_unref (file);      }    }    if (outstanding_mounts > 0)    g_main_loop_run (main_loop);    return 0;}
开发者ID:afilmore,项目名称:libfmcore,代码行数:44,


示例9: SysAddDiskPrefs

void SysAddDiskPrefs(void){	// Let BeOS scan for HFS drives	D(bug("Looking for Mac volumes.../n"));	system("mountvolume -allhfs");	// Add all HFS volumes	int32 i = 0;	dev_t d;	fs_info info;	while ((d = next_dev(&i)) >= 0) {		fs_stat_dev(d, &info);		status_t err = -1;		BPath mount;		if (!strcmp(info.fsh_name, "hfs")) {			BDirectory dir;			BEntry entry;			node_ref node;			node.device = info.dev;			node.node = info.root;			err = dir.SetTo(&node);			if (!err)				err = dir.GetEntry(&entry);			if (!err)				err = entry.GetPath(&mount);		}#warning TODO: unmount inuse disk!#if 0		if (!err)			err = unmount(mount.Path());#endif		if (!err) {			char dev_name[B_FILE_NAME_LENGTH];			if (info.flags & B_FS_IS_READONLY) {				dev_name[0] = '*';				dev_name[1] = 0;			} else				dev_name[0] = 0;			strcat(dev_name, info.device_name);			PrefsAddString("disk", dev_name);		}	}}
开发者ID:Na1w,项目名称:sheepshear,代码行数:43,


示例10: unmount_and_close_device

static void unmount_and_close_device( void ){  int                     rc;  rtems_resource_snapshot now;  bool                    are_resources_freed;  delete_folder_tree( MOUNT_DIR );  rc = unmount( MOUNT_DIR );  rtems_test_assert( rc == 0 );  are_resources_freed = rtems_resource_snapshot_check( &before_mount );  if ( !are_resources_freed )    rtems_resource_snapshot_take( &now );  rtems_test_assert( are_resources_freed );}
开发者ID:chch1028,项目名称:rtems,代码行数:19,


示例11: LFS_INFO

int LittleFileSystem::reformat(BlockDevice *bd){    _mutex.lock();    LFS_INFO("reformat(%p)", bd);    if (_bd) {        if (!bd) {            bd = _bd;        }        int err = unmount();        if (err) {            LFS_INFO("reformat -> %d", err);            _mutex.unlock();            return err;        }    }    if (!bd) {        LFS_INFO("reformat -> %d", -ENODEV);        _mutex.unlock();        return -ENODEV;    }    int err = LittleFileSystem::format(bd,            _read_size, _prog_size, _block_size, _lookahead);    if (err) {        LFS_INFO("reformat -> %d", err);        _mutex.unlock();        return err;    }    err = mount(bd);    if (err) {        LFS_INFO("reformat -> %d", err);        _mutex.unlock();        return err;    }    LFS_INFO("reformat -> %d", 0);    _mutex.unlock();    return 0;}
开发者ID:mazimkhan,项目名称:mbed-os,代码行数:42,


示例12: main

int main(int argc, char **argv) {		if (argc == 3) {				mount(argv[1]);				if (mi_unlink(argv[2]) < 0) {			printf("ERROR (mi_rm.c): Fallo al ejecutar mi_unlink(%s)./n", argv[2]);			return (-1);		}				unmount(argv[1]);		}	else {		printf("Error en los parámetros de mi_rm/n");	}		return (0);}
开发者ID:alvaromb,项目名称:Lemonfs,代码行数:20,


示例13: ck_remove_tmpfs

gbooleanck_remove_tmpfs (guint uid, const gchar *dest){#ifdef HAVE_SYS_MOUNT_H        int           result;        TRACE ();        result = unmount(dest, 0);        if (result == 0) {                return TRUE;        }        g_info ("Failed to unmount tmpfs mount, reason was: %s", strerror(errno));        errno = 0;#endif        return FALSE;}
开发者ID:ifzz,项目名称:consolekit,代码行数:20,


示例14: do_unmount

staticvoiddo_unmount(const atf::fs::path& in_path){    // At least, FreeBSD's unmount(2) requires the path to be absolute.    // Let's make it absolute in all cases just to be safe that this does    // not affect other systems.    const atf::fs::path& abs_path = in_path.is_absolute() ?        in_path : in_path.to_absolute();#if defined(HAVE_UNMOUNT)    int retries = max_retries;retry_unmount:    if (unmount(abs_path.c_str(), 0) == -1) {        if (errno == EBUSY && retries > 0) {            retries--;            ::sleep(retry_delay_in_seconds);            goto retry_unmount;        } else {            throw atf::system_error(IMPL_NAME "::cleanup(" + in_path.str() +                                    ")", "unmount(2) failed", errno);        }    }#else    // We could use umount(2) instead if it was available... but    // trying to do so under, e.g. Linux, is a nightmare because we    // also have to update /etc/mtab to match what we did.  It is    // satf::fser to just leave the system-specific umount(8) tool deal    // with it, at least for now.    const atf::fs::path prog("umount");    atf::process::argv_array argv("umount", abs_path.c_str(), NULL);    atf::process::status s = atf::process::exec(prog, argv,        atf::process::stream_inherit(), atf::process::stream_inherit());    if (!s.exited() || s.exitstatus() != EXIT_SUCCESS)        throw std::runtime_error("Call to unmount failed");#endif}
开发者ID:Backspace7,项目名称:minix,代码行数:39,


示例15: test

static void test(void){  int rv;  const void *data = NULL;  rv = mkdir(mnt, S_IRWXU | S_IRWXG | S_IRWXO);  rtems_test_assert(rv == 0);  rv = rtems_rfs_format(device, &rfs_config);  rtems_test_assert(rv == 0);  rv = mount(    device,    mnt,    RTEMS_FILESYSTEM_TYPE_RFS,    RTEMS_FILESYSTEM_READ_WRITE,    data  );  rtems_test_assert(rv == 0);  rv = mknod(file, S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO, 0);  rtems_test_assert(rv == 0);  rv = unmount(mnt);  rtems_test_assert(rv == 0);  test_file_system_with_handler(    0,    device,    mnt,    &test_rfs_handler,    NULL  );  flashdisk_print_status(device);}
开发者ID:chch1028,项目名称:rtems,代码行数:36,


示例16: unmount

void Player::set_mount(SuperObject* m, fvec3 rwc) {    if (!m) {        unmount();        return;    }    if (mount) {        // unmount first        mount->remove_entity(this);    }    printf_fvec3(get_world_pos());    printf("/n");    mount = m;    // no moving around while mounted!    velocity = fvec3(0, 0, 0);    // TODO this is hack fix    this->set_pos(rwc - get_center_offset());    mount->add_entity(this);    //m->transform_into_my_coordinates_smooth(&offset_to_mount, pos.x, pos.y, pos.z);    //set_pos(pos - this->center_pos);    can_collide = false;    printf_fvec3(get_world_pos());        toggle_mount(true);}
开发者ID:ericandoh,项目名称:Bawk,代码行数:24,


示例17: transition_machine

inttransition_machine(){    int i;    while(transition!=DEATH) {        switch(transition) {        case MULTI:            run_multi();            break;        case SINGLE:            run_single();            break;        }    }    syslog(LOG_EMERG,"Killing all existing sessions...");    /* Kill all sessions */    kill(-1,SIGKILL);    /* Be nice and wait for them */    while(waitpid(-1,(int *)0,WNOHANG|WUNTRACED)>0) continue;    unmount("/",0);    reboot(RB_AUTOBOOT);    /* NOTREACHED */}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:24,


示例18: rtems_shell_main_unmount

static int rtems_shell_main_unmount(  int   argc,  char *argv[]){  char* mount_point = NULL;  int   arg;  for (arg = 1; arg < argc; arg++) {    if (!mount_point)      mount_point = argv[arg];    else {      fprintf (stderr, "error: only one mount path require: %s/n", argv[arg]);      return 1;    }  }  if (!mount_point) {    fprintf (stderr, "error: no mount point/n");    return 1;  }  /*   * Unmount the disk.   */  if (unmount (mount_point) < 0) {    fprintf (stderr, "error: unmount failed: %s: %s/n",             mount_point, strerror (errno));    return 1;  }  printf ("unmounted %s/n", mount_point);  return 0;}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:36,


示例19: test_file_creation

static void test_file_creation(  const char    *dev_name,  const char    *mount_dir,  const uint32_t number_of_files ){  int      rv;  uint32_t file_idx;  char     file_name[MAX_PATH_LENGTH + 1];  rv = mount( dev_name,              mount_dir,              RTEMS_FILESYSTEM_TYPE_DOSFS,              RTEMS_FILESYSTEM_READ_WRITE,              NULL );  rtems_test_assert( 0 == rv );  for ( file_idx = 0; file_idx < number_of_files; ++file_idx ) {    test_create_file( mount_dir, file_idx, true );  }  test_create_file( mount_dir, file_idx, false );  for ( file_idx = 0; file_idx < number_of_files; ++file_idx ) {    snprintf( file_name,              MAX_PATH_LENGTH,              "%s/file%" PRIu32 ".txt",              mount_dir,              file_idx );    rv = unlink( file_name );    rtems_test_assert( 0 == rv );  }  rv = unmount( mount_dir );  rtems_test_assert( 0 == rv );}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:36,


示例20: main

intmain(int argc, char *argv[]){	char c, *p, *noncanon_mp, *cmd, *path_env, dir[PATH_MAX];	struct pscfs_args args = PSCFS_ARGS_INIT(0, NULL);	struct psc_dynarray startup_cmds = DYNARRAY_INIT;	const char *progpath = argv[0];	int rc, i, unmount_first = 0;	pfl_init();	pscfs_addarg(&args, "");		/* progname/argv[0] */	pscfs_addarg(&args, "-o");	pscfs_addarg(&args, STD_MOUNT_OPTIONS);	p = getenv("CTL_SOCK_FILE");	if (p)		ctlsockfn = p;	while ((c = getopt(argc, argv, "dL:o:S:U")) != -1)		switch (c) {		case 'd':			pscfs_addarg(&args, "-odebug");			break;		case 'L':			psc_dynarray_add(&startup_cmds, optarg);			break;		case 'o':			if (!opt_lookup(optarg)) {				pscfs_addarg(&args, "-o");				pscfs_addarg(&args, optarg);			}			break;		case 'S':			ctlsockfn = optarg;			break;		case 'U':			unmount_first = 1;			break;		default:			usage();		}	argc -= optind;	argv += optind;	if (argc != 1)		usage();	pscthr_init(PFL_THRT_FSMGR, NULL, 0, "fsmgrthr");	noncanon_mp = argv[0];	if (unmount_first)		unmount(noncanon_mp);	/* canonicalize mount path */	if (realpath(noncanon_mp, mountpoint) == NULL)		psc_fatal("realpath %s", noncanon_mp);	pscfs_mount(mountpoint, &args);	pscfs_freeargs(&args);	ctlthr_spawn();	pfl_opstimerthr_spawn(PFL_THRT_OPSTIMER, "opstimerthr");	pfl_workq_init(128, 1024, 1024);	pfl_wkthr_spawn(PFL_THRT_WORKER, 4, 0, "wkthr%d");	pscfs_entry_timeout = 8.;	pscfs_attr_timeout = 8.;	/*	 * Here, $p = (directory this daemon binary resides in).	 * Now we add the following to $PATH:	 *	 *   1) $p	 *   2) $p/../wokctl (for developers)	 */	pfl_dirname(progpath, dir);	p = getenv("PATH");	rc = pfl_asprintf(&path_env, "%s:%s/../wokctl%s%s", dir, dir,	    p ? ":" : "", p ? p : "");	psc_assert(rc != -1);	setenv("PATH", path_env, 1);	/* 	 * If wokctl (see file wokctl.c) misbehaves because it is given  	 * a wrong arugment, it is hard to debug from our end because  	 * we won't be receiving anything useful via the socket. This  	 * should be changed to a native call someday. 	 * 	 * If the client does not come up, double/triple checkout  	 * the name of your slash2 shared library. I wish I can 	 * add more verbose debugging information. 	 */	DYNARRAY_FOREACH(cmd, i, &startup_cmds)		pfl_systemf("wokctl -S %s %s", ctlsockfn, cmd);	exit(pscfs_main(32, ""));}
开发者ID:pscedu,项目名称:slash2-stable,代码行数:98,


示例21: test_compatibility

//.........这里部分代码省略.........  int                       rc;  rtems_status_code         sc;  dev_t                     dev;  char                      diskpath[] = "/dev/ramdisk1";  rtems_dosfs_mount_options mount_opts;  rtems_device_major_number major;  FILE                     *fp;  int                       buffer;  unsigned int              index_file = 0;  unsigned int              index_char;  unsigned int              offset;  char                      content_buf[MAX_NAME_LENGTH + strlen( MOUNT_DIR )                                        + 1];  char                      file_path[MAX_NAME_LENGTH + strlen( MOUNT_DIR )                                      + 1];  DIR                      *dir_stream;  struct dirent            *dp;  mount_opts.converter = rtems_dosfs_create_utf8_converter( "CP850" );  rtems_test_assert( mount_opts.converter != NULL );  sc = rtems_io_register_driver( 0, &ramdisk_ops, &major );  rtems_test_assert( sc == RTEMS_SUCCESSFUL );  dev = rtems_filesystem_make_dev_t( major, 1 );  sc  = rtems_disk_create_phys(    dev,    BLOCK_SIZE,    BLOCK_COUNT,    ramdisk_ioctl,    &disk_image,    diskpath );  rtems_test_assert( sc == RTEMS_SUCCESSFUL );  rc = mount_and_make_target_path(    diskpath,    MOUNT_DIR,    RTEMS_FILESYSTEM_TYPE_DOSFS,    RTEMS_FILESYSTEM_READ_WRITE,    &mount_opts );  rtems_test_assert( rc == 0 );  dir_stream = opendir( MOUNT_DIR );  rtems_test_assert( dir_stream != NULL );  dp = readdir( dir_stream );  rtems_test_assert( dp != NULL );  while ( dp != NULL ) {    index_char = 0;    size_t len = strlen( filenames[index_file] );    if ( filenames[index_file][len - 1] == '.' )      rtems_test_assert( ( len - 1 ) == dp->d_namlen );    else      rtems_test_assert( len == dp->d_namlen );    rtems_test_assert( 0                       == memcmp( &filenames[index_file][0], &dp->d_name[0],                                  dp->d_namlen ) );    snprintf( file_path, sizeof( file_path ), "%s/%s", MOUNT_DIR,              filenames[index_file] );    fp = fopen( file_path, "r" );    rtems_test_assert( fp != NULL );    /* These files should contain their own file names. */    while ( ( buffer = fgetc( fp ) ) != EOF ) {      content_buf[index_char] = buffer;      ++index_char;    }    if ( 0 == strncmp( content_buf, UTF8_BOM, UTF8_BOM_SIZE ) )      offset = UTF8_BOM_SIZE;    else      offset = 0;    rtems_test_assert( 0                       == memcmp( filenames[index_file],                                  &content_buf[offset],                                  index_char - offset ) );    rc = fclose( fp );    rtems_test_assert( rc == 0 );    ++index_file;    dp = readdir( dir_stream );  }  rtems_test_assert( index_file == FILES_FILENAMES_NUMBER_OF );  rc = closedir( dir_stream );  rtems_test_assert( rc == 0 );  rc = unmount( MOUNT_DIR );  rtems_test_assert( rc == 0 );}
开发者ID:chch1028,项目名称:rtems,代码行数:101,


示例22: unmount

FATFileSystem::~FATFileSystem(){    // nop if unmounted    unmount();}
开发者ID:OpenNuvoton,项目名称:mbed,代码行数:5,


示例23: main

intmain(){    void *vptr;    struct iovec iov[6];    vptr = mmap((void *)ADDR, PAGESIZE, PROT_READ | PROT_WRITE,            MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0);    if(vptr == MAP_FAILED)    {        perror("mmap");        exit(EXIT_FAILURE);    }    vptr += OFFSET;    printf("[*] vptr = 0x%.8x/n", (unsigned int)vptr);    memcpy(vptr, kernelcode, (sizeof(kernelcode) - 1));    mkdir(DIRPATH, 0700);    iov[0].iov_base = "fstype";    iov[0].iov_len = strlen(iov[0].iov_base) + 1;        iov[1].iov_base = FSNAME;    iov[1].iov_len = strlen(iov[1].iov_base) + 1;        iov[2].iov_base = "fspath";    iov[2].iov_len = strlen(iov[2].iov_base) + 1;        iov[3].iov_base = DIRPATH;    iov[3].iov_len = strlen(iov[3].iov_base) + 1;    iov[4].iov_base = calloc(BUFSIZE, sizeof(char));    if(iov[4].iov_base == NULL)    {        perror("calloc");        rmdir(DIRPATH);        exit(EXIT_FAILURE);    }    memset(iov[4].iov_base, 0x41, (BUFSIZE - 1));    iov[4].iov_len = BUFSIZE;    iov[5].iov_base = "BBBB";    iov[5].iov_len = strlen(iov[5].iov_base) + 1;    printf("[*] calling nmount()/n");    if(nmount(iov, 6, 0) < 0)    {        perror("nmount");        rmdir(DIRPATH);        exit(EXIT_FAILURE);    }    printf("[*] unmounting and deleting %s/n", DIRPATH);    unmount(DIRPATH, 0);    rmdir(DIRPATH);    return EXIT_SUCCESS;}
开发者ID:BuddhaLabs,项目名称:PacketStorm-Exploits,代码行数:64,


示例24: procexec

voidprocexec(Channel *pidc, char *prog, char *args[]){	int n;	Proc *p;	Thread *t;	_threaddebug(DBGEXEC, "procexec %s", prog);	/* must be only thread in proc */	p = _threadgetproc();	t = p->thread;	if(p->threads.head != t || p->threads.head->nextt != nil){		werrstr("not only thread in proc");	Bad:		if(pidc)			sendul(pidc, ~0);		return;	}	/*	 * We want procexec to behave like exec; if exec succeeds,	 * never return, and if it fails, return with errstr set.	 * Unfortunately, the exec happens in another proc since	 * we have to wait for the exec'ed process to finish.	 * To provide the semantics, we open a pipe with the 	 * write end close-on-exec and hand it to the proc that	 * is doing the exec.  If the exec succeeds, the pipe will	 * close so that our read below fails.  If the exec fails,	 * then the proc doing the exec sends the errstr down the	 * pipe to us.	 */	if(bind("#|", PIPEMNT, MREPL) < 0)		goto Bad;	if((p->exec.fd[0] = open(PIPEMNT "/data", OREAD)) < 0){		unmount(nil, PIPEMNT);		goto Bad;	}	if((p->exec.fd[1] = open(PIPEMNT "/data1", OWRITE|OCEXEC)) < 0){		close(p->exec.fd[0]);		unmount(nil, PIPEMNT);		goto Bad;	}	unmount(nil, PIPEMNT);	/* exec in parallel via the scheduler */	assert(p->needexec==0);	p->exec.prog = prog;	p->exec.args = args;	p->needexec = 1;	_sched();	close(p->exec.fd[1]);	if((n = read(p->exec.fd[0], p->exitstr, ERRMAX-1)) > 0){	/* exec failed */		p->exitstr[n] = '/0';		errstr(p->exitstr, ERRMAX);		close(p->exec.fd[0]);		goto Bad;	}	close(p->exec.fd[0]);	if(pidc)		sendul(pidc, t->ret);	/* wait for exec'ed program, then exit */	_schedexecwait();}
开发者ID:99years,项目名称:plan9,代码行数:66,


示例25: main

//.........这里部分代码省略.........	} else {		/* just the filesystems specified on the command line */		mntbuf = malloc(argc * sizeof(*mntbuf));		if (mntbuf == 0)			err(1, "malloc()");		mntsize = 0;		/* continued in for loop below */	}	/* iterate through specified filesystems */	for (; *argv; argv++) {		if (stat(*argv, &stbuf) < 0) {			if ((mntpt = getmntpt(*argv)) == 0) {				warn("%s", *argv);				rv = 1;				continue;			}		} else if (S_ISCHR(stbuf.st_mode)) {			if ((mntpt = getmntpt(*argv)) == 0) {				mdev.fspec = *argv;				mntpath = strdup("/tmp/df.XXXXXX");				if (mntpath == NULL) {					warn("strdup failed");					rv = 1;					continue;				}				mntpt = mkdtemp(mntpath);				if (mntpt == NULL) {					warn("mkdtemp(/"%s/") failed", mntpath);					rv = 1;					free(mntpath);					continue;				}				if (mount(fstype, mntpt, MNT_RDONLY,				    &mdev) != 0) {					warn("%s", *argv);					rv = 1;					(void)rmdir(mntpt);					free(mntpath);					continue;				} else if (statfs(mntpt, &statfsbuf) == 0) {					statfsbuf.f_mntonname[0] = '/0';					prtstat(&statfsbuf, &maxwidths);					if (cflag)						addstat(&totalbuf, &statfsbuf);				} else {					warn("%s", *argv);					rv = 1;				}				(void)unmount(mntpt, 0);				(void)rmdir(mntpt);				free(mntpath);				continue;			}		} else			mntpt = *argv;		/*		 * Statfs does not take a `wait' flag, so we cannot		 * implement nflag here.		 */		if (statfs(mntpt, &statfsbuf) < 0) {			warn("%s", mntpt);			rv = 1;			continue;		}		/*		 * Check to make sure the arguments we've been given are		 * satisfied.  Return an error if we have been asked to		 * list a mount point that does not match the other args		 * we've been given (-l, -t, etc.).		 */		if (checkvfsname(statfsbuf.f_fstypename, vfslist)) {			rv = 1;			continue;		}		/* the user asked for it, so ignore the ignore flag */		statfsbuf.f_flags &= ~MNT_IGNORE;		/* add to list */		mntbuf[mntsize++] = statfsbuf;	}	bzero(&maxwidths, sizeof(maxwidths));	for (i = 0; i < mntsize; i++) {		if (aflag || (mntbuf[i].f_flags & MNT_IGNORE) == 0) {			update_maxwidths(&maxwidths, &mntbuf[i]);			if (cflag)				addstat(&totalbuf, &mntbuf[i]);		}	}	for (i = 0; i < mntsize; i++)		if (aflag || (mntbuf[i].f_flags & MNT_IGNORE) == 0)			prtstat(&mntbuf[i], &maxwidths);	if (cflag)		prtstat(&totalbuf, &maxwidths);	return (rv);}
开发者ID:grayshadow212,项目名称:usr.src,代码行数:101,


示例26: unmount

//--------------------------------------------------------------------------// Function:	CommonFG::unmount////brief	This is an overloaded member function, provided for convenience.///		It differs from the above function in that it takes an///		/c H5std_string for /a name.// Programmer	Binh-Minh Ribler - 2000//--------------------------------------------------------------------------void CommonFG::unmount( const H5std_string& name ) const{   unmount( name.c_str() );}
开发者ID:ArielleBassanelli,项目名称:gempak,代码行数:11,


示例27: qCDebug

void Mounter::onPakcageReceived(const NetworkPackage& np){    if (np.get<bool>("stop", false))    {        qCDebug(KDECONNECT_PLUGIN_SFTP) << "SFTP server stopped";        unmount();        return;    }    //This is the previous code, to access sftp server using KIO. Now we are    //using the external binary sshfs, and accessing it as a local filesystem.  /*   *    QUrl url;   *    url.setScheme("sftp");   *    url.setHost(np.get<QString>("ip"));   *    url.setPort(np.get<QString>("port").toInt());   *    url.setUserName(np.get<QString>("user"));   *    url.setPassword(np.get<QString>("password"));   *    url.setPath(np.get<QString>("path"));   *    new KRun(url, 0);   *    Q_EMIT mounted();   */    unmount();    m_proc = new KProcess(this);    m_proc->setOutputChannelMode(KProcess::MergedChannels);    connect(m_proc, SIGNAL(started()), SLOT(onStarted()));    connect(m_proc, SIGNAL(error(QProcess::ProcessError)), SLOT(onError(QProcess::ProcessError)));    connect(m_proc, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(onFinished(int,QProcess::ExitStatus)));    QDir().mkpath(m_mountPoint);    const QString program = "sshfs";    QString path;    if (np.has("multiPaths")) path = '/';    else path = np.get<QString>("path");    const QStringList arguments = QStringList()        << QString("%[email
C++ unorm_normalize函数代码示例
C++ unmask_irq函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。