From 183710558f78bb2fa55640ef1f0d2e087355240e Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Tue, 19 Oct 2010 11:49:31 -0200 Subject: Bug#45288: pb2 returns a lot of compilation warnings on linux Fix assorted compiler warnings on Mac OS X. BUILD/SETUP.sh: Remove -Wctor-dtor-privacy flag to workaround a GCC bug that causes it to not properly detect that implicitly generated constructors are always public. cmd-line-utils/readline/terminal.c: tgetnum and tgetflag might not take a const string argument. mysys/my_gethostbyname.c: Tag unused arguments. mysys/my_sync.c: Tag unused arguments. --- mysys/my_sync.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'mysys/my_sync.c') diff --git a/mysys/my_sync.c b/mysys/my_sync.c index 97540f5eb48..d6ca4f1c1df 100644 --- a/mysys/my_sync.c +++ b/mysys/my_sync.c @@ -89,6 +89,8 @@ int my_sync(File fd, myf my_flags) static const char cur_dir_name[]= {FN_CURLIB, 0}; + + /* Force directory information to disk. @@ -100,9 +102,11 @@ static const char cur_dir_name[]= {FN_CURLIB, 0}; RETURN 0 if ok, !=0 if error */ + +#ifdef NEED_EXPLICIT_SYNC_DIR + int my_sync_dir(const char *dir_name, myf my_flags) { -#ifdef NEED_EXPLICIT_SYNC_DIR File dir_fd; int res= 0; const char *correct_dir_name; @@ -124,11 +128,18 @@ int my_sync_dir(const char *dir_name, myf my_flags) else res= 1; DBUG_RETURN(res); -#else +} + +#else /* NEED_EXPLICIT_SYNC_DIR */ + +int my_sync_dir(const char *dir_name __attribute__((unused)), + myf my_flags __attribute__((unused))) +{ return 0; -#endif } +#endif /* NEED_EXPLICIT_SYNC_DIR */ + /* Force directory information to disk. @@ -141,15 +152,24 @@ int my_sync_dir(const char *dir_name, myf my_flags) RETURN 0 if ok, !=0 if error */ + +#ifdef NEED_EXPLICIT_SYNC_DIR + int my_sync_dir_by_file(const char *file_name, myf my_flags) { -#ifdef NEED_EXPLICIT_SYNC_DIR char dir_name[FN_REFLEN]; size_t dir_name_length; dirname_part(dir_name, file_name, &dir_name_length); return my_sync_dir(dir_name, my_flags); -#else +} + +#else /* NEED_EXPLICIT_SYNC_DIR */ + +int my_sync_dir_by_file(const char *file_name __attribute__((unused)), + myf my_flags __attribute__((unused))) +{ return 0; -#endif } +#endif /* NEED_EXPLICIT_SYNC_DIR */ + -- cgit v1.2.1 From 7406b38efa0a2eec5a245839c5ce13b85d51d125 Mon Sep 17 00:00:00 2001 From: Davi Arnaut Date: Tue, 19 Oct 2010 14:48:03 -0200 Subject: Bug#45288: pb2 returns a lot of compilation warnings Ensure that fdatasync is properly declared as on Mac OS X, the function is available but there is no prototype. Also, port a fix for a warning from the InnoDB plugin over to the builtin. configure.in: Check that fdatasync is declared. mysys/my_sync.c: Use fdatasync only if it is declared. storage/innobase/include/ut0dbg.h: Port over from the plugin a fix for a warning. --- mysys/my_sync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysys/my_sync.c') diff --git a/mysys/my_sync.c b/mysys/my_sync.c index d6ca4f1c1df..7acbccec345 100644 --- a/mysys/my_sync.c +++ b/mysys/my_sync.c @@ -58,7 +58,7 @@ int my_sync(File fd, myf my_flags) /* Some file systems don't support F_FULLFSYNC and fail above: */ DBUG_PRINT("info",("fcntl(F_FULLFSYNC) failed, falling back")); #endif -#if defined(HAVE_FDATASYNC) +#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC res= fdatasync(fd); #elif defined(HAVE_FSYNC) res= fsync(fd); -- cgit v1.2.1 From c0854c3e1746f81abcba27505c7f8adc09ff2c45 Mon Sep 17 00:00:00 2001 From: Mikael Ronstrom Date: Thu, 28 Oct 2010 18:27:25 +0200 Subject: Added reporting of fsync to THD wait interface --- mysys/my_sync.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'mysys/my_sync.c') diff --git a/mysys/my_sync.c b/mysys/my_sync.c index bc050922ffc..6a4e26a6542 100644 --- a/mysys/my_sync.c +++ b/mysys/my_sync.c @@ -17,6 +17,16 @@ #include "mysys_err.h" #include +static void (*before_sync_wait)(void)= 0; +static void (*after_sync_wait)(void)= 0; + +void thr_set_sync_wait_callback(void (*before_wait)(void), + void (*after_wait)(void)) +{ + before_sync_wait= before_wait; + after_sync_wait= after_wait; +} + /* Sync data in file to disk @@ -48,6 +58,8 @@ int my_sync(File fd, myf my_flags) do { + if (before_sync_wait) + (*before_sync_wait)(); #if defined(F_FULLFSYNC) /* In Mac OS X >= 10.3 this call is safer than fsync() (it forces the @@ -75,6 +87,8 @@ int my_sync(File fd, myf my_flags) int er= errno; if (!(my_errno= er)) my_errno= -1; /* Unknown error */ + if (after_sync_wait) + (*after_sync_wait)(); if ((my_flags & MY_IGNORE_BADFD) && (er == EBADF || er == EINVAL || er == EROFS)) { @@ -84,6 +98,11 @@ int my_sync(File fd, myf my_flags) else if (my_flags & MY_WME) my_error(EE_SYNC, MYF(ME_BELL+ME_WAITTANG), my_filename(fd), my_errno); } + else + { + if (after_sync_wait) + (*after_sync_wait)(); + } DBUG_RETURN(res); } /* my_sync */ -- cgit v1.2.1 From cede2d8d76aa1963b0b16b0065c4fb9f75731e15 Mon Sep 17 00:00:00 2001 From: Mikael Ronstrom Date: Fri, 4 Mar 2011 12:42:20 +0100 Subject: Fixed wrong order of call to thd_wait service --- mysys/my_sync.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mysys/my_sync.c') diff --git a/mysys/my_sync.c b/mysys/my_sync.c index 3ca57055470..076b9b40642 100644 --- a/mysys/my_sync.c +++ b/mysys/my_sync.c @@ -56,10 +56,10 @@ int my_sync(File fd, myf my_flags) DBUG_ENTER("my_sync"); DBUG_PRINT("my",("Fd: %d my_flags: %d", fd, my_flags)); + if (before_sync_wait) + (*before_sync_wait)(); do { - if (before_sync_wait) - (*before_sync_wait)(); #if defined(F_FULLFSYNC) /* In Mac OS X >= 10.3 this call is safer than fsync() (it forces the -- cgit v1.2.1