| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
held but this path is only followed while `syslogf' socket is not set.
New `syslogf_rwlock' used to protect `syslogf' access.
ok bluhm@
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
are started before syslogd(8). This resulted in ugly sendsyslog(2)
dropped logs and the real message was lost.
Create a temporary stash for log messages within the kernel. It
has a limited size of 100 messages, and each message is truncated
to 8192 bytes. When the stash is exhausted, the well-known dropped
message is generated with a counter. After syslogd(8) has setup
everything, it sends a debug line through libc to flush the kernel
stash. Then syslogd receives all messages from the kernel before
the usual logs.
OK deraadt@ visa@
|
|
|
|
|
|
|
|
|
|
|
|
| |
the SCHED_LOCK().
Putting a thread on a sleep queue is reduce to the following:
sleep_setup();
/* check condition or release lock */
sleep_finish();
Previous version ok cheloha@, jmatthew@, ok claudio@
|
|
|
|
|
|
|
|
|
|
|
|
| |
On sparc64, initmsgbuf() is invoked before curcpu() is usable
on the boot processor. Consequently, it is unsafe to use mutexes
during the message buffer initialization. Avoid such use by skipping
log_mtx when appending a newline from initmsgbuf().
Use mbp instead of msgbufp as the buffer argument to the putchar routine
for consistency.
Bug reported and fix suggested by miod@
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.
Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.
OK mpi@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This introduces a system-wide mutex that serializes msgbuf operations.
The mutex controls access to all modifiable fields of struct msgbuf.
It also covers logsoftc.sc_state.
To avoid adding extra lock order constraints that would affect use of
printf(9), the code does not take new locks when the log mutex is held.
The code assumes that there is at most one thread using logread(). This
keeps the logic simple. If there was more than one reader, logread()
might return the same data to different readers. Also, log wakeup might
not be reliable with multiple threads.
Tested in snaps for two weeks.
OK mpi@
|
|
|
|
|
|
|
|
|
| |
Take into account the circular nature of the message buffer when
computing the number of available bytes. Move the computation into
a separate function and use it with the kevent(2) and ioctl(2)
interfaces.
OK mpi@
|
|
|
|
| |
OK mvs@
|
|
|
|
|
|
| |
for example, with locking assertions.
OK mpi@, anton@
|
|
|
|
|
|
| |
adding more filter properties without cluttering the struct.
OK mpi@, anton@
|
|
|
|
| |
ok bluhm@
|
|
|
|
|
|
|
|
|
|
|
|
| |
FIOGETOWN/SIOCGPGRP/TIOCGPGRP. Do this by determining the meaning of
the ID parameter inside the sigio code. Also add cases for FIOSETOWN
and FIOGETOWN where there have been TIOCSPGRP and TIOCGPGRP before.
These changes allow removing the ID translation from sys_fcntl() and
sys_ioctl().
Idea from NetBSD
OK mpi@, claudio@
|
|
|
|
|
| |
bpf(4) and tun(4) instead of using hand rolled code using csignal().
OK visa@
|
|
|
|
|
|
| |
make the structs const so that the data are put in .rodata.
OK mpi@, deraadt@, anton@, bluhm@
|
|
|
|
|
|
|
| |
only called from main(). There allocation must not fail, so better
use M_WAITOK and remove error handling. As it is not a temporary
buffer, M_TTYS is more appropriate.
OK deraadt@ mpi@
|
|
|
|
|
|
| |
so that the timeout would not be scheduled on every tick.
Discussed with and OK mpi@
|
|
|
|
|
|
|
|
|
|
|
| |
waiters, just set a flag in logwakeup(). The flag is later noted through
periodic polling. This lets the wakeup code run with sufficient locking.
logwakeup() is a very tricky place to take locks because the function
can be called in many different contexts. By not requiring locks in
the routine helps to keep printf(9) as usable as possible.
OK mpi@
|
|
|
|
|
|
|
|
| |
use copyin() on. While here: just put the struct iovec for ktrace on the
stack instead of mallocing and freeing it.
problem debugged by patrick@
ok deraadt@ mpi@
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
for sockets is non-blocking.
This allows us to G/C SS_NBIO. Having to keep the two flags in sync
in a mp-safe way is complicated.
This change introduce a behavior change in sosplice(), it can now
always block. However this should not matter much due to the socket
lock being taken beforhand.
ok bluhm@, benno@, visa@
|
|
|
|
|
|
|
| |
The account flag `ASU' will no longer be set but that makes suser()
mpsafe since it no longer mess with a per-process field.
No objection from millert@, ok tedu@, bluhm@
|
|
|
|
|
|
|
|
|
| |
via sendsyslog(2) along with the corresponding errno.
Help when troubleshooting which program is triggering an error, like
an overflow.
ok bluhm@
|
|
|
|
| |
okay bluhm@, deraadt@
|
|
|
|
|
|
| |
truncate the length of a syslog message to 8192 bytes. Use one
global define LOG_MAXLINE for all of them.
OK deraadt@ millert@
|
|
|
|
|
| |
Do the same in sendsyslog(2) and document the behavior.
reported by Ilja Van Sprundel; OK millert@ deraadt@
|
|
|
|
|
|
|
| |
syslogf always points to a file object with increased reference
count. This makes the implementation independent from the fact
whether changing the reference counter may sleep.
pointed out by Mateusz Guzik; OK deraadt@
|
|
|
|
|
|
|
|
|
|
| |
sosend(syslogf->f_data, ...) could be called with a NULL pointer.
syslogf was not NULL, f_data was NULL and f_count was 1. The file
structure is ref counted, but the global variable syslogf is not
protected. So it may change during sleep and dosendsyslog() possibly
used a different socket at each access. Solution is to access
syslogf only once, use a local copy, and do the ref counting there.
OK millert@ deraadt@
|
|
|
|
|
|
| |
should not have it either. While there bring some variables in
sync between both functions.
OK deraadt@
|
|
|
|
|
|
|
| |
undetected during debugging. To make clear what happens, count the
dropped bytes and write message buffer full to syslogd. This also
helps to have a reliable log system.
OK deraadt@ millert@ tedu@
|
|
|
|
|
|
|
| |
handler, every access to msg buf counters should be protected by
splhigh(). This is already done in some places, make it consistenly
everywhere.
OK mpi@ deraadt@
|
|
|
|
|
| |
a flags argument
ok guenther sthen
|
|
|
|
| |
OK deraadt@ natano@
|
| |
|
|
|
|
|
|
| |
makes console redirection with senssyslog(2) and LOG_CONS work
again. Also merge the two if else if else blocks into one.
OK deraadt@
|
|
|
|
|
|
|
| |
been opened during init(8). Only log with cnwrite() if cn_devvp
exists, otherwise use cnputc() as fallback. While there move extern
declarations to dev/cons.h.
input and OK deraadt@
|
|
|
|
|
|
|
| |
Permanently holding /dev/console open in the kernel works only until
init(8) calls revoke(2). After that the console device vnode cannot
be used anymore. It still resulted in a hanging init(8) if it tried
to syslog(3) something. With the backout also dmesg -s works again.
|
|
|
|
|
|
|
|
| |
started and before init(8) has opened the console, the kernel could
crash as the console device has not been initialized. Open
/dev/console in the kernel before starting init(8) and keep it open.
This way sendsyslog(2) can be called early in the system.
OK beck@ deraadt@
|
|
|
|
|
|
| |
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@
|
|
|
|
| |
ok deraadt@
|
|
|
|
| |
OK deraadt@ millert@
|
|
|
|
|
|
|
|
|
|
| |
to tputchar() and could crash the kernel. Better use cnwrite() in
sendsyslog2() for writing to console. It takes a struct uio which
does the copyin() automatically. In addition cnwrite() outputs to
the real console or to a redirected one, whichever is appropriate.
One drawback is that the syslog priority cannot be stripped off
easily.
OK deraadt@
|
| |
|
|
|
|
|
|
|
| |
LOG_CONS. If syslogd is not accepting messages, direct them to the console.
This allows us to remove the direct /dev/console opening code from the
bowels of libc. Of course, that forgotten code was exposed by pledge.
ok kettenis millert beck
|
|
|
|
|
| |
dropped message error log.
OK benno@
|
|
|
|
|
|
| |
log atempts. sendsyslog(2) is a good place to detect and report
the problem.
OK deraadt@
|
|
|
|
|
|
| |
Diff from Vitaliy Makkoveev.
Manpage tweak and ok millert@
|
|
|
|
|
|
|
| |
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.
ok tedu@ deraadt@
|
|
|
|
|
|
|
| |
- rename uiomove() to uiomovei() and update all its users.
- introduce uiomove(), which is similar to uiomovei() but with a size_t.
- rewrite uiomovei() as an uiomove() wrapper.
ok kettenis@
|
|
|
|
|
|
|
|
|
| |
initialized. Calling malloc(9) at that point is not a good idea. So
initialize consbuf later.
Fixes dmesg -s on sparc64 (and probably a few other architectures).
ok miod@, deraadt@
|
|
|
|
|
| |
Help and feedback by Theo and Miod.
OK deraadt@, manpage-ok jmc@
|
|
|
|
| |
ok tedu@ deraadt@
|