]> git.wh0rd.org Git - ICEs.git/blob - 318007/buf0buf.i.0
more ices
[ICEs.git] / 318007 / buf0buf.i.0
1 # 1 "buf/buf0buf.c"
2 # 1 "<built-in>"
3 # 1 "<command-line>"
4 # 1 "buf/buf0buf.c"
5 # 23 "buf/buf0buf.c"
6 # 1 "./include/buf0buf.h" 1
7 # 26 "./include/buf0buf.h"
8 # 1 "./include/univ.i" 1
9 # 33 "./include/univ.i"
10 # 1 "./../include/my_global.h" 1
11 # 83 "./../include/my_global.h"
12 # 1 "./../include/my_config.h" 1
13 # 84 "./../include/my_global.h" 2
14 # 241 "./../include/my_global.h"
15 # 1 "/usr/include/pthread.h" 1 3 4
16 # 23 "/usr/include/pthread.h" 3 4
17 # 1 "/usr/include/features.h" 1 3 4
18 # 347 "/usr/include/features.h" 3 4
19 # 1 "/usr/include/sys/cdefs.h" 1 3 4
20 # 353 "/usr/include/sys/cdefs.h" 3 4
21 # 1 "/usr/include/bits/wordsize.h" 1 3 4
22 # 354 "/usr/include/sys/cdefs.h" 2 3 4
23 # 348 "/usr/include/features.h" 2 3 4
24 # 371 "/usr/include/features.h" 3 4
25 # 1 "/usr/include/gnu/stubs.h" 1 3 4
26
27
28
29 # 1 "/usr/include/bits/wordsize.h" 1 3 4
30 # 5 "/usr/include/gnu/stubs.h" 2 3 4
31
32
33
34
35 # 1 "/usr/include/gnu/stubs-64.h" 1 3 4
36 # 10 "/usr/include/gnu/stubs.h" 2 3 4
37 # 372 "/usr/include/features.h" 2 3 4
38 # 24 "/usr/include/pthread.h" 2 3 4
39 # 1 "/usr/include/endian.h" 1 3 4
40 # 37 "/usr/include/endian.h" 3 4
41 # 1 "/usr/include/bits/endian.h" 1 3 4
42 # 38 "/usr/include/endian.h" 2 3 4
43 # 61 "/usr/include/endian.h" 3 4
44 # 1 "/usr/include/bits/byteswap.h" 1 3 4
45 # 62 "/usr/include/endian.h" 2 3 4
46 # 25 "/usr/include/pthread.h" 2 3 4
47 # 1 "/usr/include/sched.h" 1 3 4
48 # 26 "/usr/include/sched.h" 3 4
49 # 1 "/usr/include/bits/types.h" 1 3 4
50 # 28 "/usr/include/bits/types.h" 3 4
51 # 1 "/usr/include/bits/wordsize.h" 1 3 4
52 # 29 "/usr/include/bits/types.h" 2 3 4
53
54
55 typedef unsigned char __u_char;
56 typedef unsigned short int __u_short;
57 typedef unsigned int __u_int;
58 typedef unsigned long int __u_long;
59
60
61 typedef signed char __int8_t;
62 typedef unsigned char __uint8_t;
63 typedef signed short int __int16_t;
64 typedef unsigned short int __uint16_t;
65 typedef signed int __int32_t;
66 typedef unsigned int __uint32_t;
67
68 typedef signed long int __int64_t;
69 typedef unsigned long int __uint64_t;
70
71
72
73
74
75
76
77 typedef long int __quad_t;
78 typedef unsigned long int __u_quad_t;
79 # 131 "/usr/include/bits/types.h" 3 4
80 # 1 "/usr/include/bits/typesizes.h" 1 3 4
81 # 132 "/usr/include/bits/types.h" 2 3 4
82
83
84 typedef unsigned long int __dev_t;
85 typedef unsigned int __uid_t;
86 typedef unsigned int __gid_t;
87 typedef unsigned long int __ino_t;
88 typedef unsigned long int __ino64_t;
89 typedef unsigned int __mode_t;
90 typedef unsigned long int __nlink_t;
91 typedef long int __off_t;
92 typedef long int __off64_t;
93 typedef int __pid_t;
94 typedef struct { int __val[2]; } __fsid_t;
95 typedef long int __clock_t;
96 typedef unsigned long int __rlim_t;
97 typedef unsigned long int __rlim64_t;
98 typedef unsigned int __id_t;
99 typedef long int __time_t;
100 typedef unsigned int __useconds_t;
101 typedef long int __suseconds_t;
102
103 typedef int __daddr_t;
104 typedef long int __swblk_t;
105 typedef int __key_t;
106
107
108 typedef int __clockid_t;
109
110
111 typedef void * __timer_t;
112
113
114 typedef long int __blksize_t;
115
116
117
118
119 typedef long int __blkcnt_t;
120 typedef long int __blkcnt64_t;
121
122
123 typedef unsigned long int __fsblkcnt_t;
124 typedef unsigned long int __fsblkcnt64_t;
125
126
127 typedef unsigned long int __fsfilcnt_t;
128 typedef unsigned long int __fsfilcnt64_t;
129
130 typedef long int __ssize_t;
131
132
133
134 typedef __off64_t __loff_t;
135 typedef __quad_t *__qaddr_t;
136 typedef char *__caddr_t;
137
138
139 typedef long int __intptr_t;
140
141
142 typedef unsigned int __socklen_t;
143 # 27 "/usr/include/sched.h" 2 3 4
144
145
146 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 1 3 4
147 # 214 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 3 4
148 typedef long unsigned int size_t;
149 # 30 "/usr/include/sched.h" 2 3 4
150
151
152 # 1 "/usr/include/time.h" 1 3 4
153 # 120 "/usr/include/time.h" 3 4
154 struct timespec
155   {
156     __time_t tv_sec;
157     long int tv_nsec;
158   };
159 # 33 "/usr/include/sched.h" 2 3 4
160
161
162 # 1 "/usr/include/bits/sched.h" 1 3 4
163 # 71 "/usr/include/bits/sched.h" 3 4
164 struct sched_param
165   {
166     int __sched_priority;
167   };
168
169
170
171
172
173 extern int clone (int (*__fn) (void *__arg), void *__child_stack,
174     int __flags, void *__arg, ...) __attribute__ ((__nothrow__));
175
176
177 extern int unshare (int __flags) __attribute__ ((__nothrow__));
178
179
180 extern int sched_getcpu (void) __attribute__ ((__nothrow__));
181
182
183
184
185
186
187
188
189
190
191 struct __sched_param
192   {
193     int __sched_priority;
194   };
195 # 113 "/usr/include/bits/sched.h" 3 4
196 typedef unsigned long int __cpu_mask;
197
198
199
200
201
202
203 typedef struct
204 {
205   __cpu_mask __bits[1024 / (8 * sizeof (__cpu_mask))];
206 } cpu_set_t;
207 # 196 "/usr/include/bits/sched.h" 3 4
208
209
210 extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp)
211   __attribute__ ((__nothrow__));
212 extern cpu_set_t *__sched_cpualloc (size_t __count) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
213 extern void __sched_cpufree (cpu_set_t *__set) __attribute__ ((__nothrow__));
214
215
216 # 36 "/usr/include/sched.h" 2 3 4
217
218
219
220
221
222
223
224 extern int sched_setparam (__pid_t __pid, __const struct sched_param *__param)
225      __attribute__ ((__nothrow__));
226
227
228 extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __attribute__ ((__nothrow__));
229
230
231 extern int sched_setscheduler (__pid_t __pid, int __policy,
232           __const struct sched_param *__param) __attribute__ ((__nothrow__));
233
234
235 extern int sched_getscheduler (__pid_t __pid) __attribute__ ((__nothrow__));
236
237
238 extern int sched_yield (void) __attribute__ ((__nothrow__));
239
240
241 extern int sched_get_priority_max (int __algorithm) __attribute__ ((__nothrow__));
242
243
244 extern int sched_get_priority_min (int __algorithm) __attribute__ ((__nothrow__));
245
246
247 extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __attribute__ ((__nothrow__));
248 # 110 "/usr/include/sched.h" 3 4
249 extern int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
250          __const cpu_set_t *__cpuset) __attribute__ ((__nothrow__));
251
252
253 extern int sched_getaffinity (__pid_t __pid, size_t __cpusetsize,
254          cpu_set_t *__cpuset) __attribute__ ((__nothrow__));
255
256
257
258 # 26 "/usr/include/pthread.h" 2 3 4
259 # 1 "/usr/include/time.h" 1 3 4
260 # 30 "/usr/include/time.h" 3 4
261
262
263
264
265
266
267
268
269 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 1 3 4
270 # 39 "/usr/include/time.h" 2 3 4
271
272
273
274 # 1 "/usr/include/bits/time.h" 1 3 4
275 # 43 "/usr/include/time.h" 2 3 4
276 # 58 "/usr/include/time.h" 3 4
277
278
279 typedef __clock_t clock_t;
280
281
282
283 # 74 "/usr/include/time.h" 3 4
284
285
286 typedef __time_t time_t;
287
288
289
290 # 92 "/usr/include/time.h" 3 4
291 typedef __clockid_t clockid_t;
292 # 104 "/usr/include/time.h" 3 4
293 typedef __timer_t timer_t;
294 # 131 "/usr/include/time.h" 3 4
295
296
297 struct tm
298 {
299   int tm_sec;
300   int tm_min;
301   int tm_hour;
302   int tm_mday;
303   int tm_mon;
304   int tm_year;
305   int tm_wday;
306   int tm_yday;
307   int tm_isdst;
308
309
310   long int tm_gmtoff;
311   __const char *tm_zone;
312
313
314
315
316 };
317
318
319
320
321
322
323
324
325 struct itimerspec
326   {
327     struct timespec it_interval;
328     struct timespec it_value;
329   };
330
331
332 struct sigevent;
333
334
335
336
337
338 typedef __pid_t pid_t;
339
340
341
342
343
344
345
346
347 extern clock_t clock (void) __attribute__ ((__nothrow__));
348
349
350 extern time_t time (time_t *__timer) __attribute__ ((__nothrow__));
351
352
353 extern double difftime (time_t __time1, time_t __time0)
354      __attribute__ ((__nothrow__)) __attribute__ ((__const__));
355
356
357 extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__));
358
359
360
361
362
363 extern size_t strftime (char *__restrict __s, size_t __maxsize,
364    __const char *__restrict __format,
365    __const struct tm *__restrict __tp) __attribute__ ((__nothrow__));
366
367
368
369
370
371 extern char *strptime (__const char *__restrict __s,
372          __const char *__restrict __fmt, struct tm *__tp)
373      __attribute__ ((__nothrow__));
374
375
376
377
378
379 # 1 "/usr/include/xlocale.h" 1 3 4
380 # 28 "/usr/include/xlocale.h" 3 4
381 typedef struct __locale_struct
382 {
383
384   struct locale_data *__locales[13];
385
386
387   const unsigned short int *__ctype_b;
388   const int *__ctype_tolower;
389   const int *__ctype_toupper;
390
391
392   const char *__names[13];
393 } *__locale_t;
394
395
396 typedef __locale_t locale_t;
397 # 216 "/usr/include/time.h" 2 3 4
398
399 extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
400      __const char *__restrict __format,
401      __const struct tm *__restrict __tp,
402      __locale_t __loc) __attribute__ ((__nothrow__));
403
404
405
406 extern char *strptime_l (__const char *__restrict __s,
407     __const char *__restrict __fmt, struct tm *__tp,
408     __locale_t __loc) __attribute__ ((__nothrow__));
409
410
411
412
413
414
415 extern struct tm *gmtime (__const time_t *__timer) __attribute__ ((__nothrow__));
416
417
418
419 extern struct tm *localtime (__const time_t *__timer) __attribute__ ((__nothrow__));
420
421
422
423
424
425 extern struct tm *gmtime_r (__const time_t *__restrict __timer,
426        struct tm *__restrict __tp) __attribute__ ((__nothrow__));
427
428
429
430 extern struct tm *localtime_r (__const time_t *__restrict __timer,
431           struct tm *__restrict __tp) __attribute__ ((__nothrow__));
432
433
434
435
436
437 extern char *asctime (__const struct tm *__tp) __attribute__ ((__nothrow__));
438
439
440 extern char *ctime (__const time_t *__timer) __attribute__ ((__nothrow__));
441
442
443
444
445
446
447
448 extern char *asctime_r (__const struct tm *__restrict __tp,
449    char *__restrict __buf) __attribute__ ((__nothrow__));
450
451
452 extern char *ctime_r (__const time_t *__restrict __timer,
453         char *__restrict __buf) __attribute__ ((__nothrow__));
454
455
456
457
458 extern char *__tzname[2];
459 extern int __daylight;
460 extern long int __timezone;
461
462
463
464
465 extern char *tzname[2];
466
467
468
469 extern void tzset (void) __attribute__ ((__nothrow__));
470
471
472
473 extern int daylight;
474 extern long int timezone;
475
476
477
478
479
480 extern int stime (__const time_t *__when) __attribute__ ((__nothrow__));
481 # 313 "/usr/include/time.h" 3 4
482 extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__));
483
484
485 extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__));
486
487
488 extern int dysize (int __year) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
489 # 328 "/usr/include/time.h" 3 4
490 extern int nanosleep (__const struct timespec *__requested_time,
491         struct timespec *__remaining);
492
493
494
495 extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__));
496
497
498 extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__));
499
500
501 extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp)
502      __attribute__ ((__nothrow__));
503
504
505
506
507
508
509 extern int clock_nanosleep (clockid_t __clock_id, int __flags,
510        __const struct timespec *__req,
511        struct timespec *__rem);
512
513
514 extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__));
515
516
517
518
519 extern int timer_create (clockid_t __clock_id,
520     struct sigevent *__restrict __evp,
521     timer_t *__restrict __timerid) __attribute__ ((__nothrow__));
522
523
524 extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__));
525
526
527 extern int timer_settime (timer_t __timerid, int __flags,
528      __const struct itimerspec *__restrict __value,
529      struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__));
530
531
532 extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
533      __attribute__ ((__nothrow__));
534
535
536 extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__));
537 # 390 "/usr/include/time.h" 3 4
538 extern int getdate_err;
539 # 399 "/usr/include/time.h" 3 4
540 extern struct tm *getdate (__const char *__string);
541 # 413 "/usr/include/time.h" 3 4
542 extern int getdate_r (__const char *__restrict __string,
543         struct tm *__restrict __resbufp);
544
545
546
547 # 27 "/usr/include/pthread.h" 2 3 4
548
549
550 # 1 "/usr/include/signal.h" 1 3 4
551 # 31 "/usr/include/signal.h" 3 4
552
553
554 # 1 "/usr/include/bits/sigset.h" 1 3 4
555 # 24 "/usr/include/bits/sigset.h" 3 4
556 typedef int __sig_atomic_t;
557
558
559
560
561 typedef struct
562   {
563     unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
564   } __sigset_t;
565 # 34 "/usr/include/signal.h" 2 3 4
566 # 50 "/usr/include/signal.h" 3 4
567 typedef __sigset_t sigset_t;
568 # 408 "/usr/include/signal.h" 3 4
569
570 # 30 "/usr/include/pthread.h" 2 3 4
571 # 1 "/usr/include/bits/pthreadtypes.h" 1 3 4
572 # 24 "/usr/include/bits/pthreadtypes.h" 3 4
573 # 1 "/usr/include/bits/wordsize.h" 1 3 4
574 # 25 "/usr/include/bits/pthreadtypes.h" 2 3 4
575 # 51 "/usr/include/bits/pthreadtypes.h" 3 4
576 typedef unsigned long int pthread_t;
577
578
579 typedef union
580 {
581   char __size[56];
582   long int __align;
583 } pthread_attr_t;
584
585
586
587 typedef struct __pthread_internal_list
588 {
589   struct __pthread_internal_list *__prev;
590   struct __pthread_internal_list *__next;
591 } __pthread_list_t;
592 # 77 "/usr/include/bits/pthreadtypes.h" 3 4
593 typedef union
594 {
595   struct __pthread_mutex_s
596   {
597     int __lock;
598     unsigned int __count;
599     int __owner;
600
601     unsigned int __nusers;
602
603
604
605     int __kind;
606
607     int __spins;
608     __pthread_list_t __list;
609 # 102 "/usr/include/bits/pthreadtypes.h" 3 4
610   } __data;
611   char __size[40];
612   long int __align;
613 } pthread_mutex_t;
614
615 typedef union
616 {
617   char __size[4];
618   int __align;
619 } pthread_mutexattr_t;
620
621
622
623
624 typedef union
625 {
626   struct
627   {
628     int __lock;
629     unsigned int __futex;
630     __extension__ unsigned long long int __total_seq;
631     __extension__ unsigned long long int __wakeup_seq;
632     __extension__ unsigned long long int __woken_seq;
633     void *__mutex;
634     unsigned int __nwaiters;
635     unsigned int __broadcast_seq;
636   } __data;
637   char __size[48];
638   __extension__ long long int __align;
639 } pthread_cond_t;
640
641 typedef union
642 {
643   char __size[4];
644   int __align;
645 } pthread_condattr_t;
646
647
648
649 typedef unsigned int pthread_key_t;
650
651
652
653 typedef int pthread_once_t;
654
655
656
657
658
659 typedef union
660 {
661
662   struct
663   {
664     int __lock;
665     unsigned int __nr_readers;
666     unsigned int __readers_wakeup;
667     unsigned int __writer_wakeup;
668     unsigned int __nr_readers_queued;
669     unsigned int __nr_writers_queued;
670     int __writer;
671     int __shared;
672     unsigned long int __pad1;
673     unsigned long int __pad2;
674
675
676     unsigned int __flags;
677   } __data;
678 # 188 "/usr/include/bits/pthreadtypes.h" 3 4
679   char __size[56];
680   long int __align;
681 } pthread_rwlock_t;
682
683 typedef union
684 {
685   char __size[8];
686   long int __align;
687 } pthread_rwlockattr_t;
688
689
690
691
692
693 typedef volatile int pthread_spinlock_t;
694
695
696
697
698 typedef union
699 {
700   char __size[32];
701   long int __align;
702 } pthread_barrier_t;
703
704 typedef union
705 {
706   char __size[4];
707   int __align;
708 } pthread_barrierattr_t;
709 # 31 "/usr/include/pthread.h" 2 3 4
710 # 1 "/usr/include/bits/setjmp.h" 1 3 4
711 # 33 "/usr/include/bits/setjmp.h" 3 4
712 # 1 "/usr/include/bits/wordsize.h" 1 3 4
713 # 34 "/usr/include/bits/setjmp.h" 2 3 4
714 # 44 "/usr/include/bits/setjmp.h" 3 4
715 typedef long int __jmp_buf[64] __attribute__ ((__aligned__ (16)));
716 # 32 "/usr/include/pthread.h" 2 3 4
717 # 1 "/usr/include/bits/wordsize.h" 1 3 4
718 # 33 "/usr/include/pthread.h" 2 3 4
719
720
721
722 enum
723 {
724   PTHREAD_CREATE_JOINABLE,
725
726   PTHREAD_CREATE_DETACHED
727
728 };
729
730
731
732 enum
733 {
734   PTHREAD_MUTEX_TIMED_NP,
735   PTHREAD_MUTEX_RECURSIVE_NP,
736   PTHREAD_MUTEX_ERRORCHECK_NP,
737   PTHREAD_MUTEX_ADAPTIVE_NP
738
739   ,
740   PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
741   PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
742   PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
743   PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
744
745
746
747   , PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_TIMED_NP
748
749 };
750
751
752
753
754 enum
755 {
756   PTHREAD_MUTEX_STALLED,
757   PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED,
758   PTHREAD_MUTEX_ROBUST,
759   PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST
760 };
761
762
763
764
765
766 enum
767 {
768   PTHREAD_PRIO_NONE,
769   PTHREAD_PRIO_INHERIT,
770   PTHREAD_PRIO_PROTECT
771 };
772 # 117 "/usr/include/pthread.h" 3 4
773 enum
774 {
775   PTHREAD_RWLOCK_PREFER_READER_NP,
776   PTHREAD_RWLOCK_PREFER_WRITER_NP,
777   PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
778   PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP
779 };
780 # 149 "/usr/include/pthread.h" 3 4
781 enum
782 {
783   PTHREAD_INHERIT_SCHED,
784
785   PTHREAD_EXPLICIT_SCHED
786
787 };
788
789
790
791 enum
792 {
793   PTHREAD_SCOPE_SYSTEM,
794
795   PTHREAD_SCOPE_PROCESS
796
797 };
798
799
800
801 enum
802 {
803   PTHREAD_PROCESS_PRIVATE,
804
805   PTHREAD_PROCESS_SHARED
806
807 };
808 # 184 "/usr/include/pthread.h" 3 4
809 struct _pthread_cleanup_buffer
810 {
811   void (*__routine) (void *);
812   void *__arg;
813   int __canceltype;
814   struct _pthread_cleanup_buffer *__prev;
815 };
816
817
818 enum
819 {
820   PTHREAD_CANCEL_ENABLE,
821
822   PTHREAD_CANCEL_DISABLE
823
824 };
825 enum
826 {
827   PTHREAD_CANCEL_DEFERRED,
828
829   PTHREAD_CANCEL_ASYNCHRONOUS
830
831 };
832 # 222 "/usr/include/pthread.h" 3 4
833
834
835
836
837
838 extern int pthread_create (pthread_t *__restrict __newthread,
839       __const pthread_attr_t *__restrict __attr,
840       void *(*__start_routine) (void *),
841       void *__restrict __arg) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3)));
842
843
844
845
846
847 extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__));
848
849
850
851
852
853
854
855 extern int pthread_join (pthread_t __th, void **__thread_return);
856
857
858
859
860 extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __attribute__ ((__nothrow__));
861
862
863
864
865
866
867
868 extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return,
869      __const struct timespec *__abstime);
870
871
872
873
874
875
876 extern int pthread_detach (pthread_t __th) __attribute__ ((__nothrow__));
877
878
879
880 extern pthread_t pthread_self (void) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
881
882
883 extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __attribute__ ((__nothrow__));
884
885
886
887
888
889
890
891 extern int pthread_attr_init (pthread_attr_t *__attr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
892
893
894 extern int pthread_attr_destroy (pthread_attr_t *__attr)
895      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
896
897
898 extern int pthread_attr_getdetachstate (__const pthread_attr_t *__attr,
899      int *__detachstate)
900      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
901
902
903 extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
904      int __detachstate)
905      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
906
907
908
909 extern int pthread_attr_getguardsize (__const pthread_attr_t *__attr,
910           size_t *__guardsize)
911      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
912
913
914 extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
915           size_t __guardsize)
916      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
917
918
919
920 extern int pthread_attr_getschedparam (__const pthread_attr_t *__restrict
921            __attr,
922            struct sched_param *__restrict __param)
923      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
924
925
926 extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
927            __const struct sched_param *__restrict
928            __param) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
929
930
931 extern int pthread_attr_getschedpolicy (__const pthread_attr_t *__restrict
932      __attr, int *__restrict __policy)
933      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
934
935
936 extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy)
937      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
938
939
940 extern int pthread_attr_getinheritsched (__const pthread_attr_t *__restrict
941       __attr, int *__restrict __inherit)
942      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
943
944
945 extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
946       int __inherit)
947      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
948
949
950
951 extern int pthread_attr_getscope (__const pthread_attr_t *__restrict __attr,
952       int *__restrict __scope)
953      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
954
955
956 extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope)
957      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
958
959
960 extern int pthread_attr_getstackaddr (__const pthread_attr_t *__restrict
961           __attr, void **__restrict __stackaddr)
962      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__deprecated__));
963
964
965
966
967
968 extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
969           void *__stackaddr)
970      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__));
971
972
973 extern int pthread_attr_getstacksize (__const pthread_attr_t *__restrict
974           __attr, size_t *__restrict __stacksize)
975      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
976
977
978
979
980 extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
981           size_t __stacksize)
982      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
983
984
985
986 extern int pthread_attr_getstack (__const pthread_attr_t *__restrict __attr,
987       void **__restrict __stackaddr,
988       size_t *__restrict __stacksize)
989      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2, 3)));
990
991
992
993
994 extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
995       size_t __stacksize) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
996
997
998
999
1000
1001 extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr,
1002      size_t __cpusetsize,
1003      __const cpu_set_t *__cpuset)
1004      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3)));
1005
1006
1007
1008 extern int pthread_attr_getaffinity_np (__const pthread_attr_t *__attr,
1009      size_t __cpusetsize,
1010      cpu_set_t *__cpuset)
1011      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3)));
1012
1013
1014
1015
1016
1017 extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr)
1018      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
1019
1020
1021
1022
1023
1024
1025
1026 extern int pthread_setschedparam (pthread_t __target_thread, int __policy,
1027       __const struct sched_param *__param)
1028      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3)));
1029
1030
1031 extern int pthread_getschedparam (pthread_t __target_thread,
1032       int *__restrict __policy,
1033       struct sched_param *__restrict __param)
1034      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
1035
1036
1037 extern int pthread_setschedprio (pthread_t __target_thread, int __prio)
1038      __attribute__ ((__nothrow__));
1039
1040
1041
1042
1043 extern int pthread_getconcurrency (void) __attribute__ ((__nothrow__));
1044
1045
1046 extern int pthread_setconcurrency (int __level) __attribute__ ((__nothrow__));
1047
1048
1049
1050
1051
1052
1053
1054 extern int pthread_yield (void) __attribute__ ((__nothrow__));
1055
1056
1057
1058
1059 extern int pthread_setaffinity_np (pthread_t __th, size_t __cpusetsize,
1060        __const cpu_set_t *__cpuset)
1061      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3)));
1062
1063
1064 extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize,
1065        cpu_set_t *__cpuset)
1066      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3)));
1067 # 468 "/usr/include/pthread.h" 3 4
1068 extern int pthread_once (pthread_once_t *__once_control,
1069     void (*__init_routine) (void)) __attribute__ ((__nonnull__ (1, 2)));
1070 # 480 "/usr/include/pthread.h" 3 4
1071 extern int pthread_setcancelstate (int __state, int *__oldstate);
1072
1073
1074
1075 extern int pthread_setcanceltype (int __type, int *__oldtype);
1076
1077
1078 extern int pthread_cancel (pthread_t __th);
1079
1080
1081
1082
1083 extern void pthread_testcancel (void);
1084
1085
1086
1087
1088 typedef struct
1089 {
1090   struct
1091   {
1092     __jmp_buf __cancel_jmp_buf;
1093     int __mask_was_saved;
1094   } __cancel_jmp_buf[1];
1095   void *__pad[4];
1096 } __pthread_unwind_buf_t __attribute__ ((__aligned__));
1097 # 514 "/usr/include/pthread.h" 3 4
1098 struct __pthread_cleanup_frame
1099 {
1100   void (*__cancel_routine) (void *);
1101   void *__cancel_arg;
1102   int __do_it;
1103   int __cancel_type;
1104 };
1105 # 654 "/usr/include/pthread.h" 3 4
1106 extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf)
1107      ;
1108 # 666 "/usr/include/pthread.h" 3 4
1109 extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
1110   ;
1111 # 689 "/usr/include/pthread.h" 3 4
1112 extern void __pthread_register_cancel_defer (__pthread_unwind_buf_t *__buf)
1113      ;
1114 # 702 "/usr/include/pthread.h" 3 4
1115 extern void __pthread_unregister_cancel_restore (__pthread_unwind_buf_t *__buf)
1116   ;
1117
1118
1119
1120 extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
1121      __attribute__ ((__noreturn__))
1122
1123      __attribute__ ((__weak__))
1124
1125      ;
1126
1127
1128
1129 struct __jmp_buf_tag;
1130 extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __attribute__ ((__nothrow__));
1131
1132
1133
1134
1135
1136 extern int pthread_mutex_init (pthread_mutex_t *__mutex,
1137           __const pthread_mutexattr_t *__mutexattr)
1138      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1139
1140
1141 extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
1142      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1143
1144
1145 extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
1146      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1147
1148
1149 extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
1150      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1151
1152
1153
1154 extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
1155                                     __const struct timespec *__restrict
1156                                     __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1157
1158
1159
1160 extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
1161      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1162
1163
1164
1165
1166 extern int pthread_mutex_getprioceiling (__const pthread_mutex_t *
1167       __restrict __mutex,
1168       int *__restrict __prioceiling)
1169      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1170
1171
1172
1173 extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
1174       int __prioceiling,
1175       int *__restrict __old_ceiling)
1176      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3)));
1177
1178
1179
1180
1181
1182 extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex)
1183      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1184
1185 extern int pthread_mutex_consistent_np (pthread_mutex_t *__mutex)
1186      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1187 # 782 "/usr/include/pthread.h" 3 4
1188 extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr)
1189      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1190
1191
1192 extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr)
1193      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1194
1195
1196 extern int pthread_mutexattr_getpshared (__const pthread_mutexattr_t *
1197       __restrict __attr,
1198       int *__restrict __pshared)
1199      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1200
1201
1202 extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
1203       int __pshared)
1204      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1205
1206
1207
1208 extern int pthread_mutexattr_gettype (__const pthread_mutexattr_t *__restrict
1209           __attr, int *__restrict __kind)
1210      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1211
1212
1213
1214
1215 extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
1216      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1217
1218
1219 extern int pthread_mutexattr_getprotocol (__const pthread_mutexattr_t *
1220        __restrict __attr,
1221        int *__restrict __protocol)
1222      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1223
1224
1225
1226 extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr,
1227        int __protocol)
1228      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1229
1230
1231 extern int pthread_mutexattr_getprioceiling (__const pthread_mutexattr_t *
1232           __restrict __attr,
1233           int *__restrict __prioceiling)
1234      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1235
1236
1237 extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr,
1238           int __prioceiling)
1239      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1240
1241
1242
1243
1244 extern int pthread_mutexattr_getrobust (__const pthread_mutexattr_t *__attr,
1245      int *__robustness)
1246      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1247
1248 extern int pthread_mutexattr_getrobust_np (__const pthread_mutexattr_t *__attr,
1249         int *__robustness)
1250      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1251
1252
1253
1254 extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
1255      int __robustness)
1256      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1257
1258 extern int pthread_mutexattr_setrobust_np (pthread_mutexattr_t *__attr,
1259         int __robustness)
1260      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1261 # 864 "/usr/include/pthread.h" 3 4
1262 extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
1263     __const pthread_rwlockattr_t *__restrict
1264     __attr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1265
1266
1267 extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
1268      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1269
1270
1271 extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
1272      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1273
1274
1275 extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
1276   __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1277
1278
1279
1280 extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
1281            __const struct timespec *__restrict
1282            __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1283
1284
1285
1286 extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
1287      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1288
1289
1290 extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
1291      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1292
1293
1294
1295 extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
1296            __const struct timespec *__restrict
1297            __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1298
1299
1300
1301 extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
1302      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1303
1304
1305
1306
1307
1308 extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
1309      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1310
1311
1312 extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr)
1313      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1314
1315
1316 extern int pthread_rwlockattr_getpshared (__const pthread_rwlockattr_t *
1317        __restrict __attr,
1318        int *__restrict __pshared)
1319      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1320
1321
1322 extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
1323        int __pshared)
1324      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1325
1326
1327 extern int pthread_rwlockattr_getkind_np (__const pthread_rwlockattr_t *
1328        __restrict __attr,
1329        int *__restrict __pref)
1330      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1331
1332
1333 extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
1334        int __pref) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1335
1336
1337
1338
1339
1340
1341
1342 extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
1343          __const pthread_condattr_t *__restrict
1344          __cond_attr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1345
1346
1347 extern int pthread_cond_destroy (pthread_cond_t *__cond)
1348      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1349
1350
1351 extern int pthread_cond_signal (pthread_cond_t *__cond)
1352      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1353
1354
1355 extern int pthread_cond_broadcast (pthread_cond_t *__cond)
1356      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1357
1358
1359
1360
1361
1362
1363 extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
1364          pthread_mutex_t *__restrict __mutex)
1365      __attribute__ ((__nonnull__ (1, 2)));
1366 # 976 "/usr/include/pthread.h" 3 4
1367 extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
1368        pthread_mutex_t *__restrict __mutex,
1369        __const struct timespec *__restrict
1370        __abstime) __attribute__ ((__nonnull__ (1, 2, 3)));
1371
1372
1373
1374
1375 extern int pthread_condattr_init (pthread_condattr_t *__attr)
1376      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1377
1378
1379 extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
1380      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1381
1382
1383 extern int pthread_condattr_getpshared (__const pthread_condattr_t *
1384                                         __restrict __attr,
1385                                         int *__restrict __pshared)
1386      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1387
1388
1389 extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
1390                                         int __pshared) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1391
1392
1393
1394 extern int pthread_condattr_getclock (__const pthread_condattr_t *
1395           __restrict __attr,
1396           __clockid_t *__restrict __clock_id)
1397      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1398
1399
1400 extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
1401           __clockid_t __clock_id)
1402      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1403 # 1020 "/usr/include/pthread.h" 3 4
1404 extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
1405      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1406
1407
1408 extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
1409      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1410
1411
1412 extern int pthread_spin_lock (pthread_spinlock_t *__lock)
1413      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1414
1415
1416 extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
1417      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1418
1419
1420 extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
1421      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1422
1423
1424
1425
1426
1427
1428 extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
1429      __const pthread_barrierattr_t *__restrict
1430      __attr, unsigned int __count)
1431      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1432
1433
1434 extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
1435      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1436
1437
1438 extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
1439      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1440
1441
1442
1443 extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
1444      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1445
1446
1447 extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
1448      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1449
1450
1451 extern int pthread_barrierattr_getpshared (__const pthread_barrierattr_t *
1452         __restrict __attr,
1453         int *__restrict __pshared)
1454      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1455
1456
1457 extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
1458                                            int __pshared)
1459      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1460 # 1087 "/usr/include/pthread.h" 3 4
1461 extern int pthread_key_create (pthread_key_t *__key,
1462           void (*__destr_function) (void *))
1463      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1464
1465
1466 extern int pthread_key_delete (pthread_key_t __key) __attribute__ ((__nothrow__));
1467
1468
1469 extern void *pthread_getspecific (pthread_key_t __key) __attribute__ ((__nothrow__));
1470
1471
1472 extern int pthread_setspecific (pthread_key_t __key,
1473     __const void *__pointer) __attribute__ ((__nothrow__)) ;
1474
1475
1476
1477
1478 extern int pthread_getcpuclockid (pthread_t __thread_id,
1479       __clockid_t *__clock_id)
1480      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
1481 # 1121 "/usr/include/pthread.h" 3 4
1482 extern int pthread_atfork (void (*__prepare) (void),
1483       void (*__parent) (void),
1484       void (*__child) (void)) __attribute__ ((__nothrow__));
1485
1486
1487
1488
1489 extern __inline int
1490 __attribute__ ((__nothrow__)) pthread_equal (pthread_t __thread1, pthread_t __thread2)
1491 {
1492   return __thread1 == __thread2;
1493 }
1494
1495
1496
1497 # 242 "./../include/my_global.h" 2
1498 # 311 "./../include/my_global.h"
1499 # 1 "/usr/include/stdio.h" 1 3 4
1500 # 30 "/usr/include/stdio.h" 3 4
1501
1502
1503
1504
1505 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 1 3 4
1506 # 35 "/usr/include/stdio.h" 2 3 4
1507 # 45 "/usr/include/stdio.h" 3 4
1508 struct _IO_FILE;
1509
1510
1511
1512 typedef struct _IO_FILE FILE;
1513
1514
1515
1516
1517
1518 # 65 "/usr/include/stdio.h" 3 4
1519 typedef struct _IO_FILE __FILE;
1520 # 75 "/usr/include/stdio.h" 3 4
1521 # 1 "/usr/include/libio.h" 1 3 4
1522 # 32 "/usr/include/libio.h" 3 4
1523 # 1 "/usr/include/_G_config.h" 1 3 4
1524 # 15 "/usr/include/_G_config.h" 3 4
1525 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 1 3 4
1526 # 16 "/usr/include/_G_config.h" 2 3 4
1527
1528
1529
1530
1531 # 1 "/usr/include/wchar.h" 1 3 4
1532 # 83 "/usr/include/wchar.h" 3 4
1533 typedef struct
1534 {
1535   int __count;
1536   union
1537   {
1538
1539     unsigned int __wch;
1540
1541
1542
1543     char __wchb[4];
1544   } __value;
1545 } __mbstate_t;
1546 # 21 "/usr/include/_G_config.h" 2 3 4
1547
1548 typedef struct
1549 {
1550   __off_t __pos;
1551   __mbstate_t __state;
1552 } _G_fpos_t;
1553 typedef struct
1554 {
1555   __off64_t __pos;
1556   __mbstate_t __state;
1557 } _G_fpos64_t;
1558 # 53 "/usr/include/_G_config.h" 3 4
1559 typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
1560 typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
1561 typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
1562 typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
1563 # 33 "/usr/include/libio.h" 2 3 4
1564 # 53 "/usr/include/libio.h" 3 4
1565 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stdarg.h" 1 3 4
1566 # 43 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stdarg.h" 3 4
1567 typedef __builtin_va_list __gnuc_va_list;
1568 # 54 "/usr/include/libio.h" 2 3 4
1569 # 170 "/usr/include/libio.h" 3 4
1570 struct _IO_jump_t; struct _IO_FILE;
1571 # 180 "/usr/include/libio.h" 3 4
1572 typedef void _IO_lock_t;
1573
1574
1575
1576
1577
1578 struct _IO_marker {
1579   struct _IO_marker *_next;
1580   struct _IO_FILE *_sbuf;
1581
1582
1583
1584   int _pos;
1585 # 203 "/usr/include/libio.h" 3 4
1586 };
1587
1588
1589 enum __codecvt_result
1590 {
1591   __codecvt_ok,
1592   __codecvt_partial,
1593   __codecvt_error,
1594   __codecvt_noconv
1595 };
1596 # 271 "/usr/include/libio.h" 3 4
1597 struct _IO_FILE {
1598   int _flags;
1599
1600
1601
1602
1603   char* _IO_read_ptr;
1604   char* _IO_read_end;
1605   char* _IO_read_base;
1606   char* _IO_write_base;
1607   char* _IO_write_ptr;
1608   char* _IO_write_end;
1609   char* _IO_buf_base;
1610   char* _IO_buf_end;
1611
1612   char *_IO_save_base;
1613   char *_IO_backup_base;
1614   char *_IO_save_end;
1615
1616   struct _IO_marker *_markers;
1617
1618   struct _IO_FILE *_chain;
1619
1620   int _fileno;
1621
1622
1623
1624   int _flags2;
1625
1626   __off_t _old_offset;
1627
1628
1629
1630   unsigned short _cur_column;
1631   signed char _vtable_offset;
1632   char _shortbuf[1];
1633
1634
1635
1636   _IO_lock_t *_lock;
1637 # 319 "/usr/include/libio.h" 3 4
1638   __off64_t _offset;
1639 # 328 "/usr/include/libio.h" 3 4
1640   void *__pad1;
1641   void *__pad2;
1642   void *__pad3;
1643   void *__pad4;
1644   size_t __pad5;
1645
1646   int _mode;
1647
1648   char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
1649
1650 };
1651
1652
1653 typedef struct _IO_FILE _IO_FILE;
1654
1655
1656 struct _IO_FILE_plus;
1657
1658 extern struct _IO_FILE_plus _IO_2_1_stdin_;
1659 extern struct _IO_FILE_plus _IO_2_1_stdout_;
1660 extern struct _IO_FILE_plus _IO_2_1_stderr_;
1661 # 364 "/usr/include/libio.h" 3 4
1662 typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
1663
1664
1665
1666
1667
1668
1669
1670 typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
1671      size_t __n);
1672
1673
1674
1675
1676
1677
1678
1679 typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
1680
1681
1682 typedef int __io_close_fn (void *__cookie);
1683
1684
1685
1686
1687 typedef __io_read_fn cookie_read_function_t;
1688 typedef __io_write_fn cookie_write_function_t;
1689 typedef __io_seek_fn cookie_seek_function_t;
1690 typedef __io_close_fn cookie_close_function_t;
1691
1692
1693 typedef struct
1694 {
1695   __io_read_fn *read;
1696   __io_write_fn *write;
1697   __io_seek_fn *seek;
1698   __io_close_fn *close;
1699 } _IO_cookie_io_functions_t;
1700 typedef _IO_cookie_io_functions_t cookie_io_functions_t;
1701
1702 struct _IO_cookie_file;
1703
1704
1705 extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
1706         void *__cookie, _IO_cookie_io_functions_t __fns);
1707
1708
1709
1710
1711
1712
1713
1714 extern int __underflow (_IO_FILE *);
1715 extern int __uflow (_IO_FILE *);
1716 extern int __overflow (_IO_FILE *, int);
1717 # 458 "/usr/include/libio.h" 3 4
1718 extern int _IO_getc (_IO_FILE *__fp);
1719 extern int _IO_putc (int __c, _IO_FILE *__fp);
1720 extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__));
1721 extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__));
1722
1723 extern int _IO_peekc_locked (_IO_FILE *__fp);
1724
1725
1726
1727
1728
1729 extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__));
1730 extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__));
1731 extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__));
1732 # 488 "/usr/include/libio.h" 3 4
1733 extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
1734    __gnuc_va_list, int *__restrict);
1735 extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
1736     __gnuc_va_list);
1737 extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
1738 extern size_t _IO_sgetn (_IO_FILE *, void *, size_t);
1739
1740 extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int);
1741 extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int);
1742
1743 extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__));
1744 # 76 "/usr/include/stdio.h" 2 3 4
1745
1746
1747
1748
1749 typedef __gnuc_va_list va_list;
1750 # 89 "/usr/include/stdio.h" 3 4
1751
1752
1753 typedef _G_fpos_t fpos_t;
1754
1755
1756
1757
1758
1759 typedef _G_fpos64_t fpos64_t;
1760 # 141 "/usr/include/stdio.h" 3 4
1761 # 1 "/usr/include/bits/stdio_lim.h" 1 3 4
1762 # 142 "/usr/include/stdio.h" 2 3 4
1763
1764
1765
1766 extern struct _IO_FILE *stdin;
1767 extern struct _IO_FILE *stdout;
1768 extern struct _IO_FILE *stderr;
1769
1770
1771
1772
1773
1774
1775
1776 extern int remove (__const char *__filename) __attribute__ ((__nothrow__));
1777
1778 extern int rename (__const char *__old, __const char *__new) __attribute__ ((__nothrow__));
1779
1780
1781
1782
1783 extern int renameat (int __oldfd, __const char *__old, int __newfd,
1784        __const char *__new) __attribute__ ((__nothrow__));
1785
1786
1787
1788
1789
1790
1791
1792
1793 extern FILE *tmpfile (void) __attribute__ ((__warn_unused_result__));
1794 # 182 "/usr/include/stdio.h" 3 4
1795 extern FILE *tmpfile64 (void) __attribute__ ((__warn_unused_result__));
1796
1797
1798
1799 extern char *tmpnam (char *__s) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
1800
1801
1802
1803
1804
1805 extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
1806 # 204 "/usr/include/stdio.h" 3 4
1807 extern char *tempnam (__const char *__dir, __const char *__pfx)
1808      __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) __attribute__ ((__warn_unused_result__));
1809
1810
1811
1812
1813
1814
1815
1816
1817 extern int fclose (FILE *__stream);
1818
1819
1820
1821
1822 extern int fflush (FILE *__stream);
1823
1824 # 229 "/usr/include/stdio.h" 3 4
1825 extern int fflush_unlocked (FILE *__stream);
1826 # 239 "/usr/include/stdio.h" 3 4
1827 extern int fcloseall (void);
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837 extern FILE *fopen (__const char *__restrict __filename,
1838       __const char *__restrict __modes) __attribute__ ((__warn_unused_result__));
1839
1840
1841
1842
1843 extern FILE *freopen (__const char *__restrict __filename,
1844         __const char *__restrict __modes,
1845         FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
1846 # 272 "/usr/include/stdio.h" 3 4
1847
1848
1849 extern FILE *fopen64 (__const char *__restrict __filename,
1850         __const char *__restrict __modes) __attribute__ ((__warn_unused_result__));
1851 extern FILE *freopen64 (__const char *__restrict __filename,
1852    __const char *__restrict __modes,
1853    FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
1854
1855
1856
1857
1858 extern FILE *fdopen (int __fd, __const char *__modes) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
1859
1860
1861
1862
1863
1864 extern FILE *fopencookie (void *__restrict __magic_cookie,
1865      __const char *__restrict __modes,
1866      _IO_cookie_io_functions_t __io_funcs) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
1867
1868
1869
1870
1871 extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes)
1872   __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
1873
1874
1875
1876
1877 extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
1878
1879
1880
1881
1882
1883
1884 extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__));
1885
1886
1887
1888 extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
1889       int __modes, size_t __n) __attribute__ ((__nothrow__));
1890
1891
1892
1893
1894
1895 extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
1896          size_t __size) __attribute__ ((__nothrow__));
1897
1898
1899 extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__));
1900
1901
1902
1903
1904
1905
1906
1907
1908 extern int fprintf (FILE *__restrict __stream,
1909       __const char *__restrict __format, ...);
1910
1911
1912
1913
1914 extern int printf (__const char *__restrict __format, ...);
1915
1916 extern int sprintf (char *__restrict __s,
1917       __const char *__restrict __format, ...) __attribute__ ((__nothrow__));
1918
1919
1920
1921
1922
1923 extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
1924        __gnuc_va_list __arg);
1925
1926
1927
1928
1929 extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
1930
1931 extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
1932        __gnuc_va_list __arg) __attribute__ ((__nothrow__));
1933
1934
1935
1936
1937
1938 extern int snprintf (char *__restrict __s, size_t __maxlen,
1939        __const char *__restrict __format, ...)
1940      __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4)));
1941
1942 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
1943         __const char *__restrict __format, __gnuc_va_list __arg)
1944      __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0)));
1945
1946
1947
1948
1949
1950
1951 extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
1952         __gnuc_va_list __arg)
1953      __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 0))) __attribute__ ((__warn_unused_result__));
1954 extern int __asprintf (char **__restrict __ptr,
1955          __const char *__restrict __fmt, ...)
1956      __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 3))) __attribute__ ((__warn_unused_result__));
1957 extern int asprintf (char **__restrict __ptr,
1958        __const char *__restrict __fmt, ...)
1959      __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 3))) __attribute__ ((__warn_unused_result__));
1960 # 394 "/usr/include/stdio.h" 3 4
1961 extern int vdprintf (int __fd, __const char *__restrict __fmt,
1962        __gnuc_va_list __arg)
1963      __attribute__ ((__format__ (__printf__, 2, 0)));
1964 extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
1965      __attribute__ ((__format__ (__printf__, 2, 3)));
1966
1967
1968
1969
1970
1971
1972
1973
1974 extern int fscanf (FILE *__restrict __stream,
1975      __const char *__restrict __format, ...) __attribute__ ((__warn_unused_result__));
1976
1977
1978
1979
1980 extern int scanf (__const char *__restrict __format, ...) __attribute__ ((__warn_unused_result__));
1981
1982 extern int sscanf (__const char *__restrict __s,
1983      __const char *__restrict __format, ...) __attribute__ ((__nothrow__));
1984 # 445 "/usr/include/stdio.h" 3 4
1985
1986
1987
1988
1989
1990
1991
1992
1993 extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
1994       __gnuc_va_list __arg)
1995      __attribute__ ((__format__ (__scanf__, 2, 0))) __attribute__ ((__warn_unused_result__));
1996
1997
1998
1999
2000
2001 extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg)
2002      __attribute__ ((__format__ (__scanf__, 1, 0))) __attribute__ ((__warn_unused_result__));
2003
2004
2005 extern int vsscanf (__const char *__restrict __s,
2006       __const char *__restrict __format, __gnuc_va_list __arg)
2007      __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__scanf__, 2, 0)));
2008 # 504 "/usr/include/stdio.h" 3 4
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018 extern int fgetc (FILE *__stream);
2019 extern int getc (FILE *__stream);
2020
2021
2022
2023
2024
2025 extern int getchar (void);
2026
2027 # 532 "/usr/include/stdio.h" 3 4
2028 extern int getc_unlocked (FILE *__stream);
2029 extern int getchar_unlocked (void);
2030 # 543 "/usr/include/stdio.h" 3 4
2031 extern int fgetc_unlocked (FILE *__stream);
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043 extern int fputc (int __c, FILE *__stream);
2044 extern int putc (int __c, FILE *__stream);
2045
2046
2047
2048
2049
2050 extern int putchar (int __c);
2051
2052 # 576 "/usr/include/stdio.h" 3 4
2053 extern int fputc_unlocked (int __c, FILE *__stream);
2054
2055
2056
2057
2058
2059
2060
2061 extern int putc_unlocked (int __c, FILE *__stream);
2062 extern int putchar_unlocked (int __c);
2063
2064
2065
2066
2067
2068
2069 extern int getw (FILE *__stream);
2070
2071
2072 extern int putw (int __w, FILE *__stream);
2073
2074
2075
2076
2077
2078
2079
2080
2081 extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
2082      __attribute__ ((__warn_unused_result__));
2083
2084
2085
2086
2087
2088
2089 extern char *gets (char *__s) __attribute__ ((__warn_unused_result__));
2090
2091 # 622 "/usr/include/stdio.h" 3 4
2092 extern char *fgets_unlocked (char *__restrict __s, int __n,
2093         FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
2094 # 638 "/usr/include/stdio.h" 3 4
2095 extern __ssize_t __getdelim (char **__restrict __lineptr,
2096           size_t *__restrict __n, int __delimiter,
2097           FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
2098 extern __ssize_t getdelim (char **__restrict __lineptr,
2099         size_t *__restrict __n, int __delimiter,
2100         FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
2101
2102
2103
2104
2105
2106
2107
2108 extern __ssize_t getline (char **__restrict __lineptr,
2109        size_t *__restrict __n,
2110        FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
2111
2112
2113
2114
2115
2116
2117
2118
2119 extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
2120
2121
2122
2123
2124
2125 extern int puts (__const char *__s);
2126
2127
2128
2129
2130
2131
2132 extern int ungetc (int __c, FILE *__stream);
2133
2134
2135
2136
2137
2138
2139 extern size_t fread (void *__restrict __ptr, size_t __size,
2140        size_t __n, FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
2141
2142
2143
2144
2145 extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
2146         size_t __n, FILE *__restrict __s) __attribute__ ((__warn_unused_result__));
2147
2148 # 699 "/usr/include/stdio.h" 3 4
2149 extern int fputs_unlocked (__const char *__restrict __s,
2150       FILE *__restrict __stream);
2151 # 710 "/usr/include/stdio.h" 3 4
2152 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
2153          size_t __n, FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
2154 extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
2155           size_t __n, FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
2156
2157
2158
2159
2160
2161
2162
2163
2164 extern int fseek (FILE *__stream, long int __off, int __whence);
2165
2166
2167
2168
2169 extern long int ftell (FILE *__stream) __attribute__ ((__warn_unused_result__));
2170
2171
2172
2173
2174 extern void rewind (FILE *__stream);
2175
2176 # 746 "/usr/include/stdio.h" 3 4
2177 extern int fseeko (FILE *__stream, __off_t __off, int __whence);
2178
2179
2180
2181
2182 extern __off_t ftello (FILE *__stream) __attribute__ ((__warn_unused_result__));
2183 # 765 "/usr/include/stdio.h" 3 4
2184
2185
2186
2187
2188
2189
2190 extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
2191
2192
2193
2194
2195 extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
2196 # 788 "/usr/include/stdio.h" 3 4
2197
2198
2199
2200 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
2201 extern __off64_t ftello64 (FILE *__stream) __attribute__ ((__warn_unused_result__));
2202 extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
2203 extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos);
2204
2205
2206
2207
2208 extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__));
2209
2210 extern int feof (FILE *__stream) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
2211
2212 extern int ferror (FILE *__stream) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
2213
2214
2215
2216
2217 extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__));
2218 extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
2219 extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
2220
2221
2222
2223
2224
2225
2226
2227
2228 extern void perror (__const char *__s);
2229
2230
2231
2232
2233
2234
2235 # 1 "/usr/include/bits/sys_errlist.h" 1 3 4
2236 # 27 "/usr/include/bits/sys_errlist.h" 3 4
2237 extern int sys_nerr;
2238 extern __const char *__const sys_errlist[];
2239
2240
2241 extern int _sys_nerr;
2242 extern __const char *__const _sys_errlist[];
2243 # 827 "/usr/include/stdio.h" 2 3 4
2244
2245
2246
2247
2248 extern int fileno (FILE *__stream) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
2249
2250
2251
2252
2253 extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
2254 # 846 "/usr/include/stdio.h" 3 4
2255 extern FILE *popen (__const char *__command, __const char *__modes) __attribute__ ((__warn_unused_result__));
2256
2257
2258
2259
2260
2261 extern int pclose (FILE *__stream);
2262
2263
2264
2265
2266
2267 extern char *ctermid (char *__s) __attribute__ ((__nothrow__));
2268
2269
2270
2271
2272
2273 extern char *cuserid (char *__s);
2274
2275
2276
2277
2278 struct obstack;
2279
2280
2281 extern int obstack_printf (struct obstack *__restrict __obstack,
2282       __const char *__restrict __format, ...)
2283      __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 3)));
2284 extern int obstack_vprintf (struct obstack *__restrict __obstack,
2285        __const char *__restrict __format,
2286        __gnuc_va_list __args)
2287      __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 0)));
2288
2289
2290
2291
2292
2293
2294
2295 extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__));
2296
2297
2298
2299 extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
2300
2301
2302 extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__));
2303 # 907 "/usr/include/stdio.h" 3 4
2304 # 1 "/usr/include/bits/stdio.h" 1 3 4
2305 # 44 "/usr/include/bits/stdio.h" 3 4
2306 extern __inline int
2307 getchar (void)
2308 {
2309   return _IO_getc (stdin);
2310 }
2311
2312
2313
2314
2315 extern __inline int
2316 fgetc_unlocked (FILE *__fp)
2317 {
2318   return (__builtin_expect (((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end), 0) ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++);
2319 }
2320
2321
2322
2323
2324
2325 extern __inline int
2326 getc_unlocked (FILE *__fp)
2327 {
2328   return (__builtin_expect (((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end), 0) ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++);
2329 }
2330
2331
2332 extern __inline int
2333 getchar_unlocked (void)
2334 {
2335   return (__builtin_expect (((stdin)->_IO_read_ptr >= (stdin)->_IO_read_end), 0) ? __uflow (stdin) : *(unsigned char *) (stdin)->_IO_read_ptr++);
2336 }
2337
2338
2339
2340
2341 extern __inline int
2342 putchar (int __c)
2343 {
2344   return _IO_putc (__c, stdout);
2345 }
2346
2347
2348
2349
2350 extern __inline int
2351 fputc_unlocked (int __c, FILE *__stream)
2352 {
2353   return (__builtin_expect (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end), 0) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
2354 }
2355
2356
2357
2358
2359
2360 extern __inline int
2361 putc_unlocked (int __c, FILE *__stream)
2362 {
2363   return (__builtin_expect (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end), 0) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
2364 }
2365
2366
2367 extern __inline int
2368 putchar_unlocked (int __c)
2369 {
2370   return (__builtin_expect (((stdout)->_IO_write_ptr >= (stdout)->_IO_write_end), 0) ? __overflow (stdout, (unsigned char) (__c)) : (unsigned char) (*(stdout)->_IO_write_ptr++ = (__c)));
2371 }
2372
2373
2374
2375
2376
2377 extern __inline __ssize_t
2378 getline (char **__lineptr, size_t *__n, FILE *__stream)
2379 {
2380   return __getdelim (__lineptr, __n, '\n', __stream);
2381 }
2382
2383
2384
2385
2386
2387 extern __inline int
2388 __attribute__ ((__nothrow__)) feof_unlocked (FILE *__stream)
2389 {
2390   return (((__stream)->_flags & 0x10) != 0);
2391 }
2392
2393
2394 extern __inline int
2395 __attribute__ ((__nothrow__)) ferror_unlocked (FILE *__stream)
2396 {
2397   return (((__stream)->_flags & 0x20) != 0);
2398 }
2399 # 908 "/usr/include/stdio.h" 2 3 4
2400
2401
2402 # 1 "/usr/include/bits/stdio2.h" 1 3 4
2403 # 24 "/usr/include/bits/stdio2.h" 3 4
2404 extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
2405      __const char *__restrict __format, ...) __attribute__ ((__nothrow__));
2406 extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
2407       __const char *__restrict __format,
2408       __gnuc_va_list __ap) __attribute__ ((__nothrow__));
2409
2410
2411 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2412 __attribute__ ((__nothrow__)) sprintf (char *__restrict __s, __const char *__restrict __fmt, ...)
2413 {
2414   return __builtin___sprintf_chk (__s, 2 - 1,
2415       __builtin_object_size (__s, 2 > 1), __fmt, __builtin_va_arg_pack ());
2416 }
2417
2418
2419
2420
2421
2422
2423 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2424 __attribute__ ((__nothrow__)) vsprintf (char *__restrict __s, __const char *__restrict __fmt, __gnuc_va_list __ap)
2425
2426 {
2427   return __builtin___vsprintf_chk (__s, 2 - 1,
2428        __builtin_object_size (__s, 2 > 1), __fmt, __ap);
2429 }
2430
2431
2432
2433 extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
2434       size_t __slen, __const char *__restrict __format,
2435       ...) __attribute__ ((__nothrow__));
2436 extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
2437        size_t __slen, __const char *__restrict __format,
2438        __gnuc_va_list __ap) __attribute__ ((__nothrow__));
2439
2440
2441 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2442 __attribute__ ((__nothrow__)) snprintf (char *__restrict __s, size_t __n, __const char *__restrict __fmt, ...)
2443
2444 {
2445   return __builtin___snprintf_chk (__s, __n, 2 - 1,
2446        __builtin_object_size (__s, 2 > 1), __fmt, __builtin_va_arg_pack ());
2447 }
2448
2449
2450
2451
2452
2453
2454 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2455 __attribute__ ((__nothrow__)) vsnprintf (char *__restrict __s, size_t __n, __const char *__restrict __fmt, __gnuc_va_list __ap)
2456
2457 {
2458   return __builtin___vsnprintf_chk (__s, __n, 2 - 1,
2459         __builtin_object_size (__s, 2 > 1), __fmt, __ap);
2460 }
2461
2462
2463
2464
2465
2466 extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
2467      __const char *__restrict __format, ...);
2468 extern int __printf_chk (int __flag, __const char *__restrict __format, ...);
2469 extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
2470       __const char *__restrict __format, __gnuc_va_list __ap);
2471 extern int __vprintf_chk (int __flag, __const char *__restrict __format,
2472      __gnuc_va_list __ap);
2473
2474
2475 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2476 fprintf (FILE *__restrict __stream, __const char *__restrict __fmt, ...)
2477 {
2478   return __fprintf_chk (__stream, 2 - 1, __fmt,
2479    __builtin_va_arg_pack ());
2480 }
2481
2482 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2483 printf (__const char *__restrict __fmt, ...)
2484 {
2485   return __printf_chk (2 - 1, __fmt, __builtin_va_arg_pack ());
2486 }
2487
2488
2489
2490
2491
2492
2493
2494 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2495 vprintf (__const char *__restrict __fmt, __gnuc_va_list __ap)
2496 {
2497
2498   return __vfprintf_chk (stdout, 2 - 1, __fmt, __ap);
2499
2500
2501
2502 }
2503
2504 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2505 vfprintf (FILE *__restrict __stream,
2506    __const char *__restrict __fmt, __gnuc_va_list __ap)
2507 {
2508   return __vfprintf_chk (__stream, 2 - 1, __fmt, __ap);
2509 }
2510
2511
2512
2513 extern int __asprintf_chk (char **__restrict __ptr, int __flag,
2514       __const char *__restrict __fmt, ...)
2515      __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4))) __attribute__ ((__warn_unused_result__));
2516 extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
2517        __const char *__restrict __fmt, __gnuc_va_list __arg)
2518      __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0))) __attribute__ ((__warn_unused_result__));
2519 extern int __dprintf_chk (int __fd, int __flag, __const char *__restrict __fmt,
2520      ...) __attribute__ ((__format__ (__printf__, 3, 4)));
2521 extern int __vdprintf_chk (int __fd, int __flag,
2522       __const char *__restrict __fmt, __gnuc_va_list __arg)
2523      __attribute__ ((__format__ (__printf__, 3, 0)));
2524 extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
2525      int __flag, __const char *__restrict __format,
2526      ...)
2527      __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4)));
2528 extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
2529       int __flag,
2530       __const char *__restrict __format,
2531       __gnuc_va_list __args)
2532      __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0)));
2533
2534
2535 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2536 __attribute__ ((__nothrow__)) asprintf (char **__restrict __ptr, __const char *__restrict __fmt, ...)
2537 {
2538   return __asprintf_chk (__ptr, 2 - 1, __fmt,
2539     __builtin_va_arg_pack ());
2540 }
2541
2542 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2543 __attribute__ ((__nothrow__)) __asprintf (char **__restrict __ptr, __const char *__restrict __fmt, ...)
2544
2545 {
2546   return __asprintf_chk (__ptr, 2 - 1, __fmt,
2547     __builtin_va_arg_pack ());
2548 }
2549
2550 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2551 dprintf (int __fd, __const char *__restrict __fmt, ...)
2552 {
2553   return __dprintf_chk (__fd, 2 - 1, __fmt,
2554    __builtin_va_arg_pack ());
2555 }
2556
2557 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2558 __attribute__ ((__nothrow__)) obstack_printf (struct obstack *__restrict __obstack, __const char *__restrict __fmt, ...)
2559
2560 {
2561   return __obstack_printf_chk (__obstack, 2 - 1, __fmt,
2562           __builtin_va_arg_pack ());
2563 }
2564 # 195 "/usr/include/bits/stdio2.h" 3 4
2565 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2566 __attribute__ ((__nothrow__)) vasprintf (char **__restrict __ptr, __const char *__restrict __fmt, __gnuc_va_list __ap)
2567
2568 {
2569   return __vasprintf_chk (__ptr, 2 - 1, __fmt, __ap);
2570 }
2571
2572 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2573 vdprintf (int __fd, __const char *__restrict __fmt, __gnuc_va_list __ap)
2574 {
2575   return __vdprintf_chk (__fd, 2 - 1, __fmt, __ap);
2576 }
2577
2578 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
2579 __attribute__ ((__nothrow__)) obstack_vprintf (struct obstack *__restrict __obstack, __const char *__restrict __fmt, __gnuc_va_list __ap)
2580
2581 {
2582   return __obstack_vprintf_chk (__obstack, 2 - 1, __fmt,
2583     __ap);
2584 }
2585
2586
2587
2588
2589
2590 extern char *__gets_chk (char *__str, size_t) __attribute__ ((__warn_unused_result__));
2591 extern char *__gets_warn (char *__str) __asm__ ("" "gets")
2592      __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("please use fgets or getline instead, gets can't " "specify buffer size")));
2593
2594
2595 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) char *
2596 gets (char *__str)
2597 {
2598   if (__builtin_object_size (__str, 2 > 1) != (size_t) -1)
2599     return __gets_chk (__str, __builtin_object_size (__str, 2 > 1));
2600   return __gets_warn (__str);
2601 }
2602
2603 extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n,
2604      FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
2605 extern char *__fgets_alias (char *__restrict __s, int __n, FILE *__restrict __stream) __asm__ ("" "fgets") __attribute__ ((__warn_unused_result__));
2606
2607
2608 extern char *__fgets_chk_warn (char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream) __asm__ ("" "__fgets_chk")
2609
2610
2611      __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("fgets called with bigger size than length " "of destination buffer")));
2612
2613
2614 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) char *
2615 fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
2616 {
2617   if (__builtin_object_size (__s, 2 > 1) != (size_t) -1)
2618     {
2619       if (!__builtin_constant_p (__n) || __n <= 0)
2620  return __fgets_chk (__s, __builtin_object_size (__s, 2 > 1), __n, __stream);
2621
2622       if ((size_t) __n > __builtin_object_size (__s, 2 > 1))
2623  return __fgets_chk_warn (__s, __builtin_object_size (__s, 2 > 1), __n, __stream);
2624     }
2625   return __fgets_alias (__s, __n, __stream);
2626 }
2627
2628 extern size_t __fread_chk (void *__restrict __ptr, size_t __ptrlen,
2629       size_t __size, size_t __n,
2630       FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
2631 extern size_t __fread_alias (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) __asm__ ("" "fread") __attribute__ ((__warn_unused_result__));
2632
2633
2634
2635 extern size_t __fread_chk_warn (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream) __asm__ ("" "__fread_chk")
2636
2637
2638
2639
2640      __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("fread called with bigger size * nmemb than length " "of destination buffer")));
2641
2642
2643 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) size_t
2644 fread (void *__restrict __ptr, size_t __size, size_t __n,
2645        FILE *__restrict __stream)
2646 {
2647   if (__builtin_object_size (__ptr, 0) != (size_t) -1)
2648     {
2649       if (!__builtin_constant_p (__size)
2650    || !__builtin_constant_p (__n)
2651    || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2)))
2652  return __fread_chk (__ptr, __builtin_object_size (__ptr, 0), __size, __n, __stream);
2653
2654       if (__size * __n > __builtin_object_size (__ptr, 0))
2655  return __fread_chk_warn (__ptr, __builtin_object_size (__ptr, 0), __size, __n, __stream);
2656     }
2657   return __fread_alias (__ptr, __size, __n, __stream);
2658 }
2659
2660
2661 extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size,
2662        int __n, FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
2663 extern char *__fgets_unlocked_alias (char *__restrict __s, int __n, FILE *__restrict __stream) __asm__ ("" "fgets_unlocked") __attribute__ ((__warn_unused_result__));
2664
2665
2666 extern char *__fgets_unlocked_chk_warn (char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream) __asm__ ("" "__fgets_unlocked_chk")
2667
2668
2669      __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("fgets_unlocked called with bigger size than length " "of destination buffer")));
2670
2671
2672 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) char *
2673 fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream)
2674 {
2675   if (__builtin_object_size (__s, 2 > 1) != (size_t) -1)
2676     {
2677       if (!__builtin_constant_p (__n) || __n <= 0)
2678  return __fgets_unlocked_chk (__s, __builtin_object_size (__s, 2 > 1), __n, __stream);
2679
2680       if ((size_t) __n > __builtin_object_size (__s, 2 > 1))
2681  return __fgets_unlocked_chk_warn (__s, __builtin_object_size (__s, 2 > 1), __n, __stream);
2682     }
2683   return __fgets_unlocked_alias (__s, __n, __stream);
2684 }
2685
2686
2687
2688
2689 extern size_t __fread_unlocked_chk (void *__restrict __ptr, size_t __ptrlen,
2690         size_t __size, size_t __n,
2691         FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
2692 extern size_t __fread_unlocked_alias (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) __asm__ ("" "fread_unlocked") __attribute__ ((__warn_unused_result__));
2693
2694
2695
2696 extern size_t __fread_unlocked_chk_warn (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream) __asm__ ("" "__fread_unlocked_chk")
2697
2698
2699
2700
2701      __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("fread_unlocked called with bigger size * nmemb than " "length of destination buffer")));
2702
2703
2704 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) size_t
2705 fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n,
2706   FILE *__restrict __stream)
2707 {
2708   if (__builtin_object_size (__ptr, 0) != (size_t) -1)
2709     {
2710       if (!__builtin_constant_p (__size)
2711    || !__builtin_constant_p (__n)
2712    || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2)))
2713  return __fread_unlocked_chk (__ptr, __builtin_object_size (__ptr, 0), __size, __n,
2714          __stream);
2715
2716       if (__size * __n > __builtin_object_size (__ptr, 0))
2717  return __fread_unlocked_chk_warn (__ptr, __builtin_object_size (__ptr, 0), __size, __n,
2718        __stream);
2719     }
2720
2721
2722   if (__builtin_constant_p (__size)
2723       && __builtin_constant_p (__n)
2724       && (__size | __n) < (((size_t) 1) << (8 * sizeof (size_t) / 2))
2725       && __size * __n <= 8)
2726     {
2727       size_t __cnt = __size * __n;
2728       char *__cptr = (char *) __ptr;
2729       if (__cnt == 0)
2730  return 0;
2731
2732       for (; __cnt > 0; --__cnt)
2733  {
2734    int __c = (__builtin_expect (((__stream)->_IO_read_ptr >= (__stream)->_IO_read_end), 0) ? __uflow (__stream) : *(unsigned char *) (__stream)->_IO_read_ptr++);
2735    if (__c == (-1))
2736      break;
2737    *__cptr++ = __c;
2738  }
2739       return (__cptr - (char *) __ptr) / __size;
2740     }
2741
2742   return __fread_unlocked_alias (__ptr, __size, __n, __stream);
2743 }
2744 # 911 "/usr/include/stdio.h" 2 3 4
2745
2746
2747
2748
2749
2750
2751 # 312 "./../include/my_global.h" 2
2752
2753
2754 # 1 "/usr/include/stdlib.h" 1 3 4
2755 # 33 "/usr/include/stdlib.h" 3 4
2756 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 1 3 4
2757 # 326 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 3 4
2758 typedef int wchar_t;
2759 # 34 "/usr/include/stdlib.h" 2 3 4
2760
2761
2762
2763
2764
2765
2766
2767
2768 # 1 "/usr/include/bits/waitflags.h" 1 3 4
2769 # 43 "/usr/include/stdlib.h" 2 3 4
2770 # 1 "/usr/include/bits/waitstatus.h" 1 3 4
2771 # 67 "/usr/include/bits/waitstatus.h" 3 4
2772 union wait
2773   {
2774     int w_status;
2775     struct
2776       {
2777
2778
2779
2780
2781
2782
2783
2784  unsigned int:16;
2785  unsigned int __w_retcode:8;
2786  unsigned int __w_coredump:1;
2787  unsigned int __w_termsig:7;
2788
2789       } __wait_terminated;
2790     struct
2791       {
2792
2793
2794
2795
2796
2797
2798  unsigned int:16;
2799  unsigned int __w_stopsig:8;
2800  unsigned int __w_stopval:8;
2801
2802       } __wait_stopped;
2803   };
2804 # 44 "/usr/include/stdlib.h" 2 3 4
2805 # 68 "/usr/include/stdlib.h" 3 4
2806 typedef union
2807   {
2808     union wait *__uptr;
2809     int *__iptr;
2810   } __WAIT_STATUS __attribute__ ((__transparent_union__));
2811 # 96 "/usr/include/stdlib.h" 3 4
2812
2813
2814 typedef struct
2815   {
2816     int quot;
2817     int rem;
2818   } div_t;
2819
2820
2821
2822 typedef struct
2823   {
2824     long int quot;
2825     long int rem;
2826   } ldiv_t;
2827
2828
2829
2830
2831
2832
2833
2834 __extension__ typedef struct
2835   {
2836     long long int quot;
2837     long long int rem;
2838   } lldiv_t;
2839
2840
2841 # 140 "/usr/include/stdlib.h" 3 4
2842 extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
2843
2844
2845
2846
2847 extern double atof (__const char *__nptr)
2848      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
2849
2850 extern int atoi (__const char *__nptr)
2851      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
2852
2853 extern long int atol (__const char *__nptr)
2854      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
2855
2856
2857
2858
2859
2860 __extension__ extern long long int atoll (__const char *__nptr)
2861      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
2862
2863
2864
2865
2866
2867 extern double strtod (__const char *__restrict __nptr,
2868         char **__restrict __endptr)
2869      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
2870
2871
2872
2873
2874
2875 extern float strtof (__const char *__restrict __nptr,
2876        char **__restrict __endptr) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
2877
2878 extern long double strtold (__const char *__restrict __nptr,
2879        char **__restrict __endptr)
2880      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
2881
2882
2883
2884
2885
2886 extern long int strtol (__const char *__restrict __nptr,
2887    char **__restrict __endptr, int __base)
2888      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
2889
2890 extern unsigned long int strtoul (__const char *__restrict __nptr,
2891       char **__restrict __endptr, int __base)
2892      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
2893
2894
2895
2896
2897 __extension__
2898 extern long long int strtoq (__const char *__restrict __nptr,
2899         char **__restrict __endptr, int __base)
2900      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
2901
2902 __extension__
2903 extern unsigned long long int strtouq (__const char *__restrict __nptr,
2904            char **__restrict __endptr, int __base)
2905      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
2906
2907
2908
2909
2910
2911 __extension__
2912 extern long long int strtoll (__const char *__restrict __nptr,
2913          char **__restrict __endptr, int __base)
2914      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
2915
2916 __extension__
2917 extern unsigned long long int strtoull (__const char *__restrict __nptr,
2918      char **__restrict __endptr, int __base)
2919      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
2920
2921 # 240 "/usr/include/stdlib.h" 3 4
2922 extern long int strtol_l (__const char *__restrict __nptr,
2923      char **__restrict __endptr, int __base,
2924      __locale_t __loc) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 4))) __attribute__ ((__warn_unused_result__));
2925
2926 extern unsigned long int strtoul_l (__const char *__restrict __nptr,
2927         char **__restrict __endptr,
2928         int __base, __locale_t __loc)
2929      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 4))) __attribute__ ((__warn_unused_result__));
2930
2931 __extension__
2932 extern long long int strtoll_l (__const char *__restrict __nptr,
2933     char **__restrict __endptr, int __base,
2934     __locale_t __loc)
2935      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 4))) __attribute__ ((__warn_unused_result__));
2936
2937 __extension__
2938 extern unsigned long long int strtoull_l (__const char *__restrict __nptr,
2939        char **__restrict __endptr,
2940        int __base, __locale_t __loc)
2941      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 4))) __attribute__ ((__warn_unused_result__));
2942
2943 extern double strtod_l (__const char *__restrict __nptr,
2944    char **__restrict __endptr, __locale_t __loc)
2945      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3))) __attribute__ ((__warn_unused_result__));
2946
2947 extern float strtof_l (__const char *__restrict __nptr,
2948          char **__restrict __endptr, __locale_t __loc)
2949      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3))) __attribute__ ((__warn_unused_result__));
2950
2951 extern long double strtold_l (__const char *__restrict __nptr,
2952          char **__restrict __endptr,
2953          __locale_t __loc)
2954      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3))) __attribute__ ((__warn_unused_result__));
2955
2956
2957
2958
2959
2960 extern __inline double
2961 __attribute__ ((__nothrow__)) atof (__const char *__nptr)
2962 {
2963   return strtod (__nptr, (char **) ((void *)0));
2964 }
2965 extern __inline int
2966 __attribute__ ((__nothrow__)) atoi (__const char *__nptr)
2967 {
2968   return (int) strtol (__nptr, (char **) ((void *)0), 10);
2969 }
2970 extern __inline long int
2971 __attribute__ ((__nothrow__)) atol (__const char *__nptr)
2972 {
2973   return strtol (__nptr, (char **) ((void *)0), 10);
2974 }
2975
2976
2977
2978
2979 __extension__ extern __inline long long int
2980 __attribute__ ((__nothrow__)) atoll (__const char *__nptr)
2981 {
2982   return strtoll (__nptr, (char **) ((void *)0), 10);
2983 }
2984
2985 # 311 "/usr/include/stdlib.h" 3 4
2986 extern char *l64a (long int __n) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
2987
2988
2989 extern long int a64l (__const char *__s)
2990      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
2991
2992
2993
2994
2995 # 1 "/usr/include/sys/types.h" 1 3 4
2996 # 29 "/usr/include/sys/types.h" 3 4
2997
2998
2999
3000
3001
3002
3003 typedef __u_char u_char;
3004 typedef __u_short u_short;
3005 typedef __u_int u_int;
3006 typedef __u_long u_long;
3007 typedef __quad_t quad_t;
3008 typedef __u_quad_t u_quad_t;
3009 typedef __fsid_t fsid_t;
3010
3011
3012
3013
3014 typedef __loff_t loff_t;
3015
3016
3017
3018 typedef __ino_t ino_t;
3019
3020
3021
3022
3023
3024
3025 typedef __ino64_t ino64_t;
3026
3027
3028
3029
3030 typedef __dev_t dev_t;
3031
3032
3033
3034
3035 typedef __gid_t gid_t;
3036
3037
3038
3039
3040 typedef __mode_t mode_t;
3041
3042
3043
3044
3045 typedef __nlink_t nlink_t;
3046
3047
3048
3049
3050 typedef __uid_t uid_t;
3051
3052
3053
3054
3055
3056 typedef __off_t off_t;
3057
3058
3059
3060
3061
3062
3063 typedef __off64_t off64_t;
3064 # 105 "/usr/include/sys/types.h" 3 4
3065 typedef __id_t id_t;
3066
3067
3068
3069
3070 typedef __ssize_t ssize_t;
3071
3072
3073
3074
3075
3076 typedef __daddr_t daddr_t;
3077 typedef __caddr_t caddr_t;
3078
3079
3080
3081
3082
3083 typedef __key_t key_t;
3084 # 137 "/usr/include/sys/types.h" 3 4
3085 typedef __useconds_t useconds_t;
3086
3087
3088
3089 typedef __suseconds_t suseconds_t;
3090
3091
3092
3093
3094
3095 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 1 3 4
3096 # 148 "/usr/include/sys/types.h" 2 3 4
3097
3098
3099
3100 typedef unsigned long int ulong;
3101 typedef unsigned short int ushort;
3102 typedef unsigned int uint;
3103 # 195 "/usr/include/sys/types.h" 3 4
3104 typedef int int8_t __attribute__ ((__mode__ (__QI__)));
3105 typedef int int16_t __attribute__ ((__mode__ (__HI__)));
3106 typedef int int32_t __attribute__ ((__mode__ (__SI__)));
3107 typedef int int64_t __attribute__ ((__mode__ (__DI__)));
3108
3109
3110 typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
3111 typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
3112 typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
3113 typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));
3114
3115 typedef int register_t __attribute__ ((__mode__ (__word__)));
3116 # 220 "/usr/include/sys/types.h" 3 4
3117 # 1 "/usr/include/sys/select.h" 1 3 4
3118 # 31 "/usr/include/sys/select.h" 3 4
3119 # 1 "/usr/include/bits/select.h" 1 3 4
3120 # 32 "/usr/include/sys/select.h" 2 3 4
3121
3122
3123 # 1 "/usr/include/bits/sigset.h" 1 3 4
3124 # 35 "/usr/include/sys/select.h" 2 3 4
3125 # 46 "/usr/include/sys/select.h" 3 4
3126 # 1 "/usr/include/bits/time.h" 1 3 4
3127 # 69 "/usr/include/bits/time.h" 3 4
3128 struct timeval
3129   {
3130     __time_t tv_sec;
3131     __suseconds_t tv_usec;
3132   };
3133 # 47 "/usr/include/sys/select.h" 2 3 4
3134 # 55 "/usr/include/sys/select.h" 3 4
3135 typedef long int __fd_mask;
3136 # 67 "/usr/include/sys/select.h" 3 4
3137 typedef struct
3138   {
3139
3140
3141
3142     __fd_mask fds_bits[1024 / (8 * sizeof (__fd_mask))];
3143
3144
3145
3146
3147
3148   } fd_set;
3149
3150
3151
3152
3153
3154
3155 typedef __fd_mask fd_mask;
3156 # 99 "/usr/include/sys/select.h" 3 4
3157
3158 # 109 "/usr/include/sys/select.h" 3 4
3159 extern int select (int __nfds, fd_set *__restrict __readfds,
3160      fd_set *__restrict __writefds,
3161      fd_set *__restrict __exceptfds,
3162      struct timeval *__restrict __timeout);
3163 # 121 "/usr/include/sys/select.h" 3 4
3164 extern int pselect (int __nfds, fd_set *__restrict __readfds,
3165       fd_set *__restrict __writefds,
3166       fd_set *__restrict __exceptfds,
3167       const struct timespec *__restrict __timeout,
3168       const __sigset_t *__restrict __sigmask);
3169
3170
3171
3172 # 221 "/usr/include/sys/types.h" 2 3 4
3173
3174
3175 # 1 "/usr/include/sys/sysmacros.h" 1 3 4
3176 # 30 "/usr/include/sys/sysmacros.h" 3 4
3177 __extension__
3178 extern unsigned int gnu_dev_major (unsigned long long int __dev)
3179      __attribute__ ((__nothrow__));
3180 __extension__
3181 extern unsigned int gnu_dev_minor (unsigned long long int __dev)
3182      __attribute__ ((__nothrow__));
3183 __extension__
3184 extern unsigned long long int gnu_dev_makedev (unsigned int __major,
3185             unsigned int __minor)
3186      __attribute__ ((__nothrow__));
3187
3188
3189 __extension__ extern __inline unsigned int
3190 __attribute__ ((__nothrow__)) gnu_dev_major (unsigned long long int __dev)
3191 {
3192   return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
3193 }
3194
3195 __extension__ extern __inline unsigned int
3196 __attribute__ ((__nothrow__)) gnu_dev_minor (unsigned long long int __dev)
3197 {
3198   return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
3199 }
3200
3201 __extension__ extern __inline unsigned long long int
3202 __attribute__ ((__nothrow__)) gnu_dev_makedev (unsigned int __major, unsigned int __minor)
3203 {
3204   return ((__minor & 0xff) | ((__major & 0xfff) << 8)
3205    | (((unsigned long long int) (__minor & ~0xff)) << 12)
3206    | (((unsigned long long int) (__major & ~0xfff)) << 32));
3207 }
3208 # 224 "/usr/include/sys/types.h" 2 3 4
3209
3210
3211
3212
3213 typedef __blksize_t blksize_t;
3214
3215
3216
3217
3218
3219
3220 typedef __blkcnt_t blkcnt_t;
3221
3222
3223
3224 typedef __fsblkcnt_t fsblkcnt_t;
3225
3226
3227
3228 typedef __fsfilcnt_t fsfilcnt_t;
3229 # 262 "/usr/include/sys/types.h" 3 4
3230 typedef __blkcnt64_t blkcnt64_t;
3231 typedef __fsblkcnt64_t fsblkcnt64_t;
3232 typedef __fsfilcnt64_t fsfilcnt64_t;
3233 # 273 "/usr/include/sys/types.h" 3 4
3234
3235 # 321 "/usr/include/stdlib.h" 2 3 4
3236
3237
3238
3239
3240
3241
3242 extern long int random (void) __attribute__ ((__nothrow__));
3243
3244
3245 extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__));
3246
3247
3248
3249
3250
3251 extern char *initstate (unsigned int __seed, char *__statebuf,
3252    size_t __statelen) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
3253
3254
3255
3256 extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3257
3258
3259
3260
3261
3262
3263
3264 struct random_data
3265   {
3266     int32_t *fptr;
3267     int32_t *rptr;
3268     int32_t *state;
3269     int rand_type;
3270     int rand_deg;
3271     int rand_sep;
3272     int32_t *end_ptr;
3273   };
3274
3275 extern int random_r (struct random_data *__restrict __buf,
3276        int32_t *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3277
3278 extern int srandom_r (unsigned int __seed, struct random_data *__buf)
3279      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
3280
3281 extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
3282    size_t __statelen,
3283    struct random_data *__restrict __buf)
3284      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 4)));
3285
3286 extern int setstate_r (char *__restrict __statebuf,
3287          struct random_data *__restrict __buf)
3288      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3289
3290
3291
3292
3293
3294
3295 extern int rand (void) __attribute__ ((__nothrow__));
3296
3297 extern void srand (unsigned int __seed) __attribute__ ((__nothrow__));
3298
3299
3300
3301
3302 extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__));
3303
3304
3305
3306
3307
3308
3309
3310 extern double drand48 (void) __attribute__ ((__nothrow__));
3311 extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3312
3313
3314 extern long int lrand48 (void) __attribute__ ((__nothrow__));
3315 extern long int nrand48 (unsigned short int __xsubi[3])
3316      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3317
3318
3319 extern long int mrand48 (void) __attribute__ ((__nothrow__));
3320 extern long int jrand48 (unsigned short int __xsubi[3])
3321      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3322
3323
3324 extern void srand48 (long int __seedval) __attribute__ ((__nothrow__));
3325 extern unsigned short int *seed48 (unsigned short int __seed16v[3])
3326      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3327 extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3328
3329
3330
3331
3332
3333 struct drand48_data
3334   {
3335     unsigned short int __x[3];
3336     unsigned short int __old_x[3];
3337     unsigned short int __c;
3338     unsigned short int __init;
3339     unsigned long long int __a;
3340   };
3341
3342
3343 extern int drand48_r (struct drand48_data *__restrict __buffer,
3344         double *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3345 extern int erand48_r (unsigned short int __xsubi[3],
3346         struct drand48_data *__restrict __buffer,
3347         double *__restrict __result) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3348
3349
3350 extern int lrand48_r (struct drand48_data *__restrict __buffer,
3351         long int *__restrict __result)
3352      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3353 extern int nrand48_r (unsigned short int __xsubi[3],
3354         struct drand48_data *__restrict __buffer,
3355         long int *__restrict __result)
3356      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3357
3358
3359 extern int mrand48_r (struct drand48_data *__restrict __buffer,
3360         long int *__restrict __result)
3361      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3362 extern int jrand48_r (unsigned short int __xsubi[3],
3363         struct drand48_data *__restrict __buffer,
3364         long int *__restrict __result)
3365      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3366
3367
3368 extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
3369      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
3370
3371 extern int seed48_r (unsigned short int __seed16v[3],
3372        struct drand48_data *__buffer) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3373
3374 extern int lcong48_r (unsigned short int __param[7],
3375         struct drand48_data *__buffer)
3376      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386 extern void *malloc (size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) __attribute__ ((__warn_unused_result__));
3387
3388 extern void *calloc (size_t __nmemb, size_t __size)
3389      __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) __attribute__ ((__warn_unused_result__));
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400 extern void *realloc (void *__ptr, size_t __size)
3401      __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
3402
3403 extern void free (void *__ptr) __attribute__ ((__nothrow__));
3404
3405
3406
3407
3408 extern void cfree (void *__ptr) __attribute__ ((__nothrow__));
3409
3410
3411
3412 # 1 "/usr/include/alloca.h" 1 3 4
3413 # 25 "/usr/include/alloca.h" 3 4
3414 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 1 3 4
3415 # 26 "/usr/include/alloca.h" 2 3 4
3416
3417
3418
3419
3420
3421
3422
3423 extern void *alloca (size_t __size) __attribute__ ((__nothrow__));
3424
3425
3426
3427
3428
3429
3430 # 498 "/usr/include/stdlib.h" 2 3 4
3431
3432
3433
3434
3435 extern void *valloc (size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) __attribute__ ((__warn_unused_result__));
3436
3437
3438
3439
3440 extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
3441      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
3442
3443
3444
3445
3446 extern void abort (void) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
3447
3448
3449
3450 extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3451 # 527 "/usr/include/stdlib.h" 3 4
3452 extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3453
3454
3455
3456
3457
3458
3459
3460 extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
3461      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3462
3463
3464
3465
3466
3467
3468 extern void exit (int __status) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
3469
3470
3471
3472
3473
3474
3475
3476 extern void quick_exit (int __status) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
3477
3478
3479
3480
3481
3482
3483
3484 extern void _Exit (int __status) __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
3485
3486
3487
3488
3489
3490
3491 extern char *getenv (__const char *__name) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
3492
3493
3494
3495
3496 extern char *__secure_getenv (__const char *__name)
3497      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
3498
3499
3500
3501
3502
3503 extern int putenv (char *__string) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3504
3505
3506
3507
3508
3509 extern int setenv (__const char *__name, __const char *__value, int __replace)
3510      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
3511
3512
3513 extern int unsetenv (__const char *__name) __attribute__ ((__nothrow__));
3514
3515
3516
3517
3518
3519
3520 extern int clearenv (void) __attribute__ ((__nothrow__));
3521 # 604 "/usr/include/stdlib.h" 3 4
3522 extern char *mktemp (char *__template) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
3523 # 615 "/usr/include/stdlib.h" 3 4
3524 extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
3525 # 625 "/usr/include/stdlib.h" 3 4
3526 extern int mkstemp64 (char *__template) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
3527 # 635 "/usr/include/stdlib.h" 3 4
3528 extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
3529 # 646 "/usr/include/stdlib.h" 3 4
3530 extern int mkostemp (char *__template, int __flags) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
3531 # 656 "/usr/include/stdlib.h" 3 4
3532 extern int mkostemp64 (char *__template, int __flags) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542 extern int system (__const char *__command) __attribute__ ((__warn_unused_result__));
3543
3544
3545
3546
3547
3548
3549 extern char *canonicalize_file_name (__const char *__name)
3550      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
3551 # 683 "/usr/include/stdlib.h" 3 4
3552 extern char *realpath (__const char *__restrict __name,
3553          char *__restrict __resolved) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
3554
3555
3556
3557
3558
3559
3560 typedef int (*__compar_fn_t) (__const void *, __const void *);
3561
3562
3563 typedef __compar_fn_t comparison_fn_t;
3564
3565
3566
3567 typedef int (*__compar_d_fn_t) (__const void *, __const void *, void *);
3568
3569
3570
3571
3572
3573 extern void *bsearch (__const void *__key, __const void *__base,
3574         size_t __nmemb, size_t __size, __compar_fn_t __compar)
3575      __attribute__ ((__nonnull__ (1, 2, 5))) __attribute__ ((__warn_unused_result__));
3576
3577
3578
3579 extern void qsort (void *__base, size_t __nmemb, size_t __size,
3580      __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4)));
3581
3582 extern void qsort_r (void *__base, size_t __nmemb, size_t __size,
3583        __compar_d_fn_t __compar, void *__arg)
3584   __attribute__ ((__nonnull__ (1, 4)));
3585
3586
3587
3588
3589 extern int abs (int __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)) __attribute__ ((__warn_unused_result__));
3590 extern long int labs (long int __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)) __attribute__ ((__warn_unused_result__));
3591
3592
3593
3594 __extension__ extern long long int llabs (long long int __x)
3595      __attribute__ ((__nothrow__)) __attribute__ ((__const__)) __attribute__ ((__warn_unused_result__));
3596
3597
3598
3599
3600
3601
3602
3603 extern div_t div (int __numer, int __denom)
3604      __attribute__ ((__nothrow__)) __attribute__ ((__const__)) __attribute__ ((__warn_unused_result__));
3605 extern ldiv_t ldiv (long int __numer, long int __denom)
3606      __attribute__ ((__nothrow__)) __attribute__ ((__const__)) __attribute__ ((__warn_unused_result__));
3607
3608
3609
3610
3611 __extension__ extern lldiv_t lldiv (long long int __numer,
3612         long long int __denom)
3613      __attribute__ ((__nothrow__)) __attribute__ ((__const__)) __attribute__ ((__warn_unused_result__));
3614
3615 # 756 "/usr/include/stdlib.h" 3 4
3616 extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
3617      int *__restrict __sign) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) __attribute__ ((__warn_unused_result__));
3618
3619
3620
3621
3622 extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
3623      int *__restrict __sign) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) __attribute__ ((__warn_unused_result__));
3624
3625
3626
3627
3628 extern char *gcvt (double __value, int __ndigit, char *__buf)
3629      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3))) __attribute__ ((__warn_unused_result__));
3630
3631
3632
3633
3634 extern char *qecvt (long double __value, int __ndigit,
3635       int *__restrict __decpt, int *__restrict __sign)
3636      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) __attribute__ ((__warn_unused_result__));
3637 extern char *qfcvt (long double __value, int __ndigit,
3638       int *__restrict __decpt, int *__restrict __sign)
3639      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4))) __attribute__ ((__warn_unused_result__));
3640 extern char *qgcvt (long double __value, int __ndigit, char *__buf)
3641      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3))) __attribute__ ((__warn_unused_result__));
3642
3643
3644
3645
3646 extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
3647      int *__restrict __sign, char *__restrict __buf,
3648      size_t __len) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
3649 extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
3650      int *__restrict __sign, char *__restrict __buf,
3651      size_t __len) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
3652
3653 extern int qecvt_r (long double __value, int __ndigit,
3654       int *__restrict __decpt, int *__restrict __sign,
3655       char *__restrict __buf, size_t __len)
3656      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
3657 extern int qfcvt_r (long double __value, int __ndigit,
3658       int *__restrict __decpt, int *__restrict __sign,
3659       char *__restrict __buf, size_t __len)
3660      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4, 5)));
3661
3662
3663
3664
3665
3666
3667
3668 extern int mblen (__const char *__s, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
3669
3670
3671 extern int mbtowc (wchar_t *__restrict __pwc,
3672      __const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
3673
3674
3675 extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
3676
3677
3678
3679 extern size_t mbstowcs (wchar_t *__restrict __pwcs,
3680    __const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__));
3681
3682 extern size_t wcstombs (char *__restrict __s,
3683    __const wchar_t *__restrict __pwcs, size_t __n)
3684      __attribute__ ((__nothrow__));
3685
3686
3687
3688
3689
3690
3691
3692
3693 extern int rpmatch (__const char *__response) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
3694 # 844 "/usr/include/stdlib.h" 3 4
3695 extern int getsubopt (char **__restrict __optionp,
3696         char *__const *__restrict __tokens,
3697         char **__restrict __valuep)
3698      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2, 3))) __attribute__ ((__warn_unused_result__));
3699
3700
3701
3702
3703
3704 extern void setkey (__const char *__key) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3705
3706
3707
3708
3709
3710
3711
3712 extern int posix_openpt (int __oflag) __attribute__ ((__warn_unused_result__));
3713
3714
3715
3716
3717
3718
3719
3720 extern int grantpt (int __fd) __attribute__ ((__nothrow__));
3721
3722
3723
3724 extern int unlockpt (int __fd) __attribute__ ((__nothrow__));
3725
3726
3727
3728
3729 extern char *ptsname (int __fd) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
3730
3731
3732
3733
3734
3735
3736 extern int ptsname_r (int __fd, char *__buf, size_t __buflen)
3737      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
3738
3739
3740 extern int getpt (void);
3741
3742
3743
3744
3745
3746
3747 extern int getloadavg (double __loadavg[], int __nelem)
3748      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
3749
3750
3751
3752
3753
3754 # 1 "/usr/include/bits/stdlib.h" 1 3 4
3755 # 24 "/usr/include/bits/stdlib.h" 3 4
3756 extern char *__realpath_chk (__const char *__restrict __name,
3757         char *__restrict __resolved,
3758         size_t __resolvedlen) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
3759 extern char *__realpath_alias (__const char *__restrict __name, char *__restrict __resolved) __asm__ ("" "realpath") __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
3760
3761
3762 extern char *__realpath_chk_warn (__const char *__restrict __name, char *__restrict __resolved, size_t __resolvedlen) __asm__ ("" "__realpath_chk") __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__))
3763
3764
3765
3766      __attribute__((__warning__ ("second argument of realpath must be either NULL or at " "least PATH_MAX bytes long buffer")));
3767
3768
3769 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) char *
3770 __attribute__ ((__nothrow__)) realpath (__const char *__restrict __name, char *__restrict __resolved)
3771 {
3772   if (__builtin_object_size (__resolved, 2 > 1) != (size_t) -1)
3773     {
3774
3775
3776
3777
3778       return __realpath_chk (__name, __resolved, __builtin_object_size (__resolved, 2 > 1));
3779     }
3780
3781   return __realpath_alias (__name, __resolved);
3782 }
3783
3784
3785 extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen,
3786        size_t __nreal) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
3787 extern int __ptsname_r_alias (int __fd, char *__buf, size_t __buflen) __asm__ ("" "ptsname_r") __attribute__ ((__nothrow__))
3788
3789      __attribute__ ((__nonnull__ (2)));
3790 extern int __ptsname_r_chk_warn (int __fd, char *__buf, size_t __buflen, size_t __nreal) __asm__ ("" "__ptsname_r_chk") __attribute__ ((__nothrow__))
3791
3792
3793      __attribute__ ((__nonnull__ (2))) __attribute__((__warning__ ("ptsname_r called with buflen bigger than " "size of buf")));
3794
3795
3796 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
3797 __attribute__ ((__nothrow__)) ptsname_r (int __fd, char *__buf, size_t __buflen)
3798 {
3799   if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
3800     {
3801       if (!__builtin_constant_p (__buflen))
3802  return __ptsname_r_chk (__fd, __buf, __buflen, __builtin_object_size (__buf, 2 > 1));
3803       if (__buflen > __builtin_object_size (__buf, 2 > 1))
3804  return __ptsname_r_chk_warn (__fd, __buf, __buflen, __builtin_object_size (__buf, 2 > 1));
3805     }
3806   return __ptsname_r_alias (__fd, __buf, __buflen);
3807 }
3808
3809
3810 extern int __wctomb_chk (char *__s, wchar_t __wchar, size_t __buflen)
3811   __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
3812 extern int __wctomb_alias (char *__s, wchar_t __wchar) __asm__ ("" "wctomb") __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
3813
3814
3815 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) int
3816 __attribute__ ((__nothrow__)) wctomb (char *__s, wchar_t __wchar)
3817 {
3818
3819
3820
3821
3822
3823
3824
3825   if (__builtin_object_size (__s, 2 > 1) != (size_t) -1 && 16 > __builtin_object_size (__s, 2 > 1))
3826     return __wctomb_chk (__s, __wchar, __builtin_object_size (__s, 2 > 1));
3827   return __wctomb_alias (__s, __wchar);
3828 }
3829
3830
3831 extern size_t __mbstowcs_chk (wchar_t *__restrict __dst,
3832          __const char *__restrict __src,
3833          size_t __len, size_t __dstlen) __attribute__ ((__nothrow__));
3834 extern size_t __mbstowcs_alias (wchar_t *__restrict __dst, __const char *__restrict __src, size_t __len) __asm__ ("" "mbstowcs") __attribute__ ((__nothrow__));
3835
3836
3837
3838 extern size_t __mbstowcs_chk_warn (wchar_t *__restrict __dst, __const char *__restrict __src, size_t __len, size_t __dstlen) __asm__ ("" "__mbstowcs_chk") __attribute__ ((__nothrow__))
3839
3840
3841
3842      __attribute__((__warning__ ("mbstowcs called with dst buffer smaller than len " "* sizeof (wchar_t)")));
3843
3844
3845 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) size_t
3846 __attribute__ ((__nothrow__)) mbstowcs (wchar_t *__restrict __dst, __const char *__restrict __src, size_t __len)
3847
3848 {
3849   if (__builtin_object_size (__dst, 2 > 1) != (size_t) -1)
3850     {
3851       if (!__builtin_constant_p (__len))
3852  return __mbstowcs_chk (__dst, __src, __len,
3853           __builtin_object_size (__dst, 2 > 1) / sizeof (wchar_t));
3854
3855       if (__len > __builtin_object_size (__dst, 2 > 1) / sizeof (wchar_t))
3856  return __mbstowcs_chk_warn (__dst, __src, __len,
3857          __builtin_object_size (__dst, 2 > 1) / sizeof (wchar_t));
3858     }
3859   return __mbstowcs_alias (__dst, __src, __len);
3860 }
3861
3862
3863 extern size_t __wcstombs_chk (char *__restrict __dst,
3864          __const wchar_t *__restrict __src,
3865          size_t __len, size_t __dstlen) __attribute__ ((__nothrow__));
3866 extern size_t __wcstombs_alias (char *__restrict __dst, __const wchar_t *__restrict __src, size_t __len) __asm__ ("" "wcstombs") __attribute__ ((__nothrow__));
3867
3868
3869
3870 extern size_t __wcstombs_chk_warn (char *__restrict __dst, __const wchar_t *__restrict __src, size_t __len, size_t __dstlen) __asm__ ("" "__wcstombs_chk") __attribute__ ((__nothrow__))
3871
3872
3873
3874      __attribute__((__warning__ ("wcstombs called with dst buffer smaller than len")));
3875
3876 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) size_t
3877 __attribute__ ((__nothrow__)) wcstombs (char *__restrict __dst, __const wchar_t *__restrict __src, size_t __len)
3878
3879 {
3880   if (__builtin_object_size (__dst, 2 > 1) != (size_t) -1)
3881     {
3882       if (!__builtin_constant_p (__len))
3883  return __wcstombs_chk (__dst, __src, __len, __builtin_object_size (__dst, 2 > 1));
3884       if (__len > __builtin_object_size (__dst, 2 > 1))
3885  return __wcstombs_chk_warn (__dst, __src, __len, __builtin_object_size (__dst, 2 > 1));
3886     }
3887   return __wcstombs_alias (__dst, __src, __len);
3888 }
3889 # 904 "/usr/include/stdlib.h" 2 3 4
3890 # 912 "/usr/include/stdlib.h" 3 4
3891
3892 # 315 "./../include/my_global.h" 2
3893
3894
3895 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 1 3 4
3896 # 152 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 3 4
3897 typedef long int ptrdiff_t;
3898 # 318 "./../include/my_global.h" 2
3899
3900
3901 # 1 "/usr/include/math.h" 1 3 4
3902 # 30 "/usr/include/math.h" 3 4
3903
3904
3905
3906
3907 # 1 "/usr/include/bits/huge_val.h" 1 3 4
3908 # 35 "/usr/include/math.h" 2 3 4
3909
3910 # 1 "/usr/include/bits/huge_valf.h" 1 3 4
3911 # 37 "/usr/include/math.h" 2 3 4
3912 # 1 "/usr/include/bits/huge_vall.h" 1 3 4
3913 # 38 "/usr/include/math.h" 2 3 4
3914
3915
3916 # 1 "/usr/include/bits/inf.h" 1 3 4
3917 # 41 "/usr/include/math.h" 2 3 4
3918
3919
3920 # 1 "/usr/include/bits/nan.h" 1 3 4
3921 # 44 "/usr/include/math.h" 2 3 4
3922
3923
3924
3925 # 1 "/usr/include/bits/mathdef.h" 1 3 4
3926 # 38 "/usr/include/bits/mathdef.h" 3 4
3927 typedef float float_t;
3928
3929 typedef double double_t;
3930 # 48 "/usr/include/math.h" 2 3 4
3931 # 71 "/usr/include/math.h" 3 4
3932 # 1 "/usr/include/bits/mathcalls.h" 1 3 4
3933 # 53 "/usr/include/bits/mathcalls.h" 3 4
3934
3935
3936 extern double acos (double __x) __attribute__ ((__nothrow__)); extern double __acos (double __x) __attribute__ ((__nothrow__));
3937
3938 extern double asin (double __x) __attribute__ ((__nothrow__)); extern double __asin (double __x) __attribute__ ((__nothrow__));
3939
3940 extern double atan (double __x) __attribute__ ((__nothrow__)); extern double __atan (double __x) __attribute__ ((__nothrow__));
3941
3942 extern double atan2 (double __y, double __x) __attribute__ ((__nothrow__)); extern double __atan2 (double __y, double __x) __attribute__ ((__nothrow__));
3943
3944
3945 extern double cos (double __x) __attribute__ ((__nothrow__)); extern double __cos (double __x) __attribute__ ((__nothrow__));
3946
3947 extern double sin (double __x) __attribute__ ((__nothrow__)); extern double __sin (double __x) __attribute__ ((__nothrow__));
3948
3949 extern double tan (double __x) __attribute__ ((__nothrow__)); extern double __tan (double __x) __attribute__ ((__nothrow__));
3950
3951
3952
3953
3954 extern double cosh (double __x) __attribute__ ((__nothrow__)); extern double __cosh (double __x) __attribute__ ((__nothrow__));
3955
3956 extern double sinh (double __x) __attribute__ ((__nothrow__)); extern double __sinh (double __x) __attribute__ ((__nothrow__));
3957
3958 extern double tanh (double __x) __attribute__ ((__nothrow__)); extern double __tanh (double __x) __attribute__ ((__nothrow__));
3959
3960
3961
3962
3963 extern void sincos (double __x, double *__sinx, double *__cosx) __attribute__ ((__nothrow__)); extern void __sincos (double __x, double *__sinx, double *__cosx) __attribute__ ((__nothrow__));
3964
3965
3966
3967
3968
3969
3970 extern double acosh (double __x) __attribute__ ((__nothrow__)); extern double __acosh (double __x) __attribute__ ((__nothrow__));
3971
3972 extern double asinh (double __x) __attribute__ ((__nothrow__)); extern double __asinh (double __x) __attribute__ ((__nothrow__));
3973
3974 extern double atanh (double __x) __attribute__ ((__nothrow__)); extern double __atanh (double __x) __attribute__ ((__nothrow__));
3975
3976
3977
3978
3979
3980
3981
3982 extern double exp (double __x) __attribute__ ((__nothrow__)); extern double __exp (double __x) __attribute__ ((__nothrow__));
3983
3984
3985 extern double frexp (double __x, int *__exponent) __attribute__ ((__nothrow__)); extern double __frexp (double __x, int *__exponent) __attribute__ ((__nothrow__));
3986
3987
3988 extern double ldexp (double __x, int __exponent) __attribute__ ((__nothrow__)); extern double __ldexp (double __x, int __exponent) __attribute__ ((__nothrow__));
3989
3990
3991 extern double log (double __x) __attribute__ ((__nothrow__)); extern double __log (double __x) __attribute__ ((__nothrow__));
3992
3993
3994 extern double log10 (double __x) __attribute__ ((__nothrow__)); extern double __log10 (double __x) __attribute__ ((__nothrow__));
3995
3996
3997 extern double modf (double __x, double *__iptr) __attribute__ ((__nothrow__)); extern double __modf (double __x, double *__iptr) __attribute__ ((__nothrow__));
3998
3999
4000
4001
4002 extern double exp10 (double __x) __attribute__ ((__nothrow__)); extern double __exp10 (double __x) __attribute__ ((__nothrow__));
4003
4004 extern double pow10 (double __x) __attribute__ ((__nothrow__)); extern double __pow10 (double __x) __attribute__ ((__nothrow__));
4005
4006
4007
4008
4009
4010 extern double expm1 (double __x) __attribute__ ((__nothrow__)); extern double __expm1 (double __x) __attribute__ ((__nothrow__));
4011
4012
4013 extern double log1p (double __x) __attribute__ ((__nothrow__)); extern double __log1p (double __x) __attribute__ ((__nothrow__));
4014
4015
4016 extern double logb (double __x) __attribute__ ((__nothrow__)); extern double __logb (double __x) __attribute__ ((__nothrow__));
4017
4018
4019
4020
4021
4022
4023 extern double exp2 (double __x) __attribute__ ((__nothrow__)); extern double __exp2 (double __x) __attribute__ ((__nothrow__));
4024
4025
4026 extern double log2 (double __x) __attribute__ ((__nothrow__)); extern double __log2 (double __x) __attribute__ ((__nothrow__));
4027
4028
4029
4030
4031
4032
4033
4034
4035 extern double pow (double __x, double __y) __attribute__ ((__nothrow__)); extern double __pow (double __x, double __y) __attribute__ ((__nothrow__));
4036
4037
4038 extern double sqrt (double __x) __attribute__ ((__nothrow__)); extern double __sqrt (double __x) __attribute__ ((__nothrow__));
4039
4040
4041
4042
4043
4044 extern double hypot (double __x, double __y) __attribute__ ((__nothrow__)); extern double __hypot (double __x, double __y) __attribute__ ((__nothrow__));
4045
4046
4047
4048
4049
4050
4051 extern double cbrt (double __x) __attribute__ ((__nothrow__)); extern double __cbrt (double __x) __attribute__ ((__nothrow__));
4052
4053
4054
4055
4056
4057
4058
4059
4060 extern double ceil (double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern double __ceil (double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4061
4062
4063 extern double fabs (double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern double __fabs (double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4064
4065
4066 extern double floor (double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern double __floor (double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4067
4068
4069 extern double fmod (double __x, double __y) __attribute__ ((__nothrow__)); extern double __fmod (double __x, double __y) __attribute__ ((__nothrow__));
4070
4071
4072
4073
4074 extern int __isinf (double __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4075
4076
4077 extern int __finite (double __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4078
4079
4080
4081
4082
4083 extern int isinf (double __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4084
4085
4086 extern int finite (double __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4087
4088
4089 extern double drem (double __x, double __y) __attribute__ ((__nothrow__)); extern double __drem (double __x, double __y) __attribute__ ((__nothrow__));
4090
4091
4092
4093 extern double significand (double __x) __attribute__ ((__nothrow__)); extern double __significand (double __x) __attribute__ ((__nothrow__));
4094
4095
4096
4097
4098
4099 extern double copysign (double __x, double __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern double __copysign (double __x, double __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4100
4101
4102
4103
4104
4105
4106 extern double nan (__const char *__tagb) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern double __nan (__const char *__tagb) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4107
4108
4109
4110
4111
4112 extern int __isnan (double __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4113
4114
4115
4116 extern int isnan (double __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4117
4118
4119 extern double j0 (double) __attribute__ ((__nothrow__)); extern double __j0 (double) __attribute__ ((__nothrow__));
4120 extern double j1 (double) __attribute__ ((__nothrow__)); extern double __j1 (double) __attribute__ ((__nothrow__));
4121 extern double jn (int, double) __attribute__ ((__nothrow__)); extern double __jn (int, double) __attribute__ ((__nothrow__));
4122 extern double y0 (double) __attribute__ ((__nothrow__)); extern double __y0 (double) __attribute__ ((__nothrow__));
4123 extern double y1 (double) __attribute__ ((__nothrow__)); extern double __y1 (double) __attribute__ ((__nothrow__));
4124 extern double yn (int, double) __attribute__ ((__nothrow__)); extern double __yn (int, double) __attribute__ ((__nothrow__));
4125
4126
4127
4128
4129
4130
4131 extern double erf (double) __attribute__ ((__nothrow__)); extern double __erf (double) __attribute__ ((__nothrow__));
4132 extern double erfc (double) __attribute__ ((__nothrow__)); extern double __erfc (double) __attribute__ ((__nothrow__));
4133 extern double lgamma (double) __attribute__ ((__nothrow__)); extern double __lgamma (double) __attribute__ ((__nothrow__));
4134
4135
4136
4137
4138
4139
4140 extern double tgamma (double) __attribute__ ((__nothrow__)); extern double __tgamma (double) __attribute__ ((__nothrow__));
4141
4142
4143
4144
4145
4146 extern double gamma (double) __attribute__ ((__nothrow__)); extern double __gamma (double) __attribute__ ((__nothrow__));
4147
4148
4149
4150
4151
4152
4153 extern double lgamma_r (double, int *__signgamp) __attribute__ ((__nothrow__)); extern double __lgamma_r (double, int *__signgamp) __attribute__ ((__nothrow__));
4154
4155
4156
4157
4158
4159
4160
4161 extern double rint (double __x) __attribute__ ((__nothrow__)); extern double __rint (double __x) __attribute__ ((__nothrow__));
4162
4163
4164 extern double nextafter (double __x, double __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern double __nextafter (double __x, double __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4165
4166 extern double nexttoward (double __x, long double __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern double __nexttoward (double __x, long double __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4167
4168
4169
4170 extern double remainder (double __x, double __y) __attribute__ ((__nothrow__)); extern double __remainder (double __x, double __y) __attribute__ ((__nothrow__));
4171
4172
4173
4174 extern double scalbn (double __x, int __n) __attribute__ ((__nothrow__)); extern double __scalbn (double __x, int __n) __attribute__ ((__nothrow__));
4175
4176
4177
4178 extern int ilogb (double __x) __attribute__ ((__nothrow__)); extern int __ilogb (double __x) __attribute__ ((__nothrow__));
4179
4180
4181
4182
4183 extern double scalbln (double __x, long int __n) __attribute__ ((__nothrow__)); extern double __scalbln (double __x, long int __n) __attribute__ ((__nothrow__));
4184
4185
4186
4187 extern double nearbyint (double __x) __attribute__ ((__nothrow__)); extern double __nearbyint (double __x) __attribute__ ((__nothrow__));
4188
4189
4190
4191 extern double round (double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern double __round (double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4192
4193
4194
4195 extern double trunc (double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern double __trunc (double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4196
4197
4198
4199
4200 extern double remquo (double __x, double __y, int *__quo) __attribute__ ((__nothrow__)); extern double __remquo (double __x, double __y, int *__quo) __attribute__ ((__nothrow__));
4201
4202
4203
4204
4205
4206
4207 extern long int lrint (double __x) __attribute__ ((__nothrow__)); extern long int __lrint (double __x) __attribute__ ((__nothrow__));
4208 extern long long int llrint (double __x) __attribute__ ((__nothrow__)); extern long long int __llrint (double __x) __attribute__ ((__nothrow__));
4209
4210
4211
4212 extern long int lround (double __x) __attribute__ ((__nothrow__)); extern long int __lround (double __x) __attribute__ ((__nothrow__));
4213 extern long long int llround (double __x) __attribute__ ((__nothrow__)); extern long long int __llround (double __x) __attribute__ ((__nothrow__));
4214
4215
4216
4217 extern double fdim (double __x, double __y) __attribute__ ((__nothrow__)); extern double __fdim (double __x, double __y) __attribute__ ((__nothrow__));
4218
4219
4220 extern double fmax (double __x, double __y) __attribute__ ((__nothrow__)); extern double __fmax (double __x, double __y) __attribute__ ((__nothrow__));
4221
4222
4223 extern double fmin (double __x, double __y) __attribute__ ((__nothrow__)); extern double __fmin (double __x, double __y) __attribute__ ((__nothrow__));
4224
4225
4226
4227 extern int __fpclassify (double __value) __attribute__ ((__nothrow__))
4228      __attribute__ ((__const__));
4229
4230
4231 extern int __signbit (double __value) __attribute__ ((__nothrow__))
4232      __attribute__ ((__const__));
4233
4234
4235
4236 extern double fma (double __x, double __y, double __z) __attribute__ ((__nothrow__)); extern double __fma (double __x, double __y, double __z) __attribute__ ((__nothrow__));
4237
4238
4239
4240
4241
4242
4243
4244
4245 extern double scalb (double __x, double __n) __attribute__ ((__nothrow__)); extern double __scalb (double __x, double __n) __attribute__ ((__nothrow__));
4246 # 72 "/usr/include/math.h" 2 3 4
4247 # 94 "/usr/include/math.h" 3 4
4248 # 1 "/usr/include/bits/mathcalls.h" 1 3 4
4249 # 53 "/usr/include/bits/mathcalls.h" 3 4
4250
4251
4252 extern float acosf (float __x) __attribute__ ((__nothrow__)); extern float __acosf (float __x) __attribute__ ((__nothrow__));
4253
4254 extern float asinf (float __x) __attribute__ ((__nothrow__)); extern float __asinf (float __x) __attribute__ ((__nothrow__));
4255
4256 extern float atanf (float __x) __attribute__ ((__nothrow__)); extern float __atanf (float __x) __attribute__ ((__nothrow__));
4257
4258 extern float atan2f (float __y, float __x) __attribute__ ((__nothrow__)); extern float __atan2f (float __y, float __x) __attribute__ ((__nothrow__));
4259
4260
4261 extern float cosf (float __x) __attribute__ ((__nothrow__)); extern float __cosf (float __x) __attribute__ ((__nothrow__));
4262
4263 extern float sinf (float __x) __attribute__ ((__nothrow__)); extern float __sinf (float __x) __attribute__ ((__nothrow__));
4264
4265 extern float tanf (float __x) __attribute__ ((__nothrow__)); extern float __tanf (float __x) __attribute__ ((__nothrow__));
4266
4267
4268
4269
4270 extern float coshf (float __x) __attribute__ ((__nothrow__)); extern float __coshf (float __x) __attribute__ ((__nothrow__));
4271
4272 extern float sinhf (float __x) __attribute__ ((__nothrow__)); extern float __sinhf (float __x) __attribute__ ((__nothrow__));
4273
4274 extern float tanhf (float __x) __attribute__ ((__nothrow__)); extern float __tanhf (float __x) __attribute__ ((__nothrow__));
4275
4276
4277
4278
4279 extern void sincosf (float __x, float *__sinx, float *__cosx) __attribute__ ((__nothrow__)); extern void __sincosf (float __x, float *__sinx, float *__cosx) __attribute__ ((__nothrow__));
4280
4281
4282
4283
4284
4285
4286 extern float acoshf (float __x) __attribute__ ((__nothrow__)); extern float __acoshf (float __x) __attribute__ ((__nothrow__));
4287
4288 extern float asinhf (float __x) __attribute__ ((__nothrow__)); extern float __asinhf (float __x) __attribute__ ((__nothrow__));
4289
4290 extern float atanhf (float __x) __attribute__ ((__nothrow__)); extern float __atanhf (float __x) __attribute__ ((__nothrow__));
4291
4292
4293
4294
4295
4296
4297
4298 extern float expf (float __x) __attribute__ ((__nothrow__)); extern float __expf (float __x) __attribute__ ((__nothrow__));
4299
4300
4301 extern float frexpf (float __x, int *__exponent) __attribute__ ((__nothrow__)); extern float __frexpf (float __x, int *__exponent) __attribute__ ((__nothrow__));
4302
4303
4304 extern float ldexpf (float __x, int __exponent) __attribute__ ((__nothrow__)); extern float __ldexpf (float __x, int __exponent) __attribute__ ((__nothrow__));
4305
4306
4307 extern float logf (float __x) __attribute__ ((__nothrow__)); extern float __logf (float __x) __attribute__ ((__nothrow__));
4308
4309
4310 extern float log10f (float __x) __attribute__ ((__nothrow__)); extern float __log10f (float __x) __attribute__ ((__nothrow__));
4311
4312
4313 extern float modff (float __x, float *__iptr) __attribute__ ((__nothrow__)); extern float __modff (float __x, float *__iptr) __attribute__ ((__nothrow__));
4314
4315
4316
4317
4318 extern float exp10f (float __x) __attribute__ ((__nothrow__)); extern float __exp10f (float __x) __attribute__ ((__nothrow__));
4319
4320 extern float pow10f (float __x) __attribute__ ((__nothrow__)); extern float __pow10f (float __x) __attribute__ ((__nothrow__));
4321
4322
4323
4324
4325
4326 extern float expm1f (float __x) __attribute__ ((__nothrow__)); extern float __expm1f (float __x) __attribute__ ((__nothrow__));
4327
4328
4329 extern float log1pf (float __x) __attribute__ ((__nothrow__)); extern float __log1pf (float __x) __attribute__ ((__nothrow__));
4330
4331
4332 extern float logbf (float __x) __attribute__ ((__nothrow__)); extern float __logbf (float __x) __attribute__ ((__nothrow__));
4333
4334
4335
4336
4337
4338
4339 extern float exp2f (float __x) __attribute__ ((__nothrow__)); extern float __exp2f (float __x) __attribute__ ((__nothrow__));
4340
4341
4342 extern float log2f (float __x) __attribute__ ((__nothrow__)); extern float __log2f (float __x) __attribute__ ((__nothrow__));
4343
4344
4345
4346
4347
4348
4349
4350
4351 extern float powf (float __x, float __y) __attribute__ ((__nothrow__)); extern float __powf (float __x, float __y) __attribute__ ((__nothrow__));
4352
4353
4354 extern float sqrtf (float __x) __attribute__ ((__nothrow__)); extern float __sqrtf (float __x) __attribute__ ((__nothrow__));
4355
4356
4357
4358
4359
4360 extern float hypotf (float __x, float __y) __attribute__ ((__nothrow__)); extern float __hypotf (float __x, float __y) __attribute__ ((__nothrow__));
4361
4362
4363
4364
4365
4366
4367 extern float cbrtf (float __x) __attribute__ ((__nothrow__)); extern float __cbrtf (float __x) __attribute__ ((__nothrow__));
4368
4369
4370
4371
4372
4373
4374
4375
4376 extern float ceilf (float __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern float __ceilf (float __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4377
4378
4379 extern float fabsf (float __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern float __fabsf (float __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4380
4381
4382 extern float floorf (float __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern float __floorf (float __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4383
4384
4385 extern float fmodf (float __x, float __y) __attribute__ ((__nothrow__)); extern float __fmodf (float __x, float __y) __attribute__ ((__nothrow__));
4386
4387
4388
4389
4390 extern int __isinff (float __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4391
4392
4393 extern int __finitef (float __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4394
4395
4396
4397
4398
4399 extern int isinff (float __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4400
4401
4402 extern int finitef (float __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4403
4404
4405 extern float dremf (float __x, float __y) __attribute__ ((__nothrow__)); extern float __dremf (float __x, float __y) __attribute__ ((__nothrow__));
4406
4407
4408
4409 extern float significandf (float __x) __attribute__ ((__nothrow__)); extern float __significandf (float __x) __attribute__ ((__nothrow__));
4410
4411
4412
4413
4414
4415 extern float copysignf (float __x, float __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern float __copysignf (float __x, float __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4416
4417
4418
4419
4420
4421
4422 extern float nanf (__const char *__tagb) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern float __nanf (__const char *__tagb) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4423
4424
4425
4426
4427
4428 extern int __isnanf (float __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4429
4430
4431
4432 extern int isnanf (float __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4433
4434
4435 extern float j0f (float) __attribute__ ((__nothrow__)); extern float __j0f (float) __attribute__ ((__nothrow__));
4436 extern float j1f (float) __attribute__ ((__nothrow__)); extern float __j1f (float) __attribute__ ((__nothrow__));
4437 extern float jnf (int, float) __attribute__ ((__nothrow__)); extern float __jnf (int, float) __attribute__ ((__nothrow__));
4438 extern float y0f (float) __attribute__ ((__nothrow__)); extern float __y0f (float) __attribute__ ((__nothrow__));
4439 extern float y1f (float) __attribute__ ((__nothrow__)); extern float __y1f (float) __attribute__ ((__nothrow__));
4440 extern float ynf (int, float) __attribute__ ((__nothrow__)); extern float __ynf (int, float) __attribute__ ((__nothrow__));
4441
4442
4443
4444
4445
4446
4447 extern float erff (float) __attribute__ ((__nothrow__)); extern float __erff (float) __attribute__ ((__nothrow__));
4448 extern float erfcf (float) __attribute__ ((__nothrow__)); extern float __erfcf (float) __attribute__ ((__nothrow__));
4449 extern float lgammaf (float) __attribute__ ((__nothrow__)); extern float __lgammaf (float) __attribute__ ((__nothrow__));
4450
4451
4452
4453
4454
4455
4456 extern float tgammaf (float) __attribute__ ((__nothrow__)); extern float __tgammaf (float) __attribute__ ((__nothrow__));
4457
4458
4459
4460
4461
4462 extern float gammaf (float) __attribute__ ((__nothrow__)); extern float __gammaf (float) __attribute__ ((__nothrow__));
4463
4464
4465
4466
4467
4468
4469 extern float lgammaf_r (float, int *__signgamp) __attribute__ ((__nothrow__)); extern float __lgammaf_r (float, int *__signgamp) __attribute__ ((__nothrow__));
4470
4471
4472
4473
4474
4475
4476
4477 extern float rintf (float __x) __attribute__ ((__nothrow__)); extern float __rintf (float __x) __attribute__ ((__nothrow__));
4478
4479
4480 extern float nextafterf (float __x, float __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern float __nextafterf (float __x, float __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4481
4482 extern float nexttowardf (float __x, long double __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern float __nexttowardf (float __x, long double __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4483
4484
4485
4486 extern float remainderf (float __x, float __y) __attribute__ ((__nothrow__)); extern float __remainderf (float __x, float __y) __attribute__ ((__nothrow__));
4487
4488
4489
4490 extern float scalbnf (float __x, int __n) __attribute__ ((__nothrow__)); extern float __scalbnf (float __x, int __n) __attribute__ ((__nothrow__));
4491
4492
4493
4494 extern int ilogbf (float __x) __attribute__ ((__nothrow__)); extern int __ilogbf (float __x) __attribute__ ((__nothrow__));
4495
4496
4497
4498
4499 extern float scalblnf (float __x, long int __n) __attribute__ ((__nothrow__)); extern float __scalblnf (float __x, long int __n) __attribute__ ((__nothrow__));
4500
4501
4502
4503 extern float nearbyintf (float __x) __attribute__ ((__nothrow__)); extern float __nearbyintf (float __x) __attribute__ ((__nothrow__));
4504
4505
4506
4507 extern float roundf (float __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern float __roundf (float __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4508
4509
4510
4511 extern float truncf (float __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern float __truncf (float __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4512
4513
4514
4515
4516 extern float remquof (float __x, float __y, int *__quo) __attribute__ ((__nothrow__)); extern float __remquof (float __x, float __y, int *__quo) __attribute__ ((__nothrow__));
4517
4518
4519
4520
4521
4522
4523 extern long int lrintf (float __x) __attribute__ ((__nothrow__)); extern long int __lrintf (float __x) __attribute__ ((__nothrow__));
4524 extern long long int llrintf (float __x) __attribute__ ((__nothrow__)); extern long long int __llrintf (float __x) __attribute__ ((__nothrow__));
4525
4526
4527
4528 extern long int lroundf (float __x) __attribute__ ((__nothrow__)); extern long int __lroundf (float __x) __attribute__ ((__nothrow__));
4529 extern long long int llroundf (float __x) __attribute__ ((__nothrow__)); extern long long int __llroundf (float __x) __attribute__ ((__nothrow__));
4530
4531
4532
4533 extern float fdimf (float __x, float __y) __attribute__ ((__nothrow__)); extern float __fdimf (float __x, float __y) __attribute__ ((__nothrow__));
4534
4535
4536 extern float fmaxf (float __x, float __y) __attribute__ ((__nothrow__)); extern float __fmaxf (float __x, float __y) __attribute__ ((__nothrow__));
4537
4538
4539 extern float fminf (float __x, float __y) __attribute__ ((__nothrow__)); extern float __fminf (float __x, float __y) __attribute__ ((__nothrow__));
4540
4541
4542
4543 extern int __fpclassifyf (float __value) __attribute__ ((__nothrow__))
4544      __attribute__ ((__const__));
4545
4546
4547 extern int __signbitf (float __value) __attribute__ ((__nothrow__))
4548      __attribute__ ((__const__));
4549
4550
4551
4552 extern float fmaf (float __x, float __y, float __z) __attribute__ ((__nothrow__)); extern float __fmaf (float __x, float __y, float __z) __attribute__ ((__nothrow__));
4553
4554
4555
4556
4557
4558
4559
4560
4561 extern float scalbf (float __x, float __n) __attribute__ ((__nothrow__)); extern float __scalbf (float __x, float __n) __attribute__ ((__nothrow__));
4562 # 95 "/usr/include/math.h" 2 3 4
4563 # 141 "/usr/include/math.h" 3 4
4564 # 1 "/usr/include/bits/mathcalls.h" 1 3 4
4565 # 53 "/usr/include/bits/mathcalls.h" 3 4
4566
4567
4568 extern long double acosl (long double __x) __attribute__ ((__nothrow__)); extern long double __acosl (long double __x) __attribute__ ((__nothrow__));
4569
4570 extern long double asinl (long double __x) __attribute__ ((__nothrow__)); extern long double __asinl (long double __x) __attribute__ ((__nothrow__));
4571
4572 extern long double atanl (long double __x) __attribute__ ((__nothrow__)); extern long double __atanl (long double __x) __attribute__ ((__nothrow__));
4573
4574 extern long double atan2l (long double __y, long double __x) __attribute__ ((__nothrow__)); extern long double __atan2l (long double __y, long double __x) __attribute__ ((__nothrow__));
4575
4576
4577 extern long double cosl (long double __x) __attribute__ ((__nothrow__)); extern long double __cosl (long double __x) __attribute__ ((__nothrow__));
4578
4579 extern long double sinl (long double __x) __attribute__ ((__nothrow__)); extern long double __sinl (long double __x) __attribute__ ((__nothrow__));
4580
4581 extern long double tanl (long double __x) __attribute__ ((__nothrow__)); extern long double __tanl (long double __x) __attribute__ ((__nothrow__));
4582
4583
4584
4585
4586 extern long double coshl (long double __x) __attribute__ ((__nothrow__)); extern long double __coshl (long double __x) __attribute__ ((__nothrow__));
4587
4588 extern long double sinhl (long double __x) __attribute__ ((__nothrow__)); extern long double __sinhl (long double __x) __attribute__ ((__nothrow__));
4589
4590 extern long double tanhl (long double __x) __attribute__ ((__nothrow__)); extern long double __tanhl (long double __x) __attribute__ ((__nothrow__));
4591
4592
4593
4594
4595 extern void sincosl (long double __x, long double *__sinx, long double *__cosx) __attribute__ ((__nothrow__)); extern void __sincosl (long double __x, long double *__sinx, long double *__cosx) __attribute__ ((__nothrow__));
4596
4597
4598
4599
4600
4601
4602 extern long double acoshl (long double __x) __attribute__ ((__nothrow__)); extern long double __acoshl (long double __x) __attribute__ ((__nothrow__));
4603
4604 extern long double asinhl (long double __x) __attribute__ ((__nothrow__)); extern long double __asinhl (long double __x) __attribute__ ((__nothrow__));
4605
4606 extern long double atanhl (long double __x) __attribute__ ((__nothrow__)); extern long double __atanhl (long double __x) __attribute__ ((__nothrow__));
4607
4608
4609
4610
4611
4612
4613
4614 extern long double expl (long double __x) __attribute__ ((__nothrow__)); extern long double __expl (long double __x) __attribute__ ((__nothrow__));
4615
4616
4617 extern long double frexpl (long double __x, int *__exponent) __attribute__ ((__nothrow__)); extern long double __frexpl (long double __x, int *__exponent) __attribute__ ((__nothrow__));
4618
4619
4620 extern long double ldexpl (long double __x, int __exponent) __attribute__ ((__nothrow__)); extern long double __ldexpl (long double __x, int __exponent) __attribute__ ((__nothrow__));
4621
4622
4623 extern long double logl (long double __x) __attribute__ ((__nothrow__)); extern long double __logl (long double __x) __attribute__ ((__nothrow__));
4624
4625
4626 extern long double log10l (long double __x) __attribute__ ((__nothrow__)); extern long double __log10l (long double __x) __attribute__ ((__nothrow__));
4627
4628
4629 extern long double modfl (long double __x, long double *__iptr) __attribute__ ((__nothrow__)); extern long double __modfl (long double __x, long double *__iptr) __attribute__ ((__nothrow__));
4630
4631
4632
4633
4634 extern long double exp10l (long double __x) __attribute__ ((__nothrow__)); extern long double __exp10l (long double __x) __attribute__ ((__nothrow__));
4635
4636 extern long double pow10l (long double __x) __attribute__ ((__nothrow__)); extern long double __pow10l (long double __x) __attribute__ ((__nothrow__));
4637
4638
4639
4640
4641
4642 extern long double expm1l (long double __x) __attribute__ ((__nothrow__)); extern long double __expm1l (long double __x) __attribute__ ((__nothrow__));
4643
4644
4645 extern long double log1pl (long double __x) __attribute__ ((__nothrow__)); extern long double __log1pl (long double __x) __attribute__ ((__nothrow__));
4646
4647
4648 extern long double logbl (long double __x) __attribute__ ((__nothrow__)); extern long double __logbl (long double __x) __attribute__ ((__nothrow__));
4649
4650
4651
4652
4653
4654
4655 extern long double exp2l (long double __x) __attribute__ ((__nothrow__)); extern long double __exp2l (long double __x) __attribute__ ((__nothrow__));
4656
4657
4658 extern long double log2l (long double __x) __attribute__ ((__nothrow__)); extern long double __log2l (long double __x) __attribute__ ((__nothrow__));
4659
4660
4661
4662
4663
4664
4665
4666
4667 extern long double powl (long double __x, long double __y) __attribute__ ((__nothrow__)); extern long double __powl (long double __x, long double __y) __attribute__ ((__nothrow__));
4668
4669
4670 extern long double sqrtl (long double __x) __attribute__ ((__nothrow__)); extern long double __sqrtl (long double __x) __attribute__ ((__nothrow__));
4671
4672
4673
4674
4675
4676 extern long double hypotl (long double __x, long double __y) __attribute__ ((__nothrow__)); extern long double __hypotl (long double __x, long double __y) __attribute__ ((__nothrow__));
4677
4678
4679
4680
4681
4682
4683 extern long double cbrtl (long double __x) __attribute__ ((__nothrow__)); extern long double __cbrtl (long double __x) __attribute__ ((__nothrow__));
4684
4685
4686
4687
4688
4689
4690
4691
4692 extern long double ceill (long double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern long double __ceill (long double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4693
4694
4695 extern long double fabsl (long double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern long double __fabsl (long double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4696
4697
4698 extern long double floorl (long double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern long double __floorl (long double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4699
4700
4701 extern long double fmodl (long double __x, long double __y) __attribute__ ((__nothrow__)); extern long double __fmodl (long double __x, long double __y) __attribute__ ((__nothrow__));
4702
4703
4704
4705
4706 extern int __isinfl (long double __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4707
4708
4709 extern int __finitel (long double __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4710
4711
4712
4713
4714
4715 extern int isinfl (long double __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4716
4717
4718 extern int finitel (long double __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4719
4720
4721 extern long double dreml (long double __x, long double __y) __attribute__ ((__nothrow__)); extern long double __dreml (long double __x, long double __y) __attribute__ ((__nothrow__));
4722
4723
4724
4725 extern long double significandl (long double __x) __attribute__ ((__nothrow__)); extern long double __significandl (long double __x) __attribute__ ((__nothrow__));
4726
4727
4728
4729
4730
4731 extern long double copysignl (long double __x, long double __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern long double __copysignl (long double __x, long double __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4732
4733
4734
4735
4736
4737
4738 extern long double nanl (__const char *__tagb) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern long double __nanl (__const char *__tagb) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4739
4740
4741
4742
4743
4744 extern int __isnanl (long double __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4745
4746
4747
4748 extern int isnanl (long double __value) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4749
4750
4751 extern long double j0l (long double) __attribute__ ((__nothrow__)); extern long double __j0l (long double) __attribute__ ((__nothrow__));
4752 extern long double j1l (long double) __attribute__ ((__nothrow__)); extern long double __j1l (long double) __attribute__ ((__nothrow__));
4753 extern long double jnl (int, long double) __attribute__ ((__nothrow__)); extern long double __jnl (int, long double) __attribute__ ((__nothrow__));
4754 extern long double y0l (long double) __attribute__ ((__nothrow__)); extern long double __y0l (long double) __attribute__ ((__nothrow__));
4755 extern long double y1l (long double) __attribute__ ((__nothrow__)); extern long double __y1l (long double) __attribute__ ((__nothrow__));
4756 extern long double ynl (int, long double) __attribute__ ((__nothrow__)); extern long double __ynl (int, long double) __attribute__ ((__nothrow__));
4757
4758
4759
4760
4761
4762
4763 extern long double erfl (long double) __attribute__ ((__nothrow__)); extern long double __erfl (long double) __attribute__ ((__nothrow__));
4764 extern long double erfcl (long double) __attribute__ ((__nothrow__)); extern long double __erfcl (long double) __attribute__ ((__nothrow__));
4765 extern long double lgammal (long double) __attribute__ ((__nothrow__)); extern long double __lgammal (long double) __attribute__ ((__nothrow__));
4766
4767
4768
4769
4770
4771
4772 extern long double tgammal (long double) __attribute__ ((__nothrow__)); extern long double __tgammal (long double) __attribute__ ((__nothrow__));
4773
4774
4775
4776
4777
4778 extern long double gammal (long double) __attribute__ ((__nothrow__)); extern long double __gammal (long double) __attribute__ ((__nothrow__));
4779
4780
4781
4782
4783
4784
4785 extern long double lgammal_r (long double, int *__signgamp) __attribute__ ((__nothrow__)); extern long double __lgammal_r (long double, int *__signgamp) __attribute__ ((__nothrow__));
4786
4787
4788
4789
4790
4791
4792
4793 extern long double rintl (long double __x) __attribute__ ((__nothrow__)); extern long double __rintl (long double __x) __attribute__ ((__nothrow__));
4794
4795
4796 extern long double nextafterl (long double __x, long double __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern long double __nextafterl (long double __x, long double __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4797
4798 extern long double nexttowardl (long double __x, long double __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern long double __nexttowardl (long double __x, long double __y) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4799
4800
4801
4802 extern long double remainderl (long double __x, long double __y) __attribute__ ((__nothrow__)); extern long double __remainderl (long double __x, long double __y) __attribute__ ((__nothrow__));
4803
4804
4805
4806 extern long double scalbnl (long double __x, int __n) __attribute__ ((__nothrow__)); extern long double __scalbnl (long double __x, int __n) __attribute__ ((__nothrow__));
4807
4808
4809
4810 extern int ilogbl (long double __x) __attribute__ ((__nothrow__)); extern int __ilogbl (long double __x) __attribute__ ((__nothrow__));
4811
4812
4813
4814
4815 extern long double scalblnl (long double __x, long int __n) __attribute__ ((__nothrow__)); extern long double __scalblnl (long double __x, long int __n) __attribute__ ((__nothrow__));
4816
4817
4818
4819 extern long double nearbyintl (long double __x) __attribute__ ((__nothrow__)); extern long double __nearbyintl (long double __x) __attribute__ ((__nothrow__));
4820
4821
4822
4823 extern long double roundl (long double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern long double __roundl (long double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4824
4825
4826
4827 extern long double truncl (long double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__)); extern long double __truncl (long double __x) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
4828
4829
4830
4831
4832 extern long double remquol (long double __x, long double __y, int *__quo) __attribute__ ((__nothrow__)); extern long double __remquol (long double __x, long double __y, int *__quo) __attribute__ ((__nothrow__));
4833
4834
4835
4836
4837
4838
4839 extern long int lrintl (long double __x) __attribute__ ((__nothrow__)); extern long int __lrintl (long double __x) __attribute__ ((__nothrow__));
4840 extern long long int llrintl (long double __x) __attribute__ ((__nothrow__)); extern long long int __llrintl (long double __x) __attribute__ ((__nothrow__));
4841
4842
4843
4844 extern long int lroundl (long double __x) __attribute__ ((__nothrow__)); extern long int __lroundl (long double __x) __attribute__ ((__nothrow__));
4845 extern long long int llroundl (long double __x) __attribute__ ((__nothrow__)); extern long long int __llroundl (long double __x) __attribute__ ((__nothrow__));
4846
4847
4848
4849 extern long double fdiml (long double __x, long double __y) __attribute__ ((__nothrow__)); extern long double __fdiml (long double __x, long double __y) __attribute__ ((__nothrow__));
4850
4851
4852 extern long double fmaxl (long double __x, long double __y) __attribute__ ((__nothrow__)); extern long double __fmaxl (long double __x, long double __y) __attribute__ ((__nothrow__));
4853
4854
4855 extern long double fminl (long double __x, long double __y) __attribute__ ((__nothrow__)); extern long double __fminl (long double __x, long double __y) __attribute__ ((__nothrow__));
4856
4857
4858
4859 extern int __fpclassifyl (long double __value) __attribute__ ((__nothrow__))
4860      __attribute__ ((__const__));
4861
4862
4863 extern int __signbitl (long double __value) __attribute__ ((__nothrow__))
4864      __attribute__ ((__const__));
4865
4866
4867
4868 extern long double fmal (long double __x, long double __y, long double __z) __attribute__ ((__nothrow__)); extern long double __fmal (long double __x, long double __y, long double __z) __attribute__ ((__nothrow__));
4869
4870
4871
4872
4873
4874
4875
4876
4877 extern long double scalbl (long double __x, long double __n) __attribute__ ((__nothrow__)); extern long double __scalbl (long double __x, long double __n) __attribute__ ((__nothrow__));
4878 # 142 "/usr/include/math.h" 2 3 4
4879 # 157 "/usr/include/math.h" 3 4
4880 extern int signgam;
4881 # 198 "/usr/include/math.h" 3 4
4882 enum
4883   {
4884     FP_NAN,
4885
4886     FP_INFINITE,
4887
4888     FP_ZERO,
4889
4890     FP_SUBNORMAL,
4891
4892     FP_NORMAL
4893
4894   };
4895 # 284 "/usr/include/math.h" 3 4
4896 typedef enum
4897 {
4898   _IEEE_ = -1,
4899   _SVID_,
4900   _XOPEN_,
4901   _POSIX_,
4902   _ISOC_
4903 } _LIB_VERSION_TYPE;
4904
4905
4906
4907
4908 extern _LIB_VERSION_TYPE _LIB_VERSION;
4909 # 309 "/usr/include/math.h" 3 4
4910 struct exception
4911
4912   {
4913     int type;
4914     char *name;
4915     double arg1;
4916     double arg2;
4917     double retval;
4918   };
4919
4920
4921
4922
4923 extern int matherr (struct exception *__exc);
4924 # 409 "/usr/include/math.h" 3 4
4925 # 1 "/usr/include/bits/mathinline.h" 1 3 4
4926 # 63 "/usr/include/bits/mathinline.h" 3 4
4927 extern __inline int
4928 __attribute__ ((__nothrow__)) __signbitf (float __x)
4929 {
4930   __extension__ union { float __f; int __i; } __u = { __f: __x };
4931   return __u.__i < 0;
4932 }
4933 extern __inline int
4934 __attribute__ ((__nothrow__)) __signbit (double __x)
4935 {
4936   __extension__ union { double __d; int __i[2]; } __u = { __d: __x };
4937   return __u.__i[0] < 0;
4938 }
4939
4940 extern __inline int
4941 __attribute__ ((__nothrow__)) __signbitl (long double __x)
4942 {
4943   __extension__ union { long double __d; int __i[4]; } __u = { __d: __x };
4944   return __u.__i[0] < 0;
4945 }
4946 # 116 "/usr/include/bits/mathinline.h" 3 4
4947 extern __inline double fdim (double __x, double __y) __attribute__ ((__nothrow__));
4948 extern __inline double
4949 __attribute__ ((__nothrow__)) fdim (double __x, double __y)
4950 {
4951   return __x <= __y ? 0 : __x - __y;
4952 }
4953
4954 extern __inline float fdimf (float __x, float __y) __attribute__ ((__nothrow__));
4955 extern __inline float
4956 __attribute__ ((__nothrow__)) fdimf (float __x, float __y)
4957 {
4958   return __x <= __y ? 0 : __x - __y;
4959 }
4960 # 410 "/usr/include/math.h" 2 3 4
4961 # 465 "/usr/include/math.h" 3 4
4962
4963 # 321 "./../include/my_global.h" 2
4964
4965 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include-fixed/limits.h" 1 3 4
4966 # 11 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include-fixed/limits.h" 3 4
4967 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include-fixed/syslimits.h" 1 3 4
4968
4969
4970
4971
4972
4973
4974 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include-fixed/limits.h" 1 3 4
4975 # 122 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include-fixed/limits.h" 3 4
4976 # 1 "/usr/include/limits.h" 1 3 4
4977 # 145 "/usr/include/limits.h" 3 4
4978 # 1 "/usr/include/bits/posix1_lim.h" 1 3 4
4979 # 157 "/usr/include/bits/posix1_lim.h" 3 4
4980 # 1 "/usr/include/bits/local_lim.h" 1 3 4
4981 # 40 "/usr/include/bits/local_lim.h" 3 4
4982 # 1 "/usr/include/linux/limits.h" 1 3 4
4983 # 41 "/usr/include/bits/local_lim.h" 2 3 4
4984 # 158 "/usr/include/bits/posix1_lim.h" 2 3 4
4985 # 146 "/usr/include/limits.h" 2 3 4
4986
4987
4988
4989 # 1 "/usr/include/bits/posix2_lim.h" 1 3 4
4990 # 150 "/usr/include/limits.h" 2 3 4
4991
4992
4993
4994 # 1 "/usr/include/bits/xopen_lim.h" 1 3 4
4995 # 34 "/usr/include/bits/xopen_lim.h" 3 4
4996 # 1 "/usr/include/bits/stdio_lim.h" 1 3 4
4997 # 35 "/usr/include/bits/xopen_lim.h" 2 3 4
4998 # 154 "/usr/include/limits.h" 2 3 4
4999 # 123 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include-fixed/limits.h" 2 3 4
5000 # 8 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include-fixed/syslimits.h" 2 3 4
5001 # 12 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include-fixed/limits.h" 2 3 4
5002 # 323 "./../include/my_global.h" 2
5003
5004
5005 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/float.h" 1 3 4
5006 # 326 "./../include/my_global.h" 2
5007
5008
5009 # 1 "/usr/include/fenv.h" 1 3 4
5010 # 58 "/usr/include/fenv.h" 3 4
5011 # 1 "/usr/include/bits/fenv.h" 1 3 4
5012 # 26 "/usr/include/bits/fenv.h" 3 4
5013 enum
5014   {
5015     FE_INEXACT = 1 << (31 - 6),
5016
5017     FE_DIVBYZERO = 1 << (31 - 5),
5018
5019     FE_UNDERFLOW = 1 << (31 - 4),
5020
5021     FE_OVERFLOW = 1 << (31 - 3),
5022 # 43 "/usr/include/bits/fenv.h" 3 4
5023     FE_INVALID = 1 << (31 - 2),
5024 # 54 "/usr/include/bits/fenv.h" 3 4
5025     FE_INVALID_SNAN = 1 << (31 - 7),
5026
5027
5028
5029     FE_INVALID_ISI = 1 << (31 - 8),
5030
5031
5032
5033     FE_INVALID_IDI = 1 << (31 - 9),
5034
5035
5036
5037     FE_INVALID_ZDZ = 1 << (31 - 10),
5038
5039
5040
5041     FE_INVALID_IMZ = 1 << (31 - 11),
5042
5043
5044
5045     FE_INVALID_COMPARE = 1 << (31 - 12),
5046
5047
5048
5049
5050
5051     FE_INVALID_SOFTWARE = 1 << (31 - 21),
5052
5053
5054
5055
5056     FE_INVALID_SQRT = 1 << (31 - 22),
5057
5058
5059
5060     FE_INVALID_INTEGER_CONVERSION = 1 << (31 - 23)
5061
5062
5063
5064
5065
5066
5067
5068   };
5069
5070
5071
5072
5073
5074
5075
5076 enum
5077   {
5078     FE_TONEAREST = 0,
5079
5080     FE_TOWARDZERO = 1,
5081
5082     FE_UPWARD = 2,
5083
5084     FE_DOWNWARD = 3
5085
5086   };
5087
5088
5089 typedef unsigned int fexcept_t;
5090
5091
5092
5093 typedef double fenv_t;
5094
5095
5096 extern const fenv_t __fe_dfl_env;
5097
5098
5099
5100
5101
5102 extern const fenv_t __fe_enabled_env;
5103
5104
5105
5106
5107 extern const fenv_t __fe_nonieee_env;
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118 extern const fenv_t *__fe_nomask_env (void);
5119
5120
5121
5122
5123
5124
5125
5126 extern const fenv_t *__fe_mask_env (void);
5127
5128
5129
5130 # 59 "/usr/include/fenv.h" 2 3 4
5131
5132
5133
5134
5135
5136
5137 extern int feclearexcept (int __excepts) __attribute__ ((__nothrow__));
5138
5139
5140
5141 extern int fegetexceptflag (fexcept_t *__flagp, int __excepts) __attribute__ ((__nothrow__));
5142
5143
5144 extern int feraiseexcept (int __excepts) __attribute__ ((__nothrow__));
5145
5146
5147
5148 extern int fesetexceptflag (__const fexcept_t *__flagp, int __excepts) __attribute__ ((__nothrow__));
5149
5150
5151
5152 extern int fetestexcept (int __excepts) __attribute__ ((__nothrow__));
5153
5154
5155
5156
5157
5158 extern int fegetround (void) __attribute__ ((__nothrow__));
5159
5160
5161 extern int fesetround (int __rounding_direction) __attribute__ ((__nothrow__));
5162
5163
5164
5165
5166
5167
5168 extern int fegetenv (fenv_t *__envp) __attribute__ ((__nothrow__));
5169
5170
5171
5172
5173 extern int feholdexcept (fenv_t *__envp) __attribute__ ((__nothrow__));
5174
5175
5176
5177 extern int fesetenv (__const fenv_t *__envp) __attribute__ ((__nothrow__));
5178
5179
5180
5181
5182 extern int feupdateenv (__const fenv_t *__envp) __attribute__ ((__nothrow__));
5183
5184
5185
5186
5187 # 1 "/usr/include/bits/fenvinline.h" 1 3 4
5188 # 116 "/usr/include/fenv.h" 2 3 4
5189
5190
5191
5192
5193
5194
5195
5196 extern int feenableexcept (int __excepts) __attribute__ ((__nothrow__));
5197
5198
5199
5200
5201 extern int fedisableexcept (int __excepts) __attribute__ ((__nothrow__));
5202
5203
5204 extern int fegetexcept (void) __attribute__ ((__nothrow__));
5205
5206
5207
5208 # 329 "./../include/my_global.h" 2
5209
5210
5211
5212
5213
5214
5215 # 1 "/usr/include/fcntl.h" 1 3 4
5216 # 30 "/usr/include/fcntl.h" 3 4
5217
5218
5219
5220
5221 # 1 "/usr/include/bits/fcntl.h" 1 3 4
5222 # 27 "/usr/include/bits/fcntl.h" 3 4
5223 # 1 "/usr/include/bits/uio.h" 1 3 4
5224 # 44 "/usr/include/bits/uio.h" 3 4
5225 struct iovec
5226   {
5227     void *iov_base;
5228     size_t iov_len;
5229   };
5230 # 28 "/usr/include/bits/fcntl.h" 2 3 4
5231 # 144 "/usr/include/bits/fcntl.h" 3 4
5232 struct flock
5233   {
5234     short int l_type;
5235     short int l_whence;
5236
5237     __off_t l_start;
5238     __off_t l_len;
5239
5240
5241
5242
5243     __pid_t l_pid;
5244   };
5245
5246
5247 struct flock64
5248   {
5249     short int l_type;
5250     short int l_whence;
5251     __off64_t l_start;
5252     __off64_t l_len;
5253     __pid_t l_pid;
5254   };
5255 # 211 "/usr/include/bits/fcntl.h" 3 4
5256
5257
5258
5259
5260
5261 extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
5262     __attribute__ ((__nothrow__));
5263
5264
5265
5266 extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
5267        unsigned int __flags);
5268
5269
5270
5271 extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
5272     size_t __count, unsigned int __flags);
5273
5274
5275 extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
5276          __off64_t *__offout, size_t __len,
5277          unsigned int __flags);
5278
5279
5280 extern ssize_t tee (int __fdin, int __fdout, size_t __len,
5281       unsigned int __flags);
5282
5283
5284
5285 extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
5286 # 251 "/usr/include/bits/fcntl.h" 3 4
5287 extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
5288    __off64_t __len);
5289
5290
5291
5292
5293
5294 # 35 "/usr/include/fcntl.h" 2 3 4
5295
5296
5297
5298 # 1 "/usr/include/sys/stat.h" 1 3 4
5299 # 105 "/usr/include/sys/stat.h" 3 4
5300
5301
5302 # 1 "/usr/include/bits/stat.h" 1 3 4
5303 # 24 "/usr/include/bits/stat.h" 3 4
5304 # 1 "/usr/include/bits/wordsize.h" 1 3 4
5305 # 25 "/usr/include/bits/stat.h" 2 3 4
5306 # 140 "/usr/include/bits/stat.h" 3 4
5307 struct stat
5308   {
5309     __dev_t st_dev;
5310
5311     __ino_t st_ino;
5312
5313
5314
5315     __nlink_t st_nlink;
5316     __mode_t st_mode;
5317     __uid_t st_uid;
5318     __gid_t st_gid;
5319     int __pad2;
5320     __dev_t st_rdev;
5321
5322     __off_t st_size;
5323
5324
5325
5326     __blksize_t st_blksize;
5327
5328
5329     __blkcnt_t st_blocks;
5330 # 173 "/usr/include/bits/stat.h" 3 4
5331     struct timespec st_atim;
5332     struct timespec st_mtim;
5333     struct timespec st_ctim;
5334 # 187 "/usr/include/bits/stat.h" 3 4
5335     unsigned long int __unused4;
5336     unsigned long int __unused5;
5337     unsigned long int __unused6;
5338   };
5339
5340
5341 struct stat64
5342   {
5343     __dev_t st_dev;
5344     __ino64_t st_ino;
5345     __nlink_t st_nlink;
5346     __mode_t st_mode;
5347     __uid_t st_uid;
5348     __gid_t st_gid;
5349     int __pad2;
5350     __dev_t st_rdev;
5351     __off64_t st_size;
5352     __blksize_t st_blksize;
5353     __blkcnt64_t st_blocks;
5354
5355
5356
5357
5358
5359
5360
5361     struct timespec st_atim;
5362     struct timespec st_mtim;
5363     struct timespec st_ctim;
5364 # 227 "/usr/include/bits/stat.h" 3 4
5365     unsigned long int __unused4;
5366     unsigned long int __unused5;
5367     unsigned long int __unused6;
5368   };
5369 # 108 "/usr/include/sys/stat.h" 2 3 4
5370 # 209 "/usr/include/sys/stat.h" 3 4
5371 extern int stat (__const char *__restrict __file,
5372    struct stat *__restrict __buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
5373
5374
5375
5376 extern int fstat (int __fd, struct stat *__buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
5377 # 228 "/usr/include/sys/stat.h" 3 4
5378 extern int stat64 (__const char *__restrict __file,
5379      struct stat64 *__restrict __buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
5380 extern int fstat64 (int __fd, struct stat64 *__buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
5381
5382
5383
5384
5385
5386
5387
5388 extern int fstatat (int __fd, __const char *__restrict __file,
5389       struct stat *__restrict __buf, int __flag)
5390      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
5391 # 253 "/usr/include/sys/stat.h" 3 4
5392 extern int fstatat64 (int __fd, __const char *__restrict __file,
5393         struct stat64 *__restrict __buf, int __flag)
5394      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
5395
5396
5397
5398
5399
5400
5401
5402 extern int lstat (__const char *__restrict __file,
5403     struct stat *__restrict __buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
5404 # 276 "/usr/include/sys/stat.h" 3 4
5405 extern int lstat64 (__const char *__restrict __file,
5406       struct stat64 *__restrict __buf)
5407      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
5408
5409
5410
5411
5412
5413 extern int chmod (__const char *__file, __mode_t __mode)
5414      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
5415
5416
5417
5418
5419
5420 extern int lchmod (__const char *__file, __mode_t __mode)
5421      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
5422
5423
5424
5425
5426 extern int fchmod (int __fd, __mode_t __mode) __attribute__ ((__nothrow__));
5427
5428
5429
5430
5431
5432 extern int fchmodat (int __fd, __const char *__file, __mode_t __mode,
5433        int __flag)
5434      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2))) __attribute__ ((__warn_unused_result__));
5435
5436
5437
5438
5439
5440
5441 extern __mode_t umask (__mode_t __mask) __attribute__ ((__nothrow__));
5442
5443
5444
5445
5446 extern __mode_t getumask (void) __attribute__ ((__nothrow__));
5447
5448
5449
5450 extern int mkdir (__const char *__path, __mode_t __mode)
5451      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
5452
5453
5454
5455
5456
5457 extern int mkdirat (int __fd, __const char *__path, __mode_t __mode)
5458      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
5459
5460
5461
5462
5463
5464
5465 extern int mknod (__const char *__path, __mode_t __mode, __dev_t __dev)
5466      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
5467
5468
5469
5470
5471
5472 extern int mknodat (int __fd, __const char *__path, __mode_t __mode,
5473       __dev_t __dev) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
5474
5475
5476
5477
5478
5479 extern int mkfifo (__const char *__path, __mode_t __mode)
5480      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
5481
5482
5483
5484
5485
5486 extern int mkfifoat (int __fd, __const char *__path, __mode_t __mode)
5487      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
5488
5489
5490
5491
5492
5493 extern int utimensat (int __fd, __const char *__path,
5494         __const struct timespec __times[2],
5495         int __flags)
5496      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
5497
5498
5499
5500
5501 extern int futimens (int __fd, __const struct timespec __times[2]) __attribute__ ((__nothrow__));
5502 # 399 "/usr/include/sys/stat.h" 3 4
5503 extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf)
5504      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3)));
5505 extern int __xstat (int __ver, __const char *__filename,
5506       struct stat *__stat_buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
5507 extern int __lxstat (int __ver, __const char *__filename,
5508        struct stat *__stat_buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
5509 extern int __fxstatat (int __ver, int __fildes, __const char *__filename,
5510          struct stat *__stat_buf, int __flag)
5511      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4)));
5512 # 432 "/usr/include/sys/stat.h" 3 4
5513 extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf)
5514      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3)));
5515 extern int __xstat64 (int __ver, __const char *__filename,
5516         struct stat64 *__stat_buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
5517 extern int __lxstat64 (int __ver, __const char *__filename,
5518          struct stat64 *__stat_buf) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
5519 extern int __fxstatat64 (int __ver, int __fildes, __const char *__filename,
5520     struct stat64 *__stat_buf, int __flag)
5521      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 4)));
5522
5523 extern int __xmknod (int __ver, __const char *__path, __mode_t __mode,
5524        __dev_t *__dev) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 4)));
5525
5526 extern int __xmknodat (int __ver, int __fd, __const char *__path,
5527          __mode_t __mode, __dev_t *__dev)
5528      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (3, 5)));
5529
5530
5531
5532
5533 extern __inline int
5534 __attribute__ ((__nothrow__)) stat (__const char *__path, struct stat *__statbuf)
5535 {
5536   return __xstat (1, __path, __statbuf);
5537 }
5538
5539
5540 extern __inline int
5541 __attribute__ ((__nothrow__)) lstat (__const char *__path, struct stat *__statbuf)
5542 {
5543   return __lxstat (1, __path, __statbuf);
5544 }
5545
5546
5547 extern __inline int
5548 __attribute__ ((__nothrow__)) fstat (int __fd, struct stat *__statbuf)
5549 {
5550   return __fxstat (1, __fd, __statbuf);
5551 }
5552
5553
5554 extern __inline int
5555 __attribute__ ((__nothrow__)) fstatat (int __fd, __const char *__filename, struct stat *__statbuf, int __flag)
5556
5557 {
5558   return __fxstatat (1, __fd, __filename, __statbuf, __flag);
5559 }
5560
5561
5562
5563 extern __inline int
5564 __attribute__ ((__nothrow__)) mknod (__const char *__path, __mode_t __mode, __dev_t __dev)
5565 {
5566   return __xmknod (1, __path, __mode, &__dev);
5567 }
5568
5569
5570
5571 extern __inline int
5572 __attribute__ ((__nothrow__)) mknodat (int __fd, __const char *__path, __mode_t __mode, __dev_t __dev)
5573
5574 {
5575   return __xmknodat (1, __fd, __path, __mode, &__dev);
5576 }
5577
5578
5579
5580
5581
5582 extern __inline int
5583 __attribute__ ((__nothrow__)) stat64 (__const char *__path, struct stat64 *__statbuf)
5584 {
5585   return __xstat64 (1, __path, __statbuf);
5586 }
5587
5588
5589 extern __inline int
5590 __attribute__ ((__nothrow__)) lstat64 (__const char *__path, struct stat64 *__statbuf)
5591 {
5592   return __lxstat64 (1, __path, __statbuf);
5593 }
5594
5595
5596 extern __inline int
5597 __attribute__ ((__nothrow__)) fstat64 (int __fd, struct stat64 *__statbuf)
5598 {
5599   return __fxstat64 (1, __fd, __statbuf);
5600 }
5601
5602
5603 extern __inline int
5604 __attribute__ ((__nothrow__)) fstatat64 (int __fd, __const char *__filename, struct stat64 *__statbuf, int __flag)
5605
5606 {
5607   return __fxstatat64 (1, __fd, __filename, __statbuf, __flag);
5608 }
5609
5610
5611
5612
5613
5614
5615
5616 # 39 "/usr/include/fcntl.h" 2 3 4
5617 # 76 "/usr/include/fcntl.h" 3 4
5618 extern int fcntl (int __fd, int __cmd, ...);
5619 # 85 "/usr/include/fcntl.h" 3 4
5620 extern int open (__const char *__file, int __oflag, ...) __attribute__ ((__nonnull__ (1)));
5621 # 95 "/usr/include/fcntl.h" 3 4
5622 extern int open64 (__const char *__file, int __oflag, ...) __attribute__ ((__nonnull__ (1)));
5623 # 109 "/usr/include/fcntl.h" 3 4
5624 extern int openat (int __fd, __const char *__file, int __oflag, ...)
5625      __attribute__ ((__nonnull__ (2)));
5626 # 120 "/usr/include/fcntl.h" 3 4
5627 extern int openat64 (int __fd, __const char *__file, int __oflag, ...)
5628      __attribute__ ((__nonnull__ (2)));
5629 # 130 "/usr/include/fcntl.h" 3 4
5630 extern int creat (__const char *__file, __mode_t __mode) __attribute__ ((__nonnull__ (1)));
5631 # 140 "/usr/include/fcntl.h" 3 4
5632 extern int creat64 (__const char *__file, __mode_t __mode) __attribute__ ((__nonnull__ (1)));
5633 # 159 "/usr/include/fcntl.h" 3 4
5634 extern int lockf (int __fd, int __cmd, __off_t __len);
5635 # 168 "/usr/include/fcntl.h" 3 4
5636 extern int lockf64 (int __fd, int __cmd, __off64_t __len);
5637
5638
5639
5640
5641
5642
5643
5644 extern int posix_fadvise (int __fd, __off_t __offset, __off_t __len,
5645      int __advise) __attribute__ ((__nothrow__));
5646 # 188 "/usr/include/fcntl.h" 3 4
5647 extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
5648        int __advise) __attribute__ ((__nothrow__));
5649 # 198 "/usr/include/fcntl.h" 3 4
5650 extern int posix_fallocate (int __fd, __off_t __offset, __off_t __len);
5651 # 209 "/usr/include/fcntl.h" 3 4
5652 extern int posix_fallocate64 (int __fd, __off64_t __offset, __off64_t __len);
5653
5654
5655
5656
5657
5658
5659
5660 # 1 "/usr/include/bits/fcntl2.h" 1 3 4
5661 # 27 "/usr/include/bits/fcntl2.h" 3 4
5662 extern int __open_2 (__const char *__path, int __oflag) __attribute__ ((__nonnull__ (1)));
5663 extern int __open_alias (__const char *__path, int __oflag, ...) __asm__ ("" "open") __attribute__ ((__nonnull__ (1)));
5664
5665
5666
5667
5668
5669
5670
5671 extern void __open_too_many_args (void) __attribute__((__error__ ("open can be called either with 2 or 3 arguments, not more")));
5672
5673 extern void __open_missing_mode (void) __attribute__((__error__ ("open with O_CREAT in second argument needs 3 arguments")));
5674
5675
5676 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
5677 open (__const char *__path, int __oflag, ...)
5678 {
5679   if (__builtin_va_arg_pack_len () > 1)
5680     __open_too_many_args ();
5681
5682   if (__builtin_constant_p (__oflag))
5683     {
5684       if ((__oflag & 0100) != 0 && __builtin_va_arg_pack_len () < 1)
5685  {
5686    __open_missing_mode ();
5687    return __open_2 (__path, __oflag);
5688  }
5689       return __open_alias (__path, __oflag, __builtin_va_arg_pack ());
5690     }
5691
5692   if (__builtin_va_arg_pack_len () < 1)
5693     return __open_2 (__path, __oflag);
5694
5695   return __open_alias (__path, __oflag, __builtin_va_arg_pack ());
5696 }
5697
5698
5699
5700 extern int __open64_2 (__const char *__path, int __oflag) __attribute__ ((__nonnull__ (1)));
5701 extern int __open64_alias (__const char *__path, int __oflag, ...) __asm__ ("" "open64") __attribute__ ((__nonnull__ (1)));
5702
5703 extern void __open64_too_many_args (void) __attribute__((__error__ ("open64 can be called either with 2 or 3 arguments, not more")));
5704
5705 extern void __open64_missing_mode (void) __attribute__((__error__ ("open64 with O_CREAT in second argument needs 3 arguments")));
5706
5707
5708 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
5709 open64 (__const char *__path, int __oflag, ...)
5710 {
5711   if (__builtin_va_arg_pack_len () > 1)
5712     __open64_too_many_args ();
5713
5714   if (__builtin_constant_p (__oflag))
5715     {
5716       if ((__oflag & 0100) != 0 && __builtin_va_arg_pack_len () < 1)
5717  {
5718    __open64_missing_mode ();
5719    return __open64_2 (__path, __oflag);
5720  }
5721       return __open64_alias (__path, __oflag, __builtin_va_arg_pack ());
5722     }
5723
5724   if (__builtin_va_arg_pack_len () < 1)
5725     return __open64_2 (__path, __oflag);
5726
5727   return __open64_alias (__path, __oflag, __builtin_va_arg_pack ());
5728 }
5729
5730
5731
5732
5733
5734 extern int __openat_2 (int __fd, __const char *__path, int __oflag)
5735      __attribute__ ((__nonnull__ (2)));
5736 extern int __openat_alias (int __fd, __const char *__path, int __oflag, ...) __asm__ ("" "openat")
5737
5738      __attribute__ ((__nonnull__ (2)));
5739 # 112 "/usr/include/bits/fcntl2.h" 3 4
5740 extern void __openat_too_many_args (void) __attribute__((__error__ ("openat can be called either with 3 or 4 arguments, not more")));
5741
5742 extern void __openat_missing_mode (void) __attribute__((__error__ ("openat with O_CREAT in third argument needs 4 arguments")));
5743
5744
5745 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
5746 openat (int __fd, __const char *__path, int __oflag, ...)
5747 {
5748   if (__builtin_va_arg_pack_len () > 1)
5749     __openat_too_many_args ();
5750
5751   if (__builtin_constant_p (__oflag))
5752     {
5753       if ((__oflag & 0100) != 0 && __builtin_va_arg_pack_len () < 1)
5754  {
5755    __openat_missing_mode ();
5756    return __openat_2 (__fd, __path, __oflag);
5757  }
5758       return __openat_alias (__fd, __path, __oflag, __builtin_va_arg_pack ());
5759     }
5760
5761   if (__builtin_va_arg_pack_len () < 1)
5762     return __openat_2 (__fd, __path, __oflag);
5763
5764   return __openat_alias (__fd, __path, __oflag, __builtin_va_arg_pack ());
5765 }
5766
5767
5768
5769 extern int __openat64_2 (int __fd, __const char *__path, int __oflag)
5770      __attribute__ ((__nonnull__ (2)));
5771 extern int __openat64_alias (int __fd, __const char *__path, int __oflag, ...) __asm__ ("" "openat64")
5772
5773      __attribute__ ((__nonnull__ (2)));
5774 extern void __openat64_too_many_args (void) __attribute__((__error__ ("openat64 can be called either with 3 or 4 arguments, not more")));
5775
5776 extern void __openat64_missing_mode (void) __attribute__((__error__ ("openat64 with O_CREAT in third argument needs 4 arguments")));
5777
5778
5779 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
5780 openat64 (int __fd, __const char *__path, int __oflag, ...)
5781 {
5782   if (__builtin_va_arg_pack_len () > 1)
5783     __openat64_too_many_args ();
5784
5785   if (__builtin_constant_p (__oflag))
5786     {
5787       if ((__oflag & 0100) != 0 && __builtin_va_arg_pack_len () < 1)
5788  {
5789    __openat64_missing_mode ();
5790    return __openat64_2 (__fd, __path, __oflag);
5791  }
5792       return __openat64_alias (__fd, __path, __oflag, __builtin_va_arg_pack ());
5793     }
5794
5795   if (__builtin_va_arg_pack_len () < 1)
5796     return __openat64_2 (__fd, __path, __oflag);
5797
5798   return __openat64_alias (__fd, __path, __oflag, __builtin_va_arg_pack ());
5799 }
5800 # 218 "/usr/include/fcntl.h" 2 3 4
5801
5802
5803
5804 # 336 "./../include/my_global.h" 2
5805
5806
5807 # 1 "/usr/include/sys/timeb.h" 1 3 4
5808 # 28 "/usr/include/sys/timeb.h" 3 4
5809
5810
5811
5812
5813 struct timeb
5814   {
5815     time_t time;
5816     unsigned short int millitm;
5817     short int timezone;
5818     short int dstflag;
5819   };
5820
5821
5822
5823 extern int ftime (struct timeb *__timebuf);
5824
5825
5826 # 339 "./../include/my_global.h" 2
5827
5828
5829 # 1 "/usr/include/sys/time.h" 1 3 4
5830 # 29 "/usr/include/sys/time.h" 3 4
5831 # 1 "/usr/include/bits/time.h" 1 3 4
5832 # 30 "/usr/include/sys/time.h" 2 3 4
5833 # 39 "/usr/include/sys/time.h" 3 4
5834
5835 # 57 "/usr/include/sys/time.h" 3 4
5836 struct timezone
5837   {
5838     int tz_minuteswest;
5839     int tz_dsttime;
5840   };
5841
5842 typedef struct timezone *__restrict __timezone_ptr_t;
5843 # 73 "/usr/include/sys/time.h" 3 4
5844 extern int gettimeofday (struct timeval *__restrict __tv,
5845     __timezone_ptr_t __tz) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
5846
5847
5848
5849
5850 extern int settimeofday (__const struct timeval *__tv,
5851     __const struct timezone *__tz)
5852      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
5853
5854
5855
5856
5857
5858 extern int adjtime (__const struct timeval *__delta,
5859       struct timeval *__olddelta) __attribute__ ((__nothrow__));
5860
5861
5862
5863
5864 enum __itimer_which
5865   {
5866
5867     ITIMER_REAL = 0,
5868
5869
5870     ITIMER_VIRTUAL = 1,
5871
5872
5873
5874     ITIMER_PROF = 2
5875
5876   };
5877
5878
5879
5880 struct itimerval
5881   {
5882
5883     struct timeval it_interval;
5884
5885     struct timeval it_value;
5886   };
5887
5888
5889
5890
5891 typedef enum __itimer_which __itimer_which_t;
5892
5893
5894
5895
5896
5897
5898 extern int getitimer (__itimer_which_t __which,
5899         struct itimerval *__value) __attribute__ ((__nothrow__));
5900
5901
5902
5903
5904 extern int setitimer (__itimer_which_t __which,
5905         __const struct itimerval *__restrict __new,
5906         struct itimerval *__restrict __old) __attribute__ ((__nothrow__));
5907
5908
5909
5910
5911 extern int utimes (__const char *__file, __const struct timeval __tvp[2])
5912      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
5913
5914
5915
5916 extern int lutimes (__const char *__file, __const struct timeval __tvp[2])
5917      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
5918
5919
5920 extern int futimes (int __fd, __const struct timeval __tvp[2]) __attribute__ ((__nothrow__));
5921
5922
5923
5924
5925
5926
5927 extern int futimesat (int __fd, __const char *__file,
5928         __const struct timeval __tvp[2]) __attribute__ ((__nothrow__));
5929 # 191 "/usr/include/sys/time.h" 3 4
5930
5931 # 342 "./../include/my_global.h" 2
5932 # 351 "./../include/my_global.h"
5933 # 1 "/usr/include/unistd.h" 1 3 4
5934 # 28 "/usr/include/unistd.h" 3 4
5935
5936 # 175 "/usr/include/unistd.h" 3 4
5937 # 1 "/usr/include/bits/posix_opt.h" 1 3 4
5938 # 176 "/usr/include/unistd.h" 2 3 4
5939
5940
5941
5942 # 1 "/usr/include/bits/environments.h" 1 3 4
5943 # 23 "/usr/include/bits/environments.h" 3 4
5944 # 1 "/usr/include/bits/wordsize.h" 1 3 4
5945 # 24 "/usr/include/bits/environments.h" 2 3 4
5946 # 180 "/usr/include/unistd.h" 2 3 4
5947 # 199 "/usr/include/unistd.h" 3 4
5948 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 1 3 4
5949 # 200 "/usr/include/unistd.h" 2 3 4
5950 # 240 "/usr/include/unistd.h" 3 4
5951 typedef __intptr_t intptr_t;
5952
5953
5954
5955
5956
5957
5958 typedef __socklen_t socklen_t;
5959 # 260 "/usr/include/unistd.h" 3 4
5960 extern int access (__const char *__name, int __type) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
5961
5962
5963
5964
5965 extern int euidaccess (__const char *__name, int __type)
5966      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
5967
5968
5969 extern int eaccess (__const char *__name, int __type)
5970      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
5971
5972
5973
5974
5975
5976
5977 extern int faccessat (int __fd, __const char *__file, int __type, int __flag)
5978      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2))) __attribute__ ((__warn_unused_result__));
5979 # 303 "/usr/include/unistd.h" 3 4
5980 extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__));
5981 # 314 "/usr/include/unistd.h" 3 4
5982 extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence)
5983      __attribute__ ((__nothrow__));
5984
5985
5986
5987
5988
5989
5990 extern int close (int __fd);
5991
5992
5993
5994
5995
5996
5997 extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __attribute__ ((__warn_unused_result__));
5998
5999
6000
6001
6002
6003 extern ssize_t write (int __fd, __const void *__buf, size_t __n) __attribute__ ((__warn_unused_result__));
6004 # 345 "/usr/include/unistd.h" 3 4
6005 extern ssize_t pread (int __fd, void *__buf, size_t __nbytes,
6006         __off_t __offset) __attribute__ ((__warn_unused_result__));
6007
6008
6009
6010
6011
6012
6013 extern ssize_t pwrite (int __fd, __const void *__buf, size_t __n,
6014          __off_t __offset) __attribute__ ((__warn_unused_result__));
6015 # 373 "/usr/include/unistd.h" 3 4
6016 extern ssize_t pread64 (int __fd, void *__buf, size_t __nbytes,
6017    __off64_t __offset) __attribute__ ((__warn_unused_result__));
6018
6019
6020 extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n,
6021     __off64_t __offset) __attribute__ ((__warn_unused_result__));
6022
6023
6024
6025
6026
6027
6028
6029 extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
6030
6031
6032
6033
6034 extern int pipe2 (int __pipedes[2], int __flags) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
6035 # 401 "/usr/include/unistd.h" 3 4
6036 extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__));
6037 # 413 "/usr/include/unistd.h" 3 4
6038 extern unsigned int sleep (unsigned int __seconds);
6039
6040
6041
6042
6043
6044
6045 extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval)
6046      __attribute__ ((__nothrow__));
6047
6048
6049
6050
6051
6052
6053 extern int usleep (__useconds_t __useconds);
6054 # 437 "/usr/include/unistd.h" 3 4
6055 extern int pause (void);
6056
6057
6058
6059 extern int chown (__const char *__file, __uid_t __owner, __gid_t __group)
6060      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
6061
6062
6063
6064 extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
6065
6066
6067
6068
6069 extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group)
6070      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
6071
6072
6073
6074
6075
6076
6077 extern int fchownat (int __fd, __const char *__file, __uid_t __owner,
6078        __gid_t __group, int __flag)
6079      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2))) __attribute__ ((__warn_unused_result__));
6080
6081
6082
6083 extern int chdir (__const char *__path) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
6084
6085
6086
6087 extern int fchdir (int __fd) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
6088 # 479 "/usr/include/unistd.h" 3 4
6089 extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
6090
6091
6092
6093
6094
6095 extern char *get_current_dir_name (void) __attribute__ ((__nothrow__));
6096
6097
6098
6099
6100
6101
6102 extern char *getwd (char *__buf)
6103      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) __attribute__ ((__warn_unused_result__));
6104
6105
6106
6107
6108 extern int dup (int __fd) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
6109
6110
6111 extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__));
6112
6113
6114
6115
6116 extern int dup3 (int __fd, int __fd2, int __flags) __attribute__ ((__nothrow__));
6117
6118
6119
6120 extern char **__environ;
6121
6122 extern char **environ;
6123
6124
6125
6126
6127
6128 extern int execve (__const char *__path, char *__const __argv[],
6129      char *__const __envp[]) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
6130
6131
6132
6133
6134 extern int fexecve (int __fd, char *__const __argv[], char *__const __envp[])
6135      __attribute__ ((__nothrow__));
6136
6137
6138
6139
6140 extern int execv (__const char *__path, char *__const __argv[])
6141      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
6142
6143
6144
6145 extern int execle (__const char *__path, __const char *__arg, ...)
6146      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
6147
6148
6149
6150 extern int execl (__const char *__path, __const char *__arg, ...)
6151      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
6152
6153
6154
6155 extern int execvp (__const char *__file, char *__const __argv[])
6156      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
6157
6158
6159
6160
6161 extern int execlp (__const char *__file, __const char *__arg, ...)
6162      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
6163
6164
6165
6166
6167 extern int nice (int __inc) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
6168
6169
6170
6171
6172 extern void _exit (int __status) __attribute__ ((__noreturn__));
6173
6174
6175
6176
6177
6178 # 1 "/usr/include/bits/confname.h" 1 3 4
6179 # 26 "/usr/include/bits/confname.h" 3 4
6180 enum
6181   {
6182     _PC_LINK_MAX,
6183
6184     _PC_MAX_CANON,
6185
6186     _PC_MAX_INPUT,
6187
6188     _PC_NAME_MAX,
6189
6190     _PC_PATH_MAX,
6191
6192     _PC_PIPE_BUF,
6193
6194     _PC_CHOWN_RESTRICTED,
6195
6196     _PC_NO_TRUNC,
6197
6198     _PC_VDISABLE,
6199
6200     _PC_SYNC_IO,
6201
6202     _PC_ASYNC_IO,
6203
6204     _PC_PRIO_IO,
6205
6206     _PC_SOCK_MAXBUF,
6207
6208     _PC_FILESIZEBITS,
6209
6210     _PC_REC_INCR_XFER_SIZE,
6211
6212     _PC_REC_MAX_XFER_SIZE,
6213
6214     _PC_REC_MIN_XFER_SIZE,
6215
6216     _PC_REC_XFER_ALIGN,
6217
6218     _PC_ALLOC_SIZE_MIN,
6219
6220     _PC_SYMLINK_MAX,
6221
6222     _PC_2_SYMLINKS
6223
6224   };
6225
6226
6227 enum
6228   {
6229     _SC_ARG_MAX,
6230
6231     _SC_CHILD_MAX,
6232
6233     _SC_CLK_TCK,
6234
6235     _SC_NGROUPS_MAX,
6236
6237     _SC_OPEN_MAX,
6238
6239     _SC_STREAM_MAX,
6240
6241     _SC_TZNAME_MAX,
6242
6243     _SC_JOB_CONTROL,
6244
6245     _SC_SAVED_IDS,
6246
6247     _SC_REALTIME_SIGNALS,
6248
6249     _SC_PRIORITY_SCHEDULING,
6250
6251     _SC_TIMERS,
6252
6253     _SC_ASYNCHRONOUS_IO,
6254
6255     _SC_PRIORITIZED_IO,
6256
6257     _SC_SYNCHRONIZED_IO,
6258
6259     _SC_FSYNC,
6260
6261     _SC_MAPPED_FILES,
6262
6263     _SC_MEMLOCK,
6264
6265     _SC_MEMLOCK_RANGE,
6266
6267     _SC_MEMORY_PROTECTION,
6268
6269     _SC_MESSAGE_PASSING,
6270
6271     _SC_SEMAPHORES,
6272
6273     _SC_SHARED_MEMORY_OBJECTS,
6274
6275     _SC_AIO_LISTIO_MAX,
6276
6277     _SC_AIO_MAX,
6278
6279     _SC_AIO_PRIO_DELTA_MAX,
6280
6281     _SC_DELAYTIMER_MAX,
6282
6283     _SC_MQ_OPEN_MAX,
6284
6285     _SC_MQ_PRIO_MAX,
6286
6287     _SC_VERSION,
6288
6289     _SC_PAGESIZE,
6290
6291
6292     _SC_RTSIG_MAX,
6293
6294     _SC_SEM_NSEMS_MAX,
6295
6296     _SC_SEM_VALUE_MAX,
6297
6298     _SC_SIGQUEUE_MAX,
6299
6300     _SC_TIMER_MAX,
6301
6302
6303
6304
6305     _SC_BC_BASE_MAX,
6306
6307     _SC_BC_DIM_MAX,
6308
6309     _SC_BC_SCALE_MAX,
6310
6311     _SC_BC_STRING_MAX,
6312
6313     _SC_COLL_WEIGHTS_MAX,
6314
6315     _SC_EQUIV_CLASS_MAX,
6316
6317     _SC_EXPR_NEST_MAX,
6318
6319     _SC_LINE_MAX,
6320
6321     _SC_RE_DUP_MAX,
6322
6323     _SC_CHARCLASS_NAME_MAX,
6324
6325
6326     _SC_2_VERSION,
6327
6328     _SC_2_C_BIND,
6329
6330     _SC_2_C_DEV,
6331
6332     _SC_2_FORT_DEV,
6333
6334     _SC_2_FORT_RUN,
6335
6336     _SC_2_SW_DEV,
6337
6338     _SC_2_LOCALEDEF,
6339
6340
6341     _SC_PII,
6342
6343     _SC_PII_XTI,
6344
6345     _SC_PII_SOCKET,
6346
6347     _SC_PII_INTERNET,
6348
6349     _SC_PII_OSI,
6350
6351     _SC_POLL,
6352
6353     _SC_SELECT,
6354
6355     _SC_UIO_MAXIOV,
6356
6357     _SC_IOV_MAX = _SC_UIO_MAXIOV,
6358
6359     _SC_PII_INTERNET_STREAM,
6360
6361     _SC_PII_INTERNET_DGRAM,
6362
6363     _SC_PII_OSI_COTS,
6364
6365     _SC_PII_OSI_CLTS,
6366
6367     _SC_PII_OSI_M,
6368
6369     _SC_T_IOV_MAX,
6370
6371
6372
6373     _SC_THREADS,
6374
6375     _SC_THREAD_SAFE_FUNCTIONS,
6376
6377     _SC_GETGR_R_SIZE_MAX,
6378
6379     _SC_GETPW_R_SIZE_MAX,
6380
6381     _SC_LOGIN_NAME_MAX,
6382
6383     _SC_TTY_NAME_MAX,
6384
6385     _SC_THREAD_DESTRUCTOR_ITERATIONS,
6386
6387     _SC_THREAD_KEYS_MAX,
6388
6389     _SC_THREAD_STACK_MIN,
6390
6391     _SC_THREAD_THREADS_MAX,
6392
6393     _SC_THREAD_ATTR_STACKADDR,
6394
6395     _SC_THREAD_ATTR_STACKSIZE,
6396
6397     _SC_THREAD_PRIORITY_SCHEDULING,
6398
6399     _SC_THREAD_PRIO_INHERIT,
6400
6401     _SC_THREAD_PRIO_PROTECT,
6402
6403     _SC_THREAD_PROCESS_SHARED,
6404
6405
6406     _SC_NPROCESSORS_CONF,
6407
6408     _SC_NPROCESSORS_ONLN,
6409
6410     _SC_PHYS_PAGES,
6411
6412     _SC_AVPHYS_PAGES,
6413
6414     _SC_ATEXIT_MAX,
6415
6416     _SC_PASS_MAX,
6417
6418
6419     _SC_XOPEN_VERSION,
6420
6421     _SC_XOPEN_XCU_VERSION,
6422
6423     _SC_XOPEN_UNIX,
6424
6425     _SC_XOPEN_CRYPT,
6426
6427     _SC_XOPEN_ENH_I18N,
6428
6429     _SC_XOPEN_SHM,
6430
6431
6432     _SC_2_CHAR_TERM,
6433
6434     _SC_2_C_VERSION,
6435
6436     _SC_2_UPE,
6437
6438
6439     _SC_XOPEN_XPG2,
6440
6441     _SC_XOPEN_XPG3,
6442
6443     _SC_XOPEN_XPG4,
6444
6445
6446     _SC_CHAR_BIT,
6447
6448     _SC_CHAR_MAX,
6449
6450     _SC_CHAR_MIN,
6451
6452     _SC_INT_MAX,
6453
6454     _SC_INT_MIN,
6455
6456     _SC_LONG_BIT,
6457
6458     _SC_WORD_BIT,
6459
6460     _SC_MB_LEN_MAX,
6461
6462     _SC_NZERO,
6463
6464     _SC_SSIZE_MAX,
6465
6466     _SC_SCHAR_MAX,
6467
6468     _SC_SCHAR_MIN,
6469
6470     _SC_SHRT_MAX,
6471
6472     _SC_SHRT_MIN,
6473
6474     _SC_UCHAR_MAX,
6475
6476     _SC_UINT_MAX,
6477
6478     _SC_ULONG_MAX,
6479
6480     _SC_USHRT_MAX,
6481
6482
6483     _SC_NL_ARGMAX,
6484
6485     _SC_NL_LANGMAX,
6486
6487     _SC_NL_MSGMAX,
6488
6489     _SC_NL_NMAX,
6490
6491     _SC_NL_SETMAX,
6492
6493     _SC_NL_TEXTMAX,
6494
6495
6496     _SC_XBS5_ILP32_OFF32,
6497
6498     _SC_XBS5_ILP32_OFFBIG,
6499
6500     _SC_XBS5_LP64_OFF64,
6501
6502     _SC_XBS5_LPBIG_OFFBIG,
6503
6504
6505     _SC_XOPEN_LEGACY,
6506
6507     _SC_XOPEN_REALTIME,
6508
6509     _SC_XOPEN_REALTIME_THREADS,
6510
6511
6512     _SC_ADVISORY_INFO,
6513
6514     _SC_BARRIERS,
6515
6516     _SC_BASE,
6517
6518     _SC_C_LANG_SUPPORT,
6519
6520     _SC_C_LANG_SUPPORT_R,
6521
6522     _SC_CLOCK_SELECTION,
6523
6524     _SC_CPUTIME,
6525
6526     _SC_THREAD_CPUTIME,
6527
6528     _SC_DEVICE_IO,
6529
6530     _SC_DEVICE_SPECIFIC,
6531
6532     _SC_DEVICE_SPECIFIC_R,
6533
6534     _SC_FD_MGMT,
6535
6536     _SC_FIFO,
6537
6538     _SC_PIPE,
6539
6540     _SC_FILE_ATTRIBUTES,
6541
6542     _SC_FILE_LOCKING,
6543
6544     _SC_FILE_SYSTEM,
6545
6546     _SC_MONOTONIC_CLOCK,
6547
6548     _SC_MULTI_PROCESS,
6549
6550     _SC_SINGLE_PROCESS,
6551
6552     _SC_NETWORKING,
6553
6554     _SC_READER_WRITER_LOCKS,
6555
6556     _SC_SPIN_LOCKS,
6557
6558     _SC_REGEXP,
6559
6560     _SC_REGEX_VERSION,
6561
6562     _SC_SHELL,
6563
6564     _SC_SIGNALS,
6565
6566     _SC_SPAWN,
6567
6568     _SC_SPORADIC_SERVER,
6569
6570     _SC_THREAD_SPORADIC_SERVER,
6571
6572     _SC_SYSTEM_DATABASE,
6573
6574     _SC_SYSTEM_DATABASE_R,
6575
6576     _SC_TIMEOUTS,
6577
6578     _SC_TYPED_MEMORY_OBJECTS,
6579
6580     _SC_USER_GROUPS,
6581
6582     _SC_USER_GROUPS_R,
6583
6584     _SC_2_PBS,
6585
6586     _SC_2_PBS_ACCOUNTING,
6587
6588     _SC_2_PBS_LOCATE,
6589
6590     _SC_2_PBS_MESSAGE,
6591
6592     _SC_2_PBS_TRACK,
6593
6594     _SC_SYMLOOP_MAX,
6595
6596     _SC_STREAMS,
6597
6598     _SC_2_PBS_CHECKPOINT,
6599
6600
6601     _SC_V6_ILP32_OFF32,
6602
6603     _SC_V6_ILP32_OFFBIG,
6604
6605     _SC_V6_LP64_OFF64,
6606
6607     _SC_V6_LPBIG_OFFBIG,
6608
6609
6610     _SC_HOST_NAME_MAX,
6611
6612     _SC_TRACE,
6613
6614     _SC_TRACE_EVENT_FILTER,
6615
6616     _SC_TRACE_INHERIT,
6617
6618     _SC_TRACE_LOG,
6619
6620
6621     _SC_LEVEL1_ICACHE_SIZE,
6622
6623     _SC_LEVEL1_ICACHE_ASSOC,
6624
6625     _SC_LEVEL1_ICACHE_LINESIZE,
6626
6627     _SC_LEVEL1_DCACHE_SIZE,
6628
6629     _SC_LEVEL1_DCACHE_ASSOC,
6630
6631     _SC_LEVEL1_DCACHE_LINESIZE,
6632
6633     _SC_LEVEL2_CACHE_SIZE,
6634
6635     _SC_LEVEL2_CACHE_ASSOC,
6636
6637     _SC_LEVEL2_CACHE_LINESIZE,
6638
6639     _SC_LEVEL3_CACHE_SIZE,
6640
6641     _SC_LEVEL3_CACHE_ASSOC,
6642
6643     _SC_LEVEL3_CACHE_LINESIZE,
6644
6645     _SC_LEVEL4_CACHE_SIZE,
6646
6647     _SC_LEVEL4_CACHE_ASSOC,
6648
6649     _SC_LEVEL4_CACHE_LINESIZE,
6650
6651
6652
6653     _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50,
6654
6655     _SC_RAW_SOCKETS,
6656
6657
6658     _SC_V7_ILP32_OFF32,
6659
6660     _SC_V7_ILP32_OFFBIG,
6661
6662     _SC_V7_LP64_OFF64,
6663
6664     _SC_V7_LPBIG_OFFBIG,
6665
6666
6667     _SC_SS_REPL_MAX,
6668
6669
6670     _SC_TRACE_EVENT_NAME_MAX,
6671
6672     _SC_TRACE_NAME_MAX,
6673
6674     _SC_TRACE_SYS_MAX,
6675
6676     _SC_TRACE_USER_EVENT_MAX,
6677
6678
6679     _SC_XOPEN_STREAMS,
6680
6681
6682     _SC_THREAD_ROBUST_PRIO_INHERIT,
6683
6684     _SC_THREAD_ROBUST_PRIO_PROTECT,
6685
6686   };
6687
6688
6689 enum
6690   {
6691     _CS_PATH,
6692
6693
6694     _CS_V6_WIDTH_RESTRICTED_ENVS,
6695
6696
6697
6698     _CS_GNU_LIBC_VERSION,
6699
6700     _CS_GNU_LIBPTHREAD_VERSION,
6701
6702
6703     _CS_V5_WIDTH_RESTRICTED_ENVS,
6704
6705
6706
6707     _CS_V7_WIDTH_RESTRICTED_ENVS,
6708
6709
6710
6711     _CS_LFS_CFLAGS = 1000,
6712
6713     _CS_LFS_LDFLAGS,
6714
6715     _CS_LFS_LIBS,
6716
6717     _CS_LFS_LINTFLAGS,
6718
6719     _CS_LFS64_CFLAGS,
6720
6721     _CS_LFS64_LDFLAGS,
6722
6723     _CS_LFS64_LIBS,
6724
6725     _CS_LFS64_LINTFLAGS,
6726
6727
6728     _CS_XBS5_ILP32_OFF32_CFLAGS = 1100,
6729
6730     _CS_XBS5_ILP32_OFF32_LDFLAGS,
6731
6732     _CS_XBS5_ILP32_OFF32_LIBS,
6733
6734     _CS_XBS5_ILP32_OFF32_LINTFLAGS,
6735
6736     _CS_XBS5_ILP32_OFFBIG_CFLAGS,
6737
6738     _CS_XBS5_ILP32_OFFBIG_LDFLAGS,
6739
6740     _CS_XBS5_ILP32_OFFBIG_LIBS,
6741
6742     _CS_XBS5_ILP32_OFFBIG_LINTFLAGS,
6743
6744     _CS_XBS5_LP64_OFF64_CFLAGS,
6745
6746     _CS_XBS5_LP64_OFF64_LDFLAGS,
6747
6748     _CS_XBS5_LP64_OFF64_LIBS,
6749
6750     _CS_XBS5_LP64_OFF64_LINTFLAGS,
6751
6752     _CS_XBS5_LPBIG_OFFBIG_CFLAGS,
6753
6754     _CS_XBS5_LPBIG_OFFBIG_LDFLAGS,
6755
6756     _CS_XBS5_LPBIG_OFFBIG_LIBS,
6757
6758     _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS,
6759
6760
6761     _CS_POSIX_V6_ILP32_OFF32_CFLAGS,
6762
6763     _CS_POSIX_V6_ILP32_OFF32_LDFLAGS,
6764
6765     _CS_POSIX_V6_ILP32_OFF32_LIBS,
6766
6767     _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS,
6768
6769     _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS,
6770
6771     _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS,
6772
6773     _CS_POSIX_V6_ILP32_OFFBIG_LIBS,
6774
6775     _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS,
6776
6777     _CS_POSIX_V6_LP64_OFF64_CFLAGS,
6778
6779     _CS_POSIX_V6_LP64_OFF64_LDFLAGS,
6780
6781     _CS_POSIX_V6_LP64_OFF64_LIBS,
6782
6783     _CS_POSIX_V6_LP64_OFF64_LINTFLAGS,
6784
6785     _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS,
6786
6787     _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS,
6788
6789     _CS_POSIX_V6_LPBIG_OFFBIG_LIBS,
6790
6791     _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS,
6792
6793
6794     _CS_POSIX_V7_ILP32_OFF32_CFLAGS,
6795
6796     _CS_POSIX_V7_ILP32_OFF32_LDFLAGS,
6797
6798     _CS_POSIX_V7_ILP32_OFF32_LIBS,
6799
6800     _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS,
6801
6802     _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS,
6803
6804     _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS,
6805
6806     _CS_POSIX_V7_ILP32_OFFBIG_LIBS,
6807
6808     _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS,
6809
6810     _CS_POSIX_V7_LP64_OFF64_CFLAGS,
6811
6812     _CS_POSIX_V7_LP64_OFF64_LDFLAGS,
6813
6814     _CS_POSIX_V7_LP64_OFF64_LIBS,
6815
6816     _CS_POSIX_V7_LP64_OFF64_LINTFLAGS,
6817
6818     _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS,
6819
6820     _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS,
6821
6822     _CS_POSIX_V7_LPBIG_OFFBIG_LIBS,
6823
6824     _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
6825
6826   };
6827 # 569 "/usr/include/unistd.h" 2 3 4
6828
6829
6830 extern long int pathconf (__const char *__path, int __name)
6831      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
6832
6833
6834 extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__));
6835
6836
6837 extern long int sysconf (int __name) __attribute__ ((__nothrow__));
6838
6839
6840
6841 extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__));
6842
6843
6844
6845
6846 extern __pid_t getpid (void) __attribute__ ((__nothrow__));
6847
6848
6849 extern __pid_t getppid (void) __attribute__ ((__nothrow__));
6850
6851
6852
6853
6854 extern __pid_t getpgrp (void) __attribute__ ((__nothrow__));
6855 # 605 "/usr/include/unistd.h" 3 4
6856 extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__));
6857
6858 extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__));
6859
6860
6861
6862
6863
6864
6865 extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__));
6866 # 631 "/usr/include/unistd.h" 3 4
6867 extern int setpgrp (void) __attribute__ ((__nothrow__));
6868 # 648 "/usr/include/unistd.h" 3 4
6869 extern __pid_t setsid (void) __attribute__ ((__nothrow__));
6870
6871
6872
6873 extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__));
6874
6875
6876
6877 extern __uid_t getuid (void) __attribute__ ((__nothrow__));
6878
6879
6880 extern __uid_t geteuid (void) __attribute__ ((__nothrow__));
6881
6882
6883 extern __gid_t getgid (void) __attribute__ ((__nothrow__));
6884
6885
6886 extern __gid_t getegid (void) __attribute__ ((__nothrow__));
6887
6888
6889
6890
6891 extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
6892
6893
6894
6895 extern int group_member (__gid_t __gid) __attribute__ ((__nothrow__));
6896
6897
6898
6899
6900
6901
6902 extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__));
6903
6904
6905
6906
6907 extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__));
6908
6909
6910
6911
6912 extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__));
6913
6914
6915
6916
6917
6918
6919 extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__));
6920
6921
6922
6923
6924 extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__));
6925
6926
6927
6928
6929 extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__));
6930
6931
6932
6933
6934
6935 extern int getresuid (__uid_t *__ruid, __uid_t *__euid, __uid_t *__suid)
6936      __attribute__ ((__nothrow__));
6937
6938
6939
6940 extern int getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid)
6941      __attribute__ ((__nothrow__));
6942
6943
6944
6945 extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid)
6946      __attribute__ ((__nothrow__));
6947
6948
6949
6950 extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid)
6951      __attribute__ ((__nothrow__));
6952
6953
6954
6955
6956
6957
6958 extern __pid_t fork (void) __attribute__ ((__nothrow__));
6959
6960
6961
6962
6963
6964
6965 extern __pid_t vfork (void) __attribute__ ((__nothrow__));
6966
6967
6968
6969
6970
6971 extern char *ttyname (int __fd) __attribute__ ((__nothrow__));
6972
6973
6974
6975 extern int ttyname_r (int __fd, char *__buf, size_t __buflen)
6976      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2))) __attribute__ ((__warn_unused_result__));
6977
6978
6979
6980 extern int isatty (int __fd) __attribute__ ((__nothrow__));
6981
6982
6983
6984
6985
6986 extern int ttyslot (void) __attribute__ ((__nothrow__));
6987
6988
6989
6990
6991 extern int link (__const char *__from, __const char *__to)
6992      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__warn_unused_result__));
6993
6994
6995
6996
6997 extern int linkat (int __fromfd, __const char *__from, int __tofd,
6998      __const char *__to, int __flags)
6999      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 4))) __attribute__ ((__warn_unused_result__));
7000
7001
7002
7003
7004 extern int symlink (__const char *__from, __const char *__to)
7005      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__warn_unused_result__));
7006
7007
7008
7009
7010 extern ssize_t readlink (__const char *__restrict __path,
7011     char *__restrict __buf, size_t __len)
7012      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__warn_unused_result__));
7013
7014
7015
7016
7017 extern int symlinkat (__const char *__from, int __tofd,
7018         __const char *__to) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3))) __attribute__ ((__warn_unused_result__));
7019
7020
7021 extern ssize_t readlinkat (int __fd, __const char *__restrict __path,
7022       char *__restrict __buf, size_t __len)
7023      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3))) __attribute__ ((__warn_unused_result__));
7024
7025
7026
7027 extern int unlink (__const char *__name) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
7028
7029
7030
7031 extern int unlinkat (int __fd, __const char *__name, int __flag)
7032      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
7033
7034
7035
7036 extern int rmdir (__const char *__path) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
7037
7038
7039
7040 extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__));
7041
7042
7043 extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__));
7044
7045
7046
7047
7048
7049
7050 extern char *getlogin (void);
7051
7052
7053
7054
7055
7056
7057
7058 extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1)));
7059
7060
7061
7062
7063 extern int setlogin (__const char *__name) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
7064 # 851 "/usr/include/unistd.h" 3 4
7065 # 1 "/usr/include/getopt.h" 1 3 4
7066 # 59 "/usr/include/getopt.h" 3 4
7067 extern char *optarg;
7068 # 73 "/usr/include/getopt.h" 3 4
7069 extern int optind;
7070
7071
7072
7073
7074 extern int opterr;
7075
7076
7077
7078 extern int optopt;
7079 # 152 "/usr/include/getopt.h" 3 4
7080 extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
7081        __attribute__ ((__nothrow__));
7082 # 852 "/usr/include/unistd.h" 2 3 4
7083
7084
7085
7086
7087
7088
7089
7090 extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
7091
7092
7093
7094
7095
7096
7097 extern int sethostname (__const char *__name, size_t __len)
7098      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
7099
7100
7101
7102 extern int sethostid (long int __id) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
7103
7104
7105
7106
7107
7108 extern int getdomainname (char *__name, size_t __len)
7109      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
7110 extern int setdomainname (__const char *__name, size_t __len)
7111      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
7112
7113
7114
7115
7116
7117 extern int vhangup (void) __attribute__ ((__nothrow__));
7118
7119
7120 extern int revoke (__const char *__file) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
7121
7122
7123
7124
7125
7126
7127
7128 extern int profil (unsigned short int *__sample_buffer, size_t __size,
7129      size_t __offset, unsigned int __scale)
7130      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
7131
7132
7133
7134
7135
7136 extern int acct (__const char *__name) __attribute__ ((__nothrow__));
7137
7138
7139
7140 extern char *getusershell (void) __attribute__ ((__nothrow__));
7141 extern void endusershell (void) __attribute__ ((__nothrow__));
7142 extern void setusershell (void) __attribute__ ((__nothrow__));
7143
7144
7145
7146
7147
7148 extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
7149
7150
7151
7152
7153
7154
7155 extern int chroot (__const char *__path) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
7156
7157
7158
7159 extern char *getpass (__const char *__prompt) __attribute__ ((__nonnull__ (1)));
7160 # 937 "/usr/include/unistd.h" 3 4
7161 extern int fsync (int __fd);
7162
7163
7164
7165
7166
7167
7168 extern long int gethostid (void);
7169
7170
7171 extern void sync (void) __attribute__ ((__nothrow__));
7172
7173
7174
7175
7176 extern int getpagesize (void) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
7177
7178
7179
7180
7181 extern int getdtablesize (void) __attribute__ ((__nothrow__));
7182
7183
7184
7185
7186 extern int truncate (__const char *__file, __off_t __length)
7187      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
7188 # 974 "/usr/include/unistd.h" 3 4
7189 extern int truncate64 (__const char *__file, __off64_t __length)
7190      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
7191 # 984 "/usr/include/unistd.h" 3 4
7192 extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
7193 # 994 "/usr/include/unistd.h" 3 4
7194 extern int ftruncate64 (int __fd, __off64_t __length) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
7195 # 1004 "/usr/include/unistd.h" 3 4
7196 extern int brk (void *__addr) __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
7197
7198
7199
7200
7201
7202 extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__));
7203 # 1025 "/usr/include/unistd.h" 3 4
7204 extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__));
7205 # 1079 "/usr/include/unistd.h" 3 4
7206 extern int fdatasync (int __fildes);
7207
7208
7209
7210
7211
7212
7213
7214 extern char *crypt (__const char *__key, __const char *__salt)
7215      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
7216
7217
7218
7219 extern void encrypt (char *__block, int __edflag) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
7220
7221
7222
7223
7224
7225
7226 extern void swab (__const void *__restrict __from, void *__restrict __to,
7227     ssize_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
7228
7229
7230
7231
7232
7233
7234
7235 extern char *ctermid (char *__s) __attribute__ ((__nothrow__));
7236
7237
7238
7239
7240
7241 # 1 "/usr/include/bits/unistd.h" 1 3 4
7242 # 24 "/usr/include/bits/unistd.h" 3 4
7243 extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes,
7244       size_t __buflen) __attribute__ ((__warn_unused_result__));
7245 extern ssize_t __read_alias (int __fd, void *__buf, size_t __nbytes) __asm__ ("" "read") __attribute__ ((__warn_unused_result__));
7246
7247 extern ssize_t __read_chk_warn (int __fd, void *__buf, size_t __nbytes, size_t __buflen) __asm__ ("" "__read_chk")
7248
7249
7250      __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("read called with bigger length than size of " "the destination buffer")));
7251
7252
7253 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) ssize_t
7254 read (int __fd, void *__buf, size_t __nbytes)
7255 {
7256   if (__builtin_object_size (__buf, 0) != (size_t) -1)
7257     {
7258       if (!__builtin_constant_p (__nbytes))
7259  return __read_chk (__fd, __buf, __nbytes, __builtin_object_size (__buf, 0));
7260
7261       if (__nbytes > __builtin_object_size (__buf, 0))
7262  return __read_chk_warn (__fd, __buf, __nbytes, __builtin_object_size (__buf, 0));
7263     }
7264   return __read_alias (__fd, __buf, __nbytes);
7265 }
7266
7267
7268 extern ssize_t __pread_chk (int __fd, void *__buf, size_t __nbytes,
7269        __off_t __offset, size_t __bufsize) __attribute__ ((__warn_unused_result__));
7270 extern ssize_t __pread64_chk (int __fd, void *__buf, size_t __nbytes,
7271          __off64_t __offset, size_t __bufsize) __attribute__ ((__warn_unused_result__));
7272 extern ssize_t __pread_alias (int __fd, void *__buf, size_t __nbytes, __off_t __offset) __asm__ ("" "pread") __attribute__ ((__warn_unused_result__));
7273
7274
7275 extern ssize_t __pread64_alias (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) __asm__ ("" "pread64") __attribute__ ((__warn_unused_result__));
7276
7277
7278 extern ssize_t __pread_chk_warn (int __fd, void *__buf, size_t __nbytes, __off_t __offset, size_t __bufsize) __asm__ ("" "__pread_chk")
7279
7280
7281      __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("pread called with bigger length than size of " "the destination buffer")));
7282
7283 extern ssize_t __pread64_chk_warn (int __fd, void *__buf, size_t __nbytes, __off64_t __offset, size_t __bufsize) __asm__ ("" "__pread64_chk")
7284
7285
7286
7287      __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("pread64 called with bigger length than size of " "the destination buffer")));
7288
7289
7290
7291 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) ssize_t
7292 pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
7293 {
7294   if (__builtin_object_size (__buf, 0) != (size_t) -1)
7295     {
7296       if (!__builtin_constant_p (__nbytes))
7297  return __pread_chk (__fd, __buf, __nbytes, __offset, __builtin_object_size (__buf, 0));
7298
7299       if ( __nbytes > __builtin_object_size (__buf, 0))
7300  return __pread_chk_warn (__fd, __buf, __nbytes, __offset,
7301      __builtin_object_size (__buf, 0));
7302     }
7303   return __pread_alias (__fd, __buf, __nbytes, __offset);
7304 }
7305 # 105 "/usr/include/bits/unistd.h" 3 4
7306 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) ssize_t
7307 pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
7308 {
7309   if (__builtin_object_size (__buf, 0) != (size_t) -1)
7310     {
7311       if (!__builtin_constant_p (__nbytes))
7312  return __pread64_chk (__fd, __buf, __nbytes, __offset, __builtin_object_size (__buf, 0));
7313
7314       if ( __nbytes > __builtin_object_size (__buf, 0))
7315  return __pread64_chk_warn (__fd, __buf, __nbytes, __offset,
7316        __builtin_object_size (__buf, 0));
7317     }
7318
7319   return __pread64_alias (__fd, __buf, __nbytes, __offset);
7320 }
7321
7322
7323
7324
7325 extern ssize_t __readlink_chk (__const char *__restrict __path,
7326           char *__restrict __buf, size_t __len,
7327           size_t __buflen)
7328      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__warn_unused_result__));
7329 extern ssize_t __readlink_alias (__const char *__restrict __path, char *__restrict __buf, size_t __len) __asm__ ("" "readlink") __attribute__ ((__nothrow__))
7330
7331
7332      __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__warn_unused_result__));
7333 extern ssize_t __readlink_chk_warn (__const char *__restrict __path, char *__restrict __buf, size_t __len, size_t __buflen) __asm__ ("" "__readlink_chk") __attribute__ ((__nothrow__))
7334
7335
7336
7337      __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("readlink called with bigger length " "than size of destination buffer")));
7338
7339
7340 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__warn_unused_result__)) ssize_t
7341 __attribute__ ((__nothrow__)) readlink (__const char *__restrict __path, char *__restrict __buf, size_t __len)
7342
7343 {
7344   if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
7345     {
7346       if (!__builtin_constant_p (__len))
7347  return __readlink_chk (__path, __buf, __len, __builtin_object_size (__buf, 2 > 1));
7348
7349       if ( __len > __builtin_object_size (__buf, 2 > 1))
7350  return __readlink_chk_warn (__path, __buf, __len, __builtin_object_size (__buf, 2 > 1));
7351     }
7352   return __readlink_alias (__path, __buf, __len);
7353 }
7354
7355
7356
7357 extern ssize_t __readlinkat_chk (int __fd, __const char *__restrict __path,
7358      char *__restrict __buf, size_t __len,
7359      size_t __buflen)
7360      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3))) __attribute__ ((__warn_unused_result__));
7361 extern ssize_t __readlinkat_alias (int __fd, __const char *__restrict __path, char *__restrict __buf, size_t __len) __asm__ ("" "readlinkat") __attribute__ ((__nothrow__))
7362
7363
7364
7365      __attribute__ ((__nonnull__ (2, 3))) __attribute__ ((__warn_unused_result__));
7366 extern ssize_t __readlinkat_chk_warn (int __fd, __const char *__restrict __path, char *__restrict __buf, size_t __len, size_t __buflen) __asm__ ("" "__readlinkat_chk") __attribute__ ((__nothrow__))
7367
7368
7369
7370      __attribute__ ((__nonnull__ (2, 3))) __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("readlinkat called with bigger " "length than size of destination " "buffer")));
7371
7372
7373
7374 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__nonnull__ (2, 3))) __attribute__ ((__warn_unused_result__)) ssize_t
7375 __attribute__ ((__nothrow__)) readlinkat (int __fd, __const char *__restrict __path, char *__restrict __buf, size_t __len)
7376
7377 {
7378   if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
7379     {
7380       if (!__builtin_constant_p (__len))
7381  return __readlinkat_chk (__fd, __path, __buf, __len, __builtin_object_size (__buf, 2 > 1));
7382
7383       if (__len > __builtin_object_size (__buf, 2 > 1))
7384  return __readlinkat_chk_warn (__fd, __path, __buf, __len,
7385           __builtin_object_size (__buf, 2 > 1));
7386     }
7387   return __readlinkat_alias (__fd, __path, __buf, __len);
7388 }
7389
7390
7391 extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen)
7392      __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
7393 extern char *__getcwd_alias (char *__buf, size_t __size) __asm__ ("" "getcwd") __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
7394
7395 extern char *__getcwd_chk_warn (char *__buf, size_t __size, size_t __buflen) __asm__ ("" "__getcwd_chk") __attribute__ ((__nothrow__))
7396
7397
7398      __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("getcwd caller with bigger length than size of " "destination buffer")));
7399
7400
7401 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) char *
7402 __attribute__ ((__nothrow__)) getcwd (char *__buf, size_t __size)
7403 {
7404   if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
7405     {
7406       if (!__builtin_constant_p (__size))
7407  return __getcwd_chk (__buf, __size, __builtin_object_size (__buf, 2 > 1));
7408
7409       if (__size > __builtin_object_size (__buf, 2 > 1))
7410  return __getcwd_chk_warn (__buf, __size, __builtin_object_size (__buf, 2 > 1));
7411     }
7412   return __getcwd_alias (__buf, __size);
7413 }
7414
7415
7416 extern char *__getwd_chk (char *__buf, size_t buflen)
7417      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
7418 extern char *__getwd_warn (char *__buf) __asm__ ("" "getwd") __attribute__ ((__nothrow__))
7419      __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("please use getcwd instead, as getwd " "doesn't specify buffer size")));
7420
7421
7422 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) __attribute__ ((__warn_unused_result__)) char *
7423 __attribute__ ((__nothrow__)) getwd (char *__buf)
7424 {
7425   if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
7426     return __getwd_chk (__buf, __builtin_object_size (__buf, 2 > 1));
7427   return __getwd_warn (__buf);
7428 }
7429
7430
7431 extern size_t __confstr_chk (int __name, char *__buf, size_t __len,
7432         size_t __buflen) __attribute__ ((__nothrow__));
7433 extern size_t __confstr_alias (int __name, char *__buf, size_t __len) __asm__ ("" "confstr") __attribute__ ((__nothrow__));
7434
7435 extern size_t __confstr_chk_warn (int __name, char *__buf, size_t __len, size_t __buflen) __asm__ ("" "__confstr_chk") __attribute__ ((__nothrow__))
7436
7437
7438      __attribute__((__warning__ ("confstr called with bigger length than size of destination " "buffer")));
7439
7440
7441 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) size_t
7442 __attribute__ ((__nothrow__)) confstr (int __name, char *__buf, size_t __len)
7443 {
7444   if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
7445     {
7446       if (!__builtin_constant_p (__len))
7447  return __confstr_chk (__name, __buf, __len, __builtin_object_size (__buf, 2 > 1));
7448
7449       if (__builtin_object_size (__buf, 2 > 1) < __len)
7450  return __confstr_chk_warn (__name, __buf, __len, __builtin_object_size (__buf, 2 > 1));
7451     }
7452   return __confstr_alias (__name, __buf, __len);
7453 }
7454
7455
7456 extern int __getgroups_chk (int __size, __gid_t __list[], size_t __listlen)
7457      __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
7458 extern int __getgroups_alias (int __size, __gid_t __list[]) __asm__ ("" "getgroups") __attribute__ ((__nothrow__)) __attribute__ ((__warn_unused_result__));
7459
7460 extern int __getgroups_chk_warn (int __size, __gid_t __list[], size_t __listlen) __asm__ ("" "__getgroups_chk") __attribute__ ((__nothrow__))
7461
7462
7463      __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("getgroups called with bigger group count than what " "can fit into destination buffer")));
7464
7465
7466 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
7467 __attribute__ ((__nothrow__)) getgroups (int __size, __gid_t __list[])
7468 {
7469   if (__builtin_object_size (__list, 2 > 1) != (size_t) -1)
7470     {
7471       if (!__builtin_constant_p (__size) || __size < 0)
7472  return __getgroups_chk (__size, __list, __builtin_object_size (__list, 2 > 1));
7473
7474       if (__size * sizeof (__gid_t) > __builtin_object_size (__list, 2 > 1))
7475  return __getgroups_chk_warn (__size, __list, __builtin_object_size (__list, 2 > 1));
7476     }
7477   return __getgroups_alias (__size, __list);
7478 }
7479
7480
7481 extern int __ttyname_r_chk (int __fd, char *__buf, size_t __buflen,
7482        size_t __nreal) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
7483 extern int __ttyname_r_alias (int __fd, char *__buf, size_t __buflen) __asm__ ("" "ttyname_r") __attribute__ ((__nothrow__))
7484
7485      __attribute__ ((__nonnull__ (2)));
7486 extern int __ttyname_r_chk_warn (int __fd, char *__buf, size_t __buflen, size_t __nreal) __asm__ ("" "__ttyname_r_chk") __attribute__ ((__nothrow__))
7487
7488
7489      __attribute__ ((__nonnull__ (2))) __attribute__((__warning__ ("ttyname_r called with bigger buflen than " "size of destination buffer")));
7490
7491
7492 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
7493 __attribute__ ((__nothrow__)) ttyname_r (int __fd, char *__buf, size_t __buflen)
7494 {
7495   if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
7496     {
7497       if (!__builtin_constant_p (__buflen))
7498  return __ttyname_r_chk (__fd, __buf, __buflen, __builtin_object_size (__buf, 2 > 1));
7499
7500       if (__buflen > __builtin_object_size (__buf, 2 > 1))
7501  return __ttyname_r_chk_warn (__fd, __buf, __buflen, __builtin_object_size (__buf, 2 > 1));
7502     }
7503   return __ttyname_r_alias (__fd, __buf, __buflen);
7504 }
7505
7506
7507
7508 extern int __getlogin_r_chk (char *__buf, size_t __buflen, size_t __nreal)
7509      __attribute__ ((__nonnull__ (1)));
7510 extern int __getlogin_r_alias (char *__buf, size_t __buflen) __asm__ ("" "getlogin_r") __attribute__ ((__nonnull__ (1)));
7511
7512 extern int __getlogin_r_chk_warn (char *__buf, size_t __buflen, size_t __nreal) __asm__ ("" "__getlogin_r_chk")
7513
7514
7515      __attribute__ ((__nonnull__ (1))) __attribute__((__warning__ ("getlogin_r called with bigger buflen than " "size of destination buffer")));
7516
7517
7518 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
7519 getlogin_r (char *__buf, size_t __buflen)
7520 {
7521   if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
7522     {
7523       if (!__builtin_constant_p (__buflen))
7524  return __getlogin_r_chk (__buf, __buflen, __builtin_object_size (__buf, 2 > 1));
7525
7526       if (__buflen > __builtin_object_size (__buf, 2 > 1))
7527  return __getlogin_r_chk_warn (__buf, __buflen, __builtin_object_size (__buf, 2 > 1));
7528     }
7529   return __getlogin_r_alias (__buf, __buflen);
7530 }
7531
7532
7533
7534
7535 extern int __gethostname_chk (char *__buf, size_t __buflen, size_t __nreal)
7536      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
7537 extern int __gethostname_alias (char *__buf, size_t __buflen) __asm__ ("" "gethostname") __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
7538
7539 extern int __gethostname_chk_warn (char *__buf, size_t __buflen, size_t __nreal) __asm__ ("" "__gethostname_chk") __attribute__ ((__nothrow__))
7540
7541
7542      __attribute__ ((__nonnull__ (1))) __attribute__((__warning__ ("gethostname called with bigger buflen than " "size of destination buffer")));
7543
7544
7545 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
7546 __attribute__ ((__nothrow__)) gethostname (char *__buf, size_t __buflen)
7547 {
7548   if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
7549     {
7550       if (!__builtin_constant_p (__buflen))
7551  return __gethostname_chk (__buf, __buflen, __builtin_object_size (__buf, 2 > 1));
7552
7553       if (__buflen > __builtin_object_size (__buf, 2 > 1))
7554  return __gethostname_chk_warn (__buf, __buflen, __builtin_object_size (__buf, 2 > 1));
7555     }
7556   return __gethostname_alias (__buf, __buflen);
7557 }
7558
7559
7560
7561
7562 extern int __getdomainname_chk (char *__buf, size_t __buflen, size_t __nreal)
7563      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
7564 extern int __getdomainname_alias (char *__buf, size_t __buflen) __asm__ ("" "getdomainname") __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
7565
7566
7567 extern int __getdomainname_chk_warn (char *__buf, size_t __buflen, size_t __nreal) __asm__ ("" "__getdomainname_chk") __attribute__ ((__nothrow__))
7568
7569
7570      __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("getdomainname called with bigger " "buflen than size of destination " "buffer")));
7571
7572
7573
7574 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
7575 __attribute__ ((__nothrow__)) getdomainname (char *__buf, size_t __buflen)
7576 {
7577   if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
7578     {
7579       if (!__builtin_constant_p (__buflen))
7580  return __getdomainname_chk (__buf, __buflen, __builtin_object_size (__buf, 2 > 1));
7581
7582       if (__buflen > __builtin_object_size (__buf, 2 > 1))
7583  return __getdomainname_chk_warn (__buf, __buflen, __builtin_object_size (__buf, 2 > 1));
7584     }
7585   return __getdomainname_alias (__buf, __buflen);
7586 }
7587 # 1115 "/usr/include/unistd.h" 2 3 4
7588
7589
7590
7591 # 352 "./../include/my_global.h" 2
7592 # 371 "./../include/my_global.h"
7593 # 1 "/usr/include/errno.h" 1 3 4
7594 # 32 "/usr/include/errno.h" 3 4
7595
7596
7597
7598
7599 # 1 "/usr/include/bits/errno.h" 1 3 4
7600 # 25 "/usr/include/bits/errno.h" 3 4
7601 # 1 "/usr/include/linux/errno.h" 1 3 4
7602
7603
7604
7605 # 1 "/usr/include/asm/errno.h" 1 3 4
7606
7607
7608
7609 # 1 "/usr/include/asm-generic/errno.h" 1 3 4
7610
7611
7612
7613 # 1 "/usr/include/asm-generic/errno-base.h" 1 3 4
7614 # 5 "/usr/include/asm-generic/errno.h" 2 3 4
7615 # 5 "/usr/include/asm/errno.h" 2 3 4
7616 # 5 "/usr/include/linux/errno.h" 2 3 4
7617 # 26 "/usr/include/bits/errno.h" 2 3 4
7618 # 43 "/usr/include/bits/errno.h" 3 4
7619 extern int *__errno_location (void) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
7620 # 37 "/usr/include/errno.h" 2 3 4
7621 # 55 "/usr/include/errno.h" 3 4
7622 extern char *program_invocation_name, *program_invocation_short_name;
7623
7624
7625
7626
7627 # 69 "/usr/include/errno.h" 3 4
7628 typedef int error_t;
7629 # 372 "./../include/my_global.h" 2
7630
7631
7632 # 1 "/usr/include/crypt.h" 1 3 4
7633 # 30 "/usr/include/crypt.h" 3 4
7634
7635
7636
7637 extern char *crypt (__const char *__key, __const char *__salt)
7638      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
7639
7640
7641 extern void setkey (__const char *__key) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
7642
7643
7644
7645 extern void encrypt (char *__block, int __edflag) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
7646
7647
7648
7649
7650 struct crypt_data
7651   {
7652     char keysched[16 * 8];
7653     char sb0[32768];
7654     char sb1[32768];
7655     char sb2[32768];
7656     char sb3[32768];
7657
7658     char crypt_3_buf[14];
7659     char current_salt[2];
7660     long int current_saltbits;
7661     int direction, initialized;
7662   };
7663
7664 extern char *crypt_r (__const char *__key, __const char *__salt,
7665         struct crypt_data * __restrict __data)
7666      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2, 3)));
7667
7668 extern void setkey_r (__const char *__key,
7669         struct crypt_data * __restrict __data)
7670      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
7671
7672 extern void encrypt_r (char *__block, int __edflag,
7673          struct crypt_data * __restrict __data)
7674      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3)));
7675
7676
7677
7678 # 375 "./../include/my_global.h" 2
7679
7680
7681
7682
7683
7684
7685
7686 # 1 "/usr/include/assert.h" 1 3 4
7687 # 66 "/usr/include/assert.h" 3 4
7688
7689
7690
7691 extern void __assert_fail (__const char *__assertion, __const char *__file,
7692       unsigned int __line, __const char *__function)
7693      __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
7694
7695
7696 extern void __assert_perror_fail (int __errnum, __const char *__file,
7697       unsigned int __line,
7698       __const char *__function)
7699      __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
7700
7701
7702
7703
7704 extern void __assert (const char *__assertion, const char *__file, int __line)
7705      __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__));
7706
7707
7708
7709 # 383 "./../include/my_global.h" 2
7710 # 508 "./../include/my_global.h"
7711 # 1 "./../include/my_attribute.h" 1
7712 # 509 "./../include/my_global.h" 2
7713 # 544 "./../include/my_global.h"
7714 # 1 "./../include/my_dbug.h" 1
7715 # 545 "./../include/my_global.h" 2
7716
7717
7718
7719
7720
7721
7722
7723 typedef int File;
7724
7725 typedef int my_socket;
7726
7727
7728
7729
7730
7731 typedef void (*sig_return)();
7732
7733
7734 typedef char pchar;
7735 typedef char puchar;
7736 typedef char pbool;
7737 typedef short pshort;
7738 typedef float pfloat;
7739
7740
7741
7742
7743
7744
7745
7746
7747 typedef int (*qsort_cmp)(const void *,const void *);
7748 typedef int (*qsort_cmp2)(void*, const void *,const void *);
7749
7750 # 590 "./../include/my_global.h"
7751 # 1 "/usr/include/sys/socket.h" 1 3 4
7752 # 26 "/usr/include/sys/socket.h" 3 4
7753
7754
7755 # 1 "/usr/include/sys/uio.h" 1 3 4
7756 # 26 "/usr/include/sys/uio.h" 3 4
7757
7758
7759
7760 # 1 "/usr/include/bits/uio.h" 1 3 4
7761 # 30 "/usr/include/sys/uio.h" 2 3 4
7762 # 40 "/usr/include/sys/uio.h" 3 4
7763 extern ssize_t readv (int __fd, __const struct iovec *__iovec, int __count)
7764   __attribute__ ((__warn_unused_result__));
7765 # 51 "/usr/include/sys/uio.h" 3 4
7766 extern ssize_t writev (int __fd, __const struct iovec *__iovec, int __count)
7767   __attribute__ ((__warn_unused_result__));
7768 # 66 "/usr/include/sys/uio.h" 3 4
7769 extern ssize_t preadv (int __fd, __const struct iovec *__iovec, int __count,
7770          __off_t __offset) __attribute__ ((__warn_unused_result__));
7771 # 78 "/usr/include/sys/uio.h" 3 4
7772 extern ssize_t pwritev (int __fd, __const struct iovec *__iovec, int __count,
7773    __off_t __offset) __attribute__ ((__warn_unused_result__));
7774 # 104 "/usr/include/sys/uio.h" 3 4
7775 extern ssize_t preadv64 (int __fd, __const struct iovec *__iovec, int __count,
7776     __off64_t __offset) __attribute__ ((__warn_unused_result__));
7777 # 116 "/usr/include/sys/uio.h" 3 4
7778 extern ssize_t pwritev64 (int __fd, __const struct iovec *__iovec, int __count,
7779      __off64_t __offset) __attribute__ ((__warn_unused_result__));
7780
7781
7782
7783
7784 # 29 "/usr/include/sys/socket.h" 2 3 4
7785
7786 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 1 3 4
7787 # 31 "/usr/include/sys/socket.h" 2 3 4
7788
7789
7790 # 1 "/usr/include/bits/sigset.h" 1 3 4
7791 # 34 "/usr/include/sys/socket.h" 2 3 4
7792
7793
7794
7795
7796
7797
7798 # 1 "/usr/include/bits/socket.h" 1 3 4
7799 # 29 "/usr/include/bits/socket.h" 3 4
7800 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 1 3 4
7801 # 30 "/usr/include/bits/socket.h" 2 3 4
7802 # 40 "/usr/include/bits/socket.h" 3 4
7803 enum __socket_type
7804 {
7805   SOCK_STREAM = 1,
7806
7807
7808   SOCK_DGRAM = 2,
7809
7810
7811   SOCK_RAW = 3,
7812
7813   SOCK_RDM = 4,
7814
7815   SOCK_SEQPACKET = 5,
7816
7817
7818   SOCK_DCCP = 6,
7819
7820   SOCK_PACKET = 10,
7821
7822
7823
7824
7825
7826
7827
7828   SOCK_CLOEXEC = 02000000,
7829
7830
7831   SOCK_NONBLOCK = 04000
7832
7833
7834 };
7835 # 169 "/usr/include/bits/socket.h" 3 4
7836 # 1 "/usr/include/bits/sockaddr.h" 1 3 4
7837 # 29 "/usr/include/bits/sockaddr.h" 3 4
7838 typedef unsigned short int sa_family_t;
7839 # 170 "/usr/include/bits/socket.h" 2 3 4
7840
7841
7842 struct sockaddr
7843   {
7844     sa_family_t sa_family;
7845     char sa_data[14];
7846   };
7847 # 185 "/usr/include/bits/socket.h" 3 4
7848 struct sockaddr_storage
7849   {
7850     sa_family_t ss_family;
7851     unsigned long int __ss_align;
7852     char __ss_padding[(128 - (2 * sizeof (unsigned long int)))];
7853   };
7854
7855
7856
7857 enum
7858   {
7859     MSG_OOB = 0x01,
7860
7861     MSG_PEEK = 0x02,
7862
7863     MSG_DONTROUTE = 0x04,
7864
7865
7866
7867     MSG_TRYHARD = MSG_DONTROUTE,
7868
7869
7870     MSG_CTRUNC = 0x08,
7871
7872     MSG_PROXY = 0x10,
7873
7874     MSG_TRUNC = 0x20,
7875
7876     MSG_DONTWAIT = 0x40,
7877
7878     MSG_EOR = 0x80,
7879
7880     MSG_WAITALL = 0x100,
7881
7882     MSG_FIN = 0x200,
7883
7884     MSG_SYN = 0x400,
7885
7886     MSG_CONFIRM = 0x800,
7887
7888     MSG_RST = 0x1000,
7889
7890     MSG_ERRQUEUE = 0x2000,
7891
7892     MSG_NOSIGNAL = 0x4000,
7893
7894     MSG_MORE = 0x8000,
7895
7896
7897     MSG_CMSG_CLOEXEC = 0x40000000
7898
7899
7900
7901   };
7902
7903
7904
7905
7906 struct msghdr
7907   {
7908     void *msg_name;
7909     socklen_t msg_namelen;
7910
7911     struct iovec *msg_iov;
7912     size_t msg_iovlen;
7913
7914     void *msg_control;
7915     size_t msg_controllen;
7916
7917
7918
7919
7920     int msg_flags;
7921   };
7922
7923
7924 struct cmsghdr
7925   {
7926     size_t cmsg_len;
7927
7928
7929
7930
7931     int cmsg_level;
7932     int cmsg_type;
7933
7934     __extension__ unsigned char __cmsg_data [];
7935
7936   };
7937 # 291 "/usr/include/bits/socket.h" 3 4
7938 extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
7939           struct cmsghdr *__cmsg) __attribute__ ((__nothrow__));
7940
7941
7942
7943
7944 extern __inline struct cmsghdr *
7945 __attribute__ ((__nothrow__)) __cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)
7946 {
7947   if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
7948
7949     return 0;
7950
7951   __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
7952           + (((__cmsg->cmsg_len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1)));
7953   if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
7954      + __mhdr->msg_controllen)
7955       || ((unsigned char *) __cmsg + (((__cmsg->cmsg_len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1))
7956    > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
7957
7958     return 0;
7959   return __cmsg;
7960 }
7961
7962
7963
7964
7965 enum
7966   {
7967     SCM_RIGHTS = 0x01
7968
7969
7970     , SCM_CREDENTIALS = 0x02
7971
7972
7973   };
7974
7975
7976
7977 struct ucred
7978 {
7979   pid_t pid;
7980   uid_t uid;
7981   gid_t gid;
7982 };
7983 # 364 "/usr/include/bits/socket.h" 3 4
7984 # 1 "/usr/include/asm/socket.h" 1 3 4
7985 # 11 "/usr/include/asm/socket.h" 3 4
7986 # 1 "/usr/include/asm/sockios.h" 1 3 4
7987 # 12 "/usr/include/asm/socket.h" 2 3 4
7988 # 365 "/usr/include/bits/socket.h" 2 3 4
7989 # 398 "/usr/include/bits/socket.h" 3 4
7990 struct linger
7991   {
7992     int l_onoff;
7993     int l_linger;
7994   };
7995 # 41 "/usr/include/sys/socket.h" 2 3 4
7996
7997
7998
7999
8000 struct osockaddr
8001   {
8002     unsigned short int sa_family;
8003     unsigned char sa_data[14];
8004   };
8005
8006
8007
8008
8009 enum
8010 {
8011   SHUT_RD = 0,
8012
8013   SHUT_WR,
8014
8015   SHUT_RDWR
8016
8017 };
8018 # 92 "/usr/include/sys/socket.h" 3 4
8019 typedef union { struct sockaddr *__restrict __sockaddr__; struct sockaddr_at *__restrict __sockaddr_at__; struct sockaddr_ax25 *__restrict __sockaddr_ax25__; struct sockaddr_dl *__restrict __sockaddr_dl__; struct sockaddr_eon *__restrict __sockaddr_eon__; struct sockaddr_in *__restrict __sockaddr_in__; struct sockaddr_in6 *__restrict __sockaddr_in6__; struct sockaddr_inarp *__restrict __sockaddr_inarp__; struct sockaddr_ipx *__restrict __sockaddr_ipx__; struct sockaddr_iso *__restrict __sockaddr_iso__; struct sockaddr_ns *__restrict __sockaddr_ns__; struct sockaddr_un *__restrict __sockaddr_un__; struct sockaddr_x25 *__restrict __sockaddr_x25__;
8020        } __SOCKADDR_ARG __attribute__ ((__transparent_union__));
8021
8022
8023 typedef union { __const struct sockaddr *__restrict __sockaddr__; __const struct sockaddr_at *__restrict __sockaddr_at__; __const struct sockaddr_ax25 *__restrict __sockaddr_ax25__; __const struct sockaddr_dl *__restrict __sockaddr_dl__; __const struct sockaddr_eon *__restrict __sockaddr_eon__; __const struct sockaddr_in *__restrict __sockaddr_in__; __const struct sockaddr_in6 *__restrict __sockaddr_in6__; __const struct sockaddr_inarp *__restrict __sockaddr_inarp__; __const struct sockaddr_ipx *__restrict __sockaddr_ipx__; __const struct sockaddr_iso *__restrict __sockaddr_iso__; __const struct sockaddr_ns *__restrict __sockaddr_ns__; __const struct sockaddr_un *__restrict __sockaddr_un__; __const struct sockaddr_x25 *__restrict __sockaddr_x25__;
8024        } __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__));
8025
8026
8027
8028
8029
8030
8031
8032 extern int socket (int __domain, int __type, int __protocol) __attribute__ ((__nothrow__));
8033
8034
8035
8036
8037
8038 extern int socketpair (int __domain, int __type, int __protocol,
8039          int __fds[2]) __attribute__ ((__nothrow__));
8040
8041
8042 extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len)
8043      __attribute__ ((__nothrow__));
8044
8045
8046 extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
8047    socklen_t *__restrict __len) __attribute__ ((__nothrow__));
8048 # 129 "/usr/include/sys/socket.h" 3 4
8049 extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len);
8050
8051
8052
8053 extern int getpeername (int __fd, __SOCKADDR_ARG __addr,
8054    socklen_t *__restrict __len) __attribute__ ((__nothrow__));
8055
8056
8057
8058
8059
8060
8061 extern ssize_t send (int __fd, __const void *__buf, size_t __n, int __flags);
8062
8063
8064
8065
8066
8067
8068 extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags);
8069
8070
8071
8072
8073
8074
8075 extern ssize_t sendto (int __fd, __const void *__buf, size_t __n,
8076          int __flags, __CONST_SOCKADDR_ARG __addr,
8077          socklen_t __addr_len);
8078 # 166 "/usr/include/sys/socket.h" 3 4
8079 extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
8080     int __flags, __SOCKADDR_ARG __addr,
8081     socklen_t *__restrict __addr_len);
8082
8083
8084
8085
8086
8087
8088
8089 extern ssize_t sendmsg (int __fd, __const struct msghdr *__message,
8090    int __flags);
8091
8092
8093
8094
8095
8096
8097 extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags);
8098
8099
8100
8101
8102
8103 extern int getsockopt (int __fd, int __level, int __optname,
8104          void *__restrict __optval,
8105          socklen_t *__restrict __optlen) __attribute__ ((__nothrow__));
8106
8107
8108
8109
8110 extern int setsockopt (int __fd, int __level, int __optname,
8111          __const void *__optval, socklen_t __optlen) __attribute__ ((__nothrow__));
8112
8113
8114
8115
8116
8117 extern int listen (int __fd, int __n) __attribute__ ((__nothrow__));
8118 # 214 "/usr/include/sys/socket.h" 3 4
8119 extern int accept (int __fd, __SOCKADDR_ARG __addr,
8120      socklen_t *__restrict __addr_len);
8121
8122
8123
8124
8125
8126
8127 extern int accept4 (int __fd, __SOCKADDR_ARG __addr,
8128       socklen_t *__restrict __addr_len, int __flags);
8129 # 232 "/usr/include/sys/socket.h" 3 4
8130 extern int shutdown (int __fd, int __how) __attribute__ ((__nothrow__));
8131
8132
8133
8134
8135 extern int sockatmark (int __fd) __attribute__ ((__nothrow__));
8136
8137
8138
8139
8140
8141
8142
8143 extern int isfdtype (int __fd, int __fdtype) __attribute__ ((__nothrow__));
8144
8145
8146
8147
8148
8149 # 1 "/usr/include/bits/socket2.h" 1 3 4
8150 # 24 "/usr/include/bits/socket2.h" 3 4
8151 extern ssize_t __recv_chk (int __fd, void *__buf, size_t __n, size_t __buflen,
8152       int __flags);
8153 extern ssize_t __recv_alias (int __fd, void *__buf, size_t __n, int __flags) __asm__ ("" "recv");
8154
8155 extern ssize_t __recv_chk_warn (int __fd, void *__buf, size_t __n, size_t __buflen, int __flags) __asm__ ("" "__recv_chk")
8156
8157
8158      __attribute__((__warning__ ("recv called with bigger length than size of destination " "buffer")));
8159
8160
8161 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) ssize_t
8162 recv (int __fd, void *__buf, size_t __n, int __flags)
8163 {
8164   if (__builtin_object_size (__buf, 0) != (size_t) -1)
8165     {
8166       if (!__builtin_constant_p (__n))
8167  return __recv_chk (__fd, __buf, __n, __builtin_object_size (__buf, 0), __flags);
8168
8169       if (__n > __builtin_object_size (__buf, 0))
8170  return __recv_chk_warn (__fd, __buf, __n, __builtin_object_size (__buf, 0), __flags);
8171     }
8172   return __recv_alias (__fd, __buf, __n, __flags);
8173 }
8174
8175 extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n,
8176           size_t __buflen, int __flags,
8177           __SOCKADDR_ARG __addr,
8178           socklen_t *__restrict __addr_len);
8179 extern ssize_t __recvfrom_alias (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) __asm__ ("" "recvfrom");
8180
8181
8182
8183 extern ssize_t __recvfrom_chk_warn (int __fd, void *__restrict __buf, size_t __n, size_t __buflen, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) __asm__ ("" "__recvfrom_chk")
8184
8185
8186
8187
8188      __attribute__((__warning__ ("recvfrom called with bigger length than size of " "destination buffer")));
8189
8190
8191 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) ssize_t
8192 recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags,
8193    __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len)
8194 {
8195   if (__builtin_object_size (__buf, 0) != (size_t) -1)
8196     {
8197       if (!__builtin_constant_p (__n))
8198  return __recvfrom_chk (__fd, __buf, __n, __builtin_object_size (__buf, 0), __flags,
8199           __addr, __addr_len);
8200       if (__n > __builtin_object_size (__buf, 0))
8201  return __recvfrom_chk_warn (__fd, __buf, __n, __builtin_object_size (__buf, 0), __flags,
8202         __addr, __addr_len);
8203     }
8204   return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len);
8205 }
8206 # 252 "/usr/include/sys/socket.h" 2 3 4
8207
8208
8209
8210 # 591 "./../include/my_global.h" 2
8211
8212 typedef socklen_t size_socket;
8213 # 834 "./../include/my_global.h"
8214 typedef long long my_ptrdiff_t;
8215 # 882 "./../include/my_global.h"
8216 typedef char *gptr;
8217
8218
8219 typedef signed char int8;
8220 typedef short int16;
8221
8222
8223 typedef unsigned char uchar;
8224
8225 typedef unsigned char uint8;
8226 typedef unsigned short uint16;
8227
8228
8229
8230 typedef int int32;
8231
8232 typedef unsigned int uint32;
8233 # 918 "./../include/my_global.h"
8234 typedef unsigned long long int ulonglong;
8235 typedef long long int longlong;
8236 # 931 "./../include/my_global.h"
8237 typedef unsigned long long my_ulonglong;
8238 # 951 "./../include/my_global.h"
8239 typedef ulonglong my_off_t;
8240
8241
8242
8243
8244
8245 typedef off_t os_off_t;
8246 # 991 "./../include/my_global.h"
8247 typedef uint8 int7;
8248 typedef short int15;
8249 typedef char *my_string;
8250 typedef unsigned long size_s;
8251 typedef int myf;
8252
8253 typedef char byte;
8254
8255 typedef char my_bool;
8256
8257 typedef char bool;
8258 # 34 "./include/univ.i" 2
8259 # 1 "./../include/my_pthread.h" 1
8260 # 21 "./../include/my_pthread.h"
8261 # 1 "/usr/include/errno.h" 1 3 4
8262 # 22 "./../include/my_pthread.h" 2
8263 # 288 "./../include/my_pthread.h"
8264 extern int my_pthread_getprio(pthread_t thread_id);
8265
8266
8267
8268
8269
8270
8271 typedef void *(* pthread_handler)(void *);
8272 # 382 "./../include/my_pthread.h"
8273 extern void my_pthread_setprio(pthread_t thread_id,int prior);
8274
8275
8276
8277
8278
8279
8280
8281 extern void my_pthread_attr_setprio(pthread_attr_t *attr, int priority);
8282 # 549 "./../include/my_pthread.h"
8283 typedef struct st_safe_mutex_t
8284 {
8285   pthread_mutex_t global,mutex;
8286   const char *file;
8287   uint line,count;
8288   pthread_t thread;
8289
8290
8291
8292 } safe_mutex_t;
8293 # 576 "./../include/my_pthread.h"
8294 int safe_mutex_init(safe_mutex_t *mp, const pthread_mutexattr_t *attr,
8295                     const char *file, uint line);
8296 int safe_mutex_lock(safe_mutex_t *mp, my_bool try_lock, const char *file, uint line);
8297 int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line);
8298 int safe_mutex_destroy(safe_mutex_t *mp,const char *file, uint line);
8299 int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp,const char *file,
8300      uint line);
8301 int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
8302    struct timespec *abstime, const char *file, uint line);
8303 void safe_mutex_global_init(void);
8304 void safe_mutex_end(FILE *file);
8305 # 690 "./../include/my_pthread.h"
8306 extern pthread_mutexattr_t my_fast_mutexattr;
8307
8308
8309
8310
8311
8312 extern pthread_mutexattr_t my_errorcheck_mutexattr;
8313 # 707 "./../include/my_pthread.h"
8314 extern my_bool my_thread_global_init(void);
8315 extern void my_thread_global_end(void);
8316 extern my_bool my_thread_init(void);
8317 extern void my_thread_end(void);
8318 extern const char *my_thread_name(void);
8319 extern long my_thread_id(void);
8320 extern int pthread_no_free(void *);
8321 extern int pthread_dummy(int);
8322 # 731 "./../include/my_pthread.h"
8323 struct st_my_thread_var
8324 {
8325   int thr_errno;
8326   pthread_cond_t suspend;
8327   pthread_mutex_t mutex;
8328   pthread_mutex_t * volatile current_mutex;
8329   pthread_cond_t * volatile current_cond;
8330   pthread_t pthread_self;
8331   long id;
8332   int cmp_length;
8333   int volatile abort;
8334   my_bool init;
8335   struct st_my_thread_var *next,**prev;
8336   void *opt_info;
8337
8338
8339
8340
8341 };
8342
8343 extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
8344 extern uint my_thread_end_wait_time;
8345 # 766 "./../include/my_pthread.h"
8346 extern uint thd_lib_detected;
8347 # 35 "./include/univ.i" 2
8348 # 44 "./include/univ.i"
8349 # 1 "./include/../ib_config.h" 1
8350 # 45 "./include/univ.i" 2
8351 # 187 "./include/univ.i"
8352 typedef unsigned long int ulint;
8353
8354 typedef long int lint;
8355
8356
8357
8358
8359
8360 typedef longlong ib_longlong;
8361
8362
8363 typedef unsigned long long int ullint;
8364 # 207 "./include/univ.i"
8365 typedef double utfloat;
8366 # 272 "./include/univ.i"
8367 # 1 "./include/ut0dbg.h" 1
8368 # 12 "./include/ut0dbg.h"
8369 # 1 "./include/univ.i" 1
8370 # 13 "./include/ut0dbg.h" 2
8371
8372 # 1 "./include/os0thread.h" 1
8373 # 33 "./include/os0thread.h"
8374 typedef pthread_t os_thread_t;
8375 typedef os_thread_t os_thread_id_t;
8376
8377
8378
8379
8380
8381 typedef void* (*os_posix_f_t) (void*);
8382
8383
8384
8385
8386 ulint
8387 os_thread_eq(
8388
8389
8390  os_thread_id_t a,
8391  os_thread_id_t b);
8392
8393
8394
8395
8396 ulint
8397 os_thread_pf(
8398
8399
8400  os_thread_id_t a);
8401
8402
8403
8404
8405
8406
8407
8408 os_thread_t
8409 os_thread_create(
8410
8411
8412
8413    os_posix_f_t start_f,
8414
8415
8416
8417
8418  void* arg,
8419
8420  os_thread_id_t* thread_id);
8421
8422 int
8423 os_thread_join(
8424
8425   os_thread_id_t thread_id);
8426
8427
8428
8429 void
8430 os_thread_exit(
8431
8432  void* exit_value);
8433
8434
8435
8436
8437 os_thread_id_t
8438 os_thread_get_curr_id(void);
8439
8440
8441
8442
8443 os_thread_t
8444 os_thread_get_curr(void);
8445
8446
8447
8448
8449 void
8450 os_thread_yield(void);
8451
8452
8453
8454
8455 void
8456 os_thread_sleep(
8457
8458  ulint tm);
8459
8460
8461
8462 ulint
8463 os_thread_get_priority(
8464
8465
8466  os_thread_t handle);
8467
8468
8469
8470 void
8471 os_thread_set_priority(
8472
8473  os_thread_t handle,
8474  ulint pri);
8475
8476
8477
8478 ulint
8479 os_thread_get_last_error(void);
8480
8481
8482
8483 # 1 "./include/os0thread.ic" 1
8484 # 143 "./include/os0thread.h" 2
8485 # 15 "./include/ut0dbg.h" 2
8486 # 27 "./include/ut0dbg.h"
8487 void
8488 ut_dbg_assertion_failed(
8489
8490  const char* expr,
8491  const char* file,
8492  ulint line);
8493 # 46 "./include/ut0dbg.h"
8494 extern ulint ut_dbg_stop_threads;
8495
8496
8497 extern ulint* ut_dbg_null_ptr;
8498
8499
8500
8501
8502 void
8503 ut_dbg_stop_thread(
8504
8505  const char* file,
8506  ulint line);
8507 # 273 "./include/univ.i" 2
8508 # 1 "./include/ut0ut.h" 1
8509 # 15 "./include/ut0ut.h"
8510 # 1 "/usr/include/ctype.h" 1 3 4
8511 # 30 "/usr/include/ctype.h" 3 4
8512
8513 # 48 "/usr/include/ctype.h" 3 4
8514 enum
8515 {
8516   _ISupper = (1 << (0)),
8517   _ISlower = (1 << (1)),
8518   _ISalpha = (1 << (2)),
8519   _ISdigit = (1 << (3)),
8520   _ISxdigit = (1 << (4)),
8521   _ISspace = (1 << (5)),
8522   _ISprint = (1 << (6)),
8523   _ISgraph = (1 << (7)),
8524   _ISblank = (1 << (8)),
8525   _IScntrl = (1 << (9)),
8526   _ISpunct = (1 << (10)),
8527   _ISalnum = (1 << (11))
8528 };
8529 # 81 "/usr/include/ctype.h" 3 4
8530 extern __const unsigned short int **__ctype_b_loc (void)
8531      __attribute__ ((__nothrow__)) __attribute__ ((__const));
8532 extern __const __int32_t **__ctype_tolower_loc (void)
8533      __attribute__ ((__nothrow__)) __attribute__ ((__const));
8534 extern __const __int32_t **__ctype_toupper_loc (void)
8535      __attribute__ ((__nothrow__)) __attribute__ ((__const));
8536 # 96 "/usr/include/ctype.h" 3 4
8537
8538
8539
8540
8541
8542
8543 extern int isalnum (int) __attribute__ ((__nothrow__));
8544 extern int isalpha (int) __attribute__ ((__nothrow__));
8545 extern int iscntrl (int) __attribute__ ((__nothrow__));
8546 extern int isdigit (int) __attribute__ ((__nothrow__));
8547 extern int islower (int) __attribute__ ((__nothrow__));
8548 extern int isgraph (int) __attribute__ ((__nothrow__));
8549 extern int isprint (int) __attribute__ ((__nothrow__));
8550 extern int ispunct (int) __attribute__ ((__nothrow__));
8551 extern int isspace (int) __attribute__ ((__nothrow__));
8552 extern int isupper (int) __attribute__ ((__nothrow__));
8553 extern int isxdigit (int) __attribute__ ((__nothrow__));
8554
8555
8556
8557 extern int tolower (int __c) __attribute__ ((__nothrow__));
8558
8559
8560 extern int toupper (int __c) __attribute__ ((__nothrow__));
8561
8562
8563
8564
8565
8566
8567
8568
8569 extern int isblank (int) __attribute__ ((__nothrow__));
8570
8571
8572
8573
8574
8575
8576 extern int isctype (int __c, int __mask) __attribute__ ((__nothrow__));
8577
8578
8579
8580
8581
8582
8583 extern int isascii (int __c) __attribute__ ((__nothrow__));
8584
8585
8586
8587 extern int toascii (int __c) __attribute__ ((__nothrow__));
8588
8589
8590
8591 extern int _toupper (int) __attribute__ ((__nothrow__));
8592 extern int _tolower (int) __attribute__ ((__nothrow__));
8593 # 190 "/usr/include/ctype.h" 3 4
8594 extern __inline int
8595 __attribute__ ((__nothrow__)) tolower (int __c)
8596 {
8597   return __c >= -128 && __c < 256 ? (*__ctype_tolower_loc ())[__c] : __c;
8598 }
8599
8600 extern __inline int
8601 __attribute__ ((__nothrow__)) toupper (int __c)
8602 {
8603   return __c >= -128 && __c < 256 ? (*__ctype_toupper_loc ())[__c] : __c;
8604 }
8605 # 247 "/usr/include/ctype.h" 3 4
8606 extern int isalnum_l (int, __locale_t) __attribute__ ((__nothrow__));
8607 extern int isalpha_l (int, __locale_t) __attribute__ ((__nothrow__));
8608 extern int iscntrl_l (int, __locale_t) __attribute__ ((__nothrow__));
8609 extern int isdigit_l (int, __locale_t) __attribute__ ((__nothrow__));
8610 extern int islower_l (int, __locale_t) __attribute__ ((__nothrow__));
8611 extern int isgraph_l (int, __locale_t) __attribute__ ((__nothrow__));
8612 extern int isprint_l (int, __locale_t) __attribute__ ((__nothrow__));
8613 extern int ispunct_l (int, __locale_t) __attribute__ ((__nothrow__));
8614 extern int isspace_l (int, __locale_t) __attribute__ ((__nothrow__));
8615 extern int isupper_l (int, __locale_t) __attribute__ ((__nothrow__));
8616 extern int isxdigit_l (int, __locale_t) __attribute__ ((__nothrow__));
8617
8618 extern int isblank_l (int, __locale_t) __attribute__ ((__nothrow__));
8619
8620
8621
8622 extern int __tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__));
8623 extern int tolower_l (int __c, __locale_t __l) __attribute__ ((__nothrow__));
8624
8625
8626 extern int __toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__));
8627 extern int toupper_l (int __c, __locale_t __l) __attribute__ ((__nothrow__));
8628 # 323 "/usr/include/ctype.h" 3 4
8629
8630 # 16 "./include/ut0ut.h" 2
8631
8632
8633 typedef time_t ib_time_t;
8634
8635
8636
8637
8638
8639
8640 ulint
8641 ut_get_high32(
8642
8643
8644  ulint a);
8645
8646
8647 static inline
8648 ulint
8649 ut_min(
8650
8651
8652  ulint n1,
8653  ulint n2);
8654
8655
8656 static inline
8657 ulint
8658 ut_max(
8659
8660
8661  ulint n1,
8662  ulint n2);
8663
8664
8665 static inline
8666 void
8667 ut_pair_min(
8668
8669  ulint* a,
8670  ulint* b,
8671  ulint a1,
8672  ulint b1,
8673  ulint a2,
8674  ulint b2);
8675
8676
8677 static inline
8678 int
8679 ut_ulint_cmp(
8680
8681
8682  ulint a,
8683  ulint b);
8684
8685
8686 static inline
8687 int
8688 ut_pair_cmp(
8689
8690
8691
8692  ulint a1,
8693  ulint a2,
8694  ulint b1,
8695  ulint b2);
8696
8697
8698 static inline
8699 ulint
8700 ut_2pow_remainder(
8701
8702  ulint n,
8703  ulint m);
8704
8705
8706 static inline
8707 ulint
8708 ut_2pow_round(
8709
8710
8711  ulint n,
8712  ulint m);
8713
8714
8715
8716 static inline
8717 ulint
8718 ut_2_log(
8719
8720
8721  ulint n);
8722
8723
8724 static inline
8725 ulint
8726 ut_2_exp(
8727
8728
8729  ulint n);
8730
8731
8732
8733 ulint
8734 ut_2_power_up(
8735
8736
8737  ulint n);
8738
8739
8740
8741 void
8742 ut_ulint_sort(ulint* arr, ulint* aux_arr, ulint low, ulint high);
8743
8744
8745
8746
8747 ulint
8748 ut_clock(void);
8749
8750
8751
8752
8753 ib_time_t
8754 ut_time(void);
8755
8756
8757
8758
8759
8760
8761
8762 int
8763 ut_usectime(
8764
8765
8766  ulint* sec,
8767  ulint* ms);
8768
8769
8770
8771 double
8772 ut_difftime(
8773
8774
8775  ib_time_t time2,
8776  ib_time_t time1);
8777
8778
8779
8780 void
8781 ut_print_timestamp(
8782
8783  FILE* file);
8784
8785
8786
8787 void
8788 ut_sprintf_timestamp(
8789
8790  char* buf);
8791
8792
8793
8794
8795 void
8796 ut_sprintf_timestamp_without_extra_chars(
8797
8798  char* buf);
8799
8800
8801
8802 void
8803 ut_get_year_month_day(
8804
8805  ulint* year,
8806  ulint* month,
8807  ulint* day);
8808
8809
8810
8811
8812 ulint
8813 ut_delay(
8814
8815
8816  ulint delay);
8817
8818
8819
8820 void
8821 ut_print_buf(
8822
8823  FILE* file,
8824  const unsigned char* buf,
8825  ulint len);
8826
8827
8828
8829
8830 void
8831 ut_print_filename(
8832
8833  FILE* f,
8834  const char* name);
8835
8836
8837
8838
8839 struct trx_struct;
8840
8841 void
8842 ut_print_name(
8843
8844  FILE* f,
8845  struct trx_struct*trx,
8846  const char* name);
8847
8848
8849
8850
8851 void
8852 ut_print_namel(
8853
8854  FILE* f,
8855  struct trx_struct*trx,
8856  const char* name,
8857  ulint namelen);
8858
8859
8860
8861
8862 void
8863 ut_copy_file(
8864
8865  FILE* dest,
8866  FILE* src);
8867
8868
8869 # 1 "./include/ut0ut.ic" 1
8870 # 11 "./include/ut0ut.ic"
8871 static inline
8872 ulint
8873 ut_min(
8874
8875
8876  ulint n1,
8877  ulint n2)
8878 {
8879  return((n1 <= n2) ? n1 : n2);
8880 }
8881
8882
8883
8884 static inline
8885 ulint
8886 ut_max(
8887
8888
8889  ulint n1,
8890  ulint n2)
8891 {
8892  return((n1 <= n2) ? n2 : n1);
8893 }
8894
8895
8896
8897 static inline
8898 void
8899 ut_pair_min(
8900
8901  ulint* a,
8902  ulint* b,
8903  ulint a1,
8904  ulint b1,
8905  ulint a2,
8906  ulint b2)
8907 {
8908  if (a1 == a2) {
8909   *a = a1;
8910   *b = ut_min(b1, b2);
8911  } else if (a1 < a2) {
8912   *a = a1;
8913   *b = b1;
8914  } else {
8915   *a = a2;
8916   *b = b2;
8917  }
8918 }
8919
8920
8921
8922 static inline
8923 int
8924 ut_ulint_cmp(
8925
8926
8927  ulint a,
8928  ulint b)
8929 {
8930  if (a < b) {
8931   return(-1);
8932  } else if (a == b) {
8933   return(0);
8934  } else {
8935   return(1);
8936  }
8937 }
8938
8939
8940
8941 static inline
8942 int
8943 ut_pair_cmp(
8944
8945
8946  ulint a1,
8947  ulint a2,
8948  ulint b1,
8949  ulint b2)
8950 {
8951  if (a1 > b1) {
8952   return(1);
8953  } else if (a1 < b1) {
8954   return(-1);
8955  } else if (a2 > b2) {
8956   return(1);
8957  } else if (a2 < b2) {
8958   return(-1);
8959  } else {
8960   return(0);
8961  }
8962 }
8963
8964
8965
8966 static inline
8967 ulint
8968 ut_2pow_remainder(
8969
8970  ulint n,
8971  ulint m)
8972 {
8973  ;
8974
8975  return(n & (m - 1));
8976 }
8977
8978
8979
8980 static inline
8981 ulint
8982 ut_2pow_round(
8983
8984
8985  ulint n,
8986  ulint m)
8987 {
8988  ;
8989
8990  return(n & ~(m - 1));
8991 }
8992
8993
8994
8995
8996 static inline
8997 ulint
8998 ut_2_log(
8999
9000
9001  ulint n)
9002 {
9003  ulint res;
9004
9005  res = 0;
9006
9007  ;
9008
9009  n = n - 1;
9010
9011  for (;;) {
9012   n = n / 2;
9013
9014   if (n == 0) {
9015    break;
9016   }
9017
9018   res++;
9019  }
9020
9021  return(res + 1);
9022 }
9023
9024
9025
9026 static inline
9027 ulint
9028 ut_2_exp(
9029
9030
9031  ulint n)
9032 {
9033  return((ulint) 1 << n);
9034 }
9035 # 255 "./include/ut0ut.h" 2
9036 # 274 "./include/univ.i" 2
9037 # 1 "./include/db0err.h" 1
9038 # 275 "./include/univ.i" 2
9039 # 27 "./include/buf0buf.h" 2
9040 # 1 "./include/fil0fil.h" 1
9041 # 13 "./include/fil0fil.h"
9042 # 1 "./include/sync0rw.h" 1
9043 # 13 "./include/sync0rw.h"
9044 # 1 "./include/ut0lst.h" 1
9045 # 14 "./include/sync0rw.h" 2
9046 # 1 "./include/sync0sync.h" 1
9047 # 13 "./include/sync0sync.h"
9048 # 1 "./include/sync0types.h" 1
9049 # 13 "./include/sync0types.h"
9050 typedef struct mutex_struct ib_mutex_t;
9051 # 14 "./include/sync0sync.h" 2
9052
9053 # 1 "./include/ut0mem.h" 1
9054 # 13 "./include/ut0mem.h"
9055 # 1 "/usr/include/string.h" 1 3 4
9056 # 28 "/usr/include/string.h" 3 4
9057
9058
9059
9060
9061
9062 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 1 3 4
9063 # 34 "/usr/include/string.h" 2 3 4
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073 extern void *memcpy (void *__restrict __dest,
9074        __const void *__restrict __src, size_t __n)
9075      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9076
9077
9078 extern void *memmove (void *__dest, __const void *__src, size_t __n)
9079      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9080
9081
9082
9083
9084
9085
9086 extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
9087         int __c, size_t __n)
9088      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9089
9090
9091
9092
9093
9094 extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
9095
9096
9097 extern int memcmp (__const void *__s1, __const void *__s2, size_t __n)
9098      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
9099 # 94 "/usr/include/string.h" 3 4
9100 extern void *memchr (__const void *__s, int __c, size_t __n)
9101       __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
9102
9103
9104 # 108 "/usr/include/string.h" 3 4
9105 extern void *rawmemchr (__const void *__s, int __c)
9106      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
9107 # 119 "/usr/include/string.h" 3 4
9108 extern void *memrchr (__const void *__s, int __c, size_t __n)
9109       __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
9110
9111
9112
9113
9114
9115
9116 extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
9117      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9118
9119 extern char *strncpy (char *__restrict __dest,
9120         __const char *__restrict __src, size_t __n)
9121      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9122
9123
9124 extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
9125      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9126
9127 extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
9128         size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9129
9130
9131 extern int strcmp (__const char *__s1, __const char *__s2)
9132      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
9133
9134 extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
9135      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
9136
9137
9138 extern int strcoll (__const char *__s1, __const char *__s2)
9139      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
9140
9141 extern size_t strxfrm (char *__restrict __dest,
9142          __const char *__restrict __src, size_t __n)
9143      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
9144
9145 # 164 "/usr/include/string.h" 3 4
9146 extern int strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l)
9147      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3)));
9148
9149 extern size_t strxfrm_l (char *__dest, __const char *__src, size_t __n,
9150     __locale_t __l) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 4)));
9151
9152
9153
9154
9155 extern char *strdup (__const char *__s)
9156      __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));
9157
9158
9159
9160
9161
9162
9163 extern char *strndup (__const char *__string, size_t __n)
9164      __attribute__ ((__nothrow__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));
9165 # 208 "/usr/include/string.h" 3 4
9166
9167 # 233 "/usr/include/string.h" 3 4
9168 extern char *strchr (__const char *__s, int __c)
9169      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
9170 # 260 "/usr/include/string.h" 3 4
9171 extern char *strrchr (__const char *__s, int __c)
9172      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
9173
9174
9175 # 274 "/usr/include/string.h" 3 4
9176 extern char *strchrnul (__const char *__s, int __c)
9177      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
9178
9179
9180
9181
9182
9183
9184 extern size_t strcspn (__const char *__s, __const char *__reject)
9185      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
9186
9187
9188 extern size_t strspn (__const char *__s, __const char *__accept)
9189      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
9190 # 312 "/usr/include/string.h" 3 4
9191 extern char *strpbrk (__const char *__s, __const char *__accept)
9192      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
9193 # 340 "/usr/include/string.h" 3 4
9194 extern char *strstr (__const char *__haystack, __const char *__needle)
9195      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
9196
9197
9198
9199
9200 extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
9201      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
9202
9203
9204
9205
9206 extern char *__strtok_r (char *__restrict __s,
9207     __const char *__restrict __delim,
9208     char **__restrict __save_ptr)
9209      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
9210
9211 extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
9212          char **__restrict __save_ptr)
9213      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 3)));
9214 # 371 "/usr/include/string.h" 3 4
9215 extern char *strcasestr (__const char *__haystack, __const char *__needle)
9216      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
9217
9218
9219
9220
9221
9222
9223
9224 extern void *memmem (__const void *__haystack, size_t __haystacklen,
9225        __const void *__needle, size_t __needlelen)
9226      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 3)));
9227
9228
9229
9230 extern void *__mempcpy (void *__restrict __dest,
9231    __const void *__restrict __src, size_t __n)
9232      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9233 extern void *mempcpy (void *__restrict __dest,
9234         __const void *__restrict __src, size_t __n)
9235      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9236
9237
9238
9239
9240
9241 extern size_t strlen (__const char *__s)
9242      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
9243
9244
9245
9246
9247
9248 extern size_t strnlen (__const char *__string, size_t __maxlen)
9249      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
9250
9251
9252
9253
9254
9255 extern char *strerror (int __errnum) __attribute__ ((__nothrow__));
9256
9257 # 436 "/usr/include/string.h" 3 4
9258 extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
9259      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
9260
9261
9262
9263
9264
9265 extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__));
9266
9267
9268
9269
9270
9271 extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
9272
9273
9274
9275 extern void bcopy (__const void *__src, void *__dest, size_t __n)
9276      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9277
9278
9279 extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
9280
9281
9282 extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
9283      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
9284 # 487 "/usr/include/string.h" 3 4
9285 extern char *index (__const char *__s, int __c)
9286      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
9287 # 515 "/usr/include/string.h" 3 4
9288 extern char *rindex (__const char *__s, int __c)
9289      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
9290
9291
9292
9293
9294 extern int ffs (int __i) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
9295
9296
9297
9298
9299 extern int ffsl (long int __l) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
9300
9301 __extension__ extern int ffsll (long long int __ll)
9302      __attribute__ ((__nothrow__)) __attribute__ ((__const__));
9303
9304
9305
9306
9307 extern int strcasecmp (__const char *__s1, __const char *__s2)
9308      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
9309
9310
9311 extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
9312      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
9313
9314
9315
9316
9317
9318 extern int strcasecmp_l (__const char *__s1, __const char *__s2,
9319     __locale_t __loc)
9320      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3)));
9321
9322 extern int strncasecmp_l (__const char *__s1, __const char *__s2,
9323      size_t __n, __locale_t __loc)
9324      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 4)));
9325
9326
9327
9328
9329
9330 extern char *strsep (char **__restrict __stringp,
9331        __const char *__restrict __delim)
9332      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9333
9334
9335
9336
9337 extern char *strsignal (int __sig) __attribute__ ((__nothrow__));
9338
9339
9340 extern char *__stpcpy (char *__restrict __dest, __const char *__restrict __src)
9341      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9342 extern char *stpcpy (char *__restrict __dest, __const char *__restrict __src)
9343      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9344
9345
9346
9347 extern char *__stpncpy (char *__restrict __dest,
9348    __const char *__restrict __src, size_t __n)
9349      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9350 extern char *stpncpy (char *__restrict __dest,
9351         __const char *__restrict __src, size_t __n)
9352      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
9353
9354
9355
9356
9357 extern int strverscmp (__const char *__s1, __const char *__s2)
9358      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
9359
9360
9361 extern char *strfry (char *__string) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
9362
9363
9364 extern void *memfrob (void *__s, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
9365 # 604 "/usr/include/string.h" 3 4
9366 extern char *basename (__const char *__filename) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
9367 # 632 "/usr/include/string.h" 3 4
9368 # 1 "/usr/include/bits/string.h" 1 3 4
9369 # 633 "/usr/include/string.h" 2 3 4
9370
9371
9372 # 1 "/usr/include/bits/string2.h" 1 3 4
9373 # 80 "/usr/include/bits/string2.h" 3 4
9374 typedef struct { unsigned char __arr[2]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR2;
9375 typedef struct { unsigned char __arr[3]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR3;
9376 typedef struct { unsigned char __arr[4]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR4;
9377 typedef struct { unsigned char __arr[5]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR5;
9378 typedef struct { unsigned char __arr[6]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR6;
9379 typedef struct { unsigned char __arr[7]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR7;
9380 typedef struct { unsigned char __arr[8]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR8;
9381 # 394 "/usr/include/bits/string2.h" 3 4
9382 extern void *__rawmemchr (const void *__s, int __c);
9383 # 969 "/usr/include/bits/string2.h" 3 4
9384 extern __inline size_t __strcspn_c1 (__const char *__s, int __reject);
9385 extern __inline size_t
9386 __strcspn_c1 (__const char *__s, int __reject)
9387 {
9388   register size_t __result = 0;
9389   while (__s[__result] != '\0' && __s[__result] != __reject)
9390     ++__result;
9391   return __result;
9392 }
9393
9394 extern __inline size_t __strcspn_c2 (__const char *__s, int __reject1,
9395          int __reject2);
9396 extern __inline size_t
9397 __strcspn_c2 (__const char *__s, int __reject1, int __reject2)
9398 {
9399   register size_t __result = 0;
9400   while (__s[__result] != '\0' && __s[__result] != __reject1
9401   && __s[__result] != __reject2)
9402     ++__result;
9403   return __result;
9404 }
9405
9406 extern __inline size_t __strcspn_c3 (__const char *__s, int __reject1,
9407          int __reject2, int __reject3);
9408 extern __inline size_t
9409 __strcspn_c3 (__const char *__s, int __reject1, int __reject2,
9410        int __reject3)
9411 {
9412   register size_t __result = 0;
9413   while (__s[__result] != '\0' && __s[__result] != __reject1
9414   && __s[__result] != __reject2 && __s[__result] != __reject3)
9415     ++__result;
9416   return __result;
9417 }
9418 # 1045 "/usr/include/bits/string2.h" 3 4
9419 extern __inline size_t __strspn_c1 (__const char *__s, int __accept);
9420 extern __inline size_t
9421 __strspn_c1 (__const char *__s, int __accept)
9422 {
9423   register size_t __result = 0;
9424
9425   while (__s[__result] == __accept)
9426     ++__result;
9427   return __result;
9428 }
9429
9430 extern __inline size_t __strspn_c2 (__const char *__s, int __accept1,
9431         int __accept2);
9432 extern __inline size_t
9433 __strspn_c2 (__const char *__s, int __accept1, int __accept2)
9434 {
9435   register size_t __result = 0;
9436
9437   while (__s[__result] == __accept1 || __s[__result] == __accept2)
9438     ++__result;
9439   return __result;
9440 }
9441
9442 extern __inline size_t __strspn_c3 (__const char *__s, int __accept1,
9443         int __accept2, int __accept3);
9444 extern __inline size_t
9445 __strspn_c3 (__const char *__s, int __accept1, int __accept2, int __accept3)
9446 {
9447   register size_t __result = 0;
9448
9449   while (__s[__result] == __accept1 || __s[__result] == __accept2
9450   || __s[__result] == __accept3)
9451     ++__result;
9452   return __result;
9453 }
9454 # 1121 "/usr/include/bits/string2.h" 3 4
9455 extern __inline char *__strpbrk_c2 (__const char *__s, int __accept1,
9456          int __accept2);
9457 extern __inline char *
9458 __strpbrk_c2 (__const char *__s, int __accept1, int __accept2)
9459 {
9460
9461   while (*__s != '\0' && *__s != __accept1 && *__s != __accept2)
9462     ++__s;
9463   return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s;
9464 }
9465
9466 extern __inline char *__strpbrk_c3 (__const char *__s, int __accept1,
9467          int __accept2, int __accept3);
9468 extern __inline char *
9469 __strpbrk_c3 (__const char *__s, int __accept1, int __accept2,
9470        int __accept3)
9471 {
9472
9473   while (*__s != '\0' && *__s != __accept1 && *__s != __accept2
9474   && *__s != __accept3)
9475     ++__s;
9476   return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s;
9477 }
9478 # 1172 "/usr/include/bits/string2.h" 3 4
9479 extern __inline char *__strtok_r_1c (char *__s, char __sep, char **__nextp);
9480 extern __inline char *
9481 __strtok_r_1c (char *__s, char __sep, char **__nextp)
9482 {
9483   char *__result;
9484   if (__s == ((void *)0))
9485     __s = *__nextp;
9486   while (*__s == __sep)
9487     ++__s;
9488   __result = ((void *)0);
9489   if (*__s != '\0')
9490     {
9491       __result = __s++;
9492       while (*__s != '\0')
9493  if (*__s++ == __sep)
9494    {
9495      __s[-1] = '\0';
9496      break;
9497    }
9498     }
9499   *__nextp = __s;
9500   return __result;
9501 }
9502 # 1204 "/usr/include/bits/string2.h" 3 4
9503 extern char *__strsep_g (char **__stringp, __const char *__delim);
9504 # 1222 "/usr/include/bits/string2.h" 3 4
9505 extern __inline char *__strsep_1c (char **__s, char __reject);
9506 extern __inline char *
9507 __strsep_1c (char **__s, char __reject)
9508 {
9509   register char *__retval = *__s;
9510   if (__retval != ((void *)0) && (*__s = (__extension__ (__builtin_constant_p (__reject) && !__builtin_constant_p (__retval) && (__reject) == '\0' ? (char *) __rawmemchr (__retval, __reject) : __builtin_strchr (__retval, __reject)))) != ((void *)0))
9511     *(*__s)++ = '\0';
9512   return __retval;
9513 }
9514
9515 extern __inline char *__strsep_2c (char **__s, char __reject1, char __reject2);
9516 extern __inline char *
9517 __strsep_2c (char **__s, char __reject1, char __reject2)
9518 {
9519   register char *__retval = *__s;
9520   if (__retval != ((void *)0))
9521     {
9522       register char *__cp = __retval;
9523       while (1)
9524  {
9525    if (*__cp == '\0')
9526      {
9527        __cp = ((void *)0);
9528    break;
9529      }
9530    if (*__cp == __reject1 || *__cp == __reject2)
9531      {
9532        *__cp++ = '\0';
9533        break;
9534      }
9535    ++__cp;
9536  }
9537       *__s = __cp;
9538     }
9539   return __retval;
9540 }
9541
9542 extern __inline char *__strsep_3c (char **__s, char __reject1, char __reject2,
9543        char __reject3);
9544 extern __inline char *
9545 __strsep_3c (char **__s, char __reject1, char __reject2, char __reject3)
9546 {
9547   register char *__retval = *__s;
9548   if (__retval != ((void *)0))
9549     {
9550       register char *__cp = __retval;
9551       while (1)
9552  {
9553    if (*__cp == '\0')
9554      {
9555        __cp = ((void *)0);
9556    break;
9557      }
9558    if (*__cp == __reject1 || *__cp == __reject2 || *__cp == __reject3)
9559      {
9560        *__cp++ = '\0';
9561        break;
9562      }
9563    ++__cp;
9564  }
9565       *__s = __cp;
9566     }
9567   return __retval;
9568 }
9569 # 1303 "/usr/include/bits/string2.h" 3 4
9570 extern char *__strdup (__const char *__string) __attribute__ ((__nothrow__)) __attribute__ ((__malloc__));
9571 # 1322 "/usr/include/bits/string2.h" 3 4
9572 extern char *__strndup (__const char *__string, size_t __n)
9573      __attribute__ ((__nothrow__)) __attribute__ ((__malloc__));
9574 # 636 "/usr/include/string.h" 2 3 4
9575
9576
9577
9578
9579 # 1 "/usr/include/bits/string3.h" 1 3 4
9580 # 23 "/usr/include/bits/string3.h" 3 4
9581 extern void __warn_memset_zero_len (void) __attribute__((__warning__ ("memset used with constant zero length parameter; this could be due to transposed parameters")));
9582 # 48 "/usr/include/bits/string3.h" 3 4
9583 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) void *
9584 __attribute__ ((__nothrow__)) memcpy (void *__restrict __dest, __const void *__restrict __src, size_t __len)
9585
9586 {
9587   return __builtin___memcpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
9588 }
9589
9590 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) void *
9591 __attribute__ ((__nothrow__)) memmove (void *__restrict __dest, __const void *__restrict __src, size_t __len)
9592
9593 {
9594   return __builtin___memmove_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
9595 }
9596
9597
9598 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) void *
9599 __attribute__ ((__nothrow__)) mempcpy (void *__restrict __dest, __const void *__restrict __src, size_t __len)
9600
9601 {
9602   return __builtin___mempcpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
9603 }
9604 # 77 "/usr/include/bits/string3.h" 3 4
9605 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) void *
9606 __attribute__ ((__nothrow__)) memset (void *__dest, int __ch, size_t __len)
9607 {
9608   if (__builtin_constant_p (__len) && __len == 0)
9609     {
9610       __warn_memset_zero_len ();
9611       return __dest;
9612     }
9613   return __builtin___memset_chk (__dest, __ch, __len, __builtin_object_size (__dest, 0));
9614 }
9615
9616
9617 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) void
9618 __attribute__ ((__nothrow__)) bcopy (__const void *__restrict __src, void *__restrict __dest, size_t __len)
9619
9620 {
9621   (void) __builtin___memmove_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
9622 }
9623
9624 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) void
9625 __attribute__ ((__nothrow__)) bzero (void *__dest, size_t __len)
9626 {
9627   (void) __builtin___memset_chk (__dest, '\0', __len, __builtin_object_size (__dest, 0));
9628 }
9629
9630
9631 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) char *
9632 __attribute__ ((__nothrow__)) strcpy (char *__restrict __dest, __const char *__restrict __src)
9633 {
9634   return __builtin___strcpy_chk (__dest, __src, __builtin_object_size (__dest, 2 > 1));
9635 }
9636
9637
9638 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) char *
9639 __attribute__ ((__nothrow__)) stpcpy (char *__restrict __dest, __const char *__restrict __src)
9640 {
9641   return __builtin___stpcpy_chk (__dest, __src, __builtin_object_size (__dest, 2 > 1));
9642 }
9643
9644
9645
9646 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) char *
9647 __attribute__ ((__nothrow__)) strncpy (char *__restrict __dest, __const char *__restrict __src, size_t __len)
9648
9649 {
9650   return __builtin___strncpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 2 > 1));
9651 }
9652
9653
9654 extern char *__stpncpy_chk (char *__dest, __const char *__src, size_t __n,
9655        size_t __destlen) __attribute__ ((__nothrow__));
9656 extern char *__stpncpy_alias (char *__dest, __const char *__src, size_t __n) __asm__ ("" "stpncpy") __attribute__ ((__nothrow__));
9657
9658
9659
9660 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) char *
9661 __attribute__ ((__nothrow__)) stpncpy (char *__dest, __const char *__src, size_t __n)
9662 {
9663   if (__builtin_object_size (__dest, 2 > 1) != (size_t) -1
9664       && (!__builtin_constant_p (__n) || __n <= __builtin_object_size (__dest, 2 > 1)))
9665     return __stpncpy_chk (__dest, __src, __n, __builtin_object_size (__dest, 2 > 1));
9666   return __stpncpy_alias (__dest, __src, __n);
9667 }
9668
9669
9670 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) char *
9671 __attribute__ ((__nothrow__)) strcat (char *__restrict __dest, __const char *__restrict __src)
9672 {
9673   return __builtin___strcat_chk (__dest, __src, __builtin_object_size (__dest, 2 > 1));
9674 }
9675
9676
9677 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) char *
9678 __attribute__ ((__nothrow__)) strncat (char *__restrict __dest, __const char *__restrict __src, size_t __len)
9679
9680 {
9681   return __builtin___strncat_chk (__dest, __src, __len, __builtin_object_size (__dest, 2 > 1));
9682 }
9683 # 641 "/usr/include/string.h" 2 3 4
9684
9685
9686
9687
9688 # 14 "./include/ut0mem.h" 2
9689
9690
9691
9692 extern ulint ut_total_allocated_memory;
9693
9694 static inline
9695 void*
9696 ut_memcpy(void* dest, const void* sour, ulint n);
9697
9698 static inline
9699 void*
9700 ut_memmove(void* dest, const void* sour, ulint n);
9701
9702 static inline
9703 int
9704 ut_memcmp(const void* str1, const void* str2, ulint n);
9705
9706
9707
9708
9709
9710
9711 void*
9712 ut_malloc_low(
9713
9714
9715         ulint n,
9716  ulint set_to_zero,
9717
9718  ulint assert_on_error);
9719
9720
9721
9722
9723
9724 void*
9725 ut_malloc(
9726
9727
9728         ulint n);
9729
9730
9731
9732
9733
9734 ulint
9735 ut_test_malloc(
9736
9737
9738  ulint n);
9739
9740
9741
9742 void
9743 ut_free(
9744
9745  void* ptr);
9746 # 96 "./include/ut0mem.h"
9747 void*
9748 ut_realloc(
9749
9750
9751  void* ptr,
9752  ulint size);
9753
9754
9755
9756 void
9757 ut_free_all_mem(void);
9758
9759
9760 static inline
9761 char*
9762 ut_strcpy(char* dest, const char* sour);
9763
9764 static inline
9765 ulint
9766 ut_strlen(const char* str);
9767
9768 static inline
9769 int
9770 ut_strcmp(const void* str1, const void* str2);
9771
9772
9773
9774
9775
9776
9777 ulint
9778 ut_strlcpy(
9779
9780
9781  char* dst,
9782  const char* src,
9783  ulint size);
9784
9785
9786
9787
9788
9789 ulint
9790 ut_strlcpy_rev(
9791
9792
9793  char* dst,
9794  const char* src,
9795  ulint size);
9796
9797
9798
9799 static inline
9800 ulint
9801 ut_strlenq(
9802
9803
9804  const char* str,
9805  char q);
9806
9807
9808
9809
9810
9811
9812 char*
9813 ut_strcpyq(
9814
9815
9816  char* dest,
9817  char q,
9818  const char* src);
9819
9820
9821
9822
9823
9824
9825 char*
9826 ut_memcpyq(
9827
9828
9829  char* dest,
9830  char q,
9831  const char* src,
9832  ulint len);
9833
9834
9835 # 1 "./include/ut0mem.ic" 1
9836 # 9 "./include/ut0mem.ic"
9837 static inline
9838 void*
9839 ut_memcpy(void* dest, const void* sour, ulint n)
9840 {
9841  return(memcpy(dest, sour, n));
9842 }
9843
9844 static inline
9845 void*
9846 ut_memmove(void* dest, const void* sour, ulint n)
9847 {
9848  return(memmove(dest, sour, n));
9849 }
9850
9851 static inline
9852 int
9853 ut_memcmp(const void* str1, const void* str2, ulint n)
9854 {
9855  return(memcmp(str1, str2, n));
9856 }
9857
9858 static inline
9859 char*
9860 ut_strcpy(char* dest, const char* sour)
9861 {
9862  return(strcpy(dest, sour));
9863 }
9864
9865 static inline
9866 ulint
9867 ut_strlen(const char* str)
9868 {
9869  return(strlen(str));
9870 }
9871
9872 static inline
9873 int
9874 ut_strcmp(const void* str1, const void* str2)
9875 {
9876  return(__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ((const char*)str1) && __builtin_constant_p ((const char*)str2) && (__s1_len = strlen ((const char*)str1), __s2_len = strlen ((const char*)str2), (!((size_t)(const void *)(((const char*)str1) + 1) - (size_t)(const void *)((const char*)str1) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(((const char*)str2) + 1) - (size_t)(const void *)((const char*)str2) == 1) || __s2_len >= 4)) ? __builtin_strcmp ((const char*)str1, (const char*)str2) : (__builtin_constant_p ((const char*)str1) && ((size_t)(const void *)(((const char*)str1) + 1) - (size_t)(const void *)((const char*)str1) == 1) && (__s1_len = strlen ((const char*)str1), __s1_len < 4) ? (__builtin_constant_p ((const char*)str2) && ((size_t)(const void *)(((const char*)str2) + 1) - (size_t)(const void *)((const char*)str2) == 1) ? __builtin_strcmp ((const char*)str1, (const char*)str2) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ((const char*)str2); register int __result = (((__const unsigned char *) (__const char *) ((const char*)str1))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) ((const char*)str1))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) ((const char*)str1))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) ((const char*)str1))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ((const char*)str2) && ((size_t)(const void *)(((const char*)str2) + 1) - (size_t)(const void *)((const char*)str2) == 1) && (__s2_len = strlen ((const char*)str2), __s2_len < 4) ? (__builtin_constant_p ((const char*)str1) && ((size_t)(const void *)(((const char*)str1) + 1) - (size_t)(const void *)((const char*)str1) == 1) ? __builtin_strcmp ((const char*)str1, (const char*)str2) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) ((const char*)str1); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ((const char*)str2))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ((const char*)str2))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ((const char*)str2))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ((const char*)str2))[3]); } } __result; }))) : __builtin_strcmp ((const char*)str1, (const char*)str2)))); }));
9877 }
9878
9879
9880
9881 static inline
9882 ulint
9883 ut_strlenq(
9884
9885
9886  const char* str,
9887  char q)
9888 {
9889  ulint len;
9890
9891  for (len = 0; *str; len++, str++) {
9892   if (*str == q) {
9893    len++;
9894   }
9895  }
9896
9897  return(len);
9898 }
9899 # 185 "./include/ut0mem.h" 2
9900 # 16 "./include/sync0sync.h" 2
9901
9902 # 1 "./include/os0sync.h" 1
9903 # 31 "./include/os0sync.h"
9904 typedef pthread_mutex_t os_fast_mutex_t;
9905
9906 typedef struct os_event_struct os_event_struct_t;
9907 typedef os_event_struct_t* os_event_t;
9908
9909 struct os_event_struct {
9910  os_fast_mutex_t os_mutex;
9911
9912  ulint is_set;
9913
9914
9915
9916  ib_longlong signal_count;
9917
9918  pthread_cond_t cond_var;
9919
9920  struct { os_event_struct_t * prev; os_event_struct_t * next; } os_event_list;
9921
9922 };
9923
9924
9925 typedef struct os_mutex_struct os_mutex_str_t;
9926 typedef os_mutex_str_t* os_mutex_t;
9927
9928
9929
9930
9931
9932
9933 extern os_mutex_t os_sync_mutex;
9934
9935
9936
9937 extern ulint os_thread_count;
9938
9939 extern ulint os_event_count;
9940 extern ulint os_mutex_count;
9941 extern ulint os_fast_mutex_count;
9942
9943
9944
9945
9946 void
9947 os_sync_init(void);
9948
9949
9950
9951
9952 void
9953 os_sync_free(void);
9954
9955
9956
9957
9958
9959
9960 os_event_t
9961 os_event_create(
9962
9963
9964  const char* name);
9965 # 109 "./include/os0sync.h"
9966 void
9967 os_event_set(
9968
9969  os_event_t event);
9970 # 121 "./include/os0sync.h"
9971 ib_longlong
9972 os_event_reset(
9973
9974  os_event_t event);
9975
9976
9977
9978 void
9979 os_event_free(
9980
9981  os_event_t event);
9982 # 156 "./include/os0sync.h"
9983 void
9984 os_event_wait_low(
9985
9986  os_event_t event,
9987  ib_longlong reset_sig_count);
9988
9989
9990
9991
9992
9993
9994
9995 ulint
9996 os_event_wait_time(
9997
9998
9999
10000
10001  os_event_t event,
10002  ulint time);
10003 # 197 "./include/os0sync.h"
10004 os_mutex_t
10005 os_mutex_create(
10006
10007
10008  const char* name);
10009
10010
10011
10012
10013 void
10014 os_mutex_enter(
10015
10016  os_mutex_t mutex);
10017
10018
10019
10020 void
10021 os_mutex_exit(
10022
10023  os_mutex_t mutex);
10024
10025
10026
10027 void
10028 os_mutex_free(
10029
10030  os_mutex_t mutex);
10031
10032
10033
10034 static inline
10035 ulint
10036 os_fast_mutex_trylock(
10037
10038
10039
10040
10041  os_fast_mutex_t* fast_mutex);
10042
10043
10044
10045 void
10046 os_fast_mutex_unlock(
10047
10048  os_fast_mutex_t* fast_mutex);
10049
10050
10051
10052 void
10053 os_fast_mutex_init(
10054
10055  os_fast_mutex_t* fast_mutex);
10056
10057
10058
10059 void
10060 os_fast_mutex_lock(
10061
10062  os_fast_mutex_t* fast_mutex);
10063
10064
10065
10066 void
10067 os_fast_mutex_free(
10068
10069  os_fast_mutex_t* fast_mutex);
10070
10071
10072 # 1 "./include/os0sync.ic" 1
10073 # 16 "./include/os0sync.ic"
10074 static inline
10075 ulint
10076 os_fast_mutex_trylock(
10077
10078
10079
10080
10081  os_fast_mutex_t* fast_mutex)
10082 {
10083 # 43 "./include/os0sync.ic"
10084  return((ulint) pthread_mutex_trylock(fast_mutex));
10085
10086
10087 }
10088 # 266 "./include/os0sync.h" 2
10089 # 18 "./include/sync0sync.h" 2
10090 # 1 "./include/sync0arr.h" 1
10091 # 17 "./include/sync0arr.h"
10092 typedef struct sync_cell_struct sync_cell_t;
10093 typedef struct sync_array_struct sync_array_t;
10094 # 28 "./include/sync0arr.h"
10095 sync_array_t*
10096 sync_array_create(
10097
10098
10099  ulint n_cells,
10100
10101  ulint protection);
10102
10103
10104
10105
10106
10107 void
10108 sync_array_free(
10109
10110  sync_array_t* arr);
10111
10112
10113
10114
10115 void
10116 sync_array_reserve_cell(
10117
10118         sync_array_t* arr,
10119         void* object,
10120         ulint type,
10121  const char* file,
10122         ulint line,
10123         ulint* index);
10124
10125
10126
10127
10128
10129
10130 void
10131 sync_array_wait_event(
10132
10133         sync_array_t* arr,
10134         ulint index);
10135
10136
10137
10138
10139 void
10140 sync_array_free_cell(
10141
10142  sync_array_t* arr,
10143         ulint index);
10144
10145
10146
10147 void
10148 sync_array_object_signalled(
10149
10150  sync_array_t* arr);
10151
10152
10153
10154
10155
10156 void
10157 sync_arr_wake_threads_if_sema_free(void);
10158
10159
10160
10161
10162 ulint
10163 sync_array_print_long_waits(void);
10164
10165
10166
10167
10168
10169
10170
10171 void
10172 sync_array_validate(
10173
10174  sync_array_t* arr);
10175
10176
10177
10178 void
10179 sync_array_print_info(
10180
10181  FILE* file,
10182  sync_array_t* arr);
10183
10184
10185
10186 # 1 "./include/sync0arr.ic" 1
10187 # 120 "./include/sync0arr.h" 2
10188 # 19 "./include/sync0sync.h" 2
10189
10190
10191 extern my_bool timed_mutexes;
10192
10193
10194
10195
10196
10197 void
10198 sync_init(void);
10199
10200
10201
10202
10203 void
10204 sync_close(void);
10205 # 54 "./include/sync0sync.h"
10206 void
10207 mutex_create_func(
10208
10209  ib_mutex_t* mutex,
10210
10211
10212
10213  const char* cfile_name,
10214  ulint cline);
10215
10216
10217
10218
10219
10220
10221 void
10222 mutex_free(
10223
10224  ib_mutex_t* mutex);
10225 # 83 "./include/sync0sync.h"
10226 void
10227 mutex_enter_noninline(
10228
10229  ib_mutex_t* mutex);
10230 # 100 "./include/sync0sync.h"
10231 static inline
10232 void
10233 mutex_enter_func(
10234
10235  ib_mutex_t* mutex,
10236  const char* file_name,
10237  ulint line);
10238
10239
10240
10241
10242 ulint
10243 mutex_enter_nowait(
10244
10245
10246  ib_mutex_t* mutex,
10247  const char* file_name,
10248
10249  ulint line);
10250
10251
10252 static inline
10253 void
10254 mutex_exit(
10255
10256  ib_mutex_t* mutex);
10257
10258
10259
10260 void
10261 mutex_exit_noninline(
10262
10263  ib_mutex_t* mutex);
10264
10265
10266
10267
10268 ulint
10269 sync_all_freed(void);
10270
10271
10272
10273
10274
10275
10276 void
10277 sync_print_wait_info(
10278
10279  FILE* file);
10280
10281
10282
10283 void
10284 sync_print(
10285
10286  FILE* file);
10287
10288
10289
10290 ulint
10291 mutex_validate(
10292
10293  ib_mutex_t* mutex);
10294
10295
10296
10297 void
10298 mutex_set_level(
10299
10300  ib_mutex_t* mutex,
10301  ulint level);
10302
10303
10304
10305
10306
10307 void
10308 sync_thread_add_level(
10309
10310  void* latch,
10311  ulint level);
10312
10313
10314
10315
10316 ulint
10317 sync_thread_reset_level(
10318
10319
10320
10321
10322
10323  void* latch);
10324
10325
10326
10327 ulint
10328 sync_thread_levels_empty(void);
10329
10330
10331
10332
10333
10334 ulint
10335 sync_thread_levels_empty_gen(
10336
10337
10338
10339  ulint dict_mutex_allowed);
10340 # 249 "./include/sync0sync.h"
10341 static inline
10342 ulint
10343 mutex_get_lock_word(
10344
10345  ib_mutex_t* mutex);
10346 # 461 "./include/sync0sync.h"
10347 struct mutex_struct {
10348  os_event_t event;
10349  ulint lock_word;
10350
10351
10352  os_fast_mutex_t
10353   os_fast_mutex;
10354
10355
10356  ulint waiters;
10357
10358
10359
10360  struct { ib_mutex_t * prev; ib_mutex_t * next; } list;
10361
10362
10363
10364
10365
10366
10367
10368  ulint level;
10369
10370  const char* cfile_name;
10371  ulint cline;
10372  ulint magic_n;
10373
10374  ulong count_os_wait;
10375 # 500 "./include/sync0sync.h"
10376 };
10377
10378
10379
10380
10381
10382
10383 extern sync_array_t* sync_primary_wait_array;
10384 # 524 "./include/sync0sync.h"
10385 extern ulint mutex_system_call_count;
10386 extern ulint mutex_exit_count;
10387
10388
10389 extern ulint sync_order_checks_on;
10390
10391
10392 extern ulint sync_initialized;
10393
10394
10395 typedef struct { ulint count; ib_mutex_t * start; ib_mutex_t * end; } ut_list_base_node_t;
10396 extern ut_list_base_node_t mutex_list;
10397
10398
10399 extern ib_mutex_t mutex_list_mutex;
10400
10401
10402
10403 # 1 "./include/sync0sync.ic" 1
10404 # 22 "./include/sync0sync.ic"
10405 void
10406 mutex_set_waiters(
10407
10408  ib_mutex_t* mutex,
10409  ulint n);
10410
10411
10412
10413
10414
10415 void
10416 mutex_spin_wait(
10417
10418         ib_mutex_t* mutex,
10419  const char* file_name,
10420  ulint line);
10421 # 52 "./include/sync0sync.ic"
10422 void
10423 mutex_signal_object(
10424
10425  ib_mutex_t* mutex);
10426
10427
10428
10429
10430 static inline
10431 ulint
10432 mutex_test_and_set(
10433
10434
10435
10436  ib_mutex_t* mutex)
10437 {
10438 # 104 "./include/sync0sync.ic"
10439  ulint ret;
10440
10441  ret = os_fast_mutex_trylock(&(mutex->os_fast_mutex));
10442
10443  if (ret == 0) {
10444
10445
10446   do { if (__builtin_expect(!((ulint)(mutex->lock_word == 0)), (0))) { ut_dbg_assertion_failed("mutex->lock_word == 0", "./include/sync0sync.ic", (ulint) 111); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/sync0sync.ic", (ulint) 111); } while (0); } while (0);
10447
10448   mutex->lock_word = 1;
10449  }
10450
10451  return(ret);
10452
10453 }
10454
10455
10456
10457
10458 static inline
10459 void
10460 mutex_reset_lock_word(
10461
10462  ib_mutex_t* mutex)
10463 {
10464 # 144 "./include/sync0sync.ic"
10465  mutex->lock_word = 0;
10466
10467  os_fast_mutex_unlock(&(mutex->os_fast_mutex));
10468
10469 }
10470
10471
10472
10473 static inline
10474 ulint
10475 mutex_get_lock_word(
10476
10477  ib_mutex_t* mutex)
10478 {
10479 volatile ulint* ptr;
10480
10481  ;
10482
10483  ptr = &(mutex->lock_word);
10484
10485  return(*ptr);
10486 }
10487
10488
10489
10490 static inline
10491 ulint
10492 mutex_get_waiters(
10493
10494
10495  ib_mutex_t* mutex)
10496 {
10497 volatile ulint* ptr;
10498
10499  ;
10500
10501  ptr = &(mutex->waiters);
10502
10503  return(*ptr);
10504
10505 }
10506
10507
10508
10509 static inline
10510 void
10511 mutex_exit(
10512
10513  ib_mutex_t* mutex)
10514 {
10515
10516
10517
10518
10519
10520
10521
10522  mutex_reset_lock_word(mutex);
10523 # 215 "./include/sync0sync.ic"
10524  if (mutex_get_waiters(mutex) != 0) {
10525
10526   mutex_signal_object(mutex);
10527  }
10528
10529
10530
10531
10532 }
10533
10534
10535
10536
10537
10538 static inline
10539 void
10540 mutex_enter_func(
10541
10542  ib_mutex_t* mutex,
10543  const char* file_name,
10544  ulint line)
10545 {
10546  ;
10547 # 246 "./include/sync0sync.ic"
10548   if (!mutex_test_and_set(mutex))
10549   {
10550
10551
10552
10553   return;
10554  }
10555
10556  mutex_spin_wait(mutex, file_name, line);
10557
10558 }
10559 # 543 "./include/sync0sync.h" 2
10560 # 15 "./include/sync0rw.h" 2
10561 # 27 "./include/sync0rw.h"
10562 typedef struct rw_lock_struct rw_lock_t;
10563
10564
10565
10566
10567 typedef struct { ulint count; rw_lock_t * start; rw_lock_t * end; } rw_lock_list_t;
10568
10569 extern rw_lock_list_t rw_lock_list;
10570 extern ib_mutex_t rw_lock_list_mutex;
10571 # 50 "./include/sync0rw.h"
10572 extern ulint rw_s_system_call_count;
10573 extern ulint rw_s_spin_wait_count;
10574 extern ulint rw_s_exit_count;
10575 extern ulint rw_s_os_wait_count;
10576 extern ulint rw_x_system_call_count;
10577 extern ulint rw_x_spin_wait_count;
10578 extern ulint rw_x_os_wait_count;
10579 extern ulint rw_x_exit_count;
10580 # 77 "./include/sync0rw.h"
10581 void
10582 rw_lock_create_func(
10583
10584  rw_lock_t* lock,
10585
10586
10587
10588  const char* cfile_name,
10589  ulint cline);
10590
10591
10592
10593
10594
10595 void
10596 rw_lock_free(
10597
10598  rw_lock_t* lock);
10599
10600
10601
10602
10603 ulint
10604 rw_lock_validate(
10605
10606  rw_lock_t* lock);
10607 # 128 "./include/sync0rw.h"
10608 static inline
10609 void
10610 rw_lock_s_lock_func(
10611
10612         rw_lock_t* lock,
10613  ulint pass,
10614
10615  const char* file_name,
10616  ulint line);
10617
10618
10619
10620
10621 static inline
10622 ulint
10623 rw_lock_s_lock_func_nowait(
10624
10625
10626         rw_lock_t* lock,
10627  const char* file_name,
10628  ulint line);
10629
10630
10631
10632
10633 static inline
10634 ulint
10635 rw_lock_x_lock_func_nowait(
10636
10637
10638         rw_lock_t* lock,
10639  const char* file_name,
10640  ulint line);
10641
10642
10643 static inline
10644 void
10645 rw_lock_s_unlock_func(
10646
10647  rw_lock_t* lock
10648
10649
10650
10651
10652  );
10653 # 217 "./include/sync0rw.h"
10654 void
10655 rw_lock_x_lock_func(
10656
10657         rw_lock_t* lock,
10658  ulint pass,
10659
10660  const char* file_name,
10661  ulint line);
10662
10663
10664 static inline
10665 void
10666 rw_lock_x_unlock_func(
10667
10668  rw_lock_t* lock
10669
10670
10671
10672
10673  );
10674 # 257 "./include/sync0rw.h"
10675 static inline
10676 void
10677 rw_lock_s_lock_direct(
10678
10679  rw_lock_t* lock,
10680  const char* file_name,
10681  ulint line
10682 );
10683
10684
10685
10686
10687 static inline
10688 void
10689 rw_lock_x_lock_direct(
10690
10691  rw_lock_t* lock,
10692  const char* file_name,
10693  ulint line
10694 );
10695 # 286 "./include/sync0rw.h"
10696 void
10697 rw_lock_x_lock_move_ownership(
10698
10699  rw_lock_t* lock);
10700
10701
10702
10703
10704 static inline
10705 void
10706 rw_lock_s_unlock_direct(
10707
10708  rw_lock_t* lock);
10709
10710
10711
10712 static inline
10713 void
10714 rw_lock_x_unlock_direct(
10715
10716  rw_lock_t* lock);
10717
10718
10719
10720 void
10721 rw_lock_set_level(
10722
10723  rw_lock_t* lock,
10724  ulint level);
10725
10726
10727
10728 static inline
10729 ulint
10730 rw_lock_get_x_lock_count(
10731
10732
10733  rw_lock_t* lock);
10734
10735
10736 static inline
10737 ulint
10738 rw_lock_get_s_waiters(
10739
10740  rw_lock_t* lock);
10741 static inline
10742 ulint
10743 rw_lock_get_x_waiters(
10744
10745  rw_lock_t* lock);
10746 static inline
10747 ulint
10748 rw_lock_get_wx_waiters(
10749
10750  rw_lock_t* lock);
10751 static inline
10752 ulint
10753 rw_lock_get_writer(
10754
10755  rw_lock_t* lock);
10756 static inline
10757 ulint
10758 rw_lock_get_reader_count(
10759
10760  rw_lock_t* lock);
10761 # 366 "./include/sync0rw.h"
10762 ulint
10763 rw_lock_is_locked(
10764
10765  rw_lock_t* lock,
10766  ulint lock_type);
10767 # 440 "./include/sync0rw.h"
10768 struct rw_lock_struct {
10769
10770  os_event_t s_event;
10771  os_event_t x_event;
10772  os_event_t wait_ex_event;
10773 # 453 "./include/sync0rw.h"
10774  volatile lint lock_word;
10775
10776
10777  volatile ulint reader_count;
10778
10779  volatile ulint writer;
10780
10781
10782
10783
10784  volatile os_thread_id_t writer_thread;
10785
10786  volatile ulint writer_count;
10787
10788
10789
10790
10791
10792  ulint pass;
10793
10794
10795
10796
10797  volatile ulint s_waiters;
10798  volatile ulint x_waiters;
10799  volatile ulint wait_ex_waiters;
10800  volatile ulint writer_is_wait_ex;
10801
10802
10803
10804
10805
10806
10807  struct { rw_lock_t * prev; rw_lock_t * next; } list;
10808
10809
10810
10811
10812
10813
10814
10815  ulint level;
10816
10817  const char* cfile_name;
10818  ulint cline;
10819  const char* last_s_file_name;
10820  const char* last_x_file_name;
10821  ulint last_s_line;
10822  ulint last_x_line;
10823  ulint magic_n;
10824 };
10825 # 525 "./include/sync0rw.h"
10826 # 1 "./include/sync0rw.ic" 1
10827 # 15 "./include/sync0rw.ic"
10828 void
10829 rw_lock_s_lock_spin(
10830
10831         rw_lock_t* lock,
10832  ulint pass,
10833
10834  const char* file_name,
10835  ulint line);
10836 # 48 "./include/sync0rw.ic"
10837 static inline
10838 ulint
10839 rw_lock_get_s_waiters(
10840
10841  rw_lock_t* lock)
10842 {
10843  return(lock->s_waiters);
10844 }
10845 static inline
10846 ulint
10847 rw_lock_get_x_waiters(
10848
10849  rw_lock_t* lock)
10850 {
10851  return(lock->x_waiters);
10852 }
10853 static inline
10854 ulint
10855 rw_lock_get_wx_waiters(
10856
10857  rw_lock_t* lock)
10858 {
10859  return(lock->wait_ex_waiters);
10860 }
10861 static inline
10862 void
10863 rw_lock_set_s_waiters(
10864  rw_lock_t* lock,
10865  ulint flag)
10866 {
10867
10868  __sync_lock_test_and_set(&lock->s_waiters, flag);
10869
10870
10871
10872 }
10873 static inline
10874 void
10875 rw_lock_set_x_waiters(
10876  rw_lock_t* lock,
10877  ulint flag)
10878 {
10879
10880  __sync_lock_test_and_set(&lock->x_waiters, flag);
10881
10882
10883
10884 }
10885 static inline
10886 void
10887 rw_lock_set_wx_waiters(
10888
10889  rw_lock_t* lock,
10890  ulint flag)
10891 {
10892
10893  __sync_lock_test_and_set(&lock->wait_ex_waiters, flag);
10894
10895
10896
10897 }
10898 static inline
10899 ulint
10900 rw_lock_get_writer(
10901
10902  rw_lock_t* lock)
10903 {
10904
10905  if (lock->writer == 350) {
10906   return(350);
10907  }
10908
10909  if (lock->writer_is_wait_ex) {
10910   return(353);
10911  } else {
10912   return(351);
10913  }
10914
10915
10916
10917 }
10918 static inline
10919 void
10920 rw_lock_set_writer(
10921
10922  rw_lock_t* lock,
10923  ulint flag)
10924 {
10925  lock->writer = flag;
10926 }
10927 static inline
10928 ulint
10929 rw_lock_get_reader_count(
10930
10931  rw_lock_t* lock)
10932 {
10933  return(lock->reader_count);
10934 }
10935 static inline
10936 void
10937 rw_lock_set_reader_count(
10938
10939  rw_lock_t* lock,
10940  ulint count)
10941 {
10942  lock->reader_count = count;
10943 }
10944 # 169 "./include/sync0rw.ic"
10945 static inline
10946 ulint
10947 rw_lock_get_x_lock_count(
10948
10949
10950  rw_lock_t* lock)
10951 {
10952  return(lock->writer_count);
10953 }
10954
10955
10956
10957
10958 static inline
10959 ulint
10960 rw_lock_s_lock_low(
10961
10962
10963         rw_lock_t* lock,
10964  ulint pass __attribute__((unused)),
10965
10966
10967  const char* file_name,
10968  ulint line)
10969 {
10970
10971
10972
10973
10974
10975
10976  if (__builtin_expect(rw_lock_get_writer(lock) == 350, (1))) {
10977
10978   if(__sync_sub_and_fetch(&(lock->lock_word),1) <= 0) {
10979
10980    __sync_fetch_and_add(&(lock->lock_word),1);
10981    return((0));
10982   }
10983
10984   __sync_fetch_and_add(&(lock->reader_count),1);
10985 # 219 "./include/sync0rw.ic"
10986   lock->last_s_file_name = file_name;
10987   lock->last_s_line = line;
10988
10989   return((1));
10990  }
10991
10992  return((0));
10993 }
10994
10995
10996
10997
10998
10999 static inline
11000 void
11001 rw_lock_s_lock_direct(
11002
11003  rw_lock_t* lock,
11004  const char* file_name,
11005  ulint line)
11006 {
11007  ;
11008  ;
11009
11010
11011
11012  __sync_fetch_and_add(&(lock->reader_count),1);
11013
11014
11015
11016
11017  lock->last_s_file_name = file_name;
11018  lock->last_s_line = line;
11019
11020
11021
11022
11023 }
11024
11025
11026
11027
11028
11029 static inline
11030 void
11031 rw_lock_x_lock_direct(
11032
11033  rw_lock_t* lock,
11034  const char* file_name,
11035  ulint line)
11036 {
11037         ;
11038  ;
11039  ;
11040
11041  rw_lock_set_writer(lock, 351);
11042  lock->writer_thread = os_thread_get_curr_id();
11043
11044  __sync_fetch_and_add(&(lock->writer_count),1);
11045
11046
11047
11048  lock->pass = 0;
11049
11050  lock->last_x_file_name = file_name;
11051  lock->last_x_line = line;
11052
11053
11054
11055
11056 }
11057
11058
11059
11060
11061
11062
11063
11064 static inline
11065 void
11066 rw_lock_s_lock_func(
11067
11068         rw_lock_t* lock,
11069  ulint pass,
11070
11071  const char* file_name,
11072  ulint line)
11073 {
11074 # 326 "./include/sync0rw.ic"
11075  if (__builtin_expect(rw_lock_s_lock_low(lock, pass, file_name, line), (1))) {
11076
11077
11078
11079
11080   return;
11081  } else {
11082
11083
11084
11085
11086
11087   rw_lock_s_lock_spin(lock, pass, file_name, line);
11088
11089   return;
11090  }
11091 }
11092
11093
11094
11095
11096
11097 static inline
11098 ulint
11099 rw_lock_s_lock_func_nowait(
11100
11101
11102         rw_lock_t* lock,
11103  const char* file_name,
11104  ulint line)
11105 {
11106  ulint success = (0);
11107
11108
11109  if (rw_lock_get_writer(lock) == 350) {
11110
11111   if(__sync_sub_and_fetch(&(lock->lock_word),1) <= 0) {
11112
11113    __sync_fetch_and_add(&(lock->lock_word),1);
11114    return((0));
11115   }
11116
11117   __sync_fetch_and_add(&(lock->reader_count),1);
11118 # 382 "./include/sync0rw.ic"
11119   lock->last_s_file_name = file_name;
11120   lock->last_s_line = line;
11121
11122   success = (1);
11123  }
11124
11125
11126
11127
11128
11129  return(success);
11130 }
11131
11132
11133
11134
11135
11136 static inline
11137 ulint
11138 rw_lock_x_lock_func_nowait(
11139
11140
11141         rw_lock_t* lock,
11142  const char* file_name,
11143  ulint line)
11144 {
11145  ulint success = (0);
11146  os_thread_id_t curr_thread = os_thread_get_curr_id();
11147
11148  if (lock->reader_count == 0) {
11149
11150   if(__sync_lock_test_and_set(&(lock->writer),351)
11151     == 350) {
11152
11153 retry_x_lock:
11154
11155    if(__sync_sub_and_fetch(&(lock->lock_word),
11156      0x00100000) == 0) {
11157
11158     lock->writer_thread = curr_thread;
11159     lock->pass = 0;
11160     lock->writer_is_wait_ex = (0);
11161
11162    relock:
11163     __sync_fetch_and_add(&(lock->writer_count),1);
11164
11165
11166
11167
11168
11169     lock->last_x_file_name = file_name;
11170     lock->last_x_line = line;
11171
11172     ;
11173
11174     return((1));
11175    } else {
11176
11177     if (__sync_fetch_and_add(&(lock->lock_word),0x00100000)
11178       == 0)
11179      goto retry_x_lock;
11180    }
11181
11182    __sync_lock_test_and_set(&(lock->writer),350);
11183   }
11184  }
11185
11186  if (lock->pass == 0
11187    && os_thread_eq(lock->writer_thread, curr_thread)) {
11188   goto relock;
11189  }
11190
11191
11192
11193  return((0));
11194 # 489 "./include/sync0rw.ic"
11195 }
11196
11197
11198
11199 static inline
11200 void
11201 rw_lock_s_unlock_func(
11202
11203  rw_lock_t* lock
11204
11205
11206
11207
11208  )
11209 {
11210
11211
11212
11213  ulint x_sg = (0);
11214  ulint wx_sg = (0);
11215
11216  ulint last = (0);
11217 # 520 "./include/sync0rw.ic"
11218  do { if (__builtin_expect(!((ulint)(lock->reader_count > 0)), (0))) { ut_dbg_assertion_failed("lock->reader_count > 0", "./include/sync0rw.ic", (ulint) 520); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/sync0rw.ic", (ulint) 520); } while (0); } while (0);
11219
11220
11221  __sync_fetch_and_add(&(lock->lock_word),1);
11222
11223  if(__sync_sub_and_fetch(&(lock->reader_count),1) == 0) {
11224   last = (1);
11225  }
11226 # 540 "./include/sync0rw.ic"
11227  if (__builtin_expect(last && __sync_lock_test_and_set(&lock->wait_ex_waiters, 0), (0))) {
11228   os_event_set(lock->wait_ex_event);
11229   sync_array_object_signalled(sync_primary_wait_array);
11230  }
11231  else if (__builtin_expect(last && __sync_lock_test_and_set(&lock->x_waiters, 0), (0))) {
11232   os_event_set(lock->x_event);
11233   sync_array_object_signalled(sync_primary_wait_array);
11234  }
11235 # 573 "./include/sync0rw.ic"
11236         ;
11237
11238
11239
11240
11241 }
11242
11243
11244
11245
11246 static inline
11247 void
11248 rw_lock_s_unlock_direct(
11249
11250  rw_lock_t* lock)
11251 {
11252
11253
11254  ;
11255
11256
11257  __sync_sub_and_fetch(&(lock->reader_count),1);
11258 # 604 "./include/sync0rw.ic"
11259  ;
11260  ;
11261
11262
11263
11264         ;
11265
11266
11267
11268 }
11269
11270
11271
11272 static inline
11273 void
11274 rw_lock_x_unlock_func(
11275
11276  rw_lock_t* lock
11277
11278
11279
11280
11281  )
11282 {
11283
11284  ulint last = (0);
11285
11286  ulint s_sg = (0);
11287  ulint x_sg = (0);
11288 # 642 "./include/sync0rw.ic"
11289  ;
11290
11291
11292  if(__sync_sub_and_fetch(&(lock->writer_count),1) == 0) {
11293   last = (1);
11294  }
11295
11296  if (last) {
11297
11298   __sync_fetch_and_add(&(lock->lock_word),0x00100000);
11299
11300
11301
11302   lock->writer_thread = -1;
11303   __sync_lock_test_and_set(&(lock->writer),350);
11304  }
11305 # 672 "./include/sync0rw.ic"
11306  if (last) {
11307   if(__sync_lock_test_and_set(&lock->s_waiters, 0)){
11308    s_sg = (1);
11309   }
11310   if(__sync_lock_test_and_set(&lock->x_waiters, 0)){
11311    x_sg = (1);
11312   }
11313  }
11314 # 695 "./include/sync0rw.ic"
11315  if (__builtin_expect(s_sg, (0))) {
11316   os_event_set(lock->s_event);
11317   sync_array_object_signalled(sync_primary_wait_array);
11318  }
11319  if (__builtin_expect(x_sg, (0))) {
11320
11321
11322
11323
11324   os_event_set(lock->x_event);
11325   sync_array_object_signalled(sync_primary_wait_array);
11326  }
11327
11328         ;
11329
11330
11331
11332
11333 }
11334
11335
11336
11337
11338 static inline
11339 void
11340 rw_lock_x_unlock_direct(
11341
11342  rw_lock_t* lock)
11343 {
11344
11345
11346
11347  ;
11348
11349
11350  if(__sync_sub_and_fetch(&(lock->writer_count),1) == 0) {
11351
11352
11353
11354
11355
11356   rw_lock_set_writer(lock, 350);
11357  }
11358
11359
11360
11361
11362
11363
11364  ;
11365  ;
11366
11367
11368
11369         ;
11370
11371
11372
11373
11374 }
11375 # 526 "./include/sync0rw.h" 2
11376 # 14 "./include/fil0fil.h" 2
11377 # 1 "./include/dict0types.h" 1
11378 # 12 "./include/dict0types.h"
11379 typedef struct dict_sys_struct dict_sys_t;
11380 typedef struct dict_col_struct dict_col_t;
11381 typedef struct dict_field_struct dict_field_t;
11382 typedef struct dict_index_struct dict_index_t;
11383 typedef struct dict_tree_struct dict_tree_t;
11384 typedef struct dict_table_struct dict_table_t;
11385 typedef struct dict_foreign_struct dict_foreign_t;
11386
11387
11388
11389
11390 typedef dict_table_t dict_cluster_t;
11391
11392 typedef struct ind_node_struct ind_node_t;
11393 typedef struct tab_node_struct tab_node_t;
11394 # 15 "./include/fil0fil.h" 2
11395 # 1 "./include/ibuf0types.h" 1
11396 # 12 "./include/ibuf0types.h"
11397 typedef struct ibuf_data_struct ibuf_data_t;
11398 typedef struct ibuf_struct ibuf_t;
11399 # 16 "./include/fil0fil.h" 2
11400 # 1 "./include/ut0byte.h" 1
11401 # 20 "./include/ut0byte.h"
11402 typedef struct dulint_struct dulint;
11403 struct dulint_struct{
11404  ulint high;
11405  ulint low;
11406 };
11407
11408
11409 extern dulint ut_dulint_zero;
11410
11411
11412 extern dulint ut_dulint_max;
11413
11414
11415
11416 static inline
11417 dulint
11418 ut_dulint_create(
11419
11420
11421  ulint high,
11422  ulint low);
11423
11424
11425 static inline
11426 ulint
11427 ut_dulint_get_high(
11428
11429
11430  dulint d);
11431
11432
11433 static inline
11434 ulint
11435 ut_dulint_get_low(
11436
11437
11438  dulint d);
11439
11440
11441
11442 static inline
11443 ib_longlong
11444 ut_conv_dulint_to_longlong(
11445
11446
11447  dulint d);
11448
11449
11450 static inline
11451 ulint
11452 ut_dulint_is_zero(
11453
11454
11455  dulint a);
11456
11457
11458 static inline
11459 int
11460 ut_dulint_cmp(
11461
11462
11463
11464  dulint a,
11465  dulint b);
11466
11467
11468 static inline
11469 dulint
11470 ut_dulint_get_max(
11471
11472
11473  dulint a,
11474  dulint b);
11475
11476
11477 static inline
11478 dulint
11479 ut_dulint_get_min(
11480
11481
11482  dulint a,
11483  dulint b);
11484
11485
11486 static inline
11487 dulint
11488 ut_dulint_add(
11489
11490
11491  dulint a,
11492  ulint b);
11493
11494
11495 static inline
11496 dulint
11497 ut_dulint_subtract(
11498
11499
11500  dulint a,
11501  ulint b);
11502
11503
11504
11505 static inline
11506 ulint
11507 ut_dulint_minus(
11508
11509
11510  dulint a,
11511
11512  dulint b);
11513
11514
11515 static inline
11516 dulint
11517 ut_dulint_align_down(
11518
11519
11520  dulint n,
11521  ulint align_no);
11522
11523
11524
11525 static inline
11526 dulint
11527 ut_dulint_align_up(
11528
11529
11530  dulint n,
11531  ulint align_no);
11532 # 168 "./include/ut0byte.h"
11533 void
11534 ut_dulint_sort(dulint* arr, dulint* aux_arr, ulint low, ulint high);
11535
11536
11537
11538
11539
11540 static inline
11541 ulint
11542 ut_calc_align(
11543
11544
11545  ulint n,
11546  ulint align_no);
11547
11548
11549
11550
11551 static inline
11552 ulint
11553 ut_calc_align_down(
11554
11555
11556  ulint n,
11557  ulint align_no);
11558
11559
11560 static inline
11561 void*
11562 ut_align(
11563
11564
11565  void* ptr,
11566  ulint align_no);
11567
11568
11569
11570 static inline
11571 void*
11572 ut_align_down(
11573
11574
11575  void* ptr,
11576  ulint align_no)
11577   __attribute__((const));
11578
11579
11580
11581 static inline
11582 ulint
11583 ut_align_offset(
11584
11585
11586
11587  const void* ptr,
11588  ulint align_no)
11589    __attribute__((const));
11590
11591
11592 static inline
11593 ulint
11594 ut_bit_get_nth(
11595
11596
11597
11598  ulint a,
11599  ulint n);
11600
11601
11602 static inline
11603 ulint
11604 ut_bit_set_nth(
11605
11606
11607  ulint a,
11608  ulint n,
11609  ulint val);
11610
11611
11612 # 1 "./include/ut0byte.ic" 1
11613 # 11 "./include/ut0byte.ic"
11614 static inline
11615 dulint
11616 ut_dulint_create(
11617
11618
11619  ulint high,
11620  ulint low)
11621 {
11622  dulint res;
11623
11624  ;
11625  ;
11626
11627  res.high = high;
11628  res.low = low;
11629
11630  return(res);
11631 }
11632
11633
11634
11635 static inline
11636 ulint
11637 ut_dulint_get_high(
11638
11639
11640  dulint d)
11641 {
11642  return(d.high);
11643 }
11644
11645
11646
11647 static inline
11648 ulint
11649 ut_dulint_get_low(
11650
11651
11652  dulint d)
11653 {
11654  return(d.low);
11655 }
11656
11657
11658
11659
11660 static inline
11661 ib_longlong
11662 ut_conv_dulint_to_longlong(
11663
11664
11665  dulint d)
11666 {
11667  return((ib_longlong)d.low
11668   + (((ib_longlong)d.high) << 32));
11669 }
11670
11671
11672
11673 static inline
11674 ulint
11675 ut_dulint_is_zero(
11676
11677
11678  dulint a)
11679 {
11680  if ((a.low == 0) && (a.high == 0)) {
11681
11682   return((1));
11683  }
11684
11685  return((0));
11686 }
11687
11688
11689
11690 static inline
11691 int
11692 ut_dulint_cmp(
11693
11694
11695
11696  dulint a,
11697  dulint b)
11698 {
11699  if (a.high > b.high) {
11700   return(1);
11701  } else if (a.high < b.high) {
11702   return(-1);
11703  } else if (a.low > b.low) {
11704   return(1);
11705  } else if (a.low < b.low) {
11706   return(-1);
11707  } else {
11708   return(0);
11709  }
11710 }
11711
11712
11713
11714 static inline
11715 dulint
11716 ut_dulint_get_max(
11717
11718
11719  dulint a,
11720  dulint b)
11721 {
11722  if (ut_dulint_cmp(a, b) > 0) {
11723
11724   return(a);
11725  }
11726
11727  return(b);
11728 }
11729
11730
11731
11732 static inline
11733 dulint
11734 ut_dulint_get_min(
11735
11736
11737  dulint a,
11738  dulint b)
11739 {
11740  if (ut_dulint_cmp(a, b) > 0) {
11741
11742   return(b);
11743  }
11744
11745  return(a);
11746 }
11747
11748
11749
11750 static inline
11751 dulint
11752 ut_dulint_add(
11753
11754
11755  dulint a,
11756  ulint b)
11757 {
11758  if (0xFFFFFFFFUL - b >= a.low) {
11759   a.low += b;
11760
11761   return(a);
11762  }
11763
11764  a.low = a.low - (0xFFFFFFFFUL - b) - 1;
11765
11766  a.high++;
11767
11768  return(a);
11769 }
11770
11771
11772
11773 static inline
11774 dulint
11775 ut_dulint_subtract(
11776
11777
11778  dulint a,
11779  ulint b)
11780 {
11781  if (a.low >= b) {
11782   a.low -= b;
11783
11784   return(a);
11785  }
11786
11787  b -= a.low + 1;
11788
11789  a.low = 0xFFFFFFFFUL - b;
11790
11791  ;
11792
11793  a.high--;
11794
11795  return(a);
11796 }
11797
11798
11799
11800
11801 static inline
11802 ulint
11803 ut_dulint_minus(
11804
11805
11806  dulint a,
11807
11808  dulint b)
11809 {
11810  ulint diff;
11811
11812  if (a.high == b.high) {
11813   ;
11814
11815   return(a.low - b.low);
11816  }
11817
11818  ;
11819
11820  diff = (ulint)(0xFFFFFFFFUL - b.low);
11821  diff += 1 + a.low;
11822
11823  ;
11824
11825  return(diff);
11826 }
11827
11828
11829
11830 static inline
11831 dulint
11832 ut_dulint_align_down(
11833
11834
11835  dulint n,
11836  ulint align_no)
11837
11838 {
11839  ulint low, high;
11840
11841  ;
11842  ;
11843
11844  low = ut_dulint_get_low(n);
11845  high = ut_dulint_get_high(n);
11846
11847  low = low & ~(align_no - 1);
11848
11849  return(ut_dulint_create(high, low));
11850 }
11851
11852
11853
11854 static inline
11855 dulint
11856 ut_dulint_align_up(
11857
11858
11859  dulint n,
11860  ulint align_no)
11861
11862 {
11863  return(ut_dulint_align_down(ut_dulint_add(n, align_no - 1), align_no));
11864 }
11865
11866
11867
11868
11869
11870 static inline
11871 ulint
11872 ut_calc_align(
11873
11874
11875  ulint n,
11876  ulint align_no)
11877 {
11878  ;
11879  ;
11880
11881  return((n + align_no - 1) & ~(align_no - 1));
11882 }
11883
11884
11885
11886 static inline
11887 void*
11888 ut_align(
11889
11890
11891  void* ptr,
11892  ulint align_no)
11893 {
11894  ;
11895  ;
11896  ;
11897
11898  ;
11899
11900  return((void*)((((ulint)ptr) + align_no - 1) & ~(align_no - 1)));
11901 }
11902
11903
11904
11905
11906
11907 static inline
11908 ulint
11909 ut_calc_align_down(
11910
11911
11912  ulint n,
11913  ulint align_no)
11914 {
11915  ;
11916  ;
11917
11918  return(n & ~(align_no - 1));
11919 }
11920
11921
11922
11923
11924 static inline
11925 void*
11926 ut_align_down(
11927
11928
11929  void* ptr,
11930  ulint align_no)
11931 {
11932  ;
11933  ;
11934  ;
11935
11936  ;
11937
11938  return((void*)((((ulint)ptr)) & ~(align_no - 1)));
11939 }
11940
11941
11942
11943
11944 static inline
11945 ulint
11946 ut_align_offset(
11947
11948
11949
11950  const void* ptr,
11951  ulint align_no)
11952 {
11953  ;
11954  ;
11955  ;
11956
11957  ;
11958
11959  return(((ulint)ptr) & (align_no - 1));
11960 }
11961
11962
11963
11964 static inline
11965 ulint
11966 ut_bit_get_nth(
11967
11968
11969
11970  ulint a,
11971  ulint n)
11972 {
11973  ;
11974  ;
11975
11976  return(1 & (a >> n));
11977 }
11978
11979
11980
11981 static inline
11982 ulint
11983 ut_bit_set_nth(
11984
11985
11986  ulint a,
11987  ulint n,
11988  ulint val)
11989 {
11990  ;
11991  ;
11992
11993  if (val) {
11994   return(((ulint) 1 << n) | a);
11995  } else {
11996   return(~((ulint) 1 << n) & a);
11997  }
11998 }
11999 # 248 "./include/ut0byte.h" 2
12000 # 17 "./include/fil0fil.h" 2
12001 # 1 "./include/os0file.h" 1
12002 # 14 "./include/os0file.h"
12003 # 1 "./include/trx0types.h" 1
12004 # 12 "./include/trx0types.h"
12005 # 1 "./include/lock0types.h" 1
12006 # 13 "./include/lock0types.h"
12007 typedef struct lock_struct ib_lock_t;
12008 typedef struct lock_sys_struct lock_sys_t;
12009 # 13 "./include/trx0types.h" 2
12010
12011
12012
12013 typedef struct trx_struct trx_t;
12014 typedef struct trx_sys_struct trx_sys_t;
12015 typedef struct trx_doublewrite_struct trx_doublewrite_t;
12016 typedef struct trx_sig_struct trx_sig_t;
12017 typedef struct trx_rseg_struct trx_rseg_t;
12018 typedef struct trx_undo_struct trx_undo_t;
12019 typedef struct trx_undo_arr_struct trx_undo_arr_t;
12020 typedef struct trx_undo_inf_struct trx_undo_inf_t;
12021 typedef struct trx_purge_struct trx_purge_t;
12022 typedef struct roll_node_struct roll_node_t;
12023 typedef struct commit_node_struct commit_node_t;
12024 typedef struct trx_named_savept_struct trx_named_savept_t;
12025
12026
12027 typedef struct trx_savept_struct trx_savept_t;
12028 struct trx_savept_struct{
12029  dulint least_undo_no;
12030 };
12031
12032
12033 typedef unsigned char trx_sysf_t;
12034 typedef unsigned char trx_rsegf_t;
12035 typedef unsigned char trx_usegf_t;
12036 typedef unsigned char trx_ulogf_t;
12037 typedef unsigned char trx_upagef_t;
12038
12039
12040 typedef unsigned char trx_undo_rec_t;
12041 # 15 "./include/os0file.h" 2
12042
12043
12044 # 1 "/usr/include/dirent.h" 1 3 4
12045 # 28 "/usr/include/dirent.h" 3 4
12046
12047 # 62 "/usr/include/dirent.h" 3 4
12048 # 1 "/usr/include/bits/dirent.h" 1 3 4
12049 # 23 "/usr/include/bits/dirent.h" 3 4
12050 struct dirent
12051   {
12052
12053     __ino_t d_ino;
12054     __off_t d_off;
12055
12056
12057
12058
12059     unsigned short int d_reclen;
12060     unsigned char d_type;
12061     char d_name[256];
12062   };
12063
12064
12065 struct dirent64
12066   {
12067     __ino64_t d_ino;
12068     __off64_t d_off;
12069     unsigned short int d_reclen;
12070     unsigned char d_type;
12071     char d_name[256];
12072   };
12073 # 63 "/usr/include/dirent.h" 2 3 4
12074 # 98 "/usr/include/dirent.h" 3 4
12075 enum
12076   {
12077     DT_UNKNOWN = 0,
12078
12079     DT_FIFO = 1,
12080
12081     DT_CHR = 2,
12082
12083     DT_DIR = 4,
12084
12085     DT_BLK = 6,
12086
12087     DT_REG = 8,
12088
12089     DT_LNK = 10,
12090
12091     DT_SOCK = 12,
12092
12093     DT_WHT = 14
12094
12095   };
12096 # 128 "/usr/include/dirent.h" 3 4
12097 typedef struct __dirstream DIR;
12098
12099
12100
12101
12102
12103
12104 extern DIR *opendir (__const char *__name) __attribute__ ((__nonnull__ (1)));
12105
12106
12107
12108
12109
12110
12111 extern DIR *fdopendir (int __fd);
12112
12113
12114
12115
12116
12117
12118
12119 extern int closedir (DIR *__dirp) __attribute__ ((__nonnull__ (1)));
12120 # 163 "/usr/include/dirent.h" 3 4
12121 extern struct dirent *readdir (DIR *__dirp) __attribute__ ((__nonnull__ (1)));
12122 # 174 "/usr/include/dirent.h" 3 4
12123 extern struct dirent64 *readdir64 (DIR *__dirp) __attribute__ ((__nonnull__ (1)));
12124 # 184 "/usr/include/dirent.h" 3 4
12125 extern int readdir_r (DIR *__restrict __dirp,
12126         struct dirent *__restrict __entry,
12127         struct dirent **__restrict __result)
12128      __attribute__ ((__nonnull__ (1, 2, 3)));
12129 # 201 "/usr/include/dirent.h" 3 4
12130 extern int readdir64_r (DIR *__restrict __dirp,
12131    struct dirent64 *__restrict __entry,
12132    struct dirent64 **__restrict __result)
12133      __attribute__ ((__nonnull__ (1, 2, 3)));
12134
12135
12136
12137
12138 extern void rewinddir (DIR *__dirp) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
12139
12140
12141
12142
12143
12144 extern void seekdir (DIR *__dirp, long int __pos) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
12145
12146
12147 extern long int telldir (DIR *__dirp) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
12148
12149
12150
12151
12152
12153 extern int dirfd (DIR *__dirp) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
12154 # 245 "/usr/include/dirent.h" 3 4
12155 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 1 3 4
12156 # 246 "/usr/include/dirent.h" 2 3 4
12157
12158
12159
12160
12161
12162
12163 extern int scandir (__const char *__restrict __dir,
12164       struct dirent ***__restrict __namelist,
12165       int (*__selector) (__const struct dirent *),
12166       int (*__cmp) (__const struct dirent **,
12167       __const struct dirent **))
12168      __attribute__ ((__nonnull__ (1, 2)));
12169 # 275 "/usr/include/dirent.h" 3 4
12170 extern int scandir64 (__const char *__restrict __dir,
12171         struct dirent64 ***__restrict __namelist,
12172         int (*__selector) (__const struct dirent64 *),
12173         int (*__cmp) (__const struct dirent64 **,
12174         __const struct dirent64 **))
12175      __attribute__ ((__nonnull__ (1, 2)));
12176
12177
12178
12179
12180 extern int alphasort (__const struct dirent **__e1,
12181         __const struct dirent **__e2)
12182      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
12183 # 300 "/usr/include/dirent.h" 3 4
12184 extern int alphasort64 (__const struct dirent64 **__e1,
12185    __const struct dirent64 **__e2)
12186      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
12187 # 313 "/usr/include/dirent.h" 3 4
12188 extern __ssize_t getdirentries (int __fd, char *__restrict __buf,
12189     size_t __nbytes,
12190     __off_t *__restrict __basep)
12191      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 4)));
12192 # 330 "/usr/include/dirent.h" 3 4
12193 extern __ssize_t getdirentries64 (int __fd, char *__restrict __buf,
12194       size_t __nbytes,
12195       __off64_t *__restrict __basep)
12196      __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2, 4)));
12197
12198
12199
12200
12201
12202
12203 extern int versionsort (__const struct dirent **__e1,
12204    __const struct dirent **__e2)
12205      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
12206 # 356 "/usr/include/dirent.h" 3 4
12207 extern int versionsort64 (__const struct dirent64 **__e1,
12208      __const struct dirent64 **__e2)
12209      __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
12210
12211
12212
12213
12214 # 18 "./include/os0file.h" 2
12215
12216
12217
12218
12219 typedef struct fil_node_struct fil_node_t;
12220
12221
12222
12223
12224 extern ulint os_has_said_disk_full;
12225 extern ulint os_aio_print_debug;
12226
12227 extern ulint os_file_n_pending_preads;
12228 extern ulint os_file_n_pending_pwrites;
12229
12230 extern ulint os_n_pending_reads;
12231 extern ulint os_n_pending_writes;
12232 # 49 "./include/os0file.h"
12233 typedef int os_file_t;
12234
12235
12236 extern ulint os_innodb_umask;
12237
12238
12239
12240
12241
12242 extern ulint os_aio_use_native_aio;
12243 # 138 "./include/os0file.h"
12244 extern ulint os_n_file_reads;
12245 extern ulint os_n_file_writes;
12246 extern ulint os_n_fsyncs;
12247
12248
12249
12250 enum os_file_type_enum{
12251     OS_FILE_TYPE_UNKNOWN = 0,
12252     OS_FILE_TYPE_FILE,
12253     OS_FILE_TYPE_DIR,
12254     OS_FILE_TYPE_LINK
12255 };
12256 typedef enum os_file_type_enum os_file_type_t;
12257 # 159 "./include/os0file.h"
12258 struct os_file_stat_struct{
12259  char name[4000];
12260  os_file_type_t type;
12261  ib_longlong size;
12262  time_t ctime;
12263  time_t mtime;
12264  time_t atime;
12265 };
12266 typedef struct os_file_stat_struct os_file_stat_t;
12267
12268
12269
12270
12271 typedef DIR* os_file_dir_t;
12272
12273
12274
12275
12276
12277 ulint
12278 os_get_os_version(void);
12279
12280
12281
12282
12283
12284 void
12285 os_io_init_simple(void);
12286
12287
12288
12289
12290 FILE*
12291 os_file_create_tmpfile(void);
12292 # 201 "./include/os0file.h"
12293 os_file_dir_t
12294 os_file_opendir(
12295
12296
12297
12298  const char* dirname,
12299
12300  ulint error_is_fatal);
12301
12302
12303
12304
12305
12306
12307
12308 int
12309 os_file_closedir(
12310
12311
12312  os_file_dir_t dir);
12313
12314
12315
12316
12317 int
12318 os_file_readdir_next_file(
12319
12320
12321
12322  const char* dirname,
12323  os_file_dir_t dir,
12324  os_file_stat_t* info);
12325
12326
12327
12328
12329
12330
12331 ulint
12332 os_file_create_directory(
12333
12334
12335
12336  const char* pathname,
12337
12338  ulint fail_if_exists);
12339
12340
12341
12342
12343 os_file_t
12344 os_file_create_simple(
12345
12346
12347
12348
12349  const char* name,
12350
12351  ulint create_mode,
12352
12353
12354
12355
12356
12357
12358  ulint access_type,
12359
12360  ulint* success);
12361
12362
12363
12364 os_file_t
12365 os_file_create_simple_no_error_handling(
12366
12367
12368
12369
12370  const char* name,
12371
12372  ulint create_mode,
12373
12374
12375
12376  ulint access_type,
12377
12378
12379
12380  ulint* success);
12381
12382
12383
12384 os_file_t
12385 os_file_create(
12386
12387
12388
12389
12390  const char* name,
12391
12392  ulint create_mode,
12393
12394
12395
12396
12397
12398
12399
12400  ulint purpose,
12401
12402
12403
12404
12405
12406
12407  ulint type,
12408  ulint* success);
12409
12410
12411
12412 ulint
12413 os_file_delete(
12414
12415
12416  const char* name);
12417
12418
12419
12420
12421 ulint
12422 os_file_delete_if_exists(
12423
12424
12425  const char* name);
12426
12427
12428
12429
12430 ulint
12431 os_file_rename(
12432
12433
12434  const char* oldpath,
12435
12436  const char* newpath);
12437
12438
12439
12440
12441 ulint
12442 os_file_close(
12443
12444
12445  os_file_t file);
12446
12447
12448
12449 ulint
12450 os_file_close_no_error_handling(
12451
12452
12453  os_file_t file);
12454
12455
12456
12457 ulint
12458 os_file_get_size(
12459
12460
12461  os_file_t file,
12462  ulint* size,
12463
12464  ulint* size_high);
12465
12466
12467
12468 ib_longlong
12469 os_file_get_size_as_iblonglong(
12470
12471
12472  os_file_t file);
12473
12474
12475
12476 ulint
12477 os_file_set_size(
12478
12479
12480  const char* name,
12481
12482  os_file_t file,
12483  ulint size,
12484
12485  ulint size_high);
12486
12487
12488
12489 ulint
12490 os_file_set_eof(
12491
12492
12493  FILE* file);
12494
12495
12496
12497 ulint
12498 os_file_flush(
12499
12500
12501  os_file_t file);
12502
12503
12504
12505
12506
12507
12508 ulint
12509 os_file_get_last_error(
12510
12511
12512
12513  ulint report_all_errors);
12514
12515
12516
12517
12518
12519
12520
12521 ulint
12522 _os_file_read(
12523
12524
12525
12526  os_file_t file,
12527  void* buf,
12528  ulint offset,
12529
12530  ulint offset_high,
12531
12532  ulint n,
12533  trx_t* trx);
12534
12535
12536
12537
12538
12539 void
12540 os_file_read_string(
12541
12542  FILE* file,
12543  char* str,
12544  ulint size);
12545
12546
12547
12548
12549 ulint
12550 os_file_read_no_error_handling(
12551
12552
12553
12554  os_file_t file,
12555  void* buf,
12556  ulint offset,
12557
12558  ulint offset_high,
12559
12560  ulint n);
12561
12562
12563
12564
12565 ulint
12566 os_file_write(
12567
12568
12569
12570  const char* name,
12571
12572  os_file_t file,
12573  const void* buf,
12574  ulint offset,
12575
12576  ulint offset_high,
12577
12578  ulint n);
12579
12580
12581
12582 ulint
12583 os_file_status(
12584
12585
12586  const char* path,
12587  ulint* exists,
12588  os_file_type_t* type);
12589 # 525 "./include/os0file.h"
12590 char*
12591 os_file_dirname(
12592
12593
12594
12595  const char* path);
12596
12597
12598
12599 ulint
12600 os_file_create_subdirs_if_needed(
12601
12602
12603
12604  const char* path);
12605 # 549 "./include/os0file.h"
12606 void
12607 os_aio_init(
12608
12609  ulint n,
12610
12611
12612
12613  ulint n_read_threads,
12614  ulint n_write_threads,
12615  ulint n_slots_sync);
12616
12617
12618
12619 ulint
12620 os_aio(
12621
12622
12623
12624  ulint type,
12625  ulint mode,
12626 # 581 "./include/os0file.h"
12627  const char* name,
12628
12629  os_file_t file,
12630  void* buf,
12631
12632  ulint offset,
12633
12634  ulint offset_high,
12635
12636  ulint n,
12637  fil_node_t* message1,
12638
12639
12640
12641  void* message2,
12642  trx_t* trx);
12643
12644
12645
12646
12647 void
12648 os_aio_wake_all_threads_at_shutdown(void);
12649
12650
12651
12652
12653
12654 void
12655 os_aio_wait_until_no_pending_writes(void);
12656
12657
12658
12659
12660 void
12661 os_aio_simulated_wake_handler_threads(void);
12662
12663
12664
12665
12666
12667
12668
12669 void
12670 os_aio_simulated_put_read_threads_to_sleep(void);
12671 # 681 "./include/os0file.h"
12672 ulint
12673 os_aio_simulated_handle(
12674
12675
12676  ulint segment,
12677
12678
12679
12680
12681  fil_node_t**message1,
12682
12683
12684
12685
12686  void** message2,
12687  ulint* type);
12688
12689
12690
12691 ulint
12692 os_aio_validate(void);
12693
12694
12695
12696
12697
12698 void
12699 os_aio_print(
12700
12701  FILE* file);
12702
12703
12704
12705 void
12706 os_aio_refresh_stats(void);
12707 # 730 "./include/os0file.h"
12708 ulint
12709 os_file_get_status(
12710
12711
12712  const char* path,
12713  os_file_stat_t* stat_info);
12714 # 18 "./include/fil0fil.h" 2
12715
12716
12717
12718
12719 extern const char* fil_path_to_mysql_datadir;
12720 # 34 "./include/fil0fil.h"
12721 typedef unsigned char fil_faddr_t;
12722 # 44 "./include/fil0fil.h"
12723 typedef struct fil_addr_struct fil_addr_t;
12724 struct fil_addr_struct{
12725  ulint page;
12726  ulint boffset;
12727 };
12728
12729
12730 extern fil_addr_t fil_addr_null;
12731 # 92 "./include/fil0fil.h"
12732 extern ulint fil_n_log_flushes;
12733
12734 extern ulint fil_n_pending_log_flushes;
12735 extern ulint fil_n_pending_tablespace_flushes;
12736
12737
12738
12739
12740
12741 ib_longlong
12742 fil_space_get_version(
12743
12744
12745
12746  ulint id);
12747
12748
12749
12750 rw_lock_t*
12751 fil_space_get_latch(
12752
12753
12754  ulint id);
12755
12756
12757
12758 ulint
12759 fil_space_get_type(
12760
12761
12762  ulint id);
12763
12764
12765
12766 ibuf_data_t*
12767 fil_space_get_ibuf_data(
12768
12769
12770  ulint id);
12771
12772
12773
12774 void
12775 fil_node_create(
12776
12777  const char* name,
12778  ulint size,
12779
12780  ulint id,
12781  ulint is_raw);
12782
12783
12784
12785
12786
12787 void
12788 fil_space_truncate_start(
12789
12790  ulint id,
12791  ulint trunc_len);
12792
12793
12794
12795
12796
12797
12798 ulint
12799 fil_space_create(
12800
12801
12802  const char* name,
12803  ulint id,
12804  ulint purpose);
12805
12806
12807
12808
12809 ulint
12810 fil_space_free(
12811
12812
12813  ulint id);
12814
12815
12816
12817
12818 ulint
12819 fil_space_get_size(
12820
12821
12822  ulint id);
12823
12824
12825
12826
12827 ulint
12828 fil_check_adress_in_tablespace(
12829
12830
12831  ulint id,
12832  ulint page_no);
12833
12834
12835
12836 void
12837 fil_init(
12838
12839  ulint max_n_open);
12840
12841
12842
12843 void
12844 fil_print(
12845
12846  FILE* file);
12847
12848
12849
12850
12851
12852
12853
12854 void
12855 fil_open_log_and_system_tablespace_files(void);
12856
12857
12858
12859
12860
12861 void
12862 fil_close_all_files(void);
12863
12864
12865
12866
12867
12868 void
12869 fil_set_max_space_id_if_bigger(
12870
12871  ulint max_id);
12872
12873
12874
12875
12876
12877 void
12878 fil_ibuf_init_at_db_start(void);
12879
12880
12881
12882
12883
12884 ulint
12885 fil_write_flushed_lsn_to_data_files(
12886
12887
12888  dulint lsn,
12889  ulint arch_log_no);
12890
12891
12892
12893
12894 void
12895 fil_read_flushed_lsn_and_arch_log_no(
12896
12897  os_file_t data_file,
12898  ulint one_read_already,
12899
12900
12901
12902
12903
12904  dulint* min_flushed_lsn,
12905  dulint* max_flushed_lsn);
12906
12907
12908
12909
12910 ulint
12911 fil_inc_pending_ibuf_merges(
12912
12913
12914
12915  ulint id);
12916
12917
12918
12919 void
12920 fil_decr_pending_ibuf_merges(
12921
12922  ulint id);
12923 # 296 "./include/fil0fil.h"
12924 unsigned char*
12925 fil_op_log_parse_or_replay(
12926
12927
12928
12929
12930         unsigned char* ptr,
12931
12932
12933         unsigned char* end_ptr,
12934  ulint type,
12935  ulint do_replay,
12936
12937  ulint space_id);
12938
12939
12940
12941
12942
12943
12944 ulint
12945 fil_delete_tablespace(
12946
12947
12948  ulint id);
12949 # 330 "./include/fil0fil.h"
12950 ulint
12951 fil_discard_tablespace(
12952
12953
12954  ulint id);
12955
12956
12957
12958
12959 ulint
12960 fil_rename_tablespace(
12961
12962
12963  const char* old_name,
12964
12965
12966
12967  ulint id,
12968  const char* new_name);
12969 # 359 "./include/fil0fil.h"
12970 ulint
12971 fil_create_new_single_table_tablespace(
12972
12973
12974  ulint* space_id,
12975
12976
12977  const char* tablename,
12978
12979
12980
12981  ulint is_temp,
12982
12983  ulint size);
12984 # 385 "./include/fil0fil.h"
12985 ulint
12986 fil_open_single_table_tablespace(
12987
12988
12989  ulint check_space_id,
12990
12991
12992
12993
12994
12995
12996  ulint id,
12997  const char* name);
12998 # 409 "./include/fil0fil.h"
12999 ulint
13000 fil_reset_too_high_lsns(
13001
13002
13003  const char* name,
13004
13005  dulint current_lsn);
13006 # 426 "./include/fil0fil.h"
13007 ulint
13008 fil_load_single_table_tablespaces(void);
13009 # 437 "./include/fil0fil.h"
13010 void
13011 fil_print_orphaned_tablespaces(void);
13012
13013
13014
13015
13016
13017 ulint
13018 fil_tablespace_deleted_or_being_deleted_in_mem(
13019
13020
13021
13022  ulint id,
13023  ib_longlong version);
13024
13025
13026
13027
13028
13029 ulint
13030 fil_tablespace_exists_in_mem(
13031
13032
13033  ulint id);
13034
13035
13036
13037
13038
13039 ulint
13040 fil_space_for_table_exists_in_mem(
13041
13042
13043
13044  ulint id,
13045  const char* name,
13046
13047
13048  ulint is_temp,
13049
13050  ulint mark_space,
13051
13052
13053
13054
13055
13056  ulint print_error_if_does_not_exist);
13057 # 493 "./include/fil0fil.h"
13058 ulint
13059 fil_extend_space_to_desired_size(
13060
13061
13062  ulint* actual_size,
13063
13064
13065  ulint space_id,
13066  ulint size_after_extend);
13067 # 518 "./include/fil0fil.h"
13068 ulint
13069 fil_space_reserve_free_extents(
13070
13071
13072  ulint id,
13073  ulint n_free_now,
13074  ulint n_to_reserve);
13075
13076
13077
13078 void
13079 fil_space_release_free_extents(
13080
13081  ulint id,
13082  ulint n_reserved);
13083
13084
13085
13086
13087 ulint
13088 fil_space_get_n_reserved_extents(
13089
13090  ulint id);
13091
13092
13093
13094
13095
13096
13097 ulint
13098 _fil_io(
13099
13100
13101
13102
13103  ulint type,
13104 # 562 "./include/fil0fil.h"
13105  ulint sync,
13106  ulint space_id,
13107  ulint block_offset,
13108  ulint byte_offset,
13109
13110
13111  ulint len,
13112
13113
13114  void* buf,
13115
13116
13117  void* message,
13118
13119  trx_t* trx);
13120
13121
13122
13123
13124
13125 ulint
13126 fil_read(
13127
13128
13129
13130
13131  ulint sync,
13132  ulint space_id,
13133  ulint block_offset,
13134  ulint byte_offset,
13135
13136  ulint len,
13137
13138
13139  void* buf,
13140
13141  void* message);
13142
13143
13144
13145
13146
13147
13148 ulint
13149 fil_write(
13150
13151
13152
13153
13154  ulint sync,
13155  ulint space_id,
13156  ulint block_offset,
13157  ulint byte_offset,
13158
13159  ulint len,
13160
13161
13162  void* buf,
13163
13164  void* message);
13165
13166
13167
13168
13169
13170
13171
13172 void
13173 fil_aio_wait(
13174
13175  ulint segment);
13176
13177
13178
13179 typedef enum {
13180  FLUSH_FROM_DIRTY_BUFFER,
13181  FLUSH_FROM_OTHER,
13182  FLUSH_FROM_CHECKPOINT,
13183  FLUSH_FROM_LOG_IO_COMPLETE,
13184  FLUSH_FROM_LOG_WRITE_UP_TO,
13185  FLUSH_FROM_ARCHIVE,
13186  FLUSH_FROM_NUMBER
13187 } flush_from_type;
13188
13189
13190
13191
13192 void
13193 fil_flush(
13194
13195  ulint space_id,
13196
13197  flush_from_type flush_type);
13198
13199
13200
13201
13202 void
13203 fil_flush_file_spaces(
13204
13205  ulint purpose,
13206  flush_from_type flush_type);
13207
13208
13209
13210 ulint
13211 fil_validate(void);
13212
13213
13214
13215
13216
13217 ulint
13218 fil_addr_is_null(
13219
13220
13221  fil_addr_t addr);
13222
13223
13224
13225 ulint
13226 fil_page_get_prev(unsigned char* page);
13227 ulint
13228 fil_page_get_next(unsigned char* page);
13229
13230
13231
13232 void
13233 fil_page_set_type(
13234
13235  unsigned char* page,
13236  ulint type);
13237
13238
13239
13240 ulint
13241 fil_page_get_type(
13242
13243
13244
13245  unsigned char* page);
13246
13247
13248
13249
13250 ulint
13251 fil_system_hash_cells(void);
13252
13253
13254 ulint
13255 fil_system_hash_nodes(void);
13256
13257
13258 typedef struct fil_space_struct fil_space_t;
13259 # 28 "./include/buf0buf.h" 2
13260 # 1 "./include/mtr0types.h" 1
13261 # 12 "./include/mtr0types.h"
13262 typedef struct mtr_struct mtr_t;
13263 # 29 "./include/buf0buf.h" 2
13264 # 1 "./include/buf0types.h" 1
13265 # 12 "./include/buf0types.h"
13266 typedef struct buf_block_struct buf_block_t;
13267 typedef struct buf_pool_struct buf_pool_t;
13268
13269 typedef struct buf_io_counter_struct buf_io_counter_t;
13270
13271
13272 typedef unsigned char buf_frame_t;
13273 # 30 "./include/buf0buf.h" 2
13274
13275 # 1 "./include/hash0hash.h" 1
13276 # 13 "./include/hash0hash.h"
13277 # 1 "./include/mem0mem.h" 1
13278 # 16 "./include/mem0mem.h"
13279 # 1 "./include/ut0rnd.h" 1
13280 # 22 "./include/ut0rnd.h"
13281 static inline
13282 void
13283 ut_rnd_set_seed(
13284
13285  ulint seed);
13286
13287
13288 static inline
13289 ulint
13290 ut_rnd_gen_next_ulint(
13291
13292
13293  ulint rnd);
13294
13295
13296
13297
13298
13299 static inline
13300 ulint
13301 ut_rnd_gen_ulint(void);
13302
13303
13304
13305
13306 static inline
13307 ulint
13308 ut_rnd_interval(
13309
13310
13311  ulint low,
13312  ulint high);
13313
13314
13315 static inline
13316 ulint
13317 ut_rnd_gen_ibool(void);
13318
13319
13320
13321
13322
13323
13324 static inline
13325 ulint
13326 ut_hash_ulint(
13327
13328
13329  ulint key,
13330  ulint table_size);
13331
13332
13333 static inline
13334 ulint
13335 ut_fold_ulint_pair(
13336
13337
13338  ulint n1,
13339  ulint n2);
13340
13341
13342 static inline
13343 ulint
13344 ut_fold_dulint(
13345
13346
13347  dulint d);
13348
13349
13350 static inline
13351 ulint
13352 ut_fold_string(
13353
13354
13355  const char* str);
13356
13357
13358 static inline
13359 ulint
13360 ut_fold_binary(
13361
13362
13363  const unsigned char* str,
13364  ulint len);
13365
13366
13367
13368
13369 ulint
13370 ut_find_prime(
13371
13372
13373  ulint n);
13374
13375
13376
13377 # 1 "./include/ut0rnd.ic" 1
13378 # 21 "./include/ut0rnd.ic"
13379 extern ulint ut_rnd_ulint_counter;
13380
13381
13382
13383 static inline
13384 void
13385 ut_rnd_set_seed(
13386
13387  ulint seed)
13388 {
13389  ut_rnd_ulint_counter = seed;
13390 }
13391
13392
13393
13394 static inline
13395 ulint
13396 ut_rnd_gen_next_ulint(
13397
13398
13399  ulint rnd)
13400 {
13401  ulint n_bits;
13402
13403  n_bits = 8 * sizeof(ulint);
13404
13405  rnd = 119785373 * rnd + 126792457;
13406  rnd = 187678878 ^ rnd;
13407  rnd = (rnd << 20) + (rnd >> (n_bits - 20));
13408  rnd = 85689495 * rnd + 63498502;
13409  rnd = 143537923 ^ rnd;
13410  rnd = (rnd << 20) + (rnd >> (n_bits - 20));
13411  rnd = 151117737 * rnd + 98781234;
13412
13413  return(rnd);
13414 }
13415
13416
13417
13418
13419
13420
13421 static inline
13422 ulint
13423 ut_rnd_gen_ulint(void)
13424
13425
13426 {
13427  ulint rnd;
13428  ulint n_bits;
13429
13430  n_bits = 8 * sizeof(ulint);
13431
13432  ut_rnd_ulint_counter =
13433    151117737 * ut_rnd_ulint_counter + 119785373;
13434
13435  rnd = ut_rnd_gen_next_ulint(ut_rnd_ulint_counter);
13436
13437  return(rnd);
13438 }
13439
13440
13441
13442 static inline
13443 ulint
13444 ut_rnd_interval(
13445
13446
13447  ulint low,
13448  ulint high)
13449 {
13450  ulint rnd;
13451
13452  ;
13453
13454  if (low == high) {
13455
13456   return(low);
13457  }
13458
13459  rnd = ut_rnd_gen_ulint();
13460
13461  return(low + (rnd % (high - low + 1)));
13462 }
13463
13464
13465
13466 static inline
13467 ulint
13468 ut_rnd_gen_ibool(void)
13469
13470
13471 {
13472  ulint x;
13473
13474  x = ut_rnd_gen_ulint();
13475
13476  if (((x >> 20) + (x >> 15)) & 1) {
13477
13478   return((1));
13479  }
13480
13481  return((0));
13482 }
13483
13484
13485
13486
13487
13488 static inline
13489 ulint
13490 ut_hash_ulint(
13491
13492
13493  ulint key,
13494  ulint table_size)
13495 {
13496  key = key ^ 1653893711;
13497
13498  return(key % table_size);
13499 }
13500
13501
13502
13503 static inline
13504 ulint
13505 ut_fold_ulint_pair(
13506
13507
13508  ulint n1,
13509  ulint n2)
13510 {
13511  return(((((n1 ^ n2 ^ 1653893711) << 8) + n1)
13512       ^ 1463735687) + n2);
13513 }
13514
13515
13516
13517 static inline
13518 ulint
13519 ut_fold_dulint(
13520
13521
13522  dulint d)
13523 {
13524  return(ut_fold_ulint_pair(ut_dulint_get_low(d),
13525       ut_dulint_get_high(d)));
13526 }
13527
13528
13529
13530 static inline
13531 ulint
13532 ut_fold_string(
13533
13534
13535  const char* str)
13536 {
13537
13538
13539
13540  ulint fold = 0;
13541
13542  ;
13543
13544  while (*str != '\0') {
13545
13546
13547
13548
13549
13550
13551   fold = ut_fold_ulint_pair(fold, (ulint)(*str));
13552   str++;
13553  }
13554
13555  return(fold);
13556 }
13557
13558
13559
13560 static inline
13561 ulint
13562 ut_fold_binary(
13563
13564
13565  const unsigned char* str,
13566  ulint len)
13567 {
13568  const unsigned char* str_end = str + len;
13569  ulint fold = 0;
13570
13571  ;
13572
13573  while (str < str_end) {
13574   fold = ut_fold_ulint_pair(fold, (ulint)(*str));
13575
13576   str++;
13577  }
13578
13579  return(fold);
13580 }
13581 # 119 "./include/ut0rnd.h" 2
13582 # 17 "./include/mem0mem.h" 2
13583
13584
13585 # 1 "./include/mach0data.h" 1
13586 # 23 "./include/mach0data.h"
13587 static inline
13588 void
13589 mach_write_to_1(
13590
13591  unsigned char* b,
13592  ulint n);
13593
13594
13595 static inline
13596 ulint
13597 mach_read_from_1(
13598
13599
13600  unsigned char* b);
13601
13602
13603
13604 static inline
13605 void
13606 mach_write_to_2(
13607
13608  unsigned char* b,
13609  ulint n);
13610
13611
13612
13613 static inline
13614 ulint
13615 mach_read_from_2(
13616
13617
13618  unsigned char* b);
13619
13620
13621
13622
13623
13624 static inline
13625 uint16
13626 mach_encode_2(
13627
13628
13629  ulint n);
13630
13631
13632
13633
13634 static inline
13635 ulint
13636 mach_decode_2(
13637
13638
13639  uint16 n);
13640
13641
13642
13643 static inline
13644 void
13645 mach_write_to_3(
13646
13647  unsigned char* b,
13648  ulint n);
13649
13650
13651
13652 static inline
13653 ulint
13654 mach_read_from_3(
13655
13656
13657  unsigned char* b);
13658
13659
13660
13661 static inline
13662 void
13663 mach_write_to_4(
13664
13665  unsigned char* b,
13666  ulint n);
13667
13668
13669
13670 static inline
13671 ulint
13672 mach_read_from_4(
13673
13674
13675  unsigned char* b);
13676
13677
13678 static inline
13679 ulint
13680 mach_write_compressed(
13681
13682
13683  unsigned char* b,
13684  ulint n);
13685
13686
13687 static inline
13688 ulint
13689 mach_get_compressed_size(
13690
13691
13692  ulint n);
13693
13694
13695 static inline
13696 ulint
13697 mach_read_compressed(
13698
13699
13700  unsigned char* b);
13701
13702
13703
13704 static inline
13705 void
13706 mach_write_to_6(
13707
13708  unsigned char* b,
13709  dulint n);
13710
13711
13712
13713 static inline
13714 dulint
13715 mach_read_from_6(
13716
13717
13718  unsigned char* b);
13719
13720
13721
13722 static inline
13723 void
13724 mach_write_to_7(
13725
13726  unsigned char* b,
13727  dulint n);
13728
13729
13730
13731 static inline
13732 dulint
13733 mach_read_from_7(
13734
13735
13736  unsigned char* b);
13737
13738
13739
13740 static inline
13741 void
13742 mach_write_to_8(
13743
13744  unsigned char* b,
13745  dulint n);
13746
13747
13748
13749 static inline
13750 dulint
13751 mach_read_from_8(
13752
13753
13754  unsigned char* b);
13755
13756
13757 static inline
13758 ulint
13759 mach_dulint_write_compressed(
13760
13761
13762  unsigned char* b,
13763  dulint n);
13764
13765
13766 static inline
13767 ulint
13768 mach_dulint_get_compressed_size(
13769
13770
13771  dulint n);
13772
13773
13774 static inline
13775 dulint
13776 mach_dulint_read_compressed(
13777
13778
13779  unsigned char* b);
13780
13781
13782 static inline
13783 ulint
13784 mach_dulint_write_much_compressed(
13785
13786
13787  unsigned char* b,
13788  dulint n);
13789
13790
13791 static inline
13792 ulint
13793 mach_dulint_get_much_compressed_size(
13794
13795
13796  dulint n);
13797
13798
13799 static inline
13800 dulint
13801 mach_dulint_read_much_compressed(
13802
13803
13804  unsigned char* b);
13805
13806
13807
13808 unsigned char*
13809 mach_parse_compressed(
13810
13811
13812
13813  unsigned char* ptr,
13814  unsigned char* end_ptr,
13815  ulint* val);
13816
13817
13818
13819 unsigned char*
13820 mach_dulint_parse_compressed(
13821
13822
13823
13824  unsigned char* ptr,
13825  unsigned char* end_ptr,
13826  dulint* val);
13827
13828
13829 static inline
13830 double
13831 mach_double_read(
13832
13833
13834  unsigned char* b);
13835
13836
13837 static inline
13838 void
13839 mach_double_write(
13840
13841  unsigned char* b,
13842  double d);
13843
13844
13845 static inline
13846 float
13847 mach_float_read(
13848
13849
13850  unsigned char* b);
13851
13852
13853 static inline
13854 void
13855 mach_float_write(
13856
13857  unsigned char* b,
13858  float d);
13859
13860
13861 static inline
13862 ulint
13863 mach_read_from_n_little_endian(
13864
13865
13866  unsigned char* buf,
13867  ulint buf_size);
13868
13869
13870 static inline
13871 void
13872 mach_write_to_n_little_endian(
13873
13874  unsigned char* dest,
13875  ulint dest_size,
13876  ulint n);
13877
13878
13879 static inline
13880 ulint
13881 mach_read_from_2_little_endian(
13882
13883
13884  unsigned char* buf);
13885
13886
13887 static inline
13888 void
13889 mach_write_to_2_little_endian(
13890
13891  unsigned char* dest,
13892  ulint n);
13893
13894
13895 # 1 "./include/mach0data.ic" 1
13896 # 12 "./include/mach0data.ic"
13897 static inline
13898 void
13899 mach_write_to_1(
13900
13901  unsigned char* b,
13902  ulint n)
13903 {
13904  ;
13905  ;
13906
13907  b[0] = (unsigned char)n;
13908 }
13909
13910
13911
13912 static inline
13913 ulint
13914 mach_read_from_1(
13915
13916
13917  unsigned char* b)
13918 {
13919  ;
13920  return((ulint)(b[0]));
13921 }
13922
13923
13924
13925
13926 static inline
13927 void
13928 mach_write_to_2(
13929
13930  unsigned char* b,
13931  ulint n)
13932 {
13933  ;
13934  ;
13935
13936  b[0] = (unsigned char)(n >> 8);
13937  b[1] = (unsigned char)(n);
13938 }
13939
13940
13941
13942
13943 static inline
13944 ulint
13945 mach_read_from_2(
13946
13947
13948  unsigned char* b)
13949 {
13950  ;
13951  return( ((ulint)(b[0]) << 8)
13952   + (ulint)(b[1])
13953        );
13954 }
13955
13956
13957
13958
13959
13960 static inline
13961 uint16
13962 mach_encode_2(
13963
13964
13965  ulint n)
13966 {
13967  uint16 ret;
13968  ;
13969  mach_write_to_2((unsigned char*) &ret, n);
13970  return(ret);
13971 }
13972
13973
13974
13975
13976 static inline
13977 ulint
13978 mach_decode_2(
13979
13980
13981  uint16 n)
13982 {
13983  ;
13984  return(mach_read_from_2((unsigned char*) &n));
13985 }
13986
13987
13988
13989
13990 static inline
13991 void
13992 mach_write_to_3(
13993
13994  unsigned char* b,
13995  ulint n)
13996 {
13997  ;
13998  ;
13999
14000  b[0] = (unsigned char)(n >> 16);
14001  b[1] = (unsigned char)(n >> 8);
14002  b[2] = (unsigned char)(n);
14003 }
14004
14005
14006
14007
14008 static inline
14009 ulint
14010 mach_read_from_3(
14011
14012
14013  unsigned char* b)
14014 {
14015  ;
14016  return( ((ulint)(b[0]) << 16)
14017   + ((ulint)(b[1]) << 8)
14018   + (ulint)(b[2])
14019        );
14020 }
14021
14022
14023
14024
14025 static inline
14026 void
14027 mach_write_to_4(
14028
14029  unsigned char* b,
14030  ulint n)
14031 {
14032  ;
14033 # 160 "./include/mach0data.ic"
14034  b[0] = (unsigned char)(n >> 24);
14035  b[1] = (unsigned char)(n >> 16);
14036  b[2] = (unsigned char)(n >> 8);
14037  b[3] = (unsigned char)n;
14038
14039 }
14040
14041
14042
14043
14044 static inline
14045 ulint
14046 mach_read_from_4(
14047
14048
14049  unsigned char* b)
14050 {
14051 # 192 "./include/mach0data.ic"
14052  ;
14053  return( ((ulint)(b[0]) << 24)
14054   + ((ulint)(b[1]) << 16)
14055   + ((ulint)(b[2]) << 8)
14056   + (ulint)(b[3])
14057        );
14058
14059 }
14060 # 208 "./include/mach0data.ic"
14061 static inline
14062 ulint
14063 mach_write_compressed(
14064
14065
14066  unsigned char* b,
14067  ulint n)
14068 {
14069  ;
14070
14071  if (n < 0x80UL) {
14072   mach_write_to_1(b, n);
14073   return(1);
14074  } else if (n < 0x4000UL) {
14075   mach_write_to_2(b, n | 0x8000UL);
14076   return(2);
14077  } else if (n < 0x200000UL) {
14078   mach_write_to_3(b, n | 0xC00000UL);
14079   return(3);
14080  } else if (n < 0x10000000UL) {
14081   mach_write_to_4(b, n | 0xE0000000UL);
14082   return(4);
14083  } else {
14084   mach_write_to_1(b, 0xF0UL);
14085   mach_write_to_4(b + 1, n);
14086   return(5);
14087  }
14088 }
14089
14090
14091
14092 static inline
14093 ulint
14094 mach_get_compressed_size(
14095
14096
14097  ulint n)
14098 {
14099  if (n < 0x80UL) {
14100   return(1);
14101  } else if (n < 0x4000UL) {
14102   return(2);
14103  } else if (n < 0x200000UL) {
14104   return(3);
14105  } else if (n < 0x10000000UL) {
14106   return(4);
14107  } else {
14108   return(5);
14109  }
14110 }
14111
14112
14113
14114 static inline
14115 ulint
14116 mach_read_compressed(
14117
14118
14119  unsigned char* b)
14120 {
14121  ulint flag;
14122
14123  ;
14124
14125  flag = mach_read_from_1(b);
14126
14127  if (flag < 0x80UL) {
14128   return(flag);
14129  } else if (flag < 0xC0UL) {
14130   return(mach_read_from_2(b) & 0x7FFFUL);
14131  } else if (flag < 0xE0UL) {
14132   return(mach_read_from_3(b) & 0x3FFFFFUL);
14133  } else if (flag < 0xF0UL) {
14134   return(mach_read_from_4(b) & 0x1FFFFFFFUL);
14135  } else {
14136   ;
14137   return(mach_read_from_4(b + 1));
14138  }
14139 }
14140
14141
14142
14143
14144 static inline
14145 void
14146 mach_write_to_8(
14147
14148  unsigned char* b,
14149  dulint n)
14150 {
14151  ;
14152
14153  mach_write_to_4(b, ut_dulint_get_high(n));
14154  mach_write_to_4(b + 4, ut_dulint_get_low(n));
14155 }
14156
14157
14158
14159
14160 static inline
14161 dulint
14162 mach_read_from_8(
14163
14164
14165  unsigned char* b)
14166 {
14167  ulint high;
14168  ulint low;
14169
14170  ;
14171
14172  high = mach_read_from_4(b);
14173  low = mach_read_from_4(b + 4);
14174
14175  return(ut_dulint_create(high, low));
14176 }
14177
14178
14179
14180
14181 static inline
14182 void
14183 mach_write_to_7(
14184
14185  unsigned char* b,
14186  dulint n)
14187 {
14188  ;
14189
14190  mach_write_to_3(b, ut_dulint_get_high(n));
14191  mach_write_to_4(b + 3, ut_dulint_get_low(n));
14192 }
14193
14194
14195
14196
14197 static inline
14198 dulint
14199 mach_read_from_7(
14200
14201
14202  unsigned char* b)
14203 {
14204  ulint high;
14205  ulint low;
14206
14207  ;
14208
14209  high = mach_read_from_3(b);
14210  low = mach_read_from_4(b + 3);
14211
14212  return(ut_dulint_create(high, low));
14213 }
14214
14215
14216
14217
14218 static inline
14219 void
14220 mach_write_to_6(
14221
14222  unsigned char* b,
14223  dulint n)
14224 {
14225  ;
14226
14227  mach_write_to_2(b, ut_dulint_get_high(n));
14228  mach_write_to_4(b + 2, ut_dulint_get_low(n));
14229 }
14230
14231
14232
14233
14234 static inline
14235 dulint
14236 mach_read_from_6(
14237
14238
14239  unsigned char* b)
14240 {
14241  ulint high;
14242  ulint low;
14243
14244  ;
14245
14246  high = mach_read_from_2(b);
14247  low = mach_read_from_4(b + 2);
14248
14249  return(ut_dulint_create(high, low));
14250 }
14251
14252
14253
14254 static inline
14255 ulint
14256 mach_dulint_write_compressed(
14257
14258
14259  unsigned char* b,
14260  dulint n)
14261 {
14262  ulint size;
14263
14264  ;
14265
14266  size = mach_write_compressed(b, ut_dulint_get_high(n));
14267  mach_write_to_4(b + size, ut_dulint_get_low(n));
14268
14269  return(size + 4);
14270 }
14271
14272
14273
14274 static inline
14275 ulint
14276 mach_dulint_get_compressed_size(
14277
14278
14279  dulint n)
14280 {
14281  return(4 + mach_get_compressed_size(ut_dulint_get_high(n)));
14282 }
14283
14284
14285
14286 static inline
14287 dulint
14288 mach_dulint_read_compressed(
14289
14290
14291  unsigned char* b)
14292 {
14293  ulint high;
14294  ulint low;
14295  ulint size;
14296
14297  ;
14298
14299  high = mach_read_compressed(b);
14300
14301  size = mach_get_compressed_size(high);
14302
14303  low = mach_read_from_4(b + size);
14304
14305  return(ut_dulint_create(high, low));
14306 }
14307
14308
14309
14310 static inline
14311 ulint
14312 mach_dulint_write_much_compressed(
14313
14314
14315  unsigned char* b,
14316  dulint n)
14317 {
14318  ulint size;
14319
14320  ;
14321
14322  if (ut_dulint_get_high(n) == 0) {
14323   return(mach_write_compressed(b, ut_dulint_get_low(n)));
14324  }
14325
14326  *b = (unsigned char)0xFF;
14327  size = 1 + mach_write_compressed(b + 1, ut_dulint_get_high(n));
14328
14329  size += mach_write_compressed(b + size, ut_dulint_get_low(n));
14330
14331  return(size);
14332 }
14333
14334
14335
14336 static inline
14337 ulint
14338 mach_dulint_get_much_compressed_size(
14339
14340
14341  dulint n)
14342 {
14343  if (0 == ut_dulint_get_high(n)) {
14344   return(mach_get_compressed_size(ut_dulint_get_low(n)));
14345  }
14346
14347  return(1 + mach_get_compressed_size(ut_dulint_get_high(n))
14348         + mach_get_compressed_size(ut_dulint_get_low(n)));
14349 }
14350
14351
14352
14353 static inline
14354 dulint
14355 mach_dulint_read_much_compressed(
14356
14357
14358  unsigned char* b)
14359 {
14360  ulint high;
14361  ulint low;
14362  ulint size;
14363
14364  ;
14365
14366  if (*b != (unsigned char)0xFF) {
14367   high = 0;
14368   size = 0;
14369  } else {
14370   high = mach_read_compressed(b + 1);
14371
14372   size = 1 + mach_get_compressed_size(high);
14373  }
14374
14375  low = mach_read_compressed(b + size);
14376
14377  return(ut_dulint_create(high, low));
14378 }
14379
14380
14381
14382 static inline
14383 double
14384 mach_double_read(
14385
14386
14387  unsigned char* b)
14388 {
14389  double d;
14390  ulint i;
14391  unsigned char* ptr;
14392
14393  ptr = (unsigned char*)&d;
14394
14395  for (i = 0; i < sizeof(double); i++) {
14396
14397   ptr[sizeof(double) - i - 1] = b[i];
14398
14399
14400
14401  }
14402
14403  return(d);
14404 }
14405
14406
14407
14408 static inline
14409 void
14410 mach_double_write(
14411
14412  unsigned char* b,
14413  double d)
14414 {
14415  ulint i;
14416  unsigned char* ptr;
14417
14418  ptr = (unsigned char*)&d;
14419
14420  for (i = 0; i < sizeof(double); i++) {
14421
14422   b[i] = ptr[sizeof(double) - i - 1];
14423
14424
14425
14426  }
14427 }
14428
14429
14430
14431 static inline
14432 float
14433 mach_float_read(
14434
14435
14436  unsigned char* b)
14437 {
14438  float d;
14439  ulint i;
14440  unsigned char* ptr;
14441
14442  ptr = (unsigned char*)&d;
14443
14444  for (i = 0; i < sizeof(float); i++) {
14445
14446   ptr[sizeof(float) - i - 1] = b[i];
14447
14448
14449
14450  }
14451
14452  return(d);
14453 }
14454
14455
14456
14457 static inline
14458 void
14459 mach_float_write(
14460
14461  unsigned char* b,
14462  float d)
14463 {
14464  ulint i;
14465  unsigned char* ptr;
14466
14467  ptr = (unsigned char*)&d;
14468
14469  for (i = 0; i < sizeof(float); i++) {
14470
14471   b[i] = ptr[sizeof(float) - i - 1];
14472
14473
14474
14475  }
14476 }
14477
14478
14479
14480 static inline
14481 ulint
14482 mach_read_from_n_little_endian(
14483
14484
14485  unsigned char* buf,
14486  ulint buf_size)
14487 {
14488  ulint n = 0;
14489  unsigned char* ptr;
14490
14491  ;
14492  ;
14493
14494  ptr = buf + buf_size;
14495
14496  for (;;) {
14497   ptr--;
14498
14499   n = n << 8;
14500
14501   n += (ulint)(*ptr);
14502
14503   if (ptr == buf) {
14504    break;
14505   }
14506  }
14507
14508  return(n);
14509 }
14510
14511
14512
14513 static inline
14514 void
14515 mach_write_to_n_little_endian(
14516
14517  unsigned char* dest,
14518  ulint dest_size,
14519  ulint n)
14520 {
14521  unsigned char* end;
14522
14523  ;
14524  ;
14525
14526  end = dest + dest_size;
14527
14528  for (;;) {
14529   *dest = (unsigned char)(n & 0xFF);
14530
14531   n = n >> 8;
14532
14533   dest++;
14534
14535   if (dest == end) {
14536    break;
14537   }
14538  }
14539
14540  ;
14541 }
14542
14543
14544
14545 static inline
14546 ulint
14547 mach_read_from_2_little_endian(
14548
14549
14550  unsigned char* buf)
14551 {
14552  return((ulint)(*buf) + ((ulint)(*(buf + 1))) * 256);
14553 }
14554
14555
14556
14557 static inline
14558 void
14559 mach_write_to_2_little_endian(
14560
14561  unsigned char* dest,
14562  ulint n)
14563 {
14564  ;
14565
14566  *dest = (unsigned char)(n & 0xFFUL);
14567
14568  n = n >> 8;
14569  dest++;
14570
14571  *dest = (unsigned char)(n & 0xFFUL);
14572 }
14573 # 332 "./include/mach0data.h" 2
14574 # 20 "./include/mem0mem.h" 2
14575
14576
14577
14578
14579 typedef struct mem_block_info_struct mem_block_info_t;
14580
14581
14582
14583 typedef mem_block_info_t mem_block_t;
14584
14585
14586 typedef mem_block_t mem_heap_t;
14587 # 57 "./include/mem0mem.h"
14588 void
14589 mem_init(
14590
14591  ulint size);
14592 # 103 "./include/mem0mem.h"
14593 static inline
14594 mem_heap_t*
14595 mem_heap_create_func(
14596
14597
14598  ulint n,
14599
14600
14601
14602
14603
14604  void* init_block,
14605 # 124 "./include/mem0mem.h"
14606  ulint type,
14607
14608  const char* file_name,
14609  ulint line
14610  );
14611
14612
14613
14614
14615 static inline
14616 void
14617 mem_heap_free_func(
14618
14619  mem_heap_t* heap,
14620  const char* file_name,
14621  ulint line);
14622
14623
14624 static inline
14625 void*
14626 mem_heap_alloc(
14627
14628
14629
14630  mem_heap_t* heap,
14631  ulint n);
14632
14633
14634
14635
14636 static inline
14637 unsigned char*
14638 mem_heap_get_heap_top(
14639
14640
14641  mem_heap_t* heap);
14642
14643
14644
14645
14646 static inline
14647 void
14648 mem_heap_free_heap_top(
14649
14650  mem_heap_t* heap,
14651  unsigned char* old_top);
14652
14653
14654 static inline
14655 void
14656 mem_heap_empty(
14657
14658  mem_heap_t* heap);
14659
14660
14661
14662 static inline
14663 void*
14664 mem_heap_get_top(
14665
14666
14667  mem_heap_t* heap,
14668  ulint n);
14669
14670
14671
14672 static inline
14673 void
14674 mem_heap_free_top(
14675
14676  mem_heap_t* heap,
14677  ulint n);
14678
14679
14680 static inline
14681 ulint
14682 mem_heap_get_size(
14683
14684  mem_heap_t* heap);
14685 # 219 "./include/mem0mem.h"
14686 static inline
14687 void*
14688 mem_alloc_func(
14689
14690
14691
14692  ulint n,
14693  const char* file_name,
14694  ulint line
14695 );
14696
14697
14698
14699
14700
14701
14702 void*
14703 mem_alloc_func_noninline(
14704
14705
14706
14707  ulint n,
14708  const char* file_name,
14709  ulint line
14710  );
14711 # 253 "./include/mem0mem.h"
14712 static inline
14713 void
14714 mem_free_func(
14715
14716  void* ptr,
14717  const char* file_name,
14718  ulint line
14719 );
14720
14721
14722
14723 static inline
14724 char*
14725 mem_strdup(
14726
14727
14728
14729  const char* str);
14730
14731
14732 static inline
14733 char*
14734 mem_strdupl(
14735
14736
14737
14738  const char* str,
14739  ulint len);
14740
14741
14742
14743 static inline
14744 char*
14745 mem_strdupq(
14746
14747
14748
14749  const char* str,
14750  char q);
14751
14752
14753
14754
14755 char*
14756 mem_heap_strdup(
14757
14758
14759  mem_heap_t* heap,
14760  const char* str);
14761
14762
14763
14764 static inline
14765 char*
14766 mem_heap_strdupl(
14767
14768
14769  mem_heap_t* heap,
14770  const char* str,
14771  ulint len);
14772 # 328 "./include/mem0mem.h"
14773 struct mem_block_info_struct {
14774  ulint magic_n;
14775  char file_name[8];
14776  ulint line;
14777  struct { ulint count; mem_block_t * start; mem_block_t * end; } base;
14778
14779
14780  struct { mem_block_t * prev; mem_block_t * next; } list;
14781
14782
14783
14784  ulint len;
14785  ulint type;
14786
14787  ulint init_block;
14788
14789
14790  ulint free;
14791
14792  ulint start;
14793
14794  unsigned char* free_block;
14795 # 360 "./include/mem0mem.h"
14796 };
14797
14798
14799
14800
14801
14802
14803
14804 # 1 "./include/mem0dbg.h" 1
14805 # 41 "./include/mem0dbg.h"
14806 void
14807 mem_heap_validate_or_print(
14808
14809  mem_heap_t* heap,
14810  unsigned char* top,
14811
14812
14813  ulint print,
14814
14815
14816  ulint* error,
14817  ulint* us_size,
14818
14819
14820
14821
14822  ulint* ph_size,
14823
14824
14825  ulint* n_blocks);
14826 # 75 "./include/mem0dbg.h"
14827 ulint
14828 mem_heap_check(
14829
14830
14831  mem_heap_t* heap);
14832
14833
14834
14835 ulint
14836 mem_heap_validate(
14837
14838
14839  mem_heap_t* heap);
14840 # 115 "./include/mem0dbg.h"
14841 void
14842 mem_analyze_corruption(
14843
14844  unsigned char* ptr);
14845
14846
14847
14848
14849 void
14850 mem_print_info(void);
14851
14852
14853
14854
14855
14856 void
14857 mem_print_new_info(void);
14858 # 369 "./include/mem0mem.h" 2
14859
14860
14861 # 1 "./include/mem0mem.ic" 1
14862 # 9 "./include/mem0mem.ic"
14863 # 1 "./include/mem0dbg.ic" 1
14864 # 10 "./include/mem0mem.ic" 2
14865
14866 # 1 "./include/mem0pool.h" 1
14867 # 16 "./include/mem0pool.h"
14868 typedef struct mem_area_struct mem_area_t;
14869 typedef struct mem_pool_struct mem_pool_t;
14870
14871
14872 extern mem_pool_t* mem_comm_pool;
14873
14874
14875
14876 struct mem_area_struct{
14877  ulint size_and_free;
14878
14879
14880
14881  struct { mem_area_t * prev; mem_area_t * next; }
14882    free_list;
14883 };
14884 # 40 "./include/mem0pool.h"
14885 mem_pool_t*
14886 mem_pool_create(
14887
14888
14889  ulint size);
14890
14891
14892
14893
14894 void*
14895 mem_area_alloc(
14896
14897
14898  ulint size,
14899
14900
14901  mem_pool_t* pool);
14902
14903
14904
14905 void
14906 mem_area_free(
14907
14908  void* ptr,
14909
14910  mem_pool_t* pool);
14911
14912
14913
14914 ulint
14915 mem_pool_get_reserved(
14916
14917
14918  mem_pool_t* pool);
14919
14920
14921
14922 void
14923 mem_pool_mutex_enter(void);
14924
14925
14926
14927
14928 void
14929 mem_pool_mutex_exit(void);
14930
14931
14932
14933
14934 ulint
14935 mem_pool_validate(
14936
14937
14938  mem_pool_t* pool);
14939
14940
14941
14942 void
14943 mem_pool_print_info(
14944
14945  FILE* outfile,
14946  mem_pool_t* pool);
14947
14948
14949
14950 # 1 "./include/mem0pool.ic" 1
14951 # 106 "./include/mem0pool.h" 2
14952 # 12 "./include/mem0mem.ic" 2
14953
14954
14955
14956
14957 mem_block_t*
14958 mem_heap_create_block(
14959
14960
14961
14962  mem_heap_t* heap,
14963
14964  ulint n,
14965
14966  void* init_block,
14967
14968  ulint type,
14969
14970  const char* file_name,
14971  ulint line);
14972
14973
14974
14975 void
14976 mem_heap_block_free(
14977
14978  mem_heap_t* heap,
14979  mem_block_t* block);
14980
14981
14982
14983 void
14984 mem_heap_free_block_free(
14985
14986  mem_heap_t* heap);
14987
14988
14989
14990 mem_block_t*
14991 mem_heap_add_block(
14992
14993
14994
14995  mem_heap_t* heap,
14996  ulint n);
14997
14998 static inline
14999 void
15000 mem_block_set_len(mem_block_t* block, ulint len)
15001 {
15002  ;
15003
15004  block->len = len;
15005 }
15006
15007 static inline
15008 ulint
15009 mem_block_get_len(mem_block_t* block)
15010 {
15011  return(block->len);
15012 }
15013
15014 static inline
15015 void
15016 mem_block_set_type(mem_block_t* block, ulint type)
15017 {
15018  ;
15019
15020
15021  block->type = type;
15022 }
15023
15024 static inline
15025 ulint
15026 mem_block_get_type(mem_block_t* block)
15027 {
15028  return(block->type);
15029 }
15030
15031 static inline
15032 void
15033 mem_block_set_free(mem_block_t* block, ulint free)
15034 {
15035  ;
15036  ;
15037
15038  block->free = free;
15039 }
15040
15041 static inline
15042 ulint
15043 mem_block_get_free(mem_block_t* block)
15044 {
15045  return(block->free);
15046 }
15047
15048 static inline
15049 void
15050 mem_block_set_start(mem_block_t* block, ulint start)
15051 {
15052  ;
15053
15054  block->start = start;
15055 }
15056
15057 static inline
15058 ulint
15059 mem_block_get_start(mem_block_t* block)
15060 {
15061  return(block->start);
15062 }
15063
15064
15065
15066 static inline
15067 void*
15068 mem_heap_alloc(
15069
15070
15071  mem_heap_t* heap,
15072  ulint n)
15073
15074
15075 {
15076  mem_block_t* block;
15077  void* buf;
15078  ulint free;
15079
15080  ;
15081
15082  block = (heap->base).end;
15083
15084  ;
15085
15086
15087
15088
15089  if (mem_block_get_len(block)
15090    < mem_block_get_free(block) + ut_calc_align((n), 8)) {
15091
15092   block = mem_heap_add_block(heap, n);
15093
15094   if (block == ((void *)0)) {
15095
15096    return(((void *)0));
15097   }
15098  }
15099
15100  free = mem_block_get_free(block);
15101
15102  buf = (unsigned char*)block + free;
15103
15104  mem_block_set_free(block, free + ut_calc_align((n), 8));
15105 # 178 "./include/mem0mem.ic"
15106  return(buf);
15107 }
15108
15109
15110
15111 static inline
15112 unsigned char*
15113 mem_heap_get_heap_top(
15114
15115
15116  mem_heap_t* heap)
15117 {
15118  mem_block_t* block;
15119  unsigned char* buf;
15120
15121  ;
15122
15123  block = (heap->base).end;
15124
15125  buf = (unsigned char*)block + mem_block_get_free(block);
15126
15127  return(buf);
15128 }
15129
15130
15131
15132
15133
15134 static inline
15135 void
15136 mem_heap_free_heap_top(
15137
15138  mem_heap_t* heap,
15139  unsigned char* old_top)
15140 {
15141  mem_block_t* block;
15142  mem_block_t* prev_block;
15143
15144
15145
15146
15147
15148
15149  ;
15150 # 237 "./include/mem0mem.ic"
15151  block = (heap->base).end;
15152
15153  while (block != ((void *)0)) {
15154   if (((unsigned char*)block + mem_block_get_free(block) >= old_top)
15155       && ((unsigned char*)block <= old_top)) {
15156
15157
15158    break;
15159   }
15160
15161
15162
15163
15164   prev_block = (((block)->list).prev);
15165
15166   mem_heap_block_free(heap, block);
15167
15168   block = prev_block;
15169  }
15170
15171  ;
15172
15173
15174  mem_block_set_free(block, old_top - (unsigned char*)block);
15175 # 279 "./include/mem0mem.ic"
15176  if ((heap != block) && (mem_block_get_free(block) ==
15177         mem_block_get_start(block))) {
15178   mem_heap_block_free(heap, block);
15179  }
15180 }
15181
15182
15183
15184 static inline
15185 void
15186 mem_heap_empty(
15187
15188  mem_heap_t* heap)
15189 {
15190  mem_heap_free_heap_top(heap, (unsigned char*)heap + mem_block_get_start(heap));
15191
15192  if (heap->free_block) {
15193   mem_heap_free_block_free(heap);
15194  }
15195 }
15196
15197
15198
15199
15200 static inline
15201 void*
15202 mem_heap_get_top(
15203
15204
15205  mem_heap_t* heap,
15206  ulint n)
15207 {
15208  mem_block_t* block;
15209  void* buf;
15210
15211  ;
15212
15213  block = (heap->base).end;
15214
15215  buf = (unsigned char*)block + mem_block_get_free(block) - ut_calc_align((n), 8);
15216 # 332 "./include/mem0mem.ic"
15217  return(buf);
15218 }
15219
15220
15221
15222
15223 static inline
15224 void
15225 mem_heap_free_top(
15226
15227  mem_heap_t* heap,
15228  ulint n)
15229 {
15230  mem_block_t* block;
15231
15232  ;
15233
15234  block = (heap->base).end;
15235
15236
15237  mem_block_set_free(block, mem_block_get_free(block)
15238       - ut_calc_align((n), 8));
15239 # 365 "./include/mem0mem.ic"
15240  if ((heap != block) && (mem_block_get_free(block) ==
15241        mem_block_get_start(block))) {
15242   mem_heap_block_free(heap, block);
15243  }
15244 }
15245
15246
15247
15248
15249
15250 static inline
15251 mem_heap_t*
15252 mem_heap_create_func(
15253
15254
15255  ulint n,
15256
15257
15258
15259
15260
15261  void* init_block,
15262 # 396 "./include/mem0mem.ic"
15263  ulint type,
15264
15265  const char* file_name,
15266  ulint line
15267  )
15268 {
15269  mem_block_t* block;
15270
15271  if (n > 0) {
15272   block = mem_heap_create_block(((void *)0), n, init_block, type,
15273        file_name, line);
15274  } else {
15275   block = mem_heap_create_block(((void *)0), 64,
15276      init_block, type, file_name, line);
15277  }
15278
15279  ;
15280
15281  { (block->base).count = 0; (block->base).start = ((void *)0); (block->base).end = ((void *)0);};
15282
15283
15284  { ; ((block->base).count)++; ((block)->list).next = (block->base).start; ((block)->list).prev = ((void *)0); if ((block->base).start != ((void *)0)) { (((block->base).start)->list).prev = (block); } (block->base).start = (block); if ((block->base).end == ((void *)0)) { (block->base).end = (block); }};
15285 # 430 "./include/mem0mem.ic"
15286  return(block);
15287 }
15288
15289
15290
15291
15292
15293 static inline
15294 void
15295 mem_heap_free_func(
15296
15297  mem_heap_t* heap,
15298  const char* file_name __attribute__((unused)),
15299
15300  ulint line __attribute__((unused)))
15301 {
15302  mem_block_t* block;
15303  mem_block_t* prev_block;
15304
15305  ;
15306
15307  block = (heap->base).end;
15308 # 462 "./include/mem0mem.ic"
15309  if (heap->free_block) {
15310   mem_heap_free_block_free(heap);
15311  }
15312
15313  while (block != ((void *)0)) {
15314
15315
15316
15317   prev_block = (((block)->list).prev);
15318
15319   mem_heap_block_free(heap, block);
15320
15321   block = prev_block;
15322  }
15323 }
15324
15325
15326
15327
15328
15329
15330 static inline
15331 void*
15332 mem_alloc_func(
15333
15334
15335
15336  ulint n,
15337  const char* file_name,
15338  ulint line
15339  )
15340 {
15341  mem_heap_t* heap;
15342  void* buf;
15343
15344  heap = mem_heap_create_func(n, ((void *)0), 0, file_name,
15345          line);
15346  if (heap == ((void *)0)) {
15347
15348   return(((void *)0));
15349  }
15350
15351
15352
15353
15354
15355
15356  buf = mem_heap_alloc(heap, n);
15357
15358  do { if (__builtin_expect(!((ulint)((unsigned char*)heap == (unsigned char*)buf - ut_calc_align(sizeof(mem_block_info_t), 8) - 0)), (0))) { ut_dbg_assertion_failed("(byte*)heap == (byte*)buf - MEM_BLOCK_HEADER_SIZE - MEM_FIELD_HEADER_SIZE", "./include/mem0mem.ic", (ulint) 512); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/mem0mem.ic", (ulint) 512); } while (0); } while (0);
15359
15360  return(buf);
15361 }
15362
15363
15364
15365
15366
15367 static inline
15368 void
15369 mem_free_func(
15370
15371  void* ptr,
15372  const char* file_name,
15373  ulint line
15374  )
15375 {
15376  mem_heap_t* heap;
15377
15378  heap = (mem_heap_t*)((unsigned char*)ptr - ut_calc_align(sizeof(mem_block_info_t), 8)
15379        - 0);
15380  mem_heap_free_func(heap, file_name, line);
15381 }
15382
15383
15384
15385 static inline
15386 ulint
15387 mem_heap_get_size(
15388
15389  mem_heap_t* heap)
15390 {
15391  mem_block_t* block;
15392  ulint size = 0;
15393
15394  ;
15395
15396  block = heap;
15397
15398  while (block != ((void *)0)) {
15399
15400   size += mem_block_get_len(block);
15401   block = (((block)->list).next);
15402  }
15403
15404  if (heap->free_block) {
15405   size += (2 * 8192);
15406  }
15407
15408  return(size);
15409 }
15410
15411
15412
15413 static inline
15414 char*
15415 mem_strdup(
15416
15417
15418
15419  const char* str)
15420 {
15421  ulint len = strlen(str) + 1;
15422  return(memcpy(mem_alloc_func((len), "./include/mem0mem.ic", 575), str, len));
15423 }
15424
15425
15426
15427 static inline
15428 char*
15429 mem_strdupl(
15430
15431
15432
15433  const char* str,
15434  ulint len)
15435 {
15436  char* s = mem_alloc_func((len + 1), "./include/mem0mem.ic", 589);
15437  s[len] = 0;
15438  return(memcpy(s, str, len));
15439 }
15440
15441
15442
15443 static inline
15444 char*
15445 mem_strdupq(
15446
15447
15448
15449  const char* str,
15450  char q)
15451 {
15452  char* dst;
15453  char* d;
15454  const char* s = str;
15455  size_t len = strlen(str) + 3;
15456
15457  while((s = (__extension__ (__builtin_constant_p (q) && !__builtin_constant_p (s) && (q) == '\0' ? (char *) __rawmemchr (s, q) : __builtin_strchr (s, q)))) != ((void *)0)) {
15458   s++;
15459   len++;
15460  }
15461
15462  d = dst = mem_alloc_func((len), "./include/mem0mem.ic", 615);
15463  *d++ = q;
15464  s = str;
15465  while(*s) {
15466   if ((*d++ = *s++) == q) {
15467    *d++ = q;
15468   }
15469  }
15470  *d++ = q;
15471  *d++ = '\0';
15472  ;
15473  return(dst);
15474 }
15475
15476
15477
15478
15479 static inline
15480 char*
15481 mem_heap_strdupl(
15482
15483
15484  mem_heap_t* heap,
15485  const char* str,
15486  ulint len)
15487 {
15488  char* s = mem_heap_alloc(heap, len + 1);
15489  s[len] = 0;
15490  return(memcpy(s, str, len));
15491 }
15492 # 372 "./include/mem0mem.h" 2
15493 # 14 "./include/hash0hash.h" 2
15494
15495
15496 typedef struct hash_table_struct hash_table_t;
15497 typedef struct hash_cell_struct hash_cell_t;
15498
15499 typedef void* hash_node_t;
15500 # 28 "./include/hash0hash.h"
15501 hash_table_t*
15502 hash0_create(
15503
15504
15505  ulint n);
15506
15507
15508
15509 void
15510 hash_create_mutexes(
15511
15512  hash_table_t* table,
15513  ulint n_mutexes,
15514  ulint sync_level);
15515
15516
15517
15518
15519 void
15520 hash_table_free(
15521
15522  hash_table_t* table);
15523
15524
15525 static inline
15526 ulint
15527 hash_calc_hash(
15528
15529
15530  ulint fold,
15531  hash_table_t* table);
15532 # 154 "./include/hash0hash.h"
15533 static inline
15534 hash_cell_t*
15535 hash_get_nth_cell(
15536
15537
15538  hash_table_t* table,
15539  ulint n);
15540
15541
15542 static inline
15543 ulint
15544 hash_get_n_cells(
15545
15546
15547  hash_table_t* table);
15548 # 230 "./include/hash0hash.h"
15549 static inline
15550 ulint
15551 hash_get_mutex_no(
15552
15553
15554  hash_table_t* table,
15555  ulint fold);
15556
15557
15558 static inline
15559 mem_heap_t*
15560 hash_get_nth_heap(
15561
15562
15563  hash_table_t* table,
15564  ulint i);
15565
15566
15567 static inline
15568 mem_heap_t*
15569 hash_get_heap(
15570
15571
15572  hash_table_t* table,
15573  ulint fold);
15574
15575
15576 static inline
15577 ib_mutex_t*
15578 hash_get_nth_mutex(
15579
15580
15581  hash_table_t* table,
15582  ulint i);
15583
15584
15585 static inline
15586 ib_mutex_t*
15587 hash_get_mutex(
15588
15589
15590  hash_table_t* table,
15591  ulint fold);
15592
15593
15594
15595 void
15596 hash_mutex_enter(
15597
15598  hash_table_t* table,
15599  ulint fold);
15600
15601
15602
15603 void
15604 hash_mutex_exit(
15605
15606  hash_table_t* table,
15607  ulint fold);
15608
15609
15610
15611 void
15612 hash_mutex_enter_all(
15613
15614  hash_table_t* table);
15615
15616
15617
15618 void
15619 hash_mutex_exit_all(
15620
15621  hash_table_t* table);
15622
15623
15624 struct hash_cell_struct{
15625  void* node;
15626 };
15627
15628
15629 struct hash_table_struct {
15630  ulint adaptive;
15631
15632  ulint n_cells;
15633  hash_cell_t* array;
15634  ulint n_mutexes;
15635
15636  ib_mutex_t* mutexes;
15637
15638  mem_heap_t** heaps;
15639
15640
15641
15642  mem_heap_t* heap;
15643  ulint magic_n;
15644 };
15645
15646
15647
15648
15649 # 1 "./include/hash0hash.ic" 1
15650 # 13 "./include/hash0hash.ic"
15651 static inline
15652 hash_cell_t*
15653 hash_get_nth_cell(
15654
15655
15656  hash_table_t* table,
15657  ulint n)
15658 {
15659  ;
15660
15661  return(table->array + n);
15662 }
15663
15664
15665
15666 static inline
15667 ulint
15668 hash_get_n_cells(
15669
15670
15671  hash_table_t* table)
15672 {
15673  return(table->n_cells);
15674 }
15675
15676
15677
15678 static inline
15679 ulint
15680 hash_calc_hash(
15681
15682
15683  ulint fold,
15684  hash_table_t* table)
15685 {
15686  return(ut_hash_ulint(fold, table->n_cells));
15687 }
15688
15689
15690
15691 static inline
15692 ulint
15693 hash_get_mutex_no(
15694
15695
15696  hash_table_t* table,
15697  ulint fold)
15698 {
15699  return(ut_2pow_remainder(fold, table->n_mutexes));
15700 }
15701
15702
15703
15704 static inline
15705 mem_heap_t*
15706 hash_get_nth_heap(
15707
15708
15709  hash_table_t* table,
15710  ulint i)
15711 {
15712  ;
15713
15714  return(table->heaps[i]);
15715 }
15716
15717
15718
15719 static inline
15720 mem_heap_t*
15721 hash_get_heap(
15722
15723
15724  hash_table_t* table,
15725  ulint fold)
15726 {
15727  ulint i;
15728
15729  if (table->heap) {
15730   return(table->heap);
15731  }
15732
15733  i = hash_get_mutex_no(table, fold);
15734
15735  return(hash_get_nth_heap(table, i));
15736 }
15737
15738
15739
15740 static inline
15741 ib_mutex_t*
15742 hash_get_nth_mutex(
15743
15744
15745  hash_table_t* table,
15746  ulint i)
15747 {
15748  ;
15749
15750  return(table->mutexes + i);
15751 }
15752
15753
15754
15755 static inline
15756 ib_mutex_t*
15757 hash_get_mutex(
15758
15759
15760  hash_table_t* table,
15761  ulint fold)
15762 {
15763  ulint i;
15764
15765  i = hash_get_mutex_no(table, fold);
15766
15767  return(hash_get_nth_mutex(table, i));
15768 }
15769 # 331 "./include/hash0hash.h" 2
15770 # 32 "./include/buf0buf.h" 2
15771
15772 # 1 "./include/os0proc.h" 1
15773 # 16 "./include/os0proc.h"
15774 # 1 "/usr/include/sys/ipc.h" 1 3 4
15775 # 29 "/usr/include/sys/ipc.h" 3 4
15776 # 1 "/usr/include/bits/ipctypes.h" 1 3 4
15777 # 33 "/usr/include/bits/ipctypes.h" 3 4
15778 typedef int __ipc_pid_t;
15779 # 30 "/usr/include/sys/ipc.h" 2 3 4
15780 # 1 "/usr/include/bits/ipc.h" 1 3 4
15781 # 43 "/usr/include/bits/ipc.h" 3 4
15782 struct ipc_perm
15783   {
15784     __key_t __key;
15785     __uid_t uid;
15786     __gid_t gid;
15787     __uid_t cuid;
15788     __gid_t cgid;
15789     __mode_t mode;
15790     __uint32_t __seq;
15791     __uint32_t __pad1;
15792     __uint64_t __unused1;
15793     __uint64_t __unused2;
15794   };
15795
15796
15797
15798
15799
15800 extern int __ipc (int __call, int __first, int __second, int __third,
15801     void *__ptr) __attribute__ ((__nothrow__));
15802
15803
15804 # 31 "/usr/include/sys/ipc.h" 2 3 4
15805 # 52 "/usr/include/sys/ipc.h" 3 4
15806
15807
15808
15809 extern key_t ftok (__const char *__pathname, int __proj_id) __attribute__ ((__nothrow__));
15810
15811
15812 # 17 "./include/os0proc.h" 2
15813 # 1 "/usr/include/sys/shm.h" 1 3 4
15814 # 25 "/usr/include/sys/shm.h" 3 4
15815 # 1 "/usr/lib/gcc/powerpc64-unknown-linux-gnu/4.3.4/include/stddef.h" 1 3 4
15816 # 26 "/usr/include/sys/shm.h" 2 3 4
15817
15818
15819
15820
15821
15822 # 1 "/usr/include/bits/shm.h" 1 3 4
15823 # 40 "/usr/include/bits/shm.h" 3 4
15824
15825
15826
15827
15828 extern int __getpagesize (void) __attribute__ ((__nothrow__)) __attribute__ ((__const__));
15829
15830
15831
15832 typedef unsigned long int shmatt_t;
15833
15834
15835 struct shmid_ds
15836   {
15837     struct ipc_perm shm_perm;
15838
15839
15840
15841     __time_t shm_atime;
15842
15843
15844
15845     __time_t shm_dtime;
15846
15847
15848
15849     __time_t shm_ctime;
15850
15851
15852
15853     size_t shm_segsz;
15854     __pid_t shm_cpid;
15855     __pid_t shm_lpid;
15856     shmatt_t shm_nattch;
15857     unsigned long __unused5;
15858     unsigned long __unused6;
15859   };
15860 # 89 "/usr/include/bits/shm.h" 3 4
15861 struct shminfo
15862   {
15863     unsigned long int shmmax;
15864     unsigned long int shmmin;
15865     unsigned long int shmmni;
15866     unsigned long int shmseg;
15867     unsigned long int shmall;
15868     unsigned long int __unused1;
15869     unsigned long int __unused2;
15870     unsigned long int __unused3;
15871     unsigned long int __unused4;
15872   };
15873
15874 struct shm_info
15875   {
15876     int used_ids;
15877     unsigned long int shm_tot;
15878     unsigned long int shm_rss;
15879     unsigned long int shm_swp;
15880     unsigned long int swap_attempts;
15881     unsigned long int swap_successes;
15882   };
15883
15884
15885
15886
15887 # 32 "/usr/include/sys/shm.h" 2 3 4
15888 # 45 "/usr/include/sys/shm.h" 3 4
15889
15890
15891
15892
15893
15894
15895 extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf) __attribute__ ((__nothrow__));
15896
15897
15898 extern int shmget (key_t __key, size_t __size, int __shmflg) __attribute__ ((__nothrow__));
15899
15900
15901 extern void *shmat (int __shmid, __const void *__shmaddr, int __shmflg)
15902      __attribute__ ((__nothrow__));
15903
15904
15905 extern int shmdt (__const void *__shmaddr) __attribute__ ((__nothrow__));
15906
15907
15908 # 18 "./include/os0proc.h" 2
15909
15910
15911 typedef void* os_process_t;
15912 typedef unsigned long int os_process_id_t;
15913
15914
15915
15916
15917
15918 typedef ulint os_awe_t;
15919
15920
15921
15922
15923
15924
15925
15926 extern ulint os_use_large_pages;
15927
15928 extern ulint os_large_page_size;
15929
15930
15931
15932
15933
15934
15935 ulint
15936 os_awe_enable_lock_pages_in_mem(void);
15937
15938
15939
15940
15941
15942
15943
15944 ulint
15945 os_awe_allocate_physical_mem(
15946
15947
15948  os_awe_t** page_info,
15949
15950
15951
15952  ulint n_megabytes);
15953
15954
15955
15956
15957 unsigned char*
15958 os_awe_allocate_virtual_mem_window(
15959
15960
15961
15962  ulint size);
15963 # 83 "./include/os0proc.h"
15964 ulint
15965 os_awe_map_physical_mem_to_window(
15966
15967
15968
15969  unsigned char* ptr,
15970
15971
15972
15973  ulint n_mem_pages,
15974
15975  os_awe_t* page_info);
15976 # 103 "./include/os0proc.h"
15977 ulint
15978 os_proc_get_number(void);
15979
15980
15981
15982
15983 void*
15984 os_mem_alloc_nocache(
15985
15986
15987  ulint n);
15988
15989
15990
15991 void*
15992 os_mem_alloc_large(
15993
15994
15995  ulint n,
15996   ulint set_to_zero,
15997
15998   ulint assert_on_error);
15999
16000
16001
16002
16003 void
16004 os_mem_free_large(
16005
16006 void *ptr);
16007
16008
16009
16010
16011 void
16012 os_process_set_priority_boost(
16013
16014  ulint do_boost);
16015
16016
16017
16018 # 1 "./include/os0proc.ic" 1
16019 # 145 "./include/os0proc.h" 2
16020 # 34 "./include/buf0buf.h" 2
16021 # 58 "./include/buf0buf.h"
16022 extern buf_pool_t* buf_pool;
16023
16024
16025
16026
16027
16028 extern ulint srv_buf_pool_write_requests;
16029
16030
16031
16032
16033
16034 buf_pool_t*
16035 buf_pool_init(
16036
16037
16038
16039  ulint max_size,
16040
16041  ulint curr_size,
16042
16043
16044  ulint n_frames);
16045
16046
16047
16048
16049
16050
16051
16052 static inline
16053 ulint
16054 buf_pool_get_curr_size(void);
16055
16056
16057
16058
16059
16060 static inline
16061 ulint
16062 buf_pool_get_max_size(void);
16063
16064
16065
16066
16067
16068 static inline
16069 dulint
16070 buf_pool_get_oldest_modification(void);
16071
16072
16073
16074
16075
16076
16077 buf_frame_t*
16078 buf_frame_alloc(void);
16079
16080
16081
16082
16083
16084 void
16085 buf_frame_free(
16086
16087  buf_frame_t* frame);
16088
16089
16090 static inline
16091 unsigned char*
16092 buf_frame_copy(
16093
16094
16095  unsigned char* buf,
16096  buf_frame_t* frame);
16097 # 165 "./include/buf0buf.h"
16098 ulint
16099 buf_page_optimistic_get_func(
16100
16101
16102  ulint rw_latch,
16103  buf_block_t* block,
16104  buf_frame_t* guess,
16105
16106  dulint modify_clock,
16107
16108  const char* file,
16109  ulint line,
16110  mtr_t* mtr);
16111
16112
16113
16114
16115
16116 static inline
16117 buf_frame_t*
16118 buf_page_get_release_on_io(
16119
16120
16121
16122  ulint space,
16123  ulint offset,
16124
16125  buf_frame_t* guess,
16126  ulint rw_latch,
16127
16128  ulint savepoint,
16129  mtr_t* mtr);
16130
16131
16132
16133
16134 ulint
16135 buf_page_get_known_nowait(
16136
16137
16138  ulint rw_latch,
16139  buf_frame_t* guess,
16140  ulint mode,
16141  const char* file,
16142  ulint line,
16143  mtr_t* mtr);
16144
16145
16146
16147 buf_frame_t*
16148 buf_page_get_gen(
16149
16150
16151  ulint space,
16152  ulint offset,
16153  ulint rw_latch,
16154  buf_frame_t* guess,
16155  ulint mode,
16156
16157  const char* file,
16158  ulint line,
16159  mtr_t* mtr);
16160
16161
16162
16163
16164
16165
16166 buf_frame_t*
16167 buf_page_create(
16168
16169
16170  ulint space,
16171  ulint offset,
16172
16173  mtr_t* mtr);
16174
16175
16176
16177 void
16178 buf_page_init_for_backup_restore(
16179
16180  ulint space,
16181  ulint offset,
16182
16183  buf_block_t* block);
16184
16185
16186
16187 static inline
16188 void
16189 buf_page_release(
16190
16191  buf_block_t* block,
16192  ulint rw_latch,
16193
16194  mtr_t* mtr);
16195
16196
16197
16198
16199
16200 void
16201 buf_page_make_young(
16202
16203  buf_frame_t* frame);
16204
16205
16206
16207
16208 ulint
16209 buf_page_peek(
16210
16211
16212
16213
16214  ulint space,
16215  ulint offset);
16216
16217
16218
16219
16220
16221 buf_block_t*
16222 buf_page_peek_block(
16223
16224
16225
16226
16227  ulint space,
16228  ulint offset);
16229
16230
16231
16232
16233 void
16234 buf_reset_check_index_page_at_flush(
16235
16236  ulint space,
16237  ulint offset);
16238
16239
16240
16241
16242
16243
16244 buf_block_t*
16245 buf_page_set_file_page_was_freed(
16246
16247
16248
16249  ulint space,
16250  ulint offset);
16251
16252
16253
16254
16255
16256
16257 buf_block_t*
16258 buf_page_reset_file_page_was_freed(
16259
16260
16261
16262  ulint space,
16263  ulint offset);
16264
16265
16266
16267
16268 static inline
16269 ulint
16270 buf_block_peek_if_too_old(
16271
16272
16273  buf_block_t* block);
16274
16275
16276
16277
16278
16279 ulint
16280 buf_page_peek_if_search_hashed(
16281
16282
16283
16284  ulint space,
16285  ulint offset);
16286
16287
16288
16289 static inline
16290 dulint
16291 buf_frame_get_newest_modification(
16292
16293
16294  buf_frame_t* frame);
16295
16296
16297
16298
16299 static inline
16300 dulint
16301 buf_frame_modify_clock_inc(
16302
16303
16304  buf_frame_t* frame);
16305
16306
16307
16308
16309 static inline
16310 dulint
16311 buf_block_modify_clock_inc(
16312
16313
16314  buf_block_t* block);
16315
16316
16317
16318 static inline
16319 dulint
16320 buf_block_get_modify_clock(
16321
16322
16323  buf_block_t* block);
16324
16325
16326
16327
16328
16329 ulint
16330 buf_calc_page_new_checksum(
16331
16332
16333  unsigned char* page);
16334 # 409 "./include/buf0buf.h"
16335 ulint
16336 buf_calc_page_old_checksum(
16337
16338
16339  unsigned char* page);
16340
16341
16342
16343 ulint
16344 buf_page_is_corrupted(
16345
16346
16347  unsigned char* read_buf);
16348
16349
16350
16351 static inline
16352 ulint
16353 buf_frame_get_page_no(
16354
16355
16356  unsigned char* ptr);
16357
16358
16359
16360 static inline
16361 ulint
16362 buf_frame_get_space_id(
16363
16364
16365  unsigned char* ptr);
16366
16367
16368
16369 static inline
16370 void
16371 buf_ptr_get_fsp_addr(
16372
16373  unsigned char* ptr,
16374  ulint* space,
16375  fil_addr_t* addr);
16376
16377
16378
16379 static inline
16380 ulint
16381 buf_frame_get_lock_hash_val(
16382
16383
16384  unsigned char* ptr);
16385
16386
16387
16388 static inline
16389 ib_mutex_t*
16390 buf_frame_get_mutex(
16391
16392
16393  unsigned char* ptr);
16394
16395
16396 static inline
16397 buf_frame_t*
16398 buf_frame_align(
16399
16400
16401  unsigned char* ptr);
16402
16403
16404
16405 static inline
16406 ulint
16407 buf_pool_is_block(
16408
16409
16410  void* ptr);
16411 # 510 "./include/buf0buf.h"
16412 void
16413 buf_page_print(
16414
16415  unsigned char* read_buf);
16416
16417
16418
16419
16420 ulint
16421 buf_get_n_pending_ios(void);
16422
16423
16424
16425
16426 void
16427 buf_print_io(
16428
16429  FILE* file);
16430
16431
16432
16433
16434 ulint
16435 buf_get_modified_ratio_pct(void);
16436
16437
16438
16439
16440 void
16441 buf_refresh_io_stats(void);
16442
16443
16444
16445
16446 ulint
16447 buf_all_freed(void);
16448
16449
16450
16451
16452
16453 ulint
16454 buf_pool_check_no_pending_io(void);
16455
16456
16457
16458
16459
16460
16461
16462 void
16463 buf_pool_invalidate(void);
16464 # 572 "./include/buf0buf.h"
16465 void
16466 buf_awe_map_page_to_frame(
16467
16468  buf_block_t* block,
16469
16470  ulint add_to_mapped_list);
16471 # 596 "./include/buf0buf.h"
16472 static inline
16473 buf_frame_t*
16474 buf_block_get_frame(
16475
16476
16477  buf_block_t* block);
16478
16479
16480 static inline
16481 ulint
16482 buf_block_get_space(
16483
16484
16485  buf_block_t* block);
16486
16487
16488 static inline
16489 ulint
16490 buf_block_get_page_no(
16491
16492
16493  buf_block_t* block);
16494
16495
16496 static inline
16497 buf_block_t*
16498 buf_block_align(
16499
16500
16501  unsigned char* ptr);
16502
16503
16504
16505 static inline
16506 ulint
16507 buf_page_io_query(
16508
16509
16510  buf_block_t* block);
16511
16512
16513 static inline
16514 buf_block_t*
16515 buf_pool_get_nth_block(
16516
16517
16518  buf_pool_t* pool,
16519  ulint i);
16520 # 656 "./include/buf0buf.h"
16521 buf_block_t*
16522 buf_page_init_for_read(
16523
16524
16525  ulint* err,
16526  ulint mode,
16527  ulint space,
16528  ib_longlong tablespace_version,
16529
16530
16531  ulint offset);
16532
16533
16534
16535
16536 void
16537 buf_page_io_complete(
16538
16539  buf_block_t* block);
16540
16541
16542
16543 static inline
16544 ulint
16545 buf_page_address_fold(
16546
16547
16548  ulint space,
16549  ulint offset);
16550
16551
16552 static inline
16553 buf_block_t*
16554 buf_page_hash_get(
16555
16556
16557  ulint space,
16558  ulint offset);
16559
16560
16561
16562 static inline
16563 ulint
16564 buf_pool_clock_tic(void);
16565
16566
16567
16568
16569
16570 ulint
16571 buf_get_free_list_len(void);
16572
16573
16574 void buf_pool_dump(void);
16575 buf_block_t* buf_pool_get_nth_block_no_inline(buf_pool_t* pool, ulint i);
16576
16577
16578
16579
16580
16581
16582 void
16583 buf_io_counter_control(void);
16584
16585
16586 void
16587 buf_io_counter_clear(void);
16588
16589
16590
16591
16592 struct buf_block_struct{
16593
16594
16595
16596  ulint magic_n;
16597  ulint state;
16598
16599
16600
16601
16602  unsigned char* frame;
16603
16604
16605
16606
16607
16608
16609
16610  os_awe_t* awe_info;
16611
16612
16613
16614
16615  ulint space;
16616  ulint offset;
16617  ulint lock_hash_val;
16618
16619  ib_mutex_t mutex;
16620
16621
16622
16623
16624
16625  rw_lock_t lock;
16626
16627  buf_block_t* hash;
16628
16629  ulint check_index_page_at_flush;
16630 # 774 "./include/buf0buf.h"
16631  struct { buf_block_t * prev; buf_block_t * next; } flush_list;
16632
16633
16634  dulint newest_modification;
16635
16636
16637
16638  dulint oldest_modification;
16639
16640
16641
16642
16643
16644  ulint flush_type;
16645
16646
16647
16648
16649
16650
16651  struct { buf_block_t * prev; buf_block_t * next; } free;
16652
16653  ulint in_free_list;
16654
16655  struct { buf_block_t * prev; buf_block_t * next; } LRU;
16656
16657  struct { buf_block_t * prev; buf_block_t * next; } awe_LRU_free_mapped;
16658
16659
16660
16661  ulint in_LRU_list;
16662
16663  ulint LRU_position;
16664
16665
16666
16667
16668
16669
16670
16671  ulint freed_page_clock;
16672
16673
16674
16675
16676
16677  ulint old;
16678
16679  ulint accessed;
16680
16681
16682
16683
16684
16685
16686  ulint buf_fix_count;
16687
16688
16689  ulint io_fix;
16690
16691
16692
16693
16694
16695  dulint modify_clock;
16696 # 853 "./include/buf0buf.h"
16697  ulint n_hash_helps;
16698
16699  ulint n_fields;
16700
16701  ulint n_bytes;
16702
16703  ulint side;
16704 # 873 "./include/buf0buf.h"
16705  ulint is_hashed;
16706
16707
16708
16709
16710
16711  ulint n_pointers;
16712
16713
16714  ulint curr_n_fields;
16715
16716  ulint curr_n_bytes;
16717  ulint curr_side;
16718
16719
16720  dict_index_t* index;
16721 # 897 "./include/buf0buf.h"
16722         ulint file_page_was_freed;
16723
16724
16725 };
16726
16727
16728
16729
16730
16731
16732 struct buf_pool_struct{
16733
16734
16735
16736  ib_mutex_t mutex;
16737
16738
16739  unsigned char* frame_mem;
16740
16741
16742
16743
16744  unsigned char* frame_zero;
16745
16746
16747  unsigned char* high_end;
16748
16749  ulint n_frames;
16750  buf_block_t* blocks;
16751  buf_block_t** blocks_of_frames;
16752 # 937 "./include/buf0buf.h"
16753  os_awe_t* awe_info;
16754
16755
16756  ulint max_size;
16757
16758  ulint curr_size;
16759
16760
16761  hash_table_t* io_counter_hash;
16762  mem_heap_t* io_counter_heap;
16763  ulint io_counters;
16764  hash_table_t* page_hash;
16765  rw_lock_t hash_latch;
16766
16767  ulint n_pend_reads;
16768
16769  time_t last_printout_time;
16770
16771  ulint n_pages_read;
16772  ulint n_pages_written;
16773  ulint n_pages_created;
16774
16775  ulint n_page_gets;
16776
16777
16778
16779
16780
16781  ulint n_pages_awe_remapped;
16782
16783
16784  ulint n_page_gets_old;
16785
16786
16787  ulint n_pages_read_old;
16788
16789  ulint n_pages_written_old;
16790  ulint n_pages_created_old;
16791
16792  ulint n_pages_awe_remapped_old;
16793
16794
16795  struct { ulint count; buf_block_t * start; buf_block_t * end; } flush_list;
16796
16797
16798  ib_mutex_t flush_list_mutex;
16799  ulint init_flush[3 + 1];
16800
16801
16802  ulint n_flush[3 + 1];
16803
16804
16805  os_event_t no_flush[3 + 1];
16806
16807
16808
16809  ulint ulint_clock;
16810
16811
16812
16813  ulint freed_page_clock;
16814
16815
16816
16817
16818
16819
16820  ulint LRU_flush_ended;
16821
16822
16823
16824
16825
16826
16827  struct { ulint count; buf_block_t * start; buf_block_t * end; } free;
16828
16829
16830
16831
16832  ib_mutex_t free_mutex;
16833  struct { ulint count; buf_block_t * start; buf_block_t * end; } LRU;
16834
16835  ib_mutex_t LRU_mutex;
16836  buf_block_t* LRU_old;
16837
16838
16839  ulint LRU_old_len;
16840
16841
16842
16843
16844
16845  struct { ulint count; buf_block_t * start; buf_block_t * end; } awe_LRU_free_mapped;
16846
16847
16848
16849
16850
16851 };
16852
16853 struct buf_io_counter_struct{
16854  ulint space;
16855  ulint offset;
16856  buf_io_counter_t* hash;
16857  ulint index_id;
16858  ulint n_read;
16859  ulint n_write;
16860 };
16861 # 1104 "./include/buf0buf.h"
16862 # 1 "./include/buf0buf.ic" 1
16863 # 9 "./include/buf0buf.ic"
16864 # 1 "./include/buf0flu.h" 1
16865 # 20 "./include/buf0flu.h"
16866 void
16867 buf_flush_write_complete(
16868
16869  buf_block_t* block);
16870
16871
16872
16873
16874 void
16875 buf_flush_free_margin(
16876
16877  ulint wait);
16878
16879
16880
16881 void
16882 buf_flush_init_for_writing(
16883
16884  unsigned char* page,
16885  dulint newest_lsn,
16886  ulint space,
16887  ulint page_no);
16888
16889
16890
16891
16892
16893
16894
16895 ulint
16896 buf_flush_batch(
16897
16898
16899
16900  ulint flush_type,
16901
16902
16903  ulint min_n,
16904
16905
16906  dulint lsn_limit);
16907
16908
16909
16910
16911
16912
16913 void
16914 buf_flush_wait_batch_end(
16915
16916  ulint type);
16917
16918
16919
16920
16921 static inline
16922 void
16923 buf_flush_note_modification(
16924
16925  buf_block_t* block,
16926  mtr_t* mtr);
16927
16928
16929 static inline
16930 void
16931 buf_flush_recv_note_modification(
16932
16933  buf_block_t* block,
16934  dulint start_lsn,
16935
16936  dulint end_lsn);
16937
16938
16939
16940
16941 ulint
16942 buf_flush_ready_for_replace(
16943
16944
16945  buf_block_t* block);
16946
16947
16948
16949
16950 ulint
16951 buf_flush_validate(void);
16952 # 118 "./include/buf0flu.h"
16953 # 1 "./include/buf0flu.ic" 1
16954 # 9 "./include/buf0flu.ic"
16955 # 1 "./include/buf0buf.h" 1
16956 # 10 "./include/buf0flu.ic" 2
16957 # 1 "./include/mtr0mtr.h" 1
16958 # 14 "./include/mtr0mtr.h"
16959 # 1 "./include/dyn0dyn.h" 1
16960 # 16 "./include/dyn0dyn.h"
16961 typedef struct dyn_block_struct dyn_block_t;
16962 typedef dyn_block_t dyn_array_t;
16963 # 26 "./include/dyn0dyn.h"
16964 static inline
16965 dyn_array_t*
16966 dyn_array_create(
16967
16968
16969  dyn_array_t* arr);
16970
16971
16972
16973 static inline
16974 void
16975 dyn_array_free(
16976
16977  dyn_array_t* arr);
16978
16979
16980
16981
16982 static inline
16983 unsigned char*
16984 dyn_array_open(
16985
16986
16987  dyn_array_t* arr,
16988  ulint size);
16989
16990
16991
16992 static inline
16993 void
16994 dyn_array_close(
16995
16996  dyn_array_t* arr,
16997  unsigned char* ptr);
16998
16999
17000
17001
17002 static inline
17003 void*
17004 dyn_array_push(
17005
17006
17007  dyn_array_t* arr,
17008  ulint size);
17009
17010
17011 static inline
17012 void*
17013 dyn_array_get_element(
17014
17015
17016  dyn_array_t* arr,
17017  ulint pos);
17018
17019
17020
17021 static inline
17022 ulint
17023 dyn_array_get_data_size(
17024
17025
17026  dyn_array_t* arr);
17027
17028
17029 static inline
17030 dyn_block_t*
17031 dyn_array_get_first_block(
17032
17033  dyn_array_t* arr);
17034
17035
17036 static inline
17037 dyn_block_t*
17038 dyn_array_get_last_block(
17039
17040  dyn_array_t* arr);
17041
17042
17043 static inline
17044 dyn_block_t*
17045 dyn_array_get_next_block(
17046
17047
17048  dyn_array_t* arr,
17049  dyn_block_t* block);
17050
17051
17052 static inline
17053 ulint
17054 dyn_block_get_used(
17055
17056
17057  dyn_block_t* block);
17058
17059
17060 static inline
17061 unsigned char*
17062 dyn_block_get_data(
17063
17064
17065  dyn_block_t* block);
17066
17067
17068 static inline
17069 void
17070 dyn_push_string(
17071
17072  dyn_array_t* arr,
17073  const unsigned char* str,
17074  ulint len);
17075
17076
17077
17078
17079
17080 struct dyn_block_struct{
17081  mem_heap_t* heap;
17082
17083  ulint used;
17084  unsigned char data[512];
17085
17086  struct { ulint count; dyn_block_t * start; dyn_block_t * end; } base;
17087
17088
17089  struct { dyn_block_t * prev; dyn_block_t * next; } list;
17090
17091
17092
17093
17094
17095
17096
17097 };
17098
17099
17100
17101 # 1 "./include/dyn0dyn.ic" 1
17102 # 15 "./include/dyn0dyn.ic"
17103 dyn_block_t*
17104 dyn_array_add_block(
17105
17106
17107  dyn_array_t* arr);
17108
17109
17110
17111
17112 static inline
17113 dyn_block_t*
17114 dyn_array_get_first_block(
17115
17116  dyn_array_t* arr)
17117 {
17118  return(arr);
17119 }
17120
17121
17122
17123 static inline
17124 dyn_block_t*
17125 dyn_array_get_last_block(
17126
17127  dyn_array_t* arr)
17128 {
17129  if (arr->heap == ((void *)0)) {
17130
17131   return(arr);
17132  }
17133
17134  return((arr->base).end);
17135 }
17136
17137
17138
17139 static inline
17140 dyn_block_t*
17141 dyn_array_get_next_block(
17142
17143
17144  dyn_array_t* arr,
17145  dyn_block_t* block)
17146 {
17147  ;
17148
17149  if (arr->heap == ((void *)0)) {
17150   ;
17151
17152   return(((void *)0));
17153  }
17154
17155  return((((block)->list).next));
17156 }
17157
17158
17159
17160 static inline
17161 ulint
17162 dyn_block_get_used(
17163
17164
17165  dyn_block_t* block)
17166 {
17167  ;
17168
17169  return((block->used) & ~0x1000000UL);
17170 }
17171
17172
17173
17174 static inline
17175 unsigned char*
17176 dyn_block_get_data(
17177
17178
17179  dyn_block_t* block)
17180 {
17181  ;
17182
17183  return(block->data);
17184 }
17185
17186
17187
17188 static inline
17189 dyn_array_t*
17190 dyn_array_create(
17191
17192
17193  dyn_array_t* arr)
17194
17195 {
17196  ;
17197  ;
17198
17199  arr->heap = ((void *)0);
17200  arr->used = 0;
17201
17202
17203
17204
17205
17206  return(arr);
17207 }
17208
17209
17210
17211 static inline
17212 void
17213 dyn_array_free(
17214
17215  dyn_array_t* arr)
17216 {
17217  if (arr->heap != ((void *)0)) {
17218   mem_heap_free_func( (arr->heap), "./include/dyn0dyn.ic", 130);
17219  }
17220
17221
17222
17223
17224 }
17225
17226
17227
17228
17229 static inline
17230 void*
17231 dyn_array_push(
17232
17233
17234  dyn_array_t* arr,
17235  ulint size)
17236 {
17237  dyn_block_t* block;
17238  ulint used;
17239
17240  ;
17241  ;
17242  ;
17243  ;
17244
17245  block = arr;
17246  used = block->used;
17247
17248  if (used + size > 512) {
17249
17250
17251   block = dyn_array_get_last_block(arr);
17252   used = block->used;
17253
17254   if (used + size > 512) {
17255    block = dyn_array_add_block(arr);
17256    used = block->used;
17257   }
17258  }
17259
17260  block->used = used + size;
17261  ;
17262
17263  return((block->data) + used);
17264 }
17265
17266
17267
17268
17269
17270 static inline
17271 unsigned char*
17272 dyn_array_open(
17273
17274
17275  dyn_array_t* arr,
17276  ulint size)
17277
17278 {
17279  dyn_block_t* block;
17280  ulint used;
17281
17282  ;
17283  ;
17284  ;
17285  ;
17286
17287  block = arr;
17288  used = block->used;
17289
17290  if (used + size > 512) {
17291
17292
17293   block = dyn_array_get_last_block(arr);
17294   used = block->used;
17295
17296   if (used + size > 512) {
17297    block = dyn_array_add_block(arr);
17298    used = block->used;
17299    do { if (__builtin_expect(!((ulint)(size <= 512)), (0))) { ut_dbg_assertion_failed("size <= DYN_ARRAY_DATA_SIZE", "./include/dyn0dyn.ic", (ulint) 211); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/dyn0dyn.ic", (ulint) 211); } while (0); } while (0);
17300   }
17301  }
17302
17303  ;
17304
17305
17306
17307
17308
17309  return((block->data) + used);
17310 }
17311
17312
17313
17314 static inline
17315 void
17316 dyn_array_close(
17317
17318  dyn_array_t* arr,
17319  unsigned char* ptr)
17320 {
17321  dyn_block_t* block;
17322
17323  ;
17324  ;
17325
17326  block = dyn_array_get_last_block(arr);
17327
17328  ;
17329
17330  block->used = ptr - block->data;
17331
17332  ;
17333
17334
17335
17336
17337 }
17338
17339
17340
17341 static inline
17342 void*
17343 dyn_array_get_element(
17344
17345
17346  dyn_array_t* arr,
17347  ulint pos)
17348
17349 {
17350  dyn_block_t* block;
17351  ulint used;
17352
17353  ;
17354  ;
17355
17356
17357  block = dyn_array_get_first_block(arr);
17358
17359  if (arr->heap != ((void *)0)) {
17360   used = dyn_block_get_used(block);
17361
17362   while (pos >= used) {
17363    pos -= used;
17364    block = (((block)->list).next);
17365    ;
17366
17367    used = dyn_block_get_used(block);
17368   }
17369  }
17370
17371  ;
17372  ;
17373
17374  return(block->data + pos);
17375 }
17376
17377
17378
17379 static inline
17380 ulint
17381 dyn_array_get_data_size(
17382
17383
17384  dyn_array_t* arr)
17385 {
17386  dyn_block_t* block;
17387  ulint sum = 0;
17388
17389  ;
17390  ;
17391
17392  if (arr->heap == ((void *)0)) {
17393
17394   return(arr->used);
17395  }
17396
17397
17398  block = dyn_array_get_first_block(arr);
17399
17400  while (block != ((void *)0)) {
17401   sum += dyn_block_get_used(block);
17402   block = dyn_array_get_next_block(arr, block);
17403  }
17404
17405  return(sum);
17406 }
17407
17408
17409
17410 static inline
17411 void
17412 dyn_push_string(
17413
17414  dyn_array_t* arr,
17415  const unsigned char* str,
17416  ulint len)
17417 {
17418  ulint n_copied;
17419
17420  while (len > 0) {
17421   if (len > 512) {
17422    n_copied = 512;
17423   } else {
17424    n_copied = len;
17425   }
17426
17427   memcpy(dyn_array_push(arr, n_copied), str, n_copied);
17428
17429   str += n_copied;
17430   len -= n_copied;
17431  }
17432 }
17433 # 164 "./include/dyn0dyn.h" 2
17434 # 15 "./include/mtr0mtr.h" 2
17435
17436
17437
17438
17439 # 1 "./include/page0types.h" 1
17440 # 17 "./include/page0types.h"
17441 typedef unsigned char ib_page_t;
17442 typedef struct page_search_struct page_search_t;
17443 typedef struct page_cur_struct page_cur_t;
17444 # 20 "./include/mtr0mtr.h" 2
17445 # 139 "./include/mtr0mtr.h"
17446 static inline
17447 mtr_t*
17448 mtr_start(
17449
17450
17451
17452  mtr_t* mtr);
17453
17454
17455
17456
17457 mtr_t*
17458 mtr_start_noninline(
17459
17460
17461
17462  mtr_t* mtr);
17463
17464
17465
17466 void
17467 mtr_commit(
17468
17469  mtr_t* mtr);
17470
17471
17472 static inline
17473 ulint
17474 mtr_set_savepoint(
17475
17476
17477  mtr_t* mtr);
17478
17479
17480
17481
17482
17483 void
17484 mtr_rollback_to_savepoint(
17485
17486  mtr_t* mtr,
17487  ulint savepoint);
17488
17489
17490
17491 static inline
17492 void
17493 mtr_release_s_latch_at_savepoint(
17494
17495  mtr_t* mtr,
17496  ulint savepoint,
17497  rw_lock_t* lock);
17498
17499
17500 static inline
17501 ulint
17502 mtr_get_log_mode(
17503
17504
17505  mtr_t* mtr);
17506
17507
17508 static inline
17509 ulint
17510 mtr_set_log_mode(
17511
17512
17513  mtr_t* mtr,
17514  ulint mode);
17515
17516
17517
17518 ulint
17519 mtr_read_ulint(
17520
17521
17522  unsigned char* ptr,
17523  ulint type,
17524  mtr_t* mtr);
17525
17526
17527
17528 dulint
17529 mtr_read_dulint(
17530
17531
17532  unsigned char* ptr,
17533  mtr_t* mtr);
17534 # 238 "./include/mtr0mtr.h"
17535 static inline
17536 void
17537 mtr_s_lock_func(
17538
17539  rw_lock_t* lock,
17540  const char* file,
17541  ulint line,
17542  mtr_t* mtr);
17543
17544
17545
17546 static inline
17547 void
17548 mtr_x_lock_func(
17549
17550  rw_lock_t* lock,
17551  const char* file,
17552  ulint line,
17553  mtr_t* mtr);
17554
17555
17556
17557
17558 void
17559 mtr_memo_release(
17560
17561  mtr_t* mtr,
17562  void* object,
17563  ulint type);
17564
17565
17566 static inline
17567 ulint
17568 mtr_memo_contains(
17569
17570
17571  mtr_t* mtr,
17572  void* object,
17573  ulint type);
17574
17575
17576
17577 void
17578 mtr_print(
17579
17580  mtr_t* mtr);
17581
17582
17583
17584
17585
17586
17587 static inline
17588 dyn_array_t*
17589 mtr_get_log(
17590
17591
17592  mtr_t* mtr);
17593
17594
17595 static inline
17596 void
17597 mtr_memo_push(
17598
17599  mtr_t* mtr,
17600  void* object,
17601  ulint type);
17602
17603
17604
17605 typedef struct mtr_memo_slot_struct mtr_memo_slot_t;
17606 struct mtr_memo_slot_struct{
17607  ulint type;
17608  void* object;
17609 };
17610
17611
17612 struct mtr_struct{
17613  ulint state;
17614  dyn_array_t memo;
17615  dyn_array_t log;
17616  ulint modifications;
17617
17618
17619  ulint n_log_recs;
17620
17621
17622  ulint log_mode;
17623
17624  dulint start_lsn;
17625
17626  dulint end_lsn;
17627
17628  ulint magic_n;
17629 };
17630 # 341 "./include/mtr0mtr.h"
17631 # 1 "./include/mtr0mtr.ic" 1
17632 # 16 "./include/mtr0mtr.ic"
17633 static inline
17634 mtr_t*
17635 mtr_start(
17636
17637
17638
17639  mtr_t* mtr)
17640 {
17641  dyn_array_create(&(mtr->memo));
17642  dyn_array_create(&(mtr->log));
17643
17644  mtr->log_mode = 21;
17645  mtr->modifications = (0);
17646  mtr->n_log_recs = 0;
17647
17648
17649
17650
17651
17652  return(mtr);
17653 }
17654
17655
17656
17657 static inline
17658 void
17659 mtr_memo_push(
17660
17661  mtr_t* mtr,
17662  void* object,
17663  ulint type)
17664 {
17665  dyn_array_t* memo;
17666  mtr_memo_slot_t* slot;
17667
17668  ;
17669  ;
17670  ;
17671  ;
17672  ;
17673
17674  memo = &(mtr->memo);
17675
17676  slot = dyn_array_push(memo, sizeof(mtr_memo_slot_t));
17677
17678  slot->object = object;
17679  slot->type = type;
17680 }
17681
17682
17683
17684 static inline
17685 ulint
17686 mtr_set_savepoint(
17687
17688
17689  mtr_t* mtr)
17690 {
17691  dyn_array_t* memo;
17692
17693  ;
17694  ;
17695
17696  memo = &(mtr->memo);
17697
17698  return(dyn_array_get_data_size(memo));
17699 }
17700
17701
17702
17703
17704 static inline
17705 void
17706 mtr_release_s_latch_at_savepoint(
17707
17708  mtr_t* mtr,
17709  ulint savepoint,
17710  rw_lock_t* lock)
17711 {
17712  mtr_memo_slot_t* slot;
17713  dyn_array_t* memo;
17714
17715  ;
17716  ;
17717  ;
17718
17719  memo = &(mtr->memo);
17720
17721  ;
17722
17723  slot = dyn_array_get_element(memo, savepoint);
17724
17725  ;
17726  ;
17727
17728  rw_lock_s_unlock_func(lock);
17729
17730  slot->object = ((void *)0);
17731 }
17732
17733
17734
17735 static inline
17736 ulint
17737 mtr_memo_contains(
17738
17739
17740  mtr_t* mtr,
17741  void* object,
17742  ulint type)
17743 {
17744  mtr_memo_slot_t* slot;
17745  dyn_array_t* memo;
17746  ulint offset;
17747
17748  ;
17749  ;
17750
17751  memo = &(mtr->memo);
17752
17753  offset = dyn_array_get_data_size(memo);
17754
17755  while (offset > 0) {
17756   offset -= sizeof(mtr_memo_slot_t);
17757
17758   slot = dyn_array_get_element(memo, offset);
17759
17760   if ((object == slot->object) && (type == slot->type)) {
17761
17762    return((1));
17763   }
17764  }
17765
17766  return((0));
17767 }
17768
17769
17770
17771 static inline
17772 dyn_array_t*
17773 mtr_get_log(
17774
17775
17776  mtr_t* mtr)
17777 {
17778  ;
17779  ;
17780
17781  return(&(mtr->log));
17782 }
17783
17784
17785
17786 static inline
17787 ulint
17788 mtr_get_log_mode(
17789
17790
17791  mtr_t* mtr)
17792 {
17793  ;
17794  ;
17795  ;
17796
17797  return(mtr->log_mode);
17798 }
17799
17800
17801
17802 static inline
17803 ulint
17804 mtr_set_log_mode(
17805
17806
17807  mtr_t* mtr,
17808  ulint mode)
17809 {
17810  ulint old_mode;
17811
17812  ;
17813  ;
17814  ;
17815
17816  old_mode = mtr->log_mode;
17817
17818  if ((mode == 24) && (old_mode == 22)) {
17819
17820  } else {
17821   mtr->log_mode = mode;
17822  }
17823
17824  ;
17825  ;
17826
17827  return(old_mode);
17828 }
17829
17830
17831
17832 static inline
17833 void
17834 mtr_s_lock_func(
17835
17836  rw_lock_t* lock,
17837  const char* file,
17838  ulint line,
17839  mtr_t* mtr)
17840 {
17841  ;
17842  ;
17843
17844  rw_lock_s_lock_func(lock, 0, file, line);
17845
17846  mtr_memo_push(mtr, lock, 55);
17847 }
17848
17849
17850
17851 static inline
17852 void
17853 mtr_x_lock_func(
17854
17855  rw_lock_t* lock,
17856  const char* file,
17857  ulint line,
17858  mtr_t* mtr)
17859 {
17860  ;
17861  ;
17862
17863  rw_lock_x_lock_func(lock, 0, file, line);
17864
17865  mtr_memo_push(mtr, lock, 56);
17866 }
17867 # 342 "./include/mtr0mtr.h" 2
17868 # 11 "./include/buf0flu.ic" 2
17869
17870
17871
17872
17873 void
17874 buf_flush_insert_into_flush_list(
17875
17876  buf_block_t* block);
17877
17878
17879
17880
17881
17882 void
17883 buf_flush_insert_sorted_into_flush_list(
17884
17885  buf_block_t* block);
17886
17887
17888
17889
17890
17891 static inline
17892 void
17893 buf_flush_note_modification(
17894
17895  buf_block_t* block,
17896  mtr_t* mtr)
17897 {
17898  ;
17899  ;
17900  ;
17901
17902
17903
17904
17905
17906  ;
17907  ;
17908  ;
17909
17910  block->newest_modification = mtr->end_lsn;
17911
17912  if (ut_dulint_is_zero(block->oldest_modification)) {
17913
17914   block->oldest_modification = mtr->start_lsn;
17915   ;
17916
17917   buf_flush_insert_into_flush_list(block);
17918  } else {
17919   ;
17920
17921  }
17922
17923         ++srv_buf_pool_write_requests;
17924 }
17925
17926
17927
17928 static inline
17929 void
17930 buf_flush_recv_note_modification(
17931
17932  buf_block_t* block,
17933  dulint start_lsn,
17934
17935  dulint end_lsn)
17936
17937 {
17938  ;
17939  ;
17940  ;
17941
17942
17943
17944
17945  mutex_enter_func((&(buf_pool->flush_list_mutex)), "./include/buf0flu.ic", 87);
17946
17947  ;
17948
17949  block->newest_modification = end_lsn;
17950
17951  if (ut_dulint_is_zero(block->oldest_modification)) {
17952
17953   block->oldest_modification = start_lsn;
17954
17955   ;
17956
17957   buf_flush_insert_sorted_into_flush_list(block);
17958  } else {
17959   ;
17960
17961  }
17962
17963  mutex_exit(&(buf_pool->flush_list_mutex));
17964 }
17965 # 119 "./include/buf0flu.h" 2
17966 # 10 "./include/buf0buf.ic" 2
17967 # 1 "./include/buf0lru.h" 1
17968 # 25 "./include/buf0lru.h"
17969 void
17970 buf_LRU_try_free_flushed_blocks(void);
17971
17972
17973
17974
17975
17976
17977 ulint
17978 buf_LRU_buf_pool_running_out(void);
17979 # 55 "./include/buf0lru.h"
17980 void
17981 buf_LRU_invalidate_tablespace(
17982
17983  ulint id);
17984
17985
17986
17987
17988
17989 ulint
17990 buf_LRU_get_recent_limit(void);
17991
17992
17993
17994
17995
17996
17997 ulint
17998 buf_LRU_search_and_free_block(
17999
18000
18001  ulint n_iterations);
18002 # 87 "./include/buf0lru.h"
18003 buf_block_t*
18004 buf_LRU_get_free_block(void);
18005
18006
18007
18008
18009
18010
18011
18012 void
18013 buf_LRU_block_free_non_file_page(
18014
18015  buf_block_t* block);
18016
18017
18018
18019 void
18020 buf_LRU_add_block(
18021
18022  buf_block_t* block,
18023  ulint old);
18024
18025
18026
18027
18028
18029
18030 void
18031 buf_LRU_make_block_young(
18032
18033  buf_block_t* block);
18034
18035
18036
18037 void
18038 buf_LRU_make_block_old(
18039
18040  buf_block_t* block);
18041
18042
18043
18044 ulint
18045 buf_LRU_validate(void);
18046
18047
18048
18049
18050 void
18051 buf_LRU_print(void);
18052
18053
18054
18055 # 1 "./include/buf0lru.ic" 1
18056 # 140 "./include/buf0lru.h" 2
18057 # 11 "./include/buf0buf.ic" 2
18058 # 1 "./include/buf0rea.h" 1
18059 # 23 "./include/buf0rea.h"
18060 ulint
18061 buf_read_page(
18062
18063
18064
18065  ulint space,
18066  ulint offset,
18067  trx_t* trx);
18068 # 55 "./include/buf0rea.h"
18069 ulint
18070 buf_read_ahead_linear(
18071
18072
18073  ulint space,
18074  ulint offset,
18075
18076  trx_t* trx);
18077
18078
18079
18080
18081
18082 void
18083 buf_read_ibuf_merge_pages(
18084
18085  ulint sync,
18086
18087
18088  ulint* space_ids,
18089  ib_longlong* space_versions,
18090
18091
18092
18093
18094  ulint* page_nos,
18095
18096  ulint n_stored);
18097
18098
18099
18100 void
18101 buf_read_recv_pages(
18102
18103  ulint sync,
18104
18105
18106  ulint space,
18107  ulint* page_nos,
18108
18109  ulint n_stored);
18110 # 12 "./include/buf0buf.ic" 2
18111
18112
18113
18114
18115
18116 void
18117 buf_print_diagnostic(
18118
18119  mtr_t* mtr,
18120  const buf_block_t* block);
18121 # 32 "./include/buf0buf.ic"
18122 static inline
18123 ulint
18124 buf_block_peek_if_too_old(
18125
18126
18127  buf_block_t* block)
18128 {
18129  return(buf_pool->freed_page_clock >= block->freed_page_clock
18130     + 1 + (buf_pool->curr_size / 1024));
18131 }
18132
18133
18134
18135
18136 static inline
18137 ulint
18138 buf_pool_get_curr_size(void)
18139
18140
18141 {
18142  return((buf_pool->n_frames) * (2 * 8192));
18143 }
18144
18145
18146
18147
18148 static inline
18149 ulint
18150 buf_pool_get_max_size(void)
18151
18152
18153 {
18154  return((buf_pool->n_frames) * (2 * 8192));
18155 }
18156
18157
18158
18159 static inline
18160 buf_block_t*
18161 buf_pool_get_nth_block(
18162
18163
18164  buf_pool_t* buf_pool,
18165  ulint i)
18166 {
18167  ;
18168  ;
18169
18170  return(i + buf_pool->blocks);
18171 }
18172
18173
18174
18175
18176 static inline
18177 ulint
18178 buf_pool_is_block(
18179
18180
18181  void* ptr)
18182 {
18183  if ((buf_pool->blocks <= (buf_block_t*)ptr)
18184      && ((buf_block_t*)ptr < buf_pool->blocks + buf_pool->max_size)) {
18185
18186   return((1));
18187  }
18188
18189  return((0));
18190 }
18191
18192
18193
18194
18195 static inline
18196 dulint
18197 buf_pool_get_oldest_modification(void)
18198
18199
18200
18201 {
18202  buf_block_t* block;
18203  dulint lsn;
18204
18205  mutex_enter_func((&(buf_pool->flush_list_mutex)), "./include/buf0buf.ic", 115);
18206
18207  block = (buf_pool->flush_list).end;
18208
18209  if (block == ((void *)0)) {
18210   lsn = ut_dulint_zero;
18211  } else {
18212   lsn = block->oldest_modification;
18213  }
18214
18215  mutex_exit(&(buf_pool->flush_list_mutex));
18216
18217  return(lsn);
18218 }
18219
18220
18221
18222
18223 static inline
18224 ulint
18225 buf_pool_clock_tic(void)
18226
18227
18228 {
18229
18230
18231
18232
18233  buf_pool->ulint_clock++;
18234
18235  return(buf_pool->ulint_clock);
18236 }
18237
18238
18239
18240 static inline
18241 buf_frame_t*
18242 buf_block_get_frame(
18243
18244
18245  buf_block_t* block)
18246 {
18247  ;
18248  ;
18249  ;
18250  ;
18251  ;
18252
18253
18254  return(block->frame);
18255 }
18256
18257
18258
18259 static inline
18260 ulint
18261 buf_block_get_space(
18262
18263
18264  buf_block_t* block)
18265 {
18266  ;
18267  ;
18268  ;
18269  do { if (__builtin_expect(!((ulint)(block->state == 213)), (0))) { ut_dbg_assertion_failed("block->state == BUF_BLOCK_FILE_PAGE", "./include/buf0buf.ic", (ulint) 179); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/buf0buf.ic", (ulint) 179); } while (0); } while (0);
18270  ;
18271
18272  return(block->space);
18273 }
18274
18275
18276
18277 static inline
18278 ulint
18279 buf_block_get_page_no(
18280
18281
18282  buf_block_t* block)
18283 {
18284  ;
18285  ;
18286  ;
18287  do { if (__builtin_expect(!((ulint)(block->state == 213)), (0))) { ut_dbg_assertion_failed("block->state == BUF_BLOCK_FILE_PAGE", "./include/buf0buf.ic", (ulint) 197); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/buf0buf.ic", (ulint) 197); } while (0); } while (0);
18288  ;
18289
18290  return(block->offset);
18291 }
18292
18293
18294
18295 static inline
18296 buf_block_t*
18297 buf_block_align(
18298
18299
18300  unsigned char* ptr)
18301 {
18302  buf_block_t* block;
18303  buf_frame_t* frame_zero;
18304
18305  ;
18306
18307  frame_zero = buf_pool->frame_zero;
18308
18309  if (__builtin_expect((ulint)ptr < (ulint)frame_zero, (0))
18310      || __builtin_expect((ulint)ptr > (ulint)(buf_pool->high_end), (0))) {
18311
18312   ut_print_timestamp(stderr);
18313   fprintf(stderr,
18314 "InnoDB: Error: trying to access a stray pointer %p\n"
18315 "InnoDB: buf pool start is at %p, end at %p\n"
18316 "InnoDB: Probable reason is database corruption or memory\n"
18317 "InnoDB: corruption. If this happens in an InnoDB database recovery, see\n"
18318 "InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html\n"
18319 "InnoDB: how to force recovery.\n",
18320     ptr, frame_zero,
18321    buf_pool->high_end);
18322   do { ut_dbg_assertion_failed(0, "./include/buf0buf.ic", (ulint) 232); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
18323  }
18324
18325  block = *(buf_pool->blocks_of_frames + (((ulint)(ptr - frame_zero))
18326       >> 14));
18327  return(block);
18328 }
18329
18330
18331
18332 static inline
18333 buf_frame_t*
18334 buf_frame_align(
18335
18336
18337  unsigned char* ptr)
18338 {
18339  buf_frame_t* frame;
18340
18341  ;
18342
18343  frame = ut_align_down(ptr, (2 * 8192));
18344
18345  if (__builtin_expect((ulint)frame < (ulint)(buf_pool->frame_zero), (0))
18346      || __builtin_expect((ulint)frame >= (ulint)(buf_pool->high_end), (0))) {
18347
18348   ut_print_timestamp(stderr);
18349   fprintf(stderr,
18350 "InnoDB: Error: trying to access a stray pointer %p\n"
18351 "InnoDB: buf pool start is at %p, end at %p\n"
18352 "InnoDB: Probable reason is database corruption or memory\n"
18353 "InnoDB: corruption. If this happens in an InnoDB database recovery, see\n"
18354 "InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html\n"
18355 "InnoDB: how to force recovery.\n",
18356     ptr, buf_pool->frame_zero,
18357    buf_pool->high_end);
18358   do { ut_dbg_assertion_failed(0, "./include/buf0buf.ic", (ulint) 268); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
18359  }
18360
18361  return(frame);
18362 }
18363
18364
18365
18366
18367 static inline
18368 ulint
18369 buf_frame_get_page_no(
18370
18371
18372  unsigned char* ptr)
18373 {
18374  return(buf_block_get_page_no(buf_block_align(ptr)));
18375 }
18376
18377
18378
18379
18380 static inline
18381 ulint
18382 buf_frame_get_space_id(
18383
18384
18385  unsigned char* ptr)
18386 {
18387  return(buf_block_get_space(buf_block_align(ptr)));
18388 }
18389
18390
18391
18392
18393 static inline
18394 void
18395 buf_ptr_get_fsp_addr(
18396
18397  unsigned char* ptr,
18398  ulint* space,
18399  fil_addr_t* addr)
18400 {
18401  buf_block_t* block;
18402
18403  block = buf_block_align(ptr);
18404
18405  *space = buf_block_get_space(block);
18406  addr->page = buf_block_get_page_no(block);
18407  addr->boffset = ptr - buf_frame_align(ptr);
18408 }
18409
18410
18411
18412
18413 static inline
18414 ulint
18415 buf_frame_get_lock_hash_val(
18416
18417
18418  unsigned char* ptr)
18419 {
18420  buf_block_t* block;
18421
18422  block = buf_block_align(ptr);
18423
18424  return(block->lock_hash_val);
18425 }
18426
18427
18428
18429
18430 static inline
18431 ib_mutex_t*
18432 buf_frame_get_mutex(
18433
18434
18435  unsigned char* ptr)
18436 {
18437  buf_block_t* block;
18438
18439  block = buf_block_align(ptr);
18440
18441  return(&block->mutex);
18442 }
18443
18444
18445
18446 static inline
18447 unsigned char*
18448 buf_frame_copy(
18449
18450
18451  unsigned char* buf,
18452  buf_frame_t* frame)
18453 {
18454  ;
18455
18456  ut_memcpy(buf, frame, (2 * 8192));
18457
18458  return(buf);
18459 }
18460
18461
18462
18463
18464 static inline
18465 ulint
18466 buf_page_address_fold(
18467
18468
18469  ulint space,
18470  ulint offset)
18471 {
18472  return((space << 20) + space + offset);
18473 }
18474
18475
18476
18477
18478 static inline
18479 ulint
18480 buf_page_io_query(
18481
18482
18483  buf_block_t* block)
18484 {
18485  mutex_enter_func((&block->mutex), "./include/buf0buf.ic", 395);
18486
18487  ;
18488  ;
18489
18490  if (block->io_fix != 0) {
18491   mutex_exit(&block->mutex);
18492
18493   return((1));
18494  }
18495
18496  mutex_exit(&block->mutex);
18497
18498  return((0));
18499 }
18500
18501
18502
18503
18504 static inline
18505 dulint
18506 buf_frame_get_newest_modification(
18507
18508
18509  buf_frame_t* frame)
18510 {
18511  buf_block_t* block;
18512  dulint lsn;
18513
18514  ;
18515
18516  block = buf_block_align(frame);
18517
18518  mutex_enter_func((&block->mutex), "./include/buf0buf.ic", 428);
18519
18520  if (block->state == 213) {
18521   lsn = block->newest_modification;
18522  } else {
18523   lsn = ut_dulint_zero;
18524  }
18525
18526  mutex_exit(&block->mutex);
18527
18528  return(lsn);
18529 }
18530
18531
18532
18533
18534
18535 static inline
18536 dulint
18537 buf_frame_modify_clock_inc(
18538
18539
18540  buf_frame_t* frame)
18541 {
18542  buf_block_t* block;
18543
18544  ;
18545
18546  block = buf_block_align(frame);
18547
18548
18549
18550
18551
18552
18553  { if ((block->modify_clock).low == 0xFFFFFFFFUL) { (block->modify_clock).high = (block->modify_clock).high + 1; (block->modify_clock).low = 0; } else { (block->modify_clock).low = (block->modify_clock).low + 1; }};
18554
18555  return(block->modify_clock);
18556 }
18557
18558
18559
18560
18561
18562 static inline
18563 dulint
18564 buf_block_modify_clock_inc(
18565
18566
18567  buf_block_t* block)
18568 {
18569
18570
18571
18572
18573
18574  { if ((block->modify_clock).low == 0xFFFFFFFFUL) { (block->modify_clock).high = (block->modify_clock).high + 1; (block->modify_clock).low = 0; } else { (block->modify_clock).low = (block->modify_clock).low + 1; }};
18575
18576  return(block->modify_clock);
18577 }
18578
18579
18580
18581
18582 static inline
18583 dulint
18584 buf_block_get_modify_clock(
18585
18586
18587  buf_block_t* block)
18588 {
18589
18590
18591
18592
18593
18594  return(block->modify_clock);
18595 }
18596 # 531 "./include/buf0buf.ic"
18597 static inline
18598 void
18599 buf_block_buf_fix_inc(
18600
18601  buf_block_t* block)
18602 {
18603
18604
18605
18606  block->buf_fix_count++;
18607 }
18608
18609
18610
18611 static inline
18612 buf_block_t*
18613 buf_page_hash_get(
18614
18615
18616  ulint space,
18617  ulint offset)
18618 {
18619  buf_block_t* block;
18620  ulint fold;
18621
18622  ;
18623
18624
18625
18626
18627
18628
18629  fold = buf_page_address_fold(space, offset);
18630
18631  { (block) = (hash_get_nth_cell(buf_pool->page_hash, hash_calc_hash(fold, buf_pool->page_hash))->node); while ((block) != ((void *)0)) { if ((block->space == space) && (block->offset == offset)) { break; } else { (block) = ((block)->hash); } }};
18632
18633  do { if (__builtin_expect(!((ulint)(block == ((void *)0) || block->state == 213)), (0))) { ut_dbg_assertion_failed("block == NULL || block->state == BUF_BLOCK_FILE_PAGE", "./include/buf0buf.ic", (ulint) 567); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/buf0buf.ic", (ulint) 567); } while (0); } while (0);
18634
18635  return(block);
18636 }
18637
18638
18639
18640
18641
18642
18643 static inline
18644 buf_frame_t*
18645 buf_page_get_release_on_io(
18646
18647
18648
18649  ulint space,
18650  ulint offset,
18651
18652  buf_frame_t* guess,
18653  ulint rw_latch,
18654
18655  ulint savepoint,
18656  mtr_t* mtr)
18657 {
18658  buf_frame_t* frame;
18659
18660  frame = buf_page_get_gen(space, offset, rw_latch, guess,
18661     11,
18662     "./include/buf0buf.ic", 596,
18663     mtr);
18664  if (frame != ((void *)0)) {
18665
18666   return(frame);
18667  }
18668
18669
18670
18671
18672  mtr_rollback_to_savepoint(mtr, savepoint);
18673
18674  buf_page_get_gen( space, offset, 1, ((void *)0), 10, "./include/buf0buf.ic", 608, mtr);
18675
18676
18677
18678
18679  mtr_rollback_to_savepoint(mtr, savepoint);
18680
18681  return(((void *)0));
18682 }
18683
18684
18685
18686
18687 static inline
18688 void
18689 buf_page_release(
18690
18691  buf_block_t* block,
18692  ulint rw_latch,
18693
18694  mtr_t* mtr)
18695 {
18696  ;
18697
18698  do { if (__builtin_expect(!((ulint)(block->state == 213)), (0))) { ut_dbg_assertion_failed("block->state == BUF_BLOCK_FILE_PAGE", "./include/buf0buf.ic", (ulint) 632); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/buf0buf.ic", (ulint) 632); } while (0); } while (0);
18699
18700  if (rw_latch == 2 && mtr->modifications) {
18701   mutex_enter_func((&buf_pool->flush_list_mutex), "./include/buf0buf.ic", 635);
18702   buf_flush_note_modification(block, mtr);
18703   mutex_exit(&buf_pool->flush_list_mutex);
18704  }
18705
18706  mutex_enter_func((&block->mutex), "./include/buf0buf.ic", 640);
18707
18708
18709  if (__builtin_expect(block->buf_fix_count == 0, (0))) {
18710   buf_print_diagnostic(mtr, block);
18711   do { ut_dbg_assertion_failed(0, "./include/buf0buf.ic", (ulint) 645); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
18712  }
18713
18714
18715
18716
18717  --block->buf_fix_count;
18718
18719  mutex_exit(&block->mutex);
18720
18721  if (rw_latch == 1) {
18722   rw_lock_s_unlock_func(&(block->lock));
18723  } else if (rw_latch == 2) {
18724   rw_lock_x_unlock_func(&(block->lock));
18725  }
18726 }
18727 # 1105 "./include/buf0buf.h" 2
18728 # 24 "buf/buf0buf.c" 2
18729
18730
18731
18732
18733
18734 # 1 "./include/mem0mem.h" 1
18735 # 30 "buf/buf0buf.c" 2
18736 # 1 "./include/btr0btr.h" 1
18737 # 14 "./include/btr0btr.h"
18738 # 1 "./include/dict0dict.h" 1
18739 # 14 "./include/dict0dict.h"
18740 # 1 "./include/dict0mem.h" 1
18741 # 14 "./include/dict0mem.h"
18742 # 1 "./include/data0type.h" 1
18743 # 14 "./include/data0type.h"
18744 extern ulint data_mysql_default_charset_coll;
18745
18746
18747
18748
18749 typedef struct dtype_struct dtype_t;
18750
18751
18752
18753 extern dtype_t* dtype_binary;
18754 # 162 "./include/data0type.h"
18755 static inline
18756 ulint
18757 dtype_get_mysql_type(
18758
18759
18760
18761  dtype_t* type);
18762
18763
18764
18765
18766
18767 ulint
18768 dtype_get_at_most_n_mbchars(
18769
18770
18771
18772  const dtype_t* dtype,
18773  ulint prefix_len,
18774
18775
18776  ulint data_len,
18777  const char* str);
18778
18779
18780
18781
18782
18783 ulint
18784 dtype_is_string_type(
18785
18786
18787  ulint mtype);
18788
18789
18790
18791
18792
18793 ulint
18794 dtype_is_binary_string_type(
18795
18796
18797  ulint mtype,
18798  ulint prtype);
18799
18800
18801
18802
18803
18804
18805 ulint
18806 dtype_is_non_binary_string_type(
18807
18808
18809  ulint mtype,
18810  ulint prtype);
18811
18812
18813 static inline
18814 void
18815 dtype_set(
18816
18817  dtype_t* type,
18818  ulint mtype,
18819  ulint prtype,
18820  ulint len,
18821  ulint prec);
18822
18823
18824 static inline
18825 void
18826 dtype_copy(
18827
18828  dtype_t* type1,
18829  dtype_t* type2);
18830
18831
18832 static inline
18833 ulint
18834 dtype_get_mtype(
18835
18836  dtype_t* type);
18837
18838
18839 static inline
18840 ulint
18841 dtype_get_prtype(
18842
18843  dtype_t* type);
18844
18845
18846
18847 ulint
18848 dtype_get_charset_coll_noninline(
18849
18850  ulint prtype);
18851
18852
18853 static inline
18854 ulint
18855 dtype_get_charset_coll(
18856
18857  ulint prtype);
18858
18859
18860
18861
18862 ulint
18863 dtype_form_prtype(
18864
18865  ulint old_prtype,
18866
18867  ulint charset_coll);
18868
18869
18870 static inline
18871 ulint
18872 dtype_get_len(
18873
18874  dtype_t* type);
18875
18876
18877 static inline
18878 ulint
18879 dtype_get_prec(
18880
18881  dtype_t* type);
18882
18883
18884 static inline
18885 ulint
18886 dtype_get_mbminlen(
18887
18888
18889
18890  const dtype_t* type);
18891
18892
18893 static inline
18894 ulint
18895 dtype_get_mbmaxlen(
18896
18897
18898
18899  const dtype_t* type);
18900
18901
18902 static inline
18903 ulint
18904 dtype_get_pad_char(
18905
18906
18907
18908  const dtype_t* type);
18909
18910
18911 static inline
18912 ulint
18913 dtype_get_fixed_size(
18914
18915
18916  dtype_t* type);
18917
18918
18919 static inline
18920 ulint
18921 dtype_get_min_size(
18922
18923
18924  const dtype_t* type);
18925
18926
18927
18928 static inline
18929 ulint
18930 dtype_get_sql_null_size(
18931
18932
18933  dtype_t* type);
18934
18935
18936 static inline
18937 ulint
18938 dtype_is_fixed_size(
18939
18940
18941  dtype_t* type);
18942
18943
18944
18945 static inline
18946 void
18947 dtype_read_for_order_and_null_size(
18948
18949  dtype_t* type,
18950  unsigned char* buf);
18951
18952
18953
18954
18955 static inline
18956 void
18957 dtype_new_store_for_order_and_null_size(
18958
18959  unsigned char* buf,
18960
18961
18962  dtype_t* type,
18963  ulint prefix_len);
18964
18965
18966
18967
18968
18969 static inline
18970 void
18971 dtype_new_read_for_order_and_null_size(
18972
18973  dtype_t* type,
18974  unsigned char* buf);
18975
18976
18977
18978
18979 ulint
18980 dtype_validate(
18981
18982
18983  dtype_t* type);
18984
18985
18986
18987 void
18988 dtype_print(
18989
18990  dtype_t* type);
18991 # 407 "./include/data0type.h"
18992 struct dtype_struct{
18993  ulint mtype;
18994  ulint prtype;
18995
18996
18997
18998
18999
19000
19001
19002  ulint len;
19003
19004
19005
19006
19007
19008  ulint prec;
19009
19010  ulint mbminlen;
19011  ulint mbmaxlen;
19012 };
19013
19014
19015 # 1 "./include/data0type.ic" 1
19016 # 16 "./include/data0type.ic"
19017 extern
19018 void
19019 innobase_get_cset_width(
19020
19021  ulint cset,
19022  ulint* mbminlen,
19023  ulint* mbmaxlen);
19024
19025
19026
19027 static inline
19028 ulint
19029 dtype_get_charset_coll(
19030
19031  ulint prtype)
19032 {
19033  return((prtype >> 16) & 0xFFUL);
19034 }
19035
19036
19037
19038 static inline
19039 ulint
19040 dtype_get_mysql_type(
19041
19042
19043
19044  dtype_t* type)
19045 {
19046  return(type->prtype & 0xFFUL);
19047 }
19048
19049
19050
19051 static inline
19052 void
19053 dtype_set_mblen(
19054
19055  dtype_t* type)
19056 {
19057  ;
19058  if (dtype_is_string_type(type->mtype)) {
19059   innobase_get_cset_width(dtype_get_charset_coll(type->prtype),
19060     &type->mbminlen, &type->mbmaxlen);
19061   ;
19062  } else {
19063   type->mbminlen = type->mbmaxlen = 0;
19064  }
19065 }
19066
19067
19068
19069 static inline
19070 void
19071 dtype_set(
19072
19073  dtype_t* type,
19074  ulint mtype,
19075  ulint prtype,
19076  ulint len,
19077  ulint prec)
19078 {
19079  ;
19080  ;
19081
19082  type->mtype = mtype;
19083  type->prtype = prtype;
19084  type->len = len;
19085  type->prec = prec;
19086
19087  dtype_set_mblen(type);
19088  ;
19089 }
19090
19091
19092
19093 static inline
19094 void
19095 dtype_copy(
19096
19097  dtype_t* type1,
19098  dtype_t* type2)
19099 {
19100  *type1 = *type2;
19101
19102  ;
19103 }
19104
19105
19106
19107 static inline
19108 ulint
19109 dtype_get_mtype(
19110
19111  dtype_t* type)
19112 {
19113  ;
19114
19115  return(type->mtype);
19116 }
19117
19118
19119
19120 static inline
19121 ulint
19122 dtype_get_prtype(
19123
19124  dtype_t* type)
19125 {
19126  ;
19127
19128  return(type->prtype);
19129 }
19130
19131
19132
19133 static inline
19134 ulint
19135 dtype_get_len(
19136
19137  dtype_t* type)
19138 {
19139  ;
19140
19141  return(type->len);
19142 }
19143
19144
19145
19146 static inline
19147 ulint
19148 dtype_get_prec(
19149
19150  dtype_t* type)
19151 {
19152  ;
19153
19154  return(type->prec);
19155 }
19156
19157
19158
19159 static inline
19160 ulint
19161 dtype_get_mbminlen(
19162
19163
19164
19165  const dtype_t* type)
19166 {
19167  ;
19168  return(type->mbminlen);
19169 }
19170
19171
19172 static inline
19173 ulint
19174 dtype_get_mbmaxlen(
19175
19176
19177
19178  const dtype_t* type)
19179 {
19180  ;
19181  return(type->mbmaxlen);
19182 }
19183
19184
19185
19186 static inline
19187 ulint
19188 dtype_get_pad_char(
19189
19190
19191
19192  const dtype_t* type)
19193 {
19194  switch (type->mtype) {
19195  case 3:
19196  case 4:
19197   if (__builtin_expect(dtype_get_charset_coll(type->prtype) == 63, (0))) {
19198
19199
19200
19201    return(((ulint)(-1)));
19202   }
19203
19204  case 2:
19205  case 1:
19206  case 13:
19207  case 12:
19208
19209
19210
19211   return(0x20);
19212  case 5:
19213   if ((type->prtype & 1024) == 0) {
19214    return(0x20);
19215   }
19216
19217  default:
19218
19219   return(((ulint)(-1)));
19220  }
19221 }
19222
19223
19224
19225
19226
19227 static inline
19228 void
19229 dtype_new_store_for_order_and_null_size(
19230
19231  unsigned char* buf,
19232
19233
19234  dtype_t* type,
19235  ulint prefix_len)
19236
19237 {
19238
19239
19240
19241  ulint len;
19242
19243  buf[0] = (unsigned char)(type->mtype & 0xFFUL);
19244
19245  if (type->prtype & 1024) {
19246   buf[0] = buf[0] | 128;
19247  }
19248
19249
19250
19251
19252
19253
19254  buf[1] = (unsigned char)(type->prtype & 0xFFUL);
19255
19256  len = prefix_len ? prefix_len : type->len;
19257
19258  mach_write_to_2(buf + 2, len & 0xFFFFUL);
19259
19260  ;
19261  mach_write_to_2(buf + 4, dtype_get_charset_coll(type->prtype));
19262
19263  if (type->prtype & 256) {
19264   buf[4] |= 128;
19265  }
19266 }
19267
19268
19269
19270
19271
19272 static inline
19273 void
19274 dtype_read_for_order_and_null_size(
19275
19276  dtype_t* type,
19277  unsigned char* buf)
19278 {
19279  ;
19280
19281  type->mtype = buf[0] & 63;
19282  type->prtype = buf[1];
19283
19284  if (buf[0] & 128) {
19285          type->prtype = type->prtype | 1024;
19286  }
19287
19288  type->len = mach_read_from_2(buf + 2);
19289
19290  type->prtype = dtype_form_prtype(type->prtype,
19291      data_mysql_default_charset_coll);
19292  dtype_set_mblen(type);
19293 }
19294
19295
19296
19297
19298
19299 static inline
19300 void
19301 dtype_new_read_for_order_and_null_size(
19302
19303  dtype_t* type,
19304  unsigned char* buf)
19305 {
19306  ulint charset_coll;
19307
19308
19309
19310
19311
19312  type->mtype = buf[0] & 63;
19313  type->prtype = buf[1];
19314
19315  if (buf[0] & 128) {
19316   type->prtype |= 1024;
19317  }
19318
19319  if (buf[4] & 128) {
19320   type->prtype |= 256;
19321  }
19322
19323  type->len = mach_read_from_2(buf + 2);
19324
19325  mach_read_from_2(buf + 4);
19326
19327  charset_coll = mach_read_from_2(buf + 4) & 0x7fff;
19328
19329  if (dtype_is_string_type(type->mtype)) {
19330   do { if (__builtin_expect(!((ulint)(charset_coll < 256)), (0))) { ut_dbg_assertion_failed("charset_coll < 256", "./include/data0type.ic", (ulint) 329); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/data0type.ic", (ulint) 329); } while (0); } while (0);
19331
19332   if (charset_coll == 0) {
19333
19334
19335
19336
19337
19338
19339    charset_coll = data_mysql_default_charset_coll;
19340   }
19341
19342   type->prtype = dtype_form_prtype(type->prtype, charset_coll);
19343  }
19344  dtype_set_mblen(type);
19345 }
19346
19347
19348
19349
19350 static inline
19351 ulint
19352 dtype_get_fixed_size(
19353
19354
19355  dtype_t* type)
19356 {
19357  ulint mtype;
19358
19359  mtype = dtype_get_mtype(type);
19360
19361  switch (mtype) {
19362  case 8:
19363 # 381 "./include/data0type.ic"
19364  case 2:
19365  case 3:
19366  case 6:
19367  case 9:
19368  case 10:
19369    return(dtype_get_len(type));
19370  case 13:
19371    if (type->prtype & 1024) {
19372     return(dtype_get_len(type));
19373    } else {
19374 # 399 "./include/data0type.ic"
19375     ulint mbminlen, mbmaxlen;
19376
19377     innobase_get_cset_width(
19378      dtype_get_charset_coll(type->prtype),
19379      &mbminlen, &mbmaxlen);
19380
19381     if (__builtin_expect(type->mbminlen != mbminlen, (0))
19382     || __builtin_expect(type->mbmaxlen != mbmaxlen, (0))) {
19383
19384      ut_print_timestamp(stderr);
19385      fprintf(stderr, "  InnoDB: "
19386       "mbminlen=%lu, "
19387       "mbmaxlen=%lu, "
19388       "type->mbminlen=%lu, "
19389       "type->mbmaxlen=%lu\n",
19390       (ulong) mbminlen,
19391       (ulong) mbmaxlen,
19392       (ulong) type->mbminlen,
19393       (ulong) type->mbmaxlen);
19394     }
19395     if (mbminlen == mbmaxlen) {
19396      return(dtype_get_len(type));
19397     }
19398    }
19399
19400  case 1:
19401  case 4:
19402  case 11:
19403  case 12:
19404  case 5:
19405    return(0);
19406  default: do { ut_dbg_assertion_failed(0, "./include/data0type.ic", (ulint) 430); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
19407  }
19408
19409  return(0);
19410 }
19411
19412
19413
19414 static inline
19415 ulint
19416 dtype_get_min_size(
19417
19418
19419  const dtype_t* type)
19420 {
19421  switch (type->mtype) {
19422  case 8:
19423 # 466 "./include/data0type.ic"
19424  case 2:
19425  case 3:
19426  case 6:
19427  case 9:
19428  case 10:
19429    return(type->len);
19430  case 13:
19431    if ((type->prtype & 1024)
19432      || type->mbminlen == type->mbmaxlen) {
19433     return(type->len);
19434    }
19435
19436    do { if (__builtin_expect(!((ulint)(type->mbminlen > 0)), (0))) { ut_dbg_assertion_failed("type->mbminlen > 0", "./include/data0type.ic", (ulint) 478); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/data0type.ic", (ulint) 478); } while (0); } while (0);
19437    do { if (__builtin_expect(!((ulint)(type->mbmaxlen > type->mbminlen)), (0))) { ut_dbg_assertion_failed("type->mbmaxlen > type->mbminlen", "./include/data0type.ic", (ulint) 479); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/data0type.ic", (ulint) 479); } while (0); } while (0);
19438    do { if (__builtin_expect(!((ulint)(type->len % type->mbmaxlen == 0)), (0))) { ut_dbg_assertion_failed("type->len % type->mbmaxlen == 0", "./include/data0type.ic", (ulint) 480); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/data0type.ic", (ulint) 480); } while (0); } while (0);
19439    return(type->len * type->mbminlen / type->mbmaxlen);
19440  case 1:
19441  case 4:
19442  case 11:
19443  case 12:
19444  case 5:
19445    return(0);
19446  default: do { ut_dbg_assertion_failed(0, "./include/data0type.ic", (ulint) 488); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
19447  }
19448
19449  return(0);
19450 }
19451
19452
19453
19454
19455
19456 static inline
19457 ulint
19458 dtype_get_sql_null_size(
19459
19460
19461  dtype_t* type)
19462 {
19463  return(dtype_get_fixed_size(type));
19464 }
19465
19466
19467
19468 static inline
19469 ulint
19470 dtype_is_fixed_size(
19471
19472
19473  dtype_t* type)
19474 {
19475  ulint size;
19476
19477  size = dtype_get_fixed_size(type);
19478
19479  if (size) {
19480   return((1));
19481  }
19482
19483  return((0));
19484 }
19485 # 431 "./include/data0type.h" 2
19486 # 15 "./include/dict0mem.h" 2
19487 # 1 "./include/data0data.h" 1
19488 # 14 "./include/data0data.h"
19489 # 1 "./include/data0types.h" 1
19490 # 13 "./include/data0types.h"
19491 typedef struct dfield_struct dfield_t;
19492
19493
19494 typedef struct dtuple_struct dtuple_t;
19495 # 15 "./include/data0data.h" 2
19496
19497
19498
19499
19500 typedef struct big_rec_struct big_rec_t;
19501
19502
19503 void
19504 dfield_set_data_noninline(
19505  dfield_t* field,
19506  void* data,
19507  ulint len);
19508 void*
19509 dfield_get_data_noninline(
19510  dfield_t* field);
19511 ulint
19512 dfield_get_len_noninline(
19513  dfield_t* field);
19514 ulint
19515 dtuple_get_n_fields_noninline(
19516  dtuple_t* tuple);
19517 dfield_t*
19518 dtuple_get_nth_field_noninline(
19519  dtuple_t* tuple,
19520  ulint n);
19521
19522
19523
19524 static inline
19525 dtype_t*
19526 dfield_get_type(
19527
19528
19529  dfield_t* field);
19530
19531
19532 static inline
19533 void
19534 dfield_set_type(
19535
19536  dfield_t* field,
19537  dtype_t* type);
19538
19539
19540 static inline
19541 void*
19542 dfield_get_data(
19543
19544
19545  dfield_t* field);
19546
19547
19548 static inline
19549 ulint
19550 dfield_get_len(
19551
19552
19553
19554  dfield_t* field);
19555
19556
19557 static inline
19558 void
19559 dfield_set_len(
19560
19561  dfield_t* field,
19562  ulint len);
19563
19564
19565 static inline
19566 void
19567 dfield_set_data(
19568
19569  dfield_t* field,
19570  const void* data,
19571  ulint len);
19572
19573
19574 static inline
19575 void
19576 data_write_sql_null(
19577
19578  unsigned char* data,
19579  ulint len);
19580
19581
19582 static inline
19583 void
19584 dfield_copy_data(
19585
19586  dfield_t* field1,
19587  dfield_t* field2);
19588
19589
19590 static inline
19591 void
19592 dfield_copy(
19593
19594  dfield_t* field1,
19595  dfield_t* field2);
19596
19597
19598 static inline
19599 ulint
19600 dfield_datas_are_binary_equal(
19601
19602
19603  dfield_t* field1,
19604  dfield_t* field2);
19605
19606
19607
19608 ulint
19609 dfield_data_is_binary_equal(
19610
19611
19612  dfield_t* field,
19613  ulint len,
19614  unsigned char* data);
19615
19616
19617 static inline
19618 ulint
19619 dtuple_get_n_fields(
19620
19621
19622  dtuple_t* tuple);
19623
19624
19625 static inline
19626 dfield_t*
19627 dtuple_get_nth_field(
19628
19629
19630  dtuple_t* tuple,
19631  ulint n);
19632
19633
19634 static inline
19635 ulint
19636 dtuple_get_info_bits(
19637
19638
19639  dtuple_t* tuple);
19640
19641
19642 static inline
19643 void
19644 dtuple_set_info_bits(
19645
19646  dtuple_t* tuple,
19647  ulint info_bits);
19648
19649
19650 static inline
19651 ulint
19652 dtuple_get_n_fields_cmp(
19653
19654
19655
19656  dtuple_t* tuple);
19657
19658
19659 static inline
19660 void
19661 dtuple_set_n_fields_cmp(
19662
19663  dtuple_t* tuple,
19664  ulint n_fields_cmp);
19665
19666
19667
19668
19669 static inline
19670 dtuple_t*
19671 dtuple_create(
19672
19673
19674  mem_heap_t* heap,
19675
19676  ulint n_fields);
19677
19678
19679
19680
19681 dtuple_t*
19682 dtuple_create_for_mysql(
19683
19684
19685  void** heap,
19686  ulint n_fields);
19687
19688
19689
19690 void
19691 dtuple_free_for_mysql(
19692
19693  void* heap);
19694
19695
19696
19697
19698 void
19699 dtuple_set_n_fields(
19700
19701  dtuple_t* tuple,
19702  ulint n_fields);
19703
19704
19705
19706 static inline
19707 ulint
19708 dtuple_get_data_size(
19709
19710
19711  dtuple_t* tuple);
19712
19713
19714
19715
19716
19717 ulint
19718 dtuple_datas_are_ordering_equal(
19719
19720
19721
19722
19723
19724  dtuple_t* tuple1,
19725  dtuple_t* tuple2);
19726
19727
19728 static inline
19729 ulint
19730 dtuple_fold(
19731
19732
19733  dtuple_t* tuple,
19734  ulint n_fields,
19735  ulint n_bytes,
19736
19737  dulint tree_id);
19738
19739
19740 static inline
19741 void
19742 dtuple_set_types_binary(
19743
19744  dtuple_t* tuple,
19745  ulint n);
19746
19747
19748 static inline
19749 ulint
19750 dtuple_contains_null(
19751
19752
19753  dtuple_t* tuple);
19754
19755
19756
19757 ulint
19758 dfield_check_typed(
19759
19760
19761  dfield_t* field);
19762
19763
19764
19765 ulint
19766 dtuple_check_typed(
19767
19768
19769  dtuple_t* tuple);
19770
19771
19772
19773 ulint
19774 dtuple_check_typed_no_assert(
19775
19776
19777  dtuple_t* tuple);
19778 # 311 "./include/data0data.h"
19779 void
19780 dfield_print(
19781
19782  dfield_t* dfield);
19783
19784
19785
19786
19787 void
19788 dfield_print_also_hex(
19789
19790  dfield_t* dfield);
19791
19792
19793
19794 void
19795 dtuple_print(
19796
19797  FILE* f,
19798  dtuple_t* tuple);
19799
19800
19801
19802
19803
19804
19805 big_rec_t*
19806 dtuple_convert_big_rec(
19807
19808
19809
19810
19811
19812  dict_index_t* index,
19813  dtuple_t* entry,
19814  ulint* ext_vec,
19815
19816
19817
19818  ulint n_ext_vec);
19819
19820
19821
19822
19823
19824 void
19825 dtuple_convert_back_big_rec(
19826
19827  dict_index_t* index,
19828  dtuple_t* entry,
19829  big_rec_t* vector);
19830
19831
19832
19833
19834 void
19835 dtuple_big_rec_free(
19836
19837  big_rec_t* vector);
19838
19839
19840
19841
19842
19843 struct dfield_struct{
19844  void* data;
19845  ulint len;
19846  dtype_t type;
19847 };
19848
19849 struct dtuple_struct {
19850  ulint info_bits;
19851
19852
19853
19854  ulint n_fields;
19855  ulint n_fields_cmp;
19856
19857
19858
19859
19860
19861
19862  dfield_t* fields;
19863  struct { dtuple_t * prev; dtuple_t * next; } tuple_list;
19864
19865
19866  ulint magic_n;
19867 };
19868
19869
19870
19871
19872 typedef struct big_rec_field_struct big_rec_field_t;
19873 struct big_rec_field_struct {
19874  ulint field_no;
19875  ulint len;
19876  unsigned char* data;
19877 };
19878
19879
19880
19881
19882 struct big_rec_struct {
19883  mem_heap_t* heap;
19884  ulint n_fields;
19885  big_rec_field_t* fields;
19886 };
19887
19888
19889 # 1 "./include/data0data.ic" 1
19890 # 12 "./include/data0data.ic"
19891 extern unsigned char data_error;
19892
19893
19894
19895 static inline
19896 dtype_t*
19897 dfield_get_type(
19898
19899
19900  dfield_t* field)
19901 {
19902  ;
19903
19904  return(&(field->type));
19905 }
19906
19907
19908
19909 static inline
19910 void
19911 dfield_set_type(
19912
19913  dfield_t* field,
19914  dtype_t* type)
19915 {
19916  ;
19917
19918  field->type = *type;
19919 }
19920
19921
19922
19923 static inline
19924 void*
19925 dfield_get_data(
19926
19927
19928  dfield_t* field)
19929 {
19930  ;
19931  ;
19932
19933
19934  return(field->data);
19935 }
19936
19937
19938
19939 static inline
19940 ulint
19941 dfield_get_len(
19942
19943
19944
19945  dfield_t* field)
19946 {
19947  ;
19948  ;
19949
19950
19951  return(field->len);
19952 }
19953
19954
19955
19956 static inline
19957 void
19958 dfield_set_len(
19959
19960  dfield_t* field,
19961  ulint len)
19962 {
19963  ;
19964
19965  field->len = len;
19966 }
19967
19968
19969
19970 static inline
19971 void
19972 dfield_set_data(
19973
19974  dfield_t* field,
19975  const void* data,
19976  ulint len)
19977 {
19978  ;
19979
19980  field->data = (void*) data;
19981  field->len = len;
19982 }
19983
19984
19985
19986 static inline
19987 void
19988 dfield_copy_data(
19989
19990  dfield_t* field1,
19991  dfield_t* field2)
19992 {
19993  ;
19994
19995  field1->data = field2->data;
19996  field1->len = field2->len;
19997 }
19998
19999
20000
20001 static inline
20002 void
20003 dfield_copy(
20004
20005  dfield_t* field1,
20006  dfield_t* field2)
20007 {
20008  *field1 = *field2;
20009 }
20010
20011
20012
20013 static inline
20014 ulint
20015 dfield_datas_are_binary_equal(
20016
20017
20018  dfield_t* field1,
20019  dfield_t* field2)
20020 {
20021  ulint len;
20022
20023  len = field1->len;
20024
20025  if ((len != field2->len)
20026      || ((len != 0xFFFFFFFF)
20027          && (0 != ut_memcmp(field1->data, field2->data, len)))) {
20028
20029   return((0));
20030  }
20031
20032  return((1));
20033 }
20034
20035
20036
20037 static inline
20038 ulint
20039 dtuple_get_info_bits(
20040
20041
20042  dtuple_t* tuple)
20043 {
20044  ;
20045
20046  return(tuple->info_bits);
20047 }
20048
20049
20050
20051 static inline
20052 void
20053 dtuple_set_info_bits(
20054
20055  dtuple_t* tuple,
20056  ulint info_bits)
20057 {
20058  ;
20059
20060  tuple->info_bits = info_bits;
20061 }
20062
20063
20064
20065 static inline
20066 ulint
20067 dtuple_get_n_fields_cmp(
20068
20069
20070
20071  dtuple_t* tuple)
20072 {
20073  ;
20074
20075  return(tuple->n_fields_cmp);
20076 }
20077
20078
20079
20080 static inline
20081 void
20082 dtuple_set_n_fields_cmp(
20083
20084  dtuple_t* tuple,
20085  ulint n_fields_cmp)
20086
20087 {
20088  ;
20089  ;
20090
20091  tuple->n_fields_cmp = n_fields_cmp;
20092 }
20093
20094
20095
20096 static inline
20097 ulint
20098 dtuple_get_n_fields(
20099
20100
20101  dtuple_t* tuple)
20102 {
20103  ;
20104
20105  return(tuple->n_fields);
20106 }
20107
20108
20109
20110 static inline
20111 dfield_t*
20112 dtuple_get_nth_field(
20113
20114
20115  dtuple_t* tuple,
20116  ulint n)
20117 {
20118  ;
20119  ;
20120
20121  return(tuple->fields + n);
20122 }
20123
20124
20125
20126
20127 static inline
20128 dtuple_t*
20129 dtuple_create(
20130
20131
20132  mem_heap_t* heap,
20133
20134  ulint n_fields)
20135 {
20136  dtuple_t* tuple;
20137
20138  ;
20139
20140  tuple = (dtuple_t*) mem_heap_alloc(heap, sizeof(dtuple_t)
20141          + n_fields * sizeof(dfield_t));
20142  tuple->info_bits = 0;
20143  tuple->n_fields = n_fields;
20144  tuple->n_fields_cmp = n_fields;
20145  tuple->fields = (dfield_t*)(((unsigned char*)tuple) + sizeof(dtuple_t));
20146 # 280 "./include/data0data.ic"
20147  return(tuple);
20148 }
20149
20150
20151
20152
20153
20154 static inline
20155 ulint
20156 dtuple_get_data_size(
20157
20158
20159  dtuple_t* tuple)
20160 {
20161  dfield_t* field;
20162  ulint n_fields;
20163  ulint len;
20164  ulint i;
20165  ulint sum = 0;
20166
20167  ;
20168  ;
20169  ;
20170
20171  n_fields = tuple->n_fields;
20172
20173  for (i = 0; i < n_fields; i++) {
20174   field = dtuple_get_nth_field(tuple, i);
20175   len = dfield_get_len(field);
20176
20177   if (len == 0xFFFFFFFF) {
20178    len = dtype_get_sql_null_size(dfield_get_type(field));
20179   }
20180
20181   sum += len;
20182  }
20183
20184  return(sum);
20185 }
20186
20187
20188
20189 static inline
20190 void
20191 dtuple_set_types_binary(
20192
20193  dtuple_t* tuple,
20194  ulint n)
20195 {
20196  dtype_t* dfield_type;
20197  ulint i;
20198
20199  for (i = 0; i < n; i++) {
20200   dfield_type = dfield_get_type(dtuple_get_nth_field(tuple, i));
20201   dtype_set(dfield_type, 4, 0, 0, 0);
20202  }
20203 }
20204
20205
20206
20207 static inline
20208 ulint
20209 dtuple_fold(
20210
20211
20212  dtuple_t* tuple,
20213  ulint n_fields,
20214  ulint n_bytes,
20215
20216  dulint tree_id)
20217 {
20218  dfield_t* field;
20219  ulint i;
20220  unsigned char* data;
20221  ulint len;
20222  ulint fold;
20223
20224  ;
20225  ;
20226  ;
20227
20228  fold = ut_fold_dulint(tree_id);
20229
20230  for (i = 0; i < n_fields; i++) {
20231   field = dtuple_get_nth_field(tuple, i);
20232
20233   data = (unsigned char*) dfield_get_data(field);
20234   len = dfield_get_len(field);
20235
20236   if (len != 0xFFFFFFFF) {
20237    fold = ut_fold_ulint_pair(fold,
20238         ut_fold_binary(data, len));
20239   }
20240  }
20241
20242  if (n_bytes > 0) {
20243   field = dtuple_get_nth_field(tuple, i);
20244
20245   data = (unsigned char*) dfield_get_data(field);
20246   len = dfield_get_len(field);
20247
20248   if (len != 0xFFFFFFFF) {
20249    if (len > n_bytes) {
20250     len = n_bytes;
20251    }
20252
20253    fold = ut_fold_ulint_pair(fold,
20254         ut_fold_binary(data, len));
20255   }
20256  }
20257
20258  return(fold);
20259 }
20260
20261
20262
20263 static inline
20264 void
20265 data_write_sql_null(
20266
20267  unsigned char* data,
20268  ulint len)
20269 {
20270  ulint j;
20271
20272  for (j = 0; j < len; j++) {
20273   data[j] = '\0';
20274  }
20275 }
20276
20277
20278
20279 static inline
20280 ulint
20281 dtuple_contains_null(
20282
20283
20284  dtuple_t* tuple)
20285 {
20286  ulint n;
20287  ulint i;
20288
20289  n = dtuple_get_n_fields(tuple);
20290
20291  for (i = 0; i < n; i++) {
20292   if (dfield_get_len(dtuple_get_nth_field(tuple, i))
20293       == 0xFFFFFFFF) {
20294
20295    return((1));
20296   }
20297  }
20298
20299  return((0));
20300 }
20301 # 422 "./include/data0data.h" 2
20302 # 16 "./include/dict0mem.h" 2
20303
20304 # 1 "./include/rem0types.h" 1
20305 # 13 "./include/rem0types.h"
20306 typedef unsigned char rec_t;
20307 # 18 "./include/dict0mem.h" 2
20308 # 1 "./include/btr0types.h" 1
20309 # 17 "./include/btr0types.h"
20310 typedef struct btr_pcur_struct btr_pcur_t;
20311 typedef struct btr_cur_struct btr_cur_t;
20312 typedef struct btr_search_struct btr_search_t;
20313 # 19 "./include/dict0mem.h" 2
20314
20315
20316
20317
20318
20319
20320
20321 # 1 "./include/que0types.h" 1
20322 # 16 "./include/que0types.h"
20323 typedef void que_node_t;
20324
20325 typedef struct que_fork_struct que_fork_t;
20326
20327
20328 typedef que_fork_t que_t;
20329
20330 typedef struct que_thr_struct que_thr_t;
20331 typedef struct que_common_struct que_common_t;
20332
20333
20334
20335
20336 struct que_common_struct{
20337  ulint type;
20338  que_node_t* parent;
20339  que_node_t* brother;
20340  dfield_t val;
20341  ulint val_buf_size;
20342
20343
20344
20345
20346
20347
20348 };
20349 # 27 "./include/dict0mem.h" 2
20350 # 48 "./include/dict0mem.h"
20351 dict_table_t*
20352 dict_mem_table_create(
20353
20354
20355  const char* name,
20356  ulint space,
20357
20358
20359
20360  ulint n_cols,
20361  ulint comp);
20362
20363
20364
20365 void
20366 dict_mem_table_free(
20367
20368  dict_table_t* table);
20369
20370
20371
20372 dict_cluster_t*
20373 dict_mem_cluster_create(
20374
20375
20376
20377  const char* name,
20378  ulint space,
20379
20380
20381  ulint n_cols,
20382  ulint mix_len);
20383
20384
20385
20386
20387 void
20388 dict_mem_table_make_cluster_member(
20389
20390  dict_table_t* table,
20391  const char* cluster_name);
20392
20393
20394
20395 void
20396 dict_mem_table_add_col(
20397
20398  dict_table_t* table,
20399  const char* name,
20400  ulint mtype,
20401  ulint prtype,
20402  ulint len,
20403  ulint prec);
20404
20405
20406
20407 dict_index_t*
20408 dict_mem_index_create(
20409
20410
20411  const char* table_name,
20412  const char* index_name,
20413  ulint space,
20414
20415
20416  ulint type,
20417
20418  ulint n_fields);
20419
20420
20421
20422
20423
20424 void
20425 dict_mem_index_add_field(
20426
20427  dict_index_t* index,
20428  const char* name,
20429  ulint order,
20430
20431  ulint prefix_len);
20432
20433
20434
20435
20436
20437 void
20438 dict_mem_index_free(
20439
20440  dict_index_t* index);
20441
20442
20443
20444 dict_foreign_t*
20445 dict_mem_foreign_create(void);
20446
20447
20448
20449
20450 struct dict_col_struct{
20451  hash_node_t hash;
20452  ulint ind;
20453
20454  ulint clust_pos;
20455
20456  ulint ord_part;
20457
20458  const char* name;
20459  dtype_t type;
20460  dict_table_t* table;
20461  ulint aux;
20462
20463 };
20464 # 173 "./include/dict0mem.h"
20465 struct dict_field_struct{
20466  dict_col_t* col;
20467  const char* name;
20468  ulint order;
20469
20470  ulint prefix_len;
20471
20472
20473
20474
20475
20476
20477  ulint fixed_len;
20478
20479
20480  ulint fixed_offs;
20481
20482
20483
20484 };
20485
20486
20487 struct dict_tree_struct{
20488  ulint type;
20489  dulint id;
20490
20491
20492  ulint space;
20493  ulint page;
20494  unsigned char pad[64];
20495
20496  rw_lock_t lock;
20497
20498  ulint mem_fix;
20499
20500
20501
20502  struct { ulint count; dict_index_t * start; dict_index_t * end; }
20503    tree_indexes;
20504
20505
20506
20507
20508
20509  ulint magic_n;
20510 };
20511
20512
20513
20514
20515 struct dict_index_struct{
20516  dulint id;
20517  mem_heap_t* heap;
20518  ulint type;
20519  const char* name;
20520  const char* table_name;
20521  dict_table_t* table;
20522  ulint space;
20523  ulint trx_id_offset;
20524
20525
20526
20527  ulint n_user_defined_cols;
20528
20529
20530
20531  ulint n_uniq;
20532
20533
20534  ulint n_def;
20535  ulint n_fields;
20536  dict_field_t* fields;
20537  ulint n_nullable;
20538  struct { dict_index_t * prev; dict_index_t * next; }
20539    indexes;
20540  dict_tree_t* tree;
20541  struct { dict_index_t * prev; dict_index_t * next; }
20542    tree_indexes;
20543
20544  ulint cached;
20545
20546  btr_search_t* search_info;
20547
20548  ib_longlong* stat_n_diff_key_vals;
20549
20550
20551
20552
20553  ulint stat_index_size;
20554
20555  ulint stat_n_leaf_pages;
20556
20557
20558  ulint magic_n;
20559 };
20560
20561
20562
20563
20564 struct dict_foreign_struct{
20565  mem_heap_t* heap;
20566
20567  char* id;
20568
20569  ulint type;
20570
20571  char* foreign_table_name;
20572  dict_table_t* foreign_table;
20573  const char** foreign_col_names;
20574
20575  char* referenced_table_name;
20576  dict_table_t* referenced_table;
20577
20578  const char** referenced_col_names;
20579
20580  ulint n_fields;
20581
20582
20583
20584
20585
20586  dict_index_t* foreign_index;
20587
20588
20589
20590
20591  dict_index_t* referenced_index;
20592  struct { dict_foreign_t * prev; dict_foreign_t * next; }
20593    foreign_list;
20594
20595  struct { dict_foreign_t * prev; dict_foreign_t * next; }
20596    referenced_list;
20597
20598 };
20599 # 321 "./include/dict0mem.h"
20600 struct dict_table_struct{
20601  dulint id;
20602  ulint type;
20603  mem_heap_t* heap;
20604  const char* name;
20605  const char* dir_path_of_temp_table;
20606
20607
20608
20609
20610
20611  ulint space;
20612
20613  ulint ibd_file_missing;
20614
20615
20616
20617  ulint tablespace_discarded;
20618
20619
20620  ulint comp;
20621  hash_node_t name_hash;
20622  hash_node_t id_hash;
20623  ulint n_def;
20624  ulint n_cols;
20625  dict_col_t* cols;
20626  struct { ulint count; dict_index_t * start; dict_index_t * end; }
20627    indexes;
20628  struct { ulint count; dict_foreign_t * start; dict_foreign_t * end; }
20629    foreign_list;
20630
20631
20632  struct { ulint count; dict_foreign_t * start; dict_foreign_t * end; }
20633    referenced_list;
20634
20635  struct { dict_table_t * prev; dict_table_t * next; }
20636    table_LRU;
20637  ulint mem_fix;
20638
20639
20640  ulint n_mysql_handles_opened;
20641
20642
20643
20644
20645
20646  ulint n_foreign_key_checks_running;
20647
20648
20649
20650
20651
20652  ulint cached;
20653
20654  ib_lock_t* auto_inc_lock;
20655
20656
20657
20658
20659
20660
20661  dulint query_cache_inv_trx_id;
20662
20663
20664
20665
20666
20667
20668  struct { ulint count; ib_lock_t * start; ib_lock_t * end; }
20669    locks;
20670
20671  dulint mix_id;
20672
20673  ulint mix_len;
20674
20675  ulint mix_id_len;
20676  unsigned char mix_id_buf[12];
20677
20678
20679  const char* cluster_name;
20680
20681
20682  ulint does_not_fit_in_memory;
20683 # 413 "./include/dict0mem.h"
20684  ib_longlong stat_n_rows;
20685
20686
20687  ulint stat_clustered_index_size;
20688
20689
20690  ulint stat_sum_of_other_index_sizes;
20691
20692  ulint stat_initialized;
20693
20694
20695  ulint stat_modified_counter;
20696 # 437 "./include/dict0mem.h"
20697  ib_mutex_t autoinc_mutex;
20698
20699
20700  ulint autoinc_inited;
20701
20702
20703
20704  ib_longlong autoinc;
20705
20706  ulint magic_n;
20707 };
20708
20709
20710
20711 # 1 "./include/dict0mem.ic" 1
20712 # 452 "./include/dict0mem.h" 2
20713 # 15 "./include/dict0dict.h" 2
20714 # 32 "./include/dict0dict.h"
20715 void
20716 dict_casedn_str(
20717
20718  char* a);
20719
20720
20721
20722 ulint
20723 dict_get_db_name_len(
20724
20725
20726  const char* name);
20727
20728
20729
20730
20731 const char*
20732 dict_accept(
20733
20734
20735
20736  const char* ptr,
20737  const char* string,
20738
20739  ulint* success);
20740
20741
20742
20743 void
20744 dict_table_decrement_handle_count(
20745
20746  dict_table_t* table);
20747
20748
20749
20750 void
20751 dict_init(void);
20752 # 77 "./include/dict0dict.h"
20753 void
20754 dict_load_space_id_list(void);
20755
20756
20757
20758 static inline
20759 dtype_t*
20760 dict_col_get_type(
20761
20762  dict_col_t* col);
20763 # 100 "./include/dict0dict.h"
20764 static inline
20765 ulint
20766 dict_col_get_no(
20767
20768  dict_col_t* col);
20769
20770
20771 static inline
20772 ulint
20773 dict_col_get_clust_pos(
20774
20775  dict_col_t* col);
20776
20777
20778
20779
20780 ulint
20781 dict_col_name_is_reserved(
20782
20783
20784  const char* name);
20785
20786
20787
20788
20789 void
20790 dict_table_autoinc_initialize(
20791
20792  dict_table_t* table,
20793  ib_longlong value);
20794
20795
20796
20797
20798 ib_longlong
20799 dict_table_autoinc_get(
20800
20801
20802  dict_table_t* table);
20803
20804
20805
20806 void
20807 dict_table_autoinc_decrement(
20808
20809  dict_table_t* table);
20810
20811
20812
20813
20814 ib_longlong
20815 dict_table_autoinc_read(
20816
20817
20818  dict_table_t* table);
20819
20820
20821
20822
20823 ib_longlong
20824 dict_table_autoinc_peek(
20825
20826
20827  dict_table_t* table);
20828
20829
20830
20831
20832 void
20833 dict_table_autoinc_update(
20834
20835
20836  dict_table_t* table,
20837  ib_longlong value);
20838
20839
20840
20841 void
20842 dict_table_add_to_cache(
20843
20844  dict_table_t* table);
20845
20846
20847
20848 void
20849 dict_table_remove_from_cache(
20850
20851  dict_table_t* table);
20852
20853
20854
20855 ulint
20856 dict_table_rename_in_cache(
20857
20858
20859  dict_table_t* table,
20860  const char* new_name,
20861  ulint rename_also_foreigns);
20862
20863
20864
20865
20866
20867
20868 void
20869 dict_table_change_id_in_cache(
20870
20871  dict_table_t* table,
20872  dulint new_id);
20873
20874
20875
20876
20877
20878
20879 ulint
20880 dict_foreign_add_to_cache(
20881
20882
20883  dict_foreign_t* foreign,
20884  ulint check_charsets);
20885
20886
20887
20888
20889 ulint
20890 dict_table_referenced_by_foreign_key(
20891
20892
20893
20894  dict_table_t* table);
20895 # 239 "./include/dict0dict.h"
20896 ulint
20897 dict_create_foreign_constraints(
20898
20899
20900  trx_t* trx,
20901  const char* sql_string,
20902
20903
20904
20905
20906
20907
20908
20909  const char* name,
20910
20911
20912  ulint reject_fks);
20913
20914
20915
20916
20917
20918 ulint
20919 dict_foreign_parse_drop_constraints(
20920
20921
20922
20923
20924
20925  mem_heap_t* heap,
20926
20927  trx_t* trx,
20928  dict_table_t* table,
20929  ulint* n,
20930
20931  const char*** constraints_to_drop);
20932
20933
20934
20935
20936
20937
20938 dict_table_t*
20939 dict_table_get(
20940
20941
20942
20943  const char* table_name,
20944  trx_t* trx);
20945
20946
20947
20948
20949 dict_table_t*
20950 dict_table_get_and_increment_handle_count(
20951
20952
20953
20954  const char* table_name,
20955  trx_t* trx);
20956
20957
20958
20959 dict_table_t*
20960 dict_table_get_on_id(
20961
20962
20963  dulint table_id,
20964  trx_t* trx);
20965
20966
20967 static inline
20968 dict_table_t*
20969 dict_table_get_on_id_low(
20970
20971
20972  dulint table_id,
20973  trx_t* trx);
20974
20975
20976 static inline
20977 void
20978 dict_table_release(
20979
20980  dict_table_t* table);
20981
20982
20983 static inline
20984 dict_table_t*
20985 dict_table_check_if_in_cache_low(
20986
20987
20988  const char* table_name);
20989
20990
20991
20992 static inline
20993 dict_table_t*
20994 dict_table_get_low(
20995
20996
20997  const char* table_name);
20998
20999
21000 static inline
21001 dict_index_t*
21002 dict_table_get_index(
21003
21004
21005  dict_table_t* table,
21006  const char* name);
21007
21008
21009
21010 dict_index_t*
21011 dict_table_get_index_noninline(
21012
21013
21014  dict_table_t* table,
21015  const char* name);
21016
21017
21018
21019 void
21020 dict_table_print(
21021
21022  dict_table_t* table);
21023
21024
21025
21026 void
21027 dict_table_print_low(
21028
21029  dict_table_t* table);
21030
21031
21032
21033 void
21034 dict_table_print_by_name(
21035
21036  const char* name);
21037
21038
21039
21040 void
21041 dict_print_info_on_foreign_keys(
21042
21043  ulint create_table_format,
21044
21045
21046
21047  FILE* file,
21048  trx_t* trx,
21049  dict_table_t* table);
21050
21051
21052
21053 void
21054 dict_print_info_on_foreign_key_in_create_format(
21055
21056  FILE* file,
21057  trx_t* trx,
21058  dict_foreign_t* foreign,
21059  ulint add_newline);
21060
21061
21062 void
21063 dict_index_name_print(
21064
21065  FILE* file,
21066  trx_t* trx,
21067  const dict_index_t* index);
21068
21069
21070 static inline
21071 dict_index_t*
21072 dict_table_get_first_index(
21073
21074
21075  dict_table_t* table);
21076
21077
21078
21079 dict_index_t*
21080 dict_table_get_first_index_noninline(
21081
21082
21083  dict_table_t* table);
21084
21085
21086 static inline
21087 dict_index_t*
21088 dict_table_get_next_index(
21089
21090
21091  dict_index_t* index);
21092
21093
21094
21095 dict_index_t*
21096 dict_table_get_next_index_noninline(
21097
21098
21099  dict_index_t* index);
21100
21101
21102
21103 static inline
21104 ulint
21105 dict_table_get_n_user_cols(
21106
21107
21108
21109  dict_table_t* table);
21110
21111
21112 static inline
21113 ulint
21114 dict_table_get_n_sys_cols(
21115
21116
21117
21118  dict_table_t* table);
21119
21120
21121
21122 static inline
21123 ulint
21124 dict_table_get_n_cols(
21125
21126
21127  dict_table_t* table);
21128
21129
21130 static inline
21131 dict_col_t*
21132 dict_table_get_nth_col(
21133
21134
21135  dict_table_t* table,
21136  ulint pos);
21137
21138
21139
21140 dict_col_t*
21141 dict_table_get_nth_col_noninline(
21142
21143
21144  dict_table_t* table,
21145  ulint pos);
21146
21147
21148 static inline
21149 dict_col_t*
21150 dict_table_get_sys_col(
21151
21152
21153  dict_table_t* table,
21154  ulint sys);
21155
21156
21157 static inline
21158 ulint
21159 dict_table_get_sys_col_no(
21160
21161
21162  dict_table_t* table,
21163  ulint sys);
21164
21165
21166
21167
21168 ulint
21169 dict_table_col_in_clustered_key(
21170
21171
21172
21173  dict_table_t* table,
21174  ulint n);
21175
21176
21177
21178 void
21179 dict_table_copy_types(
21180
21181  dtuple_t* tuple,
21182  dict_table_t* table);
21183
21184
21185
21186
21187
21188 dict_index_t*
21189 dict_index_find_on_id_low(
21190
21191
21192  dulint id);
21193
21194
21195
21196 ulint
21197 dict_index_add_to_cache(
21198
21199
21200  dict_table_t* table,
21201  dict_index_t* index,
21202
21203  ulint page_no);
21204
21205
21206
21207 static inline
21208 ulint
21209 dict_index_get_n_fields(
21210
21211
21212  dict_index_t* index);
21213
21214
21215
21216
21217
21218
21219 static inline
21220 ulint
21221 dict_index_get_n_unique(
21222
21223
21224  dict_index_t* index);
21225
21226
21227
21228
21229
21230 static inline
21231 ulint
21232 dict_index_get_n_unique_in_tree(
21233
21234
21235  dict_index_t* index);
21236
21237
21238
21239
21240
21241
21242 static inline
21243 ulint
21244 dict_index_get_n_ordering_defined_by_user(
21245
21246
21247  dict_index_t* index);
21248
21249
21250
21251 static inline
21252 dict_field_t*
21253 dict_index_get_nth_field(
21254
21255
21256  dict_index_t* index,
21257  ulint pos);
21258
21259
21260 static inline
21261 dtype_t*
21262 dict_index_get_nth_type(
21263
21264
21265  dict_index_t* index,
21266  ulint pos);
21267
21268
21269 static inline
21270 ulint
21271 dict_index_get_nth_col_no(
21272
21273
21274  dict_index_t* index,
21275  ulint pos);
21276
21277
21278
21279 ulint
21280 dict_index_get_nth_col_pos(
21281
21282
21283
21284
21285  dict_index_t* index,
21286  ulint n);
21287
21288
21289
21290 ulint
21291 dict_index_contains_col_or_prefix(
21292
21293
21294
21295  dict_index_t* index,
21296  ulint n);
21297
21298
21299
21300
21301
21302
21303 ulint
21304 dict_index_get_nth_field_pos(
21305
21306
21307
21308
21309  dict_index_t* index,
21310  dict_index_t* index2,
21311  ulint n);
21312
21313
21314
21315 ulint
21316 dict_table_get_nth_col_pos(
21317
21318
21319
21320  dict_table_t* table,
21321  ulint n);
21322
21323
21324 static inline
21325 ulint
21326 dict_index_get_sys_col_pos(
21327
21328
21329
21330  dict_index_t* index,
21331  ulint type);
21332
21333
21334
21335 void
21336 dict_index_add_col(
21337
21338  dict_index_t* index,
21339  dict_col_t* col,
21340  ulint order,
21341  ulint prefix_len);
21342
21343
21344
21345 void
21346 dict_index_copy_types(
21347
21348  dtuple_t* tuple,
21349  dict_index_t* index,
21350  ulint n_fields);
21351
21352
21353 static inline
21354 dict_tree_t*
21355 dict_index_get_tree(
21356
21357
21358  dict_index_t* index);
21359
21360
21361 static inline
21362 ulint
21363 dict_field_get_order(
21364
21365  dict_field_t* field);
21366
21367
21368 static inline
21369 dict_col_t*
21370 dict_field_get_col(
21371
21372  dict_field_t* field);
21373
21374
21375
21376 dict_tree_t*
21377 dict_tree_create(
21378
21379
21380  dict_index_t* index,
21381
21382
21383  ulint page_no);
21384
21385
21386
21387 void
21388 dict_tree_free(
21389
21390  dict_tree_t* tree);
21391
21392
21393
21394 dict_index_t*
21395 dict_tree_find_index(
21396
21397
21398  dict_tree_t* tree,
21399  rec_t* rec);
21400
21401
21402
21403
21404 dict_index_t*
21405 dict_tree_find_index_for_tuple(
21406
21407
21408
21409  dict_tree_t* tree,
21410  dtuple_t* tuple);
21411
21412
21413
21414 ulint
21415 dict_is_mixed_table_rec(
21416
21417
21418
21419  dict_table_t* table,
21420  rec_t* rec);
21421
21422
21423
21424 dict_index_t*
21425 dict_index_get_if_in_cache(
21426
21427
21428  dulint index_id);
21429
21430
21431
21432
21433 ulint
21434 dict_tree_check_search_tuple(
21435
21436
21437  dict_tree_t* tree,
21438  dtuple_t* tuple);
21439
21440
21441
21442 dtuple_t*
21443 dict_tree_build_node_ptr(
21444
21445
21446  dict_tree_t* tree,
21447  rec_t* rec,
21448
21449  ulint page_no,
21450  mem_heap_t* heap,
21451  ulint level);
21452
21453
21454
21455
21456
21457 rec_t*
21458 dict_tree_copy_rec_order_prefix(
21459
21460
21461  dict_tree_t* tree,
21462  rec_t* rec,
21463  ulint* n_fields,
21464  unsigned char** buf,
21465
21466  ulint* buf_size);
21467
21468
21469
21470 dtuple_t*
21471 dict_tree_build_data_tuple(
21472
21473
21474  dict_tree_t* tree,
21475  rec_t* rec,
21476  ulint n_fields,
21477  mem_heap_t* heap);
21478
21479
21480 static inline
21481 ulint
21482 dict_tree_get_space(
21483
21484
21485  dict_tree_t* tree);
21486
21487
21488 static inline
21489 void
21490 dict_tree_set_space(
21491
21492  dict_tree_t* tree,
21493  ulint space);
21494
21495
21496 static inline
21497 ulint
21498 dict_tree_get_page(
21499
21500
21501  dict_tree_t* tree);
21502
21503
21504 static inline
21505 void
21506 dict_tree_set_page(
21507
21508  dict_tree_t* tree,
21509  ulint page);
21510
21511
21512 static inline
21513 ulint
21514 dict_tree_get_type(
21515
21516
21517  dict_tree_t* tree);
21518
21519
21520 static inline
21521 rw_lock_t*
21522 dict_tree_get_lock(
21523
21524
21525  dict_tree_t* tree);
21526
21527
21528
21529
21530 static inline
21531 ulint
21532 dict_tree_get_space_reserve(
21533
21534
21535
21536  dict_tree_t* tree);
21537
21538
21539
21540 ulint
21541 dict_index_calc_min_rec_len(
21542
21543  dict_index_t* index);
21544
21545
21546
21547
21548 void
21549 dict_update_statistics_low(
21550
21551  dict_table_t* table,
21552  ulint has_dict_mutex);
21553
21554
21555
21556
21557
21558 void
21559 dict_update_statistics(
21560
21561  dict_table_t* table);
21562
21563
21564
21565 void
21566 dict_mutex_enter_for_mysql(void);
21567
21568
21569
21570
21571 void
21572 dict_mutex_exit_for_mysql(void);
21573
21574
21575
21576
21577 ulint
21578 dict_tables_have_same_db(
21579
21580
21581  const char* name1,
21582
21583  const char* name2);
21584
21585
21586
21587
21588
21589
21590
21591 const char*
21592 dict_scan_to(
21593
21594
21595  const char* ptr,
21596  const char* string);
21597
21598 void
21599 dict_table_LRU_trim(
21600
21601  dict_table_t* self);
21602
21603
21604
21605 extern FILE* dict_foreign_err_file;
21606 extern ib_mutex_t dict_foreign_err_mutex;
21607
21608 extern dict_sys_t* dict_sys;
21609 extern rw_lock_t dict_operation_lock;
21610
21611
21612 struct dict_sys_struct{
21613  ib_mutex_t mutex;
21614
21615
21616
21617
21618
21619
21620  dulint row_id;
21621
21622
21623
21624
21625
21626  hash_table_t* table_hash;
21627
21628  hash_table_t* table_id_hash;
21629
21630  hash_table_t* col_hash;
21631  struct { ulint count; dict_table_t * start; dict_table_t * end; }
21632    table_LRU;
21633  ulint size;
21634
21635
21636  dict_table_t* sys_tables;
21637  dict_table_t* sys_columns;
21638  dict_table_t* sys_indexes;
21639  dict_table_t* sys_fields;
21640 };
21641
21642
21643 # 1 "./include/dict0dict.ic" 1
21644 # 9 "./include/dict0dict.ic"
21645 # 1 "./include/dict0load.h" 1
21646 # 26 "./include/dict0load.h"
21647 void
21648 dict_check_tablespaces_and_store_max_id(
21649
21650  ulint in_crash_recovery);
21651
21652
21653
21654 char*
21655 dict_get_first_table_name_in_db(
21656
21657
21658
21659
21660  const char* name);
21661
21662
21663
21664
21665
21666
21667 dict_table_t*
21668 dict_load_table(
21669
21670
21671
21672
21673
21674
21675  const char* name);
21676
21677
21678
21679
21680 dict_table_t*
21681 dict_load_table_on_id(
21682
21683
21684  dulint table_id);
21685
21686
21687
21688
21689
21690 void
21691 dict_load_sys_table(
21692
21693  dict_table_t* table);
21694
21695
21696
21697
21698
21699
21700
21701 ulint
21702 dict_load_foreigns(
21703
21704
21705  const char* table_name,
21706  ulint check_charsets);
21707
21708
21709
21710
21711
21712 void
21713 dict_print(void);
21714
21715
21716
21717
21718 # 1 "./include/dict0load.ic" 1
21719 # 98 "./include/dict0load.h" 2
21720 # 10 "./include/dict0dict.ic" 2
21721 # 1 "./include/trx0undo.h" 1
21722 # 15 "./include/trx0undo.h"
21723 # 1 "./include/trx0sys.h" 1
21724 # 16 "./include/trx0sys.h"
21725 # 1 "./include/mtr0log.h" 1
21726 # 20 "./include/mtr0log.h"
21727 void
21728 mlog_write_ulint(
21729
21730  unsigned char* ptr,
21731  ulint val,
21732  unsigned char type,
21733  mtr_t* mtr);
21734
21735
21736
21737
21738 void
21739 mlog_write_dulint(
21740
21741  unsigned char* ptr,
21742  dulint val,
21743  mtr_t* mtr);
21744
21745
21746
21747
21748 void
21749 mlog_write_string(
21750
21751  unsigned char* ptr,
21752  const unsigned char* str,
21753  ulint len,
21754  mtr_t* mtr);
21755
21756
21757
21758
21759 void
21760 mlog_write_initial_log_record(
21761
21762  unsigned char* ptr,
21763
21764
21765  unsigned char type,
21766  mtr_t* mtr);
21767
21768
21769 static inline
21770 unsigned char*
21771 mlog_write_initial_log_record_for_file_op(
21772
21773
21774  ulint type,
21775
21776  ulint space_id,
21777  ulint page_no,
21778  unsigned char* log_ptr,
21779  mtr_t* mtr);
21780
21781
21782 static inline
21783 void
21784 mlog_catenate_ulint(
21785
21786  mtr_t* mtr,
21787  ulint val,
21788  ulint type);
21789
21790
21791
21792 void
21793 mlog_catenate_string(
21794
21795  mtr_t* mtr,
21796  const unsigned char* str,
21797  ulint len);
21798
21799
21800 static inline
21801 void
21802 mlog_catenate_ulint_compressed(
21803
21804  mtr_t* mtr,
21805  ulint val);
21806
21807
21808 static inline
21809 void
21810 mlog_catenate_dulint_compressed(
21811
21812  mtr_t* mtr,
21813  dulint val);
21814
21815
21816 static inline
21817 unsigned char*
21818 mlog_open(
21819
21820
21821  mtr_t* mtr,
21822  ulint size);
21823
21824
21825
21826 static inline
21827 void
21828 mlog_close(
21829
21830  mtr_t* mtr,
21831  unsigned char* ptr);
21832
21833
21834
21835
21836 static inline
21837 unsigned char*
21838 mlog_write_initial_log_record_fast(
21839
21840
21841  unsigned char* ptr,
21842
21843  unsigned char type,
21844  unsigned char* log_ptr,
21845  mtr_t* mtr);
21846
21847
21848
21849 unsigned char*
21850 mlog_parse_initial_log_record(
21851
21852
21853
21854  unsigned char* ptr,
21855  unsigned char* end_ptr,
21856  unsigned char* type,
21857  ulint* space,
21858  ulint* page_no);
21859
21860
21861
21862 unsigned char*
21863 mlog_parse_nbytes(
21864
21865
21866
21867  ulint type,
21868  unsigned char* ptr,
21869  unsigned char* end_ptr,
21870  unsigned char* page);
21871
21872
21873
21874 unsigned char*
21875 mlog_parse_string(
21876
21877
21878
21879  unsigned char* ptr,
21880  unsigned char* end_ptr,
21881  unsigned char* page);
21882 # 183 "./include/mtr0log.h"
21883 unsigned char*
21884 mlog_open_and_write_index(
21885
21886
21887
21888  mtr_t* mtr,
21889  unsigned char* rec,
21890  dict_index_t* index,
21891  unsigned char type,
21892  ulint size);
21893
21894
21895
21896
21897
21898 unsigned char*
21899 mlog_parse_index(
21900
21901
21902
21903  unsigned char* ptr,
21904  unsigned char* end_ptr,
21905
21906  ulint comp,
21907  dict_index_t** index);
21908
21909
21910
21911
21912
21913
21914 # 1 "./include/mtr0log.ic" 1
21915 # 15 "./include/mtr0log.ic"
21916 static inline
21917 unsigned char*
21918 mlog_open(
21919
21920
21921  mtr_t* mtr,
21922  ulint size)
21923
21924 {
21925  dyn_array_t* mlog;
21926
21927  mtr->modifications = (1);
21928
21929  if (mtr_get_log_mode(mtr) == 22) {
21930
21931   return(((void *)0));
21932  }
21933
21934  mlog = &(mtr->log);
21935
21936  return(dyn_array_open(mlog, size));
21937 }
21938
21939
21940
21941 static inline
21942 void
21943 mlog_close(
21944
21945  mtr_t* mtr,
21946  unsigned char* ptr)
21947 {
21948  dyn_array_t* mlog;
21949
21950  ;
21951
21952  mlog = &(mtr->log);
21953
21954  dyn_array_close(mlog, ptr);
21955 }
21956
21957
21958
21959 static inline
21960 void
21961 mlog_catenate_ulint(
21962
21963  mtr_t* mtr,
21964  ulint val,
21965  ulint type)
21966 {
21967  dyn_array_t* mlog;
21968  unsigned char* ptr;
21969
21970  if (mtr_get_log_mode(mtr) == 22) {
21971
21972   return;
21973  }
21974
21975  mlog = &(mtr->log);
21976
21977  ;
21978  ;
21979  ;
21980
21981  ptr = dyn_array_push(mlog, type);
21982
21983  if (type == ((unsigned char)4)) {
21984   mach_write_to_4(ptr, val);
21985  } else if (type == ((unsigned char)2)) {
21986   mach_write_to_2(ptr, val);
21987  } else {
21988   ;
21989   mach_write_to_1(ptr, val);
21990   }
21991 }
21992
21993
21994
21995 static inline
21996 void
21997 mlog_catenate_ulint_compressed(
21998
21999  mtr_t* mtr,
22000  ulint val)
22001 {
22002  unsigned char* log_ptr;
22003
22004  log_ptr = mlog_open(mtr, 10);
22005
22006
22007  if (log_ptr == ((void *)0)) {
22008
22009   return;
22010  }
22011
22012  log_ptr += mach_write_compressed(log_ptr, val);
22013
22014  mlog_close(mtr, log_ptr);
22015 }
22016
22017
22018
22019 static inline
22020 void
22021 mlog_catenate_dulint_compressed(
22022
22023  mtr_t* mtr,
22024  dulint val)
22025 {
22026  unsigned char* log_ptr;
22027
22028  log_ptr = mlog_open(mtr, 15);
22029
22030
22031  if (log_ptr == ((void *)0)) {
22032
22033   return;
22034  }
22035
22036  log_ptr += mach_dulint_write_compressed(log_ptr, val);
22037
22038  mlog_close(mtr, log_ptr);
22039 }
22040
22041
22042
22043
22044
22045 static inline
22046 unsigned char*
22047 mlog_write_initial_log_record_fast(
22048
22049
22050  unsigned char* ptr,
22051
22052  unsigned char type,
22053  unsigned char* log_ptr,
22054  mtr_t* mtr)
22055 {
22056  buf_block_t* block;
22057  ulint space;
22058  ulint offset;
22059
22060  ;
22061
22062  ;
22063  ;
22064
22065  block = buf_block_align(ptr);
22066
22067  space = buf_block_get_space(block);
22068  offset = buf_block_get_page_no(block);
22069
22070  mach_write_to_1(log_ptr, type);
22071  log_ptr++;
22072  log_ptr += mach_write_compressed(log_ptr, space);
22073  log_ptr += mach_write_compressed(log_ptr, offset);
22074
22075  mtr->n_log_recs++;
22076 # 190 "./include/mtr0log.ic"
22077  return(log_ptr);
22078 }
22079
22080
22081
22082 static inline
22083 unsigned char*
22084 mlog_write_initial_log_record_for_file_op(
22085
22086
22087  ulint type,
22088
22089  ulint space_id,
22090  ulint page_no,
22091  unsigned char* log_ptr,
22092  mtr_t* mtr)
22093 {
22094  ;
22095
22096  mach_write_to_1(log_ptr, type);
22097  log_ptr++;
22098
22099
22100  log_ptr += mach_write_compressed(log_ptr, space_id);
22101  log_ptr += mach_write_compressed(log_ptr, page_no);
22102
22103  mtr->n_log_recs++;
22104
22105  return(log_ptr);
22106 }
22107 # 215 "./include/mtr0log.h" 2
22108 # 17 "./include/trx0sys.h" 2
22109
22110
22111
22112
22113
22114
22115 # 1 "./include/fut0lst.h" 1
22116 # 22 "./include/fut0lst.h"
22117 typedef unsigned char flst_base_node_t;
22118 typedef unsigned char flst_node_t;
22119 # 34 "./include/fut0lst.h"
22120 static inline
22121 void
22122 flst_init(
22123
22124  flst_base_node_t* base,
22125  mtr_t* mtr);
22126
22127
22128
22129 void
22130 flst_add_last(
22131
22132  flst_base_node_t* base,
22133  flst_node_t* node,
22134  mtr_t* mtr);
22135
22136
22137
22138 void
22139 flst_add_first(
22140
22141  flst_base_node_t* base,
22142  flst_node_t* node,
22143  mtr_t* mtr);
22144
22145
22146
22147 void
22148 flst_insert_after(
22149
22150  flst_base_node_t* base,
22151  flst_node_t* node1,
22152  flst_node_t* node2,
22153  mtr_t* mtr);
22154
22155
22156
22157 void
22158 flst_insert_before(
22159
22160  flst_base_node_t* base,
22161  flst_node_t* node2,
22162  flst_node_t* node3,
22163  mtr_t* mtr);
22164
22165
22166
22167 void
22168 flst_remove(
22169
22170  flst_base_node_t* base,
22171  flst_node_t* node2,
22172  mtr_t* mtr);
22173
22174
22175
22176
22177
22178 void
22179 flst_cut_end(
22180
22181  flst_base_node_t* base,
22182  flst_node_t* node2,
22183  ulint n_nodes,
22184
22185  mtr_t* mtr);
22186
22187
22188
22189
22190
22191 void
22192 flst_truncate_end(
22193
22194  flst_base_node_t* base,
22195  flst_node_t* node2,
22196  ulint n_nodes,
22197  mtr_t* mtr);
22198
22199
22200 static inline
22201 ulint
22202 flst_get_len(
22203
22204
22205  flst_base_node_t* base,
22206  mtr_t* mtr);
22207
22208
22209 static inline
22210 fil_addr_t
22211 flst_get_first(
22212
22213
22214  flst_base_node_t* base,
22215  mtr_t* mtr);
22216
22217
22218 static inline
22219 fil_addr_t
22220 flst_get_last(
22221
22222
22223  flst_base_node_t* base,
22224  mtr_t* mtr);
22225
22226
22227 static inline
22228 fil_addr_t
22229 flst_get_next_addr(
22230
22231
22232  flst_node_t* node,
22233  mtr_t* mtr);
22234
22235
22236 static inline
22237 fil_addr_t
22238 flst_get_prev_addr(
22239
22240
22241  flst_node_t* node,
22242  mtr_t* mtr);
22243
22244
22245 static inline
22246 void
22247 flst_write_addr(
22248
22249  fil_faddr_t* faddr,
22250  fil_addr_t addr,
22251  mtr_t* mtr);
22252
22253
22254 static inline
22255 fil_addr_t
22256 flst_read_addr(
22257
22258
22259  fil_faddr_t* faddr,
22260  mtr_t* mtr);
22261
22262
22263
22264 ulint
22265 flst_validate(
22266
22267
22268  flst_base_node_t* base,
22269  mtr_t* mtr1);
22270
22271
22272
22273 void
22274 flst_print(
22275
22276  flst_base_node_t* base,
22277  mtr_t* mtr);
22278
22279
22280
22281 # 1 "./include/fut0lst.ic" 1
22282 # 9 "./include/fut0lst.ic"
22283 # 1 "./include/fut0fut.h" 1
22284 # 20 "./include/fut0fut.h"
22285 static inline
22286 unsigned char*
22287 fut_get_ptr(
22288
22289
22290
22291  ulint space,
22292  fil_addr_t addr,
22293  ulint rw_latch,
22294  mtr_t* mtr);
22295
22296
22297 # 1 "./include/fut0fut.ic" 1
22298 # 14 "./include/fut0fut.ic"
22299 static inline
22300 unsigned char*
22301 fut_get_ptr(
22302
22303
22304
22305  ulint space,
22306  fil_addr_t addr,
22307  ulint rw_latch,
22308  mtr_t* mtr)
22309 {
22310  unsigned char* ptr;
22311
22312  ;
22313  ;
22314  ;
22315
22316  ptr = buf_page_get_gen( space, addr.page, rw_latch, ((void *)0), 10, "./include/fut0fut.ic", 31, mtr) + addr.boffset;
22317
22318
22319
22320
22321
22322  return(ptr);
22323 }
22324 # 33 "./include/fut0fut.h" 2
22325 # 10 "./include/fut0lst.ic" 2
22326 # 31 "./include/fut0lst.ic"
22327 static inline
22328 void
22329 flst_write_addr(
22330
22331  fil_faddr_t* faddr,
22332  fil_addr_t addr,
22333  mtr_t* mtr)
22334 {
22335  ;
22336  ;
22337
22338
22339  mlog_write_ulint(faddr + 0, addr.page, ((unsigned char)4), mtr);
22340  mlog_write_ulint(faddr + 4, addr.boffset,
22341        ((unsigned char)2), mtr);
22342 }
22343
22344
22345
22346 static inline
22347 fil_addr_t
22348 flst_read_addr(
22349
22350
22351  fil_faddr_t* faddr,
22352  mtr_t* mtr)
22353 {
22354  fil_addr_t addr;
22355
22356  ;
22357
22358  addr.page = mtr_read_ulint(faddr + 0, ((unsigned char)4), mtr);
22359  addr.boffset = mtr_read_ulint(faddr + 4, ((unsigned char)2),
22360         mtr);
22361  return(addr);
22362 }
22363
22364
22365
22366 static inline
22367 void
22368 flst_init(
22369
22370  flst_base_node_t* base,
22371  mtr_t* mtr)
22372 {
22373  ;
22374
22375  mlog_write_ulint(base + 0, 0, ((unsigned char)4), mtr);
22376  flst_write_addr(base + 4, fil_addr_null, mtr);
22377  flst_write_addr(base + (4 + 6), fil_addr_null, mtr);
22378 }
22379
22380
22381
22382 static inline
22383 ulint
22384 flst_get_len(
22385
22386
22387  flst_base_node_t* base,
22388  mtr_t* mtr)
22389 {
22390  return(mtr_read_ulint(base + 0, ((unsigned char)4), mtr));
22391 }
22392
22393
22394
22395 static inline
22396 fil_addr_t
22397 flst_get_first(
22398
22399
22400  flst_base_node_t* base,
22401  mtr_t* mtr)
22402 {
22403  return(flst_read_addr(base + 4, mtr));
22404 }
22405
22406
22407
22408 static inline
22409 fil_addr_t
22410 flst_get_last(
22411
22412
22413  flst_base_node_t* base,
22414  mtr_t* mtr)
22415 {
22416  return(flst_read_addr(base + (4 + 6), mtr));
22417 }
22418
22419
22420
22421 static inline
22422 fil_addr_t
22423 flst_get_next_addr(
22424
22425
22426  flst_node_t* node,
22427  mtr_t* mtr)
22428 {
22429  return(flst_read_addr(node + 6, mtr));
22430 }
22431
22432
22433
22434 static inline
22435 fil_addr_t
22436 flst_get_prev_addr(
22437
22438
22439  flst_node_t* node,
22440  mtr_t* mtr)
22441 {
22442  return(flst_read_addr(node + 0, mtr));
22443 }
22444 # 196 "./include/fut0lst.h" 2
22445 # 24 "./include/trx0sys.h" 2
22446 # 1 "./include/fsp0fsp.h" 1
22447 # 34 "./include/fsp0fsp.h"
22448 typedef unsigned char fseg_header_t;
22449 # 45 "./include/fsp0fsp.h"
22450 void
22451 fsp_init(void);
22452
22453
22454
22455
22456
22457
22458
22459 ulint
22460 fsp_header_get_free_limit(
22461
22462
22463  ulint space);
22464
22465
22466
22467
22468
22469 ulint
22470 fsp_header_get_tablespace_size(
22471
22472
22473  ulint space);
22474
22475
22476
22477 ulint
22478 fsp_get_size_low(
22479
22480
22481  ib_page_t* page);
22482
22483
22484
22485 ulint
22486 fsp_header_get_space_id(
22487
22488
22489         ib_page_t* page);
22490
22491
22492
22493
22494 void
22495 fsp_header_write_space_id(
22496
22497  ib_page_t* page,
22498  ulint space_id);
22499
22500
22501
22502
22503 void
22504 fsp_header_init(
22505
22506  ulint space,
22507  ulint size,
22508  mtr_t* mtr);
22509
22510
22511
22512 void
22513 fsp_header_inc_size(
22514
22515  ulint space,
22516  ulint size_inc,
22517  mtr_t* mtr);
22518
22519
22520
22521 ib_page_t*
22522 fseg_create(
22523
22524
22525
22526
22527  ulint space,
22528  ulint page,
22529
22530
22531
22532  ulint byte_offset,
22533
22534  mtr_t* mtr);
22535
22536
22537
22538 ib_page_t*
22539 fseg_create_general(
22540
22541
22542
22543
22544  ulint space,
22545  ulint page,
22546
22547
22548
22549  ulint byte_offset,
22550
22551  ulint has_done_reservation,
22552
22553
22554
22555
22556
22557  mtr_t* mtr);
22558
22559
22560
22561
22562 ulint
22563 fseg_n_reserved_pages(
22564
22565
22566  fseg_header_t* header,
22567  ulint* used,
22568  mtr_t* mtr);
22569
22570
22571
22572
22573
22574 ulint
22575 fseg_alloc_free_page(
22576
22577
22578
22579  fseg_header_t* seg_header,
22580  ulint hint,
22581  unsigned char direction,
22582
22583
22584
22585
22586  mtr_t* mtr);
22587
22588
22589
22590
22591
22592 ulint
22593 fseg_alloc_free_page_general(
22594
22595
22596
22597  fseg_header_t* seg_header,
22598  ulint hint,
22599  unsigned char direction,
22600
22601
22602
22603
22604  ulint has_done_reservation,
22605
22606
22607
22608
22609  mtr_t* mtr);
22610 # 231 "./include/fsp0fsp.h"
22611 ulint
22612 fsp_reserve_free_extents(
22613
22614
22615         ulint* n_reserved,
22616
22617
22618  ulint space,
22619  ulint n_ext,
22620  ulint alloc_type,
22621  mtr_t* mtr);
22622
22623
22624
22625
22626
22627
22628 ullint
22629 fsp_get_available_space_in_free_extents(
22630
22631
22632  ulint space);
22633
22634
22635
22636 void
22637 fseg_free_page(
22638
22639  fseg_header_t* seg_header,
22640  ulint space,
22641  ulint page,
22642  mtr_t* mtr);
22643
22644
22645
22646
22647 void
22648 fseg_free(
22649
22650  ulint space,
22651  ulint page_no,
22652
22653  ulint offset);
22654
22655
22656
22657
22658
22659
22660
22661 ulint
22662 fseg_free_step(
22663
22664
22665  fseg_header_t* header,
22666
22667
22668
22669  mtr_t* mtr);
22670
22671
22672
22673
22674 ulint
22675 fseg_free_step_not_header(
22676
22677
22678
22679  fseg_header_t* header,
22680
22681  mtr_t* mtr);
22682
22683
22684 static inline
22685 ulint
22686 fsp_descr_page(
22687
22688
22689  ulint page_no);
22690
22691
22692
22693 unsigned char*
22694 fsp_parse_init_file_page(
22695
22696
22697  unsigned char* ptr,
22698  unsigned char* end_ptr,
22699  ib_page_t* page);
22700
22701
22702
22703 ulint
22704 fsp_validate(
22705
22706
22707  ulint space);
22708
22709
22710
22711 void
22712 fsp_print(
22713
22714  ulint space);
22715
22716
22717
22718 ulint
22719 fseg_validate(
22720
22721
22722  fseg_header_t* header,
22723  mtr_t* mtr2);
22724
22725
22726
22727 void
22728 fseg_print(
22729
22730  fseg_header_t* header,
22731  mtr_t* mtr);
22732 # 384 "./include/fsp0fsp.h"
22733 # 1 "./include/fsp0fsp.ic" 1
22734 # 11 "./include/fsp0fsp.ic"
22735 static inline
22736 ulint
22737 fsp_descr_page(
22738
22739
22740  ulint page_no)
22741 {
22742  if (page_no % (2 * 8192) == 0) {
22743
22744   return((1));
22745  }
22746
22747  return((0));
22748 }
22749 # 385 "./include/fsp0fsp.h" 2
22750 # 25 "./include/trx0sys.h" 2
22751 # 1 "./include/read0types.h" 1
22752 # 12 "./include/read0types.h"
22753 typedef struct read_view_struct read_view_t;
22754 typedef struct cursor_view_struct cursor_view_t;
22755 # 26 "./include/trx0sys.h" 2
22756
22757
22758
22759
22760
22761
22762 extern char trx_sys_mysql_master_log_name[];
22763 extern ib_longlong trx_sys_mysql_master_log_pos;
22764
22765
22766
22767
22768
22769
22770 extern char trx_sys_mysql_bin_log_name[];
22771 extern ib_longlong trx_sys_mysql_bin_log_pos;
22772
22773
22774 extern trx_sys_t* trx_sys;
22775
22776
22777 extern trx_doublewrite_t* trx_doublewrite;
22778 extern ulint trx_doublewrite_must_reset_space_ids;
22779 extern ulint trx_sys_multiple_tablespace_format;
22780
22781
22782
22783
22784
22785 void
22786 trx_sys_create_doublewrite_buf(void);
22787 # 66 "./include/trx0sys.h"
22788 void
22789 trx_sys_doublewrite_init_or_restore_pages(
22790
22791  ulint restore_corrupt_pages);
22792
22793
22794
22795
22796 void
22797 trx_sys_mark_upgraded_to_multiple_tablespaces(void);
22798
22799
22800
22801
22802 ulint
22803 trx_doublewrite_page_inside(
22804
22805
22806
22807  ulint page_no);
22808
22809
22810 static inline
22811 ulint
22812 trx_sys_hdr_page(
22813
22814
22815  ulint space,
22816  ulint page_no);
22817
22818
22819
22820
22821 void
22822 trx_sys_init_at_db_start(void);
22823
22824
22825
22826
22827 void
22828 trx_sys_create(void);
22829
22830
22831
22832
22833 void
22834 trx_sys_create_extra_rseg(
22835
22836  ulint num);
22837
22838
22839
22840 ulint
22841 trx_sysf_rseg_find_free(
22842
22843
22844
22845  mtr_t* mtr);
22846
22847
22848 static inline
22849 trx_rseg_t*
22850 trx_sys_get_nth_rseg(
22851
22852
22853
22854  trx_sys_t* sys,
22855  ulint n);
22856
22857
22858 static inline
22859 void
22860 trx_sys_set_nth_rseg(
22861
22862  trx_sys_t* sys,
22863  ulint n,
22864  trx_rseg_t* rseg);
22865
22866
22867
22868 static inline
22869 trx_sysf_t*
22870 trx_sysf_get(
22871
22872
22873  mtr_t* mtr);
22874
22875
22876
22877 static inline
22878 ulint
22879 trx_sysf_rseg_get_space(
22880
22881
22882  trx_sysf_t* sys_header,
22883  ulint i,
22884  mtr_t* mtr);
22885
22886
22887
22888 static inline
22889 ulint
22890 trx_sysf_rseg_get_page_no(
22891
22892
22893
22894  trx_sysf_t* sys_header,
22895  ulint i,
22896  mtr_t* mtr);
22897
22898
22899
22900 static inline
22901 void
22902 trx_sysf_rseg_set_space(
22903
22904  trx_sysf_t* sys_header,
22905  ulint i,
22906  ulint space,
22907  mtr_t* mtr);
22908
22909
22910
22911 static inline
22912 void
22913 trx_sysf_rseg_set_page_no(
22914
22915  trx_sysf_t* sys_header,
22916  ulint i,
22917  ulint page_no,
22918
22919  mtr_t* mtr);
22920
22921
22922 static inline
22923 dulint
22924 trx_sys_get_new_trx_id(void);
22925
22926
22927
22928
22929 static inline
22930 dulint
22931 trx_sys_get_new_trx_no(void);
22932
22933
22934
22935
22936
22937
22938 static inline
22939 void
22940 trx_write_trx_id(
22941
22942  unsigned char* ptr,
22943  dulint id);
22944
22945
22946
22947
22948 static inline
22949 dulint
22950 trx_read_trx_id(
22951
22952
22953  unsigned char* ptr);
22954
22955
22956 static inline
22957 trx_t*
22958 trx_get_on_id(
22959
22960
22961  dulint trx_id);
22962
22963
22964
22965
22966
22967 static inline
22968 dulint
22969 trx_list_get_min_trx_id(void);
22970
22971
22972
22973
22974
22975 static inline
22976 ulint
22977 trx_is_active(
22978
22979
22980  dulint trx_id);
22981
22982
22983
22984 ulint
22985 trx_in_trx_list(
22986
22987
22988  trx_t* in_trx);
22989
22990
22991
22992
22993
22994
22995 void
22996 trx_sys_update_mysql_binlog_offset(
22997
22998  const char* file_name,
22999  ib_longlong offset,
23000  ulint field,
23001
23002  mtr_t* mtr);
23003
23004
23005
23006
23007 void
23008 trx_sys_print_mysql_binlog_offset(void);
23009 # 303 "./include/trx0sys.h"
23010 void
23011 trx_sys_print_mysql_master_log_pos(void);
23012 # 403 "./include/trx0sys.h"
23013 struct trx_doublewrite_struct{
23014  ib_mutex_t mutex;
23015
23016  ulint block1;
23017
23018  ulint block2;
23019  ulint first_free;
23020
23021  unsigned char* write_buf;
23022
23023
23024
23025  unsigned char* write_buf_unaligned;
23026  buf_block_t**
23027   buf_block_arr;
23028
23029 };
23030
23031
23032
23033 struct trx_sys_struct{
23034  dulint max_trx_id;
23035
23036
23037  struct { ulint count; trx_t * start; trx_t * end; } trx_list;
23038
23039
23040
23041  struct { ulint count; trx_t * start; trx_t * end; } mysql_trx_list;
23042
23043
23044  struct { ulint count; trx_rseg_t * start; trx_rseg_t * end; } rseg_list;
23045
23046  trx_rseg_t* latest_rseg;
23047
23048
23049  trx_rseg_t* rseg_array[256];
23050
23051
23052  ulint rseg_history_len;
23053
23054
23055
23056  struct { ulint count; read_view_t * start; read_view_t * end; } view_list;
23057
23058
23059 };
23060
23061
23062
23063
23064
23065
23066
23067 # 1 "./include/trx0sys.ic" 1
23068 # 9 "./include/trx0sys.ic"
23069 # 1 "./include/srv0srv.h" 1
23070 # 19 "./include/srv0srv.h"
23071 extern const char* srv_main_thread_op_info;
23072
23073
23074
23075 extern os_event_t srv_lock_timeout_thread_event;
23076
23077
23078
23079
23080
23081
23082 extern ulint srv_slow_log;
23083
23084
23085 extern ulint srv_lower_case_table_names;
23086
23087
23088 extern ib_mutex_t srv_monitor_file_mutex;
23089
23090 extern FILE* srv_monitor_file;
23091
23092
23093
23094 extern ib_mutex_t srv_dict_tmpfile_mutex;
23095
23096 extern FILE* srv_dict_tmpfile;
23097
23098
23099
23100 extern ib_mutex_t srv_misc_tmpfile_mutex;
23101
23102 extern FILE* srv_misc_tmpfile;
23103
23104
23105
23106 extern char* srv_data_home;
23107
23108
23109
23110
23111 extern ulint srv_file_per_table;
23112 extern ulint srv_locks_unsafe_for_binlog;
23113
23114 extern ulint srv_n_data_files;
23115 extern char** srv_data_file_names;
23116 extern ulint* srv_data_file_sizes;
23117 extern ulint* srv_data_file_is_raw_partition;
23118
23119 extern ulint srv_auto_extend_last_data_file;
23120 extern ulint srv_last_file_size_max;
23121 extern ulong srv_auto_extend_increment;
23122
23123 extern ulint srv_created_new_raw;
23124
23125
23126
23127
23128 extern char** srv_log_group_home_dirs;
23129
23130 extern ulint srv_n_log_groups;
23131 extern ulint srv_n_log_files;
23132 extern ulint srv_log_file_size;
23133 extern ulint srv_log_buffer_size;
23134 extern ulong srv_flush_log_at_trx_commit;
23135 extern ulong srv_show_locks_held;
23136 extern ulong srv_show_verbose_locks;
23137
23138 extern unsigned char srv_latin1_ordering[256];
23139
23140 extern ulint srv_pool_size;
23141 extern ulint srv_awe_window_size;
23142 extern ulint srv_mem_pool_size;
23143 extern ulint srv_lock_table_size;
23144
23145 extern ulint srv_thread_concurrency_timer_based;
23146
23147 extern ulint srv_n_file_io_threads;
23148 extern ulint srv_n_read_io_threads;
23149 extern ulint srv_n_write_io_threads;
23150
23151
23152
23153
23154
23155
23156
23157 extern ulint srv_lock_wait_timeout;
23158
23159 extern char* srv_file_flush_method_str;
23160 extern ulint srv_unix_file_flush_method;
23161 extern ulint srv_win_file_flush_method;
23162
23163 extern ulint srv_max_n_open_files;
23164
23165 extern ulint srv_max_dirty_pages_pct;
23166
23167 extern ulint srv_force_recovery;
23168 extern ulong srv_thread_concurrency;
23169 extern ulong srv_commit_concurrency;
23170
23171 extern ulint srv_max_n_threads;
23172
23173 extern lint srv_conc_n_threads;
23174
23175 extern ulint srv_fast_shutdown;
23176
23177
23178
23179
23180
23181
23182 extern ulint srv_innodb_status;
23183
23184 extern ulint srv_use_doublewrite_buf;
23185 extern ulint srv_use_checksums;
23186
23187 extern ulint srv_set_thread_priorities;
23188 extern int srv_query_thread_priority;
23189
23190 extern ulong srv_max_buf_pool_modified_pct;
23191 extern ulong srv_max_purge_lag;
23192 extern ulint srv_use_awe;
23193 extern ulint srv_use_adaptive_hash_indexes;
23194
23195 extern ulint srv_io_capacity;
23196 extern long long srv_ibuf_max_size;
23197 extern ulint srv_ibuf_active_contract;
23198 extern ulint srv_ibuf_accel_rate;
23199 extern ulint srv_flush_neighbor_pages;
23200 extern ulint srv_enable_unsafe_group_commit;
23201 extern uint srv_read_ahead;
23202 extern ulint srv_adaptive_checkpoint;
23203
23204 extern ulint srv_extra_rsegments;
23205
23206 extern ulint srv_dict_size_limit;
23207
23208 extern volatile ulint srv_io_pattern;
23209 extern ulong srv_io_pattern_trace;
23210 extern ulong srv_io_pattern_trace_running;
23211 extern ulong srv_io_pattern_size_limit;
23212
23213
23214 extern ulint srv_n_rows_inserted;
23215 extern ulint srv_n_rows_updated;
23216 extern ulint srv_n_rows_deleted;
23217 extern ulint srv_n_rows_read;
23218
23219 extern ulint srv_print_innodb_monitor;
23220 extern ulint srv_print_innodb_lock_monitor;
23221 extern ulint srv_print_innodb_tablespace_monitor;
23222 extern ulint srv_print_verbose_log;
23223 extern ulint srv_print_innodb_table_monitor;
23224
23225 extern ulint srv_lock_timeout_and_monitor_active;
23226 extern ulint srv_error_monitor_active;
23227
23228 extern ulong srv_n_spin_wait_rounds;
23229 extern ulong srv_n_free_tickets_to_enter;
23230 extern ulong srv_thread_sleep_delay;
23231 extern ulint srv_spin_wait_delay;
23232 extern ulint srv_priority_boost;
23233
23234 extern ulint srv_pool_size;
23235 extern ulint srv_mem_pool_size;
23236 extern ulint srv_lock_table_size;
23237
23238 extern ulint srv_sim_disk_wait_pct;
23239 extern ulint srv_sim_disk_wait_len;
23240 extern ulint srv_sim_disk_wait_by_yield;
23241 extern ulint srv_sim_disk_wait_by_wait;
23242
23243 extern ulint srv_measure_contention;
23244 extern ulint srv_measure_by_spin;
23245
23246 extern ulint srv_print_thread_releases;
23247 extern ulint srv_print_lock_waits;
23248 extern ulint srv_print_buf_io;
23249 extern ulint srv_print_log_io;
23250 extern ulint srv_print_parsed_sql;
23251 extern ulint srv_print_latch_waits;
23252
23253 extern ulint srv_test_nocache;
23254 extern ulint srv_test_cache_evict;
23255
23256 extern ulint srv_test_extra_mutexes;
23257 extern ulint srv_test_sync;
23258 extern ulint srv_test_n_threads;
23259 extern ulint srv_test_n_loops;
23260 extern ulint srv_test_n_free_rnds;
23261 extern ulint srv_test_n_reserved_rnds;
23262 extern ulint srv_test_n_mutexes;
23263 extern ulint srv_test_array_size;
23264
23265 extern ulint srv_activity_count;
23266 extern ulint srv_fatal_semaphore_wait_threshold;
23267 extern ulint srv_dml_needed_delay;
23268
23269 extern ib_mutex_t* kernel_mutex_temp;
23270 # 227 "./include/srv0srv.h"
23271 extern const char* srv_io_thread_op_info[];
23272 extern const char* srv_io_thread_function[];
23273
23274
23275 extern ulint srv_log_write_requests;
23276
23277
23278 extern ulint srv_log_writes;
23279
23280
23281 extern ulint srv_os_log_written;
23282
23283
23284 extern ulint srv_os_log_pending_writes;
23285
23286
23287
23288 extern ulint srv_log_waits;
23289
23290
23291 extern ulint srv_data_read;
23292
23293
23294 extern ulint srv_data_written;
23295
23296
23297
23298 extern ulint srv_dblwr_writes;
23299
23300
23301
23302 extern ulint srv_dblwr_pages_written;
23303
23304
23305 extern ulint srv_buf_pool_write_requests;
23306
23307
23308
23309
23310 extern ulint srv_buf_pool_wait_free;
23311
23312
23313
23314 extern ulint srv_buf_pool_flushed;
23315
23316
23317
23318 extern ulint srv_buf_pool_reads;
23319
23320
23321 extern ulint srv_read_ahead_seq;
23322
23323
23324 extern ulint srv_read_ahead_rnd;
23325
23326
23327
23328
23329
23330 extern char srv_use_legacy_cardinality_algorithm;
23331
23332
23333 typedef struct export_var_struct export_struc;
23334
23335 extern export_struc export_vars;
23336
23337 typedef struct srv_sys_struct srv_sys_t;
23338
23339
23340 extern srv_sys_t* srv_sys;
23341 # 338 "./include/srv0srv.h"
23342 ulint
23343 srv_boot(void);
23344
23345
23346
23347
23348
23349 void
23350 srv_init(void);
23351
23352
23353
23354
23355 void
23356 srv_free(void);
23357
23358
23359
23360
23361
23362 void
23363 srv_general_init(void);
23364
23365
23366
23367
23368 ulint
23369 srv_get_n_threads(void);
23370
23371
23372
23373
23374 ulint
23375 srv_get_thread_type(void);
23376
23377
23378
23379
23380
23381 void
23382 srv_set_io_thread_op_info(
23383
23384  ulint i,
23385  const char* str);
23386
23387
23388
23389
23390
23391 ulint
23392 srv_release_threads(
23393
23394
23395
23396
23397  ulint type,
23398  ulint n);
23399
23400
23401
23402
23403 void*
23404
23405
23406
23407 srv_master_thread(
23408
23409
23410  void* arg);
23411 # 415 "./include/srv0srv.h"
23412 void
23413 srv_active_wake_master_thread(void);
23414
23415
23416
23417
23418 void
23419 srv_wake_master_thread(void);
23420
23421
23422
23423
23424
23425 void
23426 srv_conc_enter_innodb(
23427
23428  trx_t* trx);
23429
23430
23431
23432
23433
23434 void
23435 srv_conc_force_enter_innodb(
23436
23437  trx_t* trx);
23438
23439
23440
23441
23442
23443 void
23444 srv_conc_force_exit_innodb(
23445
23446  trx_t* trx);
23447
23448
23449
23450
23451 void
23452 srv_conc_exit_innodb(
23453
23454  trx_t* trx);
23455 # 466 "./include/srv0srv.h"
23456 void
23457 srv_suspend_mysql_thread(
23458
23459  que_thr_t* thr);
23460
23461
23462
23463
23464
23465 void
23466 srv_release_mysql_thread_if_suspended(
23467
23468  que_thr_t* thr);
23469
23470
23471
23472
23473
23474
23475 void*
23476
23477
23478
23479 srv_lock_timeout_and_monitor_thread(
23480
23481
23482  void* arg);
23483
23484
23485
23486
23487
23488
23489 void*
23490
23491
23492
23493 srv_error_monitor_thread(
23494
23495
23496  void* arg);
23497
23498
23499
23500
23501 void
23502 srv_printf_innodb_monitor(
23503
23504  FILE* file,
23505  ulint* trx_start,
23506
23507  ulint* trx_end);
23508
23509
23510
23511
23512
23513 void
23514 srv_export_innodb_status(void);
23515 # 546 "./include/srv0srv.h"
23516 typedef struct srv_slot_struct srv_slot_t;
23517
23518
23519 typedef srv_slot_t srv_table_t;
23520
23521
23522 struct export_var_struct{
23523         ulint innodb_data_pending_reads;
23524         ulint innodb_data_pending_writes;
23525         ulint innodb_data_pending_fsyncs;
23526         ulint innodb_data_fsyncs;
23527         ulint innodb_data_read;
23528         ulint innodb_data_writes;
23529         ulint innodb_data_written;
23530         ulint innodb_data_reads;
23531         ulint innodb_dict_tables;
23532         ulint innodb_buffer_pool_pages_total;
23533         ulint innodb_buffer_pool_pages_data;
23534         ulint innodb_buffer_pool_pages_dirty;
23535         ulint innodb_buffer_pool_pages_misc;
23536         ulint innodb_buffer_pool_pages_free;
23537
23538
23539
23540         ulint innodb_buffer_pool_read_requests;
23541         ulint innodb_buffer_pool_reads;
23542         ulint innodb_buffer_pool_wait_free;
23543         ulint innodb_buffer_pool_pages_flushed;
23544         ulint innodb_buffer_pool_write_requests;
23545         ulint innodb_buffer_pool_read_ahead_seq;
23546         ulint innodb_buffer_pool_read_ahead_rnd;
23547         ulint innodb_dblwr_pages_written;
23548         ulint innodb_dblwr_writes;
23549         ulint innodb_log_waits;
23550         ulint innodb_log_write_requests;
23551         ulint innodb_log_writes;
23552         ulint innodb_os_log_written;
23553         ulint innodb_os_log_fsyncs;
23554         ulint innodb_os_log_pending_writes;
23555         ulint innodb_os_log_pending_fsyncs;
23556         ulint innodb_page_size;
23557         ulint innodb_pages_created;
23558         ulint innodb_pages_read;
23559         ulint innodb_pages_written;
23560         ulint innodb_row_lock_waits;
23561         ulint innodb_row_lock_current_waits;
23562         ib_longlong innodb_row_lock_time;
23563         ulint innodb_row_lock_time_avg;
23564         ulint innodb_row_lock_time_max;
23565         ulint innodb_rows_read;
23566         ulint innodb_rows_inserted;
23567         ulint innodb_rows_updated;
23568         ulint innodb_rows_deleted;
23569 };
23570
23571
23572 struct srv_sys_struct{
23573  os_event_t operational;
23574
23575
23576  srv_table_t* threads;
23577  struct { ulint count; que_thr_t * start; que_thr_t * end; }
23578    tasks;
23579  dict_index_t* dummy_ind1;
23580
23581  dict_index_t* dummy_ind2;
23582
23583 };
23584
23585 extern ulint srv_n_threads_active[];
23586 # 10 "./include/trx0sys.ic" 2
23587 # 1 "./include/trx0trx.h" 1
23588 # 15 "./include/trx0trx.h"
23589 # 1 "./include/usr0types.h" 1
23590 # 12 "./include/usr0types.h"
23591 typedef struct sess_struct sess_t;
23592 # 16 "./include/trx0trx.h" 2
23593
23594
23595
23596
23597 # 1 "./include/trx0xa.h" 1
23598 # 18 "./include/trx0xa.h"
23599 struct xid_t {
23600  long formatID;
23601  long gtrid_length;
23602  long bqual_length;
23603  char data[128];
23604 };
23605 typedef struct xid_t XID;
23606 # 21 "./include/trx0trx.h" 2
23607
23608 extern ulint trx_n_mysql_transactions;
23609
23610
23611
23612 static inline
23613 void
23614 trx_reset_new_rec_lock_info(
23615
23616  trx_t* trx);
23617
23618
23619
23620
23621 static inline
23622 void
23623 trx_register_new_rec_lock(
23624
23625  trx_t* trx,
23626  dict_index_t* index);
23627
23628
23629
23630 static inline
23631 ulint
23632 trx_new_rec_locks_contain(
23633
23634
23635
23636  trx_t* trx,
23637  dict_index_t* index);
23638
23639
23640
23641 void
23642 trx_search_latch_release_if_reserved(
23643
23644         trx_t* trx);
23645
23646
23647 void
23648 trx_set_detailed_error(
23649
23650  trx_t* trx,
23651  const char* msg);
23652
23653
23654
23655
23656 void
23657 trx_set_detailed_error_from_file(
23658
23659  trx_t* trx,
23660  FILE* file);
23661
23662
23663
23664 void*
23665 trx_get_error_info(
23666
23667
23668  trx_t* trx);
23669
23670
23671
23672 trx_t*
23673 trx_create(
23674
23675
23676  sess_t* sess);
23677
23678
23679
23680 trx_t*
23681 trx_allocate_for_mysql(void);
23682
23683
23684
23685
23686
23687 trx_t*
23688 trx_allocate_for_background(void);
23689
23690
23691
23692
23693
23694 void
23695 trx_free(
23696
23697  trx_t* trx);
23698
23699
23700
23701 void
23702 trx_free_for_mysql(
23703
23704  trx_t* trx);
23705
23706
23707
23708 void
23709 trx_free_for_background(
23710
23711  trx_t* trx);
23712
23713
23714
23715
23716
23717
23718
23719 void
23720 trx_lists_init_at_db_start(void);
23721
23722
23723
23724
23725 ulint
23726 trx_start(
23727
23728
23729
23730  trx_t* trx,
23731  ulint rseg_id);
23732
23733
23734
23735
23736
23737 ulint
23738 trx_start_low(
23739
23740
23741  trx_t* trx,
23742  ulint rseg_id);
23743
23744
23745
23746
23747 static inline
23748 void
23749 trx_start_if_not_started(
23750
23751  trx_t* trx);
23752
23753
23754
23755 static inline
23756 void
23757 trx_start_if_not_started_low(
23758
23759  trx_t* trx);
23760
23761
23762
23763 void
23764 trx_start_if_not_started_noninline(
23765
23766  trx_t* trx);
23767
23768
23769
23770 void
23771 trx_commit_off_kernel(
23772
23773  trx_t* trx);
23774
23775
23776
23777
23778
23779 void
23780 trx_cleanup_at_db_startup(
23781
23782  trx_t* trx);
23783
23784
23785
23786 ulint
23787 trx_commit_for_mysql(
23788
23789
23790  trx_t* trx);
23791
23792
23793
23794 ulint
23795 trx_prepare_for_mysql(
23796
23797
23798  trx_t* trx);
23799
23800
23801
23802
23803 int
23804 trx_recover_for_mysql(
23805
23806
23807  XID* xid_list,
23808  ulint len);
23809
23810
23811
23812 trx_t *
23813 trx_get_trx_by_xid(
23814
23815
23816  XID* xid);
23817
23818
23819
23820
23821 ulint
23822 trx_commit_complete_for_mysql(
23823
23824
23825  trx_t* trx);
23826
23827
23828
23829 void
23830 trx_mark_sql_stat_end(
23831
23832  trx_t* trx);
23833
23834
23835
23836
23837
23838 read_view_t*
23839 trx_assign_read_view(
23840
23841
23842  trx_t* trx);
23843
23844
23845
23846
23847
23848 void
23849 trx_end_lock_wait(
23850
23851  trx_t* trx);
23852
23853
23854
23855 ulint
23856 trx_sig_send(
23857
23858
23859
23860  trx_t* trx,
23861  ulint type,
23862  ulint sender,
23863
23864  que_thr_t* receiver_thr,
23865
23866
23867  trx_savept_t* savept,
23868
23869  que_thr_t** next_thr);
23870 # 293 "./include/trx0trx.h"
23871 void
23872 trx_sig_reply(
23873
23874  trx_sig_t* sig,
23875  que_thr_t** next_thr);
23876
23877
23878
23879
23880
23881
23882
23883 void
23884 trx_sig_remove(
23885
23886  trx_t* trx,
23887  trx_sig_t* sig);
23888
23889
23890
23891 void
23892 trx_sig_start_handle(
23893
23894  trx_t* trx,
23895  que_thr_t** next_thr);
23896 # 328 "./include/trx0trx.h"
23897 void
23898 trx_end_signal_handling(
23899
23900  trx_t* trx);
23901
23902
23903
23904 commit_node_t*
23905 commit_node_create(
23906
23907
23908  mem_heap_t* heap);
23909
23910
23911
23912 que_thr_t*
23913 trx_commit_step(
23914
23915
23916  que_thr_t* thr);
23917
23918
23919
23920
23921
23922
23923
23924 void
23925 trx_print(
23926
23927  FILE* f,
23928  trx_t* trx,
23929  uint max_query_len);
23930
23931
23932
23933
23934
23935
23936 ulint
23937 trx_is_interrupted(
23938
23939
23940  trx_t* trx);
23941
23942
23943
23944
23945
23946
23947 struct trx_sig_struct{
23948  ulint type;
23949  ulint state;
23950
23951  ulint sender;
23952
23953  que_thr_t* receiver;
23954
23955
23956  trx_savept_t savept;
23957  struct { trx_sig_t * prev; trx_sig_t * next; }
23958    signals;
23959
23960  struct { trx_sig_t * prev; trx_sig_t * next; }
23961    reply_signals;
23962
23963 };
23964
23965
23966
23967
23968
23969
23970
23971 struct trx_struct{
23972  ulint magic_n;
23973
23974
23975  const char* op_info;
23976
23977
23978  ulint type;
23979  ulint conc_state;
23980
23981
23982
23983         time_t start_time;
23984
23985
23986  ulint isolation_level;
23987  ulint check_foreigns;
23988
23989
23990
23991  ulint check_unique_secondary;
23992
23993
23994
23995
23996
23997
23998  dulint id;
23999  XID xid;
24000
24001
24002  ulint support_xa;
24003
24004
24005
24006
24007  dulint no;
24008
24009
24010  ulint flush_log_later;
24011
24012
24013
24014  ulint must_flush_log_later;
24015
24016
24017
24018
24019
24020  dulint commit_lsn;
24021  ulint dict_operation;
24022
24023
24024
24025
24026  dulint table_id;
24027
24028
24029  int active_trans;
24030
24031
24032  void* mysql_thd;
24033
24034  char** mysql_query_str;
24035
24036
24037  const char* mysql_log_file_name;
24038
24039
24040
24041
24042  ib_longlong mysql_log_offset;
24043
24044
24045  const char* mysql_master_log_file_name;
24046
24047
24048
24049
24050
24051
24052  ib_longlong mysql_master_log_pos;
24053
24054
24055
24056
24057
24058
24059  char* repl_wait_binlog_name;
24060
24061
24062
24063
24064
24065
24066
24067  ib_longlong repl_wait_binlog_pos;
24068
24069
24070  os_thread_id_t mysql_thread_id;
24071
24072  ulint mysql_process_no;
24073
24074
24075
24076  ulint n_mysql_tables_in_use;
24077
24078
24079         ulint mysql_n_tables_locked;
24080
24081
24082
24083  ulint dict_operation_lock_mode;
24084
24085
24086
24087         ulint has_search_latch;
24088
24089
24090  ulint search_latch_timeout;
24091 # 532 "./include/trx0trx.h"
24092  ulint declared_to_be_inside_innodb;
24093
24094
24095
24096
24097  ulint n_tickets_to_enter_innodb;
24098
24099
24100
24101
24102
24103  ib_lock_t* auto_inc_lock;
24104
24105
24106  dict_index_t* new_rec_locks[2];
24107 # 558 "./include/trx0trx.h"
24108  struct { trx_t * prev; trx_t * next; }
24109    trx_list;
24110  struct { trx_t * prev; trx_t * next; }
24111    mysql_trx_list;
24112
24113
24114  ulint error_state;
24115
24116
24117
24118
24119  void* error_info;
24120
24121
24122  sess_t* sess;
24123   ulint que_state;
24124
24125  que_t* graph;
24126
24127
24128
24129
24130
24131  ulint n_active_thrs;
24132  ulint handling_signals;
24133
24134  que_t* graph_before_signal_handling;
24135
24136
24137
24138
24139  trx_sig_t sig;
24140
24141  struct { ulint count; trx_sig_t * start; trx_sig_t * end; }
24142    signals;
24143
24144  struct { ulint count; trx_sig_t * start; trx_sig_t * end; }
24145    reply_signals;
24146
24147
24148
24149
24150
24151  ib_lock_t* wait_lock;
24152
24153
24154
24155  ulint was_chosen_as_deadlock_victim;
24156
24157
24158
24159
24160
24161  time_t wait_started;
24162  struct { ulint count; que_thr_t * start; que_thr_t * end; }
24163    wait_thrs;
24164
24165
24166  ulint deadlock_mark;
24167
24168
24169  mem_heap_t* lock_heap;
24170
24171  struct { ulint count; ib_lock_t * start; ib_lock_t * end; }
24172    trx_locks;
24173
24174  mem_heap_t* global_read_view_heap;
24175
24176
24177  read_view_t* global_read_view;
24178
24179
24180  read_view_t* read_view;
24181
24182
24183
24184
24185
24186
24187  struct { ulint count; trx_named_savept_t * start; trx_named_savept_t * end; }
24188    trx_savepoints;
24189
24190
24191  ib_mutex_t undo_mutex;
24192
24193
24194
24195
24196
24197  dulint undo_no;
24198
24199  trx_savept_t last_sql_stat_start;
24200
24201
24202
24203
24204  trx_rseg_t* rseg;
24205
24206
24207  trx_undo_t* insert_undo;
24208
24209  trx_undo_t* update_undo;
24210
24211  dulint roll_limit;
24212
24213  ulint pages_undone;
24214
24215  trx_undo_arr_t* undo_no_arr;
24216
24217
24218
24219  char detailed_error[256];
24220
24221
24222  ulint io_reads;
24223  ib_longlong io_read;
24224  ulint io_reads_wait_timer;
24225  ib_longlong lock_que_wait_ustarted;
24226  ulint lock_que_wait_timer;
24227  ulint innodb_que_wait_timer;
24228  ulint distinct_page_access;
24229
24230  unsigned char* distinct_page_access_hash;
24231  ulint take_stats;
24232 };
24233 # 759 "./include/trx0trx.h"
24234 struct commit_node_struct{
24235  que_common_t common;
24236  ulint state;
24237 };
24238
24239
24240
24241
24242
24243
24244
24245 # 1 "./include/trx0trx.ic" 1
24246 # 11 "./include/trx0trx.ic"
24247 static inline
24248 void
24249 trx_start_if_not_started(
24250
24251  trx_t* trx)
24252 {
24253  ;
24254
24255  if (trx->conc_state == 1) {
24256
24257   trx_start(trx, ((ulint)(-1)));
24258  }
24259 }
24260
24261
24262
24263
24264 static inline
24265 void
24266 trx_start_if_not_started_low(
24267
24268  trx_t* trx)
24269 {
24270  ;
24271
24272  if (trx->conc_state == 1) {
24273
24274   trx_start_low(trx, ((ulint)(-1)));
24275  }
24276 }
24277
24278
24279
24280 static inline
24281 void
24282 trx_reset_new_rec_lock_info(
24283
24284  trx_t* trx)
24285 {
24286  trx->new_rec_locks[0] = ((void *)0);
24287  trx->new_rec_locks[1] = ((void *)0);
24288 }
24289
24290
24291
24292
24293
24294 static inline
24295 void
24296 trx_register_new_rec_lock(
24297
24298  trx_t* trx,
24299  dict_index_t* index)
24300
24301 {
24302  if (trx->new_rec_locks[0] == ((void *)0)) {
24303   trx->new_rec_locks[0] = index;
24304
24305   return;
24306  }
24307
24308  if (trx->new_rec_locks[0] == index) {
24309
24310   return;
24311  }
24312
24313  if (trx->new_rec_locks[1] != ((void *)0)) {
24314
24315   return;
24316  }
24317
24318  trx->new_rec_locks[1] = index;
24319 }
24320
24321
24322
24323 static inline
24324 ulint
24325 trx_new_rec_locks_contain(
24326
24327
24328
24329  trx_t* trx,
24330  dict_index_t* index)
24331 {
24332  return(trx->new_rec_locks[0] == index
24333         || trx->new_rec_locks[1] == index);
24334 }
24335 # 771 "./include/trx0trx.h" 2
24336 # 11 "./include/trx0sys.ic" 2
24337
24338
24339
24340 typedef unsigned char trx_sysf_rseg_t;
24341 # 30 "./include/trx0sys.ic"
24342 void
24343 trx_sys_flush_max_trx_id(void);
24344
24345
24346
24347
24348 static inline
24349 ulint
24350 trx_sys_hdr_page(
24351
24352
24353  ulint space,
24354  ulint page_no)
24355 {
24356  if ((space == 0) && (page_no == 5)) {
24357
24358   return((1));
24359  }
24360
24361  return((0));
24362 }
24363
24364
24365
24366 static inline
24367 trx_rseg_t*
24368 trx_sys_get_nth_rseg(
24369
24370
24371
24372  trx_sys_t* sys,
24373  ulint n)
24374 {
24375
24376
24377
24378  ;
24379
24380  return(sys->rseg_array[n]);
24381 }
24382
24383
24384
24385 static inline
24386 void
24387 trx_sys_set_nth_rseg(
24388
24389  trx_sys_t* sys,
24390  ulint n,
24391  trx_rseg_t* rseg)
24392
24393 {
24394  ;
24395
24396  sys->rseg_array[n] = rseg;
24397 }
24398
24399
24400
24401 static inline
24402 trx_sysf_t*
24403 trx_sysf_get(
24404
24405
24406  mtr_t* mtr)
24407 {
24408  trx_sysf_t* header;
24409
24410  ;
24411
24412  header = 38 + buf_page_get_gen( 0, 5, 2, ((void *)0), 10, "./include/trx0sys.ic", 101, mtr);
24413
24414
24415
24416
24417
24418
24419  return(header);
24420 }
24421
24422
24423
24424
24425 static inline
24426 ulint
24427 trx_sysf_rseg_get_space(
24428
24429
24430  trx_sysf_t* sys_header,
24431  ulint i,
24432  mtr_t* mtr)
24433 {
24434
24435
24436
24437  ;
24438  ;
24439
24440  return(mtr_read_ulint(sys_header + (8 + 10)
24441    + i * 8
24442    + 0, ((unsigned char)4), mtr));
24443 }
24444
24445
24446
24447
24448 static inline
24449 ulint
24450 trx_sysf_rseg_get_page_no(
24451
24452
24453
24454  trx_sysf_t* sys_header,
24455  ulint i,
24456  mtr_t* mtr)
24457 {
24458  ;
24459
24460
24461
24462  ;
24463
24464  return(mtr_read_ulint(sys_header + (8 + 10)
24465    + i * 8
24466    + 4, ((unsigned char)4), mtr));
24467 }
24468
24469
24470
24471
24472 static inline
24473 void
24474 trx_sysf_rseg_set_space(
24475
24476  trx_sysf_t* sys_header,
24477  ulint i,
24478  ulint space,
24479  mtr_t* mtr)
24480 {
24481
24482
24483
24484  ;
24485  ;
24486
24487  mlog_write_ulint(sys_header + (8 + 10)
24488    + i * 8
24489    + 0,
24490    space,
24491    ((unsigned char)4), mtr);
24492 }
24493
24494
24495
24496
24497 static inline
24498 void
24499 trx_sysf_rseg_set_page_no(
24500
24501  trx_sysf_t* sys_header,
24502  ulint i,
24503  ulint page_no,
24504
24505  mtr_t* mtr)
24506 {
24507
24508
24509
24510  ;
24511  ;
24512
24513  mlog_write_ulint(sys_header + (8 + 10)
24514    + i * 8
24515    + 4,
24516    page_no,
24517    ((unsigned char)4), mtr);
24518 }
24519
24520
24521
24522
24523
24524 static inline
24525 void
24526 trx_write_trx_id(
24527
24528  unsigned char* ptr,
24529  dulint id)
24530 {
24531  ;
24532
24533  mach_write_to_6(ptr, id);
24534 }
24535
24536
24537
24538
24539
24540 static inline
24541 dulint
24542 trx_read_trx_id(
24543
24544
24545  unsigned char* ptr)
24546 {
24547  ;
24548
24549  return(mach_read_from_6(ptr));
24550 }
24551
24552
24553
24554 static inline
24555 trx_t*
24556 trx_get_on_id(
24557
24558
24559  dulint trx_id)
24560 {
24561  trx_t* trx;
24562
24563
24564
24565
24566
24567  trx = (trx_sys->trx_list).start;
24568
24569  while (trx != ((void *)0)) {
24570   if (0 == ut_dulint_cmp(trx_id, trx->id)) {
24571
24572    return(trx);
24573   }
24574
24575   trx = (((trx)->trx_list).next);
24576  }
24577
24578  return(((void *)0));
24579 }
24580
24581
24582
24583
24584
24585
24586 static inline
24587 dulint
24588 trx_list_get_min_trx_id(void)
24589
24590
24591
24592 {
24593  trx_t* trx;
24594
24595
24596
24597
24598
24599  trx = (trx_sys->trx_list).end;
24600
24601  if (trx == ((void *)0)) {
24602
24603   return(trx_sys->max_trx_id);
24604  }
24605
24606  return(trx->id);
24607 }
24608
24609
24610
24611 static inline
24612 ulint
24613 trx_is_active(
24614
24615
24616  dulint trx_id)
24617 {
24618  trx_t* trx;
24619
24620
24621
24622
24623
24624  if (ut_dulint_cmp(trx_id, trx_list_get_min_trx_id()) < 0) {
24625
24626   return((0));
24627  }
24628
24629  if (ut_dulint_cmp(trx_id, trx_sys->max_trx_id) >= 0) {
24630
24631
24632
24633
24634
24635
24636   return((1));
24637  }
24638
24639  trx = trx_get_on_id(trx_id);
24640         if (trx && (trx->conc_state == 2 ||
24641                         trx->conc_state == 4)) {
24642
24643   return((1));
24644  }
24645
24646  return((0));
24647 }
24648
24649
24650
24651 static inline
24652 dulint
24653 trx_sys_get_new_trx_id(void)
24654
24655
24656 {
24657  dulint id;
24658 # 358 "./include/trx0sys.ic"
24659  if (ut_dulint_get_low(trx_sys->max_trx_id)
24660     % 256 == 0) {
24661
24662   trx_sys_flush_max_trx_id();
24663  }
24664
24665  id = trx_sys->max_trx_id;
24666
24667  { if ((trx_sys->max_trx_id).low == 0xFFFFFFFFUL) { (trx_sys->max_trx_id).high = (trx_sys->max_trx_id).high + 1; (trx_sys->max_trx_id).low = 0; } else { (trx_sys->max_trx_id).low = (trx_sys->max_trx_id).low + 1; }};
24668
24669  return(id);
24670 }
24671
24672
24673
24674 static inline
24675 dulint
24676 trx_sys_get_new_trx_no(void)
24677
24678
24679 {
24680
24681
24682
24683
24684  return(trx_sys_get_new_trx_id());
24685 }
24686 # 458 "./include/trx0sys.h" 2
24687 # 16 "./include/trx0undo.h" 2
24688
24689
24690
24691
24692
24693 static inline
24694 dulint
24695 trx_undo_build_roll_ptr(
24696
24697
24698  ulint is_insert,
24699  ulint rseg_id,
24700  ulint page_no,
24701  ulint offset);
24702
24703
24704 static inline
24705 void
24706 trx_undo_decode_roll_ptr(
24707
24708  dulint roll_ptr,
24709  ulint* is_insert,
24710  ulint* rseg_id,
24711  ulint* page_no,
24712  ulint* offset);
24713
24714
24715 static inline
24716 ulint
24717 trx_undo_roll_ptr_is_insert(
24718
24719
24720  dulint roll_ptr);
24721
24722
24723
24724
24725 static inline
24726 void
24727 trx_write_roll_ptr(
24728
24729  unsigned char* ptr,
24730  dulint roll_ptr);
24731
24732
24733
24734
24735 static inline
24736 dulint
24737 trx_read_roll_ptr(
24738
24739
24740  unsigned char* ptr);
24741
24742
24743 static inline
24744 ib_page_t*
24745 trx_undo_page_get(
24746
24747
24748  ulint space,
24749  ulint page_no,
24750  mtr_t* mtr);
24751
24752
24753 static inline
24754 ib_page_t*
24755 trx_undo_page_get_s_latched(
24756
24757
24758  ulint space,
24759  ulint page_no,
24760  mtr_t* mtr);
24761
24762
24763
24764 static inline
24765 trx_undo_rec_t*
24766 trx_undo_page_get_prev_rec(
24767
24768
24769  trx_undo_rec_t* rec,
24770  ulint page_no,
24771  ulint offset);
24772
24773
24774
24775 static inline
24776 trx_undo_rec_t*
24777 trx_undo_page_get_next_rec(
24778
24779
24780  trx_undo_rec_t* rec,
24781  ulint page_no,
24782  ulint offset);
24783
24784
24785
24786 static inline
24787 trx_undo_rec_t*
24788 trx_undo_page_get_last_rec(
24789
24790
24791  ib_page_t* undo_page,
24792  ulint page_no,
24793  ulint offset);
24794
24795
24796
24797 static inline
24798 trx_undo_rec_t*
24799 trx_undo_page_get_first_rec(
24800
24801
24802  ib_page_t* undo_page,
24803  ulint page_no,
24804  ulint offset);
24805
24806
24807
24808 trx_undo_rec_t*
24809 trx_undo_get_prev_rec(
24810
24811
24812
24813  trx_undo_rec_t* rec,
24814  ulint page_no,
24815  ulint offset,
24816  mtr_t* mtr);
24817
24818
24819
24820 trx_undo_rec_t*
24821 trx_undo_get_next_rec(
24822
24823
24824
24825  trx_undo_rec_t* rec,
24826  ulint page_no,
24827  ulint offset,
24828  mtr_t* mtr);
24829
24830
24831
24832 trx_undo_rec_t*
24833 trx_undo_get_first_rec(
24834
24835
24836
24837  ulint space,
24838  ulint page_no,
24839  ulint offset,
24840  ulint mode,
24841  mtr_t* mtr);
24842
24843
24844
24845 ulint
24846 trx_undo_add_page(
24847
24848
24849
24850  trx_t* trx,
24851  trx_undo_t* undo,
24852  mtr_t* mtr);
24853
24854
24855
24856
24857
24858
24859 void
24860 trx_undo_truncate_end(
24861
24862  trx_t* trx,
24863  trx_undo_t* undo,
24864  dulint limit);
24865
24866
24867
24868
24869
24870 void
24871 trx_undo_truncate_start(
24872
24873  trx_rseg_t* rseg,
24874  ulint space,
24875  ulint hdr_page_no,
24876  ulint hdr_offset,
24877  dulint limit);
24878 # 215 "./include/trx0undo.h"
24879 ulint
24880 trx_undo_lists_init(
24881
24882
24883
24884  trx_rseg_t* rseg);
24885
24886
24887
24888
24889 ulint
24890 trx_undo_assign_undo(
24891
24892
24893
24894
24895
24896
24897  trx_t* trx,
24898  ulint type);
24899
24900
24901
24902 ib_page_t*
24903 trx_undo_set_state_at_finish(
24904
24905
24906
24907  trx_rseg_t* rseg,
24908  trx_t* trx,
24909  trx_undo_t* undo,
24910  mtr_t* mtr);
24911
24912
24913
24914 ib_page_t*
24915 trx_undo_set_state_at_prepare(
24916
24917
24918
24919  trx_t* trx,
24920  trx_undo_t* undo,
24921  mtr_t* mtr);
24922
24923
24924
24925
24926
24927
24928 void
24929 trx_undo_update_cleanup(
24930
24931  trx_t* trx,
24932  ib_page_t* undo_page,
24933
24934  mtr_t* mtr);
24935
24936
24937
24938
24939
24940 void
24941 trx_undo_insert_cleanup(
24942
24943  trx_t* trx);
24944
24945
24946
24947 unsigned char*
24948 trx_undo_parse_page_init(
24949
24950
24951  unsigned char* ptr,
24952  unsigned char* end_ptr,
24953  ib_page_t* page,
24954  mtr_t* mtr);
24955
24956
24957
24958 unsigned char*
24959 trx_undo_parse_page_header(
24960
24961
24962  ulint type,
24963  unsigned char* ptr,
24964  unsigned char* end_ptr,
24965  ib_page_t* page,
24966  mtr_t* mtr);
24967
24968
24969
24970 unsigned char*
24971 trx_undo_parse_discard_latest(
24972
24973
24974  unsigned char* ptr,
24975  unsigned char* end_ptr,
24976  ib_page_t* page,
24977  mtr_t* mtr);
24978 # 335 "./include/trx0undo.h"
24979 struct trx_undo_struct{
24980
24981  ulint id;
24982
24983  ulint type;
24984
24985  ulint state;
24986
24987  ulint del_marks;
24988
24989
24990
24991
24992
24993
24994
24995  dulint trx_id;
24996
24997  XID xid;
24998
24999  ulint dict_operation;
25000  dulint table_id;
25001
25002  trx_rseg_t* rseg;
25003
25004  ulint space;
25005
25006  ulint hdr_page_no;
25007
25008  ulint hdr_offset;
25009
25010  ulint last_page_no;
25011
25012
25013  ulint size;
25014
25015  ulint empty;
25016
25017  ulint top_page_no;
25018
25019
25020
25021  ulint top_offset;
25022
25023
25024  dulint top_undo_no;
25025  ib_page_t* guess_page;
25026
25027
25028  struct { trx_undo_t * prev; trx_undo_t * next; } undo_list;
25029
25030
25031 };
25032 # 500 "./include/trx0undo.h"
25033 # 1 "./include/trx0undo.ic" 1
25034 # 13 "./include/trx0undo.ic"
25035 static inline
25036 dulint
25037 trx_undo_build_roll_ptr(
25038
25039
25040  ulint is_insert,
25041  ulint rseg_id,
25042  ulint page_no,
25043  ulint offset)
25044 {
25045  ;
25046  ;
25047
25048  return(ut_dulint_create(is_insert * 128 * 256 * 256
25049     + rseg_id * 256 * 256
25050     + (page_no / 256) / 256,
25051     (page_no % (256 * 256)) * 256 * 256
25052     + offset));
25053 }
25054
25055
25056
25057 static inline
25058 void
25059 trx_undo_decode_roll_ptr(
25060
25061  dulint roll_ptr,
25062  ulint* is_insert,
25063  ulint* rseg_id,
25064  ulint* page_no,
25065  ulint* offset)
25066 {
25067  ulint low;
25068  ulint high;
25069
25070  ;
25071  ;
25072
25073  high = ut_dulint_get_high(roll_ptr);
25074  low = ut_dulint_get_low(roll_ptr);
25075
25076  *offset = low % (256 * 256);
25077
25078  *is_insert = high / (256 * 256 * 128);
25079  *rseg_id = (high / (256 * 256)) % 128;
25080
25081  *page_no = (high % (256 * 256)) * 256 * 256
25082      + (low / 256) / 256;
25083 }
25084
25085
25086
25087 static inline
25088 ulint
25089 trx_undo_roll_ptr_is_insert(
25090
25091
25092  dulint roll_ptr)
25093 {
25094  ulint high;
25095
25096  ;
25097  ;
25098
25099  high = ut_dulint_get_high(roll_ptr);
25100
25101  return(high / (256 * 256 * 128));
25102 }
25103
25104
25105
25106
25107
25108 static inline
25109 void
25110 trx_write_roll_ptr(
25111
25112  unsigned char* ptr,
25113  dulint roll_ptr)
25114 {
25115  ;
25116
25117  mach_write_to_7(ptr, roll_ptr);
25118 }
25119
25120
25121
25122
25123
25124 static inline
25125 dulint
25126 trx_read_roll_ptr(
25127
25128
25129  unsigned char* ptr)
25130 {
25131  ;
25132
25133  return(mach_read_from_7(ptr));
25134 }
25135
25136
25137
25138 static inline
25139 ib_page_t*
25140 trx_undo_page_get(
25141
25142
25143  ulint space,
25144  ulint page_no,
25145  mtr_t* mtr)
25146 {
25147  ib_page_t* page;
25148
25149  page = buf_page_get_gen( space, page_no, 2, ((void *)0), 10, "./include/trx0undo.ic", 127, mtr);
25150
25151
25152
25153
25154
25155  return(page);
25156 }
25157
25158
25159
25160 static inline
25161 ib_page_t*
25162 trx_undo_page_get_s_latched(
25163
25164
25165  ulint space,
25166  ulint page_no,
25167  mtr_t* mtr)
25168 {
25169  ib_page_t* page;
25170
25171  page = buf_page_get_gen( space, page_no, 1, ((void *)0), 10, "./include/trx0undo.ic", 149, mtr);
25172
25173
25174
25175
25176
25177  return(page);
25178 }
25179
25180
25181
25182
25183 static inline
25184 ulint
25185 trx_undo_page_get_start(
25186
25187
25188  ib_page_t* undo_page,
25189  ulint page_no,
25190  ulint offset)
25191 {
25192  ulint start;
25193
25194  if (page_no == buf_frame_get_page_no(undo_page)) {
25195
25196   start = mach_read_from_2(offset + undo_page
25197       + 18);
25198  } else {
25199   start = 38 + (6 + (2 * 6));
25200  }
25201
25202  return(start);
25203 }
25204
25205
25206
25207
25208 static inline
25209 ulint
25210 trx_undo_page_get_end(
25211
25212
25213  ib_page_t* undo_page,
25214  ulint page_no,
25215  ulint offset)
25216 {
25217  trx_ulogf_t* log_hdr;
25218  ulint end;
25219
25220  if (page_no == buf_frame_get_page_no(undo_page)) {
25221
25222   log_hdr = undo_page + offset;
25223
25224   end = mach_read_from_2(log_hdr + 30);
25225
25226   if (end == 0) {
25227    end = mach_read_from_2(undo_page + 38
25228       + 4);
25229   }
25230  } else {
25231   end = mach_read_from_2(undo_page + 38
25232       + 4);
25233  }
25234
25235  return(end);
25236 }
25237
25238
25239
25240
25241 static inline
25242 trx_undo_rec_t*
25243 trx_undo_page_get_prev_rec(
25244
25245
25246  trx_undo_rec_t* rec,
25247  ulint page_no,
25248  ulint offset)
25249 {
25250  ib_page_t* undo_page;
25251  ulint start;
25252
25253  undo_page = buf_frame_align(rec);
25254
25255  start = trx_undo_page_get_start(undo_page, page_no, offset);
25256
25257  if (start + undo_page == rec) {
25258
25259   return(((void *)0));
25260  }
25261
25262  return(undo_page + mach_read_from_2(rec - 2));
25263 }
25264
25265
25266
25267
25268 static inline
25269 trx_undo_rec_t*
25270 trx_undo_page_get_next_rec(
25271
25272
25273  trx_undo_rec_t* rec,
25274  ulint page_no,
25275  ulint offset)
25276 {
25277  ib_page_t* undo_page;
25278  ulint end;
25279  ulint next;
25280
25281  undo_page = buf_frame_align(rec);
25282
25283  end = trx_undo_page_get_end(undo_page, page_no, offset);
25284
25285  next = mach_read_from_2(rec);
25286
25287  if (next == end) {
25288
25289   return(((void *)0));
25290  }
25291
25292  return(undo_page + next);
25293 }
25294
25295
25296
25297
25298 static inline
25299 trx_undo_rec_t*
25300 trx_undo_page_get_last_rec(
25301
25302
25303  ib_page_t* undo_page,
25304  ulint page_no,
25305  ulint offset)
25306 {
25307  ulint start;
25308  ulint end;
25309
25310  start = trx_undo_page_get_start(undo_page, page_no, offset);
25311  end = trx_undo_page_get_end(undo_page, page_no, offset);
25312
25313  if (start == end) {
25314
25315   return(((void *)0));
25316  }
25317
25318  return(undo_page + mach_read_from_2(undo_page + end - 2));
25319 }
25320
25321
25322
25323
25324 static inline
25325 trx_undo_rec_t*
25326 trx_undo_page_get_first_rec(
25327
25328
25329  ib_page_t* undo_page,
25330  ulint page_no,
25331  ulint offset)
25332 {
25333  ulint start;
25334  ulint end;
25335
25336  start = trx_undo_page_get_start(undo_page, page_no, offset);
25337  end = trx_undo_page_get_end(undo_page, page_no, offset);
25338
25339  if (start == end) {
25340
25341   return(((void *)0));
25342  }
25343
25344  return(undo_page + start);
25345 }
25346 # 501 "./include/trx0undo.h" 2
25347 # 11 "./include/dict0dict.ic" 2
25348
25349
25350
25351
25352 static inline
25353 dtype_t*
25354 dict_col_get_type(
25355
25356  dict_col_t* col)
25357 {
25358  ;
25359
25360  return(&col->type);
25361 }
25362 # 52 "./include/dict0dict.ic"
25363 static inline
25364 ulint
25365 dict_col_get_no(
25366
25367  dict_col_t* col)
25368 {
25369  ;
25370
25371  return(col->ind);
25372 }
25373
25374
25375
25376 static inline
25377 ulint
25378 dict_col_get_clust_pos(
25379
25380  dict_col_t* col)
25381 {
25382  ;
25383
25384  return(col->clust_pos);
25385 }
25386
25387
25388
25389 static inline
25390 dict_index_t*
25391 dict_table_get_first_index(
25392
25393
25394  dict_table_t* table)
25395 {
25396  ;
25397  ;
25398
25399  return((table->indexes).start);
25400 }
25401
25402
25403
25404 static inline
25405 dict_index_t*
25406 dict_table_get_next_index(
25407
25408
25409  dict_index_t* index)
25410 {
25411  ;
25412  ;
25413
25414  return((((index)->indexes).next));
25415 }
25416
25417
25418
25419
25420 static inline
25421 ulint
25422 dict_table_get_n_user_cols(
25423
25424
25425
25426  dict_table_t* table)
25427 {
25428  ;
25429  ;
25430
25431  return(table->n_cols - 4);
25432 }
25433
25434
25435
25436 static inline
25437 ulint
25438 dict_table_get_n_sys_cols(
25439
25440
25441
25442  dict_table_t* table __attribute__((unused)))
25443 {
25444  ;
25445  ;
25446  ;
25447
25448  return(4);
25449 }
25450
25451
25452
25453
25454 static inline
25455 ulint
25456 dict_table_get_n_cols(
25457
25458
25459  dict_table_t* table)
25460 {
25461  ;
25462  ;
25463
25464  return(table->n_cols);
25465 }
25466
25467
25468
25469 static inline
25470 dict_col_t*
25471 dict_table_get_nth_col(
25472
25473
25474  dict_table_t* table,
25475  ulint pos)
25476 {
25477  ;
25478  ;
25479  ;
25480
25481  return((table->cols) + pos);
25482 }
25483
25484
25485
25486 static inline
25487 dict_col_t*
25488 dict_table_get_sys_col(
25489
25490
25491  dict_table_t* table,
25492  ulint sys)
25493 {
25494  dict_col_t* col;
25495
25496  ;
25497  ;
25498  ;
25499
25500  col = dict_table_get_nth_col(table, table->n_cols
25501         - 4 + sys);
25502  ;
25503  ;
25504
25505  return(col);
25506 }
25507
25508
25509
25510 static inline
25511 ulint
25512 dict_table_get_sys_col_no(
25513
25514
25515  dict_table_t* table,
25516  ulint sys)
25517 {
25518  ;
25519  ;
25520  ;
25521
25522  return(table->n_cols - 4 + sys);
25523 }
25524
25525
25526
25527
25528 static inline
25529 ulint
25530 dict_index_get_n_fields(
25531
25532
25533  dict_index_t* index)
25534
25535 {
25536  ;
25537  ;
25538
25539  return(index->n_fields);
25540 }
25541
25542
25543
25544
25545
25546
25547 static inline
25548 ulint
25549 dict_index_get_n_unique(
25550
25551
25552  dict_index_t* index)
25553
25554 {
25555  ;
25556  ;
25557  ;
25558
25559  return(index->n_uniq);
25560 }
25561
25562
25563
25564
25565
25566 static inline
25567 ulint
25568 dict_index_get_n_unique_in_tree(
25569
25570
25571  dict_index_t* index)
25572
25573 {
25574  ;
25575  ;
25576  ;
25577
25578  if (index->type & 1) {
25579
25580   return(dict_index_get_n_unique(index));
25581  }
25582
25583  return(dict_index_get_n_fields(index));
25584 }
25585
25586
25587
25588
25589
25590
25591 static inline
25592 ulint
25593 dict_index_get_n_ordering_defined_by_user(
25594
25595
25596  dict_index_t* index)
25597
25598 {
25599  return(index->n_user_defined_cols);
25600 }
25601
25602
25603
25604 static inline
25605 dict_field_t*
25606 dict_index_get_nth_field(
25607
25608
25609  dict_index_t* index,
25610  ulint pos)
25611 {
25612  ;
25613  ;
25614  ;
25615
25616  return((index->fields) + pos);
25617 }
25618
25619
25620
25621 static inline
25622 ulint
25623 dict_index_get_sys_col_pos(
25624
25625
25626
25627  dict_index_t* index,
25628  ulint type)
25629 {
25630  dict_col_t* col;
25631
25632  ;
25633  ;
25634  ;
25635
25636  col = dict_table_get_sys_col(index->table, type);
25637
25638  if (index->type & 1) {
25639
25640   return(col->clust_pos);
25641  }
25642
25643  return(dict_index_get_nth_col_pos(index,
25644   dict_table_get_sys_col_no(index->table, type)));
25645 }
25646
25647
25648
25649 static inline
25650 dict_tree_t*
25651 dict_index_get_tree(
25652
25653
25654  dict_index_t* index)
25655 {
25656  ;
25657  ;
25658
25659  return(index->tree);
25660 }
25661
25662
25663
25664 static inline
25665 ulint
25666 dict_field_get_order(
25667
25668  dict_field_t* field)
25669 {
25670  ;
25671
25672  return(field->order);
25673 }
25674
25675
25676
25677 static inline
25678 dict_col_t*
25679 dict_field_get_col(
25680
25681  dict_field_t* field)
25682 {
25683  ;
25684
25685  return(field->col);
25686 }
25687
25688
25689
25690 static inline
25691 dtype_t*
25692 dict_index_get_nth_type(
25693
25694
25695  dict_index_t* index,
25696  ulint pos)
25697 {
25698  return(dict_col_get_type(dict_field_get_col(
25699    dict_index_get_nth_field(index, pos))));
25700 }
25701
25702
25703
25704 static inline
25705 ulint
25706 dict_index_get_nth_col_no(
25707
25708
25709  dict_index_t* index,
25710  ulint pos)
25711 {
25712  return(dict_col_get_no(dict_field_get_col(
25713    dict_index_get_nth_field(index, pos))));
25714 }
25715
25716
25717
25718 static inline
25719 ulint
25720 dict_tree_get_space(
25721
25722
25723  dict_tree_t* tree)
25724 {
25725  ;
25726  ;
25727
25728  return(tree->space);
25729 }
25730
25731
25732
25733 static inline
25734 void
25735 dict_tree_set_space(
25736
25737  dict_tree_t* tree,
25738  ulint space)
25739 {
25740  ;
25741  ;
25742
25743  tree->space = space;
25744 }
25745
25746
25747
25748 static inline
25749 ulint
25750 dict_tree_get_page(
25751
25752
25753  dict_tree_t* tree)
25754 {
25755  ;
25756  ;
25757
25758  return(tree->page);
25759 }
25760
25761
25762
25763 static inline
25764 void
25765 dict_tree_set_page(
25766
25767  dict_tree_t* tree,
25768  ulint page)
25769 {
25770  ;
25771  ;
25772
25773  tree->page = page;
25774 }
25775
25776
25777
25778 static inline
25779 ulint
25780 dict_tree_get_type(
25781
25782
25783  dict_tree_t* tree)
25784 {
25785  ;
25786  ;
25787
25788  return(tree->type);
25789 }
25790
25791
25792
25793 static inline
25794 rw_lock_t*
25795 dict_tree_get_lock(
25796
25797
25798  dict_tree_t* tree)
25799 {
25800  ;
25801  ;
25802
25803  return(&(tree->lock));
25804 }
25805
25806
25807
25808
25809
25810 static inline
25811 ulint
25812 dict_tree_get_space_reserve(
25813
25814
25815
25816  dict_tree_t* tree)
25817 {
25818  ;
25819
25820  tree = tree;
25821
25822  return((2 * 8192) / 16);
25823 }
25824
25825
25826
25827 static inline
25828 dict_table_t*
25829 dict_table_check_if_in_cache_low(
25830
25831
25832  const char* table_name)
25833 {
25834  dict_table_t* table;
25835  ulint table_fold;
25836
25837  ;
25838
25839
25840
25841
25842
25843  table_fold = ut_fold_string(table_name);
25844
25845  { (table) = (hash_get_nth_cell(dict_sys->table_hash, hash_calc_hash(table_fold, dict_sys->table_hash))->node); while ((table) != ((void *)0)) { if (ut_strcmp(table->name, table_name) == 0) { break; } else { (table) = ((table)->name_hash); } }};
25846
25847
25848
25849  if (table) {
25850   { ; do { if (__builtin_expect(!((ulint)((dict_sys->table_LRU).count > 0)), (0))) { ut_dbg_assertion_failed("(dict_sys->table_LRU).count > 0", "./include/dict0dict.ic", (ulint) 539); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/dict0dict.ic", (ulint) 539); } while (0); } while (0); ((dict_sys->table_LRU).count)--; if (((table)->table_LRU).next != ((void *)0)) { ((((table)->table_LRU).next)->table_LRU).prev = ((table)->table_LRU).prev; } else { (dict_sys->table_LRU).end = ((table)->table_LRU).prev; } if (((table)->table_LRU).prev != ((void *)0)) { ((((table)->table_LRU).prev)->table_LRU).next = ((table)->table_LRU).next; } else { (dict_sys->table_LRU).start = ((table)->table_LRU).next; }};
25851   { ; ((dict_sys->table_LRU).count)++; ((table)->table_LRU).next = (dict_sys->table_LRU).start; ((table)->table_LRU).prev = ((void *)0); if ((dict_sys->table_LRU).start != ((void *)0)) { (((dict_sys->table_LRU).start)->table_LRU).prev = (table); } (dict_sys->table_LRU).start = (table); if ((dict_sys->table_LRU).end == ((void *)0)) { (dict_sys->table_LRU).end = (table); }};
25852  }
25853
25854  return(table);
25855 }
25856
25857
25858
25859
25860 static inline
25861 dict_table_t*
25862 dict_table_get_low(
25863
25864
25865  const char* table_name)
25866 {
25867  dict_table_t* table;
25868
25869  ;
25870
25871
25872
25873
25874  table = dict_table_check_if_in_cache_low(table_name);
25875
25876  if (table == ((void *)0)) {
25877   table = dict_load_table(table_name);
25878  }
25879
25880  return(table);
25881 }
25882
25883
25884
25885 static inline
25886 dict_table_t*
25887 dict_table_get_on_id_low(
25888
25889
25890  dulint table_id,
25891  trx_t* trx)
25892 {
25893  dict_table_t* table;
25894  ulint fold;
25895
25896
25897
25898
25899  trx = trx;
25900
25901
25902  fold = ut_fold_dulint(table_id);
25903
25904  { (table) = (hash_get_nth_cell(dict_sys->table_id_hash, hash_calc_hash(fold, dict_sys->table_id_hash))->node); while ((table) != ((void *)0)) { if (ut_dulint_cmp(table->id, table_id) == 0) { break; } else { (table) = ((table)->id_hash); } }};
25905
25906  if (table == ((void *)0)) {
25907   table = dict_load_table_on_id(table_id);
25908  }
25909
25910  if (table != ((void *)0)) {
25911   table->mem_fix++;
25912
25913
25914   { ; do { if (__builtin_expect(!((ulint)((dict_sys->table_LRU).count > 0)), (0))) { ut_dbg_assertion_failed("(dict_sys->table_LRU).count > 0", "./include/dict0dict.ic", (ulint) 603); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/dict0dict.ic", (ulint) 603); } while (0); } while (0); ((dict_sys->table_LRU).count)--; if (((table)->table_LRU).next != ((void *)0)) { ((((table)->table_LRU).next)->table_LRU).prev = ((table)->table_LRU).prev; } else { (dict_sys->table_LRU).end = ((table)->table_LRU).prev; } if (((table)->table_LRU).prev != ((void *)0)) { ((((table)->table_LRU).prev)->table_LRU).next = ((table)->table_LRU).next; } else { (dict_sys->table_LRU).start = ((table)->table_LRU).next; }};
25915   { ; ((dict_sys->table_LRU).count)++; ((table)->table_LRU).next = (dict_sys->table_LRU).start; ((table)->table_LRU).prev = ((void *)0); if ((dict_sys->table_LRU).start != ((void *)0)) { (((dict_sys->table_LRU).start)->table_LRU).prev = (table); } (dict_sys->table_LRU).start = (table); if ((dict_sys->table_LRU).end == ((void *)0)) { (dict_sys->table_LRU).end = (table); }};
25916
25917
25918  }
25919
25920
25921
25922  return(table);
25923 }
25924
25925
25926
25927 static inline
25928 void
25929 dict_table_release(
25930
25931  dict_table_t* table)
25932 {
25933  mutex_enter_func((&(dict_sys->mutex)), "./include/dict0dict.ic", 622);
25934
25935  table->mem_fix--;
25936
25937  mutex_exit(&(dict_sys->mutex));
25938 }
25939
25940
25941
25942 static inline
25943 dict_index_t*
25944 dict_table_get_index(
25945
25946
25947  dict_table_t* table,
25948  const char* name)
25949 {
25950  dict_index_t* index = ((void *)0);
25951
25952  index = dict_table_get_first_index(table);
25953
25954  while (index != ((void *)0)) {
25955   if (ut_strcmp(name, index->name) == 0) {
25956
25957    break;
25958   }
25959
25960   index = dict_table_get_next_index(index);
25961  }
25962
25963  return(index);
25964 }
25965 # 987 "./include/dict0dict.h" 2
25966 # 15 "./include/btr0btr.h" 2
25967
25968 # 1 "./include/page0cur.h" 1
25969 # 15 "./include/page0cur.h"
25970 # 1 "./include/page0page.h" 1
25971 # 19 "./include/page0page.h"
25972 # 1 "./include/rem0rec.h" 1
25973 # 47 "./include/rem0rec.h"
25974 static inline
25975 ulint
25976 rec_get_next_offs(
25977
25978
25979
25980  rec_t* rec,
25981  ulint comp);
25982
25983
25984
25985 static inline
25986 void
25987 rec_set_next_offs(
25988
25989  rec_t* rec,
25990  ulint comp,
25991  ulint next);
25992
25993
25994
25995 static inline
25996 ulint
25997 rec_get_n_fields_old(
25998
25999
26000  rec_t* rec);
26001
26002
26003
26004 static inline
26005 ulint
26006 rec_get_n_fields(
26007
26008
26009  rec_t* rec,
26010  dict_index_t* index);
26011
26012
26013
26014 static inline
26015 ulint
26016 rec_get_n_owned(
26017
26018
26019  rec_t* rec,
26020  ulint comp);
26021
26022
26023
26024 static inline
26025 void
26026 rec_set_n_owned(
26027
26028  rec_t* rec,
26029  ulint comp,
26030  ulint n_owned);
26031
26032
26033
26034 static inline
26035 ulint
26036 rec_get_info_bits(
26037
26038
26039  rec_t* rec,
26040  ulint comp);
26041
26042
26043 static inline
26044 void
26045 rec_set_info_bits(
26046
26047  rec_t* rec,
26048  ulint comp,
26049  ulint bits);
26050
26051
26052 static inline
26053 ulint
26054 rec_get_status(
26055
26056
26057  rec_t* rec);
26058
26059
26060
26061 static inline
26062 void
26063 rec_set_status(
26064
26065  rec_t* rec,
26066  ulint bits);
26067
26068
26069
26070
26071 static inline
26072 ulint
26073 rec_get_info_and_status_bits(
26074
26075
26076  rec_t* rec,
26077  ulint comp);
26078
26079
26080
26081 static inline
26082 void
26083 rec_set_info_and_status_bits(
26084
26085  rec_t* rec,
26086  ulint comp,
26087  ulint bits);
26088
26089
26090
26091 static inline
26092 ulint
26093 rec_get_deleted_flag(
26094
26095
26096  rec_t* rec,
26097  ulint comp);
26098
26099
26100 static inline
26101 void
26102 rec_set_deleted_flag(
26103
26104  rec_t* rec,
26105  ulint comp,
26106  ulint flag);
26107
26108
26109 static inline
26110 ulint
26111 rec_get_node_ptr_flag(
26112
26113
26114  rec_t* rec);
26115
26116
26117
26118 static inline
26119 ulint
26120 rec_get_heap_no(
26121
26122
26123  rec_t* rec,
26124  ulint comp);
26125
26126
26127
26128 static inline
26129 void
26130 rec_set_heap_no(
26131
26132  rec_t* rec,
26133  ulint comp,
26134  ulint heap_no);
26135
26136
26137
26138 static inline
26139 ulint
26140 rec_get_1byte_offs_flag(
26141
26142
26143  rec_t* rec);
26144
26145
26146
26147
26148 ulint*
26149 rec_get_offsets_func(
26150
26151
26152  rec_t* rec,
26153  dict_index_t* index,
26154  ulint* offsets,
26155
26156
26157  ulint n_fields,
26158
26159  mem_heap_t** heap,
26160  const char* file,
26161  ulint line);
26162
26163
26164
26165
26166
26167
26168 static inline
26169 ulint
26170 rec_offs_validate(
26171
26172
26173  rec_t* rec,
26174  dict_index_t* index,
26175  const ulint* offsets);
26176
26177
26178
26179 static inline
26180 void
26181 rec_offs_make_valid(
26182
26183  rec_t* rec,
26184  dict_index_t* index,
26185  ulint* offsets);
26186
26187
26188
26189
26190
26191 unsigned char*
26192 rec_get_nth_field_old(
26193
26194
26195   rec_t* rec,
26196   ulint n,
26197  ulint* len);
26198
26199
26200
26201
26202
26203 static inline
26204 ulint
26205 rec_get_nth_field_size(
26206
26207
26208   rec_t* rec,
26209   ulint n);
26210
26211
26212
26213 static inline
26214 unsigned char*
26215 rec_get_nth_field(
26216
26217
26218  rec_t* rec,
26219  const ulint* offsets,
26220  ulint n,
26221  ulint* len);
26222
26223
26224
26225
26226 static inline
26227 ulint
26228 rec_offs_comp(
26229
26230
26231  const ulint* offsets);
26232
26233
26234 static inline
26235 ulint
26236 rec_offs_nth_extern(
26237
26238
26239  const ulint* offsets,
26240  ulint n);
26241
26242
26243 static inline
26244 ulint
26245 rec_offs_nth_sql_null(
26246
26247
26248  const ulint* offsets,
26249  ulint n);
26250
26251
26252 static inline
26253 ulint
26254 rec_offs_nth_size(
26255
26256
26257  const ulint* offsets,
26258  ulint n);
26259
26260
26261
26262
26263 static inline
26264 ulint
26265 rec_offs_any_extern(
26266
26267
26268  const ulint* offsets);
26269
26270
26271 static inline
26272 void
26273 rec_set_nth_field_extern_bit(
26274
26275  rec_t* rec,
26276  dict_index_t* index,
26277  ulint i,
26278  ulint val,
26279  mtr_t* mtr);
26280
26281
26282
26283
26284
26285 void
26286 rec_set_field_extern_bits(
26287
26288  rec_t* rec,
26289  dict_index_t* index,
26290  const ulint* vec,
26291  ulint n_fields,
26292  mtr_t* mtr);
26293 # 374 "./include/rem0rec.h"
26294 static inline
26295 void
26296 rec_set_nth_field(
26297
26298  rec_t* rec,
26299  const ulint* offsets,
26300  ulint n,
26301  const void* data,
26302  ulint len);
26303
26304
26305
26306
26307
26308 static inline
26309 ulint
26310 rec_get_data_size_old(
26311
26312
26313  rec_t* rec);
26314
26315
26316 static inline
26317 ulint
26318 rec_offs_n_fields(
26319
26320
26321  const ulint* offsets);
26322
26323
26324
26325
26326
26327 static inline
26328 ulint
26329 rec_offs_data_size(
26330
26331
26332  const ulint* offsets);
26333
26334
26335
26336
26337 static inline
26338 ulint
26339 rec_offs_extra_size(
26340
26341
26342  const ulint* offsets);
26343
26344
26345 static inline
26346 ulint
26347 rec_offs_size(
26348
26349
26350  const ulint* offsets);
26351
26352
26353 static inline
26354 unsigned char*
26355 rec_get_start(
26356
26357
26358  rec_t* rec,
26359  const ulint* offsets);
26360
26361
26362 static inline
26363 unsigned char*
26364 rec_get_end(
26365
26366
26367  rec_t* rec,
26368  const ulint* offsets);
26369
26370
26371 static inline
26372 rec_t*
26373 rec_copy(
26374
26375
26376  void* buf,
26377  const rec_t* rec,
26378  const ulint* offsets);
26379
26380
26381
26382
26383 rec_t*
26384 rec_copy_prefix_to_buf(
26385
26386
26387  rec_t* rec,
26388  dict_index_t* index,
26389  ulint n_fields,
26390  unsigned char** buf,
26391
26392  ulint* buf_size);
26393
26394
26395 static inline
26396 ulint
26397 rec_fold(
26398
26399
26400  rec_t* rec,
26401  const ulint* offsets,
26402
26403  ulint n_fields,
26404
26405  ulint n_bytes,
26406
26407  dulint tree_id);
26408
26409
26410
26411
26412 rec_t*
26413 rec_convert_dtuple_to_rec(
26414
26415
26416
26417  unsigned char* buf,
26418
26419  dict_index_t* index,
26420  dtuple_t* dtuple);
26421
26422
26423
26424 static inline
26425 ulint
26426 rec_get_converted_extra_size(
26427
26428
26429  ulint data_size,
26430  ulint n_fields)
26431   __attribute__((const));
26432
26433
26434
26435 static inline
26436 ulint
26437 rec_get_converted_size(
26438
26439
26440  dict_index_t* index,
26441  dtuple_t* dtuple);
26442
26443
26444
26445
26446 void
26447 rec_copy_prefix_to_dtuple(
26448
26449  dtuple_t* tuple,
26450  rec_t* rec,
26451  dict_index_t* index,
26452  ulint n_fields,
26453  mem_heap_t* heap);
26454
26455
26456
26457 ulint
26458 rec_validate(
26459
26460
26461  rec_t* rec,
26462  const ulint* offsets);
26463
26464
26465
26466 void
26467 rec_print_old(
26468
26469  FILE* file,
26470  rec_t* rec);
26471
26472
26473
26474 void
26475 rec_print_new(
26476
26477  FILE* file,
26478  rec_t* rec,
26479  const ulint* offsets);
26480
26481
26482
26483 void
26484 rec_print(
26485
26486  FILE* file,
26487  rec_t* rec,
26488  dict_index_t* index);
26489 # 582 "./include/rem0rec.h"
26490 # 1 "./include/rem0rec.ic" 1
26491 # 134 "./include/rem0rec.ic"
26492 void
26493 rec_set_nth_field_null_bit(
26494
26495  rec_t* rec,
26496  ulint i,
26497  ulint val);
26498
26499
26500
26501
26502 void
26503 rec_set_nth_field_sql_null(
26504
26505  rec_t* rec,
26506  ulint n);
26507
26508
26509
26510
26511 void
26512 rec_set_nth_field_extern_bit_old(
26513
26514  rec_t* rec,
26515  ulint i,
26516  ulint val,
26517  mtr_t* mtr);
26518
26519
26520
26521
26522
26523 void
26524 rec_set_nth_field_extern_bit_new(
26525
26526  rec_t* rec,
26527  dict_index_t* index,
26528  ulint ith,
26529  ulint val,
26530  mtr_t* mtr);
26531
26532
26533
26534
26535
26536 static inline
26537 ulint
26538 rec_get_bit_field_1(
26539
26540  rec_t* rec,
26541  ulint offs,
26542  ulint mask,
26543  ulint shift)
26544 {
26545  ;
26546
26547  return((mach_read_from_1(rec - offs) & mask) >> shift);
26548 }
26549
26550
26551
26552 static inline
26553 void
26554 rec_set_bit_field_1(
26555
26556  rec_t* rec,
26557  ulint val,
26558  ulint offs,
26559  ulint mask,
26560  ulint shift)
26561 {
26562  ;
26563  ;
26564  ;
26565  ;
26566  ;
26567  ;
26568
26569  mach_write_to_1(rec - offs,
26570    (mach_read_from_1(rec - offs) & ~mask)
26571    | (val << shift));
26572 }
26573
26574
26575
26576 static inline
26577 ulint
26578 rec_get_bit_field_2(
26579
26580  rec_t* rec,
26581  ulint offs,
26582  ulint mask,
26583  ulint shift)
26584 {
26585  ;
26586
26587  return((mach_read_from_2(rec - offs) & mask) >> shift);
26588 }
26589
26590
26591
26592 static inline
26593 void
26594 rec_set_bit_field_2(
26595
26596  rec_t* rec,
26597  ulint val,
26598  ulint offs,
26599  ulint mask,
26600  ulint shift)
26601 {
26602  ;
26603  ;
26604  ;
26605  ;
26606  ;
26607  ;
26608  ;
26609  ;
26610
26611  mach_write_to_2(rec - offs,
26612    (mach_read_from_2(rec - offs) & ~mask)
26613    | (val << shift));
26614 }
26615
26616
26617
26618
26619 static inline
26620 ulint
26621 rec_get_next_offs(
26622
26623
26624
26625  rec_t* rec,
26626  ulint comp)
26627 {
26628  ulint field_value;
26629
26630  ;
26631  ;
26632
26633  field_value = mach_read_from_2(rec - 2);
26634
26635  if (comp) {
26636 # 288 "./include/rem0rec.ic"
26637   ;
26638
26639
26640
26641
26642
26643   if (field_value == 0) {
26644
26645    return(0);
26646   }
26647
26648   return(ut_align_offset(rec + field_value, (2 * 8192)));
26649  } else {
26650   ;
26651
26652   return(field_value);
26653  }
26654 }
26655
26656
26657
26658
26659 static inline
26660 void
26661 rec_set_next_offs(
26662
26663  rec_t* rec,
26664  ulint comp,
26665  ulint next)
26666 {
26667  ;
26668  ;
26669  ;
26670  ;
26671
26672  if (comp) {
26673   ulint field_value;
26674
26675   if (next) {
26676
26677
26678
26679
26680    field_value = (ulint)((lint)next
26681     - (lint)ut_align_offset(rec, (2 * 8192)));
26682    field_value &= 0xFFFFUL;
26683   } else {
26684    field_value = 0;
26685   }
26686
26687   mach_write_to_2(rec - 2, field_value);
26688  } else {
26689   mach_write_to_2(rec - 2, next);
26690  }
26691 }
26692
26693
26694
26695
26696 static inline
26697 ulint
26698 rec_get_n_fields_old(
26699
26700
26701  rec_t* rec)
26702 {
26703  ulint ret;
26704
26705  ;
26706
26707  ret = rec_get_bit_field_2(rec, 4,
26708     0x7FEUL, 1);
26709  ;
26710  ;
26711
26712  return(ret);
26713 }
26714
26715
26716
26717
26718 static inline
26719 void
26720 rec_set_n_fields_old(
26721
26722  rec_t* rec,
26723  ulint n_fields)
26724 {
26725  ;
26726  ;
26727  ;
26728
26729  rec_set_bit_field_2(rec, n_fields, 4,
26730   0x7FEUL, 1);
26731 }
26732
26733
26734
26735 static inline
26736 ulint
26737 rec_get_status(
26738
26739
26740  rec_t* rec)
26741 {
26742  ulint ret;
26743
26744  ;
26745
26746  ret = rec_get_bit_field_1(rec, 3,
26747     0x7UL, 0);
26748  ;
26749
26750  return(ret);
26751 }
26752
26753
26754
26755
26756 static inline
26757 ulint
26758 rec_get_n_fields(
26759
26760
26761  rec_t* rec,
26762  dict_index_t* index)
26763 {
26764  ;
26765  ;
26766  if (__builtin_expect(!index->table->comp, (0))) {
26767   return(rec_get_n_fields_old(rec));
26768  }
26769  switch (rec_get_status(rec)) {
26770  case 0:
26771   return(dict_index_get_n_fields(index));
26772  case 1:
26773   return(dict_index_get_n_unique_in_tree(index) + 1);
26774  case 2:
26775  case 3:
26776   return(1);
26777  default:
26778   do { ut_dbg_assertion_failed(0, "./include/rem0rec.ic", (ulint) 429); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
26779   return(((ulint)(-1)));
26780  }
26781 }
26782
26783
26784
26785
26786 static inline
26787 ulint
26788 rec_get_n_owned(
26789
26790
26791  rec_t* rec,
26792  ulint comp)
26793 {
26794  ulint ret;
26795
26796  ;
26797
26798  ret = rec_get_bit_field_1(rec,
26799     comp ? 5 : 6,
26800     0xFUL, 0);
26801  ;
26802
26803  return(ret);
26804 }
26805
26806
26807
26808 static inline
26809 void
26810 rec_set_n_owned(
26811
26812  rec_t* rec,
26813  ulint comp,
26814  ulint n_owned)
26815 {
26816  ;
26817  ;
26818
26819  rec_set_bit_field_1(rec, n_owned,
26820     comp ? 5 : 6,
26821     0xFUL, 0);
26822 }
26823
26824
26825
26826 static inline
26827 ulint
26828 rec_get_info_bits(
26829
26830
26831  rec_t* rec,
26832  ulint comp)
26833 {
26834  ulint ret;
26835
26836  ;
26837
26838  ret = rec_get_bit_field_1(rec,
26839     comp ? 5 : 6,
26840     0xF0UL, 0);
26841  ;
26842
26843  return(ret);
26844 }
26845
26846
26847
26848 static inline
26849 void
26850 rec_set_info_bits(
26851
26852  rec_t* rec,
26853  ulint comp,
26854  ulint bits)
26855 {
26856  ;
26857  ;
26858
26859  rec_set_bit_field_1(rec, bits,
26860     comp ? 5 : 6,
26861     0xF0UL, 0);
26862 }
26863
26864
26865
26866 static inline
26867 void
26868 rec_set_status(
26869
26870  rec_t* rec,
26871  ulint bits)
26872 {
26873  ;
26874  ;
26875
26876  rec_set_bit_field_1(rec, bits, 3,
26877     0x7UL, 0);
26878 }
26879
26880
26881
26882
26883 static inline
26884 ulint
26885 rec_get_info_and_status_bits(
26886
26887
26888  rec_t* rec,
26889  ulint comp)
26890 {
26891  ulint bits;
26892
26893
26894
26895
26896  if (__builtin_expect(comp, ((ulint) 1 << 31))) {
26897   bits = rec_get_info_bits(rec, (1)) | rec_get_status(rec);
26898  } else {
26899   bits = rec_get_info_bits(rec, (0));
26900   ;
26901  }
26902  return(bits);
26903 }
26904
26905
26906
26907 static inline
26908 void
26909 rec_set_info_and_status_bits(
26910
26911  rec_t* rec,
26912  ulint comp,
26913  ulint bits)
26914 {
26915
26916
26917
26918
26919  if (comp) {
26920   rec_set_status(rec, bits & 0x7UL);
26921  } else {
26922   ;
26923  }
26924  rec_set_info_bits(rec, comp, bits & ~0x7UL);
26925 }
26926
26927
26928
26929 static inline
26930 ulint
26931 rec_get_deleted_flag(
26932
26933
26934  rec_t* rec,
26935  ulint comp)
26936 {
26937  if (__builtin_expect(comp, ((ulint) 1 << 31))) {
26938   return(__builtin_expect(rec_get_bit_field_1(rec, 5, 0x20UL, 0), (0)));
26939
26940
26941  } else {
26942   return(__builtin_expect(rec_get_bit_field_1(rec, 6, 0x20UL, 0), (0)));
26943
26944
26945  }
26946 }
26947
26948
26949
26950 static inline
26951 void
26952 rec_set_deleted_flag(
26953
26954  rec_t* rec,
26955  ulint comp,
26956  ulint flag)
26957 {
26958  ulint val;
26959
26960  val = rec_get_info_bits(rec, comp);
26961
26962  if (flag) {
26963   val |= 0x20UL;
26964  } else {
26965   val &= ~0x20UL;
26966  }
26967
26968  rec_set_info_bits(rec, comp, val);
26969 }
26970
26971
26972
26973 static inline
26974 ulint
26975 rec_get_node_ptr_flag(
26976
26977
26978  rec_t* rec)
26979 {
26980  return(1 == rec_get_status(rec));
26981 }
26982
26983
26984
26985
26986 static inline
26987 ulint
26988 rec_get_heap_no(
26989
26990
26991  rec_t* rec,
26992  ulint comp)
26993 {
26994  ulint ret;
26995
26996  ;
26997
26998  ret = rec_get_bit_field_2(rec,
26999     comp ? 4 : 5,
27000     0xFFF8UL, 3);
27001  ;
27002
27003  return(ret);
27004 }
27005
27006
27007
27008 static inline
27009 void
27010 rec_set_heap_no(
27011
27012  rec_t* rec,
27013  ulint comp,
27014  ulint heap_no)
27015 {
27016  ;
27017
27018  rec_set_bit_field_2(rec, heap_no,
27019     comp ? 4 : 5,
27020     0xFFF8UL, 3);
27021 }
27022
27023
27024
27025
27026 static inline
27027 ulint
27028 rec_get_1byte_offs_flag(
27029
27030
27031  rec_t* rec)
27032 {
27033
27034
27035
27036
27037  return(rec_get_bit_field_1(rec, 3, 0x1UL,
27038        0));
27039 }
27040
27041
27042
27043 static inline
27044 void
27045 rec_set_1byte_offs_flag(
27046
27047  rec_t* rec,
27048  ulint flag)
27049 {
27050
27051
27052
27053  ;
27054
27055  rec_set_bit_field_1(rec, flag, 3, 0x1UL,
27056        0);
27057 }
27058
27059
27060
27061
27062
27063 static inline
27064 ulint
27065 rec_1_get_field_end_info(
27066
27067
27068
27069   rec_t* rec,
27070   ulint n)
27071 {
27072  ;
27073  ;
27074
27075  return(mach_read_from_1(rec - (6 + n + 1)));
27076 }
27077
27078
27079
27080
27081
27082 static inline
27083 ulint
27084 rec_2_get_field_end_info(
27085
27086
27087
27088   rec_t* rec,
27089   ulint n)
27090 {
27091  ;
27092  ;
27093
27094  return(mach_read_from_2(rec - (6 + 2 * n + 2)));
27095 }
27096 # 764 "./include/rem0rec.ic"
27097 static inline
27098 ulint
27099 rec_offs_get_n_alloc(
27100
27101
27102  const ulint* offsets)
27103 {
27104  ulint n_alloc;
27105  ;
27106  n_alloc = offsets[0];
27107  ;
27108  return(n_alloc);
27109 }
27110
27111
27112
27113
27114 static inline
27115 void
27116 rec_offs_set_n_alloc(
27117
27118  ulint* offsets,
27119  ulint n_alloc)
27120 {
27121  ;
27122  ;
27123  offsets[0] = n_alloc;
27124 }
27125
27126
27127
27128 static inline
27129 ulint
27130 rec_offs_n_fields(
27131
27132
27133  const ulint* offsets)
27134 {
27135  ulint n_fields;
27136  ;
27137  n_fields = offsets[1];
27138  ;
27139  ;
27140  ;
27141
27142  return(n_fields);
27143 }
27144
27145
27146
27147 static inline
27148 ulint
27149 rec_offs_validate(
27150
27151
27152  rec_t* rec,
27153  dict_index_t* index,
27154  const ulint* offsets)
27155 {
27156  ulint i = rec_offs_n_fields(offsets);
27157  ulint last = ((ulint)(-2));
27158  ulint comp = *(offsets + 2) & ((ulint) 1 << 31);
27159
27160  if (rec) {
27161   ;
27162   if (!comp) {
27163    do { if (__builtin_expect(!((ulint)(rec_get_n_fields_old(rec) >= i)), (0))) { ut_dbg_assertion_failed("rec_get_n_fields_old(rec) >= i", "./include/rem0rec.ic", (ulint) 830); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/rem0rec.ic", (ulint) 830); } while (0); } while (0);
27164   }
27165  }
27166  if (index) {
27167   ulint max_n_fields;
27168   ;
27169   max_n_fields = ut_max(
27170     dict_index_get_n_fields(index),
27171     dict_index_get_n_unique_in_tree(index) + 1);
27172   if (comp && rec) {
27173    switch (rec_get_status(rec)) {
27174    case 0:
27175     break;
27176    case 1:
27177     max_n_fields =
27178     dict_index_get_n_unique_in_tree(index) + 1;
27179     break;
27180    case 2:
27181    case 3:
27182     max_n_fields = 1;
27183     break;
27184    default:
27185     do { ut_dbg_assertion_failed(0, "./include/rem0rec.ic", (ulint) 852); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
27186    }
27187   }
27188
27189   do { if (__builtin_expect(!((ulint)(!comp || index->n_def)), (0))) { ut_dbg_assertion_failed("!comp || index->n_def", "./include/rem0rec.ic", (ulint) 856); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/rem0rec.ic", (ulint) 856); } while (0); } while (0);
27190   do { if (__builtin_expect(!((ulint)(!index->n_def || i <= max_n_fields)), (0))) { ut_dbg_assertion_failed("!index->n_def || i <= max_n_fields", "./include/rem0rec.ic", (ulint) 857); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/rem0rec.ic", (ulint) 857); } while (0); } while (0);
27191  }
27192  while (i--) {
27193   ulint curr = (offsets + 2)[1 + i] & (((ulint) 1 << 30) - 1);
27194   do { if (__builtin_expect(!((ulint)(curr <= last)), (0))) { ut_dbg_assertion_failed("curr <= last", "./include/rem0rec.ic", (ulint) 861); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/rem0rec.ic", (ulint) 861); } while (0); } while (0);
27195   last = curr;
27196  }
27197  return((1));
27198 }
27199
27200
27201
27202 static inline
27203 void
27204 rec_offs_make_valid(
27205
27206  rec_t* rec __attribute__((unused)),
27207
27208  dict_index_t* index __attribute__((unused)),
27209
27210  ulint* offsets __attribute__((unused)))
27211
27212 {
27213
27214
27215
27216
27217
27218 }
27219
27220
27221
27222
27223 static inline
27224 unsigned char*
27225 rec_get_nth_field(
27226
27227
27228  rec_t* rec,
27229  const ulint* offsets,
27230  ulint n,
27231  ulint* len)
27232
27233 {
27234  unsigned char* field;
27235  ulint length;
27236  ;
27237  ;
27238  ;
27239  ;
27240
27241  if (__builtin_expect(n == 0, (0))) {
27242   field = rec;
27243  } else {
27244   field = rec + ((offsets + 2)[n] & (((ulint) 1 << 30) - 1));
27245  }
27246
27247  length = (offsets + 2)[1 + n];
27248
27249  if (length & ((ulint) 1 << 31)) {
27250   length = 0xFFFFFFFF;
27251  } else {
27252   length &= (((ulint) 1 << 30) - 1);
27253   length -= field - rec;
27254  }
27255
27256  *len = length;
27257  return(field);
27258 }
27259
27260
27261
27262
27263 static inline
27264 ulint
27265 rec_offs_comp(
27266
27267
27268  const ulint* offsets)
27269 {
27270  ;
27271  return(*(offsets + 2) & ((ulint) 1 << 31));
27272 }
27273
27274
27275
27276 static inline
27277 ulint
27278 rec_offs_nth_extern(
27279
27280
27281  const ulint* offsets,
27282  ulint n)
27283 {
27284  ;
27285  ;
27286  return(__builtin_expect((offsets + 2)[1 + n] & ((ulint) 1 << 30), (0)));
27287
27288 }
27289
27290
27291
27292 static inline
27293 ulint
27294 rec_offs_nth_sql_null(
27295
27296
27297  const ulint* offsets,
27298  ulint n)
27299 {
27300  ;
27301  ;
27302  return(__builtin_expect((offsets + 2)[1 + n] & ((ulint) 1 << 31), (0)));
27303
27304 }
27305
27306
27307
27308 static inline
27309 ulint
27310 rec_offs_nth_size(
27311
27312
27313  const ulint* offsets,
27314  ulint n)
27315 {
27316  ;
27317  ;
27318  if (!n) {
27319   return((offsets + 2)[1 + n] & (((ulint) 1 << 30) - 1));
27320  }
27321  return(((offsets + 2)[1 + n] - (offsets + 2)[n])
27322    & (((ulint) 1 << 30) - 1));
27323 }
27324
27325
27326
27327
27328 static inline
27329 ulint
27330 rec_offs_any_extern(
27331
27332
27333  const ulint* offsets)
27334 {
27335  ulint i;
27336  for (i = rec_offs_n_fields(offsets); i--; ) {
27337   if (rec_offs_nth_extern(offsets, i)) {
27338    return((1));
27339   }
27340  }
27341  return((0));
27342 }
27343
27344
27345
27346 static inline
27347 void
27348 rec_set_nth_field_extern_bit(
27349
27350  rec_t* rec,
27351  dict_index_t* index,
27352  ulint i,
27353  ulint val,
27354  mtr_t* mtr)
27355
27356
27357 {
27358  if (__builtin_expect(index->table->comp, (1))) {
27359   rec_set_nth_field_extern_bit_new(rec, index, i, val, mtr);
27360  } else {
27361   rec_set_nth_field_extern_bit_old(rec, i, val, mtr);
27362  }
27363 }
27364
27365
27366
27367
27368
27369
27370
27371 static inline
27372 ulint
27373 rec_1_get_prev_field_end_info(
27374
27375
27376
27377   rec_t* rec,
27378   ulint n)
27379 {
27380  ;
27381  ;
27382
27383  return(mach_read_from_1(rec - (6 + n)));
27384 }
27385
27386
27387
27388
27389
27390 static inline
27391 ulint
27392 rec_2_get_prev_field_end_info(
27393
27394
27395
27396   rec_t* rec,
27397   ulint n)
27398 {
27399  ;
27400  ;
27401
27402  return(mach_read_from_2(rec - (6 + 2 * n)));
27403 }
27404
27405
27406
27407
27408 static inline
27409 void
27410 rec_1_set_field_end_info(
27411
27412   rec_t* rec,
27413   ulint n,
27414   ulint info)
27415 {
27416  ;
27417  ;
27418
27419  mach_write_to_1(rec - (6 + n + 1), info);
27420 }
27421
27422
27423
27424
27425 static inline
27426 void
27427 rec_2_set_field_end_info(
27428
27429   rec_t* rec,
27430   ulint n,
27431   ulint info)
27432 {
27433  ;
27434  ;
27435
27436  mach_write_to_2(rec - (6 + 2 * n + 2), info);
27437 }
27438
27439
27440
27441
27442 static inline
27443 ulint
27444 rec_1_get_field_start_offs(
27445
27446
27447   rec_t* rec,
27448   ulint n)
27449 {
27450  ;
27451  ;
27452
27453  if (n == 0) {
27454
27455   return(0);
27456  }
27457
27458  return(rec_1_get_prev_field_end_info(rec, n)
27459       & ~0x80UL);
27460 }
27461
27462
27463
27464
27465 static inline
27466 ulint
27467 rec_2_get_field_start_offs(
27468
27469
27470   rec_t* rec,
27471   ulint n)
27472 {
27473  ;
27474  ;
27475
27476  if (n == 0) {
27477
27478   return(0);
27479  }
27480
27481  return(rec_2_get_prev_field_end_info(rec, n)
27482   & ~(0x8000UL | 0x4000UL));
27483 }
27484
27485
27486
27487
27488
27489
27490 static inline
27491 ulint
27492 rec_get_field_start_offs(
27493
27494
27495   rec_t* rec,
27496   ulint n)
27497 {
27498  ;
27499  ;
27500
27501  if (n == 0) {
27502
27503   return(0);
27504  }
27505
27506  if (rec_get_1byte_offs_flag(rec)) {
27507
27508   return(rec_1_get_field_start_offs(rec, n));
27509  }
27510
27511  return(rec_2_get_field_start_offs(rec, n));
27512 }
27513
27514
27515
27516
27517
27518 static inline
27519 ulint
27520 rec_get_nth_field_size(
27521
27522
27523   rec_t* rec,
27524   ulint n)
27525 {
27526  ulint os;
27527  ulint next_os;
27528
27529  os = rec_get_field_start_offs(rec, n);
27530  next_os = rec_get_field_start_offs(rec, n + 1);
27531
27532  ;
27533
27534  return(next_os - os);
27535 }
27536
27537
27538
27539
27540
27541
27542
27543 static inline
27544 void
27545 rec_set_nth_field(
27546
27547  rec_t* rec,
27548  const ulint* offsets,
27549  ulint n,
27550  const void* data,
27551
27552  ulint len)
27553 {
27554  unsigned char* data2;
27555  ulint len2;
27556
27557  ;
27558  ;
27559
27560  if (__builtin_expect(len == 0xFFFFFFFF, (0))) {
27561   if (!rec_offs_nth_sql_null(offsets, n)) {
27562    do { if (__builtin_expect(!((ulint)(!rec_offs_comp(offsets))), (0))) { ut_dbg_assertion_failed("!rec_offs_comp(offsets)", "./include/rem0rec.ic", (ulint) 1229); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/rem0rec.ic", (ulint) 1229); } while (0); } while (0);
27563    rec_set_nth_field_sql_null(rec, n);
27564   }
27565
27566   return;
27567  }
27568
27569  data2 = rec_get_nth_field(rec, offsets, n, &len2);
27570  if (len2 == 0xFFFFFFFF) {
27571   ;
27572   rec_set_nth_field_null_bit(rec, n, (0));
27573   ;
27574  } else {
27575   ;
27576  }
27577
27578  ut_memcpy(data2, data, len);
27579 }
27580
27581
27582
27583
27584
27585
27586 static inline
27587 ulint
27588 rec_get_data_size_old(
27589
27590
27591  rec_t* rec)
27592 {
27593  ;
27594
27595  return(rec_get_field_start_offs(rec, rec_get_n_fields_old(rec)));
27596 }
27597
27598
27599
27600 static inline
27601 void
27602 rec_offs_set_n_fields(
27603
27604  ulint* offsets,
27605  ulint n_fields)
27606 {
27607  ;
27608  ;
27609  ;
27610  ;
27611
27612  offsets[1] = n_fields;
27613 }
27614
27615
27616
27617
27618
27619
27620 static inline
27621 ulint
27622 rec_offs_data_size(
27623
27624
27625  const ulint* offsets)
27626 {
27627  ulint size;
27628
27629  ;
27630  size = (offsets + 2)[rec_offs_n_fields(offsets)]
27631    & (((ulint) 1 << 30) - 1);
27632  ;
27633  return(size);
27634 }
27635
27636
27637
27638
27639
27640 static inline
27641 ulint
27642 rec_offs_extra_size(
27643
27644
27645  const ulint* offsets)
27646 {
27647  ulint size;
27648  ;
27649  size = *(offsets + 2) & ~((ulint) 1 << 31);
27650  ;
27651  return(size);
27652 }
27653
27654
27655
27656 static inline
27657 ulint
27658 rec_offs_size(
27659
27660
27661  const ulint* offsets)
27662 {
27663  return(rec_offs_data_size(offsets) + rec_offs_extra_size(offsets));
27664 }
27665
27666
27667
27668 static inline
27669 unsigned char*
27670 rec_get_end(
27671
27672
27673  rec_t* rec,
27674  const ulint* offsets)
27675 {
27676  return(rec + rec_offs_data_size(offsets));
27677 }
27678
27679
27680
27681 static inline
27682 unsigned char*
27683 rec_get_start(
27684
27685
27686  rec_t* rec,
27687  const ulint* offsets)
27688 {
27689  return(rec - rec_offs_extra_size(offsets));
27690 }
27691
27692
27693
27694 static inline
27695 rec_t*
27696 rec_copy(
27697
27698
27699  void* buf,
27700  const rec_t* rec,
27701  const ulint* offsets)
27702 {
27703  ulint extra_len;
27704  ulint data_len;
27705
27706  ;
27707  ;
27708  ;
27709
27710  extra_len = rec_offs_extra_size(offsets);
27711  data_len = rec_offs_data_size(offsets);
27712
27713  ut_memcpy(buf, rec - extra_len, extra_len + data_len);
27714
27715  return((unsigned char*)buf + extra_len);
27716 }
27717
27718
27719
27720
27721 static inline
27722 ulint
27723 rec_get_converted_extra_size(
27724
27725
27726  ulint data_size,
27727  ulint n_fields)
27728 {
27729  if (data_size <= 0x7FUL) {
27730
27731   return(6 + n_fields);
27732  }
27733
27734  return(6 + 2 * n_fields);
27735 }
27736
27737
27738
27739
27740
27741 ulint
27742 rec_get_converted_size_new(
27743
27744
27745  dict_index_t* index,
27746  dtuple_t* dtuple);
27747
27748
27749
27750 static inline
27751 ulint
27752 rec_get_converted_size(
27753
27754
27755  dict_index_t* index,
27756  dtuple_t* dtuple)
27757 {
27758  ulint data_size;
27759  ulint extra_size;
27760
27761  ;
27762  ;
27763  ;
27764
27765  ;
27766
27767
27768
27769
27770
27771
27772  if (__builtin_expect(index->table->comp, (1))) {
27773   return(rec_get_converted_size_new(index, dtuple));
27774  }
27775
27776  data_size = dtuple_get_data_size(dtuple);
27777
27778  extra_size = rec_get_converted_extra_size(
27779     data_size, dtuple_get_n_fields(dtuple));
27780
27781  return(data_size + extra_size);
27782 }
27783
27784
27785
27786
27787 static inline
27788 ulint
27789 rec_fold(
27790
27791
27792  rec_t* rec,
27793  const ulint* offsets,
27794
27795  ulint n_fields,
27796
27797  ulint n_bytes,
27798
27799  dulint tree_id)
27800 {
27801  ulint i;
27802  unsigned char* data;
27803  ulint len;
27804  ulint fold;
27805  ulint n_fields_rec;
27806
27807  ;
27808  ;
27809  ;
27810
27811  n_fields_rec = rec_offs_n_fields(offsets);
27812  ;
27813  ;
27814
27815  if (n_fields > n_fields_rec) {
27816          n_fields = n_fields_rec;
27817  }
27818
27819  if (n_fields == n_fields_rec) {
27820          n_bytes = 0;
27821  }
27822
27823  fold = ut_fold_dulint(tree_id);
27824
27825  for (i = 0; i < n_fields; i++) {
27826   data = rec_get_nth_field(rec, offsets, i, &len);
27827
27828   if (len != 0xFFFFFFFF) {
27829    fold = ut_fold_ulint_pair(fold,
27830         ut_fold_binary(data, len));
27831   }
27832  }
27833
27834  if (n_bytes > 0) {
27835   data = rec_get_nth_field(rec, offsets, i, &len);
27836
27837   if (len != 0xFFFFFFFF) {
27838    if (len > n_bytes) {
27839     len = n_bytes;
27840    }
27841
27842    fold = ut_fold_ulint_pair(fold,
27843         ut_fold_binary(data, len));
27844   }
27845  }
27846
27847  return(fold);
27848 }
27849 # 583 "./include/rem0rec.h" 2
27850 # 20 "./include/page0page.h" 2
27851 # 33 "./include/page0page.h"
27852 typedef unsigned char page_header_t;
27853 # 114 "./include/page0page.h"
27854 typedef unsigned char page_dir_slot_t;
27855 typedef page_dir_slot_t page_dir_t;
27856 # 137 "./include/page0page.h"
27857 static inline
27858 dulint
27859 page_get_max_trx_id(
27860
27861  ib_page_t* page);
27862
27863
27864
27865 void
27866 page_set_max_trx_id(
27867
27868  ib_page_t* page,
27869  dulint trx_id);
27870
27871
27872
27873 static inline
27874 void
27875 page_update_max_trx_id(
27876
27877  ib_page_t* page,
27878  dulint trx_id);
27879
27880
27881 static inline
27882 ulint
27883 page_header_get_field(
27884
27885  ib_page_t* page,
27886  ulint field);
27887
27888
27889 static inline
27890 void
27891 page_header_set_field(
27892
27893  ib_page_t* page,
27894  ulint field,
27895  ulint val);
27896
27897
27898 static inline
27899 unsigned char*
27900 page_header_get_ptr(
27901
27902
27903  ib_page_t* page,
27904  ulint field);
27905
27906
27907 static inline
27908 void
27909 page_header_set_ptr(
27910
27911  ib_page_t* page,
27912  ulint field,
27913  unsigned char* ptr);
27914
27915
27916
27917 static inline
27918 void
27919 page_header_reset_last_insert(
27920
27921  ib_page_t* page,
27922  mtr_t* mtr);
27923
27924
27925 static inline
27926 rec_t*
27927 page_get_infimum_rec(
27928
27929
27930  ib_page_t* page);
27931
27932
27933 static inline
27934 rec_t*
27935 page_get_supremum_rec(
27936
27937
27938  ib_page_t* page);
27939
27940
27941
27942
27943 rec_t*
27944 page_get_middle_rec(
27945
27946
27947  ib_page_t* page);
27948
27949
27950
27951
27952
27953
27954 static inline
27955 int
27956 page_cmp_dtuple_rec_with_match(
27957
27958
27959
27960
27961  dtuple_t* dtuple,
27962  rec_t* rec,
27963
27964
27965
27966  const ulint* offsets,
27967  ulint* matched_fields,
27968
27969
27970  ulint* matched_bytes);
27971
27972
27973
27974
27975
27976
27977 static inline
27978 ulint
27979 page_get_n_recs(
27980
27981
27982  ib_page_t* page);
27983
27984 ulint
27985 page_get_n_recs_noninline(
27986
27987
27988  ib_page_t* page);
27989
27990
27991
27992
27993 ulint
27994 page_rec_get_n_recs_before(
27995
27996
27997  rec_t* rec);
27998
27999
28000 static inline
28001 ulint
28002 page_dir_get_n_heap(
28003
28004
28005  ib_page_t* page);
28006
28007
28008 static inline
28009 void
28010 page_dir_set_n_heap(
28011
28012  ib_page_t* page,
28013  ulint n_heap);
28014
28015
28016 static inline
28017 ulint
28018 page_dir_get_n_slots(
28019
28020
28021  ib_page_t* page);
28022
28023
28024 static inline
28025 void
28026 page_dir_set_n_slots(
28027
28028
28029  ib_page_t* page,
28030  ulint n_slots);
28031
28032
28033 static inline
28034 page_dir_slot_t*
28035 page_dir_get_nth_slot(
28036
28037
28038  ib_page_t* page,
28039  ulint n);
28040
28041
28042 static inline
28043 ulint
28044 page_rec_check(
28045
28046
28047  rec_t* rec);
28048
28049
28050 static inline
28051 rec_t*
28052 page_dir_slot_get_rec(
28053
28054
28055  page_dir_slot_t* slot);
28056
28057
28058 static inline
28059 void
28060 page_dir_slot_set_rec(
28061
28062  page_dir_slot_t* slot,
28063  rec_t* rec);
28064
28065
28066 static inline
28067 ulint
28068 page_dir_slot_get_n_owned(
28069
28070
28071  page_dir_slot_t* slot);
28072
28073
28074 static inline
28075 void
28076 page_dir_slot_set_n_owned(
28077
28078  page_dir_slot_t* slot,
28079  ulint n);
28080
28081
28082
28083
28084
28085
28086 static inline
28087 ulint
28088 page_dir_calc_reserved_space(
28089
28090  ulint n_recs);
28091
28092
28093
28094 ulint
28095 page_dir_find_owner_slot(
28096
28097
28098  rec_t* rec);
28099
28100
28101 static inline
28102 ulint
28103 page_is_comp(
28104
28105
28106
28107  ib_page_t* page);
28108
28109
28110 static inline
28111 ulint
28112 page_rec_is_comp(
28113
28114
28115  const rec_t* rec);
28116
28117
28118 static inline
28119 rec_t*
28120 page_rec_get_next(
28121
28122
28123  rec_t* rec);
28124
28125
28126
28127 static inline
28128 void
28129 page_rec_set_next(
28130
28131  rec_t* rec,
28132
28133  rec_t* next);
28134
28135
28136
28137 static inline
28138 rec_t*
28139 page_rec_get_prev(
28140
28141
28142  rec_t* rec);
28143
28144
28145
28146 static inline
28147 ulint
28148 page_rec_is_user_rec_low(
28149
28150
28151  ulint offset);
28152
28153
28154 static inline
28155 ulint
28156 page_rec_is_supremum_low(
28157
28158
28159  ulint offset);
28160
28161
28162 static inline
28163 ulint
28164 page_rec_is_infimum_low(
28165
28166
28167  ulint offset);
28168
28169
28170
28171 static inline
28172 ulint
28173 page_rec_is_user_rec(
28174
28175
28176  const rec_t* rec);
28177
28178
28179 static inline
28180 ulint
28181 page_rec_is_supremum(
28182
28183
28184  const rec_t* rec);
28185
28186
28187 static inline
28188 ulint
28189 page_rec_is_infimum(
28190
28191
28192  const rec_t* rec);
28193
28194
28195 static inline
28196 rec_t*
28197 page_rec_find_owner_rec(
28198
28199
28200  rec_t* rec);
28201
28202
28203
28204
28205
28206 void
28207 page_rec_write_index_page_no(
28208
28209  rec_t* rec,
28210  ulint i,
28211  ulint page_no,
28212  mtr_t* mtr);
28213
28214
28215
28216 static inline
28217 ulint
28218 page_get_max_insert_size(
28219
28220
28221  ib_page_t* page,
28222  ulint n_recs);
28223
28224
28225
28226 static inline
28227 ulint
28228 page_get_max_insert_size_after_reorganize(
28229
28230
28231  ib_page_t* page,
28232  ulint n_recs);
28233
28234
28235 static inline
28236 ulint
28237 page_get_free_space_of_empty(
28238
28239
28240  ulint comp)
28241   __attribute__((const));
28242
28243
28244
28245 static inline
28246 ulint
28247 page_get_data_size(
28248
28249
28250  ib_page_t* page);
28251
28252 ulint
28253 page_get_data_size_noninline(
28254
28255
28256  ib_page_t* page);
28257
28258
28259
28260 unsigned char*
28261 page_mem_alloc(
28262
28263
28264
28265  ib_page_t* page,
28266  ulint need,
28267  dict_index_t* index,
28268  ulint* heap_no);
28269
28270
28271
28272
28273 static inline
28274 void
28275 page_mem_free(
28276
28277  ib_page_t* page,
28278  rec_t* rec,
28279  const ulint* offsets);
28280
28281
28282
28283 ib_page_t*
28284 page_create(
28285
28286
28287  buf_frame_t* frame,
28288
28289  mtr_t* mtr,
28290  ulint comp);
28291
28292
28293
28294
28295 void
28296 page_copy_rec_list_end_no_locks(
28297
28298  ib_page_t* new_page,
28299  ib_page_t* page,
28300  rec_t* rec,
28301  dict_index_t* index,
28302  mtr_t* mtr);
28303
28304
28305
28306
28307
28308 void
28309 page_copy_rec_list_end(
28310
28311  ib_page_t* new_page,
28312  ib_page_t* page,
28313  rec_t* rec,
28314  dict_index_t* index,
28315  mtr_t* mtr);
28316
28317
28318
28319
28320
28321 void
28322 page_copy_rec_list_start(
28323
28324  ib_page_t* new_page,
28325  ib_page_t* page,
28326  rec_t* rec,
28327  dict_index_t* index,
28328  mtr_t* mtr);
28329
28330
28331
28332
28333 void
28334 page_delete_rec_list_end(
28335
28336  ib_page_t* page,
28337  rec_t* rec,
28338  dict_index_t* index,
28339  ulint n_recs,
28340
28341  ulint size,
28342
28343
28344  mtr_t* mtr);
28345
28346
28347
28348
28349 void
28350 page_delete_rec_list_start(
28351
28352  ib_page_t* page,
28353  rec_t* rec,
28354  dict_index_t* index,
28355  mtr_t* mtr);
28356
28357
28358
28359
28360 void
28361 page_move_rec_list_end(
28362
28363  ib_page_t* new_page,
28364  ib_page_t* page,
28365  rec_t* split_rec,
28366  dict_index_t* index,
28367  mtr_t* mtr);
28368
28369
28370
28371
28372 void
28373 page_move_rec_list_start(
28374
28375  ib_page_t* new_page,
28376  ib_page_t* page,
28377  rec_t* split_rec,
28378  dict_index_t* index,
28379  mtr_t* mtr);
28380
28381
28382
28383 void
28384 page_dir_split_slot(
28385
28386  ib_page_t* page,
28387  ulint slot_no);
28388
28389
28390
28391
28392
28393
28394 void
28395 page_dir_balance_slot(
28396
28397  ib_page_t* page,
28398  ulint slot_no);
28399
28400
28401
28402 unsigned char*
28403 page_parse_delete_rec_list(
28404
28405
28406  unsigned char type,
28407
28408
28409
28410  unsigned char* ptr,
28411  unsigned char* end_ptr,
28412  dict_index_t* index,
28413  ib_page_t* page,
28414  mtr_t* mtr);
28415
28416
28417
28418 unsigned char*
28419 page_parse_create(
28420
28421
28422  unsigned char* ptr,
28423  unsigned char* end_ptr,
28424  ulint comp,
28425  ib_page_t* page,
28426  mtr_t* mtr);
28427
28428
28429
28430
28431 void
28432 page_rec_print(
28433
28434  rec_t* rec,
28435  const ulint* offsets);
28436
28437
28438
28439
28440 void
28441 page_dir_print(
28442
28443  ib_page_t* page,
28444  ulint pr_n);
28445
28446
28447
28448
28449 void
28450 page_print_list(
28451
28452  ib_page_t* page,
28453  dict_index_t* index,
28454  ulint pr_n);
28455
28456
28457
28458 void
28459 page_header_print(
28460
28461  ib_page_t* page);
28462
28463
28464
28465
28466 void
28467 page_print(
28468
28469  ib_page_t* page,
28470  dict_index_t* index,
28471  ulint dn,
28472
28473  ulint rn);
28474
28475
28476
28477
28478
28479
28480 ulint
28481 page_rec_validate(
28482
28483
28484  rec_t* rec,
28485  const ulint* offsets);
28486
28487
28488
28489
28490
28491 void
28492 page_check_dir(
28493
28494  ib_page_t* page);
28495
28496
28497
28498
28499
28500 ulint
28501 page_simple_validate(
28502
28503
28504  ib_page_t* page);
28505
28506
28507
28508 ulint
28509 page_validate(
28510
28511
28512  ib_page_t* page,
28513  dict_index_t* index);
28514
28515
28516
28517
28518 rec_t*
28519 page_find_rec_with_heap_no(
28520
28521
28522  ib_page_t* page,
28523  ulint heap_no);
28524
28525
28526
28527
28528
28529
28530
28531 # 1 "./include/page0page.ic" 1
28532 # 10 "./include/page0page.ic"
28533 # 1 "./include/rem0cmp.h" 1
28534 # 21 "./include/rem0cmp.h"
28535 ulint
28536 cmp_types_are_equal(
28537
28538
28539
28540  dtype_t* type1,
28541  dtype_t* type2,
28542  ulint check_charsets);
28543
28544
28545
28546 static inline
28547 int
28548 cmp_data_data(
28549
28550
28551
28552  dtype_t* cur_type,
28553  unsigned char* data1,
28554
28555  ulint len1,
28556  unsigned char* data2,
28557
28558  ulint len2);
28559
28560
28561
28562
28563 int
28564 cmp_data_data_slow(
28565
28566
28567
28568  dtype_t* cur_type,
28569  unsigned char* data1,
28570
28571  ulint len1,
28572  unsigned char* data2,
28573
28574  ulint len2);
28575
28576
28577
28578 static inline
28579 int
28580 cmp_dfield_dfield(
28581
28582
28583
28584  dfield_t* dfield1,
28585  dfield_t* dfield2);
28586 # 81 "./include/rem0cmp.h"
28587 int
28588 cmp_dtuple_rec_with_match(
28589
28590
28591
28592
28593
28594
28595  dtuple_t* dtuple,
28596  rec_t* rec,
28597
28598
28599
28600  const ulint* offsets,
28601  ulint* matched_fields,
28602
28603
28604  ulint* matched_bytes);
28605
28606
28607
28608
28609
28610
28611 int
28612 cmp_dtuple_rec(
28613
28614
28615
28616
28617  dtuple_t* dtuple,
28618  rec_t* rec,
28619  const ulint* offsets);
28620
28621
28622
28623
28624 ulint
28625 cmp_dtuple_is_prefix_of_rec(
28626
28627
28628  dtuple_t* dtuple,
28629  rec_t* rec,
28630  const ulint* offsets);
28631
28632
28633
28634
28635
28636 int
28637 cmp_rec_rec_with_match(
28638
28639
28640
28641
28642  rec_t* rec1,
28643  rec_t* rec2,
28644  const ulint* offsets1,
28645  const ulint* offsets2,
28646  dict_index_t* index,
28647  ulint* matched_fields,
28648
28649
28650
28651  ulint* matched_bytes);
28652
28653
28654
28655
28656
28657
28658 static inline
28659 int
28660 cmp_rec_rec(
28661
28662
28663
28664
28665  rec_t* rec1,
28666  rec_t* rec2,
28667  const ulint* offsets1,
28668  const ulint* offsets2,
28669  dict_index_t* index);
28670
28671
28672
28673 # 1 "./include/rem0cmp.ic" 1
28674 # 12 "./include/rem0cmp.ic"
28675 static inline
28676 int
28677 cmp_data_data(
28678
28679
28680
28681  dtype_t* cur_type,
28682  unsigned char* data1,
28683
28684  ulint len1,
28685  unsigned char* data2,
28686
28687  ulint len2)
28688 {
28689  return(cmp_data_data_slow(cur_type, data1, len1, data2, len2));
28690 }
28691
28692
28693
28694
28695 static inline
28696 int
28697 cmp_dfield_dfield(
28698
28699
28700
28701  dfield_t* dfield1,
28702  dfield_t* dfield2)
28703 {
28704  ;
28705
28706  return(cmp_data_data(dfield_get_type(dfield1),
28707    dfield_get_data(dfield1), dfield_get_len(dfield1),
28708    dfield_get_data(dfield2), dfield_get_len(dfield2)));
28709 }
28710
28711
28712
28713
28714 static inline
28715 int
28716 cmp_rec_rec(
28717
28718
28719
28720
28721  rec_t* rec1,
28722  rec_t* rec2,
28723  const ulint* offsets1,
28724  const ulint* offsets2,
28725  dict_index_t* index)
28726 {
28727  ulint match_f = 0;
28728  ulint match_b = 0;
28729
28730  return(cmp_rec_rec_with_match(rec1, rec2, offsets1, offsets2, index,
28731      &match_f, &match_b));
28732 }
28733 # 168 "./include/rem0cmp.h" 2
28734 # 11 "./include/page0page.ic" 2
28735 # 20 "./include/page0page.ic"
28736 static inline
28737 dulint
28738 page_get_max_trx_id(
28739
28740  ib_page_t* page)
28741 {
28742  ;
28743
28744  return(mach_read_from_8(page + 38 + 18));
28745 }
28746
28747
28748
28749
28750 static inline
28751 void
28752 page_update_max_trx_id(
28753
28754  ib_page_t* page,
28755  dulint trx_id)
28756 {
28757  ;
28758
28759  if (ut_dulint_cmp(page_get_max_trx_id(page), trx_id) < 0) {
28760
28761   page_set_max_trx_id(page, trx_id);
28762  }
28763 }
28764
28765
28766
28767 static inline
28768 ulint
28769 page_header_get_field(
28770
28771  ib_page_t* page,
28772  ulint field)
28773 {
28774  ;
28775  ;
28776
28777  return(mach_read_from_2(page + 38 + field));
28778 }
28779
28780
28781
28782 static inline
28783 void
28784 page_header_set_field(
28785
28786  ib_page_t* page,
28787  ulint field,
28788  ulint val)
28789 {
28790  ;
28791  ;
28792  ;
28793  ;
28794
28795  mach_write_to_2(page + 38 + field, val);
28796 }
28797
28798
28799
28800 static inline
28801 unsigned char*
28802 page_header_get_ptr(
28803
28804
28805  ib_page_t* page,
28806  ulint field)
28807 {
28808  ulint offs;
28809
28810  ;
28811  ;
28812
28813
28814
28815  offs = page_header_get_field(page, field);
28816
28817  ;
28818
28819  if (offs == 0) {
28820
28821   return(((void *)0));
28822  }
28823
28824  return(page + offs);
28825 }
28826
28827
28828
28829 static inline
28830 void
28831 page_header_set_ptr(
28832
28833  ib_page_t* page,
28834  ulint field,
28835  unsigned char* ptr)
28836 {
28837  ulint offs;
28838
28839  ;
28840  ;
28841
28842
28843
28844  if (ptr == ((void *)0)) {
28845   offs = 0;
28846  } else {
28847   offs = ptr - page;
28848  }
28849
28850  ;
28851
28852  page_header_set_field(page, field, offs);
28853 }
28854
28855
28856
28857
28858 static inline
28859 void
28860 page_header_reset_last_insert(
28861
28862  ib_page_t* page,
28863  mtr_t* mtr)
28864 {
28865  ;
28866
28867  mlog_write_ulint(page + 38 + 10, 0,
28868        ((unsigned char)2), mtr);
28869 }
28870
28871
28872
28873 static inline
28874 ulint
28875 page_is_comp(
28876
28877
28878
28879  ib_page_t* page)
28880 {
28881  return(__builtin_expect(page_header_get_field(page, 4) & 0x8000, 0x8000));
28882
28883 }
28884
28885
28886
28887 static inline
28888 ulint
28889 page_rec_is_comp(
28890
28891
28892  const rec_t* rec)
28893 {
28894  return(page_is_comp(ut_align_down((rec_t*) rec, (2 * 8192))));
28895 }
28896
28897
28898
28899 static inline
28900 rec_t*
28901 page_get_infimum_rec(
28902
28903
28904  ib_page_t* page)
28905 {
28906  ;
28907
28908  if (page_is_comp(page)) {
28909   return(page + ((38 + 36 + 2 * 10) + 5));
28910  } else {
28911   return(page + ((38 + 36 + 2 * 10) + 1 + 6));
28912  }
28913 }
28914
28915
28916
28917 static inline
28918 rec_t*
28919 page_get_supremum_rec(
28920
28921
28922  ib_page_t* page)
28923 {
28924  ;
28925
28926  if (page_is_comp(page)) {
28927   return(page + ((38 + 36 + 2 * 10) + 2 * 5 + 8));
28928  } else {
28929   return(page + ((38 + 36 + 2 * 10) + 2 + 2 * 6 + 8));
28930  }
28931 }
28932
28933
28934
28935 static inline
28936 ulint
28937 page_rec_is_user_rec_low(
28938
28939
28940  ulint offset)
28941 {
28942  ;
28943 # 245 "./include/page0page.ic"
28944  ;
28945
28946  return(__builtin_expect(offset != ((38 + 36 + 2 * 10) + 2 * 5 + 8), (1))
28947   && __builtin_expect(offset != ((38 + 36 + 2 * 10) + 5), (1))
28948   && __builtin_expect(offset != ((38 + 36 + 2 * 10) + 1 + 6), (1))
28949   && __builtin_expect(offset != ((38 + 36 + 2 * 10) + 2 + 2 * 6 + 8), (1)));
28950 }
28951
28952
28953
28954 static inline
28955 ulint
28956 page_rec_is_supremum_low(
28957
28958
28959  ulint offset)
28960 {
28961  ;
28962  ;
28963
28964  return(__builtin_expect(offset == ((38 + 36 + 2 * 10) + 2 * 5 + 8), (0))
28965   || __builtin_expect(offset == ((38 + 36 + 2 * 10) + 2 + 2 * 6 + 8), (0)));
28966 }
28967
28968
28969
28970 static inline
28971 ulint
28972 page_rec_is_infimum_low(
28973
28974
28975  ulint offset)
28976 {
28977  ;
28978  ;
28979
28980  return(__builtin_expect(offset == ((38 + 36 + 2 * 10) + 5), (0))
28981   || __builtin_expect(offset == ((38 + 36 + 2 * 10) + 1 + 6), (0)));
28982 }
28983
28984
28985
28986 static inline
28987 ulint
28988 page_rec_is_user_rec(
28989
28990
28991  const rec_t* rec)
28992 {
28993  return(page_rec_is_user_rec_low(
28994    ut_align_offset(rec, (2 * 8192))));
28995 }
28996
28997
28998
28999 static inline
29000 ulint
29001 page_rec_is_supremum(
29002
29003
29004  const rec_t* rec)
29005 {
29006  return(page_rec_is_supremum_low(
29007    ut_align_offset(rec, (2 * 8192))));
29008 }
29009
29010
29011
29012 static inline
29013 ulint
29014 page_rec_is_infimum(
29015
29016
29017  const rec_t* rec)
29018 {
29019  return(page_rec_is_infimum_low(
29020    ut_align_offset(rec, (2 * 8192))));
29021 }
29022
29023
29024
29025
29026
29027
29028
29029 static inline
29030 int
29031 page_cmp_dtuple_rec_with_match(
29032
29033
29034
29035
29036  dtuple_t* dtuple,
29037  rec_t* rec,
29038
29039
29040
29041  const ulint* offsets,
29042  ulint* matched_fields,
29043
29044
29045  ulint* matched_bytes)
29046
29047
29048
29049 {
29050  ulint rec_offset;
29051
29052  ;
29053  ;
29054  ;
29055
29056  rec_offset = ut_align_offset(rec, (2 * 8192));
29057
29058  if (__builtin_expect(rec_offset == ((38 + 36 + 2 * 10) + 5), (0))
29059    || __builtin_expect(rec_offset == ((38 + 36 + 2 * 10) + 1 + 6), (0))) {
29060   return(1);
29061  }
29062  if (__builtin_expect(rec_offset == ((38 + 36 + 2 * 10) + 2 * 5 + 8), (0))
29063    || __builtin_expect(rec_offset == ((38 + 36 + 2 * 10) + 2 + 2 * 6 + 8), (0))) {
29064   return(-1);
29065  }
29066
29067  return(cmp_dtuple_rec_with_match(dtuple, rec, offsets,
29068       matched_fields,
29069       matched_bytes));
29070 }
29071
29072
29073
29074
29075 static inline
29076 ulint
29077 page_get_n_recs(
29078
29079
29080  ib_page_t* page)
29081 {
29082  return(page_header_get_field(page, 16));
29083 }
29084
29085
29086
29087 static inline
29088 ulint
29089 page_dir_get_n_slots(
29090
29091
29092  ib_page_t* page)
29093 {
29094  return(page_header_get_field(page, 0));
29095 }
29096
29097
29098 static inline
29099 void
29100 page_dir_set_n_slots(
29101
29102
29103  ib_page_t* page,
29104  ulint n_slots)
29105 {
29106  page_header_set_field(page, 0, n_slots);
29107 }
29108
29109
29110
29111 static inline
29112 ulint
29113 page_dir_get_n_heap(
29114
29115
29116  ib_page_t* page)
29117 {
29118  return(page_header_get_field(page, 4) & 0x7fff);
29119 }
29120
29121
29122
29123 static inline
29124 void
29125 page_dir_set_n_heap(
29126
29127  ib_page_t* page,
29128  ulint n_heap)
29129 {
29130  ;
29131
29132  page_header_set_field(page, 4, n_heap | (0x8000 &
29133   page_header_get_field(page, 4)));
29134 }
29135
29136
29137
29138 static inline
29139 page_dir_slot_t*
29140 page_dir_get_nth_slot(
29141
29142
29143  ib_page_t* page,
29144  ulint n)
29145 {
29146  ;
29147
29148  return(page + (2 * 8192) - 8
29149      - (n + 1) * 2);
29150 }
29151
29152
29153
29154 static inline
29155 ulint
29156 page_rec_check(
29157
29158
29159  rec_t* rec)
29160 {
29161  ib_page_t* page;
29162
29163  do { if (__builtin_expect(!((ulint)(rec)), (0))) { ut_dbg_assertion_failed("rec", "./include/page0page.ic", (ulint) 464); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/page0page.ic", (ulint) 464); } while (0); } while (0);
29164
29165  page = buf_frame_align(rec);
29166
29167  do { if (__builtin_expect(!((ulint)(rec <= page_header_get_ptr(page, 2))), (0))) { ut_dbg_assertion_failed("rec <= page_header_get_ptr(page, PAGE_HEAP_TOP)", "./include/page0page.ic", (ulint) 468); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/page0page.ic", (ulint) 468); } while (0); } while (0);
29168  do { if (__builtin_expect(!((ulint)(rec >= page + (38 + 36 + 2 * 10))), (0))) { ut_dbg_assertion_failed("rec >= page + PAGE_DATA", "./include/page0page.ic", (ulint) 469); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/page0page.ic", (ulint) 469); } while (0); } while (0);
29169
29170  return((1));
29171 }
29172
29173
29174
29175 static inline
29176 rec_t*
29177 page_dir_slot_get_rec(
29178
29179
29180  page_dir_slot_t* slot)
29181 {
29182  return(buf_frame_align(slot) + mach_read_from_2(slot));
29183 }
29184
29185
29186
29187 static inline
29188 void
29189 page_dir_slot_set_rec(
29190
29191  page_dir_slot_t* slot,
29192  rec_t* rec)
29193 {
29194  ;
29195
29196  mach_write_to_2(slot, ut_align_offset(rec, (2 * 8192)));
29197 }
29198
29199
29200
29201 static inline
29202 ulint
29203 page_dir_slot_get_n_owned(
29204
29205
29206  page_dir_slot_t* slot)
29207 {
29208  rec_t* rec = page_dir_slot_get_rec(slot);
29209  return(rec_get_n_owned(rec, page_rec_is_comp(rec)));
29210 }
29211
29212
29213
29214 static inline
29215 void
29216 page_dir_slot_set_n_owned(
29217
29218  page_dir_slot_t* slot,
29219  ulint n)
29220
29221 {
29222  rec_t* rec = page_dir_slot_get_rec(slot);
29223  rec_set_n_owned(rec, page_rec_is_comp(rec), n);
29224 }
29225
29226
29227
29228
29229
29230 static inline
29231 ulint
29232 page_dir_calc_reserved_space(
29233
29234  ulint n_recs)
29235 {
29236  return((2 * n_recs + 4 - 1)
29237       / 4);
29238 }
29239
29240
29241
29242 static inline
29243 rec_t*
29244 page_rec_get_next(
29245
29246
29247  rec_t* rec)
29248 {
29249  ulint offs;
29250  ib_page_t* page;
29251
29252  ;
29253
29254  page = ut_align_down(rec, (2 * 8192));
29255
29256  offs = rec_get_next_offs(rec, page_is_comp(page));
29257
29258  if (__builtin_expect(offs >= (2 * 8192), (0))) {
29259   fprintf(stderr,
29260 "InnoDB: Next record offset is nonsensical %lu in record at offset %lu\n"
29261 "InnoDB: rec address %p, first buffer frame %p\n"
29262 "InnoDB: buffer pool high end %p, buf fix count %lu\n",
29263     (ulong)offs, (ulong)(rec - page),
29264     rec, buf_pool->frame_zero,
29265     buf_pool->high_end,
29266     (ulong)buf_block_align(rec)->buf_fix_count);
29267   buf_page_print(page);
29268
29269   do { ut_dbg_assertion_failed(0, "./include/page0page.ic", (ulint) 570); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
29270  }
29271
29272  if (__builtin_expect(offs == 0, (0))) {
29273
29274   return(((void *)0));
29275  }
29276
29277  return(page + offs);
29278 }
29279
29280
29281
29282 static inline
29283 void
29284 page_rec_set_next(
29285
29286  rec_t* rec,
29287  rec_t* next)
29288
29289 {
29290  ib_page_t* page;
29291  ulint offs;
29292
29293  ;
29294  ;
29295  page = ut_align_down(rec, (2 * 8192));
29296
29297  if (next) {
29298   ;
29299   ;
29300   offs = (ulint) (next - page);
29301  } else {
29302   offs = 0;
29303  }
29304
29305  rec_set_next_offs(rec, page_is_comp(page), offs);
29306 }
29307
29308
29309
29310 static inline
29311 rec_t*
29312 page_rec_get_prev(
29313
29314
29315  rec_t* rec)
29316
29317 {
29318  page_dir_slot_t* slot;
29319  ulint slot_no;
29320  rec_t* rec2;
29321  rec_t* prev_rec = ((void *)0);
29322  ib_page_t* page;
29323
29324  ;
29325
29326  page = ut_align_down(rec, (2 * 8192));
29327
29328  ;
29329
29330  slot_no = page_dir_find_owner_slot(rec);
29331
29332  do { if (__builtin_expect(!((ulint)(slot_no != 0)), (0))) { ut_dbg_assertion_failed("slot_no != 0", "./include/page0page.ic", (ulint) 633); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/page0page.ic", (ulint) 633); } while (0); } while (0);
29333
29334  slot = page_dir_get_nth_slot(page, slot_no - 1);
29335
29336  rec2 = page_dir_slot_get_rec(slot);
29337
29338  while (rec != rec2) {
29339   prev_rec = rec2;
29340   rec2 = page_rec_get_next(rec2);
29341  }
29342
29343  do { if (__builtin_expect(!((ulint)(prev_rec)), (0))) { ut_dbg_assertion_failed("prev_rec", "./include/page0page.ic", (ulint) 644); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("./include/page0page.ic", (ulint) 644); } while (0); } while (0);
29344
29345  return(prev_rec);
29346 }
29347
29348
29349
29350 static inline
29351 rec_t*
29352 page_rec_find_owner_rec(
29353
29354
29355  rec_t* rec)
29356 {
29357  ;
29358
29359  if (page_rec_is_comp(rec)) {
29360   while (rec_get_n_owned(rec, (1)) == 0) {
29361    rec = page_rec_get_next(rec);
29362   }
29363  } else {
29364   while (rec_get_n_owned(rec, (0)) == 0) {
29365    rec = page_rec_get_next(rec);
29366   }
29367  }
29368
29369  return(rec);
29370 }
29371
29372
29373
29374
29375 static inline
29376 ulint
29377 page_get_data_size(
29378
29379
29380  ib_page_t* page)
29381 {
29382  ulint ret;
29383
29384  ret = (ulint)(page_header_get_field(page, 2)
29385         - (page_is_comp(page)
29386     ? (((38 + 36 + 2 * 10) + 2 * 5 + 8) + 8)
29387     : (((38 + 36 + 2 * 10) + 2 + 2 * 6 + 8) + 9))
29388         - page_header_get_field(page, 8));
29389
29390  ;
29391
29392  return(ret);
29393 }
29394
29395
29396
29397 static inline
29398 ulint
29399 page_get_free_space_of_empty(
29400
29401
29402  ulint comp)
29403 {
29404  if (__builtin_expect(comp, (1))) {
29405   return((ulint)((2 * 8192)
29406   - (((38 + 36 + 2 * 10) + 2 * 5 + 8) + 8)
29407   - 8
29408   - 2 * 2));
29409  }
29410
29411  return((ulint)((2 * 8192)
29412   - (((38 + 36 + 2 * 10) + 2 + 2 * 6 + 8) + 9)
29413   - 8
29414   - 2 * 2));
29415 }
29416 # 725 "./include/page0page.ic"
29417 static inline
29418 ulint
29419 page_get_max_insert_size(
29420
29421
29422  ib_page_t* page,
29423  ulint n_recs)
29424 {
29425  ulint occupied;
29426  ulint free_space;
29427
29428  if (page_is_comp(page)) {
29429   occupied = page_header_get_field(page, 2)
29430   - (((38 + 36 + 2 * 10) + 2 * 5 + 8) + 8) + page_dir_calc_reserved_space(
29431    n_recs + page_dir_get_n_heap(page) - 2);
29432
29433   free_space = page_get_free_space_of_empty((1));
29434  } else {
29435   occupied = page_header_get_field(page, 2)
29436   - (((38 + 36 + 2 * 10) + 2 + 2 * 6 + 8) + 9) + page_dir_calc_reserved_space(
29437    n_recs + page_dir_get_n_heap(page) - 2);
29438
29439   free_space = page_get_free_space_of_empty((0));
29440  }
29441
29442
29443
29444
29445
29446  if (occupied > free_space) {
29447
29448   return(0);
29449  }
29450
29451  return(free_space - occupied);
29452 }
29453
29454
29455
29456
29457 static inline
29458 ulint
29459 page_get_max_insert_size_after_reorganize(
29460
29461
29462  ib_page_t* page,
29463  ulint n_recs)
29464 {
29465  ulint occupied;
29466  ulint free_space;
29467
29468  occupied = page_get_data_size(page)
29469   + page_dir_calc_reserved_space(n_recs + page_get_n_recs(page));
29470
29471  free_space = page_get_free_space_of_empty(page_is_comp(page));
29472
29473  if (occupied > free_space) {
29474
29475   return(0);
29476  }
29477
29478  return(free_space - occupied);
29479 }
29480
29481
29482
29483 static inline
29484 void
29485 page_mem_free(
29486
29487  ib_page_t* page,
29488  rec_t* rec,
29489  const ulint* offsets)
29490 {
29491  rec_t* free;
29492  ulint garbage;
29493
29494  ;
29495  ;
29496  free = page_header_get_ptr(page, 6);
29497
29498  page_rec_set_next(rec, free);
29499  page_header_set_ptr(page, 6, rec);
29500 # 819 "./include/page0page.ic"
29501  garbage = page_header_get_field(page, 8);
29502
29503  page_header_set_field(page, 8,
29504     garbage + rec_offs_size(offsets));
29505 }
29506 # 812 "./include/page0page.h" 2
29507 # 16 "./include/page0cur.h" 2
29508 # 46 "./include/page0cur.h"
29509 static inline
29510 ib_page_t*
29511 page_cur_get_page(
29512
29513
29514  page_cur_t* cur);
29515
29516
29517 static inline
29518 rec_t*
29519 page_cur_get_rec(
29520
29521
29522  page_cur_t* cur);
29523
29524
29525
29526 static inline
29527 void
29528 page_cur_set_before_first(
29529
29530  ib_page_t* page,
29531  page_cur_t* cur);
29532
29533
29534
29535 static inline
29536 void
29537 page_cur_set_after_last(
29538
29539  ib_page_t* page,
29540  page_cur_t* cur);
29541
29542
29543 static inline
29544 ulint
29545 page_cur_is_before_first(
29546
29547
29548  const page_cur_t* cur);
29549
29550
29551 static inline
29552 ulint
29553 page_cur_is_after_last(
29554
29555
29556  const page_cur_t* cur);
29557
29558
29559 static inline
29560 void
29561 page_cur_position(
29562
29563  rec_t* rec,
29564  page_cur_t* cur);
29565
29566
29567 static inline
29568 void
29569 page_cur_invalidate(
29570
29571  page_cur_t* cur);
29572
29573
29574 static inline
29575 void
29576 page_cur_move_to_next(
29577
29578  page_cur_t* cur);
29579
29580
29581 static inline
29582 void
29583 page_cur_move_to_prev(
29584
29585  page_cur_t* cur);
29586
29587
29588
29589
29590 static inline
29591 rec_t*
29592 page_cur_tuple_insert(
29593
29594
29595
29596  page_cur_t* cursor,
29597  dtuple_t* tuple,
29598  dict_index_t* index,
29599  mtr_t* mtr);
29600
29601
29602
29603
29604 static inline
29605 rec_t*
29606 page_cur_rec_insert(
29607
29608
29609
29610  page_cur_t* cursor,
29611  rec_t* rec,
29612  dict_index_t* index,
29613  ulint* offsets,
29614  mtr_t* mtr);
29615
29616
29617
29618
29619
29620
29621 rec_t*
29622 page_cur_insert_rec_low(
29623
29624
29625
29626  page_cur_t* cursor,
29627  dtuple_t* tuple,
29628  dict_index_t* index,
29629  rec_t* rec,
29630  ulint* offsets,
29631  mtr_t* mtr);
29632
29633
29634
29635
29636 void
29637 page_copy_rec_list_end_to_created_page(
29638
29639  ib_page_t* new_page,
29640  ib_page_t* page,
29641  rec_t* rec,
29642  dict_index_t* index,
29643  mtr_t* mtr);
29644
29645
29646
29647
29648 void
29649 page_cur_delete_rec(
29650
29651  page_cur_t* cursor,
29652  dict_index_t* index,
29653  const ulint* offsets,
29654  mtr_t* mtr);
29655
29656
29657 static inline
29658 ulint
29659 page_cur_search(
29660
29661
29662  ib_page_t* page,
29663  dict_index_t* index,
29664  dtuple_t* tuple,
29665  ulint mode,
29666
29667  page_cur_t* cursor);
29668
29669
29670
29671 void
29672 page_cur_search_with_match(
29673
29674  ib_page_t* page,
29675  dict_index_t* index,
29676  dtuple_t* tuple,
29677  ulint mode,
29678
29679  ulint* iup_matched_fields,
29680
29681
29682  ulint* iup_matched_bytes,
29683
29684
29685  ulint* ilow_matched_fields,
29686
29687
29688  ulint* ilow_matched_bytes,
29689
29690
29691  page_cur_t* cursor);
29692
29693
29694
29695
29696 void
29697 page_cur_open_on_rnd_user_rec(
29698
29699  ib_page_t* page,
29700  page_cur_t* cursor);
29701
29702
29703
29704 unsigned char*
29705 page_cur_parse_insert_rec(
29706
29707
29708  ulint is_short,
29709  unsigned char* ptr,
29710  unsigned char* end_ptr,
29711  dict_index_t* index,
29712  ib_page_t* page,
29713  mtr_t* mtr);
29714
29715
29716
29717 unsigned char*
29718 page_parse_copy_rec_list_to_created_page(
29719
29720
29721  unsigned char* ptr,
29722  unsigned char* end_ptr,
29723  dict_index_t* index,
29724  ib_page_t* page,
29725  mtr_t* mtr);
29726
29727
29728
29729 unsigned char*
29730 page_cur_parse_delete_rec(
29731
29732
29733  unsigned char* ptr,
29734  unsigned char* end_ptr,
29735  dict_index_t* index,
29736  ib_page_t* page,
29737  mtr_t* mtr);
29738
29739
29740
29741 struct page_cur_struct{
29742  unsigned char* rec;
29743 };
29744
29745
29746 # 1 "./include/page0cur.ic" 1
29747 # 14 "./include/page0cur.ic"
29748 static inline
29749 ib_page_t*
29750 page_cur_get_page(
29751
29752
29753  page_cur_t* cur)
29754 {
29755  ;
29756
29757  return(buf_frame_align(cur->rec));
29758 }
29759
29760
29761
29762 static inline
29763 rec_t*
29764 page_cur_get_rec(
29765
29766
29767  page_cur_t* cur)
29768 {
29769  ;
29770
29771  return(cur->rec);
29772 }
29773
29774
29775
29776
29777 static inline
29778 void
29779 page_cur_set_before_first(
29780
29781  ib_page_t* page,
29782  page_cur_t* cur)
29783 {
29784  cur->rec = page_get_infimum_rec(page);
29785 }
29786
29787
29788
29789
29790 static inline
29791 void
29792 page_cur_set_after_last(
29793
29794  ib_page_t* page,
29795  page_cur_t* cur)
29796 {
29797  cur->rec = page_get_supremum_rec(page);
29798 }
29799
29800
29801
29802 static inline
29803 ulint
29804 page_cur_is_before_first(
29805
29806
29807  const page_cur_t* cur)
29808 {
29809  return(page_rec_is_infimum(cur->rec));
29810 }
29811
29812
29813
29814 static inline
29815 ulint
29816 page_cur_is_after_last(
29817
29818
29819  const page_cur_t* cur)
29820 {
29821  return(page_rec_is_supremum(cur->rec));
29822 }
29823
29824
29825
29826 static inline
29827 void
29828 page_cur_position(
29829
29830  rec_t* rec,
29831  page_cur_t* cur)
29832 {
29833  ;
29834
29835  cur->rec = rec;
29836 }
29837
29838
29839
29840 static inline
29841 void
29842 page_cur_invalidate(
29843
29844  page_cur_t* cur)
29845 {
29846  ;
29847
29848  cur->rec = ((void *)0);
29849 }
29850
29851
29852
29853 static inline
29854 void
29855 page_cur_move_to_next(
29856
29857  page_cur_t* cur)
29858 {
29859  ;
29860
29861  cur->rec = page_rec_get_next(cur->rec);
29862 }
29863
29864
29865
29866 static inline
29867 void
29868 page_cur_move_to_prev(
29869
29870  page_cur_t* cur)
29871 {
29872  ;
29873
29874  cur->rec = page_rec_get_prev(cur->rec);
29875 }
29876
29877
29878
29879 static inline
29880 ulint
29881 page_cur_search(
29882
29883
29884  ib_page_t* page,
29885  dict_index_t* index,
29886  dtuple_t* tuple,
29887  ulint mode,
29888
29889  page_cur_t* cursor)
29890 {
29891  ulint low_matched_fields = 0;
29892  ulint low_matched_bytes = 0;
29893  ulint up_matched_fields = 0;
29894  ulint up_matched_bytes = 0;
29895
29896  ;
29897
29898  page_cur_search_with_match(page, index, tuple, mode,
29899      &up_matched_fields,
29900      &up_matched_bytes,
29901      &low_matched_fields,
29902      &low_matched_bytes,
29903      cursor);
29904  return(low_matched_fields);
29905 }
29906
29907
29908
29909
29910
29911 static inline
29912 rec_t*
29913 page_cur_tuple_insert(
29914
29915
29916
29917  page_cur_t* cursor,
29918  dtuple_t* tuple,
29919  dict_index_t* index,
29920  mtr_t* mtr)
29921 {
29922  return(page_cur_insert_rec_low(cursor, tuple, index, ((void *)0), ((void *)0), mtr));
29923 }
29924
29925
29926
29927
29928
29929 static inline
29930 rec_t*
29931 page_cur_rec_insert(
29932
29933
29934
29935  page_cur_t* cursor,
29936  rec_t* rec,
29937  dict_index_t* index,
29938  ulint* offsets,
29939  mtr_t* mtr)
29940 {
29941  return(page_cur_insert_rec_low(cursor, ((void *)0), index, rec,
29942     offsets, mtr));
29943 }
29944 # 284 "./include/page0cur.h" 2
29945 # 17 "./include/btr0btr.h" 2
29946 # 51 "./include/btr0btr.h"
29947 ib_page_t*
29948 btr_root_get(
29949
29950
29951  dict_tree_t* tree,
29952  mtr_t* mtr);
29953
29954
29955 static inline
29956 ib_page_t*
29957 btr_page_get(
29958
29959  ulint space,
29960  ulint page_no,
29961  ulint mode,
29962  mtr_t* mtr);
29963
29964
29965 static inline
29966 dulint
29967 btr_page_get_index_id(
29968
29969
29970  ib_page_t* page);
29971
29972 dulint
29973 btr_page_get_index_id_noninline(
29974
29975
29976  ib_page_t* page);
29977
29978
29979 static inline
29980 ulint
29981 btr_page_get_level_low(
29982
29983
29984  ib_page_t* page);
29985
29986
29987 static inline
29988 ulint
29989 btr_page_get_level(
29990
29991
29992  ib_page_t* page,
29993  mtr_t* mtr);
29994
29995
29996 static inline
29997 ulint
29998 btr_page_get_next(
29999
30000
30001  ib_page_t* page,
30002  mtr_t* mtr);
30003
30004
30005 static inline
30006 ulint
30007 btr_page_get_prev(
30008
30009
30010  ib_page_t* page,
30011  mtr_t* mtr);
30012
30013
30014
30015
30016 rec_t*
30017 btr_get_prev_user_rec(
30018
30019
30020  rec_t* rec,
30021  mtr_t* mtr);
30022
30023
30024
30025
30026
30027 rec_t*
30028 btr_get_next_user_rec(
30029
30030
30031  rec_t* rec,
30032  mtr_t* mtr);
30033
30034
30035
30036 static inline
30037 void
30038 btr_leaf_page_release(
30039
30040  ib_page_t* page,
30041  ulint latch_mode,
30042  mtr_t* mtr);
30043
30044
30045 static inline
30046 ulint
30047 btr_node_ptr_get_child_page_no(
30048
30049
30050  rec_t* rec,
30051  const ulint* offsets);
30052
30053
30054
30055 ulint
30056 btr_create(
30057
30058
30059
30060  ulint type,
30061  ulint space,
30062  dulint index_id,
30063  ulint comp,
30064  mtr_t* mtr);
30065
30066
30067
30068
30069 void
30070 btr_free_but_not_root(
30071
30072  ulint space,
30073  ulint root_page_no);
30074
30075
30076
30077 void
30078 btr_free_root(
30079
30080  ulint space,
30081  ulint root_page_no,
30082  mtr_t* mtr);
30083 # 195 "./include/btr0btr.h"
30084 rec_t*
30085 btr_root_raise_and_insert(
30086
30087
30088  btr_cur_t* cursor,
30089
30090
30091
30092  dtuple_t* tuple,
30093  mtr_t* mtr);
30094
30095
30096
30097 void
30098 btr_page_reorganize(
30099
30100  ib_page_t* page,
30101  dict_index_t* index,
30102  mtr_t* mtr);
30103
30104
30105
30106
30107 ulint
30108 btr_page_get_split_rec_to_left(
30109
30110
30111  btr_cur_t* cursor,
30112  rec_t** split_rec);
30113
30114
30115
30116
30117
30118
30119 ulint
30120 btr_page_get_split_rec_to_right(
30121
30122
30123  btr_cur_t* cursor,
30124  rec_t** split_rec);
30125 # 246 "./include/btr0btr.h"
30126 rec_t*
30127 btr_page_split_and_insert(
30128
30129
30130
30131
30132  btr_cur_t* cursor,
30133
30134
30135  dtuple_t* tuple,
30136  mtr_t* mtr);
30137
30138
30139
30140
30141 void
30142 btr_insert_on_non_leaf_level(
30143
30144  dict_tree_t* tree,
30145  ulint level,
30146  dtuple_t* tuple,
30147  mtr_t* mtr);
30148
30149
30150
30151 void
30152 btr_set_min_rec_mark(
30153
30154  rec_t* rec,
30155  ulint comp,
30156  mtr_t* mtr);
30157
30158
30159
30160 void
30161 btr_node_ptr_delete(
30162
30163  dict_tree_t* tree,
30164  ib_page_t* page,
30165  mtr_t* mtr);
30166
30167
30168
30169 ulint
30170 btr_check_node_ptr(
30171
30172
30173  dict_tree_t* tree,
30174  ib_page_t* page,
30175  mtr_t* mtr);
30176 # 306 "./include/btr0btr.h"
30177 void
30178 btr_compress(
30179
30180  btr_cur_t* cursor,
30181
30182
30183
30184  mtr_t* mtr);
30185
30186
30187
30188
30189
30190 void
30191 btr_discard_page(
30192
30193  btr_cur_t* cursor,
30194
30195  mtr_t* mtr);
30196
30197
30198
30199
30200 unsigned char*
30201 btr_parse_set_min_rec_mark(
30202
30203
30204  unsigned char* ptr,
30205  unsigned char* end_ptr,
30206  ulint comp,
30207  ib_page_t* page,
30208  mtr_t* mtr);
30209
30210
30211
30212 unsigned char*
30213 btr_parse_page_reorganize(
30214
30215
30216  unsigned char* ptr,
30217  unsigned char* end_ptr,
30218  dict_index_t* index,
30219  ib_page_t* page,
30220  mtr_t* mtr);
30221
30222
30223
30224 ulint
30225 btr_get_size(
30226
30227
30228  dict_index_t* index,
30229  ulint flag);
30230
30231
30232
30233
30234 ib_page_t*
30235 btr_page_alloc(
30236
30237
30238
30239  dict_tree_t* tree,
30240  ulint hint_page_no,
30241  unsigned char file_direction,
30242
30243  ulint level,
30244
30245  mtr_t* mtr);
30246
30247
30248
30249
30250 void
30251 btr_page_free(
30252
30253  dict_tree_t* tree,
30254  ib_page_t* page,
30255  mtr_t* mtr);
30256
30257
30258
30259
30260
30261 void
30262 btr_page_free_low(
30263
30264  dict_tree_t* tree,
30265  ib_page_t* page,
30266  ulint level,
30267  mtr_t* mtr);
30268 # 419 "./include/btr0btr.h"
30269 ulint
30270 btr_index_rec_validate(
30271
30272
30273  rec_t* rec,
30274  dict_index_t* index,
30275  ulint dump_on_error);
30276
30277
30278
30279
30280
30281 ulint
30282 btr_validate_tree(
30283
30284
30285  dict_tree_t* tree,
30286  trx_t* trx);
30287
30288
30289
30290
30291
30292 # 1 "./include/btr0btr.ic" 1
30293 # 17 "./include/btr0btr.ic"
30294 static inline
30295 ib_page_t*
30296 btr_page_get(
30297
30298  ulint space,
30299  ulint page_no,
30300  ulint mode,
30301  mtr_t* mtr)
30302 {
30303  ib_page_t* page;
30304
30305  page = buf_page_get_gen( space, page_no, mode, ((void *)0), 10, "./include/btr0btr.ic", 28, mtr);
30306
30307
30308
30309
30310
30311
30312  return(page);
30313 }
30314
30315
30316
30317 static inline
30318 void
30319 btr_page_set_index_id(
30320
30321  ib_page_t* page,
30322  dulint id,
30323  mtr_t* mtr)
30324 {
30325  mlog_write_dulint(page + 38 + 28, id, mtr);
30326 }
30327
30328
30329
30330 static inline
30331 dulint
30332 btr_page_get_index_id(
30333
30334
30335  ib_page_t* page)
30336 {
30337  return(mach_read_from_8(page + 38 + 28));
30338 }
30339
30340
30341
30342 static inline
30343 ulint
30344 btr_page_get_level_low(
30345
30346
30347  ib_page_t* page)
30348 {
30349  ulint level;
30350
30351  ;
30352
30353  level = mach_read_from_2(page + 38 + 26);
30354
30355  ;
30356
30357  return(level);
30358 }
30359
30360
30361
30362 static inline
30363 ulint
30364 btr_page_get_level(
30365
30366
30367  ib_page_t* page,
30368  mtr_t* mtr __attribute__((unused)))
30369 {
30370  ;
30371
30372  return(btr_page_get_level_low(page));
30373 }
30374
30375
30376
30377 static inline
30378 void
30379 btr_page_set_level(
30380
30381  ib_page_t* page,
30382  ulint level,
30383  mtr_t* mtr)
30384 {
30385  ;
30386  ;
30387
30388  mlog_write_ulint(page + 38 + 26, level,
30389         ((unsigned char)2), mtr);
30390 }
30391
30392
30393
30394 static inline
30395 ulint
30396 btr_page_get_next(
30397
30398
30399  ib_page_t* page,
30400  mtr_t* mtr __attribute__((unused)))
30401 {
30402  ;
30403  ;
30404
30405
30406
30407
30408  return(mach_read_from_4(page + 12));
30409 }
30410
30411
30412
30413 static inline
30414 void
30415 btr_page_set_next(
30416
30417  ib_page_t* page,
30418  ulint next,
30419  mtr_t* mtr)
30420 {
30421  ;
30422
30423  mlog_write_ulint(page + 12, next, ((unsigned char)4), mtr);
30424 }
30425
30426
30427
30428 static inline
30429 ulint
30430 btr_page_get_prev(
30431
30432
30433  ib_page_t* page,
30434  mtr_t* mtr __attribute__((unused)))
30435 {
30436  ;
30437
30438  return(mach_read_from_4(page + 8));
30439 }
30440
30441
30442
30443 static inline
30444 void
30445 btr_page_set_prev(
30446
30447  ib_page_t* page,
30448  ulint prev,
30449  mtr_t* mtr)
30450 {
30451  ;
30452
30453  mlog_write_ulint(page + 8, prev, ((unsigned char)4), mtr);
30454 }
30455
30456
30457
30458 static inline
30459 ulint
30460 btr_node_ptr_get_child_page_no(
30461
30462
30463  rec_t* rec,
30464  const ulint* offsets)
30465 {
30466  unsigned char* field;
30467  ulint len;
30468  ulint page_no;
30469
30470  ;
30471
30472
30473  field = rec_get_nth_field(rec, offsets,
30474      rec_offs_n_fields(offsets) - 1, &len);
30475
30476  ;
30477
30478  page_no = mach_read_from_4(field);
30479
30480  if (__builtin_expect(page_no == 0, (0))) {
30481   fprintf(stderr,
30482 "InnoDB: a nonsensical page number 0 in a node ptr record at offset %lu\n",
30483    (ulong) ut_align_offset(rec, (2 * 8192)));
30484   buf_page_print(buf_frame_align(rec));
30485  }
30486
30487  return(page_no);
30488 }
30489
30490
30491
30492 static inline
30493 void
30494 btr_leaf_page_release(
30495
30496  ib_page_t* page,
30497  ulint latch_mode,
30498  mtr_t* mtr)
30499 {
30500  ;
30501
30502  if (latch_mode == 1) {
30503   mtr_memo_release(mtr, buf_block_align(page),
30504        1);
30505  } else {
30506   ;
30507   mtr_memo_release(mtr, buf_block_align(page),
30508        2);
30509  }
30510 }
30511 # 443 "./include/btr0btr.h" 2
30512 # 31 "buf/buf0buf.c" 2
30513 # 1 "./include/fil0fil.h" 1
30514 # 32 "buf/buf0buf.c" 2
30515 # 1 "./include/lock0lock.h" 1
30516 # 26 "./include/lock0lock.h"
30517 extern FILE* lock_latest_err_file;
30518
30519
30520
30521
30522 ulint
30523 lock_get_size(void);
30524
30525
30526
30527
30528
30529 void
30530 lock_sys_create(
30531
30532  ulint n_cells);
30533
30534
30535
30536
30537 trx_t*
30538 lock_sec_rec_some_has_impl_off_kernel(
30539
30540
30541
30542  rec_t* rec,
30543  dict_index_t* index,
30544  const ulint* offsets);
30545
30546
30547
30548 static inline
30549 trx_t*
30550 lock_clust_rec_some_has_impl(
30551
30552
30553
30554  rec_t* rec,
30555  dict_index_t* index,
30556  const ulint* offsets);
30557
30558
30559
30560
30561
30562 void
30563 lock_rec_inherit_to_gap(
30564
30565  rec_t* heir,
30566  rec_t* rec);
30567
30568
30569
30570
30571
30572
30573
30574 void
30575 lock_move_reorganize_page(
30576
30577  ib_page_t* page,
30578  ib_page_t* new_page);
30579
30580
30581
30582
30583 void
30584 lock_move_rec_list_end(
30585
30586  ib_page_t* new_page,
30587  ib_page_t* page,
30588  rec_t* rec);
30589
30590
30591
30592
30593
30594 void
30595 lock_move_rec_list_start(
30596
30597  ib_page_t* new_page,
30598  ib_page_t* page,
30599  rec_t* rec,
30600
30601  rec_t* old_end);
30602
30603
30604
30605
30606 void
30607 lock_update_split_right(
30608
30609  ib_page_t* right_page,
30610  ib_page_t* left_page);
30611
30612
30613
30614 void
30615 lock_update_merge_right(
30616
30617  rec_t* orig_succ,
30618
30619  ib_page_t* left_page);
30620 # 138 "./include/lock0lock.h"
30621 void
30622 lock_update_root_raise(
30623
30624  ib_page_t* new_page,
30625  ib_page_t* root);
30626
30627
30628
30629
30630 void
30631 lock_update_copy_and_discard(
30632
30633  ib_page_t* new_page,
30634  ib_page_t* page);
30635
30636
30637
30638 void
30639 lock_update_split_left(
30640
30641  ib_page_t* right_page,
30642  ib_page_t* left_page);
30643
30644
30645
30646 void
30647 lock_update_merge_left(
30648
30649  ib_page_t* left_page,
30650  rec_t* orig_pred,
30651
30652  ib_page_t* right_page);
30653
30654
30655
30656
30657
30658 void
30659 lock_rec_reset_and_inherit_gap_locks(
30660
30661  rec_t* heir,
30662  rec_t* rec);
30663
30664
30665
30666 void
30667 lock_update_discard(
30668
30669  rec_t* heir,
30670  ib_page_t* page);
30671
30672
30673
30674 void
30675 lock_update_insert(
30676
30677  rec_t* rec);
30678
30679
30680
30681 void
30682 lock_update_delete(
30683
30684  rec_t* rec);
30685 # 210 "./include/lock0lock.h"
30686 void
30687 lock_rec_store_on_page_infimum(
30688
30689  ib_page_t* page,
30690  rec_t* rec);
30691
30692
30693
30694
30695
30696
30697 void
30698 lock_rec_restore_from_page_infimum(
30699
30700  rec_t* rec,
30701  ib_page_t* page);
30702
30703
30704
30705
30706
30707 ulint
30708 lock_rec_expl_exist_on_page(
30709
30710
30711
30712  ulint space,
30713  ulint page_no);
30714
30715
30716
30717
30718
30719
30720
30721 ulint
30722 lock_rec_insert_check_and_lock(
30723
30724
30725
30726  ulint flags,
30727
30728  rec_t* rec,
30729  dict_index_t* index,
30730  que_thr_t* thr,
30731  ulint* inherit);
30732 # 266 "./include/lock0lock.h"
30733 ulint
30734 lock_clust_rec_modify_check_and_lock(
30735
30736
30737
30738  ulint flags,
30739
30740  rec_t* rec,
30741  dict_index_t* index,
30742  const ulint* offsets,
30743  que_thr_t* thr);
30744
30745
30746
30747
30748 ulint
30749 lock_sec_rec_modify_check_and_lock(
30750
30751
30752
30753  ulint flags,
30754
30755  rec_t* rec,
30756
30757
30758
30759  dict_index_t* index,
30760  que_thr_t* thr);
30761
30762
30763
30764
30765 ulint
30766 lock_sec_rec_read_check_and_lock(
30767
30768
30769
30770  ulint flags,
30771
30772  rec_t* rec,
30773
30774
30775  dict_index_t* index,
30776  const ulint* offsets,
30777  ulint mode,
30778
30779
30780  ulint gap_mode,
30781
30782  que_thr_t* thr);
30783 # 324 "./include/lock0lock.h"
30784 ulint
30785 lock_clust_rec_read_check_and_lock(
30786
30787
30788
30789  ulint flags,
30790
30791  rec_t* rec,
30792
30793
30794  dict_index_t* index,
30795  const ulint* offsets,
30796  ulint mode,
30797
30798
30799  ulint gap_mode,
30800
30801  que_thr_t* thr);
30802 # 352 "./include/lock0lock.h"
30803 ulint
30804 lock_clust_rec_read_check_and_lock_alt(
30805
30806
30807
30808  ulint flags,
30809
30810  rec_t* rec,
30811
30812
30813  dict_index_t* index,
30814  ulint mode,
30815
30816
30817  ulint gap_mode,
30818
30819  que_thr_t* thr);
30820
30821
30822
30823 ulint
30824 lock_clust_rec_cons_read_sees(
30825
30826
30827
30828  rec_t* rec,
30829
30830  dict_index_t* index,
30831  const ulint* offsets,
30832  read_view_t* view);
30833
30834
30835
30836 ulint
30837 lock_sec_rec_cons_read_sees(
30838 # 396 "./include/lock0lock.h"
30839  rec_t* rec,
30840
30841  dict_index_t* index,
30842  read_view_t* view);
30843
30844
30845
30846
30847 ulint
30848 lock_table(
30849
30850
30851
30852  ulint flags,
30853
30854  dict_table_t* table,
30855  ulint mode,
30856  que_thr_t* thr);
30857
30858
30859
30860 ulint
30861 lock_is_on_table(
30862
30863
30864  dict_table_t* table);
30865
30866
30867
30868
30869
30870 void
30871 lock_rec_unlock(
30872
30873  trx_t* trx,
30874
30875  rec_t* rec,
30876  ulint lock_mode);
30877
30878
30879
30880
30881 void
30882 lock_table_unlock(
30883
30884  ib_lock_t* lock);
30885
30886
30887
30888
30889 void
30890 lock_table_unlock_auto_inc(
30891
30892  trx_t* trx);
30893
30894
30895
30896
30897 void
30898 lock_release_off_kernel(
30899
30900  trx_t* trx);
30901
30902
30903
30904
30905 void
30906 lock_cancel_waiting_and_release(
30907
30908  ib_lock_t* lock);
30909
30910
30911
30912
30913 void
30914 lock_reset_all_on_table(
30915
30916  dict_table_t* table);
30917
30918
30919
30920 static inline
30921 ulint
30922 lock_rec_fold(
30923
30924
30925  ulint space,
30926  ulint page_no);
30927
30928
30929
30930 static inline
30931 ulint
30932 lock_rec_hash(
30933
30934
30935  ulint space,
30936  ulint page_no);
30937
30938
30939
30940
30941 dict_table_t*
30942 lock_get_src_table(
30943
30944
30945
30946
30947
30948
30949  trx_t* trx,
30950  dict_table_t* dest,
30951  ulint* mode);
30952
30953
30954
30955
30956
30957 ulint
30958 lock_is_table_exclusive(
30959
30960
30961
30962  dict_table_t* table,
30963  trx_t* trx);
30964
30965
30966
30967 ulint
30968 lock_check_trx_id_sanity(
30969
30970
30971  dulint trx_id,
30972  rec_t* rec,
30973  dict_index_t* index,
30974  const ulint* offsets,
30975  ulint has_kernel_mutex);
30976
30977
30978
30979
30980 ulint
30981 lock_rec_queue_validate(
30982
30983
30984  rec_t* rec,
30985  dict_index_t* index,
30986  const ulint* offsets);
30987
30988
30989
30990 void
30991 lock_table_print(
30992
30993  FILE* file,
30994  ib_lock_t* lock);
30995
30996
30997
30998 void
30999 lock_rec_print(
31000
31001  FILE* file,
31002  ib_lock_t* lock);
31003
31004
31005
31006 void
31007 lock_print_info_summary(
31008
31009  FILE* file);
31010
31011
31012
31013 void
31014 lock_print_info_all_transactions(
31015
31016  FILE* file);
31017
31018
31019
31020 ulint
31021 lock_table_queue_validate(
31022
31023
31024  dict_table_t* table);
31025
31026
31027
31028 ulint
31029 lock_rec_validate_page(
31030
31031
31032  ulint space,
31033  ulint page_no);
31034
31035
31036
31037 ulint
31038 lock_validate(void);
31039
31040
31041
31042
31043 extern lock_sys_t* lock_sys;
31044 # 659 "./include/lock0lock.h"
31045 typedef struct lock_op_struct lock_op_t;
31046 struct lock_op_struct{
31047  dict_table_t* table;
31048  ulint mode;
31049 };
31050
31051
31052
31053
31054
31055 struct lock_sys_struct{
31056  hash_table_t* rec_hash;
31057 };
31058
31059
31060 extern lock_sys_t* lock_sys;
31061
31062
31063
31064 # 1 "./include/lock0lock.ic" 1
31065 # 12 "./include/lock0lock.ic"
31066 # 1 "./include/row0row.h" 1
31067 # 24 "./include/row0row.h"
31068 static inline
31069 dulint
31070 row_get_rec_trx_id(
31071
31072
31073  rec_t* rec,
31074  dict_index_t* index,
31075  const ulint* offsets);
31076
31077
31078 static inline
31079 dulint
31080 row_get_rec_roll_ptr(
31081
31082
31083  rec_t* rec,
31084  dict_index_t* index,
31085  const ulint* offsets);
31086
31087
31088 static inline
31089 void
31090 row_set_rec_trx_id(
31091
31092  rec_t* rec,
31093  dict_index_t* index,
31094  const ulint* offsets,
31095  dulint trx_id);
31096
31097
31098 static inline
31099 void
31100 row_set_rec_roll_ptr(
31101
31102  rec_t* rec,
31103  dict_index_t* index,
31104  const ulint* offsets,
31105  dulint roll_ptr);
31106
31107
31108
31109
31110 dtuple_t*
31111 row_build_index_entry(
31112
31113
31114  dtuple_t* row,
31115
31116  dict_index_t* index,
31117  mem_heap_t* heap);
31118
31119
31120
31121
31122
31123 dtuple_t*
31124 row_build(
31125
31126
31127  ulint type,
31128
31129
31130
31131
31132
31133  dict_index_t* index,
31134  rec_t* rec,
31135
31136
31137
31138
31139
31140
31141  const ulint* offsets,
31142
31143
31144  mem_heap_t* heap);
31145
31146
31147
31148
31149 dtuple_t*
31150 row_rec_to_index_entry(
31151
31152
31153
31154  ulint type,
31155
31156
31157
31158  dict_index_t* index,
31159  rec_t* rec,
31160
31161
31162
31163
31164
31165
31166  mem_heap_t* heap);
31167
31168
31169
31170
31171
31172 dtuple_t*
31173 row_build_row_ref(
31174
31175
31176
31177  ulint type,
31178
31179
31180
31181  dict_index_t* index,
31182  rec_t* rec,
31183
31184
31185
31186
31187
31188
31189  mem_heap_t* heap);
31190
31191
31192
31193
31194
31195 void
31196 row_build_row_ref_in_tuple(
31197
31198  dtuple_t* ref,
31199
31200  dict_index_t* index,
31201  rec_t* rec,
31202
31203
31204
31205
31206
31207  trx_t* trx);
31208
31209
31210
31211
31212 void
31213 row_build_row_ref_from_row(
31214
31215  dtuple_t* ref,
31216
31217
31218  dict_table_t* table,
31219  dtuple_t* row);
31220
31221
31222
31223
31224
31225 static inline
31226 void
31227 row_build_row_ref_fast(
31228
31229  dtuple_t* ref,
31230
31231  const ulint* map,
31232
31233
31234  rec_t* rec,
31235
31236
31237  const ulint* offsets);
31238
31239
31240
31241
31242 ulint
31243 row_search_on_row_ref(
31244
31245
31246  btr_pcur_t* pcur,
31247
31248  ulint mode,
31249  dict_table_t* table,
31250  dtuple_t* ref,
31251  mtr_t* mtr);
31252
31253
31254
31255
31256 rec_t*
31257 row_get_clust_rec(
31258
31259
31260  ulint mode,
31261  rec_t* rec,
31262  dict_index_t* index,
31263  dict_index_t** clust_index,
31264  mtr_t* mtr);
31265
31266
31267
31268 ulint
31269 row_search_index_entry(
31270
31271
31272  dict_index_t* index,
31273  dtuple_t* entry,
31274  ulint mode,
31275  btr_pcur_t* pcur,
31276
31277  mtr_t* mtr);
31278 # 249 "./include/row0row.h"
31279 # 1 "./include/row0row.ic" 1
31280 # 17 "./include/row0row.ic"
31281 dulint
31282 row_get_rec_sys_field(
31283
31284
31285  ulint type,
31286  rec_t* rec,
31287  dict_index_t* index,
31288  const ulint* offsets);
31289
31290
31291
31292
31293 void
31294 row_set_rec_sys_field(
31295
31296
31297  ulint type,
31298  rec_t* rec,
31299  dict_index_t* index,
31300  const ulint* offsets,
31301  dulint val);
31302
31303
31304
31305 static inline
31306 dulint
31307 row_get_rec_trx_id(
31308
31309
31310  rec_t* rec,
31311  dict_index_t* index,
31312  const ulint* offsets)
31313 {
31314  ulint offset;
31315
31316  ;
31317  ;
31318
31319  offset = index->trx_id_offset;
31320
31321  if (offset) {
31322   return(trx_read_trx_id(rec + offset));
31323  } else {
31324   return(row_get_rec_sys_field(1,
31325     rec, index, offsets));
31326  }
31327 }
31328
31329
31330
31331 static inline
31332 dulint
31333 row_get_rec_roll_ptr(
31334
31335
31336  rec_t* rec,
31337  dict_index_t* index,
31338  const ulint* offsets)
31339 {
31340  ulint offset;
31341
31342  ;
31343  ;
31344
31345  offset = index->trx_id_offset;
31346
31347  if (offset) {
31348   return(trx_read_roll_ptr(rec + offset + 6));
31349  } else {
31350   return(row_get_rec_sys_field(2,
31351     rec, index, offsets));
31352  }
31353 }
31354
31355
31356
31357 static inline
31358 void
31359 row_set_rec_trx_id(
31360
31361  rec_t* rec,
31362  dict_index_t* index,
31363  const ulint* offsets,
31364  dulint trx_id)
31365 {
31366  ulint offset;
31367
31368  ;
31369  ;
31370
31371  offset = index->trx_id_offset;
31372
31373  if (offset) {
31374   trx_write_trx_id(rec + offset, trx_id);
31375  } else {
31376   row_set_rec_sys_field(1,
31377     rec, index, offsets, trx_id);
31378  }
31379 }
31380
31381
31382
31383 static inline
31384 void
31385 row_set_rec_roll_ptr(
31386
31387  rec_t* rec,
31388  dict_index_t* index,
31389  const ulint* offsets,
31390  dulint roll_ptr)
31391 {
31392  ulint offset;
31393
31394  ;
31395  ;
31396
31397  offset = index->trx_id_offset;
31398
31399  if (offset) {
31400   trx_write_roll_ptr(rec + offset + 6, roll_ptr);
31401  } else {
31402    row_set_rec_sys_field(2,
31403     rec, index, offsets, roll_ptr);
31404  }
31405 }
31406
31407
31408
31409
31410 static inline
31411 void
31412 row_build_row_ref_fast(
31413
31414  dtuple_t* ref,
31415
31416  const ulint* map,
31417
31418
31419  rec_t* rec,
31420
31421
31422  const ulint* offsets)
31423 {
31424  dfield_t* dfield;
31425  unsigned char* field;
31426  ulint len;
31427  ulint ref_len;
31428  ulint field_no;
31429  ulint i;
31430
31431  ;
31432  ref_len = dtuple_get_n_fields(ref);
31433
31434  for (i = 0; i < ref_len; i++) {
31435   dfield = dtuple_get_nth_field(ref, i);
31436
31437   field_no = *(map + i);
31438
31439   if (field_no != ((ulint)(-1))) {
31440
31441    field = rec_get_nth_field(rec, offsets,
31442       field_no, &len);
31443    dfield_set_data(dfield, field, len);
31444   }
31445  }
31446 }
31447 # 250 "./include/row0row.h" 2
31448 # 13 "./include/lock0lock.ic" 2
31449
31450
31451
31452
31453
31454 # 1 "./include/row0vers.h" 1
31455 # 26 "./include/row0vers.h"
31456 trx_t*
31457 row_vers_impl_x_locked_off_kernel(
31458
31459
31460
31461
31462  rec_t* rec,
31463  dict_index_t* index,
31464  const ulint* offsets);
31465
31466
31467
31468
31469 ulint
31470 row_vers_must_preserve_del_marked(
31471
31472
31473  dulint trx_id,
31474  mtr_t* mtr);
31475 # 53 "./include/row0vers.h"
31476 ulint
31477 row_vers_old_has_index_entry(
31478
31479
31480  ulint also_curr,
31481
31482
31483  rec_t* rec,
31484
31485  mtr_t* mtr,
31486
31487  dict_index_t* index,
31488  dtuple_t* ientry);
31489
31490
31491
31492
31493
31494 ulint
31495 row_vers_build_for_consistent_read(
31496
31497
31498  rec_t* rec,
31499
31500
31501
31502  mtr_t* mtr,
31503
31504  dict_index_t* index,
31505  ulint** offsets,
31506
31507  read_view_t* view,
31508  mem_heap_t** offset_heap,
31509
31510  mem_heap_t* in_heap,
31511
31512
31513
31514  rec_t** old_vers);
31515
31516
31517
31518
31519
31520 # 1 "./include/row0vers.ic" 1
31521 # 11 "./include/row0vers.ic"
31522 # 1 "./include/read0read.h" 1
31523 # 24 "./include/read0read.h"
31524 read_view_t*
31525 read_view_open_now(
31526
31527
31528  trx_t* cr_trx,
31529  mem_heap_t* heap);
31530
31531
31532
31533
31534 read_view_t*
31535 read_view_oldest_copy_or_open_new(
31536
31537
31538  trx_t* cr_trx,
31539  mem_heap_t* heap);
31540
31541
31542
31543 void
31544 read_view_close(
31545
31546  read_view_t* view);
31547
31548
31549
31550
31551 void
31552 read_view_close_for_mysql(
31553
31554  trx_t* trx);
31555
31556
31557 static inline
31558 ulint
31559 read_view_sees_trx_id(
31560
31561
31562  read_view_t* view,
31563  dulint trx_id);
31564
31565
31566
31567 void
31568 read_view_print(
31569
31570  read_view_t* view);
31571
31572
31573
31574
31575
31576 cursor_view_t*
31577 read_cursor_view_create_for_mysql(
31578
31579  trx_t* cr_trx);
31580
31581
31582
31583
31584 void
31585 read_cursor_view_close_for_mysql(
31586
31587  trx_t* trx,
31588  cursor_view_t* curview);
31589
31590
31591
31592
31593
31594 void
31595 read_cursor_set_for_mysql(
31596
31597  trx_t* trx,
31598  cursor_view_t* curview);
31599
31600
31601
31602
31603 struct read_view_struct{
31604  ulint can_be_too_old;
31605
31606
31607
31608  dulint low_limit_no;
31609
31610
31611
31612
31613  dulint low_limit_id;
31614
31615  dulint up_limit_id;
31616
31617  ulint n_trx_ids;
31618  dulint* trx_ids;
31619
31620
31621
31622
31623
31624  trx_t* creator;
31625
31626  struct { read_view_t * prev; read_view_t * next; } view_list;
31627
31628 };
31629
31630
31631
31632
31633
31634 struct cursor_view_struct{
31635  mem_heap_t* heap;
31636
31637  read_view_t* read_view;
31638
31639  ulint n_mysql_tables_in_use;
31640
31641
31642 };
31643
31644
31645 # 1 "./include/read0read.ic" 1
31646 # 11 "./include/read0read.ic"
31647 static inline
31648 dulint
31649 read_view_get_nth_trx_id(
31650
31651
31652  read_view_t* view,
31653  ulint n)
31654 {
31655  ;
31656
31657  return(*(view->trx_ids + n));
31658 }
31659
31660
31661
31662 static inline
31663 void
31664 read_view_set_nth_trx_id(
31665
31666  read_view_t* view,
31667  ulint n,
31668  dulint trx_id)
31669 {
31670  ;
31671
31672  *(view->trx_ids + n) = trx_id;
31673 }
31674
31675
31676
31677 static inline
31678 ulint
31679 read_view_sees_trx_id(
31680
31681
31682  read_view_t* view,
31683  dulint trx_id)
31684 {
31685  ulint n_ids;
31686  int cmp;
31687  ulint i;
31688
31689  if (ut_dulint_cmp(trx_id, view->up_limit_id) < 0) {
31690
31691   return((1));
31692  }
31693
31694  if (ut_dulint_cmp(trx_id, view->low_limit_id) >= 0) {
31695
31696   return((0));
31697  }
31698
31699
31700
31701
31702
31703
31704  n_ids = view->n_trx_ids;
31705
31706  for (i = 0; i < n_ids; i++) {
31707
31708   cmp = ut_dulint_cmp(trx_id,
31709     read_view_get_nth_trx_id(view, n_ids - i - 1));
31710   if (cmp <= 0) {
31711    return(cmp < 0);
31712   }
31713  }
31714
31715  return((1));
31716 }
31717 # 146 "./include/read0read.h" 2
31718 # 12 "./include/row0vers.ic" 2
31719
31720 # 1 "./include/log0recv.h" 1
31721 # 16 "./include/log0recv.h"
31722 # 1 "./include/log0log.h" 1
31723 # 17 "./include/log0log.h"
31724 typedef struct log_struct log_t;
31725 typedef struct log_group_struct log_group_t;
31726 # 38 "./include/log0log.h"
31727 void
31728 log_fsp_current_free_limit_set_and_checkpoint(
31729
31730  ulint limit);
31731
31732
31733
31734 ulint
31735 log_calc_where_lsn_is(
31736
31737
31738  ib_longlong* log_file_offset,
31739
31740  dulint first_header_lsn,
31741
31742  dulint lsn,
31743
31744  ulint n_log_files,
31745
31746  ib_longlong log_file_size);
31747
31748
31749
31750
31751 static inline
31752 dulint
31753 log_reserve_and_write_fast(
31754
31755
31756
31757  unsigned char* str,
31758  ulint len,
31759  dulint* start_lsn,
31760  ulint* success);
31761
31762
31763 static inline
31764 void
31765 log_release(void);
31766
31767
31768
31769
31770
31771
31772 static inline
31773 void
31774 log_free_check(void);
31775
31776
31777
31778
31779
31780 dulint
31781 log_reserve_and_open(
31782
31783
31784  ulint len);
31785
31786
31787
31788
31789 void
31790 log_write_low(
31791
31792  unsigned char* str,
31793  ulint str_len);
31794
31795
31796
31797 dulint
31798 log_close(void);
31799
31800
31801
31802
31803 static inline
31804 dulint
31805 log_get_lsn(void);
31806
31807
31808
31809
31810
31811 void
31812 log_init(void);
31813
31814
31815
31816
31817 void
31818 log_group_init(
31819
31820  ulint id,
31821  ulint n_files,
31822  ulint file_size,
31823  ulint space_id,
31824
31825
31826  ulint archive_space_id);
31827
31828
31829
31830
31831
31832
31833
31834 void
31835 log_io_complete(
31836
31837  log_group_t* group);
31838
31839
31840
31841
31842 typedef enum {
31843  LOG_WRITE_FROM_DIRTY_BUFFER,
31844  LOG_WRITE_FROM_BACKGROUND_SYNC,
31845  LOG_WRITE_FROM_BACKGROUND_ASYNC,
31846  LOG_WRITE_FROM_INTERNAL,
31847  LOG_WRITE_FROM_CHECKPOINT_SYNC,
31848  LOG_WRITE_FROM_CHECKPOINT_ASYNC,
31849  LOG_WRITE_FROM_LOG_ARCHIVE,
31850  LOG_WRITE_FROM_COMMIT_SYNC,
31851  LOG_WRITE_FROM_COMMIT_ASYNC,
31852  LOG_WRITE_FROM_NUMBER
31853 } log_sync_type;
31854
31855
31856
31857
31858
31859
31860 void
31861 log_write_up_to(
31862
31863  dulint lsn,
31864
31865  ulint wait,
31866
31867  ulint flush_to_disk,
31868
31869  log_sync_type caller);
31870
31871
31872
31873 void
31874 log_buffer_flush_to_disk(void);
31875
31876
31877
31878
31879
31880 void
31881 log_buffer_flush_maybe_sync(void);
31882
31883
31884
31885
31886
31887
31888 ulint
31889 log_preflush_pool_modified_pages(
31890
31891
31892
31893
31894  dulint new_oldest,
31895
31896  ulint sync);
31897
31898
31899
31900
31901
31902
31903
31904 ulint
31905 log_checkpoint(
31906
31907
31908
31909  ulint sync,
31910
31911  ulint write_always);
31912 # 231 "./include/log0log.h"
31913 void
31914 log_make_checkpoint_at(
31915
31916  dulint lsn,
31917
31918
31919  ulint write_always);
31920 # 249 "./include/log0log.h"
31921 void
31922 logs_empty_and_mark_files_at_shutdown(void);
31923
31924
31925
31926
31927 void
31928 log_group_read_checkpoint_info(
31929
31930  log_group_t* group,
31931  ulint field);
31932
31933
31934
31935 void
31936 log_checkpoint_get_nth_group_info(
31937
31938  unsigned char* buf,
31939  ulint n,
31940  ulint* file_no,
31941  ulint* offset);
31942
31943
31944
31945 void
31946 log_groups_write_checkpoint_info(void);
31947
31948
31949
31950
31951
31952 void
31953 log_reset_first_header_and_checkpoint(
31954
31955  unsigned char* hdr_buf,
31956
31957  dulint start);
31958
31959
31960
31961
31962
31963 ulint
31964 log_archive_do(
31965
31966
31967
31968  ulint sync,
31969  ulint* n_bytes);
31970 # 306 "./include/log0log.h"
31971 ulint
31972 log_archive_stop(void);
31973
31974
31975
31976
31977
31978 ulint
31979 log_archive_start(void);
31980
31981
31982
31983
31984
31985 ulint
31986 log_archive_noarchivelog(void);
31987
31988
31989
31990
31991
31992 ulint
31993 log_archive_archivelog(void);
31994
31995
31996
31997
31998
31999 void
32000 log_archived_file_name_gen(
32001
32002  char* buf,
32003  ulint id,
32004  ulint file_no);
32005
32006
32007
32008
32009
32010
32011 void
32012 log_check_margins(void);
32013
32014
32015
32016
32017 void
32018 log_group_read_log_seg(
32019
32020  ulint type,
32021  unsigned char* buf,
32022  log_group_t* group,
32023  dulint start_lsn,
32024  dulint end_lsn);
32025
32026
32027
32028 void
32029 log_group_write_buf(
32030
32031  log_group_t* group,
32032  unsigned char* buf,
32033  ulint len,
32034
32035  dulint start_lsn,
32036
32037
32038  ulint new_data_offset);
32039 # 382 "./include/log0log.h"
32040 void
32041 log_group_set_fields(
32042
32043  log_group_t* group,
32044  dulint lsn);
32045
32046
32047
32048
32049
32050 ulint
32051 log_group_get_capacity(
32052
32053
32054  log_group_t* group);
32055
32056
32057 static inline
32058 ulint
32059 log_block_get_flush_bit(
32060
32061
32062
32063  unsigned char* log_block);
32064
32065
32066 static inline
32067 ulint
32068 log_block_get_hdr_no(
32069
32070
32071
32072  unsigned char* log_block);
32073
32074
32075 static inline
32076 ulint
32077 log_block_get_data_len(
32078
32079
32080
32081  unsigned char* log_block);
32082
32083
32084 static inline
32085 void
32086 log_block_set_data_len(
32087
32088  unsigned char* log_block,
32089  ulint len);
32090
32091
32092 static inline
32093 ulint
32094 log_block_calc_checksum(
32095
32096
32097  unsigned char* block);
32098
32099
32100 static inline
32101 ulint
32102 log_block_get_checksum(
32103
32104
32105  unsigned char* log_block);
32106
32107
32108 static inline
32109 void
32110 log_block_set_checksum(
32111
32112  unsigned char* log_block,
32113  ulint checksum);
32114
32115
32116 static inline
32117 ulint
32118 log_block_get_first_rec_group(
32119
32120
32121
32122  unsigned char* log_block);
32123
32124
32125 static inline
32126 void
32127 log_block_set_first_rec_group(
32128
32129  unsigned char* log_block,
32130  ulint offset);
32131
32132
32133 static inline
32134 ulint
32135 log_block_get_checkpoint_no(
32136
32137
32138  unsigned char* log_block);
32139
32140
32141 static inline
32142 void
32143 log_block_init(
32144
32145  unsigned char* log_block,
32146  dulint lsn);
32147
32148
32149
32150 static inline
32151 void
32152 log_block_init_in_old_format(
32153
32154  unsigned char* log_block,
32155  dulint lsn);
32156
32157
32158 static inline
32159 ulint
32160 log_block_convert_lsn_to_no(
32161
32162
32163  dulint lsn);
32164
32165
32166
32167 void
32168 log_print(
32169
32170  FILE* file);
32171
32172
32173
32174 ulint
32175 log_peek_lsn(
32176
32177
32178
32179        dulint* lsn);
32180
32181
32182
32183 void
32184 log_refresh_stats(void);
32185
32186
32187 extern log_t* log_sys;
32188 # 661 "./include/log0log.h"
32189 struct log_group_struct{
32190
32191  ulint id;
32192  ulint n_files;
32193  ulint file_size;
32194
32195  ulint space_id;
32196
32197  ulint state;
32198
32199  dulint lsn;
32200
32201  ulint lsn_offset;
32202  ulint n_pending_writes;
32203
32204  unsigned char** file_header_bufs;
32205
32206
32207  unsigned char** archive_file_header_bufs;
32208
32209  ulint archive_space_id;
32210
32211  ulint archived_file_no;
32212
32213  ulint archived_offset;
32214
32215
32216
32217  ulint next_archived_file_no;
32218
32219
32220
32221
32222
32223  ulint next_archived_offset;
32224
32225  dulint scanned_lsn;
32226
32227
32228  unsigned char* checkpoint_buf;
32229
32230  struct { log_group_t * prev; log_group_t * next; }
32231    log_groups;
32232 };
32233
32234 struct log_struct{
32235  unsigned char pad[64];
32236
32237
32238  dulint lsn;
32239  ulint buf_free;
32240
32241  ib_mutex_t mutex;
32242  unsigned char* buf;
32243  ulint buf_size;
32244  ulint max_buf_free;
32245
32246
32247  ulint old_buf_free;
32248
32249
32250  dulint old_lsn;
32251
32252  ulint check_flush_or_checkpoint;
32253 # 733 "./include/log0log.h"
32254  struct { ulint count; log_group_t * start; log_group_t * end; }
32255    log_groups;
32256
32257
32258
32259  ulint buf_next_to_write;
32260
32261
32262
32263
32264
32265
32266  dulint written_to_some_lsn;
32267
32268
32269
32270
32271
32272  dulint written_to_all_lsn;
32273
32274
32275
32276
32277
32278  dulint write_lsn;
32279
32280  ulint write_end_offset;
32281
32282
32283
32284  dulint current_flush_lsn;
32285
32286  dulint flushed_to_disk_lsn;
32287
32288
32289  ulint n_pending_writes;
32290
32291  ulint log_sync_callers[LOG_WRITE_FROM_NUMBER];
32292
32293  ulint log_sync_syncers[LOG_WRITE_FROM_NUMBER];
32294
32295  ulint n_syncs;
32296  ulint n_checkpoints;
32297
32298
32299
32300
32301  os_event_t no_flush_event;
32302
32303
32304
32305
32306
32307  ulint one_flushed;
32308
32309
32310  os_event_t one_flushed_event;
32311 # 798 "./include/log0log.h"
32312  ulint n_log_ios;
32313
32314  ulint n_log_ios_old;
32315
32316  time_t last_printout_time;
32317
32318
32319
32320         ulint log_group_capacity;
32321
32322
32323
32324
32325  ulint max_modified_age_async;
32326
32327
32328
32329
32330  ulint max_modified_age_sync;
32331
32332
32333
32334
32335  ulint adm_checkpoint_interval;
32336
32337
32338
32339
32340  ulint max_checkpoint_age_async;
32341
32342
32343
32344  ulint max_checkpoint_age;
32345
32346
32347
32348  dulint next_checkpoint_no;
32349
32350  dulint last_checkpoint_lsn;
32351
32352  dulint next_checkpoint_lsn;
32353
32354  ulint n_pending_checkpoint_writes;
32355
32356
32357  rw_lock_t checkpoint_lock;
32358
32359
32360
32361  unsigned char* checkpoint_buf;
32362
32363
32364  ulint archiving_state;
32365
32366  dulint archived_lsn;
32367
32368  ulint max_archived_lsn_age_async;
32369
32370
32371
32372  ulint max_archived_lsn_age;
32373
32374
32375  dulint next_archived_lsn;
32376
32377
32378
32379
32380
32381  ulint archiving_phase;
32382
32383  ulint n_pending_archive_ios;
32384
32385
32386  rw_lock_t archive_lock;
32387
32388
32389
32390  ulint archive_buf_size;
32391  unsigned char* archive_buf;
32392
32393  os_event_t archiving_on;
32394
32395
32396 };
32397 # 891 "./include/log0log.h"
32398 # 1 "./include/log0log.ic" 1
32399 # 17 "./include/log0log.ic"
32400 ulint
32401 log_check_log_recs(
32402
32403  unsigned char* buf,
32404
32405  ulint len,
32406  dulint buf_start_lsn);
32407
32408
32409
32410 static inline
32411 ulint
32412 log_block_get_flush_bit(
32413
32414
32415
32416  unsigned char* log_block)
32417 {
32418  if (0x80000000UL
32419   & mach_read_from_4(log_block + 0)) {
32420
32421   return((1));
32422  }
32423
32424  return((0));
32425 }
32426
32427
32428
32429 static inline
32430 void
32431 log_block_set_flush_bit(
32432
32433  unsigned char* log_block,
32434  ulint val)
32435 {
32436  ulint field;
32437
32438  field = mach_read_from_4(log_block + 0);
32439
32440  if (val) {
32441   field = field | 0x80000000UL;
32442  } else {
32443   field = field & ~0x80000000UL;
32444  }
32445
32446  mach_write_to_4(log_block + 0, field);
32447 }
32448
32449
32450
32451 static inline
32452 ulint
32453 log_block_get_hdr_no(
32454
32455
32456
32457  unsigned char* log_block)
32458 {
32459  return(~0x80000000UL
32460   & mach_read_from_4(log_block + 0));
32461 }
32462
32463
32464
32465
32466 static inline
32467 void
32468 log_block_set_hdr_no(
32469
32470  unsigned char* log_block,
32471  ulint n)
32472
32473 {
32474  ;
32475  ;
32476
32477  mach_write_to_4(log_block + 0, n);
32478 }
32479
32480
32481
32482 static inline
32483 ulint
32484 log_block_get_data_len(
32485
32486
32487
32488  unsigned char* log_block)
32489 {
32490  return(mach_read_from_2(log_block + 4));
32491 }
32492
32493
32494
32495 static inline
32496 void
32497 log_block_set_data_len(
32498
32499  unsigned char* log_block,
32500  ulint len)
32501 {
32502  mach_write_to_2(log_block + 4, len);
32503 }
32504
32505
32506
32507 static inline
32508 ulint
32509 log_block_get_first_rec_group(
32510
32511
32512
32513  unsigned char* log_block)
32514 {
32515  return(mach_read_from_2(log_block + 6));
32516 }
32517
32518
32519
32520 static inline
32521 void
32522 log_block_set_first_rec_group(
32523
32524  unsigned char* log_block,
32525  ulint offset)
32526 {
32527  mach_write_to_2(log_block + 6, offset);
32528 }
32529
32530
32531
32532 static inline
32533 ulint
32534 log_block_get_checkpoint_no(
32535
32536
32537  unsigned char* log_block)
32538 {
32539  return(mach_read_from_4(log_block + 8));
32540 }
32541
32542
32543
32544 static inline
32545 void
32546 log_block_set_checkpoint_no(
32547
32548  unsigned char* log_block,
32549  dulint no)
32550 {
32551  mach_write_to_4(log_block + 8,
32552       ut_dulint_get_low(no));
32553 }
32554
32555
32556
32557 static inline
32558 ulint
32559 log_block_convert_lsn_to_no(
32560
32561
32562  dulint lsn)
32563 {
32564  ulint no;
32565
32566  no = ut_dulint_get_low(lsn) / 512;
32567  no += (ut_dulint_get_high(lsn) % 512)
32568   * 2 * (0x80000000UL / 512);
32569
32570  no = no & 0x3FFFFFFFUL;
32571
32572  return(no + 1);
32573 }
32574
32575
32576
32577 static inline
32578 ulint
32579 log_block_calc_checksum(
32580
32581
32582  unsigned char* block)
32583 {
32584  ulint sum;
32585  ulint sh;
32586  ulint i;
32587
32588  sum = 1;
32589  sh = 0;
32590
32591  for (i = 0; i < 512 - 4; i++) {
32592   sum = sum & 0x7FFFFFFFUL;
32593   sum += (((ulint)(*(block + i))) << sh) + (ulint)(*(block + i));
32594   sh++;
32595   if (sh > 24) {
32596    sh = 0;
32597   }
32598  }
32599
32600  return(sum);
32601 }
32602
32603
32604
32605 static inline
32606 ulint
32607 log_block_get_checksum(
32608
32609
32610  unsigned char* log_block)
32611 {
32612  return(mach_read_from_4(log_block + 512
32613      - 4));
32614 }
32615
32616
32617
32618 static inline
32619 void
32620 log_block_set_checksum(
32621
32622  unsigned char* log_block,
32623  ulint checksum)
32624 {
32625  mach_write_to_4(log_block + 512
32626      - 4,
32627      checksum);
32628 }
32629
32630
32631
32632 static inline
32633 void
32634 log_block_init(
32635
32636  unsigned char* log_block,
32637  dulint lsn)
32638 {
32639  ulint no;
32640
32641
32642
32643
32644
32645  no = log_block_convert_lsn_to_no(lsn);
32646
32647  log_block_set_hdr_no(log_block, no);
32648
32649  log_block_set_data_len(log_block, 12);
32650  log_block_set_first_rec_group(log_block, 0);
32651 }
32652
32653
32654
32655
32656 static inline
32657 void
32658 log_block_init_in_old_format(
32659
32660  unsigned char* log_block,
32661  dulint lsn)
32662 {
32663  ulint no;
32664
32665
32666
32667
32668
32669  no = log_block_convert_lsn_to_no(lsn);
32670
32671  log_block_set_hdr_no(log_block, no);
32672  mach_write_to_4(log_block + 512
32673      - 4, no);
32674  log_block_set_data_len(log_block, 12);
32675  log_block_set_first_rec_group(log_block, 0);
32676 }
32677
32678
32679
32680
32681 static inline
32682 dulint
32683 log_reserve_and_write_fast(
32684
32685
32686
32687  unsigned char* str,
32688  ulint len,
32689  dulint* start_lsn,
32690  ulint* success)
32691 {
32692  log_t* log = log_sys;
32693  ulint data_len;
32694  dulint lsn;
32695
32696  *success = (1);
32697
32698  mutex_enter_func((&(log->mutex)), "./include/log0log.ic", 315);
32699
32700  data_len = len + log->buf_free % 512;
32701
32702  if (data_len >= 512 - 4) {
32703
32704
32705
32706
32707       *success = (0);
32708
32709   mutex_exit(&(log->mutex));
32710
32711       return(ut_dulint_zero);
32712  }
32713
32714  *start_lsn = log->lsn;
32715
32716  ut_memcpy(log->buf + log->buf_free, str, len);
32717
32718  log_block_set_data_len(ut_align_down(log->buf + log->buf_free,
32719        512),
32720     data_len);
32721
32722
32723
32724
32725  log->buf_free += len;
32726
32727  ;
32728
32729  lsn = ut_dulint_add(log->lsn, len);
32730
32731  log->lsn = lsn;
32732
32733
32734
32735
32736
32737  return(lsn);
32738 }
32739
32740
32741
32742 static inline
32743 void
32744 log_release(void)
32745
32746 {
32747  mutex_exit(&(log_sys->mutex));
32748 }
32749
32750
32751
32752 static inline
32753 dulint
32754 log_get_lsn(void)
32755
32756
32757 {
32758  dulint lsn;
32759
32760  mutex_enter_func((&(log_sys->mutex)), "./include/log0log.ic", 377);
32761
32762  lsn = log_sys->lsn;
32763
32764  mutex_exit(&(log_sys->mutex));
32765
32766  return(lsn);
32767 }
32768
32769
32770
32771
32772
32773
32774 static inline
32775 void
32776 log_free_check(void)
32777
32778 {
32779
32780
32781  if (log_sys->check_flush_or_checkpoint) {
32782
32783   log_check_margins();
32784  }
32785 }
32786 # 892 "./include/log0log.h" 2
32787 # 17 "./include/log0recv.h" 2
32788 # 25 "./include/log0recv.h"
32789 ulint
32790 recv_read_cp_info_for_backup(
32791
32792
32793  unsigned char* hdr,
32794  dulint* lsn,
32795  ulint* offset,
32796  ulint* fsp_limit,
32797
32798  dulint* cp_no,
32799  dulint* first_header_lsn);
32800
32801
32802
32803
32804
32805 void
32806 recv_scan_log_seg_for_backup(
32807
32808  unsigned char* buf,
32809  ulint buf_len,
32810  dulint* scanned_lsn,
32811
32812  ulint* scanned_checkpoint_no,
32813
32814
32815
32816  ulint* n_bytes_scanned);
32817
32818
32819
32820
32821 static inline
32822 ulint
32823 recv_recovery_is_on(void);
32824
32825
32826
32827 static inline
32828 ulint
32829 recv_recovery_from_backup_is_on(void);
32830
32831
32832
32833
32834
32835
32836 void
32837 recv_recover_page(
32838
32839  ulint recover_backup,
32840
32841
32842
32843  ulint just_read_in,
32844
32845  ib_page_t* page,
32846  ulint space,
32847  ulint page_no);
32848
32849
32850
32851
32852
32853
32854 ulint
32855 recv_recovery_from_checkpoint_start(
32856
32857
32858  ulint type,
32859  dulint limit_lsn,
32860  dulint min_flushed_lsn,
32861  dulint max_flushed_lsn);
32862
32863
32864
32865 void
32866 recv_recovery_from_checkpoint_finish(void);
32867
32868
32869
32870
32871
32872 ulint
32873 recv_scan_log_recs(
32874
32875
32876
32877  ulint apply_automatically,
32878
32879
32880
32881
32882  ulint available_memory,
32883
32884  ulint store_to_hash,
32885
32886
32887  unsigned char* buf,
32888
32889  ulint len,
32890  dulint start_lsn,
32891  dulint* contiguous_lsn,
32892
32893  dulint* group_scanned_lsn);
32894
32895
32896
32897 void
32898 recv_reset_logs(
32899
32900  dulint lsn,
32901
32902
32903
32904
32905
32906  ulint new_logs_created);
32907 # 161 "./include/log0recv.h"
32908 void
32909 recv_sys_create(void);
32910
32911
32912
32913
32914 void
32915 recv_sys_init(
32916
32917  ulint recover_from_backup,
32918
32919  ulint available_memory);
32920
32921
32922
32923
32924 void
32925 recv_apply_hashed_log_recs(
32926
32927  ulint allow_ibuf);
32928 # 220 "./include/log0recv.h"
32929 void
32930 recv_compare_spaces(
32931
32932  ulint space1,
32933  ulint space2,
32934  ulint n_pages);
32935
32936
32937
32938
32939
32940
32941 void
32942 recv_compare_spaces_low(
32943
32944  ulint space1,
32945  ulint space2,
32946  ulint n_pages);
32947
32948
32949 typedef struct recv_data_struct recv_data_t;
32950 struct recv_data_struct{
32951  recv_data_t* next;
32952
32953
32954
32955 };
32956
32957
32958 typedef struct recv_struct recv_t;
32959 struct recv_struct{
32960  unsigned char type;
32961  ulint len;
32962  recv_data_t* data;
32963
32964  dulint start_lsn;
32965
32966
32967
32968  dulint end_lsn;
32969
32970
32971
32972  struct { recv_t * prev; recv_t * next; }
32973    rec_list;
32974 };
32975
32976
32977 typedef struct recv_addr_struct recv_addr_t;
32978 struct recv_addr_struct{
32979  ulint state;
32980
32981  ulint space;
32982  ulint page_no;
32983  struct { ulint count; recv_t * start; recv_t * end; }
32984    rec_list;
32985  hash_node_t addr_hash;
32986 };
32987
32988
32989 typedef struct recv_sys_struct recv_sys_t;
32990 struct recv_sys_struct{
32991  ib_mutex_t mutex;
32992
32993
32994  ulint apply_log_recs;
32995
32996
32997
32998
32999  ulint apply_batch_on;
33000
33001
33002  dulint lsn;
33003  ulint last_log_buf_size;
33004
33005
33006  unsigned char* last_block;
33007
33008
33009  unsigned char* last_block_buf_start;
33010
33011
33012  unsigned char* buf;
33013  ulint len;
33014  dulint parse_start_lsn;
33015
33016
33017
33018
33019  dulint scanned_lsn;
33020
33021
33022  ulint scanned_checkpoint_no;
33023
33024
33025  ulint recovered_offset;
33026
33027
33028  dulint recovered_lsn;
33029
33030
33031  dulint limit_lsn;
33032
33033  ulint found_corrupt_log;
33034
33035
33036
33037
33038  log_group_t* archive_group;
33039
33040
33041  mem_heap_t* heap;
33042
33043  hash_table_t* addr_hash;
33044  ulint n_addrs;
33045
33046 };
33047
33048 extern recv_sys_t* recv_sys;
33049 extern ulint recv_recovery_on;
33050 extern ulint recv_no_ibuf_operations;
33051 extern ulint recv_needed_recovery;
33052
33053 extern ulint recv_lsn_checks_on;
33054
33055
33056
33057 extern ulint recv_max_parsed_page_no;
33058 # 369 "./include/log0recv.h"
33059 extern ulint recv_n_pool_free_frames;
33060
33061
33062 # 1 "./include/log0recv.ic" 1
33063 # 14 "./include/log0recv.ic"
33064 extern ulint recv_recovery_from_backup_on;
33065
33066
33067
33068 static inline
33069 ulint
33070 recv_recovery_is_on(void)
33071
33072 {
33073  return(recv_recovery_on);
33074 }
33075
33076
33077
33078 static inline
33079 ulint
33080 recv_recovery_from_backup_is_on(void)
33081
33082 {
33083  return(recv_recovery_from_backup_on);
33084 }
33085 # 373 "./include/log0recv.h" 2
33086 # 13 "./include/row0vers.ic" 2
33087 # 98 "./include/row0vers.h" 2
33088 # 19 "./include/lock0lock.ic" 2
33089 # 1 "./include/que0que.h" 1
33090 # 19 "./include/que0que.h"
33091 # 1 "./include/row0types.h" 1
33092 # 12 "./include/row0types.h"
33093 typedef struct plan_struct plan_t;
33094
33095 typedef struct upd_struct upd_t;
33096
33097 typedef struct upd_field_struct upd_field_t;
33098
33099 typedef struct upd_node_struct upd_node_t;
33100
33101 typedef struct del_node_struct del_node_t;
33102
33103 typedef struct ins_node_struct ins_node_t;
33104
33105 typedef struct sel_node_struct sel_node_t;
33106
33107 typedef struct open_node_struct open_node_t;
33108
33109 typedef struct fetch_node_struct fetch_node_t;
33110
33111 typedef struct row_printf_node_struct row_printf_node_t;
33112 typedef struct sel_buf_struct sel_buf_t;
33113
33114 typedef struct undo_node_struct undo_node_t;
33115
33116 typedef struct purge_node_struct purge_node_t;
33117 # 20 "./include/que0que.h" 2
33118 # 1 "./include/pars0types.h" 1
33119 # 12 "./include/pars0types.h"
33120 typedef struct sym_node_struct sym_node_t;
33121 typedef struct sym_tab_struct sym_tab_t;
33122 typedef struct pars_res_word_struct pars_res_word_t;
33123 typedef struct func_node_struct func_node_t;
33124 typedef struct order_node_struct order_node_t;
33125 typedef struct proc_node_struct proc_node_t;
33126 typedef struct elsif_node_struct elsif_node_t;
33127 typedef struct if_node_struct if_node_t;
33128 typedef struct while_node_struct while_node_t;
33129 typedef struct for_node_struct for_node_t;
33130 typedef struct return_node_struct return_node_t;
33131 typedef struct assign_node_struct assign_node_t;
33132 typedef struct col_assign_node_struct col_assign_node_t;
33133
33134 typedef struct { ulint count; sym_node_t * start; sym_node_t * end; } sym_node_list_t;
33135 # 21 "./include/que0que.h" 2
33136
33137
33138
33139 extern ulint que_trace_on;
33140
33141
33142
33143
33144 void
33145 que_graph_publish(
33146
33147  que_t* graph,
33148  sess_t* sess);
33149
33150
33151
33152 que_fork_t*
33153 que_fork_create(
33154
33155
33156  que_t* graph,
33157
33158
33159  que_node_t* parent,
33160  ulint fork_type,
33161  mem_heap_t* heap);
33162
33163
33164 static inline
33165 que_thr_t*
33166 que_fork_get_first_thr(
33167
33168  que_fork_t* fork);
33169
33170
33171 static inline
33172 que_node_t*
33173 que_fork_get_child(
33174
33175  que_fork_t* fork);
33176
33177
33178 static inline
33179 void
33180 que_node_set_parent(
33181
33182  que_node_t* node,
33183  que_node_t* parent);
33184
33185
33186
33187 que_thr_t*
33188 que_thr_create(
33189
33190
33191  que_fork_t* parent,
33192  mem_heap_t* heap);
33193
33194
33195
33196
33197
33198 ulint
33199 que_graph_try_free(
33200
33201
33202  que_t* graph);
33203
33204
33205
33206
33207 void
33208 que_graph_free_recursive(
33209
33210  que_node_t* node);
33211
33212
33213
33214 void
33215 que_graph_free(
33216
33217  que_t* graph);
33218 # 112 "./include/que0que.h"
33219 ulint
33220 que_thr_stop(
33221
33222
33223  que_thr_t* thr);
33224
33225
33226
33227
33228 void
33229 que_thr_move_to_run_state_for_mysql(
33230
33231  que_thr_t* thr,
33232  trx_t* trx);
33233
33234
33235
33236
33237 void
33238 que_thr_stop_for_mysql_no_error(
33239
33240  que_thr_t* thr,
33241  trx_t* trx);
33242
33243
33244
33245
33246
33247
33248 void
33249 que_thr_stop_for_mysql(
33250
33251  que_thr_t* thr);
33252
33253
33254
33255
33256
33257 void
33258 que_run_threads(
33259
33260  que_thr_t* thr);
33261
33262
33263
33264
33265
33266 void
33267 que_fork_error_handle(
33268
33269  trx_t* trx,
33270  que_t* fork);
33271
33272
33273
33274
33275
33276 void
33277 que_thr_handle_error(
33278
33279  que_thr_t* thr,
33280  ulint err_no,
33281  unsigned char* err_str,
33282
33283
33284  ulint err_len);
33285
33286
33287
33288
33289
33290
33291 void
33292 que_thr_end_wait(
33293
33294  que_thr_t* thr,
33295
33296
33297
33298  que_thr_t** next_thr);
33299
33300
33301
33302
33303
33304
33305
33306 void
33307 que_thr_end_wait_no_next_thr(
33308
33309  que_thr_t* thr);
33310 # 212 "./include/que0que.h"
33311 que_thr_t*
33312 que_fork_start_command(
33313
33314
33315
33316
33317
33318  que_fork_t* fork);
33319
33320
33321 static inline
33322 trx_t*
33323 thr_get_trx(
33324
33325  que_thr_t* thr);
33326
33327
33328 static inline
33329 ulint
33330 que_node_get_type(
33331
33332  que_node_t* node);
33333
33334
33335 static inline
33336 dtype_t*
33337 que_node_get_data_type(
33338
33339  que_node_t* node);
33340
33341
33342 static inline
33343 dfield_t*
33344 que_node_get_val(
33345
33346  que_node_t* node);
33347
33348
33349 static inline
33350 ulint
33351 que_node_get_val_buf_size(
33352
33353
33354
33355  que_node_t* node);
33356
33357
33358 static inline
33359 void
33360 que_node_set_val_buf_size(
33361
33362  que_node_t* node,
33363  ulint size);
33364
33365
33366 static inline
33367 que_node_t*
33368 que_node_get_next(
33369
33370  que_node_t* node);
33371
33372
33373 static inline
33374 que_node_t*
33375 que_node_get_parent(
33376
33377
33378  que_node_t* node);
33379
33380
33381 static inline
33382 que_node_t*
33383 que_node_list_add_last(
33384
33385
33386  que_node_t* node_list,
33387  que_node_t* node);
33388
33389
33390 static inline
33391 ulint
33392 que_node_list_get_len(
33393
33394
33395  que_node_t* node_list);
33396
33397
33398
33399 static inline
33400 ulint
33401 que_thr_peek_stop(
33402
33403
33404
33405
33406
33407
33408  que_thr_t* thr);
33409
33410
33411 static inline
33412 ulint
33413 que_graph_is_select(
33414
33415
33416  que_t* graph);
33417
33418
33419
33420 void
33421 que_node_print_info(
33422
33423  que_node_t* node);
33424
33425
33426
33427
33428
33429 struct que_thr_struct{
33430  que_common_t common;
33431  ulint magic_n;
33432
33433  que_node_t* child;
33434  que_t* graph;
33435  ulint is_active;
33436
33437
33438
33439
33440  ulint state;
33441  struct { que_thr_t * prev; que_thr_t * next; }
33442    thrs;
33443
33444  struct { que_thr_t * prev; que_thr_t * next; }
33445    trx_thrs;
33446
33447  struct { que_thr_t * prev; que_thr_t * next; }
33448    queue;
33449
33450
33451
33452
33453
33454  que_node_t* run_node;
33455
33456
33457  que_node_t* prev_node;
33458
33459  ulint resource;
33460
33461    ulint lock_state;
33462
33463 };
33464
33465
33466
33467
33468
33469 struct que_fork_struct{
33470  que_common_t common;
33471  que_t* graph;
33472  ulint fork_type;
33473  ulint n_active_thrs;
33474
33475
33476
33477
33478  trx_t* trx;
33479
33480  ulint state;
33481  que_thr_t* caller;
33482
33483  struct { ulint count; que_thr_t * start; que_thr_t * end; }
33484    thrs;
33485
33486
33487  sym_tab_t* sym_tab;
33488
33489
33490
33491
33492  ulint cur_end;
33493
33494  ulint cur_pos;
33495
33496
33497
33498
33499  ulint cur_on_row;
33500
33501
33502  dulint n_inserts;
33503  dulint n_updates;
33504  dulint n_deletes;
33505  sel_node_t* last_sel_node;
33506
33507  struct { que_fork_t * prev; que_fork_t * next; }
33508    graphs;
33509
33510
33511  mem_heap_t* heap;
33512
33513
33514 };
33515 # 499 "./include/que0que.h"
33516 # 1 "./include/que0que.ic" 1
33517 # 9 "./include/que0que.ic"
33518 # 1 "./include/usr0sess.h" 1
33519 # 25 "./include/usr0sess.h"
33520 sess_t*
33521 sess_open(void);
33522
33523
33524
33525
33526
33527
33528 ulint
33529 sess_try_close(
33530
33531
33532  sess_t* sess);
33533
33534
33535 struct sess_struct{
33536  ulint state;
33537  trx_t* trx;
33538
33539
33540
33541
33542  struct { ulint count; que_t * start; que_t * end; }
33543    graphs;
33544
33545 };
33546
33547
33548
33549
33550
33551
33552
33553 # 1 "./include/usr0sess.ic" 1
33554 # 59 "./include/usr0sess.h" 2
33555 # 10 "./include/que0que.ic" 2
33556
33557
33558
33559 static inline
33560 trx_t*
33561 thr_get_trx(
33562
33563  que_thr_t* thr)
33564 {
33565  ;
33566
33567  return(thr->graph->trx);
33568 }
33569
33570
33571
33572 static inline
33573 que_thr_t*
33574 que_fork_get_first_thr(
33575
33576  que_fork_t* fork)
33577 {
33578  return((fork->thrs).start);
33579 }
33580
33581
33582
33583 static inline
33584 que_node_t*
33585 que_fork_get_child(
33586
33587  que_fork_t* fork)
33588 {
33589  que_thr_t* thr;
33590
33591  thr = (fork->thrs).start;
33592
33593  return(thr->child);
33594 }
33595
33596
33597
33598 static inline
33599 ulint
33600 que_node_get_type(
33601
33602  que_node_t* node)
33603 {
33604  ;
33605
33606  return(((que_common_t*)node)->type);
33607 }
33608
33609
33610
33611 static inline
33612 dfield_t*
33613 que_node_get_val(
33614
33615  que_node_t* node)
33616 {
33617  ;
33618
33619  return(&(((que_common_t*)node)->val));
33620 }
33621
33622
33623
33624 static inline
33625 ulint
33626 que_node_get_val_buf_size(
33627
33628
33629
33630  que_node_t* node)
33631 {
33632  ;
33633
33634  return(((que_common_t*)node)->val_buf_size);
33635 }
33636
33637
33638
33639 static inline
33640 void
33641 que_node_set_val_buf_size(
33642
33643  que_node_t* node,
33644  ulint size)
33645 {
33646  ;
33647
33648  ((que_common_t*)node)->val_buf_size = size;
33649 }
33650
33651
33652
33653 static inline
33654 void
33655 que_node_set_parent(
33656
33657  que_node_t* node,
33658  que_node_t* parent)
33659 {
33660  ;
33661
33662  ((que_common_t*)node)->parent = parent;
33663 }
33664
33665
33666
33667 static inline
33668 dtype_t*
33669 que_node_get_data_type(
33670
33671  que_node_t* node)
33672 {
33673  ;
33674
33675  return(&(((que_common_t*)node)->val.type));
33676 }
33677
33678
33679
33680 static inline
33681 que_node_t*
33682 que_node_list_add_last(
33683
33684
33685  que_node_t* node_list,
33686  que_node_t* node)
33687 {
33688  que_common_t* cnode;
33689  que_common_t* cnode2;
33690
33691  cnode = node;
33692
33693  cnode->brother = ((void *)0);
33694
33695  if (node_list == ((void *)0)) {
33696
33697   return(node);
33698  }
33699
33700  cnode2 = node_list;
33701
33702  while (cnode2->brother != ((void *)0)) {
33703   cnode2 = cnode2->brother;
33704  }
33705
33706  cnode2->brother = node;
33707
33708  return(node_list);
33709 }
33710
33711
33712
33713 static inline
33714 que_node_t*
33715 que_node_get_next(
33716
33717
33718  que_node_t* node)
33719 {
33720  return(((que_common_t*)node)->brother);
33721 }
33722
33723
33724
33725 static inline
33726 ulint
33727 que_node_list_get_len(
33728
33729
33730  que_node_t* node_list)
33731 {
33732  que_common_t* cnode;
33733  ulint len;
33734
33735  cnode = node_list;
33736  len = 0;
33737
33738  while (cnode != ((void *)0)) {
33739   len++;
33740   cnode = cnode->brother;
33741  }
33742
33743  return(len);
33744 }
33745
33746
33747
33748 static inline
33749 que_node_t*
33750 que_node_get_parent(
33751
33752
33753  que_node_t* node)
33754 {
33755  return(((que_common_t*)node)->parent);
33756 }
33757
33758
33759
33760
33761 static inline
33762 ulint
33763 que_thr_peek_stop(
33764
33765
33766
33767
33768
33769
33770  que_thr_t* thr)
33771 {
33772  trx_t* trx;
33773  que_t* graph;
33774
33775  graph = thr->graph;
33776  trx = graph->trx;
33777
33778  if (graph->state != 1
33779      || trx->que_state == 2
33780      || ((trx->signals).count > 0
33781     && trx->que_state == 1)) {
33782   return((1));
33783  }
33784
33785  return((0));
33786 }
33787
33788
33789
33790 static inline
33791 ulint
33792 que_graph_is_select(
33793
33794
33795  que_t* graph)
33796 {
33797  if (graph->fork_type == 2
33798    || graph->fork_type == 1) {
33799
33800       return((1));
33801  }
33802
33803  return((0));
33804 }
33805 # 500 "./include/que0que.h" 2
33806 # 20 "./include/lock0lock.ic" 2
33807 # 1 "./include/btr0cur.h" 1
33808 # 19 "./include/btr0cur.h"
33809 # 1 "./include/ha0ha.h" 1
33810 # 19 "./include/ha0ha.h"
33811 static inline
33812 void*
33813 ha_search_and_get_data(
33814
33815
33816
33817
33818  hash_table_t* table,
33819  ulint fold);
33820
33821
33822
33823
33824 void
33825 ha_search_and_update_if_found(
33826
33827  hash_table_t* table,
33828  ulint fold,
33829  void* data,
33830  void* new_data);
33831
33832
33833
33834
33835 hash_table_t*
33836 ha_create(
33837
33838
33839  ulint in_btr_search,
33840
33841  ulint n,
33842  ulint n_mutexes,
33843
33844  ulint mutex_level);
33845
33846
33847
33848
33849
33850
33851 ulint
33852 ha_insert_for_fold(
33853
33854
33855
33856  hash_table_t* table,
33857  ulint fold,
33858
33859
33860
33861  void* data);
33862
33863
33864
33865 static inline
33866 ulint
33867 ha_insert_for_fold_mutex(
33868
33869
33870
33871  hash_table_t* table,
33872  ulint fold,
33873
33874
33875
33876  void* data);
33877
33878
33879
33880 void
33881 ha_delete(
33882
33883  hash_table_t* table,
33884  ulint fold,
33885  void* data);
33886
33887
33888
33889
33890 static inline
33891 ulint
33892 ha_search_and_delete_if_found(
33893
33894
33895  hash_table_t* table,
33896  ulint fold,
33897  void* data);
33898
33899
33900
33901
33902 void
33903 ha_remove_all_nodes_to_page(
33904
33905  hash_table_t* table,
33906  ulint fold,
33907  ib_page_t* page);
33908
33909
33910
33911 ulint
33912 ha_validate(
33913
33914
33915  hash_table_t* table,
33916  ulint start_index,
33917  ulint end_index);
33918
33919
33920
33921 void
33922 ha_print_info(
33923
33924  FILE* file,
33925  hash_table_t* table);
33926
33927
33928
33929 typedef struct ha_node_struct ha_node_t;
33930 struct ha_node_struct {
33931  ha_node_t* next;
33932  void* data;
33933  ulint fold;
33934 };
33935
33936
33937 # 1 "./include/ha0ha.ic" 1
33938 # 15 "./include/ha0ha.ic"
33939 void
33940 ha_delete_hash_node(
33941
33942  hash_table_t* table,
33943  ha_node_t* del_node);
33944
33945
33946
33947 static inline
33948 void*
33949 ha_node_get_data(
33950
33951
33952  ha_node_t* node)
33953 {
33954  return(node->data);
33955 }
33956
33957
33958
33959 static inline
33960 void
33961 ha_node_set_data(
33962
33963  ha_node_t* node,
33964  void* data)
33965 {
33966  node->data = data;
33967 }
33968
33969
33970
33971 static inline
33972 ha_node_t*
33973 ha_chain_get_next(
33974
33975
33976  ha_node_t* node)
33977 {
33978  return(node->next);
33979 }
33980
33981
33982
33983 static inline
33984 ha_node_t*
33985 ha_chain_get_first(
33986
33987
33988  hash_table_t* table,
33989  ulint fold)
33990 {
33991  return(hash_get_nth_cell(table, hash_calc_hash(fold, table))->node);
33992 }
33993
33994
33995
33996 static inline
33997 ha_node_t*
33998 ha_search(
33999
34000
34001
34002
34003  hash_table_t* table,
34004  ulint fold)
34005 {
34006  ha_node_t* node;
34007
34008
34009
34010
34011
34012  node = ha_chain_get_first(table, fold);
34013
34014  while (node) {
34015   if (node->fold == fold) {
34016
34017    return(node);
34018   }
34019
34020   node = ha_chain_get_next(node);
34021  }
34022
34023  return(((void *)0));
34024 }
34025
34026
34027
34028 static inline
34029 void*
34030 ha_search_and_get_data(
34031
34032
34033
34034
34035  hash_table_t* table,
34036  ulint fold)
34037 {
34038  ha_node_t* node;
34039
34040
34041
34042
34043
34044  node = ha_chain_get_first(table, fold);
34045
34046  while (node) {
34047   if (node->fold == fold) {
34048
34049    return(node->data);
34050   }
34051
34052   node = ha_chain_get_next(node);
34053  }
34054
34055  return(((void *)0));
34056 }
34057
34058
34059
34060 static inline
34061 ha_node_t*
34062 ha_search_with_data(
34063
34064
34065
34066  hash_table_t* table,
34067  ulint fold,
34068  void* data)
34069 {
34070  ha_node_t* node;
34071
34072
34073
34074
34075
34076  node = ha_chain_get_first(table, fold);
34077
34078  while (node) {
34079   if (node->data == data) {
34080
34081    return(node);
34082   }
34083
34084   node = ha_chain_get_next(node);
34085  }
34086
34087  return(((void *)0));
34088 }
34089
34090
34091
34092
34093 static inline
34094 ulint
34095 ha_search_and_delete_if_found(
34096
34097
34098  hash_table_t* table,
34099  ulint fold,
34100  void* data)
34101 {
34102  ha_node_t* node;
34103
34104
34105
34106
34107
34108  node = ha_search_with_data(table, fold, data);
34109
34110  if (node) {
34111   ha_delete_hash_node(table, node);
34112
34113   return((1));
34114  }
34115
34116  return((0));
34117 }
34118
34119
34120
34121
34122 static inline
34123 ulint
34124 ha_insert_for_fold_mutex(
34125
34126
34127
34128  hash_table_t* table,
34129  ulint fold,
34130
34131
34132
34133  void* data)
34134 {
34135  ulint ret;
34136
34137  hash_mutex_enter(table, fold);
34138
34139  ret = ha_insert_for_fold(table, fold, data);
34140
34141  hash_mutex_exit(table, fold);
34142
34143  return(ret);
34144 }
34145 # 146 "./include/ha0ha.h" 2
34146 # 20 "./include/btr0cur.h" 2
34147 # 32 "./include/btr0cur.h"
34148 static inline
34149 page_cur_t*
34150 btr_cur_get_page_cur(
34151
34152
34153  btr_cur_t* cursor);
34154
34155
34156 static inline
34157 rec_t*
34158 btr_cur_get_rec(
34159
34160
34161  btr_cur_t* cursor);
34162
34163
34164 static inline
34165 void
34166 btr_cur_invalidate(
34167
34168  btr_cur_t* cursor);
34169
34170
34171 static inline
34172 ib_page_t*
34173 btr_cur_get_page(
34174
34175
34176  btr_cur_t* cursor);
34177
34178
34179 static inline
34180 dict_tree_t*
34181 btr_cur_get_tree(
34182
34183
34184  btr_cur_t* cursor);
34185
34186
34187 static inline
34188 void
34189 btr_cur_position(
34190
34191  dict_index_t* index,
34192  rec_t* rec,
34193  btr_cur_t* cursor);
34194 # 86 "./include/btr0cur.h"
34195 void
34196 btr_cur_search_to_nth_level(
34197
34198  dict_index_t* index,
34199  ulint level,
34200  dtuple_t* tuple,
34201
34202
34203  ulint mode,
34204
34205
34206
34207
34208
34209
34210  ulint latch_mode,
34211 # 111 "./include/btr0cur.h"
34212  btr_cur_t* cursor,
34213
34214  ulint has_search_latch,
34215
34216
34217  mtr_t* mtr);
34218
34219
34220
34221 void
34222 btr_cur_open_at_index_side(
34223
34224  ulint from_left,
34225
34226  dict_index_t* index,
34227  ulint latch_mode,
34228  btr_cur_t* cursor,
34229  mtr_t* mtr);
34230
34231
34232
34233 void
34234 btr_cur_open_at_rnd_pos(
34235
34236  dict_index_t* index,
34237  ulint latch_mode,
34238  btr_cur_t* cursor,
34239  mtr_t* mtr);
34240
34241
34242
34243
34244
34245
34246
34247 ulint
34248 btr_cur_optimistic_insert(
34249
34250
34251
34252  ulint flags,
34253
34254
34255  btr_cur_t* cursor,
34256
34257  dtuple_t* entry,
34258  rec_t** rec,
34259
34260  big_rec_t** big_rec,
34261
34262
34263  que_thr_t* thr,
34264  mtr_t* mtr);
34265
34266
34267
34268
34269
34270
34271 ulint
34272 btr_cur_pessimistic_insert(
34273
34274
34275  ulint flags,
34276
34277
34278
34279
34280
34281  btr_cur_t* cursor,
34282
34283  dtuple_t* entry,
34284  rec_t** rec,
34285
34286  big_rec_t** big_rec,
34287
34288
34289  que_thr_t* thr,
34290  mtr_t* mtr);
34291
34292
34293
34294 ulint
34295 btr_cur_update_in_place(
34296
34297
34298  ulint flags,
34299  btr_cur_t* cursor,
34300
34301
34302  upd_t* update,
34303  ulint cmpl_info,
34304
34305  que_thr_t* thr,
34306  mtr_t* mtr);
34307
34308
34309
34310
34311
34312
34313 ulint
34314 btr_cur_optimistic_update(
34315
34316
34317
34318
34319  ulint flags,
34320  btr_cur_t* cursor,
34321
34322
34323  upd_t* update,
34324
34325  ulint cmpl_info,
34326
34327  que_thr_t* thr,
34328  mtr_t* mtr);
34329
34330
34331
34332
34333
34334
34335 ulint
34336 btr_cur_pessimistic_update(
34337
34338
34339  ulint flags,
34340
34341  btr_cur_t* cursor,
34342  big_rec_t** big_rec,
34343
34344  upd_t* update,
34345
34346
34347  ulint cmpl_info,
34348
34349  que_thr_t* thr,
34350  mtr_t* mtr);
34351
34352
34353
34354
34355
34356
34357 ulint
34358 btr_cur_del_mark_set_clust_rec(
34359
34360
34361
34362  ulint flags,
34363  btr_cur_t* cursor,
34364  ulint val,
34365  que_thr_t* thr,
34366  mtr_t* mtr);
34367
34368
34369
34370 ulint
34371 btr_cur_del_mark_set_sec_rec(
34372
34373
34374
34375  ulint flags,
34376  btr_cur_t* cursor,
34377  ulint val,
34378  que_thr_t* thr,
34379  mtr_t* mtr);
34380
34381
34382
34383
34384 void
34385 btr_cur_del_unmark_for_ibuf(
34386
34387  rec_t* rec,
34388  mtr_t* mtr);
34389
34390
34391
34392
34393
34394
34395
34396 void
34397 btr_cur_compress(
34398
34399  btr_cur_t* cursor,
34400
34401  mtr_t* mtr);
34402
34403
34404
34405
34406
34407
34408
34409 ulint
34410 btr_cur_compress_if_useful(
34411
34412
34413  btr_cur_t* cursor,
34414
34415
34416  mtr_t* mtr);
34417
34418
34419
34420
34421
34422 ulint
34423 btr_cur_optimistic_delete(
34424
34425
34426
34427  btr_cur_t* cursor,
34428
34429
34430
34431  mtr_t* mtr);
34432 # 339 "./include/btr0cur.h"
34433 ulint
34434 btr_cur_pessimistic_delete(
34435
34436
34437  ulint* err,
34438
34439
34440
34441
34442  ulint has_reserved_extents,
34443
34444
34445
34446  btr_cur_t* cursor,
34447
34448
34449
34450  ulint in_rollback,
34451  mtr_t* mtr);
34452
34453
34454
34455 unsigned char*
34456 btr_cur_parse_update_in_place(
34457
34458
34459  unsigned char* ptr,
34460  unsigned char* end_ptr,
34461  ib_page_t* page,
34462  dict_index_t* index);
34463
34464
34465
34466
34467 unsigned char*
34468 btr_cur_parse_del_mark_set_clust_rec(
34469
34470
34471  unsigned char* ptr,
34472  unsigned char* end_ptr,
34473  dict_index_t* index,
34474  ib_page_t* page);
34475
34476
34477
34478
34479 unsigned char*
34480 btr_cur_parse_del_mark_set_sec_rec(
34481
34482
34483  unsigned char* ptr,
34484  unsigned char* end_ptr,
34485  ib_page_t* page);
34486
34487
34488
34489 ib_longlong
34490 btr_estimate_n_rows_in_range(
34491
34492
34493  dict_index_t* index,
34494  dtuple_t* tuple1,
34495  ulint mode1,
34496  dtuple_t* tuple2,
34497  ulint mode2);
34498
34499
34500
34501
34502
34503 void
34504 btr_estimate_number_of_different_key_vals(
34505
34506  dict_index_t* index);
34507
34508
34509
34510
34511
34512
34513 void
34514 btr_cur_mark_extern_inherited_fields(
34515
34516  rec_t* rec,
34517  const ulint* offsets,
34518  upd_t* update,
34519  mtr_t* mtr);
34520
34521
34522
34523
34524
34525 void
34526 btr_cur_mark_dtuple_inherited_extern(
34527
34528  dtuple_t* entry,
34529
34530  ulint* ext_vec,
34531
34532  ulint n_ext_vec,
34533  upd_t* update);
34534
34535
34536
34537 void
34538 btr_cur_unmark_dtuple_extern_fields(
34539
34540  dtuple_t* entry,
34541  ulint* ext_vec,
34542
34543  ulint n_ext_vec);
34544
34545
34546
34547
34548
34549 ulint
34550 btr_store_big_rec_extern_fields(
34551
34552
34553  dict_index_t* index,
34554
34555  rec_t* rec,
34556  const ulint* offsets,
34557
34558
34559
34560  big_rec_t* big_rec_vec,
34561
34562  mtr_t* local_mtr);
34563
34564
34565
34566
34567
34568
34569
34570 void
34571 btr_free_externally_stored_field(
34572
34573  dict_index_t* index,
34574
34575
34576
34577
34578
34579
34580
34581  unsigned char* data,
34582
34583
34584  ulint local_len,
34585  ulint do_not_free_inherited,
34586
34587
34588  mtr_t* local_mtr);
34589
34590
34591
34592
34593
34594 void
34595 btr_rec_free_externally_stored_fields(
34596
34597  dict_index_t* index,
34598
34599  rec_t* rec,
34600  const ulint* offsets,
34601  ulint do_not_free_inherited,
34602
34603
34604  mtr_t* mtr);
34605
34606
34607
34608
34609
34610 unsigned char*
34611 btr_rec_copy_externally_stored_field(
34612
34613
34614  rec_t* rec,
34615  const ulint* offsets,
34616  ulint no,
34617  ulint* len,
34618  mem_heap_t* heap);
34619
34620
34621
34622
34623
34624
34625 unsigned char*
34626 btr_copy_externally_stored_field(
34627
34628
34629  ulint* len,
34630  unsigned char* data,
34631
34632
34633  ulint local_len,
34634  mem_heap_t* heap);
34635
34636
34637
34638
34639
34640
34641
34642 ulint
34643 btr_push_update_extern_fields(
34644
34645
34646  ulint* ext_vect,
34647
34648  const ulint* offsets,
34649  upd_t* update);
34650 # 568 "./include/btr0cur.h"
34651 typedef struct btr_path_struct btr_path_t;
34652 struct btr_path_struct{
34653  ulint nth_rec;
34654
34655
34656
34657
34658  ulint n_recs;
34659 };
34660
34661
34662
34663
34664
34665
34666 struct btr_cur_struct {
34667  dict_index_t* index;
34668  page_cur_t page_cur;
34669  ib_page_t* left_page;
34670
34671
34672
34673  que_thr_t* thr;
34674
34675
34676
34677
34678
34679
34680
34681  ulint flag;
34682
34683
34684  ulint tree_height;
34685
34686
34687  ulint up_match;
34688 # 618 "./include/btr0cur.h"
34689  ulint up_bytes;
34690
34691
34692
34693  ulint low_match;
34694
34695
34696
34697
34698
34699
34700
34701  ulint low_bytes;
34702
34703
34704
34705  ulint n_fields;
34706
34707  ulint n_bytes;
34708
34709  ulint fold;
34710
34711
34712  btr_path_t* path_arr;
34713
34714
34715
34716 };
34717 # 695 "./include/btr0cur.h"
34718 extern ulint btr_cur_n_non_sea;
34719 extern ulint btr_cur_n_sea;
34720 extern ulint btr_cur_n_non_sea_old;
34721 extern ulint btr_cur_n_sea_old;
34722
34723
34724
34725 void innobase_mysql_thd_init_innodb_scan_cont();
34726 void innobase_mysql_thd_increment_innodb_scan_cont(ulong length);
34727 void innobase_mysql_thd_init_innodb_scan_jump();
34728 void innobase_mysql_thd_increment_innodb_scan_jump(ulong length);
34729 void innobase_mysql_thd_init_innodb_scan_data();
34730 void innobase_mysql_thd_increment_innodb_scan_data(ulong length);
34731 void innobase_mysql_thd_init_innodb_scan_garbage();
34732 void innobase_mysql_thd_increment_innodb_scan_garbage(ulong length);
34733
34734
34735 # 1 "./include/btr0cur.ic" 1
34736 # 9 "./include/btr0cur.ic"
34737 # 1 "./include/btr0btr.h" 1
34738 # 10 "./include/btr0cur.ic" 2
34739
34740
34741
34742 static inline
34743 page_cur_t*
34744 btr_cur_get_page_cur(
34745
34746
34747  btr_cur_t* cursor)
34748 {
34749  return(&(cursor->page_cur));
34750 }
34751
34752
34753
34754 static inline
34755 rec_t*
34756 btr_cur_get_rec(
34757
34758
34759  btr_cur_t* cursor)
34760 {
34761  return(page_cur_get_rec(&(cursor->page_cur)));
34762 }
34763
34764
34765
34766 static inline
34767 void
34768 btr_cur_invalidate(
34769
34770  btr_cur_t* cursor)
34771 {
34772  page_cur_invalidate(&(cursor->page_cur));
34773 }
34774
34775
34776
34777 static inline
34778 ib_page_t*
34779 btr_cur_get_page(
34780
34781
34782  btr_cur_t* cursor)
34783 {
34784  return(buf_frame_align(page_cur_get_rec(&(cursor->page_cur))));
34785 }
34786
34787
34788
34789 static inline
34790 dict_tree_t*
34791 btr_cur_get_tree(
34792
34793
34794  btr_cur_t* cursor)
34795 {
34796  return((cursor->index)->tree);
34797 }
34798
34799
34800
34801 static inline
34802 void
34803 btr_cur_position(
34804
34805  dict_index_t* index,
34806  rec_t* rec,
34807  btr_cur_t* cursor)
34808 {
34809  page_cur_position(rec, btr_cur_get_page_cur(cursor));
34810
34811  cursor->index = index;
34812 }
34813
34814
34815
34816
34817 static inline
34818 ulint
34819 btr_cur_compress_recommendation(
34820
34821
34822  btr_cur_t* cursor,
34823  mtr_t* mtr)
34824 {
34825  ib_page_t* page;
34826
34827  ;
34828
34829
34830
34831  page = btr_cur_get_page(cursor);
34832
34833  if ((page_get_data_size(page) < ((2 * 8192) / 2))
34834       || ((btr_page_get_next(page, mtr) == 0xFFFFFFFF)
34835   && (btr_page_get_prev(page, mtr) == 0xFFFFFFFF))) {
34836
34837
34838
34839
34840
34841
34842   if (dict_tree_get_page((cursor->index)->tree)
34843       == buf_frame_get_page_no(page)) {
34844
34845
34846
34847        return((0));
34848   }
34849
34850   return((1));
34851  }
34852
34853  return((0));
34854 }
34855
34856
34857
34858
34859 static inline
34860 ulint
34861 btr_cur_can_delete_without_compress(
34862
34863
34864
34865  btr_cur_t* cursor,
34866  ulint rec_size,
34867  mtr_t* mtr)
34868 {
34869  ib_page_t* page;
34870
34871  ;
34872
34873
34874
34875  page = btr_cur_get_page(cursor);
34876
34877  if ((page_get_data_size(page) - rec_size < ((2 * 8192) / 2))
34878       || ((btr_page_get_next(page, mtr) == 0xFFFFFFFF)
34879   && (btr_page_get_prev(page, mtr) == 0xFFFFFFFF))
34880      || (page_get_n_recs(page) < 2)) {
34881
34882
34883
34884
34885
34886
34887   if (dict_tree_get_page((cursor->index)->tree)
34888       == buf_frame_get_page_no(page)) {
34889
34890
34891
34892        return((1));
34893   }
34894
34895   return((0));
34896  }
34897
34898  return((1));
34899 }
34900 # 713 "./include/btr0cur.h" 2
34901 # 21 "./include/lock0lock.ic" 2
34902
34903
34904
34905
34906
34907
34908 static inline
34909 ulint
34910 lock_rec_fold(
34911
34912
34913  ulint space,
34914  ulint page_no)
34915 {
34916  return(ut_fold_ulint_pair(space, page_no));
34917 }
34918
34919
34920
34921
34922 static inline
34923 ulint
34924 lock_rec_hash(
34925
34926
34927  ulint space,
34928  ulint page_no)
34929 {
34930  return(hash_calc_hash(lock_rec_fold(space, page_no),
34931        lock_sys->rec_hash));
34932 }
34933
34934
34935
34936
34937 static inline
34938 trx_t*
34939 lock_clust_rec_some_has_impl(
34940
34941
34942
34943  rec_t* rec,
34944  dict_index_t* index,
34945  const ulint* offsets)
34946 {
34947  dulint trx_id;
34948
34949
34950
34951
34952  ;
34953  ;
34954
34955  trx_id = row_get_rec_trx_id(rec, index, offsets);
34956
34957  if (trx_is_active(trx_id)) {
34958
34959
34960   return(trx_get_on_id(trx_id));
34961  }
34962
34963  return(((void *)0));
34964 }
34965 # 679 "./include/lock0lock.h" 2
34966 # 33 "buf/buf0buf.c" 2
34967 # 1 "./include/btr0sea.h" 1
34968 # 23 "./include/btr0sea.h"
34969 void
34970 btr_search_sys_create(
34971
34972  ulint hash_size);
34973
34974
34975 static inline
34976 btr_search_t*
34977 btr_search_get_info(
34978
34979
34980  dict_index_t* index);
34981
34982
34983
34984 btr_search_t*
34985 btr_search_info_create(
34986
34987
34988  mem_heap_t* heap);
34989
34990
34991
34992 ulint
34993 btr_search_info_get_ref_count(
34994
34995
34996  btr_search_t* info);
34997
34998
34999 static inline
35000 void
35001 btr_search_info_update(
35002
35003  dict_index_t* index,
35004  btr_cur_t* cursor);
35005
35006
35007
35008
35009
35010
35011 ulint
35012 btr_search_guess_on_hash(
35013
35014
35015  dict_index_t* index,
35016  btr_search_t* info,
35017  dtuple_t* tuple,
35018  ulint mode,
35019  ulint latch_mode,
35020  btr_cur_t* cursor,
35021  ulint has_search_latch,
35022
35023
35024  mtr_t* mtr);
35025
35026
35027
35028
35029
35030
35031 void
35032 btr_search_move_or_delete_hash_entries(
35033
35034  ib_page_t* new_page,
35035
35036  ib_page_t* page,
35037  dict_index_t* index);
35038
35039
35040
35041 void
35042 btr_search_drop_page_hash_index(
35043
35044  ib_page_t* page);
35045
35046
35047
35048
35049 void
35050 btr_search_drop_page_hash_when_freed(
35051
35052  ulint space,
35053  ulint page_no);
35054
35055
35056
35057 void
35058 btr_search_update_hash_node_on_insert(
35059
35060  btr_cur_t* cursor);
35061
35062
35063
35064
35065
35066
35067 void
35068 btr_search_update_hash_on_insert(
35069
35070  btr_cur_t* cursor);
35071
35072
35073
35074
35075
35076
35077 void
35078 btr_search_update_hash_on_delete(
35079
35080  btr_cur_t* cursor);
35081
35082
35083
35084
35085
35086 ulint
35087 btr_search_validate(void);
35088 # 153 "./include/btr0sea.h"
35089 struct btr_search_struct{
35090  ulint magic_n;
35091  ulint ref_count;
35092
35093
35094
35095
35096
35097
35098
35099  rec_t* last_search;
35100
35101  ulint n_direction;
35102
35103  ulint direction;
35104
35105
35106  dulint modify_clock;
35107
35108
35109
35110
35111
35112  ib_page_t* root_guess;
35113
35114  ulint hash_analysis;
35115
35116
35117  ulint last_hash_succ;
35118
35119
35120
35121
35122  ulint n_hash_potential;
35123
35124
35125
35126  ulint n_fields;
35127
35128  ulint n_bytes;
35129
35130  ulint side;
35131
35132
35133
35134
35135
35136  ulint n_hash_succ;
35137
35138  ulint n_hash_fail;
35139  ulint n_patt_succ;
35140
35141  ulint n_searches;
35142 };
35143
35144
35145
35146
35147
35148 typedef struct btr_search_sys_struct btr_search_sys_t;
35149
35150 struct btr_search_sys_struct{
35151  hash_table_t* hash_index;
35152 };
35153
35154 extern btr_search_sys_t* btr_search_sys;
35155 # 232 "./include/btr0sea.h"
35156 extern rw_lock_t* btr_search_latch_temp;
35157
35158
35159
35160
35161
35162
35163 extern ulint btr_search_n_hash_fail;
35164 # 267 "./include/btr0sea.h"
35165 # 1 "./include/btr0sea.ic" 1
35166 # 16 "./include/btr0sea.ic"
35167 void
35168 btr_search_info_update_slow(
35169
35170  btr_search_t* info,
35171  btr_cur_t* cursor);
35172
35173
35174
35175 static inline
35176 btr_search_t*
35177 btr_search_get_info(
35178
35179
35180  dict_index_t* index)
35181 {
35182  ;
35183
35184  return(index->search_info);
35185 }
35186
35187
35188
35189 static inline
35190 void
35191 btr_search_info_update(
35192
35193  dict_index_t* index,
35194  btr_cur_t* cursor)
35195 {
35196  btr_search_t* info;
35197
35198
35199
35200
35201
35202
35203  info = btr_search_get_info(index);
35204
35205  info->hash_analysis++;
35206
35207  if (info->hash_analysis < 17) {
35208
35209
35210
35211   return;
35212
35213  }
35214
35215  ;
35216
35217  btr_search_info_update_slow(info, cursor);
35218 }
35219 # 268 "./include/btr0sea.h" 2
35220 # 34 "buf/buf0buf.c" 2
35221 # 1 "./include/ibuf0ibuf.h" 1
35222 # 21 "./include/ibuf0ibuf.h"
35223 extern ibuf_t* ibuf;
35224
35225
35226
35227
35228
35229
35230
35231 ibuf_data_t*
35232 ibuf_data_init_for_space(
35233
35234
35235
35236  ulint space);
35237
35238
35239
35240
35241 void
35242 ibuf_init_at_db_start(void);
35243
35244
35245
35246
35247
35248 void
35249 ibuf_update_max_tablespace_id(void);
35250
35251
35252
35253
35254 void
35255 ibuf_bitmap_page_init(
35256
35257  ib_page_t* page,
35258  mtr_t* mtr);
35259
35260
35261
35262
35263
35264
35265 void
35266 ibuf_reset_free_bits_with_type(
35267
35268  ulint type,
35269  ib_page_t* page);
35270 # 76 "./include/ibuf0ibuf.h"
35271 void
35272 ibuf_reset_free_bits(
35273
35274  dict_index_t* index,
35275  ib_page_t* page);
35276
35277
35278
35279
35280
35281
35282
35283 static inline
35284 void
35285 ibuf_update_free_bits_if_full(
35286
35287  dict_index_t* index,
35288  ib_page_t* page,
35289
35290
35291
35292
35293  ulint max_ins_size,
35294
35295
35296  ulint increase);
35297
35298
35299
35300
35301
35302
35303
35304 void
35305 ibuf_update_free_bits_low(
35306
35307  dict_index_t* index,
35308  ib_page_t* page,
35309  ulint max_ins_size,
35310
35311
35312  mtr_t* mtr);
35313
35314
35315
35316
35317
35318 void
35319 ibuf_update_free_bits_for_two_pages_low(
35320
35321  dict_index_t* index,
35322  ib_page_t* page1,
35323  ib_page_t* page2,
35324  mtr_t* mtr);
35325
35326
35327
35328 static inline
35329 ulint
35330 ibuf_should_try(
35331
35332  dict_index_t* index,
35333  ulint ignore_sec_unique);
35334
35335
35336
35337
35338
35339
35340
35341 ulint
35342 ibuf_inside(void);
35343
35344
35345
35346
35347
35348 static inline
35349 ulint
35350 ibuf_bitmap_page(
35351
35352
35353  ulint page_no);
35354
35355
35356
35357 ulint
35358 ibuf_page(
35359
35360
35361  ulint space,
35362  ulint page_no);
35363
35364
35365
35366 ulint
35367 ibuf_page_low(
35368
35369
35370  ulint space,
35371  ulint page_no,
35372  mtr_t* mtr);
35373
35374
35375
35376
35377
35378
35379
35380 void
35381 ibuf_free_excess_pages(
35382
35383  ulint space);
35384
35385
35386
35387
35388
35389 ulint
35390 ibuf_insert(
35391
35392
35393  dtuple_t* entry,
35394  dict_index_t* index,
35395  ulint space,
35396  ulint page_no,
35397  que_thr_t* thr);
35398 # 211 "./include/ibuf0ibuf.h"
35399 void
35400 ibuf_merge_or_delete_for_page(
35401
35402  ib_page_t* page,
35403
35404  ulint space,
35405  ulint page_no,
35406  ulint update_ibuf_bitmap);
35407 # 228 "./include/ibuf0ibuf.h"
35408 void
35409 ibuf_delete_for_discarded_space(
35410
35411  ulint space);
35412
35413
35414
35415 ulint
35416 ibuf_contract(
35417
35418
35419
35420
35421  ulint sync);
35422
35423
35424
35425
35426
35427 ulint
35428 ibuf_contract_for_n_pages(
35429
35430
35431
35432
35433  ulint sync,
35434
35435
35436  ulint n_pages);
35437
35438
35439
35440
35441
35442 unsigned char*
35443 ibuf_parse_bitmap_init(
35444
35445
35446  unsigned char* ptr,
35447  unsigned char* end_ptr,
35448  ib_page_t* page,
35449  mtr_t* mtr);
35450
35451
35452
35453 ulint
35454 ibuf_count_get(
35455
35456
35457
35458  ulint space,
35459  ulint page_no);
35460
35461
35462
35463 ulint
35464 ibuf_is_empty(void);
35465
35466
35467
35468
35469
35470 void
35471 ibuf_print(
35472
35473  FILE* file);
35474 # 304 "./include/ibuf0ibuf.h"
35475 # 1 "./include/ibuf0ibuf.ic" 1
35476 # 12 "./include/ibuf0ibuf.ic"
35477 extern ulint ibuf_flush_count;
35478 # 21 "./include/ibuf0ibuf.ic"
35479 struct ibuf_data_struct{
35480  ulint space;
35481  ulint seg_size;
35482
35483  ulint size;
35484  ulint empty;
35485
35486
35487
35488  ulint free_list_len;
35489
35490  ulint height;
35491  dict_index_t* index;
35492  struct { ibuf_data_t * prev; ibuf_data_t * next; } data_list;
35493
35494  ulint n_inserts;
35495
35496  ulint n_merges;
35497  ulint n_merged_recs;
35498 };
35499
35500
35501
35502
35503
35504 struct ibuf_struct{
35505  ulint size;
35506
35507  ulint max_size;
35508
35509  ulint meter;
35510
35511
35512
35513  struct { ulint count; ibuf_data_t * start; ibuf_data_t * end; } data_list;
35514
35515
35516 };
35517
35518
35519
35520
35521
35522
35523
35524 void
35525 ibuf_set_free_bits(
35526
35527  ulint type,
35528  ib_page_t* page,
35529
35530  ulint val,
35531  ulint max_val);
35532
35533
35534
35535
35536
35537
35538 static inline
35539 ulint
35540 ibuf_should_try(
35541
35542  dict_index_t* index,
35543  ulint ignore_sec_unique)
35544
35545
35546
35547 {
35548  if (!(index->type & 1)
35549      && (ignore_sec_unique || !(index->type & 2))
35550      && ibuf->meter > 50) {
35551
35552   ibuf_flush_count++;
35553
35554   if (ibuf_flush_count % 8 == 0) {
35555
35556    buf_LRU_try_free_flushed_blocks();
35557   }
35558
35559   return((1));
35560  }
35561
35562  return((0));
35563 }
35564
35565
35566
35567 static inline
35568 ulint
35569 ibuf_bitmap_page(
35570
35571
35572  ulint page_no)
35573 {
35574  if (page_no % (2 * 8192) == 1) {
35575
35576   return((1));
35577  }
35578
35579  return((0));
35580 }
35581
35582
35583
35584 static inline
35585 ulint
35586 ibuf_index_page_calc_free_bits(
35587
35588
35589  ulint max_ins_size)
35590
35591 {
35592  ulint n;
35593
35594  n = max_ins_size / ((2 * 8192) / 32);
35595
35596  if (n == 3) {
35597   n = 2;
35598  }
35599
35600  if (n > 3) {
35601   n = 3;
35602  }
35603
35604  return(n);
35605 }
35606
35607
35608
35609 static inline
35610 ulint
35611 ibuf_index_page_calc_free_from_bits(
35612
35613
35614
35615  ulint bits)
35616 {
35617  ;
35618
35619  if (bits == 3) {
35620   return(4 * (2 * 8192) / 32);
35621  }
35622
35623  return(bits * (2 * 8192) / 32);
35624 }
35625
35626
35627
35628 static inline
35629 ulint
35630 ibuf_index_page_calc_free(
35631
35632
35633  ib_page_t* page)
35634 {
35635  return(ibuf_index_page_calc_free_bits(
35636   page_get_max_insert_size_after_reorganize(page, 1)));
35637 }
35638
35639
35640
35641
35642
35643
35644 static inline
35645 void
35646 ibuf_update_free_bits_if_full(
35647
35648  dict_index_t* index,
35649  ib_page_t* page,
35650
35651
35652
35653
35654  ulint max_ins_size,
35655
35656
35657  ulint increase)
35658
35659
35660 {
35661  ulint before;
35662  ulint after;
35663
35664  before = ibuf_index_page_calc_free_bits(max_ins_size);
35665
35666  if (max_ins_size >= increase) {
35667   ;
35668
35669   after = ibuf_index_page_calc_free_bits(max_ins_size
35670         - increase);
35671
35672
35673
35674  } else {
35675   after = ibuf_index_page_calc_free(page);
35676  }
35677
35678  if (after == 0) {
35679
35680
35681
35682
35683
35684   buf_page_make_young(page);
35685  }
35686
35687  if (before > after) {
35688   ibuf_set_free_bits(index->type, page, after, before);
35689  }
35690 }
35691 # 305 "./include/ibuf0ibuf.h" 2
35692 # 35 "buf/buf0buf.c" 2
35693 # 1 "./include/dict0dict.h" 1
35694 # 36 "buf/buf0buf.c" 2
35695 # 1 "./include/log0recv.h" 1
35696 # 37 "buf/buf0buf.c" 2
35697 # 1 "./include/log0log.h" 1
35698 # 38 "buf/buf0buf.c" 2
35699 # 1 "./include/trx0undo.h" 1
35700 # 39 "buf/buf0buf.c" 2
35701 # 1 "./include/srv0srv.h" 1
35702 # 40 "buf/buf0buf.c" 2
35703 # 1 "./include/trx0trx.h" 1
35704 # 41 "buf/buf0buf.c" 2
35705
35706
35707 trx_t* innobase_get_trx();
35708 # 229 "buf/buf0buf.c"
35709 static const int WAIT_FOR_READ = 20000;
35710
35711 buf_pool_t* buf_pool = ((void *)0);
35712 # 246 "buf/buf0buf.c"
35713 ulint
35714 buf_calc_page_new_checksum(
35715
35716
35717  unsigned char* page)
35718 {
35719    ulint checksum;
35720 # 262 "buf/buf0buf.c"
35721    checksum = ut_fold_binary(page + 4,
35722      26 - 4)
35723        + ut_fold_binary(page + 38,
35724                (2 * 8192) - 38
35725                - 8);
35726    checksum = checksum & 0xFFFFFFFFUL;
35727
35728    return(checksum);
35729 }
35730 # 280 "buf/buf0buf.c"
35731 ulint
35732 buf_calc_page_old_checksum(
35733
35734
35735  unsigned char* page)
35736 {
35737    ulint checksum;
35738
35739    checksum = ut_fold_binary(page, 26);
35740
35741    checksum = checksum & 0xFFFFFFFFUL;
35742
35743    return(checksum);
35744 }
35745
35746
35747
35748
35749 ulint
35750 buf_page_is_corrupted(
35751
35752
35753  unsigned char* read_buf)
35754 {
35755  ulint checksum;
35756  ulint old_checksum;
35757  ulint checksum_field;
35758  ulint old_checksum_field;
35759
35760  dulint current_lsn;
35761
35762  if (mach_read_from_4(read_buf + 16 + 4)
35763       != mach_read_from_4(read_buf + (2 * 8192)
35764     - 8 + 4)) {
35765
35766
35767
35768
35769   return((1));
35770  }
35771
35772
35773  if (recv_lsn_checks_on && log_peek_lsn(&current_lsn)) {
35774   if (ut_dulint_cmp(current_lsn,
35775       mach_read_from_8(read_buf + 16))
35776      < 0) {
35777    ut_print_timestamp(stderr);
35778
35779    fprintf(stderr,
35780 "  InnoDB: Error: page %lu log sequence number %lu %lu\n"
35781 "InnoDB: is in the future! Current system log sequence number %lu %lu.\n"
35782 "InnoDB: Your database may be corrupt or you may have copied the InnoDB\n"
35783 "InnoDB: tablespace but not the InnoDB log files. See\n"
35784 "InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html\n"
35785 "InnoDB: for more information.\n",
35786           (ulong) mach_read_from_4(read_buf + 4),
35787    (ulong) ut_dulint_get_high(
35788     mach_read_from_8(read_buf + 16)),
35789    (ulong) ut_dulint_get_low(
35790     mach_read_from_8(read_buf + 16)),
35791    (ulong) ut_dulint_get_high(current_lsn),
35792    (ulong) ut_dulint_get_low(current_lsn));
35793   }
35794  }
35795
35796
35797
35798
35799
35800
35801
35802   if (srv_use_checksums) {
35803     old_checksum = buf_calc_page_old_checksum(read_buf);
35804
35805     old_checksum_field = mach_read_from_4(read_buf + (2 * 8192)
35806      - 8);
35807
35808
35809
35810
35811
35812
35813     if (old_checksum_field != mach_read_from_4(read_buf + 16)
35814         && old_checksum_field != old_checksum
35815         && old_checksum_field != 0xDEADBEEFUL) {
35816
35817       return((1));
35818     }
35819
35820     checksum = buf_calc_page_new_checksum(read_buf);
35821     checksum_field = mach_read_from_4(read_buf + 0);
35822
35823
35824
35825
35826     if (checksum_field != 0 && checksum_field != checksum
35827         && checksum_field != 0xDEADBEEFUL) {
35828
35829       return((1));
35830     }
35831   }
35832
35833  return((0));
35834 }
35835
35836
35837
35838
35839 void
35840 buf_page_print(
35841
35842  unsigned char* read_buf)
35843 {
35844  dict_index_t* index;
35845  ulint checksum;
35846  ulint old_checksum;
35847
35848  ut_print_timestamp(stderr);
35849  fprintf(stderr, "  InnoDB: Page dump in ascii and hex (%lu bytes):\n",
35850   (ulint)(2 * 8192));
35851  ut_print_buf(stderr, read_buf, (2 * 8192));
35852  fputs("InnoDB: End of page dump\n", stderr);
35853
35854  checksum = srv_use_checksums ?
35855     buf_calc_page_new_checksum(read_buf) : 0xDEADBEEFUL;
35856  old_checksum = srv_use_checksums ?
35857     buf_calc_page_old_checksum(read_buf) : 0xDEADBEEFUL;
35858
35859  ut_print_timestamp(stderr);
35860  fprintf(stderr,
35861 "  InnoDB: Page checksum %lu, prior-to-4.0.14-form checksum %lu\n"
35862 "InnoDB: stored checksum %lu, prior-to-4.0.14-form stored checksum %lu\n",
35863    (ulong) checksum, (ulong) old_checksum,
35864    (ulong) mach_read_from_4(read_buf + 0),
35865    (ulong) mach_read_from_4(read_buf + (2 * 8192)
35866      - 8));
35867  fprintf(stderr,
35868 "InnoDB: Page lsn %lu %lu, low 4 bytes of lsn at page end %lu\n"
35869 "InnoDB: Page number (if stored to page already) %lu,\n"
35870 "InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) %lu\n",
35871   (ulong) mach_read_from_4(read_buf + 16),
35872   (ulong) mach_read_from_4(read_buf + 16 + 4),
35873   (ulong) mach_read_from_4(read_buf + (2 * 8192)
35874      - 8 + 4),
35875   (ulong) mach_read_from_4(read_buf + 4),
35876   (ulong) mach_read_from_4(read_buf + 34));
35877
35878  if (mach_read_from_2(read_buf + 38 + 0)
35879      == 1) {
35880       fprintf(stderr,
35881    "InnoDB: Page may be an insert undo log page\n");
35882  } else if (mach_read_from_2(read_buf + 38
35883       + 0)
35884       == 2) {
35885       fprintf(stderr,
35886    "InnoDB: Page may be an update undo log page\n");
35887  }
35888
35889  if (fil_page_get_type(read_buf) == 17855) {
35890       fprintf(stderr,
35891 "InnoDB: Page may be an index page where index id is %lu %lu\n",
35892    (ulong) ut_dulint_get_high(btr_page_get_index_id(read_buf)),
35893    (ulong) ut_dulint_get_low(btr_page_get_index_id(read_buf)));
35894
35895
35896
35897
35898   if (dict_sys != ((void *)0)) {
35899
35900           index = dict_index_find_on_id_low(
35901      btr_page_get_index_id(read_buf));
35902           if (index) {
35903     fputs("InnoDB: (", stderr);
35904     dict_index_name_print(stderr, ((void *)0), index);
35905     fputs(")\n", stderr);
35906    }
35907   }
35908  } else if (fil_page_get_type(read_buf) == 3) {
35909   fputs("InnoDB: Page may be an 'inode' page\n", stderr);
35910  } else if (fil_page_get_type(read_buf) == 4) {
35911   fputs("InnoDB: Page may be an insert buffer free list page\n",
35912    stderr);
35913  }
35914 }
35915
35916
35917
35918 static
35919 void
35920 buf_block_init(
35921
35922  buf_block_t* block,
35923  unsigned char* frame)
35924
35925 {
35926  block->magic_n = 0;
35927
35928  block->state = 211;
35929
35930  block->frame = frame;
35931
35932  block->awe_info = ((void *)0);
35933
35934  block->buf_fix_count = 0;
35935  block->io_fix = 0;
35936
35937  block->modify_clock = ut_dulint_zero;
35938
35939  block->file_page_was_freed = (0);
35940
35941  block->check_index_page_at_flush = (0);
35942  block->index = ((void *)0);
35943
35944  block->in_free_list = (0);
35945  block->in_LRU_list = (0);
35946
35947  block->n_pointers = 0;
35948
35949  mutex_create_func((&block->mutex), "buf/buf0buf.c", 498);
35950  mutex_set_level(&block->mutex, 149);
35951
35952  rw_lock_create_func((&(block->lock)), "buf/buf0buf.c", 501);
35953  ;
35954
35955
35956
35957
35958
35959 }
35960
35961
35962
35963
35964 buf_pool_t*
35965 buf_pool_init(
35966
35967
35968
35969  ulint max_size,
35970
35971  ulint curr_size,
35972
35973
35974  ulint n_frames)
35975
35976
35977
35978
35979 {
35980  unsigned char* frame;
35981  ulint i;
35982  buf_block_t* block;
35983
35984  do { if (__builtin_expect(!((ulint)(max_size == curr_size)), (0))) { ut_dbg_assertion_failed("max_size == curr_size", "buf/buf0buf.c", (ulint) 533); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 533); } while (0); } while (0);
35985  do { if (__builtin_expect(!((ulint)(srv_use_awe || n_frames == max_size)), (0))) { ut_dbg_assertion_failed("srv_use_awe || n_frames == max_size", "buf/buf0buf.c", (ulint) 534); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 534); } while (0); } while (0);
35986
35987  if (n_frames > curr_size) {
35988          fprintf(stderr,
35989 "InnoDB: AWE: Error: you must specify in my.cnf .._awe_mem_mb larger\n"
35990 "InnoDB: than .._buffer_pool_size. Now the former is %lu pages,\n"
35991 "InnoDB: the latter %lu pages.\n", (ulong) curr_size, (ulong) n_frames);
35992
35993   return(((void *)0));
35994  }
35995
35996  buf_pool = mem_alloc_func((sizeof(buf_pool_t)), "buf/buf0buf.c", 545);
35997
35998
35999
36000  mutex_create_func((&(buf_pool->mutex)), "buf/buf0buf.c", 549);
36001  mutex_set_level(&(buf_pool->mutex), 150);
36002
36003  mutex_create_func((&(buf_pool->flush_list_mutex)), "buf/buf0buf.c", 552);
36004  mutex_create_func((&(buf_pool->LRU_mutex)), "buf/buf0buf.c", 553);
36005  mutex_create_func((&(buf_pool->free_mutex)), "buf/buf0buf.c", 554);
36006  rw_lock_create_func((&(buf_pool->hash_latch)), "buf/buf0buf.c", 555);
36007  mutex_set_level(&(buf_pool->flush_list_mutex), 3000);
36008  mutex_set_level(&(buf_pool->LRU_mutex), 3000);
36009  mutex_set_level(&(buf_pool->free_mutex), 3000);
36010  rw_lock_set_level(&(buf_pool->hash_latch), 3000);
36011
36012  mutex_enter_func((&(buf_pool->LRU_mutex)), "buf/buf0buf.c", 561);
36013  mutex_enter_func((&(buf_pool->flush_list_mutex)), "buf/buf0buf.c", 562);
36014  mutex_enter_func((&(buf_pool->free_mutex)), "buf/buf0buf.c", 563);
36015  rw_lock_x_lock_func( (&(buf_pool->hash_latch)), 0, "buf/buf0buf.c", 564);
36016  mutex_enter_func((&(buf_pool->mutex)), "buf/buf0buf.c", 565);
36017
36018  if (srv_use_awe) {
36019
36020
36021
36022
36023   buf_pool->frame_mem = os_awe_allocate_virtual_mem_window(
36024      (2 * 8192) * (n_frames + 1));
36025
36026
36027
36028
36029   if ((curr_size % ((1024 * 1024) / (2 * 8192))) != 0) {
36030
36031           fprintf(stderr,
36032 "InnoDB: AWE: Error: physical memory must be allocated in full megabytes.\n"
36033 "InnoDB: Trying to allocate %lu database pages.\n",
36034      (ulong) curr_size);
36035
36036           return(((void *)0));
36037   }
36038
36039   if (!os_awe_allocate_physical_mem(&(buf_pool->awe_info),
36040    curr_size / ((1024 * 1024) / (2 * 8192)))) {
36041
36042    return(((void *)0));
36043   }
36044
36045  } else {
36046   buf_pool->frame_mem = os_mem_alloc_large(
36047      (2 * 8192) * (n_frames + 1),
36048      (1), (0));
36049  }
36050
36051  if (buf_pool->frame_mem == ((void *)0)) {
36052
36053   return(((void *)0));
36054  }
36055
36056  buf_pool->blocks = ut_malloc(sizeof(buf_block_t) * max_size);
36057
36058  if (buf_pool->blocks == ((void *)0)) {
36059
36060   return(((void *)0));
36061  }
36062
36063  buf_pool->max_size = max_size;
36064  buf_pool->curr_size = curr_size;
36065
36066  buf_pool->n_frames = n_frames;
36067
36068
36069
36070  frame = ut_align(buf_pool->frame_mem, (2 * 8192));
36071
36072  buf_pool->frame_zero = frame;
36073  buf_pool->high_end = frame + (2 * 8192) * n_frames;
36074
36075  if (srv_use_awe) {
36076
36077
36078
36079
36080   os_awe_map_physical_mem_to_window(buf_pool->frame_zero,
36081     n_frames *
36082     ((2 * 8192) / 4096),
36083      buf_pool->awe_info);
36084
36085  }
36086
36087  buf_pool->blocks_of_frames = ut_malloc(sizeof(void*) * n_frames);
36088
36089  if (buf_pool->blocks_of_frames == ((void *)0)) {
36090
36091   return(((void *)0));
36092  }
36093
36094
36095
36096
36097
36098
36099  for (i = 0; i < max_size; i++) {
36100
36101   block = buf_pool_get_nth_block(buf_pool, i);
36102
36103   if (i < n_frames) {
36104    frame = buf_pool->frame_zero + i * (2 * 8192);
36105    *(buf_pool->blocks_of_frames + i) = block;
36106   } else {
36107    frame = ((void *)0);
36108   }
36109
36110   buf_block_init(block, frame);
36111
36112   if (srv_use_awe) {
36113
36114    block->awe_info = buf_pool->awe_info
36115     + i * ((2 * 8192) / 4096);
36116
36117   }
36118  }
36119
36120  buf_pool->page_hash = hash0_create(2 * max_size);
36121  buf_pool->io_counter_hash = ((void *)0);
36122  buf_pool->io_counter_heap = ((void *)0);
36123  buf_pool->io_counters = 0;
36124
36125  buf_pool->n_pend_reads = 0;
36126
36127  buf_pool->last_printout_time = time(((void *)0));
36128
36129  buf_pool->n_pages_read = 0;
36130  buf_pool->n_pages_written = 0;
36131  buf_pool->n_pages_created = 0;
36132  buf_pool->n_pages_awe_remapped = 0;
36133
36134  buf_pool->n_page_gets = 0;
36135  buf_pool->n_page_gets_old = 0;
36136  buf_pool->n_pages_read_old = 0;
36137  buf_pool->n_pages_written_old = 0;
36138  buf_pool->n_pages_created_old = 0;
36139  buf_pool->n_pages_awe_remapped_old = 0;
36140
36141
36142
36143  { (buf_pool->flush_list).count = 0; (buf_pool->flush_list).start = ((void *)0); (buf_pool->flush_list).end = ((void *)0);};
36144
36145  for (i = 1; i <= 3; i++) {
36146   buf_pool->n_flush[i] = 0;
36147   buf_pool->init_flush[i] = (0);
36148   buf_pool->no_flush[i] = os_event_create(((void *)0));
36149  }
36150
36151  buf_pool->LRU_flush_ended = 0;
36152
36153  buf_pool->ulint_clock = 1;
36154  buf_pool->freed_page_clock = 0;
36155
36156
36157
36158  { (buf_pool->LRU).count = 0; (buf_pool->LRU).start = ((void *)0); (buf_pool->LRU).end = ((void *)0);};
36159
36160  buf_pool->LRU_old = ((void *)0);
36161
36162  { (buf_pool->awe_LRU_free_mapped).count = 0; (buf_pool->awe_LRU_free_mapped).start = ((void *)0); (buf_pool->awe_LRU_free_mapped).end = ((void *)0);};
36163
36164
36165  { (buf_pool->free).count = 0; (buf_pool->free).start = ((void *)0); (buf_pool->free).end = ((void *)0);};
36166
36167  for (i = 0; i < curr_size; i++) {
36168
36169   block = buf_pool_get_nth_block(buf_pool, i);
36170
36171   if (block->frame) {
36172
36173
36174
36175
36176
36177
36178    if (srv_use_awe) {
36179
36180
36181
36182     { ; ((buf_pool->awe_LRU_free_mapped).count)++; ((block)->awe_LRU_free_mapped).prev = (buf_pool->awe_LRU_free_mapped).end; ((block)->awe_LRU_free_mapped).next = ((void *)0); if ((buf_pool->awe_LRU_free_mapped).end != ((void *)0)) { (((buf_pool->awe_LRU_free_mapped).end)->awe_LRU_free_mapped).next = (block); } (buf_pool->awe_LRU_free_mapped).end = (block); if ((buf_pool->awe_LRU_free_mapped).start == ((void *)0)) { (buf_pool->awe_LRU_free_mapped).start = (block); }};
36183
36184    }
36185   }
36186
36187   { ; ((buf_pool->free).count)++; ((block)->free).prev = (buf_pool->free).end; ((block)->free).next = ((void *)0); if ((buf_pool->free).end != ((void *)0)) { (((buf_pool->free).end)->free).next = (block); } (buf_pool->free).end = (block); if ((buf_pool->free).start == ((void *)0)) { (buf_pool->free).start = (block); }};
36188   block->in_free_list = (1);
36189  }
36190
36191  mutex_exit(&(buf_pool->LRU_mutex));
36192  mutex_exit(&(buf_pool->flush_list_mutex));
36193  mutex_exit(&(buf_pool->free_mutex));
36194  rw_lock_x_unlock_func(&(buf_pool->hash_latch));
36195  mutex_exit(&(buf_pool->mutex));
36196
36197  if (srv_use_adaptive_hash_indexes) {
36198     btr_search_sys_create(
36199      curr_size * (2 * 8192) / sizeof(void*) / 64);
36200  } else {
36201
36202          btr_search_sys_create(1000);
36203  }
36204
36205  return(buf_pool);
36206 }
36207
36208
36209
36210
36211
36212 void
36213 buf_awe_map_page_to_frame(
36214
36215  buf_block_t* block,
36216
36217  ulint add_to_mapped_list)
36218
36219
36220
36221 {
36222  buf_block_t* bck;
36223
36224
36225
36226
36227  ;
36228
36229  if (block->frame) {
36230
36231   return;
36232  }
36233
36234
36235
36236
36237  bck = (buf_pool->awe_LRU_free_mapped).end;
36238
36239  while (bck) {
36240   ulint skip;
36241
36242   mutex_enter_func((&bck->mutex), "buf/buf0buf.c", 791);
36243
36244   skip = (bck->state == 213
36245    && (bck->buf_fix_count != 0 || bck->io_fix != 0));
36246
36247   if (skip) {
36248    mutex_exit(&bck->mutex);
36249
36250
36251    bck = (((bck)->awe_LRU_free_mapped).prev);
36252   } else {
36253
36254
36255    os_awe_map_physical_mem_to_window(
36256     bck->frame,
36257     (2 * 8192) / 4096,
36258     block->awe_info);
36259
36260    block->frame = bck->frame;
36261
36262    *(buf_pool->blocks_of_frames
36263     + (((ulint)(block->frame
36264       - buf_pool->frame_zero))
36265       >> 14))
36266     = block;
36267
36268    bck->frame = ((void *)0);
36269    { ; do { if (__builtin_expect(!((ulint)((buf_pool->awe_LRU_free_mapped).count > 0)), (0))) { ut_dbg_assertion_failed("(buf_pool->awe_LRU_free_mapped).count > 0", "buf/buf0buf.c", (ulint) 820); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 820); } while (0); } while (0); ((buf_pool->awe_LRU_free_mapped).count)--; if (((bck)->awe_LRU_free_mapped).next != ((void *)0)) { ((((bck)->awe_LRU_free_mapped).next)->awe_LRU_free_mapped).prev = ((bck)->awe_LRU_free_mapped).prev; } else { (buf_pool->awe_LRU_free_mapped).end = ((bck)->awe_LRU_free_mapped).prev; } if (((bck)->awe_LRU_free_mapped).prev != ((void *)0)) { ((((bck)->awe_LRU_free_mapped).prev)->awe_LRU_free_mapped).next = ((bck)->awe_LRU_free_mapped).next; } else { (buf_pool->awe_LRU_free_mapped).start = ((bck)->awe_LRU_free_mapped).next; }};
36270
36271
36272
36273    if (add_to_mapped_list) {
36274     { ; ((buf_pool->awe_LRU_free_mapped).count)++; ((block)->awe_LRU_free_mapped).next = (buf_pool->awe_LRU_free_mapped).start; ((block)->awe_LRU_free_mapped).prev = ((void *)0); if ((buf_pool->awe_LRU_free_mapped).start != ((void *)0)) { (((buf_pool->awe_LRU_free_mapped).start)->awe_LRU_free_mapped).prev = (block); } (buf_pool->awe_LRU_free_mapped).start = (block); if ((buf_pool->awe_LRU_free_mapped).end == ((void *)0)) { (buf_pool->awe_LRU_free_mapped).end = (block); }};
36275
36276
36277    }
36278
36279    buf_pool->n_pages_awe_remapped++;
36280
36281    mutex_exit(&bck->mutex);
36282
36283    return;
36284   }
36285  }
36286
36287  fprintf(stderr,
36288 "InnoDB: AWE: Fatal error: cannot find a page to unmap\n"
36289 "InnoDB: awe_LRU_free_mapped list length %lu\n",
36290   (ulong) (buf_pool->awe_LRU_free_mapped).count);
36291
36292  do { if (__builtin_expect(!((ulint)(0)), (0))) { ut_dbg_assertion_failed("0", "buf/buf0buf.c", (ulint) 841); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 841); } while (0); } while (0);
36293 }
36294
36295
36296
36297 static inline
36298 buf_block_t*
36299 buf_block_alloc(void)
36300
36301
36302
36303
36304 {
36305  buf_block_t* block;
36306
36307  block = buf_LRU_get_free_block();
36308
36309  return(block);
36310 }
36311
36312
36313
36314
36315 static inline
36316 void
36317 buf_block_make_young(
36318
36319  buf_block_t* block)
36320 {
36321
36322
36323
36324
36325
36326
36327
36328  if (buf_pool->freed_page_clock >= block->freed_page_clock
36329     + 1 + (buf_pool->curr_size / 4)) {
36330
36331   mutex_enter_func((&(buf_pool->LRU_mutex)), "buf/buf0buf.c", 880);
36332
36333
36334
36335   buf_LRU_make_block_young(block);
36336   mutex_exit(&(buf_pool->LRU_mutex));
36337  }
36338 }
36339
36340
36341
36342
36343
36344
36345 void
36346 buf_page_make_young(
36347
36348  buf_frame_t* frame)
36349 {
36350  buf_block_t* block;
36351
36352  mutex_enter_func((&(buf_pool->LRU_mutex)), "buf/buf0buf.c", 901);
36353
36354  block = buf_block_align(frame);
36355
36356  do { if (__builtin_expect(!((ulint)(block->state == 213)), (0))) { ut_dbg_assertion_failed("block->state == BUF_BLOCK_FILE_PAGE", "buf/buf0buf.c", (ulint) 905); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 905); } while (0); } while (0);
36357
36358  buf_LRU_make_block_young(block);
36359
36360  mutex_exit(&(buf_pool->LRU_mutex));
36361 }
36362
36363
36364
36365 static inline
36366 void
36367 buf_block_free(
36368
36369  buf_block_t* block)
36370 {
36371  mutex_enter_func((&(buf_pool->free_mutex)), "buf/buf0buf.c", 920);
36372
36373  mutex_enter_func((&block->mutex), "buf/buf0buf.c", 922);
36374
36375  do { if (__builtin_expect(!((ulint)(block->state != 213)), (0))) { ut_dbg_assertion_failed("block->state != BUF_BLOCK_FILE_PAGE", "buf/buf0buf.c", (ulint) 924); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 924); } while (0); } while (0);
36376
36377  buf_LRU_block_free_non_file_page(block);
36378
36379  mutex_exit(&block->mutex);
36380
36381  mutex_exit(&(buf_pool->free_mutex));
36382 }
36383
36384
36385
36386
36387 buf_frame_t*
36388 buf_frame_alloc(void)
36389
36390
36391 {
36392  return(buf_block_alloc()->frame);
36393 }
36394
36395
36396
36397
36398 void
36399 buf_frame_free(
36400
36401  buf_frame_t* frame)
36402 {
36403  buf_block_free(buf_block_align(frame));
36404 }
36405
36406
36407
36408
36409
36410
36411 buf_block_t*
36412 buf_page_peek_block(
36413
36414
36415
36416
36417  ulint space,
36418  ulint offset)
36419 {
36420  buf_block_t* block;
36421
36422  rw_lock_s_lock_func( (&(buf_pool->hash_latch)), 0, "buf/buf0buf.c", 971);
36423
36424  block = buf_page_hash_get(space, offset);
36425
36426  rw_lock_s_unlock_func(&(buf_pool->hash_latch));
36427
36428  return(block);
36429 }
36430
36431
36432
36433
36434
36435 void
36436 buf_reset_check_index_page_at_flush(
36437
36438  ulint space,
36439  ulint offset)
36440 {
36441  buf_block_t* block;
36442
36443  rw_lock_s_lock_func( (&(buf_pool->hash_latch)), 0, "buf/buf0buf.c", 992);
36444
36445  block = buf_page_hash_get(space, offset);
36446
36447  if (block) {
36448   block->check_index_page_at_flush = (0);
36449  }
36450
36451  rw_lock_s_unlock_func(&(buf_pool->hash_latch));
36452 }
36453
36454
36455
36456
36457
36458
36459 ulint
36460 buf_page_peek_if_search_hashed(
36461
36462
36463
36464  ulint space,
36465  ulint offset)
36466 {
36467  buf_block_t* block;
36468  ulint is_hashed;
36469
36470  rw_lock_s_lock_func( (&(buf_pool->hash_latch)), 0, "buf/buf0buf.c", 1019);
36471
36472  block = buf_page_hash_get(space, offset);
36473
36474  if (!block) {
36475   is_hashed = (0);
36476  } else {
36477   is_hashed = block->is_hashed;
36478  }
36479
36480  rw_lock_s_unlock_func(&(buf_pool->hash_latch));
36481
36482  return(is_hashed);
36483 }
36484
36485
36486
36487
36488
36489 ulint
36490 buf_page_peek(
36491
36492
36493
36494
36495  ulint space,
36496  ulint offset)
36497 {
36498  if (buf_page_peek_block(space, offset)) {
36499
36500   return((1));
36501  }
36502
36503  return((0));
36504 }
36505
36506
36507
36508
36509
36510
36511
36512 buf_block_t*
36513 buf_page_set_file_page_was_freed(
36514
36515
36516
36517  ulint space,
36518  ulint offset)
36519 {
36520  buf_block_t* block;
36521
36522  rw_lock_s_lock_func( (&(buf_pool->hash_latch)), 0, "buf/buf0buf.c", 1071);
36523
36524  block = buf_page_hash_get(space, offset);
36525
36526  if (block) {
36527   block->file_page_was_freed = (1);
36528  }
36529
36530  rw_lock_s_unlock_func(&(buf_pool->hash_latch));
36531
36532  return(block);
36533 }
36534
36535
36536
36537
36538
36539
36540
36541 buf_block_t*
36542 buf_page_reset_file_page_was_freed(
36543
36544
36545
36546  ulint space,
36547  ulint offset)
36548 {
36549  buf_block_t* block;
36550
36551  rw_lock_s_lock_func( (&(buf_pool->hash_latch)), 0, "buf/buf0buf.c", 1100);
36552
36553  block = buf_page_hash_get(space, offset);
36554
36555  if (block) {
36556   block->file_page_was_freed = (0);
36557  }
36558
36559  rw_lock_s_unlock_func(&(buf_pool->hash_latch));
36560
36561  return(block);
36562 }
36563
36564 inline void _increment_page_get_statistics(buf_block_t* block, trx_t* trx)
36565 {
36566  ulint block_hash;
36567  ulint block_hash_byte;
36568  unsigned char block_hash_offset;
36569
36570  ;
36571
36572  if (!srv_slow_log || !trx || !trx->take_stats)
36573   return;
36574
36575  if (!trx->distinct_page_access_hash) {
36576   trx->distinct_page_access_hash = mem_alloc_func((8192), "buf/buf0buf.c", 1125);
36577   memset(trx->distinct_page_access_hash, 0, 8192);
36578  }
36579
36580         block_hash = ut_hash_ulint((block->space << 20) + block->space +
36581      block->offset, 8192 << 3);
36582  block_hash_byte = block_hash >> 3;
36583  block_hash_offset = (unsigned char) block_hash & 0x07;
36584  if (block_hash_byte < 0 || block_hash_byte >= 8192)
36585   fprintf(stderr, "!!! block_hash_byte = %lu  block_hash_offset = %lu !!!\n", block_hash_byte, block_hash_offset);
36586  if (block_hash_offset < 0 || block_hash_offset > 7)
36587   fprintf(stderr, "!!! block_hash_byte = %lu  block_hash_offset = %lu !!!\n", block_hash_byte, block_hash_offset);
36588  if ((trx->distinct_page_access_hash[block_hash_byte] & ((unsigned char) 0x01 << block_hash_offset)) == 0)
36589   trx->distinct_page_access++;
36590  trx->distinct_page_access_hash[block_hash_byte] |= (unsigned char) 0x01 << block_hash_offset;
36591  return;
36592 }
36593
36594
36595
36596
36597 buf_frame_t*
36598 buf_page_get_gen(
36599
36600
36601  ulint space,
36602  ulint offset,
36603  ulint rw_latch,
36604  buf_frame_t* guess,
36605  ulint mode,
36606
36607  const char* file,
36608  ulint line,
36609  mtr_t* mtr)
36610 {
36611  buf_block_t* block;
36612  ulint accessed;
36613  ulint fix_type;
36614  ulint success;
36615  ulint must_read;
36616  trx_t* trx = ((void *)0);
36617  ulint sec;
36618  ulint ms;
36619  ib_longlong start_time;
36620  ib_longlong finish_time;
36621
36622  ;
36623  ;
36624
36625
36626  ;
36627  ;
36628
36629
36630  ;
36631
36632  if (srv_slow_log) {
36633   trx = innobase_get_trx();
36634  }
36635  buf_pool->n_page_gets++;
36636 loop:
36637  block = ((void *)0);
36638
36639
36640  if (guess) {
36641   block = buf_block_align(guess);
36642
36643   mutex_enter_func((&block->mutex), "buf/buf0buf.c", 1192);
36644   if ((offset != block->offset) || (space != block->space)
36645     || (block->state != 213)) {
36646
36647    mutex_exit(&block->mutex);
36648    block = ((void *)0);
36649   }
36650  }
36651
36652  if (block == ((void *)0)) {
36653   rw_lock_s_lock_func( (&(buf_pool->hash_latch)), 0, "buf/buf0buf.c", 1202);
36654   block = buf_page_hash_get(space, offset);
36655   if(block) {
36656    mutex_enter_func((&block->mutex), "buf/buf0buf.c", 1205);
36657   }
36658   rw_lock_s_unlock_func(&(buf_pool->hash_latch));
36659  }
36660
36661  if (block == ((void *)0)) {
36662
36663
36664
36665
36666   if (mode == 11) {
36667
36668    return(((void *)0));
36669   }
36670
36671   buf_read_page(space, offset, trx);
36672 # 1229 "buf/buf0buf.c"
36673   goto loop;
36674  }
36675
36676
36677
36678  do { if (__builtin_expect(!((ulint)(block->state == 213)), (0))) { ut_dbg_assertion_failed("block->state == BUF_BLOCK_FILE_PAGE", "buf/buf0buf.c", (ulint) 1234); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 1234); } while (0); } while (0);
36679
36680  must_read = (0);
36681
36682  if (block->io_fix == 561) {
36683
36684   must_read = (1);
36685
36686   if (mode == 11) {
36687
36688
36689    mutex_exit(&block->mutex);
36690
36691    return(((void *)0));
36692   }
36693  }
36694
36695
36696
36697
36698  if (block->frame == ((void *)0)) {
36699   do { if (__builtin_expect(!((ulint)(srv_use_awe)), (0))) { ut_dbg_assertion_failed("srv_use_awe", "buf/buf0buf.c", (ulint) 1255); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 1255); } while (0); } while (0);
36700
36701
36702
36703
36704
36705   mutex_enter_func((&(buf_pool->mutex)), "buf/buf0buf.c", 1261);
36706   buf_awe_map_page_to_frame(block, (1));
36707   mutex_exit(&buf_pool->mutex);
36708  }
36709
36710
36711
36712
36713  buf_block_buf_fix_inc(block);
36714
36715
36716
36717
36718
36719  accessed = block->accessed;
36720
36721  block->accessed = (1);
36722
36723  mutex_exit(&block->mutex);
36724
36725  buf_block_make_young(block);
36726 # 1295 "buf/buf0buf.c"
36727  do { if (__builtin_expect(!((ulint)(block->buf_fix_count > 0)), (0))) { ut_dbg_assertion_failed("block->buf_fix_count > 0", "buf/buf0buf.c", (ulint) 1295); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 1295); } while (0); } while (0);
36728  ;
36729
36730  if (mode == 12) {
36731   if (rw_latch == 1) {
36732    success = rw_lock_s_lock_func_nowait(&(block->lock),
36733         file, line);
36734    fix_type = 1;
36735   } else {
36736    ;
36737    success = rw_lock_x_lock_func_nowait(&(block->lock),
36738      file, line);
36739    fix_type = 2;
36740   }
36741
36742   if (!success) {
36743    mutex_enter_func((&block->mutex), "buf/buf0buf.c", 1311);
36744
36745
36746
36747    if (__builtin_expect(block->buf_fix_count == 0, (0))) {
36748     buf_print_diagnostic(mtr, block);
36749     do { ut_dbg_assertion_failed(0, "buf/buf0buf.c", (ulint) 1317); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
36750    }
36751
36752    block->buf_fix_count--;
36753
36754    mutex_exit(&block->mutex);
36755
36756
36757
36758
36759    return(((void *)0));
36760   }
36761  } else if (rw_latch == 3) {
36762
36763   if (must_read) {
36764
36765
36766
36767    if (srv_slow_log && trx && trx->take_stats)
36768    {
36769     ut_usectime(&sec, &ms);
36770     start_time = (ib_longlong)sec * 1000000 + ms;
36771    }
36772           for (;;) {
36773     mutex_enter_func((&block->mutex), "buf/buf0buf.c", 1341);
36774
36775                   if (block->io_fix == 561) {
36776
36777      mutex_exit(&block->mutex);
36778
36779      os_thread_sleep(WAIT_FOR_READ);
36780     } else {
36781
36782      mutex_exit(&block->mutex);
36783
36784            break;
36785     }
36786    }
36787                  if (srv_slow_log && trx && trx->take_stats && start_time)
36788    {
36789     ut_usectime(&sec, &ms);
36790                   finish_time = (ib_longlong)sec * 1000000 + ms;
36791                   trx->io_reads_wait_timer += (ulint)(finish_time - start_time);
36792    }
36793   }
36794
36795   fix_type = 3;
36796  } else if (rw_latch == 1) {
36797
36798   rw_lock_s_lock_func(&(block->lock), 0, file, line);
36799
36800   fix_type = 1;
36801  } else {
36802   rw_lock_x_lock_func(&(block->lock), 0, file, line);
36803
36804   fix_type = 2;
36805  }
36806
36807  mtr_memo_push(mtr, block, fix_type);
36808
36809  if (!accessed) {
36810
36811
36812
36813   buf_read_ahead_linear(space, offset, trx);
36814  }
36815
36816
36817
36818
36819
36820  if (srv_slow_log) {
36821   _increment_page_get_statistics(block, trx);
36822  }
36823
36824  return(block->frame);
36825 }
36826
36827
36828
36829
36830
36831 ulint
36832 buf_page_optimistic_get_func(
36833
36834
36835  ulint rw_latch,
36836  buf_block_t* block,
36837  buf_frame_t* guess,
36838
36839  dulint modify_clock,
36840
36841  const char* file,
36842  ulint line,
36843  mtr_t* mtr)
36844 {
36845  ulint accessed;
36846  ulint success;
36847  ulint fix_type;
36848  trx_t* trx = ((void *)0);
36849
36850  ;
36851  ;
36852
36853
36854
36855  mutex_enter_func((&block->mutex), "buf/buf0buf.c", 1423);
36856
36857  if (__builtin_expect(block->state != 213, (0))
36858      || __builtin_expect(block->frame != guess, (0))) {
36859
36860   mutex_exit(&block->mutex);
36861
36862   return((0));
36863  }
36864
36865
36866
36867
36868  buf_block_buf_fix_inc(block);
36869
36870  accessed = block->accessed;
36871  block->accessed = (1);
36872
36873  mutex_exit(&block->mutex);
36874
36875  buf_block_make_young(block);
36876
36877
36878
36879  ;
36880
36881  if (rw_latch == 1) {
36882   success = rw_lock_s_lock_func_nowait(&(block->lock),
36883         file, line);
36884   fix_type = 1;
36885  } else {
36886   success = rw_lock_x_lock_func_nowait(&(block->lock),
36887         file, line);
36888   fix_type = 2;
36889  }
36890
36891  if (__builtin_expect(!success, (0))) {
36892   mutex_enter_func((&block->mutex), "buf/buf0buf.c", 1460);
36893
36894
36895
36896   if (__builtin_expect(block->buf_fix_count == 0, (0))) {
36897    buf_print_diagnostic(mtr, block);
36898    do { ut_dbg_assertion_failed(0, "buf/buf0buf.c", (ulint) 1466); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
36899   }
36900
36901   block->buf_fix_count--;
36902
36903   mutex_exit(&block->mutex);
36904
36905
36906
36907
36908   return((0));
36909  }
36910
36911  if (__builtin_expect(!(((modify_clock).low == (block->modify_clock).low) && ((modify_clock).high == (block->modify_clock).high)), (0))) {
36912
36913
36914
36915   if (rw_latch == 1) {
36916    rw_lock_s_unlock_func(&(block->lock));
36917   } else {
36918    rw_lock_x_unlock_func(&(block->lock));
36919   }
36920
36921   mutex_enter_func((&block->mutex), "buf/buf0buf.c", 1489);
36922
36923
36924
36925   if (__builtin_expect(block->buf_fix_count == 0, (0))) {
36926    buf_print_diagnostic(mtr, block);
36927    do { ut_dbg_assertion_failed(0, "buf/buf0buf.c", (ulint) 1495); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
36928   }
36929
36930   block->buf_fix_count--;
36931
36932   mutex_exit(&block->mutex);
36933
36934
36935
36936
36937   return((0));
36938  }
36939
36940  mtr_memo_push(mtr, block, fix_type);
36941 # 1519 "buf/buf0buf.c"
36942  do { if (__builtin_expect(!((ulint)(block->buf_fix_count > 0)), (0))) { ut_dbg_assertion_failed("block->buf_fix_count > 0", "buf/buf0buf.c", (ulint) 1519); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 1519); } while (0); } while (0);
36943
36944  ;
36945
36946
36947
36948
36949  if (__builtin_expect(!accessed, (0))) {
36950
36951
36952
36953   buf_read_ahead_linear(buf_frame_get_space_id(guess),
36954      buf_frame_get_page_no(guess), trx);
36955  }
36956
36957
36958
36959
36960  buf_pool->n_page_gets++;
36961
36962  if (srv_slow_log) {
36963   trx = innobase_get_trx();
36964   _increment_page_get_statistics(block, trx);
36965  }
36966
36967  return((1));
36968 }
36969
36970
36971
36972
36973
36974
36975 ulint
36976 buf_page_get_known_nowait(
36977
36978
36979  ulint rw_latch,
36980  buf_frame_t* guess,
36981  ulint mode,
36982  const char* file,
36983  ulint line,
36984  mtr_t* mtr)
36985 {
36986  buf_block_t* block;
36987  ulint success;
36988  ulint fix_type;
36989  trx_t* trx = ((void *)0);
36990
36991  ;
36992  ;
36993
36994  block = buf_block_align(guess);
36995
36996  mutex_enter_func((&block->mutex), "buf/buf0buf.c", 1573);
36997
36998  if (block->state == 215) {
36999
37000
37001
37002
37003
37004
37005
37006   mutex_exit(&block->mutex);
37007
37008   return((0));
37009  }
37010
37011  do { if (__builtin_expect(!((ulint)(block->state == 213)), (0))) { ut_dbg_assertion_failed("block->state == BUF_BLOCK_FILE_PAGE", "buf/buf0buf.c", (ulint) 1588); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 1588); } while (0); } while (0);
37012
37013
37014
37015
37016  buf_block_buf_fix_inc(block);
37017
37018  mutex_exit(&block->mutex);
37019
37020  if (mode == 51) {
37021   buf_block_make_young(block);
37022  }
37023
37024  ;
37025
37026  if (rw_latch == 1) {
37027   success = rw_lock_s_lock_func_nowait(&(block->lock),
37028         file, line);
37029   fix_type = 1;
37030  } else {
37031   success = rw_lock_x_lock_func_nowait(&(block->lock),
37032         file, line);
37033   fix_type = 2;
37034  }
37035
37036  if (!success) {
37037   mutex_enter_func((&block->mutex), "buf/buf0buf.c", 1614);
37038
37039
37040
37041   if (__builtin_expect(block->buf_fix_count == 0, (0))) {
37042    buf_print_diagnostic(mtr, block);
37043    do { ut_dbg_assertion_failed(0, "buf/buf0buf.c", (ulint) 1620); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
37044   }
37045
37046   block->buf_fix_count--;
37047
37048   mutex_exit(&block->mutex);
37049
37050
37051
37052
37053
37054   return((0));
37055  }
37056
37057  mtr_memo_push(mtr, block, fix_type);
37058 # 1644 "buf/buf0buf.c"
37059  do { if (__builtin_expect(!((ulint)(block->buf_fix_count > 0)), (0))) { ut_dbg_assertion_failed("block->buf_fix_count > 0", "buf/buf0buf.c", (ulint) 1644); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 1644); } while (0); } while (0);
37060  ;
37061 # 1654 "buf/buf0buf.c"
37062  buf_pool->n_page_gets++;
37063
37064  if (srv_slow_log) {
37065   trx = innobase_get_trx();
37066   _increment_page_get_statistics(block, trx);
37067  }
37068
37069  return((1));
37070 }
37071
37072
37073
37074
37075 void
37076 buf_page_init_for_backup_restore(
37077
37078  ulint space,
37079  ulint offset,
37080
37081  buf_block_t* block)
37082 {
37083
37084  block->magic_n = 41526563;
37085
37086  block->state = 213;
37087  block->space = space;
37088  block->offset = offset;
37089
37090  block->lock_hash_val = 0;
37091
37092  block->freed_page_clock = 0;
37093
37094  block->newest_modification = ut_dulint_zero;
37095  block->oldest_modification = ut_dulint_zero;
37096
37097  block->accessed = (0);
37098  block->buf_fix_count = 0;
37099  block->io_fix = 0;
37100
37101  block->n_hash_helps = 0;
37102  block->is_hashed = (0);
37103  block->n_fields = 1;
37104  block->n_bytes = 0;
37105  block->side = 1;
37106
37107  block->file_page_was_freed = (0);
37108 }
37109
37110
37111
37112 static
37113 void
37114 buf_page_init(
37115
37116  ulint space,
37117  ulint offset,
37118
37119  buf_block_t* block)
37120 {
37121
37122
37123
37124
37125  do { if (__builtin_expect(!((ulint)(block->state != 213)), (0))) { ut_dbg_assertion_failed("block->state != BUF_BLOCK_FILE_PAGE", "buf/buf0buf.c", (ulint) 1717); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 1717); } while (0); } while (0);
37126
37127
37128  block->magic_n = 41526563;
37129
37130  block->state = 213;
37131  block->space = space;
37132  block->offset = offset;
37133
37134  block->check_index_page_at_flush = (0);
37135  block->index = ((void *)0);
37136
37137  block->lock_hash_val = lock_rec_hash(space, offset);
37138
37139
37140
37141         if (buf_page_hash_get(space, offset)) {
37142                 fprintf(stderr,
37143 "InnoDB: Error: page %lu %lu already found from the hash table\n",
37144    (ulong) space,
37145    (ulong) offset);
37146
37147
37148
37149
37150
37151
37152                 do { if (__builtin_expect(!((ulint)(0)), (0))) { ut_dbg_assertion_failed("0", "buf/buf0buf.c", (ulint) 1744); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 1744); } while (0); } while (0);
37153         }
37154
37155  do { hash_cell_t* cell3333; buf_block_t* struct3333; (block)->hash = ((void *)0); cell3333 = hash_get_nth_cell(buf_pool->page_hash, hash_calc_hash(buf_page_address_fold(space, offset), buf_pool->page_hash)); if (cell3333->node == ((void *)0)) { cell3333->node = block; } else { struct3333 = cell3333->node; while (struct3333->hash != ((void *)0)) { struct3333 = struct3333->hash; } struct3333->hash = block; }} while (0);
37156
37157
37158  block->freed_page_clock = 0;
37159
37160  block->newest_modification = ut_dulint_zero;
37161  block->oldest_modification = ut_dulint_zero;
37162
37163  block->accessed = (0);
37164  block->buf_fix_count = 0;
37165  block->io_fix = 0;
37166
37167  block->n_hash_helps = 0;
37168  block->is_hashed = (0);
37169  block->n_fields = 1;
37170  block->n_bytes = 0;
37171  block->side = 1;
37172
37173  block->file_page_was_freed = (0);
37174 }
37175 # 1780 "buf/buf0buf.c"
37176 buf_block_t*
37177 buf_page_init_for_read(
37178
37179
37180  ulint* err,
37181  ulint mode,
37182  ulint space,
37183  ib_longlong tablespace_version,
37184
37185
37186  ulint offset)
37187 {
37188  buf_block_t* block;
37189  mtr_t mtr;
37190
37191  ;
37192
37193  *err = 10;
37194
37195  if (mode == 131) {
37196
37197
37198   ;
37199   ;
37200
37201   mtr_start(&mtr);
37202
37203   if (!ibuf_page_low(space, offset, &mtr)) {
37204
37205    mtr_commit(&mtr);
37206
37207    return(((void *)0));
37208   }
37209  } else {
37210   ;
37211  }
37212
37213  block = buf_block_alloc();
37214
37215  do { if (__builtin_expect(!((ulint)(block)), (0))) { ut_dbg_assertion_failed("block", "buf/buf0buf.c", (ulint) 1819); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 1819); } while (0); } while (0);
37216
37217  mutex_enter_func((&(buf_pool->LRU_mutex)), "buf/buf0buf.c", 1821);
37218  rw_lock_x_lock_func( (&(buf_pool->hash_latch)), 0, "buf/buf0buf.c", 1822);
37219  mutex_enter_func((&block->mutex), "buf/buf0buf.c", 1823);
37220
37221  if (fil_tablespace_deleted_or_being_deleted_in_mem(space,
37222        tablespace_version)) {
37223   *err = 44;
37224  }
37225
37226  if (*err == 44
37227      || ((void *)0) != buf_page_hash_get(space, offset)) {
37228
37229
37230
37231
37232   mutex_exit(&block->mutex);
37233   mutex_exit(&(buf_pool->LRU_mutex));
37234   rw_lock_x_unlock_func(&(buf_pool->hash_latch));
37235
37236   buf_block_free(block);
37237
37238   if (mode == 131) {
37239
37240    mtr_commit(&mtr);
37241   }
37242
37243   return(((void *)0));
37244  }
37245
37246  ;
37247
37248  buf_page_init(space, offset, block);
37249  rw_lock_x_unlock_func(&(buf_pool->hash_latch));
37250
37251
37252
37253  buf_LRU_add_block(block, (1));
37254  mutex_exit(&(buf_pool->LRU_mutex));
37255
37256  mutex_enter_func((&(buf_pool->mutex)), "buf/buf0buf.c", 1860);
37257
37258  block->io_fix = 561;
37259
37260  buf_pool->n_pend_reads++;
37261 # 1873 "buf/buf0buf.c"
37262  rw_lock_x_lock_func( (&(block->lock)), (561), "buf/buf0buf.c", 1873);
37263
37264  mutex_exit(&block->mutex);
37265   mutex_exit(&(buf_pool->mutex));
37266
37267  if (mode == 131) {
37268
37269   mtr_commit(&mtr);
37270  }
37271
37272  return(block);
37273 }
37274
37275
37276
37277
37278
37279
37280
37281 buf_frame_t*
37282 buf_page_create(
37283
37284
37285  ulint space,
37286  ulint offset,
37287
37288  mtr_t* mtr)
37289 {
37290  buf_frame_t* frame;
37291  buf_block_t* block;
37292  buf_block_t* free_block = ((void *)0);
37293
37294  ;
37295
37296  free_block = buf_LRU_get_free_block();
37297
37298  mutex_enter_func((&(buf_pool->LRU_mutex)), "buf/buf0buf.c", 1909);
37299  rw_lock_x_lock_func( (&(buf_pool->hash_latch)), 0, "buf/buf0buf.c", 1910);
37300
37301  block = buf_page_hash_get(space, offset);
37302
37303  if (block != ((void *)0)) {
37304
37305
37306
37307   block->file_page_was_freed = (0);
37308
37309
37310   mutex_exit(&(buf_pool->LRU_mutex));
37311   rw_lock_x_unlock_func(&(buf_pool->hash_latch));
37312
37313   buf_block_free(free_block);
37314
37315   frame = buf_page_get_gen( space, offset, 3, ((void *)0), 14, "buf/buf0buf.c", 1926, mtr);
37316
37317   return(frame);
37318  }
37319 # 1940 "buf/buf0buf.c"
37320  block = free_block;
37321
37322  mutex_enter_func((&block->mutex), "buf/buf0buf.c", 1942);
37323
37324  buf_page_init(space, offset, block);
37325  rw_lock_x_unlock_func(&(buf_pool->hash_latch));
37326
37327
37328  buf_LRU_add_block(block, (0));
37329
37330
37331
37332
37333  buf_block_buf_fix_inc(block);
37334
37335  buf_pool->n_pages_created++;
37336
37337  mutex_exit(&(buf_pool->LRU_mutex));
37338
37339  mtr_memo_push(mtr, block, 3);
37340
37341  block->accessed = (1);
37342
37343  mutex_exit(&block->mutex);
37344
37345
37346
37347
37348  ibuf_merge_or_delete_for_page(((void *)0), space, offset, (1));
37349
37350
37351  buf_flush_free_margin((0));
37352
37353  frame = block->frame;
37354
37355
37356
37357
37358
37359
37360
37361  memset(frame + 26, 0, 8);
37362 # 1993 "buf/buf0buf.c"
37363  return(frame);
37364 }
37365
37366
37367
37368
37369
37370 void
37371 buf_page_io_complete(
37372
37373  buf_block_t* block)
37374 {
37375  ulint io_type;
37376  ulint read_page_no;
37377  ulint flush_type;
37378
37379  buf_io_counter_t* io_counter;
37380  ulint fold;
37381
37382  ;
37383
37384  do { if (__builtin_expect(!((ulint)(block->state == 213)), (0))) { ut_dbg_assertion_failed("block->state == BUF_BLOCK_FILE_PAGE", "buf/buf0buf.c", (ulint) 2014); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 2014); } while (0); } while (0);
37385
37386
37387
37388
37389
37390
37391
37392  io_type = block->io_fix;
37393
37394  if (io_type == 561) {
37395
37396
37397
37398
37399   read_page_no = mach_read_from_4((block->frame)
37400       + 4);
37401   if (read_page_no != 0
37402    && !trx_doublewrite_page_inside(read_page_no)
37403        && read_page_no != block->offset) {
37404
37405    fprintf(stderr,
37406 "InnoDB: Error: page n:o stored in the page read in is %lu, should be %lu!\n",
37407     (ulong) read_page_no, (ulong) block->offset);
37408   }
37409
37410
37411
37412   if (buf_page_is_corrupted(block->frame)) {
37413      fprintf(stderr,
37414   "InnoDB: Database page corruption on disk or a failed\n"
37415   "InnoDB: file read of page %lu.\n", (ulong) block->offset);
37416
37417    fputs(
37418   "InnoDB: You may have to recover from a backup.\n", stderr);
37419
37420    buf_page_print(block->frame);
37421
37422      fprintf(stderr,
37423   "InnoDB: Database page corruption on disk or a failed\n"
37424   "InnoDB: file read of page %lu.\n", (ulong) block->offset);
37425    fputs(
37426   "InnoDB: You may have to recover from a backup.\n", stderr);
37427    fputs(
37428   "InnoDB: It is also possible that your operating\n"
37429   "InnoDB: system has corrupted its own file cache\n"
37430   "InnoDB: and rebooting your computer removes the\n"
37431   "InnoDB: error.\n"
37432   "InnoDB: If the corrupt page is an index page\n"
37433   "InnoDB: you can also try to fix the corruption\n"
37434   "InnoDB: by dumping, dropping, and reimporting\n"
37435   "InnoDB: the corrupt table. You can use CHECK\n"
37436   "InnoDB: TABLE to scan your table for corruption.\n"
37437   "InnoDB: See also "
37438 "InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html\n"
37439   "InnoDB: about forcing recovery.\n", stderr);
37440
37441    if (srv_force_recovery < 1) {
37442     fputs(
37443  "InnoDB: Ending processing because of a corrupt database page.\n",
37444      stderr);
37445       exit(1);
37446      }
37447   }
37448
37449   if (recv_recovery_is_on()) {
37450    recv_recover_page((0), (1), block->frame,
37451       block->space, block->offset);
37452   }
37453
37454   if (!recv_no_ibuf_operations) {
37455    ibuf_merge_or_delete_for_page(block->frame,
37456      block->space, block->offset, (1));
37457   }
37458  }
37459 # 2098 "buf/buf0buf.c"
37460  if (io_type == 561) {
37461   mutex_enter_func((&block->mutex), "buf/buf0buf.c", 2099);
37462   mutex_enter_func((&(buf_pool->mutex)), "buf/buf0buf.c", 2100);
37463
37464   block->io_fix = 0;
37465
37466
37467
37468
37469
37470   ;
37471   buf_pool->n_pend_reads--;
37472   buf_pool->n_pages_read++;
37473
37474   rw_lock_x_unlock_func(&(block->lock));
37475
37476   if (srv_io_pattern && srv_io_pattern_trace_running) {
37477   fold = buf_page_address_fold(block->space, block->offset);
37478   { (io_counter) = (hash_get_nth_cell(buf_pool->io_counter_hash, hash_calc_hash(fold, buf_pool->io_counter_hash))->node); while ((io_counter) != ((void *)0)) { if ((io_counter->space == block->space) && (io_counter->offset == block->offset)) { break; } else { (io_counter) = ((io_counter)->hash); } }};
37479
37480   if (io_counter == ((void *)0) && buf_pool->io_counters < srv_io_pattern_size_limit) {
37481    io_counter = mem_heap_alloc(buf_pool->io_counter_heap,(sizeof(buf_io_counter_t)));
37482    io_counter->space = block->space;
37483    io_counter->offset = block->offset;
37484    io_counter->n_read = 0;
37485    io_counter->n_write = 0;
37486    do { hash_cell_t* cell3333; buf_io_counter_t* struct3333; (io_counter)->hash = ((void *)0); cell3333 = hash_get_nth_cell(buf_pool->io_counter_hash, hash_calc_hash(buf_page_address_fold(block->space, block->offset), buf_pool->io_counter_hash)); if (cell3333->node == ((void *)0)) { cell3333->node = io_counter; } else { struct3333 = cell3333->node; while (struct3333->hash != ((void *)0)) { struct3333 = struct3333->hash; } struct3333->hash = io_counter; }} while (0);
37487
37488    buf_pool->io_counters++;
37489   }
37490   if (io_counter != ((void *)0)) {
37491    io_counter->index_id = ut_dulint_get_low(btr_page_get_index_id(buf_block_get_frame(block)));
37492    io_counter->n_read++;
37493   }
37494   }
37495
37496   mutex_exit(&(buf_pool->mutex));
37497   mutex_exit(&block->mutex);
37498
37499
37500
37501
37502
37503  } else {
37504   ;
37505
37506   flush_type = block->flush_type;
37507   if (flush_type == 1) {
37508    mutex_enter_func((&(buf_pool->LRU_mutex)), "buf/buf0buf.c", 2146);
37509   }
37510   mutex_enter_func((&(buf_pool->flush_list_mutex)), "buf/buf0buf.c", 2148);
37511   mutex_enter_func((&block->mutex), "buf/buf0buf.c", 2149);
37512   mutex_enter_func((&(buf_pool->mutex)), "buf/buf0buf.c", 2150);
37513
37514   block->io_fix = 0;
37515
37516
37517
37518
37519   buf_flush_write_complete(block);
37520
37521   mutex_exit(&(buf_pool->flush_list_mutex));
37522   if (flush_type == 1) {
37523    mutex_exit(&(buf_pool->LRU_mutex));
37524   }
37525
37526   rw_lock_s_unlock_func(&(block->lock));
37527
37528   if (srv_io_pattern && srv_io_pattern_trace_running) {
37529   fold = buf_page_address_fold(block->space, block->offset);
37530   { (io_counter) = (hash_get_nth_cell(buf_pool->io_counter_hash, hash_calc_hash(fold, buf_pool->io_counter_hash))->node); while ((io_counter) != ((void *)0)) { if ((io_counter->space == block->space) && (io_counter->offset == block->offset)) { break; } else { (io_counter) = ((io_counter)->hash); } }};
37531
37532   if (io_counter == ((void *)0) && buf_pool->io_counters < srv_io_pattern_size_limit) {
37533    io_counter = mem_heap_alloc(buf_pool->io_counter_heap,(sizeof(buf_io_counter_t)));
37534    io_counter->space = block->space;
37535    io_counter->offset = block->offset;
37536    io_counter->n_read = 0;
37537    io_counter->n_write = 0;
37538    do { hash_cell_t* cell3333; buf_io_counter_t* struct3333; (io_counter)->hash = ((void *)0); cell3333 = hash_get_nth_cell(buf_pool->io_counter_hash, hash_calc_hash(buf_page_address_fold(block->space, block->offset), buf_pool->io_counter_hash)); if (cell3333->node == ((void *)0)) { cell3333->node = io_counter; } else { struct3333 = cell3333->node; while (struct3333->hash != ((void *)0)) { struct3333 = struct3333->hash; } struct3333->hash = io_counter; }} while (0);
37539
37540    buf_pool->io_counters++;
37541   }
37542   if (io_counter != ((void *)0)) {
37543    io_counter->index_id = ut_dulint_get_low(btr_page_get_index_id(buf_block_get_frame(block)));
37544    io_counter->n_write++;
37545   }
37546   }
37547
37548   buf_pool->n_pages_written++;
37549
37550   mutex_exit(&(buf_pool->mutex));
37551   mutex_exit(&block->mutex);
37552
37553
37554
37555
37556
37557
37558  }
37559
37560
37561
37562
37563
37564
37565
37566 }
37567
37568
37569
37570
37571
37572
37573 void
37574 buf_pool_invalidate(void)
37575
37576 {
37577  ulint freed;
37578
37579  ;
37580
37581  freed = (1);
37582
37583  while (freed) {
37584   freed = buf_LRU_search_and_free_block(100);
37585  }
37586
37587  mutex_enter_func((&(buf_pool->LRU_mutex)), "buf/buf0buf.c", 2225);
37588
37589  ;
37590
37591  mutex_exit(&(buf_pool->LRU_mutex));
37592 }
37593
37594
37595
37596
37597 ulint
37598 buf_validate(void)
37599
37600 {
37601  buf_block_t* block;
37602  ulint i;
37603  ulint n_single_flush = 0;
37604  ulint n_lru_flush = 0;
37605  ulint n_list_flush = 0;
37606  ulint n_lru = 0;
37607  ulint n_flush = 0;
37608  ulint n_free = 0;
37609  ulint n_page = 0;
37610  ulint n_single_flush_tmp = 0;
37611  ulint n_lru_flush_tmp = 0;
37612  ulint n_list_flush_tmp = 0;
37613
37614  ;
37615
37616  mutex_enter_func((&(buf_pool->LRU_mutex)), "buf/buf0buf.c", 2254);
37617  mutex_enter_func((&(buf_pool->flush_list_mutex)), "buf/buf0buf.c", 2255);
37618  mutex_enter_func((&(buf_pool->free_mutex)), "buf/buf0buf.c", 2256);
37619  rw_lock_x_lock_func( (&(buf_pool->hash_latch)), 0, "buf/buf0buf.c", 2257);
37620
37621  mutex_enter_func((&(buf_pool->mutex)), "buf/buf0buf.c", 2259);
37622  n_single_flush_tmp = buf_pool->n_flush[2];
37623  n_list_flush_tmp = buf_pool->n_flush[3];
37624  n_lru_flush_tmp = buf_pool->n_flush[1];
37625  mutex_exit(&(buf_pool->mutex));
37626
37627  for (i = 0; i < buf_pool->curr_size; i++) {
37628
37629   block = buf_pool_get_nth_block(buf_pool, i);
37630
37631   mutex_enter_func((&block->mutex), "buf/buf0buf.c", 2269);
37632
37633   if (block->state == 213) {
37634
37635    do { if (__builtin_expect(!((ulint)(buf_page_hash_get(block->space, block->offset) == block)), (0))) { ut_dbg_assertion_failed("buf_page_hash_get(block->space, block->offset) == block", "buf/buf0buf.c", (ulint) 2274); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 2274); } while (0); } while (0);
37636
37637    n_page++;
37638
37639
37640
37641
37642
37643
37644    if (block->io_fix == 562) {
37645
37646     if (block->flush_type == 1) {
37647      n_lru_flush++;
37648      do { if (__builtin_expect(!((ulint)(rw_lock_is_locked(&(block->lock), 352))), (0))) { ut_dbg_assertion_failed("rw_lock_is_locked(&(block->lock), RW_LOCK_SHARED)", "buf/buf0buf.c", (ulint) 2287); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 2287); } while (0); } while (0);
37649
37650     } else if (block->flush_type ==
37651       3) {
37652      n_list_flush++;
37653     } else if (block->flush_type ==
37654       2) {
37655      n_single_flush++;
37656     } else {
37657      do { ut_dbg_assertion_failed(0, "buf/buf0buf.c", (ulint) 2295); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
37658     }
37659
37660    } else if (block->io_fix == 561) {
37661
37662     do { if (__builtin_expect(!((ulint)(rw_lock_is_locked(&(block->lock), 351))), (0))) { ut_dbg_assertion_failed("rw_lock_is_locked(&(block->lock), RW_LOCK_EX)", "buf/buf0buf.c", (ulint) 2301); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 2301); } while (0); } while (0);
37663
37664    }
37665
37666    n_lru++;
37667
37668    if (ut_dulint_cmp(block->oldest_modification,
37669       ut_dulint_zero) > 0) {
37670      n_flush++;
37671    }
37672
37673   } else if (block->state == 211) {
37674    n_free++;
37675   }
37676
37677   mutex_exit(&block->mutex);
37678   }
37679
37680  if (n_lru + n_free > buf_pool->curr_size) {
37681   fprintf(stderr, "n LRU %lu, n free %lu\n", (ulong) n_lru, (ulong) n_free);
37682   do { ut_dbg_assertion_failed(0, "buf/buf0buf.c", (ulint) 2320); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
37683  }
37684
37685  do { if (__builtin_expect(!((ulint)((buf_pool->LRU).count == n_lru)), (0))) { ut_dbg_assertion_failed("UT_LIST_GET_LEN(buf_pool->LRU) == n_lru", "buf/buf0buf.c", (ulint) 2323); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 2323); } while (0); } while (0);
37686  if ((buf_pool->free).count != n_free) {
37687   fprintf(stderr, "Free list len %lu, free blocks %lu\n",
37688    (ulong) (buf_pool->free).count, (ulong) n_free);
37689   do { ut_dbg_assertion_failed(0, "buf/buf0buf.c", (ulint) 2327); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
37690  }
37691  do { if (__builtin_expect(!((ulint)((buf_pool->flush_list).count == n_flush)), (0))) { ut_dbg_assertion_failed("UT_LIST_GET_LEN(buf_pool->flush_list) == n_flush", "buf/buf0buf.c", (ulint) 2329); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 2329); } while (0); } while (0);
37692
37693  do { if (__builtin_expect(!((ulint)(n_single_flush_tmp == n_single_flush)), (0))) { ut_dbg_assertion_failed("n_single_flush_tmp == n_single_flush", "buf/buf0buf.c", (ulint) 2331); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 2331); } while (0); } while (0);
37694  do { if (__builtin_expect(!((ulint)(n_list_flush_tmp == n_list_flush)), (0))) { ut_dbg_assertion_failed("n_list_flush_tmp == n_list_flush", "buf/buf0buf.c", (ulint) 2332); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 2332); } while (0); } while (0);
37695  do { if (__builtin_expect(!((ulint)(n_lru_flush_tmp == n_lru_flush)), (0))) { ut_dbg_assertion_failed("n_lru_flush_tmp == n_lru_flush", "buf/buf0buf.c", (ulint) 2333); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 2333); } while (0); } while (0);
37696
37697  mutex_exit(&(buf_pool->LRU_mutex));
37698  mutex_exit(&(buf_pool->flush_list_mutex));
37699  mutex_exit(&(buf_pool->free_mutex));
37700  rw_lock_x_unlock_func(&(buf_pool->hash_latch));
37701
37702  do { if (__builtin_expect(!((ulint)(buf_LRU_validate())), (0))) { ut_dbg_assertion_failed("buf_LRU_validate()", "buf/buf0buf.c", (ulint) 2340); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 2340); } while (0); } while (0);
37703  do { if (__builtin_expect(!((ulint)(buf_flush_validate())), (0))) { ut_dbg_assertion_failed("buf_flush_validate()", "buf/buf0buf.c", (ulint) 2341); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 2341); } while (0); } while (0);
37704
37705  return((1));
37706 }
37707
37708
37709
37710
37711 void
37712 buf_print(void)
37713
37714 {
37715  dulint* index_ids;
37716  ulint* counts;
37717  ulint size;
37718  ulint i;
37719  ulint j;
37720  dulint id;
37721  ulint n_found;
37722  buf_frame_t* frame;
37723  dict_index_t* index;
37724
37725  ;
37726
37727  size = buf_pool->curr_size;
37728
37729  index_ids = mem_alloc_func((sizeof(dulint) * size), "buf/buf0buf.c", 2367);
37730  counts = mem_alloc_func((sizeof(ulint) * size), "buf/buf0buf.c", 2368);
37731
37732  mutex_enter_func((&(buf_pool->LRU_mutex)), "buf/buf0buf.c", 2370);
37733  mutex_enter_func((&(buf_pool->flush_list_mutex)), "buf/buf0buf.c", 2371);
37734  mutex_enter_func((&(buf_pool->free_mutex)), "buf/buf0buf.c", 2372);
37735
37736  fprintf(stderr,
37737   "buf_pool size %lu\n"
37738   "database pages %lu\n"
37739   "free pages %lu\n"
37740   "modified database pages %lu\n"
37741   "n pending reads %lu\n"
37742   "n pending flush LRU %lu list %lu single page %lu\n"
37743   "pages read %lu, created %lu, written %lu\n",
37744   (ulong) size,
37745   (ulong) (buf_pool->LRU).count,
37746   (ulong) (buf_pool->free).count,
37747   (ulong) (buf_pool->flush_list).count,
37748   (ulong) buf_pool->n_pend_reads,
37749   (ulong) buf_pool->n_flush[1],
37750   (ulong) buf_pool->n_flush[3],
37751   (ulong) buf_pool->n_flush[2],
37752   (ulong) buf_pool->n_pages_read, buf_pool->n_pages_created,
37753   (ulong) buf_pool->n_pages_written);
37754
37755
37756
37757  n_found = 0;
37758
37759  for (i = 0; i < size; i++) {
37760   frame = buf_pool_get_nth_block(buf_pool, i)->frame;
37761
37762   if (fil_page_get_type(frame) == 17855) {
37763
37764    id = btr_page_get_index_id(frame);
37765
37766
37767    j = 0;
37768
37769    while (j < n_found) {
37770
37771     if (ut_dulint_cmp(index_ids[j], id) == 0) {
37772      (counts[j])++;
37773
37774      break;
37775     }
37776     j++;
37777    }
37778
37779    if (j == n_found) {
37780     n_found++;
37781     index_ids[j] = id;
37782     counts[j] = 1;
37783    }
37784   }
37785  }
37786
37787  mutex_exit(&(buf_pool->LRU_mutex));
37788  mutex_exit(&(buf_pool->flush_list_mutex));
37789  mutex_exit(&(buf_pool->free_mutex));
37790
37791  for (i = 0; i < n_found; i++) {
37792   index = dict_index_get_if_in_cache(index_ids[i]);
37793
37794   fprintf(stderr,
37795    "Block count for index %lu in buffer is about %lu",
37796          (ulong) ut_dulint_get_low(index_ids[i]),
37797          (ulong) counts[i]);
37798
37799   if (index) {
37800    _IO_putc (' ', stderr);
37801    dict_index_name_print(stderr, ((void *)0), index);
37802   }
37803
37804   _IO_putc ('\n', stderr);
37805  }
37806
37807  mem_free_func((index_ids), "buf/buf0buf.c", 2445);
37808  mem_free_func((counts), "buf/buf0buf.c", 2446);
37809
37810  do { if (__builtin_expect(!((ulint)(buf_validate())), (0))) { ut_dbg_assertion_failed("buf_validate()", "buf/buf0buf.c", (ulint) 2448); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } do if (__builtin_expect(ut_dbg_stop_threads, (0))) { ut_dbg_stop_thread("buf/buf0buf.c", (ulint) 2448); } while (0); } while (0);
37811 }
37812 # 2484 "buf/buf0buf.c"
37813 ulint
37814 buf_get_n_pending_ios(void)
37815
37816 {
37817  return(buf_pool->n_pend_reads
37818   + buf_pool->n_flush[1]
37819   + buf_pool->n_flush[3]
37820   + buf_pool->n_flush[2]);
37821 }
37822
37823
37824
37825
37826
37827 ulint
37828 buf_get_modified_ratio_pct(void)
37829
37830 {
37831  ulint ratio;
37832
37833  mutex_enter_func((&(buf_pool->LRU_mutex)), "buf/buf0buf.c", 2504);
37834  mutex_enter_func((&(buf_pool->flush_list_mutex)), "buf/buf0buf.c", 2505);
37835  mutex_enter_func((&(buf_pool->free_mutex)), "buf/buf0buf.c", 2506);
37836
37837  ratio = (100 * (buf_pool->flush_list).count)
37838        / (1 + (buf_pool->LRU).count
37839           + (buf_pool->free).count);
37840
37841
37842
37843  mutex_exit(&(buf_pool->LRU_mutex));
37844  mutex_exit(&(buf_pool->flush_list_mutex));
37845  mutex_exit(&(buf_pool->free_mutex));
37846
37847  return(ratio);
37848 }
37849
37850
37851
37852
37853 void
37854 buf_print_io(
37855
37856  FILE* file)
37857 {
37858  time_t current_time;
37859  double time_elapsed;
37860  ulint size;
37861
37862  ;
37863  size = buf_pool->curr_size;
37864
37865  mutex_enter_func((&(buf_pool->LRU_mutex)), "buf/buf0buf.c", 2536);
37866  mutex_enter_func((&(buf_pool->flush_list_mutex)), "buf/buf0buf.c", 2537);
37867  mutex_enter_func((&(buf_pool->free_mutex)), "buf/buf0buf.c", 2538);
37868  mutex_enter_func((&(buf_pool->mutex)), "buf/buf0buf.c", 2539);
37869
37870  if (srv_use_awe) {
37871   fprintf(stderr,
37872   "AWE: Buffer pool memory frames                        %lu\n",
37873     (ulong) buf_pool->n_frames);
37874
37875   fprintf(stderr,
37876   "AWE: Database pages and free buffers mapped in frames %lu\n",
37877     (ulong) (buf_pool->awe_LRU_free_mapped).count);
37878  }
37879  fprintf(file,
37880   "Buffer pool size        %lu\n"
37881   "Buffer pool size, bytes %lu\n"
37882   "Free buffers            %lu\n"
37883   "Database pages          %lu\n"
37884   "Modified db pages       %lu\n"
37885   "Pending reads %lu\n"
37886   "Pending writes: LRU %lu, flush list %lu, single page %lu\n",
37887   (ulong) size,
37888   (ulong) size * (2 * 8192),
37889   (ulong) (buf_pool->free).count,
37890   (ulong) (buf_pool->LRU).count,
37891   (ulong) (buf_pool->flush_list).count,
37892   (ulong) buf_pool->n_pend_reads,
37893   (ulong) buf_pool->n_flush[1]
37894    + buf_pool->init_flush[1],
37895   (ulong) buf_pool->n_flush[3]
37896    + buf_pool->init_flush[3],
37897   (ulong) buf_pool->n_flush[2]);
37898
37899  current_time = time(((void *)0));
37900  time_elapsed = 0.001 + difftime(current_time,
37901       buf_pool->last_printout_time);
37902  buf_pool->last_printout_time = current_time;
37903
37904  fprintf(file,
37905   "Pages read %lu, created %lu, written %lu\n"
37906   "%.2f reads/s, %.2f creates/s, %.2f writes/s\n",
37907   (ulong) buf_pool->n_pages_read,
37908   (ulong) buf_pool->n_pages_created,
37909   (ulong) buf_pool->n_pages_written,
37910   (buf_pool->n_pages_read - buf_pool->n_pages_read_old)
37911   / time_elapsed,
37912   (buf_pool->n_pages_created - buf_pool->n_pages_created_old)
37913   / time_elapsed,
37914   (buf_pool->n_pages_written - buf_pool->n_pages_written_old)
37915   / time_elapsed);
37916
37917  if (srv_use_awe) {
37918   fprintf(file, "AWE: %.2f page remaps/s\n",
37919   (buf_pool->n_pages_awe_remapped
37920     - buf_pool->n_pages_awe_remapped_old)
37921    / time_elapsed);
37922  }
37923
37924  if (buf_pool->n_page_gets > buf_pool->n_page_gets_old) {
37925   fprintf(file, "Buffer pool hit rate %lu / 1000\n",
37926        (ulong) (1000
37927   - ((1000 *
37928       (buf_pool->n_pages_read - buf_pool->n_pages_read_old))
37929   / (buf_pool->n_page_gets - buf_pool->n_page_gets_old))));
37930  } else {
37931   fputs("No buffer pool page gets since the last printout\n",
37932    file);
37933  }
37934
37935  buf_pool->n_page_gets_old = buf_pool->n_page_gets;
37936  buf_pool->n_pages_read_old = buf_pool->n_pages_read;
37937  buf_pool->n_pages_created_old = buf_pool->n_pages_created;
37938  buf_pool->n_pages_written_old = buf_pool->n_pages_written;
37939  buf_pool->n_pages_awe_remapped_old = buf_pool->n_pages_awe_remapped;
37940
37941  mutex_exit(&(buf_pool->LRU_mutex));
37942  mutex_exit(&(buf_pool->flush_list_mutex));
37943  mutex_exit(&(buf_pool->free_mutex));
37944  mutex_exit(&(buf_pool->mutex));
37945 }
37946
37947
37948
37949
37950 void
37951 buf_refresh_io_stats(void)
37952
37953 {
37954         buf_pool->last_printout_time = time(((void *)0));
37955  buf_pool->n_page_gets_old = buf_pool->n_page_gets;
37956  buf_pool->n_pages_read_old = buf_pool->n_pages_read;
37957  buf_pool->n_pages_created_old = buf_pool->n_pages_created;
37958  buf_pool->n_pages_written_old = buf_pool->n_pages_written;
37959  buf_pool->n_pages_awe_remapped_old = buf_pool->n_pages_awe_remapped;
37960 }
37961
37962
37963
37964
37965 ulint
37966 buf_all_freed(void)
37967
37968 {
37969  buf_block_t* block;
37970  ulint i;
37971
37972  ;
37973
37974  for (i = 0; i < buf_pool->curr_size; i++) {
37975
37976   block = buf_pool_get_nth_block(buf_pool, i);
37977
37978   mutex_enter_func((&block->mutex), "buf/buf0buf.c", 2649);
37979
37980   if (block->state == 213) {
37981
37982    if (!buf_flush_ready_for_replace(block)) {
37983
37984     fprintf(stderr,
37985      "Page %lu %lu still fixed or dirty\n",
37986      (ulong) block->space,
37987      (ulong) block->offset);
37988         do { ut_dbg_assertion_failed(0, "buf/buf0buf.c", (ulint) 2659); if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = ((void *)0); } while (0);
37989    }
37990   }
37991
37992   mutex_exit(&block->mutex);
37993   }
37994
37995  return((1));
37996 }
37997
37998
37999
38000
38001
38002 ulint
38003 buf_pool_check_no_pending_io(void)
38004
38005
38006 {
38007  ulint ret;
38008
38009  mutex_enter_func((&(buf_pool->mutex)), "buf/buf0buf.c", 2680);
38010
38011  if (buf_pool->n_pend_reads + buf_pool->n_flush[1]
38012     + buf_pool->n_flush[3]
38013     + buf_pool->n_flush[2]) {
38014   ret = (0);
38015  } else {
38016   ret = (1);
38017  }
38018
38019  mutex_exit(&(buf_pool->mutex));
38020
38021  return(ret);
38022 }
38023
38024
38025
38026
38027 ulint
38028 buf_get_free_list_len(void)
38029
38030 {
38031  ulint len;
38032
38033  mutex_enter_func((&(buf_pool->free_mutex)), "buf/buf0buf.c", 2704);
38034
38035  len = (buf_pool->free).count;
38036
38037  mutex_exit(&(buf_pool->free_mutex));
38038
38039  return(len);
38040 }
38041
38042
38043
38044
38045 void
38046 buf_block_print(
38047
38048  const buf_block_t* block)
38049 {
38050  fprintf(stderr,
38051   "BLOCK fields\nmagic_n: 0x%lx\n"
38052   "state: %lu frame: 0x%lx space:offset: 0x%lx:0x%lx\n"
38053   "hash value: 0x%lx  check_index_page_at_flush: %ld\n"
38054   "newest_modification %lu:%lu oldest_modification %lu:%lu\n"
38055   "flush_type: %lu in_free_list: %ld in_LRU_list: %ld\n"
38056   "LRU_position: %ld freed_page_clock: %lu old: %ld\n"
38057   "accessed: %ld buf_fix_count: %lu io_fix: %ld "
38058   "modify_clock: %lu:%lu\n"
38059   "n_hash_helps: %lu n_fields: %ld n_bytes: %lu side: %lu\n"
38060   "is_hashed: %lu n_pointers: %lu curr_n_fields: %lu\n"
38061   "curr_n_bytes: %lu curr_side: %lu index name: %s\n"
38062   "file_page_was_freed: %lu\n",
38063   block->magic_n, block->state, (ulint) block->frame,
38064   block->space, block->offset, block->lock_hash_val,
38065   block->check_index_page_at_flush,
38066   ut_dulint_get_high(block->newest_modification),
38067   ut_dulint_get_low(block->newest_modification),
38068   ut_dulint_get_high(block->oldest_modification),
38069   ut_dulint_get_low(block->oldest_modification),
38070   block->flush_type, block->in_free_list, block->in_LRU_list,
38071   block->LRU_position, block->freed_page_clock,
38072   block->old, block->accessed, block->buf_fix_count,
38073   block->io_fix,
38074   ut_dulint_get_high(block->modify_clock),
38075   ut_dulint_get_low(block->modify_clock),
38076   block->n_hash_helps, block->n_fields, block->n_bytes,
38077   block->side, block->is_hashed, block->n_pointers,
38078   block->curr_n_fields, block->curr_n_bytes,
38079   block->curr_side, block->index->name,
38080   block->file_page_was_freed);
38081 }
38082
38083
38084
38085
38086 void
38087 buf_print_diagnostic(
38088
38089  mtr_t* mtr,
38090  const buf_block_t* block)
38091 {
38092  fprintf(stderr, "=== MTR ===\n");
38093  mtr_print(mtr);
38094  buf_LRU_print();
38095  buf_print();
38096  buf_LRU_validate();
38097  buf_print_io(stderr);
38098  fprintf(stderr, "=== BLOCK ===\n");
38099  buf_block_print(block);
38100 }
38101
38102 buf_block_t*
38103 buf_pool_get_nth_block_no_inline(
38104
38105
38106         buf_pool_t* buf_pool,
38107         ulint i) {
38108
38109 return buf_pool_get_nth_block(buf_pool, i);
38110
38111 }
38112
38113
38114
38115
38116
38117 void
38118 buf_io_counter_control(void)
38119
38120 {
38121        ulint n;
38122
38123        mutex_enter_func((&(buf_pool->mutex)), "buf/buf0buf.c", 2794);
38124        if (srv_io_pattern_trace) {
38125                if (buf_pool->io_counter_hash == ((void *)0)) {
38126
38127                        buf_pool->io_counter_hash = hash0_create(20 * buf_pool->max_size);
38128                        buf_pool->io_counter_heap = mem_heap_create_func( (4096 * 1024), ((void *)0), 0, "buf/buf0buf.c", 2799);
38129                        buf_pool->io_counters = 0;
38130
38131                        srv_io_pattern = (1);
38132                }
38133        } else {
38134                if (buf_pool->io_counter_hash != ((void *)0)) {
38135                        srv_io_pattern = (0);
38136
38137                        for (n = 0; n < buf_pool->io_counter_hash->n_cells; n++) {
38138                                (buf_pool->io_counter_hash->array + n)->node = ((void *)0);
38139                        }
38140                        mem_heap_free_func( (buf_pool->io_counter_heap), "buf/buf0buf.c", 2811);
38141                        buf_pool->io_counter_heap = ((void *)0);
38142                        buf_pool->io_counters = 0;
38143
38144                        hash_table_free(buf_pool->io_counter_hash);
38145                        buf_pool->io_counter_hash = ((void *)0);
38146                }
38147        }
38148        mutex_exit(&(buf_pool->mutex));
38149 }
38150
38151 void
38152 buf_io_counter_clear(void)
38153
38154 {
38155        ulint n;
38156
38157        mutex_enter_func((&(buf_pool->mutex)), "buf/buf0buf.c", 2828);
38158        if (buf_pool->io_counter_hash != ((void *)0)) {
38159                for (n = 0; n < buf_pool->io_counter_hash->n_cells; n++) {
38160                        (buf_pool->io_counter_hash->array + n)->node = ((void *)0);
38161                }
38162                mem_heap_empty(buf_pool->io_counter_heap);
38163                buf_pool->io_counters = 0;
38164        }
38165        mutex_exit(&(buf_pool->mutex));
38166 }