#define nint and exp10 for non-SUN environs, replace usleep with closest sleep call, use getrlimit since getdtablesize() is obsolete

This commit is contained in:
Mark Anderson
1993-08-04 16:56:00 +00:00
parent 05381fa5e0
commit fac038af71
3 changed files with 19 additions and 2 deletions

View File

@@ -69,6 +69,8 @@
# include <ctype.h>
# include <sys/types.h> /* for 'select' operations */
# include <sys/time.h> /* for 'select' operations */
# include <sys/resource.h>
#endif
#include <genDefs.h>
@@ -146,6 +148,7 @@ CX_CMD **ppCxCmd; /* I pointer to pointer to command context */
fd_set fdSet; /* set of fd's to watch with select */
int fdSetWidth; /* width of select bit mask */
struct timeval fdSetTimeout;/* timeout interval for select */
struct rlimit rlp;
#endif
CX_CMD *pCxCmd=*ppCxCmd;/* pointer to command context */
int i;
@@ -161,7 +164,12 @@ CX_CMD **ppCxCmd; /* I pointer to pointer to command context */
}
#ifndef vxWorks
/* MDA - use getrlimit since getdtablesize() is obsolete
fdSetWidth = getdtablesize();
*/
getrlimit(RLIMIT_NOFILE,&rlp);
fdSetWidth = rlp.rlim_cur;
fdSetTimeout.tv_sec = 0;
fdSetTimeout.tv_usec = 0;
FD_ZERO(&fdSet);

View File

@@ -61,8 +61,14 @@
#ifdef vxWorks
#define nint(value) (value>=0 ? (int)((value)+.5) : (int)((value)-.5))
#define exp10(value) (exp(value * log(10.)))
# define nint(value) (value>=0 ? (int)((value)+.5) : (int)((value)-.5))
# define exp10(value) (exp(value * log(10.)))
#else
/* really nint and exp10 aren't ANSI-C or POSIX */
# ifndef sun
# define nint(value) (value>=0 ? (int)((value)+.5) : (int)((value)-.5))
# define exp10(value) (exp(value * log(10.)))
# endif
#endif
#if 0

View File

@@ -519,7 +519,10 @@ int seconds; /* I number of seconds (added to usec) to sleep */
int usec; /* I number of micro-sec (added to sec) to sleep */
{
#ifndef vxWorks
sleep((unsigned int)seconds);
/* MDA - usleep isn't POSIX
usleep((unsigned)(seconds*1000000 + usec));
*/
#else
int ticks;
static int ticksPerSec=0;