[Sbcl-devel] Struct groveling

17 views
Skip to first unread message

Josh Elsasser

unread,
May 12, 2013, 11:58:35 AM5/12/13
to sbcl-...@lists.sourceforge.net
Currently a number of C structure definitions are hardcoded in
src/code/unix.lisp. Most notable is struct timeval, which has three
different definitions hiding behind various reader
conditionals.

Rather than make this situation even worse to add support for
OpenBSD's upcoming switch to a 64-bit time_t, I think these structure
definitions should just be groveled like the various C types are:

https://github.com/jre/sbcl/commit/5b10a6c33bf4bb48de0cb4be5a24eaf3b926692e

It's not the ideal solution, but is much better than translating C
into lisp by hand at least :)

I believe that groveler change is correct for all the unixes, but I
wouldn't care to guess what headers one would need to include on win32
to get timeval and timespec headers. Input and testing from win32
users would be appreciated.

Unless there are any objections I'd like to go ahead and commit it
after someone can confirm that it doesn't break windows.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Sbcl-devel mailing list
Sbcl-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-devel

Paul Khuong

unread,
Jun 8, 2013, 1:03:58 PM6/8/13
to Josh Elsasser, sbcl-...@lists.sourceforge.net
Josh Elsasser wrote:
> Currently a number of C structure definitions are hardcoded in
> src/code/unix.lisp. Most notable is struct timeval, which has three
> different definitions hiding behind various reader
> conditionals.
>
> Rather than make this situation even worse to add support for
> OpenBSD's upcoming switch to a 64-bit time_t, I think these structure
> definitions should just be groveled like the various C types are:
>
> https://github.com/jre/sbcl/commit/5b10a6c33bf4bb48de0cb4be5a24eaf3b926692e

[...]

> Unless there are any objections I'd like to go ahead and commit it
> after someone can confirm that it doesn't break windows.

I unfortunately don't have access to a windows machine, but the patch
really looks like a good idea to me. Does anyone have the time to test
this on windows and report the results?

TIA,

Paul Khuong

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j

Josh Elsasser

unread,
Jun 9, 2013, 1:15:19 AM6/9/13
to Paul Khuong, sbcl-...@lists.sourceforge.net
On Sat, Jun 08, 2013 at 01:03:58PM -0400, Paul Khuong wrote:
> Josh Elsasser wrote:
> >Currently a number of C structure definitions are hardcoded in
> >src/code/unix.lisp. Most notable is struct timeval, which has three
> >different definitions hiding behind various reader
> >conditionals.
> >
> >Rather than make this situation even worse to add support for
> >OpenBSD's upcoming switch to a 64-bit time_t, I think these structure
> >definitions should just be groveled like the various C types are:
> >
> >https://github.com/jre/sbcl/commit/5b10a6c33bf4bb48de0cb4be5a24eaf3b926692e
>
> [...]
>
> >Unless there are any objections I'd like to go ahead and commit it
> >after someone can confirm that it doesn't break windows.
>
> I unfortunately don't have access to a windows machine, but the
> patch really looks like a good idea to me. Does anyone have the time
> to test this on windows and report the results?

I believe I have fixed this on windows but am unable to test with a
full build. If someone else would like to test then please grab the
grovel-structs-rebase branch from git://github.com/jre/sbcl.git

I plan on committing this in a few days unless anyone chimes up with a
bad build/test report.

Nick Levine

unread,
Jun 9, 2013, 8:41:14 AM6/9/13
to Josh Elsasser, sbcl-...@lists.sourceforge.net, p...@pvk.ca
I cloned git://github.com/jre/sbcl.git and built successfully. When I
run the image it identifies itself as "1.0.55.466-4adf30d". Build ends
thus:

Note: Test suite failures which are expected for this combination of
platform and features have been ignored:
contrib/sb-introspect
Expected failure: ALLOCATION-INFORMATION.4

WARNING! Some of the contrib modules did not build successfully or pass
their self-tests. Failed contribs:"
sb-concurrency
sb-posix

