~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/internal/my_sys.h

  • Committer: Andrew Hutchings
  • Date: 2011-03-29 20:45:43 UTC
  • mfrom: (2257 drizzle)
  • mto: (2257.1.3 build)
  • mto: This revision was merged to the branch mainline in revision 2258.
  • Revision ID: andrew@linuxjedi.co.uk-20110329204543-ssex0nuo8knncgwx
Merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#endif
30
30
 
31
31
#include <errno.h>
 
32
#include <sys/types.h>
32
33
 
 
34
#include <drizzled/definitions.h>
33
35
#include <drizzled/internal/my_pthread.h>
34
36
 
35
 
#include <drizzled/charset_info.h>                    /* for CHARSET_INFO */
 
37
#include <drizzled/charset_info.h>                    /* for charset_info_st */
36
38
#include <stdarg.h>
37
 
#include <drizzled/internal/aio_result.h>
38
 
 
39
 
#include <drizzled/memory/root.h>
40
 
#include <drizzled/error.h>
41
39
 
42
40
#ifndef errno                           /* did we already get it? */
43
41
#ifdef HAVE_ERRNO_AS_DEFINE
98
96
#define MY_COPYTIME     64      /* my_redel() copys time */
99
97
#define MY_DELETE_OLD   256     /* my_create_with_symlink() */
100
98
#define MY_HOLD_ORIGINAL_MODES 128  /* my_copy() holds to file modes */
101
 
#define MY_REDEL_MAKE_BACKUP 256
102
99
#define MY_DONT_WAIT    64      /* my_lock() don't wait if can't lock */
103
100
#define MY_DONT_OVERWRITE_FILE 1024     /* my_copy: Don't overwrite file */
104
101
#define MY_THREADSAFE 2048      /* my_seek(): lock fd mutex */
120
117
#define MY_RELATIVE_PATH        128     /* name is relative to 'dir' */
121
118
#define MY_APPEND_EXT           256     /* add 'ext' as additional extension*/
122
119
 
123
 
 
124
 
        /* Some constants */
125
 
#define MY_WAIT_FOR_USER_TO_FIX_PANIC   60      /* in seconds */
126
 
#define MY_WAIT_GIVE_USER_A_MESSAGE     10      /* Every 10 times of prev */
127
 
#define DFLT_INIT_HITS  3
128
 
 
129
 
        /* Internal error numbers (for assembler functions) */
130
 
#define MY_ERRNO_EDOM           33
131
 
#define MY_ERRNO_ERANGE         34
132
 
 
133
 
        /* Bits for get_date timeflag */
134
 
#define GETDATE_DATE_TIME       1
135
 
#define GETDATE_SHORT_DATE      2
136
 
#define GETDATE_HHMMSSTIME      4
137
 
#define GETDATE_GMT             8
138
 
#define GETDATE_FIXEDLENGTH     16
139
 
 
140
 
 
141
120
typedef uint64_t my_off_t;
142
121
 
143
 
#define TRASH(A,B) /* nothing */
144
 
 
145
122
extern char *home_dir;                  /* Home directory for user */
146
123
extern const char *my_progname;         /* program-name (printed in errors) */
147
 
extern uint32_t my_file_limit;
148
 
 
149
 
/* statistics */
150
 
extern uint     mysys_usage_id;
151
 
extern bool     my_init_done;
152
 
 
153
 
                                        /* Executed when comming from shell */
 
124
 
154
125
extern DRIZZLED_API int my_umask,               /* Default creation mask  */
155
126
           my_umask_dir,
156
127
           my_recived_signals,  /* Signals we have got */
157
128
           my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
158
129
           my_dont_interrupt;   /* call remember_intr when set */
159
 
extern bool mysys_uses_curses, my_use_symdir;
160
 
extern uint32_t sf_malloc_cur_memory, sf_malloc_max_memory;
 
130
extern bool my_use_symdir;
161
131
 
162
132
extern uint32_t my_default_record_cache_size;
163
133
extern bool my_disable_async_io,
164
134
               my_disable_flush_key_blocks, my_disable_symlinks;
165
135
extern char     wild_many, wild_one, wild_prefix;
166
136
extern const char *charsets_dir;
167
 
/* from default.c */
168
 
extern char *my_defaults_extra_file;
169
 
extern const char *my_defaults_group_suffix;
170
 
extern const char *my_defaults_file;
171
137
 
172
138
extern bool timed_mutexes;
173
139
 
174
 
typedef class wild_file_pack    /* Struct to hold info when selecting files */
175
 
