Skip to content

Commit 63538c2

Browse files
committed
Auto merge of #1118 - smaeul:flock, r=gnzlbg
Add F_RDLCK/F_WRLCK/F_UNLCK to several platforms These are used by the flock wrapper in rustc_data_structures. The constants were already present in x86_64-linux-gnu and BSD (since 4928bd9). Currently the `flock` wrapper in `rustc_data_structures` does not work on several 32-bit musl targets, because they expect the `LARGEFILE64` version of the `F_SETLK`/`F_SETLKW` constants. This PR is a prerequisite to converting that code to use the `libc` types and constants, instead of (inaccurately) duplicating them, since `libc` already provides architecture-specific definitions of the relevant constants.
2 parents 091669f + 1b130d4 commit 63538c2

File tree

7 files changed

+28
-0
lines changed

7 files changed

+28
-0
lines changed

Diff for: src/unix/haiku/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,10 @@ pub const F_SETLK: ::c_int = 0x0080;
351351
pub const F_SETLKW: ::c_int = 0x0100;
352352
pub const F_DUPFD_CLOEXEC: ::c_int = 0x0200;
353353

354+
pub const F_RDLCK: ::c_int = 0x0040;
355+
pub const F_UNLCK: ::c_int = 0x0200;
356+
pub const F_WRLCK: ::c_int = 0x0400;
357+
354358
pub const AT_FDCWD: ::c_int = -1;
355359
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x01;
356360
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x02;

Diff for: src/unix/notbsd/android/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,10 @@ pub const F_SETOWN: ::c_int = 8;
744744
pub const F_SETLK: ::c_int = 6;
745745
pub const F_SETLKW: ::c_int = 7;
746746

747+
pub const F_RDLCK: ::c_int = 0;
748+
pub const F_WRLCK: ::c_int = 1;
749+
pub const F_UNLCK: ::c_int = 2;
750+
747751
pub const TCGETS: ::c_int = 0x5401;
748752
pub const TCSETS: ::c_int = 0x5402;
749753
pub const TCSETSW: ::c_int = 0x5403;

Diff for: src/unix/notbsd/linux/musl/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ pub const ECOMM: ::c_int = 70;
121121
pub const EPROTO: ::c_int = 71;
122122
pub const EDOTDOT: ::c_int = 73;
123123

124+
pub const F_RDLCK: ::c_int = 0;
125+
pub const F_WRLCK: ::c_int = 1;
126+
pub const F_UNLCK: ::c_int = 2;
127+
124128
pub const SA_NODEFER: ::c_int = 0x40000000;
125129
pub const SA_RESETHAND: ::c_int = 0x80000000;
126130
pub const SA_RESTART: ::c_int = 0x10000000;

Diff for: src/unix/notbsd/linux/other/b32/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ pub const F_SETOWN: ::c_int = 8;
251251
pub const F_SETLK: ::c_int = 6;
252252
pub const F_SETLKW: ::c_int = 7;
253253

254+
pub const F_RDLCK: ::c_int = 0;
255+
pub const F_WRLCK: ::c_int = 1;
256+
pub const F_UNLCK: ::c_int = 2;
257+
254258
pub const SFD_NONBLOCK: ::c_int = 0x0800;
255259

256260
pub const TIOCEXCL: ::c_ulong = 0x540C;

Diff for: src/unix/notbsd/linux/other/b64/aarch64.rs

+4
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ pub const F_SETOWN: ::c_int = 8;
340340
pub const F_SETLK: ::c_int = 6;
341341
pub const F_SETLKW: ::c_int = 7;
342342

343+
pub const F_RDLCK: ::c_int = 0;
344+
pub const F_WRLCK: ::c_int = 1;
345+
pub const F_UNLCK: ::c_int = 2;
346+
343347
pub const SFD_NONBLOCK: ::c_int = 0x0800;
344348

345349
pub const TIOCEXCL: ::c_ulong = 0x540C;

Diff for: src/unix/notbsd/linux/other/b64/powerpc64.rs

+4
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,10 @@ pub const F_SETOWN: ::c_int = 8;
327327
pub const F_SETLK: ::c_int = 6;
328328
pub const F_SETLKW: ::c_int = 7;
329329

330+
pub const F_RDLCK: ::c_int = 0;
331+
pub const F_WRLCK: ::c_int = 1;
332+
pub const F_UNLCK: ::c_int = 2;
333+
330334
pub const SFD_NONBLOCK: ::c_int = 0x0800;
331335

332336
pub const TIOCEXCL: ::c_ulong = 0x540C;

Diff for: src/unix/notbsd/linux/other/b64/sparc64.rs

+4
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ pub const F_SETOWN: ::c_int = 6;
305305
pub const F_SETLK: ::c_int = 8;
306306
pub const F_SETLKW: ::c_int = 9;
307307

308+
pub const F_RDLCK: ::c_int = 1;
309+
pub const F_WRLCK: ::c_int = 2;
310+
pub const F_UNLCK: ::c_int = 3;
311+
308312
pub const SFD_NONBLOCK: ::c_int = 0x4000;
309313

310314
pub const TIOCEXCL: ::c_ulong = 0x2000740d;

0 commit comments

Comments
 (0)