diff options
-rw-r--r-- | tools/hv/hv_kvp_daemon.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index d55ce4040b74..ca9fa4d32e07 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c | |||
@@ -127,7 +127,8 @@ static void kvp_acquire_lock(int pool) | |||
127 | fl.l_pid = getpid(); | 127 | fl.l_pid = getpid(); |
128 | 128 | ||
129 | if (fcntl(kvp_file_info[pool].fd, F_SETLKW, &fl) == -1) { | 129 | if (fcntl(kvp_file_info[pool].fd, F_SETLKW, &fl) == -1) { |
130 | syslog(LOG_ERR, "Failed to acquire the lock pool: %d", pool); | 130 | syslog(LOG_ERR, "Failed to acquire the lock pool: %d; error: %d %s", pool, |
131 | errno, strerror(errno)); | ||
131 | exit(EXIT_FAILURE); | 132 | exit(EXIT_FAILURE); |
132 | } | 133 | } |
133 | } | 134 | } |
@@ -138,8 +139,8 @@ static void kvp_release_lock(int pool) | |||
138 | fl.l_pid = getpid(); | 139 | fl.l_pid = getpid(); |
139 | 140 | ||
140 | if (fcntl(kvp_file_info[pool].fd, F_SETLK, &fl) == -1) { | 141 | if (fcntl(kvp_file_info[pool].fd, F_SETLK, &fl) == -1) { |
141 | perror("fcntl"); | 142 | syslog(LOG_ERR, "Failed to release the lock pool: %d; error: %d %s", pool, |
142 | syslog(LOG_ERR, "Failed to release the lock pool: %d", pool); | 143 | errno, strerror(errno)); |
143 | exit(EXIT_FAILURE); | 144 | exit(EXIT_FAILURE); |
144 | } | 145 | } |
145 | } | 146 | } |
@@ -157,8 +158,9 @@ static void kvp_update_file(int pool) | |||
157 | 158 | ||
158 | filep = fopen(kvp_file_info[pool].fname, "we"); | 159 | filep = fopen(kvp_file_info[pool].fname, "we"); |
159 | if (!filep) { | 160 | if (!filep) { |
161 | syslog(LOG_ERR, "Failed to open file, pool: %d; error: %d %s", pool, | ||
162 | errno, strerror(errno)); | ||
160 | kvp_release_lock(pool); | 163 | kvp_release_lock(pool); |
161 | syslog(LOG_ERR, "Failed to open file, pool: %d", pool); | ||
162 | exit(EXIT_FAILURE); | 164 | exit(EXIT_FAILURE); |
163 | } | 165 | } |
164 | 166 | ||
@@ -188,8 +190,9 @@ static void kvp_update_mem_state(int pool) | |||
188 | 190 | ||
189 | filep = fopen(kvp_file_info[pool].fname, "re"); | 191 | filep = fopen(kvp_file_info[pool].fname, "re"); |
190 | if (!filep) { | 192 | if (!filep) { |
193 | syslog(LOG_ERR, "Failed to open file, pool: %d; error: %d %s", pool, | ||
194 | errno, strerror(errno)); | ||
191 | kvp_release_lock(pool); | 195 | kvp_release_lock(pool); |
192 | syslog(LOG_ERR, "Failed to open file, pool: %d", pool); | ||
193 | exit(EXIT_FAILURE); | 196 | exit(EXIT_FAILURE); |
194 | } | 197 | } |
195 | for (;;) { | 198 | for (;;) { |
@@ -240,7 +243,8 @@ static int kvp_file_init(void) | |||
240 | 243 | ||
241 | if (access(KVP_CONFIG_LOC, F_OK)) { | 244 | if (access(KVP_CONFIG_LOC, F_OK)) { |
242 | if (mkdir(KVP_CONFIG_LOC, 0755 /* rwxr-xr-x */)) { | 245 | if (mkdir(KVP_CONFIG_LOC, 0755 /* rwxr-xr-x */)) { |
243 | syslog(LOG_ERR, " Failed to create %s", KVP_CONFIG_LOC); | 246 | syslog(LOG_ERR, "Failed to create '%s'; error: %d %s", KVP_CONFIG_LOC, |
247 | errno, strerror(errno)); | ||
244 | exit(EXIT_FAILURE); | 248 | exit(EXIT_FAILURE); |
245 | } | 249 | } |
246 | } | 250 | } |
@@ -1280,7 +1284,8 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) | |||
1280 | file = fopen(if_file, "w"); | 1284 | file = fopen(if_file, "w"); |
1281 | 1285 | ||
1282 | if (file == NULL) { | 1286 | if (file == NULL) { |
1283 | syslog(LOG_ERR, "Failed to open config file"); | 1287 | syslog(LOG_ERR, "Failed to open config file; error: %d %s", |
1288 | errno, strerror(errno)); | ||
1284 | return HV_E_FAIL; | 1289 | return HV_E_FAIL; |
1285 | } | 1290 | } |
1286 | 1291 | ||
@@ -1447,7 +1452,8 @@ int main(void) | |||
1447 | 1452 | ||
1448 | fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); | 1453 | fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); |
1449 | if (fd < 0) { | 1454 | if (fd < 0) { |
1450 | syslog(LOG_ERR, "netlink socket creation failed; error:%d", fd); | 1455 | syslog(LOG_ERR, "netlink socket creation failed; error: %d %s", errno, |
1456 | strerror(errno)); | ||
1451 | exit(EXIT_FAILURE); | 1457 | exit(EXIT_FAILURE); |
1452 | } | 1458 | } |
1453 | addr.nl_family = AF_NETLINK; | 1459 | addr.nl_family = AF_NETLINK; |
@@ -1458,7 +1464,7 @@ int main(void) | |||
1458 | 1464 | ||
1459 | error = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); | 1465 | error = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); |
1460 | if (error < 0) { | 1466 | if (error < 0) { |
1461 | syslog(LOG_ERR, "bind failed; error:%d", error); | 1467 | syslog(LOG_ERR, "bind failed; error: %d %s", errno, strerror(errno)); |
1462 | close(fd); | 1468 | close(fd); |
1463 | exit(EXIT_FAILURE); | 1469 | exit(EXIT_FAILURE); |
1464 | } | 1470 | } |
@@ -1484,7 +1490,7 @@ int main(void) | |||
1484 | 1490 | ||
1485 | len = netlink_send(fd, message); | 1491 | len = netlink_send(fd, message); |
1486 | if (len < 0) { | 1492 | if (len < 0) { |
1487 | syslog(LOG_ERR, "netlink_send failed; error:%d", len); | 1493 | syslog(LOG_ERR, "netlink_send failed; error: %d %s", errno, strerror(errno)); |
1488 | close(fd); | 1494 | close(fd); |
1489 | exit(EXIT_FAILURE); | 1495 | exit(EXIT_FAILURE); |
1490 | } | 1496 | } |
@@ -1716,7 +1722,8 @@ kvp_done: | |||
1716 | 1722 | ||
1717 | len = netlink_send(fd, incoming_cn_msg); | 1723 | len = netlink_send(fd, incoming_cn_msg); |
1718 | if (len < 0) { | 1724 | if (len < 0) { |
1719 | syslog(LOG_ERR, "net_link send failed; error:%d", len); | 1725 | syslog(LOG_ERR, "net_link send failed; error: %d %s", errno, |
1726 | strerror(errno)); | ||
1720 | exit(EXIT_FAILURE); | 1727 | exit(EXIT_FAILURE); |
1721 | } | 1728 | } |
1722 | } | 1729 | } |