summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--hurd/hurd.h4
-rw-r--r--hurd/privports.c14
-rw-r--r--sysdeps/mach/hurd/adjtime.c11
-rw-r--r--sysdeps/mach/hurd/reboot.c11
-rw-r--r--sysdeps/mach/hurd/settimeofday.c11
6 files changed, 34 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index e5ddbdbe8c..90fdc5d4b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2001-04-19  Roland McGrath  <roland@frob.com>
 
+	* hurd/privports.c (__get_privileged_ports): Renamed with __.
+	Use __ names for calls we make.
+	(get_privileged_ports): Add alias.
+	* hurd/hurd.h: Declare it with the __ name.
+	* sysdeps/mach/hurd/reboot.c (reboot): Use __get_privileged_ports.
+	* sysdeps/mach/hurd/adjtime.c (__adjtime): Likewise.
+	* sysdeps/mach/hurd/settimeofday.c (__settimeofday): Likewise.
+
 	* hurd/hurdsig.c (write_corefile): Check RLIMIT_CORE limit and do
 	nothing if it's zero.
 
diff --git a/hurd/hurd.h b/hurd/hurd.h
index e9c2db8152..85ea4329db 100644
--- a/hurd/hurd.h
+++ b/hurd/hurd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1993,94,95,96,97,98,99,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -292,6 +292,8 @@ extern error_t hurd_sig_post (pid_t pid, int sig, mach_port_t refport);
    other than the proc server (such as a bootstrap filesystem) can set
    these variables to install the ports.  */
 
+extern kern_return_t __get_privileged_ports (host_priv_t *host_priv_ptr,
+					     device_t *device_master_ptr);
 extern kern_return_t get_privileged_ports (host_priv_t *host_priv_ptr,
 					   device_t *device_master_ptr);
 extern mach_port_t _hurd_host_priv, _hurd_device_master;
diff --git a/hurd/privports.c b/hurd/privports.c
index ef6388bd9d..955beeac42 100644
--- a/hurd/privports.c
+++ b/hurd/privports.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1994, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993,94,97,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -25,7 +25,8 @@ mach_port_t _hurd_host_priv, _hurd_device_master;
 
 
 kern_return_t
-get_privileged_ports (host_priv_t *host_priv_ptr, device_t *device_master_ptr)
+__get_privileged_ports (host_priv_t *host_priv_ptr,
+			device_t *device_master_ptr)
 {
   if (! _hurd_host_priv)
     {
@@ -46,15 +47,16 @@ get_privileged_ports (host_priv_t *host_priv_ptr, device_t *device_master_ptr)
 
   if (host_priv_ptr)
     {
-      mach_port_mod_refs (mach_task_self (),
-			  _hurd_host_priv, MACH_PORT_RIGHT_SEND, 1);
+      __mach_port_mod_refs (mach_task_self (),
+			    _hurd_host_priv, MACH_PORT_RIGHT_SEND, 1);
       *host_priv_ptr = _hurd_host_priv;
     }
   if (device_master_ptr)
     {
-      mach_port_mod_refs (mach_task_self (),
-			  _hurd_device_master, MACH_PORT_RIGHT_SEND, 1);
+      __mach_port_mod_refs (mach_task_self (),
+			    _hurd_device_master, MACH_PORT_RIGHT_SEND, 1);
       *device_master_ptr = _hurd_device_master;
     }
   return KERN_SUCCESS;
 }
+weak_alias (__get_privileged_ports, get_privileged_ports)
diff --git a/sysdeps/mach/hurd/adjtime.c b/sysdeps/mach/hurd/adjtime.c
index 1af3a635dc..791bb4b92e 100644
--- a/sysdeps/mach/hurd/adjtime.c
+++ b/sysdeps/mach/hurd/adjtime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991,93,95,97,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,12 +30,11 @@ __adjtime (delta, olddelta)
      struct timeval *olddelta;
 {
   error_t err;
-  mach_port_t hostpriv, devmaster;
+  mach_port_t hostpriv;
 
-  if (err = __USEPORT (PROC, __proc_getprivports (port,
-						  &hostpriv, &devmaster)))
-    return __hurd_fail (err);
-  __mach_port_deallocate (__mach_task_self (), devmaster);
+  err = __get_privileged_ports (&hostpriv, NULL);
+  if (err)
+    return __hurd_fail (EPERM);
 
   err = __host_adjust_time (hostpriv,
 			    /* `time_value_t' and `struct timeval' are in
diff --git a/sysdeps/mach/hurd/reboot.c b/sysdeps/mach/hurd/reboot.c
index ea298b2135..528bffa343 100644
--- a/sysdeps/mach/hurd/reboot.c
+++ b/sysdeps/mach/hurd/reboot.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 93, 94, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1992,93,94,97,98,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -28,12 +28,11 @@ reboot (int howto)
 {
   error_t err;
   startup_t init;
-  mach_port_t hostpriv, devmaster;
+  mach_port_t hostpriv;
 
-  if (err = __USEPORT (PROC, __proc_getprivports (port,
-						  &hostpriv, &devmaster)))
-    return __hurd_fail (err);
-  __mach_port_deallocate (__mach_task_self (), devmaster);
+  err = __get_privileged_ports (&hostpriv, NULL);
+  if (err)
+    return __hurd_fail (EPERM);
 
   err = __USEPORT (PROC, __proc_getmsgport (port, 1, &init));
   if (!err)
diff --git a/sysdeps/mach/hurd/settimeofday.c b/sysdeps/mach/hurd/settimeofday.c
index e0e8135809..a728309e1e 100644
--- a/sysdeps/mach/hurd/settimeofday.c
+++ b/sysdeps/mach/hurd/settimeofday.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,97,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -29,7 +29,7 @@ __settimeofday (tv, tz)
      const struct timezone *tz;
 {
   error_t err;
-  mach_port_t hostpriv, devmaster;
+  mach_port_t hostpriv;
 
   if (tz != NULL)
     {
@@ -37,10 +37,9 @@ __settimeofday (tv, tz)
       return -1;
     }
 
-  if (err = __USEPORT (PROC, __proc_getprivports (port,
-						  &hostpriv, &devmaster)))
-    return __hurd_fail (err);
-  __mach_port_deallocate (__mach_task_self (), devmaster);
+  err = __get_privileged_ports (&hostpriv, NULL);
+  if (err)
+    return __hurd_fail (EPERM);
 
   /* `time_value_t' and `struct timeval' are in fact identical with the
      names changed.  */