Re: struct timeval: why is tv_sec long?

2005-10-08 Thread Andreas Kohn
Hi,

On Sat, 2005-10-08 at 06:54 +1000, Peter Jeremy wrote:
> On Fri, 2005-Oct-07 20:17:43 +0200, Andreas Kohn wrote:
> >As SUSv2 wants tv_sec to be time_t[1], would it be possible to change
> >this to time_t on all but alpha? I guess alpha will not receive a switch
> >to long anymore[2]. 
> 
> tv_sec and time_t are int on Alpha for compatability with Tru64.  Since
> the Alpha is now a dead architecture and no longer a tier-1 FreeBSD
> platform, it's unlikely anyone will expend the effort to change them.

That's what I was implying, yes. So, is there any reason left (except
perhaps envious looks from the alpha guys :D) not to change it? 
Shall I open up a PR on this?

The only thing I'm currently wondering if it would be better to do 
--- sys/_timeval.h
#ifdef __alpha__
long tv_sec;
#else
time_t tv_sec;
#endif
---,

or creating a machine/_timeval.h.
#ifdef __alpha__ would probably okay, there are more files in sys/ that
do that.

I think this is an important issue, as it currently makes code not
compile on FreeBSD that uses standard interfaces. 

Attached is a patch to at least update gettimeofday(2) with the fact
that tv_usec is suseconds_t, and add a BUGS section to note the problem
with tv_sec. I was unsure whether to add the reasoning behind the
problem (alpha, tru64), so I left that out.

Best regards,
Andreas

-- 
 was macht man eigentlich auf einer linux-gamer lan ? hl server
aufsetzen und freuen ? *duck* ^^
Index: gettimeofday.2
===
RCS file: /storage/freebsd/cvs/src/lib/libc/sys/gettimeofday.2,v
retrieving revision 1.25
diff -u -r1.25 gettimeofday.2
--- gettimeofday.2	2 Jul 2004 23:52:13 -	1.25
+++ gettimeofday.2	8 Oct 2005 16:27:40 -
@@ -82,8 +82,8 @@
 .Pp
 .Bd -literal
 struct timeval {
-	long	tv_sec;		/* seconds since Jan. 1, 1970 */
-	long	tv_usec;	/* and microseconds */
+	long		tv_sec;		/* seconds since Jan. 1, 1970 */
+	suseconds_t	tv_usec;	/* and microseconds */
 };
 
 struct timezone {
@@ -133,3 +133,5 @@
 .Fn gettimeofday
 system call appeared in
 .Bx 4.2 .
+.Sh BUGS
+The tv_sec member of struct timeval should be a time_t.


signature.asc
Description: This is a digitally signed message part


Re: struct timeval: why is tv_sec long?

2005-10-07 Thread Andreas Kohn
Hi,
On Fri, 2005-10-07 at 09:28 -0700, Brooks Davis wrote:
> On Fri, Oct 07, 2005 at 02:22:22AM +0200, Andreas Kohn wrote:
> > Hi,
> > 
> > is there any special reason for timeval.tv_sec being long?
> 
> tv_sec is presumably long becuase that way 64-bit platforms end up with
> timevals that don't suffer from the 2038 bug.  time_t is also long (or
> rather synonimous with it) on all but alpha platforms.

Thanks for this explanation.

As SUSv2 wants tv_sec to be time_t[1], would it be possible to change
this to time_t on all but alpha? I guess alpha will not receive a switch
to long anymore[2]. 
This would still require workarounds as you suggested below for alpha
(nothing changes here), but would at least bring !alpha closer to
standards compliance, which would be a good thing IMVHO.

> > and this fails to compile on FreeBSD. 
> 
> You probably can just cast the tv.tv_sec to a time_t.  Alternativly, you
> could allocate a time_t and assing tv_sec to it since that will work on
> alpha where the other won't.
Yep, I did the latter, and it works. Thanks.

Regards,
Andreas

[1] http://www.opengroup.org/onlinepubs/007908799/xsh/systime.h.html
[2] I read the instructions for sparc64, it that looked ugly and
difficult. 

-- 
 was macht man eigentlich auf einer linux-gamer lan ? hl server
aufsetzen und freuen ? *duck* ^^


signature.asc
Description: This is a digitally signed message part


struct timeval: why is tv_sec long?

2005-10-06 Thread Andreas Kohn
Hi,

is there any special reason for timeval.tv_sec being long?

