1*eb4e8c1eSguenther /*
2*eb4e8c1eSguenther * Copyright (c) 2002 William C. Fenner. All rights reserved.
3*eb4e8c1eSguenther *
4*eb4e8c1eSguenther * Redistribution and use in source and binary forms, with or without
5*eb4e8c1eSguenther * modification, are permitted provided that the following conditions
6*eb4e8c1eSguenther * are met:
7*eb4e8c1eSguenther * 1. Redistributions of source code must retain the above copyright
8*eb4e8c1eSguenther * notice, this list of conditions and the following disclaimer.
9*eb4e8c1eSguenther * 2. Redistributions in binary form must reproduce the above copyright
10*eb4e8c1eSguenther * notice, this list of conditions and the following disclaimer in the
11*eb4e8c1eSguenther * documentation and/or other materials provided with the distribution.
12*eb4e8c1eSguenther *
13*eb4e8c1eSguenther * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
14*eb4e8c1eSguenther * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*eb4e8c1eSguenther * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*eb4e8c1eSguenther * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
17*eb4e8c1eSguenther * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*eb4e8c1eSguenther * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19*eb4e8c1eSguenther * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20*eb4e8c1eSguenther * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21*eb4e8c1eSguenther * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*eb4e8c1eSguenther * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*eb4e8c1eSguenther * SUCH DAMAGE.
24*eb4e8c1eSguenther *
25*eb4e8c1eSguenther * $FreeBSD$
26*eb4e8c1eSguenther */
27*eb4e8c1eSguenther
28*eb4e8c1eSguenther #include <sys/socket.h>
29*eb4e8c1eSguenther #include <sys/sockio.h>
30*eb4e8c1eSguenther #include <sys/ioctl.h>
31*eb4e8c1eSguenther
32*eb4e8c1eSguenther int
sockatmark(int s)33*eb4e8c1eSguenther sockatmark(int s)
34*eb4e8c1eSguenther {
35*eb4e8c1eSguenther int atmark;
36*eb4e8c1eSguenther
37*eb4e8c1eSguenther if (ioctl(s, SIOCATMARK, &atmark) == -1)
38*eb4e8c1eSguenther return (-1);
39*eb4e8c1eSguenther return (atmark);
40*eb4e8c1eSguenther }
41