MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / my_close

Function my_close

mysys/my_open.c:120–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118*/
119
120int my_close(File fd, myf MyFlags)
121{
122 int err;
123 DBUG_ENTER("my_close");
124 DBUG_PRINT("my",("fd: %d MyFlags: %d",fd, MyFlags));
125
126 mysql_mutex_lock(&THR_LOCK_open);
127#ifndef _WIN32
128 do
129 {
130 err= close(fd);
131 } while (err == -1 && errno == EINTR);
132#else
133 err= my_win_close(fd);
134#endif
135 if (err)
136 {
137 DBUG_PRINT("error",("Got error %d on close",err));
138 my_errno=errno;
139 if (MyFlags & (MY_FAE | MY_WME))
140 {
141 char errbuf[MYSYS_STRERROR_SIZE];
142 my_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG), my_filename(fd),
143 my_errno, my_strerror(errbuf, sizeof(errbuf), my_errno));
144 }
145 }
146 if ((uint) fd < my_file_limit && my_file_info[fd].type != UNOPEN)
147 {
148 my_free(my_file_info[fd].name);
149#if !defined(HAVE_PREAD) && !defined(_WIN32)
150 mysql_mutex_destroy(&my_file_info[fd].mutex);
151#endif
152 my_file_info[fd].type = UNOPEN;
153 }
154 my_file_opened--;
155 mysql_mutex_unlock(&THR_LOCK_open);
156 DBUG_RETURN(err);
157} /* my_close */
158
159
160/*

Callers 10

close_fileFunction · 0.85
cache_remove_open_tmpFunction · 0.85
close_cached_fileFunction · 0.85
my_sync_dirFunction · 0.85
symdirgetFunction · 0.85
my_register_filenameFunction · 0.85
my_createFunction · 0.85
my_copyFunction · 0.85
my_create_with_symlinkFunction · 0.85
inline_mysql_file_closeFunction · 0.85

Calls 5

my_win_closeFunction · 0.85
my_errorFunction · 0.85
my_filenameFunction · 0.85
my_strerrorFunction · 0.85
my_freeFunction · 0.85

Tested by

no test coverage detected