I tried running the longer tests. At one point Windows chirped in to
tell me that SBCL had crashed and it wanted to entertain me by finding
out more; but the main test harness kept on going and the output
finished thus:

Finished running tests.
Status:
Expected failure: /Users/nick/lisp/test/sbcl/tests/interface.pure.lisp / (SLEEP NON-CONSING)
Expected failure: /Users/nick/lisp/test/sbcl/tests/stream.pure.lisp / (STREAM LISTEN-VS-SELECT)
Expected failure: /Users/nick/lisp/test/sbcl/tests/threads.pure.lisp / WITHOUT-INTERRUPTS+CONDITION-WAIT
Expected failure: /Users/nick/lisp/test/sbcl/tests/alien.impure.lisp / BUG-316075
Expected failure: /Users/nick/lisp/test/sbcl/tests/alien.impure.lisp / BUG-721087
Expected failure: /Users/nick/lisp/test/sbcl/tests/deadline.impure.lisp / (DEADLINE RUN-PROGRAM TRIVIAL)
Expected failure: /Users/nick/lisp/test/sbcl/tests/deadline.impure.lisp / (DEADLINE DEFER-DEADLINE-1)
Expected failure: /Users/nick/lisp/test/sbcl/tests/deadline.impure.lisp / (DEADLINE DEFER-DEADLINE-2)
Expected failure: /Users/nick/lisp/test/sbcl/tests/deadline.impure.lisp / (DEADLINE CANCEL-DEADLINE)
Unexpected success: /Users/nick/lisp/test/sbcl/tests/debug.impure.lisp / BACKTRACE-INTERRUPTED-CONDITION-WAIT
Unhandled Error /Users/nick/lisp/test/sbcl/tests/defstruct.impure.lisp
Expected failure: /Users/nick/lisp/test/sbcl/tests/dynamic-extent.impure.lisp / (NO-CONSING SPECIALIZED-DX-VECTORS)
Expected failure: /Users/nick/lisp/test/sbcl/tests/external-format.impure.lisp / INVALID-EXTERNAL-FORMAT
Expected failure: /Users/nick/lisp/test/sbcl/tests/foreign-stack-alignment.impure.lisp / REGULAR
Expected failure: /Users/nick/lisp/test/sbcl/tests/foreign-stack-alignment.impure.lisp / CALLBACK
Expected failure: /Users/nick/lisp/test/sbcl/tests/packages.impure.lisp / USE-PACKAGE-CONFLICT-SET
Expected failure: /Users/nick/lisp/test/sbcl/tests/packages.impure.lisp / IMPORT-SINGLE-CONFLICT
Expected failure: /Users/nick/lisp/test/sbcl/tests/pathnames.impure.lisp / PRINT/READ-CONSISTENCY
Expected failure: /Users/nick/lisp/test/sbcl/tests/pathnames.impure.lisp / ROOT-TRUENAME
Expected failure: /Users/nick/lisp/test/sbcl/tests/pathnames.impure.lisp / MERGE-BACK
Expected failure: /Users/nick/lisp/test/sbcl/tests/pathnames.impure.lisp / TILDE-EXPANSION
Expected failure: /Users/nick/lisp/test/sbcl/tests/pathnames.impure.lisp / PATHNAME-ESCAPE-FIRST-DIRECTORY-COMPONENT
Expected failure: /Users/nick/lisp/test/sbcl/tests/run-program.impure.lisp / RUN-PROGRAM-CAT-5
Expected failure: /Users/nick/lisp/test/sbcl/tests/run-program.impure.lisp / (RUN-PROGRAM STRESS)
Expected failure: /Users/nick/lisp/test/sbcl/tests/run-program.impure.lisp / (RUN-PROGRAM PTY-STREAM)
Expected failure: /Users/nick/lisp/test/sbcl/tests/run-program.impure.lisp / (RUN-PROGRAM INHERIT-STDIN)
Expected failure: /Users/nick/lisp/test/sbcl/tests/run-program.impure.lisp / (RUN-PROGRAM CLEAN-EXIT-AFTER-ENCODING-ERROR)
Unhandled Error /Users/nick/lisp/test/sbcl/tests/smoke.impure.lisp
Expected failure: /Users/nick/lisp/test/sbcl/tests/stream.impure.lisp / TEST-FILE-FOR-CLOSE-SHOULD-NOT-DELETE
Skipped (broken): /Users/nick/lisp/test/sbcl/tests/swap-lispobjs.impure.lisp / SWAP-LISPOBJS/PREPARE
Expected failure: /Users/nick/lisp/test/sbcl/tests/swap-lispobjs.impure.lisp / SWAP-LISPOBJS
Invalid exit status: /Users/nick/lisp/test/sbcl/tests/threads.impure.lisp
Expected failure: /Users/nick/lisp/test/sbcl/tests/timer.impure.lisp / (TIMER THREADED-STRESS)
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RESTART-FRAME SPECIAL)
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RESTART-FRAME OPTIONAL-SPECIAL)
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RESTART-FRAME NORMAL)
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME SPECIAL)
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME OPTIONAL-SPECIAL)
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME NORMAL)
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / CURRENT-CATCH-BLOCK-RESTORED
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME LOCAL-FUNCTION)
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME HAIRY-LOCAL-FUNCTION)
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME ANONYMOUS TOPLEVEL)
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME ANONYMOUS TOPLEVEL-SPECIAL)
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME ANONYMOUS)
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME ANONYMOUS SPECIAL)
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / TEST-UNWIND-1
Expected failure: /Users/nick/lisp/test/sbcl/tests/unwind-to-frame-and-call.impure.lisp / TEST-UNWIND-2
Expected failure: /Users/nick/lisp/test/sbcl/tests/walk.impure.lisp / (WALK-LET* HAIRY-SPECIALS)
Unhandled Error /Users/nick/lisp/test/sbcl/tests/win32-foreign-stack-unwind.impure.lisp
(27 tests skipped for this combination of platform and features)
test failed, expected 104 return code, got 1

