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
bc657918
Unverified
Commit
bc657918
authored
Jul 03, 2017
by
Long Wang
Committed by
Stéphane Graber
Aug 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxclock: non-functional changes
This patch mainly updates comments based on the current code. Signed-off-by:
Long Wang
<
w@laoqinren.net
>
parent
730481c0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
lxclock.c
src/lxc/lxclock.c
+3
-5
lxclock.h
src/lxc/lxclock.h
+8
-3
No files found.
src/lxc/lxclock.c
View file @
bc657918
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
*/
*/
#define _GNU_SOURCE
#define _GNU_SOURCE
#include "lxclock.h"
#include <malloc.h>
#include <malloc.h>
#include <stdio.h>
#include <stdio.h>
#include <errno.h>
#include <errno.h>
...
@@ -30,6 +29,7 @@
...
@@ -30,6 +29,7 @@
#include <lxc/lxccontainer.h>
#include <lxc/lxccontainer.h>
#include "lxclock.h"
#include "utils.h"
#include "utils.h"
#include "log.h"
#include "log.h"
...
@@ -80,7 +80,7 @@ static void lock_mutex(pthread_mutex_t *l)
...
@@ -80,7 +80,7 @@ static void lock_mutex(pthread_mutex_t *l)
if
((
ret
=
pthread_mutex_lock
(
l
))
!=
0
)
{
if
((
ret
=
pthread_mutex_lock
(
l
))
!=
0
)
{
fprintf
(
stderr
,
"pthread_mutex_lock returned:%d %s
\n
"
,
ret
,
strerror
(
ret
));
fprintf
(
stderr
,
"pthread_mutex_lock returned:%d %s
\n
"
,
ret
,
strerror
(
ret
));
dump_stacktrace
();
dump_stacktrace
();
exit
(
1
);
exit
(
EXIT_FAILURE
);
}
}
}
}
...
@@ -91,7 +91,7 @@ static void unlock_mutex(pthread_mutex_t *l)
...
@@ -91,7 +91,7 @@ static void unlock_mutex(pthread_mutex_t *l)
if
((
ret
=
pthread_mutex_unlock
(
l
))
!=
0
)
{
if
((
ret
=
pthread_mutex_unlock
(
l
))
!=
0
)
{
fprintf
(
stderr
,
"pthread_mutex_unlock returned:%d %s
\n
"
,
ret
,
strerror
(
ret
));
fprintf
(
stderr
,
"pthread_mutex_unlock returned:%d %s
\n
"
,
ret
,
strerror
(
ret
));
dump_stacktrace
();
dump_stacktrace
();
exit
(
1
);
exit
(
EXIT_FAILURE
);
}
}
}
}
...
@@ -216,12 +216,10 @@ int lxclock(struct lxc_lock *l, int timeout)
...
@@ -216,12 +216,10 @@ int lxclock(struct lxc_lock *l, int timeout)
ret
=
-
2
;
ret
=
-
2
;
if
(
timeout
)
{
if
(
timeout
)
{
ERROR
(
"Error: timeout not supported with flock"
);
ERROR
(
"Error: timeout not supported with flock"
);
ret
=
-
2
;
goto
out
;
goto
out
;
}
}
if
(
!
l
->
u
.
f
.
fname
)
{
if
(
!
l
->
u
.
f
.
fname
)
{
ERROR
(
"Error: filename not set for flock"
);
ERROR
(
"Error: filename not set for flock"
);
ret
=
-
2
;
goto
out
;
goto
out
;
}
}
if
(
l
->
u
.
f
.
fd
==
-
1
)
{
if
(
l
->
u
.
f
.
fd
==
-
1
)
{
...
...
src/lxc/lxclock.h
View file @
bc657918
...
@@ -68,7 +68,8 @@ struct lxc_lock {
...
@@ -68,7 +68,8 @@ struct lxc_lock {
* will be placed in \c l->u.sem.
* will be placed in \c l->u.sem.
*
*
* If \ref lxcpath and \ref name are given (both must be given if either is
* If \ref lxcpath and \ref name are given (both must be given if either is
* given) then a lockfile is created as \c $lxcpath/$lxcname/locks/$name.
* given) then a lockfile is created as \c /run/lxc/lock/$lxcpath/.$name if root,
* or \c $XDG_RUNTIME_DIR/lxc/lock/$lxcpath/.$name if non-root.
* The lock is used to protect the containers on-disk representation.
* The lock is used to protect the containers on-disk representation.
*
*
* \internal This function allocates the pathname for the given lock in memory
* \internal This function allocates the pathname for the given lock in memory
...
@@ -87,7 +88,8 @@ extern struct lxc_lock *lxc_newlock(const char *lxcpath, const char *name);
...
@@ -87,7 +88,8 @@ extern struct lxc_lock *lxc_newlock(const char *lxcpath, const char *name);
* indefinite wait).
* indefinite wait).
*
*
* \return \c 0 if lock obtained, \c -2 on failure to set timeout,
* \return \c 0 if lock obtained, \c -2 on failure to set timeout,
* or \c -1 on any other error (\c errno will be set by \c sem_wait(3)).
* or \c -1 on any other error (\c errno will be set by \c sem_wait(3)
* or \c fcntl(2)).
*
*
* \note \p timeout is (currently?) only supported for privlock, not
* \note \p timeout is (currently?) only supported for privlock, not
* for slock. Since currently there is not a single use of the timeout
* for slock. Since currently there is not a single use of the timeout
...
@@ -102,7 +104,7 @@ extern int lxclock(struct lxc_lock *lock, int timeout);
...
@@ -102,7 +104,7 @@ extern int lxclock(struct lxc_lock *lock, int timeout);
* \param lock \ref lxc_lock.
* \param lock \ref lxc_lock.
*
*
* \return \c 0 on success, \c -2 if provided lock was not already held,
* \return \c 0 on success, \c -2 if provided lock was not already held,
* otherwise \c -1 with \c errno saved from \c f
lock
(2) or sem_post function.
* otherwise \c -1 with \c errno saved from \c f
cntl
(2) or sem_post function.
*/
*/
extern
int
lxcunlock
(
struct
lxc_lock
*
lock
);
extern
int
lxcunlock
(
struct
lxc_lock
*
lock
);
...
@@ -153,6 +155,9 @@ extern int container_disk_lock(struct lxc_container *c);
...
@@ -153,6 +155,9 @@ extern int container_disk_lock(struct lxc_container *c);
/*!
/*!
* \brief Unlock the containers disk data.
* \brief Unlock the containers disk data.
*
* \param c Container.
*
*/
*/
extern
void
container_disk_unlock
(
struct
lxc_container
*
c
);
extern
void
container_disk_unlock
(
struct
lxc_container
*
c
);
...
...
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