projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
usttrace: add comments to describe start sequence of ustd
[lttng-ust.git]
/
libustcomm
/
ustcomm.c
diff --git
a/libustcomm/ustcomm.c
b/libustcomm/ustcomm.c
index 3b53471ac6d69c81acd1379351d985b9b8ed177b..2bd86eb728442c2713f74cd24a30766706d731c8 100644
(file)
--- a/
libustcomm/ustcomm.c
+++ b/
libustcomm/ustcomm.c
@@
-31,7
+31,7
@@
#include <execinfo.h>
#include "ustcomm.h"
#include <execinfo.h>
#include "ustcomm.h"
-#include "
local
err.h"
+#include "
ust
err.h"
#define UNIX_PATH_MAX 108
#define UNIX_PATH_MAX 108
@@
-67,29
+67,18
@@
char *strdup_malloc(const char *s)
static int signal_process(pid_t pid)
{
static int signal_process(pid_t pid)
{
- int result;
-
- result = kill(pid, UST_SIGNAL);
- if(result == -1) {
- PERROR("kill");
- return -1;
- }
-
- /* FIXME: should wait in a better way */
- //sleep(1);
-
return 0;
}
int pid_is_online(pid_t pid) {
return 0;
}
int pid_is_online(pid_t pid) {
- return
kill(pid, UST_SIGNAL) != -
1;
+ return 1;
}
static int send_message_fd(int fd, const char *msg)
{
int result;
}
static int send_message_fd(int fd, const char *msg)
{
int result;
- result = send(fd, msg, strlen(msg),
0
);
+ result = send(fd, msg, strlen(msg),
MSG_NOSIGNAL
);
if(result == -1) {
PERROR("send");
return -1;
if(result == -1) {
PERROR("send");
return -1;
@@
-390,13
+379,24
@@
static int init_named_socket(const char *name, char **path_out)
return -1;
}
return -1;
}
+/*
+ * Return value:
+ * 0: Success, but no reply because recv() returned 0
+ * 1: Success
+ * -1: Error
+ *
+ * On error, the error message is printed, except on
+ * ECONNRESET, which is normal when the application dies.
+ */
+
int ustcomm_send_request(struct ustcomm_connection *conn, const char *req, char **reply)
{
int result;
int ustcomm_send_request(struct ustcomm_connection *conn, const char *req, char **reply)
{
int result;
- result = send(conn->fd, req, strlen(req),
0
);
+ result = send(conn->fd, req, strlen(req),
MSG_NOSIGNAL
);
if(result == -1) {
if(result == -1) {
- PERROR("send");
+ if(errno != EPIPE)
+ PERROR("send");
return -1;
}
return -1;
}
@@
-406,7
+406,8
@@
int ustcomm_send_request(struct ustcomm_connection *conn, const char *req, char
*reply = (char *) malloc(MSG_MAX+1);
result = recv(conn->fd, *reply, MSG_MAX, 0);
if(result == -1) {
*reply = (char *) malloc(MSG_MAX+1);
result = recv(conn->fd, *reply, MSG_MAX, 0);
if(result == -1) {
- PERROR("recv");
+ if(errno != ECONNRESET)
+ PERROR("recv");
return -1;
}
else if(result == 0) {
return -1;
}
else if(result == 0) {
@@
-494,7
+495,7
@@
int ustcomm_init_app(pid_t pid, struct ustcomm_app *handle)
handle->server.listen_fd = init_named_socket(name, &(handle->server.socketpath));
if(handle->server.listen_fd < 0) {
handle->server.listen_fd = init_named_socket(name, &(handle->server.socketpath));
if(handle->server.listen_fd < 0) {
- ERR("
error initializing named socket"
);
+ ERR("
Error initializing named socket (%s). Check that directory exists and that it is writable.", name
);
goto free_name;
}
free(name);
goto free_name;
}
free(name);
@@
-545,7
+546,6
@@
void ustcomm_fini_app(struct ustcomm_app *handle)
struct stat st;
/* Destroy socket */
struct stat st;
/* Destroy socket */
- ERR("socket path is: %s", handle->server.socketpath);
result = stat(handle->server.socketpath, &st);
if(result == -1) {
PERROR("stat (%s)", handle->server.socketpath);
result = stat(handle->server.socketpath, &st);
if(result == -1) {
PERROR("stat (%s)", handle->server.socketpath);
This page took
0.026312 seconds
and
4
git commands to generate.