* copied. It then notifies the afs process that the callback function \a f
* should be executed by sending the shared memory identifier (shmid) to the
* socket.
-
+ *
* If the callback produces a result, it sends any number of shared memory
* identifiers back via the socket. For each such identifier received, \a
* result_handler is called. The contents of the sma identified by the received
if (ret < 0)
goto out;
- *(uint32_t *) buf = afs_socket_cookie;
- *(int *) (buf + sizeof(afs_socket_cookie)) = query_shmid;
+ *(uint32_t *)buf = afs_socket_cookie;
+ *(int *)(buf + sizeof(afs_socket_cookie)) = query_shmid;
ret = connect_local_socket(conf.afs_socket_arg);
if (ret < 0)
activate_mood_or_playlist(NULL, &num_admissible);
}
} else
- ret2 = para_printf(&pb, "activated %s (%d admissible files)\n", current_mop?
- current_mop : "dummy mood", num_admissible);
+ ret2 = para_printf(&pb, "activated %s (%d admissible files)\n",
+ current_mop? current_mop : "dummy mood",
+ num_admissible);
out:
if (ret2 >= 0 && pb.offset)
pass_buffer_as_shm(fd, SBD_OUTPUT, pb.buf, pb.offset);
{
int ret, socket_fd;
char *socket_name = conf.afs_socket_arg;
- struct sockaddr_un unix_addr;
unlink(socket_name);
- ret = create_local_socket(socket_name, &unix_addr,
- S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IWOTH);
+ ret = create_local_socket(socket_name, 0);
if (ret < 0) {
- PARA_EMERG_LOG("%s: %s\n", para_strerror(-ret), socket_name);
- exit(EXIT_FAILURE);
+ ret = create_local_socket(socket_name,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IWOTH);
+ if (ret < 0) {
+ PARA_EMERG_LOG("%s: %s\n", para_strerror(-ret),
+ socket_name);
+ exit(EXIT_FAILURE);
+ }
}
socket_fd = ret;
- if (listen(socket_fd , 5) < 0) {
- PARA_EMERG_LOG("can not listen on socket\n");
- exit(EXIT_FAILURE);
- }
- ret = mark_fd_nonblocking(socket_fd);
- if (ret < 0) {
- close(socket_fd);
- return ret;
- }
PARA_INFO_LOG("listening on socket %s (fd %d)\n", socket_name,
socket_fd);
return socket_fd;