* 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.
This commit is contained in:
Roland McGrath 1999-06-25 14:50:51 +00:00
parent 448af2c46f
commit 6f9dc08b86
8 changed files with 60 additions and 45 deletions

View File

@ -1,5 +1,16 @@
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.

View File

@ -28,6 +28,9 @@ headers = hurd.h $(interface-headers) \
$(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/,\
@ -54,13 +57,14 @@ routines = hurdstartup hurdinit \
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
@ -74,6 +78,15 @@ routines += compat-20
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)
include ../mach/Machrules
include ../Rules

View File

@ -49,15 +49,15 @@ extern struct mutex _hurd_dtable_lock; /* Locks those two variables. */
#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;
@ -134,7 +134,7 @@ _hurd_fd_get (int fd)
/* 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)
@ -155,7 +155,7 @@ _hurd_fd_error_signal (error_t 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);
@ -171,7 +171,7 @@ _hurd_fd_error (int fd, error_t 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);

View File

@ -1,5 +1,5 @@
/* 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
@ -54,14 +54,14 @@ struct hurd_port
__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);
@ -76,7 +76,7 @@ extern void _hurd_port_cleanup (void *, jmp_buf, int);
/* 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)
{
@ -94,7 +94,7 @@ _hurd_port_locked_get (struct hurd_port *port,
/* 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)
{
@ -109,7 +109,7 @@ _hurd_port_get (struct hurd_port *port,
/* 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)
@ -133,7 +133,7 @@ _hurd_port_free (struct hurd_port *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;
@ -146,7 +146,7 @@ _hurd_port_locked_set (struct hurd_port *port, mach_port_t newport)
/* 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;

View File

@ -1,5 +1,5 @@
/* 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
@ -124,7 +124,11 @@ extern struct hurd_sigstate *_hurd_self_sigstate (void)
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 =
@ -159,7 +163,7 @@ extern int _hurd_core_limit;
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 =
@ -185,7 +189,7 @@ _hurd_critical_section_lock (void)
return ss;
}
_EXTERN_INLINE void
_HURD_SIGNAL_H_EXTERN_INLINE void
_hurd_critical_section_unlock (void *our_lock)
{
if (our_lock == NULL)

View File

@ -1,5 +1,5 @@
/* 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
@ -66,14 +66,14 @@ enum __hurd_threadvar_index
};
#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)
{
@ -97,7 +97,7 @@ __hurd_threadvar_location (enum __hurd_threadvar_index __index)
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,
@ -106,7 +106,7 @@ __hurd_threadvar_location (enum __hurd_threadvar_index __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);

View File

@ -1,5 +1,5 @@
/* 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
@ -70,14 +70,14 @@ struct hurd_userlink
};
#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)
{
@ -102,7 +102,7 @@ _hurd_userlink_link (struct hurd_userlink **chainp,
/* 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
@ -132,7 +132,7 @@ _hurd_userlink_unlink (struct hurd_userlink *link)
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)

View File

@ -1,13 +0,0 @@
/* 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"