/[global]/global/libutil/env.c
ViewVC logotype

Diff of /global/libutil/env.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by shigio, Tue Oct 4 07:59:04 2005 UTC revision 1.12 by shigio, Mon Oct 24 17:11:57 2005 UTC
# Line 94  env_size(void) Line 94  env_size(void)
94    
95          return size;          return size;
96  }  }
   
 /*  
  * exec_line_limit: upper limit of bytes of exec line.  
  *  
  *      i)      length  command line length  
  *      r)      0: unknown or cannot afford long line.  
  *              > 0: upper limit of exec line  
  */  
 int  
 exec_line_limit(int length)  
 {  
         int limit = 0;  
   
 #ifdef ARG_MAX  
         /*  
          * POSIX.2 limits the exec(2) line length to ARG_MAX - 2048.  
          */  
         limit = ARG_MAX - 2048;  
         /*  
          * The reason is unknown but the xargs(1) in GNU findutils  
          * use this limit.  
          */  
         if (limit > 20 * 1024)  
                 limit = 20 * 1024;  
         /*  
          * Add the command line length.  
          * We estimates additional 80 bytes for popen(3) and space for  
          * the additional sort command.  
          *  
          * for "/bin/sh -c "                            11bytes  
          * for " | gnusort -k 1,1 -k 3,3 -k 2,2n"       32bytes  
          * reserve                                      37bytes  
          * ----------------------------------------------------  
          * Total                                        80 bytes  
          */  
         limit -= length + 80;  
   
         limit -= env_size();  
         if (limit < 0)  
                 limit = 0;  
 #endif  
         return limit;  
 }  

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26