1/* 2 * Copyright (c) 2017 Eric van Gyzen 3 * Copyright (c) 2014 The FreeBSD Foundation. 4 * All rights reserved. 5 * 6 * Portions of this software were developed by Konstantin Belousov 7 * under sponsorship from the FreeBSD Foundation. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice(s), this list of conditions and the following disclaimer as 14 * the first lines of this file unmodified other than the possible 15 * addition of one or more copyright notices. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice(s), this list of conditions and the following disclaimer in 18 * the documentation and/or other materials provided with the 19 * distribution. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 22 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE 25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 28 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 30 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 31 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> 35__FBSDID("$FreeBSD: stable/11/lib/libc/sys/clock_nanosleep.c 317618 2017-05-01 01:36:54Z vangyzen $"); 36 37#include <sys/types.h> 38#include <time.h> 39#include "libc_private.h" 40 41__weak_reference(__sys_clock_nanosleep, __clock_nanosleep); 42 43#pragma weak clock_nanosleep 44int 45clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, 46 struct timespec *rmtp) 47{ 48 49 return (((int (*)(clockid_t, int, const struct timespec *, 50 struct timespec *)) 51 __libc_interposing[INTERPOS_clock_nanosleep])(clock_id, flags, 52 rqtp, rmtp)); 53} 54