There is 256 file descriptors limition for fopen(32 bits) under solaris.
Even worse these files descriptions has to be [0,255].
which means if you use open first than fopen, you get even less available file
descriptions for fopen. It is common for a server has more than 256 file
descrptions.
So I would think using open instead of fopen for solaris.

Here is the code I found 
"basic_file.cc" line 250 of 362 --69%--

 __basic_file<char>*
  __basic_file<char>::open(const char* __name, ios_base::openmode __mode,
                           int /*__prot*/)
  {
    __basic_file* __ret = NULL;
    const char* __c_mode = __gnu_internal::fopen_mode(__mode);
    if (__c_mode && !this->is_open())
      {
#ifdef _GLIBCXX_USE_LFS
        if ((_M_cfile = fopen64(__name, __c_mode)))
#else
        if ((_M_cfile = fopen(__name, __c_mode)))  /// file description limited
to <256
#endif
          {
            _M_cfile_created = true;
            __ret = this;
          }
      }
    return __ret;
  }

Thanks,


-- 
           Summary: fstream is using fopen underly for 32b applictaions
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zhong dot xie at yahoo dot ca
 GCC build triplet: solaris
  GCC host triplet: solaris
GCC target triplet: solaris


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27198

Reply via email to