The only difference between this and testing 1.1.8.29-315285f is:

Expected failure: /Users/nick/lisp/sbcl/tests/compiler.pure.lisp / FOLD-INDEX-ADDRESSING-POSITIVE-OFFSET

- nick

Josh Elsasser

unread,
Jun 9, 2013, 10:28:12 AM6/9/13
to Nick Levine, sbcl-...@lists.sourceforge.net, p...@pvk.ca
On Sun, Jun 09, 2013 at 01:41:14PM +0100, Nick Levine wrote:
> I cloned git://github.com/jre/sbcl.git and built successfully. When I
> run the image it identifies itself as "1.0.55.466-4adf30d". Build ends
> thus:
>
> [snip]
>
> The only difference between this and testing 1.1.8.29-315285f is:
>
> Expected failure: /Users/nick/lisp/sbcl/tests/compiler.pure.lisp / FOLD-INDEX-ADDRESSING-POSITIVE-OFFSET
>
> - nick

That looks like the (rather old) master branch on my github fork. You
want the grovel-structs-rebase branch, which should identify as
version 1.1.8.something-2a05516. The generated file
output/stuff-groveled-from-headers.lisp will contain a struct timeval
and struct timespec definition after the build finishes.

Nick Levine

unread,
Jun 10, 2013, 6:35:18 AM6/10/13
to Josh Elsasser, sbcl-...@lists.sourceforge.net, p...@pvk.ca
> Date: Sun, 9 Jun 2013 07:28:12 -0700
> From: Josh Elsasser <jo...@elsasser.org>
>
> That looks like the (rather old) master branch on my github
> fork. You want the grovel-structs-rebase branch, which should
> identify as version 1.1.8.something-2a05516. The generated file
> output/stuff-groveled-from-headers.lisp will contain a struct
> timeval and struct timespec definition after the build finishes.

Oops. I'm on the road for a couple of days, but will try this again
when I'm back at the end of the week.

- nick

Nick Levine

