1 /* @(#)seterrno.c	1.13 10/08/23 Copyright 1985, 1995-2010 J. Schilling */
2 /*
3  *	Set error number
4  *
5  *	Copyright (c) 1985, 1995-2010 J. Schilling
6  */
7 /*
8  * The contents of this file are subject to the terms of the
9  * Common Development and Distribution License, Version 1.0 only
10  * (the "License").  You may not use this file except in compliance
11  * with the License.
12  *
13  * See the file CDDL.Schily.txt in this distribution for details.
14  * A copy of the CDDL is also available via the Internet at
15  * http://www.opensource.org/licenses/cddl1.txt
16  *
17  * When distributing Covered Code, include this CDDL HEADER in each
18  * file and include the License file CDDL.Schily.txt from this distribution.
19  */
20 
21 #ifndef	_TS_ERRNO
22 #define	_TS_ERRNO		/* Solaris: get thread safe errno value */
23 #endif
24 #ifndef	_LIBC_REENTRANT
25 #define	_LIBC_REENTRANT		/* Linux: get thread safe errno value */
26 #endif
27 #include <schily/standard.h>
28 #include <schily/errno.h>
29 #include <schily/schily.h>
30 
31 #ifdef	seterrno
32 #undef	seterrno
33 #endif
34 
35 EXPORT int
seterrno(err)36 seterrno(err)
37 	int	err;
38 {
39 	int	old = errno;
40 
41 	errno = err;
42 	return (old);
43 }
44