1156956Sume/*-
2156956Sume * Copyright (c) 2006 The FreeBSD Project. All rights reserved.
3156956Sume *
4156956Sume * Redistribution and use in source and binary forms, with or without
5156956Sume * modification, are permitted provided that the following conditions
6156956Sume * are met:
7156956Sume * 1. Redistributions of source code must retain the above copyright
8156956Sume *    notice, this list of conditions and the following disclaimer.
9156956Sume * 2. Redistributions in binary form must reproduce the above copyright
10156956Sume *    notice, this list of conditions and the following disclaimer in the
11156956Sume *    documentation and/or other materials provided with the distribution.
12156956Sume *
13156956Sume * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14156956Sume * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15156956Sume * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16156956Sume * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17156956Sume * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18156956Sume * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19156956Sume * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20156956Sume * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21156956Sume * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22156956Sume * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23156956Sume * SUCH DAMAGE.
24156956Sume *
25156956Sume * $FreeBSD$
26156956Sume */
27156956Sume
28156956Sume#include <sys/types.h>
29156956Sume#include <netinet/in.h>
30156956Sume#include <arpa/nameser.h>
31156956Sume#include <resolv.h>
32156956Sume
33156956Sume#undef	h_errno
34156956Sumeextern int h_errno;
35156956Sume
36156956Sumeint *
37156956Sume__h_errno(void)
38156956Sume{
39156956Sume	return (&__res_state()->res_h_errno);
40156956Sume}
41156956Sume
42156956Sumevoid
43156956Sume__h_errno_set(res_state res, int err)
44156956Sume{
45156956Sume	h_errno = res->res_h_errno = err;
46156956Sume}
47