From: Christian Poveda Date: Wed, 19 Feb 2020 22:17:47 +0000 (-0500) Subject: promote open and lseek shims to posix X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=9a7bc3972ceeeab709b277f0930c5becce5e9adf;p=rust.git promote open and lseek shims to posix --- diff --git a/src/shims/foreign_items/posix.rs b/src/shims/foreign_items/posix.rs index a4bc7e4726d..6dc21d15b9f 100644 --- a/src/shims/foreign_items/posix.rs +++ b/src/shims/foreign_items/posix.rs @@ -45,6 +45,11 @@ fn emulate_foreign_item_by_name( } // File related shims + "open" | "open64" => { + let result = this.open(args[0], args[1])?; + this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?; + } + "fcntl" => { let result = this.fcntl(args[0], args[1], args.get(2).cloned())?; this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?; @@ -104,6 +109,11 @@ fn emulate_foreign_item_by_name( this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?; } + "lseek" | "lseek64" => { + let result = this.lseek64(args[0], args[1], args[2])?; + this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?; + } + // Other shims "posix_memalign" => { let ret = this.deref_operand(args[0])?; diff --git a/src/shims/foreign_items/posix/linux.rs b/src/shims/foreign_items/posix/linux.rs index cf1431c8f11..1c03e3cb1cf 100644 --- a/src/shims/foreign_items/posix/linux.rs +++ b/src/shims/foreign_items/posix/linux.rs @@ -19,21 +19,11 @@ fn emulate_foreign_item_by_name( } // File related shims - "open64" => { - let result = this.open(args[0], args[1])?; - this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?; - } - "close" => { let result = this.close(args[0])?; this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?; } - "lseek64" => { - let result = this.lseek64(args[0], args[1], args[2])?; - this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?; - } - // Time related shims "clock_gettime" => { let result = this.clock_gettime(args[0], args[1])?; diff --git a/src/shims/foreign_items/posix/macos.rs b/src/shims/foreign_items/posix/macos.rs index d0bb3109424..bf714626794 100644 --- a/src/shims/foreign_items/posix/macos.rs +++ b/src/shims/foreign_items/posix/macos.rs @@ -19,11 +19,6 @@ fn emulate_foreign_item_by_name( } // File related shims - "open" => { - let result = this.open(args[0], args[1])?; - this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?; - } - "close$NOCANCEL" => { let result = this.close(args[0])?; this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?; @@ -44,11 +39,6 @@ fn emulate_foreign_item_by_name( this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?; } - "lseek" => { - let result = this.lseek64(args[0], args[1], args[2])?; - this.write_scalar(Scalar::from_int(result, dest.layout.size), dest)?; - } - // Time related shims "gettimeofday" => { let result = this.gettimeofday(args[0], args[1])?;