<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: select and maxfiles e maxfiles_lim in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984687#M543563</link>
    <description>&lt;!--!*#--&gt;Sorry, if I dare participate though I am not a systems programmer.&lt;BR /&gt;But doesn't the manpage demonstrate how the user is supposed to raise the upper bound for file descriptor sets in the given sample snippet and its comments?&lt;BR /&gt;&lt;BR /&gt;&lt;MAN_2_SELECT_SNIPPET&gt;&lt;BR /&gt;&lt;BR /&gt;      The FD_SETSIZE is used in the definition of fd_set structure.  It is&lt;BR /&gt;      set to a value of 2048 to accommodate 2048 file descriptors.  Any user&lt;BR /&gt;      code that uses FD_SETSIZE or the structure fd_set should redefine&lt;BR /&gt;      FD_SETSIZE to a smaller value (greater than or equal to the number of&lt;BR /&gt;      open files the process will have) in order to save space. Similarly,&lt;BR /&gt;      any user code that wants to test more than 2048 file descriptors&lt;BR /&gt;      should redefine FD_SETSIZE to the required higher value.&lt;BR /&gt;&lt;BR /&gt;      The user can also allocate the space for fd_set structure dynamically,&lt;BR /&gt;      depending upon the number of file descriptors to be tested. The&lt;BR /&gt;      following code segment illustrates the basic concepts.&lt;BR /&gt;&lt;BR /&gt;                int num_of_fds,s;&lt;BR /&gt;                struct fd_set *f;&lt;BR /&gt;&lt;BR /&gt;                /*&lt;BR /&gt;                 * Set num_of_fds to the required value.&lt;BR /&gt;                 * User can set it to the maximum possible value the kernel is&lt;BR /&gt;                 * configured for, by using sysconf(_SC_OPEN_MAX).&lt;BR /&gt;                 * Note that, if you are not using these many files, you are&lt;BR /&gt;                 * wasting too much space.&lt;BR /&gt;                 */&lt;BR /&gt;                num_of_fds = sysconf(_SC_OPEN_MAX);&lt;BR /&gt;                s = sizeof(long);&lt;BR /&gt;                /*&lt;BR /&gt;                 * howmany is a macro defined in sys/types.h&lt;BR /&gt;                 */&lt;BR /&gt;                f = (struct fd_set *)malloc(s*howmany(num_of_fds, s*8);&lt;BR /&gt;                /*&lt;BR /&gt;                 * Use f wherever struct fd_set * is used.&lt;BR /&gt;                 * It can be used to test num_of_fds file descriptors.&lt;BR /&gt;                 */&lt;BR /&gt;&lt;BR /&gt;&lt;/MAN_2_SELECT_SNIPPET&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Maybe this comment in /usr/include/sys/_fd_macros.h&lt;BR /&gt;also may help?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/*&lt;BR /&gt; * FD_SETSIZE may be defined by the user, but must be &amp;gt;= u.u_highestfd + 1.&lt;BR /&gt; * Since we know the absolute limit for the number of per process open files is&lt;BR /&gt; * MAXFUPLIM, we need to define FD_SETSIZE to be large enough to accomodate&lt;BR /&gt; * this many file descriptors.  Unless the user has this many files opened, he&lt;BR /&gt; * should redefine FD_SETSIZE to a smaller number.&lt;BR /&gt; */&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 20 Apr 2007 08:54:22 GMT</pubDate>
    <dc:creator>Ralph Grothe</dc:creator>
    <dc:date>2007-04-20T08:54:22Z</dc:date>
    <item>
      <title>select and maxfiles e maxfiles_lim</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984682#M543558</link>
      <description>Hi,&lt;BR /&gt;in the HP-UX 11i OS, I've a process that perform a select routine that make an error.&lt;BR /&gt;The errno is EBADF.&lt;BR /&gt;&lt;BR /&gt;This error happens with the change of kernel parameter maxfiles e maxfiles_lim from 2048 to 5500.&lt;BR /&gt;&lt;BR /&gt;The select is:&lt;BR /&gt;&lt;BR /&gt;select(max_fd, &amp;amp;fdProcSet, NULL, NULL, &amp;amp;poll_time)&lt;BR /&gt;&lt;BR /&gt;where max_fd is value from getlimit:&lt;BR /&gt;&lt;BR /&gt;struct rlimit rl;&lt;BR /&gt;rl.rlim_max = 0;&lt;BR /&gt;&lt;BR /&gt;getrlimit(RLIMIT_NOFILE, &amp;amp;rl);&lt;BR /&gt;max_fd = rl.rlim_max;&lt;BR /&gt;&lt;BR /&gt;and fdProcSet is:&lt;BR /&gt;&lt;BR /&gt;fd_set fdProcSet&lt;BR /&gt;&lt;BR /&gt;Can You help me?&lt;BR /&gt;Thanks.</description>
      <pubDate>Thu, 19 Apr 2007 05:30:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984682#M543558</guid>
      <dc:creator>Benedetto Mangiapane</dc:creator>
      <dc:date>2007-04-19T05:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: select and maxfiles e maxfiles_lim</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984683#M543559</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;Several parameters may require adjustment.&lt;BR /&gt;&lt;BR /&gt;maxfiles                  256  -  256&lt;BR /&gt;maxfiles_lim             2048  Y  2048&lt;BR /&gt;nfile                    4096  -  4096&lt;BR /&gt;maxuprc&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 19 Apr 2007 06:11:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984683#M543559</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2007-04-19T06:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: select and maxfiles e maxfiles_lim</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984684#M543560</link>
      <description>Hi,&lt;BR /&gt;the kernel parameter is:&lt;BR /&gt;&lt;BR /&gt;maxfiles              5500  -  5500&lt;BR /&gt;maxfiles_lim          5500  Y  5500&lt;BR /&gt;nfile                 63488  -  (15*NPROC+2048)&lt;BR /&gt;maxuprc               3686  Y  ((NPROC*9)/10)&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Thu, 19 Apr 2007 07:17:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984684#M543560</guid>
      <dc:creator>Benedetto Mangiapane</dc:creator>
      <dc:date>2007-04-19T07:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: select and maxfiles e maxfiles_lim</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984685#M543561</link>
      <description>There are three current-ish versions of "11i" - which one are you using?&lt;BR /&gt;&lt;BR /&gt;Manpages can be your friend - from the 11.11 (11iv1) manpage:&lt;BR /&gt;&lt;BR /&gt;           [EBADF]        One or more of the file descriptor sets specified                    a file descriptor that is not a valid open file descriptor. This could happen either if the file descriptor sets are not initialized or nfds argument is greater than FD_SETSIZE.&lt;BR /&gt;&lt;BR /&gt;So, either the FD you passed isn't open, or you went beyond FD_SETSIZE.  I would suggest printing FD_SETSIZE from your program and also running it under a verbose tusc trace to see exactly what FDs are being set in the fd_sets for the call.  That may require havint tusc show both syscall entry and exit.</description>
      <pubDate>Thu, 19 Apr 2007 20:05:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984685#M543561</guid>
      <dc:creator>rick jones</dc:creator>
      <dc:date>2007-04-19T20:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: select and maxfiles e maxfiles_lim</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984686#M543562</link>
      <description>In the man pages of select(2) routine, I read that FD_SETSIZE is 2048. It can be set to 5500. This is not possible via kernel parameter maxfiles or maxfiles_lim.&lt;BR /&gt;&lt;BR /&gt;This is the problem!&lt;BR /&gt;&lt;BR /&gt;Therefore, increasing the parameter of the kernel, is necessary to remember itself of set the FD_SETSIZE value.&lt;BR /&gt;&lt;BR /&gt;It's right?</description>
      <pubDate>Fri, 20 Apr 2007 05:37:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984686#M543562</guid>
      <dc:creator>Benedetto Mangiapane</dc:creator>
      <dc:date>2007-04-20T05:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: select and maxfiles e maxfiles_lim</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984687#M543563</link>
      <description>&lt;!--!*#--&gt;Sorry, if I dare participate though I am not a systems programmer.&lt;BR /&gt;But doesn't the manpage demonstrate how the user is supposed to raise the upper bound for file descriptor sets in the given sample snippet and its comments?&lt;BR /&gt;&lt;BR /&gt;&lt;MAN_2_SELECT_SNIPPET&gt;&lt;BR /&gt;&lt;BR /&gt;      The FD_SETSIZE is used in the definition of fd_set structure.  It is&lt;BR /&gt;      set to a value of 2048 to accommodate 2048 file descriptors.  Any user&lt;BR /&gt;      code that uses FD_SETSIZE or the structure fd_set should redefine&lt;BR /&gt;      FD_SETSIZE to a smaller value (greater than or equal to the number of&lt;BR /&gt;      open files the process will have) in order to save space. Similarly,&lt;BR /&gt;      any user code that wants to test more than 2048 file descriptors&lt;BR /&gt;      should redefine FD_SETSIZE to the required higher value.&lt;BR /&gt;&lt;BR /&gt;      The user can also allocate the space for fd_set structure dynamically,&lt;BR /&gt;      depending upon the number of file descriptors to be tested. The&lt;BR /&gt;      following code segment illustrates the basic concepts.&lt;BR /&gt;&lt;BR /&gt;                int num_of_fds,s;&lt;BR /&gt;                struct fd_set *f;&lt;BR /&gt;&lt;BR /&gt;                /*&lt;BR /&gt;                 * Set num_of_fds to the required value.&lt;BR /&gt;                 * User can set it to the maximum possible value the kernel is&lt;BR /&gt;                 * configured for, by using sysconf(_SC_OPEN_MAX).&lt;BR /&gt;                 * Note that, if you are not using these many files, you are&lt;BR /&gt;                 * wasting too much space.&lt;BR /&gt;                 */&lt;BR /&gt;                num_of_fds = sysconf(_SC_OPEN_MAX);&lt;BR /&gt;                s = sizeof(long);&lt;BR /&gt;                /*&lt;BR /&gt;                 * howmany is a macro defined in sys/types.h&lt;BR /&gt;                 */&lt;BR /&gt;                f = (struct fd_set *)malloc(s*howmany(num_of_fds, s*8);&lt;BR /&gt;                /*&lt;BR /&gt;                 * Use f wherever struct fd_set * is used.&lt;BR /&gt;                 * It can be used to test num_of_fds file descriptors.&lt;BR /&gt;                 */&lt;BR /&gt;&lt;BR /&gt;&lt;/MAN_2_SELECT_SNIPPET&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Maybe this comment in /usr/include/sys/_fd_macros.h&lt;BR /&gt;also may help?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/*&lt;BR /&gt; * FD_SETSIZE may be defined by the user, but must be &amp;gt;= u.u_highestfd + 1.&lt;BR /&gt; * Since we know the absolute limit for the number of per process open files is&lt;BR /&gt; * MAXFUPLIM, we need to define FD_SETSIZE to be large enough to accomodate&lt;BR /&gt; * this many file descriptors.  Unless the user has this many files opened, he&lt;BR /&gt; * should redefine FD_SETSIZE to a smaller number.&lt;BR /&gt; */&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Apr 2007 08:54:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984687#M543563</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2007-04-20T08:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: select and maxfiles e maxfiles_lim</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984688#M543564</link>
      <description>Could you attach the source code of the routine (if it's not too big) that's causing the error. From your post it is hard to glean the context of the issue and trouble shoot it.&lt;BR /&gt;&lt;BR /&gt;~thanks</description>
      <pubDate>Fri, 20 Apr 2007 09:07:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/select-and-maxfiles-e-maxfiles-lim/m-p/3984688#M543564</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-04-20T09:07:33Z</dc:date>
    </item>
  </channel>
</rss>

