本文整理汇总了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();
}
示例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);
}
示例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;
}
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}
示例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;
}
示例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();
}
示例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"));
}
示例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("/"));
}
示例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();
}
示例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));
}
示例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;
}
示例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();
}