1 /** $MirOS: src/libexec/ld.so/sparc/syscall.h,v 1.2 2006/08/30 03:52:53 tg Exp $ */
2 /* $OpenBSD: syscall.h,v 1.8 2006/05/03 16:10:52 drahn Exp $ */
3
4 /*
5 * Copyright (c) 2001 Niklas Hallqvist
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
17 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 */
29
30 #ifndef __DL_SYSCALL_H__
31 #define __DL_SYSCALL_H__
32
33 #include <sys/syscall.h>
34 #include <sys/stat.h>
35 #include <sys/signal.h>
36
37 #ifndef _dl_MAX_ERRNO
38 #define _dl_MAX_ERRNO 4096
39 #endif
40 #define _dl_check_error(__res) \
41 ((int) __res < 0 && (int) __res >= -_dl_MAX_ERRNO)
42
43 int _dl_close(int);
44 __dead int _dl_exit(int);
45 int _dl_issetugid(void);
46 long _dl__syscall(quad_t, ...);
47 int _dl_mprotect(const void *, int, int);
48 int _dl_munmap(const void*, unsigned int);
49 int _dl_open(const char*, unsigned int);
50 int _dl_read(int, const char*, int);
51 int _dl_stat(const char *, struct stat *);
52 int _dl_fstat(int, struct stat *);
53 int _dl_fcntl(int, int, ...);
54 int _dl_getdirentries(int, char*, int, long *);
55 int _dl_sigprocmask(int, const sigset_t *, sigset_t *);
56 int _dl_sysctl(int *, u_int, void *, size_t *, void *, size_t);
57 int _dl_gettimeofday(struct timeval *tp, struct timezone *tzp);
58
59 static inline off_t
_dl_lseek(int fildes,off_t offset,int whence)60 _dl_lseek(int fildes, off_t offset, int whence)
61 {
62 return _dl__syscall((quad_t)SYS_lseek, fildes, 0, offset, whence);
63 }
64
65 #endif /*__DL_SYSCALL_H__*/
66