split out ucred to a bits header

This commit is contained in:
auronandace
2026-06-16 08:04:26 +01:00
parent 65e0136466
commit f5c0c1a9c9
6 changed files with 40 additions and 25 deletions
+3 -5
View File
@@ -16,10 +16,9 @@ after_includes = """
#include <bits/socklen-t.h> // for socklen_t
#include <bits/ssize-t.h> // for ssize_t from sys/types.h
// Below required for Non-POSIX ucred struct
#include <bits/gid-t.h> // for gid_t from sys/types.h
#include <bits/pid-t.h> // for pid_t from sys/types.h
#include <bits/uid-t.h> // for uid_t from sys/types.h
#if defined(_GNU_SOURCE)
#include <bits/ucred.h> // for Non-POSIX ucred struct
#endif
"""
trailer = """
#ifndef _RELIBC_BITS_SYS_SOCKET_H
@@ -61,7 +60,6 @@ prefix_with_name = true
include = [
"linger",
"cmsghdr",
"ucred"
]
[export.rename]
+1 -19
View File
@@ -9,9 +9,7 @@ use crate::{
header::{bits_safamily_t::sa_family_t, sys_uio::iovec},
platform::{
PalSocket, Sys,
types::{
c_char, c_int, c_long, c_uchar, c_uint, c_void, gid_t, pid_t, size_t, ssize_t, uid_t,
},
types::{c_char, c_int, c_long, c_uchar, c_uint, c_void, size_t, ssize_t},
},
};
@@ -61,22 +59,6 @@ pub struct cmsghdr {
pub cmsg_type: c_int,
}
// TODO: `ucred` should be behind _GNU_SOURCE include guard
/// Non-POSIX, see <https://www.man7.org/linux/man-pages/man7/unix.7.html>.
///
/// Represents UNIX credentials.
#[repr(C)]
#[derive(Clone, Debug)]
// FIXME: CheckVsLibcCrate
pub struct ucred {
/// Process ID of the sending process.
pub pid: pid_t,
/// User ID of the sending process.
pub uid: uid_t,
/// Group ID of the sending process.
pub gid: gid_t,
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_socket.h.html>.
#[repr(C)]
#[derive(Default, CheckVsLibcCrate)]