You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
3.5 KiB

  1. /*
  2. Copyright (c) 2002 Novell, Inc. All Rights Reserved.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  14. */
  15. #ifndef _MY_MANAGE
  16. #define _MY_MANAGE
  17. /******************************************************************************
  18. includes
  19. ******************************************************************************/
  20. #include <stdlib.h>
  21. #ifndef __WIN__
  22. #include <unistd.h>
  23. #endif
  24. #ifndef __NETWARE__
  25. #include <string.h>
  26. #include <my_global.h>
  27. #include <m_string.h>
  28. #ifndef __WIN__
  29. #define strnicmp strncasecmp
  30. #define strlwr(STRARG) (STRARG)
  31. #else
  32. int my_vsnprintf_(char *to, size_t n, const char* value, ...);
  33. #endif
  34. #endif
  35. /******************************************************************************
  36. macros
  37. ******************************************************************************/
  38. #define ARG_BUF 10
  39. #define TRY_MAX 5
  40. #ifdef __WIN__
  41. #define PATH_MAX _MAX_PATH
  42. #define NAME_MAX _MAX_FNAME
  43. #define kill(A,B) TerminateProcess((HANDLE)A,0)
  44. #define NOT_NEED_PID 0
  45. #define MASTER_PID 1
  46. #define SLAVE_PID 2
  47. #define mysqld_timeout 60000
  48. int pid_mode;
  49. bool run_server;
  50. bool skip_first_param;
  51. #define snprintf _snprintf
  52. #define vsnprintf _vsnprintf
  53. #endif
  54. /******************************************************************************
  55. structures
  56. ******************************************************************************/
  57. typedef struct
  58. {
  59. int argc;
  60. char **argv;
  61. size_t size;
  62. } arg_list_t;
  63. #ifdef __WIN__
  64. typedef int pid_t;
  65. #endif
  66. /******************************************************************************
  67. global variables
  68. ******************************************************************************/
  69. /******************************************************************************
  70. prototypes
  71. ******************************************************************************/
  72. void init_args(arg_list_t *);
  73. void add_arg(arg_list_t *, const char *, ...);
  74. void free_args(arg_list_t *);
  75. #ifndef __WIN__
  76. int sleep_until_file_exists(char *);
  77. int sleep_until_file_deleted(char *);
  78. #else
  79. int sleep_until_file_exists(HANDLE);
  80. int sleep_until_file_deleted(HANDLE);
  81. #endif
  82. int wait_for_server_start(char *, char *, char *, char *, int,char *);
  83. #ifndef __WIN__
  84. int spawn(char *, arg_list_t *, int, char *, char *, char *, char *);
  85. #else
  86. int spawn(char *, arg_list_t *, int , char *, char *, char *, HANDLE *);
  87. #endif
  88. #ifndef __WIN__
  89. int stop_server(char *, char *, char *, char *, int, char *,char *);
  90. pid_t get_server_pid(char *);
  91. void kill_server(pid_t pid);
  92. #else
  93. int stop_server(char *, char *, char *, char *, int, HANDLE,char *);
  94. #endif
  95. void del_tree(char *);
  96. int removef(const char *, ...);
  97. void get_basedir(char *, char *);
  98. void remove_empty_file(const char *file_name);
  99. bool create_system_files(const char *mdata,const char *output_file, bool test);
  100. #endif /* _MY_MANAGE */