@@ -31,12 +31,6 @@ cfg_if! {
3131 // not actually here, but brings in line with freebsd
3232 pub l_sysid: libc:: c_int,
3333 }
34-
35- pub const F_RDLCK : libc:: c_short = 0 ;
36- pub const F_WRLCK : libc:: c_short = 1 ;
37- pub const F_UNLCK : libc:: c_short = 2 ;
38- pub const F_SETLK : libc:: c_int = 6 ;
39- pub const F_SETLKW : libc:: c_int = 7 ;
4034 }
4135
4236 #[ cfg( target_os = "freebsd" ) ]
@@ -52,12 +46,6 @@ cfg_if! {
5246 pub l_whence: libc:: c_short,
5347 pub l_sysid: libc:: c_int,
5448 }
55-
56- pub const F_RDLCK : libc:: c_short = 1 ;
57- pub const F_UNLCK : libc:: c_short = 2 ;
58- pub const F_WRLCK : libc:: c_short = 3 ;
59- pub const F_SETLK : libc:: c_int = 12 ;
60- pub const F_SETLKW : libc:: c_int = 13 ;
6149 }
6250
6351 #[ cfg( any( target_os = "dragonfly" ,
@@ -78,12 +66,6 @@ cfg_if! {
7866 // not actually here, but brings in line with freebsd
7967 pub l_sysid: libc:: c_int,
8068 }
81-
82- pub const F_RDLCK : libc:: c_short = 1 ;
83- pub const F_UNLCK : libc:: c_short = 2 ;
84- pub const F_WRLCK : libc:: c_short = 3 ;
85- pub const F_SETLK : libc:: c_int = 8 ;
86- pub const F_SETLKW : libc:: c_int = 9 ;
8769 }
8870
8971 #[ cfg( target_os = "haiku" ) ]
@@ -101,12 +83,6 @@ cfg_if! {
10183 // not actually here, but brings in line with freebsd
10284 pub l_sysid: libc:: c_int,
10385 }
104-
105- pub const F_RDLCK : libc:: c_short = 0x0040 ;
106- pub const F_UNLCK : libc:: c_short = 0x0200 ;
107- pub const F_WRLCK : libc:: c_short = 0x0400 ;
108- pub const F_SETLK : libc:: c_int = 0x0080 ;
109- pub const F_SETLKW : libc:: c_int = 0x0100 ;
11086 }
11187
11288 #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
@@ -124,12 +100,6 @@ cfg_if! {
124100 // not actually here, but brings in line with freebsd
125101 pub l_sysid: libc:: c_int,
126102 }
127-
128- pub const F_RDLCK : libc:: c_short = 1 ;
129- pub const F_UNLCK : libc:: c_short = 2 ;
130- pub const F_WRLCK : libc:: c_short = 3 ;
131- pub const F_SETLK : libc:: c_int = 8 ;
132- pub const F_SETLKW : libc:: c_int = 9 ;
133103 }
134104
135105 #[ cfg( target_os = "solaris" ) ]
@@ -145,12 +115,6 @@ cfg_if! {
145115 pub l_sysid: libc:: c_int,
146116 pub l_pid: libc:: pid_t,
147117 }
148-
149- pub const F_RDLCK : libc:: c_short = 1 ;
150- pub const F_WRLCK : libc:: c_short = 2 ;
151- pub const F_UNLCK : libc:: c_short = 3 ;
152- pub const F_SETLK : libc:: c_int = 6 ;
153- pub const F_SETLKW : libc:: c_int = 7 ;
154118 }
155119
156120 #[ derive( Debug ) ]
@@ -182,9 +146,9 @@ cfg_if! {
182146 }
183147
184148 let lock_type = if exclusive {
185- os :: F_WRLCK
149+ libc :: F_WRLCK as libc :: c_short
186150 } else {
187- os :: F_RDLCK
151+ libc :: F_RDLCK as libc :: c_short
188152 } ;
189153
190154 let flock = os:: flock {
@@ -195,7 +159,7 @@ cfg_if! {
195159 l_type: lock_type,
196160 l_sysid: 0 ,
197161 } ;
198- let cmd = if wait { os :: F_SETLKW } else { os :: F_SETLK } ;
162+ let cmd = if wait { libc :: F_SETLKW } else { libc :: F_SETLK } ;
199163 let ret = unsafe {
200164 libc:: fcntl( fd, cmd, & flock)
201165 } ;
@@ -216,11 +180,11 @@ cfg_if! {
216180 l_len: 0 ,
217181 l_pid: 0 ,
218182 l_whence: libc:: SEEK_SET as libc:: c_short,
219- l_type: os :: F_UNLCK ,
183+ l_type: libc :: F_UNLCK as libc :: c_short ,
220184 l_sysid: 0 ,
221185 } ;
222186 unsafe {
223- libc:: fcntl( self . fd, os :: F_SETLK , & flock) ;
187+ libc:: fcntl( self . fd, libc :: F_SETLK , & flock) ;
224188 libc:: close( self . fd) ;
225189 }
226190 }
0 commit comments