If you can re-build tail, I wonder if this would help (in 
usr/src/cmd/tail/tail.c):


-                      if 
((file<http://grok.local/source/xref/illumos-gate/usr/src/cmd/tail/tail.c?r=339cc970f8a66bc88984fa70fdb4cbf93a9315ec#file>->fp<http://grok.local/source/xref/illumos-gate/usr/src/cmd/tail/tail.c?r=339cc970f8a66bc88984fa70fdb4cbf93a9315ec#fp>
 = 
fopen<http://grok.local/source/s?defs=fopen&project=illumos-gate>(file<http://grok.local/source/xref/illumos-gate/usr/src/cmd/tail/tail.c?r=339cc970f8a66bc88984fa70fdb4cbf93a9315ec#file>->file_name<http://grok.local/source/s?defs=file_name&project=illumos-gate>,
 "r")) == NULL<http://grok.local/source/s?defs=NULL&project=illumos-gate> ||

+                      if 
((file<http://grok.local/source/xref/illumos-gate/usr/src/cmd/tail/tail.c?r=339cc970f8a66bc88984fa70fdb4cbf93a9315ec#file>->fp<http://grok.local/source/xref/illumos-gate/usr/src/cmd/tail/tail.c?r=339cc970f8a66bc88984fa70fdb4cbf93a9315ec#fp>
 = 
fopen<http://grok.local/source/s?defs=fopen&project=illumos-gate>(file<http://grok.local/source/xref/illumos-gate/usr/src/cmd/tail/tail.c?r=339cc970f8a66bc88984fa70fdb4cbf93a9315ec#file>->file_name<http://grok.local/source/s?defs=file_name&project=illumos-gate>,
 "rF")) == NULL<http://grok.local/source/s?defs=NULL&project=illumos-gate> ||

It looks like it’s hitting the historic 32-bit stdio file limit. I didn’t look 
at everything in tail, but unless tail is doing some things it really shouldn’t 
be doing with the FILE struct, that should be fine.


From: Udo Grabowski (IMKASF) <[email protected]>
Date: Wednesday, October 22, 2025 at 4:39 AM
To: [email protected] <[email protected]>
Subject: [discuss] tail file descriptor limit
Hi,
it looks like tail's file descriptor caps off at 256 instead of
the set limit (here 1024). Limiting down to 128 and then consecutively
up confirms that. Hard limit is high up, no other limit in any of
the startup files.
Neither head or /usr/gnu/bin/tail have this limit. I cannot see anything
in the source code. truss shows that there is no close of the
file units up to 255; it could close the descriptors unless -f is
given.

# limit descriptors
descriptors  1024

# limit -h descriptors
descriptors  65536

# truss -f /usr/bin/tail output/test*.log
...
14130:  open64("test16a_2009_Jan_w3/output/test16a.log", O_RDONLY) = 255
14130:  fstat64(255, 0x0804354C)                        = 0

==> test16a_2009_Jan_w3/output/test16a.log <==
14130:  write(1, "\n = = >   t e s t 1 6 a".., 48)      = 48
14130:  mmap64(0x00000000, 661439, PROT_READ, MAP_SHARED, 255, 0) =
0xFED4D000
                            PGF :      2.0E+00
             elapsed time [s] = 24
       total elapsed time [s] = 14254
       ...done.

         Micro-Timestep 1 of  5
          building Jacobian matrix ff ...    done.

         Micro-Timestep 2 of  5
          building Jacobian matrix ff ...    done.
14130:  write(1, "                        ".., 288)     = 288
14130:  llseek(255, 661439, SEEK_SET)                   = 661439
14130:  munmap(0xFED4D000, 661439)                      = 0
14130:  ioctl(255, TCGETA, 0x0804338E)                  Err#25 ENOTTY
14130:  fstat64(255, 0x080433D0)                        = 0
14130:  brk(0x09FA96D0)                                 = 0
14130:  brk(0x09FC96D0)                                 = 0
14130:  fstat64(255, 0x080432D0)                        = 0
14130:  read(255, 0x09FA8994, 131072)                   = 0
14130:  open64("test16a_2009_Jan_w4/output/test16a.log", O_RDONLY) = 256
14130:  close(256)                                      = 0
14130:  ioctl(2, TCGETA, 0x0804257E)                    = 0
14130:  fstat64(2, 0x080424C0)                          = 0
tail14130:      write(2, " t a i l", 4)                         = 4
: 14130:        write(2, " :  ", 2)                             = 2
test16a_2009_Jan_w4/output/test16a.log14130:    write(2, " t e s t 1 6 a
_ 2 0 0 9".., 38)      = 38
:14130: write(2, " :", 1)                               = 1
   14130: write(2, "  ", 1)                               = 1
14130:  brk(0x09FC96D0)                                 = 0
14130:  brk(0x09FCB6D0)                                 = 0
14130:  open("/usr/share/locale/C/LC_MESSAGES/SUNW_OST_OSLIB.cat",
O_RDONLY) Err#2 ENOENT
14130:  open("/usr/lib/locale/C/LC_MESSAGES/SUNW_OST_OSLIB.mo",
O_RDONLY) Err#2 ENOENT
Too many open files14130:       write(2, " T o o   m a n y   o p e"..,
19)      = 19

14130:  write(2, "\n", 1)                               = 1
14130:  open64("test16a_2009_Jul_w1/output/test16a.log", O_RDONLY) = 256
14130:  close(256)                                      = 0
tail14130:      write(2, " t a i l", 4)                         = 4
: 14130:        write(2, " :  ", 2)                             = 2
test16a_2009_Jul_w1/output/test16a.log14130:    write(2, " t e s t 1 6 a
_ 2 0 0 9".., 38)      = 38
:14130: write(2, " :", 1)                               = 1
   14130: write(2, "  ", 1)                               = 1
14130:  sysconfig(_CONFIG_PAGESIZE)                     = 4096
Too many open files14130:       write(2, " T o o   m a n y   o p e"..,
19)      = 19
...

------------------------------------------
illumos: illumos-discuss
Permalink: 
https://illumos.topicbox.com/groups/discuss/T74fba5bf347a7c5f-Mbe974b83964d6375174b192b
Delivery options: https://illumos.topicbox.com/groups/discuss/subscription

Reply via email to