unread,
Jun 14, 2013, 6:45:14 AM6/14/13
to Josh Elsasser, sbcl-...@lists.sourceforge.net, p...@pvk.ca
> Date: Sun, 9 Jun 2013 07:28:12 -0700
> From: Josh Elsasser <jo...@elsasser.org>
> Cc: p...@pvk.ca, sbcl-...@lists.sourceforge.net
>
> That looks like the (rather old) master branch on my github
> fork. You want the grovel-structs-rebase branch, which should
> identify as version 1.1.8.something-2a05516. The generated file
> output/stuff-groveled-from-headers.lisp will contain a struct
> timeval and struct timespec definition after the build finishes.

It now does.

Image builds fine. Herewith the test summary. I had to kill lisp twice
- it had sat doing nothing for minutes. Let me know if I can take this
further.

This was SBCL 1.0.55.466.HEAD.121-2a05516.

- nick

Finished running tests.
Status:
Expected failure: /Users/nick/lisp/sbcl/tests/compiler.pure.lisp / FOLD-INDEX-ADDRESSING-POSITIVE-OFFSET
Expected failure: /Users/nick/lisp/sbcl/tests/interface.pure.lisp / (SLEEP NON-CONSING)
Expected failure: /Users/nick/lisp/sbcl/tests/stream.pure.lisp / (STREAM LISTEN-VS-SELECT)
Expected failure: /Users/nick/lisp/sbcl/tests/threads.pure.lisp / WITHOUT-INTERRUPTS+CONDITION-WAIT
Expected failure: /Users/nick/lisp/sbcl/tests/alien.impure.lisp / BUG-316075
Expected failure: /Users/nick/lisp/sbcl/tests/alien.impure.lisp / BUG-721087
Expected failure: /Users/nick/lisp/sbcl/tests/deadline.impure.lisp / (DEADLINE RUN-PROGRAM TRIVIAL)
Expected failure: /Users/nick/lisp/sbcl/tests/deadline.impure.lisp / (DEADLINE DEFER-DEADLINE-1)
Expected failure: /Users/nick/lisp/sbcl/tests/deadline.impure.lisp / (DEADLINE DEFER-DEADLINE-2)
Expected failure: /Users/nick/lisp/sbcl/tests/deadline.impure.lisp / (DEADLINE CANCEL-DEADLINE)
Unexpected success: /Users/nick/lisp/sbcl/tests/debug.impure.lisp / BACKTRACE-INTERRUPTED-CONDITION-WAIT
Unhandled Error /Users/nick/lisp/sbcl/tests/defstruct.impure.lisp
Expected failure: /Users/nick/lisp/sbcl/tests/dynamic-extent.impure.lisp / (NO-CONSING SPECIALIZED-DX-VECTORS)
Expected failure: /Users/nick/lisp/sbcl/tests/external-format.impure.lisp / INVALID-EXTERNAL-FORMAT
Expected failure: /Users/nick/lisp/sbcl/tests/foreign-stack-alignment.impure.lisp / REGULAR
Expected failure: /Users/nick/lisp/sbcl/tests/foreign-stack-alignment.impure.lisp / CALLBACK
Expected failure: /Users/nick/lisp/sbcl/tests/packages.impure.lisp / USE-PACKAGE-CONFLICT-SET
Expected failure: /Users/nick/lisp/sbcl/tests/packages.impure.lisp / IMPORT-SINGLE-CONFLICT
Expected failure: /Users/nick/lisp/sbcl/tests/pathnames.impure.lisp / PRINT/READ-CONSISTENCY
Expected failure: /Users/nick/lisp/sbcl/tests/pathnames.impure.lisp / ROOT-TRUENAME
Expected failure: /Users/nick/lisp/sbcl/tests/pathnames.impure.lisp / MERGE-BACK
Expected failure: /Users/nick/lisp/sbcl/tests/pathnames.impure.lisp / TILDE-EXPANSION
Expected failure: /Users/nick/lisp/sbcl/tests/pathnames.impure.lisp / PATHNAME-ESCAPE-FIRST-DIRECTORY-COMPONENT
Expected failure: /Users/nick/lisp/sbcl/tests/run-program.impure.lisp / RUN-PROGRAM-CAT-5
Expected failure: /Users/nick/lisp/sbcl/tests/run-program.impure.lisp / (RUN-PROGRAM STRESS)
Expected failure: /Users/nick/lisp/sbcl/tests/run-program.impure.lisp / (RUN-PROGRAM PTY-STREAM)
Expected failure: /Users/nick/lisp/sbcl/tests/run-program.impure.lisp / (RUN-PROGRAM INHERIT-STDIN)
Expected failure: /Users/nick/lisp/sbcl/tests/run-program.impure.lisp / (RUN-PROGRAM CLEAN-EXIT-AFTER-ENCODING-ERROR)
Unhandled Error /Users/nick/lisp/sbcl/tests/smoke.impure.lisp
Expected failure: /Users/nick/lisp/sbcl/tests/stream.impure.lisp / TEST-FILE-FOR-CLOSE-SHOULD-NOT-DELETE
Skipped (broken): /Users/nick/lisp/sbcl/tests/swap-lispobjs.impure.lisp / SWAP-LISPOBJS/PREPARE
Expected failure: /Users/nick/lisp/sbcl/tests/swap-lispobjs.impure.lisp / SWAP-LISPOBJS
Invalid exit status: /Users/nick/lisp/sbcl/tests/threads.impure.lisp
Invalid exit status: /Users/nick/lisp/sbcl/tests/timer.impure.lisp
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RESTART-FRAME SPECIAL)
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RESTART-FRAME OPTIONAL-SPECIAL)
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RESTART-FRAME NORMAL)
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME SPECIAL)
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME OPTIONAL-SPECIAL)
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME NORMAL)
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / CURRENT-CATCH-BLOCK-RESTORED
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME LOCAL-FUNCTION)
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME HAIRY-LOCAL-FUNCTION)
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME ANONYMOUS TOPLEVEL)
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME ANONYMOUS TOPLEVEL-SPECIAL)
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME ANONYMOUS)
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / (RETURN-FROM-FRAME ANONYMOUS SPECIAL)
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / TEST-UNWIND-1
Expected failure: /Users/nick/lisp/sbcl/tests/unwind-to-frame-and-call.impure.lisp / TEST-UNWIND-2
Expected failure: /Users/nick/lisp/sbcl/tests/walk.impure.lisp / (WALK-LET* HAIRY-SPECIALS)
Unhandled Error /Users/nick/lisp/sbcl/tests/win32-foreign-stack-unwind.impure.lisp
(11 tests skipped for this combination of platform and features)
test failed, expected 104 return code, got 1

