mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
build: Initial musl support
Fix all build failures and add musl to the gihub workflows. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
committed by
Rob Bradford
parent
a5de49558e
commit
86fcd19b8a
@@ -12,6 +12,9 @@ jobs:
|
|||||||
- stable
|
- stable
|
||||||
- beta
|
- beta
|
||||||
- nightly
|
- nightly
|
||||||
|
target:
|
||||||
|
- x86_64-unknown-linux-gnu
|
||||||
|
- x86_64-unknown-linux-musl
|
||||||
steps:
|
steps:
|
||||||
- name: Code checkout
|
- name: Code checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -19,7 +22,8 @@ jobs:
|
|||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ matrix.rust }}
|
toolchain: ${{ matrix.rust }}
|
||||||
|
target: ${{ matrix.target }}
|
||||||
override: true
|
override: true
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --release
|
run: cargo build --release --target=${{ matrix.target }}
|
||||||
|
|||||||
@@ -9,13 +9,20 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Code checkout
|
- name: Code checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Install Rust toolchain (stable)
|
- name: Install Rust toolchain (x86_64-unknown-linux-gnu)
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
override: true
|
target: x86_64-unknown-linux-gnu
|
||||||
|
- name: Install Rust toolchain (x86_64-unknown-linux-musl)
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
target: x86_64-unknown-linux-musl
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --release
|
run: cargo build --release --target=x86_64-unknown-linux-gnu
|
||||||
|
- name: Static Build
|
||||||
|
run: cargo build --release --target=x86_64-unknown-linux-musl
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
@@ -33,9 +40,19 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
asset_path: target/release/cloud-hypervisor
|
asset_path: target/x86_64-unknown-linux-gnu/release/cloud-hypervisor
|
||||||
asset_name: cloud-hypervisor
|
asset_name: cloud-hypervisor
|
||||||
asset_content_type: application/octet-stream
|
asset_content_type: application/octet-stream
|
||||||
|
- name: Upload static cloud-hypervisor
|
||||||
|
id: upload-release-static-cloud-hypervisor
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: target/x86_64-unknown-linux-musl/release/cloud-hypervisor
|
||||||
|
asset_name: cloud-hypervisor-static
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
- name: Upload ch-remote
|
- name: Upload ch-remote
|
||||||
id: upload-release-ch-remote
|
id: upload-release-ch-remote
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
@@ -43,6 +60,6 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
asset_path: target/release/ch-remote
|
asset_path: target/x86_64-unknown-linux-gnu/release/ch-remote
|
||||||
asset_name: ch-remote
|
asset_name: ch-remote
|
||||||
asset_content_type: application/octet-stream
|
asset_content_type: application/octet-stream
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
use std::collections::btree_map;
|
use std::collections::btree_map;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::convert::TryInto;
|
|
||||||
use std::ffi::{CStr, CString};
|
use std::ffi::{CStr, CString};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io;
|
use std::io;
|
||||||
@@ -1695,13 +1694,14 @@ impl FileSystem for PassthroughFs {
|
|||||||
// Safe because this will only modify `offset_in` and `offset_out` and we check
|
// Safe because this will only modify `offset_in` and `offset_out` and we check
|
||||||
// the return value.
|
// the return value.
|
||||||
let res = unsafe {
|
let res = unsafe {
|
||||||
libc::copy_file_range(
|
libc::syscall(
|
||||||
|
libc::SYS_copy_file_range,
|
||||||
fd_in,
|
fd_in,
|
||||||
&mut (offset_in as i64) as &mut _ as *mut _,
|
&mut (offset_in as i64) as &mut _ as *mut _,
|
||||||
fd_out,
|
fd_out,
|
||||||
&mut (offset_out as i64) as &mut _ as *mut _,
|
&mut (offset_out as i64) as &mut _ as *mut _,
|
||||||
len.try_into().unwrap(),
|
len,
|
||||||
flags.try_into().unwrap(),
|
flags,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
if res < 0 {
|
if res < 0 {
|
||||||
|
|||||||
+1
-1
@@ -671,7 +671,7 @@ impl VcpuState {
|
|||||||
fn signal_thread(&self) {
|
fn signal_thread(&self) {
|
||||||
if let Some(handle) = self.handle.as_ref() {
|
if let Some(handle) = self.handle.as_ref() {
|
||||||
unsafe {
|
unsafe {
|
||||||
libc::pthread_kill(handle.as_pthread_t(), SIGRTMIN());
|
libc::pthread_kill(handle.as_pthread_t() as _, SIGRTMIN());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user