From 7c6da0c213bc4299d7da200a5eef0a6d7b1c3c35 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Fri, 15 Mar 2019 19:14:05 -0400 Subject: [PATCH] hurd: Fixes for upgrade to debian-hurd-20190220.img. * include/mach/mach-init.h (__mach_host_self, __mach_task_self): Remove macro magic. (mach_host_self, mach_task_self): Remove macro magic; declare as function. * lib/mach/mach-init.c (mach_host_self, mach_task_self): New function. (mach_init): Use them. * lib/gnu/hurd-start.c (_hurd_start): Use mach_task_self (). * lib/gnu/_exit.c (_exit): Likewise. --- include/mach/mach-init.h | 52 ++++++++++++++-------------- lib/gnu/_exit.c | 2 +- lib/gnu/hurd-start.c | 2 +- lib/mach/mach-init.c | 73 +++++++++++++++++++++++++-------------- lib/string/argz-count.c | 7 ++-- lib/string/argz-extract.c | 7 ++-- 6 files changed, 83 insertions(+), 60 deletions(-) diff --git a/include/mach/mach-init.h b/include/mach/mach-init.h index 3cced775..02916a77 100644 --- a/include/mach/mach-init.h +++ b/include/mach/mach-init.h @@ -1,20 +1,28 @@ -/* Declarations and macros for the basic Mach things set at startup. - Copyright (C) 1993-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 1993-2016 Free Software Foundation, Inc. + * Copyright © 2019 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ +/** Commentary: + Taken from GNU C Library + Declarations and macros for the basic Mach things set at startup. + */ #ifndef _MACH_INIT_H @@ -23,18 +31,8 @@ #include /* Return the current task's task port. */ -extern mach_port_t __mach_task_self (void); extern mach_port_t mach_task_self (void); - -/* This cache is initialized at startup. */ -extern mach_port_t __mach_task_self_; -#define __mach_task_self() (__mach_task_self_ + 0) /* Not an lvalue. */ -#define mach_task_self() (__mach_task_self ()) - -/* This cache is initialized at startup. */ -extern mach_port_t __mach_host_self_; -#define __mach_host_self() (__mach_host_self_ + 0) /* Not an lvalue. */ -#define mach_host_self() (__mach_host_self ()) +extern mach_port_t mach_host_self (void); /* Kernel page size. */ extern vm_size_t __vm_page_size; diff --git a/lib/gnu/_exit.c b/lib/gnu/_exit.c index 82908d47..39268f8f 100644 --- a/lib/gnu/_exit.c +++ b/lib/gnu/_exit.c @@ -33,7 +33,7 @@ void _exit (int status) { __proc_mark_exit (_hurd_startup_data.portarray[INIT_PORT_PROC], status, 0); - __task_terminate (__mach_task_self ()); + __task_terminate (mach_task_self ()); #if 0 // FIXME: this was needed? while (1) {* (int *) 0 = 0;} #else diff --git a/lib/gnu/hurd-start.c b/lib/gnu/hurd-start.c index 043d676b..b6b98c09 100644 --- a/lib/gnu/hurd-start.c +++ b/lib/gnu/hurd-start.c @@ -48,7 +48,7 @@ _hurd_start () { mach_port_t bootstrap; __mach_init (); - __task_get_special_port (__mach_task_self (), TASK_BOOTSTRAP_PORT, + __task_get_special_port (mach_task_self (), TASK_BOOTSTRAP_PORT, &bootstrap); __exec_startup_get_data (bootstrap, &_hurd_startup_data); _hurd_dtable_count = _hurd_startup_data.dtable_count; diff --git a/lib/mach/mach-init.c b/lib/mach/mach-init.c index 53e73f0a..3d64975c 100644 --- a/lib/mach/mach-init.c +++ b/lib/mach/mach-init.c @@ -1,26 +1,35 @@ -/* Copyright (C) 1992-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 1992-2016 Free Software Foundation, Inc. + * Copyright © 2019 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ +/** Commentary: + Taken from GNU C Library + */ #define _GNU_SOURCE 1 #define __USE_GNU 1 +#define __FILE_defined 1 -#include +#include #include -//#include +#include #include mach_port_t __mach_task_self_; @@ -32,21 +41,35 @@ __mach_init (void) { kern_return_t err; - __mach_task_self_ = (__mach_task_self) (); - __mach_host_self_ = (__mach_host_self) (); -#if 0 - __mig_init (0); -#endif - #ifdef HAVE_HOST_PAGE_SIZE - if (err = __host_page_size (__mach_host_self (), &__vm_page_size)) + if (err = __host_page_size (mach_host_self (), &__vm_page_size)) _exit (err); #else { vm_statistics_data_t stats; - if (err = __vm_statistics (__mach_task_self (), &stats)) + if (err = __vm_statistics (mach_task_self (), &stats)) _exit (err); __vm_page_size = stats.pagesize; } #endif } + +extern mach_port_t __mach_host_self (void); + +mach_port_t +mach_host_self (void) +{ + if (!__mach_host_self_) + __mach_host_self_ = __mach_host_self (); + return __mach_host_self_; +} + +extern mach_port_t __mach_task_self (void); + +mach_port_t +mach_task_self (void) +{ + if (!__mach_task_self_) + __mach_task_self_ = __mach_task_self (); + return __mach_task_self_; +} diff --git a/lib/string/argz-count.c b/lib/string/argz-count.c index 98f8ceec..b8b53e56 100644 --- a/lib/string/argz-count.c +++ b/lib/string/argz-count.c @@ -18,9 +18,10 @@ * along with GNU Mes. If not, see . */ -/* Taken from GNU C Library - * Routines for dealing with '\0' separated arg vectors. - * Written by Miles Bader +/** Commentary: + Taken from GNU C Library + Routines for dealing with '\0' separated arg vectors. + Written by Miles Bader */ #include diff --git a/lib/string/argz-extract.c b/lib/string/argz-extract.c index 7175e8dc..0788a5e4 100644 --- a/lib/string/argz-extract.c +++ b/lib/string/argz-extract.c @@ -19,9 +19,10 @@ * along with GNU Mes. If not, see . */ -/* Taken from GNU C Library - * Routines for dealing with '\0' separated arg vectors. - * Written by Miles Bader +/** Commentary: + Taken from GNU C Library + Routines for dealing with '\0' separated arg vectors. + Written by Miles Bader */ #include