mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-21 11:13:30 +00:00
d201fe46e3
adding (weak definitions to) stubs for some of the pthread functions. If the threads library is linked in, the real pthread functions will pulled in. Use the following convention for system calls wrapped by the threads library: __sys_foo - actual system call _foo - weak definition to __sys_foo foo - weak definition to __sys_foo Change all libc uses of system calls wrapped by the threads library from foo to _foo. In order to define the prototypes for _foo(), we introduce namespace.h and un-namespace.h (suggested by bde). All files that need to reference these system calls, should include namespace.h before any standard includes, then include un-namespace.h after the standard includes and before any local includes. <db.h> is an exception and shouldn't be included in between namespace.h and un-namespace.h namespace.h will define foo to _foo, and un-namespace.h will undefine foo. Try to eliminate some of the recursive calls to MT-safe functions in libc/stdio in preparation for adding a mutex to FILE. We have recursive mutexes, but would like to avoid using them if possible. Remove uneeded includes of <errno.h> from a few files. Add $FreeBSD$ to a few files in order to pass commitprep. Approved by: -arch
110 lines
2.9 KiB
C
110 lines
2.9 KiB
C
/* $FreeBSD$ */
|
|
/* From: NetBSD: SYS.h,v 1.5 1997/05/02 18:15:15 kleink Exp */
|
|
|
|
/*
|
|
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
|
* All rights reserved.
|
|
*
|
|
* Author: Chris G. Demetriou
|
|
*
|
|
* Permission to use, copy, modify and distribute this software and
|
|
* its documentation is hereby granted, provided that both the copyright
|
|
* notice and this permission notice appear in all copies of the
|
|
* software, derivative works or modified versions, and any portions
|
|
* thereof, and that both notices appear in supporting documentation.
|
|
*
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
|
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
|
*
|
|
* Carnegie Mellon requests users of this software to return to
|
|
*
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
* School of Computer Science
|
|
* Carnegie Mellon University
|
|
* Pittsburgh PA 15213-3890
|
|
*
|
|
* any improvements or extensions that they make and grant Carnegie the
|
|
* rights to redistribute these changes.
|
|
*/
|
|
|
|
#include <machine/asm.h>
|
|
#include <sys/syscall.h>
|
|
|
|
#define CALLSYS_ERROR(name) \
|
|
CALLSYS_NOERROR(name); \
|
|
cmp.ne p6,p0=r0,r10; \
|
|
(p6) br.cond.sptk.few .cerror
|
|
|
|
|
|
#define SYSCALL(name) \
|
|
ENTRY(_ ## name,0); /* XXX # of args? */ \
|
|
WEAK_ALIAS(name, _ ## name); \
|
|
CALLSYS_ERROR(name)
|
|
|
|
#define SYSCALL_NOERROR(name) \
|
|
ENTRY(name,0); /* XXX # of args? */ \
|
|
CALLSYS_NOERROR(name)
|
|
|
|
|
|
#define RSYSCALL(name) \
|
|
SYSCALL(name); \
|
|
br.ret.sptk.few rp; \
|
|
END(_ ## name)
|
|
|
|
#define RSYSCALL_NOERROR(name) \
|
|
SYSCALL_NOERROR(name); \
|
|
br.ret.sptk.few rp; \
|
|
END(name)
|
|
|
|
|
|
#define PSEUDO(label,name) \
|
|
ENTRY(_ ## label,0); /* XXX # of args? */ \
|
|
WEAK_ALIAS(label, _ ## label); \
|
|
CALLSYS_ERROR(name); \
|
|
br.ret.sptk.few rp; \
|
|
END(_ ## label);
|
|
|
|
#define PSEUDO_NOERROR(label,name) \
|
|
ENTRY(label,0); /* XXX # of args? */ \
|
|
CALLSYS_NOERROR(name); \
|
|
br.ret.sptk.few rp; \
|
|
END(label);
|
|
|
|
/*
|
|
* Design note:
|
|
*
|
|
* The macros PSYSCALL() and PRSYSCALL() are intended for use where a
|
|
* syscall needs to be renamed in the threaded library.
|
|
*/
|
|
/*
|
|
* For the thread_safe versions, we prepend __sys_ to the function
|
|
* name so that the 'C' wrapper can go around the real name.
|
|
*/
|
|
#define PCALL(name) \
|
|
CALL(__sys_ ## name)
|
|
|
|
#define PENTRY(name, args) \
|
|
ENTRY(__sys_ ## name,args)
|
|
|
|
#define PEND(name) \
|
|
END(__sys_ ## name)
|
|
|
|
#define PSYSCALL(name) \
|
|
PENTRY(name,0); /* XXX # of args? */ \
|
|
CALLSYS_ERROR(name)
|
|
|
|
#define PRSYSCALL(name) \
|
|
PENTRY(_sys_ ## name,0); /* XXX # of args? */ \
|
|
WEAK_ALIAS(name, __sys_ ## name); \
|
|
WEAK_ALIAS(_ ## name, __sys_ ## name); \
|
|
CALLSYS_ERROR(name) \
|
|
br.ret.sptk.few rp; \
|
|
PEND(name)
|
|
|
|
#define PPSEUDO(label,name) \
|
|
PENTRY(label,0); /* XXX # of args? */ \
|
|
CALLSYS_ERROR(name); \
|
|
br.ret.sptk.few rp; \
|
|
PEND(label)
|