]> git.lizzy.rs Git - rust.git/blobdiff - src/librustdoc/flock.rs
auto merge of #15999 : Kimundi/rust/fix_folder, r=nikomatsakis
[rust.git] / src / librustdoc / flock.rs
index cb2ebd15b3970ffc21733dc3672571bd1d479ba1..f22950e7a299e235c8922a1d7edeec6d513c514e 100644 (file)
@@ -63,6 +63,27 @@ pub struct flock {
         pub static F_SETLKW: libc::c_int = 13;
     }
 
+    #[cfg(target_os = "dragonfly")]
+    mod os {
+        use libc;
+
+        pub struct flock {
+            pub l_start: libc::off_t,
+            pub l_len: libc::off_t,
+            pub l_pid: libc::pid_t,
+            pub l_type: libc::c_short,
+            pub l_whence: libc::c_short,
+
+            // not actually here, but brings in line with freebsd
+            pub l_sysid: libc::c_int,
+        }
+
+        pub static F_UNLCK: libc::c_short = 2;
+        pub static F_WRLCK: libc::c_short = 3;
+        pub static F_SETLK: libc::c_int = 8;
+        pub static F_SETLKW: libc::c_int = 9;
+    }
+
     #[cfg(target_os = "macos")]
     #[cfg(target_os = "ios")]
     mod os {
@@ -162,7 +183,8 @@ pub struct Lock {
 
     impl Lock {
         pub fn new(p: &Path) -> Lock {
-            let p_16 = p.as_str().unwrap().to_utf16().append_one(0);
+            let p_16: Vec<u16> = p.as_str().unwrap().utf16_units().collect();
+            let p_16 = p_16.append_one(0);
             let handle = unsafe {
                 libc::CreateFileW(p_16.as_ptr(),
                                   libc::FILE_GENERIC_READ |