Fiexd some build errors ubuntu 22.04 (kernel:5.19.0-1025, gcc:11.4.0),

Ref #777.
This commit is contained in:
fengbojiang 2023-08-14 20:42:34 +08:00
parent 8471eecb32
commit 0ee517ed0a
4 changed files with 21 additions and 6 deletions

View File

@ -90,8 +90,8 @@ libff_syscall.so: ${FF_SYSCALL_OBJS}
${CC} -fPIC -shared -o $@ $^ ${FF_SYSCALL_LIBS} ${DPDK_LIBS}
example:
cc ${CFLAGS} -I ${FF_PATH}/adapter/syscall -L ${FF_PATH}/adapter/syscall -lff_syscall -o helloworld_stack main_stack.c ${LIBS}
cc ${CFLAGS} -I ${FF_PATH}/adapter/syscall -L ${FF_PATH}/adapter/syscall -lff_syscall -o helloworld_stack_thread_socket main_stack_thread_socket.c ${LIBS}
cc ${CFLAGS} -I ${FF_PATH}/adapter/syscall -o helloworld_stack main_stack.c -L ${FF_PATH}/adapter/syscall -lff_syscall ${LIBS}
cc ${CFLAGS} -I ${FF_PATH}/adapter/syscall -o helloworld_stack_thread_socket main_stack_thread_socket.c -L ${FF_PATH}/adapter/syscall -lff_syscall ${LIBS}
cc ${CFLAGS} -I ${FF_PATH}/adapter/syscall -o helloworld_stack_epoll main_stack_epoll.c ${LIBS}
cc ${CFLAGS} -I ${FF_PATH}/adapter/syscall -o helloworld_stack_epoll_thread_socket main_stack_epoll_thread_socket.c ${LIBS}
cc ${CFLAGS} -I ${FF_PATH}/adapter/syscall -o helloworld_stack_epoll_kernel main_stack_epoll_kernel.c ${LIBS}

View File

@ -116,7 +116,12 @@ void *loop(void *arg)
char buf[256];
size_t readlen = read( events[i].data.fd, buf, sizeof(buf));
if(readlen > 0) {
write( events[i].data.fd, html, sizeof(html) - 1);
ssize_t writelen = write( events[i].data.fd, html, sizeof(html) - 1);
if (writelen < 0){
printf("write failed, readlen:%lu, writelen:%lu, :%d, %s\n",
readlen, writelen, errno, strerror(errno));
close(events[i].data.fd);
}
} else {
epoll_ctl(epfd, EPOLL_CTL_DEL, events[i].data.fd, NULL);
close(events[i].data.fd);

View File

@ -122,7 +122,12 @@ void *loop(void *arg)
char buf[256];
size_t readlen = read( events[i].data.fd, buf, sizeof(buf));
if(readlen > 0) {
write( events[i].data.fd, html, sizeof(html) - 1);
size_t writelen = write( events[i].data.fd, html, sizeof(html) - 1);
if (writelen < 0){
printf("write failed, readlen:%lu, writelen:%lu, :%d, %s\n",
readlen, writelen, errno, strerror(errno));
close(events[i].data.fd);
}
} else {
epoll_ctl(epfd, EPOLL_CTL_DEL, events[i].data.fd, NULL);
close(events[i].data.fd);

View File

@ -75,7 +75,7 @@ void *loop(void *arg)
thread_id = *(int *)arg;
printf("start thread %d\n", thread_id);
sockfd = socket(AF_INET, SOCK_STREAM | SOCK_FSTACK, 0);
printf("thread %d, sockfd:%d\n", thread_id, sockfd);
if (sockfd < 0) {
@ -184,7 +184,12 @@ void *loop(void *arg)
char buf[256];
size_t readlen = read( events[i].data.fd, buf, sizeof(buf));
if(readlen > 0) {
write( events[i].data.fd, html, sizeof(html) - 1);
size_t writelen = write( events[i].data.fd, html, sizeof(html) - 1);
if (writelen < 0){
printf("write failed, readlen:%lu, writelen:%lu, :%d, %s\n",
readlen, writelen, errno, strerror(errno));
close(events[i].data.fd);
}
} else {
epoll_ctl(epfd, EPOLL_CTL_DEL, events[i].data.fd, NULL);
close(events[i].data.fd);