socket library and gettimeofday function
Posted in 1995
Topics: Installation, Setup & Upgrades, Connectivity: ESQL/C, 4GL & Embedded SQL, Networking & sqlhosts Configuration
In article <3i2gfk$99s@cssun.mathcs.emory.edu> johnl@informix.com (Jonathan Leffler) explains: >This is bug B31977: > > C4GL LINKS LIBSOCKET.A WHICH IS NOT STANDARD ON SCO, BCOPY() > UNDEFINED > > c4gl script links libsocket.a which is not delivered in the > standard SCO package. Maybe should we use bycopy() instead of > bcopy(). (genlib rdtime.c) > >If you are getting gettimeofday() undefined, then any of your time-keeping >code using DATETIME and CURRENT is unlikely to work correctly. It depends, >in part, on how good a dummy you have provided. The bug report identifies >bcopy() as the missing function rather than gettimeofday(). An operational >bcopy() can be created using: > >#include <string.h> > >void bcopy(src, dst, nbytes) >char *src; >char *dst; >int nbytes; >{ > memmove(dst, src, nbytes); >} > >Note the use of memmove() -- bcopy() is defined to be safe on overlapping >strings, and so is memmove(). It is not safe to memcpy() instead of >memmove(). > >Yours, >Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> Thank's JL, but the bug description doesn't exactly match with our problem. There seems to be no reference in the libraries to bcopy(), and there is well defined bycopy(). It's the gettimeofday() which is missing, so the very exciting bcopy() source is of little use. Perhaps the bug description or our version of the 4GL is out of date ? As to the dummy gettimeofday() we have, I've found in the article <20072.792865632@cassens.com> from dave@cassens.com (Dave Adams) about the function parameters and for the while we're using something as follows #include <sys/types.h> #include <sys/timeb.h> void gettimeofday(tp, tzp) struct { unsigned long tv_sec; /* seconds since Jan. 1, 1970 */ long tv_usec; /* and microseconds */ } *tp; struct { int tz_minuteswest; /* of UTC */ int tz_dsttime; /* type of DST correction to apply */ } *tzp; { struct timeb tmb; ftime(&tmb); tp->tv_sec = tmb.time; tp->tv_usec = tmb.millitm; tzp->tz_minuteswest = tmb.timezone; tzp->tz_dsttime = tmb.dstflag; /*???*/ } But even if we are using empty function body the TIME and CURRENT functions in our programs seem to work pretty fine. Isn't it that gettimeofday() is referenced in the networked environments only (what is suggested by the location of the function in libsocket.a), and we are safe as far as we are working locally (we don't have tcp/ip installed) ? If this is not the case than can someone with a better than our knowledge of the Unix programming revise our version of gettimeofday() source (for a local environment)? BTW. The same problem exists while rebuilding (4.12.UE1) RDS & ID runners. Any help would be appreciated. Regards, Wlodek. +-----------------------------------------------------------------------+ | Wlodek Futrega, SoftProdukt Ltd. E-mail: fidelia@ikp.atm.com.pl | | Warsaw, Poland. Fax: +48 022 23-83-78 | +-----------------------------------------------------------------------+