Skip to content

Commit

Permalink
Auto merge of #3218 - JohnTitor:cleanup-extern-c, r=JohnTitor
Browse files Browse the repository at this point in the history
Clean up some externs
  • Loading branch information
bors committed Apr 23, 2023
2 parents 86593ce + 9d3b4d6 commit 6074ea8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bors.yml
Expand Up @@ -314,7 +314,7 @@ jobs:
run: rustup self update
shell: bash
- name: Execute build.sh
run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} WIN_TARGET=${{ matrix.target }} sh ./ci/build.sh
run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh
shell: bash

check_cfg:
Expand Down
46 changes: 22 additions & 24 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Expand Up @@ -2513,31 +2513,7 @@ extern "C" {
) -> ::c_int;

pub fn reallocarr(ptr: *mut ::c_void, number: ::size_t, size: ::size_t) -> ::c_int;
}

#[link(name = "rt")]
extern "C" {
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
#[link_name = "__aio_suspend50"]
pub fn aio_suspend(
aiocb_list: *const *const aiocb,
nitems: ::c_int,
timeout: *const ::timespec,
) -> ::c_int;
pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
pub fn lio_listio(
mode: ::c_int,
aiocb_list: *const *mut aiocb,
nitems: ::c_int,
sevp: *mut sigevent,
) -> ::c_int;
}

extern "C" {
pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
Expand Down Expand Up @@ -2967,6 +2943,28 @@ extern "C" {
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
}

#[link(name = "rt")]
extern "C" {
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
#[link_name = "__aio_suspend50"]
pub fn aio_suspend(
aiocb_list: *const *const aiocb,
nitems: ::c_int,
timeout: *const ::timespec,
) -> ::c_int;
pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
pub fn lio_listio(
mode: ::c_int,
aiocb_list: *const *mut aiocb,
nitems: ::c_int,
sevp: *mut sigevent,
) -> ::c_int;
}

#[link(name = "util")]
extern "C" {
#[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")]
Expand Down
17 changes: 2 additions & 15 deletions src/unix/linux_like/linux/gnu/mod.rs
Expand Up @@ -1240,9 +1240,6 @@ extern "C" {
pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;

pub fn ctermid(s: *mut ::c_char) -> *mut ::c_char;
}

extern "C" {
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int;
pub fn glob64(
Expand Down Expand Up @@ -1331,9 +1328,6 @@ extern "C" {
/// GNU version of `basename(3)`, defined in `string.h`.
#[link_name = "basename"]
pub fn gnu_basename(path: *const ::c_char) -> *mut ::c_char;
}

extern "C" {
pub fn dlmopen(lmid: Lmid_t, filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
pub fn dlinfo(handle: *mut ::c_void, request: ::c_int, info: *mut ::c_void) -> ::c_int;
pub fn dladdr1(
Expand All @@ -1343,15 +1337,10 @@ extern "C" {
flags: ::c_int,
) -> ::c_int;
pub fn malloc_trim(__pad: ::size_t) -> ::c_int;
}

extern "C" {
pub fn gnu_get_libc_release() -> *const ::c_char;
pub fn gnu_get_libc_version() -> *const ::c_char;
}

// posix/spawn.h
extern "C" {
// posix/spawn.h
// Added in `glibc` 2.29
pub fn posix_spawn_file_actions_addchdir_np(
actions: *mut ::posix_spawn_file_actions_t,
Expand All @@ -1372,10 +1361,8 @@ extern "C" {
actions: *mut ::posix_spawn_file_actions_t,
tcfd: ::c_int,
) -> ::c_int;
}

// mntent.h
extern "C" {
// mntent.h
pub fn getmntent_r(
stream: *mut ::FILE,
mntbuf: *mut ::mntent,
Expand Down

0 comments on commit 6074ea8

Please sign in to comment.