fix: replace nix::libc with libc in datetime.rs

This commit is contained in:
Sylvestre Ledru
2026-04-21 00:38:39 +02:00
parent a2b5380e27
commit 22ea466c17
5 changed files with 6 additions and 8 deletions
+2 -2
View File
@@ -1411,7 +1411,7 @@ pub(crate) fn fd_soft_limit() -> Option<usize> {
#[cfg(unix)]
pub(crate) fn current_open_fd_count() -> Option<usize> {
use nix::libc;
use libc;
fn count_dir(path: &str) -> Option<usize> {
let entries = std::fs::read_dir(path).ok()?;
@@ -1771,7 +1771,7 @@ fn locale_failed_to_set() -> bool {
#[cfg(unix)]
fn locale_failed_to_set() -> bool {
use nix::libc;
use libc;
unsafe { libc::setlocale(libc::LC_COLLATE, c"".as_ptr()).is_null() }
}
+3 -3
View File
@@ -19,14 +19,14 @@ mod flags;
use crate::flags::AllFlags;
use crate::flags::COMBINATION_SETTINGS;
use clap::{Arg, ArgAction, ArgMatches, Command};
use nix::libc::{O_NONBLOCK, TIOCGWINSZ, TIOCSWINSZ, c_ushort};
use libc::{O_NONBLOCK, TIOCGWINSZ, TIOCSWINSZ, c_ushort};
#[cfg(all(
target_os = "linux",
not(target_arch = "powerpc"),
not(target_arch = "powerpc64")
))]
use nix::libc::{TCGETS2, termios2};
use libc::{TCGETS2, termios2};
use rustix::termios::{
ControlModes as ControlFlags, InputModes as InputFlags, LocalModes as LocalFlags,
@@ -528,7 +528,7 @@ fn parse_rows_cols(arg: &str) -> Option<u16> {
/// - Returns `None` if format is invalid
fn parse_saved_state(arg: &str) -> Option<Vec<u32>> {
let parts: Vec<&str> = arg.split(':').collect();
let expected_parts = 4 + nix::libc::NCCS;
let expected_parts = 4 + libc::NCCS;
// GNU requires exactly the right number of parts for this platform
if parts.len() != expected_parts {
+1 -1
View File
@@ -178,7 +178,7 @@ pub fn get_locale_months() -> Option<&'static [Vec<u8>; 12]> {
target_os = "dragonfly"
))]
fn get_locale_months_inner() -> Option<[Vec<u8>; 12]> {
use nix::libc;
use libc;
use std::ffi::CStr;
let abmon_items: [libc::nl_item; 12] = [
-1
View File
@@ -704,7 +704,6 @@ static STARTUP_STATE_WAS_CAPTURED: AtomicBool = AtomicBool::new(false);
#[cfg(unix)]
#[allow(clippy::missing_safety_doc)]
pub unsafe extern "C" fn capture_startup_state() {
use nix::libc;
use std::mem::MaybeUninit;
use std::ptr;
-1
View File
@@ -49,7 +49,6 @@ pub fn mute_sigpipe_panic() {
/// variable. If set to "default", it restores SIGPIPE to SIG_DFL.
#[cfg(unix)]
pub fn preserve_inherited_sigpipe() {
use nix::libc;
// Check if parent specified that SIGPIPE should be default
if std::env::var_os("RUST_SIGPIPE").is_some_and(|v| v == "default") {