From 847242451c6e53156abead29aa47a3f56cfcc928 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sun, 2 Jun 1996 18:50:07 +0000 Subject: Wed May 29 00:57:37 1996 David Mosberger-Tang * time/Makefile (tests): Add test-tz. * time/test-tz.c: New test. * time/clocktest.c: Rewrite to test more meaningfully. * sysdeps/unix/sysv/linux/syscalls.list: Add bdflush, create_module, delete_module, get_kernel_syms, init_module, klogctl. * sysdeps/unix/sysv/linux/sys/param.h (MAXSYMLINKS): Define as 5 instead of SYMLOOP_MAX, which is nowhere to be found. * sysdeps/unix/sysv/linux/sys/msq_buf.h, sysdeps/unix/sysv/linux/sys/sem_buf.h, sysdeps/unix/sysv/linux/sys/shm_buf.h [__USE_MISC]: Add more control ops and datastructures. * sysdeps/unix/sysv/linux/sys/io.h: New file declaring low-level I/O related functions. * sysdeps/unix/sysv/linux/sys/kdaemon.h: New file declaring kernel daemon related functions/operations. * sysdeps/unix/sysv/linux/sys/klog.h: New file declaring kernel logging related functions/operations. * sysdeps/unix/sysv/linux/sys/module.h: New file declaring kernel module related functions/operations. * sysdeps/unix/sysv/linux/speed.c: Only do "mention this twice" hack for non-Alpha based Linux systems. * sysdeps/unix/sysv/linux/alpha/speed.c: Remove. * sysdeps/unix/sysv/linux/Makefile (headers): Add sys/module.h, sys/io.h, sys/klog.h, and sys/kdaemon.h. * sysdeps/unix/sysdep.h (END): Define empty END macro for platforms that don't need some sort of end directive at the end of functions. * sysdeps/unix/make-syscalls.sh: Emit END($strong) at end of syscall wrapper to allow correct generation of debugging information. * sysdeps/unix/alpha/sysdep.h (END): Redefine to use .end directive for both ELF and ECOFF. (ret): Delete macro. It was a dangerous macro and unnecessary since the Alpha assemblers recognizes "ret" as a macro themselves. * sysdeps/gnu/utmpbits.h (struct utmp): Move ut_tv behind ut_session to guarantee long alignment. This is important for Linux/Alpha since ut_tv.tv_sec is 32 bits and time_t is 64 bits. This will all get cleaned up as programs start to use ut_tv instead ut_time. * sysdeps/alpha/divrem.h: Include instead of <*/regdef.h>. * sysdeps/alpha/bsd-_setjmp.S (setjmp): Renamed entry point to _setjmp. * sysdeps/alpha/_mcount.S, sysdeps/alpha/bb_init_func.S, sysdeps/alpha/bsd-_setjmp.S, sysdeps/alpha/bsd-setjmp.S, sysdeps/alpha/copysign.S, sysdeps/alpha/divrem.h, sysdeps/alpha/fabs.S, sysdeps/alpha/ffs.S, sysdeps/alpha/htonl.S, sysdeps/alpha/htons.S, sysdeps/alpha/memchr.S, sysdeps/alpha/setjmp.S, sysdeps/alpha/strlen.S, sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S, sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S, sysdeps/unix/sysv/linux/alpha/llseek.S, sysdeps/unix/sysv/linux/alpha/pipe.S, sysdeps/unix/sysv/linux/alpha/sigsuspend.S, sysdeps/unix/sysv/linux/alpha/sysdep.S: Use END macro instead of .end directive. * csu/initfini.c (_fini): Tell gcc that _fini is not a leaf function by having it contain a dummy function call. * configure.in (config_machine): Don't make ELF the default for Linux/Alpha just yet (use --with-elf instead). (.init/.fini check): Generate .text to ensure function start and end are in same section. * sysdeps/unix/bsd/osf/alpha/brk.S, sysdeps/unix/sysv/linux/alpha/brk.S (__curbrk): Store the entire break value, not just the low 32 bits to accomodate large memories. Tue May 28 10:46:04 1996 Richard Henderson * sysdeps/unix/sysv/linux/alpha/brk.S: Rather than attempt to dynamically resolve _end for initializing __curbrk, support the brk(0) query idiom. * sysdeps/alpha/bb_init_func.S: Don't make `init' an external symbol. * sysdeps/alpha/bsd-_setjmp.S: The function is _setjmp not setjmp. Sun May 26 22:17:38 1996 Richard Henderson * stdlib/lcong48_r.c, stdlib/seed48_r.c, stdlib/strtod.c, stdlib/strtol.c: Include for mem* and str* fns used. Thu May 23 02:15:56 1996 David Mosberger-Tang * sysdeps/unix/sysv/linux/Makefile (headers): Add sys/io.h, sys/klog.h, and sys/kdaemon.h. * sysdeps/unix/sysv/linux/sys/io.h: New file. * sysdeps/unix/sysv/linux/sys/klog.h: Ditto. * sysdeps/unix/sysv/linux/sys/kdaemon.h: Ditto. * sysdeps/unix/alpha/sysdep.h (ret): Remove macro. It is dangerous and unnecessary since both OSF/1 as and gas define "ret" as a pseudo-instruction. Sat Jun 1 17:18:21 1996 Roland McGrath * time/tzset.c (__tzset): Clear tz_rules name pointers after freeing them. Bug found by David Mosberger-Tang. * sysdeps/posix/tempname.c (__stdio_gen_tempname): Use __ptr_t instead of PTR. * extra-lib.mk (extra-objs): Use patsubst intead of $(A:=B) syntax to work around Make bug when A contains var ref. Fri May 31 18:27:52 1996 Roland McGrath * string/string.h [__USE_MISC]: Declare basename; OSF/1 puts it here. * sysdeps/unix/sysv/linux/syscalls.list (getpgid, setpgid): Define __ strong names and [gs]etpgid as weak aliases. * math/math_private.h (GET_LDOUBLE_EXP): Add missing backslash. --- sysdeps/unix/sysv/linux/sys/io.h | 39 +++++++++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/sys/kdaemon.h | 9 ++++++++ sysdeps/unix/sysv/linux/sys/klog.h | 10 +++++++++ sysdeps/unix/sysv/linux/sys/module.h | 36 ++++++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/sys/msq_buf.h | 22 ++++++++++++++++++++ sysdeps/unix/sysv/linux/sys/param.h | 2 +- sysdeps/unix/sysv/linux/sys/sem_buf.h | 21 +++++++++++++++++++ sysdeps/unix/sysv/linux/sys/shm_buf.h | 37 +++++++++++++++++++++++++++++---- 8 files changed, 171 insertions(+), 5 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/sys/io.h create mode 100644 sysdeps/unix/sysv/linux/sys/kdaemon.h create mode 100644 sysdeps/unix/sysv/linux/sys/klog.h create mode 100644 sysdeps/unix/sysv/linux/sys/module.h (limited to 'sysdeps/unix/sysv/linux/sys') diff --git a/sysdeps/unix/sysv/linux/sys/io.h b/sysdeps/unix/sysv/linux/sys/io.h new file mode 100644 index 0000000000..d44850f025 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sys/io.h @@ -0,0 +1,39 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifndef _SYS_IO_H +#define _SYS_IO_H + +#include + +/* If TURN_ON is TRUE, request for permission to do direct i/o on the + port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O + permission off for that range. This call requires root privileges. + + Portability note: not all Linux platforms support this call. Most + platforms based on the PC I/O architecture probably will, however. + E.g., Linux/Alpha for Alpha PCs supports this. */ +extern int ioperm __P((unsigned long __from, unsigned long __num, + int __turn_on)); + +/* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to + access any I/O port is granted. This call requires root + privileges. */ +extern int iopl __P((int __level)); + +#endif /* _SYS_IO_H */ diff --git a/sysdeps/unix/sysv/linux/sys/kdaemon.h b/sysdeps/unix/sysv/linux/sys/kdaemon.h new file mode 100644 index 0000000000..fce169fe6b --- /dev/null +++ b/sysdeps/unix/sysv/linux/sys/kdaemon.h @@ -0,0 +1,9 @@ +/* Interfaces to control the various kernel daemons. */ + +#ifndef _SYS_KDAEMON_H +#define _SYS_KDAEMON_H + +/* Start, flush, or tune the kernel's buffer flushing daemon. */ +extern int bdflush (int func, long data); + +#endif /* _SYS_KDAEMON_H */ diff --git a/sysdeps/unix/sysv/linux/sys/klog.h b/sysdeps/unix/sysv/linux/sys/klog.h new file mode 100644 index 0000000000..b8a39d6492 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sys/klog.h @@ -0,0 +1,10 @@ +#ifndef _SYS_KLOG_H +#define _SYS_KLOG_H + +/* Control the kernel's logging facility. This corresponds exactly to + the kernel's syslog system call, but that name is easily confused + with the user-level syslog facility, which is something completely + different. */ +extern int klogctl __P((int type, char *bufp, int len)); + +#endif /* _SYS_KLOG_H */ diff --git a/sysdeps/unix/sysv/linux/sys/module.h b/sysdeps/unix/sysv/linux/sys/module.h new file mode 100644 index 0000000000..5c4dbcea37 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sys/module.h @@ -0,0 +1,36 @@ +#ifndef _SYS_MODULE_H +#define _SYS_MODULE_H + +#include + +#include + +/* Return number of kernel symbols if TABLE == NULL, otherwise, return + kernel symbols in TABLE. TABLE must be large enough to hold all + kernel symbols. */ +extern int get_kernel_syms __P((struct kernel_sym * table)); + +/* Create a new module of name MODULE_NAME and of size SIZE bytes. + The return address is the starting address of the new module or -1L + if the module cannot be created (the return value needs to be cast + to (long) to detect the error condition). */ +extern unsigned long create_module __P((const char * module_name, + size_t size)); + +/* Initialize the module called MODULE_NAME with the CONTENTSSIZE + bytes starting at address CONTENTS. CONTENTS normally contains the + text and data segment of the module (the bss is implicity zeroed). + After copying the contents, the function pointed to by + ROUTINES.init is executed. When the module is no longer needed, + ROUTINES.cleanup is executed. SYMTAB is NULL if the module does + not want to export symbols by itself, or a pointer to a symbol + table if the module wants to register its own symbols. */ +extern int init_module __P((const char * module_name, + const void * contents, size_t contentssize, + struct mod_routines * routines, + struct symbol_table * symtab)); + +/* Delete the module named MODULE_NAME from the kernel. */ +extern int delete_module __P((const char *module_name)); + +#endif /* _SYS_MODULE_H */ diff --git a/sysdeps/unix/sysv/linux/sys/msq_buf.h b/sysdeps/unix/sysv/linux/sys/msq_buf.h index 92a52d515d..6e4435dc23 100644 --- a/sysdeps/unix/sysv/linux/sys/msq_buf.h +++ b/sysdeps/unix/sysv/linux/sys/msq_buf.h @@ -49,6 +49,28 @@ struct msqid_ds __pid_t msg_lrpid; /* pid of last msgrcv() */ }; +#ifdef __USE_MISC + +#define msg_cbytes __msg_cbytes + +/* ipcs ctl commands */ +#define MSG_STAT 11 +#define MSG_INFO 12 + +/* buffer for msgctl calls IPC_INFO, MSG_INFO */ +struct msginfo { + int msgpool; + int msgmap; + int msgmax; + int msgmnb; + int msgmni; + int msgssz; + int msgtql; + ushort msgseg; +}; + +#endif /* __USE_MISC */ + __END_DECLS #endif /* sys/msq_buf.h */ diff --git a/sysdeps/unix/sysv/linux/sys/param.h b/sysdeps/unix/sysv/linux/sys/param.h index 4950d58d38..e4a8406e44 100644 --- a/sysdeps/unix/sysv/linux/sys/param.h +++ b/sysdeps/unix/sysv/linux/sys/param.h @@ -29,7 +29,7 @@ Boston, MA 02111-1307, USA. */ #ifndef NGROUPS #define NGROUPS NGROUPS_MAX #endif -#define MAXSYMLINKS SYMLOOP_MAX +#define MAXSYMLINKS 5 #define CANBSIZ MAX_CANON #define NCARGS ARG_MAX #define MAXPATHLEN PATH_MAX diff --git a/sysdeps/unix/sysv/linux/sys/sem_buf.h b/sysdeps/unix/sysv/linux/sys/sem_buf.h index d93002ad6e..bfac9141bf 100644 --- a/sysdeps/unix/sysv/linux/sys/sem_buf.h +++ b/sysdeps/unix/sysv/linux/sys/sem_buf.h @@ -60,6 +60,27 @@ union semun struct seminfo *__buf; /* buffer for IPC_INFO */ }; +#ifdef __USE_MISC + +/* ipcs ctl cmds */ +#define SEM_STAT 18 +#define SEM_INFO 19 + +struct seminfo { + int semmap; + int semmni; + int semmns; + int semmnu; + int semmsl; + int semopm; + int semume; + int semusz; + int semvmx; + int semaem; +}; + +#endif /* __USE_MISC */ + __END_DECLS #endif /* sys/sem_buf.h */ diff --git a/sysdeps/unix/sysv/linux/sys/shm_buf.h b/sysdeps/unix/sysv/linux/sys/shm_buf.h index fa1e8235d8..048aa64dc2 100644 --- a/sysdeps/unix/sysv/linux/sys/shm_buf.h +++ b/sysdeps/unix/sysv/linux/sys/shm_buf.h @@ -38,11 +38,11 @@ __BEGIN_DECLS /* Data structure describing a set of semaphores. */ struct shmid_ds { - struct ipc_perm sem_perm; /* operation permisson struct */ + struct ipc_perm shm_perm; /* operation permisson struct */ int shm_segsz; /* size of segment in bytes */ - __time_t sem_atime; /* time of last shmat() */ - __time_t sem_dtime; /* time of last shmdt() */ - __time_t sem_ctime; /* time of last change by shmctl() */ + __time_t shm_atime; /* time of last shmat() */ + __time_t shm_dtime; /* time of last shmdt() */ + __time_t shm_ctime; /* time of last change by shmctl() */ __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ unsigned short int shm_nattch; /* number of current attaches */ @@ -51,6 +51,35 @@ struct shmid_ds struct vm_area_struct *__attaches; /* descriptors for attaches */ }; +#ifdef __USE_MISC + +/* ipcs ctl commands */ +#define SHM_STAT 13 +#define SHM_INFO 14 + +/* shm_mode upper byte flags */ +#define SHM_DEST 01000 /* segment will be destroyed on last detach */ +#define SHM_LOCKED 02000 /* segment will not be swapped */ + +struct shminfo { + int shmmax; + int shmmin; + int shmmni; + int shmseg; + int shmall; +}; + +struct shm_info { + int used_ids; + ulong shm_tot; /* total allocated shm */ + ulong shm_rss; /* total resident shm */ + ulong shm_swp; /* total swapped shm */ + ulong swap_attempts; + ulong swap_successes; +}; + +#endif /* __USE_MISC */ + __END_DECLS #endif /* sys/shm_buf.h */ -- cgit 1.4.1