Commit ad3bc057 authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Cyrill Gorcunov

uts_ns.c: use pr_perror() where appropriate

There are quite a few cases where we need to print system error string.
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent ca099959
...@@ -27,7 +27,7 @@ static int collect_ipc_msg(void *data) ...@@ -27,7 +27,7 @@ static int collect_ipc_msg(void *data)
ret = msgctl(0, MSG_INFO, (struct msqid_ds *)&info); ret = msgctl(0, MSG_INFO, (struct msqid_ds *)&info);
if (ret < 0) { if (ret < 0) {
pr_err("msgctl failed with %d\n", errno); pr_perror("msgctl failed");
return ret; return ret;
} }
...@@ -46,7 +46,7 @@ static int collect_ipc_sem(void *data) ...@@ -46,7 +46,7 @@ static int collect_ipc_sem(void *data)
ret = semctl(0, 0, SEM_INFO, &info); ret = semctl(0, 0, SEM_INFO, &info);
if (ret < 0) if (ret < 0)
pr_err("semctl failed with %d\n", errno); pr_perror("semctl failed");
if (ret) { if (ret) {
pr_err("IPC semaphores migration is not supported yet\n"); pr_err("IPC semaphores migration is not supported yet\n");
...@@ -64,7 +64,7 @@ static int collect_ipc_shm(void *data) ...@@ -64,7 +64,7 @@ static int collect_ipc_shm(void *data)
ret = shmctl(0, IPC_INFO, &shmid); ret = shmctl(0, IPC_INFO, &shmid);
if (ret < 0) if (ret < 0)
pr_err("semctl failed with %d\n", errno); pr_perror("semctl failed");
if (ret) { if (ret) {
pr_err("IPC shared memory migration is not supported yet\n"); pr_err("IPC shared memory migration is not supported yet\n");
...@@ -83,12 +83,12 @@ static int read_ipc_sysctl_long(char *name, u64 *data, size_t size) ...@@ -83,12 +83,12 @@ static int read_ipc_sysctl_long(char *name, u64 *data, size_t size)
fd = open(name, O_RDONLY); fd = open(name, O_RDONLY);
if (fd < 0) { if (fd < 0) {
pr_err("Can't open %s\n", name); pr_perror("Can't open %s", name);
return fd; return fd;
} }
ret = read(fd, buf, 32); ret = read(fd, buf, 32);
if (ret < 0) { if (ret < 0) {
pr_err("Can't read %s\n", name); pr_perror("Can't read %s", name);
ret = -errno; ret = -errno;
goto err; goto err;
} }
...@@ -107,12 +107,12 @@ static int read_ipc_sysctl(char *name, u32 *data, size_t size) ...@@ -107,12 +107,12 @@ static int read_ipc_sysctl(char *name, u32 *data, size_t size)
fd = open(name, O_RDONLY); fd = open(name, O_RDONLY);
if (fd < 0) { if (fd < 0) {
pr_err("Can't open %s\n", name); pr_perror("Can't open %s", name);
return fd; return fd;
} }
ret = read(fd, buf, 32); ret = read(fd, buf, 32);
if (ret < 0) { if (ret < 0) {
pr_err("Can't read %s\n", name); pr_perror("Can't read %s", name);
ret = -errno; ret = -errno;
goto err; goto err;
} }
...@@ -132,12 +132,12 @@ static int read_ipc_sem(u32 sem[]) ...@@ -132,12 +132,12 @@ static int read_ipc_sem(u32 sem[])
fd = open(name, O_RDONLY); fd = open(name, O_RDONLY);
if (fd < 0) { if (fd < 0) {
pr_err("Can't open %s\n", name); pr_perror("Can't open %s", name);
return fd; return fd;
} }
ret = read(fd, buf, 128); ret = read(fd, buf, 128);
if (ret < 0) { if (ret < 0) {
pr_err("Can't read %s\n", name); pr_perror("Can't read %s", name);
ret = -errno; ret = -errno;
goto err; goto err;
} }
...@@ -320,13 +320,13 @@ static int write_ipc_sysctl_long(char *name, u64 *data) ...@@ -320,13 +320,13 @@ static int write_ipc_sysctl_long(char *name, u64 *data)
fd = open(name, O_WRONLY); fd = open(name, O_WRONLY);
if (fd < 0) { if (fd < 0) {
pr_err("Can't open %s\n", name); pr_perror("Can't open %s", name);
return fd; return fd;
} }
sprintf(buf, "%ld\n", *(long *)data); sprintf(buf, "%ld\n", *(long *)data);
ret = write(fd, buf, 32); ret = write(fd, buf, 32);
if (ret < 0) { if (ret < 0) {
pr_err("Can't write %s\n", name); pr_perror("Can't write %s", name);
ret = -errno; ret = -errno;
} }
close(fd); close(fd);
...@@ -342,13 +342,13 @@ static int write_ipc_sysctl(char *name, u32 *data) ...@@ -342,13 +342,13 @@ static int write_ipc_sysctl(char *name, u32 *data)
fd = open(name, O_WRONLY); fd = open(name, O_WRONLY);
if (fd < 0) { if (fd < 0) {
pr_err("Can't open %s\n", name); pr_perror("Can't open %s", name);
return fd; return fd;
} }
sprintf(buf, "%d\n", *(int *)data); sprintf(buf, "%d\n", *(int *)data);
ret = write(fd, buf, 32); ret = write(fd, buf, 32);
if (ret < 0) { if (ret < 0) {
pr_err("Can't write %s\n", name); pr_perror("Can't write %s", name);
ret = -errno; ret = -errno;
} }
close(fd); close(fd);
...@@ -364,13 +364,13 @@ static int write_ipc_sem(u32 sem[]) ...@@ -364,13 +364,13 @@ static int write_ipc_sem(u32 sem[])
fd = open(name, O_WRONLY); fd = open(name, O_WRONLY);
if (fd < 0) { if (fd < 0) {
pr_err("Can't open %s\n", name); pr_perror("Can't open %s", name);
return fd; return fd;
} }
sprintf(buf, "%d %d %d %d\n", sem[0], sem[1], sem[2], sem[3]); sprintf(buf, "%d %d %d %d\n", sem[0], sem[1], sem[2], sem[3]);
ret = write(fd, buf, 128); ret = write(fd, buf, 128);
if (ret < 0) { if (ret < 0) {
pr_err("Can't write %s: %d\n", name, errno); pr_perror("Can't write %s", name);
ret = -errno; ret = -errno;
} }
close(fd); close(fd);
......
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