MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / openDirectLogFiledes

Function openDirectLogFiledes

src/debug.cpp:1637–1643  ·  view source on GitHub ↗

Return a file descriptor to write directly to the Redis log with the * write(2) syscall, that can be used in critical sections of the code * where the rest of Redis can't be trusted (for example during the memory * test) or when an API call requires a raw fd. * * Close it with closeDirectLogFiledes(). */

Source from the content-addressed store, hash-verified

1635 *
1636 * Close it with closeDirectLogFiledes(). */
1637int openDirectLogFiledes(void) {
1638 int log_to_stdout = g_pserver->logfile[0] == '\0';
1639 int fd = log_to_stdout ?
1640 STDOUT_FILENO :
1641 open(g_pserver->logfile, O_APPEND|O_CREAT|O_WRONLY, 0644);
1642 return fd;
1643}
1644
1645/* Used to close what closeDirectLogFiledes() returns. */
1646void closeDirectLogFiledes(int fd) {

Callers 2

logStackTraceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected