#include <sys/socket.h>
#include <ust-comm.h>
+#include <lttng/ust-error.h>
#include <../../libringbuffer/backend.h>
#include <../../libringbuffer/frontend.h>
#include "../../liblttng-ust/compat.h" /* For ENODATA */
}
k++;
}
- if (ret == -ENOENT)
+ if (ret == -LTTNG_UST_ERR_NOENT)
break;
if (ret)
return ret;
int update_futex(int fd, int active)
{
- size_t mmap_size = sysconf(_SC_PAGE_SIZE);
+ long page_size;
char *wait_shm_mmap;
int ret;
- wait_shm_mmap = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE,
+ page_size = sysconf(_SC_PAGE_SIZE);
+ if (page_size <= 0) {
+ if (!page_size) {
+ errno = EINVAL;
+ }
+ perror("Error in sysconf(_SC_PAGE_SIZE)");
+ goto error;
+ }
+ wait_shm_mmap = mmap(NULL, page_size, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0);
if (wait_shm_mmap == MAP_FAILED) {
perror("mmap");
if (active) {
uatomic_set((int32_t *) wait_shm_mmap, 1);
- futex_async((int32_t *) wait_shm_mmap, FUTEX_WAKE,
- INT_MAX, NULL, NULL, 0);
+ if (futex_async((int32_t *) wait_shm_mmap, FUTEX_WAKE,
+ INT_MAX, NULL, NULL, 0) < 0) {
+ perror("futex_async");
+ goto error;
+ }
} else {
uatomic_set((int32_t *) wait_shm_mmap, 0);
}
- ret = munmap(wait_shm_mmap, mmap_size);
+ ret = munmap(wait_shm_mmap, page_size);
if (ret) {
perror("Error unmapping wait shm");
goto error;
int ret, wait_shm_fd;
struct sigaction act;
mode_t old_umask = 0;
+ long page_size;
set_ulimit();
return -1;
}
+ page_size = sysconf(_SC_PAGE_SIZE);
+ if (page_size <= 0) {
+ if (!page_size) {
+ errno = EINVAL;
+ }
+ perror("Error in sysconf(_SC_PAGE_SIZE)");
+ return -1;
+ }
+
if (geteuid() == 0) {
ret = mkdir(LTTNG_RUNDIR, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
if (ret && errno != EEXIST) {
return -1;
}
wait_shm_fd = get_wait_shm(DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH,
- sysconf(_SC_PAGE_SIZE), 1);
+ page_size, 1);
if (wait_shm_fd < 0) {
perror("global wait shm error");
return -1;
snprintf(local_apps_wait_shm_path, PATH_MAX,
DEFAULT_HOME_APPS_WAIT_SHM_PATH, getuid());
wait_shm_fd = get_wait_shm(local_apps_wait_shm_path,
- sysconf(_SC_PAGE_SIZE), 0);
+ page_size, 0);
if (wait_shm_fd < 0) {
perror("local wait shm error");
return -1;
pid_t ppid;
uid_t uid;
gid_t gid;
+ uint32_t bits_per_long;
char name[16]; /* Process name */
} reg_msg;
char bufname[17];
ret = system(cmd);
if (ret < 0) {
printf("Unable to clean %s\n", home_rundir);
+ return -1;
}
}