1107836Sfenner/* 2107836Sfenner * Copyright (c) 2002 William C. Fenner. All rights reserved. 3107836Sfenner * 4107836Sfenner * Redistribution and use in source and binary forms, with or without 5107836Sfenner * modification, are permitted provided that the following conditions 6107836Sfenner * are met: 7107836Sfenner * 1. Redistributions of source code must retain the above copyright 8107836Sfenner * notice, this list of conditions and the following disclaimer. 9107836Sfenner * 2. Redistributions in binary form must reproduce the above copyright 10107836Sfenner * notice, this list of conditions and the following disclaimer in the 11107836Sfenner * documentation and/or other materials provided with the distribution. 12107836Sfenner * 13107836Sfenner * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND 14107836Sfenner * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15107836Sfenner * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16107836Sfenner * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 17107836Sfenner * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18107836Sfenner * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19107836Sfenner * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20107836Sfenner * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21107836Sfenner * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22107836Sfenner * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23107836Sfenner * SUCH DAMAGE. 24107836Sfenner * 25107836Sfenner * $FreeBSD$ 26107836Sfenner */ 27107836Sfenner#include <sys/ioctl.h> 28107836Sfenner 29107836Sfennerint sockatmark(int s) 30107836Sfenner{ 31107836Sfenner int atmark; 32107836Sfenner 33107836Sfenner if (ioctl(s, SIOCATMARK, &atmark) == -1) 34107836Sfenner return -1; 35107836Sfenner return atmark; 36107836Sfenner} 37