projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Version 2.11.1
[lttng-ust.git]
/
liblttng-ust-comm
/
lttng-ust-comm.c
diff --git
a/liblttng-ust-comm/lttng-ust-comm.c
b/liblttng-ust-comm/lttng-ust-comm.c
index 3d1c65038295062559db6dd415fe2b03304d5ec2..46f2e9e3343d0b36b45c919bf2755294fd281ff9 100644
(file)
--- a/
liblttng-ust-comm/lttng-ust-comm.c
+++ b/
liblttng-ust-comm/lttng-ust-comm.c
@@
-106,6
+106,7
@@
int ustcomm_connect_unix_sock(const char *pathname, long timeout)
/*
* libust threads require the close-on-exec flag for all
* resources so it does not leak file descriptors upon exec.
/*
* libust threads require the close-on-exec flag for all
* resources so it does not leak file descriptors upon exec.
+ * SOCK_CLOEXEC is not used since it is linux specific.
*/
fd = socket(PF_UNIX, SOCK_STREAM, 0);
if (fd < 0) {
*/
fd = socket(PF_UNIX, SOCK_STREAM, 0);
if (fd < 0) {
@@
-438,8
+439,6
@@
ssize_t ustcomm_send_fds_unix_sock(int sock, int *fds, size_t nb_fd)
/*
* Recv a message accompanied by fd(s) from a unix socket.
*
/*
* Recv a message accompanied by fd(s) from a unix socket.
*
- * Returns the size of received data, or negative error value.
- *
* Expect at most "nb_fd" file descriptors. Returns the number of fd
* actually received in nb_fd.
* Returns -EPIPE on orderly shutdown.
* Expect at most "nb_fd" file descriptors. Returns the number of fd
* actually received in nb_fd.
* Returns -EPIPE on orderly shutdown.
@@
-453,6
+452,7
@@
ssize_t ustcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd)
char recv_fd[CMSG_SPACE(sizeof_fds)];
struct msghdr msg;
char dummy;
char recv_fd[CMSG_SPACE(sizeof_fds)];
struct msghdr msg;
char dummy;
+ int i;
memset(&msg, 0, sizeof(msg));
memset(&msg, 0, sizeof(msg));
@@
-508,8
+508,19
@@
ssize_t ustcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd)
ret = -1;
goto end;
}
ret = -1;
goto end;
}
+
memcpy(fds, CMSG_DATA(cmsg), sizeof_fds);
memcpy(fds, CMSG_DATA(cmsg), sizeof_fds);
- ret = sizeof_fds;
+
+ /* Set FD_CLOEXEC */
+ for (i = 0; i < nb_fd; i++) {
+ ret = fcntl(fds[i], F_SETFD, FD_CLOEXEC);
+ if (ret < 0) {
+ PERROR("fcntl failed to set FD_CLOEXEC on fd %d",
+ fds[i]);
+ }
+ }
+
+ ret = nb_fd;
end:
return ret;
}
end:
return ret;
}
@@
-853,12
+864,15
@@
static
int serialize_integer_type(struct ustctl_integer_type *uit,
const struct lttng_integer_type *lit)
{
int serialize_integer_type(struct ustctl_integer_type *uit,
const struct lttng_integer_type *lit)
{
+ int32_t encoding;
+
uit->size = lit->size;
uit->signedness = lit->signedness;
uit->reverse_byte_order = lit->reverse_byte_order;
uit->base = lit->base;
uit->size = lit->size;
uit->signedness = lit->signedness;
uit->reverse_byte_order = lit->reverse_byte_order;
uit->base = lit->base;
- if (serialize_string_encoding(&
uit->
encoding, lit->encoding))
+ if (serialize_string_encoding(&encoding, lit->encoding))
return -EINVAL;
return -EINVAL;
+ uit->encoding = encoding;
uit->alignment = lit->alignment;
return 0;
}
uit->alignment = lit->alignment;
return 0;
}
@@
-880,9
+894,11
@@
int serialize_basic_type(struct lttng_session *session,
}
case atype_string:
{
}
case atype_string:
{
- if (serialize_string_encoding(&ubt->string.encoding,
- lbt->string.encoding))
+ int32_t encoding;
+
+ if (serialize_string_encoding(&encoding, lbt->string.encoding))
return -EINVAL;
return -EINVAL;
+ ubt->string.encoding = encoding;
*uatype = ustctl_atype_string;
break;
}
*uatype = ustctl_atype_string;
break;
}
@@
-911,8
+927,7
@@
int serialize_basic_type(struct lttng_session *session,
if (session) {
const struct lttng_enum *_enum;
if (session) {
const struct lttng_enum *_enum;
- _enum = lttng_ust_enum_get(session,
- lbt->enumeration.desc->name);
+ _enum = lttng_ust_enum_get_from_desc(session, lbt->enumeration.desc);
if (!_enum)
return -EINVAL;
ubt->enumeration.id = _enum->id;
if (!_enum)
return -EINVAL;
ubt->enumeration.id = _enum->id;
@@
-1008,13
+1023,15
@@
int serialize_one_field(struct lttng_session *session,
{
struct ustctl_field *uf = &fields[*iter_output];
struct ustctl_type *ut = &uf->type;
{
struct ustctl_field *uf = &fields[*iter_output];
struct ustctl_type *ut = &uf->type;
+ enum ustctl_abstract_types atype;
strncpy(uf->name, lf->name, LTTNG_UST_SYM_NAME_LEN);
uf->name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
strncpy(uf->name, lf->name, LTTNG_UST_SYM_NAME_LEN);
uf->name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
- ret = serialize_basic_type(session, &
ut->
atype, lt->atype,
+ ret = serialize_basic_type(session, &atype, lt->atype,
&ut->u.basic, <->u.basic);
if (ret)
return ret;
&ut->u.basic, <->u.basic);
if (ret)
return ret;
+ ut->atype = atype;
(*iter_output)++;
break;
}
(*iter_output)++;
break;
}
@@
-1024,6
+1041,7
@@
int serialize_one_field(struct lttng_session *session,
struct ustctl_type *ut = &uf->type;
struct ustctl_basic_type *ubt;
const struct lttng_basic_type *lbt;
struct ustctl_type *ut = &uf->type;
struct ustctl_basic_type *ubt;
const struct lttng_basic_type *lbt;
+ enum ustctl_abstract_types atype;
strncpy(uf->name, lf->name, LTTNG_UST_SYM_NAME_LEN);
uf->name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
strncpy(uf->name, lf->name, LTTNG_UST_SYM_NAME_LEN);
uf->name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
@@
-1031,10
+1049,11
@@
int serialize_one_field(struct lttng_session *session,
ubt = &ut->u.array.elem_type;
lbt = <->u.array.elem_type;
ut->u.array.length = lt->u.array.length;
ubt = &ut->u.array.elem_type;
lbt = <->u.array.elem_type;
ut->u.array.length = lt->u.array.length;
- ret = serialize_basic_type(session, &
ubt->
atype, lbt->atype,
+ ret = serialize_basic_type(session, &atype, lbt->atype,
&ubt->u.basic, &lbt->u.basic);
if (ret)
return -EINVAL;
&ubt->u.basic, &lbt->u.basic);
if (ret)
return -EINVAL;
+ ubt->atype = atype;
ut->atype = ustctl_atype_array;
(*iter_output)++;
break;
ut->atype = ustctl_atype_array;
(*iter_output)++;
break;
@@
-1045,6
+1064,7
@@
int serialize_one_field(struct lttng_session *session,
struct ustctl_type *ut = &uf->type;
struct ustctl_basic_type *ubt;
const struct lttng_basic_type *lbt;
struct ustctl_type *ut = &uf->type;
struct ustctl_basic_type *ubt;
const struct lttng_basic_type *lbt;
+ enum ustctl_abstract_types atype;
int ret;
strncpy(uf->name, lf->name, LTTNG_UST_SYM_NAME_LEN);
int ret;
strncpy(uf->name, lf->name, LTTNG_UST_SYM_NAME_LEN);
@@
-1052,16
+1072,18
@@
int serialize_one_field(struct lttng_session *session,
uf->type.atype = ustctl_atype_sequence;
ubt = &ut->u.sequence.length_type;
lbt = <->u.sequence.length_type;
uf->type.atype = ustctl_atype_sequence;
ubt = &ut->u.sequence.length_type;
lbt = <->u.sequence.length_type;
- ret = serialize_basic_type(session, &
ubt->
atype, lbt->atype,
+ ret = serialize_basic_type(session, &atype, lbt->atype,
&ubt->u.basic, &lbt->u.basic);
if (ret)
return -EINVAL;
&ubt->u.basic, &lbt->u.basic);
if (ret)
return -EINVAL;
+ ubt->atype = atype;
ubt = &ut->u.sequence.elem_type;
lbt = <->u.sequence.elem_type;
ubt = &ut->u.sequence.elem_type;
lbt = <->u.sequence.elem_type;
- ret = serialize_basic_type(session, &
ubt->
atype, lbt->atype,
+ ret = serialize_basic_type(session, &atype, lbt->atype,
&ubt->u.basic, &lbt->u.basic);
if (ret)
return -EINVAL;
&ubt->u.basic, &lbt->u.basic);
if (ret)
return -EINVAL;
+ ubt->atype = atype;
ut->atype = ustctl_atype_sequence;
(*iter_output)++;
break;
ut->atype = ustctl_atype_sequence;
(*iter_output)++;
break;
This page took
0.025798 seconds
and
4
git commands to generate.