diff options
| author | Yoh Deadfall <yoh.deadfall@hotmail.com> | 2025-01-28 18:10:54 +0300 |
|---|---|---|
| committer | Yoh Deadfall <yoh.deadfall@hotmail.com> | 2025-01-30 01:26:10 +0300 |
| commit | 4a329e91830ca34744c657ca2d67627cf6ad5d5c (patch) | |
| tree | dca7eac10cc970e414c151cf429a062fcaa4ee80 | |
| parent | 6963ecd371c961a3eb2e68262ea2b08dcc05a5c5 (diff) | |
| download | rust-4a329e91830ca34744c657ca2d67627cf6ad5d5c.tar.gz rust-4a329e91830ca34744c657ca2d67627cf6ad5d5c.zip | |
Set the st_fstype filed on Solaris
4 files changed, 19 insertions, 19 deletions
diff --git a/src/tools/miri/src/shims/unix/freebsd/foreign_items.rs b/src/tools/miri/src/shims/unix/freebsd/foreign_items.rs index 03dbd931329..08d06fe5d4c 100644 --- a/src/tools/miri/src/shims/unix/freebsd/foreign_items.rs +++ b/src/tools/miri/src/shims/unix/freebsd/foreign_items.rs @@ -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" => { diff --git a/src/tools/miri/src/shims/unix/fs.rs b/src/tools/miri/src/shims/unix/fs.rs index 25594b78031..48dfb92f1f5 100644 --- a/src/tools/miri/src/shims/unix/fs.rs +++ b/src/tools/miri/src/shims/unix/fs.rs @@ -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( diff --git a/src/tools/miri/src/shims/unix/macos/foreign_items.rs b/src/tools/miri/src/shims/unix/macos/foreign_items.rs index 85c963774a1..60f7b67b7b2 100644 --- a/src/tools/miri/src/shims/unix/macos/foreign_items.rs +++ b/src/tools/miri/src/shims/unix/macos/foreign_items.rs @@ -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" => { diff --git a/src/tools/miri/src/shims/unix/solarish/foreign_items.rs b/src/tools/miri/src/shims/unix/solarish/foreign_items.rs index f94783a3907..9805dcb852d 100644 --- a/src/tools/miri/src/shims/unix/solarish/foreign_items.rs +++ b/src/tools/miri/src/shims/unix/solarish/foreign_items.rs @@ -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" => { |
