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.5.7
[lttng-ust.git]
/
liblttng-ust
/
lttng-ust-comm.c
diff --git
a/liblttng-ust/lttng-ust-comm.c
b/liblttng-ust/lttng-ust-comm.c
index 049667bf298d2122ffb904fc554b96744eb0083f..a7398286104d75a776124181549c33d9bc40e02c 100644
(file)
--- a/
liblttng-ust/lttng-ust-comm.c
+++ b/
liblttng-ust/lttng-ust-comm.c
@@
-111,8
+111,15
@@
static int lttng_ust_comm_should_quit;
int ust_lock(void)
{
sigset_t sig_all_blocked, orig_mask;
int ust_lock(void)
{
sigset_t sig_all_blocked, orig_mask;
- int ret;
+ int ret
, oldstate
;
+ ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate);
+ if (ret) {
+ ERR("pthread_setcancelstate: %s", strerror(ret));
+ }
+ if (oldstate != PTHREAD_CANCEL_ENABLE) {
+ ERR("pthread_setcancelstate: unexpected oldstate");
+ }
sigfillset(&sig_all_blocked);
ret = pthread_sigmask(SIG_SETMASK, &sig_all_blocked, &orig_mask);
if (ret) {
sigfillset(&sig_all_blocked);
ret = pthread_sigmask(SIG_SETMASK, &sig_all_blocked, &orig_mask);
if (ret) {
@@
-140,8
+147,15
@@
int ust_lock(void)
void ust_lock_nocheck(void)
{
sigset_t sig_all_blocked, orig_mask;
void ust_lock_nocheck(void)
{
sigset_t sig_all_blocked, orig_mask;
- int ret;
+ int ret
, oldstate
;
+ ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate);
+ if (ret) {
+ ERR("pthread_setcancelstate: %s", strerror(ret));
+ }
+ if (oldstate != PTHREAD_CANCEL_ENABLE) {
+ ERR("pthread_setcancelstate: unexpected oldstate");
+ }
sigfillset(&sig_all_blocked);
ret = pthread_sigmask(SIG_SETMASK, &sig_all_blocked, &orig_mask);
if (ret) {
sigfillset(&sig_all_blocked);
ret = pthread_sigmask(SIG_SETMASK, &sig_all_blocked, &orig_mask);
if (ret) {
@@
-161,7
+175,7
@@
void ust_lock_nocheck(void)
void ust_unlock(void)
{
sigset_t sig_all_blocked, orig_mask;
void ust_unlock(void)
{
sigset_t sig_all_blocked, orig_mask;
- int ret;
+ int ret
, oldstate
;
sigfillset(&sig_all_blocked);
ret = pthread_sigmask(SIG_SETMASK, &sig_all_blocked, &orig_mask);
sigfillset(&sig_all_blocked);
ret = pthread_sigmask(SIG_SETMASK, &sig_all_blocked, &orig_mask);
@@
-174,6
+188,13
@@
void ust_unlock(void)
if (ret) {
ERR("pthread_sigmask: %s", strerror(ret));
}
if (ret) {
ERR("pthread_sigmask: %s", strerror(ret));
}
+ ret = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate);
+ if (ret) {
+ ERR("pthread_setcancelstate: %s", strerror(ret));
+ }
+ if (oldstate != PTHREAD_CANCEL_DISABLE) {
+ ERR("pthread_setcancelstate: unexpected oldstate");
+ }
}
/*
}
/*
@@
-552,13
+573,13
@@
int handle_message(struct sock_info *sock_info,
if (ust_lock()) {
ret = -LTTNG_UST_ERR_EXITING;
if (ust_lock()) {
ret = -LTTNG_UST_ERR_EXITING;
- goto e
nd
;
+ goto e
rror
;
}
ops = objd_ops(lum->handle);
if (!ops) {
ret = -ENOENT;
}
ops = objd_ops(lum->handle);
if (!ops) {
ret = -ENOENT;
- goto e
nd
;
+ goto e
rror
;
}
switch (lum->cmd) {
}
switch (lum->cmd) {
@@
-619,12
+640,12
@@
int handle_message(struct sock_info *sock_info,
}
ret = len;
free(bytecode);
}
ret = len;
free(bytecode);
- goto e
nd
;
+ goto e
rror
;
} else {
DBG("incorrect filter data message size: %zd", len);
ret = -EINVAL;
free(bytecode);
} else {
DBG("incorrect filter data message size: %zd", len);
ret = -EINVAL;
free(bytecode);
- goto e
nd
;
+ goto e
rror
;
}
}
bytecode->bc.len = lum->u.filter.data_size;
}
}
bytecode->bc.len = lum->u.filter.data_size;
@@
-684,12
+705,12
@@
int handle_message(struct sock_info *sock_info,
}
ret = len;
free(node);
}
ret = len;
free(node);
- goto e
nd
;
+ goto e
rror
;
} else {
DBG("Incorrect exclusion data message size: %zd", len);
ret = -EINVAL;
free(node);
} else {
DBG("Incorrect exclusion data message size: %zd", len);
ret = -EINVAL;
free(node);
- goto e
nd
;
+ goto e
rror
;
}
}
if (ops->cmd) {
}
}
if (ops->cmd) {
@@
-730,11
+751,11
@@
int handle_message(struct sock_info *sock_info,
goto error;
}
ret = len;
goto error;
}
ret = len;
- goto e
nd
;
+ goto e
rror
;
} else {
DBG("incorrect channel data message size: %zd", len);
ret = -EINVAL;
} else {
DBG("incorrect channel data message size: %zd", len);
ret = -EINVAL;
- goto e
nd
;
+ goto e
rror
;
}
}
args.channel.chan_data = chan_data;
}
}
args.channel.chan_data = chan_data;
@@
-755,7
+776,7
@@
int handle_message(struct sock_info *sock_info,
&args.stream.shm_fd,
&args.stream.wakeup_fd);
if (ret) {
&args.stream.shm_fd,
&args.stream.wakeup_fd);
if (ret) {
- goto e
nd
;
+ goto e
rror
;
}
if (ops->cmd)
ret = ops->cmd(lum->handle, lum->cmd,
}
if (ops->cmd)
ret = ops->cmd(lum->handle, lum->cmd,
@@
-775,7
+796,6
@@
int handle_message(struct sock_info *sock_info,
break;
}
break;
}
-end:
lur.handle = lum->handle;
lur.cmd = lum->cmd;
lur.ret_val = ret;
lur.handle = lum->handle;
lur.cmd = lum->cmd;
lur.ret_val = ret;
@@
-907,7
+927,12
@@
void cleanup_sock_info(struct sock_info *sock_info, int exiting)
long page_size;
page_size = sysconf(_SC_PAGE_SIZE);
long page_size;
page_size = sysconf(_SC_PAGE_SIZE);
- if (page_size > 0) {
+ if (page_size <= 0) {
+ if (!page_size) {
+ errno = EINVAL;
+ }
+ PERROR("Error in sysconf(_SC_PAGE_SIZE)");
+ } else {
ret = munmap(sock_info->wait_shm_mmap, page_size);
if (ret) {
ERR("Error unmapping wait shm");
ret = munmap(sock_info->wait_shm_mmap, page_size);
if (ret) {
ERR("Error unmapping wait shm");
@@
-1089,7
+1114,11
@@
char *get_map_shm(struct sock_info *sock_info)
char *wait_shm_mmap;
page_size = sysconf(_SC_PAGE_SIZE);
char *wait_shm_mmap;
page_size = sysconf(_SC_PAGE_SIZE);
- if (page_size < 0) {
+ if (page_size <= 0) {
+ if (!page_size) {
+ errno = EINVAL;
+ }
+ PERROR("Error in sysconf(_SC_PAGE_SIZE)");
goto error;
}
goto error;
}
@@
-1196,8
+1225,9
@@
restart:
* deals with a killed or broken session daemon.
*/
sleep(5);
* deals with a killed or broken session daemon.
*/
sleep(5);
+ } else {
+ has_waited = 1;
}
}
- has_waited = 1;
prev_connect_failed = 0;
}
prev_connect_failed = 0;
}
@@
-1376,7
+1406,13
@@
restart:
print_cmd(lum.cmd, lum.handle);
ret = handle_message(sock_info, sock, &lum);
if (ret) {
print_cmd(lum.cmd, lum.handle);
ret = handle_message(sock_info, sock, &lum);
if (ret) {
- ERR("Error handling message for %s socket", sock_info->name);
+ ERR("Error handling message for %s socket",
+ sock_info->name);
+ /*
+ * Close socket if protocol error is
+ * detected.
+ */
+ goto end;
}
continue;
default:
}
continue;
default:
This page took
0.027271 seconds
and
4
git commands to generate.