~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_sync.c

  • Committer: Brian Aker
  • Date: 2008-07-14 03:04:13 UTC
  • mfrom: (77.1.90 codestyle)
  • Revision ID: brian@tangent.org-20080714030413-dpv6opb0eoy1rd3f
Merging Monty's code, I did remove error on compile though (since it does
not currently work because of sql_plugin.cc)

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
int my_sync(File fd, myf my_flags)
44
44
{
45
45
  int res;
 
46
  DBUG_ENTER("my_sync");
 
47
  DBUG_PRINT("my",("Fd: %d  my_flags: %d", fd, my_flags));
46
48
 
47
49
  do
48
50
  {
54
56
    if (!(res= fcntl(fd, F_FULLFSYNC, 0)))
55
57
      break; /* ok */
56
58
    /* Some file systems don't support F_FULLFSYNC and fail above: */
 
59
    DBUG_PRINT("info",("fcntl(F_FULLFSYNC) failed, falling back"));
57
60
#endif
58
61
#if defined(HAVE_FDATASYNC)
59
62
    res= fdatasync(fd);
73
76
    if ((my_flags & MY_IGNORE_BADFD) &&
74
77
        (er == EBADF || er == EINVAL || er == EROFS))
75
78
    {
 
79
      DBUG_PRINT("info", ("ignoring errno %d", er));
76
80
      res= 0;
77
81
    }
78
82
    else if (my_flags & MY_WME)
79
83
      my_error(EE_SYNC, MYF(ME_BELL+ME_WAITTANG), my_filename(fd), my_errno);
80
84
  }
81
 
  return(res);
 
85
  DBUG_RETURN(res);
82
86
} /* my_sync */
83
87
 
84
88
 
94
98
  RETURN
95
99
    0 if ok, !=0 if error
96
100
*/
97
 
int my_sync_dir(const char *dir_name __attribute__((unused)),
98
 
                myf my_flags __attribute__((unused)))
 
101
int my_sync_dir(const char *dir_name, myf my_flags)
99
102
{
100
103
#ifdef NEED_EXPLICIT_SYNC_DIR
 
104
  DBUG_ENTER("my_sync_dir");
 
105
  DBUG_PRINT("my",("Dir: '%s'  my_flags: %d", dir_name, my_flags));
101
106
  File dir_fd;
102
107
  int res= 0;
103
108
  const char *correct_dir_name;
116
121
  }
117
122
  else
118
123
    res= 1;
119
 
  return(res);
 
124
  DBUG_RETURN(res);
120
125
#else
121
126
  return 0;
122
127
#endif
134
139
  RETURN
135
140
    0 if ok, !=0 if error
136
141
*/
137
 
int my_sync_dir_by_file(const char *file_name __attribute__((unused)),
138
 
                        myf my_flags __attribute__((unused)))
 
142
int my_sync_dir_by_file(const char *file_name, myf my_flags)
139
143
{
140
144
#ifdef NEED_EXPLICIT_SYNC_DIR
141
145
  char dir_name[FN_REFLEN];