这篇教程C++ syserr函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中syserr函数的典型用法代码示例。如果您正苦于以下问题:C++ syserr函数的具体用法?C++ syserr怎么用?C++ syserr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了syserr函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: compile_error void compile_error(lua_State * L, int status) { if(status == 0) return; // No errors. // This is the human readable error message. const char * msg = lua_tostring(L, -1); std::stringstream ss; switch (status) { case LUA_ERRMEM: ss << "Memory allocation error: " << msg << std::endl; syserr(ss.str().c_str()); break; case LUA_ERRSYNTAX: ss << "Syntax error: " << msg << std::endl; syserr(ss.str().c_str()); break; } // Remove error message. lua_pop(L, 1); }
开发者ID:icedman,项目名称:lov8,代码行数:25,
示例2: servSidevoid servSide(int newsockfd, char* buffer){ int n, size, tempfd; struct stat filestats; char * filename; filename = malloc(sizeof(char)*BUFFSIZE); //Receive file name memset(buffer, 0, BUFFSIZE); n = recv(newsockfd, buffer, BUFFSIZE, 0); if(n < 0) syserr("can't receive filename from peer"); sscanf(buffer, "%s", filename); printf("filename peer wants to download is: %s/n", filename); //Send file size and file to peer stat(filename, &filestats); size = filestats.st_size; printf("Size of file to send: %d/n", size); size = htonl(size); n = send(newsockfd, &size, sizeof(int), 0); if(n < 0) syserr("couldn't send size to peer"); tempfd = open(filename, O_RDONLY); if(tempfd < 0) syserr("failed to open file"); sendall(tempfd, newsockfd, buffer); close(tempfd); //Close the connection to peer printf("Connection to peer shutting down/n"); int status = 1; status = htonl(status); n = send(newsockfd, &status, sizeof(int), 0); if(n < 0) syserr("didn't send exit signal to client");}
开发者ID:eguer048,项目名称:peer2peer,代码行数:34,
示例3: mainint main (){ pid_t pid; /* wypisuje identyfikator procesu */ printf("Moj PID = %d/n", getpid()); /* tworzy nowy proces */ switch (pid = fork()) { case -1: /* blad */ syserr("Error in fork/n"); case 0: /* proces potomny */ printf("Jestem procesem potomnym. Moj PID = %d/n", getpid()); printf("Jestem procesem potomnym. Wartosc przekazana przez fork() =/ %d/n", pid); return 0; default: /* proces macierzysty */ printf("Jestem procesem macierzystym. Moj PID = %d/n", getpid()); printf("Jestem procesem macierzystym. Wartosc przekazana przez fork() =/ %d/n", pid); /* czeka na zakonczenie procesu potomnego */ if (wait(0) == -1) syserr("Error in wait/n"); return 0; } /*switch*/}
开发者ID:ertesh,项目名称:SO,代码行数:34,
示例4: do_transcation// do_transcation: send a request to the server and get a response backchar * do_transcation(char * msg){ static char buf[MSGLEN]; struct sockaddr retaddr; socklen_t addrlen = sizeof(retaddr); int ret; // printf("before sendto msg %s/n", msg); ret = sendto(sd, msg, strlen(msg), 0, &serv_addr, serv_alen); // printf("after sendto ret %d/n", ret); if (ret == -1) { syserr("sendto"); return(NULL); } // printf("before recvfrom/n"); ret = recvfrom(sd, buf, MSGLEN, 0, &retaddr, &addrlen); // printf("after recvfrom ret %d/n", ret); if (ret == -1) { syserr("recvfrom"); return(NULL); } return(buf);}
开发者ID:tigerRose,项目名称:unix_c,代码行数:28,
示例5: pascalvoid pascal(int id, int left[2], int right[2]) { uint64_t value = 0; assert(id == 0); assert(left == NULL); for(int i = 1; i < n; ++i) if(-1 == write(right[1], &value, sizeof(value))) syserr("Pascal: Unable to write"); if(-1 == close(right[1])) syserr("Pascal: Unable to close"); for(int i = 0; i < n; ++i) switch(read(right[0], &value, sizeof(value))) { case -1: syserr("Pascal: Unable to read"); case 0: fatal("Pascal: Unexpected end of pipe"); default: printf("%" PRIu64 " ", value); } putchar('/n'); if(-1 == close(right[0])) syserr("Pascal: Unable to close");}
开发者ID:amharc,项目名称:SO-zad1,代码行数:28,
示例6: comparestatic intcompare(tparser *p, thandler *handler, void *userdata, GArray *offsets, char *cleanname, char *dataname, long *error_position, cmdline *cmdline){ FILE *clean, *data; int rc; long pos; if ( !(clean = fopen(cleanname, "r+"))) syserr(); if ( !(data = fopen(dataname, "r"))) syserr(); rc = compare_streams(p, handler, userdata, offsets, clean, data, &pos, error_position); if (fclose(clean) == EOF) syserr(); if (fclose(data) == EOF) syserr(); if (rc == -2) { /* an error has happened */ int n; if (!cmdline) { fputs("oops: unexpected error in handler/n", stderr); exit(1); } /* remove already-processed entries from the data file */ cut_datafile(dataname, pos, cmdline); /* flag already-processed entries in the offset table */ for (n = 0; n < offsets->len; n++) if (g_array_index(offsets, long, n) < 0) g_array_index(offsets, long, n) = -1; }
开发者ID:wtsi-hgi,项目名称:ldapvi,代码行数:33,
示例7: mainint main (){ register int i; if (setpgrp() == -1) /*ustalenie nowej grupy*/ syserr("setpgrp"); for (i = 0; i < 10; i++) switch (fork()) { case -1: syserr("fork"); case 0: /*proces potomny*/ if (i & 1) if (setpgrp() == -1) syserr("setpgrp2"); printf("pid = %d pgrp = %d/n", getpid(), getpgrp()); if (i & 1) sleep(15); else pause(); return 0; } sleep(5); /*dajmy czas procesom potomnym na rozpoczecie dzialania*/ if (kill(0, SIGINT) == -1) syserr("kill"); return 0;} /*main*/
开发者ID:ertesh,项目名称:SO,代码行数:28,
示例8: call/*Reassembles the original input and gives it to system */void call(char** args, int wait) { pid_t pid; // process ID //int rc; // return code pid = getpid(); // get our own pid printf("Process ID before fork: %d/n", (int)pid); switch (pid = fork()) { case -1: syserr("fork"); break; case 0: // execution in child process printf("Process ID in child after fork: %d/n", pid); execvp(args[0], args); syserr("execl"); // error if return from exec break; default: if (wait) { /* Parent waits for child process, with no status info returned */ waitpid(pid, NULL, WUNTRACED); } }// continued execution in parent process pid = getpid(); // reget our pid printf("Process ID in parent after fork: %d/n", pid);}
开发者ID:Cuboxylate,项目名称:Seashell,代码行数:29,
示例9: appqual/*** APPQUAL -- append qualification to tree**** The qualification is conjoined to the qualificaion of the** tree which is passed.**** Parameters:** qual -- a pointer to the qualification to be appended.** root -- a pointer to the tree to be appended to.**** Returns:** none**** Side Effects:** Both 'qual' ad 'root' may be modified. Note that** 'qual' is linked into 'root', and must be** retained.**** Trace Flags:** 13*/voidappqual(qtree_t *qual, qtree_t *root){ register qtree_t *p; register qtree_t *r; r = root;#ifdef xQTR3 if (r == NULL) syserr("appqual: NULL root");#endif /* ** Find node before QLEND node ** p points the node we are examining, r points to ** it's parent. */ while ((p = r->right) != NULL && p->sym.type != QLEND) {#ifdef xQTR3 if (p->sym.type != AND) syserr("appqual: node %d", p->sym.type);#endif r = p; } /* link in qualification */ r->right = qual;}
开发者ID:jonathangray,项目名称:freebsd-1.x-ports,代码行数:50,
示例10: wl_get_dev_typestatic intwl_get_dev_type(char *name, void *buf, int len){ int s; int ret; struct ifreq ifr; struct ethtool_drvinfo info; /* open socket to kernel */ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) syserr("socket"); /* get device type */ memset(&info, 0, sizeof(info)); info.cmd = ETHTOOL_GDRVINFO; ifr.ifr_data = (caddr_t)&info; strncpy(ifr.ifr_name, name, IFNAMSIZ); if ((ret = ioctl(s, SIOCETHTOOL, &ifr)) < 0) { /* print a good diagnostic if not superuser */ if (errno == EPERM) syserr("wl_get_dev_type"); *(char *)buf = '/0'; } else { strncpy(buf, info.driver, len); } close(s); return ret;}
开发者ID:houzhenggang,项目名称:hiwifi-openwrt-HC5661-HC5761,代码行数:31,
示例11: syserrFET *readfetfile(char *file){ FILE *fp; FET *fet; char c,buf[MAXFETLENGTH]; if ((fp = fopen(file,"rb")) == (FILE *)NULL) syserr("readfetfile","fopen",file); fet = allocfet(MAXFETS); while (fscanf(fp,"%s",buf) != EOF){ while(((c = getc(fp)) == ' ') || (c == '/t')); ungetc(c, fp); if (fet->num >= fet->alloc) reallocfet(fet, fet->alloc + MAXFETS); fet->names[fet->num] = strdup(buf); if(fet->names[fet->num] == (char *)NULL) syserr("readfetfile","strdup","fet->names[]"); fgets(buf,MAXFETLENGTH-1,fp); buf[strlen(buf)-1] = '/0'; fet->values[fet->num] = (char *)strdup(buf); if(fet->values[fet->num] == (char *)NULL) syserr("readfetfile","strdup","fet->values[]"); (fet->num)++; } fclose(fp); return(fet);}
开发者ID:Booley,项目名称:nbis,代码行数:28,
示例12: make_loopvoid make_loop(int n, int* last_pipe, char* grammar) { /* last_pipe[0] = input of the recently created pipe * * last_pipe[1] = output of the first pipe */ pid_t pid; if (n == 1) { prepare_input(last_pipe); prepare_output(last_pipe); close_pipe(last_pipe); return; } int next_pipe[2]; create_pipe(next_pipe); switch (pid = fork()) { case -1: syserr("Error in fork()/n"); case 0: prepare_input(last_pipe); close_pipe(last_pipe); prepare_output(next_pipe); close_pipe(next_pipe); execl("./worker", "./worker", grammar, NULL); syserr("Error in execl()/n"); default: last_pipe[0] = next_pipe[0]; make_loop(n - 1, last_pipe, grammar); return; }}
开发者ID:ertesh,项目名称:SO,代码行数:28,
示例13: client#include <stdio.h>#include <unistd.h>#include <string.h>#include <sys/types.h>#include <sys/ipc.h>#include <sys/shm.h>#include "mesg.h"#include "err.h"#include "simple_sem.h"int shmid, clisem, servsem; /* shared memory and semaphore IDs */Mesg *mesgptr; /* ptr to message structure, which is in the shared memory segment */void client(){ int n; P(clisem); /* get control of shared memory */ printf("Enter filename: "); if (fgets(mesgptr->mesg_data, MAXMESGDATA, stdin) == NULL) syserr("filename read error"); n = strlen(mesgptr->mesg_data); if (mesgptr->mesg_data[n - 1] == '/n') n--; /* ignore newline from fgets() */ mesgptr->mesg_len = n; V(servsem); /* wake up server */ P(clisem); /* wait for server to process */ while( (n = mesgptr->mesg_len) > 0) { if (write(1, mesgptr->mesg_data, n) != n) syserr("data write error"); V(servsem); /* wake up server */ P(clisem); /* wait for server to process */ } if (n < 0) syserr("data read error");}
开发者ID:ertesh,项目名称:SO,代码行数:41,
示例14: pr_integrity/*** PR_INTEGRITY -- print out integrity constraints on a relation**** Finds all integrity tuples for this unique relation, and** calls pr_int() to print a query from them.**** Parameters:** relid -- rel name** relowner -- 2 byte owner id**** Returns:** none**** Side Effects:** file activity, query printing**** Trace Flags:** 33, 9*/voidpr_integrity(char *relid, char *relowner){ extern desc_t Intdes; tid_t hitid, lotid; struct integrity key, tuple; register int i;#ifdef xZTR1 if (tTf(50, 9)) printf("pr_integrity(relid =%s, relowner=%s)/n", relid, relowner);#endif printf("Integrity constraints on %s are:/n/n", relid); opencatalog("integrities", OR_READ); /* get integrities tuples for relid, relowner */ clearkeys(&Intdes); ingres_setkey(&Intdes, &key, relid, INTRELID); ingres_setkey(&Intdes, &key, relowner, INTRELOWNER); if ((i = find(&Intdes, EXACTKEY, &lotid, &hitid, &key)) != 0) syserr("pr_integrity: find %d", i); for (;;) { if ((i = get(&Intdes, &lotid, &hitid, &tuple, TRUE)) != 0) break; if (kcompare(&Intdes, &tuple, &key) == 0) pr_int(&tuple, relid); } if (i != 1) syserr("pr_integrity: get %d", i);}
开发者ID:jonathangray,项目名称:freebsd-1.x-ports,代码行数:52,
示例15: mainint main (){ pid_t pid; /* wypisuje identyfikator procesu */ printf("Moj PID = %d/n", getpid()); /* tworzy nowy proces */ switch (pid = fork()) { case -1: /* blad */ syserr("Error in fork/n"); case 0: /* proces potomny */ printf("Jestem procesem potomnym. Moj PID = %d/n", getpid()); printf("Jestem procesem potomnym. Wartosc przekazana przez fork() =" "%d/n", pid); /* wykonuje program ps */ execl("/bin/ps", "ps", 0); syserr("Error in execlp/n"); default: /* proces macierzysty */ printf("Jestem procesem macierzystym. Moj PID = %d/n", getpid()); printf("Jestem procesem macierzystym. Wartosc przekazana przez fork() =/ %d/n", pid); /* czeka na zakonczenie procesu potomnego */ printf("wait: %d/n", wait(0)); return 0; } /*switch*/}
开发者ID:rm360179,项目名称:SO,代码行数:34,
示例16: ip_bindery/* * NAME: ip_bindery * USAGE: Establish a local passive (listening) socket at the given port. * ARGS: family - AF_INET is the only supported argument. * port - The port to establish the connection upon. May be 0, * which requests any open port. * storage - Pointer to a sockaddr structure big enough for the * specified family. Upon success, it will be filled with * the local sockaddr of the new connection. * NOTES: In most cases, the local address for 'storage' will be INADDR_ANY * which doesn't really give you any useful information. It is not * possible to authoritatively figure out the local IP address * without using ioctl(). However, we guess the best we may. * * NOTES: This function lacks IPv6 support. * This function lacks Unix Domain Socket support. */int ip_bindery (int family, unsigned short port, SS *storage){ socklen_t len; int fd; if (inet_vhostsockaddr(family, port, NULL, storage, &len)) { syserr(-1, "ip_bindery: inet_vhostsockaddr(%d,%d) failed.", family, port); return -1; } if (!len) { syserr(-1, "ip_bindery: inet_vhostsockaddr(%d,%d) didn't " "return an address I could bind", family, port); return -1; } if ((fd = client_bind((SA *)storage, len)) < 0) { syserr(-1, "ip_bindery: client_bind(%d,%d) failed.", family, port); return -1; } return fd;}
开发者ID:ailin-nemui,项目名称:epic5,代码行数:44,
示例17: initializeThreadAttributevoid initializeThreadAttribute(pthread_attr_t* threadAttribute, int detachState) { if (pthread_attr_init(threadAttribute) != 0) syserr(THREAD_ATTRIBUTE_INITIALIZATION_ERROR_CODE); if (pthread_attr_setdetachstate(threadAttribute, detachState) != 0) syserr(THREAD_ATTRIBUTE_DETACHSTATE_INITIALIZATION_ERROR_CODE);}
开发者ID:mszeszko,项目名称:OS-Elections,代码行数:7,
示例18: xdot/*** XDOT** add to attribute stash any missing attributes in the** source relation and then build tree with all attribs** in the 'a_id' order. This algorithm assumes that** the function 'attadd' insert attributes into the list** in 'a_id' order from 1 -> N.*/qtree_t *xdot(int slot){ PARRNG *rptr; attr_t tuple; register attr_t *ktuple; attr_t ktup; tid_t tid; tid_t limtid; qtree_t *tempt; register qtree_t *vnode; int ik; register att_ent_t *aptr; extern PARRNG Parrng[]; extern char *Trname; extern desc_t Attdes; rptr = &Parrng[slot];#ifdef xPTR2 tTfp(35, 0, "ALL being processed for %12s/n", rptr->vardesc.d_rangevar);#endif if (rptr->vardesc.d_r.r_attrc <= 0) syserr("xdot: rptr->vardesc.d_r.r_attrc %d./n", rptr->vardesc.d_r.r_attrc); /* if attstash is missing any attribs then fill in list */ if (rptr->vardesc.d_r.r_attrc != attcount(slot)) { /* get all entries in attrib relation */ clearkeys(&Attdes); ktuple = &ktup; ingres_setkey(&Attdes, ktuple, rptr->vardesc.d_r.r_id, ATTRELID); ingres_setkey(&Attdes, ktuple, rptr->vardesc.d_r.r_owner, ATTOWNER); if ((ik = find(&Attdes, EXACTKEY, &tid, &limtid, ktuple)) != 0) syserr("bad find in xdot '%d'", ik); while (!get(&Attdes, &tid, &limtid, &tuple, 1)) if (!kcompare(&Attdes, &tuple, ktuple)) /* add any that are not in the stash */ if (!attfind(slot, tuple.a_name)) attadd(slot, &tuple); } /* build tree for ALL */ tempt = NULL; aptr = rptr->attlist; while (aptr != 0) { vnode = par_tree(NULL, NULL, VAR, sizeof(varnode_t), slot, aptr); Trname = aptr->atbname; tempt = addresdom(tempt, vnode); aptr = aptr->atbnext; }#ifdef xPTR3 tTfp(35, 0, "end of xdot %12s/n", rptr->vardesc.d_rangevar);#endif return(tempt);}
开发者ID:jonathangray,项目名称:freebsd-1.x-ports,代码行数:67,
示例19: MutexAndSignal_createMutexAndSignal_pointer MutexAndSignal_create() { MutexAndSignal_pointer this = safe_raw_allocate(1, sizeof(struct MutexAndSignal)); if (pthread_mutex_init(&this->lock, 0) != 0) syserr ("MutexAndSignal_create: gMutex init failed"); if (pthread_cond_init(&this->signal, 0) != 0) syserr ("MutexAndSignal_create: signal init failed"); return this;}
开发者ID:staronj,项目名称:AcademicProjects,代码行数:8,
示例20: exit_servervoid exit_server(){ if (msgctl(server_qid, IPC_RMID, 0) == -1) syserr("msgctl RMID"); if (msgctl(report_qid, IPC_RMID, 0) == -1) syserr("msgctl RMID"); exit(0);}
开发者ID:wiktoriaroza,项目名称:kolejki-1,代码行数:8,
示例21: getIPCsvoid getIPCs(){ if ((IPCs[out] = msgget(S_KEY, 0)) == -1) syserr("msgget"); if ((IPCs[in] = msgget(K_KEY, 0)) == -1) syserr("msgget");}
开发者ID:Wookesh,项目名称:SO2,代码行数:8,
示例22: destroyServerSyncToolsvoid destroyServerSyncTools(sharedSynchronizationTools* tools) { if (pthread_mutex_destroy(&tools->mutex) != 0) syserr(MUTEX_DESTROY_ERROR_CODE); if (pthread_cond_destroy(&tools->committeeUpdateResultsCondition) != 0) syserr(COMMITTEES_CONDITION_DESTROY_ERROR_CODE); if (pthread_cond_destroy(&tools->reportProcessResultsCondition) != 0) syserr(REPORTS_CONDITION_DESTROY_ERROR_CODE);}
开发者ID:mszeszko,项目名称:OS-Elections,代码行数:8,
示例23: initializeServerSyncTools/* Initialization. */void initializeServerSyncTools(sharedSynchronizationTools* tools) { if (pthread_mutex_init(&tools->mutex, 0) != 0) syserr(MUTEX_INITIALIZATION_ERROR_CODE); if (pthread_cond_init(&tools->committeeUpdateResultsCondition, 0) != 0) syserr(COMMITTEES_CONDITION_INITIALIZATION_ERROR_CODE); if (pthread_cond_init(&tools->reportProcessResultsCondition, 0) != 0) syserr(REPORTS_CONDITION_INITIALIZATION_ERROR_CODE);}
开发者ID:mszeszko,项目名称:OS-Elections,代码行数:9,
示例24: MutexAndSignal_createMutexAndSignal_pointer MutexAndSignal_create() { MutexAndSignal_pointer this = new(struct MutexAndSignal); if (pthread_mutex_init(&this->lock, 0) != 0) syserr("MutexAndSignal_create: gMutex init failed"); if (pthread_cond_init(&this->signal, 0) != 0) syserr("MutexAndSignal_create: signal init failed"); return this;}
开发者ID:staronj,项目名称:BetterC,代码行数:8,
示例25: create_queuesvoid create_queues(){ const int flags = 0666 | IPC_CREAT | IPC_EXCL; if ((server_qid = msgget(SERVER_QUEUE_KEY, flags)) == -1) syserr("msgget"); if ((report_qid = msgget(REPORT_QUEUE_KEY, flags)) == -1) syserr("msgget");}
开发者ID:wiktoriaroza,项目名称:kolejki-1,代码行数:8,
示例26: rel_file/*** REL_FILE -- copy from relation to file*/intrel_file(void){ int j; struct tup_id tid, limtid; char *cp, save; register int offset; register int i; register struct map *mp; /* set scan limits to scan the entire relation */ if (find(&Des, NOKEY, &tid, &limtid, (void *) NULL)) syserr("find error"); while ((i = get(&Des, &tid, &limtid, Inbuf, 1)) == 0) { mp = Map; offset = 0; for (i = 0; i < Mapcount; i++) { /* ** For cases of char to numeric conversion, ** there must be a null byte at the end of the ** string. The character just past the current ** domain is saved an a null byte inserted */ cp = &Inbuf[mp->roffset + mp->rlen]; /* compute address */ save = *cp; /* get the character */ *cp = '/0'; /* insert a null */ /* ** Special case, we want to copy the tid */ if ( mp->roffset == -1 ) { j = transfer((ANYTYPE *)&tid, mp->rtype, mp->rlen, mp->ftype, mp->flen, offset); } else { j = transfer((ANYTYPE *)&Inbuf[mp->roffset], mp->rtype, mp->rlen, mp->ftype, mp->flen, offset); } if (j) { /* bad ascii to numeric conversion or field length too small */ return (nferror(j, mp->paramname, &Inbuf[mp->roffset], locv(Tupcount), Relname, Filename, 0)); } *cp = save; /* restore the saved character */ offset += mp->flen; mp++; } Tupcount++; if (fwrite(Outbuf, 1, offset, File_iop) != offset) syserr("copy:cant write to user file %s", Filename); } if (i < 0) syserr("bad get from rel %d", i); return (0);}
开发者ID:jonathangray,项目名称:freebsd-1.x-ports,代码行数:60,
示例27: read_arg/*** READ_ARG -- Read a single argument from pipe**** An argument can be as simple as an integer, or as complex** as a query tree.**** Parameters:** ppb -- the pipe block to read from.** pparm -- the parameter descripter to put the** argument in.**** Returns:** none.**** Side Effects:** May allocate space from Qbuf for trees, etc.**** Called By:** readinput**** Trace Flags:** 10.6 - 10.7*/intread_arg(register pb_t *ppb, register paramv_t *pparm){ char ptype; short plen; register int i; register char *p; qtree_t *q; /* get the parameter type */ i = pb_get(ppb, &ptype, 1); if (i == 0) { pparm->pv_type = PV_EOF; pparm->pv_val.pv_str = NULL; return (PV_EOF); } i = pb_get(ppb, (char *) &plen, 2); if (i < 2) syserr("readarg: pb_get %d", i); /* figure out the type */ switch (ptype) { case PV_INT:#ifdef xCM_DEBUG if (plen != sizeof(pparm->pv_val.pv_int)) syserr("readinput: PV_INT %d", plen);#endif pb_get(ppb, (char *) &pparm->pv_val.pv_int, plen); break; case PV_STR: case PV_TUPLE: p = need(Qbuf, plen); pb_get(ppb, p, plen); pparm->pv_val.pv_str = p; break; case PV_QTREE: q = readqry(pb_get, (int) ppb, TRUE); pparm->pv_val.pv_qtree = q; break; case PV_EOF: /* this case is allowed for the mon-par interface */ break; default: syserr("readinput: type %d len %d", ptype, plen); } /* save the type & length */ pparm->pv_type = ptype; pparm->pv_len = plen; return (ptype);}
开发者ID:jonathangray,项目名称:freebsd-1.x-ports,代码行数:79,
示例28: mainint main(int argc, char* argv[]){ int sockfd, portno, n; struct hostent* server; struct sockaddr_in serv_addr; socklen_t addrlen; char buffer[256]; if(argc != 3) { fprintf(stderr, "Usage: %s <hostname> <port>/n", argv[0]); return 1; } server = gethostbyname(argv[1]); if(!server) { fprintf(stderr, "ERROR: no such host: %s/n", argv[1]); return 2; } portno = atoi(argv[2]); /*{ struct in_addr **addr_list; int i; printf("Official name is: %s/n", server->h_name); printf(" IP addresses: "); addr_list = (struct in_addr **)server->h_addr_list; for(i = 0; addr_list[i] != NULL; i++) { printf("%s ", inet_ntoa(*addr_list[i])); } printf("/n"); }*/ sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if(sockfd < 0) syserr("can't open socket"); printf("create socket.../n"); memset(&serv_addr, 0, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; serv_addr.sin_addr = *((struct in_addr*)server->h_addr); /*memcpy(&server->h_addr, &serv_addr.sin_addr.s_addr, server->h_length);*/ serv_addr.sin_port = htons(portno); printf("PLEASE ENTER MESSAGE: "); fgets(buffer, 255, stdin); n = strlen(buffer); if(n>0 && buffer[n-1] == '/n') buffer[n-1] = '/0'; addrlen = sizeof(serv_addr); n = sendto(sockfd, buffer, strlen(buffer), 0, (struct sockaddr*)&serv_addr, addrlen); if(n < 0) syserr("can't send to server"); printf("send.../n"); n = recvfrom(sockfd, buffer, 255, 0, (struct sockaddr*)&serv_addr, &addrlen); if(n < 0) syserr("can't receive from server"); printf("CLIENT RECEIVED MESSAGE: %s/n", buffer); close(sockfd); return 0;}
开发者ID:liuxfiu,项目名称:teach-CNT4713F14,代码行数:56,
示例29: freeServerIPCQueuesResources/* Free resources & destroy. */void freeServerIPCQueuesResources(sharedIPCQueueIds* queueIds) { if (msgctl(queueIds->initConnectionIPCQueueId, IPC_RMID, 0) == -1) syserr(IPC_QUEUE_REMOVE_OPERATION_ERROR_CODE); if (msgctl(queueIds->committeeDataIPCQueueId, IPC_RMID, 0) == -1) syserr(IPC_QUEUE_REMOVE_OPERATION_ERROR_CODE); if (msgctl(queueIds->finishIPCQueueId, IPC_RMID, 0) == -1) syserr(IPC_QUEUE_REMOVE_OPERATION_ERROR_CODE); if (msgctl(queueIds->reportDataIPCQueueId, IPC_RMID, 0) == -1) syserr(IPC_QUEUE_REMOVE_OPERATION_ERROR_CODE);}
开发者ID:mszeszko,项目名称:OS-Elections,代码行数:11,
示例30: socket_closevoid socket_close(socket s){ if (close(s.in_fd) == -1) { syserr("socket_close: cannot close in_fd"); } if (close(s.out_fd) == -1) { syserr("socket_close: cannot close out_fd"); }}
开发者ID:pawel-n,项目名称:so-zad1,代码行数:10,
注:本文中的syserr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ syserror函数代码示例 C++ sysdev_unregister函数代码示例 |