User@gannet ~/lisp/sbcl/tests
$ cd ../

User@gannet ~/lisp/sbcl

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Josh Elsasser

unread,
Jun 19, 2013, 11:54:21 PM6/19/13
to sbcl-...@lists.sourceforge.net
On Fri, Jun 14, 2013 at 11:45:14AM +0100, Nick Levine wrote:
> > Date: Sun, 9 Jun 2013 07:28:12 -0700
> > From: Josh Elsasser <jo...@elsasser.org>
> > Cc: p...@pvk.ca, sbcl-...@lists.sourceforge.net
> >
> > That looks like the (rather old) master branch on my github
> > fork. You want the grovel-structs-rebase branch, which should
> > identify as version 1.1.8.something-2a05516. The generated file
> > output/stuff-groveled-from-headers.lisp will contain a struct
> > timeval and struct timespec definition after the build finishes.
>
> It now does.
>
> Image builds fine. Herewith the test summary. I had to kill lisp twice
> - it had sat doing nothing for minutes. Let me know if I can take this
> further.
>
> This was SBCL 1.0.55.466.HEAD.121-2a05516.
>
> - nick

I don't think this introduces any actual regressions, so I've
committed it. If there any resulting build failures then the platform
(cpu, os, 32/64-bit) as well as the contents of
output/stuff-groveled-from-headers.lisp will be useful for debugging.
Reply all
Reply to author
Forward
0 new messages