commands: switch to pid_t to send around pid

parent b41ec4d2
...@@ -329,13 +329,13 @@ int lxc_try_cmd(const char *name, const char *lxcpath) ...@@ -329,13 +329,13 @@ int lxc_try_cmd(const char *name, const char *lxcpath)
pid_t lxc_cmd_get_init_pid(const char *name, const char *lxcpath) pid_t lxc_cmd_get_init_pid(const char *name, const char *lxcpath)
{ {
int ret, stopped; int ret, stopped;
intmax_t pid = -1; pid_t pid = -1;
struct lxc_cmd_rr cmd = { struct lxc_cmd_rr cmd = {
.req = { .req = {
.cmd = LXC_CMD_GET_INIT_PID .cmd = LXC_CMD_GET_INIT_PID
}, },
.rsp = { .rsp = {
.data = INTMAX_TO_PTR(pid) .data = PID_TO_PTR(pid)
} }
}; };
...@@ -343,7 +343,7 @@ pid_t lxc_cmd_get_init_pid(const char *name, const char *lxcpath) ...@@ -343,7 +343,7 @@ pid_t lxc_cmd_get_init_pid(const char *name, const char *lxcpath)
if (ret < 0) if (ret < 0)
return -1; return -1;
pid = PTR_TO_INTMAX(cmd.rsp.data); pid = PTR_TO_PID(cmd.rsp.data);
if (pid < 0) if (pid < 0)
return -1; return -1;
...@@ -357,10 +357,8 @@ static int lxc_cmd_get_init_pid_callback(int fd, struct lxc_cmd_req *req, ...@@ -357,10 +357,8 @@ static int lxc_cmd_get_init_pid_callback(int fd, struct lxc_cmd_req *req,
struct lxc_handler *handler, struct lxc_handler *handler,
struct lxc_epoll_descr *descr) struct lxc_epoll_descr *descr)
{ {
intmax_t pid = handler->pid;
struct lxc_cmd_rsp rsp = { struct lxc_cmd_rsp rsp = {
.data = INTMAX_TO_PTR(pid) .data = PID_TO_PTR(handler->pid)
}; };
return lxc_cmd_rsp_send(fd, &rsp); return lxc_cmd_rsp_send(fd, &rsp);
......
...@@ -414,8 +414,8 @@ enum { ...@@ -414,8 +414,8 @@ enum {
#define PTR_TO_INT(p) ((int)((intptr_t)(p))) #define PTR_TO_INT(p) ((int)((intptr_t)(p)))
#define INT_TO_PTR(u) ((void *)((intptr_t)(u))) #define INT_TO_PTR(u) ((void *)((intptr_t)(u)))
#define PTR_TO_INTMAX(p) ((intmax_t)((intptr_t)(p))) #define PTR_TO_PID(p) ((pid_t)((intptr_t)(p)))
#define INTMAX_TO_PTR(u) ((void *)((intptr_t)(u))) #define PID_TO_PTR(u) ((void *)((intptr_t)(u)))
#define PTR_TO_UINT64(p) ((uint64_t)((intptr_t)(p))) #define PTR_TO_UINT64(p) ((uint64_t)((intptr_t)(p)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment