Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4123148
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:34:27+00:00 2026-05-20T23:34:27+00:00

I worked with libevent2 for some time, but usually I used it to handle

  • 0

I worked with libevent2 for some time, but usually I used it to handle network I/O (using sockets). Now I need to read many different files so I also wanted to use it. I created this code:

int file = open(filename, O_RDONLY);
struct event *ev_file_read = event_new(ev_base, file, EV_READ | EV_PERSIST, read_file, NULL);

if(event_add(ev_file_read, NULL))
        error("adding file event");

Unfortunately it doesn’t work. I get this message when trying to add event:

[warn] Epoll ADD(1) on fd 7 failed. Old events were 0; read change was 1 (add); write change was 0 (none): Operation not permitted
adding file event: Operation not permitted

The file exists and has rights to read/write.

Anyone has any idea how to handle file IO using libevent? I thought also about bufferred events, but in API there’s only function bufferevent_socket_new() which doesn’t apply here.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:34:28+00:00Added an answer on May 20, 2026 at 11:34 pm

    I needed libevent to read many files regarding priorities. The problem was in epoll not in libevent. Epoll doesn’t support regular Unix files.

    To solve it I forced libevent not to use epoll:

        struct event_config *cfg = event_config_new();
    
    event_config_avoid_method(cfg, "epoll");
    
    ev_base = event_base_new_with_config(cfg);  
        event_config_free(cfg);
    

    Next method on the preference list was poll, which fully support files just as I wanted to.

    Thank you all for answers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I worked with ESRI shapefile format right now and i have some problem with
Having worked with Classic ASP for about 2 years now by creating a few
I've worked on a variety of systems as a programmer, some with Oracle, some
Having worked for Java for 7 years I'm now moving into a project in
I worked for a friend's project in VS 2008. Now I upgraded it to
I worked on an embedded system this summer written in straight C. It was
I worked for a company that had both Java and .NET implementations of an
I have worked for 5 years mainly in java desktop applications accessing Oracle databases
I've worked on a number of database systems in the past where moving entries
I once worked with an architect who banned the use of SQL views. His

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.