diff options
author | Christopher Faylor <me@cgf.cx> | 2002-10-30 21:05:18 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-10-30 21:05:18 +0000 |
commit | 831d6fa520ed43d055924607a2d9be7fcc3813e9 (patch) | |
tree | f79c2bc5524f448accc0d407fc5b3b5c8ff9e0f4 /winsup/cygwin/string.h | |
parent | 4c8eba2cf384878e76b5d13acf0d7b22db531463 (diff) | |
download | cygnal-831d6fa520ed43d055924607a2d9be7fcc3813e9.tar.gz cygnal-831d6fa520ed43d055924607a2d9be7fcc3813e9.tar.bz2 cygnal-831d6fa520ed43d055924607a2d9be7fcc3813e9.zip |
* external.cc (cygwin_internal): Implement CW_CMDLINE.
* pinfo.h (SIGCOMMUNE): New signal type.
(commune_result): New structure for commune functions.
(picom): New enum for commune functions.
(_pinfo::hello_pid): New. Pid who's communicating with me.
(_pinfo::tothem): New. Handle of communicating pipe.
(_pinfo::fromthem): Ditto.
(_pinfo::commune_recv): Declare.
(_pinfo::commune_send): Declare.
(_pinfo::alive): Declare.
(_pinfo::cmdline): Declare.
(_pinfo::lock): Declare.
* pinfo.cc (set_myself): Initialize new _pinfo lock.
(_pinfo::alive): Define. Determines if process still exists.
(_pinfo::commune_recv): Define. Receive info from another cooperating process.
(_pinfo::commune_send): Define. Send info to another cooperating process.
(_pinfo::cmdline): Define. Determine command line of a given process.
* include/sys/cygwin.h (CW_CMDLINE): Define.
*sigproc.cc (talktome): Communicate with any processes who want to talk to me.
(wait_sig): Honor __SIGCOMMUNE.
* fhandler.cc (fhandler_virtual::fixup_after_exec): Declare.
* fhandler_proc.cc: Use malloc/free/realloc throughout rather than cmalloc
since buffers don't need to be propagated to subprocesses.
* fhandler_registry.cc: Ditto.
* fhandler_virtual.cc: Ditto.
(fhandler_virtual::fixup_after_exec): Define.
* fhandler_process.cc: Ditto for malloc/free/realloc.
(process_listin): Add "cmdline".
(fhandler_process::fill_filebuf): Implement PROCESS_CMDLINE.
* miscfuncs.cc (isalpha_array): New array populated with xor values for alpha
characters to switch from one case to another.
* string.h (cygwin_strcasematch): New asm implementation of case match.
* string.h (cygwin_nstrcasematch): New asm implementation of counted case
match.
Diffstat (limited to 'winsup/cygwin/string.h')
-rw-r--r-- | winsup/cygwin/string.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/winsup/cygwin/string.h b/winsup/cygwin/string.h index 84dc14cb7..778bb40ac 100644 --- a/winsup/cygwin/string.h +++ b/winsup/cygwin/string.h @@ -38,6 +38,70 @@ strchr (const char *s, int c) return res; } +extern const char isalpha_array[]; + +#undef strcasematch +#define strcasematch cygwin_strcasematch + +static inline int +cygwin_strcasematch (const char *cs, const char *ct) +{ + register int __res; + int d0, d1; + __asm__ ("\ + .global _isalpha_array \n\ + cld \n\ + andl $0xff,%%eax \n\ +1: lodsb \n\ + scasb \n\ + je 2f \n\ + xorb _isalpha_array(%%eax),%%al \n\ + cmpb -1(%%edi),%%al \n\ + jne 3f \n\ +2: testb %%al,%%al \n\ + jnz 1b \n\ + movl $1,%%eax \n\ + jmp 4f \n\ +3: xor %0,%0 \n\ +4:" + :"=a" (__res), "=&S" (d0), "=&D" (d1) + : "1" (cs), "2" (ct)); + + return __res; +} + +#undef strncasematch +#define strncasematch cygwin_strncasematch + +static inline int +cygwin_strncasematch (const char *cs, const char *ct, size_t n) +{ + register int __res; + int d0, d1, d2; + __asm__ ("\ + .global _isalpha_array; \n\ + cld \n\ + andl $0xff,%%eax \n\ +1: decl %3 \n\ + js 3f \n\ + lodsb \n\ + scasb \n\ + je 2f \n\ + xorb _isalpha_array(%%eax),%%al \n\ + cmpb -1(%%edi),%%al \n\ + jne 4f \n\ +2: testb %%al,%%al \n\ + jnz 1b \n\ +3: movl $1,%%eax \n\ + jmp 5f \n\ +4: xor %0,%0 \n\ +5:" + :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2) + :"1" (cs), "2" (ct), "3" (n)); + + return __res; +} + #ifdef __cplusplus } #endif |