mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
Logging now doesn't lock with each message
The original logging routines were locking a common mutex. This led to massive underperformance and unwanted serialization when heavily logging due to lock contention. Now the logging is lockless, though still serializing on write() syscalls to the same filedescriptor. This change also brings in a persistent logging channel structures and thus avoids writing into active configuration data structures during regular run.
This commit is contained in:
@@ -120,7 +120,9 @@ enum rf_mode {
|
||||
};
|
||||
|
||||
struct rfile *rf_open(struct pool *, const char *name, enum rf_mode mode);
|
||||
int rf_fileno(struct rfile *f);
|
||||
off_t rf_size(struct rfile *);
|
||||
int rf_same(struct rfile *, struct rfile *);
|
||||
void rf_write(struct rfile *, const void *, size_t);
|
||||
|
||||
extern struct rfile rf_stderr;
|
||||
|
||||
@@ -138,10 +140,9 @@ void log_switch(int initial, list *l, const char *);
|
||||
struct log_config {
|
||||
node n;
|
||||
uint mask; /* Classes to log */
|
||||
struct rfile *rf; /* Resource for log file; NULL=syslog */
|
||||
struct rfile *rf; /* File handle */
|
||||
const char *filename; /* Log filename */
|
||||
const char *backup; /* Secondary filename (for log rotation) */
|
||||
off_t pos; /* Position/size of current log */
|
||||
off_t limit; /* Log size limit */
|
||||
int terminal_flag;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user