Skip to content

Commit

Permalink
libevent: define O_CLOEXEC for Guile 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
aconchillo committed Dec 18, 2022
1 parent 242fcc0 commit c744201
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion extensions/libevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@



#include <stdio.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <event2/event.h>
#include <libguile.h>

#if SCM_MAJOR_VERSION == 2
# include <fcntl.h> /* O_CLOEXEC */
#endif

struct event_data
{
int fd;
Expand Down Expand Up @@ -328,6 +335,11 @@ init_fibers_libevt (void)
scm_c_define ("EVWRITE", scm_from_int (EV_WRITE));
scm_c_define ("EVPERSIST", scm_from_int (EV_PERSIST));
scm_c_define ("EVCLOSED", scm_from_int (EV_CLOSED));

#if SCM_MAJOR_VERSION == 2
/* Guile 2.2.7 lacks a definition for O_CLOEXEC. */
scm_c_define ("O_CLOEXEC", scm_from_int (O_CLOEXEC));
#endif
}

/*
Expand Down

0 comments on commit c744201

Please sign in to comment.