xref: /dflybsd-src/lib/libc/net/sockatmark.c (revision b7adaf3bcda6cb9de6f9ea18386a76def74f86ef)
112b71966SPeter Avalos /*
212b71966SPeter Avalos  * Copyright (c) 2002 William C. Fenner.  All rights reserved.
312b71966SPeter Avalos  *
412b71966SPeter Avalos  * Redistribution and use in source and binary forms, with or without
512b71966SPeter Avalos  * modification, are permitted provided that the following conditions
612b71966SPeter Avalos  * are met:
712b71966SPeter Avalos  * 1. Redistributions of source code must retain the above copyright
812b71966SPeter Avalos  *    notice, this list of conditions and the following disclaimer.
912b71966SPeter Avalos  * 2. Redistributions in binary form must reproduce the above copyright
1012b71966SPeter Avalos  *    notice, this list of conditions and the following disclaimer in the
1112b71966SPeter Avalos  *    documentation and/or other materials provided with the distribution.
1212b71966SPeter Avalos  *
1312b71966SPeter Avalos  * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
1412b71966SPeter Avalos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1512b71966SPeter Avalos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1612b71966SPeter Avalos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1712b71966SPeter Avalos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1812b71966SPeter Avalos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1912b71966SPeter Avalos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2012b71966SPeter Avalos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2112b71966SPeter Avalos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2212b71966SPeter Avalos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2312b71966SPeter Avalos  * SUCH DAMAGE.
2412b71966SPeter Avalos  *
2512b71966SPeter Avalos  * $FreeBSD: src/lib/libc/net/sockatmark.c,v 1.1 2002/12/13 22:22:55 fenner Exp $
2612b71966SPeter Avalos  */
2712b71966SPeter Avalos 
28*b7adaf3bSSascha Wildner #include "namespace.h"
2912b71966SPeter Avalos #include <sys/ioctl.h>
30*b7adaf3bSSascha Wildner #include "un-namespace.h"
3112b71966SPeter Avalos 
3212b71966SPeter Avalos int sockatmark(int s)
3312b71966SPeter Avalos {
3412b71966SPeter Avalos 	int atmark;
3512b71966SPeter Avalos 
36*b7adaf3bSSascha Wildner 	if (_ioctl(s, SIOCATMARK, &atmark) == -1)
3712b71966SPeter Avalos 		return -1;
3812b71966SPeter Avalos 	return atmark;
3912b71966SPeter Avalos }
40