diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2008-12-10 16:39:54 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2008-12-10 16:39:54 +0000 |
commit | 0f1e140e796f55cf5f07d39707f3e88d335f4ff1 (patch) | |
tree | e44d49e4cb8da17389d4ffa57e784f7ee91d3381 /ports/sysdeps/unix/sysv/linux | |
parent | 8acd6170c246b159d26f05d85fa256746391d3d7 (diff) |
Merge changes between r7357 and r7510 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@7511 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'ports/sysdeps/unix/sysv/linux')
129 files changed, 9969 insertions, 2 deletions
diff --git a/ports/sysdeps/unix/sysv/linux/alpha/Implies b/ports/sysdeps/unix/sysv/linux/alpha/Implies new file mode 100644 index 000000000..1616efecb --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/Implies @@ -0,0 +1,4 @@ +unix/sysv/linux/wordsize-64 +# These supply the ABI compatibility for when long double was double. +ieee754/ldbl-64-128 +ieee754/ldbl-opt diff --git a/ports/sysdeps/unix/sysv/linux/alpha/Makefile b/ports/sysdeps/unix/sysv/linux/alpha/Makefile new file mode 100644 index 000000000..f64f23fd7 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/Makefile @@ -0,0 +1,38 @@ +ifeq ($(subdir),posix) +sysdep_routines += oldglob +endif + +ifeq ($(subdir),stdlib) +gen-as-const-headers += ucontext-offsets.sym +endif + +ifeq ($(subdir),misc) +sysdep_headers += alpha/ptrace.h alpha/regdef.h sys/io.h + +sysdep_routines += ieee_get_fp_control ieee_set_fp_control \ + ioperm llseek + +# Support old timeval32 entry points +sysdep_routines += osf_select osf_gettimeofday osf_settimeofday \ + osf_getitimer osf_setitimer osf_utimes \ + osf_getrusage osf_wait4 + +# Support old ipc control +sysdep_routines += oldmsgctl oldsemctl oldshmctl + +CFLAGS-ioperm.c = -Wa,-mev6 +endif + +ifeq ($(subdir),signal) +sysdep_routines += rt_sigaction +endif + +ifeq ($(subdir),math) +# These 2 routines are normally in libgcc{.a,_s.so.1}. +# However, alpha -mlong-double-128 libgcc relies on +# glibc providing _Ots* routines and without these files +# glibc relies on __multc3/__divtc3 only provided +# by libgcc if configured with -mlong-double-128. +# Provide these routines here as well. +libm-routines += multc3 divtc3 +endif # math diff --git a/ports/sysdeps/unix/sysv/linux/alpha/Versions b/ports/sysdeps/unix/sysv/linux/alpha/Versions new file mode 100644 index 000000000..8709dd2a3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/Versions @@ -0,0 +1,94 @@ +libc { + # The comment lines with "#errlist-compat" are magic; see + # sysdeps/gnu/errlist-compat.awk. + # When you get an error from errlist-compat.awk, you need to add a new + # version here. Don't do this blindly, since this means changing the ABI + # for all GNU/Linux configurations. + + GLIBC_2.0 { + #errlist-compat 131 + _sys_errlist; sys_errlist; _sys_nerr; sys_nerr; + + # Unfortunately in wider use. + _inb; _inw; _inl; _outb; _outw; _outl; _bus_base; _bus_base_sparse; + _hae_shift; + + # Exception handling support functions from libgcc + __register_frame; __register_frame_table; __deregister_frame; + __frame_state_for; __register_frame_info_table; + + # b* + bus_base; bus_base_sparse; + + # h* + hae_shift; + + # i* + inb; inl; inw; ioperm; iopl; + + # o* + outb; outl; outw; + + # p* + pciconfig_read; pciconfig_write; sethae; + } + GLIBC_2.1 { + #errlist-compat 131 + _sys_errlist; sys_errlist; _sys_nerr; sys_nerr; + + # Linux/Alpha 64-bit timeval functions. + __select; select; + adjtime; adjtimex; __adjtimex; + __gettimeofday; + + # glob interface change + glob; globfree; + + # limit type change + getrusage; + + # time type change + gettimeofday; getitimer; + + # i* + ieee_get_fp_control; ieee_set_fp_control; + + # s* + setitimer; settimeofday; + + # u* + utimes; + + # w* + wait4; + } + GLIBC_2.1.4 { + pciconfig_iobase; + } + GLIBC_2.2.2 { + # w* + wordexp; + } + GLIBC_2.3 { + #errlist-compat 132 + _sys_errlist; sys_errlist; _sys_nerr; sys_nerr; + } + GLIBC_2.4 { + #errlist-compat 138 + _sys_errlist; sys_errlist; _sys_nerr; sys_nerr; + } + GLIBC_PRIVATE { + __libc_alpha_cache_shape; + } +} +ld { + GLIBC_PRIVATE { + __libc_alpha_cache_shape; + } +} +librt { + GLIBC_2.3 { + # AIO functions. + aio_cancel; aio_cancel64; + } +} diff --git a/ports/sysdeps/unix/sysv/linux/alpha/a.out.h b/ports/sysdeps/unix/sysv/linux/alpha/a.out.h new file mode 100644 index 000000000..a7699f0fe --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/a.out.h @@ -0,0 +1,197 @@ +#ifndef __A_OUT_GNU_H__ +#define __A_OUT_GNU_H__ + +#include <bits/a.out.h> + +#define __GNU_EXEC_MACROS__ + +/* + * OSF/1 ECOFF header structs. ECOFF files consist of: + * - a file header (struct filehdr), + * - an a.out header (struct aouthdr), + * - one or more section headers (struct scnhdr). + * The filhdr's "f_nscns" field contains the + * number of section headers. + */ + +struct filehdr +{ + /* OSF/1 "file" header */ + unsigned short f_magic, f_nscns; + unsigned int f_timdat; + unsigned long f_symptr; + unsigned int f_nsyms; + unsigned short f_opthdr, f_flags; +}; + +struct aouthdr +{ + unsigned long info; /* After that it looks quite normal.. */ + unsigned long tsize; + unsigned long dsize; + unsigned long bsize; + unsigned long entry; + unsigned long text_start; /* With a few additions that actually make sense. */ + unsigned long data_start; + unsigned long bss_start; + unsigned int gprmask, fprmask; /* Bitmask of general & floating point regs used in binary. */ + unsigned long gpvalue; +}; + +struct scnhdr +{ + char s_name[8]; + unsigned long s_paddr; + unsigned long s_vaddr; + unsigned long s_size; + unsigned long s_scnptr; + unsigned long s_relptr; + unsigned long s_lnnoptr; + unsigned short s_nreloc; + unsigned short s_nlnno; + unsigned int s_flags; +}; + +struct exec +{ + /* OSF/1 "file" header */ + struct filehdr fh; + struct aouthdr ah; +}; + +#define a_info ah.info +#define a_text ah.tsize +#define a_data ah.dsize +#define a_bss ah.bsize +#define a_entry ah.entry +#define a_textstart ah.text_start +#define a_datastart ah.data_start +#define a_bssstart ah.bss_start +#define a_gprmask ah.gprmask +#define a_fprmask ah.fprmask +#define a_gpvalue ah.gpvalue + + +#define AOUTHSZ sizeof(struct aouthdr) +#define SCNHSZ sizeof(struct scnhdr) +#define SCNROUND 16 + +enum machine_type +{ + M_OLDSUN2 = 0, + M_68010 = 1, + M_68020 = 2, + M_SPARC = 3, + M_386 = 100, + M_MIPS1 = 151, + M_MIPS2 = 152 +}; + +#define N_MAGIC(exec) ((exec).a_info & 0xffff) +#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff)) +#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) +#define N_SET_INFO(exec, magic, type, flags) \ + ((exec).a_info = ((magic) & 0xffff) \ + | (((int)(type) & 0xff) << 16) \ + | (((flags) & 0xff) << 24)) +#define N_SET_MAGIC(exec, magic) \ + ((exec).a_info = ((exec).a_info & 0xffff0000) | ((magic) & 0xffff)) +#define N_SET_MACHTYPE(exec, machtype) \ + ((exec).a_info = \ + ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16)) +#define N_SET_FLAGS(exec, flags) \ + ((exec).a_info = \ + ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) + +/* Code indicating object file or impure executable. */ +#define OMAGIC 0407 +/* Code indicating pure executable. */ +#define NMAGIC 0410 +/* Code indicating demand-paged executable. */ +#define ZMAGIC 0413 +/* This indicates a demand-paged executable with the header in the text. + The first page is unmapped to help trap NULL pointer references. */ +#define QMAGIC 0314 +/* Code indicating core file. */ +#define CMAGIC 0421 + +#define N_TRSIZE(x) 0 +#define N_DRSIZE(x) 0 +#define N_SYMSIZE(x) 0 +#define N_BADMAG(x) \ + (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \ + && N_MAGIC(x) != ZMAGIC && N_MAGIC(x) != QMAGIC) +#define _N_HDROFF(x) (1024 - sizeof (struct exec)) +#define N_TXTOFF(x) \ + ((long) N_MAGIC(x) == ZMAGIC ? 0 : \ + (sizeof (struct exec) + (x).fh.f_nscns * SCNHSZ + SCNROUND - 1) \ + & ~(SCNROUND - 1)) + +#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text) +#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data) +#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x)) +#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x)) +#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x)) + +/* Address of text segment in memory after it is loaded. */ +#define N_TXTADDR(x) ((x).a_textstart) + +/* Address of data segment in memory after it is loaded. */ +#define SEGMENT_SIZE 1024 + +#define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1)) +#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text) + +#define N_DATADDR(x) ((x).a_datastart) +#define N_BSSADDR(x) ((x).a_bssstart) + +#if !defined (N_NLIST_DECLARED) +struct nlist +{ + union + { + char *n_name; + struct nlist *n_next; + long n_strx; + } n_un; + unsigned char n_type; + char n_other; + short n_desc; + unsigned long n_value; +}; +#endif /* no N_NLIST_DECLARED. */ + +#define N_UNDF 0 +#define N_ABS 2 +#define N_TEXT 4 +#define N_DATA 6 +#define N_BSS 8 +#define N_FN 15 +#define N_EXT 1 +#define N_TYPE 036 +#define N_STAB 0340 +#define N_INDR 0xa +#define N_SETA 0x14 /* Absolute set element symbol. */ +#define N_SETT 0x16 /* Text set element symbol. */ +#define N_SETD 0x18 /* Data set element symbol. */ +#define N_SETB 0x1A /* Bss set element symbol. */ +#define N_SETV 0x1C /* Pointer to set vector in data area. */ + +#if !defined (N_RELOCATION_INFO_DECLARED) +/* This structure describes a single relocation to be performed. + The text-relocation section of the file is a vector of these structures, + all of which apply to the text section. + Likewise, the data-relocation section applies to the data section. */ + +struct relocation_info +{ + int r_address; + unsigned int r_symbolnum:24; + unsigned int r_pcrel:1; + unsigned int r_length:2; + unsigned int r_extern:1; + unsigned int r_pad:4; +}; +#endif /* no N_RELOCATION_INFO_DECLARED. */ + +#endif /* __A_OUT_GNU_H__ */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/adjtime.c b/ports/sysdeps/unix/sysv/linux/alpha/adjtime.c new file mode 100644 index 000000000..1700524d3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/adjtime.c @@ -0,0 +1,220 @@ +/* Copyright (C) 1998,2000,2002,2003,2004,2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <shlib-compat.h> +#include <sysdep.h> +#include <sys/time.h> +#include <kernel-features.h> + +#if !defined __ASSUME_TIMEVAL64 || SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) +struct timeval32 +{ + int tv_sec, tv_usec; +}; + +struct timex32 { + unsigned int modes; /* mode selector */ + long offset; /* time offset (usec) */ + long freq; /* frequency offset (scaled ppm) */ + long maxerror; /* maximum error (usec) */ + long esterror; /* estimated error (usec) */ + int status; /* clock command/status */ + long constant; /* pll time constant */ + long precision; /* clock precision (usec) (read only) */ + long tolerance; /* clock frequency tolerance (ppm) + * (read only) + */ + struct timeval32 time; /* (read only) */ + long tick; /* (modified) usecs between clock ticks */ + + long ppsfreq; /* pps frequency (scaled ppm) (ro) */ + long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + long stabil; /* pps stability (scaled ppm) (ro) */ + long jitcnt; /* jitter limit exceeded (ro) */ + long calcnt; /* calibration intervals (ro) */ + long errcnt; /* calibration errors (ro) */ + long stbcnt; /* stability limit exceeded (ro) */ + + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; +}; + +#define TIMEVAL timeval32 +#define TIMEX timex32 +#define ADJTIME attribute_compat_text_section __adjtime_tv32 +#define ADJTIMEX(x) INLINE_SYSCALL (old_adjtimex, 1, x) +#define ADJTIMEX32(x) INLINE_SYSCALL (old_adjtimex, 1, x) +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) +#define LINKAGE +#else +#define LINKAGE static +#endif + +LINKAGE int ADJTIME (const struct TIMEVAL *itv, struct TIMEVAL *otv); + +#include <sysdeps/unix/sysv/linux/adjtime.c> + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) +int +attribute_compat_text_section +__adjtimex_tv32 (struct timex32 *tx) { return ADJTIMEX (tx); } +strong_alias (__adjtimex_tv32, __adjtimex_tv32_1); +strong_alias (__adjtimex_tv32, __adjtimex_tv32_2); +compat_symbol (libc, __adjtimex_tv32_1, __adjtimex, GLIBC_2_0); +compat_symbol (libc, __adjtimex_tv32_2, adjtimex, GLIBC_2_0); +compat_symbol (libc, __adjtime_tv32, adjtime, GLIBC_2_0); +#endif +#endif /* !__ASSUME_TIMEVAL64 || SHLIB_COMPAT */ + +#undef TIMEVAL +#define TIMEVAL timeval +#undef TIMEX +#define TIMEX timex +#undef ADJTIMEX +#define ADJTIMEX(x) INLINE_SYSCALL (adjtimex, 1, x) + +#undef LINKAGE +#undef ADJTIME +#if !defined __ASSUME_TIMEVAL64 +#define LINKAGE static +#define ADJTIME __adjtime_tv64 +#endif + +#include <sysdeps/unix/sysv/linux/adjtime.c> +#include <stdbool.h> + +#if !defined __ASSUME_TIMEVAL64 +static bool missing_adjtimex; + +int +__adjtime (itv, otv) + const struct timeval *itv; + struct timeval *otv; +{ + struct timeval32 itv32, otv32; + int ret; + + switch (missing_adjtimex) + { + case false: + ret = __adjtime_tv64 (itv, otv); + if (ret && errno == ENOSYS) + missing_adjtimex = 1; + else + break; + + /* FALLTHRU */ + + default: + itv32.tv_sec = itv->tv_sec; + itv32.tv_usec = itv->tv_usec; + ret = __adjtime_tv32 (&itv32, &otv32); + if (ret == 0) + { + otv->tv_sec = otv32.tv_sec; + otv->tv_usec = otv32.tv_usec; + } + break; + } + + return ret; +} +#endif + +versioned_symbol (libc, __adjtime, adjtime, GLIBC_2_1); + +int +__adjtimex_tv64 (struct timex *tx) +{ +#if defined __ASSUME_TIMEVAL64 + return ADJTIMEX (tx); +#else + struct timex32 tx32; + int ret; + + switch (missing_adjtimex) + { + case false: + ret = ADJTIMEX (tx); + if (ret && errno == ENOSYS) + missing_adjtimex = 1; + else + break; + + /* FALLTHRU */ + + default: + tx32.modes = tx->modes; + tx32.offset = tx->offset; + tx32.freq = tx->freq; + tx32.maxerror = tx->maxerror; + tx32.esterror = tx->esterror; + tx32.status = tx->status; + tx32.constant = tx->constant; + tx32.precision = tx->precision; + tx32.tolerance = tx->tolerance; + tx32.time.tv_sec = tx->time.tv_sec; + tx32.time.tv_sec = tx->time.tv_usec; + tx32.tick = tx->tick; + tx32.ppsfreq = tx->ppsfreq; + tx32.jitter = tx->jitter; + tx32.shift = tx->shift; + tx32.stabil = tx->stabil; + tx32.jitcnt = tx->jitcnt; + tx32.calcnt = tx->calcnt; + tx32.errcnt = tx->errcnt; + tx32.stbcnt = tx->stbcnt; + + ret = ADJTIMEX32 (&tx32); + if (ret == 0) + { + tx->modes = tx32.modes; + tx->offset = tx32.offset; + tx->freq = tx32.freq; + tx->maxerror = tx32.maxerror; + tx->esterror = tx32.esterror; + tx->status = tx32.status; + tx->constant = tx32.constant; + tx->precision = tx32.precision; + tx->tolerance = tx32.tolerance; + tx->time.tv_sec = tx32.time.tv_sec; + tx->time.tv_usec = tx32.time.tv_sec; + tx->tick = tx32.tick; + tx->ppsfreq = tx32.ppsfreq; + tx->jitter = tx32.jitter; + tx->shift = tx32.shift; + tx->stabil = tx32.stabil; + tx->jitcnt = tx32.jitcnt; + tx->calcnt = tx32.calcnt; + tx->errcnt = tx32.errcnt; + tx->stbcnt = tx32.stbcnt; + } + break; + } + + return ret; +#endif +} + +strong_alias (__adjtimex_tv64, __adjtimex_internal); +strong_alias (__adjtimex_tv64, __adjtimex_tv64p); +weak_alias (__adjtimex_tv64, ntp_adjtime); +versioned_symbol (libc, __adjtimex_tv64, __adjtimex, GLIBC_2_1); +versioned_symbol (libc, __adjtimex_tv64p, adjtimex, GLIBC_2_1); diff --git a/ports/sysdeps/unix/sysv/linux/alpha/alpha/ptrace.h b/ports/sysdeps/unix/sysv/linux/alpha/alpha/ptrace.h new file mode 100644 index 000000000..57b96d64d --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/alpha/ptrace.h @@ -0,0 +1,18 @@ +#ifndef __alpha_ptrace_h__ +#define __alpha_ptrace_h__ + +/* + * Mostly for OSF/1 compatibility. + */ + +#define REG_BASE 0 +#define NGP_REGS 32 +#define NFP_REGS 32 + +#define GPR_BASE REG_BASE +#define FPR_BASE (GPR_BASE+NGP_REGS) +#define PC (FPR_BASE+NFP_REGS) +#define SPR_PS (PC+1) +#define NPTRC_REGS (SPR_PS+1) + +#endif /* __alpha_ptrace_h__ */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/alpha/regdef.h b/ports/sysdeps/unix/sysv/linux/alpha/alpha/regdef.h new file mode 100644 index 000000000..142df9c4f --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/alpha/regdef.h @@ -0,0 +1,44 @@ +#ifndef __alpha_regdef_h__ +#define __alpha_regdef_h__ + +#define v0 $0 /* function return value */ + +#define t0 $1 /* temporary registers (caller-saved) */ +#define t1 $2 +#define t2 $3 +#define t3 $4 +#define t4 $5 +#define t5 $6 +#define t6 $7 +#define t7 $8 + +#define s0 $9 /* saved-registers (callee-saved registers) */ +#define s1 $10 +#define s2 $11 +#define s3 $12 +#define s4 $13 +#define s5 $14 +#define s6 $15 +#define fp s6 /* frame-pointer (s6 in frame-less procedures) */ + +#define a0 $16 /* argument registers (caller-saved) */ +#define a1 $17 +#define a2 $18 +#define a3 $19 +#define a4 $20 +#define a5 $21 + +#define t8 $22 /* more temps (caller-saved) */ +#define t9 $23 +#define t10 $24 +#define t11 $25 +#define ra $26 /* return address register */ +#define t12 $27 + +#define pv t12 /* procedure-variable register */ +#define AT $at /* assembler temporary */ +#define gp $29 /* global pointer */ +#define sp $30 /* stack pointer */ +#define zero $31 /* reads as zero, writes are noops */ + +#endif /* __alpha_regdef_h__ */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies b/ports/sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies new file mode 100644 index 000000000..0d7000dc2 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/alphaev6/fpu/Implies @@ -0,0 +1,2 @@ +# Override ldbl-opt with alpha specific routines. +alpha/alphaev6/fpu diff --git a/ports/sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies b/ports/sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies new file mode 100644 index 000000000..617c388d2 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/alphaev67/fpu/Implies @@ -0,0 +1,2 @@ +# Override ldbl-opt with alpha specific routines. +alpha/alphaev67/fpu diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/a.out.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/a.out.h new file mode 100644 index 000000000..82a3dd4c0 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/a.out.h @@ -0,0 +1,9 @@ +#ifndef __A_OUT_GNU_H__ +# error "Never use <bits/a.out.h> directly; include <a.out.h> instead." +#endif +#ifndef __A_OUT_GNU_H__ +# error "Never use <bits/a.out.h> directly; include <a.out.h> instead." +#endif +#ifndef __A_OUT_GNU_H__ +# error "Never use <bits/a.out.h> directly; include <a.out.h> instead." +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/dirent.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/dirent.h new file mode 100644 index 000000000..6ed74783a --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/dirent.h @@ -0,0 +1,55 @@ +/* Copyright (C) 1996, 1997 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _BITS_DIRENT_H +#define _BITS_DIRENT_H 1 + +struct dirent + { +#ifdef __USE_FILE_OFFSET64 + __ino64_t d_ino; +#else + __ino_t d_ino; + int __pad; +#endif + __off_t d_off; + unsigned short int d_reclen; + unsigned char d_type; + char d_name[256]; /* We must not include limits.h! */ + }; + +#ifdef __USE_LARGEFILE64 +/* Note dirent64 is the same as dirent. */ +struct dirent64 + { + __ino64_t d_ino; + __off64_t d_off; + unsigned short int d_reclen; + unsigned char d_type; + char d_name[256]; /* We must not include limits.h! */ + }; +#endif + +#define d_fileno d_ino /* Backwards compatibility. */ + +#undef _DIRENT_HAVE_D_NAMLEN +#define _DIRENT_HAVE_D_RECLEN +#define _DIRENT_HAVE_D_OFF +#define _DIRENT_HAVE_D_TYPE + +#endif /* bits/dirent.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/elfclass.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/elfclass.h new file mode 100644 index 000000000..e5aa4a0fb --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/elfclass.h @@ -0,0 +1,14 @@ +/* This file specifies the native word size of the machine, which indicates + the ELF file class used for executables and shared objects on this + machine. */ + +#ifndef _LINK_H +# error "Never use <bits/elfclass.h> directly; include <link.h> instead." +#endif + +#include <bits/wordsize.h> + +#define __ELF_NATIVE_CLASS __WORDSIZE + +/* Linux/Alpha is exceptional as it has .hash section with 64 bit entries. */ +typedef uint64_t Elf_Symndx; diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/errno.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/errno.h new file mode 100644 index 000000000..8b2f152a1 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/errno.h @@ -0,0 +1,58 @@ +/* Error constants. Linux/Alpha specific version. + Copyright (C) 1996,1997,1998,1999,2002,2005 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef _ERRNO_H + +# undef EDOM +# undef EILSEQ +# undef ERANGE +# include <linux/errno.h> + +/* Linux has no ENOTSUP error code. */ +# define ENOTSUP EOPNOTSUPP + +# ifndef ECANCELED +# define ECANCELED 131 +# endif + +/* Support for error codes to support robust mutexes was added later, too. */ +# ifndef EOWNERDEAD +# define EOWNERDEAD 136 +# define ENOTRECOVERABLE 137 +# endif + +# ifndef __ASSEMBLER__ +/* Function to get address of global `errno' variable. */ +extern int *__errno_location (void) __THROW __attribute__ ((__const__)); + +# if !defined _LIBC || defined _LIBC_REENTRANT +/* When using threads, errno is a per-thread value. */ +# define errno (*__errno_location ()) +# endif +# endif /* !__ASSEMBLER__ */ +#endif /* _ERRNO_H */ + +#if !defined _ERRNO_H && defined __need_Emath +/* This is ugly but the kernel header is not clean enough. We must + define only the values EDOM, EILSEQ and ERANGE in case __need_Emath is + defined. */ +# define EDOM 33 /* Math argument out of domain of function. */ +# define EILSEQ 116 /* Illegal byte sequence. */ +# define ERANGE 34 /* Math result not representable. */ +#endif /* !_ERRNO_H && __need_Emath */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h new file mode 100644 index 000000000..710bace21 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/fcntl.h @@ -0,0 +1,232 @@ +/* O_*, F_*, FD_* bit values for Linux. + Copyright (C) 1995-2000,2004,2005,2006,2007 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _FCNTL_H +# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." +#endif + +#include <sys/types.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif + + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 01000 /* not fcntl */ +#define O_TRUNC 02000 /* not fcntl */ +#define O_EXCL 04000 /* not fcntl */ +#define O_NOCTTY 010000 /* not fcntl */ + +#define O_NONBLOCK 00004 +#define O_APPEND 00010 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 040000 +#define O_FSYNC O_SYNC +#define O_ASYNC 020000 /* fcntl, for BSD compatibility */ + +#ifdef __USE_GNU +# define O_DIRECTORY 0100000 /* Must be a directory. */ +# define O_NOFOLLOW 0200000 /* Do not follow links. */ +# define O_DIRECT 02000000 /* Direct disk access. */ +# define O_NOATIME 04000000 /* Do not set atime. */ +# define O_CLOEXEC 010000000 /* Set close_on_exec. */ +#endif + +#ifdef __USE_LARGEFILE64 +/* Not necessary, files are always with 64bit off_t. */ +# define O_LARGEFILE 0 +#endif + +/* For now Linux has synchronisity options for data and read operations. + We define the symbols here but let them do the same as O_SYNC since + this is a superset. */ +#if defined __USE_POSIX199309 || defined __USE_UNIX98 +# define O_DSYNC O_SYNC /* Synchronize data. */ +# define O_RSYNC O_SYNC /* Synchronize read operations. */ +#endif + +/* Values for the second argument to `fcntl'. */ +#define F_DUPFD 0 /* Duplicate file descriptor. */ +#define F_GETFD 1 /* Get file descriptor flags. */ +#define F_SETFD 2 /* Set file descriptor flags. */ +#define F_GETFL 3 /* Get file status flags. */ +#define F_SETFL 4 /* Set file status flags. */ +#define F_GETLK 7 /* Get record locking info. */ +#define F_SETLK 8 /* Set record locking info (non-blocking). */ +#define F_SETLKW 9 /* Set record locking info (blocking). */ +#define F_GETLK64 F_GETLK /* Get record locking info. */ +#define F_SETLK64 F_SETLK /* Set record locking info (non-blocking). */ +#define F_SETLKW64 F_SETLKW /* Set record locking info (blocking). */ + +#if defined __USE_BSD || defined __USE_UNIX98 +# define F_SETOWN 5 /* Get owner of socket (receiver of SIGIO). */ +# define F_GETOWN 6 /* Set owner of socket (receiver of SIGIO). */ +#endif + +#ifdef __USE_GNU +# define F_SETSIG 10 /* Set number of signal to be sent. */ +# define F_GETSIG 11 /* Get number of signal to be sent. */ +#endif + +#ifdef __USE_GNU +# define F_SETLEASE 1024 /* Set a lease. */ +# define F_GETLEASE 1025 /* Enquire what lease is active. */ +# define F_NOTIFY 1026 /* Request notfications on a directory. */ +# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with + close-on-exit set. */ +#endif + +/* for F_[GET|SET]FD */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* For posix fcntl() and `l_type' field of a `struct flock' for lockf() */ +#define F_RDLCK 1 /* Read lock. */ +#define F_WRLCK 2 /* Write lock. */ +#define F_UNLCK 8 /* Remove lock. */ + +/* for old implementation of bsd flock () */ +#define F_EXLCK 16 /* or 3 */ +#define F_SHLCK 32 /* or 4 */ + +/* Operations for bsd flock(), also used by the kernel implementation */ +#ifdef __USE_BSD +# define LOCK_SH 1 /* shared lock */ +# define LOCK_EX 2 /* exclusive lock */ +# define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +# define LOCK_UN 8 /* remove lock */ +#endif + +#ifdef __USE_GNU +# define LOCK_MAND 32 /* This is a mandatory flock: */ +# define LOCK_READ 64 /* ... which allows concurrent read operations. */ +# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ +# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ +#endif + +#ifdef __USE_GNU +/* Types of directory notifications that may be requested with F_NOTIFY. */ +# define DN_ACCESS 0x00000001 /* File accessed. */ +# define DN_MODIFY 0x00000002 /* File modified. */ +# define DN_CREATE 0x00000004 /* File created. */ +# define DN_DELETE 0x00000008 /* File removed. */ +# define DN_RENAME 0x00000010 /* File renamed. */ +# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ +# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ +#endif + +/* We don't need to support __USE_FILE_OFFSET64. */ +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + + +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +# define FAPPEND O_APPEND +# define FFSYNC O_FSYNC +# define FASYNC O_ASYNC +# define FNONBLOCK O_NONBLOCK +# define FNDELAY O_NDELAY +#endif /* Use BSD. */ + +/* Advise to `posix_fadvise'. */ +#ifdef __USE_XOPEN2K +# define POSIX_FADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_FADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ +# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ +#endif + + +#ifdef __USE_GNU +/* Flags for SYNC_FILE_RANGE. */ +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ + +/* Flags for SPLICE and VMSPLICE. */ +# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */ +# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing + (but we may still block on the fd + we splice from/to). */ +# define SPLICE_F_MORE 4 /* Expect more data. */ +# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ +#endif + +__BEGIN_DECLS + +#ifdef __USE_GNU + +/* Provide kernel hint to read ahead. */ +extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) + __THROW; + + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + + +/* Splice address range into a pipe. */ +extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, + size_t __count, unsigned int __flags); + +/* Splice two files together. */ +extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, + __off64_t *__offout, size_t __len, + unsigned int __flags); + +/* In-kernel implementation of tee for pipe buffers. */ +extern ssize_t tee (int __fdin, int __fdout, size_t __len, + unsigned int __flags); + +#endif + +__END_DECLS diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/ioctls.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/ioctls.h new file mode 100644 index 000000000..c525046e5 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/ioctls.h @@ -0,0 +1,37 @@ +/* Copyright (C) 1996, 1997 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_IOCTL_H +# error "Never use <bits/ioctls.h> directly; include <sys/ioctl.h> instead." +#endif + +/* Use the definitions from the kernel header files. */ +#include <asm/ioctls.h> + +/* Oh well, this is necessary since the kernel data structure is + different from the user-level version. */ +#undef TCGETS +#undef TCSETS +#undef TCSETSW +#undef TCSETSF +#define TCGETS _IOR ('t', 19, char[44]) +#define TCSETS _IOW ('t', 20, char[44]) +#define TCSETSW _IOW ('t', 21, char[44]) +#define TCSETSF _IOW ('t', 22, char[44]) + +#include <linux/sockios.h> diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/ipc.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/ipc.h new file mode 100644 index 000000000..77f3c938d --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/ipc.h @@ -0,0 +1,55 @@ +/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; 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 <bits/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. */ +#ifdef __USE_GNU +# define IPC_INFO 3 /* See ipcs. */ +#endif + +/* 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. */ + unsigned int uid; /* Owner's user ID. */ + unsigned int gid; /* Owner's group ID. */ + unsigned int cuid; /* Creator's user ID. */ + unsigned int cgid; /* Creator's group ID. */ + unsigned int 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/ports/sysdeps/unix/sysv/linux/alpha/bits/mman.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/mman.h new file mode 100644 index 000000000..2f0e56491 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/mman.h @@ -0,0 +1,118 @@ +/* Definitions for POSIX memory map interface. Linux/Alpha version. + Copyright (C) 1997, 1998, 2000, 2003, 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_MMAN_H +# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." +#endif + +/* The following definitions basically come from the kernel headers. + But the kernel header is not namespace clean. */ + + +/* Protections are chosen from these bits, OR'd together. The + implementation does not necessarily support PROT_EXEC or PROT_WRITE + without PROT_READ. The only guarantees are that no writing will be + allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ + +#define PROT_READ 0x1 /* Page can be read. */ +#define PROT_WRITE 0x2 /* Page can be written. */ +#define PROT_EXEC 0x4 /* Page can be executed. */ +#define PROT_NONE 0x0 /* Page can not be accessed. */ +#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of + growsdown vma (mprotect only). */ +#define PROT_GROWSUP 0x02000000 /* Extend change to start of + growsup vma (mprotect only). */ + +/* Sharing types (must choose one and only one of these). */ +#define MAP_SHARED 0x01 /* Share changes. */ +#define MAP_PRIVATE 0x02 /* Changes are private. */ +#ifdef __USE_MISC +# define MAP_TYPE 0x0f /* Mask for type of mapping. */ +#endif + +/* Other flags. */ +#define MAP_FIXED 0x100 /* Interpret addr exactly. */ +#ifdef __USE_MISC +# define MAP_FILE 0 +# define MAP_ANONYMOUS 0x10 /* Don't use a file. */ +# define MAP_ANON MAP_ANONYMOUS +#endif + +/* Not used by Linux, but here to make sure we don't clash with + OSF/1 defines. */ +#if 0 && defined __USE_BSD +# define MAP_HASSEMAPHORE 0x0200 +# define MAP_INHERIT 0x0400 +# define MAP_UNALIGNED 0x0800 +#endif + +/* These are Linux-specific. */ +#ifdef __USE_MISC +# define MAP_GROWSDOWN 0x01000 /* Stack-like segment. */ +# define MAP_DENYWRITE 0x02000 /* ETXTBSY */ +# define MAP_EXECUTABLE 0x04000 /* Mark it as an executable. */ +# define MAP_LOCKED 0x08000 /* Lock the mapping. */ +# define MAP_NORESERVE 0x10000 /* Don't check for reservations. */ +# define MAP_POPULATE 0x20000 /* Populate (prefault) pagetables. */ +# define MAP_NONBLOCK 0x40000 /* Do not block on IO. */ +#endif + +/* Flags to `msync'. */ +#define MS_ASYNC 1 /* Sync memory asynchronously. */ +#define MS_SYNC 2 /* Synchronous memory sync. */ +#define MS_INVALIDATE 4 /* Invalidate the caches. */ + +/* Flags for `mlockall'. */ +#define MCL_CURRENT 8192 /* Lock all currently mapped pages. */ +#define MCL_FUTURE 16384 /* Lock all additions to address + space. */ + +/* Flags for `mremap'. */ +#ifdef __USE_GNU +# define MREMAP_MAYMOVE 1 +# define MREMAP_FIXED 2 +#endif + +/* Advice to `madvise'. */ +#ifdef __USE_BSD +# define MADV_NORMAL 0 /* No further special treatment. */ +# define MADV_RANDOM 1 /* Expect random page references. */ +# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define MADV_WILLNEED 3 /* Will need these pages. */ +# define MADV_DONTNEED 6 /* Don't need these pages. */ +# define MADV_REMOVE 9 /* Remove these pages and resources. */ +# define MADV_DONTFORK 10 /* Do not inherit across fork. */ +# define MADV_DOFORK 11 /* Do inherit across fork. */ +#endif + +/* The POSIX people had to invent similar names for the same things. */ +#ifdef __USE_XOPEN2K +# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_MADV_DONTNEED 6 /* Don't need these pages. */ +#endif + +/* Not used by Linux, but here to make sure we don't clash with + OSF/1 defines. */ +#if 0 && defined __USE_BSD +# define MADV_DONTNEED_COMPAT 4 /* Old version? */ +# define MADV_SPACEAVAIL 5 /* Ensure resources are available. */ +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/msq.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/msq.h new file mode 100644 index 000000000..ab251eaf7 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/msq.h @@ -0,0 +1,74 @@ +/* Copyright (C) 1995, 1996, 1997, 2000 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_MSG_H +# error "Never use <bits/msq.h> directly; include <sys/msg.h> instead." +#endif + +#include <bits/types.h> + +/* Define options for message queue functions. */ +#define MSG_NOERROR 010000 /* no error if message is too big */ +#ifdef __USE_GNU +# define MSG_EXCEPT 020000 /* recv any msg except of specified type */ +#endif + +/* Types used in the structure definition. */ +typedef unsigned long int msgqnum_t; +typedef unsigned long int msglen_t; + + +/* Structure of record for one message inside the kernel. + The type `struct msg' is opaque. */ +struct msqid_ds +{ + struct ipc_perm msg_perm; /* structure describing operation permission */ + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgrcv command */ + __time_t msg_ctime; /* time of last change */ + unsigned long int __msg_cbytes; /* current number of bytes on queue */ + msgqnum_t msg_qnum; /* number of messages currently on queue */ + msglen_t msg_qbytes; /* max number of bytes allowed on queue */ + __pid_t msg_lspid; /* pid of last msgsnd() */ + __pid_t msg_lrpid; /* pid of last msgrcv() */ + unsigned long int __unused1; + unsigned long int __unused2; +}; + +#ifdef __USE_MISC + +# define msg_cbytes __msg_cbytes + +/* ipcs ctl commands */ +# define MSG_STAT 11 +# define MSG_INFO 12 + +/* buffer for msgctl calls IPC_INFO, MSG_INFO */ +struct msginfo + { + int msgpool; + int msgmap; + int msgmax; + int msgmnb; + int msgmni; + int msgssz; + int msgtql; + unsigned short int msgseg; + }; + +#endif /* __USE_MISC */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/netdb.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/netdb.h new file mode 100644 index 000000000..e3664fd29 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/netdb.h @@ -0,0 +1,35 @@ +/* Copyright (C) 1996, 1997, 1998, 1999, 2000 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NETDB_H +# error "Never include <bits/netdb.h> directly; use <netdb.h> instead." +#endif + + +/* Description of data base entry for a single network. NOTE: here a + poor assumption is made. The network number is expected to fit + into an unsigned long int variable. */ +struct netent +{ + char *n_name; /* Official name of network. */ + char **n_aliases; /* Alias list. */ + int n_addrtype; /* Net address type. */ + /* XXX We should probably use uint32_t for the field and ensure + compatiblity by adding appropriate padding. */ + unsigned long int n_net; /* Network number. */ +}; diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/resource.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/resource.h new file mode 100644 index 000000000..92d0199dc --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/resource.h @@ -0,0 +1,233 @@ +/* Bit values & structures for resource limits. Alpha/Linux version. + Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005 + 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_RESOURCE_H +# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead." +#endif + +#include <bits/types.h> + +/* Transmute defines to enumerations. The macro re-definitions are + necessary because some programs want to test for operating system + features with #ifdef RUSAGE_SELF. In ISO C the reflexive + definition is a no-op. */ + +/* Kinds of resource limit. */ +enum __rlimit_resource +{ + /* Per-process CPU limit, in seconds. */ + RLIMIT_CPU = 0, +#define RLIMIT_CPU RLIMIT_CPU + + /* Largest file that can be created, in bytes. */ + RLIMIT_FSIZE = 1, +#define RLIMIT_FSIZE RLIMIT_FSIZE + + /* Maximum size of data segment, in bytes. */ + RLIMIT_DATA = 2, +#define RLIMIT_DATA RLIMIT_DATA + + /* Maximum size of stack segment, in bytes. */ + RLIMIT_STACK = 3, +#define RLIMIT_STACK RLIMIT_STACK + + /* Largest core file that can be created, in bytes. */ + RLIMIT_CORE = 4, +#define RLIMIT_CORE RLIMIT_CORE + + /* Largest resident set size, in bytes. + This affects swapping; processes that are exceeding their + resident set size will be more likely to have physical memory + taken from them. */ + __RLIMIT_RSS = 5, +#define RLIMIT_RSS __RLIMIT_RSS + + /* Number of open files. */ + RLIMIT_NOFILE = 6, + __RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ +#define RLIMIT_NOFILE RLIMIT_NOFILE +#define RLIMIT_OFILE __RLIMIT_OFILE + + /* Address space limit (?) */ + RLIMIT_AS = 7, +#define RLIMIT_AS RLIMIT_AS + + /* Number of processes. */ + __RLIMIT_NPROC = 8, +#define RLIMIT_NPROC __RLIMIT_NPROC + + /* Locked-in-memory address space. */ + __RLIMIT_MEMLOCK = 9, +#define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK + + /* Maximum number of file locks. */ + __RLIMIT_LOCKS = 10, +#define RLIMIT_LOCKS __RLIMIT_LOCKS + + /* Maximum number of pending signals. */ + __RLIMIT_SIGPENDING = 11, +#define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING + + /* Maximum bytes in POSIX message queues. */ + __RLIMIT_MSGQUEUE = 12, +#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE + + /* Maximum nice priority allowed to raise to. + Nice levels 19 .. -20 correspond to 0 .. 39 + values of this resource limit. */ + __RLIMIT_NICE = 13, +#define RLIMIT_NICE __RLIMIT_NICE + + /* Maximum realtime priority allowed for non-priviledged + processes. */ + __RLIMIT_RTPRIO = 14, +#define RLIMIT_RTPRIO __RLIMIT_RTPRIO + + __RLIMIT_NLIMITS = 15, + __RLIM_NLIMITS = __RLIMIT_NLIMITS +#define RLIMIT_NLIMITS __RLIMIT_NLIMITS +#define RLIM_NLIMITS __RLIM_NLIMITS +}; + +/* Value to indicate that there is no limit. */ +#ifndef __USE_FILE_OFFSET64 +# define RLIM_INFINITY ((long int)(~0UL >> 1)) +#else +# define RLIM_INFINITY 0x7fffffffffffffffLL +#endif + +#ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0x7fffffffffffffffLL +#endif + +/* We can represent all limits. */ +#define RLIM_SAVED_MAX RLIM_INFINITY +#define RLIM_SAVED_CUR RLIM_INFINITY + + +/* Type for resource quantity measurement. */ +#ifndef __USE_FILE_OFFSET64 +typedef __rlim_t rlim_t; +#else +typedef __rlim64_t rlim_t; +#endif +#ifdef __USE_LARGEFILE64 +typedef __rlim64_t rlim64_t; +#endif + +struct rlimit + { + /* The current (soft) limit. */ + rlim_t rlim_cur; + /* The hard limit. */ + rlim_t rlim_max; + }; + +#ifdef __USE_LARGEFILE64 +struct rlimit64 + { + /* The current (soft) limit. */ + rlim64_t rlim_cur; + /* The hard limit. */ + rlim64_t rlim_max; + }; +#endif + +/* Whose usage statistics do you want? */ +enum __rusage_who +{ + /* The calling process. */ + RUSAGE_SELF = 0, +#define RUSAGE_SELF RUSAGE_SELF + + /* All of its terminated child processes. */ + RUSAGE_CHILDREN = -1, +#define RUSAGE_CHILDREN RUSAGE_CHILDREN + +#ifdef __USE_GNU + /* The calling thread. */ + RUSAGE_THREAD = 1 +# define RUSAGE_THREAD RUSAGE_THREAD + /* Name for the same functionality on Solaris. */ +# define RUSAGE_LWP RUSAGE_THREAD +#endif +}; + +#define __need_timeval +#include <bits/time.h> /* For `struct timeval'. */ + +/* Structure which says how much of each resource has been used. */ +struct rusage + { + /* Total amount of user time used. */ + struct timeval ru_utime; + /* Total amount of system time used. */ + struct timeval ru_stime; + /* Maximum resident set size (in kilobytes). */ + long int ru_maxrss; + /* Amount of sharing of text segment memory + with other processes (kilobyte-seconds). */ + long int ru_ixrss; + /* Amount of data segment memory used (kilobyte-seconds). */ + long int ru_idrss; + /* Amount of stack memory used (kilobyte-seconds). */ + long int ru_isrss; + /* Number of soft page faults (i.e. those serviced by reclaiming + a page from the list of pages awaiting reallocation. */ + long int ru_minflt; + /* Number of hard page faults (i.e. those that required I/O). */ + long int ru_majflt; + /* Number of times a process was swapped out of physical memory. */ + long int ru_nswap; + /* Number of input operations via the file system. Note: This + and `ru_oublock' do not include operations with the cache. */ + long int ru_inblock; + /* Number of output operations via the file system. */ + long int ru_oublock; + /* Number of IPC messages sent. */ + long int ru_msgsnd; + /* Number of IPC messages received. */ + long int ru_msgrcv; + /* Number of signals delivered. */ + long int ru_nsignals; + /* Number of voluntary context switches, i.e. because the process + gave up the process before it had to (usually to wait for some + resource to be available). */ + long int ru_nvcsw; + /* Number of involuntary context switches, i.e. a higher priority process + became runnable or the current process used up its time slice. */ + long int ru_nivcsw; + }; + +/* Priority limits. */ +#define PRIO_MIN -20 /* Minimum priority a process can have. */ +#define PRIO_MAX 20 /* Maximum priority a process can have. */ + +/* The type of the WHICH argument to `getpriority' and `setpriority', + indicating what flavor of entity the WHO argument specifies. */ +enum __priority_which +{ + PRIO_PROCESS = 0, /* WHO is a process ID. */ +#define PRIO_PROCESS PRIO_PROCESS + PRIO_PGRP = 1, /* WHO is a process group ID. */ +#define PRIO_PGRP PRIO_PGRP + PRIO_USER = 2 /* WHO is a user ID. */ +#define PRIO_USER PRIO_USER +}; diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/sem.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/sem.h new file mode 100644 index 000000000..f63360b2b --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/sem.h @@ -0,0 +1,85 @@ +/* Copyright (C) 1995, 1996, 1997, 1998, 2000 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SEM_H +# error "Never include <bits/sem.h> directly; use <sys/sem.h> instead." +#endif + +#include <sys/types.h> + +/* Flags for `semop'. */ +#define SEM_UNDO 0x1000 /* undo the operation on exit */ + +/* Commands for `semctl'. */ +#define GETPID 11 /* get sempid */ +#define GETVAL 12 /* get semval */ +#define GETALL 13 /* get all semval's */ +#define GETNCNT 14 /* get semncnt */ +#define GETZCNT 15 /* get semzcnt */ +#define SETVAL 16 /* set semval */ +#define SETALL 17 /* set all semval's */ + + +/* Data structure describing a set of semaphores. */ +struct semid_ds +{ + struct ipc_perm sem_perm; /* operation permission struct */ + __time_t sem_otime; /* last semop() time */ + __time_t sem_ctime; /* last time changed by semctl() */ + unsigned long int sem_nsems; /* number of semaphores in set */ + unsigned long int __unused1; + unsigned long int __unused2; +}; + +/* The user should define a union like the following to use it for arguments + for `semctl'. + + union semun + { + int val; <= value for SETVAL + struct semid_ds *buf; <= buffer for IPC_STAT & IPC_SET + unsigned short int *array; <= array for GETALL & SETALL + struct seminfo *__buf; <= buffer for IPC_INFO + }; + + Previous versions of this file used to define this union but this is + incorrect. One can test the macro _SEM_SEMUN_UNDEFINED to see whether + one must define the union or not. */ +#define _SEM_SEMUN_UNDEFINED 1 + +#ifdef __USE_MISC + +/* ipcs ctl cmds */ +# define SEM_STAT 18 +# define SEM_INFO 19 + +struct seminfo +{ + int semmap; + int semmni; + int semmns; + int semmnu; + int semmsl; + int semopm; + int semume; + int semusz; + int semvmx; + int semaem; +}; + +#endif /* __USE_MISC */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/shm.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/shm.h new file mode 100644 index 000000000..cb214e641 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/shm.h @@ -0,0 +1,101 @@ +/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2004 + 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; 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 <bits/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) */ + +__BEGIN_DECLS + +/* Segment low boundary address multiple. */ +#define SHMLBA (__getpagesize ()) +extern int __getpagesize (void) __THROW __attribute__ ((__const__)); + + +/* Type to count number of attaches. */ +typedef unsigned long int shmatt_t; + +/* Data structure describing a shared memory segment. */ +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 */ + shmatt_t 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 */ +# define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ +# define SHM_NORESERVE 010000 /* don't check for reservations */ + +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 */ + +__END_DECLS diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/sigaction.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/sigaction.h new file mode 100644 index 000000000..80feb2fa2 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/sigaction.h @@ -0,0 +1,74 @@ +/* The proper definitions for Linux/Alpha sigaction. + Copyright (C) 1996, 1997, 1999, 2000 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGNAL_H +# error "Never include <bits/sigaction.h> directly; use <signal.h> instead." +#endif + +/* Structure describing the action to be taken when a signal arrives. */ +struct sigaction + { + /* Signal handler. */ +#ifdef __USE_POSIX199309 + union + { + /* Used if SA_SIGINFO is not set. */ + __sighandler_t sa_handler; + /* Used if SA_SIGINFO is set. */ + void (*sa_sigaction) (int, siginfo_t *, void *); + } + __sigaction_handler; +# define sa_handler __sigaction_handler.sa_handler +# define sa_sigaction __sigaction_handler.sa_sigaction +#else + __sighandler_t sa_handler; +#endif + + /* Additional set of signals to be blocked. */ + __sigset_t sa_mask; + + /* Special flags. */ + unsigned int sa_flags; + }; + +/* Bits in `sa_flags'. */ +#define SA_NOCLDSTOP 0x00000004 /* Don't send SIGCHLD when children stop. */ +#define SA_NOCLDWAIT 0x00000020 /* Don't create zombie on child death. */ +#define SA_SIGINFO 0x00000040 /* Invoke signal-catching function with + three arguments instead of one. */ +#if defined __USE_UNIX98 || defined __USE_MISC +# define SA_ONSTACK 0x00000001 /* Use signal stack by using `sa_restorer'. */ +# define SA_RESTART 0x00000002 /* Restart syscall on signal return. */ +# define SA_NODEFER 0x00000008 /* Don't automatically block the signal + when its handler is being executed. */ +# define SA_RESETHAND 0x00000010 /* Reset to SIG_DFL on entry to handler. */ +#endif +#ifdef __USE_MISC +# define SA_INTERRUPT 0x20000000 /* Historical no-op. */ + +/* Some aliases for the SA_ constants. */ +# define SA_NOMASK SA_NODEFER +# define SA_ONESHOT SA_RESETHAND +# define SA_STACK SA_ONSTACK +#endif + +/* Values for the HOW argument to `sigprocmask'. */ +#define SIG_BLOCK 1 /* Block signals. */ +#define SIG_UNBLOCK 2 /* Unblock signals. */ +#define SIG_SETMASK 3 /* Set the set of blocked signals. */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/siginfo.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/siginfo.h new file mode 100644 index 000000000..a2aacc04b --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/siginfo.h @@ -0,0 +1,303 @@ +/* siginfo_t, sigevent and constants. Linux/Alpha version. + Copyright (C) 1997-2002, 2003 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if !defined _SIGNAL_H && !defined __need_siginfo_t \ + && !defined __need_sigevent_t +# error "Never include this file directly. Use <signal.h> instead" +#endif + +#if (!defined __have_sigval_t \ + && (defined _SIGNAL_H || defined __need_siginfo_t \ + || defined __need_sigevent_t)) +# define __have_sigval_t 1 + +/* Type for data associated with a signal. */ +typedef union sigval + { + int sival_int; + void *sival_ptr; + } sigval_t; +#endif + +#if (!defined __have_siginfo_t \ + && (defined _SIGNAL_H || defined __need_siginfo_t)) +# define __have_siginfo_t 1 + +# define __SI_MAX_SIZE 128 +# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4) + +typedef struct siginfo + { + int si_signo; /* Signal number. */ + int si_errno; /* If non-zero, an errno value associated with + this signal, as defined in <errno.h>. */ + int si_code; /* Signal code. */ + + union + { + int _pad[__SI_PAD_SIZE]; + + /* kill(). */ + struct + { + __pid_t si_pid; /* Sending process ID. */ + __uid_t si_uid; /* Real user ID of sending process. */ + } _kill; + + /* POSIX.1b timers. */ + struct + { + int si_tid; /* Timer ID. */ + int si_overrun; /* Overrun count. */ + sigval_t si_sigval; /* Signal value. */ + } _timer; + + /* POSIX.1b signals. */ + struct + { + __pid_t si_pid; /* Sending process ID. */ + __uid_t si_uid; /* Real user ID of sending process. */ + sigval_t si_sigval; /* Signal value. */ + } _rt; + + /* SIGCHLD. */ + struct + { + __pid_t si_pid; /* Which child. */ + __uid_t si_uid; /* Real user ID of sending process. */ + int si_status; /* Exit value or signal. */ + __clock_t si_utime; + __clock_t si_stime; + } _sigchld; + + /* SIGILL, SIGFPE, SIGSEGV, SIGBUS. */ + struct + { + void *si_addr; /* Faulting insn/memory ref. */ + } _sigfault; + + /* SIGPOLL. */ + struct + { + int si_band; /* Band event for SIGPOLL. */ + int si_fd; + } _sigpoll; + } _sifields; + } siginfo_t; + + +/* X/Open requires some more fields with fixed names. */ +# define si_pid _sifields._kill.si_pid +# define si_uid _sifields._kill.si_uid +# define si_timerid _sifields._timer.si_tid +# define si_overrun _sifields._timer.si_overrun +# define si_status _sifields._sigchld.si_status +# define si_utime _sifields._sigchld.si_utime +# define si_stime _sifields._sigchld.si_stime +# define si_value _sifields._rt.si_sigval +# define si_int _sifields._rt.si_sigval.sival_int +# define si_ptr _sifields._rt.si_sigval.sival_ptr +# define si_addr _sifields._sigfault.si_addr +# define si_band _sifields._sigpoll.si_band +# define si_fd _sifields._sigpoll.si_fd + + +/* Values for `si_code'. Positive values are reserved for kernel-generated + signals. */ +enum +{ + SI_ASYNCNL = -60, /* Sent by asynch name lookup completion. */ +# define SI_ASYNCNL SI_ASYNCNL + SI_TKILL = -6, /* Sent by tkill. */ +# define SI_TKILL SI_TKILL + SI_SIGIO, /* Sent by queued SIGIO. */ +# define SI_SIGIO SI_SIGIO + SI_ASYNCIO, /* Sent by AIO completion. */ +# define SI_ASYNCIO SI_ASYNCIO + SI_MESGQ, /* Sent by real time mesq state change. */ +# define SI_MESGQ SI_MESGQ + SI_TIMER, /* Sent by timer expiration. */ +# define SI_TIMER SI_TIMER + SI_QUEUE, /* Sent by sigqueue. */ +# define SI_QUEUE SI_QUEUE + SI_USER, /* Sent by kill, sigsend, raise. */ +# define SI_USER SI_USER + SI_KERNEL = 0x80 /* Send by kernel. */ +#define SI_KERNEL SI_KERNEL +}; + + +/* `si_code' values for SIGILL signal. */ +enum +{ + ILL_ILLOPC = 1, /* Illegal opcode. */ +# define ILL_ILLOPC ILL_ILLOPC + ILL_ILLOPN, /* Illegal operand. */ +# define ILL_ILLOPN ILL_ILLOPN + ILL_ILLADR, /* Illegal addressing mode. */ +# define ILL_ILLADR ILL_ILLADR + ILL_ILLTRP, /* Illegal trap. */ +# define ILL_ILLTRP ILL_ILLTRP + ILL_PRVOPC, /* Privileged opcode. */ +# define ILL_PRVOPC ILL_PRVOPC + ILL_PRVREG, /* Privileged register. */ +# define ILL_PRVREG ILL_PRVREG + ILL_COPROC, /* Coprocessor error. */ +# define ILL_COPROC ILL_COPROC + ILL_BADSTK /* Internal stack error. */ +# define ILL_BADSTK ILL_BADSTK +}; + +/* `si_code' values for SIGFPE signal. */ +enum +{ + FPE_INTDIV = 1, /* Integer divide by zero. */ +# define FPE_INTDIV FPE_INTDIV + FPE_INTOVF, /* Integer overflow. */ +# define FPE_INTOVF FPE_INTOVF + FPE_FLTDIV, /* Floating point divide by zero. */ +# define FPE_FLTDIV FPE_FLTDIV + FPE_FLTOVF, /* Floating point overflow. */ +# define FPE_FLTOVF FPE_FLTOVF + FPE_FLTUND, /* Floating point underflow. */ +# define FPE_FLTUND FPE_FLTUND + FPE_FLTRES, /* Floating point inexact result. */ +# define FPE_FLTRES FPE_FLTRES + FPE_FLTINV, /* Floating point invalid operation. */ +# define FPE_FLTINV FPE_FLTINV + FPE_FLTSUB /* Subscript out of range. */ +# define FPE_FLTSUB FPE_FLTSUB +}; + +/* `si_code' values for SIGSEGV signal. */ +enum +{ + SEGV_MAPERR = 1, /* Address not mapped to object. */ +# define SEGV_MAPERR SEGV_MAPERR + SEGV_ACCERR /* Invalid permissions for mapped object. */ +# define SEGV_ACCERR SEGV_ACCERR +}; + +/* `si_code' values for SIGBUS signal. */ +enum +{ + BUS_ADRALN = 1, /* Invalid address alignment. */ +# define BUS_ADRALN BUS_ADRALN + BUS_ADRERR, /* Non-existant physical address. */ +# define BUS_ADRERR BUS_ADRERR + BUS_OBJERR /* Object specific hardware error. */ +# define BUS_OBJERR BUS_OBJERR +}; + +/* `si_code' values for SIGTRAP signal. */ +enum +{ + TRAP_BRKPT = 1, /* Process breakpoint. */ +# define TRAP_BRKPT TRAP_BRKPT + TRAP_TRACE /* Process trace trap. */ +# define TRAP_TRACE TRAP_TRACE +}; + +/* `si_code' values for SIGCHLD signal. */ +enum +{ + CLD_EXITED = 1, /* Child has exited. */ +# define CLD_EXITED CLD_EXITED + CLD_KILLED, /* Child was killed. */ +# define CLD_KILLED CLD_KILLED + CLD_DUMPED, /* Child terminated abnormally. */ +# define CLD_DUMPED CLD_DUMPED + CLD_TRAPPED, /* Traced child has trapped. */ +# define CLD_TRAPPED CLD_TRAPPED + CLD_STOPPED, /* Child has stopped. */ +# define CLD_STOPPED CLD_STOPPED + CLD_CONTINUED /* Stopped child has continued. */ +# define CLD_CONTINUED CLD_CONTINUED +}; + +/* `si_code' values for SIGPOLL signal. */ +enum +{ + POLL_IN = 1, /* Data input available. */ +# define POLL_IN POLL_IN + POLL_OUT, /* Output buffers available. */ +# define POLL_OUT POLL_OUT + POLL_MSG, /* Input message available. */ +# define POLL_MSG POLL_MSG + POLL_ERR, /* I/O error. */ +# define POLL_ERR POLL_ERR + POLL_PRI, /* High priority input available. */ +# define POLL_PRI POLL_PRI + POLL_HUP /* Device disconnected. */ +# define POLL_HUP POLL_HUP +}; + +# undef __need_siginfo_t +#endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t). */ + + +#if (defined _SIGNAL_H || defined __need_sigevent_t) \ + && !defined __have_sigevent_t +# define __have_sigevent_t 1 + +/* Structure to transport application-defined values with signals. */ +# define __SIGEV_MAX_SIZE 64 +# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 4) + +typedef struct sigevent + { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + + union + { + int _pad[__SIGEV_PAD_SIZE]; + + /* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the + thread to receive the signal. */ + __pid_t _tid; + + struct + { + void (*_function) (sigval_t); /* Function to start. */ + void *_attribute; /* Really pthread_attr_t. */ + } _sigev_thread; + } _sigev_un; + } sigevent_t; + +/* POSIX names to access some of the members. */ +# define sigev_notify_function _sigev_un._sigev_thread._function +# define sigev_notify_attributes _sigev_un._sigev_thread._attribute + +/* `sigev_notify' values. */ +enum +{ + SIGEV_SIGNAL = 0, /* Notify via signal. */ +# define SIGEV_SIGNAL SIGEV_SIGNAL + SIGEV_NONE, /* Other notification: meaningless. */ +# define SIGEV_NONE SIGEV_NONE + SIGEV_THREAD, /* Deliver via thread creation. */ +# define SIGEV_THREAD SIGEV_THREAD + + SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */ +#define SIGEV_THREAD_ID SIGEV_THREAD_ID +}; + +#endif /* have _SIGNAL_H. */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/signum.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/signum.h new file mode 100644 index 000000000..477c13175 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/signum.h @@ -0,0 +1,82 @@ +/* Signal number definitions. Linux/Alpha version. + Copyright (C) 1996, 1997, 1998, 1999, 2003 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifdef _SIGNAL_H + +/* Fake signal functions. */ +#define SIG_ERR ((__sighandler_t) -1) /* Error return. */ +#define SIG_DFL ((__sighandler_t) 0) /* Default action. */ +#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ + +#ifdef __USE_UNIX98 +# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */ +#endif + +/* + * Linux/AXP has different signal numbers that Linux/i386: I'm trying + * to make it OSF/1 binary compatible, at least for normal binaries. + */ +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGEMT 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGBUS 10 +#define SIGSEGV 11 +#define SIGSYS 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGURG 16 +#define SIGSTOP 17 +#define SIGTSTP 18 +#define SIGCONT 19 +#define SIGCHLD 20 +#define SIGCLD SIGCHLD +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGIO 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGINFO 29 +#define SIGUSR1 30 +#define SIGUSR2 31 + +#define SIGPOLL SIGIO +#define SIGPWR SIGINFO +#define SIGIOT SIGABRT + +#define _NSIG 65 /* Biggest signal number + 1. */ + +#define SIGRTMIN (__libc_current_sigrtmin ()) +#define SIGRTMAX (__libc_current_sigrtmax ()) + +/* These are the hard limits of the kernel. These values should not be + used directly at user level. */ +#define __SIGRTMIN 32 +#define __SIGRTMAX (_NSIG - 1) + +#endif /* <signal.h> included. */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/sigstack.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/sigstack.h new file mode 100644 index 000000000..7faaf98d5 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/sigstack.h @@ -0,0 +1,55 @@ +/* sigstack, sigaltstack definitions. + Copyright (C) 1998 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIGNAL_H +# error "Never include this file directly. Use <signal.h> instead" +#endif + + +/* Structure describing a signal stack (obsolete). */ +struct sigstack + { + __ptr_t ss_sp; /* Signal stack pointer. */ + int ss_onstack; /* Nonzero if executing on this stack. */ + }; + + +/* Possible values for `ss_flags.'. */ +enum +{ + SS_ONSTACK = 1, +#define SS_ONSTACK SS_ONSTACK + SS_DISABLE +#define SS_DISABLE SS_DISABLE +}; + +/* Minimum stack size for a signal handler. */ +#define MINSIGSTKSZ 4096 + +/* System default stack size. */ +#define SIGSTKSZ 16384 + + +/* Alternate, preferred interface. */ +typedef struct sigaltstack + { + __ptr_t ss_sp; + int ss_flags; + size_t ss_size; + } stack_t; diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/stat.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/stat.h new file mode 100644 index 000000000..42748be76 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/stat.h @@ -0,0 +1,157 @@ +/* Copyright (C) 1996,1997,1998,1999,2000,2001,2004 + 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_STAT_H +# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead." +#endif + +/* Versions of the `struct stat' data structure. */ +#define _STAT_VER_KERNEL 0 +#define _STAT_VER_GLIBC2 1 +#define _STAT_VER_GLIBC2_1 2 +#define _STAT_VER_KERNEL64 3 +#define _STAT_VER_GLIBC2_3_4 3 +#define _STAT_VER _STAT_VER_GLIBC2_3_4 + +/* Versions of the `xmknod' interface. */ +#define _MKNOD_VER_LINUX 0 + + +/* Nanosecond resolution timestamps are stored in a format equivalent to + 'struct timespec'. This is the type used whenever possible but the + Unix namespace rules do not allow the identifier 'timespec' to appear + in the <sys/stat.h> header. Therefore we have to handle the use of + this header in strictly standard-compliant sources special. + + Use neat tidy anonymous unions and structures when possible. */ + +#ifdef __USE_MISC +# if __GNUC_PREREQ(3,3) +# define __ST_TIME(X) \ + __extension__ union { \ + struct timespec st_##X##tim; \ + struct { \ + __time_t st_##X##time; \ + unsigned long st_##X##timensec; \ + }; \ + } +# else +# define __ST_TIME(X) struct timespec st_##X##tim +# define st_atime st_atim.tv_sec +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# endif +#else +# define __ST_TIME(X) \ + __time_t st_##X##time; \ + unsigned long st_##X##timensec +#endif + + +struct stat + { + __dev_t st_dev; /* Device. */ +#ifdef __USE_FILE_OFFSET64 + __ino64_t st_ino; /* File serial number. */ +#else + __ino_t st_ino; /* File serial number. */ + int __pad0; /* 64-bit st_ino. */ +#endif + __dev_t st_rdev; /* Device number, if device. */ + __off_t st_size; /* Size of file, in bytes. */ +#ifdef __USE_FILE_OFFSET64 + __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ +#else + __blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */ + int __pad1; /* 64-bit st_blocks. */ +#endif + __mode_t st_mode; /* File mode. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __nlink_t st_nlink; /* Link count. */ + int __pad2; /* Real padding. */ + __ST_TIME(a); /* Time of last access. */ + __ST_TIME(m); /* Time of last modification. */ + __ST_TIME(c); /* Time of last status change. */ + long __unused[3]; + }; + +#ifdef __USE_LARGEFILE64 +/* Note stat64 is the same shape as stat. */ +struct stat64 + { + __dev_t st_dev; /* Device. */ + __ino64_t st_ino; /* File serial number. */ + __dev_t st_rdev; /* Device number, if device. */ + __off_t st_size; /* Size of file, in bytes. */ + __blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */ + __mode_t st_mode; /* File mode. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + __nlink_t st_nlink; /* Link count. */ + int __pad0; /* Real padding. */ + __ST_TIME(a); /* Time of last access. */ + __ST_TIME(m); /* Time of last modification. */ + __ST_TIME(c); /* Time of last status change. */ + long __unused[3]; + }; +#endif + +#undef __ST_TIME + +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV +#define _STATBUF_ST_NSEC + +/* Encoding of the file mode. */ + +#define __S_IFMT 0170000 /* These bits determine file type. */ + +/* File types. */ +#define __S_IFDIR 0040000 /* Directory. */ +#define __S_IFCHR 0020000 /* Character device. */ +#define __S_IFBLK 0060000 /* Block device. */ +#define __S_IFREG 0100000 /* Regular file. */ +#define __S_IFIFO 0010000 /* FIFO. */ +#define __S_IFLNK 0120000 /* Symbolic link. */ +#define __S_IFSOCK 0140000 /* Socket. */ + +/* POSIX.1b objects. Note that these macros always evaluate to zero. But + they do it by enforcing the correct use of the macros. */ +#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) +#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) +#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) + +/* Protection bits. */ + +#define __S_ISUID 04000 /* Set user ID on execution. */ +#define __S_ISGID 02000 /* Set group ID on execution. */ +#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ +#define __S_IREAD 0400 /* Read by owner. */ +#define __S_IWRITE 0200 /* Write by owner. */ +#define __S_IEXEC 0100 /* Execute by owner. */ + +#if defined __USE_ATFILE || defined __USE_GNU +/* XXX This will change to the macro for the next 2008 POSIX revision. */ +# define UTIME_NOW ((1l << 30) - 1l) +# define UTIME_OMIT ((1l << 30) - 2l) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/statfs.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/statfs.h new file mode 100644 index 000000000..d838e6bf4 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/statfs.h @@ -0,0 +1,67 @@ +/* Copyright (C) 1997, 1998, 2000, 2003 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_STATFS_H +# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead." +#endif + +#include <bits/types.h> /* for __fsid_t and __fsblkcnt_t. */ + +struct statfs + { + int f_type; + int f_bsize; +#ifndef __USE_FILE_OFFSET64 + __fsblkcnt_t f_blocks; + __fsblkcnt_t f_bfree; + __fsblkcnt_t f_bavail; + __fsfilcnt_t f_files; + __fsfilcnt_t f_ffree; +#else + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_bavail; + __fsfilcnt64_t f_files; + __fsfilcnt64_t f_ffree; +#endif + __fsid_t f_fsid; + int f_namelen; + int f_frsize; + int f_spare[5]; + }; + +#ifdef __USE_LARGEFILE64 +struct statfs64 + { + int f_type; + int f_bsize; + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_bavail; + __fsfilcnt64_t f_files; + __fsfilcnt64_t f_ffree; + __fsid_t f_fsid; + int f_namelen; + int f_frsize; + int f_spare[5]; + }; +#endif + +/* Tell code we have this member. */ +#define _STATFS_F_NAMELEN +#define _STATFS_F_FRSIZE diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/termios.h new file mode 100644 index 000000000..966ccf94d --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/termios.h @@ -0,0 +1,226 @@ +/* termios type and macro definitions. Linux version. + Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2003, 2005 + 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _TERMIOS_H +# error "Never include <bits/termios.h> directly; use <termios.h> instead." +#endif + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 32 +struct termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_cc[NCCS]; /* control characters */ + cc_t c_line; /* line discipline (== c_cc[33]) */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1 +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1 + }; + +/* c_cc characters */ +#define VEOF 0 +#define VEOL 1 +#define VEOL2 2 +#define VERASE 3 +#define VWERASE 4 +#define VKILL 5 +#define VREPRINT 6 +#define VSWTC 7 +#define VINTR 8 +#define VQUIT 9 +#define VSUSP 10 +#define VSTART 12 +#define VSTOP 13 +#define VLNEXT 14 +#define VDISCARD 15 +#define VMIN 16 +#define VTIME 17 + +/* c_iflag bits */ +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IXON 0001000 +#define IXOFF 0002000 +#ifdef __USE_BSD + /* POSIX.1 doesn't want these... */ +# define IXANY 0004000 +# define IUCLC 0010000 +# define IMAXBEL 0020000 +# define IUTF8 0040000 +#endif + +/* c_oflag bits */ +#define OPOST 0000001 +#define ONLCR 0000002 +#define OLCUC 0000004 + +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 + +#define OFILL 00000100 +#define OFDEL 00000200 +#if defined __USE_MISC || defined __USE_XOPEN +# define NLDLY 00001400 +# define NL0 00000000 +# define NL1 00000400 +# define NL2 00001000 +# define NL3 00001400 +# define TABDLY 00006000 +# define TAB0 00000000 +# define TAB1 00002000 +# define TAB2 00004000 +# define TAB3 00006000 +# define CRDLY 00030000 +# define CR0 00000000 +# define CR1 00010000 +# define CR2 00020000 +# define CR3 00030000 +# define FFDLY 00040000 +# define FF0 00000000 +# define FF1 00040000 +# define BSDLY 00100000 +# define BS0 00000000 +# define BS1 00100000 +#endif + +#define VTDLY 00200000 +#define VT0 00000000 +#define VT1 00200000 + +#ifdef __USE_MISC +# define XTABS 01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */ +#endif + +/* c_cflag bit meaning */ +#ifdef __USE_MISC +# define CBAUD 0000037 +#endif +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#ifdef __USE_MISC +# define EXTA B19200 +# define EXTB B38400 +# define CBAUDEX 0000000 +#endif +#define B57600 00020 +#define B115200 00021 +#define B230400 00022 +#define B460800 00023 +#define B500000 00024 +#define B576000 00025 +#define B921600 00026 +#define B1000000 00027 +#define B1152000 00030 +#define B1500000 00031 +#define B2000000 00032 +#define B2500000 00033 +#define B3000000 00034 +#define B3500000 00035 +#define B4000000 00036 + +#define __MAX_BAUD B4000000 + +#define CSIZE 00001400 +#define CS5 00000000 +#define CS6 00000400 +#define CS7 00001000 +#define CS8 00001400 + +#define CSTOPB 00002000 +#define CREAD 00004000 +#define PARENB 00010000 +#define PARODD 00020000 +#define HUPCL 00040000 + +#define CLOCAL 00100000 +#ifdef __USE_MISC +# define CMSPAR 010000000000 /* mark or space (stick) parity */ +# define CRTSCTS 020000000000 /* flow control */ +#endif + +/* c_lflag bits */ +#define ISIG 0x00000080 +#define ICANON 0x00000100 +#if defined __USE_MISC || defined __USE_XOPEN +# define XCASE 0x00004000 +#endif +#define ECHO 0x00000008 +#define ECHOE 0x00000002 +#define ECHOK 0x00000004 +#define ECHONL 0x00000010 +#define NOFLSH 0x80000000 +#define TOSTOP 0x00400000 +#ifdef __USE_MISC +# define ECHOCTL 0x00000040 +# define ECHOPRT 0x00000020 +# define ECHOKE 0x00000001 +# define FLUSHO 0x00800000 +# define PENDIN 0x20000000 +#endif +#define IEXTEN 0x00000400 + +/* Values for the ACTION argument to `tcflow'. */ +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +/* Values for the QUEUE_SELECTOR argument to `tcflush'. */ +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */ +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + + +#define _IOT_termios /* Hurd ioctl type field. */ \ + _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h new file mode 100644 index 000000000..201585af1 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h @@ -0,0 +1,66 @@ +/* bits/typesizes.h -- underlying types for *_t. Linux/Alpha version. + Copyright (C) 2002, 2003 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _BITS_TYPES_H +# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead." +#endif + +#ifndef _BITS_TYPESIZES_H +#define _BITS_TYPESIZES_H 1 + +/* See <bits/types.h> for the meaning of these macros. This file exists so + that <bits/types.h> need not vary across different GNU platforms. */ + +#define __DEV_T_TYPE __U64_TYPE +#define __UID_T_TYPE __U32_TYPE +#define __GID_T_TYPE __U32_TYPE +#define __INO_T_TYPE __U32_TYPE +#define __INO64_T_TYPE __U64_TYPE +#define __MODE_T_TYPE __U32_TYPE +#define __NLINK_T_TYPE __U32_TYPE +#define __OFF_T_TYPE __SLONGWORD_TYPE +#define __OFF64_T_TYPE __S64_TYPE +#define __PID_T_TYPE __S32_TYPE +#define __RLIM_T_TYPE __ULONGWORD_TYPE +#define __RLIM64_T_TYPE __U64_TYPE +#define __BLKCNT_T_TYPE __U32_TYPE +#define __BLKCNT64_T_TYPE __U64_TYPE +#define __FSBLKCNT_T_TYPE __S32_TYPE +#define __FSBLKCNT64_T_TYPE __S64_TYPE +#define __FSFILCNT_T_TYPE __U32_TYPE +#define __FSFILCNT64_T_TYPE __U64_TYPE +#define __ID_T_TYPE __U32_TYPE +#define __CLOCK_T_TYPE __SLONGWORD_TYPE +#define __TIME_T_TYPE __SLONGWORD_TYPE +#define __USECONDS_T_TYPE __U32_TYPE +#define __SUSECONDS_T_TYPE __S64_TYPE +#define __DADDR_T_TYPE __S32_TYPE +#define __SWBLK_T_TYPE __SLONGWORD_TYPE +#define __KEY_T_TYPE __S32_TYPE +#define __CLOCKID_T_TYPE __S32_TYPE +#define __TIMER_T_TYPE void * +#define __BLKSIZE_T_TYPE __U32_TYPE +#define __FSID_T_TYPE struct { int __val[2]; } +#define __SSIZE_T_TYPE __SWORD_TYPE + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + + +#endif /* bits/typesizes.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h b/ports/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h new file mode 100644 index 000000000..22fc64109 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h @@ -0,0 +1,30 @@ +/* Copyright (C) 1999, 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define __WORDSIZE 64 + +#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL + +/* Signal that we didn't used to have a `long double'. The changes all + the `long double' function variants to be redirects to the double + functions. */ +# define __LONG_DOUBLE_MATH_OPTIONAL 1 +# ifndef __LONG_DOUBLE_128__ +# define __NO_LONG_DOUBLE_MATH 1 +# endif +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/brk.S b/ports/sysdeps/unix/sysv/linux/alpha/brk.S new file mode 100644 index 000000000..e01abebe0 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/brk.S @@ -0,0 +1,81 @@ +/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe <brendan@zen.org>, 1993. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* __brk is a special syscall under Linux since it never returns an + error. Instead, the error condition is indicated by returning the old + break value (instead of the new, requested one). */ + +#include <sysdep.h> +#define _ERRNO_H +#include <bits/errno.h> + +#ifdef PIC +.section .bss + .align 3 + .globl __curbrk +__curbrk: .skip 8 + .type __curbrk,@object + .size __curbrk,8 +#else +.comm __curbrk, 8 +#endif + + .text +LEAF(__brk, 8) + ldgp gp, 0(t12) + subq sp, 8, sp +#ifdef PROF + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at +#endif + .prologue 1 + + /* Save the requested brk across the system call. */ + stq a0, 0(sp) + + ldiq v0, __NR_brk + call_pal PAL_callsys + + ldq a0, 0(sp) + + /* Be prepared for an OSF-style brk. */ + bne a3, $err1 + beq v0, $ok + + /* Correctly handle the brk(0) query case. */ + cmoveq a0, v0, a0 + xor a0, v0, t0 + bne t0, $err0 + + /* Update __curbrk and return cleanly. */ + mov zero, v0 +$ok: stq a0, __curbrk + addq sp, 8, sp + ret + + /* What a horrible way to die. */ +$err0: ldi v0, ENOMEM +$err1: addq sp, 8, sp + SYSCALL_ERROR_HANDLER + + END(__brk) + +weak_alias (__brk, brk) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/clone.S b/ports/sysdeps/unix/sysv/linux/alpha/clone.S new file mode 100644 index 000000000..5e0b21ea1 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/clone.S @@ -0,0 +1,149 @@ +/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson <rth@tamu.edu>, 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* clone() is even more special than fork() as it mucks with stacks + and invokes a function in the right context after its all over. */ + +#include <sysdep.h> +#define _ERRNO_H 1 +#include <bits/errno.h> + +#define CLONE_VM 0x00000100 +#define CLONE_THREAD 0x00010000 + +/* int clone(int (*fn)(void *arg), void *child_stack, int flags, + void *arg, pid_t *ptid, void *tls, pid_t *ctid); + + Note that everything past ARG is technically optional, based + on FLAGS, and that CTID is arg 7, and thus is on the stack. + However, since a load from top-of-stack better be legal always, + we don't bother checking FLAGS. */ + + .text +ENTRY(__clone) +#ifdef PROF + ldgp gp,0(pv) + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at + .prologue 1 +#else + .prologue 0 +#endif + + /* Sanity check arguments. */ + ldiq v0,EINVAL + beq a0,$error /* no NULL function pointers */ + beq a1,$error /* no NULL stack pointers */ + + /* Save the fn ptr and arg on the new stack. */ + subq a1,32,a1 + stq a0,0(a1) + stq a3,8(a1) +#ifdef RESET_PID + stq a2,16(a1) +#endif + + /* The syscall is of the form clone(flags, usp, ptid, ctid, tls). + Shift the flags, ptid, ctid, tls arguments into place; the + child_stack argument is already correct. */ + mov a2,a0 + mov a4,a2 + ldq a3,0(sp) + mov a5,a4 + + /* Do the system call. */ + ldiq v0,__NR_clone + call_pal PAL_callsys + + bne a3,$error + beq v0,thread_start + + /* Successful return from the parent. */ + ret + + /* Something bad happened -- no child created. */ +$error: +#ifndef PROF + br gp,1f +1: ldgp gp,0(gp) +#endif + SYSCALL_ERROR_HANDLER + + END(__clone) + +/* Load up the arguments to the function. Put this block of code in + its own function so that we can terminate the stack trace with our + debug info. */ + + .ent thread_start +thread_start: + .frame fp,0,fp,0 + mov 0, fp + .prologue 0 + +#ifdef RESET_PID + /* Check and see if we need to reset the PID. */ + ldq t0,16(sp) + lda t1,CLONE_THREAD + and t0,t1,t2 + beq t2,2f +1: +#endif + + /* Load up the arguments. */ + ldq pv,0(sp) + ldq a0,8(sp) + addq sp,32,sp + + /* Call the user's function. */ + jsr ra,(pv) + ldgp gp,0(ra) + + /* Call _exit rather than doing it inline for breakpoint purposes. */ + mov v0,a0 +#ifdef PIC + bsr ra, HIDDEN_JUMPTARGET(_exit) !samegp +#else + jsr ra, HIDDEN_JUMPTARGET(_exit) +#endif + + /* Die horribly. */ + halt + +#ifdef RESET_PID +2: + rduniq + lda t1, CLONE_VM + mov v0, s0 + lda v0, -1 + and t0, t1, t2 + bne t2, 3f + lda v0, __NR_getxpid + callsys +3: + stl v0, PID_OFFSET(s0) + stl v0, TID_OFFSET(s0) + br 1b +#endif + + .end thread_start + +weak_alias (__clone, clone) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/dl-auxv.h b/ports/sysdeps/unix/sysv/linux/alpha/dl-auxv.h new file mode 100644 index 000000000..8afc4dba3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/dl-auxv.h @@ -0,0 +1,36 @@ +/* Auxiliary vector processing for Linux/Alpha. + Copyright (C) 2007 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Scan the Aux Vector for the cache shape entries. */ + +long __libc_alpha_cache_shape[4] = { -2, -2, -2, -2 }; + +#define DL_PLATFORM_AUXV \ + case AT_L1I_CACHESHAPE: \ + __libc_alpha_cache_shape[0] = av->a_un.a_val; \ + break; \ + case AT_L1D_CACHESHAPE: \ + __libc_alpha_cache_shape[1] = av->a_un.a_val; \ + break; \ + case AT_L2_CACHESHAPE: \ + __libc_alpha_cache_shape[2] = av->a_un.a_val; \ + break; \ + case AT_L3_CACHESHAPE: \ + __libc_alpha_cache_shape[3] = av->a_un.a_val; \ + break; diff --git a/ports/sysdeps/unix/sysv/linux/alpha/dl-brk.S b/ports/sysdeps/unix/sysv/linux/alpha/dl-brk.S new file mode 100644 index 000000000..eeb96544e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/dl-brk.S @@ -0,0 +1 @@ +#include <brk.S> diff --git a/ports/sysdeps/unix/sysv/linux/alpha/dl-support.c b/ports/sysdeps/unix/sysv/linux/alpha/dl-support.c new file mode 100644 index 000000000..290217671 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/dl-support.c @@ -0,0 +1,2 @@ +#include "dl-auxv.h" +#include <elf/dl-support.c> diff --git a/ports/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c b/ports/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c new file mode 100644 index 000000000..4034820f4 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/dl-sysdep.c @@ -0,0 +1,2 @@ +#include "dl-auxv.h" +#include <sysdeps/unix/sysv/linux/dl-sysdep.c> diff --git a/ports/sysdeps/unix/sysv/linux/alpha/fpu/Implies b/ports/sysdeps/unix/sysv/linux/alpha/fpu/Implies new file mode 100644 index 000000000..d76f511c2 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/fpu/Implies @@ -0,0 +1,2 @@ +# Override ldbl-opt with alpha specific routines. +alpha/fpu diff --git a/ports/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c b/ports/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c new file mode 100644 index 000000000..5e63be5cc --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/fraiseexcpt.c @@ -0,0 +1,92 @@ +/* Copyright (C) 2004,2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <fenv_libc.h> +#include <sysdep.h> +#include <float.h> +#include <kernel-features.h> +#include "kernel_sysinfo.h" + + +int +__feraiseexcept (int excepts) +{ + INTERNAL_SYSCALL_DECL (err); + unsigned long t = excepts; + long r; + + r = INTERNAL_SYSCALL (osf_setsysinfo, err, 2, SSI_IEEE_RAISE_EXCEPTION, &t); + +#ifndef __ASSUME_IEEE_RAISE_EXCEPTION + if (!INTERNAL_SYSCALL_ERROR_P (r, err)) + return 0; + + double d; + + /* If we got an error from SSI_IEEE_RAISE_EXCEPTION, assume it means that + the system call isn't actually implemented. Do the best we can. */ + + /* Invalid implemented with 0 / 0 -> NaN. */ + if (excepts & FE_INVALID) + __asm__ __volatile__ ("divs/su $f31,$f31,%0; trapb" : "=f"(d) : ); + + /* Division By Zero implemented with 1 / 0 -> NaN. */ + if (excepts & FE_DIVBYZERO) + __asm__ __volatile__ ("divs/su %1,$f31,%0; trapb" : "=&f"(d) : "f"(1.0f)); + + /* Overflow and underflow cannot be had all by themselves. We can + generate them with arithmetic, but we always get INEXACT raised + at the same time. Prepare to undo. */ + if ((excepts & (FE_OVERFLOW | FE_UNDERFLOW)) && !(excepts & FE_INEXACT)) + INTERNAL_SYSCALL (osf_getsysinfo, err, 2, GSI_IEEE_FP_CONTROL, &t); + + /* Overflow implemented with FLT_MAX + FLT_MAX -> Inf. */ + if (excepts & FE_OVERFLOW) + __asm__ __volatile__ ("adds/sui %1,%1,%0; trapb" + : "=&f"(d) : "f"(FLT_MAX)); + + /* Underflow implemented with FLT_MIN * FLT_MIN -> 0. */ + if (excepts & FE_UNDERFLOW) + __asm__ __volatile__ ("muls/sui %1,%1,%0; trapb" + : "=&f"(d) : "f"(FLT_MIN)); + + /* Inexact implemented with (long)0.5 -> 0. */ + if ((excepts & (FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)) == FE_INEXACT) + __asm__ __volatile__ ("cvttq/svi %1,%0; trapb" : "=&f"(d) : "f"(0.5f)); + + /* If we raised inexact when not asked, and inexact was not previously + raised, then clear that exception. */ + if ((excepts & (FE_OVERFLOW | FE_UNDERFLOW)) + && !((excepts | t) & FE_INEXACT)) + { + t |= excepts & SWCR_STATUS_MASK; + INTERNAL_SYSCALL (osf_setsysinfo, err, 2, SSI_IEEE_FP_CONTROL, &t); + } +#endif /* !__ASSUME_IEEE_RAISE_EXCEPTION */ + + return 0; +} + +#include <shlib-compat.h> +#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2) +strong_alias (__feraiseexcept, __old_feraiseexcept) +compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1); +#endif + +libm_hidden_ver (__feraiseexcept, feraiseexcept) +versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2); diff --git a/ports/sysdeps/unix/sysv/linux/alpha/fxstat.c b/ports/sysdeps/unix/sysv/linux/alpha/fxstat.c new file mode 100644 index 000000000..40e08fd86 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/fxstat.c @@ -0,0 +1,64 @@ +/* fxstat using old-style Unix stat system call. + Copyright (C) 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define __fxstat64 __fxstat64_disable + +#include <errno.h> +#include <stddef.h> +#include <sys/stat.h> +#include <kernel_stat.h> +#include <sysdep.h> +#include <sys/syscall.h> +#include <xstatconv.h> + +#undef __fxstat64 + + +/* Get information about the file NAME in BUF. */ +int +__fxstat (int vers, int fd, struct stat *buf) +{ + INTERNAL_SYSCALL_DECL (err); + int result, errno_out; + struct kernel_stat kbuf; + + if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64) + { + result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf); + if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + return result; + errno_out = INTERNAL_SYSCALL_ERRNO (result, err); + if (errno_out != ENOSYS) + goto fail; + __libc_missing_axp_stat64 = 1; + } + + result = INTERNAL_SYSCALL (fstat, err, 2, fd, &kbuf); + if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + return __xstat_conv (vers, &kbuf, buf); + errno_out = INTERNAL_SYSCALL_ERRNO (result, err); + + fail: + __set_errno (errno_out); + return -1; +} +hidden_def (__fxstat) +weak_alias (__fxstat, _fxstat); +strong_alias (__fxstat, __fxstat64); +hidden_ver (__fxstat, __fxstat64) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/fxstatat.c b/ports/sysdeps/unix/sysv/linux/alpha/fxstatat.c new file mode 100644 index 000000000..497694619 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/fxstatat.c @@ -0,0 +1,99 @@ +/* Copyright (C) 2005, 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define __fxstatat64 __fxstatat64_disable + +#include <errno.h> +#include <fcntl.h> +#include <stddef.h> +#include <stdio.h> +#include <sys/stat.h> +#include <kernel_stat.h> +#include <sysdep.h> +#include <sys/syscall.h> +#include <xstatconv.h> + +#undef __fxstatat64 + + +/* Get information about the file NAME in BUF. */ +int +__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) +{ + if (flag & ~AT_SYMLINK_NOFOLLOW) + { + __set_errno (EINVAL); + return -1; + } + + char *buf = NULL; + + if (fd != AT_FDCWD && file[0] != '/') + { + size_t filelen = strlen (file); + static const char procfd[] = "/proc/self/fd/%d/%s"; + /* Buffer for the path name we are going to use. It consists of + - the string /proc/self/fd/ + - the file descriptor number + - the file name provided. + The final NUL is included in the sizeof. A bit of overhead + due to the format elements compensates for possible negative + numbers. */ + size_t buflen = sizeof (procfd) + sizeof (int) * 3 + filelen; + buf = alloca (buflen); + + __snprintf (buf, buflen, procfd, fd, file); + file = buf; + } + + INTERNAL_SYSCALL_DECL (err); + int result, errno_out; + struct kernel_stat kst; + + if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64) + { + if (flag & AT_SYMLINK_NOFOLLOW) + result = INTERNAL_SYSCALL (lstat64, err, 2, file, st); + else + result = INTERNAL_SYSCALL (stat64, err, 2, file, st); + + if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + return result; + errno_out = INTERNAL_SYSCALL_ERRNO (result, err); + if (errno_out != ENOSYS) + goto fail; + __libc_missing_axp_stat64 = 1; + } + + if (flag & AT_SYMLINK_NOFOLLOW) + result = INTERNAL_SYSCALL (lstat, err, 2, file, &kst); + else + result = INTERNAL_SYSCALL (stat, err, 2, file, &kst); + + if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + return __xstat_conv (vers, &kst, st); + errno_out = INTERNAL_SYSCALL_ERRNO (result, err); + + fail: + __atfct_seterrno (errno_out, fd, buf); + + return -1; +} +libc_hidden_def (__fxstatat) +strong_alias (__fxstatat, __fxstatat64); +libc_hidden_ver(__fxstatat, __fxstatat64); diff --git a/ports/sysdeps/unix/sysv/linux/alpha/getclktck.c b/ports/sysdeps/unix/sysv/linux/alpha/getclktck.c new file mode 100644 index 000000000..6636bbe68 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/getclktck.c @@ -0,0 +1,2 @@ +#define SYSTEM_CLK_TCK 1024 +#include <sysdeps/unix/sysv/linux/getclktck.c> diff --git a/ports/sysdeps/unix/sysv/linux/alpha/getcontext.S b/ports/sysdeps/unix/sysv/linux/alpha/getcontext.S new file mode 100644 index 000000000..f010f337e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/getcontext.S @@ -0,0 +1,188 @@ +/* Save current context. + Copyright (C) 2004, 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include <ucontext-offsets.h> + +/* ??? Should be a better place for this that's asm friendly. */ +#define SIG_BLOCK 1 + + +ENTRY (__getcontext) +#ifdef PROF + ldgp gp, 0(pv) + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at + .prologue 1 +#else + .prologue 0 +#endif + + bsr $0, __getcontext_x + mov $31, $0 + ret + +END(__getcontext) +weak_alias (__getcontext, getcontext) + + +/* An internal routine used by getcontext and setcontext. + The incomming return address register is $0. */ + + .align 4 + .globl __getcontext_x + .hidden __getcontext_x + .usepv __getcontext_x, no + + cfi_startproc + cfi_return_column (64) +__getcontext_x: + cfi_register (64, 0) + + .set noat + + /* Return value of getcontext. $0 is the only register + whose value is not preserved. */ + stq $31, UC_SIGCTX+SC_REGS($16) + + /* Store all registers into the context. */ + stq $1, UC_SIGCTX+SC_REGS+1*8($16) + stq $2, UC_SIGCTX+SC_REGS+2*8($16) + stq $3, UC_SIGCTX+SC_REGS+3*8($16) + stq $4, UC_SIGCTX+SC_REGS+4*8($16) + stq $5, UC_SIGCTX+SC_REGS+5*8($16) + stq $6, UC_SIGCTX+SC_REGS+6*8($16) + stq $7, UC_SIGCTX+SC_REGS+7*8($16) + stq $8, UC_SIGCTX+SC_REGS+8*8($16) + stq $9, UC_SIGCTX+SC_REGS+9*8($16) + stq $10, UC_SIGCTX+SC_REGS+10*8($16) + stq $11, UC_SIGCTX+SC_REGS+11*8($16) + stq $12, UC_SIGCTX+SC_REGS+12*8($16) + stq $13, UC_SIGCTX+SC_REGS+13*8($16) + stq $14, UC_SIGCTX+SC_REGS+14*8($16) + stq $15, UC_SIGCTX+SC_REGS+15*8($16) + stq $16, UC_SIGCTX+SC_REGS+16*8($16) + stq $17, UC_SIGCTX+SC_REGS+17*8($16) + stq $18, UC_SIGCTX+SC_REGS+18*8($16) + stq $19, UC_SIGCTX+SC_REGS+19*8($16) + stq $20, UC_SIGCTX+SC_REGS+20*8($16) + stq $21, UC_SIGCTX+SC_REGS+21*8($16) + stq $22, UC_SIGCTX+SC_REGS+22*8($16) + stq $23, UC_SIGCTX+SC_REGS+23*8($16) + stq $24, UC_SIGCTX+SC_REGS+24*8($16) + stq $25, UC_SIGCTX+SC_REGS+25*8($16) + stq $26, UC_SIGCTX+SC_REGS+26*8($16) + stq $27, UC_SIGCTX+SC_REGS+27*8($16) + stq $28, UC_SIGCTX+SC_REGS+28*8($16) + stq $29, UC_SIGCTX+SC_REGS+29*8($16) + stq $30, UC_SIGCTX+SC_REGS+30*8($16) + stq $31, UC_SIGCTX+SC_REGS+31*8($16) + + stt $f0, UC_SIGCTX+SC_FPREGS+0*8($16) + stt $f1, UC_SIGCTX+SC_FPREGS+1*8($16) + stt $f2, UC_SIGCTX+SC_FPREGS+2*8($16) + stt $f3, UC_SIGCTX+SC_FPREGS+3*8($16) + stt $f4, UC_SIGCTX+SC_FPREGS+4*8($16) + stt $f5, UC_SIGCTX+SC_FPREGS+5*8($16) + stt $f6, UC_SIGCTX+SC_FPREGS+6*8($16) + stt $f7, UC_SIGCTX+SC_FPREGS+7*8($16) + stt $f8, UC_SIGCTX+SC_FPREGS+8*8($16) + stt $f9, UC_SIGCTX+SC_FPREGS+9*8($16) + stt $f10, UC_SIGCTX+SC_FPREGS+10*8($16) + stt $f11, UC_SIGCTX+SC_FPREGS+11*8($16) + stt $f12, UC_SIGCTX+SC_FPREGS+12*8($16) + stt $f13, UC_SIGCTX+SC_FPREGS+13*8($16) + stt $f14, UC_SIGCTX+SC_FPREGS+14*8($16) + stt $f15, UC_SIGCTX+SC_FPREGS+15*8($16) + stt $f16, UC_SIGCTX+SC_FPREGS+16*8($16) + stt $f17, UC_SIGCTX+SC_FPREGS+17*8($16) + stt $f18, UC_SIGCTX+SC_FPREGS+18*8($16) + stt $f19, UC_SIGCTX+SC_FPREGS+19*8($16) + stt $f20, UC_SIGCTX+SC_FPREGS+20*8($16) + stt $f21, UC_SIGCTX+SC_FPREGS+21*8($16) + stt $f22, UC_SIGCTX+SC_FPREGS+22*8($16) + stt $f23, UC_SIGCTX+SC_FPREGS+23*8($16) + stt $f24, UC_SIGCTX+SC_FPREGS+24*8($16) + stt $f25, UC_SIGCTX+SC_FPREGS+25*8($16) + stt $f26, UC_SIGCTX+SC_FPREGS+26*8($16) + stt $f27, UC_SIGCTX+SC_FPREGS+27*8($16) + stt $f28, UC_SIGCTX+SC_FPREGS+28*8($16) + stt $f29, UC_SIGCTX+SC_FPREGS+29*8($16) + stt $f30, UC_SIGCTX+SC_FPREGS+30*8($16) + stt $f31, UC_SIGCTX+SC_FPREGS+31*8($16) + + mf_fpcr $f0 + lda $1, 8 + stt $f0, UC_SIGCTX+SC_FPCR($16) + + /* The return address of getcontext is the restart pc. */ + stq $26, UC_SIGCTX+SC_PC($16) + + /* Userlevel always has a processor status word of 8. */ + stq $1, UC_SIGCTX+SC_PS($16) + + /* Save registers around the syscall. We preserve $17 + for the benefit of swapcontext. */ + subq $30, 4*8, $30 + cfi_adjust_cfa_offset(4*8) + stq $0, 0($30) + cfi_rel_offset(64, 0) + stq $16, 8($30) + stq $17, 16($30) + + /* Save the current signal mask. Whee, there are three + copies of this in the alpha ucontext_t. */ + lda $16, SIG_BLOCK + lda $17, 0 + lda $0, __NR_osf_sigprocmask + callsys + + ldq $16, 8($30) + ldq $17, 16($30) + + stq $0, UC_OSF_SIGMASK($16) + stq $0, UC_SIGCTX+SC_MASK($16) + stq $0, UC_SIGMASK($16) + stq $31, UC_SIGMASK + 1*8($16) + stq $31, UC_SIGMASK + 2*8($16) + stq $31, UC_SIGMASK + 3*8($16) + stq $31, UC_SIGMASK + 4*8($16) + stq $31, UC_SIGMASK + 5*8($16) + stq $31, UC_SIGMASK + 6*8($16) + stq $31, UC_SIGMASK + 7*8($16) + stq $31, UC_SIGMASK + 8*8($16) + stq $31, UC_SIGMASK + 9*8($16) + stq $31, UC_SIGMASK +10*8($16) + stq $31, UC_SIGMASK +11*8($16) + stq $31, UC_SIGMASK +12*8($16) + stq $31, UC_SIGMASK +13*8($16) + stq $31, UC_SIGMASK +14*8($16) + stq $31, UC_SIGMASK +15*8($16) + + ldq $0, 0($30) + addq $30, 4*8, $30 + cfi_register (64, 0) + cfi_adjust_cfa_offset(-4*8) + ret $31, ($0), 1 + + cfi_endproc + .size __getcontext_x, .-__getcontext_x + .type __getcontext_x, @function diff --git a/ports/sysdeps/unix/sysv/linux/alpha/getdents.c b/ports/sysdeps/unix/sysv/linux/alpha/getdents.c new file mode 100644 index 000000000..dfecfef92 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/getdents.c @@ -0,0 +1,3 @@ +#define DIRENT_SET_DP_INO(dp, value) \ + do { (dp)->d_ino = (value); (dp)->__pad = 0; } while (0) +#include <sysdeps/unix/sysv/linux/getdents.c> diff --git a/ports/sysdeps/unix/sysv/linux/alpha/getdents64.c b/ports/sysdeps/unix/sysv/linux/alpha/getdents64.c new file mode 100644 index 000000000..e53570c03 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/getdents64.c @@ -0,0 +1 @@ +#include "../getdents64.c" diff --git a/ports/sysdeps/unix/sysv/linux/alpha/gethostname.c b/ports/sysdeps/unix/sysv/linux/alpha/gethostname.c new file mode 100644 index 000000000..4e15ee43e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/gethostname.c @@ -0,0 +1,47 @@ +/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2001 + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <string.h> +#include <unistd.h> + +#include <sysdep.h> +#include <sys/syscall.h> +#include <bp-checks.h> + +int +__gethostname (char *name, size_t len) +{ + int result; + + result = INLINE_SYSCALL (gethostname, 2, CHECK_N (name, len), len); + + if (result == 0 + /* See whether the string is terminated. If not we will return + an error. */ + && memchr (name, '\0', len) == NULL) + { + __set_errno (EOVERFLOW); + result = -1; + } + + return result; +} + +weak_alias (__gethostname, gethostname) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/getitimer.S b/ports/sysdeps/unix/sysv/linux/alpha/getitimer.S new file mode 100644 index 000000000..6644a5c36 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/getitimer.S @@ -0,0 +1,113 @@ +/* Copyright (C) 1998, 2003, 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#define _ERRNO_H 1 +#include <bits/errno.h> +#include <kernel-features.h> + +.text + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +#define GETITIMER __getitimer_tv64 +#else +#define GETITIMER getitimer +#endif + +#if defined __ASSUME_TIMEVAL64 +PSEUDO(GETITIMER, getitimer, 2) + ret +PSEUDO_END(GETITIMER) +#else +/* The problem here is that initially we made struct timeval compatible with + OSF/1, using int32. But we defined time_t with uint64, and later found + that POSIX requires tv_sec to be time_t. + + So now we have to do compatibility stuff. */ + +/* The variable is shared between all wrappers around signal handling + functions which have RT equivalents. */ +.comm __libc_missing_axp_tv64, 4 + +LEAF(GETITIMER, 16) + ldgp gp, 0(pv) + subq sp, 16, sp +#ifdef PROF + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at +#endif + .prologue 1 + + ldl t0, __libc_missing_axp_tv64 + + /* Save arguments in case we do need to fall back. */ + stq a0, 0(sp) + stq a1, 8(sp) + + bne t0, $do32 + + ldi v0, SYS_ify(getitimer) + callsys + bne a3, $err64 + + /* Everything ok. */ + addq sp, 16, sp + ret + + /* If we didn't get ENOSYS, it is a real error. */ + .align 3 +$err64: cmpeq v0, ENOSYS, t0 + beq t0, $error + stl t0, __libc_missing_axp_tv64 + + /* Recover the saved arguments. */ + ldq a1, 8(sp) + ldq a0, 0(sp) + + .align 3 +$do32: ldi v0, SYS_ify(osf_getitimer) + callsys + bne a3, $error + + /* Copy back to proper format. */ + ldq a1, 8(sp) + ldl t0, 0(a1) + ldl t1, 4(a1) + ldl t2, 8(a1) + ldl t3, 12(a1) + stq t0, 0(a1) + stq t1, 8(a1) + stq t2, 16(a1) + stq t3, 24(a1) + + addq sp, 16, sp + ret + + .align 3 +$error: + addq sp, 16, sp + SYSCALL_ERROR_HANDLER + +END(GETITIMER) +#endif /* __ASSUME_TIMEVAL64 */ + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +default_symbol_version (__getitimer_tv64, getitimer, GLIBC_2.1) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/getrusage.S b/ports/sysdeps/unix/sysv/linux/alpha/getrusage.S new file mode 100644 index 000000000..0bca4b5f2 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/getrusage.S @@ -0,0 +1,149 @@ +/* Copyright (C) 1998, 2003, 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#define _ERRNO_H 1 +#include <bits/errno.h> +#include <kernel-features.h> + +.text + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +#define GETRUSAGE __getrusage_tv64 +#else +#define GETRUSAGE __getrusage +#endif + +#if defined __ASSUME_TIMEVAL64 +PSEUDO(GETRUSAGE, getrusage, 2) + ret +PSEUDO_END(GETRUSAGE) +#else +/* The problem here is that initially we made struct timeval compatible with + OSF/1, using int32. But we defined time_t with uint64, and later found + that POSIX requires tv_sec to be time_t. + + So now we have to do compatibility stuff. */ + +/* The variable is shared between all wrappers around signal handling + functions which have RT equivalents. */ +.comm __libc_missing_axp_tv64, 4 + +LEAF(GETRUSAGE, 16) + ldgp gp, 0(pv) + subq sp, 16, sp +#ifdef PROF + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at +#endif + .prologue 1 + + ldl t0, __libc_missing_axp_tv64 + + /* Save arguments in case we do need to fall back. */ + stq a0, 0(sp) + stq a1, 8(sp) + + bne t0, $do32 + + ldi v0, SYS_ify(getrusage) + callsys + bne a3, $err64 + + /* Everything ok. */ + addq sp, 16, sp + ret + + /* If we didn't get ENOSYS, it is a real error. */ + .align 3 +$err64: cmpeq v0, ENOSYS, t0 + beq t0, $error + stl t0, __libc_missing_axp_tv64 + + /* Recover the saved arguments. */ + ldq a1, 8(sp) + ldq a0, 0(sp) + + .align 3 +$do32: ldi v0, SYS_ify(osf_getrusage) + callsys + bne a3, $error + + /* Copy back to proper format. */ + ldq a1, 8(sp) + ldl t0, 0(a1) # ru_utime.tv_sec + ldl t1, 4(a1) # ru_utime.tv_usec + ldl t2, 8(a1) # ru_stime.tv_sec + ldl t3, 12(a1) # ru_stime.tv_usec + ldt $f15, 16(a1) # ru_maxrss + ldt $f16, 24(a1) # ru_ixrss + ldt $f17, 32(a1) # ru_idrss + ldt $f18, 40(a1) # ru_isrss + ldt $f19, 48(a1) # ru_minflt + ldt $f20, 56(a1) # ru_majflt + ldt $f21, 64(a1) # ru_nswap + ldt $f22, 72(a1) # ru_inblock + ldt $f23, 80(a1) # ru_oublock + ldt $f24, 88(a1) # ru_msgsend + ldt $f25, 96(a1) # ru_msgrcv + ldt $f26, 104(a1) # ru_nsignals + ldt $f27, 112(a1) # ru_nvcsw + .set noat + ldt $f28, 120(a1) # ru_nivcsw + .set at + stq t0, 0(a1) + stq t1, 8(a1) + stq t2, 16(a1) + stq t3, 24(a1) + stt $f15, 32(a1) + stt $f16, 40(a1) + stt $f17, 48(a1) + stt $f18, 56(a1) + stt $f19, 64(a1) + stt $f20, 72(a1) + stt $f21, 80(a1) + stt $f22, 88(a1) + stt $f23, 96(a1) + stt $f24, 104(a1) + stt $f25, 112(a1) + stt $f26, 120(a1) + stt $f27, 128(a1) + .set noat + stt $f28, 136(a1) + .set at + + addq sp, 16, sp + ret + + .align 3 +$error: + addq sp, 16, sp + SYSCALL_ERROR_HANDLER + +END(GETRUSAGE) +#endif /* __ASSUME_TIMEVAL64 */ + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +strong_alias(__getrusage_tv64, ____getrusage_tv64) +default_symbol_version (____getrusage_tv64, __getrusage, GLIBC_2.1) +default_symbol_version (__getrusage_tv64, getrusage, GLIBC_2.1) +#else +weak_alias (__getrusage, getrusage) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/getsysstats.c b/ports/sysdeps/unix/sysv/linux/alpha/getsysstats.c new file mode 100644 index 000000000..0e49a8452 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/getsysstats.c @@ -0,0 +1,57 @@ +/* Determine various system internal values, Linux/Alpha version. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Schwab <schwab@suse.de> + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + + +/* We need to define a special parser for /proc/cpuinfo. */ +#define GET_NPROCS_PARSER(FP, BUFFER, RESULT) \ + do \ + { \ + /* Find the line that contains the information about the number of \ + active cpus. We don't have to fear extremely long lines since \ + the kernel will not generate them. 8192 bytes are really enough. \ + If there is no "CPUs ..." line then we are on a UP system. */ \ + (RESULT) = 1; \ + while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != NULL) \ + if ((sscanf (BUFFER, "cpus active : %d", &(RESULT)) == 1) \ + || (sscanf (BUFFER, "CPUs probed %*d active %d", \ + &(RESULT)) == 1)) \ + break; \ + } \ + while (0) + + +/* On the Alpha we can distinguish between the number of configured and + active cpus. */ +#define GET_NPROCS_CONF_PARSER(FP, BUFFER, RESULT) \ + do \ + { \ + /* Find the line that contains the information about the number of \ + probed cpus. We don't have to fear extremely long lines since \ + the kernel will not generate them. 8192 bytes are really enough. \ + If there is no "CPUs ..." line then we are on a UP system. */ \ + (RESULT) = 1; \ + while (fgets_unlocked ((BUFFER), sizeof (BUFFER), (FP)) != NULL) \ + if ((sscanf (buffer, "cpus detected : %d", &(RESULT)) == 1) \ + || (sscanf (buffer, "CPUs probed %d", &(RESULT)) == 1)) \ + break; \ + } \ + while (0) + +#include <sysdeps/unix/sysv/linux/getsysstats.c> diff --git a/ports/sysdeps/unix/sysv/linux/alpha/gettimeofday.S b/ports/sysdeps/unix/sysv/linux/alpha/gettimeofday.S new file mode 100644 index 000000000..7c9183a4f --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/gettimeofday.S @@ -0,0 +1,120 @@ +/* Copyright (C) 1998, 2002, 2003, 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#define _ERRNO_H 1 +#include <bits/errno.h> +#include <kernel-features.h> + +.text + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +#define GETTIMEOFDAY __gettimeofday_tv64 +#else +#define GETTIMEOFDAY __gettimeofday +#endif + +#if defined __ASSUME_TIMEVAL64 +PSEUDO(GETTIMEOFDAY, gettimeofday, 2) + ret +PSEUDO_END(GETTIMEOFDAY) +#else + +/* The problem here is that initially we made struct timeval compatible with + OSF/1, using int32. But we defined time_t with uint64, and later found + that POSIX requires tv_sec to be time_t. + + So now we have to do compatibility stuff. */ + +/* The variable is shared between all wrappers around signal handling + functions which have RT equivalents. */ +.comm __libc_missing_axp_tv64, 4 + +LEAF(GETTIMEOFDAY, 16) + ldgp gp, 0(pv) + subq sp, 16, sp +#ifdef PROF + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at +#endif + .prologue 1 + + ldl t0, __libc_missing_axp_tv64 + + /* Save arguments in case we do need to fall back. */ + stq a0, 0(sp) + stq a1, 8(sp) + + bne t0, $do32 + + ldi v0, SYS_ify(gettimeofday) + callsys + bne a3, $err64 + + /* Everything ok. */ + addq sp, 16, sp + ret + + /* If we didn't get ENOSYS, it is a real error. */ + .align 3 +$err64: cmpeq v0, ENOSYS, t0 + beq t0, $error + stl t0, __libc_missing_axp_tv64 + + /* Recover the saved arguments. */ + ldq a1, 8(sp) + ldq a0, 0(sp) + + .align 3 +$do32: ldi v0, SYS_ify(osf_gettimeofday) + callsys + bne a3, $error + + /* Copy back to proper format. */ + ldq a0, 0(sp) + beq a0, 2f + ldl t0, 0(a0) + ldl t1, 4(a0) + stq t0, 0(a0) + stq t1, 8(a0) + +2: addq sp, 16, sp + ret + + .align 3 +$error: + addq sp, 16, sp + SYSCALL_ERROR_HANDLER + +END(GETTIMEOFDAY) +#endif /* __ASSUME_TIMEVAL64 */ + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +default_symbol_version (__gettimeofday_tv64, __gettimeofday, GLIBC_2.1) + +/* It seems to me to be a misfeature of the assembler that we can only + have one version-alias per symbol. So create an alias ourselves. + The 'p' is for 'public'. *Shrug* */ +strong_alias (__gettimeofday_tv64, __gettimeofday_tv64p) +default_symbol_version (__gettimeofday_tv64p, gettimeofday, GLIBC_2.1) +#else +weak_alias (__gettimeofday, gettimeofday) +#endif +strong_alias(GETTIMEOFDAY, __gettimeofday_internal) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/glob.c b/ports/sysdeps/unix/sysv/linux/alpha/glob.c new file mode 100644 index 000000000..84573899d --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/glob.c @@ -0,0 +1,52 @@ +/* Copyright (C) 1998, 2000, 2002, 2005 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define glob64 __no_glob64_decl +#define globfree64 __no_globfree64_decl + +#include <sys/types.h> +#include <glob.h> +#include <shlib-compat.h> + +/* For Linux/Alpha we have to make the glob symbols versioned. */ +#define glob(pattern, flags, errfunc, pglob) \ + __new_glob (pattern, flags, errfunc, pglob) +#define globfree(pglob) \ + __new_globfree (pglob) + +/* We need prototypes for these new names. */ +extern int __new_glob (const char *__pattern, int __flags, + int (*__errfunc) (const char *, int), + glob_t *__pglob); +extern void __new_globfree (glob_t *__pglob); + +#include <posix/glob.c> + +#undef glob +#undef globfree +#undef glob64 +#undef globfree64 + +versioned_symbol (libc, __new_glob, glob, GLIBC_2_1); +versioned_symbol (libc, __new_globfree, globfree, GLIBC_2_1); +libc_hidden_ver (__new_glob, glob) +libc_hidden_ver (__new_globfree, globfree) + +weak_alias (__new_glob, glob64) +weak_alias (__new_globfree, globfree64) +libc_hidden_ver (__new_globfree, globfree64) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S b/ports/sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S new file mode 100644 index 000000000..4779f175e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S @@ -0,0 +1,61 @@ +/* Copyright (C) 1993, 1995, 1996, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger <davidm@azstarnet.com>, 1995. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include "kernel_sysinfo.h" + + + .text + +LEAF(__ieee_get_fp_control, 16) +#ifdef PROF + ldgp gp, 0(pv) + lda sp, -16(sp) + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at + .prologue 1 +#elif defined PIC + lda sp, -16(sp) + .prologue 0 +#else + ldgp gp, 0(pv) + lda sp, -16(sp) + .prologue 1 +#endif + + mov sp, a1 + ldi a0, GSI_IEEE_FP_CONTROL + ldi v0, __NR_osf_getsysinfo + call_pal PAL_callsys + bne a3, $error + + ldq v0, 0(sp) + lda sp, 16(sp) + ret + +$error: + lda sp, 16(sp) + SYSCALL_ERROR_HANDLER + + END(__ieee_get_fp_control) + +libc_hidden_def(__ieee_get_fp_control) +weak_alias (__ieee_get_fp_control, ieee_get_fp_control) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S b/ports/sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S new file mode 100644 index 000000000..a9c0891aa --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S @@ -0,0 +1,61 @@ +/* Copyright (C) 1993, 1995, 1996, 1997, 2003, 2004 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger <davidm@azstarnet.com>, 1995. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include "kernel_sysinfo.h" + + +LEAF(__ieee_set_fp_control, 16) +#ifdef PROF + ldgp gp, 0(pv) + lda sp, -16(sp) + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at + .prologue 1 +#elif defined PIC + lda sp, -16(sp) + .prologue 0 +#else + ldgp gp, 0(pv) + lda sp, -16(sp) + .prologue 1 +#endif + + stq a0, 0(sp) + mov sp, a1 + ldi a0, SSI_IEEE_FP_CONTROL + ldi v0, __NR_osf_setsysinfo + call_pal PAL_callsys + + bne a3, $error + + lda sp, 16(sp) + ret + +$error: + lda sp, 16(sp) + SYSCALL_ERROR_HANDLER + + END(__ieee_set_fp_control) + +libc_hidden_def(__ieee_set_fp_control) +weak_alias (__ieee_set_fp_control, ieee_set_fp_control) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c b/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c new file mode 100644 index 000000000..32e96ec2f --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/ioperm.c @@ -0,0 +1,883 @@ +/* Copyright (C) 1992, 1996-1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; 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, 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 page, there + are PAGE_SIZE>>IO_SHIFT I/O ports (e.g., 256 ports on a Low Cost Alpha + based system using 8KB pages). + + Keep in mind that this code should be able to run in a 32bit address + space. It is therefore unreasonable to expect mmap'ing the entire + sparse address space would work (e.g., the Low Cost Alpha chip has an + I/O address space that's 512MB large!). */ + +/* Make sure the ldbu/stb asms below are not expaneded to macros. */ +#ifndef __alpha_bwx__ +asm(".arch ev56"); +#endif + +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <ctype.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include <sys/types.h> +#include <sys/mman.h> +#include <sys/io.h> + +#include <sysdep.h> +#include <sys/syscall.h> + +#define PATH_ALPHA_SYSTYPE "/etc/alpha_systype" +#define PATH_CPUINFO "/proc/cpuinfo" + +#define MAX_PORT 0x10000 +#define vip volatile int * +#define vuip volatile unsigned int * +#define vusp volatile unsigned short * +#define vucp volatile unsigned char * + +#define JENSEN_IO_BASE (0x300000000UL) +#define JENSEN_SPARSE_MEM (0x200000000UL) + +/* With respect to the I/O architecture, APECS and LCA are identical, + so the following defines apply to LCA as well. */ +#define APECS_IO_BASE (0x1c0000000UL) +#define APECS_SPARSE_MEM (0x200000000UL) +#define APECS_DENSE_MEM (0x300000000UL) + +/* The same holds for CIA and PYXIS, except for PYXIS we prefer BWX. */ +#define CIA_IO_BASE (0x8580000000UL) +#define CIA_SPARSE_MEM (0x8000000000UL) +#define CIA_DENSE_MEM (0x8600000000UL) + +#define PYXIS_IO_BASE (0x8900000000UL) +#define PYXIS_DENSE_MEM (0x8800000000UL) + +/* SABLE is EV4, GAMMA is EV5 */ +#define T2_IO_BASE (0x3a0000000UL) +#define T2_SPARSE_MEM (0x200000000UL) +#define T2_DENSE_MEM (0x3c0000000UL) + +#define GAMMA_IO_BASE (0x83a0000000UL) +#define GAMMA_SPARSE_MEM (0x8200000000UL) +#define GAMMA_DENSE_MEM (0x83c0000000UL) + +/* NOTE: these are hardwired to PCI bus 0 addresses!!! */ +#define MCPCIA_IO_BASE (0xf980000000UL) +#define MCPCIA_SPARSE_MEM (0xf800000000UL) +#define MCPCIA_DENSE_MEM (0xf900000000UL) + +/* Tsunami and Irongate use the same offsets, at least for hose 0. */ +#define TSUNAMI_IO_BASE (0x801fc000000UL) +#define TSUNAMI_DENSE_MEM (0x80000000000UL) + +/* Polaris has SPARSE space, but we prefer to use only DENSE + because of some idiosyncracies in actually using SPARSE. */ +#define POLARIS_IO_BASE (0xf9fc000000UL) +#define POLARIS_DENSE_MEM (0xf900000000UL) + +typedef enum { + IOSYS_UNKNOWN, IOSYS_JENSEN, IOSYS_APECS, IOSYS_CIA, IOSYS_PYXIS, IOSYS_T2, + IOSYS_TSUNAMI, IOSYS_MCPCIA, IOSYS_GAMMA, IOSYS_POLARIS, + IOSYS_CPUDEP, IOSYS_PCIDEP +} iosys_t; + +typedef enum { + IOSWIZZLE_JENSEN, IOSWIZZLE_SPARSE, IOSWIZZLE_DENSE +} ioswizzle_t; + +static struct io_system { + unsigned long int bus_memory_base; + unsigned long int sparse_bus_mem_base; + unsigned long int bus_io_base; +} io_system[] = { /* NOTE! must match iosys_t enumeration */ +/* UNKNOWN */ {0, 0, 0}, +/* JENSEN */ {0, JENSEN_SPARSE_MEM, JENSEN_IO_BASE}, +/* APECS */ {APECS_DENSE_MEM, APECS_SPARSE_MEM, APECS_IO_BASE}, +/* CIA */ {CIA_DENSE_MEM, CIA_SPARSE_MEM, CIA_IO_BASE}, +/* PYXIS */ {PYXIS_DENSE_MEM, 0, PYXIS_IO_BASE}, +/* T2 */ {T2_DENSE_MEM, T2_SPARSE_MEM, T2_IO_BASE}, +/* TSUNAMI */ {TSUNAMI_DENSE_MEM, 0, TSUNAMI_IO_BASE}, +/* MCPCIA */ {MCPCIA_DENSE_MEM, MCPCIA_SPARSE_MEM, MCPCIA_IO_BASE}, +/* GAMMA */ {GAMMA_DENSE_MEM, GAMMA_SPARSE_MEM, GAMMA_IO_BASE}, +/* POLARIS */ {POLARIS_DENSE_MEM, 0, POLARIS_IO_BASE}, +/* CPUDEP */ {0, 0, 0}, /* for platforms dependent on CPU type */ +/* PCIDEP */ {0, 0, 0}, /* for platforms dependent on core logic */ +}; + +static struct platform { + const char *name; + iosys_t io_sys; +} platform[] = { + {"Alcor", IOSYS_CIA}, + {"Avanti", IOSYS_APECS}, + {"Cabriolet", IOSYS_APECS}, + {"EB164", IOSYS_PCIDEP}, + {"EB64+", IOSYS_APECS}, + {"EB66", IOSYS_APECS}, + {"EB66P", IOSYS_APECS}, + {"Jensen", IOSYS_JENSEN}, + {"Miata", IOSYS_PYXIS}, + {"Mikasa", IOSYS_CPUDEP}, + {"Nautilus", IOSYS_TSUNAMI}, + {"Noname", IOSYS_APECS}, + {"Noritake", IOSYS_CPUDEP}, + {"Rawhide", IOSYS_MCPCIA}, + {"Ruffian", IOSYS_PYXIS}, + {"Sable", IOSYS_CPUDEP}, + {"Takara", IOSYS_CIA}, + {"Tsunami", IOSYS_TSUNAMI}, + {"XL", IOSYS_APECS}, +}; + +struct ioswtch { + void (*sethae)(unsigned long int addr); + void (*outb)(unsigned char b, unsigned long int port); + void (*outw)(unsigned short b, unsigned long int port); + void (*outl)(unsigned int b, unsigned long int port); + unsigned int (*inb)(unsigned long int port); + unsigned int (*inw)(unsigned long int port); + unsigned int (*inl)(unsigned long int port); +}; + +static struct { + unsigned long int hae_cache; + unsigned long int base; + struct ioswtch * swp; + unsigned long int bus_memory_base; + unsigned long int sparse_bus_memory_base; + unsigned long int io_base; + ioswizzle_t swiz; +} io; + +static inline void +stb_mb(unsigned char val, unsigned long addr) +{ + __asm__("stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val)); +} + +static inline void +stw_mb(unsigned short val, unsigned long addr) +{ + __asm__("stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val)); +} + +static inline void +stl_mb(unsigned int val, unsigned long addr) +{ + __asm__("stl %1,%0; mb" : "=m"(*(vip)addr) : "r"(val)); +} + +/* No need to examine error -- sethae never fails. */ +static inline void +__sethae(unsigned long value) +{ + register unsigned long r16 __asm__("$16") = value; + register unsigned long r0 __asm__("$0") = __NR_sethae; + __asm__ __volatile__ ("callsys" + : "=r"(r0) + : "0"(r0), "r" (r16) + : inline_syscall_clobbers, "$19"); +} + +extern long __pciconfig_iobase(enum __pciconfig_iobase_which __which, + unsigned long int __bus, + unsigned long int __dfn); + +static inline unsigned long int +port_to_cpu_addr (unsigned long int port, ioswizzle_t ioswiz, int size) +{ + if (ioswiz == IOSWIZZLE_SPARSE) + return io.base + (port << 5) + ((size - 1) << 3); + else if (ioswiz == IOSWIZZLE_DENSE) + return port + io.base; + else + return io.base + (port << 7) + ((size - 1) << 5); +} + +static inline void +inline_sethae (unsigned long int addr, ioswizzle_t ioswiz) +{ + if (ioswiz == IOSWIZZLE_SPARSE) + { + unsigned long int msb; + + /* no need to set hae if msb is 0: */ + msb = addr & 0xf8000000; + if (msb && msb != io.hae_cache) + { + io.hae_cache = msb; + __sethae (msb); + } + } + else if (ioswiz == IOSWIZZLE_JENSEN) + { + /* HAE on the Jensen is bits 31:25 shifted right. */ + addr >>= 25; + if (addr != io.hae_cache) + { + io.hae_cache = addr; + __sethae (addr); + } + } +} + +static inline void +inline_outb (unsigned char b, unsigned long int port, ioswizzle_t ioswiz) +{ + unsigned int w; + unsigned long int addr = port_to_cpu_addr (port, ioswiz, 1); + + asm ("insbl %2,%1,%0" : "=r" (w) : "ri" (port & 0x3), "r" (b)); + stl_mb(w, addr); +} + + +static inline void +inline_outw (unsigned short int b, unsigned long int port, ioswizzle_t ioswiz) +{ + unsigned long w; + unsigned long int addr = port_to_cpu_addr (port, ioswiz, 2); + + asm ("inswl %2,%1,%0" : "=r" (w) : "ri" (port & 0x3), "r" (b)); + stl_mb(w, addr); +} + + +static inline void +inline_outl (unsigned int b, unsigned long int port, ioswizzle_t ioswiz) +{ + unsigned long int addr = port_to_cpu_addr (port, ioswiz, 4); + + stl_mb(b, addr); +} + + +static inline unsigned int +inline_inb (unsigned long int port, ioswizzle_t ioswiz) +{ + unsigned long int addr = port_to_cpu_addr (port, ioswiz, 1); + int result; + + result = *(vip) addr; + result >>= (port & 3) * 8; + return 0xffUL & result; +} + + +static inline unsigned int +inline_inw (unsigned long int port, ioswizzle_t ioswiz) +{ + unsigned long int addr = port_to_cpu_addr (port, ioswiz, 2); + int result; + + result = *(vip) addr; + result >>= (port & 3) * 8; + return 0xffffUL & result; +} + + +static inline unsigned int +inline_inl (unsigned long int port, ioswizzle_t ioswiz) +{ + unsigned long int addr = port_to_cpu_addr (port, ioswiz, 4); + + return *(vuip) addr; +} + +/* + * Now define the inline functions for CPUs supporting byte/word insns, + * and whose core logic supports I/O space accesses utilizing them. + * + * These routines could be used by MIATA, for example, because it has + * and EV56 plus PYXIS, but it currently uses SPARSE anyway. This is + * also true of RX164 which used POLARIS, but we will choose to use + * these routines in that case instead of SPARSE. + * + * These routines are necessary for TSUNAMI/TYPHOON based platforms, + * which will have (at least) EV6. + */ + +static inline unsigned long int +dense_port_to_cpu_addr (unsigned long int port) +{ + return port + io.base; +} + +static inline void +inline_bwx_outb (unsigned char b, unsigned long int port) +{ + unsigned long int addr = dense_port_to_cpu_addr (port); + stb_mb (b, addr); +} + +static inline void +inline_bwx_outw (unsigned short int b, unsigned long int port) +{ + unsigned long int addr = dense_port_to_cpu_addr (port); + stw_mb (b, addr); +} + +static inline void +inline_bwx_outl (unsigned int b, unsigned long int port) +{ + unsigned long int addr = dense_port_to_cpu_addr (port); + stl_mb (b, addr); +} + +static inline unsigned int +inline_bwx_inb (unsigned long int port) +{ + unsigned long int addr = dense_port_to_cpu_addr (port); + unsigned char r; + + __asm__ ("ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr)); + return r; +} + +static inline unsigned int +inline_bwx_inw (unsigned long int port) +{ + unsigned long int addr = dense_port_to_cpu_addr (port); + unsigned short r; + + __asm__ ("ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr)); + return r; +} + +static inline unsigned int +inline_bwx_inl (unsigned long int port) +{ + unsigned long int addr = dense_port_to_cpu_addr (port); + + return *(vuip) addr; +} + +/* macros to define routines with appropriate names and functions */ + +/* these do either SPARSE or JENSEN swizzle */ + +#define DCL_SETHAE(name, ioswiz) \ +static void \ +name##_sethae (unsigned long int addr) \ +{ \ + inline_sethae (addr, IOSWIZZLE_##ioswiz); \ +} + +#define DCL_OUT(name, func, type, ioswiz) \ +static void \ +name##_##func (unsigned type b, unsigned long int addr) \ +{ \ + inline_##func (b, addr, IOSWIZZLE_##ioswiz); \ +} + +#define DCL_IN(name, func, ioswiz) \ +static unsigned int \ +name##_##func (unsigned long int addr) \ +{ \ + return inline_##func (addr, IOSWIZZLE_##ioswiz); \ +} + +/* these do DENSE, so no swizzle is needed */ + +#define DCL_OUT_BWX(name, func, type) \ +static void \ +name##_##func (unsigned type b, unsigned long int addr) \ +{ \ + inline_bwx_##func (b, addr); \ +} + +#define DCL_IN_BWX(name, func) \ +static unsigned int \ +name##_##func (unsigned long int addr) \ +{ \ + return inline_bwx_##func (addr); \ +} + +/* now declare/define the necessary routines */ + +DCL_SETHAE(jensen, JENSEN) +DCL_OUT(jensen, outb, char, JENSEN) +DCL_OUT(jensen, outw, short int, JENSEN) +DCL_OUT(jensen, outl, int, JENSEN) +DCL_IN(jensen, inb, JENSEN) +DCL_IN(jensen, inw, JENSEN) +DCL_IN(jensen, inl, JENSEN) + +DCL_SETHAE(sparse, SPARSE) +DCL_OUT(sparse, outb, char, SPARSE) +DCL_OUT(sparse, outw, short int, SPARSE) +DCL_OUT(sparse, outl, int, SPARSE) +DCL_IN(sparse, inb, SPARSE) +DCL_IN(sparse, inw, SPARSE) +DCL_IN(sparse, inl, SPARSE) + +DCL_SETHAE(dense, DENSE) +DCL_OUT_BWX(dense, outb, char) +DCL_OUT_BWX(dense, outw, short int) +DCL_OUT_BWX(dense, outl, int) +DCL_IN_BWX(dense, inb) +DCL_IN_BWX(dense, inw) +DCL_IN_BWX(dense, inl) + +/* define the "swizzle" switch */ +static struct ioswtch ioswtch[] = { + { + jensen_sethae, + jensen_outb, jensen_outw, jensen_outl, + jensen_inb, jensen_inw, jensen_inl + }, + { + sparse_sethae, + sparse_outb, sparse_outw, sparse_outl, + sparse_inb, sparse_inw, sparse_inl + }, + { + dense_sethae, + dense_outb, dense_outw, dense_outl, + dense_inb, dense_inw, dense_inl + } +}; + +#undef DEBUG_IOPERM + +/* Routine to process the /proc/cpuinfo information into the fields + that are required for correctly determining the platform parameters. */ + +struct cpuinfo_data +{ + char systype[256]; /* system type field */ + char sysvari[256]; /* system variation field */ + char cpumodel[256]; /* cpu model field */ +}; + +static inline int +process_cpuinfo(struct cpuinfo_data *data) +{ + int got_type, got_vari, got_model; + char dummy[256]; + FILE * fp; + int n; + + data->systype[0] = 0; + data->sysvari[0] = 0; + data->cpumodel[0] = 0; + + /* If there's an /etc/alpha_systype link, we're intending to override + whatever's in /proc/cpuinfo. */ + n = __readlink (PATH_ALPHA_SYSTYPE, data->systype, 256 - 1); + if (n > 0) + { + data->systype[n] = '\0'; + return 1; + } + + fp = fopen (PATH_CPUINFO, "r"); + if (!fp) + return 0; + + got_type = got_vari = got_model = 0; + + while (1) + { + if (fgets (dummy, 256, fp) == NULL) + break; + if (!got_type && + sscanf (dummy, "system type : %256[^\n]\n", data->systype) == 1) + got_type = 1; + if (!got_vari && + sscanf (dummy, "system variation : %256[^\n]\n", data->sysvari) == 1) + got_vari = 1; + if (!got_model && + sscanf (dummy, "cpu model : %256[^\n]\n", data->cpumodel) == 1) + got_model = 1; + } + + fclose (fp); + +#ifdef DEBUG_IOPERM + fprintf(stderr, "system type: `%s'\n", data->systype); + fprintf(stderr, "system vari: `%s'\n", data->sysvari); + fprintf(stderr, "cpu model: `%s'\n", data->cpumodel); +#endif + + return got_type + got_vari + got_model; +} + + +/* + * Initialize I/O system. + */ +static int +init_iosys (void) +{ + long addr; + int i, olderrno = errno; + struct cpuinfo_data data; + + /* First try the pciconfig_iobase syscall added to 2.2.15 and 2.3.99. */ + +#ifdef __NR_pciconfig_iobase + addr = __pciconfig_iobase (IOBASE_DENSE_MEM, 0, 0); + if (addr != -1) + { + ioswizzle_t io_swiz; + + if (addr == 0) + { + /* Only Jensen doesn't have dense mem space. */ + io.sparse_bus_memory_base + = io_system[IOSYS_JENSEN].sparse_bus_mem_base; + io.io_base = io_system[IOSYS_JENSEN].bus_io_base; + io_swiz = IOSWIZZLE_JENSEN; + } + else + { + io.bus_memory_base = addr; + + addr = __pciconfig_iobase (IOBASE_DENSE_IO, 0, 0); + if (addr != 0) + { + /* The X server uses _bus_base_sparse == 0 to know that + BWX access are supported to dense mem space. This is + true of every system that supports dense io space, so + never fill in io.sparse_bus_memory_base in this case. */ + io_swiz = IOSWIZZLE_DENSE; + io.io_base = addr; + } + else + { + io.sparse_bus_memory_base + = __pciconfig_iobase (IOBASE_SPARSE_MEM, 0, 0); + io.io_base = __pciconfig_iobase (IOBASE_SPARSE_IO, 0, 0); + io_swiz = IOSWIZZLE_SPARSE; + } + } + + io.swiz = io_swiz; + io.swp = &ioswtch[io_swiz]; + + return 0; + } +#endif + + /* Second, collect the contents of /etc/alpha_systype or /proc/cpuinfo. */ + + if (process_cpuinfo(&data) == 0) + { + /* This can happen if the format of /proc/cpuinfo changes. */ + fprintf (stderr, + "ioperm.init_iosys: Unable to determine system type.\n" + "\t(May need " PATH_ALPHA_SYSTYPE " symlink?)\n"); + __set_errno (ENODEV); + return -1; + } + + /* Translate systype name into i/o system. */ + for (i = 0; i < sizeof (platform) / sizeof (platform[0]); ++i) + { + if (strcmp (platform[i].name, data.systype) == 0) + { + iosys_t io_sys = platform[i].io_sys; + + /* Some platforms can have either EV4 or EV5 CPUs. */ + if (io_sys == IOSYS_CPUDEP) + { + /* SABLE or MIKASA or NORITAKE so far. */ + if (strcmp (platform[i].name, "Sable") == 0) + { + if (strncmp (data.cpumodel, "EV4", 3) == 0) + io_sys = IOSYS_T2; + else if (strncmp (data.cpumodel, "EV5", 3) == 0) + io_sys = IOSYS_GAMMA; + } + else + { + /* This covers MIKASA/NORITAKE. */ + if (strncmp (data.cpumodel, "EV4", 3) == 0) + io_sys = IOSYS_APECS; + else if (strncmp (data.cpumodel, "EV5", 3) == 0) + io_sys = IOSYS_CIA; + } + if (io_sys == IOSYS_CPUDEP) + { + /* This can happen if the format of /proc/cpuinfo changes.*/ + fprintf (stderr, "ioperm.init_iosys: Unable to determine" + " CPU model.\n"); + __set_errno (ENODEV); + return -1; + } + } + /* Some platforms can have different core logic chipsets */ + if (io_sys == IOSYS_PCIDEP) + { + /* EB164 so far */ + if (strcmp (data.systype, "EB164") == 0) + { + if (strncmp (data.sysvari, "RX164", 5) == 0) + io_sys = IOSYS_POLARIS; + else if (strncmp (data.sysvari, "LX164", 5) == 0 + || strncmp (data.sysvari, "SX164", 5) == 0) + io_sys = IOSYS_PYXIS; + else + io_sys = IOSYS_CIA; + } + if (io_sys == IOSYS_PCIDEP) + { + /* This can happen if the format of /proc/cpuinfo changes.*/ + fprintf (stderr, "ioperm.init_iosys: Unable to determine" + " core logic chipset.\n"); + __set_errno (ENODEV); + return -1; + } + } + io.bus_memory_base = io_system[io_sys].bus_memory_base; + io.sparse_bus_memory_base = io_system[io_sys].sparse_bus_mem_base; + io.io_base = io_system[io_sys].bus_io_base; + + if (io_sys == IOSYS_JENSEN) + io.swiz = IOSWIZZLE_JENSEN; + else if (io_sys == IOSYS_TSUNAMI + || io_sys == IOSYS_POLARIS + || io_sys == IOSYS_PYXIS) + io.swiz = IOSWIZZLE_DENSE; + else + io.swiz = IOSWIZZLE_SPARSE; + io.swp = &ioswtch[io.swiz]; + + __set_errno (olderrno); + return 0; + } + } + + __set_errno (ENODEV); + fprintf(stderr, "ioperm.init_iosys: Platform not recognized.\n" + "\t(May need " PATH_ALPHA_SYSTYPE " symlink?)\n"); + return -1; +} + + +int +_ioperm (unsigned long int from, unsigned long int num, int turn_on) +{ + unsigned long int addr, len, pagesize = __getpagesize(); + int prot; + + if (!io.swp && init_iosys() < 0) + { +#ifdef DEBUG_IOPERM + fprintf(stderr, "ioperm: init_iosys() failed (%m)\n"); +#endif + return -1; + } + + /* This test isn't as silly as it may look like; consider overflows! */ + if (from >= MAX_PORT || from + num > MAX_PORT) + { + __set_errno (EINVAL); +#ifdef DEBUG_IOPERM + fprintf(stderr, "ioperm: from/num out of range\n"); +#endif + return -1; + } + +#ifdef DEBUG_IOPERM + fprintf(stderr, "ioperm: turn_on %d io.base %ld\n", turn_on, io.base); +#endif + + if (turn_on) + { + if (!io.base) + { + int fd; + + io.hae_cache = 0; + if (io.swiz != IOSWIZZLE_DENSE) + { + /* Synchronize with hw. */ + __sethae (0); + } + + fd = __open ("/dev/mem", O_RDWR); + if (fd < 0) + { +#ifdef DEBUG_IOPERM + fprintf(stderr, "ioperm: /dev/mem open failed (%m)\n"); +#endif + return -1; + } + + addr = port_to_cpu_addr (0, io.swiz, 1); + len = port_to_cpu_addr (MAX_PORT, io.swiz, 1) - addr; + io.base = + (unsigned long int) __mmap (0, len, PROT_NONE, MAP_SHARED, + fd, io.io_base); + __close (fd); +#ifdef DEBUG_IOPERM + fprintf(stderr, "ioperm: mmap of len 0x%lx returned 0x%lx\n", + len, io.base); +#endif + if ((long) io.base == -1) + return -1; + } + prot = PROT_READ | PROT_WRITE; + } + else + { + if (!io.base) + return 0; /* never was turned on... */ + + /* turnoff access to relevant pages: */ + prot = PROT_NONE; + } + addr = port_to_cpu_addr (from, io.swiz, 1); + addr &= ~(pagesize - 1); + len = port_to_cpu_addr (from + num, io.swiz, 1) - addr; + return __mprotect ((void *) addr, len, prot); +} + + +int +_iopl (int level) +{ + switch (level) + { + case 0: + return 0; + + case 1: case 2: case 3: + return _ioperm (0, MAX_PORT, 1); + + default: + __set_errno (EINVAL); + return -1; + } +} + + +void +_sethae (unsigned long int addr) +{ + if (!io.swp && init_iosys () < 0) + return; + + io.swp->sethae (addr); +} + + +void +_outb (unsigned char b, unsigned long int port) +{ + if (port >= MAX_PORT) + return; + + io.swp->outb (b, port); +} + + +void +_outw (unsigned short b, unsigned long int port) +{ + if (port >= MAX_PORT) + return; + + io.swp->outw (b, port); +} + + +void +_outl (unsigned int b, unsigned long int port) +{ + if (port >= MAX_PORT) + return; + + io.swp->outl (b, port); +} + + +unsigned int +_inb (unsigned long int port) +{ + return io.swp->inb (port); +} + + +unsigned int +_inw (unsigned long int port) +{ + return io.swp->inw (port); +} + + +unsigned int +_inl (unsigned long int port) +{ + return io.swp->inl (port); +} + + +unsigned long int +_bus_base(void) +{ + if (!io.swp && init_iosys () < 0) + return -1; + return io.bus_memory_base; +} + +unsigned long int +_bus_base_sparse(void) +{ + if (!io.swp && init_iosys () < 0) + return -1; + return io.sparse_bus_memory_base; +} + +int +_hae_shift(void) +{ + if (!io.swp && init_iosys () < 0) + return -1; + if (io.swiz == IOSWIZZLE_JENSEN) + return 7; + if (io.swiz == IOSWIZZLE_SPARSE) + return 5; + return 0; +} + +weak_alias (_sethae, sethae); +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); +weak_alias (_bus_base, bus_base); +weak_alias (_bus_base_sparse, bus_base_sparse); +weak_alias (_hae_shift, hae_shift); diff --git a/ports/sysdeps/unix/sysv/linux/alpha/ipc_priv.h b/ports/sysdeps/unix/sysv/linux/alpha/ipc_priv.h new file mode 100644 index 000000000..67883be10 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/ipc_priv.h @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/powerpc/ipc_priv.h> diff --git a/ports/sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h b/ports/sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h new file mode 100644 index 000000000..4c35d969c --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h @@ -0,0 +1,15 @@ +/* This is the sigaction struction from the Linux 2.1.20 kernel. */ + +struct old_kernel_sigaction { + __sighandler_t k_sa_handler; + unsigned long sa_mask; + unsigned int sa_flags; +}; + +/* This is the sigaction structure from the Linux 2.1.68 kernel. */ + +struct kernel_sigaction { + __sighandler_t k_sa_handler; + unsigned int sa_flags; + sigset_t sa_mask; +}; diff --git a/ports/sysdeps/unix/sysv/linux/alpha/kernel_stat.h b/ports/sysdeps/unix/sysv/linux/alpha/kernel_stat.h new file mode 100644 index 000000000..a1d012ab0 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/kernel_stat.h @@ -0,0 +1,88 @@ +/* Definition of `struct stat' used in the kernel. */ +struct kernel_stat + { + unsigned int st_dev; + unsigned int st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_rdev; + long int st_size; + unsigned long int st_atime; + unsigned long int st_mtime; + unsigned long int st_ctime; + unsigned int st_blksize; + int st_blocks; + unsigned int st_flags; + unsigned int st_gen; + }; + +/* Definition of `struct stat64' used in the kernel. */ +struct kernel_stat64 + { + unsigned long st_dev; + unsigned long st_ino; + unsigned long st_rdev; + long st_size; + unsigned long st_blocks; + + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_blksize; + unsigned int st_nlink; + unsigned int __pad0; + + unsigned long st_atime; + unsigned long st_atimensec; + unsigned long st_mtime; + unsigned long st_mtimensec; + unsigned long st_ctime; + unsigned long st_ctimensec; + long __unused[3]; + }; + +/* Definition of `struct stat' used by glibc 2.0. */ +struct glibc2_stat + { + __dev_t st_dev; + __ino_t st_ino; + __mode_t st_mode; + __nlink_t st_nlink; + __uid_t st_uid; + __gid_t st_gid; + __dev_t st_rdev; + __off_t st_size; + __time_t st_atime; + __time_t st_mtime; + __time_t st_ctime; + unsigned int st_blksize; + int st_blocks; + unsigned int st_flags; + unsigned int st_gen; + }; + +/* Definition of `struct stat' used by glibc 2.1. */ +struct glibc21_stat + { + __dev_t st_dev; + __ino64_t st_ino; + __mode_t st_mode; + __nlink_t st_nlink; + __uid_t st_uid; + __gid_t st_gid; + __dev_t st_rdev; + __off_t st_size; + __time_t st_atime; + __time_t st_mtime; + __time_t st_ctime; + __blkcnt64_t st_blocks; + __blksize_t st_blksize; + unsigned int st_flags; + unsigned int st_gen; + int __pad3; + long __unused[4]; + }; + +#define XSTAT_IS_XSTAT64 1 diff --git a/ports/sysdeps/unix/sysv/linux/alpha/kernel_sysinfo.h b/ports/sysdeps/unix/sysv/linux/alpha/kernel_sysinfo.h new file mode 100644 index 000000000..a3edec226 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/kernel_sysinfo.h @@ -0,0 +1,6 @@ +/* A copy of the couple of bits we need from <asm/sysinfo.h>. */ + +#define GSI_IEEE_FP_CONTROL 45 + +#define SSI_IEEE_FP_CONTROL 14 +#define SSI_IEEE_RAISE_EXCEPTION 1001 diff --git a/ports/sysdeps/unix/sysv/linux/alpha/kernel_termios.h b/ports/sysdeps/unix/sysv/linux/alpha/kernel_termios.h new file mode 100644 index 000000000..c38f1fac1 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/kernel_termios.h @@ -0,0 +1,44 @@ +/* Copyright (C) 1997 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _KERNEL_TERMIOS_H +#define _KERNEL_TERMIOS_H 1 + +/* The following corresponds to the values from the Linux 2.1.20 kernel. */ + +/* We need the definition of tcflag_t, cc_t, and speed_t. */ +#include <termios.h> + +#define __KERNEL_NCCS 19 + +struct __kernel_termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_cc[__KERNEL_NCCS]; /* control characters */ + cc_t c_line; /* line discipline */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ + }; + +#define _HAVE_C_ISPEED 1 +#define _HAVE_C_OSPEED 1 + +#endif /* kernel_termios.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/lxstat.c b/ports/sysdeps/unix/sysv/linux/alpha/lxstat.c new file mode 100644 index 000000000..38fac2e2b --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/lxstat.c @@ -0,0 +1,64 @@ +/* lxstat using old-style Unix stat system call. + Copyright (C) 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define __lxstat64 __lxstat64_disable + +#include <errno.h> +#include <stddef.h> +#include <sys/stat.h> +#include <kernel_stat.h> +#include <sysdep.h> +#include <sys/syscall.h> +#include <xstatconv.h> + +#undef __lxstat64 + + +/* Get information about the file NAME in BUF. */ +int +__lxstat (int vers, const char *name, struct stat *buf) +{ + INTERNAL_SYSCALL_DECL (err); + int result, errno_out; + struct kernel_stat kbuf; + + if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64) + { + result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf); + if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + return result; + errno_out = INTERNAL_SYSCALL_ERRNO (result, err); + if (errno_out != ENOSYS) + goto fail; + __libc_missing_axp_stat64 = 1; + } + + result = INTERNAL_SYSCALL (lstat, err, 2, name, &kbuf); + if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + return __xstat_conv (vers, &kbuf, buf); + errno_out = INTERNAL_SYSCALL_ERRNO (result, err); + + fail: + __set_errno (errno_out); + return -1; +} +hidden_def (__lxstat) +weak_alias (__lxstat, _lxstat); +strong_alias (__lxstat, __lxstat64); +hidden_ver (__lxstat, __lxstat64) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/makecontext.S b/ports/sysdeps/unix/sysv/linux/alpha/makecontext.S new file mode 100644 index 000000000..223117e26 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/makecontext.S @@ -0,0 +1,164 @@ +/* Copyright (C) 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include <ucontext-offsets.h> + + +ENTRY(__makecontext) + ldgp $29, 0($27) +#ifdef PROF + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at +#endif + .prologue 1 + + /* Compute top of stack, including arguments. */ + ldq $1, UC_STACK+SS_SP($16) + ldq $2, UC_STACK+SS_SIZE($16) + addq $1, $2, $8 + subq $18, 6, $1 + cmovlt $1, 0, $1 + s8addq $1, 0, $2 + subq $8, $2, $8 + + /* Copy all parameters. Switch statement header here. */ + ldah $3, $jumptable($29) !gprelhigh + cmple $18, 6, $1 + mov $18, $2 + cmoveq $1, 7, $2 + s4addq $2, $3, $3 + ldl $4, $jumptable($3) !gprellow + addq $4, $29, $4 + jmp $31, ($4), $args1 + + .section .rodata + .align 2 +$jumptable: + .gprel32 $args0 + .gprel32 $args1 + .gprel32 $args2 + .gprel32 $args3 + .gprel32 $args4 + .gprel32 $args5 + .gprel32 $args6 + .gprel32 $argsN + .text + + /* Here we process arguments 7 through N. This is a straight + stack-to-stack copy. */ + .align 4 +$argsN: + subq $18, 6, $1 + lda $2, 0($8) + lda $3, 3*8($30) + .align 4 +1: + ldq $0, 0($3) + subq $1, 1, $1 + lda $3, 8($3) + stq $0, 0($2) + lda $2, 8($2) + bne $1, 1b + + /* Here we process arguments 6 through 0. This involves + copying into the register save areas of the ucontext. */ + .align 4 +$args6: + ldq $0, 2*8($30) + stq $0, UC_SIGCTX+SC_REGS+21*8($16) + unop + stq $0, UC_SIGCTX+SC_FPREGS+21*8($16) +$args5: + ldq $0, 1*8($30) + stq $0, UC_SIGCTX+SC_REGS+20*8($16) + unop + stq $0, UC_SIGCTX+SC_FPREGS+20*8($16) +$args4: + ldq $0, 0*8($30) + stq $0, UC_SIGCTX+SC_REGS+19*8($16) + unop + stq $0, UC_SIGCTX+SC_FPREGS+19*8($16) +$args3: + unop + stq $21, UC_SIGCTX+SC_REGS+18*8($16) + unop + stt $f21, UC_SIGCTX+SC_FPREGS+18*8($16) +$args2: + unop + stq $20, UC_SIGCTX+SC_REGS+17*8($16) + unop + stt $f20, UC_SIGCTX+SC_FPREGS+17*8($16) +$args1: + unop + stq $19, UC_SIGCTX+SC_REGS+16*8($16) + unop + stt $f19, UC_SIGCTX+SC_FPREGS+16*8($16) +$args0: + + /* Set up the registers ready to invoke __startcontext. + We seed $27 with the target function address, and $9 + with the link from ucp. */ + ldah $0, __startcontext($29) !gprelhigh + ldq $1, UC_LINK($16) + lda $0, __startcontext($0) !gprellow + stq $17, UC_SIGCTX+SC_REGS+27*8($16) + stq $8, UC_SIGCTX+SC_REGS+30*8($16) + stq $0, UC_SIGCTX+SC_PC($16) + stq $1, UC_SIGCTX+SC_REGS+9*8($16) + + /* No return value from makecontext. */ + ret + +END(__makecontext) +weak_alias (__makecontext, makecontext) + +/* This function is where a new makecontext "thread" begins life. + We have already set up $27 for calling the target function, and + we've set $9 to the UC_LINK of the parent context. + + If the function returns, we either jump to the linked context + (if non-null) or exit. */ + + .align 4 + .ent __startcontext +__startcontext: + .frame $31, 0, $31, 0 + .prologue 0 + + jsr $26, ($27), 0 + ldgp $29, 0($26) + mov $9, $16 + beq $9, 1f + +#ifdef PIC + bsr $26, __setcontext !samegp +1: mov $31, $16 + bsr $26, HIDDEN_JUMPTARGET(exit) !samegp +#else + jsr $26, __setcontext + ldgp $29, 0($26) +1: mov $31, $16 + jsr $26, HIDDEN_JUMPTARGET(exit) +#endif + + halt + + .end __startcontext diff --git a/ports/sysdeps/unix/sysv/linux/alpha/msgctl.c b/ports/sysdeps/unix/sysv/linux/alpha/msgctl.c new file mode 100644 index 000000000..a59911fe4 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/msgctl.c @@ -0,0 +1,121 @@ +/* Copyright (C) 1995,1997,1998,2000,2003,2006 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <sys/msg.h> +#include <ipc_priv.h> + +#include <sysdep.h> +#include <string.h> +#include <sys/syscall.h> +#include <bp-checks.h> + +#include <kernel-features.h> + +struct __old_msqid_ds +{ + struct __old_ipc_perm msg_perm; /* structure describing operation permission */ + struct msg *__unbounded __msg_first; /* pointer to first message on queue */ + struct msg *__unbounded __msg_last; /* pointer to last message on queue */ + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgrcv command */ + __time_t msg_ctime; /* time of last change */ + struct wait_queue *__unbounded __wwait; /* ??? */ + struct wait_queue *__unbounded __rwait; /* ??? */ + unsigned short int __msg_cbytes; /* current number of bytes on queue */ + unsigned short int msg_qnum; /* number of messages currently on queue */ + unsigned short int msg_qbytes; /* max number of bytes allowed on queue */ + __ipc_pid_t msg_lspid; /* pid of last msgsnd() */ + __ipc_pid_t msg_lrpid; /* pid of last msgrcv() */ +}; + +/* Allows to control internal state and destruction of message queue + objects. */ +int __new_msgctl (int, int, struct msqid_ds *); + +int +__new_msgctl (int msqid, int cmd, struct msqid_ds *buf) +{ + /* This is a misnomer -- Alpha had 32-bit uids at the beginning + of time. However, msg_qnum and msg_qbytes changed size at + the same time the size of uid changed elsewhere. */ +#if __ASSUME_32BITUIDS > 0 + return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, CHECK_1 (buf)); +#else + switch (cmd) { + case MSG_STAT: + case IPC_STAT: + case IPC_SET: + break; + default: + return INLINE_SYSCALL (msgctl, 3, msqid, cmd, CHECK_1 (buf)); + } + + { + int save_errno = errno, result; + struct __old_msqid_ds old; + + /* Unfortunately there is no way how to find out for sure whether + we should use old or new msgctl. */ + result = INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, CHECK_1 (buf)); + if (result != -1 || errno != EINVAL) + return result; + + __set_errno(save_errno); + if (cmd == IPC_SET) + { + old.msg_perm.uid = buf->msg_perm.uid; + old.msg_perm.gid = buf->msg_perm.gid; + old.msg_perm.mode = buf->msg_perm.mode; + old.msg_qbytes = buf->msg_qbytes; + if (old.msg_perm.uid != buf->msg_perm.uid || + old.msg_perm.gid != buf->msg_perm.gid || + old.msg_qbytes != buf->msg_qbytes) + { + __set_errno (EINVAL); + return -1; + } + } + result = INLINE_SYSCALL (msgctl, 3, msqid, cmd, __ptrvalue (&old)); + if (result != -1 && cmd != IPC_SET) + { + memset(buf, 0, sizeof(*buf)); + buf->msg_perm.__key = old.msg_perm.__key; + buf->msg_perm.uid = old.msg_perm.uid; + buf->msg_perm.gid = old.msg_perm.gid; + buf->msg_perm.cuid = old.msg_perm.cuid; + buf->msg_perm.cgid = old.msg_perm.cgid; + buf->msg_perm.mode = old.msg_perm.mode; + buf->msg_perm.__seq = old.msg_perm.__seq; + buf->msg_stime = old.msg_stime; + buf->msg_rtime = old.msg_rtime; + buf->msg_ctime = old.msg_ctime; + buf->__msg_cbytes = old.__msg_cbytes; + buf->msg_qnum = old.msg_qnum; + buf->msg_qbytes = old.msg_qbytes; + buf->msg_lspid = old.msg_lspid; + buf->msg_lrpid = old.msg_lrpid; + } + return result; + } +#endif +} + +#include <shlib-compat.h> +versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2); diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nldbl-abi.h b/ports/sysdeps/unix/sysv/linux/alpha/nldbl-abi.h new file mode 100644 index 000000000..bd985cc59 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nldbl-abi.h @@ -0,0 +1,8 @@ +/* ABI version for long double switch. + This is used by the Versions and math_ldbl_opt.h files in + sysdeps/ieee754/ldbl-opt/. It gives the ABI version where + long double == double was replaced with proper long double + for libm *l functions and libc functions using long double. */ + +#define NLDBL_VERSION GLIBC_2.4 +#define LONG_DOUBLE_COMPAT_VERSION GLIBC_2_4 diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/Makefile b/ports/sysdeps/unix/sysv/linux/alpha/nptl/Makefile new file mode 100644 index 000000000..8c8084079 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/Makefile @@ -0,0 +1,2 @@ +# pull in __syscall_error routine, __sigprocmask, __syscall_rt_sigaction +libpthread-routines += ptw-sysdep ptw-sigprocmask ptw-rt_sigaction diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/Versions b/ports/sysdeps/unix/sysv/linux/alpha/nptl/Versions new file mode 100644 index 000000000..437c4da28 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/Versions @@ -0,0 +1,13 @@ +libpthread { + GLIBC_2.3.3 { + # Changed PTHREAD_STACK_MIN. + pthread_attr_setstack; pthread_attr_setstacksize; + } +} +librt { + GLIBC_2.3.3 { + # Changed timer_t. + timer_create; timer_delete; timer_getoverrun; timer_gettime; + timer_settime; + } +} diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/aio_cancel.c b/ports/sysdeps/unix/sysv/linux/alpha/nptl/aio_cancel.c new file mode 100644 index 000000000..0d6da8291 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/aio_cancel.c @@ -0,0 +1,33 @@ +#include <shlib-compat.h> + +#define aio_cancel64 XXX +#include <aio.h> +#undef aio_cancel64 +#include <errno.h> + +extern __typeof (aio_cancel) __new_aio_cancel; +extern __typeof (aio_cancel) __old_aio_cancel; + +#define aio_cancel __new_aio_cancel + +#include <sysdeps/pthread/aio_cancel.c> + +#undef aio_cancel +strong_alias (__new_aio_cancel, __new_aio_cancel64); +versioned_symbol (librt, __new_aio_cancel, aio_cancel, GLIBC_2_3); +versioned_symbol (librt, __new_aio_cancel64, aio_cancel64, GLIBC_2_3); + +#if SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_3) + +#undef ECANCELED +#define aio_cancel __old_aio_cancel +#define ECANCELED 125 + +#include <sysdeps/pthread/aio_cancel.c> + +#undef aio_cancel +strong_alias (__old_aio_cancel, __old_aio_cancel64); +compat_symbol (librt, __old_aio_cancel, aio_cancel, GLIBC_2_1); +compat_symbol (librt, __old_aio_cancel64, aio_cancel64, GLIBC_2_1); + +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/bits/local_lim.h b/ports/sysdeps/unix/sysv/linux/alpha/nptl/bits/local_lim.h new file mode 100644 index 000000000..a7c9740a0 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/bits/local_lim.h @@ -0,0 +1,100 @@ +/* Minimum guaranteed maximum values for system limits. Linux/Alpha version. + Copyright (C) 1993-1998,2000,2002-2004,2008 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 + 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. */ + +/* The kernel header pollutes the namespace with the NR_OPEN symbol + and defines LINK_MAX although filesystems have different maxima. A + similar thing is true for OPEN_MAX: the limit can be changed at + runtime and therefore the macro must not be defined. Remove this + after including the header if necessary. */ +#ifndef NR_OPEN +# define __undef_NR_OPEN +#endif +#ifndef LINK_MAX +# define __undef_LINK_MAX +#endif +#ifndef OPEN_MAX +# define __undef_OPEN_MAX +#endif +#ifndef ARG_MAX +# define __undef_ARG_MAX +#endif + +/* The kernel sources contain a file with all the needed information. */ +#include <linux/limits.h> + +/* Have to remove NR_OPEN? */ +#ifdef __undef_NR_OPEN +# undef NR_OPEN +# undef __undef_NR_OPEN +#endif +/* Have to remove LINK_MAX? */ +#ifdef __undef_LINK_MAX +# undef LINK_MAX +# undef __undef_LINK_MAX +#endif +/* Have to remove OPEN_MAX? */ +#ifdef __undef_OPEN_MAX +# undef OPEN_MAX +# undef __undef_OPEN_MAX +#endif +/* Have to remove ARG_MAX? */ +#ifdef __undef_ARG_MAX +# undef ARG_MAX +# undef __undef_ARG_MAX +#endif + +/* The number of data keys per process. */ +#define _POSIX_THREAD_KEYS_MAX 128 +/* This is the value this implementation supports. */ +#define PTHREAD_KEYS_MAX 1024 + +/* Controlling the iterations of destructors for thread-specific data. */ +#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 +/* Number of iterations this implementation does. */ +#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS + +/* The number of threads per process. */ +#define _POSIX_THREAD_THREADS_MAX 64 +/* We have no predefined limit on the number of threads. */ +#undef PTHREAD_THREADS_MAX + +/* Maximum amount by which a process can descrease its asynchronous I/O + priority level. */ +#define AIO_PRIO_DELTA_MAX 20 + +/* Minimum size for a thread. We are free to choose a reasonable value. */ +#define PTHREAD_STACK_MIN 24576 + +/* Maximum number of timer expiration overruns. */ +#define DELAYTIMER_MAX 2147483647 + +/* Maximum tty name length. */ +#define TTY_NAME_MAX 32 + +/* Maximum login name length. This is arbitrary. */ +#define LOGIN_NAME_MAX 256 + +/* Maximum host name length. */ +#define HOST_NAME_MAX 64 + +/* Maximum message queue priority level. */ +#define MQ_PRIO_MAX 32768 + +/* Maximum value the semaphore can have. */ +#define SEM_VALUE_MAX (2147483647) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/bits/pthreadtypes.h b/ports/sysdeps/unix/sysv/linux/alpha/nptl/bits/pthreadtypes.h new file mode 100644 index 000000000..41c0be197 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/bits/pthreadtypes.h @@ -0,0 +1,168 @@ +/* Machine-specific pthread type layouts. Alpha version. + Copyright (C) 2003, 2004, 2005, 2006, 2007 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _BITS_PTHREADTYPES_H +#define _BITS_PTHREADTYPES_H 1 + +#define __SIZEOF_PTHREAD_ATTR_T 56 +#define __SIZEOF_PTHREAD_MUTEX_T 40 +#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 +#define __SIZEOF_PTHREAD_COND_T 48 +#define __SIZEOF_PTHREAD_CONDATTR_T 4 +#define __SIZEOF_PTHREAD_RWLOCK_T 56 +#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 +#define __SIZEOF_PTHREAD_BARRIER_T 32 +#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 + + +/* Thread identifiers. The structure of the attribute type is + deliberately not exposed. */ +typedef unsigned long int pthread_t; + + +typedef union +{ + char __size[__SIZEOF_PTHREAD_ATTR_T]; + long int __align; +} pthread_attr_t; + + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; + + +/* Data structures for mutex handling. The structure of the attribute + type is deliberately not exposed. */ +typedef union +{ + struct __pthread_mutex_s + { + int __lock; + unsigned int __count; + int __owner; + unsigned int __nusers; + /* KIND must stay at this position in the structure to maintain + binary compatibility. */ + int __kind; + int __spins; + __pthread_list_t __list; +#define __PTHREAD_MUTEX_HAVE_PREV 1 + } __data; + char __size[__SIZEOF_PTHREAD_MUTEX_T]; + long int __align; +} pthread_mutex_t; + +typedef union +{ + char __size[__SIZEOF_PTHREAD_MUTEXATTR_T]; + int __align; +} pthread_mutexattr_t; + + +/* Data structure for conditional variable handling. The structure of + the attribute type is deliberately not exposed. */ +typedef union +{ + struct + { + int __lock; + unsigned int __futex; + __extension__ unsigned long long int __total_seq; + __extension__ unsigned long long int __wakeup_seq; + __extension__ unsigned long long int __woken_seq; + void *__mutex; + unsigned int __nwaiters; + unsigned int __broadcast_seq; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; + __extension__ long long int __align; +} pthread_cond_t; + +typedef union +{ + char __size[__SIZEOF_PTHREAD_CONDATTR_T]; + int __align; +} pthread_condattr_t; + + +/* Keys for thread-specific data */ +typedef unsigned int pthread_key_t; + + +/* Once-only execution */ +typedef int pthread_once_t; + + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K +/* Data structure for read-write lock variable handling. The + structure of the attribute type is deliberately not exposed. */ +typedef union +{ + struct + { + int __lock; + unsigned int __nr_readers; + unsigned int __readers_wakeup; + unsigned int __writer_wakeup; + unsigned int __nr_readers_queued; + unsigned int __nr_writers_queued; + int __writer; + int __shared; + unsigned long int __pad1; + unsigned long int __pad2; + /* FLAGS must stay at this position in the structure to maintain + binary compatibility. */ + unsigned int __flags; + } __data; + char __size[__SIZEOF_PTHREAD_RWLOCK_T]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T]; + long int __align; +} pthread_rwlockattr_t; +#endif + + +#ifdef __USE_XOPEN2K +/* POSIX spinlock data type. */ +typedef volatile int pthread_spinlock_t; + +/* POSIX barriers data type. The structure of the type is + deliberately not exposed. */ +typedef union +{ + char __size[__SIZEOF_PTHREAD_BARRIER_T]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[__SIZEOF_PTHREAD_BARRIERATTR_T]; + int __align; +} pthread_barrierattr_t; +#endif + + +#endif /* bits/pthreadtypes.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/bits/semaphore.h b/ports/sysdeps/unix/sysv/linux/alpha/nptl/bits/semaphore.h new file mode 100644 index 000000000..be4469c69 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/bits/semaphore.h @@ -0,0 +1,34 @@ +/* Machine-specific POSIX semaphore type layouts. Alpha version. + Copyright (C) 2003 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SEMAPHORE_H +# error "Never use <bits/semaphore.h> directly; include <semaphore.h> instead." +#endif + +# define __SIZEOF_SEM_T 32 + +/* Value returned if `sem_open' failed. */ +#define SEM_FAILED ((sem_t *) 0) + + +typedef union +{ + char __size[__SIZEOF_SEM_T]; + long int __align; +} sem_t; diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/clone.S b/ports/sysdeps/unix/sysv/linux/alpha/nptl/clone.S new file mode 100644 index 000000000..675a997e9 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/clone.S @@ -0,0 +1,9 @@ +/* We want an #include_next, but we are the main source file. + So, #include ourselves and in that incarnation we can use #include_next. */ +#ifndef INCLUDED_SELF +# define INCLUDED_SELF +# include <clone.S> +#else +# define RESET_PID +# include_next <clone.S> +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/createthread.c b/ports/sysdeps/unix/sysv/linux/alpha/nptl/createthread.c new file mode 100644 index 000000000..6a51e73da --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/createthread.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2003 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Value passed to 'clone' for initialization of the thread register. */ +#define TLS_VALUE (pd + 1) + +/* Get the real implementation. */ +#include <nptl/sysdeps/pthread/createthread.c> diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/fork.c b/ports/sysdeps/unix/sysv/linux/alpha/nptl/fork.c new file mode 100644 index 000000000..ca85fc008 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/fork.c @@ -0,0 +1,30 @@ +/* Copyright (C) 2003 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sched.h> +#include <signal.h> +#include <sysdep.h> +#include <tls.h> + + +#define ARCH_FORK() \ + INLINE_SYSCALL (clone, 5, \ + CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, \ + NULL, NULL, &THREAD_SELF->tid, NULL) + +#include "../fork.c" diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h b/ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h new file mode 100644 index 000000000..93188234c --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/lowlevellock.h @@ -0,0 +1,280 @@ +/* Copyright (C) 2003, 2004, 2006, 2007 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Libr \ary; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LOWLEVELLOCK_H +#define _LOWLEVELLOCK_H 1 + +#include <time.h> +#include <sys/param.h> +#include <bits/pthreadtypes.h> +#include <atomic.h> +#include <sysdep.h> +#include <kernel-features.h> + + +#define __NR_futex 394 +#define FUTEX_WAIT 0 +#define FUTEX_WAKE 1 +#define FUTEX_REQUEUE 3 +#define FUTEX_CMP_REQUEUE 4 +#define FUTEX_WAKE_OP 5 +#define FUTEX_OP_CLEAR_WAKE_IF_GT_ONE ((4 << 24) | 1) +#define FUTEX_LOCK_PI 6 +#define FUTEX_UNLOCK_PI 7 +#define FUTEX_TRYLOCK_PI 8 +#define FUTEX_PRIVATE_FLAG 128 + +/* Values for 'private' parameter of locking macros. Yes, the + definition seems to be backwards. But it is not. The bit will be + reversed before passing to the system call. */ +#define LLL_PRIVATE 0 +#define LLL_SHARED FUTEX_PRIVATE_FLAG + + +#if !defined NOT_IN_libc || defined IS_IN_rtld +/* In libc.so or ld.so all futexes are private. */ +# ifdef __ASSUME_PRIVATE_FUTEX +# define __lll_private_flag(fl, private) \ + ((fl) | FUTEX_PRIVATE_FLAG) +# else +# define __lll_private_flag(fl, private) \ + ((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex)) +# endif +#else +# ifdef __ASSUME_PRIVATE_FUTEX +# define __lll_private_flag(fl, private) \ + (((fl) | FUTEX_PRIVATE_FLAG) ^ (private)) +# else +# define __lll_private_flag(fl, private) \ + (__builtin_constant_p (private) \ + ? ((private) == 0 \ + ? ((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex)) \ + : (fl)) \ + : ((fl) | (((private) ^ FUTEX_PRIVATE_FLAG) \ + & THREAD_GETMEM (THREAD_SELF, header.private_futex)))) +# endif +#endif + + +#define lll_futex_wait(futexp, val, private) \ + lll_futex_timed_wait (futexp, val, NULL, private) + +#define lll_futex_timed_wait(futexp, val, timespec, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret; \ + __ret = INTERNAL_SYSCALL (futex, __err, 4, (futexp), \ + __lll_private_flag (FUTEX_WAIT, private), \ + (val), (timespec)); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err)? -__ret : __ret; \ + }) + +#define lll_futex_wake(futexp, nr, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret; \ + __ret = INTERNAL_SYSCALL (futex, __err, 4, (futexp), \ + __lll_private_flag (FUTEX_WAKE, private), \ + (nr), 0); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err)? -__ret : __ret; \ + }) + +#define lll_robust_dead(futexv, private) \ + do \ + { \ + int *__futexp = &(futexv); \ + atomic_or (__futexp, FUTEX_OWNER_DIED); \ + lll_futex_wake (__futexp, 1, private); \ + } \ + while (0) + +/* Returns non-zero if error happened, zero if success. */ +#define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret; \ + __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \ + __lll_private_flag (FUTEX_CMP_REQUEUE, private),\ + (nr_wake), (nr_move), (mutex), (val)); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err); \ + }) + +/* Returns non-zero if error happened, zero if success. */ +#define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, private) \ + ({ \ + INTERNAL_SYSCALL_DECL (__err); \ + long int __ret; \ + __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp), \ + __lll_private_flag (FUTEX_WAKE_OP, private), \ + (nr_wake), (nr_wake2), (futexp2), \ + FUTEX_OP_CLEAR_WAKE_IF_GT_ONE); \ + INTERNAL_SYSCALL_ERROR_P (__ret, __err); \ + }) + + + + +static inline int __attribute__((always_inline)) +__lll_trylock(int *futex) +{ + return atomic_compare_and_exchange_val_acq (futex, 1, 0) != 0; +} +#define lll_trylock(lock) __lll_trylock (&(lock)) + + +static inline int __attribute__((always_inline)) +__lll_cond_trylock(int *futex) +{ + return atomic_compare_and_exchange_val_acq (futex, 2, 0) != 0; +} +#define lll_cond_trylock(lock) __lll_cond_trylock (&(lock)) + + +static inline int __attribute__((always_inline)) +__lll_robust_trylock(int *futex, int id) +{ + return atomic_compare_and_exchange_val_acq (futex, id, 0) != 0; +} +#define lll_robust_trylock(lock, id) \ + __lll_robust_trylock (&(lock), id) + +extern void __lll_lock_wait_private (int *futex) attribute_hidden; +extern void __lll_lock_wait (int *futex, int private) attribute_hidden; +extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden; + +static inline void __attribute__((always_inline)) +__lll_lock(int *futex, int private) +{ + if (atomic_compare_and_exchange_bool_acq (futex, 1, 0) != 0) + { + if (__builtin_constant_p (private) && private == LLL_PRIVATE) + __lll_lock_wait_private (futex); + else + __lll_lock_wait (futex, private); + } +} +#define lll_lock(futex, private) __lll_lock (&(futex), private) + + +static inline int __attribute__ ((always_inline)) +__lll_robust_lock (int *futex, int id, int private) +{ + int result = 0; + if (atomic_compare_and_exchange_bool_acq (futex, id, 0) != 0) + result = __lll_robust_lock_wait (futex, private); + return result; +} +#define lll_robust_lock(futex, id, private) \ + __lll_robust_lock (&(futex), id, private) + + +static inline void __attribute__ ((always_inline)) +__lll_cond_lock (int *futex, int private) +{ + if (atomic_compare_and_exchange_bool_acq (futex, 2, 0) != 0) + __lll_lock_wait (futex, private); +} +#define lll_cond_lock(futex, private) __lll_cond_lock (&(futex), private) + + +#define lll_robust_cond_lock(futex, id, private) \ + __lll_robust_lock (&(futex), (id) | FUTEX_WAITERS, private) + + +extern int __lll_timedlock_wait (int *futex, const struct timespec *, + int private) attribute_hidden; +extern int __lll_robust_timedlock_wait (int *futex, const struct timespec *, + int private) attribute_hidden; + +static inline int __attribute__ ((always_inline)) +__lll_timedlock (int *futex, const struct timespec *abstime, int private) +{ + int result = 0; + if (atomic_compare_and_exchange_bool_acq (futex, 1, 0) != 0) + result = __lll_timedlock_wait (futex, abstime, private); + return result; +} +#define lll_timedlock(futex, abstime, private) \ + __lll_timedlock (&(futex), abstime, private) + + +static inline int __attribute__ ((always_inline)) +__lll_robust_timedlock (int *futex, const struct timespec *abstime, + int id, int private) +{ + int result = 0; + if (atomic_compare_and_exchange_bool_acq (futex, id, 0) != 0) + result = __lll_robust_timedlock_wait (futex, abstime, private); + return result; +} +#define lll_robust_timedlock(futex, abstime, id, private) \ + __lll_robust_timedlock (&(futex), abstime, id, private) + + +#define __lll_unlock(futex, private) \ + (void) \ + ({ int *__futex = (futex); \ + int __oldval = atomic_exchange_rel (__futex, 0); \ + if (__builtin_expect (__oldval > 1, 0)) \ + lll_futex_wake (__futex, 1, private); \ + }) +#define lll_unlock(futex, private) __lll_unlock(&(futex), private) + + +#define __lll_robust_unlock(futex, private) \ + (void) \ + ({ int *__futex = (futex); \ + int __oldval = atomic_exchange_rel (__futex, 0); \ + if (__builtin_expect (__oldval & FUTEX_WAITERS, 0)) \ + lll_futex_wake (__futex, 1, private); \ + }) +#define lll_robust_unlock(futex, private) \ + __lll_robust_unlock(&(futex), private) + + +#define lll_islocked(futex) \ + (futex != 0) + +/* Initializers for lock. */ +#define LLL_LOCK_INITIALIZER (0) +#define LLL_LOCK_INITIALIZER_LOCKED (1) + + +/* The kernel notifies a process which uses CLONE_CLEARTID via futex + wakeup when the clone terminates. The memory location contains the + thread ID while the clone is running and is reset to zero + afterwards. */ +#define lll_wait_tid(tid) \ + do { \ + __typeof (tid) __tid; \ + while ((__tid = (tid)) != 0) \ + lll_futex_wait (&(tid), __tid, LLL_SHARED); \ + } while (0) + +extern int __lll_timedwait_tid (int *, const struct timespec *) + attribute_hidden; + +#define lll_timedwait_tid(tid, abstime) \ + ({ \ + int __res = 0; \ + if ((tid) != 0) \ + __res = __lll_timedwait_tid (&(tid), (abstime)); \ + __res; \ + }) + +#endif /* lowlevellock.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/pt-vfork.S b/ports/sysdeps/unix/sysv/linux/alpha/nptl/pt-vfork.S new file mode 100644 index 000000000..ec5d175be --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/pt-vfork.S @@ -0,0 +1,43 @@ +/* Copyright (C) 2003, 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include <tcb-offsets.h> + +#undef PSEUDO_PREPARE_ARGS +#define PSEUDO_PREPARE_ARGS \ + /* Load the current cached pid value across the vfork. */ \ + rduniq; \ + ldl a2, PID_OFFSET(v0); \ + mov v0, a1; \ + /* Write back its negation, to indicate that the pid value is \ + uninitialized in the the child, and in the window between \ + here and the point at which we restore the value. */ \ + negl a2, t0; \ + stl t0, PID_OFFSET(v0); + +PSEUDO (__vfork, vfork, 0) + + /* If we're back in the parent, restore the saved pid. */ + beq v0, 1f + stl a2, PID_OFFSET(a1) +1: ret + +PSEUDO_END (__vfork) + +weak_alias (__vfork, vfork) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/pthread_once.c b/ports/sysdeps/unix/sysv/linux/alpha/nptl/pthread_once.c new file mode 100644 index 000000000..0e7e9790d --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/pthread_once.c @@ -0,0 +1,96 @@ +/* Copyright (C) 2003, 2004, 2007 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "pthreadP.h" +#include <lowlevellock.h> + + +unsigned long int __fork_generation attribute_hidden; + +static void +clear_once_control (void *arg) +{ + pthread_once_t *once_control = (pthread_once_t *) arg; + + *once_control = 0; + lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE); +} + +int +__pthread_once (pthread_once_t *once_control, void (*init_routine) (void)) +{ + for (;;) + { + int oldval; + int newval; + int tmp; + + /* Pseudo code: + newval = __fork_generation | 1; + oldval = *once_control; + if ((oldval & 2) == 0) + *once_control = newval; + Do this atomically. + */ + newval = __fork_generation | 1; + __asm __volatile ( + "1: ldl_l %0, %2\n" + " and %0, 2, %1\n" + " bne %1, 2f\n" + " mov %3, %1\n" + " stl_c %1, %2\n" + " beq %1, 1b\n" + "2: mb" + : "=&r" (oldval), "=&r" (tmp), "=m" (*once_control) + : "r" (newval), "m" (*once_control)); + + /* Check if the initializer has already been done. */ + if ((oldval & 2) != 0) + return 0; + + /* Check if another thread already runs the initializer. */ + if ((oldval & 1) == 0) + break; + + /* Check whether the initializer execution was interrupted by a fork. */ + if (oldval != newval) + break; + + /* Same generation, some other thread was faster. Wait. */ + lll_futex_wait (once_control, oldval, LLL_PRIVATE); + } + + /* This thread is the first here. Do the initialization. + Register a cleanup handler so that in case the thread gets + interrupted the initialization can be restarted. */ + pthread_cleanup_push (clear_once_control, once_control); + + init_routine (); + + pthread_cleanup_pop (0); + + /* Add one to *once_control to take the bottom 2 bits from 01 to 10. */ + atomic_increment (once_control); + + /* Wake up all other threads. */ + lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE); + + return 0; +} +weak_alias (__pthread_once, pthread_once) +strong_alias (__pthread_once, __pthread_once_internal) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c b/ports/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c new file mode 100644 index 000000000..27fd817e6 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/sem_post.c @@ -0,0 +1,5 @@ +/* ??? This is an ass-backwards way to do this. We should simply define + the acquire/release semantics of atomic_exchange_and_add. And even if + we don't do this, we should be using atomic_full_barrier or otherwise. */ +#define __lll_rel_instr "mb" +#include "../sem_post.c" diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/sysdep-cancel.h b/ports/sysdeps/unix/sysv/linux/alpha/nptl/sysdep-cancel.h new file mode 100644 index 000000000..1db847c9e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/sysdep-cancel.h @@ -0,0 +1,177 @@ +/* Copyright (C) 2003, 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include <tls.h> +#ifndef __ASSEMBLER__ +# include <nptl/pthreadP.h> +#endif + +#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt + +# ifdef PROF +# define PSEUDO_PROF \ + .set noat; \ + lda AT, _mcount; \ + jsr AT, (AT), _mcount; \ + .set at +# else +# define PSEUDO_PROF +# endif + +/* ??? Assumes that nothing comes between PSEUDO and PSEUDO_END + besides "ret". */ + +# undef PSEUDO +# define PSEUDO(name, syscall_name, args) \ + .globl name; \ + .align 4; \ + .type name, @function; \ + .usepv name, std; \ + cfi_startproc; \ +__LABEL(name) \ + ldgp gp, 0(pv); \ + PSEUDO_PROF; \ + PSEUDO_PREPARE_ARGS \ + SINGLE_THREAD_P(t0); \ + bne t0, $pseudo_cancel; \ + lda v0, SYS_ify(syscall_name); \ + call_pal PAL_callsys; \ + bne a3, SYSCALL_ERROR_LABEL; \ +__LABEL($pseudo_ret) \ + .subsection 2; \ + cfi_startproc; \ +__LABEL($pseudo_cancel) \ + subq sp, 64, sp; \ + cfi_def_cfa_offset(64); \ + stq ra, 0(sp); \ + cfi_offset(ra, -64); \ + SAVE_ARGS_##args; \ + CENABLE; \ + LOAD_ARGS_##args; \ + /* Save the CENABLE return value in RA. That register \ + is preserved across syscall and the real return \ + address is saved on the stack. */ \ + mov v0, ra; \ + lda v0, SYS_ify(syscall_name); \ + call_pal PAL_callsys; \ + stq v0, 8(sp); \ + mov ra, a0; \ + bne a3, $multi_error; \ + CDISABLE; \ + ldq ra, 0(sp); \ + ldq v0, 8(sp); \ + addq sp, 64, sp; \ + cfi_remember_state; \ + cfi_restore(ra); \ + cfi_def_cfa_offset(0); \ + ret; \ + cfi_restore_state; \ +__LABEL($multi_error) \ + CDISABLE; \ + ldq ra, 0(sp); \ + ldq v0, 8(sp); \ + addq sp, 64, sp; \ + cfi_restore(ra); \ + cfi_def_cfa_offset(0); \ +__LABEL($syscall_error) \ + SYSCALL_ERROR_HANDLER; \ + cfi_endproc; \ + .previous + +# undef PSEUDO_END +# define PSEUDO_END(sym) \ + cfi_endproc; \ + .subsection 2; \ + .size sym, .-sym + +# define SAVE_ARGS_0 /* Nothing. */ +# define SAVE_ARGS_1 SAVE_ARGS_0; stq a0, 8(sp) +# define SAVE_ARGS_2 SAVE_ARGS_1; stq a1, 16(sp) +# define SAVE_ARGS_3 SAVE_ARGS_2; stq a2, 24(sp) +# define SAVE_ARGS_4 SAVE_ARGS_3; stq a3, 32(sp) +# define SAVE_ARGS_5 SAVE_ARGS_4; stq a4, 40(sp) +# define SAVE_ARGS_6 SAVE_ARGS_5; stq a5, 48(sp) + +# define LOAD_ARGS_0 /* Nothing. */ +# define LOAD_ARGS_1 LOAD_ARGS_0; ldq a0, 8(sp) +# define LOAD_ARGS_2 LOAD_ARGS_1; ldq a1, 16(sp) +# define LOAD_ARGS_3 LOAD_ARGS_2; ldq a2, 24(sp) +# define LOAD_ARGS_4 LOAD_ARGS_3; ldq a3, 32(sp) +# define LOAD_ARGS_5 LOAD_ARGS_4; ldq a4, 40(sp) +# define LOAD_ARGS_6 LOAD_ARGS_5; ldq a5, 48(sp) + +# ifdef IS_IN_libpthread +# define __local_enable_asynccancel __pthread_enable_asynccancel +# define __local_disable_asynccancel __pthread_disable_asynccancel +# define __local_multiple_threads __pthread_multiple_threads +# elif !defined NOT_IN_libc +# define __local_enable_asynccancel __libc_enable_asynccancel +# define __local_disable_asynccancel __libc_disable_asynccancel +# define __local_multiple_threads __libc_multiple_threads +# elif defined IS_IN_librt +# define __local_enable_asynccancel __librt_enable_asynccancel +# define __local_disable_asynccancel __librt_disable_asynccancel +# else +# error Unsupported library +# endif + +# ifdef PIC +# define CENABLE bsr ra, __local_enable_asynccancel !samegp +# define CDISABLE bsr ra, __local_disable_asynccancel !samegp +# else +# define CENABLE jsr ra, __local_enable_asynccancel; ldgp ra, 0(gp) +# define CDISABLE jsr ra, __local_disable_asynccancel; ldgp ra, 0(gp) +# endif + +# if defined IS_IN_libpthread || !defined NOT_IN_libc +# ifndef __ASSEMBLER__ +extern int __local_multiple_threads attribute_hidden; +# define SINGLE_THREAD_P \ + __builtin_expect (__local_multiple_threads == 0, 1) +# elif defined(PIC) +# define SINGLE_THREAD_P(reg) ldl reg, __local_multiple_threads(gp) !gprel +# else +# define SINGLE_THREAD_P(reg) \ + ldah reg, __local_multiple_threads(gp) !gprelhigh; \ + ldl reg, __local_multiple_threads(reg) !gprellow +# endif +# else +# ifndef __ASSEMBLER__ +# define SINGLE_THREAD_P \ + __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ + header.multiple_threads) == 0, 1) +# else +# define SINGLE_THREAD_P(reg) \ + call_pal PAL_rduniq; \ + ldl reg, MULTIPLE_THREADS_OFFSET($0) +# endif +# endif + +#else + +# define SINGLE_THREAD_P (1) +# define NO_CANCELLATION 1 + +#endif + +#ifndef __ASSEMBLER__ +# define RTLD_SINGLE_THREAD_P \ + __builtin_expect (THREAD_GETMEM (THREAD_SELF, \ + header.multiple_threads) == 0, 1) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c b/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c new file mode 100644 index 000000000..172223af3 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_create.c @@ -0,0 +1 @@ +#include "../x86_64/timer_create.c" diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c b/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c new file mode 100644 index 000000000..537516e0a --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_delete.c @@ -0,0 +1 @@ +#include "../x86_64/timer_delete.c" diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c b/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c new file mode 100644 index 000000000..3f21a73c9 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_getoverr.c @@ -0,0 +1 @@ +#include "../x86_64/timer_getoverr.c" diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c b/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c new file mode 100644 index 000000000..a50143adc --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_gettime.c @@ -0,0 +1 @@ +#include "../x86_64/timer_gettime.c" diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c b/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c new file mode 100644 index 000000000..37baeffac --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/timer_settime.c @@ -0,0 +1 @@ +#include "../x86_64/timer_settime.c" diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/vfork.S b/ports/sysdeps/unix/sysv/linux/alpha/nptl/vfork.S new file mode 100644 index 000000000..f4ed9311b --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/vfork.S @@ -0,0 +1,46 @@ +/* Copyright (C) 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include <tcb-offsets.h> + +#undef PSEUDO_PREPARE_ARGS +#define PSEUDO_PREPARE_ARGS \ + /* Load the current cached pid value across the vfork. */ \ + rduniq; \ + ldl a2, PID_OFFSET(v0); \ + mov v0, a1; \ + /* If the cached value is initialized (nonzero), then write \ + back its negation, or INT_MIN, to indicate that the pid \ + value is uninitialized in the the child, and in the window \ + between here and the point at which we restore the value. */ \ + ldah t0, -0x8000; \ + negl a2, t1; \ + cmovne a2, t1, t0; \ + stl t0, PID_OFFSET(v0); + +PSEUDO (__vfork, vfork, 0) + + /* If we're back in the parent, restore the saved pid. */ + beq v0, 1f + stl a2, PID_OFFSET(a1) +1: ret + +PSEUDO_END (__vfork) +libc_hidden_def (__vfork) +weak_alias (__vfork, vfork) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/oldglob.c b/ports/sysdeps/unix/sysv/linux/alpha/oldglob.c new file mode 100644 index 000000000..6d9b79f2c --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/oldglob.c @@ -0,0 +1,100 @@ +/* Copyright (C) 1998, 2000, 2004, 2005 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file contains only wrappers around the real glob functions. It + became necessary since the glob_t structure changed. */ +#include <sys/types.h> +#include <glob.h> +#include <shlib-compat.h> + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) + +/* This is the old structure. The difference is that the gl_pathc and + gl_offs elements have type `int'. */ +typedef struct + { + int gl_pathc; /* Count of paths matched by the pattern. */ + char **gl_pathv; /* List of matched pathnames. */ + int gl_offs; /* Slots to reserve in `gl_pathv'. */ + int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */ + + /* If the GLOB_ALTDIRFUNC flag is set, the following functions + are used instead of the normal file access functions. */ + void (*gl_closedir) (void *); + struct dirent *(*gl_readdir) (void *); + __ptr_t (*gl_opendir) (__const char *); + int (*gl_lstat) (__const char *, struct stat *); + int (*gl_stat) (__const char *, struct stat *); + } old_glob_t; + + +int +attribute_compat_text_section +__old_glob (const char *pattern, int flags, + int (*errfunc) (const char *, int), + old_glob_t *pglob) +{ + glob_t correct; + int result; + + /* Construct an object of correct type. */ + correct.gl_pathc = pglob->gl_pathc; + correct.gl_pathv = pglob->gl_pathv; + correct.gl_offs = pglob->gl_offs; + correct.gl_flags = pglob->gl_flags; + correct.gl_closedir = pglob->gl_closedir; + correct.gl_readdir = pglob->gl_readdir; + correct.gl_opendir = pglob->gl_opendir; + correct.gl_lstat = pglob->gl_lstat; + correct.gl_stat = pglob->gl_stat; + + result = glob (pattern, flags, errfunc, &correct); + + /* And convert it back. */ + pglob->gl_pathc = correct.gl_pathc; + pglob->gl_pathv = correct.gl_pathv; + pglob->gl_offs = correct.gl_offs; + pglob->gl_flags = correct.gl_flags; + pglob->gl_closedir = correct.gl_closedir; + pglob->gl_readdir = correct.gl_readdir; + pglob->gl_opendir = correct.gl_opendir; + pglob->gl_lstat = correct.gl_lstat; + pglob->gl_stat = correct.gl_stat; + + return result; +} +compat_symbol (libc, __old_glob, glob, GLIBC_2_0); + + +/* Free storage allocated in PGLOB by a previous `glob' call. */ +void +attribute_compat_text_section +__old_globfree (old_glob_t *pglob) +{ + glob_t correct; + + /* We only need these two symbols. */ + correct.gl_pathc = pglob->gl_pathc; + correct.gl_pathv = pglob->gl_pathv; + correct.gl_offs = pglob->gl_offs; + + globfree (&correct); +} +compat_symbol (libc, __old_globfree, globfree, GLIBC_2_0); + +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/pipe.S b/ports/sysdeps/unix/sysv/linux/alpha/pipe.S new file mode 100644 index 000000000..1e7ec1c19 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/pipe.S @@ -0,0 +1 @@ +#include <sysdeps/unix/alpha/pipe.S> diff --git a/ports/sysdeps/unix/sysv/linux/alpha/register-dump.h b/ports/sysdeps/unix/sysv/linux/alpha/register-dump.h new file mode 100644 index 000000000..77f962952 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/register-dump.h @@ -0,0 +1,157 @@ +/* Dump registers. + Copyright (C) 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <stddef.h> +#include <string.h> + +/* We will print the register dump in this format: + + V0: XXXXXXXXXXXXXXXX T0: XXXXXXXXXXXXXXXX T1: XXXXXXXXXXXXXXXX + T2: XXXXXXXXXXXXXXXX T3: XXXXXXXXXXXXXXXX T4: XXXXXXXXXXXXXXXX + T5: XXXXXXXXXXXXXXXX T6: XXXXXXXXXXXXXXXX T7: XXXXXXXXXXXXXXXX + S0: XXXXXXXXXXXXXXXX S1: XXXXXXXXXXXXXXXX S2: XXXXXXXXXXXXXXXX + S3: XXXXXXXXXXXXXXXX S4: XXXXXXXXXXXXXXXX S5: XXXXXXXXXXXXXXXX + S6: XXXXXXXXXXXXXXXX A0: XXXXXXXXXXXXXXXX A1: XXXXXXXXXXXXXXXX + A2: XXXXXXXXXXXXXXXX A3: XXXXXXXXXXXXXXXX A4: XXXXXXXXXXXXXXXX + A5: XXXXXXXXXXXXXXXX T8: XXXXXXXXXXXXXXXX T9: XXXXXXXXXXXXXXXX + T10: XXXXXXXXXXXXXXXX T11: XXXXXXXXXXXXXXXX RA: XXXXXXXXXXXXXXXX + T12: XXXXXXXXXXXXXXXX AT: XXXXXXXXXXXXXXXX GP: XXXXXXXXXXXXXXXX + SP: XXXXXXXXXXXXXXXX PC: XXXXXXXXXXXXXXXX + + FP0: XXXXXXXXXXXXXXXX FP1: XXXXXXXXXXXXXXXX FP2: XXXXXXXXXXXXXXXX + FP3: XXXXXXXXXXXXXXXX FP4: XXXXXXXXXXXXXXXX FP5: XXXXXXXXXXXXXXXX + FP6: XXXXXXXXXXXXXXXX FP7: XXXXXXXXXXXXXXXX FP8: XXXXXXXXXXXXXXXX + FP9: XXXXXXXXXXXXXXXX FP10: XXXXXXXXXXXXXXXX FP11: XXXXXXXXXXXXXXXX + FP12: XXXXXXXXXXXXXXXX FP13: XXXXXXXXXXXXXXXX FP14: XXXXXXXXXXXXXXXX + FP15: XXXXXXXXXXXXXXXX FP16: XXXXXXXXXXXXXXXX FP17: XXXXXXXXXXXXXXXX + FP18: XXXXXXXXXXXXXXXX FP19: XXXXXXXXXXXXXXXX FP20: XXXXXXXXXXXXXXXX + FP21: XXXXXXXXXXXXXXXX FP22: XXXXXXXXXXXXXXXX FP23: XXXXXXXXXXXXXXXX + FP24: XXXXXXXXXXXXXXXX FP25: XXXXXXXXXXXXXXXX FP26: XXXXXXXXXXXXXXXX + FP27: XXXXXXXXXXXXXXXX FP28: XXXXXXXXXXXXXXXX FP29: XXXXXXXXXXXXXXXX + FP30: XXXXXXXXXXXXXXXX FPCR: XXXXXXXXXXXXXXXX + + TA0: XXXXXXXXXXXXXXXX TA1: XXXXXXXXXXXXXXXX TA2: XXXXXXXXXXXXXXXX +*/ + +#define NREGS (32+32+3) + +static const char __attribute__((aligned(8))) regnames[NREGS][8] = +{ + " V0: ", " T0: ", " T1: ", + " T2: ", " T3: ", " T4: ", + " T5: ", " T6: ", " T7: ", + " S0: ", " S1: ", " S2: ", + " S3: ", " S4: ", " S5: ", + " S6: ", " A0: ", " A1: ", + " A2: ", " A3: ", " A4: ", + " A5: ", " T8: ", " T9: ", + " T10: ", " T11: ", " RA: ", + " T12: ", " AT: ", " GP: ", + " SP: ", " PC: ", + + " FP0: ", " FP1: ", " FP2: ", + " FP3: ", " FP4: ", " FP5: ", + " FP6: ", " FP7: ", " FP8: ", + " FP9: ", " FP10: ", " FP11: ", + " FP12: ", " FP13: ", " FP14: ", + " FP15: ", " FP16: ", " FP17: ", + " FP18: ", " FP19: ", " FP20: ", + " FP21: ", " FP22: ", " FP23: ", + " FP24: ", " FP25: ", " FP26: ", + " FP27: ", " FP28: ", " FP29: ", + " FP30: ", " FPCR: ", + + " TA0: ", " TA1: ", " TA2: " +}; + +#define O(FIELD, LF) offsetof(struct sigcontext, FIELD) + LF + +static const int offsets[NREGS] = +{ + O(sc_regs[0], 0), O(sc_regs[1], 0), O(sc_regs[2], 1), + O(sc_regs[3], 0), O(sc_regs[4], 0), O(sc_regs[5], 1), + O(sc_regs[6], 0), O(sc_regs[7], 0), O(sc_regs[8], 1), + O(sc_regs[9], 0), O(sc_regs[10], 0), O(sc_regs[11], 1), + O(sc_regs[12], 0), O(sc_regs[13], 0), O(sc_regs[14], 1), + O(sc_regs[15], 0), O(sc_regs[16], 0), O(sc_regs[17], 1), + O(sc_regs[18], 0), O(sc_regs[19], 0), O(sc_regs[20], 1), + O(sc_regs[21], 0), O(sc_regs[22], 0), O(sc_regs[23], 1), + O(sc_regs[24], 0), O(sc_regs[25], 0), O(sc_regs[26], 1), + O(sc_regs[27], 0), O(sc_regs[28], 0), O(sc_regs[29], 1), + O(sc_regs[30], 0), O(sc_pc, 2), + + O(sc_fpregs[0], 0), O(sc_fpregs[1], 0), O(sc_fpregs[2], 1), + O(sc_fpregs[3], 0), O(sc_fpregs[4], 0), O(sc_fpregs[5], 1), + O(sc_fpregs[6], 0), O(sc_fpregs[7], 0), O(sc_fpregs[8], 1), + O(sc_fpregs[9], 0), O(sc_fpregs[10], 0), O(sc_fpregs[11], 1), + O(sc_fpregs[12], 0), O(sc_fpregs[13], 0), O(sc_fpregs[14], 1), + O(sc_fpregs[15], 0), O(sc_fpregs[16], 0), O(sc_fpregs[17], 1), + O(sc_fpregs[18], 0), O(sc_fpregs[19], 0), O(sc_fpregs[20], 1), + O(sc_fpregs[21], 0), O(sc_fpregs[22], 0), O(sc_fpregs[23], 1), + O(sc_fpregs[24], 0), O(sc_fpregs[25], 0), O(sc_fpregs[26], 1), + O(sc_fpregs[27], 0), O(sc_fpregs[28], 0), O(sc_fpregs[29], 1), + O(sc_fpregs[30], 0), O(sc_fpcr, 2), + + O(sc_traparg_a0, 0), O(sc_traparg_a1, 0), O(sc_traparg_a2, 1) +}; + +#undef O + +static void +register_dump (int fd, struct sigcontext *ctx) +{ + char buf[NREGS*(8+16) + 25 + 80]; + char *p = buf; + size_t i; + + p = stpcpy (p, "Register dump:\n\n"); + + for (i = 0; i < NREGS; ++i) + { + int this_offset, this_lf; + unsigned long val; + signed long j; + + this_offset = offsets[i]; + this_lf = this_offset & 7; + + val = *(unsigned long *)(((size_t)ctx + this_offset) & -8); + + memcpy (p, regnames[i], 8); + p += 8; + + for (j = 60; j >= 0; j -= 4) + { + unsigned long x = (val >> j) & 15; + x += x < 10 ? '0' : 'a' - 10; + *p++ = x; + } + + if (this_lf > 0) + { + if (this_lf > 1) + *p++ = '\n'; + *p++ = '\n'; + } + } + + write (fd, buf, p - buf); +} + +#define REGISTER_DUMP register_dump (fd, ctx) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/rt_sigaction.S b/ports/sysdeps/unix/sysv/linux/alpha/rt_sigaction.S new file mode 100644 index 000000000..e27949fef --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/rt_sigaction.S @@ -0,0 +1,120 @@ +/* Copyright (C) 1998, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson <rth@cygnus.com>, 1998 + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +/* On Alpha we desparately want to avoid having to issue an imb. Ordinarily + the kernel would have to issue one after setting up the signal return + stack, but the Linux rt_sigaction syscall is prepared to accept a pointer + to the sigreturn syscall, instead of inlining it on the stack. + + This just about halves signal delivery time. */ + + .text + +ENTRY(__syscall_rt_sigaction) + .frame sp,0,ra,0 + ldgp gp,0(pv) +#ifdef PROF + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at +#endif + .prologue 1 + + beq a1, 0f + ldl t0, 8(a1) # sa_flags + + /* The unwinder will subtract one from the return address when + attempting to find the call instruction that led us here. + Since we didn't get here via a normal call, if we do nothing + we would pick up the wrong symbol and the wrong FDE. Account + for this by adding a nop to the start of the function and + then skipping it here by adding 4. */ + ldah a4, __syscall_sigreturn+4(gp) !gprelhigh + ldah t1, __syscall_rt_sigreturn+4(gp) !gprelhigh + lda a4, __syscall_sigreturn+4(a4) !gprellow + lda t1, __syscall_rt_sigreturn+4(t1) !gprellow + and t0, 0x40, t0 # SA_SIGINFO + cmovne t0, t1, a4 + +0: ldi v0, __NR_rt_sigaction + callsys + bne a3, SYSCALL_ERROR_LABEL + ret + +PSEUDO_END(__syscall_rt_sigaction) + +/* To enable unwinding through the signal frame without special hackery + elsewhere, describe the entire struct sigcontext with unwind info. + + In order to minimize the size of the encoding, we set the CFA to the + end of the sigcontext, which makes all of the registers have small + negative offsets from that. */ + + .macro SIGCONTEXT_REGS_I base, from=0 + cfi_offset (\from, \base + (4 + \from) * 8) + .if 30-\from + SIGCONTEXT_REGS_I \base, "(\from+1)" + .endif + .endm + + .macro SIGCONTEXT_REGS_F base, from=32 + cfi_offset (\from, \base + (4 + 1 + \from) * 8) + .if 62-\from + SIGCONTEXT_REGS_F \base, "(\from+1)" + .endif + .endm + + .macro SIGCONTEXT_REGS base + SIGCONTEXT_REGS_I \base + SIGCONTEXT_REGS_F \base + cfi_offset (63, \base + (4 + 32 + 1 + 32) * 8) + cfi_offset (64, \base + 2 * 8) + .endm + + .align 4 + nop + nop + nop + + cfi_startproc + cfi_return_column (64) + SIGCONTEXT_REGS -648 + + cfi_def_cfa_offset (648) +__syscall_sigreturn: + nop + mov sp, a0 + ldi v0, __NR_sigreturn + callsys + .size __syscall_sigreturn, .-__syscall_sigreturn + .type __syscall_sigreturn, @function + + cfi_def_cfa_offset (176 + 648) +__syscall_rt_sigreturn: + nop + mov sp,a0 + ldi v0,__NR_rt_sigreturn + callsys + .size __syscall_rt_sigreturn, .-__syscall_rt_sigreturn + .type __syscall_rt_sigreturn, @function + + cfi_endproc diff --git a/ports/sysdeps/unix/sysv/linux/alpha/select.S b/ports/sysdeps/unix/sysv/linux/alpha/select.S new file mode 100644 index 000000000..35a81e949 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/select.S @@ -0,0 +1,241 @@ +/* Copyright (C) 1998,2002,2003,2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep-cancel.h> +#define _ERRNO_H 1 +#include <bits/errno.h> +#include <kernel-features.h> + +.text + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +#define SELECT __select_tv64 +#else +#define SELECT __select +#endif + +#if defined __ASSUME_TIMEVAL64 +PSEUDO(SELECT, select, 5) + ret +PSEUDO_END(SELECT) +#else +/* The problem here is that initially we made struct timeval compatible with + OSF/1, using int32. But we defined time_t with uint64, and later found + that POSIX requires tv_sec to be time_t. + + So now we have to do compatibility stuff. */ + +/* The variable is shared between all wrappers around signal handling + functions which have RT equivalents. */ +.comm __libc_missing_axp_tv64, 4 + +LEAF(SELECT, 64) + ldgp gp, 0(pv) + subq sp, 64, sp +#ifdef PROF + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at +#endif + stq ra, 40(sp) + .mask 0x4000000, 40-64 + .prologue 1 + +#ifdef CENABLE + SINGLE_THREAD_P (t1) +#else + ldl t0, __libc_missing_axp_tv64 +#endif + + /* Save timeout early, since we'll need to recover this after + the system call. */ + stq a4, 48(sp) + +#ifdef CENABLE + bne t1, $do_cancel +#endif + + bne t0, $do32 + + /* Save arguments in case we do need to fall back. */ + stq a0, 8(sp) + stq a1, 16(sp) + stq a2, 24(sp) + stq a3, 32(sp) + + ldi v0, SYS_ify(select) + callsys + bne a3, $err64 + + /* Everything ok. */ + addq sp, 64, sp + ret + + /* If we didn't get ENOSYS, it is a real error. */ + .align 3 +$err64: cmpeq v0, ENOSYS, t0 + beq t0, $error + stl t0, __libc_missing_axp_tv64 + + /* Recover the saved arguments. */ + ldq a4, 48(sp) + ldq a3, 32(sp) + ldq a2, 24(sp) + ldq a1, 16(sp) + ldq a0, 8(sp) + + .align 3 +$do32: + /* If the timeout argument is present bounce to the smaller fmt. */ + beq a4, 1f + ldq t0, 0(a4) + ldq t1, 8(a4) + stl t0, 0(sp) + stl t1, 4(sp) + mov sp, a4 + +1: ldi v0, SYS_ify(osf_select) + callsys + bne a3, $error + + /* ... and bounce the remaining timeout back. */ + ldq a4, 48(sp) + beq a4, 2f + ldl t0, 0(sp) + ldl t1, 4(sp) + stq t0, 0(a4) + stq t1, 8(a4) + +2: addq sp, 64, sp + ret + +#ifdef CENABLE + .align 3 +$do_cancel: + /* Save arguments. */ + stq a0, 8(sp) + stq a1, 16(sp) + stq a2, 24(sp) + stq a3, 32(sp) + + CENABLE + mov v0, ra + + ldl t0, __libc_missing_axp_tv64 + bne t0, $do_cancel32 + + /* Recover the saved arguments. */ + ldq a4, 48(sp) + ldq a3, 32(sp) + ldq a2, 24(sp) + ldq a1, 16(sp) + ldq a0, 8(sp) + + ldi v0, SYS_ify(select) + callsys + + mov ra, a0 + bne a3, $cancel_err64 + + stq v0, 8(sp) + CDISABLE + ldq v0, 8(sp) + ldq ra, 40(sp) + + /* Everything ok. */ + addq sp, 64, sp + ret + + /* If we didn't get ENOSYS, it is a real error. */ + .align 3 +$cancel_err64: + cmpeq v0, ENOSYS, t0 + beq t0, $cancel_error + stl t0, __libc_missing_axp_tv64 + + /* Recover the saved arguments. */ + .align 3 +$do_cancel32: + ldq a4, 48(sp) + ldq a3, 32(sp) + ldq a2, 24(sp) + ldq a1, 16(sp) + ldq a0, 8(sp) + + /* If the timeout argument is present bounce to the smaller fmt. */ + beq a4, 1f + ldq t0, 0(a4) + ldq t1, 8(a4) + stl t0, 0(sp) + stl t1, 4(sp) + mov sp, a4 + +1: ldi v0, SYS_ify(osf_select) + callsys + + mov ra, a0 + bne a3, $cancel_error + + /* ... and bounce the remaining timeout back. */ + ldq a4, 48(sp) + beq a4, 2f + ldl t0, 0(sp) + ldl t1, 4(sp) + stq t0, 0(a4) + stq t1, 8(a4) + +2: stq v0, 8(sp) + CDISABLE + ldq v0, 8(sp) + ldq ra, 40(sp) + + addq sp, 64, sp + ret + + .align 3 +$cancel_error: + stq v0, 8(sp) + CDISABLE + ldq v0, 8(sp) + ldq ra, 40(sp) +#endif + + .align 3 +$error: + addq sp, 64, sp + SYSCALL_ERROR_HANDLER + +END(SELECT) +#endif /* __ASSUME_TIMEVAL64 */ + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +default_symbol_version (__select_tv64, __select, GLIBC_2.1) + +/* It seems to me to be a misfeature of the assembler that we can only + have one version-alias per symbol. So create an alias ourselves. + The 'p' is for 'public'. *Shrug* */ +strong_alias (__select_tv64, __select_tv64p) +default_symbol_version (__select_tv64p, select, GLIBC_2.1) +libc_hidden_ver (__select_tv64, __select) +strong_alias (__select_tv64, __libc_select) +#else +strong_alias (__select, __libc_select) +weak_alias (__select, select) +libc_hidden_def (__select) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/semctl.c b/ports/sysdeps/unix/sysv/linux/alpha/semctl.c new file mode 100644 index 000000000..9957f983b --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/semctl.c @@ -0,0 +1,136 @@ +/* Copyright (C) 1995,1997,1998,2000,2003,2006 + 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <stdarg.h> +#include <sys/sem.h> +#include <ipc_priv.h> + +#include <sysdep.h> +#include <string.h> +#include <sys/syscall.h> + +#include <kernel-features.h> + +struct __old_semid_ds +{ + struct __old_ipc_perm sem_perm; /* operation permission struct */ + __time_t sem_otime; /* last semop() time */ + __time_t sem_ctime; /* last time changed by semctl() */ + struct sem *__sembase; /* ptr to first semaphore in array */ + struct sem_queue *__sem_pending; /* pending operations */ + struct sem_queue *__sem_pending_last; /* last pending operation */ + struct sem_undo *__undo; /* ondo requests on this array */ + unsigned short int sem_nsems; /* number of semaphores in set */ +}; + +/* Define a `union semun' suitable for Linux here. */ +union semun +{ + int val; /* value for SETVAL */ + struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */ + unsigned short int *array; /* array for GETALL & SETALL */ + struct seminfo *__buf; /* buffer for IPC_INFO */ +}; + +#include <bp-checks.h> +#include <bp-semctl.h> /* definition of CHECK_SEMCTL needs union semum */ + +/* Return identifier for array of NSEMS semaphores associated with + KEY. */ +int __new_semctl (int semid, int semnum, int cmd, ...); + +int +__new_semctl (int semid, int semnum, int cmd, ...) +{ + union semun arg; + va_list ap; + + va_start (ap, cmd); + + /* Get the argument. */ + arg = va_arg (ap, union semun); + + va_end (ap); + +#if __ASSUME_32BITUIDS > 0 + return INLINE_SYSCALL (semctl, 4, semid, semnum, cmd | __IPC_64, + CHECK_SEMCTL (&arg, semid, cmd | __IPC_64)->array); +#else + switch (cmd) { + case SEM_STAT: + case IPC_STAT: + case IPC_SET: + break; + default: + return INLINE_SYSCALL (semctl, 4, semid, semnum, cmd, + CHECK_SEMCTL (&arg, semid, cmd)->array); + } + + { + int save_errno = errno, result; + struct __old_semid_ds old; + struct semid_ds *buf; + + /* Unfortunately there is no way how to find out for sure whether + we should use old or new semctl. */ + result = INLINE_SYSCALL (semctl, 4, semid, semnum, cmd | __IPC_64, + CHECK_SEMCTL (&arg, semid, cmd | __IPC_64)->array); + if (result != -1 || errno != EINVAL) + return result; + + __set_errno(save_errno); + buf = arg.buf; + arg.buf = (void *)&old; + if (cmd == IPC_SET) + { + old.sem_perm.uid = buf->sem_perm.uid; + old.sem_perm.gid = buf->sem_perm.gid; + old.sem_perm.mode = buf->sem_perm.mode; + if (old.sem_perm.uid != buf->sem_perm.uid || + old.sem_perm.gid != buf->sem_perm.gid) + { + __set_errno (EINVAL); + return -1; + } + } + result = INLINE_SYSCALL (semctl, 4, semid, semnum, cmd, + CHECK_SEMCTL (&arg, semid, cmd)->array); + if (result != -1 && cmd != IPC_SET) + { + memset(buf, 0, sizeof(*buf)); + buf->sem_perm.__key = old.sem_perm.__key; + buf->sem_perm.uid = old.sem_perm.uid; + buf->sem_perm.gid = old.sem_perm.gid; + buf->sem_perm.cuid = old.sem_perm.cuid; + buf->sem_perm.cgid = old.sem_perm.cgid; + buf->sem_perm.mode = old.sem_perm.mode; + buf->sem_perm.__seq = old.sem_perm.__seq; + buf->sem_otime = old.sem_otime; + buf->sem_ctime = old.sem_ctime; + buf->sem_nsems = old.sem_nsems; + } + return result; + } +#endif +} + +#include <shlib-compat.h> +versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2); diff --git a/ports/sysdeps/unix/sysv/linux/alpha/setcontext.S b/ports/sysdeps/unix/sysv/linux/alpha/setcontext.S new file mode 100644 index 000000000..27abfd0c1 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/setcontext.S @@ -0,0 +1,35 @@ +/* Install given context. + Copyright (C) 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include <ucontext-offsets.h> + + +/* In case the user fiddled it, copy the "official" signal mask + from the ucontext_t into the sigcontext structure. */ +#undef PSEUDO_PREPARE_ARGS +#define PSEUDO_PREPARE_ARGS \ + ldq $0, UC_SIGMASK($16); \ + stq $0, UC_SIGCTX+SC_MASK($16); \ + lda $16, UC_SIGCTX($16); + +PSEUDO(__setcontext, sigreturn, 1) + ret +PSEUDO_END(__setcontext) +weak_alias (__setcontext, setcontext) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/setfpucw.c b/ports/sysdeps/unix/sysv/linux/alpha/setfpucw.c new file mode 100644 index 000000000..a7e3a5581 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/setfpucw.c @@ -0,0 +1,80 @@ +/* Set FP exception mask and rounding mode. + Copyright (C) 1996, 1997, 1998, 2003 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <fpu_control.h> +#include <asm/fpu.h> + +extern void __ieee_set_fp_control (unsigned long); +libc_hidden_proto(__ieee_set_fp_control) + +extern unsigned long __ieee_get_fp_control (void); +libc_hidden_proto(__ieee_get_fp_control) + +static inline unsigned long +rdfpcr (void) +{ + unsigned long fpcr; + asm ("excb; mf_fpcr %0" : "=f"(fpcr)); + return fpcr; +} + + +static inline void +wrfpcr (unsigned long fpcr) +{ + asm volatile ("mt_fpcr %0; excb" : : "f"(fpcr)); +} + + +void +__setfpucw (fpu_control_t fpu_control) +{ + unsigned long fpcr = 0, fpcw = 0; + + if (!fpu_control) + fpu_control = _FPU_DEFAULT; + + /* first, set dynamic rounding mode: */ + + fpcr = rdfpcr(); + fpcr &= ~FPCR_DYN_MASK; + switch (fpu_control & 0xc00) + { + case _FPU_RC_NEAREST: fpcr |= FPCR_DYN_NORMAL; break; + case _FPU_RC_DOWN: fpcr |= FPCR_DYN_MINUS; break; + case _FPU_RC_UP: fpcr |= FPCR_DYN_PLUS; break; + case _FPU_RC_ZERO: fpcr |= FPCR_DYN_CHOPPED; break; + } + wrfpcr(fpcr); + + /* now tell kernel about traps that we like to hear about: */ + + fpcw = __ieee_get_fp_control(); + fpcw &= ~IEEE_TRAP_ENABLE_MASK; + + if (!(fpu_control & _FPU_MASK_IM)) fpcw |= IEEE_TRAP_ENABLE_INV; + if (!(fpu_control & _FPU_MASK_DM)) fpcw |= IEEE_TRAP_ENABLE_UNF; + if (!(fpu_control & _FPU_MASK_ZM)) fpcw |= IEEE_TRAP_ENABLE_DZE; + if (!(fpu_control & _FPU_MASK_OM)) fpcw |= IEEE_TRAP_ENABLE_OVF; + if (!(fpu_control & _FPU_MASK_PM)) fpcw |= IEEE_TRAP_ENABLE_INE; + + __fpu_control = fpu_control; /* update global copy */ + + __ieee_set_fp_control(fpcw); +} diff --git a/ports/sysdeps/unix/sysv/linux/alpha/setitimer.S b/ports/sysdeps/unix/sysv/linux/alpha/setitimer.S new file mode 100644 index 000000000..59caeac68 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/setitimer.S @@ -0,0 +1,137 @@ +/* Copyright (C) 1998, 2003, 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#define _ERRNO_H 1 +#include <bits/errno.h> +#include <kernel-features.h> + +.text + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +#define SETITIMER __setitimer_tv64 +#else +#define SETITIMER __setitimer +#endif + +#if defined __ASSUME_TIMEVAL64 +PSEUDO(SETITIMER, setitimer, 3) + ret +PSEUDO_END(SETITIMER) +#else +/* The problem here is that initially we made struct timeval compatible with + OSF/1, using int32. But we defined time_t with uint64, and later found + that POSIX requires tv_sec to be time_t. + + So now we have to do compatibility stuff. */ + +/* The variable is shared between all wrappers around signal handling + functions which have RT equivalents. */ +.comm __libc_missing_axp_tv64, 4 + +LEAF(SETITIMER, 48) + ldgp gp, 0(pv) + subq sp, 48, sp +#ifdef PROF + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at +#endif + .prologue 1 + + ldl t0, __libc_missing_axp_tv64 + + /* Save arguments in case we do need to fall back. */ + stq a0, 0(sp) + stq a1, 8(sp) + stq a2, 16(sp) + + bne t0, $do32 + + ldi v0, SYS_ify(setitimer) + callsys + bne a3, $err64 + + /* Everything ok. */ + addq sp, 48, sp + ret + + /* If we didn't get ENOSYS, it is a real error. */ + .align 3 +$err64: cmpeq v0, ENOSYS, t0 + beq t0, $error + stl t0, __libc_missing_axp_tv64 + + /* Recover the saved arguments. */ + ldq a2, 16(sp) + ldq a1, 8(sp) + ldq a0, 0(sp) + + .align 3 +$do32: + /* Conditionally bounce new value down. */ + beq a1, 1f + ldq t0, 0(a1) + ldq t1, 8(a1) + ldq t2, 16(a1) + ldq t3, 24(a1) + stl t0, 32(sp) + stl t1, 36(sp) + stl t2, 40(sp) + stl t3, 44(sp) + addq sp, 32, a1 + +1: ldi v0, SYS_ify(osf_setitimer) + callsys + bne a3, $error + + /* Conditionaly bounce old value up. */ + ldq a2, 16(sp) + bne a2, 2f + ldl t0, 0(a2) + ldl t1, 4(a2) + ldl t2, 8(a2) + ldl t3, 12(a2) + stq t0, 0(a2) + stq t1, 8(a2) + stq t2, 48(a2) + stq t3, 24(a2) + +2: addq sp, 48, sp + ret + + .align 3 +$error: + addq sp, 48, sp + SYSCALL_ERROR_HANDLER + +END(SETITIMER) +#endif /* __ASSUME_TIMEVAL64 */ + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +default_symbol_version (__setitimer_tv64, __setitimer, GLIBC_2.1) + +/* It seems to me to be a misfeature of the assembler that we can only + have one version-alias per symbol. So create an alias ourselves. + The 'p' is for 'public'. *Shrug* */ +strong_alias (__setitimer_tv64, __setitimer_tv64p) +default_symbol_version (__setitimer_tv64p, setitimer, GLIBC_2.1) +#else +weak_alias (__setitimer, setitimer) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/setregid.c b/ports/sysdeps/unix/sysv/linux/alpha/setregid.c new file mode 100644 index 000000000..0973fe4ac --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/setregid.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1998, 2000, 2003, 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <unistd.h> +#include <setxid.h> + + +int +__setregid (gid_t rgid, gid_t egid) +{ + return INLINE_SETXID_SYSCALL (setregid, 2, (int) rgid, (int) egid); +} +#ifndef __setregid +weak_alias (__setregid, setregid) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/setresgid.c b/ports/sysdeps/unix/sysv/linux/alpha/setresgid.c new file mode 100644 index 000000000..50e29e3c7 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/setresgid.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1998, 2000, 2003, 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <unistd.h> +#include <setxid.h> + + +int +__setresgid (gid_t rgid, gid_t egid, gid_t sgid) +{ + return INLINE_SETXID_SYSCALL (setresgid, 3, (int) rgid, + (int) egid, (int) sgid); +} +libc_hidden_def (__setresgid) +#ifndef __setresgid +weak_alias (__setresgid, setresgid) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/setresuid.c b/ports/sysdeps/unix/sysv/linux/alpha/setresuid.c new file mode 100644 index 000000000..e76413bf6 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/setresuid.c @@ -0,0 +1,33 @@ +/* Copyright (C) 1998, 2000, 2003, 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <unistd.h> +#include <setxid.h> + + +int +__setresuid (uid_t ruid, uid_t euid, uid_t suid) +{ + return INLINE_SETXID_SYSCALL (setresuid, 3, (int) ruid, + (int) euid, (int) suid); +} +libc_hidden_def (__setresuid) +#ifndef __setresuid +weak_alias (__setresuid, setresuid) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/setreuid.c b/ports/sysdeps/unix/sysv/linux/alpha/setreuid.c new file mode 100644 index 000000000..a23a34792 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/setreuid.c @@ -0,0 +1,31 @@ +/* Copyright (C) 1998, 2000, 2003, 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <unistd.h> +#include <setxid.h> + + +int +__setreuid (uid_t ruid, uid_t euid) +{ + return INLINE_SETXID_SYSCALL (setreuid, 2, (int) ruid, (int) euid); +} +#ifndef __setreuid +weak_alias (__setreuid, setreuid) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/settimeofday.S b/ports/sysdeps/unix/sysv/linux/alpha/settimeofday.S new file mode 100644 index 000000000..e39eadc20 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/settimeofday.S @@ -0,0 +1,118 @@ +/* Copyright (C) 1998, 2003, 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#define _ERRNO_H 1 +#include <bits/errno.h> +#include <kernel-features.h> + +.text + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +#define SETTIMEOFDAY __settimeofday_tv64 +#else +#define SETTIMEOFDAY __settimeofday +#endif + +#if defined __ASSUME_TIMEVAL64 +PSEUDO(SETTIMEOFDAY, settimeofday, 2) + ret +PSEUDO_END(SETTIMEOFDAY) +#else +/* The problem here is that initially we made struct timeval compatible with + OSF/1, using int32. But we defined time_t with uint64, and later found + that POSIX requires tv_sec to be time_t. + + So now we have to do compatibility stuff. */ + +/* The variable is shared between all wrappers around signal handling + functions which have RT equivalents. */ +.comm __libc_missing_axp_tv64, 4 + +LEAF(SETTIMEOFDAY, 16) + ldgp gp, 0(pv) + subq sp, 16, sp +#ifdef PROF + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at +#endif + .prologue 1 + + ldl t0, __libc_missing_axp_tv64 + bne t0, $do32 + + /* Save arguments in case we do need to fall back. */ + stq a0, 0(sp) + stq a1, 8(sp) + + ldi v0, SYS_ify(settimeofday) + callsys + bne a3, $err64 + + /* Everything ok. */ + addq sp, 16, sp + ret + + /* If we didn't get ENOSYS, it is a real error. */ + .align 3 +$err64: cmpeq v0, ENOSYS, t0 + beq t0, $error + stl t0, __libc_missing_axp_tv64 + + /* Recover the saved arguments. */ + ldq a1, 8(sp) + ldq a0, 0(sp) + + .align 3 +$do32: + /* Conditionally bounce the timeval down. */ + beq a0, 1f + ldq t0, 0(a0) + ldq t1, 8(a0) + stl t0, 0(sp) + stl t1, 4(sp) + mov sp, a0 + +1: ldi v0, SYS_ify(osf_settimeofday) + callsys + bne a3, $error + + addq sp, 16, sp + ret + + .align 3 +$error: + addq sp, 16, sp + SYSCALL_ERROR_HANDLER + +END(SETTIMEOFDAY) +#endif /* __ASSUME_TIMEVAL64 */ + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +default_symbol_version (__settimeofday_tv64, __settimeofday, GLIBC_2.1) + +/* It seems to me to be a misfeature of the assembler that we can only + have one version-alias per symbol. So create an alias ourselves. + The 'p' is for 'public'. *Shrug* */ +strong_alias (__settimeofday_tv64, __settimeofday_tv64p) +default_symbol_version (__settimeofday_tv64p, settimeofday, GLIBC_2.1) +#else +weak_alias (__settimeofday, settimeofday) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/shmctl.c b/ports/sysdeps/unix/sysv/linux/alpha/shmctl.c new file mode 100644 index 000000000..e63211fa0 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/shmctl.c @@ -0,0 +1,135 @@ +/* Copyright (C) 1995,1997,1998,2000,2003,2006 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; 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 <string.h> +#include <sys/syscall.h> +#include <bits/wordsize.h> +#include <bp-checks.h> + +#include <kernel-features.h> + +struct __old_shmid_ds +{ + struct __old_ipc_perm shm_perm; /* operation permission struct */ + int 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() */ + __ipc_pid_t shm_cpid; /* pid of creator */ + __ipc_pid_t shm_lpid; /* pid of last shmop */ + unsigned short int shm_nattch; /* number of current attaches */ + unsigned short int __shm_npages; /* size of segment (pages) */ + unsigned long int *__unbounded __shm_pages; /* array of ptrs to frames -> SHMMAX */ + struct vm_area_struct *__unbounded __attaches; /* descriptors for attaches */ +}; + +struct __old_shminfo +{ + int shmmax; + int shmmin; + int shmmni; + int shmseg; + int shmall; +}; + +/* Provide operations to control over shared memory segments. */ +int __new_shmctl (int, int, struct shmid_ds *); + +int +__new_shmctl (int shmid, int cmd, struct shmid_ds *buf) +{ +#if __ASSUME_32BITUIDS > 0 + return INLINE_SYSCALL (shmctl, 3, shmid, cmd | __IPC_64, CHECK_1 (buf)); +#else + switch (cmd) { + case SHM_STAT: + case IPC_STAT: + case IPC_SET: + case IPC_INFO: + break; + default: + return INLINE_SYSCALL (shmctl, 3, shmid, cmd, CHECK_1 (buf)); + } + + { + int save_errno = errno, result; + struct __old_shmid_ds old; + + /* Unfortunately there is no way how to find out for sure whether + we should use old or new shmctl. */ + result = INLINE_SYSCALL (shmctl, 3, shmid, cmd | __IPC_64, CHECK_1 (buf)); + if (result != -1 || errno != EINVAL) + return result; + + __set_errno(save_errno); + if (cmd == IPC_SET) + { + old.shm_perm.uid = buf->shm_perm.uid; + old.shm_perm.gid = buf->shm_perm.gid; + old.shm_perm.mode = buf->shm_perm.mode; + if (old.shm_perm.uid != buf->shm_perm.uid || + old.shm_perm.gid != buf->shm_perm.gid) + { + __set_errno (EINVAL); + return -1; + } + } + result = INLINE_SYSCALL (shmctl, 3, shmid, cmd, __ptrvalue (&old)); + if (result != -1 && (cmd == SHM_STAT || cmd == IPC_STAT)) + { + memset(buf, 0, sizeof(*buf)); + buf->shm_perm.__key = old.shm_perm.__key; + buf->shm_perm.uid = old.shm_perm.uid; + buf->shm_perm.gid = old.shm_perm.gid; + buf->shm_perm.cuid = old.shm_perm.cuid; + buf->shm_perm.cgid = old.shm_perm.cgid; + buf->shm_perm.mode = old.shm_perm.mode; + buf->shm_perm.__seq = old.shm_perm.__seq; + buf->shm_atime = old.shm_atime; + buf->shm_dtime = old.shm_dtime; + buf->shm_ctime = old.shm_ctime; + buf->shm_segsz = old.shm_segsz; + buf->shm_nattch = old.shm_nattch; + buf->shm_cpid = old.shm_cpid; + buf->shm_lpid = old.shm_lpid; + } + else if (result != -1 && cmd == IPC_INFO) + { + struct __old_shminfo *oldi = (void *)&old; + struct shminfo *i = (struct shminfo *)buf; + + memset(i, 0, sizeof(*i)); + i->shmmax = oldi->shmmax; + i->shmmin = oldi->shmmin; + i->shmmni = oldi->shmmni; + i->shmseg = oldi->shmseg; + i->shmall = oldi->shmall; + } + return result; + } +#endif +} + +#include <shlib-compat.h> +versioned_symbol (libc, __new_shmctl, shmctl, GLIBC_2_2); diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sigaction.c b/ports/sysdeps/unix/sysv/linux/alpha/sigaction.c new file mode 100644 index 000000000..26b081d9a --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sigaction.c @@ -0,0 +1,39 @@ +/* Copyright (C) 2003 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include <sys/cdefs.h> +#include <stddef.h> + +/* + * In order to get the hidden arguments for rt_sigaction set up + * properly, we need to call the assembly version. Detect this in the + * INLINE_SYSCALL macro, and fail to expand inline in that case. + */ + +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + (__NR_##name == __NR_rt_sigaction \ + ? __syscall_rt_sigaction(args) \ + : INLINE_SYSCALL1(name, nr, args)) + +struct kernel_sigaction; +extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *__unbounded, + struct kernel_sigaction *__unbounded, size_t); + +#include <sysdeps/unix/sysv/linux/sigaction.c> diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h b/ports/sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h new file mode 100644 index 000000000..16c5dcbc5 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h @@ -0,0 +1,25 @@ +/* Copyright (C) 1999, 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define SIGCONTEXT int _code, struct sigcontext * +#define SIGCONTEXT_EXTRA_ARGS _code, +#define GET_PC(ctx) ((void *) (ctx)->sc_pc) +#define GET_FRAME(ctx) ((void *) (ctx)->sc_regs[15]) +#define GET_STACK(ctx) ((void *) (ctx)->sc_regs[30]) +#define CALL_SIGHANDLER(handler, signo, ctx) \ + (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sigprocmask.c b/ports/sysdeps/unix/sysv/linux/alpha/sigprocmask.c new file mode 100644 index 000000000..1916111a2 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sigprocmask.c @@ -0,0 +1,58 @@ +/* Copyright (C) 1993, 1995, 1997, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger (davidm@azstarnet.com). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <sysdep.h> +#include <signal.h> + +/* When there is kernel support for more than 64 signals, we'll have to + switch to a new system call convention here. */ + +int +__sigprocmask (int how, const sigset_t *set, sigset_t *oset) +{ + unsigned long int setval; + long result; + + if (set) + setval = set->__val[0]; + else + { + setval = 0; + how = SIG_BLOCK; /* ensure blocked mask doesn't get changed */ + } + + result = INLINE_SYSCALL (osf_sigprocmask, 2, how, setval); + if (result == -1) + /* If there are ever more than 63 signals, we need to recode this + in assembler since we wouldn't be able to distinguish a mask of + all 1s from -1, but for now, we're doing just fine... */ + return result; + + if (oset) + { + oset->__val[0] = result; + result = _SIGSET_NWORDS; + while (--result > 0) + oset->__val[result] = 0; + } + return 0; +} + +weak_alias (__sigprocmask, sigprocmask); diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sigsuspend.S b/ports/sysdeps/unix/sysv/linux/alpha/sigsuspend.S new file mode 100644 index 000000000..6863c07ec --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sigsuspend.S @@ -0,0 +1,46 @@ +/* Copyright (C) 1993,1995,1996,1997,2002,2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger <davidm@cs.arizona.edu>, 1995. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* sigsuspend is a special syscall since it needs to dereference the + sigset. This will have to change when we have more than 64 signals. */ + +#ifndef NO_CANCELLATION +#include <sysdep.h> + +#undef PSEUDO_PREPARE_ARGS +#define PSEUDO_PREPARE_ARGS ldq a0, 0(a0); + +PSEUDO(__sigsuspend_nocancel, sigsuspend, 1) + ret +/* Use END, not PSEUDO_END, so that we don't issue two $syscall_error + symbols; we'll jump into __sigsuspend for the error case. */ +END(__sigsuspend_nocancel) +#endif /* NO_CANCELLATION */ + +#include <sysdep-cancel.h> + +#undef PSEUDO_PREPARE_ARGS +#define PSEUDO_PREPARE_ARGS ldq a0, 0(a0); + +PSEUDO(__sigsuspend, sigsuspend, 1) + ret +PSEUDO_END(__sigsuspend) +libc_hidden_def (__sigsuspend) +weak_alias (__sigsuspend, sigsuspend) +strong_alias (__sigsuspend, __libc_sigsuspend) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sizes.h b/ports/sysdeps/unix/sysv/linux/alpha/sizes.h new file mode 100644 index 000000000..0c7f4d5d2 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sizes.h @@ -0,0 +1,24 @@ +/* Copyright (C) 1998 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SIZES_H +#define _SIZES_H 1 + +#define PTR_SIZE_STR "8" + +#endif /* sizes.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/swapcontext.S b/ports/sysdeps/unix/sysv/linux/alpha/swapcontext.S new file mode 100644 index 000000000..1221f67f7 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/swapcontext.S @@ -0,0 +1,51 @@ +/* Save current context and install the given one. + Copyright (C) 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include <ucontext-offsets.h> + +ENTRY(__swapcontext) + +#ifdef PROF + ldgp $29, 0($27) + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at + .prologue 1 +#elif defined PIC + .prologue 0 +#else + ldgp $29, 0($27) + .prologue 1 +#endif + +#ifdef PIC + unop + bsr $0, __getcontext_x !samegp + mov $17, $16 + br $31, __setcontext !samegp +#else + jsr $0, __getcontext_x + mov $17, $16 + jmp $31, __setcontext +#endif + +END(__swapcontext) +weak_alias (__swapcontext, swapcontext) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sys/acct.h b/ports/sysdeps/unix/sysv/linux/alpha/sys/acct.h new file mode 100644 index 000000000..1e00006ef --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sys/acct.h @@ -0,0 +1,66 @@ +/* Copyright (C) 1996, 1997, 2000 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_ACCT_H + +#define _SYS_ACCT_H 1 +#include <features.h> + +#define __need_time_t +#include <time.h> + + +__BEGIN_DECLS + +#define ACCT_COMM 16 + +struct acct + { + char ac_comm[ACCT_COMM]; /* Accounting command name. */ + time_t ac_utime; /* Accounting user time. */ + time_t ac_stime; /* Accounting system time. */ + time_t ac_etime; /* Accounting elapsed time. */ + time_t ac_btime; /* Beginning time. */ + unsigned int ac_uid; /* Accounting user ID. */ + unsigned int ac_gid; /* Accounting group ID. */ + unsigned int ac_tty; /* Controlling tty. */ + /* Please note that the value of the `ac_tty' field, a device number, + is encoded differently in the kernel and for the libc dev_t type. */ + char ac_flag; /* Accounting flag. */ + long int ac_minflt; /* Accounting minor pagefaults. */ + long int ac_majflt; /* Accounting major pagefaults. */ + long int ac_exitcode; /* Accounting process exitcode. */ + }; + +enum + { + AFORK = 0001, /* Has executed fork, but no exec. */ + ASU = 0002, /* Used super-user privileges. */ + ACORE = 0004, /* Dumped core. */ + AXSIG = 0010 /* Killed by a signal. */ + }; + +#define AHZ 100 + + +/* Switch process accounting on and off. */ +extern int acct (__const char *__filename) __THROW; + +__END_DECLS + +#endif /* sys/acct.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sys/epoll.h b/ports/sysdeps/unix/sysv/linux/alpha/sys/epoll.h new file mode 100644 index 000000000..9f983a515 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sys/epoll.h @@ -0,0 +1,143 @@ +/* Copyright (C) 2002-2006, 2007, 2008 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_EPOLL_H +#define _SYS_EPOLL_H 1 + +#include <stdint.h> +#include <sys/types.h> + +/* Get __sigset_t. */ +#include <bits/sigset.h> + +#ifndef __sigset_t_defined +# define __sigset_t_defined +typedef __sigset_t sigset_t; +#endif + + +/* Flags to be passed to epoll_create2. */ +enum + { + EPOLL_CLOEXEC = 010000000, +#define EPOLL_CLOEXEC EPOLL_CLOEXEC + EPOLL_NONBLOCK = 04 +#define EPOLL_NONBLOCK EPOLL_NONBLOCK + }; + + +enum EPOLL_EVENTS + { + EPOLLIN = 0x001, +#define EPOLLIN EPOLLIN + EPOLLPRI = 0x002, +#define EPOLLPRI EPOLLPRI + EPOLLOUT = 0x004, +#define EPOLLOUT EPOLLOUT + EPOLLRDNORM = 0x040, +#define EPOLLRDNORM EPOLLRDNORM + EPOLLRDBAND = 0x080, +#define EPOLLRDBAND EPOLLRDBAND + EPOLLWRNORM = 0x100, +#define EPOLLWRNORM EPOLLWRNORM + EPOLLWRBAND = 0x200, +#define EPOLLWRBAND EPOLLWRBAND + EPOLLMSG = 0x400, +#define EPOLLMSG EPOLLMSG + EPOLLERR = 0x008, +#define EPOLLERR EPOLLERR + EPOLLHUP = 0x010, +#define EPOLLHUP EPOLLHUP + EPOLLRDHUP = 0x2000, +#define EPOLLRDHUP EPOLLRDHUP + EPOLLONESHOT = (1 << 30), +#define EPOLLONESHOT EPOLLONESHOT + EPOLLET = (1 << 31) +#define EPOLLET EPOLLET + }; + + +/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */ +#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */ +#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */ +#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */ + + +typedef union epoll_data +{ + void *ptr; + int fd; + uint32_t u32; + uint64_t u64; +} epoll_data_t; + +struct epoll_event +{ + uint32_t events; /* Epoll events */ + epoll_data_t data; /* User data variable */ +}; + + +__BEGIN_DECLS + +/* Creates an epoll instance. Returns an fd for the new instance. + The "size" parameter is a hint specifying the number of file + descriptors to be associated with the new instance. The fd + returned by epoll_create() should be closed with close(). */ +extern int epoll_create (int __size) __THROW; + +/* Same as epoll_create but with an additional FLAGS parameter. */ +extern int epoll_create2 (int __size, int __flags) __THROW; + + +/* Manipulate an epoll instance "epfd". Returns 0 in case of success, + -1 in case of error ( the "errno" variable will contain the + specific error code ) The "op" parameter is one of the EPOLL_CTL_* + constants defined above. The "fd" parameter is the target of the + operation. The "event" parameter describes which events the caller + is interested in and any associated user data. */ +extern int epoll_ctl (int __epfd, int __op, int __fd, + struct epoll_event *__event) __THROW; + + +/* Wait for events on an epoll instance "epfd". Returns the number of + triggered events returned in "events" buffer. Or -1 in case of + error with the "errno" variable set to the specific error code. The + "events" parameter is a buffer that will contain triggered + events. The "maxevents" is the maximum number of events to be + returned ( usually size of "events" ). The "timeout" parameter + specifies the maximum wait time in milliseconds (-1 == infinite). + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int epoll_wait (int __epfd, struct epoll_event *__events, + int __maxevents, int __timeout); + + +/* Same as epoll_wait, but the thread's signal mask is temporarily + and atomically replaced with the one provided as parameter. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int epoll_pwait (int __epfd, struct epoll_event *__events, + int __maxevents, int __timeout, + __const __sigset_t *__ss); + +__END_DECLS + +#endif /* sys/epoll.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sys/eventfd.h b/ports/sysdeps/unix/sysv/linux/alpha/sys/eventfd.h new file mode 100644 index 000000000..c8ce55462 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sys/eventfd.h @@ -0,0 +1,52 @@ +/* Copyright (C) 2007, 2008 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_EVENTFD_H +#define _SYS_EVENTFD_H 1 + +#include <stdint.h> + + +/* Type for event counter. */ +typedef uint64_t eventfd_t; + +/* Flags for signalfd. */ +enum + { + EFD_CLOEXEC = 010000000, +#define EFD_CLOEXEC EFD_CLOEXEC + EFD_NONBLOCK = 04 +#define EFD_NONBLOCK EFD_NONBLOCK + }; + + +__BEGIN_DECLS + +/* Return file descriptor for generic event channel. Set initial + value to COUNT. */ +extern int eventfd (int __count, int __flags) __THROW; + +/* Read event counter and possibly wait for events. */ +extern int eventfd_read (int __fd, eventfd_t *__value); + +/* Increment event counter. */ +extern int eventfd_write (int __fd, eventfd_t value); + +__END_DECLS + +#endif /* sys/eventfd.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sys/inotify.h b/ports/sysdeps/unix/sysv/linux/alpha/sys/inotify.h new file mode 100644 index 000000000..d61c700d5 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sys/inotify.h @@ -0,0 +1,105 @@ +/* Copyright (C) 2005, 2006, 2008 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_INOTIFY_H +#define _SYS_INOTIFY_H 1 + +#include <stdint.h> + + +/* Flags for the parameter of inotify_init1. */ +enum + { + IN_CLOEXEC = 010000000, +#define IN_CLOEXEC IN_CLOEXEC + IN_NONBLOCK = 04 +#define IN_NONBLOCK IN_NONBLOCK + }; + + +/* Structure describing an inotify event. */ +struct inotify_event +{ + int wd; /* Watch descriptor. */ + uint32_t mask; /* Watch mask. */ + uint32_t cookie; /* Cookie to synchronize two events. */ + uint32_t len; /* Length (including NULs) of name. */ + char name __flexarr; /* Name. */ +}; + + +/* Supported events suitable for MASK parameter of INOTIFY_ADD_WATCH. */ +#define IN_ACCESS 0x00000001 /* File was accessed. */ +#define IN_MODIFY 0x00000002 /* File was modified. */ +#define IN_ATTRIB 0x00000004 /* Metadata changed. */ +#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed. */ +#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed. */ +#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */ +#define IN_OPEN 0x00000020 /* File was opened. */ +#define IN_MOVED_FROM 0x00000040 /* File was moved from X. */ +#define IN_MOVED_TO 0x00000080 /* File was moved to Y. */ +#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */ +#define IN_CREATE 0x00000100 /* Subfile was created. */ +#define IN_DELETE 0x00000200 /* Subfile was deleted. */ +#define IN_DELETE_SELF 0x00000400 /* Self was deleted. */ +#define IN_MOVE_SELF 0x00000800 /* Self was moved. */ + +/* Events sent by the kernel. */ +#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted. */ +#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed. */ +#define IN_IGNORED 0x00008000 /* File was ignored. */ + +/* Helper events. */ +#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* Close. */ +#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* Moves. */ + +/* Special flags. */ +#define IN_ONLYDIR 0x01000000 /* Only watch the path if it is a + directory. */ +#define IN_DONT_FOLLOW 0x02000000 /* Do not follow a sym link. */ +#define IN_MASK_ADD 0x20000000 /* Add to the mask of an already + existing watch. */ +#define IN_ISDIR 0x40000000 /* Event occurred against dir. */ +#define IN_ONESHOT 0x80000000 /* Only send event once. */ + +/* All events which a program can wait on. */ +#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE \ + | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM \ + | IN_MOVED_TO | IN_CREATE | IN_DELETE \ + | IN_DELETE_SELF | IN_MOVE_SELF) + + +__BEGIN_DECLS + +/* Create and initialize inotify instance. */ +extern int inotify_init (void) __THROW; + +/* Create and initialize inotify instance. */ +extern int inotify_init1 (int __flags) __THROW; + +/* Add watch of object NAME to inotify instance FD. Notify about + events specified by MASK. */ +extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask) + __THROW; + +/* Remove the watch specified by WD from the inotify instance FD. */ +extern int inotify_rm_watch (int __fd, uint32_t __wd) __THROW; + +__END_DECLS + +#endif /* sys/inotify.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sys/io.h b/ports/sysdeps/unix/sysv/linux/alpha/sys/io.h new file mode 100644 index 000000000..4334c6392 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sys/io.h @@ -0,0 +1,95 @@ +/* Copyright (C) 1996, 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_IO_H + +#define _SYS_IO_H 1 +#include <features.h> + +__BEGIN_DECLS + +/* If TURN_ON is TRUE, request for permission to do direct i/o on the + port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O + permission off for that range. This call requires root privileges. + + Portability note: not all Linux platforms support this call. Most + platforms based on the PC I/O architecture probably will, however. + E.g., Linux/Alpha for Alpha PCs supports this. */ +extern int ioperm (unsigned long int __from, unsigned long int __num, + int __turn_on) __THROW; + +/* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to + access any I/O port is granted. This call requires root + privileges. */ +extern int iopl (int __level) __THROW; + +/* Return the physical address of the DENSE I/O memory or NULL if none + is available (e.g. on a jensen). */ +extern unsigned long int _bus_base (void) __THROW __attribute__ ((const)); +extern unsigned long int bus_base (void) __THROW __attribute__ ((const)); + +/* Return the physical address of the SPARSE I/O memory. */ +extern unsigned long _bus_base_sparse (void) __THROW __attribute__ ((const)); +extern unsigned long bus_base_sparse (void) __THROW __attribute__ ((const)); + +/* Return the HAE shift used by the SPARSE I/O memory. */ +extern int _hae_shift (void) __THROW __attribute__ ((const)); +extern int hae_shift (void) __THROW __attribute__ ((const)); + +/* Previous three are deprecated in favour of the following, which + knows about multiple PCI "hoses". Provide the PCI bus and dfn + numbers just as to pciconfig_read/write. */ + +enum __pciconfig_iobase_which +{ + IOBASE_HOSE = 0, /* Return hose index. */ + IOBASE_SPARSE_MEM = 1, /* Return physical memory addresses. */ + IOBASE_DENSE_MEM = 2, + IOBASE_SPARSE_IO = 3, + IOBASE_DENSE_IO = 4 +}; + +extern long pciconfig_iobase(enum __pciconfig_iobase_which __which, + unsigned long int __bus, + unsigned long int __dfn) + __THROW __attribute__ ((const)); + +/* Access PCI space protected from machine checks. */ +extern int pciconfig_read (unsigned long int __bus, + unsigned long int __dfn, + unsigned long int __off, + unsigned long int __len, + unsigned char *__buf) __THROW; + +extern int pciconfig_write (unsigned long int __bus, + unsigned long int __dfn, + unsigned long int __off, + unsigned long int __len, + unsigned char *__buf) __THROW; + +/* Userspace declarations. */ +extern unsigned int inb (unsigned long __port) __THROW; +extern unsigned int inw (unsigned long __port) __THROW; +extern unsigned int inl (unsigned long __port) __THROW; +extern void outb (unsigned char __b, unsigned long __port) __THROW; +extern void outw (unsigned short __w, unsigned long __port) __THROW; +extern void outl (unsigned int __l, unsigned long __port) __THROW; + +__END_DECLS + +#endif /* _SYS_IO_H */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sys/procfs.h b/ports/sysdeps/unix/sysv/linux/alpha/sys/procfs.h new file mode 100644 index 000000000..bee51f94e --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sys/procfs.h @@ -0,0 +1,115 @@ +/* Copyright (C) 1996, 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_PROCFS_H +#define _SYS_PROCFS_H 1 + +/* This is somehow modelled after the file of the same name on SysVr4 + systems. It provides a definition of the core file format for ELF + used on Linux. */ + +#include <features.h> +#include <signal.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/ucontext.h> +#include <sys/user.h> +#include <asm/elf.h> + +__BEGIN_DECLS + +struct elf_siginfo + { + int si_signo; /* Signal number. */ + int si_code; /* Extra code. */ + int si_errno; /* Errno. */ + }; + +/* Definitions to generate Intel SVR4-like core files. These mostly + have the same names as the SVR4 types with "elf_" tacked on the + front to prevent clashes with linux definitions, and the typedef + forms have been avoided. This is mostly like the SVR4 structure, + but more Linuxy, with things that Linux does not support and which + gdb doesn't really use excluded. Fields present but not used are + marked with "XXX". */ +struct elf_prstatus + { +#if 0 + long int pr_flags; /* XXX Process flags. */ + short int pr_why; /* XXX Reason for process halt. */ + short int pr_what; /* XXX More detailed reason. */ +#endif + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned long int pr_sigpend; /* Set of pending signals. */ + unsigned long int pr_sighold; /* Set of held signals. */ +#if 0 + struct sigaltstack pr_altstack; /* Alternate stack info. */ + struct sigaction pr_action; /* Signal action for current sig. */ +#endif + __pid_t pr_pid; + __pid_t pr_ppid; + __pid_t pr_pgrp; + __pid_t pr_sid; + struct timeval pr_utime; /* User time. */ + struct timeval pr_stime; /* System time. */ + struct timeval pr_cutime; /* Cumulative user time. */ + struct timeval pr_cstime; /* Cumulative system time. */ +#if 0 + long int pr_instr; /* Current instruction. */ +#endif + elf_gregset_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + + +#define ELF_PRARGSZ (80) /* Number of chars for args */ + +struct elf_prpsinfo + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + unsigned long int pr_flag; /* Flags. */ + unsigned int pr_uid; + unsigned int pr_gid; + int pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* Filename of executable. */ + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ + }; + +/* Addresses. */ +typedef void *psaddr_t; + +/* Register sets. Linux has different names. */ +typedef gregset_t prgregset_t; +typedef fpregset_t prfpregset_t; + +/* We don't have any differences between processes and threads, + therefore habe only ine PID type. */ +typedef __pid_t lwpid_t; + + +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; + +__END_DECLS + +#endif /* sys/procfs.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h b/ports/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h new file mode 100644 index 000000000..4cbe97776 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h @@ -0,0 +1,66 @@ +/* Copyright (C) 2007, 2008 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_SIGNALFD_H +#define _SYS_SIGNALFD_H 1 + +#define __need_sigset_t +#include <signal.h> +#include <stdint.h> + + +struct signalfd_siginfo +{ + uint32_t ssi_signo; + int32_t ssi_errno; + int32_t ssi_code; + uint32_t ssi_pid; + uint32_t ssi_uid; + int32_t ssi_fd; + uint32_t ssi_tid; + uint32_t ssi_band; + uint32_t ssi_overrun; + uint32_t ssi_trapno; + int32_t ssi_status; + int32_t ssi_int; + uint64_t ssi_ptr; + uint64_t ssi_utime; + uint64_t ssi_stime; + uint64_t ssi_addr; + uint8_t __pad[48]; +}; + +/* Flags for signalfd. */ +enum + { + SFD_CLOEXEC = 010000000, +#define SFD_CLOEXEC SFD_CLOEXEC + SFD_NONBLOCK = 04 +#define SFD_NONBLOCK SFD_NONBLOCK + }; + +__BEGIN_DECLS + +/* Request notification for delivery of signals in MASK to be + performed using descriptor FD.*/ +extern int signalfd (int __fd, const sigset_t *__mask, int __flags) + __THROW __nonnull ((2)); + +__END_DECLS + +#endif /* sys/signalfd.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h b/ports/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h new file mode 100644 index 000000000..09d6ccf6c --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h @@ -0,0 +1,60 @@ +/* Copyright (C) 2008 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_TIMERFD_H +#define _SYS_TIMERFD_H 1 + +#include <time.h> + + +/* Bits to be set in the FLAGS parameter of `timerfd_create'. */ +enum + { + TFD_CLOEXEC = 010000000, +#define TFD_CLOEXEC TFD_CLOEXEC + TFD_NONBLOCK = 04 +#define TFD_NONBLOCK TFD_NONBLOCK + }; + + +/* Bits to be set in the FLAGS parameter of `timerfd_settime'. */ +enum + { + TFD_TIMER_ABSTIME = 1 << 0 +#define TFD_TIMER_ABSTIME TFD_TIMER_ABSTIME + }; + + +__BEGIN_DECLS + +/* Return file descriptor for new interval timer source. */ +extern int timerfd_create (clockid_t __clock_id, int __flags) __THROW; + +/* Set next expiration time of interval timer source UFD to UTMR. If + FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is + absolute. Optionally return the old expiration time in OTMR. */ +extern int timerfd_settime (int __ufd, int __flags, + __const struct itimerspec *__utmr, + struct itimerspec *__otmr) __THROW; + +/* Return the next expiration time of UFD. */ +extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW; + +__END_DECLS + +#endif /* sys/timerfd.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h b/ports/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h new file mode 100644 index 000000000..438293c62 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h @@ -0,0 +1,61 @@ +/* Copyright (C) 1998, 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include <features.h> +#include <signal.h> + +#include <bits/sigcontext.h> + + +/* Type for general register. */ +typedef long int greg_t; + +/* Number of general registers. */ +#define NGREG 33 + +/* Container for all general registers. */ +typedef greg_t gregset_t[NGREG]; + +/* Type for floating-point register. */ +typedef long int fpreg_t; + +/* Number of general registers. */ +#define NFPREG 32 + +/* Container for all general registers. */ +typedef fpreg_t fpregset_t[NFPREG]; + + +/* A machine context is exactly a sigcontext. */ +typedef struct sigcontext mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext + { + unsigned long int uc_flags; + struct ucontext *uc_link; + unsigned long __uc_osf_sigmask; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; + } ucontext_t; + +#endif /* sys/ucontext.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sys/user.h b/ports/sysdeps/unix/sysv/linux/alpha/sys/user.h new file mode 100644 index 000000000..4cd29d2ff --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sys/user.h @@ -0,0 +1,50 @@ +/* Copyright (C) 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_USER_H +#define _SYS_USER_H 1 + +/* The whole purpose of this file is for gdb/strace and gdb/strace + only. Don't read too much into it. Don't use it for anything other + than gdb/strace unless you know what you are doing. */ + +#include <asm/page.h> +#include <asm/reg.h> + +struct user +{ + unsigned long int regs[EF_SIZE / 8 + 32]; /* integer and fp regs */ + size_t u_tsize; /* text size (pages) */ + size_t u_dsize; /* data size (pages) */ + size_t u_ssize; /* stack size (pages) */ + unsigned long int start_code; /* text starting address */ + unsigned long int start_data; /* data starting address */ + unsigned long int start_stack; /* stack starting address */ + long int signal; /* signal causing core dump */ + struct regs *u_ar0; /* help gdb find registers */ + unsigned long int magic; /* identifies a core file */ + char u_comm[32]; /* user command name */ +}; + +#define NBPG PAGE_SIZE +#define UPAGES 1 +#define HOST_TEXT_START_ADDR (u.start_code) +#define HOST_DATA_START_ADDR (u.start_data) +#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) + +#endif /* sys/user.h */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/syscall.S b/ports/sysdeps/unix/sysv/linux/alpha/syscall.S new file mode 100644 index 000000000..0c4081363 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/syscall.S @@ -0,0 +1,77 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger <davidm@azstarnet.com>, 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> + +/* + * This is for COMPATIBILITY with Linux/x86 only. Linux/Alpha system + * calls return an error indication in a3. This allows arbitrary 64bit + * values to be returned in v0 (because negative values are not + * mistaken as error numbers). However, C allows only one value to + * be returned, so the interface below folds the error indication passed in + * a3 back into v0: it sets v0 to -errno if an error occurs. Thus, + * no negative 64bit numbers can be returned. To avoid this problem, + * use assembly stubs wherever possible/convenient. + * + * Usage: + * + * long syscall(syscall_number, arg1, arg2, arg3, arg4, arg5) + * + * syscall_number = the index of the system call we're invoking + * arg1-arg5 = up to 5 integer arguments to the system call + * + * We need to do some arg shifting: the kernel expects the + * syscall number in v0 and the first five args in a0-a4. + * + */ + + +LEAF(__syscall, 0) +#ifdef PROF + ldgp gp, 0(pv) + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at + .prologue 1 +#else + .prologue 0 +#endif + + mov a0, v0 /* Syscall number -> v0 */ + mov a1, a0 /* arg1-arg5 -> a0-a4 */ + mov a2, a1 + mov a3, a2 + mov a4, a3 + mov a5, a4 + + call_pal PAL_callsys /* Invoke system call */ + bne a3, $error + ret + +$error: +#ifndef PROF + br gp, 2f +2: ldgp gp, 0(gp) +#endif + SYSCALL_ERROR_HANDLER + +END(__syscall) + +weak_alias (__syscall, syscall) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/syscalls.list b/ports/sysdeps/unix/sysv/linux/alpha/syscalls.list new file mode 100644 index 000000000..de2c3ceac --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/syscalls.list @@ -0,0 +1,55 @@ +# File name Caller Syscall name # args Strong name Weak names + +oldmsgctl EXTRA msgctl i:iip __old_msgctl msgctl@GLIBC_2.0 +msgget - msgget i:ii __msgget msgget +msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv +msgsnd - msgsnd Ci:ibni __msgsnd msgsnd +shmat - osf_shmat i:ipi __shmat shmat +oldshmctl EXTRA shmctl i:iip __old_shmctl shmctl@GLIBC_2.0 +shmdt - shmdt i:s __shmdt shmdt +shmget - shmget i:iii __shmget shmget +semop - semop i:ipi __semop semop +semtimedop - semtimedop i:ipip semtimedop +semget - semget i:iii __semget semget +oldsemctl EXTRA semctl i:iiii __old_semctl semctl@GLIBC_2.0 + +sigstack - sigstack 2 sigstack +vfork - vfork 0 __vfork vfork + +getpriority - getpriority i:ii __getpriority getpriority + +# proper socket implementations: +accept - accept Ci:iBN __libc_accept __accept accept +bind - bind i:ipi __bind bind +connect - connect Ci:ipi __libc_connect __connect_internal __connect connect +getpeername - getpeername i:ipp __getpeername getpeername +getsockname - getsockname i:ipp __getsockname getsockname +getsockopt - getsockopt i:iiiBN __getsockopt getsockopt +listen - listen i:ii __listen listen +recv - recv Ci:ibni __libc_recv __recv recv +recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom +recvmsg - recvmsg Ci:ipi __libc_recvmsg __recvmsg recvmsg +send - send Ci:ibni __libc_send __send send +sendmsg - sendmsg Ci:ipi __libc_sendmsg __sendmsg sendmsg +sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto +setsockopt - setsockopt i:iiibn __setsockopt setsockopt +shutdown - shutdown i:ii __shutdown shutdown +socket - socket i:iii __socket socket +socketpair - socketpair i:iiif __socketpair socketpair + +ptrace - ptrace 4 __ptrace ptrace + +# access pci space protected from machine checks: +pciconfig_read EXTRA pciconfig_read 5 pciconfig_read +pciconfig_write EXTRA pciconfig_write 5 pciconfig_write +pciconfig_iobase EXTRA pciconfig_iobase 3 __pciconfig_iobase pciconfig_iobase + +# support old timeval32 entry points +osf_select - osf_select C:5 __select_tv32 __select@GLIBC_2.0 select@GLIBC_2.0 +osf_gettimeofday - osf_gettimeofday 2 __gettimeofday_tv32 __gettimeofday@GLIBC_2.0 gettimeofday@GLIBC_2.0 +osf_settimeofday - osf_settimeofday 2 __settimeofday_tv32 settimeofday@GLIBC_2.0 +osf_getitimer - osf_getitimer 2 __getitimer_tv32 getitimer@GLIBC_2.0 +osf_setitimer - osf_setitimer 3 __setitimer_tv32 setitimer@GLIBC_2.0 +osf_utimes - osf_utimes 2 __utimes_tv32 utimes@GLIBC_2.0 +osf_getrusage - osf_getrusage 2 __getrusage_tv32 getrusage@GLIBC_2.0 +osf_wait4 - osf_wait4 2 __wait4_tv32 wait4@GLIBC_2.0 diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sysconf.c b/ports/sysdeps/unix/sysv/linux/alpha/sysconf.c new file mode 100644 index 000000000..3e5b4ee85 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sysconf.c @@ -0,0 +1,152 @@ +/* Copyright (C) 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <assert.h> +#include <stdbool.h> +#include <stdlib.h> +#include <unistd.h> + + +static long int linux_sysconf (int name); + +#define CSHAPE(totalsize, linesize, assoc) \ + ((totalsize & ~0xff) | (linesize << 4) | assoc) + +extern long __libc_alpha_cache_shape[4]; + +static inline unsigned long +implver (void) +{ + unsigned long i; +#if __GNUC_PREREQ(3,3) + i = __builtin_alpha_implver (); +#else + asm ("implver %0" : "=r" (i)); +#endif + return i; +} + +static inline unsigned long +amask (unsigned long x) +{ + unsigned long r; +#if __GNUC_PREREQ(3,3) + r = __builtin_alpha_amask (x); +#else + asm ("amask %1,%0" : "=r"(r) : "Ir"(x)); +#endif + return r; +} + +/* Get the value of the system variable NAME. */ +long int +__sysconf (int name) +{ + long shape, index; + + /* We only handle the cache information here (for now). */ + if (name < _SC_LEVEL1_ICACHE_SIZE || name > _SC_LEVEL4_CACHE_LINESIZE) + return linux_sysconf (name); + + /* No Alpha has L4 caches. */ + if (name >= _SC_LEVEL4_CACHE_SIZE) + return -1; + + index = (name - _SC_LEVEL1_ICACHE_SIZE) / 3; + shape = __libc_alpha_cache_shape[index]; + if (shape == -2) + { + long shape_l1i, shape_l1d, shape_l2, shape_l3 = -1; + + /* ??? In the cases below for which we do not know L1 cache sizes, + we could do timings to measure sizes. But for the Bcache, it's + generally big enough that (without additional help) TLB effects + get in the way. We'd either need to be able to allocate large + pages or have the kernel do the timings from KSEG. Fortunately, + kernels beginning with 2.6.5 will pass us this info in auxvec. */ + + switch (implver()) + { + case 0: /* EV4 */ + /* EV4/LCA45 had 8k L1 caches; EV45 had 16k L1 caches. */ + /* EV4/EV45 had 128k to 16M 32-byte direct Bcache. LCA45 + had 64k to 8M 8-byte direct Bcache. Can't tell. */ + shape_l1i = shape_l1d = shape_l2 = CSHAPE (0, 5, 1); + break; + + case 1: /* EV5 */ + if (amask (1 << 8)) + { + /* MAX insns not present; either EV5 or EV56. */ + shape_l1i = shape_l1d = CSHAPE(8*1024, 5, 1); + /* ??? L2 and L3 *can* be configured as 32-byte line. */ + shape_l2 = CSHAPE (96*1024, 6, 3); + /* EV5/EV56 has 1M to 16M Bcache. */ + shape_l3 = CSHAPE (0, 6, 1); + } + else + { + /* MAX insns present; either PCA56 or PCA57. */ + /* PCA56 had 16k 64-byte cache; PCA57 had 32k Icache. */ + /* PCA56 had 8k 64-byte cache; PCA57 had 16k Dcache. */ + /* PCA5[67] had 512k to 4M Bcache. */ + shape_l1i = shape_l1d = shape_l2 = CSHAPE (0, 6, 1); + } + break; + + case 2: /* EV6 */ + shape_l1i = shape_l1d = CSHAPE(64*1024, 6, 2); + /* EV6/EV67/EV68* had 1M to 16M Bcache. */ + shape_l2 = CSHAPE (0, 6, 1); + break; + + case 3: /* EV7 */ + shape_l1i = shape_l1d = CSHAPE(64*1024, 6, 2); + shape_l2 = CSHAPE(7*1024*1024/4, 6, 7); + break; + + default: + shape_l1i = shape_l1d = shape_l2 = 0; + break; + } + + __libc_alpha_cache_shape[0] = shape_l1i; + __libc_alpha_cache_shape[1] = shape_l1d; + __libc_alpha_cache_shape[2] = shape_l2; + __libc_alpha_cache_shape[3] = shape_l3; + shape = __libc_alpha_cache_shape[index]; + } + + if (shape <= 0) + return shape; + + switch (name % 3) + { + case 0: /* total size */ + return shape & -0x100; + case 1: /* associativity */ + return shape & 0xf; + default: /* line size */ + return 1L << ((shape >> 4) & 0xf); + } +} + +/* Now the generic Linux version. */ +#undef __sysconf +#define __sysconf static linux_sysconf +#include "../sysconf.c" diff --git a/ports/sysdeps/unix/sysv/linux/alpha/sysdep.h b/ports/sysdeps/unix/sysv/linux/alpha/sysdep.h new file mode 100644 index 000000000..f0661d162 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/sysdep.h @@ -0,0 +1,101 @@ +/* Copyright (C) 1992, 1993, 1995, 1996, 1997, 2002, 2003, 2004, 2007 + 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _LINUX_ALPHA_SYSDEP_H +#define _LINUX_ALPHA_SYSDEP_H 1 + +#ifdef __ASSEMBLER__ +#include <asm/pal.h> +#include <alpha/regdef.h> +#endif + +/* There is some commonality. */ +#include <sysdeps/unix/alpha/sysdep.h> + +#include <tls.h> + +/* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h + of the kernel. But these symbols do not follow the SYS_* syntax + so we have to redefine the `SYS_ify' macro here. */ +#undef SYS_ify +#ifdef __STDC__ +# define SYS_ify(syscall_name) __NR_##syscall_name +#else +# define SYS_ify(syscall_name) __NR_/**/syscall_name +#endif + +/* Define some aliases to make automatic syscall generation work + properly. The SYS_* variants are for the benefit of the files in + sysdeps/unix. */ +#define __NR_getpid __NR_getxpid +#define __NR_getuid __NR_getxuid +#define __NR_getgid __NR_getxgid +#define SYS_getpid __NR_getxpid +#define SYS_getuid __NR_getxuid +#define SYS_getgid __NR_getxgid + +/* + * Some syscalls no Linux program should know about: + */ +#define __NR_osf_sigprocmask 48 +#define __NR_osf_shmat 209 +#define __NR_osf_getsysinfo 256 +#define __NR_osf_setsysinfo 257 + +/* Help old kernel headers where particular syscalls are not available. */ +#ifndef __NR_semtimedop +# define __NR_semtimedop 423 +#endif + +/* This is a kludge to make syscalls.list find these under the names + pread and pwrite, since some kernel headers define those names + and some define the *64 names for the same system calls. */ +#if !defined __NR_pread && defined __NR_pread64 +# define __NR_pread __NR_pread64 +#endif +#if !defined __NR_pwrite && defined __NR_pwrite64 +# define __NR_pwrite __NR_pwrite64 +#endif + +/* + * In order to get the hidden arguments for rt_sigaction set up + * properly, we need to call the assembly version. This shouldn't + * happen except for inside sigaction.c, where we handle this + * specially. Catch other uses and error. + */ + +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ +({ \ + extern char ChEcK[__NR_##name == __NR_rt_sigaction ? -1 : 1] \ + __attribute__((unused)); \ + INLINE_SYSCALL1(name, nr, args); \ +}) + +#undef INTERNAL_SYSCALL +#define INTERNAL_SYSCALL(name, err_out, nr, args...) \ +({ \ + extern char ChEcK[__NR_##name == __NR_rt_sigaction ? -1 : 1] \ + __attribute__((unused)); \ + INTERNAL_SYSCALL1(name, err_out, nr, args); \ +}) + +#endif /* _LINUX_ALPHA_SYSDEP_H */ diff --git a/ports/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym b/ports/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym new file mode 100644 index 000000000..f95ff7563 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym @@ -0,0 +1,18 @@ +#include <stddef.h> +#include <sys/ucontext.h> + +-- +UC_LINK offsetof (ucontext_t, uc_link) +UC_OSF_SIGMASK offsetof (ucontext_t, __uc_osf_sigmask) +UC_STACK offsetof (ucontext_t, uc_stack) +UC_SIGCTX offsetof (ucontext_t, uc_mcontext) +UC_SIGMASK offsetof (ucontext_t, uc_sigmask) +SC_REGS offsetof (struct sigcontext, sc_regs) +SC_FPREGS offsetof (struct sigcontext, sc_fpregs) +SC_PC offsetof (struct sigcontext, sc_pc) +SC_PS offsetof (struct sigcontext, sc_ps) +SC_FPCRS offsetof (struct sigcontext, sc_fpcr) +SC_MASK offsetof (struct sigcontext, sc_mask) +SC_FPCR offsetof (struct sigcontext, sc_fpcr) +SS_SP offsetof (stack_t, ss_sp) +SS_SIZE offsetof (stack_t, ss_size) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/utimes.S b/ports/sysdeps/unix/sysv/linux/alpha/utimes.S new file mode 100644 index 000000000..0dd0a9372 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/utimes.S @@ -0,0 +1,123 @@ +/* Copyright (C) 1998, 2003, 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#define _ERRNO_H 1 +#include <bits/errno.h> +#include <kernel-features.h> + +.text + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +#define UTIMES __utimes_tv64 +#else +#define UTIMES __utimes +#endif + +#if defined __ASSUME_TIMEVAL64 +PSEUDO(UTIMES, utimes, 2) + ret +PSEUDO_END(UTIMES) +#else +/* The problem here is that initially we made struct timeval compatible with + OSF/1, using int32. But we defined time_t with uint64, and later found + that POSIX requires tv_sec to be time_t. + + So now we have to do compatibility stuff. */ + +/* The variable is shared between all wrappers around signal handling + functions which have RT equivalents. */ +.comm __libc_missing_axp_tv64, 4 + +LEAF(UTIMES, 16) + ldgp gp, 0(pv) + subq sp, 16, sp +#ifdef PROF + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at +#endif + .prologue 1 + + ldl t0, __libc_missing_axp_tv64 + + /* Save arguments in case we do need to fall back. */ + stq a0, 0(sp) + stq a1, 8(sp) + + bne t0, $do32 + + ldi v0, SYS_ify(utimes) + callsys + bne a3, $err64 + + /* Everything ok. */ + addq sp, 16, sp + ret + + /* If we didn't get ENOSYS, it is a real error. */ + .align 3 +$err64: cmpeq v0, ENOSYS, t0 + beq t0, $error + stl t0, __libc_missing_axp_tv64 + + /* Recover the saved arguments. */ + ldq a1, 8(sp) + ldq a0, 0(sp) + + .align 3 +$do32: + /* Conditionally bounce values down. */ + beq a1, 1f + ldq t0, 0(a1) + ldq t1, 8(a1) + ldq t2, 16(a1) + ldq t3, 24(a1) + stl t0, 0(sp) + stl t1, 4(sp) + stl t2, 8(sp) + stl t3, 12(sp) + mov sp, a1 + +1: ldi v0, SYS_ify(osf_utimes) + callsys + bne a3, $error + + addq sp, 16, sp + ret + + .align 3 +$error: + addq sp, 16, sp + SYSCALL_ERROR_HANDLER + +END(UTIMES) +#endif /* __ASSUME_TIMEVAL64 */ + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +default_symbol_version (__utimes_tv64, __utimes, GLIBC_2.1) + +/* It seems to me to be a misfeature of the assembler that we can only + have one version-alias per symbol. So create an alias ourselves. + The 'p' is for 'public'. *Shrug* */ +strong_alias (__utimes_tv64, __utimes_tv64p) +default_symbol_version (__utimes_tv64p, utimes, GLIBC_2.1) +#else +weak_alias (__utimes, utimes) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/wait4.S b/ports/sysdeps/unix/sysv/linux/alpha/wait4.S new file mode 100644 index 000000000..634993deb --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/wait4.S @@ -0,0 +1,156 @@ +/* Copyright (C) 1998, 2003, 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#define _ERRNO_H 1 +#include <bits/errno.h> +#include <kernel-features.h> + +.text + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +#define WAIT4 __wait4_tv64 +#else +#define WAIT4 __wait4 +#endif + +#if defined __ASSUME_TIMEVAL64 +PSEUDO(WAIT4, wait4, 4) + ret +PSEUDO_END(WAIT4) +#else +/* The problem here is that initially we made struct timeval compatible with + OSF/1, using int32. But we defined time_t with uint64, and later found + that POSIX requires tv_sec to be time_t. + + So now we have to do compatibility stuff. */ + +/* The variable is shared between all wrappers around signal handling + functions which have RT equivalents. */ +.comm __libc_missing_axp_tv64, 4 + +LEAF(WAIT4, 32) + ldgp gp, 0(pv) + subq sp, 32, sp +#ifdef PROF + .set noat + lda AT, _mcount + jsr AT, (AT), _mcount + .set at +#endif + .prologue 1 + + ldl t0, __libc_missing_axp_tv64 + + /* Save arguments in case we do need to fall back. */ + stq a0, 0(sp) + stq a1, 8(sp) + stq a2, 16(sp) + stq a3, 24(sp) + + bne t0, $do32 + + ldi v0, SYS_ify(wait4) + callsys + bne a3, $err64 + + /* Everything ok. */ + addq sp, 32, sp + ret + + /* If we didn't get ENOSYS, it is a real error. */ + .align 3 +$err64: cmpeq v0, ENOSYS, t0 + beq t0, $error + stl t0, __libc_missing_axp_tv64 + + /* Recover the saved arguments. */ + ldq a3, 24(sp) + ldq a2, 16(sp) + ldq a1, 8(sp) + ldq a0, 0(sp) + + .align 3 +$do32: ldi v0, SYS_ify(osf_wait4) + callsys + bne a3, $error + + /* Copy back to proper format. */ + ldq a3, 24(sp) + beq a3, 2f + ldl t0, 0(a3) # ru_utime.tv_sec + ldl t1, 4(a3) # ru_utime.tv_usec + ldl t2, 8(a3) # ru_stime.tv_sec + ldl t3, 12(a3) # ru_stime.tv_usec + ldt $f15, 16(a3) # ru_maxrss + ldt $f16, 24(a3) # ru_ixrss + ldt $f17, 32(a3) # ru_idrss + ldt $f18, 40(a3) # ru_isrss + ldt $f19, 48(a3) # ru_minflt + ldt $f20, 56(a3) # ru_majflt + ldt $f21, 64(a3) # ru_nswap + ldt $f22, 72(a3) # ru_inblock + ldt $f23, 80(a3) # ru_oublock + ldt $f24, 88(a3) # ru_msgsend + ldt $f25, 96(a3) # ru_msgrcv + ldt $f26, 104(a3) # ru_nsignals + ldt $f27, 112(a3) # ru_nvcsw + .set noat + ldt $f28, 120(a3) # ru_nivcsw + stq t0, 0(a3) + stq t1, 8(a3) + stq t2, 16(a3) + stq t3, 24(a3) + stt $f15, 32(a3) + stt $f16, 40(a3) + stt $f17, 48(a3) + stt $f18, 56(a3) + stt $f19, 64(a3) + stt $f20, 72(a3) + stt $f21, 80(a3) + stt $f22, 88(a3) + stt $f23, 96(a3) + stt $f24, 104(a3) + stt $f25, 112(a3) + stt $f26, 120(a3) + stt $f27, 128(a3) + stt $f28, 136(a3) + .set at + +2: addq sp, 32, sp + ret + + .align 3 +$error: + addq sp, 32, sp + SYSCALL_ERROR_HANDLER + +END(WAIT4) +#endif /* __ASSUME_TIMEVAL64 */ + +#if defined HAVE_ELF && defined PIC && defined DO_VERSIONING +default_symbol_version (__wait4_tv64, __wait4, GLIBC_2.1) + +/* It seems to me to be a misfeature of the assembler that we can only + have one version-alias per symbol. So create an alias ourselves. + The 'p' is for 'public'. *Shrug* */ +strong_alias (__wait4_tv64, __wait4_tv64p) +default_symbol_version (__wait4_tv64p, wait4, GLIBC_2.1) +#else +weak_alias (__wait4, wait4) +#endif diff --git a/ports/sysdeps/unix/sysv/linux/alpha/wordexp.c b/ports/sysdeps/unix/sysv/linux/alpha/wordexp.c new file mode 100644 index 000000000..075b267bb --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/wordexp.c @@ -0,0 +1 @@ +#include <sysdeps/unix/sysv/linux/ia64/wordexp.c> diff --git a/ports/sysdeps/unix/sysv/linux/alpha/xstat.c b/ports/sysdeps/unix/sysv/linux/alpha/xstat.c new file mode 100644 index 000000000..b7488e425 --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/xstat.c @@ -0,0 +1,64 @@ +/* xstat using old-style Unix stat system call. + Copyright (C) 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define __xstat64 __xstat64_disable + +#include <errno.h> +#include <stddef.h> +#include <sys/stat.h> +#include <kernel_stat.h> +#include <sysdep.h> +#include <sys/syscall.h> +#include <xstatconv.h> + +#undef __xstat64 + + +/* Get information about the file NAME in BUF. */ +int +__xstat (int vers, const char *name, struct stat *buf) +{ + INTERNAL_SYSCALL_DECL (err); + int result, errno_out; + struct kernel_stat kbuf; + + if (vers == _STAT_VER_KERNEL64 && !__libc_missing_axp_stat64) + { + result = INTERNAL_SYSCALL (stat64, err, 2, name, buf); + if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + return result; + errno_out = INTERNAL_SYSCALL_ERRNO (result, err); + if (errno_out != ENOSYS) + goto fail; + __libc_missing_axp_stat64 = 1; + } + + result = INTERNAL_SYSCALL (stat, err, 2, name, &kbuf); + if (__builtin_expect (!INTERNAL_SYSCALL_ERROR_P (result, err), 1)) + return __xstat_conv (vers, &kbuf, buf); + errno_out = INTERNAL_SYSCALL_ERRNO (result, err); + + fail: + __set_errno (errno_out); + return -1; +} +hidden_def (__xstat) +weak_alias (__xstat, _xstat); +strong_alias (__xstat, __xstat64); +hidden_ver (__xstat, __xstat64) diff --git a/ports/sysdeps/unix/sysv/linux/alpha/xstatconv.c b/ports/sysdeps/unix/sysv/linux/alpha/xstatconv.c new file mode 100644 index 000000000..a193b62ad --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/xstatconv.c @@ -0,0 +1,123 @@ +/* Convert between the kernel's `struct stat' format, and libc's. + Copyright (C) 1997, 2003, 2004 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <string.h> +#include <sys/stat.h> +#include <kernel_stat.h> +#include <xstatconv.h> + + +int __libc_missing_axp_stat64; + +int +__xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf) +{ + switch (vers) + { + case _STAT_VER_KERNEL: + *(struct kernel_stat *) ubuf = *kbuf; + break; + + case _STAT_VER_GLIBC2: + { + struct glibc2_stat *buf = ubuf; + + buf->st_dev = kbuf->st_dev; + buf->st_ino = kbuf->st_ino; + buf->st_mode = kbuf->st_mode; + buf->st_nlink = kbuf->st_nlink; + buf->st_uid = kbuf->st_uid; + buf->st_gid = kbuf->st_gid; + buf->st_rdev = kbuf->st_rdev; + buf->st_size = kbuf->st_size; + buf->st_atime = kbuf->st_atime; + buf->st_mtime = kbuf->st_mtime; + buf->st_ctime = kbuf->st_ctime; + buf->st_blksize = kbuf->st_blksize; + buf->st_blocks = kbuf->st_blocks; + buf->st_flags = kbuf->st_flags; + buf->st_gen = kbuf->st_gen; + } + break; + + case _STAT_VER_GLIBC2_1: + { + struct glibc21_stat *buf = ubuf; + + buf->st_dev = kbuf->st_dev; + buf->st_ino = kbuf->st_ino; + buf->st_mode = kbuf->st_mode; + buf->st_nlink = kbuf->st_nlink; + buf->st_uid = kbuf->st_uid; + buf->st_gid = kbuf->st_gid; + buf->st_rdev = kbuf->st_rdev; + buf->st_size = kbuf->st_size; + buf->st_atime = kbuf->st_atime; + buf->st_mtime = kbuf->st_mtime; + buf->st_ctime = kbuf->st_ctime; + buf->st_blocks = kbuf->st_blocks; + buf->st_blksize = kbuf->st_blksize; + buf->st_flags = kbuf->st_flags; + buf->st_gen = kbuf->st_gen; + buf->__pad3 = 0; + buf->__unused[0] = 0; + buf->__unused[1] = 0; + buf->__unused[2] = 0; + buf->__unused[3] = 0; + } + break; + + case _STAT_VER_GLIBC2_3_4: + { + struct stat64 *buf = ubuf; + + buf->st_dev = kbuf->st_dev; + buf->st_ino = kbuf->st_ino; + buf->st_rdev = kbuf->st_rdev; + buf->st_size = kbuf->st_size; + buf->st_blocks = kbuf->st_blocks; + + buf->st_mode = kbuf->st_mode; + buf->st_uid = kbuf->st_uid; + buf->st_gid = kbuf->st_gid; + buf->st_blksize = kbuf->st_blksize; + buf->st_nlink = kbuf->st_nlink; + buf->__pad0 = 0; + + buf->st_atime = kbuf->st_atime; + buf->st_atimensec = 0; + buf->st_mtime = kbuf->st_mtime; + buf->st_mtimensec = 0; + buf->st_ctime = kbuf->st_ctime; + buf->st_ctimensec = 0; + + buf->__unused[0] = 0; + buf->__unused[1] = 0; + buf->__unused[2] = 0; + } + break; + + default: + __set_errno (EINVAL); + return -1; + } + + return 0; +} diff --git a/ports/sysdeps/unix/sysv/linux/alpha/xstatconv.h b/ports/sysdeps/unix/sysv/linux/alpha/xstatconv.h new file mode 100644 index 000000000..094d11e5c --- /dev/null +++ b/ports/sysdeps/unix/sysv/linux/alpha/xstatconv.h @@ -0,0 +1,24 @@ +/* Convert between the kernel's `struct stat' format, and libc's. + Copyright (C) 2004, 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <kernel-features.h> + +extern int __libc_missing_axp_stat64 attribute_hidden; +extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf) + attribute_hidden; diff --git a/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h b/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h index 889f97c0f..7a054620d 100644 --- a/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h +++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h @@ -35,6 +35,8 @@ #define FUTEX_LOCK_PI 6 #define FUTEX_UNLOCK_PI 7 #define FUTEX_TRYLOCK_PI 8 +#define FUTEX_WAIT_BITSET 9 +#define FUTEX_WAKE_BITSET 10 #define FUTEX_PRIVATE_FLAG 128 /* Values for 'private' parameter of locking macros. Yes, the diff --git a/ports/sysdeps/unix/sysv/linux/mips/bits/socket.h b/ports/sysdeps/unix/sysv/linux/mips/bits/socket.h index 4f219d5af..dad2c2d09 100644 --- a/ports/sysdeps/unix/sysv/linux/mips/bits/socket.h +++ b/ports/sysdeps/unix/sysv/linux/mips/bits/socket.h @@ -303,7 +303,7 @@ enum { SCM_RIGHTS = 0x01 /* Transfer file descriptors. */ #define SCM_RIGHTS SCM_RIGHTS -#ifdef __USE_BSD +#ifdef __USE_GNU , SCM_CREDENTIALS = 0x02 /* Credentials passing. */ # define SCM_CREDENTIALS SCM_CREDENTIALS #endif diff --git a/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h b/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h index 1cb3d9b7c..eae3f40f7 100644 --- a/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h +++ b/ports/sysdeps/unix/sysv/linux/mips/nptl/lowlevellock.h @@ -35,6 +35,8 @@ #define FUTEX_LOCK_PI 6 #define FUTEX_UNLOCK_PI 7 #define FUTEX_TRYLOCK_PI 8 +#define FUTEX_WAIT_BITSET 9 +#define FUTEX_WAKE_BITSET 10 #define FUTEX_PRIVATE_FLAG 128 /* Values for 'private' parameter of locking macros. Yes, the diff --git a/ports/sysdeps/unix/sysv/linux/mips/sys/signalfd.h b/ports/sysdeps/unix/sysv/linux/mips/sys/signalfd.h index 2fe7e379d..08923c086 100644 --- a/ports/sysdeps/unix/sysv/linux/mips/sys/signalfd.h +++ b/ports/sysdeps/unix/sysv/linux/mips/sys/signalfd.h @@ -59,7 +59,7 @@ __BEGIN_DECLS /* Request notification for delivery of signals in MASK to be performed using descriptor FD.*/ extern int signalfd (int __fd, const sigset_t *__mask, int __flags) - __nonnull ((2)) __THROW; + __THROW __nonnull ((2)); __END_DECLS |