This commit is contained in:
Shengliang Guan 2021-01-16 23:16:17 +08:00
parent 65a28796cd
commit 3998f0895e
3 changed files with 38 additions and 5 deletions

View File

@ -191,6 +191,8 @@ int gettimeofday(struct timeval *ptv, void *pTimeZone);
#define PATH_MAX 256 #define PATH_MAX 256
#endif #endif
#define TAOS_OS_FUNC_SIGNAL
typedef struct { typedef struct {
int we_wordc; int we_wordc;
char **we_wordv; char **we_wordv;

View File

@ -77,7 +77,8 @@ int64_t taosFSendFile(FILE *out_file, FILE *in_file, int64_t *offset, int64_t co
} }
int64_t taosSendFile(SOCKET dfd, int32_t sfd, int64_t *offset, int64_t count) { int64_t taosSendFile(SOCKET dfd, int32_t sfd, int64_t *offset, int64_t count) {
lseek(sfd, (int32_t)(*offset), 0); if (offset != NULL) lseek(sfd, (int32_t)(*offset), 0);
int64_t writeLen = 0; int64_t writeLen = 0;
uint8_t buffer[_SEND_FILE_STEP_] = {0}; uint8_t buffer[_SEND_FILE_STEP_] = {0};
@ -168,7 +169,6 @@ int fsync(int filedes) {
} }
HANDLE h = (HANDLE)_get_osfhandle(filedes); HANDLE h = (HANDLE)_get_osfhandle(filedes);
FlushFileBuffers(h);
return FlushFileBuffers(h);
return 0; }
}

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include <signal.h>
void taosSetSignal(int32_t signum, FSignalHandler sigfp) {
if (signum == SIGUSR1) return;
signal(signum, sigfp);
}
void taosIgnSignal(int32_t signum) {
signal(signum, SIG_IGN);
}
void taosDflSignal(int32_t signum) {
signal(signum, SIG_DFL);
}