[Groonga-commit] groonga/groonga at 6e20502 [master] windows groonga: support --pid-path

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Jul 2 15:33:15 JST 2015


Kouhei Sutou	2015-07-02 15:33:15 +0900 (Thu, 02 Jul 2015)

  New Revision: 6e205028721f4a91415cb4f9e7a534fc4397ce9e
  https://github.com/groonga/groonga/commit/6e205028721f4a91415cb4f9e7a534fc4397ce9e

  Message:
    windows groonga: support --pid-path

  Modified files:
    lib/grn.h
    src/groonga.c

  Modified: lib/grn.h (+2 -0)
===================================================================
--- lib/grn.h    2015-07-02 15:30:59 +0900 (1155d6d)
+++ lib/grn.h    2015-07-02 15:33:15 +0900 (711767d)
@@ -446,8 +446,10 @@ typedef int grn_cond;
 # define GRN_FMT_SSIZE "Id"
 # ifdef WIN64
 #  define GRN_FMT_SOCKET GRN_FMT_INT64U
+#  define GRN_FMT_DWORD  "lu"
 # else /* WIN64 */
 #  define GRN_FMT_SOCKET GRN_FMT_INT32U
+#  define GRN_FMT_DWORD  "u"
 # endif /* WIN64 */
 # define GRN_FMT_OFF64_T GRN_FMT_LLD
 #else /* WIN32 */

  Modified: src/groonga.c (+12 -8)
===================================================================
--- src/groonga.c    2015-07-02 15:30:59 +0900 (28c3186)
+++ src/groonga.c    2015-07-02 15:33:15 +0900 (bed3801)
@@ -512,29 +512,33 @@ send_ready_notify(void)
 static void
 create_pid_file(void)
 {
-#ifndef WIN32
   FILE *pid_file = NULL;
-  pid_t pid;
 
   if (!pid_file_path) {
     return;
   }
 
   pid_file = fopen(pid_file_path, "w");
-  pid = getpid();
-  fprintf(pid_file, "%d\n", pid);
+  {
+#ifdef WIN32
+    DWORD pid;
+    pid = GetCurrentProcessId();
+    fprintf(pid_file, "%" GRN_FMT_DWORD "\n", pid);
+#else /* WIN32 */
+    pid_t pid;
+    pid = getpid();
+    fprintf(pid_file, "%d\n", pid);
+#endif /* WIN32 */
+  }
   fclose(pid_file);
-#endif
 }
 
 static void
 clean_pid_file(void)
 {
-#ifndef WIN32
   if (pid_file_path) {
-    unlink(pid_file_path);
+    grn_unlink(pid_file_path);
   }
-#endif
 }
 
 static int
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index