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 9062073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:38:40+00:00 2026-06-16T15:38:40+00:00

OPEN_MAX is the constant that defines the maximum number of open files allowed for

  • 0

OPEN_MAX is the constant that defines the maximum number of open files allowed for a single program.

According to Beginning Linux Programming 4th Edition, Page 101 :

The limit, usually defined by the constant OPEN_MAX in limits.h, varies from system to system, …

In my system, the file limits.h in directory /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed does not have this constant. Am i looking at the wrong limits.h or has the location of OPEN_MAX changed since 2008 ?

  • 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-16T15:38:43+00:00Added an answer on June 16, 2026 at 3:38 pm

    For what it’s worth, the 4th edition of Beginning Linux Programming was published in 2007; parts of it may be a bit out of date. (That’s not a criticism of the book, which I haven’t read.)

    It appears that OPEN_MAX is deprecated, at least on Linux systems. The reason appears to be that the maximum number of file that can be opened simultaneously is not fixed, so a macro that expands to an integer literal is not a good way to get that information.

    There’s another macro FOPEN_MAX that should be similar; I can’t think of a reason why OPEN_MAX and FOPEN_MAX, if they’re both defined, should have different values. But FOPEN_MAX is mandated by the C language standard, so system’s don’t have the option of not defining it. The C standard says that FOPEN_MAX

    expands to an integer constant expression that is the minimum number of files that
    the implementation guarantees can be open simultaneously

    (If the word “minimum” is confusing, it’s a guarantee that a program can open at least that many files at once.)

    If you want the current maximum number of files that can be opened, take a look at the sysconf() function; on my system, sysconf(_SC_OPEN_MAX) returns 1024. (The sysconf() man page refers to a symbol OPEN_MAX. This is not a count, but a value recognized by sysconf(). And it’s not defined on my system.)

    I’ve searched for OPEN_MAX (word match, so excluding FOPEN_MAX) on my Ubuntu system, and found the following (these are obviously just brief excerpts):

    /usr/include/X11/Xos.h:

    # ifdef __GNU__
    #  define PATH_MAX 4096
    #  define MAXPATHLEN 4096
    #  define OPEN_MAX 256 /* We define a reasonable limit.  */
    # endif
    

    /usr/include/i386-linux-gnu/bits/local_lim.h:

    /* The kernel header pollutes the namespace with the NR_OPEN symbol
       and defines LINK_MAX although filesystems have different maxima.  A
       similar thing is true for OPEN_MAX: the limit can be changed at
       runtime and therefore the macro must not be defined.  Remove this
       after including the header if necessary.  */  
    #ifndef NR_OPEN
    # define __undef_NR_OPEN
    #endif
    #ifndef LINK_MAX
    # define __undef_LINK_MAX
    #endif
    #ifndef OPEN_MAX
    # define __undef_OPEN_MAX
    #endif
    #ifndef ARG_MAX
    # define __undef_ARG_MAX
    #endif
    

    /usr/include/i386-linux-gnu/bits/xopen_lim.h:

    /* We do not provide fixed values for 
    
       ARG_MAX      Maximum length of argument to the `exec' function
                    including environment data.
    
       ATEXIT_MAX   Maximum number of functions that may be registered
                    with `atexit'.
    
       CHILD_MAX    Maximum number of simultaneous processes per real
                    user ID. 
    
       OPEN_MAX     Maximum number of files that one process can have open
                    at anyone time.
    
       PAGESIZE
       PAGE_SIZE    Size of bytes of a page.
    
       PASS_MAX     Maximum number of significant bytes in a password.
    
       We only provide a fixed limit for
    
       IOV_MAX      Maximum number of `iovec' structures that one process has
                    available for use with `readv' or writev'.
    
       if this is indeed fixed by the underlying system.
    */
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program which set the number of file handle open to unlimited
When open a query in Microsoft project, the start date changes. Please note that,
I open several files in Vim by, for example, running vim a/*.php which opens
The default limit for the max open files on Mac OS X is 256
Is it possible to increase Max open files parameter for working process ? I
I'm working on an open-source project, and there is an hash_table that I need
I have an admin site that I need to open up to more admins.
Open High Low Close Volume Adj Close Date 1990-01-02 00:00:00 35.25 37.50 35.00 37.25
Open Ankh seems to be using Subversion 1.6.2 and Tortoise uses Subversion 1.6.0. After
open message box and long click on a message , as you can see

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.