Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/third_party/rust/nix/test/sys/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 912 B image not shown  

Quelle  test_epoll.rs   Sprache: unbekannt

 
#![allow(deprecated)]

use nix::errno::Errno;
use nix::sys::epoll::{epoll_create1, epoll_ctl};
use nix::sys::epoll::{EpollCreateFlags, EpollEvent, EpollFlags, EpollOp};

#[test]
pub fn test_epoll_errno() {
    let efd = epoll_create1(EpollCreateFlags::empty()).unwrap();
    let result = epoll_ctl(efd, EpollOp::EpollCtlDel, 1, None);
    result.expect_err("assertion failed");
    assert_eq!(result.unwrap_err(), Errno::ENOENT);

    let result = epoll_ctl(efd, EpollOp::EpollCtlAdd, 1, None);
    result.expect_err("assertion failed");
    assert_eq!(result.unwrap_err(), Errno::EINVAL);
}

#[test]
pub fn test_epoll_ctl() {
    let efd = epoll_create1(EpollCreateFlags::empty()).unwrap();
    let mut event =
        EpollEvent::new(EpollFlags::EPOLLIN | EpollFlags::EPOLLERR, 1);
    epoll_ctl(efd, EpollOp::EpollCtlAdd, 1, &mut event).unwrap();
    epoll_ctl(efd, EpollOp::EpollCtlDel, 1, None).unwrap();
}

[ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet)  ]