xref: /openbsd-src/lib/libc/sys/getrtable.2 (revision d13be5d47e4149db2549a9828e244d59dbc43f15)
1.\" $OpenBSD: getrtable.2,v 1.1 2010/07/03 04:44:51 guenther Exp $
2.\"
3.\" Copyright (c) 2009 Reyk Floeter <reyk@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: July 3 2010 $
18.Dt GETRTABLE 2
19.Os
20.Sh NAME
21.Nm getrtable ,
22.Nm setrtable
23.Nd "get and set the default routing domain of the current process"
24.Sh SYNOPSIS
25.Fd #include <sys/types.h>
26.Fd #include <sys/socket.h>
27.Ft int
28.Fn getrtable "void"
29.Ft int
30.Fn setrtable "int rtableid"
31.Sh DESCRIPTION
32.Fn getrtable
33and
34.Fn setrtable
35manipulate the routing table and routing domain associated with the current
36process.
37.Pp
38Only the superuser is allowed to change the process routing domain if
39it is already set to a non-zero value.
40.Sh RETURN VALUES
41A 0 is returned if the call succeeds, \-1 if it fails.
42.Sh ERRORS
43The call succeeds unless:
44.Bl -tag -width Er
45.It Bq Er EINVAL
46The value of the
47.Fa rtableid
48argument is not a valid routing table.
49.It Bq Er EPERM
50The user is not the superuser and the routing domain of the
51calling process is already set to a non-zero value.
52.El
53.Sh SEE ALSO
54.Xr getsockopt 2 ,
55.Xr setsockopt 2 ,
56.Xr route 8
57.Sh HISTORY
58The
59.Fn getrtable
60and
61.Fn setrtable
62system calls appeared in
63.Ox 4.8 .
64