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
8b79a8fe
Commit
8b79a8fe
authored
Nov 29, 2016
by
Christian Brauner
Committed by
Stéphane Graber
Nov 30, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tree-wide: random macro cleanups
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
bb1957a5
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
42 additions
and
51 deletions
+42
-51
attach.c
src/lxc/attach.c
+1
-1
bdev.c
src/lxc/bdev/bdev.c
+1
-1
bdev.h
src/lxc/bdev/bdev.h
+1
-1
cgfsng.c
src/lxc/cgroups/cgfsng.c
+3
-7
commands.h
src/lxc/commands.h
+3
-3
conf.c
src/lxc/conf.c
+3
-5
genl.c
src/lxc/genl.c
+3
-3
log.c
src/lxc/log.c
+4
-4
monitor.c
src/lxc/monitor.c
+3
-4
nl.h
src/lxc/nl.h
+1
-2
lxc_init.c
src/lxc/tools/lxc_init.c
+1
-1
lxc_ls.c
src/lxc/tools/lxc_ls.c
+0
-1
lxc_start.c
src/lxc/tools/lxc_start.c
+3
-3
lxc_stop.c
src/lxc/tools/lxc_stop.c
+2
-2
lxc_usernsexec.c
src/lxc/tools/lxc_usernsexec.c
+1
-1
utils.c
src/lxc/utils.c
+8
-9
utils.h
src/lxc/utils.h
+2
-1
concurrent.c
src/tests/concurrent.c
+1
-1
lxc-test-utils.c
src/tests/lxc-test-utils.c
+1
-1
No files found.
src/lxc/attach.c
View file @
8b79a8fe
...
@@ -79,7 +79,7 @@
...
@@ -79,7 +79,7 @@
lxc_log_define
(
lxc_attach
,
lxc
);
lxc_log_define
(
lxc_attach
,
lxc
);
/* /proc/pid-to-str/current\0 = (5 + 21 + 7 + 1) */
/* /proc/pid-to-str/current\0 = (5 + 21 + 7 + 1) */
#define __LSMATTRLEN (5 +
21
+ 7 + 1)
#define __LSMATTRLEN (5 +
(LXC_NUMSTRLEN64)
+ 7 + 1)
static
int
lsm_openat
(
int
procfd
,
pid_t
pid
,
int
on_exec
)
static
int
lsm_openat
(
int
procfd
,
pid_t
pid
,
int
on_exec
)
{
{
int
ret
=
-
1
;
int
ret
=
-
1
;
...
...
src/lxc/bdev/bdev.c
View file @
8b79a8fe
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
#include "utils.h"
#include "utils.h"
#ifndef BLKGETSIZE64
#ifndef BLKGETSIZE64
#define BLKGETSIZE64 _IOR(0x12,
114,
size_t)
#define BLKGETSIZE64 _IOR(0x12,
114,
size_t)
#endif
#endif
lxc_log_define
(
bdev
,
lxc
);
lxc_log_define
(
bdev
,
lxc
);
...
...
src/lxc/bdev/bdev.h
View file @
8b79a8fe
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
#endif
#endif
#ifndef MS_SLAVE
#ifndef MS_SLAVE
#define MS_SLAVE (1
<<
19)
#define MS_SLAVE (1
<<
19)
#endif
#endif
#ifndef MS_RELATIME
#ifndef MS_RELATIME
...
...
src/lxc/cgroups/cgfsng.c
View file @
8b79a8fe
...
@@ -357,22 +357,18 @@ static uint32_t *lxc_cpumask(char *buf, size_t nbits)
...
@@ -357,22 +357,18 @@ static uint32_t *lxc_cpumask(char *buf, size_t nbits)
return
bitarr
;
return
bitarr
;
}
}
/* The largest integer that can fit into long int is 2^64. This is a
* 20-digit number.
*/
#define __IN_TO_STR_LEN 21
/* Turn cpumask into simple, comma-separated cpulist. */
/* Turn cpumask into simple, comma-separated cpulist. */
static
char
*
lxc_cpumask_to_cpulist
(
uint32_t
*
bitarr
,
size_t
nbits
)
static
char
*
lxc_cpumask_to_cpulist
(
uint32_t
*
bitarr
,
size_t
nbits
)
{
{
size_t
i
;
size_t
i
;
int
ret
;
int
ret
;
char
numstr
[
__IN_TO_STR_LEN
]
=
{
0
};
char
numstr
[
LXC_NUMSTRLEN64
]
=
{
0
};
char
**
cpulist
=
NULL
;
char
**
cpulist
=
NULL
;
for
(
i
=
0
;
i
<=
nbits
;
i
++
)
{
for
(
i
=
0
;
i
<=
nbits
;
i
++
)
{
if
(
is_set
(
i
,
bitarr
))
{
if
(
is_set
(
i
,
bitarr
))
{
ret
=
snprintf
(
numstr
,
__IN_TO_STR_LEN
,
"%zu"
,
i
);
ret
=
snprintf
(
numstr
,
LXC_NUMSTRLEN64
,
"%zu"
,
i
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
__IN_TO_STR_LEN
)
{
if
(
ret
<
0
||
(
size_t
)
ret
>=
LXC_NUMSTRLEN64
)
{
lxc_free_array
((
void
**
)
cpulist
,
free
);
lxc_free_array
((
void
**
)
cpulist
,
free
);
return
NULL
;
return
NULL
;
}
}
...
...
src/lxc/commands.h
View file @
8b79a8fe
...
@@ -26,11 +26,11 @@
...
@@ -26,11 +26,11 @@
#include "state.h"
#include "state.h"
#define LXC_CMD_DATA_MAX (MAXPATHLEN
*
2)
#define LXC_CMD_DATA_MAX (MAXPATHLEN
*
2)
/* https://developer.gnome.org/glib/2.28/glib-Type-Conversion-Macros.html */
/* https://developer.gnome.org/glib/2.28/glib-Type-Conversion-Macros.html */
#define INT_TO_PTR(n) ((void *)
(long)
(n))
#define INT_TO_PTR(n) ((void *)
(long)
(n))
#define PTR_TO_INT(p) ((int)
(long)
(p))
#define PTR_TO_INT(p) ((int)
(long)
(p))
typedef
enum
{
typedef
enum
{
LXC_CMD_CONSOLE
,
LXC_CMD_CONSOLE
,
...
...
src/lxc/conf.c
View file @
8b79a8fe
...
@@ -99,8 +99,6 @@
...
@@ -99,8 +99,6 @@
lxc_log_define
(
lxc_conf
,
lxc
);
lxc_log_define
(
lxc_conf
,
lxc
);
#define LINELEN 4096
#if HAVE_SYS_CAPABILITY_H
#if HAVE_SYS_CAPABILITY_H
#ifndef CAP_SETFCAP
#ifndef CAP_SETFCAP
#define CAP_SETFCAP 31
#define CAP_SETFCAP 31
...
@@ -1281,7 +1279,7 @@ static int setup_rootfs(struct lxc_conf *conf)
...
@@ -1281,7 +1279,7 @@ static int setup_rootfs(struct lxc_conf *conf)
int
prepare_ramfs_root
(
char
*
root
)
int
prepare_ramfs_root
(
char
*
root
)
{
{
char
buf
[
LINELEN
],
*
p
;
char
buf
[
L
XC_L
INELEN
],
*
p
;
char
nroot
[
PATH_MAX
];
char
nroot
[
PATH_MAX
];
FILE
*
f
;
FILE
*
f
;
int
i
;
int
i
;
...
@@ -1326,7 +1324,7 @@ int prepare_ramfs_root(char *root)
...
@@ -1326,7 +1324,7 @@ int prepare_ramfs_root(char *root)
SYSERROR
(
"Unable to open /proc/self/mountinfo"
);
SYSERROR
(
"Unable to open /proc/self/mountinfo"
);
return
-
1
;
return
-
1
;
}
}
while
(
fgets
(
buf
,
LINELEN
,
f
))
{
while
(
fgets
(
buf
,
L
XC_L
INELEN
,
f
))
{
for
(
p
=
buf
,
i
=
0
;
p
&&
i
<
4
;
i
++
)
for
(
p
=
buf
,
i
=
0
;
p
&&
i
<
4
;
i
++
)
p
=
strchr
(
p
+
1
,
' '
);
p
=
strchr
(
p
+
1
,
' '
);
if
(
!
p
)
if
(
!
p
)
...
@@ -3042,7 +3040,7 @@ bool lxc_delete_network(struct lxc_handler *handler)
...
@@ -3042,7 +3040,7 @@ bool lxc_delete_network(struct lxc_handler *handler)
#define LXC_USERNIC_PATH LIBEXECDIR "/lxc/lxc-user-nic"
#define LXC_USERNIC_PATH LIBEXECDIR "/lxc/lxc-user-nic"
/* lxc-user-nic returns "interface_name:interface_name\n" */
/* lxc-user-nic returns "interface_name:interface_name\n" */
#define MAX_BUFFER_SIZE IFNAMSIZ
*
2 + 2
#define MAX_BUFFER_SIZE IFNAMSIZ
*
2 + 2
static
int
unpriv_assign_nic
(
const
char
*
lxcpath
,
char
*
lxcname
,
static
int
unpriv_assign_nic
(
const
char
*
lxcpath
,
char
*
lxcname
,
struct
lxc_netdev
*
netdev
,
pid_t
pid
)
struct
lxc_netdev
*
netdev
,
pid_t
pid
)
{
{
...
...
src/lxc/genl.c
View file @
8b79a8fe
...
@@ -44,7 +44,7 @@ static int genetlink_resolve_family(const char *family)
...
@@ -44,7 +44,7 @@ static int genetlink_resolve_family(const char *family)
request
=
genlmsg_alloc
(
GENLMSG_GOOD_SIZE
);
request
=
genlmsg_alloc
(
GENLMSG_GOOD_SIZE
);
if
(
!
request
)
if
(
!
request
)
return
-
ENOMEM
;
return
-
ENOMEM
;
reply
=
genlmsg_alloc
(
GENLMSG_GOOD_SIZE
);
reply
=
genlmsg_alloc
(
GENLMSG_GOOD_SIZE
);
if
(
!
reply
)
{
if
(
!
reply
)
{
genlmsg_free
(
request
);
genlmsg_free
(
request
);
...
@@ -86,10 +86,10 @@ static int genetlink_resolve_family(const char *family)
...
@@ -86,10 +86,10 @@ static int genetlink_resolve_family(const char *family)
len
-=
NLMSG_LENGTH
(
GENL_HDRLEN
);
len
-=
NLMSG_LENGTH
(
GENL_HDRLEN
);
if
(
len
<
0
)
if
(
len
<
0
)
goto
out_close
;
goto
out_close
;
attr
=
(
struct
nlattr
*
)
GENLMSG_DATA
(
reply
);
attr
=
(
struct
nlattr
*
)
GENLMSG_DATA
(
reply
);
attr
=
(
struct
nlattr
*
)((
char
*
)
attr
+
NLA_ALIGN
(
attr
->
nla_len
));
attr
=
(
struct
nlattr
*
)((
char
*
)
attr
+
NLA_ALIGN
(
attr
->
nla_len
));
ret
=
-
ENOMSG
;
ret
=
-
ENOMSG
;
if
(
attr
->
nla_type
!=
CTRL_ATTR_FAMILY_ID
)
if
(
attr
->
nla_type
!=
CTRL_ATTR_FAMILY_ID
)
goto
out_close
;
goto
out_close
;
...
...
src/lxc/log.c
View file @
8b79a8fe
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
* datatype is currently at maximum a 64bit integer, we have a date string that
* datatype is currently at maximum a 64bit integer, we have a date string that
* is of maximum length (2^64 - 1) * 2 = (21 + 21) = 42.
* is of maximum length (2^64 - 1) * 2 = (21 + 21) = 42.
*/
*/
#define LXC_LOG_TIME_SIZE
((__LXC_NUMSTRLEN) *
2)
#define LXC_LOG_TIME_SIZE
((LXC_NUMSTRLEN64)*
2)
int
lxc_log_fd
=
-
1
;
int
lxc_log_fd
=
-
1
;
int
lxc_quiet_specified
;
int
lxc_quiet_specified
;
...
@@ -78,7 +78,7 @@ int lxc_unix_epoch_to_utc(char *buf, size_t bufsize, const struct timespec *time
...
@@ -78,7 +78,7 @@ int lxc_unix_epoch_to_utc(char *buf, size_t bufsize, const struct timespec *time
{
{
int64_t
epoch_to_days
,
z
,
era
,
doe
,
yoe
,
year
,
doy
,
mp
,
day
,
month
,
int64_t
epoch_to_days
,
z
,
era
,
doe
,
yoe
,
year
,
doy
,
mp
,
day
,
month
,
d_in_s
,
hours
,
h_in_s
,
minutes
,
seconds
;
d_in_s
,
hours
,
h_in_s
,
minutes
,
seconds
;
char
nanosec
[
__LXC_NUMSTRLEN
];
char
nanosec
[
LXC_NUMSTRLEN64
];
int
ret
;
int
ret
;
/* See https://howardhinnant.github.io/date_algorithms.html for an
/* See https://howardhinnant.github.io/date_algorithms.html for an
...
@@ -150,8 +150,8 @@ int lxc_unix_epoch_to_utc(char *buf, size_t bufsize, const struct timespec *time
...
@@ -150,8 +150,8 @@ int lxc_unix_epoch_to_utc(char *buf, size_t bufsize, const struct timespec *time
seconds
=
(
time
->
tv_sec
-
d_in_s
-
h_in_s
-
(
minutes
*
60
));
seconds
=
(
time
->
tv_sec
-
d_in_s
-
h_in_s
-
(
minutes
*
60
));
/* Make string from nanoseconds. */
/* Make string from nanoseconds. */
ret
=
snprintf
(
nanosec
,
__LXC_NUMSTRLEN
,
"%ld"
,
time
->
tv_nsec
);
ret
=
snprintf
(
nanosec
,
LXC_NUMSTRLEN64
,
"%ld"
,
time
->
tv_nsec
);
if
(
ret
<
0
||
ret
>=
__LXC_NUMSTRLEN
)
if
(
ret
<
0
||
ret
>=
LXC_NUMSTRLEN64
)
return
-
1
;
return
-
1
;
/* Create final timestamp for the log and shorten nanoseconds to 3
/* Create final timestamp for the log and shorten nanoseconds to 3
...
...
src/lxc/monitor.c
View file @
8b79a8fe
...
@@ -284,12 +284,11 @@ int lxc_monitor_read(int fd, struct lxc_msg *msg)
...
@@ -284,12 +284,11 @@ int lxc_monitor_read(int fd, struct lxc_msg *msg)
/* Used to spawn a monitord either on startup of a daemon container, or when
/* Used to spawn a monitord either on startup of a daemon container, or when
* lxc-monitor starts.
* lxc-monitor starts.
*/
*/
#define __INT_LEN 21
int
lxc_monitord_spawn
(
const
char
*
lxcpath
)
int
lxc_monitord_spawn
(
const
char
*
lxcpath
)
{
{
int
ret
;
int
ret
;
int
pipefd
[
2
];
int
pipefd
[
2
];
char
pipefd_str
[
__INT_LEN
];
char
pipefd_str
[
LXC_NUMSTRLEN64
];
pid_t
pid1
,
pid2
;
pid_t
pid1
,
pid2
;
char
*
const
args
[]
=
{
char
*
const
args
[]
=
{
...
@@ -356,8 +355,8 @@ int lxc_monitord_spawn(const char *lxcpath)
...
@@ -356,8 +355,8 @@ int lxc_monitord_spawn(const char *lxcpath)
close
(
pipefd
[
0
]);
close
(
pipefd
[
0
]);
ret
=
snprintf
(
pipefd_str
,
__INT_LEN
,
"%d"
,
pipefd
[
1
]);
ret
=
snprintf
(
pipefd_str
,
LXC_NUMSTRLEN64
,
"%d"
,
pipefd
[
1
]);
if
(
ret
<
0
||
ret
>=
__INT_LEN
)
{
if
(
ret
<
0
||
ret
>=
LXC_NUMSTRLEN64
)
{
ERROR
(
"Failed to create pid argument to pass to monitord."
);
ERROR
(
"Failed to create pid argument to pass to monitord."
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
...
...
src/lxc/nl.h
View file @
8b79a8fe
...
@@ -30,8 +30,7 @@
...
@@ -30,8 +30,7 @@
#define PAGE_SIZE 4096
#define PAGE_SIZE 4096
#endif
#endif
#define NLMSG_GOOD_SIZE (2*PAGE_SIZE)
#define NLMSG_GOOD_SIZE (2*PAGE_SIZE)
#define NLMSG_TAIL(nmsg) \
#define NLMSG_TAIL(nmsg) ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
#define NLA_DATA(na) ((void *)((char*)(na) + NLA_HDRLEN))
#define NLA_DATA(na) ((void *)((char*)(na) + NLA_HDRLEN))
#define NLA_NEXT_ATTR(attr) ((void *)((char *)attr) + NLA_ALIGN(attr->nla_len))
#define NLA_NEXT_ATTR(attr) ((void *)((char *)attr) + NLA_ALIGN(attr->nla_len))
...
...
src/lxc/tools/lxc_init.c
View file @
8b79a8fe
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdio.h>
#include <unistd.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -30,7 +31,6 @@
...
@@ -30,7 +31,6 @@
#include <sys/stat.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/wait.h>
#define _GNU_SOURCE
#include <getopt.h>
#include <getopt.h>
#include "log.h"
#include "log.h"
...
...
src/lxc/tools/lxc_ls.c
View file @
8b79a8fe
...
@@ -43,7 +43,6 @@
...
@@ -43,7 +43,6 @@
lxc_log_define
(
lxc_ls
,
lxc
);
lxc_log_define
(
lxc_ls
,
lxc
);
#define LINELEN 1024
/* Per default we only allow five levels of recursion to protect the stack at
/* Per default we only allow five levels of recursion to protect the stack at
* least a little bit. */
* least a little bit. */
#define MAX_NESTLVL 5
#define MAX_NESTLVL 5
...
...
src/lxc/tools/lxc_start.c
View file @
8b79a8fe
...
@@ -50,9 +50,9 @@
...
@@ -50,9 +50,9 @@
#include "confile.h"
#include "confile.h"
#include "arguments.h"
#include "arguments.h"
#define OPT_SHARE_NET OPT_USAGE
+
1
#define OPT_SHARE_NET OPT_USAGE
+
1
#define OPT_SHARE_IPC OPT_USAGE
+
2
#define OPT_SHARE_IPC OPT_USAGE
+
2
#define OPT_SHARE_UTS OPT_USAGE
+
3
#define OPT_SHARE_UTS OPT_USAGE
+
3
lxc_log_define
(
lxc_start_ui
,
lxc
);
lxc_log_define
(
lxc_start_ui
,
lxc
);
...
...
src/lxc/tools/lxc_stop.c
View file @
8b79a8fe
...
@@ -33,8 +33,8 @@
...
@@ -33,8 +33,8 @@
#include "commands.h"
#include "commands.h"
#include "utils.h"
#include "utils.h"
#define OPT_NO_LOCK OPT_USAGE
+
1
#define OPT_NO_LOCK OPT_USAGE
+
1
#define OPT_NO_KILL OPT_USAGE
+
2
#define OPT_NO_KILL OPT_USAGE
+
2
lxc_log_define
(
lxc_stop_ui
,
lxc
);
lxc_log_define
(
lxc_stop_ui
,
lxc
);
...
...
src/lxc/tools/lxc_usernsexec.c
View file @
8b79a8fe
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
#endif
#endif
#ifndef MS_SLAVE
#ifndef MS_SLAVE
#define MS_SLAVE (1
<<
19)
#define MS_SLAVE (1
<<
19)
#endif
#endif
int
unshare
(
int
flags
);
int
unshare
(
int
flags
);
...
...
src/lxc/utils.c
View file @
8b79a8fe
...
@@ -1093,10 +1093,9 @@ uint64_t fnv_64a_buf(void *buf, size_t len, uint64_t hval)
...
@@ -1093,10 +1093,9 @@ uint64_t fnv_64a_buf(void *buf, size_t len, uint64_t hval)
* is MS_SHARED, but not '/', then you're out of luck - figuring that
* is MS_SHARED, but not '/', then you're out of luck - figuring that
* out would be too much work to be worth it.
* out would be too much work to be worth it.
*/
*/
#define LINELEN 4096
int
detect_shared_rootfs
(
void
)
int
detect_shared_rootfs
(
void
)
{
{
char
buf
[
LINELEN
],
*
p
;
char
buf
[
L
XC_L
INELEN
],
*
p
;
FILE
*
f
;
FILE
*
f
;
int
i
;
int
i
;
char
*
p2
;
char
*
p2
;
...
@@ -1104,18 +1103,18 @@ int detect_shared_rootfs(void)
...
@@ -1104,18 +1103,18 @@ int detect_shared_rootfs(void)
f
=
fopen
(
"/proc/self/mountinfo"
,
"r"
);
f
=
fopen
(
"/proc/self/mountinfo"
,
"r"
);
if
(
!
f
)
if
(
!
f
)
return
0
;
return
0
;
while
(
fgets
(
buf
,
LINELEN
,
f
))
{
while
(
fgets
(
buf
,
L
XC_L
INELEN
,
f
))
{
for
(
p
=
buf
,
i
=
0
;
p
&&
i
<
4
;
i
++
)
for
(
p
=
buf
,
i
=
0
;
p
&&
i
<
4
;
i
++
)
p
=
strchr
(
p
+
1
,
' '
);
p
=
strchr
(
p
+
1
,
' '
);
if
(
!
p
)
if
(
!
p
)
continue
;
continue
;
p2
=
strchr
(
p
+
1
,
' '
);
p2
=
strchr
(
p
+
1
,
' '
);
if
(
!
p2
)
if
(
!
p2
)
continue
;
continue
;
*
p2
=
'\0'
;
*
p2
=
'\0'
;
if
(
strcmp
(
p
+
1
,
"/"
)
==
0
)
{
if
(
strcmp
(
p
+
1
,
"/"
)
==
0
)
{
// this is '/'. is it shared?
// this is '/'. is it shared?
p
=
strchr
(
p2
+
1
,
' '
);
p
=
strchr
(
p2
+
1
,
' '
);
if
(
p
&&
strstr
(
p
,
"shared:"
))
{
if
(
p
&&
strstr
(
p
,
"shared:"
))
{
fclose
(
f
);
fclose
(
f
);
return
1
;
return
1
;
...
@@ -1897,7 +1896,7 @@ int lxc_strmunmap(void *addr, size_t length)
...
@@ -1897,7 +1896,7 @@ int lxc_strmunmap(void *addr, size_t length)
/* Check whether a signal is blocked by a process. */
/* Check whether a signal is blocked by a process. */
/* /proc/pid-to-str/status\0 = (5 + 21 + 7 + 1) */
/* /proc/pid-to-str/status\0 = (5 + 21 + 7 + 1) */
#define __PROC_STATUS_LEN (5 +
21
+ 7 + 1)
#define __PROC_STATUS_LEN (5 +
(LXC_NUMSTRLEN64)
+ 7 + 1)
bool
task_blocking_signal
(
pid_t
pid
,
int
signal
)
bool
task_blocking_signal
(
pid_t
pid
,
int
signal
)
{
{
bool
bret
=
false
;
bool
bret
=
false
;
...
...
src/lxc/utils.h
View file @
8b79a8fe
...
@@ -37,7 +37,8 @@
...
@@ -37,7 +37,8 @@
/* Useful macros */
/* Useful macros */
/* Maximum number for 64 bit integer is a string with 21 digits: 2^64 - 1 = 21 */
/* Maximum number for 64 bit integer is a string with 21 digits: 2^64 - 1 = 21 */
#define __LXC_NUMSTRLEN 21
#define LXC_NUMSTRLEN64 21
#define LXC_LINELEN 4096
/* returns 1 on success, 0 if there were any failures */
/* returns 1 on success, 0 if there were any failures */
extern
int
lxc_rmdir_onedev
(
char
*
path
,
const
char
*
exclude
);
extern
int
lxc_rmdir_onedev
(
char
*
path
,
const
char
*
exclude
);
...
...
src/tests/concurrent.c
View file @
8b79a8fe
...
@@ -16,13 +16,13 @@
...
@@ -16,13 +16,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
*/
#define _GNU_SOURCE
#include <limits.h>
#include <limits.h>
#include <stdio.h>
#include <stdio.h>
#include <pthread.h>
#include <pthread.h>
#include <unistd.h>
#include <unistd.h>
#include <string.h>
#include <string.h>
#include <fcntl.h>
#include <fcntl.h>
#define _GNU_SOURCE
#include <getopt.h>
#include <getopt.h>
#include <lxc/lxccontainer.h>
#include <lxc/lxccontainer.h>
...
...
src/tests/lxc-test-utils.c
View file @
8b79a8fe
...
@@ -71,7 +71,7 @@ void test_lxc_deslashify(void)
...
@@ -71,7 +71,7 @@ void test_lxc_deslashify(void)
}
}
/* /proc/int_as_str/ns/mnt\0 = (5 + 21 + 7 + 1) */
/* /proc/int_as_str/ns/mnt\0 = (5 + 21 + 7 + 1) */
#define __MNTNS_LEN (5 +
21
+ 7 + 1)
#define __MNTNS_LEN (5 +
(LXC_NUMSTRLEN64)
+ 7 + 1)
void
test_detect_ramfs_rootfs
(
void
)
void
test_detect_ramfs_rootfs
(
void
)
{
{
size_t
i
;
size_t
i
;
...
...
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