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

  • SEARCH
  • Home
  • 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 8702335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:37:40+00:00 2026-06-13T02:37:40+00:00

I was trying to make a AIO practice via kernel AIO API . Here

  • 0

I was trying to make a AIO practice via kernel AIO API. Here is some code:

#define _GNU_SOURCE /* syscall() not POSIX */
#define ALIGN_SIZE 4096
#define RD_WR_SIZE 1024

/* ... */

/* Make the alignment according to page size to validate open() */
posix_memalign(&buf, ALIGN_SIZE, RD_WR_SIZE);
fd = open("aio_test_file", O_RDWR | O_CREAT | O_DIRECT, 0644);
if (fd == -1) {
    perror("open");
    return -1;
}
/* ... */

But my open() calling still fail:

open: Invalid argument

I have searched that error. Some of them says that you must make the alignment in the case of direct I/O. By using the command:

$ sudo dumpe2fs /dev/sda1 | grep -i "block size"

I got the block size is 4096. But why the open() calling still fail?

  • 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-06-13T02:37:41+00:00Added an answer on June 13, 2026 at 2:37 am

    From the man page:

    O_DIRECT support was added under Linux in kernel version 2.4.10. Older
    Linux kernels simply ignore this flag. Some file systems may not
    implement the flag and open() will fail with EINVAL if it is used.

    That would be my first guess.

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

Sidebar

Related Questions

Trying to make a simple jquery drop down here, here's my code so far:
Trying to make some small changes to Apache's Velocity engine. Here's what I can
Trying to make a small countdown timer in my app but it's not working.
I'm trying make a report which contains some prices on every row, and I
Trying to make td elements clickable. Here's my HTML: <td id=A3 class= open-square><a href=/gameplay/A3></a></td>
I'm trying make a simple control, with a some path in it. And binding
I'm trying make a <dl> to define the icons I am using on the
Trying to make this function dynamic instead of static. This was the original code
I am trying make a JSON call to a server using HttpClient API. The
I am trying make a request and get response from server. Here is my

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.