diff options
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/bits/ipc.h | 54 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/bits/shm.h | 88 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/fstatfs64.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/ftruncate64.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/getrlimit64.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/glob.c | 7 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/glob64.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/ioperm.c | 211 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/pread64.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/pwrite64.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/readdir.c | 7 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/readdir64.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/readdir64_r.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/readdir_r.c | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/setrlimit64.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/shmctl.c | 31 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/statfs64.c | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/syscalls.list | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/truncate64.c | 1 |
19 files changed, 414 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/ipc.h b/sysdeps/unix/sysv/linux/ia64/bits/ipc.h new file mode 100644 index 0000000000..12c424b4fd --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/bits/ipc.h @@ -0,0 +1,54 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger-Tang <davidm@hpl.hp.com> + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_IPC_H +# error "Never use <bits/ipc.h> directly; include <sys/ipc.h> instead." +#endif + +#include <sys/types.h> + +/* Mode bits for `msgget', `semget', and `shmget'. */ +#define IPC_CREAT 01000 /* Create key if key does not exist. */ +#define IPC_EXCL 02000 /* Fail if key exists. */ +#define IPC_NOWAIT 04000 /* Return error on wait. */ + +/* Control commands for `msgctl', `semctl', and `shmctl'. */ +#define IPC_RMID 0 /* Remove identifier. */ +#define IPC_SET 1 /* Set `ipc_perm' options. */ +#define IPC_STAT 2 /* Get `ipc_perm' options. */ +#define IPC_INFO 3 /* See ipcs. */ + +/* Special key values. */ +#define IPC_PRIVATE ((__key_t) 0) /* Private key. */ + + +/* Data structure used to pass permission information to IPC operations. */ +struct ipc_perm + { + __key_t __key; /* Key. */ + __uid_t uid; /* Owner's user ID. */ + __gid_t gid; /* Owner's group ID. */ + __uid_t cuid; /* Creator's user ID. */ + __gid_t cgid; /* Creator's group ID. */ + __mode_t mode; /* Read/write permission. */ + unsigned short int __seq; /* Sequence number. */ + unsigned short int __pad1; + unsigned long int __unused1; + unsigned long int __unused2; + }; diff --git a/sysdeps/unix/sysv/linux/ia64/bits/shm.h b/sysdeps/unix/sysv/linux/ia64/bits/shm.h new file mode 100644 index 0000000000..3001eab7d1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/bits/shm.h @@ -0,0 +1,88 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger-Tang <davidm@hpl.hp.com> + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_SHM_H +# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead." +#endif + +#include <sys/types.h> + +/* Permission flag for shmget. */ +#define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */ +#define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */ + +/* Flags for `shmat'. */ +#define SHM_RDONLY 010000 /* attach read-only else read-write */ +#define SHM_RND 020000 /* round attach address to SHMLBA */ +#define SHM_REMAP 040000 /* take-over region on attach */ + +/* Commands for `shmctl'. */ +#define SHM_LOCK 11 /* lock segment (root only) */ +#define SHM_UNLOCK 12 /* unlock segment (root only) */ + + +/* Data structure describing a set of semaphores. */ +struct shmid_ds + { + struct ipc_perm shm_perm; /* operation permission struct */ + size_t shm_segsz; /* size of segment in bytes */ + __time_t shm_atime; /* time of last shmat() */ + __time_t shm_dtime; /* time of last shmdt() */ + __time_t shm_ctime; /* time of last change by shmctl() */ + __pid_t shm_cpid; /* pid of creator */ + __pid_t shm_lpid; /* pid of last shmop */ + unsigned long int shm_nattch; /* number of current attaches */ + unsigned long int __unused1; + unsigned long int __unused2; + }; + +#ifdef __USE_MISC + +/* ipcs ctl commands */ +# define SHM_STAT 13 +# define SHM_INFO 14 + +/* shm_mode upper byte flags */ +# define SHM_DEST 01000 /* segment will be destroyed on last detach */ +# define SHM_LOCKED 02000 /* segment will not be swapped */ + +struct shminfo + { + unsigned long int shmmax; + unsigned long int shmmin; + unsigned long int shmmni; + unsigned long int shmseg; + unsigned long int shmall; + unsigned long int __unused1; + unsigned long int __unused2; + unsigned long int __unused3; + unsigned long int __unused4; + }; + +struct shm_info + { + int used_ids; + unsigned long int shm_tot; /* total allocated shm */ + unsigned long int shm_rss; /* total resident shm */ + unsigned long int shm_swp; /* total swapped shm */ + unsigned long int swap_attempts; + unsigned long int swap_successes; + }; + +#endif /* __USE_MISC */ diff --git a/sysdeps/unix/sysv/linux/ia64/fstatfs64.c b/sysdeps/unix/sysv/linux/ia64/fstatfs64.c new file mode 100644 index 0000000000..2be4e59ba4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/fstatfs64.c @@ -0,0 +1 @@ +/* fstatfs64 is the same as fstatfs. */ diff --git a/sysdeps/unix/sysv/linux/ia64/ftruncate64.c b/sysdeps/unix/sysv/linux/ia64/ftruncate64.c new file mode 100644 index 0000000000..673a8b525a --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/ftruncate64.c @@ -0,0 +1 @@ +/* ftruncate64 is the same as ftruncate. */ diff --git a/sysdeps/unix/sysv/linux/ia64/getrlimit64.c b/sysdeps/unix/sysv/linux/ia64/getrlimit64.c new file mode 100644 index 0000000000..9feab0e6b8 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/getrlimit64.c @@ -0,0 +1 @@ +/* getrlimit64 is the same as getrlimit. */ diff --git a/sysdeps/unix/sysv/linux/ia64/glob.c b/sysdeps/unix/sysv/linux/ia64/glob.c new file mode 100644 index 0000000000..b6da989e57 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/glob.c @@ -0,0 +1,7 @@ +#define glob64 __no_glob64_decl +#define globfree64 __no_globfree64_decl +#include <sysdeps/generic/glob.c> +#undef glob64 +#undef globfree64 +weak_alias (glob, glob64) +weak_alias (globfree, globfree64) diff --git a/sysdeps/unix/sysv/linux/ia64/glob64.c b/sysdeps/unix/sysv/linux/ia64/glob64.c new file mode 100644 index 0000000000..33918ea6a5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/glob64.c @@ -0,0 +1 @@ +/* glob64 is in glob.c */ diff --git a/sysdeps/unix/sysv/linux/ia64/ioperm.c b/sysdeps/unix/sysv/linux/ia64/ioperm.c new file mode 100644 index 0000000000..abe8fea4af --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/ioperm.c @@ -0,0 +1,211 @@ +/* Copyright (C) 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger-Tang <davidm@hpl.hp.com>. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* I/O access is restricted to ISA port space (ports 0..65535). + Modern devices hopefully are sane enough not to put any performance + critical registers in i/o space. + + On the first call to ioperm() or iopl(), the entire (E)ISA port + space is mapped into the virtual address space at address io.base. + mprotect() calls are then used to enable/disable access to ports. + Per 4KB page, there are 4 I/O ports. */ + +#include <errno.h> +#include <fcntl.h> +#include <ctype.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include <sys/types.h> +#include <sys/mman.h> + +#include <asm/page.h> +#include <asm/system.h> + +#define MAX_PORT 0x10000 + +/* + * Memory fence w/accept. This should never be used in code that is + * not IA-64 specific. + */ +#define __ia64_mf_a() __asm__ __volatile__ ("mf.a" ::: "memory") + +static struct + { + unsigned long int base; + unsigned long int page_mask; + } +io; + +__inline__ unsigned long int +io_offset (unsigned long int port) +{ + return ((port >> 2) << 12) | (port & 0xfff); +} + +int +_ioperm (unsigned long int from, unsigned long int num, int turn_on) +{ + unsigned long int addr, len, base; + int prot; + + /* this test isn't as silly as it may look like; consider overflows! */ + if (from >= MAX_PORT || from + num > MAX_PORT) + { + __set_errno (EINVAL); + return -1; + } + + if (turn_on) + { + if (!io.base) + { + unsigned long phys_io_base, len; + int fd; + + io.page_mask = ~(getpagesize() - 1); + + /* get I/O base physical address from ar.k0 as per PRM: */ + __asm__ ("mov %0=ar.k0" : "=r"(phys_io_base)); + + /* The O_SYNC flag tells the /dev/mem driver to map the + memory uncached: */ + fd = open ("/dev/mem", O_RDWR | O_SYNC); + if (fd < 0) + return -1; + + len = io_offset (MAX_PORT); +#if 1 + /* see comment below */ + base = (unsigned long int) __mmap (0, len, PROT_READ | PROT_WRITE, MAP_SHARED, + fd, phys_io_base); +#else + base = (unsigned long int) __mmap (0, len, PROT_NONE, MAP_SHARED, + fd, phys_io_base); +#endif + close (fd); + + if ((long) base == -1) + return -1; + + io.base = base; + } + prot = PROT_READ | PROT_WRITE; + } + else + { + if (!io.base) + return 0; /* never was turned on... */ + + prot = PROT_NONE; + } +#if 0 + /* We can't do mprotect because that would cause us to lose the + uncached flag that the /dev/mem driver turned on. A MAP_UNCACHED + flag seems so much cleaner... */ + addr = (io.base + io_offset (from)) & io.page_mask; + len = io.base + io_offset (from + num) - addr; + return mprotect ((void *) addr, len, prot); +#else + return 0; +#endif +} + +int +_iopl (unsigned int level) +{ + if (level > 3) + { + __set_errno (EINVAL); + return -1; + } + if (level) + return _ioperm (0, MAX_PORT, 1); + return 0; +} + +unsigned int +_inb (unsigned long int port) +{ + volatile unsigned char *addr = (void *) io.base + io_offset (port); + unsigned char ret; + + ret = *addr; + __ia64_mf_a(); + return ret; +} + +unsigned int +_inw (unsigned long int port) +{ + volatile unsigned short *addr = (void *) io.base + io_offset (port); + unsigned short ret; + + ret = *addr; + __ia64_mf_a(); + return ret; +} + +unsigned int +_inl (unsigned long int port) +{ + volatile unsigned int *addr = (void *) io.base + io_offset (port); + unsigned int ret; + + ret = *addr; + __ia64_mf_a(); + return ret; +} + +void +_outb (unsigned char val, unsigned long int port) +{ + volatile unsigned char *addr = (void *) io.base + io_offset (port); + + *addr = val; + __ia64_mf_a(); +} + +void +_outw (unsigned short val, unsigned long int port) +{ + volatile unsigned short *addr = (void *) io.base + io_offset (port); + + *addr = val; + __ia64_mf_a(); +} + +void +_outl (unsigned int val, unsigned long int port) +{ + volatile unsigned int *addr = (void *) io.base + io_offset (port); + + *addr = val; + __ia64_mf_a(); +} + +weak_alias (_ioperm, ioperm); +weak_alias (_iopl, iopl); +weak_alias (_inb, inb); +weak_alias (_inw, inw); +weak_alias (_inl, inl); +weak_alias (_outb, outb); +weak_alias (_outw, outw); +weak_alias (_outl, outl); diff --git a/sysdeps/unix/sysv/linux/ia64/pread64.c b/sysdeps/unix/sysv/linux/ia64/pread64.c new file mode 100644 index 0000000000..b7f298dea8 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/pread64.c @@ -0,0 +1 @@ +/* Empty since the pread syscall is equivalent. */ diff --git a/sysdeps/unix/sysv/linux/ia64/pwrite64.c b/sysdeps/unix/sysv/linux/ia64/pwrite64.c new file mode 100644 index 0000000000..b7f298dea8 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/pwrite64.c @@ -0,0 +1 @@ +/* Empty since the pread syscall is equivalent. */ diff --git a/sysdeps/unix/sysv/linux/ia64/readdir.c b/sysdeps/unix/sysv/linux/ia64/readdir.c new file mode 100644 index 0000000000..300ebb2629 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/readdir.c @@ -0,0 +1,7 @@ +#define readdir64 __no_readdir64_decl +#define __readdir64 __no___readdir64_decl +#include <sysdeps/unix/readdir.c> +#undef __readdir64 +strong_alias (__readdir, __readdir64) +#undef readdir64 +weak_alias (__readdir, readdir64) diff --git a/sysdeps/unix/sysv/linux/ia64/readdir64.c b/sysdeps/unix/sysv/linux/ia64/readdir64.c new file mode 100644 index 0000000000..9796431dc4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/readdir64.c @@ -0,0 +1 @@ +/* readdir64 is in readdir.c */ diff --git a/sysdeps/unix/sysv/linux/ia64/readdir64_r.c b/sysdeps/unix/sysv/linux/ia64/readdir64_r.c new file mode 100644 index 0000000000..b8fe9a31b4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/readdir64_r.c @@ -0,0 +1 @@ +/* readdir64_r is in readdir_r.c */ diff --git a/sysdeps/unix/sysv/linux/ia64/readdir_r.c b/sysdeps/unix/sysv/linux/ia64/readdir_r.c new file mode 100644 index 0000000000..adb92db6af --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/readdir_r.c @@ -0,0 +1,4 @@ +#define readdir64_r __no_readdir64_r_decl +#include <sysdeps/unix/readdir_r.c> +#undef readdir64_r +weak_alias (__readdir_r, readdir64_r) diff --git a/sysdeps/unix/sysv/linux/ia64/setrlimit64.c b/sysdeps/unix/sysv/linux/ia64/setrlimit64.c new file mode 100644 index 0000000000..8edcff0086 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/setrlimit64.c @@ -0,0 +1 @@ +/* setrlimit64 is the same as setrlimit. */ diff --git a/sysdeps/unix/sysv/linux/ia64/shmctl.c b/sysdeps/unix/sysv/linux/ia64/shmctl.c new file mode 100644 index 0000000000..dbf0782bc1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/shmctl.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1995, 1997, 1998, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <errno.h> +#include <sys/shm.h> +#include <ipc_priv.h> + +#include <sysdep.h> +#include <sys/syscall.h> + +int +shmctl (int shmid, int cmd, struct shmid_ds *buf) +{ + return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd, 0, buf); +} diff --git a/sysdeps/unix/sysv/linux/ia64/statfs64.c b/sysdeps/unix/sysv/linux/ia64/statfs64.c new file mode 100644 index 0000000000..06bc68826f --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/statfs64.c @@ -0,0 +1 @@ +/* statfs64 is the same as statfs. */ diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list index fb45729718..7b484051be 100644 --- a/sysdeps/unix/sysv/linux/ia64/syscalls.list +++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list @@ -6,7 +6,7 @@ umount2 - umount 2 __umount2 umount2 llseek EXTRA lseek 3 __llseek llseek __lseek64 lseek64 pread - pread 4 __syscall_pread __syscall_pread64 __pread pread __pread64 pread64 pwrite - pwrite 4 __syscall_pwrite __syscall_pwrite64 __pwrite pwrite __pwrite64 pwrite64 -fstatfs - fstatfs i:ip __fstatfs fstatfs fstatfs64 +fstatfs - fstatfs i:ip __fstatfs fstatfs fstatfs64 __fstatfs64 statfs - statfs i:sp __statfs statfs statfs64 mmap - mmap 6 __mmap mmap __mmap64 mmap64 getpeername - getpeername i:ipp __getpeername getpeername diff --git a/sysdeps/unix/sysv/linux/ia64/truncate64.c b/sysdeps/unix/sysv/linux/ia64/truncate64.c new file mode 100644 index 0000000000..8999768874 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/truncate64.c @@ -0,0 +1 @@ +/* truncate64 is the same as truncate. */ |