summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2009-11-27 20:05:51 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2009-11-27 20:05:51 +0000
commitc0d8f7f98402ba0080bf459aeb08b0fa7d1e27f0 (patch)
tree7aa9e16b867d47d734d65160e15d6ead3fcc95c0 /lib
parentb5b5edebe52f3da6dcc3ebe2ed767d2269c40f6d (diff)
Add setrdomain() and getrdomain() system calls. Committing now to
catch the libc major bump per request from deraadt@ Diff by reyk. ok guenther@
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/sys/Makefile.inc8
-rw-r--r--lib/libc/sys/getrdomain.262
2 files changed, 67 insertions, 3 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index d4767916585..216fdd1f681 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.87 2009/08/13 19:54:58 jmc Exp $
+# $OpenBSD: Makefile.inc,v 1.88 2009/11/27 20:05:50 guenther Exp $
# $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $
# @(#)Makefile.inc 8.1 (Berkeley) 6/17/93
@@ -63,7 +63,8 @@ ASM= accept.o access.o acct.o adjfreq.o adjtime.o bind.o chdir.o chflags.o \
symlink.o sync.o sysarch.o umask.o unlink.o unmount.o \
utimes.o wait4.o write.o writev.o nnpfspioctl.o __semctl.o \
__syscall.o __sysctl.o __getcwd.o sched_yield.o getthrid.o \
- thrsleep.o thrwakeup.o threxit.o thrsigdivert.o
+ thrsleep.o thrwakeup.o threxit.o thrsigdivert.o \
+ setrdomain.o getrdomain.o
GASM= ${ASM:.o=.go}
PASM= ${ASM:.o=.po}
@@ -215,7 +216,7 @@ MAN+= accept.2 access.2 acct.2 adjfreq.2 adjtime.2 bind.2 brk.2 chdir.2 \
dup.2 execve.2 _exit.2 fcntl.2 fhopen.2 \
flock.2 fork.2 fsync.2 getdirentries.2 \
getfh.2 getfsstat.2 getgid.2 getgroups.2 getitimer.2 getlogin.2 \
- getpeername.2 getpeereid.2 getpgrp.2 \
+ getpeername.2 getpeereid.2 getpgrp.2 getrdomain.2 \
getpid.2 getpriority.2 getrlimit.2 getrusage.2 getsid.2 getsockname.2 \
getsockopt.2 gettimeofday.2 getuid.2 intro.2 issetugid.2 ioctl.2 \
kill.2 kqueue.2 ktrace.2 link.2 \
@@ -258,6 +259,7 @@ MLINKS+=getpid.2 getppid.2
MLINKS+=getpriority.2 setpriority.2
MLINKS+=getrlimit.2 setrlimit.2
MLINKS+=getsockopt.2 setsockopt.2
+MLINKS+=getrdomain.2 setrdomain.2
MLINKS+=gettimeofday.2 settimeofday.2
MLINKS+=getuid.2 geteuid.2
MLINKS+=kqueue.2 kevent.2 kqueue.2 EV_SET.2
diff --git a/lib/libc/sys/getrdomain.2 b/lib/libc/sys/getrdomain.2
new file mode 100644
index 00000000000..cfea4fc7a99
--- /dev/null
+++ b/lib/libc/sys/getrdomain.2
@@ -0,0 +1,62 @@
+.\" $OpenBSD: getrdomain.2,v 1.1 2009/11/27 20:05:50 guenther Exp $
+.\"
+.\" Copyright (c) 2009 Reyk Floeter <reyk@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: November 27 2009 $
+.Dt GETRDOMAIN 2
+.Os
+.Sh NAME
+.Nm getrdomain ,
+.Nm setrdomain
+.Nd get and set the default routing domain of the current process
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/socket.h>
+.Ft int
+.Fn getrdomain "void"
+.Ft int
+.Fn setrdomain "int rdomain"
+.Sh DESCRIPTION
+.Fn getrdomain
+and
+.Fn setrdomain
+manipulate the routing domain associated with the current process.
+.Pp
+Only the superuser is allowed to change the process routing domain if
+it is already set to a non-zero value.
+.Sh RETURN VALUES
+A 0 is returned if the call succeeds, \-1 if it fails.
+.Sh ERRORS
+The call succeeds unless:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The value of the
+.Fa rdomain
+argument is not a valid routing domain.
+.It Bq Er EPERM
+The user is not the superuser and the routing domain of the
+calling process is already set to a non-zero value.
+.El
+.Sh SEE ALSO
+.Xr getsockopt 2 ,
+.Xr setsockopt 2 ,
+.Xr route 8
+.Sh HISTORY
+The
+.Fn getrdomain
+and
+.Fn setrdomain
+system calls appeared in
+.Ox 4.7 .