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


C++ ERR_EXIT函数代码示例

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


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

示例1: urg_handler

void urg_handler(int signo) {
	int n;
	char c;
	if ( (n = recv(server_fd, &c, 1, MSG_OOB)) < 0) {
		if (errno != EWOULDBLOCK) ERR_EXIT("recv error");
	}
	printf("receive heart beat packet from server\n");
	nprobes = 0;
	return ;
}
开发者ID:lidongmeng,项目名称:UNP,代码行数:10,代码来源:keepAliveClient.cpp

示例2: ERR_EXIT

InetAddress InetAddress::getLocalAddress(int sockfd)
{
    struct sockaddr_in addr;
    socklen_t len = sizeof addr;
    if(::getsockname(sockfd, (SA*)&addr, &len) == -1)
    {
        ERR_EXIT("getsockname");
    }
    return InetAddress(addr);
}
开发者ID:lvchao0428,项目名称:ultrapp,代码行数:10,代码来源:InetAddress.cpp

示例3: activate_oobinline

// 开启套接字fd接收带外数据的功能
void activate_oobinline(int fd)
{
	int oob_inline = 1;
	int ret;
	ret = setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, &oob_inline, sizeof(oob_inline));
	if (ret == -1)
	{
		ERR_EXIT("setsockopt");
	}
}
开发者ID:Tachone,项目名称:Tachftp,代码行数:11,代码来源:sysutil.c

示例4: main

int main(int argc, const char *argv[])
{
    int fd = open("3.txt", O_WRONLY | O_CREAT | O_EXCL, 0666);
    if(fd == -1)
        ERR_EXIT("open");
    char buf[1024] = "wang si ke shi yi ge hao gu niang.";
    write(fd, buf, sizeof(buf));
    close(fd);
    return 0;
}
开发者ID:ShiboBrady,项目名称:cpp,代码行数:10,代码来源:open4.c

示例5: main

int main(int argc, const char *argv[])
{
    int peerfd = socket(PF_INET, SOCK_STREAM, 0);
    if(peerfd == -1)
        ERR_EXIT("socket");

    struct sockaddr_in peeraddr;
    peeraddr.sin_family = AF_INET;
    peeraddr.sin_port = htons(8080);
    peeraddr.sin_addr.s_addr = inet_addr("127.0.0.1");

    if((connect(peerfd, (struct sockaddr*)&peeraddr, sizeof peeraddr)) < 0)
        ERR_EXIT("connect");

    do_service(peerfd);

    close(peerfd);
    return 0;
}
开发者ID:dasima,项目名称:WD,代码行数:19,代码来源:client.c

示例6: myftw

/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  myftw
 *  Description:  
 * =====================================================================================
 */
static int myftw(char *pathname,Myfunc *func){
    fullpath = malloc(sizeof(char)*pathlen);
    if(pathlen <= strlen(pathname)){
        pathlen = strlen(pathname) * 2;
        if((fullpath = realloc(fullpath,pathlen))==NULL)
            ERR_EXIT("relloc failed");
    }
    strcpy(fullpath,pathname);
    return(dopath(func));
}
开发者ID:jasonwust,项目名称:unix,代码行数:16,代码来源:4_22.c

示例7: main

int main(int argc, const char *argv[])
{
    if(signal(SIGPIPE, SIG_IGN) == SIG_ERR)
        ERR_EXIT("signal");
    int fd_server;
    preprocess(&fd_server);
    do_epoll(fd_server); 
    close(fd_server);
    return 0;
}
开发者ID:ShiboBrady,项目名称:cpp,代码行数:10,代码来源:server.c

示例8: TcpClient

int TcpClient(const char* host, uint64_t port)//return peerfd
{
	int peerfd = socket(PF_INET, SOCK_STREAM, 0);		
	if(peerfd == -1)
		ERR_EXIT("socket");	
	
	if(port == 0)//if port=0 then no need to bind
		return peerfd;
	SetAddReuse(peerfd, 1);//add reuse

	SAI addr;	
	memset(&addr, 0, sizeof addr);	
	addr.sin_family = AF_INET; 
	addr.sin_port = htons(port);
	addr.sin_addr.s_addr = inet_addr(host);
	if(bind(peerfd, (SA*)&addr, sizeof addr) == -1)
		ERR_EXIT("bind client");
	return peerfd;
}
开发者ID:presentzeng,项目名称:2014,代码行数:19,代码来源:tcp.c

