MCPcopy Create free account
hub / github.com/F-Stack/f-stack / openDirectLogFiledes

Function openDirectLogFiledes

app/redis-6.2.6/src/debug.c:1529–1535  ·  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

1527 *
1528 * Close it with closeDirectLogFiledes(). */
1529int openDirectLogFiledes(void) {
1530 int log_to_stdout = server.logfile[0] == '\0';
1531 int fd = log_to_stdout ?
1532 STDOUT_FILENO :
1533 open(server.logfile, O_APPEND|O_CREAT|O_WRONLY, 0644);
1534 return fd;
1535}
1536
1537/* Used to close what closeDirectLogFiledes() returns. */
1538void closeDirectLogFiledes(int fd) {

Callers 2

logStackTraceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected