Skip to content

Commit

Permalink
lang/rust-analyzer: do the previous ... properly.
Browse files Browse the repository at this point in the history
Linux x32 has a quirk in the libc crate, so that gets duplicated here.
Also, fix the path to the file to be patched.  Ride previous revision bump.
  • Loading branch information
he32 committed Oct 10, 2022
1 parent 6a6bd39 commit 6d76611
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lang/rust-analyzer/distinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.18 2022/10/10 08:08:28 he Exp $
$NetBSD: distinfo,v 1.19 2022/10/10 19:04:52 he Exp $

BLAKE2s (addr2line-0.17.0.crate) = f7fa3b016f0e80c4ea9967f8947de15edc9fa39d0c0cdea692dccd0c41c28039
SHA512 (addr2line-0.17.0.crate) = ef3bbd7c6d1dfdd0b47e3be1fb4c8b15ed61a769bed7e80dce80461a1ee13ef21c75e62e9a66328504f862341f1e808abec5790ac79784e18655afcc16206b95
Expand Down Expand Up @@ -513,4 +513,4 @@ Size (xshell-0.2.2.crate) = 23846 bytes
BLAKE2s (xshell-macros-0.2.2.crate) = 21b45d4c73fe60a536e4762405e28a321e64fe7411890a36ebdd9f35774c14a9
SHA512 (xshell-macros-0.2.2.crate) = a477f18810d2b647c78cbc06d59b8b84817ee5e54cc8785897ecae743d263c6d0fab3563f66aed6a5e81b790bab317871162513c8ff14364d936afaa082f1ff4
Size (xshell-macros-0.2.2.crate) = 2848 bytes
SHA1 (patch-vendor_kqueue-1.0.6_src_time.rs) = d46b71aebe930dd01effe2f81cfa13f823285e93
SHA1 (patch-vendor_kqueue-1.0.6_src_time.rs) = bc6df7987e0c4b2677d4c6015d2779dc8e9de170
27 changes: 16 additions & 11 deletions lang/rust-analyzer/patches/patch-vendor_kqueue-1.0.6_src_time.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
$NetBSD: patch-vendor_kqueue-1.0.6_src_time.rs,v 1.1 2022/10/10 08:08:28 he Exp $
$NetBSD: patch-vendor_kqueue-1.0.6_src_time.rs,v 1.2 2022/10/10 19:04:52 he Exp $

Use the timespec component types instead of hardcoding int lengths.
...except Linux has a quirk.

--- vendor/kqueue-1.0.6/src/time.rs.orig 1973-11-29 21:33:09.000000000 +0000
+++ vendor/kqueue-1.0.6/src/time.rs
@@ -1,32 +1,11 @@
+use libc::time_t;
+use libc::c_long;
use libc::timespec;
--- ../vendor/kqueue-1.0.6/src/time.rs.orig 1973-11-29 21:33:09.000000000 +0000
+++ ../vendor/kqueue-1.0.6/src/time.rs
@@ -1,32 +1,15 @@
-use libc::timespec;
+use libc::{timespec, time_t, c_long};
use std::time::Duration;

-#[cfg(not(all(
- any(target_os = "freebsd", target_os = "macos"),
- any(target_arch = "x86", target_arch = "powerpc")
-)))]
pub(crate) fn duration_to_timespec(d: Duration) -> timespec {
-pub(crate) fn duration_to_timespec(d: Duration) -> timespec {
- let tv_sec = d.as_secs() as i64;
- let tv_nsec = d.subsec_nanos() as i64;
-
Expand All @@ -28,16 +28,21 @@ Use the timespec component types instead of hardcoding int lengths.
-
- timespec { tv_sec, tv_nsec }
-}
-
+// Linux x32 compatibility, ref. libc/src/unix/mod.rs
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+type NSec = i64;
+#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+type NSec = c_long;

-#[cfg(all(
- any(target_os = "freebsd", target_os = "macos"),
- any(target_arch = "x86", target_arch = "powerpc")
-))]
-pub(crate) fn duration_to_timespec(d: Duration) -> timespec {
pub(crate) fn duration_to_timespec(d: Duration) -> timespec {
- let tv_sec = d.as_secs() as i32;
- let tv_nsec = d.subsec_nanos() as i32;
+ let tv_sec = d.as_secs() as time_t;
+ let tv_nsec = d.subsec_nanos() as c_long;
+ let tv_nsec = d.subsec_nanos() as NSec;

if tv_sec.is_negative() {
panic!("Duration seconds is negative");

0 comments on commit 6d76611

Please sign in to comment.