Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ FREETYPEINC = /usr/include/freetype2
# OpenBSD (uncomment)
#FREETYPEINC = ${X11INC}/freetype2

# FREEBSD (uncomment)
#EPOLLLIBS= -lepoll-shim
#EPOLLINC = /usr/local/include/libepoll-shim

# yajl
YAJLLIBS = -lyajl
YAJLINC = /usr/include/yajl

# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC} -I${YAJLINC}
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} ${YAJLLIBS}
INCS = -I${X11INC} -I${FREETYPEINC} -I${YAJLINC} -I${EPOLLINC}
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} ${YAJLLIBS} ${EPOLLLIBS}

# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
Expand Down
12 changes: 6 additions & 6 deletions dwm-msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ write_socket(const void *buf, size_t count)
}

static void
connect_to_socket()
connect_to_socket(void)
{
struct sockaddr_un addr;

Expand Down Expand Up @@ -280,7 +280,7 @@ is_signed_int(const char *s)
}

static void
flush_socket_reply()
flush_socket_reply(void)
{
IPCMessageType reply_type;
uint32_t reply_size;
Expand All @@ -292,7 +292,7 @@ flush_socket_reply()
}

static void
print_socket_reply()
print_socket_reply(void)
{
IPCMessageType reply_type;
uint32_t reply_size;
Expand Down Expand Up @@ -352,15 +352,15 @@ run_command(const char *name, char *args[], int argc)
}

static int
get_monitors()
get_monitors(void)
{
send_message(IPC_TYPE_GET_MONITORS, 1, (uint8_t *)"");
print_socket_reply();
return 0;
}

static int
get_tags()
get_tags(void)
{
send_message(IPC_TYPE_GET_TAGS, 1, (uint8_t *)"");
print_socket_reply();
Expand All @@ -369,7 +369,7 @@ get_tags()
}

static int
get_layouts()
get_layouts(void)
{
send_message(IPC_TYPE_GET_LAYOUTS, 1, (uint8_t *)"");
print_socket_reply();
Expand Down
2 changes: 1 addition & 1 deletion dwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1963,7 +1963,7 @@ updatebarpos(Monitor *m)
}

void
updateclientlist()
updateclientlist(void)
{
Client *c;
Monitor *m;
Expand Down
31 changes: 25 additions & 6 deletions ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,26 @@ ipc_create_socket(const char *filename)
char *normal_filename;
char *parent;
const size_t addr_size = sizeof(struct sockaddr_un);
const int sock_type = SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC;
const int sock_type = SOCK_STREAM;
int sockfd = socket(AF_INET, sock_type, 0);
// Set the socket to non-blocking
int flags = fcntl(sockfd, F_GETFL, 0);
if (flags == -1) {
die("fctnl get");
}
if (fcntl(sockfd, F_SETFL, flags | O_NONBLOCK) == -1) {
die("fcntl set non-blocking");
}
// Set the socket to close-on-exec
flags = fcntl(sockfd, F_GETFD, 0);
if (flags == -1) {
die("fctnl get");
}
if (fcntl(sockfd, F_SETFD, flags | FD_CLOEXEC) == -1) {
die("fcntl set close-on-exec");
}



normalizepath(filename, &normal_filename);

Expand All @@ -53,11 +72,11 @@ ipc_create_socket(const char *filename)
mkdirp(parent);
free(parent);

sockaddr.sun_family = AF_LOCAL;
sockaddr.sun_family = AF_UNIX;
strcpy(sockaddr.sun_path, normal_filename);
free(normal_filename);

sock_fd = socket(AF_LOCAL, sock_type, 0);
sock_fd = socket(AF_UNIX, sock_type, 0);
if (sock_fd == -1) {
fputs("Failed to create socket\n", stderr);
return -1;
Expand Down Expand Up @@ -782,7 +801,7 @@ ipc_init(const char *socket_path, const int p_epoll_fd, IPCCommand commands[],
}

void
ipc_cleanup()
ipc_cleanup(void)
{
IPCClient *c = ipc_clients;
// Free clients and their buffers
Expand Down Expand Up @@ -810,7 +829,7 @@ ipc_cleanup()
}

int
ipc_get_sock_fd()
ipc_get_sock_fd(void)
{
return sock_fd;
}
Expand All @@ -828,7 +847,7 @@ ipc_is_client_registered(int fd)
}

int
ipc_accept_client()
ipc_accept_client(void)
{
int fd = -1;

Expand Down
6 changes: 3 additions & 3 deletions ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ int ipc_init(const char *socket_path, const int p_epoll_fd,
* Uninitialize the socket and module. Free allocated memory and restore static
* variables to their state before ipc_init
*/
void ipc_cleanup();
void ipc_cleanup(void);

/**
* Get the file descriptor of the IPC socket
*
* @return int File descriptor of IPC socket, -1 if socket not created.
*/
int ipc_get_sock_fd();
int ipc_get_sock_fd(void);

/**
* Get address to IPCClient with specified file descriptor
Expand Down Expand Up @@ -142,7 +142,7 @@ int ipc_drop_client(IPCClient *c);
*
* @return File descriptor of new client, -1 on error
*/
int ipc_accept_client();
int ipc_accept_client(void);

/**
* Read an incoming message from an accepted IPC client
Expand Down