Skip to content

Commit

Permalink
Fixed CORE-2807: Problem with tracing on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPeshkoff committed Dec 14, 2009
1 parent 486b0ba commit cf3ef42
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/jrd/isc_sync.cpp
Expand Up @@ -1763,7 +1763,7 @@ UCHAR* ISC_map_file(Arg::StatusVector& statusVector,
#else
int
#endif
fd_init = os_utils::openCreateShmemFile(init_filename, 0);
fd_init = os_utils::openCreateSharedFile(init_filename, 0);
if (fd_init == -1)
{
error(statusVector, "open", errno);
Expand All @@ -1785,7 +1785,7 @@ UCHAR* ISC_map_file(Arg::StatusVector& statusVector,
{
TEXT sem_filename[MAXPATHLEN];
gds__prefix_lock(sem_filename, SEM_FILE);
const int f = os_utils::openCreateShmemFile(sem_filename, 0);
const int f = os_utils::openCreateSharedFile(sem_filename, 0);
if (f == -1)
{
error(statusVector, "open", errno);
Expand Down Expand Up @@ -1815,7 +1815,7 @@ UCHAR* ISC_map_file(Arg::StatusVector& statusVector,
#endif

// open the file to be inited
const int fd = os_utils::openCreateShmemFile(expanded_filename, 0);
const int fd = os_utils::openCreateSharedFile(expanded_filename, 0);
if (fd == -1)
{
error(statusVector, "open", errno);
Expand Down Expand Up @@ -1994,7 +1994,7 @@ UCHAR* ISC_map_file(Arg::StatusVector& statusVector,

MutexLockGuard guard(openFdInit);

const int fd = os_utils::openCreateShmemFile(expanded_filename, O_TRUNC);
const int fd = os_utils::openCreateSharedFile(expanded_filename, O_TRUNC);
if (fd < 0)
{
error(statusVector, "open", errno);
Expand Down Expand Up @@ -3915,7 +3915,7 @@ static SLONG find_key(Arg::StatusVector& statusVector, const TEXT* filename)
key_t key = ftok(filename, FTOK_KEY);
if (key == -1)
{
int fd = os_utils::openCreateShmemFile(filename, O_TRUNC);
int fd = os_utils::openCreateSharedFile(filename, O_TRUNC);
if (fd == -1)
{
error(statusVector, "open", errno);
Expand Down
2 changes: 1 addition & 1 deletion src/jrd/os/os_utils.h
Expand Up @@ -42,7 +42,7 @@ namespace os_utils
bool get_user_home(int user_id, Firebird::PathName& homeDir);

void createLockDirectory(const char* pathname);
int openCreateShmemFile(const char* pathname, int flags);
int openCreateSharedFile(const char* pathname, int flags);

} // namespace os_utils

Expand Down
2 changes: 1 addition & 1 deletion src/jrd/os/posix/os_utils.cpp
Expand Up @@ -152,7 +152,7 @@ void createLockDirectory(const char* pathname)
}

// open (or create if missing) and set appropriate access rights
int openCreateShmemFile(const char* pathname, int flags)
int openCreateSharedFile(const char* pathname, int flags)
{
int fd;
do {
Expand Down
2 changes: 1 addition & 1 deletion src/jrd/os/win32/os_utils.cpp
Expand Up @@ -236,7 +236,7 @@ void createLockDirectory(const char* pathname)
}

// open (or create if missing) and set appropriate access rights
int openCreateShmemFile(const char* pathname, int flags)
int openCreateSharedFile(const char* pathname, int flags)
{
return ::open(pathname, flags | O_RDWR | O_CREAT, S_IREAD | S_IWRITE);
}
Expand Down
2 changes: 1 addition & 1 deletion src/jrd/trace/TraceConfigStorage.cpp
Expand Up @@ -200,7 +200,7 @@ void ConfigStorage::checkFile()

PathName filename = TempFile::create("fb_trace_", dir);
filename.copyTo(cfg_file_name, sizeof(m_base->cfg_file_name));
m_cfg_file = os_utils::openCreateShmemFile(cfg_file_name, O_BINARY);
m_cfg_file = os_utils::openCreateSharedFile(cfg_file_name, O_BINARY);
}
else
{
Expand Down
11 changes: 5 additions & 6 deletions src/jrd/trace/TraceLog.cpp
Expand Up @@ -41,6 +41,7 @@
#include "../../jrd/isc_proto.h"
#include "../../jrd/isc_s_proto.h"
#include "../../jrd/os/path_utils.h"
#include "../../jrd/os/os_utils.h"
#include "../../jrd/trace/TraceLog.h"

using namespace Firebird;
Expand Down Expand Up @@ -110,14 +111,12 @@ int TraceLog::openFile(int fileNum)
PathName fileName;
fileName.printf("%s.%07ld", m_baseFileName.c_str(), fileNum);

const int oflag = O_CREAT | O_RDWR
int file = os_utils::openCreateSharedFile(fileName.c_str(),
#ifdef WIN_NT
| O_BINARY | O_SEQUENTIAL | _O_SHORT_LIVED
O_BINARY | O_SEQUENTIAL | _O_SHORT_LIVED);
#else
0);
#endif
;
const int pflag = S_IREAD | S_IWRITE;

int file = open(fileName.c_str(), oflag, pflag);

return file;
}
Expand Down

0 comments on commit cf3ef42

Please sign in to comment.