ap.h文件的分析

原创 2006年06月16日 23:26:00

API_EXPORT(char *) ap_cpystrn(char *, const char *, size_t);
int ap_slack(int, int);
int ap_execle(const char *, const char *, ...);
int ap_execve(const char *, const char *argv[], const char *envp[]);

/* small utility macros to make things easier to read */

#ifdef WIN32
#define ap_killpg(x, y)
#else
#ifdef NO_KILLPG
#define ap_killpg(x, y)  (kill (-(x), (y)))
#else
#define ap_killpg(x, y)  (killpg ((x), (y)))
#endif
#endif /* WIN32 */

/* ap_vformatter() is a generic printf-style formatting routine
 * with some extensions.  The extensions are:
 *
 * %pA takes a struct in_addr *, and prints it as a.b.c.d
 * %pI takes a struct sockaddr_in * and prints it as a.b.c.d:port
 * %pp  takes a void * and outputs it in hex
 *
 * The %p hacks are to force gcc's printf warning code to skip
 * over a pointer argument without complaining.  This does
 * mean that the ANSI-style %p (output a void * in hex format) won't
 * work as expected at all, but that seems to be a fair trade-off
 * for the increased robustness of having printf-warnings work.
 *
 * Additionally, ap_vformatter allows for arbitrary output methods
 * using the ap_vformatter_buff and flush_func.
 *
 * The ap_vformatter_buff has two elements curpos and endpos.
 * curpos is where ap_vformatter will write the next byte of output.
 * It proceeds writing output to curpos, and updating curpos, until
 * either the end of output is reached, or curpos == endpos (i.e. the
 * buffer is full).
 *
 * If the end of output is reached, ap_vformatter returns the
 * number of bytes written.
 *
 * When the buffer is full, the flush_func is called.  The flush_func
 * can return -1 to indicate that no further output should be attempted,
 * and ap_vformatter will return immediately with -1.  Otherwise
 * the flush_func should flush the buffer in whatever manner is
 * appropriate, re-initialize curpos and endpos, and return 0.
 *
 * Note that flush_func is only invoked as a result of attempting to
 * write another byte at curpos when curpos >= endpos.  So for
 * example, it's possible when the output exactly matches the buffer
 * space available that curpos == endpos will be true when
 * ap_vformatter returns.
 *
 * ap_vformatter does not call out to any other code, it is entirely
 * self-contained.  This allows the callers to do things which are
 * otherwise "unsafe".  For example, ap_psprintf uses the "scratch"
 * space at the unallocated end of a block, and doesn't actually
 * complete the allocation until ap_vformatter returns.  ap_psprintf
 * would be completely broken if ap_vformatter were to call anything
 * that used a pool.  Similarly http_bprintf() uses the "scratch"
 * space at the end of its output buffer, and doesn't actually note
 * that the space is in use until it either has to flush the buffer
 * or until ap_vformatter returns.
 */

typedef struct {
    char *curpos;
    char *endpos;
} ap_vformatter_buff;

API_EXPORT(int) ap_vformatter(int (*flush_func)(ap_vformatter_buff *),
    ap_vformatter_buff *, const char *fmt, va_list ap);

/* These are snprintf implementations based on ap_vformatter().
 *
 * Note that various standards and implementations disagree on the return
 * value of snprintf, and side-effects due to %n in the formatting string.
 * ap_snprintf behaves as follows:
 *
 * Process the format string until the entire string is exhausted, or
 * the buffer fills.  If the buffer fills then stop processing immediately
 * (so no further %n arguments are processed), and return the buffer
 * length.  In all cases the buffer is NUL terminated.
 *
 * In no event does ap_snprintf return a negative number.  It's not possible
 * to distinguish between an output which was truncated, and an output which
 * exactly filled the buffer.
 */
API_EXPORT(int) ap_snprintf(char *buf, size_t len, const char *format,...)
       __attribute__((format(printf,3,4)));
API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format,
        va_list ap);

 

这个文件比较独立,它包含的NO_KILLPG宏定义在ap_config.h中

API_EXPORT也定义在ap_config.h中

DUMP文件分析2:一个最简单的DUMP分析示例

本节开始,我将在示例中给大家讲述基本的DUMP文件分析方法。读者应该对Windows系统比较了解,同时比较熟悉Windbg。 本节的示例非常简单,也非常经典,就是常常会遇到的访问空指针。Window...
  • hustd10
  • hustd10
  • 2016年07月30日 21:53
  • 7250

如何分析Windows的dump文件 (usermode篇)

Windows的dump文件一般分为两种,一种是usermode的dump,比如一些应用程序崩溃之后生成的dump文件,另外一种是kernelmode的dump,比如一些驱动出错导致的蓝屏之后生成的d...
  • llnatalie
  • llnatalie
  • 2014年01月28日 16:04
  • 2041

Oracle-trace文件分析

如果一个系统的执行效率比较低,一个比较好的方法是通过跟踪用户的会话并且使用tkprof工具使用排序功能格式化输出,从而找出有问题的SQL语句。 例如首先从os上利用top命令找到当前占用cpu资源最...
  • boer521314
  • boer521314
  • 2015年09月25日 16:43
  • 1905

H5 开发ap 框架PhoneGap(cordova)的应用详解

PhoneGap是一套能让你使用HTML5轻松调用本地API接口和发布应用到商店的应用开发平台。官方说有低成本,低开发周期,轻量化等优点,这些咱暂时也没法证明,略过不表。但是有一条跨平台,却是很明显的...
  • u013378306
  • u013378306
  • 2017年02月10日 11:16
  • 783

ap百米波讯9341刷爱快h1编程器固件

  • 2017年12月11日 20:24
  • 8MB
  • 下载

H3CWA1205E-AP

  • 2013年09月29日 10:47
  • 586KB
  • 下载

ZXHN H560N 300Mbps Mini Wireless-N AP

  • 2016年02月09日 06:31
  • 32.89MB
  • 下载

Linux源码List.h文件详细分析(链表、队列、堆栈、哈希表等)

  • 2017年11月15日 21:55
  • 62KB
  • 下载

Linux Kernel 之AP读写Nand Flash上的Yaffs2文件的全过程浅析

1.1                   用top-down的方法分析AP读一个Nand Flash上的file的全过程 我先简单看一个例子,看User Application如何打开一个Y...
  • u011461299
  • u011461299
  • 2013年08月21日 21:24
  • 1478

H3C WA3600系列无线局域网接入点胖ap文件(20131128厂家发布)

  • 2015年06月25日 17:20
  • 10.81MB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:ap.h文件的分析
举报原因:
原因补充:

(最多只允许输入30个字)