From 928bfe5c0949ade1403a88a123fd990fce5795c4 Mon Sep 17 00:00:00 2001 From: leitner Date: Thu, 3 Jun 2010 22:46:59 +0000 Subject: [PATCH] for installed header files, add comment saying where they came from --- array.h | 9 ++++++++- array/array_get.c | 4 ++-- buffer.h | 1 + byte.h | 1 + case.h | 1 + cdb.h | 1 + cdb_make.h | 1 + dns.h | 1 + errmsg.h | 1 + fmt.h | 1 + iarray.h | 1 + io.h | 3 +++ io_internal.h | 15 +++++++++++++++ iob.h | 1 + iopause.h1 | 1 + iopause.h2 | 1 + ip4.h | 1 + ip6.h | 1 + mmap.h | 1 + ndelay.h | 1 + open.h | 1 + openreadclose.h | 1 + rangecheck.h | 1 + safemult.h | 1 + scan.h | 1 + socket.h | 1 + str.h | 1 + stralloc.h | 1 + tai.h | 1 + taia.h | 1 + textcode.h | 1 + uint16.h | 1 + uint32.h | 1 + uint64.h | 1 + va_narg.h | 1 + 35 files changed, 59 insertions(+), 3 deletions(-) diff --git a/array.h b/array.h index 953ce14..a2bec14 100644 --- a/array.h +++ b/array.h @@ -1,6 +1,8 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef ARRAY_H #define ARRAY_H +#include #include "uint64.h" typedef struct { @@ -11,10 +13,12 @@ typedef struct { /* p and allocated nonzero: array is allocated */ /* p and allocated zero: array is unallocated */ /* p zero and allocated < 0: array is failed */ + + size_t headroom; /* the actual pointer for free() and realloc() is p-headroom */ } array; void* array_allocate(array* x,uint64 membersize,int64 pos); -void* array_get(array* x,uint64 membersize,int64 pos); +void* array_get(const array* const x,uint64 membersize,int64 pos); void* array_start(const array* const x); int64 array_length(const array* const x,uint64 membersize); int64 array_bytes(const array* const x); @@ -30,6 +34,9 @@ void array_cats0(array* to,const char* from); void array_cat0(array* to); void array_cate(array* to,const array* const from,int64 pos,int64 stop); +void array_shift(array* x,uint64 membersize,uint64 members); +void array_chop(array* x,uint64 membersize,uint64 members); + #define array_failed(x) (array_bytes(x)==-1) #define array_unallocated(x) (array_bytes(x)==0) diff --git a/array/array_get.c b/array/array_get.c index dce1c63..d1e25a5 100644 --- a/array/array_get.c +++ b/array/array_get.c @@ -15,11 +15,11 @@ (pos+1)*sizeof(t) bytes are initialized. #endif -void* array_get(array* x,uint64 membersize,int64 pos) { +void* array_get(const array* const x,uint64 membersize,int64 pos) { uint64 wanted; if (__unlikely(pos+1<1)) return 0; if (__unlikely(!umult64(membersize,pos,&wanted))) return 0; if (__unlikely((int64)wanted >= x->allocated || wanted>=x->initialized)) return 0; - return x->p+pos*membersize; + return (void*)(x->p+pos*membersize); } diff --git a/buffer.h b/buffer.h index a60b497..ce1b895 100644 --- a/buffer.h +++ b/buffer.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef BUFFER_H #define BUFFER_H diff --git a/byte.h b/byte.h index 43e03c5..4f93815 100644 --- a/byte.h +++ b/byte.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef BYTE_H #define BYTE_H diff --git a/case.h b/case.h index 5019477..77676ca 100644 --- a/case.h +++ b/case.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef CASE_H #define CASE_H diff --git a/cdb.h b/cdb.h index ba01ef8..4135a20 100644 --- a/cdb.h +++ b/cdb.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef CDB_H #define CDB_H diff --git a/cdb_make.h b/cdb_make.h index 4919f92..5baf90e 100644 --- a/cdb_make.h +++ b/cdb_make.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef CDB_MAKE_H #define CDB_MAKE_H diff --git a/dns.h b/dns.h index 391f5d6..90c3514 100644 --- a/dns.h +++ b/dns.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef DNS_H #define DNS_H diff --git a/errmsg.h b/errmsg.h index 92862d1..575f1d5 100644 --- a/errmsg.h +++ b/errmsg.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef ERRMSG_H #define ERRMSG_H diff --git a/fmt.h b/fmt.h index 2ecaf0c..91b65e3 100644 --- a/fmt.h +++ b/fmt.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef FMT_H #define FMT_H diff --git a/iarray.h b/iarray.h index 870fc80..2066858 100644 --- a/iarray.h +++ b/iarray.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef IARRAY_H #define IARRAY_H diff --git a/io.h b/io.h index 780f34a..5b78793 100644 --- a/io.h +++ b/io.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef IO_H #define IO_H @@ -103,6 +104,8 @@ int io_passfd(int64 sock,int64 fd); * process. Return sock if ok, -1 on error, setting errno. */ int64 io_receivefd(int64 sock); +int io_starteventloopthread(unsigned int threads); + typedef int64 (*io_write_callback)(int64 s,const void* buf,uint64 n); /* used internally, but hey, who knows */ diff --git a/io_internal.h b/io_internal.h index ce19fe3..eea698a 100644 --- a/io_internal.h +++ b/io_internal.h @@ -50,6 +50,9 @@ typedef struct { #endif } io_entry; +extern int io_multithreaded; +extern int io_sockets[2]; + my_extern array io_fds; my_extern uint64 io_wanted_fds; my_extern array io_pollfds; @@ -92,4 +95,16 @@ int64 io_waituntil2(int64 milliseconds); void io_sigpipe(void); +/* return next descriptor from io_wait that can be read from */ +int64 io_canread_unlocked(); +/* return next descriptor from io_wait that can be written to */ +int64 io_canwrite_unlocked(); +/* return next descriptor with expired timeout */ +int64 io_timeouted_unlocked(); + +struct eventpacket { + int fd; + enum { CANREAD, CANWRITE, TIMEOUT } what; +}; + #define debug_printf(x) diff --git a/iob.h b/iob.h index 1a37635..8983b05 100644 --- a/iob.h +++ b/iob.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef _IOB_H #define _IOB_H diff --git a/iopause.h1 b/iopause.h1 index dae0a33..3e2b3ce 100644 --- a/iopause.h1 +++ b/iopause.h1 @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef IOPAUSE_H #define IOPAUSE_H diff --git a/iopause.h2 b/iopause.h2 index 4347f01..54a3323 100644 --- a/iopause.h2 +++ b/iopause.h2 @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef IOPAUSE_H #define IOPAUSE_H diff --git a/ip4.h b/ip4.h index e313551..8da0385 100644 --- a/ip4.h +++ b/ip4.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef IP4_H #define IP4_H diff --git a/ip6.h b/ip6.h index cab7984..6128a60 100644 --- a/ip6.h +++ b/ip6.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef IP6_H #define IP6_H diff --git a/mmap.h b/mmap.h index 4ed3161..d29f1a7 100644 --- a/mmap.h +++ b/mmap.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef MMAP_H #define MMAP_H diff --git a/ndelay.h b/ndelay.h index bf80648..a72eb3e 100644 --- a/ndelay.h +++ b/ndelay.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef NDELAY_H #define NDELAY_H diff --git a/open.h b/open.h index cf4cf28..169f6fa 100644 --- a/open.h +++ b/open.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef OPEN_H #define OPEN_H diff --git a/openreadclose.h b/openreadclose.h index d9ed394..d340232 100644 --- a/openreadclose.h +++ b/openreadclose.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef OPENREADCLOSE_H #define OPENREADCLOSE_H diff --git a/rangecheck.h b/rangecheck.h index 59c4744..652e62f 100644 --- a/rangecheck.h +++ b/rangecheck.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef RANGECHECK_H #define RANGECHECK_H diff --git a/safemult.h b/safemult.h index 9ef14ec..bf4c4be 100644 --- a/safemult.h +++ b/safemult.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef _SAFEMULT_H #define _SAFEMULT_H diff --git a/scan.h b/scan.h index 035e4d9..e5d596e 100644 --- a/scan.h +++ b/scan.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef SCAN_H #define SCAN_H diff --git a/socket.h b/socket.h index 8ae05db..c5be59a 100644 --- a/socket.h +++ b/socket.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef SOCKET_H #define SOCKET_H diff --git a/str.h b/str.h index 172042e..91fecea 100644 --- a/str.h +++ b/str.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef STR_H #define STR_H diff --git a/stralloc.h b/stralloc.h index 4152ac9..6904889 100644 --- a/stralloc.h +++ b/stralloc.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef STRALLOC_H #define STRALLOC_H diff --git a/tai.h b/tai.h index 3a01555..79ced33 100644 --- a/tai.h +++ b/tai.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef TAI_H #define TAI_H diff --git a/taia.h b/taia.h index 9576b06..fd68633 100644 --- a/taia.h +++ b/taia.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef TAIA_H #define TAIA_H diff --git a/textcode.h b/textcode.h index 612029f..d4c2b00 100644 --- a/textcode.h +++ b/textcode.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef TEXTCODE_H #define TEXTCODE_H diff --git a/uint16.h b/uint16.h index f1e7324..42f1043 100644 --- a/uint16.h +++ b/uint16.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef UINT16_H #define UINT16_H diff --git a/uint32.h b/uint32.h index fbfe039..7ff87c1 100644 --- a/uint32.h +++ b/uint32.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef UINT32_H #define UINT32_H diff --git a/uint64.h b/uint64.h index 8188fe8..4f6d580 100644 --- a/uint64.h +++ b/uint64.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef UINT64_H #define UINT64_H diff --git a/va_narg.h b/va_narg.h index eab88d3..fa950a5 100644 --- a/va_narg.h +++ b/va_narg.h @@ -1,3 +1,4 @@ +/* this header file comes from libowfat, http://www.fefe.de/libowfat/ */ #ifndef _VA_NARG_H #define _VA_NARG_H