set header flags in sf_proto_init_task_context

use_iouring
YuQing 2024-01-29 11:08:16 +08:00
parent 782697414d
commit e20a2c04c2
2 changed files with 12 additions and 12 deletions

12
make.sh
View File

@ -8,9 +8,9 @@ LIB_VERSION=lib64
DEBUG_FLAG=0 DEBUG_FLAG=0
if [ -f /usr/include/fastcommon/_os_define.h ]; then if [ -f /usr/include/fastcommon/_os_define.h ]; then
OS_BITS=$(fgrep OS_BITS /usr/include/fastcommon/_os_define.h | awk '{print $NF;}') OS_BITS=$(grep -F OS_BITS /usr/include/fastcommon/_os_define.h | awk '{print $NF;}')
elif [ -f /usr/local/include/fastcommon/_os_define.h ]; then elif [ -f /usr/local/include/fastcommon/_os_define.h ]; then
OS_BITS=$(fgrep OS_BITS /usr/local/include/fastcommon/_os_define.h | awk '{print $NF;}') OS_BITS=$(grep -F OS_BITS /usr/local/include/fastcommon/_os_define.h | awk '{print $NF;}')
else else
OS_BITS=64 OS_BITS=64
fi fi
@ -77,19 +77,19 @@ elif [ "$uname" = "HP-UX" ]; then
fi fi
elif [ "$uname" = "FreeBSD" ]; then elif [ "$uname" = "FreeBSD" ]; then
if [ -f /usr/lib/libc_r.so ]; then if [ -f /usr/lib/libc_r.so ]; then
line=$(nm -D /usr/lib/libc_r.so | grep pthread_create | grep -w T) line=$(nm -D /usr/lib/libc_r.so | grep -F pthread_create | grep -w T)
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
LIBS="$LIBS -lc_r" LIBS="$LIBS -lc_r"
have_pthread=1 have_pthread=1
fi fi
elif [ -f /lib64/libc_r.so ]; then elif [ -f /lib64/libc_r.so ]; then
line=$(nm -D /lib64/libc_r.so | grep pthread_create | grep -w T) line=$(nm -D /lib64/libc_r.so | grep -F pthread_create | grep -w T)
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
LIBS="$LIBS -lc_r" LIBS="$LIBS -lc_r"
have_pthread=1 have_pthread=1
fi fi
elif [ -f /usr/lib64/libc_r.so ]; then elif [ -f /usr/lib64/libc_r.so ]; then
line=$(nm -D /usr/lib64/libc_r.so | grep pthread_create | grep -w T) line=$(nm -D /usr/lib64/libc_r.so | grep -F pthread_create | grep -w T)
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
LIBS="$LIBS -lc_r" LIBS="$LIBS -lc_r"
have_pthread=1 have_pthread=1
@ -98,7 +98,7 @@ elif [ "$uname" = "FreeBSD" ]; then
fi fi
if [ $have_pthread -eq 0 ] && [ "$uname" = "Linux" ]; then if [ $have_pthread -eq 0 ] && [ "$uname" = "Linux" ]; then
/sbin/ldconfig -p | fgrep libpthread.so > /dev/null /sbin/ldconfig -p | grep -w libpthread.so > /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
LIBS="$LIBS -lpthread" LIBS="$LIBS -lpthread"
else else

View File

@ -68,19 +68,17 @@
#define SF_PROTO_MAGIC_PARAMS(m) \ #define SF_PROTO_MAGIC_PARAMS(m) \
m[0], m[1], m[2], m[3] m[0], m[1], m[2], m[3]
#define SF_PROTO_SET_HEADER(header, _cmd, _body_len) \ #define SF_PROTO_SET_HEADER_EX(header, _cmd, _flags, _body_len) \
do { \ do { \
SF_PROTO_SET_MAGIC((header)->magic); \ SF_PROTO_SET_MAGIC((header)->magic); \
(header)->cmd = _cmd; \ (header)->cmd = _cmd; \
(header)->status[0] = (header)->status[1] = 0; \ (header)->status[0] = (header)->status[1] = 0; \
short2buff(_flags, (header)->flags); \
int2buff(_body_len, (header)->body_len); \ int2buff(_body_len, (header)->body_len); \
} while (0) } while (0)
#define SF_PROTO_SET_HEADER_EX(header, _cmd, _flags, _body_len) \ #define SF_PROTO_SET_HEADER(header, _cmd, _body_len) \
do { \ SF_PROTO_SET_HEADER_EX(header, _cmd, 0, _body_len)
SF_PROTO_SET_HEADER(header, _cmd, _body_len); \
short2buff(_flags, (header)->flags); \
} while (0)
#define SF_PROTO_SET_RESPONSE_HEADER(proto_header, resp_header) \ #define SF_PROTO_SET_RESPONSE_HEADER(proto_header, resp_header) \
do { \ do { \
@ -320,6 +318,8 @@ static inline void sf_proto_init_task_context(struct fast_task_info *task,
ctx->request.header.body_len = SF_RECV_BODY_LENGTH(task); ctx->request.header.body_len = SF_RECV_BODY_LENGTH(task);
ctx->request.header.status = buff2short(((SFCommonProtoHeader *) ctx->request.header.status = buff2short(((SFCommonProtoHeader *)
task->recv.ptr->data)->status); task->recv.ptr->data)->status);
ctx->request.header.flags = buff2short(((SFCommonProtoHeader *)
task->recv.ptr->data)->flags);
if (task->recv_body != NULL) { if (task->recv_body != NULL) {
ctx->request.body = task->recv_body; ctx->request.body = task->recv_body;
} else { } else {