Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
1638d310
Commit
1638d310
authored
Sep 03, 2008
by
dlezcano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed lxc_lock
parent
0886644a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
93 deletions
+0
-93
lock.c
src/liblxc/lock.c
+0
-63
lock.h
src/liblxc/lock.h
+0
-30
No files found.
src/liblxc/lock.c
deleted
100644 → 0
View file @
0886644a
/*
* lxc: linux Container library
*
* (C) Copyright IBM Corp. 2007, 2008
*
* Authors:
* Daniel Lezcano <dlezcano at fr.ibm.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define _GNU_SOURCE
#include <stdio.h>
#undef _GNU_SOURCE
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/file.h>
#include <lxc.h>
int
lxc_get_lock
(
const
char
*
name
)
{
char
*
lock
;
int
fd
,
ret
;
asprintf
(
&
lock
,
LXCPATH
"/%s"
,
name
);
fd
=
open
(
lock
,
O_RDONLY
|
O_DIRECTORY
,
S_IRUSR
|
S_IWUSR
);
if
(
fd
<
0
)
{
ret
=
-
errno
;
goto
out
;
}
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
);
if
(
flock
(
fd
,
LOCK_EX
|
LOCK_NB
))
{
ret
=
errno
==
EWOULDBLOCK
?
0
:
-
errno
;
close
(
fd
);
goto
out
;
}
ret
=
fd
;
out:
free
(
lock
);
return
ret
;
}
void
lxc_put_lock
(
int
lock
)
{
flock
(
lock
,
LOCK_UN
);
close
(
lock
);
}
src/liblxc/lock.h
deleted
100644 → 0
View file @
0886644a
/*
* lxc: linux Container library
*
* (C) Copyright IBM Corp. 2007, 2008
*
* Authors:
* Daniel Lezcano <dlezcano at fr.ibm.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _lock_h
#define _lock_h
extern
int
lxc_get_lock
(
const
char
*
name
);
extern
int
lxc_put_lock
(
int
lock
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment