Fixed printf format errors.

Use offsetof() instead of null pointer hacks.  Use a home made offsetof()
because including <stddef.h> is not permitted in LKMs.
This commit is contained in:
bde 1998-07-29 15:50:41 +00:00
parent db2c82a097
commit 8498bf4764
2 changed files with 22 additions and 18 deletions

View File

@ -1,23 +1,25 @@
/* $Id: linux_genassym.c,v 1.6 1997/08/25 23:36:23 bde Exp $ */
/* $Id: linux_genassym.c,v 1.7 1998/02/01 18:47:56 bde Exp $ */
#include <sys/param.h>
#include <i386/linux/linux.h>
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
#define OS(s, m) ((u_int)offsetof(struct s, m))
int main __P((void));
int printf __P((const char *, ...));
int
main()
{
struct linux_sigframe *linux_sigf = (struct linux_sigframe *)0;
struct linux_sigcontext *linux_sc = (struct linux_sigcontext *)0;
printf("#define\tLINUX_SIGF_HANDLER %d\n", &linux_sigf->sf_handler);
printf("#define\tLINUX_SIGF_SC %d\n", &linux_sigf->sf_sc);
printf("#define\tLINUX_SC_FS %d\n", &linux_sc->sc_fs);
printf("#define\tLINUX_SC_GS %d\n", &linux_sc->sc_gs);
printf("#define\tLINUX_SC_EFLAGS %d\n", &linux_sc->sc_eflags);
printf("#define\tLINUX_SIGF_HANDLER %u\n",
OS(linux_sigframe, sf_handler));
printf("#define\tLINUX_SIGF_SC %u\n", OS(linux_sigframe, sf_sc));
printf("#define\tLINUX_SC_FS %u\n", OS(linux_sigcontext, sc_fs));
printf("#define\tLINUX_SC_GS %u\n", OS(linux_sigcontext, sc_gs));
printf("#define\tLINUX_SC_EFLAGS %u\n",
OS(linux_sigcontext, sc_eflags));
return (0);
}

View File

@ -1,23 +1,25 @@
/* $Id: linux_genassym.c,v 1.6 1997/08/25 23:36:23 bde Exp $ */
/* $Id: linux_genassym.c,v 1.7 1998/02/01 18:47:56 bde Exp $ */
#include <sys/param.h>
#include <i386/linux/linux.h>
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
#define OS(s, m) ((u_int)offsetof(struct s, m))
int main __P((void));
int printf __P((const char *, ...));
int
main()
{
struct linux_sigframe *linux_sigf = (struct linux_sigframe *)0;
struct linux_sigcontext *linux_sc = (struct linux_sigcontext *)0;
printf("#define\tLINUX_SIGF_HANDLER %d\n", &linux_sigf->sf_handler);
printf("#define\tLINUX_SIGF_SC %d\n", &linux_sigf->sf_sc);
printf("#define\tLINUX_SC_FS %d\n", &linux_sc->sc_fs);
printf("#define\tLINUX_SC_GS %d\n", &linux_sc->sc_gs);
printf("#define\tLINUX_SC_EFLAGS %d\n", &linux_sc->sc_eflags);
printf("#define\tLINUX_SIGF_HANDLER %u\n",
OS(linux_sigframe, sf_handler));
printf("#define\tLINUX_SIGF_SC %u\n", OS(linux_sigframe, sf_sc));
printf("#define\tLINUX_SC_FS %u\n", OS(linux_sigcontext, sc_fs));
printf("#define\tLINUX_SC_GS %u\n", OS(linux_sigcontext, sc_gs));
printf("#define\tLINUX_SC_EFLAGS %u\n",
OS(linux_sigcontext, sc_eflags));
return (0);
}