From 166475ad3db4bed5e8ee5b5c97816df365c10da1 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 17 May 2002 18:33:07 +0000 Subject: 2002-05-15 Ralf Corsepius * configure.ac: Remove lib. --- c/src/ChangeLog | 4 + c/src/configure.ac | 1 - c/src/lib/Makefile.am | 91 -- c/src/lib/configure.ac | 39 - c/src/lib/include/.cvsignore | 2 - c/src/lib/include/chain.h | 361 ------- c/src/lib/include/clockdrv.h | 50 - c/src/lib/include/console.h | 68 -- c/src/lib/include/inttypes.h | 22 - c/src/lib/include/iosupp.h | 43 - c/src/lib/include/motorola/.cvsignore | 2 - c/src/lib/include/motorola/mc68230.h | 70 -- c/src/lib/include/motorola/mc68681.h | 306 ------ c/src/lib/include/ringbuf.h | 53 -- c/src/lib/include/rtc.h | 38 - c/src/lib/include/rtems/.cvsignore | 2 - c/src/lib/include/rtems/assoc.h | 42 - c/src/lib/include/rtems/error.h | 47 - c/src/lib/include/rtems/libcsupport.h | 43 - c/src/lib/include/rtems/libio.h | 575 ------------ c/src/lib/include/rtems/libio_.h | 239 ----- c/src/lib/include/rtems/termiostypes.h | 177 ---- c/src/lib/include/spurious.h | 38 - c/src/lib/include/stdint.h | 30 - c/src/lib/include/sys/.cvsignore | 2 - c/src/lib/include/sys/cdefs.h | 177 ---- c/src/lib/include/sys/filio.h | 59 -- c/src/lib/include/sys/ioccom.h | 95 -- c/src/lib/include/sys/ioctl.h | 77 -- c/src/lib/include/sys/sockio.h | 92 -- c/src/lib/include/sys/termios.h | 198 ---- c/src/lib/include/sys/ttycom.h | 141 --- c/src/lib/include/sys/utime.h | 25 - c/src/lib/include/sys/utsname.h | 56 -- c/src/lib/include/timerdrv.h | 39 - c/src/lib/include/vmeintr.h | 57 -- c/src/lib/include/zilog/.cvsignore | 2 - c/src/lib/include/zilog/z8036.h | 108 --- c/src/lib/include/zilog/z8530.h | 98 -- c/src/lib/include/zilog/z8536.h | 111 --- c/src/lib/libc/.cvsignore | 6 - c/src/lib/libc/CASES | 23 - c/src/lib/libc/Makefile.am | 89 -- c/src/lib/libc/README | 37 - c/src/lib/libc/TODO | 14 - c/src/lib/libc/__brk.c | 32 - c/src/lib/libc/__getpid.c | 18 - c/src/lib/libc/__gettod.c | 120 --- c/src/lib/libc/__sbrk.c | 32 - c/src/lib/libc/__times.c | 89 -- c/src/lib/libc/access.c | 49 - c/src/lib/libc/assoc.c | 254 ----- c/src/lib/libc/assocnamebad.c | 41 - c/src/lib/libc/base_fs.c | 119 --- c/src/lib/libc/cfgetispeed.c | 32 - c/src/lib/libc/cfgetospeed.c | 32 - c/src/lib/libc/cfsetispeed.c | 40 - c/src/lib/libc/cfsetospeed.c | 40 - c/src/lib/libc/chdir.c | 61 -- c/src/lib/libc/chmod.c | 56 -- c/src/lib/libc/chown.c | 49 - c/src/lib/libc/chroot.c | 51 - c/src/lib/libc/close.c | 58 -- c/src/lib/libc/closedir.c | 74 -- c/src/lib/libc/creat.c | 19 - c/src/lib/libc/ctermid.c | 37 - c/src/lib/libc/dup.c | 26 - c/src/lib/libc/dup2.c | 52 -- c/src/lib/libc/envlock.c | 108 --- c/src/lib/libc/error.c | 213 ----- c/src/lib/libc/eval.c | 81 -- c/src/lib/libc/fchdir.c | 74 -- c/src/lib/libc/fchmod.c | 49 - c/src/lib/libc/fcntl.c | 155 --- c/src/lib/libc/fdatasync.c | 42 - c/src/lib/libc/fpathconf.c | 87 -- c/src/lib/libc/fs_null_handlers.c | 41 - c/src/lib/libc/fstat.c | 80 -- c/src/lib/libc/fsync.c | 45 - c/src/lib/libc/ftruncate.c | 58 -- c/src/lib/libc/getcwd.c | 287 ------ c/src/lib/libc/getdents.c | 63 -- c/src/lib/libc/getgrent.c | 193 ---- c/src/lib/libc/getpwent.c | 248 ----- c/src/lib/libc/gxx_wrappers.c | 218 ----- c/src/lib/libc/hosterr.c | 51 - c/src/lib/libc/ioctl.c | 60 -- c/src/lib/libc/isatty.c | 31 - c/src/lib/libc/libio.c | 335 ------- c/src/lib/libc/libio_sockets.c | 75 -- c/src/lib/libc/link.c | 105 --- c/src/lib/libc/lseek.c | 102 -- c/src/lib/libc/lstat.c | 18 - c/src/lib/libc/malloc.c | 426 --------- c/src/lib/libc/mallocfreespace.c | 44 - c/src/lib/libc/mkdir.c | 31 - c/src/lib/libc/mkfifo.c | 28 - c/src/lib/libc/mknod.c | 74 -- c/src/lib/libc/mount.c | 274 ------ c/src/lib/libc/newlibc.c | 334 ------- c/src/lib/libc/no_libc.c | 59 -- c/src/lib/libc/no_posix.c | 105 --- c/src/lib/libc/open.c | 215 ----- c/src/lib/libc/opendir.c | 89 -- c/src/lib/libc/pathconf.c | 41 - c/src/lib/libc/pipe.c | 26 - c/src/lib/libc/printk.c | 150 --- c/src/lib/libc/privateenv.c | 81 -- c/src/lib/libc/read.c | 71 -- c/src/lib/libc/readdir.c | 90 -- c/src/lib/libc/readlink.c | 57 -- c/src/lib/libc/rewinddir.c | 39 - c/src/lib/libc/rmdir.c | 70 -- c/src/lib/libc/scandir.c | 168 ---- c/src/lib/libc/seekdir.c | 44 - c/src/lib/libc/stat.c | 104 --- c/src/lib/libc/symlink.c | 47 - c/src/lib/libc/tcdrain.c | 36 - c/src/lib/libc/tcflow.c | 34 - c/src/lib/libc/tcflush.c | 34 - c/src/lib/libc/tcgetattr.c | 36 - c/src/lib/libc/tcgetprgrp.c | 34 - c/src/lib/libc/tcsendbreak.c | 34 - c/src/lib/libc/tcsetattr.c | 51 - c/src/lib/libc/tcsetpgrp.c | 34 - c/src/lib/libc/telldir.c | 47 - c/src/lib/libc/termios.c | 1502 ------------------------------ c/src/lib/libc/termiosinitialize.c | 54 -- c/src/lib/libc/termiosreserveresources.c | 37 - c/src/lib/libc/truncate.c | 44 - c/src/lib/libc/ttyname.c | 78 -- c/src/lib/libc/ttyname_r.c | 119 --- c/src/lib/libc/umask.c | 33 - c/src/lib/libc/unixlibc.c | 53 -- c/src/lib/libc/unlink.c | 78 -- c/src/lib/libc/unmount.c | 221 ----- c/src/lib/libc/utime.c | 46 - c/src/lib/libc/utsname.c | 53 -- c/src/lib/libc/write.c | 78 -- 139 files changed, 4 insertions(+), 13448 deletions(-) delete mode 100644 c/src/lib/Makefile.am delete mode 100644 c/src/lib/configure.ac delete mode 100644 c/src/lib/include/.cvsignore delete mode 100644 c/src/lib/include/chain.h delete mode 100644 c/src/lib/include/clockdrv.h delete mode 100644 c/src/lib/include/console.h delete mode 100644 c/src/lib/include/inttypes.h delete mode 100644 c/src/lib/include/iosupp.h delete mode 100644 c/src/lib/include/motorola/.cvsignore delete mode 100644 c/src/lib/include/motorola/mc68230.h delete mode 100644 c/src/lib/include/motorola/mc68681.h delete mode 100644 c/src/lib/include/ringbuf.h delete mode 100644 c/src/lib/include/rtc.h delete mode 100644 c/src/lib/include/rtems/.cvsignore delete mode 100644 c/src/lib/include/rtems/assoc.h delete mode 100644 c/src/lib/include/rtems/error.h delete mode 100644 c/src/lib/include/rtems/libcsupport.h delete mode 100644 c/src/lib/include/rtems/libio.h delete mode 100644 c/src/lib/include/rtems/libio_.h delete mode 100644 c/src/lib/include/rtems/termiostypes.h delete mode 100644 c/src/lib/include/spurious.h delete mode 100644 c/src/lib/include/stdint.h delete mode 100644 c/src/lib/include/sys/.cvsignore delete mode 100644 c/src/lib/include/sys/cdefs.h delete mode 100644 c/src/lib/include/sys/filio.h delete mode 100644 c/src/lib/include/sys/ioccom.h delete mode 100644 c/src/lib/include/sys/ioctl.h delete mode 100644 c/src/lib/include/sys/sockio.h delete mode 100644 c/src/lib/include/sys/termios.h delete mode 100644 c/src/lib/include/sys/ttycom.h delete mode 100644 c/src/lib/include/sys/utime.h delete mode 100644 c/src/lib/include/sys/utsname.h delete mode 100644 c/src/lib/include/timerdrv.h delete mode 100644 c/src/lib/include/vmeintr.h delete mode 100644 c/src/lib/include/zilog/.cvsignore delete mode 100644 c/src/lib/include/zilog/z8036.h delete mode 100644 c/src/lib/include/zilog/z8530.h delete mode 100644 c/src/lib/include/zilog/z8536.h delete mode 100644 c/src/lib/libc/.cvsignore delete mode 100644 c/src/lib/libc/CASES delete mode 100644 c/src/lib/libc/Makefile.am delete mode 100644 c/src/lib/libc/README delete mode 100644 c/src/lib/libc/TODO delete mode 100644 c/src/lib/libc/__brk.c delete mode 100644 c/src/lib/libc/__getpid.c delete mode 100644 c/src/lib/libc/__gettod.c delete mode 100644 c/src/lib/libc/__sbrk.c delete mode 100644 c/src/lib/libc/__times.c delete mode 100644 c/src/lib/libc/access.c delete mode 100644 c/src/lib/libc/assoc.c delete mode 100644 c/src/lib/libc/assocnamebad.c delete mode 100644 c/src/lib/libc/base_fs.c delete mode 100644 c/src/lib/libc/cfgetispeed.c delete mode 100644 c/src/lib/libc/cfgetospeed.c delete mode 100644 c/src/lib/libc/cfsetispeed.c delete mode 100644 c/src/lib/libc/cfsetospeed.c delete mode 100644 c/src/lib/libc/chdir.c delete mode 100644 c/src/lib/libc/chmod.c delete mode 100644 c/src/lib/libc/chown.c delete mode 100644 c/src/lib/libc/chroot.c delete mode 100644 c/src/lib/libc/close.c delete mode 100644 c/src/lib/libc/closedir.c delete mode 100644 c/src/lib/libc/creat.c delete mode 100644 c/src/lib/libc/ctermid.c delete mode 100644 c/src/lib/libc/dup.c delete mode 100644 c/src/lib/libc/dup2.c delete mode 100644 c/src/lib/libc/envlock.c delete mode 100644 c/src/lib/libc/error.c delete mode 100644 c/src/lib/libc/eval.c delete mode 100644 c/src/lib/libc/fchdir.c delete mode 100644 c/src/lib/libc/fchmod.c delete mode 100644 c/src/lib/libc/fcntl.c delete mode 100644 c/src/lib/libc/fdatasync.c delete mode 100644 c/src/lib/libc/fpathconf.c delete mode 100644 c/src/lib/libc/fs_null_handlers.c delete mode 100644 c/src/lib/libc/fstat.c delete mode 100644 c/src/lib/libc/fsync.c delete mode 100644 c/src/lib/libc/ftruncate.c delete mode 100644 c/src/lib/libc/getcwd.c delete mode 100644 c/src/lib/libc/getdents.c delete mode 100644 c/src/lib/libc/getgrent.c delete mode 100644 c/src/lib/libc/getpwent.c delete mode 100644 c/src/lib/libc/gxx_wrappers.c delete mode 100644 c/src/lib/libc/hosterr.c delete mode 100644 c/src/lib/libc/ioctl.c delete mode 100644 c/src/lib/libc/isatty.c delete mode 100644 c/src/lib/libc/libio.c delete mode 100644 c/src/lib/libc/libio_sockets.c delete mode 100644 c/src/lib/libc/link.c delete mode 100644 c/src/lib/libc/lseek.c delete mode 100644 c/src/lib/libc/lstat.c delete mode 100644 c/src/lib/libc/malloc.c delete mode 100644 c/src/lib/libc/mallocfreespace.c delete mode 100644 c/src/lib/libc/mkdir.c delete mode 100644 c/src/lib/libc/mkfifo.c delete mode 100644 c/src/lib/libc/mknod.c delete mode 100644 c/src/lib/libc/mount.c delete mode 100644 c/src/lib/libc/newlibc.c delete mode 100644 c/src/lib/libc/no_libc.c delete mode 100644 c/src/lib/libc/no_posix.c delete mode 100644 c/src/lib/libc/open.c delete mode 100644 c/src/lib/libc/opendir.c delete mode 100644 c/src/lib/libc/pathconf.c delete mode 100644 c/src/lib/libc/pipe.c delete mode 100644 c/src/lib/libc/printk.c delete mode 100644 c/src/lib/libc/privateenv.c delete mode 100644 c/src/lib/libc/read.c delete mode 100644 c/src/lib/libc/readdir.c delete mode 100644 c/src/lib/libc/readlink.c delete mode 100644 c/src/lib/libc/rewinddir.c delete mode 100644 c/src/lib/libc/rmdir.c delete mode 100644 c/src/lib/libc/scandir.c delete mode 100644 c/src/lib/libc/seekdir.c delete mode 100644 c/src/lib/libc/stat.c delete mode 100644 c/src/lib/libc/symlink.c delete mode 100644 c/src/lib/libc/tcdrain.c delete mode 100644 c/src/lib/libc/tcflow.c delete mode 100644 c/src/lib/libc/tcflush.c delete mode 100644 c/src/lib/libc/tcgetattr.c delete mode 100644 c/src/lib/libc/tcgetprgrp.c delete mode 100644 c/src/lib/libc/tcsendbreak.c delete mode 100644 c/src/lib/libc/tcsetattr.c delete mode 100644 c/src/lib/libc/tcsetpgrp.c delete mode 100644 c/src/lib/libc/telldir.c delete mode 100644 c/src/lib/libc/termios.c delete mode 100644 c/src/lib/libc/termiosinitialize.c delete mode 100644 c/src/lib/libc/termiosreserveresources.c delete mode 100644 c/src/lib/libc/truncate.c delete mode 100644 c/src/lib/libc/ttyname.c delete mode 100644 c/src/lib/libc/ttyname_r.c delete mode 100644 c/src/lib/libc/umask.c delete mode 100644 c/src/lib/libc/unixlibc.c delete mode 100644 c/src/lib/libc/unlink.c delete mode 100644 c/src/lib/libc/unmount.c delete mode 100644 c/src/lib/libc/utime.c delete mode 100644 c/src/lib/libc/utsname.c delete mode 100644 c/src/lib/libc/write.c (limited to 'c/src') diff --git a/c/src/ChangeLog b/c/src/ChangeLog index f7c92b2156..1b486b7ea1 100644 --- a/c/src/ChangeLog +++ b/c/src/ChangeLog @@ -1,3 +1,7 @@ +2002-05-15 Ralf Corsepius + + * configure.ac: Remove lib. + 2002-05-14 Ralf Corsepius * config-ml.in: Take out arm and sh variants RTEMS does not support. diff --git a/c/src/configure.ac b/c/src/configure.ac index a79cc2f1e2..c140d88dda 100644 --- a/c/src/configure.ac +++ b/c/src/configure.ac @@ -33,7 +33,6 @@ if test x"$multilib" = x"no"; then AC_CONFIG_SUBDIRS(exec) fi AC_CONFIG_SUBDIRS(optman) -AC_CONFIG_SUBDIRS(lib) AC_CONFIG_SUBDIRS(lib/libcpu) AC_CONFIG_SUBDIRS(libblock) AC_CONFIG_SUBDIRS(lib/libbsp) diff --git a/c/src/lib/Makefile.am b/c/src/lib/Makefile.am deleted file mode 100644 index fd44699989..0000000000 --- a/c/src/lib/Makefile.am +++ /dev/null @@ -1,91 +0,0 @@ -## -## $Id$ -## - -ACLOCAL_AMFLAGS = -I ../../../aclocal - -include $(top_srcdir)/../../../automake/multilib.am - -SUBDIRS = . libc - -include_HEADERS = include/chain.h include/console.h include/clockdrv.h \ - include/iosupp.h include/ringbuf.h include/rtc.h \ - include/spurious.h include/timerdrv.h include/vmeintr.h - -LIBC_HFILES = include/stdint.h include/inttypes.h -include_HEADERS += $(LIBC_HFILES) - -PREINSTALL_FILES = $(PROJECT_INCLUDE) \ - $(include_HEADERS:include/%=$(PROJECT_INCLUDE)/%) - -$(PROJECT_INCLUDE): - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/motorola: - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/rtems: - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/sys: - @$(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/zilog: - @$(mkinstalldirs) $@ - -$(PROJECT_INCLUDE)/%.h: include/%.h - $(INSTALL_DATA) $< $@ - -## motorola - -include_motoroladir = $(includedir)/motorola - -include_motorola_HEADERS = include/motorola/mc68230.h include/motorola/mc68681.h - -PREINSTALL_FILES += $(PROJECT_INCLUDE)/motorola \ - $(include_motorola_HEADERS:include/%=$(PROJECT_INCLUDE)/%) - -## rtems -include_rtemsdir = $(includedir)/rtems - -include_rtems_HEADERS = \ - include/rtems/assoc.h include/rtems/error.h include/rtems/libcsupport.h \ - include/rtems/libio.h include/rtems/libio_.h \ - include/rtems/termiostypes.h - -PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems \ - $(include_rtems_HEADERS:include/%=$(PROJECT_INCLUDE)/%) - -## sys - -include_sysdir = $(includedir)/sys - - -if NEWLIB -NEWLIB_H_FILES = include/sys/termios.h include/sys/cdefs.h include/sys/utsname.h -endif - -include_sys_HEADERS = \ -include/sys/filio.h \ -include/sys/ioccom.h \ -include/sys/ioctl.h \ -include/sys/sockio.h \ -include/sys/termios.h \ -include/sys/ttycom.h \ -include/sys/utime.h \ -$(NEWLIB_H_FILES) - -PREINSTALL_FILES += $(PROJECT_INCLUDE)/sys \ - $(include_sys_HEADERS:include/%=$(PROJECT_INCLUDE)/%) - -## zilog - -include_zilogdir = $(includedir)/zilog - -include_zilog_HEADERS = include/zilog/z8036.h include/zilog/z8530.h \ - include/zilog/z8536.h - -PREINSTALL_FILES += $(PROJECT_INCLUDE)/zilog \ - $(include_zilog_HEADERS:include/%=$(PROJECT_INCLUDE)/%) - -## General stuff -all-local: $(PREINSTALL_FILES) - -include $(top_srcdir)/../../../automake/subdirs.am -include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/lib/configure.ac b/c/src/lib/configure.ac deleted file mode 100644 index 6b7379f1fc..0000000000 --- a/c/src/lib/configure.ac +++ /dev/null @@ -1,39 +0,0 @@ -## Process this file with autoconf to produce a configure script. -## -## $Id$ - -AC_PREREQ(2.52) -AC_INIT([rtems-c-src-lib],[_RTEMS_VERSION],[rtems-bugs@OARcorp.com]) -AC_CONFIG_SRCDIR([libc]) -RTEMS_TOP(../../..) -AC_CONFIG_AUX_DIR(../../..) - -RTEMS_CANONICAL_TARGET_CPU -AM_INIT_AUTOMAKE([no-define foreign 1.6]) -AM_MAINTAINER_MODE - -RTEMS_ENABLE_BARE - -RTEMS_ENV_RTEMSBSP - -RTEMS_CHECK_CPU -RTEMS_CANONICAL_HOST - -RTEMS_PROJECT_ROOT - -RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm]) -RTEMS_CANONICALIZE_TOOLS - -RTEMS_CHECK_NEWLIB -RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP) -RTEMS_CHECK_MULTIPROCESSING(RTEMS_BSP) - -AM_CONDITIONAL(UNIX,test x"$RTEMS_CPU" = x"unix") -AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes") - -AM_CONFIG_HEADER(libc/config.h) - -# Explicitly list all Makefiles here -AC_CONFIG_FILES([Makefile -libc/Makefile]) -AC_OUTPUT diff --git a/c/src/lib/include/.cvsignore b/c/src/lib/include/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/lib/include/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/lib/include/chain.h b/c/src/lib/include/chain.h deleted file mode 100644 index ab8bb42513..0000000000 --- a/c/src/lib/include/chain.h +++ /dev/null @@ -1,361 +0,0 @@ -/* chain.h - * - * This include file contains all the constants and structures associated - * with doubly linked chains. This file actually just provides an - * interface to the chain object in rtems. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $ld: - */ - -#ifndef __CHAIN_h -#define __CHAIN_h - -#include - -/* - * Chain_Initialize - * - * This routine initializes the_chain structure to manage the - * contiguous array of number_nodes nodes which starts at - * starting_address. Each node is of node_size bytes. - * - * Chain_Control *the_chain, * IN * - * void *starting_address, * IN * - * rtems_unsigned32 number_nodes, * IN * - * rtems_unsigned32 node_size * IN * - */ - -#define Chain_Initialize( the_chain, starting_address, \ - number_nodes, node_size ) \ - _Chain_Initialize( the_chain, starting_address, \ - number_nodes, node_size ) \ - - -/* - * Chain_Initialize_empty - * - * This routine initializes the specified chain to contain zero nodes. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Initialize_empty( the_chain ) \ - _Chain_Initialize_empty( the_chain ) - - -/* - * Chain_Are_nodes_equal - * - * This function returns TRUE if LEFT and RIGHT are equal, - * and FALSE otherwise. - * - * Chain_Node *left, * IN * - * Chain_Node *right * IN * - */ - -#define Chain_Are_nodes_equal( left, right ) \ - _Chain_Are_nodes_equal( left, right ) - - -/* - * Chain_Extract_unprotected - * - * This routine extracts the_node from the chain on which it resides. - * It does NOT disable interrupts to insure the atomicity of the - * extract operation. - * - * Chain_Node *the_node * IN * - */ - -#define Chain_Extract_unprotected( the_node ) \ - _Chain_Extract_unprotected( the_node ) - - -/* - * Chain_Extract - * - * This routine extracts the_node from the chain on which it resides. - * It disables interrupts to insure the atomicity of the - * extract operation. - * - * Chain_Node *the_node * IN * - */ - -#define Chain_Extract( the_node ) \ - _Chain_Extract( the_node ) - - -/* - * Chain_Get_unprotected - * - * This function removes the first node from the_chain and returns - * a pointer to that node. If the_chain is empty, then NULL is returned. - * It does NOT disable interrupts to insure the atomicity of the - * get operation. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Get_unprotected( the_chain ) \ - _Chain_Get_unprotected( the_chain ) - - -/* - * Chain_Get - * - * This function removes the first node from the_chain and returns - * a pointer to that node. If the_chain is empty, then NULL is returned. - * It disables interrupts to insure the atomicity of the - * get operation. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Get( the_chain ) \ - _Chain_Get( the_chain ) - - -/* - * Chain_Get_first_unprotected - * - * This function removes the first node from the_chain and returns - * a pointer to that node. It does NOT disable interrupts to insure - * the atomicity of the get operation. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Get_first_unprotected( the_chain ) \ - _Chain_Get_first_unprotected( the_chain ) - - -/* - * Chain_Insert_unprotected - * - * This routine inserts the_node on a chain immediately following - * after_node. It does NOT disable interrupts to insure the atomicity - * of the extract operation. - * - * Chain_Node *after_node, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Insert_unprotected( after_node, the_node ) \ - _Chain_Insert_unprotected( after_node, the_node ) - - -/* - * Chain_Insert - * - * This routine inserts the_node on a chain immediately following - * after_node. It disables interrupts to insure the atomicity - * of the extract operation. - * - * Chain_Node *after_node, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Insert( after_node, the_node ) \ - _Chain_Insert( after_node, the_node ) - - -/* - * Chain_Append_unprotected - * - * This routine appends the_node onto the end of the_chain. - * It does NOT disable interrupts to insure the atomicity of the - * append operation. - * - * Chain_Control *the_chain, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Append_unprotected( the_chain, the_node ) \ - _Chain_Append_unprotected( the_chain, the_node ) - - -/* - * Chain_Append - * - * This routine appends the_node onto the end of the_chain. - * It disables interrupts to insure the atomicity of the - * append operation. - * - * Chain_Control *the_chain, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Append( the_chain, the_node ) \ - _Chain_Append( the_chain, the_node ) - - -/* - * Chain_Prepend_unprotected - * - * This routine prepends the_node onto the front of the_chain. - * It does NOT disable interrupts to insure the atomicity of the - * prepend operation. - * - * Chain_Control *the_chain, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Prepend_unprotected( the_chain, the_node ) \ - _Chain_Prepend_unprotected( the_chain, the_node ) - - -/* - * Chain_Prepend - * - * This routine prepends the_node onto the front of the_chain. - * It disables interrupts to insure the atomicity of the - * prepend operation. - * - * Chain_Control *the_chain, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Prepend( the_chain, the_node ) \ - _Chain_Prepend( the_chain, the_node ) - - -/* - * Chain_Head - * - * This function returns a pointer to the first node on the chain. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Head( the_chain ) \ - _Chain_Head( the_chain ) - - -/* - * Chain_Tail - * - * This function returns a pointer to the last node on the chain. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Tail( the_chain ) \ - _Chain_Tail( the_chain ) - - -/* - * Chain_Is_head - * - * This function returns TRUE if the_node is the head of the_chain and - * FALSE otherwise. - * - * Chain_Control *the_chain, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Is_head( the_chain, the_node ) \ - _Chain_Is_head( the_chain, the_node ) - - -/* - * Chain_Is_tail - * - * This function returns TRUE if the_node is the tail of the_chain and - * FALSE otherwise. - * - * Chain_Control *the_chain, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Is_tail( the_chain, the_node ) \ - _Chain_Is_tail( the_chain, the_node ) - - -/* - * Chain_Is_first - * - * This function returns TRUE if the_node is the first node on a chain and - * FALSE otherwise. - * - * Chain_Node *the_node * IN * - */ - -#define Chain_Is_first( the_node ) \ - _Chain_Is_first( the_node ) - - -/* - * Chain_Is_last - * - * This function returns TRUE if the_node is the last node on a chain and - * FALSE otherwise. - * - * Chain_Node *the_node * IN * - */ - -#define Chain_Is_last( the_node ) \ - _Chain_Is_last( the_node ) - - -/* - * Chain_Is_empty - * - * This function returns TRUE if there are no nodes on the_chain and - * FALSE otherwise. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Is_empty( the_chain ) \ - _Chain_Is_empty( the_chain ) - - -/* - * Chain_Has_only_one_node - * - * This function returns TRUE if there is only one node on the_chain and - * FALSE otherwise. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Has_only_one_node( the_chain ) \ - _Chain_Has_only_one_node( the_chain ) - - -/* - * Chain_Is_null - * - * This function returns TRUE if the_chain is NULL and FALSE otherwise. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Is_null( the_chain ) \ - _Chain_Is_null( the_chain ) - - -/* - * Chain_Is_null_node - * - * This function returns TRUE if the_node is NULL and FALSE otherwise. - * - * Chain_Node *the_node * IN * - */ - -#define Chain_Is_null_node( the_node ) \ - _Chain_Is_null_node( the_node ) - - -#undef __RTEMS_APPLICATION__ -#include -#define __RTEMS_APPLICATION__ -#endif -/* end of include file */ diff --git a/c/src/lib/include/clockdrv.h b/c/src/lib/include/clockdrv.h deleted file mode 100644 index d7b0b4671f..0000000000 --- a/c/src/lib/include/clockdrv.h +++ /dev/null @@ -1,50 +0,0 @@ -/* clock.h - * - * This file describes the Clock Driver for all boards. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __CLOCK_DRIVER_h -#define __CLOCK_DRIVER_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* variables */ - -extern volatile rtems_unsigned32 Clock_driver_ticks; -extern rtems_device_major_number rtems_clock_major; -extern rtems_device_minor_number rtems_clock_minor; - -/* default clock driver entry */ - -#define CLOCK_DRIVER_TABLE_ENTRY \ - { Clock_initialize, NULL, NULL, NULL, NULL, Clock_control } - -rtems_device_driver Clock_initialize( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver Clock_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/lib/include/console.h b/c/src/lib/include/console.h deleted file mode 100644 index 2d2f380012..0000000000 --- a/c/src/lib/include/console.h +++ /dev/null @@ -1,68 +0,0 @@ -/* console.h - * - * This file describes the Console Device Driver for all boards. - * This driver provides support for the standard C Library. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef _CONSOLE_DRIVER_h -#define _CONSOLE_DRIVER_h - -#ifdef __cplusplus -extern "C" { -#endif - -#define CONSOLE_DRIVER_TABLE_ENTRY \ - { console_initialize, console_open, console_close, \ - console_read, console_write, console_control } - -rtems_device_driver console_initialize( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver console_open( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver console_close( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver console_read( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver console_write( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver console_control( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/lib/include/inttypes.h b/c/src/lib/include/inttypes.h deleted file mode 100644 index dad6c67c7d..0000000000 --- a/c/src/lib/include/inttypes.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * inttypes.h - * - * ISO C99 Format conversion of integer types. - * - * $Id$ - */ - -#ifndef __INTTYPES_H -#define __INTTYPES_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/lib/include/iosupp.h b/c/src/lib/include/iosupp.h deleted file mode 100644 index ef8e01b76d..0000000000 --- a/c/src/lib/include/iosupp.h +++ /dev/null @@ -1,43 +0,0 @@ -/* iosupp.h - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __IOSUPP_h -#define __IOSUPP_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* character constants */ - -#define BS 0x08 /* backspace */ -#define LF 0x0a /* line feed */ -#define CR 0x0d /* carriage return */ -#define XON 0x11 /* control-Q */ -#define XOFF 0x13 /* control-S */ - -/* structures */ - -#ifdef IOSUPP_INIT -#define IOSUPP_EXTERN -#else -#undef IOSUPP_EXTERN -#define IOSUPP_EXTERN extern -#endif - -/* functions */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/lib/include/motorola/.cvsignore b/c/src/lib/include/motorola/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/lib/include/motorola/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/lib/include/motorola/mc68230.h b/c/src/lib/include/motorola/mc68230.h deleted file mode 100644 index 22ec49c12b..0000000000 --- a/c/src/lib/include/motorola/mc68230.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * mc68230.h -- Low level support code for the Motorola 68230 Parallel - * Interface/Timer (PIT) - * - * Modified by Doug McBride, Colorado Space Grant College - * - * Format taken partly from RTEMS code and mostly from Motorola IDP user's - * manual. RTEMS copyright information below. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __MC68230_H__ -#define __MC68230_H__ - -/* Some Motorola IDP User manual defines: */ -#define PIT_ADDR 0x00c01003 /* base address of the PIT */ -#define REGOFF 0x04 /* Difference between addresses */ -#define VECT 64 -#define H1VECT 0x00 -#define H2VECT 0x01 -#define H3VECT 0x02 -#define H4VECT 0x03 - -/* - * mc68230 register offsets - */ -#define PGCR 0x00 -#define PSRR 1*REGOFF -#define PADDR 2*REGOFF -#define PBDDR 3*REGOFF -#define PCDDR 4*REGOFF -#define PIVR 5*REGOFF -#define PACR 6*REGOFF -#define PBCR 7*REGOFF -#define PADR 8*REGOFF -#define PBDR 9*REGOFF -#define PAAR 10*REGOFF -#define PBAR 11*REGOFF -#define PCDR 12*REGOFF -#define PITSR 13*REGOFF -#define TCR 16*REGOFF -#define TIVR 17*REGOFF -#define CPRH 19*REGOFF -#define CPRM 20*REGOFF -#define CPRL 21*REGOFF -#define CNTRH 23*REGOFF -#define CNTRM 24*REGOFF -#define CNTRL 25*REGOFF -#define TSR 26*REGOFF - -/* Some RTEMS style defines: */ -#ifndef VOL8 -#define VOL8( ptr ) ((volatile rtems_unsigned8 *)(ptr)) -#endif - -#define MC68230_WRITE( reg, data ) \ - *(VOL8(PIT_ADDR+reg)) = (data) - -#define MC68230_READ( reg, data ) \ - (data) = *(VOL8(PIT_ADDR+reg)) - -#endif diff --git a/c/src/lib/include/motorola/mc68681.h b/c/src/lib/include/motorola/mc68681.h deleted file mode 100644 index 7602097fd8..0000000000 --- a/c/src/lib/include/motorola/mc68681.h +++ /dev/null @@ -1,306 +0,0 @@ -/* - * mc68681-duart.h -- Low level support code for the Motorola mc68681 - * DUART. - * - * Originally written by rob@cygnus.com (Rob Savoye) for the libgloss - * IDP support. - * - * $Id$ - */ - -#ifndef __MC68681_H__ -#define __MC68681_H__ - -/* - * In the dark ages when this controller was designed, it was actually - * possible to access data on unaligned byte boundaries with no penalty. - * Now we find this chip in configurations in which the registers are - * at 16-bit, 32-bit, and 64-bit boundaries at the whim of the board - * designer. If the registers are not at byte addresses, then - * set this multiplier before including this file to correct the offsets. - */ - -#ifndef MC68681_OFFSET_MULTIPLIER -#define MC68681_OFFSET_MULTIPLIER 1 -#endif - -#define __MC68681_REG(_R) ((_R) * MC68681_OFFSET_MULTIPLIER) - -/* - * mc68681 register offsets Read/Write Addresses - */ -#define MC68681_MODE_REG_1A __MC68681_REG(0) /* MR1A-MR Prior to Read */ -#define MC68681_MODE_REG_2A __MC68681_REG(0) /* MR2A-MR After Read */ - -#define MC68681_COUNT_MODE_CURRENT_MSB __MC68681_REG(6) /* CTU */ -#define MC68681_COUNTER_TIMER_UPPER_REG __MC68681_REG(6) /* CTU */ -#define MC68681_COUNT_MODE_CURRENT_LSB __MC68681_REG(7) /* CTL */ -#define MC68681_COUNTER_TIMER_LOWER_REG __MC68681_REG(7) /* CTL */ -#define MC68681_INTERRUPT_VECTOR_REG __MC68681_REG(12) /* IVR */ - -#define MC68681_MODE_REG_1B __MC68681_REG(8) /* MR1B-MR Prior to Read */ -#define MC68681_MODE_REG_2B __MC68681_REG(8) /* MR2BA-MR After Read */ - -/* - * mc68681 register offsets Read Only Addresses - */ -#define MC68681_STATUS_REG_A __MC68681_REG(1) /* SRA */ -#define MC68681_MASK_ISR_REG __MC68681_REG(2) /* MISR */ -#define MC68681_RECEIVE_BUFFER_A __MC68681_REG(3) /* RHRA */ -#define MC68681_INPUT_PORT_CHANGE_REG __MC68681_REG(4) /* IPCR */ -#define MC68681_INTERRUPT_STATUS_REG __MC68681_REG(5) /* ISR */ -#define MC68681_STATUS_REG_B __MC68681_REG(9) /* SRB */ -#define MC68681_RECEIVE_BUFFER_B __MC68681_REG(11) /* RHRB */ -#define MC68681_INPUT_PORT __MC68681_REG(13) /* IP */ -#define MC68681_START_COUNT_CMD __MC68681_REG(14) /* SCC */ -#define MC68681_STOP_COUNT_CMD __MC68681_REG(15) /* STC */ - -/* - * mc68681 register offsets Write Only Addresses - */ -#define MC68681_CLOCK_SELECT_REG_A __MC68681_REG(1) /* CSRA */ -#define MC68681_COMMAND_REG_A __MC68681_REG(2) /* CRA */ -#define MC68681_TRANSMIT_BUFFER_A __MC68681_REG(3) /* THRA */ -#define MC68681_AUX_CTRL_REG __MC68681_REG(4) /* ACR */ -#define MC68681_INTERRUPT_MASK_REG __MC68681_REG(5) /* IMR */ -#define MC68681_CLOCK_SELECT_REG_B __MC68681_REG(9) /* CSRB */ -#define MC68681_COMMAND_REG_B __MC68681_REG(10) /* CRB */ -#define MC68681_TRANSMIT_BUFFER_B __MC68681_REG(11) /* THRB */ -#define MC68681_OUTPUT_PORT_CONFIG_REG __MC68681_REG(13) /* OPCR */ -#define MC68681_OUTPUT_PORT_SET_REG __MC68681_REG(14) /* SOPBC */ -#define MC68681_OUTPUT_PORT_RESET_BITS __MC68681_REG(15) /* COPBC */ - - -#ifndef MC6681_VOL -#define MC6681_VOL( ptr ) ((volatile unsigned char *)(ptr)) -#endif - -#define MC68681_WRITE( _base, _reg, _data ) \ - *((volatile unsigned char *)_base+_reg) = (_data) - -#define MC68681_READ( _base, _reg ) \ - *(((volatile unsigned char *)_base+_reg)) - - - -#define MC68681_CLEAR 0x00 - -#define MC68681_PORT_A 0 -#define MC68681_PORT_B 1 - -/* - * DUART Command Register Definitions: - * - * MC68681_COMMAND_REG_A,MC68681_COMMAND_REG_B - */ -#define MC68681_MODE_REG_ENABLE_RX 0x01 -#define MC68681_MODE_REG_DISABLE_RX 0x02 -#define MC68681_MODE_REG_ENABLE_TX 0x04 -#define MC68681_MODE_REG_DISABLE_TX 0x08 -#define MC68681_MODE_REG_RESET_MR_PTR 0x10 -#define MC68681_MODE_REG_RESET_RX 0x20 -#define MC68681_MODE_REG_RESET_TX 0x30 -#define MC68681_MODE_REG_RESET_ERROR 0x40 -#define MC68681_MODE_REG_RESET_BREAK 0x50 -#define MC68681_MODE_REG_START_BREAK 0x60 -#define MC68681_MODE_REG_STOP_BREAK 0x70 -#define MC68681_MODE_REG_SET_RX_BRG 0x80 -#define MC68681_MODE_REG_CLEAR_RX_BRG 0x90 -#define MC68681_MODE_REG_SET_TX_BRG 0xa0 -#define MC68681_MODE_REG_CLEAR_TX_BRG 0xb0 -#define MC68681_MODE_REG_SET_STANDBY 0xc0 -#define MC68681_MODE_REG_SET_ACTIVE 0xd0 - -/* - * Mode Register Definitions - * - * MC68681_MODE_REG_1A - * MC68681_MODE_REG_1B - */ -#define MC68681_5BIT_CHARS 0x00 -#define MC68681_6BIT_CHARS 0x01 -#define MC68681_7BIT_CHARS 0x02 -#define MC68681_8BIT_CHARS 0x03 - -#define MC68681_ODD_PARITY 0x00 -#define MC68681_EVEN_PARITY 0x04 - -#define MC68681_WITH_PARITY 0x00 -#define MC68681_FORCE_PARITY 0x08 -#define MC68681_NO_PARITY 0x10 -#define MC68681_MULTI_DROP 0x18 - -#define MC68681_ERR_MODE_CHAR 0x00 -#define MC68681_ERR_MODE_BLOCK 0x20 - -#define MC68681_RX_INTR_RX_READY 0x00 -#define MC68681_RX_INTR_FFULL 0x40 - -#define MC68681_NO_RX_RTS_CTL 0x00 -#define MC68681_RX_RTS_CTRL 0x80 - - -/* - * Mode Register Definitions - * - * MC68681_MODE_REG_2A - * MC68681_MODE_REG_2B - */ -#define MC68681_STOP_BIT_LENGTH__563 0x00 -#define MC68681_STOP_BIT_LENGTH__625 0x01 -#define MC68681_STOP_BIT_LENGTH__688 0x02 -#define MC68681_STOP_BIT_LENGTH__75 0x03 -#define MC68681_STOP_BIT_LENGTH__813 0x04 -#define MC68681_STOP_BIT_LENGTH__875 0x05 -#define MC68681_STOP_BIT_LENGTH__938 0x06 -#define MC68681_STOP_BIT_LENGTH_1 0x07 -#define MC68681_STOP_BIT_LENGTH_1_563 0x08 -#define MC68681_STOP_BIT_LENGTH_1_625 0x09 -#define MC68681_STOP_BIT_LENGTH_1_688 0x0a -#define MC68681_STOP_BIT_LENGTH_1_75 0x0b -#define MC68681_STOP_BIT_LENGTH_1_813 0x0c -#define MC68681_STOP_BIT_LENGTH_1_875 0x0d -#define MC68681_STOP_BIT_LENGTH_1_938 0x0e -#define MC68681_STOP_BIT_LENGTH_2 0x0f - -#define MC68681_CTS_ENABLE_TX 0x10 -#define MC68681_TX_RTS_CTRL 0x20 - -#define MC68681_CHANNEL_MODE_NORMAL 0x00 -#define MC68681_CHANNEL_MODE_ECHO 0x40 -#define MC68681_CHANNEL_MODE_LOCAL_LOOP 0x80 -#define MC68681_CHANNEL_MODE_REMOTE_LOOP 0xc0 - -/* - * Status Register Definitions - * - * MC68681_STATUS_REG_A, MC68681_STATUS_REG_B - */ -#define MC68681_RX_READY 0x01 -#define MC68681_FFULL 0x02 -#define MC68681_TX_READY 0x04 -#define MC68681_TX_EMPTY 0x08 -#define MC68681_OVERRUN_ERROR 0x10 -#define MC68681_PARITY_ERROR 0x20 -#define MC68681_FRAMING_ERROR 0x40 -#define MC68681_RECEIVED_BREAK 0x80 - - -/* - * Interupt Status Register Definitions. - * - * MC68681_INTERRUPT_STATUS_REG - */ - - -/* - * Interupt Mask Register Definitions - * - * MC68681_INTERRUPT_MASK_REG - */ -#define MC68681_IR_TX_READY_A 0x01 -#define MC68681_IR_RX_READY_A 0x02 -#define MC68681_IR_BREAK_A 0x04 -#define MC68681_IR_COUNTER_READY 0x08 -#define MC68681_IR_TX_READY_B 0x10 -#define MC68681_IR_RX_READY_B 0x20 -#define MC68681_IR_BREAK_B 0x40 -#define MC68681_IR_INPUT_PORT_CHANGE 0x80 - -/* - * Status Register Definitions. - * - * MC68681_STATUS_REG_A,MC68681_STATUS_REG_B - */ -#define MC68681_STATUS_RXRDY 0x01 -#define MC68681_STATUS_FFULL 0x02 -#define MC68681_STATUS_TXRDY 0x04 -#define MC68681_STATUS_TXEMT 0x08 -#define MC68681_STATUS_OVERRUN_ERROR 0x10 -#define MC68681_STATUS_PARITY_ERROR 0x20 -#define MC68681_STATUS_FRAMING_ERROR 0x40 -#define MC68681_STATUS_RECEIVED_BREAK 0x80 - -/* - * Definitions for the Interrupt Vector Register: - * - * MC68681_INTERRUPT_VECTOR_REG - */ -#define MC68681_INTERRUPT_VECTOR_INIT 0x0f - -/* - * Definitions for the Auxiliary Control Register - * - * MC68681_AUX_CTRL_REG - */ -#define MC68681_AUX_BRG_SET1 0x00 -#define MC68681_AUX_BRG_SET2 0x80 - - -/* - * The following Baud rates assume the X1 clock pin is driven with a - * 3.6864 MHz signal. If a different frequency is used the DUART channel - * is running at the follwoing baud rate: - * ((Table Baud Rate)*frequency)/3.6864 MHz - */ - -/* - * Definitions for the Clock Select Register: - * - * MC68681_CLOCK_SELECT_REG_A,MC68681_CLOCK_SELECT_REG_A - * - * Note: ACR[7] is the MSB of the Auxiliary Control register - * X is the extend bit. - * CRA - 0x08 Set Rx BRG Select Extend Bit (X=1) - * CRA - 0x09 Clear Rx BRG Select Extend Bit (X=0) - * CRB - 0x0a Set Tx BRG Select Extend Bit (X=1) - * CRB - 0x0b Clear Tx BRG Select Extend Bit (x=1) - */ -#define MC68681_BAUD_RATE_MASK_50 0x00 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_75 0x00 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_110 0x01 -#define MC68681_BAUD_RATE_MASK_134_5 0x02 -#define MC68681_BAUD_RATE_MASK_150 0x03 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_200 0x03 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_300 0x04 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_600 0x05 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_1050 0x07 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_1200 0x06 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_1800 0x0a /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_2400 0x08 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_3600 0x04 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_4800 0x09 -#define MC68681_BAUD_RATE_MASK_7200 0x0a /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_9600 0xbb - -#define MC68681_BAUD_RATE_MASK_14_4K 0x05 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_19_2K 0xcc /* ACR[7]=1,X=0 */ - /* ARC[7]=0,X=1 */ -#define MC68681_BAUD_RATE_MASK_28_8K 0x06 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_38_4K 0xcc /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_57_6K 0x07 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_115_5K 0x08 -#define MC68681_BAUD_RATE_MASK_TIMER 0xdd -#define MC68681_BAUD_RATE_MASK_TIMER_16X 0xee -#define MC68681_BAUD_RATE_MASK_TIMER_1X 0xff - -#endif - - - diff --git a/c/src/lib/include/ringbuf.h b/c/src/lib/include/ringbuf.h deleted file mode 100644 index 8c80aaf9c8..0000000000 --- a/c/src/lib/include/ringbuf.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * ringbuf.h - * - * This file provides simple ring buffer functionality. - * - * $Id$ - */ - -#ifndef __RINGBUF_H__ -#define __RINGBUF_H__ - -#ifndef RINGBUF_QUEUE_LENGTH -#define RINGBUF_QUEUE_LENGTH 128 -#endif - -typedef struct { - char buffer[RINGBUF_QUEUE_LENGTH]; - volatile int head; - volatile int tail; -} Ring_buffer_t; - -#define Ring_buffer_Initialize( _buffer ) \ - do { \ - (_buffer)->head = (_buffer)->tail = 0; \ - } while ( 0 ) - -#define Ring_buffer_Is_empty( _buffer ) \ - ( (_buffer)->head == (_buffer)->tail ) - -#define Ring_buffer_Is_full( _buffer ) \ - ( (_buffer)->head == ((_buffer)->tail + 1) % RINGBUF_QUEUE_LENGTH ) - -#define Ring_buffer_Add_character( _buffer, _ch ) \ - do { \ - rtems_unsigned32 isrlevel; \ - \ - rtems_interrupt_disable( isrlevel ); \ - (_buffer)->tail = ((_buffer)->tail+1) % RINGBUF_QUEUE_LENGTH; \ - (_buffer)->buffer[ (_buffer)->tail ] = (_ch); \ - rtems_interrupt_enable( isrlevel ); \ - } while ( 0 ) - -#define Ring_buffer_Remove_character( _buffer, _ch ) \ - do { \ - rtems_unsigned32 isrlevel; \ - \ - rtems_interrupt_disable( isrlevel ); \ - (_buffer)->head = ((_buffer)->head+1) % RINGBUF_QUEUE_LENGTH; \ - (_ch) = (_buffer)->buffer[ (_buffer)->head ]; \ - rtems_interrupt_enable( isrlevel ); \ - } while ( 0 ) - -#endif diff --git a/c/src/lib/include/rtc.h b/c/src/lib/include/rtc.h deleted file mode 100644 index ba9f9d6622..0000000000 --- a/c/src/lib/include/rtc.h +++ /dev/null @@ -1,38 +0,0 @@ -/* rtc.h - * - * This file describes the Real-Time Clock driver for all boards. - * This driver provides support for the standard RTEMS routines - * that set the tod based on an RTC. - * - * COPYRIGHT (c) 1989-2001. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef _RTC_DRIVER_h -#define _RTC_DRIVER_h - -#ifdef __cplusplus -extern "C" { -#endif - -#define RTC_DRIVER_TABLE_ENTRY \ - { rtc_initialize, NULL, NULL, NULL, NULL, NULL } - -rtems_device_driver rtc_initialize( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/lib/include/rtems/.cvsignore b/c/src/lib/include/rtems/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/lib/include/rtems/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/lib/include/rtems/assoc.h b/c/src/lib/include/rtems/assoc.h deleted file mode 100644 index 1982d654ac..0000000000 --- a/c/src/lib/include/rtems/assoc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * Rtems associativity routines. Mainly used to convert a value from - * one space to another (eg: our errno's to host errno's and v.v) - * - * - * $Id$ - */ - -#ifndef _INCLUDE_ASSOC_H -#define _INCLUDE_ASSOC_H - -typedef struct { - const char *name; - unsigned32 local_value; - unsigned32 remote_value; -} rtems_assoc_t; - -/* - * Flag/marker for optional default value in each table - */ - -#define RTEMS_ASSOC_DEFAULT_NAME "(default)" - -const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *); -const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32); -const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *); -unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *); -const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32); -const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32); -char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *); -char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *); -unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32); - - -#endif /* ! _INCLUDE_ASSOC_H */ diff --git a/c/src/lib/include/rtems/error.h b/c/src/lib/include/rtems/error.h deleted file mode 100644 index de6e1715db..0000000000 --- a/c/src/lib/include/rtems/error.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Defines and externs for rtems error reporting - * - * $Id$ - */ - -#ifndef __RTEMS_ERROR_h -#define __RTEMS_ERROR_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * rtems_error() and rtems_panic() support - */ - -#define RTEMS_ERROR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */ -#define RTEMS_ERROR_PANIC (RTEMS_ERROR_ERRNO / 2) /* err fatal; no return */ -#define RTEMS_ERROR_ABORT (RTEMS_ERROR_ERRNO / 4) /* err is fatal; panic */ - -#define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \ - RTEMS_ERROR_PANIC) /* all */ - -const char *rtems_status_text(rtems_status_code); -int rtems_error(int error_code, const char *printf_format, ...); -#ifdef __GNUC__ -void rtems_panic(const char *printf_format, ...); -/* - * We should be able to use this attribute but gcc complains that - * rtems_panic does in fact return. :( - * - * __attribute__ ((__noreturn__)); - */ -#else -void rtems_panic(const char *printf_format, ...); -#endif - -extern int rtems_panic_in_progress; - -#ifdef __cplusplus -} -#endif - - -#endif -/* end of include file */ diff --git a/c/src/lib/include/rtems/libcsupport.h b/c/src/lib/include/rtems/libcsupport.h deleted file mode 100644 index 4def1e82c5..0000000000 --- a/c/src/lib/include/rtems/libcsupport.h +++ /dev/null @@ -1,43 +0,0 @@ -/* libcsupport.h - * - * This include file contains the information regarding the - * RTEMS specific support for the standard C library. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __LIBC_SUPPORT_h -#define __LIBC_SUPPORT_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -void RTEMS_Malloc_Initialize( - void *start, - size_t length, - size_t sbrk_amount -); - -extern void malloc_dump(void); -extern void malloc_walk(size_t source, size_t printf_enabled); -extern void libc_init(int reentrant); -extern int host_errno(void); -extern void fix_syscall_errno(void); -extern size_t malloc_free_space(); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/lib/include/rtems/libio.h b/c/src/lib/include/rtems/libio.h deleted file mode 100644 index d95e5c375e..0000000000 --- a/c/src/lib/include/rtems/libio.h +++ /dev/null @@ -1,575 +0,0 @@ -/* - * System call and file system interface definition - * - * General purpose communication channel for RTEMS to allow UNIX/POSIX - * system call behavior under RTEMS. Initially this supported only - * IO to devices but has since been enhanced to support networking - * and support for mounted file systems. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef _RTEMS_LIBIO_H -#define _RTEMS_LIBIO_H - -#include -#include -#include -#include - -/* - * Define data types which must be constructed using forward references. - */ - -#include - -/* - * Valid RTEMS file types. - */ -typedef enum { - RTEMS_FILESYSTEM_DIRECTORY, - RTEMS_FILESYSTEM_DEVICE, - RTEMS_FILESYSTEM_HARD_LINK, - RTEMS_FILESYSTEM_SYM_LINK, - RTEMS_FILESYSTEM_MEMORY_FILE -} rtems_filesystem_node_types_t; - -/* - * File Handler Operations Table - */ - -typedef int (*rtems_filesystem_open_t)( - rtems_libio_t *iop, - const char *pathname, - unsigned32 flag, - unsigned32 mode -); - -typedef int (*rtems_filesystem_close_t)( - rtems_libio_t *iop -); - -typedef int (*rtems_filesystem_read_t)( - rtems_libio_t *iop, - void *buffer, - unsigned32 count -); - -typedef int (*rtems_filesystem_write_t)( - rtems_libio_t *iop, - const void *buffer, - unsigned32 count -); - -typedef int (*rtems_filesystem_ioctl_t)( - rtems_libio_t *iop, - unsigned32 command, - void *buffer -); - -typedef int (*rtems_filesystem_lseek_t)( - rtems_libio_t *iop, - off_t length, - int whence -); - -typedef int (*rtems_filesystem_fstat_t)( - rtems_filesystem_location_info_t *loc, - struct stat *buf -); - -typedef int (*rtems_filesystem_fchmod_t)( - rtems_filesystem_location_info_t *loc, - mode_t mode -); - -typedef int (*rtems_filesystem_ftruncate_t)( - rtems_libio_t *iop, - off_t length -); - -typedef int (*rtems_filesystem_fpathconf_t)( - rtems_libio_t *iop, - int name -); - -typedef int (*rtems_filesystem_fsync_t)( - rtems_libio_t *iop -); - -typedef int (*rtems_filesystem_fdatasync_t)( - rtems_libio_t *iop -); - -typedef int (*rtems_filesystem_fcntl_t)( - int cmd, - rtems_libio_t *iop -); - -typedef int (*rtems_filesystem_rmnod_t)( - rtems_filesystem_location_info_t *pathloc /* IN */ -); - -struct _rtems_filesystem_file_handlers_r { - rtems_filesystem_open_t open_h; - rtems_filesystem_close_t close_h; - rtems_filesystem_read_t read_h; - rtems_filesystem_write_t write_h; - rtems_filesystem_ioctl_t ioctl_h; - rtems_filesystem_lseek_t lseek_h; - rtems_filesystem_fstat_t fstat_h; - rtems_filesystem_fchmod_t fchmod_h; - rtems_filesystem_ftruncate_t ftruncate_h; - rtems_filesystem_fpathconf_t fpathconf_h; - rtems_filesystem_fsync_t fsync_h; - rtems_filesystem_fdatasync_t fdatasync_h; - rtems_filesystem_fcntl_t fcntl_h; - rtems_filesystem_rmnod_t rmnod_h; -}; - -/* - * File System Operations Table - */ - -/* - * XXX - * This routine does not allocate any space and rtems_filesystem_freenode_t - * is not called by the generic after calling this routine. - * ie. node_access does not have to contain valid data when the - * routine returns. - */ - -typedef int (*rtems_filesystem_mknod_t)( - const char *path, /* IN */ - mode_t mode, /* IN */ - dev_t dev, /* IN */ - rtems_filesystem_location_info_t *pathloc /* IN/OUT */ -); - -/* - * rtems_filesystem_freenode_t must be called by the generic after - * calling this routine - */ - -typedef int (*rtems_filesystem_evalpath_t)( - const char *pathname, /* IN */ - int flags, /* IN */ - rtems_filesystem_location_info_t *pathloc /* IN/OUT */ -); - -typedef int (*rtems_filesystem_evalmake_t)( - const char *path, /* IN */ - rtems_filesystem_location_info_t *pathloc, /* IN/OUT */ - const char **name /* OUT */ -); - -typedef int (*rtems_filesystem_link_t)( - rtems_filesystem_location_info_t *to_loc, /* IN */ - rtems_filesystem_location_info_t *parent_loc, /* IN */ - const char *name /* IN */ -); - -typedef int (*rtems_filesystem_unlink_t)( - rtems_filesystem_location_info_t *pathloc /* IN */ -); - -typedef int (*rtems_filesystem_chown_t)( - rtems_filesystem_location_info_t *pathloc, /* IN */ - uid_t owner, /* IN */ - gid_t group /* IN */ -); - -typedef int (*rtems_filesystem_freenode_t)( - rtems_filesystem_location_info_t *pathloc /* IN */ -); - -typedef int (* rtems_filesystem_mount_t ) ( - rtems_filesystem_mount_table_entry_t *mt_entry /* in */ -); - -typedef int (* rtems_filesystem_fsmount_me_t )( - rtems_filesystem_mount_table_entry_t *mt_entry -); - -typedef int (* rtems_filesystem_unmount_t ) ( - rtems_filesystem_mount_table_entry_t *mt_entry /* in */ -); - -typedef int (* rtems_filesystem_fsunmount_me_t ) ( - rtems_filesystem_mount_table_entry_t *mt_entry /* in */ -); - -typedef rtems_filesystem_node_types_t (* rtems_filesystem_node_type_t) ( - rtems_filesystem_location_info_t *pathloc /* in */ -); - -typedef int (* rtems_filesystem_utime_t)( - rtems_filesystem_location_info_t *pathloc, /* IN */ - time_t actime, /* IN */ - time_t modtime /* IN */ -); - -typedef int (*rtems_filesystem_evaluate_link_t)( - rtems_filesystem_location_info_t *pathloc, /* IN/OUT */ - int flags /* IN */ -); - -typedef int (*rtems_filesystem_symlink_t)( - rtems_filesystem_location_info_t *loc, /* IN */ - const char *link_name, /* IN */ - const char *node_name -); - -typedef int (*rtems_filesystem_readlink_t)( - rtems_filesystem_location_info_t *loc, /* IN */ - char *buf, /* OUT */ - size_t bufsize -); - -/* - * operations table that must be defined for every file system. - */ - -/* - * File system types - */ -struct _rtems_filesystem_operations_table { - rtems_filesystem_evalpath_t evalpath_h; - rtems_filesystem_evalmake_t evalformake_h; - rtems_filesystem_link_t link_h; - rtems_filesystem_unlink_t unlink_h; - rtems_filesystem_node_type_t node_type_h; - rtems_filesystem_mknod_t mknod_h; - rtems_filesystem_chown_t chown_h; - rtems_filesystem_freenode_t freenod_h; - rtems_filesystem_mount_t mount_h; - rtems_filesystem_fsmount_me_t fsmount_me_h; - rtems_filesystem_unmount_t unmount_h; - rtems_filesystem_fsunmount_me_t fsunmount_me_h; - rtems_filesystem_utime_t utime_h; - rtems_filesystem_evaluate_link_t eval_link_h; - rtems_filesystem_symlink_t symlink_h; - rtems_filesystem_readlink_t readlink_h; -}; - -#if 0 -/* Now in exec/include/rtems/fs.h */ - -/* - * Structure used to determine a location/filesystem in the tree. - */ - -struct rtems_filesystem_location_info_tt -{ - void *node_access; - rtems_filesystem_file_handlers_r *handlers; - rtems_filesystem_operations_table *ops; - rtems_filesystem_mount_table_entry_t *mt_entry; -}; -#endif - -/* - * Structure used to contain file system specific information which - * is required to support fpathconf(). - */ - -typedef struct { - int link_max; - int max_canon; - int max_input; - int name_max; - int path_max; - int pipe_buf; - int posix_async_io; - int posix_chown_restrictions; - int posix_no_trunc; - int posix_prio_io; - int posix_sync_io; - int posix_vdisable; -} rtems_filesystem_limits_and_options_t; - -/* - * Structure for a mount table entry. - */ - -struct rtems_filesystem_mount_table_entry_tt { - Chain_Node Node; - rtems_filesystem_location_info_t mt_point_node; - rtems_filesystem_location_info_t mt_fs_root; - int options; - void *fs_info; - - rtems_filesystem_limits_and_options_t pathconf_limits_and_options; - - /* - * When someone adds a mounted filesystem on a real device, - * this will need to be used. - * - * The best option long term for this is probably an open file descriptor. - */ - char *dev; -}; - -/* - * Valid RTEMS file systems options - */ - -typedef enum -{ - RTEMS_FILESYSTEM_READ_ONLY, - RTEMS_FILESYSTEM_READ_WRITE, - RTEMS_FILESYSTEM_BAD_OPTIONS -} rtems_filesystem_options_t; - - -/* - * An open file data structure, indexed by 'fd' - * TODO: - * should really have a separate per/file data structure that this - * points to (eg: size, offset, driver, pathname should be in that) - */ - -struct rtems_libio_tt { - rtems_driver_name_t *driver; - off_t size; /* size of file */ - off_t offset; /* current offset into file */ - unsigned32 flags; - rtems_filesystem_location_info_t pathinfo; - Objects_Id sem; - unsigned32 data0; /* private to "driver" */ - void *data1; /* ... */ - void *file_info; /* used by file handlers */ - rtems_filesystem_file_handlers_r *handlers; /* type specific handlers */ -}; - -/* - * param block for read/write - * Note: it must include 'offset' instead of using iop's offset since - * we can have multiple outstanding i/o's on a device. - */ - -typedef struct { - rtems_libio_t *iop; - off_t offset; - unsigned8 *buffer; - unsigned32 count; - unsigned32 flags; - unsigned32 bytes_moved; -} rtems_libio_rw_args_t; - -/* - * param block for open/close - */ - -typedef struct { - rtems_libio_t *iop; - unsigned32 flags; - unsigned32 mode; -} rtems_libio_open_close_args_t; - -/* - * param block for ioctl - */ - -typedef struct { - rtems_libio_t *iop; - unsigned32 command; - void *buffer; - unsigned32 ioctl_return; -} rtems_libio_ioctl_args_t; - -/* - * Values for 'flag' - */ - -#define LIBIO_FLAGS_NO_DELAY 0x0001 /* return immediately if no data */ -#define LIBIO_FLAGS_READ 0x0002 /* reading */ -#define LIBIO_FLAGS_WRITE 0x0004 /* writing */ -#define LIBIO_FLAGS_OPEN 0x0100 /* device is open */ -#define LIBIO_FLAGS_APPEND 0x0200 /* all writes append */ -#define LIBIO_FLAGS_CREATE 0x0400 /* create file */ -#define LIBIO_FLAGS_CLOSE_ON_EXEC 0x0800 /* close on process exec() */ -#define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE) - -void rtems_libio_init(void); - -/* - * External I/O handlers - */ - -typedef int (*rtems_libio_open_t)( - const char *pathname, - unsigned32 flag, - unsigned32 mode -); - -typedef int (*rtems_libio_close_t)( - int fd -); - -typedef int (*rtems_libio_read_t)( - int fd, - void *buffer, - unsigned32 count -); - -typedef int (*rtems_libio_write_t)( - int fd, - const void *buffer, - unsigned32 count -); - -typedef int (*rtems_libio_ioctl_t)( - int fd, - unsigned32 command, - void *buffer -); - -typedef int (*rtems_libio_lseek_t)( - int fd, - off_t offset, - int whence -); - -/* - * The following macros are used to build up the permissions sets - * used to check permissions. These are similar in style to the - * mode_t bits and should stay compatible with them. - */ - -#define RTEMS_LIBIO_PERMS_READ S_IROTH -#define RTEMS_LIBIO_PERMS_WRITE S_IWOTH -#define RTEMS_LIBIO_PERMS_RDWR (S_IROTH|S_IWOTH) -#define RTEMS_LIBIO_PERMS_EXEC S_IXOTH -#define RTEMS_LIBIO_PERMS_SEARCH RTEMS_LIBIO_PERMS_EXEC -#define RTEMS_LIBIO_PERMS_RWX S_IRWXO - -/* - * Macros - */ - -#define rtems_filesystem_make_dev_t( _major, _minor ) \ - ((((dev_t)(_major)) << 32) | (dev_t)(_minor)) - -#define rtems_filesystem_dev_major_t( _dev ) \ - (rtems_device_major_number) ((_dev) >> 32) - -#define rtems_filesystem_dev_minor_t( _dev ) \ - (rtems_device_minor_number) ((_dev) & 0xFFFFFFFF) - -#define rtems_filesystem_split_dev_t( _dev, _major, _minor ) \ - do { \ - (_major) = rtems_filesystem_dev_major_t ( _dev ); \ - (_minor) = rtems_filesystem_dev_minor_t( _dev ); \ - } while(0) - -/* - * Verifies that the permission flag is valid. - */ -#define rtems_libio_is_valid_perms( _perm ) \ - (~ ((~RTEMS_LIBIO_PERMS_RWX) & _perm )) - - -/* - * Prototypes for filesystem - */ - -void rtems_filesystem_initialize( void ); - - -/* - * Callbacks from TERMIOS routines to device-dependent code - */ - -#include - -typedef struct rtems_termios_callbacks { - int (*firstOpen)(int major, int minor, void *arg); - int (*lastClose)(int major, int minor, void *arg); - int (*pollRead)(int minor); - int (*write)(int minor, const char *buf, int len); - int (*setAttributes)(int minor, const struct termios *t); - int (*stopRemoteTx)(int minor); - int (*startRemoteTx)(int minor); - int outputUsesInterrupts; -} rtems_termios_callbacks; - -/* - * Device-independent TERMIOS routines - */ - -void rtems_termios_initialize (void); - -rtems_status_code rtems_termios_open ( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg, - const rtems_termios_callbacks *callbacks -); - -rtems_status_code rtems_termios_close( - void *arg -); - -rtems_status_code rtems_termios_read( - void *arg -); - -rtems_status_code rtems_termios_write( - void *arg -); - -rtems_status_code rtems_termios_ioctl( - void *arg -); - -int rtems_termios_enqueue_raw_characters( - void *ttyp, - char *buf, - int len -); - -int rtems_termios_dequeue_characters( - void *ttyp, - int len -); - -void rtems_termios_reserve_resources( - rtems_configuration_table *configuration, - rtems_unsigned32 number_of_devices -); - -int unmount( - const char *mount_path -); - -int mount( - rtems_filesystem_mount_table_entry_t **mt_entry, - rtems_filesystem_operations_table *fs_ops, - rtems_filesystem_options_t fsoptions, - char *device, - char *mount_point -); - -/* - * Boot Time Mount Table Structure - */ - -typedef struct { - rtems_filesystem_operations_table *fs_ops; - rtems_filesystem_options_t fsoptions; - char *device; - char *mount_point; -} rtems_filesystem_mount_table_t; - -extern rtems_filesystem_mount_table_t *rtems_filesystem_mount_table; -extern int rtems_filesystem_mount_table_size; - -#endif /* _RTEMS_LIBIO_H */ diff --git a/c/src/lib/include/rtems/libio_.h b/c/src/lib/include/rtems/libio_.h deleted file mode 100644 index 4265c55a1e..0000000000 --- a/c/src/lib/include/rtems/libio_.h +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Libio Internal Information - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __RTEMS_LIBIO_INTERNAL__h -#define __RTEMS_LIBIO_INTERNAL__h - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include /* include before standard IO */ - -#include - -#include - -/* - * Semaphore to protect the io table - */ - -#define RTEMS_LIBIO_SEM rtems_build_name('L', 'B', 'I', 'O') -#define RTEMS_LIBIO_IOP_SEM(n) rtems_build_name('L', 'B', 'I', n) - -extern rtems_id rtems_libio_semaphore; -extern rtems_filesystem_file_handlers_r rtems_filesystem_null_handlers; - -/* - * File descriptor Table Information - */ - -extern unsigned32 rtems_libio_number_iops; -extern rtems_libio_t *rtems_libio_iops; -extern rtems_libio_t *rtems_libio_last_iop; -extern rtems_libio_t *rtems_libio_iop_freelist; - -/* - * rtems_libio_iop - * - * Macro to return the file descriptor pointer. - */ - -#define rtems_libio_iop(_fd) \ - ((((unsigned32)(_fd)) < rtems_libio_number_iops) ? \ - &rtems_libio_iops[_fd] : 0) - -/* - * rtems_libio_check_is_open - * - * Macro to check if a file descriptor is actually open. - */ - -#define rtems_libio_check_is_open(_iop) \ - do { \ - if (((_iop)->flags & LIBIO_FLAGS_OPEN) == 0) { \ - errno = EBADF; \ - return -1; \ - } \ - } while (0) - -/* - * rtems_libio_check_fd - * - * Macro to check if a file descriptor number is valid. - */ - -#define rtems_libio_check_fd(_fd) \ - do { \ - if ((unsigned32) (_fd) >= rtems_libio_number_iops) { \ - errno = EBADF; \ - return -1; \ - } \ - } while (0) - -/* - * rtems_libio_check_buffer - * - * Macro to check if a buffer pointer is valid. - */ - -#define rtems_libio_check_buffer(_buffer) \ - do { \ - if ((_buffer) == 0) { \ - errno = EINVAL; \ - return -1; \ - } \ - } while (0) - -/* - * rtems_libio_check_count - * - * Macro to check if a count or length is valid. - */ - -#define rtems_libio_check_count(_count) \ - do { \ - if ((_count) == 0) { \ - return 0; \ - } \ - } while (0) - -/* - * rtems_libio_check_permissions - * - * Macro to check if a file descriptor is open for this operation. - */ - -#define rtems_libio_check_permissions(_iop, _flag) \ - do { \ - if (((_iop)->flags & (_flag)) == 0) { \ - rtems_set_errno_and_return_minus_one( EINVAL ); \ - return -1; \ - } \ - } while (0) - -/* - * rtems_filesystem_freenode - * - * Macro to free a node. - */ - -#define rtems_filesystem_freenode( _node ) \ - do { \ - if ( (_node)->ops )\ - if ( (_node)->ops->freenod_h ) \ - (*(_node)->ops->freenod_h)( (_node) ); \ - } while (0) - -/* - * rtems_filesystem_is_separator - * - * Macro to determine if a character is a path name separator. - * - * NOTE: This macro handles MS-DOS and UNIX style names. - */ - -#define rtems_filesystem_is_separator( _ch ) \ - ( ((_ch) == '/') || ((_ch) == '\\') || ((_ch) == '\0')) - -/* - * rtems_filesystem_get_start_loc - * - * Macro to determine if path is absolute or relative. - */ - -#define rtems_filesystem_get_start_loc( _path, _index, _loc ) \ - do { \ - if ( rtems_filesystem_is_separator( (_path)[ 0 ] ) ) { \ - *(_loc) = rtems_filesystem_root; \ - *(_index) = 1; \ - } else { \ - *(_loc) = rtems_filesystem_current; \ - *(_index) = 0; \ - } \ - } while (0) - -#define rtems_filesystem_get_sym_start_loc( _path, _index, _loc ) \ - do { \ - if ( rtems_filesystem_is_separator( (_path)[ 0 ] ) ) { \ - *(_loc) = rtems_filesystem_root; \ - *(_index) = 1; \ - } else { \ - *(_index) = 0; \ - } \ - } while (0) - - -/* - * External structures - */ -#include - -extern rtems_user_env_t * rtems_current_user_env; -extern rtems_user_env_t rtems_global_user_env; - -/* - * Instantiate a private copy of the per user information for the calling task. - */ - -rtems_status_code rtems_libio_set_private_env(void); -rtems_status_code rtems_libio_share_private_env(rtems_id task_id) ; - -/* - * File Descriptor Routine Prototypes - */ - -rtems_libio_t *rtems_libio_allocate(void); - -unsigned32 rtems_libio_fcntl_flags( - unsigned32 fcntl_flags -); - -unsigned32 rtems_libio_to_fcntl_flags( - unsigned32 flags -); - -void rtems_libio_free( - rtems_libio_t *iop -); - -int rtems_libio_is_open_files_in_fs( - rtems_filesystem_mount_table_entry_t *mt_entry -); - -int rtems_libio_is_file_open( - void *node_access -); - -/* - * File System Routine Prototypes - */ - -int rtems_filesystem_evaluate_path( - const char *pathname, - int flags, - rtems_filesystem_location_info_t *pathloc, - int follow_link -); - -void rtems_filesystem_initialize(); - -int init_fs_mount_table(); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/lib/include/rtems/termiostypes.h b/c/src/lib/include/rtems/termiostypes.h deleted file mode 100644 index adda9e0871..0000000000 --- a/c/src/lib/include/rtems/termiostypes.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * RTEMS termios device support internal data structures - * - * COPYRIGHT (c) 1989-2000. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef TERMIOSTYPES_H -#define TERMIOSTYPES_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Wakeup callback data structure - */ -struct ttywakeup { - void (*sw_pfn)__P((struct termios *tty, void *arg)); - void *sw_arg; -}; - -/* - * Variables associated with the character buffer - */ -struct rtems_termios_rawbuf { - char *theBuf; - volatile unsigned int Head; - volatile unsigned int Tail; - volatile unsigned int Size; - rtems_id Semaphore; -}; -/* - * Variables associated with each termios instance. - * One structure for each hardware I/O device. - */ -struct rtems_termios_tty { - /* - * Linked-list of active TERMIOS devices - */ - struct rtems_termios_tty *forw; - struct rtems_termios_tty *back; - - /* - * How many times has this device been opened - */ - int refcount; - - /* - * This device - */ - rtems_device_major_number major; - rtems_device_major_number minor; - - /* - * Mutual-exclusion semaphores - */ - rtems_id isem; - rtems_id osem; - - /* - * The canonical (cooked) character buffer - */ - char *cbuf; - int ccount; - int cindex; - - /* - * Keep track of cursor (printhead) position - */ - int column; - int read_start_column; - - /* - * The ioctl settings - */ - struct termios termios; - rtems_interval vtimeTicks; - - /* - * Raw input character buffer - */ - struct rtems_termios_rawbuf rawInBuf; - rtems_unsigned32 rawInBufSemaphoreOptions; - rtems_interval rawInBufSemaphoreTimeout; - rtems_interval rawInBufSemaphoreFirstTimeout; - unsigned int rawInBufDropped; /* Statistics */ - - /* - * Raw output character buffer - */ - struct rtems_termios_rawbuf rawOutBuf; - int t_dqlen; /* count of characters dequeued from device */ - enum {rob_idle, rob_busy, rob_wait } rawOutBufState; - - /* - * Callbacks to device-specific routines - */ - rtems_termios_callbacks device; - volatile unsigned int flow_ctrl; - unsigned int lowwater,highwater; - - /* - * I/O task IDs (for task-driven drivers) - */ - rtems_id rxTaskId; - rtems_id txTaskId; - /* - * line discipline related stuff - */ - int t_line; /* id of line discipline */ - void *t_sc; /* hook for discipline-specific data structure */ - /* - * Wakeup callback variables - */ - struct ttywakeup tty_snd; - struct ttywakeup tty_rcv; - int tty_rcvwakeup; -}; - -struct linesw { - int (*l_open) (struct rtems_termios_tty *tp); - int (*l_close)(struct rtems_termios_tty *tp); - int (*l_read )(struct rtems_termios_tty *tp,rtems_libio_rw_args_t *args); - int (*l_write)(struct rtems_termios_tty *tp,rtems_libio_rw_args_t *args); - int (*l_rint )(int c,struct rtems_termios_tty *tp); - int (*l_start)(struct rtems_termios_tty *tp); - int (*l_ioctl)(struct rtems_termios_tty *tp,rtems_libio_ioctl_args_t *args); - int (*l_modem)(struct rtems_termios_tty *tp,int flags); -}; - -/* - * FIXME: this should move to libio.h! - * values for rtems_termios_callbacks.outputUsesInterrupts - */ -#define TERMIOS_POLLED 0 -#define TERMIOS_IRQ_DRIVEN 1 -#define TERMIOS_TASK_DRIVEN 2 - - -/* - * FIXME: this should move to termios.h! - */ -void rtems_termios_rxirq_occured(struct rtems_termios_tty *tty); -/* - * FIXME: this should move to termios.h! - * put a string to output ring buffer - */ -void rtems_termios_puts (const char *buf, - int len, - struct rtems_termios_tty *tty); -/* - * global hooks for line disciplines - */ -extern struct linesw linesw[]; -extern int nlinesw; - -#define TTYDISC 0 /* termios tty line discipline */ -#define TABLDISC 3 /* tablet discipline */ -#define SLIPDISC 4 /* serial IP discipline */ -#define PPPDISC 5 /* PPP discipline */ -#define MAXLDISC 8 - -#ifdef __cplusplus -} -#endif - -#endif /* TERMIOSTYPES_H */ diff --git a/c/src/lib/include/spurious.h b/c/src/lib/include/spurious.h deleted file mode 100644 index 36fcaba904..0000000000 --- a/c/src/lib/include/spurious.h +++ /dev/null @@ -1,38 +0,0 @@ -/* spurious.h - * - * This file describes the Spurious Interrupt Driver for all boards. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __SPURIOUS_h -#define __SPURIOUS_h - -#ifdef __cplusplus -extern "C" { -#endif - -#define SPURIOUS_DRIVER_TABLE_ENTRY \ - { Spurious_Initialize, NULL, NULL, NULL, NULL, NULL } - -rtems_device_driver Spurious_Initialize( - rtems_device_major_number, - rtems_device_minor_number, - void *, - rtems_id, - rtems_unsigned32 * -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/lib/include/stdint.h b/c/src/lib/include/stdint.h deleted file mode 100644 index dd2e490ef9..0000000000 --- a/c/src/lib/include/stdint.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * stdint.h - * - * ISO C99 integer types - * - * $Id$ - */ - -#ifndef __STDINT_H -#define __STDINT_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef signed char int8_t; -typedef short int int16_t; -typedef int int32_t; -typedef long int int64_t; - -typedef unsigned char uint8_t; -typedef unsigned short int uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long int uint64_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/lib/include/sys/.cvsignore b/c/src/lib/include/sys/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/lib/include/sys/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/lib/include/sys/cdefs.h b/c/src/lib/include/sys/cdefs.h deleted file mode 100644 index d089dc5894..0000000000 --- a/c/src/lib/include/sys/cdefs.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Berkeley Software Design, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 - * $Id$ - */ - -#ifndef _SYS_CDEFS_H_ -#define _SYS_CDEFS_H_ - -#if defined(__cplusplus) -#define __BEGIN_DECLS extern "C" { -#define __END_DECLS }; -#else -#define __BEGIN_DECLS -#define __END_DECLS -#endif - -/* - * The __CONCAT macro is used to concatenate parts of symbol names, e.g. - * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. - * The __CONCAT macro is a bit tricky -- make sure you don't put spaces - * in between its arguments. __CONCAT can also concatenate double-quoted - * strings produced by the __STRING macro, but this only works with ANSI C. - * - * __XSTRING is like __STRING, but it expands any macros in its argument - * first. It is only available with ANSI C. - */ -#if defined(__STDC__) || defined(__cplusplus) -#define __P(protos) protos /* full-blown ANSI C */ -#define __CONCAT1(x,y) x ## y -#define __CONCAT(x,y) __CONCAT1(x,y) -#define __STRING(x) #x /* stringify without expanding x */ -#define __XSTRING(x) __STRING(x) /* expand x, then stringify */ - -#define __const const /* define reserved names to standard */ -#define __signed signed -#define __volatile volatile -#if defined(__cplusplus) -#define __inline inline /* convert to C++ keyword */ -#else -#ifndef __GNUC__ -#define __inline /* delete GCC keyword */ -#endif /* !__GNUC__ */ -#endif /* !__cplusplus */ - -#else /* !(__STDC__ || __cplusplus) */ -#define __P(protos) () /* traditional C preprocessor */ -#define __CONCAT(x,y) x/**/y -#define __STRING(x) "x" - -#ifndef __GNUC__ -#define __const /* delete pseudo-ANSI C keywords */ -#define __inline -#define __signed -#define __volatile -/* - * In non-ANSI C environments, new programs will want ANSI-only C keywords - * deleted from the program and old programs will want them left alone. - * When using a compiler other than gcc, programs using the ANSI C keywords - * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. - * When using "gcc -traditional", we assume that this is the intent; if - * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. - */ -#ifndef NO_ANSI_KEYWORDS -#define const /* delete ANSI C keywords */ -#define inline -#define signed -#define volatile -#endif /* !NO_ANSI_KEYWORDS */ -#endif /* !__GNUC__ */ -#endif /* !(__STDC__ || __cplusplus) */ - -/* - * GCC1 and some versions of GCC2 declare dead (non-returning) and - * pure (no side effects) functions using "volatile" and "const"; - * unfortunately, these then cause warnings under "-ansi -pedantic". - * GCC2.5 uses a new, peculiar __attribute__((attrs)) style. All of - * these work for GNU C++ (modulo a slight glitch in the C++ grammar - * in the distribution version of 2.5.5). - */ -#if __GNUC__ < 2 -#define __dead -#define __dead2 -#define __pure -#define __pure2 -#define __unused -#define __attribute__(x) -#endif -#if __GNUC__ == 2 && __GNUC_MINOR__ < 5 -#define __dead __volatile -#define __dead2 -#define __pure __const -#define __pure2 -#define __unused -#endif -#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 -#define __dead -#define __dead2 __attribute__((__noreturn__)) -#define __pure -#define __pure2 __attribute__((__const__)) -#define __unused -#endif -#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3 -#define __dead -#define __dead2 __attribute__((__noreturn__)) -#define __pure -#define __pure2 __attribute__((__const__)) -#define __unused __attribute__((__unused__)) -#endif - -#ifdef __GNUC__ -#ifdef __STDC__ -#define __weak_reference(sym,alias) \ - __asm__(".stabs \"_" #alias "\",11,0,0,0"); \ - __asm__(".stabs \"_" #sym "\",1,0,0,0") -#define __warn_references(sym,msg) \ - __asm__(".stabs \"" msg "\",30,0,0,0"); \ - __asm__(".stabs \"_" #sym "\",1,0,0,0") -#else -#define __weak_reference(sym,alias) \ - __asm__(".stabs \"_/**/alias\",11,0,0,0"); \ - __asm__(".stabs \"_/**/sym\",1,0,0,0") -#define __warn_references(sym,msg) \ - __asm__(".stabs msg,30,0,0,0"); \ - __asm__(".stabs \"_/**/sym\",1,0,0,0") -#endif -#endif - -#define __IDSTRING(name,string) \ - static const char name[] __attribute__((__unused__)) = string - -#ifndef __RCSID -#define __RCSID(s) __IDSTRING(rcsid,s) -#endif - -#ifndef __RCSID_SOURCE -#define __RCSID_SOURCE(s) __IDSTRING(rcsid_source,s) -#endif - -#ifndef __COPYRIGHT -#define __COPYRIGHT(s) __IDSTRING(copyright,s) -#endif - -#endif /* !_SYS_CDEFS_H_ */ diff --git a/c/src/lib/include/sys/filio.h b/c/src/lib/include/sys/filio.h deleted file mode 100644 index 5a8b7e4bbb..0000000000 --- a/c/src/lib/include/sys/filio.h +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)filio.h 8.1 (Berkeley) 3/28/94 - * $Id$ - */ - -#ifndef _SYS_FILIO_H_ -#define _SYS_FILIO_H_ - -#include - -/* RTEMS defines all of these in sys/ioccom.h */ -#if 0 -/* Generic file-descriptor ioctl's. */ -#define FIOCLEX _IO('f', 1) /* set close on exec on fd */ -#define FIONCLEX _IO('f', 2) /* remove close on exec */ -#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ -#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ -#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ -#define FIOSETOWN _IOW('f', 124, int) /* set owner */ -#define FIOGETOWN _IOR('f', 123, int) /* get owner */ -#endif - -#endif /* !_SYS_FILIO_H_ */ diff --git a/c/src/lib/include/sys/ioccom.h b/c/src/lib/include/sys/ioccom.h deleted file mode 100644 index 60e16a6c8a..0000000000 --- a/c/src/lib/include/sys/ioccom.h +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ioccom.h 8.2 (Berkeley) 3/28/94 - * $Id$ - */ - -#ifndef _SYS_IOCCOM_H_ -#define _SYS_IOCCOM_H_ - -/* - * Ioctl's have the command encoded in the lower word, and the size of - * any in or out parameters in the upper word. The high 3 bits of the - * upper word are used to encode the in/out status of the parameter. - */ -#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ -#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) -#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) -#define IOCGROUP(x) (((x) >> 8) & 0xff) - -#define IOCPARM_MAX PAGE_SIZE /* max size of ioctl, mult. of PAGE_SIZE */ -#define IOC_VOID 0x20000000 /* no parameters */ -#define IOC_OUT 0x40000000 /* copy out parameters */ -#define IOC_IN 0x80000000 /* copy in parameters */ -#define IOC_INOUT (IOC_IN|IOC_OUT) -#define IOC_DIRMASK 0xe0000000 /* mask for IN/OUT/VOID */ - -#define _IOC(inout,group,num,len) \ - (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) -#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) -#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) -#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) -/* this should be _IORW, but stdio got there first */ -#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) - -/* - * IOCTL values - */ - -#define RTEMS_IO_GET_ATTRIBUTES 1 -#define RTEMS_IO_SET_ATTRIBUTES 2 -#define RTEMS_IO_TCDRAIN 3 -#define RTEMS_IO_RCVWAKEUP 4 -#define RTEMS_IO_SNDWAKEUP 5 - -/* copied from libnetworking/sys/filio.h and commented out there */ -/* Generic file-descriptor ioctl's. */ -#define FIOCLEX _IO('f', 1) /* set close on exec on fd */ -#define FIONCLEX _IO('f', 2) /* remove close on exec */ -#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ -#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ -#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ -#define FIOSETOWN _IOW('f', 124, int) /* set owner */ -#define FIOGETOWN _IOR('f', 123, int) /* get owner */ - -#ifndef KERNEL - -#include - -__BEGIN_DECLS -int ioctl __P((int, int, ...)); -__END_DECLS - -#endif /* !KERNEL */ - -#endif /* !_SYS_IOCCOM_H_ */ diff --git a/c/src/lib/include/sys/ioctl.h b/c/src/lib/include/sys/ioctl.h deleted file mode 100644 index e3a69a5a7f..0000000000 --- a/c/src/lib/include/sys/ioctl.h +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ioctl.h 8.6 (Berkeley) 3/28/94 - * $Id$ - */ - -#ifndef _SYS_IOCTL_H_ -#define _SYS_IOCTL_H_ - -#include - -/* - * Pun for SunOS prior to 3.2. SunOS 3.2 and later support TIOCGWINSZ - * and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented - * notwithstanding). - */ -struct ttysize { - unsigned short ts_lines; - unsigned short ts_cols; - unsigned short ts_xxx; - unsigned short ts_yyy; -}; -#define TIOCGSIZE TIOCGWINSZ -#define TIOCSSIZE TIOCSWINSZ - -#include - -#include -#include - -#endif /* !_SYS_IOCTL_H_ */ - -/* - * Keep outside _SYS_IOCTL_H_ - * Compatibility with old terminal driver - * - * Source level -> #define USE_OLD_TTY - * Kernel level -> options COMPAT_43 or COMPAT_SUNOS - */ -#if defined(USE_OLD_TTY) || defined(COMPAT_43) || defined(COMPAT_SUNOS) -#include -#endif diff --git a/c/src/lib/include/sys/sockio.h b/c/src/lib/include/sys/sockio.h deleted file mode 100644 index 5e54baffe8..0000000000 --- a/c/src/lib/include/sys/sockio.h +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)sockio.h 8.1 (Berkeley) 3/28/94 - * $Id$ - */ - -#ifndef _SYS_SOCKIO_H_ -#define _SYS_SOCKIO_H_ - -#include - -/* Socket ioctl's. */ -#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ -#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ -#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ -#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ -#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ -#define SIOCSPGRP _IOW('s', 8, int) /* set process group */ -#define SIOCGPGRP _IOR('s', 9, int) /* get process group */ - -#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */ -#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */ -#define SIOCGETVIFCNT _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */ -#define SIOCGETSGCNT _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */ - -#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ -#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */ -#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */ -#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ -#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */ -#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */ -#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ -#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */ -#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */ -#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */ -#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ -#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */ -#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ -#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */ -#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ -#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ -#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */ -#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */ -#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */ -#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */ - -#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ -#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ -#define SIOCGIFMTU _IOWR('i', 51, struct ifreq) /* get IF mtu */ -#define SIOCSIFMTU _IOW('i', 52, struct ifreq) /* set IF mtu */ -#define SIOCGIFPHYS _IOWR('i', 53, struct ifreq) /* get IF wire */ -#define SIOCSIFPHYS _IOW('i', 54, struct ifreq) /* set IF wire */ -#define SIOCSIFMEDIA _IOWR('i', 55, struct ifreq) /* set net media */ -#define SIOCGIFMEDIA _IOWR('i', 56, struct ifmediareq) /* get net media */ - -/* - * RTEMS additions for setting/getting `tap' function on incoming packets. - */ -#define SIOCSIFTAP _IOW('i', 80, struct ifreq) /* set tap function */ -#define SIOCGIFTAP _IOW('i', 81, struct ifreq) /* get tap function */ - -#endif /* !_SYS_SOCKIO_H_ */ diff --git a/c/src/lib/include/sys/termios.h b/c/src/lib/include/sys/termios.h deleted file mode 100644 index 199bb2aef2..0000000000 --- a/c/src/lib/include/sys/termios.h +++ /dev/null @@ -1,198 +0,0 @@ -/* - * POSIX termios implementation for RTEMS console device driver. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef TERMIOS_H -#define TERMIOS_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef unsigned char cc_t; -typedef unsigned int speed_t; -typedef unsigned int tcflag_t; - -#define NCCS 19 -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_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ -}; - -/* c_cc characters */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VTIME 5 -#define VMIN 6 -#define VSWTC 7 -#define VSTART 8 -#define VSTOP 9 -#define VSUSP 10 -#define VEOL 11 -#define VREPRINT 12 -#define VDISCARD 13 -#define VWERASE 14 -#define VLNEXT 15 -#define VEOL2 16 - -/* 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 IUCLC 0001000 -#define IXON 0002000 -#define IXANY 0004000 -#define IXOFF 0010000 -#define IMAXBEL 0020000 - -/* c_oflag bits */ -#define OPOST 0000001 -#define OLCUC 0000002 -#define ONLCR 0000004 -#define OCRNL 0000010 -#define ONOCR 0000020 -#define ONLRET 0000040 -#define OFILL 0000100 -#define OFDEL 0000200 -#define NLDLY 0000400 -#define NL0 0000000 -#define NL1 0000400 -#define CRDLY 0003000 -#define CR0 0000000 -#define CR1 0001000 -#define CR2 0002000 -#define CR3 0003000 -#define TABDLY 0014000 -#define TAB0 0000000 -#define TAB1 0004000 -#define TAB2 0010000 -#define TAB3 0014000 -#define XTABS 0014000 -#define BSDLY 0020000 -#define BS0 0000000 -#define BS1 0020000 -#define VTDLY 0040000 -#define VT0 0000000 -#define VT1 0040000 -#define FFDLY 0100000 -#define FF0 0000000 -#define FF1 0100000 - -/* c_cflag bit meaning */ -#define CBAUD 0010017 -#define B0 0000000 /* hang up */ -#define B50 0000001 -#define B75 0000002 -#define B110 0000003 -#define B134 0000004 -#define B150 0000005 -#define B200 0000006 -#define B300 0000007 -#define B600 0000010 -#define B1200 0000011 -#define B1800 0000012 -#define B2400 0000013 -#define B4800 0000014 -#define B9600 0000015 -#define B19200 0000016 -#define B38400 0000017 -#define EXTA B19200 -#define EXTB B38400 -#define CSIZE 0000060 -#define CS5 0000000 -#define CS6 0000020 -#define CS7 0000040 -#define CS8 0000060 -#define CSTOPB 0000100 -#define CREAD 0000200 -#define PARENB 0000400 -#define PARODD 0001000 -#define HUPCL 0002000 -#define CLOCAL 0004000 -#define CBAUDEX 0010000 -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 -#define CIBAUD 002003600000 /* input baud rate (not used) */ -#define CRTSCTS 020000000000 /* flow control */ - -#define RTEMS_TERMIOS_NUMBER_BAUD_RATES 20 - -/* c_lflag bits */ -#define ISIG 0000001 -#define ICANON 0000002 -#define XCASE 0000004 -#define ECHO 0000010 -#define ECHOE 0000020 -#define ECHOK 0000040 -#define ECHONL 0000100 -#define NOFLSH 0000200 -#define TOSTOP 0000400 -#define ECHOCTL 0001000 -#define ECHOPRT 0002000 -#define ECHOKE 0004000 -#define FLUSHO 0010000 -#define PENDIN 0040000 -#define IEXTEN 0100000 - -/* tcflow() and TCXONC use these */ -#define TCOOFF 0 -#define TCOON 1 -#define TCIOFF 2 -#define TCION 3 - -/* tcflush() and TCFLSH use these */ -#define TCIFLUSH 0 -#define TCOFLUSH 1 -#define TCIOFLUSH 2 - -/* tcsetattr uses these */ -#define TCSANOW 0 -#define TCSADRAIN 1 -#define TCSAFLUSH 2 - -int tcdrain(int); -int tcflow(int, int); -int tcflush(int, int); -int tcgetattr(int, struct termios *); -int tcsetattr(int, int, struct termios *); -int tcdrain(int); -pid_t tcgetprgrp(int); -int tcsetprgrp(int, pid_t); -int tcsendbreak(int, int); - -speed_t cfgetospeed(const struct termios *tp); -int cfsetospeed(struct termios *tp, speed_t speed); -speed_t cfgetispeed(const struct termios *tp); -int cfsetispeed(struct termios *tp, speed_t speed); - -#ifdef __cplusplus -} -#endif - -#endif /* TERMIOS_H */ diff --git a/c/src/lib/include/sys/ttycom.h b/c/src/lib/include/sys/ttycom.h deleted file mode 100644 index f2e491bc50..0000000000 --- a/c/src/lib/include/sys/ttycom.h +++ /dev/null @@ -1,141 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ttycom.h 8.1 (Berkeley) 3/28/94 - * $Id$ - */ - -#ifndef _SYS_TTYCOM_H_ -#define _SYS_TTYCOM_H_ - -#include - -/* - * Tty ioctl's except for those supported only for backwards compatibility - * with the old tty driver. - */ - -/* - * Window/terminal size structure. This information is stored by the kernel - * in order to provide a consistent interface, but is not used by the kernel. - */ -struct winsize { - unsigned short ws_row; /* rows, in characters */ - unsigned short ws_col; /* columns, in characters */ - unsigned short ws_xpixel; /* horizontal size, pixels */ - unsigned short ws_ypixel; /* vertical size, pixels */ -}; - -#define TIOCMODG _IOR('t', 3, int) /* get modem control state */ -#define TIOCMODS _IOW('t', 4, int) /* set modem control state */ -#define TIOCM_LE 0001 /* line enable */ -#define TIOCM_DTR 0002 /* data terminal ready */ -#define TIOCM_RTS 0004 /* request to send */ -#define TIOCM_ST 0010 /* secondary transmit */ -#define TIOCM_SR 0020 /* secondary receive */ -#define TIOCM_CTS 0040 /* clear to send */ -#define TIOCM_CAR 0100 /* carrier detect */ -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RNG 0200 /* ring */ -#define TIOCM_RI TIOCM_RNG -#define TIOCM_DSR 0400 /* data set ready */ - /* 8-10 compat */ -#define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */ -#define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */ - /* 15 unused */ -#define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */ - /* 17-18 compat */ -#define TIOCGETA _IOR('t', 19, struct termios) /* get termios struct */ -#define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */ -#define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */ -#define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */ -#define TIOCGETD _IOR('t', 26, int) /* get line discipline */ -#define TIOCSETD _IOW('t', 27, int) /* set line discipline */ - /* 127-124 compat */ -#define TIOCSBRK _IO('t', 123) /* set break bit */ -#define TIOCCBRK _IO('t', 122) /* clear break bit */ -#define TIOCSDTR _IO('t', 121) /* set data terminal ready */ -#define TIOCCDTR _IO('t', 120) /* clear data terminal ready */ -#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */ -#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */ - /* 117-116 compat */ -#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ -#define TIOCSTI _IOW('t', 114, char) /* simulate terminal input */ -#define TIOCNOTTY _IO('t', 113) /* void tty association */ -#define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */ -#define TIOCPKT_DATA 0x00 /* data packet */ -#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ -#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ -#define TIOCPKT_STOP 0x04 /* stop output */ -#define TIOCPKT_START 0x08 /* start output */ -#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ -#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ -#define TIOCPKT_IOCTL 0x40 /* state change of pty driver */ -#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ -#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ -#define TIOCMSET _IOW('t', 109, int) /* set all modem bits */ -#define TIOCMBIS _IOW('t', 108, int) /* bis modem bits */ -#define TIOCMBIC _IOW('t', 107, int) /* bic modem bits */ -#define TIOCMGET _IOR('t', 106, int) /* get all modem bits */ -#define TIOCREMOTE _IOW('t', 105, int) /* remote input editing */ -#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */ -#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */ -#define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */ -#define TIOCSTAT _IO('t', 101) /* simulate ^T status message */ -#define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */ -#define TIOCCONS _IOW('t', 98, int) /* become virtual console */ -#define TIOCSCTTY _IO('t', 97) /* become controlling tty */ -#define TIOCEXT _IOW('t', 96, int) /* pty: external processing */ -#define TIOCSIG _IO('t', 95) /* pty: generate signal */ -#define TIOCDRAIN _IO('t', 94) /* wait till output drained */ -#define TIOCMSDTRWAIT _IOW('t', 91, int) /* modem: set wait on close */ -#define TIOCMGDTRWAIT _IOR('t', 90, int) /* modem: get wait on close */ -#define TIOCTIMESTAMP _IOR('t', 89, struct timeval) /* enable/get timestamp - * of last input event */ -#define TIOCDCDTIMESTAMP _IOR('t', 88, struct timeval) /* enable/get timestamp - * of last DCd rise */ -#define TIOCSDRAINWAIT _IOW('t', 87, int) /* set ttywait timeout */ -#define TIOCGDRAINWAIT _IOR('t', 86, int) /* get ttywait timeout */ -#define TIOCDSIMICROCODE _IO('t', 85) /* download microcode to - * DSI Softmodem */ - -#define TTYDISC 0 /* termios tty line discipline */ -#define TABLDISC 3 /* tablet discipline */ -#define SLIPDISC 4 /* serial IP discipline */ -#define PPPDISC 5 /* PPP discipline */ - -#endif /* !_SYS_TTYCOM_H_ */ diff --git a/c/src/lib/include/sys/utime.h b/c/src/lib/include/sys/utime.h deleted file mode 100644 index 3e9955e61f..0000000000 --- a/c/src/lib/include/sys/utime.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * $Id$ - */ - -#ifndef __UTIME_h__ -#define __UTIME_h__ - -/* - * POSIX 1003.1b 5.6.6 Set File Access and Modification Times - */ - -struct utimbuf { - time_t actime; /* Access time */ - time_t modtime; /* Modification time */ -}; - -/* Functions */ - -int utime( - const char *path, - const struct utimbuf *times -); - -#endif -/* end of include file */ diff --git a/c/src/lib/include/sys/utsname.h b/c/src/lib/include/sys/utsname.h deleted file mode 100644 index 70d6dfc7cf..0000000000 --- a/c/src/lib/include/sys/utsname.h +++ /dev/null @@ -1,56 +0,0 @@ -/* sys/utsname.h - * - * $Id$ - */ - -#ifndef __POSIX_SYS_UTSNAME_h -#define __POSIX_SYS_UTSNAME_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/* - * 4.4.1 Get System Name (Table 4-1), P1003.1b-1993, p. 90 - * - * NOTE: The lengths of the strings in this structure are - * just long enough to reliably contain the RTEMS information. - * For example, the fields are not long enough to support - * Internet hostnames. - */ - -struct utsname { - char sysname[ 32 ]; /* Name of this implementation of the operating system */ - char nodename[ 32 ]; /* Name of this node within an implementation */ - /* specified communication network */ - char release[ 32 ]; /* Current release level of this implementation */ - char version[ 32 ]; /* Current version level of this release */ - char machine[ 32 ]; /* Name of the hardware type on which the system */ - /* is running */ -}; - -/* - * 4.4.1 Get System Name, P1003.1b-1993, p. 90 - */ - -int uname( - struct utsname *name -); - -/* - * 4.5.2 Get Process Times, P1003.1b-1993, p. 92 - */ - -clock_t times( - struct tms *buffer -); - -#ifdef __cplusplus -} -#endif -#endif -/* end of include file */ - diff --git a/c/src/lib/include/timerdrv.h b/c/src/lib/include/timerdrv.h deleted file mode 100644 index 1234f8283a..0000000000 --- a/c/src/lib/include/timerdrv.h +++ /dev/null @@ -1,39 +0,0 @@ -/* timerdrv.h - * - * This file describes the Timer Driver for all boards. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __TIMER_DRIVER_h -#define __TIMER_DRIVER_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* functions */ - -void Timer_initialize( void ); - -rtems_unsigned32 Read_timer( void ); - -rtems_status_code Empty_function( void ); - -void Set_find_average_overhead( - rtems_boolean find_flag -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/lib/include/vmeintr.h b/c/src/lib/include/vmeintr.h deleted file mode 100644 index 583ccff6cc..0000000000 --- a/c/src/lib/include/vmeintr.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * vmeintr.h - * - * This file is the specification for the VMEbus interface library - * which should be provided by all BSPs for VMEbus Single Board - * Computers but currently only a few do so. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __VME_INTERRUPT_h -#define __VME_INTERRUPT_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This defines the mask which is used to determine which - * interrupt levels are affected by a call to this package. - * The LSB corresponds to VME interrupt 0 and the MSB - * to VME interrupt 7. - * - */ - -typedef rtems_unsigned8 VME_interrupt_Mask; - -/* - * VME_interrupt_Disable - * - */ - -void VME_interrupt_Disable ( - VME_interrupt_Mask mask /* IN */ -); - -/* - * VME_interrupt_Disable - * - */ - -void VME_interrupt_Enable ( - VME_interrupt_Mask mask /* IN */ -); - -#ifdef __cplusplus -} -#endif - -#endif /* end of include file */ diff --git a/c/src/lib/include/zilog/.cvsignore b/c/src/lib/include/zilog/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/c/src/lib/include/zilog/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/c/src/lib/include/zilog/z8036.h b/c/src/lib/include/zilog/z8036.h deleted file mode 100644 index d2f1652bcc..0000000000 --- a/c/src/lib/include/zilog/z8036.h +++ /dev/null @@ -1,108 +0,0 @@ -/* z8036.h - * - * This include file defines information related to a Zilog Z8036 - * Counter/Timer/IO Chip. It is a memory mapped part. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * NOTE: This file shares as much as possible with the include - * file for the Z8536 via z8x36.h. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __Z8036_h -#define __Z8036_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* macros */ - -#define Z8036( ptr ) ((volatile struct z8036_map *)(ptr)) - -#define Z8x36_STATE0 ( z8036 ) \ - { /*char *garbage = *(Z8036(z8036))->???; */ } - - -#define Z8x36_WRITE( z8036, reg, data ) \ - (Z8036(z8036))->reg = (data) - - -#define Z8x36_READ( z8036, reg, data ) \ - (Z8036(z8036))->reg = (data) - -/* structures */ - -struct z8036_map { -/* MAIN CONTROL REGISTERS (0x00-0x07) */ - rtems_unsigned8 MASTER_INTR; /* Master Interrupt Ctl Reg */ - rtems_unsigned8 MASTER_CFG; /* Master Configuration Ctl Reg */ - rtems_unsigned8 PORTA_VECTOR; /* Port A - Interrupt Vector */ - rtems_unsigned8 PORTB_VECTOR; /* Port B - Interrupt Vector */ - rtems_unsigned8 CNT_TMR_VECTOR; /* Counter/Timer Interrupt Vector */ - rtems_unsigned8 PORTC_DATA_POLARITY; /* Port C - Data Path Polarity */ - rtems_unsigned8 PORTC_DIRECTION; /* Port C - Data Direction */ - rtems_unsigned8 PORTC_SPECIAL_IO_CTL; /* Port C - Special IO Control */ -/* MOST OFTEN ACCESSED REGISTERS (0x08 - 0x0f) */ - rtems_unsigned8 PORTA_CMD_STATUS; /* Port A - Command Status Reg */ - rtems_unsigned8 PORTB_CMD_STATUS; /* Port B - Command Status Reg */ - rtems_unsigned8 CT1_CMD_STATUS; /* Ctr/Timer 1 - Command Status Reg */ - rtems_unsigned8 CT2_CMD_STATUS; /* Ctr/Timer 2 - Command Status Reg */ - rtems_unsigned8 CT3_CMD_STATUS; /* Ctr/Timer 3 - Command Status Reg */ - rtems_unsigned8 PORTA_DATA; /* Port A - Data */ - rtems_unsigned8 PORTB_DATA; /* Port B - Data */ - rtems_unsigned8 PORTC_DATA; /* Port C - Data */ -/* COUNTER/TIMER RELATED REGISTERS (0x10-0x1f) */ - rtems_unsigned8 CT1_CUR_CNT_MSB; /* Ctr/Timer 1 - Current Count (MSB) */ - rtems_unsigned8 CT1_CUR_CNT_LSB; /* Ctr/Timer 1 - Current Count (LSB) */ - rtems_unsigned8 CT2_CUR_CNT_MSB; /* Ctr/Timer 2 - Current Count (MSB) */ - rtems_unsigned8 CT2_CUR_CNT_LSB; /* Ctr/Timer 2 - Current Count (LSB) */ - rtems_unsigned8 CT3_CUR_CNT_MSB; /* Ctr/Timer 3 - Current Count (MSB) */ - rtems_unsigned8 CT3_CUR_CNT_LSB; /* Ctr/Timer 3 - Current Count (LSB) */ - rtems_unsigned8 CT1_TIME_CONST_MSB; /* Ctr/Timer 1 - Time Constant (MSB) */ - rtems_unsigned8 CT1_TIME_CONST_LSB; /* Ctr/Timer 1 - Time Constant (LSB) */ - rtems_unsigned8 CT2_TIME_CONST_MSB; /* Ctr/Timer 2 - Time Constant (MSB) */ - rtems_unsigned8 CT2_TIME_CONST_LSB; /* Ctr/Timer 2 - Time Constant (LSB) */ - rtems_unsigned8 CT3_TIME_CONST_MSB; /* Ctr/Timer 3 - Time Constant (MSB) */ - rtems_unsigned8 CT3_TIME_CONST_LSB; /* Ctr/Timer 3 - Time Constant (LSB) */ - rtems_unsigned8 CT1_MODE_SPEC; /* Ctr/Timer 1 - Mode Specification */ - rtems_unsigned8 CT2_MODE_SPEC; /* Ctr/Timer 2 - Mode Specification */ - rtems_unsigned8 CT3_MODE_SPEC; /* Ctr/Timer 3 - Mode Specification */ - rtems_unsigned8 CURRENT_VECTOR; /* Current Vector */ -/* PORT A SPECIFICATION REGISTERS (0x20 -0x27) */ - rtems_unsigned8 PORTA_MODE; /* Port A - Mode Specification */ - rtems_unsigned8 PORTA_HANDSHAKE; /* Port A - Handshake Specification */ - rtems_unsigned8 PORTA_DATA_POLARITY; /* Port A - Data Path Polarity */ - rtems_unsigned8 PORTA_DIRECTION; /* Port A - Data Direction */ - rtems_unsigned8 PORTA_SPECIAL_IO_CTL; /* Port A - Special IO Control */ - rtems_unsigned8 PORTA_PATT_POLARITY; /* Port A - Pattern Polarity */ - rtems_unsigned8 PORTA_PATT_TRANS; /* Port A - Pattern Transition */ - rtems_unsigned8 PORTA_PATT_MASK; /* Port A - Pattern Mask */ -/* PORT B SPECIFICATION REGISTERS (0x28-0x2f) */ - rtems_unsigned8 PORTB_MODE; /* Port B - Mode Specification */ - rtems_unsigned8 PORTB_HANDSHAKE; /* Port B - Handshake Specification */ - rtems_unsigned8 PORTB_DATA_POLARITY; /* Port B - Data Path Polarity */ - rtems_unsigned8 PORTB_DIRECTION; /* Port B - Data Direction */ - rtems_unsigned8 PORTB_SPECIAL_IO_CTL; /* Port B - Special IO Control */ - rtems_unsigned8 PORTB_PATT_POLARITY; /* Port B - Pattern Polarity */ - rtems_unsigned8 PORTB_PATT_TRANS; /* Port B - Pattern Transition */ - rtems_unsigned8 PORTB_PATT_MASK; /* Port B - Pattern Mask */ -}; - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/c/src/lib/include/zilog/z8530.h b/c/src/lib/include/zilog/z8530.h deleted file mode 100644 index aba481ac25..0000000000 --- a/c/src/lib/include/zilog/z8530.h +++ /dev/null @@ -1,98 +0,0 @@ -/* z8530.h - * - * This include file defines information related to a Zilog Z8530 - * SCC Chip. It is a IO mapped part. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __Z8530_h -#define __Z8530_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* macros */ - -#define VOL8( ptr ) ((volatile rtems_unsigned8 *)(ptr)) - -#define Z8x30_STATE0 ( z8530 ) \ - { char *garbage; \ - (garbage) = *(VOL8(z8530)) \ - } - -#define Z8x30_WRITE_CONTROL( z8530, reg, data ) \ - *(VOL8(z8530)) = (reg); \ - *(VOL8(z8530)) = (data) - -#define Z8x30_READ_CONTROL( z8530, reg, data ) \ - *(VOL8(z8530)) = (reg); \ - (data) = *(VOL8(z8530)) - -#define Z8x30_WRITE_DATA( z8530, data ) \ - *(VOL8(z8530)) = (data); - -#define Z8x30_READ_DATA( z8530, data ) \ - (data) = *(VOL8(z8530)); - - -/* RR_0 Bit Definitions */ - -#define RR_0_TX_BUFFER_EMPTY 0x04 -#define RR_0_RX_DATA_AVAILABLE 0x01 - -/* read registers */ - -#define RR_0 0x00 -#define RR_1 0x01 -#define RR_2 0x02 -#define RR_3 0x03 -#define RR_4 0x04 -#define RR_5 0x05 -#define RR_6 0x06 -#define RR_7 0x07 -#define RR_8 0x08 -#define RR_9 0x09 -#define RR_10 0x0A -#define RR_11 0x0B -#define RR_12 0x0C -#define RR_13 0x0D -#define RR_14 0x0E -#define RR_15 0x0F - -/* write registers */ - -#define WR_0 0x00 -#define WR_1 0x01 -#define WR_2 0x02 -#define WR_3 0x03 -#define WR_4 0x04 -#define WR_5 0x05 -#define WR_6 0x06 -#define WR_7 0x07 -#define WR_8 0x08 -#define WR_9 0x09 -#define WR_10 0x0A -#define WR_11 0x0B -#define WR_12 0x0C -#define WR_13 0x0D -#define WR_14 0x0E -#define WR_15 0x0F - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/lib/include/zilog/z8536.h b/c/src/lib/include/zilog/z8536.h deleted file mode 100644 index 8b8fac4567..0000000000 --- a/c/src/lib/include/zilog/z8536.h +++ /dev/null @@ -1,111 +0,0 @@ -/* z8536.h - * - * This include file defines information related to a Zilog Z8536 - * Counter/Timer/IO Chip. It is a IO mapped part. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * NOTE: This file shares as much as possible with the include - * file for the Z8036 via z8x36.h. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __Z8536_h -#define __Z8536_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* macros */ - -#define VOL8( ptr ) ((volatile rtems_unsigned8 *)(ptr)) - -#define Z8x36_STATE0 ( z8536 ) \ - { char *garbage; \ - (garbage) = *(VOL8(z8536+0xC)) \ - } - -#define Z8x36_WRITE( z8536, reg, data ) \ - *(VOL8(z8536+0xC)) = (reg); \ - *(VOL8(z8536+0xC)) = (data) - -#define Z8x36_READ( z8536, reg, data ) \ - *(VOL8(z8536+0xC)) = (reg); \ - (data) = *(VOL8(z8536+0xC)) - -/* structures */ - -/* MAIN CONTROL REGISTERS (0x00-0x07) */ -#define MASTER_INTR 0x00 /* Master Interrupt Ctl Reg */ -#define MASTER_CFG 0x01 /* Master Configuration Ctl Reg */ -#define PORTA_VECTOR 0x02 /* Port A - Interrupt Vector */ -#define PORTB_VECTOR 0x03 /* Port B - Interrupt Vector */ -#define CNT_TMR_VECTOR 0x04 /* Counter/Timer Interrupt Vector */ -#define PORTC_DATA_POLARITY 0x05 /* Port C - Data Path Polarity */ -#define PORTC_DIRECTION 0x06 /* Port C - Data Direction */ -#define PORTC_SPECIAL_IO_CTL 0x07 /* Port C - Special IO Control */ - -/* MOST OFTEN ACCESSED REGISTERS (0x08 - 0x0f) */ -#define PORTA_CMD_STATUS 0x08 /* Port A - Command Status Reg */ -#define PORTB_CMD_STATUS 0x09 /* Port B - Command Status Reg */ -#define CT1_CMD_STATUS 0x0a /* Ctr/Timer 1 - Command Status Reg */ -#define CT2_CMD_STATUS 0x0b /* Ctr/Timer 2 - Command Status Reg */ -#define CT3_CMD_STATUS 0x0c /* Ctr/Timer 3 - Command Status Reg */ -#define PORTA_DATA 0x0d /* Port A - Data */ -#define PORTB_DATA 0x0e /* Port B - Data */ -#define PORTC_DATA 0x0f /* Port C - Data */ - -/* COUNTER/TIMER RELATED REGISTERS (0x10-0x1f) */ -#define CT1_CUR_CNT_MSB 0x10 /* Ctr/Timer 1 - Current Count (MSB) */ -#define CT1_CUR_CNT_LSB 0x11 /* Ctr/Timer 1 - Current Count (LSB) */ -#define CT2_CUR_CNT_MSB 0x12 /* Ctr/Timer 2 - Current Count (MSB) */ -#define CT2_CUR_CNT_LSB 0x13 /* Ctr/Timer 2 - Current Count (LSB) */ -#define CT3_CUR_CNT_MSB 0x14 /* Ctr/Timer 3 - Current Count (MSB) */ -#define CT3_CUR_CNT_LSB 0x15 /* Ctr/Timer 3 - Current Count (LSB) */ -#define CT1_TIME_CONST_MSB 0x16 /* Ctr/Timer 1 - Time Constant (MSB) */ -#define CT1_TIME_CONST_LSB 0x17 /* Ctr/Timer 1 - Time Constant (LSB) */ -#define CT2_TIME_CONST_MSB 0x18 /* Ctr/Timer 2 - Time Constant (MSB) */ -#define CT2_TIME_CONST_LSB 0x19 /* Ctr/Timer 2 - Time Constant (LSB) */ -#define CT3_TIME_CONST_MSB 0x1a /* Ctr/Timer 3 - Time Constant (MSB) */ -#define CT3_TIME_CONST_LSB 0x1b /* Ctr/Timer 3 - Time Constant (LSB) */ -#define CT1_MODE_SPEC 0x1c /* Ctr/Timer 1 - Mode Specification */ -#define CT2_MODE_SPEC 0x1d /* Ctr/Timer 2 - Mode Specification */ -#define CT3_MODE_SPEC 0x1e /* Ctr/Timer 3 - Mode Specification */ -#define CURRENT_VECTOR 0x1f /* Current Vector */ - -/* PORT A SPECIFICATION REGISTERS (0x20 -0x27) */ -#define PORTA_MODE 0x20 /* Port A - Mode Specification */ -#define PORTA_HANDSHAKE 0x21 /* Port A - Handshake Specification */ -#define PORTA_DATA_POLARITY 0x22 /* Port A - Data Path Polarity */ -#define PORTA_DIRECTION 0x23 /* Port A - Data Direction */ -#define PORTA_SPECIAL_IO_CTL 0x24 /* Port A - Special IO Control */ -#define PORTA_PATT_POLARITY 0x25 /* Port A - Pattern Polarity */ -#define PORTA_PATT_TRANS 0x26 /* Port A - Pattern Transition */ -#define PORTA_PATT_MASK 0x27 /* Port A - Pattern Mask */ - -/* PORT B SPECIFICATION REGISTERS (0x28-0x2f) */ -#define PORTB_MODE 0x28 /* Port B - Mode Specification */ -#define PORTB_HANDSHAKE 0x29 /* Port B - Handshake Specification */ -#define PORTB_DATA_POLARITY 0x2a /* Port B - Data Path Polarity */ -#define PORTB_DIRECTION 0x2b /* Port B - Data Direction */ -#define PORTB_SPECIAL_IO_CTL 0x2c /* Port B - Special IO Control */ -#define PORTB_PATT_POLARITY 0x2d /* Port B - Pattern Polarity */ -#define PORTB_PATT_TRANS 0x2e /* Port B - Pattern Transition */ -#define PORTB_PATT_MASK 0x2f /* Port B - Pattern Mask */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/lib/libc/.cvsignore b/c/src/lib/libc/.cvsignore deleted file mode 100644 index 7bb609bf24..0000000000 --- a/c/src/lib/libc/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -config.h -config.h.in -stamp-h -stamp-h.in diff --git a/c/src/lib/libc/CASES b/c/src/lib/libc/CASES deleted file mode 100644 index 4578ae5009..0000000000 --- a/c/src/lib/libc/CASES +++ /dev/null @@ -1,23 +0,0 @@ -# -# $Id$ -# - -This is a list of cases to consider when implementing a file system: - - -+ Given a tree of this form: - - a ----- b - / - c - - Where a and b are directories and c is a link to directory b. Consider - this sequence: - - - rmdir a/b - - mknod c/b/x - - unlink c - - - - diff --git a/c/src/lib/libc/Makefile.am b/c/src/lib/libc/Makefile.am deleted file mode 100644 index f1c478268b..0000000000 --- a/c/src/lib/libc/Makefile.am +++ /dev/null @@ -1,89 +0,0 @@ -## -## $Id$ -## - -include $(top_srcdir)/../../../automake/multilib.am -include $(top_srcdir)/../../../automake/compile.am -include $(top_srcdir)/../../../automake/lib.am - -LIBNAME = libcsupport -LIB = ${ARCH}/${LIBNAME}.a - -INCLUDES = -I. - -ERROR_C_FILES = error.c - -ASSOCIATION_C_FILES = assoc.c assocnamebad.c - -BASE_FS_C_FILES = base_fs.c mount.c unmount.c libio.c \ - libio_sockets.c eval.c fs_null_handlers.c privateenv.c - -TERMIOS_C_FILES = cfgetispeed.c cfgetospeed.c cfsetispeed.c cfsetospeed.c \ - tcgetattr.c tcsetattr.c tcdrain.c tcflow.c tcflush.c tcgetprgrp.c \ - tcsendbreak.c tcsetpgrp.c termios.c termiosinitialize.c \ - termiosreserveresources.c - -SYSTEM_CALL_C_FILES = open.c close.c read.c write.c lseek.c ioctl.c mkdir.c \ - mknod.c mkfifo.c rmdir.c chdir.c chmod.c fchdir.c fchmod.c chown.c \ - link.c unlink.c umask.c ftruncate.c utime.c fstat.c fcntl.c fpathconf.c \ - getdents.c fsync.c fdatasync.c pipe.c dup.c dup2.c symlink.c readlink.c \ - creat.c chroot.c - -DIRECTORY_SCAN_C_FILES = opendir.c closedir.c readdir.c rewinddir.c \ - scandir.c seekdir.c telldir.c getcwd.c - -MALLOC_C_FILES = malloc.c mallocfreespace.c __brk.c __sbrk.c - -ENVIRON_C_FILES = - -PASSWORD_GROUP_C_FILES = getpwent.c getgrent.c - -TERMINAL_IDENTIFICATION_C_FILES = ctermid.c isatty.c ttyname.c ttyname_r.c - -LIBC_GLUE_C_FILES = __getpid.c __gettod.c __times.c truncate.c access.c \ - stat.c lstat.c pathconf.c envlock.c newlibc.c no_posix.c no_libc.c \ - utsname.c - -UNIX_LIBC_C_FILES = unixlibc.c hosterr.c - -COMMON_C_FILES = gxx_wrappers.c printk.c $(BASE_FS_C_FILES) \ - $(MALLOC_C_FILES) $(ENVIRON_C_FILES) $(TERMIOS_C_FILES) $(ERROR_C_FILES) \ - $(ASSOCIATION_C_FILES) - -UNIX_C_FILES = $(UNIX_LIBC_C_FILES) - -EMBEDDED_C_FILES = $(LIBC_GLUE_C_FILES) $(PASSWORD_GROUP_C_FILES) \ - $(TERMINAL_IDENTIFICATION_C_FILES) $(SYSTEM_CALL_C_FILES) \ - $(DIRECTORY_SCAN_C_FILES) - -if UNIX -C_FILES = $(COMMON_C_FILES) $(UNIX_C_FILES) -else -C_FILES = $(COMMON_C_FILES) $(EMBEDDED_C_FILES) -endif -C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) - -TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib$(MULTISUBDIR)/$(LIBNAME)$(LIB_VARIANT).a - -OBJS = $(C_O_FILES) - -# -# Add local stuff here using += -# - -AM_CFLAGS += $(LIBC_DEFINES) - -all-local: ${ARCH} $(TMPINSTALL_FILES) - -$(LIB): ${OBJS} - $(make-library) - -$(PROJECT_RELEASE)/lib$(MULTISUBDIR)/$(LIBNAME)$(LIB_VARIANT).a: $(LIB) - $(INSTALL_DATA) $< $@ - -DOC_FILES = TODO CASES - -EXTRA_DIST = $(DOC_FILES) $(COMMON_C_FILES) $(EMBEDDED_C_FILES) \ - $(UNIX_C_FILES) - -include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/lib/libc/README b/c/src/lib/libc/README deleted file mode 100644 index ee7a90501e..0000000000 --- a/c/src/lib/libc/README +++ /dev/null @@ -1,37 +0,0 @@ --- --- $Id$ --- - -Overview of newlib support (newlib is from CYGNUS) - Each task can have its own libc state including: - open stdio files - strtok - multi precision arithmetic state - etc. - - This is implemented by a reentrancy data structure for each task. - - When a task is "started" (in RTEMS sense) the reentrancy structure - is allocated. Its address is stored in notepad[NOTEPAD_LAST]. - - When task is switched to, the value of global variable _impure_ptr - is changed to the value of the new tasks reentrancy structure. - - When a task is deleted - atexit() processing (for that task) happens - task's stdio buffers are flushed - - When exit(3) is called - calling task's atexit processing done - global libc state atexit processing done - (this will include any atexit routines installed by drivers) - executive is shutdown - causes a context switch back to bsp land - - -NOTE: - libc extension are installed by bsp_libc_init() - iff we are using clock interrupts. - This hack is necessary to allow the tmtests to avoid - timing the extensions. - diff --git a/c/src/lib/libc/TODO b/c/src/lib/libc/TODO deleted file mode 100644 index 38cb012326..0000000000 --- a/c/src/lib/libc/TODO +++ /dev/null @@ -1,14 +0,0 @@ -# -# $Id$ -# - -+ newlib 1.8.0 has the wrong prototype for at least read() and write(). - -+ There should be a "eat it" stub for all system calls which are - available to make filling out an operations table easier. - See device_lseek() for an example of where this would be nice. - -+ Fix strerror() so it prints all error numbers. - -+ Check the node allocation coment in the fchdir call. -+ Add an interface somewhere for this call. \ No newline at end of file diff --git a/c/src/lib/libc/__brk.c b/c/src/lib/libc/__brk.c deleted file mode 100644 index 296b0e3ca7..0000000000 --- a/c/src/lib/libc/__brk.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * RTEMS "Broken" __brk Implementation - * - * NOTE: sbrk() is provided by each BSP. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if !defined(RTEMS_UNIX) - -#include - -int __brk( - const void *endds -) -{ - errno = EINVAL; - return -1; -} -#endif diff --git a/c/src/lib/libc/__getpid.c b/c/src/lib/libc/__getpid.c deleted file mode 100644 index 54a7c980e0..0000000000 --- a/c/src/lib/libc/__getpid.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Some C Libraries reference this routine since they think getpid is - * a real system call. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -pid_t __getpid(void) -{ - return getpid(); -} - diff --git a/c/src/lib/libc/__gettod.c b/c/src/lib/libc/__gettod.c deleted file mode 100644 index 96e44802dc..0000000000 --- a/c/src/lib/libc/__gettod.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * gettimeofday() - SVR4 and BSD4.3 extension required by Newlib - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ - -#include - -#if !defined(RTEMS_UNIX) -#ifdef RTEMS_NEWLIB -#include -#endif - -#include -#include - -#include -#include - -/* - * Seconds from January 1, 1970 to January 1, 1988. Used to account for - * differences between POSIX API and RTEMS core. - */ - -#define POSIX_TIME_SECONDS_1970_THROUGH_1988 \ - (((1987 - 1970 + 1) * TOD_SECONDS_PER_NON_LEAP_YEAR) + \ - (4 * TOD_SECONDS_PER_DAY)) - -/* - * NOTE: The solaris gettimeofday does not have a second parameter. - */ - -int gettimeofday( - struct timeval *tp, - struct timezone *tzp -) -{ - rtems_interrupt_level level; - rtems_unsigned32 seconds; - rtems_unsigned32 microseconds; - - if ( !tp ) { - errno = EFAULT; - return -1; - } - - /* - * POSIX does not seem to allow for not having a TOD so we just - * grab the time of day. - * - * NOTE: XXX this routine should really be in the executive proper. - */ - - rtems_interrupt_disable(level); - seconds = _TOD_Seconds_since_epoch; - microseconds = _TOD_Current.ticks; - rtems_interrupt_enable(level); - - tp->tv_sec = seconds + POSIX_TIME_SECONDS_1970_THROUGH_1988; - tp->tv_usec = microseconds * _TOD_Microseconds_per_tick; - - /* - * newlib does not have timezone and daylight savings time - * yet. When it does this needs to be fixed. - */ - -#if 0 - if ( tzp ) { - tzp->tz_minuteswest = 0; /* at UTC */ - tzp->tz_dsttime = 0; /* no daylight savings */ - tzp->minuteswest = timezone / 60; /* from seconds to minutes */ - tzp->dsttime = daylight; - } -#endif - return 0; -} - -#if defined(RTEMS_NEWLIB) - -/* - * "Reentrant" version - */ - -int _gettimeofday_r( - struct _reent *ignored_reentrancy_stuff, - struct timeval *tp, - struct timezone *tzp -) -{ - return gettimeofday( tp, tzp ); -} - -/* - * "System call" version - */ - -int _gettimeofday( - struct timeval *tp, - struct timezone *tzp -) -{ - return gettimeofday( tp, tzp ); -} - -#endif /* defined(RTEMS_NEWLIB) */ - -#endif diff --git a/c/src/lib/libc/__sbrk.c b/c/src/lib/libc/__sbrk.c deleted file mode 100644 index 87753d7016..0000000000 --- a/c/src/lib/libc/__sbrk.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * RTEMS "Broken" __sbrk Implementation - * - * NOTE: sbrk is provided by the BSP. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if !defined(RTEMS_UNIX) - -#include - -void * __sbrk( - int incr -) -{ - errno = EINVAL; - return (void *)0; -} -#endif diff --git a/c/src/lib/libc/__times.c b/c/src/lib/libc/__times.c deleted file mode 100644 index eab408e8d3..0000000000 --- a/c/src/lib/libc/__times.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * times() - POSIX 1003.1b 4.5.2 - Get Process Times - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include -#include -#include -#include -#include - -clock_t _times( - struct tms *ptms -) -{ - rtems_status_code status; - rtems_interval ticks; - - if ( !ptms ) { - errno = EFAULT; - return -1; - } - - /* "POSIX" does not seem to allow for not having a TOD */ - status = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks ); - if ( status != RTEMS_SUCCESSFUL ) { - assert( 0 ); - return -1; - } - - /* - * RTEMS has no notion of system versus user time and although - * a way to keep track of per task CPU usage was added since - * 3.6.0, this routine does not utilize it yet. - */ - - ptms->tms_utime = ticks; - ptms->tms_stime = 0; - ptms->tms_cutime = 0; - ptms->tms_cstime = 0; - - return 0; -} - -/* - * times() - * - * times() system call wrapper for _times() above. - */ - -clock_t times( - struct tms *ptms -) -{ - return _times( ptms ); -} - -/* - * _times_r - * - * This is the Newlib dependent reentrant version of times(). - */ - -#if defined(RTEMS_NEWLIB) - -#include - -clock_t _times_r( - struct _reent *ptr, - struct tms *ptms -) -{ - return _times( ptms ); -} -#endif diff --git a/c/src/lib/libc/access.c b/c/src/lib/libc/access.c deleted file mode 100644 index 7540cd8d55..0000000000 --- a/c/src/lib/libc/access.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * access() - POSIX 1003.1b 5.6.3 - File Accessibility - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -int access( - const char *path, - int amode -) -{ - struct stat statbuf; - - if ( stat(path, &statbuf) ) - return -1; - - if ( amode & R_OK ) { - if (!( statbuf.st_mode & S_IREAD )) - return -1; - } - - if ( amode & W_OK ) { - if ( !( statbuf.st_mode & S_IWRITE ) ) - return -1; - } - - if ( amode & X_OK ) { - if ( !( statbuf.st_mode & S_IEXEC ) ) - return -1; - } - - return 0; -} - diff --git a/c/src/lib/libc/assoc.c b/c/src/lib/libc/assoc.c deleted file mode 100644 index 3e4fb21211..0000000000 --- a/c/src/lib/libc/assoc.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * assoc.c - * rtems assoc routines - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include /* strcat, strcmp */ - -#define STREQ(a,b) (strcmp((a), (b)) == 0) -#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME)) - -const rtems_assoc_t * -rtems_assoc_ptr_by_name( - const rtems_assoc_t *ap, - const char *name - ) -{ - const rtems_assoc_t *default_ap = 0; - - if (rtems_assoc_is_default(ap)) - default_ap = ap++; - - for ( ; ap->name; ap++) - if (strcmp(ap->name, name) == 0) - return ap; - - return default_ap; -} - -const rtems_assoc_t * -rtems_assoc_ptr_by_local( - const rtems_assoc_t *ap, - unsigned32 local_value - ) -{ - const rtems_assoc_t *default_ap = 0; - - if (rtems_assoc_is_default(ap)) - default_ap = ap++; - - for ( ; ap->name; ap++) - if (ap->local_value == local_value) - return ap; - - return default_ap; -} - - -const rtems_assoc_t * -rtems_assoc_ptr_by_remote( - const rtems_assoc_t *ap, - unsigned32 remote_value - ) -{ - const rtems_assoc_t *default_ap = 0; - - if (rtems_assoc_is_default(ap)) - default_ap = ap++; - - for ( ; ap->name; ap++) - if (ap->remote_value == remote_value) - return ap; - - return default_ap; -} - - -/* - * Get values - */ - -unsigned32 -rtems_assoc_remote_by_local( - const rtems_assoc_t *ap, - unsigned32 local_value - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_local(ap, local_value); - if (nap) - return nap->remote_value; - - return 0; -} - -unsigned32 -rtems_assoc_local_by_remote( - const rtems_assoc_t *ap, - unsigned32 remote_value - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_remote(ap, remote_value); - if (nap) - return nap->local_value; - - return 0; -} - -unsigned32 -rtems_assoc_remote_by_name( - const rtems_assoc_t *ap, - const char *name - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_name(ap, name); - if (nap) - return nap->remote_value; - - return 0; -} - -unsigned32 -rtems_assoc_local_by_name( - const rtems_assoc_t *ap, - const char *name - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_name(ap, name); - if (nap) - return nap->local_value; - - return 0; -} - -/* - * what to return if a value is not found - * this is not reentrant, but it really shouldn't be invoked anyway - */ - -const char *rtems_assoc_name_bad( - unsigned32 bad_value -); - -/* body in separate file to reduce dependency on printf */ - - -const char * -rtems_assoc_name_by_local( - const rtems_assoc_t *ap, - unsigned32 local_value - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_local(ap, local_value); - if (nap) - return nap->name; - - return rtems_assoc_name_bad(local_value); -} - -const char * -rtems_assoc_name_by_remote( - const rtems_assoc_t *ap, - unsigned32 remote_value - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_remote(ap, remote_value); - if (nap) - return nap->name; - - return rtems_assoc_name_bad(remote_value); -} - -/* - * Bitfield functions assume just 1 bit set in each of remote and local - * entries; they do not check for this. - */ - -unsigned32 rtems_assoc_remote_by_local_bitfield( - const rtems_assoc_t *ap, - unsigned32 local_value - ) -{ - unsigned32 b; - unsigned32 remote_value = 0; - - for (b = 1; b; b <<= 1) - if (b & local_value) - remote_value |= rtems_assoc_remote_by_local(ap, b); - - return remote_value; -} - - -unsigned32 rtems_assoc_local_by_remote_bitfield( - const rtems_assoc_t *ap, - unsigned32 remote_value - ) -{ - unsigned32 b; - unsigned32 local_value = 0; - - for (b = 1; b; b <<= 1) - if (b & remote_value) - local_value |= rtems_assoc_local_by_remote(ap, b); - - return local_value; -} - -char * -rtems_assoc_name_by_remote_bitfield( - const rtems_assoc_t *ap, - unsigned32 value, - char *buffer - ) -{ - unsigned32 b; - - *buffer = 0; - - for (b = 1; b; b <<= 1) - if (b & value) - { - if (*buffer) - strcat(buffer, " "); - strcat(buffer, rtems_assoc_name_by_remote(ap, b)); - } - - return buffer; -} - -char * -rtems_assoc_name_by_local_bitfield( - const rtems_assoc_t *ap, - unsigned32 value, - char *buffer - ) -{ - unsigned32 b; - - *buffer = 0; - - for (b = 1; b; b <<= 1) - if (b & value) - { - if (*buffer) - strcat(buffer, " "); - strcat(buffer, rtems_assoc_name_by_local(ap, b)); - } - - return buffer; -} diff --git a/c/src/lib/libc/assocnamebad.c b/c/src/lib/libc/assocnamebad.c deleted file mode 100644 index 4a6a52d6c6..0000000000 --- a/c/src/lib/libc/assocnamebad.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * assoc.c - * rtems assoc routines - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include /* sprintf */ -#include /* strcat, strcmp */ - -#define STREQ(a,b) (strcmp((a), (b)) == 0) -#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME)) - -/* - * what to return if a value is not found - * this is not reentrant, but it really shouldn't be invoked anyway - */ - -const char * -rtems_assoc_name_bad( - unsigned32 bad_value -) -{ -#ifdef RTEMS_DEBUG - static char bad_buffer[32]; - - sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); -#else - static char bad_buffer[32] = ""; -#endif - return bad_buffer; -} - - diff --git a/c/src/lib/libc/base_fs.c b/c/src/lib/libc/base_fs.c deleted file mode 100644 index 119f38d794..0000000000 --- a/c/src/lib/libc/base_fs.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Base file system initialization - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -/* - * Global information for the base file system. - */ - -rtems_user_env_t rtems_global_user_env; -rtems_user_env_t * rtems_current_user_env = &rtems_global_user_env; - -/* - * Default mode for created files. - */ - - -/* - * rtems_filesystem_initialize - * - * Initialize the foundation of the file system. This is specified - * by the structure rtems_filesystem_mount_table. The usual - * configuration is a single instantiation of the IMFS or miniIMFS with - * a single "/dev" directory in it. - */ - -void rtems_filesystem_initialize( void ) -{ -#if !defined(RTEMS_UNIX) -#if 0 - int i; -#endif - int status; - rtems_filesystem_mount_table_entry_t *entry; - rtems_filesystem_mount_table_t *mt; - - /* - * Set the default umask to "022". - */ - - rtems_filesystem_umask = 022; - - - init_fs_mount_table(); - - /* - * mount the first filesystem. - */ - - if ( rtems_filesystem_mount_table_size == 0 ) - rtems_fatal_error_occurred( 0xABCD0001 ); - - mt = &rtems_filesystem_mount_table[0]; - - status = mount( - &entry, mt->fs_ops, mt->fsoptions, mt->device, mt->mount_point ); - - if ( status == -1 ) - rtems_fatal_error_occurred( 0xABCD0002 ); - - rtems_filesystem_link_counts = 0; - rtems_filesystem_root = entry->mt_fs_root; - rtems_filesystem_current = rtems_filesystem_root; - - - /* - * Traditionally RTEMS devices are under "/dev" so install this directory. - * - * If the mkdir() fails, we can't print anything so just fatal error. - * - * NOTE: UNIX root is 755 and owned by root/root (0/0). It is actually - * created that way by the IMFS. - */ - - status = mkdir( "/dev", 0777); - if ( status != 0 ) - rtems_fatal_error_occurred( 0xABCD0003 ); - - /* - * This code if if'ed 0 out because you can't mount another - * filesystem properly until the mount point it will be - * mounted onto is created. Moreover, if it is going to - * use a device, then it is REALLY unfair to attempt this - * before device drivers are initialized. - */ - -#if 0 - /* - * Now if there are other filesystems to mount, go for it. - */ - - for ( i=1 ; i < rtems_filesystem_mount_table_size ; i++ ) { - mt = &rtems_filesystem_mount_table[0]; - - status = mount( - &entry, mt->fs_ops, mt->fsoptions, mt->device, mt->mount_point ); - - if ( status == -1 ) - rtems_fatal_error_occurred( 0xABCD0003 ); - } -#endif -#endif -} diff --git a/c/src/lib/libc/cfgetispeed.c b/c/src/lib/libc/cfgetispeed.c deleted file mode 100644 index 964b51ccc4..0000000000 --- a/c/src/lib/libc/cfgetispeed.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * cfgetispeed() - POSIX 1003.1b 7.1.3 - Baud Rate Functions - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if defined(RTEMS_NEWLIB) - -#include -#include -#include -#include - -speed_t cfgetispeed( - const struct termios *tp -) -{ - return (tp->c_cflag / (CIBAUD / CBAUD)) & CBAUD; -} -#endif diff --git a/c/src/lib/libc/cfgetospeed.c b/c/src/lib/libc/cfgetospeed.c deleted file mode 100644 index 955791cbe6..0000000000 --- a/c/src/lib/libc/cfgetospeed.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * cfgetospeed() - POSIX 1003.1b 7.1.3 - Baud Rate Functions - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if defined(RTEMS_NEWLIB) - -#include -#include -#include -#include - -speed_t cfgetospeed( - const struct termios *tp -) -{ - return tp->c_cflag & CBAUD; -} -#endif diff --git a/c/src/lib/libc/cfsetispeed.c b/c/src/lib/libc/cfsetispeed.c deleted file mode 100644 index 0298340848..0000000000 --- a/c/src/lib/libc/cfsetispeed.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * cfsetispeed() - POSIX 1003.1b 7.1.3 - Baud Rate Functions - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if defined(RTEMS_NEWLIB) - -#include -#include -#include -#include - -#include -#include - -int cfsetispeed( - struct termios *tp, - speed_t speed -) -{ - if ( speed & ~CBAUD ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - tp->c_cflag = (tp->c_cflag & ~CIBAUD) | (speed * (CIBAUD / CBAUD)); - return 0; -} -#endif diff --git a/c/src/lib/libc/cfsetospeed.c b/c/src/lib/libc/cfsetospeed.c deleted file mode 100644 index 20e1b11403..0000000000 --- a/c/src/lib/libc/cfsetospeed.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * cfsetospeed() - POSIX 1003.1b 7.1.3 - Baud Rate Functions - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if defined(RTEMS_NEWLIB) - -#include -#include -#include -#include - -#include -#include - -int cfsetospeed( - struct termios *tp, - speed_t speed -) -{ - if ( speed & ~CBAUD ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - tp->c_cflag = (tp->c_cflag & ~CBAUD) | speed; - return 0; -} -#endif diff --git a/c/src/lib/libc/chdir.c b/c/src/lib/libc/chdir.c deleted file mode 100644 index 07fca7610a..0000000000 --- a/c/src/lib/libc/chdir.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * chdir() - POSIX 1003.1b - 5.2.1 - Change Current Working Directory - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include -#include - -#include -#include - -int chdir( - const char *pathname -) -{ - rtems_filesystem_location_info_t loc; - int result; - - /* - * Get the node where we wish to go. - */ - - result = rtems_filesystem_evaluate_path( - pathname, RTEMS_LIBIO_PERMS_SEARCH, &loc, TRUE ); - if ( result != 0 ) - return -1; - - /* - * Verify you can change directory into this node. - */ - - if ( !loc.ops->node_type_h ) { - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) { - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( ENOTDIR ); - } - - rtems_filesystem_freenode( &rtems_filesystem_current ); - - rtems_filesystem_current = loc; - - return 0; -} diff --git a/c/src/lib/libc/chmod.c b/c/src/lib/libc/chmod.c deleted file mode 100644 index 5e62be0683..0000000000 --- a/c/src/lib/libc/chmod.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * chmod() - POSIX 1003.1b 5.6.4 - Change File Modes - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include - -int chmod( - const char *path, - mode_t mode -) -{ - int status; - rtems_filesystem_location_info_t loc; - int result; - - status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE ); - if ( status != 0 ) - return -1; - - if ( !loc.handlers ){ - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( EBADF ); - } - - if ( !loc.handlers->fchmod_h ){ - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - result = (*loc.handlers->fchmod_h)( &loc, mode ); - - rtems_filesystem_freenode( &loc ); - - return result; -} diff --git a/c/src/lib/libc/chown.c b/c/src/lib/libc/chown.c deleted file mode 100644 index c860ace76e..0000000000 --- a/c/src/lib/libc/chown.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * chown() - POSIX 1003.1b 5.6.5 - Change Owner and Group of a File - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include -#include - -#include -#include - -int chown( - const char *path, - uid_t owner, - gid_t group -) -{ - rtems_filesystem_location_info_t loc; - int result; - - if ( rtems_filesystem_evaluate_path( path, 0x00, &loc, TRUE ) ) - return -1; - - if ( !loc.ops->chown_h ) { - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - result = (*loc.ops->chown_h)( &loc, owner, group ); - - rtems_filesystem_freenode( &loc ); - - return result; -} diff --git a/c/src/lib/libc/chroot.c b/c/src/lib/libc/chroot.c deleted file mode 100644 index 95124a43c0..0000000000 --- a/c/src/lib/libc/chroot.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * chroot() - Change Root Directory - * Author: fernando.ruiz@ctv.es - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include -#include - -#include -#include - -int chroot( - const char *pathname -) -{ - int result; - rtems_filesystem_location_info_t loc; - - /* an automatic call to new private env the first time */ - if (rtems_current_user_env == &rtems_global_user_env) { - rtems_libio_set_private_env(); /* try to set a new private env*/ - if (rtems_current_user_env == &rtems_global_user_env) /* not ok */ - rtems_set_errno_and_return_minus_one( ENOTSUP ); - }; - - loc = rtems_filesystem_root; /* save the value */ - - result = chdir(pathname); - if (result) { - rtems_filesystem_root = loc; /* restore the value */ - rtems_set_errno_and_return_minus_one( errno ); - }; - rtems_filesystem_root = rtems_filesystem_current; - - return 0; -} diff --git a/c/src/lib/libc/close.c b/c/src/lib/libc/close.c deleted file mode 100644 index a9bfc289ac..0000000000 --- a/c/src/lib/libc/close.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * close() - POSIX 1003.1b 6.3.1 - Close a File - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -int close( - int fd -) -{ - rtems_libio_t *iop; - rtems_status_code rc; - - rtems_libio_check_fd(fd); - iop = rtems_libio_iop(fd); - rtems_libio_check_is_open(iop); - - rc = RTEMS_SUCCESSFUL; - if ( iop->handlers->close_h ) - rc = (*iop->handlers->close_h)( iop ); - - rtems_filesystem_freenode( &iop->pathinfo ); - rtems_libio_free( iop ); - - return rc; -} - -/* - * _close_r - * - * This is the Newlib dependent reentrant version of close(). - */ - -#if defined(RTEMS_NEWLIB) - -#include - -int _close_r( - struct _reent *ptr, - int fd -) -{ - return close( fd ); -} -#endif diff --git a/c/src/lib/libc/closedir.c b/c/src/lib/libc/closedir.c deleted file mode 100644 index 64562264ec..0000000000 --- a/c/src/lib/libc/closedir.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * closedir() - POSIX 1003.1b - XXX - * - * This was copied from Newlib 1.8.0. - * - * - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)closedir.c 5.9 (Berkeley) 2/23/91"; -#endif /* LIBC_SCCS and not lint */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include - -#include -#include - -/* - * close a directory. - */ -int -closedir(dirp) - register DIR *dirp; -{ - int fd; - - if ( !dirp ) - rtems_set_errno_and_return_minus_one( EBADF ); - - fd = dirp->dd_fd; - dirp->dd_fd = -1; - dirp->dd_loc = 0; - (void)free((void *)dirp->dd_buf); - (void)free((void *)dirp); - return(close(fd)); -} diff --git a/c/src/lib/libc/creat.c b/c/src/lib/libc/creat.c deleted file mode 100644 index ed7a872d4a..0000000000 --- a/c/src/lib/libc/creat.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * $Id$ - */ - -/* creat() "system call" */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -/* This is needed by f2c and therefore the SPEC benchmarks. */ - -#include - -int -creat (const char *path, mode_t mode) -{ - return open (path, O_WRONLY | O_CREAT | O_TRUNC, mode); -} diff --git a/c/src/lib/libc/ctermid.c b/c/src/lib/libc/ctermid.c deleted file mode 100644 index 6869acb291..0000000000 --- a/c/src/lib/libc/ctermid.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * ctermid() - POSIX 1003.1b 4.7.1 - Generate Terminal Pathname - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if defined(RTEMS_NEWLIB) - -#include -#include - -static char *ctermid_name = "/dev/console"; - -char *ctermid( - char *s -) -{ - if ( !s ) - return ctermid_name; - - strcpy( s, ctermid_name ); - return s; -} - -#endif diff --git a/c/src/lib/libc/dup.c b/c/src/lib/libc/dup.c deleted file mode 100644 index 2edce9c6ff..0000000000 --- a/c/src/lib/libc/dup.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * dup() - POSIX 1003.1b 6.2.1 Duplicate an Open File Descriptor - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -int dup( - int fildes -) -{ - return fcntl( fildes, F_DUPFD, 0 ); -} diff --git a/c/src/lib/libc/dup2.c b/c/src/lib/libc/dup2.c deleted file mode 100644 index af4ed99fb5..0000000000 --- a/c/src/lib/libc/dup2.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * dup2() - POSIX 1003.1b 6.2.1 Duplicate an Open File Descriptor - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include - -int dup2( - int fildes, - int fildes2 -) -{ - int status; - struct stat buf; - - /* - * If fildes is not valid, then fildes2 should not be closed. - */ - - status = fstat( fildes, &buf ); - if ( status == -1 ) - return -1; - - /* - * If fildes2 is not valid, then we should not do anything either. - */ - - status = fstat( fildes2, &buf ); - if ( status == -1 ) - return -1; - - /* - * This fcntl handles everything else. - */ - - return fcntl( fildes, F_DUPFD, fildes2 ); -} diff --git a/c/src/lib/libc/envlock.c b/c/src/lib/libc/envlock.c deleted file mode 100644 index 444d0e6b63..0000000000 --- a/c/src/lib/libc/envlock.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Author: Till Straumann , 3/2002 - * - * $Id$ - */ - -/* provide locking for the global environment 'environ' */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include - -/* - * NOTES: - * - although it looks like a classical multiple-readers / single writer (MRSW) - * locking problem, we still use a single lock for the following reasons: - * 1) newlib has no provision / hook for calling different locking routines - * from setenv/putenv and getenv, respectively. - * 2) MRSW involves calling several semaphore-primitives, even in the most - * likely case of a first-reader's access. This probably takes more CPU - * time than just waiting until another reader is done; environment - * access is fast. - * - the lock implementation must allow nesting (same thread may call - * lock-lock-unlock-unlock). - * - NEWLIB-1.8.2 has an ugly BUG: if environ is NULL, _findenv_r() bails - * out leaving the lock held :-( - * - * Used by the following functions: - * findenv_r(), setenv_r(), and unsetenv_r() which are called by - * getenv(), getenv_r(), setenv(), and unsetenv(). - * - */ - -#if defined(ENVLOCK_DEDIDCATED_MUTEX) -static rtems_id envLock=0; - -static void -__rtems_envlock_init(void) -{ - extern char **environ; - rtems_status_code rc; - - if (envLock) /* already initialized */ - return; - - assert(environ && "MUST have non-NULL 'environ' due to newlib bug"); - - rc = rtems_semaphore_create( - rtems_build_name('E','N','V','S'), - 1, - RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, - 0, - &envLock); - if (RTEMS_SUCCESSFUL!=rc) - rtems_fatal_error_occurred(rc); -} - -void -__env_lock(struct _reent *r) -{ - /* Do lazy init */ - if (!envLock) - __rtems_envlock_init(); - /* - * Must not use a semaphore before pre-tasking hook is called. - * - it will corrupt memory :-( - */ - - if (_Thread_Executing) - rtems_semaphore_obtain(envLock, RTEMS_WAIT, RTEMS_NO_TIMEOUT); -} - -void -__env_unlock(struct _reent *r) -{ - /* - * Must not use a semaphore before pre-tasking hook is called. - * - it will corrupt memory :-( - */ - if (_Thread_Executing) - rtems_semaphore_release(envLock); -} -#else - -/* - * Reuse the libio mutex -- it is always initialized before we - * could possibly run. - */ - -#include - -void -__env_lock(struct _reent *r) -{ - rtems_semaphore_obtain( rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); -} - -void -__env_unlock(struct _reent *r) -{ - rtems_semaphore_release( rtems_libio_semaphore ); -} -#endif diff --git a/c/src/lib/libc/error.c b/c/src/lib/libc/error.c deleted file mode 100644 index fff95ce80c..0000000000 --- a/c/src/lib/libc/error.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * report errors and panics to RTEMS' stderr. - * Currently just used by RTEMS monitor. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -/* - * These routines provide general purpose error reporting. - * rtems_error reports an error to stderr and allows use of - * printf style formatting. A newline is appended to all messages. - * - * error_flag can be specified as any of the following: - * - * RTEMS_ERROR_ERRNO -- include errno text in output - * RTEMS_ERROR_PANIC -- halts local system after output - * RTEMS_ERROR_ABORT -- abort after output - * - * It can also include a rtems_status value which can be OR'd - * with the above flags. * - * - * EXAMPLE - * #include - * #include - * rtems_error(0, "stray interrupt %d", intr); - * - * EXAMPLE - * if ((status = rtems_task_create(...)) != RTEMS_SUCCCESSFUL) - * { - * rtems_error(status | RTEMS_ERROR_ABORT, - * "could not create task"); - * } - * - * EXAMPLE - * if ((fd = open(pathname, O_RDNLY)) < 0) - * { - * rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname); - * goto failed; - * } - */ - -#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ -#include - -#include -#include - -#include -#include -#include -#include -#include -#include /* _exit() */ - -/* bug in hpux : no prototypes unless you are C++ */ -#ifdef hpux9 -char *strerror(int); -#endif - -extern char *rtems_progname; -int rtems_panic_in_progress; - -rtems_assoc_t rtems_status_assoc[] = { - { "successful completion", RTEMS_SUCCESSFUL, }, - { "returned from a thread", RTEMS_TASK_EXITTED, }, - { "multiprocessing not configured", RTEMS_MP_NOT_CONFIGURED, }, - { "invalid object name", RTEMS_INVALID_NAME, }, - { "invalid object id", RTEMS_INVALID_ID, }, - { "too many", RTEMS_TOO_MANY, }, - { "timed out waiting", RTEMS_TIMEOUT, }, - { "object deleted while waiting", RTEMS_OBJECT_WAS_DELETED, }, - { "specified size was invalid", RTEMS_INVALID_SIZE, }, - { "address specified is invalid", RTEMS_INVALID_ADDRESS, }, - { "number was invalid", RTEMS_INVALID_NUMBER, }, - { "item has not been initialized", RTEMS_NOT_DEFINED, }, - { "resources still outstanding", RTEMS_RESOURCE_IN_USE, }, - { "request not satisfied", RTEMS_UNSATISFIED, }, - { "thread is in wrong state", RTEMS_INCORRECT_STATE, }, - { "thread already in state", RTEMS_ALREADY_SUSPENDED, }, - { "illegal on calling thread", RTEMS_ILLEGAL_ON_SELF, }, - { "illegal for remote object", RTEMS_ILLEGAL_ON_REMOTE_OBJECT, }, - { "called from wrong environment", RTEMS_CALLED_FROM_ISR, }, - { "invalid thread priority", RTEMS_INVALID_PRIORITY, }, - { "invalid date/time", RTEMS_INVALID_CLOCK, }, - { "invalid node id", RTEMS_INVALID_NODE, }, - { "directive not configured", RTEMS_NOT_CONFIGURED, }, - { "not owner of resource", RTEMS_NOT_OWNER_OF_RESOURCE , }, - { "directive not implemented", RTEMS_NOT_IMPLEMENTED, }, - { "RTEMS inconsistency detected", RTEMS_INTERNAL_ERROR, }, - { "could not get enough memory", RTEMS_NO_MEMORY, }, - { "driver IO error", RTEMS_IO_ERROR, }, - { "internal multiprocessing only", THREAD_STATUS_PROXY_BLOCKING, }, - { 0, 0, 0 }, -}; - - -const char * -rtems_status_text( - rtems_status_code status -) -{ - return rtems_assoc_name_by_local(rtems_status_assoc, status); -} - - -static int rtems_verror( - unsigned32 error_flag, - const char *printf_format, - va_list arglist -) -{ - int local_errno = 0; - int chars_written = 0; - rtems_status_code status; - - if (error_flag & RTEMS_ERROR_PANIC) - { - if (rtems_panic_in_progress++) - _Thread_Disable_dispatch(); /* disable task switches */ - - /* don't aggravate things */ - if (rtems_panic_in_progress > 2) - return 0; - } - - (void) fflush(stdout); /* in case stdout/stderr same */ - - status = error_flag & ~RTEMS_ERROR_MASK; - if (error_flag & RTEMS_ERROR_ERRNO) /* include errno? */ - local_errno = errno; - - if (_System_state_Is_multiprocessing) - fprintf(stderr, "[%d] ", _Configuration_MP_table->node); - - if (rtems_progname && *rtems_progname) - chars_written += fprintf(stderr, "%s: ", rtems_progname); - chars_written += vfprintf(stderr, printf_format, arglist); - - if (status) - chars_written += fprintf(stderr, " (status: %s)", rtems_status_text(status)); - - if (local_errno) - { - if ((local_errno > 0) && *strerror(local_errno)) - chars_written += fprintf(stderr, " (errno: %s)", strerror(local_errno)); - else - chars_written += fprintf(stderr, " (unknown errno=%d)", local_errno); - } - - chars_written += fprintf(stderr, "\n"); - - (void) fflush(stderr); - - if (error_flag & (RTEMS_ERROR_PANIC | RTEMS_ERROR_ABORT)) - { - if (error_flag & RTEMS_ERROR_PANIC) - { - rtems_error(0, "fatal error, exiting"); - _exit(local_errno); - } - else - { - rtems_error(0, "fatal error, aborting"); - abort(); - } - } - return chars_written; -} - - -/* - * Report an error. - * error_flag is as above; printf_format is a normal - * printf(3) format string, with its concommitant arguments. - * - * Returns the number of characters written. - */ - -int rtems_error( - int error_flag, - const char *printf_format, - ... - ) -{ - va_list arglist; - int chars_written; - - va_start(arglist, printf_format); - chars_written = rtems_verror(error_flag, printf_format, arglist); - va_end(arglist); - - return chars_written; -} - -/* - * rtems_panic is shorthand for rtems_error(RTEMS_ERROR_PANIC, ...) - */ - -void rtems_panic( - const char *printf_format, - ... - ) -{ - va_list arglist; - - va_start(arglist, printf_format); - (void) rtems_verror(RTEMS_ERROR_PANIC, printf_format, arglist); - va_end(arglist); -} diff --git a/c/src/lib/libc/eval.c b/c/src/lib/libc/eval.c deleted file mode 100644 index 7d70d20cf7..0000000000 --- a/c/src/lib/libc/eval.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * rtems_filesystem_evaluate_path() - * - * Routine to seed the evaluate path routine. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -int rtems_filesystem_evaluate_path( - const char *pathname, - int flags, - rtems_filesystem_location_info_t *pathloc, - int follow_link -) -{ - int i; - int result; - rtems_filesystem_node_types_t type; - - /* - * Verify Input parameters. - */ - - if ( !pathname ) - rtems_set_errno_and_return_minus_one( EFAULT ); - - if ( !pathloc ) - rtems_set_errno_and_return_minus_one( EIO ); /* should never happen */ - - /* - * Evaluate the path using the optable evalpath. - */ - - rtems_filesystem_get_start_loc( pathname, &i, pathloc ); - - if ( !pathloc->ops->evalpath_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - result = (*pathloc->ops->evalpath_h)( &pathname[i], flags, pathloc ); - - /* - * Get the Node type and determine if you need to follow the link or - * not. - */ - - if ( (result == 0) && follow_link ) { - - if ( !pathloc->ops->node_type_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - type = (*pathloc->ops->node_type_h)( pathloc ); - - if ( ( type == RTEMS_FILESYSTEM_HARD_LINK ) || - ( type == RTEMS_FILESYSTEM_SYM_LINK ) ) { - - if ( !pathloc->ops->eval_link_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - result = (*pathloc->ops->eval_link_h)( pathloc, flags ); - - } - } - - return result; -} - diff --git a/c/src/lib/libc/fchdir.c b/c/src/lib/libc/fchdir.c deleted file mode 100644 index 7c984bc892..0000000000 --- a/c/src/lib/libc/fchdir.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * fchdir() - compatible with SVr4, 4.4BSD and X/OPEN - Change Directory - * - * COPYRIGHT (c) 1989-2000. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -#include -#include -#include -#include - -int fchdir( - int fd -) -{ - rtems_libio_t *iop; - - rtems_libio_check_fd( fd ); - iop = rtems_libio_iop( fd ); - rtems_libio_check_is_open(iop); - - /* - * Now process the fchmod(). - */ - - rtems_libio_check_permissions( iop, LIBIO_FLAGS_READ ); - - /* - * Verify you can change directory into this node. - */ - - if ( !iop->pathinfo.ops ) { - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - if ( !iop->pathinfo.ops->node_type_h ) { - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - if ( (*iop->pathinfo.ops->node_type_h)( &iop->pathinfo ) != - RTEMS_FILESYSTEM_DIRECTORY ) { - rtems_set_errno_and_return_minus_one( ENOTDIR ); - } - - rtems_filesystem_freenode( &rtems_filesystem_current ); - - /* - * FIXME : I feel there should be another call to - * actually take into account the extra reference to - * this node which we are making here. I can - * see the freenode interface but do not see - * allocnode node interface. It maybe node_type. - */ - - rtems_filesystem_current = iop->pathinfo; - - return 0; -} - diff --git a/c/src/lib/libc/fchmod.c b/c/src/lib/libc/fchmod.c deleted file mode 100644 index 70b58a0998..0000000000 --- a/c/src/lib/libc/fchmod.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * fchmod() - POSIX 1003.1b 5.6.4 - Change File Modes - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -#include -#include -#include -#include - -int fchmod( - int fd, - mode_t mode -) -{ - rtems_libio_t *iop; - - rtems_libio_check_fd( fd ); - iop = rtems_libio_iop( fd ); - rtems_libio_check_is_open(iop); - - /* - * Now process the fchmod(). - */ - - rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE ); - - if ( !iop->handlers->fchmod_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - return (*iop->pathinfo.handlers->fchmod_h)( &iop->pathinfo, mode ); -} - diff --git a/c/src/lib/libc/fcntl.c b/c/src/lib/libc/fcntl.c deleted file mode 100644 index 6c2aa1da11..0000000000 --- a/c/src/lib/libc/fcntl.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * fcntl() - POSIX 1003.1b 6.5.2 - File Control - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include - -#include -#include - -int fcntl( - int fd, - int cmd, - ... -) -{ - va_list ap; - rtems_libio_t *iop; - rtems_libio_t *diop; - int fd2; - int flags; - int mask; - int ret = 0; - - va_start( ap, cmd ); - - rtems_libio_check_fd( fd ); - iop = rtems_libio_iop( fd ); - rtems_libio_check_is_open(iop); - - /* - * Now process the fcntl(). - */ - - /* - * This switch should contain all the cases from POSIX. - */ - - switch ( cmd ) { - case F_DUPFD: /* dup */ - fd2 = va_arg( ap, int ); - if ( fd2 ) - diop = rtems_libio_iop( fd2 ); - else { - /* allocate a file control block */ - diop = rtems_libio_allocate(); - if ( diop == 0 ) { - ret = -1; - break; - } - } - - diop->handlers = iop->handlers; - diop->file_info = iop->file_info; - diop->flags = iop->flags; - diop->pathinfo = iop->pathinfo; - ret = (int) (diop - rtems_libio_iops); - break; - - case F_GETFD: /* get f_flags */ - ret = ((iop->flags & LIBIO_FLAGS_CLOSE_ON_EXEC) != 0); - break; - - case F_SETFD: /* set f_flags */ - /* - * Interpret the third argument as the "close on exec()" flag. - * If this argument is 1, then the file descriptor is to be closed - * if a new process is exec()'ed. Since RTEMS does not support - * processes, then we can ignore this one except to make - * F_GETFD work. - */ - - if ( va_arg( ap, int ) ) - iop->flags |= LIBIO_FLAGS_CLOSE_ON_EXEC; - else - iop->flags &= ~LIBIO_FLAGS_CLOSE_ON_EXEC; - break; - - case F_GETFL: /* more flags (cloexec) */ - ret = rtems_libio_to_fcntl_flags( iop->flags ); - break; - - case F_SETFL: - flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); - mask = LIBIO_FLAGS_NO_DELAY | LIBIO_FLAGS_APPEND; - - /* - * XXX If we are turning on append, should we seek to the end? - */ - - iop->flags = (iop->flags & ~mask) | (flags & mask); - break; - - case F_GETLK: - errno = ENOTSUP; - ret = -1; - break; - - case F_SETLK: - errno = ENOTSUP; - ret = -1; - break; - - case F_SETLKW: - errno = ENOTSUP; - ret = -1; - break; - - case F_SETOWN: /* for sockets. */ - errno = ENOTSUP; - ret = -1; - break; - - case F_GETOWN: /* for sockets. */ - errno = ENOTSUP; - ret = -1; - break; - - default: - errno = EINVAL; - ret = -1; - break; - } - - /* - * If we got this far successfully, then we give the optional - * filesystem specific handler a chance to process this. - */ - - if (ret >= 0) { - if (iop->handlers->fcntl_h) { - int err = (*iop->handlers->fcntl_h)( cmd, iop ); - if (err) { - errno = err; - ret = -1; - } - } - } - return ret; -} diff --git a/c/src/lib/libc/fdatasync.c b/c/src/lib/libc/fdatasync.c deleted file mode 100644 index ca27f996aa..0000000000 --- a/c/src/lib/libc/fdatasync.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * fdatasync() - POSIX 1003.1b 6.6.2 - Synchronize the Data of a File - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include -#include - -int fdatasync( - int fd -) -{ - rtems_libio_t *iop; - - rtems_libio_check_fd( fd ); - iop = rtems_libio_iop( fd ); - rtems_libio_check_is_open(iop); - rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE ); - - /* - * Now process the fdatasync(). - */ - - if ( !iop->handlers->fdatasync_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - return (*iop->handlers->fdatasync_h)( iop ); -} diff --git a/c/src/lib/libc/fpathconf.c b/c/src/lib/libc/fpathconf.c deleted file mode 100644 index ac65db000b..0000000000 --- a/c/src/lib/libc/fpathconf.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * fpathconf() - POSIX 1003.1b - 5.7.1 - Configurable Pathname Varables - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include -#include - -long fpathconf( - int fd, - int name -) -{ - long return_value; - rtems_libio_t *iop; - rtems_filesystem_limits_and_options_t *the_limits; - - rtems_libio_check_fd(fd); - iop = rtems_libio_iop(fd); - rtems_libio_check_is_open(iop); - rtems_libio_check_permissions(iop, LIBIO_FLAGS_READ); - - /* - * Now process the information request. - */ - - the_limits = &iop->pathinfo.mt_entry->pathconf_limits_and_options; - - switch ( name ) { - case _PC_LINK_MAX: - return_value = the_limits->link_max; - break; - case _PC_MAX_CANON: - return_value = the_limits->max_canon; - break; - case _PC_MAX_INPUT: - return_value = the_limits->max_input; - break; - case _PC_NAME_MAX: - return_value = the_limits->name_max; - break; - case _PC_PATH_MAX: - return_value = the_limits->path_max; - break; - case _PC_PIPE_BUF: - return_value = the_limits->pipe_buf; - break; - case _PC_CHOWN_RESTRICTED: - return_value = the_limits->posix_chown_restrictions; - break; - case _PC_NO_TRUNC: - return_value = the_limits->posix_no_trunc; - break; - case _PC_VDISABLE: - return_value = the_limits->posix_vdisable; - break; - case _PC_ASYNC_IO: - return_value = the_limits->posix_async_io; - break; - case _PC_PRIO_IO: - return_value = the_limits->posix_prio_io; - break; - case _PC_SYNC_IO: - return_value = the_limits->posix_sync_io; - break; - default: - rtems_set_errno_and_return_minus_one( EINVAL ); - break; - } - - return return_value; -} diff --git a/c/src/lib/libc/fs_null_handlers.c b/c/src/lib/libc/fs_null_handlers.c deleted file mode 100644 index f9a08d0aca..0000000000 --- a/c/src/lib/libc/fs_null_handlers.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Null Filesystem Operations Tables - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include - -/* - * Set of null operations handlers. - */ - -rtems_filesystem_file_handlers_r rtems_filesystem_null_handlers = { - NULL, /* open */ - NULL, /* close */ - NULL, /* read */ - NULL, /* write */ - NULL, /* ioctl */ - NULL, /* lseek */ - NULL, /* fstat */ - NULL, /* fchmod */ - NULL, /* ftruncate */ - NULL, /* fpathconf */ - NULL, /* fsync */ - NULL, /* fdatasync */ - NULL, /* fcntl */ - NULL /* rmnod */ -}; diff --git a/c/src/lib/libc/fstat.c b/c/src/lib/libc/fstat.c deleted file mode 100644 index 22b1f8c412..0000000000 --- a/c/src/lib/libc/fstat.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * fstat() - POSIX 1003.1b 5.6.2 - Get File Status - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -#include -#include - -int fstat( - int fd, - struct stat *sbuf -) -{ - rtems_libio_t *iop; - - /* - * Check to see if we were passed a valid pointer. - */ - - if ( !sbuf ) - rtems_set_errno_and_return_minus_one( EFAULT ); - - /* - * Now process the stat() request. - */ - - iop = rtems_libio_iop( fd ); - rtems_libio_check_fd( fd ); - rtems_libio_check_is_open(iop); - - if ( !iop->handlers ) - rtems_set_errno_and_return_minus_one( EBADF ); - - if ( !iop->handlers->fstat_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - /* - * Zero out the stat structure so the various support - * versions of stat don't have to. - */ - memset( sbuf, 0, sizeof(struct stat) ); - - return (*iop->handlers->fstat_h)( &iop->pathinfo, sbuf ); -} - -/* - * _fstat_r - * - * This is the Newlib dependent reentrant version of fstat(). - */ - -#if defined(RTEMS_NEWLIB) - -#include - -int _fstat_r( - struct _reent *ptr, - int fd, - struct stat *buf -) -{ - return fstat( fd, buf ); -} -#endif diff --git a/c/src/lib/libc/fsync.c b/c/src/lib/libc/fsync.c deleted file mode 100644 index 56ef546f83..0000000000 --- a/c/src/lib/libc/fsync.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * fsync() - POSIX 1003.1b 6.6.1 - Synchronize the State of a File - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include -#include - -int fsync( - int fd -) -{ - rtems_libio_t *iop; - - rtems_libio_check_fd( fd ); - iop = rtems_libio_iop( fd ); - rtems_libio_check_is_open(iop); - rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE ); - - /* - * Now process the fsync(). - */ - - if ( !iop->handlers ) - rtems_set_errno_and_return_minus_one( EBADF ); - - if ( !iop->handlers->fsync_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - return (*iop->handlers->fsync_h)( iop ); -} diff --git a/c/src/lib/libc/ftruncate.c b/c/src/lib/libc/ftruncate.c deleted file mode 100644 index 4f1cb79d93..0000000000 --- a/c/src/lib/libc/ftruncate.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * ftruncate() - Truncate a File to the Specified Length - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include -#include - -int ftruncate( - int fd, - off_t length -) -{ - rtems_libio_t *iop; - rtems_filesystem_location_info_t loc; - - rtems_libio_check_fd( fd ); - iop = rtems_libio_iop( fd ); - rtems_libio_check_is_open(iop); - - /* - * Now process the ftruncate() request. - */ - - /* - * Make sure we are not working on a directory - */ - - loc = iop->pathinfo; - if ( !loc.ops->node_type_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - if ( (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) - rtems_set_errno_and_return_minus_one( EISDIR ); - - rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE ); - - if ( !iop->handlers->ftruncate_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - return (*iop->handlers->ftruncate_h)( iop, length ); -} - diff --git a/c/src/lib/libc/getcwd.c b/c/src/lib/libc/getcwd.c deleted file mode 100644 index fdde4eea81..0000000000 --- a/c/src/lib/libc/getcwd.c +++ /dev/null @@ -1,287 +0,0 @@ -/* - * Copyright (c) 1989, 1991 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Copied from newlib 1.8.1. RTEMS can not build all of the contents - * of the UNIX directory but we need this routine. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -/* - * Added these when moved to RTEMS - */ - -#define _stat stat -#define _opendir opendir -#define _fstat fstat -#define _readdir readdir -#define _closedir closedir - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)getcwd.c 5.11 (Berkeley) 2/24/91"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include <_syslist.h> - -#define bcopy(a,b,c) memmove (b,a,c) - -#define ISDOT(dp) \ - (dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \ - (dp->d_name[1] == '.' && dp->d_name[2] == '\0'))) - -#ifndef _REENT_ONLY - -char * -getcwd (pt, size) - char *pt; - size_t size; -{ - register struct dirent *dp; - register DIR *dir = 0; - register dev_t dev; - register ino_t ino; - register int first; - register char *bpt, *bup; - struct stat s; - dev_t root_dev; - ino_t root_ino; - size_t ptsize, upsize; - int save_errno; - char *ept, *eup, *up; - - /* - * If no buffer specified by the user, allocate one as necessary. - * If a buffer is specified, the size has to be non-zero. The path - * is built from the end of the buffer backwards. - */ - - if (pt) - { - ptsize = 0; - if (!size) - { - errno = EINVAL; - return (char *) NULL; - } - ept = pt + size; - } - else - { - if (!(pt = (char *) malloc (ptsize = 1024 - 4))) - { - return (char *) NULL; - } - ept = pt + ptsize; - } - bpt = ept - 1; - *bpt = '\0'; - - /* - * Allocate bytes (1024 - malloc space) for the string of "../"'s. - * Should always be enough (it's 340 levels). If it's not, allocate - * as necessary. Special * case the first stat, it's ".", not "..". - */ - - if (!(up = (char *) malloc (upsize = 1024 - 4))) - { - goto err; - } - eup = up + MAXPATHLEN; - bup = up; - up[0] = '.'; - up[1] = '\0'; - - /* Save root values, so know when to stop. */ - if (stat ("/", &s)) - goto err; - root_dev = s.st_dev; - root_ino = s.st_ino; - - errno = 0; /* XXX readdir has no error return. */ - - for (first = 1;; first = 0) - { - /* Stat the current level. */ - if (_stat (up, &s)) - goto err; - - /* Save current node values. */ - ino = s.st_ino; - dev = s.st_dev; - - /* Check for reaching root. */ - if (root_dev == dev && root_ino == ino) - { - *--bpt = '/'; - /* - * It's unclear that it's a requirement to copy the - * path to the beginning of the buffer, but it's always - * been that way and stuff would probably break. - */ - (void) bcopy (bpt, pt, ept - bpt); - free (up); - return pt; - } - - /* - * Build pointer to the parent directory, allocating memory - * as necessary. Max length is 3 for "../", the largest - * possible component name, plus a trailing NULL. - */ - - if (bup + 3 + MAXNAMLEN + 1 >= eup) - { - if (!(up = (char *) realloc (up, upsize *= 2))) - { - goto err; - } - bup = up; - eup = up + upsize; - } - *bup++ = '.'; - *bup++ = '.'; - *bup = '\0'; - - /* Open and stat parent directory. */ - if (!(dir = _opendir (up)) || _fstat (__dirfd (dir), &s)) - goto err; - - /* Add trailing slash for next directory. */ - *bup++ = '/'; - - /* - * If it's a mount point, have to stat each element because - * the inode number in the directory is for the entry in the - * parent directory, not the inode number of the mounted file. - */ - - save_errno = 0; - if (s.st_dev == dev) - { - for (;;) - { - if (!(dp = _readdir (dir))) - goto notfound; - if (dp->d_ino == ino) - break; - } - } - else - for (;;) - { - if (!(dp = _readdir (dir))) - goto notfound; - if (ISDOT (dp)) - continue; - bcopy (dp->d_name, bup, strlen (dp->d_name) + 1); - - /* Save the first error for later. */ - if (stat (up, &s)) - { - if (!save_errno) - save_errno = errno; - errno = 0; - continue; - } - if (s.st_dev == dev && s.st_ino == ino) - break; - } - - /* - * Check for length of the current name, preceding slash, - * leading slash. - */ - - if (bpt - pt <= strlen (dp->d_name) + (first ? 1 : 2)) - { - size_t len, off; - - if (!ptsize) - { - errno = ERANGE; - goto err; - } - off = bpt - pt; - len = ept - bpt; - if (!(pt = (char *) realloc (pt, ptsize *= 2))) - { - goto err; - } - bpt = pt + off; - ept = pt + ptsize; - (void) bcopy (bpt, ept - len, len); - bpt = ept - len; - } - if (!first) - *--bpt = '/'; - bpt -= strlen (dp->d_name); - bcopy (dp->d_name, bpt, strlen (dp->d_name)); - (void) _closedir (dir); - dir = 0; - - /* Truncate any file name. */ - *bup = '\0'; - } - -notfound: - /* - * If readdir set errno, use it, not any saved error; otherwise, - * didn't find the current directory in its parent directory, set - * errno to ENOENT. - */ - - if (!errno) - errno = save_errno ? save_errno : ENOENT; - /* FALLTHROUGH */ - -err: - if(dir) - (void) _closedir (dir); - if (ptsize) - free (pt); - free (up); - return (char *) NULL; -} - -#endif /* _REENT_ONLY */ diff --git a/c/src/lib/libc/getdents.c b/c/src/lib/libc/getdents.c deleted file mode 100644 index fe774fc2f2..0000000000 --- a/c/src/lib/libc/getdents.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * getdents() - Get Directory Entries - * - * SVR4 and SVID extension required by Newlib readdir() family. - * - * This routine will dd_len / (sizeof dirent) directory entries relative to - * the current directory position index. These entries will be placed in - * character array pointed to by -dd_buf- - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include -#include - -int getdents( - int dd_fd, - char *dd_buf, - int dd_len -) -{ - rtems_libio_t *iop; - rtems_filesystem_location_info_t loc; - - /* - * Get the file control block structure associated with the file descriptor - */ - - iop = rtems_libio_iop( dd_fd ); - - /* - * Make sure we are working on a directory - */ - loc = iop->pathinfo; - if ( !loc.ops->node_type_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) - rtems_set_errno_and_return_minus_one( ENOTDIR ); - - /* - * Return the number of bytes that were actually transfered as a result - * of the read attempt. - */ - - if ( !iop->handlers->read_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - return (*iop->handlers->read_h)( iop, dd_buf, dd_len ); -} diff --git a/c/src/lib/libc/getgrent.c b/c/src/lib/libc/getgrent.c deleted file mode 100644 index 104b0a317f..0000000000 --- a/c/src/lib/libc/getgrent.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * POSIX 1003.1b - 9.2.1 - Group Database Access Routines - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - - -static struct group gr_group; /* password structure */ -static FILE *group_fp; - -/* - * The size of these buffers is arbitrary and there is no provision - * to protect any of them from overflowing. The scanf patterns - * need to be changed to prevent overflowing. In addition, - * the limits on these needs to be examined. - */ - -static char groupname[8]; -static char password[1024]; -static char groups[1024]; -static char *gr_mem[16] = { } ; - -extern void init_etc_passwd_group(void); - -int getgrnam_r( - const char *name, - struct group *grp, - char *buffer, - size_t bufsize, - struct group **result -) -{ - FILE *fp; - rtems_user_env_t * aux=rtems_current_user_env; /* save */ - - init_etc_passwd_group(); - rtems_current_user_env=&rtems_global_user_env; /* set root */ - - if ((fp = fopen ("/etc/group", "r")) == NULL) { - errno = EINVAL; - rtems_current_user_env=aux; /* restore */ - return -1; - } - - while (fgets (buffer, bufsize, fp)) { - sscanf (buffer, "%[^:]:%[^:]:%d:%s\n", - groupname, password, (int *) &grp->gr_gid, - groups); - grp->gr_name = groupname; - grp->gr_passwd = password; - grp->gr_mem = gr_mem ; - - if (!strcmp (groupname, name)) { - fclose (fp); - *result = grp; - rtems_current_user_env=aux; /* restore */ - return 0; - } - } - fclose (fp); - errno = EINVAL; - rtems_current_user_env=aux; /* restore */ - return -1; -} - -struct group *getgrnam( - const char *name -) -{ - char buf[1024]; - struct group *g; - - if ( getgrnam_r( name, &gr_group, buf, 1024, &g ) ) - return NULL; - - return g; -} - -int getgrgid_r( - gid_t gid, - struct group *grp, - char *buffer, - size_t bufsize, - struct group **result -) -{ - FILE *fp; - rtems_user_env_t * aux=rtems_current_user_env; /* save */ - - - init_etc_passwd_group(); - rtems_current_user_env=&rtems_global_user_env; /* set root */ - - if ((fp = fopen ("/etc/group", "r")) == NULL) { - errno = EINVAL; - rtems_current_user_env=aux; /* restore */ - return -1; - } - - while (fgets (buffer, bufsize, fp)) { - sscanf (buffer, "%[^:]:%[^:]:%d:%s\n", - groupname, password, (int *) &gr_group.gr_gid, - groups); - gr_group.gr_name = groupname; - gr_group.gr_passwd = password; - gr_group.gr_mem = gr_mem ; - - - if (gid == gr_group.gr_gid) { - fclose (fp); - *result = grp; - rtems_current_user_env=aux; /* restore */ - return 0; - } - } - fclose (fp); - errno = EINVAL; - rtems_current_user_env=aux; /* restore */ - return -1; -} - -struct group *getgrgid ( - gid_t gid -) -{ - char buf[1024]; - struct group *g; - - if ( getgrgid_r( gid, &gr_group, buf, 1024, &g ) ) - return NULL; - - return g; -} - -struct group *getgrent( void ) -{ - char buf[1024]; - - if (group_fp == NULL) - return NULL; - - if (fgets (buf, sizeof (buf), group_fp) == NULL) - return NULL; - - sscanf (buf, "%[^:]:%[^:]:%d:%s\n", - groupname, password, (int *) &gr_group.gr_gid, - groups); - gr_group.gr_name = groupname; - gr_group.gr_passwd = password; - gr_group.gr_mem = gr_mem ; - - return &gr_group; -} - -void -setgrent () -{ - rtems_user_env_t * aux=rtems_current_user_env; /* save */ - init_etc_passwd_group(); - rtems_current_user_env=&rtems_global_user_env; /* set root */ - - if (group_fp != NULL) - fclose (group_fp); - - group_fp = fopen ("/etc/group", "r"); - rtems_current_user_env=aux; /* restore */ -} - -void -endgrent () -{ - if (group_fp != NULL) - fclose (group_fp); -} diff --git a/c/src/lib/libc/getpwent.c b/c/src/lib/libc/getpwent.c deleted file mode 100644 index 91b6550f59..0000000000 --- a/c/src/lib/libc/getpwent.c +++ /dev/null @@ -1,248 +0,0 @@ -/* - * POSIX 1003.1b - 9.2.2 - User Database Access Routines - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -static struct passwd pw_passwd; /* password structure */ -static FILE *passwd_fp; - -/* - * The size of these buffers is arbitrary and there is no provision - * to protect any of them from overflowing. The scanf patterns - * need to be changed to prevent overflowing. In addition, - * the limits on these needs to be examined. - */ - -static char logname[8]; -static char password[1024]; -static char comment[1024]; -static char gecos[1024]; -static char dir[1024]; -static char shell[1024]; - -/* - * Initialize a useable but dummy /etc/passwd - * - * NOTE: Ignore all errors. - * - */ - -static char etc_passwd_initted = 0; - -void init_etc_passwd_group(void) -{ - FILE *fp; - - if ( etc_passwd_initted ) - return; - etc_passwd_initted = 1; - - (void) mkdir( "/etc", 0777); - - /* - * Initialize /etc/passwd - */ - - if ((fp = fopen ("/etc/passwd", "w")) == NULL) - return; - - fprintf( fp, "root:*:0:0:root,,,,:/:/bin/sh\n" - "rtems:*:1:1:RTEMS Application,,,,:/:/bin/sh\n" - "tty:!:2:2:tty owner,,,,:/:/bin/false\n" ); - - fclose( fp ); - - /* - * Initialize /etc/group - */ - - if ((fp = fopen ("/etc/group", "w")) == NULL) - return; - - fprintf( fp, "root:x:0:root\n" - "rtems:x:1:rtems\n" - "tty:x:2:tty\n" ); - - fclose( fp ); -} - -int getpwnam_r( - const char *name, - struct passwd *pwd, - char *buffer, - size_t bufsize, - struct passwd **result -) -{ - FILE *fp; - rtems_user_env_t * aux=rtems_current_user_env; /* save */ - - init_etc_passwd_group(); - rtems_current_user_env=&rtems_global_user_env; /* set root */ - - if ((fp = fopen ("/etc/passwd", "r")) == NULL) { - errno = EINVAL; - rtems_current_user_env=aux; /* restore */ - return -1; - } - - while (fgets (buffer, bufsize, fp)) { - sscanf (buffer, "%[^:]:%[^:]:%d:%d:%[^:]:%[^:]:%[^:]:%s\n", - logname, password, &pwd->pw_uid, - &pwd->pw_gid, comment, gecos, - dir, shell); - pwd->pw_name = logname; - pwd->pw_passwd = password; - pwd->pw_comment = comment; - pwd->pw_gecos = gecos; - pwd->pw_dir = dir; - pwd->pw_shell = shell; - - if (!strcmp (logname, name)) { - fclose (fp); - *result = pwd; - rtems_current_user_env=aux; /* restore */ - return 0; - } - } - fclose (fp); - errno = EINVAL; - rtems_current_user_env=aux; /* restore */ - return -1; -} - -struct passwd *getpwnam( - const char *name -) -{ - char buf[1024]; - struct passwd *p; - - if ( getpwnam_r( name, &pw_passwd, buf, 1024, &p ) ) - return NULL; - - return p; -} - -int getpwuid_r( - uid_t uid, - struct passwd *pwd, - char *buffer, - size_t bufsize, - struct passwd **result -) -{ - FILE *fp; - rtems_user_env_t * aux=rtems_current_user_env; /* save */ - - init_etc_passwd_group(); - rtems_current_user_env=&rtems_global_user_env; /* set root */ - - if ((fp = fopen ("/etc/passwd", "r")) == NULL) { - errno = EINVAL; - rtems_current_user_env=aux; /* restore */ - return -1; - } - - while (fgets (buffer, bufsize, fp)) { - sscanf (buffer, "%[^:]:%[^:]:%d:%d:%[^:]:%[^:]:%[^:]:%s\n", - logname, password, &pw_passwd.pw_uid, - &pw_passwd.pw_gid, comment, gecos, - dir, shell); - pwd->pw_name = logname; - pwd->pw_passwd = password; - pwd->pw_comment = comment; - pwd->pw_gecos = gecos; - pwd->pw_dir = dir; - pwd->pw_shell = shell; - - if (uid == pwd->pw_uid) { - fclose (fp); - *result = pwd; - rtems_current_user_env=aux; /* restore */ - return 0; - } - } - fclose (fp); - errno = EINVAL; - rtems_current_user_env=aux; /* restore */ - return -1; -} - -struct passwd *getpwuid( - uid_t uid -) -{ - char buf[1024]; - struct passwd *p; - - if ( getpwuid_r( uid, &pw_passwd, buf, 1024, &p ) ) - return NULL; - - return p; -} - -struct passwd *getpwent() -{ - char buf[1024]; - - if (passwd_fp == NULL) - return NULL; - - if (fgets (buf, sizeof (buf), passwd_fp) == NULL) - return NULL; - - sscanf (buf, "%[^:]:%[^:]:%d:%d:%[^:]:%[^:]:%[^:]:%s\n", - logname, password, &pw_passwd.pw_uid, - &pw_passwd.pw_gid, comment, gecos, - dir, shell); - pw_passwd.pw_name = logname; - pw_passwd.pw_passwd = password; - pw_passwd.pw_comment = comment; - pw_passwd.pw_gecos = gecos; - pw_passwd.pw_dir = dir; - pw_passwd.pw_shell = shell; - - return &pw_passwd; -} - -void setpwent( void ) -{ - rtems_user_env_t * aux=rtems_current_user_env; /* save */ - init_etc_passwd_group(); - rtems_current_user_env=&rtems_global_user_env; /* set root */ - - if (passwd_fp != NULL) - fclose (passwd_fp); - - passwd_fp = fopen ("/etc/passwd", "r"); - rtems_current_user_env=aux; /* restore */ -} - -void endpwent( void ) -{ - if (passwd_fp != NULL) - fclose (passwd_fp); -} diff --git a/c/src/lib/libc/gxx_wrappers.c b/c/src/lib/libc/gxx_wrappers.c deleted file mode 100644 index d660a6f226..0000000000 --- a/c/src/lib/libc/gxx_wrappers.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * RTEMS threads compatibily routines for libgcc2. - * - * by: Rosimildo da Silva ( rdasilva@connecttel.com - * - * Used ideas from: - * W. Eric Norum - * Canadian Light Source - * University of Saskatchewan - * Saskatoon, Saskatchewan, CANADA - * eric@cls.usask.ca - * - * Eric sent some e-mail in the rtems-list as a start point for this - * module implementation. - * - * - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -/* We might not need, defined just in case */ -#define __RTEMS_INSIDE__ 1 - - -#include -#include - -#include -#include -#include /* rtems_panic */ -#include - -/* - * These typedefs should match with the ones defined in the file - * gcc/gthr-rtems.h in the gcc distribution. - */ -typedef void *__gthread_key_t; -typedef int __gthread_once_t; -typedef void *__gthread_mutex_t; - - -/* uncomment this if you need to debug this interface */ - -/* -#define DEBUG_GXX_WRAPPERS 1 -*/ - -#ifdef DEBUG_GXX_WRAPPERS -/* local function to return the ID of the calling thread */ -static rtems_id get_tid( void ) -{ - rtems_id id = 0; - rtems_task_ident( RTEMS_SELF, 0, &id ); - return id; -} -#endif - - -int rtems_gxx_once(__gthread_once_t *once, void (*func) (void)) -{ -#ifdef DEBUG_GXX_WRAPPERS - printk( "gxx_wrappers: once=%x, func=%x\n", *once, func ); -#endif - if( *(volatile __gthread_once_t *)once == 0 ) - { - rtems_mode saveMode; - rtems_task_mode(RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &saveMode); - if( *(volatile __gthread_once_t *)once == 0 ) - { - *(volatile __gthread_once_t *)once = 1; - (*func)(); - } - rtems_task_mode(saveMode, RTEMS_PREEMPT_MASK, &saveMode); - } - return 0; -} - - -int rtems_gxx_key_create (__gthread_key_t *key, void (*dtor) (void *)) -{ - /* Ok, this can be a bit tricky. We are going to return a "key" as a - * pointer to the buffer that will hold the value of the key itself. - * We have to to this, becuase the others functions on this interface - * deal with the value of the key, as used with the POSIX API. - */ - /* Do not pull your hair, trust me this works. :-) */ - __gthread_key_t *new_key = ( __gthread_key_t * )malloc( sizeof( __gthread_key_t ) ); - *key = ( __gthread_key_t )new_key; - *new_key = NULL; - -#ifdef DEBUG_GXX_WRAPPERS - printk( "gxx_wrappers: create key=%x, dtor=%x, new_key=%x\n", key, dtor, new_key ); -#endif - /* register with RTEMS the buffer that will hold the key values */ - if( rtems_task_variable_add( RTEMS_SELF, (void **)new_key, NULL ) == RTEMS_SUCCESSFUL ) - return 0; - return -1; -} - -int rtems_gxx_key_dtor (__gthread_key_t key, void *ptr) -{ -#ifdef DEBUG_GXX_WRAPPERS - printk( "gxx_wrappers: dtor key=%x, ptr=%x\n", key, ptr ); -#endif - *(void **)key = 0; - return 0; -} - -int rtems_gxx_key_delete (__gthread_key_t key) -{ -#ifdef DEBUG_GXX_WRAPPERS - printk( "gxx_wrappers: delete key=%x\n", key ); -#endif - /* register with RTEMS the buffer that will hold the key values */ - if( rtems_task_variable_delete( RTEMS_SELF, (void **)key ) == RTEMS_SUCCESSFUL ) - { - if( key ) free( (void *)key ); - return 0; - } - return 0; -} - - -void *rtems_gxx_getspecific(__gthread_key_t key) -{ - void *p= 0; - - /* register with RTEMS the buffer that will hold the key values */ - if( rtems_task_variable_get( RTEMS_SELF, (void **)key, &p ) == RTEMS_SUCCESSFUL ) - { - /* We do not have to do this, but what the heck ! */ - p= *( void **)key; - } - else - { - /* fisrt time, always set to zero, it is unknown the value that the others - * threads are using at the moment of this call - */ - if( rtems_task_variable_add( RTEMS_SELF, (void **)key, NULL ) != RTEMS_SUCCESSFUL ) - { - rtems_panic ("rtems_gxx_getspecific"); - } - *( void ** )key = (void *)0; - } - -#ifdef DEBUG_GXX_WRAPPERS - printk( "gxx_wrappers: getspecific key=%x, ptr=%x, id=%x\n", key, p, get_tid() ); -#endif - return p; -} - - -int rtems_gxx_setspecific(__gthread_key_t key, const void *ptr) -{ -#ifdef DEBUG_GXX_WRAPPERS - printk( "gxx_wrappers: setspecific key=%x, ptr=%x, id=%x\n", key, ptr, get_tid() ); -#endif - /* register with RTEMS the buffer that will hold the key values */ - if( rtems_task_variable_add( RTEMS_SELF, (void **)key, NULL ) == RTEMS_SUCCESSFUL ) - { - /* now let's set the proper value */ - *( void ** )key = (void *)ptr; - return 0; - } - return -1; -} - - -/* - * MUTEX support - */ -void rtems_gxx_mutex_init (__gthread_mutex_t *mutex) -{ -#ifdef DEBUG_GXX_WRAPPERS - printk( "gxx_wrappers: mutex init =%X\n", *mutex ); -#endif - if( rtems_semaphore_create( rtems_build_name ('G', 'C', 'C', '2'), - 1, - RTEMS_PRIORITY|RTEMS_BINARY_SEMAPHORE - |RTEMS_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING|RTEMS_LOCAL, - 0, - (rtems_id *)mutex ) != RTEMS_SUCCESSFUL ) - { - rtems_panic ("rtems_gxx_mutex_init"); - } -#ifdef DEBUG_GXX_WRAPPERS - printk( "gxx_wrappers: mutex init complete =%X\n", *mutex ); -#endif -} - -int rtems_gxx_mutex_lock (__gthread_mutex_t *mutex) -{ -#ifdef DEBUG_GXX_WRAPPERS - printk( "gxx_wrappers: lock mutex=%X\n", *mutex ); -#endif - return ( rtems_semaphore_obtain( (rtems_id)*mutex, - RTEMS_WAIT, RTEMS_NO_TIMEOUT ) == RTEMS_SUCCESSFUL) ? 0 : -1; -} - -int rtems_gxx_mutex_trylock (__gthread_mutex_t *mutex) -{ -#ifdef DEBUG_GXX_WRAPPERS - printk( "gxx_wrappers: trylock mutex=%X\n", *mutex ); -#endif - return (rtems_semaphore_obtain ((rtems_id)*mutex, - RTEMS_NO_WAIT, 0) == RTEMS_SUCCESSFUL) ? 0 : -1; -} - -int rtems_gxx_mutex_unlock (__gthread_mutex_t *mutex) -{ -#ifdef DEBUG_GXX_WRAPPERS - printk( "gxx_wrappers: unlock mutex=%X\n", *mutex ); -#endif - return (rtems_semaphore_release( (rtems_id)*mutex ) == RTEMS_SUCCESSFUL) ? 0 :-1; -} - diff --git a/c/src/lib/libc/hosterr.c b/c/src/lib/libc/hosterr.c deleted file mode 100644 index 2a02fd2b03..0000000000 --- a/c/src/lib/libc/hosterr.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Routines to access a host errno - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if defined(RTEMS_UNIX) -#include - -int host_errno( void ); - -/* - * fix_syscall_errno - * - * copy host errno, if any to thread aware errno, if any - */ - -void fix_syscall_errno( void ) -{ - errno = host_errno(); -} - -/* - * host_errno - * - * Get the host system errno, if any - * When using newlib (or possibly other libc's) on top of UNIX - * the errno returned by system calls may be unavailable due - * to trickery of making errno thread aware. - * This provides a kludge of getting at it. - */ - -#undef errno -extern int errno; -int host_errno(void) -{ - return errno; -} -#endif diff --git a/c/src/lib/libc/ioctl.c b/c/src/lib/libc/ioctl.c deleted file mode 100644 index 5527747cff..0000000000 --- a/c/src/lib/libc/ioctl.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * ioctl() system call - * - * This routine is not defined in the POSIX 1003.1b standard but is - * commonly supported on most UNIX and POSIX systems. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include -#include - -#include - -int ioctl( - int fd, - int command, - ... -) -{ - va_list ap; - rtems_status_code rc; - rtems_libio_t *iop; - void *buffer; - - rtems_libio_check_fd( fd ); - iop = rtems_libio_iop( fd ); - rtems_libio_check_is_open(iop); - - va_start(ap, command); - - buffer = va_arg(ap, void *); - - /* - * Now process the ioctl(). - */ - - if ( !iop->handlers ) - rtems_set_errno_and_return_minus_one( EBADF ); - - if ( !iop->handlers->ioctl_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - rc = (*iop->handlers->ioctl_h)( iop, command, buffer ); - - return rc; -} diff --git a/c/src/lib/libc/isatty.c b/c/src/lib/libc/isatty.c deleted file mode 100644 index 57eeb8ca50..0000000000 --- a/c/src/lib/libc/isatty.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -int isatty( - int fd -) -{ - struct stat buf; - - if (fstat (fd, &buf) < 0) - return 0; - - if (S_ISCHR (buf.st_mode)) - return 1; - - return 0; -} diff --git a/c/src/lib/libc/libio.c b/c/src/lib/libc/libio.c deleted file mode 100644 index 713ba6dd33..0000000000 --- a/c/src/lib/libc/libio.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - * This file contains the support infrastructure used to manage the - * table of integer style file descriptors used by the low level - * POSIX system calls like open(), read, fstat(), etc. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include /* libio_.h pulls in rtems */ -#include -#include /* assoc.h not included by rtems.h */ - -#include /* O_RDONLY, et.al. */ -#include /* O_RDONLY, et.al. */ -#include -#include - -#if ! defined(O_NDELAY) -# if defined(solaris2) -# define O_NDELAY O_NONBLOCK -# elif defined(__CYGWIN__) -# define O_NDELAY _FNBIO -# elif defined(RTEMS_NEWLIB) -# define O_NDELAY _FNBIO -# endif -#endif - - -#include -#include /* strcmp */ -#include -#include /* calloc() */ - -#include /* libio.h not pulled in by rtems */ - -/* - * File descriptor Table Information - */ - -extern unsigned32 rtems_libio_number_iops; -rtems_id rtems_libio_semaphore; -rtems_libio_t *rtems_libio_iops; -rtems_libio_t *rtems_libio_iop_freelist; - -/* - * rtems_libio_init - * - * Called by BSP startup code to initialize the libio subsystem. - */ - -void rtems_libio_init( void ) -{ - rtems_status_code rc; - int i; - rtems_libio_t *iop; - - if (rtems_libio_number_iops > 0) - { - rtems_libio_iops = (rtems_libio_t *) calloc(rtems_libio_number_iops, - sizeof(rtems_libio_t)); - if (rtems_libio_iops == NULL) - rtems_fatal_error_occurred(RTEMS_NO_MEMORY); - - iop = rtems_libio_iop_freelist = rtems_libio_iops; - for (i = 0 ; i < (rtems_libio_number_iops - 1) ; i++, iop++) - iop->data1 = iop + 1; - iop->data1 = NULL; - } - - /* - * Create the binary semaphore used to provide mutual exclusion - * on the IOP Table. - */ - - rc = rtems_semaphore_create( - RTEMS_LIBIO_SEM, - 1, - RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY, - RTEMS_NO_PRIORITY, - &rtems_libio_semaphore - ); - if ( rc != RTEMS_SUCCESSFUL ) - rtems_fatal_error_occurred( rc ); - - /* - * Initialize the base file system infrastructure. - */ - - rtems_filesystem_initialize(); -} - -/* - * rtems_libio_fcntl_flags - * - * Convert UNIX fnctl(2) flags to ones that RTEMS drivers understand - */ - -rtems_assoc_t access_modes_assoc[] = { - { "READ", LIBIO_FLAGS_READ, O_RDONLY }, - { "WRITE", LIBIO_FLAGS_WRITE, O_WRONLY }, - { "READ/WRITE", LIBIO_FLAGS_READ_WRITE, O_RDWR }, - { 0, 0, 0 }, -}; - -rtems_assoc_t status_flags_assoc[] = { - { "NO DELAY", LIBIO_FLAGS_NO_DELAY, O_NDELAY }, - { "NONBLOCK", LIBIO_FLAGS_NO_DELAY, O_NONBLOCK }, - { "APPEND", LIBIO_FLAGS_APPEND, O_APPEND }, - { "CREATE", LIBIO_FLAGS_CREATE, O_CREAT }, - { 0, 0, 0 }, -}; - -unsigned32 rtems_libio_fcntl_flags( - unsigned32 fcntl_flags -) -{ - unsigned32 flags = 0; - unsigned32 access_modes; - - /* - * Access mode is a small integer - */ - - access_modes = fcntl_flags & O_ACCMODE; - fcntl_flags &= ~O_ACCMODE; - flags = rtems_assoc_local_by_remote( access_modes_assoc, access_modes ); - - /* - * Everything else is single bits - */ - - flags |= - rtems_assoc_local_by_remote_bitfield(status_flags_assoc, fcntl_flags); - return flags; -} - -/* - * rtems_libio_to_fcntl_flags - * - * Convert RTEMS internal flags to UNIX fnctl(2) flags - */ - -unsigned32 rtems_libio_to_fcntl_flags( - unsigned32 flags -) -{ - unsigned32 fcntl_flags = 0; - - if ( (flags & LIBIO_FLAGS_READ_WRITE) == LIBIO_FLAGS_READ_WRITE ) { - fcntl_flags |= O_RDWR; - } else if ( (flags & LIBIO_FLAGS_READ) == LIBIO_FLAGS_READ) { - fcntl_flags |= O_RDONLY; - } else if ( (flags & LIBIO_FLAGS_WRITE) == LIBIO_FLAGS_WRITE) { - fcntl_flags |= O_WRONLY; - } - - if ( (flags & LIBIO_FLAGS_NO_DELAY) == LIBIO_FLAGS_NO_DELAY ) { - fcntl_flags |= O_NDELAY; - } - - if ( (flags & LIBIO_FLAGS_APPEND) == LIBIO_FLAGS_APPEND ) { - fcntl_flags |= O_APPEND; - } - - if ( (flags & LIBIO_FLAGS_CREATE) == LIBIO_FLAGS_CREATE ) { - fcntl_flags |= O_CREAT; - } - - return fcntl_flags; -} - -/* - * rtems_libio_allocate - * - * This routine searches the IOP Table for an unused entry. If it - * finds one, it returns it. Otherwise, it returns NULL. - */ - -rtems_libio_t *rtems_libio_allocate( void ) -{ - rtems_libio_t *iop, *next; - rtems_status_code rc; - - rtems_semaphore_obtain( rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); - - if (rtems_libio_iop_freelist) { - iop = rtems_libio_iop_freelist; - next = iop->data1; - (void) memset( iop, 0, sizeof(rtems_libio_t) ); - iop->flags = LIBIO_FLAGS_OPEN; - rc = rtems_semaphore_create( - RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops), - 1, - RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY, - RTEMS_NO_PRIORITY, - &iop->sem - ); - if (rc != RTEMS_SUCCESSFUL) - goto failed; - rtems_libio_iop_freelist = next; - goto done; - } - -failed: - iop = 0; - -done: - rtems_semaphore_release( rtems_libio_semaphore ); - return iop; -} - -/* - * rtems_libio_free - * - * This routine frees the resources associated with an IOP (file descriptor) - * and clears the slot in the IOP Table. - */ - -void rtems_libio_free( - rtems_libio_t *iop -) -{ - rtems_semaphore_obtain( rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); - - if (iop->sem) - rtems_semaphore_delete(iop->sem); - - iop->flags &= ~LIBIO_FLAGS_OPEN; - iop->data1 = rtems_libio_iop_freelist; - rtems_libio_iop_freelist = iop; - - rtems_semaphore_release(rtems_libio_semaphore); -} - -/* - * rtems_libio_is_open_files_in_fs - * - * This routine scans the entire file descriptor table to determine if the - * are any active file descriptors that refer to the at least one node in the - * file system that we are trying to dismount. - * - * If there is at least one node in the file system referenced by the mount - * table entry a 1 is returned, otherwise a 0 is returned. - */ - -int rtems_libio_is_open_files_in_fs( - rtems_filesystem_mount_table_entry_t * fs_mt_entry -) -{ - rtems_libio_t *iop; - int result = 0; - int i; - - rtems_semaphore_obtain( rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); - - /* - * Look for any active file descriptor entry. - */ - - for (iop=rtems_libio_iops,i=0; i < rtems_libio_number_iops; iop++, i++){ - - if ((iop->flags & LIBIO_FLAGS_OPEN) != 0) { - - /* - * Check if this node is under the file system that we - * are trying to dismount. - */ - - if ( iop->pathinfo.mt_entry == fs_mt_entry ) { - result = 1; - break; - } - } - } - - rtems_semaphore_release( rtems_libio_semaphore ); - - return result; -} - -/* - * rtems_libio_is_file_open - * - * This routine scans the entire file descriptor table to determine if the - * given file refers to an active file descriptor. - * - * If the given file is open a 1 is returned, otherwise a 0 is returned. - */ - -int rtems_libio_is_file_open( - void *node_access -) -{ - rtems_libio_t *iop; - int result=0; - int i; - - rtems_semaphore_obtain( rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); - - /* - * Look for any active file descriptor entry. - */ - - for (iop=rtems_libio_iops,i=0; i < rtems_libio_number_iops; iop++, i++){ - if ((iop->flags & LIBIO_FLAGS_OPEN) != 0) { - - /* - * Check if this node is under the file system that we - * are trying to dismount. - */ - - if ( iop->pathinfo.node_access == node_access ) { - result = 1; - break; - } - } - } - - rtems_semaphore_release( rtems_libio_semaphore ); - - return result; -} - - diff --git a/c/src/lib/libc/libio_sockets.c b/c/src/lib/libc/libio_sockets.c deleted file mode 100644 index a1e98c8b0a..0000000000 --- a/c/src/lib/libc/libio_sockets.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file contains the support infrastructure used to manage the - * table of integer style file descriptors used by the socket calls. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include /* libio_.h pulls in rtems */ -#include - -#include - -/* - * Convert an RTEMS file descriptor to a BSD socket pointer. - */ - -struct socket *rtems_bsdnet_fdToSocket( - int fd -) -{ - rtems_libio_t *iop; - - /* same as rtems_libio_check_fd(_fd) but different return */ - if ((unsigned32)fd >= rtems_libio_number_iops) { - errno = EBADF; - return NULL; - } - iop = &rtems_libio_iops[fd]; - - /* same as rtems_libio_check_is_open(iop) but different return */ - if ((iop->flags & LIBIO_FLAGS_OPEN) == 0) { - errno = EBADF; - return NULL; - } - - if (iop->data1 == NULL) - errno = EBADF; - return iop->data1; -} - -/* - * Create an RTEMS file descriptor for a socket - */ - -int rtems_bsdnet_makeFdForSocket( - void *so, - const rtems_filesystem_file_handlers_r *h -) -{ - rtems_libio_t *iop; - int fd; - - iop = rtems_libio_allocate(); - if (iop == 0) { - errno = ENFILE; - return -1; - } - fd = iop - rtems_libio_iops; - iop->flags |= LIBIO_FLAGS_WRITE | LIBIO_FLAGS_READ; - iop->data0 = fd; - iop->data1 = so; - iop->handlers = (rtems_filesystem_file_handlers_r *) h; - return fd; -} diff --git a/c/src/lib/libc/link.c b/c/src/lib/libc/link.c deleted file mode 100644 index 6587f76fb5..0000000000 --- a/c/src/lib/libc/link.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * link() - POSIX 1003.1b - 5.3.4 - Create a new link - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -#include -#include - -int link( - const char *existing, - const char *new -) -{ - rtems_filesystem_location_info_t existing_loc; - rtems_filesystem_location_info_t parent_loc; - int i; - int result; - const char *name_start; - - /* - * Get the node we are linking to. - */ - - result = rtems_filesystem_evaluate_path( existing, 0, &existing_loc, TRUE ); - if ( result != 0 ) - return -1; - - /* - * Get the parent of the node we are creating. - */ - - rtems_filesystem_get_start_loc( new, &i, &parent_loc ); - - if ( !parent_loc.ops->evalformake_h ) { - rtems_filesystem_freenode( &existing_loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - result = (*parent_loc.ops->evalformake_h)( &new[i], &parent_loc, &name_start ); - if ( result != 0 ) { - rtems_filesystem_freenode( &existing_loc ); - rtems_set_errno_and_return_minus_one( result ); - } - - /* - * Check to see if the caller is trying to link across file system - * boundaries. - */ - - if ( parent_loc.mt_entry != existing_loc.mt_entry ) { - rtems_filesystem_freenode( &existing_loc ); - rtems_filesystem_freenode( &parent_loc ); - rtems_set_errno_and_return_minus_one( EXDEV ); - } - - if ( !parent_loc.ops->link_h ) { - rtems_filesystem_freenode( &existing_loc ); - rtems_filesystem_freenode( &parent_loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - result = (*parent_loc.ops->link_h)( &existing_loc, &parent_loc, name_start ); - - rtems_filesystem_freenode( &existing_loc ); - rtems_filesystem_freenode( &parent_loc ); - - return result; -} - -/* - * _link_r - * - * This is the Newlib dependent reentrant version of link(). - */ - -#if defined(RTEMS_NEWLIB) - -#include - -int _link_r( - struct _reent *ptr, - const char *existing, - const char *new -) -{ - return link( existing, new ); -} -#endif - diff --git a/c/src/lib/libc/lseek.c b/c/src/lib/libc/lseek.c deleted file mode 100644 index 0a87a4997d..0000000000 --- a/c/src/lib/libc/lseek.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * lseek() - POSIX 1003.1b 6.5.3 - Reposition Read/Write File Offset - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include -#include - -off_t lseek( - int fd, - off_t offset, - int whence -) -{ - rtems_libio_t *iop; - off_t old_offset; - off_t status; - - rtems_libio_check_fd( fd ); - iop = rtems_libio_iop( fd ); - rtems_libio_check_is_open(iop); - - /* - * Check as many errors as possible before touching iop->offset. - */ - - if ( !iop->handlers->lseek_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - /* - * Now process the lseek(). - */ - - old_offset = iop->offset; - switch ( whence ) { - case SEEK_SET: - iop->offset = offset; - break; - - case SEEK_CUR: - iop->offset += offset; - break; - - case SEEK_END: - iop->offset = iop->size + offset; - break; - - default: - rtems_set_errno_and_return_minus_one( EINVAL ); - } - - /* - * At this time, handlers assume iop->offset has the desired - * new offset. - */ - - status = (*iop->handlers->lseek_h)( iop, offset, whence ); - if ( status == (off_t) -1 ) - iop->offset = old_offset; - - /* - * So if the operation failed, we have to restore iop->offset. - */ - - return status; -} - -/* - * _lseek_r - * - * This is the Newlib dependent reentrant version of lseek(). - */ - -#if defined(RTEMS_NEWLIB) - -#include - -off_t _lseek_r( - struct _reent *ptr, - int fd, - off_t offset, - int whence -) -{ - return lseek( fd, offset, whence ); -} -#endif - diff --git a/c/src/lib/libc/lstat.c b/c/src/lib/libc/lstat.c deleted file mode 100644 index 8a3e38c049..0000000000 --- a/c/src/lib/libc/lstat.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * lstat() - BSD 4.3 and SVR4 - Get File Status - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#define _STAT_NAME lstat -#define _STAT_R_NAME _lstat_r -#define _STAT_FOLLOW_LINKS FALSE - -#include "stat.c" diff --git a/c/src/lib/libc/malloc.c b/c/src/lib/libc/malloc.c deleted file mode 100644 index 9f02311478..0000000000 --- a/c/src/lib/libc/malloc.c +++ /dev/null @@ -1,426 +0,0 @@ -/* - * RTEMS Malloc Family Implementation - * - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ -#include -#include -#ifdef RTEMS_NEWLIB -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include /* sbrk(2) */ - -rtems_id RTEMS_Malloc_Heap; -size_t RTEMS_Malloc_Sbrk_amount; - -#ifdef RTEMS_DEBUG -#define MALLOC_STATS -#define MALLOC_DIRTY -#endif - -#ifdef MALLOC_STATS -#define MSBUMP(f,n) rtems_malloc_stats.f += (n) - -struct { - unsigned32 space_available; /* current size of malloc area */ - unsigned32 malloc_calls; /* # calls to malloc */ - unsigned32 free_calls; - unsigned32 realloc_calls; - unsigned32 calloc_calls; - unsigned32 max_depth; /* most ever malloc'd at 1 time */ - unsigned64 lifetime_allocated; - unsigned64 lifetime_freed; -} rtems_malloc_stats; - -#else /* No rtems_malloc_stats */ -#define MSBUMP(f,n) -#endif - -void RTEMS_Malloc_Initialize( - void *start, - size_t length, - size_t sbrk_amount -) -{ - rtems_status_code status; - void *starting_address; - rtems_unsigned32 old_address; - rtems_unsigned32 u32_address; - - /* - * If the starting address is 0 then we are to attempt to - * get length worth of memory using sbrk. Make sure we - * align the address that we get back. - */ - - starting_address = start; - RTEMS_Malloc_Sbrk_amount = sbrk_amount; - - if (!starting_address) { - u32_address = (unsigned int)sbrk(length); - - if (u32_address == (rtems_unsigned32) -1) { - rtems_fatal_error_occurred( RTEMS_NO_MEMORY ); - /* DOES NOT RETURN!!! */ - } - - if (u32_address & (CPU_HEAP_ALIGNMENT-1)) { - old_address = u32_address; - u32_address = (u32_address + CPU_HEAP_ALIGNMENT) & ~(CPU_HEAP_ALIGNMENT-1); - - /* - * adjust the length by whatever we aligned by - */ - - length -= u32_address - old_address; - } - - starting_address = (void *)u32_address; - } - - /* - * If the BSP is not clearing out the workspace, then it is most likely - * not clearing out the initial memory for the heap. There is no - * standard supporting zeroing out the heap memory. But much code - * with UNIX history seems to assume that memory malloc'ed during - * initialization (before any free's) is zero'ed. This is true most - * of the time under UNIX because zero'ing memory when it is first - * given to a process eliminates the chance of a process seeing data - * left over from another process. This would be a security violation. - */ - - if ( rtems_cpu_configuration_get_do_zero_of_workspace() ) - memset( starting_address, 0, length ); - - /* - * Unfortunately we cannot use assert if this fails because if this - * has failed we do not have a heap and if we do not have a heap - * STDIO cannot work because there will be no buffers. - */ - - status = rtems_region_create( - rtems_build_name( 'H', 'E', 'A', 'P' ), - starting_address, - length, - CPU_HEAP_ALIGNMENT, - RTEMS_DEFAULT_ATTRIBUTES, - &RTEMS_Malloc_Heap - ); - if ( status != RTEMS_SUCCESSFUL ) - rtems_fatal_error_occurred( status ); - -#ifdef MALLOC_STATS - /* zero all the stats */ - (void) memset( &rtems_malloc_stats, 0, sizeof(rtems_malloc_stats) ); -#endif - - MSBUMP(space_available, length); -} - -#ifdef RTEMS_NEWLIB -void *malloc( - size_t size -) -{ - void *return_this; - void *starting_address; - rtems_unsigned32 the_size; - rtems_unsigned32 sbrk_amount; - rtems_status_code status; - - MSBUMP(malloc_calls, 1); - - if ( !size ) - return (void *) 0; - - /* - * Try to give a segment in the current region if there is not - * enough space then try to grow the region using rtems_region_extend(). - * If this fails then return a NULL pointer. - */ - - status = rtems_region_get_segment( - RTEMS_Malloc_Heap, - size, - RTEMS_NO_WAIT, - RTEMS_NO_TIMEOUT, - &return_this - ); - - if ( status != RTEMS_SUCCESSFUL ) { - /* - * Round to the "requested sbrk amount" so hopefully we won't have - * to grow again for a while. This effectively does sbrk() calls - * in "page" amounts. - */ - - sbrk_amount = RTEMS_Malloc_Sbrk_amount; - - if ( sbrk_amount == 0 ) - return (void *) 0; - - the_size = ((size + sbrk_amount) / sbrk_amount * sbrk_amount); - - if (((rtems_unsigned32)starting_address = (void *)sbrk(the_size)) - == (rtems_unsigned32) -1) - return (void *) 0; - - status = rtems_region_extend( - RTEMS_Malloc_Heap, - starting_address, - the_size - ); - if ( status != RTEMS_SUCCESSFUL ) { - sbrk(-the_size); - errno = ENOMEM; - return (void *) 0; - } - - MSBUMP(space_available, the_size); - - status = rtems_region_get_segment( - RTEMS_Malloc_Heap, - size, - RTEMS_NO_WAIT, - RTEMS_NO_TIMEOUT, - &return_this - ); - if ( status != RTEMS_SUCCESSFUL ) { - errno = ENOMEM; - return (void *) 0; - } - } - -#ifdef MALLOC_STATS - if (return_this) - { - unsigned32 actual_size; - unsigned32 current_depth; - status = rtems_region_get_segment_size( - RTEMS_Malloc_Heap, return_this, &actual_size); - MSBUMP(lifetime_allocated, actual_size); - current_depth = rtems_malloc_stats.lifetime_allocated - - rtems_malloc_stats.lifetime_freed; - if (current_depth > rtems_malloc_stats.max_depth) - rtems_malloc_stats.max_depth = current_depth; - } -#endif - -#ifdef MALLOC_DIRTY - (void) memset(return_this, 0xCF, size); -#endif - - return return_this; -} - -void *calloc( - size_t nelem, - size_t elsize -) -{ - register char *cptr; - int length; - - MSBUMP(calloc_calls, 1); - - length = nelem * elsize; - cptr = malloc( length ); - if ( cptr ) - memset( cptr, '\0', length ); - - MSBUMP(malloc_calls, -1); /* subtract off the malloc */ - - return cptr; -} - -void *realloc( - void *ptr, - size_t size -) -{ - rtems_unsigned32 old_size; - rtems_status_code status; - char *new_area; - - MSBUMP(realloc_calls, 1); - - if ( !ptr ) - return malloc( size ); - - if ( !size ) { - free( ptr ); - return (void *) 0; - } - - new_area = malloc( size ); - - MSBUMP(malloc_calls, -1); /* subtract off the malloc */ - - if ( !new_area ) { - free( ptr ); - return (void *) 0; - } - - status = rtems_region_get_segment_size( RTEMS_Malloc_Heap, ptr, &old_size ); - if ( status != RTEMS_SUCCESSFUL ) { - errno = EINVAL; - return (void *) 0; - } - - memcpy( new_area, ptr, (size < old_size) ? size : old_size ); - free( ptr ); - - return new_area; - -} - -void free( - void *ptr -) -{ - rtems_status_code status; - - MSBUMP(free_calls, 1); - - if ( !ptr ) - return; - -#ifdef MALLOC_STATS - { - unsigned32 size; - status = rtems_region_get_segment_size( RTEMS_Malloc_Heap, ptr, &size ); - if ( status == RTEMS_SUCCESSFUL ) { - MSBUMP(lifetime_freed, size); - } - } -#endif - - status = rtems_region_return_segment( RTEMS_Malloc_Heap, ptr ); - if ( status != RTEMS_SUCCESSFUL ) { - errno = EINVAL; - assert( 0 ); - } -} -/* end if RTEMS_NEWLIB */ -#endif - -#ifdef MALLOC_STATS -/* - * Dump the malloc statistics - * May be called via atexit() (installable by our bsp) or - * at any time by user - */ - -void malloc_dump(void) -{ - unsigned32 allocated = rtems_malloc_stats.lifetime_allocated - - rtems_malloc_stats.lifetime_freed; - - printf("Malloc stats\n"); - printf(" avail:%uk allocated:%uk (%d%%) " - "max:%uk (%d%%) lifetime:%Luk freed:%Luk\n", - (unsigned int) rtems_malloc_stats.space_available / 1024, - (unsigned int) allocated / 1024, - /* avoid float! */ - (allocated * 100) / rtems_malloc_stats.space_available, - (unsigned int) rtems_malloc_stats.max_depth / 1024, - (rtems_malloc_stats.max_depth * 100) / rtems_malloc_stats.space_available, - (unsigned64) rtems_malloc_stats.lifetime_allocated / 1024, - (unsigned64) rtems_malloc_stats.lifetime_freed / 1024); - printf(" Call counts: malloc:%d free:%d realloc:%d calloc:%d\n", - rtems_malloc_stats.malloc_calls, - rtems_malloc_stats.free_calls, - rtems_malloc_stats.realloc_calls, - rtems_malloc_stats.calloc_calls); -} - - -void malloc_walk(size_t source, size_t printf_enabled) -{ - register Region_Control *the_region; - Objects_Locations location; - - the_region = _Region_Get( RTEMS_Malloc_Heap, &location ); - if ( location == OBJECTS_LOCAL ) - { - _Heap_Walk( &the_region->Memory, source, printf_enabled ); - _Thread_Enable_dispatch(); - } -} - -#else - -void malloc_dump(void) -{ - return; -} - -void malloc_walk(size_t source, size_t printf_enabled) -{ - return; -} - -#endif - -/* - * "Reentrant" versions of the above routines implemented above. - */ - -#ifdef RTEMS_NEWLIB -void *_malloc_r( - struct _reent *ignored, - size_t size -) -{ - return malloc( size ); -} - -void *_calloc_r( - struct _reent *ignored, - size_t nelem, - size_t elsize -) -{ - return calloc( nelem, elsize ); -} - -void *_realloc_r( - struct _reent *ignored, - void *ptr, - size_t size -) -{ - return realloc( ptr, size ); -} - -void _free_r( - struct _reent *ignored, - void *ptr -) -{ - free( ptr ); -} - -#endif diff --git a/c/src/lib/libc/mallocfreespace.c b/c/src/lib/libc/mallocfreespace.c deleted file mode 100644 index 26f4f34944..0000000000 --- a/c/src/lib/libc/mallocfreespace.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * RTEMS Malloc Get Status Information - * - * - * COPYRIGHT (c) 1989-2000. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ -#include -#include - -#include -#include -#include -#include -#include -#include - -extern rtems_id RTEMS_Malloc_Heap; - -/* - * Find amount of free heap remaining - */ - -size_t malloc_free_space( void ) -{ - region_information_block heap_info; - - if ( rtems_region_get_information( RTEMS_Malloc_Heap, &heap_info ) ) { - return (size_t) heap_info.free_size; - } - return (size_t) -1; -} diff --git a/c/src/lib/libc/mkdir.c b/c/src/lib/libc/mkdir.c deleted file mode 100644 index c67a0a8cb4..0000000000 --- a/c/src/lib/libc/mkdir.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * mkdir() - POSIX 1003.1b 5.4.1 - Make a Directory - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include - -int mkdir( - const char *pathname, - mode_t mode -) -{ - return mknod( pathname, mode | S_IFDIR, 0LL); -} - diff --git a/c/src/lib/libc/mkfifo.c b/c/src/lib/libc/mkfifo.c deleted file mode 100644 index 2c1ae3889c..0000000000 --- a/c/src/lib/libc/mkfifo.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * mkfifo() - POSIX 1003.1b 5.4.1 - Make a FIFO Special File - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -int mkfifo( - const char *path, - mode_t mode -) -{ - return mknod( path, mode | S_IFIFO, 0LL ); -} diff --git a/c/src/lib/libc/mknod.c b/c/src/lib/libc/mknod.c deleted file mode 100644 index 6110b90e1d..0000000000 --- a/c/src/lib/libc/mknod.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * mknod() - * - * This routine is not defined in the POSIX 1003.1b standard but is - * commonly supported on most UNIX and POSIX systems. It is the - * foundation for creating file system objects. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include - -int mknod( - const char *pathname, - mode_t mode, - dev_t dev -) -{ - rtems_filesystem_location_info_t temp_loc; - int i; - const char *name_start; - int result; - - if ( !(mode & (S_IFREG|S_IFCHR|S_IFBLK|S_IFIFO) ) ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - if ( S_ISFIFO(mode) ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - rtems_filesystem_get_start_loc( pathname, &i, &temp_loc ); - - if ( !temp_loc.ops->evalformake_h ) { - rtems_filesystem_freenode( &temp_loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - result = (*temp_loc.ops->evalformake_h)( - &pathname[i], - &temp_loc, - &name_start - ); - if ( result != 0 ) - return -1; - - if ( !temp_loc.ops->mknod_h ) { - rtems_filesystem_freenode( &temp_loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - result = (*temp_loc.ops->mknod_h)( name_start, mode, dev, &temp_loc ); - - rtems_filesystem_freenode( &temp_loc ); - - return result; -} diff --git a/c/src/lib/libc/mount.c b/c/src/lib/libc/mount.c deleted file mode 100644 index 9ea08b7e2b..0000000000 --- a/c/src/lib/libc/mount.c +++ /dev/null @@ -1,274 +0,0 @@ -/* - * mount() - * - * XXX - * - * XXX make sure no required ops are NULL - * XXX make sure no optional ops you are using are NULL - * XXX unmount should be required. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -Chain_Control rtems_filesystem_mount_table_control; - -/* - * Prototypes that probably should be somewhere else. - */ - -int init_fs_mount_table( void ); -static int Is_node_fs_root( - rtems_filesystem_location_info_t *loc -); - - -/* - * XXX - */ - -#define FOUND 0 -#define NOT_FOUND -1 - -/* - * mount - * - * This routine will attempt to mount a new file system at the specified - * mount point. A series of tests will be run to determine if any of the - * following reasons exist to prevent the mount operation: - * - * 1) The file system type or options are not valid - * 2) No new file system root node is specified - * 3) The selected file system has already been mounted - * 4) The mount point exists with the proper permissions to allow mounting - * 5) The selected mount point already has a file system mounted to it - * - */ - -int mount( - rtems_filesystem_mount_table_entry_t **mt_entry, - rtems_filesystem_operations_table *fs_ops, - rtems_filesystem_options_t options, - char *device, - char *mount_point -) -{ - rtems_filesystem_location_info_t loc; - rtems_filesystem_mount_table_entry_t *temp_mt_entry; - rtems_filesystem_location_info_t *loc_to_free = NULL; - size_t size; - -/* XXX add code to check for required operations */ - - /* - * Is there a file system operations table? - */ - - if ( fs_ops == NULL ) { - errno = EINVAL; - return -1; - } - - /* - * Are the file system options valid? - */ - - if ( options != RTEMS_FILESYSTEM_READ_ONLY && - options != RTEMS_FILESYSTEM_READ_WRITE ) { - errno = EINVAL; - return -1; - } - - /* - * Allocate a mount table entry - */ - - size = sizeof(rtems_filesystem_mount_table_entry_t); - if ( device ) - size += strlen( device ) + 1; - temp_mt_entry = malloc( size ); - - if ( !temp_mt_entry ) { - errno = ENOMEM; - return -1; - } - - temp_mt_entry->mt_fs_root.mt_entry = temp_mt_entry; - temp_mt_entry->options = options; - if ( device ) { - temp_mt_entry->dev = - (char *)temp_mt_entry + sizeof( rtems_filesystem_mount_table_entry_t ); - strcpy( temp_mt_entry->dev, device ); - } else - temp_mt_entry->dev = 0; - - /* - * The mount_point should be a directory with read/write/execute - * permissions in the existing tree. - */ - - if ( mount_point ) { - - if ( rtems_filesystem_evaluate_path( - mount_point, RTEMS_LIBIO_PERMS_RWX, &loc, TRUE ) == -1 ) - goto cleanup_and_bail; - - /* - * Test to see if it is a directory - */ - - loc_to_free = &loc; - if ( loc.ops->node_type_h( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ) { - errno = ENOTDIR; - goto cleanup_and_bail; - } - - /* - * You can only mount one file system onto a single mount point. - */ - - if ( Is_node_fs_root( &loc ) ){ - errno = EBUSY; - goto cleanup_and_bail; - } - - /* - * This must be a good mount point, so move the location information - * into the allocated mount entry. Note: the information that - * may have been allocated in loc should not be sent to freenode - * until the system is unmounted. It may be needed to correctly - * traverse the tree. - */ - - temp_mt_entry->mt_point_node.node_access = loc.node_access; - temp_mt_entry->mt_point_node.handlers = loc.handlers; - temp_mt_entry->mt_point_node.ops = loc.ops; - temp_mt_entry->mt_point_node.mt_entry = loc.mt_entry; - - /* - * This link to the parent is only done when we are dealing with system - * below the base file system - */ - - if ( !loc.ops->mount_h ){ - errno = ENOTSUP; - goto cleanup_and_bail; - } - - if ( loc.ops->mount_h( temp_mt_entry ) ) { - goto cleanup_and_bail; - } - } else { - - /* - * This is a mount of the base file system --> The - * mt_point_node.node_access will be set to null to indicate that this - * is the root of the entire file system. - */ - - temp_mt_entry->mt_fs_root.node_access = NULL; - temp_mt_entry->mt_fs_root.handlers = NULL; - temp_mt_entry->mt_fs_root.ops = NULL; - - temp_mt_entry->mt_point_node.node_access = NULL; - temp_mt_entry->mt_point_node.handlers = NULL; - temp_mt_entry->mt_point_node.ops = NULL; - temp_mt_entry->mt_point_node.mt_entry = NULL; - } - - if ( !fs_ops->fsmount_me_h ) { - errno = ENOTSUP; - goto cleanup_and_bail; - } - - if ( fs_ops->fsmount_me_h( temp_mt_entry ) ) - goto cleanup_and_bail; - - /* - * Add the mount table entry to the mount table chain - */ - - Chain_Append( &rtems_filesystem_mount_table_control, &temp_mt_entry->Node ); - - *mt_entry = temp_mt_entry; - - return 0; - -cleanup_and_bail: - - free( temp_mt_entry ); - - if ( loc_to_free ) - rtems_filesystem_freenode( loc_to_free ); - - return -1; -} - - - -/* - * init_fs_mount_table - * - * This routine will initialize the chain control element that manages the - * mount table chain. - */ - -int init_fs_mount_table() -{ - Chain_Initialize_empty ( &rtems_filesystem_mount_table_control ); - return 0; -} - -/* - * Is_node_fs_root - * - * This routine will run through the entries that currently exist in the - * mount table chain. For each entry in the mount table chain it will - * compare the mount tables root node to the node describing the selected - * mount point. If any match is found true is returned else false is - * returned. - * - */ - -static int Is_node_fs_root( - rtems_filesystem_location_info_t *loc -) -{ - Chain_Node *the_node; - rtems_filesystem_mount_table_entry_t *the_mount_entry; - - /* - * For each mount table entry - */ - - for ( the_node = rtems_filesystem_mount_table_control.first; - !Chain_Is_tail( &rtems_filesystem_mount_table_control, the_node ); - the_node = the_node->next ) { - the_mount_entry = (rtems_filesystem_mount_table_entry_t *) the_node; - if ( the_mount_entry->mt_fs_root.node_access == loc->node_access ) - return TRUE; - } - return FALSE; -} diff --git a/c/src/lib/libc/newlibc.c b/c/src/lib/libc/newlibc.c deleted file mode 100644 index 8c3836a1e7..0000000000 --- a/c/src/lib/libc/newlibc.c +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Implementation of hooks for the CYGNUS newlib libc - * These hooks set things up so that: - * + '_REENT' is switched at task switch time. - * - * COPYRIGHT (c) 1994 by Division Incorporated - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - * - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ -#include - -#if defined(RTEMS_NEWLIB) -#include -#include /* for free() */ -#include /* for memset() */ - -#include /* for extern of _REENT (aka _impure_ptr) */ -#include - -/* - * NOTE: - * There is some problem with doing this on the hpux version - * of the UNIX simulator (symptom is printf core dumps), so - * we just don't for now. - * Not sure if this is a problem with hpux, newlib, or something else. - */ - -#if defined(RTEMS_UNIX) && !defined(hpux) -#define NEED_SETVBUF -#endif - -#ifdef NEED_SETVBUF -#include -#endif - -int libc_reentrant; /* do we think we are reentrant? */ -struct _reent libc_global_reent; - -/* - * CYGNUS newlib routine that does atexit() processing and flushes - * stdio streams - * undocumented - */ - -extern void _wrapup_reent(struct _reent *); -extern void _reclaim_reent(struct _reent *); - -#include - -void libc_wrapup(void) -{ - /* - * In case RTEMS is already down, don't do this. It could be - * dangerous. - */ - - if (!_System_state_Is_up(_System_state_Get())) - return; - - /* - * This was already done if the user called exit() directly . - _wrapup_reent(0); - */ - - if (_REENT != &libc_global_reent) { - _wrapup_reent(&libc_global_reent); -#if 0 - /* Don't reclaim this one, just in case we do printfs - * on the way out to ROM. - */ - _reclaim_reent(&libc_global_reent); -#endif - _REENT = &libc_global_reent; - } - - /* - * Try to drain output buffers. - * - * Should this be changed to do *all* file streams? - * _fwalk (_REENT, fclose); - */ - - fclose (stdin); - fclose (stdout); - fclose (stderr); -} - - -rtems_boolean libc_create_hook( - rtems_tcb *current_task, - rtems_tcb *creating_task -) -{ - creating_task->libc_reent = NULL; - return TRUE; -} - -/* - * Called for all user TASKS (system tasks are MPCI Receive Server and IDLE) - */ - -rtems_extension libc_start_hook( - rtems_tcb *current_task, - rtems_tcb *starting_task -) -{ - struct _reent *ptr; - - /* NOTE: The RTEMS malloc is reentrant without a reent ptr since - * it is based on the Classic API Region Manager. - */ - - ptr = (struct _reent *) calloc(1, sizeof(struct _reent)); - - if (!ptr) - rtems_fatal_error_occurred(RTEMS_NO_MEMORY); - -#ifdef __GNUC__ - /* GCC extension: structure constants */ - *ptr = (struct _reent) _REENT_INIT((*ptr)); -#else - /* - * WARNING: THIS IS VERY DEPENDENT ON NEWLIB!!! - * Last visual check was against newlib 1.8.2 but last known - * use was against 1.7.0. This is basically an exansion of - * REENT_INIT() in . - * NOTE: calloc() takes care of zeroing fields. - */ - ptr->_stdin = &ptr->__sf[0]; - ptr->_stdout = &ptr->__sf[1]; - ptr->_stderr = &ptr->__sf[2]; - ptr->_current_locale = "C"; - ptr->_new._reent._rand_next = 1; -#endif - - starting_task->libc_reent = ptr; -} - -/* - * Called for all user TASKS (system tasks are MPCI Receive Server and IDLE) - */ - -#ifdef NEED_SETVBUF -rtems_extension libc_begin_hook(rtems_tcb *current_task) -{ - setvbuf( stdout, NULL, _IOLBF, BUFSIZ ); -} -#endif - -/* - * Function: libc_delete_hook - * Created: 94/12/10 - * - * Description: - * Called when a task is deleted. - * Must restore the new lib reentrancy state for the new current - * task. - * - * Parameters: - * - * - * Returns: - * - * - * Side Effects: - * - * Notes: - * - * - * Deficiencies/ToDo: - * - * - */ - -rtems_extension libc_delete_hook( - rtems_tcb *current_task, - rtems_tcb *deleted_task -) -{ - struct _reent *ptr; - - /* - * The reentrancy structure was allocated by newlib using malloc() - */ - - if (current_task == deleted_task) { - ptr = _REENT; - } else { - ptr = (struct _reent *) deleted_task->libc_reent; - } - - /* if (ptr) */ - if (ptr && ptr != &libc_global_reent) { - _wrapup_reent(ptr); - _reclaim_reent(ptr); - free(ptr); - } - - deleted_task->libc_reent = NULL; - - /* - * Require the switch back to another task to install its own - */ - - if ( current_task == deleted_task ) { - _REENT = 0; - } -} - -/* - * Function: libc_init - * Created: 94/12/10 - * - * Description: - * Init libc for CYGNUS newlib - * Set up _REENT to use our global libc_global_reent. - * (newlib provides a global of its own, but we prefer our - * own name for it) - * - * If reentrancy is desired (which it should be), then - * we install the task extension hooks to maintain the - * newlib reentrancy global variable _REENT on task - * create, delete, switch, exit, etc. - * - * Parameters: - * reentrant non-zero if reentrant library desired. - * - * Returns: - * - * Side Effects: - * installs libc extensions if reentrant. - * - * Notes: - * - * - * Deficiencies/ToDo: - * - */ - -void -libc_init(int reentrant) -{ - rtems_extensions_table libc_extension; - rtems_status_code rc; - rtems_id extension_id; - - libc_global_reent = (struct _reent) _REENT_INIT((libc_global_reent)); - _REENT = &libc_global_reent; - - if (reentrant) { - memset(&libc_extension, 0, sizeof(libc_extension)); - - libc_extension.thread_create = libc_create_hook; - libc_extension.thread_start = libc_start_hook; -#ifdef NEED_SETVBUF - libc_extension.thread_begin = libc_begin_hook; -#endif - libc_extension.thread_delete = libc_delete_hook; - - _Thread_Set_libc_reent ((void**) &_REENT); - - rc = rtems_extension_create(rtems_build_name('L', 'I', 'B', 'C'), - &libc_extension, &extension_id); - if (rc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred( rc ); - - libc_reentrant = reentrant; - } -} - -/* - * Function: _exit - * Created: 94/12/10 - * - * Description: - * Called from exit() after it does atexit() processing and stdio fflush's - * - * called from bottom of exit() to really delete the task. - * If we are using reentrant libc, then let the delete extension - * do all the work, otherwise if a shutdown is in progress, - * then just do it. - * - * Parameters: - * exit status - * - * Returns: - * does not return - * - * Side Effects: - * - * Notes: - * - * - * Deficiencies/ToDo: - * - * - */ - -#include - -#if !defined(RTEMS_UNIX) -void _exit(int status) -{ - /* - * We need to do the exit processing on the global reentrancy structure. - * This has already been done on the per task reentrancy structure - * associated with this task. - */ - - libc_wrapup(); - rtems_shutdown_executive(status); -} - -#else - -void exit(int status) -{ - libc_wrapup(); - rtems_shutdown_executive(status); -} -#endif - -#endif diff --git a/c/src/lib/libc/no_libc.c b/c/src/lib/libc/no_libc.c deleted file mode 100644 index 016b577e63..0000000000 --- a/c/src/lib/libc/no_libc.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file contains stubs for the reentrancy hooks when - * an unknown C library is used. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if !defined(RTEMS_NEWLIB) && !defined(RTEMS_UNIX) - -#include - -#include /* for free() */ - -void libc_init( - int reentrant -) -{ -} - -void libc_suspend_main(void) -{ -} - - -void libc_global_exit( - rtems_unsigned32 code -) -{ -} - -void _exit( - int status -) -{ -} - -#else - -/* remove ANSI errors. - * A program must contain at least one external-declaration - * (X3.159-1989 p.82,L3). - */ -void no_libc_dummy_function( void ) -{ -} - -#endif diff --git a/c/src/lib/libc/no_posix.c b/c/src/lib/libc/no_posix.c deleted file mode 100644 index a845092173..0000000000 --- a/c/src/lib/libc/no_posix.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Marginal implementations of some POSIX API routines - * to be used when POSIX is disabled. - * - * + getpid - * + _getpid_r - * + kill - * + _kill_r - * + __kill - * + sleep - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include - -/* - * These are directly supported (and completely correct) in the posix api. - */ - -#if !defined(RTEMS_POSIX_API) -pid_t getpid(void) -{ - return 0; -} - -#if defined(RTEMS_NEWLIB) -#include - -pid_t _getpid_r( - struct _reent *ptr -) -{ - return getpid(); -} -#endif - -#endif - -#if !defined(RTEMS_POSIX_API) -int kill( pid_t pid, int sig ) -{ - return 0; -} - -int _kill_r( pid_t pid, int sig ) -{ - return 0; -} -#endif - -int __kill( pid_t pid, int sig ) -{ - return 0; -} - - -/* - * 3.4.3 Delay Process Execution, P1003.1b-1993, p. 81 - * - * $Id$ - */ - -#include -#include - -#include - -#if !defined(RTEMS_POSIX_API) -unsigned int sleep( - unsigned int seconds -) -{ - rtems_status_code status; - rtems_interval ticks_per_second; - rtems_interval ticks; - - status = rtems_clock_get( - RTEMS_CLOCK_GET_TICKS_PER_SECOND, - &ticks_per_second - ); - - ticks = seconds * ticks_per_second; - - status = rtems_task_wake_after( ticks ); - - /* - * Returns the "unslept" amount of time. In RTEMS signals are not - * interruptable, so tasks really sleep all of the requested time. - */ - - return 0; -} -#endif - diff --git a/c/src/lib/libc/open.c b/c/src/lib/libc/open.c deleted file mode 100644 index f36f74d4ac..0000000000 --- a/c/src/lib/libc/open.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * open() - POSIX 1003.1 5.3.1 - Open a File - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include - -#include - -/* - * Returns file descriptor on success or -1 and errno set to one of the - * following: - * - * EACCESS - Seach permission is denied on a component of the path prefix, - * or the file exists and the permissions specified by the - * flags are denied, or the file does not exist and write - * permission is denied for the parent directory of the file - * to be created, or O_TRUNC is specified and write permission - * is denied. - * EEXIST - O_CREAT and O_EXCL are set and the named file exists. - * EINTR - The open( operation was interrupted by a signal. - * EINVAL - This implementation does not support synchronized IO for this - * file. - * EISDIR - The named file is a directory and the flags argument - * specified write or read/write access. - * EMFILE - Too many file descriptors are in used by this process. - * ENAMETOOLONG - - * The length of the path exceeds PATH_MAX or a pathname - * component is longer than NAME_MAX while POSIX_NO_TRUNC - * is in effect. - * ENFILE - Too many files are open in the system. - * ENOENT - O_CREAT is not set and and the anmed file does not exist, - * or O_CREAT is set and eitehr the path prefix does not exist - * or the path argument points to an empty string. - * ENOSPC - The directory or file system that would contain the new file - * cannot be extended. - * ENOTDIR - A component of the path prefix is not a directory. - * ENXIO - O_NONBLOCK is set, the named file is a FIFO, O_WRONLY is - * set, and no process has the file open for reading. - * EROFS - The named file resides on a read-only file system and either - * O_WRONLY, O_RDWR, O_CREAT (if the file does not exist), or - * O_TRUNC is set in the flags argument. - */ - -int open( - const char *pathname, - int flags, - ... -) -{ - va_list ap; - int mode; - int rc; - rtems_libio_t *iop = 0; - int status; - rtems_filesystem_location_info_t loc; - rtems_filesystem_location_info_t *loc_to_free = NULL; - int eval_flags; - - - /* - * Set the Evaluation flags - */ - - eval_flags = 0; - status = flags + 1; - if ( ( status & _FREAD ) == _FREAD ) - eval_flags |= RTEMS_LIBIO_PERMS_READ; - if ( ( status & _FWRITE ) == _FWRITE ) - eval_flags |= RTEMS_LIBIO_PERMS_WRITE; - - - va_start(ap, flags); - - mode = va_arg( ap, int ); - - /* - * NOTE: This comment is OBSOLETE. The proper way to do this now - * would be to support a magic mounted file system. - * - * Additional external I/O handlers would be supported by adding - * code to pick apart the pathname appropriately. The networking - * code does not require changes here since network file - * descriptors are obtained using socket(), not open(). - */ - - /* allocate a file control block */ - iop = rtems_libio_allocate(); - if ( iop == 0 ) { - rc = ENFILE; - goto done; - } - - /* - * See if the file exists. - */ - - status = rtems_filesystem_evaluate_path( - pathname, eval_flags, &loc, TRUE ); - - if ( status == -1 ) { - if ( errno != ENOENT ) { - rc = errno; - goto done; - } - - /* If the file does not exist and we are not trying to create it--> error */ - if ( !(flags & O_CREAT) ) { - rc = ENOENT; - goto done; - } - - /* Create the node for the new regular file */ - rc = mknod( pathname, S_IFREG | mode, 0LL ); - if ( rc ) { - rc = errno; - goto done; - } - - /* Sanity check to see if the file name exists after the mknod() */ - status = rtems_filesystem_evaluate_path( pathname, 0x0, &loc, TRUE ); - if ( status != 0 ) { /* The file did not exist */ - rc = EACCES; - goto done; - } - - } else if ((flags & (O_EXCL|O_CREAT)) == (O_EXCL|O_CREAT)) { - /* We were trying to create a file that already exists */ - rc = EEXIST; - loc_to_free = &loc; - goto done; - } - - loc_to_free = &loc; - - /* - * Fill in the file control block based on the loc structure - * returned by successful path evaluation. - */ - - iop->handlers = loc.handlers; - iop->file_info = loc.node_access; - iop->flags |= rtems_libio_fcntl_flags( flags ); - iop->pathinfo = loc; - - if ( !iop->handlers->open_h ) { - rc = ENOTSUP; - goto done; - } - - rc = (*iop->handlers->open_h)( iop, pathname, flags, mode ); - if ( rc ) - goto done; - - /* - * Optionally truncate the file. - */ - - if ( (flags & O_TRUNC) == O_TRUNC ) { - rc = ftruncate( iop - rtems_libio_iops, 0 ); - } - - /* - * Single exit and clean up path. - */ - -done: - va_end(ap); - - if ( rc ) { - if ( iop ) - rtems_libio_free( iop ); - if ( loc_to_free ) - rtems_filesystem_freenode( loc_to_free ); - rtems_set_errno_and_return_minus_one( rc ); - } - - return iop - rtems_libio_iops; -} - -/* - * _open_r - * - * This is the Newlib dependent reentrant version of open(). - */ - -#if defined(RTEMS_NEWLIB) - -#include - -int _open_r( - struct _reent *ptr, - const char *buf, - int flags, - int mode -) -{ - return open( buf, flags, mode ); -} -#endif diff --git a/c/src/lib/libc/opendir.c b/c/src/lib/libc/opendir.c deleted file mode 100644 index eef211dcbc..0000000000 --- a/c/src/lib/libc/opendir.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * opendir() - POSIX 1003.1b - XXX - * - * This was copied from Newlib 1.8.0. - * - * - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)opendir.c 5.11 (Berkeley) 2/23/91"; -#endif /* LIBC_SCCS and not lint */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include - -/* - * open a directory. - */ -DIR * -opendir(name) - const char *name; -{ - register DIR *dirp; - register int fd; - - if ((fd = open(name, 0)) == -1) - return NULL; - if (fcntl(fd, F_SETFD, 1) == -1 || - (dirp = (DIR *)malloc(sizeof(DIR))) == NULL) { - close (fd); - return NULL; - } - /* - * If CLSIZE is an exact multiple of DIRBLKSIZ, use a CLSIZE - * buffer that it cluster boundary aligned. - * Hopefully this can be a big win someday by allowing page trades - * to user space to be done by getdirentries() - */ - dirp->dd_buf = malloc (512); - dirp->dd_len = 512; - - if (dirp->dd_buf == NULL) { - close (fd); - return NULL; - } - dirp->dd_fd = fd; - dirp->dd_loc = 0; - dirp->dd_seek = 0; - /* - * Set up seek point for rewinddir. - */ - return dirp; -} diff --git a/c/src/lib/libc/pathconf.c b/c/src/lib/libc/pathconf.c deleted file mode 100644 index 0d9d4894e8..0000000000 --- a/c/src/lib/libc/pathconf.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * pathconf() - POSIX 1003.1b - 5.7.1 - Configurable Pathname Varables - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include - -long pathconf( - const char *path, - int name -) -{ - int status; - int fd; - - fd = open( path, O_RDONLY ); - if ( fd == -1 ) - return -1; - - status = fpathconf( fd, name ); - - (void) close( fd ); - - return status; -} diff --git a/c/src/lib/libc/pipe.c b/c/src/lib/libc/pipe.c deleted file mode 100644 index f218433be0..0000000000 --- a/c/src/lib/libc/pipe.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * pipe() - POSIX 1003.1b 6.1.1 Create an Inter-Process Channel - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -int pipe( - int filsdes[2] -) -{ - errno = ENOSYS; - return -1; -} diff --git a/c/src/lib/libc/printk.c b/c/src/lib/libc/printk.c deleted file mode 100644 index 3542fd465a..0000000000 --- a/c/src/lib/libc/printk.c +++ /dev/null @@ -1,150 +0,0 @@ -/*-------------------------------------------------------------------------+ -| printk.c v1.1 - PC386 BSP - 1997/08/07 -+--------------------------------------------------------------------------+ -| (C) Copyright 1997 - -| - NavIST Group - Real-Time Distributed Systems and Industrial Automation -| -| http://pandora.ist.utl.pt -| -| Instituto Superior Tecnico * Lisboa * PORTUGAL -+--------------------------------------------------------------------------+ -| Disclaimer: -| -| This file is provided "AS IS" without warranty of any kind, either -| expressed or implied. -+--------------------------------------------------------------------------+ -| This code is based on code by: Jose Rufino - IST -| -| $Id$ -+--------------------------------------------------------------------------*/ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -/*-------------------------------------------------------------------------+ -| Function: printNum -| Description: print number in a given base. -| Global Variables: None. -| Arguments: num - number to print, base - base used to print the number. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -static void -printNum(long unsigned int num, int base, int sign, int maxwidth, int lead) -{ - long unsigned int n; - int count; - char toPrint[20]; - - if ( (sign == 1) && ((long)num < 0) ) { - BSP_output_char('-'); - num = -num; - if (maxwidth) maxwidth--; - } - - count = 0; - while ((n = num / base) > 0) { - toPrint[count++] = (num - (n*base)); - num = n ; - } - toPrint[count++] = num; - - if (maxwidth) { - for (n=maxwidth-count ; n ; n-- ) - BSP_output_char(lead); - } - - for (n = 0; n < count; n++){ - BSP_output_char("0123456789ABCDEF"[(int)(toPrint[count-(n+1)])]); - } -} /* printNum */ - - -/*-------------------------------------------------------------------------+ -| Function: printk -| Description: a simplified version of printf intended for use when the - console is not yet initialized or in ISR's. -| Global Variables: None. -| Arguments: as in printf: fmt - format string, ... - unnamed arguments. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -void -printk(char *fmt, ...) -{ - va_list ap; /* points to each unnamed argument in turn */ - char c, *str; - int lflag, base, sign, width, lead; - /* unsigned int level; */ - - /* _CPU_ISR_Disable(level); */ - - va_start(ap, fmt); /* make ap point to 1st unnamed arg */ - for (; *fmt != '\0'; fmt++) - { - lflag = 0; - base = 0; - sign = 0; - width = 0; - lead = ' '; - if (*fmt == '%') - { - fmt++; - if (*fmt == '0' ) { - lead = '0'; - fmt++; - } - while (*fmt >= '0' && *fmt <= '9' ) { - width *= 10; - width += (*fmt - '0'); - fmt++; - } - - if ((c = *fmt) == 'l') - { - lflag = 1; - c = *++fmt; - } - switch (c) - { - case 'o': case 'O': base = 8; sign = 0; break; - case 'd': case 'D': base = 10; sign = 1; break; - case 'u': case 'U': base = 10; sign = 0; break; - case 'x': case 'X': base = 16; sign = 0; break; - case 's': - for (str = va_arg(ap, char *); *str; str++) - BSP_output_char(*str); - break; - case 'c': -#if 0 -#if defined(_TMS320C3x) || defined(_TMS320C4x) - BSP_output_char(va_arg(ap, int)); -#else - BSP_output_char(va_arg(ap, char)); -#endif -#else - BSP_output_char(va_arg(ap, int)); -#endif - break; - default: - BSP_output_char(c); - break; - } /* switch*/ - - if (base) - printNum(lflag ? va_arg(ap, long int) : (long int)va_arg(ap, int), - base, sign, width, lead); - } - else - { - BSP_output_char(*fmt); - } - } - va_end(ap); /* clean up when done */ - /* _CPU_ISR_Enable(level); */ - -} /* printk */ - diff --git a/c/src/lib/libc/privateenv.c b/c/src/lib/libc/privateenv.c deleted file mode 100644 index 93dff453c5..0000000000 --- a/c/src/lib/libc/privateenv.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Instantatiate a private user environment for the calling thread. - * - * Submitted by: fernando.ruiz@ctv.es (correo@fernando-ruiz.com) - * - * COPYRIGHT (c) 1989-2000. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include /* free */ - -#include -#include -#include - -rtems_status_code rtems_libio_set_private_env(void) { - rtems_status_code sc; - rtems_id task_id; - - sc=rtems_task_ident(RTEMS_SELF,0,&task_id); - if (sc != RTEMS_SUCCESSFUL) return sc; - - /* Only for the first time a malloc is necesary */ - if (rtems_current_user_env==&rtems_global_user_env) { - sc = rtems_task_variable_add(RTEMS_SELF,(void*)&rtems_current_user_env,free); - if (sc != RTEMS_SUCCESSFUL) return sc; - rtems_current_user_env = malloc(sizeof(rtems_user_env_t)); - if (!rtems_current_user_env) - return RTEMS_NO_MEMORY; - }; - - /* the side effect desired . chroot("/") */ - *rtems_current_user_env = rtems_global_user_env; /* get the global values*/ - rtems_current_user_env->task_id=task_id; /* mark the local values*/ - - return RTEMS_SUCCESSFUL; -} - -/* - * Share a same private environment beetween two task: - * Task_id (remote) and RTEMS_SELF(current). - */ - -rtems_status_code rtems_libio_share_private_env(rtems_id task_id) { - rtems_status_code sc; - rtems_user_env_t * shared_user_env; - rtems_id current_task_id; - - sc=rtems_task_ident(RTEMS_SELF,0,¤t_task_id); - if (sc != RTEMS_SUCCESSFUL) return sc; - - if (rtems_current_user_env->task_id==current_task_id) { - /* kill the current user env & task_var*/ - free(rtems_current_user_env); - sc = rtems_task_variable_delete(RTEMS_SELF,(void*)&rtems_current_user_env); - if (sc != RTEMS_SUCCESSFUL) return sc; - }; - - sc = rtems_task_variable_get(task_id,(void*)&rtems_current_user_env, - (void*)&shared_user_env ); - if (sc != RTEMS_SUCCESSFUL) return sc; - - /* don't free(NULL'ed) at the task_delete. It is a shared var... */ - sc = rtems_task_variable_add(RTEMS_SELF,(void*)&rtems_current_user_env,NULL); - if (sc != RTEMS_SUCCESSFUL) return sc; - - /* the current_user_env is the same pointer that remote env */ - rtems_current_user_env = shared_user_env; - - return RTEMS_SUCCESSFUL; -} diff --git a/c/src/lib/libc/read.c b/c/src/lib/libc/read.c deleted file mode 100644 index 421f967caf..0000000000 --- a/c/src/lib/libc/read.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * read() - POSIX 1003.1b 6.4.1 - Read From a File - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -ssize_t read( - int fd, - void *buffer, - size_t count -) -{ - int rc; /* XXX change to a size_t when prototype is fixed */ - rtems_libio_t *iop; - - rtems_libio_check_fd( fd ); - iop = rtems_libio_iop( fd ); - rtems_libio_check_is_open(iop); - rtems_libio_check_buffer( buffer ); - rtems_libio_check_count( count ); - rtems_libio_check_permissions( iop, LIBIO_FLAGS_READ ); - - /* - * Now process the read(). - */ - - if ( !iop->handlers->read_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - rc = (*iop->handlers->read_h)( iop, buffer, count ); - - if ( rc > 0 ) - iop->offset += rc; - - return rc; -} - -/* - * _read_r - * - * This is the Newlib dependent reentrant version of read(). - */ - -#if defined(RTEMS_NEWLIB) - -#include - -_ssize_t _read_r( - struct _reent *ptr, - int fd, - void *buf, - size_t nbytes -) -{ - return read( fd, buf, nbytes ); -} -#endif diff --git a/c/src/lib/libc/readdir.c b/c/src/lib/libc/readdir.c deleted file mode 100644 index 8b54a9401b..0000000000 --- a/c/src/lib/libc/readdir.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * readdir() - POSIX 1003.1b - XXX - * - * This was copied from Newlib 1.8.0. - * - * - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)readdir.c 5.7 (Berkeley) 6/1/90"; -#endif /* LIBC_SCCS and not lint */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -int getdents( - int dd_fd, - char *dd_buf, - int dd_len -); - -/* - * get next entry in a directory. - */ -struct dirent * -readdir(dirp) -register DIR *dirp; { - register struct dirent *dp; - - if ( !dirp ) - return NULL; - - for (;;) { - if (dirp->dd_loc == 0) { - dirp->dd_size = getdents (dirp->dd_fd, - dirp->dd_buf, - dirp->dd_len); - - if (dirp->dd_size <= 0) - return NULL; - } - if (dirp->dd_loc >= dirp->dd_size) { - dirp->dd_loc = 0; - continue; - } - dp = (struct dirent *)(dirp->dd_buf + dirp->dd_loc); - if ((int)dp & 03) /* bogus pointer check */ - return NULL; - if (dp->d_reclen <= 0 || - dp->d_reclen > dirp->dd_len + 1 - dirp->dd_loc) - return NULL; - dirp->dd_loc += dp->d_reclen; - if (dp->d_ino == 0) - continue; - return (dp); - } -} diff --git a/c/src/lib/libc/readlink.c b/c/src/lib/libc/readlink.c deleted file mode 100644 index 2e2d897709..0000000000 --- a/c/src/lib/libc/readlink.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * readlink() - POSIX 1003.1b - X.X.X - XXX - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -int readlink( - const char *pathname, - char *buf, - int bufsize -) -{ - rtems_filesystem_location_info_t loc; - int result; - - if (!buf) - rtems_set_errno_and_return_minus_one( EFAULT ); - - result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE ); - if ( result != 0 ) - return -1; - - if ( !loc.ops->node_type_h ){ - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_SYM_LINK ){ - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( EINVAL ); - } - - if ( !loc.ops->readlink_h ){ - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - result = (*loc.ops->readlink_h)( &loc, buf, bufsize ); - - rtems_filesystem_freenode( &loc ); - - return result; -} diff --git a/c/src/lib/libc/rewinddir.c b/c/src/lib/libc/rewinddir.c deleted file mode 100644 index 462fc41f2a..0000000000 --- a/c/src/lib/libc/rewinddir.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * rewinddir() - POSIX 1003.1b - XXX - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include - -void rewinddir( - DIR *dirp -) -{ - off_t status; - - if ( !dirp ) - return; - - status = lseek( dirp->dd_fd, 0, SEEK_SET ); - - if( status == -1 ) - return; - - dirp->dd_loc = 0; -} diff --git a/c/src/lib/libc/rmdir.c b/c/src/lib/libc/rmdir.c deleted file mode 100644 index b306894d06..0000000000 --- a/c/src/lib/libc/rmdir.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * rmdir() - POSIX 1003.1b - 5.2.2 - Remove a Directory - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include - -#include -#include - -int rmdir( - const char *pathname -) -{ - rtems_filesystem_location_info_t loc; - int result; - - /* - * Get the node where we wish to go. - */ - - result = rtems_filesystem_evaluate_path( pathname, 0, &loc, FALSE ); - if ( result != 0 ) - return -1; - - /* - * Verify you can remove this node as a directory. - */ - - if ( !loc.ops->node_type_h ){ - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - if ( (*loc.ops->node_type_h)( &loc ) != RTEMS_FILESYSTEM_DIRECTORY ){ - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( ENOTDIR ); - } - - /* - * Use the filesystems rmnod to remove the node. - */ - - if ( !loc.handlers->rmnod_h ){ - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - result = (*loc.handlers->rmnod_h)( &loc ); - - rtems_filesystem_freenode( &loc ); - - return result; -} diff --git a/c/src/lib/libc/scandir.c b/c/src/lib/libc/scandir.c deleted file mode 100644 index e8ef3212d5..0000000000 --- a/c/src/lib/libc/scandir.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * scandir() - POSIX 1003.1b - XXX - * - * This was copied from Newlib 1.8.0. - * - * - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)scandir.c 5.10 (Berkeley) 2/23/91"; -#endif /* LIBC_SCCS and not lint */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -/* - * Scan the directory dirname calling select to make a list of selected - * directory entries then sort using qsort and compare routine dcomp. - * Returns the number of entries and a pointer to a list of pointers to - * struct dirent (through namelist). Returns -1 if there were any errors. - */ - -#include -#include -#include -#include -#include - -/* - * The DIRSIZ macro gives the minimum record length which will hold - * the directory entry. This requires the amount of space in struct dirent - * without the d_name field, plus enough space for the name with a terminating - * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary. - */ -#undef DIRSIZ -/* -#define DIRSIZ(dp) \ - ((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) -*/ - -#define DIRSIZ(dp) \ - ((sizeof (struct dirent) - (NAME_MAX+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) - -#ifndef __P -#define __P(args) () -#endif - -int -scandir(dirname, namelist, select, dcomp) - const char *dirname; - struct dirent ***namelist; - int (*select) __P((struct dirent *)); - int (*dcomp) __P((const void *, const void *)); -{ - register struct dirent *d = NULL; - register struct dirent *p = NULL; - register struct dirent **names = NULL; - register size_t nitems = 0; - struct stat stb; - long arraysz; - DIR *dirp = NULL; - int i; - - if ((dirp = opendir(dirname)) == NULL) - return(-1); - if (fstat(dirp->dd_fd, &stb) < 0) - goto cleanup_and_bail; - - /* - * estimate the array size by taking the size of the directory file - * and dividing it by a multiple of the minimum size entry. - */ - arraysz = (stb.st_size / 24); - names = (struct dirent **)malloc(arraysz * sizeof(struct dirent *)); - if (names == NULL) - goto cleanup_and_bail; - - while ((d = readdir(dirp)) != NULL) { - if (select != NULL && !(*select)(d)) - continue; /* just selected names */ - /* - * Make a minimum size copy of the data - */ - p = (struct dirent *)malloc(DIRSIZ(d)); - if (p == NULL) - goto cleanup_and_bail; - p->d_ino = d->d_ino; - p->d_reclen = d->d_reclen; - p->d_namlen = d->d_namlen; - strncpy(p->d_name, d->d_name, p->d_namlen + 1); - /* - * Check to make sure the array has space left and - * realloc the maximum size. - */ - if (++nitems >= arraysz) { - if (fstat(dirp->dd_fd, &stb) < 0) - goto cleanup_and_bail; /* just might have grown */ - arraysz = stb.st_size / 12; - names = (struct dirent **)realloc((char *)names, - arraysz * sizeof(struct dirent *)); - if (names == NULL) - goto cleanup_and_bail; - } - names[nitems-1] = p; - } - closedir(dirp); - if (nitems && dcomp != NULL){ - qsort(names, nitems, sizeof(struct dirent *), dcomp); - } - *namelist = names; - return(nitems); - -cleanup_and_bail: - - if ( dirp ) - closedir( dirp ); - - if ( names ) { - for (i=0; i < nitems; i++ ) - free( names[i] ); - free( names ); - } - - return(-1); -} - -/* - * Alphabetic order comparison routine for those who want it. - */ -int -alphasort(d1, d2) - const void *d1; - const void *d2; -{ - return(strcmp((*(struct dirent **)d1)->d_name, - (*(struct dirent **)d2)->d_name)); -} diff --git a/c/src/lib/libc/seekdir.c b/c/src/lib/libc/seekdir.c deleted file mode 100644 index a6836c36c6..0000000000 --- a/c/src/lib/libc/seekdir.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * seekdir() - POSIX 1003.1b - XXX - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include - -void seekdir( - DIR *dirp, - long loc -) -{ - off_t status; - - if ( !dirp ) - return; - - status = lseek( dirp->dd_fd, loc, SEEK_SET ); - - /* - * This is not a nice way to error out, but we have no choice here. - */ - - if ( status == -1 ) - return; - - dirp->dd_loc = 0; -} diff --git a/c/src/lib/libc/stat.c b/c/src/lib/libc/stat.c deleted file mode 100644 index e4e4f0be3b..0000000000 --- a/c/src/lib/libc/stat.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * stat() - POSIX 1003.1b 5.6.2 - Get File Status - * - * Reused from lstat(). - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -/* - * lstat() and stat() share the same implementation with a minor - * difference on how links are evaluated. - */ - -#ifndef _STAT_NAME -#define _STAT_NAME stat -#define _STAT_R_NAME _stat_r -#define _STAT_FOLLOW_LINKS TRUE -#endif - - -#include - -#if !defined(RTEMS_UNIX) - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -int _STAT_NAME( - const char *path, - struct stat *buf -) -{ - int status; - rtems_filesystem_location_info_t loc; - - /* - * Check to see if we were passed a valid pointer. - */ - - if ( !buf ) - rtems_set_errno_and_return_minus_one( EFAULT ); - - status = rtems_filesystem_evaluate_path( path, 0, &loc, _STAT_FOLLOW_LINKS ); - if ( status != 0 ) - return -1; - - if ( !loc.handlers->fstat_h ){ - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - /* - * Zero out the stat structure so the various support - * versions of stat don't have to. - */ - - memset( buf, 0, sizeof(struct stat) ); - - status = (*loc.handlers->fstat_h)( &loc, buf ); - - rtems_filesystem_freenode( &loc ); - - return status; -} -#endif - -/* - * _stat_r, _lstat_r - * - * This is the Newlib dependent reentrant version of stat() and lstat(). - */ - -#if defined(RTEMS_NEWLIB) - -#include - -int _STAT_R_NAME( - struct _reent *ptr, - const char *path, - struct stat *buf -) -{ - return _STAT_NAME( path, buf ); -} -#endif diff --git a/c/src/lib/libc/symlink.c b/c/src/lib/libc/symlink.c deleted file mode 100644 index 8d5bb30bd5..0000000000 --- a/c/src/lib/libc/symlink.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * symlink() - POSIX 1003.1b - X.X.X - XXX - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -int symlink( - const char *actualpath, - const char *sympath -) -{ - rtems_filesystem_location_info_t loc; - int i; - const char *name_start; - int result; - - rtems_filesystem_get_start_loc( sympath, &i, &loc ); - result = (*loc.ops->evalformake_h)( &sympath[i], &loc, &name_start ); - if ( result != 0 ) - return -1; - - if ( !loc.ops->symlink_h ) { - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - result = (*loc.ops->symlink_h)( &loc, actualpath, name_start); - - rtems_filesystem_freenode( &loc ); - - return result; -} - diff --git a/c/src/lib/libc/tcdrain.c b/c/src/lib/libc/tcdrain.c deleted file mode 100644 index 3af93d8c18..0000000000 --- a/c/src/lib/libc/tcdrain.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * tcdrain() - POSIX 1003.1b 7.2.2 - Line Control Functions - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if defined(RTEMS_NEWLIB) - -#include -#include -#include -#include -/* #include */ - -#include - -int tcdrain( - int fd -) -{ - return ioctl( fd, RTEMS_IO_TCDRAIN, 0 ); -} - -#endif diff --git a/c/src/lib/libc/tcflow.c b/c/src/lib/libc/tcflow.c deleted file mode 100644 index ac1fec10c5..0000000000 --- a/c/src/lib/libc/tcflow.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * tcflow() - POSIX 1003.1b 7.2.2 - Line Control Functions - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if defined(RTEMS_NEWLIB) - -#include -#include -#include -#include -/* #include */ - -#include - -int tcflow (int fd, int action) -{ - return 0; -} - -#endif diff --git a/c/src/lib/libc/tcflush.c b/c/src/lib/libc/tcflush.c deleted file mode 100644 index 0bfac64235..0000000000 --- a/c/src/lib/libc/tcflush.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * tcflush() - POSIX 1003.1b 7.2.2 - Line Control Functions - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if defined(RTEMS_NEWLIB) - -#include -#include -#include -#include -/* #include */ - -#include - -int tcflush (int fd, int queue) -{ - return 0; -} - -#endif diff --git a/c/src/lib/libc/tcgetattr.c b/c/src/lib/libc/tcgetattr.c deleted file mode 100644 index cd5b0a5a79..0000000000 --- a/c/src/lib/libc/tcgetattr.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * tcgetattr() - POSIX 1003.1b 7.2.1 - Get and Set State - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if defined(RTEMS_NEWLIB) - -#include -#include -#include -#include -/* #include */ - -#include - -int tcgetattr( - int fd, - struct termios *tp -) -{ - return ioctl( fd, RTEMS_IO_GET_ATTRIBUTES, tp ); -} -#endif diff --git a/c/src/lib/libc/tcgetprgrp.c b/c/src/lib/libc/tcgetprgrp.c deleted file mode 100644 index 36413f3fe2..0000000000 --- a/c/src/lib/libc/tcgetprgrp.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * tcgetprgrp() - POSIX 1003.1b 7.2.3 - Get Foreground Process Group ID - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if defined(RTEMS_NEWLIB) - -#include -#include -#include -#include -/* #include */ - -#include - -pid_t tcgetprgrp(int fd) -{ - return getpid(); -} - -#endif diff --git a/c/src/lib/libc/tcsendbreak.c b/c/src/lib/libc/tcsendbreak.c deleted file mode 100644 index d7b3e68764..0000000000 --- a/c/src/lib/libc/tcsendbreak.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * tcsendbreak() - POSIX 1003.1b 7.2.2 - Line Control Functions - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if defined(RTEMS_NEWLIB) - -#include -#include -#include -#include -/* #include */ - -#include - -int tcsendbreak ( int fd, int duration ) -{ - return 0; -} - -#endif diff --git a/c/src/lib/libc/tcsetattr.c b/c/src/lib/libc/tcsetattr.c deleted file mode 100644 index f7a413c956..0000000000 --- a/c/src/lib/libc/tcsetattr.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * tcsetattr() - POSIX 1003.1b 7.2.1 - Get and Set State - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if defined(RTEMS_NEWLIB) - -#include -#include -#include -#include -/* #include */ - -#include -#include -#include - -int tcsetattr( - int fd, - int opt, - struct termios *tp -) -{ - switch (opt) { - default: - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - case TCSADRAIN: - if (ioctl( fd, RTEMS_IO_TCDRAIN, NULL ) < 0) - return -1; - /* - * Fall through to.... - */ - case TCSANOW: - return ioctl( fd, RTEMS_IO_SET_ATTRIBUTES, tp ); - } -} -#endif diff --git a/c/src/lib/libc/tcsetpgrp.c b/c/src/lib/libc/tcsetpgrp.c deleted file mode 100644 index 25d1d0403b..0000000000 --- a/c/src/lib/libc/tcsetpgrp.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * tcsetprgrp() - POSIX 1003.1b 7.2.4 - Set Foreground Process Group ID - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#if defined(RTEMS_NEWLIB) - -#include -#include -#include -#include -/* #include */ - -#include - -int tcsetprgrp(int fd, pid_t pid) -{ - return 0; -} - -#endif diff --git a/c/src/lib/libc/telldir.c b/c/src/lib/libc/telldir.c deleted file mode 100644 index 81c9606ebf..0000000000 --- a/c/src/lib/libc/telldir.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * telldir() - XXX - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include - -long telldir( - DIR *dirp -) -{ - rtems_libio_t *iop; - - if ( !dirp ) - rtems_set_errno_and_return_minus_one( EBADF ); - - /* - * Get the file control block structure associated with the - * file descriptor - */ - - iop = rtems_libio_iop( dirp->dd_fd ); - - if (iop == NULL) - assert(0); - - return (long)( iop->offset ); -} diff --git a/c/src/lib/libc/termios.c b/c/src/lib/libc/termios.c deleted file mode 100644 index 25b8f00c9a..0000000000 --- a/c/src/lib/libc/termios.c +++ /dev/null @@ -1,1502 +0,0 @@ -/* - * TERMIOS serial line support - * - * Author: - * W. Eric Norum - * Saskatchewan Accelerator Laboratory - * University of Saskatchewan - * Saskatoon, Saskatchewan, CANADA - * eric@skatter.usask.ca - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -/* - * FreeBSD does not support a full POSIX termios so we have to help it out - */ - -#if defined(__FreeBSD__) -#define XTABS 0 -#define ONLRET 0 -#define ONOCR 0 -#define TABDLY 0 -#define OLCUC 0 -#define ILCUC 0 -#define OCRNL 0 -#define IUCLC 0 -#endif - -/* - * Cygwin does not define these - */ - -#if defined(__CYGWIN__) -#define ECHOPRT 0 -#endif - -/* - * The size of the cooked buffer - */ -#define CBUFSIZE 256 - -/* - * The sizes of the raw message buffers. - * On most architectures it is quite a bit more - * efficient if these are powers of two. - */ -#define RAW_INPUT_BUFFER_SIZE 128 -#define RAW_OUTPUT_BUFFER_SIZE 64 - -/* fields for "flow_ctrl" status */ -#define FL_IREQXOF 1 /* input queue requests stop of incoming data */ -#define FL_ISNTXOF 2 /* XOFF has been sent to other side of line */ -#define FL_IRTSOFF 4 /* RTS has been turned off for other side.. */ - -#define FL_ORCVXOF 0x10 /* XOFF has been received */ -#define FL_OSTOP 0x20 /* output has been stopped due to XOFF */ - -#define FL_MDRTS 0x100 /* input controlled with RTS/CTS handshake */ -#define FL_MDXON 0x200 /* input controlled with XON/XOFF protocol */ -#define FL_MDXOF 0x400 /* output controlled with XON/XOFF protocol */ - -#define NODISC(n) \ - { NULL, NULL, NULL, NULL, \ - NULL, NULL, NULL, NULL } -/* - * FIXME: change linesw entries consistant with linesw entry usage... - */ -struct linesw linesw[MAXLDISC] = -{ - NODISC(0), /* 0- termios-built-in */ - NODISC(1), /* 1- defunct */ - NODISC(2), /* 2- NTTYDISC */ - NODISC(3), /* TABLDISC */ - NODISC(4), /* SLIPDISC */ - NODISC(5), /* PPPDISC */ - NODISC(6), /* loadable */ - NODISC(7), /* loadable */ -}; - -int nlinesw = sizeof (linesw) / sizeof (linesw[0]); - -extern struct rtems_termios_tty *rtems_termios_ttyHead; -extern struct rtems_termios_tty *rtems_termios_ttyTail; -extern rtems_id rtems_termios_ttyMutex; - -static rtems_task rtems_termios_rxdaemon(rtems_task_argument argument); -static rtems_task rtems_termios_txdaemon(rtems_task_argument argument); -/* - * some constants for I/O daemon task creation - */ -#define TERMIOS_TXTASK_PRIO 10 -#define TERMIOS_RXTASK_PRIO 9 -#define TERMIOS_TXTASK_STACKSIZE 1024 -#define TERMIOS_RXTASK_STACKSIZE 1024 -/* - * some events to be sent to the I/O tasks - */ -#define TERMIOS_TX_START_EVENT RTEMS_EVENT_1 -#define TERMIOS_TX_TERMINATE_EVENT RTEMS_EVENT_0 - -#define TERMIOS_RX_PROC_EVENT RTEMS_EVENT_1 -#define TERMIOS_RX_TERMINATE_EVENT RTEMS_EVENT_0 - -/* - * Open a termios device - */ -rtems_status_code -rtems_termios_open ( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg, - const rtems_termios_callbacks *callbacks - ) -{ - rtems_status_code sc; - rtems_libio_open_close_args_t *args = arg; - struct rtems_termios_tty *tty; - - /* - * See if the device has already been opened - */ - sc = rtems_semaphore_obtain (rtems_termios_ttyMutex, - RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - return sc; - for (tty = rtems_termios_ttyHead ; tty != NULL ; tty = tty->forw) { - if ((tty->major == major) && (tty->minor == minor)) - break; - } - if (tty == NULL) { - static char c = 'a'; - - /* - * Create a new device - */ - tty = calloc (1, sizeof (struct rtems_termios_tty)); - if (tty == NULL) { - rtems_semaphore_release (rtems_termios_ttyMutex); - return RTEMS_NO_MEMORY; - } - /* - * allocate raw input buffer - */ - tty->rawInBuf.Size = RAW_INPUT_BUFFER_SIZE; - tty->rawInBuf.theBuf = malloc (tty->rawInBuf.Size); - if (tty->rawInBuf.theBuf == NULL) { - free(tty); - rtems_semaphore_release (rtems_termios_ttyMutex); - return RTEMS_NO_MEMORY; - } - /* - * allocate raw output buffer - */ - tty->rawOutBuf.Size = RAW_OUTPUT_BUFFER_SIZE; - tty->rawOutBuf.theBuf = malloc (tty->rawOutBuf.Size); - if (tty->rawInBuf.theBuf == NULL) { - free((void *)(tty->rawInBuf.theBuf)); - free(tty); - rtems_semaphore_release (rtems_termios_ttyMutex); - return RTEMS_NO_MEMORY; - } - /* - * allocate cooked buffer - */ - tty->cbuf = malloc (CBUFSIZE); - if (tty->cbuf == NULL) { - free((void *)(tty->rawOutBuf.theBuf)); - free((void *)(tty->rawInBuf.theBuf)); - free(tty); - rtems_semaphore_release (rtems_termios_ttyMutex); - return RTEMS_NO_MEMORY; - } - /* - * Initialize wakeup callbacks - */ - tty->tty_snd.sw_pfn = NULL; - tty->tty_snd.sw_arg = NULL; - tty->tty_rcv.sw_pfn = NULL; - tty->tty_rcv.sw_arg = NULL; - tty->tty_rcvwakeup = 0; - - /* - * link tty - */ - tty->forw = rtems_termios_ttyHead; - tty->back = NULL; - if (rtems_termios_ttyHead != NULL) - rtems_termios_ttyHead->back = tty; - rtems_termios_ttyHead = tty; - if (rtems_termios_ttyTail == NULL) - rtems_termios_ttyTail = tty; - - tty->minor = minor; - tty->major = major; - - /* - * Set up mutex semaphores - */ - sc = rtems_semaphore_create ( - rtems_build_name ('T', 'R', 'i', c), - 1, - RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY, - RTEMS_NO_PRIORITY, - &tty->isem); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - sc = rtems_semaphore_create ( - rtems_build_name ('T', 'R', 'o', c), - 1, - RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY, - RTEMS_NO_PRIORITY, - &tty->osem); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - sc = rtems_semaphore_create ( - rtems_build_name ('T', 'R', 'x', c), - 0, - RTEMS_SIMPLE_BINARY_SEMAPHORE | RTEMS_FIFO, - RTEMS_NO_PRIORITY, - &tty->rawOutBuf.Semaphore); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - tty->rawOutBufState = rob_idle; - - /* - * Set callbacks - */ - tty->device = *callbacks; - - /* - * Create I/O tasks - */ - if (tty->device.outputUsesInterrupts == TERMIOS_TASK_DRIVEN) { - sc = rtems_task_create ( - rtems_build_name ('T', 'x', 'T', c), - TERMIOS_TXTASK_PRIO, - TERMIOS_TXTASK_STACKSIZE, - RTEMS_NO_PREEMPT | RTEMS_NO_TIMESLICE | - RTEMS_NO_ASR, - RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL, - &tty->txTaskId); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - sc = rtems_task_create ( - rtems_build_name ('R', 'x', 'T', c), - TERMIOS_RXTASK_PRIO, - TERMIOS_RXTASK_STACKSIZE, - RTEMS_NO_PREEMPT | RTEMS_NO_TIMESLICE | - RTEMS_NO_ASR, - RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL, - &tty->rxTaskId); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - - } - if ((tty->device.pollRead == NULL) || - (tty->device.outputUsesInterrupts == TERMIOS_TASK_DRIVEN)){ - sc = rtems_semaphore_create ( - rtems_build_name ('T', 'R', 'r', c), - 0, - RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY, - RTEMS_NO_PRIORITY, - &tty->rawInBuf.Semaphore); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - } - - /* - * Set default parameters - */ - tty->termios.c_iflag = BRKINT | ICRNL | IXON | IMAXBEL; - tty->termios.c_oflag = OPOST | ONLCR | XTABS; - tty->termios.c_cflag = B9600 | CS8 | CREAD | CLOCAL; - tty->termios.c_lflag = ISIG | ICANON | IEXTEN | ECHO | ECHOK | ECHOE | ECHOCTL; - - tty->termios.c_cc[VINTR] = '\003'; - tty->termios.c_cc[VQUIT] = '\034'; - tty->termios.c_cc[VERASE] = '\177'; - tty->termios.c_cc[VKILL] = '\025'; - tty->termios.c_cc[VEOF] = '\004'; - tty->termios.c_cc[VEOL] = '\000'; - tty->termios.c_cc[VEOL2] = '\000'; - tty->termios.c_cc[VSTART] = '\021'; - tty->termios.c_cc[VSTOP] = '\023'; - tty->termios.c_cc[VSUSP] = '\032'; - tty->termios.c_cc[VREPRINT] = '\022'; - tty->termios.c_cc[VDISCARD] = '\017'; - tty->termios.c_cc[VWERASE] = '\027'; - tty->termios.c_cc[VLNEXT] = '\026'; - - /* start with no flow control, clear flow control flags */ - tty->flow_ctrl = 0; - /* - * set low/highwater mark for XON/XOFF support - */ - tty->lowwater = tty->rawInBuf.Size * 1/2; - tty->highwater = tty->rawInBuf.Size * 3/4; - /* - * Bump name characer - */ - if (c++ == 'z') - c = 'a'; - - } - args->iop->data1 = tty; - if (!tty->refcount++) { - if (tty->device.firstOpen) - (*tty->device.firstOpen)(major, minor, arg); - /* - * start I/O tasks, if needed - */ - if (tty->device.outputUsesInterrupts == TERMIOS_TASK_DRIVEN) { - sc = rtems_task_start(tty->rxTaskId, - rtems_termios_rxdaemon, - (rtems_task_argument)tty); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - - sc = rtems_task_start(tty->txTaskId, - rtems_termios_txdaemon, - (rtems_task_argument)tty); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - } - } - rtems_semaphore_release (rtems_termios_ttyMutex); - return RTEMS_SUCCESSFUL; -} - -/* - * Drain output queue - */ -static void -drainOutput (struct rtems_termios_tty *tty) -{ - rtems_interrupt_level level; - rtems_status_code sc; - - if (tty->device.outputUsesInterrupts != TERMIOS_POLLED) { - rtems_interrupt_disable (level); - while (tty->rawOutBuf.Tail != tty->rawOutBuf.Head) { - tty->rawOutBufState = rob_wait; - rtems_interrupt_enable (level); - sc = rtems_semaphore_obtain (tty->rawOutBuf.Semaphore, - RTEMS_WAIT, - RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - rtems_interrupt_disable (level); - } - rtems_interrupt_enable (level); - } -} - -rtems_status_code -rtems_termios_close (void *arg) -{ - rtems_libio_open_close_args_t *args = arg; - struct rtems_termios_tty *tty = args->iop->data1; - rtems_status_code sc; - - sc = rtems_semaphore_obtain (rtems_termios_ttyMutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - if (--tty->refcount == 0) { - if (linesw[tty->t_line].l_close != NULL) { - /* - * call discipline-specific close - */ - sc = linesw[tty->t_line].l_close(tty); - } - else { - /* - * default: just flush output buffer - */ - drainOutput (tty); - } - - if (tty->device.outputUsesInterrupts - == TERMIOS_TASK_DRIVEN) { - /* - * send "terminate" to I/O tasks - */ - sc = rtems_event_send( - tty->rxTaskId, - TERMIOS_RX_TERMINATE_EVENT); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - sc = rtems_event_send( - tty->txTaskId, - TERMIOS_TX_TERMINATE_EVENT); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - } - if (tty->device.lastClose) - (*tty->device.lastClose)(tty->major, tty->minor, arg); - if (tty->forw == NULL) { - rtems_termios_ttyTail = tty->back; - if ( rtems_termios_ttyTail != NULL ) { - rtems_termios_ttyTail->forw = NULL; - } - } - else { - tty->forw->back = tty->back; - } - if (tty->back == NULL) { - rtems_termios_ttyHead = tty->forw; - if ( rtems_termios_ttyHead != NULL ) { - rtems_termios_ttyHead->back = NULL; - } - } - else { - tty->back->forw = tty->forw; - } - rtems_semaphore_delete (tty->isem); - rtems_semaphore_delete (tty->osem); - rtems_semaphore_delete (tty->rawOutBuf.Semaphore); - if ((tty->device.pollRead == NULL) || - (tty->device.outputUsesInterrupts == TERMIOS_TASK_DRIVEN)) - rtems_semaphore_delete (tty->rawInBuf.Semaphore); - free (tty->rawInBuf.theBuf); - free (tty->rawOutBuf.theBuf); - free (tty->cbuf); - free (tty); - } - rtems_semaphore_release (rtems_termios_ttyMutex); - return RTEMS_SUCCESSFUL; -} - -static void -termios_set_flowctrl(struct rtems_termios_tty *tty) -{ - rtems_interrupt_level level; - /* - * check for flow control options to be switched off - */ - - /* check for outgoing XON/XOFF flow control switched off */ - if (( tty->flow_ctrl & FL_MDXON) && - !(tty->termios.c_iflag & IXON)) { - /* clear related flags in flow_ctrl */ - tty->flow_ctrl &= ~(FL_MDXON | FL_ORCVXOF); - - /* has output been stopped due to received XOFF? */ - if (tty->flow_ctrl & FL_OSTOP) { - /* disable interrupts */ - rtems_interrupt_disable(level); - tty->flow_ctrl &= ~FL_OSTOP; - /* check for chars in output buffer (or rob_state?) */ - if (tty->rawOutBufState != rob_idle) { - /* if chars available, call write function... */ - (*tty->device.write)(tty->minor, - (char *)&tty->rawOutBuf.theBuf[tty->rawOutBuf.Tail],1); - } - /* reenable interrupts */ - rtems_interrupt_enable(level); - } - } - /* check for incoming XON/XOFF flow control switched off */ - if (( tty->flow_ctrl & FL_MDXOF) && - !(tty->termios.c_iflag & IXOFF)) { - /* clear related flags in flow_ctrl */ - tty->flow_ctrl &= ~(FL_MDXOF); - /* FIXME: what happens, if we had sent XOFF but not yet XON? */ - tty->flow_ctrl &= ~(FL_ISNTXOF); - } - - /* check for incoming RTS/CTS flow control switched off */ - if (( tty->flow_ctrl & FL_MDRTS) && - !(tty->termios.c_cflag & CRTSCTS)) { - /* clear related flags in flow_ctrl */ - tty->flow_ctrl &= ~(FL_MDRTS); - - /* restart remote Tx, if it was stopped */ - if ((tty->flow_ctrl & FL_IRTSOFF) && - (tty->device.startRemoteTx != NULL)) { - tty->device.startRemoteTx(tty->minor); - } - tty->flow_ctrl &= ~(FL_IRTSOFF); - } - - /* - * check for flow control options to be switched on - */ - /* check for incoming RTS/CTS flow control switched on */ - if (tty->termios.c_cflag & CRTSCTS) { - tty->flow_ctrl |= FL_MDRTS; - } - /* check for incoming XON/XOF flow control switched on */ - if (tty->termios.c_iflag & IXOFF) { - tty->flow_ctrl |= FL_MDXOF; - } - /* check for outgoing XON/XOF flow control switched on */ - if (tty->termios.c_iflag & IXON) { - tty->flow_ctrl |= FL_MDXON; - } -} - -rtems_status_code -rtems_termios_ioctl (void *arg) -{ - rtems_libio_ioctl_args_t *args = arg; - struct rtems_termios_tty *tty = args->iop->data1; - struct ttywakeup *wakeup = (struct ttywakeup *)args->buffer; - rtems_status_code sc; - - args->ioctl_return = 0; - sc = rtems_semaphore_obtain (tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) { - args->ioctl_return = sc; - return sc; - } - switch (args->command) { - default: - if (linesw[tty->t_line].l_ioctl != NULL) { - sc = linesw[tty->t_line].l_ioctl(tty,args); - } - else { - sc = RTEMS_INVALID_NUMBER; - } - break; - - case RTEMS_IO_GET_ATTRIBUTES: - *(struct termios *)args->buffer = tty->termios; - break; - - case RTEMS_IO_SET_ATTRIBUTES: - tty->termios = *(struct termios *)args->buffer; - - /* check for and process change in flow control options */ - termios_set_flowctrl(tty); - - if (tty->termios.c_lflag & ICANON) { - tty->rawInBufSemaphoreOptions = RTEMS_WAIT; - tty->rawInBufSemaphoreTimeout = RTEMS_NO_TIMEOUT; - tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT; - } - else { - rtems_interval ticksPerSecond; - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticksPerSecond); - tty->vtimeTicks = tty->termios.c_cc[VTIME] * ticksPerSecond / 10; - if (tty->termios.c_cc[VTIME]) { - tty->rawInBufSemaphoreOptions = RTEMS_WAIT; - tty->rawInBufSemaphoreTimeout = tty->vtimeTicks; - if (tty->termios.c_cc[VMIN]) - tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT; - else - tty->rawInBufSemaphoreFirstTimeout = tty->vtimeTicks; - } - else { - if (tty->termios.c_cc[VMIN]) { - tty->rawInBufSemaphoreOptions = RTEMS_WAIT; - tty->rawInBufSemaphoreTimeout = RTEMS_NO_TIMEOUT; - tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT; - } - else { - tty->rawInBufSemaphoreOptions = RTEMS_NO_WAIT; - } - } - } - if (tty->device.setAttributes) - (*tty->device.setAttributes)(tty->minor, &tty->termios); - break; - - case RTEMS_IO_TCDRAIN: - drainOutput (tty); - break; - - case RTEMS_IO_SNDWAKEUP: - tty->tty_snd = *wakeup; - break; - - case RTEMS_IO_RCVWAKEUP: - tty->tty_rcv = *wakeup; - break; - - /* - * FIXME: add various ioctl code handlers - */ - -#if 1 /* FIXME */ - case TIOCSETD: - /* - * close old line discipline - */ - if (linesw[tty->t_line].l_close != NULL) { - sc = linesw[tty->t_line].l_close(tty); - } - tty->t_line=*(int*)(args->buffer); - tty->t_sc = NULL; /* ensure that no more valid data */ - /* - * open new line discipline - */ - if (linesw[tty->t_line].l_open != NULL) { - sc = linesw[tty->t_line].l_open(tty); - } - break; - case TIOCGETD: - *(int*)(args->buffer)=tty->t_line; - break; -#endif - case FIONREAD: - /* Half guess that this is the right operation */ - *(int *)args->buffer = tty->ccount - tty->cindex; - break; - } - rtems_semaphore_release (tty->osem); - args->ioctl_return = sc; - return sc; -} - -/* - * Send characters to device-specific code - */ -void -rtems_termios_puts (const char *buf, int len, struct rtems_termios_tty *tty) -{ - unsigned int newHead; - rtems_interrupt_level level; - rtems_status_code sc; - - if (tty->device.outputUsesInterrupts == TERMIOS_POLLED) { - (*tty->device.write)(tty->minor, buf, len); - return; - } - newHead = tty->rawOutBuf.Head; - while (len) { - /* - * Performance improvement could be made here. - * Copy multiple bytes to raw buffer: - * if (len > 1) && (space to buffer end, or tail > 1) - * ncopy = MIN (len, space to buffer end or tail) - * memcpy (raw buffer, buf, ncopy) - * buf += ncopy - * len -= ncopy - * - * To minimize latency, the memcpy should be done - * with interrupts enabled. - */ - newHead = (newHead + 1) % tty->rawOutBuf.Size; - rtems_interrupt_disable (level); - while (newHead == tty->rawOutBuf.Tail) { - tty->rawOutBufState = rob_wait; - rtems_interrupt_enable (level); - sc = rtems_semaphore_obtain (tty->rawOutBuf.Semaphore, - RTEMS_WAIT, - RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - rtems_interrupt_disable (level); - } - tty->rawOutBuf.theBuf[tty->rawOutBuf.Head] = *buf++; - tty->rawOutBuf.Head = newHead; - if (tty->rawOutBufState == rob_idle) { - /* check, whether XOFF has been received */ - if (!(tty->flow_ctrl & FL_ORCVXOF)) { - (*tty->device.write)(tty->minor, - (char *)&tty->rawOutBuf.theBuf[tty->rawOutBuf.Tail],1); - } - else { - /* remember that output has been stopped due to flow ctrl*/ - tty->flow_ctrl |= FL_OSTOP; - } - tty->rawOutBufState = rob_busy; - } - rtems_interrupt_enable (level); - len--; - } -} - -/* - * Handle output processing - */ -static void -oproc (unsigned char c, struct rtems_termios_tty *tty) -{ - int i; - - if (tty->termios.c_oflag & OPOST) { - switch (c) { - case '\n': - if (tty->termios.c_oflag & ONLRET) - tty->column = 0; - if (tty->termios.c_oflag & ONLCR) { - rtems_termios_puts ("\r", 1, tty); - tty->column = 0; - } - break; - - case '\r': - if ((tty->termios.c_oflag & ONOCR) && (tty->column == 0)) - return; - if (tty->termios.c_oflag & OCRNL) { - c = '\n'; - if (tty->termios.c_oflag & ONLRET) - tty->column = 0; - break; - } - tty->column = 0; - break; - - case '\t': - i = 8 - (tty->column & 7); - if ((tty->termios.c_oflag & TABDLY) == XTABS) { - tty->column += i; - rtems_termios_puts ( " ", i, tty); - return; - } - tty->column += i; - break; - - case '\b': - if (tty->column > 0) - tty->column--; - break; - - default: - if (tty->termios.c_oflag & OLCUC) - c = toupper(c); - if (!iscntrl(c)) - tty->column++; - break; - } - } - rtems_termios_puts (&c, 1, tty); -} - -rtems_status_code -rtems_termios_write (void *arg) -{ - rtems_libio_rw_args_t *args = arg; - struct rtems_termios_tty *tty = args->iop->data1; - rtems_status_code sc; - - sc = rtems_semaphore_obtain (tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - return sc; - if (linesw[tty->t_line].l_write != NULL) { - sc = linesw[tty->t_line].l_write(tty,args); - rtems_semaphore_release (tty->osem); - return sc; - } - if (tty->termios.c_oflag & OPOST) { - unsigned32 count = args->count; - unsigned8 *buffer = args->buffer; - while (count--) - oproc (*buffer++, tty); - args->bytes_moved = args->count; - } - else { - rtems_termios_puts (args->buffer, args->count, tty); - args->bytes_moved = args->count; - } - rtems_semaphore_release (tty->osem); - return sc; -} - -/* - * Echo a typed character - */ -static void -echo (unsigned char c, struct rtems_termios_tty *tty) -{ - if ((tty->termios.c_lflag & ECHOCTL) && iscntrl(c) && (c != '\t') && (c != '\n')) { - char echobuf[2]; - - echobuf[0] = '^'; - echobuf[1] = c ^ 0x40; - rtems_termios_puts (echobuf, 2, tty); - tty->column += 2; - } - else { - oproc (c, tty); - } -} - -/* - * Erase a character or line - * FIXME: Needs support for WERASE and ECHOPRT. - * FIXME: Some of the tests should check for IEXTEN, too. - */ -static void -erase (struct rtems_termios_tty *tty, int lineFlag) -{ - if (tty->ccount == 0) - return; - if (lineFlag) { - if (!(tty->termios.c_lflag & ECHO)) { - tty->ccount = 0; - return; - } - if (!(tty->termios.c_lflag & ECHOE)) { - tty->ccount = 0; - echo (tty->termios.c_cc[VKILL], tty); - if (tty->termios.c_lflag & ECHOK) - echo ('\n', tty); - return; - } - } - while (tty->ccount) { - unsigned char c = tty->cbuf[--tty->ccount]; - - if (tty->termios.c_lflag & ECHO) { - if (!lineFlag && !(tty->termios.c_lflag & ECHOE)) { - echo (tty->termios.c_cc[VERASE], tty); - } - else if (c == '\t') { - int col = tty->read_start_column; - int i = 0; - - /* - * Find the character before the tab - */ - while (i != tty->ccount) { - c = tty->cbuf[i++]; - if (c == '\t') { - col = (col | 7) + 1; - } - else if (iscntrl (c)) { - if (tty->termios.c_lflag & ECHOCTL) - col += 2; - } - else { - col++; - } - } - - /* - * Back up over the tab - */ - while (tty->column > col) { - rtems_termios_puts ("\b", 1, tty); - tty->column--; - } - } - else { - if (iscntrl (c) && (tty->termios.c_lflag & ECHOCTL)) { - rtems_termios_puts ("\b \b", 3, tty); - if (tty->column) - tty->column--; - } - if (!iscntrl (c) || (tty->termios.c_lflag & ECHOCTL)) { - rtems_termios_puts ("\b \b", 3, tty); - if (tty->column) - tty->column--; - } - } - } - if (!lineFlag) - break; - } -} - -/* - * Process a single input character - */ -static int -iproc (unsigned char c, struct rtems_termios_tty *tty) -{ - if (tty->termios.c_iflag & ISTRIP) - c &= 0x7f; - if (tty->termios.c_iflag & IUCLC) - c = tolower (c); - if (c == '\r') { - if (tty->termios.c_iflag & IGNCR) - return 0; - if (tty->termios.c_iflag & ICRNL) - c = '\n'; - } - else if ((c == '\n') && (tty->termios.c_iflag & INLCR)) { - c = '\r'; - } - if ((c != '\0') && (tty->termios.c_lflag & ICANON)) { - if (c == tty->termios.c_cc[VERASE]) { - erase (tty, 0); - return 0; - } - else if (c == tty->termios.c_cc[VKILL]) { - erase (tty, 1); - return 0; - } - else if (c == tty->termios.c_cc[VEOF]) { - return 1; - } - else if (c == '\n') { - if (tty->termios.c_lflag & (ECHO | ECHONL)) - echo (c, tty); - tty->cbuf[tty->ccount++] = c; - return 1; - } - else if ((c == tty->termios.c_cc[VEOL]) - || (c == tty->termios.c_cc[VEOL2])) { - if (tty->termios.c_lflag & ECHO) - echo (c, tty); - tty->cbuf[tty->ccount++] = c; - return 1; - } - } - - /* - * FIXME: Should do IMAXBEL handling somehow - */ - if (tty->ccount < (CBUFSIZE-1)) { - if (tty->termios.c_lflag & ECHO) - echo (c, tty); - tty->cbuf[tty->ccount++] = c; - } - return 0; -} - -/* - * Process input character, with semaphore. - */ -static int -siproc (unsigned char c, struct rtems_termios_tty *tty) -{ - int i; - - /* - * Obtain output semaphore if character will be echoed - */ - if (tty->termios.c_lflag & (ECHO|ECHOE|ECHOK|ECHONL|ECHOPRT|ECHOCTL|ECHOKE)) { - rtems_semaphore_obtain (tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - i = iproc (c, tty); - rtems_semaphore_release (tty->osem); - } - else { - i = iproc (c, tty); - } - return i; -} - -/* - * Fill the input buffer by polling the device - */ -static rtems_status_code -fillBufferPoll (struct rtems_termios_tty *tty) -{ - int n; - - if (tty->termios.c_lflag & ICANON) { - for (;;) { - n = (*tty->device.pollRead)(tty->minor); - if (n < 0) { - rtems_task_wake_after (1); - } - else { - if (siproc (n, tty)) - break; - } - } - } - else { - rtems_interval then, now; - if (!tty->termios.c_cc[VMIN] && tty->termios.c_cc[VTIME]) - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &then); - for (;;) { - n = (*tty->device.pollRead)(tty->minor); - if (n < 0) { - if (tty->termios.c_cc[VMIN]) { - if (tty->termios.c_cc[VTIME] && tty->ccount) { - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now); - if ((now - then) > tty->vtimeTicks) { - break; - } - } - } - else { - if (!tty->termios.c_cc[VTIME]) - break; - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now); - if ((now - then) > tty->vtimeTicks) { - break; - } - } - rtems_task_wake_after (1); - } - else { - siproc (n, tty); - if (tty->ccount >= tty->termios.c_cc[VMIN]) - break; - if (tty->termios.c_cc[VMIN] && tty->termios.c_cc[VTIME]) - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &then); - } - } - } - return RTEMS_SUCCESSFUL; -} - -/* - * Fill the input buffer from the raw input queue - */ -static rtems_status_code -fillBufferQueue (struct rtems_termios_tty *tty) -{ - rtems_interval timeout = tty->rawInBufSemaphoreFirstTimeout; - rtems_status_code sc; - int wait = (int)1; - - while ( wait ) { - /* - * Process characters read from raw queue - */ - while (tty->rawInBuf.Head != tty->rawInBuf.Tail) { - unsigned char c; - unsigned int newHead; - - newHead = (tty->rawInBuf.Head + 1) % tty->rawInBuf.Size; - c = tty->rawInBuf.theBuf[newHead]; - tty->rawInBuf.Head = newHead; - if(((tty->rawInBuf.Tail-newHead+tty->rawInBuf.Size) - % tty->rawInBuf.Size) - < tty->lowwater) { - tty->flow_ctrl &= ~FL_IREQXOF; - /* if tx stopped and XON should be sent... */ - if (((tty->flow_ctrl & (FL_MDXON | FL_ISNTXOF)) - == (FL_MDXON | FL_ISNTXOF)) - && ((tty->rawOutBufState == rob_idle) - || (tty->flow_ctrl & FL_OSTOP))) { - /* XON should be sent now... */ - (*tty->device.write)(tty->minor, - &(tty->termios.c_cc[VSTART]), - 1); - } - else if (tty->flow_ctrl & FL_MDRTS) { - tty->flow_ctrl &= ~FL_IRTSOFF; - /* activate RTS line */ - if (tty->device.startRemoteTx != NULL) { - tty->device.startRemoteTx(tty->minor); - } - } - } - - /* continue processing new character */ - if (tty->termios.c_lflag & ICANON) { - if (siproc (c, tty)) - wait = 0; - } - else { - siproc (c, tty); - if (tty->ccount >= tty->termios.c_cc[VMIN]) - wait = 0; - } - timeout = tty->rawInBufSemaphoreTimeout; - } - - /* - * Wait for characters - */ - if ( wait ) { - sc = rtems_semaphore_obtain (tty->rawInBuf.Semaphore, - tty->rawInBufSemaphoreOptions, - timeout); - if (sc != RTEMS_SUCCESSFUL) - break; - } - } - return RTEMS_SUCCESSFUL; -} - -rtems_status_code -rtems_termios_read (void *arg) -{ - rtems_libio_rw_args_t *args = arg; - struct rtems_termios_tty *tty = args->iop->data1; - unsigned32 count = args->count; - unsigned8 *buffer = args->buffer; - rtems_status_code sc; - - sc = rtems_semaphore_obtain (tty->isem, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - return sc; - if (linesw[tty->t_line].l_read != NULL) { - sc = linesw[tty->t_line].l_read(tty,args); - tty->tty_rcvwakeup = 0; - rtems_semaphore_release (tty->isem); - return sc; - } - if (tty->cindex == tty->ccount) { - tty->cindex = tty->ccount = 0; - tty->read_start_column = tty->column; - if (tty->device.pollRead != NULL - && tty->device.outputUsesInterrupts == TERMIOS_POLLED) - sc = fillBufferPoll (tty); - else - sc = fillBufferQueue (tty); - if (sc != RTEMS_SUCCESSFUL) - tty->cindex = tty->ccount = 0; - } - while (count && (tty->cindex < tty->ccount)) { - *buffer++ = tty->cbuf[tty->cindex++]; - count--; - } - args->bytes_moved = args->count - count; - tty->tty_rcvwakeup = 0; - rtems_semaphore_release (tty->isem); - return sc; -} - -/* - * signal receive interrupt to rx daemon - * NOTE: This routine runs in the context of the - * device receive interrupt handler. - */ -void rtems_termios_rxirq_occured(struct rtems_termios_tty *tty) -{ - /* - * send event to rx daemon task - */ - rtems_event_send(tty->rxTaskId,TERMIOS_RX_PROC_EVENT); -} - -/* - * Place characters on raw queue. - * NOTE: This routine runs in the context of the - * device receive interrupt handler. - * Returns the number of characters dropped because of overflow. - */ -int -rtems_termios_enqueue_raw_characters (void *ttyp, char *buf, int len) -{ - struct rtems_termios_tty *tty = ttyp; - unsigned int newTail; - char c; - int dropped = 0; - boolean flow_rcv = FALSE; /* TRUE, if flow control char received */ - rtems_interrupt_level level; - - if (linesw[tty->t_line].l_rint != NULL) { - while (len--) { - c = *buf++; - linesw[tty->t_line].l_rint(c,tty); - } - - /* - * check to see if rcv wakeup callback was set - */ - if (( !tty->tty_rcvwakeup ) && ( tty->tty_rcv.sw_pfn != NULL )) { - (*tty->tty_rcv.sw_pfn)(&tty->termios, tty->tty_rcv.sw_arg); - tty->tty_rcvwakeup = 1; - } - return 0; - } - - while (len--) { - c = *buf++; - /* FIXME: implement IXANY: any character restarts output */ - /* if incoming XON/XOFF controls outgoing stream: */ - if (tty->flow_ctrl & FL_MDXON) { - /* if received char is V_STOP and V_START (both are equal value) */ - if (c == tty->termios.c_cc[VSTOP]) { - if (c == tty->termios.c_cc[VSTART]) { - /* received VSTOP and VSTART==VSTOP? */ - /* then toggle "stop output" status */ - tty->flow_ctrl = tty->flow_ctrl ^ FL_ORCVXOF; - } - else { - /* VSTOP received (other code than VSTART) */ - /* stop output */ - tty->flow_ctrl |= FL_ORCVXOF; - } - flow_rcv = TRUE; - } - else if (c == tty->termios.c_cc[VSTART]) { - /* VSTART received */ - /* restart output */ - tty->flow_ctrl &= ~FL_ORCVXOF; - flow_rcv = TRUE; - } - } - if (flow_rcv) { - /* restart output according to FL_ORCVXOF flag */ - if ((tty->flow_ctrl & (FL_ORCVXOF | FL_OSTOP)) == FL_OSTOP) { - /* disable interrupts */ - rtems_interrupt_disable(level); - tty->flow_ctrl &= ~FL_OSTOP; - /* check for chars in output buffer (or rob_state?) */ - if (tty->rawOutBufState != rob_idle) { - /* if chars available, call write function... */ - (*tty->device.write)(tty->minor, - (char *)&tty->rawOutBuf.theBuf[tty->rawOutBuf.Tail], 1); - } - /* reenable interrupts */ - rtems_interrupt_enable(level); - } - } - else { - newTail = (tty->rawInBuf.Tail + 1) % tty->rawInBuf.Size; - /* if chars_in_buffer > highwater */ - rtems_interrupt_disable(level); - if ((((newTail - tty->rawInBuf.Head + tty->rawInBuf.Size) - % tty->rawInBuf.Size) - > tty->highwater) && - !(tty->flow_ctrl & FL_IREQXOF)) { - /* incoming data stream should be stopped */ - tty->flow_ctrl |= FL_IREQXOF; - if ((tty->flow_ctrl & (FL_MDXOF | FL_ISNTXOF)) - == (FL_MDXOF ) ){ - if ((tty->flow_ctrl & FL_OSTOP) || - (tty->rawOutBufState == rob_idle)) { - /* if tx is stopped due to XOFF or out of data */ - /* call write function here */ - tty->flow_ctrl |= FL_ISNTXOF; - (*tty->device.write)(tty->minor, - &(tty->termios.c_cc[VSTOP]), - 1); - } - } - else if ((tty->flow_ctrl & (FL_MDRTS | FL_IRTSOFF)) - == (FL_MDRTS ) ) { - tty->flow_ctrl |= FL_IRTSOFF; - /* deactivate RTS line */ - if (tty->device.stopRemoteTx != NULL) { - tty->device.stopRemoteTx(tty->minor); - } - } - } - /* reenable interrupts */ - rtems_interrupt_enable(level); - - if (newTail == tty->rawInBuf.Head) { - dropped++; - } - else { - tty->rawInBuf.theBuf[newTail] = c; - tty->rawInBuf.Tail = newTail; - - /* - * check to see if rcv wakeup callback was set - */ - if (( !tty->tty_rcvwakeup ) && ( tty->tty_rcv.sw_pfn != NULL )) { - (*tty->tty_rcv.sw_pfn)(&tty->termios, tty->tty_rcv.sw_arg); - tty->tty_rcvwakeup = 1; - } - } - } - } - tty->rawInBufDropped += dropped; - rtems_semaphore_release (tty->rawInBuf.Semaphore); - return dropped; -} - -/* - * in task-driven mode, this function is called in Tx task context - * in interrupt-driven mode, this function is called in TxIRQ context - */ -int -rtems_termios_refill_transmitter (struct rtems_termios_tty *tty) -{ - unsigned int newTail; - int nToSend; - rtems_interrupt_level level; - int len; - - /* check for XOF/XON to send */ - if ((tty->flow_ctrl & (FL_MDXOF | FL_IREQXOF | FL_ISNTXOF)) - == (FL_MDXOF | FL_IREQXOF)) { - /* XOFF should be sent now... */ - (*tty->device.write)(tty->minor, - &(tty->termios.c_cc[VSTOP]), 1); - - rtems_interrupt_disable(level); - tty->t_dqlen--; - tty->flow_ctrl |= FL_ISNTXOF; - rtems_interrupt_enable(level); - - nToSend = 1; - } - else if ((tty->flow_ctrl & (FL_IREQXOF | FL_ISNTXOF)) - == FL_ISNTXOF) { - /* NOTE: send XON even, if no longer in XON/XOFF mode... */ - /* XON should be sent now... */ - /* - * FIXME: this .write call will generate another - * dequeue callback. This will advance the "Tail" in the data - * buffer, although the corresponding data is not yet out! - * Therefore the dequeue "length" should be reduced by 1 - */ - (*tty->device.write)(tty->minor, - &(tty->termios.c_cc[VSTART]), 1); - - rtems_interrupt_disable(level); - tty->t_dqlen--; - tty->flow_ctrl &= ~FL_ISNTXOF; - rtems_interrupt_enable(level); - - nToSend = 1; - } - else { - if ( tty->rawOutBuf.Head == tty->rawOutBuf.Tail ) { - /* - * buffer was empty - */ - if (tty->rawOutBufState == rob_wait) { - /* - * this should never happen... - */ - rtems_semaphore_release (tty->rawOutBuf.Semaphore); - } - return 0; - } - - rtems_interrupt_disable(level); - len = tty->t_dqlen; - tty->t_dqlen = 0; - rtems_interrupt_enable(level); - - newTail = (tty->rawOutBuf.Tail + len) % tty->rawOutBuf.Size; - tty->rawOutBuf.Tail = newTail; - if (tty->rawOutBufState == rob_wait) { - /* - * wake up any pending writer task - */ - rtems_semaphore_release (tty->rawOutBuf.Semaphore); - } - if (newTail == tty->rawOutBuf.Head) { - /* - * Buffer has become empty - */ - tty->rawOutBufState = rob_idle; - nToSend = 0; - - /* - * check to see if snd wakeup callback was set - */ - if ( tty->tty_snd.sw_pfn != NULL) { - (*tty->tty_snd.sw_pfn)(&tty->termios, tty->tty_snd.sw_arg); - } - } - /* check, whether output should stop due to received XOFF */ - else if ((tty->flow_ctrl & (FL_MDXON | FL_ORCVXOF)) - == (FL_MDXON | FL_ORCVXOF)) { - /* Buffer not empty, but output stops due to XOFF */ - /* set flag, that output has been stopped */ - rtems_interrupt_disable(level); - tty->flow_ctrl |= FL_OSTOP; - tty->rawOutBufState = rob_busy; /*apm*/ - rtems_interrupt_enable(level); - nToSend = 0; - } - else { - /* - * Buffer not empty, start tranmitter - */ - if (newTail > tty->rawOutBuf.Head) - nToSend = tty->rawOutBuf.Size - newTail; - else - nToSend = tty->rawOutBuf.Head - newTail; - /* when flow control XON or XOF, don't send blocks of data */ - /* to allow fast reaction on incoming flow ctrl and low latency*/ - /* for outgoing flow control */ - if (tty->flow_ctrl & (FL_MDXON | FL_MDXOF)) { - nToSend = 1; - } - tty->rawOutBufState = rob_busy; /*apm*/ - (*tty->device.write)(tty->minor, - (char *)&tty->rawOutBuf.theBuf[newTail], - nToSend); - } - tty->rawOutBuf.Tail = newTail; /*apm*/ - } - return nToSend; -} - -/* - * Characters have been transmitted - * NOTE: This routine runs in the context of the - * device transmit interrupt handler. - * The second argument is the number of characters transmitted so far. - * This value will always be 1 for devices which generate an interrupt - * for each transmitted character. - * It returns number of characters left to transmit - */ -int -rtems_termios_dequeue_characters (void *ttyp, int len) -{ - struct rtems_termios_tty *tty = ttyp; - rtems_status_code sc; - - /* - * sum up character count already sent - */ - tty->t_dqlen += len; - - if (tty->device.outputUsesInterrupts == TERMIOS_TASK_DRIVEN) { - /* - * send wake up to transmitter task - */ - sc = rtems_event_send(tty->txTaskId, - TERMIOS_TX_START_EVENT); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - return 0; /* nothing to output in IRQ... */ - } - else if (tty->t_line == PPPDISC ) { - /* - * call any line discipline start function - */ - if (linesw[tty->t_line].l_start != NULL) { - linesw[tty->t_line].l_start(tty); - } - return 0; /* nothing to output in IRQ... */ - } - else { - return rtems_termios_refill_transmitter(tty); - } -} - -/* - * this task actually processes any transmit events - */ -static rtems_task rtems_termios_txdaemon(rtems_task_argument argument) -{ - struct rtems_termios_tty *tty = (struct rtems_termios_tty *)argument; - rtems_event_set the_event; - - while (1) { - /* - * wait for rtems event - */ - rtems_event_receive((TERMIOS_TX_START_EVENT | - TERMIOS_TX_TERMINATE_EVENT), - RTEMS_EVENT_ANY | RTEMS_WAIT, - RTEMS_NO_TIMEOUT, - &the_event); - if ((the_event & TERMIOS_TX_TERMINATE_EVENT) != 0) { - tty->txTaskId = 0; - rtems_task_delete(RTEMS_SELF); - } - else { - /* - * call any line discipline start function - */ - if (linesw[tty->t_line].l_start != NULL) { - linesw[tty->t_line].l_start(tty); - } - /* - * try to push further characters to device - */ - rtems_termios_refill_transmitter(tty); - } - } -} - -/* - * this task actually processes any receive events - */ -static rtems_task rtems_termios_rxdaemon(rtems_task_argument argument) -{ - struct rtems_termios_tty *tty = (struct rtems_termios_tty *)argument; - rtems_event_set the_event; - int c; - char c_buf; - while (1) { - /* - * wait for rtems event - */ - rtems_event_receive((TERMIOS_RX_PROC_EVENT | - TERMIOS_RX_TERMINATE_EVENT), - RTEMS_EVENT_ANY | RTEMS_WAIT, - RTEMS_NO_TIMEOUT, - &the_event); - if ((the_event & TERMIOS_RX_TERMINATE_EVENT) != 0) { - tty->rxTaskId = 0; - rtems_task_delete(RTEMS_SELF); - } - else { - /* - * do something - */ - c = tty->device.pollRead(tty->minor); - if (c != EOF) { - /* - * pollRead did call enqueue on its own - */ - c_buf = c; - rtems_termios_enqueue_raw_characters ( - tty,&c_buf,1); - } - } - } -} diff --git a/c/src/lib/libc/termiosinitialize.c b/c/src/lib/libc/termiosinitialize.c deleted file mode 100644 index 96194435c6..0000000000 --- a/c/src/lib/libc/termiosinitialize.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Termios initialization routine - * - * Author: - * W. Eric Norum - * Saskatchewan Accelerator Laboratory - * University of Saskatchewan - * Saskatoon, Saskatchewan, CANADA - * eric@skatter.usask.ca - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct rtems_termios_tty *rtems_termios_ttyHead; -struct rtems_termios_tty *rtems_termios_ttyTail; -rtems_id rtems_termios_ttyMutex; - -void -rtems_termios_initialize (void) -{ - rtems_status_code sc; - - /* - * Create the mutex semaphore for the tty list - */ - if (!rtems_termios_ttyMutex) { - sc = rtems_semaphore_create ( - rtems_build_name ('T', 'R', 'm', 'i'), - 1, - RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY, - RTEMS_NO_PRIORITY, - &rtems_termios_ttyMutex); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - } -} diff --git a/c/src/lib/libc/termiosreserveresources.c b/c/src/lib/libc/termiosreserveresources.c deleted file mode 100644 index 86bacc3d53..0000000000 --- a/c/src/lib/libc/termiosreserveresources.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Reserve enough resources to open every physical device once. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#if 0 -static int first_time; /* assumed to be zeroed by BSS initialization */ -#endif - -void rtems_termios_reserve_resources ( - rtems_configuration_table *configuration, - rtems_unsigned32 number_of_devices -) -{ -#if 0 - rtems_api_configuration_table *rtems_config; - - - if (!configuration) - rtems_fatal_error_occurred (0xFFF0F001); - rtems_config = configuration->RTEMS_api_configuration; - if (!rtems_config) - rtems_fatal_error_occurred (0xFFF0F002); - if (!first_time) - rtems_config->maximum_semaphores += 1; - first_time = 1; - rtems_config->maximum_semaphores += (4 * number_of_devices); -#endif -} - diff --git a/c/src/lib/libc/truncate.c b/c/src/lib/libc/truncate.c deleted file mode 100644 index d4f6f1613f..0000000000 --- a/c/src/lib/libc/truncate.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * truncate() - Truncate a File to the Specified Length - * - * This routine is not defined in the POSIX 1003.1b standard but is - * commonly supported on most UNIX and POSIX systems. It is provided - * for compatibility. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -int truncate( - const char *path, - off_t length -) -{ - int status; - int fd; - - fd = open( path, O_WRONLY ); - if ( fd == -1 ) - return -1; - - status = ftruncate( fd, length ); - - (void) close( fd ); - - return status; -} - diff --git a/c/src/lib/libc/ttyname.c b/c/src/lib/libc/ttyname.c deleted file mode 100644 index 08d53b2c24..0000000000 --- a/c/src/lib/libc/ttyname.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * ttyname_r() - POSIX 1003.1b 4.7.2 - Demetermine Terminal Device Name - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include <_syslist.h> -#include - -#include -#include - -int ttyname_r( - int fd, - char *name, - int namesize -) -{ - struct stat sb; - struct termios tty; - struct dirent *dirp; - DIR *dp; - struct stat dsb; - char *rval; - - /* Must be a terminal. */ - if (tcgetattr (fd, &tty) < 0) - rtems_set_errno_and_return_minus_one(EBADF); - - /* Must be a character device. */ - if (fstat (fd, &sb) || !S_ISCHR (sb.st_mode)) - rtems_set_errno_and_return_minus_one(EBADF); - - if ((dp = opendir (_PATH_DEV)) == NULL) - rtems_set_errno_and_return_minus_one(EBADF); - - for (rval = NULL; (dirp = readdir (dp)) != NULL ;) - { - if (dirp->d_ino != sb.st_ino) - continue; - strcpy (name + sizeof (_PATH_DEV) - 1, dirp->d_name); - if (stat (name, &dsb) || sb.st_dev != dsb.st_dev || - sb.st_ino != dsb.st_ino) - continue; - rval = name; - break; - } - (void) closedir (dp); - return 0; -} - -static char buf[sizeof (_PATH_DEV) + MAXNAMLEN] = _PATH_DEV; - -/* - * ttyname() - POSIX 1003.1b 4.7.2 - Demetermine Terminal Device Name - */ - -char *ttyname( - int fd -) -{ - if ( !ttyname_r( fd, buf, sizeof(buf) ) ) - return buf; - return NULL; -} - diff --git a/c/src/lib/libc/ttyname_r.c b/c/src/lib/libc/ttyname_r.c deleted file mode 100644 index 6cf4800dcb..0000000000 --- a/c/src/lib/libc/ttyname_r.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * This file was copied from newlib-1.8.2/newlib/unix/ttyname.c - * and transformed into ttyname_r(). - * - * Copyright (c) 1988 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id$ - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)ttyname.c 5.10 (Berkeley) 5/6/91"; -#endif /* LIBC_SCCS and not lint */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include <_syslist.h> -#include - -#include -#include - -/* - * ttyname_r() - POSIX 1003.1b 4.7.2 - Demetermine Terminal Device Name - */ - -int ttyname_r( - int fd, - char *name, - int namesize -) -{ - struct stat sb; - struct termios tty; - struct dirent *dirp; - DIR *dp; - struct stat dsb; - char *rval; - - /* Must be a terminal. */ - if (tcgetattr (fd, &tty) < 0) - rtems_set_errno_and_return_minus_one(EBADF); - - /* Must be a character device. */ - if (_fstat (fd, &sb) || !S_ISCHR (sb.st_mode)) - rtems_set_errno_and_return_minus_one(EBADF); - - if ((dp = opendir (_PATH_DEV)) == NULL) - rtems_set_errno_and_return_minus_one(EBADF); - - for (rval = NULL; (dirp = readdir (dp)) != NULL ;) - { - if (dirp->d_ino != sb.st_ino) - continue; - strcpy (name + sizeof (_PATH_DEV) - 1, dirp->d_name); - if (stat (name, &dsb) || sb.st_dev != dsb.st_dev || - sb.st_ino != dsb.st_ino) - continue; - (void) closedir (dp); - rval = name; - break; - } - (void) closedir (dp); - return 0; -} - -static char buf[sizeof (_PATH_DEV) + MAXNAMLEN] = _PATH_DEV; - -/* - * ttyname() - POSIX 1003.1b 4.7.2 - Demetermine Terminal Device Name - */ - -char *ttyname( - int fd -) -{ - if ( !ttyname_r( fd, buf, sizeof(buf) ) ) - return buf; - return NULL; -} - diff --git a/c/src/lib/libc/umask.c b/c/src/lib/libc/umask.c deleted file mode 100644 index fa683936ef..0000000000 --- a/c/src/lib/libc/umask.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * umask() - POSIX 1003.1b 5.3.3 - Set File Creation Mask - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include - -mode_t umask( - mode_t cmask -) -{ - mode_t old_mask; - - old_mask = rtems_filesystem_umask; - rtems_filesystem_umask = cmask; - - return old_mask; -} diff --git a/c/src/lib/libc/unixlibc.c b/c/src/lib/libc/unixlibc.c deleted file mode 100644 index f0232ce5db..0000000000 --- a/c/src/lib/libc/unixlibc.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id$ - * UNIX Port C Library Support - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -rtems_status_code rtems_io_register_name( - char *device_name, - rtems_device_major_number major, - rtems_device_minor_number minor -) -{ - return 0; /* not supported */ -} - -rtems_status_code rtems_io_lookup_name( - const char *name, - rtems_driver_name_t **device_info -) -{ - return 0; /* not supported */ -} - -#if defined(RTEMS_UNIXLIB) - -void libc_init(int reentrant) -{ -} - -#else - -/* remove ANSI errors. - * A program must contain at least one external-declaration - * (X3.159-1989 p.82,L3). - */ -void unixlibc_dummy_function( void ) -{ -} - -#endif diff --git a/c/src/lib/libc/unlink.c b/c/src/lib/libc/unlink.c deleted file mode 100644 index 09a68c9247..0000000000 --- a/c/src/lib/libc/unlink.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * unlink() - POSIX 1003.1b - 5.5.1 - Remove an existing link - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include -#include - -int unlink( - const char *path -) -{ - rtems_filesystem_location_info_t loc; - int result; - - /* - * Get the node to be unlinked. - */ - - result = rtems_filesystem_evaluate_path( path, 0, &loc, FALSE ); - if ( result != 0 ) - return -1; - - if ( !loc.ops->node_type_h ) { - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - if ( (*loc.ops->node_type_h)( &loc ) == RTEMS_FILESYSTEM_DIRECTORY ) { - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( EISDIR ); - } - - if ( !loc.ops->unlink_h ) { - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - result = (*loc.ops->unlink_h)( &loc ); - - rtems_filesystem_freenode( &loc ); - - return result; -} - -/* - * _unlink_r - * - * This is the Newlib dependent reentrant version of unlink(). - */ - -#if defined(RTEMS_NEWLIB) - -#include - -int _unlink_r( - struct _reent *ptr, - const char *path -) -{ - return unlink( path ); -} -#endif - diff --git a/c/src/lib/libc/unmount.c b/c/src/lib/libc/unmount.c deleted file mode 100644 index 9c2653378b..0000000000 --- a/c/src/lib/libc/unmount.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * unmount() - Unmount a File System - * - * This routine is not defined in the POSIX 1003.1b standard but - * in some form is supported on most UNIX and POSIX systems. This - * routine is necessary to mount instantiations of a file system - * into the file system name space. - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/* - * Data structures and routines private to mount/unmount pair. - */ - -extern Chain_Control rtems_filesystem_mount_table_control; - -int search_mt_for_mount_point( - rtems_filesystem_location_info_t *location_of_mount_point -); - -rtems_boolean rtems_filesystem_nodes_equal( - const rtems_filesystem_location_info_t *loc1, - const rtems_filesystem_location_info_t *loc2 -){ - return ( loc1->node_access == loc2->node_access ); -} - - -/* - * file_systems_below_this_mountpoint - * - * This routine will run through the entries that currently exist in the - * mount table chain. For each entry in the mount table chain it will - * compare the mount tables mt_fs_root to the new_fs_root_node. If any of the - * mount table file system root nodes matches the new file system root node - * this indicates that we are trying to mount a file system that has already - * been mounted. This is not a permitted operation. temp_loc is set to - * the root node of the file system being unmounted. - */ - -rtems_boolean file_systems_below_this_mountpoint( - const char *path, - rtems_filesystem_location_info_t *fs_root_loc, - rtems_filesystem_mount_table_entry_t *fs_to_unmount -) -{ - Chain_Node *the_node; - rtems_filesystem_mount_table_entry_t *the_mount_entry; - - /* - * Search the mount table for any mount entries referencing this - * mount entry. - */ - - for ( the_node = rtems_filesystem_mount_table_control.first; - !Chain_Is_tail( &rtems_filesystem_mount_table_control, the_node ); - the_node = the_node->next ) { - the_mount_entry = ( rtems_filesystem_mount_table_entry_t * )the_node; - if (the_mount_entry->mt_point_node.mt_entry == fs_root_loc->mt_entry ) { - return TRUE; - } - } - - return FALSE; -} - -/* - * unmount - * - * This routine will attempt to unmount the file system that has been - * is mounted a path. If the operation is successful, 0 will - * be returned to the calling routine. Otherwise, 1 will be returned. - */ - -int unmount( - const char *path -) -{ - rtems_filesystem_location_info_t loc; - rtems_filesystem_location_info_t *fs_root_loc; - rtems_filesystem_location_info_t *fs_mount_loc; - rtems_filesystem_mount_table_entry_t *mt_entry; - - /* - * Get - * The root node of the mounted filesytem. - * The node for the directory that the fileystem is mounted on. - * The mount entry that is being refered to. - */ - - if ( rtems_filesystem_evaluate_path( path, 0x0, &loc, TRUE ) ) - return -1; - - mt_entry = loc.mt_entry; - fs_mount_loc = &mt_entry->mt_point_node; - fs_root_loc = &mt_entry->mt_fs_root; - - /* - * Verify this is the root node for the file system to be unmounted. - */ - - if ( !rtems_filesystem_nodes_equal( fs_root_loc, &loc) ){ - rtems_filesystem_freenode( &loc ); - rtems_set_errno_and_return_minus_one( EACCES ); - } - - /* - * Free the loc node and just use the nodes from the mt_entry . - */ - - rtems_filesystem_freenode( &loc ); - - /* - * Verify Unmount is supported by both filesystems. - */ - - if ( !fs_mount_loc->ops->unmount_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - if ( !fs_root_loc->ops->fsunmount_me_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - - /* - * Verify the current node is not in this filesystem. - * XXX - Joel I have a question here wasn't code added - * that made the current node thread based instead - * of system based? I thought it was but it doesn't - * look like it in this version. - */ - - if ( rtems_filesystem_current.mt_entry == mt_entry ) - rtems_set_errno_and_return_minus_one( EBUSY ); - - /* - * Verify there are no file systems below the path specified - */ - - if ( file_systems_below_this_mountpoint( path, fs_root_loc, mt_entry ) != 0 ) - rtems_set_errno_and_return_minus_one( EBUSY ); - - /* - * Run the file descriptor table to determine if there are any file - * descriptors that are currently active and reference nodes in the - * file system that we are trying to unmount - */ - - if ( rtems_libio_is_open_files_in_fs( mt_entry ) == 1 ) - rtems_set_errno_and_return_minus_one( EBUSY ); - - /* - * Allow the file system being unmounted on to do its cleanup. - * If it fails it will set the errno to the approprate value - * and the fileystem will not be modified. - */ - - if (( fs_mount_loc->ops->unmount_h )( mt_entry ) != 0 ) - return -1; - - /* - * Allow the mounted filesystem to unmark the use of the root node. - * - * Run the unmount function for the subordinate file system. - * - * If we fail to unmount the filesystem remount it on the base filesystems - * directory node. - * - * NOTE: Fatal error is called in a case which should never happen - * This was response was questionable but the best we could - * come up with. - */ - - if ((fs_root_loc->ops->fsunmount_me_h )( mt_entry ) != 0){ - if (( fs_mount_loc->ops->mount_h )( mt_entry ) != 0 ) - rtems_fatal_error_occurred( 0 ); - return -1; - } - - /* - * Extract the mount table entry from the chain - */ - - Chain_Extract( ( Chain_Node * ) mt_entry ); - - /* - * Free the memory node that was allocated in mount - * Free the memory associated with the extracted mount table entry. - */ - - rtems_filesystem_freenode( fs_mount_loc ); - free( mt_entry ); - - return 0; -} - - diff --git a/c/src/lib/libc/utime.c b/c/src/lib/libc/utime.c deleted file mode 100644 index f176615231..0000000000 --- a/c/src/lib/libc/utime.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * utime() - POSIX 1003.1b 5.5.6 - Set File Access and Modification Times - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include - -#include -#include - -int utime( - const char *path, - const struct utimbuf *times -) -{ - rtems_filesystem_location_info_t temp_loc; - int result; - - if ( rtems_filesystem_evaluate_path( path, 0x00, &temp_loc, TRUE ) ) - return -1; - - if ( !temp_loc.ops->utime_h ){ - rtems_filesystem_freenode( &temp_loc ); - rtems_set_errno_and_return_minus_one( ENOTSUP ); - } - - result = (*temp_loc.ops->utime_h)( &temp_loc, times->actime, times->modtime ); - - rtems_filesystem_freenode( &temp_loc ); - - return result; -} diff --git a/c/src/lib/libc/utsname.c b/c/src/lib/libc/utsname.c deleted file mode 100644 index fe3fecac9f..0000000000 --- a/c/src/lib/libc/utsname.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -#include -#include - - -#include -#include -#include - -#include - -/*PAGE - * - * 4.4.1 Get System Name, P1003.1b-1993, p. 90 - */ - -int uname( - struct utsname *name -) -{ - /* XXX: Here is what Solaris returns... - sysname = SunOS - nodename = node_name - release = 5.3 - version = Generic_101318-12 - machine = sun4m - */ - - if ( !name ) - rtems_set_errno_and_return_minus_one( EFAULT ); - - strcpy( name->sysname, "RTEMS" ); - - sprintf( name->nodename, "Node %d", _Objects_Local_node ); - - strcpy( name->release, RTEMS_VERSION ); - - strcpy( name->version, "" ); - - sprintf( name->machine, "%s/%s", CPU_NAME, CPU_MODEL_NAME ); - - return 0; -} diff --git a/c/src/lib/libc/write.c b/c/src/lib/libc/write.c deleted file mode 100644 index 697c4c59ec..0000000000 --- a/c/src/lib/libc/write.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * write() - POSIX 1003.1b 6.4.2 - Write to a File - * - * COPYRIGHT (c) 1989-1999. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -/* - * write - * - * This routine writes count bytes from from buffer pointed to by buffer - * to the file associated with the open file descriptor, fildes. - */ - -ssize_t write( - int fd, - const void *buffer, - size_t count -) -{ - ssize_t rc; - rtems_libio_t *iop; - - rtems_libio_check_fd( fd ); - iop = rtems_libio_iop( fd ); - rtems_libio_check_is_open(iop); - rtems_libio_check_buffer( buffer ); - rtems_libio_check_count( count ); - rtems_libio_check_permissions( iop, LIBIO_FLAGS_WRITE ); - - /* - * Now process the write() request. - */ - - if ( !iop->handlers->write_h ) - rtems_set_errno_and_return_minus_one( ENOTSUP ); - - rc = (*iop->handlers->write_h)( iop, buffer, count ); - - if ( rc > 0 ) - iop->offset += rc; - - return rc; -} - -/* - * _write_r - * - * This is the Newlib dependent reentrant version of write(). - */ - -#if defined(RTEMS_NEWLIB) - -#include - -long _write_r( - struct _reent *ptr, - int fd, - const void *buf, - size_t nbytes -) -{ - return write( fd, buf, nbytes ); -} -#endif -- cgit v1.2.3