--- sys/_timeval.h
/*
 * Structure returned by gettimeofday(2) system call, and used in other
calls.
 */
struct timeval {
longtv_sec; /* seconds (XXX should be
time_t) */
suseconds_t tv_usec;/* and microseconds */
};
---

I just stumbled across this code in an application,
---
timeval tv;
gettimeofday(&tv, 0);

char tbuf[64];
struct tm tmp;
strftime(tbuf, sizeof(tbuf), "%b %d %H:%M:%S", localtime_r(&tv.tv_sec,
&tmp));
---

and this fails to compile on FreeBSD. I fixed the application code now,
but I do wonder why that XXX in sys/_timeval.h is there.
_timeval.h came into existence on 31-Dec-2002, before that timeval was
defined in sys/time.h with both tv_sec and tv_usec as long.

Could anyone offer any pointers?

Best regards,
--
Andreas

-- 
 was macht man eigentlich auf einer linux-gamer lan ? hl server
aufsetzen und freuen ? *duck* ^^
-- 
 was macht man eigentlich auf einer linux-gamer lan ? hl server
aufsetzen und freuen ? *duck* ^^


signature.asc
Description: This is a digitally signed message part


Strange (null) in cc -print-search-dirs

2005-08-20 Thread Andreas Kohn
Hi,

I tried building lcc from the quake3 arena sources today, and it failed
when doing
cc -print-search-dirs.

On my FreeBSD -CURRENT I got:
install: /usr/libexec/(null)

On DragonflyBSD guys from #dragonflybsd also got (null) there, except on
very recent DF.

Linux(RH9) has:
install: /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/

I changed contrib/gcc/gcc.c so that the (null) does no longer show, can
someone please look at the attached patch for correctness?

Thanks,
--
Andreas

-- 
 was macht man eigentlich auf einer linux-gamer lan ? hl server
aufsetzen und freuen ? *duck* ^^
Index: contrib/gcc/gcc.c
===
RCS file: /storage/freebsd/cvs/src/contrib/gcc/gcc.c,v
retrieving revision 1.40
diff -u -r1.40 gcc.c
--- contrib/gcc/gcc.c	3 Jun 2005 04:02:20 -	1.40
+++ contrib/gcc/gcc.c	20 Aug 2005 13:02:49 -
@@ -6095,6 +6095,7 @@
   /* Read specs from a file if there is one.  */
 
 #ifdef FREEBSD_NATIVE
