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

Function my_fdopen

mysys/my_fopen.c:272–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270 /* Name may be 0 */
271
272FILE *my_fdopen(File Filedes, const char *name, int Flags, myf MyFlags)
273{
274 FILE *fd;
275 char type[5];
276 DBUG_ENTER("my_fdopen");
277 DBUG_PRINT("my",("Fd: %d Flags: %d MyFlags: %d",
278 Filedes, Flags, MyFlags));
279
280 make_ftype(type,Flags);
281#ifdef _WIN32
282 fd= my_win_fdopen(Filedes, type);
283#else
284 fd= fdopen(Filedes, type);
285#endif
286 if (!fd)
287 {
288 my_errno=errno;
289 if (MyFlags & (MY_FAE | MY_WME))
290 {
291 char errbuf[MYSYS_STRERROR_SIZE];
292 my_error(EE_CANT_OPEN_STREAM, MYF(ME_BELL+ME_WAITTANG),
293 my_errno, my_strerror(errbuf, sizeof(errbuf), my_errno));
294 }
295 }
296 else
297 {
298 mysql_mutex_lock(&THR_LOCK_open);
299 my_stream_opened++;
300 if ((uint) Filedes < (uint) my_file_limit)
301 {
302 if (my_file_info[Filedes].type != UNOPEN)
303 {
304 my_file_opened--; /* File is opened with my_open ! */
305 }
306 else
307 {
308 my_file_info[Filedes].name= my_strdup(name,MyFlags);
309 }
310 my_file_info[Filedes].type = STREAM_BY_FDOPEN;
311 }
312 mysql_mutex_unlock(&THR_LOCK_open);
313 }
314
315 DBUG_PRINT("exit",("stream: 0x%lx", (long) fd));
316 DBUG_RETURN(fd);
317} /* my_fdopen */
318
319
320/*

Callers 1

convert_fileFunction · 0.85

Calls 5

make_ftypeFunction · 0.85
my_win_fdopenFunction · 0.85
my_errorFunction · 0.85
my_strerrorFunction · 0.85
my_strdupFunction · 0.85

Tested by

no test coverage detected