1.\" $NetBSD: ttymsg.3,v 1.13 2013/01/16 06:44:27 wiz Exp $ 2.\" 3.\" Copyright (c) 1996 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25.\" POSSIBILITY OF SUCH DAMAGE. 26.\" 27.Dd January 15, 2013 28.Dt TTYMSG 3 29.Os 30.Sh NAME 31.Nm ttymsg 32.Nd ttymsg utility function 33.Sh LIBRARY 34.Lb libutil 35.Sh SYNOPSIS 36.In util.h 37.Ft char * 38.Fn ttymsg "struct iovec *iov" "int iovlen" "const char *tty" "int tmout" 39.Sh DESCRIPTION 40The 41.Fn ttymsg 42function is used by 43programs such as 44.Xr talkd 8 , 45.Xr syslogd 8 , 46.Xr wall 1 , 47etc., to display the contents of a uio structure on a terminal. 48.Fn ttymsg 49forks and finishes in the child if the write would block after 50waiting up to 51.Fa tmout 52seconds. 53.Sh RETURN VALUES 54.Fn ttymsg 55returns a pointer to an error string on unexpected 56error; the string is not newline-terminated. 57Various "normal" errors are 58ignored (exclusive-use, lack of permission, etc.). 59.Sh SEE ALSO 60.Xr writev 2 61.Sh BUGS 62.Nm 63could grow some flags and a username/uid who is the expected owner 64of the tty. 65If the flags say so then the owner should be checked against the tty 66owner, and the message should not be sent if there is a mismatch. 67Also another flag could say check against group writable, and don't 68send a message. 69