bytedance / monoio

Rust async runtime based on io-uring.
Apache License 2.0
3.98k stars 223 forks source link

feat(op, fs): :sparkles: Intergated `statx` into monoio #268

Closed Lzzzzzt closed 3 months ago

Lzzzzzt commented 4 months ago

Add statx support for monoio

Add Statx<T> struct to support Op, just implement for SharedFd and CString to support different use cases.

So there are two types: FdStatx and PathStatx, both of them are implement OpAble Trait.

Currently, they can work on linux with iouring and legacy feature, and not support macos and windows, due to these two platforms don't have the statx syscall, it may use the stat syscall and transform the result to the statx

Also, to test the Statx<T> work correctly, I add some new struct to fs module like Metadata, Permissions and FileType.

There is another reason to add these struct, I can't transform the statx struct to the Metadata and other types in std::fs.

So these struct provide nearly the same API like std::fs's

I also add some basic test in tests dir.

Currently, all these changes above only work on linux

CLAassistant commented 4 months ago

CLA assistant check
All committers have signed the CLA.

Lzzzzzt commented 4 months ago

267

ihciah commented 4 months ago

It seems test failed for i686 and aarch64...

Lzzzzzt commented 4 months ago

the problem in aarch64 may fixed, but the i686's i don't know why this would happen, maybe disable the statx in i686?

Lzzzzzt commented 4 months ago

the error happen due to the cross's bug, i have test in newest cross version, it works fine.

Lzzzzzt commented 4 months ago
image

and the run.sh is

#!/bin/bash

# Define the list of architectures to test
architectures=(
    "x86_64-unknown-linux-gnu"
    "i686-unknown-linux-gnu"
    "aarch64-unknown-linux-gnu"
    "armv7-unknown-linux-gnueabihf"
    "riscv64gc-unknown-linux-gnu"
    "s390x-unknown-linux-gnu"

    "x86_64-apple-darwin"
    "aarch64-apple-darwin"
)

# Loop through each architecture and run the tests
for arch in "${architectures[@]}"; do

    cross test --lib --bins --tests --target "$arch" --no-default-features --features "async-cancel,bytes,legacy,macros,utils" > /dev/null 2>&1

    if [ $? -eq 0 ]; then
        echo "Success for $arch"
    else
        echo "Failure for $arch"
    fi
done

the failure of riscv is #1423