summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_log.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Use FNONBLOCK instead of SS_NBIO to check/indicate that the I/O modempi2018-07-301-2/+4
| | | | | | | | | | | | | 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@
* Remove almost unused `flags' argument of suser().mpi2018-02-191-2/+2
| | | | | | | 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@
* Print the pid of the most recent program that failed to send a logmpi2017-10-171-6/+10
| | | | | | | | | via sendsyslog(2) along with the corresponding errno. Help when troubleshooting which program is triggering an error, like an overflow. ok bluhm@
* sendsyslog should take a const char * everywhere.espie2017-09-251-2/+2
| | | | okay bluhm@, deraadt@
* Kernel sendsyslog(2), libc syslog(3), and syslogd(8) restrict andbluhm2017-08-081-3/+3
| | | | | | truncate the length of a syslog message to 8192 bytes. Use one global define LOG_MAXLINE for all of them. OK deraadt@ millert@
* Both syslog(3) and syslogd(8) truncate the message at 8192 bytes.bluhm2017-07-181-1/+4
| | | | | Do the same in sendsyslog(2) and document the behavior. reported by Ilja Van Sprundel; OK millert@ deraadt@
* Reorder FREF() and FRELE() in a way that the the global variablebluhm2017-03-271-7/+9
| | | | | | | 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@
* There was a race in dosendsyslog() which resulted in a crash.bluhm2017-03-241-7/+10
| | | | | | | | | | 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@
* As klog dropped message has no ifdef small kernel, sendsyslogbluhm2016-06-231-9/+6
| | | | | | should not have it either. While there bring some variables in sync between both functions. OK deraadt@
* It is annoying that the dmesg buffer can overflow and loose messagesbluhm2016-06-231-1/+15
| | | | | | | 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@
* As logging to dmesg with msgbuf_putchar() can happen in any interruptbluhm2016-06-081-15/+21
| | | | | | | 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@
* sys_osendsyslog can go away; we have transitioned to the new version withderaadt2016-05-311-16/+1
| | | | | a flags argument ok guenther sthen
* All msg buf counters are long, so lmin(9) should be used for them.bluhm2016-05-191-2/+2
| | | | OK deraadt@ natano@
* Kill trailing whitespaces.bluhm2016-05-181-4/+4
|
* Use constty and cn_devvp for checking wether to use cnwrite(). Thatbluhm2016-05-181-23/+21
| | | | | | makes console redirection with senssyslog(2) and LOG_CONS work again. Also merge the two if else if else blocks into one. OK deraadt@
* Allow sendsyslog(2) with LOG_CONS even when /dev/console has notbluhm2016-05-171-5/+29
| | | | | | | 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@
* Backout the previous fix for the sendsyslog(2) with LOG_CONS solution.bluhm2016-05-171-2/+2
| | | | | | | 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.
* If sendsyslog(2) is called with LOG_CONS before syslogd(8) has beenbluhm2016-05-101-2/+2
| | | | | | | | 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@
* Rename the system call sendsyslog2 to sendsyslog. Keep the old onebluhm2016-03-211-7/+7
| | | | | | as osendsyslog for a while. The three argument variant is the only one that will stay. input kettenis@; OK deraadt@
* Convert to uiomove(); from Martin Natano, thanks!stefan2016-01-131-6/+7
| | | | ok deraadt@
* In sendsyslogd(2) strip off syslog priority when logging to console.bluhm2016-01-071-4/+32
| | | | OK deraadt@ millert@
* The pointer buf is a user space string which was directly passedbluhm2016-01-011-31/+32
| | | | | | | | | | 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@
* remove stale lint annotationstedu2015-12-051-6/+1
|
* Add sendsyslog2(), which accepts the syslog/openlog "logopt" flagderaadt2015-11-241-7/+40
| | | | | | | 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
* The must be no space after the syslog priority in the sendsyslog(2)bluhm2015-09-111-2/+2
| | | | | dropped message error log. OK benno@
* To make logging to local syslog reliable, log a message about failedbluhm2015-09-021-4/+40
| | | | | | log atempts. sendsyslog(2) is a good place to detect and report the problem. OK deraadt@
* Pass a thread pointer instead of its file descriptor table to getsock(9).mpi2015-05-061-2/+2
| | | | | | Diff from Vitaliy Makkoveev. Manpage tweak and ok millert@
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* First step towards making uiomove() take a size_t size argument:miod2015-02-101-2/+2
| | | | | | | - 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@
* Many architectures call initmsgbuf() really really early, before uvm iskettenis2015-01-131-1/+7
| | | | | | | | | 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@
* Add dmesg -s support, to view the output of rc(8) system startup messages.mpf2015-01-131-7/+13
| | | | | Help and feedback by Theo and Miod. OK deraadt@, manpage-ok jmc@
* yet more mallocarray() changes.doug2014-12-131-2/+3
| | | | ok tedu@ deraadt@
* convert bcopy to memcpy. ok millerttedu2014-12-101-2/+2
|
* pass size argument to free()deraadt2014-11-031-3/+4
| | | | ok doug tedu
* I/O ktrace of sendsyslog(2) did not work. As uiomove() adjustsbluhm2014-07-281-2/+6
| | | | | | iov_len to 0, we need a propper length calculation. While there, use -1 for the file descriptor because 0 is reserved for stdin. OK deraadt@ guenther@
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-2/+2
| | | | after discussions with beck deraadt kettenis.
* Add new sendsyslog(const char *, size_t) system call which simply passesderaadt2014-07-101-2/+79
| | | | | | | | | a message up into syslogd's /dev/log interface. This will be used to make syslog_r work during file descriptor exhaustion, or inside sandboxes which prohibit socket, connect, sendto, etc. The system call is being added about a week before the library and daemon changes. ok guenther tedu miod matthew
* Eliminates struct pcred by moving the real and saved ugids intoguenther2014-03-301-2/+2
| | | | | | | | | struct ucred; struct process then directly links to the ucred Based on a discussion at c2k10 or so before noting that FreeBSD and NetBSD did this too. ok matthew@
* bzero -> memsettedu2014-01-211-2/+2
|
* kqueue attach functions should return an errno or 0, not a plain 1. Fixnicm2011-07-021-2/+2
| | | | | | the obvious cases to return EINVAL and ENXIO. ok tedu deraadt
* Every selwakeup() should have a matching KNOTE() (even if kqueue isn'tnicm2009-11-091-2/+1
| | | | | | | | | | supported it doesn't do any harm), so put the KNOTE() in selwakeup() itself and remove it from any occurences where both are used, except one for kqueue itself and one in sys_pipe.c (where the selwakeup is under a PIPE_SEL flag). Based on a diff from tedu. ok deraadt
* unsupported ioctl's should be returned with ENOTTYthib2007-09-031-2/+2
| | | | | | not -1; ok miod@
* ansi and deregister. No binary change.jsg2005-12-091-27/+8
|
* knfderaadt2005-04-201-2/+3
|
* Try to start log message buffer on a new line. Helps install scripts avoidkrw2005-04-141-5/+28
| | | | | | detecting phantom devices when scanning dmesg output. Suggested by miod@, ok deraadt@.
* Replace select backends with poll backends. selscan() and pollscan()millert2003-09-231-13/+11
| | | | | | | now call the poll backend. With this change we implement greater poll(2) functionality instead of emulating it via the select backend. Adapted from NetBSD and including some changes from FreeBSD. Tested by many, deraadt@ OK
* remove caddr_t casts. it's just silly to cast something when the functiontedu2003-07-211-5/+4
| | | | takes a void *. convert uiomove to take a void * as well. ok deraadt@
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-6/+2
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* kqfilter for the log. niels said i can commit it if it worksmickey2002-06-291-1/+51
| | | | and i converted syslog to libevent and it works now (;
* Move offsetof define into sys/param.hcsapuntz2001-04-061-3/+1
|