Set the st_fstype filed on Solaris
This commit is contained in:
parent
6963ecd371
commit
4a329e9183
4 changed files with 19 additions and 19 deletions
|
|
@ -60,17 +60,17 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
// since freebsd 12 the former form can be expected.
|
||||
"stat" | "stat@FBSD_1.0" => {
|
||||
let [path, buf] = this.check_shim(abi, Conv::C, link_name, args)?;
|
||||
let result = this.macos_fbsd_solaris_stat(path, buf)?;
|
||||
let result = this.macos_fbsd_solarish_stat(path, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"lstat" | "lstat@FBSD_1.0" => {
|
||||
let [path, buf] = this.check_shim(abi, Conv::C, link_name, args)?;
|
||||
let result = this.macos_fbsd_solaris_lstat(path, buf)?;
|
||||
let result = this.macos_fbsd_solarish_lstat(path, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"fstat" | "fstat@FBSD_1.0" => {
|
||||
let [fd, buf] = this.check_shim(abi, Conv::C, link_name, args)?;
|
||||
let result = this.macos_fbsd_solaris_fstat(fd, buf)?;
|
||||
let result = this.macos_fbsd_solarish_fstat(fd, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"readdir_r" | "readdir_r@FBSD_1.0" => {
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ impl UnixFileDescription for FileHandle {
|
|||
|
||||
impl<'tcx> EvalContextExtPrivate<'tcx> for crate::MiriInterpCx<'tcx> {}
|
||||
trait EvalContextExtPrivate<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
||||
fn macos_fbsd_solaris_write_buf(
|
||||
fn macos_fbsd_solarish_write_stat_buf(
|
||||
&mut self,
|
||||
metadata: FileMetadata,
|
||||
buf_op: &OpTy<'tcx>,
|
||||
|
|
@ -321,9 +321,9 @@ trait EvalContextExtPrivate<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
}
|
||||
|
||||
if matches!(&*this.tcx.sess.target.os, "solaris" | "illumos") {
|
||||
// FIXME: write st_fstype field once libc is updated.
|
||||
// https://github.com/rust-lang/libc/pull/4145
|
||||
//this.write_int_fields_named(&[("st_fstype", 0)], &buf)?;
|
||||
let st_fstype = this.project_field_named(&buf, "st_fstype")?;
|
||||
// This is an array; write 0 into first element so that it encodes the empty string.
|
||||
this.write_int(0, &this.project_index(&st_fstype, 0)?)?;
|
||||
}
|
||||
|
||||
interp_ok(0)
|
||||
|
|
@ -668,7 +668,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
interp_ok(Scalar::from_i32(this.try_unwrap_io_result(result)?))
|
||||
}
|
||||
|
||||
fn macos_fbsd_solaris_stat(
|
||||
fn macos_fbsd_solarish_stat(
|
||||
&mut self,
|
||||
path_op: &OpTy<'tcx>,
|
||||
buf_op: &OpTy<'tcx>,
|
||||
|
|
@ -694,11 +694,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
Err(err) => return this.set_last_error_and_return_i32(err),
|
||||
};
|
||||
|
||||
interp_ok(Scalar::from_i32(this.macos_fbsd_solaris_write_buf(metadata, buf_op)?))
|
||||
interp_ok(Scalar::from_i32(this.macos_fbsd_solarish_write_stat_buf(metadata, buf_op)?))
|
||||
}
|
||||
|
||||
// `lstat` is used to get symlink metadata.
|
||||
fn macos_fbsd_solaris_lstat(
|
||||
fn macos_fbsd_solarish_lstat(
|
||||
&mut self,
|
||||
path_op: &OpTy<'tcx>,
|
||||
buf_op: &OpTy<'tcx>,
|
||||
|
|
@ -726,10 +726,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
Err(err) => return this.set_last_error_and_return_i32(err),
|
||||
};
|
||||
|
||||
interp_ok(Scalar::from_i32(this.macos_fbsd_solaris_write_buf(metadata, buf_op)?))
|
||||
interp_ok(Scalar::from_i32(this.macos_fbsd_solarish_write_stat_buf(metadata, buf_op)?))
|
||||
}
|
||||
|
||||
fn macos_fbsd_solaris_fstat(
|
||||
fn macos_fbsd_solarish_fstat(
|
||||
&mut self,
|
||||
fd_op: &OpTy<'tcx>,
|
||||
buf_op: &OpTy<'tcx>,
|
||||
|
|
@ -756,7 +756,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
Ok(metadata) => metadata,
|
||||
Err(err) => return this.set_last_error_and_return_i32(err),
|
||||
};
|
||||
interp_ok(Scalar::from_i32(this.macos_fbsd_solaris_write_buf(metadata, buf_op)?))
|
||||
interp_ok(Scalar::from_i32(this.macos_fbsd_solarish_write_stat_buf(metadata, buf_op)?))
|
||||
}
|
||||
|
||||
fn linux_statx(
|
||||
|
|
|
|||
|
|
@ -40,17 +40,17 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
}
|
||||
"stat" | "stat64" | "stat$INODE64" => {
|
||||
let [path, buf] = this.check_shim(abi, Conv::C, link_name, args)?;
|
||||
let result = this.macos_fbsd_solaris_stat(path, buf)?;
|
||||
let result = this.macos_fbsd_solarish_stat(path, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"lstat" | "lstat64" | "lstat$INODE64" => {
|
||||
let [path, buf] = this.check_shim(abi, Conv::C, link_name, args)?;
|
||||
let result = this.macos_fbsd_solaris_lstat(path, buf)?;
|
||||
let result = this.macos_fbsd_solarish_lstat(path, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"fstat" | "fstat64" | "fstat$INODE64" => {
|
||||
let [fd, buf] = this.check_shim(abi, Conv::C, link_name, args)?;
|
||||
let result = this.macos_fbsd_solaris_fstat(fd, buf)?;
|
||||
let result = this.macos_fbsd_solarish_fstat(fd, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"opendir$INODE64" => {
|
||||
|
|
|
|||
|
|
@ -87,17 +87,17 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
// File related shims
|
||||
"stat" | "stat64" => {
|
||||
let [path, buf] = this.check_shim(abi, Conv::C, link_name, args)?;
|
||||
let result = this.macos_fbsd_solaris_stat(path, buf)?;
|
||||
let result = this.macos_fbsd_solarish_stat(path, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"lstat" | "lstat64" => {
|
||||
let [path, buf] = this.check_shim(abi, Conv::C, link_name, args)?;
|
||||
let result = this.macos_fbsd_solaris_lstat(path, buf)?;
|
||||
let result = this.macos_fbsd_solarish_lstat(path, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"fstat" | "fstat64" => {
|
||||
let [fd, buf] = this.check_shim(abi, Conv::C, link_name, args)?;
|
||||
let result = this.macos_fbsd_solaris_fstat(fd, buf)?;
|
||||
let result = this.macos_fbsd_solarish_fstat(fd, buf)?;
|
||||
this.write_scalar(result, dest)?;
|
||||
}
|
||||
"readdir" => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue