<commit_before>#include "pink_epoll.h"
#include "pink_define.h"
#include "xdebug.h"
#include "status.h"
#include <linux/version.h>
#include <fcntl.h>

namespace pink {

PinkEpoll::PinkEpoll()
{
#if defined(RHEL_MAJOR)
  #if RHEL_MAJOR == 6
    epfd_ = epoll_create1(EPOLL_CLOEXEC);
  #else
    epfd_ = epoll_create(1024);
    fcntl(epfd_, F_SETFD, fcntl(epfd_, F_GETFD) | FD_CLOEXEC);
  #endif
#endif

  if (epfd_ < 0) {
    log_err("epoll create fail");
    exit(1);
  }
  events_ = (struct epoll_event *)malloc(sizeof(struct epoll_event) * PINK_MAX_CLIENTS);
  if (!events_) {
    log_err("init epoll_event error");
  }
  timeout_ = 1000;

  firedevent_ = (PinkFiredEvent *)malloc(sizeof(PinkFiredEvent) * PINK_MAX_CLIENTS);
}
<commit_msg>bugfix: compatible with epoll_wait and epoll_wait1, use EPOLL_CLOEXEC<commit_after>#include "pink_epoll.h"
#include "pink_define.h"
#include "xdebug.h"
#include "status.h"
#include <linux/version.h>
#include <fcntl.h>

namespace pink {

PinkEpoll::PinkEpoll()
{
#if defined(EPOLL_CLOEXEC)
    epfd_ = epoll_create1(EPOLL_CLOEXEC);
#else
    epfd_ = epoll_create(1024);
    fcntl(epfd_, F_SETFD, fcntl(epfd_, F_GETFD) | FD_CLOEXEC);
#endif

  if (epfd_ < 0) {
    log_err("epoll create fail");
    exit(1);
  }
  events_ = (struct epoll_event *)malloc(sizeof(struct epoll_event) * PINK_MAX_CLIENTS);
  if (!events_) {
    log_err("init epoll_event error");
  }
  timeout_ = 1000;

  firedevent_ = (PinkFiredEvent *)malloc(sizeof(PinkFiredEvent) * PINK_MAX_CLIENTS);
}

{'fraction_non_alphanumeric': 0.13925729442970822, 'fraction_numerical': 0.015915119363395226, 'mean_word_length': 4.9644268774703555, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1155072', 'n_tokens_mistral': 657, 'n_tokens_neox': 635, 'n_words': 115}