File system operations.
От | Anastasia Lubennikova |
---|---|
Тема | File system operations. |
Дата | |
Msg-id | 7c702f13-3270-863a-9874-69818aa2adbd@postgrespro.ru обсуждение исходный текст |
Ответы |
Re: File system operations.
|
Список | pgsql-hackers |
Hi, hackers! Do we have any standard set of functions to operate with files? I mean link(), copy(), rename(), unlink(), ftruncate() and so on. Mostly I worry about the first two since they have different implementation on Windows. I found a couple of functions in src/backend/storage/file/copydir.c, some more in src/bin/pg_upgrade/file.c along with a set of defines in src/bin/pg_upgrade/pg_upgrade.h. Obviously md.c and fd.c contain some functions. Do we have any policy of using them? There is a comment in fd.c * For this scheme to work, most (if not all) routines throughout the * server should use these interfaces instead of callingthe C library * routines (e.g., open(2) and fopen(3)) themselves. Otherwise, we * may find ourselves short of realfile descriptors anyway. and even more in fd.h * File {Close, Read, Write, Seek, Tell, Sync} * {Path Name Open, Allocate, Free} File * * These are NOT JUST RENAMINGSOF THE UNIX ROUTINES. * Use them for all file activity... but I see that, for example, pg_open_tzfile() and get_controlfile(), logfile_open() call open()/fopen() directly. Same behavior you can find for any C library function. Am I missing something important or it is simply a legasy/overlooked code? What do you think about moving stuff from pg_upgrade/file.c to storage/file/ to allow reuse of this code? I think it'll be really helpful for developers of contrib modules like backup managers. -- Anastasia Lubennikova Postgres Professional:http://www.postgrespro.com The Russian Postgres Company
В списке pgsql-hackers по дате отправления: