Skip to content

Missing POSIX lockf #1631

Closed
Closed
@brunoczim

Description

@brunoczim
use libc;

fn main() {
    let name = b"foo" as *const u8 as *const i8;
    let file = libc::open(name, libc::O_WRONLY);
    libc::lockf(file, libc::F_TLOCK, 0);
    libc::lockf(file, libc::F_ULOCK, 0);
    libc::close(file);
}
  • the target triple - x86_64-unknown-linux-gnu
  • Try to compile the following code in the given target triple. The following error appears:
   Compiling playground v0.0.1 (/playground)
error[E0425]: cannot find function `lockf` in crate `libc`
 --> src/main.rs:6:11
  |
6 |     libc::lockf(file, libc::F_TLOCK, 0);
  |           ^^^^^ not found in `libc`

error[E0425]: cannot find function `lockf` in crate `libc`
 --> src/main.rs:7:11
  |
7 |     libc::lockf(file, libc::F_ULOCK, 0);
  |           ^^^^^ not found in `libc`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0425`.
error: could not compile `playground`.

To learn more, run the command again with --verbose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions