本文整理汇总了C++中ISERR函数的典型用法代码示例。如果您正苦于以下问题:C++ ISERR函数的具体用法?C++ ISERR怎么用?C++ ISERR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ISERR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: preclone_sigs_setup
//******************************************************************************
//*preclone stuff (if too much, will go away in another source file)
//*fds mapping:
//* - 0 connexion socket
//* - 1 connexion socket
//* - 2 parent stderr
//* - 3 epoll
//* - 4 signalfd fd
//* - 5 parent unix socket for receiving connexion socket
//******************************************************************************
static void preclone_sigs_setup(void)
{
//cannot change SIGKILL, neither SIGSTOP
ul mask=(~0);
l r=rt_sigprocmask(SIG_BLOCK,&mask,0,sizeof(mask));
if(ISERR(r)){
PERR("FATAL:child:preclone:%d:error blocking mostly all signals (%ld)\n",
preclone_slot,r);
exit(-1);
}
mask=SIGBIT(SIGTERM);
i sigs_fd=(i)signalfd4(-1,&mask,sizeof(mask),SFD_NONBLOCK);
if(ISERR(r)){
PERR("FATAL:child:preclone:%d:error setting up fd for signals (%d)\n",
preclone_slot,sigs_fd);
exit(-1);
}
if(sigs_fd!=4){//moving signalfd fd to 4, if required
r=dup2(sigs_fd,4);
if(ISERR(r)){
PERR("FATAL:child:preclone:%d:unable to move signalfd fd (%ld)\n",
preclone_slot,r);
exit(-1);
}
do r=close(sigs_fd); while(r==-EINTR);
}
}
开发者ID:hooji,项目名称:cmingcnasm,代码行数:39,代码来源:pre-fork_socket_unix_tcp.c
示例2: srv_sock_create
static void srv_sock_create(void)
{
//TCP on IPv4... erk!
srv_sock=(i)socket(PF_INET,SOCK_STREAM|SOCK_NONBLOCK,0);
if(ISERR(srv_sock)){
PERR("FATAL:unable to create the server listening socket:%d\n",srv_sock);
kill(0,SIGTERM);
exit(-1);
}
l bool_true=1;
l r=setsockopt(srv_sock,SOL_SOCKET,SO_REUSEADDR,&bool_true,sizeof(bool_true));
if(ISERR(r)){
PERR("FATAL:unable to turn on socket rebinding option:%ld\n",r);
kill(0,SIGTERM);
exit(-1);
}
r=bind(srv_sock,&srv_addr,sizeof(srv_addr));
if(ISERR(r)){
PERR("FATAL:unable to bind address/port on server listening socket:%ld\n",r);
kill(0,SIGTERM);
exit(-1);
}
r=listen(srv_sock,0);
if(ISERR(r)){
PERR("FATAL:unable to flag server listening socket:%ld\n",r);
kill(0,SIGTERM);
exit(-1);
}
}
开发者ID:hooji,项目名称:cmingcnasm,代码行数:32,代码来源:pre-fork_socket_unix_tcp.c
示例3: ep_p_new
//based on the ep type, we may need to book enough room to put a worst case
//scenario of a concatenated sub-p with the ep p rem
static s8 ep_p_new(struct ep *ep,void *p_str,u64 p_sz)
{
//We will do some p concatenation for the following p types. Then book room
//for the worst case scenario.
u64 str_sz=ep->type=='?'||ep->type=='@'?ep->full_p_sz:p_sz;
l addr;
u64 map_sz;
if(!ep->ps){//first allocation
map_sz=sizeof(*ep->ps)+str_sz+1;//count the 0 terminating char
addr=mmap(map_sz,RD|WR,PRIVATE|ANONYMOUS);
if(!addr||ISERR(addr)) return ERR_NOMEM;
ep->last=0;
}else{
u64 new_p_sz=sizeof(*ep->ps)+str_sz+1;//count the 0 terminating char
map_sz=ep->sz+new_p_sz;
addr=mremap(ep->ps,ep->sz,map_sz);
if(!addr||ISERR(addr)) return ERR_NOMEM;//ep is unmapped elsewhere
struct p *p_last=(struct p*)((u8*)(ep->ps)+ep->last);
ep->last+=sizeof(*p_last)+p_last->sz+1;//count the 0 terminating char
}
ep->ps=(struct p*)addr;
ep->sz=map_sz;
struct p *p=(struct p*)((u8*)(ep->ps)+ep->last);
p->sz=str_sz;
memcpy(&p->str[0],p_str,p_sz);//copy only p_sz chars
p->str[p_sz]=0;//set the 0 terminating char
return OK;
}
开发者ID:sylware,项目名称:lwl,代码行数:33,代码来源:match.c
示例4: channel_update
static void channel_update (channel_t *c)
{
DEBUG(" %s %x/%x/%x (%d) %s", c->which, c->status, c->flags, c->events, count_epoll, __FUNCTION__);
ASSERT(!ISLISTED(c));
channel_patch(c);
channel_patch(c->peer);
if (ISSHUT(c) && ISSHUT(c->peer))
return tunnel_release(c->tunnel);
if (ISERR(c))
return tunnel_abort(c->tunnel, "Peer error: %s", c->which);
if (ISERR(c->peer))
return tunnel_abort(c->tunnel, "Peer error: %s", c->which);
uint32_t evt = channel_events(c);
if (c->events & BOTH) {
c->events = evt;
c->flags = SETACT(c->flags) & ~FLAG_ACTIVITY;
PREPEND_STRUCT(ACTIVE_STRUCT_NAME(channel_t),c);
} else
channel_rearm(c, evt);
DEBUG(" %s %x/%x/%x DONE (%d) %s", c->which, c->status, c->flags, c->events, count_epoll, __FUNCTION__);
channel_update_listed(c->peer);
}
开发者ID:jkasarherou,项目名称:lbtk,代码行数:25,代码来源:proxy-tcp-splice.c
示例5: dir_parse
//XXX:carefull, the dentry type is not supported by all fs
static void dir_parse(i parent_fd)
{
++depth;
u8 dirents[DIRENTS_BUF_SZ];
while(1){
l r=getdents64(parent_fd,dirents,DIRENTS_BUF_SZ);
if(ISERR(r)){
PERR("ERROR(%ld):getdents error\n",r);
exit(-1);
}
if(!r) break;
l j=0;
while(j<r){
struct dirent64 *d=(struct dirent64*)(dirents+j);
dout(d);
if(d->type==DT_DIR&&!is_current(d->name)&&!is_parent(d->name)){
i dir_fd;
do
dir_fd=(i)openat(parent_fd,d->name,RDONLY|NONBLOCK);
while(dir_fd==-EINTR);
if(ISERR(dir_fd))
PERR("ERROR(%d):unable to open subdir:%s\n",dir_fd,d->name);
else{
dir_parse(dir_fd);
l r1;
do r1=close(dir_fd); while(r1==-EINTR);
}
}
j+=d->rec_len;
}
}
depth--;
}
开发者ID:sylware,项目名称:lwl,代码行数:36,代码来源:dir_parse.c
示例6: dce_mode_program
s8 dce_mode_program(s32 output_name)
{
struct output *o=®istry[output_name].output;
void *sysname=(void*)udev_device_get_sysname(o->d);
//----------------------------------------------------------------------------
//alloc a properly sized double buffered frame buffer
o->fb.align=PAGE_SZ;//align on a cpu memory page
u64 sz=2*(o->current->h*o->current->v*alga_pixel_fmts_sz[o->pixel_fmt]);
o->fb.sz=sz;
ul req=IOWR('d',SI_MEM_ALLOC,o->fb);
l r=ioctl(o->fd,req,(l)&o->fb);
if(ISERR(r)){
PERR("output:%s:dce:unable to allocate proper vram for a frame buffer of"
" size %llu bytes\n",sysname,o->fb.sz);
goto err;
}
LOG("output:%s:dce:double buffered frame buffer of %llu bytes allocated\n",
sysname,sz);
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//program synchronously the video mode
struct si_dce_dp_set dp_set;
dp_set.idx=o->blk_idx;
dp_set.primary=o->fb.gpu_addr;
dp_set.secondary=o->fb.gpu_addr+sz/2;
dp_set.pixel_fmt=o->pixel_fmt;
dp_set.timing=*(o->current);
dp_set.pitch=o->current->h;
req=IOW('d',SI_DCE_DP_SET,dp_set);
r=ioctl(o->fd,req,(l)&dp_set);
if(ISERR(r)){
PERR("output:%s:dce:%ux%[email protected]%u: unable to program\n",sysname,o->current->h,
o->current->v,v_refresh(o->current));
goto err_free_fb;
}
//----------------------------------------------------------------------------
LOG("output:%s:dce:%ux%[email protected]%u:programmed successfully\n",sysname,o->current->h,
o->current->v,v_refresh(o->current));
return LWL_OK;
err_free_fb:
req=IOW('d',SI_MEM_FREE,o->fb.gpu_addr);
r=ioctl(o->fd,req,&o->fb.gpu_addr);
if(ISERR(r))
PERR("output:%s:dce:unable to free frame buffer memory (LEAK!)\n",sysname);
err:
return LWL_ERR;
}
开发者ID:sylware,项目名称:lwl,代码行数:52,代码来源:dce.c
示例7: preclone_spawn
static i preclone_spawn(s16 slot)
{
atomic_u8_set(preclones_states+slot,PRECLONE_BUSY);
i sockets[2];
preclone_ctl_socket(sockets);
l r=clone(SIGCHLD,0,0,0,0);
if(ISERR(r)){
PERR("FATAL:error precloning process slot %d with error %ld\n",slot,r);
return -1;
}
if(r==0) goto preclone_entry_setup;
preclones[slot].sock=sockets[1];
do r=close(sockets[0]); while(r==-EINTR);
preclones[slot].pid=(i)r;
return 0;
preclone_entry_setup:
preclone_slot=slot;
do r=close(sockets[1]); while(r==-EINTR);//close parent unix socket
preclone_parent_sock=sockets[0];
do r=close(0); while(r==-EINTR);//for the connexion socket
do r=close(1); while(r==-EINTR);//for the connexion socket
//keep stderr
do r=close(sigs_fd); while(r==-EINTR);//don't care of parent signal
do r=close(epfd); while(r==-EINTR);//don't use parent epoll
preclone_entry();
return -1;
}
开发者ID:hooji,项目名称:cmingcnasm,代码行数:34,代码来源:pre-fork_socket_unix_tcp.c
示例8: clone_spawn
static void clone_spawn(void)
{
l r;
if(ps_n<ps_max){
r=clone(SIGCHLD,0,0,0,0);
if(ISERR(r)){
PERR("FATAL:error cloning %ld\n",r);
kill(0,SIGTERM);
exit(-1);
}
if(r==0) goto clone_entry_setup;
++ps_n;
}
return;
clone_entry_setup:
do r=close(0); while(r==-EINTR);//for the connexion socket
do r=close(1); while(r==-EINTR);//for the connexion socket
//keep stderr
do r=close(sigs_fd); while(r==-EINTR);//don't care of parent signal
do r=close(epfd); while(r==-EINTR);//don't use parent epoll
clone_entry();
return;
}
开发者ID:hooji,项目名称:cmingcnasm,代码行数:27,代码来源:pre-fork_socket_unix_tcp.c
示例9: convert_e2prom_args
int convert_e2prom_args(const char *e2prom_args, unsigned int *device_code,
unsigned int *addr, unsigned int *value)
{
int i=0, err = 0;
int pos[3]={0};
int data[3]={0};
char temp[3];
for(; i<2; i++)
{
pos[i] += 1;
pos[i+1] = find_symble(e2prom_args, pos[i]);
ISERR(pos[i+1], "args format error\n");
get_string_from_string(temp, e2prom_args, pos[i], pos[i+1]-pos[i]);
// BRIGHT_DBG("temp = %s\n", temp);
err = sscanf(temp, "%d", data+i);
// BRIGHT_DBG("data[%d] hex = %x\n", i, data[i]);
}
get_string_from_string(temp, e2prom_args, pos[2]+1, VALUE_BYTES);
// BRIGHT_DBG("temp = %s\n", temp);
err = sscanf(temp, "%x", data+2);
// BRIGHT_DBG("data[%d] hex = %x\n", 2, data[2]);
*device_code = data[0];
*addr = data[1];
*value = data[2];
return 0;
}
开发者ID:haolong886,项目名称:rd_i2c_eeprom_driver,代码行数:26,代码来源:rd_e2prom_lib.c
示例10: NFA
/*
- complicatedFind - find a match for the main NFA (with complications)
^ static int complicatedFind(struct vars *, struct cnfa *, struct colormap *);
*/
static int
complicatedFind(
struct vars *const v,
struct cnfa *const cnfa,
struct colormap *const cm)
{
struct dfa *s, *d;
chr *cold = NULL; /* silence gcc 4 warning */
int ret;
s = newDFA(v, &v->g->search, cm, &v->dfa1);
NOERR();
d = newDFA(v, cnfa, cm, &v->dfa2);
if (ISERR()) {
assert(d == NULL);
freeDFA(s);
return v->err;
}
ret = complicatedFindLoop(v, cnfa, cm, d, s, &cold);
freeDFA(d);
freeDFA(s);
NOERR();
if (v->g->cflags®_EXPECT) {
assert(v->details != NULL);
if (cold != NULL) {
v->details->rm_extend.rm_so = OFF(cold);
} else {
v->details->rm_extend.rm_so = OFF(v->stop);
}
v->details->rm_extend.rm_eo = OFF(v->stop); /* unknown */
}
return ret;
}
开发者ID:nawawi,项目名称:tcl,代码行数:39,代码来源:regexec.c
示例11: altdissect
/*
* altdissect - determine alternative subexpression matches (uncomplicated)
*/
static int /* regexec return code */
altdissect(struct vars * v,
struct subre * t,
chr *begin, /* beginning of relevant substring */
chr *end) /* end of same */
{
struct dfa *d;
int i;
assert(t != NULL);
assert(t->op == '|');
for (i = 0; t != NULL; t = t->right, i++)
{
MDEBUG(("trying %dth\n", i));
assert(t->left != NULL && t->left->cnfa.nstates > 0);
d = newdfa(v, &t->left->cnfa, &v->g->cmap, &v->dfa1);
if (ISERR())
return v->err;
if (longest(v, d, begin, end, (int *) NULL) == end)
{
MDEBUG(("success\n"));
freedfa(d);
return dissect(v, t->left, begin, end);
}
freedfa(d);
}
return REG_ASSERT; /* none of them matched?!? */
}
开发者ID:qiuyesuifeng,项目名称:gpdb,代码行数:32,代码来源:regexec.c
示例12: sigs_setup
static void sigs_setup(void)
{//synchronous treatement of signals with signalfd
//cannot change SIGKILL, neither SIGSTOP
ul mask=(~0);
l r=rt_sigprocmask(SIG_BLOCK,&mask,0,sizeof(mask));
if(ISERR(r)){
PERR("FATAL:error blocking mostly all signals (%ld)\n",r);
exit(-1);
}
mask=SIGBIT(SIGTERM)|SIGBIT(SIGCHLD);
sigs_fd=(i)signalfd4(-1,&mask,sizeof(mask),SFD_NONBLOCK);
if(ISERR(sigs_fd)){
PERR("FATAL:error setting up fd for signals (%d)\n",sigs_fd);
exit(-1);
}
}
开发者ID:hooji,项目名称:cmingcnasm,代码行数:17,代码来源:pre-fork_socket_unix_tcp.c
示例13: epoll_sigs_setup
static void epoll_sigs_setup(void)
{
epfd=(i)epoll_create1(0);
if(ISERR(epfd)){
PERR("FATAL:unable to create epoll fd (%d)\n",epfd);
exit(-1);
}
struct epoll_event ep_evt;
memset(&ep_evt,0,sizeof(ep_evt));
ep_evt.events=EPOLLET|EPOLLIN;
ep_evt.data.fd=sigs_fd;
l r=epoll_ctl(epfd,EPOLL_CTL_ADD,sigs_fd,&ep_evt);
if(ISERR(r)){
PERR("FATAL:unable to register signal fd to epoll (%ld)\n",r);
exit(-1);
}
}
开发者ID:hooji,项目名称:cmingcnasm,代码行数:17,代码来源:pre-fork_socket_unix_tcp.c
示例14: matches
/*
- complicatedAlternationDissect - determine alternative subexpression matches (w.
- complications)
^ static int complicatedAlternationDissect(struct vars *, struct subre *, chr *, chr *);
*/
static int /* regexec return code */
complicatedAlternationDissect(
struct vars *const v,
struct subre *t,
chr *const begin, /* beginning of relevant substring */
chr *const end) /* end of same */
{
int er;
#define UNTRIED 0 /* not yet tried at all */
#define TRYING 1 /* top matched, trying submatches */
#define TRIED 2 /* top didn't match or submatches exhausted */
#ifndef COMPILER_DOES_TAILCALL_OPTIMIZATION
if (0) {
doRight:
t = t->right;
}
#endif
if (t == NULL) {
return REG_NOMATCH;
}
assert(t->op == '|');
if (v->mem[t->retry] == TRIED) {
goto doRight;
}
MDEBUG(("cAlt n%d\n", t->retry));
assert(t->left != NULL);
if (v->mem[t->retry] == UNTRIED) {
struct dfa *d = newDFA(v, &t->left->cnfa, &v->g->cmap, DOMALLOC);
if (ISERR()) {
return v->err;
}
if (longest(v, d, begin, end, NULL) != end) {
freeDFA(d);
v->mem[t->retry] = TRIED;
goto doRight;
}
freeDFA(d);
MDEBUG(("cAlt matched\n"));
v->mem[t->retry] = TRYING;
}
er = complicatedDissect(v, t->left, begin, end);
if (er != REG_NOMATCH) {
return er;
}
v->mem[t->retry] = TRIED;
#ifndef COMPILER_DOES_TAILCALL_OPTIMIZATION
goto doRight;
#else
doRight:
return complicatedAlternationDissect(v, t->right, begin, end);
#endif
}
开发者ID:dgsb,项目名称:tcl,代码行数:63,代码来源:regexec.c
示例15: dce_dpm_on
void dce_dpm_on(struct output *o)
{
void *sysname=(void*)udev_device_get_sysname(o->d);
ul req=IOR('d',SI_DCE_DP_DPM,o->blk_idx);
l r=ioctl(o->fd,req,&o->blk_idx);
if(ISERR(r)) PERR("output:%s:dce:unable to swich dpm to on\n",sysname);
else LOG("output:%s:dce:dpm on successfully\n",sysname);
}
开发者ID:sylware,项目名称:lwl,代码行数:9,代码来源:dce.c
示例16: clone_setup
static void clone_setup(void)
{
clone_sigs_setup();
l r=dup2(cnx_sock,0);
if(ISERR(r)){
PERR("FATAL:child:clone:unable to make stdin the connexion socket (%ld)\n",
r);
exit(-1);
}
r=dup2(cnx_sock,1);
if(ISERR(r)){
PERR("FATAL:child:clone:unable to make stdout the connexion socket (%ld)\n",
r);
exit(-1);
}
}
开发者ID:hooji,项目名称:cmingcnasm,代码行数:18,代码来源:pre-fork_socket_unix_tcp.c
示例17: preclone_ctl_socket
static void preclone_ctl_socket(i sockets[2])
{
l r=socketpair(AF_UNIX,SOCK_DGRAM,0,sockets);
if(ISERR(r)){
PERR("FATAL:error creating preclone socket pair (%ld)\n",r);
kill(0,SIGTERM);
exit(-1);
}
}
开发者ID:hooji,项目名称:cmingcnasm,代码行数:9,代码来源:pre-fork_socket_unix_tcp.c
示例18: main
void main(int argc, char *argv[]) {
func() ? 1 : 0;
#ifdef QUEUE
DC_thread_t t;
time_t tm;
DC_queue_init (&queue, 100, 0);
DC_thread_create (&t, print_func, NULL);
signal (SIGALRM, sig);
//signal (SIGINT, sig);
alarm (1);
usleep (1);
while (!ext) {
tm = (time(NULL)/1000);
//fprintf (stderr, "Writing : %u\n", t);
if (ISERR (DC_queue_add (&queue, (OBJ_t)tm, TRUE, 0))) {
fprintf (stderr, "Queue is error\n");
break;
}
x++;
}
sleep (100);
#elif defined (CONF)
exit(DC_read_ini (argv[1], print_conf));
#elif defined (LIST)
int i = 0;
DC_list_t list;
DC_list_init (&list, (OBJ_t)0);
printf ("Insert 10 numbers (from 1-10):\n");
for (i=0; i<10; i++) {
DC_list_add (&list, i+1);
}
print_list(&list);
printf ("Insert 22 at index of 2\n");
DC_list_insert_at_index (&list, 22, 2);
print_list (&list);
printf ("Remove the number at index of 1\n");
DC_list_remove_at_index (&list, 1);
print_list (&list);
printf ("Print the number at index of 8\n");
printf ("%d\n", (int)DC_list_get_at_index (&list, 8));
DC_list_clean (&list);
print_list (&list);
DC_list_destroy (&list);
#endif
}
开发者ID:sontolau,项目名称:DataCollector,代码行数:57,代码来源:test.c
示例19: clone_sigs_setup
//******************************************************************************
//*clone stuff
//******************************************************************************
static void clone_sigs_setup(void)
{
//cannot change SIGKILL, neither SIGSTOP
u64 mask=(~0);
l r=rt_sigprocmask(SIG_BLOCK,&mask,0,sizeof(mask));
if(ISERR(r)){
PERR("FATAL:child:clone:error blocking mostly all signals (%ld)\n",r);
exit(-1);
}
}
开发者ID:hooji,项目名称:cmingcnasm,代码行数:13,代码来源:pre-fork_socket_unix_tcp.c
示例20: dce_double_frame_buffer_free
void dce_double_frame_buffer_free(struct output *o)
{
void *sysname=(void*)udev_device_get_sysname(o->d);
ul req=IOR('d',SI_MEM_FREE,o->fb.gpu_addr);
l r=ioctl(o->fd,req,&o->fb.gpu_addr);
if(ISERR(r))
PERR("output:%s:dce:unable to free frame buffer memory (LEAK!)\n",sysname);
else LOG("output:%s:dce:double frame buffer freed successfully\n",sysname);
}
开发者ID:sylware,项目名称:lwl,代码行数:10,代码来源:dce.c
注:本文中的ISERR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论