From e20a2c04c29ba2af76b2154b6765febcc94504bd Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Mon, 29 Jan 2024 11:08:16 +0800 Subject: [PATCH] set header flags in sf_proto_init_task_context --- make.sh | 12 ++++++------ src/sf_proto.h | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/make.sh b/make.sh index f9a5b33..153c281 100755 --- a/make.sh +++ b/make.sh @@ -8,9 +8,9 @@ LIB_VERSION=lib64 DEBUG_FLAG=0 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 - 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 OS_BITS=64 fi @@ -77,19 +77,19 @@ elif [ "$uname" = "HP-UX" ]; then fi elif [ "$uname" = "FreeBSD" ]; 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 LIBS="$LIBS -lc_r" have_pthread=1 fi 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 LIBS="$LIBS -lc_r" have_pthread=1 fi 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 LIBS="$LIBS -lc_r" have_pthread=1 @@ -98,7 +98,7 @@ elif [ "$uname" = "FreeBSD" ]; then fi 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 LIBS="$LIBS -lpthread" else diff --git a/src/sf_proto.h b/src/sf_proto.h index dd63dce..bea8a49 100644 --- a/src/sf_proto.h +++ b/src/sf_proto.h @@ -68,19 +68,17 @@ #define SF_PROTO_MAGIC_PARAMS(m) \ 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 { \ SF_PROTO_SET_MAGIC((header)->magic); \ (header)->cmd = _cmd; \ (header)->status[0] = (header)->status[1] = 0; \ + short2buff(_flags, (header)->flags); \ int2buff(_body_len, (header)->body_len); \ } while (0) -#define SF_PROTO_SET_HEADER_EX(header, _cmd, _flags, _body_len) \ - do { \ - SF_PROTO_SET_HEADER(header, _cmd, _body_len); \ - short2buff(_flags, (header)->flags); \ - } while (0) +#define SF_PROTO_SET_HEADER(header, _cmd, _body_len) \ + SF_PROTO_SET_HEADER_EX(header, _cmd, 0, _body_len) #define SF_PROTO_SET_RESPONSE_HEADER(proto_header, resp_header) \ 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.status = buff2short(((SFCommonProtoHeader *) task->recv.ptr->data)->status); + ctx->request.header.flags = buff2short(((SFCommonProtoHeader *) + task->recv.ptr->data)->flags); if (task->recv_body != NULL) { ctx->request.body = task->recv_body; } else {