sendto.c revision 276630
1276630Skib/* 2276630Skib * Copyright (c) 2014 The FreeBSD Foundation. 3276630Skib * All rights reserved. 4276630Skib * 5276630Skib * Portions of this software were developed by Konstantin Belousov 6276630Skib * under sponsorship from the FreeBSD Foundation. 7276630Skib * 8276630Skib * Redistribution and use in source and binary forms, with or without 9276630Skib * modification, are permitted provided that the following conditions 10276630Skib * are met: 11276630Skib * 1. Redistributions of source code must retain the above copyright 12276630Skib * notice(s), this list of conditions and the following disclaimer as 13276630Skib * the first lines of this file unmodified other than the possible 14276630Skib * addition of one or more copyright notices. 15276630Skib * 2. Redistributions in binary form must reproduce the above copyright 16276630Skib * notice(s), this list of conditions and the following disclaimer in 17276630Skib * the documentation and/or other materials provided with the 18276630Skib * distribution. 19276630Skib * 20276630Skib * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 21276630Skib * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22276630Skib * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23276630Skib * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE 24276630Skib * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25276630Skib * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26276630Skib * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 27276630Skib * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28276630Skib * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 29276630Skib * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 30276630Skib * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31276630Skib */ 32276630Skib 33276630Skib#include <sys/cdefs.h> 34276630Skib__FBSDID("$FreeBSD: head/lib/libc/sys/sendto.c 276630 2015-01-03 18:38:46Z kib $"); 35276630Skib 36276630Skib#include <sys/types.h> 37276630Skib#include <sys/syscall.h> 38276630Skib#include <sys/socket.h> 39276630Skib#include "libc_private.h" 40276630Skib 41276630Skib__weak_reference(__sys_sendto, __sendto); 42276630Skib 43276630Skib#pragma weak sendto 44276630Skibssize_t 45276630Skibsendto(int s, const void *msg, size_t len, int flags, 46276630Skib const struct sockaddr *to, socklen_t tolen) 47276630Skib{ 48276630Skib 49276630Skib return (((ssize_t (*)(int, const void *, size_t, int, 50276630Skib const struct sockaddr *, socklen_t)) 51276630Skib __libc_interposing[INTERPOS_sendto])(s, msg, len, flags, 52276630Skib to, tolen)); 53276630Skib} 54