1999-06-25 Roland McGrath <roland@baalperazim.frob.com>
+ * hurd.h, hurd/hurd/fd.h, hurd/hurd/port.h, hurd/hurd/signal.h,
+ hurd/hurd/threadvar.h, hurd/hurd/userlink.h: Instead of
+ _EXTERN_INLINE, use a macro specific to each file,
+ _HURD_FD_H_EXTERN_INLINE and the like.
+ * hurd/Makefile (inline-headers): New variable.
+ (routines): Remove hurdinline. Add $(inlines).
+ (inlines): New variable.
+ ($(inlines:%=$(objpfx)%.c)): New static pattern rule to generate them.
+ (generated): Append those here.
+ * hurd/hurdinline.c: File removed.
+
* sysdeps/generic/glob64.c: Include <stddef.h> for NULL.
* mach/Versions (libc: GLIBC_2.0): Add __mig_strncpy.
$(addprefix hurd/,fd.h id.h port.h signal.h sigpreempt.h ioctl.h\
userlink.h resource.h threadvar.h lookup.h)
+inline-headers = hurd.h $(addprefix hurd/,fd.h signal.h \
+ userlink.h threadvar.h port.h)
+
# The RPC interfaces go in a separate library.
interface-library := libhurduser
user-interfaces := $(addprefix hurd/,\
fopenport \
vpprintf \
ports-get ports-set hurdports hurdmsg \
- $(sig) $(dtable) hurdinline port-cleanup report-wait
+ $(sig) $(dtable) $(inlines) port-cleanup report-wait
sig = hurdsig hurdfault siginfo hurd-raise preempt-sig \
trampoline longjmp-ts catch-exc exc2signal hurdkill sigunwind \
thread-self thread-cancel intr-msg catch-signal
dtable = dtable port2fd new-fd alloc-fd intern-fd \
getdport openport \
fd-close fd-read fd-write hurdioctl ctty-input ctty-output
+inlines = $(inline-headers:%.h=%-inlines)
distribute = hurdstartup.h hurdfault.h hurdhost.h \
faultexc.defs intr-rpc.defs intr-rpc.h intr-msg.h Notes
endif
shared-only-routines = compat-20
+
+# For each of the $(inline-headers), generate a trivial source
+# file that will #include it to define its inline functions as real functions.
+$(inlines:%=$(objpfx)%.c): $(objpfx)%-inlines.c: %.h
+ (h="`echo $(subst /,_,$*) | tr '[a-z]' '[A-Z]'`"; \
+ echo "#define _$${h}_H_EXTERN_INLINE /* Define real function. */"; \
+ echo '#include "$<"') > $@-new
+ mv -f $@-new $@
+generated += $(inlines:=.c)
\f
include ../mach/Machrules
include ../Rules
#include <hurd/signal.h>
#include <lock-intern.h>
-#ifndef _EXTERN_INLINE
-#define _EXTERN_INLINE extern __inline
+#ifndef _HURD_FD_H_EXTERN_INLINE
+#define _HURD_FD_H_EXTERN_INLINE extern __inline
#endif
/* Returns the descriptor cell for FD. If FD is invalid or unused, return
NULL. The cell is unlocked; when ready to use it, lock it and check for
it being unused. */
-_EXTERN_INLINE struct hurd_fd *
+_HURD_FD_H_EXTERN_INLINE struct hurd_fd *
_hurd_fd_get (int fd)
{
struct hurd_fd *descriptor;
/* Check if ERR should generate a signal.
Returns the signal to take, or zero if none. */
-_EXTERN_INLINE error_t
+_HURD_FD_H_EXTERN_INLINE error_t
_hurd_fd_error_signal (error_t err)
{
switch (err)
always use this function to handle errors from RPCs made on file
descriptor ports. Some errors are translated into signals. */
-_EXTERN_INLINE error_t
+_HURD_FD_H_EXTERN_INLINE error_t
_hurd_fd_error (int fd, error_t err)
{
int signo = _hurd_fd_error_signal (err);
/* Handle error code ERR from an RPC on file descriptor FD's port.
Set `errno' to the appropriate error code, and always return -1. */
-_EXTERN_INLINE int
+_HURD_FD_H_EXTERN_INLINE int
__hurd_dfail (int fd, error_t err)
{
errno = _hurd_fd_error (fd, err);
/* Lightweight user references for ports.
- Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1994, 1995, 1997, 1999 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
__result; })
-#ifndef _EXTERN_INLINE
-#define _EXTERN_INLINE extern __inline
+#ifndef _HURD_PORT_H_EXTERN_INLINE
+#define _HURD_PORT_H_EXTERN_INLINE extern __inline
#endif
/* Initialize *PORT to INIT. */
-_EXTERN_INLINE void
+_HURD_PORT_H_EXTERN_INLINE void
_hurd_port_init (struct hurd_port *port, mach_port_t init)
{
__spin_lock_init (&port->lock);
/* Get a reference to *PORT, which is locked.
Pass return value and LINK to _hurd_port_free when done. */
-_EXTERN_INLINE mach_port_t
+_HURD_PORT_H_EXTERN_INLINE mach_port_t
_hurd_port_locked_get (struct hurd_port *port,
struct hurd_userlink *link)
{
/* Same, but locks PORT first. */
-_EXTERN_INLINE mach_port_t
+_HURD_PORT_H_EXTERN_INLINE mach_port_t
_hurd_port_get (struct hurd_port *port,
struct hurd_userlink *link)
{
/* Free a reference gotten with `USED_PORT = _hurd_port_get (PORT, LINK);' */
-_EXTERN_INLINE void
+_HURD_PORT_H_EXTERN_INLINE void
_hurd_port_free (struct hurd_port *port,
struct hurd_userlink *link,
mach_port_t used_port)
/* Set *PORT's port to NEWPORT. NEWPORT's reference is consumed by PORT->port.
PORT->lock is locked. */
-_EXTERN_INLINE void
+_HURD_PORT_H_EXTERN_INLINE void
_hurd_port_locked_set (struct hurd_port *port, mach_port_t newport)
{
mach_port_t old;
/* Same, but locks PORT first. */
-_EXTERN_INLINE void
+_HURD_PORT_H_EXTERN_INLINE void
_hurd_port_set (struct hurd_port *port, mach_port_t newport)
{
HURD_CRITICAL_BEGIN;
/* Implementing POSIX.1 signals under the Hurd.
- Copyright (C) 1993, 94, 95, 96, 98 Free Software Foundation, Inc.
+ Copyright (C) 1993, 94, 95, 96, 98, 99 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
by different threads. */
__attribute__ ((__const__));
-_EXTERN_INLINE struct hurd_sigstate *
+#ifndef _HURD_SIGNAL_H_EXTERN_INLINE
+#define _HURD_SIGNAL_H_EXTERN_INLINE extern __inline
+#endif
+
+_HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate *
_hurd_self_sigstate (void)
{
struct hurd_sigstate **location =
interrupted lest the signal handler try to take the same lock and
deadlock result. */
-_EXTERN_INLINE void *
+_HURD_SIGNAL_H_EXTERN_INLINE void *
_hurd_critical_section_lock (void)
{
struct hurd_sigstate **location =
return ss;
}
-_EXTERN_INLINE void
+_HURD_SIGNAL_H_EXTERN_INLINE void
_hurd_critical_section_unlock (void *our_lock)
{
if (our_lock == NULL)
/* Internal per-thread variables for the Hurd.
- Copyright (C) 1994, 95, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1994, 95, 97, 98, 99 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
};
-#ifndef _EXTERN_INLINE
-#define _EXTERN_INLINE extern __inline
+#ifndef _HURD_THREADVAR_H_EXTERN_INLINE
+#define _HURD_THREADVAR_H_EXTERN_INLINE extern __inline
#endif
/* Return the location of the value for the per-thread variable with index
INDEX used by the thread whose stack pointer is SP. */
-_EXTERN_INLINE unsigned long int *
+_HURD_THREADVAR_H_EXTERN_INLINE unsigned long int *
__hurd_threadvar_location_from_sp (enum __hurd_threadvar_index __index,
void *__sp)
{
the same stack frame by different threads. */
__attribute__ ((__const__));
-_EXTERN_INLINE unsigned long int *
+_HURD_THREADVAR_H_EXTERN_INLINE unsigned long int *
__hurd_threadvar_location (enum __hurd_threadvar_index __index)
{
return __hurd_threadvar_location_from_sp (__index,
/* Return the current thread's location for `errno'.
The syntax of this function allows redeclarations like `int errno'. */
-_EXTERN_INLINE int *
+_HURD_THREADVAR_H_EXTERN_INLINE int *
__hurd_errno_location (void)
{
return (int *) __hurd_threadvar_location (_HURD_THREADVAR_ERRNO);
/* Support for chains recording users of a resource; `struct hurd_userlink'.
- Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1997, 1999 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
};
-#ifndef _EXTERN_INLINE
-#define _EXTERN_INLINE extern __inline
+#ifndef _HURD_USERLINK_H_EXTERN_INLINE
+#define _HURD_USERLINK_H_EXTERN_INLINE extern __inline
#endif
/* Attach LINK to the chain of users at *CHAINP. */
-_EXTERN_INLINE void
+_HURD_USERLINK_H_EXTERN_INLINE void
_hurd_userlink_link (struct hurd_userlink **chainp,
struct hurd_userlink *link)
{
/* Detach LINK from its chain. Returns nonzero iff this was the
last user of the resource and it should be deallocated. */
-_EXTERN_INLINE int
+_HURD_USERLINK_H_EXTERN_INLINE int
_hurd_userlink_unlink (struct hurd_userlink *link)
{
/* We should deallocate the resource used if this chain has been detached
value is zero, someone is still using the resource and they will
deallocate it when they are finished. */
-_EXTERN_INLINE int
+_HURD_USERLINK_H_EXTERN_INLINE int
_hurd_userlink_clear (struct hurd_userlink **chainp)
{
if (*chainp == NULL)
+++ /dev/null
-/* Include these first to avoid defining their inline functions. */
-#include <lock-intern.h>
-#include <signal.h>
-
-#undef _EXTERN_INLINE
-#define _EXTERN_INLINE /* Define the real function. */
-
-#include "hurd.h"
-#include "hurd/fd.h"
-#include "hurd/signal.h"
-#include "hurd/userlink.h"
-#include "hurd/threadvar.h"
-#include "hurd/port.h"