| 1 | /* |
| 2 | Copyright (C) 2009-2018 Brazil |
| 3 | Copyright (C) 2018-2026 Sutou Kouhei <[email protected]> |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #include <string.h> |
| 21 | #include <stdio.h> |
| 22 | #include <ctype.h> |
| 23 | #include <fcntl.h> |
| 24 | #include <sys/stat.h> |
| 25 | #include <errno.h> |
| 26 | |
| 27 | #ifdef WIN32 |
| 28 | # define GROONGA_MAIN |
| 29 | #endif /* WIN32 */ |
| 30 | #include <grn.h>cxx . . $ `<file>/lib/grn.h`/ |
| 31 | |
| 32 | #include <grn_com.h>cxx . . $ `<file>/lib/grn_com.h`/ |
| 33 | #include <grn_ctx_impl.h>cxx . . $ `<file>/lib/grn_ctx_impl.h`/ |
| 34 | #include <grn_proc.h>cxx . . $ `<file>/lib/grn_proc.h`/ |
| 35 | #include <grn_db.h>cxx . . $ `<file>/lib/grn_db.h`/ |
| 36 | #include <grn_util.h>cxx . . $ `<file>/lib/grn_util.h`/ |
| 37 | #include <grn_error.h>cxx . . $ `<file>/lib/grn_error.h`/ |
| 38 | |
| 39 | #ifdef HAVE_SYS_WAIT_Hcxx . . $ `build/config.h:143:9`! |
| 40 | # include <sys/wait.h> |
| 41 | #endif /* HAVE_SYS_WAIT_H */ |
| 42 | #ifdef HAVE_SYS_SOCKET_Hcxx . . $ `build/config.h:139:9`! |
| 43 | # include <sys/socket.h> |
| 44 | #endif /* HAVE_SYS_SOCKET_H */ |
| 45 | #ifndef WIN32 |
| 46 | # include <netinet/in.h> |
| 47 | #endif /* WIN32 */ |
| 48 | |
| 49 | #ifdef HAVE_SYS_RESOURCE_Hcxx . . $ `build/config.h:137:9`! |
| 50 | # include <sys/resource.h> |
| 51 | #endif /* HAVE_SYS_RESOURCE_H */ |
| 52 | |
| 53 | #ifdef WIN32 |
| 54 | # include <io.h> |
| 55 | # include <direct.h> |
| 56 | #else /* WIN32 */ |
| 57 | # include <sys/uio.h> |
| 58 | #endif /* WIN32 */ |
| 59 | |
| 60 | #if !defined(WIN32) && defined(HAVE_SIGNAL_Hcxx . . $ `build/config.h:134:9`!) |
| 61 | # define ENABLE_LOG_REOPEN_BY_SIGNALcxx . . $ `src/groonga.c:61:11`! |
| 62 | #endif |
| 63 | |
| 64 | #ifdef ENABLE_LOG_REOPEN_BY_SIGNALcxx . . $ `src/groonga.c:61:11`! |
| 65 | # include <signal.h> |
| 66 | #endif |
| 67 | |
| 68 | #ifndef USE_MSG_NOSIGNAL |
| 69 | # ifdef MSG_NOSIGNALcxx . . $ `<external>/8962547315054503424/socket.h:242:9`! |
| 70 | # undef MSG_NOSIGNALcxx . . $ `<external>/8962547315054503424/socket.h:242:9`! |
| 71 | # endif |
| 72 | # define MSG_NOSIGNALcxx . . $ `src/groonga.c:72:11`! 0 |
| 73 | #endif /* USE_MSG_NOSIGNAL */ |
| 74 | |
| 75 | #ifndef STDIN_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:210:9`! |
| 76 | # define STDIN_FILENO 0 |
| 77 | #endif /* STDIN_FILENO */ |
| 78 | #ifndef STDOUT_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:211:9`! |
| 79 | # define STDOUT_FILENO 1 |
| 80 | #endif /* STDOUT_FILENO */ |
| 81 | #ifndef STDERR_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:212:9`! |
| 82 | # define STDERR_FILENO 2 |
| 83 | #endif /* STDERR_FILENO */ |
| 84 | |
| 85 | #define DEFAULT_HTTP_PORTcxx . . $ `src/groonga.c:85:9`! 10041 |
| 86 | #define DEFAULT_GQTP_PORTcxx . . $ `src/groonga.c:86:9`! 10043 |
| 87 | #define DEFAULT_DESTcxx . . $ `src/groonga.c:87:9`! "localhost" |
| 88 | #define DEFAULT_MAX_N_FLOATING_THREADScxx . . $ `src/groonga.c:88:9`! 8 |
| 89 | #define MAX_CONcxx . . $ `src/groonga.c:89:9`! 0x10000 |
| 90 | |
| 91 | #define RLIMIT_NOFILE_MINIMUMcxx . . $ `src/groonga.c:91:9`! 4096 |
| 92 | |
| 93 | static char bind_addresscxx . . $ bind_address.[HOST_NAME_MAXcxx . . $ `<external>/2191589805780913682/local_lim.h:93:9`! + 1]; |
| 94 | static char hostnamecxx . . $ hostname.[HOST_NAME_MAXcxx . . $ `<external>/2191589805780913682/local_lim.h:93:9`! + 1]; |
| 95 | static int portcxx . . $ port. = DEFAULT_GQTP_PORTcxx . . $ `src/groonga.c:86:9`!; |
| 96 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! batchmodecxx . . $ batchmode. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 97 | static int number_of_linescxx . . $ number_of_lines. = 0; |
| 98 | static int newdbcxx . . $ newdb.; |
| 99 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_daemon_modecxx . . $ is_daemon_mode. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 100 | static int listen_backlogcxx . . $ listen_backlog. = GRN_COM_EVENT_LISTEN_BACKLOG_DEFAULTcxx . . $ `lib/grn_com.h:95:9`!; |
| 101 | static int (*do_clientcxx . . $ do_client.)(int argc, char **argv); |
| 102 | static int (*do_servercxx . . $ do_server.)(char *path); |
| 103 | static const char *pid_file_pathcxx . . $ pid_file_path. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 104 | static const char *input_pathcxx . . $ input_path. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 105 | static grn_file_readercxx . . $ grn_file_reader# *input_readercxx . . $ input_reader. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 106 | static FILEcxx . . $ FILE# *outputcxx . . $ output. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 107 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_memcached_modecxx . . $ is_memcached_mode. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 108 | static const char *memcached_column_namecxx . . $ memcached_column_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 109 | |
| 110 | static int ready_notify_pipecxx . . $ ready_notify_pipe.[2]; |
| 111 | #define PIPE_READcxx . . $ `src/groonga.c:111:9`! 0 |
| 112 | #define PIPE_WRITEcxx . . $ `src/groonga.c:112:9`! 1 |
| 113 | |
| 114 | static grn_encodingcxx . . $ grn_encoding# encodingcxx . . $ encoding.; |
| 115 | static const char *windows_event_source_namecxx . . $ windows_event_source_name. = "Groonga"; |
| 116 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! use_windows_event_logcxx . . $ use_windows_event_log. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 117 | static grn_objcxx . . $ grn_obj# http_response_server_linecxx . . $ http_response_server_line.; |
| 118 | static grn_wal_rolecxx . . $ grn_wal_role# wal_rolecxx . . $ wal_role. = GRN_WAL_ROLE_NONEcxx . . $ GRN_WAL_ROLE_NONE.; |
| 119 | static grn_wal_rolecxx . . $ grn_wal_role# worker_wal_rolecxx . . $ worker_wal_role. = GRN_WAL_ROLE_NONEcxx . . $ GRN_WAL_ROLE_NONE.; |
| 120 | |
| 121 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! running_event_loopcxx . . $ running_event_loop. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 122 | |
| 123 | #ifdef ENABLE_LOG_REOPEN_BY_SIGNALcxx . . $ `src/groonga.c:61:11`! |
| 124 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! usr1_receivedcxx . . $ usr1_received. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 125 | |
| 126 | static void |
| 127 | usr1_handlercxx . . $ usr1_handler(35b49605a50c0d85).(int signal_number, siginfo_tcxx . . $ siginfo_t# *info, void *context) |
| 128 | { |
| 129 | usr1_receivedcxx . . $ usr1_received. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 130 | } |
| 131 | |
| 132 | static void |
| 133 | set_usr1_handlercxx . . $ set_usr1_handler(49f6e7a06ebc5aa8).(void) |
| 134 | { |
| 135 | struct sigactioncxx . . $ sigaction# action; |
| 136 | sigemptysetcxx . . $ sigemptyset(f9c066a8ff75ee9d).(&action.sa_maskcxx . . $ sigaction#sa_mask.); |
| 137 | action.sa_sigactioncxx . . $ `<external>/16635209305659446502/sigaction.h:40:10`! = usr1_handlercxx . . $ usr1_handler(35b49605a50c0d85).; |
| 138 | action.sa_flagscxx . . $ sigaction#sa_flags. = SA_SIGINFOcxx . . $ `<external>/16635209305659446502/sigaction.h:58:9`! | SA_ONSTACKcxx . . $ `<external>/16635209305659446502/sigaction.h:61:10`!; |
| 139 | sigactioncxx . . $ sigaction(53aba09fe16b06c7).(SIGUSR1cxx . . $ `<external>/1457673850468744829/signum-arch.h:49:9`!, &action, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 140 | } |
| 141 | |
| 142 | static void |
| 143 | reopen_log_by_signalcxx . . $ reopen_log_by_signal(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 144 | { |
| 145 | if (!usr1_receivedcxx . . $ usr1_received.) { |
| 146 | return; |
| 147 | } |
| 148 | |
| 149 | usr1_receivedcxx . . $ usr1_received. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 150 | grn_log_reopencxx . . $ grn_log_reopen(b578cd6e53d5fe91).(ctx); |
| 151 | } |
| 152 | #endif |
| 153 | |
| 154 | static int |
| 155 | grn_rc_to_exit_codecxx . . $ grn_rc_to_exit_code(b9a95f6671185517).(grn_rccxx . . $ grn_rc# rc) |
| 156 | { |
| 157 | if (rc == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 158 | return EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!; |
| 159 | } else { |
| 160 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | static void |
| 165 | break_accept_event_loopcxx . . $ break_accept_event_loop(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 166 | { |
| 167 | grn_comcxx . . $ grn_com# *client; |
| 168 | const char *address; |
| 169 | |
| 170 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(bind_addresscxx . . $ bind_address., "0.0.0.0") == 0) { |
| 171 | address = "127.0.0.1"; |
| 172 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(bind_addresscxx . . $ bind_address., "::") == 0) { |
| 173 | address = "::1"; |
| 174 | } else { |
| 175 | address = bind_addresscxx . . $ bind_address.; |
| 176 | } |
| 177 | client = grn_com_copencxx . . $ grn_com_copen(99562373e8fbda4e).(ctx, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, address, portcxx . . $ port.); |
| 178 | if (client) { |
| 179 | grn_com_closecxx . . $ grn_com_close(316fe94cc3b95f73).(ctx, client); |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | #ifdef GRN_WITH_LIBEDITcxx . . $ `build/config.h:103:9`! |
| 184 | # include <locale.h> |
| 185 | # include <histedit.h> |
| 186 | static EditLinecxx . . $ EditLine# *line_editorcxx . . $ line_editor. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 187 | static HistoryWcxx . . $ HistoryW# *line_editor_historycxx . . $ line_editor_history. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 188 | static HistEventWcxx . . $ HistEventW# line_editor_history_eventcxx . . $ line_editor_history_event.; |
| 189 | static char line_editor_history_pathcxx . . $ line_editor_history_path.[PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!] = ""; |
| 190 | |
| 191 | static const wchar_t * |
| 192 | line_editor_promptcxx . . $ line_editor_prompt(2a5cc1a3fbd876ab).(EditLinecxx . . $ EditLine# *e __attribute__((unused))) |
| 193 | { |
| 194 | return L"> "; |
| 195 | } |
| 196 | static const wchar_t *const line_editor_editorcxx . . $ line_editor_editor. = L"emacs"; |
| 197 | |
| 198 | static void |
| 199 | line_editor_initcxx . . $ line_editor_init(c759356ac01a31e7).(int argc __attribute__((unused)), char *argv[]) |
| 200 | { |
| 201 | const char *const HOME_PATH = getenvcxx . . $ getenv(a8b8e32347182212).("HOME"); |
| 202 | const char *const HISTORY_PATH = "/.groonga-history"; |
| 203 | |
| 204 | setlocalecxx . . $ setlocale(10ed28bce9115888).(LC_ALLcxx . . $ `<external>/3736975272097309885/locale.h:41:9`!, ""); |
| 205 | |
| 206 | if (strlencxx . . $ strlen(751346f8406fd082).(HOME_PATH) + strlencxx . . $ strlen(751346f8406fd082).(HISTORY_PATH) < PATH_MAXcxx . . $ `<external>/6347054901304145714/limits.h:13:9`!) { |
| 207 | grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!(line_editor_history_path, PATH_MAX, HOME_PATH); |
| 208 | grn_strcatcxx . . $ `include/groonga/portability.h:114:11`!(line_editor_history_path, PATH_MAX, HISTORY_PATH); |
| 209 | } else { |
| 210 | line_editor_history_pathcxx . . $ line_editor_history_path.[0] = '\0'; |
| 211 | } |
| 212 | |
| 213 | line_editor_historycxx . . $ line_editor_history. = history_winitcxx . . $ history_winit(a6f49200bee502be).(); |
| 214 | history_wcxx . . $ history_w(53f4355e15239b75).(line_editor_historycxx . . $ line_editor_history., &line_editor_history_eventcxx . . $ line_editor_history_event., H_SETSIZEcxx . . $ `<external>/1387195958683623002/histedit.h:208:9`!, 200); |
| 215 | if (line_editor_history_pathcxx . . $ line_editor_history_path.[0]) { |
| 216 | history_wcxx . . $ history_w(53f4355e15239b75).(line_editor_historycxx . . $ line_editor_history., |
| 217 | &line_editor_history_eventcxx . . $ line_editor_history_event., |
| 218 | H_LOADcxx . . $ `<external>/1387195958683623002/histedit.h:224:9`!, |
| 219 | line_editor_history_pathcxx . . $ line_editor_history_path.); |
| 220 | } |
| 221 | |
| 222 | line_editorcxx . . $ line_editor. = el_initcxx . . $ el_init(33f2b689eb47c35b).(argv[0], stdincxx . . $ `<external>/232824719582829767/stdio.h:157:9`!, stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!); |
| 223 | el_wsetcxx . . $ el_wset(f8dcd805b2b304e).(line_editorcxx . . $ line_editor., EL_PROMPTcxx . . $ `<external>/1387195958683623002/histedit.h:135:9`!, &line_editor_promptcxx . . $ line_editor_prompt(2a5cc1a3fbd876ab).); |
| 224 | el_wsetcxx . . $ el_wset(f8dcd805b2b304e).(line_editorcxx . . $ line_editor., EL_EDITORcxx . . $ `<external>/1387195958683623002/histedit.h:137:9`!, line_editor_editorcxx . . $ line_editor_editor.); |
| 225 | el_wsetcxx . . $ el_wset(f8dcd805b2b304e).(line_editorcxx . . $ line_editor., EL_HISTcxx . . $ `<external>/1387195958683623002/histedit.h:146:9`!, history_wcxx . . $ history_w(53f4355e15239b75)., line_editor_historycxx . . $ line_editor_history.); |
| 226 | el_sourcecxx . . $ el_source(c6c5de95499ae8ad).(line_editorcxx . . $ line_editor., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 227 | } |
| 228 | |
| 229 | static void |
| 230 | line_editor_fincxx . . $ line_editor_fin(49f6e7a06ebc5aa8).(void) |
| 231 | { |
| 232 | if (line_editorcxx . . $ line_editor.) { |
| 233 | el_endcxx . . $ el_end(f3e99368cfa6432b).(line_editorcxx . . $ line_editor.); |
| 234 | if (line_editor_historycxx . . $ line_editor_history.) { |
| 235 | if (line_editor_history_pathcxx . . $ line_editor_history_path.[0]) { |
| 236 | history_wcxx . . $ history_w(53f4355e15239b75).(line_editor_historycxx . . $ line_editor_history., |
| 237 | &line_editor_history_eventcxx . . $ line_editor_history_event., |
| 238 | H_SAVEcxx . . $ `<external>/1387195958683623002/histedit.h:225:9`!, |
| 239 | line_editor_history_pathcxx . . $ line_editor_history_path.); |
| 240 | } |
| 241 | history_wendcxx . . $ history_wend(1938fdd63a4f8ebc).(line_editor_historycxx . . $ line_editor_history.); |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | static grn_rccxx . . $ grn_rc# |
| 247 | line_editor_fgetscxx . . $ line_editor_fgets(4865d068a46d0f83).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf) |
| 248 | { |
| 249 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 250 | const wchar_t *line; |
| 251 | int nchar; |
| 252 | line = el_wgetscxx . . $ el_wgets(e477466a8654833f).(line_editorcxx . . $ line_editor., &nchar); |
| 253 | if (nchar > 0) { |
| 254 | int i; |
| 255 | char multibyte_buf[MB_CUR_MAXcxx . . $ `<external>/10696550936717951914/stdlib.h:101:9`!]; |
| 256 | size_tcxx . . $ size_t# multibyte_len; |
| 257 | mbstate_tcxx . . $ mbstate_t# ps; |
| 258 | history_wcxx . . $ history_w(53f4355e15239b75).(line_editor_historycxx . . $ line_editor_history., &line_editor_history_eventcxx . . $ line_editor_history_event., H_ENTERcxx . . $ `<external>/1387195958683623002/histedit.h:217:9`!, line); |
| 259 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&ps, 0, sizeof(ps)); |
| 260 | for (i = 0; i < nchar; i++) { |
| 261 | multibyte_len = wcrtombcxx . . $ wcrtomb(2e9d408bebe9fe2b).(multibyte_buf, line[i], &ps); |
| 262 | if (multibyte_len == (size_tcxx . . $ size_t#)-1) { |
| 263 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, |
| 264 | GRN_LOG_WARNING, |
| 265 | "[prompt][libedit] failed to read input: %s", |
| 266 | strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 267 | rc = GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.; |
| 268 | } else { |
| 269 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, buf, multibyte_buf, multibyte_len); |
| 270 | } |
| 271 | } |
| 272 | } else { |
| 273 | rc = GRN_END_OF_DATAcxx . . $ GRN_END_OF_DATA.; |
| 274 | } |
| 275 | return rc; |
| 276 | } |
| 277 | #endif /* GRN_WITH_LIBEDIT */ |
| 278 | |
| 279 | static inline grn_rccxx . . $ grn_rc# |
| 280 | read_next_linecxx . . $ read_next_line(4865d068a46d0f83).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf) |
| 281 | { |
| 282 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! the_first_read = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 283 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 284 | if (!batchmodecxx . . $ batchmode.) { |
| 285 | #ifdef GRN_WITH_LIBEDITcxx . . $ `build/config.h:103:9`! |
| 286 | rc = line_editor_fgetscxx . . $ line_editor_fgets(4865d068a46d0f83).(ctx, buf); |
| 287 | #else |
| 288 | fprintf(stderr, "> "); |
| 289 | fflush(stderr); |
| 290 | rc = grn_file_reader_read_line(ctx, input_reader, buf); |
| 291 | #endif |
| 292 | } else { |
| 293 | rc = grn_file_reader_read_linecxx . . $ grn_file_reader_read_line(d4c727e0d06e40af).(ctx, input_readercxx . . $ input_reader., buf); |
| 294 | if (rc != GRN_END_OF_DATAcxx . . $ GRN_END_OF_DATA.) { |
| 295 | number_of_linescxx . . $ number_of_lines.++; |
| 296 | } |
| 297 | } |
| 298 | if (the_first_read && GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf) > 0) { |
| 299 | const char bom[] = {0xef, 0xbb, 0xbf}; |
| 300 | if (GRN_CTX_GET_ENCODINGcxx . . $ `include/groonga/groonga.h:470:9`!(ctx) == GRN_ENC_UTF8cxx . . $ GRN_ENC_UTF8. && GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf) > 3 && |
| 301 | !memcmpcxx . . $ memcmp(36f949851efa3055).(GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(buf), bom, 3)) { |
| 302 | grn_objcxx . . $ grn_obj# buf_without_bom; |
| 303 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&buf_without_bom, 0); |
| 304 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, |
| 305 | &buf_without_bom, |
| 306 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(buf) + 3, |
| 307 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf) - 3); |
| 308 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, |
| 309 | buf, |
| 310 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&buf_without_bom), |
| 311 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&buf_without_bom)); |
| 312 | grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, &buf_without_bom); |
| 313 | } |
| 314 | the_first_read = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 315 | } |
| 316 | if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf) > 0 && |
| 317 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(buf)[GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf) - 1] == '\n') { |
| 318 | grn_bulk_truncatecxx . . $ grn_bulk_truncate(f9a66385f261f61d).(ctx, buf, GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf) - 1); |
| 319 | } |
| 320 | if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf) > 0 && |
| 321 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(buf)[GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf) - 1] == '\r') { |
| 322 | grn_bulk_truncatecxx . . $ grn_bulk_truncate(f9a66385f261f61d).(ctx, buf, GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf) - 1); |
| 323 | } |
| 324 | return rc; |
| 325 | } |
| 326 | |
| 327 | static inline grn_rccxx . . $ grn_rc# |
| 328 | promptcxx . . $ prompt(4865d068a46d0f83).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf) |
| 329 | { |
| 330 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 331 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(buf); |
| 332 | while (rc == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 333 | rc = read_next_linecxx . . $ read_next_line(4865d068a46d0f83).(ctx, buf); |
| 334 | if (rc == GRN_SUCCESScxx . . $ GRN_SUCCESS. && GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf) > 0 && |
| 335 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(buf)[GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf) - 1] == '\\') { |
| 336 | rc = grn_bulk_truncatecxx . . $ grn_bulk_truncate(f9a66385f261f61d).(ctx, buf, GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(buf) - 1); |
| 337 | } else { |
| 338 | break; |
| 339 | } |
| 340 | } |
| 341 | return rc; |
| 342 | } |
| 343 | |
| 344 | static void |
| 345 | output_envelopecxx . . $ output_envelope(aa1eebc7c39b83c).( |
| 346 | grn_ctxcxx . . $ grn_ctx# *ctx, grn_rccxx . . $ grn_rc# rc, grn_objcxx . . $ grn_obj# *head, grn_objcxx . . $ grn_obj# *body, grn_objcxx . . $ grn_obj# *foot) |
| 347 | { |
| 348 | grn_output_envelopecxx . . $ grn_output_envelope(b399116c84ab1ed4).(ctx, rc, head, body, foot, input_pathcxx . . $ input_path., number_of_linescxx . . $ number_of_lines.); |
| 349 | } |
| 350 | |
| 351 | static void |
| 352 | ensure_writecxx . . $ ensure_write(73fb6c062b1c53ff).(grn_ctxcxx . . $ grn_ctx# *ctx, FILEcxx . . $ FILE# *output, const char *data, size_tcxx . . $ size_t# size) |
| 353 | { |
| 354 | const char *rest_data = data; |
| 355 | size_tcxx . . $ size_t# rest_size = size; |
| 356 | while (rest_size > 0) { |
| 357 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0; |
| 358 | size_tcxx . . $ size_t# written = fwritecxx . . $ fwrite(ab0609fa07c47d6e).(rest_data, 1, rest_size, output); |
| 359 | if (!(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! == 0 || errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! == EAGAINcxx . . $ `<external>/8987895939074593727/errno-base.h:15:9`! || errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! == EWOULDBLOCKcxx . . $ `<external>/17922322188510340118/errno.h:22:9`!)) { |
| 360 | SERRcxx . . $ `lib/grn_error.h:411:11`!("fwrite"); |
| 361 | break; |
| 362 | } |
| 363 | rest_data += written; |
| 364 | rest_size -= written; |
| 365 | if (rest_size > 0) { |
| 366 | fflushcxx . . $ fflush(89bc1efcdac0ca22).(output); |
| 367 | } |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | typedef structcxx . . $ $anonymous_type_1ab89eed5889867_0# { |
| 372 | FILEcxx . . $ FILE# *outputcxx . . $ $anonymous_type_1ab89eed5889867_0#output.; |
| 373 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_outputtingcxx . . $ $anonymous_type_1ab89eed5889867_0#is_outputting.; |
| 374 | } standalone_output_contextcxx . . $ standalone_output_context#; |
| 375 | |
| 376 | static void |
| 377 | s_output_rawcxx . . $ s_output_raw(60bff85a906f598f).(grn_ctxcxx . . $ grn_ctx# *ctx, int flags, standalone_output_contextcxx . . $ standalone_output_context# *output_context) |
| 378 | { |
| 379 | FILEcxx . . $ FILE# *stream = output_context->outputcxx . . $ $anonymous_type_1ab89eed5889867_0#output.; |
| 380 | char *chunk = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 381 | unsigned int chunk_size = 0; |
| 382 | int recv_flags; |
| 383 | size_tcxx . . $ size_t# written = 0; |
| 384 | |
| 385 | grn_ctx_recvcxx . . $ grn_ctx_recv(8b5d6c8a2a7bb976).(ctx, &chunk, &chunk_size, &recv_flags); |
| 386 | if (chunk_size > 0) { |
| 387 | ensure_writecxx . . $ ensure_write(73fb6c062b1c53ff).(ctx, stream, chunk, chunk_size); |
| 388 | written += chunk_size; |
| 389 | } |
| 390 | |
| 391 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_last_message = (flags & GRN_CTX_TAILcxx . . $ `include/groonga/groonga.h:3294:9`!); |
| 392 | if (is_last_message) { |
| 393 | grn_objcxx . . $ grn_obj# *command; |
| 394 | |
| 395 | if (grn_ctx_get_output_typecxx . . $ grn_ctx_get_output_type(969c4efba1cf6576).(ctx) == GRN_CONTENT_GROONGA_COMMAND_LISTcxx . . $ GRN_CONTENT_GROONGA_COMMAND_LIST. && |
| 396 | chunk_size > 0 && chunk[chunk_size - 1] != '\n') { |
| 397 | ensure_writecxx . . $ ensure_write(73fb6c062b1c53ff).(ctx, stream, "\n", 1); |
| 398 | written++; |
| 399 | } |
| 400 | fflushcxx . . $ fflush(89bc1efcdac0ca22).(stream); |
| 401 | |
| 402 | command = GRN_CTX_USER_DATAcxx . . $ `include/groonga/groonga.h:372:9`!(ctx)->ptrcxx . . $ $anonymous_type_1555d7cc1d218aa4_5#ptr.; |
| 403 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(command); |
| 404 | } |
| 405 | |
| 406 | GRN_QUERY_LOGcxx . . $ `include/groonga/groonga.h:2585:9`!(ctx, |
| 407 | GRN_QUERY_LOG_SIZEcxx . . $ `include/groonga/groonga.h:216:9`!, |
| 408 | ":", |
| 409 | "send(%" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`! ")", |
| 410 | written); |
| 411 | } |
| 412 | |
| 413 | static void |
| 414 | s_output_typedcxx . . $ s_output_typed(60bff85a906f598f).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 415 | int flags, |
| 416 | standalone_output_contextcxx . . $ standalone_output_context# *output_context) |
| 417 | { |
| 418 | if (!ctx) { |
| 419 | return; |
| 420 | } |
| 421 | |
| 422 | if (!ctx->implcxx . . $ _grn_ctx#impl.) { |
| 423 | return; |
| 424 | } |
| 425 | |
| 426 | FILEcxx . . $ FILE# *stream = output_context->outputcxx . . $ $anonymous_type_1ab89eed5889867_0#output.; |
| 427 | char *chunk = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 428 | unsigned int chunk_size = 0; |
| 429 | int recv_flags; |
| 430 | grn_objcxx . . $ grn_obj# body; |
| 431 | grn_objcxx . . $ grn_obj# *command; |
| 432 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_last_message = (flags & GRN_CTX_TAILcxx . . $ `include/groonga/groonga.h:3294:9`!); |
| 433 | |
| 434 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&body, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!); |
| 435 | grn_ctx_recvcxx . . $ grn_ctx_recv(8b5d6c8a2a7bb976).(ctx, &chunk, &chunk_size, &recv_flags); |
| 436 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, &body, chunk, chunk_size); |
| 437 | |
| 438 | if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&body) == 0 && ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 439 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &body); |
| 440 | return; |
| 441 | } |
| 442 | |
| 443 | grn_objcxx . . $ grn_obj# head, foot; |
| 444 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&head, 0); |
| 445 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&foot, 0); |
| 446 | if (!output_context->is_outputtingcxx . . $ $anonymous_type_1ab89eed5889867_0#is_outputting.) { |
| 447 | if (is_last_message) { |
| 448 | output_envelopecxx . . $ output_envelope(aa1eebc7c39b83c).(ctx, ctx->rccxx . . $ _grn_ctx#rc., &head, &body, &foot); |
| 449 | } else { |
| 450 | grn_output_envelope_opencxx . . $ grn_output_envelope_open(cda3a5f3c2e53c6b).(ctx, &head); |
| 451 | } |
| 452 | output_context->is_outputtingcxx . . $ $anonymous_type_1ab89eed5889867_0#is_outputting. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 453 | } else { |
| 454 | if (is_last_message) { |
| 455 | grn_output_envelope_closecxx . . $ grn_output_envelope_close(6a9b897abe28c987).(ctx, |
| 456 | &foot, |
| 457 | ctx->rccxx . . $ _grn_ctx#rc., |
| 458 | input_pathcxx . . $ input_path., |
| 459 | number_of_linescxx . . $ number_of_lines.); |
| 460 | } |
| 461 | } |
| 462 | |
| 463 | ensure_writecxx . . $ ensure_write(73fb6c062b1c53ff).(ctx, stream, GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&head), GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&head)); |
| 464 | ensure_writecxx . . $ ensure_write(73fb6c062b1c53ff).(ctx, stream, GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&body), GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&body)); |
| 465 | ensure_writecxx . . $ ensure_write(73fb6c062b1c53ff).(ctx, stream, GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&foot), GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&foot)); |
| 466 | size_tcxx . . $ size_t# content_size = |
| 467 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&head) + GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&body) + GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&foot); |
| 468 | if (is_last_message && content_size > 0) { |
| 469 | ensure_writecxx . . $ ensure_write(73fb6c062b1c53ff).(ctx, stream, "\n", 1); |
| 470 | content_size++; |
| 471 | } |
| 472 | fflushcxx . . $ fflush(89bc1efcdac0ca22).(stream); |
| 473 | if (content_size > 0) { |
| 474 | GRN_QUERY_LOGcxx . . $ `include/groonga/groonga.h:2585:9`!(ctx, |
| 475 | GRN_QUERY_LOG_SIZEcxx . . $ `include/groonga/groonga.h:216:9`!, |
| 476 | ":", |
| 477 | "send(%" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`! ")", |
| 478 | content_size); |
| 479 | } |
| 480 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &head); |
| 481 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &foot); |
| 482 | |
| 483 | if (is_last_message) { |
| 484 | command = GRN_CTX_USER_DATAcxx . . $ `include/groonga/groonga.h:372:9`!(ctx)->ptrcxx . . $ $anonymous_type_1555d7cc1d218aa4_5#ptr.; |
| 485 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(command); |
| 486 | |
| 487 | output_context->is_outputtingcxx . . $ $anonymous_type_1ab89eed5889867_0#is_outputting. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 488 | } |
| 489 | |
| 490 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &body); |
| 491 | } |
| 492 | |
| 493 | static void |
| 494 | s_outputcxx . . $ s_output(e5088b957ff2e019).(grn_ctxcxx . . $ grn_ctx# *ctx, int flags, void *arg) |
| 495 | { |
| 496 | standalone_output_contextcxx . . $ standalone_output_context# *output_context = arg; |
| 497 | |
| 498 | switch (grn_ctx_get_output_typecxx . . $ grn_ctx_get_output_type(969c4efba1cf6576).(ctx)) { |
| 499 | case GRN_CONTENT_GROONGA_COMMAND_LISTcxx . . $ GRN_CONTENT_GROONGA_COMMAND_LIST.: |
| 500 | case GRN_CONTENT_NONEcxx . . $ GRN_CONTENT_NONE.: |
| 501 | s_output_rawcxx . . $ s_output_raw(60bff85a906f598f).(ctx, flags, output_context); |
| 502 | break; |
| 503 | default: |
| 504 | s_output_typedcxx . . $ s_output_typed(60bff85a906f598f).(ctx, flags, output_context); |
| 505 | break; |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | static void |
| 510 | create_pid_filecxx . . $ create_pid_file(49f6e7a06ebc5aa8).(void) |
| 511 | { |
| 512 | FILEcxx . . $ FILE# *pid_file = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 513 | |
| 514 | if (!pid_file_pathcxx . . $ pid_file_path.) { |
| 515 | return; |
| 516 | } |
| 517 | |
| 518 | pid_file = fopencxx . . $ fopen(82ec0787cd37e0a3).(pid_file_pathcxx . . $ pid_file_path., "w"); |
| 519 | if (!pid_file) { |
| 520 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 521 | "Failed to open PID file: <%s>: <%s>\n", |
| 522 | pid_file_pathcxx . . $ pid_file_path., |
| 523 | grn_strerrorcxx . . $ grn_strerror(f7ae7e56280f18ae).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 524 | return; |
| 525 | } |
| 526 | |
| 527 | { |
| 528 | #ifdef WIN32 |
| 529 | DWORD pid; |
| 530 | pid = GetCurrentProcessId(); |
| 531 | fprintf(pid_file, "%" GRN_FMT_DWORD "\n", pid); |
| 532 | #else /* WIN32 */ |
| 533 | pid_tcxx . . $ pid_t# pid; |
| 534 | pid = grn_getpidcxx . . $ `include/groonga/portability.h:199:11`!(); |
| 535 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(pid_file, "%d\n", pid); |
| 536 | #endif /* WIN32 */ |
| 537 | } |
| 538 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(pid_file); |
| 539 | } |
| 540 | |
| 541 | static void |
| 542 | clean_pid_filecxx . . $ clean_pid_file(49f6e7a06ebc5aa8).(void) |
| 543 | { |
| 544 | if (pid_file_pathcxx . . $ pid_file_path.) { |
| 545 | grn_unlinkcxx . . $ `include/groonga/portability.h:88:11`!(pid_file_path); |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 550 | do_alone_allow_db_reopencxx . . $ do_alone_allow_db_reopen(7434a5babe8fd550).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 551 | grn_objcxx . . $ grn_obj# *text, |
| 552 | grn_objcxx . . $ grn_obj# **db, |
| 553 | const char *db_path) |
| 554 | { |
| 555 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_close = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 556 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_reopen = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 557 | if (GRN_TEXT_EQUAL_CSTRINGcxx . . $ `include/groonga/groonga.h:2788:9`!(text, "_database_close")) { |
| 558 | is_close = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 559 | } else if (GRN_TEXT_EQUAL_CSTRINGcxx . . $ `include/groonga/groonga.h:2788:9`!(text, "_database_reopen")) { |
| 560 | is_reopen = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 561 | } else { |
| 562 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 563 | } |
| 564 | |
| 565 | GRN_QUERY_LOGcxx . . $ `include/groonga/groonga.h:2585:9`!(ctx, |
| 566 | GRN_QUERY_LOG_COMMANDcxx . . $ `include/groonga/groonga.h:212:9`!, |
| 567 | ">", |
| 568 | "%.*s", |
| 569 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(text), |
| 570 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(text)); |
| 571 | if (is_close) { |
| 572 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, *db); |
| 573 | *db = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 574 | } else if (is_reopen) { |
| 575 | if (*db) { |
| 576 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, *db); |
| 577 | } |
| 578 | if (db_path) { |
| 579 | *db = grn_db_opencxx . . $ grn_db_open(7a18fc36feec5011).(ctx, db_path); |
| 580 | } else { |
| 581 | *db = grn_db_createcxx . . $ grn_db_create(d9bca101602a0e9b).(ctx, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 582 | } |
| 583 | } |
| 584 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 585 | } |
| 586 | |
| 587 | static int |
| 588 | do_alonecxx . . $ do_alone(afcd3168fc1188a4).(int argc, char **argv) |
| 589 | { |
| 590 | int exit_code = EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 591 | char *path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 592 | grn_objcxx . . $ grn_obj# *db; |
| 593 | grn_ctxcxx . . $ grn_ctx# ctx_, *ctx = &ctx_; |
| 594 | create_pid_filecxx . . $ create_pid_file(49f6e7a06ebc5aa8).(); |
| 595 | grn_ctx_initcxx . . $ grn_ctx_init(670fdc69e3f5dbb5).(ctx, 0); |
| 596 | grn_ctx_set_wal_rolecxx . . $ grn_ctx_set_wal_role(2d7caed53fefceef).(ctx, wal_rolecxx . . $ wal_role.); |
| 597 | if (argc > 0 && argv) { |
| 598 | path = *argv++; |
| 599 | argc--; |
| 600 | } |
| 601 | db = |
| 602 | (newdbcxx . . $ newdb. || !path) ? grn_db_createcxx . . $ grn_db_create(d9bca101602a0e9b).(ctx, path, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) : grn_db_opencxx . . $ grn_db_open(7a18fc36feec5011).(ctx, path); |
| 603 | if (db) { |
| 604 | const char *allow_db_reopen_env = getenvcxx . . $ getenv(a8b8e32347182212).("GROONGA_ALLOW_DATABASE_REOPEN"); |
| 605 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! allow_db_reopen = |
| 606 | (allow_db_reopen_env && (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(allow_db_reopen_env, "yes") == 0)); |
| 607 | grn_objcxx . . $ grn_obj# command; |
| 608 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&command, 0); |
| 609 | GRN_CTX_USER_DATAcxx . . $ `include/groonga/groonga.h:372:9`!(ctx)->ptrcxx . . $ $anonymous_type_1555d7cc1d218aa4_5#ptr. = &command; |
| 610 | standalone_output_contextcxx . . $ standalone_output_context# output_context; |
| 611 | output_context.outputcxx . . $ $anonymous_type_1ab89eed5889867_0#output. = outputcxx . . $ output.; |
| 612 | output_context.is_outputtingcxx . . $ $anonymous_type_1ab89eed5889867_0#is_outputting. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 613 | grn_ctx_recv_handler_setcxx . . $ grn_ctx_recv_handler_set(9ae73d25c36b03d6).(ctx, s_outputcxx . . $ s_output(e5088b957ff2e019)., &output_context); |
| 614 | grn_objcxx . . $ grn_obj# *load_command = grn_ctx_getcxx . . $ grn_ctx_get(70fde0087014f9ea).(ctx, "load", -1); |
| 615 | if (!argc) { |
| 616 | grn_objcxx . . $ grn_obj# text; |
| 617 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&text, 0); |
| 618 | while (promptcxx . . $ prompt(4865d068a46d0f83).(ctx, &text) == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 619 | const boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_loading = |
| 620 | (ctx->implcxx . . $ _grn_ctx#impl.->commandcxx . . $ _grn_ctx_impl#command..keepcxx . . $ _grn_ctx_impl#$anonymous_type_3#keep..commandcxx . . $ _grn_ctx_impl#$anonymous_type_3#$anonymous_type_4#command. == load_command); |
| 621 | if (!is_loading) { |
| 622 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, |
| 623 | &command, |
| 624 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&text), |
| 625 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&text)); |
| 626 | if (allow_db_reopen) { |
| 627 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! processed = do_alone_allow_db_reopencxx . . $ do_alone_allow_db_reopen(7434a5babe8fd550).(ctx, &text, &db, path); |
| 628 | if (processed) { |
| 629 | ctx->implcxx . . $ _grn_ctx#impl.->curr_exprcxx . . $ _grn_ctx_impl#curr_expr. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 630 | grn_ctx_set_output_typecxx . . $ grn_ctx_set_output_type(885ce0395b04a95d).(ctx, GRN_CONTENT_JSONcxx . . $ GRN_CONTENT_JSON.); |
| 631 | grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.); |
| 632 | grn_ctx_output_flushcxx . . $ grn_ctx_output_flush(55555b1fc84b4259).(ctx, GRN_CTX_TAILcxx . . $ `include/groonga/groonga.h:3294:9`!); |
| 633 | GRN_QUERY_LOGcxx . . $ `include/groonga/groonga.h:2585:9`!(ctx, |
| 634 | GRN_QUERY_LOG_RESULT_CODEcxx . . $ `include/groonga/groonga.h:213:9`!, |
| 635 | "<", |
| 636 | "rc=%d", |
| 637 | ctx->rc); |
| 638 | if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 639 | continue; |
| 640 | } else { |
| 641 | break; |
| 642 | } |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | grn_ctx_sendcxx . . $ grn_ctx_send(dac8ec282379d9e0).(ctx, GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&text), GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&text), 0); |
| 647 | if (ctx->statcxx . . $ _grn_ctx#stat. == GRN_CTX_QUITcxx . . $ `include/groonga/groonga.h:3297:9`!) { |
| 648 | break; |
| 649 | } |
| 650 | if (!is_loading) { |
| 651 | ERRCLRcxx . . $ `lib/grn_error.h:37:9`!(ctx); |
| 652 | if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_CANCELcxx . . $ GRN_CANCEL.) { |
| 653 | ctx->rccxx . . $ _grn_ctx#rc. = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 654 | } |
| 655 | } |
| 656 | } |
| 657 | exit_code = grn_rc_to_exit_codecxx . . $ grn_rc_to_exit_code(b9a95f6671185517).(ctx->rccxx . . $ _grn_ctx#rc.); |
| 658 | grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, &text); |
| 659 | } else { |
| 660 | grn_rccxx . . $ grn_rc# rc; |
| 661 | rc = grn_ctx_sendvcxx . . $ grn_ctx_sendv(ed016bc7ceda3be3).(ctx, argc, argv, 0); |
| 662 | exit_code = grn_rc_to_exit_codecxx . . $ grn_rc_to_exit_code(b9a95f6671185517).(rc); |
| 663 | } |
| 664 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &command); |
| 665 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, db); |
| 666 | } else { |
| 667 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "db open failed (%s): %s\n", path, ctx->errbufcxx . . $ _grn_ctx#errbuf.); |
| 668 | } |
| 669 | grn_ctx_fincxx . . $ grn_ctx_fin(2b4fa601bf4f1e5b).(ctx); |
| 670 | clean_pid_filecxx . . $ clean_pid_file(49f6e7a06ebc5aa8).(); |
| 671 | return exit_code; |
| 672 | } |
| 673 | |
| 674 | static int |
| 675 | c_outputcxx . . $ c_output(aedefb968c66b619).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 676 | { |
| 677 | int flags; |
| 678 | char *str; |
| 679 | unsigned int str_len; |
| 680 | do { |
| 681 | grn_ctx_recvcxx . . $ grn_ctx_recv(8b5d6c8a2a7bb976).(ctx, &str, &str_len, &flags); |
| 682 | /* |
| 683 | if (ctx->rc) { |
| 684 | fprintf(stderr, "grn_ctx_recv failed\n"); |
| 685 | return -1; |
| 686 | } |
| 687 | */ |
| 688 | if (str_len || ctx->rccxx . . $ _grn_ctx#rc.) { |
| 689 | grn_objcxx . . $ grn_obj# head, body, foot; |
| 690 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&head, 0); |
| 691 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&body, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!); |
| 692 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&foot, 0); |
| 693 | if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 694 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, &body, str, str_len); |
| 695 | } else { |
| 696 | ERRcxx . . $ `lib/grn_error.h:156:9`!(ctx->rc, "%.*s", str_len, str); |
| 697 | } |
| 698 | output_envelopecxx . . $ output_envelope(aa1eebc7c39b83c).(ctx, ctx->rccxx . . $ _grn_ctx#rc., &head, &body, &foot); |
| 699 | fwritecxx . . $ fwrite(ab0609fa07c47d6e).(GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&head), 1, GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&head), outputcxx . . $ output.); |
| 700 | fwritecxx . . $ fwrite(ab0609fa07c47d6e).(GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&body), 1, GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&body), outputcxx . . $ output.); |
| 701 | fwritecxx . . $ fwrite(ab0609fa07c47d6e).(GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&foot), 1, GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&foot), outputcxx . . $ output.); |
| 702 | fputccxx . . $ fputc(b1cd03d6c470d1bd).('\n', outputcxx . . $ output.); |
| 703 | fflushcxx . . $ fflush(89bc1efcdac0ca22).(outputcxx . . $ output.); |
| 704 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &head); |
| 705 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &body); |
| 706 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &foot); |
| 707 | } |
| 708 | } while ((flags & GRN_CTX_MOREcxx . . $ `include/groonga/groonga.h:3293:9`!)); |
| 709 | return 0; |
| 710 | } |
| 711 | |
| 712 | static int |
| 713 | g_clientcxx . . $ g_client(afcd3168fc1188a4).(int argc, char **argv) |
| 714 | { |
| 715 | int exit_code = EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 716 | grn_ctxcxx . . $ grn_ctx# ctx_, *ctx = &ctx_; |
| 717 | const char *hostname = DEFAULT_DESTcxx . . $ `src/groonga.c:87:9`!; |
| 718 | if (argc > 0 && argv) { |
| 719 | hostname = *argv++; |
| 720 | argc--; |
| 721 | } |
| 722 | grn_ctx_initcxx . . $ grn_ctx_init(670fdc69e3f5dbb5).(ctx, 0); |
| 723 | if (!grn_ctx_connectcxx . . $ grn_ctx_connect(4b71725af6a0594b).(ctx, hostname, portcxx . . $ port., 0)) { |
| 724 | if (!argc) { |
| 725 | grn_objcxx . . $ grn_obj# text; |
| 726 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&text, 0); |
| 727 | while (promptcxx . . $ prompt(4865d068a46d0f83).(ctx, &text) == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 728 | grn_ctx_sendcxx . . $ grn_ctx_send(dac8ec282379d9e0).(ctx, GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&text), GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&text), 0); |
| 729 | exit_code = grn_rc_to_exit_codecxx . . $ grn_rc_to_exit_code(b9a95f6671185517).(ctx->rccxx . . $ _grn_ctx#rc.); |
| 730 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 731 | break; |
| 732 | } |
| 733 | if (c_outputcxx . . $ c_output(aedefb968c66b619).(ctx)) { |
| 734 | goto exit; |
| 735 | } |
| 736 | if (ctx->statcxx . . $ _grn_ctx#stat. == GRN_CTX_QUITcxx . . $ `include/groonga/groonga.h:3297:9`!) { |
| 737 | break; |
| 738 | } |
| 739 | } |
| 740 | grn_obj_unlinkcxx . . $ grn_obj_unlink(4865d068a46d0f83).(ctx, &text); |
| 741 | } else { |
| 742 | grn_rccxx . . $ grn_rc# rc; |
| 743 | rc = grn_ctx_sendvcxx . . $ grn_ctx_sendv(ed016bc7ceda3be3).(ctx, argc, argv, 0); |
| 744 | exit_code = grn_rc_to_exit_codecxx . . $ grn_rc_to_exit_code(b9a95f6671185517).(rc); |
| 745 | if (c_outputcxx . . $ c_output(aedefb968c66b619).(ctx)) { |
| 746 | goto exit; |
| 747 | } |
| 748 | } |
| 749 | } else { |
| 750 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "grn_ctx_connect failed (%s:%d)\n", hostname, portcxx . . $ port.); |
| 751 | } |
| 752 | exit: |
| 753 | grn_ctx_fincxx . . $ grn_ctx_fin(2b4fa601bf4f1e5b).(ctx); |
| 754 | return exit_code; |
| 755 | } |
| 756 | |
| 757 | /* server */ |
| 758 | |
| 759 | typedef void (*grn_edge_dispatcher_funccxx . . $ grn_edge_dispatcher_func#)(grn_ctxcxx . . $ grn_ctx# *ctx, grn_edgecxx . . $ grn_edge# *edge); |
| 760 | typedef void (*grn_handler_funccxx . . $ grn_handler_func#)(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *msg); |
| 761 | |
| 762 | static grn_com_queuecxx . . $ grn_com_queue# ctx_newcxx . . $ ctx_new.; |
| 763 | static grn_com_queuecxx . . $ grn_com_queue# ctx_oldcxx . . $ ctx_old.; |
| 764 | static grn_critical_sectioncxx . . $ grn_critical_section# q_critical_sectioncxx . . $ q_critical_section.; |
| 765 | static grn_condcxx . . $ grn_cond# q_condcxx . . $ q_cond.; |
| 766 | static uint32_tcxx . . $ uint32_t# n_running_threadscxx . . $ n_running_threads. = 0; |
| 767 | static uint32_tcxx . . $ uint32_t# n_floating_threadscxx . . $ n_floating_threads. = 0; |
| 768 | static uint32_tcxx . . $ uint32_t# max_n_floating_threadscxx . . $ max_n_floating_threads.; |
| 769 | |
| 770 | static uint32_tcxx . . $ uint32_t# |
| 771 | groonga_get_thread_limitcxx . . $ groonga_get_thread_limit(6769d0e399bf81e3).(void *data) |
| 772 | { |
| 773 | return max_n_floating_threadscxx . . $ max_n_floating_threads.; |
| 774 | } |
| 775 | |
| 776 | static void |
| 777 | groonga_set_thread_limit_with_ctxcxx . . $ groonga_set_thread_limit_with_ctx(eb336c7ec43e10ce).(grn_ctxcxx . . $ grn_ctx# *ctx, uint32_tcxx . . $ uint32_t# new_limit, void *data) |
| 778 | { |
| 779 | uint32_tcxx . . $ uint32_t# i; |
| 780 | uint32_tcxx . . $ uint32_t# current_n_floating_threads; |
| 781 | uint32_tcxx . . $ uint32_t# current_max_n_floating_threads; |
| 782 | static uint32_tcxx . . $ uint32_t# n_changing_threads = 0; |
| 783 | uint32_tcxx . . $ uint32_t# prev_n_changing_threads; |
| 784 | |
| 785 | GRN_ATOMIC_ADD_EXcxx . . $ `lib/grn.h:420:11`!(&n_changing_threads, 1, prev_n_changing_threads); |
| 786 | |
| 787 | CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(q_critical_section); |
| 788 | current_n_floating_threads = n_floating_threadscxx . . $ n_floating_threads.; |
| 789 | current_max_n_floating_threads = max_n_floating_threadscxx . . $ max_n_floating_threads.; |
| 790 | max_n_floating_threadscxx . . $ max_n_floating_threads. = new_limit; |
| 791 | CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(q_critical_section); |
| 792 | |
| 793 | if (prev_n_changing_threads > 0) { |
| 794 | GRN_ATOMIC_ADD_EXcxx . . $ `lib/grn.h:420:11`!(&n_changing_threads, -1, prev_n_changing_threads); |
| 795 | return; |
| 796 | } |
| 797 | |
| 798 | if (current_n_floating_threads > new_limit) { |
| 799 | for (i = 0; i < current_n_floating_threads; i++) { |
| 800 | CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(q_critical_section); |
| 801 | COND_SIGNALcxx . . $ `lib/grn.h:233:11`!(q_cond); |
| 802 | CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(q_critical_section); |
| 803 | } |
| 804 | } |
| 805 | |
| 806 | while (truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!) { |
| 807 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_reduced; |
| 808 | CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(q_critical_section); |
| 809 | is_reduced = (n_running_threadscxx . . $ n_running_threads. <= max_n_floating_threadscxx . . $ max_n_floating_threads.); |
| 810 | if (!is_reduced && n_floating_threadscxx . . $ n_floating_threads. > 0) { |
| 811 | COND_SIGNALcxx . . $ `lib/grn.h:233:11`!(q_cond); |
| 812 | } |
| 813 | CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(q_critical_section); |
| 814 | if (is_reduced) { |
| 815 | break; |
| 816 | } |
| 817 | if (ctx && ctx->rccxx . . $ _grn_ctx#rc. == GRN_CANCELcxx . . $ GRN_CANCEL.) { |
| 818 | CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(q_critical_section); |
| 819 | max_n_floating_threadscxx . . $ max_n_floating_threads. = current_max_n_floating_threads; |
| 820 | CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(q_critical_section); |
| 821 | break; |
| 822 | } |
| 823 | grn_nanosleepcxx . . $ grn_nanosleep(2c44cd906ae4e829).(1000000); |
| 824 | } |
| 825 | |
| 826 | GRN_ATOMIC_ADD_EXcxx . . $ `lib/grn.h:420:11`!(&n_changing_threads, -1, prev_n_changing_threads); |
| 827 | } |
| 828 | |
| 829 | static void |
| 830 | groonga_set_thread_limitcxx . . $ groonga_set_thread_limit(15326d06e62ce759).(uint32_tcxx . . $ uint32_t# new_limit, void *data) |
| 831 | { |
| 832 | groonga_set_thread_limit_with_ctxcxx . . $ groonga_set_thread_limit_with_ctx(eb336c7ec43e10ce).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, new_limit, data); |
| 833 | } |
| 834 | |
| 835 | typedef structcxx . . $ $anonymous_type_1ab89eed5889867_1# { |
| 836 | grn_mutexcxx . . $ grn_mutex# mutexcxx . . $ $anonymous_type_1ab89eed5889867_1#mutex.; |
| 837 | grn_ctxcxx . . $ grn_ctx# ctxcxx . . $ $anonymous_type_1ab89eed5889867_1#ctx.; |
| 838 | grn_patcxx . . $ grn_pat# *entriescxx . . $ $anonymous_type_1ab89eed5889867_1#entries.; |
| 839 | uint64_tcxx . . $ uint64_t# earliest_unix_time_mseccxx . . $ $anonymous_type_1ab89eed5889867_1#earliest_unix_time_msec.; |
| 840 | } request_timer_datacxx . . $ request_timer_data#; |
| 841 | static request_timer_datacxx . . $ request_timer_data# the_request_timer_datacxx . . $ the_request_timer_data.; |
| 842 | |
| 843 | static void * |
| 844 | request_timer_registercxx . . $ request_timer_register(167ce8478d7ab853).(const char *request_id, |
| 845 | unsigned int request_id_size, |
| 846 | double timeout, |
| 847 | void *user_data) |
| 848 | { |
| 849 | request_timer_datacxx . . $ request_timer_data# *data = user_data; |
| 850 | grn_idcxx . . $ grn_id# id = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!; |
| 851 | |
| 852 | if (MUTEX_LOCK_CHECKcxx . . $ `lib/grn.h:221:11`!(data->mutex)) { |
| 853 | grn_ctxcxx . . $ grn_ctx# *ctx = &(data->ctxcxx . . $ $anonymous_type_1ab89eed5889867_1#ctx.); |
| 854 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_first_timer; |
| 855 | grn_timevalcxx . . $ grn_timeval# tv; |
| 856 | uint64_tcxx . . $ uint64_t# timeout_unix_time_msec; |
| 857 | void *value; |
| 858 | |
| 859 | is_first_timer = (grn_pat_sizecxx . . $ grn_pat_size(801003d623e3bbf5).(ctx, data->entriescxx . . $ $anonymous_type_1ab89eed5889867_1#entries.) == 0); |
| 860 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 861 | timeout_unix_time_msec = GRN_TIMEVAL_TO_MSECcxx . . $ `include/groonga/time.h:28:9`!(&tv) + (timeout * 1000); |
| 862 | while (truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!) { |
| 863 | int added; |
| 864 | id = grn_pat_addcxx . . $ grn_pat_add(73f23071831c7e2a).(ctx, |
| 865 | data->entriescxx . . $ $anonymous_type_1ab89eed5889867_1#entries., |
| 866 | &timeout_unix_time_msec, |
| 867 | sizeof(uint64_tcxx . . $ uint64_t#), |
| 868 | &value, |
| 869 | &added); |
| 870 | if (added != 0) { |
| 871 | break; |
| 872 | } |
| 873 | timeout_unix_time_msec++; |
| 874 | } |
| 875 | grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(value, &request_id_size, sizeof(unsigned int)); |
| 876 | grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(((uint8_t *)value) + sizeof(unsigned int), |
| 877 | request_id, |
| 878 | request_id_size); |
| 879 | if (data->earliest_unix_time_mseccxx . . $ $anonymous_type_1ab89eed5889867_1#earliest_unix_time_msec. == 0 || |
| 880 | data->earliest_unix_time_mseccxx . . $ $anonymous_type_1ab89eed5889867_1#earliest_unix_time_msec. > timeout_unix_time_msec) { |
| 881 | data->earliest_unix_time_mseccxx . . $ $anonymous_type_1ab89eed5889867_1#earliest_unix_time_msec. = timeout_unix_time_msec; |
| 882 | } |
| 883 | if (is_first_timer) { |
| 884 | break_accept_event_loopcxx . . $ break_accept_event_loop(b578cd6e53d5fe91).(ctx); |
| 885 | } |
| 886 | MUTEX_UNLOCKcxx . . $ `lib/grn.h:222:11`!(data->mutex); |
| 887 | } |
| 888 | |
| 889 | return (void *)(uint64_tcxx . . $ uint64_t#)id; |
| 890 | } |
| 891 | |
| 892 | static void |
| 893 | request_timer_unregistercxx . . $ request_timer_unregister(6c58c5e2437d25a2).(void *timer_id, void *user_data) |
| 894 | { |
| 895 | request_timer_datacxx . . $ request_timer_data# *data = user_data; |
| 896 | grn_idcxx . . $ grn_id# id = (grn_idcxx . . $ grn_id#)(uint64_tcxx . . $ uint64_t#)timer_id; |
| 897 | |
| 898 | if (MUTEX_LOCK_CHECKcxx . . $ `lib/grn.h:221:11`!(data->mutex)) { |
| 899 | grn_ctxcxx . . $ grn_ctx# *ctx = &(data->ctxcxx . . $ $anonymous_type_1ab89eed5889867_1#ctx.); |
| 900 | uint64_tcxx . . $ uint64_t# timeout_unix_time_msec; |
| 901 | int key_size; |
| 902 | |
| 903 | key_size = grn_pat_get_keycxx . . $ grn_pat_get_key(52cd598958564ca7).(ctx, |
| 904 | data->entriescxx . . $ $anonymous_type_1ab89eed5889867_1#entries., |
| 905 | id, |
| 906 | &timeout_unix_time_msec, |
| 907 | sizeof(uint64_tcxx . . $ uint64_t#)); |
| 908 | if (key_size > 0) { |
| 909 | grn_pat_delete_by_idcxx . . $ grn_pat_delete_by_id(69fddfcd7b80a172).(ctx, data->entriescxx . . $ $anonymous_type_1ab89eed5889867_1#entries., id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 910 | if (data->earliest_unix_time_mseccxx . . $ $anonymous_type_1ab89eed5889867_1#earliest_unix_time_msec. >= timeout_unix_time_msec) { |
| 911 | data->earliest_unix_time_mseccxx . . $ $anonymous_type_1ab89eed5889867_1#earliest_unix_time_msec. = 0; |
| 912 | } |
| 913 | } |
| 914 | MUTEX_UNLOCKcxx . . $ `lib/grn.h:222:11`!(data->mutex); |
| 915 | } |
| 916 | } |
| 917 | |
| 918 | static void |
| 919 | request_timer_fincxx . . $ request_timer_fin(5d22bdacc48458e8).(void *user_data) |
| 920 | { |
| 921 | request_timer_datacxx . . $ request_timer_data# *data = user_data; |
| 922 | |
| 923 | { |
| 924 | grn_ctxcxx . . $ grn_ctx# *ctx = &(data->ctxcxx . . $ $anonymous_type_1ab89eed5889867_1#ctx.); |
| 925 | grn_pat_closecxx . . $ grn_pat_close(6044f5e1d38adedf).(ctx, data->entriescxx . . $ $anonymous_type_1ab89eed5889867_1#entries.); |
| 926 | grn_ctx_fincxx . . $ grn_ctx_fin(2b4fa601bf4f1e5b).(ctx); |
| 927 | MUTEX_FINcxx . . $ `lib/grn.h:223:11`!(data->mutex); |
| 928 | } |
| 929 | } |
| 930 | |
| 931 | static void |
| 932 | request_timer_initcxx . . $ request_timer_init(49f6e7a06ebc5aa8).(void) |
| 933 | { |
| 934 | static grn_request_timercxx . . $ grn_request_timer# timer; |
| 935 | request_timer_datacxx . . $ request_timer_data# *data = &the_request_timer_datacxx . . $ the_request_timer_data.; |
| 936 | grn_ctxcxx . . $ grn_ctx# *ctx; |
| 937 | |
| 938 | MUTEX_INITcxx . . $ `lib/grn.h:219:11`!(data->mutex); |
| 939 | ctx = &(data->ctxcxx . . $ $anonymous_type_1ab89eed5889867_1#ctx.); |
| 940 | grn_ctx_initcxx . . $ grn_ctx_init(670fdc69e3f5dbb5).(ctx, 0); |
| 941 | data->entriescxx . . $ $anonymous_type_1ab89eed5889867_1#entries. = grn_pat_createcxx . . $ grn_pat_create(c536c63c37081863).(ctx, |
| 942 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 943 | sizeof(uint64_tcxx . . $ uint64_t#), |
| 944 | GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!, |
| 945 | GRN_OBJ_KEY_UINTcxx . . $ `include/groonga/groonga.h:697:9`!); |
| 946 | data->earliest_unix_time_mseccxx . . $ $anonymous_type_1ab89eed5889867_1#earliest_unix_time_msec. = 0; |
| 947 | |
| 948 | timer.user_datacxx . . $ _grn_request_timer#user_data. = data; |
| 949 | timer.register_funccxx . . $ _grn_request_timer#register_func. = request_timer_registercxx . . $ request_timer_register(167ce8478d7ab853).; |
| 950 | timer.unregister_funccxx . . $ _grn_request_timer#unregister_func. = request_timer_unregistercxx . . $ request_timer_unregister(6c58c5e2437d25a2).; |
| 951 | timer.fin_funccxx . . $ _grn_request_timer#fin_func. = request_timer_fincxx . . $ request_timer_fin(5d22bdacc48458e8).; |
| 952 | |
| 953 | grn_request_timer_setcxx . . $ grn_request_timer_set(fc4f5f035263babf).(&timer); |
| 954 | } |
| 955 | |
| 956 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 957 | request_timer_ensure_earliest_unix_time_mseccxx . . $ request_timer_ensure_earliest_unix_time_msec(c9857a73d68e59ba).(void) |
| 958 | { |
| 959 | request_timer_datacxx . . $ request_timer_data# *data = &the_request_timer_datacxx . . $ the_request_timer_data.; |
| 960 | grn_ctxcxx . . $ grn_ctx# *ctx; |
| 961 | grn_pat_cursorcxx . . $ grn_pat_cursor# *cursor; |
| 962 | |
| 963 | if (data->earliest_unix_time_mseccxx . . $ $anonymous_type_1ab89eed5889867_1#earliest_unix_time_msec. > 0) { |
| 964 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 965 | } |
| 966 | |
| 967 | ctx = &(data->ctxcxx . . $ $anonymous_type_1ab89eed5889867_1#ctx.); |
| 968 | cursor = grn_pat_cursor_opencxx . . $ grn_pat_cursor_open(b2668de89fd2b39a).(ctx, |
| 969 | data->entriescxx . . $ $anonymous_type_1ab89eed5889867_1#entries., |
| 970 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 971 | 0, |
| 972 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 973 | 0, |
| 974 | 0, |
| 975 | 1, |
| 976 | GRN_CURSOR_ASCENDINGcxx . . $ `include/groonga/table.h:273:9`!); |
| 977 | if (!cursor) { |
| 978 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 979 | } |
| 980 | while (grn_pat_cursor_nextcxx . . $ grn_pat_cursor_next(5452c9aa69698298).(ctx, cursor) != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) { |
| 981 | void *key; |
| 982 | uint64_tcxx . . $ uint64_t# timeout_unix_time_msec; |
| 983 | |
| 984 | grn_pat_cursor_get_keycxx . . $ grn_pat_cursor_get_key(3a79fc7dedfdc985).(ctx, cursor, &key); |
| 985 | timeout_unix_time_msec = *(uint64_tcxx . . $ uint64_t# *)key; |
| 986 | data->earliest_unix_time_mseccxx . . $ $anonymous_type_1ab89eed5889867_1#earliest_unix_time_msec. = timeout_unix_time_msec; |
| 987 | break; |
| 988 | } |
| 989 | grn_pat_cursor_closecxx . . $ grn_pat_cursor_close(e6719157d7b0b236).(ctx, cursor); |
| 990 | |
| 991 | return data->earliest_unix_time_mseccxx . . $ $anonymous_type_1ab89eed5889867_1#earliest_unix_time_msec. > 0; |
| 992 | } |
| 993 | |
| 994 | static int |
| 995 | request_timer_get_poll_timeoutcxx . . $ request_timer_get_poll_timeout(b126dc7c1de90089).(void) |
| 996 | { |
| 997 | request_timer_datacxx . . $ request_timer_data# *data = &the_request_timer_datacxx . . $ the_request_timer_data.; |
| 998 | int timeout = 1000; |
| 999 | grn_ctxcxx . . $ grn_ctx# *ctx; |
| 1000 | grn_timevalcxx . . $ grn_timeval# tv; |
| 1001 | |
| 1002 | if (!MUTEX_LOCK_CHECKcxx . . $ `lib/grn.h:221:11`!(data->mutex)) { |
| 1003 | return timeout; |
| 1004 | } |
| 1005 | |
| 1006 | ctx = &(data->ctxcxx . . $ $anonymous_type_1ab89eed5889867_1#ctx.); |
| 1007 | if (grn_pat_sizecxx . . $ grn_pat_size(801003d623e3bbf5).(ctx, data->entriescxx . . $ $anonymous_type_1ab89eed5889867_1#entries.) == 0) { |
| 1008 | goto exit; |
| 1009 | } |
| 1010 | |
| 1011 | if (!request_timer_ensure_earliest_unix_time_mseccxx . . $ request_timer_ensure_earliest_unix_time_msec(c9857a73d68e59ba).()) { |
| 1012 | goto exit; |
| 1013 | } |
| 1014 | |
| 1015 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 1016 | timeout = data->earliest_unix_time_mseccxx . . $ $anonymous_type_1ab89eed5889867_1#earliest_unix_time_msec. - GRN_TIMEVAL_TO_MSECcxx . . $ `include/groonga/time.h:28:9`!(&tv); |
| 1017 | if (timeout < 0) { |
| 1018 | timeout = 0; |
| 1019 | } else if (timeout > 1000) { |
| 1020 | timeout = 1000; |
| 1021 | } |
| 1022 | |
| 1023 | exit: |
| 1024 | MUTEX_UNLOCKcxx . . $ `lib/grn.h:222:11`!(data->mutex); |
| 1025 | |
| 1026 | return timeout; |
| 1027 | } |
| 1028 | |
| 1029 | static void |
| 1030 | request_timer_process_timeoutcxx . . $ request_timer_process_timeout(49f6e7a06ebc5aa8).(void) |
| 1031 | { |
| 1032 | request_timer_datacxx . . $ request_timer_data# *data = &the_request_timer_datacxx . . $ the_request_timer_data.; |
| 1033 | grn_ctxcxx . . $ grn_ctx# *ctx; |
| 1034 | grn_timevalcxx . . $ grn_timeval# tv; |
| 1035 | uint64_tcxx . . $ uint64_t# max; |
| 1036 | grn_pat_cursorcxx . . $ grn_pat_cursor# *cursor; |
| 1037 | |
| 1038 | ctx = &(data->ctxcxx . . $ $anonymous_type_1ab89eed5889867_1#ctx.); |
| 1039 | if (grn_pat_sizecxx . . $ grn_pat_size(801003d623e3bbf5).(ctx, data->entriescxx . . $ $anonymous_type_1ab89eed5889867_1#entries.) == 0) { |
| 1040 | return; |
| 1041 | } |
| 1042 | |
| 1043 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 1044 | max = GRN_TIMEVAL_TO_MSECcxx . . $ `include/groonga/time.h:28:9`!(&tv); |
| 1045 | cursor = grn_pat_cursor_opencxx . . $ grn_pat_cursor_open(b2668de89fd2b39a).(ctx, |
| 1046 | data->entriescxx . . $ $anonymous_type_1ab89eed5889867_1#entries., |
| 1047 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 1048 | 0, |
| 1049 | &max, |
| 1050 | sizeof(uint64_tcxx . . $ uint64_t#), |
| 1051 | 0, |
| 1052 | -1, |
| 1053 | GRN_CURSOR_ASCENDINGcxx . . $ `include/groonga/table.h:273:9`!); |
| 1054 | if (!cursor) { |
| 1055 | return; |
| 1056 | } |
| 1057 | |
| 1058 | grn_idcxx . . $ grn_id# id; |
| 1059 | while ((id = grn_pat_cursor_nextcxx . . $ grn_pat_cursor_next(5452c9aa69698298).(ctx, cursor)) != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) { |
| 1060 | void *value; |
| 1061 | const char *request_id; |
| 1062 | unsigned int request_id_size; |
| 1063 | |
| 1064 | grn_pat_cursor_get_valuecxx . . $ grn_pat_cursor_get_value(3a79fc7dedfdc985).(ctx, cursor, &value); |
| 1065 | request_id_size = *((unsigned int *)value); |
| 1066 | request_id = (const char *)(((uint8_tcxx . . $ uint8_t# *)value) + sizeof(unsigned int)); |
| 1067 | grn_request_canceler_cancelcxx . . $ grn_request_canceler_cancel(8d229d683d6d7295).(request_id, request_id_size); |
| 1068 | } |
| 1069 | grn_pat_cursor_closecxx . . $ grn_pat_cursor_close(e6719157d7b0b236).(ctx, cursor); |
| 1070 | } |
| 1071 | |
| 1072 | static void |
| 1073 | reset_ready_notify_pipecxx . . $ reset_ready_notify_pipe(49f6e7a06ebc5aa8).(void) |
| 1074 | { |
| 1075 | ready_notify_pipecxx . . $ ready_notify_pipe.[PIPE_READcxx . . $ `src/groonga.c:111:9`!] = 0; |
| 1076 | ready_notify_pipecxx . . $ ready_notify_pipe.[PIPE_WRITEcxx . . $ `src/groonga.c:112:9`!] = 0; |
| 1077 | } |
| 1078 | |
| 1079 | static void |
| 1080 | close_ready_notify_pipecxx . . $ close_ready_notify_pipe(49f6e7a06ebc5aa8).(void) |
| 1081 | { |
| 1082 | if (ready_notify_pipecxx . . $ ready_notify_pipe.[PIPE_READcxx . . $ `src/groonga.c:111:9`!] > 0) { |
| 1083 | closecxx . . $ close(7864480464b09eea).(ready_notify_pipecxx . . $ ready_notify_pipe.[PIPE_READcxx . . $ `src/groonga.c:111:9`!]); |
| 1084 | } |
| 1085 | if (ready_notify_pipecxx . . $ ready_notify_pipe.[PIPE_WRITEcxx . . $ `src/groonga.c:112:9`!] > 0) { |
| 1086 | closecxx . . $ close(7864480464b09eea).(ready_notify_pipecxx . . $ ready_notify_pipe.[PIPE_WRITEcxx . . $ `src/groonga.c:112:9`!]); |
| 1087 | } |
| 1088 | reset_ready_notify_pipecxx . . $ reset_ready_notify_pipe(49f6e7a06ebc5aa8).(); |
| 1089 | } |
| 1090 | |
| 1091 | /* FIXME: callers ignore the return value of send_ready_notify. */ |
| 1092 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 1093 | send_ready_notifycxx . . $ send_ready_notify(c9857a73d68e59ba).(void) |
| 1094 | { |
| 1095 | if (ready_notify_pipecxx . . $ ready_notify_pipe.[PIPE_WRITEcxx . . $ `src/groonga.c:112:9`!] > 0) { |
| 1096 | const char *ready_notify_message = "ready"; |
| 1097 | const size_tcxx . . $ size_t# ready_notify_message_len = strlencxx . . $ strlen(751346f8406fd082).(ready_notify_message); |
| 1098 | size_tcxx . . $ size_t# n = 0; |
| 1099 | do { |
| 1100 | ssize_tcxx . . $ ssize_t# m = writecxx . . $ write(41184a59d38b4f65).(ready_notify_pipecxx . . $ ready_notify_pipe.[PIPE_WRITEcxx . . $ `src/groonga.c:112:9`!], |
| 1101 | ready_notify_message + n, |
| 1102 | ready_notify_message_len - n); |
| 1103 | if (m == -1) { |
| 1104 | close_ready_notify_pipecxx . . $ close_ready_notify_pipe(49f6e7a06ebc5aa8).(); |
| 1105 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 1106 | } |
| 1107 | n += m; |
| 1108 | } while (n < ready_notify_message_len); |
| 1109 | } |
| 1110 | close_ready_notify_pipecxx . . $ close_ready_notify_pipe(49f6e7a06ebc5aa8).(); |
| 1111 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 1112 | } |
| 1113 | |
| 1114 | static int |
| 1115 | daemonizecxx . . $ daemonize(b126dc7c1de90089).(void) |
| 1116 | { |
| 1117 | int exit_code = EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!; |
| 1118 | #ifndef WIN32 |
| 1119 | |
| 1120 | if (pipecxx . . $ pipe(a5f7824ee4986326).(ready_notify_pipecxx . . $ ready_notify_pipe.) == -1) { |
| 1121 | reset_ready_notify_pipecxx . . $ reset_ready_notify_pipe(49f6e7a06ebc5aa8).(); |
| 1122 | } |
| 1123 | |
| 1124 | switch (forkcxx . . $ fork(b126dc7c1de90089).()) { |
| 1125 | case 0: |
| 1126 | break; |
| 1127 | case -1: |
| 1128 | perrorcxx . . $ perror(85c52e162fed56f9).("fork"); |
| 1129 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 1130 | default: |
| 1131 | waitcxx . . $ wait(a5f7824ee4986326).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 1132 | if (ready_notify_pipecxx . . $ ready_notify_pipe.[PIPE_READcxx . . $ `src/groonga.c:111:9`!] > 0) { |
| 1133 | int max_fd; |
| 1134 | fd_setcxx . . $ fd_set# read_fds; |
| 1135 | FD_ZEROcxx . . $ `<external>/946878812840035423/select.h:88:9`!(&read_fds); |
| 1136 | FD_SETcxx . . $ `<external>/946878812840035423/select.h:85:9`!(ready_notify_pipe[PIPE_READcxx . . $ `src/groonga.c:111:9`!], &read_fds); |
| 1137 | max_fd = ready_notify_pipecxx . . $ ready_notify_pipe.[PIPE_READcxx . . $ `src/groonga.c:111:9`!] + 1; |
| 1138 | selectcxx . . $ select(6d24c7514c8a5b88).(max_fd, &read_fds, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 1139 | } |
| 1140 | close_ready_notify_pipecxx . . $ close_ready_notify_pipe(49f6e7a06ebc5aa8).(); |
| 1141 | _exitcxx . . $ _exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!); |
| 1142 | } |
| 1143 | switch (forkcxx . . $ fork(b126dc7c1de90089).()) { |
| 1144 | case 0: |
| 1145 | if (pid_file_pathcxx . . $ pid_file_path.) { |
| 1146 | create_pid_filecxx . . $ create_pid_file(49f6e7a06ebc5aa8).(); |
| 1147 | } else { |
| 1148 | pid_tcxx . . $ pid_t# pid; |
| 1149 | pid = grn_getpidcxx . . $ `include/groonga/portability.h:199:11`!(); |
| 1150 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%d\n", pid); |
| 1151 | } |
| 1152 | break; |
| 1153 | case -1: |
| 1154 | perrorcxx . . $ perror(85c52e162fed56f9).("fork"); |
| 1155 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 1156 | default: |
| 1157 | close_ready_notify_pipecxx . . $ close_ready_notify_pipe(49f6e7a06ebc5aa8).(); |
| 1158 | _exitcxx . . $ _exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!); |
| 1159 | } |
| 1160 | { |
| 1161 | int null_fd; |
| 1162 | grn_opencxx . . $ `include/groonga/portability.h:172:11`!(null_fd, "/dev/null", O_RDWRcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:45:9`!); |
| 1163 | if (null_fd != -1) { |
| 1164 | dup2cxx . . $ dup2(9b79fb6aee4c0440).(null_fd, STDIN_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:210:9`!); |
| 1165 | dup2cxx . . $ dup2(9b79fb6aee4c0440).(null_fd, STDOUT_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:211:9`!); |
| 1166 | dup2cxx . . $ dup2(9b79fb6aee4c0440).(null_fd, STDERR_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:212:9`!); |
| 1167 | if (null_fd > STDERR_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:212:9`!) { |
| 1168 | grn_closecxx . . $ `include/groonga/portability.h:179:11`!(null_fd); |
| 1169 | } |
| 1170 | } |
| 1171 | } |
| 1172 | #endif /* WIN32 */ |
| 1173 | return exit_code; |
| 1174 | } |
| 1175 | |
| 1176 | static void |
| 1177 | run_server_loopcxx . . $ run_server_loop(9457405711a13c5e).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_com_eventcxx . . $ grn_com_event# *ev) |
| 1178 | { |
| 1179 | request_timer_initcxx . . $ request_timer_init(49f6e7a06ebc5aa8).(); |
| 1180 | running_event_loopcxx . . $ running_event_loop. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 1181 | while (!grn_com_event_pollcxx . . $ grn_com_event_poll(c072c45909e82dfb).(ctx, ev, request_timer_get_poll_timeoutcxx . . $ request_timer_get_poll_timeout(b126dc7c1de90089).()) && |
| 1182 | grn_gctxcxx . . $ grn_gctx..statcxx . . $ _grn_ctx#stat. != GRN_CTX_QUITcxx . . $ `include/groonga/groonga.h:3297:9`!) { |
| 1183 | #ifdef ENABLE_LOG_REOPEN_BY_SIGNALcxx . . $ `src/groonga.c:61:11`! |
| 1184 | reopen_log_by_signalcxx . . $ reopen_log_by_signal(b578cd6e53d5fe91).(ctx); |
| 1185 | #endif |
| 1186 | grn_edgecxx . . $ grn_edge# *edge; |
| 1187 | while ((edge = (grn_edgecxx . . $ grn_edge# *)grn_com_queue_dequecxx . . $ grn_com_queue_deque(a823fa5c468a7360).(ctx, &ctx_oldcxx . . $ ctx_old.))) { |
| 1188 | grn_objcxx . . $ grn_obj# *msg; |
| 1189 | while ((msg = (grn_objcxx . . $ grn_obj# *)grn_com_queue_dequecxx . . $ grn_com_queue_deque(a823fa5c468a7360).(ctx, &edge->send_oldcxx . . $ $anonymous_type_f1187c146b4d15e3_1#send_old.))) { |
| 1190 | grn_msg_closecxx . . $ grn_msg_close(4865d068a46d0f83).(&edge->ctxcxx . . $ $anonymous_type_f1187c146b4d15e3_1#ctx., msg); |
| 1191 | } |
| 1192 | while ((msg = (grn_objcxx . . $ grn_obj# *)grn_com_queue_dequecxx . . $ grn_com_queue_deque(a823fa5c468a7360).(ctx, &edge->recv_newcxx . . $ $anonymous_type_f1187c146b4d15e3_1#recv_new.))) { |
| 1193 | grn_msg_closecxx . . $ grn_msg_close(4865d068a46d0f83).(ctx, msg); |
| 1194 | } |
| 1195 | grn_ctx_fincxx . . $ grn_ctx_fin(2b4fa601bf4f1e5b).(&edge->ctxcxx . . $ $anonymous_type_f1187c146b4d15e3_1#ctx.); |
| 1196 | if (edge->comcxx . . $ $anonymous_type_f1187c146b4d15e3_1#com.->has_sidcxx . . $ _grn_com#has_sid. && edge->comcxx . . $ $anonymous_type_f1187c146b4d15e3_1#com.->opaquecxx . . $ _grn_com#opaque. == edge) { |
| 1197 | grn_com_closecxx . . $ grn_com_close(316fe94cc3b95f73).(ctx, edge->comcxx . . $ $anonymous_type_f1187c146b4d15e3_1#com.); |
| 1198 | } |
| 1199 | grn_edges_deletecxx . . $ grn_edges_delete(d784cba38f301350).(ctx, edge); |
| 1200 | } |
| 1201 | request_timer_process_timeoutcxx . . $ request_timer_process_timeout(49f6e7a06ebc5aa8).(); |
| 1202 | /* todo : log stat */ |
| 1203 | } |
| 1204 | running_event_loopcxx . . $ running_event_loop. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 1205 | for (;;) { |
| 1206 | uint32_tcxx . . $ uint32_t# i; |
| 1207 | CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(q_critical_section); |
| 1208 | for (i = 0; i < n_floating_threadscxx . . $ n_floating_threads.; i++) { |
| 1209 | COND_SIGNALcxx . . $ `lib/grn.h:233:11`!(q_cond); |
| 1210 | } |
| 1211 | CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(q_critical_section); |
| 1212 | if (n_running_threadscxx . . $ n_running_threads. == 0) { |
| 1213 | break; |
| 1214 | } |
| 1215 | grn_nanosleepcxx . . $ grn_nanosleep(2c44cd906ae4e829).(1000000); |
| 1216 | } |
| 1217 | { |
| 1218 | grn_edgecxx . . $ grn_edge# *edge; |
| 1219 | GRN_HASH_EACHcxx . . $ `include/groonga/hash.h:121:9`!(ctx, grn_edges, id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, &edge, { |
| 1220 | grn_obj *obj; |
| 1221 | while ((obj = (grn_obj *)grn_com_queue_deque(ctx, &edge->send_old))) { |
| 1222 | grn_msg_close(&edge->ctx, obj); |
| 1223 | } |
| 1224 | while ((obj = (grn_obj *)grn_com_queue_deque(ctx, &edge->recv_new))) { |
| 1225 | grn_msg_close(ctx, obj); |
| 1226 | } |
| 1227 | grn_ctx_fin(&edge->ctx); |
| 1228 | if (edge->com->has_sid) { |
| 1229 | grn_com_close(ctx, edge->com); |
| 1230 | } |
| 1231 | grn_edges_delete(ctx, edge); |
| 1232 | }); |
| 1233 | } |
| 1234 | { |
| 1235 | grn_comcxx . . $ grn_com# *com; |
| 1236 | GRN_HASH_EACHcxx . . $ `include/groonga/hash.h:121:9`!(ctx, ev->hash, id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, &com, { |
| 1237 | grn_com_close(ctx, com); |
| 1238 | }); |
| 1239 | } |
| 1240 | } |
| 1241 | |
| 1242 | static int |
| 1243 | run_servercxx . . $ run_server(9810093f35f3361c).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 1244 | grn_objcxx . . $ grn_obj# *db, |
| 1245 | grn_com_eventcxx . . $ grn_com_event# *ev, |
| 1246 | grn_edge_dispatcher_funccxx . . $ grn_edge_dispatcher_func# dispatcher, |
| 1247 | grn_handler_funccxx . . $ grn_handler_func# handler) |
| 1248 | { |
| 1249 | int exit_code = EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!; |
| 1250 | struct hostentcxx . . $ hostent# *he; |
| 1251 | if (!(he = gethostbynamecxx . . $ gethostbyname(69056c040771b155).(hostnamecxx . . $ hostname.))) { |
| 1252 | send_ready_notifycxx . . $ send_ready_notify(c9857a73d68e59ba).(); |
| 1253 | SOERRcxx . . $ `lib/grn_error.h:567:11`!("gethostbyname"); |
| 1254 | } else { |
| 1255 | ev->opaquecxx . . $ _grn_com_event#opaque. = db; |
| 1256 | grn_edges_initcxx . . $ grn_edges_init(4c9a06e3bd3b390f).(ctx, dispatcher); |
| 1257 | grn_job_queue_current_setcxx . . $ grn_job_queue_current_set(39419821abd7f16c).(ctx, &ctx_newcxx . . $ ctx_new.); |
| 1258 | if (!grn_com_sopencxx . . $ grn_com_sopen(1bf217a587181f98).(ctx, ev, bind_addresscxx . . $ bind_address., portcxx . . $ port., handler, he)) { |
| 1259 | send_ready_notifycxx . . $ send_ready_notify(c9857a73d68e59ba).(); |
| 1260 | run_server_loopcxx . . $ run_server_loop(9457405711a13c5e).(ctx, ev); |
| 1261 | exit_code = EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!; |
| 1262 | } else { |
| 1263 | send_ready_notifycxx . . $ send_ready_notify(c9857a73d68e59ba).(); |
| 1264 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 1265 | "grn_com_sopen failed (%s:%d): %s\n", |
| 1266 | bind_addresscxx . . $ bind_address., |
| 1267 | portcxx . . $ port., |
| 1268 | ctx->errbufcxx . . $ _grn_ctx#errbuf.); |
| 1269 | } |
| 1270 | grn_job_queue_current_setcxx . . $ grn_job_queue_current_set(39419821abd7f16c).(ctx, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 1271 | grn_edges_fincxx . . $ grn_edges_fin(b578cd6e53d5fe91).(ctx); |
| 1272 | } |
| 1273 | return exit_code; |
| 1274 | } |
| 1275 | |
| 1276 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 1277 | memcached_initcxx . . $ memcached_init(6769dd2542d68818).(grn_ctxcxx . . $ grn_ctx# *ctx); |
| 1278 | |
| 1279 | static int |
| 1280 | start_servicecxx . . $ start_service(de3b01120b57ace0).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 1281 | const char *db_path, |
| 1282 | grn_edge_dispatcher_funccxx . . $ grn_edge_dispatcher_func# dispatcher, |
| 1283 | grn_handler_funccxx . . $ grn_handler_func# handler) |
| 1284 | { |
| 1285 | int exit_code = EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!; |
| 1286 | grn_com_eventcxx . . $ grn_com_event# ev; |
| 1287 | |
| 1288 | if (is_daemon_modecxx . . $ is_daemon_mode.) { |
| 1289 | exit_code = daemonizecxx . . $ daemonize(b126dc7c1de90089).(); |
| 1290 | if (exit_code != EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!) { |
| 1291 | return exit_code; |
| 1292 | } |
| 1293 | } else { |
| 1294 | create_pid_filecxx . . $ create_pid_file(49f6e7a06ebc5aa8).(); |
| 1295 | } |
| 1296 | |
| 1297 | if (!grn_com_event_initcxx . . $ grn_com_event_init(d6b127b5bacdec40).(ctx, &ev, MAX_CONcxx . . $ `src/groonga.c:89:9`!, sizeof(grn_comcxx . . $ grn_com#))) { |
| 1298 | grn_objcxx . . $ grn_obj# *db; |
| 1299 | db = (newdbcxx . . $ newdb. || !db_path) ? grn_db_createcxx . . $ grn_db_create(d9bca101602a0e9b).(ctx, db_path, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 1300 | : grn_db_opencxx . . $ grn_db_open(7a18fc36feec5011).(ctx, db_path); |
| 1301 | if (db) { |
| 1302 | if (is_memcached_modecxx . . $ is_memcached_mode.) { |
| 1303 | if (!memcached_initcxx . . $ memcached_init(6769dd2542d68818).(ctx)) { |
| 1304 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 1305 | "failed to initialize memcached mode: %s\n", |
| 1306 | ctx->errbufcxx . . $ _grn_ctx#errbuf.); |
| 1307 | exit_code = EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 1308 | send_ready_notifycxx . . $ send_ready_notify(c9857a73d68e59ba).(); |
| 1309 | } |
| 1310 | } |
| 1311 | if (exit_code == EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!) { |
| 1312 | grn_com_event_set_listen_backlogcxx . . $ grn_com_event_set_listen_backlog(74bbb0ab88279c59).(ctx, &ev, listen_backlogcxx . . $ listen_backlog.); |
| 1313 | exit_code = run_servercxx . . $ run_server(9810093f35f3361c).(ctx, db, &ev, dispatcher, handler); |
| 1314 | } |
| 1315 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, db); |
| 1316 | } else { |
| 1317 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "db open failed (%s): %s\n", db_path, ctx->errbufcxx . . $ _grn_ctx#errbuf.); |
| 1318 | exit_code = EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 1319 | send_ready_notifycxx . . $ send_ready_notify(c9857a73d68e59ba).(); |
| 1320 | } |
| 1321 | grn_com_event_fincxx . . $ grn_com_event_fin(e61365b784be08b5).(ctx, &ev); |
| 1322 | } else { |
| 1323 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "grn_com_event_init failed\n"); |
| 1324 | exit_code = EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 1325 | send_ready_notifycxx . . $ send_ready_notify(c9857a73d68e59ba).(); |
| 1326 | } |
| 1327 | |
| 1328 | clean_pid_filecxx . . $ clean_pid_file(49f6e7a06ebc5aa8).(); |
| 1329 | |
| 1330 | return exit_code; |
| 1331 | } |
| 1332 | |
| 1333 | typedef structcxx . . $ $anonymous_type_1ab89eed5889867_2# { |
| 1334 | grn_msgcxx . . $ grn_msg# *msgcxx . . $ $anonymous_type_1ab89eed5889867_2#msg.; |
| 1335 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! in_bodycxx . . $ $anonymous_type_1ab89eed5889867_2#in_body.; |
| 1336 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_chunkedcxx . . $ $anonymous_type_1ab89eed5889867_2#is_chunked.; |
| 1337 | } ht_contextcxx . . $ ht_context#; |
| 1338 | |
| 1339 | static void |
| 1340 | h_output_set_headercxx . . $ h_output_set_header(e34fb84489eee7b1).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 1341 | grn_objcxx . . $ grn_obj# *header, |
| 1342 | grn_rccxx . . $ grn_rc# rc, |
| 1343 | int64_tcxx . . $ int64_t# content_length, |
| 1344 | grn_objcxx . . $ grn_obj# *foot) |
| 1345 | { |
| 1346 | switch (rc) { |
| 1347 | case GRN_SUCCESScxx . . $ GRN_SUCCESS.: |
| 1348 | GRN_TEXT_SETScxx . . $ `include/groonga/groonga.h:2783:9`!(ctx, header, "HTTP/1.1 200 OK\r\n"); |
| 1349 | break; |
| 1350 | case GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.: |
| 1351 | case GRN_FUNCTION_NOT_IMPLEMENTEDcxx . . $ GRN_FUNCTION_NOT_IMPLEMENTED.: |
| 1352 | case GRN_SYNTAX_ERRORcxx . . $ GRN_SYNTAX_ERROR.: |
| 1353 | GRN_TEXT_SETScxx . . $ `include/groonga/groonga.h:2783:9`!(ctx, header, "HTTP/1.1 400 Bad Request\r\n"); |
| 1354 | break; |
| 1355 | case GRN_NO_SUCH_FILE_OR_DIRECTORYcxx . . $ GRN_NO_SUCH_FILE_OR_DIRECTORY.: |
| 1356 | GRN_TEXT_SETScxx . . $ `include/groonga/groonga.h:2783:9`!(ctx, header, "HTTP/1.1 404 Not Found\r\n"); |
| 1357 | break; |
| 1358 | case GRN_CANCELcxx . . $ GRN_CANCEL.: |
| 1359 | GRN_TEXT_SETScxx . . $ `include/groonga/groonga.h:2783:9`!(ctx, header, "HTTP/1.1 408 Request Timeout\r\n"); |
| 1360 | break; |
| 1361 | default: |
| 1362 | GRN_TEXT_SETScxx . . $ `include/groonga/groonga.h:2783:9`!(ctx, header, "HTTP/1.1 500 Internal Server Error\r\n"); |
| 1363 | break; |
| 1364 | } |
| 1365 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, |
| 1366 | header, |
| 1367 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&http_response_server_line), |
| 1368 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&http_response_server_line)); |
| 1369 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, header, "Content-Type: "); |
| 1370 | if (grn_ctx_get_output_typecxx . . $ grn_ctx_get_output_type(969c4efba1cf6576).(ctx) == GRN_CONTENT_JSONcxx . . $ GRN_CONTENT_JSON. && foot && |
| 1371 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(foot) > 0 && |
| 1372 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(foot)[GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(foot) - 1] == ';') { |
| 1373 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, header, "application/javascript"); |
| 1374 | } else { |
| 1375 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, header, grn_ctx_get_mime_type(ctx)); |
| 1376 | } |
| 1377 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, header, "\r\n"); |
| 1378 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, header, "Connection: close\r\n"); |
| 1379 | if (content_length >= 0) { |
| 1380 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, header, "Content-Length: "); |
| 1381 | grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, header, content_length); |
| 1382 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, header, "\r\n"); |
| 1383 | } else { |
| 1384 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, header, "Transfer-Encoding: chunked\r\n"); |
| 1385 | } |
| 1386 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, header, "\r\n"); |
| 1387 | } |
| 1388 | |
| 1389 | static void |
| 1390 | h_output_sendcxx . . $ h_output_send(68fee16366be2ba4).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 1391 | grn_sockcxx . . $ grn_sock# fd, |
| 1392 | grn_objcxx . . $ grn_obj# *header, |
| 1393 | grn_objcxx . . $ grn_obj# *head, |
| 1394 | grn_objcxx . . $ grn_obj# *body, |
| 1395 | grn_objcxx . . $ grn_obj# *foot) |
| 1396 | { |
| 1397 | ssize_tcxx . . $ ssize_t# ret; |
| 1398 | ssize_tcxx . . $ ssize_t# len = 0; |
| 1399 | #ifdef WIN32 |
| 1400 | int n_buffers = 0; |
| 1401 | WSABUF wsabufs[4]; |
| 1402 | if (header) { |
| 1403 | wsabufs[n_buffers].buf = GRN_TEXT_VALUE(header); |
| 1404 | wsabufs[n_buffers].len = GRN_TEXT_LEN(header); |
| 1405 | len += GRN_TEXT_LEN(header); |
| 1406 | n_buffers++; |
| 1407 | } |
| 1408 | if (head) { |
| 1409 | wsabufs[n_buffers].buf = GRN_TEXT_VALUE(head); |
| 1410 | wsabufs[n_buffers].len = GRN_TEXT_LEN(head); |
| 1411 | len += GRN_TEXT_LEN(head); |
| 1412 | n_buffers++; |
| 1413 | } |
| 1414 | if (body) { |
| 1415 | wsabufs[n_buffers].buf = GRN_TEXT_VALUE(body); |
| 1416 | wsabufs[n_buffers].len = GRN_TEXT_LEN(body); |
| 1417 | len += GRN_TEXT_LEN(body); |
| 1418 | n_buffers++; |
| 1419 | } |
| 1420 | if (foot) { |
| 1421 | wsabufs[n_buffers].buf = GRN_TEXT_VALUE(foot); |
| 1422 | wsabufs[n_buffers].len = GRN_TEXT_LEN(foot); |
| 1423 | len += GRN_TEXT_LEN(foot); |
| 1424 | n_buffers++; |
| 1425 | } |
| 1426 | { |
| 1427 | DWORD sent = 0; |
| 1428 | if (WSASend(fd, wsabufs, n_buffers, &sent, 0, NULL, NULL) == SOCKET_ERROR) { |
| 1429 | SOERR("WSASend"); |
| 1430 | } |
| 1431 | ret = sent; |
| 1432 | } |
| 1433 | #else /* WIN32 */ |
| 1434 | struct ioveccxx . . $ iovec# msg_iov[4]; |
| 1435 | struct msghdrcxx . . $ msghdr# msg; |
| 1436 | msg.msg_namecxx . . $ msghdr#msg_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1437 | msg.msg_namelencxx . . $ msghdr#msg_namelen. = 0; |
| 1438 | msg.msg_iovcxx . . $ msghdr#msg_iov. = msg_iov; |
| 1439 | msg.msg_iovlencxx . . $ msghdr#msg_iovlen. = 0; |
| 1440 | msg.msg_controlcxx . . $ msghdr#msg_control. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1441 | msg.msg_controllencxx . . $ msghdr#msg_controllen. = 0; |
| 1442 | msg.msg_flagscxx . . $ msghdr#msg_flags. = 0; |
| 1443 | |
| 1444 | if (header) { |
| 1445 | msg_iov[msg.msg_iovlencxx . . $ msghdr#msg_iovlen.].iov_basecxx . . $ iovec#iov_base. = GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(header); |
| 1446 | msg_iov[msg.msg_iovlencxx . . $ msghdr#msg_iovlen.].iov_lencxx . . $ iovec#iov_len. = GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(header); |
| 1447 | len += GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(header); |
| 1448 | msg.msg_iovlencxx . . $ msghdr#msg_iovlen.++; |
| 1449 | } |
| 1450 | if (head) { |
| 1451 | msg_iov[msg.msg_iovlencxx . . $ msghdr#msg_iovlen.].iov_basecxx . . $ iovec#iov_base. = GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(head); |
| 1452 | msg_iov[msg.msg_iovlencxx . . $ msghdr#msg_iovlen.].iov_lencxx . . $ iovec#iov_len. = GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(head); |
| 1453 | len += GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(head); |
| 1454 | msg.msg_iovlencxx . . $ msghdr#msg_iovlen.++; |
| 1455 | } |
| 1456 | if (body) { |
| 1457 | msg_iov[msg.msg_iovlencxx . . $ msghdr#msg_iovlen.].iov_basecxx . . $ iovec#iov_base. = GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(body); |
| 1458 | msg_iov[msg.msg_iovlencxx . . $ msghdr#msg_iovlen.].iov_lencxx . . $ iovec#iov_len. = GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(body); |
| 1459 | len += GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(body); |
| 1460 | msg.msg_iovlencxx . . $ msghdr#msg_iovlen.++; |
| 1461 | } |
| 1462 | if (foot) { |
| 1463 | msg_iov[msg.msg_iovlencxx . . $ msghdr#msg_iovlen.].iov_basecxx . . $ iovec#iov_base. = GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(foot); |
| 1464 | msg_iov[msg.msg_iovlencxx . . $ msghdr#msg_iovlen.].iov_lencxx . . $ iovec#iov_len. = GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(foot); |
| 1465 | len += GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(foot); |
| 1466 | msg.msg_iovlencxx . . $ msghdr#msg_iovlen.++; |
| 1467 | } |
| 1468 | if ((ret = sendmsgcxx . . $ sendmsg(bc65c149164ceef5).(fd, &msg, MSG_NOSIGNALcxx . . $ `src/groonga.c:72:11`!)) == -1) { |
| 1469 | SOERRcxx . . $ `lib/grn_error.h:567:11`!("sendmsg"); |
| 1470 | } |
| 1471 | #endif /* WIN32 */ |
| 1472 | if (ret != len) { |
| 1473 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(&grn_gctx, |
| 1474 | GRN_LOG_NOTICE, |
| 1475 | "couldn't send all data (%" GRN_FMT_SSIZEcxx . . $ `lib/grn.h:409:11`! "/%" GRN_FMT_SSIZEcxx . . $ `lib/grn.h:409:11`! ")", |
| 1476 | ret, |
| 1477 | len); |
| 1478 | } |
| 1479 | GRN_QUERY_LOGcxx . . $ `include/groonga/groonga.h:2585:9`!(ctx, |
| 1480 | GRN_QUERY_LOG_SIZEcxx . . $ `include/groonga/groonga.h:216:9`!, |
| 1481 | ":", |
| 1482 | "send(%" GRN_FMT_SSIZEcxx . . $ `lib/grn.h:409:11`! "): %" GRN_FMT_SSIZEcxx . . $ `lib/grn.h:409:11`! "/%" GRN_FMT_SSIZEcxx . . $ `lib/grn.h:409:11`!, |
| 1483 | len, |
| 1484 | ret, |
| 1485 | len); |
| 1486 | } |
| 1487 | |
| 1488 | static void |
| 1489 | h_output_rawcxx . . $ h_output_raw(633b9c26205ce43f).(grn_ctxcxx . . $ grn_ctx# *ctx, int flags, ht_contextcxx . . $ ht_context# *hc) |
| 1490 | { |
| 1491 | grn_rccxx . . $ grn_rc# expr_rc = ctx->rccxx . . $ _grn_ctx#rc.; |
| 1492 | grn_sockcxx . . $ grn_sock# fd = hc->msgcxx . . $ $anonymous_type_1ab89eed5889867_2#msg.->ucxx . . $ _grn_msg#u..fdcxx . . $ _grn_msg#$anonymous_type_0#fd.; |
| 1493 | grn_objcxx . . $ grn_obj# header_; |
| 1494 | grn_objcxx . . $ grn_obj# head_; |
| 1495 | grn_objcxx . . $ grn_obj# body_; |
| 1496 | grn_objcxx . . $ grn_obj# foot_; |
| 1497 | grn_objcxx . . $ grn_obj# *header = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1498 | grn_objcxx . . $ grn_obj# *head = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1499 | grn_objcxx . . $ grn_obj# *body = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1500 | grn_objcxx . . $ grn_obj# *foot = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1501 | char *chunk = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1502 | unsigned int chunk_size = 0; |
| 1503 | int recv_flags; |
| 1504 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_last_message = (flags & GRN_CTX_TAILcxx . . $ `include/groonga/groonga.h:3294:9`!); |
| 1505 | |
| 1506 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&header_, 0); |
| 1507 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&head_, 0); |
| 1508 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&body_, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!); |
| 1509 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&foot_, 0); |
| 1510 | |
| 1511 | grn_ctx_recvcxx . . $ grn_ctx_recv(8b5d6c8a2a7bb976).(ctx, &chunk, &chunk_size, &recv_flags); |
| 1512 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, &body_, chunk, chunk_size); |
| 1513 | |
| 1514 | if (!hc->in_bodycxx . . $ $anonymous_type_1ab89eed5889867_2#in_body.) { |
| 1515 | if (is_last_message) { |
| 1516 | h_output_set_headercxx . . $ h_output_set_header(e34fb84489eee7b1).(ctx, &header_, expr_rc, GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&body_), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 1517 | hc->is_chunkedcxx . . $ $anonymous_type_1ab89eed5889867_2#is_chunked. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 1518 | } else { |
| 1519 | h_output_set_headercxx . . $ h_output_set_header(e34fb84489eee7b1).(ctx, &header_, expr_rc, -1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 1520 | hc->is_chunkedcxx . . $ $anonymous_type_1ab89eed5889867_2#is_chunked. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 1521 | } |
| 1522 | header = &header_; |
| 1523 | hc->in_bodycxx . . $ $anonymous_type_1ab89eed5889867_2#in_body. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 1524 | } |
| 1525 | |
| 1526 | if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&body_) > 0) { |
| 1527 | if (hc->is_chunkedcxx . . $ $anonymous_type_1ab89eed5889867_2#is_chunked.) { |
| 1528 | grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, |
| 1529 | &head_, |
| 1530 | "%x\r\n", |
| 1531 | (unsigned int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&body_)); |
| 1532 | head = &head_; |
| 1533 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &foot_, "\r\n"); |
| 1534 | foot = &foot_; |
| 1535 | } |
| 1536 | body = &body_; |
| 1537 | } |
| 1538 | |
| 1539 | if (is_last_message) { |
| 1540 | if (hc->is_chunkedcxx . . $ $anonymous_type_1ab89eed5889867_2#is_chunked.) { |
| 1541 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &foot_, "0\r\n"); |
| 1542 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &foot_, "\r\n"); |
| 1543 | foot = &foot_; |
| 1544 | } |
| 1545 | } |
| 1546 | |
| 1547 | h_output_sendcxx . . $ h_output_send(68fee16366be2ba4).(ctx, fd, header, head, body, foot); |
| 1548 | |
| 1549 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &foot_); |
| 1550 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &body_); |
| 1551 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &head_); |
| 1552 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &header_); |
| 1553 | } |
| 1554 | |
| 1555 | static void |
| 1556 | h_output_typedcxx . . $ h_output_typed(633b9c26205ce43f).(grn_ctxcxx . . $ grn_ctx# *ctx, int flags, ht_contextcxx . . $ ht_context# *hc) |
| 1557 | { |
| 1558 | grn_rccxx . . $ grn_rc# expr_rc = ctx->rccxx . . $ _grn_ctx#rc.; |
| 1559 | grn_sockcxx . . $ grn_sock# fd = hc->msgcxx . . $ $anonymous_type_1ab89eed5889867_2#msg.->ucxx . . $ _grn_msg#u..fdcxx . . $ _grn_msg#$anonymous_type_0#fd.; |
| 1560 | grn_objcxx . . $ grn_obj# header_; |
| 1561 | grn_objcxx . . $ grn_obj# head_; |
| 1562 | grn_objcxx . . $ grn_obj# body_; |
| 1563 | grn_objcxx . . $ grn_obj# foot_; |
| 1564 | grn_objcxx . . $ grn_obj# *header = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1565 | grn_objcxx . . $ grn_obj# *head = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1566 | grn_objcxx . . $ grn_obj# *body = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1567 | grn_objcxx . . $ grn_obj# *foot = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1568 | char *chunk = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1569 | unsigned int chunk_size = 0; |
| 1570 | int recv_flags; |
| 1571 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! should_return_body; |
| 1572 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_last_message = (flags & GRN_CTX_TAILcxx . . $ `include/groonga/groonga.h:3294:9`!); |
| 1573 | |
| 1574 | switch (hc->msgcxx . . $ $anonymous_type_1ab89eed5889867_2#msg.->headercxx . . $ _grn_msg#header..qtypecxx . . $ _grn_com_header#qtype.) { |
| 1575 | case 'G': |
| 1576 | case 'P': |
| 1577 | should_return_body = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 1578 | break; |
| 1579 | default: |
| 1580 | should_return_body = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 1581 | break; |
| 1582 | } |
| 1583 | |
| 1584 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&header_, 0); |
| 1585 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&head_, 0); |
| 1586 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&body_, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!); |
| 1587 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&foot_, 0); |
| 1588 | |
| 1589 | grn_ctx_recvcxx . . $ grn_ctx_recv(8b5d6c8a2a7bb976).(ctx, &chunk, &chunk_size, &recv_flags); |
| 1590 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, &body_, chunk, chunk_size); |
| 1591 | |
| 1592 | if (!hc->in_bodycxx . . $ $anonymous_type_1ab89eed5889867_2#in_body.) { |
| 1593 | if (is_last_message) { |
| 1594 | output_envelopecxx . . $ output_envelope(aa1eebc7c39b83c).(ctx, expr_rc, &head_, &body_, &foot_); |
| 1595 | h_output_set_headercxx . . $ h_output_set_header(e34fb84489eee7b1).(ctx, |
| 1596 | &header_, |
| 1597 | expr_rc, |
| 1598 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&head_) + GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&body_) + |
| 1599 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&foot_), |
| 1600 | &foot_); |
| 1601 | head = &head_; |
| 1602 | body = &body_; |
| 1603 | foot = &foot_; |
| 1604 | hc->is_chunkedcxx . . $ $anonymous_type_1ab89eed5889867_2#is_chunked. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 1605 | } else { |
| 1606 | grn_objcxx . . $ grn_obj# first_output; |
| 1607 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&first_output, 0); |
| 1608 | grn_output_envelope_opencxx . . $ grn_output_envelope_open(cda3a5f3c2e53c6b).(ctx, &first_output); |
| 1609 | size_tcxx . . $ size_t# first_output_length = GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&first_output); |
| 1610 | if (first_output_length > 0) { |
| 1611 | grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, |
| 1612 | &head_, |
| 1613 | "%x\r\n", |
| 1614 | (unsigned int)first_output_length); |
| 1615 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, |
| 1616 | &head_, |
| 1617 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&first_output), |
| 1618 | first_output_length); |
| 1619 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &head_, "\r\n"); |
| 1620 | head = &head_; |
| 1621 | } |
| 1622 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &first_output); |
| 1623 | |
| 1624 | h_output_set_headercxx . . $ h_output_set_header(e34fb84489eee7b1).(ctx, &header_, expr_rc, -1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 1625 | hc->is_chunkedcxx . . $ $anonymous_type_1ab89eed5889867_2#is_chunked. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 1626 | } |
| 1627 | header = &header_; |
| 1628 | hc->in_bodycxx . . $ $anonymous_type_1ab89eed5889867_2#in_body. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 1629 | } |
| 1630 | |
| 1631 | if (!should_return_body) { |
| 1632 | h_output_sendcxx . . $ h_output_send(68fee16366be2ba4).(ctx, fd, header, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 1633 | goto exit; |
| 1634 | } |
| 1635 | |
| 1636 | if (!hc->is_chunkedcxx . . $ $anonymous_type_1ab89eed5889867_2#is_chunked.) { |
| 1637 | if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&body_) > 0) { |
| 1638 | body = &body_; |
| 1639 | } |
| 1640 | h_output_sendcxx . . $ h_output_send(68fee16366be2ba4).(ctx, fd, header, head, body, foot); |
| 1641 | goto exit; |
| 1642 | } |
| 1643 | |
| 1644 | grn_objcxx . . $ grn_obj# chunk_; |
| 1645 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&chunk_, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!); |
| 1646 | const size_tcxx . . $ size_t# max_chunk_size = 64 * 1024 * 1024; |
| 1647 | size_tcxx . . $ size_t# offset = 0; |
| 1648 | for (offset = 0; GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&body_) - offset > max_chunk_size; |
| 1649 | offset += max_chunk_size) { |
| 1650 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, &chunk_, GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&body_) + offset, max_chunk_size); |
| 1651 | grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, &head_, "%x\r\n", (unsigned int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&chunk_)); |
| 1652 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &foot_, "\r\n"); |
| 1653 | h_output_sendcxx . . $ h_output_send(68fee16366be2ba4).(ctx, fd, header, &head_, &chunk_, &foot_); |
| 1654 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&head_); |
| 1655 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&foot_); |
| 1656 | header = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1657 | head = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1658 | foot = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1659 | } |
| 1660 | if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&body_) - offset > 0) { |
| 1661 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, |
| 1662 | &chunk_, |
| 1663 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&body_) + offset, |
| 1664 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&body_) - offset); |
| 1665 | grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, &head_, "%x\r\n", (unsigned int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&chunk_)); |
| 1666 | head = &head_; |
| 1667 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &foot_, "\r\n"); |
| 1668 | foot = &foot_; |
| 1669 | body = &chunk_; |
| 1670 | } |
| 1671 | if (is_last_message) { |
| 1672 | grn_objcxx . . $ grn_obj# last_output; |
| 1673 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&last_output, 0); |
| 1674 | grn_output_envelope_closecxx . . $ grn_output_envelope_close(6a9b897abe28c987).(ctx, |
| 1675 | &last_output, |
| 1676 | expr_rc, |
| 1677 | input_pathcxx . . $ input_path., |
| 1678 | number_of_linescxx . . $ number_of_lines.); |
| 1679 | size_tcxx . . $ size_t# last_output_length = GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&last_output); |
| 1680 | grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, &foot_, "%x\r\n", (unsigned int)last_output_length); |
| 1681 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, &foot_, GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&last_output), last_output_length); |
| 1682 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &foot_, "\r\n"); |
| 1683 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &last_output); |
| 1684 | |
| 1685 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &foot_, "0\r\n"); |
| 1686 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, &foot_, "\r\n"); |
| 1687 | foot = &foot_; |
| 1688 | } |
| 1689 | h_output_sendcxx . . $ h_output_send(68fee16366be2ba4).(ctx, fd, header, head, body, foot); |
| 1690 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &chunk_); |
| 1691 | |
| 1692 | exit: |
| 1693 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &foot_); |
| 1694 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &body_); |
| 1695 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &head_); |
| 1696 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &header_); |
| 1697 | } |
| 1698 | |
| 1699 | static void |
| 1700 | h_outputcxx . . $ h_output(e5088b957ff2e019).(grn_ctxcxx . . $ grn_ctx# *ctx, int flags, void *arg) |
| 1701 | { |
| 1702 | ht_contextcxx . . $ ht_context# *hc = (ht_contextcxx . . $ ht_context# *)arg; |
| 1703 | |
| 1704 | switch (grn_ctx_get_output_typecxx . . $ grn_ctx_get_output_type(969c4efba1cf6576).(ctx)) { |
| 1705 | case GRN_CONTENT_GROONGA_COMMAND_LISTcxx . . $ GRN_CONTENT_GROONGA_COMMAND_LIST.: |
| 1706 | case GRN_CONTENT_NONEcxx . . $ GRN_CONTENT_NONE.: |
| 1707 | h_output_rawcxx . . $ h_output_raw(633b9c26205ce43f).(ctx, flags, hc); |
| 1708 | break; |
| 1709 | default: |
| 1710 | h_output_typedcxx . . $ h_output_typed(633b9c26205ce43f).(ctx, flags, hc); |
| 1711 | break; |
| 1712 | } |
| 1713 | } |
| 1714 | |
| 1715 | typedef enumcxx . . $ $anonymous_type_1ab89eed5889867_3# { |
| 1716 | HTTP_CONTENT_TYPE_UNKNOWNcxx . . $ HTTP_CONTENT_TYPE_UNKNOWN., |
| 1717 | HTTP_CONTENT_TYPE_WWW_FORM_URLENCODEDcxx . . $ HTTP_CONTENT_TYPE_WWW_FORM_URLENCODED., |
| 1718 | HTTP_CONTENT_TYPE_JSONcxx . . $ HTTP_CONTENT_TYPE_JSON., |
| 1719 | HTTP_CONTENT_TYPE_APACHE_ARROW_STREAMINGcxx . . $ HTTP_CONTENT_TYPE_APACHE_ARROW_STREAMING., |
| 1720 | } http_content_typecxx . . $ http_content_type#; |
| 1721 | |
| 1722 | typedef structcxx . . $ $anonymous_type_1ab89eed5889867_4# { |
| 1723 | const char *method_startcxx . . $ $anonymous_type_1ab89eed5889867_4#method_start.; |
| 1724 | int method_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#method_length.; |
| 1725 | const char *path_startcxx . . $ $anonymous_type_1ab89eed5889867_4#path_start.; |
| 1726 | int path_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#path_length.; |
| 1727 | http_content_typecxx . . $ http_content_type# content_typecxx . . $ $anonymous_type_1ab89eed5889867_4#content_type.; |
| 1728 | const char *content_type_rawcxx . . $ $anonymous_type_1ab89eed5889867_4#content_type_raw.; |
| 1729 | long long int content_type_raw_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#content_type_raw_length.; |
| 1730 | long long int content_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#content_length.; |
| 1731 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! have_100_continuecxx . . $ $anonymous_type_1ab89eed5889867_4#have_100_continue.; |
| 1732 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_chunked_requestcxx . . $ $anonymous_type_1ab89eed5889867_4#is_chunked_request.; |
| 1733 | const char *body_startcxx . . $ $anonymous_type_1ab89eed5889867_4#body_start.; |
| 1734 | const char *body_endcxx . . $ $anonymous_type_1ab89eed5889867_4#body_end.; |
| 1735 | } h_headercxx . . $ h_header#; |
| 1736 | |
| 1737 | #define STRING_EQUALcxx . . $ `src/groonga.c:1737:9`!(string, string_length, constant_string) \ |
| 1738 | (string_length == strlen(constant_string) && \ |
| 1739 | strncmp(string, constant_string, string_length) == 0) |
| 1740 | |
| 1741 | #define STRING_EQUAL_CIcxx . . $ `src/groonga.c:1741:9`!(string, string_length, constant_string) \ |
| 1742 | (string_length == strlen(constant_string) && \ |
| 1743 | grn_strncasecmpcxx . . $ `include/groonga/portability.h:127:11`!(string, constant_string, string_length) == 0) |
| 1744 | |
| 1745 | static const char * |
| 1746 | h_parse_header_request_linecxx . . $ h_parse_header_request_line(6baac691e10faf1b).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 1747 | const char *start, |
| 1748 | const char *end, |
| 1749 | h_headercxx . . $ h_header# *header) |
| 1750 | { |
| 1751 | const char *current; |
| 1752 | |
| 1753 | { |
| 1754 | header->method_startcxx . . $ $anonymous_type_1ab89eed5889867_4#method_start. = start; |
| 1755 | for (current = header->method_startcxx . . $ $anonymous_type_1ab89eed5889867_4#method_start.; current < end; current++) { |
| 1756 | if (current[0] == '\n') { |
| 1757 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1758 | } |
| 1759 | if (current[0] == ' ') { |
| 1760 | header->method_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#method_length. = current - header->method_startcxx . . $ $anonymous_type_1ab89eed5889867_4#method_start.; |
| 1761 | current++; |
| 1762 | break; |
| 1763 | } |
| 1764 | } |
| 1765 | if (header->method_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#method_length. == -1) { |
| 1766 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1767 | } |
| 1768 | } |
| 1769 | |
| 1770 | { |
| 1771 | header->path_startcxx . . $ $anonymous_type_1ab89eed5889867_4#path_start. = current; |
| 1772 | header->path_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#path_length. = -1; |
| 1773 | for (; current < end; current++) { |
| 1774 | if (current[0] == '\n') { |
| 1775 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1776 | } |
| 1777 | if (current[0] == ' ') { |
| 1778 | header->path_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#path_length. = current - header->path_startcxx . . $ $anonymous_type_1ab89eed5889867_4#path_start.; |
| 1779 | current++; |
| 1780 | break; |
| 1781 | } |
| 1782 | } |
| 1783 | if (header->path_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#path_length. == -1) { |
| 1784 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1785 | } |
| 1786 | } |
| 1787 | |
| 1788 | { |
| 1789 | const char *http_version_start = current; |
| 1790 | int http_version_length = -1; |
| 1791 | for (; current < end; current++) { |
| 1792 | if (current[0] == '\n') { |
| 1793 | http_version_length = current - http_version_start; |
| 1794 | if (http_version_length > 0 && |
| 1795 | http_version_start[http_version_length - 1] == '\r') { |
| 1796 | http_version_length--; |
| 1797 | } |
| 1798 | current++; |
| 1799 | break; |
| 1800 | } |
| 1801 | } |
| 1802 | if (http_version_length == -1) { |
| 1803 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1804 | } |
| 1805 | if (!(STRING_EQUAL_CIcxx . . $ `src/groonga.c:1741:9`!(http_version_start, |
| 1806 | http_version_length, |
| 1807 | "HTTP/1.0") || |
| 1808 | STRING_EQUAL_CIcxx . . $ `src/groonga.c:1741:9`!(http_version_start, |
| 1809 | http_version_length, |
| 1810 | "HTTP/1.1"))) { |
| 1811 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1812 | } |
| 1813 | } |
| 1814 | |
| 1815 | return current; |
| 1816 | } |
| 1817 | |
| 1818 | static const char * |
| 1819 | h_parse_header_valuescxx . . $ h_parse_header_values(6baac691e10faf1b).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 1820 | const char *start, |
| 1821 | const char *end, |
| 1822 | h_headercxx . . $ h_header# *header) |
| 1823 | { |
| 1824 | const char *current; |
| 1825 | const char *name = start; |
| 1826 | int name_length = -1; |
| 1827 | const char *value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1828 | int value_length = -1; |
| 1829 | |
| 1830 | for (current = start; current < end; current++) { |
| 1831 | switch (current[0]) { |
| 1832 | case '\n': |
| 1833 | if (name_length == -1) { |
| 1834 | if (current - name == 1 && current[-1] == '\r') { |
| 1835 | return current + 1; |
| 1836 | } else { |
| 1837 | /* No ":" header line. TODO: report error. */ |
| 1838 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1839 | } |
| 1840 | } else { |
| 1841 | while (value < current && value[0] == ' ') { |
| 1842 | value++; |
| 1843 | } |
| 1844 | value_length = current - value; |
| 1845 | if (value_length > 0 && value[value_length - 1] == '\r') { |
| 1846 | value_length--; |
| 1847 | } |
| 1848 | if (STRING_EQUAL_CIcxx . . $ `src/groonga.c:1741:9`!(name, name_length, "Content-Type")) { |
| 1849 | header->content_type_rawcxx . . $ $anonymous_type_1ab89eed5889867_4#content_type_raw. = value; |
| 1850 | header->content_type_raw_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#content_type_raw_length. = value_length; |
| 1851 | const char *content_type = value; |
| 1852 | int content_type_length = value_length; |
| 1853 | int i; |
| 1854 | for (i = 0; i < content_type_length; i++) { |
| 1855 | if (content_type[i] == ';') { |
| 1856 | content_type_length = i; |
| 1857 | break; |
| 1858 | } |
| 1859 | } |
| 1860 | if (STRING_EQUAL_CIcxx . . $ `src/groonga.c:1741:9`!(content_type, |
| 1861 | content_type_length, |
| 1862 | "application/x-www-form-urlencoded")) { |
| 1863 | header->content_typecxx . . $ $anonymous_type_1ab89eed5889867_4#content_type. = HTTP_CONTENT_TYPE_WWW_FORM_URLENCODEDcxx . . $ HTTP_CONTENT_TYPE_WWW_FORM_URLENCODED.; |
| 1864 | } else if (STRING_EQUAL_CIcxx . . $ `src/groonga.c:1741:9`!(content_type, |
| 1865 | content_type_length, |
| 1866 | "application/json")) { |
| 1867 | header->content_typecxx . . $ $anonymous_type_1ab89eed5889867_4#content_type. = HTTP_CONTENT_TYPE_JSONcxx . . $ HTTP_CONTENT_TYPE_JSON.; |
| 1868 | } else if (STRING_EQUAL_CIcxx . . $ `src/groonga.c:1741:9`!(content_type, |
| 1869 | content_type_length, |
| 1870 | "application/vnd.apache.arrow.stream")) { |
| 1871 | header->content_typecxx . . $ $anonymous_type_1ab89eed5889867_4#content_type. = HTTP_CONTENT_TYPE_APACHE_ARROW_STREAMINGcxx . . $ HTTP_CONTENT_TYPE_APACHE_ARROW_STREAMING.; |
| 1872 | } else if (STRING_EQUAL_CIcxx . . $ `src/groonga.c:1741:9`!(content_type, |
| 1873 | content_type_length, |
| 1874 | "application/x-apache-arrow-streaming")) { |
| 1875 | header->content_typecxx . . $ $anonymous_type_1ab89eed5889867_4#content_type. = HTTP_CONTENT_TYPE_APACHE_ARROW_STREAMINGcxx . . $ HTTP_CONTENT_TYPE_APACHE_ARROW_STREAMING.; |
| 1876 | } else { |
| 1877 | header->content_typecxx . . $ $anonymous_type_1ab89eed5889867_4#content_type. = HTTP_CONTENT_TYPE_UNKNOWNcxx . . $ HTTP_CONTENT_TYPE_UNKNOWN.; |
| 1878 | } |
| 1879 | } else if (STRING_EQUAL_CIcxx . . $ `src/groonga.c:1741:9`!(name, name_length, "Content-Length")) { |
| 1880 | const char *rest; |
| 1881 | header->content_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#content_length. = |
| 1882 | grn_atollcxx . . $ grn_atoll(e3438c906dd00acd).(value, value + value_length, &rest); |
| 1883 | if (rest != value + value_length) { |
| 1884 | /* Invalid Content-Length value. TODO: report error. */ |
| 1885 | header->content_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#content_length. = -1; |
| 1886 | } |
| 1887 | } else if (STRING_EQUAL_CIcxx . . $ `src/groonga.c:1741:9`!(name, name_length, "Expect")) { |
| 1888 | if (STRING_EQUALcxx . . $ `src/groonga.c:1737:9`!(value, value_length, "100-continue")) { |
| 1889 | header->have_100_continuecxx . . $ $anonymous_type_1ab89eed5889867_4#have_100_continue. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 1890 | } |
| 1891 | } else if (STRING_EQUAL_CIcxx . . $ `src/groonga.c:1741:9`!(name, name_length, "Transfer-Encoding")) { |
| 1892 | if (STRING_EQUALcxx . . $ `src/groonga.c:1737:9`!(value, value_length, "chunked")) { |
| 1893 | header->is_chunked_requestcxx . . $ $anonymous_type_1ab89eed5889867_4#is_chunked_request. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 1894 | } |
| 1895 | } |
| 1896 | } |
| 1897 | name = current + 1; |
| 1898 | name_length = -1; |
| 1899 | value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1900 | value_length = -1; |
| 1901 | break; |
| 1902 | case ':': |
| 1903 | if (name_length == -1) { |
| 1904 | name_length = current - name; |
| 1905 | value = current + 1; |
| 1906 | } |
| 1907 | break; |
| 1908 | default: |
| 1909 | break; |
| 1910 | } |
| 1911 | } |
| 1912 | |
| 1913 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1914 | } |
| 1915 | |
| 1916 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 1917 | h_parse_headercxx . . $ h_parse_header(2441e82252b7f25c).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 1918 | const char *start, |
| 1919 | const char *end, |
| 1920 | h_headercxx . . $ h_header# *header) |
| 1921 | { |
| 1922 | const char *current; |
| 1923 | |
| 1924 | current = h_parse_header_request_linecxx . . $ h_parse_header_request_line(6baac691e10faf1b).(ctx, start, end, header); |
| 1925 | if (!current) { |
| 1926 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 1927 | } |
| 1928 | current = h_parse_header_valuescxx . . $ h_parse_header_values(6baac691e10faf1b).(ctx, current, end, header); |
| 1929 | if (!current) { |
| 1930 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 1931 | } |
| 1932 | |
| 1933 | if (current == end) { |
| 1934 | header->body_startcxx . . $ $anonymous_type_1ab89eed5889867_4#body_start. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1935 | } else { |
| 1936 | header->body_startcxx . . $ $anonymous_type_1ab89eed5889867_4#body_start. = current; |
| 1937 | } |
| 1938 | |
| 1939 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 1940 | } |
| 1941 | |
| 1942 | static void |
| 1943 | do_htreq_getcxx . . $ do_htreq_get(cea9be018c4c70d1).(grn_ctxcxx . . $ grn_ctx# *ctx, ht_contextcxx . . $ ht_context# *hc) |
| 1944 | { |
| 1945 | grn_msgcxx . . $ grn_msg# *msg = hc->msgcxx . . $ $anonymous_type_1ab89eed5889867_2#msg.; |
| 1946 | h_headercxx . . $ h_header# header; |
| 1947 | header.method_startcxx . . $ $anonymous_type_1ab89eed5889867_4#method_start. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1948 | header.method_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#method_length. = -1; |
| 1949 | header.path_startcxx . . $ $anonymous_type_1ab89eed5889867_4#path_start. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 1950 | header.path_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#path_length. = -1; |
| 1951 | if (!h_parse_header_request_linecxx . . $ h_parse_header_request_line(6baac691e10faf1b).(ctx, |
| 1952 | GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!((grn_obj *)msg), |
| 1953 | GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!((grn_obj *)msg), |
| 1954 | &header)) { |
| 1955 | return; |
| 1956 | } |
| 1957 | grn_ctx_sendcxx . . $ grn_ctx_send(dac8ec282379d9e0).(ctx, header.path_startcxx . . $ $anonymous_type_1ab89eed5889867_4#path_start., header.path_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#path_length., GRN_CTX_TAILcxx . . $ `include/groonga/groonga.h:3294:9`!); |
| 1958 | } |
| 1959 | |
| 1960 | typedef void (*grn_htreq_post_process_body_chunk_funccxx . . $ grn_htreq_post_process_body_chunk_func#)(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 1961 | const char *chunk, |
| 1962 | size_tcxx . . $ size_t# chunk_size, |
| 1963 | void *user_data); |
| 1964 | |
| 1965 | /* #define GRN_HTTP_POST_DEBUG */ |
| 1966 | #ifdef GRN_HTTP_POST_DEBUG |
| 1967 | # define grn_http_post_p(...) printf(__VA_ARGS__) |
| 1968 | #else |
| 1969 | # define grn_http_post_pcxx . . $ `src/groonga.c:1969:11`!(...) |
| 1970 | #endif |
| 1971 | |
| 1972 | static const char * |
| 1973 | do_htreq_post_process_body_chunked_read_chunk_sizecxx . . $ do_htreq_post_process_body_chunked_read_chunk_size(fa88d49af1e296f5).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 1974 | const char *data, |
| 1975 | size_tcxx . . $ size_t# data_size, |
| 1976 | size_tcxx . . $ size_t# *chunk_size, |
| 1977 | size_tcxx . . $ size_t# total_body_size) |
| 1978 | { |
| 1979 | const char *current = data; |
| 1980 | const char *data_end = data + data_size; |
| 1981 | while (data_end - current >= 2) { |
| 1982 | switch (current[0]) { |
| 1983 | case '0': |
| 1984 | case '1': |
| 1985 | case '2': |
| 1986 | case '3': |
| 1987 | case '4': |
| 1988 | case '5': |
| 1989 | case '6': |
| 1990 | case '7': |
| 1991 | case '8': |
| 1992 | case '9': |
| 1993 | case 'a': |
| 1994 | case 'b': |
| 1995 | case 'c': |
| 1996 | case 'd': |
| 1997 | case 'e': |
| 1998 | case 'f': |
| 1999 | case 'A': |
| 2000 | case 'B': |
| 2001 | case 'C': |
| 2002 | case 'D': |
| 2003 | case 'E': |
| 2004 | case 'F': |
| 2005 | /* OK */ |
| 2006 | break; |
| 2007 | case '\r': |
| 2008 | if (current[1] == '\n') { |
| 2009 | if (data == current) { |
| 2010 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, |
| 2011 | "[http][post][%" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`! "] " |
| 2012 | "chunked request size line doesn't have content", |
| 2013 | total_body_size); |
| 2014 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2015 | } |
| 2016 | *chunk_size = grn_htouicxx . . $ grn_htoui(2da3fe788a18ce64).(data, current, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 2017 | grn_http_post_pcxx . . $ `src/groonga.c:1969:11`!("[http][post][%" GRN_FMT_SIZE "] " |
| 2018 | "read chunk size: %" GRN_FMT_SIZE ": <%.*s>\n", |
| 2019 | total_body_size, |
| 2020 | *chunk_size, |
| 2021 | (int)(current - data), |
| 2022 | data); |
| 2023 | return current + 2; |
| 2024 | } else { |
| 2025 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, |
| 2026 | "[http][post][%" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`! "] " |
| 2027 | "chunked request size line isn't ended by CRLF: " |
| 2028 | "<%.*s>", |
| 2029 | total_body_size, |
| 2030 | (int)((current + 2) - data), |
| 2031 | data); |
| 2032 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2033 | } |
| 2034 | break; |
| 2035 | default: |
| 2036 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, |
| 2037 | "[http][post][%" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`! "] " |
| 2038 | "chunked request size line has garbage: " |
| 2039 | "<%.*s>", |
| 2040 | total_body_size, |
| 2041 | (int)((current + 1) - data), |
| 2042 | data); |
| 2043 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2044 | } |
| 2045 | current++; |
| 2046 | } |
| 2047 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2048 | } |
| 2049 | |
| 2050 | static void |
| 2051 | do_htreq_post_process_body_chunkedcxx . . $ do_htreq_post_process_body_chunked(7757c6770b43dd44).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 2052 | h_headercxx . . $ h_header# *header, |
| 2053 | grn_sockcxx . . $ grn_sock# fd, |
| 2054 | grn_htreq_post_process_body_chunk_funccxx . . $ grn_htreq_post_process_body_chunk_func# func, |
| 2055 | void *user_data) |
| 2056 | { |
| 2057 | grn_objcxx . . $ grn_obj# buffer; |
| 2058 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&buffer, 0); |
| 2059 | size_tcxx . . $ size_t# buffer_offset = 0; |
| 2060 | const char *data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2061 | size_tcxx . . $ size_t# data_size = 0; |
| 2062 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! need_chunk_size = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 2063 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! need_chunk_end_cr = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2064 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! need_chunk_end_lf = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2065 | size_tcxx . . $ size_t# chunk_size = 0; |
| 2066 | size_tcxx . . $ size_t# total_body_size = 0; |
| 2067 | |
| 2068 | if (header->body_startcxx . . $ $anonymous_type_1ab89eed5889867_4#body_start.) { |
| 2069 | data = header->body_startcxx . . $ $anonymous_type_1ab89eed5889867_4#body_start.; |
| 2070 | data_size = header->body_endcxx . . $ $anonymous_type_1ab89eed5889867_4#body_end. - header->body_startcxx . . $ $anonymous_type_1ab89eed5889867_4#body_start.; |
| 2071 | } |
| 2072 | |
| 2073 | while (truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!) { |
| 2074 | if (!data) { |
| 2075 | const size_tcxx . . $ size_t# buffer_size = 8192; |
| 2076 | if (GRN_BULK_RESTcxx . . $ `include/groonga/groonga.h:2638:9`!(&buffer) < buffer_size) { |
| 2077 | grn_bulk_reservecxx . . $ grn_bulk_reserve(f9a66385f261f61d).(ctx, &buffer, buffer_size); |
| 2078 | } |
| 2079 | int recv_flags = 0; |
| 2080 | ssize_tcxx . . $ ssize_t# recv_length = |
| 2081 | recvcxx . . $ recv(4136b1fcb15a75da).(fd, GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(&buffer), GRN_BULK_RESTcxx . . $ `include/groonga/groonga.h:2638:9`!(&buffer), recv_flags); |
| 2082 | if (recv_length == 0) { |
| 2083 | grn_http_post_pcxx . . $ `src/groonga.c:1969:11`!("[http][post][%" GRN_FMT_SIZE "] no data\n", |
| 2084 | total_body_size); |
| 2085 | break; |
| 2086 | } |
| 2087 | if (recv_length == -1) { |
| 2088 | SOERRcxx . . $ `lib/grn_error.h:567:11`!("recv"); |
| 2089 | break; |
| 2090 | } |
| 2091 | GRN_BULK_INCR_LENcxx . . $ `include/groonga/groonga.h:2627:9`!(&buffer, recv_length); |
| 2092 | data = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(&buffer) + buffer_offset; |
| 2093 | data_size = GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&buffer) - buffer_offset; |
| 2094 | } |
| 2095 | |
| 2096 | if (need_chunk_end_cr) { |
| 2097 | grn_http_post_pcxx . . $ `src/groonga.c:1969:11`!("[http][post][%" GRN_FMT_SIZE "] need chunk end CR\n", |
| 2098 | total_body_size); |
| 2099 | if (data[0] != '\r') { |
| 2100 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, |
| 2101 | "[http][post][%" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`! "] " |
| 2102 | "chunk end CR doesn't exit: <%c>", |
| 2103 | total_body_size, |
| 2104 | data[0]); |
| 2105 | break; |
| 2106 | } |
| 2107 | need_chunk_end_cr = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2108 | if (data_size == 1) { |
| 2109 | data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2110 | data_size = 0; |
| 2111 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buffer); |
| 2112 | buffer_offset = 0; |
| 2113 | continue; |
| 2114 | } |
| 2115 | data++; |
| 2116 | data_size--; |
| 2117 | } |
| 2118 | |
| 2119 | if (need_chunk_end_lf) { |
| 2120 | grn_http_post_pcxx . . $ `src/groonga.c:1969:11`!("[http][post][%" GRN_FMT_SIZE "] need chunk end LF\n", |
| 2121 | total_body_size); |
| 2122 | if (data[0] != '\n') { |
| 2123 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, |
| 2124 | "[http][post][%" GRN_FMT_SIZEcxx . . $ `lib/grn.h:408:11`! "] chunk end LF doesn't exit: <%c>", |
| 2125 | total_body_size, |
| 2126 | data[0]); |
| 2127 | break; |
| 2128 | } |
| 2129 | need_chunk_end_lf = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2130 | if (data_size == 1) { |
| 2131 | data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2132 | data_size = 0; |
| 2133 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buffer); |
| 2134 | buffer_offset = 0; |
| 2135 | continue; |
| 2136 | } |
| 2137 | data++; |
| 2138 | data_size--; |
| 2139 | } |
| 2140 | |
| 2141 | if (need_chunk_size) { |
| 2142 | grn_http_post_pcxx . . $ `src/groonga.c:1969:11`!("[http][post][%" GRN_FMT_SIZE "] need chunk size\n", |
| 2143 | total_body_size); |
| 2144 | const char *chunk_start = |
| 2145 | do_htreq_post_process_body_chunked_read_chunk_sizecxx . . $ do_htreq_post_process_body_chunked_read_chunk_size(fa88d49af1e296f5).(ctx, |
| 2146 | data, |
| 2147 | data_size, |
| 2148 | &chunk_size, |
| 2149 | total_body_size); |
| 2150 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 2151 | break; |
| 2152 | } |
| 2153 | if (chunk_size == 0) { |
| 2154 | grn_http_post_pcxx . . $ `src/groonga.c:1969:11`!("[http][post][%" GRN_FMT_SIZE "] " |
| 2155 | "zero chunk_size: <%.*s>\n", |
| 2156 | total_body_size, |
| 2157 | (int)((data + data_size) - chunk_start), |
| 2158 | chunk_start); |
| 2159 | break; |
| 2160 | } |
| 2161 | if (!chunk_start) { |
| 2162 | /* TODO: Test this */ |
| 2163 | grn_http_post_pcxx . . $ `src/groonga.c:1969:11`!("[http][post][%" GRN_FMT_SIZE "] " |
| 2164 | "no chunk start: %p:%p:%p\n", |
| 2165 | total_body_size, |
| 2166 | data, |
| 2167 | GRN_BULK_HEAD(&buffer), |
| 2168 | GRN_BULK_CURR(&buffer)); |
| 2169 | if (GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(&buffer) <= data && data < GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(&buffer)) { |
| 2170 | buffer_offset = data - GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(&buffer); |
| 2171 | } else { |
| 2172 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, &buffer, data, data_size); |
| 2173 | } |
| 2174 | data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2175 | data_size = 0; |
| 2176 | continue; |
| 2177 | } |
| 2178 | size_tcxx . . $ size_t# read_chunk_size = (data + data_size) - chunk_start; |
| 2179 | data = chunk_start; |
| 2180 | data_size = read_chunk_size; |
| 2181 | } |
| 2182 | |
| 2183 | grn_http_post_pcxx . . $ `src/groonga.c:1969:11`!("[http][post][%" GRN_FMT_SIZE "] " |
| 2184 | "data: %" GRN_FMT_SIZE ":%" GRN_FMT_SIZE "\n", |
| 2185 | total_body_size, |
| 2186 | data_size, |
| 2187 | chunk_size); |
| 2188 | if (data_size >= chunk_size) { |
| 2189 | func(ctx, data, chunk_size, user_data); |
| 2190 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 2191 | break; |
| 2192 | } |
| 2193 | total_body_size += chunk_size; |
| 2194 | if (data_size == chunk_size) { |
| 2195 | data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2196 | data_size = 0; |
| 2197 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buffer); |
| 2198 | buffer_offset = 0; |
| 2199 | } else { |
| 2200 | data += chunk_size; |
| 2201 | data_size -= chunk_size; |
| 2202 | } |
| 2203 | need_chunk_end_cr = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 2204 | need_chunk_end_lf = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 2205 | need_chunk_size = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 2206 | } else { |
| 2207 | func(ctx, data, data_size, user_data); |
| 2208 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 2209 | break; |
| 2210 | } |
| 2211 | total_body_size += data_size; |
| 2212 | chunk_size -= data_size; |
| 2213 | data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2214 | data_size = 0; |
| 2215 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&buffer); |
| 2216 | buffer_offset = 0; |
| 2217 | need_chunk_size = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2218 | } |
| 2219 | } |
| 2220 | |
| 2221 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &buffer); |
| 2222 | } |
| 2223 | |
| 2224 | static void |
| 2225 | do_htreq_post_process_body_rawcxx . . $ do_htreq_post_process_body_raw(7757c6770b43dd44).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 2226 | h_headercxx . . $ h_header# *header, |
| 2227 | grn_sockcxx . . $ grn_sock# fd, |
| 2228 | grn_htreq_post_process_body_chunk_funccxx . . $ grn_htreq_post_process_body_chunk_func# func, |
| 2229 | void *user_data) |
| 2230 | { |
| 2231 | long long int read_content_length = 0; |
| 2232 | if (header->body_startcxx . . $ $anonymous_type_1ab89eed5889867_4#body_start.) { |
| 2233 | size_tcxx . . $ size_t# read_body_length = header->body_endcxx . . $ $anonymous_type_1ab89eed5889867_4#body_end. - header->body_startcxx . . $ $anonymous_type_1ab89eed5889867_4#body_start.; |
| 2234 | read_content_length += read_body_length; |
| 2235 | func(ctx, header->body_startcxx . . $ $anonymous_type_1ab89eed5889867_4#body_start., read_body_length, user_data); |
| 2236 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 2237 | return; |
| 2238 | } |
| 2239 | } |
| 2240 | |
| 2241 | while (read_content_length < header->content_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#content_length.) { |
| 2242 | #define POST_BUFFER_SIZEcxx . . $ `src/groonga.c:2242:9`! 8192 |
| 2243 | char buffer[POST_BUFFER_SIZEcxx . . $ `src/groonga.c:2242:9`!]; |
| 2244 | int recv_flags = 0; |
| 2245 | ssize_tcxx . . $ ssize_t# recv_length = recvcxx . . $ recv(4136b1fcb15a75da).(fd, buffer, POST_BUFFER_SIZEcxx . . $ `src/groonga.c:2242:9`!, recv_flags); |
| 2246 | #undef POST_BUFFER_SIZEcxx . . $ `src/groonga.c:2242:9`! |
| 2247 | if (recv_length == 0) { |
| 2248 | break; |
| 2249 | } |
| 2250 | if (recv_length == -1) { |
| 2251 | SOERRcxx . . $ `lib/grn_error.h:567:11`!("recv"); |
| 2252 | break; |
| 2253 | } |
| 2254 | func(ctx, buffer, recv_length, user_data); |
| 2255 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 2256 | break; |
| 2257 | } |
| 2258 | read_content_length += recv_length; |
| 2259 | } |
| 2260 | } |
| 2261 | |
| 2262 | static void |
| 2263 | do_htreq_post_process_bodycxx . . $ do_htreq_post_process_body(7757c6770b43dd44).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 2264 | h_headercxx . . $ h_header# *header, |
| 2265 | grn_sockcxx . . $ grn_sock# fd, |
| 2266 | grn_htreq_post_process_body_chunk_funccxx . . $ grn_htreq_post_process_body_chunk_func# func, |
| 2267 | void *user_data) |
| 2268 | { |
| 2269 | if (header->is_chunked_requestcxx . . $ $anonymous_type_1ab89eed5889867_4#is_chunked_request.) { |
| 2270 | do_htreq_post_process_body_chunkedcxx . . $ do_htreq_post_process_body_chunked(7757c6770b43dd44).(ctx, header, fd, func, user_data); |
| 2271 | } else { |
| 2272 | do_htreq_post_process_body_rawcxx . . $ do_htreq_post_process_body_raw(7757c6770b43dd44).(ctx, header, fd, func, user_data); |
| 2273 | } |
| 2274 | } |
| 2275 | |
| 2276 | typedef structcxx . . $ $anonymous_type_1ab89eed5889867_5# { |
| 2277 | grn_objcxx . . $ grn_obj# commandcxx . . $ $anonymous_type_1ab89eed5889867_5#command.; |
| 2278 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! have_questioncxx . . $ $anonymous_type_1ab89eed5889867_5#have_question.; |
| 2279 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_first_chunkcxx . . $ $anonymous_type_1ab89eed5889867_5#is_first_chunk.; |
| 2280 | } http_post_www_form_urlencoded_datacxx . . $ http_post_www_form_urlencoded_data#; |
| 2281 | |
| 2282 | static void |
| 2283 | do_htreq_post_process_body_chunks_www_form_urlencodedcxx . . $ do_htreq_post_process_body_chunks_www_form_urlencoded(118ab0d98526d35a).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 2284 | const char *chunk, |
| 2285 | size_tcxx . . $ size_t# chunk_size, |
| 2286 | void *user_data) |
| 2287 | { |
| 2288 | http_post_www_form_urlencoded_datacxx . . $ http_post_www_form_urlencoded_data# *data = user_data; |
| 2289 | |
| 2290 | if (data->is_first_chunkcxx . . $ $anonymous_type_1ab89eed5889867_5#is_first_chunk.) { |
| 2291 | if (data->have_questioncxx . . $ $anonymous_type_1ab89eed5889867_5#have_question.) { |
| 2292 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, &(data->command), '&'); |
| 2293 | } else { |
| 2294 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, &(data->command), '?'); |
| 2295 | } |
| 2296 | data->is_first_chunkcxx . . $ $anonymous_type_1ab89eed5889867_5#is_first_chunk. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2297 | } |
| 2298 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, &(data->command), chunk, chunk_size); |
| 2299 | } |
| 2300 | |
| 2301 | static void |
| 2302 | do_htreq_post_process_body_www_form_urlencodedcxx . . $ do_htreq_post_process_body_www_form_urlencoded(69b0f5c21dbb4cad).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 2303 | h_headercxx . . $ h_header# *header, |
| 2304 | grn_sockcxx . . $ grn_sock# fd) |
| 2305 | { |
| 2306 | http_post_www_form_urlencoded_datacxx . . $ http_post_www_form_urlencoded_data# data; |
| 2307 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&(data.command), 0); |
| 2308 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, &(data.command), header->path_start, header->path_length); |
| 2309 | data.have_questioncxx . . $ $anonymous_type_1ab89eed5889867_5#have_question. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2310 | { |
| 2311 | int i; |
| 2312 | for (i = 0; i < header->path_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#path_length.; i++) { |
| 2313 | if (header->path_startcxx . . $ $anonymous_type_1ab89eed5889867_4#path_start.[i] == '?') { |
| 2314 | data.have_questioncxx . . $ $anonymous_type_1ab89eed5889867_5#have_question. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 2315 | break; |
| 2316 | } |
| 2317 | } |
| 2318 | } |
| 2319 | data.is_first_chunkcxx . . $ $anonymous_type_1ab89eed5889867_5#is_first_chunk. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 2320 | |
| 2321 | do_htreq_post_process_bodycxx . . $ do_htreq_post_process_body(7757c6770b43dd44).( |
| 2322 | ctx, |
| 2323 | header, |
| 2324 | fd, |
| 2325 | do_htreq_post_process_body_chunks_www_form_urlencodedcxx . . $ do_htreq_post_process_body_chunks_www_form_urlencoded(118ab0d98526d35a)., |
| 2326 | &data); |
| 2327 | if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 2328 | grn_ctx_sendcxx . . $ grn_ctx_send(dac8ec282379d9e0).(ctx, |
| 2329 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&(data.command)), |
| 2330 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&(data.command)), |
| 2331 | GRN_CTX_TAILcxx . . $ `include/groonga/groonga.h:3294:9`!); |
| 2332 | } |
| 2333 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(data.command)); |
| 2334 | } |
| 2335 | |
| 2336 | typedef structcxx . . $ $anonymous_type_1ab89eed5889867_6# { |
| 2337 | grn_objcxx . . $ grn_obj# chunk_buffer1cxx . . $ $anonymous_type_1ab89eed5889867_6#chunk_buffer1.; |
| 2338 | grn_objcxx . . $ grn_obj# chunk_buffer2cxx . . $ $anonymous_type_1ab89eed5889867_6#chunk_buffer2.; |
| 2339 | grn_objcxx . . $ grn_obj# *chunk_buffer_oldcxx . . $ $anonymous_type_1ab89eed5889867_6#chunk_buffer_old.; |
| 2340 | grn_objcxx . . $ grn_obj# *chunk_buffer_currentcxx . . $ $anonymous_type_1ab89eed5889867_6#chunk_buffer_current.; |
| 2341 | } http_post_load_datacxx . . $ http_post_load_data#; |
| 2342 | |
| 2343 | static void |
| 2344 | http_post_load_data_initcxx . . $ http_post_load_data_init(284df0df4c74141).(grn_ctxcxx . . $ grn_ctx# *ctx, http_post_load_datacxx . . $ http_post_load_data# *data) |
| 2345 | { |
| 2346 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&(data->chunk_buffer1), 0); |
| 2347 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&(data->chunk_buffer2), 0); |
| 2348 | data->chunk_buffer_oldcxx . . $ $anonymous_type_1ab89eed5889867_6#chunk_buffer_old. = &(data->chunk_buffer1cxx . . $ $anonymous_type_1ab89eed5889867_6#chunk_buffer1.); |
| 2349 | data->chunk_buffer_currentcxx . . $ $anonymous_type_1ab89eed5889867_6#chunk_buffer_current. = &(data->chunk_buffer2cxx . . $ $anonymous_type_1ab89eed5889867_6#chunk_buffer2.); |
| 2350 | } |
| 2351 | |
| 2352 | static void |
| 2353 | http_post_load_data_fincxx . . $ http_post_load_data_fin(284df0df4c74141).(grn_ctxcxx . . $ grn_ctx# *ctx, http_post_load_datacxx . . $ http_post_load_data# *data) |
| 2354 | { |
| 2355 | if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS. && |
| 2356 | (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(data->chunk_buffer_old) > 0 || |
| 2357 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(data->chunk_buffer_current) > 0)) { |
| 2358 | if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(data->chunk_buffer_old) > 0) { |
| 2359 | int flags; |
| 2360 | if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(data->chunk_buffer_current) > 0) { |
| 2361 | flags = GRN_CTX_MOREcxx . . $ `include/groonga/groonga.h:3293:9`!; |
| 2362 | } else { |
| 2363 | flags = GRN_CTX_TAILcxx . . $ `include/groonga/groonga.h:3294:9`!; |
| 2364 | } |
| 2365 | grn_ctx_sendcxx . . $ grn_ctx_send(dac8ec282379d9e0).(ctx, |
| 2366 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(data->chunk_buffer_old), |
| 2367 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(data->chunk_buffer_old), |
| 2368 | flags); |
| 2369 | } |
| 2370 | if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(data->chunk_buffer_current) > 0) { |
| 2371 | grn_ctx_sendcxx . . $ grn_ctx_send(dac8ec282379d9e0).(ctx, |
| 2372 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(data->chunk_buffer_current), |
| 2373 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(data->chunk_buffer_current), |
| 2374 | GRN_CTX_TAILcxx . . $ `include/groonga/groonga.h:3294:9`!); |
| 2375 | } |
| 2376 | } else { |
| 2377 | grn_ctx_sendcxx . . $ grn_ctx_send(dac8ec282379d9e0).(ctx, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GRN_CTX_TAILcxx . . $ `include/groonga/groonga.h:3294:9`!); |
| 2378 | } |
| 2379 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(data->chunk_buffer1)); |
| 2380 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(data->chunk_buffer2)); |
| 2381 | } |
| 2382 | |
| 2383 | static void |
| 2384 | http_post_load_data_flushcxx . . $ http_post_load_data_flush(284df0df4c74141).(grn_ctxcxx . . $ grn_ctx# *ctx, http_post_load_datacxx . . $ http_post_load_data# *data) |
| 2385 | { |
| 2386 | if (GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(data->chunk_buffer_old) > 0) { |
| 2387 | grn_ctx_sendcxx . . $ grn_ctx_send(dac8ec282379d9e0).(ctx, |
| 2388 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(data->chunk_buffer_old), |
| 2389 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(data->chunk_buffer_old), |
| 2390 | GRN_CTX_MOREcxx . . $ `include/groonga/groonga.h:3293:9`!); |
| 2391 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(data->chunk_buffer_old); |
| 2392 | } |
| 2393 | |
| 2394 | grn_objcxx . . $ grn_obj# *tmp = data->chunk_buffer_currentcxx . . $ $anonymous_type_1ab89eed5889867_6#chunk_buffer_current.; |
| 2395 | data->chunk_buffer_currentcxx . . $ $anonymous_type_1ab89eed5889867_6#chunk_buffer_current. = data->chunk_buffer_oldcxx . . $ $anonymous_type_1ab89eed5889867_6#chunk_buffer_old.; |
| 2396 | data->chunk_buffer_oldcxx . . $ $anonymous_type_1ab89eed5889867_6#chunk_buffer_old. = tmp; |
| 2397 | } |
| 2398 | |
| 2399 | static void |
| 2400 | do_htreq_post_process_body_load_chunks_jsoncxx . . $ do_htreq_post_process_body_load_chunks_json(118ab0d98526d35a).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 2401 | const char *chunk, |
| 2402 | size_tcxx . . $ size_t# chunk_size, |
| 2403 | void *user_data) |
| 2404 | { |
| 2405 | http_post_load_datacxx . . $ http_post_load_data# *data = user_data; |
| 2406 | |
| 2407 | const char *chunk_start = chunk; |
| 2408 | const char *chunk_end = chunk + chunk_size; |
| 2409 | const char *chunk_current; |
| 2410 | ; |
| 2411 | for (chunk_current = chunk_end - 1; chunk_current > chunk; chunk_current--) { |
| 2412 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_separator; |
| 2413 | switch (chunk_current[0]) { |
| 2414 | case '\n': |
| 2415 | case ',': |
| 2416 | is_separator = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 2417 | break; |
| 2418 | default: |
| 2419 | is_separator = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2420 | break; |
| 2421 | } |
| 2422 | if (!is_separator) { |
| 2423 | continue; |
| 2424 | } |
| 2425 | |
| 2426 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, |
| 2427 | data->chunk_buffer_current, |
| 2428 | chunk, |
| 2429 | chunk_current + 1 - chunk); |
| 2430 | http_post_load_data_flushcxx . . $ http_post_load_data_flush(284df0df4c74141).(ctx, data); |
| 2431 | chunk_start = chunk_current + 1; |
| 2432 | break; |
| 2433 | } |
| 2434 | |
| 2435 | if (chunk_end > chunk_start) { |
| 2436 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, |
| 2437 | data->chunk_buffer_current, |
| 2438 | chunk_start, |
| 2439 | chunk_end - chunk_start); |
| 2440 | } |
| 2441 | } |
| 2442 | |
| 2443 | static void |
| 2444 | do_htreq_post_process_body_load_jsoncxx . . $ do_htreq_post_process_body_load_json(69b0f5c21dbb4cad).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 2445 | h_headercxx . . $ h_header# *header, |
| 2446 | grn_sockcxx . . $ grn_sock# fd) |
| 2447 | { |
| 2448 | http_post_load_datacxx . . $ http_post_load_data# data; |
| 2449 | http_post_load_data_initcxx . . $ http_post_load_data_init(284df0df4c74141).(ctx, &data); |
| 2450 | do_htreq_post_process_bodycxx . . $ do_htreq_post_process_body(7757c6770b43dd44).(ctx, |
| 2451 | header, |
| 2452 | fd, |
| 2453 | do_htreq_post_process_body_load_chunks_jsoncxx . . $ do_htreq_post_process_body_load_chunks_json(118ab0d98526d35a)., |
| 2454 | &data); |
| 2455 | http_post_load_data_fincxx . . $ http_post_load_data_fin(284df0df4c74141).(ctx, &data); |
| 2456 | } |
| 2457 | |
| 2458 | static void |
| 2459 | do_htreq_post_process_body_load_chunks_genericcxx . . $ do_htreq_post_process_body_load_chunks_generic(118ab0d98526d35a).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 2460 | const char *chunk, |
| 2461 | size_tcxx . . $ size_t# chunk_size, |
| 2462 | void *user_data) |
| 2463 | { |
| 2464 | http_post_load_datacxx . . $ http_post_load_data# *data = user_data; |
| 2465 | GRN_TEXT_PUTcxx . . $ `include/groonga/groonga.h:2773:9`!(ctx, data->chunk_buffer_current, chunk, chunk_size); |
| 2466 | http_post_load_data_flushcxx . . $ http_post_load_data_flush(284df0df4c74141).(ctx, data); |
| 2467 | } |
| 2468 | |
| 2469 | static void |
| 2470 | do_htreq_post_process_body_load_genericcxx . . $ do_htreq_post_process_body_load_generic(69b0f5c21dbb4cad).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 2471 | h_headercxx . . $ h_header# *header, |
| 2472 | grn_sockcxx . . $ grn_sock# fd) |
| 2473 | { |
| 2474 | http_post_load_datacxx . . $ http_post_load_data# data; |
| 2475 | http_post_load_data_initcxx . . $ http_post_load_data_init(284df0df4c74141).(ctx, &data); |
| 2476 | do_htreq_post_process_bodycxx . . $ do_htreq_post_process_body(7757c6770b43dd44).(ctx, |
| 2477 | header, |
| 2478 | fd, |
| 2479 | do_htreq_post_process_body_load_chunks_genericcxx . . $ do_htreq_post_process_body_load_chunks_generic(118ab0d98526d35a)., |
| 2480 | &data); |
| 2481 | http_post_load_data_fincxx . . $ http_post_load_data_fin(284df0df4c74141).(ctx, &data); |
| 2482 | } |
| 2483 | |
| 2484 | static void |
| 2485 | do_htreq_postcxx . . $ do_htreq_post(cea9be018c4c70d1).(grn_ctxcxx . . $ grn_ctx# *ctx, ht_contextcxx . . $ ht_context# *hc) |
| 2486 | { |
| 2487 | grn_msgcxx . . $ grn_msg# *msg = hc->msgcxx . . $ $anonymous_type_1ab89eed5889867_2#msg.; |
| 2488 | grn_sockcxx . . $ grn_sock# fd = msg->ucxx . . $ _grn_msg#u..fdcxx . . $ _grn_msg#$anonymous_type_0#fd.; |
| 2489 | h_headercxx . . $ h_header# header; |
| 2490 | |
| 2491 | header.method_startcxx . . $ $anonymous_type_1ab89eed5889867_4#method_start. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2492 | header.method_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#method_length. = -1; |
| 2493 | header.path_startcxx . . $ $anonymous_type_1ab89eed5889867_4#path_start. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2494 | header.path_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#path_length. = -1; |
| 2495 | header.content_typecxx . . $ $anonymous_type_1ab89eed5889867_4#content_type. = HTTP_CONTENT_TYPE_UNKNOWNcxx . . $ HTTP_CONTENT_TYPE_UNKNOWN.; |
| 2496 | header.content_type_rawcxx . . $ $anonymous_type_1ab89eed5889867_4#content_type_raw. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2497 | header.content_type_raw_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#content_type_raw_length. = -1; |
| 2498 | header.content_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#content_length. = -1; |
| 2499 | header.body_startcxx . . $ $anonymous_type_1ab89eed5889867_4#body_start. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2500 | header.body_endcxx . . $ $anonymous_type_1ab89eed5889867_4#body_end. = GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!((grn_obj *)msg); |
| 2501 | header.have_100_continuecxx . . $ $anonymous_type_1ab89eed5889867_4#have_100_continue. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2502 | header.is_chunked_requestcxx . . $ $anonymous_type_1ab89eed5889867_4#is_chunked_request. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2503 | |
| 2504 | if (!h_parse_headercxx . . $ h_parse_header(2441e82252b7f25c).(ctx, |
| 2505 | GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!((grn_obj *)msg), |
| 2506 | header.body_endcxx . . $ $anonymous_type_1ab89eed5889867_4#body_end., |
| 2507 | &header)) { |
| 2508 | return; |
| 2509 | } |
| 2510 | if (!STRING_EQUALcxx . . $ `src/groonga.c:1737:9`!(header.method_start, header.method_length, "POST")) { |
| 2511 | return; |
| 2512 | } |
| 2513 | |
| 2514 | if (header.content_typecxx . . $ $anonymous_type_1ab89eed5889867_4#content_type. == HTTP_CONTENT_TYPE_UNKNOWNcxx . . $ HTTP_CONTENT_TYPE_UNKNOWN.) { |
| 2515 | const char *specified_content_type = header.content_type_rawcxx . . $ $anonymous_type_1ab89eed5889867_4#content_type_raw.; |
| 2516 | int specified_content_type_length = header.content_type_raw_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#content_type_raw_length.; |
| 2517 | if (!specified_content_type) { |
| 2518 | specified_content_type = ""; |
| 2519 | specified_content_type_length = 0; |
| 2520 | } |
| 2521 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, |
| 2522 | "[http][post] Content-Type must be one of " |
| 2523 | "application/x-www-form-urlencoded, " |
| 2524 | "application/json or " |
| 2525 | "application/vnd.apache.arrow.stream " |
| 2526 | "(application/x-apache-arrow-streaming): " |
| 2527 | "<%.*s>", |
| 2528 | specified_content_type_length, |
| 2529 | specified_content_type); |
| 2530 | ht_contextcxx . . $ ht_context# context; |
| 2531 | context.msgcxx . . $ $anonymous_type_1ab89eed5889867_2#msg. = msg; |
| 2532 | context.in_bodycxx . . $ $anonymous_type_1ab89eed5889867_2#in_body. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2533 | context.is_chunkedcxx . . $ $anonymous_type_1ab89eed5889867_2#is_chunked. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2534 | grn_ctx_set_output_typecxx . . $ grn_ctx_set_output_type(885ce0395b04a95d).(ctx, GRN_CONTENT_JSONcxx . . $ GRN_CONTENT_JSON.); |
| 2535 | h_outputcxx . . $ h_output(e5088b957ff2e019).(ctx, GRN_CTX_TAILcxx . . $ `include/groonga/groonga.h:3294:9`!, &context); |
| 2536 | return; |
| 2537 | } |
| 2538 | |
| 2539 | if (header.have_100_continuecxx . . $ $anonymous_type_1ab89eed5889867_4#have_100_continue.) { |
| 2540 | const char *continue_message = "HTTP/1.1 100 Continue\r\n\r\n"; |
| 2541 | ssize_tcxx . . $ ssize_t# send_size; |
| 2542 | int send_flags = MSG_NOSIGNALcxx . . $ `src/groonga.c:72:11`!; |
| 2543 | send_size = |
| 2544 | sendcxx . . $ send(4e364047dcdcb5ca).(fd, continue_message, strlencxx . . $ strlen(751346f8406fd082).(continue_message), send_flags); |
| 2545 | if (send_size == -1) { |
| 2546 | SOERRcxx . . $ `lib/grn_error.h:567:11`!("send"); |
| 2547 | return; |
| 2548 | } |
| 2549 | } |
| 2550 | |
| 2551 | if (header.content_typecxx . . $ $anonymous_type_1ab89eed5889867_4#content_type. == HTTP_CONTENT_TYPE_WWW_FORM_URLENCODEDcxx . . $ HTTP_CONTENT_TYPE_WWW_FORM_URLENCODED.) { |
| 2552 | do_htreq_post_process_body_www_form_urlencodedcxx . . $ do_htreq_post_process_body_www_form_urlencoded(69b0f5c21dbb4cad).(ctx, &header, fd); |
| 2553 | } else { |
| 2554 | grn_ctx_sendcxx . . $ grn_ctx_send(dac8ec282379d9e0).(ctx, header.path_startcxx . . $ $anonymous_type_1ab89eed5889867_4#path_start., header.path_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#path_length., GRN_CTX_MOREcxx . . $ `include/groonga/groonga.h:3293:9`!); |
| 2555 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) { |
| 2556 | ht_contextcxx . . $ ht_context# context; |
| 2557 | context.msgcxx . . $ $anonymous_type_1ab89eed5889867_2#msg. = msg; |
| 2558 | context.in_bodycxx . . $ $anonymous_type_1ab89eed5889867_2#in_body. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2559 | context.is_chunkedcxx . . $ $anonymous_type_1ab89eed5889867_2#is_chunked. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2560 | h_outputcxx . . $ h_output(e5088b957ff2e019).(ctx, GRN_CTX_TAILcxx . . $ `include/groonga/groonga.h:3294:9`!, &context); |
| 2561 | return; |
| 2562 | } |
| 2563 | |
| 2564 | if (header.content_typecxx . . $ $anonymous_type_1ab89eed5889867_4#content_type. == HTTP_CONTENT_TYPE_JSONcxx . . $ HTTP_CONTENT_TYPE_JSON.) { |
| 2565 | do_htreq_post_process_body_load_jsoncxx . . $ do_htreq_post_process_body_load_json(69b0f5c21dbb4cad).(ctx, &header, fd); |
| 2566 | } else { |
| 2567 | do_htreq_post_process_body_load_genericcxx . . $ do_htreq_post_process_body_load_generic(69b0f5c21dbb4cad).(ctx, &header, fd); |
| 2568 | } |
| 2569 | } |
| 2570 | } |
| 2571 | |
| 2572 | static void |
| 2573 | do_htreqcxx . . $ do_htreq(cea9be018c4c70d1).(grn_ctxcxx . . $ grn_ctx# *ctx, ht_contextcxx . . $ ht_context# *hc) |
| 2574 | { |
| 2575 | grn_msgcxx . . $ grn_msg# *msg = hc->msgcxx . . $ $anonymous_type_1ab89eed5889867_2#msg.; |
| 2576 | grn_com_headercxx . . $ grn_com_header# *header = &msg->headercxx . . $ _grn_msg#header.; |
| 2577 | switch (header->qtypecxx . . $ _grn_com_header#qtype.) { |
| 2578 | case 'G': /* GET */ |
| 2579 | case 'H': /* HEAD */ |
| 2580 | do_htreq_getcxx . . $ do_htreq_get(cea9be018c4c70d1).(ctx, hc); |
| 2581 | break; |
| 2582 | case 'P': /* POST */ |
| 2583 | do_htreq_postcxx . . $ do_htreq_post(cea9be018c4c70d1).(ctx, hc); |
| 2584 | break; |
| 2585 | } |
| 2586 | ERRCLRcxx . . $ `lib/grn_error.h:37:9`!(ctx); |
| 2587 | if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_CANCELcxx . . $ GRN_CANCEL.) { |
| 2588 | ctx->rccxx . . $ _grn_ctx#rc. = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 2589 | } |
| 2590 | /* if (ctx->rc != GRN_OPERATION_WOULD_BLOCK) {...} */ |
| 2591 | grn_msg_closecxx . . $ grn_msg_close(4865d068a46d0f83).(ctx, (grn_objcxx . . $ grn_obj# *)msg); |
| 2592 | /* if not keep alive connection */ |
| 2593 | grn_sock_closecxx . . $ `lib/grn.h:162:11`!(msg->u.fd); |
| 2594 | grn_com_event_start_acceptcxx . . $ grn_com_event_start_accept(e61365b784be08b5).(ctx, msg->acceptorcxx . . $ _grn_msg#acceptor.->evcxx . . $ _grn_com#ev.); |
| 2595 | } |
| 2596 | |
| 2597 | enumcxx . . $ $anonymous_type_1ab89eed5889867_7# { |
| 2598 | MBRES_SUCCESScxx . . $ MBRES_SUCCESS. = 0x00, |
| 2599 | MBRES_KEY_ENOENTcxx . . $ MBRES_KEY_ENOENT. = 0x01, |
| 2600 | MBRES_KEY_EEXISTScxx . . $ MBRES_KEY_EEXISTS. = 0x02, |
| 2601 | MBRES_E2BIGcxx . . $ MBRES_E2BIG. = 0x03, |
| 2602 | MBRES_EINVALcxx . . $ MBRES_EINVAL. = 0x04, |
| 2603 | MBRES_NOT_STOREDcxx . . $ MBRES_NOT_STORED. = 0x05, |
| 2604 | MBRES_UNKNOWN_COMMANDcxx . . $ MBRES_UNKNOWN_COMMAND. = 0x81, |
| 2605 | MBRES_ENOMEMcxx . . $ MBRES_ENOMEM. = 0x82, |
| 2606 | }; |
| 2607 | |
| 2608 | enumcxx . . $ $anonymous_type_1ab89eed5889867_8# { |
| 2609 | MBCMD_GETcxx . . $ MBCMD_GET. = 0x00, |
| 2610 | MBCMD_SETcxx . . $ MBCMD_SET. = 0x01, |
| 2611 | MBCMD_ADDcxx . . $ MBCMD_ADD. = 0x02, |
| 2612 | MBCMD_REPLACEcxx . . $ MBCMD_REPLACE. = 0x03, |
| 2613 | MBCMD_DELETEcxx . . $ MBCMD_DELETE. = 0x04, |
| 2614 | MBCMD_INCREMENTcxx . . $ MBCMD_INCREMENT. = 0x05, |
| 2615 | MBCMD_DECREMENTcxx . . $ MBCMD_DECREMENT. = 0x06, |
| 2616 | MBCMD_QUITcxx . . $ MBCMD_QUIT. = 0x07, |
| 2617 | MBCMD_FLUSHcxx . . $ MBCMD_FLUSH. = 0x08, |
| 2618 | MBCMD_GETQcxx . . $ MBCMD_GETQ. = 0x09, |
| 2619 | MBCMD_NOOPcxx . . $ MBCMD_NOOP. = 0x0a, |
| 2620 | MBCMD_VERSIONcxx . . $ MBCMD_VERSION. = 0x0b, |
| 2621 | MBCMD_GETKcxx . . $ MBCMD_GETK. = 0x0c, |
| 2622 | MBCMD_GETKQcxx . . $ MBCMD_GETKQ. = 0x0d, |
| 2623 | MBCMD_APPENDcxx . . $ MBCMD_APPEND. = 0x0e, |
| 2624 | MBCMD_PREPENDcxx . . $ MBCMD_PREPEND. = 0x0f, |
| 2625 | MBCMD_STATcxx . . $ MBCMD_STAT. = 0x10, |
| 2626 | MBCMD_SETQcxx . . $ MBCMD_SETQ. = 0x11, |
| 2627 | MBCMD_ADDQcxx . . $ MBCMD_ADDQ. = 0x12, |
| 2628 | MBCMD_REPLACEQcxx . . $ MBCMD_REPLACEQ. = 0x13, |
| 2629 | MBCMD_DELETEQcxx . . $ MBCMD_DELETEQ. = 0x14, |
| 2630 | MBCMD_INCREMENTQcxx . . $ MBCMD_INCREMENTQ. = 0x15, |
| 2631 | MBCMD_DECREMENTQcxx . . $ MBCMD_DECREMENTQ. = 0x16, |
| 2632 | MBCMD_QUITQcxx . . $ MBCMD_QUITQ. = 0x17, |
| 2633 | MBCMD_FLUSHQcxx . . $ MBCMD_FLUSHQ. = 0x18, |
| 2634 | MBCMD_APPENDQcxx . . $ MBCMD_APPENDQ. = 0x19, |
| 2635 | MBCMD_PREPENDQcxx . . $ MBCMD_PREPENDQ. = 0x1a |
| 2636 | }; |
| 2637 | |
| 2638 | static grn_objcxx . . $ grn_obj# *cache_tablecxx . . $ cache_table. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2639 | static grn_objcxx . . $ grn_obj# *cache_valuecxx . . $ cache_value. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2640 | static grn_objcxx . . $ grn_obj# *cache_flagscxx . . $ cache_flags. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2641 | static grn_objcxx . . $ grn_obj# *cache_expirecxx . . $ cache_expire. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2642 | static grn_objcxx . . $ grn_obj# *cache_cascxx . . $ cache_cas. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 2643 | |
| 2644 | #define CTX_GETcxx . . $ `src/groonga.c:2644:9`!(name) (grn_ctx_get(ctx, (name), strlen(name))) |
| 2645 | |
| 2646 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 2647 | memcached_setup_flags_columncxx . . $ memcached_setup_flags_column(445bcde47c288915).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *name) |
| 2648 | { |
| 2649 | cache_flagscxx . . $ cache_flags. = grn_obj_columncxx . . $ grn_obj_column(c00e49795c44129a).(ctx, cache_tablecxx . . $ cache_table., name, strlencxx . . $ strlen(751346f8406fd082).(name)); |
| 2650 | if (cache_flagscxx . . $ cache_flags.) { |
| 2651 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 2652 | } |
| 2653 | |
| 2654 | cache_flagscxx . . $ cache_flags. = grn_column_createcxx . . $ grn_column_create(dd4a346d390d76df).(ctx, |
| 2655 | cache_tablecxx . . $ cache_table., |
| 2656 | name, |
| 2657 | strlencxx . . $ strlen(751346f8406fd082).(name), |
| 2658 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 2659 | GRN_OBJ_COLUMN_SCALARcxx . . $ `include/groonga/groonga.h:731:9`! | GRN_OBJ_PERSISTENTcxx . . $ `include/groonga/groonga.h:827:9`!, |
| 2660 | grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, GRN_DB_UINT32cxx . . $ GRN_DB_UINT32.)); |
| 2661 | if (!cache_flagscxx . . $ cache_flags.) { |
| 2662 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2663 | } |
| 2664 | |
| 2665 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 2666 | } |
| 2667 | |
| 2668 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 2669 | memcached_setup_expire_columncxx . . $ memcached_setup_expire_column(445bcde47c288915).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *name) |
| 2670 | { |
| 2671 | cache_expirecxx . . $ cache_expire. = grn_obj_columncxx . . $ grn_obj_column(c00e49795c44129a).(ctx, cache_tablecxx . . $ cache_table., name, strlencxx . . $ strlen(751346f8406fd082).(name)); |
| 2672 | if (cache_expirecxx . . $ cache_expire.) { |
| 2673 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 2674 | } |
| 2675 | |
| 2676 | cache_expirecxx . . $ cache_expire. = grn_column_createcxx . . $ grn_column_create(dd4a346d390d76df).(ctx, |
| 2677 | cache_tablecxx . . $ cache_table., |
| 2678 | name, |
| 2679 | strlencxx . . $ strlen(751346f8406fd082).(name), |
| 2680 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 2681 | GRN_OBJ_COLUMN_SCALARcxx . . $ `include/groonga/groonga.h:731:9`! | GRN_OBJ_PERSISTENTcxx . . $ `include/groonga/groonga.h:827:9`!, |
| 2682 | grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, GRN_DB_UINT32cxx . . $ GRN_DB_UINT32.)); |
| 2683 | if (!cache_expirecxx . . $ cache_expire.) { |
| 2684 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2685 | } |
| 2686 | |
| 2687 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 2688 | } |
| 2689 | |
| 2690 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 2691 | memcached_setup_cas_columncxx . . $ memcached_setup_cas_column(445bcde47c288915).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *name) |
| 2692 | { |
| 2693 | cache_cascxx . . $ cache_cas. = grn_obj_columncxx . . $ grn_obj_column(c00e49795c44129a).(ctx, cache_tablecxx . . $ cache_table., name, strlencxx . . $ strlen(751346f8406fd082).(name)); |
| 2694 | if (cache_cascxx . . $ cache_cas.) { |
| 2695 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 2696 | } |
| 2697 | |
| 2698 | cache_cascxx . . $ cache_cas. = grn_column_createcxx . . $ grn_column_create(dd4a346d390d76df).(ctx, |
| 2699 | cache_tablecxx . . $ cache_table., |
| 2700 | name, |
| 2701 | strlencxx . . $ strlen(751346f8406fd082).(name), |
| 2702 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 2703 | GRN_OBJ_COLUMN_SCALARcxx . . $ `include/groonga/groonga.h:731:9`! | GRN_OBJ_PERSISTENTcxx . . $ `include/groonga/groonga.h:827:9`!, |
| 2704 | grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, GRN_DB_UINT64cxx . . $ GRN_DB_UINT64.)); |
| 2705 | if (!cache_cascxx . . $ cache_cas.) { |
| 2706 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2707 | } |
| 2708 | |
| 2709 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 2710 | } |
| 2711 | |
| 2712 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 2713 | memcached_initcxx . . $ memcached_init(6769dd2542d68818).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 2714 | { |
| 2715 | if (memcached_column_namecxx . . $ memcached_column_name.) { |
| 2716 | cache_valuecxx . . $ cache_value. = CTX_GETcxx . . $ `src/groonga.c:2644:9`!(memcached_column_name); |
| 2717 | if (!cache_valuecxx . . $ cache_value.) { |
| 2718 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, |
| 2719 | "memcached column doesn't exist: <%s>", |
| 2720 | memcached_column_name); |
| 2721 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2722 | } |
| 2723 | if (!(grn_obj_is_columncxx . . $ grn_obj_is_column(a5760e5c319a06ee).(ctx, cache_valuecxx . . $ cache_value.) && |
| 2724 | ((cache_valuecxx . . $ cache_value.->headercxx . . $ _grn_obj#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_COLUMN_TYPE_MASKcxx . . $ `include/groonga/groonga.h:726:9`!) == |
| 2725 | GRN_OBJ_COLUMN_SCALARcxx . . $ `include/groonga/groonga.h:731:9`!))) { |
| 2726 | grn_objcxx . . $ grn_obj# inspected; |
| 2727 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 2728 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, cache_valuecxx . . $ cache_value.); |
| 2729 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, |
| 2730 | "memcached column must be scalar column: <%.*s>", |
| 2731 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 2732 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 2733 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 2734 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2735 | } |
| 2736 | if (!(GRN_DB_SHORT_TEXTcxx . . $ GRN_DB_SHORT_TEXT. <= grn_obj_get_rangecxx . . $ grn_obj_get_range(8dd58acc9865e889).(ctx, cache_valuecxx . . $ cache_value.) && |
| 2737 | grn_obj_get_rangecxx . . $ grn_obj_get_range(8dd58acc9865e889).(ctx, cache_valuecxx . . $ cache_value.) <= GRN_DB_LONG_TEXTcxx . . $ GRN_DB_LONG_TEXT.)) { |
| 2738 | grn_objcxx . . $ grn_obj# inspected; |
| 2739 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 2740 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, cache_valuecxx . . $ cache_value.); |
| 2741 | ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, |
| 2742 | "memcached column must be text column: <%.*s>", |
| 2743 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 2744 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 2745 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 2746 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2747 | } |
| 2748 | |
| 2749 | cache_tablecxx . . $ cache_table. = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, cache_valuecxx . . $ cache_value.->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.); |
| 2750 | if (cache_tablecxx . . $ cache_table.->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_TABLE_NO_KEYcxx . . $ `include/groonga/groonga.h:898:9`!) { |
| 2751 | grn_objcxx . . $ grn_obj# inspected; |
| 2752 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 2753 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, cache_tablecxx . . $ cache_table.); |
| 2754 | ERRcxx . . $ `lib/grn_error.h:156:9`!( |
| 2755 | GRN_INVALID_ARGUMENT, |
| 2756 | "memcached column's table must be HASH_KEY, PAT_KEY or DAT_KEY table: " |
| 2757 | "<%.*s>", |
| 2758 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 2759 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 2760 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 2761 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2762 | } |
| 2763 | |
| 2764 | { |
| 2765 | char column_name[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!]; |
| 2766 | char value_column_name[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!]; |
| 2767 | int value_column_name_size; |
| 2768 | |
| 2769 | value_column_name_size = grn_column_namecxx . . $ grn_column_name(a51d1bff955f2f21).(ctx, |
| 2770 | cache_valuecxx . . $ cache_value., |
| 2771 | value_column_name, |
| 2772 | GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!); |
| 2773 | grn_snprintfcxx . . $ `include/groonga/portability.h:137:11`!(column_name, |
| 2774 | GRN_TABLE_MAX_KEY_SIZE, |
| 2775 | GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!, |
| 2776 | "%.*s_memcached_flags", |
| 2777 | value_column_name_size, |
| 2778 | value_column_name); |
| 2779 | if (!memcached_setup_flags_columncxx . . $ memcached_setup_flags_column(445bcde47c288915).(ctx, column_name)) { |
| 2780 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2781 | } |
| 2782 | grn_snprintfcxx . . $ `include/groonga/portability.h:137:11`!(column_name, |
| 2783 | GRN_TABLE_MAX_KEY_SIZE, |
| 2784 | GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!, |
| 2785 | "%.*s_memcached_expire", |
| 2786 | value_column_name_size, |
| 2787 | value_column_name); |
| 2788 | if (!memcached_setup_expire_columncxx . . $ memcached_setup_expire_column(445bcde47c288915).(ctx, column_name)) { |
| 2789 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2790 | } |
| 2791 | grn_snprintfcxx . . $ `include/groonga/portability.h:137:11`!(column_name, |
| 2792 | GRN_TABLE_MAX_KEY_SIZE, |
| 2793 | GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!, |
| 2794 | "%.*s_memcached_cas", |
| 2795 | value_column_name_size, |
| 2796 | value_column_name); |
| 2797 | if (!memcached_setup_cas_columncxx . . $ memcached_setup_cas_column(445bcde47c288915).(ctx, column_name)) { |
| 2798 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2799 | } |
| 2800 | } |
| 2801 | } else { |
| 2802 | const char *table_name = "Memcache"; |
| 2803 | const char *value_column_name = "value"; |
| 2804 | |
| 2805 | cache_tablecxx . . $ cache_table. = CTX_GETcxx . . $ `src/groonga.c:2644:9`!(table_name); |
| 2806 | if (!cache_tablecxx . . $ cache_table.) { |
| 2807 | cache_tablecxx . . $ cache_table. = grn_table_createcxx . . $ grn_table_create(51df5019e8d3bdc1).(ctx, |
| 2808 | table_name, |
| 2809 | strlencxx . . $ strlen(751346f8406fd082).(table_name), |
| 2810 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 2811 | GRN_OBJ_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:689:9`! | GRN_OBJ_PERSISTENTcxx . . $ `include/groonga/groonga.h:827:9`!, |
| 2812 | grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, GRN_DB_SHORT_TEXTcxx . . $ GRN_DB_SHORT_TEXT.), |
| 2813 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 2814 | if (!cache_tablecxx . . $ cache_table.) { |
| 2815 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2816 | } |
| 2817 | } |
| 2818 | |
| 2819 | cache_valuecxx . . $ cache_value. = grn_obj_columncxx . . $ grn_obj_column(c00e49795c44129a).(ctx, |
| 2820 | cache_tablecxx . . $ cache_table., |
| 2821 | value_column_name, |
| 2822 | strlencxx . . $ strlen(751346f8406fd082).(value_column_name)); |
| 2823 | if (!cache_valuecxx . . $ cache_value.) { |
| 2824 | cache_valuecxx . . $ cache_value. = |
| 2825 | grn_column_createcxx . . $ grn_column_create(dd4a346d390d76df).(ctx, |
| 2826 | cache_tablecxx . . $ cache_table., |
| 2827 | value_column_name, |
| 2828 | strlencxx . . $ strlen(751346f8406fd082).(value_column_name), |
| 2829 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 2830 | GRN_OBJ_COLUMN_SCALARcxx . . $ `include/groonga/groonga.h:731:9`! | GRN_OBJ_PERSISTENTcxx . . $ `include/groonga/groonga.h:827:9`!, |
| 2831 | grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, GRN_DB_SHORT_TEXTcxx . . $ GRN_DB_SHORT_TEXT.)); |
| 2832 | if (!cache_valuecxx . . $ cache_value.) { |
| 2833 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2834 | } |
| 2835 | } |
| 2836 | |
| 2837 | if (!memcached_setup_flags_columncxx . . $ memcached_setup_flags_column(445bcde47c288915).(ctx, "flags")) { |
| 2838 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2839 | } |
| 2840 | if (!memcached_setup_expire_columncxx . . $ memcached_setup_expire_column(445bcde47c288915).(ctx, "expire")) { |
| 2841 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2842 | } |
| 2843 | if (!memcached_setup_cas_columncxx . . $ memcached_setup_cas_column(445bcde47c288915).(ctx, "cas")) { |
| 2844 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 2845 | } |
| 2846 | } |
| 2847 | |
| 2848 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 2849 | } |
| 2850 | |
| 2851 | #define RELATIVE_TIME_THRESHcxx . . $ `src/groonga.c:2851:9`! 1000000000 |
| 2852 | |
| 2853 | #define MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, status, key_len, extra_len, flags) \ |
| 2854 | do { \ |
| 2855 | grn_msg_set_property((ctx), (re), (status), (key_len), (extra_len)); \ |
| 2856 | grn_msg_send((ctx), (re), (flags)); \ |
| 2857 | } while (0) |
| 2858 | |
| 2859 | #define GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!(block) \ |
| 2860 | do { \ |
| 2861 | if (!quiet) { \ |
| 2862 | grn_obj *re = \ |
| 2863 | grn_msg_open_for_reply(ctx, (grn_obj *)msg, &edge->send_old); \ |
| 2864 | ((grn_msg *)re)->header.qtype = header->qtype; \ |
| 2865 | block \ |
| 2866 | } \ |
| 2867 | } while (0) |
| 2868 | |
| 2869 | static uint64_tcxx . . $ uint64_t# |
| 2870 | get_mbreq_cas_idcxx . . $ get_mbreq_cas_id(7b3bcd0168edf51f).() |
| 2871 | { |
| 2872 | static uint64_tcxx . . $ uint64_t# cas_id = 0; |
| 2873 | /* FIXME: use GRN_ATOMIC_ADD_EX_64, but it is not implemented */ |
| 2874 | return ++cas_id; |
| 2875 | } |
| 2876 | |
| 2877 | static void |
| 2878 | do_mbreqcxx . . $ do_mbreq(d784cba38f301350).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_edgecxx . . $ grn_edge# *edge) |
| 2879 | { |
| 2880 | int quiet = 0; |
| 2881 | int flags = 0; |
| 2882 | grn_msgcxx . . $ grn_msg# *msg = edge->msgcxx . . $ $anonymous_type_f1187c146b4d15e3_1#msg.; |
| 2883 | grn_com_headercxx . . $ grn_com_header# *header = &msg->headercxx . . $ _grn_msg#header.; |
| 2884 | |
| 2885 | switch (header->qtypecxx . . $ _grn_com_header#qtype.) { |
| 2886 | case MBCMD_GETQcxx . . $ MBCMD_GETQ.: |
| 2887 | flags = GRN_CTX_MOREcxx . . $ `include/groonga/groonga.h:3293:9`!; |
| 2888 | /* fallthru */ |
| 2889 | case MBCMD_GETcxx . . $ MBCMD_GET.: |
| 2890 | { |
| 2891 | grn_idcxx . . $ grn_id# rid; |
| 2892 | uint16_tcxx . . $ uint16_t# keylen = ntohscxx . . $ `<external>/9581057695539925927/in.h:429:12`!(header->keylen); |
| 2893 | char *key = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!((grn_obj *)msg); |
| 2894 | rid = grn_table_getcxx . . $ grn_table_get(5676c91e20172100).(ctx, cache_tablecxx . . $ cache_table., key, keylen); |
| 2895 | if (!rid) { |
| 2896 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_KEY_ENOENT, 0, 0, 0); }); |
| 2897 | } else { |
| 2898 | grn_timevalcxx . . $ grn_timeval# tv; |
| 2899 | uint32_tcxx . . $ uint32_t# expire; |
| 2900 | { |
| 2901 | grn_objcxx . . $ grn_obj# expire_buf; |
| 2902 | GRN_UINT32_INITcxx . . $ `include/groonga/groonga.h:2854:9`!(&expire_buf, 0); |
| 2903 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, cache_expirecxx . . $ cache_expire., rid, &expire_buf); |
| 2904 | expire = GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(&expire_buf); |
| 2905 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, &expire_buf); |
| 2906 | } |
| 2907 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 2908 | if (expire && expire < tv.tv_seccxx . . $ $anonymous_type_1555d7cc1d218aa4_15#tv_sec.) { |
| 2909 | grn_table_delete_by_idcxx . . $ grn_table_delete_by_id(aedbc3eaefbe393f).(ctx, cache_tablecxx . . $ cache_table., rid); |
| 2910 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_KEY_ENOENT, 0, 0, 0); }); |
| 2911 | } else { |
| 2912 | grn_objcxx . . $ grn_obj# cas_buf; |
| 2913 | GRN_UINT64_INITcxx . . $ `include/groonga/groonga.h:2858:9`!(&cas_buf, 0); |
| 2914 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, cache_cascxx . . $ cache_cas., rid, &cas_buf); |
| 2915 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ |
| 2916 | grn_obj_get_value(ctx, cache_flags, rid, re); |
| 2917 | grn_obj_get_value(ctx, cache_value, rid, re); |
| 2918 | ((grn_msg *)re)->header.cas = GRN_UINT64_VALUEcxx . . $ `include/groonga/groonga.h:3105:9`!(&cas_buf); |
| 2919 | MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_SUCCESS, 0, 4, flags); |
| 2920 | }); |
| 2921 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, &cas_buf); |
| 2922 | } |
| 2923 | } |
| 2924 | } |
| 2925 | break; |
| 2926 | case MBCMD_SETQcxx . . $ MBCMD_SETQ.: |
| 2927 | case MBCMD_ADDQcxx . . $ MBCMD_ADDQ.: |
| 2928 | case MBCMD_REPLACEQcxx . . $ MBCMD_REPLACEQ.: |
| 2929 | quiet = 1; |
| 2930 | /* fallthru */ |
| 2931 | case MBCMD_SETcxx . . $ MBCMD_SET.: |
| 2932 | case MBCMD_ADDcxx . . $ MBCMD_ADD.: |
| 2933 | case MBCMD_REPLACEcxx . . $ MBCMD_REPLACE.: |
| 2934 | { |
| 2935 | grn_idcxx . . $ grn_id# rid; |
| 2936 | uint32_tcxx . . $ uint32_t# size = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(header->size); |
| 2937 | uint16_tcxx . . $ uint16_t# keylen = ntohscxx . . $ `<external>/9581057695539925927/in.h:429:12`!(header->keylen); |
| 2938 | uint8_tcxx . . $ uint8_t# extralen = header->levelcxx . . $ _grn_com_header#level.; |
| 2939 | char *body = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!((grn_obj *)msg); |
| 2940 | uint32_tcxx . . $ uint32_t# flags = *((uint32_tcxx . . $ uint32_t# *)body); |
| 2941 | uint32_tcxx . . $ uint32_t# expire = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(*((uint32_t *)(body + 4))); |
| 2942 | uint32_tcxx . . $ uint32_t# valuelen = size - keylen - extralen; |
| 2943 | char *key = body + 8; |
| 2944 | char *value = key + keylen; |
| 2945 | int added = 0; |
| 2946 | int f = |
| 2947 | (header->qtypecxx . . $ _grn_com_header#qtype. == MBCMD_REPLACEcxx . . $ MBCMD_REPLACE. || header->qtypecxx . . $ _grn_com_header#qtype. == MBCMD_REPLACEQcxx . . $ MBCMD_REPLACEQ.) |
| 2948 | ? 0 |
| 2949 | : GRN_TABLE_ADDcxx . . $ `lib/grn_io.h:188:9`!; |
| 2950 | GRN_ASSERTcxx . . $ `lib/grn_ctx.h:70:11`!(extralen == 8); |
| 2951 | if (header->qtypecxx . . $ _grn_com_header#qtype. == MBCMD_REPLACEcxx . . $ MBCMD_REPLACE. || header->qtypecxx . . $ _grn_com_header#qtype. == MBCMD_REPLACEQcxx . . $ MBCMD_REPLACEQ.) { |
| 2952 | rid = grn_table_getcxx . . $ grn_table_get(5676c91e20172100).(ctx, cache_tablecxx . . $ cache_table., key, keylen); |
| 2953 | } else { |
| 2954 | rid = grn_table_addcxx . . $ grn_table_add(8041cb9a4866097e).(ctx, cache_tablecxx . . $ cache_table., key, keylen, &added); |
| 2955 | } |
| 2956 | if (!rid) { |
| 2957 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ |
| 2958 | MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, |
| 2959 | re, |
| 2960 | (f & GRN_TABLE_ADDcxx . . $ `lib/grn_io.h:188:9`!) ? MBRES_ENOMEM : MBRES_NOT_STORED, |
| 2961 | 0, |
| 2962 | 0, |
| 2963 | 0); |
| 2964 | }); |
| 2965 | } else { |
| 2966 | if (added) { |
| 2967 | if (header->cascxx . . $ _grn_com_header#cas.) { |
| 2968 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_EINVAL, 0, 0, 0); }); |
| 2969 | } else { |
| 2970 | grn_objcxx . . $ grn_obj# text_buf, uint32_buf; |
| 2971 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&text_buf, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!); |
| 2972 | GRN_TEXT_SET_REFcxx . . $ `include/groonga/groonga.h:2756:9`!(&text_buf, value, valuelen); |
| 2973 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, cache_valuecxx . . $ cache_value., rid, &text_buf, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 2974 | GRN_UINT32_INITcxx . . $ `include/groonga/groonga.h:2854:9`!(&uint32_buf, 0); |
| 2975 | GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, &uint32_buf, flags); |
| 2976 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, cache_flagscxx . . $ cache_flags., rid, &uint32_buf, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 2977 | if (expire && expire < RELATIVE_TIME_THRESHcxx . . $ `src/groonga.c:2851:9`!) { |
| 2978 | grn_timevalcxx . . $ grn_timeval# tv; |
| 2979 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 2980 | expire += tv.tv_seccxx . . $ $anonymous_type_1555d7cc1d218aa4_15#tv_sec.; |
| 2981 | } |
| 2982 | GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, &uint32_buf, expire); |
| 2983 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, cache_expirecxx . . $ cache_expire., rid, &uint32_buf, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 2984 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, &uint32_buf); |
| 2985 | { |
| 2986 | grn_objcxx . . $ grn_obj# cas_buf; |
| 2987 | uint64_tcxx . . $ uint64_t# cas_id = get_mbreq_cas_idcxx . . $ get_mbreq_cas_id(7b3bcd0168edf51f).(); |
| 2988 | GRN_UINT64_INITcxx . . $ `include/groonga/groonga.h:2858:9`!(&cas_buf, 0); |
| 2989 | GRN_UINT64_SETcxx . . $ `include/groonga/groonga.h:2919:9`!(ctx, &cas_buf, cas_id); |
| 2990 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, cache_cascxx . . $ cache_cas., rid, &cas_buf, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 2991 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, &cas_buf); |
| 2992 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ |
| 2993 | ((grn_msg *)re)->header.cas = cas_id; |
| 2994 | MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_SUCCESS, 0, 0, 0); |
| 2995 | }); |
| 2996 | } |
| 2997 | } |
| 2998 | } else { |
| 2999 | if (header->qtypecxx . . $ _grn_com_header#qtype. != MBCMD_SETcxx . . $ MBCMD_SET. && header->qtypecxx . . $ _grn_com_header#qtype. != MBCMD_SETQcxx . . $ MBCMD_SETQ.) { |
| 3000 | grn_objcxx . . $ grn_obj# uint32_buf; |
| 3001 | grn_timevalcxx . . $ grn_timeval# tv; |
| 3002 | uint32_tcxx . . $ uint32_t# oexpire; |
| 3003 | |
| 3004 | GRN_UINT32_INITcxx . . $ `include/groonga/groonga.h:2854:9`!(&uint32_buf, 0); |
| 3005 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, cache_expirecxx . . $ cache_expire., rid, &uint32_buf); |
| 3006 | oexpire = GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(&uint32_buf); |
| 3007 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 3008 | |
| 3009 | if (oexpire && oexpire < tv.tv_seccxx . . $ $anonymous_type_1555d7cc1d218aa4_15#tv_sec.) { |
| 3010 | if (header->qtypecxx . . $ _grn_com_header#qtype. == MBCMD_REPLACEcxx . . $ MBCMD_REPLACE. || |
| 3011 | header->qtypecxx . . $ _grn_com_header#qtype. == MBCMD_REPLACEQcxx . . $ MBCMD_REPLACEQ.) { |
| 3012 | grn_table_delete_by_idcxx . . $ grn_table_delete_by_id(aedbc3eaefbe393f).(ctx, cache_tablecxx . . $ cache_table., rid); |
| 3013 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_NOT_STORED, 0, 0, 0); }); |
| 3014 | break; |
| 3015 | } |
| 3016 | } else if (header->qtypecxx . . $ _grn_com_header#qtype. == MBCMD_ADDcxx . . $ MBCMD_ADD. || |
| 3017 | header->qtypecxx . . $ _grn_com_header#qtype. == MBCMD_ADDQcxx . . $ MBCMD_ADDQ.) { |
| 3018 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_NOT_STORED, 0, 0, 0); }); |
| 3019 | break; |
| 3020 | } |
| 3021 | } |
| 3022 | { |
| 3023 | if (header->cascxx . . $ _grn_com_header#cas.) { |
| 3024 | grn_objcxx . . $ grn_obj# cas_buf; |
| 3025 | GRN_UINT64_INITcxx . . $ `include/groonga/groonga.h:2858:9`!(&cas_buf, 0); |
| 3026 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, cache_cascxx . . $ cache_cas., rid, &cas_buf); |
| 3027 | if (header->cascxx . . $ _grn_com_header#cas. != GRN_UINT64_VALUEcxx . . $ `include/groonga/groonga.h:3105:9`!(&cas_buf)) { |
| 3028 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_NOT_STORED, 0, 0, 0); }); |
| 3029 | } |
| 3030 | } |
| 3031 | { |
| 3032 | grn_objcxx . . $ grn_obj# text_buf, uint32_buf; |
| 3033 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&text_buf, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!); |
| 3034 | GRN_TEXT_SET_REFcxx . . $ `include/groonga/groonga.h:2756:9`!(&text_buf, value, valuelen); |
| 3035 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, cache_valuecxx . . $ cache_value., rid, &text_buf, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 3036 | GRN_UINT32_INITcxx . . $ `include/groonga/groonga.h:2854:9`!(&uint32_buf, 0); |
| 3037 | GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, &uint32_buf, flags); |
| 3038 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, |
| 3039 | cache_flagscxx . . $ cache_flags., |
| 3040 | rid, |
| 3041 | &uint32_buf, |
| 3042 | GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 3043 | if (expire && expire < RELATIVE_TIME_THRESHcxx . . $ `src/groonga.c:2851:9`!) { |
| 3044 | grn_timevalcxx . . $ grn_timeval# tv; |
| 3045 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 3046 | expire += tv.tv_seccxx . . $ $anonymous_type_1555d7cc1d218aa4_15#tv_sec.; |
| 3047 | } |
| 3048 | GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, &uint32_buf, expire); |
| 3049 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, |
| 3050 | cache_expirecxx . . $ cache_expire., |
| 3051 | rid, |
| 3052 | &uint32_buf, |
| 3053 | GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 3054 | { |
| 3055 | grn_objcxx . . $ grn_obj# cas_buf; |
| 3056 | uint64_tcxx . . $ uint64_t# cas_id = get_mbreq_cas_idcxx . . $ get_mbreq_cas_id(7b3bcd0168edf51f).(); |
| 3057 | GRN_UINT64_INITcxx . . $ `include/groonga/groonga.h:2858:9`!(&cas_buf, 0); |
| 3058 | GRN_UINT64_SETcxx . . $ `include/groonga/groonga.h:2919:9`!(ctx, &cas_buf, cas_id); |
| 3059 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, cache_cascxx . . $ cache_cas., rid, &cas_buf, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 3060 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ |
| 3061 | ((grn_msg *)re)->header.cas = cas_id; |
| 3062 | MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_SUCCESS, 0, 0, 0); |
| 3063 | }); |
| 3064 | } |
| 3065 | } |
| 3066 | } |
| 3067 | } |
| 3068 | } |
| 3069 | } |
| 3070 | break; |
| 3071 | case MBCMD_DELETEQcxx . . $ MBCMD_DELETEQ.: |
| 3072 | quiet = 1; |
| 3073 | /* fallthru */ |
| 3074 | case MBCMD_DELETEcxx . . $ MBCMD_DELETE.: |
| 3075 | { |
| 3076 | grn_idcxx . . $ grn_id# rid; |
| 3077 | uint16_tcxx . . $ uint16_t# keylen = ntohscxx . . $ `<external>/9581057695539925927/in.h:429:12`!(header->keylen); |
| 3078 | char *key = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!((grn_obj *)msg); |
| 3079 | rid = grn_table_getcxx . . $ grn_table_get(5676c91e20172100).(ctx, cache_tablecxx . . $ cache_table., key, keylen); |
| 3080 | if (!rid) { |
| 3081 | /* GRN_LOG(ctx, GRN_LOG_NOTICE, "GET k=%d not found", keylen); */ |
| 3082 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_KEY_ENOENT, 0, 0, 0); }); |
| 3083 | } else { |
| 3084 | grn_table_delete_by_idcxx . . $ grn_table_delete_by_id(aedbc3eaefbe393f).(ctx, cache_tablecxx . . $ cache_table., rid); |
| 3085 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_SUCCESS, 0, 4, 0); }); |
| 3086 | } |
| 3087 | } |
| 3088 | break; |
| 3089 | case MBCMD_INCREMENTQcxx . . $ MBCMD_INCREMENTQ.: |
| 3090 | case MBCMD_DECREMENTQcxx . . $ MBCMD_DECREMENTQ.: |
| 3091 | quiet = 1; |
| 3092 | /* fallthru */ |
| 3093 | case MBCMD_INCREMENTcxx . . $ MBCMD_INCREMENT.: |
| 3094 | case MBCMD_DECREMENTcxx . . $ MBCMD_DECREMENT.: |
| 3095 | { |
| 3096 | grn_idcxx . . $ grn_id# rid; |
| 3097 | int added = 0; |
| 3098 | uint64_tcxx . . $ uint64_t# delta, init; |
| 3099 | uint16_tcxx . . $ uint16_t# keylen = ntohscxx . . $ `<external>/9581057695539925927/in.h:429:12`!(header->keylen); |
| 3100 | char *body = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!((grn_obj *)msg); |
| 3101 | char *key = body + 20; |
| 3102 | uint32_tcxx . . $ uint32_t# expire = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(*((uint32_t *)(body + 16))); |
| 3103 | grn_ntohcxx . . $ `lib/grn.h:611:9`!(&delta, body, 8); |
| 3104 | grn_ntohcxx . . $ `lib/grn.h:611:9`!(&init, body + 8, 8); |
| 3105 | GRN_ASSERTcxx . . $ `lib/grn_ctx.h:70:11`!(header->level == 20); /* extralen */ |
| 3106 | if (expire == 0xffffffff) { |
| 3107 | rid = grn_table_getcxx . . $ grn_table_get(5676c91e20172100).(ctx, cache_tablecxx . . $ cache_table., key, keylen); |
| 3108 | } else { |
| 3109 | rid = grn_table_addcxx . . $ grn_table_add(8041cb9a4866097e).(ctx, cache_tablecxx . . $ cache_table., key, keylen, &added); |
| 3110 | } |
| 3111 | if (!rid) { |
| 3112 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_KEY_ENOENT, 0, 0, 0); }); |
| 3113 | } else { |
| 3114 | grn_objcxx . . $ grn_obj# uint32_buf, text_buf; |
| 3115 | GRN_UINT32_INITcxx . . $ `include/groonga/groonga.h:2854:9`!(&uint32_buf, 0); |
| 3116 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&text_buf, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!); |
| 3117 | if (added) { |
| 3118 | GRN_TEXT_SET_REFcxx . . $ `include/groonga/groonga.h:2756:9`!(&text_buf, &init, 8); |
| 3119 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, cache_valuecxx . . $ cache_value., rid, &text_buf, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 3120 | GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, &uint32_buf, 0); |
| 3121 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, cache_flagscxx . . $ cache_flags., rid, &uint32_buf, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 3122 | } else { |
| 3123 | grn_timevalcxx . . $ grn_timeval# tv; |
| 3124 | uint32_tcxx . . $ uint32_t# oexpire; |
| 3125 | |
| 3126 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, cache_expirecxx . . $ cache_expire., rid, &uint32_buf); |
| 3127 | oexpire = GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(&uint32_buf); |
| 3128 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 3129 | |
| 3130 | if (oexpire && oexpire < tv.tv_seccxx . . $ $anonymous_type_1555d7cc1d218aa4_15#tv_sec.) { |
| 3131 | if (expire == 0xffffffffU) { |
| 3132 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_KEY_ENOENT, 0, 0, 0); }); |
| 3133 | break; |
| 3134 | } else { |
| 3135 | GRN_TEXT_SET_REFcxx . . $ `include/groonga/groonga.h:2756:9`!(&text_buf, &init, 8); |
| 3136 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, cache_valuecxx . . $ cache_value., rid, &text_buf, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 3137 | GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, &uint32_buf, 0); |
| 3138 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, |
| 3139 | cache_flagscxx . . $ cache_flags., |
| 3140 | rid, |
| 3141 | &uint32_buf, |
| 3142 | GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 3143 | } |
| 3144 | } else { |
| 3145 | grn_objcxx . . $ grn_obj# uint64_buf; |
| 3146 | GRN_UINT64_INITcxx . . $ `include/groonga/groonga.h:2858:9`!(&uint64_buf, 0); |
| 3147 | GRN_UINT64_SETcxx . . $ `include/groonga/groonga.h:2919:9`!(ctx, &uint64_buf, delta); |
| 3148 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, |
| 3149 | cache_valuecxx . . $ cache_value., |
| 3150 | rid, |
| 3151 | &uint64_buf, |
| 3152 | header->qtypecxx . . $ _grn_com_header#qtype. == MBCMD_INCREMENTcxx . . $ MBCMD_INCREMENT. || |
| 3153 | header->qtypecxx . . $ _grn_com_header#qtype. == MBCMD_INCREMENTQcxx . . $ MBCMD_INCREMENTQ. |
| 3154 | ? GRN_OBJ_INCRcxx . . $ `include/groonga/groonga.h:1470:9`! |
| 3155 | : GRN_OBJ_DECRcxx . . $ `include/groonga/groonga.h:1474:9`!); |
| 3156 | } |
| 3157 | } |
| 3158 | if (expire && expire < RELATIVE_TIME_THRESHcxx . . $ `src/groonga.c:2851:9`!) { |
| 3159 | grn_timevalcxx . . $ grn_timeval# tv; |
| 3160 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 3161 | expire += tv.tv_seccxx . . $ $anonymous_type_1555d7cc1d218aa4_15#tv_sec.; |
| 3162 | } |
| 3163 | GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, &uint32_buf, expire); |
| 3164 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, cache_expirecxx . . $ cache_expire., rid, &uint32_buf, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 3165 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ |
| 3166 | /* TODO: get_mbreq_cas_id() */ |
| 3167 | grn_obj_get_value(ctx, cache_value, rid, re); |
| 3168 | grn_htoncxx . . $ `lib/grn.h:588:11`!(&delta, (uint64_t *)GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(re), 8); |
| 3169 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, re, &delta, sizeof(uint64_t)); |
| 3170 | MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_SUCCESS, 0, sizeof(uint64_t), 0); |
| 3171 | }); |
| 3172 | } |
| 3173 | } |
| 3174 | break; |
| 3175 | case MBCMD_FLUSHQcxx . . $ MBCMD_FLUSHQ.: |
| 3176 | quiet = 1; |
| 3177 | /* fallthru */ |
| 3178 | case MBCMD_FLUSHcxx . . $ MBCMD_FLUSH.: |
| 3179 | { |
| 3180 | uint32_tcxx . . $ uint32_t# expire; |
| 3181 | uint8_tcxx . . $ uint8_t# extralen = header->levelcxx . . $ _grn_com_header#level.; |
| 3182 | if (extralen) { |
| 3183 | char *body = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!((grn_obj *)msg); |
| 3184 | GRN_ASSERTcxx . . $ `lib/grn_ctx.h:70:11`!(extralen == 4); |
| 3185 | expire = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(*((uint32_t *)(body))); |
| 3186 | if (expire < RELATIVE_TIME_THRESHcxx . . $ `src/groonga.c:2851:9`!) { |
| 3187 | grn_timevalcxx . . $ grn_timeval# tv; |
| 3188 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 3189 | if (expire) { |
| 3190 | expire += tv.tv_seccxx . . $ $anonymous_type_1555d7cc1d218aa4_15#tv_sec.; |
| 3191 | } else { |
| 3192 | expire = tv.tv_seccxx . . $ $anonymous_type_1555d7cc1d218aa4_15#tv_sec. - 1; |
| 3193 | } |
| 3194 | } |
| 3195 | } else { |
| 3196 | grn_timevalcxx . . $ grn_timeval# tv; |
| 3197 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 3198 | expire = tv.tv_seccxx . . $ $anonymous_type_1555d7cc1d218aa4_15#tv_sec. - 1; |
| 3199 | } |
| 3200 | { |
| 3201 | grn_objcxx . . $ grn_obj# exp_buf; |
| 3202 | GRN_UINT32_INITcxx . . $ `include/groonga/groonga.h:2854:9`!(&exp_buf, 0); |
| 3203 | GRN_UINT32_SETcxx . . $ `include/groonga/groonga.h:2909:9`!(ctx, &exp_buf, expire); |
| 3204 | GRN_TABLE_EACHcxx . . $ `include/groonga/table.h:551:9`!(ctx, cache_table, 0, 0, rid, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, { |
| 3205 | grn_obj_set_value(ctx, cache_expire, rid, &exp_buf, GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!); |
| 3206 | }); |
| 3207 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_SUCCESS, 0, 4, 0); }); |
| 3208 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, &exp_buf); |
| 3209 | } |
| 3210 | } |
| 3211 | break; |
| 3212 | case MBCMD_NOOPcxx . . $ MBCMD_NOOP.: |
| 3213 | break; |
| 3214 | case MBCMD_VERSIONcxx . . $ MBCMD_VERSION.: |
| 3215 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ |
| 3216 | grn_bulk_write(ctx, re, PACKAGE_VERSIONcxx . . $ `build/config.h:14:9`!, strlen(PACKAGE_VERSIONcxx . . $ `build/config.h:14:9`!)); |
| 3217 | MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_SUCCESS, 0, 0, 0); |
| 3218 | }); |
| 3219 | break; |
| 3220 | case MBCMD_GETKQcxx . . $ MBCMD_GETKQ.: |
| 3221 | flags = GRN_CTX_MOREcxx . . $ `include/groonga/groonga.h:3293:9`!; |
| 3222 | /* fallthru */ |
| 3223 | case MBCMD_GETKcxx . . $ MBCMD_GETK.: |
| 3224 | { |
| 3225 | grn_idcxx . . $ grn_id# rid; |
| 3226 | uint16_tcxx . . $ uint16_t# keylen = ntohscxx . . $ `<external>/9581057695539925927/in.h:429:12`!(header->keylen); |
| 3227 | char *key = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!((grn_obj *)msg); |
| 3228 | rid = grn_table_getcxx . . $ grn_table_get(5676c91e20172100).(ctx, cache_tablecxx . . $ cache_table., key, keylen); |
| 3229 | if (!rid) { |
| 3230 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_KEY_ENOENT, 0, 0, 0); }); |
| 3231 | } else { |
| 3232 | grn_objcxx . . $ grn_obj# uint32_buf; |
| 3233 | grn_timevalcxx . . $ grn_timeval# tv; |
| 3234 | uint32_tcxx . . $ uint32_t# expire; |
| 3235 | GRN_UINT32_INITcxx . . $ `include/groonga/groonga.h:2854:9`!(&uint32_buf, 0); |
| 3236 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, cache_expirecxx . . $ cache_expire., rid, &uint32_buf); |
| 3237 | expire = GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(&uint32_buf); |
| 3238 | grn_timeval_nowcxx . . $ grn_timeval_now(b116eeadcb699bd1).(ctx, &tv); |
| 3239 | if (expire && expire < tv.tv_seccxx . . $ $anonymous_type_1555d7cc1d218aa4_15#tv_sec.) { |
| 3240 | grn_table_delete_by_idcxx . . $ grn_table_delete_by_id(aedbc3eaefbe393f).(ctx, cache_tablecxx . . $ cache_table., rid); |
| 3241 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_KEY_ENOENT, 0, 0, 0); }); |
| 3242 | } else { |
| 3243 | grn_objcxx . . $ grn_obj# uint64_buf; |
| 3244 | GRN_UINT64_INITcxx . . $ `include/groonga/groonga.h:2858:9`!(&uint64_buf, 0); |
| 3245 | grn_obj_get_valuecxx . . $ grn_obj_get_value(6e06fec66698a6a).(ctx, cache_cascxx . . $ cache_cas., rid, &uint64_buf); |
| 3246 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ |
| 3247 | grn_obj_get_value(ctx, cache_flags, rid, re); |
| 3248 | grn_bulk_write(ctx, re, key, keylen); |
| 3249 | grn_obj_get_value(ctx, cache_value, rid, re); |
| 3250 | ((grn_msg *)re)->header.cas = GRN_UINT64_VALUEcxx . . $ `include/groonga/groonga.h:3105:9`!(&uint64_buf); |
| 3251 | MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_SUCCESS, keylen, 4, flags); |
| 3252 | }); |
| 3253 | } |
| 3254 | } |
| 3255 | } |
| 3256 | break; |
| 3257 | case MBCMD_APPENDQcxx . . $ MBCMD_APPENDQ.: |
| 3258 | case MBCMD_PREPENDQcxx . . $ MBCMD_PREPENDQ.: |
| 3259 | quiet = 1; |
| 3260 | /* fallthru */ |
| 3261 | case MBCMD_APPENDcxx . . $ MBCMD_APPEND.: |
| 3262 | case MBCMD_PREPENDcxx . . $ MBCMD_PREPEND.: |
| 3263 | { |
| 3264 | grn_idcxx . . $ grn_id# rid; |
| 3265 | uint32_tcxx . . $ uint32_t# size = ntohlcxx . . $ `<external>/9581057695539925927/in.h:428:12`!(header->size); |
| 3266 | uint16_tcxx . . $ uint16_t# keylen = ntohscxx . . $ `<external>/9581057695539925927/in.h:429:12`!(header->keylen); |
| 3267 | char *key = GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!((grn_obj *)msg); |
| 3268 | char *value = key + keylen; |
| 3269 | uint32_tcxx . . $ uint32_t# valuelen = size - keylen; |
| 3270 | rid = grn_table_addcxx . . $ grn_table_add(8041cb9a4866097e).(ctx, cache_tablecxx . . $ cache_table., key, keylen, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 3271 | if (!rid) { |
| 3272 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_ENOMEM, 0, 0, 0); }); |
| 3273 | } else { |
| 3274 | /* FIXME: check expire */ |
| 3275 | grn_objcxx . . $ grn_obj# buf; |
| 3276 | int flags = |
| 3277 | header->qtypecxx . . $ _grn_com_header#qtype. == MBCMD_APPENDcxx . . $ MBCMD_APPEND. ? GRN_OBJ_APPENDcxx . . $ `include/groonga/groonga.h:1478:9`! : GRN_OBJ_PREPENDcxx . . $ `include/groonga/groonga.h:1482:9`!; |
| 3278 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&buf, GRN_OBJ_DO_SHALLOW_COPYcxx . . $ `include/groonga/groonga.h:2732:9`!); |
| 3279 | GRN_TEXT_SET_REFcxx . . $ `include/groonga/groonga.h:2756:9`!(&buf, value, valuelen); |
| 3280 | grn_obj_set_valuecxx . . $ grn_obj_set_value(16170250441fe8eb).(ctx, cache_valuecxx . . $ cache_value., rid, &buf, flags); |
| 3281 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_SUCCESS, 0, 0, 0); }); |
| 3282 | } |
| 3283 | } |
| 3284 | break; |
| 3285 | case MBCMD_STATcxx . . $ MBCMD_STAT.: |
| 3286 | { |
| 3287 | pid_tcxx . . $ pid_t# pid = grn_getpidcxx . . $ `include/groonga/portability.h:199:11`!(); |
| 3288 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ |
| 3289 | grn_bulk_write(ctx, re, "pid", 3); |
| 3290 | grn_text_itoa(ctx, re, pid); |
| 3291 | MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_SUCCESS, 3, 0, 0); |
| 3292 | }); |
| 3293 | } |
| 3294 | break; |
| 3295 | case MBCMD_QUITQcxx . . $ MBCMD_QUITQ.: |
| 3296 | quiet = 1; |
| 3297 | /* fallthru */ |
| 3298 | case MBCMD_QUITcxx . . $ MBCMD_QUIT.: |
| 3299 | GRN_MSG_MBREScxx . . $ `src/groonga.c:2859:9`!({ MBREScxx . . $ `src/groonga.c:2853:9`!(ctx, re, MBRES_SUCCESS, 0, 0, 0); }); |
| 3300 | /* fallthru */ |
| 3301 | default: |
| 3302 | ctx->statcxx . . $ _grn_ctx#stat. = GRN_CTX_QUITcxx . . $ `include/groonga/groonga.h:3297:9`!; |
| 3303 | break; |
| 3304 | } |
| 3305 | } |
| 3306 | |
| 3307 | /* worker thread */ |
| 3308 | |
| 3309 | enumcxx . . $ $anonymous_type_1ab89eed5889867_9# { |
| 3310 | EDGE_IDLEcxx . . $ EDGE_IDLE. = 0x00, |
| 3311 | EDGE_WAITcxx . . $ EDGE_WAIT. = 0x01, |
| 3312 | EDGE_DOINGcxx . . $ EDGE_DOING. = 0x02, |
| 3313 | EDGE_ABORTcxx . . $ EDGE_ABORT. = 0x03, |
| 3314 | }; |
| 3315 | |
| 3316 | static void |
| 3317 | check_rlimit_nofilecxx . . $ check_rlimit_nofile(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 3318 | { |
| 3319 | #ifndef WIN32 |
| 3320 | struct rlimitcxx . . $ rlimit# limit; |
| 3321 | limit.rlim_curcxx . . $ rlimit#rlim_cur. = 0; |
| 3322 | limit.rlim_maxcxx . . $ rlimit#rlim_max. = 0; |
| 3323 | getrlimitcxx . . $ getrlimit(6c0ccb4b8dc2eb78).(RLIMIT_NOFILEcxx . . $ `<external>/1890803886155400780/resource.h:63:9`!, &limit); |
| 3324 | if (limit.rlim_curcxx . . $ rlimit#rlim_cur. < RLIMIT_NOFILE_MINIMUMcxx . . $ `src/groonga.c:91:9`!) { |
| 3325 | limit.rlim_curcxx . . $ rlimit#rlim_cur. = RLIMIT_NOFILE_MINIMUMcxx . . $ `src/groonga.c:91:9`!; |
| 3326 | limit.rlim_maxcxx . . $ rlimit#rlim_max. = RLIMIT_NOFILE_MINIMUMcxx . . $ `src/groonga.c:91:9`!; |
| 3327 | setrlimitcxx . . $ setrlimit(dd6e4620e125bc7d).(RLIMIT_NOFILEcxx . . $ `<external>/1890803886155400780/resource.h:63:9`!, &limit); |
| 3328 | limit.rlim_curcxx . . $ rlimit#rlim_cur. = 0; |
| 3329 | limit.rlim_maxcxx . . $ rlimit#rlim_max. = 0; |
| 3330 | getrlimitcxx . . $ getrlimit(6c0ccb4b8dc2eb78).(RLIMIT_NOFILEcxx . . $ `<external>/1890803886155400780/resource.h:63:9`!, &limit); |
| 3331 | } |
| 3332 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, |
| 3333 | GRN_LOG_NOTICE, |
| 3334 | "RLIMIT_NOFILE(%" GRN_FMT_LLDcxx . . $ `lib/grn.h:406:11`! ",%" GRN_FMT_LLDcxx . . $ `lib/grn.h:406:11`! ")", |
| 3335 | (long long int)limit.rlim_cur, |
| 3336 | (long long int)limit.rlim_max); |
| 3337 | #endif /* WIN32 */ |
| 3338 | } |
| 3339 | |
| 3340 | static grn_thread_func_resultcxx . . $ grn_thread_func_result# CALLBACKcxx . . $ `lib/grn.h:164:11`! |
| 3341 | h_workercxx . . $ h_worker(9f162e79bfc6c74).(void *arg) |
| 3342 | { |
| 3343 | ht_contextcxx . . $ ht_context# hc; |
| 3344 | grn_ctxcxx . . $ grn_ctx# ctx_, *ctx = &ctx_; |
| 3345 | grn_ctx_initcxx . . $ grn_ctx_init(670fdc69e3f5dbb5).(ctx, 0); |
| 3346 | grn_ctx_set_wal_rolecxx . . $ grn_ctx_set_wal_role(2d7caed53fefceef).(ctx, worker_wal_rolecxx . . $ worker_wal_role.); |
| 3347 | grn_ctx_usecxx . . $ grn_ctx_use(4865d068a46d0f83).(ctx, (grn_objcxx . . $ grn_obj# *)arg); |
| 3348 | grn_ctx_recv_handler_setcxx . . $ grn_ctx_recv_handler_set(9ae73d25c36b03d6).(ctx, h_outputcxx . . $ h_output(e5088b957ff2e019)., &hc); |
| 3349 | CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(q_critical_section); |
| 3350 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, |
| 3351 | GRN_LOG_NOTICE, |
| 3352 | "thread start (%u/%u)", |
| 3353 | n_floating_threads, |
| 3354 | n_running_threads); |
| 3355 | while (n_running_threadscxx . . $ n_running_threads. <= max_n_floating_threadscxx . . $ max_n_floating_threads. && |
| 3356 | grn_gctxcxx . . $ grn_gctx..statcxx . . $ _grn_ctx#stat. != GRN_CTX_QUITcxx . . $ `include/groonga/groonga.h:3297:9`!) { |
| 3357 | grn_objcxx . . $ grn_obj# *msg; |
| 3358 | if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_CANCELcxx . . $ GRN_CANCEL.) { |
| 3359 | ctx->rccxx . . $ _grn_ctx#rc. = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 3360 | } |
| 3361 | n_floating_threadscxx . . $ n_floating_threads.++; |
| 3362 | while (!(msg = (grn_objcxx . . $ grn_obj# *)grn_com_queue_dequecxx . . $ grn_com_queue_deque(a823fa5c468a7360).(&grn_gctxcxx . . $ grn_gctx., &ctx_newcxx . . $ ctx_new.))) { |
| 3363 | COND_WAITcxx . . $ `lib/grn.h:234:11`!(q_cond, q_critical_section); |
| 3364 | if (grn_gctxcxx . . $ grn_gctx..statcxx . . $ _grn_ctx#stat. == GRN_CTX_QUITcxx . . $ `include/groonga/groonga.h:3297:9`!) { |
| 3365 | n_floating_threadscxx . . $ n_floating_threads.--; |
| 3366 | goto exit; |
| 3367 | } |
| 3368 | if (n_running_threadscxx . . $ n_running_threads. > max_n_floating_threadscxx . . $ max_n_floating_threads.) { |
| 3369 | n_floating_threadscxx . . $ n_floating_threads.--; |
| 3370 | goto exit; |
| 3371 | } |
| 3372 | } |
| 3373 | n_floating_threadscxx . . $ n_floating_threads.--; |
| 3374 | CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(q_critical_section); |
| 3375 | hc.msgcxx . . $ $anonymous_type_1ab89eed5889867_2#msg. = (grn_msgcxx . . $ grn_msg# *)msg; |
| 3376 | hc.in_bodycxx . . $ $anonymous_type_1ab89eed5889867_2#in_body. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 3377 | hc.is_chunkedcxx . . $ $anonymous_type_1ab89eed5889867_2#is_chunked. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 3378 | do_htreqcxx . . $ do_htreq(cea9be018c4c70d1).(ctx, &hc); |
| 3379 | CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(q_critical_section); |
| 3380 | } |
| 3381 | exit: |
| 3382 | n_running_threadscxx . . $ n_running_threads.--; |
| 3383 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, |
| 3384 | GRN_LOG_NOTICE, |
| 3385 | "thread end (%u/%u)", |
| 3386 | n_floating_threads, |
| 3387 | n_running_threads); |
| 3388 | if (grn_gctxcxx . . $ grn_gctx..statcxx . . $ _grn_ctx#stat. == GRN_CTX_QUITcxx . . $ `include/groonga/groonga.h:3297:9`! && running_event_loopcxx . . $ running_event_loop.) { |
| 3389 | break_accept_event_loopcxx . . $ break_accept_event_loop(b578cd6e53d5fe91).(ctx); |
| 3390 | } |
| 3391 | grn_ctx_fincxx . . $ grn_ctx_fin(2b4fa601bf4f1e5b).(ctx); |
| 3392 | CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(q_critical_section); |
| 3393 | return GRN_THREAD_FUNC_RETURN_VALUEcxx . . $ `lib/grn.h:214:11`!; |
| 3394 | } |
| 3395 | |
| 3396 | static void |
| 3397 | h_handlercxx . . $ h_handler(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *msg) |
| 3398 | { |
| 3399 | grn_comcxx . . $ grn_com# *com = ((grn_msgcxx . . $ grn_msg# *)msg)->ucxx . . $ _grn_msg#u..peercxx . . $ _grn_msg#$anonymous_type_0#peer.; |
| 3400 | if (ctx->rccxx . . $ _grn_ctx#rc.) { |
| 3401 | grn_com_closecxx . . $ grn_com_close(316fe94cc3b95f73).(ctx, com); |
| 3402 | grn_msg_closecxx . . $ grn_msg_close(4865d068a46d0f83).(ctx, msg); |
| 3403 | } else { |
| 3404 | grn_sockcxx . . $ grn_sock# fd = com->fdcxx . . $ _grn_com#fd.; |
| 3405 | void *arg = com->evcxx . . $ _grn_com#ev.->opaquecxx . . $ _grn_com_event#opaque.; |
| 3406 | /* if not keep alive connection */ |
| 3407 | grn_com_event_delcxx . . $ grn_com_event_del(c072c45909e82dfb).(ctx, com->evcxx . . $ _grn_com#ev., fd); |
| 3408 | ((grn_msgcxx . . $ grn_msg# *)msg)->ucxx . . $ _grn_msg#u..fdcxx . . $ _grn_msg#$anonymous_type_0#fd. = fd; |
| 3409 | CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(q_critical_section); |
| 3410 | const char *immediate_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 3411 | int immediate_path_length = -1; |
| 3412 | if (n_floating_threadscxx . . $ n_floating_threads. == 0 && |
| 3413 | n_running_threadscxx . . $ n_running_threads. == max_n_floating_threadscxx . . $ max_n_floating_threads.) { |
| 3414 | h_headercxx . . $ h_header# header; |
| 3415 | header.method_startcxx . . $ $anonymous_type_1ab89eed5889867_4#method_start. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 3416 | header.method_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#method_length. = -1; |
| 3417 | header.path_startcxx . . $ $anonymous_type_1ab89eed5889867_4#path_start. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 3418 | header.path_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#path_length. = -1; |
| 3419 | if (h_parse_header_request_linecxx . . $ h_parse_header_request_line(6baac691e10faf1b).(ctx, |
| 3420 | GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!((grn_obj *)msg), |
| 3421 | GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!((grn_obj *)msg), |
| 3422 | &header) && |
| 3423 | STRING_EQUALcxx . . $ `src/groonga.c:1737:9`!(header.path_start, |
| 3424 | header.path_length, |
| 3425 | "/d/shutdown?mode=immediate")) { |
| 3426 | immediate_path = header.path_startcxx . . $ $anonymous_type_1ab89eed5889867_4#path_start.; |
| 3427 | immediate_path_length = header.path_lengthcxx . . $ $anonymous_type_1ab89eed5889867_4#path_length.; |
| 3428 | } |
| 3429 | } |
| 3430 | if (immediate_path) { |
| 3431 | ht_contextcxx . . $ ht_context# hc; |
| 3432 | grn_ctxcxx . . $ grn_ctx# ctx_shutdown; |
| 3433 | grn_ctx_initcxx . . $ grn_ctx_init(670fdc69e3f5dbb5).(&ctx_shutdown, 0); |
| 3434 | grn_ctx_usecxx . . $ grn_ctx_use(4865d068a46d0f83).(&ctx_shutdown, (grn_objcxx . . $ grn_obj# *)arg); |
| 3435 | grn_ctx_recv_handler_setcxx . . $ grn_ctx_recv_handler_set(9ae73d25c36b03d6).(&ctx_shutdown, h_outputcxx . . $ h_output(e5088b957ff2e019)., &hc); |
| 3436 | hc.msgcxx . . $ $anonymous_type_1ab89eed5889867_2#msg. = (grn_msgcxx . . $ grn_msg# *)msg; |
| 3437 | hc.in_bodycxx . . $ $anonymous_type_1ab89eed5889867_2#in_body. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 3438 | hc.is_chunkedcxx . . $ $anonymous_type_1ab89eed5889867_2#is_chunked. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 3439 | grn_ctx_sendcxx . . $ grn_ctx_send(dac8ec282379d9e0).(&ctx_shutdown, |
| 3440 | immediate_path, |
| 3441 | immediate_path_length, |
| 3442 | GRN_CTX_TAILcxx . . $ `include/groonga/groonga.h:3294:9`!); |
| 3443 | grn_ctx_fincxx . . $ grn_ctx_fin(2b4fa601bf4f1e5b).(&ctx_shutdown); |
| 3444 | } else { |
| 3445 | grn_com_queue_enquecxx . . $ grn_com_queue_enque(dbe93a48de70e820).(ctx, &ctx_newcxx . . $ ctx_new., (grn_com_queue_entrycxx . . $ grn_com_queue_entry# *)msg); |
| 3446 | if (n_floating_threadscxx . . $ n_floating_threads. == 0 && |
| 3447 | n_running_threadscxx . . $ n_running_threads. < max_n_floating_threadscxx . . $ max_n_floating_threads.) { |
| 3448 | grn_threadcxx . . $ grn_thread# thread; |
| 3449 | n_running_threadscxx . . $ n_running_threads.++; |
| 3450 | if (THREAD_CREATEcxx . . $ `lib/grn.h:215:11`!(thread, h_worker, arg)) { |
| 3451 | n_running_threadscxx . . $ n_running_threads.--; |
| 3452 | SERRcxx . . $ `lib/grn_error.h:411:11`!("pthread_create"); |
| 3453 | } |
| 3454 | } |
| 3455 | COND_SIGNALcxx . . $ `lib/grn.h:233:11`!(q_cond); |
| 3456 | } |
| 3457 | CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(q_critical_section); |
| 3458 | } |
| 3459 | } |
| 3460 | |
| 3461 | static int |
| 3462 | h_servercxx . . $ h_server(1ef8e6ec083aabb9).(char *path) |
| 3463 | { |
| 3464 | int exit_code = EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 3465 | grn_ctxcxx . . $ grn_ctx# ctx_, *ctx = &ctx_; |
| 3466 | grn_ctx_initcxx . . $ grn_ctx_init(670fdc69e3f5dbb5).(ctx, 0); |
| 3467 | grn_ctx_set_wal_rolecxx . . $ grn_ctx_set_wal_role(2d7caed53fefceef).(ctx, wal_rolecxx . . $ wal_role.); |
| 3468 | GRN_COM_QUEUE_INITcxx . . $ `lib/grn_com.h:53:9`!(&ctx_new); |
| 3469 | GRN_COM_QUEUE_INITcxx . . $ `lib/grn_com.h:53:9`!(&ctx_old); |
| 3470 | check_rlimit_nofilecxx . . $ check_rlimit_nofile(b578cd6e53d5fe91).(ctx); |
| 3471 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&http_response_server_line, 0); |
| 3472 | grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, |
| 3473 | &http_response_server_linecxx . . $ http_response_server_line., |
| 3474 | "Server: %s/%s\r\n", |
| 3475 | grn_get_package_labelcxx . . $ grn_get_package_label(33a1f659e94feb42).(), |
| 3476 | grn_get_versioncxx . . $ grn_get_version(33a1f659e94feb42).()); |
| 3477 | exit_code = start_servicecxx . . $ start_service(de3b01120b57ace0).(ctx, path, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, h_handlercxx . . $ h_handler(cda3a5f3c2e53c6b).); |
| 3478 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &http_response_server_line); |
| 3479 | grn_ctx_fincxx . . $ grn_ctx_fin(2b4fa601bf4f1e5b).(ctx); |
| 3480 | return exit_code; |
| 3481 | } |
| 3482 | |
| 3483 | static grn_thread_func_resultcxx . . $ grn_thread_func_result# CALLBACKcxx . . $ `lib/grn.h:164:11`! |
| 3484 | g_workercxx . . $ g_worker(9f162e79bfc6c74).(void *arg) |
| 3485 | { |
| 3486 | CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(q_critical_section); |
| 3487 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(&grn_gctx, |
| 3488 | GRN_LOG_NOTICE, |
| 3489 | "thread start (%u/%u)", |
| 3490 | n_floating_threads, |
| 3491 | n_running_threads); |
| 3492 | while (n_running_threadscxx . . $ n_running_threads. <= max_n_floating_threadscxx . . $ max_n_floating_threads. && |
| 3493 | grn_gctxcxx . . $ grn_gctx..statcxx . . $ _grn_ctx#stat. != GRN_CTX_QUITcxx . . $ `include/groonga/groonga.h:3297:9`!) { |
| 3494 | grn_ctxcxx . . $ grn_ctx# *ctx; |
| 3495 | grn_edgecxx . . $ grn_edge# *edge; |
| 3496 | n_floating_threadscxx . . $ n_floating_threads.++; |
| 3497 | while (!(edge = (grn_edgecxx . . $ grn_edge# *)grn_com_queue_dequecxx . . $ grn_com_queue_deque(a823fa5c468a7360).(&grn_gctxcxx . . $ grn_gctx., &ctx_newcxx . . $ ctx_new.))) { |
| 3498 | COND_WAITcxx . . $ `lib/grn.h:234:11`!(q_cond, q_critical_section); |
| 3499 | if (grn_gctxcxx . . $ grn_gctx..statcxx . . $ _grn_ctx#stat. == GRN_CTX_QUITcxx . . $ `include/groonga/groonga.h:3297:9`!) { |
| 3500 | n_floating_threadscxx . . $ n_floating_threads.--; |
| 3501 | goto exit; |
| 3502 | } |
| 3503 | if (n_running_threadscxx . . $ n_running_threads. > max_n_floating_threadscxx . . $ max_n_floating_threads.) { |
| 3504 | n_floating_threadscxx . . $ n_floating_threads.--; |
| 3505 | goto exit; |
| 3506 | } |
| 3507 | } |
| 3508 | ctx = &edge->ctxcxx . . $ $anonymous_type_f1187c146b4d15e3_1#ctx.; |
| 3509 | n_floating_threadscxx . . $ n_floating_threads.--; |
| 3510 | if (edge->statcxx . . $ $anonymous_type_f1187c146b4d15e3_1#stat. == EDGE_DOINGcxx . . $ EDGE_DOING.) { |
| 3511 | continue; |
| 3512 | } |
| 3513 | if (edge->statcxx . . $ $anonymous_type_f1187c146b4d15e3_1#stat. == EDGE_WAITcxx . . $ EDGE_WAIT.) { |
| 3514 | edge->statcxx . . $ $anonymous_type_f1187c146b4d15e3_1#stat. = EDGE_DOINGcxx . . $ EDGE_DOING.; |
| 3515 | while (!GRN_COM_QUEUE_EMPTYPcxx . . $ `lib/grn_com.h:60:9`!(&edge->recv_new)) { |
| 3516 | grn_objcxx . . $ grn_obj# *msg; |
| 3517 | CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(q_critical_section); |
| 3518 | /* if (edge->flags == GRN_EDGE_WORKER) */ |
| 3519 | while ( |
| 3520 | ctx->statcxx . . $ _grn_ctx#stat. != GRN_CTX_QUITcxx . . $ `include/groonga/groonga.h:3297:9`! && |
| 3521 | (edge->msgcxx . . $ $anonymous_type_f1187c146b4d15e3_1#msg. = (grn_msgcxx . . $ grn_msg# *)grn_com_queue_dequecxx . . $ grn_com_queue_deque(a823fa5c468a7360).(ctx, &edge->recv_newcxx . . $ $anonymous_type_f1187c146b4d15e3_1#recv_new.))) { |
| 3522 | grn_com_headercxx . . $ grn_com_header# *header = &edge->msgcxx . . $ $anonymous_type_f1187c146b4d15e3_1#msg.->headercxx . . $ _grn_msg#header.; |
| 3523 | msg = (grn_objcxx . . $ grn_obj# *)edge->msgcxx . . $ $anonymous_type_f1187c146b4d15e3_1#msg.; |
| 3524 | switch (header->protocxx . . $ _grn_com_header#proto.) { |
| 3525 | case GRN_COM_PROTO_MBREQcxx . . $ `lib/grn_com.h:169:9`!: |
| 3526 | do_mbreqcxx . . $ do_mbreq(d784cba38f301350).(ctx, edge); |
| 3527 | break; |
| 3528 | case GRN_COM_PROTO_GQTPcxx . . $ `lib/grn_com.h:168:9`!: |
| 3529 | grn_ctx_sendcxx . . $ grn_ctx_send(dac8ec282379d9e0).(ctx, |
| 3530 | GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(msg), |
| 3531 | GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(msg), |
| 3532 | header->flagscxx . . $ _grn_com_header#flags.); |
| 3533 | ERRCLRcxx . . $ `lib/grn_error.h:37:9`!(ctx); |
| 3534 | if (ctx->rccxx . . $ _grn_ctx#rc. == GRN_CANCELcxx . . $ GRN_CANCEL.) { |
| 3535 | ctx->rccxx . . $ _grn_ctx#rc. = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 3536 | } |
| 3537 | break; |
| 3538 | default: |
| 3539 | ctx->statcxx . . $ _grn_ctx#stat. = GRN_CTX_QUITcxx . . $ `include/groonga/groonga.h:3297:9`!; |
| 3540 | break; |
| 3541 | } |
| 3542 | grn_msg_closecxx . . $ grn_msg_close(4865d068a46d0f83).(ctx, msg); |
| 3543 | } |
| 3544 | while ((msg = (grn_objcxx . . $ grn_obj# *)grn_com_queue_dequecxx . . $ grn_com_queue_deque(a823fa5c468a7360).(ctx, &edge->send_oldcxx . . $ $anonymous_type_f1187c146b4d15e3_1#send_old.))) { |
| 3545 | grn_msg_closecxx . . $ grn_msg_close(4865d068a46d0f83).(ctx, msg); |
| 3546 | } |
| 3547 | CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(q_critical_section); |
| 3548 | if (ctx->statcxx . . $ _grn_ctx#stat. == GRN_CTX_QUITcxx . . $ `include/groonga/groonga.h:3297:9`! || edge->statcxx . . $ $anonymous_type_f1187c146b4d15e3_1#stat. == EDGE_ABORTcxx . . $ EDGE_ABORT.) { |
| 3549 | break; |
| 3550 | } |
| 3551 | } |
| 3552 | } |
| 3553 | if (ctx->statcxx . . $ _grn_ctx#stat. == GRN_CTX_QUITcxx . . $ `include/groonga/groonga.h:3297:9`! || edge->statcxx . . $ $anonymous_type_f1187c146b4d15e3_1#stat. == EDGE_ABORTcxx . . $ EDGE_ABORT.) { |
| 3554 | grn_com_queue_enquecxx . . $ grn_com_queue_enque(dbe93a48de70e820).(&grn_gctxcxx . . $ grn_gctx., &ctx_oldcxx . . $ ctx_old., (grn_com_queue_entrycxx . . $ grn_com_queue_entry# *)edge); |
| 3555 | edge->statcxx . . $ $anonymous_type_f1187c146b4d15e3_1#stat. = EDGE_ABORTcxx . . $ EDGE_ABORT.; |
| 3556 | } else { |
| 3557 | edge->statcxx . . $ $anonymous_type_f1187c146b4d15e3_1#stat. = EDGE_IDLEcxx . . $ EDGE_IDLE.; |
| 3558 | } |
| 3559 | }; |
| 3560 | exit: |
| 3561 | n_running_threadscxx . . $ n_running_threads.--; |
| 3562 | GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(&grn_gctx, |
| 3563 | GRN_LOG_NOTICE, |
| 3564 | "thread end (%u/%u)", |
| 3565 | n_floating_threads, |
| 3566 | n_running_threads); |
| 3567 | CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(q_critical_section); |
| 3568 | return GRN_THREAD_FUNC_RETURN_VALUEcxx . . $ `lib/grn.h:214:11`!; |
| 3569 | } |
| 3570 | |
| 3571 | static void |
| 3572 | g_dispatchercxx . . $ g_dispatcher(d784cba38f301350).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_edgecxx . . $ grn_edge# *edge) |
| 3573 | { |
| 3574 | CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(q_critical_section); |
| 3575 | if (edge->statcxx . . $ $anonymous_type_f1187c146b4d15e3_1#stat. == EDGE_IDLEcxx . . $ EDGE_IDLE.) { |
| 3576 | grn_com_queue_enquecxx . . $ grn_com_queue_enque(dbe93a48de70e820).(ctx, &ctx_newcxx . . $ ctx_new., (grn_com_queue_entrycxx . . $ grn_com_queue_entry# *)edge); |
| 3577 | edge->statcxx . . $ $anonymous_type_f1187c146b4d15e3_1#stat. = EDGE_WAITcxx . . $ EDGE_WAIT.; |
| 3578 | if (n_floating_threadscxx . . $ n_floating_threads. == 0 && n_running_threadscxx . . $ n_running_threads. < max_n_floating_threadscxx . . $ max_n_floating_threads.) { |
| 3579 | grn_threadcxx . . $ grn_thread# thread; |
| 3580 | n_running_threadscxx . . $ n_running_threads.++; |
| 3581 | if (THREAD_CREATEcxx . . $ `lib/grn.h:215:11`!(thread, g_worker, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)) { |
| 3582 | n_running_threadscxx . . $ n_running_threads.--; |
| 3583 | SERRcxx . . $ `lib/grn_error.h:411:11`!("pthread_create"); |
| 3584 | } |
| 3585 | } |
| 3586 | COND_SIGNALcxx . . $ `lib/grn.h:233:11`!(q_cond); |
| 3587 | } |
| 3588 | CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(q_critical_section); |
| 3589 | } |
| 3590 | |
| 3591 | static void |
| 3592 | g_outputcxx . . $ g_output(e5088b957ff2e019).(grn_ctxcxx . . $ grn_ctx# *ctx, int flags, void *arg) |
| 3593 | { |
| 3594 | grn_edgecxx . . $ grn_edge# *edge = arg; |
| 3595 | grn_comcxx . . $ grn_com# *com = edge->comcxx . . $ $anonymous_type_f1187c146b4d15e3_1#com.; |
| 3596 | grn_msgcxx . . $ grn_msg# *req = edge->msgcxx . . $ $anonymous_type_f1187c146b4d15e3_1#msg., *msg = (grn_msgcxx . . $ grn_msg# *)ctx->implcxx . . $ _grn_ctx#impl.->outputcxx . . $ _grn_ctx_impl#output..bufcxx . . $ _grn_ctx_impl#$anonymous_type_0#buf.; |
| 3597 | msg->edge_idcxx . . $ _grn_msg#edge_id. = req->edge_idcxx . . $ _grn_msg#edge_id.; |
| 3598 | msg->headercxx . . $ _grn_msg#header..protocxx . . $ _grn_com_header#proto. = req->headercxx . . $ _grn_msg#header..protocxx . . $ _grn_com_header#proto. == GRN_COM_PROTO_MBREQcxx . . $ `lib/grn_com.h:169:9`! |
| 3599 | ? GRN_COM_PROTO_MBREScxx . . $ `lib/grn_com.h:170:9`! |
| 3600 | : req->headercxx . . $ _grn_msg#header..protocxx . . $ _grn_com_header#proto.; |
| 3601 | if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS. && GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(ctx->impl->output.buf) == 0) { |
| 3602 | GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, ctx->impl->output.buf, ctx->errbuf); |
| 3603 | } |
| 3604 | if (grn_msg_sendcxx . . $ grn_msg_send(1bfdfa8473156571).(ctx, |
| 3605 | (grn_objcxx . . $ grn_obj# *)msg, |
| 3606 | (flags & GRN_CTX_MOREcxx . . $ `include/groonga/groonga.h:3293:9`!) ? GRN_CTX_MOREcxx . . $ `include/groonga/groonga.h:3293:9`! : GRN_CTX_TAILcxx . . $ `include/groonga/groonga.h:3294:9`!)) { |
| 3607 | edge->statcxx . . $ $anonymous_type_f1187c146b4d15e3_1#stat. = EDGE_ABORTcxx . . $ EDGE_ABORT.; |
| 3608 | } |
| 3609 | ctx->implcxx . . $ _grn_ctx#impl.->outputcxx . . $ _grn_ctx_impl#output..bufcxx . . $ _grn_ctx_impl#$anonymous_type_0#buf. = grn_msg_opencxx . . $ grn_msg_open(ea22ab7961919da8).(ctx, com, &edge->send_oldcxx . . $ $anonymous_type_f1187c146b4d15e3_1#send_old.); |
| 3610 | } |
| 3611 | |
| 3612 | static void |
| 3613 | g_handlercxx . . $ g_handler(cda3a5f3c2e53c6b).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *msg) |
| 3614 | { |
| 3615 | grn_edgecxx . . $ grn_edge# *edge; |
| 3616 | grn_comcxx . . $ grn_com# *com = ((grn_msgcxx . . $ grn_msg# *)msg)->ucxx . . $ _grn_msg#u..peercxx . . $ _grn_msg#$anonymous_type_0#peer.; |
| 3617 | if (ctx->rccxx . . $ _grn_ctx#rc.) { |
| 3618 | if (com->has_sidcxx . . $ _grn_com#has_sid.) { |
| 3619 | if ((edge = com->opaquecxx . . $ _grn_com#opaque.)) { |
| 3620 | CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(q_critical_section); |
| 3621 | if (edge->statcxx . . $ $anonymous_type_f1187c146b4d15e3_1#stat. == EDGE_IDLEcxx . . $ EDGE_IDLE.) { |
| 3622 | grn_com_queue_enquecxx . . $ grn_com_queue_enque(dbe93a48de70e820).(ctx, &ctx_oldcxx . . $ ctx_old., (grn_com_queue_entrycxx . . $ grn_com_queue_entry# *)edge); |
| 3623 | } |
| 3624 | edge->statcxx . . $ $anonymous_type_f1187c146b4d15e3_1#stat. = EDGE_ABORTcxx . . $ EDGE_ABORT.; |
| 3625 | CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(q_critical_section); |
| 3626 | } else { |
| 3627 | grn_com_closecxx . . $ grn_com_close(316fe94cc3b95f73).(ctx, com); |
| 3628 | } |
| 3629 | } |
| 3630 | grn_msg_closecxx . . $ grn_msg_close(4865d068a46d0f83).(ctx, msg); |
| 3631 | } else { |
| 3632 | int added; |
| 3633 | edge = grn_edges_addcxx . . $ grn_edges_add(b33cf19482df5c69).(ctx, &((grn_msgcxx . . $ grn_msg# *)msg)->edge_idcxx . . $ _grn_msg#edge_id., &added); |
| 3634 | if (added) { |
| 3635 | grn_ctx_initcxx . . $ grn_ctx_init(670fdc69e3f5dbb5).(&edge->ctxcxx . . $ $anonymous_type_f1187c146b4d15e3_1#ctx., 0); |
| 3636 | grn_ctx_set_wal_rolecxx . . $ grn_ctx_set_wal_role(2d7caed53fefceef).(ctx, worker_wal_rolecxx . . $ worker_wal_role.); |
| 3637 | GRN_COM_QUEUE_INITcxx . . $ `lib/grn_com.h:53:9`!(&edge->recv_new); |
| 3638 | GRN_COM_QUEUE_INITcxx . . $ `lib/grn_com.h:53:9`!(&edge->send_old); |
| 3639 | grn_ctx_usecxx . . $ grn_ctx_use(4865d068a46d0f83).(&edge->ctxcxx . . $ $anonymous_type_f1187c146b4d15e3_1#ctx., (grn_objcxx . . $ grn_obj# *)com->evcxx . . $ _grn_com#ev.->opaquecxx . . $ _grn_com_event#opaque.); |
| 3640 | grn_ctx_recv_handler_setcxx . . $ grn_ctx_recv_handler_set(9ae73d25c36b03d6).(&edge->ctxcxx . . $ $anonymous_type_f1187c146b4d15e3_1#ctx., g_outputcxx . . $ g_output(e5088b957ff2e019)., edge); |
| 3641 | com->opaquecxx . . $ _grn_com#opaque. = edge; |
| 3642 | grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(&edge->ctxcxx . . $ $anonymous_type_f1187c146b4d15e3_1#ctx., edge->ctxcxx . . $ $anonymous_type_f1187c146b4d15e3_1#ctx..implcxx . . $ _grn_ctx#impl.->outputcxx . . $ _grn_ctx_impl#output..bufcxx . . $ _grn_ctx_impl#$anonymous_type_0#buf.); |
| 3643 | edge->ctxcxx . . $ $anonymous_type_f1187c146b4d15e3_1#ctx..implcxx . . $ _grn_ctx#impl.->outputcxx . . $ _grn_ctx_impl#output..bufcxx . . $ _grn_ctx_impl#$anonymous_type_0#buf. = |
| 3644 | grn_msg_opencxx . . $ grn_msg_open(ea22ab7961919da8).(&edge->ctxcxx . . $ $anonymous_type_f1187c146b4d15e3_1#ctx., com, &edge->send_oldcxx . . $ $anonymous_type_f1187c146b4d15e3_1#send_old.); |
| 3645 | edge->comcxx . . $ $anonymous_type_f1187c146b4d15e3_1#com. = com; |
| 3646 | edge->statcxx . . $ $anonymous_type_f1187c146b4d15e3_1#stat. = EDGE_IDLEcxx . . $ EDGE_IDLE.; |
| 3647 | edge->flagscxx . . $ $anonymous_type_f1187c146b4d15e3_1#flags. = GRN_EDGE_WORKERcxx . . $ `lib/grn_com.h:225:9`!; |
| 3648 | } |
| 3649 | if (edge->ctxcxx . . $ $anonymous_type_f1187c146b4d15e3_1#ctx..statcxx . . $ _grn_ctx#stat. == GRN_CTX_QUITcxx . . $ `include/groonga/groonga.h:3297:9`! || edge->statcxx . . $ $anonymous_type_f1187c146b4d15e3_1#stat. == EDGE_ABORTcxx . . $ EDGE_ABORT.) { |
| 3650 | grn_msg_closecxx . . $ grn_msg_close(4865d068a46d0f83).(ctx, msg); |
| 3651 | } else { |
| 3652 | grn_com_queue_enquecxx . . $ grn_com_queue_enque(dbe93a48de70e820).(ctx, &edge->recv_newcxx . . $ $anonymous_type_f1187c146b4d15e3_1#recv_new., (grn_com_queue_entrycxx . . $ grn_com_queue_entry# *)msg); |
| 3653 | g_dispatchercxx . . $ g_dispatcher(d784cba38f301350).(ctx, edge); |
| 3654 | } |
| 3655 | } |
| 3656 | } |
| 3657 | |
| 3658 | static int |
| 3659 | g_servercxx . . $ g_server(1ef8e6ec083aabb9).(char *path) |
| 3660 | { |
| 3661 | int exit_code = EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 3662 | grn_ctxcxx . . $ grn_ctx# ctx_, *ctx = &ctx_; |
| 3663 | grn_ctx_initcxx . . $ grn_ctx_init(670fdc69e3f5dbb5).(ctx, 0); |
| 3664 | grn_ctx_set_wal_rolecxx . . $ grn_ctx_set_wal_role(2d7caed53fefceef).(ctx, wal_rolecxx . . $ wal_role.); |
| 3665 | GRN_COM_QUEUE_INITcxx . . $ `lib/grn_com.h:53:9`!(&ctx_new); |
| 3666 | GRN_COM_QUEUE_INITcxx . . $ `lib/grn_com.h:53:9`!(&ctx_old); |
| 3667 | check_rlimit_nofilecxx . . $ check_rlimit_nofile(b578cd6e53d5fe91).(ctx); |
| 3668 | exit_code = start_servicecxx . . $ start_service(de3b01120b57ace0).(ctx, path, g_dispatchercxx . . $ g_dispatcher(d784cba38f301350)., g_handlercxx . . $ g_handler(cda3a5f3c2e53c6b).); |
| 3669 | grn_ctx_fincxx . . $ grn_ctx_fin(2b4fa601bf4f1e5b).(ctx); |
| 3670 | return exit_code; |
| 3671 | } |
| 3672 | |
| 3673 | enumcxx . . $ $anonymous_type_1ab89eed5889867_10# { |
| 3674 | ACTION_USAGEcxx . . $ ACTION_USAGE. = 1, |
| 3675 | ACTION_VERSIONcxx . . $ ACTION_VERSION., |
| 3676 | ACTION_SHOW_CONFIGcxx . . $ ACTION_SHOW_CONFIG., |
| 3677 | ACTION_ERRORcxx . . $ ACTION_ERROR. |
| 3678 | }; |
| 3679 | |
| 3680 | #define ACTION_MASKcxx . . $ `src/groonga.c:3680:9`! (0x0f) |
| 3681 | #define MODE_MASKcxx . . $ `src/groonga.c:3681:9`! (0xf0) |
| 3682 | #define FLAG_MODE_ALONEcxx . . $ `src/groonga.c:3682:9`! (1 << 4) |
| 3683 | #define FLAG_MODE_CLIENTcxx . . $ `src/groonga.c:3683:9`! (1 << 5) |
| 3684 | #define FLAG_MODE_DAEMONcxx . . $ `src/groonga.c:3684:9`! (1 << 6) |
| 3685 | #define FLAG_MODE_SERVERcxx . . $ `src/groonga.c:3685:9`! (1 << 7) |
| 3686 | #define FLAG_NEW_DBcxx . . $ `src/groonga.c:3686:9`! (1 << 8) |
| 3687 | #define FLAG_USE_WINDOWS_EVENT_LOGcxx . . $ `src/groonga.c:3687:9`! (1 << 9) |
| 3688 | |
| 3689 | static uint32_tcxx . . $ uint32_t# |
| 3690 | get_core_numbercxx . . $ get_core_number(db52760e79bf9054).(void) |
| 3691 | { |
| 3692 | #ifdef WIN32 |
| 3693 | SYSTEM_INFO sinfo; |
| 3694 | GetSystemInfo(&sinfo); |
| 3695 | return sinfo.dwNumberOfProcessors; |
| 3696 | #else |
| 3697 | # ifdef _SC_NPROCESSORS_CONFcxx . . $ `<external>/6393649343499073842/confname.h:251:9`! |
| 3698 | return sysconfcxx . . $ sysconf(dc1f09c09fbff20f).(_SC_NPROCESSORS_CONFcxx . . $ `<external>/6393649343499073842/confname.h:251:9`!); |
| 3699 | # else |
| 3700 | return 1; |
| 3701 | # endif |
| 3702 | #endif |
| 3703 | } |
| 3704 | |
| 3705 | /* |
| 3706 | * The length of each line, including an end-of-line, in config file should be |
| 3707 | * shorter than (CONFIG_FILE_BUF_SIZE - 1) bytes. Too long lines are ignored. |
| 3708 | * Note that both '\r' and '\n' are handled as end-of-lines. |
| 3709 | * |
| 3710 | * '#' and ';' are special symbols to start comments. A comment ends with an |
| 3711 | * end-of-line. |
| 3712 | * |
| 3713 | * Format: name[=value] |
| 3714 | * - Preceding/trailing white-spaces of each line are removed. |
| 3715 | * - White-spaces around '=' are removed. |
| 3716 | * - name does not allow white-spaces. |
| 3717 | */ |
| 3718 | #define CONFIG_FILE_BUF_SIZEcxx . . $ `src/groonga.c:3718:9`! 4096 |
| 3719 | #define CONFIG_FILE_MAX_NAME_LENGTHcxx . . $ `src/groonga.c:3719:9`! 128 |
| 3720 | #define CONFIG_FILE_MAX_VALUE_LENGTHcxx . . $ `src/groonga.c:3720:9`! 2048 |
| 3721 | |
| 3722 | typedef enumcxx . . $ $anonymous_type_1ab89eed5889867_11# { |
| 3723 | CONFIG_FILE_SUCCESScxx . . $ CONFIG_FILE_SUCCESS., |
| 3724 | CONFIG_FILE_FORMAT_ERRORcxx . . $ CONFIG_FILE_FORMAT_ERROR., |
| 3725 | CONFIG_FILE_FOPEN_ERRORcxx . . $ CONFIG_FILE_FOPEN_ERROR., |
| 3726 | CONFIG_FILE_MALLOC_ERRORcxx . . $ CONFIG_FILE_MALLOC_ERROR., |
| 3727 | CONFIG_FILE_ATEXIT_ERRORcxx . . $ CONFIG_FILE_ATEXIT_ERROR. |
| 3728 | } config_file_statuscxx . . $ config_file_status#; |
| 3729 | |
| 3730 | /* |
| 3731 | * The node type of a linked list for storing values. Note that a value is |
| 3732 | * stored in the extra space of an object. |
| 3733 | */ |
| 3734 | typedef struct _config_file_entrycxx . . $ _config_file_entry# { |
| 3735 | struct _config_file_entrycxx . . $ _config_file_entry# *nextcxx . . $ _config_file_entry#next.; |
| 3736 | } config_file_entrycxx . . $ config_file_entry#; |
| 3737 | |
| 3738 | static config_file_entrycxx . . $ config_file_entry# *config_file_entry_headcxx . . $ config_file_entry_head. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 3739 | |
| 3740 | static void |
| 3741 | config_file_clearcxx . . $ config_file_clear(49f6e7a06ebc5aa8).(void) |
| 3742 | { |
| 3743 | while (config_file_entry_headcxx . . $ config_file_entry_head.) { |
| 3744 | config_file_entrycxx . . $ config_file_entry# *next = config_file_entry_headcxx . . $ config_file_entry_head.->nextcxx . . $ _config_file_entry#next.; |
| 3745 | freecxx . . $ free(5d22bdacc48458e8).(config_file_entry_headcxx . . $ config_file_entry_head.); |
| 3746 | config_file_entry_headcxx . . $ config_file_entry_head. = next; |
| 3747 | } |
| 3748 | } |
| 3749 | |
| 3750 | static config_file_statuscxx . . $ config_file_status# |
| 3751 | config_file_registercxx . . $ config_file_register(c293d33ac051e174).(const char *path, |
| 3752 | const grn_str_getopt_optcxx . . $ grn_str_getopt_opt# *opts, |
| 3753 | int *flags, |
| 3754 | const char *name, |
| 3755 | size_tcxx . . $ size_t# name_length, |
| 3756 | const char *value, |
| 3757 | size_tcxx . . $ size_t# value_length) |
| 3758 | { |
| 3759 | char name_buf[CONFIG_FILE_MAX_NAME_LENGTHcxx . . $ `src/groonga.c:3719:9`! + 3]; |
| 3760 | config_file_entrycxx . . $ config_file_entry# *entry = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 3761 | char *args[4]; |
| 3762 | |
| 3763 | name_buf[0] = name_buf[1] = '-'; |
| 3764 | grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!(name_buf + 2, CONFIG_FILE_MAX_NAME_LENGTH + 1, name); |
| 3765 | |
| 3766 | if (value) { |
| 3767 | const size_tcxx . . $ size_t# entry_size = sizeof(config_file_entrycxx . . $ config_file_entry#) + value_length + 1; |
| 3768 | entry = (config_file_entrycxx . . $ config_file_entry# *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(entry_size); |
| 3769 | if (!entry) { |
| 3770 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 3771 | "memory allocation failed: %u bytes\n", |
| 3772 | (unsigned int)entry_size); |
| 3773 | return CONFIG_FILE_MALLOC_ERRORcxx . . $ CONFIG_FILE_MALLOC_ERROR.; |
| 3774 | } |
| 3775 | grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!((char *)(entry + 1), value_length + 1, value); |
| 3776 | entry->nextcxx . . $ _config_file_entry#next. = config_file_entry_headcxx . . $ config_file_entry_head.; |
| 3777 | if (!config_file_entry_headcxx . . $ config_file_entry_head.) { |
| 3778 | if (atexitcxx . . $ atexit(8919c3b35e68c42d).(config_file_clearcxx . . $ config_file_clear(49f6e7a06ebc5aa8).)) { |
| 3779 | freecxx . . $ free(5d22bdacc48458e8).(entry); |
| 3780 | return CONFIG_FILE_ATEXIT_ERRORcxx . . $ CONFIG_FILE_ATEXIT_ERROR.; |
| 3781 | } |
| 3782 | } |
| 3783 | config_file_entry_headcxx . . $ config_file_entry_head. = entry; |
| 3784 | } |
| 3785 | |
| 3786 | args[0] = (char *)path; |
| 3787 | args[1] = name_buf; |
| 3788 | args[2] = entry ? (char *)(entry + 1) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 3789 | args[3] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 3790 | grn_str_getoptcxx . . $ grn_str_getopt(1f77e49aad5fba88).(entry ? 3 : 2, args, opts, flags); |
| 3791 | return CONFIG_FILE_SUCCESScxx . . $ CONFIG_FILE_SUCCESS.; |
| 3792 | } |
| 3793 | |
| 3794 | static config_file_statuscxx . . $ config_file_status# |
| 3795 | config_file_parsecxx . . $ config_file_parse(c29834952fc53fde).(const char *path, |
| 3796 | const grn_str_getopt_optcxx . . $ grn_str_getopt_opt# *opts, |
| 3797 | int *flags, |
| 3798 | char *buf) |
| 3799 | { |
| 3800 | char *ptr, *name, *value; |
| 3801 | size_tcxx . . $ size_t# name_length, value_length; |
| 3802 | |
| 3803 | while (isspacecxx . . $ `<external>/17904084882347303253/ctype.h:197:10`!((unsigned char)*buf)) { |
| 3804 | buf++; |
| 3805 | } |
| 3806 | |
| 3807 | ptr = buf; |
| 3808 | while (*ptr && *ptr != '#' && *ptr != ';') { |
| 3809 | ptr++; |
| 3810 | } |
| 3811 | |
| 3812 | do { |
| 3813 | *ptr-- = '\0'; |
| 3814 | } while (ptr >= buf && isspacecxx . . $ `<external>/17904084882347303253/ctype.h:197:10`!((unsigned char)*ptr)); |
| 3815 | |
| 3816 | if (!*buf) { |
| 3817 | return CONFIG_FILE_SUCCESScxx . . $ CONFIG_FILE_SUCCESS.; |
| 3818 | } |
| 3819 | |
| 3820 | name = ptr = buf; |
| 3821 | while (*ptr && !isspacecxx . . $ `<external>/17904084882347303253/ctype.h:197:10`!((unsigned char)*ptr) && *ptr != '=') { |
| 3822 | ptr++; |
| 3823 | } |
| 3824 | while (isspacecxx . . $ `<external>/17904084882347303253/ctype.h:197:10`!((unsigned char)*ptr)) { |
| 3825 | *ptr++ = '\0'; |
| 3826 | } |
| 3827 | |
| 3828 | name_length = strlencxx . . $ strlen(751346f8406fd082).(name); |
| 3829 | if (name_length == 0) { |
| 3830 | return CONFIG_FILE_SUCCESScxx . . $ CONFIG_FILE_SUCCESS.; |
| 3831 | } else if (name_length > CONFIG_FILE_MAX_NAME_LENGTHcxx . . $ `src/groonga.c:3719:9`!) { |
| 3832 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 3833 | "too long name in config file: %u bytes\n", |
| 3834 | (unsigned int)name_length); |
| 3835 | return CONFIG_FILE_FORMAT_ERRORcxx . . $ CONFIG_FILE_FORMAT_ERROR.; |
| 3836 | } |
| 3837 | |
| 3838 | if (*ptr == '=') { |
| 3839 | *ptr++ = '\0'; |
| 3840 | while (isspacecxx . . $ `<external>/17904084882347303253/ctype.h:197:10`!((unsigned char)*ptr)) { |
| 3841 | ptr++; |
| 3842 | } |
| 3843 | value = ptr; |
| 3844 | } else if (*ptr) { |
| 3845 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "invalid name in config file\n"); |
| 3846 | return CONFIG_FILE_FORMAT_ERRORcxx . . $ CONFIG_FILE_FORMAT_ERROR.; |
| 3847 | } else { |
| 3848 | value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 3849 | } |
| 3850 | |
| 3851 | value_length = value ? strlencxx . . $ strlen(751346f8406fd082).(value) : 0; |
| 3852 | if (value_length > CONFIG_FILE_MAX_VALUE_LENGTHcxx . . $ `src/groonga.c:3720:9`!) { |
| 3853 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 3854 | "too long value in config file: %u bytes\n", |
| 3855 | (unsigned int)value_length); |
| 3856 | return CONFIG_FILE_FORMAT_ERRORcxx . . $ CONFIG_FILE_FORMAT_ERROR.; |
| 3857 | } |
| 3858 | |
| 3859 | return config_file_registercxx . . $ config_file_register(c293d33ac051e174).(path, |
| 3860 | opts, |
| 3861 | flags, |
| 3862 | name, |
| 3863 | name_length, |
| 3864 | value, |
| 3865 | value_length); |
| 3866 | } |
| 3867 | |
| 3868 | static config_file_statuscxx . . $ config_file_status# |
| 3869 | config_file_loadcxx . . $ config_file_load(c68a13043071cae0).(const char *path, const grn_str_getopt_optcxx . . $ grn_str_getopt_opt# *opts, int *flags) |
| 3870 | { |
| 3871 | config_file_statuscxx . . $ config_file_status# status = CONFIG_FILE_SUCCESScxx . . $ CONFIG_FILE_SUCCESS.; |
| 3872 | char buf[CONFIG_FILE_BUF_SIZEcxx . . $ `src/groonga.c:3718:9`!]; |
| 3873 | size_tcxx . . $ size_t# length = 0; |
| 3874 | FILEcxx . . $ FILE# *const file = fopencxx . . $ fopen(82ec0787cd37e0a3).(path, "rb"); |
| 3875 | if (!file) { |
| 3876 | return CONFIG_FILE_FOPEN_ERRORcxx . . $ CONFIG_FILE_FOPEN_ERROR.; |
| 3877 | } |
| 3878 | |
| 3879 | for (;;) { |
| 3880 | int c = fgetccxx . . $ fgetc(89bc1efcdac0ca22).(file); |
| 3881 | if (c == '\r' || c == '\n' || c == EOFcxx . . $ `<external>/232824719582829767/stdio.h:109:9`!) { |
| 3882 | if (length < sizeof(buf) - 1) { |
| 3883 | buf[length] = '\0'; |
| 3884 | status = config_file_parsecxx . . $ config_file_parse(c29834952fc53fde).(path, opts, flags, buf); |
| 3885 | if (status != CONFIG_FILE_SUCCESScxx . . $ CONFIG_FILE_SUCCESS.) { |
| 3886 | break; |
| 3887 | } |
| 3888 | } |
| 3889 | length = 0; |
| 3890 | } else if (c == '\0') { |
| 3891 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "prohibited '\\0' in config file: %s\n", path); |
| 3892 | status = CONFIG_FILE_FORMAT_ERRORcxx . . $ CONFIG_FILE_FORMAT_ERROR.; |
| 3893 | break; |
| 3894 | } else { |
| 3895 | if (length < sizeof(buf) - 1) { |
| 3896 | buf[length] = (char)c; |
| 3897 | } |
| 3898 | length++; |
| 3899 | } |
| 3900 | |
| 3901 | if (c == EOFcxx . . $ `<external>/232824719582829767/stdio.h:109:9`!) { |
| 3902 | break; |
| 3903 | } |
| 3904 | } |
| 3905 | |
| 3906 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(file); |
| 3907 | return status; |
| 3908 | } |
| 3909 | |
| 3910 | static const int default_http_portcxx . . $ default_http_port. = DEFAULT_HTTP_PORTcxx . . $ `src/groonga.c:85:9`!; |
| 3911 | static const int default_gqtp_portcxx . . $ default_gqtp_port. = DEFAULT_GQTP_PORTcxx . . $ `src/groonga.c:86:9`!; |
| 3912 | static grn_encodingcxx . . $ grn_encoding# default_encodingcxx . . $ default_encoding. = GRN_ENC_DEFAULTcxx . . $ GRN_ENC_DEFAULT.; |
| 3913 | static uint32_tcxx . . $ uint32_t# default_max_n_threadscxx . . $ default_max_n_threads. = DEFAULT_MAX_N_FLOATING_THREADScxx . . $ `src/groonga.c:88:9`!; |
| 3914 | static const grn_log_levelcxx . . $ grn_log_level# default_log_levelcxx . . $ default_log_level. = GRN_LOG_DEFAULT_LEVELcxx . . $ `include/groonga/groonga.h:2473:11`!; |
| 3915 | static const char *const default_protocolcxx . . $ default_protocol. = "gqtp"; |
| 3916 | static const char *default_hostnamecxx . . $ default_hostname. = "localhost"; |
| 3917 | static const char *const default_destcxx . . $ default_dest. = "localhost"; |
| 3918 | static const char *default_log_pathcxx . . $ default_log_path. = ""; |
| 3919 | static const char *default_query_log_pathcxx . . $ default_query_log_path. = ""; |
| 3920 | static const char *default_config_pathcxx . . $ default_config_path. = ""; |
| 3921 | static const char *default_document_rootcxx . . $ default_document_root. = ""; |
| 3922 | static grn_command_versioncxx . . $ grn_command_version# default_default_command_versioncxx . . $ default_default_command_version. = |
| 3923 | GRN_COMMAND_VERSION_DEFAULTcxx . . $ GRN_COMMAND_VERSION_DEFAULT.; |
| 3924 | static int64_tcxx . . $ int64_t# default_default_match_escalation_thresholdcxx . . $ default_default_match_escalation_threshold. = 0; |
| 3925 | static const char *const default_bind_addresscxx . . $ default_bind_address. = "0.0.0.0"; |
| 3926 | static double default_default_request_timeoutcxx . . $ default_default_request_timeout. = 0.0; |
| 3927 | |
| 3928 | static void |
| 3929 | init_default_settingscxx . . $ init_default_settings(49f6e7a06ebc5aa8).(void) |
| 3930 | { |
| 3931 | outputcxx . . $ output. = stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!; |
| 3932 | |
| 3933 | default_encodingcxx . . $ default_encoding. = grn_encoding_parsecxx . . $ grn_encoding_parse(32570f06a4d1f2d3).(GRN_DEFAULT_ENCODINGcxx . . $ `build/config.h:21:9`!); |
| 3934 | |
| 3935 | { |
| 3936 | const uint32_tcxx . . $ uint32_t# n_cores = get_core_numbercxx . . $ get_core_number(db52760e79bf9054).(); |
| 3937 | if (n_cores != 0) { |
| 3938 | default_max_n_threadscxx . . $ default_max_n_threads. = n_cores; |
| 3939 | } |
| 3940 | } |
| 3941 | |
| 3942 | default_log_pathcxx . . $ default_log_path. = grn_default_logger_get_pathcxx . . $ grn_default_logger_get_path(33a1f659e94feb42).(); |
| 3943 | default_query_log_pathcxx . . $ default_query_log_path. = grn_default_query_logger_get_pathcxx . . $ grn_default_query_logger_get_path(33a1f659e94feb42).(); |
| 3944 | |
| 3945 | default_config_pathcxx . . $ default_config_path. = getenvcxx . . $ getenv(a8b8e32347182212).("GRN_CONFIG_PATH"); |
| 3946 | if (!default_config_pathcxx . . $ default_config_path.) { |
| 3947 | default_config_pathcxx . . $ default_config_path. = GRN_CONFIG_PATHcxx . . $ `build/config.h:17:9`!; |
| 3948 | if (!default_config_pathcxx . . $ default_config_path.) { |
| 3949 | default_config_pathcxx . . $ default_config_path. = ""; |
| 3950 | } |
| 3951 | } |
| 3952 | |
| 3953 | #ifdef WIN32 |
| 3954 | { |
| 3955 | static char windows_default_document_root[PATH_MAX]; |
| 3956 | size_t document_root_length = strlen(grn_windows_base_dir()) + 1 + |
| 3957 | strlen(GRN_DEFAULT_RELATIVE_DOCUMENT_ROOT) + |
| 3958 | 1; |
| 3959 | if (document_root_length >= PATH_MAX) { |
| 3960 | fprintf(stderr, "can't use default root: too long path\n"); |
| 3961 | } else { |
| 3962 | grn_strcpy(windows_default_document_root, |
| 3963 | PATH_MAX, |
| 3964 | grn_windows_base_dir()); |
| 3965 | grn_strcat(windows_default_document_root, PATH_MAX, "/"); |
| 3966 | grn_strcat(windows_default_document_root, |
| 3967 | PATH_MAX, |
| 3968 | GRN_DEFAULT_RELATIVE_DOCUMENT_ROOT); |
| 3969 | default_document_root = windows_default_document_root; |
| 3970 | } |
| 3971 | } |
| 3972 | #else |
| 3973 | default_document_rootcxx . . $ default_document_root. = GRN_DEFAULT_DOCUMENT_ROOTcxx . . $ `build/config.h:26:9`!; |
| 3974 | #endif |
| 3975 | |
| 3976 | default_default_command_versioncxx . . $ default_default_command_version. = grn_get_default_command_versioncxx . . $ grn_get_default_command_version(3a765c23ebe28c14).(); |
| 3977 | default_default_match_escalation_thresholdcxx . . $ default_default_match_escalation_threshold. = |
| 3978 | grn_get_default_match_escalation_thresholdcxx . . $ grn_get_default_match_escalation_threshold(da6335ded91d79c2).(); |
| 3979 | default_default_request_timeoutcxx . . $ default_default_request_timeout. = grn_get_default_request_timeoutcxx . . $ grn_get_default_request_timeout(31fa7155c10fdd13).(); |
| 3980 | } |
| 3981 | |
| 3982 | static void |
| 3983 | show_configcxx . . $ show_config(81f9fa9a51fefb98).(FILEcxx . . $ FILE# *out, const grn_str_getopt_optcxx . . $ grn_str_getopt_opt# *opts, int flags) |
| 3984 | { |
| 3985 | const grn_str_getopt_optcxx . . $ grn_str_getopt_opt# *o; |
| 3986 | |
| 3987 | for (o = opts; o->optcxx . . $ $anonymous_type_946308ef283cea1e_1#opt. || o->longoptcxx . . $ $anonymous_type_946308ef283cea1e_1#longopt.; o++) { |
| 3988 | switch (o->opcxx . . $ $anonymous_type_946308ef283cea1e_1#op.) { |
| 3989 | case GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.: |
| 3990 | if (o->argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. && *o->argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg.) { |
| 3991 | if (o->longoptcxx . . $ $anonymous_type_946308ef283cea1e_1#longopt. && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(o->longoptcxx . . $ $anonymous_type_946308ef283cea1e_1#longopt., "config-path")) { |
| 3992 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%s=%s\n", o->longoptcxx . . $ $anonymous_type_946308ef283cea1e_1#longopt., *o->argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg.); |
| 3993 | } |
| 3994 | } |
| 3995 | break; |
| 3996 | case GETOPT_OP_ONcxx . . $ GETOPT_OP_ON.: |
| 3997 | if (flags & o->flagcxx . . $ $anonymous_type_946308ef283cea1e_1#flag.) { |
| 3998 | goto no_arg; |
| 3999 | } |
| 4000 | break; |
| 4001 | case GETOPT_OP_OFFcxx . . $ GETOPT_OP_OFF.: |
| 4002 | if (!(flags & o->flagcxx . . $ $anonymous_type_946308ef283cea1e_1#flag.)) { |
| 4003 | goto no_arg; |
| 4004 | } |
| 4005 | break; |
| 4006 | case GETOPT_OP_UPDATEcxx . . $ GETOPT_OP_UPDATE.: |
| 4007 | if (flags == o->flagcxx . . $ $anonymous_type_946308ef283cea1e_1#flag.) { |
| 4008 | no_arg: |
| 4009 | if (o->longoptcxx . . $ $anonymous_type_946308ef283cea1e_1#longopt.) { |
| 4010 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(out, "%s\n", o->longoptcxx . . $ $anonymous_type_946308ef283cea1e_1#longopt.); |
| 4011 | } |
| 4012 | } |
| 4013 | break; |
| 4014 | } |
| 4015 | } |
| 4016 | } |
| 4017 | |
| 4018 | static void |
| 4019 | show_versioncxx . . $ show_version(49f6e7a06ebc5aa8).(void) |
| 4020 | { |
| 4021 | printfcxx . . $ printf(581fddd72a8db8fc).("%s %s [", grn_get_package_labelcxx . . $ grn_get_package_label(33a1f659e94feb42).(), grn_get_versioncxx . . $ grn_get_version(33a1f659e94feb42).()); |
| 4022 | |
| 4023 | /* FIXME: Should we detect host information dynamically on Windows? */ |
| 4024 | #ifdef HOST_OScxx . . $ `build/config.h:5:9`! |
| 4025 | printfcxx . . $ printf(581fddd72a8db8fc).("%s,", HOST_OScxx . . $ `build/config.h:5:9`!); |
| 4026 | #endif |
| 4027 | #ifdef HOST_CPUcxx . . $ `build/config.h:4:9`! |
| 4028 | printfcxx . . $ printf(581fddd72a8db8fc).("%s,", HOST_CPUcxx . . $ `build/config.h:4:9`!); |
| 4029 | #endif |
| 4030 | printfcxx . . $ printf(581fddd72a8db8fc).("%s", GRN_DEFAULT_ENCODINGcxx . . $ `build/config.h:21:9`!); |
| 4031 | |
| 4032 | printfcxx . . $ printf(581fddd72a8db8fc).(",match-escalation-threshold=%" GRN_FMT_INT64Dcxx . . $ `lib/grn.h:369:11`!, |
| 4033 | grn_get_default_match_escalation_thresholdcxx . . $ grn_get_default_match_escalation_threshold(da6335ded91d79c2).()); |
| 4034 | |
| 4035 | #ifndef NO_NFKC |
| 4036 | printfcxx . . $ printf(581fddd72a8db8fc).(",nfkc"); |
| 4037 | #endif |
| 4038 | #ifdef GRN_WITH_MECABcxx . . $ `build/config.h:107:9`! |
| 4039 | printfcxx . . $ printf(581fddd72a8db8fc).(",mecab"); |
| 4040 | #endif |
| 4041 | #ifdef GRN_WITH_MESSAGE_PACKcxx . . $ `build/config.h:108:9`! |
| 4042 | printfcxx . . $ printf(581fddd72a8db8fc).(",message-pack"); |
| 4043 | #endif |
| 4044 | #ifdef GRN_WITH_MRUBY |
| 4045 | printf(",mruby"); |
| 4046 | #endif |
| 4047 | #ifdef GRN_WITH_ONIGMOcxx . . $ `build/config.h:111:9`! |
| 4048 | printfcxx . . $ printf(581fddd72a8db8fc).(",onigmo"); |
| 4049 | #endif |
| 4050 | #ifdef GRN_WITH_ZLIBcxx . . $ `build/config.h:121:9`! |
| 4051 | printfcxx . . $ printf(581fddd72a8db8fc).(",zlib"); |
| 4052 | #endif |
| 4053 | #ifdef GRN_WITH_LZ4cxx . . $ `build/config.h:106:9`! |
| 4054 | printfcxx . . $ printf(581fddd72a8db8fc).(",lz4"); |
| 4055 | #endif |
| 4056 | #ifdef GRN_WITH_ZSTDcxx . . $ `build/config.h:122:9`! |
| 4057 | printfcxx . . $ printf(581fddd72a8db8fc).(",zstandard"); |
| 4058 | #endif |
| 4059 | #ifdef USE_KQUEUE |
| 4060 | printf(",kqueue"); |
| 4061 | #endif |
| 4062 | #ifdef USE_EPOLLcxx . . $ `build/config.h:62:9`! |
| 4063 | printfcxx . . $ printf(581fddd72a8db8fc).(",epoll"); |
| 4064 | #endif |
| 4065 | #ifdef USE_POLL |
| 4066 | printf(",poll"); |
| 4067 | #endif |
| 4068 | #ifdef GRN_WITH_RAPIDJSON |
| 4069 | printf(",rapidjson"); |
| 4070 | #endif |
| 4071 | #ifdef GRN_WITH_APACHE_ARROW |
| 4072 | printf(",apache-arrow"); |
| 4073 | #endif |
| 4074 | #ifdef GRN_WITH_XXHASHcxx . . $ `build/config.h:119:9`! |
| 4075 | printfcxx . . $ printf(581fddd72a8db8fc).(",xxhash"); |
| 4076 | #endif |
| 4077 | #ifdef GRN_WITH_BLOSC |
| 4078 | printf(",blosc"); |
| 4079 | #endif |
| 4080 | #ifdef GRN_HAVE_BFLOAT16 |
| 4081 | printf(",bfloat16"); |
| 4082 | #endif |
| 4083 | #ifdef GRN_WITH_H3cxx . . $ `build/config.h:99:9`! |
| 4084 | printfcxx . . $ printf(581fddd72a8db8fc).(",h3"); |
| 4085 | #endif |
| 4086 | #ifdef GRN_WITH_SIMDJSONcxx . . $ `build/config.h:115:9`! |
| 4087 | printfcxx . . $ printf(581fddd72a8db8fc).(",simdjson"); |
| 4088 | #endif |
| 4089 | #ifdef GRN_WITH_LLAMA_CPPcxx . . $ `build/config.h:104:9`! |
| 4090 | printfcxx . . $ printf(581fddd72a8db8fc).(",llama.cpp"); |
| 4091 | #endif |
| 4092 | #ifdef GRN_WITH_FAISScxx . . $ `build/config.h:98:9`! |
| 4093 | printfcxx . . $ printf(581fddd72a8db8fc).(",faiss"); |
| 4094 | #endif |
| 4095 | #ifdef GRN_WITH_OPENZLcxx . . $ `build/config.h:112:9`! |
| 4096 | printfcxx . . $ printf(581fddd72a8db8fc).(",openzl"); |
| 4097 | #endif |
| 4098 | #ifdef GRN_WITH_JSONCONScxx . . $ `build/config.h:101:9`! |
| 4099 | printfcxx . . $ printf(581fddd72a8db8fc).(",jsoncons"); |
| 4100 | #endif |
| 4101 | printfcxx . . $ printf(581fddd72a8db8fc).("]\n"); |
| 4102 | |
| 4103 | #ifdef CONFIGURE_OPTIONS |
| 4104 | printf("\n"); |
| 4105 | printf("configure options: <%s>\n", CONFIGURE_OPTIONS); |
| 4106 | #endif |
| 4107 | } |
| 4108 | |
| 4109 | static void |
| 4110 | show_usagecxx . . $ show_usage(8d4262d45fc644ab).(FILEcxx . . $ FILE# *output) |
| 4111 | { |
| 4112 | uint32_tcxx . . $ uint32_t# default_cache_limit = GRN_CACHE_DEFAULT_MAX_N_ENTRIEScxx . . $ `include/groonga/cache.h:25:9`!; |
| 4113 | |
| 4114 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).( |
| 4115 | output, |
| 4116 | "Usage: groonga [options...] [dest]\n" |
| 4117 | "\n" |
| 4118 | "Mode options: (default: standalone)\n" |
| 4119 | " By default, groonga runs in standalone mode.\n" |
| 4120 | " -c: run in client mode\n" |
| 4121 | " -s: run in server mode\n" |
| 4122 | " -d: run in daemon mode\n" |
| 4123 | "\n" |
| 4124 | "Database creation options:\n" |
| 4125 | " -n: create new database (except client mode)\n" |
| 4126 | " -e, --encoding <encoding>:\n" |
| 4127 | " specify encoding for new database\n" |
| 4128 | " [none|euc|utf8|sjis|latin1|koi8r] (default: %s)\n" |
| 4129 | "\n" |
| 4130 | "Standalone/client options:\n" |
| 4131 | " --file <path>: read commands from specified file\n" |
| 4132 | " --input-fd <FD>: read commands from specified file " |
| 4133 | "descriptor\n" |
| 4134 | " --file has a priority over --input-fd\n" |
| 4135 | " --output-fd <FD>: output response to specified file " |
| 4136 | "descriptor\n" |
| 4137 | " -p, --port <port number>: specify server port number (client mode " |
| 4138 | "only)\n" |
| 4139 | " (default: %d)\n" |
| 4140 | "\n" |
| 4141 | "Server/daemon options:\n" |
| 4142 | " --bind-address <ip/hostname>:\n" |
| 4143 | " specify server address to bind\n" |
| 4144 | " (default: %s)\n" |
| 4145 | " -p, --port <port number>: specify server port number\n" |
| 4146 | " (HTTP default: %d, GQTP default: %d)\n" |
| 4147 | " -i, --server-id <ip/hostname>:\n" |
| 4148 | " specify server ID address (default: %s)\n" |
| 4149 | " --protocol <protocol>: specify server protocol to listen\n" |
| 4150 | " [gqtp|http|memcached] (default: %s)\n" |
| 4151 | " --document-root <path>: specify document root path (http only)\n" |
| 4152 | " (default: %s)\n" |
| 4153 | " --cache-limit <limit>: specify max number of cache data " |
| 4154 | "(default: %u)\n" |
| 4155 | " -t, --max-threads <max threads>:\n" |
| 4156 | " specify max number of threads (default: " |
| 4157 | "%u)\n" |
| 4158 | " --pid-path <path>: specify file to write process ID to\n" |
| 4159 | " --default-n-workers <n>:\n" |
| 4160 | " specify the default number of workers\n" |
| 4161 | " --default-request-timeout <timeout>:\n" |
| 4162 | " specify the default request timeout in " |
| 4163 | "seconds\n" |
| 4164 | " (default: %f)\n" |
| 4165 | " --cache-base-path <path>: specify the cache base path\n" |
| 4166 | " You can make cache persistent by this " |
| 4167 | "option\n" |
| 4168 | " You must specify path on memory file " |
| 4169 | "system\n" |
| 4170 | " (default: none; disabled)\n" |
| 4171 | " --listen-backlog <backlog>: specify the backlog for listen(2)\n" |
| 4172 | " (default: %d)\n" |
| 4173 | "\n" |
| 4174 | "Memcached options:\n" |
| 4175 | " --memcached-column <column>:\n" |
| 4176 | " specify column to access by memcached " |
| 4177 | "protocol\n" |
| 4178 | " The column must be text type column and\n" |
| 4179 | " its table must be not NO_KEY table\n" |
| 4180 | "\n" |
| 4181 | "Logging options:\n" |
| 4182 | " -l, --log-level <log level>:\n" |
| 4183 | " specify log level\n" |
| 4184 | " [none|emergency|alert|critical|\n" |
| 4185 | " error|warning|notice|info|debug|dump]\n" |
| 4186 | " (default: %s)\n" |
| 4187 | " --log-flags <log flags>:\n" |
| 4188 | " specify log flags\n" |
| 4189 | " '+' prefix means that 'add the flag'\n" |
| 4190 | " '-' prefix means that 'remove the flag'\n" |
| 4191 | " No prefix means that 'replace existing flags'\n" |
| 4192 | " Multiple log flags can be specified by\n" |
| 4193 | " separating flags with '|'\n" |
| 4194 | " Example: default|+pid|-time\n" |
| 4195 | " [none|time|title|message|location|\n" |
| 4196 | " pid|process_id|thread_id|context_id|\n" |
| 4197 | " all|default]\n" |
| 4198 | " (default: %s)\n" |
| 4199 | " --log-path <path>: specify log path\n" |
| 4200 | " (default: %s)\n" |
| 4201 | " --log-rotate-threshold-size <threshold>:\n" |
| 4202 | " specify threshold for log rotate\n" |
| 4203 | " Log file is rotated when\n" |
| 4204 | " log file size is larger than or\n" |
| 4205 | " equals to the threshold\n" |
| 4206 | " (default: 0; disabled)\n" |
| 4207 | #ifdef WIN32 |
| 4208 | " --use-windows-event-log:\n" |
| 4209 | " report logs as Windows events\n" |
| 4210 | #endif /* WIN32 */ |
| 4211 | " --query-log-path <path>:\n" |
| 4212 | " specify query log path\n" |
| 4213 | " (default: %s)\n" |
| 4214 | " --query-log-rotate-threshold-size <threshold>:\n" |
| 4215 | " specify threshold for query log rotate\n" |
| 4216 | " Query log file is rotated when\n" |
| 4217 | " query log file size is larger than or\n" |
| 4218 | " equals to the threshold\n" |
| 4219 | " (default: 0; disabled)\n" |
| 4220 | "\n" |
| 4221 | "Common options:\n" |
| 4222 | " --working-directory <path>:\n" |
| 4223 | " specify working directory path\n" |
| 4224 | " (none)\n" |
| 4225 | " --config-path <path>:\n" |
| 4226 | " specify config file path\n" |
| 4227 | " (default: %s)\n" |
| 4228 | " --default-command-version <version>:\n" |
| 4229 | " specify default command version (default: %d)\n" |
| 4230 | " --default-match-escalation-threshold <threshold>:\n" |
| 4231 | " specify default match escalation threshold" |
| 4232 | " (default: %" GRN_FMT_INT64Dcxx . . $ `lib/grn.h:369:11`! ")\n" |
| 4233 | "\n" |
| 4234 | " --show-config: show config\n" |
| 4235 | " -h, --help: show usage\n" |
| 4236 | " --version: show groonga version\n" |
| 4237 | "\n" |
| 4238 | "dest:\n" |
| 4239 | " <db pathname> [<commands>]: in standalone mode\n" |
| 4240 | " <db pathname>: in server/daemon mode\n" |
| 4241 | " <dest hostname> [<commands>]: in client mode (default: %s)\n", |
| 4242 | grn_encoding_to_stringcxx . . $ grn_encoding_to_string(9da28ca6a864c8da).(default_encodingcxx . . $ default_encoding.), |
| 4243 | default_gqtp_portcxx . . $ default_gqtp_port., |
| 4244 | default_bind_addresscxx . . $ default_bind_address., |
| 4245 | default_http_portcxx . . $ default_http_port., |
| 4246 | default_gqtp_portcxx . . $ default_gqtp_port., |
| 4247 | default_hostnamecxx . . $ default_hostname., |
| 4248 | default_protocolcxx . . $ default_protocol., |
| 4249 | default_document_rootcxx . . $ default_document_root., |
| 4250 | default_cache_limit, |
| 4251 | default_max_n_threadscxx . . $ default_max_n_threads., |
| 4252 | default_default_request_timeoutcxx . . $ default_default_request_timeout., |
| 4253 | listen_backlogcxx . . $ listen_backlog., |
| 4254 | grn_log_level_to_stringcxx . . $ grn_log_level_to_string(e273248267cc0d14).(default_log_levelcxx . . $ default_log_level.), |
| 4255 | "time|message", /* TODO: Generate from GRN_LOG_DEFAULT */ |
| 4256 | default_log_pathcxx . . $ default_log_path., |
| 4257 | default_query_log_pathcxx . . $ default_query_log_path., |
| 4258 | default_config_pathcxx . . $ default_config_path., |
| 4259 | default_default_command_versioncxx . . $ default_default_command_version., |
| 4260 | default_default_match_escalation_thresholdcxx . . $ default_default_match_escalation_threshold., |
| 4261 | default_destcxx . . $ default_dest.); |
| 4262 | } |
| 4263 | |
| 4264 | int |
| 4265 | maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv) |
| 4266 | { |
| 4267 | const char *port_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4268 | const char *encoding_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4269 | const char *max_n_threads_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4270 | const char *log_level_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4271 | const char *bind_address_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4272 | const char *hostname_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4273 | const char *protocol_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4274 | const char *log_path_arg = GRN_LOG_PATHcxx . . $ `build/config.h:18:9`!; |
| 4275 | const char *log_rotate_threshold_size_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4276 | const char *query_log_path_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4277 | const char *query_log_rotate_threshold_size_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4278 | const char *cache_limit_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4279 | const char *document_root_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4280 | const char *default_command_version_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4281 | const char *default_match_escalation_threshold_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4282 | const char *input_fd_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4283 | const char *output_fd_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4284 | const char *working_directory_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4285 | const char *config_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4286 | const char *default_request_timeout_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4287 | const char *cache_base_path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4288 | const char *listen_backlog_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4289 | const char *log_flags_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4290 | const char *wal_role_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4291 | const char *default_n_workers_arg = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4292 | int exit_code = EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!; |
| 4293 | int i; |
| 4294 | int flags = 0; |
| 4295 | uint32_tcxx . . $ uint32_t# cache_limit = 0; |
| 4296 | grn_command_versioncxx . . $ grn_command_version# default_command_version; |
| 4297 | int64_tcxx . . $ int64_t# default_match_escalation_threshold = 0; |
| 4298 | double default_request_timeout = 0.0; |
| 4299 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! need_line_editor = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 4300 | static grn_str_getopt_optcxx . . $ grn_str_getopt_opt# opts[] = { |
| 4301 | {'p', "port", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4302 | {'e', "encoding", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4303 | {'t', "max-threads", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4304 | {'h', "help", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, ACTION_USAGEcxx . . $ ACTION_USAGE., GETOPT_OP_UPDATEcxx . . $ GETOPT_OP_UPDATE.}, |
| 4305 | {'c', NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, FLAG_MODE_CLIENTcxx . . $ `src/groonga.c:3683:9`!, GETOPT_OP_ONcxx . . $ GETOPT_OP_ON.}, |
| 4306 | {'d', NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, FLAG_MODE_DAEMONcxx . . $ `src/groonga.c:3684:9`!, GETOPT_OP_ONcxx . . $ GETOPT_OP_ON.}, |
| 4307 | {'s', NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, FLAG_MODE_SERVERcxx . . $ `src/groonga.c:3685:9`!, GETOPT_OP_ONcxx . . $ GETOPT_OP_ON.}, |
| 4308 | {'l', "log-level", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4309 | {'i', "server-id", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4310 | {'n', NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, FLAG_NEW_DBcxx . . $ `src/groonga.c:3686:9`!, GETOPT_OP_ONcxx . . $ GETOPT_OP_ON.}, |
| 4311 | {'\0', "protocol", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4312 | {'\0', "version", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, ACTION_VERSIONcxx . . $ ACTION_VERSION., GETOPT_OP_UPDATEcxx . . $ GETOPT_OP_UPDATE.}, |
| 4313 | {'\0', "log-path", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4314 | {'\0', "log-rotate-threshold-size", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4315 | {'\0', "query-log-path", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4316 | {'\0', "query-log-rotate-threshold-size", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4317 | {'\0', "pid-path", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4318 | {'\0', "config-path", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4319 | {'\0', "show-config", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, ACTION_SHOW_CONFIGcxx . . $ ACTION_SHOW_CONFIG., GETOPT_OP_UPDATEcxx . . $ GETOPT_OP_UPDATE.}, |
| 4320 | {'\0', "cache-limit", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4321 | {'\0', "file", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4322 | {'\0', "document-root", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4323 | {'\0', "default-command-version", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4324 | {'\0', "default-match-escalation-threshold", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4325 | {'\0', "bind-address", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4326 | {'\0', "input-fd", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4327 | {'\0', "output-fd", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4328 | {'\0', "working-directory", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4329 | {'\0', |
| 4330 | "use-windows-event-log", |
| 4331 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, |
| 4332 | FLAG_USE_WINDOWS_EVENT_LOGcxx . . $ `src/groonga.c:3687:9`!, |
| 4333 | GETOPT_OP_ONcxx . . $ GETOPT_OP_ON.}, |
| 4334 | {'\0', "memcached-column", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4335 | {'\0', "default-request-timeout", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4336 | {'\0', "cache-base-path", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4337 | {'\0', "listen-backlog", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4338 | {'\0', "log-flags", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4339 | {'\0', "wal-role", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4340 | {'\0', "default-n-workers", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, GETOPT_OP_NONEcxx . . $ GETOPT_OP_NONE.}, |
| 4341 | {'\0', NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, 0}}; |
| 4342 | opts[0].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &port_arg; |
| 4343 | opts[1].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &encoding_arg; |
| 4344 | opts[2].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &max_n_threads_arg; |
| 4345 | opts[7].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &log_level_arg; |
| 4346 | opts[8].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &hostname_arg; |
| 4347 | opts[10].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &protocol_arg; |
| 4348 | opts[12].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &log_path_arg; |
| 4349 | opts[13].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &log_rotate_threshold_size_arg; |
| 4350 | opts[14].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &query_log_path_arg; |
| 4351 | opts[15].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &query_log_rotate_threshold_size_arg; |
| 4352 | opts[16].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &pid_file_pathcxx . . $ pid_file_path.; |
| 4353 | opts[17].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &config_path; |
| 4354 | opts[19].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &cache_limit_arg; |
| 4355 | opts[20].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &input_pathcxx . . $ input_path.; |
| 4356 | opts[21].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &document_root_arg; |
| 4357 | opts[22].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &default_command_version_arg; |
| 4358 | opts[23].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &default_match_escalation_threshold_arg; |
| 4359 | opts[24].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &bind_address_arg; |
| 4360 | opts[25].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &input_fd_arg; |
| 4361 | opts[26].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &output_fd_arg; |
| 4362 | opts[27].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &working_directory_arg; |
| 4363 | opts[29].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &memcached_column_namecxx . . $ memcached_column_name.; |
| 4364 | opts[30].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &default_request_timeout_arg; |
| 4365 | opts[31].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &cache_base_path; |
| 4366 | opts[32].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &listen_backlog_arg; |
| 4367 | opts[33].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &log_flags_arg; |
| 4368 | opts[34].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &wal_role_arg; |
| 4369 | opts[35].argcxx . . $ $anonymous_type_946308ef283cea1e_1#arg. = &default_n_workers_arg; |
| 4370 | |
| 4371 | reset_ready_notify_pipecxx . . $ reset_ready_notify_pipe(49f6e7a06ebc5aa8).(); |
| 4372 | |
| 4373 | init_default_settingscxx . . $ init_default_settings(49f6e7a06ebc5aa8).(); |
| 4374 | |
| 4375 | /* only for parsing --config-path. */ |
| 4376 | i = grn_str_getoptcxx . . $ grn_str_getopt(1f77e49aad5fba88).(argc, argv, opts, &flags); |
| 4377 | if (i < 0) { |
| 4378 | show_usagecxx . . $ show_usage(8d4262d45fc644ab).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!); |
| 4379 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4380 | } |
| 4381 | |
| 4382 | if (config_path) { |
| 4383 | const config_file_statuscxx . . $ config_file_status# status = |
| 4384 | config_file_loadcxx . . $ config_file_load(c68a13043071cae0).(config_path, opts, &flags); |
| 4385 | if (status == CONFIG_FILE_FOPEN_ERRORcxx . . $ CONFIG_FILE_FOPEN_ERROR.) { |
| 4386 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4387 | "%s: can't open config file: %s (%s)\n", |
| 4388 | argv[0], |
| 4389 | config_path, |
| 4390 | strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 4391 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4392 | } else if (status != CONFIG_FILE_SUCCESScxx . . $ CONFIG_FILE_SUCCESS.) { |
| 4393 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4394 | "%s: failed to parse config file: %s (%s)\n", |
| 4395 | argv[0], |
| 4396 | config_path, |
| 4397 | (status == CONFIG_FILE_FORMAT_ERRORcxx . . $ CONFIG_FILE_FORMAT_ERROR.) ? "Invalid format" |
| 4398 | : strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 4399 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4400 | } |
| 4401 | } else if (*default_config_pathcxx . . $ default_config_path.) { |
| 4402 | const config_file_statuscxx . . $ config_file_status# status = |
| 4403 | config_file_loadcxx . . $ config_file_load(c68a13043071cae0).(default_config_pathcxx . . $ default_config_path., opts, &flags); |
| 4404 | if (status != CONFIG_FILE_SUCCESScxx . . $ CONFIG_FILE_SUCCESS. && status != CONFIG_FILE_FOPEN_ERRORcxx . . $ CONFIG_FILE_FOPEN_ERROR.) { |
| 4405 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4406 | "%s: failed to parse config file: %s (%s)\n", |
| 4407 | argv[0], |
| 4408 | default_config_pathcxx . . $ default_config_path., |
| 4409 | (status == CONFIG_FILE_FORMAT_ERRORcxx . . $ CONFIG_FILE_FORMAT_ERROR.) ? "Invalid format" |
| 4410 | : strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 4411 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4412 | } |
| 4413 | } |
| 4414 | |
| 4415 | if (working_directory_arg) { |
| 4416 | if (chdircxx . . $ chdir(5c4306d8553b3696).(working_directory_arg) == -1) { |
| 4417 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4418 | "%s: failed to change directory: %s: %s\n", |
| 4419 | argv[0], |
| 4420 | working_directory_arg, |
| 4421 | strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 4422 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4423 | } |
| 4424 | } |
| 4425 | |
| 4426 | if (cache_base_path) { |
| 4427 | grn_set_default_cache_base_pathcxx . . $ grn_set_default_cache_base_path(85c52e162fed56f9).(cache_base_path); |
| 4428 | } |
| 4429 | |
| 4430 | /* ignore mode option in config file */ |
| 4431 | flags = (flags == ACTION_ERRORcxx . . $ ACTION_ERROR.) ? 0 : (flags & ~ACTION_MASKcxx . . $ `src/groonga.c:3680:9`!); |
| 4432 | |
| 4433 | i = grn_str_getoptcxx . . $ grn_str_getopt(1f77e49aad5fba88).(argc, argv, opts, &flags); |
| 4434 | if (i < 0) { |
| 4435 | flags = ACTION_ERRORcxx . . $ ACTION_ERROR.; |
| 4436 | } |
| 4437 | switch (flags & ACTION_MASKcxx . . $ `src/groonga.c:3680:9`!) { |
| 4438 | case ACTION_VERSIONcxx . . $ ACTION_VERSION.: |
| 4439 | show_versioncxx . . $ show_version(49f6e7a06ebc5aa8).(); |
| 4440 | return EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!; |
| 4441 | case ACTION_USAGEcxx . . $ ACTION_USAGE.: |
| 4442 | show_usagecxx . . $ show_usage(8d4262d45fc644ab).(outputcxx . . $ output.); |
| 4443 | return EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!; |
| 4444 | case ACTION_SHOW_CONFIGcxx . . $ ACTION_SHOW_CONFIG.: |
| 4445 | show_configcxx . . $ show_config(81f9fa9a51fefb98).(outputcxx . . $ output., opts, flags & ~ACTION_MASKcxx . . $ `src/groonga.c:3680:9`!); |
| 4446 | return EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:97:9`!; |
| 4447 | case ACTION_ERRORcxx . . $ ACTION_ERROR.: |
| 4448 | show_usagecxx . . $ show_usage(8d4262d45fc644ab).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!); |
| 4449 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4450 | } |
| 4451 | |
| 4452 | if ((flags & MODE_MASKcxx . . $ `src/groonga.c:3681:9`!) == 0) { |
| 4453 | flags |= FLAG_MODE_ALONEcxx . . $ `src/groonga.c:3682:9`!; |
| 4454 | } |
| 4455 | |
| 4456 | if (port_arg) { |
| 4457 | const char *const end = port_arg + strlencxx . . $ strlen(751346f8406fd082).(port_arg); |
| 4458 | const char *rest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4459 | const int value = grn_atoicxx . . $ grn_atoi(adf3ff2c2b114929).(port_arg, end, &rest); |
| 4460 | if (rest != end || value <= 0 || value > 65535) { |
| 4461 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "invalid port number: <%s>\n", port_arg); |
| 4462 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4463 | } |
| 4464 | portcxx . . $ port. = value; |
| 4465 | } else { |
| 4466 | if (protocol_arg) { |
| 4467 | if (*protocol_arg == 'h' || *protocol_arg == 'H') { |
| 4468 | portcxx . . $ port. = default_http_portcxx . . $ default_http_port.; |
| 4469 | } |
| 4470 | } |
| 4471 | } |
| 4472 | |
| 4473 | if (encoding_arg) { |
| 4474 | switch (*encoding_arg) { |
| 4475 | case 'n': |
| 4476 | case 'N': |
| 4477 | encodingcxx . . $ encoding. = GRN_ENC_NONEcxx . . $ GRN_ENC_NONE.; |
| 4478 | break; |
| 4479 | case 'e': |
| 4480 | case 'E': |
| 4481 | encodingcxx . . $ encoding. = GRN_ENC_EUC_JPcxx . . $ GRN_ENC_EUC_JP.; |
| 4482 | break; |
| 4483 | case 'u': |
| 4484 | case 'U': |
| 4485 | encodingcxx . . $ encoding. = GRN_ENC_UTF8cxx . . $ GRN_ENC_UTF8.; |
| 4486 | break; |
| 4487 | case 's': |
| 4488 | case 'S': |
| 4489 | encodingcxx . . $ encoding. = GRN_ENC_SJIScxx . . $ GRN_ENC_SJIS.; |
| 4490 | break; |
| 4491 | case 'l': |
| 4492 | case 'L': |
| 4493 | encodingcxx . . $ encoding. = GRN_ENC_LATIN1cxx . . $ GRN_ENC_LATIN1.; |
| 4494 | break; |
| 4495 | case 'k': |
| 4496 | case 'K': |
| 4497 | encodingcxx . . $ encoding. = GRN_ENC_KOI8Rcxx . . $ GRN_ENC_KOI8R.; |
| 4498 | break; |
| 4499 | default: |
| 4500 | encodingcxx . . $ encoding. = GRN_ENC_DEFAULTcxx . . $ GRN_ENC_DEFAULT.; |
| 4501 | break; |
| 4502 | } |
| 4503 | } else { |
| 4504 | encodingcxx . . $ encoding. = GRN_ENC_DEFAULTcxx . . $ GRN_ENC_DEFAULT.; |
| 4505 | } |
| 4506 | |
| 4507 | if (!grn_document_rootcxx . . $ grn_document_root.) { |
| 4508 | grn_document_rootcxx . . $ grn_document_root. = default_document_rootcxx . . $ default_document_root.; |
| 4509 | } |
| 4510 | |
| 4511 | if (protocol_arg) { |
| 4512 | switch (*protocol_arg) { |
| 4513 | case 'g': |
| 4514 | case 'G': |
| 4515 | do_clientcxx . . $ do_client. = g_clientcxx . . $ g_client(afcd3168fc1188a4).; |
| 4516 | do_servercxx . . $ do_server. = g_servercxx . . $ g_server(1ef8e6ec083aabb9).; |
| 4517 | break; |
| 4518 | case 'h': |
| 4519 | case 'H': |
| 4520 | do_clientcxx . . $ do_client. = g_clientcxx . . $ g_client(afcd3168fc1188a4).; |
| 4521 | do_servercxx . . $ do_server. = h_servercxx . . $ h_server(1ef8e6ec083aabb9).; |
| 4522 | break; |
| 4523 | case 'm': |
| 4524 | case 'M': |
| 4525 | is_memcached_modecxx . . $ is_memcached_mode. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 4526 | do_clientcxx . . $ do_client. = g_clientcxx . . $ g_client(afcd3168fc1188a4).; |
| 4527 | do_servercxx . . $ do_server. = g_servercxx . . $ g_server(1ef8e6ec083aabb9).; |
| 4528 | break; |
| 4529 | default: |
| 4530 | do_clientcxx . . $ do_client. = g_clientcxx . . $ g_client(afcd3168fc1188a4).; |
| 4531 | do_servercxx . . $ do_server. = g_servercxx . . $ g_server(1ef8e6ec083aabb9).; |
| 4532 | break; |
| 4533 | } |
| 4534 | } else { |
| 4535 | do_clientcxx . . $ do_client. = g_clientcxx . . $ g_client(afcd3168fc1188a4).; |
| 4536 | do_servercxx . . $ do_server. = g_servercxx . . $ g_server(1ef8e6ec083aabb9).; |
| 4537 | } |
| 4538 | |
| 4539 | #ifdef WIN32 |
| 4540 | if (flags & FLAG_USE_WINDOWS_EVENT_LOG) { |
| 4541 | use_windows_event_log = true; |
| 4542 | } |
| 4543 | #endif /* WIN32 */ |
| 4544 | |
| 4545 | if (use_windows_event_logcxx . . $ use_windows_event_log.) { |
| 4546 | grn_windows_event_logger_setcxx . . $ grn_windows_event_logger_set(cae1c943be750b4c).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, windows_event_source_namecxx . . $ windows_event_source_name.); |
| 4547 | } |
| 4548 | |
| 4549 | if (log_path_arg) { |
| 4550 | grn_default_logger_set_pathcxx . . $ grn_default_logger_set_path(85c52e162fed56f9).(log_path_arg); |
| 4551 | } |
| 4552 | |
| 4553 | if (log_rotate_threshold_size_arg) { |
| 4554 | const char *const end = |
| 4555 | log_rotate_threshold_size_arg + strlencxx . . $ strlen(751346f8406fd082).(log_rotate_threshold_size_arg); |
| 4556 | const char *rest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4557 | const uint64_tcxx . . $ uint64_t# value = |
| 4558 | grn_atoullcxx . . $ grn_atoull(bd2852887cfac9d6).(log_rotate_threshold_size_arg, end, &rest); |
| 4559 | if (end != rest) { |
| 4560 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4561 | "invalid log rotate threshold size: <%s>\n", |
| 4562 | log_rotate_threshold_size_arg); |
| 4563 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4564 | } |
| 4565 | grn_default_logger_set_rotate_threshold_sizecxx . . $ grn_default_logger_set_rotate_threshold_size(1624ee8275b10bda).(value); |
| 4566 | } |
| 4567 | |
| 4568 | if (log_flags_arg) { |
| 4569 | int log_flags = GRN_LOG_DEFAULTcxx . . $ `include/groonga/groonga.h:2376:9`!; |
| 4570 | if (!grn_log_flags_parsecxx . . $ grn_log_flags_parse(1a0a5fdf16ca07b0).(log_flags_arg, -1, &log_flags)) { |
| 4571 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "invalid log flags: <%s>\n", log_flags_arg); |
| 4572 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4573 | } |
| 4574 | grn_default_logger_set_flagscxx . . $ grn_default_logger_set_flags(d4f767463ce0a6b3).(log_flags); |
| 4575 | } |
| 4576 | |
| 4577 | if (query_log_path_arg) { |
| 4578 | grn_default_query_logger_set_pathcxx . . $ grn_default_query_logger_set_path(85c52e162fed56f9).(query_log_path_arg); |
| 4579 | } |
| 4580 | |
| 4581 | if (query_log_rotate_threshold_size_arg) { |
| 4582 | const char *const end = query_log_rotate_threshold_size_arg + |
| 4583 | strlencxx . . $ strlen(751346f8406fd082).(query_log_rotate_threshold_size_arg); |
| 4584 | const char *rest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4585 | const uint64_tcxx . . $ uint64_t# value = |
| 4586 | grn_atoullcxx . . $ grn_atoull(bd2852887cfac9d6).(query_log_rotate_threshold_size_arg, end, &rest); |
| 4587 | if (end != rest) { |
| 4588 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4589 | "invalid query log rotate threshold size: <%s>\n", |
| 4590 | query_log_rotate_threshold_size_arg); |
| 4591 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4592 | } |
| 4593 | grn_default_query_logger_set_rotate_threshold_sizecxx . . $ grn_default_query_logger_set_rotate_threshold_size(1624ee8275b10bda).(value); |
| 4594 | } |
| 4595 | |
| 4596 | { |
| 4597 | grn_log_levelcxx . . $ grn_log_level# log_level; |
| 4598 | |
| 4599 | if (log_level_arg) { |
| 4600 | if (!grn_log_level_parsecxx . . $ grn_log_level_parse(ade47491a90ed684).(log_level_arg, &log_level)) { |
| 4601 | const char *const end = log_level_arg + strlencxx . . $ strlen(751346f8406fd082).(log_level_arg); |
| 4602 | const char *rest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4603 | const int value = grn_atoicxx . . $ grn_atoi(adf3ff2c2b114929).(log_level_arg, end, &rest); |
| 4604 | if (end != rest || value < GRN_LOG_NONEcxx . . $ `include/groonga/groonga.h:2362:9`! || value > GRN_LOG_DUMPcxx . . $ GRN_LOG_DUMP.) { |
| 4605 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "invalid log level: <%s>\n", log_level_arg); |
| 4606 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4607 | } |
| 4608 | log_level = value; |
| 4609 | } |
| 4610 | } else { |
| 4611 | log_level = default_log_levelcxx . . $ default_log_level.; |
| 4612 | } |
| 4613 | |
| 4614 | grn_default_logger_set_max_levelcxx . . $ grn_default_logger_set_max_level(f9d277a447c2c34d).(log_level); |
| 4615 | } |
| 4616 | |
| 4617 | if (max_n_threads_arg) { |
| 4618 | const char *const end = max_n_threads_arg + strlencxx . . $ strlen(751346f8406fd082).(max_n_threads_arg); |
| 4619 | const char *rest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4620 | const uint32_tcxx . . $ uint32_t# value = grn_atouicxx . . $ grn_atoui(2da3fe788a18ce64).(max_n_threads_arg, end, &rest); |
| 4621 | if (end != rest || value < 1 || value > 100) { |
| 4622 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4623 | "invalid max number of threads: <%s>\n", |
| 4624 | max_n_threads_arg); |
| 4625 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4626 | } |
| 4627 | max_n_floating_threadscxx . . $ max_n_floating_threads. = value; |
| 4628 | } else { |
| 4629 | if (flags & FLAG_MODE_ALONEcxx . . $ `src/groonga.c:3682:9`!) { |
| 4630 | max_n_floating_threadscxx . . $ max_n_floating_threads. = 1; |
| 4631 | } else { |
| 4632 | max_n_floating_threadscxx . . $ max_n_floating_threads. = default_max_n_threadscxx . . $ default_max_n_threads.; |
| 4633 | } |
| 4634 | } |
| 4635 | |
| 4636 | grn_thread_set_get_limit_funccxx . . $ grn_thread_set_get_limit_func(40b3ae03e5fbf9a7).(groonga_get_thread_limitcxx . . $ groonga_get_thread_limit(6769d0e399bf81e3)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 4637 | grn_thread_set_set_limit_funccxx . . $ grn_thread_set_set_limit_func(2f95b700af9d060b).(groonga_set_thread_limitcxx . . $ groonga_set_thread_limit(15326d06e62ce759)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 4638 | grn_thread_set_set_limit_with_ctx_funccxx . . $ grn_thread_set_set_limit_with_ctx_func(2535621ef2753da2).(groonga_set_thread_limit_with_ctxcxx . . $ groonga_set_thread_limit_with_ctx(eb336c7ec43e10ce)., |
| 4639 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 4640 | |
| 4641 | if (output_fd_arg) { |
| 4642 | const char *const end = output_fd_arg + strlencxx . . $ strlen(751346f8406fd082).(output_fd_arg); |
| 4643 | const char *rest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4644 | const int output_fd = grn_atoicxx . . $ grn_atoi(adf3ff2c2b114929).(output_fd_arg, end, &rest); |
| 4645 | if (rest != end || output_fd == 0) { |
| 4646 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "invalid output FD: <%s>\n", output_fd_arg); |
| 4647 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4648 | } |
| 4649 | outputcxx . . $ output. = fdopencxx . . $ fdopen(8f4e2d7350ebd077).(output_fd, "w"); |
| 4650 | if (!outputcxx . . $ output.) { |
| 4651 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4652 | "can't open output FD: %d (%s)\n", |
| 4653 | output_fd, |
| 4654 | strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 4655 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4656 | } |
| 4657 | } |
| 4658 | |
| 4659 | if (bind_address_arg) { |
| 4660 | const size_tcxx . . $ size_t# bind_address_length = strlencxx . . $ strlen(751346f8406fd082).(bind_address_arg); |
| 4661 | if (bind_address_length > HOST_NAME_MAXcxx . . $ `<external>/2191589805780913682/local_lim.h:93:9`!) { |
| 4662 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4663 | "too long bind address: %s (%u bytes):" |
| 4664 | " must not be longer than %u bytes\n", |
| 4665 | bind_address_arg, |
| 4666 | (unsigned int)bind_address_length, |
| 4667 | HOST_NAME_MAXcxx . . $ `<external>/2191589805780913682/local_lim.h:93:9`!); |
| 4668 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4669 | } |
| 4670 | grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!(bind_address, HOST_NAME_MAX + 1, bind_address_arg); |
| 4671 | } else { |
| 4672 | grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!(bind_address, HOST_NAME_MAX + 1, default_bind_address); |
| 4673 | } |
| 4674 | |
| 4675 | if (hostname_arg) { |
| 4676 | const size_tcxx . . $ size_t# hostname_length = strlencxx . . $ strlen(751346f8406fd082).(hostname_arg); |
| 4677 | if (hostname_length > HOST_NAME_MAXcxx . . $ `<external>/2191589805780913682/local_lim.h:93:9`!) { |
| 4678 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4679 | "too long hostname: %s (%u bytes):" |
| 4680 | " must not be longer than %u bytes\n", |
| 4681 | hostname_arg, |
| 4682 | (unsigned int)hostname_length, |
| 4683 | HOST_NAME_MAXcxx . . $ `<external>/2191589805780913682/local_lim.h:93:9`!); |
| 4684 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4685 | } |
| 4686 | grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!(hostname, HOST_NAME_MAX + 1, hostname_arg); |
| 4687 | } else { |
| 4688 | grn_strcpycxx . . $ `include/groonga/portability.h:101:11`!(hostname, HOST_NAME_MAX + 1, default_hostname); |
| 4689 | } |
| 4690 | |
| 4691 | if (document_root_arg) { |
| 4692 | grn_document_rootcxx . . $ grn_document_root. = document_root_arg; |
| 4693 | } |
| 4694 | |
| 4695 | if (default_command_version_arg) { |
| 4696 | const char *const end = |
| 4697 | default_command_version_arg + strlencxx . . $ strlen(751346f8406fd082).(default_command_version_arg); |
| 4698 | const char *rest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4699 | const int value = grn_atoicxx . . $ grn_atoi(adf3ff2c2b114929).(default_command_version_arg, end, &rest); |
| 4700 | if (end != rest || value < GRN_COMMAND_VERSION_MINcxx . . $ `include/groonga/groonga.h:188:9`! || |
| 4701 | value > GRN_COMMAND_VERSION_MAXcxx . . $ `include/groonga/groonga.h:190:9`!) { |
| 4702 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4703 | "invalid command version: <%s>\n", |
| 4704 | default_command_version_arg); |
| 4705 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4706 | } |
| 4707 | default_command_version = value; |
| 4708 | } else { |
| 4709 | default_command_version = default_default_command_versioncxx . . $ default_default_command_version.; |
| 4710 | } |
| 4711 | |
| 4712 | if (default_match_escalation_threshold_arg) { |
| 4713 | const char *const end = default_match_escalation_threshold_arg + |
| 4714 | strlencxx . . $ strlen(751346f8406fd082).(default_match_escalation_threshold_arg); |
| 4715 | const char *rest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4716 | const int64_tcxx . . $ int64_t# value = |
| 4717 | grn_atollcxx . . $ grn_atoll(e3438c906dd00acd).(default_match_escalation_threshold_arg, end, &rest); |
| 4718 | if (end != rest) { |
| 4719 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4720 | "invalid match escalation threshold: <%s>\n", |
| 4721 | default_match_escalation_threshold_arg); |
| 4722 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4723 | } |
| 4724 | default_match_escalation_threshold = value; |
| 4725 | } else { |
| 4726 | default_match_escalation_threshold = |
| 4727 | default_default_match_escalation_thresholdcxx . . $ default_default_match_escalation_threshold.; |
| 4728 | } |
| 4729 | |
| 4730 | if (cache_limit_arg) { |
| 4731 | const char *const end = cache_limit_arg + strlencxx . . $ strlen(751346f8406fd082).(cache_limit_arg); |
| 4732 | const char *rest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4733 | const uint32_tcxx . . $ uint32_t# value = grn_atouicxx . . $ grn_atoui(2da3fe788a18ce64).(cache_limit_arg, end, &rest); |
| 4734 | if (end != rest) { |
| 4735 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "invalid --cache-limit value: <%s>\n", cache_limit_arg); |
| 4736 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4737 | } |
| 4738 | cache_limit = value; |
| 4739 | } |
| 4740 | |
| 4741 | if (default_request_timeout_arg) { |
| 4742 | const char *const end = |
| 4743 | default_request_timeout_arg + strlencxx . . $ strlen(751346f8406fd082).(default_request_timeout_arg); |
| 4744 | char *rest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4745 | double value; |
| 4746 | value = strtodcxx . . $ strtod(3dfe5620a0d3160e).(default_request_timeout_arg, &rest); |
| 4747 | if (end != rest) { |
| 4748 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4749 | "invalid default request timeout: <%s>\n", |
| 4750 | default_request_timeout_arg); |
| 4751 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4752 | } |
| 4753 | default_request_timeout = value; |
| 4754 | } else { |
| 4755 | default_request_timeout = default_default_request_timeoutcxx . . $ default_default_request_timeout.; |
| 4756 | } |
| 4757 | |
| 4758 | if (listen_backlog_arg) { |
| 4759 | const char *const end = listen_backlog_arg + strlencxx . . $ strlen(751346f8406fd082).(listen_backlog_arg); |
| 4760 | const char *rest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4761 | int value; |
| 4762 | value = grn_atoicxx . . $ grn_atoi(adf3ff2c2b114929).(listen_backlog_arg, end, &rest); |
| 4763 | if (rest != end || value <= 0) { |
| 4764 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "invalid listen backlog: <%s>\n", listen_backlog_arg); |
| 4765 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4766 | } |
| 4767 | listen_backlogcxx . . $ listen_backlog. = value; |
| 4768 | } |
| 4769 | |
| 4770 | if (!wal_role_arg) { |
| 4771 | wal_role_arg = getenvcxx . . $ getenv(a8b8e32347182212).("GRN_WAL_ROLE"); |
| 4772 | } |
| 4773 | if (wal_role_arg) { |
| 4774 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(wal_role_arg, "none") == 0) { |
| 4775 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(wal_role_arg, "primary") == 0) { |
| 4776 | wal_rolecxx . . $ wal_role. = GRN_WAL_ROLE_PRIMARYcxx . . $ GRN_WAL_ROLE_PRIMARY.; |
| 4777 | worker_wal_rolecxx . . $ worker_wal_role. = GRN_WAL_ROLE_SECONDARYcxx . . $ GRN_WAL_ROLE_SECONDARY.; |
| 4778 | } else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(wal_role_arg, "secondary") == 0) { |
| 4779 | wal_rolecxx . . $ wal_role. = GRN_WAL_ROLE_SECONDARYcxx . . $ GRN_WAL_ROLE_SECONDARY.; |
| 4780 | worker_wal_rolecxx . . $ worker_wal_role. = GRN_WAL_ROLE_SECONDARYcxx . . $ GRN_WAL_ROLE_SECONDARY.; |
| 4781 | } else { |
| 4782 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "invalid WAL role: <%s>\n", wal_role_arg); |
| 4783 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "available WAL roles: none, primary, secondary\n"); |
| 4784 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4785 | } |
| 4786 | } |
| 4787 | |
| 4788 | if (default_n_workers_arg) { |
| 4789 | const char *const end = |
| 4790 | default_n_workers_arg + strlencxx . . $ strlen(751346f8406fd082).(default_n_workers_arg); |
| 4791 | const char *rest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4792 | const int value = grn_atoicxx . . $ grn_atoi(adf3ff2c2b114929).(default_n_workers_arg, end, &rest); |
| 4793 | if (end != rest) { |
| 4794 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4795 | "invalid --default-n-workers value: <%s>\n", |
| 4796 | default_n_workers_arg); |
| 4797 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4798 | } |
| 4799 | grn_set_default_n_workerscxx . . $ grn_set_default_n_workers(e8453182b6607dd2).(value); |
| 4800 | } |
| 4801 | |
| 4802 | grn_gctxcxx . . $ grn_gctx..errbufcxx . . $ _grn_ctx#errbuf.[0] = '\0'; |
| 4803 | if (grn_initcxx . . $ grn_init(d5bb96df31a8101).()) { |
| 4804 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "failed to initialize Groonga: %s\n", grn_gctxcxx . . $ grn_gctx..errbufcxx . . $ _grn_ctx#errbuf.); |
| 4805 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4806 | } |
| 4807 | |
| 4808 | grn_set_default_encodingcxx . . $ grn_set_default_encoding(6f15d216cbf01f96).(encodingcxx . . $ encoding.); |
| 4809 | |
| 4810 | if (default_command_version_arg) { |
| 4811 | grn_set_default_command_versioncxx . . $ grn_set_default_command_version(c2afa1c5fb9f0f17).(default_command_version); |
| 4812 | } |
| 4813 | |
| 4814 | if (default_match_escalation_threshold_arg) { |
| 4815 | grn_set_default_match_escalation_thresholdcxx . . $ grn_set_default_match_escalation_threshold(e8b6f446c557829d).( |
| 4816 | default_match_escalation_threshold); |
| 4817 | } |
| 4818 | |
| 4819 | if (default_request_timeout_arg) { |
| 4820 | grn_set_default_request_timeoutcxx . . $ grn_set_default_request_timeout(ba8836b59fb42830).(default_request_timeout); |
| 4821 | } |
| 4822 | |
| 4823 | grn_set_segv_handlercxx . . $ grn_set_segv_handler(d5bb96df31a8101).(); |
| 4824 | grn_set_abrt_handlercxx . . $ grn_set_abrt_handler(d5bb96df31a8101).(); |
| 4825 | grn_set_int_handlercxx . . $ grn_set_int_handler(d5bb96df31a8101).(); |
| 4826 | grn_set_term_handlercxx . . $ grn_set_term_handler(d5bb96df31a8101).(); |
| 4827 | #ifdef ENABLE_LOG_REOPEN_BY_SIGNALcxx . . $ `src/groonga.c:61:11`! |
| 4828 | set_usr1_handlercxx . . $ set_usr1_handler(49f6e7a06ebc5aa8).(); |
| 4829 | #endif |
| 4830 | |
| 4831 | if (cache_limit_arg) { |
| 4832 | grn_cachecxx . . $ grn_cache# *cache; |
| 4833 | cache = grn_cache_current_getcxx . . $ grn_cache_current_get(ef516a6d4bcbf29d).(&grn_gctxcxx . . $ grn_gctx.); |
| 4834 | grn_cache_set_max_n_entriescxx . . $ grn_cache_set_max_n_entries(5e00bd443a95fa3d).(&grn_gctxcxx . . $ grn_gctx., cache, cache_limit); |
| 4835 | } |
| 4836 | |
| 4837 | CRITICAL_SECTION_INITcxx . . $ `lib/grn.h:226:11`!(q_critical_section); |
| 4838 | COND_INITcxx . . $ `lib/grn.h:232:11`!(q_cond); |
| 4839 | |
| 4840 | if (input_pathcxx . . $ input_path.) { |
| 4841 | input_readercxx . . $ input_reader. = grn_file_reader_opencxx . . $ grn_file_reader_open(d6cc0d8869c2b747).(&grn_gctxcxx . . $ grn_gctx., input_pathcxx . . $ input_path.); |
| 4842 | if (!input_readercxx . . $ input_reader.) { |
| 4843 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4844 | "can't open input file: <%s>: %s\n", |
| 4845 | input_pathcxx . . $ input_path., |
| 4846 | grn_gctxcxx . . $ grn_gctx..errbufcxx . . $ _grn_ctx#errbuf.); |
| 4847 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4848 | } |
| 4849 | batchmodecxx . . $ batchmode. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 4850 | } else { |
| 4851 | if (input_fd_arg) { |
| 4852 | const char *const end = input_fd_arg + strlencxx . . $ strlen(751346f8406fd082).(input_fd_arg); |
| 4853 | const char *rest = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 4854 | const int input_fd = grn_atoicxx . . $ grn_atoi(adf3ff2c2b114929).(input_fd_arg, end, &rest); |
| 4855 | if (rest != end || input_fd == 0) { |
| 4856 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "invalid input FD: <%s>\n", input_fd_arg); |
| 4857 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4858 | } |
| 4859 | if (dup2cxx . . $ dup2(9b79fb6aee4c0440).(input_fd, STDIN_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:210:9`!) == -1) { |
| 4860 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, |
| 4861 | "can't open input FD: %d (%s)\n", |
| 4862 | input_fd, |
| 4863 | strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 4864 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4865 | } |
| 4866 | input_readercxx . . $ input_reader. = grn_file_reader_opencxx . . $ grn_file_reader_open(d6cc0d8869c2b747).(&grn_gctxcxx . . $ grn_gctx., "-"); |
| 4867 | if (!input_readercxx . . $ input_reader.) { |
| 4868 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s", grn_gctxcxx . . $ grn_gctx..errbufcxx . . $ _grn_ctx#errbuf.); |
| 4869 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4870 | } |
| 4871 | batchmodecxx . . $ batchmode. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 4872 | } else { |
| 4873 | input_readercxx . . $ input_reader. = grn_file_reader_opencxx . . $ grn_file_reader_open(d6cc0d8869c2b747).(&grn_gctxcxx . . $ grn_gctx., "-"); |
| 4874 | if (!input_readercxx . . $ input_reader.) { |
| 4875 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:159:9`!, "%s", grn_gctxcxx . . $ grn_gctx..errbufcxx . . $ _grn_ctx#errbuf.); |
| 4876 | return EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:96:9`!; |
| 4877 | } |
| 4878 | if (argc - i > 1) { |
| 4879 | batchmodecxx . . $ batchmode. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 4880 | } else { |
| 4881 | batchmodecxx . . $ batchmode. = !grn_isattycxx . . $ `include/groonga/portability.h:191:11`!(0); |
| 4882 | } |
| 4883 | } |
| 4884 | } |
| 4885 | |
| 4886 | if ((flags & (FLAG_MODE_ALONEcxx . . $ `src/groonga.c:3682:9`! | FLAG_MODE_CLIENTcxx . . $ `src/groonga.c:3683:9`!)) && !batchmodecxx . . $ batchmode.) { |
| 4887 | need_line_editor = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 4888 | } |
| 4889 | |
| 4890 | #ifdef GRN_WITH_LIBEDITcxx . . $ `build/config.h:103:9`! |
| 4891 | if (need_line_editor) { |
| 4892 | line_editor_initcxx . . $ line_editor_init(c759356ac01a31e7).(argc, argv); |
| 4893 | } |
| 4894 | #endif |
| 4895 | |
| 4896 | newdbcxx . . $ newdb. = (flags & FLAG_NEW_DBcxx . . $ `src/groonga.c:3686:9`!); |
| 4897 | is_daemon_modecxx . . $ is_daemon_mode. = (flags & FLAG_MODE_DAEMONcxx . . $ `src/groonga.c:3684:9`!); |
| 4898 | if (flags & FLAG_MODE_CLIENTcxx . . $ `src/groonga.c:3683:9`!) { |
| 4899 | exit_code = do_clientcxx . . $ do_client.(argc - i, argv + i); |
| 4900 | } else if (is_daemon_modecxx . . $ is_daemon_mode. || (flags & FLAG_MODE_SERVERcxx . . $ `src/groonga.c:3685:9`!)) { |
| 4901 | exit_code = do_servercxx . . $ do_server.(argc > i ? argv[i] : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 4902 | } else { |
| 4903 | exit_code = do_alonecxx . . $ do_alone(afcd3168fc1188a4).(argc - i, argv + i); |
| 4904 | } |
| 4905 | |
| 4906 | COND_FINcxx . . $ `lib/grn.h:236:11`!(q_cond); |
| 4907 | CRITICAL_SECTION_FINcxx . . $ `lib/grn.h:229:11`!(q_critical_section); |
| 4908 | |
| 4909 | if (input_readercxx . . $ input_reader.) { |
| 4910 | grn_file_reader_closecxx . . $ grn_file_reader_close(43c8c29f514ba60e).(&grn_gctxcxx . . $ grn_gctx., input_readercxx . . $ input_reader.); |
| 4911 | } |
| 4912 | #ifdef GRN_WITH_LIBEDITcxx . . $ `build/config.h:103:9`! |
| 4913 | if (need_line_editor) { |
| 4914 | line_editor_fincxx . . $ line_editor_fin(49f6e7a06ebc5aa8).(); |
| 4915 | } |
| 4916 | #endif |
| 4917 | if (outputcxx . . $ output. != stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!) { |
| 4918 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(outputcxx . . $ output.); |
| 4919 | } |
| 4920 | grn_fincxx . . $ grn_fin(d5bb96df31a8101).(); |
| 4921 | return exit_code; |
| 4922 | } |