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.
This commit is contained in:
Jan Nieuwenhuizen 2019-03-15 19:14:05 -04:00
parent 9b0009a888
commit 7c6da0c213
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
6 changed files with 83 additions and 60 deletions

View file

@ -1,20 +1,28 @@
/* Declarations and macros for the basic Mach things set at startup. /* -*-comment-start: "//";comment-end:""-*-
Copyright (C) 1993-2016 Free Software Foundation, Inc. * GNU Mes --- Maxwell Equations of Software
This file is part of the GNU C Library. * Copyright © 1993-2016 Free Software Foundation, Inc.
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* 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 <http://www.gnu.org/licenses/>.
*/
The GNU C Library is free software; you can redistribute it and/or /** Commentary:
modify it under the terms of the GNU Lesser General Public Taken from GNU C Library
License as published by the Free Software Foundation; either Declarations and macros for the basic Mach things set at startup.
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
<http://www.gnu.org/licenses/>. */
#ifndef _MACH_INIT_H #ifndef _MACH_INIT_H
@ -23,18 +31,8 @@
#include <mach/mach_types.h> #include <mach/mach_types.h>
/* Return the current task's task port. */ /* Return the current task's task port. */
extern mach_port_t __mach_task_self (void);
extern mach_port_t mach_task_self (void); extern mach_port_t mach_task_self (void);
extern mach_port_t mach_host_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 ())
/* Kernel page size. */ /* Kernel page size. */
extern vm_size_t __vm_page_size; extern vm_size_t __vm_page_size;

View file

@ -33,7 +33,7 @@ void
_exit (int status) _exit (int status)
{ {
__proc_mark_exit (_hurd_startup_data.portarray[INIT_PORT_PROC], status, 0); __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? #if 0 // FIXME: this was needed?
while (1) {* (int *) 0 = 0;} while (1) {* (int *) 0 = 0;}
#else #else

View file

@ -48,7 +48,7 @@ _hurd_start ()
{ {
mach_port_t bootstrap; mach_port_t bootstrap;
__mach_init (); __mach_init ();
__task_get_special_port (__mach_task_self (), TASK_BOOTSTRAP_PORT, __task_get_special_port (mach_task_self (), TASK_BOOTSTRAP_PORT,
&bootstrap); &bootstrap);
__exec_startup_get_data (bootstrap, &_hurd_startup_data); __exec_startup_get_data (bootstrap, &_hurd_startup_data);
_hurd_dtable_count = _hurd_startup_data.dtable_count; _hurd_dtable_count = _hurd_startup_data.dtable_count;

View file

@ -1,26 +1,35 @@
/* Copyright (C) 1992-2016 Free Software Foundation, Inc. /* -*-comment-start: "//";comment-end:""-*-
This file is part of the GNU C Library. * GNU Mes --- Maxwell Equations of Software
* Copyright © 1992-2016 Free Software Foundation, Inc.
* Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* 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 <http://www.gnu.org/licenses/>.
*/
The GNU C Library is free software; you can redistribute it and/or /** Commentary:
modify it under the terms of the GNU Lesser General Public Taken from GNU C Library
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
<http://www.gnu.org/licenses/>. */
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#define __USE_GNU 1 #define __USE_GNU 1
#define __FILE_defined 1
#include <mach.h> #include <stdio.h>
#include <mach/mach-init.h> #include <mach/mach-init.h>
//#include <mach/mig_support.h> #include <mach.h>
#include <unistd.h> #include <unistd.h>
mach_port_t __mach_task_self_; mach_port_t __mach_task_self_;
@ -32,21 +41,35 @@ __mach_init (void)
{ {
kern_return_t err; 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 #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); _exit (err);
#else #else
{ {
vm_statistics_data_t stats; vm_statistics_data_t stats;
if (err = __vm_statistics (__mach_task_self (), &stats)) if (err = __vm_statistics (mach_task_self (), &stats))
_exit (err); _exit (err);
__vm_page_size = stats.pagesize; __vm_page_size = stats.pagesize;
} }
#endif #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_;
}

View file

@ -18,9 +18,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* Taken from GNU C Library /** Commentary:
* Routines for dealing with '\0' separated arg vectors. Taken from GNU C Library
* Written by Miles Bader <miles@gnu.ai.mit.edu> Routines for dealing with '\0' separated arg vectors.
Written by Miles Bader <miles@gnu.org>
*/ */
#include <argz.h> #include <argz.h>

View file

@ -19,9 +19,10 @@
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* Taken from GNU C Library /** Commentary:
* Routines for dealing with '\0' separated arg vectors. Taken from GNU C Library
* Written by Miles Bader <miles@gnu.org> Routines for dealing with '\0' separated arg vectors.
Written by Miles Bader <miles@gnu.org>
*/ */
#include <argz.h> #include <argz.h>