[545] in Pthreads mailing list archive
Proven threads for hpux 10.10
daemon@ATHENA.MIT.EDU (Philippe Bernadat)
Thu Jan 9 16:59:20 1997
To: pthreads@MIT.EDU
Cc: bernadat@osf.org
Date: Thu, 09 Jan 1997 16:35:26 -0500
From: Philippe Bernadat <bernadat@osf.org>
I am using the proven pthread package on a HPUX 10.10 platform.
I had to apply several fixes to get it to compile on my workstation.
Some of the fixes are non hpux dependent, like when compiling within
a strict ansi environment and with the -g flag. These fixes are included
below.
But this is not my main problem. I am experimenting problems
with the use of select(). The problem might be related to
Posix select API conformance.
On hpux 10.10, the fd_set structure is 256 bytes long (2048 file
descriptors). Many applications invoke select with an nfds value
that is much smaller than 2048 (say 32 ...) and also assume that
only the 32 first fd_set bits will be touched. This is ok with
a non multi threaded application on hpux.
Now, with the proven threads, in the case of select returning for
a timeout reason, the fd_set variables are cleared with FD_ZERO,
which clears 256 bytes in our case. And of course it breaks such
programs.
So my question is, in the Posix1 standard, should select be allowed
to touch bits above the nfds limit ? Or are these applications not
complying to posix standards ?
Also internally, the proven select routine invokes FD_ZERO 9 times
on it's private variables. This means it clears more than 2K for
each call.
Philippe
%%%%%%%%%%%%%%%%%%%% ./include/endian.h %%%%%%%%%%%%%%%%%%%%%
*** ./include/endian.h Tue May 30 10:30:57 1995
--- /users/bernadat/pthreads/pthreads-1_60_beta6/./include/endian.h Thu Jan 9
15:58:14 1997
***************
*** 75,81 ****
defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370)
|| \
defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || \
defined(apollo) || defined(hp9000) || defined(hp9000s300) || \
! defined(hp9000s800) || \
defined (BIT_ZERO_ON_LEFT)
#define BYTE_ORDER BIG_ENDIAN
#define __BYTE_ORDER BIG_ENDIAN
--- 75,81 ----
defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370)
|| \
defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || \
defined(apollo) || defined(hp9000) || defined(hp9000s300) || \
! defined(hp9000s800) || defined(__hp9000s800) || \
defined (BIT_ZERO_ON_LEFT)
#define BYTE_ORDER BIG_ENDIAN
#define __BYTE_ORDER BIG_ENDIAN
%%%%%%%%%%%%%%%%%%%% ./include/stdio.h %%%%%%%%%%%%%%%%%%%%%
*** ./include/stdio.h Wed Jun 14 03:15:56 1995
--- /users/bernadat/pthreads/pthreads-1_60_beta6/./include/stdio.h Thu Jan 9
15:58:46 1997
***************
*** 328,334 ****
#define getc_unlocked(fp) __sgetc(fp)
#define getchar_unlocked() getc_unlocked(stdin)
! #ifdef __CAN_DO_EXTERN_INLINE
__INLINE int __sputc(int _c, FILE *_p)
{
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
--- 328,334 ----
#define getc_unlocked(fp) __sgetc(fp)
#define getchar_unlocked() getc_unlocked(stdin)
! #if defined(__CAN_DO_EXTERN_INLINE) && !defined(__STRICT_ANSI__)
__INLINE int __sputc(int _c, FILE *_p)
{
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
***************
*** 362,365 ****
--- 362,366 ----
#define fileno(p) __sfileno(p)
#endif
+ extern char *optarg;
#endif
%%%%%%%%%%%%%%%%%%%% ./machdep/hpux-9.03/__signal.h %%%%%%%%%%%%%%%%%%%%%
*** ./machdep/hpux-9.03/__signal.h Wed Dec 13 00:43:18 1995
--- /users/bernadat/pthreads/pthreads-1_60_beta6/./machdep/hpux-9.03/__signal.h
Thu Jan 9 15:59:08 1997
***************
*** 18,24 ****
#define SIG_ANY(sig) sig_any(&sig)
! static inline int sig_any(sigset_t *sig) {
int i;
for (i=0; i < SIGSET_SIZE; i++)
if (sig->sigset[i] != 0)
--- 18,30 ----
#define SIG_ANY(sig) sig_any(&sig)
! #if !defined(__STRICT_ANSI__)
! #define INLINE inline
! #else
! #define INLINE
! #endif
!
! static INLINE int sig_any(sigset_t *sig) {
int i;
for (i=0; i < SIGSET_SIZE; i++)
if (sig->sigset[i] != 0)
%%%%%%%%%%%%%%%%%%%% ./machdep/hpux-9.03/timers.h %%%%%%%%%%%%%%%%%%%%%
*** ./machdep/hpux-9.03/timers.h Tue Mar 5 03:28:25 1996
--- /users/bernadat/pthreads/pthreads-1_60_beta6/./machdep/hpux-9.03/timers.h
Fri Jan 3 11:48:54 1997
***************
*** 43,48 ****
--- 43,51 ----
#include <sys/types.h>
#include <time.h>
+ #ifndef _STRUCT_TIMESPEC
+ #define _STRUCT_TIMESPEC
+
struct timespec {
time_t tv_sec;
long tv_nsec;
***************
*** 56,61 ****
--- 59,66 ----
(tv)->tv_sec = (ts)->tv_sec; \
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
}
+
+ #endif /* _STRUCT_TIMESPEC */
/*
* New functions