+  machine_suffix = "";
   just_machine_suffix = "";
 #else	/* FREEBSD_NATIVE */
   machine_suffix = concat (spec_machine, dir_separator_str,


signature.asc
Description: This is a digitally signed message part


Re: WinXP and FreeBSD configuration problems

2005-08-05 Thread Andreas Kohn
On Thu, 2005-08-04 at 22:44 -0400, [EMAIL PROTECTED] wrote:
> Hello all,
> 
> OK it is now day three and I have given up. This will be a long 
> one just to warn you now. 
> 
[...]
> First, I tried to install windows on the first 2G partition then 
> tried to install freebsd as follows 
> ad0s0 NTFS2G  #Windows Boot
> ad0s1 FreeBSD 2G  #FreeBSD Boot/Swap
> ad0s3 FAT 20G #Windows
> ad0s4 FreeBSD 298G#FreeBSD
> 
> Now when I finished installing WinXP I could boot with no problems 
> but after installing FreeBSD, I get a BSOD when trying to boot WinXP. 
> I looked thru google, FreeBSD, and Microsoft for a possible answer. 
> No. Everyone seems to just put all of WinXP on the first partition 
> and then FreeBSD or Linux. I think thats fine for a 20, 30 or even 
> 80 GiB HD but I think there will be a performance issue with the 
> boot and swap so deep on the HD.

Hi,

I would say this is a Windows problem. Old Windows certainly had the 
habit of only reading the partition table up to the first non-windows
partition. 
Looks like WinXP still does the same.

But as your only reason for trying for days to get this to work is
a possible performance loss, you may perhaps want to try to measure this
loss and see if it warrants days of work against Windows.

Best regards,
--
Andreas

-- 
 was macht man eigentlich auf einer linux-gamer lan ? hl server
aufsetzen und freuen ? *duck* ^^


signature.asc
Description: This is a digitally signed message part


Re: Why present different size and md5 hash between the compiled code and FreeBSD's build-in binary ?

2004-10-12 Thread Andreas Kohn
Jerry wrote:

> --- Andreas Kohn <[EMAIL PROTECTED]> wrote:
>  
>
>>Hi,
>>
>>you might be using different optimization flags than
>>the release
>>building cluster.
>>Also make sure that you have really the correct
>>sources, and not a newer
>>version from CVS.
>>
>>
>Hi~ Andreas,
>
>I just used make command with default Makefile to
>build the binary,without change any gcc flag or
>option.
>And never go through the CVS to get newer source, by
>the way, my test platfrom is Release-5.2 on x86, Have
>you ever met this kind of situation? Whether
>compile "binary command" or "kernel code" ?
>
>Best Regards.
>Jerry
>  
>

Hi,

if your source files are *exactly* the same versions used as on the
building cluster, and you have *exactly* the same compilation options,
it would still be possible to have different binaries. For example if
the files included some reference to the current time, either in some
flags in the generated .o, .a, .so, or perhaps in the source code of
auto-generated headers. Some paths referenced could also be different on
your system than on the build cluster.

In short: don't worry too much. It is normal.

--
Andreas
[PS: readded freebsd-hackers@ CC: -- please don't drop the list when
replying!]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Why present different size and md5 hash between the compiled code and FreeBSD's build-in binary ?

2004-10-12 Thread Andreas Kohn
Jerry wrote:

>Hi~
>
>This is my first time to post question here, and also
>I am a newbie on FreeBSD. A confusing thing I discover
>is: Why the binary code I compiled(for example,telnet
>command)compare with the original one is diffirent,
>either size or md5 hash value, What's going on? Are
>the source files differ from the FreeBSD's binary, or
>something else ?
>Deeply appreciate your reply, thanks ~
>
>Jerry Chang
>
>  
>
Hi,

you might be using different optimization flags than the release
building cluster.
Also make sure that you have really the correct sources, and not a newer
version from CVS.

HTH,
--
Andreas

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: header file related question

2004-09-10 Thread Andreas Kohn
On Fri, 2004-09-10 at 02:38, vxp wrote:
> hi,
> 
> i realize it's most likely a stupid question, but try not to be too hard
> on me please - i'm trying to learn :)
> 
> i'm experimenting with the kernel's source, and i'm not quite sure how to
> find what all the header files are that i need, for the stuff i'd like to
> do.. how do i track down what header files i need to #include in my stuff?
> 
> for instance, i'm trying to modify icmp_input() (found in
> /sys/netinet/ip_icmp.c) and load the new function via a kernel module.
> 
> so, i copied all the #include's from /sys/netinet/ip_icmp.c and only have
> the icmp_input() function (unmodified right now, from the form i found
> it), the header files from the original ip_icmp, and a main() that
> simply returns 0. doesn't want to compile, with errors about header files
> such as:
> ---
> In file included from icmp.c:37:
> /usr/include/netinet/in_var.h:50: error: field `ia_ifa' has incomplete
> type
> In file included from /usr/include/netinet/in_var.h:238,
>  from icmp.c:37:
> /usr/include/netinet6/in6_var.h:103: error: field `ia_ifa' has incomplete
> type
> ---
> i realize that it's most likely because i didn't #include something else i
> need..  but how come /sys/netinet/ip_icmp.c compiles, then?  because this
> file is basically that, with all functions but icmp_input removed, and a
> main() that does nothing..
> 
> so.. sorry for the long post.
> but please tell me how do i find out what header files i need ? :)
> 
> thanks.
> 

Hi,

just guessing: Did you compile with -D_KERNEL?

HTH,
Andreas


signature.asc
Description: This is a digitally signed message part


Re: jdk13 native plugin stopped working on native mozilla on -CURRENT

2004-07-28 Thread Andreas Kohn
On Wed, 2004-07-28 at 00:45, Ted Faber wrote:
> I know this is off topic here, but I'm hoping that I can get a quick
> answer rather than tromping off to ports or java. 
Why don't you want to ask your question in a place where the chance for
an answer is much higher? *puzzled*

>  I'm runiing a recent
> -CURRENT and ports cvsupped and compiled today and my native-mode jdk13
> is no longer working as a plugin.  I get an unresloved symbol at mozilla
> startup and no plugin.  
Did you recompile your jdk13 as well?

HTH, 
Andreas

[Reply-To set to [EMAIL PROTECTED]


signature.asc
Description: This is a digitally signed message part