1 /*
2 * Copyright (C) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 //! sendmsg
16 #![allow(missing_docs)]
17 use std::ffi::c_int;
18
19 extern "C" {
SendMsg(socket_fd: c_int, fd: c_int, data: *mut libc::c_char, size: c_int) -> c_int20 fn SendMsg(socket_fd: c_int, fd: c_int, data: *mut libc::c_char, size: c_int) -> c_int;
21 }
22
send_msg(socket_fd: i32, fd: i32, data: &[u8]) -> i3223 pub fn send_msg(socket_fd: i32, fd: i32, data: &[u8]) -> i32 {
24 unsafe { SendMsg(socket_fd, fd, data.as_ptr() as *mut u8, data.len() as i32) }
25 }
26