1d915a14eSPedro F. Giffuni /*-
2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause
3d915a14eSPedro F. Giffuni *
443ac5a23SBill Fenner * Copyright (c) 2002 William C. Fenner. All rights reserved.
543ac5a23SBill Fenner *
643ac5a23SBill Fenner * Redistribution and use in source and binary forms, with or without
743ac5a23SBill Fenner * modification, are permitted provided that the following conditions
843ac5a23SBill Fenner * are met:
943ac5a23SBill Fenner * 1. Redistributions of source code must retain the above copyright
1043ac5a23SBill Fenner * notice, this list of conditions and the following disclaimer.
1143ac5a23SBill Fenner * 2. Redistributions in binary form must reproduce the above copyright
1243ac5a23SBill Fenner * notice, this list of conditions and the following disclaimer in the
1343ac5a23SBill Fenner * documentation and/or other materials provided with the distribution.
1443ac5a23SBill Fenner *
1543ac5a23SBill Fenner * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
1643ac5a23SBill Fenner * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1743ac5a23SBill Fenner * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1843ac5a23SBill Fenner * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1943ac5a23SBill Fenner * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2043ac5a23SBill Fenner * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2143ac5a23SBill Fenner * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2243ac5a23SBill Fenner * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2343ac5a23SBill Fenner * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2443ac5a23SBill Fenner * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2543ac5a23SBill Fenner * SUCH DAMAGE.
2643ac5a23SBill Fenner */
271c0046d7SJilles Tjoelker #include "namespace.h"
2843ac5a23SBill Fenner #include <sys/ioctl.h>
29ffdd7037SCraig Rodrigues #include <sys/socket.h>
301c0046d7SJilles Tjoelker #include "un-namespace.h"
3143ac5a23SBill Fenner
sockatmark(int s)3243ac5a23SBill Fenner int sockatmark(int s)
3343ac5a23SBill Fenner {
3443ac5a23SBill Fenner int atmark;
3543ac5a23SBill Fenner
361c0046d7SJilles Tjoelker if (_ioctl(s, SIOCATMARK, &atmark) == -1)
3743ac5a23SBill Fenner return -1;
3843ac5a23SBill Fenner return atmark;
3943ac5a23SBill Fenner }
40