From e69e2ce0e9ed2962c6e0fed8ed1d6d291d0a2b4f Mon Sep 17 00:00:00 2001 From: swcompiler Date: Fri, 29 Nov 2024 14:09:04 +0800 Subject: [PATCH 08/23] Sw64: Linux ABI --- sysdeps/unix/sysv/linux/sw_64/a.out.h | 197 ++++ sysdeps/unix/sysv/linux/sw_64/adjtime.c | 22 + sysdeps/unix/sysv/linux/sw_64/adjtimex.c | 22 + sysdeps/unix/sysv/linux/sw_64/aio_cancel.c | 35 + sysdeps/unix/sysv/linux/sw_64/bits/a.out.h | 9 + sysdeps/unix/sysv/linux/sw_64/bits/dirent.h | 57 ++ sysdeps/unix/sysv/linux/sw_64/bits/elfclass.h | 14 + sysdeps/unix/sysv/linux/sw_64/bits/epoll.h | 27 + sysdeps/unix/sysv/linux/sw_64/bits/errno.h | 53 ++ sysdeps/unix/sysv/linux/sw_64/bits/eventfd.h | 32 + sysdeps/unix/sysv/linux/sw_64/bits/fcntl.h | 87 ++ sysdeps/unix/sysv/linux/sw_64/bits/inotify.h | 30 + sysdeps/unix/sysv/linux/sw_64/bits/ioctls.h | 36 + sysdeps/unix/sysv/linux/sw_64/bits/mman.h | 67 ++ sysdeps/unix/sysv/linux/sw_64/bits/netdb.h | 33 + .../sysv/linux/sw_64/bits/procfs-prregset.h | 26 + sysdeps/unix/sysv/linux/sw_64/bits/procfs.h | 38 + .../sysv/linux/sw_64/bits/pthread_stack_min.h | 20 + sysdeps/unix/sysv/linux/sw_64/bits/resource.h | 223 +++++ .../unix/sysv/linux/sw_64/bits/sigaction.h | 82 ++ sysdeps/unix/sysv/linux/sw_64/bits/signalfd.h | 30 + .../unix/sysv/linux/sw_64/bits/signum-arch.h | 67 ++ sysdeps/unix/sysv/linux/sw_64/bits/sigstack.h | 32 + .../sysv/linux/sw_64/bits/socket-constants.h | 51 ++ .../unix/sysv/linux/sw_64/bits/socket_type.h | 56 ++ sysdeps/unix/sysv/linux/sw_64/bits/statfs.h | 64 ++ .../unix/sysv/linux/sw_64/bits/struct_stat.h | 119 +++ .../unix/sysv/linux/sw_64/bits/termios-baud.h | 47 + .../unix/sysv/linux/sw_64/bits/termios-c_cc.h | 41 + .../sysv/linux/sw_64/bits/termios-c_cflag.h | 39 + .../sysv/linux/sw_64/bits/termios-c_iflag.h | 39 + .../sysv/linux/sw_64/bits/termios-c_lflag.h | 43 + .../sysv/linux/sw_64/bits/termios-c_oflag.h | 67 ++ .../sysv/linux/sw_64/bits/termios-struct.h | 38 + sysdeps/unix/sysv/linux/sw_64/bits/timerfd.h | 30 + .../unix/sysv/linux/sw_64/bits/typesizes.h | 87 ++ sysdeps/unix/sysv/linux/sw_64/bits/wordsize.h | 19 + sysdeps/unix/sysv/linux/sw_64/brk_call.h | 27 + sysdeps/unix/sysv/linux/sw_64/dl-auxv.h | 40 + sysdeps/unix/sysv/linux/sw_64/dl-support.c | 2 + sysdeps/unix/sysv/linux/sw_64/dl-sysdep.c | 5 + .../unix/sysv/linux/sw_64/errlist-compat.c | 43 + sysdeps/unix/sysv/linux/sw_64/fraiseexcpt.S | 58 ++ sysdeps/unix/sysv/linux/sw_64/fstatfs.c | 29 + sysdeps/unix/sysv/linux/sw_64/fxstat64.c | 45 + sysdeps/unix/sysv/linux/sw_64/fxstatat64.c | 32 + sysdeps/unix/sysv/linux/sw_64/getclktck.c | 2 + sysdeps/unix/sysv/linux/sw_64/getcontext.S | 440 +++++++++ sysdeps/unix/sysv/linux/sw_64/getdents.c | 18 + sysdeps/unix/sysv/linux/sw_64/getdents64.c | 10 + sysdeps/unix/sysv/linux/sw_64/getegid.S | 26 + sysdeps/unix/sysv/linux/sw_64/geteuid.S | 26 + sysdeps/unix/sysv/linux/sw_64/gethostname.c | 45 + sysdeps/unix/sysv/linux/sw_64/getppid.S | 26 + sysdeps/unix/sysv/linux/sw_64/getrlimit64.c | 54 ++ sysdeps/unix/sysv/linux/sw_64/gettimeofday.c | 26 + .../unix/sysv/linux/sw_64/glob-lstat-compat.c | 2 + sysdeps/unix/sysv/linux/sw_64/globfree.c | 36 + .../sysv/linux/sw_64/ieee_get_fp_control.S | 50 + .../sysv/linux/sw_64/ieee_set_fp_control.S | 46 + sysdeps/unix/sysv/linux/sw_64/ioperm.c | 853 ++++++++++++++++++ sysdeps/unix/sysv/linux/sw_64/ipc_priv.h | 21 + .../unix/sysv/linux/sw_64/jmp_buf-macros.h | 6 + .../unix/sysv/linux/sw_64/kernel-features.h | 53 ++ .../sysv/linux/sw_64/kernel_rt_sigframe.h | 25 + .../unix/sysv/linux/sw_64/kernel_sigaction.h | 10 + sysdeps/unix/sysv/linux/sw_64/kernel_stat.h | 91 ++ .../unix/sysv/linux/sw_64/kernel_sysinfo.h | 6 + .../unix/sysv/linux/sw_64/kernel_termios.h | 43 + sysdeps/unix/sysv/linux/sw_64/librt-compat.c | 24 + sysdeps/unix/sysv/linux/sw_64/localplt.data | 33 + sysdeps/unix/sysv/linux/sw_64/lxstat64.c | 46 + sysdeps/unix/sysv/linux/sw_64/makecontext.S | 164 ++++ sysdeps/unix/sysv/linux/sw_64/nldbl-abi.h | 8 + sysdeps/unix/sysv/linux/sw_64/oldglob.c | 96 ++ sysdeps/unix/sysv/linux/sw_64/osf_adjtime.c | 139 +++ sysdeps/unix/sysv/linux/sw_64/osf_getitimer.c | 42 + sysdeps/unix/sysv/linux/sw_64/osf_getrusage.c | 39 + .../unix/sysv/linux/sw_64/osf_gettimeofday.c | 47 + sysdeps/unix/sysv/linux/sw_64/osf_setitimer.c | 51 ++ .../unix/sysv/linux/sw_64/osf_settimeofday.c | 48 + sysdeps/unix/sysv/linux/sw_64/osf_utimes.c | 36 + sysdeps/unix/sysv/linux/sw_64/osf_wait4.c | 40 + sysdeps/unix/sysv/linux/sw_64/pipe.S | 1 + sysdeps/unix/sysv/linux/sw_64/pointer_guard.h | 57 ++ sysdeps/unix/sysv/linux/sw_64/register-dump.h | 239 +++++ sysdeps/unix/sysv/linux/sw_64/rt_sigaction.S | 87 ++ sysdeps/unix/sysv/linux/sw_64/select.c | 52 ++ sysdeps/unix/sysv/linux/sw_64/setcontext.S | 34 + sysdeps/unix/sysv/linux/sw_64/setfpucw.c | 56 ++ sysdeps/unix/sysv/linux/sw_64/setrlimit64.c | 52 ++ sysdeps/unix/sysv/linux/sw_64/settimeofday.c | 22 + sysdeps/unix/sysv/linux/sw_64/shlib-versions | 20 + .../unix/sysv/linux/sw_64/sigcontextinfo.h | 30 + sysdeps/unix/sysv/linux/sw_64/sizes.h | 23 + sysdeps/unix/sysv/linux/sw_64/statfs.c | 29 + sysdeps/unix/sysv/linux/sw_64/sw_64/ptrace.h | 18 + sysdeps/unix/sysv/linux/sw_64/sw_64/regdef.h | 44 + sysdeps/unix/sysv/linux/sw_64/swapcontext.S | 50 + sysdeps/unix/sysv/linux/sw_64/sys/acct.h | 62 ++ sysdeps/unix/sysv/linux/sw_64/sys/io.h | 90 ++ sysdeps/unix/sysv/linux/sw_64/sys/ucontext.h | 92 ++ sysdeps/unix/sysv/linux/sw_64/sys/user.h | 52 ++ sysdeps/unix/sysv/linux/sw_64/syscalls.list | 27 + sysdeps/unix/sysv/linux/sw_64/sysconf.c | 126 +++ .../sysv/linux/sw_64/timer_t_was_int_compat.h | 19 + .../sysv/linux/sw_64/ucontext-offsets.sym | 28 + sysdeps/unix/sysv/linux/sw_64/wait4.c | 28 + sysdeps/unix/sysv/linux/sw_64/wordexp.c | 1 + sysdeps/unix/sysv/linux/sw_64/xstat64.c | 46 + sysdeps/unix/sysv/linux/sw_64/xstatconv.c | 120 +++ sysdeps/unix/sysv/linux/sw_64/xstatconv.h | 22 + sysdeps/unix/sysv/linux/sw_64/xstatver.h | 14 + 113 files changed, 6529 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/sw_64/a.out.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/adjtime.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/adjtimex.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/aio_cancel.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/a.out.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/dirent.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/elfclass.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/epoll.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/errno.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/eventfd.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/fcntl.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/inotify.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/ioctls.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/mman.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/netdb.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/procfs-prregset.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/procfs.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/pthread_stack_min.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/resource.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/sigaction.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/signalfd.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/signum-arch.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/sigstack.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/socket-constants.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/socket_type.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/statfs.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/struct_stat.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/termios-baud.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/termios-c_cc.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/termios-c_cflag.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/termios-c_iflag.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/termios-c_lflag.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/termios-c_oflag.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/termios-struct.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/timerfd.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/typesizes.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/bits/wordsize.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/brk_call.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/dl-auxv.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/dl-support.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/dl-sysdep.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/errlist-compat.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/fraiseexcpt.S create mode 100644 sysdeps/unix/sysv/linux/sw_64/fstatfs.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/fxstat64.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/fxstatat64.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/getclktck.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/getcontext.S create mode 100644 sysdeps/unix/sysv/linux/sw_64/getdents.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/getdents64.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/getegid.S create mode 100644 sysdeps/unix/sysv/linux/sw_64/geteuid.S create mode 100644 sysdeps/unix/sysv/linux/sw_64/gethostname.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/getppid.S create mode 100644 sysdeps/unix/sysv/linux/sw_64/getrlimit64.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/gettimeofday.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/glob-lstat-compat.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/globfree.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/ieee_get_fp_control.S create mode 100644 sysdeps/unix/sysv/linux/sw_64/ieee_set_fp_control.S create mode 100644 sysdeps/unix/sysv/linux/sw_64/ioperm.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/ipc_priv.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/jmp_buf-macros.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/kernel-features.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/kernel_rt_sigframe.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/kernel_sigaction.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/kernel_stat.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/kernel_sysinfo.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/kernel_termios.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/librt-compat.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/localplt.data create mode 100644 sysdeps/unix/sysv/linux/sw_64/lxstat64.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/makecontext.S create mode 100644 sysdeps/unix/sysv/linux/sw_64/nldbl-abi.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/oldglob.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/osf_adjtime.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/osf_getitimer.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/osf_getrusage.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/osf_gettimeofday.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/osf_setitimer.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/osf_settimeofday.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/osf_utimes.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/osf_wait4.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/pipe.S create mode 100644 sysdeps/unix/sysv/linux/sw_64/pointer_guard.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/register-dump.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/rt_sigaction.S create mode 100644 sysdeps/unix/sysv/linux/sw_64/select.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/setcontext.S create mode 100644 sysdeps/unix/sysv/linux/sw_64/setfpucw.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/setrlimit64.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/settimeofday.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/shlib-versions create mode 100644 sysdeps/unix/sysv/linux/sw_64/sigcontextinfo.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/sizes.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/statfs.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/sw_64/ptrace.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/sw_64/regdef.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/swapcontext.S create mode 100644 sysdeps/unix/sysv/linux/sw_64/sys/acct.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/sys/io.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/sys/user.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/syscalls.list create mode 100644 sysdeps/unix/sysv/linux/sw_64/sysconf.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/timer_t_was_int_compat.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/ucontext-offsets.sym create mode 100644 sysdeps/unix/sysv/linux/sw_64/wait4.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/wordexp.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/xstat64.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/xstatconv.c create mode 100644 sysdeps/unix/sysv/linux/sw_64/xstatconv.h create mode 100644 sysdeps/unix/sysv/linux/sw_64/xstatver.h diff --git a/sysdeps/unix/sysv/linux/sw_64/a.out.h b/sysdeps/unix/sysv/linux/sw_64/a.out.h new file mode 100644 index 00000000..2004d974 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/a.out.h @@ -0,0 +1,197 @@ +#ifndef __A_OUT_GNU_H__ +#define __A_OUT_GNU_H__ + +#include + +#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/sysdeps/unix/sysv/linux/sw_64/adjtime.c b/sysdeps/unix/sysv/linux/sw_64/adjtime.c new file mode 100644 index 00000000..6b64d1b9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/adjtime.c @@ -0,0 +1,22 @@ +/* adjtime -- Adjust the current time of day. Linux/Sw_64/tv64 version. + Copyright (C) 2019-2023 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, see + . */ + +/* We can use the generic Linux implementation, but we have to override its + default symbol version. */ +#define VERSION_adjtime GLIBC_2.1 +#include diff --git a/sysdeps/unix/sysv/linux/sw_64/adjtimex.c b/sysdeps/unix/sysv/linux/sw_64/adjtimex.c new file mode 100644 index 00000000..2e3d8d49 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/adjtimex.c @@ -0,0 +1,22 @@ +/* adjtimex -- Adjust the current time of day. Linux/Sw_64/tv64 version. + Copyright (C) 2019-2023 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, see + . */ + +/* We can use the generic Linux implementation, but we have to override its + default symbol version. */ +#define VERSION_adjtimex GLIBC_2.1 +#include diff --git a/sysdeps/unix/sysv/linux/sw_64/aio_cancel.c b/sysdeps/unix/sysv/linux/sw_64/aio_cancel.c new file mode 100644 index 00000000..222126ea --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/aio_cancel.c @@ -0,0 +1,35 @@ +#include + +#define aio_cancel64 XXX +#include +#undef aio_cancel64 +#include + +extern __typeof (aio_cancel) __new_aio_cancel; +extern __typeof (aio_cancel) __old_aio_cancel; + +#define __aio_cancel __new_aio_cancel + +#include + +#undef __aio_cancel +versioned_symbol (libc, __new_aio_cancel, aio_cancel, GLIBC_2_34); +versioned_symbol (libc, __new_aio_cancel, aio_cancel64, GLIBC_2_34); +#if OTHER_SHLIB_COMPAT (librt, GLIBC_2_3, GLIBC_2_34) +compat_symbol (librt, __new_aio_cancel, aio_cancel, GLIBC_2_3); +compat_symbol (librt, __new_aio_cancel, aio_cancel64, GLIBC_2_3); +#endif + +#if OTHER_SHLIB_COMPAT (librt, GLIBC_2_1, GLIBC_2_3) + +# undef ECANCELED +# define __aio_cancel __old_aio_cancel +# define ECANCELED 125 + +# include + +# undef __aio_cancel +compat_symbol (librt, __old_aio_cancel, aio_cancel, GLIBC_2_1); +compat_symbol (librt, __old_aio_cancel, aio_cancel64, GLIBC_2_1); + +#endif diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/a.out.h b/sysdeps/unix/sysv/linux/sw_64/bits/a.out.h new file mode 100644 index 00000000..f15e82c9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/a.out.h @@ -0,0 +1,9 @@ +#ifndef __A_OUT_GNU_H__ +# error "Never use directly; include instead." +#endif +#ifndef __A_OUT_GNU_H__ +# error "Never use directly; include instead." +#endif +#ifndef __A_OUT_GNU_H__ +# error "Never use directly; include instead." +#endif diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/dirent.h b/sysdeps/unix/sysv/linux/sw_64/bits/dirent.h new file mode 100644 index 00000000..ca27db2f --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/dirent.h @@ -0,0 +1,57 @@ +/* Copyright (C) 1996-2023 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, see + . */ + +#ifndef _BITS_DIRENT_H +#define _BITS_DIRENT_H 1 + +struct dirent +{ +#if (defined __USE_FILE_OFFSET64 || defined __sw_64__) + __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 + +/* Inform libc code that these two types are effectively identical. */ +#define _DIRENT_MATCHES_DIRENT64 1 + +#endif /* bits/dirent.h */ diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/elfclass.h b/sysdeps/unix/sysv/linux/sw_64/bits/elfclass.h new file mode 100644 index 00000000..e74c5f72 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/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 directly; include instead." +#endif + +#include + +#define __ELF_NATIVE_CLASS __WORDSIZE + +/* Linux/Sw_64 is exceptional as it has .hash section with 64 bit entries. */ +typedef uint64_t Elf_Symndx; diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/epoll.h b/sysdeps/unix/sysv/linux/sw_64/bits/epoll.h new file mode 100644 index 00000000..6c78bb04 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/epoll.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2002-2023 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, see + . */ + +#ifndef _SYS_EPOLL_H +# error "Never use directly; include instead." +#endif + +/* Flags to be passed to epoll_create1. */ +enum +{ + EPOLL_CLOEXEC = 010000000 +#define EPOLL_CLOEXEC EPOLL_CLOEXEC +}; diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/errno.h b/sysdeps/unix/sysv/linux/sw_64/bits/errno.h new file mode 100644 index 00000000..9fdbfe53 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/errno.h @@ -0,0 +1,53 @@ +/* Error constants. Linux/Sw_64 specific version. + Copyright (C) 1996-2023 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, see + . */ + +#ifndef _BITS_ERRNO_H +#define _BITS_ERRNO_H 1 + +#if !defined _ERRNO_H +# error "Never include directly; use instead." +#endif + +#include + +/* Older Linux headers do not define these constants. */ +#ifndef ENOTSUP +# define ENOTSUP EOPNOTSUPP +#endif + +#ifndef ECANCELED +# define ECANCELED 131 +#endif + +#ifndef EOWNERDEAD +# define EOWNERDEAD 136 +#endif + +#ifndef ENOTRECOVERABLE +# define ENOTRECOVERABLE 137 +#endif + +#ifndef ERFKILL +# define ERFKILL 138 +#endif + +#ifndef EHWPOISON +# define EHWPOISON 139 +#endif + +#endif /* bits/errno.h. */ diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/eventfd.h b/sysdeps/unix/sysv/linux/sw_64/bits/eventfd.h new file mode 100644 index 00000000..6ddae34b --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/eventfd.h @@ -0,0 +1,32 @@ +/* Copyright (C) 2007-2023 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, see + . */ + +#ifndef _SYS_EVENTFD_H +# error \ + "Never use directly; include instead." +#endif + +/* Flags for eventfd. */ +enum +{ + EFD_SEMAPHORE = 000000001, +#define EFD_SEMAPHORE EFD_SEMAPHORE + EFD_CLOEXEC = 010000000, +#define EFD_CLOEXEC EFD_CLOEXEC + EFD_NONBLOCK = 000000004 +#define EFD_NONBLOCK EFD_NONBLOCK +}; diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/fcntl.h b/sysdeps/unix/sysv/linux/sw_64/bits/fcntl.h new file mode 100644 index 00000000..48ae4a7c --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/fcntl.h @@ -0,0 +1,87 @@ +/* O_*, F_*, FD_* bit values for Linux. + Copyright (C) 1995-2023 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, see + . */ + +#ifndef _FCNTL_H +# error "Never use directly; include instead." +#endif + +#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_SYNC 020040000 + +#define __O_DIRECTORY 0100000 /* Must be a directory. */ +#define __O_NOFOLLOW 0200000 /* Do not follow links. */ +#define __O_CLOEXEC 010000000 /* Set close_on_exec. */ + +#define __O_DIRECT 02000000 /* Direct disk access. */ +#define __O_NOATIME 04000000 /* Do not set atime. */ +#define __O_PATH 040000000 /* Resolve pathname but do not open file. */ +#define __O_TMPFILE 0100100000 /* Atomically create nameless file. */ + +/* Not necessary, files are always with 64bit off_t. */ +#define __O_LARGEFILE 0 + +#define __O_DSYNC 040000 /* Synchronize data. */ + +#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). */ + +#define __F_SETOWN 5 /* Get owner of socket (receiver of SIGIO). */ +#define __F_GETOWN 6 /* Set owner of socket (receiver of SIGIO). */ + +/* 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 */ + +/* 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 + +/* Include generic Linux declarations. */ +#include diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/inotify.h b/sysdeps/unix/sysv/linux/sw_64/bits/inotify.h new file mode 100644 index 00000000..9d9e2872 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/inotify.h @@ -0,0 +1,30 @@ +/* Copyright (C) 2005-2023 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, see + . */ + +#ifndef _SYS_INOTIFY_H +# error \ + "Never use directly; include instead." +#endif + +/* Flags for the parameter of inotify_init1. */ +enum +{ + IN_CLOEXEC = 010000000, +#define IN_CLOEXEC IN_CLOEXEC + IN_NONBLOCK = 000000004 +#define IN_NONBLOCK IN_NONBLOCK +}; diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/ioctls.h b/sysdeps/unix/sysv/linux/sw_64/bits/ioctls.h new file mode 100644 index 00000000..41c9e754 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/ioctls.h @@ -0,0 +1,36 @@ +/* Copyright (C) 1996-2023 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, see + . */ + +#ifndef _SYS_IOCTL_H +# error "Never use directly; include instead." +#endif + +/* Use the definitions from the kernel header files. */ +#include + +/* 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 diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/mman.h b/sysdeps/unix/sysv/linux/sw_64/bits/mman.h new file mode 100644 index 00000000..f8e9f148 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/mman.h @@ -0,0 +1,67 @@ +/* Definitions for POSIX memory map interface. Linux/Sw_64 version. + Copyright (C) 1997-2023 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, see + . */ + +#ifndef _SYS_MMAN_H +# error "Never use directly; include instead." +#endif + +/* The following definitions basically come from the kernel headers. + But the kernel header is not namespace clean. */ + +#define __MAP_ANONYMOUS 0x10 /* Don't use a file. */ + +/* These are Linux-specific. */ +#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. */ +#define MAP_STACK 0x80000 /* Allocation is for a stack. */ +#define MAP_HUGETLB 0x100000 /* Create huge page mapping. */ +#define MAP_FIXED_NOREPLACE \ + 0x200000 /* MAP_FIXED but do not unmap \ + underlying mapping. */ + +/* Flags for `mlockall'. */ +#define MCL_CURRENT 8192 +#define MCL_FUTURE 16384 +#define MCL_ONFAULT 32768 + +#include + +/* Values that differ from standard . For the most part newer + values are shared, but older values are skewed. */ + +#undef MAP_FIXED +#define MAP_FIXED 0x100 + +#undef MS_SYNC +#define MS_SYNC 2 +#undef MS_INVALIDATE +#define MS_INVALIDATE 4 + +#ifdef __USE_MISC +# undef MADV_DONTNEED +# define MADV_DONTNEED 6 +#endif +#ifdef __USE_XOPEN2K +# undef POSIX_MADV_DONTNEED +# define POSIX_MADV_DONTNEED 6 +#endif diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/netdb.h b/sysdeps/unix/sysv/linux/sw_64/bits/netdb.h new file mode 100644 index 00000000..d97e16a4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/netdb.h @@ -0,0 +1,33 @@ +/* Copyright (C) 1996-2023 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, see + . */ + +#ifndef _NETDB_H +# error "Never include directly; use 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 + compatibility by adding appropriate padding. */ + uint32_t n_net; /* Network number. */ +}; diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/procfs-prregset.h b/sysdeps/unix/sysv/linux/sw_64/bits/procfs-prregset.h new file mode 100644 index 00000000..9b00b279 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/procfs-prregset.h @@ -0,0 +1,26 @@ +/* Types of prgregset_t and prfpregset_t. SW_64 version. + Copyright (C) 2018-2023 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, see + . */ + +#ifndef _SYS_PROCFS_H +# error \ + "Never include directly; use instead." +#endif + +typedef gregset_t __prgregset_t; +typedef fpregset_t __prfpregset_t; diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/procfs.h b/sysdeps/unix/sysv/linux/sw_64/bits/procfs.h new file mode 100644 index 00000000..0b3453ae --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/procfs.h @@ -0,0 +1,38 @@ +/* Types for registers for sys/procfs.h. SW_64 version. + Copyright (C) 1996-2023 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, see + . */ + +#ifndef _SYS_PROCFS_H +# error "Never include directly; use instead." +#endif + +#include +#include + +/* + * The OSF/1 version of makes gregset_t 46 entries long. + * I have no idea why that is so. For now, we just leave it at 33 + * (32 general regs + processor status word). + */ +#define ELF_NGREG 33 +#define ELF_NFPREG 32 + +typedef unsigned long elf_greg_t; +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +typedef double elf_fpreg_t; +typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/pthread_stack_min.h b/sysdeps/unix/sysv/linux/sw_64/bits/pthread_stack_min.h new file mode 100644 index 00000000..7e785f4a --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/pthread_stack_min.h @@ -0,0 +1,20 @@ +/* Definition of PTHREAD_STACK_MIN. Linux/SW_64 version. + Copyright (C) 2023 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. If not, see + . */ + +/* Minimum size for a thread. We are free to choose a reasonable value. */ +#define PTHREAD_STACK_MIN 24576 diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/resource.h b/sysdeps/unix/sysv/linux/sw_64/bits/resource.h new file mode 100644 index 00000000..9c4a2d56 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/resource.h @@ -0,0 +1,223 @@ +/* Bit values & structures for resource limits. Sw_64/Linux version. + Copyright (C) 1994-2023 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, see + . */ + +#ifndef _SYS_RESOURCE_H +# error \ + "Never use directly; include instead." +#endif + +#include + +/* 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 + + /* Maximum CPU time in microseconds that a process scheduled under a + real-time scheduling policy may consume without making a blocking system + call before being forcibly descheduled. */ + __RLIMIT_RTTIME = 15, +#define RLIMIT_RTTIME __RLIMIT_RTTIME + + __RLIMIT_NLIMITS = 16, + __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 ((__rlim_t) -1) +#else +# define RLIM_INFINITY 0xffffffffffffffffuLL +#endif + +#ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0xffffffffffffffffuLL +#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 +}; + +#include +#include + +/* 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 +}; + +__BEGIN_DECLS + +#ifdef __USE_GNU +/* Modify and return resource limits of a process atomically. */ +# ifndef __USE_FILE_OFFSET64 +extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource, + const struct rlimit *__new_limit, + struct rlimit *__old_limit) __THROW; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (prlimit, + (__pid_t __pid, enum __rlimit_resource __resource, + const struct rlimit *__new_limit, + struct rlimit *__old_limit), + prlimit64); +# else +# define prlimit prlimit64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource, + const struct rlimit64 *__new_limit, + struct rlimit64 *__old_limit) __THROW; +# endif +#endif + +__END_DECLS diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/sigaction.h b/sysdeps/unix/sysv/linux/sw_64/bits/sigaction.h new file mode 100644 index 00000000..906d94b7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/sigaction.h @@ -0,0 +1,82 @@ +/* The proper definitions for Linux/Sw_64 sigaction. + Copyright (C) 1996-2023 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, see + . */ + +#ifndef _BITS_SIGACTION_H +#define _BITS_SIGACTION_H 1 + +#ifndef _SIGNAL_H +# error "Never include directly; use instead." +#endif + +/* Structure describing the action to be taken when a signal arrives. */ +struct sigaction +{ + /* Signal handler. */ +#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED + 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. */ + 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_XOPEN_EXTENDED || defined __USE_MISC +# define SA_ONSTACK 0x00000001 /* Use signal stack by using `sa_restorer'. \ + */ +#endif +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 +# 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. */ + +#endif diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/signalfd.h b/sysdeps/unix/sysv/linux/sw_64/bits/signalfd.h new file mode 100644 index 00000000..9474ffe3 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/signalfd.h @@ -0,0 +1,30 @@ +/* Copyright (C) 2007-2023 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, see + . */ + +#ifndef _SYS_SIGNALFD_H +# error \ + "Never use directly; include instead." +#endif + +/* Flags for signalfd. */ +enum +{ + SFD_CLOEXEC = 010000000, +#define SFD_CLOEXEC SFD_CLOEXEC + SFD_NONBLOCK = 000000004 +#define SFD_NONBLOCK SFD_NONBLOCK +}; diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/signum-arch.h b/sysdeps/unix/sysv/linux/sw_64/bits/signum-arch.h new file mode 100644 index 00000000..e36c7e86 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/signum-arch.h @@ -0,0 +1,67 @@ +/* Signal number definitions. Linux/Sw_64 version. + Copyright (C) 1996-2023 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, see + . */ + +#ifndef _BITS_SIGNUM_ARCH_H +#define _BITS_SIGNUM_ARCH_H 1 + +#ifndef _SIGNAL_H +# error "Never include directly; use instead." +#endif + +/* Adjustments and additions to the signal number constants for + Linux/Sw_64. Signal values on this platform were chosen for OSF/1 + binary compatibility, and are therefore almost identical to the + BSD-derived defaults. */ + +#define SIGEMT 7 /* Emulator trap (4.2 BSD). */ +#define SIGINFO 29 /* Information request (BSD). */ +#define SIGPWR SIGINFO /* Power failure imminent (System V). */ + +/* Historical signals specified by POSIX. */ +#define SIGBUS 10 /* Bus error. */ +#define SIGSYS 12 /* Bad system call. */ + +/* New(er) POSIX signals (1003.1-2008, 1003.1-2013). */ +#define SIGURG 16 /* Urgent data is available at a socket. */ +#define SIGSTOP 17 /* Stop, unblockable. */ +#define SIGTSTP 18 /* Keyboard stop. */ +#define SIGCONT 19 /* Continue. */ +#define SIGCHLD 20 /* Child terminated or stopped. */ +#define SIGTTIN 21 /* Background read from control terminal. */ +#define SIGTTOU 22 /* Background write to control terminal. */ +#define SIGPOLL 23 /* Pollable event occurred (System V). */ +#define SIGXCPU 24 /* CPU time limit exceeded. */ +#define SIGVTALRM 26 /* Virtual timer expired. */ +#define SIGPROF 27 /* Profiling timer expired. */ +#define SIGXFSZ 25 /* File size limit exceeded. */ +#define SIGUSR1 30 /* User-defined signal 1. */ +#define SIGUSR2 31 /* User-defined signal 2. */ + +/* Nonstandard signals found in all modern POSIX systems + (including both BSD and Linux). */ +#define SIGWINCH 28 + +/* Archaic names for compatibility. */ +#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */ +#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11. */ +#define SIGCLD SIGCHLD /* Old System V name */ + +#define __SIGRTMIN 32 +#define __SIGRTMAX 64 + +#endif /* included. */ diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/sigstack.h b/sysdeps/unix/sysv/linux/sw_64/bits/sigstack.h new file mode 100644 index 00000000..7af301ff --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/sigstack.h @@ -0,0 +1,32 @@ +/* sigstack, sigaltstack definitions. + Copyright (C) 1998-2023 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, see + . */ + +#ifndef _BITS_SIGSTACK_H +#define _BITS_SIGSTACK_H 1 + +#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H +# error "Never include this file directly. Use instead" +#endif + +/* Minimum stack size for a signal handler. */ +#define MINSIGSTKSZ 4096 + +/* System default stack size. */ +#define SIGSTKSZ 16384 + +#endif /* bits/sigstack.h */ diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/socket-constants.h b/sysdeps/unix/sysv/linux/sw_64/bits/socket-constants.h new file mode 100644 index 00000000..cb1b5bec --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/socket-constants.h @@ -0,0 +1,51 @@ +/* Socket constants which vary among Linux architectures. Version for sw_64. + Copyright (C) 2019-2023 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, see + . */ + +#ifndef _SYS_SOCKET_H +# error \ + "Never include directly; use instead." +#endif + +#define SOL_SOCKET 65535 +#define SO_ACCEPTCONN 4116 +#define SO_BROADCAST 32 +#define SO_DONTROUTE 16 +#define SO_ERROR 4103 +#define SO_KEEPALIVE 8 +#define SO_LINGER 128 +#define SO_OOBINLINE 256 +#define SO_RCVBUF 4098 +#define SO_RCVLOWAT 4112 +#define SO_RCVTIMEO 4114 +#define SO_REUSEADDR 4 +#define SO_SNDBUF 4097 +#define SO_SNDLOWAT 4113 +#define SO_SNDTIMEO 4115 +#define SO_TYPE 4104 + +#define SO_RCVTIMEO_OLD 4114 +#define SO_SNDTIMEO_OLD 4115 +#define SO_RCVTIMEO_NEW 66 +#define SO_SNDTIMEO_NEW 67 + +#define SO_TIMESTAMP_OLD 29 +#define SO_TIMESTAMPNS_OLD 35 +#define SO_TIMESTAMPING_OLD 37 +#define SO_TIMESTAMP_NEW 63 +#define SO_TIMESTAMPNS_NEW 64 +#define SO_TIMESTAMPING_NEW 65 diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/socket_type.h b/sysdeps/unix/sysv/linux/sw_64/bits/socket_type.h new file mode 100644 index 00000000..64452402 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/socket_type.h @@ -0,0 +1,56 @@ +/* Define enum __socket_type for Linux/Sw_64. + Copyright (C) 1991-2023 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, see + . */ + +#ifndef _SYS_SOCKET_H +# error \ + "Never include directly; use instead." +#endif + +/* Types of sockets. */ +enum __socket_type +{ + SOCK_STREAM = 1, /* Sequenced, reliable, connection-based + byte streams. */ +#define SOCK_STREAM SOCK_STREAM + SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams + of fixed maximum length. */ +#define SOCK_DGRAM SOCK_DGRAM + SOCK_RAW = 3, /* Raw protocol interface. */ +#define SOCK_RAW SOCK_RAW + SOCK_RDM = 4, /* Reliably-delivered messages. */ +#define SOCK_RDM SOCK_RDM + SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, + datagrams of fixed maximum length. */ +#define SOCK_SEQPACKET SOCK_SEQPACKET + SOCK_DCCP = 6, /* Datagram Congestion Control Protocol. */ +#define SOCK_DCCP SOCK_DCCP + SOCK_PACKET = 10, /* Linux specific way of getting packets + at the dev level. For writing rarp and + other similar things on the user level. */ +#define SOCK_PACKET SOCK_PACKET + + /* Flags to be ORed into the type parameter of socket and socketpair and + used for the flags parameter of paccept. */ + + SOCK_CLOEXEC = 010000000, /* Atomically set close-on-exec flag for the + new descriptor(s). */ +#define SOCK_CLOEXEC SOCK_CLOEXEC + SOCK_NONBLOCK = 0x40000000 /* Atomically mark descriptor(s) as + non-blocking. */ +#define SOCK_NONBLOCK SOCK_NONBLOCK +}; diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/statfs.h b/sysdeps/unix/sysv/linux/sw_64/bits/statfs.h new file mode 100644 index 00000000..72c3f457 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/statfs.h @@ -0,0 +1,64 @@ +/* Copyright (C) 1997-2023 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, see + . */ + +#ifndef _SYS_STATFS_H +# error "Never include directly; use instead." +#endif + +#include /* for __fsid_t and __fsblkcnt_t. */ + +#ifndef __statfs_word +# define __statfs_word long +#endif + +struct statfs +{ + __statfs_word f_type; + __statfs_word f_bsize; + __statfs_word f_blocks; + __statfs_word f_bfree; + __statfs_word f_bavail; + __statfs_word f_files; + __statfs_word f_ffree; + __fsid_t f_fsid; + __statfs_word f_namelen; + __statfs_word f_frsize; + __statfs_word f_flags; + __statfs_word f_spare[4]; +}; + +#ifdef __USE_LARGEFILE64 +struct statfs64 +{ + __statfs_word f_type; + __statfs_word 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; + __statfs_word f_namelen; + __statfs_word f_frsize; + __statfs_word f_flags; + __statfs_word f_spare[4]; +}; +#endif + +/* Tell code we have this member. */ +#define _STATFS_F_NAMELEN +#define _STATFS_F_FRSIZE diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/struct_stat.h b/sysdeps/unix/sysv/linux/sw_64/bits/struct_stat.h new file mode 100644 index 00000000..f5de6cb1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/struct_stat.h @@ -0,0 +1,119 @@ +/* Definition for struct stat. + Copyright (C) 2020-2023 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, see + . */ + +#if !defined _SYS_STAT_H && !defined _FCNTL_H +# error \ + "Never include directly; use instead." +#endif + +#ifndef _BITS_STRUCT_STAT_H +# define _BITS_STRUCT_STAT_H 1 + +struct stat +{ + __dev_t st_dev; /* Device. */ +# if (defined __USE_FILE_OFFSET64 || defined __sw_64__) /* mod */ + __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. */ +# ifdef __USE_XOPEN2K8 + /* 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 header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +# endif + long __glibc_reserved[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. */ +# ifdef __USE_XOPEN2K8 + /* 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 header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +# else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +# endif + long __glibc_reserved[3]; +}; +# endif + +/* Tell code we have these members. */ +# define _STATBUF_ST_BLKSIZE +# define _STATBUF_ST_RDEV +# define _STATBUF_ST_NSEC + +#endif /* _BITS_STRUCT_STAT_H */ diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/termios-baud.h b/sysdeps/unix/sysv/linux/sw_64/bits/termios-baud.h new file mode 100644 index 00000000..675ee821 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/termios-baud.h @@ -0,0 +1,47 @@ +/* termios baud rate selection definitions. Linux/sw_64 version. + Copyright (C) 2019-2023 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, see + . */ + +#ifndef _TERMIOS_H +# error \ + "Never include directly; use instead." +#endif + +#ifdef __USE_MISC +# define CBAUD 0000037 +# define CBAUDEX 0000000 +# define CMSPAR 010000000000 /* mark or space (stick) parity */ +# define CRTSCTS 020000000000 /* flow control */ +#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 diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_cc.h b/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_cc.h new file mode 100644 index 00000000..19728cf3 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_cc.h @@ -0,0 +1,41 @@ +/* termios c_cc symbolic constant definitions. Linux/sw_64 version. + Copyright (C) 2019-2023 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, see + . */ + +#ifndef _TERMIOS_H +# error \ + "Never include directly; use instead." +#endif + +/* 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 diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_cflag.h b/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_cflag.h new file mode 100644 index 00000000..e852f6e2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_cflag.h @@ -0,0 +1,39 @@ +/* termios control mode definitions. Linux/sw_64 version. + Copyright (C) 2019-2023 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, see + . */ + +#ifndef _TERMIOS_H +# error \ + "Never include directly; use instead." +#endif + +#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 ADDRB 04000000000 +#endif diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_iflag.h b/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_iflag.h new file mode 100644 index 00000000..d85fd1e2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_iflag.h @@ -0,0 +1,39 @@ +/* termios input mode definitions. Linux/sw_64 version. + Copyright (C) 2019-2023 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, see + . */ + +#ifndef _TERMIOS_H +# error \ + "Never include directly; use instead." +#endif + +/* 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 +#define IXANY 0004000 +#define IUCLC 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_lflag.h b/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_lflag.h new file mode 100644 index 00000000..50de240a --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_lflag.h @@ -0,0 +1,43 @@ +/* termios local mode definitions. Linux/sw_64 version. + Copyright (C) 2019-2023 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, see + . */ + +#ifndef _TERMIOS_H +# error \ + "Never include directly; use instead." +#endif + +/* c_lflag bits */ +#define ISIG 0x00000080 +#define ICANON 0x00000100 +#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) +# 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 diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_oflag.h b/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_oflag.h new file mode 100644 index 00000000..bd9eda92 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/termios-c_oflag.h @@ -0,0 +1,67 @@ +/* termios output mode definitions. Linux/sw_64 version. + Copyright (C) 2019-2023 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, see + . */ + +#ifndef _TERMIOS_H +# error \ + "Never include directly; use instead." +#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 +# if defined __USE_MISC +# define NL2 00001000 +# define NL3 00001400 +# endif +# 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 TAB3 +#endif diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/termios-struct.h b/sysdeps/unix/sysv/linux/sw_64/bits/termios-struct.h new file mode 100644 index 00000000..0c5f0d4c --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/termios-struct.h @@ -0,0 +1,38 @@ +/* struct termios definition. Linux/sw_64 version. + Copyright (C) 2019-2023 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, see + . */ + +#ifndef _TERMIOS_H +# error \ + "Never include directly; use instead." +#endif + +/* SW_64 has C_CC before C_LINE compare to Linux generic definition. */ +#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 +}; diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/timerfd.h b/sysdeps/unix/sysv/linux/sw_64/bits/timerfd.h new file mode 100644 index 00000000..a6f1465d --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/timerfd.h @@ -0,0 +1,30 @@ +/* Copyright (C) 2008-2023 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, see + . */ + +#ifndef _SYS_TIMERFD_H +# error \ + "Never use directly; include instead." +#endif + +/* Bits to be set in the FLAGS parameter of `timerfd_create'. */ +enum +{ + TFD_CLOEXEC = 010000000, +#define TFD_CLOEXEC TFD_CLOEXEC + TFD_NONBLOCK = 000000004 +#define TFD_NONBLOCK TFD_NONBLOCK +}; diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/typesizes.h b/sysdeps/unix/sysv/linux/sw_64/bits/typesizes.h new file mode 100644 index 00000000..64eb96f3 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/typesizes.h @@ -0,0 +1,87 @@ +/* bits/typesizes.h -- underlying types for *_t. Linux/Sw_64 version. + Copyright (C) 2002-2023 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, see + . */ + +#ifndef _BITS_TYPES_H +# error \ + "Never include directly; use instead." +#endif + +#ifndef _BITS_TYPESIZES_H +# define _BITS_TYPESIZES_H 1 + +/* See for the meaning of these macros. This file exists so + that 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 __U64_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 __SUSECONDS64_T_TYPE __S64_TYPE +# define __DADDR_T_TYPE __S32_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 +# define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE +# define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE +# define __CPU_MASK_TYPE __ULONGWORD_TYPE +# define __FSWORD_T_TYPE __S32_TYPE + +/* Tell the libc code that off_t and off64_t are actually the same type + for all ABI purposes, even if possibly expressed as different base types + for C type-checking purposes. */ +# define __OFF_T_MATCHES_OFF64_T 1 + +/* And for __rlim_t and __rlim64_t. */ +# define __RLIM_T_MATCHES_RLIM64_T 1 + +/* Not for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ +# define __STATFS_MATCHES_STATFS64 0 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 + +/* Number of descriptors that can fit in an `fd_set'. */ +# define __FD_SETSIZE 1024 + +#endif /* bits/typesizes.h */ diff --git a/sysdeps/unix/sysv/linux/sw_64/bits/wordsize.h b/sysdeps/unix/sysv/linux/sw_64/bits/wordsize.h new file mode 100644 index 00000000..36e67434 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/bits/wordsize.h @@ -0,0 +1,19 @@ +/* Copyright (C) 1999-2023 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, see + . */ + +#define __WORDSIZE 64 +#define __WORDSIZE_TIME64_COMPAT32 0 diff --git a/sysdeps/unix/sysv/linux/sw_64/brk_call.h b/sysdeps/unix/sysv/linux/sw_64/brk_call.h new file mode 100644 index 00000000..67419149 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/brk_call.h @@ -0,0 +1,27 @@ +/* Invoke the brk system call. Sw_64 version. + Copyright (C) 2023 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, see + . */ + +static inline void * +__brk_call (void *addr) +{ + unsigned long int result = INTERNAL_SYSCALL_CALL (brk, addr); + if (result == -ENOMEM) + /* Mimic the default error reporting behavior. */ + result = INTERNAL_SYSCALL_CALL (brk, 0); + return (void *) result; +} diff --git a/sysdeps/unix/sysv/linux/sw_64/dl-auxv.h b/sysdeps/unix/sysv/linux/sw_64/dl-auxv.h new file mode 100644 index 00000000..5f1d7b71 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/dl-auxv.h @@ -0,0 +1,40 @@ +/* Auxiliary vector processing for Linux/Sw_64. + Copyright (C) 2007-2023 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, see + . */ + +/* Scan the Aux Vector for the cache shape entries. */ + +extern long __libc_sw_64_cache_shape[4]; +#define DL_PLATFORM_AUXV \ + __libc_sw_64_cache_shape[0] = auxv_values[AT_L1I_CACHESHAPE]; \ + __libc_sw_64_cache_shape[1] = auxv_values[AT_L1D_CACHESHAPE]; \ + __libc_sw_64_cache_shape[2] = auxv_values[AT_L2_CACHESHAPE]; \ + __libc_sw_64_cache_shape[3] = auxv_values[AT_L3_CACHESHAPE]; +/*#define DL_PLATFORM_AUXV \ + case AT_L1I_CACHESHAPE: \ + __libc_sw_64_cache_shape[0] = av->a_un.a_val; \ + break; \ + case AT_L1D_CACHESHAPE: \ + __libc_sw_64_cache_shape[1] = av->a_un.a_val; \ + break; \ + case AT_L2_CACHESHAPE: \ + __libc_sw_64_cache_shape[2] = av->a_un.a_val; \ + break; \ + case AT_L3_CACHESHAPE: \ + __libc_sw_64_cache_shape[3] = av->a_un.a_val; \ + break; +*/ diff --git a/sysdeps/unix/sysv/linux/sw_64/dl-support.c b/sysdeps/unix/sysv/linux/sw_64/dl-support.c new file mode 100644 index 00000000..29021767 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/dl-support.c @@ -0,0 +1,2 @@ +#include "dl-auxv.h" +#include diff --git a/sysdeps/unix/sysv/linux/sw_64/dl-sysdep.c b/sysdeps/unix/sysv/linux/sw_64/dl-sysdep.c new file mode 100644 index 00000000..be352fd9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/dl-sysdep.c @@ -0,0 +1,5 @@ +#include "dl-auxv.h" + +long __libc_sw_64_cache_shape[4] = { -2, -2, -2, -2 }; + +#include diff --git a/sysdeps/unix/sysv/linux/sw_64/errlist-compat.c b/sysdeps/unix/sysv/linux/sw_64/errlist-compat.c new file mode 100644 index 00000000..284ce7c5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/errlist-compat.c @@ -0,0 +1,43 @@ +/* Linux sys_errlist compat symbol definitions. Sw_64 version. + Copyright (C) 2020-2023 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, see + . */ + +#include + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) +DEFINE_COMPAT_ERRLIST (131, GLIBC_2_0) +#endif + +#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3) +DEFINE_COMPAT_ERRLIST (131, GLIBC_2_1) +#endif + +#if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_4) +DEFINE_COMPAT_ERRLIST (132, GLIBC_2_3) +#endif + +#if SHLIB_COMPAT (libc, GLIBC_2_4, GLIBC_2_12) +DEFINE_COMPAT_ERRLIST (138, GLIBC_2_4) +#endif + +#if SHLIB_COMPAT (libc, GLIBC_2_12, GLIBC_2_16) +DEFINE_COMPAT_ERRLIST (139, GLIBC_2_12) +#endif + +#if SHLIB_COMPAT (libc, GLIBC_2_16, GLIBC_2_32) +DEFINE_COMPAT_ERRLIST (140, GLIBC_2_16) +#endif diff --git a/sysdeps/unix/sysv/linux/sw_64/fraiseexcpt.S b/sysdeps/unix/sysv/linux/sw_64/fraiseexcpt.S new file mode 100644 index 00000000..c3c8b710 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/fraiseexcpt.S @@ -0,0 +1,58 @@ +/* Copyright (C) 2004-2023 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, see + . */ + +#include +#include "kernel_sysinfo.h" + + + .text + +ENTRY(__feraiseexcept) + cfi_startproc + PSEUDO_PROLOGUE + + ldi sp, -16(sp) + cfi_adjust_cfa_offset (16) + + ldi v0, __NR_setsysinfo + stl a0, 0(sp) + mov sp, a1 + ldi a0, SSI_IEEE_RAISE_EXCEPTION + sys_call HMC_callsys + + ldi sp, 16(sp) + cfi_adjust_cfa_offset (-16) + + /* Here in libm we can't use SYSCALL_ERROR_LABEL. Nor is it clear + that we'd want to set errno anyway. All we're required to do is + return non-zero on error. Which is exactly A3. */ + mov a3, v0 + ret + +END(__feraiseexcept) + cfi_endproc + +#if IS_IN (libm) +# include +# 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_def (__feraiseexcept) +libm_hidden_ver (__feraiseexcept, feraiseexcept) +versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2); +#endif diff --git a/sysdeps/unix/sysv/linux/sw_64/fstatfs.c b/sysdeps/unix/sysv/linux/sw_64/fstatfs.c new file mode 100644 index 00000000..bb184148 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/fstatfs.c @@ -0,0 +1,29 @@ +/* Get filesystem statistics. Linux/sw_64. + Copyright (C) 2011-2023 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, see + . */ + +#include +#include +#include + +/* Return information about the filesystem on which FD resides. */ +int +__fstatfs (int fd, struct statfs *buf) +{ + return INLINE_SYSCALL_CALL (fstatfs, fd, buf); +} +libc_hidden_def (__fstatfs) weak_alias (__fstatfs, fstatfs) diff --git a/sysdeps/unix/sysv/linux/sw_64/fxstat64.c b/sysdeps/unix/sysv/linux/sw_64/fxstat64.c new file mode 100644 index 00000000..df56314b --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/fxstat64.c @@ -0,0 +1,45 @@ +/* fxstat64 using old-style Unix stat system call. + Copyright (C) 2004-2023 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, see + . */ + +#define __fxstat __redirect___fxstat64 +#include +#undef __fxstat +#include +#include +#include + +/* Get information about the file NAME in BUF. */ +int +__fxstat64 (int vers, int fd, struct stat64 *buf) +{ + switch (vers) + { + case _STAT_VER_KERNEL64: + return INLINE_SYSCALL_CALL (fstat64, fd, buf); + + default: + { + struct kernel_stat kbuf; + int r = INTERNAL_SYSCALL_CALL (fstat, fd, &kbuf); + if (r == 0) + return __xstat_conv (vers, &kbuf, buf); + return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r); + } + } +} +strong_alias (__fxstat64, __fxstat); diff --git a/sysdeps/unix/sysv/linux/sw_64/fxstatat64.c b/sysdeps/unix/sysv/linux/sw_64/fxstatat64.c new file mode 100644 index 00000000..a274b0db --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/fxstatat64.c @@ -0,0 +1,32 @@ +/* fxstat using old-style Unix stat system call. + Copyright (C) 2004-2023 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, see + . */ + +#define __fxstatat __redirect___fxstatat64 +#include +#undef __fxstatat +#include +#include +#include + +/* Get information about the file NAME in BUF. */ +int +__fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) +{ + return INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag); +} +strong_alias (__fxstatat64, __fxstatat); diff --git a/sysdeps/unix/sysv/linux/sw_64/getclktck.c b/sysdeps/unix/sysv/linux/sw_64/getclktck.c new file mode 100644 index 00000000..111fad85 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/getclktck.c @@ -0,0 +1,2 @@ +#define SYSTEM_CLK_TCK 1024 +#include diff --git a/sysdeps/unix/sysv/linux/sw_64/getcontext.S b/sysdeps/unix/sysv/linux/sw_64/getcontext.S new file mode 100644 index 00000000..f1cc76f2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/getcontext.S @@ -0,0 +1,440 @@ +/* Save current context. + Copyright (C) 2004-2023 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, see + . */ + +#include +#include + +/* ??? 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 + ldi AT, _mcount + call 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. */ + stl $31, UC_SIGCTX+SC_REGS($16) + + /* Store all registers into the context. */ + stl $1, UC_SIGCTX+SC_REGS+1*8($16) + stl $2, UC_SIGCTX+SC_REGS+2*8($16) + stl $3, UC_SIGCTX+SC_REGS+3*8($16) + stl $4, UC_SIGCTX+SC_REGS+4*8($16) + stl $5, UC_SIGCTX+SC_REGS+5*8($16) + stl $6, UC_SIGCTX+SC_REGS+6*8($16) + stl $7, UC_SIGCTX+SC_REGS+7*8($16) + stl $8, UC_SIGCTX+SC_REGS+8*8($16) + stl $9, UC_SIGCTX+SC_REGS+9*8($16) + stl $10, UC_SIGCTX+SC_REGS+10*8($16) + stl $11, UC_SIGCTX+SC_REGS+11*8($16) + stl $12, UC_SIGCTX+SC_REGS+12*8($16) + stl $13, UC_SIGCTX+SC_REGS+13*8($16) + stl $14, UC_SIGCTX+SC_REGS+14*8($16) + stl $15, UC_SIGCTX+SC_REGS+15*8($16) + stl $16, UC_SIGCTX+SC_REGS+16*8($16) + stl $17, UC_SIGCTX+SC_REGS+17*8($16) + stl $18, UC_SIGCTX+SC_REGS+18*8($16) + stl $19, UC_SIGCTX+SC_REGS+19*8($16) + stl $20, UC_SIGCTX+SC_REGS+20*8($16) + stl $21, UC_SIGCTX+SC_REGS+21*8($16) + stl $22, UC_SIGCTX+SC_REGS+22*8($16) + stl $23, UC_SIGCTX+SC_REGS+23*8($16) + stl $24, UC_SIGCTX+SC_REGS+24*8($16) + stl $25, UC_SIGCTX+SC_REGS+25*8($16) + stl $26, UC_SIGCTX+SC_REGS+26*8($16) + stl $27, UC_SIGCTX+SC_REGS+27*8($16) + stl $28, UC_SIGCTX+SC_REGS+28*8($16) + stl $29, UC_SIGCTX+SC_REGS+29*8($16) + stl $30, UC_SIGCTX+SC_REGS+30*8($16) + stl $31, UC_SIGCTX+SC_REGS+31*8($16) +#ifndef SW_64 + fstd $f0, UC_SIGCTX+SC_FPREGS+1*8($16) + srlow $f0, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+2*8($16) + srlow $f0, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+3*8($16) + srlow $f0, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+4*8($16) + + fstd $f1, UC_SIGCTX+SC_FPREGS+5*8($16) + srlow $f1, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+6*8($16) + srlow $f1, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+7*8($16) + srlow $f1, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+8*8($16) + + fstd $f2, UC_SIGCTX+SC_FPREGS+9*8($16) + srlow $f2, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+10*8($16) + srlow $f0, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+11*8($16) + srlow $f0, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+12*8($16) + + fstd $f3, UC_SIGCTX+SC_FPREGS+13*8($16) + srlow $f3, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+14*8($16) + srlow $f1, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+15*8($16) + srlow $f1, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+16*8($16) + + fstd $f4, UC_SIGCTX+SC_FPREGS+17*8($16) + srlow $f4, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+18*8($16) + srlow $f0, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+19*8($16) + srlow $f0, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+20*8($16) + + fstd $f5, UC_SIGCTX+SC_FPREGS+21*8($16) + srlow $f5, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+22*8($16) + srlow $f1, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+23*8($16) + srlow $f1, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+24*8($16) + + fstd $f6, UC_SIGCTX+SC_FPREGS+25*8($16) + srlow $f6, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+26*8($16) + srlow $f0, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+27*8($16) + srlow $f0, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+28*8($16) + + fstd $f7, UC_SIGCTX+SC_FPREGS+29*8($16) + srlow $f7, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+30*8($16) + srlow $f1, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+31*8($16) + srlow $f1, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+32*8($16) + + fstd $f8, UC_SIGCTX+SC_FPREGS+33*8($16) + srlow $f8, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+34*8($16) + srlow $f0, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+35*8($16) + srlow $f0, 0x40, $f0 + fstd $f0, UC_SIGCTX+SC_FPREGS+36*8($16) + + fstd $f9, UC_SIGCTX+SC_FPREGS+37*8($16) + srlow $f9, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+38*8($16) + srlow $f1, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+39*8($16) + srlow $f1, 0x40, $f1 + fstd $f1, UC_SIGCTX+SC_FPREGS+40*8($16) + + fstd $f10, UC_SIGCTX+SC_FPREGS+41*8($16) + srlow $f10, 0x40, $f10 + fstd $f10, UC_SIGCTX+SC_FPREGS+42*8($16) + srlow $f10, 0x40, $f10 + fstd $f10, UC_SIGCTX+SC_FPREGS+43*8($16) + srlow $f10, 0x40, $f10 + fstd $f10, UC_SIGCTX+SC_FPREGS+44*8($16) + + fstd $f11, UC_SIGCTX+SC_FPREGS+45*8($16) + srlow $f11, 0x40, $f11 + fstd $f11, UC_SIGCTX+SC_FPREGS+46*8($16) + srlow $f11, 0x40, $f11 + fstd $f11, UC_SIGCTX+SC_FPREGS+47*8($16) + srlow $f11, 0x40, $f11 + fstd $f11, UC_SIGCTX+SC_FPREGS+48*8($16) + + fstd $f12, UC_SIGCTX+SC_FPREGS+49*8($16) + srlow $f12, 0x40, $f12 + fstd $f12, UC_SIGCTX+SC_FPREGS+50*8($16) + srlow $f12, 0x40, $f12 + fstd $f12, UC_SIGCTX+SC_FPREGS+51*8($16) + srlow $f12, 0x40, $f12 + fstd $f12, UC_SIGCTX+SC_FPREGS+52*8($16) + + fstd $f13, UC_SIGCTX+SC_FPREGS+53*8($16) + srlow $f13, 0x40, $f13 + fstd $f13, UC_SIGCTX+SC_FPREGS+54*8($16) + srlow $f13, 0x40, $f13 + fstd $f13, UC_SIGCTX+SC_FPREGS+55*8($16) + srlow $f13, 0x40, $f13 + fstd $f13, UC_SIGCTX+SC_FPREGS+56*8($16) + + fstd $f14, UC_SIGCTX+SC_FPREGS+57*8($16) + srlow $f14, 0x40, $f14 + fstd $f14, UC_SIGCTX+SC_FPREGS+58*8($16) + srlow $f14, 0x40, $f14 + fstd $f14, UC_SIGCTX+SC_FPREGS+59*8($16) + srlow $f14, 0x40, $f14 + fstd $f14, UC_SIGCTX+SC_FPREGS+60*8($16) + + fstd $f15, UC_SIGCTX+SC_FPREGS+61*8($16) + srlow $f15, 0x40, $f15 + fstd $f15, UC_SIGCTX+SC_FPREGS+62*8($16) + srlow $f15, 0x40, $f15 + fstd $f15, UC_SIGCTX+SC_FPREGS+63*8($16) + srlow $f15, 0x40, $f15 + fstd $f15, UC_SIGCTX+SC_FPREGS+64*8($16) + + fstd $f16, UC_SIGCTX+SC_FPREGS+65*8($16) + srlow $f16, 0x40, $f16 + fstd $f16, UC_SIGCTX+SC_FPREGS+66*8($16) + srlow $f16, 0x40, $f16 + fstd $f16, UC_SIGCTX+SC_FPREGS+67*8($16) + srlow $f16, 0x40, $f16 + fstd $f16, UC_SIGCTX+SC_FPREGS+68*8($16) + + fstd $f17, UC_SIGCTX+SC_FPREGS+69*8($16) + srlow $f17, 0x40, $f17 + fstd $f17, UC_SIGCTX+SC_FPREGS+70*8($16) + srlow $f17, 0x40, $f17 + fstd $f17, UC_SIGCTX+SC_FPREGS+71*8($16) + srlow $f17, 0x40, $f17 + fstd $f17, UC_SIGCTX+SC_FPREGS+72*8($16) + + fstd $f18, UC_SIGCTX+SC_FPREGS+73*8($16) + srlow $f18, 0x40, $f18 + fstd $f18, UC_SIGCTX+SC_FPREGS+74*8($16) + srlow $f18, 0x40, $f18 + fstd $f18, UC_SIGCTX+SC_FPREGS+75*8($16) + srlow $f18, 0x40, $f18 + fstd $f18, UC_SIGCTX+SC_FPREGS+76*8($16) + + fstd $f19, UC_SIGCTX+SC_FPREGS+77*8($16) + srlow $f19, 0x40, $f19 + fstd $f19, UC_SIGCTX+SC_FPREGS+78*8($16) + srlow $f19, 0x40, $f19 + fstd $f19, UC_SIGCTX+SC_FPREGS+79*8($16) + srlow $f19, 0x40, $f19 + fstd $f19, UC_SIGCTX+SC_FPREGS+80*8($16) + + fstd $f20, UC_SIGCTX+SC_FPREGS+81*8($16) + srlow $f20, 0x40, $f20 + fstd $f20, UC_SIGCTX+SC_FPREGS+82*8($16) + srlow $f20, 0x40, $f20 + fstd $f20, UC_SIGCTX+SC_FPREGS+83*8($16) + srlow $f20, 0x40, $f20 + fstd $f20, UC_SIGCTX+SC_FPREGS+84*8($16) + + fstd $f21, UC_SIGCTX+SC_FPREGS+85*8($16) + srlow $f21, 0x40, $f21 + fstd $f21, UC_SIGCTX+SC_FPREGS+86*8($16) + srlow $f21, 0x40, $f21 + fstd $f21, UC_SIGCTX+SC_FPREGS+87*8($16) + srlow $f21, 0x40, $f21 + fstd $f21, UC_SIGCTX+SC_FPREGS+88*8($16) + + fstd $f22, UC_SIGCTX+SC_FPREGS+89*8($16) + srlow $f22, 0x40, $f22 + fstd $f22, UC_SIGCTX+SC_FPREGS+90*8($16) + srlow $f22, 0x40, $f22 + fstd $f22, UC_SIGCTX+SC_FPREGS+91*8($16) + srlow $f22, 0x40, $f22 + fstd $f22, UC_SIGCTX+SC_FPREGS+92*8($16) + + fstd $f23, UC_SIGCTX+SC_FPREGS+93*8($16) + srlow $f23, 0x40, $f23 + fstd $f23, UC_SIGCTX+SC_FPREGS+94*8($16) + srlow $f23, 0x40, $f23 + fstd $f23, UC_SIGCTX+SC_FPREGS+95*8($16) + srlow $f23, 0x40, $f23 + fstd $f23, UC_SIGCTX+SC_FPREGS+96*8($16) + + fstd $f24, UC_SIGCTX+SC_FPREGS+97*8($16) + srlow $f24, 0x40, $f24 + fstd $f24, UC_SIGCTX+SC_FPREGS+98*8($16) + srlow $f24, 0x40, $f24 + fstd $f24, UC_SIGCTX+SC_FPREGS+99*8($16) + srlow $f24, 0x40, $f24 + fstd $f24, UC_SIGCTX+SC_FPREGS+100*8($16) + + fstd $f25, UC_SIGCTX+SC_FPREGS+101*8($16) + srlow $f25, 0x40, $f25 + fstd $f25, UC_SIGCTX+SC_FPREGS+102*8($16) + srlow $f25, 0x40, $f25 + fstd $f25, UC_SIGCTX+SC_FPREGS+103*8($16) + srlow $f25, 0x40, $f25 + fstd $f25, UC_SIGCTX+SC_FPREGS+104*8($16) + + fstd $f26, UC_SIGCTX+SC_FPREGS+105*8($16) + srlow $f26, 0x40, $f26 + fstd $f26, UC_SIGCTX+SC_FPREGS+106*8($16) + srlow $f26, 0x40, $f26 + fstd $f26, UC_SIGCTX+SC_FPREGS+107*8($16) + srlow $f26, 0x40, $f26 + fstd $f26, UC_SIGCTX+SC_FPREGS+108*8($16) + + fstd $f27, UC_SIGCTX+SC_FPREGS+109*8($16) + srlow $f27, 0x40, $f27 + fstd $f27, UC_SIGCTX+SC_FPREGS+110*8($16) + srlow $f27, 0x40, $f27 + fstd $f27, UC_SIGCTX+SC_FPREGS+111*8($16) + srlow $f27, 0x40, $f27 + fstd $f27, UC_SIGCTX+SC_FPREGS+112*8($16) + + fstd $f28, UC_SIGCTX+SC_FPREGS+113*8($16) + srlow $f28, 0x40, $f28 + fstd $f28, UC_SIGCTX+SC_FPREGS+114*8($16) + srlow $f28, 0x40, $f28 + fstd $f28, UC_SIGCTX+SC_FPREGS+115*8($16) + srlow $f28, 0x40, $f28 + fstd $f28, UC_SIGCTX+SC_FPREGS+116*8($16) + + fstd $f29, UC_SIGCTX+SC_FPREGS+117*8($16) + srlow $f29, 0x40, $f29 + fstd $f29, UC_SIGCTX+SC_FPREGS+118*8($16) + srlow $f29, 0x40, $f29 + fstd $f29, UC_SIGCTX+SC_FPREGS+119*8($16) + srlow $f29, 0x40, $f29 + fstd $f29, UC_SIGCTX+SC_FPREGS+120*8($16) + + fstd $f30, UC_SIGCTX+SC_FPREGS+121*8($16) + srlow $f30, 0x40, $f30 + fstd $f30, UC_SIGCTX+SC_FPREGS+122*8($16) + srlow $f30, 0x40, $f30 + fstd $f30, UC_SIGCTX+SC_FPREGS+123*8($16) + srlow $f30, 0x40, $f30 + fstd $f30, UC_SIGCTX+SC_FPREGS+124*8($16) +#else + fstd $f0, UC_SIGCTX+SC_FPREGS+0*8($16) + fstd $f1, UC_SIGCTX+SC_FPREGS+1*8($16) + fstd $f2, UC_SIGCTX+SC_FPREGS+2*8($16) + fstd $f3, UC_SIGCTX+SC_FPREGS+3*8($16) + fstd $f4, UC_SIGCTX+SC_FPREGS+4*8($16) + fstd $f5, UC_SIGCTX+SC_FPREGS+5*8($16) + fstd $f6, UC_SIGCTX+SC_FPREGS+6*8($16) + fstd $f7, UC_SIGCTX+SC_FPREGS+7*8($16) + fstd $f8, UC_SIGCTX+SC_FPREGS+8*8($16) + fstd $f9, UC_SIGCTX+SC_FPREGS+9*8($16) + fstd $f10, UC_SIGCTX+SC_FPREGS+10*8($16) + fstd $f11, UC_SIGCTX+SC_FPREGS+11*8($16) + fstd $f12, UC_SIGCTX+SC_FPREGS+12*8($16) + fstd $f13, UC_SIGCTX+SC_FPREGS+13*8($16) + fstd $f14, UC_SIGCTX+SC_FPREGS+14*8($16) + fstd $f15, UC_SIGCTX+SC_FPREGS+15*8($16) + fstd $f16, UC_SIGCTX+SC_FPREGS+16*8($16) + fstd $f17, UC_SIGCTX+SC_FPREGS+17*8($16) + fstd $f18, UC_SIGCTX+SC_FPREGS+18*8($16) + fstd $f19, UC_SIGCTX+SC_FPREGS+19*8($16) + fstd $f20, UC_SIGCTX+SC_FPREGS+20*8($16) + fstd $f21, UC_SIGCTX+SC_FPREGS+21*8($16) + fstd $f22, UC_SIGCTX+SC_FPREGS+22*8($16) + fstd $f23, UC_SIGCTX+SC_FPREGS+23*8($16) + fstd $f24, UC_SIGCTX+SC_FPREGS+24*8($16) + fstd $f25, UC_SIGCTX+SC_FPREGS+25*8($16) + fstd $f26, UC_SIGCTX+SC_FPREGS+26*8($16) + fstd $f27, UC_SIGCTX+SC_FPREGS+27*8($16) + fstd $f28, UC_SIGCTX+SC_FPREGS+28*8($16) + fstd $f29, UC_SIGCTX+SC_FPREGS+29*8($16) + fstd $f30, UC_SIGCTX+SC_FPREGS+30*8($16) + fstd $f31, UC_SIGCTX+SC_FPREGS+31*8($16) +#endif + rfpcr $f0 + ldi $1, 8 + fstd $f0, UC_SIGCTX+SC_FPCR($16) + + /* The return address of getcontext is the restart pc. */ + stl $26, UC_SIGCTX+SC_PC($16) + + /* Userlevel always has a processor status word of 8. */ + stl $1, UC_SIGCTX+SC_PS($16) + + /* Save registers around the syscall. We preserve $17 + for the benefit of swapcontext. */ + subl $30, 4*8, $30 + cfi_adjust_cfa_offset (4*8) + stl $0, 0($30) + cfi_rel_offset (64, 0) + stl $16, 8($30) + stl $17, 16($30) + + /* Save the current signal mask. Whee, there are three + copies of this in the sw_64 ucontext_t. */ +/* osf_sigprocmask change to rt_sigprocmask */ +/* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */ + ldi $19, _NSIG8 + ldi $18, UC_SIGMASK($16) + ldi $17, 0 + ldi $16, SIG_BLOCK + + ldi $0, __NR_rt_sigprocmask + sys_call 0x83 + + ldl $16, 8($30) + ldl $17, 16($30) + + stl $18, UC_OSF_SIGMASK($16) + stl $18, UC_SIGCTX+SC_MASK($16) + + stl $31, UC_SIGMASK + 1*8($16) + stl $31, UC_SIGMASK + 2*8($16) + stl $31, UC_SIGMASK + 3*8($16) + stl $31, UC_SIGMASK + 4*8($16) + stl $31, UC_SIGMASK + 5*8($16) + stl $31, UC_SIGMASK + 6*8($16) + stl $31, UC_SIGMASK + 7*8($16) + stl $31, UC_SIGMASK + 8*8($16) + stl $31, UC_SIGMASK + 9*8($16) + stl $31, UC_SIGMASK +10*8($16) + stl $31, UC_SIGMASK +11*8($16) + stl $31, UC_SIGMASK +12*8($16) + stl $31, UC_SIGMASK +13*8($16) + stl $31, UC_SIGMASK +14*8($16) + stl $31, UC_SIGMASK +15*8($16) + + ldl $0, 0($30) + addl $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/sysdeps/unix/sysv/linux/sw_64/getdents.c b/sysdeps/unix/sysv/linux/sw_64/getdents.c new file mode 100644 index 00000000..16ca198a --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/getdents.c @@ -0,0 +1,18 @@ +/* Although Sw_64 defines _DIRENT_MATCHES_DIRENT64, 'struct dirent' and + 'struct dirent64' have slight different internal layout with d_ino + being a __ino_t on non-LFS version with an extra __pad field which should + be zeroed. */ + +#include +#undef _DIRENT_MATCHES_DIRENT64 +#define _DIRENT_MATCHES_DIRENT64 0 +#ifdef SW_64 +# define DIRENT_SET_DP_INO(dp, value) \ + do \ + { \ + (dp)->d_ino = (value); \ + (dp)->__pad = 0; \ + } \ + while (0) +#endif +#include diff --git a/sysdeps/unix/sysv/linux/sw_64/getdents64.c b/sysdeps/unix/sysv/linux/sw_64/getdents64.c new file mode 100644 index 00000000..f24cc638 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/getdents64.c @@ -0,0 +1,10 @@ +/* Although Sw_64 defines _DIRENT_MATCHES_DIRENT64, 'struct dirent' and + 'struct dirent64' have slight different internal layout with d_ino + being a __ino_t on non-LFS version with an extra __pad field which should + be zeroed. */ + +#include +/* It suppresses the __getdents64 to __getdents alias. */ +#undef _DIRENT_MATCHES_DIRENT64 +#define _DIRENT_MATCHES_DIRENT64 0 +#include diff --git a/sysdeps/unix/sysv/linux/sw_64/getegid.S b/sysdeps/unix/sysv/linux/sw_64/getegid.S new file mode 100644 index 00000000..fe5bd51a --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/getegid.S @@ -0,0 +1,26 @@ +/* Copyright (C) 1991-2023 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, see + . */ + +#include + + +PSEUDO (__getegid, getxgid, 0) + MOVE (r1, r0) + ret +PSEUDO_END (__getegid) + +weak_alias (__getegid, getegid) diff --git a/sysdeps/unix/sysv/linux/sw_64/geteuid.S b/sysdeps/unix/sysv/linux/sw_64/geteuid.S new file mode 100644 index 00000000..fb8fd714 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/geteuid.S @@ -0,0 +1,26 @@ +/* Copyright (C) 1991-2023 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, see + . */ + +#include + + +PSEUDO (__geteuid, getxuid, 0) + MOVE (r1, r0) + ret +PSEUDO_END (__geteuid) + +weak_alias (__geteuid, geteuid) diff --git a/sysdeps/unix/sysv/linux/sw_64/gethostname.c b/sysdeps/unix/sysv/linux/sw_64/gethostname.c new file mode 100644 index 00000000..aeb3a957 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/gethostname.c @@ -0,0 +1,45 @@ +/* Copyright (C) 2001-2023 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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, see + . */ + +#include +#include +#include + +#include +#include + +int +__gethostname (char *name, size_t len) +{ + int result; + + result = INLINE_SYSCALL (gethostname, 2, name, 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/sysdeps/unix/sysv/linux/sw_64/getppid.S b/sysdeps/unix/sysv/linux/sw_64/getppid.S new file mode 100644 index 00000000..2107686d --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/getppid.S @@ -0,0 +1,26 @@ +/* Copyright (C) 1991-2023 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, see + . */ + +#include + + +PSEUDO (__getppid, getxpid, 0) + MOVE (r1, r0) + ret +PSEUDO_END (__getppid) + +weak_alias (__getppid, getppid) diff --git a/sysdeps/unix/sysv/linux/sw_64/getrlimit64.c b/sysdeps/unix/sysv/linux/sw_64/getrlimit64.c new file mode 100644 index 00000000..7d455c74 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/getrlimit64.c @@ -0,0 +1,54 @@ +/* Copyright (C) 2018-2023 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, see + . */ + +#define USE_VERSIONED_RLIMIT +#include +versioned_symbol (libc, __getrlimit, getrlimit, GLIBC_2_27); +versioned_symbol (libc, __getrlimit64, getrlimit64, GLIBC_2_27); + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_27) +/* RLIM64_INFINITY was supposed to be a glibc convention rather than + anything seen by the kernel, but it ended being passed to the kernel + through the prlimit64 syscall. Given that a lot of binaries with + the wrong constant value are in the wild, provide a wrapper function + fixing the value after the syscall. */ +# define OLD_RLIM64_INFINITY 0x7fffffffffffffffULL + +int attribute_compat_text_section +__old_getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits) +{ + struct rlimit64 krlimits; + + if (__getrlimit64 (resource, &krlimits) < 0) + return -1; + + if (krlimits.rlim_cur == RLIM64_INFINITY) + rlimits->rlim_cur = OLD_RLIM64_INFINITY; + else + rlimits->rlim_cur = krlimits.rlim_cur; + if (krlimits.rlim_max == RLIM64_INFINITY) + rlimits->rlim_max = OLD_RLIM64_INFINITY; + else + rlimits->rlim_max = krlimits.rlim_max; + + return 0; +} + +strong_alias (__old_getrlimit64, __old_getrlimit) + compat_symbol (libc, __old_getrlimit, getrlimit, GLIBC_2_0); +compat_symbol (libc, __old_getrlimit64, getrlimit64, GLIBC_2_1); +#endif diff --git a/sysdeps/unix/sysv/linux/sw_64/gettimeofday.c b/sysdeps/unix/sysv/linux/sw_64/gettimeofday.c new file mode 100644 index 00000000..d6fcc00a --- /dev/null +++ b/sysdeps/unix/sysv/linux/sw_64/gettimeofday.c @@ -0,0 +1,26 @@ +/* gettimeofday -- Get the current time of day. Linux/Sw_64/tv64 version. + Copyright (C) 2019-2023 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, see + . */ + +/* We can use the generic implementation, but we have to override its + default symbol version. */ +#define SET_VERSION +#include