当前位置: 首页>>代码示例>>C++>>正文


C++ RL函数代码示例

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


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

示例1: wrrd_after_unlink

static void
wrrd_after_unlink(const atf_tc_t *tc, const char *mp)
{
	int value = 0x11;
	int v2;
	int fd;

	FSTEST_ENTER();

	RL(fd = rump_sys_open("file", O_RDWR|O_CREAT, 0666));
	RL(rump_sys_unlink("file"));

	RL(rump_sys_pwrite(fd, &value, sizeof(value), 654321));

	/*
	 * We can't easily invalidate the buffer since we hold a
	 * reference, but try to get them to flush anyway.
	 */
	RL(rump_sys_fsync(fd));
	RL(rump_sys_pread(fd, &v2, sizeof(v2), 654321));
	rump_sys_close(fd);

	ATF_REQUIRE_EQ(value, v2);
	FSTEST_EXIT();
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:25,代码来源:t_io.c

示例2: ATF_TC_BODY

ATF_TC_BODY(bigenough, tc)
{
	struct stat sb;

	RZ(system("rump_server " RUMPSERV));
	RL(setenv("RUMP_SERVER", RUMPSERV, 1));

	RL(dup2(0, 10));
	RL(dup2(1, 11));
	RL(dup2(2, 12));

	RL(close(0));
	RL(close(1));
	RL(close(2));

	RL(rumpclient_init());
	RL(rump_sys_getpid());

	ATF_REQUIRE_ERRNO(EBADF, fstat(0, &sb) == -1);
	ATF_REQUIRE_ERRNO(EBADF, fstat(1, &sb) == -1);
	ATF_REQUIRE_ERRNO(EBADF, fstat(2, &sb) == -1);

	RL(rump_sys_getpid());

	/* restore these.  does it help? */
	dup2(10, 0);
	dup2(11, 1);
	dup2(12, 2);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:29,代码来源:t_fd.c

示例3: RL

static zend_rsrc_list_entry *zend_list_id_to_entry(int id TSRMLS_DC) {
  if (id < RL().size()) {
    return RL().at(id);
  } else {
    return NULL;
  }
}
开发者ID:6api,项目名称:hhvm,代码行数:7,代码来源:zend_list.cpp

示例4: holywrite

static void
holywrite(const atf_tc_t *tc, const char *mp)
{
	char buf[1024];
	char *b2, *b3;
	size_t therange = getpagesize()+1;
	int fd;

	FSTEST_ENTER();

	RL(fd = rump_sys_open("file", O_RDWR|O_CREAT|O_TRUNC, 0666));

	memset(buf, 'A', sizeof(buf));
	RL(rump_sys_pwrite(fd, buf, 1, getpagesize()));

	memset(buf, 'B', sizeof(buf));
	RL(rump_sys_pwrite(fd, buf, 2, getpagesize()-1));

	REQUIRE_LIBC(b2 = malloc(2 * getpagesize()), NULL);
	REQUIRE_LIBC(b3 = malloc(2 * getpagesize()), NULL);

	RL(rump_sys_pread(fd, b2, therange, 0));

	memset(b3, 0, therange);
	memset(b3 + getpagesize() - 1, 'B', 2);

	ATF_REQUIRE_EQ(memcmp(b2, b3, therange), 0);

	rump_sys_close(fd);
	FSTEST_EXIT();
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:31,代码来源:t_io.c

示例5: ATF_TC_BODY

ATF_TC_BODY(OOSIOCGIFBRDADDR, tc)
{
        int fd, ifnum;
        struct oifreq ifreq;
        struct sockaddr_in *sin;
	int rv;

        memset(&ifreq,'\0',sizeof ifreq);

	rump_init();

	/* create an interface and give it netmask 0xffff0000 */
	rv = rump_pub_shmif_create("bus", &ifnum);
	if (rv)
		atf_tc_fail("failed to create shmif: %s", strerror(rv));
	sprintf(ifreq.ifr_name, "shmif%d", ifnum);
	netcfg_rump_if(ifreq.ifr_name, "1.7.64.10", "255.255.0.0");

	/* query kernel for iface bcast */
        RL(fd = rump_sys_socket(AF_INET, SOCK_DGRAM, 0));
        RL(rump_sys_ioctl(fd, OOSIOCGIFBRDADDR, &ifreq));

	/* make sure we got what we deserve */
        sin = (struct sockaddr_in *)&ifreq.ifr_broadaddr;
	ATF_REQUIRE_EQ(sin->sin_addr.s_addr, htonl(0x0107ffff));
        rump_sys_close(fd);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:27,代码来源:t_compat.c

示例6: ATF_TC_BODY

ATF_TC_BODY(proccreds, tc)
{
	struct lwp *l1, *l2;

	rump_init();
	RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
	l1 = rump_pub_lwproc_curlwp();
	RZ(rump_pub_lwproc_newlwp(rump_sys_getpid()));

	RZ(rump_pub_lwproc_rfork(RUMP_RFCFDG));
	l2 = rump_pub_lwproc_curlwp();

	RL(rump_sys_setuid(22));
	ATF_REQUIRE_EQ(rump_sys_getuid(), 22);

	rump_pub_lwproc_switch(l1);
	ATF_REQUIRE_EQ(rump_sys_getuid(), 0); /* from parent, proc0 */
	RL(rump_sys_setuid(11));
	ATF_REQUIRE_EQ(rump_sys_getuid(), 11);

	rump_pub_lwproc_switch(l2);
	ATF_REQUIRE_EQ(rump_sys_getuid(), 22);
	rump_pub_lwproc_newlwp(rump_sys_getpid());
	ATF_REQUIRE_EQ(rump_sys_getuid(), 22);
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:25,代码来源:t_lwproc.c

示例7: read_after_unlink

static void
read_after_unlink(const atf_tc_t *tc, const char *mp)
{
	char buf[TBSIZE], buf2[TBSIZE];
	int fd;

	FSTEST_ENTER();

	/* create file and put some content into it */
	RL(fd = rump_sys_open("file", O_RDWR|O_CREAT, 0666));
	memset(buf, 'D', TBSIZE);
	ATF_REQUIRE_EQ(rump_sys_write(fd, buf, TBSIZE), TBSIZE);
	rump_sys_close(fd);

	/* flush buffers from UBC to file system */
	ATF_REQUIRE_ERRNO(EBUSY, rump_sys_unmount(mp, 0) == -1);

	RL(fd = rump_sys_open("file", O_RDWR));
	RL(rump_sys_unlink("file"));

	ATF_REQUIRE_EQ(rump_sys_read(fd, buf2, TBSIZE), TBSIZE);
	ATF_REQUIRE_EQ(memcmp(buf, buf2, TBSIZE), 0);
	rump_sys_close(fd);

	FSTEST_EXIT();
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:26,代码来源:t_io.c

示例8: zend_list_insert

ZEND_API int zend_list_insert(void *ptr, int type TSRMLS_DC) {
  zend_rsrc_list_entry* le = new zend_rsrc_list_entry(ptr, type);
  le->incRefCount();
  RL().push_back(le);
  int id = RL().size() - 1;
  le->id = id;
  return id;
}
开发者ID:6api,项目名称:hhvm,代码行数:8,代码来源:zend_list.cpp

示例9: child

static void
child(bool master)
{
	char ifname[IFNAMSIZ];
	struct carpreq cr;
	struct ifreq ifr;
	const char *carpif;
	int s;

	/* helps reading carp debug output */
	if (master)
		carpif = "carp0";
	else
		carpif = "carp1";

	/*
	 * Should use sysctl, bug debug is dabug.
	 */
	{
	//extern int rumpns_carp_opts[]; /* XXX */
	//rumpns_carp_opts[CARPCTL_LOG] = 1;
	}


	rump_init();

	memset(&ifr, 0, sizeof(ifr));
	strlcpy(ifr.ifr_name, carpif, sizeof(ifr.ifr_name));

	RL(s = rump_sys_socket(PF_INET, SOCK_DGRAM, 0));
	RL(rump_sys_ioctl(s, SIOCIFCREATE, &ifr));

	netcfg_rump_makeshmif(THEBUS, ifname);

	if (master)
		netcfg_rump_if(ifname, "10.1.1.1", "255.255.255.0");
	else
		netcfg_rump_if(ifname, "10.1.1.2", "255.255.255.0");

	/* configure the carp interface */
	ifr.ifr_data = &cr;
	RL(rump_sys_ioctl(s, SIOCGVH, &ifr));

	strlcpy(cr.carpr_carpdev, ifname, sizeof(cr.carpr_carpdev));
	cr.carpr_vhid = 175;
	if (master)
		cr.carpr_advskew = 0;
	else
		cr.carpr_advskew = 200;
	cr.carpr_advbase = 1;
	strcpy((char *)cr.carpr_key, "s3cret");

	RL(rump_sys_ioctl(s, SIOCSVH, &ifr));
	netcfg_rump_if(carpif, "10.1.1.100", "255.255.255.0");

	/* tassa pause()en enka muuta voi */
	pause();
}
开发者ID:2asoft,项目名称:freebsd,代码行数:58,代码来源:t_basic.c

示例10: symlink_root

static void
symlink_root(const atf_tc_t *tc, const char *mp)
{

	USES_SYMLINKS;

	RL(rump_sys_chdir(mp));
	RL(rump_sys_symlink("/", "foo"));
	RL(rump_sys_chdir("foo"));
}
开发者ID:anuragpeshne,项目名称:minix,代码行数:10,代码来源:t_vnops.c

示例11: symlink_zerolen

static void
symlink_zerolen(const atf_tc_t *tc, const char *mp)
{

	USES_SYMLINKS;

	RL(rump_sys_chdir(mp));

	RL(rump_sys_symlink("", "afile"));
	RL(rump_sys_chdir("/"));
}
开发者ID:anuragpeshne,项目名称:minix,代码行数:11,代码来源:t_vnops.c

示例12: shrinkfile

static void
shrinkfile(const atf_tc_t *tc, const char *mp)
{
	int fd;

	FSTEST_ENTER();
	RL(fd = rump_sys_open("file", O_RDWR|O_CREAT|O_TRUNC, 0666));
	RL(rump_sys_ftruncate(fd, 2));
	RL(rump_sys_ftruncate(fd, 1));
	rump_sys_close(fd);
	FSTEST_EXIT();
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:12,代码来源:t_io.c

示例13: ATF_TC_BODY

ATF_TC_BODY(pipe1, tc)
{
	struct kevent event[1];
	int fds[2];
	int kq, n;

	RL(pipe(fds));
	RL(kq = kqueue());
	RL(close(fds[0]));

	EV_SET(&event[0], fds[1], EVFILT_WRITE, EV_ADD|EV_ENABLE, 0, 0, 0);
	ATF_REQUIRE_EQ_MSG((n = kevent(kq, event, 1, NULL, 0, NULL)),
	    -1, "got: %d", n);
	ATF_REQUIRE_EQ_MSG(errno, EBADF, "got: %s", strerror(errno));
}
开发者ID:2asoft,项目名称:freebsd,代码行数:15,代码来源:t_pipe.c

示例14: InitCPU

void InitCPU(void) /* 68K state when powered on */
{ 
	ssp=*sp=RL(&theROM[0]);
	SetPC(RL(&theROM[1]));
	if(V3)printf("initial PC=%x SP=%x\n",(void*)pc-(void*)theROM,ssp);
	
	iMask=7;
	supervisor=true;
	trace=doTrace=false;
	exception=0;
	extraFlag=false;
	pendingInterrupt=0;
	stopped=false;
	badCodeAddress=false;
}
开发者ID:daveysaxt,项目名称:MacQL,代码行数:15,代码来源:iexl_general.c

示例15: read_fault

static void
read_fault(const atf_tc_t *tc, const char *mp)
{
	char ch = 123;
	int fd;

	FSTEST_ENTER();
	RL(fd = rump_sys_open("file", O_CREAT | O_RDWR, 0777));
	ATF_REQUIRE_EQ(rump_sys_write(fd, &ch, 1), 1);
	RL(rump_sys_close(fd));
	RL(fd = rump_sys_open("file", O_RDONLY | O_SYNC | O_RSYNC));
	ATF_REQUIRE_ERRNO(EFAULT, rump_sys_read(fd, NULL, 1) == -1);
	RL(rump_sys_close(fd));
	FSTEST_EXIT();
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:15,代码来源:t_io.c


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