From ead5b131e0755ed69f0b67def2fa8c8fefca5d55 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 12 Jun 2007 15:24:46 +0000 Subject: * Makefile.in (DLL_OFILES): Add xsique.o. * cygwin.din (confstr): Make NOSIGFE. (insque): Export. (remque): Export. * lsearch.cc: Remove superfluous _SEARCH_PRIVATE define. * posix.sgml: Move insque to defined SUSv3 interfaces. Remove comment for remque. * include/search.h: Remove _SEARCH_PRIVATE guarded definitions. Add struct qelem definition. Add insque and remque declarations. * include/cygwin/version.h: Bump API minor number. * include/sys/queue.h: Remove insque/remque definitions so as not to collide with SUSv3 compatible declaration in search.h. * libc/xsique.cc: New file implementing insque and remque. --- winsup/cygwin/ChangeLog | 16 ++++++++++++ winsup/cygwin/Makefile.in | 1 + winsup/cygwin/cygwin.din | 4 ++- winsup/cygwin/include/cygwin/version.h | 3 ++- winsup/cygwin/include/search.h | 22 ++++++---------- winsup/cygwin/include/sys/queue.h | 46 -------------------------------- winsup/cygwin/libc/xsique.cc | 48 ++++++++++++++++++++++++++++++++++ winsup/cygwin/lsearch.cc | 1 - winsup/cygwin/posix.sgml | 4 +-- 9 files changed, 80 insertions(+), 65 deletions(-) create mode 100644 winsup/cygwin/libc/xsique.cc (limited to 'winsup/cygwin') diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 8a4df21ff..0100d8b83 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,19 @@ +2007-06-12 Corinna Vinschen + + * Makefile.in (DLL_OFILES): Add xsique.o. + * cygwin.din (confstr): Make NOSIGFE. + (insque): Export. + (remque): Export. + * lsearch.cc: Remove superfluous _SEARCH_PRIVATE define. + * posix.sgml: Move insque to defined SUSv3 interfaces. Remove + comment for remque. + * include/search.h: Remove _SEARCH_PRIVATE guarded definitions. + Add struct qelem definition. Add insque and remque declarations. + * include/cygwin/version.h: Bump API minor number. + * include/sys/queue.h: Remove insque/remque definitions so as not + to collide with SUSv3 compatible declaration in search.h. + * libc/xsique.cc: New file implementing insque and remque. + 2007-06-12 Corinna Vinschen * fhandler.cc (fhandler_base::fstat): Set pipe permission bits more diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 571aac58a..48e1e36f9 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -144,6 +144,7 @@ DLL_OFILES:=assert.o autoload.o bsdlib.o ctype.o cxx.o cygheap.o cygthread.o \ strptime.o strsep.o strsig.o sync.o syscalls.o sysconf.o syslog.o \ termios.o thread.o timelocal.o timer.o times.o tty.o uinfo.o uname.o \ v8_regexp.o v8_regerror.o v8_regsub.o wait.o wincap.o window.o winf.o \ + xsique.o \ $(EXTRA_DLL_OFILES) $(EXTRA_OFILES) $(MALLOC_OFILES) $(MT_SAFE_OBJECTS) GMON_OFILES:=gmon.o mcount.o profil.o diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index 2e64d2b6f..9a777f1e5 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -195,7 +195,7 @@ _close = close SIGFE closedir SIGFE _closedir = closedir SIGFE closelog SIGFE -confstr SIGFE +confstr NOSIGFE connect = cygwin_connect SIGFE copysign NOSIGFE _copysign = copysign NOSIGFE @@ -731,6 +731,7 @@ _infinityf = infinityf NOSIGFE initgroups SIGFE _initgroups32 = initgroups32 SIGFE initstate NOSIGFE +insque NOSIGFE ioctl SIGFE _ioctl = ioctl SIGFE iprintf SIGFE @@ -1146,6 +1147,7 @@ remainderf NOSIGFE _remainderf = remainderf NOSIGFE remove SIGFE _remove = remove SIGFE +remque NOSIGFE remquo NOSIGFE remquof NOSIGFE rename SIGFE diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 49ad569ca..7cf8c1601 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -309,12 +309,13 @@ details. */ 167: Add st_birthtim to struct stat. 168: Export asnprintf, dprintf, _Exit, vasnprintf, vdprintf. 169: Export confstr. + 170: Export insque, remque. */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 169 +#define CYGWIN_VERSION_API_MINOR 170 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible diff --git a/winsup/cygwin/include/search.h b/winsup/cygwin/include/search.h index bfadb23e0..36a335ed9 100644 --- a/winsup/cygwin/include/search.h +++ b/winsup/cygwin/include/search.h @@ -31,26 +31,18 @@ typedef enum leaf } VISIT; -#ifdef _SEARCH_PRIVATE -typedef struct node -{ - char *key; - struct node *llink, *rlink; -} node_t; - -struct que_elem -{ - struct que_elem *next; - struct que_elem *prev; -}; -#endif - struct hsearch_data { struct internal_head *htable; size_t htablesize; }; +struct qelem +{ + struct qelem *q_forw; + struct qelem *q_back; +}; + __BEGIN_DECLS int hcreate (size_t); void hdestroy (void); @@ -69,6 +61,8 @@ void *lfind (const void *, const void *, size_t *, size_t, int (*) (const void *, const void *)); void *lsearch (const void *, void *, size_t *, size_t, int (*) (const void *, const void *)); +void insque (void *, void *); +void remque (void *); __END_DECLS #endif /* !_SEARCH_H_ */ diff --git a/winsup/cygwin/include/sys/queue.h b/winsup/cygwin/include/sys/queue.h index 92fa56b2f..a62d82a2e 100644 --- a/winsup/cygwin/include/sys/queue.h +++ b/winsup/cygwin/include/sys/queue.h @@ -509,50 +509,4 @@ struct { \ QMD_TRACE_ELEM(&(elm)->field); \ } while (0) - -#ifdef _KERNEL - -/* - * XXX insque() and remque() are an old way of handling certain queues. - * They bogusly assumes that all queue heads look alike. - */ - -struct quehead { - struct quehead *qh_link; - struct quehead *qh_rlink; -}; - -#ifdef __GNUC__ - -static __inline void -insque(void *a, void *b) -{ - struct quehead *element = (struct quehead *)a, - *head = (struct quehead *)b; - - element->qh_link = head->qh_link; - element->qh_rlink = head; - head->qh_link = element; - element->qh_link->qh_rlink = element; -} - -static __inline void -remque(void *a) -{ - struct quehead *element = (struct quehead *)a; - - element->qh_link->qh_rlink = element->qh_rlink; - element->qh_rlink->qh_link = element->qh_link; - element->qh_rlink = 0; -} - -#else /* !__GNUC__ */ - -void insque(void *a, void *b); -void remque(void *a); - -#endif /* __GNUC__ */ - -#endif /* _KERNEL */ - #endif /* !_SYS_QUEUE_H_ */ diff --git a/winsup/cygwin/libc/xsique.cc b/winsup/cygwin/libc/xsique.cc new file mode 100644 index 000000000..e451863ee --- /dev/null +++ b/winsup/cygwin/libc/xsique.cc @@ -0,0 +1,48 @@ +/* xsique.cc. XSI insque and remque functions. + + Copyright 2007 Red Hat, Inc. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#include + +extern "C" void +insque (void *velement, void *vpred) +{ + if (!velement) + return; + + struct qelem *element = (struct qelem *) velement; + struct qelem *pred = (struct qelem *) vpred; + struct qelem *succ; + + if (pred) + { + if ((succ = element->q_forw = pred->q_forw)) + succ->q_back = element; + pred->q_forw = element; + } + else + element->q_forw = NULL; + element->q_back = pred; +} + +extern "C" void +remque (void *velement) +{ + if (!velement) + return; + + struct qelem *pred = ((struct qelem *) velement)->q_back; + struct qelem *succ = ((struct qelem *) velement)->q_forw; + + if (succ) + succ->q_back = pred; + if (pred) + pred->q_forw = succ; +} + diff --git a/winsup/cygwin/lsearch.cc b/winsup/cygwin/lsearch.cc index 6f5ca980d..a348f0e35 100644 --- a/winsup/cygwin/lsearch.cc +++ b/winsup/cygwin/lsearch.cc @@ -7,7 +7,6 @@ #include #include -#define _SEARCH_PRIVATE #include #include /* for uint8_t */ #include /* for NULL */ diff --git a/winsup/cygwin/posix.sgml b/winsup/cygwin/posix.sgml index d236989f3..bad23f9f0 100644 --- a/winsup/cygwin/posix.sgml +++ b/winsup/cygwin/posix.sgml @@ -287,6 +287,7 @@ also ISO/IEC 9945:2003 and IEEE Std 1003.1-2001 (POSIX.1-2001). inet_ntop inet_pton initstate + insque ioctl isalnum isalpha @@ -550,7 +551,7 @@ also ISO/IEC 9945:2003 and IEEE Std 1003.1-2001 (POSIX.1-2001). remainder remainderf remove - remque (see chapter "Implementation Notes") + remque remquo remquof rename @@ -1149,7 +1150,6 @@ also ISO/IEC 9945:2003 and IEEE Std 1003.1-2001 (POSIX.1-2001). hypotl ilogbl initstate - insque isastream ldexpl lgammal -- cgit v1.2.3