• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pioctl函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: fs_getfilecachestats

int
fs_getfilecachestats(afs_uint32 * max_bytes, afs_uint32 * used_bytes,
		     afs_uint32 * max_vnodes, afs_uint32 * used_vnodes)
{
    afs_uint32 parms[16];
    struct ViceIoctl a_params;

    a_params.in_size = 0;
    a_params.out_size = sizeof(parms);
    a_params.in = NULL;
    a_params.out = (char *)parms;

    memset(parms, 0, sizeof(parms));

    if (pioctl(NULL, VIOCGETCACHEPARAMS, &a_params, 0) == -1)
	return errno;

    /* param[0] and param[1] send maxbytes and usedbytes in kbytes */

    if (max_vnodes)
	*max_vnodes = parms[2];
    if (used_vnodes)
	*used_vnodes = parms[3];
    if (max_bytes)
	*max_bytes = parms[4];
    if (used_bytes)
	*used_bytes = parms[5];

    return 0;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:30,代码来源:fs_lib.c


示例2: LOG1

int CIFVideoNode::stop(bool keepBuffers)
{
    LOG1("@%s: device = %s", __FUNCTION__, mName.string());
    int ret = 0;

    // Always stream off because of driver feature.
    // Driver will only turn JPEG encoding off in the streamoff.
    enum v4l2_buf_type type = mInBufType;
    ret = pioctl(mFd, VIDIOC_STREAMOFF, &type);
    if (ret < 0) {
        LOGE("VIDIOC_STREAMOFF returned: %d (%s)", ret, strerror(errno));
        return ret;
    }
    mState = DEVICE_PREPARED;

    if (mState == DEVICE_PREPARED) {
        if (!keepBuffers) {
            destroyBufferPool();
            mState = DEVICE_CONFIGURED;
        }
   } else {
        LOGW("Trying to stop a device not started");
        ret = -1;
    }

    mBuffersInDevice = 0;

    return ret;
}
开发者ID:yutokt,项目名称:android_vendor_intel,代码行数:29,代码来源:CIFVideoNode.cpp


示例3: debug

static int
debug(int pioctl_cmd, int inflags, int *outflags, char *pathname)
{
    struct ViceIoctl a_params;

    afs_int32 rinflags = inflags;
    afs_int32 routflags;

    if (inflags != -1) {
	a_params.in_size = sizeof(rinflags);
	a_params.in = (char *)&rinflags;
    } else {
	a_params.in_size = 0;
	a_params.in = NULL;
    }

    if (outflags) {
	a_params.out_size = sizeof(routflags);
	a_params.out = (char *)&routflags;
    } else {
	a_params.out_size = 0;
	a_params.out = NULL;
    }

    if (pioctl(pathname, pioctl_cmd, &a_params, 0) == -1)
	return errno;

    if (outflags)
	*outflags = routflags;

    return 0;
}
开发者ID:adeason,项目名称:openafs,代码行数:32,代码来源:fs_lib.c


示例4: NFSUnlog

static int
NFSUnlog(afs_int32 ahost, afs_int32 auid)
{
    afs_int32 code;
    afs_int32 pheader[6];
    char space[1200];
    struct ViceIoctl blob;

    /* otherwise we've got the token, now prepare to build the pioctl args */
    pheader[0] = ahost;
    pheader[1] = auid;
    pheader[2] = 0;		/* group low */
    pheader[3] = 0;		/* group high */
    pheader[4] = 9;		/* unlog pioctl index */
    pheader[5] = 1;		/* NFS protocol exporter # */

    /* copy stuff in */
    memcpy(space, pheader, sizeof(pheader));

    /* finally setup the pioctl call's parameters */
    blob.in_size = sizeof(pheader);
    blob.in = space;
    blob.out_size = 0;
    blob.out = NULL;
    code = pioctl(NULL, _VICEIOCTL(99), &blob, 0);
    if (code) {
	code = errno;
    }
    return code;
}
开发者ID:jblaine,项目名称:openafs,代码行数:30,代码来源:knfs.c


示例5: fhb_fhget

static void
fhb_fhget(char *filename, struct fhb_handle *handle)
{
    int ret = 0;
#if defined(HAVE_GETFH) && defined(HAVE_FHOPEN)
    {
	fhandle_t fh;

	ret = getfh(filename, &fh);
	if (ret)
	    err(1, "getfh");
	memcpy(handle, &fh, sizeof(fh));
    }
#endif
    {
	struct ViceIoctl vice_ioctl;

	vice_ioctl.in = NULL;
	vice_ioctl.in_size = 0;

	vice_ioctl.out = (caddr_t) handle;
	vice_ioctl.out_size = sizeof(*handle);

	ret = pioctl(filename, VIOC_FHGET, &vice_ioctl, 0);
	if (ret)
	    errx(1, "k_pioctl");
    }
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:28,代码来源:fhbench.c


示例6: Config_SetSysName

BOOL Config_SetSysName (LPCTSTR pszName, ULONG *pStatus)
{
    BOOL rc = TRUE;
    ULONG status = 0;

    if (Config_GetServiceState() == SERVICE_RUNNING)
    {
        struct {
            ULONG cbData;
            TCHAR szData[ PIOCTL_MAXSIZE ];
        } InData;
        memset (&InData, 0x00, sizeof(InData));
        USHORT i=0, j=0, len=lstrlen(pszName);
        
        if ( len == 0 ) {
            Message (MB_ICONHAND, GetErrorTitle(), IDS_FAILCONFIG_SYSNAME, TEXT("A sysname must be specified"));
            return(-1);
        }

        while ( pszName[i] ) {
            if ( !isspace(pszName[i]) ) {
                InData.szData[j++] = pszName[i];
            } else if (InData.szData[j-1] != '\0') {
                InData.szData[j++] = '\0';
                InData.cbData++;
            }
            i++;
        }
        InData.szData[j++] = '\0';
        InData.cbData++;      /* one word */

        BYTE OutData[ PIOCTL_MAXSIZE ];
        memset (OutData, 0x00, sizeof(OutData));

        struct ViceIoctl IOInfo;
        IOInfo.in_size = sizeof(ULONG) + j;
        IOInfo.in = (char *)&InData;
        IOInfo.out = (char *)OutData;
        IOInfo.out_size = PIOCTL_MAXSIZE;

        if ((status = pioctl (0, VIOC_AFS_SYSNAME, &IOInfo, 1)) != 0)
        {
            rc = FALSE;
        }
    }

    if (rc)
    {
        Config_WriteGlobalString (TEXT("SysName"), pszName);
    }

    if (pStatus && !rc)
        *pStatus = status;
    if (!rc)
        Message (MB_ICONHAND, GetErrorTitle(), IDS_FAILCONFIG_SYSNAME, TEXT("%ld"), status);
    return rc;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:57,代码来源:config.cpp


示例7: main

int main(int argc, char **argv) 
{
    ViceFid fid;
    char realm[MAXHOSTNAMELEN+1];
    char tmpfname[80];
    int fd;
    struct ViceIoctl vioc;
    char space[2048];
    int rc;

    if (argc != 2) {
	fprintf(stderr, "Usage: %s <inc-file-name>\n", argv[0]);
	exit(-1);
    }
    
    /* make sure object is inconsistent */
    if (!IsObjInc(argv[1], &fid, realm)) {
	fprintf(stderr, "%s isn't inconsistent\n", argv[1]);
	exit(0);
    }
    
    /* get fid and make sure it is a file */
    if (ISDIR(fid) && !FID_IsLocalDir(&fid)) {
	fprintf(stderr, "%s is a directory - must be removed manually\n", argv[1]);
	exit(-1);
    }

    /* create an empty file /tmp/REPAIR.XXXXXX */
    strcpy(tmpfname, "/tmp/RMINC.XXXXXX");
    if ((fd = mkstemp(tmpfname)) < 0) {
	fprintf(stderr, "Couldn't create /tmp file\n");
	exit(-1);
    }
    close(fd);

    /* dorepair on the fid with an empty file */
    vioc.in_size = (short)(1+strlen(tmpfname)); 
    vioc.in = tmpfname;
    vioc.out_size = (short) sizeof(space);
    vioc.out = space;
    memset(space, 0, (int) sizeof(space));
    rc = pioctl(argv[1], _VICEIOCTL(_VIOC_REPAIR), &vioc, 0);
    if (rc < 0 && errno != ETOOMANYREFS) {
	fprintf(stderr, "Error %d for repair\n", errno);
	unlink(tmpfname);
	exit(-1);
    }
    unlink(tmpfname);

    /* remove the repaired file */
    if (unlink(argv[1])) {
	fprintf(stderr, "Couldn't remove %s\n", argv[1]);
	exit(-1);
    }
    exit(0);
}
开发者ID:chutzimir,项目名称:coda,代码行数:56,代码来源:removeinc.c


示例8: afsd_ServicePerformFlushVolumeCmd

/////////////////////////////////////////////////////////////////////
//
// Call routine found in FS.EXE to flush volume.
//
// At entry, input param is UNC string for volume,
// e.g. '\\afs\all\athena.mit.edu\user\m\h\mholiday'
//
// I believe that success from 'pioctl' routine
// indicated by return value of zero (0).
//
afs_int32
afsd_ServicePerformFlushVolumeCmd(char *data)
{
    afs_int32 code;
    struct ViceIoctl blob;

    afsi_log("Flushing Volume \"%s\"",data);
    memset(&blob, '\0', sizeof(blob));
    code = pioctl(data, VIOC_FLUSHVOLUME, &blob, 0);

    return code;
}
开发者ID:bagdxk,项目名称:openafs,代码行数:22,代码来源:afsd_flushvol.c


示例9: IsObjInc

int IsObjInc(char *name, ViceFid *fid, char *realm) 
{
    struct GetFid {
	ViceFid fid;
	ViceVersionVector vv;
	char realm[MAXHOSTNAMELEN+1];
    } out;
    struct ViceIoctl vio;
    struct stat statbuf;
    char symval[MAXPATHLEN];
    int rc, n;

    memset(fid, 0, sizeof(ViceFid));
    realm[0] = '\0';

    /* what if the begin repair has been done already */
    rc = stat(name, &statbuf);
    if (rc) {
	/* is it a sym link */
	symval[0] = 0;
	rc = readlink(name, symval, MAXPATHLEN);
	if (rc < 0) return(0);

	/* it's a sym link, alright */
	n = sscanf(symval, "@%x.%x.%[email protected]%s",
		   &fid->Volume, &fid->Vnode, &fid->Unique, realm);

	return(n == 4);
    }

    memset(&out, 0, sizeof(out));
    vio.in = NULL;
    vio.in_size = 0;
    vio.out = (char *)&out;
    vio.out_size = sizeof(out);

    rc = pioctl(name, _VICEIOCTL(_VIOC_GETFID), &vio, 0);
    if (rc < 0 && errno != ETOOMANYREFS) {
	fprintf(stderr, "Error %d for Getfid\n", errno);
	return(0);
    }
    memcpy(fid, &out.fid, sizeof(ViceFid));
    strcpy(realm, out.realm);

    if (!ISDIR(out.fid) && (statbuf.st_mode & S_IFDIR))
	return(1);

    if (out.vv.StoreId.Host == -1) 
	return(1);

    return(0);
}
开发者ID:chutzimir,项目名称:coda,代码行数:52,代码来源:removeinc.c


示例10: set_acl

static int
set_acl(char *dir)
{
    struct ViceIoctl a_params;
    char *foo = "1\n0\nsystem:anyuser 0\n";

    a_params.in_size = strlen(foo);
    a_params.out_size = 0;
    a_params.in = foo;
    a_params.out = NULL;

    return pioctl(dir, VIOCSETAL, &a_params, 1);
}
开发者ID:chanke,项目名称:openafs-osd,代码行数:13,代码来源:write-closed2.c


示例11: fs_wscell

int
fs_wscell(char *cell, size_t cell_sz)
{
    struct ViceIoctl a_params;

    a_params.in_size = 0;
    a_params.in = NULL;
    a_params.out_size = cell_sz;
    a_params.out = cell;

    if (pioctl(NULL, VIOC_GET_WS_CELL, &a_params, 0) < 0)
	return errno;
    return 0;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:14,代码来源:fs_lib.c


示例12: Config_GetServerPrefs

PSERVERPREFS Config_GetServerPrefs (BOOL fVLServers)
{
   PSERVERPREFS pPrefs = New (SERVERPREFS);
   memset (pPrefs, 0x00, sizeof(SERVERPREFS));
   pPrefs->fVLServers = fVLServers;

   if (Config_GetServiceState() == SERVICE_RUNNING)
      {
      // We retrieve server prefs in batches--start that loop now.
      //
      size_t iOut = 0;
      for (int iOffset = 0; ; )
         {
         cm_SPrefRequest_t InData;
         memset (&InData, 0x00, sizeof(InData));
         InData.offset = iOffset;
         InData.flags = (pPrefs->fVLServers) ? CM_SPREF_VLONLY : 0;
         InData.num_servers = cSERVERPREFS_CHUNK;

         BYTE OutDataStorage[ sizeof(cm_SPrefInfo_t) + cSERVERPREFS_CHUNK * sizeof(cm_SPref_t) ];
         memset (OutDataStorage, 0x00, sizeof(OutDataStorage));
         cm_SPrefInfo_t *pOutData = (cm_SPrefInfo_t *)OutDataStorage;

         struct ViceIoctl IOInfo;
         IOInfo.in_size = sizeof(InData);
         IOInfo.in = (char *)&InData;
         IOInfo.out = (char *)pOutData;
         IOInfo.out_size = sizeof(cm_SPrefInfo_t) + cSERVERPREFS_CHUNK * sizeof(cm_SPref_t);

         if (pioctl (0, VIOC_GETSPREFS, &IOInfo, 1) != 0)
            break;

         if (!REALLOC (pPrefs->aPrefs, pPrefs->cPrefs, iOut + pOutData->num_servers, cREALLOC_PREFS))
            break;

         for (size_t ii = 0; ii < pOutData->num_servers; ++ii)
            {
            pPrefs->aPrefs[ iOut ].ipServer = pOutData->servers[ ii ].host.s_addr;
            pPrefs->aPrefs[ iOut ].iRank = pOutData->servers[ ii ].rank;
            iOut ++;
            }

         if ((iOffset = pOutData->next_offset) == 0)
            break;
         }
     }

   return pPrefs;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:49,代码来源:config.cpp


示例13: in_afs

static int
in_afs (char *path)
{
  static char space[2048];
  struct ViceIoctl vi;

  vi.in_size = 0;
  vi.out_size = sizeof (space);
  vi.out = space;

  if (pioctl (path, VIOC_FILE_CELL_NAME, &vi, 1)
      && (errno == EINVAL || errno == ENOENT))
	return 0;
  return 1;
}
开发者ID:DonCN,项目名称:haiku,代码行数:15,代码来源:fstype.c


示例14: fs_getfilecellname

int
fs_getfilecellname(char *path, char *cell, size_t len)
{
    struct ViceIoctl a_params;

    a_params.in_size = 0;
    a_params.out_size = len;
    a_params.in = NULL;
    a_params.out = cell;

    if (pioctl(path, VIOC_FILE_CELL_NAME, &a_params, 1) == -1)
	return errno;

    return 0;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:15,代码来源:fs_lib.c


示例15: fs_getcrypt

int
fs_getcrypt(afs_uint32 * level)
{
    struct ViceIoctl a_params;

    a_params.in_size = 0;
    a_params.out_size = sizeof(*level);
    a_params.in = NULL;
    a_params.out = (char *)level;

    if (pioctl(NULL, VIOC_GETRXKCRYPT, &a_params, 0) == -1)
	return errno;

    return 0;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:15,代码来源:fs_lib.c


示例16: fs_setcrypt

int
fs_setcrypt(afs_uint32 n)
{
    struct ViceIoctl a_params;

    a_params.in_size = sizeof(n);
    a_params.out_size = 0;
    a_params.in = (char *)&n;
    a_params.out = NULL;

    if (pioctl(NULL, VIOC_SETRXKCRYPT, &a_params, 0) == -1)
	return errno;

    return 0;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:15,代码来源:fs_lib.c


示例17: fs_connect

int
fs_connect(afs_int32 type, afs_int32 * flags)
{
    struct ViceIoctl a_params;

    a_params.in_size = sizeof(type);
    a_params.out_size = sizeof(afs_int32);
    a_params.in = (char *)&type;
    a_params.out = (char *)flags;

    if (pioctl(NULL, VIOCCONNECTMODE, &a_params, 0) == -1)
	return errno;

    return 0;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:15,代码来源:fs_lib.c


示例18: LOG2

int V4L2VideoNode::qbuf(struct v4l2_buffer_info *buf)
{
    LOG2("@%s", __FUNCTION__);
    struct v4l2_buffer *v4l2_buf = &buf->vbuffer;
    int ret = 0;

    v4l2_buf->flags = buf->cache_flags;
    ret = pioctl(mFd, VIDIOC_QBUF, v4l2_buf);
    if (ret < 0) {
        LOGE("VIDIOC_QBUF on %s failed: %s", mName.string(), strerror(errno));
        return ret;
    }
    android_atomic_inc(&mBuffersInDevice);
    return ret;
}
开发者ID:yutokt,项目名称:android_vendor_intel,代码行数:15,代码来源:v4l2videonode.cpp


示例19: fs_nop

int
fs_nop(void)
{
    struct ViceIoctl a_params;

    a_params.in_size = 0;
    a_params.out_size = 0;
    a_params.in = NULL;
    a_params.out = NULL;

    if (pioctl(NULL, VIOCNOP, &a_params, 1) == -1)
	return errno;

    return 0;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:15,代码来源:fs_lib.c


示例20: fs_getcellstatus

int
fs_getcellstatus(char *cellname, afs_uint32 * flags)
{
    struct ViceIoctl a_params;

    a_params.in_size = strlen(cellname) + 1;
    a_params.out_size = sizeof(afs_uint32);
    a_params.in = cellname;
    a_params.out = (caddr_t) flags;

    if (pioctl(NULL, VIOC_GETCELLSTATUS, &a_params, 0) < 0)
	return errno;
    else
	return 0;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:15,代码来源:fs_lib.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pipe函数代码示例发布时间:2022-05-30
下一篇:
C++ pio_handler_set函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap