`
jinghuainfo
  • 浏览: 1526169 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Argument list too long从何而来

 
阅读更多

转载时请注明出处和作者联系方式
文章出处:http://www.limodev.cn/blog
作者联系方式:李先静 <xianjimli at hotmail dot com>

这两天在Android eclair版本上增加WML浏览功能,以前在cupcake版本(broncho a1)上实现过,技术上倒是没有什么难题,但编译时总是出现Argument list too long的错误。WebKit里源文件太多,没有WML时还可以编译过去,但加上了WML之后,命令行参数确实很长了,ar后面跟的参数大概都有几百K。奇怪的是,在终端单独运行ar没有问题,但是在Makefile里就是不行。

先尝试去改Android.mk,把它分成几个静态库来编译,但老是编译不过去,试一次要很长时间,真的很烦。后来只好尝试去找出这个长度限制在哪里:

1.这个错误是glibc打出来,所以先到glibc里去找Argument list too long对应错误码。在sysdeps/gnu/errlist.c找到这样一行代码:



很明显,错误码就是E2BIG。

2.错误码应该是exec系统调用返回的,于是到内核里去查找返回E2BIG的代码,在exec.c里找到几处:


这是对参数个数的限制,MAX_ARG_STRINGS的定义为:

#define MAX_ARG_STRINGS 0x7FFFFFFF

这个值已经大得吓人了,不可能是参数个数超出了。

另外一处是:


valid_arg_len是用来限制单个参数长度的,PC上肯定是定义了CONFIG_MMU的,所以单个参数的长度应该是MAX_ARG_STRLEN,即:

#define MAX_ARG_STRLEN (PAGE_SIZE * 32)

对于4K的page大小来说,单个参数长度限制是128K, 这也够大了。不过如果前面所说的整个ar命令,在Makefile里被当作一个参数的话,那肯定是超长了。这可以解释在终端单独运行ar没有问题,在 Makefile调用不行的疑问。回头再研究一下Makefile里是怎么调用的吧。

分享到:
评论

相关推荐

    Laravel 5.4中migrate报错: Specified key was too long error的解决

    但方便的同时也会伴随着一些问题,下面这篇文章将详细给大家介绍关于Laravel5.4中migrate报错Specified key was too long error的解决方法,下面话不多说了,来一起看看详细的介绍吧。 发现问题 Laravel 5.4默认使用...

    Linux操作系统错误代码解释_中英文对照

    OS error code 0: ...OS error code 7: Argument list too long 操作系统错误代码7:参数列表太长 OS error code 8: Exec format error 操作系统错误代码8:执行格式错误 OS error code 9: Bad file descriptor 操

    Linux删除文件不同方法效率对比

    测试一下Linux下面删除大量文件的效率。 首先建立50万个文件 ...zsh: argument list too long: rm rm -f * 3.63s user 0.29s system 98% cpu 3.985 total 由于文件数量过多,rm不起作用。 2. fin

    linux删除大量文件的6种方法

    首先建立50万个文件 代码如下:test for i in $(seq 1 500000)for&gt; ... yzsh: argument list too long: rmrm -f * 3.63s user 0.29s system 98% cpu 3.985 total 由于文件数量过多,rm不起作用。 2 find 代码如下: 

    C++出错提示英汉对照表

    Argument list syntax error ----------------参数表语法错误 Array bounds missing ------------------丢失数组界限符 Array size toolarge -----------------数组尺寸太大 Bad character in paramenters ------...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    (One exception is if an argument Foo or const Foo& has a non-explicit, one-argument constructor, in which case we need the full definition to support automatic type conversion.) We can declare ...

    雷达技术知识

    LIST OF FIGURES Figure Page 1. Return Factor vs. LiDAR Scan Angle 2 2. Angle of Incidence 3 3. Wave Action Relationship to LiDAR Echo 3 4. Site Map 11 5. Annual Hydrograph of Sandy River 13 6. Oregon ...

    servlet2.4doc

    The default behavior of this method is to call addDateHeader(String name, long date) on the wrapped response object. addDateHeader(String, long) - Method in interface javax.servlet....

    Java邮件开发Fundamentals of the JavaMail API

    downloading and unbundling pop31_1_1.zip, add pop3.jar to your CLASSPATH, too. After installing JavaMail 1.1.3, install the JavaBeans Activation Framework. Installing the JavaBeans Activation ...

    unix power tools

    Table of Contents 1. Introduction....................................................................................................................................................2 ...

    EurekaLog_7.5.0.0_Enterprise

    1)....Fixed: Long startup time on terminal services servers EurekaLog 7.3 (7.3.0.0), 24-September-2015 1)....Added: RAD Studio 10 Seattle support 2)....Added: Performance counters for run-time ...

    php.ini-development

    ;;;;;;;;... 1.... 2.... 3.... 4.... 5.... 6.... The syntax of the file is extremely simple.... Section headers (e.g.... at runtime.... There is no name validation.... (e.g.... previously set variable or directive (e.g....

    微软内部资料-SQL性能优化5

    The data pages in the table are kept in a doubly linked list called the page chain. The order of pages in the page chain, and the order of rows on the data pages, is the order of the index key or ...

Global site tag (gtag.js) - Google Analytics