1// Copyright 2022 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// res_search, for cgo systems where that is thread-safe.
6
7//go:build cgo && !netgo && (linux || openbsd)
8
9package net
10
11/*
12#include <sys/types.h>
13#include <sys/socket.h>
14#include <netinet/in.h>
15#include <netdb.h>
16#include <unistd.h>
17#include <string.h>
18#include <arpa/nameser.h>
19#include <resolv.h>
20
21#cgo !android,!openbsd LDFLAGS: -lresolv
22*/
23import "C"
24
25type _C_struct___res_state = struct{}
26
27func _C_res_ninit(state *_C_struct___res_state) error {
28	return nil
29}
30
31func _C_res_nclose(state *_C_struct___res_state) {
32	return
33}
34
35func _C_res_nsearch(state *_C_struct___res_state, dname *_C_char, class, typ int, ans *_C_uchar, anslen int) int {
36	x := C.res_search(dname, C.int(class), C.int(typ), ans, C.int(anslen))
37	return int(x)
38}
39