示例9: SetPortReuse

void SetPortReuse(int sockfd, int optval)//port reuse
{
#ifdef SO_REUSEPORT
    int on = (optval != 0) ? 1 : 0;
    if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on)) < 0)
        ERR_EXIT("setsockopt SO_REUSEPORT");
#else
    fprintf(stderr, "SO_REUSEPORT is not supported.\n");
#endif //SO_REUSEPORT
}
开发者ID:presentzeng,项目名称:2014,代码行数:10,代码来源:tcp.c

示例10: dt_init

/*
 * Init dump tool backends
 */
void dt_init(void)
{
	struct dt *dt;
	int i = 0;

	while ((dt = dt_vec[i])) {
		g.fh = zg_open(g.opts.device, O_RDONLY, ZG_CHECK);
		if (!S_ISBLK(g.fh->sb.st_mode))
			ERR_EXIT("Please specify DASD or SCSI device node"
				 "(e.g. /dev/dasdd or /dev/sda )");
		if (dt->init() == 0) {
			l.dt = dt;
			return;
		}
		zg_close(g.fh);
		i++;
	}
	ERR_EXIT("No dump tool found on \"%s\"", g.opts.device);
}
开发者ID:hreinecke,项目名称:s390-tools,代码行数:22,代码来源:dt.c

示例11: main

int main(int argc, char *argv[])
{
	int msgid;
	msgid = msgget(1234, 0);
	if (msgid == -1)
		ERR_EXIT("msgget");

	echo_cli(msgid);
	return 0;
}
开发者ID:hzsunzixiang,项目名称:programming,代码行数:10,代码来源:echocli.c

示例12: set_minprivilage

void set_minprivilage(void)
{
    struct passwd* pwd = getpwnam("nobody");
    if ( NULL == pwd )
        ERR_EXIT("getpwnam error");
    if ( -1 == setegid(pwd->pw_gid))
        ERR_EXIT("setegid error"); 
    if ( -1 == seteuid(pwd->pw_uid))
        ERR_EXIT("seteuid error"); 

    struct __user_cap_header_struct cap_header;
    cap_header.version = _LINUX_CAPABILITY_VERSION_1;
    cap_header.pid = 0;
    struct __user_cap_data_struct cap_data;
    cap_data.effective = cap_data.permitted = 1 << CAP_NET_BIND_SERVICE;
    cap_data.inheritable = 0;
    if ( -1 == capset(&cap_header,&cap_data))
        ERR_EXIT("capset error");
}
开发者ID:icysunlight,项目名称:miniftpd,代码行数:19,代码来源:ftpnobody.c

示例13: main

int main(int argc, const char *argv[])
{
    int iret;
    if(argc == 1){
        ERR_EXIT("too few args");
    }else{
        iret = mkdir(argv[1], 0777);
    }
    return 0;
}
开发者ID:chenfan2014,项目名称:CFgit,代码行数:10,代码来源:my_mkdir.c

示例14: priv_sock_init

void priv_sock_init(session_t *sess)
{
    int fds[2];
    /* 创建一对UNIX域的套接字,用于进程间通信 */
    if(socketpair(PF_UNIX, SOCK_STREAM, 0, fds) == -1)
        ERR_EXIT("socketpair");

    sess->nobody_fd = fds[0];
    sess->proto_fd = fds[1];
}
开发者ID:chenhanzhun,项目名称:NetWorkProgramming,代码行数:10,代码来源:priv_sock.c

示例15: main

int main(int argc, const char *argv[])
{
    int fd = open("test.txt", O_RDONLY, 0666);
    if(fd == -1)
        ERR_EXIT("open");

    char buf[1024] = {0};
    int ret = read(fd, buf, 5);
    if(ret == -1)
        ERR_EXIT("read");
    printf("buf ---- %s\n", buf);

    off_t len = lseek(fd, 0, SEEK_CUR);
    printf("len ---- %d\n", (int)len);

    len = lseek(fd, 5, SEEK_CUR);
    printf("len ---- %d\n", (int)len);
    return 0;
}
开发者ID:dasima,项目名称:WD,代码行数:19,代码来源:hole1.c


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