19 #include <my_global.h>
56 #define mysql_file_register(P1, P2, P3) \
57 inline_mysql_file_register(P1, P2, P3)
64 #ifdef HAVE_PSI_FILE_INTERFACE
65 #define mysql_file_fgets(P1, P2, F) \
66 inline_mysql_file_fgets(__FILE__, __LINE__, P1, P2, F)
68 #define mysql_file_fgets(P1, P2, F) \
69 inline_mysql_file_fgets(P1, P2, F)
77 #ifdef HAVE_PSI_FILE_INTERFACE
78 #define mysql_file_fgetc(F) inline_mysql_file_fgetc(__FILE__, __LINE__, F)
80 #define mysql_file_fgetc(F) inline_mysql_file_fgetc(F)
88 #ifdef HAVE_PSI_FILE_INTERFACE
89 #define mysql_file_fputs(P1, F) \
90 inline_mysql_file_fputs(__FILE__, __LINE__, P1, F)
92 #define mysql_file_fputs(P1, F)\
93 inline_mysql_file_fputs(P1, F)
101 #ifdef HAVE_PSI_FILE_INTERFACE
102 #define mysql_file_fputc(P1, F) \
103 inline_mysql_file_fputc(__FILE__, __LINE__, P1, F)
105 #define mysql_file_fputc(P1, F) \
106 inline_mysql_file_fputc(P1, F)
114 #define mysql_file_fprintf inline_mysql_file_fprintf
121 #ifdef HAVE_PSI_FILE_INTERFACE
122 #define mysql_file_vfprintf(F, P1, P2) \
123 inline_mysql_file_vfprintf(__FILE__, __LINE__, F, P1, P2)
125 #define mysql_file_vfprintf(F, P1, P2) \
126 inline_mysql_file_vfprintf(F, P1, P2)
134 #ifdef HAVE_PSI_FILE_INTERFACE
135 #define mysql_file_fflush(F) \
136 inline_mysql_file_fflush(__FILE__, __LINE__, F)
138 #define mysql_file_fflush(F) \
139 inline_mysql_file_fflush(F)
147 #define mysql_file_feof(F) inline_mysql_file_feof(F)
154 #ifdef HAVE_PSI_FILE_INTERFACE
155 #define mysql_file_fstat(FN, S, FL) \
156 inline_mysql_file_fstat(__FILE__, __LINE__, FN, S, FL)
158 #define mysql_file_fstat(FN, S, FL) \
159 inline_mysql_file_fstat(FN, S, FL)
167 #ifdef HAVE_PSI_FILE_INTERFACE
168 #define mysql_file_stat(K, FN, S, FL) \
169 inline_mysql_file_stat(K, __FILE__, __LINE__, FN, S, FL)
171 #define mysql_file_stat(K, FN, S, FL) \
172 inline_mysql_file_stat(FN, S, FL)
180 #ifdef HAVE_PSI_FILE_INTERFACE
181 #define mysql_file_chsize(F, P1, P2, P3) \
182 inline_mysql_file_chsize(__FILE__, __LINE__, F, P1, P2, P3)
184 #define mysql_file_chsize(F, P1, P2, P3) \
185 inline_mysql_file_chsize(F, P1, P2, P3)
193 #ifdef HAVE_PSI_FILE_INTERFACE
194 #define mysql_file_fopen(K, N, F1, F2) \
195 inline_mysql_file_fopen(K, __FILE__, __LINE__, N, F1, F2)
197 #define mysql_file_fopen(K, N, F1, F2) \
198 inline_mysql_file_fopen(N, F1, F2)
213 #ifdef HAVE_PSI_FILE_INTERFACE
214 #define mysql_file_fclose(FD, FL) \
215 inline_mysql_file_fclose(__FILE__, __LINE__, FD, FL)
217 #define mysql_file_fclose(FD, FL) \
218 inline_mysql_file_fclose(FD, FL)
226 #ifdef HAVE_PSI_FILE_INTERFACE
227 #define mysql_file_fread(FD, P1, P2, P3) \
228 inline_mysql_file_fread(__FILE__, __LINE__, FD, P1, P2, P3)
230 #define mysql_file_fread(FD, P1, P2, P3) \
231 inline_mysql_file_fread(FD, P1, P2, P3)
239 #ifdef HAVE_PSI_FILE_INTERFACE
240 #define mysql_file_fwrite(FD, P1, P2, P3) \
241 inline_mysql_file_fwrite(__FILE__, __LINE__, FD, P1, P2, P3)
243 #define mysql_file_fwrite(FD, P1, P2, P3) \
244 inline_mysql_file_fwrite(FD, P1, P2, P3)
252 #ifdef HAVE_PSI_FILE_INTERFACE
253 #define mysql_file_fseek(FD, P, W, F) \
254 inline_mysql_file_fseek(__FILE__, __LINE__, FD, P, W, F)
256 #define mysql_file_fseek(FD, P, W, F) \
257 inline_mysql_file_fseek(FD, P, W, F)
265 #ifdef HAVE_PSI_FILE_INTERFACE
266 #define mysql_file_ftell(FD, F) \
267 inline_mysql_file_ftell(__FILE__, __LINE__, FD, F)
269 #define mysql_file_ftell(FD, F) \
270 inline_mysql_file_ftell(FD, F)
278 #ifdef HAVE_PSI_FILE_INTERFACE
279 #define mysql_file_create(K, N, F1, F2, F3) \
280 inline_mysql_file_create(K, __FILE__, __LINE__, N, F1, F2, F3)
282 #define mysql_file_create(K, N, F1, F2, F3) \
283 inline_mysql_file_create(N, F1, F2, F3)
291 #ifdef HAVE_PSI_FILE_INTERFACE
292 #define mysql_file_create_temp(K, T, D, P, M, F) \
293 inline_mysql_file_create_temp(K, T, D, P, M, F)
295 #define mysql_file_create_temp(K, T, D, P, M, F) \
296 inline_mysql_file_create_temp(T, D, P, M, F)
304 #ifdef HAVE_PSI_FILE_INTERFACE
305 #define mysql_file_open(K, N, F1, F2) \
306 inline_mysql_file_open(K, __FILE__, __LINE__, N, F1, F2)
308 #define mysql_file_open(K, N, F1, F2) \
309 inline_mysql_file_open(N, F1, F2)
317 #ifdef HAVE_PSI_FILE_INTERFACE
318 #define mysql_file_close(FD, F) \
319 inline_mysql_file_close(__FILE__, __LINE__, FD, F)
321 #define mysql_file_close(FD, F) \
322 inline_mysql_file_close(FD, F)
330 #ifdef HAVE_PSI_FILE_INTERFACE
331 #define mysql_file_read(FD, B, S, F) \
332 inline_mysql_file_read(__FILE__, __LINE__, FD, B, S, F)
334 #define mysql_file_read(FD, B, S, F) \
335 inline_mysql_file_read(FD, B, S, F)
343 #ifdef HAVE_PSI_FILE_INTERFACE
344 #define mysql_file_write(FD, B, S, F) \
345 inline_mysql_file_write(__FILE__, __LINE__, FD, B, S, F)
347 #define mysql_file_write(FD, B, S, F) \
348 inline_mysql_file_write(FD, B, S, F)
356 #ifdef HAVE_PSI_FILE_INTERFACE
357 #define mysql_file_pread(FD, B, S, O, F) \
358 inline_mysql_file_pread(__FILE__, __LINE__, FD, B, S, O, F)
360 #define mysql_file_pread(FD, B, S, O, F) \
361 inline_mysql_file_pread(FD, B, S, O, F)
369 #ifdef HAVE_PSI_FILE_INTERFACE
370 #define mysql_file_pwrite(FD, B, S, O, F) \
371 inline_mysql_file_pwrite(__FILE__, __LINE__, FD, B, S, O, F)
373 #define mysql_file_pwrite(FD, B, S, O, F) \
374 inline_mysql_file_pwrite(FD, B, S, O, F)
382 #ifdef HAVE_PSI_FILE_INTERFACE
383 #define mysql_file_seek(FD, P, W, F) \
384 inline_mysql_file_seek(__FILE__, __LINE__, FD, P, W, F)
386 #define mysql_file_seek(FD, P, W, F) \
387 inline_mysql_file_seek(FD, P, W, F)
395 #ifdef HAVE_PSI_FILE_INTERFACE
396 #define mysql_file_tell(FD, F) \
397 inline_mysql_file_tell(__FILE__, __LINE__, FD, F)
399 #define mysql_file_tell(FD, F) \
400 inline_mysql_file_tell(FD, F)
408 #ifdef HAVE_PSI_FILE_INTERFACE
409 #define mysql_file_delete(K, P1, P2) \
410 inline_mysql_file_delete(K, __FILE__, __LINE__, P1, P2)
412 #define mysql_file_delete(K, P1, P2) \
413 inline_mysql_file_delete(P1, P2)
421 #ifdef HAVE_PSI_FILE_INTERFACE
422 #define mysql_file_rename(K, P1, P2, P3) \
423 inline_mysql_file_rename(K, __FILE__, __LINE__, P1, P2, P3)
425 #define mysql_file_rename(K, P1, P2, P3) \
426 inline_mysql_file_rename(P1, P2, P3)
435 #ifdef HAVE_PSI_FILE_INTERFACE
436 #define mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) \
437 inline_mysql_file_create_with_symlink(K, __FILE__, __LINE__, \
440 #define mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) \
441 inline_mysql_file_create_with_symlink(P1, P2, P3, P4, P5)
450 #ifdef HAVE_PSI_FILE_INTERFACE
451 #define mysql_file_delete_with_symlink(K, P1, P2) \
452 inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2)
454 #define mysql_file_delete_with_symlink(K, P1, P2) \
455 inline_mysql_file_delete_with_symlink(P1, P2)
464 #ifdef HAVE_PSI_FILE_INTERFACE
465 #define mysql_file_rename_with_symlink(K, P1, P2, P3) \
466 inline_mysql_file_rename_with_symlink(K, __FILE__, __LINE__, P1, P2, P3)
468 #define mysql_file_rename_with_symlink(K, P1, P2, P3) \
469 inline_mysql_file_rename_with_symlink(P1, P2, P3)
477 #ifdef HAVE_PSI_FILE_INTERFACE
478 #define mysql_file_sync(P1, P2) \
479 inline_mysql_file_sync(__FILE__, __LINE__, P1, P2)
481 #define mysql_file_sync(P1, P2) \
482 inline_mysql_file_sync(P1, P2)
508 static inline void inline_mysql_file_register(
509 #ifdef HAVE_PSI_FILE_INTERFACE
510 const char *category,
514 const char *category __attribute__ ((unused)),
515 void *info __attribute__ ((unused)),
516 int count __attribute__ ((unused))
520 #ifdef HAVE_PSI_FILE_INTERFACE
521 PSI_FILE_CALL(register_file)(category, info, count);
526 inline_mysql_file_fgets(
527 #ifdef HAVE_PSI_FILE_INTERFACE
528 const char *src_file, uint src_line,
533 #ifdef HAVE_PSI_FILE_INTERFACE
534 struct PSI_file_locker *locker;
535 PSI_file_locker_state state;
536 locker= PSI_FILE_CALL(get_thread_file_stream_locker)
537 (&state, file->
m_psi, PSI_FILE_READ);
538 if (likely(locker != NULL))
540 PSI_FILE_CALL(start_file_wait)(locker, (size_t) size, src_file, src_line);
541 result= fgets(str, size, file->
m_file);
542 PSI_FILE_CALL(end_file_wait)(locker, result ? strlen(result) : 0);
547 result= fgets(str, size, file->
m_file);
552 inline_mysql_file_fgetc(
553 #ifdef HAVE_PSI_FILE_INTERFACE
554 const char *src_file, uint src_line,
559 #ifdef HAVE_PSI_FILE_INTERFACE
560 struct PSI_file_locker *locker;
561 PSI_file_locker_state state;
562 locker= PSI_FILE_CALL(get_thread_file_stream_locker)
563 (&state, file->m_psi, PSI_FILE_READ);
564 if (likely(locker != NULL))
566 PSI_FILE_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
567 result= fgetc(file->m_file);
568 PSI_FILE_CALL(end_file_wait)(locker, (size_t) 1);
573 result= fgetc(file->m_file);
578 inline_mysql_file_fputs(
579 #ifdef HAVE_PSI_FILE_INTERFACE
580 const char *src_file, uint src_line,
585 #ifdef HAVE_PSI_FILE_INTERFACE
586 struct PSI_file_locker *locker;
587 PSI_file_locker_state state;
589 locker= PSI_FILE_CALL(get_thread_file_stream_locker)
590 (&state, file->
m_psi, PSI_FILE_WRITE);
591 if (likely(locker != NULL))
593 bytes= str ? strlen(str) : 0;
594 PSI_FILE_CALL(start_file_wait)(locker, bytes, src_file, src_line);
595 result= fputs(str, file->
m_file);
596 PSI_FILE_CALL(end_file_wait)(locker, bytes);
601 result= fputs(str, file->
m_file);
606 inline_mysql_file_fputc(
607 #ifdef HAVE_PSI_FILE_INTERFACE
608 const char *src_file, uint src_line,
613 #ifdef HAVE_PSI_FILE_INTERFACE
614 struct PSI_file_locker *locker;
615 PSI_file_locker_state state;
616 locker= PSI_FILE_CALL(get_thread_file_stream_locker)
617 (&state, file->
m_psi, PSI_FILE_WRITE);
618 if (likely(locker != NULL))
620 PSI_FILE_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
621 result= fputc(c, file->
m_file);
622 PSI_FILE_CALL(end_file_wait)(locker, (size_t) 1);
627 result= fputc(c, file->
m_file);
632 inline_mysql_file_fprintf(
MYSQL_FILE *file,
const char *format, ...)
639 #ifdef HAVE_PSI_FILE_INTERFACE
640 struct PSI_file_locker *locker;
641 PSI_file_locker_state state;
642 locker= PSI_FILE_CALL(get_thread_file_stream_locker)
643 (&state, file->
m_psi, PSI_FILE_WRITE);
644 if (likely(locker != NULL))
646 PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, __FILE__, __LINE__);
647 va_start(args, format);
648 result= vfprintf(file->
m_file, format, args);
650 PSI_FILE_CALL(end_file_wait)(locker, (size_t) result);
655 va_start(args, format);
656 result= vfprintf(file->
m_file, format, args);
662 inline_mysql_file_vfprintf(
663 #ifdef HAVE_PSI_FILE_INTERFACE
664 const char *src_file, uint src_line,
666 MYSQL_FILE *file,
const char *format, va_list args)
669 #ifdef HAVE_PSI_FILE_INTERFACE
670 struct PSI_file_locker *locker;
671 PSI_file_locker_state state;
672 locker= PSI_FILE_CALL(get_thread_file_stream_locker)
673 (&state, file->m_psi, PSI_FILE_WRITE);
674 if (likely(locker != NULL))
676 PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
677 result= vfprintf(file->m_file, format, args);
678 PSI_FILE_CALL(end_file_wait)(locker, (size_t) result);
683 result= vfprintf(file->m_file, format, args);
688 inline_mysql_file_fflush(
689 #ifdef HAVE_PSI_FILE_INTERFACE
690 const char *src_file, uint src_line,
695 #ifdef HAVE_PSI_FILE_INTERFACE
696 struct PSI_file_locker *locker;
697 PSI_file_locker_state state;
698 locker= PSI_FILE_CALL(get_thread_file_stream_locker)
699 (&state, file->m_psi, PSI_FILE_FLUSH);
700 if (likely(locker != NULL))
702 PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
703 result= fflush(file->m_file);
704 PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
709 result= fflush(file->m_file);
713 static inline int inline_mysql_file_feof(
MYSQL_FILE *file)
716 return feof(file->
m_file);
720 inline_mysql_file_fstat(
721 #ifdef HAVE_PSI_FILE_INTERFACE
722 const char *src_file, uint src_line,
724 int filenr, MY_STAT *stat_area, myf
flags)
727 #ifdef HAVE_PSI_FILE_INTERFACE
728 struct PSI_file_locker *locker;
729 PSI_file_locker_state state;
730 locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
731 (&state, filenr, PSI_FILE_FSTAT);
732 if (likely(locker != NULL))
734 PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
735 result= my_fstat(filenr, stat_area, flags);
736 PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
741 result= my_fstat(filenr, stat_area, flags);
745 static inline MY_STAT *
746 inline_mysql_file_stat(
747 #ifdef HAVE_PSI_FILE_INTERFACE
748 PSI_file_key key,
const char *src_file, uint src_line,
750 const char *path, MY_STAT *stat_area, myf flags)
753 #ifdef HAVE_PSI_FILE_INTERFACE
754 struct PSI_file_locker *locker;
755 PSI_file_locker_state state;
756 locker= PSI_FILE_CALL(get_thread_file_name_locker)
757 (&state, key, PSI_FILE_STAT, path, &locker);
758 if (likely(locker != NULL))
760 PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
761 result= my_stat(path, stat_area, flags);
762 PSI_FILE_CALL(end_file_open_wait)(locker, result);
767 result= my_stat(path, stat_area, flags);
772 inline_mysql_file_chsize(
773 #ifdef HAVE_PSI_FILE_INTERFACE
774 const char *src_file, uint src_line,
776 File file, my_off_t newlength,
int filler, myf flags)
779 #ifdef HAVE_PSI_FILE_INTERFACE
780 struct PSI_file_locker *locker;
781 PSI_file_locker_state state;
782 locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
783 (&state,
file, PSI_FILE_CHSIZE);
784 if (likely(locker != NULL))
786 PSI_FILE_CALL(start_file_wait)(locker, (size_t) newlength, src_file,
788 result= my_chsize(file, newlength, filler, flags);
789 PSI_FILE_CALL(end_file_wait)(locker, (size_t) newlength);
794 result= my_chsize(file, newlength, filler, flags);
799 inline_mysql_file_fopen(
800 #ifdef HAVE_PSI_FILE_INTERFACE
801 PSI_file_key key,
const char *src_file, uint src_line,
803 const char *filename,
int flags, myf myFlags)
807 if (likely(that != NULL))
809 #ifdef HAVE_PSI_FILE_INTERFACE
810 struct PSI_file_locker *locker;
811 PSI_file_locker_state state;
812 locker= PSI_FILE_CALL(get_thread_file_name_locker)
813 (&state, key, PSI_FILE_STREAM_OPEN, filename, that);
814 if (likely(locker != NULL))
816 PSI_FILE_CALL(start_file_open_wait)
817 (locker, src_file, src_line);
818 that->
m_file= my_fopen(filename, flags, myFlags);
819 that->
m_psi= PSI_FILE_CALL(end_file_open_wait)(locker, that->
m_file);
820 if (unlikely(that->
m_file == NULL))
830 that->
m_file= my_fopen(filename, flags, myFlags);
831 if (unlikely(that->
m_file == NULL))
841 inline_mysql_file_fclose(
842 #ifdef HAVE_PSI_FILE_INTERFACE
843 const char *src_file, uint src_line,
848 if (likely(file != NULL))
850 #ifdef HAVE_PSI_FILE_INTERFACE
851 struct PSI_file_locker *locker;
852 PSI_file_locker_state state;
853 locker= PSI_FILE_CALL(get_thread_file_stream_locker)
854 (&state, file->m_psi, PSI_FILE_STREAM_CLOSE);
855 if (likely(locker != NULL))
857 PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
858 result= my_fclose(file->m_file, flags);
859 PSI_FILE_CALL(end_file_close_wait)(locker, result);
865 result= my_fclose(file->m_file, flags);
872 inline_mysql_file_fread(
873 #ifdef HAVE_PSI_FILE_INTERFACE
874 const char *src_file, uint src_line,
876 MYSQL_FILE *file, uchar *buffer,
size_t count, myf flags)
879 #ifdef HAVE_PSI_FILE_INTERFACE
880 struct PSI_file_locker *locker;
881 PSI_file_locker_state state;
883 locker= PSI_FILE_CALL(get_thread_file_stream_locker)
884 (&state, file->m_psi, PSI_FILE_READ);
885 if (likely(locker != NULL))
887 PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
888 result= my_fread(file->m_file, buffer, count, flags);
889 if (flags & (MY_NABP | MY_FNABP))
890 bytes_read= (result == 0) ? count : 0;
892 bytes_read= (result != MY_FILE_ERROR) ? result : 0;
893 PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
898 result= my_fread(file->m_file, buffer, count, flags);
903 inline_mysql_file_fwrite(
904 #ifdef HAVE_PSI_FILE_INTERFACE
905 const char *src_file, uint src_line,
907 MYSQL_FILE *file,
const uchar *buffer,
size_t count, myf flags)
910 #ifdef HAVE_PSI_FILE_INTERFACE
911 struct PSI_file_locker *locker;
912 PSI_file_locker_state state;
913 size_t bytes_written;
914 locker= PSI_FILE_CALL(get_thread_file_stream_locker)
915 (&state, file->m_psi, PSI_FILE_WRITE);
916 if (likely(locker != NULL))
918 PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
919 result= my_fwrite(file->m_file, buffer, count, flags);
920 if (flags & (MY_NABP | MY_FNABP))
921 bytes_written= (result == 0) ? count : 0;
923 bytes_written= (result != MY_FILE_ERROR) ? result : 0;
924 PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
929 result= my_fwrite(file->m_file, buffer, count, flags);
933 static inline my_off_t
934 inline_mysql_file_fseek(
935 #ifdef HAVE_PSI_FILE_INTERFACE
936 const char *src_file, uint src_line,
938 MYSQL_FILE *file, my_off_t pos,
int whence, myf flags)
941 #ifdef HAVE_PSI_FILE_INTERFACE
942 struct PSI_file_locker *locker;
943 PSI_file_locker_state state;
944 locker= PSI_FILE_CALL(get_thread_file_stream_locker)
945 (&state, file->m_psi, PSI_FILE_SEEK);
946 if (likely(locker != NULL))
948 PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
949 result= my_fseek(file->m_file, pos, whence, flags);
950 PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
955 result= my_fseek(file->m_file, pos, whence, flags);
959 static inline my_off_t
960 inline_mysql_file_ftell(
961 #ifdef HAVE_PSI_FILE_INTERFACE
962 const char *src_file, uint src_line,
967 #ifdef HAVE_PSI_FILE_INTERFACE
968 struct PSI_file_locker *locker;
969 PSI_file_locker_state state;
970 locker= PSI_FILE_CALL(get_thread_file_stream_locker)
971 (&state, file->m_psi, PSI_FILE_TELL);
972 if (likely(locker != NULL))
974 PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
975 result= my_ftell(file->m_file, flags);
976 PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
981 result= my_ftell(file->m_file, flags);
986 inline_mysql_file_create(
987 #ifdef HAVE_PSI_FILE_INTERFACE
988 PSI_file_key key,
const char *src_file, uint src_line,
990 const char *filename,
int create_flags,
int access_flags, myf myFlags)
993 #ifdef HAVE_PSI_FILE_INTERFACE
994 struct PSI_file_locker *locker;
995 PSI_file_locker_state state;
996 locker= PSI_FILE_CALL(get_thread_file_name_locker)
997 (&state, key, PSI_FILE_CREATE, filename, &locker);
998 if (likely(locker != NULL))
1000 PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
1001 file= my_create(filename, create_flags, access_flags, myFlags);
1002 PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker,
file);
1007 file= my_create(filename, create_flags, access_flags, myFlags);
1012 inline_mysql_file_create_temp(
1013 #ifdef HAVE_PSI_FILE_INTERFACE
1016 char *
to,
const char *dir,
const char *pfx,
int mode, myf myFlags)
1024 file= create_temp_file(to, dir, pfx, mode, myFlags);
1025 #ifdef HAVE_PSI_FILE_INTERFACE
1026 PSI_FILE_CALL(create_file)(key,
to,
file);
1032 inline_mysql_file_open(
1033 #ifdef HAVE_PSI_FILE_INTERFACE
1034 PSI_file_key key,
const char *src_file, uint src_line,
1036 const char *filename,
int flags, myf myFlags)
1039 #ifdef HAVE_PSI_FILE_INTERFACE
1040 struct PSI_file_locker *locker;
1041 PSI_file_locker_state state;
1042 locker= PSI_FILE_CALL(get_thread_file_name_locker)
1043 (&state, key, PSI_FILE_OPEN, filename, &locker);
1044 if (likely(locker != NULL))
1046 PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
1047 file= my_open(filename, flags, myFlags);
1048 PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker,
file);
1053 file= my_open(filename, flags, myFlags);
1058 inline_mysql_file_close(
1059 #ifdef HAVE_PSI_FILE_INTERFACE
1060 const char *src_file, uint src_line,
1062 File file, myf flags)
1065 #ifdef HAVE_PSI_FILE_INTERFACE
1066 struct PSI_file_locker *locker;
1067 PSI_file_locker_state state;
1068 locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
1069 (&state,
file, PSI_FILE_CLOSE);
1070 if (likely(locker != NULL))
1072 PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
1073 result= my_close(file, flags);
1074 PSI_FILE_CALL(end_file_close_wait)(locker, result);
1079 result= my_close(file, flags);
1083 static inline size_t
1084 inline_mysql_file_read(
1085 #ifdef HAVE_PSI_FILE_INTERFACE
1086 const char *src_file, uint src_line,
1088 File file, uchar *buffer,
size_t count, myf flags)
1091 #ifdef HAVE_PSI_FILE_INTERFACE
1092 struct PSI_file_locker *locker;
1093 PSI_file_locker_state state;
1095 locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
1096 (&state,
file, PSI_FILE_READ);
1097 if (likely(locker != NULL))
1099 PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
1100 result= my_read(file, buffer, count, flags);
1101 if (flags & (MY_NABP | MY_FNABP))
1102 bytes_read= (result == 0) ? count : 0;
1104 bytes_read= (result != MY_FILE_ERROR) ? result : 0;
1105 PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
1110 result= my_read(file, buffer, count, flags);
1114 static inline size_t
1115 inline_mysql_file_write(
1116 #ifdef HAVE_PSI_FILE_INTERFACE
1117 const char *src_file, uint src_line,
1119 File file,
const uchar *buffer,
size_t count, myf flags)
1122 #ifdef HAVE_PSI_FILE_INTERFACE
1123 struct PSI_file_locker *locker;
1124 PSI_file_locker_state state;
1125 size_t bytes_written;
1126 locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
1127 (&state,
file, PSI_FILE_WRITE);
1128 if (likely(locker != NULL))
1130 PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
1131 result= my_write(file, buffer, count, flags);
1132 if (flags & (MY_NABP | MY_FNABP))
1133 bytes_written= (result == 0) ? count : 0;
1135 bytes_written= (result != MY_FILE_ERROR) ? result : 0;
1136 PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
1141 result= my_write(file, buffer, count, flags);
1145 static inline size_t
1146 inline_mysql_file_pread(
1147 #ifdef HAVE_PSI_FILE_INTERFACE
1148 const char *src_file, uint src_line,
1150 File file, uchar *buffer,
size_t count, my_off_t
offset, myf flags)
1153 #ifdef HAVE_PSI_FILE_INTERFACE
1154 struct PSI_file_locker *locker;
1155 PSI_file_locker_state state;
1157 locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
1158 (&state,
file, PSI_FILE_READ);
1159 if (likely(locker != NULL))
1161 PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
1162 result= my_pread(file, buffer, count, offset, flags);
1163 if (flags & (MY_NABP | MY_FNABP))
1164 bytes_read= (result == 0) ? count : 0;
1166 bytes_read= (result != MY_FILE_ERROR) ? result : 0;
1167 PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
1172 result= my_pread(file, buffer, count, offset, flags);
1176 static inline size_t
1177 inline_mysql_file_pwrite(
1178 #ifdef HAVE_PSI_FILE_INTERFACE
1179 const char *src_file, uint src_line,
1181 File file,
const uchar *buffer,
size_t count, my_off_t offset, myf flags)
1184 #ifdef HAVE_PSI_FILE_INTERFACE
1185 struct PSI_file_locker *locker;
1186 PSI_file_locker_state state;
1187 size_t bytes_written;
1188 locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
1189 (&state,
file, PSI_FILE_WRITE);
1190 if (likely(locker != NULL))
1192 PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
1193 result= my_pwrite(file, buffer, count, offset, flags);
1194 if (flags & (MY_NABP | MY_FNABP))
1195 bytes_written= (result == 0) ? count : 0;
1197 bytes_written= (result != MY_FILE_ERROR) ? result : 0;
1198 PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
1203 result= my_pwrite(file, buffer, count, offset, flags);
1207 static inline my_off_t
1208 inline_mysql_file_seek(
1209 #ifdef HAVE_PSI_FILE_INTERFACE
1210 const char *src_file, uint src_line,
1212 File file, my_off_t pos,
int whence, myf flags)
1215 #ifdef HAVE_PSI_FILE_INTERFACE
1216 struct PSI_file_locker *locker;
1217 PSI_file_locker_state state;
1218 locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
1219 (&state,
file, PSI_FILE_SEEK);
1220 if (likely(locker != NULL))
1222 PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
1223 result= my_seek(file, pos, whence, flags);
1224 PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
1229 result= my_seek(file, pos, whence, flags);
1233 static inline my_off_t
1234 inline_mysql_file_tell(
1235 #ifdef HAVE_PSI_FILE_INTERFACE
1236 const char *src_file, uint src_line,
1238 File file, myf flags)
1241 #ifdef HAVE_PSI_FILE_INTERFACE
1242 struct PSI_file_locker *locker;
1243 PSI_file_locker_state state;
1244 locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
1245 (&state,
file, PSI_FILE_TELL);
1246 if (likely(locker != NULL))
1248 PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
1249 result= my_tell(file, flags);
1250 PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
1255 result= my_tell(file, flags);
1260 inline_mysql_file_delete(
1261 #ifdef HAVE_PSI_FILE_INTERFACE
1262 PSI_file_key key,
const char *src_file, uint src_line,
1264 const char *
name, myf flags)
1267 #ifdef HAVE_PSI_FILE_INTERFACE
1268 struct PSI_file_locker *locker;
1269 PSI_file_locker_state state;
1270 locker= PSI_FILE_CALL(get_thread_file_name_locker)
1271 (&state, key, PSI_FILE_DELETE,
name, &locker);
1272 if (likely(locker != NULL))
1274 PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
1275 result= my_delete(name, flags);
1276 PSI_FILE_CALL(end_file_close_wait)(locker, result);
1281 result= my_delete(name, flags);
1286 inline_mysql_file_rename(
1287 #ifdef HAVE_PSI_FILE_INTERFACE
1288 PSI_file_key key,
const char *src_file, uint src_line,
1290 const char *from,
const char *
to, myf flags)
1293 #ifdef HAVE_PSI_FILE_INTERFACE
1294 struct PSI_file_locker *locker;
1295 PSI_file_locker_state state;
1296 locker= PSI_FILE_CALL(get_thread_file_name_locker)
1297 (&state, key, PSI_FILE_RENAME,
to, &locker);
1298 if (likely(locker != NULL))
1300 PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
1301 result= my_rename(from, to, flags);
1302 PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
1307 result= my_rename(from, to, flags);
1312 inline_mysql_file_create_with_symlink(
1313 #ifdef HAVE_PSI_FILE_INTERFACE
1314 PSI_file_key key,
const char *src_file, uint src_line,
1316 const char *linkname,
const char *filename,
int create_flags,
1317 int access_flags, myf flags)
1320 #ifdef HAVE_PSI_FILE_INTERFACE
1321 struct PSI_file_locker *locker;
1322 PSI_file_locker_state state;
1323 locker= PSI_FILE_CALL(get_thread_file_name_locker)
1324 (&state, key, PSI_FILE_CREATE, filename, &locker);
1325 if (likely(locker != NULL))
1327 PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
1328 file= my_create_with_symlink(linkname, filename, create_flags, access_flags,
1330 PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker,
file);
1335 file= my_create_with_symlink(linkname, filename, create_flags, access_flags,
1341 inline_mysql_file_delete_with_symlink(
1342 #ifdef HAVE_PSI_FILE_INTERFACE
1343 PSI_file_key key,
const char *src_file, uint src_line,
1345 const char *name, myf flags)
1348 #ifdef HAVE_PSI_FILE_INTERFACE
1349 struct PSI_file_locker *locker;
1350 PSI_file_locker_state state;
1351 locker= PSI_FILE_CALL(get_thread_file_name_locker)
1352 (&state, key, PSI_FILE_DELETE,
name, &locker);
1353 if (likely(locker != NULL))
1355 PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
1356 result= my_delete_with_symlink(name, flags);
1357 PSI_FILE_CALL(end_file_close_wait)(locker, result);
1362 result= my_delete_with_symlink(name, flags);
1367 inline_mysql_file_rename_with_symlink(
1368 #ifdef HAVE_PSI_FILE_INTERFACE
1369 PSI_file_key key,
const char *src_file, uint src_line,
1371 const char *from,
const char *to, myf flags)
1374 #ifdef HAVE_PSI_FILE_INTERFACE
1375 struct PSI_file_locker *locker;
1376 PSI_file_locker_state state;
1377 locker= PSI_FILE_CALL(get_thread_file_name_locker)
1378 (&state, key, PSI_FILE_RENAME,
to, &locker);
1379 if (likely(locker != NULL))
1381 PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
1382 result= my_rename_with_symlink(from, to, flags);
1383 PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
1388 result= my_rename_with_symlink(from, to, flags);
1393 inline_mysql_file_sync(
1394 #ifdef HAVE_PSI_FILE_INTERFACE
1395 const char *src_file, uint src_line,
1400 #ifdef HAVE_PSI_FILE_INTERFACE
1401 struct PSI_file_locker *locker;
1402 PSI_file_locker_state state;
1403 locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
1404 (&state, fd, PSI_FILE_SYNC);
1405 if (likely(locker != NULL))
1407 PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
1408 result= my_sync(fd, flags);
1409 PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
1414 result= my_sync(fd, flags);