On Tue, Aug 8, 2023 at 10:41 PM Warner Losh <i...@bsdimp.com> wrote:

>
>
> On Tue, Aug 8, 2023 at 9:12 PM Richard Henderson <
> richard.hender...@linaro.org> wrote:
>
>> On 8/8/23 19:51, Warner Losh wrote:
>> >      > +    /* __int32_t  st_lspare; */
>> >
>> >     Why commented out?
>> >
>> >
>> > I believe that the element was a padding one ....
>> >
>> >      > +    struct target_freebsd_timespec st_birthtim; /* time of file
>> creation */
>> >
>> >     Does that not place st_birthtim at the wrong place?
>> >
>> >
>> > So this winds up in the right place because there's a hole...
>> >
>> > However, having said that, I don't think it should be commented out.
>> It's not
>> > in the bsd-user branch. And the state of the upstream code is such that
>> we can't
>> > run full tests easily on the system calls, so we're making sure they
>> basically
>> > work, but will run the full regression test once some other changes are
>> made
>> > to allow shared libraries to work (many of the calls in this patch are
>> needed
>> > to make 'hello world' work).
>>
>> I think there is not a hole, because the struct is __packed.
>>
>> (Also, QEMU_PACKED vs __packed?)
>
>
> There's a nstat that's an older stat w/o this field. I'm not entirely sure
> __packed should
> be on either one of these, honestly. nstat is quite old, and I'm not at
> all sure what's up
> with it. I think it dates from a time when there was only i386 and then we
> expanded to
> alpha and needed to 'fix' this interface... Not sure why it got the
> freebsd11_ prefix, so
> I'll have to chase those details down to see if this is an extra cut and
> paste or what.
> That may take a little bit to chase down in the logs and in people's
> memory. I think
> that's the back story. Normally, nstat is only defined in the kernel, and
> this is a binary
> interface from ages ago that we likely don't need to implement, but I need
> to confirm
> that, and make sure rust or go don't have some weird, misguided mistake...
>
> But nstat and stat are supposed to be the same, except nstat omits
> st_spare, so that's
> why it's commented out. stat's supposed to be carefully laid out so packed
> or not
> doesn't matter. But testing that would take a little bit as well.
>

OK. Back in 1998, John Dyson added nstat and friends:
commit 1f5621728039a2009fc163d345508d0ee9fae2e9
Author: John Dyson <dy...@freebsd.org>
Date:   Mon May 11 03:55:28 1998 +0000

    Fix the futimes/undelete/utrace conflict with other BSD's.  Note that
    the only common  usage of utrace (the possible problem with this
    commit) is with malloc, so this should be a real problem.  Add
    the various NetBSD syscalls that allow full emulation of their
    development environment.

such emulation hasn't worked since the ELF cut over in FreeSBD 3.2
in 1999,if it even did before that (there's some code to implement these,
but
it's not at all clear to me it ever worked)... This was all preserved when
FreeBSD 11 converted to 64-bit inodes.

So I guess we should preserve it, but I still need to find out the layout
of nstat vs stat on different platforms (though the only systems we ran
on at the time were i386, so after grubbing around with git blame,
I completely retract my 'it was related to alpha' comments: they were
completely wrong). But even so, I guess it was only ever used in
life fire with a.out to run old netbsd a.out files from 25 years ago and
it's relevance is zero since nobody has used it since then and all
maintenance since then in FreeBSD has been basically useless.

I may try to do a regression build of rust w/o it to see if it's used there
or not...

So today I learned...

Warner

Reply via email to