{
176
 
public:
177
 
  uint          wilds;          /* How many wildcards */
178
 
  uint          not_pos;        /* Start of not-theese-files */
179
 
  char *        *wild;          /* Pointer to wildcards */
180
 
 
181
 
  wild_file_pack():
182
 
    wilds(0),
183
 
    not_pos(0),
184
 
    wild(NULL)
185
 
  {}
186
 
 
187
 
} WF_PACK;
188
 
 
189
140
enum cache_type
190
141
{
191
142
  TYPE_NOT_SET= 0,
204
155
  uint  rc_length,read_length,reclength;
205
156
  my_off_t rc_record_pos,end_of_file;
206
157
  unsigned char *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos;
207
 
#ifdef HAVE_AIOWAIT
208
 
  int   use_async_io;
209
 
  my_aio_result aio_result;
210
 
#endif
211
158
  enum cache_type type;
212
159
 
213
160
  record_cache():
260
207
#define my_b_bytes_in_cache(info) (size_t) (*(info)->current_end - \
261
208
                                          *(info)->current_pos)
262
209
 
263
 
typedef uint32_t ha_checksum;
264
 
 
265
 
/* Define the type of function to be passed to process_default_option_files */
266
 
typedef int (*Process_option_func)(void *ctx, const char *group_name,
267
 
                                   const char *option);
268
 
 
269
210
/* Prototypes for mysys and my_func functions */
270
211
 
271
212
extern int my_copy(const char *from,const char *to,myf MyFlags);
287
228
DRIZZLED_API int my_rename(const char *from, const char *to,myf MyFlags);
288
229
DRIZZLED_API size_t my_write(int Filedes, const unsigned char *Buffer,
289
230
                             size_t Count, myf MyFlags);
290
 
extern int _sanity(const char *sFile, uint32_t uLine);
291
231
 
292
 
extern int check_if_legal_filename(const char *path);
293
232
extern int check_if_legal_tablename(const char *path);
294
233
 
295
234
DRIZZLED_API int my_sync(int fd, myf my_flags);
299
238
extern void my_end(void);
300
239
extern int my_redel(const char *from, const char *to, int MyFlags);
301
240
extern int my_copystat(const char *from, const char *to, int MyFlags);
302
 
extern char * my_filename(int fd);
303
241
 
304
242
extern void my_remember_signal(int signal_number,void (*func)(int));
305
243
extern size_t dirname_part(char * to,const char *name, size_t *to_res_length);
312
250
extern char * fn_same(char * toname,const char *name,int flag);
313
251
DRIZZLED_API char * fn_format(char * to,const char *name,const char *dir,
314
252
                              const char *form, uint32_t flag);
315
 
extern size_t strlength(const char *str);
316
253
extern size_t unpack_dirname(char * to,const char *from);
317
254
extern size_t unpack_filename(char * to,const char *from);
318
255
extern char * intern_filename(char * to,const char *from);
321
258
                              const char *own_path_prefix);
322
259
extern int wild_compare(const char *str,const char *wildstr,
323
260
                        bool str_is_pattern);
324
 
extern WF_PACK *wf_comp(char * str);
325
 
extern int wf_test(wild_file_pack *wf_pack,const char *name);
326
 
extern void wf_end(wild_file_pack *buffer);
 
261
 
327
262
extern bool array_append_string_unique(const char *str,
328
263
                                          const char **array, size_t size);
329
 
extern void get_date(char * to,int timeflag,time_t use_time);
330
264
extern int init_record_cache(RECORD_CACHE *info,size_t cachesize,int file,
331
265
                             size_t reclength,enum cache_type type,
332
266
                             bool use_async_io);
351
285
DRIZZLED_API my_off_t my_get_ptr(unsigned char *ptr, size_t pack_length);
352
286
int create_temp_file(char *to, const char *dir, const char *pfx, myf MyFlags);
353
287
 
354
 
extern int get_defaults_options(int argc, char **argv,
355
 
                                char **defaults, char **extra_defaults,
356
 
                                char **group_suffix);
357
 
extern int load_defaults(const char *conf_file, const char **groups,
358
 
                         int *argc, char ***argv);
359
 
extern int my_search_option_files(const char *conf_file, int *argc,
360
 
                                  char ***argv, uint32_t *args_used,
361
 
                                  Process_option_func func, void *func_ctx);
362
 
extern void free_defaults(char **argv);
363
 
extern void my_print_default_files(const char *conf_file);
364
 
extern void print_defaults(const char *conf_file, const char **groups);
365
 
extern ha_checksum my_checksum(ha_checksum crc, const unsigned char *mem,
366
 
                               size_t count);
367
 
extern void my_sleep(uint32_t m_seconds);
368
 
 
369
 
 
370
 
 
371
 
extern void thd_increment_bytes_sent(uint32_t length);
372
 
extern void thd_increment_bytes_received(uint32_t length);
373
 
extern void thd_increment_net_big_packet_count(uint32_t length);
374
 
 
375
288
} /* namespace internal */
376
289
} /* namespace drizzled */
377
290