Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
66abaa6d
Commit
66abaa6d
authored
3 months ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
Add support for -r (read-only) open before locking
And only supports a single file per invocation now.
parent
3b794a8c
No related branches found
No related tags found
No related merge requests found
Pipeline
#7116
passed
3 months ago
Stage: build
Stage: test
Stage: cleanup
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/xpdev/showlocks.c
+14
-10
14 additions, 10 deletions
src/xpdev/showlocks.c
with
14 additions
and
10 deletions
src/xpdev/showlocks.c
+
14
−
10
View file @
66abaa6d
#include
<stdlib.h>
#include
<string.h>
#include
"filewrap.h"
void
show_locks
(
const
char
*
path
)
int
main
(
int
argc
,
char
*
*
argv
)
{
int
file
=
open
(
path
,
O_RDWR
);
int
access
=
O_RDWR
;
int
argn
=
1
;
if
(
strcmp
(
argv
[
argn
],
"-r"
)
==
0
)
{
access
=
O_RDONLY
;
++
argn
;
}
const
char
*
path
=
argv
[
argn
++
];
int
file
=
open
(
path
,
access
);
if
(
file
==
-
1
)
{
perror
(
path
);
return
;
return
EXIT_FAILURE
;
}
off_t
len
=
filelength
(
file
);
...
...
@@ -17,11 +27,5 @@ void show_locks(const char* path)
unlock
(
file
,
o
,
1
);
}
close
(
file
);
return
EXIT_SUCCESS
;
}
int
main
(
int
argc
,
char
**
argv
)
{
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
show_locks
(
argv
[
i
]);
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment