*BSD News Article 84400


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!howland.erols.net!EU.net!sun4nl!fwi.uva.nl!not-for-mail
From: casper@fwi.uva.nl (Casper H.S. Dik)
Newsgroups: comp.unix.solaris,comp.unix.bsd.misc,comp.unix.internals
Subject: Re: Solaris 2.6
Supersedes: <cancel.casper.32a7ee1b@mail.fwi.uva.nl>
Date: 6 Dec 1996 10:57:48 +0100
Organization: Sun Microsystems, Netherlands
Lines: 30
Distribution: world
Message-ID: <casper.32a7ee1b@mail.fwi.uva.nl>
References: <32986299.AC7@mail.esrin.esa.it> <580sgh$kpi@panix2.panix.com> <casper.32a40b7b@mail.fwi.uva.nl> <587jrv$9rf@news.parc.xerox.com> <587meg$h67@web.nmti.com> <5880ig$1a5$1@shade.twinsun.com> <slrn5af88v.199.dave@pc-damir.srce.hr>
NNTP-Posting-Host: mail.fwi.uva.nl
Xref: euryale.cc.adfa.oz.au comp.unix.solaris:91659 comp.unix.bsd.misc:1711 comp.unix.internals:11491

dave@pc-damir.srce.hr (Drazen Kacar) writes:

>But of course they are. Thou shalt use off_t and ifdef it for Solaris 2.6
>Suppose you have:

>   fstat(fd, &inode)
>   printf("%d\n", inode.st_size);

>st_size is off_t (64 bits), but %d wants int (32 bits, the same as long).
>Thou shalt use "%dll" and guard it with ifdef from normal systems.
>And if not... Imagine all those HTTP servers returning "Content-Length: 0".


I think you'll be able to do:



	#include <sys/inttypes.h>

	printf("%" PRIdMAX "\n", (intmax_t) inode.st_size)


But this doesn't port to 2.5.1 or before :-(

Casper
-- 
Casper Dik - Sun Microsystems - via my guest account at the University
of Amsterdam.  My work e-mail address is: Casper.Dik@Holland.Sun.COM
Statements on Sun products included here are not gospel and may
be fiction rather than truth.