]> git.lizzy.rs Git - rust.git/commitdiff
promote open and lseek shims to posix
authorChristian Poveda <git@christianpoveda.xyz>
Wed, 19 Feb 2020 22:17:47 +0000 (17:17 -0500)
committerChristian Poveda <git@christianpoveda.xyz>
Wed, 19 Feb 2020 22:48:15 +0000 (17:48 -0500)
src/shims/foreign_items/posix.rs
src/shims/foreign_items/posix/linux.rs
src/shims/foreign_items/posix/macos.rs

index a4bc7e4726d0bf58430b802c0b72b9d1a51c1865..6dc21d15b9f630bd94cd5e2fa4afd1f76020cda9 100644 (file)
@@ -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])?;
index cf1431c8f11706ad3a2ecaa5adcc948501830a53..1c03e3cb1cfeb140de07891caf65d72837dad345 100644 (file)
@@ -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])?;
index d0bb3109424dd35b65a622092eb87c9d15f6b9d3..bf7146267944f696260321e2bcc18bc3788a9b57 100644 (file)
@@ -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])?;