From 5bb5b9c674fc85cdb7a230aa57e80daed3afe82d Mon Sep 17 00:00:00 2001 From: sef Date: Sun, 22 Jun 1997 19:04:03 +0000 Subject: For the xenix_ftime() routine, don't use the native version of the struct -- the XENIX version is packed, and two bytes smaller than ours. So, define the structure, and have it packed. I used the __attribte__((packed)) modifier for this; I could also have surrounded the struct definition with #pragma pack(2) -- but that would have meant making ibcs2_timeb's definition outside the function. This may need to be revisited if we ever want to compile with a compiler other than gcc. (I also used 'unsigned long' instead of 'time_t' because I am writing to match an external specification -- and the definition of time_t could change.) Reviewed by: Steven Wallace --- sys/i386/ibcs2/ibcs2_xenix.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sys/i386/ibcs2') diff --git a/sys/i386/ibcs2/ibcs2_xenix.c b/sys/i386/ibcs2/ibcs2_xenix.c index d294924..a4a6fbc 100644 --- a/sys/i386/ibcs2/ibcs2_xenix.c +++ b/sys/i386/ibcs2/ibcs2_xenix.c @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: ibcs2_xenix.c,v 1.10 1997/03/24 11:37:49 bde Exp $ + * $Id: ibcs2_xenix.c,v 1.11 1997/05/07 20:05:45 peter Exp $ */ #include @@ -119,7 +119,12 @@ xenix_ftime(p, uap, retval) int *retval; { struct timeval tv; - struct timeb itb; + struct ibcs2_timeb { + unsigned long time __attribute__((packed)); + unsigned short millitm; + short timezone; + short dstflag; + } itb; DPRINTF(("IBCS2: 'xenix ftime'\n")); microtime(&tv); @@ -129,7 +134,7 @@ xenix_ftime(p, uap, retval) itb.dstflag = tz.tz_dsttime != DST_NONE; return copyout((caddr_t)&itb, (caddr_t)SCARG(uap, tp), - sizeof(struct timeb)); + sizeof(struct ibcs2_timeb)); } int -- cgit v1.1