Minors fixes to the macOS compat code to build with a C++ compiler
following the conversion of the binaries.
Change-Id: Ic879d56d0025c838d5a34b0b45d02bae02a12053
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
- ptr = realloc(array->events, new_size * sizeof(*ptr));
+ ptr = (struct pollfd *) realloc(array->events, new_size * sizeof(*ptr));
if (ptr == NULL) {
PERROR("realloc epoll add");
goto error;
if (ptr == NULL) {
PERROR("realloc epoll add");
goto error;
wait = &events->wait;
/* This *must* be freed by using lttng_poll_free() */
wait = &events->wait;
/* This *must* be freed by using lttng_poll_free() */
- wait->events = zmalloc(size * sizeof(struct pollfd));
+ wait->events = (struct pollfd *) zmalloc(size * sizeof(struct pollfd));
if (wait->events == NULL) {
PERROR("zmalloc struct pollfd");
goto error;
if (wait->events == NULL) {
PERROR("zmalloc struct pollfd");
goto error;
wait->alloc_size = wait->init_size = size;
wait->alloc_size = wait->init_size = size;
- current->events = zmalloc(size * sizeof(struct pollfd));
+ current->events = (struct pollfd *) zmalloc(size * sizeof(struct pollfd));
if (current->events == NULL) {
PERROR("zmalloc struct current pollfd");
goto error;
if (current->events == NULL) {
PERROR("zmalloc struct current pollfd");
goto error;
static inline
int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid)
{
static inline
int lttng_get_unix_socket_peer_pid(int socket_fd, pid_t *pid)
{
+ socklen_t pid_len = (socklen_t) sizeof(*pid);
+
/* The getsockopt LOCAL_PEERPID option is available since macOS 10.8. */
/* The getsockopt LOCAL_PEERPID option is available since macOS 10.8. */
- return getsockopt(socket_fd, SOL_LOCAL, LOCAL_PEERPID, pid,
- &((socklen_t) {sizeof(*pid)}));
+ return getsockopt(socket_fd, SOL_LOCAL, LOCAL_PEERPID, pid, &pid_len);
.flags = flags,
.mode = {
.is_set = !!mode,
.flags = flags,
.mode = {
.is_set = !!mode,
- .value = mode ? *mode : 0,
+ .value = static_cast<mode_t>(mode ? *mode : 0),