aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/flock
blob: 71878b104f1dfa4881531e7f321c84997b2c2fb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env perl

use strict;
use warnings;

# Only arguments '--exclusive 1' exactly are supported.
(@ARGV == 2) or die;
my $mode = shift;
($mode eq "--exclusive") or die;
my $fd = shift;
($fd eq "1") or die;

use Fcntl ':flock';

open(my $fh, '>&=', 1) or die "open: $!";

flock($fh, LOCK_EX) or die "flock: $!";